window-basic-main.hpp 3.1 KB

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