mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Added a toolbar to the profile
The toolbar adds two buttons to the profile. The user can now toggle the scaling (zoomed to dive/round up to 30 mins) and adding /removing ruler to/from the profile using this toolbar. Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
This commit is contained in:
parent
248f1b86d1
commit
88172571ca
5 changed files with 209 additions and 1 deletions
91
icons/ruler.svg
Normal file
91
icons/ruler.svg
Normal file
|
@ -0,0 +1,91 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="256"
|
||||
height="256"
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
inkscape:version="0.48.4 r9939"
|
||||
sodipodi:docname="Neues Dokument 1">
|
||||
<defs
|
||||
id="defs4" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="1.979899"
|
||||
inkscape:cx="82.200797"
|
||||
inkscape:cy="132.66914"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1060"
|
||||
inkscape:window-x="1917"
|
||||
inkscape:window-y="-3"
|
||||
inkscape:window-maximized="1" />
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Ebene 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(0,-796.36218)">
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:26;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||
d="m 25,855.87869 0,136.96699 206,0 0,-136.96699"
|
||||
id="path2985"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cccc" />
|
||||
<path
|
||||
sodipodi:type="arc"
|
||||
style="fill:#ff0000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
id="path3755"
|
||||
sodipodi:cx="109.60155"
|
||||
sodipodi:cy="121.64971"
|
||||
sodipodi:rx="24.748737"
|
||||
sodipodi:ry="24.748737"
|
||||
d="m 134.35028,121.64971 a 24.748737,24.748737 0 1 1 -49.49747,0 24.748737,24.748737 0 1 1 49.49747,0 z"
|
||||
transform="matrix(0.80812204,0,0,0.80812204,142.42857,894.53737)" />
|
||||
<path
|
||||
sodipodi:type="arc"
|
||||
style="fill:#ff0000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
id="path3755-9"
|
||||
sodipodi:cx="109.60155"
|
||||
sodipodi:cy="121.64971"
|
||||
sodipodi:rx="24.748737"
|
||||
sodipodi:ry="24.748737"
|
||||
d="m 134.35028,121.64971 a 24.748737,24.748737 0 1 1 -49.49747,0 24.748737,24.748737 0 1 1 49.49747,0 z"
|
||||
transform="matrix(0.80812204,0,0,0.80812204,-63.571426,894.53737)" />
|
||||
<g
|
||||
transform="scale(0.93424041,1.0703883)"
|
||||
style="font-size:167.5866394px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans"
|
||||
id="text3793">
|
||||
<path
|
||||
d="m 128.45853,792.84841 17.75698,0 41.733,103.7597 0,11.53795 -101.877616,0 0.08183,-11.53795 42.305806,-103.7597 m 43.1241,102.53226 -27.65834,-70.53696 c -1.63665,-4.03683 -3.16413,-8.2374 -4.58245,-12.60173 -1.36388,-4.41868 -2.10034,-6.95539 -2.20939,-7.61013 l -0.73647,2.61854 c -1.69119,6.05547 -3.70965,11.97446 -6.05537,17.75698 l -27.74017,70.3733 68.98219,0"
|
||||
style=""
|
||||
id="path3817" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 3.5 KiB |
71
icons/scale.svg
Normal file
71
icons/scale.svg
Normal file
|
@ -0,0 +1,71 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="256"
|
||||
height="256"
|
||||
id="svg3838"
|
||||
version="1.1"
|
||||
inkscape:version="0.48.4 r9939"
|
||||
sodipodi:docname="Neues Dokument 7">
|
||||
<defs
|
||||
id="defs3840" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="0.98994949"
|
||||
inkscape:cx="33.080739"
|
||||
inkscape:cy="132.08746"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1060"
|
||||
inkscape:window-x="1917"
|
||||
inkscape:window-y="-3"
|
||||
inkscape:window-maximized="1" />
|
||||
<metadata
|
||||
id="metadata3843">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Ebene 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(0,-796.36218)">
|
||||
<path
|
||||
style="fill:#009aff;fill-opacity:1;stroke:#bebebe;stroke-width:6.52823304999999987;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||
d="m 3.8355452,827.43445 c 18.0403128,23.04384 34.6170948,48.35081 45.4644808,77.56 14.699861,49.43778 21.075276,130.56465 70.722524,130.56465 35.82631,0 76.39924,-153.38199 131.14189,-208.12465"
|
||||
id="path3848"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cccc" />
|
||||
<g
|
||||
style="font-size:233.09231567px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#333333;fill-opacity:1;stroke:none;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans"
|
||||
id="text4358"
|
||||
transform="matrix(1.2570811,0,0,1.2570811,-32.90638,-237.63608)">
|
||||
<path
|
||||
d="m 195.09371,960.32762 c -1.4e-4,14.79593 -5.80468,26.25325 -17.41364,34.37201 -11.53332,8.11877 -27.8088,12.17817 -48.82646,12.17817 -39.07639,0 -61.725474,-13.58187 -67.947322,-40.74564 l 21.055702,-4.21114 c 2.428011,9.63634 7.587601,16.73078 15.478787,21.28334 7.891093,4.47672 18.627593,6.71507 32.209533,6.71506 14.03704,1e-5 24.84942,-2.39009 32.43716,-7.17032 7.6634,-4.85607 11.49516,-11.9505 11.49528,-21.28333 -1.2e-4,-5.23543 -1.21415,-9.4845 -3.64207,-12.74724 -2.35228,-3.26263 -5.69084,-5.95624 -10.01568,-8.08084 -4.32506,-2.12447 -9.48465,-3.90756 -15.47879,-5.34928 -5.99432,-1.44159 -12.6335,-2.99705 -19.91756,-4.6664 -12.67142,-2.80735 -22.30771,-5.61478 -28.908907,-8.42228 -6.52541,-2.80735 -11.685,-5.91828 -15.478787,-9.3328 -3.793846,-3.49022 -6.715084,-7.5496 -8.763724,-12.17816 -1.972806,-4.62836 -2.959198,-9.9397 -2.95918,-15.93405 -1.8e-5,-13.7335 5.235449,-24.31824 15.706416,-31.75428 10.546776,-7.43572 25.608222,-11.15366 45.184402,-11.15383 18.21024,1.7e-4 32.13354,2.80759 41.76996,8.42228 9.63617,5.53913 16.38916,15.02367 20.259,28.45366 l -21.39715,3.75588 c -2.35228,-8.49803 -6.82899,-14.64401 -13.43012,-18.43797 -6.60135,-3.86955 -15.74445,-5.8044 -27.42932,-5.80454 -12.82318,1.4e-4 -22.61123,2.12468 -29.364171,6.37361 -6.753043,4.24922 -10.129539,10.58489 -10.1295,19.00704 -3.9e-5,4.93209 1.289858,9.02941 3.869697,12.29198 2.655628,3.18692 6.449444,5.91846 11.381464,8.19465 4.9319,2.20052 14.75789,4.93207 29.47798,8.19465 4.93188,1.13824 9.8259,2.31433 14.68208,3.52826 4.93187,1.13823 9.6362,2.54194 14.11302,4.21114 4.47659,1.59349 8.64978,3.49039 12.5196,5.69073 3.94545,2.20049 7.35988,4.8941 10.24332,8.08084 2.88316,3.18687 5.12151,6.94275 6.71506,11.26764 1.66914,4.32501 2.50378,9.40873 2.50392,15.25116"
|
||||
id="path4382"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 4.3 KiB |
|
@ -15,6 +15,7 @@
|
|||
#include <QPropertyAnimation>
|
||||
#include <QGraphicsSceneHoverEvent>
|
||||
#include <QMouseEvent>
|
||||
#include <QToolBar>
|
||||
#include <qtextdocument.h>
|
||||
#include <limits>
|
||||
|
||||
|
@ -44,7 +45,7 @@ extern struct ev_select *ev_namelist;
|
|||
extern int evn_allocated;
|
||||
extern int evn_used;
|
||||
|
||||
ProfileGraphicsView::ProfileGraphicsView(QWidget* parent) : QGraphicsView(parent), toolTip(0) , dive(0), diveDC(0), rulerItem(0)
|
||||
ProfileGraphicsView::ProfileGraphicsView(QWidget* parent) : QGraphicsView(parent), toolTip(0) , dive(0), diveDC(0), rulerItem(0), toolBarProxy(0)
|
||||
{
|
||||
printMode = false;
|
||||
isGrayscale = false;
|
||||
|
@ -182,6 +183,11 @@ void ProfileGraphicsView::clear()
|
|||
toolTip->deleteLater();
|
||||
toolTip = 0;
|
||||
}
|
||||
if(toolBarProxy) {
|
||||
scene()->removeItem(toolBarProxy);
|
||||
toolBarProxy->deleteLater();
|
||||
toolBarProxy = 0;
|
||||
}
|
||||
if(rulerItem) {
|
||||
remove_ruler();
|
||||
rulerItem->destNode()->deleteLater();
|
||||
|
@ -349,6 +355,9 @@ void ProfileGraphicsView::plot(struct dive *d, bool forceRedraw)
|
|||
scene()->addItem(timeEditor);
|
||||
}
|
||||
|
||||
if (!printMode)
|
||||
addControlItems();
|
||||
|
||||
if (rulerEnabled && !printMode)
|
||||
add_ruler();
|
||||
}
|
||||
|
@ -383,6 +392,23 @@ void ProfileGraphicsView::plot_depth_scale()
|
|||
depthMarkers->setPos(depthMarkers->pos().x() - 10, 0);
|
||||
}
|
||||
|
||||
void ProfileGraphicsView::addControlItems()
|
||||
{
|
||||
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);
|
||||
//make toolbar transparent
|
||||
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
|
||||
toolBarProxy->setPos(gc.maxx-toolBar->width(), gc.maxy-toolBar->height());
|
||||
}
|
||||
|
||||
void ProfileGraphicsView::plot_pp_text()
|
||||
{
|
||||
double pp, dpp, m;
|
||||
|
@ -1241,6 +1267,18 @@ void ProfileGraphicsView::edit_dive_time(const QString& time)
|
|||
refresh();
|
||||
}
|
||||
|
||||
void ProfileGraphicsView::on_rulerAction()
|
||||
{
|
||||
rulerEnabled = !rulerEnabled;
|
||||
refresh();
|
||||
}
|
||||
|
||||
void ProfileGraphicsView::on_scaleAction()
|
||||
{
|
||||
zoomed_plot = !zoomed_plot;
|
||||
refresh();
|
||||
}
|
||||
|
||||
void ToolTipItem::addToolTip(const QString& toolTip, const QIcon& icon)
|
||||
{
|
||||
QGraphicsPixmapItem *iconItem = 0;
|
||||
|
|
|
@ -149,6 +149,8 @@ protected:
|
|||
public slots:
|
||||
void refresh();
|
||||
void edit_dive_time(const QString& time);
|
||||
void on_rulerAction();
|
||||
void on_scaleAction();
|
||||
|
||||
private:
|
||||
void plot_depth_profile();
|
||||
|
@ -171,6 +173,9 @@ private:
|
|||
void plot_pp_text();
|
||||
void plot_depth_scale();
|
||||
|
||||
|
||||
void addControlItems();
|
||||
|
||||
void create_ruler();
|
||||
void add_ruler();
|
||||
void remove_ruler();
|
||||
|
@ -197,6 +202,7 @@ private:
|
|||
QGraphicsItem* depthMarkers;
|
||||
QGraphicsItem* diveComputer;
|
||||
RulerItem *rulerItem;
|
||||
QGraphicsProxyWidget *toolBarProxy;
|
||||
|
||||
// For 'Plan' mode.:
|
||||
GraphicsTextEditor *depthEditor;
|
||||
|
|
|
@ -12,5 +12,7 @@
|
|||
<file alias="average">icons/average.svg</file>
|
||||
<file alias="warning">icons/warning.png</file>
|
||||
<file alias="table-css">qt-ui/css/tableviews.css</file>
|
||||
<file alias="scale">icons/scale.svg</file>
|
||||
<file alias="ruler">icons/ruler.svg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
Loading…
Add table
Reference in a new issue