Use own icons for non-KDE desktops, if not using oxygen, gnome, or humanity icons.

This commit is contained in:
Craig Drummond
2016-01-07 22:04:29 +00:00
committed by Craig Drummond
parent f53357ce85
commit 3b3a6efa77
29 changed files with 32 additions and 62 deletions

View File

@@ -89,6 +89,8 @@
66. Use flat XML to store device music listing cache.
67. Add Composer and Performer to play queue sorts.
68. Always enable save to playlist actions, even if view is hidden.
69. Use own icons for non-KDE desktops, if not using oxygen, gnome, or humanity
icons.
1.5.2
-----

6
README
View File

@@ -378,11 +378,6 @@ Under Linux, the Cantata config file will be:
The following config items should be added to the "[General]" section.
iconTheme=<Icon theme name>
For Qt-only Linux builds, this allows you to force cantata to use the
configured icon theme. This config is empty by default, and Cantata uses
the system configured icon theme.
maxCoverUpdatePerIteration=<Integer>
Non cached covers, and cached covers in albums view, are not located and
loaded in the UI thread - as this causes lag when scrolling. A separate
@@ -483,7 +478,6 @@ seekStep=<Integer>
e.g.
[General]
iconTheme=oxygen
maxCoverUpdatePerIteration=10
coverCacheSize=10
cueFileCodecs=GBK, big5-0

View File

