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