changeset 503:133b378d8efe

* more activity updates
author Chris Cannam
date Tue, 24 Feb 2009 16:44:43 +0000
parents 73a58a4dfebd
children d95635d6b82b
files view/ViewManager.cpp widgets/ActivityLog.cpp widgets/ActivityLog.h widgets/CommandHistory.cpp
diffstat 4 files changed, 26 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/view/ViewManager.cpp	Tue Feb 24 14:01:42 2009 +0000
+++ b/view/ViewManager.cpp	Tue Feb 24 16:44:43 2009 +0000
@@ -19,6 +19,7 @@
 #include "data/model/Model.h"
 #include "widgets/CommandHistory.h"
 #include "View.h"
+#include "Overview.h"
 
 #include <QSettings>
 #include <QApplication>
@@ -508,9 +509,11 @@
         if (v) emit viewCentreFrameChanged(v, f);
     }
 
-    emit activity(tr("Scroll view to %1")
-                  .arg(RealTime::frame2RealTime
-                       (f, m_mainModelSampleRate).toText().c_str()));
+    if (!dynamic_cast<Overview *>(v) || (mode != PlaybackIgnore)) {
+        emit activity(tr("Scroll to %1")
+                      .arg(RealTime::frame2RealTime
+                           (f, m_mainModelSampleRate).toText().c_str()));
+    }
 
     if (mode == PlaybackIgnore) {
         return;
@@ -566,7 +569,10 @@
 #endif
 
     emit viewZoomLevelChanged(v, z, locked);
-    emit activity(tr("Zoom to %n sample(s) per pixel", "", z));
+
+    if (!dynamic_cast<Overview *>(v)) {
+        emit activity(tr("Zoom to %n sample(s) per pixel", "", z));
+    }
 }
 
 void
--- a/widgets/ActivityLog.cpp	Tue Feb 24 14:01:42 2009 +0000
+++ b/widgets/ActivityLog.cpp	Tue Feb 24 16:44:43 2009 +0000
@@ -18,6 +18,7 @@
 #include <QListView>
 #include <QGridLayout>
 #include <QStringListModel>
+#include <QTime>
 
 #include <iostream>
 
@@ -40,11 +41,16 @@
 {
     name = name.replace("&", "");
     std::cerr << "ActivityLog::activityHappened(" << name.toStdString() << ")" << std::endl;
-//    int row = m_model->rowCount();
-    int row = 0;
+    if (name == m_prevName) {
+        std::cerr << "(ignoring duplicate)" << std::endl;
+        return;
+    }
+    m_prevName = name;
+    int row = m_model->rowCount();
+    name = tr("%1: %2").arg(QTime::currentTime().toString()).arg(name);
     m_model->insertRows(row, 1);
-    m_model->setData(m_model->index(row, 0), name);
+    QModelIndex ix = m_model->index(row, 0);
+    m_model->setData(ix, name);
+    if (m_listView->isVisible()) m_listView->scrollTo(ix);
 }
 
-
-    
--- a/widgets/ActivityLog.h	Tue Feb 24 14:01:42 2009 +0000
+++ b/widgets/ActivityLog.h	Tue Feb 24 16:44:43 2009 +0000
@@ -36,6 +36,7 @@
 private:
     QListView *m_listView;
     QStringListModel *m_model;
+    QString m_prevName;
 };
 
 #endif
--- a/widgets/CommandHistory.cpp	Tue Feb 24 14:01:42 2009 +0000
+++ b/widgets/CommandHistory.cpp	Tue Feb 24 16:44:43 2009 +0000
@@ -35,7 +35,9 @@
 
 #include <iostream>
 
-//#define DEBUG_COMMAND_HISTORY 1
+#include <typeinfo>
+
+#define DEBUG_COMMAND_HISTORY 1
 
 CommandHistory *CommandHistory::m_instance = 0;
 
@@ -141,7 +143,7 @@
     if (!command) return;
 
 #ifdef DEBUG_COMMAND_HISTORY
-    std::cerr << "CommandHistory::addCommand: " << command->getName().toLocal8Bit().data() << " at " << command << ": execute = " << execute << ", bundle = " << bundle << " (m_currentCompound = " << m_currentCompound << ", m_currentBundle = " << m_currentBundle << ")" << std::endl;
+    std::cerr << "CommandHistory::addCommand: " << command->getName().toLocal8Bit().data() << " of type " << typeid(*command).name() << " at " << command << ": execute = " << execute << ", bundle = " << bundle << " (m_currentCompound = " << m_currentCompound << ", m_currentBundle = " << m_currentBundle << ")" << std::endl;
 #endif
 
     if (m_currentCompound) {