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)
44 class FilterController;
45 class ScopeController;
53 class AppendTask :
public QObject,
public QRunnable
57 AppendTask(
const QStringList& filenames)
59 , filenames(filenames)
64 void appendToPlaylist(QString);
68 const QStringList filenames;
71 class MainWindow :
public QMainWindow
76 static MainWindow& singleton();
78 void open(Mlt::Producer* producer);
79 bool continueModified();
80 bool continueJobsRunning();
81 QUndoStack* undoStack()
const;
82 bool saveXML(
const QString& filename,
bool withRelativePaths =
true);
83 static void changeTheme(
const QString& theme);
84 PlaylistDock* playlistDock()
const {
return m_playlistDock; }
85 FilterController* filterController()
const {
return m_filterController; }
86 HtmlEditor* htmlEditor()
const {
return m_htmlEditor.data(); }
87 Mlt::Playlist* playlist()
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 QString getFileHash(
const QString& path)
const;
95 QString getHash(Mlt::Properties& properties)
const;
96 void setProfile(
const QString& profile_name);
97 QString fileName()
const {
return m_currentFile; }
98 bool isSourceClipMyProject(QString resource = MLT.resource());
99 bool keyframesDockIsVisible()
const;
101 void keyPressEvent(QKeyEvent*);
102 void keyReleaseEvent(QKeyEvent *);
103 void hideSetDataDirectory();
104 QMenu* customProfileMenu()
const {
return m_customProfileMenu; }
105 QAction* actionAddCustomProfile()
const;
106 QAction* actionProfileRemove()
const;
107 QActionGroup* profileGroup()
const {
return m_profileGroup; }
108 void buildVideoModeMenu(QMenu *topMenu, QMenu *&customMenu, QActionGroup* group, QAction *addAction, QAction *removeAction);
109 void newProject(
const QString& filename,
bool isProjectFolder =
false);
110 void addCustomProfile(
const QString& name, QMenu* menu, QAction* action, QActionGroup* group);
111 void removeCustomProfiles(
const QStringList& profiles, QDir &dir, QMenu* menu, QAction* action);
112 QUuid timelineClipUuid(
int trackIndex,
int clipIndex);
113 void replaceInTimeline(
const QUuid& uuid, Mlt::Producer& producer);
114 Mlt::ClipInfo* timelineClipInfoByUuid(
const QUuid& uuid,
int& trackIndex,
int& clipIndex);
115 void replaceAllByHash(
const QString& hash, Mlt::Producer& producer);
118 void audioChannelsChanged();
119 void producerOpened();
120 void profileChanged();
121 void openFailed(QString);
122 void aboutToShutDown();
126 bool eventFilter(QObject* target, QEvent* event);
127 void dragEnterEvent(QDragEnterEvent*);
128 void dropEvent(QDropEvent*);
129 void closeEvent(QCloseEvent*);
130 void showEvent(QShowEvent*);
133 void setupSettingsMenu();
134 void setupOpenOtherMenu();
135 QAction *addProfile(QActionGroup* actionGroup,
const QString& desc,
const QString& name);
136 QAction *addLayout(QActionGroup* actionGroup,
const QString& name);
137 void readPlayerSettings();
138 void readWindowSettings();
139 void writeSettings();
140 void configureVideoWidget();
141 void setCurrentFile(
const QString &filename);
142 void changeAudioChannels(
bool checked,
int channels);
143 void changeDeinterlacer(
bool checked,
const char* method);
144 void changeInterpolation(
bool checked,
const char* method);
145 bool checkAutoSave(QString &url);
146 void stepLeftBySeconds(
int sec);
147 bool saveRepairedXmlFile(MltXmlChecker& checker, QString& fileName);
148 void setAudioChannels(
int channels);
149 void showSaveError();
150 void setPreviewScale(
int scale);
154 QDockWidget* m_propertiesDock;
155 RecentDock* m_recentDock;
156 EncodeDock* m_encodeDock;
157 JobsDock* m_jobsDock;
158 PlaylistDock* m_playlistDock;
159 TimelineDock* m_timelineDock;
160 QString m_currentFile;
161 bool m_isKKeyPressed;
162 QUndoStack* m_undoStack;
163 QDockWidget* m_historyDock;
164 QActionGroup* m_profileGroup;
165 QActionGroup* m_externalGroup;
166 QActionGroup* m_keyerGroup;
167 QActionGroup* m_layoutGroup;
168 QActionGroup* m_previewScaleGroup;
169 FiltersDock* m_filtersDock;
170 FilterController* m_filterController;
171 ScopeController* m_scopeController;
172 QMenu* m_customProfileMenu;
174 QStringList m_multipleFiles;
175 bool m_isPlaylistLoaded;
176 QActionGroup* m_languagesGroup;
177 QScopedPointer<HtmlEditor> m_htmlEditor;
178 QSharedPointer<AutoSaveFile> m_autosaveFile;
179 QMutex m_autosaveMutex;
180 QTimer m_autosaveTimer;
182 int m_navigationPosition;
183 QScopedPointer<QAction> m_statusBarAction;
184 QNetworkAccessManager m_network;
185 QString m_upgradeUrl;
186 KeyframesDock* m_keyframesDock;
189 LeapListener m_leapListener;
193 bool isCompatibleWithGpuMode(MltXmlChecker& checker);
194 bool isXmlRepaired(MltXmlChecker& checker, QString& fileName);
195 void updateAutoSave();
196 void open(QString url,
const Mlt::Properties* = 0);
197 void openMultiple(
const QStringList& paths);
198 void openMultiple(
const QList<QUrl>& urls);
200 void openCut(Mlt::Producer* producer,
bool play =
false);
202 void closeProducer();
203 void showStatusMessage(QAction* action,
int timeoutSeconds = 5);
204 void showStatusMessage(
const QString& message,
int timeoutSeconds = 5);
205 void seekPlaylist(
int start);
206 void seekTimeline(
int position,
bool seekPlayer =
true);
207 void seekKeyframes(
int position);
208 QWidget* loadProducerWidget(Mlt::Producer* producer);
209 void onProducerOpened(
bool withReopen =
true);
210 void onGpuNotSupported();
211 void editHTML(
const QString& fileName);
212 void stepLeftOneFrame();
213 void stepRightOneFrame();
214 void stepLeftOneSecond();
215 void stepRightOneSecond();
216 void setInToCurrent(
bool ripple);
217 void setOutToCurrent(
bool ripple);
218 void onShuttle(
float x);
219 void onPropertiesDockTriggered(
bool checked =
true);
220 bool on_actionSave_triggered();
223 void showUpgradePrompt();
224 void on_actionAbout_Shotcut_triggered();
225 void on_actionOpenOther_triggered();
226 void onProducerChanged();
227 bool on_actionSave_As_triggered();
228 void onEncodeTriggered(
bool checked =
true);
229 void onCaptureStateChanged(
bool started);
230 void onJobsDockTriggered(
bool =
true);
231 void onRecentDockTriggered(
bool checked =
true);
232 void onPlaylistDockTriggered(
bool checked =
true);
233 void onTimelineDockTriggered(
bool checked =
true);
234 void onHistoryDockTriggered(
bool checked =
true);
235 void onFiltersDockTriggered(
bool checked =
true);
236 void onKeyframesDockTriggered(
bool checked =
true);
237 void onPlaylistCreated();
238 void onPlaylistLoaded();
239 void onPlaylistCleared();
240 void onPlaylistClosed();
241 void onPlaylistModified();
242 void onMultitrackCreated();
243 void onMultitrackClosed();
244 void onMultitrackModified();
245 void onMultitrackDurationChanged();
246 void onCutModified();
247 void onProducerModified();
248 void onFilterModelChanged();
249 void updateMarkers();
250 void updateThumbnails();
251 void on_actionUndo_triggered();
252 void on_actionRedo_triggered();
253 void on_actionFAQ_triggered();
254 void on_actionForum_triggered();
255 void on_actionEnter_Full_Screen_triggered();
256 void on_actionRealtime_triggered(
bool checked);
257 void on_actionProgressive_triggered(
bool checked);
258 void on_actionChannels1_triggered(
bool checked);
259 void on_actionChannels2_triggered(
bool checked);
260 void on_actionChannels6_triggered(
bool checked);
261 void on_actionOneField_triggered(
bool checked);
262 void on_actionLinearBlend_triggered(
bool checked);
263 void on_actionYadifTemporal_triggered(
bool checked);
264 void on_actionYadifSpatial_triggered(
bool checked);
265 void on_actionNearest_triggered(
bool checked);
266 void on_actionBilinear_triggered(
bool checked);
267 void on_actionBicubic_triggered(
bool checked);
268 void on_actionHyper_triggered(
bool checked);
269 void on_actionJack_triggered(
bool checked);
270 void on_actionGPU_triggered(
bool checked);
271 void onExternalTriggered(QAction*);
272 void onKeyerTriggered(QAction*);
273 void onProfileTriggered(QAction*);
274 void onProfileChanged();
275 void on_actionAddCustomProfile_triggered();
276 void processMultipleFiles();
277 void onLanguageTriggered(QAction*);
278 void on_actionSystemTheme_triggered();
279 void on_actionFusionDark_triggered();
280 void on_actionFusionLight_triggered();
281 void on_actionTutorials_triggered();
282 void on_actionRestoreLayout_triggered();
283 void on_actionShowTitleBars_triggered(
bool checked);
284 void on_actionShowToolbar_triggered(
bool checked);
285 void onToolbarVisibilityChanged(
bool visible);
286 void on_menuExternal_aboutToShow();
287 void on_actionUpgrade_triggered();
288 void on_actionOpenXML_triggered();
289 void onAutosaveTimeout();
290 void on_actionGammaSRGB_triggered(
bool checked);
291 void on_actionGammaRec709_triggered(
bool checked);
292 void onFocusChanged(QWidget *old, QWidget * now)
const;
293 void onFocusObjectChanged(QObject *obj)
const;
294 void onFocusWindowChanged(QWindow *window)
const;
295 void onTimelineClipSelected();
296 void onAddAllToTimeline(Mlt::Playlist* playlist);
297 void on_actionScrubAudio_triggered(
bool checked);
298 #if !defined(Q_OS_MAC)
299 void onDrawingMethodTriggered(QAction*);
301 void on_actionApplicationLog_triggered();
302 void on_actionClose_triggered();
303 void onPlayerTabIndexChanged(
int index);
304 void onUpgradeCheckFinished(QNetworkReply* reply);
305 void onUpgradeTriggered();
306 void onTimelineSelectionChanged();
307 void on_actionCut_triggered();
308 void on_actionCopy_triggered();
309 void on_actionPaste_triggered();
311 void on_actionExportEDL_triggered();
312 void on_actionExportFrame_triggered();
313 void onGLWidgetImageReady();
314 void on_actionAppDataSet_triggered();
315 void on_actionAppDataShow_triggered();
316 void on_actionNew_triggered();
317 void on_actionKeyboardShortcuts_triggered();
318 void on_actionLayoutPlayer_triggered();
319 void on_actionLayoutPlaylist_triggered();
320 void on_actionLayoutTimeline_triggered();
321 void on_actionLayoutClip_triggered();
322 void on_actionLayoutAdd_triggered();
323 void onLayoutTriggered(QAction*);
324 void on_actionProfileRemove_triggered();
325 void on_actionLayoutRemove_triggered();
326 void onAppendToPlaylist(
const QString& xml);
327 void onAppendTaskDone();
328 void on_actionOpenOther2_triggered();
329 void onOpenOtherTriggered(QWidget* widget);
330 void onOpenOtherTriggered();
331 void on_actionClearRecentOnExit_toggled(
bool arg1);
332 void onSceneGraphInitialized();
333 void on_actionShowTextUnderIcons_toggled(
bool b);
334 void on_actionShowSmallIcons_toggled(
bool b);
335 void onPlaylistInChanged(
int in);
336 void onPlaylistOutChanged(
int out);
337 void on_actionPreviewNone_triggered(
bool checked);
338 void on_actionPreview360_triggered(
bool checked);
339 void on_actionPreview540_triggered(
bool checked);
340 void on_actionPreview720_triggered(
bool checked);
343 #define MAIN MainWindow::singleton()
345 #endif // MAINWINDOW_H