window-basic-settings.hpp 3.4 KB

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