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 <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Sergey Starosek 2014-06-28 12:14:36 +04:00 committed by Dirk Hohndel
parent c84b40664d
commit 22d56889bb
7 changed files with 17 additions and 3 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 649 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 622 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 B

View file

@ -0,0 +1,7 @@
[Icon Theme]
Name=Subsurface
Comment=Subsurface fallback theme
Directories=32x32/actions
[32x32/actions]
Size=32

View file

@ -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()));

View file

@ -74,7 +74,7 @@
<string/>
</property>
<property name="icon">
<iconset theme="go-previous">
<iconset theme="go-up">
<normaloff/>
</iconset>
</property>
@ -98,7 +98,7 @@
<string/>
</property>
<property name="icon">
<iconset theme="go-next">
<iconset theme="go-down">
<normaloff/>
</iconset>
</property>

View file

@ -53,6 +53,10 @@
<file alias="icon_ceiling_dc">icons/pc.png</file>
<file alias="icon_ead">icons/ead.png</file>
<file alias="icon_HR">icons/icon-HR.png</file>
<file alias="calendar">icons/calendarbg.png</file>
<file alias="calendar">icons/calendarbg.png</file>
<file>icons/subsurface/index.theme</file>
<file>icons/subsurface/32x32/actions/go-down.png</file>
<file>icons/subsurface/32x32/actions/go-up.png</file>
<file>icons/subsurface/32x32/actions/window-close.png</file>
</qresource>
</RCC>