mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Different Icon for a Bookmark Event.
This patch adds a different icon for a Bookmark Event, and it also cleaned a lot of code. :) See #300 [Dirk Hohndel: made the two icons slightly bigger] Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
d3a56c137b
commit
441838def0
4 changed files with 9 additions and 32 deletions
|
@ -9,6 +9,7 @@
|
||||||
<temperature air='25.2 C' water='24.8 C' />
|
<temperature air='25.2 C' water='24.8 C' />
|
||||||
<surface pressure='1.024 bar' />
|
<surface pressure='1.024 bar' />
|
||||||
<event time='0:10 min' name='Tank Pressure Info' />
|
<event time='0:10 min' name='Tank Pressure Info' />
|
||||||
|
<event time='0:40 min' name='bookmark' />
|
||||||
<sample time='0:05 min' depth='1.77 m' temp='25.2 C' pressure='79.65 bar' ndl='99:00 min' />
|
<sample time='0:05 min' depth='1.77 m' temp='25.2 C' pressure='79.65 bar' ndl='99:00 min' />
|
||||||
<sample time='0:10 min' depth='1.67 m' pressure='79.53 bar' />
|
<sample time='0:10 min' depth='1.67 m' pressure='79.53 bar' />
|
||||||
<sample time='0:16 min' depth='1.84 m' pressure='79.27 bar' />
|
<sample time='0:16 min' depth='1.84 m' pressure='79.27 bar' />
|
||||||
|
|
|
@ -1626,37 +1626,13 @@ QColor EventItem::getColor(const color_indice_t i)
|
||||||
return profile_color[i].at((isGrayscale) ? 1 : 0);
|
return profile_color[i].at((isGrayscale) ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
EventItem::EventItem(struct event *ev, QGraphicsItem* parent, bool grayscale): QGraphicsPolygonItem(parent), ev(ev), isGrayscale(grayscale)
|
EventItem::EventItem(struct event *ev, QGraphicsItem* parent, bool grayscale): QGraphicsPixmapItem(parent), ev(ev), isGrayscale(grayscale)
|
||||||
{
|
{
|
||||||
setFlag(ItemIgnoresTransformations);
|
if(ev->name && strcmp(ev->name, "bookmark") == 0) {
|
||||||
setFlag(ItemIsFocusable);
|
setPixmap( QPixmap(QString(":flag")).scaled(20, 20, Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
||||||
setAcceptHoverEvents(true);
|
} else {
|
||||||
|
setPixmap( QPixmap(QString(":warning")).scaled(20, 20, Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
||||||
QPolygonF poly;
|
}
|
||||||
poly.push_back(QPointF(-8, 16));
|
|
||||||
poly.push_back(QPointF(8, 16));
|
|
||||||
poly.push_back(QPointF(0, 0));
|
|
||||||
poly.push_back(QPointF(-8, 16));
|
|
||||||
|
|
||||||
QPen defaultPen ;
|
|
||||||
defaultPen.setJoinStyle(Qt::RoundJoin);
|
|
||||||
defaultPen.setCapStyle(Qt::RoundCap);
|
|
||||||
defaultPen.setWidth(2);
|
|
||||||
defaultPen.setCosmetic(true);
|
|
||||||
|
|
||||||
QPen pen = defaultPen;
|
|
||||||
pen.setBrush(QBrush(getColor(ALERT_BG)));
|
|
||||||
|
|
||||||
setPolygon(poly);
|
|
||||||
setBrush(QBrush(getColor(ALERT_BG)));
|
|
||||||
setPen(pen);
|
|
||||||
|
|
||||||
QGraphicsLineItem *line = new QGraphicsLineItem(0, 5, 0, 10, this);
|
|
||||||
line->setPen(QPen(getColor(ALERT_FG), 2));
|
|
||||||
|
|
||||||
QGraphicsEllipseItem *ball = new QGraphicsEllipseItem(-1, 12, 2, 2, this);
|
|
||||||
ball->setBrush(QBrush(getColor(ALERT_FG)));
|
|
||||||
ball->setPen(QPen(getColor(ALERT_FG)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RulerNodeItem::RulerNodeItem(QGraphicsItem *parent, graphics_context context) : QGraphicsEllipseItem(parent), gc(context), entry(NULL) , ruler(NULL)
|
RulerNodeItem::RulerNodeItem(QGraphicsItem *parent, graphics_context context) : QGraphicsEllipseItem(parent), gc(context), entry(NULL) , ruler(NULL)
|
||||||
|
|
|
@ -97,7 +97,7 @@ private:
|
||||||
int paint_direction;
|
int paint_direction;
|
||||||
};
|
};
|
||||||
|
|
||||||
class EventItem : public QGraphicsPolygonItem
|
class EventItem : public QGraphicsPixmapItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit EventItem(struct event *ev, QGraphicsItem* parent = 0, bool grayscale = FALSE);
|
explicit EventItem(struct event *ev, QGraphicsItem* parent = 0, bool grayscale = FALSE);
|
||||||
|
@ -106,7 +106,6 @@ public:
|
||||||
private:
|
private:
|
||||||
ToolTipItem *controller;
|
ToolTipItem *controller;
|
||||||
QString text;
|
QString text;
|
||||||
QIcon icon;
|
|
||||||
bool isGrayscale;
|
bool isGrayscale;
|
||||||
|
|
||||||
QColor getColor(const color_indice_t i);
|
QColor getColor(const color_indice_t i);
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
<file alias="scale">icons/scale.png</file>
|
<file alias="scale">icons/scale.png</file>
|
||||||
<!-- <file alias="ruler">icons/ruler.svg</file> -->
|
<!-- <file alias="ruler">icons/ruler.svg</file> -->
|
||||||
<file alias="ruler">icons/ruler.png</file>
|
<file alias="ruler">icons/ruler.png</file>
|
||||||
|
<file alias="flag">icons/flag.png</file>
|
||||||
<file alias="arrow_up">icons/planner/arrow_up.png</file>
|
<file alias="arrow_up">icons/planner/arrow_up.png</file>
|
||||||
<file alias="arrow_down">icons/planner/arrow_down.png</file>
|
<file alias="arrow_down">icons/planner/arrow_down.png</file>
|
||||||
<file alias="icon_time">icons/planner/icon_time.png</file>
|
<file alias="icon_time">icons/planner/icon_time.png</file>
|
||||||
|
|
Loading…
Reference in a new issue