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;
56class MainWindow :
public QMainWindow
71 static MainWindow &singleton();
73 void open(Mlt::Producer *producer);
74 bool continueModified();
75 bool continueJobsRunning();
76 QUndoStack *undoStack()
const;
77 bool saveXML(
const QString &filename,
bool withRelativePaths =
true);
78 static void changeTheme(
const QString &theme);
79 PlaylistDock *playlistDock()
const
81 return m_playlistDock;
83 FilterController *filterController()
const
85 return m_filterController;
87 Mlt::Playlist *playlist()
const;
88 bool isPlaylistValid()
const;
89 Mlt::Producer *multitrack()
const;
90 bool isMultitrackValid()
const;
92 void setFullScreen(
bool isFullScreen);
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 SubtitlesDock *m_subtitlesDock;
229 std::unique_ptr<QWidget> m_producerWidget;
232 bool isCompatibleWithGpuMode(MltXmlChecker &checker);
233 bool isXmlRepaired(MltXmlChecker &checker, QString &fileName);
234 bool open(QString url,
const Mlt::Properties * =
nullptr,
bool play =
true,
235 bool skipConvert =
false);
236 void openMultiple(
const QStringList &paths);
237 void openMultiple(
const QList<QUrl> &urls);
239 void openCut(Mlt::Producer *producer,
bool play =
false);
241 void closeProducer();
242 void showStatusMessage(QAction *action,
int timeoutSeconds = 5);
243 void showStatusMessage(
const QString &message,
int timeoutSeconds = 5,
244 QPalette::ColorRole role = QPalette::ToolTipBase);
245 void onStatusMessageClicked();
246 void seekPlaylist(
int start);
247 void seekTimeline(
int position,
bool seekPlayer =
true);
248 void seekKeyframes(
int position);
249 QWidget *loadProducerWidget(Mlt::Producer *producer);
250 void onProducerOpened(
bool withReopen =
true);
251 void onGpuNotSupported();
252 void onShuttle(
float x);
253 void onPropertiesDockTriggered(
bool checked =
true);
254 bool on_actionSave_triggered();
255 void onCreateOrEditFilterOnOutput(Mlt::Filter *filter,
const QStringList &key_properties);
258 void showUpgradePrompt();
259 void on_actionAbout_Shotcut_triggered();
260 void on_actionOpenOther_triggered();
261 void onProducerChanged();
262 bool on_actionSave_As_triggered();
263 void onEncodeTriggered(
bool checked =
true);
264 void onCaptureStateChanged(
bool started);
265 void onJobsDockTriggered(
bool =
true);
266 void onRecentDockTriggered(
bool checked =
true);
267 void onPlaylistDockTriggered(
bool checked =
true);
268 void onTimelineDockTriggered(
bool checked =
true);
269 void onHistoryDockTriggered(
bool checked =
true);
270 void onFiltersDockTriggered(
bool checked =
true);
271 void onKeyframesDockTriggered(
bool checked =
true);
272 void onMarkersDockTriggered(
bool =
true);
273 void onNotesDockTriggered(
bool =
true);
274 void onSubtitlesDockTriggered(
bool =
true);
275 void onPlaylistCreated();
276 void onPlaylistLoaded();
277 void onPlaylistCleared();
278 void onPlaylistClosed();
279 void onPlaylistModified();
280 void onMultitrackCreated();
281 void onMultitrackClosed();
282 void onMultitrackModified();
283 void onMultitrackDurationChanged();
284 void onNoteModified();
285 void onSubtitleModified();
286 void onCutModified();
287 void onProducerModified();
288 void onFilterModelChanged();
289 void updateMarkers();
290 void updateThumbnails();
291 void on_actionUndo_triggered();
292 void on_actionRedo_triggered();
293 void on_actionFAQ_triggered();
294 void on_actionForum_triggered();
295 void on_actionEnterFullScreen_triggered();
296 void on_actionRealtime_triggered(
bool checked);
297 void on_actionProgressive_triggered(
bool checked);
298 void on_actionChannels1_triggered(
bool checked);
299 void on_actionChannels2_triggered(
bool checked);
300 void on_actionChannels4_triggered(
bool checked);
301 void on_actionChannels6_triggered(
bool checked);
302 void on_actionOneField_triggered(
bool checked);
303 void on_actionLinearBlend_triggered(
bool checked);
304 void on_actionYadifTemporal_triggered(
bool checked);
305 void on_actionYadifSpatial_triggered(
bool checked);
306 void on_actionBwdif_triggered(
bool checked);
307 void on_actionNearest_triggered(
bool checked);
308 void on_actionBilinear_triggered(
bool checked);
309 void on_actionBicubic_triggered(
bool checked);
310 void on_actionHyper_triggered(
bool checked);
311 void on_actionJack_triggered(
bool checked);
312 void on_actionGPU_triggered(
bool checked);
313 void onExternalTriggered(QAction *);
314 void onKeyerTriggered(QAction *);
315 void onProfileTriggered(QAction *);
316 void onProfileChanged();
317 void on_actionAddCustomProfile_triggered();
318 void processMultipleFiles();
319 void processSingleFile();
320 void onLanguageTriggered(QAction *);
321 void on_actionSystemTheme_triggered();
322 void on_actionFusionDark_triggered();
323 void on_actionJobPriorityLow_triggered();
324 void on_actionJobPriorityNormal_triggered();
325 void on_actionFusionLight_triggered();
326 void on_actionTutorials_triggered();
327 void on_actionRestoreLayout_triggered();
328 void on_actionShowTitleBars_triggered(
bool checked);
329 void on_actionShowToolbar_triggered(
bool checked);
330 void onToolbarVisibilityChanged(
bool visible);
331 void on_menuExternal_aboutToShow();
332 void on_actionUpgrade_triggered();
333 void on_actionOpenXML_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_actionKeyboardShortcuts_triggered();
358 void on_actionLayoutLogging_triggered();
359 void on_actionLayoutEditing_triggered();
360 void on_actionLayoutEffects_triggered();
361 void on_actionLayoutColor_triggered();
362 void on_actionLayoutAudio_triggered();
363 void on_actionLayoutPlayer_triggered();
364 void on_actionLayoutPlaylist_triggered();
365 void on_actionLayoutClip_triggered();
366 void on_actionLayoutAdd_triggered();
367 void onLayoutTriggered(QAction *);
368 void on_actionProfileRemove_triggered();
369 void on_actionLayoutRemove_triggered();
370 void on_actionOpenOther2_triggered();
371 void onOpenOtherTriggered(QWidget *widget);
372 void onOpenOtherFinished(
int result);
373 void onOpenOtherTriggered();
374 void on_actionClearRecentOnExit_toggled(
bool arg1);
375 void onSceneGraphInitialized();
376 void on_actionShowTextUnderIcons_toggled(
bool b);
377 void on_actionShowSmallIcons_toggled(
bool b);
378 void onPlaylistInChanged(
int in);
379 void onPlaylistOutChanged(
int out);
380 void on_actionPreviewNone_triggered(
bool checked);
381 void on_actionPreview360_triggered(
bool checked);
382 void on_actionPreview540_triggered(
bool checked);
383 void on_actionPreview720_triggered(
bool checked);
384 void on_actionTopics_triggered();
385 void on_actionSync_triggered();
386 void on_actionUseProxy_triggered(
bool checked);
387 void on_actionProxyStorageSet_triggered();
388 void on_actionProxyStorageShow_triggered();
389 void on_actionProxyUseProjectFolder_triggered(
bool checked);
390 void on_actionProxyUseHardware_triggered(
bool checked);
391 void on_actionProxyConfigureHardware_triggered();
392 void updateLayoutSwitcher();
393 void clearCurrentLayout();
394 void onClipboardChanged();
395 void sourceUpdated();
396 void resetSourceUpdated();
397 void on_actionExportChapters_triggered();
398 void on_actionAudioVideoDevice_triggered();
399 void on_actionReset_triggered();
400 void on_actionBackupSave_triggered();
403#define MAIN MainWindow::singleton()