# HG changeset patch # User Chris Cannam # Date 1235561167 0 # Node ID 299d0ffebb386a558b51a3ee3394803b25a0b8bf # Parent d95635d6b82b71fe56502c86bd277ef20248483d * Make Activity Log a bit more of a proper window diff -r d95635d6b82b -r 299d0ffebb38 widgets/ActivityLog.cpp --- a/widgets/ActivityLog.cpp Tue Feb 24 17:25:55 2009 +0000 +++ b/widgets/ActivityLog.cpp Wed Feb 25 11:26:07 2009 +0000 @@ -18,18 +18,31 @@ #include #include #include +#include +#include #include +#include #include ActivityLog::ActivityLog() : QDialog() { + setWindowTitle(tr("Activity Log")); + + QGridLayout *layout = new QGridLayout; + setLayout(layout); + + layout->addWidget(new QLabel(tr("

Activity Log shows a list of your interactions and other events within %1.

").arg(QApplication::applicationName())), 0, 0); + + m_listView = new QListView; m_model = new QStringListModel; - m_listView = new QListView; - QGridLayout *layout = new QGridLayout; - layout->addWidget(m_listView, 0, 0); - setLayout(layout); m_listView->setModel(m_model); + layout->addWidget(m_listView, 1, 0); + layout->setRowStretch(1, 10); + + QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Close); + connect(bb, SIGNAL(rejected()), this, SLOT(hide())); + layout->addWidget(bb, 2, 0); } ActivityLog::~ActivityLog() @@ -54,3 +67,12 @@ if (isVisible()) m_listView->scrollTo(ix); } +void +ActivityLog::scrollToEnd() +{ + if (m_model->rowCount() == 0 || !isVisible()) return; + QModelIndex ix = m_model->index(m_model->rowCount()-1, 0); + m_listView->scrollTo(ix); +} + + diff -r d95635d6b82b -r 299d0ffebb38 widgets/ActivityLog.h --- a/widgets/ActivityLog.h Tue Feb 24 17:25:55 2009 +0000 +++ b/widgets/ActivityLog.h Wed Feb 25 11:26:07 2009 +0000 @@ -32,6 +32,7 @@ public slots: void activityHappened(QString); + void scrollToEnd(); private: QListView *m_listView;