summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2013-11-01 09:33:39 -0400
committerGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2013-11-01 09:33:39 -0400
commit69d4ccae6db83173c2d87b2565852b530852c3cc (patch)
tree0a02684538e093fe7c41558ee314abd5abf28a8a
parenta7b19b251da3421060f9603133265f0a5d54492d (diff)
downloadsubsurface-69d4ccae6db83173c2d87b2565852b530852c3cc.tar.gz
Added a new option to edit the dives.
Added a new option to edit the dive in the profile view. The option will only be visible if the dive was manually entered or if the dive is a plan. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
-rw-r--r--qt-ui/mainwindow.cpp2
-rw-r--r--qt-ui/profilegraphics.cpp16
-rw-r--r--qt-ui/profilegraphics.h2
-rw-r--r--subsurface.qrc1
4 files changed, 15 insertions, 6 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 1dcf03314..d797b0fe1 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -280,7 +280,7 @@ void MainWindow::on_actionAddDive_triggered()
// now cheat - create one dive that we use to store the info tab data in
struct dive *dive = alloc_dive();
dive->when = QDateTime::currentMSecsSinceEpoch() / 1000L;
- const char* model = strdup(tr("manulaly added dive").toLocal8Bit().constData());
+ const char* model = strdup(tr("manually added dive").toLocal8Bit().constData());
dive->dc.model = model; // do not use tr here since it expects a char*.
record_dive(dive);
select_dive(get_divenr(dive));
diff --git a/qt-ui/profilegraphics.cpp b/qt-ui/profilegraphics.cpp
index cba803de2..0eed723dd 100644
--- a/qt-ui/profilegraphics.cpp
+++ b/qt-ui/profilegraphics.cpp
@@ -342,7 +342,7 @@ void ProfileGraphicsView::plot(struct dive *d, bool forceRedraw)
}
if (!printMode)
- addControlItems();
+ addControlItems(d);
if (rulerEnabled && !printMode)
add_ruler();
@@ -378,20 +378,28 @@ void ProfileGraphicsView::plot_depth_scale()
depthMarkers->setPos(depthMarkers->pos().x() - 10, 0);
}
-void ProfileGraphicsView::addControlItems()
+void ProfileGraphicsView::addControlItems(struct dive *d)
{
QAction *scaleAction = new QAction(QIcon(":scale"), tr("Scale"), this);
QAction *rulerAction = new QAction(QIcon(":ruler"), tr("Ruler"), this);
QToolBar *toolBar = new QToolBar("", 0);
toolBar->addAction(rulerAction);
toolBar->addAction(scaleAction);
+ toolBar->setOrientation(Qt::Vertical);
//make toolbar transparent
- toolBar->setStyleSheet(QString::fromUtf8 ("background-color: rgba(255,255,255,0);"));
+ //toolBar->setStyleSheet(QString::fromUtf8 ("background-color: rgba(255,255,255,0);"));
connect(scaleAction, SIGNAL(triggered()), this, SLOT(on_scaleAction()));
connect(rulerAction, SIGNAL(triggered()), this, SLOT(on_rulerAction()));
- toolBarProxy = scene()->addWidget(toolBar);
//Put it into the lower right corner of the profile
+
+ QString defaultDC(d->dc.model);
+ if (defaultDC == tr("manually added dive") || defaultDC == tr("Simulated Dive")) {
+ QAction *editAction = new QAction(QIcon(":edit"), tr("Edit"), this);
+ toolBar->addAction(editAction);
+ connect(editAction, SIGNAL(triggered()), mainWindow(), SLOT(editCurrentDive()));
+ }
+ toolBarProxy = scene()->addWidget(toolBar);
toolBarProxy->setPos(gc.maxx-toolBar->width(), gc.maxy-toolBar->height());
}
diff --git a/qt-ui/profilegraphics.h b/qt-ui/profilegraphics.h
index 7fe4f9ff7..28e7b9d60 100644
--- a/qt-ui/profilegraphics.h
+++ b/qt-ui/profilegraphics.h
@@ -171,7 +171,7 @@ private:
void plot_depth_scale();
- void addControlItems();
+ void addControlItems(struct dive *d);
void create_ruler();
void add_ruler();
diff --git a/subsurface.qrc b/subsurface.qrc
index cda15944c..67efdc7a1 100644
--- a/subsurface.qrc
+++ b/subsurface.qrc
@@ -6,6 +6,7 @@
<file alias="trash">icons/trash.png</file>
<file alias="units">icons/units.png</file>
<file alias="advanced">icons/advanced.png</file>
+ <file alias="edit">icons/advanced.png</file>
<file alias="graph">icons/graph.png</file>
<file alias="minimum">icons/minimum.svg</file>
<file alias="maximum">icons/maximum.svg</file>