aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets/tab-widgets
diff options
context:
space:
mode:
Diffstat (limited to 'desktop-widgets/tab-widgets')
-rw-r--r--desktop-widgets/tab-widgets/maintab.cpp59
-rw-r--r--desktop-widgets/tab-widgets/maintab.h2
2 files changed, 2 insertions, 59 deletions
diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp
index 84f64e0d0..8b23eb147 100644
--- a/desktop-widgets/tab-widgets/maintab.cpp
+++ b/desktop-widgets/tab-widgets/maintab.cpp
@@ -47,7 +47,6 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
weightModel(new WeightModel(this)),
cylindersModel(new CylindersModel(this)),
editMode(NONE),
- copyPaste(false),
lastSelectedDive(true),
lastTabSelectedDive(0),
lastTabSelectedDiveTrip(0),
@@ -288,7 +287,6 @@ void MainTab::enableEdition(EditMode newEditMode)
if (((newEditMode == DIVE || newEditMode == NONE) && current_dive == NULL) || editMode != NONE)
return;
modified = false;
- copyPaste = false;
if ((newEditMode == DIVE || newEditMode == NONE) &&
!isTripEdit &&
current_dive->dc.model &&
@@ -700,22 +698,11 @@ void MainTab::reload()
mark_divelist_changed(true); \
} while (0)
-#define EDIT_TEXT(what) \
- if (same_string(mydive->what, cd->what) || copyPaste) { \
- free(mydive->what); \
- mydive->what = copy_string(displayed_dive.what); \
- }
-
MainTab::EditMode MainTab::getEditMode() const
{
return editMode;
}
-#define EDIT_VALUE(what) \
- if (mydive->what == cd->what || copyPaste) { \
- mydive->what = displayed_dive.what; \
- }
-
void MainTab::refreshDisplayedDiveSite()
{
struct dive_site *ds = get_dive_site_for_dive(&displayed_dive);
@@ -812,7 +799,7 @@ void MainTab::acceptChanges()
MODIFY_DIVES(selectedDives,
for (int i = 0; i < MAX_CYLINDERS; i++) {
if (mydive != cd) {
- if (same_string(mydive->cylinder[i].type.description, cd->cylinder[i].type.description) || copyPaste) {
+ if (same_string(mydive->cylinder[i].type.description, cd->cylinder[i].type.description)) {
// if we started out with the same cylinder description (for multi-edit) or if we do copt & paste
// make sure that we have the same cylinder type and copy the gasmix, but DON'T copy the start
// and end pressures (those are per dive after all)
@@ -855,7 +842,7 @@ void MainTab::acceptChanges()
mark_divelist_changed(true);
MODIFY_DIVES(selectedDives,
for (int i = 0; i < MAX_WEIGHTSYSTEMS; i++) {
- if (mydive != cd && (copyPaste || same_string(mydive->weightsystem[i].description, cd->weightsystem[i].description))) {
+ if (mydive != cd && (same_string(mydive->weightsystem[i].description, cd->weightsystem[i].description))) {
mydive->weightsystem[i] = displayed_dive.weightsystem[i];
mydive->weightsystem[i].description = copy_string(displayed_dive.weightsystem[i].description);
}
@@ -1173,8 +1160,6 @@ void MainTab::on_visibility_valueChanged(int value)
}
#undef MODIFY_DIVES
-#undef EDIT_TEXT
-#undef EDIT_VALUE
void MainTab::editCylinderWidget(const QModelIndex &index)
{
@@ -1216,43 +1201,3 @@ void MainTab::clearTabs() {
}
clearEquipment();
}
-
-#define SHOW_SELECTIVE(_component) \
- if (what._component) \
- ui._component->setText(displayed_dive._component);
-
-void MainTab::showAndTriggerEditSelective(struct dive_components what)
-{
- // take the data in our copyPasteDive and apply it to selected dives
- enableEdition();
- copyPaste = true;
- SHOW_SELECTIVE(buddy);
- SHOW_SELECTIVE(divemaster);
- SHOW_SELECTIVE(suit);
- if (what.notes) {
- QString tmp(displayed_dive.notes);
- if (tmp.contains("<div")) {
- tmp.replace(QString("\n"), QString("<br>"));
- ui.notes->setHtml(tmp);
- } else {
- ui.notes->setPlainText(tmp);
- }
- }
- if (what.rating)
- ui.rating->setCurrentStars(displayed_dive.rating);
- if (what.visibility)
- ui.visibility->setCurrentStars(displayed_dive.visibility);
- if (what.divesite)
- ui.location->setCurrentDiveSite(displayed_dive.dive_site);
- if (what.tags) {
- ui.tagWidget->setText(get_taglist_string(displayed_dive.tag_list));
- }
- if (what.cylinders) {
- cylindersModel->updateDive();
- cylindersModel->changed = true;
- }
- if (what.weights) {
- weightModel->updateDive();
- weightModel->changed = true;
- }
-}
diff --git a/desktop-widgets/tab-widgets/maintab.h b/desktop-widgets/tab-widgets/maintab.h
index 5d341d287..83a19895a 100644
--- a/desktop-widgets/tab-widgets/maintab.h
+++ b/desktop-widgets/tab-widgets/maintab.h
@@ -55,7 +55,6 @@ public:
void updateCoordinatesText(qreal lat, qreal lon);
void refreshDisplayedDiveSite();
void nextInputField(QKeyEvent *event);
- void showAndTriggerEditSelective(struct dive_components what);
signals:
void addDiveFinished();
@@ -113,7 +112,6 @@ private:
TagCompletionModel tagModel;
Completers completers;
bool modified;
- bool copyPaste;
bool lastSelectedDive;
int lastTabSelectedDive;
int lastTabSelectedDiveTrip;