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();
190 QDockWidget *m_propertiesDock;
191 RecentDock *m_recentDock;
192 EncodeDock *m_encodeDock;
193 JobsDock *m_jobsDock;
194 PlaylistDock *m_playlistDock;
195 TimelineDock *m_timelineDock;
196 QString m_currentFile;
197 bool m_isKKeyPressed;
198 QUndoStack *m_undoStack;
199 QDockWidget *m_historyDock;
200 QActionGroup *m_profileGroup;
201 QActionGroup *m_externalGroup;
202 QActionGroup *m_keyerGroup;
203 QActionGroup *m_layoutGroup;
204 QActionGroup *m_previewScaleGroup;
205 FiltersDock *m_filtersDock;
206 FilterController *m_filterController;
207 ScopeController *m_scopeController;
208 QMenu *m_customProfileMenu;
209 QAction *m_decklinkHdrAction{
nullptr};
211 QStringList m_multipleFiles;
212 bool m_multipleFilesLoading;
213 bool m_isPlaylistLoaded;
214 QActionGroup *m_languagesGroup;
215 QSharedPointer<AutoSaveFile> m_autosaveFile;
216 QMutex m_autosaveMutex;
217 QTimer m_autosaveTimer;
219 QScopedPointer<QAction> m_statusBarAction;
220 QNetworkAccessManager m_network;
221 QString m_upgradeUrl;
222 KeyframesDock *m_keyframesDock;
223 QDateTime m_clipboardUpdatedAt;
224 QDateTime m_sourceUpdatedAt;
225 QDateTime m_lastBackupDateTime;
226 MarkersDock *m_markersDock;
227 NotesDock *m_notesDock;
228 SubtitlesDock *m_subtitlesDock;
229 std::unique_ptr<QWidget> m_producerWidget;
230 FilesDock *m_filesDock;
231 ElementsDock *m_elementsDock;
232 ScreenCapture *m_screenCapture;
233 HdrPreviewWindow *m_hdrPreviewWindow{
nullptr};
236 bool isCompatibleWithProcessingMode(MltXmlChecker &checker, QString &fileName,
bool &converted);
237 bool isXmlRepaired(MltXmlChecker &checker, QString &fileName);
238 bool open(QString url,
239 const Mlt::Properties * =
nullptr,
241 bool skipConvert =
false);
242 void openMultiple(
const QStringList &paths);
243 void openMultiple(
const QList<QUrl> &urls);
245 void openCut(Mlt::Producer *producer,
bool play =
false);
247 void closeProducer();
248 void showStatusMessage(QAction *action,
int timeoutSeconds = 5);
249 void showStatusMessage(
const QString &message,
250 int timeoutSeconds = 5,
251 QPalette::ColorRole role = QPalette::ToolTipBase);
252 void onStatusMessageClicked();
253 void seekPlaylist(
int start);
254 void seekTimeline(
int position,
bool seekPlayer =
true);
255 void seekKeyframes(
int position);
256 QWidget *loadProducerWidget(Mlt::Producer *producer);
257 void onProducerOpened(
bool withReopen =
true);
258 void onGpuNotSupported();
259 void onShuttle(
float x);
260 void onPropertiesDockTriggered(
bool checked =
true);
261 void onFiltersDockTriggered(
bool checked =
true);
262 void onElementsDockTriggered(
bool checked =
true);
263 bool on_actionSave_triggered();
264 void onCreateOrEditFilterOnOutput(Mlt::Filter *filter,
const QStringList &key_properties);
265 void showSettingsMenu()
const;
268 void showUpgradePrompt();
269 void on_actionAbout_Shotcut_triggered();
270 void on_actionOpenOther_triggered();
271 void onProducerChanged();
272 bool on_actionSave_As_triggered();
273 void onEncodeTriggered(
bool checked =
true);
274 void onCaptureStateChanged(
bool started);
275 void onJobsDockTriggered(
bool =
true);
276 void onRecentDockTriggered(
bool checked =
true);
277 void onPlaylistDockTriggered(
bool checked =
true);
278 void onTimelineDockTriggered(
bool checked =
true);
279 void onHistoryDockTriggered(
bool checked =
true);
280 void onKeyframesDockTriggered(
bool checked =
true);
281 void onMarkersDockTriggered(
bool =
true);
282 void onNotesDockTriggered(
bool =
true);
283 void onSubtitlesDockTriggered(
bool =
true);
284 void onFilesDockTriggered(
bool =
true);
285 void onPlaylistCreated();
286 void onPlaylistLoaded();
287 void onPlaylistCleared();
288 void onPlaylistClosed();
289 void onPlaylistModified();
290 void onMultitrackCreated();
291 void onMultitrackClosed();
292 void onMultitrackModified();
293 void onMultitrackDurationChanged();
294 void onNoteModified();
295 void onSubtitleModified();
296 void onCutModified();
297 void onProducerModified();
298 void onFilterModelChanged();
299 void updateMarkers();
300 void updateThumbnails();
301 void on_actionFAQ_triggered();
302 void on_actionForum_triggered();
303 void on_actionEnterFullScreen_triggered();
304 void on_actionRealtime_triggered(
bool checked);
305 void on_actionProgressive_triggered(
bool checked);
306 void on_actionChannels1_triggered(
bool checked);
307 void on_actionChannels2_triggered(
bool checked);
308 void on_actionChannels4_triggered(
bool checked);
309 void on_actionChannels6_triggered(
bool checked);
310 void on_actionOneField_triggered(
bool checked);
311 void on_actionYadifTemporal_triggered(
bool checked);
312 void on_actionYadifSpatial_triggered(
bool checked);
313 void on_actionBwdif_triggered(
bool checked);
314 void on_actionNearest_triggered(
bool checked);
315 void on_actionBilinear_triggered(
bool checked);
316 void on_actionBicubic_triggered(
bool checked);
317 void on_actionHyper_triggered(
bool checked);
318 void on_actionJack_triggered(
bool checked);
319 void onHdrPreviewToggled(
bool checked);
320 void onExternalTriggered(QAction *);
321 void onDecklinkHdrMetadataTriggered();
322 void onKeyerTriggered(QAction *);
323 void onProfileTriggered(QAction *);
324 void onProfileChanged();
325 void on_actionAddCustomProfile_triggered();
326 void processMultipleFiles();
327 void processSingleFile();
328 void onLanguageTriggered(QAction *);
329 void on_actionSystemTheme_triggered();
330 void on_actionSystemFusion_triggered();
331 void on_actionFusionDark_triggered();
332 void on_actionJobPriorityLow_triggered();
333 void on_actionJobPriorityNormal_triggered();
334 void on_actionFusionLight_triggered();
335 void on_actionTutorials_triggered();
336 void on_actionRestoreLayout_triggered();
337 void on_actionShowTitleBars_triggered(
bool checked);
338 void on_actionShowToolbar_triggered(
bool checked);
339 void onToolbarVisibilityChanged(
bool visible);
340 void on_menuExternal_aboutToShow();
341 void on_actionUpgrade_triggered();
342 void on_actionOpenXML_triggered();
343 void on_actionShowProjectFolder_triggered();
344 void onAutosaveTimeout();
345 void onFocusChanged(QWidget *old, QWidget *now)
const;
346 void onFocusObjectChanged(QObject *obj)
const;
347 void onFocusWindowChanged(QWindow *window)
const;
348 void onTimelineClipSelected();
349 void onAddAllToTimeline(Mlt::Playlist *playlist,
bool skipProxy,
bool emptyTrack);
350 void on_actionScrubAudio_triggered(
bool checked);
351#if !defined(Q_OS_MAC)
352 void onDrawingMethodTriggered(QAction *);
354 void onGpuAdapterTriggered(QAction *);
355 void on_actionResources_triggered();
356 void on_actionApplicationLog_triggered();
357 void on_actionClose_triggered();
358 void onPlayerTabIndexChanged(
int index);
359 void onUpgradeCheckFinished(QNetworkReply *reply);
360 void onUpgradeTriggered();
362 void on_actionExportEDL_triggered();
363 void on_actionExportFrame_triggered();
364 void onVideoWidgetImageReady();
365 void on_actionAppDataSet_triggered();
366 void on_actionAppDataShow_triggered();
367 void on_actionNew_triggered();
368 void on_actionScreenSnapshot_triggered();
369 void on_actionScreenRecording_triggered();
370 void on_actionKeyboardShortcuts_triggered();
371 void on_actionLayoutLogging_triggered();
372 void on_actionLayoutEditing_triggered();
373 void on_actionLayoutEffects_triggered();
374 void on_actionLayoutColor_triggered();
375 void on_actionLayoutAudio_triggered();
376 void on_actionLayoutPlayer_triggered();
377 void on_actionLayoutPlaylist_triggered();
378 void on_actionLayoutClip_triggered();
379 void on_actionLayoutAdd_triggered();
380 void onLayoutTriggered(QAction *);
381 void on_actionProfileRemove_triggered();
382 void on_actionLayoutRemove_triggered();
383 void on_actionOpenOther2_triggered();
384 void onOpenOtherTriggered(QWidget *widget);
385 void onOpenOtherFinished(
int result);
386 void onOpenOtherTriggered();
387 void onHtmlGeneratorTriggered();
388 void on_actionClearRecentOnExit_toggled(
bool arg1);
389 void onSceneGraphInitialized();
390 void adjustMainToolbar();
391 void on_actionShowTextUnderIcons_toggled(
bool b);
392 void on_actionShowSmallIcons_toggled(
bool b);
393 void onPlaylistInChanged(
int in);
394 void onPlaylistOutChanged(
int out);
395 void on_actionPreviewNone_triggered(
bool checked);
396 void on_actionPreview360_triggered(
bool checked);
397 void on_actionPreview540_triggered(
bool checked);
398 void on_actionPreview720_triggered(
bool checked);
399 void on_actionPreview1080_triggered(
bool checked);
400 void on_actionPreviewHardwareDecoder_triggered(
bool checked);
401 void on_actionTopics_triggered();
402 void on_actionSync_triggered();
403 void on_actionUseProxy_triggered(
bool checked);
404 void on_actionProxyStorageSet_triggered();
405 void on_actionProxyStorageShow_triggered();
406 void on_actionProxyUseProjectFolder_triggered(
bool checked);
407 void on_actionProxyUseHardware_triggered(
bool checked);
408 void on_actionProxyConfigureHardware_triggered();
409 void updateLayoutSwitcher();
410 void clearCurrentLayout();
411 void onClipboardChanged();
412 void sourceUpdated();
413 void resetSourceUpdated();
414 void on_actionExportChapters_triggered();
415 void on_actionAudioVideoDevice_triggered();
416 void on_actionReset_triggered();
417 void on_actionBackupSave_triggered();
418 void on_actionPauseAfterSeek_triggered(
bool checked);
419 void on_actionWhatsThis_triggered();
420 void on_actionLeaveSafeMode_triggered();
423#define MAIN MainWindow::singleton()