]> git.sur5r.net Git - minitube/commitdiff
Always rely on native icons on X11
authorFlavio Tordini <flavio.tordini@gmail.com>
Sun, 25 Jul 2010 15:17:00 +0000 (17:17 +0200)
committerFlavio Tordini <flavio.tordini@gmail.com>
Sun, 25 Jul 2010 15:17:00 +0000 (17:17 +0200)
14 files changed:
Info.plist [deleted file]
images/media-playback-pause.png [deleted file]
images/media-playback-start.png [deleted file]
images/media-playback-stop.png [deleted file]
images/media-skip-forward.png [deleted file]
images/view-fullscreen.png [deleted file]
minitube.icns [deleted file]
minitube.ico [deleted file]
minitube.rc [deleted file]
resources.qrc
src/Constants.h [deleted file]
src/MainWindow.cpp
src/iconloader/qticonloader.cpp
src/iconloader/qticonloader.h

diff --git a/Info.plist b/Info.plist
deleted file mode 100644 (file)
index 27b03c3..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-       <key>CFBundleName</key>
-       <string>Minitube</string>
-       <key>CFBundleIconFile</key>
-       <string>minitube.icns</string>
-       <key>CFBundlePackageType</key>
-       <string>APPL</string>
-       <key>CFBundleGetInfoString</key>
-       <string>Copyright 2009 Flavio Tordini</string>
-       <key>CFBundleExecutable</key>
-       <string>minitube</string>
-       <key>CFBundleIdentifier</key>
-       <string>org.tordini.flavio.minitube</string>
-</dict>
-</plist>
diff --git a/images/media-playback-pause.png b/images/media-playback-pause.png
deleted file mode 100644 (file)
index 2faccc2..0000000
Binary files a/images/media-playback-pause.png and /dev/null differ
diff --git a/images/media-playback-start.png b/images/media-playback-start.png
deleted file mode 100644 (file)
index c933f11..0000000
Binary files a/images/media-playback-start.png and /dev/null differ
diff --git a/images/media-playback-stop.png b/images/media-playback-stop.png
deleted file mode 100644 (file)
index e4fb4bd..0000000
Binary files a/images/media-playback-stop.png and /dev/null differ
diff --git a/images/media-skip-forward.png b/images/media-skip-forward.png
deleted file mode 100644 (file)
index 704ca17..0000000
Binary files a/images/media-skip-forward.png and /dev/null differ
diff --git a/images/view-fullscreen.png b/images/view-fullscreen.png
deleted file mode 100644 (file)
index c859ce4..0000000
Binary files a/images/view-fullscreen.png and /dev/null differ
diff --git a/minitube.icns b/minitube.icns
deleted file mode 100644 (file)
index 0053278..0000000
Binary files a/minitube.icns and /dev/null differ
diff --git a/minitube.ico b/minitube.ico
deleted file mode 100644 (file)
index 9a3acbe..0000000
Binary files a/minitube.ico and /dev/null differ
diff --git a/minitube.rc b/minitube.rc
deleted file mode 100644 (file)
index 2c1795b..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-IDI_ICON1               ICON    DISCARDABLE     "minitube.ico"
-
index 639421ad2d63d57aca4b09cff97160b7632035d4..53d1d4dc5197f2765e27ca8784b533d7145e6be2 100755 (executable)
@@ -1,10 +1,5 @@
 <RCC>
     <qresource prefix="/">
         <file>images/app.png</file>
-        <file>images/view-fullscreen.png</file>
-        <file>images/media-playback-pause.png</file>
-        <file>images/media-playback-start.png</file>
-        <file>images/media-playback-stop.png</file>
-        <file>images/media-skip-forward.png</file>
     </qresource>
 </RCC>
