From 22d56889bbed5616d40d4a1391750b94ec500b9e Mon Sep 17 00:00:00 2001 From: Sergey Starosek Date: Sat, 28 Jun 2014 12:14:36 +0400 Subject: 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 --- qt-ui/mainwindow.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'qt-ui/mainwindow.cpp') 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())); -- cgit v1.2.3-70-g09d2