window-basic-settings.hpp 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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. ConfigFile localeIni;
  30. bool generalChanged;
  31. bool outputsChanged;
  32. bool audioChanged;
  33. bool videoChanged;
  34. int pageIndex;
  35. bool loading;
  36. OBSPropertiesView *streamProperties;
  37. void SaveCombo(QComboBox *widget, const char *section,
  38. const char *value);
  39. void SaveComboData(QComboBox *widget, const char *section,
  40. const char *value);
  41. void SaveCheckBox(QCheckBox *widget, const char *section,
  42. const char *value);
  43. void SaveEdit(QLineEdit *widget, const char *section,
  44. const char *value);
  45. void SaveSpinBox(QSpinBox *widget, const char *section,
  46. const char *value);
  47. inline bool Changed() const
  48. {
  49. return generalChanged || outputsChanged ||
  50. audioChanged || videoChanged;
  51. }
  52. inline void EnableApplyButton(bool en)
  53. {
  54. ui->buttonBox->button(QDialogButtonBox::Apply)->setEnabled(en);
  55. }
  56. inline void ClearChanged()
  57. {
  58. generalChanged = false;
  59. outputsChanged = false;
  60. audioChanged = false;
  61. videoChanged = false;
  62. EnableApplyButton(false);
  63. }
  64. void HookWidget(QWidget *widget, const char *signal, const char *slot);
  65. bool QueryChanges();
  66. void LoadServiceTypes();
  67. void LoadServiceInfo();
  68. void LoadGeneralSettings();
  69. void LoadOutputSettings();
  70. void LoadAudioSettings();
  71. void LoadVideoSettings();
  72. void LoadSettings(bool changedOnly);
  73. /* general */
  74. void LoadLanguageList();
  75. /* output */
  76. void LoadSimpleOutputSettings();
  77. /* audio */
  78. void LoadListValues(QComboBox *widget, obs_property_t prop,
  79. const char *configName);
  80. void LoadAudioDevices();
  81. /* video */
  82. void LoadRendererList();
  83. void ResetDownscales(uint32_t cx, uint32_t cy);
  84. void LoadResolutionLists();
  85. void LoadFPSData();
  86. void SaveGeneralSettings();
  87. void SaveOutputSettings();
  88. void SaveAudioSettings();
  89. void SaveVideoSettings();
  90. void SaveSettings();
  91. private slots:
  92. void on_listWidget_itemSelectionChanged();
  93. void on_buttonBox_clicked(QAbstractButton *button);
  94. void on_streamType_currentIndexChanged(int idx);
  95. void on_simpleOutputBrowse_clicked();
  96. void on_baseResolution_editTextChanged(const QString &text);
  97. void GeneralChanged();
  98. void AudioChanged();
  99. void AudioChangedRestart();
  100. void OutputsChanged();
  101. void VideoChanged();
  102. void VideoChangedResolution();
  103. void VideoChangedRestart();
  104. protected:
  105. virtual void closeEvent(QCloseEvent *event);
  106. public:
  107. OBSBasicSettings(QWidget *parent);
  108. };