diff --git a/src/Constants.h b/src/Constants.h
deleted file mode 100755 (executable)
index 8ba79e8..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef CONSTANTS_H
-#define CONSTANTS_H
-
-#include <QString>
-
-namespace Constants {
-    static const char *VERSION = "1.0";
-    static const char *APP_NAME = "Minitube";
-    static const char *ORG_NAME = "Flavio Tordini";
-    static const char *ORG_DOMAIN = "flavio.tordini.org";
-    static const char *WEBSITE = "http://flavio.tordini.org/minitube";
-    static const char *EMAIL = "flavio.tordini@gmail.com";
-    static const QString USER_AGENT = QString(APP_NAME) + " " + VERSION + " (" + WEBSITE + ")";
-}
-
-#endif
index b785fc1d06e7e9e7832a3ae24bb24b94756d2d52..d01d9e05930dbd7e7e6afec9f8ac874f581dc7a7 100755 (executable)
@@ -77,27 +77,27 @@ void MainWindow::createActions() {
 
     QMap<QString, QAction*> *actions = The::globalActions();
 
-    stopAct = new QAction(QtIconLoader::icon("media-playback-stop", QIcon(":/images/media-playback-stop.png")), tr("&Stop"), this);
+    stopAct = new QAction(QtIconLoader::icon("media-playback-stop"), tr("&Stop"), this);
     stopAct->setStatusTip(tr("Stop playback and go back to the search view"));
     stopAct->setShortcuts(QList<QKeySequence>() << QKeySequence(Qt::Key_Escape) << QKeySequence(Qt::Key_MediaStop));
     actions->insert("stop", stopAct);
     connect(stopAct, SIGNAL(triggered()), this, SLOT(stop()));
 
-    skipAct = new QAction(QtIconLoader::icon("media-skip-forward", QIcon(":/images/media-skip-forward.png")), tr("S&kip"), this);
+    skipAct = new QAction(QtIconLoader::icon("media-skip-forward"), tr("S&kip"), this);
     skipAct->setStatusTip(tr("Skip to the next video"));
     skipAct->setShortcuts(QList<QKeySequence>() << QKeySequence(Qt::CTRL + Qt::Key_Right) << QKeySequence(Qt::Key_MediaNext));
     skipAct->setEnabled(false);
     actions->insert("skip", skipAct);
     connect(skipAct, SIGNAL(triggered()), mediaView, SLOT(skip()));
 
-    pauseAct = new QAction(QtIconLoader::icon("media-playback-pause", QIcon(":/images/media-playback-pause.png")), tr("&Pause"), this);
+    pauseAct = new QAction(QtIconLoader::icon("media-playback-pause"), tr("&Pause"), this);
     pauseAct->setStatusTip(tr("Pause playback"));
     pauseAct->setShortcuts(QList<QKeySequence>() << QKeySequence(Qt::Key_Space) << QKeySequence(Qt::Key_MediaPlay));
     pauseAct->setEnabled(false);
     actions->insert("pause", pauseAct);
     connect(pauseAct, SIGNAL(triggered()), mediaView, SLOT(pause()));
 
-    fullscreenAct = new QAction(QtIconLoader::icon("view-fullscreen", QIcon(":/images/view-fullscreen.png")), tr("&Full Screen"), this);
+    fullscreenAct = new QAction(QtIconLoader::icon("view-fullscreen"), tr("&Full Screen"), this);
     fullscreenAct->setStatusTip(tr("Go full screen"));
     fullscreenAct->setShortcut(QKeySequence(Qt::ALT + Qt::Key_Return));
     fullscreenAct->setShortcutContext(Qt::ApplicationShortcut);
@@ -522,7 +522,7 @@ void MainWindow::stateChanged(Phonon::State newState, Phonon::State /* oldState
 
          case Phonon::PlayingState:
         pauseAct->setEnabled(true);
-        pauseAct->setIcon(QtIconLoader::icon("media-playback-pause", QIcon(":/images/media-playback-pause.png")));
+        pauseAct->setIcon(QtIconLoader::icon("media-playback-pause"));
         pauseAct->setText(tr("&Pause"));
         pauseAct->setStatusTip(tr("Pause playback") + " (" +  pauseAct->shortcut().toString(QKeySequence::NativeText) + ")");
         skipAct->setEnabled(true);
@@ -536,7 +536,7 @@ void MainWindow::stateChanged(Phonon::State newState, Phonon::State /* oldState
          case Phonon::PausedState:
         skipAct->setEnabled(true);
         pauseAct->setEnabled(true);
-        pauseAct->setIcon(QtIconLoader::icon("media-playback-start", QIcon(":/images/media-playback-start.png")));
+        pauseAct->setIcon(QtIconLoader::icon("media-playback-start"));
         pauseAct->setText(tr("&Play"));
         pauseAct->setStatusTip(tr("Resume playback") + " (" +  pauseAct->shortcut().toString(QKeySequence::NativeText) + ")");
         break;
index 551e1acb75d715b0b170631906ac687122d20654..0649c5cc03ec0fa59de2c508a868b33fd3fac46c 100644 (file)
@@ -88,7 +88,7 @@ private:
 Q_GLOBAL_STATIC(QtIconLoaderImplementation, iconLoaderInstance)
 #endif
 
-/*!
+        /*!
 
     Returns the standard icon for the given icon /a name
     as specified in the freedesktop icon spec
@@ -99,28 +99,25 @@ Q_GLOBAL_STATIC(QtIconLoaderImplementation, iconLoaderInstance)
     crossplatform code.
 
 */
-QIcon QtIconLoader::icon(const QString &name, const QIcon &fallback)
+        QIcon QtIconLoader::icon(const QString &name)
 {
     QIcon icon;
 
-#if QT_VERSION < 0x040600
-
 #ifdef Q_WS_X11
+#if QT_VERSION < 0x040600
     QString pngExtension(QLatin1String(".png"));
     QList<int> iconSizes;
-    iconSizes << 16 << 24 << 32 << 48 << 64;
+    iconSizes << 16 << 22 << 24 << 32 << 48;
     Q_FOREACH (int size, iconSizes) {
-        icon.addPixmap(iconLoaderInstance()->findIcon(size, name + pngExtension));
+        icon.addPixmap(iconLoaderInstance()->findIcon(size, name));
     }
+#else
+    icon = QIcon::fromTheme(name);
 #endif
-
 #else
-    icon = QIcon::fromTheme(name, fallback);
+        icon = QIcon(QString(":/images/%1.png").arg(name));
 #endif
 
-    if (icon.isNull())
-        icon = fallback;
-    Q_UNUSED(name);
     return icon;
 }
 
@@ -233,7 +230,7 @@ void QtIconLoaderImplementation::lookupIconTheme() const
     dataDirs.prepend(QDir::homePath() + QLatin1String("/:"));
     QStringList kdeDirs = QFile::decodeName(getenv("KDEDIRS")).split(QLatin1Char(':'));
     Q_FOREACH (const QString dirName, kdeDirs)
-        dataDirs.append(QLatin1Char(':') + dirName + QLatin1String("/share"));
+            dataDirs.append(QLatin1Char(':') + dirName + QLatin1String("/share"));
     iconDirs = dataDirs.split(QLatin1Char(':'));
     
     QFileInfo fileInfo(QLatin1String("/usr/share/icons/default.kde"));
@@ -313,9 +310,23 @@ QPixmap QtIconLoaderImplementation::findIconHelper(int size, const QString &them
                 QString contentDir = (iconDirs[i].startsWith(QDir::homePath())) ?
                                      QLatin1String("/.icons/") : QLatin1String("/icons/");
                 QString fileName = iconDirs[i] + contentDir + themeName + QLatin1Char('/') + subDirs[j] + QLatin1Char('/') + iconName;
-                QFile file(fileName);
-                if (file.exists())
-                    pixmap.load(fileName);
+
+                QString svgExtension(QLatin1String(".svg"));
+                QString svgFilename = fileName + svgExtension;
+                QFile svgFile(svgFilename);
+                if (false && svgFile.exists()) {
+                    // qDebug() << "Found svg";
+                    pixmap.load(svgFilename);
+                } else {
+                    QString pngExtension(QLatin1String(".png"));
+                    QString pngFilename = fileName + pngExtension;
+                    QFile pngFile(pngFilename);
+                    if (pngFile.exists()) {
+                        // qDebug() << "Found png";
+                        pixmap.load(pngFilename);
+                    }
+                }
+
                 if (!pixmap.isNull())
                     break;
             }
index 89fc1b2ba4b4c71d90859f36721e37f748b6b58f..a40da0f9a0e018018d48529a1e5a3e178ed8289c 100644 (file)
@@ -50,7 +50,7 @@
 class QtIconLoader
 {
 public:
-    static QIcon icon(const QString &name, const QIcon &fallback = QIcon());
+    static QIcon icon(const QString &name);
 };
 
 #endif // QTICONLOADER_H