Created a placeholder for the Equipment Edition.

This creates a placeholder for the equipment edition,
it will ease the 'revert' and 'apply' when editing
multi dives.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
Tomaz Canabrava 2013-09-25 13:30:51 -03:00
parent 95e094c325
commit 4f0112c420
2 changed files with 12 additions and 2 deletions

View file

@ -329,8 +329,10 @@ void MainTab::updateDiveInfo(int dive)
ui->timeLimits->setAverage(get_time_string(seconds, 0));
ui->timeLimits->setMaximum(get_time_string(stats_selection.longest_time.seconds, 0));
ui->timeLimits->setMinimum(get_time_string(stats_selection.shortest_time.seconds, 0));
cylindersModel->setDive(d);
weightModel->setDive(d);
multiEditEquipmentPlaceholder = *d;
cylindersModel->setDive(&multiEditEquipmentPlaceholder);
weightModel->setDive(&multiEditEquipmentPlaceholder);
} else {
/* clear the fields */
ui->rating->setCurrentStars(0);

View file

@ -81,6 +81,14 @@ private:
WeightModel *weightModel;
CylindersModel *cylindersModel;
QMap<dive*, NotesBackup> notesBackup;
/* since the multi-edition of the equipment is fairly more
* complex than a single item, because it involves a Qt
* Model to edit things, we are copying the first selected
* dive to this structure, making all editions there,
* then applying the changes on the other dives.*/
struct dive multiEditEquipmentPlaceholder;
enum { NONE, DIVE, TRIP, ADD } editMode;
Completers completers;
void enableEdition();