Added a new widget to control the Planner

Added a new widget to control the DivePlanner, now we
have two widgets, a graphics one and a qt sidget based one.
the Technical divers will most likely use the QtWidget one
while the hobbists will most likely use the QGraphicsView
one. there's not a option to choose one, they both will
appear at the same time.

Next step: make the screens to work.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
Tomaz Canabrava 2013-08-26 08:43:37 -03:00
parent 2fb2918607
commit 0a043528f7
5 changed files with 144 additions and 62 deletions

View file

@ -799,3 +799,8 @@ void Button::mousePressEvent(QGraphicsSceneMouseEvent* event)
event->ignore();
emit clicked();
}
DivePlannerWidget::DivePlannerWidget(QWidget* parent, Qt::WindowFlags f): QWidget(parent, f), ui(new Ui::DivePlanner())
{
ui->setupUi(this);
}

View file

@ -5,6 +5,10 @@
#include <QGraphicsPathItem>
#include <QDialog>
namespace Ui{
class DivePlanner;
};
class QListView;
class QStringListModel;
class QModelIndex;
@ -145,4 +149,12 @@ private:
int dpMaxTime; // this is the time of the dive calculated by the deco.
};
class DivePlannerWidget : public QWidget {
Q_OBJECT
public:
explicit DivePlannerWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
private:
Ui::DivePlanner *ui;
};
#endif

View file

@ -1,27 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DivePlanner</class>
<widget class="QDialog" name="DivePlanner">
<widget class="QWidget" name="DivePlanner">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>575</width>
<height>451</height>
<width>400</width>
<height>352</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="DivePlannerGraphics" name="graphicsView"/>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Start Time</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_2">
<property name="text">
<string>ATM Pressure</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QTimeEdit" name="startTime"/>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="ATMPressure"/>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="decoStopSAC"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Low GF</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLineEdit" name="lowGF"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Bottom SAC</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="label_6">
<property name="text">
<string>High GF</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_4">
<property name="text">
<string>SAC on DECO Stop</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLineEdit" name="bottomSAC"/>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="highGF"/>
</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="7" column="0" colspan="2">
<widget class="QTableView" name="tablePoints"/>
</item>
<item row="8" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
@ -29,46 +93,6 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>DivePlannerGraphics</class>
<extends>QGraphicsView</extends>
<header>diveplanner.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>DivePlanner</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>DivePlanner</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
<connections/>
</ui>

View file

@ -238,12 +238,14 @@ void MainWindow::on_actionDivePlanner_triggered()
{
disableDcShortcuts();
ui->stackedWidget->setCurrentIndex(1);
ui->infoPane->setCurrentIndex(1);
}
void MainWindow::showProfile()
{
enableDcShortcuts();
ui->stackedWidget->setCurrentIndex(0);
ui->infoPane->setCurrentIndex(0);
}

View file

@ -24,17 +24,44 @@
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<widget class="MainTab" name="InfoWidget" native="true"/>
<widget class="QStackedWidget" name="infoPane">
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="page">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="MainTab" name="InfoWidget" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_2">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="DivePlannerWidget" name="widget" native="true"/>
</item>
</layout>
</widget>
</widget>
<widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="page_5">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
@ -47,7 +74,16 @@
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
@ -123,10 +159,7 @@
</widget>
</item>
<item>
<widget class="KMessageWidget" name="mainErrorMessage" native="true">
<zorder>mainSplitter</zorder>
<zorder>mainSplitter</zorder>
</widget>
<widget class="KMessageWidget" name="mainErrorMessage" native="true"/>
</item>
</layout>
</widget>
@ -136,7 +169,7 @@
<x>0</x>
<y>0</y>
<width>763</width>
<height>20</height>
<height>19</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
@ -443,6 +476,12 @@
<extends>QGraphicsView</extends>
<header>diveplanner.h</header>
</customwidget>
<customwidget>
<class>DivePlannerWidget</class>
<extends>QWidget</extends>
<header>diveplanner.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>