Switch components for cut/paste dive to dive site logic

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-02-12 20:58:03 -08:00
parent 99ba2f0687
commit 32da12664d
4 changed files with 30 additions and 41 deletions

3
dive.h
View file

@ -349,14 +349,13 @@ extern int get_cylinder_idx_by_use(struct dive *dive, enum cylinderuse cylinder_
/* when selectively copying dive information, which parts should be copied? */
struct dive_components {
unsigned int location : 1;
unsigned int divesite : 1;
unsigned int notes : 1;
unsigned int divemaster : 1;
unsigned int buddy : 1;
unsigned int suit : 1;
unsigned int rating : 1;
unsigned int visibility : 1;
unsigned int gps : 1;
unsigned int tags : 1;
unsigned int cylinders : 1;
unsigned int weights : 1;

View file

@ -9,8 +9,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>308</width>
<height>263</height>
<width>401</width>
<height>317</height>
</rect>
</property>
<property name="sizePolicy">
@ -41,9 +41,9 @@
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QCheckBox" name="location">
<widget class="QCheckBox" name="divesite">
<property name="text">
<string>Location</string>
<string>Dive site</string>
</property>
</widget>
</item>
@ -54,34 +54,6 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="gps">
<property name="text">
<string>GPS coordinates</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="divemaster">
<property name="text">
<string>Divemaster</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="buddy">
<property name="text">
<string>Buddy</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="rating">
<property name="text">
<string>Rating</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="visibility">
<property name="text">
@ -117,6 +89,27 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="divemaster">
<property name="text">
<string>Divemaster</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="buddy">
<property name="text">
<string>Buddy</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="rating">
<property name="text">
<string>Rating</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View file

@ -1314,7 +1314,6 @@ void MainTab::showAndTriggerEditSelective(struct dive_components what)
// take the data in our copyPasteDive and apply it to selected dives
enableEdition();
copyPaste = true;
SHOW_SELECTIVE(location);
SHOW_SELECTIVE(buddy);
SHOW_SELECTIVE(divemaster);
SHOW_SELECTIVE(suit);
@ -1329,8 +1328,8 @@ void MainTab::showAndTriggerEditSelective(struct dive_components what)
ui.rating->setCurrentStars(displayed_dive.rating);
if (what.visibility)
ui.visibility->setCurrentStars(displayed_dive.visibility);
if (what.gps)
updateGpsCoordinates();
if (what.divesite)
ui.location->setText(get_dive_location(&displayed_dive));
if (what.tags) {
char buf[1024];
taglist_get_tagstring(displayed_dive.tag_list, buf, 1024);

View file

@ -457,8 +457,7 @@ DiveComponentSelection::DiveComponentSelection(QWidget *parent, struct dive *tar
{
ui.setupUi(this);
what = _what;
UI_FROM_COMPONENT(location);
UI_FROM_COMPONENT(gps);
UI_FROM_COMPONENT(divesite);
UI_FROM_COMPONENT(divemaster);
UI_FROM_COMPONENT(buddy);
UI_FROM_COMPONENT(rating);
@ -478,8 +477,7 @@ DiveComponentSelection::DiveComponentSelection(QWidget *parent, struct dive *tar
void DiveComponentSelection::buttonClicked(QAbstractButton *button)
{
if (ui.buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole) {
COMPONENT_FROM_UI(location);
COMPONENT_FROM_UI(gps);
COMPONENT_FROM_UI(divesite);
COMPONENT_FROM_UI(divemaster);
COMPONENT_FROM_UI(buddy);
COMPONENT_FROM_UI(rating);