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 */
63 class MainWindow : public KXmlGuiWindow {
68 * \param MltPath path to MLT environment
69 * \param Url Url to open
70 * \param parent Std. widget parent
72 * The constructor inits the main window. If Url is present, it will be opened.
73 * If Url is not present, and openLastproject is set, last project will be set
74 * If no file is open after trying this, a default "newfile" will be created. */
75 MainWindow(const QString &MltPath = QString(), const KUrl & Url = KUrl(), QWidget *parent = 0);
76 void parseProfiles(const QString &mltPath = QString());
78 static EffectsList videoEffects;
79 static EffectsList audioEffects;
80 static EffectsList customEffects;
81 static EffectsList transitions;
83 virtual bool queryClose();
84 virtual void customEvent(QEvent * e);
85 virtual void keyPressEvent(QKeyEvent *ke);
86 /** Override hideEvent to get events when the mainwindow gets hidden */
87 virtual void hideEvent(QHideEvent *e);
88 bool eventFilter(QObject *obj, QEvent *ev);
90 * This function is called when it is time for the app to save its
91 * properties for session management purposes.
93 void saveProperties(KConfig *);
96 * This function is called when this app is restored. The KConfig
97 * object points to the session management config file that was saved
98 * with @ref saveProperties
100 void readProperties(KConfig *);
103 KTabWidget* m_timelineArea;
104 QProgressBar *statusProgressBar;
106 KdenliveDoc *m_activeDocument;
107 TrackView *m_activeTimeline;
108 MonitorManager *m_monitorManager;
110 QDockWidget *projectListDock;
111 ProjectList *m_projectList;
113 QDockWidget *effectListDock;
114 EffectsListView *m_effectList;
115 //KListWidget *m_effectList;
117 QDockWidget *effectStackDock;
118 EffectStackView *effectStack;
120 QDockWidget *transitionConfigDock;
121 TransitionSettings *transitionConfig;
123 QDockWidget *clipMonitorDock;
124 Monitor *m_clipMonitor;
126 QDockWidget *projectMonitorDock;
127 Monitor *m_projectMonitor;
129 QDockWidget *recMonitorDock;
130 RecMonitor *m_recMonitor;
132 QDockWidget *undoViewDock;
133 QUndoView *m_undoView;
134 QUndoGroup *m_commandStack;
136 KComboBox *m_timecodeFormat;
138 QDockWidget *overviewDock;
139 CustomTrackView *m_overView;
141 QMenu *m_customEffectsMenu;
142 QMenu *m_timelineContextMenu;
143 QMenu *m_timelineContextClipMenu;
144 QMenu *m_timelineContextTransitionMenu;
146 RenderWidget *m_renderWidget;
148 #ifndef NO_JOGSHUTTLE
149 JogShuttle *m_jogProcess;
150 #endif /* NO_JOGSHUTTLE */
152 KRecentFilesAction *m_fileOpenRecent;
153 KAction *m_projectSearch;
154 KAction *m_projectSearchNext;
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;
170 StatusBarMessageLabel *m_messageLabel;
172 bool m_findActivated;
173 QString m_findString;
179 #ifndef NO_JOGSHUTTLE
180 void activateShuttleDevice();
181 void slotShuttleAction(int code);
182 #endif /* NO_JOGSHUTTLE */
183 void connectDocumentInfo(KdenliveDoc *doc);
185 void doOpenFile(const KUrl &url, KAutoSaveFile *stale);
186 void recoverFiles(QList<KAutoSaveFile *> staleFiles);
188 void populateMenus(QObject *plugin);
189 void addToMenu(QObject *plugin, const QStringList &texts,
190 QMenu *menu, const char *member,
191 QActionGroup *actionGroup);
193 QStringList m_pluginFileNames;
196 void openFile(const KUrl &url);
197 void slotGotProgressInfo(const QString &message, int progress);
200 void newFile(bool showProjectSettings = true);
202 void activateDocument();
203 void connectDocument(TrackView*, KdenliveDoc*);
208 bool saveFileAs(const QString &outputFileName);
209 void slotPreferences(int page = -1, int option = -1);
210 void updateConfiguration();
211 void slotConnectMonitors();
212 void slotRaiseMonitor(bool clipMonitor);
213 void slotSetClipDuration(const QString &id, int duration);
214 void slotUpdateMousePosition(int pos);
215 void slotAddEffect(QDomElement effect, GenTime pos = GenTime(), int track = -1);
216 void slotEditProfiles();
217 void slotEditProjectSettings();
218 void slotDisplayActionMessage(QAction *a);
219 void slotSwitchVideoThumbs();
220 void slotSwitchAudioThumbs();
221 void slotSwitchMarkersComments();
222 void slotSwitchSnap();
223 void slotRenderProject();
224 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);
225 void slotFullScreen();
226 void slotUpdateDocumentState(bool modified);
230 void closeCurrentDocument();
231 void slotDeleteTimelineClip();
232 void slotAddClipMarker();
233 void slotDeleteClipMarker();
234 void slotDeleteAllClipMarkers();
235 void slotEditClipMarker();
236 void slotCutTimelineClip();
237 void slotAddVideoEffect(QAction *result);
238 void slotAddAudioEffect(QAction *result);
239 void slotAddCustomEffect(QAction *result);
240 void slotAddTransition(QAction *result);
241 void slotAddProjectClip(KUrl url);
242 #ifndef NO_JOGSHUTTLE
243 void slotShuttleButton(int code);
244 #endif /* NO_JOGSHUTTLE */
245 void slotShowClipProperties(DocClipBase *clip);
246 void slotActivateEffectStackView();
247 void slotActivateTransitionView(Transition *);
248 void slotChangeTool(QAction * action);
249 void slotSetTool(PROJECTTOOL tool);
250 void slotSnapForward();
251 void slotSnapRewind();
252 void slotClipStart();
258 void slotInsertSpace();
259 void slotRemoveSpace();
261 void slotEditGuide();
262 void slotDeleteGuide();
263 void slotDeleteAllGuides();
264 void slotGuidesUpdated();
268 void slotPasteEffects();
269 void slotReloadEffects();
270 void slotChangeClipSpeed();
272 void slotAdjustClipMonitor();
273 void slotAdjustProjectMonitor();
274 void slotSaveZone(Render *render, QPoint zone);
276 void slotSetInPoint();
277 void slotSetOutPoint();
278 void configureNotifications();
279 void slotInsertTrack(int ix = 0);
280 void slotDeleteTrack(int ix = 0);
281 void slotChangeTrack(int ix = 0);
282 void slotGetNewStuff();
283 void slotAutoTransition();
284 void slotRunWizard();
286 void slotZoneMoved(int start, int end);
287 void slotUpdatePreviewSettings();