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