Planner: New plannerSettingsWidget

In planner mode, this replaces the globe with the dive plan and introduces
a new plannerSettingsWidget in the diveListPane. All new fields are still
disfunctional. This is WIP.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Robert C. Helling 2014-06-10 17:40:02 +02:00 committed by Dirk Hohndel
parent 1644be22ac
commit 708f19830e
7 changed files with 377 additions and 81 deletions

View file

@ -275,11 +275,6 @@ DivePlannerWidget::DivePlannerWidget(QWidget *parent, Qt::WindowFlags f) : QWidg
connect(ui.gfhigh, SIGNAL(editingFinished()), plannerModel, SLOT(emitDataChanged()));
connect(ui.gflow, SIGNAL(valueChanged(int)), plannerModel, SLOT(setGFLow(int)));
connect(ui.gflow, SIGNAL(editingFinished()), plannerModel, SLOT(emitDataChanged()));
connect(ui.lastStop, SIGNAL(toggled(bool)), plannerModel, SLOT(setLastStop6m(bool)));
connect(ui.verbatim_plan, SIGNAL(toggled(bool)), plannerModel, SLOT(setVerbatim(bool)));
connect(ui.display_duration, SIGNAL(toggled(bool)), plannerModel, SLOT(setDisplayDuration(bool)));
connect(ui.display_runtime, SIGNAL(toggled(bool)), plannerModel, SLOT(setDisplayRuntime(bool)));
connect(ui.display_transitions, SIGNAL(toggled(bool)), plannerModel, SLOT(setDisplayTransitions(bool)));
connect(ui.printPlan, SIGNAL(pressed()), this, SLOT(printDecoPlan()));
// Creating (and canceling) the plan
@ -330,6 +325,41 @@ void DivePlannerWidget::printDecoPlan()
MainWindow::instance()->printPlan();
}
PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f)
{
ui.setupUi(this);
connect(ui.lastStop, SIGNAL(toggled(bool)), plannerModel, SLOT(setLastStop6m(bool)));
connect(ui.verbatim_plan, SIGNAL(toggled(bool)), plannerModel, SLOT(setVerbatim(bool)));
connect(ui.display_duration, SIGNAL(toggled(bool)), plannerModel, SLOT(setDisplayDuration(bool)));
connect(ui.display_runtime, SIGNAL(toggled(bool)), plannerModel, SLOT(setDisplayRuntime(bool)));
connect(ui.display_transitions, SIGNAL(toggled(bool)), plannerModel, SLOT(setDisplayTransitions(bool)));
setMinimumWidth(0);
setMinimumHeight(0);
}
void PlannerSettingsWidget::settingsChanged()
{
}
void PlannerSettingsWidget::atmPressureChanged(const QString &pressure)
{
}
void PlannerSettingsWidget::bottomSacChanged(const QString &bottomSac)
{
}
void PlannerSettingsWidget::decoSacChanged(const QString &decosac)
{
}
void PlannerSettingsWidget::printDecoPlan()
{
}
void DivePlannerPointsModel::setPlanMode(Mode m)
{
mode = m;

View file

@ -143,6 +143,25 @@ private:
Ui::DivePlanner ui;
};
#include "ui_plannerSettings.h"
class PlannerSettingsWidget : public QWidget {
Q_OBJECT
public:
explicit PlannerSettingsWidget(QWidget *parent = 0, Qt::WindowFlags f = 0);
public
slots:
void settingsChanged();
void atmPressureChanged(const QString &pressure);
void bottomSacChanged(const QString &bottomSac);
void decoSacChanged(const QString &decosac);
void printDecoPlan();
private:
Ui::plannerSettingsWidget ui;
};
QString dpGasToStr(const divedatapoint &p);
#endif // DIVEPLANNER_H

View file

@ -65,10 +65,10 @@
<property name="spacing">
<number>2</number>
</property>
<item row="10" column="0" colspan="2">
<widget class="TableView" name="tableWidget" native="true">
<item row="7" column="0" colspan="2">
<widget class="TableView" name="cylinderTableWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -81,10 +81,10 @@
</property>
</widget>
</item>
<item row="9" column="0" colspan="2">
<widget class="TableView" name="cylinderTableWidget" native="true">
<item row="8" column="0" colspan="2">
<widget class="TableView" name="tableWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -110,6 +110,9 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QTimeEdit" name="startTime"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
@ -124,23 +127,13 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QTimeEdit" name="startTime"/>
</item>
<item row="13" column="0" colspan="2">
<item row="11" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Abort|QDialogButtonBox::Save</set>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="lastStop">
<property name="text">
<string>Last Stop at 6m</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLineEdit" name="bottomSAC"/>
</item>
@ -154,13 +147,6 @@
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QCheckBox" name="verbatim_plan">
<property name="text">
<string>verbatim diveplan</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_4">
<property name="text">
@ -192,46 +178,7 @@
<item row="1" column="1">
<widget class="QLineEdit" name="ATMPressure"/>
</item>
<item row="8" column="0">
<widget class="QCheckBox" name="display_transitions">
<property name="toolTip">
<string>In diveplan, list transitions or treat them as implicit</string>
</property>
<property name="text">
<string>display transitions in deco</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QCheckBox" name="display_duration">
<property name="enabled">
<bool>true</bool>
</property>
<property name="toolTip">
<string>In dive plan, show duration (relative time) of stops</string>
</property>
<property name="text">
<string>display segment duration</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QCheckBox" name="display_runtime">
<property name="toolTip">
<string>In dive plan, show runtime (absolute time) of stops</string>
</property>
<property name="text">
<string>display runtime</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="8" column="1">
<item row="6" column="1">
<widget class="QPushButton" name="printPlan">
<property name="text">
<string>Print</string>

