From c84f3d236625ad1be1cd79d42033c446d0c65f8d Mon Sep 17 00:00:00 2001 From: Javier Llorente Date: Fri, 7 Feb 2014 23:14:32 +0100 Subject: [PATCH] [Theme] Use theme icon for Exit Fullscreen button in toolbar --- bin/themes/chrome/main.css | 5 +++++ bin/themes/default/main.css | 5 +++++ bin/themes/linux/main.css | 5 +++++ bin/themes/mac/main.css | 5 +++++ bin/themes/windows/main.css | 5 +++++ src/lib/data/icons.qrc | 1 + src/lib/data/icons/theme/view-restore.png | Bin 0 -> 469 bytes src/lib/navigation/navigationbar.cpp | 5 ++++- src/lib/tools/iconprovider.cpp | 5 +++++ src/lib/tools/toolbutton.cpp | 3 ++- 10 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 src/lib/data/icons/theme/view-restore.png diff --git a/bin/themes/chrome/main.css b/bin/themes/chrome/main.css index 9562803b6..a36c59a0a 100644 --- a/bin/themes/chrome/main.css +++ b/bin/themes/chrome/main.css @@ -102,6 +102,11 @@ qproperty-multiIcon: url(images/navigation-supermenu.png); } +#navigation-button-exitfullscreen +{ + qproperty-themeIcon: "view-restore"; +} + /*TabWidget*/ #tabbar::scroller { diff --git a/bin/themes/default/main.css b/bin/themes/default/main.css index 5a048ae0b..c2a4a79e2 100644 --- a/bin/themes/default/main.css +++ b/bin/themes/default/main.css @@ -100,6 +100,11 @@ qproperty-icon: url(images/navigation-supmenu.png); } +#navigation-button-exitfullscreen +{ + qproperty-themeIcon: "view-restore"; +} + /*TabWidget*/ #tabbar::tab { diff --git a/bin/themes/linux/main.css b/bin/themes/linux/main.css index c20b8c58a..b4ada9a50 100644 --- a/bin/themes/linux/main.css +++ b/bin/themes/linux/main.css @@ -69,6 +69,11 @@ qproperty-fallbackIcon: url(images/preferences-desktop.png); } +#navigation-button-exitfullscreen +{ + qproperty-themeIcon: "view-restore"; +} + #navigation-button-supermenu::menu-indicator { image: none; diff --git a/bin/themes/mac/main.css b/bin/themes/mac/main.css index 83b34ae2c..6c09d075d 100644 --- a/bin/themes/mac/main.css +++ b/bin/themes/mac/main.css @@ -97,6 +97,11 @@ qproperty-multiIcon: url(images/navigation-supermenu.png); } +#navigation-button-exitfullscreen +{ + qproperty-themeIcon: "view-restore"; +} + /*TabWidget*/ #tabbar::scroller { diff --git a/bin/themes/windows/main.css b/bin/themes/windows/main.css index 0484827fd..4929de814 100644 --- a/bin/themes/windows/main.css +++ b/bin/themes/windows/main.css @@ -107,6 +107,11 @@ qproperty-iconSize: 23px 22px; } +#navigation-button-exitfullscreen +{ + qproperty-themeIcon: "view-restore"; +} + /*TabWidget*/ #tabbar::scroller { diff --git a/src/lib/data/icons.qrc b/src/lib/data/icons.qrc index 92f489868..7c3243a4b 100644 --- a/src/lib/data/icons.qrc +++ b/src/lib/data/icons.qrc @@ -80,5 +80,6 @@ icons/theme/expand.png icons/theme/collapse.png icons/theme/speeddial.png + icons/theme/view-restore.png diff --git a/src/lib/data/icons/theme/view-restore.png b/src/lib/data/icons/theme/view-restore.png new file mode 100644 index 0000000000000000000000000000000000000000..56b87cabdf5bc1bdf42a6f7fce654162548733b4 GIT binary patch literal 469 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyjKx9jP7LeL$-D$|I14-?i-C%- zgD|6$#_S59AbW|YuPgfv9$7vfK9QA@3xGnU0X`wFKpGkR`0+z#34_IYh2ULwp}QRl zk0sQd&RcqW)~dVn*WX{ZbLY;JCr_O@bMC^0OINO3yK&>z9T2#8|Nevf_a8od`1sMI zCy&0|fAZw%vu7_}zI^ri^_#bE-@SYH;mhyOKY#xG3k3iE{Qv*IHR|DWpsj2rL4Lsu zLWV}h-*$V)2LMGFlf2zs)S@_MYz1q;Pt(W!p>1?LxeVpbeyuR1X&ZvE6cL9=$9QSgaF9=bp0eRg$COyiJn z)x2-)e^JBNqQ_uL^dydoJTC99oi`>qcub!>q4>;XT~!Vnb5;dcq4f%WEq_w^(_bjR un7+h*a-7KCtY4d6yiQv!>h^zj{bxoG&$!;3Ia7^5;q2+^=d#Wzp$P!*xzIxZ literal 0 HcmV?d00001 diff --git a/src/lib/navigation/navigationbar.cpp b/src/lib/navigation/navigationbar.cpp index de9324d3c..93e29e519 100644 --- a/src/lib/navigation/navigationbar.cpp +++ b/src/lib/navigation/navigationbar.cpp @@ -149,10 +149,13 @@ NavigationBar::NavigationBar(QupZilla* mainClass) m_navigationSplitter->setCollapsible(0, false); m_exitFullscreen = new ToolButton(); - m_exitFullscreen->setText(tr("Exit Fullscreen")); + m_exitFullscreen->setObjectName("navigation-button-exitfullscreen"); m_exitFullscreen->setToolTip(tr("Exit Fullscreen")); + m_exitFullscreen->setToolButtonStyle(Qt::ToolButtonIconOnly); + m_exitFullscreen->setFocusPolicy(Qt::NoFocus); m_exitFullscreen->setAutoRaise(true); m_exitFullscreen->setVisible(false); + setButtonIconSize(m_exitFullscreen); m_layout->addLayout(backNextLayout); m_layout->addWidget(m_reloadStop); diff --git a/src/lib/tools/iconprovider.cpp b/src/lib/tools/iconprovider.cpp index 1bbeb5681..6f4f7f58a 100644 --- a/src/lib/tools/iconprovider.cpp +++ b/src/lib/tools/iconprovider.cpp @@ -196,6 +196,8 @@ QIcon IconProvider::standardIcon(QStyle::StandardPixmap icon) QIcon IconProvider::fromTheme(const QString &icon) { + // TODO: This should actually look in :icons/theme for fallback icon, not hardcode every icon + if (icon == QLatin1String("go-home")) { return QIcon::fromTheme("go-home", QIcon(":/icons/theme/home.png")); } @@ -217,6 +219,9 @@ QIcon IconProvider::fromTheme(const QString &icon) else if (icon == QLatin1String("go-previous")) { return QIcon::fromTheme("go-previous", QIcon(":icons/theme/go-previous.png")); } + else if (icon == QLatin1String("view-restore")) { + return QIcon::fromTheme("view-restore", QIcon(":icons/theme/view-restore.png")); + } else { return QIcon::fromTheme(icon); } diff --git a/src/lib/tools/toolbutton.cpp b/src/lib/tools/toolbutton.cpp index 0ce7bebd8..074f64eca 100644 --- a/src/lib/tools/toolbutton.cpp +++ b/src/lib/tools/toolbutton.cpp @@ -16,6 +16,7 @@ * along with this program. If not, see . * ============================================================ */ #include "toolbutton.h" +#include "iconprovider.h" #include #include @@ -35,7 +36,7 @@ ToolButton::ToolButton(QWidget* parent) void ToolButton::setThemeIcon(const QString &image) { m_themeIcon = image; - setIcon(QIcon::fromTheme(image)); + setIcon(qIconProvider->fromTheme(image)); m_usingMultiIcon = false; }