mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-01 06:30:26 +00:00
Enable/Disable toolbar element in freedive mode
Signed-off-by: Giorgio Marzano <marzano.giorgio@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
45b1d0d73d
commit
166d587197
2 changed files with 49 additions and 1 deletions
|
@ -114,7 +114,6 @@ MainWindow::MainWindow() : QMainWindow(),
|
|||
toolBar->addAction(a);
|
||||
toolBar->setOrientation(Qt::Vertical);
|
||||
toolBar->setIconSize(QSize(24,24));
|
||||
|
||||
QWidget *profileContainer = new QWidget();
|
||||
QHBoxLayout *profLayout = new QHBoxLayout();
|
||||
profLayout->setSpacing(0);
|
||||
|
@ -251,6 +250,7 @@ MainWindow::MainWindow() : QMainWindow(),
|
|||
ui.actionFacebook->setEnabled(false);
|
||||
#endif
|
||||
|
||||
|
||||
ui.menubar->show();
|
||||
set_git_update_cb(&updateProgress);
|
||||
}
|
||||
|
@ -335,6 +335,48 @@ void MainWindow::recreateDiveList()
|
|||
SuitsFilterModel::instance()->repopulate();
|
||||
}
|
||||
|
||||
void MainWindow::configureToolbar() {
|
||||
if (selected_dive>0) {
|
||||
if (current_dive->dc.divemode == FREEDIVE) {
|
||||
ui.profCalcCeiling->setDisabled(true);
|
||||
ui.profCalcAllTissues ->setDisabled(true);
|
||||
ui.profIncrement3m->setDisabled(true);
|
||||
ui.profDcCeiling->setDisabled(true);
|
||||
ui.profPhe->setDisabled(true);
|
||||
ui.profPn2->setDisabled(true); //TODO is the same as scuba?
|
||||
ui.profPO2->setDisabled(true); //TODO is the same as scuba?
|
||||
ui.profRuler->setDisabled(false);
|
||||
ui.profScaled->setDisabled(false); // measuring and scaling
|
||||
ui.profTogglePicture->setDisabled(false);
|
||||
ui.profTankbar->setDisabled(true);
|
||||
ui.profMod->setDisabled(true);
|
||||
ui.profNdl_tts->setDisabled(true);
|
||||
ui.profEad->setDisabled(true);
|
||||
ui.profSAC->setDisabled(true);
|
||||
ui.profHR->setDisabled(false);
|
||||
ui.profTissues->setDisabled(true);
|
||||
} else {
|
||||
ui.profCalcCeiling->setDisabled(false);
|
||||
ui.profCalcAllTissues ->setDisabled(false);
|
||||
ui.profIncrement3m->setDisabled(false);
|
||||
ui.profDcCeiling->setDisabled(false);
|
||||
ui.profPhe->setDisabled(false);
|
||||
ui.profPn2->setDisabled(false);
|
||||
ui.profPO2->setDisabled(false); // partial pressure graphs
|
||||
ui.profRuler->setDisabled(false);
|
||||
ui.profScaled->setDisabled(false); // measuring and scaling
|
||||
ui.profTogglePicture->setDisabled(false);
|
||||
ui.profTankbar->setDisabled(false);
|
||||
ui.profMod->setDisabled(false);
|
||||
ui.profNdl_tts->setDisabled(false); // various values that a user is either interested in or not
|
||||
ui.profEad->setDisabled(false);
|
||||
ui.profSAC->setDisabled(false);
|
||||
ui.profHR->setDisabled(false); // very few dive computers support this
|
||||
ui.profTissues->setDisabled(false);; // maybe less frequently used
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::current_dive_changed(int divenr)
|
||||
{
|
||||
if (divenr >= 0) {
|
||||
|
@ -342,6 +384,7 @@ void MainWindow::current_dive_changed(int divenr)
|
|||
}
|
||||
graphics()->plotDive();
|
||||
information()->updateDiveInfo();
|
||||
configureToolbar();
|
||||
GlobeGPS::instance()->reload();
|
||||
}
|
||||
|
||||
|
@ -654,6 +697,7 @@ bool MainWindow::plannerStateClean()
|
|||
void MainWindow::refreshProfile()
|
||||
{
|
||||
showProfile();
|
||||
configureToolbar();
|
||||
graphics()->replot(get_dive(selected_dive));
|
||||
DivePictureModel::instance()->updateDivePictures();
|
||||
}
|
||||
|
@ -789,6 +833,7 @@ void MainWindow::on_actionAddDive_triggered()
|
|||
|
||||
graphics()->setAddState();
|
||||
DivePlannerPointsModel::instance()->createSimpleDive();
|
||||
configureToolbar();
|
||||
graphics()->plotDive();
|
||||
}
|
||||
|
||||
|
@ -968,6 +1013,7 @@ void MainWindow::on_actionPreviousDC_triggered()
|
|||
{
|
||||
unsigned nrdc = number_of_computers(current_dive);
|
||||
dc_number = (dc_number + nrdc - 1) % nrdc;
|
||||
configureToolbar();
|
||||
graphics()->plotDive();
|
||||
information()->updateDiveInfo();
|
||||
}
|
||||
|
@ -976,6 +1022,7 @@ void MainWindow::on_actionNextDC_triggered()
|
|||
{
|
||||
unsigned nrdc = number_of_computers(current_dive);
|
||||
dc_number = (dc_number + 1) % nrdc;
|
||||
configureToolbar();
|
||||
graphics()->plotDive();
|
||||
information()->updateDiveInfo();
|
||||
}
|
||||
|
|
|
@ -224,6 +224,7 @@ private:
|
|||
|
||||
bool plannerStateClean();
|
||||
void setupForAddAndPlan(const char *model);
|
||||
void configureToolbar();
|
||||
QDialog *survey;
|
||||
struct dive copyPasteDive;
|
||||
struct dive_components what;
|
||||
|
|
Loading…
Reference in a new issue