From: Uwe Hermann Date: Sun, 30 Apr 2017 20:44:33 +0000 (+0200) Subject: Improve icon/theme handling. X-Git-Tag: pulseview-0.4.0~88 X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=commitdiff_plain;h=4d8130bb039a3e2096d6c0f8650e027340722ead;hp=3432032fbc693b58a0c65427c025b9553c419237 Improve icon/theme handling. Only use QIcon::fromTheme() for icons which are included in the freedesktop.org icon naming specification: https://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html For all others there will be no icon to use from the theme and we always want our own icons to be used unconditionally in those cases anyway. --- diff --git a/HACKING b/HACKING index 17183ed1..d539681c 100644 --- a/HACKING +++ b/HACKING @@ -67,6 +67,9 @@ Random notes and the final @return line. The @param lines themselves (if there is more than one) are not separated by empty lines. + - Use QIcon::fromTheme() for icons that are included in the freedesktop.org + icon naming specification. Do NOT use it for all other icons. + Release engineering ------------------- diff --git a/pv/toolbars/mainbar.cpp b/pv/toolbars/mainbar.cpp index e1a666b1..a3b722cc 100644 --- a/pv/toolbars/mainbar.cpp +++ b/pv/toolbars/mainbar.cpp @@ -199,8 +199,7 @@ MainBar::MainBar(Session &session, QWidget *parent, connect(menu_decoders_add_, SIGNAL(decoder_selected(srd_decoder*)), this, SLOT(add_decoder(srd_decoder*))); - add_decoder_button_->setIcon(QIcon::fromTheme("add-decoder", - QIcon(":/icons/add-decoder.svg"))); + add_decoder_button_->setIcon(QIcon(":/icons/add-decoder.svg")); add_decoder_button_->setPopupMode(QToolButton::InstantPopup); add_decoder_button_->setMenu(menu_decoders_add_); add_decoder_button_->setToolTip(tr("Add low-level, non-stacked protocol decoder")); @@ -220,8 +219,7 @@ MainBar::MainBar(Session &session, QWidget *parent, QIcon(":/icons/preferences-system.png"))); channels_button_.setToolTip(tr("Configure Channels")); - channels_button_.setIcon(QIcon::fromTheme("channels", - QIcon(":/icons/channels.svg"))); + channels_button_.setIcon(QIcon(":/icons/channels.svg")); add_toolbar_widgets(); diff --git a/pv/views/trace/standardbar.cpp b/pv/views/trace/standardbar.cpp index 1a77edaa..6d8f97e6 100644 --- a/pv/views/trace/standardbar.cpp +++ b/pv/views/trace/standardbar.cpp @@ -78,8 +78,7 @@ StandardBar::StandardBar(Session &session, QWidget *parent, this, SLOT(on_actionViewZoomOneToOne_triggered())); action_view_show_cursors_->setCheckable(true); - action_view_show_cursors_->setIcon(QIcon::fromTheme("show-cursors", - QIcon(":/icons/show-cursors.svg"))); + action_view_show_cursors_->setIcon(QIcon(":/icons/show-cursors.svg")); action_view_show_cursors_->setShortcut(QKeySequence(Qt::Key_C)); connect(action_view_show_cursors_, SIGNAL(triggered(bool)), this, SLOT(on_actionViewShowCursors_triggered()));