From: Flavio Tordini Date: Sun, 25 Jul 2010 15:17:00 +0000 (+0200) Subject: Always rely on native icons on X11 X-Git-Tag: 1.2~41 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=77142704a641ac86f393567b271f23e635926298;p=minitube Always rely on native icons on X11 --- diff --git a/Info.plist b/Info.plist deleted file mode 100644 index 27b03c3..0000000 --- a/Info.plist +++ /dev/null @@ -1,18 +0,0 @@ - - - - - CFBundleName - Minitube - CFBundleIconFile - minitube.icns - CFBundlePackageType - APPL - CFBundleGetInfoString - Copyright 2009 Flavio Tordini - CFBundleExecutable - minitube - CFBundleIdentifier - org.tordini.flavio.minitube - - diff --git a/images/media-playback-pause.png b/images/media-playback-pause.png deleted file mode 100644 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 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 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 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 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 index 0053278..0000000 Binary files a/minitube.icns and /dev/null differ diff --git a/minitube.ico b/minitube.ico deleted file mode 100644 index 9a3acbe..0000000 Binary files a/minitube.ico and /dev/null differ diff --git a/minitube.rc b/minitube.rc deleted file mode 100644 index 2c1795b..0000000 --- a/minitube.rc +++ /dev/null @@ -1,2 +0,0 @@ -IDI_ICON1 ICON DISCARDABLE "minitube.ico" - diff --git a/resources.qrc b/resources.qrc index 639421a..53d1d4d 100755 --- a/resources.qrc +++ b/resources.qrc @@ -1,10 +1,5 @@ images/app.png - images/view-fullscreen.png - images/media-playback-pause.png - images/media-playback-start.png - images/media-playback-stop.png - images/media-skip-forward.png diff --git a/src/Constants.h b/src/Constants.h deleted file mode 100755 index 8ba79e8..0000000 --- a/src/Constants.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef CONSTANTS_H -#define CONSTANTS_H - -#include - -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 diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index b785fc1..d01d9e0 100755 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -77,27 +77,27 @@ void MainWindow::createActions() { QMap *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(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(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(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; diff --git a/src/iconloader/qticonloader.cpp b/src/iconloader/qticonloader.cpp index 551e1ac..0649c5c 100644 --- a/src/iconloader/qticonloader.cpp +++ b/src/iconloader/qticonloader.cpp @@ -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 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; } diff --git a/src/iconloader/qticonloader.h b/src/iconloader/qticonloader.h index 89fc1b2..a40da0f 100644 --- a/src/iconloader/qticonloader.h +++ b/src/iconloader/qticonloader.h @@ -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