]> git.sesse.net Git - kdenlive/blob - src/mainwindow.h
34ab13b08436cea6e7f21ea1c0c2e1520a6e2c42
[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     /** Constructor
67      * \param MltPath path to MLT environment
68      * \param Url Url to open
69      * \param parent Std. widget parent
70      *
71      * The constructor inits the main window. If Url is present, it will be opened.
72      * If Url is not present, and openLastproject is set, last project will be set
73      * If no file is open after trying this, a default "newfile" will be created. */
74     MainWindow(const QString &MltPath = QString(), const KUrl & Url = KUrl(), QWidget *parent = 0);
75     void parseProfiles(const QString &mltPath = QString());
76
77     static EffectsList videoEffects;
78     static EffectsList audioEffects;
79     static EffectsList customEffects;
80     static EffectsList transitions;
81 protected:
82     virtual bool queryClose();
83     virtual void customEvent(QEvent * e);
84     virtual void keyPressEvent(QKeyEvent *ke);
85     /** Override hideEvent to get events when the mainwindow gets hidden */
86     virtual void hideEvent(QHideEvent *e);
87     bool eventFilter(QObject *obj, QEvent *ev);
88     /**
89      * This function is called when it is time for the app to save its
90      * properties for session management purposes.
91      */
92     void saveProperties(KConfig *);
93
94     /**
95      * This function is called when this app is restored.  The KConfig
96      * object points to the session management config file that was saved
97      * with @ref saveProperties
98      */
99     void readProperties(KConfig *);
100
101 private:
102     KTabWidget* m_timelineArea;
103     QProgressBar *statusProgressBar;
104     void setupActions();
105     KdenliveDoc *m_activeDocument;
106     TrackView *m_activeTimeline;
107     MonitorManager *m_monitorManager;
108
109     QDockWidget *projectListDock;
110     ProjectList *m_projectList;
111
112     QDockWidget *effectListDock;
113     EffectsListView *m_effectList;
114     //KListWidget *m_effectList;
115
116     QDockWidget *effectStackDock;
117     EffectStackView *effectStack;
118
119     QDockWidget *transitionConfigDock;
120     TransitionSettings *transitionConfig;
121
122     QDockWidget *clipMonitorDock;
123     Monitor *m_clipMonitor;
124
125     QDockWidget *projectMonitorDock;
126     Monitor *m_projectMonitor;
127
128     QDockWidget *recMonitorDock;
129     RecMonitor *m_recMonitor;
130
131     QDockWidget *undoViewDock;
132     QUndoView *m_undoView;
133     QUndoGroup *m_commandStack;
134
135     KComboBox *m_timecodeFormat;
136
137     QDockWidget *overviewDock;
138     CustomTrackView *m_overView;
139
140     QMenu *m_customEffectsMenu;
141     QMenu *m_timelineContextMenu;
142     QMenu *m_timelineContextClipMenu;
143     QMenu *m_timelineContextTransitionMenu;
144
145     RenderWidget *m_renderWidget;
146
147 #ifndef NO_JOGSHUTTLE
148     JogShuttle *m_jogProcess;
149 #endif /* NO_JOGSHUTTLE */
150
151     KRecentFilesAction *m_fileOpenRecent;
152     KAction *m_projectSearch;
153     KAction *m_projectSearchNext;
154
155     KAction *m_buttonAudioThumbs;
156     KAction *m_buttonVideoThumbs;
157     KAction *m_buttonShowMarkers;
158     KAction *m_buttonFitZoom;
159     KAction *m_buttonSelectTool;
160     KAction *m_buttonRazorTool;
161     KAction *m_buttonSpacerTool;
162     KAction *m_buttonSnap;
163     QActionGroup *m_toolGroup;
164     KAction *m_saveAction;
165     KAction *m_closeAction;
166     QSlider *m_zoomSlider;
167     StatusBarMessageLabel *m_messageLabel;
168
169     bool m_findActivated;
170     QString m_findString;
171     QTimer m_findTimer;
172     bool m_initialized;
173
174     void readOptions();
175     void saveOptions();
176 #ifndef NO_JOGSHUTTLE
177     void activateShuttleDevice();
178     void slotShuttleAction(int code);
179 #endif /* NO_JOGSHUTTLE */
180     void connectDocumentInfo(KdenliveDoc *doc);
181     void findAhead();
182     void doOpenFile(const KUrl &url, KAutoSaveFile *stale);
183     void recoverFiles(QList<KAutoSaveFile *> staleFiles);
184
185 public slots:
186     void openFile(const KUrl &url);
187     void slotGotProgressInfo(const QString &message, int progress);
188
189 private slots:
190     void newFile(bool showProjectSettings = true);
191     void queryQuit();
192     void activateDocument();
193     void connectDocument(TrackView*, KdenliveDoc*);
194     void openFile();
195     void openLastFile();
196     bool saveFile();
197     bool saveFileAs();
198     bool saveFileAs(const QString &outputFileName);
199     void slotPreferences(int page = -1, int option = -1);
200     void updateConfiguration();
201     void slotConnectMonitors();
202     void slotRaiseMonitor(bool clipMonitor);
203     void slotSetClipDuration(const QString &id, int duration);
204     void slotUpdateMousePosition(int pos);
205     void slotAddEffect(QDomElement effect, GenTime pos = GenTime(), int track = -1);
206     void slotEditProfiles();
207     void slotEditProjectSettings();
208     void slotDisplayActionMessage(QAction *a);
209     void slotSwitchVideoThumbs();
210     void slotSwitchAudioThumbs();
211     void slotSwitchMarkersComments();
212     void slotSwitchSnap();
213     void slotRenderProject();
214     void slotDoRender(const QString &dest, const QString &render, const QStringList &overlay_args, const QStringList &avformat_args, bool zoneOnly, bool playAfter, double guideStart, double guideEnd);
215     void slotFullScreen();
216     void slotUpdateDocumentState(bool modified);
217     void slotZoomIn();
218     void slotZoomOut();
219     void slotFitZoom();
220     void closeCurrentDocument();
221     void slotDeleteTimelineClip();
222     void slotAddClipMarker();
223     void slotDeleteClipMarker();
224     void slotDeleteAllClipMarkers();
225     void slotEditClipMarker();
226     void slotCutTimelineClip();
227     void slotAddVideoEffect(QAction *result);
228     void slotAddAudioEffect(QAction *result);
229     void slotAddCustomEffect(QAction *result);
230     void slotAddTransition(QAction *result);
231     void slotAddProjectClip(KUrl url);
232 #ifndef NO_JOGSHUTTLE
233     void slotShuttleButton(int code);
234 #endif /* NO_JOGSHUTTLE */
235     void slotShowClipProperties(DocClipBase *clip);
236     void slotActivateEffectStackView();
237     void slotActivateTransitionView();
238     void slotChangeTool(QAction * action);
239     void slotSetTool(PROJECTTOOL tool);
240     void slotSnapForward();
241     void slotSnapRewind();
242     void slotClipStart();
243     void slotClipEnd();
244     void slotFind();
245     void findTimeout();
246     void slotFindNext();
247
248     void slotInsertSpace();
249     void slotRemoveSpace();
250     void slotAddGuide();
251     void slotEditGuide();
252     void slotDeleteGuide();
253     void slotDeleteAllGuides();
254     void slotGuidesUpdated();
255
256     void slotCopy();
257     void slotPaste();
258     void slotPasteEffects();
259     void slotReloadEffects();
260     void slotChangeClipSpeed();
261
262     void slotAdjustClipMonitor();
263     void slotAdjustProjectMonitor();
264     void slotSaveZone(Render *render, QPoint zone);
265
266     void slotSetInPoint();
267     void slotSetOutPoint();
268     void configureNotifications();
269     void slotInsertTrack(int ix = 0);
270     void slotDeleteTrack(int ix = 0);
271 };
272
273
274 #endif