25#include <QNetworkAccessManager>
26#include <QScopedPointer>
27#include <QSharedPointer>
29#include "mltcontroller.h"
30#include "mltxmlchecker.h"
32#define EXIT_RESTART (42)
33#define EXIT_RESET (43)
45class FilterController;
55class MainWindow :
public QMainWindow
70 static MainWindow &singleton();
72 void open(Mlt::Producer *producer);
73 bool continueModified();
74 bool continueJobsRunning();
75 QUndoStack *undoStack()
const;
76 bool saveXML(
const QString &filename,
bool withRelativePaths =
true);
77 static void changeTheme(
const QString &theme);
78 PlaylistDock *playlistDock()
const
80 return m_playlistDock;
82 FilterController *filterController()
const
84 return m_filterController;
86 Mlt::Playlist *playlist()
const;
87 bool isPlaylistValid()
const;
88 Mlt::Producer *multitrack()
const;
89 bool isMultitrackValid()
const;
91 void setFullScreen(
bool isFullScreen);
92 QString removeFileScheme(QUrl &url);
93 QString untitledFileName()
const;
94 void setProfile(
const QString &profile_name);
95 QString fileName()
const
99 bool isSourceClipMyProject(QString resource = MLT.resource(),
bool withDialog =
true);
100 bool keyframesDockIsVisible()
const;
102 void keyPressEvent(QKeyEvent *);
103 void keyReleaseEvent(QKeyEvent *);
104 void hideSetDataDirectory();
105 QMenu *customProfileMenu()
const
107 return m_customProfileMenu;
109 QAction *actionAddCustomProfile()
const;
110 QAction *actionProfileRemove()
const;
111 QActionGroup *profileGroup()
const
113 return m_profileGroup;
115 void buildVideoModeMenu(QMenu *topMenu, QMenu *&customMenu, QActionGroup *group, QAction *addAction,
116 QAction *removeAction);
117 void newProject(
const QString &filename,
bool isProjectFolder =
false);
118 void addCustomProfile(
const QString &name, QMenu *menu, QAction *action, QActionGroup *group);
119 void removeCustomProfiles(
const QStringList &profiles, QDir &dir, QMenu *menu, QAction *action);
120 QUuid timelineClipUuid(
int trackIndex,
int clipIndex);
121 void replaceInTimeline(
const QUuid &uuid, Mlt::Producer &producer);
122 void replaceAllByHash(
const QString &hash, Mlt::Producer &producer,
bool isProxy =
false);
123 bool isClipboardNewer()
const
125 return m_clipboardUpdatedAt > m_sourceUpdatedAt;
127 int mltIndexForTrack(
int trackIndex)
const;
128 int bottomVideoTrackIndex()
const;
129 void cropSource(
const QRectF &rect);
130 void getMarkerRange(
int position,
int *start,
int *end);
131 void getSelectionRange(
int *start,
int *end);
134 void audioChannelsChanged();
135 void producerOpened(
bool withReopen =
true);
136 void profileChanged();
137 void openFailed(QString);
138 void aboutToShutDown();
139 void renameRequested();
140 void serviceInChanged(
int delta, Mlt::Service *);
141 void serviceOutChanged(
int delta, Mlt::Service *);
145 bool eventFilter(QObject *target, QEvent *event);
146 void dragEnterEvent(QDragEnterEvent *);
147 void dropEvent(QDropEvent *);
148 void closeEvent(QCloseEvent *);
149 void showEvent(QShowEvent *);
150 void hideEvent(QHideEvent *event);
153 void connectFocusSignals();
154 void registerDebugCallback();
155 void connectUISignals();
156 void setupAndConnectUndoStack();
157 void setupAndConnectPlayerWidget();
158 void setupLayoutSwitcher();
159 void centerLayoutInRemainingToolbarSpace();
160 void setupAndConnectDocks();
161 void setupMenuFile();
162 void setupMenuView();
163 void connectVideoWidgetSignals();
164 void setupSettingsMenu();
165 void setupOpenOtherMenu();
167 QAction *addProfile(QActionGroup *actionGroup,
const QString &desc,
const QString &name);
168 QAction *addLayout(QActionGroup *actionGroup,
const QString &name);
169 void readPlayerSettings();
170 void readWindowSettings();
171 void writeSettings();
172 void configureVideoWidget();
173 void setCurrentFile(
const QString &filename);
174 void changeAudioChannels(
bool checked,
int channels);
175 void changeDeinterlacer(
bool checked,
const char *method);
176 void changeInterpolation(
bool checked,
const char *method);
177 bool checkAutoSave(QString &url);
178 bool saveRepairedXmlFile(MltXmlChecker &checker, QString &fileName);
179 void setAudioChannels(
int channels);
180 void showSaveError();
181 void setPreviewScale(
int scale);
182 void setVideoModeMenu();
183 void resetVideoModeMenu();
184 void resetDockCorners();
185 void showIncompatibleProjectMessage(
const QString &shotcutVersion);
186 void restartAfterChangeTheme();
188 void backupPeriodically();
192 QDockWidget *m_propertiesDock;
193 RecentDock *m_recentDock;
194 EncodeDock *m_encodeDock;
195 JobsDock *m_jobsDock;
196 PlaylistDock *m_playlistDock;
197 TimelineDock *m_timelineDock;
198 QString m_currentFile;
199 bool m_isKKeyPressed;
200 QUndoStack *m_undoStack;
201 QDockWidget *m_historyDock;
202 QActionGroup *m_profileGroup;
203 QActionGroup *m_externalGroup;
204 QActionGroup *m_keyerGroup;
205 QActionGroup *m_layoutGroup;
206 QActionGroup *m_previewScaleGroup;
207 FiltersDock *m_filtersDock;
208 FilterController *m_filterController;
209 ScopeController *m_scopeController;
210 QMenu *m_customProfileMenu;
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 MarkersDock *m_markersDock;
227 NotesDock *m_notesDock;
228 std::unique_ptr<QWidget> m_producerWidget;
231 bool isCompatibleWithGpuMode(MltXmlChecker &checker);
232 bool isXmlRepaired(MltXmlChecker &checker, QString &fileName);
233 bool open(QString url,
const Mlt::Properties * =
nullptr,
bool play =
true,
234 bool skipConvert =
false);
235 void openMultiple(
const QStringList &paths);
236 void openMultiple(
const QList<QUrl> &urls);
238 void openCut(Mlt::Producer *producer,
bool play =
false);
240 void closeProducer();
241 void showStatusMessage(QAction *action,
int timeoutSeconds = 5);
242 void showStatusMessage(
const QString &message,
int timeoutSeconds = 5,
243 QPalette::ColorRole role = QPalette::ToolTipBase);
244 void onStatusMessageClicked();
245 void seekPlaylist(
int start);
246 void seekTimeline(
int position,
bool seekPlayer =
true);
247 void seekKeyframes(
int position);
248 QWidget *loadProducerWidget(Mlt::Producer *producer);
249 void onProducerOpened(
bool withReopen =
true);
250 void onGpuNotSupported();
251 void onShuttle(
float x);
252 void onPropertiesDockTriggered(
bool checked =
true);
253 bool on_actionSave_triggered();
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 onFiltersDockTriggered(
bool checked =
true);
269 void onKeyframesDockTriggered(
bool checked =
true);
270 void onMarkersDockTriggered(
bool =
true);
271 void onNotesDockTriggered(
bool =
true);
272 void onPlaylistCreated();
273 void onPlaylistLoaded();
274 void onPlaylistCleared();
275 void onPlaylistClosed();
276 void onPlaylistModified();
277 void onMultitrackCreated();
278 void onMultitrackClosed();
279 void onMultitrackModified();
280 void onMultitrackDurationChanged();
281 void onNoteModified();
282 void onCutModified();
283 void onProducerModified();
284 void onFilterModelChanged();
285 void updateMarkers();
286 void updateThumbnails();
287 void on_actionUndo_triggered();
288 void on_actionRedo_triggered();
289 void on_actionFAQ_triggered();
290 void on_actionForum_triggered();
291 void on_actionEnterFullScreen_triggered();
292 void on_actionRealtime_triggered(
bool checked);
293 void on_actionProgressive_triggered(
bool checked);
294 void on_actionChannels1_triggered(
bool checked);
295 void on_actionChannels2_triggered(
bool checked);
296 void on_actionChannels4_triggered(
bool checked);
297 void on_actionChannels6_triggered(
bool checked);
298 void on_actionOneField_triggered(
bool checked);
299 void on_actionLinearBlend_triggered(
bool checked);
300 void on_actionYadifTemporal_triggered(
bool checked);
301 void on_actionYadifSpatial_triggered(
bool checked);
302 void on_actionBwdif_triggered(
bool checked);
303 void on_actionNearest_triggered(
bool checked);
304 void on_actionBilinear_triggered(
bool checked);
305 void on_actionBicubic_triggered(
bool checked);
306 void on_actionHyper_triggered(
bool checked);
307 void on_actionJack_triggered(
bool checked);
308 void on_actionGPU_triggered(
bool checked);
309 void onExternalTriggered(QAction *);
310 void onKeyerTriggered(QAction *);
311 void onProfileTriggered(QAction *);
312 void onProfileChanged();
313 void on_actionAddCustomProfile_triggered();
314 void processMultipleFiles();
315 void processSingleFile();
316 void onLanguageTriggered(QAction *);
317 void on_actionSystemTheme_triggered();
318 void on_actionFusionDark_triggered();
319 void on_actionJobPriorityLow_triggered();
320 void on_actionJobPriorityNormal_triggered();
321 void on_actionFusionLight_triggered();
322 void on_actionTutorials_triggered();
323 void on_actionRestoreLayout_triggered();
324 void on_actionShowTitleBars_triggered(
bool checked);
325 void on_actionShowToolbar_triggered(
bool checked);
326 void onToolbarVisibilityChanged(
bool visible);
327 void on_menuExternal_aboutToShow();
328 void on_actionUpgrade_triggered();
329 void on_actionOpenXML_triggered();
330 void onAutosaveTimeout();
331 void onFocusChanged(QWidget *old, QWidget *now)
const;
332 void onFocusObjectChanged(QObject *obj)
const;
333 void onFocusWindowChanged(QWindow *window)
const;
334 void onTimelineClipSelected();
335 void onAddAllToTimeline(Mlt::Playlist *playlist,
bool skipProxy);
336 void on_actionScrubAudio_triggered(
bool checked);
337#if !defined(Q_OS_MAC)
338 void onDrawingMethodTriggered(QAction *);
340 void on_actionResources_triggered();
341 void on_actionApplicationLog_triggered();
342 void on_actionClose_triggered();
343 void onPlayerTabIndexChanged(
int index);
344 void onUpgradeCheckFinished(QNetworkReply *reply);
345 void onUpgradeTriggered();
347 void on_actionExportEDL_triggered();
348 void on_actionExportFrame_triggered();
349 void onVideoWidgetImageReady();
350 void on_actionAppDataSet_triggered();
351 void on_actionAppDataShow_triggered();
352 void on_actionNew_triggered();
353 void on_actionKeyboardShortcuts_triggered();
354 void on_actionLayoutLogging_triggered();
355 void on_actionLayoutEditing_triggered();
356 void on_actionLayoutEffects_triggered();
357 void on_actionLayoutColor_triggered();
358 void on_actionLayoutAudio_triggered();
359 void on_actionLayoutPlayer_triggered();
360 void on_actionLayoutPlaylist_triggered();
361 void on_actionLayoutClip_triggered();
362 void on_actionLayoutAdd_triggered();
363 void onLayoutTriggered(QAction *);
364 void on_actionProfileRemove_triggered();
365 void on_actionLayoutRemove_triggered();
366 void on_actionOpenOther2_triggered();
367 void onOpenOtherTriggered(QWidget *widget);
368 void onOpenOtherFinished(
int result);
369 void onOpenOtherTriggered();
370 void on_actionClearRecentOnExit_toggled(
bool arg1);
371 void onSceneGraphInitialized();
372 void on_actionShowTextUnderIcons_toggled(
bool b);
373 void on_actionShowSmallIcons_toggled(
bool b);
374 void onPlaylistInChanged(
int in);
375 void onPlaylistOutChanged(
int out);
376 void on_actionPreviewNone_triggered(
bool checked);
377 void on_actionPreview360_triggered(
bool checked);
378 void on_actionPreview540_triggered(
bool checked);
379 void on_actionPreview720_triggered(
bool checked);
380 void on_actionTopics_triggered();
381 void on_actionSync_triggered();
382 void on_actionUseProxy_triggered(
bool checked);
383 void on_actionProxyStorageSet_triggered();
384 void on_actionProxyStorageShow_triggered();
385 void on_actionProxyUseProjectFolder_triggered(
bool checked);
386 void on_actionProxyUseHardware_triggered(
bool checked);
387 void on_actionProxyConfigureHardware_triggered();
388 void updateLayoutSwitcher();
389 void clearCurrentLayout();
390 void onClipboardChanged();
391 void sourceUpdated();
392 void resetSourceUpdated();
393 void on_actionExportChapters_triggered();
394 void on_actionAudioVideoDevice_triggered();
395 void on_actionReset_triggered();
396 void on_actionBackupSave_triggered();
399#define MAIN MainWindow::singleton()