From e3c4aa5dffecc8f62958c44035b2e58de0228eb4 Mon Sep 17 00:00:00 2001 From: Javier Date: Sun, 14 Jun 2015 17:17:12 +0200 Subject: better synchronization status reporting --- mainwindow.cc | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'mainwindow.cc') diff --git a/mainwindow.cc b/mainwindow.cc index 0fdf38d..b49a8da 100644 --- a/mainwindow.cc +++ b/mainwindow.cc @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -13,7 +14,8 @@ MainWindow::MainWindow(QWidget *parent) : _media(new Phonon::MediaObject(this)), _mediaOutput(new Phonon::AudioOutput(this)), _replay(new PaperReplay(this)), - _replayModel(new PaperReplayModel(_replay, this)) + _replayModel(new PaperReplayModel(_replay, this)), + _statusLabel(new QLabel) { ui->setupUi(this); ui->notebookTree->setModel(_notebooks); @@ -30,6 +32,11 @@ MainWindow::MainWindow(QWidget *parent) : _media->setTickInterval(500); ui->replaySlider->setMediaObject(_media); ui->pauseButton->setVisible(false); + ui->statusBar->addWidget(_statusLabel, 1); + connect(_notebooks, SIGNAL(rowsInserted(QModelIndex,int,int)), + this, SLOT(handleNotebookRowsInserted(QModelIndex,int,int))); + connect(_manager, SIGNAL(pensBeingSynchronizedChanged()), + this, SLOT(handlePensBeingSynchronizedChanged())); connect(_media, SIGNAL(stateChanged(Phonon::State,Phonon::State)), this, SLOT(handleMediaStateChange(Phonon::State))); connect(_media, SIGNAL(totalTimeChanged(qint64)), @@ -140,6 +147,14 @@ void MainWindow::handleNotebookSelected(const QModelIndex &index) _notebooks->data(child, Qt::DisplayRole).toString()); } +void MainWindow::handleNotebookRowsInserted(const QModelIndex &index, int start, int end) +{ + Q_UNUSED(index); + Q_UNUSED(start); + Q_UNUSED(end); + QTimer::singleShot(200, ui->notebookTree, SLOT(expandAll())); +} + void MainWindow::handleCurPageChanged() { ui->pageEdit->setText(QString::number(ui->notebookView->curPage() + 1)); @@ -227,6 +242,16 @@ void MainWindow::handleMediaTick(qint64 time) ui->mediaPosLabel->setText(formatDuration(time)); } +void MainWindow::handlePensBeingSynchronizedChanged() +{ + QStringList pens = _manager->pensBeingSynchronized(); + if (pens.isEmpty()) { + _statusLabel->setText(QString()); + } else { + _statusLabel->setText(tr("Synchronizing %1...").arg(pens.join(", "))); + } +} + void MainWindow::handleExport() { if (_curNotebookName == PAPER_REPLAY) { -- cgit v1.2.3