From 22d56889bbed5616d40d4a1391750b94ec500b9e Mon Sep 17 00:00:00 2001 From: Sergey Starosek Date: Sat, 28 Jun 2014 12:14:36 +0400 Subject: [PATCH] Fallback to loading theme icons from resources Since not all platforms support theme icons, we need to pack them into resources and fallback to that resource theme. There seems to be a bug in Qt (https://bugreports.qt-project.org/browse/QTBUG-16697), thus default theme name (hicolor) does not work. So we test for 'window-close' theme icon on startup and if not found, set theme name to 'subsurface' Signed-off-by: Sergey Starosek Signed-off-by: Dirk Hohndel --- icons/subsurface/32x32/actions/go-down.png | Bin 0 -> 649 bytes icons/subsurface/32x32/actions/go-up.png | Bin 0 -> 622 bytes icons/subsurface/32x32/actions/window-close.png | Bin 0 -> 338 bytes icons/subsurface/index.theme | 7 +++++++ qt-ui/mainwindow.cpp | 3 +++ qt-ui/usermanual.ui | 4 ++-- subsurface.qrc | 6 +++++- 7 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 icons/subsurface/32x32/actions/go-down.png create mode 100644 icons/subsurface/32x32/actions/go-up.png create mode 100644 icons/subsurface/32x32/actions/window-close.png create mode 100644 icons/subsurface/index.theme diff --git a/icons/subsurface/32x32/actions/go-down.png b/icons/subsurface/32x32/actions/go-down.png new file mode 100644 index 0000000000000000000000000000000000000000..0d08df9cb4d1f8a6349d06f5b11f8dd43c1383db GIT binary patch literal 649 zcmV;40(Sk0P)m;wU>11n}`<`|$x79>rFfR0!OFKEh6J#dP5nM1lz#5oz5INyWBfQd~InAkum zT?R?b+i%~#O}c*l`g45IM$iEu&DPe|yuj3(1GGR9$*>Q=D4Go71A{mhNC_ZWejk{d zrW`$b^fRF}LzDwRh5)lD8_>{Xpd$>C4E+gZvm;r49_ZM)z^wL*kmVqGq8$J=j1ibP zLx2T~D>lRb{rk5YnAp|;;Q5tMb<}l6i~zR j(GVC7fzc2c6d?crXnN5huIUwU00000NkvXXu0mjfFvSpZ literal 0 HcmV?d00001 diff --git a/icons/subsurface/32x32/actions/go-up.png b/icons/subsurface/32x32/actions/go-up.png new file mode 100644 index 0000000000000000000000000000000000000000..397511707818d6c2d2abe690d9f16e8f1d6d6f04 GIT binary patch literal 622 zcmV-!0+IcRP)j&(|5ZWJ0ftl8Q}OIgW{TqqZEAt_0%&O!0B{a3Wb7)2x~N&)j%L{t^`66fX!y>f#@*N{u2GbwG)X% zj^#qg1z;dP1o2)WAwV1fVi#)#sUVU8%w{vI*Xt+Hb~{!4?Q2}c&oK-W%49O@@pwEd z1ws;l+wHDK(P@acP(`1$TCJD7=kxg)JZdP2Yrrn~e7+Yk2vGo&$<)Ac+$_Wml)zm! zoAt(Gu_rQTu~=$ZmYqRNBOinDBcQ#BMB@G@h#vv0R%@G1r<+7EjuJmlrBZ9jWHLh+ zHX4n3gTdfIYzGzln#<)@qS5GODTtB)Fk2T|Jc@#qRPsqE6xzo7M~Q+Ohr=;~wQdUH z9p>B$hr_2rIf4LoyL|v=>PG^lg$vn5c9xa=*g-fdJxH~rXW}aP&=S@pzIy^1VSg*Ax~{0!2kdN07*qo IM6N<$f=QPZQ~&?~ literal 0 HcmV?d00001 diff --git a/icons/subsurface/32x32/actions/window-close.png b/icons/subsurface/32x32/actions/window-close.png new file mode 100644 index 0000000000000000000000000000000000000000..2d02aaf3ea874d632bc20bf87ee44ebf372eec32 GIT binary patch literal 338 zcmV-Y0j>UtP)C%04voIV0axFVMdn-^OKM;dLU@EzefLfjnG=mL@KmPprvl=~Av4#Me zMzS11tQk1d0I>#Oiyl(+;?0Jn7zA?&sd@;O1Ed&8idvY12|56zkQjrBQG+eIh;jfS zN04hd$XucwfXfk3U%|2($vK832jFl7NEnpQNw%Ei5WtbrLBeENJ~SPGCBe}z3b3Vi zx+OwCdWWh^$gDHm{ea-(k2+3O|k)Pl){2@K%3>* k;*?fmBv;4OcF3p$0L*9tFc46<{Qv*}07*qoM6N<$g0=64=Kufz literal 0 HcmV?d00001 diff --git a/icons/subsurface/index.theme b/icons/subsurface/index.theme new file mode 100644 index 000000000..e7835db51 --- /dev/null +++ b/icons/subsurface/index.theme @@ -0,0 +1,7 @@ +[Icon Theme] +Name=Subsurface +Comment=Subsurface fallback theme +Directories=32x32/actions + +[32x32/actions] +Size=32 diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index ed0488986..146dced4b 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -70,6 +70,9 @@ MainWindow::MainWindow() : QMainWindow(), m_Instance = this; ui.setupUi(this); setWindowIcon(QIcon(":subsurface-icon")); + if (!QIcon::hasThemeIcon("window-close")) { + QIcon::setThemeName("subsurface"); + } connect(ui.ListWidget, SIGNAL(currentDiveChanged(int)), this, SLOT(current_dive_changed(int))); connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this, SLOT(readSettings())); connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), ui.ListWidget, SLOT(update())); diff --git a/qt-ui/usermanual.ui b/qt-ui/usermanual.ui index 506b5c2ca..e8f0095f5 100644 --- a/qt-ui/usermanual.ui +++ b/qt-ui/usermanual.ui @@ -74,7 +74,7 @@ - + @@ -98,7 +98,7 @@ - + diff --git a/subsurface.qrc b/subsurface.qrc index 47a8ce414..48dce73dd 100644 --- a/subsurface.qrc +++ b/subsurface.qrc @@ -53,6 +53,10 @@ icons/pc.png icons/ead.png icons/icon-HR.png - icons/calendarbg.png + icons/calendarbg.png + icons/subsurface/index.theme + icons/subsurface/32x32/actions/go-down.png + icons/subsurface/32x32/actions/go-up.png + icons/subsurface/32x32/actions/window-close.png