1
0

window-basic-main.hpp 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242
  1. /******************************************************************************
  2. Copyright (C) 2023 by Lain 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 <QBuffer>
  16. #include <QAction>
  17. #include <QThread>
  18. #include <QWidgetAction>
  19. #include <QSystemTrayIcon>
  20. #include <QStyledItemDelegate>
  21. #include <obs.hpp>
  22. #include <vector>
  23. #include <memory>
  24. #include "window-main.hpp"
  25. #include "window-basic-interaction.hpp"
  26. #include "window-basic-vcam.hpp"
  27. #include "window-basic-properties.hpp"
  28. #include "window-basic-transform.hpp"
  29. #include "window-basic-adv-audio.hpp"
  30. #include "window-basic-filters.hpp"
  31. #include "window-missing-files.hpp"
  32. #include "window-projector.hpp"
  33. #include "window-basic-about.hpp"
  34. #include "auth-base.hpp"
  35. #include "log-viewer.hpp"
  36. #include "undo-stack-obs.hpp"
  37. #include <obs-frontend-internal.hpp>
  38. #include <util/platform.h>
  39. #include <util/threading.h>
  40. #include <util/util.hpp>
  41. #include <QPointer>
  42. class QMessageBox;
  43. class QListWidgetItem;
  44. class VolControl;
  45. class OBSBasicStats;
  46. class OBSBasicVCamConfig;
  47. #include "ui_OBSBasic.h"
  48. #include "ui_ColorSelect.h"
  49. #define DESKTOP_AUDIO_1 Str("DesktopAudioDevice1")
  50. #define DESKTOP_AUDIO_2 Str("DesktopAudioDevice2")
  51. #define AUX_AUDIO_1 Str("AuxAudioDevice1")
  52. #define AUX_AUDIO_2 Str("AuxAudioDevice2")
  53. #define AUX_AUDIO_3 Str("AuxAudioDevice3")
  54. #define AUX_AUDIO_4 Str("AuxAudioDevice4")
  55. #define SIMPLE_ENCODER_X264 "x264"
  56. #define SIMPLE_ENCODER_X264_LOWCPU "x264_lowcpu"
  57. #define SIMPLE_ENCODER_QSV "qsv"
  58. #define SIMPLE_ENCODER_QSV_AV1 "qsv_av1"
  59. #define SIMPLE_ENCODER_NVENC "nvenc"
  60. #define SIMPLE_ENCODER_NVENC_AV1 "nvenc_av1"
  61. #define SIMPLE_ENCODER_NVENC_HEVC "nvenc_hevc"
  62. #define SIMPLE_ENCODER_AMD "amd"
  63. #define SIMPLE_ENCODER_AMD_HEVC "amd_hevc"
  64. #define SIMPLE_ENCODER_AMD_AV1 "amd_av1"
  65. #define SIMPLE_ENCODER_APPLE_H264 "apple_h264"
  66. #define SIMPLE_ENCODER_APPLE_HEVC "apple_hevc"
  67. #define PREVIEW_EDGE_SIZE 10
  68. struct BasicOutputHandler;
  69. enum class QtDataRole {
  70. OBSRef = Qt::UserRole,
  71. OBSSignals,
  72. };
  73. struct SavedProjectorInfo {
  74. ProjectorType type;
  75. int monitor;
  76. std::string geometry;
  77. std::string name;
  78. bool alwaysOnTop;
  79. bool alwaysOnTopOverridden;
  80. };
  81. struct SourceCopyInfo {
  82. OBSWeakSource weak_source;
  83. bool visible;
  84. obs_sceneitem_crop crop;
  85. obs_transform_info transform;
  86. obs_blending_method blend_method;
  87. obs_blending_type blend_mode;
  88. };
  89. struct QuickTransition {
  90. QPushButton *button = nullptr;
  91. OBSSource source;
  92. obs_hotkey_id hotkey = OBS_INVALID_HOTKEY_ID;
  93. int duration = 0;
  94. int id = 0;
  95. bool fadeToBlack = false;
  96. inline QuickTransition() {}
  97. inline QuickTransition(OBSSource source_, int duration_, int id_,
  98. bool fadeToBlack_ = false)
  99. : source(source_),
  100. duration(duration_),
  101. id(id_),
  102. fadeToBlack(fadeToBlack_),
  103. renamedSignal(std::make_shared<OBSSignal>(
  104. obs_source_get_signal_handler(source), "rename",
  105. SourceRenamed, this))
  106. {
  107. }
  108. private:
  109. static void SourceRenamed(void *param, calldata_t *data);
  110. std::shared_ptr<OBSSignal> renamedSignal;
  111. };
  112. class ColorSelect : public QWidget {
  113. public:
  114. explicit ColorSelect(QWidget *parent = 0);
  115. private:
  116. std::unique_ptr<Ui::ColorSelect> ui;
  117. };
  118. class OBSBasic : public OBSMainWindow {
  119. Q_OBJECT
  120. Q_PROPERTY(QIcon imageIcon READ GetImageIcon WRITE SetImageIcon
  121. DESIGNABLE true)
  122. Q_PROPERTY(QIcon colorIcon READ GetColorIcon WRITE SetColorIcon
  123. DESIGNABLE true)
  124. Q_PROPERTY(QIcon slideshowIcon READ GetSlideshowIcon WRITE
  125. SetSlideshowIcon DESIGNABLE true)
  126. Q_PROPERTY(QIcon audioInputIcon READ GetAudioInputIcon WRITE
  127. SetAudioInputIcon DESIGNABLE true)
  128. Q_PROPERTY(QIcon audioOutputIcon READ GetAudioOutputIcon WRITE
  129. SetAudioOutputIcon DESIGNABLE true)
  130. Q_PROPERTY(QIcon desktopCapIcon READ GetDesktopCapIcon WRITE
  131. SetDesktopCapIcon DESIGNABLE true)
  132. Q_PROPERTY(QIcon windowCapIcon READ GetWindowCapIcon WRITE
  133. SetWindowCapIcon DESIGNABLE true)
  134. Q_PROPERTY(QIcon gameCapIcon READ GetGameCapIcon WRITE SetGameCapIcon
  135. DESIGNABLE true)
  136. Q_PROPERTY(QIcon cameraIcon READ GetCameraIcon WRITE SetCameraIcon
  137. DESIGNABLE true)
  138. Q_PROPERTY(QIcon textIcon READ GetTextIcon WRITE SetTextIcon
  139. DESIGNABLE true)
  140. Q_PROPERTY(QIcon mediaIcon READ GetMediaIcon WRITE SetMediaIcon
  141. DESIGNABLE true)
  142. Q_PROPERTY(QIcon browserIcon READ GetBrowserIcon WRITE SetBrowserIcon
  143. DESIGNABLE true)
  144. Q_PROPERTY(QIcon groupIcon READ GetGroupIcon WRITE SetGroupIcon
  145. DESIGNABLE true)
  146. Q_PROPERTY(QIcon sceneIcon READ GetSceneIcon WRITE SetSceneIcon
  147. DESIGNABLE true)
  148. Q_PROPERTY(QIcon defaultIcon READ GetDefaultIcon WRITE SetDefaultIcon
  149. DESIGNABLE true)
  150. Q_PROPERTY(QIcon audioProcessOutputIcon READ GetAudioProcessOutputIcon
  151. WRITE SetAudioProcessOutputIcon DESIGNABLE true)
  152. friend class OBSAbout;
  153. friend class OBSBasicPreview;
  154. friend class OBSBasicStatusBar;
  155. friend class OBSBasicSourceSelect;
  156. friend class OBSBasicTransform;
  157. friend class OBSBasicSettings;
  158. friend class Auth;
  159. friend class AutoConfig;
  160. friend class AutoConfigStreamPage;
  161. friend class RecordButton;
  162. friend class ControlsSplitButton;
  163. friend class ExtraBrowsersModel;
  164. friend class ExtraBrowsersDelegate;
  165. friend class DeviceCaptureToolbar;
  166. friend class DeviceToolbarPropertiesThread;
  167. friend class OBSBasicSourceSelect;
  168. friend class OBSYoutubeActions;
  169. friend class OBSPermissions;
  170. friend struct BasicOutputHandler;
  171. friend struct OBSStudioAPI;
  172. friend class ScreenshotObj;
  173. enum class MoveDir { Up, Down, Left, Right };
  174. enum DropType {
  175. DropType_RawText,
  176. DropType_Text,
  177. DropType_Image,
  178. DropType_Media,
  179. DropType_Html,
  180. DropType_Url,
  181. };
  182. enum ContextBarSize {
  183. ContextBarSize_Minimized,
  184. ContextBarSize_Reduced,
  185. ContextBarSize_Normal
  186. };
  187. enum class CenterType {
  188. Scene,
  189. Vertical,
  190. Horizontal,
  191. };
  192. private:
  193. obs_frontend_callbacks *api = nullptr;
  194. std::shared_ptr<Auth> auth;
  195. std::vector<VolControl *> volumes;
  196. std::vector<OBSSignal> signalHandlers;
  197. QList<QPointer<QDockWidget>> oldExtraDocks;
  198. bool loaded = false;
  199. long disableSaving = 1;
  200. bool projectChanged = false;
  201. bool previewEnabled = true;
  202. ContextBarSize contextBarSize = ContextBarSize_Normal;
  203. std::deque<SourceCopyInfo> clipboard;
  204. OBSWeakSourceAutoRelease copyFiltersSource;
  205. bool copyVisible = true;
  206. obs_transform_info copiedTransformInfo;
  207. obs_sceneitem_crop copiedCropInfo;
  208. bool hasCopiedTransform = false;
  209. OBSWeakSourceAutoRelease copySourceTransition;
  210. bool closing = false;
  211. bool clearingFailed = false;
  212. QScopedPointer<QThread> devicePropertiesThread;
  213. QScopedPointer<QThread> whatsNewInitThread;
  214. QScopedPointer<QThread> updateCheckThread;
  215. QScopedPointer<QThread> introCheckThread;
  216. QScopedPointer<QThread> logUploadThread;
  217. QPointer<OBSBasicInteraction> interaction;
  218. QPointer<OBSBasicProperties> properties;
  219. QPointer<OBSBasicTransform> transformWindow;
  220. QPointer<OBSBasicAdvAudio> advAudioWindow;
  221. QPointer<OBSBasicFilters> filters;
  222. QPointer<QDockWidget> statsDock;
  223. QPointer<OBSAbout> about;
  224. QPointer<OBSMissingFiles> missDialog;
  225. QPointer<OBSLogViewer> logView;
  226. QPointer<QTimer> cpuUsageTimer;
  227. QPointer<QTimer> diskFullTimer;
  228. QPointer<QTimer> nudge_timer;
  229. bool recent_nudge = false;
  230. os_cpu_usage_info_t *cpuUsageInfo = nullptr;
  231. OBSService service;
  232. std::unique_ptr<BasicOutputHandler> outputHandler;
  233. bool streamingStopping = false;
  234. bool recordingStopping = false;
  235. bool replayBufferStopping = false;
  236. gs_vertbuffer_t *box = nullptr;
  237. gs_vertbuffer_t *boxLeft = nullptr;
  238. gs_vertbuffer_t *boxTop = nullptr;
  239. gs_vertbuffer_t *boxRight = nullptr;
  240. gs_vertbuffer_t *boxBottom = nullptr;
  241. gs_vertbuffer_t *circle = nullptr;
  242. gs_vertbuffer_t *actionSafeMargin = nullptr;
  243. gs_vertbuffer_t *graphicsSafeMargin = nullptr;
  244. gs_vertbuffer_t *fourByThreeSafeMargin = nullptr;
  245. gs_vertbuffer_t *leftLine = nullptr;
  246. gs_vertbuffer_t *topLine = nullptr;
  247. gs_vertbuffer_t *rightLine = nullptr;
  248. int previewX = 0, previewY = 0;
  249. int previewCX = 0, previewCY = 0;
  250. float previewScale = 0.0f;
  251. ConfigFile basicConfig;
  252. std::vector<SavedProjectorInfo *> savedProjectorsArray;
  253. std::vector<OBSProjector *> projectors;
  254. QPointer<QWidget> stats;
  255. QPointer<QWidget> remux;
  256. QPointer<QWidget> extraBrowsers;
  257. QPointer<QWidget> importer;
  258. QPointer<QMenu> startStreamMenu;
  259. QPointer<QPushButton> transitionButton;
  260. QPointer<ControlsSplitButton> replayBufferButton;
  261. QScopedPointer<QPushButton> pause;
  262. QPointer<ControlsSplitButton> vcamButton;
  263. bool vcamEnabled = false;
  264. VCamConfig vcamConfig;
  265. QScopedPointer<QSystemTrayIcon> trayIcon;
  266. QPointer<QAction> sysTrayStream;
  267. QPointer<QAction> sysTrayRecord;
  268. QPointer<QAction> sysTrayReplayBuffer;
  269. QPointer<QAction> sysTrayVirtualCam;
  270. QPointer<QAction> showHide;
  271. QPointer<QAction> exit;
  272. QPointer<QMenu> trayMenu;
  273. QPointer<QMenu> previewProjector;
  274. QPointer<QMenu> studioProgramProjector;
  275. QPointer<QMenu> previewProjectorSource;
  276. QPointer<QMenu> previewProjectorMain;
  277. QPointer<QMenu> sceneProjectorMenu;
  278. QPointer<QMenu> sourceProjector;
  279. QPointer<QMenu> scaleFilteringMenu;
  280. QPointer<QMenu> blendingMethodMenu;
  281. QPointer<QMenu> blendingModeMenu;
  282. QPointer<QMenu> colorMenu;
  283. QPointer<QWidgetAction> colorWidgetAction;
  284. QPointer<ColorSelect> colorSelect;
  285. QPointer<QMenu> deinterlaceMenu;
  286. QPointer<QMenu> perSceneTransitionMenu;
  287. QPointer<QObject> shortcutFilter;
  288. QPointer<QAction> renameScene;
  289. QPointer<QAction> renameSource;
  290. QPointer<QWidget> programWidget;
  291. QPointer<QVBoxLayout> programLayout;
  292. QPointer<QLabel> programLabel;
  293. QScopedPointer<QThread> patronJsonThread;
  294. std::string patronJson;
  295. std::atomic<obs_scene_t *> currentScene = nullptr;
  296. void UpdateMultiviewProjectorMenu();
  297. void DrawBackdrop(float cx, float cy);
  298. void SetupEncoders();
  299. void CreateFirstRunSources();
  300. void CreateDefaultScene(bool firstStart);
  301. void UpdateVolumeControlsDecayRate();
  302. void UpdateVolumeControlsPeakMeterType();
  303. void ClearVolumeControls();
  304. void UploadLog(const char *subdir, const char *file, const bool crash);
  305. void Save(const char *file);
  306. void LoadData(obs_data_t *data, const char *file);
  307. void Load(const char *file);
  308. void InitHotkeys();
  309. void CreateHotkeys();
  310. void ClearHotkeys();
  311. bool InitService();
  312. bool InitBasicConfigDefaults();
  313. void InitBasicConfigDefaults2();
  314. bool InitBasicConfig();
  315. void InitOBSCallbacks();
  316. void InitPrimitives();
  317. void OnFirstLoad();
  318. OBSSceneItem GetSceneItem(QListWidgetItem *item);
  319. OBSSceneItem GetCurrentSceneItem();
  320. bool QueryRemoveSource(obs_source_t *source);
  321. void TimedCheckForUpdates();
  322. void CheckForUpdates(bool manualUpdate);
  323. void GetFPSCommon(uint32_t &num, uint32_t &den) const;
  324. void GetFPSInteger(uint32_t &num, uint32_t &den) const;
  325. void GetFPSFraction(uint32_t &num, uint32_t &den) const;
  326. void GetFPSNanoseconds(uint32_t &num, uint32_t &den) const;
  327. void GetConfigFPS(uint32_t &num, uint32_t &den) const;
  328. void UpdatePreviewScalingMenu();
  329. void LoadSceneListOrder(obs_data_array_t *array);
  330. obs_data_array_t *SaveSceneListOrder();
  331. void ChangeSceneIndex(bool relative, int idx, int invalidIdx);
  332. void TempFileOutput(const char *path, int vBitrate, int aBitrate);
  333. void TempStreamOutput(const char *url, const char *key, int vBitrate,
  334. int aBitrate);
  335. void CloseDialogs();
  336. void ClearSceneData();
  337. void ClearProjectors();
  338. void Nudge(int dist, MoveDir dir);
  339. OBSProjector *OpenProjector(obs_source_t *source, int monitor,
  340. ProjectorType type);
  341. void GetAudioSourceFilters();
  342. void GetAudioSourceProperties();
  343. void VolControlContextMenu();
  344. void ToggleVolControlLayout();
  345. void ToggleMixerLayout(bool vertical);
  346. void RefreshSceneCollections();
  347. void ChangeSceneCollection();
  348. void LogScenes();
  349. void ResetProfileData();
  350. bool AddProfile(bool create_new, const char *title, const char *text,
  351. const char *init_text = nullptr, bool rename = false);
  352. bool CreateProfile(const std::string &newName, bool create_new,
  353. bool showWizardChecked, bool rename = false);
  354. void DeleteProfile(const char *profile_name, const char *profile_dir);
  355. void RefreshProfiles();
  356. void ChangeProfile();
  357. void CheckForSimpleModeX264Fallback();
  358. void SaveProjectNow();
  359. int GetTopSelectedSourceItem();
  360. QModelIndexList GetAllSelectedSourceItems();
  361. obs_hotkey_pair_id streamingHotkeys, recordingHotkeys, pauseHotkeys,
  362. replayBufHotkeys, vcamHotkeys, togglePreviewHotkeys,
  363. contextBarHotkeys;
  364. obs_hotkey_id forceStreamingStopHotkey, splitFileHotkey;
  365. void InitDefaultTransitions();
  366. void InitTransition(obs_source_t *transition);
  367. obs_source_t *FindTransition(const char *name);
  368. OBSSource GetCurrentTransition();
  369. obs_data_array_t *SaveTransitions();
  370. void LoadTransitions(obs_data_array_t *transitions,
  371. obs_load_source_cb cb, void *private_data);
  372. obs_source_t *fadeTransition;
  373. obs_source_t *cutTransition;
  374. void CreateProgramDisplay();
  375. void CreateProgramOptions();
  376. void AddQuickTransitionId(int id);
  377. void AddQuickTransition();
  378. void AddQuickTransitionHotkey(QuickTransition *qt);
  379. void RemoveQuickTransitionHotkey(QuickTransition *qt);
  380. void LoadQuickTransitions(obs_data_array_t *array);
  381. obs_data_array_t *SaveQuickTransitions();
  382. void ClearQuickTransitionWidgets();
  383. void RefreshQuickTransitions();
  384. void DisableQuickTransitionWidgets();
  385. void EnableTransitionWidgets(bool enable);
  386. void CreateDefaultQuickTransitions();
  387. void PasteShowHideTransition(obs_sceneitem_t *item, bool show,
  388. obs_source_t *tr);
  389. QMenu *CreatePerSceneTransitionMenu();
  390. QMenu *CreateVisibilityTransitionMenu(bool visible);
  391. QuickTransition *GetQuickTransition(int id);
  392. int GetQuickTransitionIdx(int id);
  393. QMenu *CreateTransitionMenu(QWidget *parent, QuickTransition *qt);
  394. void ClearQuickTransitions();
  395. void QuickTransitionClicked();
  396. void QuickTransitionChange();
  397. void QuickTransitionChangeDuration(int value);
  398. void QuickTransitionRemoveClicked();
  399. void SetPreviewProgramMode(bool enabled);
  400. void ResizeProgram(uint32_t cx, uint32_t cy);
  401. void SetCurrentScene(obs_scene_t *scene, bool force = false);
  402. static void RenderProgram(void *data, uint32_t cx, uint32_t cy);
  403. std::vector<QuickTransition> quickTransitions;
  404. QPointer<QWidget> programOptions;
  405. QPointer<OBSQTDisplay> program;
  406. OBSWeakSource lastScene;
  407. OBSWeakSource swapScene;
  408. OBSWeakSource programScene;
  409. OBSWeakSource lastProgramScene;
  410. bool editPropertiesMode = false;
  411. bool sceneDuplicationMode = true;
  412. bool swapScenesMode = true;
  413. volatile bool previewProgramMode = false;
  414. obs_hotkey_id togglePreviewProgramHotkey = 0;
  415. obs_hotkey_id transitionHotkey = 0;
  416. obs_hotkey_id statsHotkey = 0;
  417. obs_hotkey_id screenshotHotkey = 0;
  418. obs_hotkey_id sourceScreenshotHotkey = 0;
  419. int quickTransitionIdCounter = 1;
  420. bool overridingTransition = false;
  421. int programX = 0, programY = 0;
  422. int programCX = 0, programCY = 0;
  423. float programScale = 0.0f;
  424. int disableOutputsRef = 0;
  425. inline void OnActivate(bool force = false);
  426. inline void OnDeactivate();
  427. void AddDropSource(const char *file, DropType image);
  428. void AddDropURL(const char *url, QString &name, obs_data_t *settings,
  429. const obs_video_info &ovi);
  430. void ConfirmDropUrl(const QString &url);
  431. void dragEnterEvent(QDragEnterEvent *event) override;
  432. void dragLeaveEvent(QDragLeaveEvent *event) override;
  433. void dragMoveEvent(QDragMoveEvent *event) override;
  434. void dropEvent(QDropEvent *event) override;
  435. void ReplayBufferClicked();
  436. bool sysTrayMinimizeToTray();
  437. void EnumDialogs();
  438. QList<QDialog *> visDialogs;
  439. QList<QDialog *> modalDialogs;
  440. QList<QMessageBox *> visMsgBoxes;
  441. QList<QPoint> visDlgPositions;
  442. QByteArray startingDockLayout;
  443. obs_data_array_t *SaveProjectors();
  444. void LoadSavedProjectors(obs_data_array_t *savedProjectors);
  445. void MacBranchesFetched(const QString &branch, bool manualUpdate);
  446. void ReceivedIntroJson(const QString &text);
  447. void ShowWhatsNew(const QString &url);
  448. void UpdatePreviewProgramIndicators();
  449. QStringList extraDockNames;
  450. QList<QSharedPointer<QDockWidget>> extraDocks;
  451. #ifdef BROWSER_AVAILABLE
  452. QPointer<QAction> extraBrowserMenuDocksSeparator;
  453. QList<QSharedPointer<QDockWidget>> extraBrowserDocks;
  454. QStringList extraBrowserDockTargets;
  455. void ClearExtraBrowserDocks();
  456. void LoadExtraBrowserDocks();
  457. void SaveExtraBrowserDocks();
  458. void ManageExtraBrowserDocks();
  459. void AddExtraBrowserDock(const QString &title, const QString &url,
  460. const QString &uuid, bool firstCreate);
  461. #endif
  462. QIcon imageIcon;
  463. QIcon colorIcon;
  464. QIcon slideshowIcon;
  465. QIcon audioInputIcon;
  466. QIcon audioOutputIcon;
  467. QIcon desktopCapIcon;
  468. QIcon windowCapIcon;
  469. QIcon gameCapIcon;
  470. QIcon cameraIcon;
  471. QIcon textIcon;
  472. QIcon mediaIcon;
  473. QIcon browserIcon;
  474. QIcon groupIcon;
  475. QIcon sceneIcon;
  476. QIcon defaultIcon;
  477. QIcon audioProcessOutputIcon;
  478. QIcon GetImageIcon() const;
  479. QIcon GetColorIcon() const;
  480. QIcon GetSlideshowIcon() const;
  481. QIcon GetAudioInputIcon() const;
  482. QIcon GetAudioOutputIcon() const;
  483. QIcon GetDesktopCapIcon() const;
  484. QIcon GetWindowCapIcon() const;
  485. QIcon GetGameCapIcon() const;
  486. QIcon GetCameraIcon() const;
  487. QIcon GetTextIcon() const;
  488. QIcon GetMediaIcon() const;
  489. QIcon GetBrowserIcon() const;
  490. QIcon GetDefaultIcon() const;
  491. QIcon GetAudioProcessOutputIcon() const;
  492. QSlider *tBar;
  493. bool tBarActive = false;
  494. OBSSource GetOverrideTransition(OBSSource source);
  495. int GetOverrideTransitionDuration(OBSSource source);
  496. void UpdateProjectorHideCursor();
  497. void UpdateProjectorAlwaysOnTop(bool top);
  498. void ResetProjectors();
  499. QPointer<QObject> screenshotData;
  500. void MoveSceneItem(enum obs_order_movement movement,
  501. const QString &action_name);
  502. bool autoStartBroadcast = true;
  503. bool autoStopBroadcast = true;
  504. bool broadcastActive = false;
  505. bool broadcastReady = false;
  506. QPointer<QThread> youtubeStreamCheckThread;
  507. #if YOUTUBE_ENABLED
  508. void YoutubeStreamCheck(const std::string &key);
  509. void ShowYouTubeAutoStartWarning();
  510. void YouTubeActionDialogOk(const QString &id, const QString &key,
  511. bool autostart, bool autostop,
  512. bool start_now);
  513. #endif
  514. void BroadcastButtonClicked();
  515. void SetBroadcastFlowEnabled(bool enabled);
  516. void UpdatePreviewSafeAreas();
  517. bool drawSafeAreas = false;
  518. void CenterSelectedSceneItems(const CenterType &centerType);
  519. void ShowMissingFilesDialog(obs_missing_files_t *files);
  520. QColor selectionColor;
  521. QColor cropColor;
  522. QColor hoverColor;
  523. QColor GetCropColor() const;
  524. QColor GetHoverColor() const;
  525. void UpdatePreviewSpacingHelpers();
  526. bool drawSpacingHelpers = true;
  527. float GetDevicePixelRatio();
  528. void SourceToolBarActionsSetEnabled();
  529. std::string lastScreenshot;
  530. std::string lastReplay;
  531. void UpdatePreviewOverflowSettings();
  532. public slots:
  533. void DeferSaveBegin();
  534. void DeferSaveEnd();
  535. void DisplayStreamStartError();
  536. void SetupBroadcast();
  537. void StartStreaming();
  538. void StopStreaming();
  539. void ForceStopStreaming();
  540. void StreamDelayStarting(int sec);
  541. void StreamDelayStopping(int sec);
  542. void StreamingStart();
  543. void StreamStopping();
  544. void StreamingStop(int errorcode, QString last_error);
  545. void StartRecording();
  546. void StopRecording();
  547. void RecordingStart();
  548. void RecordStopping();
  549. void RecordingStop(int code, QString last_error);
  550. void RecordingFileChanged(QString lastRecordingPath);
  551. void ShowReplayBufferPauseWarning();
  552. void StartReplayBuffer();
  553. void StopReplayBuffer();
  554. void ReplayBufferStart();
  555. void ReplayBufferSave();
  556. void ReplayBufferSaved();
  557. void ReplayBufferStopping();
  558. void ReplayBufferStop(int code);
  559. void StartVirtualCam();
  560. void StopVirtualCam();
  561. void OnVirtualCamStart();
  562. void OnVirtualCamStop(int code);
  563. void SaveProjectDeferred();
  564. void SaveProject();
  565. void SetTransition(OBSSource transition);
  566. void OverrideTransition(OBSSource transition);
  567. void TransitionToScene(OBSScene scene, bool force = false);
  568. void TransitionToScene(OBSSource scene, bool force = false,
  569. bool quickTransition = false,
  570. int quickDuration = 0, bool black = false,
  571. bool manual = false);
  572. void SetCurrentScene(OBSSource scene, bool force = false);
  573. bool AddSceneCollection(bool create_new,
  574. const QString &name = QString());
  575. bool NewProfile(const QString &name);
  576. bool DuplicateProfile(const QString &name);
  577. void DeleteProfile(const QString &profileName);
  578. void UpdatePatronJson(const QString &text, const QString &error);
  579. void ShowContextBar();
  580. void HideContextBar();
  581. void PauseRecording();
  582. void UnpauseRecording();
  583. private slots:
  584. void on_actionMainUndo_triggered();
  585. void on_actionMainRedo_triggered();
  586. void AddSceneItem(OBSSceneItem item);
  587. void AddScene(OBSSource source);
  588. void RemoveScene(OBSSource source);
  589. void RenameSources(OBSSource source, QString newName, QString prevName);
  590. void ActivateAudioSource(OBSSource source);
  591. void DeactivateAudioSource(OBSSource source);
  592. void DuplicateSelectedScene();
  593. void RemoveSelectedScene();
  594. void ToggleAlwaysOnTop();
  595. void ReorderSources(OBSScene scene);
  596. void RefreshSources(OBSScene scene);
  597. void ProcessHotkey(obs_hotkey_id id, bool pressed);
  598. void AddTransition();
  599. void RenameTransition();
  600. void TransitionClicked();
  601. void TransitionStopped();
  602. void TransitionFullyStopped();
  603. void TriggerQuickTransition(int id);
  604. void SetDeinterlacingMode();
  605. void SetDeinterlacingOrder();
  606. void SetScaleFilter();
  607. void SetBlendingMethod();
  608. void SetBlendingMode();
  609. void IconActivated(QSystemTrayIcon::ActivationReason reason);
  610. void SetShowing(bool showing);
  611. void ToggleShowHide();
  612. void HideAudioControl();
  613. void UnhideAllAudioControls();
  614. void ToggleHideMixer();
  615. void MixerRenameSource();
  616. void on_vMixerScrollArea_customContextMenuRequested();
  617. void on_hMixerScrollArea_customContextMenuRequested();
  618. void on_actionCopySource_triggered();
  619. void on_actionPasteRef_triggered();
  620. void on_actionPasteDup_triggered();
  621. void on_actionCopyFilters_triggered();
  622. void on_actionPasteFilters_triggered();
  623. void ColorChange();
  624. SourceTreeItem *GetItemWidgetFromSceneItem(obs_sceneitem_t *sceneItem);
  625. void on_actionShowAbout_triggered();
  626. void AudioMixerCopyFilters();
  627. void AudioMixerPasteFilters();
  628. void EnablePreview();
  629. void DisablePreview();
  630. void SceneCopyFilters();
  631. void ScenePasteFilters();
  632. void CheckDiskSpaceRemaining();
  633. void OpenSavedProjector(SavedProjectorInfo *info);
  634. void ScenesReordered();
  635. void ResetStatsHotkey();
  636. void SetImageIcon(const QIcon &icon);
  637. void SetColorIcon(const QIcon &icon);
  638. void SetSlideshowIcon(const QIcon &icon);
  639. void SetAudioInputIcon(const QIcon &icon);
  640. void SetAudioOutputIcon(const QIcon &icon);
  641. void SetDesktopCapIcon(const QIcon &icon);
  642. void SetWindowCapIcon(const QIcon &icon);
  643. void SetGameCapIcon(const QIcon &icon);
  644. void SetCameraIcon(const QIcon &icon);
  645. void SetTextIcon(const QIcon &icon);
  646. void SetMediaIcon(const QIcon &icon);
  647. void SetBrowserIcon(const QIcon &icon);
  648. void SetGroupIcon(const QIcon &icon);
  649. void SetSceneIcon(const QIcon &icon);
  650. void SetDefaultIcon(const QIcon &icon);
  651. void SetAudioProcessOutputIcon(const QIcon &icon);
  652. void TBarChanged(int value);
  653. void TBarReleased();
  654. void LockVolumeControl(bool lock);
  655. void ResetProxyStyleSliders();
  656. void UpdateVirtualCamConfig(const VCamConfig &config);
  657. private:
  658. /* OBS Callbacks */
  659. static void SceneReordered(void *data, calldata_t *params);
  660. static void SceneRefreshed(void *data, calldata_t *params);
  661. static void SceneItemAdded(void *data, calldata_t *params);
  662. static void SourceCreated(void *data, calldata_t *params);
  663. static void SourceRemoved(void *data, calldata_t *params);
  664. static void SourceActivated(void *data, calldata_t *params);
  665. static void SourceDeactivated(void *data, calldata_t *params);
  666. static void SourceAudioActivated(void *data, calldata_t *params);
  667. static void SourceAudioDeactivated(void *data, calldata_t *params);
  668. static void SourceRenamed(void *data, calldata_t *params);
  669. static void RenderMain(void *data, uint32_t cx, uint32_t cy);
  670. void ResizePreview(uint32_t cx, uint32_t cy);
  671. void AddSource(const char *id);
  672. QMenu *CreateAddSourcePopupMenu();
  673. void AddSourcePopupMenu(const QPoint &pos);
  674. void copyActionsDynamicProperties();
  675. static void HotkeyTriggered(void *data, obs_hotkey_id id, bool pressed);
  676. void AutoRemux(QString input, bool no_show = false);
  677. void UpdatePause(bool activate = true);
  678. void UpdateReplayBuffer(bool activate = true);
  679. bool OutputPathValid();
  680. void OutputPathInvalidMessage();
  681. bool LowDiskSpace();
  682. void DiskSpaceMessage();
  683. OBSSource prevFTBSource = nullptr;
  684. float dpi = 1.0;
  685. public:
  686. OBSSource GetProgramSource();
  687. OBSScene GetCurrentScene();
  688. void SysTrayNotify(const QString &text, QSystemTrayIcon::MessageIcon n);
  689. inline OBSSource GetCurrentSceneSource()
  690. {
  691. OBSScene curScene = GetCurrentScene();
  692. return OBSSource(obs_scene_get_source(curScene));
  693. }
  694. obs_service_t *GetService();
  695. void SetService(obs_service_t *service);
  696. int GetTransitionDuration();
  697. int GetTbarPosition();
  698. inline bool IsPreviewProgramMode() const
  699. {
  700. return os_atomic_load_bool(&previewProgramMode);
  701. }
  702. inline bool VCamEnabled() const { return vcamEnabled; }
  703. bool Active() const;
  704. void ResetUI();
  705. int ResetVideo();
  706. bool ResetAudio();
  707. void AddVCamButton();
  708. void ResetOutputs();
  709. void RefreshVolumeColors();
  710. void ResetAudioDevice(const char *sourceId, const char *deviceId,
  711. const char *deviceDesc, int channel);
  712. void NewProject();
  713. void LoadProject();
  714. inline void GetDisplayRect(int &x, int &y, int &cx, int &cy)
  715. {
  716. x = previewX;
  717. y = previewY;
  718. cx = previewCX;
  719. cy = previewCY;
  720. }
  721. inline bool SavingDisabled() const { return disableSaving; }
  722. inline double GetCPUUsage() const
  723. {
  724. return os_cpu_usage_info_query(cpuUsageInfo);
  725. }
  726. void SaveService();
  727. bool LoadService();
  728. inline Auth *GetAuth() { return auth.get(); }
  729. inline void EnableOutputs(bool enable)
  730. {
  731. if (enable) {
  732. if (--disableOutputsRef < 0)
  733. disableOutputsRef = 0;
  734. } else {
  735. disableOutputsRef++;
  736. }
  737. }
  738. QMenu *AddDeinterlacingMenu(QMenu *menu, obs_source_t *source);
  739. QMenu *AddScaleFilteringMenu(QMenu *menu, obs_sceneitem_t *item);
  740. QMenu *AddBlendingMethodMenu(QMenu *menu, obs_sceneitem_t *item);
  741. QMenu *AddBlendingModeMenu(QMenu *menu, obs_sceneitem_t *item);
  742. QMenu *AddBackgroundColorMenu(QMenu *menu, QWidgetAction *widgetAction,
  743. ColorSelect *select,
  744. obs_sceneitem_t *item);
  745. void CreateSourcePopupMenu(int idx, bool preview);
  746. void UpdateTitleBar();
  747. void SystemTrayInit();
  748. void SystemTray(bool firstStarted);
  749. void OpenSavedProjectors();
  750. void CreateInteractionWindow(obs_source_t *source);
  751. void CreatePropertiesWindow(obs_source_t *source);
  752. void CreateFiltersWindow(obs_source_t *source);
  753. void CreateEditTransformWindow(obs_sceneitem_t *item);
  754. QAction *AddDockWidget(QDockWidget *dock);
  755. void AddDockWidget(QDockWidget *dock, Qt::DockWidgetArea area,
  756. bool extraBrowser = false);
  757. void RemoveDockWidget(const QString &name);
  758. static OBSBasic *Get();
  759. const char *GetCurrentOutputPath();
  760. void DeleteProjector(OBSProjector *projector);
  761. void AddProjectorMenuMonitors(QMenu *parent, QObject *target,
  762. const char *slot);
  763. QIcon GetSourceIcon(const char *id) const;
  764. QIcon GetGroupIcon() const;
  765. QIcon GetSceneIcon() const;
  766. OBSWeakSource copyFilter;
  767. void ShowStatusBarMessage(const QString &message);
  768. static OBSData
  769. BackupScene(obs_scene_t *scene,
  770. std::vector<obs_source_t *> *sources = nullptr);
  771. void CreateSceneUndoRedoAction(const QString &action_name,
  772. OBSData undo_data, OBSData redo_data);
  773. static inline OBSData
  774. BackupScene(obs_source_t *scene_source,
  775. std::vector<obs_source_t *> *sources = nullptr)
  776. {
  777. obs_scene_t *scene = obs_scene_from_source(scene_source);
  778. return BackupScene(scene, sources);
  779. }
  780. void CreateFilterPasteUndoRedoAction(const QString &text,
  781. obs_source_t *source,
  782. obs_data_array_t *undo_array,
  783. obs_data_array_t *redo_array);
  784. void UpdateEditMenu();
  785. void SetDisplayAffinity(QWindow *window);
  786. QColor GetSelectionColor() const;
  787. protected:
  788. virtual void closeEvent(QCloseEvent *event) override;
  789. #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
  790. virtual bool nativeEvent(const QByteArray &eventType, void *message,
  791. qintptr *result) override;
  792. #else
  793. virtual bool nativeEvent(const QByteArray &eventType, void *message,
  794. long *result) override;
  795. #endif
  796. virtual void changeEvent(QEvent *event) override;
  797. private slots:
  798. void on_actionFullscreenInterface_triggered();
  799. void on_actionShow_Recordings_triggered();
  800. void on_actionRemux_triggered();
  801. void on_action_Settings_triggered();
  802. void on_actionShowMacPermissions_triggered();
  803. void on_actionShowMissingFiles_triggered();
  804. void on_actionAdvAudioProperties_triggered();
  805. void on_actionMixerToolbarAdvAudio_triggered();
  806. void on_actionMixerToolbarMenu_triggered();
  807. void on_actionShowLogs_triggered();
  808. void on_actionUploadCurrentLog_triggered();
  809. void on_actionUploadLastLog_triggered();
  810. void on_actionViewCurrentLog_triggered();
  811. void on_actionCheckForUpdates_triggered();
  812. void on_actionRepair_triggered();
  813. void on_actionShowWhatsNew_triggered();
  814. void on_actionShowCrashLogs_triggered();
  815. void on_actionUploadLastCrashLog_triggered();
  816. void on_actionEditTransform_triggered();
  817. void on_actionCopyTransform_triggered();
  818. void on_actionPasteTransform_triggered();
  819. void on_actionRotate90CW_triggered();
  820. void on_actionRotate90CCW_triggered();
  821. void on_actionRotate180_triggered();
  822. void on_actionFlipHorizontal_triggered();
  823. void on_actionFlipVertical_triggered();
  824. void on_actionFitToScreen_triggered();
  825. void on_actionStretchToScreen_triggered();
  826. void on_actionCenterToScreen_triggered();
  827. void on_actionVerticalCenter_triggered();
  828. void on_actionHorizontalCenter_triggered();
  829. void on_actionSceneFilters_triggered();
  830. void on_OBSBasic_customContextMenuRequested(const QPoint &pos);
  831. void on_scenes_currentItemChanged(QListWidgetItem *current,
  832. QListWidgetItem *prev);
  833. void on_scenes_customContextMenuRequested(const QPoint &pos);
  834. void GridActionClicked();
  835. void on_actionAddScene_triggered();
  836. void on_actionRemoveScene_triggered();
  837. void on_actionSceneUp_triggered();
  838. void on_actionSceneDown_triggered();
  839. void on_sources_customContextMenuRequested(const QPoint &pos);
  840. void on_scenes_itemDoubleClicked(QListWidgetItem *item);
  841. void on_actionAddSource_triggered();
  842. void on_actionRemoveSource_triggered();
  843. void on_actionInteract_triggered();
  844. void on_actionSourceProperties_triggered();
  845. void on_actionSourceUp_triggered();
  846. void on_actionSourceDown_triggered();
  847. void on_actionMoveUp_triggered();
  848. void on_actionMoveDown_triggered();
  849. void on_actionMoveToTop_triggered();
  850. void on_actionMoveToBottom_triggered();
  851. void on_actionLockPreview_triggered();
  852. void on_scalingMenu_aboutToShow();
  853. void on_actionScaleWindow_triggered();
  854. void on_actionScaleCanvas_triggered();
  855. void on_actionScaleOutput_triggered();
  856. void on_streamButton_clicked();
  857. void on_recordButton_clicked();
  858. void VCamButtonClicked();
  859. void VCamConfigButtonClicked();
  860. void on_settingsButton_clicked();
  861. void Screenshot(OBSSource source_ = nullptr);
  862. void ScreenshotSelectedSource();
  863. void ScreenshotProgram();
  864. void ScreenshotScene();
  865. void on_actionHelpPortal_triggered();
  866. void on_actionWebsite_triggered();
  867. void on_actionDiscord_triggered();
  868. void on_preview_customContextMenuRequested();
  869. void ProgramViewContextMenuRequested();
  870. void on_previewDisabledWidget_customContextMenuRequested();
  871. void on_actionNewSceneCollection_triggered();
  872. void on_actionDupSceneCollection_triggered();
  873. void on_actionRenameSceneCollection_triggered();
  874. void on_actionRemoveSceneCollection_triggered();
  875. void on_actionImportSceneCollection_triggered();
  876. void on_actionExportSceneCollection_triggered();
  877. void on_actionNewProfile_triggered();
  878. void on_actionDupProfile_triggered();
  879. void on_actionRenameProfile_triggered();
  880. void on_actionRemoveProfile_triggered(bool skipConfirmation = false);
  881. void on_actionImportProfile_triggered();
  882. void on_actionExportProfile_triggered();
  883. void on_actionShowSettingsFolder_triggered();
  884. void on_actionShowProfileFolder_triggered();
  885. void on_actionAlwaysOnTop_triggered();
  886. void on_toggleListboxToolbars_toggled(bool visible);
  887. void on_toggleContextBar_toggled(bool visible);
  888. void on_toggleStatusBar_toggled(bool visible);
  889. void on_toggleSourceIcons_toggled(bool visible);
  890. void on_transitions_currentIndexChanged(int index);
  891. void on_transitionAdd_clicked();
  892. void on_transitionRemove_clicked();
  893. void on_transitionProps_clicked();
  894. void on_transitionDuration_valueChanged();
  895. void ShowTransitionProperties();
  896. void HideTransitionProperties();
  897. void on_modeSwitch_clicked();
  898. // Source Context Buttons
  899. void on_sourcePropertiesButton_clicked();
  900. void on_sourceFiltersButton_clicked();
  901. void on_sourceInteractButton_clicked();
  902. void on_autoConfigure_triggered();
  903. void on_stats_triggered();
  904. void on_resetUI_triggered();
  905. void on_resetDocks_triggered(bool force = false);
  906. void on_lockDocks_toggled(bool lock);
  907. void on_multiviewProjectorWindowed_triggered();
  908. void PauseToggled();
  909. void logUploadFinished(const QString &text, const QString &error);
  910. void crashUploadFinished(const QString &text, const QString &error);
  911. void openLogDialog(const QString &text, const bool crash);
  912. void updateCheckFinished();
  913. void AddSourceFromAction();
  914. void MoveSceneToTop();
  915. void MoveSceneToBottom();
  916. void EditSceneName();
  917. void EditSceneItemName();
  918. void SceneNameEdited(QWidget *editor);
  919. void OpenSceneFilters();
  920. void OpenFilters(OBSSource source = nullptr);
  921. void OpenProperties(OBSSource source = nullptr);
  922. void OpenInteraction(OBSSource source = nullptr);
  923. void OpenEditTransform(OBSSceneItem item = nullptr);
  924. void EnablePreviewDisplay(bool enable);
  925. void TogglePreview();
  926. void OpenStudioProgramProjector();
  927. void OpenPreviewProjector();
  928. void OpenSourceProjector();
  929. void OpenMultiviewProjector();
  930. void OpenSceneProjector();
  931. void OpenStudioProgramWindow();
  932. void OpenPreviewWindow();
  933. void OpenSourceWindow();
  934. void OpenSceneWindow();
  935. void StackedMixerAreaContextMenuRequested();
  936. void ResizeOutputSizeOfSource();
  937. public slots:
  938. void on_actionResetTransform_triggered();
  939. bool StreamingActive();
  940. bool RecordingActive();
  941. bool ReplayBufferActive();
  942. bool VirtualCamActive();
  943. void ClearContextBar();
  944. void UpdateContextBar(bool force = false);
  945. void UpdateContextBarDeferred(bool force = false);
  946. void UpdateContextBarVisibility();
  947. private:
  948. std::unique_ptr<Ui::OBSBasic> ui;
  949. public:
  950. /* `undo_s` needs to be declared after `ui` to prevent an uninitialized
  951. * warning for `ui` while initializing `undo_s`. */
  952. undo_stack undo_s;
  953. explicit OBSBasic(QWidget *parent = 0);
  954. virtual ~OBSBasic();
  955. virtual void OBSInit() override;
  956. virtual config_t *Config() const override;
  957. virtual int GetProfilePath(char *path, size_t size,
  958. const char *file) const override;
  959. static void InitBrowserPanelSafeBlock();
  960. };
  961. class SceneRenameDelegate : public QStyledItemDelegate {
  962. Q_OBJECT
  963. public:
  964. SceneRenameDelegate(QObject *parent);
  965. virtual void setEditorData(QWidget *editor,
  966. const QModelIndex &index) const override;
  967. protected:
  968. virtual bool eventFilter(QObject *editor, QEvent *event) override;
  969. };