]> git.sesse.net Git - kdenlive/blob - src/mainwindow.h
dad33684f8d98bd7ebe2fb1dad64241489c49dc7
[kdenlive] / src / mainwindow.h
1 /***************************************************************************
2  *   Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org)        *
3  *                                                                         *
4  *   This program is free software; you can redistribute it and/or modify  *
5  *   it under the terms of the GNU General Public License as published by  *
6  *   the Free Software Foundation; either version 2 of the License, or     *
7  *   (at your option) any later version.                                   *
8  *                                                                         *
9  *   This program is distributed in the hope that it will be useful,       *
10  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12  *   GNU General Public License for more details.                          *
13  *                                                                         *
14  *   You should have received a copy of the GNU General Public License     *
15  *   along with this program; if not, write to the                         *
16  *   Free Software Foundation, Inc.,                                       *
17  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
18  ***************************************************************************/
19
20
21 #ifndef MAINWINDOW_H
22 #define MAINWINDOW_H
23
24 #include <QDockWidget>
25 #include <QUndoView>
26 #include <QLabel>
27 #include <QProgressBar>
28 #include <QEvent>
29 #include <QTimer>
30
31 #include <KXmlGuiWindow>
32 #include <KTextEdit>
33 #include <KListWidget>
34 #include <KTabWidget>
35 #include <KUndoStack>
36 #include <KRecentFilesAction>
37 #include <KComboBox>
38 #include <kautosavefile.h>
39
40 #include "effectslist.h"
41 #include "gentime.h"
42 #include "definitions.h"
43 #include "statusbarmessagelabel.h"
44
45 class KdenliveDoc;
46 class TrackView;
47 class MonitorManager;
48 class ProjectList;
49 class EffectsListView;
50 class EffectStackView;
51 class TransitionSettings;
52 class Monitor;
53 class RecMonitor;
54 class CustomTrackView;
55 class RenderWidget;
56 #ifndef NO_JOGSHUTTLE
57 class JogShuttle;
58 #endif /* NO_JOGSHUTTLE */
59 class DocClipBase;
60 class Render;
61
62 class MainWindow : public KXmlGuiWindow {
63     Q_OBJECT
64
65 public:
66     MainWindow(const QString &MltPath = QString(), QWidget *parent = 0);
67     void parseProfiles(const QString &mltPath = QString());
68
69     static EffectsList videoEffects;
70     static EffectsList audioEffects;
71     static EffectsList customEffects;
72     static EffectsList transitions;
73 protected:
74     virtual bool queryClose();
75     virtual void customEvent(QEvent * e);
76     virtual void keyPressEvent(QKeyEvent *ke);
77     /** Override hideEvent to get events when the mainwindow gets hidden */
78     virtual void hideEvent(QHideEvent *e);
79     bool eventFilter(QObject *obj, QEvent *ev);
80     /**
81      * This function is called when it is time for the app to save its
82      * properties for session management purposes.
83      */
84     void saveProperties(KConfig *);
85
86     /**
87      * This function is called when this app is restored.  The KConfig
88      * object points to the session management config file that was saved
89      * with @ref saveProperties
90      */
91     void readProperties(KConfig *);
92
93 private:
94     KTabWidget* m_timelineArea;
95     QProgressBar *statusProgressBar;
96     void setupActions();
97     KdenliveDoc *m_activeDocument;
98     TrackView *m_activeTimeline;
99     MonitorManager *m_monitorManager;
100
101     QDockWidget *projectListDock;
102     ProjectList *m_projectList;
103
104     QDockWidget *effectListDock;
105     EffectsListView *m_effectList;
106     //KListWidget *m_effectList;
107
108     QDockWidget *effectStackDock;
109     EffectStackView *effectStack;
110
111     QDockWidget *transitionConfigDock;
112     TransitionSettings *transitionConfig;
113
114     QDockWidget *clipMonitorDock;
115     Monitor *m_clipMonitor;
116
117     QDockWidget *projectMonitorDock;
118     Monitor *m_projectMonitor;
119
120     QDockWidget *recMonitorDock;
121     RecMonitor *m_recMonitor;
122
123     QDockWidget *undoViewDock;
124     QUndoView *m_undoView;
125     QUndoGroup *m_commandStack;
126
127     KComboBox *m_timecodeFormat;
128
129     QDockWidget *overviewDock;
130     CustomTrackView *m_overView;
131
132     QMenu *m_customEffectsMenu;
133     QMenu *m_timelineContextMenu;
134     QMenu *m_timelineContextClipMenu;
135     QMenu *m_timelineContextTransitionMenu;
136
137     RenderWidget *m_renderWidget;
138
139 #ifndef NO_JOGSHUTTLE
140     JogShuttle *m_jogProcess;
141 #endif /* NO_JOGSHUTTLE */
142
143     KRecentFilesAction *m_fileOpenRecent;
144     KAction *m_projectSearch;
145     KAction *m_projectSearchNext;
146
147     KAction *m_buttonAudioThumbs;
148     KAction *m_buttonVideoThumbs;
149     KAction *m_buttonShowMarkers;
150     KAction *m_buttonFitZoom;
151     KAction *m_buttonSelectTool;
152     KAction *m_buttonRazorTool;
153     KAction *m_buttonSnap;
154     QActionGroup *m_toolGroup;
155     KAction *m_saveAction;
156     KAction *m_closeAction;
157     QSlider *m_zoomSlider;
158     StatusBarMessageLabel *m_messageLabel;
159
160     bool m_findActivated;
161     QString m_findString;
162     QTimer m_findTimer;
163     bool m_initialized;
164
165     void readOptions();
166     void saveOptions();
167 #ifndef NO_JOGSHUTTLE
168     void activateShuttleDevice();
169     void slotShuttleAction(int code);
170 #endif /* NO_JOGSHUTTLE */
171     void connectDocumentInfo(KdenliveDoc *doc);
172     void findAhead();
173     void doOpenFile(const KUrl &url, KAutoSaveFile *stale);
174     void recoverFiles(QList<KAutoSaveFile *> staleFiles);
175
176 public slots:
177     void openFile(const KUrl &url);
178     void slotGotProgressInfo(const QString &message, int progress);
179
180 private slots:
181     void newFile(bool showProjectSettings = true);
182     void queryQuit();
183     void activateDocument();
184     void connectDocument(TrackView*, KdenliveDoc*);
185     void openFile();
186     void openLastFile();
187     void saveFile();
188     void saveFileAs();
189     void saveFileAs(const QString &outputFileName);
190     void slotPreferences(int page = -1, int option = -1);
191     void updateConfiguration();
192     void slotConnectMonitors();
193     void slotRaiseMonitor(bool clipMonitor);
194     void slotSetClipDuration(const QString &id, int duration);
195     void slotUpdateMousePosition(int pos);
196     void slotAddEffect(QDomElement effect, GenTime pos = GenTime(), int track = -1);
197     void slotEditProfiles();
198     void slotEditProjectSettings();
199     void slotDisplayActionMessage(QAction *a);
200     void slotSwitchVideoThumbs();
201     void slotSwitchAudioThumbs();
202     void slotSwitchMarkersComments();
203     void slotSwitchSnap();
204     void slotRenderProject();
205     void slotDoRender(const QString &dest, const QString &render, const QStringList &overlay_args, const QStringList &avformat_args, bool zoneOnly, bool playAfter, double guideStart, double guideEnd);
206     void slotFullScreen();
207     void slotUpdateDocumentState(bool modified);
208     void slotZoomIn();
209     void slotZoomOut();
210     void slotFitZoom();
211     void closeCurrentDocument();
212     void slotDeleteTimelineClip();
213     void slotAddClipMarker();
214     void slotDeleteClipMarker();
215     void slotDeleteAllClipMarkers();
216     void slotEditClipMarker();
217     void slotCutTimelineClip();
218     void slotAddVideoEffect(QAction *result);
219     void slotAddAudioEffect(QAction *result);
220     void slotAddCustomEffect(QAction *result);
221     void slotAddTransition(QAction *result);
222     void slotAddProjectClip(KUrl url);
223 #ifndef NO_JOGSHUTTLE
224     void slotShuttleButton(int code);
225 #endif /* NO_JOGSHUTTLE */
226     void slotShowClipProperties(DocClipBase *clip);
227     void slotActivateEffectStackView();
228     void slotActivateTransitionView();
229     void slotChangeTool(QAction * action);
230     void slotSetTool(PROJECTTOOL tool);
231     void slotSnapForward();
232     void slotSnapRewind();
233     void slotClipStart();
234     void slotClipEnd();
235     void slotFind();
236     void findTimeout();
237     void slotFindNext();
238
239     void slotAddGuide();
240     void slotEditGuide();
241     void slotDeleteGuide();
242     void slotDeleteAllGuides();
243     void slotGuidesUpdated();
244
245     void slotCopy();
246     void slotPaste();
247     void slotPasteEffects();
248     void slotReloadEffects();
249     void slotChangeClipSpeed();
250
251     void slotAdjustClipMonitor();
252     void slotAdjustProjectMonitor();
253     void slotSaveZone(Render *render, QPoint zone);
254
255     void slotSetInPoint();
256     void slotSetOutPoint();
257     void configureNotifications();
258 };
259
260
261 #endif