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