]> git.sesse.net Git - kdenlive/blob - src/mainwindow.h
* Fix crash on renderer stopping
[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     QAction *m_saveAction;
149     QSlider *m_zoomSlider;
150     StatusBarMessageLabel *m_messageLabel;
151
152     bool m_findActivated;
153     QString m_findString;
154     QTimer m_findTimer;
155     bool m_initialized;
156
157     void readOptions();
158     void saveOptions();
159     void activateShuttleDevice();
160     void slotShuttleAction(int code);
161     void connectDocumentInfo(KdenliveDoc *doc);
162     void findAhead();
163     void doOpenFile(const KUrl &url, KAutoSaveFile *stale);
164     void recoverFiles(QList<KAutoSaveFile *> staleFiles);
165
166 public slots:
167     void openFile(const KUrl &url);
168     void slotGotProgressInfo(const QString &message, int progress);
169
170 private slots:
171     void newFile();
172     void queryQuit();
173     void activateDocument();
174     void connectDocument(TrackView*, KdenliveDoc*);
175     void openFile();
176     void openLastFile();
177     void saveFile();
178     void saveFileAs();
179     void saveFileAs(const QString &outputFileName);
180     void slotPreferences(int page = -1, int option = -1);
181     void updateConfiguration();
182     void slotConnectMonitors();
183     void slotRaiseMonitor(bool clipMonitor);
184     void slotSetClipDuration(const QString &id, int duration);
185     void slotUpdateMousePosition(int pos);
186     void slotAddEffect(QDomElement effect, GenTime pos = GenTime(), int track = -1);
187     void slotEditProfiles();
188     void slotEditProjectSettings();
189     void slotDisplayActionMessage(QAction *a);
190     void slotSwitchVideoThumbs();
191     void slotSwitchAudioThumbs();
192     void slotSwitchMarkersComments();
193     void slotSwitchSnap();
194     void slotRenderProject();
195     void slotDoRender(const QString &dest, const QString &render, const QStringList &avformat_args, bool zoneOnly, bool playAfter);
196     void slotFullScreen();
197     void slotUpdateDocumentState(bool modified);
198     void slotZoomIn();
199     void slotZoomOut();
200     void slotFitZoom();
201     void closeCurrentDocument();
202     void slotDeleteTimelineClip();
203     void slotAddClipMarker();
204     void slotDeleteClipMarker();
205     void slotDeleteAllClipMarkers();
206     void slotEditClipMarker();
207     void slotCutTimelineClip();
208     void slotAddVideoEffect(QAction *result);
209     void slotAddAudioEffect(QAction *result);
210     void slotAddCustomEffect(QAction *result);
211     void slotAddTransition(QAction *result);
212     void slotAddProjectClip(KUrl url);
213     void slotShuttleButton(int code);
214     void slotShowClipProperties(DocClipBase *clip);
215     void slotActivateEffectStackView();
216     void slotActivateTransitionView();
217     void slotChangeTool(QAction * action);
218     void slotSetTool(PROJECTTOOL tool);
219     void slotSnapForward();
220     void slotSnapRewind();
221     void slotClipStart();
222     void slotClipEnd();
223     void slotFind();
224     void findTimeout();
225     void slotFindNext();
226
227     void slotAddGuide();
228     void slotEditGuide();
229     void slotDeleteGuide();
230     void slotDeleteAllGuides();
231
232     void slotCopy();
233     void slotPaste();
234     void slotPasteEffects();
235     void slotReloadEffects();
236     void slotChangeClipSpeed();
237
238     void slotAdjustClipMonitor();
239     void slotAdjustProjectMonitor();
240 };
241
242
243 #endif