window-basic-settings.hpp 4.8 KB

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