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