View file

@ -133,6 +133,7 @@ void MainWindow::refreshDisplay(bool doRecreateDiveList)
if (doRecreateDiveList)
recreateDiveList();
ui.diveListPane->setCurrentIndex(0); // switch to the dive list
ui.globePane->setCurrentIndex(0);
ui.ListWidget->setEnabled(true);
ui.ListWidget->setFocus();
WSInfoModel::instance()->updateInfo();
@ -472,6 +473,7 @@ void MainWindow::on_actionDivePlanner_triggered()
ui.ListWidget->reload(DiveTripModel::CURRENT);
ui.ListWidget->setEnabled(false);
ui.diveListPane->setCurrentIndex(1); // switch to the plan output
ui.globePane->setCurrentIndex(1);
}
void MainWindow::on_actionAddDive_triggered()

View file

@ -38,7 +38,7 @@
</property>
<widget class="QStackedWidget" name="infoPane">
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="page">
<layout class="QHBoxLayout" name="horizontalLayout_3">
@ -504,7 +504,7 @@
</property>
<widget class="QStackedWidget" name="diveListPane">
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="DiveListView" name="ListWidget">
<property name="alternatingRowColors">
@ -526,7 +526,7 @@
<bool>true</bool>
</property>
</widget>
<widget class="QWidget" name="fullPlan">
<widget class="PlannerSettingsWidget" name="fullPlan">
<layout class="QVBoxLayout" name="horizontalLayout_p4">
<property name="spacing">
<number>0</number>
@ -543,8 +543,42 @@
<property name="bottomMargin">
<number>0</number>
</property>
</layout>
</widget>
</widget>
<widget class="QStackedWidget" name="globePane">
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="stackedWidgetPage1" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="GlobeGPS" name="globe" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_5">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QLabel" name="divePlanOutputLabel">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>Dive plan details</string>
</property>
@ -552,6 +586,12 @@
</item>
<item>
<widget class="QTextEdit" name="divePlanOutput">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">font: 13pt &quot;Courier&quot;;</string>
</property>
@ -570,18 +610,14 @@ p, li { white-space: pre-wrap; }
</layout>
</widget>
</widget>
<widget class="QWidget" name="layoutWidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="GlobeGPS" name="globe" native="true"/>
</item>
</layout>
</widget>
</widget>
</widget>
</item>
<item>
<widget class="KMessageWidget" name="mainErrorMessage" native="true"/>
<widget class="KMessageWidget" name="mainErrorMessage" native="true">
<zorder>mainSplitter</zorder>
<zorder>mainSplitter</zorder>
</widget>
</item>
</layout>
</widget>
@ -1003,6 +1039,12 @@ p, li { white-space: pre-wrap; }
<extends>QGraphicsView</extends>
<header>qt-ui/profile/profilewidget2.h</header>
</customwidget>
<customwidget>
<class>PlannerSettingsWidget</class>
<extends>QWidget</extends>
<header>diveplanner.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../subsurface.qrc"/>

255
qt-ui/plannerSettings.ui Normal file
View file

@ -0,0 +1,255 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>plannerSettingsWidget</class>
<widget class="QWidget" name="plannerSettingsWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>963</width>
<height>324</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QWidget" name="gridLayoutWidget">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>872</width>
<height>203</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="2">
<widget class="QFrame" name="frame_2">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QCheckBox" name="lastStop">
<property name="text">
<string>Last Stop at 6m/20ft</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="backgasBreaks">
<property name="text">
<string>plan backgas breaks</string>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QFrame" name="frame_4">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QFormLayout" name="formLayout_2">
<item row="1" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string> bottom ppO2</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>deco ppO2</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPlainTextEdit" name="ascRate75_2">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>20</height>
</size>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPlainTextEdit" name="ascRate75_3">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>20</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="verbatim_plan">
<property name="text">
<string>verbatim diveplan</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="display_runtime">
<property name="toolTip">
<string>In dive plan, show runtime (absolute time) of stops</string>
</property>
<property name="text">
<string>display runtime</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="display_duration">
<property name="enabled">
<bool>true</bool>
</property>
<property name="toolTip">
<string>In dive plan, show duration (relative time) of stops</string>
</property>
<property name="text">
<string>display segment duration</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="display_transitions">
<property name="toolTip">
<string>In diveplan, list transitions or treat them as implicit</string>
</property>
<property name="text">
<string>display transitions in deco</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="1">
<widget class="QFrame" name="frame_3">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>below 75% avg. depth</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPlainTextEdit" name="ascRate75">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>20</height>
</size>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>75%-50% avg. depth</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>50% avg. depth - 6m/20ft</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>6m/20ft to surface</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPlainTextEdit" name="ascRate50">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>20</height>
</size>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QPlainTextEdit" name="ascRateStops">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>20</height>
</size>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QPlainTextEdit" name="ascRateLast6m">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>20</height>
</size>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Ascent rates</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View file

@ -187,7 +187,8 @@ FORMS = \
qt-ui/tableview.ui \
qt-ui/divelogimportdialog.ui \
qt-ui/usermanual.ui \
qt-ui/divelogexportdialog.ui
qt-ui/divelogexportdialog.ui \
qt-ui/plannerSettings.ui
# Nether usermanual or printing is supported on android right now
android: FORMS -= qt-ui/usermanual.ui qt-ui/printoptions.ui