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;
131 void audioChannelsChanged();
132 void producerOpened(
bool withReopen =
true);
133 void profileChanged();
134 void openFailed(QString);
135 void aboutToShutDown();
136 void renameRequested();
137 void serviceInChanged(
int delta, Mlt::Service *);
138 void serviceOutChanged(
int delta, Mlt::Service *);
142 bool eventFilter(QObject *target, QEvent *event);
143 void dragEnterEvent(QDragEnterEvent *);
144 void dropEvent(QDropEvent *);
145 void closeEvent(QCloseEvent *);
146 void showEvent(QShowEvent *);
147 void hideEvent(QHideEvent *event);
150 void connectFocusSignals();
151 void registerDebugCallback();
152 void connectUISignals();
153 void setupAndConnectUndoStack();
154 void setupAndConnectPlayerWidget();
155 void setupLayoutSwitcher();
156 void centerLayoutInRemainingToolbarSpace();
157 void setupAndConnectDocks();
158 void setupMenuView();
159 void connectVideoWidgetSignals();
160 void setupSettingsMenu();
161 void setupOpenOtherMenu();
163 QAction *addProfile(QActionGroup *actionGroup,
const QString &desc,
const QString &name);
164 QAction *addLayout(QActionGroup *actionGroup,
const QString &name);
165 void readPlayerSettings();
166 void readWindowSettings();
167 void writeSettings();
168 void configureVideoWidget();
169 void setCurrentFile(
const QString &filename);
170 void changeAudioChannels(
bool checked,
int channels);
171 void changeDeinterlacer(
bool checked,
const char *method);
172 void changeInterpolation(
bool checked,
const char *method);
173 bool checkAutoSave(QString &url);
174 bool saveRepairedXmlFile(MltXmlChecker &checker, QString &fileName);
175 void setAudioChannels(
int channels);
176 void showSaveError();
177 void setPreviewScale(
int scale);
178 void setVideoModeMenu();
179 void resetVideoModeMenu();
180 void resetDockCorners();
181 void showIncompatibleProjectMessage(
const QString &shotcutVersion);
182 void restartAfterChangeTheme();
186 QDockWidget *m_propertiesDock;
187 RecentDock *m_recentDock;
188 EncodeDock *m_encodeDock;
189 JobsDock *m_jobsDock;
190 PlaylistDock *m_playlistDock;
191 TimelineDock *m_timelineDock;
192 QString m_currentFile;
193 bool m_isKKeyPressed;
194 QUndoStack *m_undoStack;
195 QDockWidget *m_historyDock;
196 QActionGroup *m_profileGroup;
197 QActionGroup *m_externalGroup;
198 QActionGroup *m_keyerGroup;
199 QActionGroup *m_layoutGroup;
200 QActionGroup *m_previewScaleGroup;
201 FiltersDock *m_filtersDock;
202 FilterController *m_filterController;
203 ScopeController *m_scopeController;
204 QMenu *m_customProfileMenu;
206 QStringList m_multipleFiles;
207 bool m_multipleFilesLoading;
208 bool m_isPlaylistLoaded;
209 QActionGroup *m_languagesGroup;
210 QSharedPointer<AutoSaveFile> m_autosaveFile;
211 QMutex m_autosaveMutex;
212 QTimer m_autosaveTimer;
214 QScopedPointer<QAction> m_statusBarAction;
215 QNetworkAccessManager m_network;
216 QString m_upgradeUrl;
217 KeyframesDock *m_keyframesDock;
218 QDateTime m_clipboardUpdatedAt;
219 QDateTime m_sourceUpdatedAt;
220 MarkersDock *m_markersDock;
221 NotesDock *m_notesDock;
222 std::unique_ptr<QWidget> m_producerWidget;
225 bool isCompatibleWithGpuMode(MltXmlChecker &checker);
226 bool isXmlRepaired(MltXmlChecker &checker, QString &fileName);
227 bool open(QString url,
const Mlt::Properties * =
nullptr,
bool play =
true,
228 bool skipConvert =
false);
229 void openMultiple(
const QStringList &paths);
230 void openMultiple(
const QList<QUrl> &urls);
232 void openCut(Mlt::Producer *producer,
bool play =
false);
234 void closeProducer();
235 void showStatusMessage(QAction *action,
int timeoutSeconds = 5);
236 void showStatusMessage(
const QString &message,
int timeoutSeconds = 5,
237 QPalette::ColorRole role = QPalette::ToolTipBase);
238 void onStatusMessageClicked();
239 void seekPlaylist(
int start);
240 void seekTimeline(
int position,
bool seekPlayer =
true);
241 void seekKeyframes(
int position);
242 QWidget *loadProducerWidget(Mlt::Producer *producer);
243 void onProducerOpened(
bool withReopen =
true);
244 void onGpuNotSupported();
245 void onShuttle(
float x);
246 void onPropertiesDockTriggered(
bool checked =
true);
247 bool on_actionSave_triggered();
250 void showUpgradePrompt();
251 void on_actionAbout_Shotcut_triggered();
252 void on_actionOpenOther_triggered();
253 void onProducerChanged();
254 bool on_actionSave_As_triggered();
255 void onEncodeTriggered(
bool checked =
true);
256 void onCaptureStateChanged(
bool started);
257 void onJobsDockTriggered(
bool =
true);
258 void onRecentDockTriggered(
bool checked =
true);
259 void onPlaylistDockTriggered(
bool checked =
true);
260 void onTimelineDockTriggered(
bool checked =
true);
261 void onHistoryDockTriggered(
bool checked =
true);
262 void onFiltersDockTriggered(
bool checked =
true);
263 void onKeyframesDockTriggered(
bool checked =
true);
264 void onMarkersDockTriggered(
bool =
true);
265 void onNotesDockTriggered(
bool =
true);
266 void onPlaylistCreated();
267 void onPlaylistLoaded();
268 void onPlaylistCleared();
269 void onPlaylistClosed();
270 void onPlaylistModified();
271 void onMultitrackCreated();
272 void onMultitrackClosed();
273 void onMultitrackModified();
274 void onMultitrackDurationChanged();
275 void onNoteModified();
276 void onCutModified();
277 void onProducerModified();
278 void onFilterModelChanged();
279 void updateMarkers();
280 void updateThumbnails();
281 void on_actionUndo_triggered();
282 void on_actionRedo_triggered();
283 void on_actionFAQ_triggered();
284 void on_actionForum_triggered();
285 void on_actionEnterFullScreen_triggered();
286 void on_actionRealtime_triggered(
bool checked);
287 void on_actionProgressive_triggered(
bool checked);
288 void on_actionChannels1_triggered(
bool checked);
289 void on_actionChannels2_triggered(
bool checked);
290 void on_actionChannels6_triggered(
bool checked);
291 void on_actionOneField_triggered(
bool checked);
292 void on_actionLinearBlend_triggered(
bool checked);
293 void on_actionYadifTemporal_triggered(
bool checked);
294 void on_actionYadifSpatial_triggered(
bool checked);
295 void on_actionBwdif_triggered(
bool checked);
296 void on_actionNearest_triggered(
bool checked);
297 void on_actionBilinear_triggered(
bool checked);
298 void on_actionBicubic_triggered(
bool checked);
299 void on_actionHyper_triggered(
bool checked);
300 void on_actionJack_triggered(
bool checked);
301 void on_actionGPU_triggered(
bool checked);
302 void onExternalTriggered(QAction *);
303 void onKeyerTriggered(QAction *);
304 void onProfileTriggered(QAction *);
305 void onProfileChanged();
306 void on_actionAddCustomProfile_triggered();
307 void processMultipleFiles();
308 void processSingleFile();
309 void onLanguageTriggered(QAction *);
310 void on_actionSystemTheme_triggered();
311 void on_actionFusionDark_triggered();
312 void on_actionJobPriorityLow_triggered();
313 void on_actionJobPriorityNormal_triggered();
314 void on_actionFusionLight_triggered();
315 void on_actionTutorials_triggered();
316 void on_actionRestoreLayout_triggered();
317 void on_actionShowTitleBars_triggered(
bool checked);
318 void on_actionShowToolbar_triggered(
bool checked);
319 void onToolbarVisibilityChanged(
bool visible);
320 void on_menuExternal_aboutToShow();
321 void on_actionUpgrade_triggered();
322 void on_actionOpenXML_triggered();
323 void onAutosaveTimeout();
324 void onFocusChanged(QWidget *old, QWidget *now)
const;
325 void onFocusObjectChanged(QObject *obj)
const;
326 void onFocusWindowChanged(QWindow *window)
const;
327 void onTimelineClipSelected();
328 void onAddAllToTimeline(Mlt::Playlist *playlist,
bool skipProxy);
329 void on_actionScrubAudio_triggered(
bool checked);
330#if !defined(Q_OS_MAC)
331 void onDrawingMethodTriggered(QAction *);
333 void on_actionResources_triggered();
334 void on_actionApplicationLog_triggered();
335 void on_actionClose_triggered();
336 void onPlayerTabIndexChanged(
int index);
337 void onUpgradeCheckFinished(QNetworkReply *reply);
338 void onUpgradeTriggered();
340 void on_actionExportEDL_triggered();
341 void on_actionExportFrame_triggered();
342 void onVideoWidgetImageReady();
343 void on_actionAppDataSet_triggered();
344 void on_actionAppDataShow_triggered();
345 void on_actionNew_triggered();
346 void on_actionKeyboardShortcuts_triggered();
347 void on_actionLayoutLogging_triggered();
348 void on_actionLayoutEditing_triggered();
349 void on_actionLayoutEffects_triggered();
350 void on_actionLayoutColor_triggered();
351 void on_actionLayoutAudio_triggered();
352 void on_actionLayoutPlayer_triggered();
353 void on_actionLayoutPlaylist_triggered();
354 void on_actionLayoutClip_triggered();
355 void on_actionLayoutAdd_triggered();
356 void onLayoutTriggered(QAction *);
357 void on_actionProfileRemove_triggered();
358 void on_actionLayoutRemove_triggered();
359 void on_actionOpenOther2_triggered();
360 void onOpenOtherTriggered(QWidget *widget);
361 void onOpenOtherFinished(
int result);
362 void onOpenOtherTriggered();
363 void on_actionClearRecentOnExit_toggled(
bool arg1);
364 void onSceneGraphInitialized();
365 void on_actionShowTextUnderIcons_toggled(
bool b);
366 void on_actionShowSmallIcons_toggled(
bool b);
367 void onPlaylistInChanged(
int in);
368 void onPlaylistOutChanged(
int out);
369 void on_actionPreviewNone_triggered(
bool checked);
370 void on_actionPreview360_triggered(
bool checked);
371 void on_actionPreview540_triggered(
bool checked);
372 void on_actionPreview720_triggered(
bool checked);
373 void on_actionTopics_triggered();
374 void on_actionSync_triggered();
375 void on_actionUseProxy_triggered(
bool checked);
376 void on_actionProxyStorageSet_triggered();
377 void on_actionProxyStorageShow_triggered();
378 void on_actionProxyUseProjectFolder_triggered(
bool checked);
379 void on_actionProxyUseHardware_triggered(
bool checked);
380 void on_actionProxyConfigureHardware_triggered();
381 void updateLayoutSwitcher();
382 void clearCurrentLayout();
383 void onClipboardChanged();
384 void sourceUpdated();
385 void resetSourceUpdated();
386 void on_actionExportChapters_triggered();
387 void on_actionAudioVideoDevice_triggered();
388 void on_actionReset_triggered();
389 void on_actionBackupSave_triggered();
392#define MAIN MainWindow::singleton()