diff options
author | Aleks Kissinger <aleks0@gmail.com> | 2019-01-02 11:42:37 +0100 |
---|---|---|
committer | Aleks Kissinger <aleks0@gmail.com> | 2019-01-02 11:43:00 +0100 |
commit | 0615dcb854da736e11665ad3387ecba0adbd8cd8 (patch) | |
tree | 7e692ba39bdfeff39abb05f2cf9012ee1f98f4b0 /src/gui/previewwindow.cpp | |
parent | f68cf0d4ae6837b5cd95a43ab482b1f63c1ca54e (diff) |
finished export dialog (closes #49)
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."); + } } } |