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 ***************************************************************************/
21 #include "mainwindow.h"
22 #include "mainwindowadaptor.h"
23 #include "kdenlivesettings.h"
24 #include "kdenlivesettingsdialog.h"
25 #include "initeffects.h"
26 #include "profilesdialog.h"
27 #include "projectsettings.h"
29 #include "clipmanager.h"
30 #include "projectlist.h"
32 #include "recmonitor.h"
33 #include "monitormanager.h"
34 #include "kdenlivedoc.h"
35 #include "trackview.h"
36 #include "customtrackview.h"
37 #include "effectslistview.h"
38 #include "effectstackview.h"
39 #include "transitionsettings.h"
40 #include "renderwidget.h"
43 #include "jogshuttle.h"
44 #endif /* NO_JOGSHUTTLE */
45 #include "clipproperties.h"
47 #include "editclipcommand.h"
48 #include "titlewidget.h"
49 #include "markerdialog.h"
51 #include "interfaces.h"
52 #include "kdenlive-config.h"
53 #include "cliptranscode.h"
54 #include "ui_templateclip_ui.h"
55 #include "vectorscope.h"
57 #include "rgbparade.h"
59 #include <KApplication>
63 #include <KActionCollection>
64 #include <KActionCategory>
65 #include <KStandardAction>
66 #include <KShortcutsDialog>
67 #include <KFileDialog>
68 #include <KMessageBox>
70 #include <KIO/NetAccess>
73 #include <KConfigDialog>
74 #include <KXMLGUIFactory>
76 #include <kstandarddirs.h>
77 #include <KUrlRequesterDialog>
78 #include <KTemporaryFile>
80 #include <KActionMenu>
83 #include <ktogglefullscreenaction.h>
85 #include <KNotification>
86 #include <KNotifyConfigWidget>
87 #if KDE_IS_VERSION(4,3,80)
88 #include <knewstuff3/downloaddialog.h>
89 #include <knewstuff3/knewstuffaction.h>
91 #include <knewstuff2/engine.h>
92 #include <knewstuff2/ui/knewstuffaction.h>
94 #endif /* KDE_IS_VERSION(4,3,80) */
96 #include <KColorScheme>
98 #include <QTextStream>
102 #include <QInputDialog>
103 #include <QDesktopWidget>
108 static const char version[] = VERSION;
110 static const int ID_TIMELINE_POS = 0;
117 EffectsList MainWindow::videoEffects;
118 EffectsList MainWindow::audioEffects;
119 EffectsList MainWindow::customEffects;
120 EffectsList MainWindow::transitions;
122 MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, QWidget *parent) :
123 KXmlGuiWindow(parent),
124 m_activeDocument(NULL),
125 m_activeTimeline(NULL),
126 m_renderWidget(NULL),
127 #ifndef NO_JOGSHUTTLE
129 #endif /* NO_JOGSHUTTLE */
130 m_findActivated(false)
133 // Create DBus interface
134 new MainWindowAdaptor(this);
135 QDBusConnection dbus = QDBusConnection::sessionBus();
136 dbus.registerObject("/MainWindow", this);
138 setlocale(LC_NUMERIC, "POSIX");
139 if (!KdenliveSettings::colortheme().isEmpty()) slotChangePalette(NULL, KdenliveSettings::colortheme());
140 setFont(KGlobalSettings::toolBarFont());
141 parseProfiles(MltPath);
142 m_commandStack = new QUndoGroup;
143 m_timelineArea = new KTabWidget(this);
144 m_timelineArea->setTabReorderingEnabled(true);
145 m_timelineArea->setTabBarHidden(true);
146 m_timelineArea->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
147 m_timelineArea->setMinimumHeight(200);
149 QToolButton *closeTabButton = new QToolButton;
150 connect(closeTabButton, SIGNAL(clicked()), this, SLOT(closeCurrentDocument()));
151 closeTabButton->setIcon(KIcon("tab-close"));
152 closeTabButton->adjustSize();
153 closeTabButton->setToolTip(i18n("Close the current tab"));
154 m_timelineArea->setCornerWidget(closeTabButton);
155 connect(m_timelineArea, SIGNAL(currentChanged(int)), this, SLOT(activateDocument()));
157 connect(&m_findTimer, SIGNAL(timeout()), this, SLOT(findTimeout()));
158 m_findTimer.setSingleShot(true);
160 // FIXME: the next call returns a newly allocated object, which leaks
161 initEffects::parseEffectFiles();
162 //initEffects::parseCustomEffectsFile();
164 m_monitorManager = new MonitorManager();
166 m_shortcutRemoveFocus = new QShortcut(QKeySequence("Esc"), this);
167 connect(m_shortcutRemoveFocus, SIGNAL(activated()), this, SLOT(slotRemoveFocus()));
172 m_projectListDock = new QDockWidget(i18n("Project Tree"), this);
173 m_projectListDock->setObjectName("project_tree");
174 m_projectList = new ProjectList(this);
175 m_projectListDock->setWidget(m_projectList);
176 addDockWidget(Qt::TopDockWidgetArea, m_projectListDock);
178 m_effectStackDock = new QDockWidget(i18n("Effect Stack"), this);
179 m_effectStackDock->setObjectName("effect_stack");
180 m_effectStack = new EffectStackView(this);
181 m_effectStackDock->setWidget(m_effectStack);
182 addDockWidget(Qt::TopDockWidgetArea, m_effectStackDock);
184 m_transitionConfigDock = new QDockWidget(i18n("Transition"), this);
185 m_transitionConfigDock->setObjectName("transition");
186 m_transitionConfig = new TransitionSettings(this);
187 m_transitionConfigDock->setWidget(m_transitionConfig);
188 addDockWidget(Qt::TopDockWidgetArea, m_transitionConfigDock);
190 m_clipMonitorDock = new QDockWidget(i18n("Clip Monitor"), this);
191 m_clipMonitorDock->setObjectName("clip_monitor");
192 m_clipMonitor = new Monitor("clip", m_monitorManager, QString(), this);
193 m_clipMonitorDock->setWidget(m_clipMonitor);
194 addDockWidget(Qt::TopDockWidgetArea, m_clipMonitorDock);
196 m_projectMonitorDock = new QDockWidget(i18n("Project Monitor"), this);
197 m_projectMonitorDock->setObjectName("project_monitor");
198 m_projectMonitor = new Monitor("project", m_monitorManager, QString(), this);
199 m_projectMonitorDock->setWidget(m_projectMonitor);
200 addDockWidget(Qt::TopDockWidgetArea, m_projectMonitorDock);
203 m_recMonitorDock = new QDockWidget(i18n("Record Monitor"), this);
204 m_recMonitorDock->setObjectName("record_monitor");
205 m_recMonitor = new RecMonitor("record", this);
206 m_recMonitorDock->setWidget(m_recMonitor);
207 addDockWidget(Qt::TopDockWidgetArea, m_recMonitorDock);
208 connect(m_recMonitor, SIGNAL(addProjectClip(KUrl)), this, SLOT(slotAddProjectClip(KUrl)));
209 connect(m_recMonitor, SIGNAL(showConfigDialog(int, int)), this, SLOT(slotPreferences(int, int)));
212 m_effectListDock = new QDockWidget(i18n("Effect List"), this);
213 m_effectListDock->setObjectName("effect_list");
214 m_effectList = new EffectsListView();
215 m_effectListDock->setWidget(m_effectList);
216 addDockWidget(Qt::TopDockWidgetArea, m_effectListDock);
218 m_vectorscope = new Vectorscope(m_projectMonitor, m_clipMonitor, this);
219 m_vectorscopeDock = new QDockWidget(i18n("Vectorscope"), this);
220 m_vectorscopeDock->setObjectName(m_vectorscope->widgetName());
221 m_vectorscopeDock->setWidget(m_vectorscope);
222 addDockWidget(Qt::TopDockWidgetArea, m_vectorscopeDock);
224 m_waveform = new Waveform(m_projectMonitor, m_clipMonitor, this);
225 m_waveformDock = new QDockWidget(i18n("Waveform"), this);
226 m_waveformDock->setObjectName(m_waveform->widgetName());
227 m_waveformDock->setWidget(m_waveform);
228 addDockWidget(Qt::TopDockWidgetArea, m_waveformDock);
230 m_RGBParade = new RGBParade(m_projectMonitor, m_clipMonitor, this);
231 m_RGBParadeDock = new QDockWidget("RGB Parade", this);
232 m_RGBParadeDock->setObjectName(m_RGBParade->widgetName());
233 m_RGBParadeDock->setWidget(m_RGBParade);
234 addDockWidget(Qt::TopDockWidgetArea, m_RGBParadeDock);
237 m_undoViewDock = new QDockWidget(i18n("Undo History"), this);
238 m_undoViewDock->setObjectName("undo_history");
239 m_undoView = new QUndoView(this);
240 m_undoView->setCleanIcon(KIcon("edit-clear"));
241 m_undoView->setEmptyLabel(i18n("Clean"));
242 m_undoViewDock->setWidget(m_undoView);
243 m_undoView->setGroup(m_commandStack);
244 addDockWidget(Qt::TopDockWidgetArea, m_undoViewDock);
246 //overviewDock = new QDockWidget(i18n("Project Overview"), this);
247 //overviewDock->setObjectName("project_overview");
248 //m_overView = new CustomTrackView(NULL, NULL, this);
249 //overviewDock->setWidget(m_overView);
250 //addDockWidget(Qt::TopDockWidgetArea, overviewDock);
255 /// Tabify Widgets ///
256 tabifyDockWidget(m_projectListDock, m_effectStackDock);
257 tabifyDockWidget(m_projectListDock, m_transitionConfigDock);
260 tabifyDockWidget(m_clipMonitorDock, m_projectMonitorDock);
262 tabifyDockWidget(m_clipMonitorDock, m_recMonitorDock);
265 tabifyDockWidget(m_vectorscopeDock, m_waveformDock);
266 tabifyDockWidget(m_vectorscopeDock, m_RGBParadeDock);
267 tabifyDockWidget(m_vectorscopeDock, m_undoViewDock);
268 tabifyDockWidget(m_vectorscopeDock, m_effectListDock);
271 setCentralWidget(m_timelineArea);
274 KdenliveSettings::setCurrent_profile(KdenliveSettings::default_profile());
275 m_fileOpenRecent = KStandardAction::openRecent(this, SLOT(openFile(const KUrl &)), actionCollection());
277 m_fileRevert = KStandardAction::revert(this, SLOT(slotRevert()), actionCollection());
278 m_fileRevert->setEnabled(false);
284 // Find QDockWidget tab bars and show / hide widget title bars on right click
285 QList <QTabBar *> tabs = findChildren<QTabBar *>();
286 for (int i = 0; i < tabs.count(); i++) {
287 tabs.at(i)->setContextMenuPolicy(Qt::CustomContextMenu);
288 connect(tabs.at(i), SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(slotSwitchTitles()));
291 /*ScriptingPart* sp = new ScriptingPart(this, QStringList());
292 guiFactory()->addClient(sp);*/
296 //kDebug() << factory() << " " << factory()->container("video_effects_menu", this);
298 m_projectMonitor->setupMenu(static_cast<QMenu*>(factory()->container("monitor_go", this)), m_playZone, m_loopZone);
299 m_clipMonitor->setupMenu(static_cast<QMenu*>(factory()->container("monitor_go", this)), m_playZone, m_loopZone, static_cast<QMenu*>(factory()->container("marker_menu", this)));
301 QMenu *clipInTimeline = static_cast<QMenu*>(factory()->container("clip_in_timeline", this));
302 clipInTimeline->setIcon(KIcon("go-jump"));
303 m_projectList->setupGeneratorMenu(static_cast<QMenu*>(factory()->container("generators", this)),
304 static_cast<QMenu*>(factory()->container("transcoders", this)),
308 // build themes menus
309 QMenu *themesMenu = static_cast<QMenu*>(factory()->container("themes_menu", this));
310 QActionGroup *themegroup = new QActionGroup(this);
311 themegroup->setExclusive(true);
312 action = new KAction(i18n("Default"), this);
313 action->setCheckable(true);
314 themegroup->addAction(action);
315 if (KdenliveSettings::colortheme().isEmpty()) action->setChecked(true);
317 const QStringList schemeFiles = KGlobal::dirs()->findAllResources("data", "color-schemes/*.colors", KStandardDirs::NoDuplicates);
319 for (int i = 0; i < schemeFiles.size(); ++i) {
321 const QString filename = schemeFiles.at(i);
322 const QFileInfo info(filename);
325 KSharedConfigPtr config = KSharedConfig::openConfig(filename);
326 QIcon icon = createSchemePreviewIcon(config);
327 KConfigGroup group(config, "General");
328 const QString name = group.readEntry("Name", info.baseName());
329 action = new KAction(name, this);
330 action->setData(filename);
331 action->setIcon(icon);
332 action->setCheckable(true);
333 themegroup->addAction(action);
334 if (KdenliveSettings::colortheme() == filename) action->setChecked(true);
337 /*KGlobal::dirs()->addResourceDir("themes", KStandardDirs::installPath("data") + QString("kdenlive/themes"));
338 QStringList themes = KGlobal::dirs()->findAllResources("themes", QString(), KStandardDirs::Recursive | KStandardDirs::NoDuplicates);
339 for (QStringList::const_iterator it = themes.constBegin(); it != themes.constEnd(); ++it)
342 action = new QAction(fi.fileName(), this);
343 action->setData(*it);
344 action->setCheckable(true);
345 themegroup->addAction(action);
346 if (KdenliveSettings::colortheme() == *it) action->setChecked(true);
348 themesMenu->addActions(themegroup->actions());
349 connect(themesMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotChangePalette(QAction*)));
351 // Setup and fill effects and transitions menus.
352 m_videoEffectsMenu = static_cast<QMenu*>(factory()->container("video_effects_menu", this));
353 for (int i = 0; i < videoEffects.count(); ++i)
354 m_videoEffectsMenu->addAction(m_videoEffects[i]);
355 m_audioEffectsMenu = static_cast<QMenu*>(factory()->container("audio_effects_menu", this));
356 for (int i = 0; i < audioEffects.count(); ++i)
357 m_audioEffectsMenu->addAction(m_audioEffects[i]);
358 m_customEffectsMenu = static_cast<QMenu*>(factory()->container("custom_effects_menu", this));
359 if (customEffects.isEmpty())
360 m_customEffectsMenu->setEnabled(false);
362 m_customEffectsMenu->setEnabled(true);
363 for (int i = 0; i < customEffects.count(); ++i)
364 m_customEffectsMenu->addAction(m_customEffects[i]);
365 m_transitionsMenu = new QMenu(i18n("Add Transition"), this);
366 for (int i = 0; i < transitions.count(); ++i)
367 m_transitionsMenu->addAction(m_transitions[i]);
369 connect(m_videoEffectsMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotAddVideoEffect(QAction *)));
370 connect(m_audioEffectsMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotAddAudioEffect(QAction *)));
371 connect(m_customEffectsMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotAddCustomEffect(QAction *)));
372 connect(m_transitionsMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotAddTransition(QAction *)));
374 QMenu *newEffect = new QMenu(this);
375 newEffect->addMenu(m_videoEffectsMenu);
376 newEffect->addMenu(m_audioEffectsMenu);
377 newEffect->addMenu(m_customEffectsMenu);
378 m_effectStack->setMenu(newEffect);
380 QMenu *viewMenu = static_cast<QMenu*>(factory()->container("dockwindows", this));
381 const QList<QAction *> viewActions = createPopupMenu()->actions();
382 viewMenu->insertActions(NULL, viewActions);
384 m_timelineContextMenu = new QMenu(this);
385 m_timelineContextClipMenu = new QMenu(this);
386 m_timelineContextTransitionMenu = new QMenu(this);
388 m_timelineContextMenu->addAction(actionCollection()->action("insert_space"));
389 m_timelineContextMenu->addAction(actionCollection()->action("delete_space"));
390 m_timelineContextMenu->addAction(actionCollection()->action(KStandardAction::name(KStandardAction::Paste)));
392 m_timelineContextClipMenu->addAction(actionCollection()->action("clip_in_project_tree"));
393 //m_timelineContextClipMenu->addAction(actionCollection()->action("clip_to_project_tree"));
394 m_timelineContextClipMenu->addAction(actionCollection()->action("edit_item_duration"));
395 m_timelineContextClipMenu->addAction(actionCollection()->action("delete_item"));
396 m_timelineContextClipMenu->addSeparator();
397 m_timelineContextClipMenu->addAction(actionCollection()->action("group_clip"));
398 m_timelineContextClipMenu->addAction(actionCollection()->action("ungroup_clip"));
399 m_timelineContextClipMenu->addAction(actionCollection()->action("split_audio"));
400 m_timelineContextClipMenu->addSeparator();
401 m_timelineContextClipMenu->addAction(actionCollection()->action("cut_timeline_clip"));
402 m_timelineContextClipMenu->addAction(actionCollection()->action(KStandardAction::name(KStandardAction::Copy)));
403 m_timelineContextClipMenu->addAction(actionCollection()->action("paste_effects"));
404 m_timelineContextClipMenu->addSeparator();
406 QMenu *markersMenu = (QMenu*)(factory()->container("marker_menu", this));
407 m_timelineContextClipMenu->addMenu(markersMenu);
408 m_timelineContextClipMenu->addSeparator();
409 m_timelineContextClipMenu->addMenu(m_transitionsMenu);
410 m_timelineContextClipMenu->addMenu(m_videoEffectsMenu);
411 m_timelineContextClipMenu->addMenu(m_audioEffectsMenu);
412 //TODO: re-enable custom effects menu when it is implemented
413 m_timelineContextClipMenu->addMenu(m_customEffectsMenu);
415 m_timelineContextTransitionMenu->addAction(actionCollection()->action("edit_item_duration"));
416 m_timelineContextTransitionMenu->addAction(actionCollection()->action("delete_item"));
417 m_timelineContextTransitionMenu->addAction(actionCollection()->action(KStandardAction::name(KStandardAction::Copy)));
419 m_timelineContextTransitionMenu->addAction(actionCollection()->action("auto_transition"));
421 connect(m_projectMonitorDock, SIGNAL(visibilityChanged(bool)), m_projectMonitor, SLOT(refreshMonitor(bool)));
422 connect(m_clipMonitorDock, SIGNAL(visibilityChanged(bool)), m_clipMonitor, SLOT(refreshMonitor(bool)));
423 //connect(m_monitorManager, SIGNAL(connectMonitors()), this, SLOT(slotConnectMonitors()));
424 connect(m_monitorManager, SIGNAL(raiseClipMonitor(bool)), this, SLOT(slotRaiseMonitor(bool)));
425 connect(m_monitorManager, SIGNAL(raiseClipMonitor(bool)), m_vectorscope, SLOT(slotActiveMonitorChanged(bool)));
426 connect(m_monitorManager, SIGNAL(raiseClipMonitor(bool)), m_waveform, SLOT(slotActiveMonitorChanged(bool)));
427 connect(m_monitorManager, SIGNAL(raiseClipMonitor(bool)), m_RGBParade, SLOT(slotActiveMonitorChanged(bool)));
428 connect(m_effectList, SIGNAL(addEffect(const QDomElement)), this, SLOT(slotAddEffect(const QDomElement)));
429 connect(m_effectList, SIGNAL(reloadEffects()), this, SLOT(slotReloadEffects()));
431 m_monitorManager->initMonitors(m_clipMonitor, m_projectMonitor);
432 slotConnectMonitors();
434 // Disable drop B frames, see Kdenlive issue #1330, see also kdenlivesettingsdialog.cpp
435 KdenliveSettings::setDropbframes(false);
437 // Open or create a file. Command line argument passed in Url has
438 // precedence, then "openlastproject", then just a plain empty file.
439 // If opening Url fails, openlastproject will _not_ be used.
440 if (!Url.isEmpty()) {
441 // delay loading so that the window shows up
443 QTimer::singleShot(500, this, SLOT(openFile()));
444 } else if (KdenliveSettings::openlastproject()) {
445 QTimer::singleShot(500, this, SLOT(openLastFile()));
446 } else { //if (m_timelineArea->count() == 0) {
450 #ifndef NO_JOGSHUTTLE
451 activateShuttleDevice();
452 #endif /* NO_JOGSHUTTLE */
453 m_projectListDock->raise();
456 void MainWindow::queryQuit()
459 if (m_projectMonitor) m_projectMonitor->stop();
460 if (m_clipMonitor) m_clipMonitor->stop();
461 delete m_effectStack;
462 delete m_activeTimeline;
464 // This sometimes causes crash on exit on OS X for some reason.
465 delete m_projectMonitor;
466 delete m_clipMonitor;
468 delete m_activeDocument;
469 delete m_shortcutRemoveFocus;
470 Mlt::Factory::close();
476 bool MainWindow::queryClose()
478 if (m_renderWidget) {
479 int waitingJobs = m_renderWidget->waitingJobsCount();
480 if (waitingJobs > 0) {
481 switch (KMessageBox::warningYesNoCancel(this, i18np("You have 1 rendering job waiting in the queue.\nWhat do you want to do with this job?", "You have %1 rendering jobs waiting in the queue.\nWhat do you want to do with these jobs?", waitingJobs), QString(), KGuiItem(i18n("Start them now")), KGuiItem(i18n("Delete them")))) {
482 case KMessageBox::Yes :
483 // create script with waiting jobs and start it
484 if (m_renderWidget->startWaitingRenderJobs() == false) return false;
486 case KMessageBox::No :
487 // Don't do anything, jobs will be deleted
495 if (m_monitorManager) m_monitorManager->stopActiveMonitor();
496 // warn the user to save if document is modified and we have clips in our project list
497 if (m_activeDocument && m_activeDocument->isModified() &&
498 ((m_projectList->documentClipList().isEmpty() && !m_activeDocument->url().isEmpty()) ||
499 !m_projectList->documentClipList().isEmpty())) {
501 if (m_activeDocument->url().fileName().isEmpty())
502 message = i18n("Save changes to document?");
504 message = i18n("The project <b>\"%1\"</b> has been changed.\nDo you want to save your changes?").arg(m_activeDocument->url().fileName());
505 switch (KMessageBox::warningYesNoCancel(this, message)) {
506 case KMessageBox::Yes :
507 // save document here. If saving fails, return false;
509 case KMessageBox::No :
510 // User does not want to save the changes, clear recovery files
511 m_activeDocument->m_autosave->resize(0);
520 void MainWindow::loadPlugins()
522 foreach(QObject *plugin, QPluginLoader::staticInstances()) {
523 populateMenus(plugin);
526 QStringList directories = KGlobal::dirs()->findDirs("module", QString());
528 filters << "libkdenlive*";
529 foreach(const QString &folder, directories) {
530 kDebug() << "Parsing plugin folder: " << folder;
531 QDir pluginsDir(folder);
532 foreach(const QString &fileName,
533 pluginsDir.entryList(filters, QDir::Files)) {
535 * Avoid loading the same plugin twice when there is more than one
538 if (!m_pluginFileNames.contains(fileName)) {
539 kDebug() << "Found plugin: " << fileName;
540 QPluginLoader loader(pluginsDir.absoluteFilePath(fileName));
541 QObject *plugin = loader.instance();
543 populateMenus(plugin);
544 m_pluginFileNames += fileName;
546 kDebug() << "Error loading plugin: " << fileName << ", " << loader.errorString();
552 void MainWindow::populateMenus(QObject *plugin)
554 QMenu *addMenu = static_cast<QMenu*>(factory()->container("generators", this));
555 ClipGenerator *iGenerator = qobject_cast<ClipGenerator *>(plugin);
557 addToMenu(plugin, iGenerator->generators(KdenliveSettings::producerslist()), addMenu, SLOT(generateClip()),
561 void MainWindow::addToMenu(QObject *plugin, const QStringList &texts,
562 QMenu *menu, const char *member,
563 QActionGroup *actionGroup)
565 kDebug() << "// ADD to MENU" << texts;
566 foreach(const QString &text, texts) {
567 QAction *action = new QAction(text, plugin);
568 action->setData(text);
569 connect(action, SIGNAL(triggered()), this, member);
570 menu->addAction(action);
573 action->setCheckable(true);
574 actionGroup->addAction(action);
579 void MainWindow::aboutPlugins()
581 //PluginDialog dialog(pluginsDir.path(), m_pluginFileNames, this);
586 void MainWindow::generateClip()
588 QAction *action = qobject_cast<QAction *>(sender());
589 ClipGenerator *iGenerator = qobject_cast<ClipGenerator *>(action->parent());
591 KUrl clipUrl = iGenerator->generatedClip(action->data().toString(), m_activeDocument->projectFolder(),
592 QStringList(), QStringList(), m_activeDocument->fps(), m_activeDocument->width(), m_activeDocument->height());
593 if (!clipUrl.isEmpty()) {
594 m_projectList->slotAddClip(QList <QUrl> () << clipUrl);
598 void MainWindow::saveProperties(KConfigGroup &config)
600 // save properties here,used by session management
602 KMainWindow::saveProperties(config);
606 void MainWindow::readProperties(const KConfigGroup &config)
608 // read properties here,used by session management
609 KMainWindow::readProperties(config);
610 QString Lastproject = config.group("Recent Files").readPathEntry("File1", QString());
611 openFile(KUrl(Lastproject));
614 void MainWindow::slotReloadEffects()
616 m_customEffectsMenu->clear();
617 initEffects::parseCustomEffectsFile();
619 QStringList effectInfo;
620 QMap<QString, QStringList> effectsList;
621 for (int ix = 0; ix < customEffects.count(); ix++) {
622 effectInfo = customEffects.effectIdInfo(ix);
623 effectsList.insert(effectInfo.at(0).toLower(), effectInfo);
625 if (effectsList.isEmpty())
626 m_customEffectsMenu->setEnabled(false);
628 m_customEffectsMenu->setEnabled(true);
630 foreach(const QStringList &value, effectsList) {
631 action = new QAction(value.at(0), this);
632 action->setData(value);
633 m_customEffectsMenu->addAction(action);
635 m_effectList->reloadEffectList();
638 #ifndef NO_JOGSHUTTLE
639 void MainWindow::activateShuttleDevice()
643 if (KdenliveSettings::enableshuttle() == false) return;
644 m_jogProcess = new JogShuttle(KdenliveSettings::shuttledevice());
645 connect(m_jogProcess, SIGNAL(rewind1()), m_monitorManager, SLOT(slotRewindOneFrame()));
646 connect(m_jogProcess, SIGNAL(forward1()), m_monitorManager, SLOT(slotForwardOneFrame()));
647 connect(m_jogProcess, SIGNAL(rewind(double)), m_monitorManager, SLOT(slotRewind(double)));
648 connect(m_jogProcess, SIGNAL(forward(double)), m_monitorManager, SLOT(slotForward(double)));
649 connect(m_jogProcess, SIGNAL(stop()), m_monitorManager, SLOT(slotPlay()));
650 connect(m_jogProcess, SIGNAL(button(int)), this, SLOT(slotShuttleButton(int)));
653 void MainWindow::slotShuttleButton(int code)
657 slotShuttleAction(KdenliveSettings::shuttle1());
660 slotShuttleAction(KdenliveSettings::shuttle2());
663 slotShuttleAction(KdenliveSettings::shuttle3());
666 slotShuttleAction(KdenliveSettings::shuttle4());
669 slotShuttleAction(KdenliveSettings::shuttle5());
674 void MainWindow::slotShuttleAction(int code)
680 m_monitorManager->slotPlay();
683 m_monitorManager->slotPlay();
687 #endif /* NO_JOGSHUTTLE */
689 void MainWindow::configureNotifications()
691 KNotifyConfigWidget::configure(this);
694 void MainWindow::slotFullScreen()
696 KToggleFullScreenAction::setFullScreen(this, actionCollection()->action("fullscreen")->isChecked());
699 void MainWindow::slotAddEffect(const QDomElement effect, GenTime pos, int track)
701 if (!m_activeDocument) return;
702 if (effect.isNull()) {
703 kDebug() << "--- ERROR, TRYING TO APPEND NULL EFFECT";
706 QDomElement effectToAdd = effect.cloneNode().toElement();
707 m_activeTimeline->projectView()->slotAddEffect(effectToAdd, pos, track);
710 void MainWindow::slotRaiseMonitor(bool clipMonitor)
712 if (clipMonitor) m_clipMonitorDock->raise();
713 else m_projectMonitorDock->raise();
716 void MainWindow::slotUpdateClip(const QString &id)
718 if (!m_activeDocument) return;
719 m_activeTimeline->projectView()->slotUpdateClip(id);
722 void MainWindow::slotConnectMonitors()
724 m_projectList->setRenderer(m_projectMonitor->render);
725 //connect(m_projectList, SIGNAL(receivedClipDuration(const QString &)), this, SLOT(slotUpdateClip(const QString &)));
726 connect(m_projectList, SIGNAL(deleteProjectClips(QStringList, QMap<QString, QString>)), this, SLOT(slotDeleteProjectClips(QStringList, QMap<QString, QString>)));
727 connect(m_projectList, SIGNAL(showClipProperties(DocClipBase *)), this, SLOT(slotShowClipProperties(DocClipBase *)));
728 connect(m_projectList, SIGNAL(showClipProperties(QList <DocClipBase *>, QMap<QString, QString>)), this, SLOT(slotShowClipProperties(QList <DocClipBase *>, QMap<QString, QString>)));
729 connect(m_projectList, SIGNAL(getFileProperties(const QDomElement, const QString &, int, bool)), m_projectMonitor->render, SLOT(getFileProperties(const QDomElement, const QString &, int, bool)));
730 connect(m_projectMonitor->render, SIGNAL(replyGetImage(const QString &, const QPixmap &)), m_projectList, SLOT(slotReplyGetImage(const QString &, const QPixmap &)));
731 connect(m_projectMonitor->render, SIGNAL(replyGetFileProperties(const QString &, Mlt::Producer*, const QMap < QString, QString > &, const QMap < QString, QString > &, bool)), m_projectList, SLOT(slotReplyGetFileProperties(const QString &, Mlt::Producer*, const QMap < QString, QString > &, const QMap < QString, QString > &, bool)));
733 connect(m_projectMonitor->render, SIGNAL(removeInvalidClip(const QString &, bool)), m_projectList, SLOT(slotRemoveInvalidClip(const QString &, bool)));
735 connect(m_clipMonitor, SIGNAL(refreshClipThumbnail(const QString &)), m_projectList, SLOT(slotRefreshClipThumbnail(const QString &)));
737 connect(m_clipMonitor, SIGNAL(adjustMonitorSize()), this, SLOT(slotAdjustClipMonitor()));
738 connect(m_projectMonitor, SIGNAL(adjustMonitorSize()), this, SLOT(slotAdjustProjectMonitor()));
740 connect(m_clipMonitor, SIGNAL(saveZone(Render *, QPoint)), this, SLOT(slotSaveZone(Render *, QPoint)));
741 connect(m_projectMonitor, SIGNAL(saveZone(Render *, QPoint)), this, SLOT(slotSaveZone(Render *, QPoint)));
744 void MainWindow::slotAdjustClipMonitor()
746 m_clipMonitorDock->updateGeometry();
747 m_clipMonitorDock->adjustSize();
748 m_clipMonitor->resetSize();
751 void MainWindow::slotAdjustProjectMonitor()
753 m_projectMonitorDock->updateGeometry();
754 m_projectMonitorDock->adjustSize();
755 m_projectMonitor->resetSize();
758 void MainWindow::setupActions()
761 KActionCollection* collection = actionCollection();
762 m_timecodeFormat = new KComboBox(this);
763 m_timecodeFormat->addItem(i18n("hh:mm:ss::ff"));
764 m_timecodeFormat->addItem(i18n("Frames"));
765 if (KdenliveSettings::frametimecode()) m_timecodeFormat->setCurrentIndex(1);
766 connect(m_timecodeFormat, SIGNAL(activated(int)), this, SLOT(slotUpdateTimecodeFormat(int)));
768 m_statusProgressBar = new QProgressBar(this);
769 m_statusProgressBar->setMinimum(0);
770 m_statusProgressBar->setMaximum(100);
771 m_statusProgressBar->setMaximumWidth(150);
772 m_statusProgressBar->setVisible(false);
774 KToolBar *toolbar = new KToolBar("statusToolBar", this, Qt::BottomToolBarArea);
775 toolbar->setMovable(false);
776 statusBar()->setStyleSheet(QString("QStatusBar QLabel {font-size:%1pt;} QStatusBar::item { border: 0px; font-size:%1pt;padding:0px; }").arg(statusBar()->font().pointSize()));
777 QString style1 = "QToolBar { border: 0px } QToolButton { border-style: inset; border:1px solid #999999;border-radius: 3px;margin: 0px 3px;padding: 0px;} QToolButton:checked { background-color: rgba(224, 224, 0, 100); border-style: inset; border:1px solid #cc6666;border-radius: 3px;}";
778 QString styleBorderless = "QToolButton { border-width: 0px;margin: 1px 3px 0px;padding: 0px;}";
780 //create edit mode buttons
781 m_normalEditTool = new KAction(KIcon("kdenlive-normal-edit"), i18n("Normal mode"), this);
782 m_normalEditTool->setShortcut(i18nc("Normal editing", "n"));
783 toolbar->addAction(m_normalEditTool);
784 m_normalEditTool->setCheckable(true);
785 m_normalEditTool->setChecked(true);
787 m_overwriteEditTool = new KAction(KIcon("kdenlive-overwrite-edit"), i18n("Overwrite mode"), this);
788 //m_overwriteEditTool->setShortcut(i18nc("Overwrite mode shortcut", "o"));
789 toolbar->addAction(m_overwriteEditTool);
790 m_overwriteEditTool->setCheckable(true);
791 m_overwriteEditTool->setChecked(false);
793 m_insertEditTool = new KAction(KIcon("kdenlive-insert-edit"), i18n("Insert mode"), this);
794 //m_insertEditTool->setShortcut(i18nc("Insert mode shortcut", "i"));
795 toolbar->addAction(m_insertEditTool);
796 m_insertEditTool->setCheckable(true);
797 m_insertEditTool->setChecked(false);
798 // not implemented yet
799 m_insertEditTool->setEnabled(false);
801 QActionGroup *editGroup = new QActionGroup(this);
802 editGroup->addAction(m_normalEditTool);
803 editGroup->addAction(m_overwriteEditTool);
804 editGroup->addAction(m_insertEditTool);
805 editGroup->setExclusive(true);
806 connect(editGroup, SIGNAL(triggered(QAction *)), this, SLOT(slotChangeEdit(QAction *)));
807 //connect(m_overwriteEditTool, SIGNAL(toggled(bool)), this, SLOT(slotSetOverwriteMode(bool)));
809 toolbar->addSeparator();
811 // create tools buttons
812 m_buttonSelectTool = new KAction(KIcon("kdenlive-select-tool"), i18n("Selection tool"), this);
813 m_buttonSelectTool->setShortcut(i18nc("Selection tool shortcut", "s"));
814 toolbar->addAction(m_buttonSelectTool);
815 m_buttonSelectTool->setCheckable(true);
816 m_buttonSelectTool->setChecked(true);
818 m_buttonRazorTool = new KAction(KIcon("edit-cut"), i18n("Razor tool"), this);
819 m_buttonRazorTool->setShortcut(i18nc("Razor tool shortcut", "x"));
820 toolbar->addAction(m_buttonRazorTool);
821 m_buttonRazorTool->setCheckable(true);
822 m_buttonRazorTool->setChecked(false);
824 m_buttonSpacerTool = new KAction(KIcon("kdenlive-spacer-tool"), i18n("Spacer tool"), this);
825 m_buttonSpacerTool->setShortcut(i18nc("Spacer tool shortcut", "m"));
826 toolbar->addAction(m_buttonSpacerTool);
827 m_buttonSpacerTool->setCheckable(true);
828 m_buttonSpacerTool->setChecked(false);
830 QActionGroup *toolGroup = new QActionGroup(this);
831 toolGroup->addAction(m_buttonSelectTool);
832 toolGroup->addAction(m_buttonRazorTool);
833 toolGroup->addAction(m_buttonSpacerTool);
834 toolGroup->setExclusive(true);
835 toolbar->setToolButtonStyle(Qt::ToolButtonIconOnly);
837 QWidget * actionWidget;
838 int max = toolbar->iconSizeDefault() + 2;
839 actionWidget = toolbar->widgetForAction(m_normalEditTool);
840 actionWidget->setMaximumWidth(max);
841 actionWidget->setMaximumHeight(max - 4);
843 actionWidget = toolbar->widgetForAction(m_insertEditTool);
844 actionWidget->setMaximumWidth(max);
845 actionWidget->setMaximumHeight(max - 4);
847 actionWidget = toolbar->widgetForAction(m_overwriteEditTool);
848 actionWidget->setMaximumWidth(max);
849 actionWidget->setMaximumHeight(max - 4);
851 actionWidget = toolbar->widgetForAction(m_buttonSelectTool);
852 actionWidget->setMaximumWidth(max);
853 actionWidget->setMaximumHeight(max - 4);
855 actionWidget = toolbar->widgetForAction(m_buttonRazorTool);
856 actionWidget->setMaximumWidth(max);
857 actionWidget->setMaximumHeight(max - 4);
859 actionWidget = toolbar->widgetForAction(m_buttonSpacerTool);
860 actionWidget->setMaximumWidth(max);
861 actionWidget->setMaximumHeight(max - 4);
863 toolbar->setStyleSheet(style1);
864 connect(toolGroup, SIGNAL(triggered(QAction *)), this, SLOT(slotChangeTool(QAction *)));
866 toolbar->addSeparator();
867 m_buttonFitZoom = new KAction(KIcon("zoom-fit-best"), i18n("Fit zoom to project"), this);
868 toolbar->addAction(m_buttonFitZoom);
869 m_buttonFitZoom->setCheckable(false);
871 m_zoomOut = new KAction(KIcon("zoom-out"), i18n("Zoom Out"), this);
872 toolbar->addAction(m_zoomOut);
873 m_zoomOut->setShortcut(Qt::CTRL + Qt::Key_Minus);
875 m_zoomSlider = new QSlider(Qt::Horizontal, this);
876 m_zoomSlider->setMaximum(13);
877 m_zoomSlider->setPageStep(1);
878 m_zoomSlider->setInvertedAppearance(true);
880 m_zoomSlider->setMaximumWidth(150);
881 m_zoomSlider->setMinimumWidth(100);
882 toolbar->addWidget(m_zoomSlider);
884 m_zoomIn = new KAction(KIcon("zoom-in"), i18n("Zoom In"), this);
885 toolbar->addAction(m_zoomIn);
886 m_zoomIn->setShortcut(Qt::CTRL + Qt::Key_Plus);
888 actionWidget = toolbar->widgetForAction(m_buttonFitZoom);
889 actionWidget->setMaximumWidth(max);
890 actionWidget->setMaximumHeight(max - 4);
891 actionWidget->setStyleSheet(styleBorderless);
893 actionWidget = toolbar->widgetForAction(m_zoomIn);
894 actionWidget->setMaximumWidth(max);
895 actionWidget->setMaximumHeight(max - 4);
896 actionWidget->setStyleSheet(styleBorderless);
898 actionWidget = toolbar->widgetForAction(m_zoomOut);
899 actionWidget->setMaximumWidth(max);
900 actionWidget->setMaximumHeight(max - 4);
901 actionWidget->setStyleSheet(styleBorderless);
903 connect(m_zoomSlider, SIGNAL(valueChanged(int)), this, SLOT(slotSetZoom(int)));
904 connect(m_zoomSlider, SIGNAL(sliderMoved(int)), this, SLOT(slotShowZoomSliderToolTip(int)));
905 connect(m_buttonFitZoom, SIGNAL(triggered()), this, SLOT(slotFitZoom()));
906 connect(m_zoomIn, SIGNAL(triggered(bool)), this, SLOT(slotZoomIn()));
907 connect(m_zoomOut, SIGNAL(triggered(bool)), this, SLOT(slotZoomOut()));
909 toolbar->addSeparator();
911 //create automatic audio split button
912 m_buttonAutomaticSplitAudio = new KAction(KIcon("kdenlive-split-audio"), i18n("Split audio and video automatically"), this);
913 toolbar->addAction(m_buttonAutomaticSplitAudio);
914 m_buttonAutomaticSplitAudio->setCheckable(true);
915 m_buttonAutomaticSplitAudio->setChecked(KdenliveSettings::splitaudio());
916 connect(m_buttonAutomaticSplitAudio, SIGNAL(triggered()), this, SLOT(slotSwitchSplitAudio()));
918 m_buttonVideoThumbs = new KAction(KIcon("kdenlive-show-videothumb"), i18n("Show video thumbnails"), this);
919 toolbar->addAction(m_buttonVideoThumbs);
920 m_buttonVideoThumbs->setCheckable(true);
921 m_buttonVideoThumbs->setChecked(KdenliveSettings::videothumbnails());
922 connect(m_buttonVideoThumbs, SIGNAL(triggered()), this, SLOT(slotSwitchVideoThumbs()));
924 m_buttonAudioThumbs = new KAction(KIcon("kdenlive-show-audiothumb"), i18n("Show audio thumbnails"), this);
925 toolbar->addAction(m_buttonAudioThumbs);
926 m_buttonAudioThumbs->setCheckable(true);
927 m_buttonAudioThumbs->setChecked(KdenliveSettings::audiothumbnails());
928 connect(m_buttonAudioThumbs, SIGNAL(triggered()), this, SLOT(slotSwitchAudioThumbs()));
930 m_buttonShowMarkers = new KAction(KIcon("kdenlive-show-markers"), i18n("Show markers comments"), this);
931 toolbar->addAction(m_buttonShowMarkers);
932 m_buttonShowMarkers->setCheckable(true);
933 m_buttonShowMarkers->setChecked(KdenliveSettings::showmarkers());
934 connect(m_buttonShowMarkers, SIGNAL(triggered()), this, SLOT(slotSwitchMarkersComments()));
936 m_buttonSnap = new KAction(KIcon("kdenlive-snap"), i18n("Snap"), this);
937 toolbar->addAction(m_buttonSnap);
938 m_buttonSnap->setCheckable(true);
939 m_buttonSnap->setChecked(KdenliveSettings::snaptopoints());
940 connect(m_buttonSnap, SIGNAL(triggered()), this, SLOT(slotSwitchSnap()));
942 actionWidget = toolbar->widgetForAction(m_buttonAutomaticSplitAudio);
943 actionWidget->setMaximumWidth(max);
944 actionWidget->setMaximumHeight(max - 4);
946 actionWidget = toolbar->widgetForAction(m_buttonVideoThumbs);
947 actionWidget->setMaximumWidth(max);
948 actionWidget->setMaximumHeight(max - 4);
950 actionWidget = toolbar->widgetForAction(m_buttonAudioThumbs);
951 actionWidget->setMaximumWidth(max);
952 actionWidget->setMaximumHeight(max - 4);
954 actionWidget = toolbar->widgetForAction(m_buttonShowMarkers);
955 actionWidget->setMaximumWidth(max);
956 actionWidget->setMaximumHeight(max - 4);
958 actionWidget = toolbar->widgetForAction(m_buttonSnap);
959 actionWidget->setMaximumWidth(max);
960 actionWidget->setMaximumHeight(max - 4);
962 m_messageLabel = new StatusBarMessageLabel(this);
963 m_messageLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding);
965 statusBar()->addWidget(m_messageLabel, 10);
966 statusBar()->addWidget(m_statusProgressBar, 0);
967 statusBar()->addPermanentWidget(toolbar);
968 statusBar()->insertPermanentFixedItem("00:00:00:00", ID_TIMELINE_POS);
969 statusBar()->addPermanentWidget(m_timecodeFormat);
970 //statusBar()->setMaximumHeight(statusBar()->font().pointSize() * 3);
972 collection->addAction("normal_mode", m_normalEditTool);
973 collection->addAction("overwrite_mode", m_overwriteEditTool);
974 collection->addAction("insert_mode", m_insertEditTool);
975 collection->addAction("select_tool", m_buttonSelectTool);
976 collection->addAction("razor_tool", m_buttonRazorTool);
977 collection->addAction("spacer_tool", m_buttonSpacerTool);
979 collection->addAction("automatic_split_audio", m_buttonAutomaticSplitAudio);
980 collection->addAction("show_video_thumbs", m_buttonVideoThumbs);
981 collection->addAction("show_audio_thumbs", m_buttonAudioThumbs);
982 collection->addAction("show_markers", m_buttonShowMarkers);
983 collection->addAction("snap", m_buttonSnap);
984 collection->addAction("zoom_fit", m_buttonFitZoom);
985 collection->addAction("zoom_in", m_zoomIn);
986 collection->addAction("zoom_out", m_zoomOut);
988 m_projectSearch = new KAction(KIcon("edit-find"), i18n("Find"), this);
989 collection->addAction("project_find", m_projectSearch);
990 connect(m_projectSearch, SIGNAL(triggered(bool)), this, SLOT(slotFind()));
991 m_projectSearch->setShortcut(Qt::Key_Slash);
993 m_projectSearchNext = new KAction(KIcon("go-down-search"), i18n("Find Next"), this);
994 collection->addAction("project_find_next", m_projectSearchNext);
995 connect(m_projectSearchNext, SIGNAL(triggered(bool)), this, SLOT(slotFindNext()));
996 m_projectSearchNext->setShortcut(Qt::Key_F3);
997 m_projectSearchNext->setEnabled(false);
999 KAction* profilesAction = new KAction(KIcon("document-new"), i18n("Manage Project Profiles"), this);
1000 collection->addAction("manage_profiles", profilesAction);
1001 connect(profilesAction, SIGNAL(triggered(bool)), this, SLOT(slotEditProfiles()));
1003 KNS3::standardAction(i18n("Download New Wipes..."), this, SLOT(slotGetNewLumaStuff()), actionCollection(), "get_new_lumas");
1004 KNS3::standardAction(i18n("Download New Render Profiles..."), this, SLOT(slotGetNewRenderStuff()), actionCollection(), "get_new_profiles");
1005 KNS3::standardAction(i18n("Download New Project Profiles..."), this, SLOT(slotGetNewMltProfileStuff()), actionCollection(), "get_new_mlt_profiles");
1006 KNS3::standardAction(i18n("Download New Title Templates..."), this, SLOT(slotGetNewTitleStuff()), actionCollection(), "get_new_titles");
1008 KAction* wizAction = new KAction(KIcon("configure"), i18n("Run Config Wizard"), this);
1009 collection->addAction("run_wizard", wizAction);
1010 connect(wizAction, SIGNAL(triggered(bool)), this, SLOT(slotRunWizard()));
1012 KAction* projectAction = new KAction(KIcon("configure"), i18n("Project Settings"), this);
1013 collection->addAction("project_settings", projectAction);
1014 connect(projectAction, SIGNAL(triggered(bool)), this, SLOT(slotEditProjectSettings()));
1016 KAction* projectRender = new KAction(KIcon("media-record"), i18n("Render"), this);
1017 collection->addAction("project_render", projectRender);
1018 projectRender->setShortcut(Qt::CTRL + Qt::Key_Return);
1019 connect(projectRender, SIGNAL(triggered(bool)), this, SLOT(slotRenderProject()));
1021 KAction* projectClean = new KAction(KIcon("edit-clear"), i18n("Clean Project"), this);
1022 collection->addAction("project_clean", projectClean);
1023 connect(projectClean, SIGNAL(triggered(bool)), this, SLOT(slotCleanProject()));
1025 KAction* monitorPlay = new KAction(KIcon("media-playback-start"), i18n("Play"), this);
1026 KShortcut playShortcut;
1027 playShortcut.setPrimary(Qt::Key_Space);
1028 playShortcut.setAlternate(Qt::Key_K);
1029 monitorPlay->setShortcut(playShortcut);
1030 collection->addAction("monitor_play", monitorPlay);
1031 connect(monitorPlay, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotPlay()));
1033 m_playZone = new KAction(KIcon("media-playback-start"), i18n("Play Zone"), this);
1034 m_playZone->setShortcut(Qt::CTRL + Qt::Key_Space);
1035 collection->addAction("monitor_play_zone", m_playZone);
1036 connect(m_playZone, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotPlayZone()));
1038 m_loopZone = new KAction(KIcon("media-playback-start"), i18n("Loop Zone"), this);
1039 m_loopZone->setShortcut(Qt::ALT + Qt::Key_Space);
1040 collection->addAction("monitor_loop_zone", m_loopZone);
1041 connect(m_loopZone, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotLoopZone()));
1043 KAction *dvdWizard = new KAction(KIcon("media-optical"), i18n("DVD Wizard"), this);
1044 collection->addAction("dvd_wizard", dvdWizard);
1045 connect(dvdWizard, SIGNAL(triggered(bool)), this, SLOT(slotDvdWizard()));
1047 KAction *transcodeClip = new KAction(KIcon("edit-copy"), i18n("Transcode Clips"), this);
1048 collection->addAction("transcode_clip", transcodeClip);
1049 connect(transcodeClip, SIGNAL(triggered(bool)), this, SLOT(slotTranscodeClip()));
1051 KAction *markIn = collection->addAction("mark_in");
1052 markIn->setText(i18n("Set Zone In"));
1053 markIn->setShortcut(Qt::Key_I);
1054 connect(markIn, SIGNAL(triggered(bool)), this, SLOT(slotSetInPoint()));
1056 KAction *markOut = collection->addAction("mark_out");
1057 markOut->setText(i18n("Set Zone Out"));
1058 markOut->setShortcut(Qt::Key_O);
1059 connect(markOut, SIGNAL(triggered(bool)), this, SLOT(slotSetOutPoint()));
1061 KAction *switchMon = collection->addAction("switch_monitor");
1062 switchMon->setText(i18n("Switch monitor"));
1063 switchMon->setShortcut(Qt::Key_T);
1064 connect(switchMon, SIGNAL(triggered(bool)), this, SLOT(slotSwitchMonitors()));
1066 KAction *insertTree = collection->addAction("insert_project_tree");
1067 insertTree->setText(i18n("Insert zone in project tree"));
1068 insertTree->setShortcut(Qt::CTRL + Qt::Key_I);
1069 connect(insertTree, SIGNAL(triggered(bool)), this, SLOT(slotInsertZoneToTree()));
1071 KAction *insertTimeline = collection->addAction("insert_timeline");
1072 insertTimeline->setText(i18n("Insert zone in timeline"));
1073 insertTimeline->setShortcut(Qt::SHIFT + Qt::CTRL + Qt::Key_I);
1074 connect(insertTimeline, SIGNAL(triggered(bool)), this, SLOT(slotInsertZoneToTimeline()));
1076 KAction *resizeStart = new KAction(KIcon(), i18n("Resize Item Start"), this);
1077 collection->addAction("resize_timeline_clip_start", resizeStart);
1078 resizeStart->setShortcut(Qt::Key_1);
1079 connect(resizeStart, SIGNAL(triggered(bool)), this, SLOT(slotResizeItemStart()));
1081 KAction *resizeEnd = new KAction(KIcon(), i18n("Resize Item End"), this);
1082 collection->addAction("resize_timeline_clip_end", resizeEnd);
1083 resizeEnd->setShortcut(Qt::Key_2);
1084 connect(resizeEnd, SIGNAL(triggered(bool)), this, SLOT(slotResizeItemEnd()));
1086 KAction* monitorSeekBackward = new KAction(KIcon("media-seek-backward"), i18n("Rewind"), this);
1087 monitorSeekBackward->setShortcut(Qt::Key_J);
1088 collection->addAction("monitor_seek_backward", monitorSeekBackward);
1089 connect(monitorSeekBackward, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotRewind()));
1091 KAction* monitorSeekBackwardOneFrame = new KAction(KIcon("media-skip-backward"), i18n("Rewind 1 Frame"), this);
1092 monitorSeekBackwardOneFrame->setShortcut(Qt::Key_Left);
1093 collection->addAction("monitor_seek_backward-one-frame", monitorSeekBackwardOneFrame);
1094 connect(monitorSeekBackwardOneFrame, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotRewindOneFrame()));
1096 KAction* monitorSeekBackwardOneSecond = new KAction(KIcon("media-skip-backward"), i18n("Rewind 1 Second"), this);
1097 monitorSeekBackwardOneSecond->setShortcut(Qt::SHIFT + Qt::Key_Left);
1098 collection->addAction("monitor_seek_backward-one-second", monitorSeekBackwardOneSecond);
1099 connect(monitorSeekBackwardOneSecond, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotRewindOneSecond()));
1101 KAction* monitorSeekSnapBackward = new KAction(KIcon("media-seek-backward"), i18n("Go to Previous Snap Point"), this);
1102 monitorSeekSnapBackward->setShortcut(Qt::ALT + Qt::Key_Left);
1103 collection->addAction("monitor_seek_snap_backward", monitorSeekSnapBackward);
1104 connect(monitorSeekSnapBackward, SIGNAL(triggered(bool)), this, SLOT(slotSnapRewind()));
1106 KAction* monitorSeekForward = new KAction(KIcon("media-seek-forward"), i18n("Forward"), this);
1107 monitorSeekForward->setShortcut(Qt::Key_L);
1108 collection->addAction("monitor_seek_forward", monitorSeekForward);
1109 connect(monitorSeekForward, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotForward()));
1111 KAction* clipStart = new KAction(KIcon("media-seek-backward"), i18n("Go to Clip Start"), this);
1112 clipStart->setShortcut(Qt::Key_Home);
1113 collection->addAction("seek_clip_start", clipStart);
1114 connect(clipStart, SIGNAL(triggered(bool)), this, SLOT(slotClipStart()));
1116 KAction* clipEnd = new KAction(KIcon("media-seek-forward"), i18n("Go to Clip End"), this);
1117 clipEnd->setShortcut(Qt::Key_End);
1118 collection->addAction("seek_clip_end", clipEnd);
1119 connect(clipEnd, SIGNAL(triggered(bool)), this, SLOT(slotClipEnd()));
1121 KAction* zoneStart = new KAction(KIcon("media-seek-backward"), i18n("Go to Zone Start"), this);
1122 zoneStart->setShortcut(Qt::SHIFT + Qt::Key_I);
1123 collection->addAction("seek_zone_start", zoneStart);
1124 connect(zoneStart, SIGNAL(triggered(bool)), this, SLOT(slotZoneStart()));
1126 KAction* zoneEnd = new KAction(KIcon("media-seek-forward"), i18n("Go to Zone End"), this);
1127 zoneEnd->setShortcut(Qt::SHIFT + Qt::Key_O);
1128 collection->addAction("seek_zone_end", zoneEnd);
1129 connect(zoneEnd, SIGNAL(triggered(bool)), this, SLOT(slotZoneEnd()));
1131 KAction* projectStart = new KAction(KIcon("go-first"), i18n("Go to Project Start"), this);
1132 projectStart->setShortcut(Qt::CTRL + Qt::Key_Home);
1133 collection->addAction("seek_start", projectStart);
1134 connect(projectStart, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotStart()));
1136 KAction* projectEnd = new KAction(KIcon("go-last"), i18n("Go to Project End"), this);
1137 projectEnd->setShortcut(Qt::CTRL + Qt::Key_End);
1138 collection->addAction("seek_end", projectEnd);
1139 connect(projectEnd, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotEnd()));
1141 KAction* monitorSeekForwardOneFrame = new KAction(KIcon("media-skip-forward"), i18n("Forward 1 Frame"), this);
1142 monitorSeekForwardOneFrame->setShortcut(Qt::Key_Right);
1143 collection->addAction("monitor_seek_forward-one-frame", monitorSeekForwardOneFrame);
1144 connect(monitorSeekForwardOneFrame, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotForwardOneFrame()));
1146 KAction* monitorSeekForwardOneSecond = new KAction(KIcon("media-skip-forward"), i18n("Forward 1 Second"), this);
1147 monitorSeekForwardOneSecond->setShortcut(Qt::SHIFT + Qt::Key_Right);
1148 collection->addAction("monitor_seek_forward-one-second", monitorSeekForwardOneSecond);
1149 connect(monitorSeekForwardOneSecond, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotForwardOneSecond()));
1151 KAction* monitorSeekSnapForward = new KAction(KIcon("media-seek-forward"), i18n("Go to Next Snap Point"), this);
1152 monitorSeekSnapForward->setShortcut(Qt::ALT + Qt::Key_Right);
1153 collection->addAction("monitor_seek_snap_forward", monitorSeekSnapForward);
1154 connect(monitorSeekSnapForward, SIGNAL(triggered(bool)), this, SLOT(slotSnapForward()));
1156 KAction* deleteItem = new KAction(KIcon("edit-delete"), i18n("Delete Selected Item"), this);
1157 deleteItem->setShortcut(Qt::Key_Delete);
1158 collection->addAction("delete_timeline_clip", deleteItem);
1159 connect(deleteItem, SIGNAL(triggered(bool)), this, SLOT(slotDeleteItem()));
1161 /*KAction* editTimelineClipSpeed = new KAction(i18n("Change Clip Speed"), this);
1162 collection->addAction("change_clip_speed", editTimelineClipSpeed);
1163 editTimelineClipSpeed->setData("change_speed");
1164 connect(editTimelineClipSpeed, SIGNAL(triggered(bool)), this, SLOT(slotChangeClipSpeed()));*/
1166 KAction *stickTransition = collection->addAction("auto_transition");
1167 stickTransition->setData(QString("auto"));
1168 stickTransition->setCheckable(true);
1169 stickTransition->setEnabled(false);
1170 stickTransition->setText(i18n("Automatic Transition"));
1171 connect(stickTransition, SIGNAL(triggered(bool)), this, SLOT(slotAutoTransition()));
1173 KAction* groupClip = new KAction(KIcon("object-group"), i18n("Group Clips"), this);
1174 groupClip->setShortcut(Qt::CTRL + Qt::Key_G);
1175 collection->addAction("group_clip", groupClip);
1176 connect(groupClip, SIGNAL(triggered(bool)), this, SLOT(slotGroupClips()));
1178 KAction* ungroupClip = new KAction(KIcon("object-ungroup"), i18n("Ungroup Clips"), this);
1179 collection->addAction("ungroup_clip", ungroupClip);
1180 ungroupClip->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_G);
1181 ungroupClip->setData("ungroup_clip");
1182 connect(ungroupClip, SIGNAL(triggered(bool)), this, SLOT(slotUnGroupClips()));
1184 KAction* editItemDuration = new KAction(KIcon("measure"), i18n("Edit Duration"), this);
1185 collection->addAction("edit_item_duration", editItemDuration);
1186 connect(editItemDuration, SIGNAL(triggered(bool)), this, SLOT(slotEditItemDuration()));
1188 KAction* clipInProjectTree = new KAction(KIcon("go-jump-definition"), i18n("Clip in Project Tree"), this);
1189 collection->addAction("clip_in_project_tree", clipInProjectTree);
1190 connect(clipInProjectTree, SIGNAL(triggered(bool)), this, SLOT(slotClipInProjectTree()));
1192 /*KAction* clipToProjectTree = new KAction(KIcon("go-jump-definition"), i18n("Add Clip to Project Tree"), this);
1193 collection->addAction("clip_to_project_tree", clipToProjectTree);
1194 connect(clipToProjectTree, SIGNAL(triggered(bool)), this, SLOT(slotClipToProjectTree()));*/
1196 KAction* insertOvertwrite = new KAction(KIcon(), i18n("Insert Clip Zone in Timeline (Overwrite)"), this);
1197 insertOvertwrite->setShortcut(Qt::Key_V);
1198 collection->addAction("overwrite_to_in_point", insertOvertwrite);
1199 connect(insertOvertwrite, SIGNAL(triggered(bool)), this, SLOT(slotInsertClipOverwrite()));
1201 KAction* selectTimelineClip = new KAction(KIcon("edit-select"), i18n("Select Clip"), this);
1202 selectTimelineClip->setShortcut(Qt::Key_Plus);
1203 collection->addAction("select_timeline_clip", selectTimelineClip);
1204 connect(selectTimelineClip, SIGNAL(triggered(bool)), this, SLOT(slotSelectTimelineClip()));
1206 KAction* deselectTimelineClip = new KAction(KIcon("edit-select"), i18n("Deselect Clip"), this);
1207 deselectTimelineClip->setShortcut(Qt::Key_Minus);
1208 collection->addAction("deselect_timeline_clip", deselectTimelineClip);
1209 connect(deselectTimelineClip, SIGNAL(triggered(bool)), this, SLOT(slotDeselectTimelineClip()));
1211 KAction* selectAddTimelineClip = new KAction(KIcon("edit-select"), i18n("Add Clip To Selection"), this);
1212 selectAddTimelineClip->setShortcut(Qt::ALT + Qt::Key_Plus);
1213 collection->addAction("select_add_timeline_clip", selectAddTimelineClip);
1214 connect(selectAddTimelineClip, SIGNAL(triggered(bool)), this, SLOT(slotSelectAddTimelineClip()));
1216 KAction* selectTimelineTransition = new KAction(KIcon("edit-select"), i18n("Select Transition"), this);
1217 selectTimelineTransition->setShortcut(Qt::SHIFT + Qt::Key_Plus);
1218 collection->addAction("select_timeline_transition", selectTimelineTransition);
1219 connect(selectTimelineTransition, SIGNAL(triggered(bool)), this, SLOT(slotSelectTimelineTransition()));
1221 KAction* deselectTimelineTransition = new KAction(KIcon("edit-select"), i18n("Deselect Transition"), this);
1222 deselectTimelineTransition->setShortcut(Qt::SHIFT + Qt::Key_Minus);
1223 collection->addAction("deselect_timeline_transition", deselectTimelineTransition);
1224 connect(deselectTimelineTransition, SIGNAL(triggered(bool)), this, SLOT(slotDeselectTimelineTransition()));
1226 KAction* selectAddTimelineTransition = new KAction(KIcon("edit-select"), i18n("Add Transition To Selection"), this);
1227 selectAddTimelineTransition->setShortcut(Qt::ALT + Qt::SHIFT + Qt::Key_Plus);
1228 collection->addAction("select_add_timeline_transition", selectAddTimelineTransition);
1229 connect(selectAddTimelineTransition, SIGNAL(triggered(bool)), this, SLOT(slotSelectAddTimelineTransition()));
1231 KAction* cutTimelineClip = new KAction(KIcon("edit-cut"), i18n("Cut Clip"), this);
1232 cutTimelineClip->setShortcut(Qt::SHIFT + Qt::Key_R);
1233 collection->addAction("cut_timeline_clip", cutTimelineClip);
1234 connect(cutTimelineClip, SIGNAL(triggered(bool)), this, SLOT(slotCutTimelineClip()));
1236 KAction* addClipMarker = new KAction(KIcon("bookmark-new"), i18n("Add Marker"), this);
1237 collection->addAction("add_clip_marker", addClipMarker);
1238 connect(addClipMarker, SIGNAL(triggered(bool)), this, SLOT(slotAddClipMarker()));
1240 KAction* deleteClipMarker = new KAction(KIcon("edit-delete"), i18n("Delete Marker"), this);
1241 collection->addAction("delete_clip_marker", deleteClipMarker);
1242 connect(deleteClipMarker, SIGNAL(triggered(bool)), this, SLOT(slotDeleteClipMarker()));
1244 KAction* deleteAllClipMarkers = new KAction(KIcon("edit-delete"), i18n("Delete All Markers"), this);
1245 collection->addAction("delete_all_clip_markers", deleteAllClipMarkers);
1246 connect(deleteAllClipMarkers, SIGNAL(triggered(bool)), this, SLOT(slotDeleteAllClipMarkers()));
1248 KAction* editClipMarker = new KAction(KIcon("document-properties"), i18n("Edit Marker"), this);
1249 collection->addAction("edit_clip_marker", editClipMarker);
1250 connect(editClipMarker, SIGNAL(triggered(bool)), this, SLOT(slotEditClipMarker()));
1252 KAction* splitAudio = new KAction(KIcon("document-new"), i18n("Split Audio"), this);
1253 collection->addAction("split_audio", splitAudio);
1254 connect(splitAudio, SIGNAL(triggered(bool)), this, SLOT(slotSplitAudio()));
1256 KAction* audioOnly = new KAction(KIcon("document-new"), i18n("Audio Only"), this);
1257 collection->addAction("clip_audio_only", audioOnly);
1258 audioOnly->setData("clip_audio_only");
1259 audioOnly->setCheckable(true);
1261 KAction* videoOnly = new KAction(KIcon("document-new"), i18n("Video Only"), this);
1262 collection->addAction("clip_video_only", videoOnly);
1263 videoOnly->setData("clip_video_only");
1264 videoOnly->setCheckable(true);
1266 KAction* audioAndVideo = new KAction(KIcon("document-new"), i18n("Audio and Video"), this);
1267 collection->addAction("clip_audio_and_video", audioAndVideo);
1268 audioAndVideo->setData("clip_audio_and_video");
1269 audioAndVideo->setCheckable(true);
1271 m_clipTypeGroup = new QActionGroup(this);
1272 m_clipTypeGroup->addAction(audioOnly);
1273 m_clipTypeGroup->addAction(videoOnly);
1274 m_clipTypeGroup->addAction(audioAndVideo);
1275 connect(m_clipTypeGroup, SIGNAL(triggered(QAction *)), this, SLOT(slotUpdateClipType(QAction *)));
1276 m_clipTypeGroup->setEnabled(false);
1278 KAction *insertSpace = new KAction(KIcon(), i18n("Insert Space"), this);
1279 collection->addAction("insert_space", insertSpace);
1280 connect(insertSpace, SIGNAL(triggered()), this, SLOT(slotInsertSpace()));
1282 KAction *removeSpace = new KAction(KIcon(), i18n("Remove Space"), this);
1283 collection->addAction("delete_space", removeSpace);
1284 connect(removeSpace, SIGNAL(triggered()), this, SLOT(slotRemoveSpace()));
1286 KAction *insertTrack = new KAction(KIcon(), i18n("Insert Track"), this);
1287 collection->addAction("insert_track", insertTrack);
1288 connect(insertTrack, SIGNAL(triggered()), this, SLOT(slotInsertTrack()));
1290 KAction *deleteTrack = new KAction(KIcon(), i18n("Delete Track"), this);
1291 collection->addAction("delete_track", deleteTrack);
1292 connect(deleteTrack, SIGNAL(triggered()), this, SLOT(slotDeleteTrack()));
1294 KAction *configTracks = new KAction(KIcon("configure"), i18n("Configure Tracks"), this);
1295 collection->addAction("config_tracks", configTracks);
1296 connect(configTracks, SIGNAL(triggered()), this, SLOT(slotConfigTrack()));
1298 KAction *addGuide = new KAction(KIcon("document-new"), i18n("Add Guide"), this);
1299 collection->addAction("add_guide", addGuide);
1300 connect(addGuide, SIGNAL(triggered()), this, SLOT(slotAddGuide()));
1302 QAction *delGuide = new KAction(KIcon("edit-delete"), i18n("Delete Guide"), this);
1303 collection->addAction("delete_guide", delGuide);
1304 connect(delGuide, SIGNAL(triggered()), this, SLOT(slotDeleteGuide()));
1306 QAction *editGuide = new KAction(KIcon("document-properties"), i18n("Edit Guide"), this);
1307 collection->addAction("edit_guide", editGuide);
1308 connect(editGuide, SIGNAL(triggered()), this, SLOT(slotEditGuide()));
1310 QAction *delAllGuides = new KAction(KIcon("edit-delete"), i18n("Delete All Guides"), this);
1311 collection->addAction("delete_all_guides", delAllGuides);
1312 connect(delAllGuides, SIGNAL(triggered()), this, SLOT(slotDeleteAllGuides()));
1314 QAction *pasteEffects = new KAction(KIcon("edit-paste"), i18n("Paste Effects"), this);
1315 collection->addAction("paste_effects", pasteEffects);
1316 pasteEffects->setData("paste_effects");
1317 connect(pasteEffects , SIGNAL(triggered()), this, SLOT(slotPasteEffects()));
1319 QAction *showTimeline = new KAction(i18n("Show Timeline"), this);
1320 collection->addAction("show_timeline", showTimeline);
1321 showTimeline->setCheckable(true);
1322 showTimeline->setChecked(true);
1323 connect(showTimeline, SIGNAL(triggered(bool)), this, SLOT(slotShowTimeline(bool)));
1325 QAction *showTitleBar = new KAction(i18n("Show Title Bars"), this);
1326 collection->addAction("show_titlebars", showTitleBar);
1327 showTitleBar->setCheckable(true);
1328 connect(showTitleBar, SIGNAL(triggered(bool)), this, SLOT(slotShowTitleBars(bool)));
1329 showTitleBar->setChecked(KdenliveSettings::showtitlebars());
1330 slotShowTitleBars(KdenliveSettings::showtitlebars());
1332 /*QAction *maxCurrent = new KAction(i18n("Maximize Current Widget"), this);
1333 collection->addAction("maximize_current", maxCurrent);
1334 maxCurrent->setCheckable(true);
1335 maxCurrent->setChecked(false);
1336 connect(maxCurrent, SIGNAL(triggered(bool)), this, SLOT(slotMaximizeCurrent(bool)));*/
1338 m_closeAction = KStandardAction::close(this, SLOT(closeCurrentDocument()), collection);
1339 KStandardAction::quit(this, SLOT(queryQuit()), collection);
1340 KStandardAction::open(this, SLOT(openFile()), collection);
1341 m_saveAction = KStandardAction::save(this, SLOT(saveFile()), collection);
1342 KStandardAction::saveAs(this, SLOT(saveFileAs()), collection);
1343 KStandardAction::openNew(this, SLOT(newFile()), collection);
1344 // TODO: make the following connection to slotEditKeys work
1345 KStandardAction::keyBindings(this, SLOT(slotEditKeys()), collection);
1346 KStandardAction::preferences(this, SLOT(slotPreferences()), collection);
1347 KStandardAction::configureNotifications(this, SLOT(configureNotifications()), collection);
1348 KStandardAction::copy(this, SLOT(slotCopy()), collection);
1349 KStandardAction::paste(this, SLOT(slotPaste()), collection);
1350 KStandardAction::fullScreen(this, SLOT(slotFullScreen()), this, collection);
1352 KAction *undo = KStandardAction::undo(m_commandStack, SLOT(undo()), collection);
1353 undo->setEnabled(false);
1354 connect(m_commandStack, SIGNAL(canUndoChanged(bool)), undo, SLOT(setEnabled(bool)));
1356 KAction *redo = KStandardAction::redo(m_commandStack, SLOT(redo()), collection);
1357 redo->setEnabled(false);
1358 connect(m_commandStack, SIGNAL(canRedoChanged(bool)), redo, SLOT(setEnabled(bool)));
1361 //TODO: Add status tooltip to actions ?
1362 connect(collection, SIGNAL(actionHovered(QAction*)),
1363 this, SLOT(slotDisplayActionMessage(QAction*)));*/
1366 QAction *addClip = new KAction(KIcon("kdenlive-add-clip"), i18n("Add Clip"), this);
1367 collection->addAction("add_clip", addClip);
1368 connect(addClip , SIGNAL(triggered()), m_projectList, SLOT(slotAddClip()));
1370 QAction *addColorClip = new KAction(KIcon("kdenlive-add-color-clip"), i18n("Add Color Clip"), this);
1371 collection->addAction("add_color_clip", addColorClip);
1372 connect(addColorClip , SIGNAL(triggered()), m_projectList, SLOT(slotAddColorClip()));
1374 QAction *addSlideClip = new KAction(KIcon("kdenlive-add-slide-clip"), i18n("Add Slideshow Clip"), this);
1375 collection->addAction("add_slide_clip", addSlideClip);
1376 connect(addSlideClip , SIGNAL(triggered()), m_projectList, SLOT(slotAddSlideshowClip()));
1378 QAction *addTitleClip = new KAction(KIcon("kdenlive-add-text-clip"), i18n("Add Title Clip"), this);
1379 collection->addAction("add_text_clip", addTitleClip);
1380 connect(addTitleClip , SIGNAL(triggered()), m_projectList, SLOT(slotAddTitleClip()));
1382 QAction *addTitleTemplateClip = new KAction(KIcon("kdenlive-add-text-clip"), i18n("Add Template Title"), this);
1383 collection->addAction("add_text_template_clip", addTitleTemplateClip);
1384 connect(addTitleTemplateClip , SIGNAL(triggered()), m_projectList, SLOT(slotAddTitleTemplateClip()));
1386 QAction *addFolderButton = new KAction(KIcon("folder-new"), i18n("Create Folder"), this);
1387 collection->addAction("add_folder", addFolderButton);
1388 connect(addFolderButton , SIGNAL(triggered()), m_projectList, SLOT(slotAddFolder()));
1390 QAction *clipProperties = new KAction(KIcon("document-edit"), i18n("Clip Properties"), this);
1391 collection->addAction("clip_properties", clipProperties);
1392 clipProperties->setData("clip_properties");
1393 connect(clipProperties , SIGNAL(triggered()), m_projectList, SLOT(slotEditClip()));
1394 clipProperties->setEnabled(false);
1396 QAction *openClip = new KAction(KIcon("document-open"), i18n("Edit Clip"), this);
1397 collection->addAction("edit_clip", openClip);
1398 openClip->setData("edit_clip");
1399 connect(openClip , SIGNAL(triggered()), m_projectList, SLOT(slotOpenClip()));
1400 openClip->setEnabled(false);
1402 QAction *deleteClip = new KAction(KIcon("edit-delete"), i18n("Delete Clip"), this);
1403 collection->addAction("delete_clip", deleteClip);
1404 deleteClip->setData("delete_clip");
1405 connect(deleteClip , SIGNAL(triggered()), m_projectList, SLOT(slotRemoveClip()));
1406 deleteClip->setEnabled(false);
1408 QAction *reloadClip = new KAction(KIcon("view-refresh"), i18n("Reload Clip"), this);
1409 collection->addAction("reload_clip", reloadClip);
1410 reloadClip->setData("reload_clip");
1411 connect(reloadClip , SIGNAL(triggered()), m_projectList, SLOT(slotReloadClip()));
1412 reloadClip->setEnabled(false);
1414 QMenu *addClips = new QMenu();
1415 addClips->addAction(addClip);
1416 addClips->addAction(addColorClip);
1417 addClips->addAction(addSlideClip);
1418 addClips->addAction(addTitleClip);
1419 addClips->addAction(addTitleTemplateClip);
1420 addClips->addAction(addFolderButton);
1422 addClips->addAction(reloadClip);
1423 addClips->addAction(clipProperties);
1424 addClips->addAction(openClip);
1425 addClips->addAction(deleteClip);
1426 m_projectList->setupMenu(addClips, addClip);
1428 // Setup effects and transitions actions.
1429 m_effectsActionCollection = new KActionCollection(this, KGlobal::mainComponent());
1430 //KActionCategory *videoEffectActions = new KActionCategory(i18n("Video Effects"), m_effectsActionCollection);
1431 KActionCategory *videoEffectActions = new KActionCategory(i18n("Video Effects"), collection);
1432 m_videoEffects = new KAction*[videoEffects.count()];
1433 for (int i = 0; i < videoEffects.count(); ++i) {
1434 QStringList effectInfo = videoEffects.effectIdInfo(i);
1435 m_videoEffects[i] = new KAction(KIcon("kdenlive-show-video"), effectInfo.at(0), this);
1436 m_videoEffects[i]->setData(effectInfo);
1437 m_videoEffects[i]->setIconVisibleInMenu(false);
1438 videoEffectActions->addAction("video_effect_" + effectInfo.at(0), m_videoEffects[i]);
1440 //KActionCategory *audioEffectActions = new KActionCategory(i18n("Audio Effects"), m_effectsActionCollection);
1441 KActionCategory *audioEffectActions = new KActionCategory(i18n("Audio Effects"), collection);
1442 m_audioEffects = new KAction*[audioEffects.count()];
1443 for (int i = 0; i < audioEffects.count(); ++i) {
1444 QStringList effectInfo = audioEffects.effectIdInfo(i);
1445 m_audioEffects[i] = new KAction(KIcon("kdenlive-show-audio"), effectInfo.at(0), this);
1446 m_audioEffects[i]->setData(effectInfo);
1447 m_audioEffects[i]->setIconVisibleInMenu(false);
1448 audioEffectActions->addAction("audio_effect_" + effectInfo.at(0), m_audioEffects[i]);
1450 //KActionCategory *customEffectActions = new KActionCategory(i18n("Custom Effects"), m_effectsActionCollection);
1451 KActionCategory *customEffectActions = new KActionCategory(i18n("Custom Effects"), collection);
1452 m_customEffects = new KAction*[customEffects.count()];
1453 for (int i = 0; i < customEffects.count(); ++i) {
1454 QStringList effectInfo = customEffects.effectIdInfo(i);
1455 m_customEffects[i] = new KAction(KIcon("kdenlive-custom-effect"), effectInfo.at(0), this);
1456 m_customEffects[i]->setData(effectInfo);
1457 m_customEffects[i]->setIconVisibleInMenu(false);
1458 customEffectActions->addAction("custom_effect_" + effectInfo.at(0), m_customEffects[i]);
1460 //KActionCategory *transitionActions = new KActionCategory(i18n("Transitions"), m_effectsActionCollection);
1461 KActionCategory *transitionActions = new KActionCategory(i18n("Transitions"), collection);
1462 m_transitions = new KAction*[transitions.count()];
1463 for (int i = 0; i < transitions.count(); i++) {
1464 QStringList effectInfo = transitions.effectIdInfo(i);
1465 m_transitions[i] = new KAction(effectInfo.at(0), this);
1466 m_transitions[i]->setData(effectInfo);
1467 m_transitions[i]->setIconVisibleInMenu(false);
1468 transitionActions->addAction("transition_" + effectInfo.at(0), m_transitions[i]);
1470 m_effectsActionCollection->readSettings();
1472 //connect(collection, SIGNAL( clearStatusText() ),
1473 //statusBar(), SLOT( clear() ) );
1476 void MainWindow::slotDisplayActionMessage(QAction *a)
1478 statusBar()->showMessage(a->data().toString(), 3000);
1481 void MainWindow::saveOptions()
1483 KdenliveSettings::self()->writeConfig();
1484 KSharedConfigPtr config = KGlobal::config();
1485 m_fileOpenRecent->saveEntries(KConfigGroup(config, "Recent Files"));
1486 KConfigGroup treecolumns(config, "Project Tree");
1487 treecolumns.writeEntry("columns", m_projectList->headerInfo());
1491 void MainWindow::readOptions()
1493 KSharedConfigPtr config = KGlobal::config();
1494 m_fileOpenRecent->loadEntries(KConfigGroup(config, "Recent Files"));
1495 KConfigGroup initialGroup(config, "version");
1496 bool upgrade = false;
1497 if (initialGroup.exists()) {
1498 if (initialGroup.readEntry("version", QString()).section(' ', 0, 0) != QString(version).section(' ', 0, 0)) {
1502 if (initialGroup.readEntry("version") == "0.7") {
1503 //Add new settings from 0.7.1
1504 if (KdenliveSettings::defaultprojectfolder().isEmpty()) {
1505 QString path = QDir::homePath() + "/kdenlive";
1506 if (KStandardDirs::makeDir(path) == false) {
1507 kDebug() << "/// ERROR CREATING PROJECT FOLDER: " << path;
1508 } else KdenliveSettings::setDefaultprojectfolder(path);
1514 if (!initialGroup.exists() || upgrade) {
1515 // this is our first run, show Wizard
1516 Wizard *w = new Wizard(upgrade, this);
1517 if (w->exec() == QDialog::Accepted && w->isOk()) {
1518 w->adjustSettings();
1519 initialGroup.writeEntry("version", version);
1525 KConfigGroup treecolumns(config, "Project Tree");
1526 const QByteArray state = treecolumns.readEntry("columns", QByteArray());
1527 if (!state.isEmpty())
1528 m_projectList->setHeaderInfo(state);
1531 void MainWindow::slotRunWizard()
1533 Wizard *w = new Wizard(false, this);
1534 if (w->exec() == QDialog::Accepted && w->isOk()) {
1535 w->adjustSettings();
1540 void MainWindow::newFile(bool showProjectSettings, bool force)
1542 if (!m_timelineArea->isEnabled() && !force) return;
1543 m_fileRevert->setEnabled(false);
1544 QString profileName;
1546 QPoint projectTracks(KdenliveSettings::videotracks(), KdenliveSettings::audiotracks());
1547 if (!showProjectSettings) {
1548 if (!KdenliveSettings::activatetabs()) closeCurrentDocument();
1549 profileName = KdenliveSettings::default_profile();
1550 projectFolder = KdenliveSettings::defaultprojectfolder();
1552 ProjectSettings *w = new ProjectSettings(NULL, QStringList(), projectTracks.x(), projectTracks.y(), KdenliveSettings::defaultprojectfolder(), false, true, this);
1553 if (w->exec() != QDialog::Accepted) return;
1554 if (!KdenliveSettings::activatetabs()) closeCurrentDocument();
1555 if (KdenliveSettings::videothumbnails() != w->enableVideoThumbs()) slotSwitchVideoThumbs();
1556 if (KdenliveSettings::audiothumbnails() != w->enableAudioThumbs()) slotSwitchAudioThumbs();
1557 profileName = w->selectedProfile();
1558 projectFolder = w->selectedFolder();
1559 projectTracks = w->tracks();
1562 m_timelineArea->setEnabled(true);
1563 m_projectList->setEnabled(true);
1564 KdenliveDoc *doc = new KdenliveDoc(KUrl(), projectFolder, m_commandStack, profileName, projectTracks, m_projectMonitor->render, this);
1565 doc->m_autosave = new KAutoSaveFile(KUrl(), doc);
1567 TrackView *trackView = new TrackView(doc, &ok, this);
1568 m_timelineArea->addTab(trackView, KIcon("kdenlive"), doc->description());
1571 //m_timelineArea->setEnabled(false);
1572 //m_projectList->setEnabled(false);
1576 if (m_timelineArea->count() == 1) {
1577 connectDocumentInfo(doc);
1578 connectDocument(trackView, doc);
1579 } else m_timelineArea->setTabBarHidden(false);
1580 m_monitorManager->activateMonitor("clip");
1581 m_closeAction->setEnabled(m_timelineArea->count() > 1);
1584 void MainWindow::activateDocument()
1586 if (m_timelineArea->currentWidget() == NULL || !m_timelineArea->isEnabled()) return;
1587 TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
1588 KdenliveDoc *currentDoc = currentTab->document();
1589 connectDocumentInfo(currentDoc);
1590 connectDocument(currentTab, currentDoc);
1593 void MainWindow::closeCurrentDocument(bool saveChanges)
1595 QWidget *w = m_timelineArea->currentWidget();
1597 // closing current document
1598 int ix = m_timelineArea->currentIndex() + 1;
1599 if (ix == m_timelineArea->count()) ix = 0;
1600 m_timelineArea->setCurrentIndex(ix);
1601 TrackView *tabToClose = (TrackView *) w;
1602 KdenliveDoc *docToClose = tabToClose->document();
1603 if (docToClose && docToClose->isModified() && saveChanges) {
1605 if (m_activeDocument->url().fileName().isEmpty())
1606 message = i18n("Save changes to document?");
1608 message = i18n("The project <b>\"%1\"</b> has been changed.\nDo you want to save your changes?").arg(m_activeDocument->url().fileName());
1609 switch (KMessageBox::warningYesNoCancel(this, message)) {
1610 case KMessageBox::Yes :
1611 // save document here. If saving fails, return false;
1612 if (saveFile() == false) return;
1614 case KMessageBox::Cancel :
1621 m_clipMonitor->slotSetXml(NULL);
1622 m_timelineArea->removeTab(m_timelineArea->indexOf(w));
1623 if (m_timelineArea->count() == 1) {
1624 m_timelineArea->setTabBarHidden(true);
1625 m_closeAction->setEnabled(false);
1627 if (docToClose == m_activeDocument) {
1628 delete m_activeDocument;
1629 m_activeDocument = NULL;
1630 m_effectStack->clear();
1631 m_transitionConfig->slotTransitionItemSelected(NULL, 0, QPoint(), false);
1635 if (w == m_activeTimeline) {
1636 delete m_activeTimeline;
1637 m_activeTimeline = NULL;
1643 bool MainWindow::saveFileAs(const QString &outputFileName)
1645 QString currentSceneList;
1646 m_monitorManager->stopActiveMonitor();
1647 if (KdenliveSettings::dropbframes()) {
1648 KdenliveSettings::setDropbframes(false);
1649 m_activeDocument->clipManager()->updatePreviewSettings();
1650 currentSceneList = m_projectMonitor->sceneList();
1651 KdenliveSettings::setDropbframes(true);
1652 m_activeDocument->clipManager()->updatePreviewSettings();
1653 } else currentSceneList = m_projectMonitor->sceneList();
1655 if (m_activeDocument->saveSceneList(outputFileName, currentSceneList) == false)
1658 // Save timeline thumbnails
1659 m_activeTimeline->projectView()->saveThumbnails();
1660 m_activeDocument->setUrl(KUrl(outputFileName));
1661 if (m_activeDocument->m_autosave == NULL) {
1662 m_activeDocument->m_autosave = new KAutoSaveFile(KUrl(outputFileName), this);
1663 } else m_activeDocument->m_autosave->setManagedFile(KUrl(outputFileName));
1664 setCaption(m_activeDocument->description());
1665 m_timelineArea->setTabText(m_timelineArea->currentIndex(), m_activeDocument->description());
1666 m_timelineArea->setTabToolTip(m_timelineArea->currentIndex(), m_activeDocument->url().path());
1667 m_activeDocument->setModified(false);
1668 m_fileOpenRecent->addUrl(KUrl(outputFileName));
1669 m_fileRevert->setEnabled(true);
1673 bool MainWindow::saveFileAs()
1675 QString outputFile = KFileDialog::getSaveFileName(KUrl(), getMimeType());
1676 if (outputFile.isEmpty()) return false;
1677 if (QFile::exists(outputFile)) {
1678 // Show the file dialog again if the user does not want to overwrite the file
1679 if (KMessageBox::questionYesNo(this, i18n("File already exists.\nDo you want to overwrite it?")) == KMessageBox::No)
1680 return saveFileAs();
1682 return saveFileAs(outputFile);
1685 bool MainWindow::saveFile()
1687 if (!m_activeDocument) return true;
1688 if (m_activeDocument->url().isEmpty()) {
1689 return saveFileAs();
1691 bool result = saveFileAs(m_activeDocument->url().path());
1692 m_activeDocument->m_autosave->resize(0);
1697 void MainWindow::openFile()
1699 if (!m_startUrl.isEmpty()) {
1700 openFile(m_startUrl);
1701 m_startUrl = KUrl();
1704 KUrl url = KFileDialog::getOpenUrl(KUrl("kfiledialog:///projectfolder"), getMimeType());
1705 if (url.isEmpty()) return;
1706 m_fileOpenRecent->addUrl(url);
1710 void MainWindow::openLastFile()
1712 KSharedConfigPtr config = KGlobal::config();
1713 KUrl::List urls = m_fileOpenRecent->urls();
1714 //WARNING: this is buggy, we get a random url, not the last one. Bug in KRecentFileAction?
1715 if (urls.isEmpty()) newFile(false);
1716 else openFile(urls.last());
1719 void MainWindow::openFile(const KUrl &url)
1721 // Check if the document is already opened
1722 const int ct = m_timelineArea->count();
1723 bool isOpened = false;
1725 for (i = 0; i < ct; i++) {
1726 TrackView *tab = (TrackView *) m_timelineArea->widget(i);
1727 KdenliveDoc *doc = tab->document();
1728 if (doc->url() == url) {
1734 m_timelineArea->setCurrentIndex(i);
1738 // Check for backup file
1739 QList<KAutoSaveFile *> staleFiles = KAutoSaveFile::staleFiles(url);
1740 if (!staleFiles.isEmpty()) {
1741 if (KMessageBox::questionYesNo(this,
1742 i18n("Auto-saved files exist. Do you want to recover them now?"),
1743 i18n("File Recovery"),
1744 KGuiItem(i18n("Recover")), KGuiItem(i18n("Don't recover"))) == KMessageBox::Yes) {
1745 recoverFiles(staleFiles);
1748 // remove the stale files
1749 foreach(KAutoSaveFile *stale, staleFiles) {
1750 stale->open(QIODevice::ReadWrite);
1755 if (!KdenliveSettings::activatetabs()) closeCurrentDocument();
1756 m_messageLabel->setMessage(i18n("Opening file %1", url.path()), InformationMessage);
1757 m_messageLabel->repaint();
1758 doOpenFile(url, NULL);
1761 void MainWindow::doOpenFile(const KUrl &url, KAutoSaveFile *stale)
1763 if (!m_timelineArea->isEnabled()) return;
1764 m_fileRevert->setEnabled(true);
1765 KdenliveDoc *doc = new KdenliveDoc(url, KdenliveSettings::defaultprojectfolder(), m_commandStack, KdenliveSettings::default_profile(), QPoint(KdenliveSettings::videotracks(), KdenliveSettings::audiotracks()), m_projectMonitor->render, this);
1766 if (stale == NULL) {
1767 stale = new KAutoSaveFile(url, doc);
1768 doc->m_autosave = stale;
1770 doc->m_autosave = stale;
1771 doc->setUrl(stale->managedFile());
1772 doc->setModified(true);
1773 stale->setParent(doc);
1775 connectDocumentInfo(doc);
1777 TrackView *trackView = new TrackView(doc, &ok, this);
1778 m_timelineArea->setCurrentIndex(m_timelineArea->addTab(trackView, KIcon("kdenlive"), doc->description()));
1780 m_timelineArea->setEnabled(false);
1781 m_projectList->setEnabled(false);
1782 KMessageBox::sorry(this, i18n("Cannot open file %1.\nProject is corrupted.", url.path()));
1783 slotGotProgressInfo(QString(), -1);
1784 newFile(false, true);
1787 m_timelineArea->setTabToolTip(m_timelineArea->currentIndex(), doc->url().path());
1788 trackView->setDuration(trackView->duration());
1789 trackView->projectView()->initCursorPos(m_projectMonitor->render->seekPosition().frames(doc->fps()));
1791 if (m_timelineArea->count() > 1) m_timelineArea->setTabBarHidden(false);
1792 slotGotProgressInfo(QString(), -1);
1793 m_projectMonitor->adjustRulerSize(trackView->duration());
1794 m_projectMonitor->slotZoneMoved(trackView->inPoint(), trackView->outPoint());
1795 m_clipMonitor->refreshMonitor(true);
1798 void MainWindow::recoverFiles(QList<KAutoSaveFile *> staleFiles)
1800 if (!KdenliveSettings::activatetabs()) closeCurrentDocument();
1801 foreach(KAutoSaveFile *stale, staleFiles) {
1802 /*if (!stale->open(QIODevice::QIODevice::ReadOnly)) {
1803 // show an error message; we could not steal the lockfile
1804 // maybe another application got to the file before us?
1808 kDebug() << "// OPENING RECOVERY: " << stale->fileName() << "\nMANAGED: " << stale->managedFile().path();
1809 // the stalefiles also contain ".lock" files so we must ignore them... bug in KAutoSaveFile?
1810 if (!stale->fileName().endsWith(".lock")) doOpenFile(KUrl(stale->fileName()), stale);
1811 else KIO::NetAccess::del(KUrl(stale->fileName()), this);
1815 void MainWindow::parseProfiles(const QString &mltPath)
1817 //KdenliveSettings::setDefaulttmpfolder();
1818 if (!mltPath.isEmpty()) {
1819 KdenliveSettings::setMltpath(mltPath + "/share/mlt/profiles/");
1820 KdenliveSettings::setRendererpath(mltPath + "/bin/melt");
1823 if (KdenliveSettings::mltpath().isEmpty())
1824 KdenliveSettings::setMltpath(QString(MLT_PREFIX) + QString("/share/mlt/profiles/"));
1826 if (KdenliveSettings::rendererpath().isEmpty() || KdenliveSettings::rendererpath().endsWith("inigo")) {
1827 QString meltPath = QString(MLT_PREFIX) + QString("/bin/melt");
1828 if (!QFile::exists(meltPath))
1829 meltPath = KStandardDirs::findExe("melt");
1830 KdenliveSettings::setRendererpath(meltPath);
1833 if (KdenliveSettings::rendererpath().isEmpty()) {
1834 // Cannot find the MLT melt renderer, ask for location
1835 KUrlRequesterDialog *getUrl = new KUrlRequesterDialog(QString(), i18n("Cannot find the melt program required for rendering (part of MLT)"), this);
1836 if (getUrl->exec() == QDialog::Rejected) {
1839 KUrl rendererPath = getUrl->selectedUrl();
1841 if (rendererPath.isEmpty()) ::exit(0);
1842 KdenliveSettings::setRendererpath(rendererPath.path());
1845 QStringList profilesFilter;
1846 profilesFilter << "*";
1847 QStringList profilesList = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
1848 if (profilesList.isEmpty()) {
1849 // Cannot find MLT path, try finding melt
1850 QString profilePath = KdenliveSettings::rendererpath();
1851 if (!profilePath.isEmpty()) {
1852 profilePath = profilePath.section('/', 0, -3);
1853 KdenliveSettings::setMltpath(profilePath + "/share/mlt/profiles/");
1854 profilesList = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
1856 if (profilesList.isEmpty()) {
1857 // Cannot find the MLT profiles, ask for location
1858 KUrlRequesterDialog *getUrl = new KUrlRequesterDialog(KdenliveSettings::mltpath(), i18n("Cannot find your MLT profiles, please give the path"), this);
1859 getUrl->fileDialog()->setMode(KFile::Directory);
1860 if (getUrl->exec() == QDialog::Rejected) {
1863 KUrl mltPath = getUrl->selectedUrl();
1865 if (mltPath.isEmpty()) ::exit(0);
1866 KdenliveSettings::setMltpath(mltPath.path(KUrl::AddTrailingSlash));
1867 profilesList = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
1871 kDebug() << "RESULTING MLT PATH: " << KdenliveSettings::mltpath();
1873 // Parse again MLT profiles to build a list of available video formats
1874 if (profilesList.isEmpty()) parseProfiles();
1878 void MainWindow::slotEditProfiles()
1880 ProfilesDialog *w = new ProfilesDialog;
1881 if (w->exec() == QDialog::Accepted) {
1882 KdenliveSettingsDialog* d = static_cast <KdenliveSettingsDialog*>(KConfigDialog::exists("settings"));
1883 if (d) d->checkProfile();
1888 void MainWindow::slotDetectAudioDriver()
1890 /* WARNING: do not use this method because sometimes detects wrong driver (pulse instead of alsa),
1891 leading to no audio output, see bug #934 */
1893 //decide which audio driver is really best, in some cases SDL is wrong
1894 if (KdenliveSettings::audiodrivername().isEmpty()) {
1896 KProcess readProcess;
1897 //PulseAudio needs to be selected if it exists, the ALSA pulse pcm device is not fast enough.
1898 if (!KStandardDirs::findExe("pactl").isEmpty()) {
1899 readProcess.setOutputChannelMode(KProcess::OnlyStdoutChannel);
1900 readProcess.setProgram("pactl", QStringList() << "stat");
1901 readProcess.execute(2000); // Kill it after 2 seconds
1903 QString result = QString(readProcess.readAllStandardOutput());
1904 kDebug() << "// / / / / / READING PACTL: ";
1906 if (!result.isEmpty()) {
1908 kDebug() << "// / / / / PULSEAUDIO DETECTED";
1912 KdenliveSettings::setAutoaudiodrivername(driver);
1916 void MainWindow::slotEditProjectSettings()
1918 QPoint p = m_activeDocument->getTracksCount();
1919 ProjectSettings *w = new ProjectSettings(m_projectList, m_activeTimeline->projectView()->extractTransitionsLumas(), p.x(), p.y(), m_activeDocument->projectFolder().path(), true, !m_activeDocument->isModified(), this);
1921 if (w->exec() == QDialog::Accepted) {
1922 QString profile = w->selectedProfile();
1923 m_activeDocument->setProjectFolder(w->selectedFolder());
1924 if (m_renderWidget) m_renderWidget->setDocumentPath(w->selectedFolder().path(KUrl::AddTrailingSlash));
1925 if (KdenliveSettings::videothumbnails() != w->enableVideoThumbs()) slotSwitchVideoThumbs();
1926 if (KdenliveSettings::audiothumbnails() != w->enableAudioThumbs()) slotSwitchAudioThumbs();
1927 if (m_activeDocument->profilePath() != profile) {
1928 // Profile was changed
1929 double dar = m_activeDocument->dar();
1931 // Deselect current effect / transition
1932 m_effectStack->slotClipItemSelected(NULL, 0);
1933 m_transitionConfig->slotTransitionItemSelected(NULL, 0, QPoint(), false);
1934 m_clipMonitor->slotSetXml(NULL);
1935 bool updateFps = m_activeDocument->setProfilePath(profile);
1936 KdenliveSettings::setCurrent_profile(profile);
1937 KdenliveSettings::setProject_fps(m_activeDocument->fps());
1938 setCaption(m_activeDocument->description(), m_activeDocument->isModified());
1940 m_activeDocument->clipManager()->clearUnusedProducers();
1941 m_monitorManager->resetProfiles(m_activeDocument->timecode());
1943 m_transitionConfig->updateProjectFormat(m_activeDocument->mltProfile(), m_activeDocument->timecode(), m_activeDocument->tracksList());
1944 m_effectStack->updateProjectFormat(m_activeDocument->mltProfile(), m_activeDocument->timecode());
1945 m_projectList->updateProjectFormat(m_activeDocument->timecode());
1946 if (m_renderWidget) m_renderWidget->setProfile(m_activeDocument->mltProfile());
1947 m_timelineArea->setTabText(m_timelineArea->currentIndex(), m_activeDocument->description());
1948 //m_activeDocument->clipManager()->resetProducersList(m_projectMonitor->render->producersList());
1949 if (dar != m_activeDocument->dar()) m_projectList->reloadClipThumbnails();
1950 if (updateFps) m_activeTimeline->updateProjectFps();
1951 m_activeDocument->setModified(true);
1952 m_commandStack->activeStack()->clear();
1953 //Update the mouse position display so it will display in DF/NDF format by default based on the project setting.
1954 slotUpdateMousePosition(0);
1955 // We need to desactivate & reactivate monitors to get a refresh
1956 //m_monitorManager->switchMonitors();
1963 void MainWindow::slotRenderProject()
1965 if (!m_renderWidget) {
1966 QString projectfolder = m_activeDocument ? m_activeDocument->projectFolder().path(KUrl::AddTrailingSlash) : KdenliveSettings::defaultprojectfolder();
1967 m_renderWidget = new RenderWidget(projectfolder, this);
1968 connect(m_renderWidget, SIGNAL(shutdown()), this, SLOT(slotShutdown()));
1969 connect(m_renderWidget, SIGNAL(selectedRenderProfile(const QString &, const QString &, const QString &, const QString&)), this, SLOT(slotSetDocumentRenderProfile(const QString &, const QString &, const QString &, const QString&)));
1970 connect(m_renderWidget, SIGNAL(prepareRenderingData(bool, bool, const QString&)), this, SLOT(slotPrepareRendering(bool, bool, const QString&)));
1971 connect(m_renderWidget, SIGNAL(abortProcess(const QString &)), this, SIGNAL(abortRenderJob(const QString &)));
1972 connect(m_renderWidget, SIGNAL(openDvdWizard(const QString &, const QString &)), this, SLOT(slotDvdWizard(const QString &, const QString &)));
1973 if (m_activeDocument) {
1974 m_renderWidget->setProfile(m_activeDocument->mltProfile());
1975 m_renderWidget->setGuides(m_activeDocument->guidesXml(), m_activeDocument->projectDuration());
1976 m_renderWidget->setDocumentPath(m_activeDocument->projectFolder().path(KUrl::AddTrailingSlash));
1977 m_renderWidget->setRenderProfile(m_activeDocument->getDocumentProperty("renderdestination"), m_activeDocument->getDocumentProperty("rendercategory"), m_activeDocument->getDocumentProperty("renderprofile"), m_activeDocument->getDocumentProperty("renderurl"));
1980 slotCheckRenderStatus();
1981 /*TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
1982 if (currentTab) m_renderWidget->setTimeline(currentTab);
1983 m_renderWidget->setDocument(m_activeDocument);*/
1984 m_renderWidget->show();
1985 m_renderWidget->showNormal();
1987 m_activeTimeline->tracksNumber();
1988 m_renderWidget->enableAudio(false);
1989 //m_renderWidget->export_audio;
1992 void MainWindow::slotCheckRenderStatus()
1994 // Make sure there are no missing clips
1996 m_renderWidget->missingClips(m_projectList->hasMissingClips());
1999 void MainWindow::setRenderingProgress(const QString &url, int progress)
2002 m_renderWidget->setRenderJob(url, progress);
2005 void MainWindow::setRenderingFinished(const QString &url, int status, const QString &error)
2008 m_renderWidget->setRenderStatus(url, status, error);
2011 void MainWindow::slotCleanProject()
2013 if (KMessageBox::warningContinueCancel(this, i18n("This will remove all unused clips from your project."), i18n("Clean up project")) == KMessageBox::Cancel) return;
2014 m_projectList->cleanup();
2017 void MainWindow::slotUpdateMousePosition(int pos)
2019 if (m_activeDocument)
2020 switch (m_timecodeFormat->currentIndex()) {
2022 statusBar()->changeItem(m_activeDocument->timecode().getTimecodeFromFrames(pos), ID_TIMELINE_POS);
2025 statusBar()->changeItem(QString::number(pos), ID_TIMELINE_POS);
2029 void MainWindow::slotUpdateDocumentState(bool modified)
2031 if (!m_activeDocument) return;
2032 setCaption(m_activeDocument->description(), modified);
2033 m_saveAction->setEnabled(modified);
2035 m_timelineArea->setTabTextColor(m_timelineArea->currentIndex(), palette().color(QPalette::Link));
2036 m_timelineArea->setTabIcon(m_timelineArea->currentIndex(), KIcon("document-save"));
2038 m_timelineArea->setTabTextColor(m_timelineArea->currentIndex(), palette().color(QPalette::Text));
2039 m_timelineArea->setTabIcon(m_timelineArea->currentIndex(), KIcon("kdenlive"));
2043 void MainWindow::connectDocumentInfo(KdenliveDoc *doc)
2045 if (m_activeDocument) {
2046 if (m_activeDocument == doc) return;
2047 disconnect(m_activeDocument, SIGNAL(progressInfo(const QString &, int)), this, SLOT(slotGotProgressInfo(const QString &, int)));
2049 connect(doc, SIGNAL(progressInfo(const QString &, int)), this, SLOT(slotGotProgressInfo(const QString &, int)));
2052 void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) //changed
2054 //m_projectMonitor->stop();
2055 m_closeAction->setEnabled(m_timelineArea->count() > 1);
2056 kDebug() << "/////////////////// CONNECTING DOC TO PROJECT VIEW ////////////////";
2057 if (m_activeDocument) {
2058 if (m_activeDocument == doc) return;
2059 if (m_activeTimeline) {
2060 disconnect(m_projectMonitor, SIGNAL(renderPosition(int)), m_activeTimeline, SLOT(moveCursorPos(int)));
2061 disconnect(m_projectMonitor, SIGNAL(zoneUpdated(QPoint)), m_activeTimeline, SLOT(slotSetZone(QPoint)));
2062 disconnect(m_projectMonitor, SIGNAL(durationChanged(int)), m_activeTimeline, SLOT(setDuration(int)));
2063 disconnect(m_projectMonitor, SIGNAL(zoneUpdated(QPoint)), m_activeDocument, SLOT(setModified()));
2064 disconnect(m_clipMonitor, SIGNAL(zoneUpdated(QPoint)), m_activeDocument, SLOT(setModified()));
2065 disconnect(m_projectList, SIGNAL(projectModified()), m_activeDocument, SLOT(setModified()));
2066 disconnect(m_projectMonitor->render, SIGNAL(refreshDocumentProducers()), m_activeDocument, SLOT(checkProjectClips()));
2068 disconnect(m_activeDocument, SIGNAL(guidesUpdated()), this, SLOT(slotGuidesUpdated()));
2069 disconnect(m_activeDocument, SIGNAL(addProjectClip(DocClipBase *, bool)), m_projectList, SLOT(slotAddClip(DocClipBase *, bool)));
2070 disconnect(m_activeDocument, SIGNAL(resetProjectList()), m_projectList, SLOT(slotResetProjectList()));
2071 disconnect(m_activeDocument, SIGNAL(signalDeleteProjectClip(const QString &)), m_projectList, SLOT(slotDeleteClip(const QString &)));
2072 disconnect(m_activeDocument, SIGNAL(updateClipDisplay(const QString &)), m_projectList, SLOT(slotUpdateClip(const QString &)));
2073 disconnect(m_activeDocument, SIGNAL(selectLastAddedClip(const QString &)), m_projectList, SLOT(slotSelectClip(const QString &)));
2074 disconnect(m_activeDocument, SIGNAL(deleteTimelineClip(const QString &)), m_activeTimeline, SLOT(slotDeleteClip(const QString &)));
2075 disconnect(m_activeTimeline->projectView(), SIGNAL(clipItemSelected(ClipItem*, int)), m_effectStack, SLOT(slotClipItemSelected(ClipItem*, int)));
2076 disconnect(m_activeTimeline->projectView(), SIGNAL(clipItemSelected(ClipItem*, int)), this, SLOT(slotActivateEffectStackView()));
2077 disconnect(m_activeTimeline->projectView(), SIGNAL(transitionItemSelected(Transition*, int, QPoint, bool)), m_transitionConfig, SLOT(slotTransitionItemSelected(Transition*, int, QPoint, bool)));
2078 disconnect(m_activeTimeline->projectView(), SIGNAL(transitionItemSelected(Transition*, int, QPoint, bool)), this, SLOT(slotActivateTransitionView(Transition *)));
2079 disconnect(m_activeTimeline->projectView(), SIGNAL(playMonitor()), m_projectMonitor, SLOT(slotPlay()));
2080 disconnect(m_activeTimeline->projectView(), SIGNAL(displayMessage(const QString&, MessageType)), m_messageLabel, SLOT(setMessage(const QString&, MessageType)));
2081 disconnect(m_activeTimeline->projectView(), SIGNAL(showClipFrame(DocClipBase *, QPoint, const int)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *, QPoint, const int)));
2082 disconnect(m_activeTimeline, SIGNAL(cursorMoved()), m_projectMonitor, SLOT(activateMonitor()));
2083 disconnect(m_activeTimeline, SIGNAL(insertTrack(int)), this, SLOT(slotInsertTrack(int)));
2084 disconnect(m_activeTimeline, SIGNAL(deleteTrack(int)), this, SLOT(slotDeleteTrack(int)));
2085 disconnect(m_activeTimeline, SIGNAL(configTrack(int)), this, SLOT(slotConfigTrack(int)));
2086 disconnect(m_activeDocument, SIGNAL(docModified(bool)), this, SLOT(slotUpdateDocumentState(bool)));
2087 disconnect(m_effectStack, SIGNAL(updateClipEffect(ClipItem*, QDomElement, QDomElement, int)), m_activeTimeline->projectView(), SLOT(slotUpdateClipEffect(ClipItem*, QDomElement, QDomElement, int)));
2088 disconnect(m_effectStack, SIGNAL(removeEffect(ClipItem*, QDomElement)), m_activeTimeline->projectView(), SLOT(slotDeleteEffect(ClipItem*, QDomElement)));
2089 disconnect(m_effectStack, SIGNAL(changeEffectState(ClipItem*, int, bool)), m_activeTimeline->projectView(), SLOT(slotChangeEffectState(ClipItem*, int, bool)));
2090 disconnect(m_effectStack, SIGNAL(changeEffectPosition(ClipItem*, int, int)), m_activeTimeline->projectView(), SLOT(slotChangeEffectPosition(ClipItem*, int, int)));
2091 disconnect(m_effectStack, SIGNAL(refreshEffectStack(ClipItem*)), m_activeTimeline->projectView(), SLOT(slotRefreshEffects(ClipItem*)));
2092 disconnect(m_effectStack, SIGNAL(reloadEffects()), this, SLOT(slotReloadEffects()));
2093 disconnect(m_transitionConfig, SIGNAL(transitionUpdated(Transition *, QDomElement)), m_activeTimeline->projectView() , SLOT(slotTransitionUpdated(Transition *, QDomElement)));
2094 disconnect(m_transitionConfig, SIGNAL(seekTimeline(int)), m_activeTimeline->projectView() , SLOT(setCursorPos(int)));
2095 disconnect(m_activeTimeline->projectView(), SIGNAL(activateDocumentMonitor()), m_projectMonitor, SLOT(activateMonitor()));
2096 disconnect(m_activeTimeline, SIGNAL(zoneMoved(int, int)), this, SLOT(slotZoneMoved(int, int)));
2097 disconnect(m_projectList, SIGNAL(loadingIsOver()), m_activeTimeline->projectView(), SLOT(slotUpdateAllThumbs()));
2098 disconnect(m_projectList, SIGNAL(displayMessage(const QString&, int)), this, SLOT(slotGotProgressInfo(const QString&, int)));
2099 disconnect(m_projectList, SIGNAL(updateRenderStatus()), this, SLOT(slotCheckRenderStatus()));
2100 disconnect(m_projectList, SIGNAL(clipNeedsReload(const QString&, bool)), m_activeTimeline->projectView(), SLOT(slotUpdateClip(const QString &, bool)));
2101 m_effectStack->clear();
2103 //m_activeDocument->setRenderer(NULL);
2104 disconnect(m_projectList, SIGNAL(clipSelected(DocClipBase *)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *)));
2105 disconnect(m_projectList, SIGNAL(refreshClip()), m_clipMonitor, SLOT(refreshMonitor()));
2106 m_clipMonitor->stop();
2108 KdenliveSettings::setCurrent_profile(doc->profilePath());
2109 KdenliveSettings::setProject_fps(doc->fps());
2110 m_monitorManager->resetProfiles(doc->timecode());
2111 m_projectList->setDocument(doc);
2112 m_transitionConfig->updateProjectFormat(doc->mltProfile(), doc->timecode(), doc->tracksList());
2113 m_effectStack->updateProjectFormat(doc->mltProfile(), doc->timecode());
2114 connect(m_projectList, SIGNAL(clipSelected(DocClipBase *, QPoint)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *, QPoint)));
2115 connect(m_projectList, SIGNAL(refreshClip()), m_clipMonitor, SLOT(refreshMonitor()));
2116 connect(m_projectList, SIGNAL(clipNeedsReload(const QString&, bool)), trackView->projectView(), SLOT(slotUpdateClip(const QString &, bool)));
2118 connect(m_projectList, SIGNAL(projectModified()), doc, SLOT(setModified()));
2119 connect(m_projectList, SIGNAL(clipNameChanged(const QString, const QString)), trackView->projectView(), SLOT(clipNameChanged(const QString, const QString)));
2121 connect(m_projectList, SIGNAL(findInTimeline(const QString&)), this, SLOT(slotClipInTimeline(const QString&)));
2124 connect(trackView, SIGNAL(cursorMoved()), m_projectMonitor, SLOT(activateMonitor()));
2125 connect(trackView, SIGNAL(insertTrack(int)), this, SLOT(slotInsertTrack(int)));
2126 connect(trackView, SIGNAL(deleteTrack(int)), this, SLOT(slotDeleteTrack(int)));
2127 connect(trackView, SIGNAL(configTrack(int)), this, SLOT(slotConfigTrack(int)));
2128 connect(trackView, SIGNAL(updateTracksInfo()), this, SLOT(slotUpdateTrackInfo()));
2129 connect(trackView, SIGNAL(mousePosition(int)), this, SLOT(slotUpdateMousePosition(int)));
2130 connect(m_projectMonitor, SIGNAL(renderPosition(int)), trackView, SLOT(moveCursorPos(int)));
2131 connect(m_projectMonitor, SIGNAL(zoneUpdated(QPoint)), trackView, SLOT(slotSetZone(QPoint)));
2132 connect(m_clipMonitor, SIGNAL(zoneUpdated(QPoint)), m_projectList, SLOT(slotUpdateClipCut(QPoint)));
2133 connect(m_projectMonitor, SIGNAL(zoneUpdated(QPoint)), doc, SLOT(setModified()));
2134 connect(m_clipMonitor, SIGNAL(zoneUpdated(QPoint)), doc, SLOT(setModified()));
2135 connect(m_projectMonitor, SIGNAL(durationChanged(int)), trackView, SLOT(setDuration(int)));
2136 connect(m_projectMonitor->render, SIGNAL(refreshDocumentProducers()), doc, SLOT(checkProjectClips()));
2138 connect(doc, SIGNAL(addProjectClip(DocClipBase *, bool)), m_projectList, SLOT(slotAddClip(DocClipBase *, bool)));
2139 connect(doc, SIGNAL(resetProjectList()), m_projectList, SLOT(slotResetProjectList()));
2140 connect(doc, SIGNAL(signalDeleteProjectClip(const QString &)), m_projectList, SLOT(slotDeleteClip(const QString &)));
2141 connect(doc, SIGNAL(updateClipDisplay(const QString &)), m_projectList, SLOT(slotUpdateClip(const QString &)));
2142 connect(doc, SIGNAL(selectLastAddedClip(const QString &)), m_projectList, SLOT(slotSelectClip(const QString &)));
2144 connect(doc, SIGNAL(deleteTimelineClip(const QString &)), trackView, SLOT(slotDeleteClip(const QString &)));
2145 connect(doc, SIGNAL(docModified(bool)), this, SLOT(slotUpdateDocumentState(bool)));
2146 connect(doc, SIGNAL(guidesUpdated()), this, SLOT(slotGuidesUpdated()));
2149 connect(trackView->projectView(), SIGNAL(clipItemSelected(ClipItem*, int)), m_effectStack, SLOT(slotClipItemSelected(ClipItem*, int)));
2150 connect(trackView->projectView(), SIGNAL(updateClipMarkers(DocClipBase *)), this, SLOT(slotUpdateClipMarkers(DocClipBase*)));
2152 connect(trackView->projectView(), SIGNAL(clipItemSelected(ClipItem*, int)), this, SLOT(slotActivateEffectStackView()));
2153 connect(trackView->projectView(), SIGNAL(transitionItemSelected(Transition*, int, QPoint, bool)), m_transitionConfig, SLOT(slotTransitionItemSelected(Transition*, int, QPoint, bool)));
2154 connect(trackView->projectView(), SIGNAL(transitionItemSelected(Transition*, int, QPoint, bool)), this, SLOT(slotActivateTransitionView(Transition *)));
2155 m_zoomSlider->setValue(doc->zoom().x());
2156 connect(trackView->projectView(), SIGNAL(zoomIn()), this, SLOT(slotZoomIn()));
2157 connect(trackView->projectView(), SIGNAL(zoomOut()), this, SLOT(slotZoomOut()));
2158 connect(trackView, SIGNAL(setZoom(int)), this, SLOT(slotSetZoom(int)));
2159 connect(trackView->projectView(), SIGNAL(displayMessage(const QString&, MessageType)), m_messageLabel, SLOT(setMessage(const QString&, MessageType)));
2161 connect(trackView->projectView(), SIGNAL(showClipFrame(DocClipBase *, QPoint, const int)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *, QPoint, const int)));
2162 connect(trackView->projectView(), SIGNAL(playMonitor()), m_projectMonitor, SLOT(slotPlay()));
2165 connect(m_effectStack, SIGNAL(updateClipEffect(ClipItem*, QDomElement, QDomElement, int)), trackView->projectView(), SLOT(slotUpdateClipEffect(ClipItem*, QDomElement, QDomElement, int)));
2166 connect(m_effectStack, SIGNAL(updateClipRegion(ClipItem*, int, QString)), trackView->projectView(), SLOT(slotUpdateClipRegion(ClipItem*, int, QString)));
2167 connect(m_effectStack, SIGNAL(removeEffect(ClipItem*, QDomElement)), trackView->projectView(), SLOT(slotDeleteEffect(ClipItem*, QDomElement)));
2168 connect(m_effectStack, SIGNAL(changeEffectState(ClipItem*, int, bool)), trackView->projectView(), SLOT(slotChangeEffectState(ClipItem*, int, bool)));
2169 connect(m_effectStack, SIGNAL(changeEffectPosition(ClipItem*, int, int)), trackView->projectView(), SLOT(slotChangeEffectPosition(ClipItem*, int, int)));
2170 connect(m_effectStack, SIGNAL(refreshEffectStack(ClipItem*)), trackView->projectView(), SLOT(slotRefreshEffects(ClipItem*)));
2171 connect(m_transitionConfig, SIGNAL(transitionUpdated(Transition *, QDomElement)), trackView->projectView() , SLOT(slotTransitionUpdated(Transition *, QDomElement)));
2172 connect(m_transitionConfig, SIGNAL(seekTimeline(int)), trackView->projectView() , SLOT(setCursorPos(int)));
2173 connect(m_effectStack, SIGNAL(seekTimeline(int)), trackView->projectView() , SLOT(setCursorPos(int)));
2174 connect(m_effectStack, SIGNAL(reloadEffects()), this, SLOT(slotReloadEffects()));
2176 connect(trackView->projectView(), SIGNAL(activateDocumentMonitor()), m_projectMonitor, SLOT(activateMonitor()));
2177 connect(trackView, SIGNAL(zoneMoved(int, int)), this, SLOT(slotZoneMoved(int, int)));
2178 connect(m_projectList, SIGNAL(loadingIsOver()), trackView->projectView(), SLOT(slotUpdateAllThumbs()));
2179 connect(m_projectList, SIGNAL(displayMessage(const QString&, int)), this, SLOT(slotGotProgressInfo(const QString&, int)));
2180 connect(m_projectList, SIGNAL(updateRenderStatus()), this, SLOT(slotCheckRenderStatus()));
2183 trackView->projectView()->setContextMenu(m_timelineContextMenu, m_timelineContextClipMenu, m_timelineContextTransitionMenu, m_clipTypeGroup, (QMenu*)(factory()->container("marker_menu", this)));
2184 m_activeTimeline = trackView;
2185 if (m_renderWidget) {
2186 slotCheckRenderStatus();
2187 m_renderWidget->setProfile(doc->mltProfile());
2188 m_renderWidget->setGuides(doc->guidesXml(), doc->projectDuration());
2189 m_renderWidget->setDocumentPath(doc->projectFolder().path(KUrl::AddTrailingSlash));
2190 m_renderWidget->setRenderProfile(doc->getDocumentProperty("renderdestination"), doc->getDocumentProperty("rendercategory"), doc->getDocumentProperty("renderprofile"), doc->getDocumentProperty("renderurl"));
2192 //doc->setRenderer(m_projectMonitor->render);
2193 m_commandStack->setActiveStack(doc->commandStack());
2194 KdenliveSettings::setProject_display_ratio(doc->dar());
2195 //doc->clipManager()->checkAudioThumbs();
2197 //m_overView->setScene(trackView->projectScene());
2198 //m_overView->scale(m_overView->width() / trackView->duration(), m_overView->height() / (50 * trackView->tracksNumber()));
2199 //m_overView->fitInView(m_overView->itemAt(0, 50), Qt::KeepAspectRatio);
2201 setCaption(doc->description(), doc->isModified());
2202 m_saveAction->setEnabled(doc->isModified());
2203 m_normalEditTool->setChecked(true);
2204 m_activeDocument = doc;
2205 m_activeTimeline->updateProjectFps();
2206 m_activeDocument->checkProjectClips();
2207 if (KdenliveSettings::dropbframes()) slotUpdatePreviewSettings();
2208 //Update the mouse position display so it will display in DF/NDF format by default based on the project setting.
2209 slotUpdateMousePosition(0);
2210 // set tool to select tool
2211 m_buttonSelectTool->setChecked(true);
2214 void MainWindow::slotZoneMoved(int start, int end)
2216 m_activeDocument->setZone(start, end);
2217 m_projectMonitor->slotZoneMoved(start, end);
2220 void MainWindow::slotGuidesUpdated()
2223 m_renderWidget->setGuides(m_activeDocument->guidesXml(), m_activeDocument->projectDuration());
2226 void MainWindow::slotEditKeys()
2228 KShortcutsDialog dialog(KShortcutsEditor::AllActions, KShortcutsEditor::LetterShortcutsAllowed, this);
2229 dialog.addCollection(actionCollection(), i18nc("general keyboard shortcuts", "General"));
2230 dialog.addCollection(m_effectsActionCollection, i18nc("effects and transitions keyboard shortcuts", "Effects & Transitions"));
2234 void MainWindow::slotPreferences(int page, int option)
2236 //An instance of your dialog could be already created and could be
2237 // cached, in which case you want to display the cached dialog
2238 // instead of creating another one
2239 if (KConfigDialog::showDialog("settings")) {
2240 KdenliveSettingsDialog* d = static_cast <KdenliveSettingsDialog*>(KConfigDialog::exists("settings"));
2241 if (page != -1) d->showPage(page, option);
2245 // KConfigDialog didn't find an instance of this dialog, so lets
2247 KdenliveSettingsDialog* dialog = new KdenliveSettingsDialog(this);
2248 connect(dialog, SIGNAL(settingsChanged(const QString&)), this, SLOT(updateConfiguration()));
2249 //connect(dialog, SIGNAL(doResetProfile()), this, SLOT(slotDetectAudioDriver()));
2250 connect(dialog, SIGNAL(doResetProfile()), m_monitorManager, SLOT(slotResetProfiles()));
2251 connect(dialog, SIGNAL(updatePreviewSettings()), this, SLOT(slotUpdatePreviewSettings()));
2253 connect(dialog, SIGNAL(updateCaptureFolder()), m_recMonitor, SLOT(slotUpdateCaptureFolder()));
2255 //connect(dialog, SIGNAL(updatePreviewSettings()), this, SLOT(slotUpdatePreviewSettings()));
2257 if (page != -1) dialog->showPage(page, option);
2260 void MainWindow::slotUpdatePreviewSettings()
2262 if (m_activeDocument) {
2263 m_clipMonitor->slotSetXml(NULL);
2264 m_activeDocument->updatePreviewSettings();
2268 void MainWindow::updateConfiguration()
2270 //TODO: we should apply settings to all projects, not only the current one
2271 if (m_activeTimeline) {
2272 m_activeTimeline->refresh();
2273 m_activeTimeline->projectView()->checkAutoScroll();
2274 m_activeTimeline->projectView()->checkTrackHeight();
2275 if (m_activeDocument)
2276 m_activeDocument->clipManager()->checkAudioThumbs();
2278 m_buttonAudioThumbs->setChecked(KdenliveSettings::audiothumbnails());
2279 m_buttonVideoThumbs->setChecked(KdenliveSettings::videothumbnails());
2280 m_buttonAutomaticSplitAudio->setChecked(KdenliveSettings::splitaudio());
2282 // Update list of transcoding profiles
2284 #ifndef NO_JOGSHUTTLE
2285 activateShuttleDevice();
2286 #endif /* NO_JOGSHUTTLE */
2290 void MainWindow::slotSwitchSplitAudio()
2292 KdenliveSettings::setSplitaudio(!KdenliveSettings::splitaudio());
2293 m_buttonAutomaticSplitAudio->setChecked(KdenliveSettings::splitaudio());
2296 void MainWindow::slotSwitchVideoThumbs()
2298 KdenliveSettings::setVideothumbnails(!KdenliveSettings::videothumbnails());
2299 if (m_activeTimeline)
2300 m_activeTimeline->projectView()->slotUpdateAllThumbs();
2301 m_buttonVideoThumbs->setChecked(KdenliveSettings::videothumbnails());
2304 void MainWindow::slotSwitchAudioThumbs()
2306 KdenliveSettings::setAudiothumbnails(!KdenliveSettings::audiothumbnails());
2307 if (m_activeTimeline) {
2308 m_activeTimeline->refresh();
2309 m_activeTimeline->projectView()->checkAutoScroll();
2310 if (m_activeDocument)
2311 m_activeDocument->clipManager()->checkAudioThumbs();
2313 m_buttonAudioThumbs->setChecked(KdenliveSettings::audiothumbnails());
2316 void MainWindow::slotSwitchMarkersComments()
2318 KdenliveSettings::setShowmarkers(!KdenliveSettings::showmarkers());
2319 if (m_activeTimeline)
2320 m_activeTimeline->refresh();
2321 m_buttonShowMarkers->setChecked(KdenliveSettings::showmarkers());
2324 void MainWindow::slotSwitchSnap()
2326 KdenliveSettings::setSnaptopoints(!KdenliveSettings::snaptopoints());
2327 m_buttonSnap->setChecked(KdenliveSettings::snaptopoints());
2331 void MainWindow::slotDeleteItem()
2333 if (QApplication::focusWidget() &&
2334 QApplication::focusWidget()->parentWidget() &&
2335 QApplication::focusWidget()->parentWidget()->parentWidget() &&
2336 QApplication::focusWidget()->parentWidget()->parentWidget() == m_projectListDock) {
2337 m_projectList->slotRemoveClip();
2340 QWidget *widget = QApplication::focusWidget();
2342 if (widget == m_effectStackDock) {
2343 m_effectStack->slotItemDel();
2346 widget = widget->parentWidget();
2349 // effect stack has no focus
2350 if (m_activeTimeline)
2351 m_activeTimeline->projectView()->deleteSelectedClips();
2355 void MainWindow::slotUpdateClipMarkers(DocClipBase *clip)
2357 if (m_clipMonitor->isActive())
2358 m_clipMonitor->checkOverlay();
2359 m_clipMonitor->updateMarkers(clip);
2362 void MainWindow::slotAddClipMarker()
2364 DocClipBase *clip = NULL;
2366 if (m_projectMonitor->isActive()) {
2367 if (m_activeTimeline) {
2368 ClipItem *item = m_activeTimeline->projectView()->getActiveClipUnderCursor();
2370 pos = GenTime((int)((m_projectMonitor->position() - item->startPos() + item->cropStart()).frames(m_activeDocument->fps()) * item->speed() + 0.5), m_activeDocument->fps());
2371 clip = item->baseClip();
2375 clip = m_clipMonitor->activeClip();
2376 pos = m_clipMonitor->position();
2379 m_messageLabel->setMessage(i18n("Cannot find clip to add marker"), ErrorMessage);
2382 QString id = clip->getId();
2383 CommentedTime marker(pos, i18n("Marker"));
2384 MarkerDialog d(clip, marker, m_activeDocument->timecode(), i18n("Add Marker"), this);
2385 if (d.exec() == QDialog::Accepted)
2386 m_activeTimeline->projectView()->slotAddClipMarker(id, d.newMarker().time(), d.newMarker().comment());
2389 void MainWindow::slotDeleteClipMarker()
2391 DocClipBase *clip = NULL;
2393 if (m_projectMonitor->isActive()) {
2394 if (m_activeTimeline) {
2395 ClipItem *item = m_activeTimeline->projectView()->getActiveClipUnderCursor();
2397 pos = (m_projectMonitor->position() - item->startPos() + item->cropStart()) / item->speed();
2398 clip = item->baseClip();
2402 clip = m_clipMonitor->activeClip();
2403 pos = m_clipMonitor->position();
2406 m_messageLabel->setMessage(i18n("Cannot find clip to remove marker"), ErrorMessage);
2410 QString id = clip->getId();
2411 QString comment = clip->markerComment(pos);
2412 if (comment.isEmpty()) {
2413 m_messageLabel->setMessage(i18n("No marker found at cursor time"), ErrorMessage);
2416 m_activeTimeline->projectView()->slotDeleteClipMarker(comment, id, pos);
2419 void MainWindow::slotDeleteAllClipMarkers()
2421 DocClipBase *clip = NULL;
2422 if (m_projectMonitor->isActive()) {
2423 if (m_activeTimeline) {
2424 ClipItem *item = m_activeTimeline->projectView()->getActiveClipUnderCursor();
2426 clip = item->baseClip();
2430 clip = m_clipMonitor->activeClip();
2433 m_messageLabel->setMessage(i18n("Cannot find clip to remove marker"), ErrorMessage);
2436 m_activeTimeline->projectView()->slotDeleteAllClipMarkers(clip->getId());
2439 void MainWindow::slotEditClipMarker()
2441 DocClipBase *clip = NULL;
2443 if (m_projectMonitor->isActive()) {
2444 if (m_activeTimeline) {
2445 ClipItem *item = m_activeTimeline->projectView()->getActiveClipUnderCursor();
2447 pos = (m_projectMonitor->position() - item->startPos() + item->cropStart()) / item->speed();
2448 clip = item->baseClip();
2452 clip = m_clipMonitor->activeClip();
2453 pos = m_clipMonitor->position();
2456 m_messageLabel->setMessage(i18n("Cannot find clip to remove marker"), ErrorMessage);
2460 QString id = clip->getId();
2461 QString oldcomment = clip->markerComment(pos);
2462 if (oldcomment.isEmpty()) {
2463 m_messageLabel->setMessage(i18n("No marker found at cursor time"), ErrorMessage);
2467 CommentedTime marker(pos, oldcomment);
2468 MarkerDialog d(clip, marker, m_activeDocument->timecode(), i18n("Edit Marker"), this);
2469 if (d.exec() == QDialog::Accepted) {
2470 m_activeTimeline->projectView()->slotAddClipMarker(id, d.newMarker().time(), d.newMarker().comment());
2471 if (d.newMarker().time() != pos) {
2472 // remove old marker
2473 m_activeTimeline->projectView()->slotAddClipMarker(id, pos, QString());
2478 void MainWindow::slotAddGuide()
2480 if (m_activeTimeline)
2481 m_activeTimeline->projectView()->slotAddGuide();
2484 void MainWindow::slotInsertSpace()
2486 if (m_activeTimeline)
2487 m_activeTimeline->projectView()->slotInsertSpace();
2490 void MainWindow::slotRemoveSpace()
2492 if (m_activeTimeline)
2493 m_activeTimeline->projectView()->slotRemoveSpace();
2496 void MainWindow::slotInsertTrack(int ix)
2498 m_projectMonitor->activateMonitor();
2499 if (m_activeTimeline)
2500 m_activeTimeline->projectView()->slotInsertTrack(ix);
2501 if (m_activeDocument)
2502 m_transitionConfig->updateProjectFormat(m_activeDocument->mltProfile(), m_activeDocument->timecode(), m_activeDocument->tracksList());
2505 void MainWindow::slotDeleteTrack(int ix)
2507 m_projectMonitor->activateMonitor();
2508 if (m_activeTimeline)
2509 m_activeTimeline->projectView()->slotDeleteTrack(ix);
2510 if (m_activeDocument)
2511 m_transitionConfig->updateProjectFormat(m_activeDocument->mltProfile(), m_activeDocument->timecode(), m_activeDocument->tracksList());
2514 void MainWindow::slotConfigTrack(int ix)
2516 m_projectMonitor->activateMonitor();
2517 if (m_activeTimeline)
2518 m_activeTimeline->projectView()->slotConfigTracks(ix);
2519 if (m_activeDocument)
2520 m_transitionConfig->updateProjectFormat(m_activeDocument->mltProfile(), m_activeDocument->timecode(), m_activeDocument->tracksList());
2523 void MainWindow::slotEditGuide()
2525 if (m_activeTimeline)
2526 m_activeTimeline->projectView()->slotEditGuide();
2529 void MainWindow::slotDeleteGuide()
2531 if (m_activeTimeline)
2532 m_activeTimeline->projectView()->slotDeleteGuide();
2535 void MainWindow::slotDeleteAllGuides()
2537 if (m_activeTimeline)
2538 m_activeTimeline->projectView()->slotDeleteAllGuides();
2541 void MainWindow::slotCutTimelineClip()
2543 if (m_activeTimeline)
2544 m_activeTimeline->projectView()->cutSelectedClips();
2547 void MainWindow::slotInsertClipOverwrite()
2549 if (m_activeTimeline) {
2550 QStringList data = m_clipMonitor->getZoneInfo();
2551 m_activeTimeline->projectView()->insertZoneOverwrite(data, m_activeTimeline->inPoint());
2555 void MainWindow::slotSelectTimelineClip()
2557 if (m_activeTimeline)
2558 m_activeTimeline->projectView()->selectClip(true);
2561 void MainWindow::slotSelectTimelineTransition()
2563 if (m_activeTimeline)
2564 m_activeTimeline->projectView()->selectTransition(true);
2567 void MainWindow::slotDeselectTimelineClip()
2569 if (m_activeTimeline)
2570 m_activeTimeline->projectView()->selectClip(false, true);
2573 void MainWindow::slotDeselectTimelineTransition()
2575 if (m_activeTimeline)
2576 m_activeTimeline->projectView()->selectTransition(false, true);
2579 void MainWindow::slotSelectAddTimelineClip()
2581 if (m_activeTimeline)
2582 m_activeTimeline->projectView()->selectClip(true, true);
2585 void MainWindow::slotSelectAddTimelineTransition()
2587 if (m_activeTimeline)
2588 m_activeTimeline->projectView()->selectTransition(true, true);
2591 void MainWindow::slotGroupClips()
2593 if (m_activeTimeline)
2594 m_activeTimeline->projectView()->groupClips();
2597 void MainWindow::slotUnGroupClips()
2599 if (m_activeTimeline)
2600 m_activeTimeline->projectView()->groupClips(false);
2603 void MainWindow::slotEditItemDuration()
2605 if (m_activeTimeline)
2606 m_activeTimeline->projectView()->editItemDuration();
2609 void MainWindow::slotAddProjectClip(KUrl url)
2611 if (m_activeDocument)
2612 m_activeDocument->slotAddClipFile(url, QString());
2615 void MainWindow::slotAddTransition(QAction *result)
2617 if (!result) return;
2618 QStringList info = result->data().toStringList();
2619 if (info.isEmpty()) return;
2620 QDomElement transition = transitions.getEffectByTag(info.at(1), info.at(2));
2621 if (m_activeTimeline && !transition.isNull()) {
2622 m_activeTimeline->projectView()->slotAddTransitionToSelectedClips(transition.cloneNode().toElement());
2626 void MainWindow::slotAddVideoEffect(QAction *result)
2628 if (!result) return;
2629 QStringList info = result->data().toStringList();
2630 if (info.isEmpty()) return;
2631 QDomElement effect = videoEffects.getEffectByTag(info.at(1), info.at(2));
2632 slotAddEffect(effect);
2635 void MainWindow::slotAddAudioEffect(QAction *result)
2637 if (!result) return;
2638 QStringList info = result->data().toStringList();
2639 if (info.isEmpty()) return;
2640 QDomElement effect = audioEffects.getEffectByTag(info.at(1), info.at(2));
2641 slotAddEffect(effect);
2644 void MainWindow::slotAddCustomEffect(QAction *result)
2646 if (!result) return;
2647 QStringList info = result->data().toStringList();
2648 if (info.isEmpty()) return;
2649 QDomElement effect = customEffects.getEffectByTag(info.at(1), info.at(2));
2650 slotAddEffect(effect);
2653 void MainWindow::slotZoomIn()
2655 m_zoomSlider->setValue(m_zoomSlider->value() - 1);
2656 slotShowZoomSliderToolTip();
2659 void MainWindow::slotZoomOut()
2661 m_zoomSlider->setValue(m_zoomSlider->value() + 1);
2662 slotShowZoomSliderToolTip();
2665 void MainWindow::slotFitZoom()
2667 if (m_activeTimeline)
2668 m_zoomSlider->setValue(m_activeTimeline->fitZoom());
2671 void MainWindow::slotSetZoom(int value)
2673 if (m_activeTimeline)
2674 m_activeTimeline->slotChangeZoom(value);
2676 m_zoomOut->setEnabled(value < m_zoomSlider->maximum());
2677 m_zoomIn->setEnabled(value > m_zoomSlider->minimum());
2678 slotUpdateZoomSliderToolTip(value);
2680 m_zoomSlider->blockSignals(true);
2681 m_zoomSlider->setValue(value);
2682 m_zoomSlider->blockSignals(false);
2685 void MainWindow::slotShowZoomSliderToolTip(int zoomlevel)
2687 if (zoomlevel != -1)
2688 slotUpdateZoomSliderToolTip(zoomlevel);
2690 QPoint global = m_zoomSlider->rect().topLeft();
2691 global.ry() += m_zoomSlider->height() / 2;
2692 QHelpEvent toolTipEvent(QEvent::ToolTip, QPoint(0, 0), m_zoomSlider->mapToGlobal(global));
2693 QApplication::sendEvent(m_zoomSlider, &toolTipEvent);
2696 void MainWindow::slotUpdateZoomSliderToolTip(int zoomlevel)
2698 m_zoomSlider->setToolTip(i18n("Zoom Level: %1/13", (13 - zoomlevel)));
2701 void MainWindow::slotGotProgressInfo(const QString &message, int progress)
2703 m_statusProgressBar->setValue(progress);
2704 if (progress >= 0) {
2705 if (!message.isEmpty())
2706 m_messageLabel->setMessage(message, InformationMessage);//statusLabel->setText(message);
2707 m_statusProgressBar->setVisible(true);
2708 } else if (progress == -2) {
2709 if (!message.isEmpty())
2710 m_messageLabel->setMessage(message, ErrorMessage);
2711 m_statusProgressBar->setVisible(false);
2713 m_messageLabel->setMessage(QString(), DefaultMessage);
2714 m_statusProgressBar->setVisible(false);
2718 void MainWindow::slotShowClipProperties(DocClipBase *clip)
2720 if (clip->clipType() == TEXT) {
2721 QString titlepath = m_activeDocument->projectFolder().path(KUrl::AddTrailingSlash) + "titles/";
2722 if (!clip->getProperty("resource").isEmpty() && clip->getProperty("xmldata").isEmpty()) {
2723 // template text clip
2725 // Get the list of existing templates
2727 filter << "*.kdenlivetitle";
2728 QStringList templateFiles = QDir(titlepath).entryList(filter, QDir::Files);
2730 QDialog *dia = new QDialog(this);
2731 Ui::TemplateClip_UI dia_ui;
2732 dia_ui.setupUi(dia);
2734 const QString templatePath = clip->getProperty("resource");
2735 for (int i = 0; i < templateFiles.size(); ++i) {
2736 dia_ui.template_list->comboBox()->addItem(templateFiles.at(i), titlepath + templateFiles.at(i));
2737 if (templatePath == KUrl(titlepath + templateFiles.at(i)).path()) ix = i;
2739 if (ix != -1) dia_ui.template_list->comboBox()->setCurrentIndex(ix);
2740 else dia_ui.template_list->comboBox()->insertItem(0, templatePath);
2741 dia_ui.template_list->fileDialog()->setFilter("*.kdenlivetitle");
2742 //warning: setting base directory doesn't work??
2743 KUrl startDir(titlepath);
2744 dia_ui.template_list->fileDialog()->setUrl(startDir);
2745 dia_ui.description->setText(clip->getProperty("description"));
2746 if (dia->exec() == QDialog::Accepted) {
2747 QString textTemplate = dia_ui.template_list->comboBox()->itemData(dia_ui.template_list->comboBox()->currentIndex()).toString();
2748 if (textTemplate.isEmpty()) textTemplate = dia_ui.template_list->comboBox()->currentText();
2750 QMap <QString, QString> newprops;
2752 if (KUrl(textTemplate).path() != templatePath) {
2753 // The template was changed
2754 newprops.insert("resource", textTemplate);
2757 if (dia_ui.description->toPlainText() != clip->getProperty("description")) {
2758 newprops.insert("description", dia_ui.description->toPlainText());
2761 QString newtemplate = newprops.value("xmltemplate");
2762 if (newtemplate.isEmpty()) newtemplate = templatePath;
2764 // template modified we need to update xmldata
2765 QString description = newprops.value("description");
2766 if (description.isEmpty()) description = clip->getProperty("description");
2767 else newprops.insert("templatetext", description);
2768 //newprops.insert("xmldata", m_projectList->generateTemplateXml(newtemplate, description).toString());
2769 if (!newprops.isEmpty()) {
2770 EditClipCommand *command = new EditClipCommand(m_projectList, clip->getId(), clip->properties(), newprops, true);
2771 m_activeDocument->commandStack()->push(command);
2777 QString path = clip->getProperty("resource");
2778 TitleWidget *dia_ui = new TitleWidget(KUrl(), m_activeDocument->timecode(), titlepath, m_projectMonitor->render, this);
2780 doc.setContent(clip->getProperty("xmldata"));
2781 dia_ui->setXml(doc);
2782 if (dia_ui->exec() == QDialog::Accepted) {
2783 QMap <QString, QString> newprops;
2784 newprops.insert("xmldata", dia_ui->xml().toString());
2785 if (dia_ui->outPoint() != clip->duration().frames(m_activeDocument->fps()) - 1) {
2786 // duration changed, we need to update duration
2787 newprops.insert("out", QString::number(dia_ui->outPoint()));
2789 EditClipCommand *command = new EditClipCommand(m_projectList, clip->getId(), clip->properties(), newprops, true);
2790 m_activeDocument->commandStack()->push(command);
2791 //m_activeTimeline->projectView()->slotUpdateClip(clip->getId());
2792 m_activeDocument->setModified(true);
2796 //m_activeDocument->editTextClip(clip->getProperty("xml"), clip->getId());
2799 ClipProperties dia(clip, m_activeDocument->timecode(), m_activeDocument->fps(), this);
2800 connect(&dia, SIGNAL(addMarker(const QString &, GenTime, QString)), m_activeTimeline->projectView(), SLOT(slotAddClipMarker(const QString &, GenTime, QString)));
2801 if (dia.exec() == QDialog::Accepted) {
2802 QMap <QString, QString> newprops = dia.properties();
2803 if (newprops.isEmpty()) return;
2804 EditClipCommand *command = new EditClipCommand(m_projectList, clip->getId(), clip->properties(), newprops, true);
2805 m_activeDocument->commandStack()->push(command);
2807 if (dia.needsTimelineRefresh()) {
2808 // update clip occurences in timeline
2809 m_activeTimeline->projectView()->slotUpdateClip(clip->getId(), dia.needsTimelineReload());
2815 void MainWindow::slotShowClipProperties(QList <DocClipBase *> cliplist, QMap<QString, QString> commonproperties)
2817 ClipProperties dia(cliplist, m_activeDocument->timecode(), commonproperties, this);
2818 if (dia.exec() == QDialog::Accepted) {
2819 QUndoCommand *command = new QUndoCommand();
2820 command->setText(i18n("Edit clips"));
2821 for (int i = 0; i < cliplist.count(); i++) {
2822 DocClipBase *clip = cliplist.at(i);
2823 new EditClipCommand(m_projectList, clip->getId(), clip->properties(), dia.properties(), true, command);
2825 m_activeDocument->commandStack()->push(command);
2826 for (int i = 0; i < cliplist.count(); i++)
2827 m_activeTimeline->projectView()->slotUpdateClip(cliplist.at(i)->getId(), dia.needsTimelineReload());
2831 void MainWindow::customEvent(QEvent* e)
2833 if (e->type() == QEvent::User)
2834 m_messageLabel->setMessage(static_cast <MltErrorEvent *>(e)->message(), MltError);
2836 void MainWindow::slotActivateEffectStackView()
2838 m_effectStack->raiseWindow(m_effectStackDock);
2841 void MainWindow::slotActivateTransitionView(Transition *t)
2844 m_transitionConfig->raiseWindow(m_transitionConfigDock);
2847 void MainWindow::slotSnapRewind()
2849 if (m_projectMonitor->isActive()) {
2850 if (m_activeTimeline)
2851 m_activeTimeline->projectView()->slotSeekToPreviousSnap();
2853 m_clipMonitor->slotSeekToPreviousSnap();
2857 void MainWindow::slotSnapForward()
2859 if (m_projectMonitor->isActive()) {
2860 if (m_activeTimeline)
2861 m_activeTimeline->projectView()->slotSeekToNextSnap();
2863 m_clipMonitor->slotSeekToNextSnap();
2867 void MainWindow::slotClipStart()
2869 if (m_projectMonitor->isActive()) {
2870 if (m_activeTimeline)
2871 m_activeTimeline->projectView()->clipStart();
2875 void MainWindow::slotClipEnd()
2877 if (m_projectMonitor->isActive()) {
2878 if (m_activeTimeline)
2879 m_activeTimeline->projectView()->clipEnd();
2883 void MainWindow::slotZoneStart()
2885 if (m_projectMonitor->isActive())
2886 m_projectMonitor->slotZoneStart();
2888 m_clipMonitor->slotZoneStart();
2891 void MainWindow::slotZoneEnd()
2893 if (m_projectMonitor->isActive())
2894 m_projectMonitor->slotZoneEnd();
2896 m_clipMonitor->slotZoneEnd();
2899 void MainWindow::slotChangeTool(QAction * action)
2901 if (action == m_buttonSelectTool)
2902 slotSetTool(SELECTTOOL);
2903 else if (action == m_buttonRazorTool)
2904 slotSetTool(RAZORTOOL);
2905 else if (action == m_buttonSpacerTool)
2906 slotSetTool(SPACERTOOL);
2909 void MainWindow::slotChangeEdit(QAction * action)
2911 if (!m_activeTimeline)
2914 if (action == m_overwriteEditTool)
2915 m_activeTimeline->projectView()->setEditMode(OVERWRITEEDIT);
2916 else if (action == m_insertEditTool)
2917 m_activeTimeline->projectView()->setEditMode(INSERTEDIT);
2919 m_activeTimeline->projectView()->setEditMode(NORMALEDIT);
2922 void MainWindow::slotSetTool(PROJECTTOOL tool)
2924 if (m_activeDocument && m_activeTimeline) {
2925 //m_activeDocument->setTool(tool);
2929 message = i18n("Ctrl + click to use spacer on current track only");
2932 message = i18n("Click on a clip to cut it");
2935 message = i18n("Shift + click to create a selection rectangle, Ctrl + click to add an item to selection");
2938 m_messageLabel->setMessage(message, InformationMessage);
2939 m_activeTimeline->projectView()->setTool(tool);
2943 void MainWindow::slotCopy()
2945 if (m_activeDocument && m_activeTimeline)
2946 m_activeTimeline->projectView()->copyClip();
2949 void MainWindow::slotPaste()
2951 if (m_activeDocument && m_activeTimeline)
2952 m_activeTimeline->projectView()->pasteClip();
2955 void MainWindow::slotPasteEffects()
2957 if (m_activeDocument && m_activeTimeline)
2958 m_activeTimeline->projectView()->pasteClipEffects();
2961 void MainWindow::slotFind()
2963 if (!m_activeDocument || !m_activeTimeline) return;
2964 m_projectSearch->setEnabled(false);
2965 m_findActivated = true;
2966 m_findString.clear();
2967 m_activeTimeline->projectView()->initSearchStrings();
2968 statusBar()->showMessage(i18n("Starting -- find text as you type"));
2969 m_findTimer.start(5000);
2970 qApp->installEventFilter(this);
2973 void MainWindow::slotFindNext()
2975 if (m_activeTimeline && m_activeTimeline->projectView()->findNextString(m_findString))
2976 statusBar()->showMessage(i18n("Found: %1", m_findString));
2978 statusBar()->showMessage(i18n("Reached end of project"));
2979 m_findTimer.start(4000);
2982 void MainWindow::findAhead()
2984 if (m_activeTimeline && m_activeTimeline->projectView()->findString(m_findString)) {
2985 m_projectSearchNext->setEnabled(true);
2986 statusBar()->showMessage(i18n("Found: %1", m_findString));
2988 m_projectSearchNext->setEnabled(false);
2989 statusBar()->showMessage(i18n("Not found: %1", m_findString));
2993 void MainWindow::findTimeout()
2995 m_projectSearchNext->setEnabled(false);
2996 m_findActivated = false;
2997 m_findString.clear();
2998 statusBar()->showMessage(i18n("Find stopped"), 3000);
2999 if (m_activeTimeline) m_activeTimeline->projectView()->clearSearchStrings();
3000 m_projectSearch->setEnabled(true);
3001 removeEventFilter(this);
3004 void MainWindow::slotClipInTimeline(const QString &clipId)
3006 if (m_activeTimeline && m_activeDocument) {
3007 QList<ItemInfo> matching = m_activeTimeline->projectView()->findId(clipId);
3009 QMenu *inTimelineMenu = static_cast<QMenu*>(factory()->container("clip_in_timeline", this));
3010 inTimelineMenu->clear();
3012 QList <QAction *> actionList;
3014 for (int i = 0; i < matching.count(); ++i) {
3015 QString track = QString::number(matching.at(i).track);
3016 QString start = m_activeDocument->timecode().getTimecode(matching.at(i).startPos);
3018 QAction *a = new QAction(track + ": " + start, this);
3019 a->setData(QStringList() << track << start);
3020 connect(a, SIGNAL(triggered()), this, SLOT(slotSelectClipInTimeline()));
3021 while (j < actionList.count()) {
3022 if (actionList.at(j)->text() > a->text()) break;
3025 actionList.insert(j, a);
3027 inTimelineMenu->addActions(actionList);
3029 if (matching.empty())
3030 inTimelineMenu->setEnabled(false);
3032 inTimelineMenu->setEnabled(true);
3036 void MainWindow::slotClipInProjectTree()
3038 if (m_activeTimeline) {
3039 const QStringList &clipIds = m_activeTimeline->projectView()->selectedClips();
3040 if (clipIds.isEmpty())
3042 m_projectListDock->raise();
3043 for (int i = 0; i < clipIds.count(); i++)
3044 m_projectList->selectItemById(clipIds.at(i));
3045 if (m_projectMonitor->isActive())
3046 slotSwitchMonitors();
3050 /*void MainWindow::slotClipToProjectTree()
3052 if (m_activeTimeline) {
3053 const QList<ClipItem *> clips = m_activeTimeline->projectView()->selectedClipItems();
3054 if (clips.isEmpty()) return;
3055 for (int i = 0; i < clips.count(); i++) {
3056 m_projectList->slotAddXmlClip(clips.at(i)->itemXml());
3058 //m_projectList->selectItemById(clipIds.at(i));
3062 void MainWindow::slotSelectClipInTimeline()
3064 if (m_activeTimeline) {
3065 QAction *action = qobject_cast<QAction *>(sender());
3066 QStringList data = action->data().toStringList();
3067 m_activeTimeline->projectView()->selectFound(data.at(0), data.at(1));
3071 void MainWindow::keyPressEvent(QKeyEvent *ke)
3073 if (m_findActivated) {
3074 if (ke->key() == Qt::Key_Backspace) {
3075 m_findString = m_findString.left(m_findString.length() - 1);
3077 if (!m_findString.isEmpty())
3082 m_findTimer.start(4000);
3085 } else if (ke->key() == Qt::Key_Escape) {
3089 } else if (ke->key() == Qt::Key_Space || !ke->text().trimmed().isEmpty()) {
3090 m_findString += ke->text();
3094 m_findTimer.start(4000);
3099 KXmlGuiWindow::keyPressEvent(ke);
3104 /** Gets called when the window gets hidden */
3105 void MainWindow::hideEvent(QHideEvent */*event*/)
3108 if (m_monitorManager)
3109 m_monitorManager->stopActiveMonitor();
3112 bool MainWindow::eventFilter(QObject *obj, QEvent *event)
3114 if (m_findActivated) {
3115 if (event->type() == QEvent::ShortcutOverride) {
3116 QKeyEvent* ke = (QKeyEvent*) event;
3117 if (ke->text().trimmed().isEmpty()) return false;
3124 // pass the event on to the parent class
3125 return QMainWindow::eventFilter(obj, event);
3130 void MainWindow::slotSaveZone(Render *render, QPoint zone)
3132 KDialog *dialog = new KDialog(this);
3133 dialog->setCaption("Save clip zone");
3134 dialog->setButtons(KDialog::Ok | KDialog::Cancel);
3136 QWidget *widget = new QWidget(dialog);
3137 dialog->setMainWidget(widget);
3139 QVBoxLayout *vbox = new QVBoxLayout(widget);
3140 QLabel *label1 = new QLabel(i18n("Save clip zone as:"), this);
3141 QString path = m_activeDocument->projectFolder().path();
3143 path.append("untitled.mlt");
3144 KUrlRequester *url = new KUrlRequester(KUrl(path), this);
3145 url->setFilter("video/mlt-playlist");
3146 QLabel *label2 = new QLabel(i18n("Description:"), this);
3147 KLineEdit *edit = new KLineEdit(this);
3148 vbox->addWidget(label1);
3149 vbox->addWidget(url);
3150 vbox->addWidget(label2);
3151 vbox->addWidget(edit);
3152 if (dialog->exec() == QDialog::Accepted)
3153 render->saveZone(url->url(), edit->text(), zone);
3157 void MainWindow::slotSetInPoint()
3159 if (m_clipMonitor->isActive())
3160 m_clipMonitor->slotSetZoneStart();
3162 m_projectMonitor->slotSetZoneStart();
3163 //else m_activeTimeline->projectView()->setInPoint();
3166 void MainWindow::slotSetOutPoint()
3168 if (m_clipMonitor->isActive())
3169 m_clipMonitor->slotSetZoneEnd();
3171 m_projectMonitor->slotSetZoneEnd();
3172 // else m_activeTimeline->projectView()->setOutPoint();
3175 void MainWindow::slotResizeItemStart()
3177 if (m_activeTimeline)
3178 m_activeTimeline->projectView()->setInPoint();
3181 void MainWindow::slotResizeItemEnd()
3183 if (m_activeTimeline)
3184 m_activeTimeline->projectView()->setOutPoint();
3187 int MainWindow::getNewStuff(const QString &configFile)
3189 KNS3::Entry::List entries;
3190 #if KDE_IS_VERSION(4,3,80)
3191 KNS3::DownloadDialog dialog(configFile);
3193 entries = dialog.changedEntries();
3194 foreach(const KNS3::Entry &entry, entries) {
3195 if (entry.status() == KNS3::Entry::Installed)
3196 kDebug() << "// Installed files: " << entry.installedFiles();
3199 KNS::Engine engine(0);
3200 if (engine.init(configFile))
3201 entries = engine.downloadDialogModal(this);
3202 foreach(KNS::Entry *entry, entries) {
3203 if (entry->status() == KNS::Entry::Installed)
3204 kDebug() << "// Installed files: " << entry->installedFiles();
3206 #endif /* KDE_IS_VERSION(4,3,80) */
3207 return entries.size();
3210 void MainWindow::slotGetNewTitleStuff()
3212 if (getNewStuff("kdenlive_titles.knsrc") > 0)
3213 TitleWidget::refreshTitleTemplates();
3216 void MainWindow::slotGetNewLumaStuff()
3218 if (getNewStuff("kdenlive_wipes.knsrc") > 0) {
3219 initEffects::refreshLumas();
3220 m_activeTimeline->projectView()->reloadTransitionLumas();
3224 void MainWindow::slotGetNewRenderStuff()
3226 if (getNewStuff("kdenlive_renderprofiles.knsrc") > 0)
3228 m_renderWidget->reloadProfiles();
3231 void MainWindow::slotGetNewMltProfileStuff()
3233 if (getNewStuff("kdenlive_projectprofiles.knsrc") > 0) {
3234 // update the list of profiles in settings dialog
3235 KdenliveSettingsDialog* d = static_cast <KdenliveSettingsDialog*>(KConfigDialog::exists("settings"));
3241 void MainWindow::slotAutoTransition()
3243 if (m_activeTimeline)
3244 m_activeTimeline->projectView()->autoTransition();
3247 void MainWindow::slotSplitAudio()
3249 if (m_activeTimeline)
3250 m_activeTimeline->projectView()->splitAudio();
3253 void MainWindow::slotUpdateClipType(QAction *action)
3255 if (m_activeTimeline) {
3256 if (action->data().toString() == "clip_audio_only") m_activeTimeline->projectView()->setAudioOnly();
3257 else if (action->data().toString() == "clip_video_only") m_activeTimeline->projectView()->setVideoOnly();
3258 else m_activeTimeline->projectView()->setAudioAndVideo();
3262 void MainWindow::slotDvdWizard(const QString &url, const QString &profile)
3264 // We must stop the monitors since we create a new on in the dvd wizard
3265 m_clipMonitor->stop();
3266 m_projectMonitor->stop();
3267 DvdWizard w(url, profile, this);
3269 m_projectMonitor->start();
3272 void MainWindow::slotShowTimeline(bool show)
3274 if (show == false) {
3275 m_timelineState = saveState();
3276 centralWidget()->setHidden(true);
3278 centralWidget()->setHidden(false);
3279 restoreState(m_timelineState);
3283 void MainWindow::slotMaximizeCurrent(bool /*show*/)
3285 //TODO: is there a way to maximize current widget?
3288 m_timelineState = saveState();
3289 QWidget *par = focusWidget()->parentWidget();
3290 while (par->parentWidget() && par->parentWidget() != this)
3291 par = par->parentWidget();
3292 kDebug() << "CURRENT WIDGET: " << par->objectName();
3295 //centralWidget()->setHidden(false);
3296 //restoreState(m_timelineState);
3300 void MainWindow::loadTranscoders()
3302 QMenu *transMenu = static_cast<QMenu*>(factory()->container("transcoders", this));
3305 KSharedConfigPtr config = KSharedConfig::openConfig("kdenlivetranscodingrc");
3306 KConfigGroup transConfig(config, "Transcoding");
3308 QMap< QString, QString > profiles = transConfig.entryMap();
3309 QMapIterator<QString, QString> i(profiles);
3310 while (i.hasNext()) {
3312 QStringList data = i.value().split(";", QString::SkipEmptyParts);
3313 QAction *a = transMenu->addAction(i.key());
3315 if (data.count() > 1)
3316 a->setToolTip(data.at(1));
3317 connect(a, SIGNAL(triggered()), this, SLOT(slotTranscode()));
3321 void MainWindow::slotTranscode(KUrl::List urls)
3326 if (urls.isEmpty()) {
3327 QAction *action = qobject_cast<QAction *>(sender());
3328 QStringList data = action->data().toStringList();
3329 params = data.at(0);
3330 if (data.count() > 1) desc = data.at(1);
3331 if (data.count() > 2) condition = data.at(2);
3332 urls << m_projectList->getConditionalUrls(condition);
3333 urls.removeAll(KUrl());
3335 if (urls.isEmpty()) {
3336 m_messageLabel->setMessage(i18n("No clip to transcode"), ErrorMessage);
3339 ClipTranscode *d = new ClipTranscode(urls, params, desc);
3340 connect(d, SIGNAL(addClip(KUrl)), this, SLOT(slotAddProjectClip(KUrl)));
3342 //QProcess::startDetached("ffmpeg", parameters);
3345 void MainWindow::slotTranscodeClip()
3347 KUrl::List urls = KFileDialog::getOpenUrls(KUrl("kfiledialog:///projectfolder"));
3348 if (urls.isEmpty()) return;
3349 slotTranscode(urls);
3352 void MainWindow::slotSetDocumentRenderProfile(const QString &dest, const QString &group, const QString &name, const QString &file)
3354 if (m_activeDocument == NULL) return;
3355 m_activeDocument->setDocumentProperty("renderdestination", dest);
3356 m_activeDocument->setDocumentProperty("rendercategory", group);
3357 m_activeDocument->setDocumentProperty("renderprofile", name);
3358 m_activeDocument->setDocumentProperty("renderurl", file);
3359 m_activeDocument->setModified(true);
3363 void MainWindow::slotPrepareRendering(bool scriptExport, bool zoneOnly, const QString &chapterFile)
3365 if (m_activeDocument == NULL || m_renderWidget == NULL) return;
3367 QString playlistPath;
3370 QString scriptsFolder = m_activeDocument->projectFolder().path() + "/scripts/";
3371 QString path = m_renderWidget->getFreeScriptName();
3372 scriptPath = QInputDialog::getText(this, i18n("Create Render Script"), i18n("Script name (will be saved in: %1)", scriptsFolder), QLineEdit::Normal, KUrl(path).fileName(), &ok);
3373 if (!ok || scriptPath.isEmpty()) return;
3374 scriptPath.prepend(scriptsFolder);
3375 QFile f(scriptPath);
3377 if (KMessageBox::warningYesNo(this, i18n("Script file already exists. Do you want to overwrite it?")) != KMessageBox::Yes)
3380 playlistPath = scriptPath + ".mlt";
3381 m_projectMonitor->saveSceneList(playlistPath);
3383 KTemporaryFile temp;
3384 temp.setAutoRemove(false);
3385 temp.setSuffix(".mlt");
3387 playlistPath = temp.fileName();
3388 m_projectMonitor->saveSceneList(playlistPath);
3391 if (!chapterFile.isEmpty()) {
3394 if (!zoneOnly) out = (int) GenTime(m_activeDocument->projectDuration()).frames(m_activeDocument->fps());
3396 in = m_activeTimeline->inPoint();
3397 out = m_activeTimeline->outPoint();
3400 QDomElement chapters = doc.createElement("chapters");
3401 chapters.setAttribute("fps", m_activeDocument->fps());
3402 doc.appendChild(chapters);
3404 QDomElement guidesxml = m_activeDocument->guidesXml();
3405 QDomNodeList nodes = guidesxml.elementsByTagName("guide");
3406 for (int i = 0; i < nodes.count(); i++) {
3407 QDomElement e = nodes.item(i).toElement();
3409 QString comment = e.attribute("comment");
3410 int time = (int) GenTime(e.attribute("time").toDouble()).frames(m_activeDocument->fps());
3411 if (time >= in && time < out) {
3412 if (zoneOnly) time = time - in;
3413 QDomElement chapter = doc.createElement("chapter");
3414 chapters.appendChild(chapter);
3415 chapter.setAttribute("title", comment);
3416 chapter.setAttribute("time", time);
3420 if (chapters.childNodes().count() > 0) {
3421 if (m_activeTimeline->projectView()->hasGuide(out, 0) == -1) {
3422 // Always insert a guide in pos 0
3423 QDomElement chapter = doc.createElement("chapter");
3424 chapters.insertBefore(chapter, QDomNode());
3425 chapter.setAttribute("title", i18n("Start"));
3426 chapter.setAttribute("time", "0");
3428 // save chapters file
3429 QFile file(chapterFile);
3430 if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
3431 kWarning() << "////// ERROR writing DVD CHAPTER file: " << chapterFile;
3433 file.write(doc.toString().toUtf8());
3434 if (file.error() != QFile::NoError) {
3435 kWarning() << "////// ERROR writing DVD CHAPTER file: " << chapterFile;
3442 m_renderWidget->slotExport(scriptExport, m_activeTimeline->inPoint(), m_activeTimeline->outPoint(), playlistPath, scriptPath);
3445 void MainWindow::slotUpdateTimecodeFormat(int ix)
3447 KdenliveSettings::setFrametimecode(ix == 1);
3448 m_clipMonitor->updateTimecodeFormat();
3449 m_projectMonitor->updateTimecodeFormat();
3450 m_transitionConfig->updateTimecodeFormat();
3451 m_effectStack->updateTimecodeFormat();
3452 //m_activeTimeline->projectView()->clearSelection();
3453 m_activeTimeline->updateRuler();
3456 void MainWindow::slotRemoveFocus()
3458 statusBar()->setFocus();
3459 statusBar()->clearFocus();
3462 void MainWindow::slotRevert()
3464 if (KMessageBox::warningContinueCancel(this, i18n("This will delete all changes made since you last saved your project. Are you sure you want to continue?"), i18n("Revert to last saved version")) == KMessageBox::Cancel) return;
3465 KUrl url = m_activeDocument->url();
3466 closeCurrentDocument(false);
3467 doOpenFile(url, NULL);
3471 void MainWindow::slotShutdown()
3473 if (m_activeDocument) m_activeDocument->setModified(false);
3475 QDBusConnectionInterface* interface = QDBusConnection::sessionBus().interface();
3476 if (interface && interface->isServiceRegistered("org.kde.ksmserver")) {
3477 QDBusInterface smserver("org.kde.ksmserver", "/KSMServer", "org.kde.KSMServerInterface");
3478 smserver.call("logout", 1, 2, 2);
3479 } else if (interface && interface->isServiceRegistered("org.gnome.SessionManager")) {
3480 QDBusInterface smserver("org.gnome.SessionManager", "/org/gnome/SessionManager", "org.gnome.SessionManager");
3481 smserver.call("Shutdown");
3485 void MainWindow::slotUpdateTrackInfo()
3487 if (m_activeDocument)
3488 m_transitionConfig->updateProjectFormat(m_activeDocument->mltProfile(), m_activeDocument->timecode(), m_activeDocument->tracksList());
3491 void MainWindow::slotChangePalette(QAction *action, const QString &themename)
3493 // Load the theme file
3495 if (action == NULL) theme = themename;
3496 else theme = action->data().toString();
3497 KdenliveSettings::setColortheme(theme);
3498 // Make palette for all widgets.
3500 if (theme.isEmpty())
3501 plt = QApplication::desktop()->palette();
3503 KSharedConfigPtr config = KSharedConfig::openConfig(theme);
3504 plt = KGlobalSettings::createApplicationPalette(config);
3507 kapp->setPalette(plt);
3508 const QObjectList children = statusBar()->children();
3510 foreach(QObject *child, children) {
3511 if (child->isWidgetType())
3512 ((QWidget*)child)->setPalette(plt);
3513 const QObjectList subchildren = child->children();
3514 foreach(QObject *subchild, subchildren) {
3515 if (subchild->isWidgetType())
3516 ((QWidget*)subchild)->setPalette(plt);
3519 if (m_activeTimeline)
3520 m_activeTimeline->projectView()->updatePalette();
3524 QPixmap MainWindow::createSchemePreviewIcon(const KSharedConfigPtr &config)
3526 // code taken from kdebase/workspace/kcontrol/colors/colorscm.cpp
3527 const uchar bits1[] = { 0xff, 0xff, 0xff, 0x2c, 0x16, 0x0b };
3528 const uchar bits2[] = { 0x68, 0x34, 0x1a, 0xff, 0xff, 0xff };
3529 const QSize bitsSize(24, 2);
3530 const QBitmap b1 = QBitmap::fromData(bitsSize, bits1);
3531 const QBitmap b2 = QBitmap::fromData(bitsSize, bits2);
3533 QPixmap pixmap(23, 16);
3534 pixmap.fill(Qt::black); // ### use some color other than black for borders?
3536 KConfigGroup group(config, "WM");
3537 QPainter p(&pixmap);
3538 KColorScheme windowScheme(QPalette::Active, KColorScheme::Window, config);
3539 p.fillRect(1, 1, 7, 7, windowScheme.background());
3540 p.fillRect(2, 2, 5, 2, QBrush(windowScheme.foreground().color(), b1));
3542 KColorScheme buttonScheme(QPalette::Active, KColorScheme::Button, config);
3543 p.fillRect(8, 1, 7, 7, buttonScheme.background());
3544 p.fillRect(9, 2, 5, 2, QBrush(buttonScheme.foreground().color(), b1));
3546 p.fillRect(15, 1, 7, 7, group.readEntry("activeBackground", QColor(96, 148, 207)));
3547 p.fillRect(16, 2, 5, 2, QBrush(group.readEntry("activeForeground", QColor(255, 255, 255)), b1));
3549 KColorScheme viewScheme(QPalette::Active, KColorScheme::View, config);
3550 p.fillRect(1, 8, 7, 7, viewScheme.background());
3551 p.fillRect(2, 12, 5, 2, QBrush(viewScheme.foreground().color(), b2));
3553 KColorScheme selectionScheme(QPalette::Active, KColorScheme::Selection, config);
3554 p.fillRect(8, 8, 7, 7, selectionScheme.background());
3555 p.fillRect(9, 12, 5, 2, QBrush(selectionScheme.foreground().color(), b2));
3557 p.fillRect(15, 8, 7, 7, group.readEntry("inactiveBackground", QColor(224, 223, 222)));
3558 p.fillRect(16, 12, 5, 2, QBrush(group.readEntry("inactiveForeground", QColor(20, 19, 18)), b2));
3564 void MainWindow::slotSwitchMonitors()
3566 m_monitorManager->slotSwitchMonitors(!m_clipMonitor->isActive());
3567 if (m_projectMonitor->isActive()) m_activeTimeline->projectView()->setFocus();
3568 else m_projectList->focusTree();
3571 void MainWindow::slotInsertZoneToTree()
3573 if (!m_clipMonitor->isActive() || m_clipMonitor->activeClip() == NULL) return;
3574 QStringList info = m_clipMonitor->getZoneInfo();
3575 m_projectList->slotAddClipCut(info.at(0), info.at(1).toInt(), info.at(2).toInt());
3578 void MainWindow::slotInsertZoneToTimeline()
3580 if (m_activeTimeline == NULL || m_clipMonitor->activeClip() == NULL) return;
3581 QStringList info = m_clipMonitor->getZoneInfo();
3582 m_activeTimeline->projectView()->insertClipCut(m_clipMonitor->activeClip(), info.at(1).toInt(), info.at(2).toInt());
3586 void MainWindow::slotDeleteProjectClips(QStringList ids, QMap<QString, QString> folderids)
3588 if (m_activeDocument && m_activeTimeline) {
3589 if (!ids.isEmpty()) {
3590 for (int i = 0; i < ids.size(); ++i) {
3591 m_activeTimeline->slotDeleteClip(ids.at(i));
3593 m_activeDocument->clipManager()->slotDeleteClips(ids);
3595 if (!folderids.isEmpty()) m_projectList->deleteProjectFolder(folderids);
3596 m_activeDocument->setModified(true);
3600 void MainWindow::slotShowTitleBars(bool show)
3603 m_effectStackDock->setTitleBarWidget(0);
3604 m_clipMonitorDock->setTitleBarWidget(0);
3605 m_projectMonitorDock->setTitleBarWidget(0);
3607 m_recMonitorDock->setTitleBarWidget(0);
3609 m_effectListDock->setTitleBarWidget(0);
3610 m_transitionConfigDock->setTitleBarWidget(0);
3611 m_projectListDock->setTitleBarWidget(0);
3612 m_undoViewDock->setTitleBarWidget(0);
3613 m_vectorscopeDock->setTitleBarWidget(0);
3614 m_waveformDock->setTitleBarWidget(0);
3615 m_RGBParadeDock->setTitleBarWidget(0);
3617 if (!m_effectStackDock->isFloating()) { m_effectStackDock->setTitleBarWidget(new QWidget(this)); }
3618 if (!m_clipMonitorDock->isFloating()) { m_clipMonitorDock->setTitleBarWidget(new QWidget(this)); }
3619 if (!m_projectMonitorDock->isFloating()) { m_projectMonitorDock->setTitleBarWidget(new QWidget(this)); }
3621 if (!m_recMonitorDock->isFloating()) { m_recMonitorDock->setTitleBarWidget(new QWidget(this)); }
3623 if (!m_effectListDock->isFloating()) { m_effectListDock->setTitleBarWidget(new QWidget(this)); }
3624 if (!m_transitionConfigDock->isFloating()) { m_transitionConfigDock->setTitleBarWidget(new QWidget(this)); }
3625 if (!m_projectListDock->isFloating()) { m_projectListDock->setTitleBarWidget(new QWidget(this)); }
3626 if (!m_undoViewDock->isFloating()) { m_undoViewDock->setTitleBarWidget(new QWidget(this)); }
3627 if (!m_vectorscopeDock->isFloating()) { m_vectorscopeDock->setTitleBarWidget(new QWidget(this)); }
3628 if (!m_waveformDock->isFloating()) { m_waveformDock->setTitleBarWidget(new QWidget(this)); }
3629 if (!m_RGBParadeDock->isFloating()) { m_RGBParadeDock->setTitleBarWidget(new QWidget(this)); }
3631 KdenliveSettings::setShowtitlebars(show);
3634 void MainWindow::slotSwitchTitles()
3636 slotShowTitleBars(!KdenliveSettings::showtitlebars());
3639 QString MainWindow::getMimeType()
3641 QString mimetype = "application/x-kdenlive";
3642 KMimeType::Ptr mime = KMimeType::mimeType(mimetype);
3643 if (!mime) mimetype = "*.kdenlive";
3647 #include "mainwindow.moc"