window-basic-settings.hpp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. #include "ui_OBSBasicSettings.h"
  23. class OBSBasicSettings : public QDialog {
  24. Q_OBJECT
  25. private:
  26. OBSBasic *main;
  27. std::unique_ptr<Ui::OBSBasicSettings> ui;
  28. ConfigFile localeIni;
  29. bool generalChanged;
  30. bool outputsChanged;
  31. bool audioChanged;
  32. bool videoChanged;
  33. int pageIndex;
  34. bool loading;
  35. inline bool Changed() const
  36. {
  37. return generalChanged || outputsChanged || audioChanged ||
  38. videoChanged;
  39. }
  40. inline void ClearChanged()
  41. {
  42. generalChanged = false;
  43. outputsChanged = false;
  44. audioChanged = false;
  45. videoChanged = false;
  46. }
  47. void HookWidget(QWidget *widget, const char *signal, const char *slot);
  48. bool QueryChanges();
  49. void LoadGeneralSettings();
  50. void LoadOutputSettings();
  51. void LoadAudioSettings();
  52. void LoadVideoSettings();
  53. void LoadSettings(bool changedOnly);
  54. /* general */
  55. void LoadLanguageList();
  56. /* audio */
  57. void LoadListValues(QComboBox *widget, obs_property_t prop,
  58. const char *configName);
  59. void LoadAudioDevices();
  60. /* video */
  61. void LoadRendererList();
  62. void ResetDownscales(uint32_t cx, uint32_t cy);
  63. void LoadResolutionLists();
  64. void LoadFPSData();
  65. void SaveGeneralSettings();
  66. void SaveOutputSettings();
  67. void SaveAudioSettings();
  68. void SaveVideoSettings();
  69. void SaveSettings();
  70. private slots:
  71. void on_listWidget_itemSelectionChanged();
  72. void on_buttonBox_clicked(QAbstractButton *button);
  73. void on_baseResolution_editTextChanged(const QString &text);
  74. void GeneralChanged();
  75. void AudioChanged();
  76. void AudioChangedRestart();
  77. void OutputsChanged();
  78. void VideoChanged();
  79. void VideoChangedResolution();
  80. void VideoChangedRestart();
  81. protected:
  82. virtual void closeEvent(QCloseEvent *event);
  83. public:
  84. OBSBasicSettings(QWidget *parent);
  85. };