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 {
66 Q_CLASSINFO("D-Bus Interface", "org.kdenlive.MainWindow")
70 * \param MltPath path to MLT environment
71 * \param Url Url to open
72 * \param parent Std. widget parent
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 MainWindow(const QString &MltPath = QString(), const KUrl & Url = KUrl(), QWidget *parent = 0);
78 void parseProfiles(const QString &mltPath = QString());
80 static EffectsList videoEffects;
81 static EffectsList audioEffects;
82 static EffectsList customEffects;
83 static EffectsList transitions;
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);
92 * This function is called when it is time for the app to save its
93 * properties for session management purposes.
95 void saveProperties(KConfig *);
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
102 void readProperties(KConfig *);
105 KTabWidget* m_timelineArea;
106 QProgressBar *statusProgressBar;
108 KdenliveDoc *m_activeDocument;
109 TrackView *m_activeTimeline;
110 MonitorManager *m_monitorManager;
112 QDockWidget *projectListDock;
113 ProjectList *m_projectList;
115 QDockWidget *effectListDock;
116 EffectsListView *m_effectList;
117 //KListWidget *m_effectList;
119 QDockWidget *effectStackDock;
120 EffectStackView *effectStack;
122 QDockWidget *transitionConfigDock;
123 TransitionSettings *transitionConfig;
125 QDockWidget *clipMonitorDock;
126 Monitor *m_clipMonitor;
128 QDockWidget *projectMonitorDock;
129 Monitor *m_projectMonitor;
131 QDockWidget *recMonitorDock;
132 RecMonitor *m_recMonitor;
134 QDockWidget *undoViewDock;
135 QUndoView *m_undoView;
136 QUndoGroup *m_commandStack;
138 KComboBox *m_timecodeFormat;
140 QDockWidget *overviewDock;
141 CustomTrackView *m_overView;
143 QMenu *m_customEffectsMenu;
144 QMenu *m_timelineContextMenu;
145 QMenu *m_timelineContextClipMenu;
146 QMenu *m_timelineContextTransitionMenu;
148 RenderWidget *m_renderWidget;
150 #ifndef NO_JOGSHUTTLE
151 JogShuttle *m_jogProcess;
152 #endif /* NO_JOGSHUTTLE */
154 KRecentFilesAction *m_fileOpenRecent;
155 KAction *m_projectSearch;
156 KAction *m_projectSearchNext;
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;
172 StatusBarMessageLabel *m_messageLabel;
174 bool m_findActivated;
175 QString m_findString;
181 #ifndef NO_JOGSHUTTLE
182 void activateShuttleDevice();
183 void slotShuttleAction(int code);
184 #endif /* NO_JOGSHUTTLE */
185 void connectDocumentInfo(KdenliveDoc *doc);
187 void doOpenFile(const KUrl &url, KAutoSaveFile *stale);
188 void recoverFiles(QList<KAutoSaveFile *> staleFiles);
190 void populateMenus(QObject *plugin);
191 void addToMenu(QObject *plugin, const QStringList &texts,
192 QMenu *menu, const char *member,
193 QActionGroup *actionGroup);
195 QStringList m_pluginFileNames;
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);
204 void newFile(bool showProjectSettings = true);
206 void activateDocument();
207 void connectDocument(TrackView*, KdenliveDoc*);
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);
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();
262 void slotInsertSpace();
263 void slotRemoveSpace();
265 void slotEditGuide();
266 void slotDeleteGuide();
267 void slotDeleteAllGuides();
268 void slotGuidesUpdated();
272 void slotPasteEffects();
273 void slotReloadEffects();
274 void slotChangeClipSpeed();
276 void slotAdjustClipMonitor();
277 void slotAdjustProjectMonitor();
278 void slotSaveZone(Render *render, QPoint zone);
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 slotAutoTransition();
289 void slotRunWizard();
291 void slotZoneMoved(int start, int end);
292 void slotUpdatePreviewSettings();
293 void slotDvdWizard(const QString &url = QString(), const QString &profile = "dv_pal");
296 Q_SCRIPTABLE void abortRenderJob(const QString &url);