mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Cleanup: Turn widget accessor-functions into simple pointers
The keeps track of different sub widgets needed by other parts of the code, notably: MainTab PlannerDetails PlannerSettingsWidget ProfileWidget2 DivePlannerWidget DiveListView Access to these widgets was provided with accessor functions. Now these functions were very weird: instead of simply returning pointers that were stored in the class, they accessed a data structure which describes the different application states. But this data structure was "duck-typed", so there was an implicit agreement at which position the pointers to the widgets were put inside. The widgets were then down-cast by the accessor functions. This might make sense if the individual widgets could for some reason be replaced by other widgets [dynamic plugins?], but even then it would be strange, as one would expect to get a pointer to some base class. Therefore, directly store the properly typed pointers to the widgets and simply remove the accessor functions. Why bother? Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
11a211fb02
commit
78e2560296
14 changed files with 175 additions and 201 deletions
|
@ -275,7 +275,7 @@ void DiveLogExportDialog::export_TeX(const char *filename, const bool selected_o
|
||||||
if (selected_only && !dive->selected)
|
if (selected_only && !dive->selected)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ProfileWidget2 *profile = MainWindow::instance()->graphics();
|
ProfileWidget2 *profile = MainWindow::instance()->graphics;
|
||||||
profile->plotDive(dive, true);
|
profile->plotDive(dive, true);
|
||||||
profile->setToolTipVisibile(false);
|
profile->setToolTipVisibile(false);
|
||||||
QPixmap pix = QPixmap::grabWidget(profile);
|
QPixmap pix = QPixmap::grabWidget(profile);
|
||||||
|
|
|
@ -527,7 +527,7 @@ void DownloadFromDCWidget::on_ok_clicked()
|
||||||
delete_dive_from_table(&downloadTable, j);
|
delete_dive_from_table(&downloadTable, j);
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::instance()->dive_list()->unselectDives();
|
MainWindow::instance()->dive_list->unselectDives();
|
||||||
|
|
||||||
if (downloadTable.nr > 0) {
|
if (downloadTable.nr > 0) {
|
||||||
// remember the last downloaded dive (on most dive computers this will be the chronologically
|
// remember the last downloaded dive (on most dive computers this will be the chronologically
|
||||||
|
@ -542,8 +542,8 @@ void DownloadFromDCWidget::on_ok_clicked()
|
||||||
int idx = get_idx_by_uniq_id(uniqId);
|
int idx = get_idx_by_uniq_id(uniqId);
|
||||||
// this shouldn't be necessary - but there are reports that somehow existing dives stay selected
|
// this shouldn't be necessary - but there are reports that somehow existing dives stay selected
|
||||||
// (but not visible as selected)
|
// (but not visible as selected)
|
||||||
MainWindow::instance()->dive_list()->unselectDives();
|
MainWindow::instance()->dive_list->unselectDives();
|
||||||
MainWindow::instance()->dive_list()->selectDive(idx, true);
|
MainWindow::instance()->dive_list->selectDive(idx, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ostcFirmwareCheck && currentState == DONE) {
|
if (ostcFirmwareCheck && currentState == DONE) {
|
||||||
|
|
|
@ -255,7 +255,7 @@ void LocationInformationWidget::resetState()
|
||||||
{
|
{
|
||||||
modified = false;
|
modified = false;
|
||||||
resetPallete();
|
resetPallete();
|
||||||
MainWindow::instance()->dive_list()->setEnabled(true);
|
MainWindow::instance()->dive_list->setEnabled(true);
|
||||||
MainWindow::instance()->setEnabledToolbar(true);
|
MainWindow::instance()->setEnabledToolbar(true);
|
||||||
ui.diveSiteMessage->setText(tr("Dive site management"));
|
ui.diveSiteMessage->setText(tr("Dive site management"));
|
||||||
MapWidget::instance()->endGetDiveCoordinates();
|
MapWidget::instance()->endGetDiveCoordinates();
|
||||||
|
@ -267,7 +267,7 @@ void LocationInformationWidget::resetState()
|
||||||
|
|
||||||
void LocationInformationWidget::enableEdition()
|
void LocationInformationWidget::enableEdition()
|
||||||
{
|
{
|
||||||
MainWindow::instance()->dive_list()->setEnabled(false);
|
MainWindow::instance()->dive_list->setEnabled(false);
|
||||||
MainWindow::instance()->setEnabledToolbar(false);
|
MainWindow::instance()->setEnabledToolbar(false);
|
||||||
ui.diveSiteMessage->setText(tr("You are editing a dive site"));
|
ui.diveSiteMessage->setText(tr("You are editing a dive site"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,14 +137,14 @@ MainWindow::MainWindow() : QMainWindow(),
|
||||||
// widgets will change on the mainwindow.
|
// widgets will change on the mainwindow.
|
||||||
|
|
||||||
// for the "default" mode
|
// for the "default" mode
|
||||||
MainTab *mainTab = new MainTab();
|
information = new MainTab(this);
|
||||||
DiveListView *diveListView = new DiveListView();
|
dive_list = new DiveListView(this);
|
||||||
ProfileWidget2 *profileWidget = new ProfileWidget2();
|
graphics = new ProfileWidget2(this);
|
||||||
MapWidget *mapWidget = MapWidget::instance();
|
MapWidget *mapWidget = MapWidget::instance();
|
||||||
|
|
||||||
PlannerSettingsWidget *plannerSettings = new PlannerSettingsWidget();
|
divePlannerSettingsWidget = new PlannerSettingsWidget(this);
|
||||||
DivePlannerWidget *plannerWidget = new DivePlannerWidget();
|
divePlannerWidget = new DivePlannerWidget(this);
|
||||||
PlannerDetails *plannerDetails = new PlannerDetails();
|
plannerDetails = new PlannerDetails(this);
|
||||||
|
|
||||||
// what is a sane order for those icons? we should have the ones the user is
|
// what is a sane order for those icons? we should have the ones the user is
|
||||||
// most likely to want towards the top so they are always visible
|
// most likely to want towards the top so they are always visible
|
||||||
|
@ -170,7 +170,7 @@ MainWindow::MainWindow() : QMainWindow(),
|
||||||
profLayout->setMargin(0);
|
profLayout->setMargin(0);
|
||||||
profLayout->setContentsMargins(0,0,0,0);
|
profLayout->setContentsMargins(0,0,0,0);
|
||||||
profLayout->addWidget(toolBar);
|
profLayout->addWidget(toolBar);
|
||||||
profLayout->addWidget(profileWidget);
|
profLayout->addWidget(graphics);
|
||||||
profileContainer->setLayout(profLayout);
|
profileContainer->setLayout(profLayout);
|
||||||
|
|
||||||
diveSiteEdit = new LocationInformationWidget(this);
|
diveSiteEdit = new LocationInformationWidget(this);
|
||||||
|
@ -178,7 +178,7 @@ MainWindow::MainWindow() : QMainWindow(),
|
||||||
this, &MainWindow::setDefaultState);
|
this, &MainWindow::setDefaultState);
|
||||||
connect(diveSiteEdit, SIGNAL(endEditDiveSite()), this, SLOT(refreshDisplay()));
|
connect(diveSiteEdit, SIGNAL(endEditDiveSite()), this, SLOT(refreshDisplay()));
|
||||||
connect(diveSiteEdit, &LocationInformationWidget::endEditDiveSite,
|
connect(diveSiteEdit, &LocationInformationWidget::endEditDiveSite,
|
||||||
mainTab, &MainTab::refreshDisplayedDiveSite);
|
information, &MainTab::refreshDisplayedDiveSite);
|
||||||
|
|
||||||
std::pair<QByteArray, QVariant> enabled = std::make_pair("enabled", QVariant(true));
|
std::pair<QByteArray, QVariant> enabled = std::make_pair("enabled", QVariant(true));
|
||||||
std::pair<QByteArray, QVariant> disabled = std::make_pair("enabled", QVariant(false));
|
std::pair<QByteArray, QVariant> disabled = std::make_pair("enabled", QVariant(false));
|
||||||
|
@ -187,12 +187,12 @@ MainWindow::MainWindow() : QMainWindow(),
|
||||||
enabledList.push_back(enabled);
|
enabledList.push_back(enabled);
|
||||||
disabledList.push_back(disabled);
|
disabledList.push_back(disabled);
|
||||||
|
|
||||||
registerApplicationState("Default", mainTab, profileContainer, diveListView, mapWidget );
|
registerApplicationState("Default", information, profileContainer, dive_list, mapWidget );
|
||||||
registerApplicationState("AddDive", mainTab, profileContainer, diveListView, mapWidget );
|
registerApplicationState("AddDive", information, profileContainer, dive_list, mapWidget );
|
||||||
registerApplicationState("EditDive", mainTab, profileContainer, diveListView, mapWidget );
|
registerApplicationState("EditDive", information, profileContainer, dive_list, mapWidget );
|
||||||
registerApplicationState("PlanDive", plannerWidget, profileContainer, plannerSettings, plannerDetails );
|
registerApplicationState("PlanDive", divePlannerWidget, profileContainer, divePlannerSettingsWidget, plannerDetails );
|
||||||
registerApplicationState("EditPlannedDive", plannerWidget, profileContainer, diveListView, mapWidget );
|
registerApplicationState("EditPlannedDive", divePlannerWidget, profileContainer, dive_list, mapWidget );
|
||||||
registerApplicationState("EditDiveSite", diveSiteEdit, profileContainer, diveListView, mapWidget);
|
registerApplicationState("EditDiveSite", diveSiteEdit, profileContainer, dive_list, mapWidget);
|
||||||
|
|
||||||
setStateProperties("Default", enabledList, enabledList, enabledList,enabledList);
|
setStateProperties("Default", enabledList, enabledList, enabledList,enabledList);
|
||||||
setStateProperties("AddDive", enabledList, enabledList, enabledList,enabledList);
|
setStateProperties("AddDive", enabledList, enabledList, enabledList,enabledList);
|
||||||
|
@ -211,11 +211,11 @@ MainWindow::MainWindow() : QMainWindow(),
|
||||||
}
|
}
|
||||||
connect(&diveListNotifier, &DiveListNotifier::selectionChanged, this, &MainWindow::selectionChanged);
|
connect(&diveListNotifier, &DiveListNotifier::selectionChanged, this, &MainWindow::selectionChanged);
|
||||||
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this, SLOT(readSettings()));
|
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this, SLOT(readSettings()));
|
||||||
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), diveListView, SLOT(update()));
|
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), dive_list, SLOT(update()));
|
||||||
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), diveListView, SLOT(reloadHeaderActions()));
|
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), dive_list, SLOT(reloadHeaderActions()));
|
||||||
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), information(), SLOT(updateDiveInfo()));
|
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), information, SLOT(updateDiveInfo()));
|
||||||
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), divePlannerWidget(), SLOT(settingsChanged()));
|
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), divePlannerWidget, SLOT(settingsChanged()));
|
||||||
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), divePlannerSettingsWidget(), SLOT(settingsChanged()));
|
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), divePlannerSettingsWidget, SLOT(settingsChanged()));
|
||||||
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), TankInfoModel::instance(), SLOT(update()));
|
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), TankInfoModel::instance(), SLOT(update()));
|
||||||
for (int i = 0; i < NUM_RECENT_FILES; i++) {
|
for (int i = 0; i < NUM_RECENT_FILES; i++) {
|
||||||
actionsRecent[i] = new QAction(this);
|
actionsRecent[i] = new QAction(this);
|
||||||
|
@ -224,14 +224,14 @@ MainWindow::MainWindow() : QMainWindow(),
|
||||||
connect(actionsRecent[i], SIGNAL(triggered(bool)), this, SLOT(recentFileTriggered(bool)));
|
connect(actionsRecent[i], SIGNAL(triggered(bool)), this, SLOT(recentFileTriggered(bool)));
|
||||||
}
|
}
|
||||||
ui.menuFile->insertSeparator(ui.actionQuit);
|
ui.menuFile->insertSeparator(ui.actionQuit);
|
||||||
connect(information(), SIGNAL(addDiveFinished()), graphics(), SLOT(setProfileState()));
|
connect(information, SIGNAL(addDiveFinished()), graphics, SLOT(setProfileState()));
|
||||||
connect(information(), SIGNAL(dateTimeChanged()), graphics(), SLOT(dateTimeChanged()));
|
connect(information, SIGNAL(dateTimeChanged()), graphics, SLOT(dateTimeChanged()));
|
||||||
connect(DivePlannerPointsModel::instance(), SIGNAL(planCreated()), this, SLOT(planCreated()));
|
connect(DivePlannerPointsModel::instance(), SIGNAL(planCreated()), this, SLOT(planCreated()));
|
||||||
connect(DivePlannerPointsModel::instance(), SIGNAL(planCanceled()), this, SLOT(planCanceled()));
|
connect(DivePlannerPointsModel::instance(), SIGNAL(planCanceled()), this, SLOT(planCanceled()));
|
||||||
connect(DivePlannerPointsModel::instance(), SIGNAL(variationsComputed(QString)), this, SLOT(updateVariations(QString)));
|
connect(DivePlannerPointsModel::instance(), SIGNAL(variationsComputed(QString)), this, SLOT(updateVariations(QString)));
|
||||||
connect(plannerDetails->printPlan(), SIGNAL(pressed()), divePlannerWidget(), SLOT(printDecoPlan()));
|
connect(plannerDetails->printPlan(), SIGNAL(pressed()), divePlannerWidget, SLOT(printDecoPlan()));
|
||||||
connect(this, SIGNAL(startDiveSiteEdit()), this, SLOT(on_actionDiveSiteEdit_triggered()));
|
connect(this, SIGNAL(startDiveSiteEdit()), this, SLOT(on_actionDiveSiteEdit_triggered()));
|
||||||
connect(information(), &MainTab::diveSiteChanged, mapWidget, &MapWidget::centerOnSelectedDiveSite);
|
connect(information, &MainTab::diveSiteChanged, mapWidget, &MapWidget::centerOnSelectedDiveSite);
|
||||||
connect(this, &MainWindow::showError, ui.mainErrorMessage, &NotificationWidget::showError, Qt::AutoConnection);
|
connect(this, &MainWindow::showError, ui.mainErrorMessage, &NotificationWidget::showError, Qt::AutoConnection);
|
||||||
|
|
||||||
connect(&windowTitleUpdate, &WindowTitleUpdate::updateTitle, this, &MainWindow::setAutomaticTitle);
|
connect(&windowTitleUpdate, &WindowTitleUpdate::updateTitle, this, &MainWindow::setAutomaticTitle);
|
||||||
|
@ -242,17 +242,17 @@ MainWindow::MainWindow() : QMainWindow(),
|
||||||
enableDisableCloudActions();
|
enableDisableCloudActions();
|
||||||
|
|
||||||
ui.mainErrorMessage->hide();
|
ui.mainErrorMessage->hide();
|
||||||
graphics()->setEmptyState();
|
graphics->setEmptyState();
|
||||||
initialUiSetup();
|
initialUiSetup();
|
||||||
readSettings();
|
readSettings();
|
||||||
diveListView->reload(DiveTripModel::TREE);
|
dive_list->reload(DiveTripModel::TREE);
|
||||||
diveListView->reloadHeaderActions();
|
dive_list->reloadHeaderActions();
|
||||||
diveListView->setFocus();
|
dive_list->setFocus();
|
||||||
MapWidget::instance()->reload();
|
MapWidget::instance()->reload();
|
||||||
diveListView->expand(dive_list()->model()->index(0, 0));
|
dive_list->expand(dive_list->model()->index(0, 0));
|
||||||
diveListView->scrollTo(dive_list()->model()->index(0, 0), QAbstractItemView::PositionAtCenter);
|
dive_list->scrollTo(dive_list->model()->index(0, 0), QAbstractItemView::PositionAtCenter);
|
||||||
divePlannerWidget()->settingsChanged();
|
divePlannerWidget->settingsChanged();
|
||||||
divePlannerSettingsWidget()->settingsChanged();
|
divePlannerSettingsWidget->settingsChanged();
|
||||||
#ifdef NO_USERMANUAL
|
#ifdef NO_USERMANUAL
|
||||||
ui.menuHelp->removeAction(ui.actionUserManual);
|
ui.menuHelp->removeAction(ui.actionUserManual);
|
||||||
#endif
|
#endif
|
||||||
|
@ -317,34 +317,34 @@ MainWindow::MainWindow() : QMainWindow(),
|
||||||
connect(ui.profPn2, &QAction::triggered, pp_gas, &qPrefPartialPressureGas::set_pn2);
|
connect(ui.profPn2, &QAction::triggered, pp_gas, &qPrefPartialPressureGas::set_pn2);
|
||||||
connect(ui.profPO2, &QAction::triggered, pp_gas, &qPrefPartialPressureGas::set_po2);
|
connect(ui.profPO2, &QAction::triggered, pp_gas, &qPrefPartialPressureGas::set_po2);
|
||||||
|
|
||||||
connect(tec, &qPrefTechnicalDetails::calcalltissuesChanged , graphics(), &ProfileWidget2::actionRequestedReplot);
|
connect(tec, &qPrefTechnicalDetails::calcalltissuesChanged , graphics, &ProfileWidget2::actionRequestedReplot);
|
||||||
connect(tec, &qPrefTechnicalDetails::calcceilingChanged , graphics(), &ProfileWidget2::actionRequestedReplot);
|
connect(tec, &qPrefTechnicalDetails::calcceilingChanged , graphics, &ProfileWidget2::actionRequestedReplot);
|
||||||
connect(tec, &qPrefTechnicalDetails::dcceilingChanged , graphics(), &ProfileWidget2::actionRequestedReplot);
|
connect(tec, &qPrefTechnicalDetails::dcceilingChanged , graphics, &ProfileWidget2::actionRequestedReplot);
|
||||||
connect(tec, &qPrefTechnicalDetails::eadChanged , graphics(), &ProfileWidget2::actionRequestedReplot);
|
connect(tec, &qPrefTechnicalDetails::eadChanged , graphics, &ProfileWidget2::actionRequestedReplot);
|
||||||
connect(tec, &qPrefTechnicalDetails::calcceiling3mChanged , graphics(), &ProfileWidget2::actionRequestedReplot);
|
connect(tec, &qPrefTechnicalDetails::calcceiling3mChanged , graphics, &ProfileWidget2::actionRequestedReplot);
|
||||||
connect(tec, &qPrefTechnicalDetails::modChanged , graphics(), &ProfileWidget2::actionRequestedReplot);
|
connect(tec, &qPrefTechnicalDetails::modChanged , graphics, &ProfileWidget2::actionRequestedReplot);
|
||||||
connect(tec, &qPrefTechnicalDetails::calcndlttsChanged , graphics(), &ProfileWidget2::actionRequestedReplot);
|
connect(tec, &qPrefTechnicalDetails::calcndlttsChanged , graphics, &ProfileWidget2::actionRequestedReplot);
|
||||||
connect(tec, &qPrefTechnicalDetails::hrgraphChanged , graphics(), &ProfileWidget2::actionRequestedReplot);
|
connect(tec, &qPrefTechnicalDetails::hrgraphChanged , graphics, &ProfileWidget2::actionRequestedReplot);
|
||||||
connect(tec, &qPrefTechnicalDetails::rulergraphChanged , graphics(), &ProfileWidget2::actionRequestedReplot);
|
connect(tec, &qPrefTechnicalDetails::rulergraphChanged , graphics, &ProfileWidget2::actionRequestedReplot);
|
||||||
connect(tec, &qPrefTechnicalDetails::show_sacChanged , graphics(), &ProfileWidget2::actionRequestedReplot);
|
connect(tec, &qPrefTechnicalDetails::show_sacChanged , graphics, &ProfileWidget2::actionRequestedReplot);
|
||||||
connect(tec, &qPrefTechnicalDetails::zoomed_plotChanged , graphics(), &ProfileWidget2::actionRequestedReplot);
|
connect(tec, &qPrefTechnicalDetails::zoomed_plotChanged , graphics, &ProfileWidget2::actionRequestedReplot);
|
||||||
connect(tec, &qPrefTechnicalDetails::show_pictures_in_profileChanged , graphics(), &ProfileWidget2::actionRequestedReplot);
|
connect(tec, &qPrefTechnicalDetails::show_pictures_in_profileChanged , graphics, &ProfileWidget2::actionRequestedReplot);
|
||||||
connect(tec, &qPrefTechnicalDetails::tankbarChanged , graphics(), &ProfileWidget2::actionRequestedReplot);
|
connect(tec, &qPrefTechnicalDetails::tankbarChanged , graphics, &ProfileWidget2::actionRequestedReplot);
|
||||||
connect(tec, &qPrefTechnicalDetails::percentagegraphChanged , graphics(), &ProfileWidget2::actionRequestedReplot);
|
connect(tec, &qPrefTechnicalDetails::percentagegraphChanged , graphics, &ProfileWidget2::actionRequestedReplot);
|
||||||
|
|
||||||
connect(pp_gas, &qPrefPartialPressureGas::pheChanged, graphics(), &ProfileWidget2::actionRequestedReplot);
|
connect(pp_gas, &qPrefPartialPressureGas::pheChanged, graphics, &ProfileWidget2::actionRequestedReplot);
|
||||||
connect(pp_gas, &qPrefPartialPressureGas::pn2Changed, graphics(), &ProfileWidget2::actionRequestedReplot);
|
connect(pp_gas, &qPrefPartialPressureGas::pn2Changed, graphics, &ProfileWidget2::actionRequestedReplot);
|
||||||
connect(pp_gas, &qPrefPartialPressureGas::po2Changed, graphics(), &ProfileWidget2::actionRequestedReplot);
|
connect(pp_gas, &qPrefPartialPressureGas::po2Changed, graphics, &ProfileWidget2::actionRequestedReplot);
|
||||||
|
|
||||||
// now let's set up some connections
|
// now let's set up some connections
|
||||||
connect(graphics(), &ProfileWidget2::enableToolbar ,this, &MainWindow::setEnabledToolbar);
|
connect(graphics, &ProfileWidget2::enableToolbar ,this, &MainWindow::setEnabledToolbar);
|
||||||
connect(graphics(), &ProfileWidget2::disableShortcuts, this, &MainWindow::disableShortcuts);
|
connect(graphics, &ProfileWidget2::disableShortcuts, this, &MainWindow::disableShortcuts);
|
||||||
connect(graphics(), &ProfileWidget2::enableShortcuts, this, &MainWindow::enableShortcuts);
|
connect(graphics, &ProfileWidget2::enableShortcuts, this, &MainWindow::enableShortcuts);
|
||||||
connect(graphics(), &ProfileWidget2::refreshDisplay, this, &MainWindow::refreshDisplay);
|
connect(graphics, &ProfileWidget2::refreshDisplay, this, &MainWindow::refreshDisplay);
|
||||||
connect(graphics(), &ProfileWidget2::editCurrentDive, this, &MainWindow::editCurrentDive);
|
connect(graphics, &ProfileWidget2::editCurrentDive, this, &MainWindow::editCurrentDive);
|
||||||
connect(graphics(), &ProfileWidget2::updateDiveInfo, information(), &MainTab::updateDiveInfo);
|
connect(graphics, &ProfileWidget2::updateDiveInfo, information, &MainTab::updateDiveInfo);
|
||||||
|
|
||||||
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), graphics(), SLOT(settingsChanged()));
|
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), graphics, SLOT(settingsChanged()));
|
||||||
|
|
||||||
ui.profCalcAllTissues->setChecked(qPrefTechnicalDetails::calcalltissues());
|
ui.profCalcAllTissues->setChecked(qPrefTechnicalDetails::calcalltissues());
|
||||||
ui.profCalcCeiling->setChecked(qPrefTechnicalDetails::calcceiling());
|
ui.profCalcCeiling->setChecked(qPrefTechnicalDetails::calcceiling());
|
||||||
|
@ -385,7 +385,7 @@ void MainWindow::setupSocialNetworkMenu()
|
||||||
connections = new QMenu(tr("Connect to"));
|
connections = new QMenu(tr("Connect to"));
|
||||||
FacebookPlugin *facebookPlugin = new FacebookPlugin();
|
FacebookPlugin *facebookPlugin = new FacebookPlugin();
|
||||||
QAction *toggle_connection = new QAction(this);
|
QAction *toggle_connection = new QAction(this);
|
||||||
QObject *obj = qobject_cast<QObject*>(facebookPlugin);
|
QObject *obj = facebookPlugin;
|
||||||
toggle_connection->setText(facebookPlugin->socialNetworkName());
|
toggle_connection->setText(facebookPlugin->socialNetworkName());
|
||||||
toggle_connection->setIcon(QIcon(facebookPlugin->socialNetworkIcon()));
|
toggle_connection->setIcon(QIcon(facebookPlugin->socialNetworkIcon()));
|
||||||
toggle_connection->setData(QVariant::fromValue(obj));
|
toggle_connection->setData(QVariant::fromValue(obj));
|
||||||
|
@ -457,16 +457,9 @@ void MainWindow::enableDisableCloudActions()
|
||||||
ui.actionCloudstoragesave->setEnabled(prefs.cloud_verification_status == qPrefCloudStorage::CS_VERIFIED);
|
ui.actionCloudstoragesave->setEnabled(prefs.cloud_verification_status == qPrefCloudStorage::CS_VERIFIED);
|
||||||
}
|
}
|
||||||
|
|
||||||
PlannerDetails *MainWindow::plannerDetails() const {
|
|
||||||
return qobject_cast<PlannerDetails*>(applicationState["PlanDive"].bottomRight);
|
|
||||||
}
|
|
||||||
PlannerSettingsWidget *MainWindow::divePlannerSettingsWidget() {
|
|
||||||
return qobject_cast<PlannerSettingsWidget*>(applicationState["PlanDive"].bottomLeft);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::setDefaultState() {
|
void MainWindow::setDefaultState() {
|
||||||
setApplicationState("Default");
|
setApplicationState("Default");
|
||||||
if (information()->getEditMode() != MainTab::NONE) {
|
if (information->getEditMode() != MainTab::NONE) {
|
||||||
ui.bottomLeft->currentWidget()->setEnabled(false);
|
ui.bottomLeft->currentWidget()->setEnabled(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -479,22 +472,22 @@ MainWindow *MainWindow::instance()
|
||||||
// This gets called after one or more dives were added, edited or downloaded for a dive computer
|
// This gets called after one or more dives were added, edited or downloaded for a dive computer
|
||||||
void MainWindow::refreshDisplay(bool doRecreateDiveList)
|
void MainWindow::refreshDisplay(bool doRecreateDiveList)
|
||||||
{
|
{
|
||||||
information()->reload();
|
information->reload();
|
||||||
TankInfoModel::instance()->update();
|
TankInfoModel::instance()->update();
|
||||||
MapWidget::instance()->reload();
|
MapWidget::instance()->reload();
|
||||||
if (doRecreateDiveList)
|
if (doRecreateDiveList)
|
||||||
recreateDiveList();
|
recreateDiveList();
|
||||||
|
|
||||||
setApplicationState("Default");
|
setApplicationState("Default");
|
||||||
dive_list()->setEnabled(true);
|
dive_list->setEnabled(true);
|
||||||
dive_list()->setFocus();
|
dive_list->setFocus();
|
||||||
WSInfoModel::instance()->updateInfo();
|
WSInfoModel::instance()->updateInfo();
|
||||||
ui.actionAutoGroup->setChecked(autogroup);
|
ui.actionAutoGroup->setChecked(autogroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::recreateDiveList()
|
void MainWindow::recreateDiveList()
|
||||||
{
|
{
|
||||||
dive_list()->reload(DiveTripModel::CURRENT);
|
dive_list->reload(DiveTripModel::CURRENT);
|
||||||
TagFilterModel::instance()->repopulate();
|
TagFilterModel::instance()->repopulate();
|
||||||
BuddyFilterModel::instance()->repopulate();
|
BuddyFilterModel::instance()->repopulate();
|
||||||
LocationFilterModel::instance()->repopulate();
|
LocationFilterModel::instance()->repopulate();
|
||||||
|
@ -530,12 +523,12 @@ void MainWindow::configureToolbar() {
|
||||||
void MainWindow::selectionChanged()
|
void MainWindow::selectionChanged()
|
||||||
{
|
{
|
||||||
if (!current_dive) {
|
if (!current_dive) {
|
||||||
information()->clearTabs();
|
information->clearTabs();
|
||||||
information()->updateDiveInfo(true);
|
information->updateDiveInfo(true);
|
||||||
graphics()->setEmptyState();
|
graphics->setEmptyState();
|
||||||
} else {
|
} else {
|
||||||
graphics()->plotDive(nullptr, false, true);
|
graphics->plotDive(nullptr, false, true);
|
||||||
information()->updateDiveInfo();
|
information->updateDiveInfo();
|
||||||
configureToolbar();
|
configureToolbar();
|
||||||
MapWidget::instance()->reload();
|
MapWidget::instance()->reload();
|
||||||
}
|
}
|
||||||
|
@ -646,8 +639,8 @@ void MainWindow::on_actionCloudstoragesave_triggered()
|
||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
qDebug() << "Saving cloud storage to:" << filename;
|
qDebug() << "Saving cloud storage to:" << filename;
|
||||||
if (information()->isEditing())
|
if (information->isEditing())
|
||||||
information()->acceptChanges();
|
information->acceptChanges();
|
||||||
|
|
||||||
showProgressBar();
|
showProgressBar();
|
||||||
int error = save_dives(qPrintable(filename));
|
int error = save_dives(qPrintable(filename));
|
||||||
|
@ -668,7 +661,7 @@ void MainWindow::on_actionCloudOnline_triggered()
|
||||||
// Refuse to go online if there is an edit in progress
|
// Refuse to go online if there is an edit in progress
|
||||||
if (!isOffline &&
|
if (!isOffline &&
|
||||||
(DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING ||
|
(DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING ||
|
||||||
information()->isEditing())) {
|
information->isEditing())) {
|
||||||
QMessageBox::warning(this, tr("Warning"), tr("Please save or cancel the current dive edit before going online"));
|
QMessageBox::warning(this, tr("Warning"), tr("Please save or cancel the current dive edit before going online"));
|
||||||
// We didn't switch to online, therefore uncheck the checkbox
|
// We didn't switch to online, therefore uncheck the checkbox
|
||||||
ui.actionCloudOnline->setChecked(false);
|
ui.actionCloudOnline->setChecked(false);
|
||||||
|
@ -699,17 +692,12 @@ void MainWindow::on_actionCloudOnline_triggered()
|
||||||
updateCloudOnlineStatus();
|
updateCloudOnlineStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfileWidget2 *MainWindow::graphics() const
|
|
||||||
{
|
|
||||||
return qobject_cast<ProfileWidget2*>(applicationState["Default"].topRight->layout()->itemAt(1)->widget());
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::cleanUpEmpty()
|
void MainWindow::cleanUpEmpty()
|
||||||
{
|
{
|
||||||
information()->clearTabs();
|
information->clearTabs();
|
||||||
information()->updateDiveInfo(true);
|
information->updateDiveInfo(true);
|
||||||
graphics()->setEmptyState();
|
graphics->setEmptyState();
|
||||||
dive_list()->reload(DiveTripModel::TREE);
|
dive_list->reload(DiveTripModel::TREE);
|
||||||
MapWidget::instance()->reload();
|
MapWidget::instance()->reload();
|
||||||
if (!existing_filename)
|
if (!existing_filename)
|
||||||
setTitle();
|
setTitle();
|
||||||
|
@ -719,7 +707,7 @@ void MainWindow::cleanUpEmpty()
|
||||||
bool MainWindow::okToClose(QString message)
|
bool MainWindow::okToClose(QString message)
|
||||||
{
|
{
|
||||||
if (DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING ||
|
if (DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING ||
|
||||||
information()->isEditing() ) {
|
information->isEditing() ) {
|
||||||
QMessageBox::warning(this, tr("Warning"), message);
|
QMessageBox::warning(this, tr("Warning"), message);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -731,7 +719,7 @@ bool MainWindow::okToClose(QString message)
|
||||||
|
|
||||||
void MainWindow::closeCurrentFile()
|
void MainWindow::closeCurrentFile()
|
||||||
{
|
{
|
||||||
graphics()->setEmptyState();
|
graphics->setEmptyState();
|
||||||
/* free the dives and trips */
|
/* free the dives and trips */
|
||||||
clear_git_id();
|
clear_git_id();
|
||||||
clear_dive_file_data();
|
clear_dive_file_data();
|
||||||
|
@ -804,7 +792,7 @@ void MainWindow::enableShortcuts()
|
||||||
void MainWindow::showProfile()
|
void MainWindow::showProfile()
|
||||||
{
|
{
|
||||||
enableShortcuts();
|
enableShortcuts();
|
||||||
graphics()->setProfileState();
|
graphics->setProfileState();
|
||||||
setApplicationState("Default");
|
setApplicationState("Default");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -821,9 +809,9 @@ void MainWindow::on_actionPreferences_triggered()
|
||||||
|
|
||||||
void MainWindow::on_actionQuit_triggered()
|
void MainWindow::on_actionQuit_triggered()
|
||||||
{
|
{
|
||||||
if (information()->isEditing()) {
|
if (information->isEditing()) {
|
||||||
information()->rejectChanges();
|
information->rejectChanges();
|
||||||
if (information()->isEditing())
|
if (information->isEditing())
|
||||||
// didn't discard the edits
|
// didn't discard the edits
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -864,7 +852,7 @@ bool MainWindow::plannerStateClean()
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING ||
|
if (DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING ||
|
||||||
information()->isEditing()) {
|
information->isEditing()) {
|
||||||
QMessageBox::warning(this, tr("Warning"), tr("Please save or cancel the current dive edit before trying to add a dive."));
|
QMessageBox::warning(this, tr("Warning"), tr("Please save or cancel the current dive edit before trying to add a dive."));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -875,7 +863,7 @@ void MainWindow::refreshProfile()
|
||||||
{
|
{
|
||||||
showProfile();
|
showProfile();
|
||||||
configureToolbar();
|
configureToolbar();
|
||||||
graphics()->replot(current_dive);
|
graphics->replot(current_dive);
|
||||||
DivePictureModel::instance()->updateDivePictures();
|
DivePictureModel::instance()->updateDivePictures();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -892,13 +880,13 @@ void MainWindow::planCreated()
|
||||||
// make sure our UI is in a consistent state
|
// make sure our UI is in a consistent state
|
||||||
showProfile();
|
showProfile();
|
||||||
setApplicationState("Default");
|
setApplicationState("Default");
|
||||||
dive_list()->setEnabled(true);
|
dive_list->setEnabled(true);
|
||||||
dive_list()->setFocus();
|
dive_list->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::setPlanNotes()
|
void MainWindow::setPlanNotes()
|
||||||
{
|
{
|
||||||
plannerDetails()->divePlanOutput()->setHtml(displayed_dive.notes);
|
plannerDetails->divePlanOutput()->setHtml(displayed_dive.notes);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::updateVariations(QString variations)
|
void MainWindow::updateVariations(QString variations)
|
||||||
|
@ -906,13 +894,13 @@ void MainWindow::updateVariations(QString variations)
|
||||||
QString notes = QString(displayed_dive.notes);
|
QString notes = QString(displayed_dive.notes);
|
||||||
free(displayed_dive.notes);
|
free(displayed_dive.notes);
|
||||||
displayed_dive.notes = copy_qstring(notes.replace("VARIATIONS", variations));
|
displayed_dive.notes = copy_qstring(notes.replace("VARIATIONS", variations));
|
||||||
plannerDetails()->divePlanOutput()->setHtml(displayed_dive.notes);
|
plannerDetails->divePlanOutput()->setHtml(displayed_dive.notes);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::printPlan()
|
void MainWindow::printPlan()
|
||||||
{
|
{
|
||||||
#ifndef NO_PRINTING
|
#ifndef NO_PRINTING
|
||||||
QString diveplan = plannerDetails()->divePlanOutput()->toHtml();
|
QString diveplan = plannerDetails->divePlanOutput()->toHtml();
|
||||||
QString withDisclaimer = QString("<img height=50 src=\":subsurface-icon\"> ") + diveplan + QString(disclaimer);
|
QString withDisclaimer = QString("<img height=50 src=\":subsurface-icon\"> ") + diveplan + QString(disclaimer);
|
||||||
|
|
||||||
QPrinter printer;
|
QPrinter printer;
|
||||||
|
@ -935,7 +923,7 @@ void MainWindow::printPlan()
|
||||||
painter.setRenderHint(QPainter::Antialiasing);
|
painter.setRenderHint(QPainter::Antialiasing);
|
||||||
painter.setRenderHint(QPainter::SmoothPixmapTransform);
|
painter.setRenderHint(QPainter::SmoothPixmapTransform);
|
||||||
|
|
||||||
ProfileWidget2 *profile = graphics();
|
ProfileWidget2 *profile = graphics;
|
||||||
QSize origSize = profile->size();
|
QSize origSize = profile->size();
|
||||||
profile->resize(renderSize.toSize());
|
profile->resize(renderSize.toSize());
|
||||||
profile->setPrintMode(true);
|
profile->setPrintMode(true);
|
||||||
|
@ -949,9 +937,9 @@ void MainWindow::printPlan()
|
||||||
QString profileImage = QString("<img src=\"data:image/png;base64,") + byteArray.toBase64() + "\"/><br><br>";
|
QString profileImage = QString("<img src=\"data:image/png;base64,") + byteArray.toBase64() + "\"/><br><br>";
|
||||||
withDisclaimer = profileImage + withDisclaimer;
|
withDisclaimer = profileImage + withDisclaimer;
|
||||||
|
|
||||||
plannerDetails()->divePlanOutput()->setHtml(withDisclaimer);
|
plannerDetails->divePlanOutput()->setHtml(withDisclaimer);
|
||||||
plannerDetails()->divePlanOutput()->print(&printer);
|
plannerDetails->divePlanOutput()->print(&printer);
|
||||||
plannerDetails()->divePlanOutput()->setHtml(displayed_dive.notes);
|
plannerDetails->divePlanOutput()->setHtml(displayed_dive.notes);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -982,15 +970,15 @@ void MainWindow::on_actionReplanDive_triggered()
|
||||||
DivePlannerPointsModel::instance()->clear();
|
DivePlannerPointsModel::instance()->clear();
|
||||||
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::PLAN);
|
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::PLAN);
|
||||||
|
|
||||||
graphics()->setPlanState();
|
graphics->setPlanState();
|
||||||
graphics()->clearHandlers();
|
graphics->clearHandlers();
|
||||||
setApplicationState("PlanDive");
|
setApplicationState("PlanDive");
|
||||||
divePlannerWidget()->setReplanButton(true);
|
divePlannerWidget->setReplanButton(true);
|
||||||
divePlannerWidget()->setupStartTime(QDateTime::fromMSecsSinceEpoch(1000 * current_dive->when, Qt::UTC));
|
divePlannerWidget->setupStartTime(QDateTime::fromMSecsSinceEpoch(1000 * current_dive->when, Qt::UTC));
|
||||||
if (current_dive->surface_pressure.mbar)
|
if (current_dive->surface_pressure.mbar)
|
||||||
divePlannerWidget()->setSurfacePressure(current_dive->surface_pressure.mbar);
|
divePlannerWidget->setSurfacePressure(current_dive->surface_pressure.mbar);
|
||||||
if (current_dive->salinity)
|
if (current_dive->salinity)
|
||||||
divePlannerWidget()->setSalinity(current_dive->salinity);
|
divePlannerWidget->setSalinity(current_dive->salinity);
|
||||||
DivePlannerPointsModel::instance()->loadFromDive(current_dive);
|
DivePlannerPointsModel::instance()->loadFromDive(current_dive);
|
||||||
reset_cylinders(&displayed_dive, true);
|
reset_cylinders(&displayed_dive, true);
|
||||||
CylindersModel::instance()->updateDive();
|
CylindersModel::instance()->updateDive();
|
||||||
|
@ -1005,7 +993,7 @@ void MainWindow::on_actionDivePlanner_triggered()
|
||||||
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::PLAN);
|
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::PLAN);
|
||||||
setApplicationState("PlanDive");
|
setApplicationState("PlanDive");
|
||||||
|
|
||||||
graphics()->setPlanState();
|
graphics->setPlanState();
|
||||||
|
|
||||||
// create a simple starting dive, using the first gas from the just copied cylinders
|
// create a simple starting dive, using the first gas from the just copied cylinders
|
||||||
setupForAddAndPlan("planned dive"); // don't translate, stored in XML file
|
setupForAddAndPlan("planned dive"); // don't translate, stored in XML file
|
||||||
|
@ -1013,16 +1001,12 @@ void MainWindow::on_actionDivePlanner_triggered()
|
||||||
DivePlannerPointsModel::instance()->createSimpleDive();
|
DivePlannerPointsModel::instance()->createSimpleDive();
|
||||||
// plan the dive in the same mode as the currently selected one
|
// plan the dive in the same mode as the currently selected one
|
||||||
if (current_dive) {
|
if (current_dive) {
|
||||||
divePlannerSettingsWidget()->setDiveMode(current_dive->dc.divemode);
|
divePlannerSettingsWidget->setDiveMode(current_dive->dc.divemode);
|
||||||
if (current_dive->salinity)
|
if (current_dive->salinity)
|
||||||
divePlannerWidget()->setSalinity(current_dive->salinity);
|
divePlannerWidget->setSalinity(current_dive->salinity);
|
||||||
}
|
}
|
||||||
DivePictureModel::instance()->updateDivePictures();
|
DivePictureModel::instance()->updateDivePictures();
|
||||||
divePlannerWidget()->setReplanButton(false);
|
divePlannerWidget->setReplanButton(false);
|
||||||
}
|
|
||||||
|
|
||||||
DivePlannerWidget* MainWindow::divePlannerWidget() {
|
|
||||||
return qobject_cast<DivePlannerWidget*>(applicationState["PlanDive"].topLeft);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionAddDive_triggered()
|
void MainWindow::on_actionAddDive_triggered()
|
||||||
|
@ -1030,9 +1014,9 @@ void MainWindow::on_actionAddDive_triggered()
|
||||||
if (!plannerStateClean())
|
if (!plannerStateClean())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (dive_list()->selectedTrips().count() >= 1) {
|
if (dive_list->selectedTrips().count() >= 1) {
|
||||||
dive_list()->rememberSelection();
|
dive_list->rememberSelection();
|
||||||
dive_list()->clearSelection();
|
dive_list->clearSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
setApplicationState("AddDive");
|
setApplicationState("AddDive");
|
||||||
|
@ -1042,19 +1026,19 @@ void MainWindow::on_actionAddDive_triggered()
|
||||||
setupForAddAndPlan("manually added dive"); // don't translate, stored in the XML file
|
setupForAddAndPlan("manually added dive"); // don't translate, stored in the XML file
|
||||||
|
|
||||||
// now show the mostly empty main tab
|
// now show the mostly empty main tab
|
||||||
information()->updateDiveInfo();
|
information->updateDiveInfo();
|
||||||
|
|
||||||
information()->addDiveStarted();
|
information->addDiveStarted();
|
||||||
|
|
||||||
graphics()->setAddState();
|
graphics->setAddState();
|
||||||
DivePlannerPointsModel::instance()->createSimpleDive();
|
DivePlannerPointsModel::instance()->createSimpleDive();
|
||||||
configureToolbar();
|
configureToolbar();
|
||||||
graphics()->plotDive(nullptr, false, true);
|
graphics->plotDive(nullptr, false, true);
|
||||||
fixup_dc_duration(&displayed_dive.dc);
|
fixup_dc_duration(&displayed_dive.dc);
|
||||||
displayed_dive.duration = displayed_dive.dc.duration;
|
displayed_dive.duration = displayed_dive.dc.duration;
|
||||||
|
|
||||||
// now that we have the correct depth and duration, update the dive info
|
// now that we have the correct depth and duration, update the dive info
|
||||||
information()->updateDepthDuration();
|
information->updateDepthDuration();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionRenumber_triggered()
|
void MainWindow::on_actionRenumber_triggered()
|
||||||
|
@ -1255,8 +1239,8 @@ void MainWindow::on_actionPreviousDC_triggered()
|
||||||
unsigned nrdc = number_of_computers(current_dive);
|
unsigned nrdc = number_of_computers(current_dive);
|
||||||
dc_number = (dc_number + nrdc - 1) % nrdc;
|
dc_number = (dc_number + nrdc - 1) % nrdc;
|
||||||
configureToolbar();
|
configureToolbar();
|
||||||
graphics()->plotDive(nullptr, false, true);
|
graphics->plotDive(nullptr, false, true);
|
||||||
information()->updateDiveInfo();
|
information->updateDiveInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionNextDC_triggered()
|
void MainWindow::on_actionNextDC_triggered()
|
||||||
|
@ -1264,8 +1248,8 @@ void MainWindow::on_actionNextDC_triggered()
|
||||||
unsigned nrdc = number_of_computers(current_dive);
|
unsigned nrdc = number_of_computers(current_dive);
|
||||||
dc_number = (dc_number + 1) % nrdc;
|
dc_number = (dc_number + 1) % nrdc;
|
||||||
configureToolbar();
|
configureToolbar();
|
||||||
graphics()->plotDive(nullptr, false, true);
|
graphics->plotDive(nullptr, false, true);
|
||||||
information()->updateDiveInfo();
|
information->updateDiveInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionFullScreen_triggered(bool checked)
|
void MainWindow::on_actionFullScreen_triggered(bool checked)
|
||||||
|
@ -1496,7 +1480,7 @@ void MainWindow::writeSettings()
|
||||||
void MainWindow::closeEvent(QCloseEvent *event)
|
void MainWindow::closeEvent(QCloseEvent *event)
|
||||||
{
|
{
|
||||||
if (DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING ||
|
if (DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING ||
|
||||||
information()->isEditing()) {
|
information->isEditing()) {
|
||||||
on_actionQuit_triggered();
|
on_actionQuit_triggered();
|
||||||
event->ignore();
|
event->ignore();
|
||||||
return;
|
return;
|
||||||
|
@ -1511,16 +1495,6 @@ void MainWindow::closeEvent(QCloseEvent *event)
|
||||||
QApplication::closeAllWindows();
|
QApplication::closeAllWindows();
|
||||||
}
|
}
|
||||||
|
|
||||||
DiveListView *MainWindow::dive_list()
|
|
||||||
{
|
|
||||||
return qobject_cast<DiveListView*>(applicationState["Default"].bottomLeft);
|
|
||||||
}
|
|
||||||
|
|
||||||
MainTab *MainWindow::information()
|
|
||||||
{
|
|
||||||
return qobject_cast<MainTab*>(applicationState["Default"].topLeft);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::loadRecentFiles()
|
void MainWindow::loadRecentFiles()
|
||||||
{
|
{
|
||||||
recentFiles.clear();
|
recentFiles.clear();
|
||||||
|
@ -1639,8 +1613,8 @@ int MainWindow::file_save_as(void)
|
||||||
if (filename.isNull() || filename.isEmpty())
|
if (filename.isNull() || filename.isEmpty())
|
||||||
return report_error("No filename to save into");
|
return report_error("No filename to save into");
|
||||||
|
|
||||||
if (information()->isEditing())
|
if (information->isEditing())
|
||||||
information()->acceptChanges();
|
information->acceptChanges();
|
||||||
|
|
||||||
if (save_dives(qPrintable(filename)))
|
if (save_dives(qPrintable(filename)))
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1663,8 +1637,8 @@ int MainWindow::file_save(void)
|
||||||
if (is_cloud && !saveToCloudOK())
|
if (is_cloud && !saveToCloudOK())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (information()->isEditing())
|
if (information->isEditing())
|
||||||
information()->acceptChanges();
|
information->acceptChanges();
|
||||||
|
|
||||||
current_default = prefs.default_filename;
|
current_default = prefs.default_filename;
|
||||||
if (strcmp(existing_filename, current_default) == 0) {
|
if (strcmp(existing_filename, current_default) == 0) {
|
||||||
|
@ -1827,7 +1801,7 @@ void MainWindow::editCurrentDive()
|
||||||
if (!current_dive)
|
if (!current_dive)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (information()->isEditing() || DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING) {
|
if (information->isEditing() || DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING) {
|
||||||
QMessageBox::warning(this, tr("Warning"), tr("Please, first finish the current edition before trying to do another."));
|
QMessageBox::warning(this, tr("Warning"), tr("Please, first finish the current edition before trying to do another."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1838,18 +1812,18 @@ void MainWindow::editCurrentDive()
|
||||||
disableShortcuts();
|
disableShortcuts();
|
||||||
if (defaultDC == "manually added dive") {
|
if (defaultDC == "manually added dive") {
|
||||||
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::ADD);
|
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::ADD);
|
||||||
graphics()->setAddState();
|
graphics->setAddState();
|
||||||
setApplicationState("EditDive");
|
setApplicationState("EditDive");
|
||||||
DivePlannerPointsModel::instance()->loadFromDive(d);
|
DivePlannerPointsModel::instance()->loadFromDive(d);
|
||||||
information()->enableEdition(MainTab::MANUALLY_ADDED_DIVE);
|
information->enableEdition(MainTab::MANUALLY_ADDED_DIVE);
|
||||||
} else if (defaultDC == "planned dive") {
|
} else if (defaultDC == "planned dive") {
|
||||||
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::PLAN);
|
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::PLAN);
|
||||||
setApplicationState("EditPlannedDive");
|
setApplicationState("EditPlannedDive");
|
||||||
DivePlannerPointsModel::instance()->loadFromDive(d);
|
DivePlannerPointsModel::instance()->loadFromDive(d);
|
||||||
information()->enableEdition(MainTab::MANUALLY_ADDED_DIVE);
|
information->enableEdition(MainTab::MANUALLY_ADDED_DIVE);
|
||||||
} else {
|
} else {
|
||||||
setApplicationState("EditDive");
|
setApplicationState("EditDive");
|
||||||
information()->enableEdition();
|
information->enableEdition();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1891,7 +1865,7 @@ void MainWindow::on_paste_triggered()
|
||||||
{
|
{
|
||||||
// take the data in our copyPasteDive and apply it to selected dives
|
// take the data in our copyPasteDive and apply it to selected dives
|
||||||
selective_copy_dive(©PasteDive, &displayed_dive, what, false);
|
selective_copy_dive(©PasteDive, &displayed_dive, what, false);
|
||||||
information()->showAndTriggerEditSelective(what);
|
information->showAndTriggerEditSelective(what);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionFilterTags_triggered()
|
void MainWindow::on_actionFilterTags_triggered()
|
||||||
|
|
|
@ -59,14 +59,10 @@ public:
|
||||||
MainWindow();
|
MainWindow();
|
||||||
~MainWindow();
|
~MainWindow();
|
||||||
static MainWindow *instance();
|
static MainWindow *instance();
|
||||||
MainTab *information();
|
|
||||||
void loadRecentFiles();
|
void loadRecentFiles();
|
||||||
void updateRecentFiles();
|
void updateRecentFiles();
|
||||||
void updateRecentFilesMenu();
|
void updateRecentFilesMenu();
|
||||||
void addRecentFile(const QString &file, bool update);
|
void addRecentFile(const QString &file, bool update);
|
||||||
DiveListView *dive_list();
|
|
||||||
DivePlannerWidget *divePlannerWidget();
|
|
||||||
PlannerSettingsWidget *divePlannerSettingsWidget();
|
|
||||||
LocationInformationWidget *locationInformationWidget();
|
LocationInformationWidget *locationInformationWidget();
|
||||||
void setTitle();
|
void setTitle();
|
||||||
|
|
||||||
|
@ -74,8 +70,6 @@ public:
|
||||||
void importFiles(const QStringList importFiles);
|
void importFiles(const QStringList importFiles);
|
||||||
void cleanUpEmpty();
|
void cleanUpEmpty();
|
||||||
void setToolButtonsEnabled(bool enabled);
|
void setToolButtonsEnabled(bool enabled);
|
||||||
ProfileWidget2 *graphics() const;
|
|
||||||
PlannerDetails *plannerDetails() const;
|
|
||||||
void printPlan();
|
void printPlan();
|
||||||
void checkSurvey();
|
void checkSurvey();
|
||||||
void setApplicationState(const QByteArray& state);
|
void setApplicationState(const QByteArray& state);
|
||||||
|
@ -87,6 +81,12 @@ public:
|
||||||
void enterEditState();
|
void enterEditState();
|
||||||
void exitEditState();
|
void exitEditState();
|
||||||
|
|
||||||
|
MainTab *information;
|
||||||
|
PlannerDetails *plannerDetails;
|
||||||
|
PlannerSettingsWidget *divePlannerSettingsWidget;
|
||||||
|
ProfileWidget2 *graphics;
|
||||||
|
DivePlannerWidget *divePlannerWidget;
|
||||||
|
DiveListView *dive_list;
|
||||||
private
|
private
|
||||||
slots:
|
slots:
|
||||||
/* file menu action */
|
/* file menu action */
|
||||||
|
|
|
@ -103,9 +103,9 @@ void MapWidget::selectedDivesChanged(QList<int> list)
|
||||||
{
|
{
|
||||||
CHECK_IS_READY_RETURN_VOID();
|
CHECK_IS_READY_RETURN_VOID();
|
||||||
skipReload = true;
|
skipReload = true;
|
||||||
MainWindow::instance()->dive_list()->unselectDives();
|
MainWindow::instance()->dive_list->unselectDives();
|
||||||
if (!list.empty())
|
if (!list.empty())
|
||||||
MainWindow::instance()->dive_list()->selectDives(list);
|
MainWindow::instance()->dive_list->selectDives(list);
|
||||||
skipReload = false;
|
skipReload = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -263,10 +263,10 @@ TankInfoDelegate::TankInfoDelegate(QObject *parent) : ComboBoxDelegate(TankInfoM
|
||||||
|
|
||||||
void TankInfoDelegate::reenableReplot(QWidget*, QAbstractItemDelegate::EndEditHint)
|
void TankInfoDelegate::reenableReplot(QWidget*, QAbstractItemDelegate::EndEditHint)
|
||||||
{
|
{
|
||||||
MainWindow::instance()->graphics()->setReplot(true);
|
MainWindow::instance()->graphics->setReplot(true);
|
||||||
// FIXME: We need to replot after a cylinder is selected but the replot below overwrites
|
// FIXME: We need to replot after a cylinder is selected but the replot below overwrites
|
||||||
// the newly selected cylinder.
|
// the newly selected cylinder.
|
||||||
// MainWindow::instance()->graphics()->replot();
|
// MainWindow::instance()->graphics->replot();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TankInfoDelegate::revertModelData(QWidget*, QAbstractItemDelegate::EndEditHint hint)
|
void TankInfoDelegate::revertModelData(QWidget*, QAbstractItemDelegate::EndEditHint hint)
|
||||||
|
@ -290,7 +290,7 @@ QWidget *TankInfoDelegate::createEditor(QWidget *parent, const QStyleOptionViewI
|
||||||
currCylinderData.type = copy_string(cyl->type.description);
|
currCylinderData.type = copy_string(cyl->type.description);
|
||||||
currCylinderData.pressure = cyl->type.workingpressure.mbar;
|
currCylinderData.pressure = cyl->type.workingpressure.mbar;
|
||||||
currCylinderData.size = cyl->type.size.mliter;
|
currCylinderData.size = cyl->type.size.mliter;
|
||||||
MainWindow::instance()->graphics()->setReplot(false);
|
MainWindow::instance()->graphics->setReplot(false);
|
||||||
return delegate;
|
return delegate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -197,7 +197,7 @@ void FacebookManager::userIdReceived()
|
||||||
QPixmap FacebookManager::grabProfilePixmap()
|
QPixmap FacebookManager::grabProfilePixmap()
|
||||||
{
|
{
|
||||||
qCDebug(lcFacebook) << "Grabbing Dive Profile pixmap";
|
qCDebug(lcFacebook) << "Grabbing Dive Profile pixmap";
|
||||||
ProfileWidget2 *profile = MainWindow::instance()->graphics();
|
ProfileWidget2 *profile = MainWindow::instance()->graphics;
|
||||||
|
|
||||||
QSize size = fbInfo.profileSize == FacebookInfo::SMALL ? QSize(800,600) :
|
QSize size = fbInfo.profileSize == FacebookInfo::SMALL ? QSize(800,600) :
|
||||||
fbInfo.profileSize == FacebookInfo::MEDIUM ? QSize(1024,760) :
|
fbInfo.profileSize == FacebookInfo::MEDIUM ? QSize(1024,760) :
|
||||||
|
|
|
@ -134,7 +134,7 @@ void Printer::flowRender()
|
||||||
void Printer::render(int Pages = 0)
|
void Printer::render(int Pages = 0)
|
||||||
{
|
{
|
||||||
// keep original preferences
|
// keep original preferences
|
||||||
QPointer<ProfileWidget2> profile = MainWindow::instance()->graphics();
|
QPointer<ProfileWidget2> profile = MainWindow::instance()->graphics;
|
||||||
int profileFrameStyle = profile->frameStyle();
|
int profileFrameStyle = profile->frameStyle();
|
||||||
int animationOriginal = qPrefDisplay::animation_speed();
|
int animationOriginal = qPrefDisplay::animation_speed();
|
||||||
double fontScale = profile->getFontPrintScale();
|
double fontScale = profile->getFontPrintScale();
|
||||||
|
|
|
@ -159,7 +159,7 @@ void RenumberDialog::renumberOnlySelected(bool selected)
|
||||||
void RenumberDialog::buttonClicked(QAbstractButton *button)
|
void RenumberDialog::buttonClicked(QAbstractButton *button)
|
||||||
{
|
{
|
||||||
if (ui.buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole) {
|
if (ui.buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole) {
|
||||||
MainWindow::instance()->dive_list()->rememberSelection();
|
MainWindow::instance()->dive_list->rememberSelection();
|
||||||
// we remember a list from dive uuid to a new number
|
// we remember a list from dive uuid to a new number
|
||||||
QVector<QPair<dive *, int>> renumberedDives;
|
QVector<QPair<dive *, int>> renumberedDives;
|
||||||
int i;
|
int i;
|
||||||
|
@ -205,7 +205,7 @@ void SetpointDialog::buttonClicked(QAbstractButton *button)
|
||||||
invalidate_dive_cache(current_dive);
|
invalidate_dive_cache(current_dive);
|
||||||
}
|
}
|
||||||
mark_divelist_changed(true);
|
mark_divelist_changed(true);
|
||||||
MainWindow::instance()->graphics()->replot();
|
MainWindow::instance()->graphics->replot();
|
||||||
}
|
}
|
||||||
|
|
||||||
SetpointDialog::SetpointDialog(QWidget *parent) : QDialog(parent),
|
SetpointDialog::SetpointDialog(QWidget *parent) : QDialog(parent),
|
||||||
|
|
|
@ -109,12 +109,12 @@ void TabDivePhotos::recalculateSelectedThumbnails()
|
||||||
//TODO: This looks overly wrong. We shouldn't call MainWindow to retrieve the DiveList to add Images.
|
//TODO: This looks overly wrong. We shouldn't call MainWindow to retrieve the DiveList to add Images.
|
||||||
void TabDivePhotos::addPhotosFromFile()
|
void TabDivePhotos::addPhotosFromFile()
|
||||||
{
|
{
|
||||||
MainWindow::instance()->dive_list()->loadImages();
|
MainWindow::instance()->dive_list->loadImages();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabDivePhotos::addPhotosFromURL()
|
void TabDivePhotos::addPhotosFromURL()
|
||||||
{
|
{
|
||||||
MainWindow::instance()->dive_list()->loadWebImages();
|
MainWindow::instance()->dive_list->loadWebImages();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabDivePhotos::removeAllPhotos()
|
void TabDivePhotos::removeAllPhotos()
|
||||||
|
|
|
@ -293,7 +293,7 @@ void MainTab::updateTextLabels(bool showUnits)
|
||||||
void MainTab::enableEdition(EditMode newEditMode)
|
void MainTab::enableEdition(EditMode newEditMode)
|
||||||
{
|
{
|
||||||
const bool isTripEdit = MainWindow::instance() &&
|
const bool isTripEdit = MainWindow::instance() &&
|
||||||
MainWindow::instance()->dive_list()->selectedTrips().count() == 1;
|
MainWindow::instance()->dive_list->selectedTrips().count() == 1;
|
||||||
|
|
||||||
if (((newEditMode == DIVE || newEditMode == NONE) && current_dive == NULL) || editMode != NONE)
|
if (((newEditMode == DIVE || newEditMode == NONE) && current_dive == NULL) || editMode != NONE)
|
||||||
return;
|
return;
|
||||||
|
@ -317,7 +317,7 @@ void MainTab::enableEdition(EditMode newEditMode)
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.editDiveSiteButton->setEnabled(false);
|
ui.editDiveSiteButton->setEnabled(false);
|
||||||
MainWindow::instance()->dive_list()->setEnabled(false);
|
MainWindow::instance()->dive_list->setEnabled(false);
|
||||||
MainWindow::instance()->setEnabledToolbar(false);
|
MainWindow::instance()->setEnabledToolbar(false);
|
||||||
MainWindow::instance()->enterEditState();
|
MainWindow::instance()->enterEditState();
|
||||||
ui.tabWidget->setTabEnabled(2, false);
|
ui.tabWidget->setTabEnabled(2, false);
|
||||||
|
@ -384,7 +384,7 @@ void MainTab::updateDiveInfo(bool clear)
|
||||||
ui.location->refreshDiveSiteCache();
|
ui.location->refreshDiveSiteCache();
|
||||||
EditMode rememberEM = editMode;
|
EditMode rememberEM = editMode;
|
||||||
// don't execute this while adding / planning a dive
|
// don't execute this while adding / planning a dive
|
||||||
if (editMode == ADD || editMode == MANUALLY_ADDED_DIVE || MainWindow::instance()->graphics()->isPlanner())
|
if (editMode == ADD || editMode == MANUALLY_ADDED_DIVE || MainWindow::instance()->graphics->isPlanner())
|
||||||
return;
|
return;
|
||||||
if (!isEnabled() && !clear )
|
if (!isEnabled() && !clear )
|
||||||
setEnabled(true);
|
setEnabled(true);
|
||||||
|
@ -430,7 +430,7 @@ void MainTab::updateDiveInfo(bool clear)
|
||||||
localTime.setTimeSpec(Qt::UTC);
|
localTime.setTimeSpec(Qt::UTC);
|
||||||
ui.dateEdit->setDate(localTime.date());
|
ui.dateEdit->setDate(localTime.date());
|
||||||
ui.timeEdit->setTime(localTime.time());
|
ui.timeEdit->setTime(localTime.time());
|
||||||
if (MainWindow::instance() && MainWindow::instance()->dive_list()->selectedTrips().count() == 1) {
|
if (MainWindow::instance() && MainWindow::instance()->dive_list->selectedTrips().count() == 1) {
|
||||||
// Remember the tab selected for last dive
|
// Remember the tab selected for last dive
|
||||||
if (lastSelectedDive)
|
if (lastSelectedDive)
|
||||||
lastTabSelectedDive = ui.tabWidget->currentIndex();
|
lastTabSelectedDive = ui.tabWidget->currentIndex();
|
||||||
|
@ -442,7 +442,7 @@ void MainTab::updateDiveInfo(bool clear)
|
||||||
if (lastSelectedDive)
|
if (lastSelectedDive)
|
||||||
ui.tabWidget->setCurrentIndex(lastTabSelectedDiveTrip);
|
ui.tabWidget->setCurrentIndex(lastTabSelectedDiveTrip);
|
||||||
lastSelectedDive = false;
|
lastSelectedDive = false;
|
||||||
currentTrip = *MainWindow::instance()->dive_list()->selectedTrips().begin();
|
currentTrip = *MainWindow::instance()->dive_list->selectedTrips().begin();
|
||||||
// only use trip relevant fields
|
// only use trip relevant fields
|
||||||
ui.divemaster->setVisible(false);
|
ui.divemaster->setVisible(false);
|
||||||
ui.DivemasterLabel->setVisible(false);
|
ui.DivemasterLabel->setVisible(false);
|
||||||
|
@ -763,11 +763,11 @@ void MainTab::acceptChanges()
|
||||||
ui.editDiveSiteButton->setEnabled(!ui.location->text().isEmpty());
|
ui.editDiveSiteButton->setEnabled(!ui.location->text().isEmpty());
|
||||||
emit addDiveFinished();
|
emit addDiveFinished();
|
||||||
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::NOTHING);
|
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::NOTHING);
|
||||||
MainWindow::instance()->dive_list()->setFocus();
|
MainWindow::instance()->dive_list->setFocus();
|
||||||
resetPallete();
|
resetPallete();
|
||||||
displayed_dive.divetrip = nullptr; // Should not be necessary, just in case!
|
displayed_dive.divetrip = nullptr; // Should not be necessary, just in case!
|
||||||
return;
|
return;
|
||||||
} else if (MainWindow::instance() && MainWindow::instance()->dive_list()->selectedTrips().count() == 1) {
|
} else if (MainWindow::instance() && MainWindow::instance()->dive_list->selectedTrips().count() == 1) {
|
||||||
/* now figure out if things have changed */
|
/* now figure out if things have changed */
|
||||||
if (displayedTrip.notes && !same_string(displayedTrip.notes, currentTrip->notes)) {
|
if (displayedTrip.notes && !same_string(displayedTrip.notes, currentTrip->notes)) {
|
||||||
currentTrip->notes = copy_string(displayedTrip.notes);
|
currentTrip->notes = copy_string(displayedTrip.notes);
|
||||||
|
@ -932,27 +932,27 @@ void MainTab::acceptChanges()
|
||||||
mark_divelist_changed(true);
|
mark_divelist_changed(true);
|
||||||
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::NOTHING);
|
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::NOTHING);
|
||||||
}
|
}
|
||||||
int scrolledBy = MainWindow::instance()->dive_list()->verticalScrollBar()->sliderPosition();
|
int scrolledBy = MainWindow::instance()->dive_list->verticalScrollBar()->sliderPosition();
|
||||||
resetPallete();
|
resetPallete();
|
||||||
if (editMode == MANUALLY_ADDED_DIVE) {
|
if (editMode == MANUALLY_ADDED_DIVE) {
|
||||||
MainWindow::instance()->dive_list()->reload(DiveTripModel::CURRENT, true);
|
MainWindow::instance()->dive_list->reload(DiveTripModel::CURRENT, true);
|
||||||
int newDiveNr = get_divenr(get_dive_by_uniq_id(addedId));
|
int newDiveNr = get_divenr(get_dive_by_uniq_id(addedId));
|
||||||
MainWindow::instance()->dive_list()->unselectDives();
|
MainWindow::instance()->dive_list->unselectDives();
|
||||||
MainWindow::instance()->dive_list()->selectDive(newDiveNr, true);
|
MainWindow::instance()->dive_list->selectDive(newDiveNr, true);
|
||||||
editMode = NONE;
|
editMode = NONE;
|
||||||
MainWindow::instance()->refreshDisplay();
|
MainWindow::instance()->refreshDisplay();
|
||||||
MainWindow::instance()->graphics()->replot();
|
MainWindow::instance()->graphics->replot();
|
||||||
} else {
|
} else {
|
||||||
editMode = NONE;
|
editMode = NONE;
|
||||||
if (do_replot)
|
if (do_replot)
|
||||||
MainWindow::instance()->graphics()->replot();
|
MainWindow::instance()->graphics->replot();
|
||||||
MainWindow::instance()->dive_list()->rememberSelection();
|
MainWindow::instance()->dive_list->rememberSelection();
|
||||||
MainWindow::instance()->refreshDisplay();
|
MainWindow::instance()->refreshDisplay();
|
||||||
MainWindow::instance()->dive_list()->restoreSelection();
|
MainWindow::instance()->dive_list->restoreSelection();
|
||||||
}
|
}
|
||||||
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::NOTHING);
|
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::NOTHING);
|
||||||
MainWindow::instance()->dive_list()->verticalScrollBar()->setSliderPosition(scrolledBy);
|
MainWindow::instance()->dive_list->verticalScrollBar()->setSliderPosition(scrolledBy);
|
||||||
MainWindow::instance()->dive_list()->setFocus();
|
MainWindow::instance()->dive_list->setFocus();
|
||||||
MainWindow::instance()->exitEditState();
|
MainWindow::instance()->exitEditState();
|
||||||
cylindersModel->changed = false;
|
cylindersModel->changed = false;
|
||||||
weightModel->changed = false;
|
weightModel->changed = false;
|
||||||
|
@ -1003,7 +1003,7 @@ void MainTab::rejectChanges()
|
||||||
// no harm done to call cancelPlan even if we were not in ADD or PLAN mode...
|
// no harm done to call cancelPlan even if we were not in ADD or PLAN mode...
|
||||||
DivePlannerPointsModel::instance()->cancelPlan();
|
DivePlannerPointsModel::instance()->cancelPlan();
|
||||||
if(lastMode == ADD)
|
if(lastMode == ADD)
|
||||||
MainWindow::instance()->dive_list()->restoreSelection();
|
MainWindow::instance()->dive_list->restoreSelection();
|
||||||
|
|
||||||
// now make sure that the correct dive is displayed
|
// now make sure that the correct dive is displayed
|
||||||
if (current_dive)
|
if (current_dive)
|
||||||
|
@ -1019,7 +1019,7 @@ void MainTab::rejectChanges()
|
||||||
// let's get the correct location back in view
|
// let's get the correct location back in view
|
||||||
MapWidget::instance()->centerOnDiveSite(get_dive_site_by_uuid(displayed_dive.dive_site_uuid));
|
MapWidget::instance()->centerOnDiveSite(get_dive_site_by_uuid(displayed_dive.dive_site_uuid));
|
||||||
// show the profile and dive info
|
// show the profile and dive info
|
||||||
MainWindow::instance()->graphics()->replot();
|
MainWindow::instance()->graphics->replot();
|
||||||
MainWindow::instance()->setEnabledToolbar(true);
|
MainWindow::instance()->setEnabledToolbar(true);
|
||||||
MainWindow::instance()->exitEditState();
|
MainWindow::instance()->exitEditState();
|
||||||
cylindersModel->changed = false;
|
cylindersModel->changed = false;
|
||||||
|
@ -1079,7 +1079,7 @@ void MainTab::on_duration_textChanged(const QString &text)
|
||||||
if (editMode == IGNORE || acceptingEdit == true)
|
if (editMode == IGNORE || acceptingEdit == true)
|
||||||
return;
|
return;
|
||||||
// parse this
|
// parse this
|
||||||
MainWindow::instance()->graphics()->setReplot(false);
|
MainWindow::instance()->graphics->setReplot(false);
|
||||||
if (!isEditing())
|
if (!isEditing())
|
||||||
enableEdition();
|
enableEdition();
|
||||||
displayed_dive.dc.duration.seconds = parseDurationToSeconds(text);
|
displayed_dive.dc.duration.seconds = parseDurationToSeconds(text);
|
||||||
|
@ -1088,8 +1088,8 @@ void MainTab::on_duration_textChanged(const QString &text)
|
||||||
displayed_dive.dc.samples = 0;
|
displayed_dive.dc.samples = 0;
|
||||||
DivePlannerPointsModel::instance()->loadFromDive(&displayed_dive);
|
DivePlannerPointsModel::instance()->loadFromDive(&displayed_dive);
|
||||||
markChangedWidget(ui.duration);
|
markChangedWidget(ui.duration);
|
||||||
MainWindow::instance()->graphics()->setReplot(true);
|
MainWindow::instance()->graphics->setReplot(true);
|
||||||
MainWindow::instance()->graphics()->plotDive();
|
MainWindow::instance()->graphics->plotDive();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1098,7 +1098,7 @@ void MainTab::on_depth_textChanged(const QString &text)
|
||||||
if (editMode == IGNORE || acceptingEdit == true)
|
if (editMode == IGNORE || acceptingEdit == true)
|
||||||
return;
|
return;
|
||||||
// don't replot until we set things up the way we want them
|
// don't replot until we set things up the way we want them
|
||||||
MainWindow::instance()->graphics()->setReplot(false);
|
MainWindow::instance()->graphics->setReplot(false);
|
||||||
if (!isEditing())
|
if (!isEditing())
|
||||||
enableEdition();
|
enableEdition();
|
||||||
displayed_dive.dc.maxdepth.mm = parseLengthToMm(text);
|
displayed_dive.dc.maxdepth.mm = parseLengthToMm(text);
|
||||||
|
@ -1107,8 +1107,8 @@ void MainTab::on_depth_textChanged(const QString &text)
|
||||||
displayed_dive.dc.samples = 0;
|
displayed_dive.dc.samples = 0;
|
||||||
DivePlannerPointsModel::instance()->loadFromDive(&displayed_dive);
|
DivePlannerPointsModel::instance()->loadFromDive(&displayed_dive);
|
||||||
markChangedWidget(ui.depth);
|
markChangedWidget(ui.depth);
|
||||||
MainWindow::instance()->graphics()->setReplot(true);
|
MainWindow::instance()->graphics->setReplot(true);
|
||||||
MainWindow::instance()->graphics()->plotDive();
|
MainWindow::instance()->graphics->plotDive();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainTab::on_airtemp_textChanged(const QString &text)
|
void MainTab::on_airtemp_textChanged(const QString &text)
|
||||||
|
@ -1127,7 +1127,7 @@ void MainTab::divetype_Changed(int index)
|
||||||
displayed_dc->divemode = (enum divemode_t) index;
|
displayed_dc->divemode = (enum divemode_t) index;
|
||||||
update_setpoint_events(&displayed_dive, displayed_dc);
|
update_setpoint_events(&displayed_dive, displayed_dc);
|
||||||
markChangedWidget(ui.DiveType);
|
markChangedWidget(ui.DiveType);
|
||||||
MainWindow::instance()->graphics()->recalcCeiling();
|
MainWindow::instance()->graphics->recalcCeiling();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainTab::on_watertemp_textChanged(const QString &text)
|
void MainTab::on_watertemp_textChanged(const QString &text)
|
||||||
|
|
|
@ -92,7 +92,7 @@ void TagWidget::reparse()
|
||||||
* Do not show the completer when not in edit mode - basically
|
* Do not show the completer when not in edit mode - basically
|
||||||
* this returns when we are accepting or discarding the changes.
|
* this returns when we are accepting or discarding the changes.
|
||||||
*/
|
*/
|
||||||
if (MainWindow::instance()->information()->isEditing() == false) {
|
if (MainWindow::instance()->information->isEditing() == false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ void TagWidget::keyPressEvent(QKeyEvent *e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (e->key() == Qt::Key_Tab && lastFinishedTag) { // if we already end in comma, go to next/prev field
|
if (e->key() == Qt::Key_Tab && lastFinishedTag) { // if we already end in comma, go to next/prev field
|
||||||
MainWindow::instance()->information()->nextInputField(e); // by sending the key event to the MainTab widget
|
MainWindow::instance()->information->nextInputField(e); // by sending the key event to the MainTab widget
|
||||||
} else if (e->key() == Qt::Key_Tab || e->key() == Qt::Key_Return) { // otherwise let's pretend this is a comma instead
|
} else if (e->key() == Qt::Key_Tab || e->key() == Qt::Key_Return) { // otherwise let's pretend this is a comma instead
|
||||||
QKeyEvent fakeEvent(e->type(), Qt::Key_Comma, e->modifiers(), QString(","));
|
QKeyEvent fakeEvent(e->type(), Qt::Key_Comma, e->modifiers(), QString(","));
|
||||||
keyPressEvent(&fakeEvent);
|
keyPressEvent(&fakeEvent);
|
||||||
|
|
|
@ -644,7 +644,7 @@ void MultiFilterSortModel::myInvalidate()
|
||||||
#if !defined(SUBSURFACE_MOBILE)
|
#if !defined(SUBSURFACE_MOBILE)
|
||||||
int i;
|
int i;
|
||||||
struct dive *d;
|
struct dive *d;
|
||||||
DiveListView *dlv = MainWindow::instance()->dive_list();
|
DiveListView *dlv = MainWindow::instance()->dive_list;
|
||||||
|
|
||||||
divesDisplayed = 0;
|
divesDisplayed = 0;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue