mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Hook up adding a dive
This gets things mostly right. It creates a dive and uses the planner widget to create samples which are copied into the dive. It fills in some reasonable defaults (DC model, timestamp), but doesn't allow editing the timestamp (or the temperatures and air pressure). On accept the planner gets reset and the dive appears correctly in the dive list. Cancel still needs to be handled. And I bet there are many subtle bugs lurking here and there. But it's a start. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
5a96389cd3
commit
46b125782e
6 changed files with 53 additions and 10 deletions
|
@ -36,6 +36,8 @@
|
|||
#include "about.h"
|
||||
#include "printdialog.h"
|
||||
|
||||
#include "glib/gi18n.h"
|
||||
|
||||
static MainWindow* instance = 0;
|
||||
|
||||
MainWindow* mainWindow()
|
||||
|
@ -255,14 +257,25 @@ void MainWindow::on_actionEditDeviceNames_triggered()
|
|||
|
||||
void MainWindow::on_actionAddDive_triggered()
|
||||
{
|
||||
// clear the selection
|
||||
for (int i = 0; i < dive_table.nr; i++) {
|
||||
struct dive *d = get_dive(i);
|
||||
if (d && d->selected)
|
||||
deselect_dive(i);
|
||||
}
|
||||
disableDcShortcuts();
|
||||
DivePlannerPointsModel::instance()->setPlanMode(false);
|
||||
// now cheat - create one dive that we use to store the info tab data in
|
||||
struct dive *dive = alloc_dive();
|
||||
dive->when = QDateTime::currentMSecsSinceEpoch() / 1000L;
|
||||
dive->dc.model = _("manually added dive");
|
||||
record_dive(dive);
|
||||
select_dive(get_divenr(dive));
|
||||
ui->InfoWidget->updateDiveInfo(selected_dive);
|
||||
ui->stackedWidget->setCurrentIndex(1);
|
||||
ui->infoPane->setCurrentIndex(0);
|
||||
ui->InfoWidget->clearStats();
|
||||
ui->InfoWidget->clearInfo();
|
||||
ui->InfoWidget->clearEquipment();
|
||||
ui->InfoWidget->updateDiveInfo(-1);
|
||||
refreshDisplay();
|
||||
ui->InfoWidget->addDiveStarted();
|
||||
}
|
||||
|
||||
void MainWindow::on_actionRenumber_triggered()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue