diff edgui.cpp @ 397:9993873ff655

More work towards editor.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 19 Oct 2012 07:22:09 +0300
parents 5137db55f00b
children 8660c6005032
line wrap: on
line diff
--- a/edgui.cpp	Fri Oct 19 07:21:54 2012 +0300
+++ b/edgui.cpp	Fri Oct 19 07:22:09 2012 +0300
@@ -21,10 +21,10 @@
     // Set window title based on document filename and changed status
     QString name;
 
-    if (!tl || tl->filename.isEmpty())
+    if (!currTimeline || currTimeline->filename.isEmpty())
         name = DOC_DEF_FILENAME;
     else
-        name = tl->filename;
+        name = currTimeline->filename;
 
     if (changed)
         name = "*" + name;
@@ -32,14 +32,9 @@
     setWindowTitle(name + " - " + QCoreApplication::applicationName());
 
     // Enable menu items based on states
-#if 0
-    menuActValidate->setEnabled(tl->get);
-    menuActSave->setEnabled(tl->changed || changed);
-    menuActSaveAs->setEnabled(tl->changed || changed);
-#else
-    menuActSave->setEnabled(false);
-    menuActSaveAs->setEnabled(false);
-#endif
+    menuActSave->setEnabled(currTimeline->changed || changed);
+    menuActSaveAs->setEnabled(currTimeline->changed || changed);
+
     
     // Enable undo/redo items and set their texts based on history status
     int historyLevels = undoHistory.size();
@@ -141,7 +136,7 @@
                 {
                     QMessageBox::information(this, 
                         "Document saved",
-                        "The document was saved as " + tl->filename);
+                        "The document was saved as " + currTimeline->filename);
 
                     okToCreate = true;
                 }
@@ -177,7 +172,7 @@
                 {
                     QMessageBox::information(this, 
                         "Document saved",
-                        "The document was saved as " + tl->filename);
+                        "The document was saved as " + currTimeline->filename);
                     
                     okToOpen = true;
                 }
@@ -205,9 +200,9 @@
 
 void DemoEditor::actionFileSaveAs()
 {
-    if (!tl)
+    if (!currTimeline)
     {
-        qDebug() << "DemoEditor::actionFileSaveAs(): tl == null";
+        qDebug() << "DemoEditor::actionFileSaveAs(): currTimeline == null";
         return;
     }
 
@@ -219,7 +214,7 @@
     fdialog.setDefaultSuffix("demo");
     fdialog.setConfirmOverwrite(true);
 
-    fdialog.selectFile(tl->filename.isEmpty() ? tl->filename : DOC_DEF_FILENAME);
+    fdialog.selectFile(currTimeline->filename.isEmpty() ? currTimeline->filename : DOC_DEF_FILENAME);
     
     if (fdialog.exec())
         saveToFile(fdialog.selectedFiles()[0]);
@@ -228,15 +223,15 @@
 
 void DemoEditor::actionFileSave()
 {
-    if (!tl)
+    if (!currTimeline)
     {
-        qDebug() << "DemoEditor::actionFileSave(): tl == null";
+        qDebug() << "DemoEditor::actionFileSave(): currTimeline == null";
         return;
     }
 
     // If filename has been set, save .. otherwise go to save as
-    if (!tl->filename.isEmpty())
-        saveToFile(tl->filename);
+    if (!currTimeline->filename.isEmpty())
+        saveToFile(currTimeline->filename);
     else
         actionFileSaveAs();
 }
@@ -494,11 +489,12 @@
     connect(timelineAudioTrack, SIGNAL(timeChanged(float)), this, SLOT(actionTimeChanged(float)));
 
     timelineView = new QTimelineView();
+    connect(timelineView, SIGNAL(timelineChanged()), this, SLOT(actionTimelineChanged()));
 
     demoView = new SWDemoView(this);
 
     verticalSplitter->addLayout(horizSplitter);
-    verticalSplitter->addWidget(timelineTrack);
+    verticalSplitter->addWidget(timelineView);
     verticalSplitter->addWidget(timelineAudioTrack);
     verticalSplitter->addWidget(timelineScrollBar);