aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-06-27 14:48:03 -0300
committerGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-06-27 14:48:03 -0300
commit1244438b017f71be466ace7df9cad9462287fd30 (patch)
treeaa7dcb8f0e52f54d01918f54e3ffd617eea4f9ea
parentde7506b44d03b4190d3a0205398d047e8303f75a (diff)
downloadsubsurface-1244438b017f71be466ace7df9cad9462287fd30.tar.gz
Moved the DivePlanner to the MainWindow.
Now, activating the dive planner will hide the profile and show the planner on the same place. we still need a way to 'cancel' or 'accept' the profile created. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
-rw-r--r--qt-ui/diveplanner.cpp20
-rw-r--r--qt-ui/diveplanner.h14
-rw-r--r--qt-ui/mainwindow.cpp11
-rw-r--r--qt-ui/mainwindow.h3
-rw-r--r--qt-ui/mainwindow.ui50
5 files changed, 53 insertions, 45 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index 799e87c42..e8cca8280 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -170,13 +170,13 @@ void DivePlannerGraphics::createDecoStops()
void DivePlannerGraphics::resizeEvent(QResizeEvent* event)
{
QGraphicsView::resizeEvent(event);
- fitInView(sceneRect(), Qt::KeepAspectRatio);
+ fitInView(sceneRect(), Qt::IgnoreAspectRatio);
}
void DivePlannerGraphics::showEvent(QShowEvent* event)
{
QGraphicsView::showEvent(event);
- fitInView(sceneRect(), Qt::KeepAspectRatio);
+ fitInView(sceneRect(), Qt::IgnoreAspectRatio);
}
void DivePlannerGraphics::mouseMoveEvent(QMouseEvent* event)
@@ -349,22 +349,6 @@ qreal Ruler::posAtValue(qreal value)
return retValue;
}
-DivePlanner::DivePlanner() : ui(new Ui::DivePlanner())
-{
- ui->setupUi(this);
-}
-
-struct dive* DivePlanner::getDive()
-{
- return 0;
-}
-
-DivePlanner* DivePlanner::instance()
-{
- static DivePlanner *self = new DivePlanner();
- return self;
-}
-
double Ruler::maximum() const
{
return max;
diff --git a/qt-ui/diveplanner.h b/qt-ui/diveplanner.h
index 8669217a1..4029a6875 100644
--- a/qt-ui/diveplanner.h
+++ b/qt-ui/diveplanner.h
@@ -90,18 +90,4 @@ private:
QPointF lastValidPos;
};
-namespace Ui{
- class DivePlanner;
-}
-
-class DivePlanner : public QDialog{
- Q_OBJECT
-public:
- static DivePlanner *instance();
- struct dive* getDive();
-
-private:
- DivePlanner();
- Ui::DivePlanner *ui;
-};
#endif
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 3f16b50e5..66bebc6c7 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -223,11 +223,12 @@ void MainWindow::on_actionPrint_triggered()
void MainWindow::on_actionDivePlanner_triggered()
{
- DivePlanner *planner = DivePlanner::instance();
- if (planner->exec() == QDialog::Accepted){
- struct dive *d = planner->getDive();
- qDebug() << "Finish me.";
- }
+ ui->stackedWidget->setCurrentIndex(1);
+}
+
+void MainWindow::showProfile()
+{
+ ui->stackedWidget->setCurrentIndex(0);
}
diff --git a/qt-ui/mainwindow.h b/qt-ui/mainwindow.h
index 4890cb2ef..013c0dca7 100644
--- a/qt-ui/mainwindow.h
+++ b/qt-ui/mainwindow.h
@@ -48,8 +48,6 @@ public:
void setTitle(enum MainWindowTitleFormat format);
private slots:
-
-
/* file menu action */
void on_actionNew_triggered();
void on_actionOpen_triggered();
@@ -100,6 +98,7 @@ protected:
public slots:
void readSettings();
void refreshDisplay();
+ void showProfile();
private:
Ui::MainWindow *ui;
diff --git a/qt-ui/mainwindow.ui b/qt-ui/mainwindow.ui
index b1274b8ea..731013538 100644
--- a/qt-ui/mainwindow.ui
+++ b/qt-ui/mainwindow.ui
@@ -14,8 +14,8 @@
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0">
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
<widget class="QSplitter" name="mainSplitter">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -25,7 +25,37 @@
<enum>Qt::Horizontal</enum>
</property>
<widget class="MainTab" name="InfoWidget" native="true"/>
- <widget class="ProfileGraphicsView" name="ProfileWidget"/>
+ <widget class="QStackedWidget" name="stackedWidget">
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="page_5">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="ProfileGraphicsView" name="ProfileWidget"/>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="page_6">
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="DivePlannerGraphics" name="divePlanner"/>
+ </item>
+ </layout>
+ </widget>
+ </widget>
</widget>
<widget class="QSplitter" name="listGlobeSplitter">
<property name="orientation">
@@ -92,8 +122,11 @@
</widget>
</widget>
</item>
- <item row="1" column="0">
- <widget class="KMessageWidget" name="mainErrorMessage" native="true"/>
+ <item>
+ <widget class="KMessageWidget" name="mainErrorMessage" native="true">
+ <zorder>mainSplitter</zorder>
+ <zorder>mainSplitter</zorder>
+ </widget>
</item>
</layout>
</widget>
@@ -103,7 +136,7 @@
<x>0</x>
<y>0</y>
<width>763</width>
- <height>18</height>
+ <height>20</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
@@ -405,6 +438,11 @@
<header>globe.h</header>
<container>1</container>
</customwidget>
+ <customwidget>
+ <class>DivePlannerGraphics</class>
+ <extends>QGraphicsView</extends>
+ <header>diveplanner.h</header>
+ </customwidget>
</customwidgets>
<resources/>
<connections/>