mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 20:33:24 +00:00
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>
This commit is contained in:
parent
a7b19b251d
commit
69d4ccae6d
4 changed files with 15 additions and 6 deletions
|
@ -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));
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
|
@ -171,7 +171,7 @@ private:
|
|||
void plot_depth_scale();
|
||||
|
||||
|
||||
void addControlItems();
|
||||
void addControlItems(struct dive *d);
|
||||
|
||||
void create_ruler();
|
||||
void add_ruler();
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Add table
Reference in a new issue