]> git.sur5r.net Git - minitube/commitdiff
Removed icon loader
authorFlavio <flavio@odisseo.local>
Tue, 8 Jan 2013 15:21:20 +0000 (16:21 +0100)
committerFlavio <flavio@odisseo.local>
Tue, 8 Jan 2013 15:21:20 +0000 (16:21 +0100)
minitube.pro
src/main.cpp
src/playlistitemdelegate.cpp
src/sidebarheader.cpp
src/utils.cpp [new file with mode: 0644]
src/utils.h [new file with mode: 0644]

index e229cce4a17c953dcf401adf7f3a16d58d27e5bc..e15b75b7c0645f4421cc6fe18ffd7d2123a476fe 100644 (file)
@@ -22,7 +22,6 @@ HEADERS += \
     src/urllineedit.h \
     src/spacer.h \
     src/constants.h \
-    src/iconloader/qticonloader.h \
     src/playlistitemdelegate.h \
     src/networkaccess.h \
     src/videomimedata.h \
@@ -70,13 +69,13 @@ HEADERS += \
     src/videosourcewidget.h \
     src/regionsview.h \
     src/ytsinglevideosource.h \
-    src/sidebarheader.h
+    src/sidebarheader.h \
+    src/utils.h
 SOURCES += src/main.cpp \
     src/searchlineedit.cpp \
     src/urllineedit.cpp \
     src/spacer.cpp \
     src/video.cpp \
-    src/iconloader/qticonloader.cpp \
     src/videomimedata.cpp \
     src/updatechecker.cpp \
     src/networkaccess.cpp \
@@ -122,7 +121,8 @@ SOURCES += src/main.cpp \
     src/videosourcewidget.cpp \
     src/regionsview.cpp \
     src/ytsinglevideosource.cpp \
-    src/sidebarheader.cpp
+    src/sidebarheader.cpp \
+    src/utils.cpp
 RESOURCES += resources.qrc
 DESTDIR = build/target/
 OBJECTS_DIR = build/obj/
index 3513dbaa774f5fb1f9b9e8e0796320eb05a185c2..05d1e3be051f27a1dab1ae436885df28e00ba8a3 100644 (file)
@@ -3,7 +3,7 @@
 #include "constants.h"
 #include "mainwindow.h"
 #include "searchparams.h"
-#include "iconloader/qticonloader.h"
+#include "utils.h"
 #ifndef Q_WS_X11
 #include "extra.h"
 #endif
@@ -76,7 +76,7 @@ int main(int argc, char **argv) {
 #ifndef APP_MAC
     QIcon appIcon;
     if (QDir(dataDir).exists()) {
-        appIcon = QtIconLoader::icon(Constants::UNIX_NAME);
+        appIcon = Utils::icon(Constants::UNIX_NAME);
     } else {
         dataDir = qApp->applicationDirPath() + "/data";
         const int iconSizes [] = { 16, 22, 32, 48, 64, 128, 256, 512 };
index 6800f9962dc17bf26779900d8cc7b260a57bba9f..4cc36f9a5d06f78d406c1a711549c5051d9dbbd4 100644 (file)
@@ -2,7 +2,7 @@
 #include "playlistmodel.h"
 #include "fontutils.h"
 #include "downloaditem.h"
-#include "iconloader/qticonloader.h"
+#include "utils.h"
 #include "videodefinition.h"
 #include "video.h"
 
@@ -333,7 +333,7 @@ void PlaylistItemDelegate::paintDownloadInfo( QPainter* painter,
     if (status != Finished && status != Failed && status != Idle) {
         if (downloadButtonHovered) message = tr("Stop downloading");
         painter->save();
-        QIcon closeIcon = QtIconLoader::icon("window-close");
+        QIcon closeIcon = Utils::icon("window-close");
         painter->drawPixmap(downloadButtonRect(line), closeIcon.pixmap(16, 16, iconMode));
         painter->restore();
     }
@@ -346,7 +346,7 @@ void PlaylistItemDelegate::paintDownloadInfo( QPainter* painter,
         message = tr("Open parent folder");
 #endif
         painter->save();
-        QIcon searchIcon = QtIconLoader::icon("system-search");
+        QIcon searchIcon = Utils::icon("system-search");
         painter->drawPixmap(downloadButtonRect(line), searchIcon.pixmap(16, 16, iconMode));
         painter->restore();
     }
@@ -354,7 +354,7 @@ void PlaylistItemDelegate::paintDownloadInfo( QPainter* painter,
     else if (status == Failed || status == Idle) {
         if (downloadButtonHovered) message = tr("Restart downloading");
         painter->save();
-        QIcon searchIcon = QtIconLoader::icon("view-refresh");
+        QIcon searchIcon = Utils::icon("view-refresh");
         painter->drawPixmap(downloadButtonRect(line), searchIcon.pixmap(16, 16, iconMode));
         painter->restore();
     }
index fb7dce654231129670ce2b8b8cd123851137284b..a2fc787a806853c2d91c519cead3566fb2aef99d 100644 (file)
@@ -1,5 +1,5 @@
 #include "sidebarheader.h"
-#include "iconloader/qticonloader.h"
+#include "utils.h"
 #include "mediaview.h"
 #include "videosource.h"
 #include "fontutils.h"
@@ -12,13 +12,13 @@ void SidebarHeader::setup() {
     isSetup = true;
 
     backAction = new QAction(
-                QtIconLoader::icon("go-previous"),
+                Utils::icon("go-previous"),
                 tr("&Back"), this);
     connect(backAction, SIGNAL(triggered()), MediaView::instance(), SLOT(goBack()));
     addAction(backAction);
 
     forwardAction = new QAction(
-                QtIconLoader::icon("go-next"),
+                Utils::icon("go-next"),
                 tr("&Back"), this);
     connect(forwardAction, SIGNAL(triggered()), MediaView::instance(), SLOT(goForward()));
     addAction(forwardAction);
diff --git a/src/utils.cpp b/src/utils.cpp
new file mode 100644 (file)
index 0000000..19a9a4a
--- /dev/null
@@ -0,0 +1,12 @@
+#include "utils.h"
+#ifndef Q_WS_X11
+#include "extra.h"
+#endif
+
+QIcon Utils::icon(const QString &name) {
+#ifdef Q_WS_X11
+    return QIcon::fromTheme(name);
+#else
+    return Extra::getIcon(name);
+#endif
+}
diff --git a/src/utils.h b/src/utils.h
new file mode 100644 (file)
index 0000000..af3115b
--- /dev/null
@@ -0,0 +1,16 @@
+#ifndef UTILS_H
+#define UTILS_H
+
+#include <QtCore>
+
+class Utils {
+
+public:
+    static QIcon icon(const QString &name);
+
+private:
+    Utils() { }
+
+};
+
+#endif // UTILS_H