window-basic-properties.hpp 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /******************************************************************************
  2. Copyright (C) 2023 by Lain Bailey <lain@obsproject.com>
  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 <QDialog>
  16. #include <QDialogButtonBox>
  17. #include <QPointer>
  18. #include <QSplitter>
  19. #include "qt-display.hpp"
  20. #include <obs.hpp>
  21. class OBSPropertiesView;
  22. class OBSBasic;
  23. #include "ui_OBSBasicProperties.h"
  24. class OBSBasicProperties : public QDialog {
  25. Q_OBJECT
  26. private:
  27. OBSBasic *main;
  28. std::unique_ptr<Ui::OBSBasicProperties> ui;
  29. bool acceptClicked;
  30. OBSSource source;
  31. OBSSignal removedSignal;
  32. OBSSignal renamedSignal;
  33. OBSSignal updatePropertiesSignal;
  34. OBSData oldSettings;
  35. OBSPropertiesView *view;
  36. QDialogButtonBox *buttonBox;
  37. QSplitter *windowSplitter;
  38. OBSSourceAutoRelease sourceA;
  39. OBSSourceAutoRelease sourceB;
  40. OBSSourceAutoRelease sourceClone;
  41. bool direction = true;
  42. static void SourceRemoved(void *data, calldata_t *params);
  43. static void SourceRenamed(void *data, calldata_t *params);
  44. static void UpdateProperties(void *data, calldata_t *params);
  45. static void DrawPreview(void *data, uint32_t cx, uint32_t cy);
  46. static void DrawTransitionPreview(void *data, uint32_t cx, uint32_t cy);
  47. void UpdateCallback(void *obj, obs_data_t *settings);
  48. bool ConfirmQuit();
  49. int CheckSettings();
  50. void Cleanup();
  51. private slots:
  52. void on_buttonBox_clicked(QAbstractButton *button);
  53. void AddPreviewButton();
  54. public:
  55. OBSBasicProperties(QWidget *parent, OBSSource source_);
  56. ~OBSBasicProperties();
  57. void Init();
  58. protected:
  59. virtual void closeEvent(QCloseEvent *event) override;
  60. virtual bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result) override;
  61. virtual void reject() override;
  62. };