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>
This commit is contained in:
Tomaz Canabrava 2013-06-27 14:48:03 -03:00
parent de7506b44d
commit 1244438b01
5 changed files with 53 additions and 45 deletions

View file

@ -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;

View file

@ -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

View file

@ -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);
}

View file

@ -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;

View file

@ -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/>