summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--qt-ui/maintab.cpp2
-rw-r--r--qt-ui/maintab.h3
-rw-r--r--qt-ui/mainwindow.cpp1
-rw-r--r--qt-ui/profile/profilewidget2.cpp6
4 files changed, 12 insertions, 0 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 96e2efc1c..2fd07878b 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -761,6 +761,7 @@ void MainTab::acceptChanges()
editMode = NONE;
MainWindow::instance()->refreshDisplay();
MainWindow::instance()->graphics()->replot();
+ emit addDiveFinished();
} else {
editMode = NONE;
MainWindow::instance()->dive_list()->rememberSelection();
@@ -861,6 +862,7 @@ void MainTab::rejectChanges()
delete_single_dive(selected_dive);
MainWindow::instance()->dive_list()->reload(DiveTripModel::CURRENT);
MainWindow::instance()->dive_list()->restoreSelection();
+ emit addDiveFinished();
}
if (selected_dive >= 0) {
multiEditEquipmentPlaceholder = *get_dive(selected_dive);
diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h
index 241f4c7e6..939e387d2 100644
--- a/qt-ui/maintab.h
+++ b/qt-ui/maintab.h
@@ -67,6 +67,9 @@ public:
bool isEditing();
void updateCoordinatesText(qreal lat, qreal lon);
void nextInputField(QKeyEvent *event);
+signals:
+ void addDiveFinished();
+
public
slots:
void addCylinder_clicked();
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index c56d02e71..33946f34f 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -75,6 +75,7 @@ MainWindow::MainWindow() : QMainWindow(),
connect(ui.actionRecent2, SIGNAL(triggered(bool)), this, SLOT(recentFileTriggered(bool)));
connect(ui.actionRecent3, SIGNAL(triggered(bool)), this, SLOT(recentFileTriggered(bool)));
connect(ui.actionRecent4, SIGNAL(triggered(bool)), this, SLOT(recentFileTriggered(bool)));
+ connect(information(), SIGNAL(addDiveFinished()), ui.newProfile, SLOT(setProfileState()));
ui.mainErrorMessage->hide();
initialUiSetup();
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index f0b7bc380..919db5c38 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -606,6 +606,7 @@ void ProfileWidget2::setEmptyState()
if (currentState == EMPTY)
return;
+ setBackgroundBrush(getColor(::BACKGROUND, isGrayscale));
dataModel->clear();
currentState = EMPTY;
MainWindow::instance()->setToolButtonsEnabled(false);
@@ -642,6 +643,11 @@ void ProfileWidget2::setProfileState()
if (currentState == PROFILE)
return;
+ if (dive_table.nr == 0) { // oops, called to plot something with zero dives. bail out.
+ setEmptyState();
+ return;
+ }
+
currentState = PROFILE;
MainWindow::instance()->setToolButtonsEnabled(true);
toolTipItem->readPos();