window-basic-main.hpp 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 <obs.hpp>
  16. #include <unordered_map>
  17. #include <memory>
  18. #include <QMainWindow>
  19. class QListWidgetItem;
  20. #include "ui_OBSBasic.h"
  21. class OBSBasic : public QMainWindow {
  22. Q_OBJECT
  23. private:
  24. std::unordered_map<obs_source_t, int> sourceSceneRefs;
  25. obs_scene_t GetCurrentScene();
  26. void AddSceneItem(obs_sceneitem_t item);
  27. void RemoveSceneItem(obs_sceneitem_t item);
  28. void AddScene(obs_source_t scene);
  29. void RemoveScene(obs_source_t scene);
  30. void UpdateSources(obs_scene_t scene);
  31. void UpdateSceneSelection(obs_source_t source);
  32. /* OBS Callbacks */
  33. static void SceneItemAdded(void *data, calldata_t params);
  34. static void SceneItemRemoved(void *data, calldata_t params);
  35. static void SourceAdded(void *data, calldata_t params);
  36. static void SourceDestroyed(void *data, calldata_t params);
  37. static void ChannelChanged(void *data, calldata_t params);
  38. void ResizePreview(uint32_t cx, uint32_t cy);
  39. void AddSource(obs_scene_t scene, const char *id);
  40. void AddSourcePopupMenu(const QPoint &pos);
  41. bool InitGraphics();
  42. bool InitAudio();
  43. void NewProject();
  44. void SaveProject();
  45. void LoadProject();
  46. protected:
  47. virtual void closeEvent(QCloseEvent *event);
  48. virtual void changeEvent(QEvent *event);
  49. virtual void resizeEvent(QResizeEvent *event);
  50. private slots:
  51. void on_action_New_triggered();
  52. void on_action_Open_triggered();
  53. void on_action_Save_triggered();
  54. void on_scenes_itemChanged(QListWidgetItem *item);
  55. void on_scenes_customContextMenuRequested(const QPoint &pos);
  56. void on_actionAddScene_triggered();
  57. void on_actionRemoveScene_triggered();
  58. void on_actionSceneProperties_triggered();
  59. void on_actionSceneUp_triggered();
  60. void on_actionSceneDown_triggered();
  61. void on_sources_itemChanged(QListWidgetItem *item);
  62. void on_sources_customContextMenuRequested(const QPoint &pos);
  63. void on_actionAddSource_triggered();
  64. void on_actionRemoveSource_triggered();
  65. void on_actionSourceProperties_triggered();
  66. void on_actionSourceUp_triggered();
  67. void on_actionSourceDown_triggered();
  68. void on_settingsButton_clicked();
  69. public:
  70. explicit OBSBasic(QWidget *parent = 0);
  71. ~OBSBasic();
  72. private:
  73. std::unique_ptr<Ui::OBSBasic> ui;
  74. };