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