window-basic-settings.hpp 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. /******************************************************************************
  2. Copyright (C) 2013 by Hugh Bailey <[email protected]>
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. ******************************************************************************/
  14. #pragma once
  15. #include <util/util.hpp>
  16. #include <QDialog>
  17. #include <memory>
  18. #include <obs.h>
  19. class OBSBasic;
  20. class QAbstractButton;
  21. class QComboBox;
  22. class OBSPropertiesView;
  23. #include "ui_OBSBasicSettings.h"
  24. class OBSBasicSettings : public QDialog {
  25. Q_OBJECT
  26. private:
  27. OBSBasic *main;
  28. std::unique_ptr<Ui::OBSBasicSettings> ui;
  29. bool generalChanged = false;
  30. bool stream1Changed = false;
  31. bool outputsChanged = false;
  32. bool audioChanged = false;
  33. bool videoChanged = false;
  34. bool advancedChanged = false;
  35. int pageIndex = 0;
  36. bool loading = true;
  37. OBSPropertiesView *streamProperties = nullptr;
  38. OBSPropertiesView *streamEncoderProps = nullptr;
  39. OBSPropertiesView *recordEncoderProps = nullptr;
  40. void SaveCombo(QComboBox *widget, const char *section,
  41. const char *value);
  42. void SaveComboData(QComboBox *widget, const char *section,
  43. const char *value);
  44. void SaveCheckBox(QAbstractButton *widget, const char *section,
  45. const char *value, bool invert = false);
  46. void SaveEdit(QLineEdit *widget, const char *section,
  47. const char *value);
  48. void SaveSpinBox(QSpinBox *widget, const char *section,
  49. const char *value);
  50. inline bool Changed() const
  51. {
  52. return generalChanged || outputsChanged || stream1Changed ||
  53. audioChanged || videoChanged || advancedChanged;
  54. }
  55. inline void EnableApplyButton(bool en)
  56. {
  57. ui->buttonBox->button(QDialogButtonBox::Apply)->setEnabled(en);
  58. }
  59. inline void ClearChanged()
  60. {
  61. generalChanged = false;
  62. stream1Changed = false;
  63. outputsChanged = false;
  64. audioChanged = false;
  65. videoChanged = false;
  66. advancedChanged= false;
  67. EnableApplyButton(false);
  68. }
  69. void HookWidget(QWidget *widget, const char *signal, const char *slot);
  70. bool QueryChanges();
  71. void LoadServiceTypes();
  72. void LoadEncoderTypes();
  73. void LoadColorRanges();
  74. void LoadGeneralSettings();
  75. void LoadStream1Settings();
  76. void LoadOutputSettings();
  77. void LoadAudioSettings();
  78. void LoadVideoSettings();
  79. void LoadAdvancedSettings();
  80. void LoadSettings(bool changedOnly);
  81. OBSPropertiesView *CreateEncoderPropertyView(const char *encoder,
  82. const char *path, bool changed = false);
  83. /* general */
  84. void LoadLanguageList();
  85. /* output */
  86. void LoadSimpleOutputSettings();
  87. void LoadAdvOutputStreamingSettings();
  88. void LoadAdvOutputStreamingEncoderProperties();
  89. void LoadAdvOutputRecordingSettings();
  90. void LoadAdvOutputRecordingEncoderProperties();
  91. void LoadAdvOutputFFmpegSettings();
  92. void LoadAdvOutputAudioSettings();
  93. /* audio */
  94. void LoadListValues(QComboBox *widget, obs_property_t *prop,
  95. const char *configName);
  96. void LoadAudioDevices();
  97. /* video */
  98. void LoadRendererList();
  99. void ResetDownscales(uint32_t cx, uint32_t cy,
  100. uint32_t out_cx, uint32_t out_cy);
  101. void LoadDownscaleFilters();
  102. void LoadResolutionLists();
  103. void LoadFPSData();
  104. void SaveGeneralSettings();
  105. void SaveStream1Settings();
  106. void SaveOutputSettings();
  107. void SaveAudioSettings();
  108. void SaveVideoSettings();
  109. void SaveAdvancedSettings();
  110. void SaveSettings();
  111. private slots:
  112. void on_simpleOutUseBufsize_toggled(bool checked);
  113. void on_simpleOutputVBitrate_valueChanged(int val);
  114. void on_listWidget_itemSelectionChanged();
  115. void on_buttonBox_clicked(QAbstractButton *button);
  116. void on_streamType_currentIndexChanged(int idx);
  117. void on_simpleOutputBrowse_clicked();
  118. void on_advOutRecPathBrowse_clicked();
  119. void on_advOutFFPathBrowse_clicked();
  120. void on_advOutEncoder_currentIndexChanged(int idx);
  121. void on_advOutRecEncoder_currentIndexChanged(int idx);
  122. void on_baseResolution_editTextChanged(const QString &text);
  123. void GeneralChanged();
  124. void AudioChanged();
  125. void AudioChangedRestart();
  126. void OutputsChanged();
  127. void Stream1Changed();
  128. void VideoChanged();
  129. void VideoChangedResolution();
  130. void VideoChangedRestart();
  131. void AdvancedChanged();
  132. void AdvancedChangedRestart();
  133. protected:
  134. virtual void closeEvent(QCloseEvent *event);
  135. public:
  136. OBSBasicSettings(QWidget *parent);
  137. };