From: Flavio Date: Tue, 8 Jan 2013 15:21:20 +0000 (+0100) Subject: Removed icon loader X-Git-Tag: 2.0~38 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3f55b39d3e809753bf3863ccc183ddfdb6df7b09;p=minitube Removed icon loader --- diff --git a/minitube.pro b/minitube.pro index e229cce..e15b75b 100644 --- a/minitube.pro +++ b/minitube.pro @@ -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/ diff --git a/src/main.cpp b/src/main.cpp index 3513dba..05d1e3b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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 }; diff --git a/src/playlistitemdelegate.cpp b/src/playlistitemdelegate.cpp index 6800f99..4cc36f9 100644 --- a/src/playlistitemdelegate.cpp +++ b/src/playlistitemdelegate.cpp @@ -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(); } diff --git a/src/sidebarheader.cpp b/src/sidebarheader.cpp index fb7dce6..a2fc787 100644 --- a/src/sidebarheader.cpp +++ b/src/sidebarheader.cpp @@ -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 index 0000000..19a9a4a --- /dev/null +++ b/src/utils.cpp @@ -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 index 0000000..af3115b --- /dev/null +++ b/src/utils.h @@ -0,0 +1,16 @@ +#ifndef UTILS_H +#define UTILS_H + +#include + +class Utils { + +public: + static QIcon icon(const QString &name); + +private: + Utils() { } + +}; + +#endif // UTILS_H