aboutsummaryrefslogtreecommitdiff
path: root/mainwindow.cc
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2015-06-14 17:17:12 +0200
committerJavier <dev.git@javispedro.com>2015-06-14 17:17:12 +0200
commite3c4aa5dffecc8f62958c44035b2e58de0228eb4 (patch)
tree8fb5f24098e094fe1f103092c6fed07a116cb91a /mainwindow.cc
parentaa2999041d405215d5a7e8c494e276ebbfc089fc (diff)
downloadscribiu-e3c4aa5dffecc8f62958c44035b2e58de0228eb4.tar.gz
scribiu-e3c4aa5dffecc8f62958c44035b2e58de0228eb4.zip
better synchronization status reporting
Diffstat (limited to 'mainwindow.cc')
-rw-r--r--mainwindow.cc27
1 files changed, 26 insertions, 1 deletions
diff --git a/mainwindow.cc b/mainwindow.cc
index 0fdf38d..b49a8da 100644
--- a/mainwindow.cc
+++ b/mainwindow.cc
@@ -1,4 +1,5 @@
#include <QtCore/QDebug>
+#include <QtCore/QTimer>
#include <QtGui/QFileDialog>
#include <QtGui/QMessageBox>
#include <QtSvg/QSvgGenerator>
@@ -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) {