aboutsummaryrefslogtreecommitdiff
path: root/mainwindow.cc
diff options
context:
space:
mode:
Diffstat (limited to 'mainwindow.cc')
-rw-r--r--mainwindow.cc21
1 files changed, 20 insertions, 1 deletions
diff --git a/mainwindow.cc b/mainwindow.cc
index bba19cc..8a32f2c 100644
--- a/mainwindow.cc
+++ b/mainwindow.cc
@@ -117,7 +117,7 @@ void MainWindow::openNotebook(const QString &pen, const QString &notebook)
void MainWindow::exportCurrentPageAsPng(const QString &file)
{
qDebug() << "Exporting current page" << ui->notebookView->curPage() << "to" << file;
- QImage image = ui->notebookView->exportPage(ui->notebookView->curPage());
+ QImage image = ui->notebookView->exportPageAsImage(ui->notebookView->curPage());
if (!image.save(file, "PNG")) {
QMessageBox::warning(this, tr("Export page"),
tr("Could not export current page to '%s'").arg(file));
@@ -139,6 +139,18 @@ void MainWindow::exportCurrentPageAsSvg(const QString &file)
painter.end();
}
+void MainWindow::exportCurrentPageAsStrokeListTxt(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->exportPageAsStrokeList(&f, ui->notebookView->curPage());
+ f.close();
+}
+
void MainWindow::exportCurrentPaperReplayAsAac(const QString &file)
{
QString src = _media->currentSource().fileName();
@@ -311,6 +323,7 @@ void MainWindow::handleExport()
QStringList filters;
filters << tr("Current page as PNG image (*.png)")
<< tr("Current page as SVG image (*.svg)")
+ << tr("Current page as stroke list text file (*.txt)")
<< tr("Current audio as AAC (*.aac)");
QString filter;
QString fileName = QFileDialog::getSaveFileName(this, tr("Export page"), QString(),
@@ -331,6 +344,12 @@ void MainWindow::handleExport()
exportCurrentPageAsSvg(fileName);
break;
case 2:
+ if (!fileName.endsWith(".txt", Qt::CaseInsensitive)) {
+ fileName.append(".txt");
+ }
+ exportCurrentPageAsStrokeListTxt(fileName);
+ break;
+ case 3:
if (!fileName.endsWith(".aac", Qt::CaseInsensitive)) {
fileName.append(".aac");
}