From 0615dcb854da736e11665ad3387ecba0adbd8cd8 Mon Sep 17 00:00:00 2001 From: Aleks Kissinger Date: Wed, 2 Jan 2019 11:42:37 +0100 Subject: finished export dialog (closes #49) --- src/gui/previewwindow.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/gui/previewwindow.cpp') 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."); + } } } -- cgit v1.2.3