Use better aliases for icons.

Icon aliases were complete mess.
Some icons had alias some didn't.
Named with underscores vs. hyphens vs. camelCase.
Lower vs. upper case.
"ICON" prefix vs. suffix vs. nothing.
With vs. without filename suffix.
Some didn't make sence. Eg. mapwidget-marker-gray
(I can see, it's grey, but what does it represent?)
Some were duplicated, eg warning vs. warning-icon.
Some were name after widget, which is wrong.

Do not reinvent wheel. Use widely used naming scheme
close to Freedesktop Icon Naming Specification. This
will enable usage of common icons from current set in
the future. Thus Subsurface will fit nicely to GUI.

This changes icon aliases to one, easy grep-able style.

Signed-off-by: Martin Měřinský <mermar@centrum.cz>
This commit is contained in:
Martin Měřinský 2017-11-29 10:57:08 +01:00 committed by Dirk Hohndel
parent 0855f6f315
commit 8ef87e618a
26 changed files with 135 additions and 132 deletions

View file

@ -81,19 +81,19 @@ void DiveEventItem::setupPixmap()
#define EVENT_PIXMAP(PIX) QPixmap(QString(PIX)).scaled(sz_pix, sz_pix, Qt::KeepAspectRatio, Qt::SmoothTransformation)
#define EVENT_PIXMAP_BIGGER(PIX) QPixmap(QString(PIX)).scaled(sz_bigger, sz_bigger, Qt::KeepAspectRatio, Qt::SmoothTransformation)
if (same_string(internalEvent->name, "")) {
setPixmap(EVENT_PIXMAP(":warning-icon"));
setPixmap(EVENT_PIXMAP(":status-warning-icon"));
} else if (internalEvent->type == SAMPLE_EVENT_BOOKMARK) {
setPixmap(EVENT_PIXMAP(":flag"));
setPixmap(EVENT_PIXMAP(":dive-bookmark-icon"));
} else if (event_is_gaschange(internalEvent)) {
struct gasmix *mix = get_gasmix_from_event(&displayed_dive, internalEvent);
if (mix->he.permille)
setPixmap(EVENT_PIXMAP_BIGGER(":gaschangeTrimix"));
setPixmap(EVENT_PIXMAP_BIGGER(":gaschange-trimix-icon"));
else if (gasmix_is_air(mix))
setPixmap(EVENT_PIXMAP_BIGGER(":gaschangeAir"));
setPixmap(EVENT_PIXMAP_BIGGER(":gaschange-air-icon"));
else if (mix->o2.permille == 1000)
setPixmap(EVENT_PIXMAP_BIGGER(":gaschangeOxy"));
setPixmap(EVENT_PIXMAP_BIGGER(":gaschange-oxygen-icon"));
else
setPixmap(EVENT_PIXMAP_BIGGER(":gaschangeNitrox"));
setPixmap(EVENT_PIXMAP_BIGGER(":gaschange-ean-icon"));
#ifdef SAMPLE_FLAGS_SEVERITY_SHIFT
} else if ((((internalEvent->flags & SAMPLE_FLAGS_SEVERITY_MASK) >> SAMPLE_FLAGS_SEVERITY_SHIFT) == 1) ||
// those are useless internals of the dive computer
@ -114,11 +114,11 @@ void DiveEventItem::setupPixmap()
setPixmap(transparentPixmap);
#ifdef SAMPLE_FLAGS_SEVERITY_SHIFT
} else if (((internalEvent->flags & SAMPLE_FLAGS_SEVERITY_MASK) >> SAMPLE_FLAGS_SEVERITY_SHIFT) == 2) {
setPixmap(EVENT_PIXMAP(":info-icon"));
setPixmap(EVENT_PIXMAP(":status-info-icon"));
} else if (((internalEvent->flags & SAMPLE_FLAGS_SEVERITY_MASK) >> SAMPLE_FLAGS_SEVERITY_SHIFT) == 3) {
setPixmap(EVENT_PIXMAP(":warning-icon"));
setPixmap(EVENT_PIXMAP(":status-warning-icon"));
} else if (((internalEvent->flags & SAMPLE_FLAGS_SEVERITY_MASK) >> SAMPLE_FLAGS_SEVERITY_SHIFT) == 4) {
setPixmap(EVENT_PIXMAP(":violation-icon"));
setPixmap(EVENT_PIXMAP(":status-violation-icon"));
#endif
} else if (same_string_caseinsensitive(internalEvent->name, "violation") || // generic libdivecomputer
same_string_caseinsensitive(internalEvent->name, "Safety stop violation") || // the rest are from the Uemis downloader
@ -127,17 +127,17 @@ void DiveEventItem::setupPixmap()
same_string_caseinsensitive(internalEvent->name, "Dive time alert") ||
same_string_caseinsensitive(internalEvent->name, "Low battery alert") ||
same_string_caseinsensitive(internalEvent->name, "Speed alarm")) {
setPixmap(EVENT_PIXMAP(":violation-icon"));
setPixmap(EVENT_PIXMAP(":status-violation-icon"));
} else if (same_string_caseinsensitive(internalEvent->name, "non stop time") || // generic libdivecomputer
same_string_caseinsensitive(internalEvent->name, "safety stop") ||
same_string_caseinsensitive(internalEvent->name, "safety stop (voluntary)") ||
same_string_caseinsensitive(internalEvent->name, "Tank change suggested") || // Uemis downloader
same_string_caseinsensitive(internalEvent->name, "Marker")) {
setPixmap(EVENT_PIXMAP(":info-icon"));
setPixmap(EVENT_PIXMAP(":status-info-icon"));
} else {
// we should do some guessing based on the type / name of the event;
// for now they all get the warning icon
setPixmap(EVENT_PIXMAP(":warning-icon"));
setPixmap(EVENT_PIXMAP(":status-warning-icon"));
}
#undef EVENT_PIXMAP
#undef EVENT_PIXMAP_BIGGER

View file

@ -29,7 +29,7 @@ void DiveButtonItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
// paint on screen, but for now, this.
CloseButtonItem::CloseButtonItem(QObject *parent): DiveButtonItem(parent)
{
static QPixmap p = QPixmap(":trash");
static QPixmap p = QPixmap(":list-remove-icon");
setPixmap(p);
setFlag(ItemIgnoresTransformations);
}

View file

@ -86,7 +86,7 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : QGraphicsView(parent),
zoomLevel(0),
zoomFactor(1.15),
background(new DivePixmapItem()),
backgroundFile(":poster"),
backgroundFile(":poster-icon"),
#ifndef SUBSURFACE_MOBILE
toolTipItem(new ToolTipItem()),
#endif