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"
44 #include "dvdwizard.h"
50 class EffectsListView;
51 class EffectStackView;
52 class TransitionSettings;
55 class CustomTrackView;
59 #endif /* NO_JOGSHUTTLE */
64 class MainWindow : public KXmlGuiWindow
67 Q_CLASSINFO("D-Bus Interface", "org.kdenlive.MainWindow")
71 * \param MltPath path to MLT environment
72 * \param Url Url to open
73 * \param parent Std. widget parent
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());
81 static EffectsList videoEffects;
82 static EffectsList audioEffects;
83 static EffectsList customEffects;
84 static EffectsList transitions;
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);
93 * This function is called when it is time for the app to save its
94 * properties for session management purposes.
96 void saveProperties(KConfig *);
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
103 void readProperties(KConfig *);
106 KTabWidget* m_timelineArea;
107 QProgressBar *statusProgressBar;
109 KdenliveDoc *m_activeDocument;
110 TrackView *m_activeTimeline;
111 MonitorManager *m_monitorManager;
113 QDockWidget *projectListDock;
114 ProjectList *m_projectList;
116 QDockWidget *effectListDock;
117 EffectsListView *m_effectList;
118 //KListWidget *m_effectList;
120 QDockWidget *effectStackDock;
121 EffectStackView *effectStack;
123 QDockWidget *transitionConfigDock;
124 TransitionSettings *transitionConfig;
126 QDockWidget *clipMonitorDock;
127 Monitor *m_clipMonitor;
129 QDockWidget *projectMonitorDock;
130 Monitor *m_projectMonitor;
132 QDockWidget *recMonitorDock;
133 RecMonitor *m_recMonitor;
135 QDockWidget *undoViewDock;
136 QUndoView *m_undoView;
137 QUndoGroup *m_commandStack;
139 KComboBox *m_timecodeFormat;
141 QDockWidget *overviewDock;
142 CustomTrackView *m_overView;
144 QMenu *m_customEffectsMenu;
145 QMenu *m_timelineContextMenu;
146 QMenu *m_timelineContextClipMenu;
147 QMenu *m_timelineContextTransitionMenu;
149 RenderWidget *m_renderWidget;
151 #ifndef NO_JOGSHUTTLE
152 JogShuttle *m_jogProcess;
153 #endif /* NO_JOGSHUTTLE */
155 KRecentFilesAction *m_fileOpenRecent;
156 KAction *m_projectSearch;
157 KAction *m_projectSearchNext;
159 KAction *m_buttonAudioThumbs;
160 KAction *m_buttonVideoThumbs;
161 KAction *m_buttonShowMarkers;
162 KAction *m_buttonFitZoom;
163 KAction *m_buttonSelectTool;
164 KAction *m_buttonRazorTool;
165 KAction *m_buttonSpacerTool;
166 KAction *m_buttonSnap;
167 QActionGroup *m_toolGroup;
168 KAction *m_saveAction;
169 KAction *m_closeAction;
170 QSlider *m_zoomSlider;
173 StatusBarMessageLabel *m_messageLabel;
175 bool m_findActivated;
176 QString m_findString;
182 #ifndef NO_JOGSHUTTLE
183 void activateShuttleDevice();
184 void slotShuttleAction(int code);
185 #endif /* NO_JOGSHUTTLE */
186 void connectDocumentInfo(KdenliveDoc *doc);
188 void doOpenFile(const KUrl &url, KAutoSaveFile *stale);
189 void recoverFiles(QList<KAutoSaveFile *> staleFiles);
191 void populateMenus(QObject *plugin);
192 void addToMenu(QObject *plugin, const QStringList &texts,
193 QMenu *menu, const char *member,
194 QActionGroup *actionGroup);
196 QStringList m_pluginFileNames;
197 QByteArray m_timelineState;
200 void openFile(const KUrl &url);
201 void slotGotProgressInfo(const QString &message, int progress);
202 Q_SCRIPTABLE void setRenderingProgress(const QString &url, int progress);
203 Q_SCRIPTABLE void setRenderingFinished(const QString &url, int status, const QString &error);
206 void newFile(bool showProjectSettings = true);
208 void activateDocument();
209 void connectDocument(TrackView*, KdenliveDoc*);
214 bool saveFileAs(const QString &outputFileName);
215 void slotPreferences(int page = -1, int option = -1);
216 void updateConfiguration();
217 void slotConnectMonitors();
218 void slotRaiseMonitor(bool clipMonitor);
219 void slotSetClipDuration(const QString &id, int duration);
220 void slotUpdateMousePosition(int pos);
221 void slotAddEffect(QDomElement effect, GenTime pos = GenTime(), int track = -1);
222 void slotEditProfiles();
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 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);
231 void slotFullScreen();
232 void slotUpdateDocumentState(bool modified);
236 void closeCurrentDocument();
237 void slotDeleteTimelineClip();
238 void slotAddClipMarker();
239 void slotDeleteClipMarker();
240 void slotDeleteAllClipMarkers();
241 void slotEditClipMarker();
242 void slotCutTimelineClip();
243 void slotAddVideoEffect(QAction *result);
244 void slotAddAudioEffect(QAction *result);
245 void slotAddCustomEffect(QAction *result);
246 void slotAddTransition(QAction *result);
247 void slotAddProjectClip(KUrl url);
248 #ifndef NO_JOGSHUTTLE
249 void slotShuttleButton(int code);
250 #endif /* NO_JOGSHUTTLE */
251 void slotShowClipProperties(DocClipBase *clip);
252 void slotActivateEffectStackView();
253 void slotActivateTransitionView(Transition *);
254 void slotChangeTool(QAction * action);
255 void slotSetTool(PROJECTTOOL tool);
256 void slotSnapForward();
257 void slotSnapRewind();
258 void slotClipStart();
264 void slotInsertSpace();
265 void slotRemoveSpace();
267 void slotEditGuide();
268 void slotDeleteGuide();
269 void slotDeleteAllGuides();
270 void slotGuidesUpdated();
274 void slotPasteEffects();
275 void slotReloadEffects();
276 void slotChangeClipSpeed();
278 void slotAdjustClipMonitor();
279 void slotAdjustProjectMonitor();
280 void slotSaveZone(Render *render, QPoint zone);
282 void slotSetInPoint();
283 void slotSetOutPoint();
284 void configureNotifications();
285 void slotInsertTrack(int ix = 0);
286 void slotDeleteTrack(int ix = 0);
287 void slotChangeTrack(int ix = 0);
288 void slotGetNewLumaStuff();
289 void slotGetNewRenderStuff();
290 void slotGetNewMltProfileStuff();
291 void slotAutoTransition();
292 void slotRunWizard();
294 void slotZoneMoved(int start, int end);
295 void slotUpdatePreviewSettings();
296 void slotDvdWizard(const QString &url = QString(), const QString &profile = "dv_pal");
297 void slotGroupClips();
298 void slotUnGroupClips();
299 void slotSplitAudio();
300 void slotVideoOnly();
301 void slotAudioOnly();
302 void slotShowTimeline(bool show);
303 void slotMaximizeCurrent(bool show);
306 Q_SCRIPTABLE void abortRenderJob(const QString &url);