forked from mltframework/shotcut
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainwindow.h
More file actions
401 lines (384 loc) · 14.2 KB
/
mainwindow.h
File metadata and controls
401 lines (384 loc) · 14.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
/*
* Copyright (c) 2011-2021 Meltytech, LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QMutex>
#include <QTimer>
#include <QUrl>
#include <QNetworkAccessManager>
#include <QScopedPointer>
#include <QSharedPointer>
#include <QDateTime>
#include "mltcontroller.h"
#include "mltxmlchecker.h"
#define EXIT_RESTART (42)
namespace Ui {
class MainWindow;
}
class Player;
class RecentDock;
class EncodeDock;
class JobsDock;
class PlaylistDock;
class QUndoStack;
class QActionGroup;
class FilterController;
class ScopeController;
class FiltersDock;
class TimelineDock;
class AutoSaveFile;
class QNetworkReply;
class KeyframesDock;
class MarkersDock;
class NotesDock;
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
enum LayoutMode {
Custom = 0,
Logging,
Editing,
Effects,
Color,
Audio,
PlayerOnly
};
static MainWindow &singleton();
~MainWindow();
void open(Mlt::Producer *producer);
bool continueModified();
bool continueJobsRunning();
QUndoStack *undoStack() const;
bool saveXML(const QString &filename, bool withRelativePaths = true);
static void changeTheme(const QString &theme);
PlaylistDock *playlistDock() const
{
return m_playlistDock;
}
FilterController *filterController() const
{
return m_filterController;
}
Mlt::Playlist *playlist() const;
bool isPlaylistValid() const;
Mlt::Producer *multitrack() const;
bool isMultitrackValid() const;
void doAutosave();
void setFullScreen(bool isFullScreen);
QString removeFileScheme(QUrl &url);
QString untitledFileName() const;
void setProfile(const QString &profile_name);
QString fileName() const
{
return m_currentFile;
}
bool isSourceClipMyProject(QString resource = MLT.resource(), bool withDialog = true);
bool keyframesDockIsVisible() const;
void keyPressEvent(QKeyEvent *);
void keyReleaseEvent(QKeyEvent *);
void hideSetDataDirectory();
QMenu *customProfileMenu() const
{
return m_customProfileMenu;
}
QAction *actionAddCustomProfile() const;
QAction *actionProfileRemove() const;
QActionGroup *profileGroup() const
{
return m_profileGroup;
}
void buildVideoModeMenu(QMenu *topMenu, QMenu *&customMenu, QActionGroup *group, QAction *addAction,
QAction *removeAction);
void newProject(const QString &filename, bool isProjectFolder = false);
void addCustomProfile(const QString &name, QMenu *menu, QAction *action, QActionGroup *group);
void removeCustomProfiles(const QStringList &profiles, QDir &dir, QMenu *menu, QAction *action);
QUuid timelineClipUuid(int trackIndex, int clipIndex);
void replaceInTimeline(const QUuid &uuid, Mlt::Producer &producer);
Mlt::ClipInfo *timelineClipInfoByUuid(const QUuid &uuid, int &trackIndex, int &clipIndex);
void replaceAllByHash(const QString &hash, Mlt::Producer &producer, bool isProxy = false);
bool isClipboardNewer() const
{
return m_clipboardUpdatedAt > m_sourceUpdatedAt;
}
signals:
void audioChannelsChanged();
void producerOpened(bool withReopen = true);
void profileChanged();
void openFailed(QString);
void aboutToShutDown();
void renameRequested();
void serviceInChanged(int delta, Mlt::Service *);
void serviceOutChanged(int delta, Mlt::Service *);
protected:
MainWindow();
bool eventFilter(QObject *target, QEvent *event);
void dragEnterEvent(QDragEnterEvent *);
void dropEvent(QDropEvent *);
void closeEvent(QCloseEvent *);
void showEvent(QShowEvent *);
void hideEvent(QHideEvent *event);
private:
void connectFocusSignals();
void registerDebugCallback();
void connectUISignals();
void setupAndConnectUndoStack();
void setupAndConnectPlayerWidget();
void setupLayoutSwitcher();
void centerLayoutInRemainingToolbarSpace();
void setupAndConnectDocks();
void setupMenuView();
void connectVideoWidgetSignals();
void setupAndConnectLeapNetworkListener();
void setupSettingsMenu();
void setupOpenOtherMenu();
QAction *addProfile(QActionGroup *actionGroup, const QString &desc, const QString &name);
QAction *addLayout(QActionGroup *actionGroup, const QString &name);
void readPlayerSettings();
void readWindowSettings();
void writeSettings();
void configureVideoWidget();
void setCurrentFile(const QString &filename);
void changeAudioChannels(bool checked, int channels);
void changeDeinterlacer(bool checked, const char *method);
void changeInterpolation(bool checked, const char *method);
bool checkAutoSave(QString &url);
void stepLeftBySeconds(int sec);
bool saveRepairedXmlFile(MltXmlChecker &checker, QString &fileName);
void setAudioChannels(int channels);
void showSaveError();
void setPreviewScale(int scale);
void setVideoModeMenu();
void resetVideoModeMenu();
void resetDockCorners();
void showIncompatibleProjectMessage(const QString &shotcutVersion);
void restartAfterChangeTheme();
Ui::MainWindow *ui;
Player *m_player;
QDockWidget *m_propertiesDock;
RecentDock *m_recentDock;
EncodeDock *m_encodeDock;
JobsDock *m_jobsDock;
PlaylistDock *m_playlistDock;
TimelineDock *m_timelineDock;
QString m_currentFile;
bool m_isKKeyPressed;
QUndoStack *m_undoStack;
QDockWidget *m_historyDock;
QActionGroup *m_profileGroup;
QActionGroup *m_externalGroup;
QActionGroup *m_keyerGroup;
QActionGroup *m_layoutGroup;
QActionGroup *m_previewScaleGroup;
FiltersDock *m_filtersDock;
FilterController *m_filterController;
ScopeController *m_scopeController;
QMenu *m_customProfileMenu;
QMenu *m_keyerMenu;
QStringList m_multipleFiles;
bool m_isPlaylistLoaded;
QActionGroup *m_languagesGroup;
QSharedPointer<AutoSaveFile> m_autosaveFile;
QMutex m_autosaveMutex;
QTimer m_autosaveTimer;
int m_exitCode;
int m_navigationPosition;
QScopedPointer<QAction> m_statusBarAction;
QNetworkAccessManager m_network;
QString m_upgradeUrl;
KeyframesDock *m_keyframesDock;
QDateTime m_clipboardUpdatedAt;
QDateTime m_sourceUpdatedAt;
MarkersDock *m_markersDock;
NotesDock *m_notesDock;
#ifdef WITH_LIBLEAP
LeapListener m_leapListener;
#endif
public slots:
bool isCompatibleWithGpuMode(MltXmlChecker &checker);
bool isXmlRepaired(MltXmlChecker &checker, QString &fileName);
void open(QString url, const Mlt::Properties * = nullptr, bool play = true);
void openMultiple(const QStringList &paths);
void openMultiple(const QList<QUrl> &urls);
void openVideo();
void openCut(Mlt::Producer *producer, bool play = false);
void hideProducer();
void closeProducer();
void showStatusMessage(QAction *action, int timeoutSeconds = 5);
void showStatusMessage(const QString &message, int timeoutSeconds = 5,
QPalette::ColorRole role = QPalette::ToolTipBase);
void onStatusMessageClicked();
void seekPlaylist(int start);
void seekTimeline(int position, bool seekPlayer = true);
void seekKeyframes(int position);
QWidget *loadProducerWidget(Mlt::Producer *producer);
void onProducerOpened(bool withReopen = true);
void onGpuNotSupported();
void stepLeftOneFrame();
void stepRightOneFrame();
void stepLeftOneSecond();
void stepRightOneSecond();
void setInToCurrent(bool ripple);
void setOutToCurrent(bool ripple);
void onShuttle(float x);
void onPropertiesDockTriggered(bool checked = true);
bool on_actionSave_triggered();
private slots:
void showUpgradePrompt();
void on_actionAbout_Shotcut_triggered();
void on_actionOpenOther_triggered();
void onProducerChanged();
bool on_actionSave_As_triggered();
void onEncodeTriggered(bool checked = true);
void onCaptureStateChanged(bool started);
void onJobsDockTriggered(bool = true);
void onRecentDockTriggered(bool checked = true);
void onPlaylistDockTriggered(bool checked = true);
void onTimelineDockTriggered(bool checked = true);
void onHistoryDockTriggered(bool checked = true);
void onFiltersDockTriggered(bool checked = true);
void onKeyframesDockTriggered(bool checked = true);
void onMarkersDockTriggered(bool = true);
void onNotesDockTriggered(bool = true);
void onPlaylistCreated();
void onPlaylistLoaded();
void onPlaylistCleared();
void onPlaylistClosed();
void onPlaylistModified();
void onMultitrackCreated();
void onMultitrackClosed();
void onMultitrackModified();
void onMultitrackDurationChanged();
void onNoteModified();
void onCutModified();
void onProducerModified();
void onFilterModelChanged();
void updateMarkers();
void updateThumbnails();
void on_actionUndo_triggered();
void on_actionRedo_triggered();
void on_actionFAQ_triggered();
void on_actionForum_triggered();
void on_actionEnter_Full_Screen_triggered();
void on_actionRealtime_triggered(bool checked);
void on_actionProgressive_triggered(bool checked);
void on_actionChannels1_triggered(bool checked);
void on_actionChannels2_triggered(bool checked);
void on_actionChannels6_triggered(bool checked);
void on_actionOneField_triggered(bool checked);
void on_actionLinearBlend_triggered(bool checked);
void on_actionYadifTemporal_triggered(bool checked);
void on_actionYadifSpatial_triggered(bool checked);
void on_actionNearest_triggered(bool checked);
void on_actionBilinear_triggered(bool checked);
void on_actionBicubic_triggered(bool checked);
void on_actionHyper_triggered(bool checked);
void on_actionJack_triggered(bool checked);
void on_actionGPU_triggered(bool checked);
void onExternalTriggered(QAction *);
void onKeyerTriggered(QAction *);
void onProfileTriggered(QAction *);
void onProfileChanged();
void on_actionAddCustomProfile_triggered();
void processMultipleFiles();
void onLanguageTriggered(QAction *);
void on_actionSystemTheme_triggered();
void on_actionFusionDark_triggered();
void on_actionJobPriorityLow_triggered();
void on_actionJobPriorityNormal_triggered();
void on_actionFusionLight_triggered();
void on_actionTutorials_triggered();
void on_actionRestoreLayout_triggered();
void on_actionShowTitleBars_triggered(bool checked);
void on_actionShowToolbar_triggered(bool checked);
void onToolbarVisibilityChanged(bool visible);
void on_menuExternal_aboutToShow();
void on_actionUpgrade_triggered();
void on_actionOpenXML_triggered();
void onAutosaveTimeout();
void on_actionGammaSRGB_triggered(bool checked);
void on_actionGammaRec709_triggered(bool checked);
void onFocusChanged(QWidget *old, QWidget *now) const;
void onFocusObjectChanged(QObject *obj) const;
void onFocusWindowChanged(QWindow *window) const;
void onTimelineClipSelected();
void onAddAllToTimeline(Mlt::Playlist *playlist, bool skipProxy);
void on_actionScrubAudio_triggered(bool checked);
#if !defined(Q_OS_MAC)
void onDrawingMethodTriggered(QAction *);
#endif
void on_actionApplicationLog_triggered();
void on_actionClose_triggered();
void onPlayerTabIndexChanged(int index);
void onUpgradeCheckFinished(QNetworkReply *reply);
void onUpgradeTriggered();
void onTimelineSelectionChanged();
void on_actionCut_triggered();
void on_actionCopy_triggered();
void on_actionPaste_triggered();
void onClipCopied();
void on_actionExportEDL_triggered();
void on_actionExportFrame_triggered();
void onGLWidgetImageReady();
void on_actionAppDataSet_triggered();
void on_actionAppDataShow_triggered();
void on_actionNew_triggered();
void on_actionKeyboardShortcuts_triggered();
void on_actionLayoutLogging_triggered();
void on_actionLayoutEditing_triggered();
void on_actionLayoutEffects_triggered();
void on_actionLayoutColor_triggered();
void on_actionLayoutAudio_triggered();
void on_actionLayoutPlayer_triggered();
void on_actionLayoutPlaylist_triggered();
void on_actionLayoutClip_triggered();
void on_actionLayoutAdd_triggered();
void onLayoutTriggered(QAction *);
void on_actionProfileRemove_triggered();
void on_actionLayoutRemove_triggered();
void on_actionOpenOther2_triggered();
void onOpenOtherTriggered(QWidget *widget);
void onOpenOtherTriggered();
void on_actionClearRecentOnExit_toggled(bool arg1);
void onSceneGraphInitialized();
void on_actionShowTextUnderIcons_toggled(bool b);
void on_actionShowSmallIcons_toggled(bool b);
void onPlaylistInChanged(int in);
void onPlaylistOutChanged(int out);
void on_actionPreviewNone_triggered(bool checked);
void on_actionPreview360_triggered(bool checked);
void on_actionPreview540_triggered(bool checked);
void on_actionPreview720_triggered(bool checked);
void on_actionTopics_triggered();
void on_actionSync_triggered();
void on_actionUseProxy_triggered(bool checked);
void on_actionProxyStorageSet_triggered();
void on_actionProxyStorageShow_triggered();
void on_actionProxyUseProjectFolder_triggered(bool checked);
void on_actionProxyUseHardware_triggered(bool checked);
void on_actionProxyConfigureHardware_triggered();
void updateLayoutSwitcher();
void clearCurrentLayout();
void onClipboardChanged();
void sourceUpdated();
void resetSourceUpdated();
void on_actionExportChapters_triggered();
void on_actionAudioVideoDevice_triggered();
};
#define MAIN MainWindow::singleton()
#endif // MAINWINDOW_H