CuteLogger
Fast and simple logging solution for Qt based applications
mainwindow.h
1 /*
2  * Copyright (c) 2011-2017 Meltytech, LLC
3  * Author: Dan Dennedy <dan@dennedy.org>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef MAINWINDOW_H
20 #define MAINWINDOW_H
21 
22 #include <QMainWindow>
23 #include <QMutex>
24 #include <QTimer>
25 #include <QUrl>
26 #include <QNetworkAccessManager>
27 #include <QScopedPointer>
28 #include <QSharedPointer>
29 #include "mltcontroller.h"
30 #include "mltxmlchecker.h"
31 
32 #define EXIT_RESTART (42)
33 
34 namespace Ui {
35  class MainWindow;
36 }
37 class Player;
38 class RecentDock;
39 class EncodeDock;
40 class JobsDock;
41 class PlaylistDock;
42 class QUndoStack;
43 class MeltedPlaylistDock;
44 class MeltedServerDock;
45 class QActionGroup;
46 class FilterController;
47 class ScopeController;
48 class FiltersDock;
49 class HtmlEditor;
50 class TimelineDock;
51 class AutoSaveFile;
52 class QNetworkReply;
53 
54 class MainWindow : public QMainWindow
55 {
56  Q_OBJECT
57 
58 public:
59  static MainWindow& singleton();
60  ~MainWindow();
61  void open(Mlt::Producer* producer);
62  bool continueModified();
63  bool continueJobsRunning();
64  QUndoStack* undoStack() const;
65  void saveXML(const QString& filename, bool withRelativePaths = true);
66  static void changeTheme(const QString& theme);
67  PlaylistDock* playlistDock() const { return m_playlistDock; }
68  FilterController* filterController() const { return m_filterController; }
69  HtmlEditor* htmlEditor() const { return m_htmlEditor.data(); }
70  Mlt::Playlist* playlist() const;
71  Mlt::Producer* multitrack() const;
72  bool isMultitrackValid() const;
73  void doAutosave();
74  void setFullScreen(bool isFullScreen);
75  QString removeFileScheme(QUrl& url);
76  QString untitledFileName() const;
77  QString getFileHash(const QString& path) const;
78  QString getHash(Mlt::Properties& properties) const;
79  void setProfile(const QString& profile_name);
80  QString fileName() const { return m_currentFile; }
81 
82  void keyPressEvent(QKeyEvent*);
83  void keyReleaseEvent(QKeyEvent *);
84  void hideSetDataDirectory();
85 
86 signals:
87  void producerOpened();
88  void profileChanged();
89  void openFailed(QString);
90  void aboutToShutDown();
91 
92 protected:
93  MainWindow();
94  bool eventFilter(QObject* target, QEvent* event);
95  void dragEnterEvent(QDragEnterEvent*);
96  void dropEvent(QDropEvent*);
97  void closeEvent(QCloseEvent*);
98  void showEvent(QShowEvent*);
99 
100 private:
101  void setupSettingsMenu();
102  QAction *addProfile(QActionGroup* actionGroup, const QString& desc, const QString& name);
103  void readPlayerSettings();
104  void readWindowSettings();
105  void writeSettings();
106  void configureVideoWidget();
107  void setCurrentFile(const QString &filename);
108  void changeDeinterlacer(bool checked, const char* method);
109  void changeInterpolation(bool checked, const char* method);
110  bool checkAutoSave(QString &url);
111  void stepLeftBySeconds(int sec);
112  bool saveRepairedXmlFile(MltXmlChecker& checker, QString& fileName);
113 
114  Ui::MainWindow* ui;
115  Player* m_player;
116  QDockWidget* m_propertiesDock;
117  RecentDock* m_recentDock;
118  EncodeDock* m_encodeDock;
119  JobsDock* m_jobsDock;
120  PlaylistDock* m_playlistDock;
121  TimelineDock* m_timelineDock;
122  QString m_currentFile;
123  bool m_isKKeyPressed;
124  QUndoStack* m_undoStack;
125  QDockWidget* m_historyDock;
126  MeltedServerDock* m_meltedServerDock;
127  MeltedPlaylistDock* m_meltedPlaylistDock;
128  QActionGroup* m_profileGroup;
129  QActionGroup* m_externalGroup;
130  QActionGroup* m_keyerGroup;
131  FiltersDock* m_filtersDock;
132  FilterController* m_filterController;
133  ScopeController* m_scopeController;
134  QMenu* m_customProfileMenu;
135  QMenu* m_keyerMenu;
136  QStringList m_multipleFiles;
137  bool m_isPlaylistLoaded;
138  QActionGroup* m_languagesGroup;
139  QScopedPointer<HtmlEditor> m_htmlEditor;
140  QSharedPointer<AutoSaveFile> m_autosaveFile;
141  QMutex m_autosaveMutex;
142  QTimer m_autosaveTimer;
143  int m_exitCode;
144  int m_navigationPosition;
145  QScopedPointer<QAction> m_statusBarAction;
146  QNetworkAccessManager m_network;
147  QString m_upgradeUrl;
148 
149 #ifdef WITH_LIBLEAP
150  LeapListener m_leapListener;
151 #endif
152 
153 public slots:
154  bool isCompatibleWithGpuMode(MltXmlChecker& checker);
155  bool isXmlRepaired(MltXmlChecker& checker, QString& fileName);
156  void updateAutoSave();
157  void open(QString url, const Mlt::Properties* = 0);
158  void openVideo();
159  void openCut(Mlt::Producer* producer);
160  void hideProducer();
161  void closeProducer();
162  void showStatusMessage(QAction* action, int timeoutSeconds = 5);
163  void showStatusMessage(const QString& message, int timeoutSeconds = 5);
164  void seekPlaylist(int start);
165  void seekTimeline(int position);
166  QWidget* loadProducerWidget(Mlt::Producer* producer);
167  void onProducerOpened();
168  void onGpuNotSupported();
169  void editHTML(const QString& fileName);
170  void stepLeftOneFrame();
171  void stepRightOneFrame();
172  void stepLeftOneSecond();
173  void stepRightOneSecond();
174  void setInToCurrent(bool ripple);
175  void setOutToCurrent(bool ripple);
176  void onShuttle(float x);
177 
178 private slots:
179  void showUpgradePrompt();
180  void on_actionAbout_Shotcut_triggered();
181  void on_actionOpenOther_triggered();
182  void onProducerChanged();
183  bool on_actionSave_triggered();
184  bool on_actionSave_As_triggered();
185  void onEncodeTriggered(bool checked = true);
186  void onCaptureStateChanged(bool started);
187  void onJobsDockTriggered(bool);
188  void onRecentDockTriggered(bool checked = true);
189  void onPropertiesDockTriggered(bool checked = true);
190  void onPlaylistDockTriggered(bool checked = true);
191  void onTimelineDockTriggered(bool checked = true);
192  void onHistoryDockTriggered(bool checked = true);
193  void onFiltersDockTriggered(bool checked = true);
194  void onPlaylistCreated();
195  void onPlaylistLoaded();
196  void onPlaylistCleared();
197  void onPlaylistClosed();
198  void onPlaylistModified();
199  void onMultitrackCreated();
200  void onMultitrackClosed();
201  void onMultitrackModified();
202  void onMultitrackDurationChanged();
203  void onCutModified();
204  void onFilterModelChanged();
205  void updateMarkers();
206  void updateThumbnails();
207  void on_actionUndo_triggered();
208  void on_actionRedo_triggered();
209  void on_actionFAQ_triggered();
210  void on_actionForum_triggered();
211  void onMeltedUnitOpened();
212  void onMeltedUnitActivated();
213  void on_actionEnter_Full_Screen_triggered();
214  void on_actionRealtime_triggered(bool checked);
215  void on_actionProgressive_triggered(bool checked);
216  void on_actionOneField_triggered(bool checked);
217  void on_actionLinearBlend_triggered(bool checked);
218  void on_actionYadifTemporal_triggered(bool checked);
219  void on_actionYadifSpatial_triggered(bool checked);
220  void on_actionNearest_triggered(bool checked);
221  void on_actionBilinear_triggered(bool checked);
222  void on_actionBicubic_triggered(bool checked);
223  void on_actionHyper_triggered(bool checked);
224  void on_actionJack_triggered(bool checked);
225  void on_actionGPU_triggered(bool checked);
226  void onExternalTriggered(QAction*);
227  void onKeyerTriggered(QAction*);
228  void onProfileTriggered(QAction*);
229  void onProfileChanged();
230  void on_actionAddCustomProfile_triggered();
231  void processMultipleFiles();
232  void onLanguageTriggered(QAction*);
233  void on_actionSystemTheme_triggered();
234  void on_actionFusionDark_triggered();
235  void on_actionFusionLight_triggered();
236  void on_actionTutorials_triggered();
237  void on_actionRestoreLayout_triggered();
238  void on_actionShowTitleBars_triggered(bool checked);
239  void on_actionShowToolbar_triggered(bool checked);
240  void onToolbarVisibilityChanged(bool visible);
241  void on_menuExternal_aboutToShow();
242  void on_actionUpgrade_triggered();
243  void on_actionOpenXML_triggered();
244  void onAutosaveTimeout();
245  void on_actionGammaSRGB_triggered(bool checked);
246  void on_actionGammaRec709_triggered(bool checked);
247  void onFocusChanged(QWidget *old, QWidget * now) const;
248  void onFocusObjectChanged(QObject *obj) const;
249  void onFocusWindowChanged(QWindow *window) const;
250  void onTimelineClipSelected();
251  void onAddAllToTimeline(Mlt::Playlist* playlist);
252  void on_actionScrubAudio_triggered(bool checked);
253 #ifdef Q_OS_WIN
254  void onDrawingMethodTriggered(QAction*);
255 #endif
256  void on_actionApplicationLog_triggered();
257  void on_actionClose_triggered();
258  void onPlayerTabIndexChanged(int index);
259  void onUpgradeCheckFinished(QNetworkReply* reply);
260  void onUpgradeTriggered();
261  void onTimelineSelectionChanged();
262  void on_actionCut_triggered();
263  void on_actionCopy_triggered();
264  void on_actionPaste_triggered();
265  void onClipCopied();
266  void on_actionExportEDL_triggered();
267  void on_actionExportFrame_triggered();
268  void onGLWidgetImageReady();
269  void on_actionAppDataSet_triggered();
270  void on_actionAppDataShow_triggered();
271  void on_actionNew_triggered();
272 };
273 
274 #define MAIN MainWindow::singleton()
275 
276 #endif // MAINWINDOW_H
Definition: addencodepresetdialog.h:24