not working yet, the UI sucks but it's a right step. tons of bugs. don't use, don't merge. more tomorrow.
From cb57ef13bdfe8d9c969c8e007b7c67e010c89c2d Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Wed, 30 Mar 2016 20:36:44 -0300 Subject: [PATCH 3/3] Add signal to handle the button to add the dive
Signed-off-by: Tomaz Canabrava <[email protected]> --- profile-widget/profilewidget2.cpp | 8 ++++++++ profile-widget/profilewidget2.h | 1 + 2 files changed, 9 insertions(+) diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp index 3c3d00d..537b888 100644 --- a/profile-widget/profilewidget2.cpp +++ b/profile-widget/profilewidget2.cpp @@ -177,6 +177,7 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : QGraphicsView(parent), l->addWidget(addDiveDuration, 1, 1); l->addWidget(addDiveAccept, 2, 1); addDiveOverlay->setLayout(l); + connect(addDiveAccept, &QPushButton::clicked, this, &ProfileWidget2::addDiveAcceptClicked); #endif } @@ -216,6 +217,13 @@ ProfileWidget2::~ProfileWidget2() delete tankItem; } +#ifndef SUBSURFACE_MOBILE +void ProfileWidget2::addDiveAcceptClicked() +{ + qDebug() << "Clicked" << addDiveDepth->text() << addDiveDuration->text(); +} +#endif + #define SUBSURFACE_OBJ_DATA 1 #define SUBSURFACE_OBJ_DC_TEXT 0x42 diff --git a/profile-widget/profilewidget2.h b/profile-widget/profilewidget2.h index 4391116..aad9ac1 100644 --- a/profile-widget/profilewidget2.h +++ b/profile-widget/profilewidget2.h @@ -151,6 +151,7 @@ protected: void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE; void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE; void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE; + void addDiveAcceptClicked(); #endif void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE; void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE; -- 2.7.4
From c465d7b03744f0e3c9f50f03373902ab924e32a4 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Wed, 30 Mar 2016 20:10:54 -0300 Subject: [PATCH 2/3] Show the dialog to create the Dive This dialog is horrible, we need to find a way to make it look good. One of the biggest issues is that the subsurface UI is really hard to hack on - something that I plan to fix soon, as already discussed with Dirk. Signed-off-by: Tomaz Canabrava <[email protected]> --- profile-widget/profilewidget2.cpp | 32 +++++++++++++++++++------------- profile-widget/profilewidget2.h | 4 +++- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp index cd20c11..3c3d00d 100644 --- a/profile-widget/profilewidget2.cpp +++ b/profile-widget/profilewidget2.cpp @@ -19,6 +19,8 @@ #include "diveplanner.h" #include "simplewidgets.h" #include "divepicturewidget.h" +#include <QLineEdit> +#include <QPushButton> #endif #include <libdivecomputer/parser.h> @@ -118,10 +120,10 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : QGraphicsView(parent), mouseFollowerVertical(new DiveLineItem()), mouseFollowerHorizontal(new DiveLineItem()), rulerItem(new RulerItem2()), - addDivePanel(new QGraphicsProxyWidget()), + addDiveOverlay(new QWidget()), addDiveDuration(new QLineEdit()), addDiveDepth(new QLineEdit()), - addDiveAccept(new QPushButton()), + addDiveAccept(new QPushButton(tr("Create"))), #endif tankItem(new TankItem()), isGrayscale(false), @@ -167,19 +169,17 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : QGraphicsView(parent), diveDepthTableView->show(); #endif - QWidget *panel = new QWidget(); - QHBoxLayout *l = new QHBoxLayout(); - l->addWidget(new QLabel("Depth:")); - l->addWidget(addDiveDepth); - l->addWidget(new QLabel("Duration:"); - l->addWidget(addDiveDuration); - l->addWidget(addDiveAccept); - panel->setLayout(l); - addDivePanel->setWidget(panel); - addDivePanel->setVisible(false); +#ifndef SUBSURFACE_MOBILE + QGridLayout *l = new QGridLayout(); + l->addWidget(new QLabel("Depth:"), 0, 0); + l->addWidget(addDiveDepth, 0, 1); + l->addWidget(new QLabel("Duration:"), 1, 0); + l->addWidget(addDiveDuration, 1, 1); + l->addWidget(addDiveAccept, 2, 1); + addDiveOverlay->setLayout(l); +#endif } - ProfileWidget2::~ProfileWidget2() { delete background; @@ -1259,6 +1259,12 @@ void ProfileWidget2::setAddState() diveCeiling->setVisible(true); decoModelParameters->setVisible(true); setBackgroundBrush(QColor("#A7DCFF")); + + addDiveOverlay->setParent(this); + QRect r = addDiveOverlay->geometry(); + addDiveOverlay->setStyleSheet("QWidget { background: white } QLineEdit { background: white}"); + addDiveOverlay->setGeometry(0,geometry().bottom() - 100,250,100); + addDiveOverlay->setVisible(true); } void ProfileWidget2::setPlanState() diff --git a/profile-widget/profilewidget2.h b/profile-widget/profilewidget2.h index 31f15ef..4391116 100644 --- a/profile-widget/profilewidget2.h +++ b/profile-widget/profilewidget2.h @@ -47,6 +47,8 @@ class DiveHandler; class QGraphicsSimpleTextItem; class QModelIndex; class DivePictureItem; +class QLineEdit; +class QPushButton; class ProfileWidget2 : public QGraphicsView { Q_OBJECT @@ -213,7 +215,7 @@ private: DiveLineItem *mouseFollowerHorizontal; RulerItem2 *rulerItem; - QGraphicsProxyWidget *addDivePanel; + QWidget *addDiveOverlay; QLineEdit *addDiveDuration; QLineEdit *addDiveDepth; QPushButton *addDiveAccept; -- 2.7.4
From c246c43a1f4303b1c88b00cfe3044967237e8b3d Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Wed, 30 Mar 2016 19:18:31 -0300 Subject: [PATCH 1/3] Add the necessary widgets for the Add Dive minimal setup. The add dive with minimal setup will offer two input widgets one for depth, other for duration, and the dive will be created using those values. Signed-off-by: Tomaz Canabrava <[email protected]> --- profile-widget/profilewidget2.cpp | 15 +++++++++++++++ profile-widget/profilewidget2.h | 5 +++++ 2 files changed, 20 insertions(+) diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp index e4b03eb..cd20c11 100644 --- a/profile-widget/profilewidget2.cpp +++ b/profile-widget/profilewidget2.cpp @@ -118,6 +118,10 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : QGraphicsView(parent), mouseFollowerVertical(new DiveLineItem()), mouseFollowerHorizontal(new DiveLineItem()), rulerItem(new RulerItem2()), + addDivePanel(new QGraphicsProxyWidget()), + addDiveDuration(new QLineEdit()), + addDiveDepth(new QLineEdit()), + addDiveAccept(new QPushButton()), #endif tankItem(new TankItem()), isGrayscale(false), @@ -162,6 +166,17 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : QGraphicsView(parent), diveDepthTableView->setModel(dataModel); diveDepthTableView->show(); #endif + + QWidget *panel = new QWidget(); + QHBoxLayout *l = new QHBoxLayout(); + l->addWidget(new QLabel("Depth:")); + l->addWidget(addDiveDepth); + l->addWidget(new QLabel("Duration:"); + l->addWidget(addDiveDuration); + l->addWidget(addDiveAccept); + panel->setLayout(l); + addDivePanel->setWidget(panel); + addDivePanel->setVisible(false); } diff --git a/profile-widget/profilewidget2.h b/profile-widget/profilewidget2.h index 5e05b14..31f15ef 100644 --- a/profile-widget/profilewidget2.h +++ b/profile-widget/profilewidget2.h @@ -212,6 +212,11 @@ private: DiveLineItem *mouseFollowerVertical; DiveLineItem *mouseFollowerHorizontal; RulerItem2 *rulerItem; + + QGraphicsProxyWidget *addDivePanel; + QLineEdit *addDiveDuration; + QLineEdit *addDiveDepth; + QPushButton *addDiveAccept; #endif TankItem *tankItem; bool isGrayscale; -- 2.7.4
_______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