@@ -30,37 +30,24 @@
#include <QDir>
#include <QIcon>
static void setupIconTheme()
static void setupIconTheme(Application *app)
{
QString cfgTheme=Settings::self()->iconTheme();
if (cfgTheme.isEmpty() && GtkStyle::isActive()) {
cfgTheme=GtkStyle::iconTheme();
}
if (!cfgTheme.isEmpty()) {
QIcon::setThemeName(cfgTheme);
QString gtkIconTheme=GtkStyle::isActive() ? GtkStyle::iconTheme() : QString();
if (gtkIconTheme.isEmpty()) {
QIcon::setThemeName(gtkIconTheme);
}
// BUG:130 Some non-DE environments (IceWM, etc) seem to set theme to HiColor, and this has missing
// icons. So check for a themed icon, if the current theme does not have this - then see if oxygen
// or gnome icon themes are installed, and set theme to one of those.
if (!QIcon::hasThemeIcon("document-save-as")) {
QStringList themes=QStringList() << QLatin1String("oxygen") << QLatin1String("gnome");
QStringList prefixes=QStringList() << QLatin1String("/usr") << QLatin1String("/usr/local");
if (!prefixes.contains(QLatin1String(INSTALL_PREFIX))) {
prefixes+=QLatin1String(INSTALL_PREFIX);
}
foreach (const QString &theme, themes) {
foreach (const QString &prefix, prefixes) {
QString dir(prefix+QLatin1String("/share/icons/")+theme);
if (QDir(dir).exists()) {
QIcon::setThemeName(theme);
// Add to theme search paths, if it is not there already...
if (!QIcon::themeSearchPaths().contains(prefix+QLatin1String("/share/icons"))) {
QIcon::setThemeSearchPaths(QIcon::themeSearchPaths() << QString(prefix+QLatin1String("/share/icons")));
}
return;
}
}
if (Utils::KDE!=Utils::currentDe() || QLatin1String("breeze")==QIcon::themeName()) {
QSet<QString> okThemes=QSet<QString>() << QLatin1String("oxygen")
<< QLatin1String("gnome")
<< QLatin1String("humanity")
<< QLatin1String("ubuntu-mono-dark")
<< QLatin1String("ubuntu-mono-light");
if (!okThemes.contains(QIcon::themeName().toLower())) {
QIcon::setThemeSearchPaths(QStringList() << CANTATA_SYS_ICONS_DIR << QIcon::themeSearchPaths());
QIcon::setThemeName(QLatin1String("cantata"));
app->setAttribute(Qt::AA_DontShowIconsInMenus, true);
}
}
}
@@ -78,7 +65,7 @@ Application::Application(int &argc, char **argv)
bool Application::start()
{
if (QDBusConnection::sessionBus().registerService(CANTATA_REV_URL)) {
setupIconTheme();
setupIconTheme(this);
return true;
}
loadFiles();

View File

@@ -84,7 +84,7 @@ PreferencesDialog::PreferencesDialog(QWidget *parent)
#if defined CDDB_FOUND || defined MUSICBRAINZ5_FOUND
audiocd = new AudioCdSettings(0);
audiocd->load();
addPage(QLatin1String("cd"), audiocd, i18n("Audio CD"), Icon("media-optical"), i18n("Audio CD Settings"));
addPage(QLatin1String("cd"), audiocd, i18n("Audio CD"), Icons::self()->albumIcon(32), i18n("Audio CD Settings"));
#endif
#ifdef ENABLE_PROXY_CONFIG
proxy = new ProxySettings(0);

View File

@@ -205,13 +205,6 @@ QList<MPDConnectionDetails> Settings::allConnections()
return connections;
}
#ifndef ENABLE_KDE_SUPPORT
QString Settings::iconTheme()
{
return cfg.get("iconTheme", QString());
}
#endif
bool Settings::showPlaylist()
{
return cfg.get("showPlaylist", true);

View File

@@ -263,9 +263,6 @@ public:
void saveMpris(bool v);
void save();
void clearVersion();
#ifndef ENABLE_KDE_SUPPORT
QString iconTheme();
#endif
bool firstRun() const { return AP_Configured!=state; }

View File

@@ -55,6 +55,8 @@ if (NOT WIN32 AND NOT APPLE)
endif (NOT WIN32 AND NOT APPLE)
add_subdirectory(theme)
#if (APPLE)
# install(FILES trayicon-mono-dark.svg DESTINATION ${CANTATA_ICON_INSTALL_PREFIX}/scalable/apps RENAME cantata-panel.svg)
#endif (APPLE)

View File

@@ -10,21 +10,20 @@ svg/playlist.svg
svg/preferences-desktop-keyboard.svg
svg/preferences-other.svg
svg/speaker.svg
16/media-optical.png
22/media-optical.png
32/media-optical.png
48/media-optical.png
64/media-optical.png
128/media-optical.png
256/media-optical.png
svg64/dialog-error.svg
svg64/dialog-information.svg
svg64/dialog-question.svg
svg64/dialog-warning.svg
)
if (WIN32 OR APPLE)
set(CANTATA_ICON_THEME_PATH ${CANTATA_ICON_INSTALL_PREFIX})
else (WIN32 OR APPLE)
set(CANTATA_ICON_THEME_PATH ${SHARE_INSTALL_PREFIX}/${CMAKE_PROJECT_NAME}/icons/cantata)
endif (WIN32 OR APPLE)
foreach(ICON ${ICON_FILES})
get_filename_component(ICON_PATH ${ICON} PATH)
install(FILES ${ICON} DESTINATION ${CANTATA_ICON_INSTALL_PREFIX}/${ICON_PATH})
install(FILES ${ICON} DESTINATION ${CANTATA_ICON_THEME_PATH}/${ICON_PATH})
endforeach(ICON ${ICON_FILES})
install(FILES AUTHORS index.theme LICENSE DESTINATION ${CANTATA_ICON_INSTALL_PREFIX})
install(FILES AUTHORS index.theme LICENSE DESTINATION ${CANTATA_ICON_THEME_PATH})

View File

@@ -1,7 +1,7 @@
[Icon Theme]
Name=Cantata
Comment=Icons taken from Papirus theme.
Inherits=breeze,oxygen,hicolor
Directories=svg,svg64,6,22,32,48,64,128,256
[svg]

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 957 B

After

Width:  |  Height:  |  Size: 957 B

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -8,5 +8,3 @@ foreach(qm ${qt_trans})
endif (NOT ${qm} MATCHES "(${QT_TRANSLATIONS_DIR}/qt_help*)")
endforeach(qm ${qt_trans})
install(FILES ${qt_translations} DESTINATION ${MACOSX_BUNDLE_RESOURCES}/translations/)
add_subdirectory(${CMAKE_SOURCE_DIR}/windows/icons ${CMAKE_CURRENT_BINARY_DIR}/icons)

View File

@@ -398,7 +398,7 @@ Icons::Icons()
QString iconTheme=Icon::currentTheme().toLower();
#ifndef ALWAYS_USE_MONO_ICONS
bool useAwesomeIcons=GtkStyle::isActive() || QLatin1String("breeze")==iconTheme;
bool useAwesomeIcons=GtkStyle::isActive() || QLatin1String("cantata")==iconTheme || QLatin1String("breeze")==iconTheme;
#endif
QString iconFile=QString(CANTATA_SYS_ICONS_DIR+"stream.png");
@@ -546,7 +546,7 @@ void Icons::initToolbarIcons(const QColor &toolbarText)
QColor stdColor=calcIconColor();
#if !defined ENABLE_UBUNTU
#ifndef ALWAYS_USE_MONO_ICONS
if (GtkStyle::useSymbolicIcons() || QLatin1String("breeze")==iconTheme) {
if (GtkStyle::useSymbolicIcons() || QLatin1String("cantata")==iconTheme || QLatin1String("breeze")==iconTheme) {
#endif
bool rtl=QApplication::isRightToLeft();
#if defined Q_OS_MAC

View File

@@ -50,5 +50,3 @@ install(FILES ${qt_translations} DESTINATION ${CMAKE_INSTALL_PREFIX}/translation
install(FILES ${EXTRA_WIN_LIBS} DESTINATION ${CMAKE_INSTALL_PREFIX})
install(FILES LICENSE.txt DESTINATION ${CMAKE_INSTALL_PREFIX} RENAME "Cantata License (GPL V3).txt")
add_subdirectory(icons)