diff options
Diffstat (limited to 'qt-ui/mainwindow.cpp')
-rw-r--r-- | qt-ui/mainwindow.cpp | 46 |
1 files changed, 25 insertions, 21 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 5a2f872b4..2be60edb7 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -280,7 +280,8 @@ void MainWindow::on_actionAddDive_triggered() // 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 = tr("manually added dive").toLocal8Bit().constData(); // do not use tr here since it expects a char*. + const char* model = strdup(tr("manually added dive").toLocal8Bit().constData()); + dive->dc.model = model; // do not use tr here since it expects a char*. record_dive(dive); select_dive(get_divenr(dive)); ui.InfoWidget->updateDiveInfo(selected_dive); @@ -782,13 +783,7 @@ void MainWindow::importFiles(const QStringList fileNames) } } process_dives(TRUE, FALSE); - - ui.InfoWidget->reload(); - ui.globe->reload(); - ui.ListWidget->reload(DiveTripModel::TREE); - ui.ListWidget->setFocus(); - WSInfoModel *wsim = WSInfoModel::instance(); - wsim->updateInfo(); + refreshDisplay(); } void MainWindow::loadFiles(const QStringList fileNames) @@ -813,25 +808,34 @@ void MainWindow::loadFiles(const QStringList fileNames) process_dives(FALSE, FALSE); - ui.InfoWidget->reload(); - ui.globe->reload(); - ui.ListWidget->reload(DiveTripModel::TREE); - ui.ListWidget->setFocus(); - WSInfoModel *wsim = WSInfoModel::instance(); - wsim->updateInfo(); + refreshDisplay(); ui.actionAutoGroup->setChecked(autogroup); } void MainWindow::on_actionImportCSV_triggered() { - CSVImportDialog *csvImport = new(CSVImportDialog); + CSVImportDialog *csvImport = new CSVImportDialog(); csvImport->show(); process_dives(TRUE, FALSE); + refreshDisplay(); +} - ui.InfoWidget->reload(); - ui.globe->reload(); - ui.ListWidget->reload(DiveTripModel::TREE); - ui.ListWidget->setFocus(); - WSInfoModel *wsim = WSInfoModel::instance(); - wsim->updateInfo(); + +void MainWindow::editCurrentDive() +{ + struct dive *d = current_dive; + QString defaultDC(d->dc.model); + + if (defaultDC == tr("manually added dive")){ + disableDcShortcuts(); + DivePlannerPointsModel::instance()->setPlanMode(false); + ui.stackedWidget->setCurrentIndex(PLANNERPROFILE); // Planner. + ui.infoPane->setCurrentIndex(MAINTAB); + DivePlannerPointsModel::instance()->loadFromDive(d); + ui.InfoWidget->enableEdition(MainTab::MANUALLY_ADDED_DIVE); + } + else if (defaultDC == tr("Simulated Dive")){ + + } + } |