+void MainWindow::slotRevert()
+{
+ 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;
+ KUrl url = m_activeDocument->url();
+ closeCurrentDocument(false);
+ doOpenFile(url, NULL);
+}
+
+
+void MainWindow::slotShutdown()
+{
+ if (m_activeDocument) m_activeDocument->setModified(false);
+ // Call shutdown
+ QDBusConnectionInterface* interface = QDBusConnection::sessionBus().interface();
+ if (interface && interface->isServiceRegistered("org.kde.ksmserver")) {
+ QDBusInterface smserver("org.kde.ksmserver", "/KSMServer", "org.kde.KSMServerInterface");
+ smserver.call("logout", 1, 2, 2);
+ } else if (interface && interface->isServiceRegistered("org.gnome.SessionManager")) {
+ QDBusInterface smserver("org.gnome.SessionManager", "/org/gnome/SessionManager", "org.gnome.SessionManager");
+ smserver.call("Shutdown");
+ }
+}
+
+void MainWindow::slotUpdateTrackInfo()
+{
+ if (m_activeDocument)
+ m_transitionConfig->updateProjectFormat(m_activeDocument->mltProfile(), m_activeDocument->timecode(), m_activeDocument->tracksList());
+}
+
+void MainWindow::slotChangePalette(QAction *action, const QString &themename)
+{
+ // Load the theme file
+ QString theme;
+ if (action == NULL) theme = themename;
+ else theme = action->data().toString();
+ KdenliveSettings::setColortheme(theme);
+ // Make palette for all widgets.
+ QPalette plt;
+ if (theme.isEmpty())
+ plt = QApplication::desktop()->palette();
+ else {
+ KSharedConfigPtr config = KSharedConfig::openConfig(theme);
+ plt = KGlobalSettings::createApplicationPalette(config);
+ }
+
+ kapp->setPalette(plt);
+ const QObjectList children = statusBar()->children();
+
+ foreach(QObject *child, children) {
+ if (child->isWidgetType())
+ ((QWidget*)child)->setPalette(plt);
+ const QObjectList subchildren = child->children();
+ foreach(QObject *subchild, subchildren) {
+ if (subchild->isWidgetType())
+ ((QWidget*)subchild)->setPalette(plt);
+ }
+ }
+}
+
+
+QPixmap MainWindow::createSchemePreviewIcon(const KSharedConfigPtr &config)
+{
+ // code taken from kdebase/workspace/kcontrol/colors/colorscm.cpp
+ const uchar bits1[] = { 0xff, 0xff, 0xff, 0x2c, 0x16, 0x0b };
+ const uchar bits2[] = { 0x68, 0x34, 0x1a, 0xff, 0xff, 0xff };
+ const QSize bitsSize(24, 2);
+ const QBitmap b1 = QBitmap::fromData(bitsSize, bits1);
+ const QBitmap b2 = QBitmap::fromData(bitsSize, bits2);
+
+ QPixmap pixmap(23, 16);
+ pixmap.fill(Qt::black); // ### use some color other than black for borders?
+
+ KConfigGroup group(config, "WM");
+ QPainter p(&pixmap);
+ KColorScheme windowScheme(QPalette::Active, KColorScheme::Window, config);
+ p.fillRect(1, 1, 7, 7, windowScheme.background());
+ p.fillRect(2, 2, 5, 2, QBrush(windowScheme.foreground().color(), b1));
+
+ KColorScheme buttonScheme(QPalette::Active, KColorScheme::Button, config);
+ p.fillRect(8, 1, 7, 7, buttonScheme.background());
+ p.fillRect(9, 2, 5, 2, QBrush(buttonScheme.foreground().color(), b1));
+
+ p.fillRect(15, 1, 7, 7, group.readEntry("activeBackground", QColor(96, 148, 207)));
+ p.fillRect(16, 2, 5, 2, QBrush(group.readEntry("activeForeground", QColor(255, 255, 255)), b1));
+
+ KColorScheme viewScheme(QPalette::Active, KColorScheme::View, config);
+ p.fillRect(1, 8, 7, 7, viewScheme.background());
+ p.fillRect(2, 12, 5, 2, QBrush(viewScheme.foreground().color(), b2));
+
+ KColorScheme selectionScheme(QPalette::Active, KColorScheme::Selection, config);
+ p.fillRect(8, 8, 7, 7, selectionScheme.background());
+ p.fillRect(9, 12, 5, 2, QBrush(selectionScheme.foreground().color(), b2));
+
+ p.fillRect(15, 8, 7, 7, group.readEntry("inactiveBackground", QColor(224, 223, 222)));
+ p.fillRect(16, 12, 5, 2, QBrush(group.readEntry("inactiveForeground", QColor(20, 19, 18)), b2));
+
+ p.end();
+ return pixmap;
+}
+
+void MainWindow::slotSwitchMonitors()
+{
+ m_monitorManager->slotSwitchMonitors(!m_clipMonitor->isActive());
+ if (m_projectMonitor->isActive()) m_activeTimeline->projectView()->setFocus();
+ else m_projectList->focusTree();
+}
+
+void MainWindow::slotInsertZoneToTree()
+{
+ if (!m_clipMonitor->isActive() || m_clipMonitor->activeClip() == NULL) return;
+ QStringList info = m_clipMonitor->getZoneInfo();
+ m_projectList->slotAddClipCut(info.at(0), info.at(1).toInt(), info.at(2).toInt());
+}
+
+void MainWindow::slotInsertZoneToTimeline()
+{
+ if (m_activeTimeline == NULL || m_clipMonitor->activeClip() == NULL) return;
+ QStringList info = m_clipMonitor->getZoneInfo();
+ m_activeTimeline->projectView()->insertClipCut(m_clipMonitor->activeClip(), info.at(1).toInt(), info.at(2).toInt());
+}
+