comparison widgets/ActivityLog.cpp @ 503:133b378d8efe

* more activity updates
author Chris Cannam
date Tue, 24 Feb 2009 16:44:43 +0000
parents 73a58a4dfebd
children d95635d6b82b
comparison
equal deleted inserted replaced
502:73a58a4dfebd 503:133b378d8efe
16 #include "ActivityLog.h" 16 #include "ActivityLog.h"
17 17
18 #include <QListView> 18 #include <QListView>
19 #include <QGridLayout> 19 #include <QGridLayout>
20 #include <QStringListModel> 20 #include <QStringListModel>
21 #include <QTime>
21 22
22 #include <iostream> 23 #include <iostream>
23 24
24 ActivityLog::ActivityLog() : QDialog() 25 ActivityLog::ActivityLog() : QDialog()
25 { 26 {
38 void 39 void
39 ActivityLog::activityHappened(QString name) 40 ActivityLog::activityHappened(QString name)
40 { 41 {
41 name = name.replace("&", ""); 42 name = name.replace("&", "");
42 std::cerr << "ActivityLog::activityHappened(" << name.toStdString() << ")" << std::endl; 43 std::cerr << "ActivityLog::activityHappened(" << name.toStdString() << ")" << std::endl;
43 // int row = m_model->rowCount(); 44 if (name == m_prevName) {
44 int row = 0; 45 std::cerr << "(ignoring duplicate)" << std::endl;
46 return;
47 }
48 m_prevName = name;
49 int row = m_model->rowCount();
50 name = tr("%1: %2").arg(QTime::currentTime().toString()).arg(name);
45 m_model->insertRows(row, 1); 51 m_model->insertRows(row, 1);
46 m_model->setData(m_model->index(row, 0), name); 52 QModelIndex ix = m_model->index(row, 0);
53 m_model->setData(ix, name);
54 if (m_listView->isVisible()) m_listView->scrollTo(ix);
47 } 55 }
48 56
49
50