]> git.sesse.net Git - kdenlive/blobdiff - src/mainwindow.cpp
Add action to show / hide timeline
[kdenlive] / src / mainwindow.cpp
index d5a9ab50a1508e6962fb85a0c5323bc970d7c11c..dfd61d78db8b18db4a3a1f4c4fa88bb176185263 100644 (file)
@@ -987,6 +987,19 @@ void MainWindow::setupActions() {
     pasteEffects->setData("paste_effects");
     connect(pasteEffects , SIGNAL(triggered()), this, SLOT(slotPasteEffects()));
 
+    QAction *showTimeline = new KAction(i18n("Show Timeline"), this);
+    collection->addAction("show_timeline", showTimeline);
+    showTimeline->setCheckable(true);
+    showTimeline->setChecked(true);
+    connect(showTimeline, SIGNAL(triggered(bool)), this, SLOT(slotShowTimeline(bool)));
+
+    /*QAction *maxCurrent = new KAction(i18n("Maximize Current Widget"), this);
+    collection->addAction("maximize_current", maxCurrent);
+    maxCurrent->setCheckable(true);
+    maxCurrent->setChecked(false);
+    connect(maxCurrent, SIGNAL(triggered(bool)), this, SLOT(slotMaximizeCurrent(bool)));*/
+
+
     m_closeAction = KStandardAction::close(this, SLOT(closeCurrentDocument()), collection);
 
     KStandardAction::quit(this, SLOT(queryQuit()), collection);
@@ -2415,5 +2428,31 @@ void MainWindow::slotDvdWizard(const QString &url, const QString &profile) {
     w->exec();
 }
 
+void MainWindow::slotShowTimeline(bool show) {
+    if (show == false) {
+        m_timelineState = saveState();
+        centralWidget()->setHidden(true);
+    } else {
+        centralWidget()->setHidden(false);
+        restoreState(m_timelineState);
+    }
+}
+
+void MainWindow::slotMaximizeCurrent(bool show) {
+    //TODO: is there a way to maximize current widget?
+    //if (show == true)
+    {
+        m_timelineState = saveState();
+        QWidget *par = focusWidget()->parentWidget();
+        while (par->parentWidget() && par->parentWidget() != this) {
+            par = par->parentWidget();
+        }
+        kDebug() << "CURRENT WIDGET: " << par->objectName();
+    }
+    /*else {
+    //centralWidget()->setHidden(false);
+    //restoreState(m_timelineState);
+    }*/
+}
 
 #include "mainwindow.moc"