From ac7b085449fb49f54225d22c7c229da6ad120e2b Mon Sep 17 00:00:00 2001 From: Javier Date: Sun, 12 Sep 2021 19:41:12 +0200 Subject: remove PEN_EPOCH mistake and get usertime from the pen --- mainwindow.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'mainwindow.cc') diff --git a/mainwindow.cc b/mainwindow.cc index 8a32f2c..dae4ae6 100644 --- a/mainwindow.cc +++ b/mainwindow.cc @@ -96,10 +96,12 @@ void MainWindow::openNotebook(const QString &pen, const QString ¬ebook) _curPenName = pen; _curNotebookName = notebook; + Smartpen::PenTime userTime = _notebooks->penUserTime(pen); + if (_curNotebookName == PAPER_REPLAY) { QString replayDir = _notebooks->paperReplayDirectory(_curPenName); - _replay->open(replayDir, 0); + _replay->open(replayDir, PAPER_REPLAY_GUID, userTime); _replayModel->refresh(); ui->pane2Stack->setCurrentWidget(ui->paperReplayView); @@ -108,6 +110,7 @@ void MainWindow::openNotebook(const QString &pen, const QString ¬ebook) qDebug() << "Opening notebook" << _curPenName << _curNotebookName << nbDir; + ui->notebookView->setPenUserTime(userTime); ui->notebookView->setPaperReplay(_notebooks->paperReplayDirectory(_curPenName)); ui->notebookView->setNotebook(nbDir); ui->pane2Stack->setCurrentWidget(ui->notebookView); @@ -215,9 +218,12 @@ void MainWindow::handlePaperReplayRequested(const QString &file, qint64 time) QString filePath = finfo.canonicalFilePath(); if (_media->currentSource().fileName() != filePath) { + qDebug() << "requesting media " << filePath; _media->setCurrentSource(QUrl::fromLocalFile(filePath)); } + qDebug() << "requesting media seek to" << time << "/" << _media->totalTime(); + switch (_media->state()) { case Phonon::PlayingState: case Phonon::BufferingState: @@ -250,6 +256,7 @@ void MainWindow::handleMediaStateChange(Phonon::State state) ui->playButton->setVisible(false); ui->pauseButton->setVisible(true); if (_pendingSeek) { + qDebug() << "requesting (pending) media seek to" << _pendingSeek << "/" << _media->totalTime(); _media->seek(_pendingSeek); _pendingSeek = 0; } -- cgit v1.2.3