diff options
author | Mateusz Łukasik <mati75@linuxmint.pl> | 2015-04-25 16:17:41 +0200 |
---|---|---|
committer | Mateusz Łukasik <mati75@linuxmint.pl> | 2015-04-25 16:17:41 +0200 |
commit | 45ee5ac6dc2159352596ce8e8ec744e0c864d492 (patch) | |
tree | 55ca90fd4a0d5c0eae188c5919510b6b0d2e3c5d /src/images.cpp | |
parent | a35c74c509f107094fd81cee8df109b652063969 (diff) |
Imported Upstream version 14.9.0.6690~ds0
Diffstat (limited to 'src/images.cpp')
-rw-r--r-- | src/images.cpp | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/src/images.cpp b/src/images.cpp index f4c7e26..572f760 100644 --- a/src/images.cpp +++ b/src/images.cpp @@ -1,5 +1,5 @@ /* smplayer, GUI front-end for mplayer. - Copyright (C) 2006-2014 Ricardo Villalba <rvm@users.sourceforge.net> + Copyright (C) 2006-2015 Ricardo Villalba <rvm@users.sourceforge.net> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -36,6 +36,7 @@ QString Images::themes_path; #ifdef USE_RESOURCES QString Images::last_resource_loaded; +bool Images::has_rcc = false; QString Images::resourceFilename() { QString filename = QString::null; @@ -70,11 +71,15 @@ void Images::setTheme(const QString & name) { } QString rs_file = resourceFilename(); - if (QFile::exists(rs_file)) { + if ((!rs_file.isEmpty()) && (QFile::exists(rs_file))) { qDebug() << "Images::setTheme: loading" << rs_file; QResource::registerResource(rs_file); last_resource_loaded = rs_file; + has_rcc = true; + } else { + has_rcc = false; } + qDebug() << "Images::setTheme: has_rcc:" << has_rcc; #endif } @@ -90,12 +95,21 @@ QString Images::file(const QString & name) { } #endif -#ifdef USE_RESOURCES - QString icon_name = ":/" + current_theme + "/"+ name + ".png"; -#else - QString icon_name = themes_path +"/"+ current_theme + "/"+ name + ".png"; -#endif - if (!QFile::exists(icon_name)) { + QString icon_name; + if (!current_theme.isEmpty()) { + #ifdef USE_RESOURCES + if (has_rcc) { + icon_name = ":/" + current_theme + "/"+ name + ".png"; + } else { + icon_name = themes_path +"/"+ current_theme + "/"+ name + ".png"; + } + #else + icon_name = themes_path +"/"+ current_theme + "/"+ name + ".png"; + #endif + } + + //qDebug() << "Images::file:" << icon_name; + if ((icon_name.isEmpty()) || (!QFile::exists(icon_name))) { icon_name = ":/icons-png/" + name + ".png"; } |