1 /***************************************************************************
2 * Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
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. *
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. *
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 ***************************************************************************/
24 #include <QDockWidget>
27 #include <QProgressBar>
31 #include <KXmlGuiWindow>
33 #include <KListWidget>
36 #include <KRecentFilesAction>
38 #include <kautosavefile.h>
40 #include "effectslist.h"
42 #include "definitions.h"
43 #include "statusbarmessagelabel.h"
49 class EffectsListView;
50 class EffectStackView;
51 class TransitionSettings;
54 class CustomTrackView;
58 #endif /* NO_JOGSHUTTLE */
62 class MainWindow : public KXmlGuiWindow {
66 MainWindow(const QString &MltPath = QString(), QWidget *parent = 0);
67 void parseProfiles(const QString &mltPath = QString());
69 static EffectsList videoEffects;
70 static EffectsList audioEffects;
71 static EffectsList customEffects;
72 static EffectsList transitions;
74 virtual bool queryClose();
75 virtual void customEvent(QEvent * e);
76 virtual void keyPressEvent(QKeyEvent *ke);
77 /** Override hideEvent to get events when the mainwindow gets hidden */
78 virtual void hideEvent(QHideEvent *e);
79 bool eventFilter(QObject *obj, QEvent *ev);
81 * This function is called when it is time for the app to save its
82 * properties for session management purposes.
84 void saveProperties(KConfig *);
87 * This function is called when this app is restored. The KConfig
88 * object points to the session management config file that was saved
89 * with @ref saveProperties
91 void readProperties(KConfig *);
94 KTabWidget* m_timelineArea;
95 QProgressBar *statusProgressBar;
97 KdenliveDoc *m_activeDocument;
98 TrackView *m_activeTimeline;
99 MonitorManager *m_monitorManager;
101 QDockWidget *projectListDock;
102 ProjectList *m_projectList;
104 QDockWidget *effectListDock;
105 EffectsListView *m_effectList;
106 //KListWidget *m_effectList;
108 QDockWidget *effectStackDock;
109 EffectStackView *effectStack;
111 QDockWidget *transitionConfigDock;
112 TransitionSettings *transitionConfig;
114 QDockWidget *clipMonitorDock;
115 Monitor *m_clipMonitor;
117 QDockWidget *projectMonitorDock;
118 Monitor *m_projectMonitor;
120 QDockWidget *recMonitorDock;
121 RecMonitor *m_recMonitor;
123 QDockWidget *undoViewDock;
124 QUndoView *m_undoView;
125 QUndoGroup *m_commandStack;
127 KComboBox *m_timecodeFormat;
129 QDockWidget *overviewDock;
130 CustomTrackView *m_overView;
132 QMenu *m_customEffectsMenu;
133 QMenu *m_timelineContextMenu;
134 QMenu *m_timelineContextClipMenu;
135 QMenu *m_timelineContextTransitionMenu;
137 RenderWidget *m_renderWidget;
139 #ifndef NO_JOGSHUTTLE
140 JogShuttle *m_jogProcess;
141 #endif /* NO_JOGSHUTTLE */
143 KRecentFilesAction *m_fileOpenRecent;
144 KAction *m_projectSearch;
145 KAction *m_projectSearchNext;
147 KAction *m_buttonAudioThumbs;
148 KAction *m_buttonVideoThumbs;
149 KAction *m_buttonShowMarkers;
150 KAction *m_buttonFitZoom;
151 KAction *m_buttonSelectTool;
152 KAction *m_buttonRazorTool;
153 KAction *m_buttonSnap;
154 QActionGroup *m_toolGroup;
155 KAction *m_saveAction;
156 KAction *m_closeAction;
157 QSlider *m_zoomSlider;
158 StatusBarMessageLabel *m_messageLabel;
160 bool m_findActivated;
161 QString m_findString;
167 #ifndef NO_JOGSHUTTLE
168 void activateShuttleDevice();
169 void slotShuttleAction(int code);
170 #endif /* NO_JOGSHUTTLE */
171 void connectDocumentInfo(KdenliveDoc *doc);
173 void doOpenFile(const KUrl &url, KAutoSaveFile *stale);
174 void recoverFiles(QList<KAutoSaveFile *> staleFiles);
177 void openFile(const KUrl &url);
178 void slotGotProgressInfo(const QString &message, int progress);
181 void newFile(bool showProjectSettings = true);
183 void activateDocument();
184 void connectDocument(TrackView*, KdenliveDoc*);
189 void saveFileAs(const QString &outputFileName);
190 void slotPreferences(int page = -1, int option = -1);
191 void updateConfiguration();
192 void slotConnectMonitors();
193 void slotRaiseMonitor(bool clipMonitor);
194 void slotSetClipDuration(const QString &id, int duration);
195 void slotUpdateMousePosition(int pos);
196 void slotAddEffect(QDomElement effect, GenTime pos = GenTime(), int track = -1);
197 void slotEditProfiles();
198 void slotEditProjectSettings();
199 void slotDisplayActionMessage(QAction *a);
200 void slotSwitchVideoThumbs();
201 void slotSwitchAudioThumbs();
202 void slotSwitchMarkersComments();
203 void slotSwitchSnap();
204 void slotRenderProject();
205 void slotDoRender(const QString &dest, const QString &render, const QStringList &overlay_args, const QStringList &avformat_args, bool zoneOnly, bool playAfter, double guideStart, double guideEnd);
206 void slotFullScreen();
207 void slotUpdateDocumentState(bool modified);
211 void closeCurrentDocument();
212 void slotDeleteTimelineClip();
213 void slotAddClipMarker();
214 void slotDeleteClipMarker();
215 void slotDeleteAllClipMarkers();
216 void slotEditClipMarker();
217 void slotCutTimelineClip();
218 void slotAddVideoEffect(QAction *result);
219 void slotAddAudioEffect(QAction *result);
220 void slotAddCustomEffect(QAction *result);
221 void slotAddTransition(QAction *result);
222 void slotAddProjectClip(KUrl url);
223 #ifndef NO_JOGSHUTTLE
224 void slotShuttleButton(int code);
225 #endif /* NO_JOGSHUTTLE */
226 void slotShowClipProperties(DocClipBase *clip);
227 void slotActivateEffectStackView();
228 void slotActivateTransitionView();
229 void slotChangeTool(QAction * action);
230 void slotSetTool(PROJECTTOOL tool);
231 void slotSnapForward();
232 void slotSnapRewind();
233 void slotClipStart();
240 void slotEditGuide();
241 void slotDeleteGuide();
242 void slotDeleteAllGuides();
243 void slotGuidesUpdated();
247 void slotPasteEffects();
248 void slotReloadEffects();
249 void slotChangeClipSpeed();
251 void slotAdjustClipMonitor();
252 void slotAdjustProjectMonitor();
253 void slotSaveZone(Render *render, QPoint zone);
255 void slotSetInPoint();
256 void slotSetOutPoint();
257 void configureNotifications();