Changeset 913fa85 in subsurface


Ignore:
Timestamp:
Jan 7, 2017, 7:12:07 AM (5 months ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
master
Children:
a6f9a37
Parents:
c084887 (diff), e3a7782 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'plannerSettings'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • qt-models/diveplannermodel.cpp

    r9357341 r913fa85  
    66#include "qt-models/models.h"
    77#include "core/device.h"
     8#include "core/subsurface-qt/SettingsObjectWrapper.h"
    89
    910/* TODO: Port this to CleanerTableModel to remove a bit of boilerplate and
     
    378379{
    379380        diveplan.bottomsac = units_to_sac(sac);
    380         prefs.bottomsac = diveplan.bottomsac;
     381        auto planner = SettingsObjectWrapper::instance()->planner_settings;
     382        planner->setBottomSac(diveplan.bottomsac);
    381383        emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
    382384}
     
    385387{
    386388        diveplan.decosac = units_to_sac(sac);
    387         prefs.decosac = diveplan.decosac;
     389        auto planner = SettingsObjectWrapper::instance()->planner_settings;
     390        planner->setDecoSac(diveplan.decosac);
    388391        emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
    389392}
     
    456459void DivePlannerPointsModel::setLastStop6m(bool value)
    457460{
    458         prefs.last_stop = value;
     461        auto planner = SettingsObjectWrapper::instance()->planner_settings;
     462        planner->setLastStop(value);
    459463        emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
    460464}
     
    462466void DivePlannerPointsModel::setVerbatim(bool value)
    463467{
    464         prefs.verbatim_plan = value;
     468        auto planner = SettingsObjectWrapper::instance()->planner_settings;
     469        planner->setVerbatimPlan(value);
    465470        emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
    466471}
     
    468473void DivePlannerPointsModel::setDisplayRuntime(bool value)
    469474{
    470         prefs.display_runtime = value;
     475        auto planner = SettingsObjectWrapper::instance()->planner_settings;
     476        planner->setDisplayRuntime(value);
    471477        emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
    472478}
     
    474480void DivePlannerPointsModel::setDisplayDuration(bool value)
    475481{
    476         prefs.display_duration = value;
     482        auto planner = SettingsObjectWrapper::instance()->planner_settings;
     483        planner->setDisplayDuration(value);
    477484        emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
    478485}
     
    480487void DivePlannerPointsModel::setDisplayTransitions(bool value)
    481488{
    482         prefs.display_transitions = value;
     489        auto planner = SettingsObjectWrapper::instance()->planner_settings;
     490        planner->setDisplayTransitions(value);
    483491        emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
    484492}
     
    486494void DivePlannerPointsModel::setDecoMode(int mode)
    487495{
    488         prefs.planner_deco_mode = deco_mode(mode);
     496        auto planner = SettingsObjectWrapper::instance()->planner_settings;
     497        planner->setDecoMode(deco_mode(mode));
    489498        emit recreationChanged(mode == int(prefs.planner_deco_mode));
    490499        emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS -1));
     
    493502void DivePlannerPointsModel::setSafetyStop(bool value)
    494503{
    495         prefs.safetystop = value;
     504        auto planner = SettingsObjectWrapper::instance()->planner_settings;
     505        planner->setSafetyStop(value);
    496506        emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS -1));
    497507}
     
    499509void DivePlannerPointsModel::setReserveGas(int reserve)
    500510{
     511        auto planner = SettingsObjectWrapper::instance()->planner_settings;
    501512        if (prefs.units.pressure == units::BAR)
    502                 prefs.reserve_gas = reserve * 1000;
     513                planner->setReserveGas(reserve * 1000);
    503514        else
    504                 prefs.reserve_gas = psi_to_mbar(reserve);
     515                planner->setReserveGas(psi_to_mbar(reserve));
    505516        emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
    506517}
     
    508519void DivePlannerPointsModel::setDropStoneMode(bool value)
    509520{
    510         prefs.drop_stone_mode = value;
     521        auto planner = SettingsObjectWrapper::instance()->planner_settings;
     522        planner->setDropStoneMode(value);
    511523        if (prefs.drop_stone_mode) {
    512524        /* Remove the first entry if we enable drop_stone_mode */
     
    530542void DivePlannerPointsModel::setSwitchAtReqStop(bool value)
    531543{
    532         prefs.switch_at_req_stop = value;
     544        auto planner = SettingsObjectWrapper::instance()->planner_settings;
     545        planner->setSwitchAtRequiredStop(value);
    533546        emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
    534547}
     
    536549void DivePlannerPointsModel::setMinSwitchDuration(int duration)
    537550{
    538         prefs.min_switch_duration = duration * 60;
     551        auto planner = SettingsObjectWrapper::instance()->planner_settings;
     552        planner->setMinSwitchDuration(duration * 60);
    539553        emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
    540554}
Note: See TracChangeset for help on using the changeset viewer.