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(); event->ignore();
emit clicked(); 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 <QGraphicsPathItem>
#include <QDialog> #include <QDialog>
namespace Ui{
class DivePlanner;
};
class QListView; class QListView;
class QStringListModel; class QStringListModel;
class QModelIndex; class QModelIndex;
@ -145,4 +149,12 @@ private:
int dpMaxTime; // this is the time of the dive calculated by the deco. 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 #endif

View file

@ -1,27 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>DivePlanner</class> <class>DivePlanner</class>
<widget class="QDialog" name="DivePlanner"> <widget class="QWidget" name="DivePlanner">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>575</width> <width>400</width>
<height>451</height> <height>352</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Dialog</string> <string>Form</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QGridLayout" name="gridLayout">
<item> <item row="0" column="0">
<widget class="DivePlannerGraphics" name="graphicsView"/> <widget class="QLabel" name="label">
</item> <property name="text">
<item> <string>Start Time</string>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property> </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"> <property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property> </property>
@ -29,46 +93,6 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<customwidgets>
<customwidget>
<class>DivePlannerGraphics</class>
<extends>QGraphicsView</extends>
<header>diveplanner.h</header>
</customwidget>
</customwidgets>
<resources/> <resources/>
<connections> <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>
</ui> </ui>

View file

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

View file

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