1 /***************************************************************************
2 * Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
21 #include "mainwindow.h"
22 #include "mainwindowadaptor.h"
23 #include "kdenlivesettings.h"
24 #include "kdenlivesettingsdialog.h"
25 #include "initeffects.h"
26 #include "profilesdialog.h"
27 #include "projectsettings.h"
29 #include "clipmanager.h"
30 #include "projectlist.h"
32 #include "recmonitor.h"
33 #include "monitormanager.h"
34 #include "kdenlivedoc.h"
35 #include "trackview.h"
36 #include "customtrackview.h"
37 #include "effectslistview.h"
38 #include "effectstackview.h"
39 #include "transitionsettings.h"
40 #include "renderwidget.h"
43 #include "jogshuttle.h"
44 #endif /* NO_JOGSHUTTLE */
45 #include "clipproperties.h"
47 #include "editclipcommand.h"
48 #include "titlewidget.h"
49 #include "markerdialog.h"
51 #include "interfaces.h"
52 #include "kdenlive-config.h"
53 #include "cliptranscode.h"
54 #include "ui_templateclip_ui.h"
55 #include "vectorscope.h"
57 #include "testwidget.h"
59 #include <KApplication>
63 #include <KActionCollection>
64 #include <KActionCategory>
65 #include <KStandardAction>
66 #include <KShortcutsDialog>
67 #include <KFileDialog>
68 #include <KMessageBox>
70 #include <KIO/NetAccess>
73 #include <KConfigDialog>
74 #include <KXMLGUIFactory>
76 #include <kstandarddirs.h>
77 #include <KUrlRequesterDialog>
78 #include <KTemporaryFile>
80 #include <KActionMenu>
83 #include <ktogglefullscreenaction.h>
85 #include <KNotification>
86 #include <KNotifyConfigWidget>
87 #if KDE_IS_VERSION(4,3,80)
88 #include <knewstuff3/downloaddialog.h>
89 #include <knewstuff3/knewstuffaction.h>
91 #include <knewstuff2/engine.h>
92 #include <knewstuff2/ui/knewstuffaction.h>
94 #endif /* KDE_IS_VERSION(4,3,80) */
96 #include <KColorScheme>
98 #include <QTextStream>
102 #include <QInputDialog>
103 #include <QDesktopWidget>
108 static const char version[] = VERSION;
110 static const int ID_TIMELINE_POS = 0;
117 EffectsList MainWindow::videoEffects;
118 EffectsList MainWindow::audioEffects;
119 EffectsList MainWindow::customEffects;
120 EffectsList MainWindow::transitions;
122 MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, QWidget *parent) :
123 KXmlGuiWindow(parent),
124 m_activeDocument(NULL),
125 m_activeTimeline(NULL),
126 m_renderWidget(NULL),
127 #ifndef NO_JOGSHUTTLE
129 #endif /* NO_JOGSHUTTLE */
130 m_findActivated(false)
133 // Create DBus interface
134 new MainWindowAdaptor(this);
135 QDBusConnection dbus = QDBusConnection::sessionBus();
136 dbus.registerObject("/MainWindow", this);
138 setlocale(LC_NUMERIC, "POSIX");
139 if (!KdenliveSettings::colortheme().isEmpty()) slotChangePalette(NULL, KdenliveSettings::colortheme());
140 setFont(KGlobalSettings::toolBarFont());
141 parseProfiles(MltPath);
142 m_commandStack = new QUndoGroup;
143 m_timelineArea = new KTabWidget(this);
144 m_timelineArea->setTabReorderingEnabled(true);
145 m_timelineArea->setTabBarHidden(true);
146 m_timelineArea->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
147 m_timelineArea->setMinimumHeight(200);
149 QToolButton *closeTabButton = new QToolButton;
150 connect(closeTabButton, SIGNAL(clicked()), this, SLOT(closeCurrentDocument()));
151 closeTabButton->setIcon(KIcon("tab-close"));
152 closeTabButton->adjustSize();
153 closeTabButton->setToolTip(i18n("Close the current tab"));
154 m_timelineArea->setCornerWidget(closeTabButton);
155 connect(m_timelineArea, SIGNAL(currentChanged(int)), this, SLOT(activateDocument()));
157 connect(&m_findTimer, SIGNAL(timeout()), this, SLOT(findTimeout()));
158 m_findTimer.setSingleShot(true);
160 // FIXME: the next call returns a newly allocated object, which leaks
161 initEffects::parseEffectFiles();
162 //initEffects::parseCustomEffectsFile();
164 m_monitorManager = new MonitorManager();
166 m_shortcutRemoveFocus = new QShortcut(QKeySequence("Esc"), this);
167 connect(m_shortcutRemoveFocus, SIGNAL(activated()), this, SLOT(slotRemoveFocus()));
172 m_projectListDock = new QDockWidget(i18n("Project Tree"), this);
173 m_projectListDock->setObjectName("project_tree");
174 m_projectList = new ProjectList(this);
175 m_projectListDock->setWidget(m_projectList);
176 addDockWidget(Qt::TopDockWidgetArea, m_projectListDock);
178 m_effectStackDock = new QDockWidget(i18n("Effect Stack"), this);
179 m_effectStackDock->setObjectName("effect_stack");
180 m_effectStack = new EffectStackView(this);
181 m_effectStackDock->setWidget(m_effectStack);
182 addDockWidget(Qt::TopDockWidgetArea, m_effectStackDock);
184 m_transitionConfigDock = new QDockWidget(i18n("Transition"), this);
185 m_transitionConfigDock->setObjectName("transition");
186 m_transitionConfig = new TransitionSettings(this);
187 m_transitionConfigDock->setWidget(m_transitionConfig);
188 addDockWidget(Qt::TopDockWidgetArea, m_transitionConfigDock);
190 m_clipMonitorDock = new QDockWidget(i18n("Clip Monitor"), this);
191 m_clipMonitorDock->setObjectName("clip_monitor");
192 m_clipMonitor = new Monitor("clip", m_monitorManager, QString(), this);
193 m_clipMonitorDock->setWidget(m_clipMonitor);
194 addDockWidget(Qt::TopDockWidgetArea, m_clipMonitorDock);
196 m_projectMonitorDock = new QDockWidget(i18n("Project Monitor"), this);
197 m_projectMonitorDock->setObjectName("project_monitor");
198 m_projectMonitor = new Monitor("project", m_monitorManager, QString(), this);
199 m_projectMonitorDock->setWidget(m_projectMonitor);
200 addDockWidget(Qt::TopDockWidgetArea, m_projectMonitorDock);
203 m_recMonitorDock = new QDockWidget(i18n("Record Monitor"), this);
204 m_recMonitorDock->setObjectName("record_monitor");
205 m_recMonitor = new RecMonitor("record", this);
206 m_recMonitorDock->setWidget(m_recMonitor);
207 addDockWidget(Qt::TopDockWidgetArea, m_recMonitorDock);
208 connect(m_recMonitor, SIGNAL(addProjectClip(KUrl)), this, SLOT(slotAddProjectClip(KUrl)));
209 connect(m_recMonitor, SIGNAL(showConfigDialog(int, int)), this, SLOT(slotPreferences(int, int)));
212 m_effectListDock = new QDockWidget(i18n("Effect List"), this);
213 m_effectListDock->setObjectName("effect_list");
214 m_effectList = new EffectsListView();
215 m_effectListDock->setWidget(m_effectList);
216 addDockWidget(Qt::TopDockWidgetArea, m_effectListDock);
218 m_vectorscope = new Vectorscope(m_projectMonitor, m_clipMonitor, this);
219 m_vectorscopeDock = new QDockWidget(i18n("Vectorscope"), this);
220 m_vectorscopeDock->setObjectName("vectorscope");
221 m_vectorscopeDock->setWidget(m_vectorscope);
222 addDockWidget(Qt::TopDockWidgetArea, m_vectorscopeDock);
224 m_waveform = new Waveform(m_projectMonitor, m_clipMonitor, this);
225 m_waveformDock = new QDockWidget(i18n("Waveform"), this);
226 m_waveformDock->setObjectName("waveform");
227 m_waveformDock->setWidget(m_waveform);
228 addDockWidget(Qt::TopDockWidgetArea, m_waveformDock);
230 m_test = new TestWidget(m_projectMonitor, m_clipMonitor, this);
231 m_testDock = new QDockWidget("Test", this);
232 m_testDock->setObjectName("test");
233 m_testDock->setWidget(m_test);
234 addDockWidget(Qt::TopDockWidgetArea, m_testDock);
237 m_undoViewDock = new QDockWidget(i18n("Undo History"), this);
238 m_undoViewDock->setObjectName("undo_history");
239 m_undoView = new QUndoView(this);
240 m_undoView->setCleanIcon(KIcon("edit-clear"));
241 m_undoView->setEmptyLabel(i18n("Clean"));
242 m_undoViewDock->setWidget(m_undoView);
243 m_undoView->setGroup(m_commandStack);
244 addDockWidget(Qt::TopDockWidgetArea, m_undoViewDock);
246 //overviewDock = new QDockWidget(i18n("Project Overview"), this);
247 //overviewDock->setObjectName("project_overview");
248 //m_overView = new CustomTrackView(NULL, NULL, this);
249 //overviewDock->setWidget(m_overView);
250 //addDockWidget(Qt::TopDockWidgetArea, overviewDock);
255 /// Tabify Widgets ///
256 tabifyDockWidget(m_projectListDock, m_effectStackDock);
257 tabifyDockWidget(m_projectListDock, m_transitionConfigDock);
260 tabifyDockWidget(m_clipMonitorDock, m_projectMonitorDock);
262 tabifyDockWidget(m_clipMonitorDock, m_recMonitorDock);
265 tabifyDockWidget(m_vectorscopeDock, m_waveformDock);
266 tabifyDockWidget(m_vectorscopeDock, m_undoViewDock);
267 tabifyDockWidget(m_vectorscopeDock, m_effectListDock);
270 setCentralWidget(m_timelineArea);
273 KdenliveSettings::setCurrent_profile(KdenliveSettings::default_profile());
274 m_fileOpenRecent = KStandardAction::openRecent(this, SLOT(openFile(const KUrl &)), actionCollection());
276 m_fileRevert = KStandardAction::revert(this, SLOT(slotRevert()), actionCollection());
277 m_fileRevert->setEnabled(false);
283 // Find QDockWidget tab bars and show / hide widget title bars on right click
284 QList <QTabBar *> tabs = findChildren<QTabBar *>();
285 for (int i = 0; i < tabs.count(); i++) {
286 tabs.at(i)->setContextMenuPolicy(Qt::CustomContextMenu);
287 connect(tabs.at(i), SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(slotSwitchTitles()));
290 /*ScriptingPart* sp = new ScriptingPart(this, QStringList());
291 guiFactory()->addClient(sp);*/
295 //kDebug() << factory() << " " << factory()->container("video_effects_menu", this);
297 m_projectMonitor->setupMenu(static_cast<QMenu*>(factory()->container("monitor_go", this)), m_playZone, m_loopZone);
298 m_clipMonitor->setupMenu(static_cast<QMenu*>(factory()->container("monitor_go", this)), m_playZone, m_loopZone, static_cast<QMenu*>(factory()->container("marker_menu", this)));
300 QMenu *clipInTimeline = static_cast<QMenu*>(factory()->container("clip_in_timeline", this));
301 clipInTimeline->setIcon(KIcon("go-jump"));
302 m_projectList->setupGeneratorMenu(static_cast<QMenu*>(factory()->container("generators", this)),
303 static_cast<QMenu*>(factory()->container("transcoders", this)),
307 // build themes menus
308 QMenu *themesMenu = static_cast<QMenu*>(factory()->container("themes_menu", this));
309 QActionGroup *themegroup = new QActionGroup(this);
310 themegroup->setExclusive(true);
311 action = new KAction(i18n("Default"), this);
312 action->setCheckable(true);
313 themegroup->addAction(action);
314 if (KdenliveSettings::colortheme().isEmpty()) action->setChecked(true);
316 const QStringList schemeFiles = KGlobal::dirs()->findAllResources("data", "color-schemes/*.colors", KStandardDirs::NoDuplicates);
318 for (int i = 0; i < schemeFiles.size(); ++i) {
320 const QString filename = schemeFiles.at(i);
321 const QFileInfo info(filename);
324 KSharedConfigPtr config = KSharedConfig::openConfig(filename);
325 QIcon icon = createSchemePreviewIcon(config);
326 KConfigGroup group(config, "General");
327 const QString name = group.readEntry("Name", info.baseName());
328 action = new KAction(name, this);
329 action->setData(filename);
330 action->setIcon(icon);
331 action->setCheckable(true);
332 themegroup->addAction(action);
333 if (KdenliveSettings::colortheme() == filename) action->setChecked(true);
336 /*KGlobal::dirs()->addResourceDir("themes", KStandardDirs::installPath("data") + QString("kdenlive/themes"));
337 QStringList themes = KGlobal::dirs()->findAllResources("themes", QString(), KStandardDirs::Recursive | KStandardDirs::NoDuplicates);
338 for (QStringList::const_iterator it = themes.constBegin(); it != themes.constEnd(); ++it)
341 action = new QAction(fi.fileName(), this);
342 action->setData(*it);
343 action->setCheckable(true);
344 themegroup->addAction(action);
345 if (KdenliveSettings::colortheme() == *it) action->setChecked(true);
347 themesMenu->addActions(themegroup->actions());
348 connect(themesMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotChangePalette(QAction*)));
350 // Setup and fill effects and transitions menus.
351 m_videoEffectsMenu = static_cast<QMenu*>(factory()->container("video_effects_menu", this));
352 for (int i = 0; i < videoEffects.count(); ++i)
353 m_videoEffectsMenu->addAction(m_videoEffects[i]);
354 m_audioEffectsMenu = static_cast<QMenu*>(factory()->container("audio_effects_menu", this));
355 for (int i = 0; i < audioEffects.count(); ++i)
356 m_audioEffectsMenu->addAction(m_audioEffects[i]);
357 m_customEffectsMenu = static_cast<QMenu*>(factory()->container("custom_effects_menu", this));
358 if (customEffects.isEmpty())
359 m_customEffectsMenu->setEnabled(false);
361 m_customEffectsMenu->setEnabled(true);
362 for (int i = 0; i < customEffects.count(); ++i)
363 m_customEffectsMenu->addAction(m_customEffects[i]);
364 m_transitionsMenu = new QMenu(i18n("Add Transition"), this);
365 for (int i = 0; i < transitions.count(); ++i)
366 m_transitionsMenu->addAction(m_transitions[i]);
368 connect(m_videoEffectsMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotAddVideoEffect(QAction *)));
369 connect(m_audioEffectsMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotAddAudioEffect(QAction *)));
370 connect(m_customEffectsMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotAddCustomEffect(QAction *)));
371 connect(m_transitionsMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotAddTransition(QAction *)));
373 QMenu *newEffect = new QMenu(this);
374 newEffect->addMenu(m_videoEffectsMenu);
375 newEffect->addMenu(m_audioEffectsMenu);
376 newEffect->addMenu(m_customEffectsMenu);
377 m_effectStack->setMenu(newEffect);
379 QMenu *viewMenu = static_cast<QMenu*>(factory()->container("dockwindows", this));
380 const QList<QAction *> viewActions = createPopupMenu()->actions();
381 viewMenu->insertActions(NULL, viewActions);
383 m_timelineContextMenu = new QMenu(this);
384 m_timelineContextClipMenu = new QMenu(this);
385 m_timelineContextTransitionMenu = new QMenu(this);
387 m_timelineContextMenu->addAction(actionCollection()->action("insert_space"));
388 m_timelineContextMenu->addAction(actionCollection()->action("delete_space"));
389 m_timelineContextMenu->addAction(actionCollection()->action(KStandardAction::name(KStandardAction::Paste)));
391 m_timelineContextClipMenu->addAction(actionCollection()->action("clip_in_project_tree"));
392 //m_timelineContextClipMenu->addAction(actionCollection()->action("clip_to_project_tree"));
393 m_timelineContextClipMenu->addAction(actionCollection()->action("edit_item_duration"));
394 m_timelineContextClipMenu->addAction(actionCollection()->action("delete_item"));
395 m_timelineContextClipMenu->addSeparator();
396 m_timelineContextClipMenu->addAction(actionCollection()->action("group_clip"));
397 m_timelineContextClipMenu->addAction(actionCollection()->action("ungroup_clip"));
398 m_timelineContextClipMenu->addAction(actionCollection()->action("split_audio"));
399 m_timelineContextClipMenu->addSeparator();
400 m_timelineContextClipMenu->addAction(actionCollection()->action("cut_timeline_clip"));
401 m_timelineContextClipMenu->addAction(actionCollection()->action(KStandardAction::name(KStandardAction::Copy)));
402 m_timelineContextClipMenu->addAction(actionCollection()->action("paste_effects"));
403 m_timelineContextClipMenu->addSeparator();
405 QMenu *markersMenu = (QMenu*)(factory()->container("marker_menu", this));
406 m_timelineContextClipMenu->addMenu(markersMenu);
407 m_timelineContextClipMenu->addSeparator();
408 m_timelineContextClipMenu->addMenu(m_transitionsMenu);
409 m_timelineContextClipMenu->addMenu(m_videoEffectsMenu);
410 m_timelineContextClipMenu->addMenu(m_audioEffectsMenu);
411 //TODO: re-enable custom effects menu when it is implemented
412 m_timelineContextClipMenu->addMenu(m_customEffectsMenu);
414 m_timelineContextTransitionMenu->addAction(actionCollection()->action("edit_item_duration"));
415 m_timelineContextTransitionMenu->addAction(actionCollection()->action("delete_item"));
416 m_timelineContextTransitionMenu->addAction(actionCollection()->action(KStandardAction::name(KStandardAction::Copy)));
418 m_timelineContextTransitionMenu->addAction(actionCollection()->action("auto_transition"));
420 connect(m_projectMonitorDock, SIGNAL(visibilityChanged(bool)), m_projectMonitor, SLOT(refreshMonitor(bool)));
421 connect(m_clipMonitorDock, SIGNAL(visibilityChanged(bool)), m_clipMonitor, SLOT(refreshMonitor(bool)));
422 //connect(m_monitorManager, SIGNAL(connectMonitors()), this, SLOT(slotConnectMonitors()));
423 connect(m_monitorManager, SIGNAL(raiseClipMonitor(bool)), this, SLOT(slotRaiseMonitor(bool)));
424 connect(m_monitorManager, SIGNAL(raiseClipMonitor(bool)), m_vectorscope, SLOT(slotActiveMonitorChanged(bool)));
425 connect(m_monitorManager, SIGNAL(raiseClipMonitor(bool)), m_waveform, SLOT(slotActiveMonitorChanged(bool)));
426 connect(m_effectList, SIGNAL(addEffect(const QDomElement)), this, SLOT(slotAddEffect(const QDomElement)));
427 connect(m_effectList, SIGNAL(reloadEffects()), this, SLOT(slotReloadEffects()));
429 m_monitorManager->initMonitors(m_clipMonitor, m_projectMonitor);
430 slotConnectMonitors();
432 // Disable drop B frames, see Kdenlive issue #1330, see also kdenlivesettingsdialog.cpp
433 KdenliveSettings::setDropbframes(false);
435 // Open or create a file. Command line argument passed in Url has
436 // precedence, then "openlastproject", then just a plain empty file.
437 // If opening Url fails, openlastproject will _not_ be used.
438 if (!Url.isEmpty()) {
439 // delay loading so that the window shows up
441 QTimer::singleShot(500, this, SLOT(openFile()));
442 } else if (KdenliveSettings::openlastproject()) {
443 QTimer::singleShot(500, this, SLOT(openLastFile()));
444 } else { //if (m_timelineArea->count() == 0) {
448 #ifndef NO_JOGSHUTTLE
449 activateShuttleDevice();
450 #endif /* NO_JOGSHUTTLE */
451 m_projectListDock->raise();
454 void MainWindow::queryQuit()
457 if (m_projectMonitor) m_projectMonitor->stop();
458 if (m_clipMonitor) m_clipMonitor->stop();
459 delete m_effectStack;
460 delete m_activeTimeline;
462 // This sometimes causes crash on exit on OS X for some reason.
463 delete m_projectMonitor;
464 delete m_clipMonitor;
466 delete m_activeDocument;
467 delete m_shortcutRemoveFocus;
468 Mlt::Factory::close();
474 bool MainWindow::queryClose()
476 if (m_renderWidget) {
477 int waitingJobs = m_renderWidget->waitingJobsCount();
478 if (waitingJobs > 0) {
479 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")))) {
480 case KMessageBox::Yes :
481 // create script with waiting jobs and start it
482 if (m_renderWidget->startWaitingRenderJobs() == false) return false;
484 case KMessageBox::No :
485 // Don't do anything, jobs will be deleted
493 if (m_monitorManager) m_monitorManager->stopActiveMonitor();
494 // warn the user to save if document is modified and we have clips in our project list
495 if (m_activeDocument && m_activeDocument->isModified() &&
496 ((m_projectList->documentClipList().isEmpty() && !m_activeDocument->url().isEmpty()) ||
497 !m_projectList->documentClipList().isEmpty())) {
499 if (m_activeDocument->url().fileName().isEmpty())
500 message = i18n("Save changes to document?");
502 message = i18n("The project <b>\"%1\"</b> has been changed.\nDo you want to save your changes?").arg(m_activeDocument->url().fileName());
503 switch (KMessageBox::warningYesNoCancel(this, message)) {
504 case KMessageBox::Yes :
505 // save document here. If saving fails, return false;
507 case KMessageBox::No :
508 // User does not want to save the changes, clear recovery files
509 m_activeDocument->m_autosave->resize(0);
518 void MainWindow::loadPlugins()
520 foreach(QObject *plugin, QPluginLoader::staticInstances()) {
521 populateMenus(plugin);
524 QStringList directories = KGlobal::dirs()->findDirs("module", QString());
526 filters << "libkdenlive*";
527 foreach(const QString &folder, directories) {
528 kDebug() << "Parsing plugin folder: " << folder;
529 QDir pluginsDir(folder);
530 foreach(const QString &fileName,
531 pluginsDir.entryList(filters, QDir::Files)) {
533 * Avoid loading the same plugin twice when there is more than one
536 if (!m_pluginFileNames.contains(fileName)) {
537 kDebug() << "Found plugin: " << fileName;
538 QPluginLoader loader(pluginsDir.absoluteFilePath(fileName));
539 QObject *plugin = loader.instance();
541 populateMenus(plugin);
542 m_pluginFileNames += fileName;
544 kDebug() << "Error loading plugin: " << fileName << ", " << loader.errorString();
550 void MainWindow::populateMenus(QObject *plugin)
552 QMenu *addMenu = static_cast<QMenu*>(factory()->container("generators", this));
553 ClipGenerator *iGenerator = qobject_cast<ClipGenerator *>(plugin);
555 addToMenu(plugin, iGenerator->generators(KdenliveSettings::producerslist()), addMenu, SLOT(generateClip()),
559 void MainWindow::addToMenu(QObject *plugin, const QStringList &texts,
560 QMenu *menu, const char *member,
561 QActionGroup *actionGroup)
563 kDebug() << "// ADD to MENU" << texts;
564 foreach(const QString &text, texts) {
565 QAction *action = new QAction(text, plugin);
566 action->setData(text);
567 connect(action, SIGNAL(triggered()), this, member);
568 menu->addAction(action);
571 action->setCheckable(true);
572 actionGroup->addAction(action);
577 void MainWindow::aboutPlugins()
579 //PluginDialog dialog(pluginsDir.path(), m_pluginFileNames, this);
584 void MainWindow::generateClip()
586 QAction *action = qobject_cast<QAction *>(sender());
587 ClipGenerator *iGenerator = qobject_cast<ClipGenerator *>(action->parent());
589 KUrl clipUrl = iGenerator->generatedClip(action->data().toString(), m_activeDocument->projectFolder(),
590 QStringList(), QStringList(), m_activeDocument->fps(), m_activeDocument->width(), m_activeDocument->height());
591 if (!clipUrl.isEmpty()) {
592 m_projectList->slotAddClip(QList <QUrl> () << clipUrl);
596 void MainWindow::saveProperties(KConfigGroup &config)
598 // save properties here,used by session management
600 KMainWindow::saveProperties(config);
604 void MainWindow::readProperties(const KConfigGroup &config)
606 // read properties here,used by session management
607 KMainWindow::readProperties(config);
608 QString Lastproject = config.group("Recent Files").readPathEntry("File1", QString());
609 openFile(KUrl(Lastproject));
612 void MainWindow::slotReloadEffects()
614 m_customEffectsMenu->clear();
615 initEffects::parseCustomEffectsFile();
617 QStringList effectInfo;
618 QMap<QString, QStringList> effectsList;
619 for (int ix = 0; ix < customEffects.count(); ix++) {
620 effectInfo = customEffects.effectIdInfo(ix);
621 effectsList.insert(effectInfo.at(0).toLower(), effectInfo);
623 if (effectsList.isEmpty())
624 m_customEffectsMenu->setEnabled(false);
626 m_customEffectsMenu->setEnabled(true);
628 foreach(const QStringList &value, effectsList) {
629 action = new QAction(value.at(0), this);
630 action->setData(value);
631 m_customEffectsMenu->addAction(action);
633 m_effectList->reloadEffectList();
636 #ifndef NO_JOGSHUTTLE
637 void MainWindow::activateShuttleDevice()
641 if (KdenliveSettings::enableshuttle() == false) return;
642 m_jogProcess = new JogShuttle(KdenliveSettings::shuttledevice());
643 connect(m_jogProcess, SIGNAL(rewind1()), m_monitorManager, SLOT(slotRewindOneFrame()));
644 connect(m_jogProcess, SIGNAL(forward1()), m_monitorManager, SLOT(slotForwardOneFrame()));
645 connect(m_jogProcess, SIGNAL(rewind(double)), m_monitorManager, SLOT(slotRewind(double)));
646 connect(m_jogProcess, SIGNAL(forward(double)), m_monitorManager, SLOT(slotForward(double)));
647 connect(m_jogProcess, SIGNAL(stop()), m_monitorManager, SLOT(slotPlay()));
648 connect(m_jogProcess, SIGNAL(button(int)), this, SLOT(slotShuttleButton(int)));
651 void MainWindow::slotShuttleButton(int code)
655 slotShuttleAction(KdenliveSettings::shuttle1());
658 slotShuttleAction(KdenliveSettings::shuttle2());
661 slotShuttleAction(KdenliveSettings::shuttle3());
664 slotShuttleAction(KdenliveSettings::shuttle4());
667 slotShuttleAction(KdenliveSettings::shuttle5());
672 void MainWindow::slotShuttleAction(int code)
678 m_monitorManager->slotPlay();
681 m_monitorManager->slotPlay();
685 #endif /* NO_JOGSHUTTLE */
687 void MainWindow::configureNotifications()
689 KNotifyConfigWidget::configure(this);
692 void MainWindow::slotFullScreen()
694 KToggleFullScreenAction::setFullScreen(this, actionCollection()->action("fullscreen")->isChecked());
697 void MainWindow::slotAddEffect(const QDomElement effect, GenTime pos, int track)
699 if (!m_activeDocument) return;
700 if (effect.isNull()) {
701 kDebug() << "--- ERROR, TRYING TO APPEND NULL EFFECT";
704 QDomElement effectToAdd = effect.cloneNode().toElement();
705 m_activeTimeline->projectView()->slotAddEffect(effectToAdd, pos, track);
708 void MainWindow::slotRaiseMonitor(bool clipMonitor)
710 if (clipMonitor) m_clipMonitorDock->raise();
711 else m_projectMonitorDock->raise();
714 void MainWindow::slotUpdateClip(const QString &id)
716 if (!m_activeDocument) return;
717 m_activeTimeline->projectView()->slotUpdateClip(id);
720 void MainWindow::slotConnectMonitors()
722 m_projectList->setRenderer(m_projectMonitor->render);
723 //connect(m_projectList, SIGNAL(receivedClipDuration(const QString &)), this, SLOT(slotUpdateClip(const QString &)));
724 connect(m_projectList, SIGNAL(deleteProjectClips(QStringList, QMap<QString, QString>)), this, SLOT(slotDeleteProjectClips(QStringList, QMap<QString, QString>)));
725 connect(m_projectList, SIGNAL(showClipProperties(DocClipBase *)), this, SLOT(slotShowClipProperties(DocClipBase *)));
726 connect(m_projectList, SIGNAL(showClipProperties(QList <DocClipBase *>, QMap<QString, QString>)), this, SLOT(slotShowClipProperties(QList <DocClipBase *>, QMap<QString, QString>)));
727 connect(m_projectList, SIGNAL(getFileProperties(const QDomElement, const QString &, int, bool)), m_projectMonitor->render, SLOT(getFileProperties(const QDomElement, const QString &, int, bool)));
728 connect(m_projectMonitor->render, SIGNAL(replyGetImage(const QString &, const QPixmap &)), m_projectList, SLOT(slotReplyGetImage(const QString &, const QPixmap &)));
729 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)));
731 connect(m_projectMonitor->render, SIGNAL(removeInvalidClip(const QString &, bool)), m_projectList, SLOT(slotRemoveInvalidClip(const QString &, bool)));
733 connect(m_clipMonitor, SIGNAL(refreshClipThumbnail(const QString &)), m_projectList, SLOT(slotRefreshClipThumbnail(const QString &)));
735 connect(m_clipMonitor, SIGNAL(adjustMonitorSize()), this, SLOT(slotAdjustClipMonitor()));
736 connect(m_projectMonitor, SIGNAL(adjustMonitorSize()), this, SLOT(slotAdjustProjectMonitor()));
738 connect(m_clipMonitor, SIGNAL(saveZone(Render *, QPoint)), this, SLOT(slotSaveZone(Render *, QPoint)));
739 connect(m_projectMonitor, SIGNAL(saveZone(Render *, QPoint)), this, SLOT(slotSaveZone(Render *, QPoint)));
742 void MainWindow::slotAdjustClipMonitor()
744 m_clipMonitorDock->updateGeometry();
745 m_clipMonitorDock->adjustSize();
746 m_clipMonitor->resetSize();
749 void MainWindow::slotAdjustProjectMonitor()
751 m_projectMonitorDock->updateGeometry();
752 m_projectMonitorDock->adjustSize();
753 m_projectMonitor->resetSize();
756 void MainWindow::setupActions()
759 KActionCollection* collection = actionCollection();
760 m_timecodeFormat = new KComboBox(this);
761 m_timecodeFormat->addItem(i18n("hh:mm:ss::ff"));
762 m_timecodeFormat->addItem(i18n("Frames"));
763 if (KdenliveSettings::frametimecode()) m_timecodeFormat->setCurrentIndex(1);
764 connect(m_timecodeFormat, SIGNAL(activated(int)), this, SLOT(slotUpdateTimecodeFormat(int)));
766 m_statusProgressBar = new QProgressBar(this);
767 m_statusProgressBar->setMinimum(0);
768 m_statusProgressBar->setMaximum(100);
769 m_statusProgressBar->setMaximumWidth(150);
770 m_statusProgressBar->setVisible(false);
772 KToolBar *toolbar = new KToolBar("statusToolBar", this, Qt::BottomToolBarArea);
773 toolbar->setMovable(false);
774 statusBar()->setStyleSheet(QString("QStatusBar QLabel {font-size:%1pt;} QStatusBar::item { border: 0px; font-size:%1pt;padding:0px; }").arg(statusBar()->font().pointSize()));
775 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;}";
776 QString styleBorderless = "QToolButton { border-width: 0px;margin: 1px 3px 0px;padding: 0px;}";
778 //create edit mode buttons
779 m_normalEditTool = new KAction(KIcon("kdenlive-normal-edit"), i18n("Normal mode"), this);
780 m_normalEditTool->setShortcut(i18nc("Normal editing", "n"));
781 toolbar->addAction(m_normalEditTool);
782 m_normalEditTool->setCheckable(true);
783 m_normalEditTool->setChecked(true);
785 m_overwriteEditTool = new KAction(KIcon("kdenlive-overwrite-edit"), i18n("Overwrite mode"), this);
786 //m_overwriteEditTool->setShortcut(i18nc("Overwrite mode shortcut", "o"));
787 toolbar->addAction(m_overwriteEditTool);
788 m_overwriteEditTool->setCheckable(true);
789 m_overwriteEditTool->setChecked(false);
791 m_insertEditTool = new KAction(KIcon("kdenlive-insert-edit"), i18n("Insert mode"), this);
792 //m_insertEditTool->setShortcut(i18nc("Insert mode shortcut", "i"));
793 toolbar->addAction(m_insertEditTool);
794 m_insertEditTool->setCheckable(true);
795 m_insertEditTool->setChecked(false);
796 // not implemented yet
797 m_insertEditTool->setEnabled(false);
799 QActionGroup *editGroup = new QActionGroup(this);
800 editGroup->addAction(m_normalEditTool);
801 editGroup->addAction(m_overwriteEditTool);
802 editGroup->addAction(m_insertEditTool);
803 editGroup->setExclusive(true);
804 connect(editGroup, SIGNAL(triggered(QAction *)), this, SLOT(slotChangeEdit(QAction *)));
805 //connect(m_overwriteEditTool, SIGNAL(toggled(bool)), this, SLOT(slotSetOverwriteMode(bool)));
807 toolbar->addSeparator();
809 // create tools buttons
810 m_buttonSelectTool = new KAction(KIcon("kdenlive-select-tool"), i18n("Selection tool"), this);
811 m_buttonSelectTool->setShortcut(i18nc("Selection tool shortcut", "s"));
812 toolbar->addAction(m_buttonSelectTool);
813 m_buttonSelectTool->setCheckable(true);
814 m_buttonSelectTool->setChecked(true);
816 m_buttonRazorTool = new KAction(KIcon("edit-cut"), i18n("Razor tool"), this);
817 m_buttonRazorTool->setShortcut(i18nc("Razor tool shortcut", "x"));
818 toolbar->addAction(m_buttonRazorTool);
819 m_buttonRazorTool->setCheckable(true);
820 m_buttonRazorTool->setChecked(false);
822 m_buttonSpacerTool = new KAction(KIcon("kdenlive-spacer-tool"), i18n("Spacer tool"), this);
823 m_buttonSpacerTool->setShortcut(i18nc("Spacer tool shortcut", "m"));
824 toolbar->addAction(m_buttonSpacerTool);
825 m_buttonSpacerTool->setCheckable(true);
826 m_buttonSpacerTool->setChecked(false);
828 QActionGroup *toolGroup = new QActionGroup(this);
829 toolGroup->addAction(m_buttonSelectTool);
830 toolGroup->addAction(m_buttonRazorTool);
831 toolGroup->addAction(m_buttonSpacerTool);
832 toolGroup->setExclusive(true);
833 toolbar->setToolButtonStyle(Qt::ToolButtonIconOnly);
835 QWidget * actionWidget;
836 int max = toolbar->iconSizeDefault() + 2;
837 actionWidget = toolbar->widgetForAction(m_normalEditTool);
838 actionWidget->setMaximumWidth(max);
839 actionWidget->setMaximumHeight(max - 4);
841 actionWidget = toolbar->widgetForAction(m_insertEditTool);
842 actionWidget->setMaximumWidth(max);
843 actionWidget->setMaximumHeight(max - 4);
845 actionWidget = toolbar->widgetForAction(m_overwriteEditTool);
846 actionWidget->setMaximumWidth(max);
847 actionWidget->setMaximumHeight(max - 4);
849 actionWidget = toolbar->widgetForAction(m_buttonSelectTool);
850 actionWidget->setMaximumWidth(max);
851 actionWidget->setMaximumHeight(max - 4);
853 actionWidget = toolbar->widgetForAction(m_buttonRazorTool);
854 actionWidget->setMaximumWidth(max);
855 actionWidget->setMaximumHeight(max - 4);
857 actionWidget = toolbar->widgetForAction(m_buttonSpacerTool);
858 actionWidget->setMaximumWidth(max);
859 actionWidget->setMaximumHeight(max - 4);
861 toolbar->setStyleSheet(style1);
862 connect(toolGroup, SIGNAL(triggered(QAction *)), this, SLOT(slotChangeTool(QAction *)));
864 toolbar->addSeparator();
865 m_buttonFitZoom = new KAction(KIcon("zoom-fit-best"), i18n("Fit zoom to project"), this);
866 toolbar->addAction(m_buttonFitZoom);
867 m_buttonFitZoom->setCheckable(false);
869 m_zoomOut = new KAction(KIcon("zoom-out"), i18n("Zoom Out"), this);
870 toolbar->addAction(m_zoomOut);
871 m_zoomOut->setShortcut(Qt::CTRL + Qt::Key_Minus);
873 m_zoomSlider = new QSlider(Qt::Horizontal, this);
874 m_zoomSlider->setMaximum(13);
875 m_zoomSlider->setPageStep(1);
876 m_zoomSlider->setInvertedAppearance(true);
878 m_zoomSlider->setMaximumWidth(150);
879 m_zoomSlider->setMinimumWidth(100);
880 toolbar->addWidget(m_zoomSlider);
882 m_zoomIn = new KAction(KIcon("zoom-in"), i18n("Zoom In"), this);
883 toolbar->addAction(m_zoomIn);
884 m_zoomIn->setShortcut(Qt::CTRL + Qt::Key_Plus);
886 actionWidget = toolbar->widgetForAction(m_buttonFitZoom);
887 actionWidget->setMaximumWidth(max);
888 actionWidget->setMaximumHeight(max - 4);
889 actionWidget->setStyleSheet(styleBorderless);
891 actionWidget = toolbar->widgetForAction(m_zoomIn);
892 actionWidget->setMaximumWidth(max);
893 actionWidget->setMaximumHeight(max - 4);
894 actionWidget->setStyleSheet(styleBorderless);
896 actionWidget = toolbar->widgetForAction(m_zoomOut);
897 actionWidget->setMaximumWidth(max);
898 actionWidget->setMaximumHeight(max - 4);
899 actionWidget->setStyleSheet(styleBorderless);
901 connect(m_zoomSlider, SIGNAL(valueChanged(int)), this, SLOT(slotSetZoom(int)));
902 connect(m_zoomSlider, SIGNAL(sliderMoved(int)), this, SLOT(slotShowZoomSliderToolTip(int)));
903 connect(m_buttonFitZoom, SIGNAL(triggered()), this, SLOT(slotFitZoom()));
904 connect(m_zoomIn, SIGNAL(triggered(bool)), this, SLOT(slotZoomIn()));
905 connect(m_zoomOut, SIGNAL(triggered(bool)), this, SLOT(slotZoomOut()));
907 toolbar->addSeparator();
909 //create automatic audio split button
910 m_buttonAutomaticSplitAudio = new KAction(KIcon("kdenlive-split-audio"), i18n("Split audio and video automatically"), this);
911 toolbar->addAction(m_buttonAutomaticSplitAudio);
912 m_buttonAutomaticSplitAudio->setCheckable(true);
913 m_buttonAutomaticSplitAudio->setChecked(KdenliveSettings::splitaudio());
914 connect(m_buttonAutomaticSplitAudio, SIGNAL(triggered()), this, SLOT(slotSwitchSplitAudio()));
916 m_buttonVideoThumbs = new KAction(KIcon("kdenlive-show-videothumb"), i18n("Show video thumbnails"), this);
917 toolbar->addAction(m_buttonVideoThumbs);
918 m_buttonVideoThumbs->setCheckable(true);
919 m_buttonVideoThumbs->setChecked(KdenliveSettings::videothumbnails());
920 connect(m_buttonVideoThumbs, SIGNAL(triggered()), this, SLOT(slotSwitchVideoThumbs()));
922 m_buttonAudioThumbs = new KAction(KIcon("kdenlive-show-audiothumb"), i18n("Show audio thumbnails"), this);
923 toolbar->addAction(m_buttonAudioThumbs);
924 m_buttonAudioThumbs->setCheckable(true);
925 m_buttonAudioThumbs->setChecked(KdenliveSettings::audiothumbnails());
926 connect(m_buttonAudioThumbs, SIGNAL(triggered()), this, SLOT(slotSwitchAudioThumbs()));
928 m_buttonShowMarkers = new KAction(KIcon("kdenlive-show-markers"), i18n("Show markers comments"), this);
929 toolbar->addAction(m_buttonShowMarkers);
930 m_buttonShowMarkers->setCheckable(true);
931 m_buttonShowMarkers->setChecked(KdenliveSettings::showmarkers());
932 connect(m_buttonShowMarkers, SIGNAL(triggered()), this, SLOT(slotSwitchMarkersComments()));
934 m_buttonSnap = new KAction(KIcon("kdenlive-snap"), i18n("Snap"), this);
935 toolbar->addAction(m_buttonSnap);
936 m_buttonSnap->setCheckable(true);
937 m_buttonSnap->setChecked(KdenliveSettings::snaptopoints());
938 connect(m_buttonSnap, SIGNAL(triggered()), this, SLOT(slotSwitchSnap()));
940 actionWidget = toolbar->widgetForAction(m_buttonAutomaticSplitAudio);
941 actionWidget->setMaximumWidth(max);
942 actionWidget->setMaximumHeight(max - 4);
944 actionWidget = toolbar->widgetForAction(m_buttonVideoThumbs);
945 actionWidget->setMaximumWidth(max);
946 actionWidget->setMaximumHeight(max - 4);
948 actionWidget = toolbar->widgetForAction(m_buttonAudioThumbs);
949 actionWidget->setMaximumWidth(max);
950 actionWidget->setMaximumHeight(max - 4);
952 actionWidget = toolbar->widgetForAction(m_buttonShowMarkers);
953 actionWidget->setMaximumWidth(max);
954 actionWidget->setMaximumHeight(max - 4);
956 actionWidget = toolbar->widgetForAction(m_buttonSnap);
957 actionWidget->setMaximumWidth(max);
958 actionWidget->setMaximumHeight(max - 4);
960 m_messageLabel = new StatusBarMessageLabel(this);
961 m_messageLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding);
963 statusBar()->addWidget(m_messageLabel, 10);
964 statusBar()->addWidget(m_statusProgressBar, 0);
965 statusBar()->addPermanentWidget(toolbar);
966 statusBar()->insertPermanentFixedItem("00:00:00:00", ID_TIMELINE_POS);
967 statusBar()->addPermanentWidget(m_timecodeFormat);
968 //statusBar()->setMaximumHeight(statusBar()->font().pointSize() * 3);
970 collection->addAction("normal_mode", m_normalEditTool);
971 collection->addAction("overwrite_mode", m_overwriteEditTool);
972 collection->addAction("insert_mode", m_insertEditTool);
973 collection->addAction("select_tool", m_buttonSelectTool);
974 collection->addAction("razor_tool", m_buttonRazorTool);
975 collection->addAction("spacer_tool", m_buttonSpacerTool);
977 collection->addAction("automatic_split_audio", m_buttonAutomaticSplitAudio);
978 collection->addAction("show_video_thumbs", m_buttonVideoThumbs);
979 collection->addAction("show_audio_thumbs", m_buttonAudioThumbs);
980 collection->addAction("show_markers", m_buttonShowMarkers);
981 collection->addAction("snap", m_buttonSnap);
982 collection->addAction("zoom_fit", m_buttonFitZoom);
983 collection->addAction("zoom_in", m_zoomIn);
984 collection->addAction("zoom_out", m_zoomOut);
986 m_projectSearch = new KAction(KIcon("edit-find"), i18n("Find"), this);
987 collection->addAction("project_find", m_projectSearch);
988 connect(m_projectSearch, SIGNAL(triggered(bool)), this, SLOT(slotFind()));
989 m_projectSearch->setShortcut(Qt::Key_Slash);
991 m_projectSearchNext = new KAction(KIcon("go-down-search"), i18n("Find Next"), this);
992 collection->addAction("project_find_next", m_projectSearchNext);
993 connect(m_projectSearchNext, SIGNAL(triggered(bool)), this, SLOT(slotFindNext()));
994 m_projectSearchNext->setShortcut(Qt::Key_F3);
995 m_projectSearchNext->setEnabled(false);
997 KAction* profilesAction = new KAction(KIcon("document-new"), i18n("Manage Project Profiles"), this);
998 collection->addAction("manage_profiles", profilesAction);
999 connect(profilesAction, SIGNAL(triggered(bool)), this, SLOT(slotEditProfiles()));
1001 KNS3::standardAction(i18n("Download New Wipes..."), this, SLOT(slotGetNewLumaStuff()), actionCollection(), "get_new_lumas");
1002 KNS3::standardAction(i18n("Download New Render Profiles..."), this, SLOT(slotGetNewRenderStuff()), actionCollection(), "get_new_profiles");
1003 KNS3::standardAction(i18n("Download New Project Profiles..."), this, SLOT(slotGetNewMltProfileStuff()), actionCollection(), "get_new_mlt_profiles");
1004 KNS3::standardAction(i18n("Download New Title Templates..."), this, SLOT(slotGetNewTitleStuff()), actionCollection(), "get_new_titles");
1006 KAction* wizAction = new KAction(KIcon("configure"), i18n("Run Config Wizard"), this);
1007 collection->addAction("run_wizard", wizAction);
1008 connect(wizAction, SIGNAL(triggered(bool)), this, SLOT(slotRunWizard()));
1010 KAction* projectAction = new KAction(KIcon("configure"), i18n("Project Settings"), this);
1011 collection->addAction("project_settings", projectAction);
1012 connect(projectAction, SIGNAL(triggered(bool)), this, SLOT(slotEditProjectSettings()));
1014 KAction* projectRender = new KAction(KIcon("media-record"), i18n("Render"), this);
1015 collection->addAction("project_render", projectRender);
1016 projectRender->setShortcut(Qt::CTRL + Qt::Key_Return);
1017 connect(projectRender, SIGNAL(triggered(bool)), this, SLOT(slotRenderProject()));
1019 KAction* projectClean = new KAction(KIcon("edit-clear"), i18n("Clean Project"), this);
1020 collection->addAction("project_clean", projectClean);
1021 connect(projectClean, SIGNAL(triggered(bool)), this, SLOT(slotCleanProject()));
1023 KAction* monitorPlay = new KAction(KIcon("media-playback-start"), i18n("Play"), this);
1024 KShortcut playShortcut;
1025 playShortcut.setPrimary(Qt::Key_Space);
1026 playShortcut.setAlternate(Qt::Key_K);
1027 monitorPlay->setShortcut(playShortcut);
1028 collection->addAction("monitor_play", monitorPlay);
1029 connect(monitorPlay, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotPlay()));
1031 m_playZone = new KAction(KIcon("media-playback-start"), i18n("Play Zone"), this);
1032 m_playZone->setShortcut(Qt::CTRL + Qt::Key_Space);
1033 collection->addAction("monitor_play_zone", m_playZone);
1034 connect(m_playZone, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotPlayZone()));
1036 m_loopZone = new KAction(KIcon("media-playback-start"), i18n("Loop Zone"), this);
1037 m_loopZone->setShortcut(Qt::ALT + Qt::Key_Space);
1038 collection->addAction("monitor_loop_zone", m_loopZone);
1039 connect(m_loopZone, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotLoopZone()));
1041 KAction *dvdWizard = new KAction(KIcon("media-optical"), i18n("DVD Wizard"), this);
1042 collection->addAction("dvd_wizard", dvdWizard);
1043 connect(dvdWizard, SIGNAL(triggered(bool)), this, SLOT(slotDvdWizard()));
1045 KAction *transcodeClip = new KAction(KIcon("edit-copy"), i18n("Transcode Clips"), this);
1046 collection->addAction("transcode_clip", transcodeClip);
1047 connect(transcodeClip, SIGNAL(triggered(bool)), this, SLOT(slotTranscodeClip()));
1049 KAction *markIn = collection->addAction("mark_in");
1050 markIn->setText(i18n("Set Zone In"));
1051 markIn->setShortcut(Qt::Key_I);
1052 connect(markIn, SIGNAL(triggered(bool)), this, SLOT(slotSetInPoint()));
1054 KAction *markOut = collection->addAction("mark_out");
1055 markOut->setText(i18n("Set Zone Out"));
1056 markOut->setShortcut(Qt::Key_O);
1057 connect(markOut, SIGNAL(triggered(bool)), this, SLOT(slotSetOutPoint()));
1059 KAction *switchMon = collection->addAction("switch_monitor");
1060 switchMon->setText(i18n("Switch monitor"));
1061 switchMon->setShortcut(Qt::Key_T);
1062 connect(switchMon, SIGNAL(triggered(bool)), this, SLOT(slotSwitchMonitors()));
1064 KAction *insertTree = collection->addAction("insert_project_tree");
1065 insertTree->setText(i18n("Insert zone in project tree"));
1066 insertTree->setShortcut(Qt::CTRL + Qt::Key_I);
1067 connect(insertTree, SIGNAL(triggered(bool)), this, SLOT(slotInsertZoneToTree()));
1069 KAction *insertTimeline = collection->addAction("insert_timeline");
1070 insertTimeline->setText(i18n("Insert zone in timeline"));
1071 insertTimeline->setShortcut(Qt::SHIFT + Qt::CTRL + Qt::Key_I);
1072 connect(insertTimeline, SIGNAL(triggered(bool)), this, SLOT(slotInsertZoneToTimeline()));
1074 KAction *resizeStart = new KAction(KIcon(), i18n("Resize Item Start"), this);
1075 collection->addAction("resize_timeline_clip_start", resizeStart);
1076 resizeStart->setShortcut(Qt::Key_1);
1077 connect(resizeStart, SIGNAL(triggered(bool)), this, SLOT(slotResizeItemStart()));
1079 KAction *resizeEnd = new KAction(KIcon(), i18n("Resize Item End"), this);
1080 collection->addAction("resize_timeline_clip_end", resizeEnd);
1081 resizeEnd->setShortcut(Qt::Key_2);
1082 connect(resizeEnd, SIGNAL(triggered(bool)), this, SLOT(slotResizeItemEnd()));
1084 KAction* monitorSeekBackward = new KAction(KIcon("media-seek-backward"), i18n("Rewind"), this);
1085 monitorSeekBackward->setShortcut(Qt::Key_J);
1086 collection->addAction("monitor_seek_backward", monitorSeekBackward);
1087 connect(monitorSeekBackward, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotRewind()));
1089 KAction* monitorSeekBackwardOneFrame = new KAction(KIcon("media-skip-backward"), i18n("Rewind 1 Frame"), this);
1090 monitorSeekBackwardOneFrame->setShortcut(Qt::Key_Left);
1091 collection->addAction("monitor_seek_backward-one-frame", monitorSeekBackwardOneFrame);
1092 connect(monitorSeekBackwardOneFrame, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotRewindOneFrame()));
1094 KAction* monitorSeekBackwardOneSecond = new KAction(KIcon("media-skip-backward"), i18n("Rewind 1 Second"), this);
1095 monitorSeekBackwardOneSecond->setShortcut(Qt::SHIFT + Qt::Key_Left);
1096 collection->addAction("monitor_seek_backward-one-second", monitorSeekBackwardOneSecond);
1097 connect(monitorSeekBackwardOneSecond, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotRewindOneSecond()));
1099 KAction* monitorSeekSnapBackward = new KAction(KIcon("media-seek-backward"), i18n("Go to Previous Snap Point"), this);
1100 monitorSeekSnapBackward->setShortcut(Qt::ALT + Qt::Key_Left);
1101 collection->addAction("monitor_seek_snap_backward", monitorSeekSnapBackward);
1102 connect(monitorSeekSnapBackward, SIGNAL(triggered(bool)), this, SLOT(slotSnapRewind()));
1104 KAction* monitorSeekForward = new KAction(KIcon("media-seek-forward"), i18n("Forward"), this);
1105 monitorSeekForward->setShortcut(Qt::Key_L);
1106 collection->addAction("monitor_seek_forward", monitorSeekForward);
1107 connect(monitorSeekForward, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotForward()));
1109 KAction* clipStart = new KAction(KIcon("media-seek-backward"), i18n("Go to Clip Start"), this);
1110 clipStart->setShortcut(Qt::Key_Home);
1111 collection->addAction("seek_clip_start", clipStart);
1112 connect(clipStart, SIGNAL(triggered(bool)), this, SLOT(slotClipStart()));
1114 KAction* clipEnd = new KAction(KIcon("media-seek-forward"), i18n("Go to Clip End"), this);
1115 clipEnd->setShortcut(Qt::Key_End);
1116 collection->addAction("seek_clip_end", clipEnd);
1117 connect(clipEnd, SIGNAL(triggered(bool)), this, SLOT(slotClipEnd()));
1119 KAction* zoneStart = new KAction(KIcon("media-seek-backward"), i18n("Go to Zone Start"), this);
1120 zoneStart->setShortcut(Qt::SHIFT + Qt::Key_I);
1121 collection->addAction("seek_zone_start", zoneStart);
1122 connect(zoneStart, SIGNAL(triggered(bool)), this, SLOT(slotZoneStart()));
1124 KAction* zoneEnd = new KAction(KIcon("media-seek-forward"), i18n("Go to Zone End"), this);
1125 zoneEnd->setShortcut(Qt::SHIFT + Qt::Key_O);
1126 collection->addAction("seek_zone_end", zoneEnd);
1127 connect(zoneEnd, SIGNAL(triggered(bool)), this, SLOT(slotZoneEnd()));
1129 KAction* projectStart = new KAction(KIcon("go-first"), i18n("Go to Project Start"), this);
1130 projectStart->setShortcut(Qt::CTRL + Qt::Key_Home);
1131 collection->addAction("seek_start", projectStart);
1132 connect(projectStart, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotStart()));
1134 KAction* projectEnd = new KAction(KIcon("go-last"), i18n("Go to Project End"), this);
1135 projectEnd->setShortcut(Qt::CTRL + Qt::Key_End);
1136 collection->addAction("seek_end", projectEnd);
1137 connect(projectEnd, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotEnd()));
1139 KAction* monitorSeekForwardOneFrame = new KAction(KIcon("media-skip-forward"), i18n("Forward 1 Frame"), this);
1140 monitorSeekForwardOneFrame->setShortcut(Qt::Key_Right);
1141 collection->addAction("monitor_seek_forward-one-frame", monitorSeekForwardOneFrame);
1142 connect(monitorSeekForwardOneFrame, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotForwardOneFrame()));
1144 KAction* monitorSeekForwardOneSecond = new KAction(KIcon("media-skip-forward"), i18n("Forward 1 Second"), this);
1145 monitorSeekForwardOneSecond->setShortcut(Qt::SHIFT + Qt::Key_Right);
1146 collection->addAction("monitor_seek_forward-one-second", monitorSeekForwardOneSecond);
1147 connect(monitorSeekForwardOneSecond, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotForwardOneSecond()));
1149 KAction* monitorSeekSnapForward = new KAction(KIcon("media-seek-forward"), i18n("Go to Next Snap Point"), this);
1150 monitorSeekSnapForward->setShortcut(Qt::ALT + Qt::Key_Right);
1151 collection->addAction("monitor_seek_snap_forward", monitorSeekSnapForward);
1152 connect(monitorSeekSnapForward, SIGNAL(triggered(bool)), this, SLOT(slotSnapForward()));
1154 KAction* deleteItem = new KAction(KIcon("edit-delete"), i18n("Delete Selected Item"), this);
1155 deleteItem->setShortcut(Qt::Key_Delete);
1156 collection->addAction("delete_timeline_clip", deleteItem);
1157 connect(deleteItem, SIGNAL(triggered(bool)), this, SLOT(slotDeleteItem()));
1159 /*KAction* editTimelineClipSpeed = new KAction(i18n("Change Clip Speed"), this);
1160 collection->addAction("change_clip_speed", editTimelineClipSpeed);
1161 editTimelineClipSpeed->setData("change_speed");
1162 connect(editTimelineClipSpeed, SIGNAL(triggered(bool)), this, SLOT(slotChangeClipSpeed()));*/
1164 KAction *stickTransition = collection->addAction("auto_transition");
1165 stickTransition->setData(QString("auto"));
1166 stickTransition->setCheckable(true);
1167 stickTransition->setEnabled(false);
1168 stickTransition->setText(i18n("Automatic Transition"));
1169 connect(stickTransition, SIGNAL(triggered(bool)), this, SLOT(slotAutoTransition()));
1171 KAction* groupClip = new KAction(KIcon("object-group"), i18n("Group Clips"), this);
1172 groupClip->setShortcut(Qt::CTRL + Qt::Key_G);
1173 collection->addAction("group_clip", groupClip);
1174 connect(groupClip, SIGNAL(triggered(bool)), this, SLOT(slotGroupClips()));
1176 KAction* ungroupClip = new KAction(KIcon("object-ungroup"), i18n("Ungroup Clips"), this);
1177 collection->addAction("ungroup_clip", ungroupClip);
1178 ungroupClip->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_G);
1179 ungroupClip->setData("ungroup_clip");
1180 connect(ungroupClip, SIGNAL(triggered(bool)), this, SLOT(slotUnGroupClips()));
1182 KAction* editItemDuration = new KAction(KIcon("measure"), i18n("Edit Duration"), this);
1183 collection->addAction("edit_item_duration", editItemDuration);
1184 connect(editItemDuration, SIGNAL(triggered(bool)), this, SLOT(slotEditItemDuration()));
1186 KAction* clipInProjectTree = new KAction(KIcon("go-jump-definition"), i18n("Clip in Project Tree"), this);
1187 collection->addAction("clip_in_project_tree", clipInProjectTree);
1188 connect(clipInProjectTree, SIGNAL(triggered(bool)), this, SLOT(slotClipInProjectTree()));
1190 /*KAction* clipToProjectTree = new KAction(KIcon("go-jump-definition"), i18n("Add Clip to Project Tree"), this);
1191 collection->addAction("clip_to_project_tree", clipToProjectTree);
1192 connect(clipToProjectTree, SIGNAL(triggered(bool)), this, SLOT(slotClipToProjectTree()));*/
1194 KAction* insertOvertwrite = new KAction(KIcon(), i18n("Insert Clip Zone in Timeline (Overwrite)"), this);
1195 insertOvertwrite->setShortcut(Qt::Key_V);
1196 collection->addAction("overwrite_to_in_point", insertOvertwrite);
1197 connect(insertOvertwrite, SIGNAL(triggered(bool)), this, SLOT(slotInsertClipOverwrite()));
1199 KAction* selectTimelineClip = new KAction(KIcon("edit-select"), i18n("Select Clip"), this);
1200 selectTimelineClip->setShortcut(Qt::Key_Plus);
1201 collection->addAction("select_timeline_clip", selectTimelineClip);
1202 connect(selectTimelineClip, SIGNAL(triggered(bool)), this, SLOT(slotSelectTimelineClip()));
1204 KAction* deselectTimelineClip = new KAction(KIcon("edit-select"), i18n("Deselect Clip"), this);
1205 deselectTimelineClip->setShortcut(Qt::Key_Minus);
1206 collection->addAction("deselect_timeline_clip", deselectTimelineClip);
1207 connect(deselectTimelineClip, SIGNAL(triggered(bool)), this, SLOT(slotDeselectTimelineClip()));
1209 KAction* selectAddTimelineClip = new KAction(KIcon("edit-select"), i18n("Add Clip To Selection"), this);
1210 selectAddTimelineClip->setShortcut(Qt::ALT + Qt::Key_Plus);
1211 collection->addAction("select_add_timeline_clip", selectAddTimelineClip);
1212 connect(selectAddTimelineClip, SIGNAL(triggered(bool)), this, SLOT(slotSelectAddTimelineClip()));
1214 KAction* selectTimelineTransition = new KAction(KIcon("edit-select"), i18n("Select Transition"), this);
1215 selectTimelineTransition->setShortcut(Qt::SHIFT + Qt::Key_Plus);
1216 collection->addAction("select_timeline_transition", selectTimelineTransition);
1217 connect(selectTimelineTransition, SIGNAL(triggered(bool)), this, SLOT(slotSelectTimelineTransition()));
1219 KAction* deselectTimelineTransition = new KAction(KIcon("edit-select"), i18n("Deselect Transition"), this);
1220 deselectTimelineTransition->setShortcut(Qt::SHIFT + Qt::Key_Minus);
1221 collection->addAction("deselect_timeline_transition", deselectTimelineTransition);
1222 connect(deselectTimelineTransition, SIGNAL(triggered(bool)), this, SLOT(slotDeselectTimelineTransition()));
1224 KAction* selectAddTimelineTransition = new KAction(KIcon("edit-select"), i18n("Add Transition To Selection"), this);
1225 selectAddTimelineTransition->setShortcut(Qt::ALT + Qt::SHIFT + Qt::Key_Plus);
1226 collection->addAction("select_add_timeline_transition", selectAddTimelineTransition);
1227 connect(selectAddTimelineTransition, SIGNAL(triggered(bool)), this, SLOT(slotSelectAddTimelineTransition()));
1229 KAction* cutTimelineClip = new KAction(KIcon("edit-cut"), i18n("Cut Clip"), this);
1230 cutTimelineClip->setShortcut(Qt::SHIFT + Qt::Key_R);
1231 collection->addAction("cut_timeline_clip", cutTimelineClip);
1232 connect(cutTimelineClip, SIGNAL(triggered(bool)), this, SLOT(slotCutTimelineClip()));
1234 KAction* addClipMarker = new KAction(KIcon("bookmark-new"), i18n("Add Marker"), this);
1235 collection->addAction("add_clip_marker", addClipMarker);
1236 connect(addClipMarker, SIGNAL(triggered(bool)), this, SLOT(slotAddClipMarker()));
1238 KAction* deleteClipMarker = new KAction(KIcon("edit-delete"), i18n("Delete Marker"), this);
1239 collection->addAction("delete_clip_marker", deleteClipMarker);
1240 connect(deleteClipMarker, SIGNAL(triggered(bool)), this, SLOT(slotDeleteClipMarker()));
1242 KAction* deleteAllClipMarkers = new KAction(KIcon("edit-delete"), i18n("Delete All Markers"), this);
1243 collection->addAction("delete_all_clip_markers", deleteAllClipMarkers);
1244 connect(deleteAllClipMarkers, SIGNAL(triggered(bool)), this, SLOT(slotDeleteAllClipMarkers()));
1246 KAction* editClipMarker = new KAction(KIcon("document-properties"), i18n("Edit Marker"), this);
1247 collection->addAction("edit_clip_marker", editClipMarker);
1248 connect(editClipMarker, SIGNAL(triggered(bool)), this, SLOT(slotEditClipMarker()));
1250 KAction* splitAudio = new KAction(KIcon("document-new"), i18n("Split Audio"), this);
1251 collection->addAction("split_audio", splitAudio);
1252 connect(splitAudio, SIGNAL(triggered(bool)), this, SLOT(slotSplitAudio()));
1254 KAction* audioOnly = new KAction(KIcon("document-new"), i18n("Audio Only"), this);
1255 collection->addAction("clip_audio_only", audioOnly);
1256 audioOnly->setData("clip_audio_only");
1257 audioOnly->setCheckable(true);
1259 KAction* videoOnly = new KAction(KIcon("document-new"), i18n("Video Only"), this);
1260 collection->addAction("clip_video_only", videoOnly);
1261 videoOnly->setData("clip_video_only");
1262 videoOnly->setCheckable(true);
1264 KAction* audioAndVideo = new KAction(KIcon("document-new"), i18n("Audio and Video"), this);
1265 collection->addAction("clip_audio_and_video", audioAndVideo);
1266 audioAndVideo->setData("clip_audio_and_video");
1267 audioAndVideo->setCheckable(true);
1269 m_clipTypeGroup = new QActionGroup(this);
1270 m_clipTypeGroup->addAction(audioOnly);
1271 m_clipTypeGroup->addAction(videoOnly);
1272 m_clipTypeGroup->addAction(audioAndVideo);
1273 connect(m_clipTypeGroup, SIGNAL(triggered(QAction *)), this, SLOT(slotUpdateClipType(QAction *)));
1274 m_clipTypeGroup->setEnabled(false);
1276 KAction *insertSpace = new KAction(KIcon(), i18n("Insert Space"), this);
1277 collection->addAction("insert_space", insertSpace);
1278 connect(insertSpace, SIGNAL(triggered()), this, SLOT(slotInsertSpace()));
1280 KAction *removeSpace = new KAction(KIcon(), i18n("Remove Space"), this);
1281 collection->addAction("delete_space", removeSpace);
1282 connect(removeSpace, SIGNAL(triggered()), this, SLOT(slotRemoveSpace()));
1284 KAction *insertTrack = new KAction(KIcon(), i18n("Insert Track"), this);
1285 collection->addAction("insert_track", insertTrack);
1286 connect(insertTrack, SIGNAL(triggered()), this, SLOT(slotInsertTrack()));
1288 KAction *deleteTrack = new KAction(KIcon(), i18n("Delete Track"), this);
1289 collection->addAction("delete_track", deleteTrack);
1290 connect(deleteTrack, SIGNAL(triggered()), this, SLOT(slotDeleteTrack()));
1292 KAction *configTracks = new KAction(KIcon("configure"), i18n("Configure Tracks"), this);
1293 collection->addAction("config_tracks", configTracks);
1294 connect(configTracks, SIGNAL(triggered()), this, SLOT(slotConfigTrack()));
1296 KAction *addGuide = new KAction(KIcon("document-new"), i18n("Add Guide"), this);
1297 collection->addAction("add_guide", addGuide);
1298 connect(addGuide, SIGNAL(triggered()), this, SLOT(slotAddGuide()));
1300 QAction *delGuide = new KAction(KIcon("edit-delete"), i18n("Delete Guide"), this);
1301 collection->addAction("delete_guide", delGuide);
1302 connect(delGuide, SIGNAL(triggered()), this, SLOT(slotDeleteGuide()));
1304 QAction *editGuide = new KAction(KIcon("document-properties"), i18n("Edit Guide"), this);
1305 collection->addAction("edit_guide", editGuide);
1306 connect(editGuide, SIGNAL(triggered()), this, SLOT(slotEditGuide()));
1308 QAction *delAllGuides = new KAction(KIcon("edit-delete"), i18n("Delete All Guides"), this);
1309 collection->addAction("delete_all_guides", delAllGuides);
1310 connect(delAllGuides, SIGNAL(triggered()), this, SLOT(slotDeleteAllGuides()));
1312 QAction *pasteEffects = new KAction(KIcon("edit-paste"), i18n("Paste Effects"), this);
1313 collection->addAction("paste_effects", pasteEffects);
1314 pasteEffects->setData("paste_effects");
1315 connect(pasteEffects , SIGNAL(triggered()), this, SLOT(slotPasteEffects()));
1317 QAction *showTimeline = new KAction(i18n("Show Timeline"), this);
1318 collection->addAction("show_timeline", showTimeline);
1319 showTimeline->setCheckable(true);
1320 showTimeline->setChecked(true);
1321 connect(showTimeline, SIGNAL(triggered(bool)), this, SLOT(slotShowTimeline(bool)));
1323 QAction *showTitleBar = new KAction(i18n("Show Title Bars"), this);
1324 collection->addAction("show_titlebars", showTitleBar);
1325 showTitleBar->setCheckable(true);
1326 connect(showTitleBar, SIGNAL(triggered(bool)), this, SLOT(slotShowTitleBars(bool)));
1327 showTitleBar->setChecked(KdenliveSettings::showtitlebars());
1328 slotShowTitleBars(KdenliveSettings::showtitlebars());
1330 /*QAction *maxCurrent = new KAction(i18n("Maximize Current Widget"), this);
1331 collection->addAction("maximize_current", maxCurrent);
1332 maxCurrent->setCheckable(true);
1333 maxCurrent->setChecked(false);
1334 connect(maxCurrent, SIGNAL(triggered(bool)), this, SLOT(slotMaximizeCurrent(bool)));*/
1336 m_closeAction = KStandardAction::close(this, SLOT(closeCurrentDocument()), collection);
1337 KStandardAction::quit(this, SLOT(queryQuit()), collection);
1338 KStandardAction::open(this, SLOT(openFile()), collection);
1339 m_saveAction = KStandardAction::save(this, SLOT(saveFile()), collection);
1340 KStandardAction::saveAs(this, SLOT(saveFileAs()), collection);
1341 KStandardAction::openNew(this, SLOT(newFile()), collection);
1342 // TODO: make the following connection to slotEditKeys work
1343 KStandardAction::keyBindings(this, SLOT(slotEditKeys()), collection);
1344 KStandardAction::preferences(this, SLOT(slotPreferences()), collection);
1345 KStandardAction::configureNotifications(this, SLOT(configureNotifications()), collection);
1346 KStandardAction::copy(this, SLOT(slotCopy()), collection);
1347 KStandardAction::paste(this, SLOT(slotPaste()), collection);
1348 KStandardAction::fullScreen(this, SLOT(slotFullScreen()), this, collection);
1350 KAction *undo = KStandardAction::undo(m_commandStack, SLOT(undo()), collection);
1351 undo->setEnabled(false);
1352 connect(m_commandStack, SIGNAL(canUndoChanged(bool)), undo, SLOT(setEnabled(bool)));
1354 KAction *redo = KStandardAction::redo(m_commandStack, SLOT(redo()), collection);
1355 redo->setEnabled(false);
1356 connect(m_commandStack, SIGNAL(canRedoChanged(bool)), redo, SLOT(setEnabled(bool)));
1359 //TODO: Add status tooltip to actions ?
1360 connect(collection, SIGNAL(actionHovered(QAction*)),
1361 this, SLOT(slotDisplayActionMessage(QAction*)));*/
1364 QAction *addClip = new KAction(KIcon("kdenlive-add-clip"), i18n("Add Clip"), this);
1365 collection->addAction("add_clip", addClip);
1366 connect(addClip , SIGNAL(triggered()), m_projectList, SLOT(slotAddClip()));
1368 QAction *addColorClip = new KAction(KIcon("kdenlive-add-color-clip"), i18n("Add Color Clip"), this);
1369 collection->addAction("add_color_clip", addColorClip);
1370 connect(addColorClip , SIGNAL(triggered()), m_projectList, SLOT(slotAddColorClip()));
1372 QAction *addSlideClip = new KAction(KIcon("kdenlive-add-slide-clip"), i18n("Add Slideshow Clip"), this);
1373 collection->addAction("add_slide_clip", addSlideClip);
1374 connect(addSlideClip , SIGNAL(triggered()), m_projectList, SLOT(slotAddSlideshowClip()));
1376 QAction *addTitleClip = new KAction(KIcon("kdenlive-add-text-clip"), i18n("Add Title Clip"), this);
1377 collection->addAction("add_text_clip", addTitleClip);
1378 connect(addTitleClip , SIGNAL(triggered()), m_projectList, SLOT(slotAddTitleClip()));
1380 QAction *addTitleTemplateClip = new KAction(KIcon("kdenlive-add-text-clip"), i18n("Add Template Title"), this);
1381 collection->addAction("add_text_template_clip", addTitleTemplateClip);
1382 connect(addTitleTemplateClip , SIGNAL(triggered()), m_projectList, SLOT(slotAddTitleTemplateClip()));
1384 QAction *addFolderButton = new KAction(KIcon("folder-new"), i18n("Create Folder"), this);
1385 collection->addAction("add_folder", addFolderButton);
1386 connect(addFolderButton , SIGNAL(triggered()), m_projectList, SLOT(slotAddFolder()));
1388 QAction *clipProperties = new KAction(KIcon("document-edit"), i18n("Clip Properties"), this);
1389 collection->addAction("clip_properties", clipProperties);
1390 clipProperties->setData("clip_properties");
1391 connect(clipProperties , SIGNAL(triggered()), m_projectList, SLOT(slotEditClip()));
1392 clipProperties->setEnabled(false);
1394 QAction *openClip = new KAction(KIcon("document-open"), i18n("Edit Clip"), this);
1395 collection->addAction("edit_clip", openClip);
1396 openClip->setData("edit_clip");
1397 connect(openClip , SIGNAL(triggered()), m_projectList, SLOT(slotOpenClip()));
1398 openClip->setEnabled(false);
1400 QAction *deleteClip = new KAction(KIcon("edit-delete"), i18n("Delete Clip"), this);
1401 collection->addAction("delete_clip", deleteClip);
1402 deleteClip->setData("delete_clip");
1403 connect(deleteClip , SIGNAL(triggered()), m_projectList, SLOT(slotRemoveClip()));
1404 deleteClip->setEnabled(false);
1406 QAction *reloadClip = new KAction(KIcon("view-refresh"), i18n("Reload Clip"), this);
1407 collection->addAction("reload_clip", reloadClip);
1408 reloadClip->setData("reload_clip");
1409 connect(reloadClip , SIGNAL(triggered()), m_projectList, SLOT(slotReloadClip()));
1410 reloadClip->setEnabled(false);
1412 QMenu *addClips = new QMenu();
1413 addClips->addAction(addClip);
1414 addClips->addAction(addColorClip);
1415 addClips->addAction(addSlideClip);
1416 addClips->addAction(addTitleClip);
1417 addClips->addAction(addTitleTemplateClip);
1418 addClips->addAction(addFolderButton);
1420 addClips->addAction(reloadClip);
1421 addClips->addAction(clipProperties);
1422 addClips->addAction(openClip);
1423 addClips->addAction(deleteClip);
1424 m_projectList->setupMenu(addClips, addClip);
1426 // Setup effects and transitions actions.
1427 m_effectsActionCollection = new KActionCollection(this, KGlobal::mainComponent());
1428 //KActionCategory *videoEffectActions = new KActionCategory(i18n("Video Effects"), m_effectsActionCollection);
1429 KActionCategory *videoEffectActions = new KActionCategory(i18n("Video Effects"), collection);
1430 m_videoEffects = new KAction*[videoEffects.count()];
1431 for (int i = 0; i < videoEffects.count(); ++i) {
1432 QStringList effectInfo = videoEffects.effectIdInfo(i);
1433 m_videoEffects[i] = new KAction(KIcon("kdenlive-show-video"), effectInfo.at(0), this);
1434 m_videoEffects[i]->setData(effectInfo);
1435 m_videoEffects[i]->setIconVisibleInMenu(false);
1436 videoEffectActions->addAction("video_effect_" + effectInfo.at(0), m_videoEffects[i]);
1438 //KActionCategory *audioEffectActions = new KActionCategory(i18n("Audio Effects"), m_effectsActionCollection);
1439 KActionCategory *audioEffectActions = new KActionCategory(i18n("Audio Effects"), collection);
1440 m_audioEffects = new KAction*[audioEffects.count()];
1441 for (int i = 0; i < audioEffects.count(); ++i) {
1442 QStringList effectInfo = audioEffects.effectIdInfo(i);
1443 m_audioEffects[i] = new KAction(KIcon("kdenlive-show-audio"), effectInfo.at(0), this);
1444 m_audioEffects[i]->setData(effectInfo);
1445 m_audioEffects[i]->setIconVisibleInMenu(false);
1446 audioEffectActions->addAction("audio_effect_" + effectInfo.at(0), m_audioEffects[i]);
1448 //KActionCategory *customEffectActions = new KActionCategory(i18n("Custom Effects"), m_effectsActionCollection);
1449 KActionCategory *customEffectActions = new KActionCategory(i18n("Custom Effects"), collection);
1450 m_customEffects = new KAction*[customEffects.count()];
1451 for (int i = 0; i < customEffects.count(); ++i) {
1452 QStringList effectInfo = customEffects.effectIdInfo(i);
1453 m_customEffects[i] = new KAction(KIcon("kdenlive-custom-effect"), effectInfo.at(0), this);
1454 m_customEffects[i]->setData(effectInfo);
1455 m_customEffects[i]->setIconVisibleInMenu(false);
1456 customEffectActions->addAction("custom_effect_" + effectInfo.at(0), m_customEffects[i]);
1458 //KActionCategory *transitionActions = new KActionCategory(i18n("Transitions"), m_effectsActionCollection);
1459 KActionCategory *transitionActions = new KActionCategory(i18n("Transitions"), collection);
1460 m_transitions = new KAction*[transitions.count()];
1461 for (int i = 0; i < transitions.count(); i++) {
1462 QStringList effectInfo = transitions.effectIdInfo(i);
1463 m_transitions[i] = new KAction(effectInfo.at(0), this);
1464 m_transitions[i]->setData(effectInfo);
1465 m_transitions[i]->setIconVisibleInMenu(false);
1466 transitionActions->addAction("transition_" + effectInfo.at(0), m_transitions[i]);
1468 m_effectsActionCollection->readSettings();
1470 //connect(collection, SIGNAL( clearStatusText() ),
1471 //statusBar(), SLOT( clear() ) );
1474 void MainWindow::slotDisplayActionMessage(QAction *a)
1476 statusBar()->showMessage(a->data().toString(), 3000);
1479 void MainWindow::saveOptions()
1481 KdenliveSettings::self()->writeConfig();
1482 KSharedConfigPtr config = KGlobal::config();
1483 m_fileOpenRecent->saveEntries(KConfigGroup(config, "Recent Files"));
1484 KConfigGroup treecolumns(config, "Project Tree");
1485 treecolumns.writeEntry("columns", m_projectList->headerInfo());
1489 void MainWindow::readOptions()
1491 KSharedConfigPtr config = KGlobal::config();
1492 m_fileOpenRecent->loadEntries(KConfigGroup(config, "Recent Files"));
1493 KConfigGroup initialGroup(config, "version");
1494 bool upgrade = false;
1495 if (initialGroup.exists()) {
1496 if (initialGroup.readEntry("version", QString()).section(' ', 0, 0) != QString(version).section(' ', 0, 0)) {
1500 if (initialGroup.readEntry("version") == "0.7") {
1501 //Add new settings from 0.7.1
1502 if (KdenliveSettings::defaultprojectfolder().isEmpty()) {
1503 QString path = QDir::homePath() + "/kdenlive";
1504 if (KStandardDirs::makeDir(path) == false) {
1505 kDebug() << "/// ERROR CREATING PROJECT FOLDER: " << path;
1506 } else KdenliveSettings::setDefaultprojectfolder(path);
1512 if (!initialGroup.exists() || upgrade) {
1513 // this is our first run, show Wizard
1514 Wizard *w = new Wizard(upgrade, this);
1515 if (w->exec() == QDialog::Accepted && w->isOk()) {
1516 w->adjustSettings();
1517 initialGroup.writeEntry("version", version);
1523 KConfigGroup treecolumns(config, "Project Tree");
1524 const QByteArray state = treecolumns.readEntry("columns", QByteArray());
1525 if (!state.isEmpty())
1526 m_projectList->setHeaderInfo(state);
1529 void MainWindow::slotRunWizard()
1531 Wizard *w = new Wizard(false, this);
1532 if (w->exec() == QDialog::Accepted && w->isOk()) {
1533 w->adjustSettings();
1538 void MainWindow::newFile(bool showProjectSettings, bool force)
1540 if (!m_timelineArea->isEnabled() && !force) return;
1541 m_fileRevert->setEnabled(false);
1542 QString profileName;
1544 QPoint projectTracks(KdenliveSettings::videotracks(), KdenliveSettings::audiotracks());
1545 if (!showProjectSettings) {
1546 if (!KdenliveSettings::activatetabs()) closeCurrentDocument();
1547 profileName = KdenliveSettings::default_profile();
1548 projectFolder = KdenliveSettings::defaultprojectfolder();
1550 ProjectSettings *w = new ProjectSettings(NULL, QStringList(), projectTracks.x(), projectTracks.y(), KdenliveSettings::defaultprojectfolder(), false, true, this);
1551 if (w->exec() != QDialog::Accepted) return;
1552 if (!KdenliveSettings::activatetabs()) closeCurrentDocument();
1553 if (KdenliveSettings::videothumbnails() != w->enableVideoThumbs()) slotSwitchVideoThumbs();
1554 if (KdenliveSettings::audiothumbnails() != w->enableAudioThumbs()) slotSwitchAudioThumbs();
1555 profileName = w->selectedProfile();
1556 projectFolder = w->selectedFolder();
1557 projectTracks = w->tracks();
1560 m_timelineArea->setEnabled(true);
1561 m_projectList->setEnabled(true);
1562 KdenliveDoc *doc = new KdenliveDoc(KUrl(), projectFolder, m_commandStack, profileName, projectTracks, m_projectMonitor->render, this);
1563 doc->m_autosave = new KAutoSaveFile(KUrl(), doc);
1565 TrackView *trackView = new TrackView(doc, &ok, this);
1566 m_timelineArea->addTab(trackView, KIcon("kdenlive"), doc->description());
1569 //m_timelineArea->setEnabled(false);
1570 //m_projectList->setEnabled(false);
1574 if (m_timelineArea->count() == 1) {
1575 connectDocumentInfo(doc);
1576 connectDocument(trackView, doc);
1577 } else m_timelineArea->setTabBarHidden(false);
1578 m_monitorManager->activateMonitor("clip");
1579 m_closeAction->setEnabled(m_timelineArea->count() > 1);
1582 void MainWindow::activateDocument()
1584 if (m_timelineArea->currentWidget() == NULL || !m_timelineArea->isEnabled()) return;
1585 TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
1586 KdenliveDoc *currentDoc = currentTab->document();
1587 connectDocumentInfo(currentDoc);
1588 connectDocument(currentTab, currentDoc);
1591 void MainWindow::closeCurrentDocument(bool saveChanges)
1593 QWidget *w = m_timelineArea->currentWidget();
1595 // closing current document
1596 int ix = m_timelineArea->currentIndex() + 1;
1597 if (ix == m_timelineArea->count()) ix = 0;
1598 m_timelineArea->setCurrentIndex(ix);
1599 TrackView *tabToClose = (TrackView *) w;
1600 KdenliveDoc *docToClose = tabToClose->document();
1601 if (docToClose && docToClose->isModified() && saveChanges) {
1603 if (m_activeDocument->url().fileName().isEmpty())
1604 message = i18n("Save changes to document?");
1606 message = i18n("The project <b>\"%1\"</b> has been changed.\nDo you want to save your changes?").arg(m_activeDocument->url().fileName());
1607 switch (KMessageBox::warningYesNoCancel(this, message)) {
1608 case KMessageBox::Yes :
1609 // save document here. If saving fails, return false;
1610 if (saveFile() == false) return;
1612 case KMessageBox::Cancel :
1619 m_clipMonitor->slotSetXml(NULL);
1620 m_timelineArea->removeTab(m_timelineArea->indexOf(w));
1621 if (m_timelineArea->count() == 1) {
1622 m_timelineArea->setTabBarHidden(true);
1623 m_closeAction->setEnabled(false);
1625 if (docToClose == m_activeDocument) {
1626 delete m_activeDocument;
1627 m_activeDocument = NULL;
1628 m_effectStack->clear();
1629 m_transitionConfig->slotTransitionItemSelected(NULL, 0, QPoint(), false);
1633 if (w == m_activeTimeline) {
1634 delete m_activeTimeline;
1635 m_activeTimeline = NULL;
1641 bool MainWindow::saveFileAs(const QString &outputFileName)
1643 QString currentSceneList;
1644 m_monitorManager->stopActiveMonitor();
1645 if (KdenliveSettings::dropbframes()) {
1646 KdenliveSettings::setDropbframes(false);
1647 m_activeDocument->clipManager()->updatePreviewSettings();
1648 currentSceneList = m_projectMonitor->sceneList();
1649 KdenliveSettings::setDropbframes(true);
1650 m_activeDocument->clipManager()->updatePreviewSettings();
1651 } else currentSceneList = m_projectMonitor->sceneList();
1653 if (m_activeDocument->saveSceneList(outputFileName, currentSceneList) == false)
1656 // Save timeline thumbnails
1657 m_activeTimeline->projectView()->saveThumbnails();
1658 m_activeDocument->setUrl(KUrl(outputFileName));
1659 if (m_activeDocument->m_autosave == NULL) {
1660 m_activeDocument->m_autosave = new KAutoSaveFile(KUrl(outputFileName), this);
1661 } else m_activeDocument->m_autosave->setManagedFile(KUrl(outputFileName));
1662 setCaption(m_activeDocument->description());
1663 m_timelineArea->setTabText(m_timelineArea->currentIndex(), m_activeDocument->description());
1664 m_timelineArea->setTabToolTip(m_timelineArea->currentIndex(), m_activeDocument->url().path());
1665 m_activeDocument->setModified(false);
1666 m_fileOpenRecent->addUrl(KUrl(outputFileName));
1667 m_fileRevert->setEnabled(true);
1671 bool MainWindow::saveFileAs()
1673 QString outputFile = KFileDialog::getSaveFileName(KUrl(), getMimeType());
1674 if (outputFile.isEmpty()) return false;
1675 if (QFile::exists(outputFile)) {
1676 // Show the file dialog again if the user does not want to overwrite the file
1677 if (KMessageBox::questionYesNo(this, i18n("File already exists.\nDo you want to overwrite it?")) == KMessageBox::No)
1678 return saveFileAs();
1680 return saveFileAs(outputFile);
1683 bool MainWindow::saveFile()
1685 if (!m_activeDocument) return true;
1686 if (m_activeDocument->url().isEmpty()) {
1687 return saveFileAs();
1689 bool result = saveFileAs(m_activeDocument->url().path());
1690 m_activeDocument->m_autosave->resize(0);
1695 void MainWindow::openFile()
1697 if (!m_startUrl.isEmpty()) {
1698 openFile(m_startUrl);
1699 m_startUrl = KUrl();
1702 KUrl url = KFileDialog::getOpenUrl(KUrl("kfiledialog:///projectfolder"), getMimeType());
1703 if (url.isEmpty()) return;
1704 m_fileOpenRecent->addUrl(url);
1708 void MainWindow::openLastFile()
1710 KSharedConfigPtr config = KGlobal::config();
1711 KUrl::List urls = m_fileOpenRecent->urls();
1712 //WARNING: this is buggy, we get a random url, not the last one. Bug in KRecentFileAction?
1713 if (urls.isEmpty()) newFile(false);
1714 else openFile(urls.last());
1717 void MainWindow::openFile(const KUrl &url)
1719 // Check if the document is already opened
1720 const int ct = m_timelineArea->count();
1721 bool isOpened = false;
1723 for (i = 0; i < ct; i++) {
1724 TrackView *tab = (TrackView *) m_timelineArea->widget(i);
1725 KdenliveDoc *doc = tab->document();
1726 if (doc->url() == url) {
1732 m_timelineArea->setCurrentIndex(i);
1736 // Check for backup file
1737 QList<KAutoSaveFile *> staleFiles = KAutoSaveFile::staleFiles(url);
1738 if (!staleFiles.isEmpty()) {
1739 if (KMessageBox::questionYesNo(this,
1740 i18n("Auto-saved files exist. Do you want to recover them now?"),
1741 i18n("File Recovery"),
1742 KGuiItem(i18n("Recover")), KGuiItem(i18n("Don't recover"))) == KMessageBox::Yes) {
1743 recoverFiles(staleFiles);
1746 // remove the stale files
1747 foreach(KAutoSaveFile *stale, staleFiles) {
1748 stale->open(QIODevice::ReadWrite);
1753 if (!KdenliveSettings::activatetabs()) closeCurrentDocument();
1754 m_messageLabel->setMessage(i18n("Opening file %1", url.path()), InformationMessage);
1755 m_messageLabel->repaint();
1756 doOpenFile(url, NULL);
1759 void MainWindow::doOpenFile(const KUrl &url, KAutoSaveFile *stale)
1761 if (!m_timelineArea->isEnabled()) return;
1762 m_fileRevert->setEnabled(true);
1763 KdenliveDoc *doc = new KdenliveDoc(url, KdenliveSettings::defaultprojectfolder(), m_commandStack, KdenliveSettings::default_profile(), QPoint(KdenliveSettings::videotracks(), KdenliveSettings::audiotracks()), m_projectMonitor->render, this);
1764 if (stale == NULL) {
1765 stale = new KAutoSaveFile(url, doc);
1766 doc->m_autosave = stale;
1768 doc->m_autosave = stale;
1769 doc->setUrl(stale->managedFile());
1770 doc->setModified(true);
1771 stale->setParent(doc);
1773 connectDocumentInfo(doc);
1775 TrackView *trackView = new TrackView(doc, &ok, this);
1776 m_timelineArea->setCurrentIndex(m_timelineArea->addTab(trackView, KIcon("kdenlive"), doc->description()));
1778 m_timelineArea->setEnabled(false);
1779 m_projectList->setEnabled(false);
1780 KMessageBox::sorry(this, i18n("Cannot open file %1.\nProject is corrupted.", url.path()));
1781 slotGotProgressInfo(QString(), -1);
1782 newFile(false, true);
1785 m_timelineArea->setTabToolTip(m_timelineArea->currentIndex(), doc->url().path());
1786 trackView->setDuration(trackView->duration());
1787 trackView->projectView()->initCursorPos(m_projectMonitor->render->seekPosition().frames(doc->fps()));
1789 if (m_timelineArea->count() > 1) m_timelineArea->setTabBarHidden(false);
1790 slotGotProgressInfo(QString(), -1);
1791 m_projectMonitor->adjustRulerSize(trackView->duration());
1792 m_projectMonitor->slotZoneMoved(trackView->inPoint(), trackView->outPoint());
1793 m_clipMonitor->refreshMonitor(true);
1796 void MainWindow::recoverFiles(QList<KAutoSaveFile *> staleFiles)
1798 if (!KdenliveSettings::activatetabs()) closeCurrentDocument();
1799 foreach(KAutoSaveFile *stale, staleFiles) {
1800 /*if (!stale->open(QIODevice::QIODevice::ReadOnly)) {
1801 // show an error message; we could not steal the lockfile
1802 // maybe another application got to the file before us?
1806 kDebug() << "// OPENING RECOVERY: " << stale->fileName() << "\nMANAGED: " << stale->managedFile().path();
1807 // the stalefiles also contain ".lock" files so we must ignore them... bug in KAutoSaveFile?
1808 if (!stale->fileName().endsWith(".lock")) doOpenFile(KUrl(stale->fileName()), stale);
1809 else KIO::NetAccess::del(KUrl(stale->fileName()), this);
1813 void MainWindow::parseProfiles(const QString &mltPath)
1815 //KdenliveSettings::setDefaulttmpfolder();
1816 if (!mltPath.isEmpty()) {
1817 KdenliveSettings::setMltpath(mltPath + "/share/mlt/profiles/");
1818 KdenliveSettings::setRendererpath(mltPath + "/bin/melt");
1821 if (KdenliveSettings::mltpath().isEmpty())
1822 KdenliveSettings::setMltpath(QString(MLT_PREFIX) + QString("/share/mlt/profiles/"));
1824 if (KdenliveSettings::rendererpath().isEmpty() || KdenliveSettings::rendererpath().endsWith("inigo")) {
1825 QString meltPath = QString(MLT_PREFIX) + QString("/bin/melt");
1826 if (!QFile::exists(meltPath))
1827 meltPath = KStandardDirs::findExe("melt");
1828 KdenliveSettings::setRendererpath(meltPath);
1831 if (KdenliveSettings::rendererpath().isEmpty()) {
1832 // Cannot find the MLT melt renderer, ask for location
1833 KUrlRequesterDialog *getUrl = new KUrlRequesterDialog(QString(), i18n("Cannot find the melt program required for rendering (part of MLT)"), this);
1834 if (getUrl->exec() == QDialog::Rejected) {
1837 KUrl rendererPath = getUrl->selectedUrl();
1839 if (rendererPath.isEmpty()) ::exit(0);
1840 KdenliveSettings::setRendererpath(rendererPath.path());
1843 QStringList profilesFilter;
1844 profilesFilter << "*";
1845 QStringList profilesList = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
1846 if (profilesList.isEmpty()) {
1847 // Cannot find MLT path, try finding melt
1848 QString profilePath = KdenliveSettings::rendererpath();
1849 if (!profilePath.isEmpty()) {
1850 profilePath = profilePath.section('/', 0, -3);
1851 KdenliveSettings::setMltpath(profilePath + "/share/mlt/profiles/");
1852 profilesList = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
1854 if (profilesList.isEmpty()) {
1855 // Cannot find the MLT profiles, ask for location
1856 KUrlRequesterDialog *getUrl = new KUrlRequesterDialog(KdenliveSettings::mltpath(), i18n("Cannot find your MLT profiles, please give the path"), this);
1857 getUrl->fileDialog()->setMode(KFile::Directory);
1858 if (getUrl->exec() == QDialog::Rejected) {
1861 KUrl mltPath = getUrl->selectedUrl();
1863 if (mltPath.isEmpty()) ::exit(0);
1864 KdenliveSettings::setMltpath(mltPath.path(KUrl::AddTrailingSlash));
1865 profilesList = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
1869 kDebug() << "RESULTING MLT PATH: " << KdenliveSettings::mltpath();
1871 // Parse again MLT profiles to build a list of available video formats
1872 if (profilesList.isEmpty()) parseProfiles();
1876 void MainWindow::slotEditProfiles()
1878 ProfilesDialog *w = new ProfilesDialog;
1879 if (w->exec() == QDialog::Accepted) {
1880 KdenliveSettingsDialog* d = static_cast <KdenliveSettingsDialog*>(KConfigDialog::exists("settings"));
1881 if (d) d->checkProfile();
1886 void MainWindow::slotDetectAudioDriver()
1888 /* WARNING: do not use this method because sometimes detects wrong driver (pulse instead of alsa),
1889 leading to no audio output, see bug #934 */
1891 //decide which audio driver is really best, in some cases SDL is wrong
1892 if (KdenliveSettings::audiodrivername().isEmpty()) {
1894 KProcess readProcess;
1895 //PulseAudio needs to be selected if it exists, the ALSA pulse pcm device is not fast enough.
1896 if (!KStandardDirs::findExe("pactl").isEmpty()) {
1897 readProcess.setOutputChannelMode(KProcess::OnlyStdoutChannel);
1898 readProcess.setProgram("pactl", QStringList() << "stat");
1899 readProcess.execute(2000); // Kill it after 2 seconds
1901 QString result = QString(readProcess.readAllStandardOutput());
1902 kDebug() << "// / / / / / READING PACTL: ";
1904 if (!result.isEmpty()) {
1906 kDebug() << "// / / / / PULSEAUDIO DETECTED";
1910 KdenliveSettings::setAutoaudiodrivername(driver);
1914 void MainWindow::slotEditProjectSettings()
1916 QPoint p = m_activeDocument->getTracksCount();
1917 ProjectSettings *w = new ProjectSettings(m_projectList, m_activeTimeline->projectView()->extractTransitionsLumas(), p.x(), p.y(), m_activeDocument->projectFolder().path(), true, !m_activeDocument->isModified(), this);
1919 if (w->exec() == QDialog::Accepted) {
1920 QString profile = w->selectedProfile();
1921 m_activeDocument->setProjectFolder(w->selectedFolder());
1922 if (m_renderWidget) m_renderWidget->setDocumentPath(w->selectedFolder().path(KUrl::AddTrailingSlash));
1923 if (KdenliveSettings::videothumbnails() != w->enableVideoThumbs()) slotSwitchVideoThumbs();
1924 if (KdenliveSettings::audiothumbnails() != w->enableAudioThumbs()) slotSwitchAudioThumbs();
1925 if (m_activeDocument->profilePath() != profile) {
1926 // Profile was changed
1927 double dar = m_activeDocument->dar();
1929 // Deselect current effect / transition
1930 m_effectStack->slotClipItemSelected(NULL, 0);
1931 m_transitionConfig->slotTransitionItemSelected(NULL, 0, QPoint(), false);
1932 m_clipMonitor->slotSetXml(NULL);
1933 bool updateFps = m_activeDocument->setProfilePath(profile);
1934 KdenliveSettings::setCurrent_profile(profile);
1935 KdenliveSettings::setProject_fps(m_activeDocument->fps());
1936 setCaption(m_activeDocument->description(), m_activeDocument->isModified());
1938 m_activeDocument->clipManager()->clearUnusedProducers();
1939 m_monitorManager->resetProfiles(m_activeDocument->timecode());
1941 m_transitionConfig->updateProjectFormat(m_activeDocument->mltProfile(), m_activeDocument->timecode(), m_activeDocument->tracksList());
1942 m_effectStack->updateProjectFormat(m_activeDocument->mltProfile(), m_activeDocument->timecode());
1943 m_projectList->updateProjectFormat(m_activeDocument->timecode());
1944 if (m_renderWidget) m_renderWidget->setProfile(m_activeDocument->mltProfile());
1945 m_timelineArea->setTabText(m_timelineArea->currentIndex(), m_activeDocument->description());
1946 //m_activeDocument->clipManager()->resetProducersList(m_projectMonitor->render->producersList());
1947 if (dar != m_activeDocument->dar()) m_projectList->reloadClipThumbnails();
1948 if (updateFps) m_activeTimeline->updateProjectFps();
1949 m_activeDocument->setModified(true);
1950 m_commandStack->activeStack()->clear();
1951 //Update the mouse position display so it will display in DF/NDF format by default based on the project setting.
1952 slotUpdateMousePosition(0);
1953 // We need to desactivate & reactivate monitors to get a refresh
1954 //m_monitorManager->switchMonitors();
1961 void MainWindow::slotRenderProject()
1963 if (!m_renderWidget) {
1964 QString projectfolder = m_activeDocument ? m_activeDocument->projectFolder().path(KUrl::AddTrailingSlash) : KdenliveSettings::defaultprojectfolder();
1965 m_renderWidget = new RenderWidget(projectfolder, this);
1966 connect(m_renderWidget, SIGNAL(shutdown()), this, SLOT(slotShutdown()));
1967 connect(m_renderWidget, SIGNAL(selectedRenderProfile(const QString &, const QString &, const QString &, const QString&)), this, SLOT(slotSetDocumentRenderProfile(const QString &, const QString &, const QString &, const QString&)));
1968 connect(m_renderWidget, SIGNAL(prepareRenderingData(bool, bool, const QString&)), this, SLOT(slotPrepareRendering(bool, bool, const QString&)));
1969 connect(m_renderWidget, SIGNAL(abortProcess(const QString &)), this, SIGNAL(abortRenderJob(const QString &)));
1970 connect(m_renderWidget, SIGNAL(openDvdWizard(const QString &, const QString &)), this, SLOT(slotDvdWizard(const QString &, const QString &)));
1971 if (m_activeDocument) {
1972 m_renderWidget->setProfile(m_activeDocument->mltProfile());
1973 m_renderWidget->setGuides(m_activeDocument->guidesXml(), m_activeDocument->projectDuration());
1974 m_renderWidget->setDocumentPath(m_activeDocument->projectFolder().path(KUrl::AddTrailingSlash));
1975 m_renderWidget->setRenderProfile(m_activeDocument->getDocumentProperty("renderdestination"), m_activeDocument->getDocumentProperty("rendercategory"), m_activeDocument->getDocumentProperty("renderprofile"), m_activeDocument->getDocumentProperty("renderurl"));
1978 slotCheckRenderStatus();
1979 /*TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
1980 if (currentTab) m_renderWidget->setTimeline(currentTab);
1981 m_renderWidget->setDocument(m_activeDocument);*/
1982 m_renderWidget->show();
1983 m_renderWidget->showNormal();
1985 m_activeTimeline->tracksNumber();
1986 m_renderWidget->enableAudio(false);
1987 //m_renderWidget->export_audio;
1990 void MainWindow::slotCheckRenderStatus()
1992 // Make sure there are no missing clips
1994 m_renderWidget->missingClips(m_projectList->hasMissingClips());
1997 void MainWindow::setRenderingProgress(const QString &url, int progress)
2000 m_renderWidget->setRenderJob(url, progress);
2003 void MainWindow::setRenderingFinished(const QString &url, int status, const QString &error)
2006 m_renderWidget->setRenderStatus(url, status, error);
2009 void MainWindow::slotCleanProject()
2011 if (KMessageBox::warningContinueCancel(this, i18n("This will remove all unused clips from your project."), i18n("Clean up project")) == KMessageBox::Cancel) return;
2012 m_projectList->cleanup();
2015 void MainWindow::slotUpdateMousePosition(int pos)
2017 if (m_activeDocument)
2018 switch (m_timecodeFormat->currentIndex()) {
2020 statusBar()->changeItem(m_activeDocument->timecode().getTimecodeFromFrames(pos), ID_TIMELINE_POS);
2023 statusBar()->changeItem(QString::number(pos), ID_TIMELINE_POS);
2027 void MainWindow::slotUpdateDocumentState(bool modified)
2029 if (!m_activeDocument) return;
2030 setCaption(m_activeDocument->description(), modified);
2031 m_saveAction->setEnabled(modified);
2033 m_timelineArea->setTabTextColor(m_timelineArea->currentIndex(), palette().color(QPalette::Link));
2034 m_timelineArea->setTabIcon(m_timelineArea->currentIndex(), KIcon("document-save"));
2036 m_timelineArea->setTabTextColor(m_timelineArea->currentIndex(), palette().color(QPalette::Text));
2037 m_timelineArea->setTabIcon(m_timelineArea->currentIndex(), KIcon("kdenlive"));
2041 void MainWindow::connectDocumentInfo(KdenliveDoc *doc)
2043 if (m_activeDocument) {
2044 if (m_activeDocument == doc) return;
2045 disconnect(m_activeDocument, SIGNAL(progressInfo(const QString &, int)), this, SLOT(slotGotProgressInfo(const QString &, int)));
2047 connect(doc, SIGNAL(progressInfo(const QString &, int)), this, SLOT(slotGotProgressInfo(const QString &, int)));
2050 void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) //changed
2052 //m_projectMonitor->stop();
2053 m_closeAction->setEnabled(m_timelineArea->count() > 1);
2054 kDebug() << "/////////////////// CONNECTING DOC TO PROJECT VIEW ////////////////";
2055 if (m_activeDocument) {
2056 if (m_activeDocument == doc) return;
2057 if (m_activeTimeline) {
2058 disconnect(m_projectMonitor, SIGNAL(renderPosition(int)), m_activeTimeline, SLOT(moveCursorPos(int)));
2059 disconnect(m_projectMonitor, SIGNAL(zoneUpdated(QPoint)), m_activeTimeline, SLOT(slotSetZone(QPoint)));
2060 disconnect(m_projectMonitor, SIGNAL(durationChanged(int)), m_activeTimeline, SLOT(setDuration(int)));
2061 disconnect(m_projectMonitor, SIGNAL(zoneUpdated(QPoint)), m_activeDocument, SLOT(setModified()));
2062 disconnect(m_clipMonitor, SIGNAL(zoneUpdated(QPoint)), m_activeDocument, SLOT(setModified()));
2063 disconnect(m_projectList, SIGNAL(projectModified()), m_activeDocument, SLOT(setModified()));
2064 disconnect(m_projectMonitor->render, SIGNAL(refreshDocumentProducers()), m_activeDocument, SLOT(checkProjectClips()));
2066 disconnect(m_activeDocument, SIGNAL(guidesUpdated()), this, SLOT(slotGuidesUpdated()));
2067 disconnect(m_activeDocument, SIGNAL(addProjectClip(DocClipBase *, bool)), m_projectList, SLOT(slotAddClip(DocClipBase *, bool)));
2068 disconnect(m_activeDocument, SIGNAL(resetProjectList()), m_projectList, SLOT(slotResetProjectList()));
2069 disconnect(m_activeDocument, SIGNAL(signalDeleteProjectClip(const QString &)), m_projectList, SLOT(slotDeleteClip(const QString &)));
2070 disconnect(m_activeDocument, SIGNAL(updateClipDisplay(const QString &)), m_projectList, SLOT(slotUpdateClip(const QString &)));
2071 disconnect(m_activeDocument, SIGNAL(selectLastAddedClip(const QString &)), m_projectList, SLOT(slotSelectClip(const QString &)));
2072 disconnect(m_activeDocument, SIGNAL(deleteTimelineClip(const QString &)), m_activeTimeline, SLOT(slotDeleteClip(const QString &)));
2073 disconnect(m_activeTimeline->projectView(), SIGNAL(clipItemSelected(ClipItem*, int)), m_effectStack, SLOT(slotClipItemSelected(ClipItem*, int)));
2074 disconnect(m_activeTimeline->projectView(), SIGNAL(clipItemSelected(ClipItem*, int)), this, SLOT(slotActivateEffectStackView()));
2075 disconnect(m_activeTimeline->projectView(), SIGNAL(transitionItemSelected(Transition*, int, QPoint, bool)), m_transitionConfig, SLOT(slotTransitionItemSelected(Transition*, int, QPoint, bool)));
2076 disconnect(m_activeTimeline->projectView(), SIGNAL(transitionItemSelected(Transition*, int, QPoint, bool)), this, SLOT(slotActivateTransitionView(Transition *)));
2077 disconnect(m_activeTimeline->projectView(), SIGNAL(playMonitor()), m_projectMonitor, SLOT(slotPlay()));
2078 disconnect(m_activeTimeline->projectView(), SIGNAL(displayMessage(const QString&, MessageType)), m_messageLabel, SLOT(setMessage(const QString&, MessageType)));
2079 disconnect(m_activeTimeline->projectView(), SIGNAL(showClipFrame(DocClipBase *, QPoint, const int)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *, QPoint, const int)));
2080 disconnect(m_activeTimeline, SIGNAL(cursorMoved()), m_projectMonitor, SLOT(activateMonitor()));
2081 disconnect(m_activeTimeline, SIGNAL(insertTrack(int)), this, SLOT(slotInsertTrack(int)));
2082 disconnect(m_activeTimeline, SIGNAL(deleteTrack(int)), this, SLOT(slotDeleteTrack(int)));
2083 disconnect(m_activeTimeline, SIGNAL(configTrack(int)), this, SLOT(slotConfigTrack(int)));
2084 disconnect(m_activeDocument, SIGNAL(docModified(bool)), this, SLOT(slotUpdateDocumentState(bool)));
2085 disconnect(m_effectStack, SIGNAL(updateClipEffect(ClipItem*, QDomElement, QDomElement, int)), m_activeTimeline->projectView(), SLOT(slotUpdateClipEffect(ClipItem*, QDomElement, QDomElement, int)));
2086 disconnect(m_effectStack, SIGNAL(removeEffect(ClipItem*, QDomElement)), m_activeTimeline->projectView(), SLOT(slotDeleteEffect(ClipItem*, QDomElement)));
2087 disconnect(m_effectStack, SIGNAL(changeEffectState(ClipItem*, int, bool)), m_activeTimeline->projectView(), SLOT(slotChangeEffectState(ClipItem*, int, bool)));
2088 disconnect(m_effectStack, SIGNAL(changeEffectPosition(ClipItem*, int, int)), m_activeTimeline->projectView(), SLOT(slotChangeEffectPosition(ClipItem*, int, int)));
2089 disconnect(m_effectStack, SIGNAL(refreshEffectStack(ClipItem*)), m_activeTimeline->projectView(), SLOT(slotRefreshEffects(ClipItem*)));
2090 disconnect(m_effectStack, SIGNAL(reloadEffects()), this, SLOT(slotReloadEffects()));
2091 disconnect(m_transitionConfig, SIGNAL(transitionUpdated(Transition *, QDomElement)), m_activeTimeline->projectView() , SLOT(slotTransitionUpdated(Transition *, QDomElement)));
2092 disconnect(m_transitionConfig, SIGNAL(seekTimeline(int)), m_activeTimeline->projectView() , SLOT(setCursorPos(int)));
2093 disconnect(m_activeTimeline->projectView(), SIGNAL(activateDocumentMonitor()), m_projectMonitor, SLOT(activateMonitor()));
2094 disconnect(m_activeTimeline, SIGNAL(zoneMoved(int, int)), this, SLOT(slotZoneMoved(int, int)));
2095 disconnect(m_projectList, SIGNAL(loadingIsOver()), m_activeTimeline->projectView(), SLOT(slotUpdateAllThumbs()));
2096 disconnect(m_projectList, SIGNAL(displayMessage(const QString&, int)), this, SLOT(slotGotProgressInfo(const QString&, int)));
2097 disconnect(m_projectList, SIGNAL(updateRenderStatus()), this, SLOT(slotCheckRenderStatus()));
2098 disconnect(m_projectList, SIGNAL(clipNeedsReload(const QString&, bool)), m_activeTimeline->projectView(), SLOT(slotUpdateClip(const QString &, bool)));
2099 m_effectStack->clear();
2101 //m_activeDocument->setRenderer(NULL);
2102 disconnect(m_projectList, SIGNAL(clipSelected(DocClipBase *)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *)));
2103 disconnect(m_projectList, SIGNAL(refreshClip()), m_clipMonitor, SLOT(refreshMonitor()));
2104 m_clipMonitor->stop();
2106 KdenliveSettings::setCurrent_profile(doc->profilePath());
2107 KdenliveSettings::setProject_fps(doc->fps());
2108 m_monitorManager->resetProfiles(doc->timecode());
2109 m_projectList->setDocument(doc);
2110 m_transitionConfig->updateProjectFormat(doc->mltProfile(), doc->timecode(), doc->tracksList());
2111 m_effectStack->updateProjectFormat(doc->mltProfile(), doc->timecode());
2112 connect(m_projectList, SIGNAL(clipSelected(DocClipBase *, QPoint)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *, QPoint)));
2113 connect(m_projectList, SIGNAL(refreshClip()), m_clipMonitor, SLOT(refreshMonitor()));
2114 connect(m_projectList, SIGNAL(clipNeedsReload(const QString&, bool)), trackView->projectView(), SLOT(slotUpdateClip(const QString &, bool)));
2116 connect(m_projectList, SIGNAL(projectModified()), doc, SLOT(setModified()));
2117 connect(m_projectList, SIGNAL(clipNameChanged(const QString, const QString)), trackView->projectView(), SLOT(clipNameChanged(const QString, const QString)));
2119 connect(m_projectList, SIGNAL(findInTimeline(const QString&)), this, SLOT(slotClipInTimeline(const QString&)));
2122 connect(trackView, SIGNAL(cursorMoved()), m_projectMonitor, SLOT(activateMonitor()));
2123 connect(trackView, SIGNAL(insertTrack(int)), this, SLOT(slotInsertTrack(int)));
2124 connect(trackView, SIGNAL(deleteTrack(int)), this, SLOT(slotDeleteTrack(int)));
2125 connect(trackView, SIGNAL(configTrack(int)), this, SLOT(slotConfigTrack(int)));
2126 connect(trackView, SIGNAL(updateTracksInfo()), this, SLOT(slotUpdateTrackInfo()));
2127 connect(trackView, SIGNAL(mousePosition(int)), this, SLOT(slotUpdateMousePosition(int)));
2128 connect(m_projectMonitor, SIGNAL(renderPosition(int)), trackView, SLOT(moveCursorPos(int)));
2129 connect(m_projectMonitor, SIGNAL(zoneUpdated(QPoint)), trackView, SLOT(slotSetZone(QPoint)));
2130 connect(m_clipMonitor, SIGNAL(zoneUpdated(QPoint)), m_projectList, SLOT(slotUpdateClipCut(QPoint)));
2131 connect(m_projectMonitor, SIGNAL(zoneUpdated(QPoint)), doc, SLOT(setModified()));
2132 connect(m_clipMonitor, SIGNAL(zoneUpdated(QPoint)), doc, SLOT(setModified()));
2133 connect(m_projectMonitor, SIGNAL(durationChanged(int)), trackView, SLOT(setDuration(int)));
2134 connect(m_projectMonitor->render, SIGNAL(refreshDocumentProducers()), doc, SLOT(checkProjectClips()));
2136 connect(doc, SIGNAL(addProjectClip(DocClipBase *, bool)), m_projectList, SLOT(slotAddClip(DocClipBase *, bool)));
2137 connect(doc, SIGNAL(resetProjectList()), m_projectList, SLOT(slotResetProjectList()));
2138 connect(doc, SIGNAL(signalDeleteProjectClip(const QString &)), m_projectList, SLOT(slotDeleteClip(const QString &)));
2139 connect(doc, SIGNAL(updateClipDisplay(const QString &)), m_projectList, SLOT(slotUpdateClip(const QString &)));
2140 connect(doc, SIGNAL(selectLastAddedClip(const QString &)), m_projectList, SLOT(slotSelectClip(const QString &)));
2142 connect(doc, SIGNAL(deleteTimelineClip(const QString &)), trackView, SLOT(slotDeleteClip(const QString &)));
2143 connect(doc, SIGNAL(docModified(bool)), this, SLOT(slotUpdateDocumentState(bool)));
2144 connect(doc, SIGNAL(guidesUpdated()), this, SLOT(slotGuidesUpdated()));
2147 connect(trackView->projectView(), SIGNAL(clipItemSelected(ClipItem*, int)), m_effectStack, SLOT(slotClipItemSelected(ClipItem*, int)));
2148 connect(trackView->projectView(), SIGNAL(updateClipMarkers(DocClipBase *)), this, SLOT(slotUpdateClipMarkers(DocClipBase*)));
2150 connect(trackView->projectView(), SIGNAL(clipItemSelected(ClipItem*, int)), this, SLOT(slotActivateEffectStackView()));
2151 connect(trackView->projectView(), SIGNAL(transitionItemSelected(Transition*, int, QPoint, bool)), m_transitionConfig, SLOT(slotTransitionItemSelected(Transition*, int, QPoint, bool)));
2152 connect(trackView->projectView(), SIGNAL(transitionItemSelected(Transition*, int, QPoint, bool)), this, SLOT(slotActivateTransitionView(Transition *)));
2153 m_zoomSlider->setValue(doc->zoom().x());
2154 connect(trackView->projectView(), SIGNAL(zoomIn()), this, SLOT(slotZoomIn()));
2155 connect(trackView->projectView(), SIGNAL(zoomOut()), this, SLOT(slotZoomOut()));
2156 connect(trackView, SIGNAL(setZoom(int)), this, SLOT(slotSetZoom(int)));
2157 connect(trackView->projectView(), SIGNAL(displayMessage(const QString&, MessageType)), m_messageLabel, SLOT(setMessage(const QString&, MessageType)));
2159 connect(trackView->projectView(), SIGNAL(showClipFrame(DocClipBase *, QPoint, const int)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *, QPoint, const int)));
2160 connect(trackView->projectView(), SIGNAL(playMonitor()), m_projectMonitor, SLOT(slotPlay()));
2163 connect(m_effectStack, SIGNAL(updateClipEffect(ClipItem*, QDomElement, QDomElement, int)), trackView->projectView(), SLOT(slotUpdateClipEffect(ClipItem*, QDomElement, QDomElement, int)));
2164 connect(m_effectStack, SIGNAL(updateClipRegion(ClipItem*, int, QString)), trackView->projectView(), SLOT(slotUpdateClipRegion(ClipItem*, int, QString)));
2165 connect(m_effectStack, SIGNAL(removeEffect(ClipItem*, QDomElement)), trackView->projectView(), SLOT(slotDeleteEffect(ClipItem*, QDomElement)));
2166 connect(m_effectStack, SIGNAL(changeEffectState(ClipItem*, int, bool)), trackView->projectView(), SLOT(slotChangeEffectState(ClipItem*, int, bool)));
2167 connect(m_effectStack, SIGNAL(changeEffectPosition(ClipItem*, int, int)), trackView->projectView(), SLOT(slotChangeEffectPosition(ClipItem*, int, int)));
2168 connect(m_effectStack, SIGNAL(refreshEffectStack(ClipItem*)), trackView->projectView(), SLOT(slotRefreshEffects(ClipItem*)));
2169 connect(m_transitionConfig, SIGNAL(transitionUpdated(Transition *, QDomElement)), trackView->projectView() , SLOT(slotTransitionUpdated(Transition *, QDomElement)));
2170 connect(m_transitionConfig, SIGNAL(seekTimeline(int)), trackView->projectView() , SLOT(setCursorPos(int)));
2171 connect(m_effectStack, SIGNAL(seekTimeline(int)), trackView->projectView() , SLOT(setCursorPos(int)));
2172 connect(m_effectStack, SIGNAL(reloadEffects()), this, SLOT(slotReloadEffects()));
2174 connect(trackView->projectView(), SIGNAL(activateDocumentMonitor()), m_projectMonitor, SLOT(activateMonitor()));
2175 connect(trackView, SIGNAL(zoneMoved(int, int)), this, SLOT(slotZoneMoved(int, int)));
2176 connect(m_projectList, SIGNAL(loadingIsOver()), trackView->projectView(), SLOT(slotUpdateAllThumbs()));
2177 connect(m_projectList, SIGNAL(displayMessage(const QString&, int)), this, SLOT(slotGotProgressInfo(const QString&, int)));
2178 connect(m_projectList, SIGNAL(updateRenderStatus()), this, SLOT(slotCheckRenderStatus()));
2181 trackView->projectView()->setContextMenu(m_timelineContextMenu, m_timelineContextClipMenu, m_timelineContextTransitionMenu, m_clipTypeGroup, (QMenu*)(factory()->container("marker_menu", this)));
2182 m_activeTimeline = trackView;
2183 if (m_renderWidget) {
2184 slotCheckRenderStatus();
2185 m_renderWidget->setProfile(doc->mltProfile());
2186 m_renderWidget->setGuides(doc->guidesXml(), doc->projectDuration());
2187 m_renderWidget->setDocumentPath(doc->projectFolder().path(KUrl::AddTrailingSlash));
2188 m_renderWidget->setRenderProfile(doc->getDocumentProperty("renderdestination"), doc->getDocumentProperty("rendercategory"), doc->getDocumentProperty("renderprofile"), doc->getDocumentProperty("renderurl"));
2190 //doc->setRenderer(m_projectMonitor->render);
2191 m_commandStack->setActiveStack(doc->commandStack());
2192 KdenliveSettings::setProject_display_ratio(doc->dar());
2193 //doc->clipManager()->checkAudioThumbs();
2195 //m_overView->setScene(trackView->projectScene());
2196 //m_overView->scale(m_overView->width() / trackView->duration(), m_overView->height() / (50 * trackView->tracksNumber()));
2197 //m_overView->fitInView(m_overView->itemAt(0, 50), Qt::KeepAspectRatio);
2199 setCaption(doc->description(), doc->isModified());
2200 m_saveAction->setEnabled(doc->isModified());
2201 m_normalEditTool->setChecked(true);
2202 m_activeDocument = doc;
2203 m_activeTimeline->updateProjectFps();
2204 m_activeDocument->checkProjectClips();
2205 if (KdenliveSettings::dropbframes()) slotUpdatePreviewSettings();
2206 //Update the mouse position display so it will display in DF/NDF format by default based on the project setting.
2207 slotUpdateMousePosition(0);
2208 // set tool to select tool
2209 m_buttonSelectTool->setChecked(true);
2212 void MainWindow::slotZoneMoved(int start, int end)
2214 m_activeDocument->setZone(start, end);
2215 m_projectMonitor->slotZoneMoved(start, end);
2218 void MainWindow::slotGuidesUpdated()
2221 m_renderWidget->setGuides(m_activeDocument->guidesXml(), m_activeDocument->projectDuration());
2224 void MainWindow::slotEditKeys()
2226 KShortcutsDialog dialog(KShortcutsEditor::AllActions, KShortcutsEditor::LetterShortcutsAllowed, this);
2227 dialog.addCollection(actionCollection(), i18nc("general keyboard shortcuts", "General"));
2228 dialog.addCollection(m_effectsActionCollection, i18nc("effects and transitions keyboard shortcuts", "Effects & Transitions"));
2232 void MainWindow::slotPreferences(int page, int option)
2234 //An instance of your dialog could be already created and could be
2235 // cached, in which case you want to display the cached dialog
2236 // instead of creating another one
2237 if (KConfigDialog::showDialog("settings")) {
2238 KdenliveSettingsDialog* d = static_cast <KdenliveSettingsDialog*>(KConfigDialog::exists("settings"));
2239 if (page != -1) d->showPage(page, option);
2243 // KConfigDialog didn't find an instance of this dialog, so lets
2245 KdenliveSettingsDialog* dialog = new KdenliveSettingsDialog(this);
2246 connect(dialog, SIGNAL(settingsChanged(const QString&)), this, SLOT(updateConfiguration()));
2247 //connect(dialog, SIGNAL(doResetProfile()), this, SLOT(slotDetectAudioDriver()));
2248 connect(dialog, SIGNAL(doResetProfile()), m_monitorManager, SLOT(slotResetProfiles()));
2249 connect(dialog, SIGNAL(updatePreviewSettings()), this, SLOT(slotUpdatePreviewSettings()));
2251 connect(dialog, SIGNAL(updateCaptureFolder()), m_recMonitor, SLOT(slotUpdateCaptureFolder()));
2253 //connect(dialog, SIGNAL(updatePreviewSettings()), this, SLOT(slotUpdatePreviewSettings()));
2255 if (page != -1) dialog->showPage(page, option);
2258 void MainWindow::slotUpdatePreviewSettings()
2260 if (m_activeDocument) {
2261 m_clipMonitor->slotSetXml(NULL);
2262 m_activeDocument->updatePreviewSettings();
2266 void MainWindow::updateConfiguration()
2268 //TODO: we should apply settings to all projects, not only the current one
2269 if (m_activeTimeline) {
2270 m_activeTimeline->refresh();
2271 m_activeTimeline->projectView()->checkAutoScroll();
2272 m_activeTimeline->projectView()->checkTrackHeight();
2273 if (m_activeDocument)
2274 m_activeDocument->clipManager()->checkAudioThumbs();
2276 m_buttonAudioThumbs->setChecked(KdenliveSettings::audiothumbnails());
2277 m_buttonVideoThumbs->setChecked(KdenliveSettings::videothumbnails());
2278 m_buttonAutomaticSplitAudio->setChecked(KdenliveSettings::splitaudio());
2280 // Update list of transcoding profiles
2282 #ifndef NO_JOGSHUTTLE
2283 activateShuttleDevice();
2284 #endif /* NO_JOGSHUTTLE */
2288 void MainWindow::slotSwitchSplitAudio()
2290 KdenliveSettings::setSplitaudio(!KdenliveSettings::splitaudio());
2291 m_buttonAutomaticSplitAudio->setChecked(KdenliveSettings::splitaudio());
2294 void MainWindow::slotSwitchVideoThumbs()
2296 KdenliveSettings::setVideothumbnails(!KdenliveSettings::videothumbnails());
2297 if (m_activeTimeline)
2298 m_activeTimeline->projectView()->slotUpdateAllThumbs();
2299 m_buttonVideoThumbs->setChecked(KdenliveSettings::videothumbnails());
2302 void MainWindow::slotSwitchAudioThumbs()
2304 KdenliveSettings::setAudiothumbnails(!KdenliveSettings::audiothumbnails());
2305 if (m_activeTimeline) {
2306 m_activeTimeline->refresh();
2307 m_activeTimeline->projectView()->checkAutoScroll();
2308 if (m_activeDocument)
2309 m_activeDocument->clipManager()->checkAudioThumbs();
2311 m_buttonAudioThumbs->setChecked(KdenliveSettings::audiothumbnails());
2314 void MainWindow::slotSwitchMarkersComments()
2316 KdenliveSettings::setShowmarkers(!KdenliveSettings::showmarkers());
2317 if (m_activeTimeline)
2318 m_activeTimeline->refresh();
2319 m_buttonShowMarkers->setChecked(KdenliveSettings::showmarkers());
2322 void MainWindow::slotSwitchSnap()
2324 KdenliveSettings::setSnaptopoints(!KdenliveSettings::snaptopoints());
2325 m_buttonSnap->setChecked(KdenliveSettings::snaptopoints());
2329 void MainWindow::slotDeleteItem()
2331 if (QApplication::focusWidget() &&
2332 QApplication::focusWidget()->parentWidget() &&
2333 QApplication::focusWidget()->parentWidget()->parentWidget() &&
2334 QApplication::focusWidget()->parentWidget()->parentWidget() == m_projectListDock) {
2335 m_projectList->slotRemoveClip();
2338 QWidget *widget = QApplication::focusWidget();
2340 if (widget == m_effectStackDock) {
2341 m_effectStack->slotItemDel();
2344 widget = widget->parentWidget();
2347 // effect stack has no focus
2348 if (m_activeTimeline)
2349 m_activeTimeline->projectView()->deleteSelectedClips();
2353 void MainWindow::slotUpdateClipMarkers(DocClipBase *clip)
2355 if (m_clipMonitor->isActive())
2356 m_clipMonitor->checkOverlay();
2357 m_clipMonitor->updateMarkers(clip);
2360 void MainWindow::slotAddClipMarker()
2362 DocClipBase *clip = NULL;
2364 if (m_projectMonitor->isActive()) {
2365 if (m_activeTimeline) {
2366 ClipItem *item = m_activeTimeline->projectView()->getActiveClipUnderCursor();
2368 pos = GenTime((int)((m_projectMonitor->position() - item->startPos() + item->cropStart()).frames(m_activeDocument->fps()) * item->speed() + 0.5), m_activeDocument->fps());
2369 clip = item->baseClip();
2373 clip = m_clipMonitor->activeClip();
2374 pos = m_clipMonitor->position();
2377 m_messageLabel->setMessage(i18n("Cannot find clip to add marker"), ErrorMessage);
2380 QString id = clip->getId();
2381 CommentedTime marker(pos, i18n("Marker"));
2382 MarkerDialog d(clip, marker, m_activeDocument->timecode(), i18n("Add Marker"), this);
2383 if (d.exec() == QDialog::Accepted)
2384 m_activeTimeline->projectView()->slotAddClipMarker(id, d.newMarker().time(), d.newMarker().comment());
2387 void MainWindow::slotDeleteClipMarker()
2389 DocClipBase *clip = NULL;
2391 if (m_projectMonitor->isActive()) {
2392 if (m_activeTimeline) {
2393 ClipItem *item = m_activeTimeline->projectView()->getActiveClipUnderCursor();
2395 pos = (m_projectMonitor->position() - item->startPos() + item->cropStart()) / item->speed();
2396 clip = item->baseClip();
2400 clip = m_clipMonitor->activeClip();
2401 pos = m_clipMonitor->position();
2404 m_messageLabel->setMessage(i18n("Cannot find clip to remove marker"), ErrorMessage);
2408 QString id = clip->getId();
2409 QString comment = clip->markerComment(pos);
2410 if (comment.isEmpty()) {
2411 m_messageLabel->setMessage(i18n("No marker found at cursor time"), ErrorMessage);
2414 m_activeTimeline->projectView()->slotDeleteClipMarker(comment, id, pos);
2417 void MainWindow::slotDeleteAllClipMarkers()
2419 DocClipBase *clip = NULL;
2420 if (m_projectMonitor->isActive()) {
2421 if (m_activeTimeline) {
2422 ClipItem *item = m_activeTimeline->projectView()->getActiveClipUnderCursor();
2424 clip = item->baseClip();
2428 clip = m_clipMonitor->activeClip();
2431 m_messageLabel->setMessage(i18n("Cannot find clip to remove marker"), ErrorMessage);
2434 m_activeTimeline->projectView()->slotDeleteAllClipMarkers(clip->getId());
2437 void MainWindow::slotEditClipMarker()
2439 DocClipBase *clip = NULL;
2441 if (m_projectMonitor->isActive()) {
2442 if (m_activeTimeline) {
2443 ClipItem *item = m_activeTimeline->projectView()->getActiveClipUnderCursor();
2445 pos = (m_projectMonitor->position() - item->startPos() + item->cropStart()) / item->speed();
2446 clip = item->baseClip();
2450 clip = m_clipMonitor->activeClip();
2451 pos = m_clipMonitor->position();
2454 m_messageLabel->setMessage(i18n("Cannot find clip to remove marker"), ErrorMessage);
2458 QString id = clip->getId();
2459 QString oldcomment = clip->markerComment(pos);
2460 if (oldcomment.isEmpty()) {
2461 m_messageLabel->setMessage(i18n("No marker found at cursor time"), ErrorMessage);
2465 CommentedTime marker(pos, oldcomment);
2466 MarkerDialog d(clip, marker, m_activeDocument->timecode(), i18n("Edit Marker"), this);
2467 if (d.exec() == QDialog::Accepted) {
2468 m_activeTimeline->projectView()->slotAddClipMarker(id, d.newMarker().time(), d.newMarker().comment());
2469 if (d.newMarker().time() != pos) {
2470 // remove old marker
2471 m_activeTimeline->projectView()->slotAddClipMarker(id, pos, QString());
2476 void MainWindow::slotAddGuide()
2478 if (m_activeTimeline)
2479 m_activeTimeline->projectView()->slotAddGuide();
2482 void MainWindow::slotInsertSpace()
2484 if (m_activeTimeline)
2485 m_activeTimeline->projectView()->slotInsertSpace();
2488 void MainWindow::slotRemoveSpace()
2490 if (m_activeTimeline)
2491 m_activeTimeline->projectView()->slotRemoveSpace();
2494 void MainWindow::slotInsertTrack(int ix)
2496 m_projectMonitor->activateMonitor();
2497 if (m_activeTimeline)
2498 m_activeTimeline->projectView()->slotInsertTrack(ix);
2499 if (m_activeDocument)
2500 m_transitionConfig->updateProjectFormat(m_activeDocument->mltProfile(), m_activeDocument->timecode(), m_activeDocument->tracksList());
2503 void MainWindow::slotDeleteTrack(int ix)
2505 m_projectMonitor->activateMonitor();
2506 if (m_activeTimeline)
2507 m_activeTimeline->projectView()->slotDeleteTrack(ix);
2508 if (m_activeDocument)
2509 m_transitionConfig->updateProjectFormat(m_activeDocument->mltProfile(), m_activeDocument->timecode(), m_activeDocument->tracksList());
2512 void MainWindow::slotConfigTrack(int ix)
2514 m_projectMonitor->activateMonitor();
2515 if (m_activeTimeline)
2516 m_activeTimeline->projectView()->slotConfigTracks(ix);
2517 if (m_activeDocument)
2518 m_transitionConfig->updateProjectFormat(m_activeDocument->mltProfile(), m_activeDocument->timecode(), m_activeDocument->tracksList());
2521 void MainWindow::slotEditGuide()
2523 if (m_activeTimeline)
2524 m_activeTimeline->projectView()->slotEditGuide();
2527 void MainWindow::slotDeleteGuide()
2529 if (m_activeTimeline)
2530 m_activeTimeline->projectView()->slotDeleteGuide();
2533 void MainWindow::slotDeleteAllGuides()
2535 if (m_activeTimeline)
2536 m_activeTimeline->projectView()->slotDeleteAllGuides();
2539 void MainWindow::slotCutTimelineClip()
2541 if (m_activeTimeline)
2542 m_activeTimeline->projectView()->cutSelectedClips();
2545 void MainWindow::slotInsertClipOverwrite()
2547 if (m_activeTimeline) {
2548 QStringList data = m_clipMonitor->getZoneInfo();
2549 m_activeTimeline->projectView()->insertZoneOverwrite(data, m_activeTimeline->inPoint());
2553 void MainWindow::slotSelectTimelineClip()
2555 if (m_activeTimeline)
2556 m_activeTimeline->projectView()->selectClip(true);
2559 void MainWindow::slotSelectTimelineTransition()
2561 if (m_activeTimeline)
2562 m_activeTimeline->projectView()->selectTransition(true);
2565 void MainWindow::slotDeselectTimelineClip()
2567 if (m_activeTimeline)
2568 m_activeTimeline->projectView()->selectClip(false, true);
2571 void MainWindow::slotDeselectTimelineTransition()
2573 if (m_activeTimeline)
2574 m_activeTimeline->projectView()->selectTransition(false, true);
2577 void MainWindow::slotSelectAddTimelineClip()
2579 if (m_activeTimeline)
2580 m_activeTimeline->projectView()->selectClip(true, true);
2583 void MainWindow::slotSelectAddTimelineTransition()
2585 if (m_activeTimeline)
2586 m_activeTimeline->projectView()->selectTransition(true, true);
2589 void MainWindow::slotGroupClips()
2591 if (m_activeTimeline)
2592 m_activeTimeline->projectView()->groupClips();
2595 void MainWindow::slotUnGroupClips()
2597 if (m_activeTimeline)
2598 m_activeTimeline->projectView()->groupClips(false);
2601 void MainWindow::slotEditItemDuration()
2603 if (m_activeTimeline)
2604 m_activeTimeline->projectView()->editItemDuration();
2607 void MainWindow::slotAddProjectClip(KUrl url)
2609 if (m_activeDocument)
2610 m_activeDocument->slotAddClipFile(url, QString());
2613 void MainWindow::slotAddTransition(QAction *result)
2615 if (!result) return;
2616 QStringList info = result->data().toStringList();
2617 if (info.isEmpty()) return;
2618 QDomElement transition = transitions.getEffectByTag(info.at(1), info.at(2));
2619 if (m_activeTimeline && !transition.isNull()) {
2620 m_activeTimeline->projectView()->slotAddTransitionToSelectedClips(transition.cloneNode().toElement());
2624 void MainWindow::slotAddVideoEffect(QAction *result)
2626 if (!result) return;
2627 QStringList info = result->data().toStringList();
2628 if (info.isEmpty()) return;
2629 QDomElement effect = videoEffects.getEffectByTag(info.at(1), info.at(2));
2630 slotAddEffect(effect);
2633 void MainWindow::slotAddAudioEffect(QAction *result)
2635 if (!result) return;
2636 QStringList info = result->data().toStringList();
2637 if (info.isEmpty()) return;
2638 QDomElement effect = audioEffects.getEffectByTag(info.at(1), info.at(2));
2639 slotAddEffect(effect);
2642 void MainWindow::slotAddCustomEffect(QAction *result)
2644 if (!result) return;
2645 QStringList info = result->data().toStringList();
2646 if (info.isEmpty()) return;
2647 QDomElement effect = customEffects.getEffectByTag(info.at(1), info.at(2));
2648 slotAddEffect(effect);
2651 void MainWindow::slotZoomIn()
2653 m_zoomSlider->setValue(m_zoomSlider->value() - 1);
2654 slotShowZoomSliderToolTip();
2657 void MainWindow::slotZoomOut()
2659 m_zoomSlider->setValue(m_zoomSlider->value() + 1);
2660 slotShowZoomSliderToolTip();
2663 void MainWindow::slotFitZoom()
2665 if (m_activeTimeline)
2666 m_zoomSlider->setValue(m_activeTimeline->fitZoom());
2669 void MainWindow::slotSetZoom(int value)
2671 if (m_activeTimeline)
2672 m_activeTimeline->slotChangeZoom(value);
2674 m_zoomOut->setEnabled(value < m_zoomSlider->maximum());
2675 m_zoomIn->setEnabled(value > m_zoomSlider->minimum());
2676 slotUpdateZoomSliderToolTip(value);
2678 m_zoomSlider->blockSignals(true);
2679 m_zoomSlider->setValue(value);
2680 m_zoomSlider->blockSignals(false);
2683 void MainWindow::slotShowZoomSliderToolTip(int zoomlevel)
2685 if (zoomlevel != -1)
2686 slotUpdateZoomSliderToolTip(zoomlevel);
2688 QPoint global = m_zoomSlider->rect().topLeft();
2689 global.ry() += m_zoomSlider->height() / 2;
2690 QHelpEvent toolTipEvent(QEvent::ToolTip, QPoint(0, 0), m_zoomSlider->mapToGlobal(global));
2691 QApplication::sendEvent(m_zoomSlider, &toolTipEvent);
2694 void MainWindow::slotUpdateZoomSliderToolTip(int zoomlevel)
2696 m_zoomSlider->setToolTip(i18n("Zoom Level: %1/13", (13 - zoomlevel)));
2699 void MainWindow::slotGotProgressInfo(const QString &message, int progress)
2701 m_statusProgressBar->setValue(progress);
2702 if (progress >= 0) {
2703 if (!message.isEmpty())
2704 m_messageLabel->setMessage(message, InformationMessage);//statusLabel->setText(message);
2705 m_statusProgressBar->setVisible(true);
2706 } else if (progress == -2) {
2707 if (!message.isEmpty())
2708 m_messageLabel->setMessage(message, ErrorMessage);
2709 m_statusProgressBar->setVisible(false);
2711 m_messageLabel->setMessage(QString(), DefaultMessage);
2712 m_statusProgressBar->setVisible(false);
2716 void MainWindow::slotShowClipProperties(DocClipBase *clip)
2718 if (clip->clipType() == TEXT) {
2719 QString titlepath = m_activeDocument->projectFolder().path(KUrl::AddTrailingSlash) + "titles/";
2720 if (!clip->getProperty("resource").isEmpty() && clip->getProperty("xmldata").isEmpty()) {
2721 // template text clip
2723 // Get the list of existing templates
2725 filter << "*.kdenlivetitle";
2726 QStringList templateFiles = QDir(titlepath).entryList(filter, QDir::Files);
2728 QDialog *dia = new QDialog(this);
2729 Ui::TemplateClip_UI dia_ui;
2730 dia_ui.setupUi(dia);
2732 const QString templatePath = clip->getProperty("resource");
2733 for (int i = 0; i < templateFiles.size(); ++i) {
2734 dia_ui.template_list->comboBox()->addItem(templateFiles.at(i), titlepath + templateFiles.at(i));
2735 if (templatePath == KUrl(titlepath + templateFiles.at(i)).path()) ix = i;
2737 if (ix != -1) dia_ui.template_list->comboBox()->setCurrentIndex(ix);
2738 else dia_ui.template_list->comboBox()->insertItem(0, templatePath);
2739 dia_ui.template_list->fileDialog()->setFilter("*.kdenlivetitle");
2740 //warning: setting base directory doesn't work??
2741 KUrl startDir(titlepath);
2742 dia_ui.template_list->fileDialog()->setUrl(startDir);
2743 dia_ui.description->setText(clip->getProperty("description"));
2744 if (dia->exec() == QDialog::Accepted) {
2745 QString textTemplate = dia_ui.template_list->comboBox()->itemData(dia_ui.template_list->comboBox()->currentIndex()).toString();
2746 if (textTemplate.isEmpty()) textTemplate = dia_ui.template_list->comboBox()->currentText();
2748 QMap <QString, QString> newprops;
2750 if (KUrl(textTemplate).path() != templatePath) {
2751 // The template was changed
2752 newprops.insert("resource", textTemplate);
2755 if (dia_ui.description->toPlainText() != clip->getProperty("description")) {
2756 newprops.insert("description", dia_ui.description->toPlainText());
2759 QString newtemplate = newprops.value("xmltemplate");
2760 if (newtemplate.isEmpty()) newtemplate = templatePath;
2762 // template modified we need to update xmldata
2763 QString description = newprops.value("description");
2764 if (description.isEmpty()) description = clip->getProperty("description");
2765 else newprops.insert("templatetext", description);
2766 //newprops.insert("xmldata", m_projectList->generateTemplateXml(newtemplate, description).toString());
2767 if (!newprops.isEmpty()) {
2768 EditClipCommand *command = new EditClipCommand(m_projectList, clip->getId(), clip->properties(), newprops, true);
2769 m_activeDocument->commandStack()->push(command);
2775 QString path = clip->getProperty("resource");
2776 TitleWidget *dia_ui = new TitleWidget(KUrl(), m_activeDocument->timecode(), titlepath, m_projectMonitor->render, this);
2778 doc.setContent(clip->getProperty("xmldata"));
2779 dia_ui->setXml(doc);
2780 if (dia_ui->exec() == QDialog::Accepted) {
2781 QMap <QString, QString> newprops;
2782 newprops.insert("xmldata", dia_ui->xml().toString());
2783 if (dia_ui->outPoint() != clip->duration().frames(m_activeDocument->fps()) - 1) {
2784 // duration changed, we need to update duration
2785 newprops.insert("out", QString::number(dia_ui->outPoint()));
2787 EditClipCommand *command = new EditClipCommand(m_projectList, clip->getId(), clip->properties(), newprops, true);
2788 m_activeDocument->commandStack()->push(command);
2789 //m_activeTimeline->projectView()->slotUpdateClip(clip->getId());
2790 m_activeDocument->setModified(true);
2794 //m_activeDocument->editTextClip(clip->getProperty("xml"), clip->getId());
2797 ClipProperties dia(clip, m_activeDocument->timecode(), m_activeDocument->fps(), this);
2798 connect(&dia, SIGNAL(addMarker(const QString &, GenTime, QString)), m_activeTimeline->projectView(), SLOT(slotAddClipMarker(const QString &, GenTime, QString)));
2799 if (dia.exec() == QDialog::Accepted) {
2800 QMap <QString, QString> newprops = dia.properties();
2801 if (newprops.isEmpty()) return;
2802 EditClipCommand *command = new EditClipCommand(m_projectList, clip->getId(), clip->properties(), newprops, true);
2803 m_activeDocument->commandStack()->push(command);
2805 if (dia.needsTimelineRefresh()) {
2806 // update clip occurences in timeline
2807 m_activeTimeline->projectView()->slotUpdateClip(clip->getId(), dia.needsTimelineReload());
2813 void MainWindow::slotShowClipProperties(QList <DocClipBase *> cliplist, QMap<QString, QString> commonproperties)
2815 ClipProperties dia(cliplist, m_activeDocument->timecode(), commonproperties, this);
2816 if (dia.exec() == QDialog::Accepted) {
2817 QUndoCommand *command = new QUndoCommand();
2818 command->setText(i18n("Edit clips"));
2819 for (int i = 0; i < cliplist.count(); i++) {
2820 DocClipBase *clip = cliplist.at(i);
2821 new EditClipCommand(m_projectList, clip->getId(), clip->properties(), dia.properties(), true, command);
2823 m_activeDocument->commandStack()->push(command);
2824 for (int i = 0; i < cliplist.count(); i++)
2825 m_activeTimeline->projectView()->slotUpdateClip(cliplist.at(i)->getId(), dia.needsTimelineReload());
2829 void MainWindow::customEvent(QEvent* e)
2831 if (e->type() == QEvent::User)
2832 m_messageLabel->setMessage(static_cast <MltErrorEvent *>(e)->message(), MltError);
2834 void MainWindow::slotActivateEffectStackView()
2836 m_effectStack->raiseWindow(m_effectStackDock);
2839 void MainWindow::slotActivateTransitionView(Transition *t)
2842 m_transitionConfig->raiseWindow(m_transitionConfigDock);
2845 void MainWindow::slotSnapRewind()
2847 if (m_projectMonitor->isActive()) {
2848 if (m_activeTimeline)
2849 m_activeTimeline->projectView()->slotSeekToPreviousSnap();
2851 m_clipMonitor->slotSeekToPreviousSnap();
2855 void MainWindow::slotSnapForward()
2857 if (m_projectMonitor->isActive()) {
2858 if (m_activeTimeline)
2859 m_activeTimeline->projectView()->slotSeekToNextSnap();
2861 m_clipMonitor->slotSeekToNextSnap();
2865 void MainWindow::slotClipStart()
2867 if (m_projectMonitor->isActive()) {
2868 if (m_activeTimeline)
2869 m_activeTimeline->projectView()->clipStart();
2873 void MainWindow::slotClipEnd()
2875 if (m_projectMonitor->isActive()) {
2876 if (m_activeTimeline)
2877 m_activeTimeline->projectView()->clipEnd();
2881 void MainWindow::slotZoneStart()
2883 if (m_projectMonitor->isActive())
2884 m_projectMonitor->slotZoneStart();
2886 m_clipMonitor->slotZoneStart();
2889 void MainWindow::slotZoneEnd()
2891 if (m_projectMonitor->isActive())
2892 m_projectMonitor->slotZoneEnd();
2894 m_clipMonitor->slotZoneEnd();
2897 void MainWindow::slotChangeTool(QAction * action)
2899 if (action == m_buttonSelectTool)
2900 slotSetTool(SELECTTOOL);
2901 else if (action == m_buttonRazorTool)
2902 slotSetTool(RAZORTOOL);
2903 else if (action == m_buttonSpacerTool)
2904 slotSetTool(SPACERTOOL);
2907 void MainWindow::slotChangeEdit(QAction * action)
2909 if (!m_activeTimeline)
2912 if (action == m_overwriteEditTool)
2913 m_activeTimeline->projectView()->setEditMode(OVERWRITEEDIT);
2914 else if (action == m_insertEditTool)
2915 m_activeTimeline->projectView()->setEditMode(INSERTEDIT);
2917 m_activeTimeline->projectView()->setEditMode(NORMALEDIT);
2920 void MainWindow::slotSetTool(PROJECTTOOL tool)
2922 if (m_activeDocument && m_activeTimeline) {
2923 //m_activeDocument->setTool(tool);
2927 message = i18n("Ctrl + click to use spacer on current track only");
2930 message = i18n("Click on a clip to cut it");
2933 message = i18n("Shift + click to create a selection rectangle, Ctrl + click to add an item to selection");
2936 m_messageLabel->setMessage(message, InformationMessage);
2937 m_activeTimeline->projectView()->setTool(tool);
2941 void MainWindow::slotCopy()
2943 if (m_activeDocument && m_activeTimeline)
2944 m_activeTimeline->projectView()->copyClip();
2947 void MainWindow::slotPaste()
2949 if (m_activeDocument && m_activeTimeline)
2950 m_activeTimeline->projectView()->pasteClip();
2953 void MainWindow::slotPasteEffects()
2955 if (m_activeDocument && m_activeTimeline)
2956 m_activeTimeline->projectView()->pasteClipEffects();
2959 void MainWindow::slotFind()
2961 if (!m_activeDocument || !m_activeTimeline) return;
2962 m_projectSearch->setEnabled(false);
2963 m_findActivated = true;
2964 m_findString.clear();
2965 m_activeTimeline->projectView()->initSearchStrings();
2966 statusBar()->showMessage(i18n("Starting -- find text as you type"));
2967 m_findTimer.start(5000);
2968 qApp->installEventFilter(this);
2971 void MainWindow::slotFindNext()
2973 if (m_activeTimeline && m_activeTimeline->projectView()->findNextString(m_findString))
2974 statusBar()->showMessage(i18n("Found: %1", m_findString));
2976 statusBar()->showMessage(i18n("Reached end of project"));
2977 m_findTimer.start(4000);
2980 void MainWindow::findAhead()
2982 if (m_activeTimeline && m_activeTimeline->projectView()->findString(m_findString)) {
2983 m_projectSearchNext->setEnabled(true);
2984 statusBar()->showMessage(i18n("Found: %1", m_findString));
2986 m_projectSearchNext->setEnabled(false);
2987 statusBar()->showMessage(i18n("Not found: %1", m_findString));
2991 void MainWindow::findTimeout()
2993 m_projectSearchNext->setEnabled(false);
2994 m_findActivated = false;
2995 m_findString.clear();
2996 statusBar()->showMessage(i18n("Find stopped"), 3000);
2997 if (m_activeTimeline) m_activeTimeline->projectView()->clearSearchStrings();
2998 m_projectSearch->setEnabled(true);
2999 removeEventFilter(this);
3002 void MainWindow::slotClipInTimeline(const QString &clipId)
3004 if (m_activeTimeline && m_activeDocument) {
3005 QList<ItemInfo> matching = m_activeTimeline->projectView()->findId(clipId);
3007 QMenu *inTimelineMenu = static_cast<QMenu*>(factory()->container("clip_in_timeline", this));
3008 inTimelineMenu->clear();
3010 QList <QAction *> actionList;
3012 for (int i = 0; i < matching.count(); ++i) {
3013 QString track = QString::number(matching.at(i).track);
3014 QString start = m_activeDocument->timecode().getTimecode(matching.at(i).startPos);
3016 QAction *a = new QAction(track + ": " + start, this);
3017 a->setData(QStringList() << track << start);
3018 connect(a, SIGNAL(triggered()), this, SLOT(slotSelectClipInTimeline()));
3019 while (j < actionList.count()) {
3020 if (actionList.at(j)->text() > a->text()) break;
3023 actionList.insert(j, a);
3025 inTimelineMenu->addActions(actionList);
3027 if (matching.empty())
3028 inTimelineMenu->setEnabled(false);
3030 inTimelineMenu->setEnabled(true);
3034 void MainWindow::slotClipInProjectTree()
3036 if (m_activeTimeline) {
3037 const QStringList &clipIds = m_activeTimeline->projectView()->selectedClips();
3038 if (clipIds.isEmpty())
3040 m_projectListDock->raise();
3041 for (int i = 0; i < clipIds.count(); i++)
3042 m_projectList->selectItemById(clipIds.at(i));
3043 if (m_projectMonitor->isActive())
3044 slotSwitchMonitors();
3048 /*void MainWindow::slotClipToProjectTree()
3050 if (m_activeTimeline) {
3051 const QList<ClipItem *> clips = m_activeTimeline->projectView()->selectedClipItems();
3052 if (clips.isEmpty()) return;
3053 for (int i = 0; i < clips.count(); i++) {
3054 m_projectList->slotAddXmlClip(clips.at(i)->itemXml());
3056 //m_projectList->selectItemById(clipIds.at(i));
3060 void MainWindow::slotSelectClipInTimeline()
3062 if (m_activeTimeline) {
3063 QAction *action = qobject_cast<QAction *>(sender());
3064 QStringList data = action->data().toStringList();
3065 m_activeTimeline->projectView()->selectFound(data.at(0), data.at(1));
3069 void MainWindow::keyPressEvent(QKeyEvent *ke)
3071 if (m_findActivated) {
3072 if (ke->key() == Qt::Key_Backspace) {
3073 m_findString = m_findString.left(m_findString.length() - 1);
3075 if (!m_findString.isEmpty())
3080 m_findTimer.start(4000);
3083 } else if (ke->key() == Qt::Key_Escape) {
3087 } else if (ke->key() == Qt::Key_Space || !ke->text().trimmed().isEmpty()) {
3088 m_findString += ke->text();
3092 m_findTimer.start(4000);
3097 KXmlGuiWindow::keyPressEvent(ke);
3102 /** Gets called when the window gets hidden */
3103 void MainWindow::hideEvent(QHideEvent */*event*/)
3106 if (m_monitorManager)
3107 m_monitorManager->stopActiveMonitor();
3110 bool MainWindow::eventFilter(QObject *obj, QEvent *event)
3112 if (m_findActivated) {
3113 if (event->type() == QEvent::ShortcutOverride) {
3114 QKeyEvent* ke = (QKeyEvent*) event;
3115 if (ke->text().trimmed().isEmpty()) return false;
3122 // pass the event on to the parent class
3123 return QMainWindow::eventFilter(obj, event);
3128 void MainWindow::slotSaveZone(Render *render, QPoint zone)
3130 KDialog *dialog = new KDialog(this);
3131 dialog->setCaption("Save clip zone");
3132 dialog->setButtons(KDialog::Ok | KDialog::Cancel);
3134 QWidget *widget = new QWidget(dialog);
3135 dialog->setMainWidget(widget);
3137 QVBoxLayout *vbox = new QVBoxLayout(widget);
3138 QLabel *label1 = new QLabel(i18n("Save clip zone as:"), this);
3139 QString path = m_activeDocument->projectFolder().path();
3141 path.append("untitled.mlt");
3142 KUrlRequester *url = new KUrlRequester(KUrl(path), this);
3143 url->setFilter("video/mlt-playlist");
3144 QLabel *label2 = new QLabel(i18n("Description:"), this);
3145 KLineEdit *edit = new KLineEdit(this);
3146 vbox->addWidget(label1);
3147 vbox->addWidget(url);
3148 vbox->addWidget(label2);
3149 vbox->addWidget(edit);
3150 if (dialog->exec() == QDialog::Accepted)
3151 render->saveZone(url->url(), edit->text(), zone);
3155 void MainWindow::slotSetInPoint()
3157 if (m_clipMonitor->isActive())
3158 m_clipMonitor->slotSetZoneStart();
3160 m_projectMonitor->slotSetZoneStart();
3161 //else m_activeTimeline->projectView()->setInPoint();
3164 void MainWindow::slotSetOutPoint()
3166 if (m_clipMonitor->isActive())
3167 m_clipMonitor->slotSetZoneEnd();
3169 m_projectMonitor->slotSetZoneEnd();
3170 // else m_activeTimeline->projectView()->setOutPoint();
3173 void MainWindow::slotResizeItemStart()
3175 if (m_activeTimeline)
3176 m_activeTimeline->projectView()->setInPoint();
3179 void MainWindow::slotResizeItemEnd()
3181 if (m_activeTimeline)
3182 m_activeTimeline->projectView()->setOutPoint();
3185 int MainWindow::getNewStuff(const QString &configFile)
3187 KNS3::Entry::List entries;
3188 #if KDE_IS_VERSION(4,3,80)
3189 KNS3::DownloadDialog dialog(configFile);
3191 entries = dialog.changedEntries();
3192 foreach(const KNS3::Entry &entry, entries) {
3193 if (entry.status() == KNS3::Entry::Installed)
3194 kDebug() << "// Installed files: " << entry.installedFiles();
3197 KNS::Engine engine(0);
3198 if (engine.init(configFile))
3199 entries = engine.downloadDialogModal(this);
3200 foreach(KNS::Entry *entry, entries) {
3201 if (entry->status() == KNS::Entry::Installed)
3202 kDebug() << "// Installed files: " << entry->installedFiles();
3204 #endif /* KDE_IS_VERSION(4,3,80) */
3205 return entries.size();
3208 void MainWindow::slotGetNewTitleStuff()
3210 if (getNewStuff("kdenlive_titles.knsrc") > 0)
3211 TitleWidget::refreshTitleTemplates();
3214 void MainWindow::slotGetNewLumaStuff()
3216 if (getNewStuff("kdenlive_wipes.knsrc") > 0) {
3217 initEffects::refreshLumas();
3218 m_activeTimeline->projectView()->reloadTransitionLumas();
3222 void MainWindow::slotGetNewRenderStuff()
3224 if (getNewStuff("kdenlive_renderprofiles.knsrc") > 0)
3226 m_renderWidget->reloadProfiles();
3229 void MainWindow::slotGetNewMltProfileStuff()
3231 if (getNewStuff("kdenlive_projectprofiles.knsrc") > 0) {
3232 // update the list of profiles in settings dialog
3233 KdenliveSettingsDialog* d = static_cast <KdenliveSettingsDialog*>(KConfigDialog::exists("settings"));
3239 void MainWindow::slotAutoTransition()
3241 if (m_activeTimeline)
3242 m_activeTimeline->projectView()->autoTransition();
3245 void MainWindow::slotSplitAudio()
3247 if (m_activeTimeline)
3248 m_activeTimeline->projectView()->splitAudio();
3251 void MainWindow::slotUpdateClipType(QAction *action)
3253 if (m_activeTimeline) {
3254 if (action->data().toString() == "clip_audio_only") m_activeTimeline->projectView()->setAudioOnly();
3255 else if (action->data().toString() == "clip_video_only") m_activeTimeline->projectView()->setVideoOnly();
3256 else m_activeTimeline->projectView()->setAudioAndVideo();
3260 void MainWindow::slotDvdWizard(const QString &url, const QString &profile)
3262 // We must stop the monitors since we create a new on in the dvd wizard
3263 m_clipMonitor->stop();
3264 m_projectMonitor->stop();
3265 DvdWizard w(url, profile, this);
3267 m_projectMonitor->start();
3270 void MainWindow::slotShowTimeline(bool show)
3272 if (show == false) {
3273 m_timelineState = saveState();
3274 centralWidget()->setHidden(true);
3276 centralWidget()->setHidden(false);
3277 restoreState(m_timelineState);
3281 void MainWindow::slotMaximizeCurrent(bool /*show*/)
3283 //TODO: is there a way to maximize current widget?
3286 m_timelineState = saveState();
3287 QWidget *par = focusWidget()->parentWidget();
3288 while (par->parentWidget() && par->parentWidget() != this)
3289 par = par->parentWidget();
3290 kDebug() << "CURRENT WIDGET: " << par->objectName();
3293 //centralWidget()->setHidden(false);
3294 //restoreState(m_timelineState);
3298 void MainWindow::loadTranscoders()
3300 QMenu *transMenu = static_cast<QMenu*>(factory()->container("transcoders", this));
3303 KSharedConfigPtr config = KSharedConfig::openConfig("kdenlivetranscodingrc");
3304 KConfigGroup transConfig(config, "Transcoding");
3306 QMap< QString, QString > profiles = transConfig.entryMap();
3307 QMapIterator<QString, QString> i(profiles);
3308 while (i.hasNext()) {
3310 QStringList data = i.value().split(";", QString::SkipEmptyParts);
3311 QAction *a = transMenu->addAction(i.key());
3313 if (data.count() > 1)
3314 a->setToolTip(data.at(1));
3315 connect(a, SIGNAL(triggered()), this, SLOT(slotTranscode()));
3319 void MainWindow::slotTranscode(KUrl::List urls)
3324 if (urls.isEmpty()) {
3325 QAction *action = qobject_cast<QAction *>(sender());
3326 QStringList data = action->data().toStringList();
3327 params = data.at(0);
3328 if (data.count() > 1) desc = data.at(1);
3329 if (data.count() > 2) condition = data.at(2);
3330 urls << m_projectList->getConditionalUrls(condition);
3331 urls.removeAll(KUrl());
3333 if (urls.isEmpty()) {
3334 m_messageLabel->setMessage(i18n("No clip to transcode"), ErrorMessage);
3337 ClipTranscode *d = new ClipTranscode(urls, params, desc);
3338 connect(d, SIGNAL(addClip(KUrl)), this, SLOT(slotAddProjectClip(KUrl)));
3340 //QProcess::startDetached("ffmpeg", parameters);
3343 void MainWindow::slotTranscodeClip()
3345 KUrl::List urls = KFileDialog::getOpenUrls(KUrl("kfiledialog:///projectfolder"));
3346 if (urls.isEmpty()) return;
3347 slotTranscode(urls);
3350 void MainWindow::slotSetDocumentRenderProfile(const QString &dest, const QString &group, const QString &name, const QString &file)
3352 if (m_activeDocument == NULL) return;
3353 m_activeDocument->setDocumentProperty("renderdestination", dest);
3354 m_activeDocument->setDocumentProperty("rendercategory", group);
3355 m_activeDocument->setDocumentProperty("renderprofile", name);
3356 m_activeDocument->setDocumentProperty("renderurl", file);
3357 m_activeDocument->setModified(true);
3361 void MainWindow::slotPrepareRendering(bool scriptExport, bool zoneOnly, const QString &chapterFile)
3363 if (m_activeDocument == NULL || m_renderWidget == NULL) return;
3365 QString playlistPath;
3368 QString scriptsFolder = m_activeDocument->projectFolder().path() + "/scripts/";
3369 QString path = m_renderWidget->getFreeScriptName();
3370 scriptPath = QInputDialog::getText(this, i18n("Create Render Script"), i18n("Script name (will be saved in: %1)", scriptsFolder), QLineEdit::Normal, KUrl(path).fileName(), &ok);
3371 if (!ok || scriptPath.isEmpty()) return;
3372 scriptPath.prepend(scriptsFolder);
3373 QFile f(scriptPath);
3375 if (KMessageBox::warningYesNo(this, i18n("Script file already exists. Do you want to overwrite it?")) != KMessageBox::Yes)
3378 playlistPath = scriptPath + ".mlt";
3379 m_projectMonitor->saveSceneList(playlistPath);
3381 KTemporaryFile temp;
3382 temp.setAutoRemove(false);
3383 temp.setSuffix(".mlt");
3385 playlistPath = temp.fileName();
3386 m_projectMonitor->saveSceneList(playlistPath);
3389 if (!chapterFile.isEmpty()) {
3392 if (!zoneOnly) out = (int) GenTime(m_activeDocument->projectDuration()).frames(m_activeDocument->fps());
3394 in = m_activeTimeline->inPoint();
3395 out = m_activeTimeline->outPoint();
3398 QDomElement chapters = doc.createElement("chapters");
3399 chapters.setAttribute("fps", m_activeDocument->fps());
3400 doc.appendChild(chapters);
3402 QDomElement guidesxml = m_activeDocument->guidesXml();
3403 QDomNodeList nodes = guidesxml.elementsByTagName("guide");
3404 for (int i = 0; i < nodes.count(); i++) {
3405 QDomElement e = nodes.item(i).toElement();
3407 QString comment = e.attribute("comment");
3408 int time = (int) GenTime(e.attribute("time").toDouble()).frames(m_activeDocument->fps());
3409 if (time >= in && time < out) {
3410 if (zoneOnly) time = time - in;
3411 QDomElement chapter = doc.createElement("chapter");
3412 chapters.appendChild(chapter);
3413 chapter.setAttribute("title", comment);
3414 chapter.setAttribute("time", time);
3418 if (chapters.childNodes().count() > 0) {
3419 if (m_activeTimeline->projectView()->hasGuide(out, 0) == -1) {
3420 // Always insert a guide in pos 0
3421 QDomElement chapter = doc.createElement("chapter");
3422 chapters.insertBefore(chapter, QDomNode());
3423 chapter.setAttribute("title", i18n("Start"));
3424 chapter.setAttribute("time", "0");
3426 // save chapters file
3427 QFile file(chapterFile);
3428 if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
3429 kWarning() << "////// ERROR writing DVD CHAPTER file: " << chapterFile;
3431 file.write(doc.toString().toUtf8());
3432 if (file.error() != QFile::NoError) {
3433 kWarning() << "////// ERROR writing DVD CHAPTER file: " << chapterFile;
3440 m_renderWidget->slotExport(scriptExport, m_activeTimeline->inPoint(), m_activeTimeline->outPoint(), playlistPath, scriptPath);
3443 void MainWindow::slotUpdateTimecodeFormat(int ix)
3445 KdenliveSettings::setFrametimecode(ix == 1);
3446 m_clipMonitor->updateTimecodeFormat();
3447 m_projectMonitor->updateTimecodeFormat();
3448 m_transitionConfig->updateTimecodeFormat();
3449 m_effectStack->updateTimecodeFormat();
3450 //m_activeTimeline->projectView()->clearSelection();
3451 m_activeTimeline->updateRuler();
3454 void MainWindow::slotRemoveFocus()
3456 statusBar()->setFocus();
3457 statusBar()->clearFocus();
3460 void MainWindow::slotRevert()
3462 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;
3463 KUrl url = m_activeDocument->url();
3464 closeCurrentDocument(false);
3465 doOpenFile(url, NULL);
3469 void MainWindow::slotShutdown()
3471 if (m_activeDocument) m_activeDocument->setModified(false);
3473 QDBusConnectionInterface* interface = QDBusConnection::sessionBus().interface();
3474 if (interface && interface->isServiceRegistered("org.kde.ksmserver")) {
3475 QDBusInterface smserver("org.kde.ksmserver", "/KSMServer", "org.kde.KSMServerInterface");
3476 smserver.call("logout", 1, 2, 2);
3477 } else if (interface && interface->isServiceRegistered("org.gnome.SessionManager")) {
3478 QDBusInterface smserver("org.gnome.SessionManager", "/org/gnome/SessionManager", "org.gnome.SessionManager");
3479 smserver.call("Shutdown");
3483 void MainWindow::slotUpdateTrackInfo()
3485 if (m_activeDocument)
3486 m_transitionConfig->updateProjectFormat(m_activeDocument->mltProfile(), m_activeDocument->timecode(), m_activeDocument->tracksList());
3489 void MainWindow::slotChangePalette(QAction *action, const QString &themename)
3491 // Load the theme file
3493 if (action == NULL) theme = themename;
3494 else theme = action->data().toString();
3495 KdenliveSettings::setColortheme(theme);
3496 // Make palette for all widgets.
3498 if (theme.isEmpty())
3499 plt = QApplication::desktop()->palette();
3501 KSharedConfigPtr config = KSharedConfig::openConfig(theme);
3502 plt = KGlobalSettings::createApplicationPalette(config);
3505 kapp->setPalette(plt);
3506 const QObjectList children = statusBar()->children();
3508 foreach(QObject *child, children) {
3509 if (child->isWidgetType())
3510 ((QWidget*)child)->setPalette(plt);
3511 const QObjectList subchildren = child->children();
3512 foreach(QObject *subchild, subchildren) {
3513 if (subchild->isWidgetType())
3514 ((QWidget*)subchild)->setPalette(plt);
3517 if (m_activeTimeline)
3518 m_activeTimeline->projectView()->updatePalette();
3522 QPixmap MainWindow::createSchemePreviewIcon(const KSharedConfigPtr &config)
3524 // code taken from kdebase/workspace/kcontrol/colors/colorscm.cpp
3525 const uchar bits1[] = { 0xff, 0xff, 0xff, 0x2c, 0x16, 0x0b };
3526 const uchar bits2[] = { 0x68, 0x34, 0x1a, 0xff, 0xff, 0xff };
3527 const QSize bitsSize(24, 2);
3528 const QBitmap b1 = QBitmap::fromData(bitsSize, bits1);
3529 const QBitmap b2 = QBitmap::fromData(bitsSize, bits2);
3531 QPixmap pixmap(23, 16);
3532 pixmap.fill(Qt::black); // ### use some color other than black for borders?
3534 KConfigGroup group(config, "WM");
3535 QPainter p(&pixmap);
3536 KColorScheme windowScheme(QPalette::Active, KColorScheme::Window, config);
3537 p.fillRect(1, 1, 7, 7, windowScheme.background());
3538 p.fillRect(2, 2, 5, 2, QBrush(windowScheme.foreground().color(), b1));
3540 KColorScheme buttonScheme(QPalette::Active, KColorScheme::Button, config);
3541 p.fillRect(8, 1, 7, 7, buttonScheme.background());
3542 p.fillRect(9, 2, 5, 2, QBrush(buttonScheme.foreground().color(), b1));
3544 p.fillRect(15, 1, 7, 7, group.readEntry("activeBackground", QColor(96, 148, 207)));
3545 p.fillRect(16, 2, 5, 2, QBrush(group.readEntry("activeForeground", QColor(255, 255, 255)), b1));
3547 KColorScheme viewScheme(QPalette::Active, KColorScheme::View, config);
3548 p.fillRect(1, 8, 7, 7, viewScheme.background());
3549 p.fillRect(2, 12, 5, 2, QBrush(viewScheme.foreground().color(), b2));
3551 KColorScheme selectionScheme(QPalette::Active, KColorScheme::Selection, config);
3552 p.fillRect(8, 8, 7, 7, selectionScheme.background());
3553 p.fillRect(9, 12, 5, 2, QBrush(selectionScheme.foreground().color(), b2));
3555 p.fillRect(15, 8, 7, 7, group.readEntry("inactiveBackground", QColor(224, 223, 222)));
3556 p.fillRect(16, 12, 5, 2, QBrush(group.readEntry("inactiveForeground", QColor(20, 19, 18)), b2));
3562 void MainWindow::slotSwitchMonitors()
3564 m_monitorManager->slotSwitchMonitors(!m_clipMonitor->isActive());
3565 if (m_projectMonitor->isActive()) m_activeTimeline->projectView()->setFocus();
3566 else m_projectList->focusTree();
3569 void MainWindow::slotInsertZoneToTree()
3571 if (!m_clipMonitor->isActive() || m_clipMonitor->activeClip() == NULL) return;
3572 QStringList info = m_clipMonitor->getZoneInfo();
3573 m_projectList->slotAddClipCut(info.at(0), info.at(1).toInt(), info.at(2).toInt());
3576 void MainWindow::slotInsertZoneToTimeline()
3578 if (m_activeTimeline == NULL || m_clipMonitor->activeClip() == NULL) return;
3579 QStringList info = m_clipMonitor->getZoneInfo();
3580 m_activeTimeline->projectView()->insertClipCut(m_clipMonitor->activeClip(), info.at(1).toInt(), info.at(2).toInt());
3584 void MainWindow::slotDeleteProjectClips(QStringList ids, QMap<QString, QString> folderids)
3586 if (m_activeDocument && m_activeTimeline) {
3587 if (!ids.isEmpty()) {
3588 for (int i = 0; i < ids.size(); ++i) {
3589 m_activeTimeline->slotDeleteClip(ids.at(i));
3591 m_activeDocument->clipManager()->slotDeleteClips(ids);
3593 if (!folderids.isEmpty()) m_projectList->deleteProjectFolder(folderids);
3594 m_activeDocument->setModified(true);
3598 void MainWindow::slotShowTitleBars(bool show)
3601 m_effectStackDock->setTitleBarWidget(0);
3602 m_clipMonitorDock->setTitleBarWidget(0);
3603 m_projectMonitorDock->setTitleBarWidget(0);
3605 m_recMonitorDock->setTitleBarWidget(0);
3607 m_effectListDock->setTitleBarWidget(0);
3608 m_transitionConfigDock->setTitleBarWidget(0);
3609 m_projectListDock->setTitleBarWidget(0);
3610 m_undoViewDock->setTitleBarWidget(0);
3611 m_vectorscopeDock->setTitleBarWidget(0);
3612 m_waveformDock->setTitleBarWidget(0);
3614 if (!m_effectStackDock->isFloating()) { m_effectStackDock->setTitleBarWidget(new QWidget(this)); }
3615 if (!m_clipMonitorDock->isFloating()) { m_clipMonitorDock->setTitleBarWidget(new QWidget(this)); }
3616 if (!m_projectMonitorDock->isFloating()) { m_projectMonitorDock->setTitleBarWidget(new QWidget(this)); }
3618 if (!m_recMonitorDock->isFloating()) { m_recMonitorDock->setTitleBarWidget(new QWidget(this)); }
3620 if (!m_effectListDock->isFloating()) { m_effectListDock->setTitleBarWidget(new QWidget(this)); }
3621 if (!m_transitionConfigDock->isFloating()) { m_transitionConfigDock->setTitleBarWidget(new QWidget(this)); }
3622 if (!m_projectListDock->isFloating()) { m_projectListDock->setTitleBarWidget(new QWidget(this)); }
3623 if (!m_undoViewDock->isFloating()) { m_undoViewDock->setTitleBarWidget(new QWidget(this)); }
3624 if (!m_vectorscopeDock->isFloating()) { m_vectorscopeDock->setTitleBarWidget(new QWidget(this)); }
3625 if (!m_waveformDock->isFloating()) { m_waveformDock->setTitleBarWidget(new QWidget(this)); }
3627 KdenliveSettings::setShowtitlebars(show);
3630 void MainWindow::slotSwitchTitles()
3632 slotShowTitleBars(!KdenliveSettings::showtitlebars());
3635 QString MainWindow::getMimeType()
3637 QString mimetype = "application/x-kdenlive";
3638 KMimeType::Ptr mime = KMimeType::mimeType(mimetype);
3639 if (!mime) mimetype = "*.kdenlive";
3643 #include "mainwindow.moc"