Add various enhancements to profile export and dive data copy

... as suggested by Lubomir.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
Robert C. Helling 2019-02-03 15:47:52 +01:00
parent 041d38cc0e
commit 6a37d24a5a
5 changed files with 55 additions and 38 deletions

View file

@ -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

View file

@ -49,7 +49,7 @@
</sizepolicy>
</property>
<property name="title">
<string>Which components would you like to copy</string>
<string>Which components would you like to copy?</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
@ -67,34 +67,6 @@
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QCheckBox" name="divesite">
<property name="text">
<string>Dive site</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="suit">
<property name="text">
<string>Suit</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="visibility">
<property name="text">
<string>Visibility</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="notes">
<property name="text">
<string>Notes</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="tags">
<property name="text">
@ -109,6 +81,20 @@
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="divesite">
<property name="text">
<string>Dive site</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="visibility">
<property name="text">
<string>Visibility</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="cylinders">
<property name="text">
@ -116,6 +102,20 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="buddy">
<property name="text">
<string>Buddy</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="notes">
<property name="text">
<string>Notes</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="divemaster">
<property name="text">
@ -123,10 +123,10 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="buddy">
<item row="0" column="1">
<widget class="QCheckBox" name="suit">
<property name="text">
<string>Buddy</string>
<string>Suit</string>
</property>
</widget>
</item>
@ -140,6 +140,19 @@
</layout>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>You can paste these to another dive or as text to another application.</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">

View file

@ -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;

View file

@ -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);
};

View file

@ -184,7 +184,7 @@
<item>
<widget class="QRadioButton" name="exportProfile">
<property name="text">
<string>dive profile</string>
<string>Dive profile</string>
</property>
<attribute name="buttonGroup">
<string notr="true">exportGroup</string>