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"
58 #include <KApplication>
62 #include <KActionCollection>
63 #include <KActionCategory>
64 #include <KStandardAction>
65 #include <KShortcutsDialog>
66 #include <KFileDialog>
67 #include <KMessageBox>
69 #include <KIO/NetAccess>
72 #include <KConfigDialog>
73 #include <KXMLGUIFactory>
75 #include <kstandarddirs.h>
76 #include <KUrlRequesterDialog>
77 #include <KTemporaryFile>
79 #include <KActionMenu>
82 #include <ktogglefullscreenaction.h>
84 #include <KNotification>
85 #include <KNotifyConfigWidget>
86 #if KDE_IS_VERSION(4,3,80)
87 #include <knewstuff3/downloaddialog.h>
88 #include <knewstuff3/knewstuffaction.h>
90 #include <knewstuff2/engine.h>
91 #include <knewstuff2/ui/knewstuffaction.h>
93 #endif /* KDE_IS_VERSION(4,3,80) */
95 #include <KColorScheme>
97 #include <QTextStream>
101 #include <QInputDialog>
102 #include <QDesktopWidget>
107 static const char version[] = VERSION;
109 static const int ID_TIMELINE_POS = 0;
116 EffectsList MainWindow::videoEffects;
117 EffectsList MainWindow::audioEffects;
118 EffectsList MainWindow::customEffects;
119 EffectsList MainWindow::transitions;
121 MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, QWidget *parent) :
122 KXmlGuiWindow(parent),
123 m_activeDocument(NULL),
124 m_activeTimeline(NULL),
125 m_renderWidget(NULL),
126 #ifndef NO_JOGSHUTTLE
128 #endif /* NO_JOGSHUTTLE */
129 m_findActivated(false)
132 // Create DBus interface
133 new MainWindowAdaptor(this);
134 QDBusConnection dbus = QDBusConnection::sessionBus();
135 dbus.registerObject("/MainWindow", this);
137 setlocale(LC_NUMERIC, "POSIX");
138 if (!KdenliveSettings::colortheme().isEmpty()) slotChangePalette(NULL, KdenliveSettings::colortheme());
139 setFont(KGlobalSettings::toolBarFont());
140 parseProfiles(MltPath);
141 m_commandStack = new QUndoGroup;
142 m_timelineArea = new KTabWidget(this);
143 m_timelineArea->setTabReorderingEnabled(true);
144 m_timelineArea->setTabBarHidden(true);
145 m_timelineArea->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
146 m_timelineArea->setMinimumHeight(200);
148 QToolButton *closeTabButton = new QToolButton;
149 connect(closeTabButton, SIGNAL(clicked()), this, SLOT(closeCurrentDocument()));
150 closeTabButton->setIcon(KIcon("tab-close"));
151 closeTabButton->adjustSize();
152 closeTabButton->setToolTip(i18n("Close the current tab"));
153 m_timelineArea->setCornerWidget(closeTabButton);
154 connect(m_timelineArea, SIGNAL(currentChanged(int)), this, SLOT(activateDocument()));
156 connect(&m_findTimer, SIGNAL(timeout()), this, SLOT(findTimeout()));
157 m_findTimer.setSingleShot(true);
159 // FIXME: the next call returns a newly allocated object, which leaks
160 initEffects::parseEffectFiles();
161 //initEffects::parseCustomEffectsFile();
163 m_monitorManager = new MonitorManager();
165 m_shortcutRemoveFocus = new QShortcut(QKeySequence("Esc"), this);
166 connect(m_shortcutRemoveFocus, SIGNAL(activated()), this, SLOT(slotRemoveFocus()));
171 m_projectListDock = new QDockWidget(i18n("Project Tree"), this);
172 m_projectListDock->setObjectName("project_tree");
173 m_projectList = new ProjectList(this);
174 m_projectListDock->setWidget(m_projectList);
175 addDockWidget(Qt::TopDockWidgetArea, m_projectListDock);
177 m_effectStackDock = new QDockWidget(i18n("Effect Stack"), this);
178 m_effectStackDock->setObjectName("effect_stack");
179 m_effectStack = new EffectStackView(this);
180 m_effectStackDock->setWidget(m_effectStack);
181 addDockWidget(Qt::TopDockWidgetArea, m_effectStackDock);
183 m_transitionConfigDock = new QDockWidget(i18n("Transition"), this);
184 m_transitionConfigDock->setObjectName("transition");
185 m_transitionConfig = new TransitionSettings(this);
186 m_transitionConfigDock->setWidget(m_transitionConfig);
187 addDockWidget(Qt::TopDockWidgetArea, m_transitionConfigDock);
189 m_clipMonitorDock = new QDockWidget(i18n("Clip Monitor"), this);
190 m_clipMonitorDock->setObjectName("clip_monitor");
191 m_clipMonitor = new Monitor("clip", m_monitorManager, QString(), this);
192 m_clipMonitorDock->setWidget(m_clipMonitor);
193 addDockWidget(Qt::TopDockWidgetArea, m_clipMonitorDock);
195 m_projectMonitorDock = new QDockWidget(i18n("Project Monitor"), this);
196 m_projectMonitorDock->setObjectName("project_monitor");
197 m_projectMonitor = new Monitor("project", m_monitorManager, QString(), this);
198 m_projectMonitorDock->setWidget(m_projectMonitor);
199 addDockWidget(Qt::TopDockWidgetArea, m_projectMonitorDock);
202 m_recMonitorDock = new QDockWidget(i18n("Record Monitor"), this);
203 m_recMonitorDock->setObjectName("record_monitor");
204 m_recMonitor = new RecMonitor("record", this);
205 m_recMonitorDock->setWidget(m_recMonitor);
206 addDockWidget(Qt::TopDockWidgetArea, m_recMonitorDock);
207 connect(m_recMonitor, SIGNAL(addProjectClip(KUrl)), this, SLOT(slotAddProjectClip(KUrl)));
208 connect(m_recMonitor, SIGNAL(showConfigDialog(int, int)), this, SLOT(slotPreferences(int, int)));
211 m_effectListDock = new QDockWidget(i18n("Effect List"), this);
212 m_effectListDock->setObjectName("effect_list");
213 m_effectList = new EffectsListView();
214 m_effectListDock->setWidget(m_effectList);
215 addDockWidget(Qt::TopDockWidgetArea, m_effectListDock);
217 m_vectorscope = new Vectorscope(m_projectMonitor, m_clipMonitor, this);
218 m_vectorscopeDock = new QDockWidget(i18n("Vectorscope"), this);
219 m_vectorscopeDock->setObjectName("vectorscope");
220 m_vectorscopeDock->setWidget(m_vectorscope);
221 addDockWidget(Qt::TopDockWidgetArea, m_vectorscopeDock);
223 m_waveform = new Waveform(m_projectMonitor, m_clipMonitor, this);
224 m_waveformDock = new QDockWidget(i18n("Waveform"), this);
225 m_waveformDock->setObjectName("waveform");
226 m_waveformDock->setWidget(m_waveform);
227 addDockWidget(Qt::TopDockWidgetArea, m_waveformDock);
230 m_undoViewDock = new QDockWidget(i18n("Undo History"), this);
231 m_undoViewDock->setObjectName("undo_history");
232 m_undoView = new QUndoView(this);
233 m_undoView->setCleanIcon(KIcon("edit-clear"));
234 m_undoView->setEmptyLabel(i18n("Clean"));
235 m_undoViewDock->setWidget(m_undoView);
236 m_undoView->setGroup(m_commandStack);
237 addDockWidget(Qt::TopDockWidgetArea, m_undoViewDock);
239 //overviewDock = new QDockWidget(i18n("Project Overview"), this);
240 //overviewDock->setObjectName("project_overview");
241 //m_overView = new CustomTrackView(NULL, NULL, this);
242 //overviewDock->setWidget(m_overView);
243 //addDockWidget(Qt::TopDockWidgetArea, overviewDock);
248 /// Tabify Widgets ///
249 tabifyDockWidget(m_projectListDock, m_effectStackDock);
250 tabifyDockWidget(m_projectListDock, m_transitionConfigDock);
253 tabifyDockWidget(m_clipMonitorDock, m_projectMonitorDock);
255 tabifyDockWidget(m_clipMonitorDock, m_recMonitorDock);
258 tabifyDockWidget(m_vectorscopeDock, m_waveformDock);
259 tabifyDockWidget(m_vectorscopeDock, m_undoViewDock);
260 tabifyDockWidget(m_vectorscopeDock, m_effectListDock);
263 setCentralWidget(m_timelineArea);
266 KdenliveSettings::setCurrent_profile(KdenliveSettings::default_profile());
267 m_fileOpenRecent = KStandardAction::openRecent(this, SLOT(openFile(const KUrl &)), actionCollection());
269 m_fileRevert = KStandardAction::revert(this, SLOT(slotRevert()), actionCollection());
270 m_fileRevert->setEnabled(false);
276 // Find QDockWidget tab bars and show / hide widget title bars on right click
277 QList <QTabBar *> tabs = findChildren<QTabBar *>();
278 for (int i = 0; i < tabs.count(); i++) {
279 tabs.at(i)->setContextMenuPolicy(Qt::CustomContextMenu);
280 connect(tabs.at(i), SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(slotSwitchTitles()));
283 /*ScriptingPart* sp = new ScriptingPart(this, QStringList());
284 guiFactory()->addClient(sp);*/
288 //kDebug() << factory() << " " << factory()->container("video_effects_menu", this);
290 m_projectMonitor->setupMenu(static_cast<QMenu*>(factory()->container("monitor_go", this)), m_playZone, m_loopZone);
291 m_clipMonitor->setupMenu(static_cast<QMenu*>(factory()->container("monitor_go", this)), m_playZone, m_loopZone, static_cast<QMenu*>(factory()->container("marker_menu", this)));
293 QMenu *clipInTimeline = static_cast<QMenu*>(factory()->container("clip_in_timeline", this));
294 clipInTimeline->setIcon(KIcon("go-jump"));
295 m_projectList->setupGeneratorMenu(static_cast<QMenu*>(factory()->container("generators", this)),
296 static_cast<QMenu*>(factory()->container("transcoders", this)),
300 // build themes menus
301 QMenu *themesMenu = static_cast<QMenu*>(factory()->container("themes_menu", this));
302 QActionGroup *themegroup = new QActionGroup(this);
303 themegroup->setExclusive(true);
304 action = new KAction(i18n("Default"), this);
305 action->setCheckable(true);
306 themegroup->addAction(action);
307 if (KdenliveSettings::colortheme().isEmpty()) action->setChecked(true);
309 const QStringList schemeFiles = KGlobal::dirs()->findAllResources("data", "color-schemes/*.colors", KStandardDirs::NoDuplicates);
311 for (int i = 0; i < schemeFiles.size(); ++i) {
313 const QString filename = schemeFiles.at(i);
314 const QFileInfo info(filename);
317 KSharedConfigPtr config = KSharedConfig::openConfig(filename);
318 QIcon icon = createSchemePreviewIcon(config);
319 KConfigGroup group(config, "General");
320 const QString name = group.readEntry("Name", info.baseName());
321 action = new KAction(name, this);
322 action->setData(filename);
323 action->setIcon(icon);
324 action->setCheckable(true);
325 themegroup->addAction(action);
326 if (KdenliveSettings::colortheme() == filename) action->setChecked(true);
329 /*KGlobal::dirs()->addResourceDir("themes", KStandardDirs::installPath("data") + QString("kdenlive/themes"));
330 QStringList themes = KGlobal::dirs()->findAllResources("themes", QString(), KStandardDirs::Recursive | KStandardDirs::NoDuplicates);
331 for (QStringList::const_iterator it = themes.constBegin(); it != themes.constEnd(); ++it)
334 action = new QAction(fi.fileName(), this);
335 action->setData(*it);
336 action->setCheckable(true);
337 themegroup->addAction(action);
338 if (KdenliveSettings::colortheme() == *it) action->setChecked(true);
340 themesMenu->addActions(themegroup->actions());
341 connect(themesMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotChangePalette(QAction*)));
343 // Setup and fill effects and transitions menus.
344 m_videoEffectsMenu = static_cast<QMenu*>(factory()->container("video_effects_menu", this));
345 for (int i = 0; i < videoEffects.count(); ++i)
346 m_videoEffectsMenu->addAction(m_videoEffects[i]);
347 m_audioEffectsMenu = static_cast<QMenu*>(factory()->container("audio_effects_menu", this));
348 for (int i = 0; i < audioEffects.count(); ++i)
349 m_audioEffectsMenu->addAction(m_audioEffects[i]);
350 m_customEffectsMenu = static_cast<QMenu*>(factory()->container("custom_effects_menu", this));
351 if (customEffects.isEmpty())
352 m_customEffectsMenu->setEnabled(false);
354 m_customEffectsMenu->setEnabled(true);
355 for (int i = 0; i < customEffects.count(); ++i)
356 m_customEffectsMenu->addAction(m_customEffects[i]);
357 m_transitionsMenu = new QMenu(i18n("Add Transition"), this);
358 for (int i = 0; i < transitions.count(); ++i)
359 m_transitionsMenu->addAction(m_transitions[i]);
361 connect(m_videoEffectsMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotAddVideoEffect(QAction *)));
362 connect(m_audioEffectsMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotAddAudioEffect(QAction *)));
363 connect(m_customEffectsMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotAddCustomEffect(QAction *)));
364 connect(m_transitionsMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotAddTransition(QAction *)));
366 QMenu *newEffect = new QMenu(this);
367 newEffect->addMenu(m_videoEffectsMenu);
368 newEffect->addMenu(m_audioEffectsMenu);
369 newEffect->addMenu(m_customEffectsMenu);
370 m_effectStack->setMenu(newEffect);
372 QMenu *viewMenu = static_cast<QMenu*>(factory()->container("dockwindows", this));
373 const QList<QAction *> viewActions = createPopupMenu()->actions();
374 viewMenu->insertActions(NULL, viewActions);
376 m_timelineContextMenu = new QMenu(this);
377 m_timelineContextClipMenu = new QMenu(this);
378 m_timelineContextTransitionMenu = new QMenu(this);
380 m_timelineContextMenu->addAction(actionCollection()->action("insert_space"));
381 m_timelineContextMenu->addAction(actionCollection()->action("delete_space"));
382 m_timelineContextMenu->addAction(actionCollection()->action(KStandardAction::name(KStandardAction::Paste)));
384 m_timelineContextClipMenu->addAction(actionCollection()->action("clip_in_project_tree"));
385 //m_timelineContextClipMenu->addAction(actionCollection()->action("clip_to_project_tree"));
386 m_timelineContextClipMenu->addAction(actionCollection()->action("edit_item_duration"));
387 m_timelineContextClipMenu->addAction(actionCollection()->action("delete_item"));
388 m_timelineContextClipMenu->addSeparator();
389 m_timelineContextClipMenu->addAction(actionCollection()->action("group_clip"));
390 m_timelineContextClipMenu->addAction(actionCollection()->action("ungroup_clip"));
391 m_timelineContextClipMenu->addAction(actionCollection()->action("split_audio"));
392 m_timelineContextClipMenu->addSeparator();
393 m_timelineContextClipMenu->addAction(actionCollection()->action("cut_timeline_clip"));
394 m_timelineContextClipMenu->addAction(actionCollection()->action(KStandardAction::name(KStandardAction::Copy)));
395 m_timelineContextClipMenu->addAction(actionCollection()->action("paste_effects"));
396 m_timelineContextClipMenu->addSeparator();
398 QMenu *markersMenu = (QMenu*)(factory()->container("marker_menu", this));
399 m_timelineContextClipMenu->addMenu(markersMenu);
400 m_timelineContextClipMenu->addSeparator();
401 m_timelineContextClipMenu->addMenu(m_transitionsMenu);
402 m_timelineContextClipMenu->addMenu(m_videoEffectsMenu);
403 m_timelineContextClipMenu->addMenu(m_audioEffectsMenu);
404 //TODO: re-enable custom effects menu when it is implemented
405 m_timelineContextClipMenu->addMenu(m_customEffectsMenu);
407 m_timelineContextTransitionMenu->addAction(actionCollection()->action("edit_item_duration"));
408 m_timelineContextTransitionMenu->addAction(actionCollection()->action("delete_item"));
409 m_timelineContextTransitionMenu->addAction(actionCollection()->action(KStandardAction::name(KStandardAction::Copy)));
411 m_timelineContextTransitionMenu->addAction(actionCollection()->action("auto_transition"));
413 connect(m_projectMonitorDock, SIGNAL(visibilityChanged(bool)), m_projectMonitor, SLOT(refreshMonitor(bool)));
414 connect(m_clipMonitorDock, SIGNAL(visibilityChanged(bool)), m_clipMonitor, SLOT(refreshMonitor(bool)));
415 //connect(m_monitorManager, SIGNAL(connectMonitors()), this, SLOT(slotConnectMonitors()));
416 connect(m_monitorManager, SIGNAL(raiseClipMonitor(bool)), this, SLOT(slotRaiseMonitor(bool)));
417 connect(m_monitorManager, SIGNAL(raiseClipMonitor(bool)), m_vectorscope, SLOT(slotActiveMonitorChanged(bool)));
418 connect(m_monitorManager, SIGNAL(raiseClipMonitor(bool)), m_waveform, SLOT(slotActiveMonitorChanged(bool)));
419 connect(m_effectList, SIGNAL(addEffect(const QDomElement)), this, SLOT(slotAddEffect(const QDomElement)));
420 connect(m_effectList, SIGNAL(reloadEffects()), this, SLOT(slotReloadEffects()));
422 m_monitorManager->initMonitors(m_clipMonitor, m_projectMonitor);
423 slotConnectMonitors();
425 // Disable drop B frames, see Kdenlive issue #1330, see also kdenlivesettingsdialog.cpp
426 KdenliveSettings::setDropbframes(false);
428 // Open or create a file. Command line argument passed in Url has
429 // precedence, then "openlastproject", then just a plain empty file.
430 // If opening Url fails, openlastproject will _not_ be used.
431 if (!Url.isEmpty()) {
432 // delay loading so that the window shows up
434 QTimer::singleShot(500, this, SLOT(openFile()));
435 } else if (KdenliveSettings::openlastproject()) {
436 QTimer::singleShot(500, this, SLOT(openLastFile()));
437 } else { //if (m_timelineArea->count() == 0) {
441 #ifndef NO_JOGSHUTTLE
442 activateShuttleDevice();
443 #endif /* NO_JOGSHUTTLE */
444 m_projectListDock->raise();
447 void MainWindow::queryQuit()
450 if (m_projectMonitor) m_projectMonitor->stop();
451 if (m_clipMonitor) m_clipMonitor->stop();
452 delete m_effectStack;
453 delete m_activeTimeline;
455 // This sometimes causes crash on exit on OS X for some reason.
456 delete m_projectMonitor;
457 delete m_clipMonitor;
459 delete m_activeDocument;
460 delete m_shortcutRemoveFocus;
461 Mlt::Factory::close();
467 bool MainWindow::queryClose()
469 if (m_renderWidget) {
470 int waitingJobs = m_renderWidget->waitingJobsCount();
471 if (waitingJobs > 0) {
472 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")))) {
473 case KMessageBox::Yes :
474 // create script with waiting jobs and start it
475 if (m_renderWidget->startWaitingRenderJobs() == false) return false;
477 case KMessageBox::No :
478 // Don't do anything, jobs will be deleted
486 if (m_monitorManager) m_monitorManager->stopActiveMonitor();
487 // warn the user to save if document is modified and we have clips in our project list
488 if (m_activeDocument && m_activeDocument->isModified() &&
489 ((m_projectList->documentClipList().isEmpty() && !m_activeDocument->url().isEmpty()) ||
490 !m_projectList->documentClipList().isEmpty())) {
492 if (m_activeDocument->url().fileName().isEmpty())
493 message = i18n("Save changes to document?");
495 message = i18n("The project <b>\"%1\"</b> has been changed.\nDo you want to save your changes?").arg(m_activeDocument->url().fileName());
496 switch (KMessageBox::warningYesNoCancel(this, message)) {
497 case KMessageBox::Yes :
498 // save document here. If saving fails, return false;
500 case KMessageBox::No :
501 // User does not want to save the changes, clear recovery files
502 m_activeDocument->m_autosave->resize(0);
511 void MainWindow::loadPlugins()
513 foreach(QObject *plugin, QPluginLoader::staticInstances()) {
514 populateMenus(plugin);
517 QStringList directories = KGlobal::dirs()->findDirs("module", QString());
519 filters << "libkdenlive*";
520 foreach(const QString &folder, directories) {
521 kDebug() << "Parsing plugin folder: " << folder;
522 QDir pluginsDir(folder);
523 foreach(const QString &fileName,
524 pluginsDir.entryList(filters, QDir::Files)) {
526 * Avoid loading the same plugin twice when there is more than one
529 if (!m_pluginFileNames.contains(fileName)) {
530 kDebug() << "Found plugin: " << fileName;
531 QPluginLoader loader(pluginsDir.absoluteFilePath(fileName));
532 QObject *plugin = loader.instance();
534 populateMenus(plugin);
535 m_pluginFileNames += fileName;
537 kDebug() << "Error loading plugin: " << fileName << ", " << loader.errorString();
543 void MainWindow::populateMenus(QObject *plugin)
545 QMenu *addMenu = static_cast<QMenu*>(factory()->container("generators", this));
546 ClipGenerator *iGenerator = qobject_cast<ClipGenerator *>(plugin);
548 addToMenu(plugin, iGenerator->generators(KdenliveSettings::producerslist()), addMenu, SLOT(generateClip()),
552 void MainWindow::addToMenu(QObject *plugin, const QStringList &texts,
553 QMenu *menu, const char *member,
554 QActionGroup *actionGroup)
556 kDebug() << "// ADD to MENU" << texts;
557 foreach(const QString &text, texts) {
558 QAction *action = new QAction(text, plugin);
559 action->setData(text);
560 connect(action, SIGNAL(triggered()), this, member);
561 menu->addAction(action);
564 action->setCheckable(true);
565 actionGroup->addAction(action);
570 void MainWindow::aboutPlugins()
572 //PluginDialog dialog(pluginsDir.path(), m_pluginFileNames, this);
577 void MainWindow::generateClip()
579 QAction *action = qobject_cast<QAction *>(sender());
580 ClipGenerator *iGenerator = qobject_cast<ClipGenerator *>(action->parent());
582 KUrl clipUrl = iGenerator->generatedClip(action->data().toString(), m_activeDocument->projectFolder(),
583 QStringList(), QStringList(), m_activeDocument->fps(), m_activeDocument->width(), m_activeDocument->height());
584 if (!clipUrl.isEmpty()) {
585 m_projectList->slotAddClip(QList <QUrl> () << clipUrl);
589 void MainWindow::saveProperties(KConfigGroup &config)
591 // save properties here,used by session management
593 KMainWindow::saveProperties(config);
597 void MainWindow::readProperties(const KConfigGroup &config)
599 // read properties here,used by session management
600 KMainWindow::readProperties(config);
601 QString Lastproject = config.group("Recent Files").readPathEntry("File1", QString());
602 openFile(KUrl(Lastproject));
605 void MainWindow::slotReloadEffects()
607 m_customEffectsMenu->clear();
608 initEffects::parseCustomEffectsFile();
610 QStringList effectInfo;
611 QMap<QString, QStringList> effectsList;
612 for (int ix = 0; ix < customEffects.count(); ix++) {
613 effectInfo = customEffects.effectIdInfo(ix);
614 effectsList.insert(effectInfo.at(0).toLower(), effectInfo);
616 if (effectsList.isEmpty())
617 m_customEffectsMenu->setEnabled(false);
619 m_customEffectsMenu->setEnabled(true);
621 foreach(const QStringList &value, effectsList) {
622 action = new QAction(value.at(0), this);
623 action->setData(value);
624 m_customEffectsMenu->addAction(action);
626 m_effectList->reloadEffectList();
629 #ifndef NO_JOGSHUTTLE
630 void MainWindow::activateShuttleDevice()
634 if (KdenliveSettings::enableshuttle() == false) return;
635 m_jogProcess = new JogShuttle(KdenliveSettings::shuttledevice());
636 connect(m_jogProcess, SIGNAL(rewind1()), m_monitorManager, SLOT(slotRewindOneFrame()));
637 connect(m_jogProcess, SIGNAL(forward1()), m_monitorManager, SLOT(slotForwardOneFrame()));
638 connect(m_jogProcess, SIGNAL(rewind(double)), m_monitorManager, SLOT(slotRewind(double)));
639 connect(m_jogProcess, SIGNAL(forward(double)), m_monitorManager, SLOT(slotForward(double)));
640 connect(m_jogProcess, SIGNAL(stop()), m_monitorManager, SLOT(slotPlay()));
641 connect(m_jogProcess, SIGNAL(button(int)), this, SLOT(slotShuttleButton(int)));
644 void MainWindow::slotShuttleButton(int code)
648 slotShuttleAction(KdenliveSettings::shuttle1());
651 slotShuttleAction(KdenliveSettings::shuttle2());
654 slotShuttleAction(KdenliveSettings::shuttle3());
657 slotShuttleAction(KdenliveSettings::shuttle4());
660 slotShuttleAction(KdenliveSettings::shuttle5());
665 void MainWindow::slotShuttleAction(int code)
671 m_monitorManager->slotPlay();
674 m_monitorManager->slotPlay();
678 #endif /* NO_JOGSHUTTLE */
680 void MainWindow::configureNotifications()
682 KNotifyConfigWidget::configure(this);
685 void MainWindow::slotFullScreen()
687 KToggleFullScreenAction::setFullScreen(this, actionCollection()->action("fullscreen")->isChecked());
690 void MainWindow::slotAddEffect(const QDomElement effect, GenTime pos, int track)
692 if (!m_activeDocument) return;
693 if (effect.isNull()) {
694 kDebug() << "--- ERROR, TRYING TO APPEND NULL EFFECT";
697 QDomElement effectToAdd = effect.cloneNode().toElement();
698 m_activeTimeline->projectView()->slotAddEffect(effectToAdd, pos, track);
701 void MainWindow::slotRaiseMonitor(bool clipMonitor)
703 if (clipMonitor) m_clipMonitorDock->raise();
704 else m_projectMonitorDock->raise();
707 void MainWindow::slotUpdateClip(const QString &id)
709 if (!m_activeDocument) return;
710 m_activeTimeline->projectView()->slotUpdateClip(id);
713 void MainWindow::slotConnectMonitors()
715 m_projectList->setRenderer(m_projectMonitor->render);
716 //connect(m_projectList, SIGNAL(receivedClipDuration(const QString &)), this, SLOT(slotUpdateClip(const QString &)));
717 connect(m_projectList, SIGNAL(deleteProjectClips(QStringList, QMap<QString, QString>)), this, SLOT(slotDeleteProjectClips(QStringList, QMap<QString, QString>)));
718 connect(m_projectList, SIGNAL(showClipProperties(DocClipBase *)), this, SLOT(slotShowClipProperties(DocClipBase *)));
719 connect(m_projectList, SIGNAL(showClipProperties(QList <DocClipBase *>, QMap<QString, QString>)), this, SLOT(slotShowClipProperties(QList <DocClipBase *>, QMap<QString, QString>)));
720 connect(m_projectList, SIGNAL(getFileProperties(const QDomElement, const QString &, int, bool)), m_projectMonitor->render, SLOT(getFileProperties(const QDomElement, const QString &, int, bool)));
721 connect(m_projectMonitor->render, SIGNAL(replyGetImage(const QString &, const QPixmap &)), m_projectList, SLOT(slotReplyGetImage(const QString &, const QPixmap &)));
722 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)));
724 connect(m_projectMonitor->render, SIGNAL(removeInvalidClip(const QString &, bool)), m_projectList, SLOT(slotRemoveInvalidClip(const QString &, bool)));
726 connect(m_clipMonitor, SIGNAL(refreshClipThumbnail(const QString &)), m_projectList, SLOT(slotRefreshClipThumbnail(const QString &)));
728 connect(m_clipMonitor, SIGNAL(adjustMonitorSize()), this, SLOT(slotAdjustClipMonitor()));
729 connect(m_projectMonitor, SIGNAL(adjustMonitorSize()), this, SLOT(slotAdjustProjectMonitor()));
731 connect(m_clipMonitor, SIGNAL(saveZone(Render *, QPoint)), this, SLOT(slotSaveZone(Render *, QPoint)));
732 connect(m_projectMonitor, SIGNAL(saveZone(Render *, QPoint)), this, SLOT(slotSaveZone(Render *, QPoint)));
735 void MainWindow::slotAdjustClipMonitor()
737 m_clipMonitorDock->updateGeometry();
738 m_clipMonitorDock->adjustSize();
739 m_clipMonitor->resetSize();
742 void MainWindow::slotAdjustProjectMonitor()
744 m_projectMonitorDock->updateGeometry();
745 m_projectMonitorDock->adjustSize();
746 m_projectMonitor->resetSize();
749 void MainWindow::setupActions()
752 KActionCollection* collection = actionCollection();
753 m_timecodeFormat = new KComboBox(this);
754 m_timecodeFormat->addItem(i18n("hh:mm:ss::ff"));
755 m_timecodeFormat->addItem(i18n("Frames"));
756 if (KdenliveSettings::frametimecode()) m_timecodeFormat->setCurrentIndex(1);
757 connect(m_timecodeFormat, SIGNAL(activated(int)), this, SLOT(slotUpdateTimecodeFormat(int)));
759 m_statusProgressBar = new QProgressBar(this);
760 m_statusProgressBar->setMinimum(0);
761 m_statusProgressBar->setMaximum(100);
762 m_statusProgressBar->setMaximumWidth(150);
763 m_statusProgressBar->setVisible(false);
765 KToolBar *toolbar = new KToolBar("statusToolBar", this, Qt::BottomToolBarArea);
766 toolbar->setMovable(false);
767 statusBar()->setStyleSheet(QString("QStatusBar QLabel {font-size:%1pt;} QStatusBar::item { border: 0px; font-size:%1pt;padding:0px; }").arg(statusBar()->font().pointSize()));
768 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;}";
769 QString styleBorderless = "QToolButton { border-width: 0px;margin: 1px 3px 0px;padding: 0px;}";
771 //create edit mode buttons
772 m_normalEditTool = new KAction(KIcon("kdenlive-normal-edit"), i18n("Normal mode"), this);
773 m_normalEditTool->setShortcut(i18nc("Normal editing", "n"));
774 toolbar->addAction(m_normalEditTool);
775 m_normalEditTool->setCheckable(true);
776 m_normalEditTool->setChecked(true);
778 m_overwriteEditTool = new KAction(KIcon("kdenlive-overwrite-edit"), i18n("Overwrite mode"), this);
779 //m_overwriteEditTool->setShortcut(i18nc("Overwrite mode shortcut", "o"));
780 toolbar->addAction(m_overwriteEditTool);
781 m_overwriteEditTool->setCheckable(true);
782 m_overwriteEditTool->setChecked(false);
784 m_insertEditTool = new KAction(KIcon("kdenlive-insert-edit"), i18n("Insert mode"), this);
785 //m_insertEditTool->setShortcut(i18nc("Insert mode shortcut", "i"));
786 toolbar->addAction(m_insertEditTool);
787 m_insertEditTool->setCheckable(true);
788 m_insertEditTool->setChecked(false);
789 // not implemented yet
790 m_insertEditTool->setEnabled(false);
792 QActionGroup *editGroup = new QActionGroup(this);
793 editGroup->addAction(m_normalEditTool);
794 editGroup->addAction(m_overwriteEditTool);
795 editGroup->addAction(m_insertEditTool);
796 editGroup->setExclusive(true);
797 connect(editGroup, SIGNAL(triggered(QAction *)), this, SLOT(slotChangeEdit(QAction *)));
798 //connect(m_overwriteEditTool, SIGNAL(toggled(bool)), this, SLOT(slotSetOverwriteMode(bool)));
800 toolbar->addSeparator();
802 // create tools buttons
803 m_buttonSelectTool = new KAction(KIcon("kdenlive-select-tool"), i18n("Selection tool"), this);
804 m_buttonSelectTool->setShortcut(i18nc("Selection tool shortcut", "s"));
805 toolbar->addAction(m_buttonSelectTool);
806 m_buttonSelectTool->setCheckable(true);
807 m_buttonSelectTool->setChecked(true);
809 m_buttonRazorTool = new KAction(KIcon("edit-cut"), i18n("Razor tool"), this);
810 m_buttonRazorTool->setShortcut(i18nc("Razor tool shortcut", "x"));
811 toolbar->addAction(m_buttonRazorTool);
812 m_buttonRazorTool->setCheckable(true);
813 m_buttonRazorTool->setChecked(false);
815 m_buttonSpacerTool = new KAction(KIcon("kdenlive-spacer-tool"), i18n("Spacer tool"), this);
816 m_buttonSpacerTool->setShortcut(i18nc("Spacer tool shortcut", "m"));
817 toolbar->addAction(m_buttonSpacerTool);
818 m_buttonSpacerTool->setCheckable(true);
819 m_buttonSpacerTool->setChecked(false);
821 QActionGroup *toolGroup = new QActionGroup(this);
822 toolGroup->addAction(m_buttonSelectTool);
823 toolGroup->addAction(m_buttonRazorTool);
824 toolGroup->addAction(m_buttonSpacerTool);
825 toolGroup->setExclusive(true);
826 toolbar->setToolButtonStyle(Qt::ToolButtonIconOnly);
828 QWidget * actionWidget;
829 int max = toolbar->iconSizeDefault() + 2;
830 actionWidget = toolbar->widgetForAction(m_normalEditTool);
831 actionWidget->setMaximumWidth(max);
832 actionWidget->setMaximumHeight(max - 4);
834 actionWidget = toolbar->widgetForAction(m_insertEditTool);
835 actionWidget->setMaximumWidth(max);
836 actionWidget->setMaximumHeight(max - 4);
838 actionWidget = toolbar->widgetForAction(m_overwriteEditTool);
839 actionWidget->setMaximumWidth(max);
840 actionWidget->setMaximumHeight(max - 4);
842 actionWidget = toolbar->widgetForAction(m_buttonSelectTool);
843 actionWidget->setMaximumWidth(max);
844 actionWidget->setMaximumHeight(max - 4);
846 actionWidget = toolbar->widgetForAction(m_buttonRazorTool);
847 actionWidget->setMaximumWidth(max);
848 actionWidget->setMaximumHeight(max - 4);
850 actionWidget = toolbar->widgetForAction(m_buttonSpacerTool);
851 actionWidget->setMaximumWidth(max);
852 actionWidget->setMaximumHeight(max - 4);
854 toolbar->setStyleSheet(style1);
855 connect(toolGroup, SIGNAL(triggered(QAction *)), this, SLOT(slotChangeTool(QAction *)));
857 toolbar->addSeparator();
858 m_buttonFitZoom = new KAction(KIcon("zoom-fit-best"), i18n("Fit zoom to project"), this);
859 toolbar->addAction(m_buttonFitZoom);
860 m_buttonFitZoom->setCheckable(false);
862 m_zoomOut = new KAction(KIcon("zoom-out"), i18n("Zoom Out"), this);
863 toolbar->addAction(m_zoomOut);
864 m_zoomOut->setShortcut(Qt::CTRL + Qt::Key_Minus);
866 m_zoomSlider = new QSlider(Qt::Horizontal, this);
867 m_zoomSlider->setMaximum(13);
868 m_zoomSlider->setPageStep(1);
869 m_zoomSlider->setInvertedAppearance(true);
871 m_zoomSlider->setMaximumWidth(150);
872 m_zoomSlider->setMinimumWidth(100);
873 toolbar->addWidget(m_zoomSlider);
875 m_zoomIn = new KAction(KIcon("zoom-in"), i18n("Zoom In"), this);
876 toolbar->addAction(m_zoomIn);
877 m_zoomIn->setShortcut(Qt::CTRL + Qt::Key_Plus);
879 actionWidget = toolbar->widgetForAction(m_buttonFitZoom);
880 actionWidget->setMaximumWidth(max);
881 actionWidget->setMaximumHeight(max - 4);
882 actionWidget->setStyleSheet(styleBorderless);
884 actionWidget = toolbar->widgetForAction(m_zoomIn);
885 actionWidget->setMaximumWidth(max);
886 actionWidget->setMaximumHeight(max - 4);
887 actionWidget->setStyleSheet(styleBorderless);
889 actionWidget = toolbar->widgetForAction(m_zoomOut);
890 actionWidget->setMaximumWidth(max);
891 actionWidget->setMaximumHeight(max - 4);
892 actionWidget->setStyleSheet(styleBorderless);
894 connect(m_zoomSlider, SIGNAL(valueChanged(int)), this, SLOT(slotSetZoom(int)));
895 connect(m_zoomSlider, SIGNAL(sliderMoved(int)), this, SLOT(slotShowZoomSliderToolTip(int)));
896 connect(m_buttonFitZoom, SIGNAL(triggered()), this, SLOT(slotFitZoom()));
897 connect(m_zoomIn, SIGNAL(triggered(bool)), this, SLOT(slotZoomIn()));
898 connect(m_zoomOut, SIGNAL(triggered(bool)), this, SLOT(slotZoomOut()));
900 toolbar->addSeparator();
902 //create automatic audio split button
903 m_buttonAutomaticSplitAudio = new KAction(KIcon("kdenlive-split-audio"), i18n("Split audio and video automatically"), this);
904 toolbar->addAction(m_buttonAutomaticSplitAudio);
905 m_buttonAutomaticSplitAudio->setCheckable(true);
906 m_buttonAutomaticSplitAudio->setChecked(KdenliveSettings::splitaudio());
907 connect(m_buttonAutomaticSplitAudio, SIGNAL(triggered()), this, SLOT(slotSwitchSplitAudio()));
909 m_buttonVideoThumbs = new KAction(KIcon("kdenlive-show-videothumb"), i18n("Show video thumbnails"), this);
910 toolbar->addAction(m_buttonVideoThumbs);
911 m_buttonVideoThumbs->setCheckable(true);
912 m_buttonVideoThumbs->setChecked(KdenliveSettings::videothumbnails());
913 connect(m_buttonVideoThumbs, SIGNAL(triggered()), this, SLOT(slotSwitchVideoThumbs()));
915 m_buttonAudioThumbs = new KAction(KIcon("kdenlive-show-audiothumb"), i18n("Show audio thumbnails"), this);
916 toolbar->addAction(m_buttonAudioThumbs);
917 m_buttonAudioThumbs->setCheckable(true);
918 m_buttonAudioThumbs->setChecked(KdenliveSettings::audiothumbnails());
919 connect(m_buttonAudioThumbs, SIGNAL(triggered()), this, SLOT(slotSwitchAudioThumbs()));
921 m_buttonShowMarkers = new KAction(KIcon("kdenlive-show-markers"), i18n("Show markers comments"), this);
922 toolbar->addAction(m_buttonShowMarkers);
923 m_buttonShowMarkers->setCheckable(true);
924 m_buttonShowMarkers->setChecked(KdenliveSettings::showmarkers());
925 connect(m_buttonShowMarkers, SIGNAL(triggered()), this, SLOT(slotSwitchMarkersComments()));
927 m_buttonSnap = new KAction(KIcon("kdenlive-snap"), i18n("Snap"), this);
928 toolbar->addAction(m_buttonSnap);
929 m_buttonSnap->setCheckable(true);
930 m_buttonSnap->setChecked(KdenliveSettings::snaptopoints());
931 connect(m_buttonSnap, SIGNAL(triggered()), this, SLOT(slotSwitchSnap()));
933 actionWidget = toolbar->widgetForAction(m_buttonAutomaticSplitAudio);
934 actionWidget->setMaximumWidth(max);
935 actionWidget->setMaximumHeight(max - 4);
937 actionWidget = toolbar->widgetForAction(m_buttonVideoThumbs);
938 actionWidget->setMaximumWidth(max);
939 actionWidget->setMaximumHeight(max - 4);
941 actionWidget = toolbar->widgetForAction(m_buttonAudioThumbs);
942 actionWidget->setMaximumWidth(max);
943 actionWidget->setMaximumHeight(max - 4);
945 actionWidget = toolbar->widgetForAction(m_buttonShowMarkers);
946 actionWidget->setMaximumWidth(max);
947 actionWidget->setMaximumHeight(max - 4);
949 actionWidget = toolbar->widgetForAction(m_buttonSnap);
950 actionWidget->setMaximumWidth(max);
951 actionWidget->setMaximumHeight(max - 4);
953 m_messageLabel = new StatusBarMessageLabel(this);
954 m_messageLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding);
956 statusBar()->addWidget(m_messageLabel, 10);
957 statusBar()->addWidget(m_statusProgressBar, 0);
958 statusBar()->addPermanentWidget(toolbar);
959 statusBar()->insertPermanentFixedItem("00:00:00:00", ID_TIMELINE_POS);
960 statusBar()->addPermanentWidget(m_timecodeFormat);
961 //statusBar()->setMaximumHeight(statusBar()->font().pointSize() * 3);
963 collection->addAction("normal_mode", m_normalEditTool);
964 collection->addAction("overwrite_mode", m_overwriteEditTool);
965 collection->addAction("insert_mode", m_insertEditTool);
966 collection->addAction("select_tool", m_buttonSelectTool);
967 collection->addAction("razor_tool", m_buttonRazorTool);
968 collection->addAction("spacer_tool", m_buttonSpacerTool);
970 collection->addAction("automatic_split_audio", m_buttonAutomaticSplitAudio);
971 collection->addAction("show_video_thumbs", m_buttonVideoThumbs);
972 collection->addAction("show_audio_thumbs", m_buttonAudioThumbs);
973 collection->addAction("show_markers", m_buttonShowMarkers);
974 collection->addAction("snap", m_buttonSnap);
975 collection->addAction("zoom_fit", m_buttonFitZoom);
976 collection->addAction("zoom_in", m_zoomIn);
977 collection->addAction("zoom_out", m_zoomOut);
979 m_projectSearch = new KAction(KIcon("edit-find"), i18n("Find"), this);
980 collection->addAction("project_find", m_projectSearch);
981 connect(m_projectSearch, SIGNAL(triggered(bool)), this, SLOT(slotFind()));
982 m_projectSearch->setShortcut(Qt::Key_Slash);
984 m_projectSearchNext = new KAction(KIcon("go-down-search"), i18n("Find Next"), this);
985 collection->addAction("project_find_next", m_projectSearchNext);
986 connect(m_projectSearchNext, SIGNAL(triggered(bool)), this, SLOT(slotFindNext()));
987 m_projectSearchNext->setShortcut(Qt::Key_F3);
988 m_projectSearchNext->setEnabled(false);
990 KAction* profilesAction = new KAction(KIcon("document-new"), i18n("Manage Project Profiles"), this);
991 collection->addAction("manage_profiles", profilesAction);
992 connect(profilesAction, SIGNAL(triggered(bool)), this, SLOT(slotEditProfiles()));
994 KNS3::standardAction(i18n("Download New Wipes..."), this, SLOT(slotGetNewLumaStuff()), actionCollection(), "get_new_lumas");
995 KNS3::standardAction(i18n("Download New Render Profiles..."), this, SLOT(slotGetNewRenderStuff()), actionCollection(), "get_new_profiles");
996 KNS3::standardAction(i18n("Download New Project Profiles..."), this, SLOT(slotGetNewMltProfileStuff()), actionCollection(), "get_new_mlt_profiles");
997 KNS3::standardAction(i18n("Download New Title Templates..."), this, SLOT(slotGetNewTitleStuff()), actionCollection(), "get_new_titles");
999 KAction* wizAction = new KAction(KIcon("configure"), i18n("Run Config Wizard"), this);
1000 collection->addAction("run_wizard", wizAction);
1001 connect(wizAction, SIGNAL(triggered(bool)), this, SLOT(slotRunWizard()));
1003 KAction* projectAction = new KAction(KIcon("configure"), i18n("Project Settings"), this);
1004 collection->addAction("project_settings", projectAction);
1005 connect(projectAction, SIGNAL(triggered(bool)), this, SLOT(slotEditProjectSettings()));
1007 KAction* projectRender = new KAction(KIcon("media-record"), i18n("Render"), this);
1008 collection->addAction("project_render", projectRender);
1009 projectRender->setShortcut(Qt::CTRL + Qt::Key_Return);
1010 connect(projectRender, SIGNAL(triggered(bool)), this, SLOT(slotRenderProject()));
1012 KAction* projectClean = new KAction(KIcon("edit-clear"), i18n("Clean Project"), this);
1013 collection->addAction("project_clean", projectClean);
1014 connect(projectClean, SIGNAL(triggered(bool)), this, SLOT(slotCleanProject()));
1016 KAction* monitorPlay = new KAction(KIcon("media-playback-start"), i18n("Play"), this);
1017 KShortcut playShortcut;
1018 playShortcut.setPrimary(Qt::Key_Space);
1019 playShortcut.setAlternate(Qt::Key_K);
1020 monitorPlay->setShortcut(playShortcut);
1021 collection->addAction("monitor_play", monitorPlay);
1022 connect(monitorPlay, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotPlay()));
1024 m_playZone = new KAction(KIcon("media-playback-start"), i18n("Play Zone"), this);
1025 m_playZone->setShortcut(Qt::CTRL + Qt::Key_Space);
1026 collection->addAction("monitor_play_zone", m_playZone);
1027 connect(m_playZone, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotPlayZone()));
1029 m_loopZone = new KAction(KIcon("media-playback-start"), i18n("Loop Zone"), this);
1030 m_loopZone->setShortcut(Qt::ALT + Qt::Key_Space);
1031 collection->addAction("monitor_loop_zone", m_loopZone);
1032 connect(m_loopZone, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotLoopZone()));
1034 KAction *dvdWizard = new KAction(KIcon("media-optical"), i18n("DVD Wizard"), this);
1035 collection->addAction("dvd_wizard", dvdWizard);
1036 connect(dvdWizard, SIGNAL(triggered(bool)), this, SLOT(slotDvdWizard()));
1038 KAction *transcodeClip = new KAction(KIcon("edit-copy"), i18n("Transcode Clips"), this);
1039 collection->addAction("transcode_clip", transcodeClip);
1040 connect(transcodeClip, SIGNAL(triggered(bool)), this, SLOT(slotTranscodeClip()));
1042 KAction *markIn = collection->addAction("mark_in");
1043 markIn->setText(i18n("Set Zone In"));
1044 markIn->setShortcut(Qt::Key_I);
1045 connect(markIn, SIGNAL(triggered(bool)), this, SLOT(slotSetInPoint()));
1047 KAction *markOut = collection->addAction("mark_out");
1048 markOut->setText(i18n("Set Zone Out"));
1049 markOut->setShortcut(Qt::Key_O);
1050 connect(markOut, SIGNAL(triggered(bool)), this, SLOT(slotSetOutPoint()));
1052 KAction *switchMon = collection->addAction("switch_monitor");
1053 switchMon->setText(i18n("Switch monitor"));
1054 switchMon->setShortcut(Qt::Key_T);
1055 connect(switchMon, SIGNAL(triggered(bool)), this, SLOT(slotSwitchMonitors()));
1057 KAction *insertTree = collection->addAction("insert_project_tree");
1058 insertTree->setText(i18n("Insert zone in project tree"));
1059 insertTree->setShortcut(Qt::CTRL + Qt::Key_I);
1060 connect(insertTree, SIGNAL(triggered(bool)), this, SLOT(slotInsertZoneToTree()));
1062 KAction *insertTimeline = collection->addAction("insert_timeline");
1063 insertTimeline->setText(i18n("Insert zone in timeline"));
1064 insertTimeline->setShortcut(Qt::SHIFT + Qt::CTRL + Qt::Key_I);
1065 connect(insertTimeline, SIGNAL(triggered(bool)), this, SLOT(slotInsertZoneToTimeline()));
1067 KAction *resizeStart = new KAction(KIcon(), i18n("Resize Item Start"), this);
1068 collection->addAction("resize_timeline_clip_start", resizeStart);
1069 resizeStart->setShortcut(Qt::Key_1);
1070 connect(resizeStart, SIGNAL(triggered(bool)), this, SLOT(slotResizeItemStart()));
1072 KAction *resizeEnd = new KAction(KIcon(), i18n("Resize Item End"), this);
1073 collection->addAction("resize_timeline_clip_end", resizeEnd);
1074 resizeEnd->setShortcut(Qt::Key_2);
1075 connect(resizeEnd, SIGNAL(triggered(bool)), this, SLOT(slotResizeItemEnd()));
1077 KAction* monitorSeekBackward = new KAction(KIcon("media-seek-backward"), i18n("Rewind"), this);
1078 monitorSeekBackward->setShortcut(Qt::Key_J);
1079 collection->addAction("monitor_seek_backward", monitorSeekBackward);
1080 connect(monitorSeekBackward, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotRewind()));
1082 KAction* monitorSeekBackwardOneFrame = new KAction(KIcon("media-skip-backward"), i18n("Rewind 1 Frame"), this);
1083 monitorSeekBackwardOneFrame->setShortcut(Qt::Key_Left);
1084 collection->addAction("monitor_seek_backward-one-frame", monitorSeekBackwardOneFrame);
1085 connect(monitorSeekBackwardOneFrame, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotRewindOneFrame()));
1087 KAction* monitorSeekBackwardOneSecond = new KAction(KIcon("media-skip-backward"), i18n("Rewind 1 Second"), this);
1088 monitorSeekBackwardOneSecond->setShortcut(Qt::SHIFT + Qt::Key_Left);
1089 collection->addAction("monitor_seek_backward-one-second", monitorSeekBackwardOneSecond);
1090 connect(monitorSeekBackwardOneSecond, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotRewindOneSecond()));
1092 KAction* monitorSeekSnapBackward = new KAction(KIcon("media-seek-backward"), i18n("Go to Previous Snap Point"), this);
1093 monitorSeekSnapBackward->setShortcut(Qt::ALT + Qt::Key_Left);
1094 collection->addAction("monitor_seek_snap_backward", monitorSeekSnapBackward);
1095 connect(monitorSeekSnapBackward, SIGNAL(triggered(bool)), this, SLOT(slotSnapRewind()));
1097 KAction* monitorSeekForward = new KAction(KIcon("media-seek-forward"), i18n("Forward"), this);
1098 monitorSeekForward->setShortcut(Qt::Key_L);
1099 collection->addAction("monitor_seek_forward", monitorSeekForward);
1100 connect(monitorSeekForward, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotForward()));
1102 KAction* clipStart = new KAction(KIcon("media-seek-backward"), i18n("Go to Clip Start"), this);
1103 clipStart->setShortcut(Qt::Key_Home);
1104 collection->addAction("seek_clip_start", clipStart);
1105 connect(clipStart, SIGNAL(triggered(bool)), this, SLOT(slotClipStart()));
1107 KAction* clipEnd = new KAction(KIcon("media-seek-forward"), i18n("Go to Clip End"), this);
1108 clipEnd->setShortcut(Qt::Key_End);
1109 collection->addAction("seek_clip_end", clipEnd);
1110 connect(clipEnd, SIGNAL(triggered(bool)), this, SLOT(slotClipEnd()));
1112 KAction* zoneStart = new KAction(KIcon("media-seek-backward"), i18n("Go to Zone Start"), this);
1113 zoneStart->setShortcut(Qt::SHIFT + Qt::Key_I);
1114 collection->addAction("seek_zone_start", zoneStart);
1115 connect(zoneStart, SIGNAL(triggered(bool)), this, SLOT(slotZoneStart()));
1117 KAction* zoneEnd = new KAction(KIcon("media-seek-forward"), i18n("Go to Zone End"), this);
1118 zoneEnd->setShortcut(Qt::SHIFT + Qt::Key_O);
1119 collection->addAction("seek_zone_end", zoneEnd);
1120 connect(zoneEnd, SIGNAL(triggered(bool)), this, SLOT(slotZoneEnd()));
1122 KAction* projectStart = new KAction(KIcon("go-first"), i18n("Go to Project Start"), this);
1123 projectStart->setShortcut(Qt::CTRL + Qt::Key_Home);
1124 collection->addAction("seek_start", projectStart);
1125 connect(projectStart, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotStart()));
1127 KAction* projectEnd = new KAction(KIcon("go-last"), i18n("Go to Project End"), this);
1128 projectEnd->setShortcut(Qt::CTRL + Qt::Key_End);
1129 collection->addAction("seek_end", projectEnd);
1130 connect(projectEnd, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotEnd()));
1132 KAction* monitorSeekForwardOneFrame = new KAction(KIcon("media-skip-forward"), i18n("Forward 1 Frame"), this);
1133 monitorSeekForwardOneFrame->setShortcut(Qt::Key_Right);
1134 collection->addAction("monitor_seek_forward-one-frame", monitorSeekForwardOneFrame);
1135 connect(monitorSeekForwardOneFrame, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotForwardOneFrame()));
1137 KAction* monitorSeekForwardOneSecond = new KAction(KIcon("media-skip-forward"), i18n("Forward 1 Second"), this);
1138 monitorSeekForwardOneSecond->setShortcut(Qt::SHIFT + Qt::Key_Right);
1139 collection->addAction("monitor_seek_forward-one-second", monitorSeekForwardOneSecond);
1140 connect(monitorSeekForwardOneSecond, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotForwardOneSecond()));
1142 KAction* monitorSeekSnapForward = new KAction(KIcon("media-seek-forward"), i18n("Go to Next Snap Point"), this);
1143 monitorSeekSnapForward->setShortcut(Qt::ALT + Qt::Key_Right);
1144 collection->addAction("monitor_seek_snap_forward", monitorSeekSnapForward);
1145 connect(monitorSeekSnapForward, SIGNAL(triggered(bool)), this, SLOT(slotSnapForward()));
1147 KAction* deleteItem = new KAction(KIcon("edit-delete"), i18n("Delete Selected Item"), this);
1148 deleteItem->setShortcut(Qt::Key_Delete);
1149 collection->addAction("delete_timeline_clip", deleteItem);
1150 connect(deleteItem, SIGNAL(triggered(bool)), this, SLOT(slotDeleteItem()));
1152 /*KAction* editTimelineClipSpeed = new KAction(i18n("Change Clip Speed"), this);
1153 collection->addAction("change_clip_speed", editTimelineClipSpeed);
1154 editTimelineClipSpeed->setData("change_speed");
1155 connect(editTimelineClipSpeed, SIGNAL(triggered(bool)), this, SLOT(slotChangeClipSpeed()));*/
1157 KAction *stickTransition = collection->addAction("auto_transition");
1158 stickTransition->setData(QString("auto"));
1159 stickTransition->setCheckable(true);
1160 stickTransition->setEnabled(false);
1161 stickTransition->setText(i18n("Automatic Transition"));
1162 connect(stickTransition, SIGNAL(triggered(bool)), this, SLOT(slotAutoTransition()));
1164 KAction* groupClip = new KAction(KIcon("object-group"), i18n("Group Clips"), this);
1165 groupClip->setShortcut(Qt::CTRL + Qt::Key_G);
1166 collection->addAction("group_clip", groupClip);
1167 connect(groupClip, SIGNAL(triggered(bool)), this, SLOT(slotGroupClips()));
1169 KAction* ungroupClip = new KAction(KIcon("object-ungroup"), i18n("Ungroup Clips"), this);
1170 collection->addAction("ungroup_clip", ungroupClip);
1171 ungroupClip->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_G);
1172 ungroupClip->setData("ungroup_clip");
1173 connect(ungroupClip, SIGNAL(triggered(bool)), this, SLOT(slotUnGroupClips()));
1175 KAction* editItemDuration = new KAction(KIcon("measure"), i18n("Edit Duration"), this);
1176 collection->addAction("edit_item_duration", editItemDuration);
1177 connect(editItemDuration, SIGNAL(triggered(bool)), this, SLOT(slotEditItemDuration()));
1179 KAction* clipInProjectTree = new KAction(KIcon("go-jump-definition"), i18n("Clip in Project Tree"), this);
1180 collection->addAction("clip_in_project_tree", clipInProjectTree);
1181 connect(clipInProjectTree, SIGNAL(triggered(bool)), this, SLOT(slotClipInProjectTree()));
1183 /*KAction* clipToProjectTree = new KAction(KIcon("go-jump-definition"), i18n("Add Clip to Project Tree"), this);
1184 collection->addAction("clip_to_project_tree", clipToProjectTree);
1185 connect(clipToProjectTree, SIGNAL(triggered(bool)), this, SLOT(slotClipToProjectTree()));*/
1187 KAction* insertOvertwrite = new KAction(KIcon(), i18n("Insert Clip Zone in Timeline (Overwrite)"), this);
1188 insertOvertwrite->setShortcut(Qt::Key_V);
1189 collection->addAction("overwrite_to_in_point", insertOvertwrite);
1190 connect(insertOvertwrite, SIGNAL(triggered(bool)), this, SLOT(slotInsertClipOverwrite()));
1192 KAction* selectTimelineClip = new KAction(KIcon("edit-select"), i18n("Select Clip"), this);
1193 selectTimelineClip->setShortcut(Qt::Key_Plus);
1194 collection->addAction("select_timeline_clip", selectTimelineClip);
1195 connect(selectTimelineClip, SIGNAL(triggered(bool)), this, SLOT(slotSelectTimelineClip()));
1197 KAction* deselectTimelineClip = new KAction(KIcon("edit-select"), i18n("Deselect Clip"), this);
1198 deselectTimelineClip->setShortcut(Qt::Key_Minus);
1199 collection->addAction("deselect_timeline_clip", deselectTimelineClip);
1200 connect(deselectTimelineClip, SIGNAL(triggered(bool)), this, SLOT(slotDeselectTimelineClip()));
1202 KAction* selectAddTimelineClip = new KAction(KIcon("edit-select"), i18n("Add Clip To Selection"), this);
1203 selectAddTimelineClip->setShortcut(Qt::ALT + Qt::Key_Plus);
1204 collection->addAction("select_add_timeline_clip", selectAddTimelineClip);
1205 connect(selectAddTimelineClip, SIGNAL(triggered(bool)), this, SLOT(slotSelectAddTimelineClip()));
1207 KAction* selectTimelineTransition = new KAction(KIcon("edit-select"), i18n("Select Transition"), this);
1208 selectTimelineTransition->setShortcut(Qt::SHIFT + Qt::Key_Plus);
1209 collection->addAction("select_timeline_transition", selectTimelineTransition);
1210 connect(selectTimelineTransition, SIGNAL(triggered(bool)), this, SLOT(slotSelectTimelineTransition()));
1212 KAction* deselectTimelineTransition = new KAction(KIcon("edit-select"), i18n("Deselect Transition"), this);
1213 deselectTimelineTransition->setShortcut(Qt::SHIFT + Qt::Key_Minus);
1214 collection->addAction("deselect_timeline_transition", deselectTimelineTransition);
1215 connect(deselectTimelineTransition, SIGNAL(triggered(bool)), this, SLOT(slotDeselectTimelineTransition()));
1217 KAction* selectAddTimelineTransition = new KAction(KIcon("edit-select"), i18n("Add Transition To Selection"), this);
1218 selectAddTimelineTransition->setShortcut(Qt::ALT + Qt::SHIFT + Qt::Key_Plus);
1219 collection->addAction("select_add_timeline_transition", selectAddTimelineTransition);
1220 connect(selectAddTimelineTransition, SIGNAL(triggered(bool)), this, SLOT(slotSelectAddTimelineTransition()));
1222 KAction* cutTimelineClip = new KAction(KIcon("edit-cut"), i18n("Cut Clip"), this);
1223 cutTimelineClip->setShortcut(Qt::SHIFT + Qt::Key_R);
1224 collection->addAction("cut_timeline_clip", cutTimelineClip);
1225 connect(cutTimelineClip, SIGNAL(triggered(bool)), this, SLOT(slotCutTimelineClip()));
1227 KAction* addClipMarker = new KAction(KIcon("bookmark-new"), i18n("Add Marker"), this);
1228 collection->addAction("add_clip_marker", addClipMarker);
1229 connect(addClipMarker, SIGNAL(triggered(bool)), this, SLOT(slotAddClipMarker()));
1231 KAction* deleteClipMarker = new KAction(KIcon("edit-delete"), i18n("Delete Marker"), this);
1232 collection->addAction("delete_clip_marker", deleteClipMarker);
1233 connect(deleteClipMarker, SIGNAL(triggered(bool)), this, SLOT(slotDeleteClipMarker()));
1235 KAction* deleteAllClipMarkers = new KAction(KIcon("edit-delete"), i18n("Delete All Markers"), this);
1236 collection->addAction("delete_all_clip_markers", deleteAllClipMarkers);
1237 connect(deleteAllClipMarkers, SIGNAL(triggered(bool)), this, SLOT(slotDeleteAllClipMarkers()));
1239 KAction* editClipMarker = new KAction(KIcon("document-properties"), i18n("Edit Marker"), this);
1240 collection->addAction("edit_clip_marker", editClipMarker);
1241 connect(editClipMarker, SIGNAL(triggered(bool)), this, SLOT(slotEditClipMarker()));
1243 KAction* splitAudio = new KAction(KIcon("document-new"), i18n("Split Audio"), this);
1244 collection->addAction("split_audio", splitAudio);
1245 connect(splitAudio, SIGNAL(triggered(bool)), this, SLOT(slotSplitAudio()));
1247 KAction* audioOnly = new KAction(KIcon("document-new"), i18n("Audio Only"), this);
1248 collection->addAction("clip_audio_only", audioOnly);
1249 audioOnly->setData("clip_audio_only");
1250 audioOnly->setCheckable(true);
1252 KAction* videoOnly = new KAction(KIcon("document-new"), i18n("Video Only"), this);
1253 collection->addAction("clip_video_only", videoOnly);
1254 videoOnly->setData("clip_video_only");
1255 videoOnly->setCheckable(true);
1257 KAction* audioAndVideo = new KAction(KIcon("document-new"), i18n("Audio and Video"), this);
1258 collection->addAction("clip_audio_and_video", audioAndVideo);
1259 audioAndVideo->setData("clip_audio_and_video");
1260 audioAndVideo->setCheckable(true);
1262 m_clipTypeGroup = new QActionGroup(this);
1263 m_clipTypeGroup->addAction(audioOnly);
1264 m_clipTypeGroup->addAction(videoOnly);
1265 m_clipTypeGroup->addAction(audioAndVideo);
1266 connect(m_clipTypeGroup, SIGNAL(triggered(QAction *)), this, SLOT(slotUpdateClipType(QAction *)));
1267 m_clipTypeGroup->setEnabled(false);
1269 KAction *insertSpace = new KAction(KIcon(), i18n("Insert Space"), this);
1270 collection->addAction("insert_space", insertSpace);
1271 connect(insertSpace, SIGNAL(triggered()), this, SLOT(slotInsertSpace()));
1273 KAction *removeSpace = new KAction(KIcon(), i18n("Remove Space"), this);
1274 collection->addAction("delete_space", removeSpace);
1275 connect(removeSpace, SIGNAL(triggered()), this, SLOT(slotRemoveSpace()));
1277 KAction *insertTrack = new KAction(KIcon(), i18n("Insert Track"), this);
1278 collection->addAction("insert_track", insertTrack);
1279 connect(insertTrack, SIGNAL(triggered()), this, SLOT(slotInsertTrack()));
1281 KAction *deleteTrack = new KAction(KIcon(), i18n("Delete Track"), this);
1282 collection->addAction("delete_track", deleteTrack);
1283 connect(deleteTrack, SIGNAL(triggered()), this, SLOT(slotDeleteTrack()));
1285 KAction *configTracks = new KAction(KIcon("configure"), i18n("Configure Tracks"), this);
1286 collection->addAction("config_tracks", configTracks);
1287 connect(configTracks, SIGNAL(triggered()), this, SLOT(slotConfigTrack()));
1289 KAction *addGuide = new KAction(KIcon("document-new"), i18n("Add Guide"), this);
1290 collection->addAction("add_guide", addGuide);
1291 connect(addGuide, SIGNAL(triggered()), this, SLOT(slotAddGuide()));
1293 QAction *delGuide = new KAction(KIcon("edit-delete"), i18n("Delete Guide"), this);
1294 collection->addAction("delete_guide", delGuide);
1295 connect(delGuide, SIGNAL(triggered()), this, SLOT(slotDeleteGuide()));
1297 QAction *editGuide = new KAction(KIcon("document-properties"), i18n("Edit Guide"), this);
1298 collection->addAction("edit_guide", editGuide);
1299 connect(editGuide, SIGNAL(triggered()), this, SLOT(slotEditGuide()));
1301 QAction *delAllGuides = new KAction(KIcon("edit-delete"), i18n("Delete All Guides"), this);
1302 collection->addAction("delete_all_guides", delAllGuides);
1303 connect(delAllGuides, SIGNAL(triggered()), this, SLOT(slotDeleteAllGuides()));
1305 QAction *pasteEffects = new KAction(KIcon("edit-paste"), i18n("Paste Effects"), this);
1306 collection->addAction("paste_effects", pasteEffects);
1307 pasteEffects->setData("paste_effects");
1308 connect(pasteEffects , SIGNAL(triggered()), this, SLOT(slotPasteEffects()));
1310 QAction *showTimeline = new KAction(i18n("Show Timeline"), this);
1311 collection->addAction("show_timeline", showTimeline);
1312 showTimeline->setCheckable(true);
1313 showTimeline->setChecked(true);
1314 connect(showTimeline, SIGNAL(triggered(bool)), this, SLOT(slotShowTimeline(bool)));
1316 QAction *showTitleBar = new KAction(i18n("Show Title Bars"), this);
1317 collection->addAction("show_titlebars", showTitleBar);
1318 showTitleBar->setCheckable(true);
1319 connect(showTitleBar, SIGNAL(triggered(bool)), this, SLOT(slotShowTitleBars(bool)));
1320 showTitleBar->setChecked(KdenliveSettings::showtitlebars());
1321 slotShowTitleBars(KdenliveSettings::showtitlebars());
1323 /*QAction *maxCurrent = new KAction(i18n("Maximize Current Widget"), this);
1324 collection->addAction("maximize_current", maxCurrent);
1325 maxCurrent->setCheckable(true);
1326 maxCurrent->setChecked(false);
1327 connect(maxCurrent, SIGNAL(triggered(bool)), this, SLOT(slotMaximizeCurrent(bool)));*/
1329 m_closeAction = KStandardAction::close(this, SLOT(closeCurrentDocument()), collection);
1330 KStandardAction::quit(this, SLOT(queryQuit()), collection);
1331 KStandardAction::open(this, SLOT(openFile()), collection);
1332 m_saveAction = KStandardAction::save(this, SLOT(saveFile()), collection);
1333 KStandardAction::saveAs(this, SLOT(saveFileAs()), collection);
1334 KStandardAction::openNew(this, SLOT(newFile()), collection);
1335 // TODO: make the following connection to slotEditKeys work
1336 KStandardAction::keyBindings(this, SLOT(slotEditKeys()), collection);
1337 KStandardAction::preferences(this, SLOT(slotPreferences()), collection);
1338 KStandardAction::configureNotifications(this, SLOT(configureNotifications()), collection);
1339 KStandardAction::copy(this, SLOT(slotCopy()), collection);
1340 KStandardAction::paste(this, SLOT(slotPaste()), collection);
1341 KStandardAction::fullScreen(this, SLOT(slotFullScreen()), this, collection);
1343 KAction *undo = KStandardAction::undo(m_commandStack, SLOT(undo()), collection);
1344 undo->setEnabled(false);
1345 connect(m_commandStack, SIGNAL(canUndoChanged(bool)), undo, SLOT(setEnabled(bool)));
1347 KAction *redo = KStandardAction::redo(m_commandStack, SLOT(redo()), collection);
1348 redo->setEnabled(false);
1349 connect(m_commandStack, SIGNAL(canRedoChanged(bool)), redo, SLOT(setEnabled(bool)));
1352 //TODO: Add status tooltip to actions ?
1353 connect(collection, SIGNAL(actionHovered(QAction*)),
1354 this, SLOT(slotDisplayActionMessage(QAction*)));*/
1357 QAction *addClip = new KAction(KIcon("kdenlive-add-clip"), i18n("Add Clip"), this);
1358 collection->addAction("add_clip", addClip);
1359 connect(addClip , SIGNAL(triggered()), m_projectList, SLOT(slotAddClip()));
1361 QAction *addColorClip = new KAction(KIcon("kdenlive-add-color-clip"), i18n("Add Color Clip"), this);
1362 collection->addAction("add_color_clip", addColorClip);
1363 connect(addColorClip , SIGNAL(triggered()), m_projectList, SLOT(slotAddColorClip()));
1365 QAction *addSlideClip = new KAction(KIcon("kdenlive-add-slide-clip"), i18n("Add Slideshow Clip"), this);
1366 collection->addAction("add_slide_clip", addSlideClip);
1367 connect(addSlideClip , SIGNAL(triggered()), m_projectList, SLOT(slotAddSlideshowClip()));
1369 QAction *addTitleClip = new KAction(KIcon("kdenlive-add-text-clip"), i18n("Add Title Clip"), this);
1370 collection->addAction("add_text_clip", addTitleClip);
1371 connect(addTitleClip , SIGNAL(triggered()), m_projectList, SLOT(slotAddTitleClip()));
1373 QAction *addTitleTemplateClip = new KAction(KIcon("kdenlive-add-text-clip"), i18n("Add Template Title"), this);
1374 collection->addAction("add_text_template_clip", addTitleTemplateClip);
1375 connect(addTitleTemplateClip , SIGNAL(triggered()), m_projectList, SLOT(slotAddTitleTemplateClip()));
1377 QAction *addFolderButton = new KAction(KIcon("folder-new"), i18n("Create Folder"), this);
1378 collection->addAction("add_folder", addFolderButton);
1379 connect(addFolderButton , SIGNAL(triggered()), m_projectList, SLOT(slotAddFolder()));
1381 QAction *clipProperties = new KAction(KIcon("document-edit"), i18n("Clip Properties"), this);
1382 collection->addAction("clip_properties", clipProperties);
1383 clipProperties->setData("clip_properties");
1384 connect(clipProperties , SIGNAL(triggered()), m_projectList, SLOT(slotEditClip()));
1385 clipProperties->setEnabled(false);
1387 QAction *openClip = new KAction(KIcon("document-open"), i18n("Edit Clip"), this);
1388 collection->addAction("edit_clip", openClip);
1389 openClip->setData("edit_clip");
1390 connect(openClip , SIGNAL(triggered()), m_projectList, SLOT(slotOpenClip()));
1391 openClip->setEnabled(false);
1393 QAction *deleteClip = new KAction(KIcon("edit-delete"), i18n("Delete Clip"), this);
1394 collection->addAction("delete_clip", deleteClip);
1395 deleteClip->setData("delete_clip");
1396 connect(deleteClip , SIGNAL(triggered()), m_projectList, SLOT(slotRemoveClip()));
1397 deleteClip->setEnabled(false);
1399 QAction *reloadClip = new KAction(KIcon("view-refresh"), i18n("Reload Clip"), this);
1400 collection->addAction("reload_clip", reloadClip);
1401 reloadClip->setData("reload_clip");
1402 connect(reloadClip , SIGNAL(triggered()), m_projectList, SLOT(slotReloadClip()));
1403 reloadClip->setEnabled(false);
1405 QMenu *addClips = new QMenu();
1406 addClips->addAction(addClip);
1407 addClips->addAction(addColorClip);
1408 addClips->addAction(addSlideClip);
1409 addClips->addAction(addTitleClip);
1410 addClips->addAction(addTitleTemplateClip);
1411 addClips->addAction(addFolderButton);
1413 addClips->addAction(reloadClip);
1414 addClips->addAction(clipProperties);
1415 addClips->addAction(openClip);
1416 addClips->addAction(deleteClip);
1417 m_projectList->setupMenu(addClips, addClip);
1419 // Setup effects and transitions actions.
1420 m_effectsActionCollection = new KActionCollection(this, KGlobal::mainComponent());
1421 //KActionCategory *videoEffectActions = new KActionCategory(i18n("Video Effects"), m_effectsActionCollection);
1422 KActionCategory *videoEffectActions = new KActionCategory(i18n("Video Effects"), collection);
1423 m_videoEffects = new KAction*[videoEffects.count()];
1424 for (int i = 0; i < videoEffects.count(); ++i) {
1425 QStringList effectInfo = videoEffects.effectIdInfo(i);
1426 m_videoEffects[i] = new KAction(KIcon("kdenlive-show-video"), effectInfo.at(0), this);
1427 m_videoEffects[i]->setData(effectInfo);
1428 m_videoEffects[i]->setIconVisibleInMenu(false);
1429 videoEffectActions->addAction("video_effect_" + effectInfo.at(0), m_videoEffects[i]);
1431 //KActionCategory *audioEffectActions = new KActionCategory(i18n("Audio Effects"), m_effectsActionCollection);
1432 KActionCategory *audioEffectActions = new KActionCategory(i18n("Audio Effects"), collection);
1433 m_audioEffects = new KAction*[audioEffects.count()];
1434 for (int i = 0; i < audioEffects.count(); ++i) {
1435 QStringList effectInfo = audioEffects.effectIdInfo(i);
1436 m_audioEffects[i] = new KAction(KIcon("kdenlive-show-audio"), effectInfo.at(0), this);
1437 m_audioEffects[i]->setData(effectInfo);
1438 m_audioEffects[i]->setIconVisibleInMenu(false);
1439 audioEffectActions->addAction("audio_effect_" + effectInfo.at(0), m_audioEffects[i]);
1441 //KActionCategory *customEffectActions = new KActionCategory(i18n("Custom Effects"), m_effectsActionCollection);
1442 KActionCategory *customEffectActions = new KActionCategory(i18n("Custom Effects"), collection);
1443 m_customEffects = new KAction*[customEffects.count()];
1444 for (int i = 0; i < customEffects.count(); ++i) {
1445 QStringList effectInfo = customEffects.effectIdInfo(i);
1446 m_customEffects[i] = new KAction(KIcon("kdenlive-custom-effect"), effectInfo.at(0), this);
1447 m_customEffects[i]->setData(effectInfo);
1448 m_customEffects[i]->setIconVisibleInMenu(false);
1449 customEffectActions->addAction("custom_effect_" + effectInfo.at(0), m_customEffects[i]);
1451 //KActionCategory *transitionActions = new KActionCategory(i18n("Transitions"), m_effectsActionCollection);
1452 KActionCategory *transitionActions = new KActionCategory(i18n("Transitions"), collection);
1453 m_transitions = new KAction*[transitions.count()];
1454 for (int i = 0; i < transitions.count(); i++) {
1455 QStringList effectInfo = transitions.effectIdInfo(i);
1456 m_transitions[i] = new KAction(effectInfo.at(0), this);
1457 m_transitions[i]->setData(effectInfo);
1458 m_transitions[i]->setIconVisibleInMenu(false);
1459 transitionActions->addAction("transition_" + effectInfo.at(0), m_transitions[i]);
1461 m_effectsActionCollection->readSettings();
1463 //connect(collection, SIGNAL( clearStatusText() ),
1464 //statusBar(), SLOT( clear() ) );
1467 void MainWindow::slotDisplayActionMessage(QAction *a)
1469 statusBar()->showMessage(a->data().toString(), 3000);
1472 void MainWindow::saveOptions()
1474 KdenliveSettings::self()->writeConfig();
1475 KSharedConfigPtr config = KGlobal::config();
1476 m_fileOpenRecent->saveEntries(KConfigGroup(config, "Recent Files"));
1477 KConfigGroup treecolumns(config, "Project Tree");
1478 treecolumns.writeEntry("columns", m_projectList->headerInfo());
1482 void MainWindow::readOptions()
1484 KSharedConfigPtr config = KGlobal::config();
1485 m_fileOpenRecent->loadEntries(KConfigGroup(config, "Recent Files"));
1486 KConfigGroup initialGroup(config, "version");
1487 bool upgrade = false;
1488 if (initialGroup.exists()) {
1489 if (initialGroup.readEntry("version", QString()).section(' ', 0, 0) != QString(version).section(' ', 0, 0)) {
1493 if (initialGroup.readEntry("version") == "0.7") {
1494 //Add new settings from 0.7.1
1495 if (KdenliveSettings::defaultprojectfolder().isEmpty()) {
1496 QString path = QDir::homePath() + "/kdenlive";
1497 if (KStandardDirs::makeDir(path) == false) {
1498 kDebug() << "/// ERROR CREATING PROJECT FOLDER: " << path;
1499 } else KdenliveSettings::setDefaultprojectfolder(path);
1505 if (!initialGroup.exists() || upgrade) {
1506 // this is our first run, show Wizard
1507 Wizard *w = new Wizard(upgrade, this);
1508 if (w->exec() == QDialog::Accepted && w->isOk()) {
1509 w->adjustSettings();
1510 initialGroup.writeEntry("version", version);
1516 KConfigGroup treecolumns(config, "Project Tree");
1517 const QByteArray state = treecolumns.readEntry("columns", QByteArray());
1518 if (!state.isEmpty())
1519 m_projectList->setHeaderInfo(state);
1522 void MainWindow::slotRunWizard()
1524 Wizard *w = new Wizard(false, this);
1525 if (w->exec() == QDialog::Accepted && w->isOk()) {
1526 w->adjustSettings();
1531 void MainWindow::newFile(bool showProjectSettings, bool force)
1533 if (!m_timelineArea->isEnabled() && !force) return;
1534 m_fileRevert->setEnabled(false);
1535 QString profileName;
1537 QPoint projectTracks(KdenliveSettings::videotracks(), KdenliveSettings::audiotracks());
1538 if (!showProjectSettings) {
1539 if (!KdenliveSettings::activatetabs()) closeCurrentDocument();
1540 profileName = KdenliveSettings::default_profile();
1541 projectFolder = KdenliveSettings::defaultprojectfolder();
1543 ProjectSettings *w = new ProjectSettings(NULL, QStringList(), projectTracks.x(), projectTracks.y(), KdenliveSettings::defaultprojectfolder(), false, true, this);
1544 if (w->exec() != QDialog::Accepted) return;
1545 if (!KdenliveSettings::activatetabs()) closeCurrentDocument();
1546 if (KdenliveSettings::videothumbnails() != w->enableVideoThumbs()) slotSwitchVideoThumbs();
1547 if (KdenliveSettings::audiothumbnails() != w->enableAudioThumbs()) slotSwitchAudioThumbs();
1548 profileName = w->selectedProfile();
1549 projectFolder = w->selectedFolder();
1550 projectTracks = w->tracks();
1553 m_timelineArea->setEnabled(true);
1554 m_projectList->setEnabled(true);
1555 KdenliveDoc *doc = new KdenliveDoc(KUrl(), projectFolder, m_commandStack, profileName, projectTracks, m_projectMonitor->render, this);
1556 doc->m_autosave = new KAutoSaveFile(KUrl(), doc);
1558 TrackView *trackView = new TrackView(doc, &ok, this);
1559 m_timelineArea->addTab(trackView, KIcon("kdenlive"), doc->description());
1562 //m_timelineArea->setEnabled(false);
1563 //m_projectList->setEnabled(false);
1567 if (m_timelineArea->count() == 1) {
1568 connectDocumentInfo(doc);
1569 connectDocument(trackView, doc);
1570 } else m_timelineArea->setTabBarHidden(false);
1571 m_monitorManager->activateMonitor("clip");
1572 m_closeAction->setEnabled(m_timelineArea->count() > 1);
1575 void MainWindow::activateDocument()
1577 if (m_timelineArea->currentWidget() == NULL || !m_timelineArea->isEnabled()) return;
1578 TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
1579 KdenliveDoc *currentDoc = currentTab->document();
1580 connectDocumentInfo(currentDoc);
1581 connectDocument(currentTab, currentDoc);
1584 void MainWindow::closeCurrentDocument(bool saveChanges)
1586 QWidget *w = m_timelineArea->currentWidget();
1588 // closing current document
1589 int ix = m_timelineArea->currentIndex() + 1;
1590 if (ix == m_timelineArea->count()) ix = 0;
1591 m_timelineArea->setCurrentIndex(ix);
1592 TrackView *tabToClose = (TrackView *) w;
1593 KdenliveDoc *docToClose = tabToClose->document();
1594 if (docToClose && docToClose->isModified() && saveChanges) {
1596 if (m_activeDocument->url().fileName().isEmpty())
1597 message = i18n("Save changes to document?");
1599 message = i18n("The project <b>\"%1\"</b> has been changed.\nDo you want to save your changes?").arg(m_activeDocument->url().fileName());
1600 switch (KMessageBox::warningYesNoCancel(this, message)) {
1601 case KMessageBox::Yes :
1602 // save document here. If saving fails, return false;
1603 if (saveFile() == false) return;
1605 case KMessageBox::Cancel :
1612 m_clipMonitor->slotSetXml(NULL);
1613 m_timelineArea->removeTab(m_timelineArea->indexOf(w));
1614 if (m_timelineArea->count() == 1) {
1615 m_timelineArea->setTabBarHidden(true);
1616 m_closeAction->setEnabled(false);
1618 if (docToClose == m_activeDocument) {
1619 delete m_activeDocument;
1620 m_activeDocument = NULL;
1621 m_effectStack->clear();
1622 m_transitionConfig->slotTransitionItemSelected(NULL, 0, QPoint(), false);
1626 if (w == m_activeTimeline) {
1627 delete m_activeTimeline;
1628 m_activeTimeline = NULL;
1634 bool MainWindow::saveFileAs(const QString &outputFileName)
1636 QString currentSceneList;
1637 m_monitorManager->stopActiveMonitor();
1638 if (KdenliveSettings::dropbframes()) {
1639 KdenliveSettings::setDropbframes(false);
1640 m_activeDocument->clipManager()->updatePreviewSettings();
1641 currentSceneList = m_projectMonitor->sceneList();
1642 KdenliveSettings::setDropbframes(true);
1643 m_activeDocument->clipManager()->updatePreviewSettings();
1644 } else currentSceneList = m_projectMonitor->sceneList();
1646 if (m_activeDocument->saveSceneList(outputFileName, currentSceneList) == false)
1649 // Save timeline thumbnails
1650 m_activeTimeline->projectView()->saveThumbnails();
1651 m_activeDocument->setUrl(KUrl(outputFileName));
1652 if (m_activeDocument->m_autosave == NULL) {
1653 m_activeDocument->m_autosave = new KAutoSaveFile(KUrl(outputFileName), this);
1654 } else m_activeDocument->m_autosave->setManagedFile(KUrl(outputFileName));
1655 setCaption(m_activeDocument->description());
1656 m_timelineArea->setTabText(m_timelineArea->currentIndex(), m_activeDocument->description());
1657 m_timelineArea->setTabToolTip(m_timelineArea->currentIndex(), m_activeDocument->url().path());
1658 m_activeDocument->setModified(false);
1659 m_fileOpenRecent->addUrl(KUrl(outputFileName));
1660 m_fileRevert->setEnabled(true);
1664 bool MainWindow::saveFileAs()
1666 QString outputFile = KFileDialog::getSaveFileName(KUrl(), getMimeType());
1667 if (outputFile.isEmpty()) return false;
1668 if (QFile::exists(outputFile)) {
1669 // Show the file dialog again if the user does not want to overwrite the file
1670 if (KMessageBox::questionYesNo(this, i18n("File already exists.\nDo you want to overwrite it?")) == KMessageBox::No)
1671 return saveFileAs();
1673 return saveFileAs(outputFile);
1676 bool MainWindow::saveFile()
1678 if (!m_activeDocument) return true;
1679 if (m_activeDocument->url().isEmpty()) {
1680 return saveFileAs();
1682 bool result = saveFileAs(m_activeDocument->url().path());
1683 m_activeDocument->m_autosave->resize(0);
1688 void MainWindow::openFile()
1690 if (!m_startUrl.isEmpty()) {
1691 openFile(m_startUrl);
1692 m_startUrl = KUrl();
1695 KUrl url = KFileDialog::getOpenUrl(KUrl("kfiledialog:///projectfolder"), getMimeType());
1696 if (url.isEmpty()) return;
1697 m_fileOpenRecent->addUrl(url);
1701 void MainWindow::openLastFile()
1703 KSharedConfigPtr config = KGlobal::config();
1704 KUrl::List urls = m_fileOpenRecent->urls();
1705 //WARNING: this is buggy, we get a random url, not the last one. Bug in KRecentFileAction?
1706 if (urls.isEmpty()) newFile(false);
1707 else openFile(urls.last());
1710 void MainWindow::openFile(const KUrl &url)
1712 // Check if the document is already opened
1713 const int ct = m_timelineArea->count();
1714 bool isOpened = false;
1716 for (i = 0; i < ct; i++) {
1717 TrackView *tab = (TrackView *) m_timelineArea->widget(i);
1718 KdenliveDoc *doc = tab->document();
1719 if (doc->url() == url) {
1725 m_timelineArea->setCurrentIndex(i);
1729 // Check for backup file
1730 QList<KAutoSaveFile *> staleFiles = KAutoSaveFile::staleFiles(url);
1731 if (!staleFiles.isEmpty()) {
1732 if (KMessageBox::questionYesNo(this,
1733 i18n("Auto-saved files exist. Do you want to recover them now?"),
1734 i18n("File Recovery"),
1735 KGuiItem(i18n("Recover")), KGuiItem(i18n("Don't recover"))) == KMessageBox::Yes) {
1736 recoverFiles(staleFiles);
1739 // remove the stale files
1740 foreach(KAutoSaveFile *stale, staleFiles) {
1741 stale->open(QIODevice::ReadWrite);
1746 if (!KdenliveSettings::activatetabs()) closeCurrentDocument();
1747 m_messageLabel->setMessage(i18n("Opening file %1", url.path()), InformationMessage);
1748 m_messageLabel->repaint();
1749 doOpenFile(url, NULL);
1752 void MainWindow::doOpenFile(const KUrl &url, KAutoSaveFile *stale)
1754 if (!m_timelineArea->isEnabled()) return;
1755 m_fileRevert->setEnabled(true);
1756 KdenliveDoc *doc = new KdenliveDoc(url, KdenliveSettings::defaultprojectfolder(), m_commandStack, KdenliveSettings::default_profile(), QPoint(KdenliveSettings::videotracks(), KdenliveSettings::audiotracks()), m_projectMonitor->render, this);
1757 if (stale == NULL) {
1758 stale = new KAutoSaveFile(url, doc);
1759 doc->m_autosave = stale;
1761 doc->m_autosave = stale;
1762 doc->setUrl(stale->managedFile());
1763 doc->setModified(true);
1764 stale->setParent(doc);
1766 connectDocumentInfo(doc);
1768 TrackView *trackView = new TrackView(doc, &ok, this);
1769 m_timelineArea->setCurrentIndex(m_timelineArea->addTab(trackView, KIcon("kdenlive"), doc->description()));
1771 m_timelineArea->setEnabled(false);
1772 m_projectList->setEnabled(false);
1773 KMessageBox::sorry(this, i18n("Cannot open file %1.\nProject is corrupted.", url.path()));
1774 slotGotProgressInfo(QString(), -1);
1775 newFile(false, true);
1778 m_timelineArea->setTabToolTip(m_timelineArea->currentIndex(), doc->url().path());
1779 trackView->setDuration(trackView->duration());
1780 trackView->projectView()->initCursorPos(m_projectMonitor->render->seekPosition().frames(doc->fps()));
1782 if (m_timelineArea->count() > 1) m_timelineArea->setTabBarHidden(false);
1783 slotGotProgressInfo(QString(), -1);
1784 m_projectMonitor->adjustRulerSize(trackView->duration());
1785 m_projectMonitor->slotZoneMoved(trackView->inPoint(), trackView->outPoint());
1786 m_clipMonitor->refreshMonitor(true);
1789 void MainWindow::recoverFiles(QList<KAutoSaveFile *> staleFiles)
1791 if (!KdenliveSettings::activatetabs()) closeCurrentDocument();
1792 foreach(KAutoSaveFile *stale, staleFiles) {
1793 /*if (!stale->open(QIODevice::QIODevice::ReadOnly)) {
1794 // show an error message; we could not steal the lockfile
1795 // maybe another application got to the file before us?
1799 kDebug() << "// OPENING RECOVERY: " << stale->fileName() << "\nMANAGED: " << stale->managedFile().path();
1800 // the stalefiles also contain ".lock" files so we must ignore them... bug in KAutoSaveFile?
1801 if (!stale->fileName().endsWith(".lock")) doOpenFile(KUrl(stale->fileName()), stale);
1802 else KIO::NetAccess::del(KUrl(stale->fileName()), this);
1806 void MainWindow::parseProfiles(const QString &mltPath)
1808 //KdenliveSettings::setDefaulttmpfolder();
1809 if (!mltPath.isEmpty()) {
1810 KdenliveSettings::setMltpath(mltPath + "/share/mlt/profiles/");
1811 KdenliveSettings::setRendererpath(mltPath + "/bin/melt");
1814 if (KdenliveSettings::mltpath().isEmpty())
1815 KdenliveSettings::setMltpath(QString(MLT_PREFIX) + QString("/share/mlt/profiles/"));
1817 if (KdenliveSettings::rendererpath().isEmpty() || KdenliveSettings::rendererpath().endsWith("inigo")) {
1818 QString meltPath = QString(MLT_PREFIX) + QString("/bin/melt");
1819 if (!QFile::exists(meltPath))
1820 meltPath = KStandardDirs::findExe("melt");
1821 KdenliveSettings::setRendererpath(meltPath);
1824 if (KdenliveSettings::rendererpath().isEmpty()) {
1825 // Cannot find the MLT melt renderer, ask for location
1826 KUrlRequesterDialog *getUrl = new KUrlRequesterDialog(QString(), i18n("Cannot find the melt program required for rendering (part of MLT)"), this);
1827 if (getUrl->exec() == QDialog::Rejected) {
1830 KUrl rendererPath = getUrl->selectedUrl();
1832 if (rendererPath.isEmpty()) ::exit(0);
1833 KdenliveSettings::setRendererpath(rendererPath.path());
1836 QStringList profilesFilter;
1837 profilesFilter << "*";
1838 QStringList profilesList = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
1839 if (profilesList.isEmpty()) {
1840 // Cannot find MLT path, try finding melt
1841 QString profilePath = KdenliveSettings::rendererpath();
1842 if (!profilePath.isEmpty()) {
1843 profilePath = profilePath.section('/', 0, -3);
1844 KdenliveSettings::setMltpath(profilePath + "/share/mlt/profiles/");
1845 profilesList = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
1847 if (profilesList.isEmpty()) {
1848 // Cannot find the MLT profiles, ask for location
1849 KUrlRequesterDialog *getUrl = new KUrlRequesterDialog(KdenliveSettings::mltpath(), i18n("Cannot find your MLT profiles, please give the path"), this);
1850 getUrl->fileDialog()->setMode(KFile::Directory);
1851 if (getUrl->exec() == QDialog::Rejected) {
1854 KUrl mltPath = getUrl->selectedUrl();
1856 if (mltPath.isEmpty()) ::exit(0);
1857 KdenliveSettings::setMltpath(mltPath.path(KUrl::AddTrailingSlash));
1858 profilesList = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
1862 kDebug() << "RESULTING MLT PATH: " << KdenliveSettings::mltpath();
1864 // Parse again MLT profiles to build a list of available video formats
1865 if (profilesList.isEmpty()) parseProfiles();
1869 void MainWindow::slotEditProfiles()
1871 ProfilesDialog *w = new ProfilesDialog;
1872 if (w->exec() == QDialog::Accepted) {
1873 KdenliveSettingsDialog* d = static_cast <KdenliveSettingsDialog*>(KConfigDialog::exists("settings"));
1874 if (d) d->checkProfile();
1879 void MainWindow::slotDetectAudioDriver()
1881 /* WARNING: do not use this method because sometimes detects wrong driver (pulse instead of alsa),
1882 leading to no audio output, see bug #934 */
1884 //decide which audio driver is really best, in some cases SDL is wrong
1885 if (KdenliveSettings::audiodrivername().isEmpty()) {
1887 KProcess readProcess;
1888 //PulseAudio needs to be selected if it exists, the ALSA pulse pcm device is not fast enough.
1889 if (!KStandardDirs::findExe("pactl").isEmpty()) {
1890 readProcess.setOutputChannelMode(KProcess::OnlyStdoutChannel);
1891 readProcess.setProgram("pactl", QStringList() << "stat");
1892 readProcess.execute(2000); // Kill it after 2 seconds
1894 QString result = QString(readProcess.readAllStandardOutput());
1895 kDebug() << "// / / / / / READING PACTL: ";
1897 if (!result.isEmpty()) {
1899 kDebug() << "// / / / / PULSEAUDIO DETECTED";
1903 KdenliveSettings::setAutoaudiodrivername(driver);
1907 void MainWindow::slotEditProjectSettings()
1909 QPoint p = m_activeDocument->getTracksCount();
1910 ProjectSettings *w = new ProjectSettings(m_projectList, m_activeTimeline->projectView()->extractTransitionsLumas(), p.x(), p.y(), m_activeDocument->projectFolder().path(), true, !m_activeDocument->isModified(), this);
1912 if (w->exec() == QDialog::Accepted) {
1913 QString profile = w->selectedProfile();
1914 m_activeDocument->setProjectFolder(w->selectedFolder());
1915 if (m_renderWidget) m_renderWidget->setDocumentPath(w->selectedFolder().path(KUrl::AddTrailingSlash));
1916 if (KdenliveSettings::videothumbnails() != w->enableVideoThumbs()) slotSwitchVideoThumbs();
1917 if (KdenliveSettings::audiothumbnails() != w->enableAudioThumbs()) slotSwitchAudioThumbs();
1918 if (m_activeDocument->profilePath() != profile) {
1919 // Profile was changed
1920 double dar = m_activeDocument->dar();
1922 // Deselect current effect / transition
1923 m_effectStack->slotClipItemSelected(NULL, 0);
1924 m_transitionConfig->slotTransitionItemSelected(NULL, 0, QPoint(), false);
1925 m_clipMonitor->slotSetXml(NULL);
1926 bool updateFps = m_activeDocument->setProfilePath(profile);
1927 KdenliveSettings::setCurrent_profile(profile);
1928 KdenliveSettings::setProject_fps(m_activeDocument->fps());
1929 setCaption(m_activeDocument->description(), m_activeDocument->isModified());
1931 m_activeDocument->clipManager()->clearUnusedProducers();
1932 m_monitorManager->resetProfiles(m_activeDocument->timecode());
1934 m_transitionConfig->updateProjectFormat(m_activeDocument->mltProfile(), m_activeDocument->timecode(), m_activeDocument->tracksList());
1935 m_effectStack->updateProjectFormat(m_activeDocument->mltProfile(), m_activeDocument->timecode());
1936 m_projectList->updateProjectFormat(m_activeDocument->timecode());
1937 if (m_renderWidget) m_renderWidget->setProfile(m_activeDocument->mltProfile());
1938 m_timelineArea->setTabText(m_timelineArea->currentIndex(), m_activeDocument->description());
1939 //m_activeDocument->clipManager()->resetProducersList(m_projectMonitor->render->producersList());
1940 if (dar != m_activeDocument->dar()) m_projectList->reloadClipThumbnails();
1941 if (updateFps) m_activeTimeline->updateProjectFps();
1942 m_activeDocument->setModified(true);
1943 m_commandStack->activeStack()->clear();
1944 //Update the mouse position display so it will display in DF/NDF format by default based on the project setting.
1945 slotUpdateMousePosition(0);
1946 // We need to desactivate & reactivate monitors to get a refresh
1947 //m_monitorManager->switchMonitors();
1954 void MainWindow::slotRenderProject()
1956 if (!m_renderWidget) {
1957 QString projectfolder = m_activeDocument ? m_activeDocument->projectFolder().path(KUrl::AddTrailingSlash) : KdenliveSettings::defaultprojectfolder();
1958 m_renderWidget = new RenderWidget(projectfolder, this);
1959 connect(m_renderWidget, SIGNAL(shutdown()), this, SLOT(slotShutdown()));
1960 connect(m_renderWidget, SIGNAL(selectedRenderProfile(const QString &, const QString &, const QString &, const QString&)), this, SLOT(slotSetDocumentRenderProfile(const QString &, const QString &, const QString &, const QString&)));
1961 connect(m_renderWidget, SIGNAL(prepareRenderingData(bool, bool, const QString&)), this, SLOT(slotPrepareRendering(bool, bool, const QString&)));
1962 connect(m_renderWidget, SIGNAL(abortProcess(const QString &)), this, SIGNAL(abortRenderJob(const QString &)));
1963 connect(m_renderWidget, SIGNAL(openDvdWizard(const QString &, const QString &)), this, SLOT(slotDvdWizard(const QString &, const QString &)));
1964 if (m_activeDocument) {
1965 m_renderWidget->setProfile(m_activeDocument->mltProfile());
1966 m_renderWidget->setGuides(m_activeDocument->guidesXml(), m_activeDocument->projectDuration());
1967 m_renderWidget->setDocumentPath(m_activeDocument->projectFolder().path(KUrl::AddTrailingSlash));
1968 m_renderWidget->setRenderProfile(m_activeDocument->getDocumentProperty("renderdestination"), m_activeDocument->getDocumentProperty("rendercategory"), m_activeDocument->getDocumentProperty("renderprofile"), m_activeDocument->getDocumentProperty("renderurl"));
1971 slotCheckRenderStatus();
1972 /*TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
1973 if (currentTab) m_renderWidget->setTimeline(currentTab);
1974 m_renderWidget->setDocument(m_activeDocument);*/
1975 m_renderWidget->show();
1976 m_renderWidget->showNormal();
1978 m_activeTimeline->tracksNumber();
1979 m_renderWidget->enableAudio(false);
1980 //m_renderWidget->export_audio;
1983 void MainWindow::slotCheckRenderStatus()
1985 // Make sure there are no missing clips
1987 m_renderWidget->missingClips(m_projectList->hasMissingClips());
1990 void MainWindow::setRenderingProgress(const QString &url, int progress)
1993 m_renderWidget->setRenderJob(url, progress);
1996 void MainWindow::setRenderingFinished(const QString &url, int status, const QString &error)
1999 m_renderWidget->setRenderStatus(url, status, error);
2002 void MainWindow::slotCleanProject()
2004 if (KMessageBox::warningContinueCancel(this, i18n("This will remove all unused clips from your project."), i18n("Clean up project")) == KMessageBox::Cancel) return;
2005 m_projectList->cleanup();
2008 void MainWindow::slotUpdateMousePosition(int pos)
2010 if (m_activeDocument)
2011 switch (m_timecodeFormat->currentIndex()) {
2013 statusBar()->changeItem(m_activeDocument->timecode().getTimecodeFromFrames(pos), ID_TIMELINE_POS);
2016 statusBar()->changeItem(QString::number(pos), ID_TIMELINE_POS);
2020 void MainWindow::slotUpdateDocumentState(bool modified)
2022 if (!m_activeDocument) return;
2023 setCaption(m_activeDocument->description(), modified);
2024 m_saveAction->setEnabled(modified);
2026 m_timelineArea->setTabTextColor(m_timelineArea->currentIndex(), palette().color(QPalette::Link));
2027 m_timelineArea->setTabIcon(m_timelineArea->currentIndex(), KIcon("document-save"));
2029 m_timelineArea->setTabTextColor(m_timelineArea->currentIndex(), palette().color(QPalette::Text));
2030 m_timelineArea->setTabIcon(m_timelineArea->currentIndex(), KIcon("kdenlive"));
2034 void MainWindow::connectDocumentInfo(KdenliveDoc *doc)
2036 if (m_activeDocument) {
2037 if (m_activeDocument == doc) return;
2038 disconnect(m_activeDocument, SIGNAL(progressInfo(const QString &, int)), this, SLOT(slotGotProgressInfo(const QString &, int)));
2040 connect(doc, SIGNAL(progressInfo(const QString &, int)), this, SLOT(slotGotProgressInfo(const QString &, int)));
2043 void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) //changed
2045 //m_projectMonitor->stop();
2046 m_closeAction->setEnabled(m_timelineArea->count() > 1);
2047 kDebug() << "/////////////////// CONNECTING DOC TO PROJECT VIEW ////////////////";
2048 if (m_activeDocument) {
2049 if (m_activeDocument == doc) return;
2050 if (m_activeTimeline) {
2051 disconnect(m_projectMonitor, SIGNAL(renderPosition(int)), m_activeTimeline, SLOT(moveCursorPos(int)));
2052 disconnect(m_projectMonitor, SIGNAL(zoneUpdated(QPoint)), m_activeTimeline, SLOT(slotSetZone(QPoint)));
2053 disconnect(m_projectMonitor, SIGNAL(durationChanged(int)), m_activeTimeline, SLOT(setDuration(int)));
2054 disconnect(m_projectMonitor, SIGNAL(zoneUpdated(QPoint)), m_activeDocument, SLOT(setModified()));
2055 disconnect(m_clipMonitor, SIGNAL(zoneUpdated(QPoint)), m_activeDocument, SLOT(setModified()));
2056 disconnect(m_projectList, SIGNAL(projectModified()), m_activeDocument, SLOT(setModified()));
2057 disconnect(m_projectMonitor->render, SIGNAL(refreshDocumentProducers()), m_activeDocument, SLOT(checkProjectClips()));
2059 disconnect(m_activeDocument, SIGNAL(guidesUpdated()), this, SLOT(slotGuidesUpdated()));
2060 disconnect(m_activeDocument, SIGNAL(addProjectClip(DocClipBase *, bool)), m_projectList, SLOT(slotAddClip(DocClipBase *, bool)));
2061 disconnect(m_activeDocument, SIGNAL(resetProjectList()), m_projectList, SLOT(slotResetProjectList()));
2062 disconnect(m_activeDocument, SIGNAL(signalDeleteProjectClip(const QString &)), m_projectList, SLOT(slotDeleteClip(const QString &)));
2063 disconnect(m_activeDocument, SIGNAL(updateClipDisplay(const QString &)), m_projectList, SLOT(slotUpdateClip(const QString &)));
2064 disconnect(m_activeDocument, SIGNAL(selectLastAddedClip(const QString &)), m_projectList, SLOT(slotSelectClip(const QString &)));
2065 disconnect(m_activeDocument, SIGNAL(deleteTimelineClip(const QString &)), m_activeTimeline, SLOT(slotDeleteClip(const QString &)));
2066 disconnect(m_activeTimeline->projectView(), SIGNAL(clipItemSelected(ClipItem*, int)), m_effectStack, SLOT(slotClipItemSelected(ClipItem*, int)));
2067 disconnect(m_activeTimeline->projectView(), SIGNAL(clipItemSelected(ClipItem*, int)), this, SLOT(slotActivateEffectStackView()));
2068 disconnect(m_activeTimeline->projectView(), SIGNAL(transitionItemSelected(Transition*, int, QPoint, bool)), m_transitionConfig, SLOT(slotTransitionItemSelected(Transition*, int, QPoint, bool)));
2069 disconnect(m_activeTimeline->projectView(), SIGNAL(transitionItemSelected(Transition*, int, QPoint, bool)), this, SLOT(slotActivateTransitionView(Transition *)));
2070 disconnect(m_activeTimeline->projectView(), SIGNAL(playMonitor()), m_projectMonitor, SLOT(slotPlay()));
2071 disconnect(m_activeTimeline->projectView(), SIGNAL(displayMessage(const QString&, MessageType)), m_messageLabel, SLOT(setMessage(const QString&, MessageType)));
2072 disconnect(m_activeTimeline->projectView(), SIGNAL(showClipFrame(DocClipBase *, QPoint, const int)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *, QPoint, const int)));
2073 disconnect(m_activeTimeline, SIGNAL(cursorMoved()), m_projectMonitor, SLOT(activateMonitor()));
2074 disconnect(m_activeTimeline, SIGNAL(insertTrack(int)), this, SLOT(slotInsertTrack(int)));
2075 disconnect(m_activeTimeline, SIGNAL(deleteTrack(int)), this, SLOT(slotDeleteTrack(int)));
2076 disconnect(m_activeTimeline, SIGNAL(configTrack(int)), this, SLOT(slotConfigTrack(int)));
2077 disconnect(m_activeDocument, SIGNAL(docModified(bool)), this, SLOT(slotUpdateDocumentState(bool)));
2078 disconnect(m_effectStack, SIGNAL(updateClipEffect(ClipItem*, QDomElement, QDomElement, int)), m_activeTimeline->projectView(), SLOT(slotUpdateClipEffect(ClipItem*, QDomElement, QDomElement, int)));
2079 disconnect(m_effectStack, SIGNAL(removeEffect(ClipItem*, QDomElement)), m_activeTimeline->projectView(), SLOT(slotDeleteEffect(ClipItem*, QDomElement)));
2080 disconnect(m_effectStack, SIGNAL(changeEffectState(ClipItem*, int, bool)), m_activeTimeline->projectView(), SLOT(slotChangeEffectState(ClipItem*, int, bool)));
2081 disconnect(m_effectStack, SIGNAL(changeEffectPosition(ClipItem*, int, int)), m_activeTimeline->projectView(), SLOT(slotChangeEffectPosition(ClipItem*, int, int)));
2082 disconnect(m_effectStack, SIGNAL(refreshEffectStack(ClipItem*)), m_activeTimeline->projectView(), SLOT(slotRefreshEffects(ClipItem*)));
2083 disconnect(m_effectStack, SIGNAL(reloadEffects()), this, SLOT(slotReloadEffects()));
2084 disconnect(m_transitionConfig, SIGNAL(transitionUpdated(Transition *, QDomElement)), m_activeTimeline->projectView() , SLOT(slotTransitionUpdated(Transition *, QDomElement)));
2085 disconnect(m_transitionConfig, SIGNAL(seekTimeline(int)), m_activeTimeline->projectView() , SLOT(setCursorPos(int)));
2086 disconnect(m_activeTimeline->projectView(), SIGNAL(activateDocumentMonitor()), m_projectMonitor, SLOT(activateMonitor()));
2087 disconnect(m_activeTimeline, SIGNAL(zoneMoved(int, int)), this, SLOT(slotZoneMoved(int, int)));
2088 disconnect(m_projectList, SIGNAL(loadingIsOver()), m_activeTimeline->projectView(), SLOT(slotUpdateAllThumbs()));
2089 disconnect(m_projectList, SIGNAL(displayMessage(const QString&, int)), this, SLOT(slotGotProgressInfo(const QString&, int)));
2090 disconnect(m_projectList, SIGNAL(updateRenderStatus()), this, SLOT(slotCheckRenderStatus()));
2091 disconnect(m_projectList, SIGNAL(clipNeedsReload(const QString&, bool)), m_activeTimeline->projectView(), SLOT(slotUpdateClip(const QString &, bool)));
2092 m_effectStack->clear();
2094 //m_activeDocument->setRenderer(NULL);
2095 disconnect(m_projectList, SIGNAL(clipSelected(DocClipBase *)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *)));
2096 disconnect(m_projectList, SIGNAL(refreshClip()), m_clipMonitor, SLOT(refreshMonitor()));
2097 m_clipMonitor->stop();
2099 KdenliveSettings::setCurrent_profile(doc->profilePath());
2100 KdenliveSettings::setProject_fps(doc->fps());
2101 m_monitorManager->resetProfiles(doc->timecode());
2102 m_projectList->setDocument(doc);
2103 m_transitionConfig->updateProjectFormat(doc->mltProfile(), doc->timecode(), doc->tracksList());
2104 m_effectStack->updateProjectFormat(doc->mltProfile(), doc->timecode());
2105 connect(m_projectList, SIGNAL(clipSelected(DocClipBase *, QPoint)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *, QPoint)));
2106 connect(m_projectList, SIGNAL(refreshClip()), m_clipMonitor, SLOT(refreshMonitor()));
2107 connect(m_projectList, SIGNAL(clipNeedsReload(const QString&, bool)), trackView->projectView(), SLOT(slotUpdateClip(const QString &, bool)));
2109 connect(m_projectList, SIGNAL(projectModified()), doc, SLOT(setModified()));
2110 connect(m_projectList, SIGNAL(clipNameChanged(const QString, const QString)), trackView->projectView(), SLOT(clipNameChanged(const QString, const QString)));
2112 connect(m_projectList, SIGNAL(findInTimeline(const QString&)), this, SLOT(slotClipInTimeline(const QString&)));
2115 connect(trackView, SIGNAL(cursorMoved()), m_projectMonitor, SLOT(activateMonitor()));
2116 connect(trackView, SIGNAL(insertTrack(int)), this, SLOT(slotInsertTrack(int)));
2117 connect(trackView, SIGNAL(deleteTrack(int)), this, SLOT(slotDeleteTrack(int)));
2118 connect(trackView, SIGNAL(configTrack(int)), this, SLOT(slotConfigTrack(int)));
2119 connect(trackView, SIGNAL(updateTracksInfo()), this, SLOT(slotUpdateTrackInfo()));
2120 connect(trackView, SIGNAL(mousePosition(int)), this, SLOT(slotUpdateMousePosition(int)));
2121 connect(m_projectMonitor, SIGNAL(renderPosition(int)), trackView, SLOT(moveCursorPos(int)));
2122 connect(m_projectMonitor, SIGNAL(zoneUpdated(QPoint)), trackView, SLOT(slotSetZone(QPoint)));
2123 connect(m_clipMonitor, SIGNAL(zoneUpdated(QPoint)), m_projectList, SLOT(slotUpdateClipCut(QPoint)));
2124 connect(m_projectMonitor, SIGNAL(zoneUpdated(QPoint)), doc, SLOT(setModified()));
2125 connect(m_clipMonitor, SIGNAL(zoneUpdated(QPoint)), doc, SLOT(setModified()));
2126 connect(m_projectMonitor, SIGNAL(durationChanged(int)), trackView, SLOT(setDuration(int)));
2127 connect(m_projectMonitor->render, SIGNAL(refreshDocumentProducers()), doc, SLOT(checkProjectClips()));
2129 connect(doc, SIGNAL(addProjectClip(DocClipBase *, bool)), m_projectList, SLOT(slotAddClip(DocClipBase *, bool)));
2130 connect(doc, SIGNAL(resetProjectList()), m_projectList, SLOT(slotResetProjectList()));
2131 connect(doc, SIGNAL(signalDeleteProjectClip(const QString &)), m_projectList, SLOT(slotDeleteClip(const QString &)));
2132 connect(doc, SIGNAL(updateClipDisplay(const QString &)), m_projectList, SLOT(slotUpdateClip(const QString &)));
2133 connect(doc, SIGNAL(selectLastAddedClip(const QString &)), m_projectList, SLOT(slotSelectClip(const QString &)));
2135 connect(doc, SIGNAL(deleteTimelineClip(const QString &)), trackView, SLOT(slotDeleteClip(const QString &)));
2136 connect(doc, SIGNAL(docModified(bool)), this, SLOT(slotUpdateDocumentState(bool)));
2137 connect(doc, SIGNAL(guidesUpdated()), this, SLOT(slotGuidesUpdated()));
2140 connect(trackView->projectView(), SIGNAL(clipItemSelected(ClipItem*, int)), m_effectStack, SLOT(slotClipItemSelected(ClipItem*, int)));
2141 connect(trackView->projectView(), SIGNAL(updateClipMarkers(DocClipBase *)), this, SLOT(slotUpdateClipMarkers(DocClipBase*)));
2143 connect(trackView->projectView(), SIGNAL(clipItemSelected(ClipItem*, int)), this, SLOT(slotActivateEffectStackView()));
2144 connect(trackView->projectView(), SIGNAL(transitionItemSelected(Transition*, int, QPoint, bool)), m_transitionConfig, SLOT(slotTransitionItemSelected(Transition*, int, QPoint, bool)));
2145 connect(trackView->projectView(), SIGNAL(transitionItemSelected(Transition*, int, QPoint, bool)), this, SLOT(slotActivateTransitionView(Transition *)));
2146 m_zoomSlider->setValue(doc->zoom().x());
2147 connect(trackView->projectView(), SIGNAL(zoomIn()), this, SLOT(slotZoomIn()));
2148 connect(trackView->projectView(), SIGNAL(zoomOut()), this, SLOT(slotZoomOut()));
2149 connect(trackView, SIGNAL(setZoom(int)), this, SLOT(slotSetZoom(int)));
2150 connect(trackView->projectView(), SIGNAL(displayMessage(const QString&, MessageType)), m_messageLabel, SLOT(setMessage(const QString&, MessageType)));
2152 connect(trackView->projectView(), SIGNAL(showClipFrame(DocClipBase *, QPoint, const int)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *, QPoint, const int)));
2153 connect(trackView->projectView(), SIGNAL(playMonitor()), m_projectMonitor, SLOT(slotPlay()));
2156 connect(m_effectStack, SIGNAL(updateClipEffect(ClipItem*, QDomElement, QDomElement, int)), trackView->projectView(), SLOT(slotUpdateClipEffect(ClipItem*, QDomElement, QDomElement, int)));
2157 connect(m_effectStack, SIGNAL(updateClipRegion(ClipItem*, int, QString)), trackView->projectView(), SLOT(slotUpdateClipRegion(ClipItem*, int, QString)));
2158 connect(m_effectStack, SIGNAL(removeEffect(ClipItem*, QDomElement)), trackView->projectView(), SLOT(slotDeleteEffect(ClipItem*, QDomElement)));
2159 connect(m_effectStack, SIGNAL(changeEffectState(ClipItem*, int, bool)), trackView->projectView(), SLOT(slotChangeEffectState(ClipItem*, int, bool)));
2160 connect(m_effectStack, SIGNAL(changeEffectPosition(ClipItem*, int, int)), trackView->projectView(), SLOT(slotChangeEffectPosition(ClipItem*, int, int)));
2161 connect(m_effectStack, SIGNAL(refreshEffectStack(ClipItem*)), trackView->projectView(), SLOT(slotRefreshEffects(ClipItem*)));
2162 connect(m_transitionConfig, SIGNAL(transitionUpdated(Transition *, QDomElement)), trackView->projectView() , SLOT(slotTransitionUpdated(Transition *, QDomElement)));
2163 connect(m_transitionConfig, SIGNAL(seekTimeline(int)), trackView->projectView() , SLOT(setCursorPos(int)));
2164 connect(m_effectStack, SIGNAL(seekTimeline(int)), trackView->projectView() , SLOT(setCursorPos(int)));
2165 connect(m_effectStack, SIGNAL(reloadEffects()), this, SLOT(slotReloadEffects()));
2167 connect(trackView->projectView(), SIGNAL(activateDocumentMonitor()), m_projectMonitor, SLOT(activateMonitor()));
2168 connect(trackView, SIGNAL(zoneMoved(int, int)), this, SLOT(slotZoneMoved(int, int)));
2169 connect(m_projectList, SIGNAL(loadingIsOver()), trackView->projectView(), SLOT(slotUpdateAllThumbs()));
2170 connect(m_projectList, SIGNAL(displayMessage(const QString&, int)), this, SLOT(slotGotProgressInfo(const QString&, int)));
2171 connect(m_projectList, SIGNAL(updateRenderStatus()), this, SLOT(slotCheckRenderStatus()));
2174 trackView->projectView()->setContextMenu(m_timelineContextMenu, m_timelineContextClipMenu, m_timelineContextTransitionMenu, m_clipTypeGroup, (QMenu*)(factory()->container("marker_menu", this)));
2175 m_activeTimeline = trackView;
2176 if (m_renderWidget) {
2177 slotCheckRenderStatus();
2178 m_renderWidget->setProfile(doc->mltProfile());
2179 m_renderWidget->setGuides(doc->guidesXml(), doc->projectDuration());
2180 m_renderWidget->setDocumentPath(doc->projectFolder().path(KUrl::AddTrailingSlash));
2181 m_renderWidget->setRenderProfile(doc->getDocumentProperty("renderdestination"), doc->getDocumentProperty("rendercategory"), doc->getDocumentProperty("renderprofile"), doc->getDocumentProperty("renderurl"));
2183 //doc->setRenderer(m_projectMonitor->render);
2184 m_commandStack->setActiveStack(doc->commandStack());
2185 KdenliveSettings::setProject_display_ratio(doc->dar());
2186 //doc->clipManager()->checkAudioThumbs();
2188 //m_overView->setScene(trackView->projectScene());
2189 //m_overView->scale(m_overView->width() / trackView->duration(), m_overView->height() / (50 * trackView->tracksNumber()));
2190 //m_overView->fitInView(m_overView->itemAt(0, 50), Qt::KeepAspectRatio);
2192 setCaption(doc->description(), doc->isModified());
2193 m_saveAction->setEnabled(doc->isModified());
2194 m_normalEditTool->setChecked(true);
2195 m_activeDocument = doc;
2196 m_activeTimeline->updateProjectFps();
2197 m_activeDocument->checkProjectClips();
2198 if (KdenliveSettings::dropbframes()) slotUpdatePreviewSettings();
2199 //Update the mouse position display so it will display in DF/NDF format by default based on the project setting.
2200 slotUpdateMousePosition(0);
2201 // set tool to select tool
2202 m_buttonSelectTool->setChecked(true);
2205 void MainWindow::slotZoneMoved(int start, int end)
2207 m_activeDocument->setZone(start, end);
2208 m_projectMonitor->slotZoneMoved(start, end);
2211 void MainWindow::slotGuidesUpdated()
2214 m_renderWidget->setGuides(m_activeDocument->guidesXml(), m_activeDocument->projectDuration());
2217 void MainWindow::slotEditKeys()
2219 KShortcutsDialog dialog(KShortcutsEditor::AllActions, KShortcutsEditor::LetterShortcutsAllowed, this);
2220 dialog.addCollection(actionCollection(), i18nc("general keyboard shortcuts", "General"));
2221 dialog.addCollection(m_effectsActionCollection, i18nc("effects and transitions keyboard shortcuts", "Effects & Transitions"));
2225 void MainWindow::slotPreferences(int page, int option)
2227 //An instance of your dialog could be already created and could be
2228 // cached, in which case you want to display the cached dialog
2229 // instead of creating another one
2230 if (KConfigDialog::showDialog("settings")) {
2231 KdenliveSettingsDialog* d = static_cast <KdenliveSettingsDialog*>(KConfigDialog::exists("settings"));
2232 if (page != -1) d->showPage(page, option);
2236 // KConfigDialog didn't find an instance of this dialog, so lets
2238 KdenliveSettingsDialog* dialog = new KdenliveSettingsDialog(this);
2239 connect(dialog, SIGNAL(settingsChanged(const QString&)), this, SLOT(updateConfiguration()));
2240 //connect(dialog, SIGNAL(doResetProfile()), this, SLOT(slotDetectAudioDriver()));
2241 connect(dialog, SIGNAL(doResetProfile()), m_monitorManager, SLOT(slotResetProfiles()));
2242 connect(dialog, SIGNAL(updatePreviewSettings()), this, SLOT(slotUpdatePreviewSettings()));
2244 connect(dialog, SIGNAL(updateCaptureFolder()), m_recMonitor, SLOT(slotUpdateCaptureFolder()));
2246 //connect(dialog, SIGNAL(updatePreviewSettings()), this, SLOT(slotUpdatePreviewSettings()));
2248 if (page != -1) dialog->showPage(page, option);
2251 void MainWindow::slotUpdatePreviewSettings()
2253 if (m_activeDocument) {
2254 m_clipMonitor->slotSetXml(NULL);
2255 m_activeDocument->updatePreviewSettings();
2259 void MainWindow::updateConfiguration()
2261 //TODO: we should apply settings to all projects, not only the current one
2262 if (m_activeTimeline) {
2263 m_activeTimeline->refresh();
2264 m_activeTimeline->projectView()->checkAutoScroll();
2265 m_activeTimeline->projectView()->checkTrackHeight();
2266 if (m_activeDocument)
2267 m_activeDocument->clipManager()->checkAudioThumbs();
2269 m_buttonAudioThumbs->setChecked(KdenliveSettings::audiothumbnails());
2270 m_buttonVideoThumbs->setChecked(KdenliveSettings::videothumbnails());
2271 m_buttonAutomaticSplitAudio->setChecked(KdenliveSettings::splitaudio());
2273 // Update list of transcoding profiles
2275 #ifndef NO_JOGSHUTTLE
2276 activateShuttleDevice();
2277 #endif /* NO_JOGSHUTTLE */
2281 void MainWindow::slotSwitchSplitAudio()
2283 KdenliveSettings::setSplitaudio(!KdenliveSettings::splitaudio());
2284 m_buttonAutomaticSplitAudio->setChecked(KdenliveSettings::splitaudio());
2287 void MainWindow::slotSwitchVideoThumbs()
2289 KdenliveSettings::setVideothumbnails(!KdenliveSettings::videothumbnails());
2290 if (m_activeTimeline)
2291 m_activeTimeline->projectView()->slotUpdateAllThumbs();
2292 m_buttonVideoThumbs->setChecked(KdenliveSettings::videothumbnails());
2295 void MainWindow::slotSwitchAudioThumbs()
2297 KdenliveSettings::setAudiothumbnails(!KdenliveSettings::audiothumbnails());
2298 if (m_activeTimeline) {
2299 m_activeTimeline->refresh();
2300 m_activeTimeline->projectView()->checkAutoScroll();
2301 if (m_activeDocument)
2302 m_activeDocument->clipManager()->checkAudioThumbs();
2304 m_buttonAudioThumbs->setChecked(KdenliveSettings::audiothumbnails());
2307 void MainWindow::slotSwitchMarkersComments()
2309 KdenliveSettings::setShowmarkers(!KdenliveSettings::showmarkers());
2310 if (m_activeTimeline)
2311 m_activeTimeline->refresh();
2312 m_buttonShowMarkers->setChecked(KdenliveSettings::showmarkers());
2315 void MainWindow::slotSwitchSnap()
2317 KdenliveSettings::setSnaptopoints(!KdenliveSettings::snaptopoints());
2318 m_buttonSnap->setChecked(KdenliveSettings::snaptopoints());
2322 void MainWindow::slotDeleteItem()
2324 if (QApplication::focusWidget() &&
2325 QApplication::focusWidget()->parentWidget() &&
2326 QApplication::focusWidget()->parentWidget()->parentWidget() &&
2327 QApplication::focusWidget()->parentWidget()->parentWidget() == m_projectListDock) {
2328 m_projectList->slotRemoveClip();
2331 QWidget *widget = QApplication::focusWidget();
2333 if (widget == m_effectStackDock) {
2334 m_effectStack->slotItemDel();
2337 widget = widget->parentWidget();
2340 // effect stack has no focus
2341 if (m_activeTimeline)
2342 m_activeTimeline->projectView()->deleteSelectedClips();
2346 void MainWindow::slotUpdateClipMarkers(DocClipBase *clip)
2348 if (m_clipMonitor->isActive())
2349 m_clipMonitor->checkOverlay();
2350 m_clipMonitor->updateMarkers(clip);
2353 void MainWindow::slotAddClipMarker()
2355 DocClipBase *clip = NULL;
2357 if (m_projectMonitor->isActive()) {
2358 if (m_activeTimeline) {
2359 ClipItem *item = m_activeTimeline->projectView()->getActiveClipUnderCursor();
2361 pos = GenTime((int)((m_projectMonitor->position() - item->startPos() + item->cropStart()).frames(m_activeDocument->fps()) * item->speed() + 0.5), m_activeDocument->fps());
2362 clip = item->baseClip();
2366 clip = m_clipMonitor->activeClip();
2367 pos = m_clipMonitor->position();
2370 m_messageLabel->setMessage(i18n("Cannot find clip to add marker"), ErrorMessage);
2373 QString id = clip->getId();
2374 CommentedTime marker(pos, i18n("Marker"));
2375 MarkerDialog d(clip, marker, m_activeDocument->timecode(), i18n("Add Marker"), this);
2376 if (d.exec() == QDialog::Accepted)
2377 m_activeTimeline->projectView()->slotAddClipMarker(id, d.newMarker().time(), d.newMarker().comment());
2380 void MainWindow::slotDeleteClipMarker()
2382 DocClipBase *clip = NULL;
2384 if (m_projectMonitor->isActive()) {
2385 if (m_activeTimeline) {
2386 ClipItem *item = m_activeTimeline->projectView()->getActiveClipUnderCursor();
2388 pos = (m_projectMonitor->position() - item->startPos() + item->cropStart()) / item->speed();
2389 clip = item->baseClip();
2393 clip = m_clipMonitor->activeClip();
2394 pos = m_clipMonitor->position();
2397 m_messageLabel->setMessage(i18n("Cannot find clip to remove marker"), ErrorMessage);
2401 QString id = clip->getId();
2402 QString comment = clip->markerComment(pos);
2403 if (comment.isEmpty()) {
2404 m_messageLabel->setMessage(i18n("No marker found at cursor time"), ErrorMessage);
2407 m_activeTimeline->projectView()->slotDeleteClipMarker(comment, id, pos);
2410 void MainWindow::slotDeleteAllClipMarkers()
2412 DocClipBase *clip = NULL;
2413 if (m_projectMonitor->isActive()) {
2414 if (m_activeTimeline) {
2415 ClipItem *item = m_activeTimeline->projectView()->getActiveClipUnderCursor();
2417 clip = item->baseClip();
2421 clip = m_clipMonitor->activeClip();
2424 m_messageLabel->setMessage(i18n("Cannot find clip to remove marker"), ErrorMessage);
2427 m_activeTimeline->projectView()->slotDeleteAllClipMarkers(clip->getId());
2430 void MainWindow::slotEditClipMarker()
2432 DocClipBase *clip = NULL;
2434 if (m_projectMonitor->isActive()) {
2435 if (m_activeTimeline) {
2436 ClipItem *item = m_activeTimeline->projectView()->getActiveClipUnderCursor();
2438 pos = (m_projectMonitor->position() - item->startPos() + item->cropStart()) / item->speed();
2439 clip = item->baseClip();
2443 clip = m_clipMonitor->activeClip();
2444 pos = m_clipMonitor->position();
2447 m_messageLabel->setMessage(i18n("Cannot find clip to remove marker"), ErrorMessage);
2451 QString id = clip->getId();
2452 QString oldcomment = clip->markerComment(pos);
2453 if (oldcomment.isEmpty()) {
2454 m_messageLabel->setMessage(i18n("No marker found at cursor time"), ErrorMessage);
2458 CommentedTime marker(pos, oldcomment);
2459 MarkerDialog d(clip, marker, m_activeDocument->timecode(), i18n("Edit Marker"), this);
2460 if (d.exec() == QDialog::Accepted) {
2461 m_activeTimeline->projectView()->slotAddClipMarker(id, d.newMarker().time(), d.newMarker().comment());
2462 if (d.newMarker().time() != pos) {
2463 // remove old marker
2464 m_activeTimeline->projectView()->slotAddClipMarker(id, pos, QString());
2469 void MainWindow::slotAddGuide()
2471 if (m_activeTimeline)
2472 m_activeTimeline->projectView()->slotAddGuide();
2475 void MainWindow::slotInsertSpace()
2477 if (m_activeTimeline)
2478 m_activeTimeline->projectView()->slotInsertSpace();
2481 void MainWindow::slotRemoveSpace()
2483 if (m_activeTimeline)
2484 m_activeTimeline->projectView()->slotRemoveSpace();
2487 void MainWindow::slotInsertTrack(int ix)
2489 m_projectMonitor->activateMonitor();
2490 if (m_activeTimeline)
2491 m_activeTimeline->projectView()->slotInsertTrack(ix);
2492 if (m_activeDocument)
2493 m_transitionConfig->updateProjectFormat(m_activeDocument->mltProfile(), m_activeDocument->timecode(), m_activeDocument->tracksList());
2496 void MainWindow::slotDeleteTrack(int ix)
2498 m_projectMonitor->activateMonitor();
2499 if (m_activeTimeline)
2500 m_activeTimeline->projectView()->slotDeleteTrack(ix);
2501 if (m_activeDocument)
2502 m_transitionConfig->updateProjectFormat(m_activeDocument->mltProfile(), m_activeDocument->timecode(), m_activeDocument->tracksList());
2505 void MainWindow::slotConfigTrack(int ix)
2507 m_projectMonitor->activateMonitor();
2508 if (m_activeTimeline)
2509 m_activeTimeline->projectView()->slotConfigTracks(ix);
2510 if (m_activeDocument)
2511 m_transitionConfig->updateProjectFormat(m_activeDocument->mltProfile(), m_activeDocument->timecode(), m_activeDocument->tracksList());
2514 void MainWindow::slotEditGuide()
2516 if (m_activeTimeline)
2517 m_activeTimeline->projectView()->slotEditGuide();
2520 void MainWindow::slotDeleteGuide()
2522 if (m_activeTimeline)
2523 m_activeTimeline->projectView()->slotDeleteGuide();
2526 void MainWindow::slotDeleteAllGuides()
2528 if (m_activeTimeline)
2529 m_activeTimeline->projectView()->slotDeleteAllGuides();
2532 void MainWindow::slotCutTimelineClip()
2534 if (m_activeTimeline)
2535 m_activeTimeline->projectView()->cutSelectedClips();
2538 void MainWindow::slotInsertClipOverwrite()
2540 if (m_activeTimeline) {
2541 QStringList data = m_clipMonitor->getZoneInfo();
2542 m_activeTimeline->projectView()->insertZoneOverwrite(data, m_activeTimeline->inPoint());
2546 void MainWindow::slotSelectTimelineClip()
2548 if (m_activeTimeline)
2549 m_activeTimeline->projectView()->selectClip(true);
2552 void MainWindow::slotSelectTimelineTransition()
2554 if (m_activeTimeline)
2555 m_activeTimeline->projectView()->selectTransition(true);
2558 void MainWindow::slotDeselectTimelineClip()
2560 if (m_activeTimeline)
2561 m_activeTimeline->projectView()->selectClip(false, true);
2564 void MainWindow::slotDeselectTimelineTransition()
2566 if (m_activeTimeline)
2567 m_activeTimeline->projectView()->selectTransition(false, true);
2570 void MainWindow::slotSelectAddTimelineClip()
2572 if (m_activeTimeline)
2573 m_activeTimeline->projectView()->selectClip(true, true);
2576 void MainWindow::slotSelectAddTimelineTransition()
2578 if (m_activeTimeline)
2579 m_activeTimeline->projectView()->selectTransition(true, true);
2582 void MainWindow::slotGroupClips()
2584 if (m_activeTimeline)
2585 m_activeTimeline->projectView()->groupClips();
2588 void MainWindow::slotUnGroupClips()
2590 if (m_activeTimeline)
2591 m_activeTimeline->projectView()->groupClips(false);
2594 void MainWindow::slotEditItemDuration()
2596 if (m_activeTimeline)
2597 m_activeTimeline->projectView()->editItemDuration();
2600 void MainWindow::slotAddProjectClip(KUrl url)
2602 if (m_activeDocument)
2603 m_activeDocument->slotAddClipFile(url, QString());
2606 void MainWindow::slotAddTransition(QAction *result)
2608 if (!result) return;
2609 QStringList info = result->data().toStringList();
2610 if (info.isEmpty()) return;
2611 QDomElement transition = transitions.getEffectByTag(info.at(1), info.at(2));
2612 if (m_activeTimeline && !transition.isNull()) {
2613 m_activeTimeline->projectView()->slotAddTransitionToSelectedClips(transition.cloneNode().toElement());
2617 void MainWindow::slotAddVideoEffect(QAction *result)
2619 if (!result) return;
2620 QStringList info = result->data().toStringList();
2621 if (info.isEmpty()) return;
2622 QDomElement effect = videoEffects.getEffectByTag(info.at(1), info.at(2));
2623 slotAddEffect(effect);
2626 void MainWindow::slotAddAudioEffect(QAction *result)
2628 if (!result) return;
2629 QStringList info = result->data().toStringList();
2630 if (info.isEmpty()) return;
2631 QDomElement effect = audioEffects.getEffectByTag(info.at(1), info.at(2));
2632 slotAddEffect(effect);
2635 void MainWindow::slotAddCustomEffect(QAction *result)
2637 if (!result) return;
2638 QStringList info = result->data().toStringList();
2639 if (info.isEmpty()) return;
2640 QDomElement effect = customEffects.getEffectByTag(info.at(1), info.at(2));
2641 slotAddEffect(effect);
2644 void MainWindow::slotZoomIn()
2646 m_zoomSlider->setValue(m_zoomSlider->value() - 1);
2647 slotShowZoomSliderToolTip();
2650 void MainWindow::slotZoomOut()
2652 m_zoomSlider->setValue(m_zoomSlider->value() + 1);
2653 slotShowZoomSliderToolTip();
2656 void MainWindow::slotFitZoom()
2658 if (m_activeTimeline)
2659 m_zoomSlider->setValue(m_activeTimeline->fitZoom());
2662 void MainWindow::slotSetZoom(int value)
2664 if (m_activeTimeline)
2665 m_activeTimeline->slotChangeZoom(value);
2667 m_zoomOut->setEnabled(value < m_zoomSlider->maximum());
2668 m_zoomIn->setEnabled(value > m_zoomSlider->minimum());
2669 slotUpdateZoomSliderToolTip(value);
2671 m_zoomSlider->blockSignals(true);
2672 m_zoomSlider->setValue(value);
2673 m_zoomSlider->blockSignals(false);
2676 void MainWindow::slotShowZoomSliderToolTip(int zoomlevel)
2678 if (zoomlevel != -1)
2679 slotUpdateZoomSliderToolTip(zoomlevel);
2681 QPoint global = m_zoomSlider->rect().topLeft();
2682 global.ry() += m_zoomSlider->height() / 2;
2683 QHelpEvent toolTipEvent(QEvent::ToolTip, QPoint(0, 0), m_zoomSlider->mapToGlobal(global));
2684 QApplication::sendEvent(m_zoomSlider, &toolTipEvent);
2687 void MainWindow::slotUpdateZoomSliderToolTip(int zoomlevel)
2689 m_zoomSlider->setToolTip(i18n("Zoom Level: %1/13", (13 - zoomlevel)));
2692 void MainWindow::slotGotProgressInfo(const QString &message, int progress)
2694 m_statusProgressBar->setValue(progress);
2695 if (progress >= 0) {
2696 if (!message.isEmpty())
2697 m_messageLabel->setMessage(message, InformationMessage);//statusLabel->setText(message);
2698 m_statusProgressBar->setVisible(true);
2699 } else if (progress == -2) {
2700 if (!message.isEmpty())
2701 m_messageLabel->setMessage(message, ErrorMessage);
2702 m_statusProgressBar->setVisible(false);
2704 m_messageLabel->setMessage(QString(), DefaultMessage);
2705 m_statusProgressBar->setVisible(false);
2709 void MainWindow::slotShowClipProperties(DocClipBase *clip)
2711 if (clip->clipType() == TEXT) {
2712 QString titlepath = m_activeDocument->projectFolder().path(KUrl::AddTrailingSlash) + "titles/";
2713 if (!clip->getProperty("resource").isEmpty() && clip->getProperty("xmldata").isEmpty()) {
2714 // template text clip
2716 // Get the list of existing templates
2718 filter << "*.kdenlivetitle";
2719 QStringList templateFiles = QDir(titlepath).entryList(filter, QDir::Files);
2721 QDialog *dia = new QDialog(this);
2722 Ui::TemplateClip_UI dia_ui;
2723 dia_ui.setupUi(dia);
2725 const QString templatePath = clip->getProperty("resource");
2726 for (int i = 0; i < templateFiles.size(); ++i) {
2727 dia_ui.template_list->comboBox()->addItem(templateFiles.at(i), titlepath + templateFiles.at(i));
2728 if (templatePath == KUrl(titlepath + templateFiles.at(i)).path()) ix = i;
2730 if (ix != -1) dia_ui.template_list->comboBox()->setCurrentIndex(ix);
2731 else dia_ui.template_list->comboBox()->insertItem(0, templatePath);
2732 dia_ui.template_list->fileDialog()->setFilter("*.kdenlivetitle");
2733 //warning: setting base directory doesn't work??
2734 KUrl startDir(titlepath);
2735 dia_ui.template_list->fileDialog()->setUrl(startDir);
2736 dia_ui.description->setText(clip->getProperty("description"));
2737 if (dia->exec() == QDialog::Accepted) {
2738 QString textTemplate = dia_ui.template_list->comboBox()->itemData(dia_ui.template_list->comboBox()->currentIndex()).toString();
2739 if (textTemplate.isEmpty()) textTemplate = dia_ui.template_list->comboBox()->currentText();
2741 QMap <QString, QString> newprops;
2743 if (KUrl(textTemplate).path() != templatePath) {
2744 // The template was changed
2745 newprops.insert("resource", textTemplate);
2748 if (dia_ui.description->toPlainText() != clip->getProperty("description")) {
2749 newprops.insert("description", dia_ui.description->toPlainText());
2752 QString newtemplate = newprops.value("xmltemplate");
2753 if (newtemplate.isEmpty()) newtemplate = templatePath;
2755 // template modified we need to update xmldata
2756 QString description = newprops.value("description");
2757 if (description.isEmpty()) description = clip->getProperty("description");
2758 else newprops.insert("templatetext", description);
2759 //newprops.insert("xmldata", m_projectList->generateTemplateXml(newtemplate, description).toString());
2760 if (!newprops.isEmpty()) {
2761 EditClipCommand *command = new EditClipCommand(m_projectList, clip->getId(), clip->properties(), newprops, true);
2762 m_activeDocument->commandStack()->push(command);
2768 QString path = clip->getProperty("resource");
2769 TitleWidget *dia_ui = new TitleWidget(KUrl(), m_activeDocument->timecode(), titlepath, m_projectMonitor->render, this);
2771 doc.setContent(clip->getProperty("xmldata"));
2772 dia_ui->setXml(doc);
2773 if (dia_ui->exec() == QDialog::Accepted) {
2774 QMap <QString, QString> newprops;
2775 newprops.insert("xmldata", dia_ui->xml().toString());
2776 if (dia_ui->outPoint() != clip->duration().frames(m_activeDocument->fps()) - 1) {
2777 // duration changed, we need to update duration
2778 newprops.insert("out", QString::number(dia_ui->outPoint()));
2780 EditClipCommand *command = new EditClipCommand(m_projectList, clip->getId(), clip->properties(), newprops, true);
2781 m_activeDocument->commandStack()->push(command);
2782 //m_activeTimeline->projectView()->slotUpdateClip(clip->getId());
2783 m_activeDocument->setModified(true);
2787 //m_activeDocument->editTextClip(clip->getProperty("xml"), clip->getId());
2790 ClipProperties dia(clip, m_activeDocument->timecode(), m_activeDocument->fps(), this);
2791 connect(&dia, SIGNAL(addMarker(const QString &, GenTime, QString)), m_activeTimeline->projectView(), SLOT(slotAddClipMarker(const QString &, GenTime, QString)));
2792 if (dia.exec() == QDialog::Accepted) {
2793 QMap <QString, QString> newprops = dia.properties();
2794 if (newprops.isEmpty()) return;
2795 EditClipCommand *command = new EditClipCommand(m_projectList, clip->getId(), clip->properties(), newprops, true);
2796 m_activeDocument->commandStack()->push(command);
2798 if (dia.needsTimelineRefresh()) {
2799 // update clip occurences in timeline
2800 m_activeTimeline->projectView()->slotUpdateClip(clip->getId(), dia.needsTimelineReload());
2806 void MainWindow::slotShowClipProperties(QList <DocClipBase *> cliplist, QMap<QString, QString> commonproperties)
2808 ClipProperties dia(cliplist, m_activeDocument->timecode(), commonproperties, this);
2809 if (dia.exec() == QDialog::Accepted) {
2810 QUndoCommand *command = new QUndoCommand();
2811 command->setText(i18n("Edit clips"));
2812 for (int i = 0; i < cliplist.count(); i++) {
2813 DocClipBase *clip = cliplist.at(i);
2814 new EditClipCommand(m_projectList, clip->getId(), clip->properties(), dia.properties(), true, command);
2816 m_activeDocument->commandStack()->push(command);
2817 for (int i = 0; i < cliplist.count(); i++)
2818 m_activeTimeline->projectView()->slotUpdateClip(cliplist.at(i)->getId(), dia.needsTimelineReload());
2822 void MainWindow::customEvent(QEvent* e)
2824 if (e->type() == QEvent::User)
2825 m_messageLabel->setMessage(static_cast <MltErrorEvent *>(e)->message(), MltError);
2827 void MainWindow::slotActivateEffectStackView()
2829 m_effectStack->raiseWindow(m_effectStackDock);
2832 void MainWindow::slotActivateTransitionView(Transition *t)
2835 m_transitionConfig->raiseWindow(m_transitionConfigDock);
2838 void MainWindow::slotSnapRewind()
2840 if (m_projectMonitor->isActive()) {
2841 if (m_activeTimeline)
2842 m_activeTimeline->projectView()->slotSeekToPreviousSnap();
2844 m_clipMonitor->slotSeekToPreviousSnap();
2848 void MainWindow::slotSnapForward()
2850 if (m_projectMonitor->isActive()) {
2851 if (m_activeTimeline)
2852 m_activeTimeline->projectView()->slotSeekToNextSnap();
2854 m_clipMonitor->slotSeekToNextSnap();
2858 void MainWindow::slotClipStart()
2860 if (m_projectMonitor->isActive()) {
2861 if (m_activeTimeline)
2862 m_activeTimeline->projectView()->clipStart();
2866 void MainWindow::slotClipEnd()
2868 if (m_projectMonitor->isActive()) {
2869 if (m_activeTimeline)
2870 m_activeTimeline->projectView()->clipEnd();
2874 void MainWindow::slotZoneStart()
2876 if (m_projectMonitor->isActive())
2877 m_projectMonitor->slotZoneStart();
2879 m_clipMonitor->slotZoneStart();
2882 void MainWindow::slotZoneEnd()
2884 if (m_projectMonitor->isActive())
2885 m_projectMonitor->slotZoneEnd();
2887 m_clipMonitor->slotZoneEnd();
2890 void MainWindow::slotChangeTool(QAction * action)
2892 if (action == m_buttonSelectTool)
2893 slotSetTool(SELECTTOOL);
2894 else if (action == m_buttonRazorTool)
2895 slotSetTool(RAZORTOOL);
2896 else if (action == m_buttonSpacerTool)
2897 slotSetTool(SPACERTOOL);
2900 void MainWindow::slotChangeEdit(QAction * action)
2902 if (!m_activeTimeline)
2905 if (action == m_overwriteEditTool)
2906 m_activeTimeline->projectView()->setEditMode(OVERWRITEEDIT);
2907 else if (action == m_insertEditTool)
2908 m_activeTimeline->projectView()->setEditMode(INSERTEDIT);
2910 m_activeTimeline->projectView()->setEditMode(NORMALEDIT);
2913 void MainWindow::slotSetTool(PROJECTTOOL tool)
2915 if (m_activeDocument && m_activeTimeline) {
2916 //m_activeDocument->setTool(tool);
2920 message = i18n("Ctrl + click to use spacer on current track only");
2923 message = i18n("Click on a clip to cut it");
2926 message = i18n("Shift + click to create a selection rectangle, Ctrl + click to add an item to selection");
2929 m_messageLabel->setMessage(message, InformationMessage);
2930 m_activeTimeline->projectView()->setTool(tool);
2934 void MainWindow::slotCopy()
2936 if (m_activeDocument && m_activeTimeline)
2937 m_activeTimeline->projectView()->copyClip();
2940 void MainWindow::slotPaste()
2942 if (m_activeDocument && m_activeTimeline)
2943 m_activeTimeline->projectView()->pasteClip();
2946 void MainWindow::slotPasteEffects()
2948 if (m_activeDocument && m_activeTimeline)
2949 m_activeTimeline->projectView()->pasteClipEffects();
2952 void MainWindow::slotFind()
2954 if (!m_activeDocument || !m_activeTimeline) return;
2955 m_projectSearch->setEnabled(false);
2956 m_findActivated = true;
2957 m_findString.clear();
2958 m_activeTimeline->projectView()->initSearchStrings();
2959 statusBar()->showMessage(i18n("Starting -- find text as you type"));
2960 m_findTimer.start(5000);
2961 qApp->installEventFilter(this);
2964 void MainWindow::slotFindNext()
2966 if (m_activeTimeline && m_activeTimeline->projectView()->findNextString(m_findString))
2967 statusBar()->showMessage(i18n("Found: %1", m_findString));
2969 statusBar()->showMessage(i18n("Reached end of project"));
2970 m_findTimer.start(4000);
2973 void MainWindow::findAhead()
2975 if (m_activeTimeline && m_activeTimeline->projectView()->findString(m_findString)) {
2976 m_projectSearchNext->setEnabled(true);
2977 statusBar()->showMessage(i18n("Found: %1", m_findString));
2979 m_projectSearchNext->setEnabled(false);
2980 statusBar()->showMessage(i18n("Not found: %1", m_findString));
2984 void MainWindow::findTimeout()
2986 m_projectSearchNext->setEnabled(false);
2987 m_findActivated = false;
2988 m_findString.clear();
2989 statusBar()->showMessage(i18n("Find stopped"), 3000);
2990 if (m_activeTimeline) m_activeTimeline->projectView()->clearSearchStrings();
2991 m_projectSearch->setEnabled(true);
2992 removeEventFilter(this);
2995 void MainWindow::slotClipInTimeline(const QString &clipId)
2997 if (m_activeTimeline && m_activeDocument) {
2998 QList<ItemInfo> matching = m_activeTimeline->projectView()->findId(clipId);
3000 QMenu *inTimelineMenu = static_cast<QMenu*>(factory()->container("clip_in_timeline", this));
3001 inTimelineMenu->clear();
3003 QList <QAction *> actionList;
3005 for (int i = 0; i < matching.count(); ++i) {
3006 QString track = QString::number(matching.at(i).track);
3007 QString start = m_activeDocument->timecode().getTimecode(matching.at(i).startPos);
3009 QAction *a = new QAction(track + ": " + start, this);
3010 a->setData(QStringList() << track << start);
3011 connect(a, SIGNAL(triggered()), this, SLOT(slotSelectClipInTimeline()));
3012 while (j < actionList.count()) {
3013 if (actionList.at(j)->text() > a->text()) break;
3016 actionList.insert(j, a);
3018 inTimelineMenu->addActions(actionList);
3020 if (matching.empty())
3021 inTimelineMenu->setEnabled(false);
3023 inTimelineMenu->setEnabled(true);
3027 void MainWindow::slotClipInProjectTree()
3029 if (m_activeTimeline) {
3030 const QStringList &clipIds = m_activeTimeline->projectView()->selectedClips();
3031 if (clipIds.isEmpty())
3033 m_projectListDock->raise();
3034 for (int i = 0; i < clipIds.count(); i++)
3035 m_projectList->selectItemById(clipIds.at(i));
3036 if (m_projectMonitor->isActive())
3037 slotSwitchMonitors();
3041 /*void MainWindow::slotClipToProjectTree()
3043 if (m_activeTimeline) {
3044 const QList<ClipItem *> clips = m_activeTimeline->projectView()->selectedClipItems();
3045 if (clips.isEmpty()) return;
3046 for (int i = 0; i < clips.count(); i++) {
3047 m_projectList->slotAddXmlClip(clips.at(i)->itemXml());
3049 //m_projectList->selectItemById(clipIds.at(i));
3053 void MainWindow::slotSelectClipInTimeline()
3055 if (m_activeTimeline) {
3056 QAction *action = qobject_cast<QAction *>(sender());
3057 QStringList data = action->data().toStringList();
3058 m_activeTimeline->projectView()->selectFound(data.at(0), data.at(1));
3062 void MainWindow::keyPressEvent(QKeyEvent *ke)
3064 if (m_findActivated) {
3065 if (ke->key() == Qt::Key_Backspace) {
3066 m_findString = m_findString.left(m_findString.length() - 1);
3068 if (!m_findString.isEmpty())
3073 m_findTimer.start(4000);
3076 } else if (ke->key() == Qt::Key_Escape) {
3080 } else if (ke->key() == Qt::Key_Space || !ke->text().trimmed().isEmpty()) {
3081 m_findString += ke->text();
3085 m_findTimer.start(4000);
3090 KXmlGuiWindow::keyPressEvent(ke);
3095 /** Gets called when the window gets hidden */
3096 void MainWindow::hideEvent(QHideEvent */*event*/)
3099 if (m_monitorManager)
3100 m_monitorManager->stopActiveMonitor();
3103 bool MainWindow::eventFilter(QObject *obj, QEvent *event)
3105 if (m_findActivated) {
3106 if (event->type() == QEvent::ShortcutOverride) {
3107 QKeyEvent* ke = (QKeyEvent*) event;
3108 if (ke->text().trimmed().isEmpty()) return false;
3115 // pass the event on to the parent class
3116 return QMainWindow::eventFilter(obj, event);
3121 void MainWindow::slotSaveZone(Render *render, QPoint zone)
3123 KDialog *dialog = new KDialog(this);
3124 dialog->setCaption("Save clip zone");
3125 dialog->setButtons(KDialog::Ok | KDialog::Cancel);
3127 QWidget *widget = new QWidget(dialog);
3128 dialog->setMainWidget(widget);
3130 QVBoxLayout *vbox = new QVBoxLayout(widget);
3131 QLabel *label1 = new QLabel(i18n("Save clip zone as:"), this);
3132 QString path = m_activeDocument->projectFolder().path();
3134 path.append("untitled.mlt");
3135 KUrlRequester *url = new KUrlRequester(KUrl(path), this);
3136 url->setFilter("video/mlt-playlist");
3137 QLabel *label2 = new QLabel(i18n("Description:"), this);
3138 KLineEdit *edit = new KLineEdit(this);
3139 vbox->addWidget(label1);
3140 vbox->addWidget(url);
3141 vbox->addWidget(label2);
3142 vbox->addWidget(edit);
3143 if (dialog->exec() == QDialog::Accepted)
3144 render->saveZone(url->url(), edit->text(), zone);
3148 void MainWindow::slotSetInPoint()
3150 if (m_clipMonitor->isActive())
3151 m_clipMonitor->slotSetZoneStart();
3153 m_projectMonitor->slotSetZoneStart();
3154 //else m_activeTimeline->projectView()->setInPoint();
3157 void MainWindow::slotSetOutPoint()
3159 if (m_clipMonitor->isActive())
3160 m_clipMonitor->slotSetZoneEnd();
3162 m_projectMonitor->slotSetZoneEnd();
3163 // else m_activeTimeline->projectView()->setOutPoint();
3166 void MainWindow::slotResizeItemStart()
3168 if (m_activeTimeline)
3169 m_activeTimeline->projectView()->setInPoint();
3172 void MainWindow::slotResizeItemEnd()
3174 if (m_activeTimeline)
3175 m_activeTimeline->projectView()->setOutPoint();
3178 int MainWindow::getNewStuff(const QString &configFile)
3180 KNS3::Entry::List entries;
3181 #if KDE_IS_VERSION(4,3,80)
3182 KNS3::DownloadDialog dialog(configFile);
3184 entries = dialog.changedEntries();
3185 foreach(const KNS3::Entry &entry, entries) {
3186 if (entry.status() == KNS3::Entry::Installed)
3187 kDebug() << "// Installed files: " << entry.installedFiles();
3190 KNS::Engine engine(0);
3191 if (engine.init(configFile))
3192 entries = engine.downloadDialogModal(this);
3193 foreach(KNS::Entry *entry, entries) {
3194 if (entry->status() == KNS::Entry::Installed)
3195 kDebug() << "// Installed files: " << entry->installedFiles();
3197 #endif /* KDE_IS_VERSION(4,3,80) */
3198 return entries.size();
3201 void MainWindow::slotGetNewTitleStuff()
3203 if (getNewStuff("kdenlive_titles.knsrc") > 0)
3204 TitleWidget::refreshTitleTemplates();
3207 void MainWindow::slotGetNewLumaStuff()
3209 if (getNewStuff("kdenlive_wipes.knsrc") > 0) {
3210 initEffects::refreshLumas();
3211 m_activeTimeline->projectView()->reloadTransitionLumas();
3215 void MainWindow::slotGetNewRenderStuff()
3217 if (getNewStuff("kdenlive_renderprofiles.knsrc") > 0)
3219 m_renderWidget->reloadProfiles();
3222 void MainWindow::slotGetNewMltProfileStuff()
3224 if (getNewStuff("kdenlive_projectprofiles.knsrc") > 0) {
3225 // update the list of profiles in settings dialog
3226 KdenliveSettingsDialog* d = static_cast <KdenliveSettingsDialog*>(KConfigDialog::exists("settings"));
3232 void MainWindow::slotAutoTransition()
3234 if (m_activeTimeline)
3235 m_activeTimeline->projectView()->autoTransition();
3238 void MainWindow::slotSplitAudio()
3240 if (m_activeTimeline)
3241 m_activeTimeline->projectView()->splitAudio();
3244 void MainWindow::slotUpdateClipType(QAction *action)
3246 if (m_activeTimeline) {
3247 if (action->data().toString() == "clip_audio_only") m_activeTimeline->projectView()->setAudioOnly();
3248 else if (action->data().toString() == "clip_video_only") m_activeTimeline->projectView()->setVideoOnly();
3249 else m_activeTimeline->projectView()->setAudioAndVideo();
3253 void MainWindow::slotDvdWizard(const QString &url, const QString &profile)
3255 // We must stop the monitors since we create a new on in the dvd wizard
3256 m_clipMonitor->stop();
3257 m_projectMonitor->stop();
3258 DvdWizard w(url, profile, this);
3260 m_projectMonitor->start();
3263 void MainWindow::slotShowTimeline(bool show)
3265 if (show == false) {
3266 m_timelineState = saveState();
3267 centralWidget()->setHidden(true);
3269 centralWidget()->setHidden(false);
3270 restoreState(m_timelineState);
3274 void MainWindow::slotMaximizeCurrent(bool /*show*/)
3276 //TODO: is there a way to maximize current widget?
3279 m_timelineState = saveState();
3280 QWidget *par = focusWidget()->parentWidget();
3281 while (par->parentWidget() && par->parentWidget() != this)
3282 par = par->parentWidget();
3283 kDebug() << "CURRENT WIDGET: " << par->objectName();
3286 //centralWidget()->setHidden(false);
3287 //restoreState(m_timelineState);
3291 void MainWindow::loadTranscoders()
3293 QMenu *transMenu = static_cast<QMenu*>(factory()->container("transcoders", this));
3296 KSharedConfigPtr config = KSharedConfig::openConfig("kdenlivetranscodingrc");
3297 KConfigGroup transConfig(config, "Transcoding");
3299 QMap< QString, QString > profiles = transConfig.entryMap();
3300 QMapIterator<QString, QString> i(profiles);
3301 while (i.hasNext()) {
3303 QStringList data = i.value().split(";", QString::SkipEmptyParts);
3304 QAction *a = transMenu->addAction(i.key());
3306 if (data.count() > 1)
3307 a->setToolTip(data.at(1));
3308 connect(a, SIGNAL(triggered()), this, SLOT(slotTranscode()));
3312 void MainWindow::slotTranscode(KUrl::List urls)
3317 if (urls.isEmpty()) {
3318 QAction *action = qobject_cast<QAction *>(sender());
3319 QStringList data = action->data().toStringList();
3320 params = data.at(0);
3321 if (data.count() > 1) desc = data.at(1);
3322 if (data.count() > 2) condition = data.at(2);
3323 urls << m_projectList->getConditionalUrls(condition);
3324 urls.removeAll(KUrl());
3326 if (urls.isEmpty()) {
3327 m_messageLabel->setMessage(i18n("No clip to transcode"), ErrorMessage);
3330 ClipTranscode *d = new ClipTranscode(urls, params, desc);
3331 connect(d, SIGNAL(addClip(KUrl)), this, SLOT(slotAddProjectClip(KUrl)));
3333 //QProcess::startDetached("ffmpeg", parameters);
3336 void MainWindow::slotTranscodeClip()
3338 KUrl::List urls = KFileDialog::getOpenUrls(KUrl("kfiledialog:///projectfolder"));
3339 if (urls.isEmpty()) return;
3340 slotTranscode(urls);
3343 void MainWindow::slotSetDocumentRenderProfile(const QString &dest, const QString &group, const QString &name, const QString &file)
3345 if (m_activeDocument == NULL) return;
3346 m_activeDocument->setDocumentProperty("renderdestination", dest);
3347 m_activeDocument->setDocumentProperty("rendercategory", group);
3348 m_activeDocument->setDocumentProperty("renderprofile", name);
3349 m_activeDocument->setDocumentProperty("renderurl", file);
3350 m_activeDocument->setModified(true);
3354 void MainWindow::slotPrepareRendering(bool scriptExport, bool zoneOnly, const QString &chapterFile)
3356 if (m_activeDocument == NULL || m_renderWidget == NULL) return;
3358 QString playlistPath;
3361 QString scriptsFolder = m_activeDocument->projectFolder().path() + "/scripts/";
3362 QString path = m_renderWidget->getFreeScriptName();
3363 scriptPath = QInputDialog::getText(this, i18n("Create Render Script"), i18n("Script name (will be saved in: %1)", scriptsFolder), QLineEdit::Normal, KUrl(path).fileName(), &ok);
3364 if (!ok || scriptPath.isEmpty()) return;
3365 scriptPath.prepend(scriptsFolder);
3366 QFile f(scriptPath);
3368 if (KMessageBox::warningYesNo(this, i18n("Script file already exists. Do you want to overwrite it?")) != KMessageBox::Yes)
3371 playlistPath = scriptPath + ".mlt";
3372 m_projectMonitor->saveSceneList(playlistPath);
3374 KTemporaryFile temp;
3375 temp.setAutoRemove(false);
3376 temp.setSuffix(".mlt");
3378 playlistPath = temp.fileName();
3379 m_projectMonitor->saveSceneList(playlistPath);
3382 if (!chapterFile.isEmpty()) {
3385 if (!zoneOnly) out = (int) GenTime(m_activeDocument->projectDuration()).frames(m_activeDocument->fps());
3387 in = m_activeTimeline->inPoint();
3388 out = m_activeTimeline->outPoint();
3391 QDomElement chapters = doc.createElement("chapters");
3392 chapters.setAttribute("fps", m_activeDocument->fps());
3393 doc.appendChild(chapters);
3395 QDomElement guidesxml = m_activeDocument->guidesXml();
3396 QDomNodeList nodes = guidesxml.elementsByTagName("guide");
3397 for (int i = 0; i < nodes.count(); i++) {
3398 QDomElement e = nodes.item(i).toElement();
3400 QString comment = e.attribute("comment");
3401 int time = (int) GenTime(e.attribute("time").toDouble()).frames(m_activeDocument->fps());
3402 if (time >= in && time < out) {
3403 if (zoneOnly) time = time - in;
3404 QDomElement chapter = doc.createElement("chapter");
3405 chapters.appendChild(chapter);
3406 chapter.setAttribute("title", comment);
3407 chapter.setAttribute("time", time);
3411 if (chapters.childNodes().count() > 0) {
3412 if (m_activeTimeline->projectView()->hasGuide(out, 0) == -1) {
3413 // Always insert a guide in pos 0
3414 QDomElement chapter = doc.createElement("chapter");
3415 chapters.insertBefore(chapter, QDomNode());
3416 chapter.setAttribute("title", i18n("Start"));
3417 chapter.setAttribute("time", "0");
3419 // save chapters file
3420 QFile file(chapterFile);
3421 if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
3422 kWarning() << "////// ERROR writing DVD CHAPTER file: " << chapterFile;
3424 file.write(doc.toString().toUtf8());
3425 if (file.error() != QFile::NoError) {
3426 kWarning() << "////// ERROR writing DVD CHAPTER file: " << chapterFile;
3433 m_renderWidget->slotExport(scriptExport, m_activeTimeline->inPoint(), m_activeTimeline->outPoint(), playlistPath, scriptPath);
3436 void MainWindow::slotUpdateTimecodeFormat(int ix)
3438 KdenliveSettings::setFrametimecode(ix == 1);
3439 m_clipMonitor->updateTimecodeFormat();
3440 m_projectMonitor->updateTimecodeFormat();
3441 m_transitionConfig->updateTimecodeFormat();
3442 m_effectStack->updateTimecodeFormat();
3443 //m_activeTimeline->projectView()->clearSelection();
3444 m_activeTimeline->updateRuler();
3447 void MainWindow::slotRemoveFocus()
3449 statusBar()->setFocus();
3450 statusBar()->clearFocus();
3453 void MainWindow::slotRevert()
3455 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;
3456 KUrl url = m_activeDocument->url();
3457 closeCurrentDocument(false);
3458 doOpenFile(url, NULL);
3462 void MainWindow::slotShutdown()
3464 if (m_activeDocument) m_activeDocument->setModified(false);
3466 QDBusConnectionInterface* interface = QDBusConnection::sessionBus().interface();
3467 if (interface && interface->isServiceRegistered("org.kde.ksmserver")) {
3468 QDBusInterface smserver("org.kde.ksmserver", "/KSMServer", "org.kde.KSMServerInterface");
3469 smserver.call("logout", 1, 2, 2);
3470 } else if (interface && interface->isServiceRegistered("org.gnome.SessionManager")) {
3471 QDBusInterface smserver("org.gnome.SessionManager", "/org/gnome/SessionManager", "org.gnome.SessionManager");
3472 smserver.call("Shutdown");
3476 void MainWindow::slotUpdateTrackInfo()
3478 if (m_activeDocument)
3479 m_transitionConfig->updateProjectFormat(m_activeDocument->mltProfile(), m_activeDocument->timecode(), m_activeDocument->tracksList());
3482 void MainWindow::slotChangePalette(QAction *action, const QString &themename)
3484 // Load the theme file
3486 if (action == NULL) theme = themename;
3487 else theme = action->data().toString();
3488 KdenliveSettings::setColortheme(theme);
3489 // Make palette for all widgets.
3491 if (theme.isEmpty())
3492 plt = QApplication::desktop()->palette();
3494 KSharedConfigPtr config = KSharedConfig::openConfig(theme);
3495 plt = KGlobalSettings::createApplicationPalette(config);
3498 kapp->setPalette(plt);
3499 const QObjectList children = statusBar()->children();
3501 foreach(QObject *child, children) {
3502 if (child->isWidgetType())
3503 ((QWidget*)child)->setPalette(plt);
3504 const QObjectList subchildren = child->children();
3505 foreach(QObject *subchild, subchildren) {
3506 if (subchild->isWidgetType())
3507 ((QWidget*)subchild)->setPalette(plt);
3510 if (m_activeTimeline)
3511 m_activeTimeline->projectView()->updatePalette();
3515 QPixmap MainWindow::createSchemePreviewIcon(const KSharedConfigPtr &config)
3517 // code taken from kdebase/workspace/kcontrol/colors/colorscm.cpp
3518 const uchar bits1[] = { 0xff, 0xff, 0xff, 0x2c, 0x16, 0x0b };
3519 const uchar bits2[] = { 0x68, 0x34, 0x1a, 0xff, 0xff, 0xff };
3520 const QSize bitsSize(24, 2);
3521 const QBitmap b1 = QBitmap::fromData(bitsSize, bits1);
3522 const QBitmap b2 = QBitmap::fromData(bitsSize, bits2);
3524 QPixmap pixmap(23, 16);
3525 pixmap.fill(Qt::black); // ### use some color other than black for borders?
3527 KConfigGroup group(config, "WM");
3528 QPainter p(&pixmap);
3529 KColorScheme windowScheme(QPalette::Active, KColorScheme::Window, config);
3530 p.fillRect(1, 1, 7, 7, windowScheme.background());
3531 p.fillRect(2, 2, 5, 2, QBrush(windowScheme.foreground().color(), b1));
3533 KColorScheme buttonScheme(QPalette::Active, KColorScheme::Button, config);
3534 p.fillRect(8, 1, 7, 7, buttonScheme.background());
3535 p.fillRect(9, 2, 5, 2, QBrush(buttonScheme.foreground().color(), b1));
3537 p.fillRect(15, 1, 7, 7, group.readEntry("activeBackground", QColor(96, 148, 207)));
3538 p.fillRect(16, 2, 5, 2, QBrush(group.readEntry("activeForeground", QColor(255, 255, 255)), b1));
3540 KColorScheme viewScheme(QPalette::Active, KColorScheme::View, config);
3541 p.fillRect(1, 8, 7, 7, viewScheme.background());
3542 p.fillRect(2, 12, 5, 2, QBrush(viewScheme.foreground().color(), b2));
3544 KColorScheme selectionScheme(QPalette::Active, KColorScheme::Selection, config);
3545 p.fillRect(8, 8, 7, 7, selectionScheme.background());
3546 p.fillRect(9, 12, 5, 2, QBrush(selectionScheme.foreground().color(), b2));
3548 p.fillRect(15, 8, 7, 7, group.readEntry("inactiveBackground", QColor(224, 223, 222)));
3549 p.fillRect(16, 12, 5, 2, QBrush(group.readEntry("inactiveForeground", QColor(20, 19, 18)), b2));
3555 void MainWindow::slotSwitchMonitors()
3557 m_monitorManager->slotSwitchMonitors(!m_clipMonitor->isActive());
3558 if (m_projectMonitor->isActive()) m_activeTimeline->projectView()->setFocus();
3559 else m_projectList->focusTree();
3562 void MainWindow::slotInsertZoneToTree()
3564 if (!m_clipMonitor->isActive() || m_clipMonitor->activeClip() == NULL) return;
3565 QStringList info = m_clipMonitor->getZoneInfo();
3566 m_projectList->slotAddClipCut(info.at(0), info.at(1).toInt(), info.at(2).toInt());
3569 void MainWindow::slotInsertZoneToTimeline()
3571 if (m_activeTimeline == NULL || m_clipMonitor->activeClip() == NULL) return;
3572 QStringList info = m_clipMonitor->getZoneInfo();
3573 m_activeTimeline->projectView()->insertClipCut(m_clipMonitor->activeClip(), info.at(1).toInt(), info.at(2).toInt());
3577 void MainWindow::slotDeleteProjectClips(QStringList ids, QMap<QString, QString> folderids)
3579 if (m_activeDocument && m_activeTimeline) {
3580 if (!ids.isEmpty()) {
3581 for (int i = 0; i < ids.size(); ++i) {
3582 m_activeTimeline->slotDeleteClip(ids.at(i));
3584 m_activeDocument->clipManager()->slotDeleteClips(ids);
3586 if (!folderids.isEmpty()) m_projectList->deleteProjectFolder(folderids);
3587 m_activeDocument->setModified(true);
3591 void MainWindow::slotShowTitleBars(bool show)
3594 m_effectStackDock->setTitleBarWidget(0);
3595 m_clipMonitorDock->setTitleBarWidget(0);
3596 m_projectMonitorDock->setTitleBarWidget(0);
3598 m_recMonitorDock->setTitleBarWidget(0);
3600 m_effectListDock->setTitleBarWidget(0);
3601 m_transitionConfigDock->setTitleBarWidget(0);
3602 m_projectListDock->setTitleBarWidget(0);
3603 m_undoViewDock->setTitleBarWidget(0);
3604 m_vectorscopeDock->setTitleBarWidget(0);
3605 m_waveformDock->setTitleBarWidget(0);
3607 if (!m_effectStackDock->isFloating()) { m_effectStackDock->setTitleBarWidget(new QWidget(this)); }
3608 if (!m_clipMonitorDock->isFloating()) { m_clipMonitorDock->setTitleBarWidget(new QWidget(this)); }
3609 if (!m_projectMonitorDock->isFloating()) { m_projectMonitorDock->setTitleBarWidget(new QWidget(this)); }
3611 if (!m_recMonitorDock->isFloating()) { m_recMonitorDock->setTitleBarWidget(new QWidget(this)); }
3613 if (!m_effectListDock->isFloating()) { m_effectListDock->setTitleBarWidget(new QWidget(this)); }
3614 if (!m_transitionConfigDock->isFloating()) { m_transitionConfigDock->setTitleBarWidget(new QWidget(this)); }
3615 if (!m_projectListDock->isFloating()) { m_projectListDock->setTitleBarWidget(new QWidget(this)); }
3616 if (!m_undoViewDock->isFloating()) { m_undoViewDock->setTitleBarWidget(new QWidget(this)); }
3617 if (!m_vectorscopeDock->isFloating()) { m_vectorscopeDock->setTitleBarWidget(new QWidget(this)); }
3618 if (!m_waveformDock->isFloating()) { m_waveformDock->setTitleBarWidget(new QWidget(this)); }
3620 KdenliveSettings::setShowtitlebars(show);
3623 void MainWindow::slotSwitchTitles()
3625 slotShowTitleBars(!KdenliveSettings::showtitlebars());
3628 QString MainWindow::getMimeType()
3630 QString mimetype = "application/x-kdenlive";
3631 KMimeType::Ptr mime = KMimeType::mimeType(mimetype);
3632 if (!mime) mimetype = "*.kdenlive";
3636 #include "mainwindow.moc"