diff options
Diffstat (limited to 'src/gui/previewwindow.cpp')
-rw-r--r-- | src/gui/previewwindow.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/gui/previewwindow.cpp b/src/gui/previewwindow.cpp index c27c1be..ec66f81 100644 --- a/src/gui/previewwindow.cpp +++ b/src/gui/previewwindow.cpp @@ -156,11 +156,27 @@ void PreviewWindow::render() { void PreviewWindow::exportImage() { + QSettings settings("tikzit", "tikzit"); if (_doc == nullptr) return; ExportDialog *d = new ExportDialog(this); int ret = d->exec(); if (ret == QDialog::Accepted) { - qDebug() << "save accepted"; + bool success; + if (d->fileFormat() == ExportDialog::PDF) { + success = _doc->exportPdf(d->filePath()); + } else { + success = _doc->exportImage( + d->filePath(), + (d->fileFormat() == ExportDialog::PNG) ? "PNG" : "JPG", + d->size()); + } + + if (!success) { + QMessageBox::warning(this, + "Error", + "Could not write to: '" + d->filePath() + + "'. Check file permissions or choose a new location."); + } } } |