diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3efbea21c..bc0b6bbe9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,6 +5,7 @@ cmake_minimum_required( VERSION 2.6 )
set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake )
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
+# SET(CPACK_SOURCE_IGNORE_FILES ${CPACK_SOURCE_IGNORE_FILES} "/.svn/" "/android/")
set(CPACK_GENERATOR "DEB;RPM;TGZ")
set(DEBIAN_PACKAGE_DESCRIPTION "Qt4/KDE4 Client for MPD")
set(DEBIAN_PACKAGE_SECTION "kde4")
@@ -117,6 +118,7 @@ SET( CANTATA_SRCS
widgets/actionitemdelegate.cpp
widgets/textbrowser.cpp
widgets/coverwidget.cpp
+ widgets/icon.cpp
lyrics/lyricspage.cpp
lyrics/lyricsettings.cpp
lyrics/ultimatelyricsprovider.cpp
diff --git a/android/cantata.pro b/android/cantata.pro
index 533248e3f..af79f093a 100644
--- a/android/cantata.pro
+++ b/android/cantata.pro
@@ -76,7 +76,9 @@ SOURCES += \
../network/networkproxyfactory.cpp \
../widgets/kmessagewidget.cpp \
../widgets/dialog.cpp \
- ../widgets/messagebox.cpp
+ ../widgets/messagebox.cpp \
+ ../widgets/icon.cpp \
+ ../widgets/togglebutton.cpp
HEADERS+= \
../gui/mainwindow.h \
@@ -164,7 +166,8 @@ INCLUDEPATH += \
../network
RESOURCES += \
- ../cantata_qt.qrc
+ ../cantata.qrc \
+ cantata_android.qrc
DEFINES += \
QT_NO_DEBUG_OUTPUT
diff --git a/android/cantata_android.qrc b/android/cantata_android.qrc
new file mode 100644
index 000000000..964cf27f6
--- /dev/null
+++ b/android/cantata_android.qrc
@@ -0,0 +1,58 @@
+
+
+../icons/cantata.svg
+icons/hisc-action-cantata-view-media-artist-various.svg
+icons/hisc-action-cantata-view-media-library.svg
+icons/other/consume.svg
+icons/gnome/repeat.svg
+icons/oxygen/application-exit.svg
+icons/oxygen/applications-internet.svg
+icons/oxygen/arrow-down.svg
+icons/oxygen/arrow-up.svg
+icons/oxygen/audio-volume-high.svg
+icons/oxygen/audio-volume-low.svg
+icons/oxygen/audio-volume-medium.svg
+icons/oxygen/audio-volume-muted.svg
+icons/oxygen/audio-x-generic.svg
+icons/oxygen/configure.svg
+icons/oxygen/dialog-close.svg
+icons/oxygen/dialog-error.svg
+icons/oxygen/dialog-information.svg
+icons/oxygen/dialog-ok.svg
+icons/oxygen/dialog-warning.svg
+icons/oxygen/document-edit.svg
+icons/oxygen/document-new.svg
+icons/oxygen/document-save-as.svg
+icons/oxygen/document-save.svg
+icons/oxygen/edit-clear-list.svg
+icons/oxygen/edit-clear-locationbar-ltr.svg
+icons/oxygen/edit-delete.svg
+icons/oxygen/edit-find.svg
+icons/oxygen/edit-rename.svg
+icons/oxygen/favorites.svg
+icons/oxygen/go-next.svg
+icons/oxygen/go-previous.svg
+icons/oxygen/inode-directory.svg
+icons/oxygen/list-add.svg
+icons/oxygen/list-remove.svg
+
+icons/other/opticaldisc.svg
+icons/oxygen/media-playback-pause.svg
+icons/oxygen/media-playback-start.svg
+icons/oxygen/media-playback-stop.svg
+
+icons/gnome/random.svg
+icons/oxygen/media-skip-backward.svg
+icons/oxygen/media-skip-forward.svg
+icons/oxygen/network-disconnect.svg
+icons/oxygen/network-connect.svg
+icons/oxygen/network-server.svg
+icons/oxygen/server-database.svg
+icons/oxygen/speaker.svg
+icons/oxygen/system-run.svg
+icons/oxygen/view-media-artist.svg
+icons/oxygen/view-media-lyrics.svg
+icons/oxygen/view-media-playlist.svg
+icons/oxygen/view-refresh.svg
+
+
diff --git a/android/icons/gnome/random.svg b/android/icons/gnome/random.svg
new file mode 100644
index 000000000..2bb1d9aca
--- /dev/null
+++ b/android/icons/gnome/random.svg
@@ -0,0 +1,79 @@
+
+
+
+
\ No newline at end of file
diff --git a/android/icons/gnome/repeat.svg b/android/icons/gnome/repeat.svg
new file mode 100644
index 000000000..f6ff478fe
--- /dev/null
+++ b/android/icons/gnome/repeat.svg
@@ -0,0 +1,157 @@
+
+
+
+
\ No newline at end of file
diff --git a/android/icons/hisc-action-cantata-view-media-artist-various.svg b/android/icons/hisc-action-cantata-view-media-artist-various.svg
new file mode 100644
index 000000000..b9d7ad6d3
--- /dev/null
+++ b/android/icons/hisc-action-cantata-view-media-artist-various.svg
@@ -0,0 +1,1446 @@
+
+
+
+
diff --git a/android/icons/hisc-action-cantata-view-media-library.svg b/android/icons/hisc-action-cantata-view-media-library.svg
new file mode 100644
index 000000000..b598aa22d
--- /dev/null
+++ b/android/icons/hisc-action-cantata-view-media-library.svg
@@ -0,0 +1,7364 @@
+
+
+
+
diff --git a/android/icons/other/consume.svg b/android/icons/other/consume.svg
new file mode 100644
index 000000000..0e85e0522
--- /dev/null
+++ b/android/icons/other/consume.svg
@@ -0,0 +1,106 @@
+
+
+
+
diff --git a/android/icons/other/opticaldisc.svg b/android/icons/other/opticaldisc.svg
new file mode 100644
index 000000000..54f2c397b
--- /dev/null
+++ b/android/icons/other/opticaldisc.svg
@@ -0,0 +1,518 @@
+
+
+
+
diff --git a/android/icons/oxygen/application-exit.svg b/android/icons/oxygen/application-exit.svg
new file mode 100644
index 000000000..11b105e9d
--- /dev/null
+++ b/android/icons/oxygen/application-exit.svg
@@ -0,0 +1,787 @@
+
+
+
diff --git a/android/icons/oxygen/applications-internet.svg b/android/icons/oxygen/applications-internet.svg
new file mode 100644
index 000000000..ca091ba5b
--- /dev/null
+++ b/android/icons/oxygen/applications-internet.svg
@@ -0,0 +1,4283 @@
+
+
+
\ No newline at end of file
diff --git a/android/icons/oxygen/arrow-down.svg b/android/icons/oxygen/arrow-down.svg
new file mode 100644
index 000000000..d6431b9b8
--- /dev/null
+++ b/android/icons/oxygen/arrow-down.svg
@@ -0,0 +1,1028 @@
+
+
+
diff --git a/android/icons/oxygen/arrow-up.svg b/android/icons/oxygen/arrow-up.svg
new file mode 100644
index 000000000..403cf9e75
--- /dev/null
+++ b/android/icons/oxygen/arrow-up.svg
@@ -0,0 +1,1028 @@
+
+
+
diff --git a/android/icons/oxygen/audio-volume-high.svg b/android/icons/oxygen/audio-volume-high.svg
new file mode 100644
index 000000000..87660ce49
--- /dev/null
+++ b/android/icons/oxygen/audio-volume-high.svg
@@ -0,0 +1,629 @@
+
+
+
\ No newline at end of file
diff --git a/android/icons/oxygen/audio-volume-low.svg b/android/icons/oxygen/audio-volume-low.svg
new file mode 100644
index 000000000..59df4f05e
--- /dev/null
+++ b/android/icons/oxygen/audio-volume-low.svg
@@ -0,0 +1,576 @@
+
+
+
\ No newline at end of file
diff --git a/android/icons/oxygen/audio-volume-medium.svg b/android/icons/oxygen/audio-volume-medium.svg
new file mode 100644
index 000000000..d6ee77cee
--- /dev/null
+++ b/android/icons/oxygen/audio-volume-medium.svg
@@ -0,0 +1,579 @@
+
+
+
\ No newline at end of file
diff --git a/android/icons/oxygen/audio-volume-muted.svg b/android/icons/oxygen/audio-volume-muted.svg
new file mode 100644
index 000000000..ac98b6773
--- /dev/null
+++ b/android/icons/oxygen/audio-volume-muted.svg
@@ -0,0 +1,10729 @@
+
+
+
\ No newline at end of file
diff --git a/android/icons/oxygen/audio-x-generic.svg b/android/icons/oxygen/audio-x-generic.svg
new file mode 100644
index 000000000..154129940
--- /dev/null
+++ b/android/icons/oxygen/audio-x-generic.svg
@@ -0,0 +1,8968 @@
+
+
+
+
diff --git a/android/icons/oxygen/configure.svg b/android/icons/oxygen/configure.svg
new file mode 100644
index 000000000..4ae7b2cdf
--- /dev/null
+++ b/android/icons/oxygen/configure.svg
@@ -0,0 +1,4606 @@
+
+
+
diff --git a/android/icons/oxygen/copyright b/android/icons/oxygen/copyright
new file mode 100644
index 000000000..71bd74e58
--- /dev/null
+++ b/android/icons/oxygen/copyright
@@ -0,0 +1,66 @@
+This package was debianized by Armin Berres on
+Wed, 24 Jun 2009 19:47:47 +0200
+
+It was downloaded from ftp://ftp.kde.org
+
+
+Upstream authors and copyright holders:
+
+
+The Oxygen Icon Theme
+ Copyright (C) 2007 Nuno Pinheiro
+ Copyright (C) 2007 David Vignoni
+ Copyright (C) 2007 David Miller
+ Copyright (C) 2007 Johann Ollivier Lapeyre
+ Copyright (C) 2007 Kenneth Wimer
+ Copyright (C) 2007 Riccardo Iaconelli
+
+and others
+
+License:
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 3 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library. If not, see .
+
+Clarification:
+
+ The GNU Lesser General Public License or LGPL is written for
+ software libraries in the first place. We expressly want the LGPL to
+ be valid for this artwork library too.
+
+ KDE Oxygen theme icons is a special kind of software library, it is an
+ artwork library, it's elements can be used in a Graphical User Interface, or
+ GUI.
+
+ Source code, for this library means:
+ - where they exist, SVG;
+ - otherwise, if applicable, the multi-layered formats xcf or psd, or
+ otherwise png.
+
+ The LGPL in some sections obliges you to make the files carry
+ notices. With images this is in some cases impossible or hardly useful.
+
+ With this library a notice is placed at a prominent place in the directory
+ containing the elements. You may follow this practice.
+
+ The exception in section 5 of the GNU Lesser General Public License covers
+ the use of elements of this art library in a GUI.
+
+ kde-artists [at] kde.org
+
+On Debian systems, the complete text of the GNU Lesser General Public
+License version 3 can be found in /usr/share/common-licenses/LGPL-3
+
+
+The Debian packaging is (C) 2007-2011 by Debian Qt/KDE Maintainers and
+is licensed under the GPL, see `/usr/share/common-licenses/GPL'.
diff --git a/android/icons/oxygen/dialog-close.svg b/android/icons/oxygen/dialog-close.svg
new file mode 100644
index 000000000..754eb5fd3
--- /dev/null
+++ b/android/icons/oxygen/dialog-close.svg
@@ -0,0 +1,389 @@
+
+
+
diff --git a/android/icons/oxygen/dialog-error.svg b/android/icons/oxygen/dialog-error.svg
new file mode 100644
index 000000000..690a6a273
--- /dev/null
+++ b/android/icons/oxygen/dialog-error.svg
@@ -0,0 +1,775 @@
+
+
+
diff --git a/android/icons/oxygen/dialog-information.svg b/android/icons/oxygen/dialog-information.svg
new file mode 100644
index 000000000..171a708e7
--- /dev/null
+++ b/android/icons/oxygen/dialog-information.svg
@@ -0,0 +1,4386 @@
+
+
+
\ No newline at end of file
diff --git a/android/icons/oxygen/dialog-ok.svg b/android/icons/oxygen/dialog-ok.svg
new file mode 100644
index 000000000..db31e5650
--- /dev/null
+++ b/android/icons/oxygen/dialog-ok.svg
@@ -0,0 +1,512 @@
+
+
+
diff --git a/android/icons/oxygen/dialog-warning.svg b/android/icons/oxygen/dialog-warning.svg
new file mode 100644
index 000000000..cea15e35b
--- /dev/null
+++ b/android/icons/oxygen/dialog-warning.svg
@@ -0,0 +1,631 @@
+
+
+
diff --git a/android/icons/oxygen/document-edit.svg b/android/icons/oxygen/document-edit.svg
new file mode 100644
index 000000000..ea44462ae
--- /dev/null
+++ b/android/icons/oxygen/document-edit.svg
@@ -0,0 +1,16945 @@
+
+
+
\ No newline at end of file
diff --git a/android/icons/oxygen/document-new.svg b/android/icons/oxygen/document-new.svg
new file mode 100644
index 000000000..8b9f1a8ab
--- /dev/null
+++ b/android/icons/oxygen/document-new.svg
@@ -0,0 +1,602 @@
+
+
+
\ No newline at end of file
diff --git a/android/icons/oxygen/document-save-as.svg b/android/icons/oxygen/document-save-as.svg
new file mode 100644
index 000000000..b755e4392
--- /dev/null
+++ b/android/icons/oxygen/document-save-as.svg
@@ -0,0 +1,31037 @@
+
+
+
diff --git a/android/icons/oxygen/document-save.svg b/android/icons/oxygen/document-save.svg
new file mode 100644
index 000000000..26d6ee09b
--- /dev/null
+++ b/android/icons/oxygen/document-save.svg
@@ -0,0 +1,29013 @@
+
+
+
diff --git a/android/icons/oxygen/edit-clear-list.svg b/android/icons/oxygen/edit-clear-list.svg
new file mode 100644
index 000000000..e9dcd5524
--- /dev/null
+++ b/android/icons/oxygen/edit-clear-list.svg
@@ -0,0 +1,6353 @@
+
+
+
+
diff --git a/android/icons/oxygen/edit-clear-locationbar-ltr.svg b/android/icons/oxygen/edit-clear-locationbar-ltr.svg
new file mode 100644
index 000000000..fc9451ad7
--- /dev/null
+++ b/android/icons/oxygen/edit-clear-locationbar-ltr.svg
@@ -0,0 +1,751 @@
+
+
+
diff --git a/android/icons/oxygen/edit-delete.svg b/android/icons/oxygen/edit-delete.svg
new file mode 100644
index 000000000..018ad85e8
--- /dev/null
+++ b/android/icons/oxygen/edit-delete.svg
@@ -0,0 +1,5671 @@
+
+
+
diff --git a/android/icons/oxygen/edit-find.svg b/android/icons/oxygen/edit-find.svg
new file mode 100644
index 000000000..0b051f510
--- /dev/null
+++ b/android/icons/oxygen/edit-find.svg
@@ -0,0 +1,3486 @@
+
+
+
diff --git a/android/icons/oxygen/edit-rename.svg b/android/icons/oxygen/edit-rename.svg
new file mode 100644
index 000000000..cd14779f9
--- /dev/null
+++ b/android/icons/oxygen/edit-rename.svg
@@ -0,0 +1,1052 @@
+
+
+
diff --git a/android/icons/oxygen/favorites.svg b/android/icons/oxygen/favorites.svg
new file mode 100644
index 000000000..574019b99
--- /dev/null
+++ b/android/icons/oxygen/favorites.svg
@@ -0,0 +1,966 @@
+
+
+
diff --git a/android/icons/oxygen/go-next.svg b/android/icons/oxygen/go-next.svg
new file mode 100644
index 000000000..a04e34490
--- /dev/null
+++ b/android/icons/oxygen/go-next.svg
@@ -0,0 +1,830 @@
+
+
+
diff --git a/android/icons/oxygen/go-previous.svg b/android/icons/oxygen/go-previous.svg
new file mode 100644
index 000000000..071f13d5f
--- /dev/null
+++ b/android/icons/oxygen/go-previous.svg
@@ -0,0 +1,961 @@
+
+
+
diff --git a/android/icons/oxygen/inode-directory.svg b/android/icons/oxygen/inode-directory.svg
new file mode 100644
index 000000000..83114a25e
--- /dev/null
+++ b/android/icons/oxygen/inode-directory.svg
@@ -0,0 +1,683 @@
+
+
+
+
diff --git a/android/icons/oxygen/list-add.svg b/android/icons/oxygen/list-add.svg
new file mode 100644
index 000000000..50a22437a
--- /dev/null
+++ b/android/icons/oxygen/list-add.svg
@@ -0,0 +1,398 @@
+
+
+
diff --git a/android/icons/oxygen/list-remove.svg b/android/icons/oxygen/list-remove.svg
new file mode 100644
index 000000000..8d483a3c2
--- /dev/null
+++ b/android/icons/oxygen/list-remove.svg
@@ -0,0 +1,325 @@
+
+
+
diff --git a/android/icons/oxygen/media-optical.svg b/android/icons/oxygen/media-optical.svg
new file mode 100644
index 000000000..0652bc882
--- /dev/null
+++ b/android/icons/oxygen/media-optical.svg
@@ -0,0 +1,614 @@
+
+
+
+
\ No newline at end of file
diff --git a/android/icons/oxygen/media-playback-pause.svg b/android/icons/oxygen/media-playback-pause.svg
new file mode 100644
index 000000000..e25538743
--- /dev/null
+++ b/android/icons/oxygen/media-playback-pause.svg
@@ -0,0 +1,283 @@
+
+
+
diff --git a/android/icons/oxygen/media-playback-start.svg b/android/icons/oxygen/media-playback-start.svg
new file mode 100644
index 000000000..5d46ca505
--- /dev/null
+++ b/android/icons/oxygen/media-playback-start.svg
@@ -0,0 +1,265 @@
+
+
+
diff --git a/android/icons/oxygen/media-playback-stop.svg b/android/icons/oxygen/media-playback-stop.svg
new file mode 100644
index 000000000..2019ccb2f
--- /dev/null
+++ b/android/icons/oxygen/media-playback-stop.svg
@@ -0,0 +1,267 @@
+
+
+
diff --git a/android/icons/oxygen/media-playlist-shuffle.svg b/android/icons/oxygen/media-playlist-shuffle.svg
new file mode 100644
index 000000000..18cd9a261
--- /dev/null
+++ b/android/icons/oxygen/media-playlist-shuffle.svg
@@ -0,0 +1,553 @@
+
+
+
diff --git a/android/icons/oxygen/media-skip-backward.svg b/android/icons/oxygen/media-skip-backward.svg
new file mode 100644
index 000000000..f30010fbb
--- /dev/null
+++ b/android/icons/oxygen/media-skip-backward.svg
@@ -0,0 +1,281 @@
+
+
+
diff --git a/android/icons/oxygen/media-skip-forward.svg b/android/icons/oxygen/media-skip-forward.svg
new file mode 100644
index 000000000..d0ad98d14
--- /dev/null
+++ b/android/icons/oxygen/media-skip-forward.svg
@@ -0,0 +1,281 @@
+
+
+
diff --git a/android/icons/oxygen/network-connect.svg b/android/icons/oxygen/network-connect.svg
new file mode 100644
index 000000000..92e8fee60
--- /dev/null
+++ b/android/icons/oxygen/network-connect.svg
@@ -0,0 +1,1717 @@
+
+
+
diff --git a/android/icons/oxygen/network-disconnect.svg b/android/icons/oxygen/network-disconnect.svg
new file mode 100644
index 000000000..7ca0be777
--- /dev/null
+++ b/android/icons/oxygen/network-disconnect.svg
@@ -0,0 +1,1249 @@
+
+
+
diff --git a/android/icons/oxygen/network-server.svg b/android/icons/oxygen/network-server.svg
new file mode 100644
index 000000000..385a984dc
--- /dev/null
+++ b/android/icons/oxygen/network-server.svg
@@ -0,0 +1,6124 @@
+
+
+
+
diff --git a/android/icons/oxygen/server-database.svg b/android/icons/oxygen/server-database.svg
new file mode 100644
index 000000000..d7c008d53
--- /dev/null
+++ b/android/icons/oxygen/server-database.svg
@@ -0,0 +1,2120 @@
+
+
+
+
diff --git a/android/icons/oxygen/speaker.svg b/android/icons/oxygen/speaker.svg
new file mode 100644
index 000000000..5108e3ee4
--- /dev/null
+++ b/android/icons/oxygen/speaker.svg
@@ -0,0 +1,1474 @@
+
+
+
diff --git a/android/icons/oxygen/system-run.svg b/android/icons/oxygen/system-run.svg
new file mode 100644
index 000000000..182585673
--- /dev/null
+++ b/android/icons/oxygen/system-run.svg
@@ -0,0 +1,1037 @@
+
+
+
diff --git a/android/icons/oxygen/view-media-artist.svg b/android/icons/oxygen/view-media-artist.svg
new file mode 100644
index 000000000..3b2f36131
--- /dev/null
+++ b/android/icons/oxygen/view-media-artist.svg
@@ -0,0 +1,425 @@
+
+
+
diff --git a/android/icons/oxygen/view-media-lyrics.svg b/android/icons/oxygen/view-media-lyrics.svg
new file mode 100644
index 000000000..f295a6d4b
--- /dev/null
+++ b/android/icons/oxygen/view-media-lyrics.svg
@@ -0,0 +1,2569 @@
+
+
+
diff --git a/android/icons/oxygen/view-media-playlist.svg b/android/icons/oxygen/view-media-playlist.svg
new file mode 100644
index 000000000..2957fa81e
--- /dev/null
+++ b/android/icons/oxygen/view-media-playlist.svg
@@ -0,0 +1,1615 @@
+
+
+
diff --git a/android/icons/oxygen/view-refresh.svg b/android/icons/oxygen/view-refresh.svg
new file mode 100644
index 000000000..4ab18c929
--- /dev/null
+++ b/android/icons/oxygen/view-refresh.svg
@@ -0,0 +1,1566 @@
+
+
+
diff --git a/application.cpp b/application.cpp
index b6e553582..61011cb1a 100644
--- a/application.cpp
+++ b/application.cpp
@@ -28,10 +28,9 @@
#include
#else
#include
-#include
-#include
#include
#endif
+#include "icon.h"
#include "utils.h"
#include "config.h"
#include "mainwindow.h"
@@ -102,9 +101,24 @@ Application::~Application()
{
}
+#ifdef CANTATA_ANDROID
+static void setPal(QPalette &pal, QPalette::ColorGroup cg, const QStringList &parts)
+{
+ for(int i=0; i(activationWindow())->load(urls);
}
}
-#endif
+#endif // TAGLIB_FOUND
#endif
diff --git a/application.h b/application.h
index 4e3357c25..4b83ef73a 100644
--- a/application.h
+++ b/application.h
@@ -66,19 +66,13 @@ public:
bool start();
#if defined TAGLIB_FOUND
void loadFiles();
- #endif
private:
- void setupIconTheme();
- #if defined TAGLIB_FOUND
void load(const QStringList &files);
- #endif
-#if defined TAGLIB_FOUND
private Q_SLOTS:
void message(const QString &m);
-#endif
-
+ #endif // TAGLIB_FOUND
};
#endif
diff --git a/cantata.qrc b/cantata.qrc
index 6502babd5..6304ddbef 100644
--- a/cantata.qrc
+++ b/cantata.qrc
@@ -1,5 +1,5 @@
-lyrics/ultimate_providers.xml
+lyrics/ultimate_providers.xml
diff --git a/cantata_qt.qrc b/cantata_qt.qrc
index c9294f188..86aaf8468 100644
--- a/cantata_qt.qrc
+++ b/cantata_qt.qrc
@@ -1,7 +1,6 @@
-lyrics/ultimate_providers.xml
-icons/cantata.svg
+icons/cantata.svg
icons/hi16-action-cantata-view-media-consume.png
icons/hi22-action-cantata-view-media-consume.png
icons/hi16-action-cantata-view-media-repeat.png
diff --git a/gui/covers.cpp b/gui/covers.cpp
index 9330364f7..8a4de3e6c 100644
--- a/gui/covers.cpp
+++ b/gui/covers.cpp
@@ -30,6 +30,7 @@
#include "networkaccessmanager.h"
#include "network.h"
#include "settings.h"
+#include "config.h"
#ifdef TAGLIB_FOUND
#include "tags.h"
#endif
@@ -130,7 +131,7 @@ static QString encodeName(QString name)
return name;
}
-#ifndef Q_OS_WIN
+#if !defined Q_OS_WIN && !defined CANTATA_ANDROID
static QString xdgConfig()
{
QString env = QString::fromLocal8Bit(qgetenv("XDG_CONFIG_HOME"));
@@ -513,7 +514,7 @@ Covers::Image Covers::getImage(const Song &song)
Job job(song, dirName);
- #ifndef Q_OS_WIN
+ #if !defined Q_OS_WIN && !defined CANTATA_ANDROID
// See if amarok, or clementine, has it...
AppCover app=otherAppCover(job);
if (!app.img.isNull()) {
@@ -686,7 +687,7 @@ void Covers::albumFailure(int, const QString &, QNetworkReply *reply)
if (job.isArtist) {
emit artistImage(job.song.albumartist, QImage());
} else {
- #ifdef Q_OS_WIN
+ #if defined Q_OS_WIN || defined CANTATA_ANDROID
emit cover(job.song, QImage(), QString());
#else
AppCover app=otherAppCover(job);
@@ -726,7 +727,7 @@ void Covers::jobFinished(QNetworkReply *reply)
if (job.isArtist) {
emit artistImage(job.song.albumartist, img);
} else if (img.isNull()) {
- #ifdef Q_OS_WIN
+ #if defined Q_OS_WIN || defined CANTATA_ANDROID
emit cover(job.song, QImage(), QString());
#else
AppCover app=otherAppCover(job);
diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp
index 753731bc2..e5191ffd1 100644
--- a/gui/mainwindow.cpp
+++ b/gui/mainwindow.cpp
@@ -108,31 +108,9 @@
#include "messagewidget.h"
#include "groupedview.h"
#include "actionitemdelegate.h"
+#include "icon.h"
#include "debugtimer.h"
-#ifdef ENABLE_KDE_SUPPORT
-#include
-#define Icon(X) KIcon(X)
-#define getMediaIcon(X) KIcon(X)
-#else
-#include
-#define Icon(X) QIcon::fromTheme(X)
-static QIcon getMediaIcon(const char *name)
-{
- static QList modes=QList() << QIcon::Normal << QIcon::Disabled << QIcon::Active << QIcon::Selected;
- QIcon icn;
- QIcon icon=QIcon::fromTheme(name);
-
- foreach (QIcon::Mode mode, modes) {
- icn.addPixmap(icon.pixmap(QSize(64, 64), mode).scaled(QSize(28, 28), Qt::KeepAspectRatio, Qt::SmoothTransformation), mode);
- icn.addPixmap(icon.pixmap(QSize(22, 22), mode), mode);
- }
-
- return icn;
-}
-
-#endif
-
static QPixmap createSingleIconPixmap(int size, QColor &col, double opacity)
{
QPixmap pix(size, size);
@@ -157,14 +135,23 @@ static QPixmap createSingleIconPixmap(int size, QColor &col, double opacity)
static QIcon createSingleIcon()
{
QIcon icon;
- QColor col=QColor(Qt::black);
- icon.addPixmap(createSingleIconPixmap(16, col, 100.0));
- icon.addPixmap(createSingleIconPixmap(22, col, 100.0));
- icon.addPixmap(createSingleIconPixmap(16, col, 50.0), QIcon::Disabled);
- icon.addPixmap(createSingleIconPixmap(22, col, 50.0), QIcon::Disabled);
- col=QColor(48, 48, 48);
- icon.addPixmap(createSingleIconPixmap(16, col, 100.0), QIcon::Active);
- icon.addPixmap(createSingleIconPixmap(22, col, 100.0), QIcon::Active);
+ QColor stdColor=QColor(QApplication::palette().color(QPalette::Active, QPalette::WindowText));
+ if (stdColor==Qt::white) {
+ stdColor=QColor(200, 200, 200);
+ }
+ QColor highlightColor=stdColor.red()<100 ? stdColor.lighter(50) : stdColor.darker(50);
+ QList sizes=QList() << 16 << 22
+ #ifdef CANTATA_ANDROID
+ << 32 << 48 << 64
+ #endif
+ ;
+
+ foreach (int s, sizes) {
+ icon.addPixmap(createSingleIconPixmap(s, stdColor, 100.0));
+ icon.addPixmap(createSingleIconPixmap(s, stdColor, 50.0), QIcon::Disabled);
+ icon.addPixmap(createSingleIconPixmap(s, highlightColor, 100.0), QIcon::Active);
+ }
+
return icon;
}
@@ -256,8 +243,12 @@ VolumeControl::VolumeControl(QWidget *parent)
layout->setMargin(0);
layout->addWidget(w);
connect(slider, SIGNAL(valueChanged(int)), SIGNAL(valueChanged(int)));
- slider->setMinimumHeight(192);
- slider->setMaximumHeight(192);
+ int size=Icon::stdSize(QApplication::fontMetrics().height());
+
+ slider->setMinimumHeight(size*12);
+ slider->setMaximumHeight(size*12);
+ slider->setMinimumWidth(size*1.5);
+ slider->setMaximumWidth(size*1.5);
slider->setOrientation(Qt::Vertical);
slider->setMinimum(0);
slider->setMaximum(100);
@@ -336,6 +327,26 @@ static int nextKey(int &key) {
#define SET_SHORTCUT(ACT, S) ACT->setShortcut(S); addAction(ACT); ACT->setShortcutContext(Qt::ApplicationShortcut)
#endif
+void MainWindow::initButton(QToolButton *btn)
+{
+ #ifdef CANTATA_ANDROID
+ static int size=-1;
+
+ if (-1==size) {
+ size=QApplication::fontMetrics().height();
+ if (size>18) {
+ size=Icon::stdSize(size*1.25);
+ } else {
+ size=16;
+ }
+ }
+ btn->setIconSize(QSize(size, size));
+ #else
+ btn->setIconSize(QSize(16, 16));
+ #endif
+ btn->setAutoRaise(true);
+}
+
MainWindow::MainWindow(QWidget *parent)
#ifdef ENABLE_KDE_SUPPORT
: KXmlGuiWindow(parent)
@@ -391,7 +402,7 @@ MainWindow::MainWindow(QWidget *parent)
MPDParseUtils::setGroupMultiple(Settings::self()->groupMultiple());
#ifndef ENABLE_KDE_SUPPORT
- setWindowIcon(QIcon(":/icons/cantata.svg"));
+ setWindowIcon(QIcon(":/cantata.svg"));
QNetworkProxyFactory::setApplicationProxyFactory(NetworkProxyFactory::Instance());
#endif
@@ -717,11 +728,11 @@ MainWindow::MainWindow(QWidget *parent)
positionSlider->setStyle(new ProxyStyle());
- playbackPlay = getMediaIcon("media-playback-start");
- playbackPause = getMediaIcon("media-playback-pause");
+ playbackPlay = MediaIcon("media-playback-start");
+ playbackPause = MediaIcon("media-playback-pause");
randomPlayQueueAction->setIcon(Icon("media-playlist-shuffle"));
locateTrackAction->setIcon(Icon("edit-find"));
- #ifdef ENABLE_KDE_SUPPORT
+ #if defined ENABLE_KDE_SUPPORT || defined CANTATA_ANDROID
consumePlayQueueAction->setIcon(Icon("cantata-view-media-consume"));
repeatPlayQueueAction->setIcon(Icon("cantata-view-media-repeat"));
// randomPlayQueueAction->setIcon(Icon("cantata-view-media-shuffle"));
@@ -766,10 +777,10 @@ MainWindow::MainWindow(QWidget *parent)
// }
// #endif
- prevTrackAction->setIcon(getMediaIcon("media-skip-backward"));
- nextTrackAction->setIcon(getMediaIcon("media-skip-forward"));
+ prevTrackAction->setIcon(MediaIcon("media-skip-backward"));
+ nextTrackAction->setIcon(MediaIcon("media-skip-forward"));
playPauseTrackAction->setIcon(playbackPlay);
- stopTrackAction->setIcon(getMediaIcon("media-playback-stop"));
+ stopTrackAction->setIcon(MediaIcon("media-playback-stop"));
removeFromPlayQueueAction->setIcon(Icon("list-remove"));
clearPlayQueueAction->setIcon(Icon("edit-clear-list"));
savePlayQueueAction->setIcon(Icon("document-save-as"));
@@ -784,8 +795,8 @@ MainWindow::MainWindow(QWidget *parent)
connectionsGroup=new QActionGroup(connectionsAction->menu());
outputsAction->setMenu(new QMenu(this));
outputsAction->setVisible(false);
- showPlayQueueAction->setIcon(QIcon::fromTheme("media-playback-start"));
- #ifdef ENABLE_KDE_SUPPORT
+ showPlayQueueAction->setIcon(Icon("media-playback-start"));
+ #if defined ENABLE_KDE_SUPPORT || defined CANTATA_ANDROID
libraryTabAction->setIcon(Icon("cantata-view-media-library"));
#else
QIcon libraryIcon(":lib16.png");
@@ -801,7 +812,7 @@ MainWindow::MainWindow(QWidget *parent)
lyricsTabAction->setIcon(Icon("view-media-lyrics"));
streamsTabAction->setIcon(Icon(DEFAULT_STREAM_ICON));
#ifdef ENABLE_WEBKIT
- #ifdef ENABLE_KDE_SUPPORT
+ #if defined ENABLE_KDE_SUPPORT || defined CANTATA_ANDROID
infoTabAction->setIcon(Icon("cantata-view-wikipedia"));
#else // ENABLE_KDE_SUPPORT
QIcon wikiIcon(":wiki16.png");
@@ -868,6 +879,8 @@ MainWindow::MainWindow(QWidget *parent)
streamButton->setVisible(false);
#endif
+ initSizes();
+
QStringList hiddenPages=Settings::self()->hiddenPages();
#define TAB_ACTION(A) A->icon(), A->text(), A->text()+"
"+A->shortcut().toString()+""
@@ -957,10 +970,8 @@ MainWindow::MainWindow(QWidget *parent)
#endif
}
- #ifndef CANTATA_ANDROID
setPlaybackButtonsSize(Settings::self()->smallPlaybackButtons());
setControlButtonsSize(Settings::self()->smallControlButtons());
- #endif
trackLabel->setText(QString());
artistLabel->setText(QString());
@@ -1033,8 +1044,8 @@ MainWindow::MainWindow(QWidget *parent)
#endif
dynamicLabel->setVisible(false);
- addWithPriorityAction->setIcon(QIcon::fromTheme("favorites"));
- setPriorityAction->setIcon(QIcon::fromTheme("favorites"));
+ addWithPriorityAction->setIcon(Icon("favorites"));
+ setPriorityAction->setIcon(Icon("favorites"));
addWithPriorityAction->setVisible(false);
setPriorityAction->setVisible(false);
addPrioHighestAction->setData(255);
@@ -1268,7 +1279,6 @@ MainWindow::MainWindow(QWidget *parent)
QTimer::singleShot(250, this, SLOT(toggleDockManager()));
}
#endif
- initSizes();
}
MainWindow::~MainWindow()
@@ -1333,6 +1343,8 @@ MainWindow::~MainWindow()
void MainWindow::initSizes()
{
+ ItemView::setup();
+ FancyTabWidget::setup();
GroupedView::setup();
ActionItemDelegate::setup();
MusicLibraryItemAlbum::setup();
@@ -1398,38 +1410,57 @@ void MainWindow::controlButtonsMenu()
void MainWindow::setPlaybackButtonsSize(bool small)
{
+ #ifdef CANTATA_ANDROID
+ int size=Icon::stdSize(QApplication::fontMetrics().height()*1.5);
+ #endif
+
QList playbackBtns;
playbackBtns << prevTrackButton << stopTrackButton << playPauseTrackButton << nextTrackButton;
foreach (QToolButton *b, playbackBtns) {
b->setToolButtonStyle(Qt::ToolButtonIconOnly);
-// #ifdef ENABLE_KDE_SUPPORT
- b->setIconSize(small ? QSize(22, 22) : QSize(28, 28));
- b->setMinimumSize(small ? QSize(26, 26) : QSize(32, 32));
- b->setMaximumSize(small ? QSize(26, 26) : QSize(32, 32));
-// #else
-// b->setIconSize(small ? QSize(24, 24) : QSize(28, 28));
-// b->setMinimumSize(small ? QSize(26, 26) : QSize(36, 36));
-// b->setMaximumSize(small ? QSize(26, 26) : QSize(36, 36));
-// #endif
+ #ifdef CANTATA_ANDROID
+ if (size>22) {
+ b->setMinimumSize(QSize(size+2, size+2));
+ b->setMaximumSize(QSize(size+2, size+2));
+ b->setIconSize(QSize(size, size));
+ } else
+ #endif
+ {
+ b->setIconSize(small ? QSize(22, 22) : QSize(28, 28));
+ b->setMinimumSize(small ? QSize(26, 26) : QSize(32, 32));
+ b->setMaximumSize(small ? QSize(26, 26) : QSize(32, 32));
+ }
}
}
void MainWindow::setControlButtonsSize(bool small)
{
+ #ifdef CANTATA_ANDROID
+ int size=Icon::stdSize(QApplication::fontMetrics().height()*1.5);
+ #endif
QList controlBtns;
controlBtns << volumeButton << menuButton;
#ifdef PHONON_FOUND
controlBtns << streamButton;
#endif
foreach (QToolButton *b, controlBtns) {
- b->setMinimumSize(small ? QSize(22, 22) : QSize(26, 26));
- b->setMaximumSize(small ? QSize(22, 22) : QSize(26, 26));
b->setToolButtonStyle(Qt::ToolButtonIconOnly);
- #ifdef ENABLE_KDE_SUPPORT
- b->setIconSize(small ? QSize(16, 16) : QSize(22, 22));
- #else
- b->setIconSize(small ? QSize(18, 18) : QSize(22, 22));
+ #ifdef CANTATA_ANDROID
+ if (size>22) {
+ b->setMinimumSize(QSize(size+2, size+2));
+ b->setMaximumSize(QSize(size+2, size+2));
+ b->setIconSize(QSize(size, size));
+ } else
#endif
+ {
+ b->setMinimumSize(small ? QSize(22, 22) : QSize(26, 26));
+ b->setMaximumSize(small ? QSize(22, 22) : QSize(26, 26));
+ #ifdef ENABLE_KDE_SUPPORT
+ b->setIconSize(small ? QSize(16, 16) : QSize(22, 22));
+ #else
+ b->setIconSize(small ? QSize(18, 18) : QSize(22, 22));
+ #endif
+ }
}
}
@@ -1523,7 +1554,22 @@ void MainWindow::keyPressEvent(QKeyEvent *event)
}
}
-#ifndef CANTATA_ANDROID
+#ifdef CANTATA_ANDROID
+void MainWindow::resizeEvent(QResizeEvent *event)
+{
+ if (event->size().width()>event->size().height()) {
+ if (tabWidget->isEnabled(PAGE_PLAYQUEUE)) {
+ tabWidget->ToggleTab(PAGE_PLAYQUEUE, false);
+ if (PAGE_PLAYQUEUE==tabWidget->current_index()) {
+ showTab(PAGE_LIBRARY);
+ }
+ }
+ } else if (!tabWidget->isEnabled(PAGE_PLAYQUEUE)) {
+ tabWidget->ToggleTab(PAGE_PLAYQUEUE, true);
+ showTab(PAGE_PLAYQUEUE);
+ }
+}
+#else
void MainWindow::closeEvent(QCloseEvent *event)
{
if (trayItem) {
diff --git a/gui/mainwindow.h b/gui/mainwindow.h
index ed567ac23..bb4b5b819 100644
--- a/gui/mainwindow.h
+++ b/gui/mainwindow.h
@@ -37,7 +37,6 @@
#include
#include
#include
-#include
#include
#include
#include
@@ -185,10 +184,7 @@ public:
Q_PROPERTY(int volume READ mpdVolume WRITE setMpdVolume)
- static void initButton(QToolButton *btn) {
- btn->setAutoRaise(true);
- btn->setIconSize(QSize(16, 16));
- }
+ static void initButton(QToolButton *btn);
MainWindow(QWidget *parent = 0);
~MainWindow();
@@ -204,7 +200,9 @@ public:
protected:
void keyPressEvent(QKeyEvent *event);
- #ifndef CANTATA_ANDROID
+ #ifdef CANTATA_ANDROID
+ void resizeEvent(QResizeEvent *event);
+ #else
void closeEvent(QCloseEvent *event);
#endif
diff --git a/gui/mainwindow.ui b/gui/mainwindow.ui
index 6740cb748..dddff2adb 100644
--- a/gui/mainwindow.ui
+++ b/gui/mainwindow.ui
@@ -96,7 +96,7 @@
0
-
-
+
20
@@ -229,7 +229,7 @@
-
-
+
true
@@ -239,7 +239,7 @@
-
-
+
true
@@ -249,7 +249,7 @@
-
-
+
true
@@ -278,7 +278,7 @@
-
-
+
@@ -287,6 +287,11 @@
+
+ ToggleButton
+ QToolButton
+
+
SqueezedTextLabel
QLabel
diff --git a/gui/playlistspage.cpp b/gui/playlistspage.cpp
index 94f2b476b..ccd3bbe51 100644
--- a/gui/playlistspage.cpp
+++ b/gui/playlistspage.cpp
@@ -27,7 +27,7 @@
#include "messagebox.h"
#include "inputdialog.h"
#include "localize.h"
-#include
+#include "icon.h"
#include
#ifdef ENABLE_KDE_SUPPORT
#include
@@ -49,7 +49,7 @@ PlaylistsPage::PlaylistsPage(MainWindow *p)
#else
renamePlaylistAction = new QAction(tr("Rename"), this);
#endif
- renamePlaylistAction->setIcon(QIcon::fromTheme("edit-rename"));
+ renamePlaylistAction->setIcon(Icon("edit-rename"));
replacePlayQueue->setDefaultAction(p->replacePlayQueueAction);
libraryUpdate->setDefaultAction(p->refreshAction);
@@ -98,7 +98,7 @@ PlaylistsPage::PlaylistsPage(MainWindow *p)
menu->addAction(p->removeAction);
menu->addAction(renamePlaylistAction);
menuButton->setMenu(menu);
- menuButton->setIcon(QIcon::fromTheme("system-run"));
+ menuButton->setIcon(Icon("system-run"));
updateGenres(QSet());
}
diff --git a/gui/preferencesdialog.cpp b/gui/preferencesdialog.cpp
index f5e2f12df..41d0bf9b9 100644
--- a/gui/preferencesdialog.cpp
+++ b/gui/preferencesdialog.cpp
@@ -24,6 +24,7 @@
#include "preferencesdialog.h"
#include "mainwindow.h"
#include "settings.h"
+#include "icon.h"
#ifndef CANTATA_ANDROID
#include "interfacesettings.h"
#include "externalsettings.h"
@@ -54,11 +55,23 @@ class ConfigPage : public QWidget
public:
ConfigPage(QWidget *p, const QString &title, const QIcon &icon, QWidget *cfg) : QWidget(p)
{
+ static int size=-1;
+
+ if (-1==size) {
+ size=QApplication::fontMetrics().height();
+ if (size>20) {
+ size=Icon::stdSize(size*1.25);
+ } else {
+ size=22;
+ }
+ }
+
QBoxLayout *layout=new QBoxLayout(QBoxLayout::TopToBottom, this);
QBoxLayout *titleLayout=new QBoxLayout(QBoxLayout::LeftToRight, 0);
titleLayout->addWidget(new QLabel(""+title+"", this));
QLabel *icn=new QLabel(this);
- icn->setPixmap(icon.pixmap(22, 22));
+
+ icn->setPixmap(icon.pixmap(size, size));
titleLayout->addItem(new QSpacerItem(16, 16, QSizePolicy::Expanding, QSizePolicy::Minimum));
titleLayout->addWidget(icn);
layout->addLayout(titleLayout);
@@ -135,29 +148,29 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, LyricsPage *lp)
page->setHeader(i18n("Lyrics Settings"));
page->setIcon(KIcon("view-media-lyrics"));
#else
- widget->AddTab(new ConfigPage(this, tr("Connection Settings"), QIcon::fromTheme("server-database"), server),
- QIcon::fromTheme("server-database"), tr("Connection"));
- widget->AddTab(new ConfigPage(this, tr("Output Settings"), QIcon::fromTheme("speaker"), serverplayback),
- QIcon::fromTheme("speaker"), tr("Output"));
- widget->AddTab(new ConfigPage(this, tr("Playback Settings"), QIcon::fromTheme("media-playback-start"), playback),
- QIcon::fromTheme("media-playback-start"), tr("Playback"));
+ widget->AddTab(new ConfigPage(this, tr("Connection Settings"), Icon("server-database"), server),
+ Icon("server-database"), tr("Connection"));
+ widget->AddTab(new ConfigPage(this, tr("Output Settings"), Icon("speaker"), serverplayback),
+ Icon("speaker"), tr("Output"));
+ widget->AddTab(new ConfigPage(this, tr("Playback Settings"), Icon("media-playback-start"), playback),
+ Icon("media-playback-start"), tr("Playback"));
#ifndef CANTATA_ANDROID
- widget->AddTab(new ConfigPage(this, tr("Interface Settings"), QIcon::fromTheme("view-choose"), interface),
- QIcon::fromTheme("view-choose"), tr("Interface"));
- widget->AddTab(new ConfigPage(this, tr("External Settings"), QIcon::fromTheme("video-display"), ext),
- QIcon::fromTheme("video-display"), tr("External"));
+ widget->AddTab(new ConfigPage(this, tr("Interface Settings"), Icon("view-choose"), interface),
+ Icon("view-choose"), tr("Interface"));
+ widget->AddTab(new ConfigPage(this, tr("External Settings"), Icon("video-display"), ext),
+ Icon("video-display"), tr("External"));
#ifdef TAGLIB_FOUND
- widget->AddTab(new ConfigPage(this, tr("HTTP Server Settings"), QIcon::fromTheme("network-server"), http),
- QIcon::fromTheme("network-server"), tr("HTTP Server"));
+ widget->AddTab(new ConfigPage(this, tr("HTTP Server Settings"), Icon("network-server"), http),
+ Icon("network-server"), tr("HTTP Server"));
#endif
#endif
- widget->AddTab(new ConfigPage(this, tr("Lyrics Settings"), QIcon::fromTheme("view-media-lyrics"), lyrics),
- QIcon::fromTheme("view-media-lyrics"), tr("Lyrics"));
+ widget->AddTab(new ConfigPage(this, tr("Lyrics Settings"), Icon("view-media-lyrics"), lyrics),
+ Icon("view-media-lyrics"), tr("Lyrics"));
#ifndef CANTATA_ANDROID
proxy = new ProxySettings(this);
proxy->load();
- widget->AddTab(new ConfigPage(this, tr("Proxy Settings"), QIcon::fromTheme("preferences-system-network"), proxy),
- QIcon::fromTheme("preferences-system-network"), tr("Proxy"));
+ widget->AddTab(new ConfigPage(this, tr("Proxy Settings"), Icon("preferences-system-network"), proxy),
+ Icon("preferences-system-network"), tr("Proxy"));
#endif
widget->SetMode(FancyTabWidget::Mode_LargeSidebar);
#endif
diff --git a/gui/serverinfopage.cpp b/gui/serverinfopage.cpp
index 425034a29..962bb485e 100644
--- a/gui/serverinfopage.cpp
+++ b/gui/serverinfopage.cpp
@@ -27,6 +27,7 @@
#include "mainwindow.h"
#include "mpdparseutils.h"
#include "localize.h"
+#include "icon.h"
#ifdef ENABLE_KDE_SUPPORT
#include
#include
@@ -46,7 +47,7 @@ ServerInfoPage::ServerInfoPage(MainWindow *p)
#else
updateAction = new QAction(tr("Update MPD Information"), this);
#endif
- updateAction->setIcon(QIcon::fromTheme("view-refresh"));
+ updateAction->setIcon(Icon("view-refresh"));
updateInfo->setDefaultAction(updateAction);
connect(updateAction, SIGNAL(triggered(bool)), MPDConnection::self(), SLOT(getStats()));
connect(MPDConnection::self(), SIGNAL(statsUpdated(const MPDStats &)), SLOT(statsUpdated(const MPDStats &)));
diff --git a/gui/serverplaybacksettings.cpp b/gui/serverplaybacksettings.cpp
index 188b61670..8c8d5d4ba 100644
--- a/gui/serverplaybacksettings.cpp
+++ b/gui/serverplaybacksettings.cpp
@@ -25,6 +25,7 @@
#include "mpdconnection.h"
#include "localize.h"
#include "settings.h"
+#include "icon.h"
#include
static const int constIconSize=48;
@@ -110,7 +111,7 @@ void ServerPlaybackSettings::mpdConnectionStateChanged(bool c)
streamUrl->setEnabled(c);
streamUrlLabel->setEnabled(c);
#endif
- messageIcon->setPixmap(QIcon::fromTheme(c ? "dialog-information" : "dialog-warning").pixmap(constIconSize, constIconSize));
+ messageIcon->setPixmap(Icon(c ? "dialog-information" : "dialog-warning").pixmap(constIconSize, constIconSize));
if (c) {
messageLabel->setText(i18n("Connected to %1
The entries below apply to the currently connected MPD instance.")
.arg(MPDConnection::self()->getDetails().description()));
diff --git a/gui/serversettings.cpp b/gui/serversettings.cpp
index cf5e42140..0c832fb35 100644
--- a/gui/serversettings.cpp
+++ b/gui/serversettings.cpp
@@ -26,10 +26,10 @@
#include "localize.h"
#include "inputdialog.h"
#include "messagebox.h"
+#include "icon.h"
#include
#include
#include
-#include
ServerSettings::ServerSettings(QWidget *p)
: QWidget(p)
@@ -49,8 +49,8 @@ ServerSettings::ServerSettings(QWidget *p)
connect(saveButton, SIGNAL(clicked(bool)), SLOT(saveAs()));
connect(removeButton, SIGNAL(clicked(bool)), SLOT(remove()));
connect(connectButton, SIGNAL(clicked(bool)), SLOT(toggleConnection()));
- saveButton->setIcon(QIcon::fromTheme("document-save-as"));
- removeButton->setIcon(QIcon::fromTheme("edit-delete"));
+ saveButton->setIcon(Icon("document-save-as"));
+ removeButton->setIcon(Icon("edit-delete"));
#if defined Q_OS_WIN || defined CANTATA_ANDROID
hostLabel->setText(i18n("Host:"));
@@ -188,7 +188,7 @@ void ServerSettings::enableWidgets(bool e)
// passwordLabel->setEnabled(e);
// dirLabel->setEnabled(e);
connectButton->setText(e ? i18n("Connect") : i18n("Disconnect"));
- connectButton->setIcon(QIcon::fromTheme(e ? "network-connect" : "network-disconnect"));
+ connectButton->setIcon(Icon(e ? "network-connect" : "network-disconnect"));
removeButton->setEnabled(e);
// saveButton->setEnabled(e);
}
diff --git a/gui/streamspage.cpp b/gui/streamspage.cpp
index 1f8e11684..dea9f9d46 100644
--- a/gui/streamspage.cpp
+++ b/gui/streamspage.cpp
@@ -27,7 +27,7 @@
#include "mpdconnection.h"
#include "messagebox.h"
#include "localize.h"
-#include
+#include "icon.h"
#include
#ifdef ENABLE_KDE_SUPPORT
#include
@@ -60,10 +60,10 @@ StreamsPage::StreamsPage(MainWindow *p)
addAction = new QAction(tr("Add Stream"), this);
editAction = new QAction(tr("Edit"), this);
#endif
- importAction->setIcon(QIcon::fromTheme("document-import"));
- exportAction->setIcon(QIcon::fromTheme("document-export"));
- addAction->setIcon(QIcon::fromTheme("list-add"));
- editAction->setIcon(QIcon::fromTheme("document-edit"));
+ importAction->setIcon(Icon("document-import"));
+ exportAction->setIcon(Icon("document-export"));
+ addAction->setIcon(Icon("list-add"));
+ editAction->setIcon(Icon("document-edit"));
replacePlayQueue->setDefaultAction(p->replacePlayQueueAction);
// connect(view, SIGNAL(itemsSelected(bool)), addToPlaylist, SLOT(setEnabled(bool)));
connect(view, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(itemDoubleClicked(const QModelIndex &)));
@@ -84,7 +84,7 @@ StreamsPage::StreamsPage(MainWindow *p)
menu->addAction(importAction);
menu->addAction(exportAction);
menuButton->setMenu(menu);
- menuButton->setIcon(QIcon::fromTheme("system-run"));
+ menuButton->setIcon(Icon("system-run"));
MainWindow::initButton(replacePlayQueue);
view->setTopText(i18n("Streams"));
diff --git a/lyrics/lyricsdialog.cpp b/lyrics/lyricsdialog.cpp
index 02856ca9c..f7a95bcb7 100644
--- a/lyrics/lyricsdialog.cpp
+++ b/lyrics/lyricsdialog.cpp
@@ -23,7 +23,7 @@
#include
#include
-#include
+#include "icon.h"
#include "lyricsdialog.h"
#include "localize.h"
#ifdef ENABLE_KDE_SUPPORT
@@ -51,7 +51,7 @@ LyricsDialog::LyricsDialog(const Song &s, QWidget *parent)
int iconSize=48;
icn->setMinimumSize(iconSize, iconSize);
icn->setMaximumSize(iconSize, iconSize);
- icn->setPixmap(QIcon::fromTheme("dialog-information").pixmap(iconSize, iconSize));
+ icn->setPixmap(Icon("dialog-information").pixmap(iconSize, iconSize));
mainLayout->setMargin(0);
layout->setMargin(0);
mainLayout->addWidget(icn, 0, 0, 1, 1);
diff --git a/lyrics/lyricsettings.cpp b/lyrics/lyricsettings.cpp
index 7a3eaa99a..ab359cc33 100644
--- a/lyrics/lyricsettings.cpp
+++ b/lyrics/lyricsettings.cpp
@@ -26,7 +26,7 @@
#include "ultimatelyricsprovider.h"
#include "ui_lyricsettings.h"
#include "localize.h"
-#include
+#include "icon.h"
LyricSettings::LyricSettings(QWidget *parent)
: QWidget(parent),
@@ -40,8 +40,8 @@ LyricSettings::LyricSettings(QWidget *parent)
SLOT(CurrentItemChanged(QListWidgetItem*)));
// connect(ui_->providers, SIGNAL(itemChanged(QListWidgetItem*)),
// SLOT(ItemChanged(QListWidgetItem*)));
- ui_->up->setIcon(QIcon::fromTheme("arrow-up"));
- ui_->down->setIcon(QIcon::fromTheme("arrow-down"));
+ ui_->up->setIcon(Icon("arrow-up"));
+ ui_->down->setIcon(Icon("arrow-down"));
}
LyricSettings::~LyricSettings() {
diff --git a/lyrics/lyricspage.cpp b/lyrics/lyricspage.cpp
index 567830046..15b5c0623 100644
--- a/lyrics/lyricspage.cpp
+++ b/lyrics/lyricspage.cpp
@@ -36,6 +36,7 @@
#ifdef TAGLIB_FOUND
#include "tags.h"
#endif
+#include "icon.h"
#include
#include
#include
@@ -44,7 +45,6 @@
#include
#include
#include
-#include
#include
#ifdef ENABLE_KDE_SUPPORT
#include
@@ -90,14 +90,14 @@ LyricsPage::LyricsPage(MainWindow *p)
{
setupUi(this);
- providers=UltimateLyricsReader().Parse(QString(":lyrics/ultimate_providers.xml"));
+ providers=UltimateLyricsReader().Parse(QString(":lyrics.xml"));
foreach (UltimateLyricsProvider* provider, providers) {
connect(provider, SIGNAL(InfoReady(int, const QString &)), SLOT(resultReady(int, const QString &)));
}
// Parse the ultimate lyrics xml file in the background
// QFuture future = QtConcurrent::run(reader.data(), &UltimateLyricsReader::Parse,
-// QString(":lyrics/ultimate_providers.xml"));
+// QString(":lyrics.xml"));
// QFutureWatcher *watcher = new QFutureWatcher(this);
// watcher->setFuture(future);
// connect(watcher, SIGNAL(finished()), SLOT(ultimateLyricsParsed()));
@@ -122,12 +122,12 @@ LyricsPage::LyricsPage(MainWindow *p)
cancelAction = new QAction(tr("Refresh"), this);
delAction = new QAction(tr("Refresh"), this);
#endif
- refreshAction->setIcon(QIcon::fromTheme("view-refresh"));
- searchAction->setIcon(QIcon::fromTheme("edit-find"));
- editAction->setIcon(QIcon::fromTheme("document-edit"));
- saveAction->setIcon(QIcon::fromTheme("document-save"));
- cancelAction->setIcon(QIcon::fromTheme("dialog-cancel"));
- delAction->setIcon(QIcon::fromTheme("edit-delete"));
+ refreshAction->setIcon(Icon("view-refresh"));
+ searchAction->setIcon(Icon("edit-find"));
+ editAction->setIcon(Icon("document-edit"));
+ saveAction->setIcon(Icon("document-save"));
+ cancelAction->setIcon(Icon("dialog-cancel"));
+ delAction->setIcon(Icon("edit-delete"));
connect(refreshAction, SIGNAL(triggered()), SLOT(update()));
connect(searchAction, SIGNAL(triggered()), SLOT(search()));
connect(editAction, SIGNAL(triggered()), SLOT(edit()));
diff --git a/models/albumsmodel.cpp b/models/albumsmodel.cpp
index cd1fd2335..a6bd686bb 100644
--- a/models/albumsmodel.cpp
+++ b/models/albumsmodel.cpp
@@ -25,7 +25,6 @@
#include
#include
#include
-#include
#include
#include "localize.h"
#ifdef ENABLE_KDE_SUPPORT
@@ -44,6 +43,7 @@
#include "itemview.h"
#include "mpdparseutils.h"
#include "debugtimer.h"
+#include "icon.h"
static int sortAlbums=AlbumsModel::Sort_AlbumArtist;
@@ -212,7 +212,7 @@ QVariant AlbumsModel::data(const QModelIndex &index, int role) const
int iSize=iconSize();
if (Qt::DecorationRole==role && 0==iSize) {
- return QIcon::fromTheme(DEFAULT_ALBUM_ICON);
+ return Icon(DEFAULT_ALBUM_ICON);
}
if (!theDefaultIcon) {
@@ -221,7 +221,7 @@ QVariant AlbumsModel::data(const QModelIndex &index, int role) const
if (0==cSize) {
cSize=stdSize=22;
}
- theDefaultIcon = new QPixmap(QIcon::fromTheme(DEFAULT_ALBUM_ICON).pixmap(stdSize, stdSize)
+ theDefaultIcon = new QPixmap(Icon(DEFAULT_ALBUM_ICON).pixmap(stdSize, stdSize)
.scaled(QSize(cSize, cSize), Qt::KeepAspectRatio, Qt::SmoothTransformation));
}
if (!al->coverRequested && iSize && Song::SingleTracks!=al->type) {
@@ -276,7 +276,7 @@ QVariant AlbumsModel::data(const QModelIndex &index, int role) const
switch (role) {
case Qt::DecorationRole:
- return QIcon::fromTheme(Song::Playlist==si->type ? "view-media-playlist" : "audio-x-generic");
+ return Icon(Song::Playlist==si->type ? "view-media-playlist" : "audio-x-generic");
case Qt::ToolTipRole: {
quint32 year=si->parent->songs.count() ? si->parent->songs.at(0)->year : 0;
return si->parent->artist+QLatin1String("
")+
diff --git a/models/dirviewmodel.cpp b/models/dirviewmodel.cpp
index c28f0cde7..2e1c0164b 100644
--- a/models/dirviewmodel.cpp
+++ b/models/dirviewmodel.cpp
@@ -36,6 +36,7 @@
#include "settings.h"
#include "mpdconnection.h"
#include "debugtimer.h"
+#include "icon.h"
#ifdef ENABLE_KDE_SUPPORT
K_GLOBAL_STATIC(DirViewModel, instance)
@@ -160,9 +161,9 @@ QVariant DirViewModel::data(const QModelIndex &index, int role) const
switch (role) {
case Qt::DecorationRole: {
if (item->type() == DirViewItem::Type_Dir) {
- return QIcon::fromTheme("inode-directory");
+ return Icon("inode-directory");
} else if (item->type() == DirViewItem::Type_File) {
- return QIcon::fromTheme("audio-x-generic");
+ return Icon("audio-x-generic");
}
break;
}
diff --git a/models/musiclibraryitemalbum.cpp b/models/musiclibraryitemalbum.cpp
index 5163c7fb9..79685d370 100644
--- a/models/musiclibraryitemalbum.cpp
+++ b/models/musiclibraryitemalbum.cpp
@@ -31,7 +31,7 @@
#include "song.h"
#include "covers.h"
#include "config.h"
-#include
+#include "icon.h"
#include
#include
#include
@@ -168,7 +168,7 @@ const QPixmap & MusicLibraryItemAlbum::cover()
if (0==cSize) {
cSize=22;
}
- theDefaultIcon = new QPixmap(QIcon::fromTheme(DEFAULT_ALBUM_ICON).pixmap(cSize, cSize)
+ theDefaultIcon = new QPixmap(Icon(DEFAULT_ALBUM_ICON).pixmap(cSize, cSize)
.scaled(QSize(cSize, cSize), Qt::KeepAspectRatio, Qt::SmoothTransformation));
}
m_coverIsDefault = true;
diff --git a/models/musiclibraryitemartist.cpp b/models/musiclibraryitemartist.cpp
index e2b2e718b..b07219335 100644
--- a/models/musiclibraryitemartist.cpp
+++ b/models/musiclibraryitemartist.cpp
@@ -33,7 +33,7 @@
#include "mpdparseutils.h"
#include "localize.h"
#include "covers.h"
-#include
+#include "icon.h"
static QPixmap *theDefaultIcon=0;
@@ -93,8 +93,8 @@ const QPixmap & MusicLibraryItemArtist::cover()
}
if (m_various) {
- #ifdef ENABLE_KDE_SUPPORT
- QIcon icon(QIcon::fromTheme("cantata-view-media-artist-various"));
+ #if defined ENABLE_KDE_SUPPORT || defined CANTATA_ANDROID
+ QIcon icon=Icon("cantata-view-media-artist-various");
#else
QIcon icon(MusicLibraryModel::vaIcon());
#endif
@@ -102,7 +102,7 @@ const QPixmap & MusicLibraryItemArtist::cover()
m_coverIsDefault=false;
} else {
if (!theDefaultIcon) {
- theDefaultIcon = new QPixmap(QIcon::fromTheme("view-media-artist").pixmap(cSize, cSize)
+ theDefaultIcon = new QPixmap(Icon("view-media-artist").pixmap(cSize, cSize)
.scaled(QSize(cSize, cSize), Qt::KeepAspectRatio, Qt::SmoothTransformation));
}
m_coverIsDefault = true;
diff --git a/models/musiclibrarymodel.cpp b/models/musiclibrarymodel.cpp
index 8bc81cf88..d95c24882 100644
--- a/models/musiclibrarymodel.cpp
+++ b/models/musiclibrarymodel.cpp
@@ -40,6 +40,7 @@
#include "network.h"
#include "localize.h"
#include "utils.h"
+#include "icon.h"
#include
#include
#include
@@ -167,7 +168,7 @@ int MusicLibraryModel::columnCount(const QModelIndex &parent) const
}
}
-#ifndef ENABLE_KDE_SUPPORT
+#if !defined ENABLE_KDE_SUPPORT && !defined CANTATA_ANDROID
const QIcon & MusicLibraryModel::vaIcon()
{
static QIcon icon;
@@ -200,20 +201,20 @@ QVariant MusicLibraryModel::data(const QModelIndex &index, int role) const
if (artistImages) {
return artist->cover();
} else {
- #ifdef ENABLE_KDE_SUPPORT
- return QIcon::fromTheme(artist->isVarious() ? "cantata-view-media-artist-various" : "view-media-artist");
+ #if defined ENABLE_KDE_SUPPORT || defined CANTATA_ANDROID
+ return Icon(artist->isVarious() ? "cantata-view-media-artist-various" : "view-media-artist");
#else
- return artist->isVarious() ? vaIcon() : QIcon::fromTheme("view-media-artist");
+ return artist->isVarious() ? vaIcon() : Icon("view-media-artist");
#endif
}
}
case MusicLibraryItem::Type_Album:
if (MusicLibraryItemAlbum::CoverNone==MusicLibraryItemAlbum::currentCoverSize()) {
- return QIcon::fromTheme(DEFAULT_ALBUM_ICON);
+ return Icon(DEFAULT_ALBUM_ICON);
} else {
return static_cast(item)->cover();
}
- case MusicLibraryItem::Type_Song: return QIcon::fromTheme(Song::Playlist==static_cast(item)->song().type ? "view-media-playlist" : "audio-x-generic");
+ case MusicLibraryItem::Type_Song: return Icon(Song::Playlist==static_cast(item)->song().type ? "view-media-playlist" : "audio-x-generic");
default: return QVariant();
}
case Qt::DisplayRole:
diff --git a/models/musiclibrarymodel.h b/models/musiclibrarymodel.h
index a551e517b..adcf07e9e 100644
--- a/models/musiclibrarymodel.h
+++ b/models/musiclibrarymodel.h
@@ -70,7 +70,7 @@ public:
void removeCache();
void getDetails(QSet &artists, QSet &albumArtists, QSet &albums, QSet &genres);
- #ifndef ENABLE_KDE_SUPPORT
+ #if !defined ENABLE_KDE_SUPPORT && !defined CANTATA_ANDROID
static const QIcon & vaIcon();
#endif
bool update(const QSet &songs);
diff --git a/models/playlistsmodel.cpp b/models/playlistsmodel.cpp
index 7800cfb10..b026efce6 100644
--- a/models/playlistsmodel.cpp
+++ b/models/playlistsmodel.cpp
@@ -42,6 +42,7 @@ K_GLOBAL_STATIC(PlaylistsModel, instance)
#include "mpdconnection.h"
#include "playqueuemodel.h"
#include "debugtimer.h"
+#include "icon.h"
PlaylistsModel * PlaylistsModel::self()
{
@@ -198,7 +199,7 @@ QVariant PlaylistsModel::data(const QModelIndex &index, int role) const
: tr("%1\n1 Track (%2)").arg(pl->name).arg(Song::formattedTime(pl->totalTime())));
#endif
case Qt::DecorationRole:
- return QIcon::fromTheme("view-media-playlist");
+ return Icon("view-media-playlist");
case ItemView::Role_SubText:
#ifdef ENABLE_KDE_SUPPORT
return i18np("1 Track (%2)", "%1 Tracks (%2)", pl->songs.count(), Song::formattedTime(pl->totalTime()));
@@ -281,7 +282,7 @@ QVariant PlaylistsModel::data(const QModelIndex &index, int role) const
return text;
}
case Qt::DecorationRole:
- return QIcon::fromTheme(s->title.isEmpty() ? DEFAULT_STREAM_ICON : "audio-x-generic");
+ return Icon(s->title.isEmpty() ? DEFAULT_STREAM_ICON : "audio-x-generic");
case ItemView::Role_MainText:
return s->title.isEmpty() ? s->file : s->title;
case ItemView::Role_SubText:
@@ -708,9 +709,9 @@ void PlaylistsModel::updateItemMenu()
itemMenu->clear();
#ifdef ENABLE_KDE_SUPPORT
- itemMenu->addAction(QIcon::fromTheme("document-new"), i18n("New Playlist..."), this, SIGNAL(addToNew()));
+ itemMenu->addAction(Icon("document-new"), i18n("New Playlist..."), this, SIGNAL(addToNew()));
#else
- itemMenu->addAction(QIcon::fromTheme("document-new"), tr("New Playlist..."), this, SIGNAL(addToNew()));
+ itemMenu->addAction(Icon("document-new"), tr("New Playlist..."), this, SIGNAL(addToNew()));
#endif
QStringList names;
diff --git a/models/playqueuemodel.cpp b/models/playqueuemodel.cpp
index 45bd18b07..5983e5a4e 100644
--- a/models/playqueuemodel.cpp
+++ b/models/playqueuemodel.cpp
@@ -26,7 +26,6 @@
#include
#include
-#include
#include
#include
#include
@@ -45,6 +44,7 @@
#endif
#include "settings.h"
#include "debugtimer.h"
+#include "icon.h"
static QStringList reverseList(const QStringList &orig)
{
@@ -371,9 +371,9 @@ QVariant PlayQueueModel::data(const QModelIndex &index, int role) const
if (COL_STATUS==index.column() && songs.at(index.row()).id == currentSongId) {
switch (mpdState) {
case MPDState_Inactive:
- case MPDState_Stopped: return QIcon::fromTheme("media-playback-stop");
- case MPDState_Playing: return QIcon::fromTheme("media-playback-start");
- case MPDState_Paused: return QIcon::fromTheme("media-playback-pause");
+ case MPDState_Stopped: return Icon("media-playback-stop");
+ case MPDState_Playing: return Icon("media-playback-start");
+ case MPDState_Paused: return Icon("media-playback-pause");
}
}
break;
diff --git a/models/streamsmodel.cpp b/models/streamsmodel.cpp
index 2546aed69..ff17fd40a 100644
--- a/models/streamsmodel.cpp
+++ b/models/streamsmodel.cpp
@@ -32,8 +32,8 @@
#include
#include
#include
-#include
-#ifdef Q_OS_WIN
+#include "config.h"
+#if defined Q_OS_WIN || defined CANTATA_ANDROID
#include
#endif
#include "localize.h"
@@ -42,6 +42,7 @@
#include "playqueuemodel.h"
#include "mpdconnection.h"
#include "config.h"
+#include "icon.h"
const QLatin1String StreamsModel::constDefaultCategoryIcon("inode-directory");
const QLatin1String StreamsModel::constDefaultStreamIcon(DEFAULT_STREAM_ICON);
@@ -53,7 +54,7 @@ static bool iconIsValid(const QString &icon)
static QString configDir()
{
- #ifdef Q_OS_WIN
+ #if defined Q_OS_WIN || defined CANTATA_ANDROID
QString dir = QDesktopServices::storageLocation(QDesktopServices::DataLocation)+"/";
#else
QString env = qgetenv("XDG_CONFIG_HOME");
@@ -166,8 +167,8 @@ QVariant StreamsModel::data(const QModelIndex &index, int role) const
? tr("%1\n%2 Streams").arg(cat->name).arg(cat->streams.count())
: tr("%1\n1 Stream").arg(cat->name));
#endif
- case Qt::DecorationRole: return cat->icon.isEmpty() ? QIcon::fromTheme(constDefaultCategoryIcon)
- : cat->icon.startsWith('/') ? QIcon(cat->icon) : QIcon::fromTheme(cat->icon);
+ case Qt::DecorationRole: return cat->icon.isEmpty() ? Icon(constDefaultCategoryIcon)
+ : cat->icon.startsWith('/') ? QIcon(cat->icon) : Icon(cat->icon);
case ItemView::Role_SubText:
#ifdef ENABLE_KDE_SUPPORT
return i18np("1 Stream", "%1 Streams", cat->streams.count());
@@ -184,8 +185,8 @@ QVariant StreamsModel::data(const QModelIndex &index, int role) const
case Qt::DisplayRole: return stream->name;
case ItemView::Role_SubText:
case Qt::ToolTipRole: return stream->url;
- case Qt::DecorationRole: return stream->icon.isEmpty() ? QIcon::fromTheme(constDefaultStreamIcon)
- : stream->icon.startsWith('/') ? QIcon(stream->icon) : QIcon::fromTheme(stream->icon);
+ case Qt::DecorationRole: return stream->icon.isEmpty() ? Icon(constDefaultStreamIcon)
+ : stream->icon.startsWith('/') ? QIcon(stream->icon) : Icon(stream->icon);
default: break;
}
}
diff --git a/network/network.cpp b/network/network.cpp
index 571dd97bc..c2a44a83a 100644
--- a/network/network.cpp
+++ b/network/network.cpp
@@ -30,7 +30,7 @@
#include
#include
#include
-#ifdef Q_OS_WIN
+#if defined Q_OS_WIN || defined CANTATA_ANDROID
#include
#endif
#ifdef ENABLE_KDE_SUPPORT
@@ -40,7 +40,7 @@ K_GLOBAL_STATIC(Network, instance)
QString Network::cacheDir(const QString &sub, bool create)
{
- #ifdef Q_OS_WIN
+ #if defined Q_OS_WIN || defined CANTATA_ANDROID
QString dir = QDesktopServices::storageLocation(QDesktopServices::CacheLocation)+"/";
#else
QString env = qgetenv("XDG_CACHE_HOME");
diff --git a/widgets/actionitemdelegate.cpp b/widgets/actionitemdelegate.cpp
index 0f211482b..867c93fc2 100644
--- a/widgets/actionitemdelegate.cpp
+++ b/widgets/actionitemdelegate.cpp
@@ -23,32 +23,21 @@
#include "actionitemdelegate.h"
#include "itemview.h"
+#include "icon.h"
#include
#include
#include
-#include
int ActionItemDelegate::constBorder = 1;
int ActionItemDelegate::constActionBorder = 4;
-int ActionItemDelegate::constActionIconSize=16;
+int ActionItemDelegate::constActionIconSize = 16;
void ActionItemDelegate::setup()
{
int height=QApplication::fontMetrics().height();
if (height>17) {
- constActionIconSize=((int)(height/4))*4;
- if (constActionIconSize<20) {
- constActionIconSize=16;
- } else if (constActionIconSize<28) {
- constActionIconSize=22;
- } else if (constActionIconSize<40) {
- constActionIconSize=32;
- } else if (constActionIconSize<56) {
- constActionIconSize=48;
- } else {
- constActionIconSize=64;
- }
+ constActionIconSize=Icon::stdSize(((int)(height/4))*4);
constBorder=constActionIconSize>22 ? 2 : 1;
constActionBorder=constActionIconSize>32 ? 6 : 4;
} else {
@@ -177,7 +166,7 @@ void ActionItemDelegate::drawIcons(QPainter *painter, const QRect &r, bool mouse
if (act1 || act2) {
adjustActionRect(rtl, iconMode, actionRect);
}
- QPixmap pix=QIcon::fromTheme(iconName).pixmap(QSize(constActionIconSize, constActionIconSize));
+ QPixmap pix=Icon(iconName).pixmap(QSize(constActionIconSize, constActionIconSize));
if (!pix.isNull() && actionRect.width()>=pix.width()/* && r.x()>=0 && r.y()>=0*/) {
drawBgnd(painter, actionRect);
painter->drawPixmap(actionRect.x()+(actionRect.width()-pix.width())/2,
diff --git a/widgets/coverwidget.cpp b/widgets/coverwidget.cpp
index eb39ebee5..7e08d8e1c 100644
--- a/widgets/coverwidget.cpp
+++ b/widgets/coverwidget.cpp
@@ -25,8 +25,8 @@
#include "covers.h"
#include "config.h"
#include "localize.h"
+#include "icon.h"
#include
-#include
#include
#include
#include
@@ -58,7 +58,7 @@ const QPixmap & CoverWidget::stdPixmap(bool stream)
QPixmap &pix=stream ? noStreamCover : noCover;
if (pix.isNull()) {
- pix = QIcon::fromTheme(stream ? DEFAULT_STREAM_ICON : DEFAULT_ALBUM_ICON).pixmap(128, 128).scaled(size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
+ pix = Icon(stream ? DEFAULT_STREAM_ICON : DEFAULT_ALBUM_ICON).pixmap(128, 128).scaled(size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
}
return pix;
}
diff --git a/widgets/dialog.cpp b/widgets/dialog.cpp
index b35b3ae46..d45625569 100644
--- a/widgets/dialog.cpp
+++ b/widgets/dialog.cpp
@@ -22,9 +22,9 @@
*/
#include "dialog.h"
+#include "icon.h"
#include
#include
-#include
#include
static QDialogButtonBox::StandardButton mapType(int btn) {
@@ -110,7 +110,7 @@ void Dialog::setButtonGuiItem(ButtonCode button, const KGuiItem &item)
if (b) {
b->setText(item.text);
if (!item.icon.isEmpty()) {
- b->setIcon(QIcon::fromTheme(item.icon));
+ b->setIcon(Icon(item.icon));
}
}
}
diff --git a/widgets/dirrequester.cpp b/widgets/dirrequester.cpp
index b4ecb70e1..66a27082b 100644
--- a/widgets/dirrequester.cpp
+++ b/widgets/dirrequester.cpp
@@ -22,9 +22,9 @@
*/
#include "dirrequester.h"
+#include "icon.h"
#include
#include
-#include
DirRequester::DirRequester(QWidget *parent)
: QWidget(parent)
@@ -36,7 +36,7 @@ DirRequester::DirRequester(QWidget *parent)
layout->addWidget(edit);
layout->addWidget(button);
button->setAutoRaise(true);
- button->setIcon(QIcon::fromTheme("document-open"));
+ button->setIcon(Icon("document-open"));
connect(button, SIGNAL(clicked(bool)), SLOT(chooseDir()));
}
diff --git a/widgets/fancytabwidget.cpp b/widgets/fancytabwidget.cpp
index 91f7fad31..f3eaebe5e 100644
--- a/widgets/fancytabwidget.cpp
+++ b/widgets/fancytabwidget.cpp
@@ -35,6 +35,7 @@
#include "fancytabwidget.h"
#include "localize.h"
+#include "icon.h"
// #include "stylehelper.h"
// #include
@@ -65,6 +66,29 @@ using namespace Internal;
const int FancyTabBar::m_rounding = 22;
const int FancyTabBar::m_textPadding = 4;
+static int largeIconSize=32;
+static int smallIconSize=16;
+
+void FancyTabWidget::setup()
+{
+ int height=QApplication::fontMetrics().height();
+
+ if (height>22) {
+ largeIconSize=Icon::stdSize(height*2.5);
+ smallIconSize=16;
+ if (largeIconSize>32) {
+ if (largeIconSize<56) {
+ smallIconSize=22;
+ } else {
+ smallIconSize=32;
+ }
+ }
+ } else {
+ largeIconSize=32;
+ smallIconSize=16;
+ }
+}
+
#if 0
static QPainterPath createPath(const QRect &rect, double radius)
{
@@ -755,7 +779,7 @@ void FancyTabWidget::SetMode(Mode mode) {
case Mode_IconOnlySmallSidebar:
case Mode_IconOnlyLargeSidebar:
case Mode_LargeSidebar: {
- FancyTabBar* bar = new FancyTabBar(this, drawBorder_, Mode_LargeSidebar==mode, Mode_IconOnlySmallSidebar==mode ? 16 : 32);
+ FancyTabBar* bar = new FancyTabBar(this, drawBorder_, Mode_LargeSidebar==mode, Mode_IconOnlySmallSidebar==mode ? smallIconSize : largeIconSize);
side_layout_->insertWidget(0, bar);
tab_bar_ = bar;
diff --git a/widgets/fancytabwidget.h b/widgets/fancytabwidget.h
index 8804ad28b..90be37b46 100644
--- a/widgets/fancytabwidget.h
+++ b/widgets/fancytabwidget.h
@@ -157,6 +157,9 @@ class FancyTabWidget : public QWidget {
Q_OBJECT
public:
+
+ static void setup();
+
FancyTabWidget(QWidget *parent, bool allowContext=true, bool drawBorder=false);
// Values are persisted - only add to the end
diff --git a/widgets/groupedview.cpp b/widgets/groupedview.cpp
index 1d8af823c..93d4359d0 100644
--- a/widgets/groupedview.cpp
+++ b/widgets/groupedview.cpp
@@ -29,6 +29,7 @@
#include "itemview.h"
#include "config.h"
#include "localize.h"
+#include "icon.h"
#include
#include
#include
@@ -289,7 +290,7 @@ public:
pix=index.data(Qt::DecorationRole).value().pixmap(constCoverSize, constCoverSize);
} else {
QPixmap *cover=Covers::self()->get(song, constCoverSize);
- pix=cover ? *cover : QIcon::fromTheme(stream ? DEFAULT_STREAM_ICON : DEFAULT_ALBUM_ICON).pixmap(constCoverSize, constCoverSize);
+ pix=cover ? *cover : Icon(stream ? DEFAULT_STREAM_ICON : DEFAULT_ALBUM_ICON).pixmap(constCoverSize, constCoverSize);
}
if (rtl) {
diff --git a/widgets/icon.cpp b/widgets/icon.cpp
new file mode 100644
index 000000000..95c82802a
--- /dev/null
+++ b/widgets/icon.cpp
@@ -0,0 +1,84 @@
+/*
+ * Cantata
+ *
+ * Copyright (c) 2011-2012 Craig Drummond
+ *
+ * ----
+ *
+ * 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; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "icon.h"
+int Icon::stdSize(int v)
+{
+ if (v<20) {
+ return 16;
+ } else if (v<28) {
+ return 22;
+ } else if (v<40) {
+ return 32;
+ } else if (v<56) {
+ return 48;
+ } else if (v<90) {
+ return 64;
+ } else {
+ return 128;
+ }
+}
+#if !defined ENABLE_KDE_SUPPORT && !defined CANTATA_ANDROID
+#include
+
+QIcon Icon::getMediaIcon(const char *name)
+{
+ static QList modes=QList() << QIcon::Normal << QIcon::Disabled << QIcon::Active << QIcon::Selected;
+ QIcon icn;
+ QIcon icon=QIcon::fromTheme(name);
+
+ foreach (QIcon::Mode mode, modes) {
+ icn.addPixmap(icon.pixmap(QSize(64, 64), mode).scaled(QSize(28, 28), Qt::KeepAspectRatio, Qt::SmoothTransformation), mode);
+ icn.addPixmap(icon.pixmap(QSize(22, 22), mode), mode);
+ }
+
+ return icn;
+}
+
+void Icon::setupIconTheme()
+{
+ // Check that we have certain icons in the selected icon theme. If not, and oxygen is installed, then
+ // set icon theme to oxygen.
+ QString theme=QIcon::themeName();
+ if (QLatin1String("oxygen")!=theme) {
+ QStringList check=QStringList() << "actions/edit-clear-list" << "actions/view-media-playlist"
+ << "actions/view-media-lyrics" << "actions/configure"
+ << "actions/view-choose" << "actions/view-media-artist"
+ << "places/server-database" << "devices/media-optical-audio";
+
+ foreach (const QString &icn, check) {
+ if (!QIcon::hasThemeIcon(icn)) {
+ QStringList paths=QIcon::themeSearchPaths();
+
+ foreach (const QString &p, paths) {
+ if (QDir(p+QLatin1String("/oxygen")).exists()) {
+ QIcon::setThemeName(QLatin1String("oxygen"));
+ return;
+ }
+ }
+ return;
+ }
+ }
+ }
+}
+#endif
diff --git a/widgets/icon.h b/widgets/icon.h
new file mode 100644
index 000000000..b06d46e22
--- /dev/null
+++ b/widgets/icon.h
@@ -0,0 +1,55 @@
+/*
+ * Cantata
+ *
+ * Copyright (c) 2011-2012 Craig Drummond
+ *
+ * ----
+ *
+ * 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; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef ICON_H
+#define ICON_H
+
+#ifdef ENABLE_KDE_SUPPORT
+#include
+#define Icon(X) KIcon(X)
+#define MediaIcon(X) KIcon(X)
+namespace Icon
+{
+ extern int stdSize(int s);
+}
+#elif defined CANTATA_ANDROID
+#include
+#define Icon(X) QIcon(QLatin1String(":/")+(X))
+#define MediaIcon(X) Icon(X)
+namespace Icon
+{
+ extern int stdSize(int s);
+}
+#else
+#include
+#define Icon(X) QIcon::fromTheme(X)
+#define MediaIcon(X) Icon::getMediaIcon(X)
+namespace Icon
+{
+ extern QIcon getMediaIcon(const char *name);
+ extern void setupIconTheme();
+ extern int stdSize(int s);
+}
+#endif
+
+#endif
diff --git a/widgets/itemview.cpp b/widgets/itemview.cpp
index 1f7c128d6..513557c73 100644
--- a/widgets/itemview.cpp
+++ b/widgets/itemview.cpp
@@ -28,7 +28,7 @@
#include "proxymodel.h"
#include "actionitemdelegate.h"
#include "localize.h"
-#include
+#include "icon.h"
#include
#include
#include
@@ -47,6 +47,22 @@
#define SINGLE_CLICK style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, 0, this)
#endif
+static int listDecorationSize=22;
+static int treeDecorationSize=16;
+
+void ItemView::setup()
+{
+ int height=QApplication::fontMetrics().height();
+
+ if (height>22) {
+ listDecorationSize=Icon::stdSize(height*1.4);
+ treeDecorationSize=Icon::stdSize(height);
+ } else {
+ listDecorationSize=22;
+ treeDecorationSize=16;
+ }
+}
+
EscapeKeyEventHandler::EscapeKeyEventHandler(QAbstractItemView *v, QAction *a)
: QObject(v)
, view(v)
@@ -147,8 +163,9 @@ static inline double subTextAlpha(bool selected)
class ListDelegate : public ActionItemDelegate
{
public:
- ListDelegate(QAbstractItemView *p, QAction *a1, QAction *a2, QAction *t, int actionLevel)
+ ListDelegate(ListView *v, QAbstractItemView *p, QAction *a1, QAction *a2, QAction *t, int actionLevel)
: ActionItemDelegate(p, a1, a2, t, actionLevel)
+ , view(v)
{
}
@@ -165,7 +182,7 @@ public:
imageSize=constImageSize;
}
- if (imageSize>50) { // Icon Mode!
+ if (view && QListView::IconMode==view->viewMode()) {
int textHeight = QApplication::fontMetrics().height()*2;
return QSize(imageSize + (constBorder * 2), textHeight+imageSize + (constBorder*2));
} else {
@@ -208,9 +225,9 @@ public:
image = index.data(Qt::DecorationRole);
}
- QPixmap pix = QVariant::Pixmap==image.type() ? image.value() : image.value().pixmap(imageSize, imageSize);
+ QPixmap pix = QVariant::Pixmap==image.type() ? image.value() : image.value().pixmap(listDecorationSize, listDecorationSize);
bool oneLine = childText.isEmpty();
- bool iconMode = imageSize>50;
+ bool iconMode = view && QListView::IconMode==view->viewMode();
bool rtl = Qt::RightToLeft==QApplication::layoutDirection();
painter->save();
@@ -308,13 +325,16 @@ public:
painter->restore();
}
+
+private:
+ ListView *view;
};
class TreeDelegate : public ListDelegate
{
public:
TreeDelegate(QAbstractItemView *p, QAction *a1, QAction *a2, QAction *t, int actionLevel)
- : ListDelegate(p, a1, a2, t, actionLevel)
+ : ListDelegate(0, p, a1, a2, t, actionLevel)
{
}
@@ -354,7 +374,7 @@ public:
QRect r(option.rect);
r.adjust(4, 0, -4, 0);
- QPixmap pix=index.data(Qt::DecorationRole).value().pixmap(constActionIconSize, constActionIconSize);
+ QPixmap pix=index.data(Qt::DecorationRole).value().pixmap(treeDecorationSize, treeDecorationSize);
if (!pix.isNull()) {
int adjust=qMax(pix.width(), pix.height());
if (rtl) {
@@ -419,7 +439,7 @@ ItemView::ItemView(QWidget *p)
{
setupUi(this);
backAction = new QAction(i18n("Back"), this);
- backAction->setIcon(QIcon::fromTheme("go-previous"));
+ backAction->setIcon(Icon("go-previous"));
backButton->setDefaultAction(backAction);
backButton->setAutoRaise(true);
treeView->setPageDefaults();
@@ -456,7 +476,7 @@ void ItemView::init(QAction *a1, QAction *a2, QAction *t, int actionLevel)
act2=a2;
toggle=t;
actLevel=actionLevel;
- listView->setItemDelegate(new ListDelegate(listView, a1, a2, toggle, actionLevel));
+ listView->setItemDelegate(new ListDelegate(listView, listView, a1, a2, toggle, actionLevel));
treeView->setItemDelegate(new TreeDelegate(treeView, a1, a2, toggle, actionLevel));
if (groupedView) {
groupedView->init(0, 0, 0, 0); // No actions in grouped view :-(
diff --git a/widgets/itemview.h b/widgets/itemview.h
index d2bded01f..36265c047 100644
--- a/widgets/itemview.h
+++ b/widgets/itemview.h
@@ -85,6 +85,7 @@ class ItemView : public QWidget, public Ui::ItemView
{
Q_OBJECT
public:
+
enum Mode
{
Mode_Tree,
@@ -107,6 +108,8 @@ public:
Role_Search
};
+ static void setup();
+
ItemView(QWidget *p);
virtual ~ItemView();
diff --git a/widgets/kmessagewidget.cpp b/widgets/kmessagewidget.cpp
index 9ee50b9c8..89cb545dc 100644
--- a/widgets/kmessagewidget.cpp
+++ b/widgets/kmessagewidget.cpp
@@ -29,7 +29,7 @@
#include
#endif
-#include
+#include "icon.h"
#include
#include
#include
@@ -95,7 +95,7 @@ void KMessageWidgetPrivate::init(KMessageWidget *q_ptr)
KAction* closeAction = KStandardAction::close(q, SLOT(animatedHide()), q);
#else
QAction* closeAction = new QAction(q);
- closeAction->setIcon(QIcon::fromTheme("dialog-close"));
+ closeAction->setIcon(Icon("dialog-close"));
QObject::connect(closeAction, SIGNAL(triggered()), q, SLOT(animatedHide()));
#endif
@@ -288,31 +288,31 @@ void KMessageWidget::setMessageType(KMessageWidget::MessageType type)
QColor text;
switch (type) {
// case PositiveMessageType:
-// icon = QIcon::fromTheme("dialog-ok");
+// icon = Icon("dialog-ok");
// bgRole = KColorScheme::PositiveBackground;
// fgRole = KColorScheme::PositiveText;
// break;
case Information:
- d->iconLabel->setPixmap(QIcon::fromTheme("dialog-information").pixmap(22, 22));
+ d->iconLabel->setPixmap(Icon("dialog-information").pixmap(22, 22));
border=Qt::blue;
bgnd=QColor(0xa5, 0xc1, 0xe4);
text=Qt::black;
break;
// case WarningMessageType:
-// icon = QIcon::fromTheme("dialog-warning");
+// icon = Icon("dialog-warning");
// bgRole = KColorScheme::NeutralBackground;
// fgRole = KColorScheme::NeutralText;
// break;
default:
case Error:
- d->iconLabel->setPixmap(QIcon::fromTheme("dialog-error").pixmap(22, 22));
+ d->iconLabel->setPixmap(Icon("dialog-error").pixmap(22, 22));
border=Qt::red;
bgnd=QColor(0xeb, 0xbb, 0xbb);
text=Qt::black;
break;
}
-// const int size = QIcon::fromThemeLoader::global()->currentSize(QIcon::fromThemeLoader::MainToolbar);
+// const int size = IconLoader::global()->currentSize(IconLoader::MainToolbar);
// KColorScheme scheme(QPalette::Active, colorSet);
// QBrush bg = scheme.background(bgRole);
diff --git a/widgets/lineedit.cpp b/widgets/lineedit.cpp
index c1121b447..464f42e4b 100644
--- a/widgets/lineedit.cpp
+++ b/widgets/lineedit.cpp
@@ -31,15 +31,15 @@
****************************************************************************/
#include "lineedit.h"
+#include "icon.h"
#include
#include
-#include
LineEdit::LineEdit(QWidget *parent)
: QLineEdit(parent)
{
clearButton = new QToolButton(this);
- QPixmap pixmap(QIcon::fromTheme(Qt::RightToLeft==layoutDirection() ? "edit-clear-locationbar-ltr" : "edit-clear-locationbar-rtl").pixmap(16, 16));
+ QPixmap pixmap(Icon(Qt::RightToLeft==layoutDirection() ? "edit-clear-locationbar-ltr" : "edit-clear-locationbar-rtl").pixmap(16, 16));
clearButton->setIcon(QIcon(pixmap));
clearButton->setIconSize(pixmap.size());
clearButton->setCursor(Qt::ArrowCursor);
diff --git a/widgets/listview.cpp b/widgets/listview.cpp
index 506f584ac..4f03833fb 100644
--- a/widgets/listview.cpp
+++ b/widgets/listview.cpp
@@ -23,9 +23,9 @@
#include "listview.h"
#include "config.h"
+#include "icon.h"
#include
#include
-#include
#include
ListView::ListView(QWidget *parent)
@@ -79,7 +79,7 @@ void ListView::startDrag(Qt::DropActions supportedActions)
QDrag *drag = new QDrag(this);
drag->setMimeData(data);
if (indexes.count()>1) {
- drag->setPixmap(QIcon::fromTheme(DEFAULT_ALBUM_ICON).pixmap(64, 64));
+ drag->setPixmap(Icon(DEFAULT_ALBUM_ICON).pixmap(64, 64));
} else {
drag->setPixmap(QPixmap::fromImage(model()->data(indexes.first(), Qt::DecorationRole).value()
.scaled(QSize(64, 64), Qt::KeepAspectRatio, Qt::SmoothTransformation)));
diff --git a/widgets/messagebox.cpp b/widgets/messagebox.cpp
index 58d0adbee..5d6e3456a 100644
--- a/widgets/messagebox.cpp
+++ b/widgets/messagebox.cpp
@@ -22,8 +22,8 @@
*/
#include "messagebox.h"
+#include "icon.h"
#include
-#include
MessageBox::ButtonCode map(QMessageBox::StandardButton c)
{
@@ -54,14 +54,14 @@ MessageBox::ButtonCode MessageBox::questionYesNoCancel(QWidget *parent, const QS
QAbstractButton *btn=box.button(QMessageBox::Yes);
btn->setText(yesText.text);
if (!yesText.icon.isEmpty()) {
- btn->setIcon(QIcon::fromTheme(yesText.icon));
+ btn->setIcon(Icon(yesText.icon));
}
}
if (!noText.text.isEmpty()) {
QAbstractButton *btn=box.button(QMessageBox::No);
btn->setText(noText.text);
if (!noText.icon.isEmpty()) {
- btn->setIcon(QIcon::fromTheme(noText.icon));
+ btn->setIcon(Icon(noText.icon));
}
}
return -1==box.exec() ? Cancel : map(box.standardButton(box.clickedButton()));
diff --git a/widgets/togglebutton.cpp b/widgets/togglebutton.cpp
new file mode 100644
index 000000000..67717934a
--- /dev/null
+++ b/widgets/togglebutton.cpp
@@ -0,0 +1,67 @@
+/*
+ * Cantata
+ *
+ * Copyright (c) 2011-2012 Craig Drummond
+ *
+ * ----
+ *
+ * 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; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "togglebutton.h"
+#include
+#include
+#include
+#include
+#include
+#include
+
+ToggleButton::ToggleButton(QWidget *parent)
+ : QToolButton(parent)
+{
+ setAutoRaise(true);
+}
+
+ToggleButton::~ToggleButton()
+{
+}
+
+void ToggleButton::paintEvent(QPaintEvent *e)
+{
+ Q_UNUSED(e)
+ if (isChecked()) {
+ QPainter p(this);
+ QRect rx(rect());
+ QRectF r(rx.x()+0.5, rx.y()+0.5, rx.width()-1, rx.height()-1);
+ QPainterPath path;
+// QColor c(palette().color(QPalette::Active, QPalette::Highlight));
+ QColor borderCol(palette().color(QPalette::Active, QPalette::WindowText));
+
+ path.addEllipse(r);
+ p.setRenderHint(QPainter::Antialiasing, true);
+// c.setAlphaF(0.50);
+// p.fillPath(path, c);
+ borderCol.setAlphaF(0.75);
+ p.setPen(QPen(borderCol, 1.5));
+ p.drawPath(path);
+ }
+
+ QStylePainter sp(this);
+ QStyleOptionToolButton opt;
+
+ initStyleOption(&opt);
+ sp.drawControl(QStyle::CE_ToolButtonLabel, opt);
+}
diff --git a/widgets/togglebutton.h b/widgets/togglebutton.h
new file mode 100644
index 000000000..c75761881
--- /dev/null
+++ b/widgets/togglebutton.h
@@ -0,0 +1,50 @@
+/*
+ * Cantata
+ *
+ * Copyright (c) 2011-2012 Craig Drummond
+ *
+ * ----
+ *
+ * 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; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef TOGGLE_BUTTON_H
+#define TOGGLE_BUTTON_H
+
+#include "config.h"
+
+#ifdef ENABLE_KDE_SUPPORT
+#include
+typedef QToolButton ToggleButton;
+
+#else // ENABLE_KDE_SUPPORT
+
+#include
+#ifdef CANTATA_ANDROID
+class ToggleButton : public QToolButton
+{
+public:
+ ToggleButton(QWidget *parent);
+ virtual ~ToggleButton();
+ void paintEvent(QPaintEvent *e);
+};
+#else // CANTATA_ANDROID
+typedef QToolButton ToggleButton;
+#endif // CANTATA_ANDROID
+
+#endif // ENABLE_KDE_SUPPORT
+
+#endif