21 #include <QMainWindow>
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)
45 class FilterController;
46 class ScopeController;
55 class 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 setupAndConnectLeapNetworkListener();
161 void setupSettingsMenu();
162 void setupOpenOtherMenu();
164 QAction *addProfile(QActionGroup *actionGroup,
const QString &desc,
const QString &name);
165 QAction *addLayout(QActionGroup *actionGroup,
const QString &name);
166 void readPlayerSettings();
167 void readWindowSettings();
168 void writeSettings();
169 void configureVideoWidget();
170 void setCurrentFile(
const QString &filename);
171 void changeAudioChannels(
bool checked,
int channels);
172 void changeDeinterlacer(
bool checked,
const char *method);
173 void changeInterpolation(
bool checked,
const char *method);
174 bool checkAutoSave(QString &url);
175 bool saveRepairedXmlFile(MltXmlChecker &checker, QString &fileName);
176 void setAudioChannels(
int channels);
177 void showSaveError();
178 void setPreviewScale(
int scale);
179 void setVideoModeMenu();
180 void resetVideoModeMenu();
181 void resetDockCorners();
182 void showIncompatibleProjectMessage(
const QString &shotcutVersion);
183 void restartAfterChangeTheme();
187 QDockWidget *m_propertiesDock;
188 RecentDock *m_recentDock;
189 EncodeDock *m_encodeDock;
190 JobsDock *m_jobsDock;
191 PlaylistDock *m_playlistDock;
192 TimelineDock *m_timelineDock;
193 QString m_currentFile;
194 bool m_isKKeyPressed;
195 QUndoStack *m_undoStack;
196 QDockWidget *m_historyDock;
197 QActionGroup *m_profileGroup;
198 QActionGroup *m_externalGroup;
199 QActionGroup *m_keyerGroup;
200 QActionGroup *m_layoutGroup;
201 QActionGroup *m_previewScaleGroup;
202 FiltersDock *m_filtersDock;
203 FilterController *m_filterController;
204 ScopeController *m_scopeController;
205 QMenu *m_customProfileMenu;
207 QStringList m_multipleFiles;
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;
224 LeapListener m_leapListener;
228 bool isCompatibleWithGpuMode(MltXmlChecker &checker);
229 bool isXmlRepaired(MltXmlChecker &checker, QString &fileName);
230 bool open(QString url,
const Mlt::Properties * =
nullptr,
bool play =
true);
231 void openMultiple(
const QStringList &paths);
232 void openMultiple(
const QList<QUrl> &urls);
234 void openCut(Mlt::Producer *producer,
bool play =
false);
236 void closeProducer();
237 void showStatusMessage(QAction *action,
int timeoutSeconds = 5);
238 void showStatusMessage(
const QString &message,
int timeoutSeconds = 5,
239 QPalette::ColorRole role = QPalette::ToolTipBase);
240 void onStatusMessageClicked();
241 void seekPlaylist(
int start);
242 void seekTimeline(
int position,
bool seekPlayer =
true);
243 void seekKeyframes(
int position);
244 QWidget *loadProducerWidget(Mlt::Producer *producer);
245 void onProducerOpened(
bool withReopen =
true);
246 void onGpuNotSupported();
247 void onShuttle(
float x);
248 void onPropertiesDockTriggered(
bool checked =
true);
249 bool on_actionSave_triggered();
252 void showUpgradePrompt();
253 void on_actionAbout_Shotcut_triggered();
254 void on_actionOpenOther_triggered();
255 void onProducerChanged();
256 bool on_actionSave_As_triggered();
257 void onEncodeTriggered(
bool checked =
true);
258 void onCaptureStateChanged(
bool started);
259 void onJobsDockTriggered(
bool =
true);
260 void onRecentDockTriggered(
bool checked =
true);
261 void onPlaylistDockTriggered(
bool checked =
true);
262 void onTimelineDockTriggered(
bool checked =
true);
263 void onHistoryDockTriggered(
bool checked =
true);
264 void onFiltersDockTriggered(
bool checked =
true);
265 void onKeyframesDockTriggered(
bool checked =
true);
266 void onMarkersDockTriggered(
bool =
true);
267 void onNotesDockTriggered(
bool =
true);
268 void onPlaylistCreated();
269 void onPlaylistLoaded();
270 void onPlaylistCleared();
271 void onPlaylistClosed();
272 void onPlaylistModified();
273 void onMultitrackCreated();
274 void onMultitrackClosed();
275 void onMultitrackModified();
276 void onMultitrackDurationChanged();
277 void onNoteModified();
278 void onCutModified();
279 void onProducerModified();
280 void onFilterModelChanged();
281 void updateMarkers();
282 void updateThumbnails();
283 void on_actionUndo_triggered();
284 void on_actionRedo_triggered();
285 void on_actionFAQ_triggered();
286 void on_actionForum_triggered();
287 void on_actionEnterFullScreen_triggered();
288 void on_actionRealtime_triggered(
bool checked);
289 void on_actionProgressive_triggered(
bool checked);
290 void on_actionChannels1_triggered(
bool checked);
291 void on_actionChannels2_triggered(
bool checked);
292 void on_actionChannels6_triggered(
bool checked);
293 void on_actionOneField_triggered(
bool checked);
294 void on_actionLinearBlend_triggered(
bool checked);
295 void on_actionYadifTemporal_triggered(
bool checked);
296 void on_actionYadifSpatial_triggered(
bool checked);
297 void on_actionNearest_triggered(
bool checked);
298 void on_actionBilinear_triggered(
bool checked);
299 void on_actionBicubic_triggered(
bool checked);
300 void on_actionHyper_triggered(
bool checked);
301 void on_actionJack_triggered(
bool checked);
302 void on_actionGPU_triggered(
bool checked);
303 void onExternalTriggered(QAction *);
304 void onKeyerTriggered(QAction *);
305 void onProfileTriggered(QAction *);
306 void onProfileChanged();
307 void on_actionAddCustomProfile_triggered();
308 void processMultipleFiles();
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 on_actionGammaSRGB_triggered(
bool checked);
325 void on_actionGammaRec709_triggered(
bool checked);
326 void onFocusChanged(QWidget *old, QWidget *now)
const;
327 void onFocusObjectChanged(QObject *obj)
const;
328 void onFocusWindowChanged(QWindow *window)
const;
329 void onTimelineClipSelected();
330 void onAddAllToTimeline(Mlt::Playlist *playlist,
bool skipProxy);
331 void on_actionScrubAudio_triggered(
bool checked);
332 #if !defined(Q_OS_MAC)
333 void onDrawingMethodTriggered(QAction *);
335 void on_actionApplicationLog_triggered();
336 void on_actionClose_triggered();
337 void onPlayerTabIndexChanged(
int index);
338 void onUpgradeCheckFinished(QNetworkReply *reply);
339 void onUpgradeTriggered();
341 void on_actionExportEDL_triggered();
342 void on_actionExportFrame_triggered();
343 void onGLWidgetImageReady();
344 void on_actionAppDataSet_triggered();
345 void on_actionAppDataShow_triggered();
346 void on_actionNew_triggered();
347 void on_actionKeyboardShortcuts_triggered();
348 void on_actionLayoutLogging_triggered();
349 void on_actionLayoutEditing_triggered();
350 void on_actionLayoutEffects_triggered();
351 void on_actionLayoutColor_triggered();
352 void on_actionLayoutAudio_triggered();
353 void on_actionLayoutPlayer_triggered();
354 void on_actionLayoutPlaylist_triggered();
355 void on_actionLayoutClip_triggered();
356 void on_actionLayoutAdd_triggered();
357 void onLayoutTriggered(QAction *);
358 void on_actionProfileRemove_triggered();
359 void on_actionLayoutRemove_triggered();
360 void on_actionOpenOther2_triggered();
361 void onOpenOtherTriggered(QWidget *widget);
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();
391 #define MAIN MainWindow::singleton()