summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/tab-widgets/TabDiveEquipment.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'desktop-widgets/tab-widgets/TabDiveEquipment.cpp')
-rw-r--r--desktop-widgets/tab-widgets/TabDiveEquipment.cpp81
1 files changed, 0 insertions, 81 deletions
diff --git a/desktop-widgets/tab-widgets/TabDiveEquipment.cpp b/desktop-widgets/tab-widgets/TabDiveEquipment.cpp
index ea2d910ef..c5601f1ce 100644
--- a/desktop-widgets/tab-widgets/TabDiveEquipment.cpp
+++ b/desktop-widgets/tab-widgets/TabDiveEquipment.cpp
@@ -183,87 +183,6 @@ void TabDiveEquipment::editWeightWidget(const QModelIndex &index)
ui.weights->edit(index);
}
-// tricky little macro to edit all the selected dives
-// loop ove all DIVES and do WHAT.
-#define MODIFY_DIVES(DIVES, WHAT) \
- do { \
- for (dive *mydive: DIVES) { \
- invalidate_dive_cache(mydive); \
- WHAT; \
- } \
- mark_divelist_changed(true); \
- } while (0)
-
-// Get the list of selected dives, but put the current dive at the last position of the vector
-static QVector<dive *> getSelectedDivesCurrentLast()
-{
- QVector<dive *> res;
- struct dive *d;
- int i;
- for_each_dive (i, d) {
- if (d->selected && d != current_dive)
- res.append(d);
- }
- res.append(current_dive);
- return res;
-}
-
-// TODO: This is a temporary functions until undo of cylinders is implemented.
-// Therefore it is not worth putting it in a header.
-extern bool cylinders_equal(const dive *d1, const dive *d2);
-
-void TabDiveEquipment::acceptChanges()
-{
- bool do_replot = false;
-
- // now check if something has changed and if yes, edit the selected dives that
- // were identical with the master dive shown (and mark the divelist as changed)
- struct dive *cd = current_dive;
-
- // Get list of selected dives, but put the current dive last;
- // this is required in case the invocation wants to compare things
- // to the original value in current_dive like it should
- QVector<dive *> selectedDives = getSelectedDivesCurrentLast();
-
- if (cylindersModel->model()->changed) {
- mark_divelist_changed(true);
- MODIFY_DIVES(selectedDives,
- // 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)
- if (cylinders_equal(mydive, cd) && mydive != cd)
- copy_cylinder_types(&displayed_dive, cd);
- copy_cylinders(&displayed_dive.cylinders, &cd->cylinders);
- );
- /* if cylinders changed we may have changed gas change events
- * and sensor idx in samples as well
- * - so far this is ONLY supported for a single selected dive */
- struct divecomputer *tdc = &current_dive->dc;
- struct divecomputer *sdc = &displayed_dive.dc;
- while(tdc && sdc) {
- free_events(tdc->events);
- copy_events(sdc, tdc);
- free(tdc->sample);
- copy_samples(sdc, tdc);
- tdc = tdc->next;
- sdc = sdc->next;
- }
- do_replot = true;
- }
-
- if (do_replot)
- MainWindow::instance()->graphics->replot();
-
- cylindersModel->model()->changed = false;
-}
-
-void TabDiveEquipment::rejectChanges()
-{
- cylindersModel->model()->changed = false;
- cylindersModel->updateDive(current_dive);
- weightModel->updateDive(current_dive);
-}
-
void TabDiveEquipment::divesEdited(int i)
{
// No warning if only one dive was edited