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