From fd2a247a065548422b828d3055729e435a918f42 Mon Sep 17 00:00:00 2001 From: Javier Date: Sun, 19 Sep 2021 20:55:17 +0200 Subject: add InkML export support, fix bug with page layout in notebookview --- mainwindow.cc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'mainwindow.cc') diff --git a/mainwindow.cc b/mainwindow.cc index e7a73fa..d8a935c 100644 --- a/mainwindow.cc +++ b/mainwindow.cc @@ -154,6 +154,18 @@ void MainWindow::exportCurrentPageAsTXYP(const QString &file, bool relativeTime) f.close(); } +void MainWindow::exportCurrentPageAsInkML(const QString &file) +{ + QFile f(file); + if (!f.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text)) { + QMessageBox::warning(this, tr("Export page"), + tr("Could not export current page to '%s'").arg(file)); + return; + } + ui->notebookView->exportPageAsInkML(&f, ui->notebookView->curPage()); + f.close(); +} + void MainWindow::exportCurrentPaperReplayAsAac(const QString &file) { QString src = _media->currentSource().fileName(); @@ -349,6 +361,7 @@ void MainWindow::handleExport() filters << tr("Current page as PNG image (*.png)") << tr("Current page as SVG image (*.svg)") << tr("Current page as TXYP (*.txyp)") + << tr("Current page as InkML (*.inkml)") << tr("Current audio as AAC (*.aac)"); int filterIndex = settings.value("filetype").toInt(); QString filter = filters.value(filterIndex); @@ -378,6 +391,12 @@ void MainWindow::handleExport() exportCurrentPageAsTXYP(fileName, settings.value("txyp_relative_t", true).toBool()); break; case 3: + if (!fileName.endsWith(".inkml", Qt::CaseInsensitive)) { + fileName.append(".inkml"); + } + exportCurrentPageAsInkML(fileName); + break; + case 4: if (!fileName.endsWith(".aac", Qt::CaseInsensitive)) { fileName.append(".aac"); } -- cgit v1.2.3