diff --git a/CHANGELOG.md b/CHANGELOG.md index bfa0a728f..73ac81407 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -- 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,34 +67,6 @@ 0 - - - - Dive site - - - - - - - Suit - - - - - - - Visibility - - - - - - - Notes - - - @@ -109,6 +81,20 @@ + + + + Dive site + + + + + + + Visibility + + + @@ -116,6 +102,20 @@ + + + + Buddy + + + + + + + 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 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; diff --git a/desktop-widgets/divelogexportdialog.h b/desktop-widgets/divelogexportdialog.h index d7905dd94..ce6106be0 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, bool plain); - 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 fe4827060..9080c647f 100644 --- a/desktop-widgets/divelogexportdialog.ui +++ b/desktop-widgets/divelogexportdialog.ui @@ -184,7 +184,7 @@ - dive profile + Dive profile exportGroup