Mercurial > hg > svgui
changeset 505:299d0ffebb38
* Make Activity Log a bit more of a proper window
author | Chris Cannam |
---|---|
date | Wed, 25 Feb 2009 11:26:07 +0000 |
parents | d95635d6b82b |
children | 33572f3ad62b |
files | widgets/ActivityLog.cpp widgets/ActivityLog.h |
diffstat | 2 files changed, 27 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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 <QListView> #include <QGridLayout> #include <QStringListModel> +#include <QLabel> +#include <QDialogButtonBox> #include <QTime> +#include <QApplication> #include <iostream> ActivityLog::ActivityLog() : QDialog() { + setWindowTitle(tr("Activity Log")); + + QGridLayout *layout = new QGridLayout; + setLayout(layout); + + layout->addWidget(new QLabel(tr("<p>Activity Log shows a list of your interactions and other events within %1.</p>").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); +} + +