aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
authorGravatar mikeller <github@ike.ch>2021-05-16 15:39:47 +1200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2021-05-19 15:15:34 -0700
commit2d734c529b5eb389ca9526575c9520b444d21a30 (patch)
treeca34e7dd7eacdbb107079441ae1d13be49db117e /desktop-widgets
parent2264a5e16659f847187271e852473fb454f990d1 (diff)
downloadsubsurface-2d734c529b5eb389ca9526575c9520b444d21a30.tar.gz
desktop: Add the capability to copy / paste dive number and date / time.
This is adding the capability to select 'Dive number' and 'Date / Time' in the 'Copy dive components' dialog, and then copy them into the clipboard. When using 'Paste dive components, these values will then be pasted into the selected dive(s). This is intended to help with workflows that import dive information from two different sources, like general information from another logging program, and CCR ppO2 sensor readings from a unit log, and then stitch them together into one cohesive entry with all data per dive. Copied data is also output into formatted text when pasting the clipboard outside of the application: ``` Dive number: 401 Date / time: Sun 2 May 2021 12:00 AM ``` No translations have been added as of now - I could not find any information on how strings are translated for this project. Signed-off-by: Michael Keller <github@ike.ch>
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/divecomponentselection.ui14
-rw-r--r--desktop-widgets/simplewidgets.cpp8
2 files changed, 22 insertions, 0 deletions
diff --git a/desktop-widgets/divecomponentselection.ui b/desktop-widgets/divecomponentselection.ui
index 05e989174..16b4d1589 100644
--- a/desktop-widgets/divecomponentselection.ui
+++ b/desktop-widgets/divecomponentselection.ui
@@ -137,6 +137,20 @@
</property>
</widget>
</item>
+ <item row="5" column="1">
+ <widget class="QCheckBox" name="number">
+ <property name="text">
+ <string>Dive Number</string>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="1">
+ <widget class="QCheckBox" name="when">
+ <property name="text">
+ <string>Date / Time</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
diff --git a/desktop-widgets/simplewidgets.cpp b/desktop-widgets/simplewidgets.cpp
index 0b79dfe6d..366b57a84 100644
--- a/desktop-widgets/simplewidgets.cpp
+++ b/desktop-widgets/simplewidgets.cpp
@@ -312,6 +312,8 @@ DiveComponentSelection::DiveComponentSelection(QWidget *parent, struct dive *tar
UI_FROM_COMPONENT(tags);
UI_FROM_COMPONENT(cylinders);
UI_FROM_COMPONENT(weights);
+ UI_FROM_COMPONENT(number);
+ UI_FROM_COMPONENT(when);
connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *)));
QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this);
connect(close, SIGNAL(activated()), this, SLOT(close()));
@@ -332,6 +334,8 @@ void DiveComponentSelection::buttonClicked(QAbstractButton *button)
COMPONENT_FROM_UI(tags);
COMPONENT_FROM_UI(cylinders);
COMPONENT_FROM_UI(weights);
+ COMPONENT_FROM_UI(number);
+ COMPONENT_FROM_UI(when);
selective_copy_dive(current_dive, targetDive, *what, true);
QClipboard *clipboard = QApplication::clipboard();
QTextStream text;
@@ -376,6 +380,10 @@ void DiveComponentSelection::buttonClicked(QAbstractButton *button)
text << ws.description << ws.weight.grams / 1000 << "kg\n";
}
}
+ if (what->number)
+ text << tr("Dive number: ") << current_dive->number << "\n";
+ if (what->when)
+ text << tr("Date / time: ") << get_dive_date_string(current_dive->when) << "\n";
clipboard->setText(cliptext);
}
}