From 95326274be5dacbf9a47906c46f46cc1f5275ed8 Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Sun, 3 Feb 2019 15:47:52 +0100 Subject: Add various enhancements to profile export and dive data copy ... as suggested by Lubomir. Signed-off-by: Robert C. Helling Signed-off-by: Dirk Hohndel --- CHANGELOG.md | 1 + desktop-widgets/divecomponentselection.ui | 63 +++++++++++++++++++------------ desktop-widgets/divelogexportdialog.cpp | 10 +++-- desktop-widgets/divelogexportdialog.h | 2 +- desktop-widgets/divelogexportdialog.ui | 2 +- 5 files changed, 48 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b36250f88..1d21fbf79 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ - Desktop: make sure cloud storage email addresses are lower case only - Desktop: Fix editing of dive-time [#1975] - Export option for profile picture +- Desktop: Add export option for profile picture [#1962] - Export: fix picture thumbnails [#1963] - Desktop: remove support for the "Share on Facebook" feature. Rationale: It is fairly easy to share images on Facebook, thus it was decided diff --git a/desktop-widgets/divecomponentselection.ui b/desktop-widgets/divecomponentselection.ui index ba58c546b..05e989174 100644 --- a/desktop-widgets/divecomponentselection.ui +++ b/desktop-widgets/divecomponentselection.ui @@ -49,7 +49,7 @@ - Which components would you like to copy + Which components would you like to copy? @@ -67,52 +67,52 @@ 0 - - + + - Dive site + Tags - - + + - Suit + Weights - - + + - Visibility + Dive site - - + + - Notes + Visibility - - + + - Tags + Cylinders - - + + - Weights + Buddy - - + + - Cylinders + Notes @@ -123,10 +123,10 @@ - - + + - Buddy + Suit @@ -140,6 +140,19 @@ + + + + You can paste these to another dive or as text to another application. + + + Qt::PlainText + + + true + + + diff --git a/desktop-widgets/divelogexportdialog.cpp b/desktop-widgets/divelogexportdialog.cpp index e22aff433..d3a7106e6 100644 --- a/desktop-widgets/divelogexportdialog.cpp +++ b/desktop-widgets/divelogexportdialog.cpp @@ -94,6 +94,8 @@ void DiveLogExportDialog::showExplanation() ui->description->setText(tr("Write depths of images to file.")); } else if (ui->exportTeX->isChecked()) { ui->description->setText(tr("Write dive as TeX macros to file.")); + } else if (ui->exportProfile->isChecked()) { + ui->description->setText(tr("Write the profile image as PNG file.")); } } @@ -168,7 +170,7 @@ void DiveLogExportDialog::on_buttonBox_accepted() if (!filename.isNull() && !filename.isEmpty()) export_TeX(qPrintable(filename), ui->exportSelected->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()); } @@ -231,18 +233,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; diff --git a/desktop-widgets/divelogexportdialog.h b/desktop-widgets/divelogexportdialog.h index cd1c56112..fe403b11a 100644 --- a/desktop-widgets/divelogexportdialog.h +++ b/desktop-widgets/divelogexportdialog.h @@ -34,7 +34,7 @@ private: void exportHtmlInit(const QString &filename); void export_depths(const char *filename, const bool selected_only); void export_TeX(const char *filename, const bool selected_only); - void exportProfile(const QString filename, const bool selected_only); + void exportProfile(QString filename, const bool selected_only); void saveProfile(const struct dive *dive, const QString filename); }; diff --git a/desktop-widgets/divelogexportdialog.ui b/desktop-widgets/divelogexportdialog.ui index eb51074d2..29a784fde 100644 --- a/desktop-widgets/divelogexportdialog.ui +++ b/desktop-widgets/divelogexportdialog.ui @@ -184,7 +184,7 @@ - dive profile + Dive profile exportGroup -- cgit v1.2.3-70-g09d2