diff options
| -rw-r--r-- | src/ui/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/ui/lxdesupport.cpp | 40 | ||||
| -rw-r--r-- | src/ui/lxdesupport.h | 33 | ||||
| -rw-r--r-- | src/ui/ui.pro | 6 |
4 files changed, 79 insertions, 2 deletions
diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt index 2a1eb1915..5275ad98f 100644 --- a/src/ui/CMakeLists.txt +++ b/src/ui/CMakeLists.txt @@ -85,6 +85,7 @@ SET(ui_SRCS popupsettings.cpp windowsystem.cpp viewmenu.cpp + lxdesupport.cpp ) SET(ui_MOC_HDRS @@ -140,6 +141,7 @@ SET(ui_MOC_HDRS popupsettings.h windowsystem.h viewmenu.h + lxdesupport.h ) SET(ui_RCCS images/images.qrc stuff.qrc translations/qmmp_locales.qrc) diff --git a/src/ui/lxdesupport.cpp b/src/ui/lxdesupport.cpp new file mode 100644 index 000000000..827cbd60c --- /dev/null +++ b/src/ui/lxdesupport.cpp @@ -0,0 +1,40 @@ +/*************************************************************************** + * Copyright (C) 2010 by Ilya Kotov * + * forkotov02@hotmail.ru * + * * + * 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 * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include <QIcon> +#include <QSettings> +#include <QDir> +#include "lxdesupport.h" + +void LXDESupport::load() +{ + if(qgetenv("XDG_CURRENT_DESKTOP") != "LXDE") + return; + + QString conf_path = qgetenv("XDG_CONFIG_HOME"); + if(conf_path.isEmpty()) + conf_path = QDir::homePath() + "/.config"; + conf_path.append("/lxsession/LXDE/desktop.conf"); + + QSettings lxde_settings(conf_path, QSettings::IniFormat); + QString themeName = lxde_settings.value("GTK/sNet/IconThemeName").toString(); + if(!themeName.isEmpty()) + QIcon::setThemeName(themeName); +} diff --git a/src/ui/lxdesupport.h b/src/ui/lxdesupport.h new file mode 100644 index 000000000..99f0aac62 --- /dev/null +++ b/src/ui/lxdesupport.h @@ -0,0 +1,33 @@ +/*************************************************************************** + * Copyright (C) 2010 by Ilya Kotov * + * forkotov02@hotmail.ru * + * * + * 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 * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef LXDESUPPORT_H +#define LXDESUPPORT_H + +/** + @author Ilya Kotov <forkotov02@hotmail.ru> +*/ +class LXDESupport +{ +public: + static void load(); +}; + +#endif // LXDESUPPORT_H diff --git a/src/ui/ui.pro b/src/ui/ui.pro index 2d570c4d6..c4c0ee861 100644 --- a/src/ui/ui.pro +++ b/src/ui/ui.pro @@ -57,7 +57,8 @@ HEADERS += mainwindow.h \ popupwidget.h \ popupsettings.h \ windowsystem.h \ - viewmenu.h + viewmenu.h \ + lxdesupport.h SOURCES += mainwindow.cpp \ mp3player.cpp \ button.cpp \ @@ -109,7 +110,8 @@ SOURCES += mainwindow.cpp \ popupwidget.cpp \ popupsettings.cpp \ windowsystem.cpp \ - viewmenu.cpp + viewmenu.cpp \ + lxdesupport.cpp win32:HEADERS += ../qmmp/visual.h unix { HEADERS += |
