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 *);
134 bool eventFilter(QObject *target, QEvent *event);
135 void dragEnterEvent(QDragEnterEvent *);
136 void dropEvent(QDropEvent *);
137 void closeEvent(QCloseEvent *);
138 void showEvent(QShowEvent *);
139 void hideEvent(QHideEvent *event);
140 void resizeEvent(QResizeEvent *event);
143 void connectFocusSignals();
144 void registerDebugCallback();
145 void connectUISignals();
146 void setupAndConnectUndoStack();
147 void setupAndConnectPlayerWidget();
148 void setupLayoutSwitcher();
149 void centerLayoutInRemainingToolbarSpace();
150 void setupAndConnectDocks();
151 void setupMenuFile();
152 void setupMenuView();
153 void connectVideoWidgetSignals();
154 void setupSettingsMenu();
155 void setupOpenOtherMenu();
157 void mirrorViewActionShortcuts();
158 QAction *addProfile(QActionGroup *actionGroup,
const QString &desc,
const QString &name);
159 QAction *addLayout(QActionGroup *actionGroup,
const QString &name);
160 void readPlayerSettings();
161 void readWindowSettings();
162 void writeSettings();
163 void configureVideoWidget();
164 void setCurrentFile(
const QString &filename);
165 void updateWindowTitle();
166 void changeAudioChannels(
bool checked,
int channels);
167 void changeDeinterlacer(
bool checked,
const char *method);
168 void changeInterpolation(
bool checked,
const char *method);
169 bool checkAutoSave(QString &url);
170 bool saveConvertedXmlFile(MltXmlChecker &checker, QString &fileName);
171 bool saveRepairedXmlFile(MltXmlChecker &checker, QString &fileName);
172 void setAudioChannels(
int channels);
173 void setProcessingMode(ShotcutSettings::ProcessingMode mode);
174 void showSaveError();
175 void setPreviewScale(
int scale);
176 void setVideoModeMenu();
177 void resetVideoModeMenu();
178 void resetDockCorners();
179 void showIncompatibleProjectMessage(
const QString &shotcutVersion);
180 void restartAfterChangeTheme();
182 void backupPeriodically();
183 bool confirmProfileChange();
184 bool confirmRestartExternalMonitor();
185 void resetFilterMenuIfNeeded();
186 void updateDecklinkActions();
187 void syncTimelineKeyframesZoom(
double scale);
191 QDockWidget *m_propertiesDock;
192 RecentDock *m_recentDock;
193 EncodeDock *m_encodeDock;
194 JobsDock *m_jobsDock;
195 PlaylistDock *m_playlistDock;
196 TimelineDock *m_timelineDock;
197 QString m_currentFile;
198 bool m_isKKeyPressed;
199 QUndoStack *m_undoStack;
200 QDockWidget *m_historyDock;
201 QActionGroup *m_profileGroup;
202 QActionGroup *m_externalGroup;
203 QActionGroup *m_keyerGroup;
204 QActionGroup *m_layoutGroup;
205 QActionGroup *m_previewScaleGroup;
206 FiltersDock *m_filtersDock;
207 FilterController *m_filterController;
208 ScopeController *m_scopeController;
209 QMenu *m_customProfileMenu;
210 QAction *m_decklinkHdrAction{
nullptr};
212 QStringList m_multipleFiles;
213 bool m_multipleFilesLoading;
214 bool m_isPlaylistLoaded;
215 QActionGroup *m_languagesGroup;
216 QSharedPointer<AutoSaveFile> m_autosaveFile;
217 QMutex m_autosaveMutex;
218 QTimer m_autosaveTimer;
220 QScopedPointer<QAction> m_statusBarAction;
221 QNetworkAccessManager m_network;
222 QString m_upgradeUrl;
223 KeyframesDock *m_keyframesDock;
224 QDateTime m_clipboardUpdatedAt;
225 QDateTime m_sourceUpdatedAt;
226 QDateTime m_lastBackupDateTime;
227 MarkersDock *m_markersDock;
228 NotesDock *m_notesDock;
229 SubtitlesDock *m_subtitlesDock;
230 std::unique_ptr<QWidget> m_producerWidget;
231 FilesDock *m_filesDock;
232 ElementsDock *m_elementsDock;
233 ScreenCapture *m_screenCapture;
234 HdrPreviewWindow *m_hdrPreviewWindow{
nullptr};
235 bool m_syncingZoom{
false};
238 bool isCompatibleWithProcessingMode(MltXmlChecker &checker, QString &fileName,
bool &converted);
239 bool isXmlRepaired(MltXmlChecker &checker, QString &fileName);
240 bool open(QString url,
241 const Mlt::Properties * =
nullptr,
243 bool skipConvert =
false);
244 void openMultiple(
const QStringList &paths);
245 void openMultiple(
const QList<QUrl> &urls);
247 void openCut(Mlt::Producer *producer,
bool play =
false);
249 void closeProducer();
250 void showStatusMessage(QAction *action,
int timeoutSeconds = 5);
251 void showStatusMessage(
const QString &message,
252 int timeoutSeconds = 5,
253 QPalette::ColorRole role = QPalette::ToolTipBase);
254 void onStatusMessageClicked();
255 void seekPlaylist(
int start);
256 void seekTimeline(
int position,
bool seekPlayer =
true);
257 void seekKeyframes(
int position);
258 QWidget *loadProducerWidget(Mlt::Producer *producer);
259 void onProducerOpened(
bool withReopen =
true);
260 void onGpuNotSupported();
261 void onShuttle(
float x);
262 void onPropertiesDockTriggered(
bool checked =
true);
263 void onFiltersDockTriggered(
bool checked =
true);
264 void onElementsDockTriggered(
bool checked =
true);
265 bool on_actionSave_triggered();
266 void onCreateOrEditFilterOnOutput(Mlt::Filter *filter,
const QStringList &key_properties);
267 void showSettingsMenu()
const;
270 void showUpgradePrompt();
271 void on_actionAbout_Shotcut_triggered();
272 void on_actionOpenOther_triggered();
273 void onProducerChanged();
274 bool on_actionSave_As_triggered();
275 void onEncodeTriggered(
bool checked =
true);
276 void onCaptureStateChanged(
bool started);
277 void onJobsDockTriggered(
bool =
true);
278 void onRecentDockTriggered(
bool checked =
true);
279 void onPlaylistDockTriggered(
bool checked =
true);
280 void onTimelineDockTriggered(
bool checked =
true);
281 void onHistoryDockTriggered(
bool checked =
true);
282 void onKeyframesDockTriggered(
bool checked =
true);
283 void onMarkersDockTriggered(
bool =
true);
284 void onNotesDockTriggered(
bool =
true);
285 void onSubtitlesDockTriggered(
bool =
true);
286 void onFilesDockTriggered(
bool =
true);
287 void onPlaylistCreated();
288 void onPlaylistLoaded();
289 void onPlaylistCleared();
290 void onPlaylistClosed();
291 void onPlaylistModified();
292 void onMultitrackCreated();
293 void onMultitrackClosed();
294 void onMultitrackModified();
295 void onMultitrackDurationChanged();
296 void onNoteModified();
297 void onSubtitleModified();
298 void onCutModified();
299 void onProducerModified();
300 void onFilterModelChanged();
301 void updateMarkers();
302 void updateThumbnails();
303 void on_actionFAQ_triggered();
304 void on_actionForum_triggered();
305 void on_actionEnterFullScreen_triggered();
306 void on_actionRealtime_triggered(
bool checked);
307 void on_actionProgressive_triggered(
bool checked);
308 void on_actionChannels1_triggered(
bool checked);
309 void on_actionChannels2_triggered(
bool checked);
310 void on_actionChannels4_triggered(
bool checked);
311 void on_actionChannels6_triggered(
bool checked);
312 void on_actionOneField_triggered(
bool checked);
313 void on_actionYadifTemporal_triggered(
bool checked);
314 void on_actionYadifSpatial_triggered(
bool checked);
315 void on_actionBwdif_triggered(
bool checked);
316 void on_actionNearest_triggered(
bool checked);
317 void on_actionBilinear_triggered(
bool checked);
318 void on_actionBicubic_triggered(
bool checked);
319 void on_actionHyper_triggered(
bool checked);
320 void on_actionJack_triggered(
bool checked);
321 void onHdrPreviewToggled(
bool checked);
322 void onExternalTriggered(QAction *);
323 void onDecklinkHdrMetadataTriggered();
324 void onKeyerTriggered(QAction *);
325 void onProfileTriggered(QAction *);
326 void onProfileChanged();
327 void on_actionAddCustomProfile_triggered();
328 void processMultipleFiles();
329 void processSingleFile();
330 void onLanguageTriggered(QAction *);
331 void on_actionSystemTheme_triggered();
332 void on_actionSystemFusion_triggered();
333 void on_actionFusionDark_triggered();
334 void on_actionJobPriorityLow_triggered();
335 void on_actionJobPriorityNormal_triggered();
336 void on_actionFusionLight_triggered();
337 void on_actionTutorials_triggered();
338 void on_actionRestoreLayout_triggered();
339 void on_actionShowTitleBars_triggered(
bool checked);
340 void on_actionShowToolbar_triggered(
bool checked);
341 void onToolbarVisibilityChanged(
bool visible);
342 void on_menuExternal_aboutToShow();
343 void on_actionUpgrade_triggered();
344 void on_actionOpenXML_triggered();
345 void on_actionShowProjectFolder_triggered();
346 void onAutosaveTimeout();
347 void onFocusChanged(QWidget *old, QWidget *now)
const;
348 void onFocusObjectChanged(QObject *obj)
const;
349 void onFocusWindowChanged(QWindow *window)
const;
350 void onTimelineClipSelected();
351 void onAddAllToTimeline(Mlt::Playlist *playlist,
bool skipProxy,
bool emptyTrack);
352 void on_actionScrubAudio_triggered(
bool checked);
353#if !defined(Q_OS_MAC)
354 void onDrawingMethodTriggered(QAction *);
356 void onGpuAdapterTriggered(QAction *);
357 void on_actionResources_triggered();
358 void on_actionApplicationLog_triggered();
359 void on_actionClose_triggered();
360 void onPlayerTabIndexChanged(
int index);
361 void onUpgradeCheckFinished(QNetworkReply *reply);
362 void onUpgradeTriggered();
364 void on_actionExportEDL_triggered();
365 void on_actionExportFrame_triggered();
366 void onVideoWidgetImageReady();
367 void on_actionAppDataSet_triggered();
368 void on_actionAppDataShow_triggered();
369 void on_actionNew_triggered();
370 void on_actionScreenSnapshot_triggered();
371 void on_actionScreenRecording_triggered();
372 void on_actionKeyboardShortcuts_triggered();
373 void on_actionLayoutLogging_triggered();
374 void on_actionLayoutEditing_triggered();
375 void on_actionLayoutEffects_triggered();
376 void on_actionLayoutColor_triggered();
377 void on_actionLayoutAudio_triggered();
378 void on_actionLayoutPlayer_triggered();
379 void on_actionLayoutPlaylist_triggered();
380 void on_actionLayoutClip_triggered();
381 void on_actionLayoutAdd_triggered();
382 void onLayoutTriggered(QAction *);
383 void on_actionProfileRemove_triggered();
384 void on_actionLayoutRemove_triggered();
385 void on_actionOpenOther2_triggered();
386 void onOpenOtherTriggered(QWidget *widget);
387 void onOpenOtherFinished(
int result);
388 void onOpenOtherTriggered();
389 void onHtmlGeneratorTriggered();
390 void on_actionClearRecentOnExit_toggled(
bool arg1);
391 void onSceneGraphInitialized();
392 void adjustMainToolbar();
393 void on_actionShowTextUnderIcons_toggled(
bool b);
394 void on_actionShowSmallIcons_toggled(
bool b);
395 void onPlaylistInChanged(
int in);
396 void onPlaylistOutChanged(
int out);
397 void on_actionPreviewNone_triggered(
bool checked);
398 void on_actionPreview360_triggered(
bool checked);
399 void on_actionPreview540_triggered(
bool checked);
400 void on_actionPreview720_triggered(
bool checked);
401 void on_actionPreview1080_triggered(
bool checked);
402 void on_actionPreviewHardwareDecoder_triggered(
bool checked);
403 void on_actionTopics_triggered();
404 void on_actionSync_triggered();
405 void on_actionUseProxy_triggered(
bool checked);
406 void on_actionProxyStorageSet_triggered();
407 void on_actionProxyStorageShow_triggered();
408 void on_actionProxyUseProjectFolder_triggered(
bool checked);
409 void on_actionProxyUseHardware_triggered(
bool checked);
410 void on_actionProxyConfigureHardware_triggered();
411 void updateLayoutSwitcher();
412 void clearCurrentLayout();
413 void onClipboardChanged();
414 void sourceUpdated();
415 void resetSourceUpdated();
416 void on_actionExportChapters_triggered();
417 void on_actionAudioVideoDevice_triggered();
418 void on_actionReset_triggered();
419 void on_actionBackupSave_triggered();
420 void on_actionPauseAfterSeek_triggered(
bool checked);
421 void on_actionWhatsThis_triggered();
422 void on_actionLeaveSafeMode_triggered();
425#define MAIN MainWindow::singleton()