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 {
67 * \param MltPath path to MLT environment
68 * \param Url Url to open
69 * \param parent Std. widget parent
71 * The constructor inits the main window. If Url is present, it will be opened.
72 * If Url is not present, and openLastproject is set, last project will be set
73 * If no file is open after trying this, a default "newfile" will be created. */
74 MainWindow(const QString &MltPath = QString(), const KUrl & Url = KUrl(), QWidget *parent = 0);
75 void parseProfiles(const QString &mltPath = QString());
77 static EffectsList videoEffects;
78 static EffectsList audioEffects;
79 static EffectsList customEffects;
80 static EffectsList transitions;
82 virtual bool queryClose();
83 virtual void customEvent(QEvent * e);
84 virtual void keyPressEvent(QKeyEvent *ke);
85 /** Override hideEvent to get events when the mainwindow gets hidden */
86 virtual void hideEvent(QHideEvent *e);
87 bool eventFilter(QObject *obj, QEvent *ev);
89 * This function is called when it is time for the app to save its
90 * properties for session management purposes.
92 void saveProperties(KConfig *);
95 * This function is called when this app is restored. The KConfig
96 * object points to the session management config file that was saved
97 * with @ref saveProperties
99 void readProperties(KConfig *);
102 KTabWidget* m_timelineArea;
103 QProgressBar *statusProgressBar;
105 KdenliveDoc *m_activeDocument;
106 TrackView *m_activeTimeline;
107 MonitorManager *m_monitorManager;
109 QDockWidget *projectListDock;
110 ProjectList *m_projectList;
112 QDockWidget *effectListDock;
113 EffectsListView *m_effectList;
114 //KListWidget *m_effectList;
116 QDockWidget *effectStackDock;
117 EffectStackView *effectStack;
119 QDockWidget *transitionConfigDock;
120 TransitionSettings *transitionConfig;
122 QDockWidget *clipMonitorDock;
123 Monitor *m_clipMonitor;
125 QDockWidget *projectMonitorDock;
126 Monitor *m_projectMonitor;
128 QDockWidget *recMonitorDock;
129 RecMonitor *m_recMonitor;
131 QDockWidget *undoViewDock;
132 QUndoView *m_undoView;
133 QUndoGroup *m_commandStack;
135 KComboBox *m_timecodeFormat;
137 QDockWidget *overviewDock;
138 CustomTrackView *m_overView;
140 QMenu *m_customEffectsMenu;
141 QMenu *m_timelineContextMenu;
142 QMenu *m_timelineContextClipMenu;
143 QMenu *m_timelineContextTransitionMenu;
145 RenderWidget *m_renderWidget;
147 #ifndef NO_JOGSHUTTLE
148 JogShuttle *m_jogProcess;
149 #endif /* NO_JOGSHUTTLE */
151 KRecentFilesAction *m_fileOpenRecent;
152 KAction *m_projectSearch;
153 KAction *m_projectSearchNext;
155 KAction *m_buttonAudioThumbs;
156 KAction *m_buttonVideoThumbs;
157 KAction *m_buttonShowMarkers;
158 KAction *m_buttonFitZoom;
159 KAction *m_buttonSelectTool;
160 KAction *m_buttonRazorTool;
161 KAction *m_buttonSpacerTool;
162 KAction *m_buttonSnap;
163 QActionGroup *m_toolGroup;
164 KAction *m_saveAction;
165 KAction *m_closeAction;
166 QSlider *m_zoomSlider;
169 StatusBarMessageLabel *m_messageLabel;
171 bool m_findActivated;
172 QString m_findString;
178 #ifndef NO_JOGSHUTTLE
179 void activateShuttleDevice();
180 void slotShuttleAction(int code);
181 #endif /* NO_JOGSHUTTLE */
182 void connectDocumentInfo(KdenliveDoc *doc);
184 void doOpenFile(const KUrl &url, KAutoSaveFile *stale);
185 void recoverFiles(QList<KAutoSaveFile *> staleFiles);
187 void populateMenus(QObject *plugin);
188 void addToMenu(QObject *plugin, const QStringList &texts,
189 QMenu *menu, const char *member,
190 QActionGroup *actionGroup);
192 QStringList m_pluginFileNames;
195 void openFile(const KUrl &url);
196 void slotGotProgressInfo(const QString &message, int progress);
199 void newFile(bool showProjectSettings = true);
201 void activateDocument();
202 void connectDocument(TrackView*, KdenliveDoc*);
207 bool saveFileAs(const QString &outputFileName);
208 void slotPreferences(int page = -1, int option = -1);
209 void updateConfiguration();
210 void slotConnectMonitors();
211 void slotRaiseMonitor(bool clipMonitor);
212 void slotSetClipDuration(const QString &id, int duration);
213 void slotUpdateMousePosition(int pos);
214 void slotAddEffect(QDomElement effect, GenTime pos = GenTime(), int track = -1);
215 void slotEditProfiles();
216 void slotEditProjectSettings();
217 void slotDisplayActionMessage(QAction *a);
218 void slotSwitchVideoThumbs();
219 void slotSwitchAudioThumbs();
220 void slotSwitchMarkersComments();
221 void slotSwitchSnap();
222 void slotRenderProject();
223 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);
224 void slotFullScreen();
225 void slotUpdateDocumentState(bool modified);
229 void closeCurrentDocument();
230 void slotDeleteTimelineClip();
231 void slotAddClipMarker();
232 void slotDeleteClipMarker();
233 void slotDeleteAllClipMarkers();
234 void slotEditClipMarker();
235 void slotCutTimelineClip();
236 void slotAddVideoEffect(QAction *result);
237 void slotAddAudioEffect(QAction *result);
238 void slotAddCustomEffect(QAction *result);
239 void slotAddTransition(QAction *result);
240 void slotAddProjectClip(KUrl url);
241 #ifndef NO_JOGSHUTTLE
242 void slotShuttleButton(int code);
243 #endif /* NO_JOGSHUTTLE */
244 void slotShowClipProperties(DocClipBase *clip);
245 void slotActivateEffectStackView();
246 void slotActivateTransitionView();
247 void slotChangeTool(QAction * action);
248 void slotSetTool(PROJECTTOOL tool);
249 void slotSnapForward();
250 void slotSnapRewind();
251 void slotClipStart();
257 void slotInsertSpace();
258 void slotRemoveSpace();
260 void slotEditGuide();
261 void slotDeleteGuide();
262 void slotDeleteAllGuides();
263 void slotGuidesUpdated();
267 void slotPasteEffects();
268 void slotReloadEffects();
269 void slotChangeClipSpeed();
271 void slotAdjustClipMonitor();
272 void slotAdjustProjectMonitor();
273 void slotSaveZone(Render *render, QPoint zone);
275 void slotSetInPoint();
276 void slotSetOutPoint();
277 void configureNotifications();
278 void slotInsertTrack(int ix = 0);
279 void slotDeleteTrack(int ix = 0);
280 void slotChangeTrack(int ix = 0);
281 void slotGetNewStuff();
282 void slotAutoTransition();
283 void slotRunWizard();
285 void slotZoneMoved(int start, int end);
286 //void slotUpdatePreviewSettings();