21#include "mltcontroller.h"
22#include "mltxmlchecker.h"
27#include <QNetworkAccessManager>
28#include <QScopedPointer>
29#include <QSharedPointer>
33#define EXIT_RESTART (42)
34#define EXIT_RESET (43)
46class FilterController;
59class HdrPreviewWindow;
61class MainWindow :
public QMainWindow
66 enum LayoutMode { Custom = 0, Logging, Editing, Effects, Color, Audio, PlayerOnly };
68 static MainWindow &singleton();
70 void open(Mlt::Producer *producer,
bool play =
true);
71 bool continueModified();
72 bool continueJobsRunning();
73 QUndoStack *undoStack()
const;
74 bool saveXML(
const QString &filename,
bool withRelativePaths =
true);
75 static void changeTheme(
const QString &theme);
76 PlaylistDock *playlistDock()
const {
return m_playlistDock; }
77 TimelineDock *timelineDock()
const {
return m_timelineDock; }
78 FilterController *filterController()
const {
return m_filterController; }
79 Mlt::Playlist *playlist()
const;
80 bool isPlaylistValid()
const;
81 Mlt::Producer *multitrack()
const;
82 bool isMultitrackValid()
const;
84 void setFullScreen(
bool isFullScreen);
85 QString untitledFileName()
const;
86 void setProfile(
const QString &profile_name);
87 QString fileName()
const {
return m_currentFile; }
88 bool isSourceClipMyProject(QString resource = MLT.resource(),
bool withDialog =
true);
89 bool keyframesDockIsVisible()
const;
90 Player *player()
const {
return m_player; }
92 void keyPressEvent(QKeyEvent *);
93 void keyReleaseEvent(QKeyEvent *);
94 void hideSetDataDirectory();
95 QMenu *customProfileMenu()
const {
return m_customProfileMenu; }
96 QAction *actionAddCustomProfile()
const;
97 QAction *actionProfileRemove()
const;
98 QActionGroup *profileGroup()
const {
return m_profileGroup; }
99 void buildVideoModeMenu(QMenu *topMenu,
103 QAction *removeAction);
104 void newProject(
const QString &filename,
bool isProjectFolder =
false);
105 void addCustomProfile(
const QString &name, QMenu *menu, QAction *action, QActionGroup *group);
106 void removeCustomProfiles(
const QStringList &profiles, QDir &dir, QMenu *menu, QAction *action);
107 QUuid timelineClipUuid(
int trackIndex,
int clipIndex);
108 void replaceInTimeline(
const QUuid &uuid, Mlt::Producer &producer);
109 void replaceAllByHash(
const QString &hash, Mlt::Producer &producer,
bool isProxy =
false);
110 bool isClipboardNewer()
const {
return m_clipboardUpdatedAt > m_sourceUpdatedAt; }
111 int mltIndexForTrack(
int trackIndex)
const;
112 int bottomVideoTrackIndex()
const;
113 void cropSource(
const QRectF &rect);
114 void getMarkerRange(
int position,
int *start,
int *end);
115 void getSelectionRange(
int *start,
int *end);
116 Mlt::Playlist *binPlaylist();
117 void showInFiles(
const QString &filePath);
118 void turnOffHardwareDecoder();
121 void audioChannelsChanged();
122 void processingModeChanged();
123 void producerOpened(
bool withReopen =
true);
124 void profileChanged();
125 void openFailed(QString);
126 void aboutToShutDown();
127 void renameRequested();
128 void serviceInChanged(
int delta, Mlt::Service *);
129 void serviceOutChanged(
int delta, Mlt::Service *);
133 bool eventFilter(QObject *target, QEvent *event);
134 void dragEnterEvent(QDragEnterEvent *);
135 void dropEvent(QDropEvent *);
136 void closeEvent(QCloseEvent *);
137 void showEvent(QShowEvent *);
138 void hideEvent(QHideEvent *event);
139 void resizeEvent(QResizeEvent *event);
142 void connectFocusSignals();
143 void registerDebugCallback();
144 void connectUISignals();
145 void setupAndConnectUndoStack();
146 void setupAndConnectPlayerWidget();
147 void setupLayoutSwitcher();
148 void centerLayoutInRemainingToolbarSpace();
149 void setupAndConnectDocks();
150 void setupMenuFile();
151 void setupMenuView();
152 void connectVideoWidgetSignals();
153 void setupSettingsMenu();
154 void setupOpenOtherMenu();
156 void mirrorViewActionShortcuts();
157 QAction *addProfile(QActionGroup *actionGroup,
const QString &desc,
const QString &name);
158 QAction *addLayout(QActionGroup *actionGroup,
const QString &name);
159 void readPlayerSettings();
160 void readWindowSettings();
161 void writeSettings();
162 void configureVideoWidget();
163 void setCurrentFile(
const QString &filename);
164 void updateWindowTitle();
165 void changeAudioChannels(
bool checked,
int channels);
166 void changeDeinterlacer(
bool checked,
const char *method);
167 void changeInterpolation(
bool checked,
const char *method);
168 bool checkAutoSave(QString &url);
169 bool saveConvertedXmlFile(MltXmlChecker &checker, QString &fileName);
170 bool saveRepairedXmlFile(MltXmlChecker &checker, QString &fileName);
171 void setAudioChannels(
int channels);
172 void setProcessingMode(ShotcutSettings::ProcessingMode mode);
173 void showSaveError();
174 void setPreviewScale(
int scale);
175 void setVideoModeMenu();
176 void resetVideoModeMenu();
177 void resetDockCorners();
178 void showIncompatibleProjectMessage(
const QString &shotcutVersion);
179 void restartAfterChangeTheme();
181 void backupPeriodically();
182 bool confirmProfileChange();
183 bool confirmRestartExternalMonitor();
184 void resetFilterMenuIfNeeded();
185 void updateDecklinkActions();
189 QDockWidget *m_propertiesDock;
190 RecentDock *m_recentDock;
191 EncodeDock *m_encodeDock;
192 JobsDock *m_jobsDock;
193 PlaylistDock *m_playlistDock;
194 TimelineDock *m_timelineDock;
195 QString m_currentFile;
196 bool m_isKKeyPressed;
197 QUndoStack *m_undoStack;
198 QDockWidget *m_historyDock;
199 QActionGroup *m_profileGroup;
200 QActionGroup *m_externalGroup;
201 QActionGroup *m_keyerGroup;
202 QActionGroup *m_layoutGroup;
203 QActionGroup *m_previewScaleGroup;
204 FiltersDock *m_filtersDock;
205 FilterController *m_filterController;
206 ScopeController *m_scopeController;
207 QMenu *m_customProfileMenu;
208 QAction *m_decklinkHdrAction{
nullptr};
210 QStringList m_multipleFiles;
211 bool m_multipleFilesLoading;
212 bool m_isPlaylistLoaded;
213 QActionGroup *m_languagesGroup;
214 QSharedPointer<AutoSaveFile> m_autosaveFile;
215 QMutex m_autosaveMutex;
216 QTimer m_autosaveTimer;
218 QScopedPointer<QAction> m_statusBarAction;
219 QNetworkAccessManager m_network;
220 QString m_upgradeUrl;
221 KeyframesDock *m_keyframesDock;
222 QDateTime m_clipboardUpdatedAt;
223 QDateTime m_sourceUpdatedAt;
224 QDateTime m_lastBackupDateTime;
225 MarkersDock *m_markersDock;
226 NotesDock *m_notesDock;
227 SubtitlesDock *m_subtitlesDock;
228 std::unique_ptr<QWidget> m_producerWidget;
229 FilesDock *m_filesDock;
230 ElementsDock *m_elementsDock;
231 ScreenCapture *m_screenCapture;
232 HdrPreviewWindow *m_hdrPreviewWindow{
nullptr};
235 bool isCompatibleWithProcessingMode(MltXmlChecker &checker, QString &fileName,
bool &converted);
236 bool isXmlRepaired(MltXmlChecker &checker, QString &fileName);
237 bool open(QString url,
238 const Mlt::Properties * =
nullptr,
240 bool skipConvert =
false);
241 void openMultiple(
const QStringList &paths);
242 void openMultiple(
const QList<QUrl> &urls);
244 void openCut(Mlt::Producer *producer,
bool play =
false);
246 void closeProducer();
247 void showStatusMessage(QAction *action,
int timeoutSeconds = 5);
248 void showStatusMessage(
const QString &message,
249 int timeoutSeconds = 5,
250 QPalette::ColorRole role = QPalette::ToolTipBase);
251 void onStatusMessageClicked();
252 void seekPlaylist(
int start);
253 void seekTimeline(
int position,
bool seekPlayer =
true);
254 void seekKeyframes(
int position);
255 QWidget *loadProducerWidget(Mlt::Producer *producer);
256 void onProducerOpened(
bool withReopen =
true);
257 void onGpuNotSupported();
258 void onShuttle(
float x);
259 void onPropertiesDockTriggered(
bool checked =
true);
260 void onFiltersDockTriggered(
bool checked =
true);
261 void onElementsDockTriggered(
bool checked =
true);
262 bool on_actionSave_triggered();
263 void onCreateOrEditFilterOnOutput(Mlt::Filter *filter,
const QStringList &key_properties);
264 void showSettingsMenu()
const;
267 void showUpgradePrompt();
268 void on_actionAbout_Shotcut_triggered();
269 void on_actionOpenOther_triggered();
270 void onProducerChanged();
271 bool on_actionSave_As_triggered();
272 void onEncodeTriggered(
bool checked =
true);
273 void onCaptureStateChanged(
bool started);
274 void onJobsDockTriggered(
bool =
true);
275 void onRecentDockTriggered(
bool checked =
true);
276 void onPlaylistDockTriggered(
bool checked =
true);
277 void onTimelineDockTriggered(
bool checked =
true);
278 void onHistoryDockTriggered(
bool checked =
true);
279 void onKeyframesDockTriggered(
bool checked =
true);
280 void onMarkersDockTriggered(
bool =
true);
281 void onNotesDockTriggered(
bool =
true);
282 void onSubtitlesDockTriggered(
bool =
true);
283 void onFilesDockTriggered(
bool =
true);
284 void onPlaylistCreated();
285 void onPlaylistLoaded();
286 void onPlaylistCleared();
287 void onPlaylistClosed();
288 void onPlaylistModified();
289 void onMultitrackCreated();
290 void onMultitrackClosed();
291 void onMultitrackModified();
292 void onMultitrackDurationChanged();
293 void onNoteModified();
294 void onSubtitleModified();
295 void onCutModified();
296 void onProducerModified();
297 void onFilterModelChanged();
298 void updateMarkers();
299 void updateThumbnails();
300 void on_actionFAQ_triggered();
301 void on_actionForum_triggered();
302 void on_actionEnterFullScreen_triggered();
303 void on_actionRealtime_triggered(
bool checked);
304 void on_actionProgressive_triggered(
bool checked);
305 void on_actionChannels1_triggered(
bool checked);
306 void on_actionChannels2_triggered(
bool checked);
307 void on_actionChannels4_triggered(
bool checked);
308 void on_actionChannels6_triggered(
bool checked);
309 void on_actionOneField_triggered(
bool checked);
310 void on_actionYadifTemporal_triggered(
bool checked);
311 void on_actionYadifSpatial_triggered(
bool checked);
312 void on_actionBwdif_triggered(
bool checked);
313 void on_actionNearest_triggered(
bool checked);
314 void on_actionBilinear_triggered(
bool checked);
315 void on_actionBicubic_triggered(
bool checked);
316 void on_actionHyper_triggered(
bool checked);
317 void on_actionJack_triggered(
bool checked);
318 void onHdrPreviewToggled(
bool checked);
319 void onExternalTriggered(QAction *);
320 void onDecklinkHdrMetadataTriggered();
321 void onKeyerTriggered(QAction *);
322 void onProfileTriggered(QAction *);
323 void onProfileChanged();
324 void on_actionAddCustomProfile_triggered();
325 void processMultipleFiles();
326 void processSingleFile();
327 void onLanguageTriggered(QAction *);
328 void on_actionSystemTheme_triggered();
329 void on_actionSystemFusion_triggered();
330 void on_actionFusionDark_triggered();
331 void on_actionJobPriorityLow_triggered();
332 void on_actionJobPriorityNormal_triggered();
333 void on_actionFusionLight_triggered();
334 void on_actionTutorials_triggered();
335 void on_actionRestoreLayout_triggered();
336 void on_actionShowTitleBars_triggered(
bool checked);
337 void on_actionShowToolbar_triggered(
bool checked);
338 void onToolbarVisibilityChanged(
bool visible);
339 void on_menuExternal_aboutToShow();
340 void on_actionUpgrade_triggered();
341 void on_actionOpenXML_triggered();
342 void on_actionShowProjectFolder_triggered();
343 void onAutosaveTimeout();
344 void onFocusChanged(QWidget *old, QWidget *now)
const;
345 void onFocusObjectChanged(QObject *obj)
const;
346 void onFocusWindowChanged(QWindow *window)
const;
347 void onTimelineClipSelected();
348 void onAddAllToTimeline(Mlt::Playlist *playlist,
bool skipProxy,
bool emptyTrack);
349 void on_actionScrubAudio_triggered(
bool checked);
350#if !defined(Q_OS_MAC)
351 void onDrawingMethodTriggered(QAction *);
353 void onGpuAdapterTriggered(QAction *);
354 void on_actionResources_triggered();
355 void on_actionApplicationLog_triggered();
356 void on_actionClose_triggered();
357 void onPlayerTabIndexChanged(
int index);
358 void onUpgradeCheckFinished(QNetworkReply *reply);
359 void onUpgradeTriggered();
361 void on_actionExportEDL_triggered();
362 void on_actionExportFrame_triggered();
363 void onVideoWidgetImageReady();
364 void on_actionAppDataSet_triggered();
365 void on_actionAppDataShow_triggered();
366 void on_actionNew_triggered();
367 void on_actionScreenSnapshot_triggered();
368 void on_actionScreenRecording_triggered();
369 void on_actionKeyboardShortcuts_triggered();
370 void on_actionLayoutLogging_triggered();
371 void on_actionLayoutEditing_triggered();
372 void on_actionLayoutEffects_triggered();
373 void on_actionLayoutColor_triggered();
374 void on_actionLayoutAudio_triggered();
375 void on_actionLayoutPlayer_triggered();
376 void on_actionLayoutPlaylist_triggered();
377 void on_actionLayoutClip_triggered();
378 void on_actionLayoutAdd_triggered();
379 void onLayoutTriggered(QAction *);
380 void on_actionProfileRemove_triggered();
381 void on_actionLayoutRemove_triggered();
382 void on_actionOpenOther2_triggered();
383 void onOpenOtherTriggered(QWidget *widget);
384 void onOpenOtherFinished(
int result);
385 void onOpenOtherTriggered();
386 void onHtmlGeneratorTriggered();
387 void on_actionClearRecentOnExit_toggled(
bool arg1);
388 void onSceneGraphInitialized();
389 void adjustMainToolbar();
390 void on_actionShowTextUnderIcons_toggled(
bool b);
391 void on_actionShowSmallIcons_toggled(
bool b);
392 void onPlaylistInChanged(
int in);
393 void onPlaylistOutChanged(
int out);
394 void on_actionPreviewNone_triggered(
bool checked);
395 void on_actionPreview360_triggered(
bool checked);
396 void on_actionPreview540_triggered(
bool checked);
397 void on_actionPreview720_triggered(
bool checked);
398 void on_actionPreview1080_triggered(
bool checked);
399 void on_actionPreviewHardwareDecoder_triggered(
bool checked);
400 void on_actionTopics_triggered();
401 void on_actionSync_triggered();
402 void on_actionUseProxy_triggered(
bool checked);
403 void on_actionProxyStorageSet_triggered();
404 void on_actionProxyStorageShow_triggered();
405 void on_actionProxyUseProjectFolder_triggered(
bool checked);
406 void on_actionProxyUseHardware_triggered(
bool checked);
407 void on_actionProxyConfigureHardware_triggered();
408 void updateLayoutSwitcher();
409 void clearCurrentLayout();
410 void onClipboardChanged();
411 void sourceUpdated();
412 void resetSourceUpdated();
413 void on_actionExportChapters_triggered();
414 void on_actionAudioVideoDevice_triggered();
415 void on_actionReset_triggered();
416 void on_actionBackupSave_triggered();
417 void on_actionPauseAfterSeek_triggered(
bool checked);
418 void on_actionWhatsThis_triggered();
419 void on_actionLeaveSafeMode_triggered();
422#define MAIN MainWindow::singleton()