diff options
author | Robert C. Helling <helling@atdotde.de> | 2019-02-03 15:47:52 +0100 |
---|---|---|
committer | Robert C. Helling <helling@atdotde.de> | 2019-02-07 16:06:43 +0100 |
commit | 6a37d24a5a30b9f9fc724695655803c40351186e (patch) | |
tree | 54eaa5c944a75174b6ee3f403d28efe9e994b58c /desktop-widgets/divelogexportdialog.cpp | |
parent | 041d38cc0e55d0f2cc5aee24c06a34eedc6ab229 (diff) | |
download | subsurface-6a37d24a5a30b9f9fc724695655803c40351186e.tar.gz |
Add various enhancements to profile export and dive data copy
... as suggested by Lubomir.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Diffstat (limited to 'desktop-widgets/divelogexportdialog.cpp')
-rw-r--r-- | desktop-widgets/divelogexportdialog.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/desktop-widgets/divelogexportdialog.cpp b/desktop-widgets/divelogexportdialog.cpp index 04f0b03de..3e712fc5d 100644 --- a/desktop-widgets/divelogexportdialog.cpp +++ b/desktop-widgets/divelogexportdialog.cpp @@ -96,6 +96,8 @@ void DiveLogExportDialog::showExplanation() ui->description->setText(tr("Write dive as TeX macros to file.")); } else if (ui->exportLaTeX->isChecked()) { ui->description->setText(tr("Write dive as LaTeX macros to file.")); + } else if (ui->exportProfile->isChecked()) { + ui->description->setText(tr("Write the profile image as PNG file.")); } } @@ -170,7 +172,7 @@ void DiveLogExportDialog::on_buttonBox_accepted() if (!filename.isNull() && !filename.isEmpty()) export_TeX(qPrintable(filename), ui->exportSelected->isChecked(), ui->exportTeX->isChecked()); } else if (ui->exportProfile->isChecked()) { - filename = QFileDialog::getSaveFileName(this, tr("Save image depths"), lastDir); + filename = QFileDialog::getSaveFileName(this, tr("Save profile image"), lastDir); if (!filename.isNull() && !filename.isEmpty()) exportProfile(qPrintable(filename), ui->exportSelected->isChecked()); } @@ -233,18 +235,20 @@ void DiveLogExportDialog::export_depths(const char *filename, const bool selecte free_buffer(&buf); } -void DiveLogExportDialog::exportProfile(const QString filename, const bool selected_only) +void DiveLogExportDialog::exportProfile(QString filename, const bool selected_only) { struct dive *dive; int i; int count = 0; + if (!filename.endsWith(".png", Qt::CaseInsensitive)) + filename = filename.append(".png"); QFileInfo fi(filename); for_each_dive (i, dive) { if (selected_only && !dive->selected) continue; if (count) - saveProfile(dive, fi.completeBaseName().append(QString("-%1.").arg(count)).append(fi.suffix())); + saveProfile(dive, fi.path() + QDir::separator() + fi.completeBaseName().append(QString("-%1.").arg(count)) + fi.suffix()); else saveProfile(dive, filename); ++count; |