]> git.sesse.net Git - kdenlive/blob - src/mainwindow.h
Use KAutosaveFile for document recovery
[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 class JogShuttle;
57 class DocClipBase;
58
59 class MainWindow : public KXmlGuiWindow {
60     Q_OBJECT
61
62 public:
63     MainWindow(QWidget *parent = 0);
64     void parseProfiles();
65
66     static EffectsList videoEffects;
67     static EffectsList audioEffects;
68     static EffectsList customEffects;
69     static EffectsList transitions;
70 protected:
71     virtual bool queryClose();
72     virtual void customEvent(QEvent * e);
73     virtual void keyPressEvent(QKeyEvent *ke);
74     bool eventFilter(QObject *obj, QEvent *ev);
75     /**
76      * This function is called when it is time for the app to save its
77      * properties for session management purposes.
78      */
79     void saveProperties(KConfig *);
80
81     /**
82      * This function is called when this app is restored.  The KConfig
83      * object points to the session management config file that was saved
84      * with @ref saveProperties
85      */
86     void readProperties(KConfig *);
87
88 private:
89     KTabWidget* m_timelineArea;
90     QProgressBar *statusProgressBar;
91     void setupActions();
92     KdenliveDoc *m_activeDocument;
93     TrackView *m_activeTimeline;
94     MonitorManager *m_monitorManager;
95
96     QDockWidget *projectListDock;
97     ProjectList *m_projectList;
98
99     QDockWidget *effectListDock;
100     EffectsListView *m_effectList;
101     //KListWidget *m_effectList;
102
103     QDockWidget *effectStackDock;
104     EffectStackView *effectStack;
105
106     QDockWidget *transitionConfigDock;
107     TransitionSettings *transitionConfig;
108
109     QDockWidget *clipMonitorDock;
110     Monitor *m_clipMonitor;
111
112     QDockWidget *projectMonitorDock;
113     Monitor *m_projectMonitor;
114
115     QDockWidget *recMonitorDock;
116     RecMonitor *m_recMonitor;
117
118     QDockWidget *undoViewDock;
119     QUndoView *m_undoView;
120     QUndoGroup *m_commandStack;
121
122     KComboBox *m_timecodeFormat;
123
124     QDockWidget *overviewDock;
125     CustomTrackView *m_overView;
126
127     QMenu *m_customEffectsMenu;
128     QMenu *m_timelineContextMenu;
129     QMenu *m_timelineContextClipMenu;
130     QMenu *m_timelineContextTransitionMenu;
131
132     RenderWidget *m_renderWidget;
133
134     JogShuttle *m_jogProcess;
135
136     KRecentFilesAction *m_fileOpenRecent;
137     KAction *m_projectSearch;
138     KAction *m_projectSearchNext;
139
140     QAction *m_buttonAudioThumbs;
141     QAction *m_buttonVideoThumbs;
142     QAction *m_buttonShowMarkers;
143     QAction *m_buttonFitZoom;
144     QAction *m_buttonSelectTool;
145     QAction *m_buttonRazorTool;
146     QAction *m_buttonSnap;
147     QActionGroup *m_toolGroup;
148     QSlider *m_zoomSlider;
149     StatusBarMessageLabel *m_messageLabel;
150
151     bool m_findActivated;
152     QString m_findString;
153     QTimer m_findTimer;
154     bool m_initialized;
155
156     void readOptions();
157     void saveOptions();
158     void activateShuttleDevice();
159     void slotShuttleAction(int code);
160     void connectDocumentInfo(KdenliveDoc *doc);
161     void findAhead();
162     void doOpenFile(const KUrl &url, KAutoSaveFile *stale);
163     void recoverFiles(QList<KAutoSaveFile *> staleFiles);
164
165 public slots:
166     void openFile(const KUrl &url);
167     void slotGotProgressInfo(const QString &message, int progress);
168
169 private slots:
170     void newFile();
171     void queryQuit();
172     void activateDocument();
173     void connectDocument(TrackView*, KdenliveDoc*);
174     void openFile();
175     void openLastFile();
176     void saveFile();
177     void saveFileAs();
178     void saveFileAs(const QString &outputFileName);
179     void slotPreferences(int page = -1, int option = -1);
180     void updateConfiguration();
181     void slotConnectMonitors();
182     void slotRaiseMonitor(bool clipMonitor);
183     void slotSetClipDuration(const QString &id, int duration);
184     void slotUpdateMousePosition(int pos);
185     void slotAddEffect(QDomElement effect, GenTime pos = GenTime(), int track = -1);
186     void slotEditProfiles();
187     void slotEditProjectSettings();
188     void slotDisplayActionMessage(QAction *a);
189     void slotSwitchVideoThumbs();
190     void slotSwitchAudioThumbs();
191     void slotSwitchMarkersComments();
192     void slotSwitchSnap();
193     void slotRenderProject();
194     void slotDoRender(const QString &dest, const QString &render, const QStringList &avformat_args, bool zoneOnly, bool playAfter);
195     void slotFullScreen();
196     void slotUpdateDocumentState(bool modified);
197     void slotZoomIn();
198     void slotZoomOut();
199     void slotFitZoom();
200     void slotRemoveTab();
201     void slotDeleteTimelineClip();
202     void slotAddClipMarker();
203     void slotDeleteClipMarker();
204     void slotDeleteAllClipMarkers();
205     void slotEditClipMarker();
206     void slotCutTimelineClip();
207     void slotAddVideoEffect(QAction *result);
208     void slotAddAudioEffect(QAction *result);
209     void slotAddCustomEffect(QAction *result);
210     void slotAddTransition(QAction *result);
211     void slotAddProjectClip(KUrl url);
212     void slotShuttleButton(int code);
213     void slotShowClipProperties(DocClipBase *clip);
214     void slotActivateEffectStackView();
215     void slotActivateTransitionView();
216     void slotChangeTool(QAction * action);
217     void slotSetTool(PROJECTTOOL tool);
218     void slotSnapForward();
219     void slotSnapRewind();
220     void slotClipStart();
221     void slotClipEnd();
222     void slotFind();
223     void findTimeout();
224     void slotFindNext();
225
226     void slotAddGuide();
227     void slotEditGuide();
228     void slotDeleteGuide();
229     void slotDeleteAllGuides();
230
231     void slotCopy();
232     void slotPaste();
233     void slotPasteEffects();
234     void slotReloadEffects();
235     void slotChangeClipSpeed();
236
237     void slotAdjustClipMonitor();
238     void slotAdjustProjectMonitor();
239 };
240
241
242 #endif