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