diff --git a/.gitignore b/.gitignore index 14e8c9ae44d..837f4e69579 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,5 @@ config.status src/icons/qbt-theme/build-icons/node_modules/ src/icons/skin/build-icons/node_modules/ src/icons/skin/build-icons/icons/*.png +src/icons/status/build-icons/node_modules/ + diff --git a/src/base/preferences.cpp b/src/base/preferences.cpp index e7044bcf1a8..99ce023da73 100644 --- a/src/base/preferences.cpp +++ b/src/base/preferences.cpp @@ -57,9 +57,11 @@ #include "logger.h" #include "preferences.h" -Preferences* Preferences::m_instance = 0; +Preferences *Preferences::m_instance = 0; -Preferences::Preferences() {} +Preferences::Preferences() +{ +} Preferences *Preferences::instance() { @@ -141,6 +143,16 @@ void Preferences::setAlternatingRowColors(bool b) setValue("Preferences/General/AlternatingRowColors", b); } +bool Preferences::useLargeStatusIcons() const +{ + return value("Preferences/General/LargeStatusIcons", false).toBool(); +} + +void Preferences::setLargeStatusIcons(bool b) +{ + setValue("Preferences/General/LargeStatusIcons", b); +} + bool Preferences::getHideZeroValues() const { return value("Preferences/General/HideZeroValues", false).toBool(); @@ -250,6 +262,7 @@ void Preferences::setWinStartup(bool b) settings.remove("qBittorrent"); } } + #endif // Downloads @@ -712,6 +725,7 @@ void Preferences::useSystemIconTheme(bool enabled) { setValue("Preferences/Advanced/useSystemIconTheme", enabled); } + #endif bool Preferences::recursiveDownloadDisabled() const @@ -725,7 +739,8 @@ void Preferences::disableRecursiveDownload(bool disable) } #ifdef Q_OS_WIN -namespace { +namespace +{ enum REG_SEARCH_TYPE { USER, @@ -814,7 +829,7 @@ namespace { versions.sort(); bool found = false; - while(!found && !versions.empty()) { + while (!found && !versions.empty()) { const QString version = versions.takeLast() + "\\InstallPath"; LPWSTR lpSubkey = new WCHAR[version.size() + 1]; version.toWCharArray(lpSubkey); @@ -844,7 +859,6 @@ namespace { return path; } - } QString Preferences::getPythonPath() @@ -950,6 +964,7 @@ void Preferences::setMagnetLinkAssoc(bool set) SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, 0, 0); } + #endif #ifdef Q_OS_MAC @@ -1006,6 +1021,7 @@ void Preferences::setMagnetLinkAssoc() CFStringRef myBundleId = CFBundleGetIdentifier(CFBundleGetMainBundle()); LSSetDefaultHandlerForURLScheme(magnetUrlScheme, myBundleId); } + #endif int Preferences::getTrackerPort() const @@ -1028,6 +1044,7 @@ void Preferences::setUpdateCheckEnabled(bool enabled) { setValue("Preferences/Advanced/updateCheck", enabled); } + #endif bool Preferences::confirmTorrentDeletion() const @@ -1132,7 +1149,7 @@ void Preferences::setMainLastDir(const QString &path) } #ifndef DISABLE_GUI -QSize Preferences::getPrefSize(const QSize& defaultSize) const +QSize Preferences::getPrefSize(const QSize &defaultSize) const { return value("Preferences/State/size", defaultSize).toSize(); } @@ -1141,6 +1158,7 @@ void Preferences::setPrefSize(const QSize &size) { setValue("Preferences/State/size", size); } + #endif QPoint Preferences::getPrefPos() const @@ -1477,7 +1495,7 @@ void Preferences::setTransHeaderState(const QByteArray &state) #endif } -//From old RssSettings class +// From old RssSettings class bool Preferences::isRSSEnabled() const { return value("Preferences/RSS/RSSEnabled", false).toBool(); @@ -1611,10 +1629,9 @@ void Preferences::upgrade() QStringList labels = value("TransferListFilters/customLabels").toStringList(); if (!labels.isEmpty()) { QVariantMap categories = value("BitTorrent/Session/Categories").toMap(); - foreach (const QString &label, labels) { + foreach (const QString &label, labels) if (!categories.contains(label)) categories[label] = ""; - } setValue("BitTorrent/Session/Categories", categories); SettingsStorage::instance()->removeValue("TransferListFilters/customLabels"); } diff --git a/src/base/preferences.h b/src/base/preferences.h index ec328f264cb..c953e89c6af 100644 --- a/src/base/preferences.h +++ b/src/base/preferences.h @@ -89,7 +89,7 @@ class Preferences: public QObject const QVariant value(const QString &key, const QVariant &defaultValue = QVariant()) const; void setValue(const QString &key, const QVariant &value); - static Preferences* m_instance; + static Preferences *m_instance; signals: void changed(); @@ -97,7 +97,7 @@ class Preferences: public QObject public: static void initInstance(); static void freeInstance(); - static Preferences* instance(); + static Preferences *instance(); // General options QString getLocale() const; @@ -110,6 +110,8 @@ class Preferences: public QObject void showSpeedInTitleBar(bool show); bool useAlternatingRowColors() const; void setAlternatingRowColors(bool b); + bool useLargeStatusIcons() const; + void setLargeStatusIcons(bool b); bool getHideZeroValues() const; void setHideZeroValues(bool b); int getHideZeroComboValues() const; @@ -332,7 +334,7 @@ class Preferences: public QObject int getToolbarTextPosition() const; void setToolbarTextPosition(const int position); - //From old RssSettings class + // From old RssSettings class bool isRSSEnabled() const; void setRSSEnabled(const bool enabled); uint getRSSRefreshInterval() const; diff --git a/src/gui/guiiconprovider.cpp b/src/gui/guiiconprovider.cpp index 1c58dd03cf0..90c50706309 100644 --- a/src/gui/guiiconprovider.cpp +++ b/src/gui/guiiconprovider.cpp @@ -1,5 +1,6 @@ /* * Bittorrent Client using Qt and libtorrent. + * Copyright (C) 2017 Tim Delaney * Copyright (C) 2015 Vladimir Golovnev * Copyright (C) 2011 Christophe Dumez * @@ -27,10 +28,20 @@ * exception statement from your version. */ -#include "guiiconprovider.h" +#include "base/bittorrent/torrenthandle.h" #include "base/preferences.h" +#include "guiiconprovider.h" +#include "torrentmodel.h" +#include +#include +#include +#include #include +#include +#include +#include + #if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) #include #include @@ -38,12 +49,16 @@ GuiIconProvider::GuiIconProvider(QObject *parent) : IconProvider(parent) + , m_iconCache(new QHash, QIcon>) { - configure(); + configure(true); connect(Preferences::instance(), SIGNAL(changed()), SLOT(configure())); } -GuiIconProvider::~GuiIconProvider() {} +GuiIconProvider::~GuiIconProvider() +{ + delete m_iconCache; +} void GuiIconProvider::initInstance() { @@ -64,7 +79,7 @@ QIcon GuiIconProvider::getIcon(const QString &iconId) QIcon GuiIconProvider::getIcon(const QString &iconId, const QString &fallback) { #if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) - if (m_useSystemTheme) { + if (m_themeFlags & SystemTheme) { QIcon icon = QIcon::fromTheme(iconId); if (icon.name() != iconId) icon = QIcon::fromTheme(fallback, QIcon(IconProvider::getIconPath(iconId))); @@ -117,12 +132,13 @@ QIcon GuiIconProvider::generateDifferentSizes(const QIcon &icon) return newIcon; } + #endif QString GuiIconProvider::getIconPath(const QString &iconId) { #if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) - if (m_useSystemTheme) { + if (m_themeFlags & SystemTheme) { QString path = QDir::temp().absoluteFilePath(iconId + ".png"); if (!QFile::exists(path)) { const QIcon icon = QIcon::fromTheme(iconId); @@ -138,10 +154,90 @@ QString GuiIconProvider::getIconPath(const QString &iconId) return IconProvider::getIconPath(iconId); } +void GuiIconProvider::updateTheme() +{ + configure(); +} -void GuiIconProvider::configure() +void GuiIconProvider::configure(bool firstRun) { + ThemeFlags themeFlags = 0; + #if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) - m_useSystemTheme = Preferences::instance()->useSystemIconTheme(); + if (Preferences::instance()->useSystemIconTheme()) + themeFlags |= SystemTheme; #endif + + // QPalette::Base is used for the background of widgets like list and tree views + QPalette pal = QApplication::palette(); + QColor color = pal.color(QPalette::Active, QPalette::Base); + bool darkTheme = (color.lightness() < 127); + + if (darkTheme) + themeFlags |= DarkTheme; + + const Preferences *const pref = Preferences::instance(); + + if (pref->useLargeStatusIcons()) + themeFlags |= LargeStatusIcons; + + if (firstRun || (themeFlags != m_themeFlags)) { + qDebug().nospace() << "Changing status icon theme to " << ((themeFlags & DarkTheme) ? "dark" : "light") + << ", " << ((themeFlags & LargeStatusIcons) ? "large" : "small") << " icons"; + m_iconCache->clear(); + m_themeFlags = themeFlags; + emit themeChanged(); + } +} + +GuiIconProvider::ThemeFlags GuiIconProvider::getThemeFlags() +{ + return m_themeFlags; +} + +QIcon GuiIconProvider::getStatusIcon(const QString &iconId) +{ + return getStatusIcon(iconId, BitTorrent::TorrentState::Unknown, true); +} + +QIcon GuiIconProvider::getStatusIcon(const QString &iconId, const BitTorrent::TorrentState &state) +{ + return getStatusIcon(iconId, state, false); +} + +QIcon GuiIconProvider::getStatusIcon(const QString &iconId, const BitTorrent::TorrentState &state, bool ignoreState) +{ + QString path(":/icons/status/" + iconId + ".png"); + QPair key(path, state); + QIcon icon((*m_iconCache)[key]); + + if (!icon.isNull()) + return icon; + + QPixmap pixmap(path); + + if (!ignoreState) { + QPixmap colored(pixmap.size()); + colored.fill(TorrentModel::getIconColorByState(state)); + colored.setMask(pixmap.createMaskFromColor(Qt::transparent)); + pixmap = colored; + } + + if (m_themeFlags & LargeStatusIcons) { + // The icon files have a fair amount of whitespace that we can crop off + int wInset = pixmap.width() / 8; + int hInset = pixmap.height() / 8; + QRect rect(wInset, hInset, pixmap.width() - (wInset * 2), pixmap.height() - (hInset * 2)); + qDebug() << "Resizing icon" << pixmap.rect() << "->" << rect; + pixmap = pixmap.copy(rect); + } + +#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) + icon = generateDifferentSizes(QIcon(pixmap)); +#else + icon = QIcon(pixmap); +#endif + + (*m_iconCache)[key] = icon; + return icon; } diff --git a/src/gui/guiiconprovider.h b/src/gui/guiiconprovider.h index 665a7fabeb7..fb0ea07459d 100644 --- a/src/gui/guiiconprovider.h +++ b/src/gui/guiiconprovider.h @@ -1,5 +1,6 @@ /* * Bittorrent Client using Qt and libtorrent. + * Copyright (C) 2017 Tim Delaney * Copyright (C) 2015 Vladimir Golovnev * Copyright (C) 2011 Christophe Dumez * @@ -30,35 +31,67 @@ #ifndef GUIICONPROVIDER_H #define GUIICONPROVIDER_H +#include + #include "base/iconprovider.h" +template class QHash; class QIcon; +template class QPair; +class QString; + +namespace BitTorrent +{ + class TorrentState; +} -class GuiIconProvider : public IconProvider +class GuiIconProvider: public IconProvider { Q_DISABLE_COPY(GuiIconProvider) Q_OBJECT public: + + enum ThemeFlag + { + SystemTheme = 1, + DarkTheme = 2, + LargeStatusIcons = 4, + }; + + Q_DECLARE_FLAGS(ThemeFlags, ThemeFlag) + static void initInstance(); static GuiIconProvider *instance(); + ThemeFlags getThemeFlags(); + void updateTheme(); + QIcon getIcon(const QString &iconId); QIcon getIcon(const QString &iconId, const QString &fallback); QIcon getFlagIcon(const QString &countryIsoCode); + QIcon getStatusIcon(const QString &iconId); + QIcon getStatusIcon(const QString &iconId, const BitTorrent::TorrentState &state); QString getIconPath(const QString &iconId); +signals: + void themeChanged(); + private slots: - void configure(); + void configure(bool firstRun = false); private: explicit GuiIconProvider(QObject *parent = 0); ~GuiIconProvider(); + QIcon getStatusIcon(const QString &path, const BitTorrent::TorrentState &state, bool ignoreState); #if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) QIcon generateDifferentSizes(const QIcon &icon); - - bool m_useSystemTheme; #endif + + ThemeFlags m_themeFlags; + QHash, QIcon> *m_iconCache; }; +Q_DECLARE_OPERATORS_FOR_FLAGS(GuiIconProvider::ThemeFlags) + #endif // GUIICONPROVIDER_H diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index 0b873443de4..c6dfc558a40 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -776,7 +776,7 @@ void MainWindow::createKeyboardShortcuts() m_ui->actionDocumentation->setShortcut(QKeySequence::HelpContents); m_ui->actionOptions->setShortcut(Qt::ALT + Qt::Key_O); m_ui->actionStart->setShortcut(Qt::CTRL + Qt::Key_S); - m_ui->actionStartAll->setShortcut(Qt::CTRL + Qt::SHIFT +Qt::Key_S); + m_ui->actionStartAll->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_S); m_ui->actionPause->setShortcut(Qt::CTRL + Qt::Key_P); m_ui->actionPauseAll->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_P); m_ui->actionBottomPriority->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_Minus); @@ -1094,6 +1094,12 @@ bool MainWindow::event(QEvent *e) return ret; } #endif + case QEvent::ApplicationPaletteChange: { + qDebug("Palette change event"); + // Will notify if there was an actual theme change + GuiIconProvider::instance()->updateTheme(); + break; + } default: break; } diff --git a/src/gui/optionsdlg.cpp b/src/gui/optionsdlg.cpp index 8716667241a..9da615f05ae 100644 --- a/src/gui/optionsdlg.cpp +++ b/src/gui/optionsdlg.cpp @@ -171,6 +171,7 @@ OptionsDialog::OptionsDialog(QWidget *parent) connect(m_ui->comboI18n, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton())); connect(m_ui->confirmDeletion, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(m_ui->checkAltRowColors, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); + connect(m_ui->checkLargeStatusIcons, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(m_ui->checkHideZero, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(m_ui->checkHideZero, SIGNAL(toggled(bool)), m_ui->comboHideZero, SLOT(setEnabled(bool))); connect(m_ui->comboHideZero, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton())); @@ -459,6 +460,7 @@ void OptionsDialog::saveOptions() pref->setLocale(locale); pref->setConfirmTorrentDeletion(m_ui->confirmDeletion->isChecked()); pref->setAlternatingRowColors(m_ui->checkAltRowColors->isChecked()); + pref->setLargeStatusIcons(m_ui->checkLargeStatusIcons->isChecked()); pref->setHideZeroValues(m_ui->checkHideZero->isChecked()); pref->setHideZeroComboValues(m_ui->comboHideZero->currentIndex()); pref->setSystrayIntegration(systrayIntegration()); @@ -664,6 +666,7 @@ void OptionsDialog::loadOptions() setLocale(pref->getLocale()); m_ui->confirmDeletion->setChecked(pref->confirmTorrentDeletion()); m_ui->checkAltRowColors->setChecked(pref->useAlternatingRowColors()); + m_ui->checkLargeStatusIcons->setChecked(pref->useLargeStatusIcons()); m_ui->checkHideZero->setChecked(pref->getHideZeroValues()); m_ui->comboHideZero->setEnabled(m_ui->checkHideZero->isChecked()); m_ui->comboHideZero->setCurrentIndex(pref->getHideZeroComboValues()); diff --git a/src/gui/optionsdlg.ui b/src/gui/optionsdlg.ui index 191ea6392e1..8b59d6b104e 100644 --- a/src/gui/optionsdlg.ui +++ b/src/gui/optionsdlg.ui @@ -212,6 +212,16 @@ + + + + Use large status icons + + + false + + + diff --git a/src/gui/torrentmodel.cpp b/src/gui/torrentmodel.cpp index d18c3c6277a..c9741899bca 100644 --- a/src/gui/torrentmodel.cpp +++ b/src/gui/torrentmodel.cpp @@ -1,5 +1,6 @@ /* * Bittorrent Client using Qt and libtorrent. + * Copyright (C) 2017 Tim Delaney * Copyright (C) 2015 Vladimir Golovnev * Copyright (C) 2010 Christophe Dumez * @@ -29,32 +30,20 @@ * Contact : chris@qbittorrent.org */ +#include #include -#include -#include #include +#include +#include +#include #include "base/bittorrent/session.h" #include "base/bittorrent/torrenthandle.h" #include "base/torrentfilter.h" #include "base/utils/fs.h" +#include "guiiconprovider.h" #include "torrentmodel.h" -static QIcon getIconByState(BitTorrent::TorrentState state); -static QColor getColorByState(BitTorrent::TorrentState state); - -static QIcon getPausedIcon(); -static QIcon getQueuedIcon(); -static QIcon getDownloadingIcon(); -static QIcon getStalledDownloadingIcon(); -static QIcon getUploadingIcon(); -static QIcon getStalledUploadingIcon(); -static QIcon getCompletedIcon(); -static QIcon getCheckingIcon(); -static QIcon getErrorIcon(); - -static bool isDarkTheme(); - // TorrentModel TorrentModel::TorrentModel(QObject *parent) @@ -314,79 +303,123 @@ void TorrentModel::handleTorrentsUpdated() // Static functions -QIcon getIconByState(BitTorrent::TorrentState state) +static const QLatin1String downloading("downloading"); +static const QLatin1String stalledDL("stalledDL"); +static const QLatin1String stalledUP("stalledUP"); +static const QLatin1String uploading("uploading"); +static const QLatin1String paused("paused"); +static const QLatin1String completed("completed"); +static const QLatin1String queued("queued"); +static const QLatin1String checking("checking"); +static const QLatin1String error("error"); + +QString TorrentModel::getIconId(const BitTorrent::TorrentState &state) { switch (state) { case BitTorrent::TorrentState::Downloading: case BitTorrent::TorrentState::ForcedDownloading: case BitTorrent::TorrentState::DownloadingMetadata: - return getDownloadingIcon(); + return downloading; case BitTorrent::TorrentState::Allocating: case BitTorrent::TorrentState::StalledDownloading: - return getStalledDownloadingIcon(); + return stalledDL; case BitTorrent::TorrentState::StalledUploading: - return getStalledUploadingIcon(); + return stalledUP; case BitTorrent::TorrentState::Uploading: case BitTorrent::TorrentState::ForcedUploading: - return getUploadingIcon(); + return uploading; case BitTorrent::TorrentState::PausedDownloading: - return getPausedIcon(); + return paused; case BitTorrent::TorrentState::PausedUploading: - return getCompletedIcon(); + return completed; case BitTorrent::TorrentState::QueuedDownloading: case BitTorrent::TorrentState::QueuedUploading: - return getQueuedIcon(); + return queued; case BitTorrent::TorrentState::CheckingDownloading: case BitTorrent::TorrentState::CheckingUploading: case BitTorrent::TorrentState::QueuedForChecking: case BitTorrent::TorrentState::CheckingResumeData: - return getCheckingIcon(); + return checking; case BitTorrent::TorrentState::Unknown: case BitTorrent::TorrentState::MissingFiles: case BitTorrent::TorrentState::Error: - return getErrorIcon(); + return error; default: Q_ASSERT(false); - return getErrorIcon(); + return error; } } -QColor getColorByState(BitTorrent::TorrentState state) +QIcon TorrentModel::getIconByState(const BitTorrent::TorrentState &state) +{ + return GuiIconProvider::instance()->getStatusIcon(getIconId(state), state); +} + +// Color names taken from http://cloford.com/resources/colours/500col.htm +static const QColor black(0, 0, 0); +static const QColor cyan3(0, 205, 205); +static const QColor darkBlue(0, 0, 139); +static const QColor forestGreen(34, 139, 34); +static const QColor gray80(204, 204, 204); +static const QColor limeGreen(50, 205, 50); +static const QColor maroon(128, 0, 0); +static const QColor red(255, 0, 0); +static const QColor royalBlue(65, 105, 225); +static const QColor salmon(250, 128, 114); +static const QColor steelBlue1(99, 184, 255); +static const QColor steelBlue3(79, 148, 205); +static const QColor teal(0, 128, 128); + +QColor TorrentModel::getColorByState(const BitTorrent::TorrentState &state) { - // Color names taken from http://cloford.com/resources/colours/500col.htm - bool dark = isDarkTheme(); + Q_UNUSED(state); + + bool dark = GuiIconProvider::instance()->getThemeFlags() & GuiIconProvider::DarkTheme; + + if (!dark) + return black; + else + return gray80; +} + +QColor TorrentModel::getIconColorByState(const BitTorrent::TorrentState &state) +{ + bool dark = GuiIconProvider::instance()->getThemeFlags() & GuiIconProvider::DarkTheme; switch (state) { case BitTorrent::TorrentState::Downloading: case BitTorrent::TorrentState::ForcedDownloading: case BitTorrent::TorrentState::DownloadingMetadata: if (!dark) - return QColor(34, 139, 34); // Forest Green + return forestGreen; else - return QColor(50, 205, 50); // Lime Green + return limeGreen; case BitTorrent::TorrentState::Allocating: case BitTorrent::TorrentState::StalledDownloading: - case BitTorrent::TorrentState::StalledUploading: if (!dark) - return QColor(0, 0, 0); // Black + return maroon; else - return QColor(204, 204, 204); // Gray 80 + return salmon; case BitTorrent::TorrentState::Uploading: case BitTorrent::TorrentState::ForcedUploading: + case BitTorrent::TorrentState::StalledUploading: if (!dark) - return QColor(65, 105, 225); // Royal Blue + return royalBlue; else - return QColor(99, 184, 255); // Steel Blue 1 + return steelBlue1; case BitTorrent::TorrentState::PausedDownloading: - return QColor(250, 128, 114); // Salmon + if (!dark) + return black; + else + return gray80; case BitTorrent::TorrentState::PausedUploading: if (!dark) - return QColor(0, 0, 139); // Dark Blue + return darkBlue; else - return QColor(79, 148, 205); // Steel Blue 3 + return steelBlue3; case BitTorrent::TorrentState::Error: case BitTorrent::TorrentState::MissingFiles: - return QColor(255, 0, 0); // red + return red; case BitTorrent::TorrentState::QueuedDownloading: case BitTorrent::TorrentState::QueuedUploading: case BitTorrent::TorrentState::CheckingDownloading: @@ -394,75 +427,13 @@ QColor getColorByState(BitTorrent::TorrentState state) case BitTorrent::TorrentState::QueuedForChecking: case BitTorrent::TorrentState::CheckingResumeData: if (!dark) - return QColor(0, 128, 128); // Teal + return teal; else - return QColor(0, 205, 205); // Cyan 3 + return cyan3; case BitTorrent::TorrentState::Unknown: - return QColor(255, 0, 0); // red + return red; default: Q_ASSERT(false); - return QColor(255, 0, 0); // red + return red; } } - -QIcon getPausedIcon() -{ - static QIcon cached = QIcon(":/icons/skin/paused.png"); - return cached; -} - -QIcon getQueuedIcon() -{ - static QIcon cached = QIcon(":/icons/skin/queued.png"); - return cached; -} - -QIcon getDownloadingIcon() -{ - static QIcon cached = QIcon(":/icons/skin/downloading.png"); - return cached; -} - -QIcon getStalledDownloadingIcon() -{ - static QIcon cached = QIcon(":/icons/skin/stalledDL.png"); - return cached; -} - -QIcon getUploadingIcon() -{ - static QIcon cached = QIcon(":/icons/skin/uploading.png"); - return cached; -} - -QIcon getStalledUploadingIcon() -{ - static QIcon cached = QIcon(":/icons/skin/stalledUP.png"); - return cached; -} - -QIcon getCompletedIcon() -{ - static QIcon cached = QIcon(":/icons/skin/completed.png"); - return cached; -} - -QIcon getCheckingIcon() -{ - static QIcon cached = QIcon(":/icons/skin/checking.png"); - return cached; -} - -QIcon getErrorIcon() -{ - static QIcon cached = QIcon(":/icons/skin/error.png"); - return cached; -} - -bool isDarkTheme() -{ - QPalette pal = QApplication::palette(); - // QPalette::Base is used for the background of the Treeview - QColor color = pal.color(QPalette::Active, QPalette::Base); - return (color.lightness() < 127); -} diff --git a/src/gui/torrentmodel.h b/src/gui/torrentmodel.h index 8bd3b0ecf18..acf1bbb05a3 100644 --- a/src/gui/torrentmodel.h +++ b/src/gui/torrentmodel.h @@ -1,5 +1,6 @@ /* * Bittorrent Client using Qt and libtorrent. + * Copyright (C) 2017 Tim Delaney * Copyright (C) 2015 Vladimir Golovnev * Copyright (C) 2010 Christophe Dumez * @@ -35,13 +36,18 @@ #include #include +class QColor; +class QIcon; +class QString; + namespace BitTorrent { class InfoHash; class TorrentHandle; + class TorrentState; } -class TorrentModel : public QAbstractListModel +class TorrentModel: public QAbstractListModel { Q_OBJECT Q_DISABLE_COPY(TorrentModel) @@ -84,8 +90,8 @@ class TorrentModel : public QAbstractListModel explicit TorrentModel(QObject *parent = 0); - int rowCount(const QModelIndex& index = QModelIndex()) const; - int columnCount(const QModelIndex &parent=QModelIndex()) const; + int rowCount(const QModelIndex &index = QModelIndex()) const; + int columnCount(const QModelIndex &parent = QModelIndex()) const; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::DisplayRole); QVariant headerData(int section, Qt::Orientation orientation, int role) const; @@ -93,12 +99,18 @@ class TorrentModel : public QAbstractListModel BitTorrent::TorrentHandle *torrentHandle(const QModelIndex &index) const; + static QIcon getIconByState(const BitTorrent::TorrentState &state); + static QColor getIconColorByState(const BitTorrent::TorrentState &state); + static QColor getColorByState(const BitTorrent::TorrentState &state); + private slots: void addTorrent(BitTorrent::TorrentHandle *const torrent); void handleTorrentAboutToBeRemoved(BitTorrent::TorrentHandle *const torrent); void handleTorrentStatusUpdated(BitTorrent::TorrentHandle *const torrent); void handleTorrentsUpdated(); + static QString getIconId(const BitTorrent::TorrentState &state); + private: QList m_torrents; }; diff --git a/src/gui/transferlistfilterswidget.cpp b/src/gui/transferlistfilterswidget.cpp index d99185dd038..c0ec8860d65 100644 --- a/src/gui/transferlistfilterswidget.cpp +++ b/src/gui/transferlistfilterswidget.cpp @@ -78,8 +78,8 @@ FiltersBase::FiltersBase(QWidget *parent, TransferListWidget *transferList) connect(this, SIGNAL(customContextMenuRequested(QPoint)), SLOT(showMenu(QPoint))); connect(this, SIGNAL(currentRowChanged(int)), SLOT(applyFilter(int))); - connect(BitTorrent::Session::instance(), SIGNAL(torrentAdded(BitTorrent::TorrentHandle *const)), SLOT(handleNewTorrent(BitTorrent::TorrentHandle *const))); - connect(BitTorrent::Session::instance(), SIGNAL(torrentAboutToBeRemoved(BitTorrent::TorrentHandle *const)), SLOT(torrentAboutToBeDeleted(BitTorrent::TorrentHandle *const))); + connect(BitTorrent::Session::instance(), SIGNAL(torrentAdded(BitTorrent::TorrentHandle * const)), SLOT(handleNewTorrent(BitTorrent::TorrentHandle * const))); + connect(BitTorrent::Session::instance(), SIGNAL(torrentAboutToBeRemoved(BitTorrent::TorrentHandle * const)), SLOT(torrentAboutToBeDeleted(BitTorrent::TorrentHandle * const))); } QSize FiltersBase::sizeHint() const @@ -111,40 +111,18 @@ void FiltersBase::toggleFilter(bool checked) StatusFiltersWidget::StatusFiltersWidget(QWidget *parent, TransferListWidget *transferList) : FiltersBase(parent, transferList) { - connect(BitTorrent::Session::instance(), SIGNAL(torrentsUpdated()), SLOT(updateTorrentNumbers())); - // Add status filters - QListWidgetItem *all = new QListWidgetItem(this); - all->setData(Qt::DisplayRole, QVariant(tr("All (0)", "this is for the status filter"))); - all->setData(Qt::DecorationRole, QIcon(":/icons/skin/filterall.png")); - QListWidgetItem *downloading = new QListWidgetItem(this); - downloading->setData(Qt::DisplayRole, QVariant(tr("Downloading (0)"))); - downloading->setData(Qt::DecorationRole, QIcon(":/icons/skin/downloading.png")); - QListWidgetItem *seeding = new QListWidgetItem(this); - seeding->setData(Qt::DisplayRole, QVariant(tr("Seeding (0)"))); - seeding->setData(Qt::DecorationRole, QIcon(":/icons/skin/uploading.png")); - QListWidgetItem *completed = new QListWidgetItem(this); - completed->setData(Qt::DisplayRole, QVariant(tr("Completed (0)"))); - completed->setData(Qt::DecorationRole, QIcon(":/icons/skin/completed.png")); - QListWidgetItem *resumed = new QListWidgetItem(this); - resumed->setData(Qt::DisplayRole, QVariant(tr("Resumed (0)"))); - resumed->setData(Qt::DecorationRole, QIcon(":/icons/skin/resumed.png")); - QListWidgetItem *paused = new QListWidgetItem(this); - paused->setData(Qt::DisplayRole, QVariant(tr("Paused (0)"))); - paused->setData(Qt::DecorationRole, QIcon(":/icons/skin/paused.png")); - QListWidgetItem *active = new QListWidgetItem(this); - active->setData(Qt::DisplayRole, QVariant(tr("Active (0)"))); - active->setData(Qt::DecorationRole, QIcon(":/icons/skin/filteractive.png")); - QListWidgetItem *inactive = new QListWidgetItem(this); - inactive->setData(Qt::DisplayRole, QVariant(tr("Inactive (0)"))); - inactive->setData(Qt::DecorationRole, QIcon(":/icons/skin/filterinactive.png")); - QListWidgetItem *errored = new QListWidgetItem(this); - errored->setData(Qt::DisplayRole, QVariant(tr("Errored (0)"))); - errored->setData(Qt::DecorationRole, QIcon(":/icons/skin/error.png")); - - const Preferences* const pref = Preferences::instance(); + for (int i = TorrentFilter::All; i <= TorrentFilter::Errored; ++i) + new QListWidgetItem(this); + + const Preferences *const pref = Preferences::instance(); setCurrentRow(pref->getTransSelFilter(), QItemSelectionModel::SelectCurrent); toggleFilter(pref->getStatusFilterState()); + + updateTorrentNumbers(); + updateStatusIcons(); + connect(BitTorrent::Session::instance(), SIGNAL(torrentsUpdated()), SLOT(updateTorrentNumbers())); + connect(GuiIconProvider::instance(), SIGNAL(themeChanged()), SLOT(updateStatusIcons())); } StatusFiltersWidget::~StatusFiltersWidget() @@ -155,7 +133,7 @@ StatusFiltersWidget::~StatusFiltersWidget() void StatusFiltersWidget::updateTorrentNumbers() { auto report = BitTorrent::Session::instance()->torrentStatusReport(); - + qDebug() << "Updating status filter counts"; item(TorrentFilter::All)->setData(Qt::DisplayRole, QVariant(tr("All (%1)").arg(report.nbActive + report.nbInactive))); item(TorrentFilter::Downloading)->setData(Qt::DisplayRole, QVariant(tr("Downloading (%1)").arg(report.nbDownloading))); item(TorrentFilter::Seeding)->setData(Qt::DisplayRole, QVariant(tr("Seeding (%1)").arg(report.nbSeeding))); @@ -167,16 +145,42 @@ void StatusFiltersWidget::updateTorrentNumbers() item(TorrentFilter::Errored)->setData(Qt::DisplayRole, QVariant(tr("Errored (%1)").arg(report.nbErrored))); } -void StatusFiltersWidget::showMenu(QPoint) {} +void StatusFiltersWidget::updateStatusIcons() +{ + static const QLatin1String filterall("filterall"); + static const QLatin1String resumed("resumed"); + static const QLatin1String filteractive("filteractive"); + static const QLatin1String filterinactive("filterinactive"); + + GuiIconProvider *ico = GuiIconProvider::instance(); + qDebug() << "Updating status filter icons"; + item(TorrentFilter::All)->setData(Qt::DecorationRole, ico->getStatusIcon(filterall)); + item(TorrentFilter::Downloading)->setData(Qt::DecorationRole, TorrentModel::getIconByState(BitTorrent::TorrentState::Downloading)); + item(TorrentFilter::Seeding)->setData(Qt::DecorationRole, TorrentModel::getIconByState(BitTorrent::TorrentState::Uploading)); + item(TorrentFilter::Completed)->setData(Qt::DecorationRole, TorrentModel::getIconByState(BitTorrent::TorrentState::PausedUploading)); + item(TorrentFilter::Resumed)->setData(Qt::DecorationRole, ico->getStatusIcon(resumed, BitTorrent::TorrentState::Downloading)); + item(TorrentFilter::Paused)->setData(Qt::DecorationRole, TorrentModel::getIconByState(BitTorrent::TorrentState::PausedDownloading)); + item(TorrentFilter::Active)->setData(Qt::DecorationRole, ico->getStatusIcon(filteractive, BitTorrent::TorrentState::Downloading)); + item(TorrentFilter::Inactive)->setData(Qt::DecorationRole, ico->getStatusIcon(filterinactive, BitTorrent::TorrentState::StalledDownloading)); + item(TorrentFilter::Errored)->setData(Qt::DecorationRole, TorrentModel::getIconByState(BitTorrent::TorrentState::Error)); +} + +void StatusFiltersWidget::showMenu(QPoint) +{ +} void StatusFiltersWidget::applyFilter(int row) { transferList->applyStatusFilter(row); } -void StatusFiltersWidget::handleNewTorrent(BitTorrent::TorrentHandle *const) {} +void StatusFiltersWidget::handleNewTorrent(BitTorrent::TorrentHandle *const) +{ +} -void StatusFiltersWidget::torrentAboutToBeDeleted(BitTorrent::TorrentHandle *const) {} +void StatusFiltersWidget::torrentAboutToBeDeleted(BitTorrent::TorrentHandle *const) +{ +} TrackerFiltersList::TrackerFiltersList(QWidget *parent, TransferListWidget *transferList) : FiltersBase(parent, transferList) @@ -219,12 +223,10 @@ void TrackerFiltersList::addItem(const QString &tracker, const QString &hash) if (tmp.contains(hash)) return; - if (host != "") { + if (host != "") trackerItem = item(rowFromTracker(host)); - } - else { + else trackerItem = item(1); - } } else { trackerItem = new QListWidgetItem(); @@ -314,10 +316,9 @@ void TrackerFiltersList::setDownloadTrackerFavicon(bool value) m_downloadTrackerFavicon = value; if (m_downloadTrackerFavicon) { - foreach (const QString &tracker, m_trackers.keys()) { + foreach (const QString &tracker, m_trackers.keys()) if (!tracker.isEmpty()) downloadFavicon(QString("http://%1/favicon.ico").arg(tracker)); - } } } @@ -383,15 +384,15 @@ void TrackerFiltersList::trackerWarning(const QString &hash, const QString &trac applyFilter(3); } -void TrackerFiltersList::downloadFavicon(const QString& url) +void TrackerFiltersList::downloadFavicon(const QString &url) { if (!m_downloadTrackerFavicon) return; Net::DownloadHandler *h = Net::DownloadManager::instance()->downloadUrl(url, true); - connect(h, SIGNAL(downloadFinished(QString, QString)), this, SLOT(handleFavicoDownload(QString, QString))); - connect(h, SIGNAL(downloadFailed(QString, QString)), this, SLOT(handleFavicoFailure(QString, QString))); + connect(h, SIGNAL(downloadFinished(QString,QString)), this, SLOT(handleFavicoDownload(QString,QString))); + connect(h, SIGNAL(downloadFailed(QString,QString)), this, SLOT(handleFavicoFailure(QString,QString))); } -void TrackerFiltersList::handleFavicoDownload(const QString& url, const QString& filePath) +void TrackerFiltersList::handleFavicoDownload(const QString &url, const QString &filePath) { QString host = getHost(url); if (!m_trackers.contains(host)) { @@ -403,7 +404,7 @@ void TrackerFiltersList::handleFavicoDownload(const QString& url, const QString& if (!trackerItem) return; QIcon icon(filePath); - //Detect a non-decodable icon + // Detect a non-decodable icon QList sizes = icon.availableSizes(); bool invalid = (sizes.isEmpty() || icon.pixmap(sizes.first()).isNull()); if (invalid) { @@ -417,7 +418,7 @@ void TrackerFiltersList::handleFavicoDownload(const QString& url, const QString& } } -void TrackerFiltersList::handleFavicoFailure(const QString& url, const QString& error) +void TrackerFiltersList::handleFavicoFailure(const QString &url, const QString &error) { Q_UNUSED(error) if (url.endsWith(".ico", Qt::CaseInsensitive)) @@ -459,7 +460,7 @@ void TrackerFiltersList::handleNewTorrent(BitTorrent::TorrentHandle *const torre foreach (const BitTorrent::TrackerEntry &tracker, trackers) addItem(tracker.url(), hash); - //Check for trackerless torrent + // Check for trackerless torrent if (trackers.size() == 0) addItem("", hash); @@ -473,7 +474,7 @@ void TrackerFiltersList::torrentAboutToBeDeleted(BitTorrent::TorrentHandle *cons foreach (const BitTorrent::TrackerEntry &tracker, trackers) removeItem(tracker.url(), hash); - //Check for trackerless torrent + // Check for trackerless torrent if (trackers.size() == 0) removeItem("", hash); @@ -531,7 +532,7 @@ TransferListFiltersWidget::TransferListFiltersWidget(QWidget *parent, TransferLi , m_transferList(transferList) , m_trackerFilters(0) { - Preferences* const pref = Preferences::instance(); + Preferences *const pref = Preferences::instance(); // Construct lists QVBoxLayout *vLayout = new QVBoxLayout(this); @@ -557,7 +558,7 @@ TransferListFiltersWidget::TransferListFiltersWidget(QWidget *parent, TransferLi vLayout->addWidget(scroll); setLayout(vLayout); - QCheckBox * statusLabel = new QCheckBox(tr("Status"), this); + QCheckBox *statusLabel = new QCheckBox(tr("Status"), this); statusLabel->setChecked(pref->getStatusFilterState()); statusLabel->setFont(font); frameLayout->addWidget(statusLabel); @@ -595,9 +596,9 @@ TransferListFiltersWidget::TransferListFiltersWidget(QWidget *parent, TransferLi connect(statusLabel, SIGNAL(toggled(bool)), pref, SLOT(setStatusFilterState(const bool))); connect(trackerLabel, SIGNAL(toggled(bool)), m_trackerFilters, SLOT(toggleFilter(bool))); connect(trackerLabel, SIGNAL(toggled(bool)), pref, SLOT(setTrackerFilterState(const bool))); - connect(this, SIGNAL(trackerSuccess(const QString &, const QString &)), m_trackerFilters, SLOT(trackerSuccess(const QString &, const QString &))); - connect(this, SIGNAL(trackerError(const QString &, const QString &)), m_trackerFilters, SLOT(trackerError(const QString &, const QString &))); - connect(this, SIGNAL(trackerWarning(const QString &, const QString &)), m_trackerFilters, SLOT(trackerWarning(const QString &, const QString &))); + connect(this, SIGNAL(trackerSuccess(const QString&,const QString&)), m_trackerFilters, SLOT(trackerSuccess(const QString&,const QString&))); + connect(this, SIGNAL(trackerError(const QString&,const QString&)), m_trackerFilters, SLOT(trackerError(const QString&,const QString&))); + connect(this, SIGNAL(trackerWarning(const QString&,const QString&)), m_trackerFilters, SLOT(trackerWarning(const QString&,const QString&))); } void TransferListFiltersWidget::setDownloadTrackerFavicon(bool value) diff --git a/src/gui/transferlistfilterswidget.h b/src/gui/transferlistfilterswidget.h index b2b7ad0f5a1..4f9d72218b1 100644 --- a/src/gui/transferlistfilterswidget.h +++ b/src/gui/transferlistfilterswidget.h @@ -35,8 +35,9 @@ #include QT_BEGIN_NAMESPACE -class QResizeEvent; class QCheckBox; +class QResizeEvent; +class QPaintEvent; QT_END_NAMESPACE class TransferListWidget; @@ -79,6 +80,7 @@ class StatusFiltersWidget: public FiltersBase ~StatusFiltersWidget(); private slots: + void updateStatusIcons(); void updateTorrentNumbers(); private: diff --git a/src/icons.qrc b/src/icons.qrc index 8a7441ef65f..81efff8add3 100644 --- a/src/icons.qrc +++ b/src/icons.qrc @@ -330,17 +330,11 @@ icons/skin/bg-handle-horizontal.gif icons/skin/bg-header.gif icons/skin/bg-panel-header.gif - icons/skin/checking.png icons/skin/collapse-expand.gif icons/skin/connected.png icons/skin/disconnected.png icons/skin/dock-tabs.gif icons/skin/download.png - icons/skin/downloading.png - icons/skin/error.png - icons/skin/filteractive.png - icons/skin/filterall.png - icons/skin/filterinactive.png icons/skin/firewalled.png icons/skin/handle-icon-horizontal.gif icons/skin/handle-icon.gif @@ -349,13 +343,11 @@ icons/skin/logo.gif icons/skin/logo2.gif icons/skin/mascot.png - icons/skin/paused.png icons/skin/qbittorrent16.png icons/skin/qbittorrent22.png icons/skin/qbittorrent32.png icons/skin/qbittorrent_mono_dark.png icons/skin/qbittorrent_mono_light.png - icons/skin/queued.png icons/skin/ratio.png icons/skin/seeding.png icons/skin/slider-area.gif @@ -363,18 +355,26 @@ icons/skin/spinner-placeholder.gif icons/skin/spinner.gif icons/skin/splash.png - icons/skin/stalledDL.png - icons/skin/stalledUP.png icons/skin/tabs.gif icons/skin/toolbox-divider.gif icons/skin/toolbox-divider2.gif - icons/skin/resumed.png - icons/skin/uploading.png - icons/skin/completed.png icons/qbt-theme/system-log-out.png icons/qbt-theme/go-bottom.png icons/qbt-theme/go-top.png icons/qbt-theme/checked.png icons/qbt-theme/office-chart-line.png + icons/status/checking.png + icons/status/completed.png + icons/status/downloading.png + icons/status/error.png + icons/status/filteractive.png + icons/status/filterall.png + icons/status/filterinactive.png + icons/status/paused.png + icons/status/queued.png + icons/status/resumed.png + icons/status/stalledDL.png + icons/status/stalledUP.png + icons/status/uploading.png diff --git a/src/icons/skin/build-icons/icons/checking.svg b/src/icons/skin/build-icons/icons/checking.svg deleted file mode 100644 index 8304276ec81..00000000000 --- a/src/icons/skin/build-icons/icons/checking.svg +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/src/icons/skin/build-icons/icons/completed.svg b/src/icons/skin/build-icons/icons/completed.svg deleted file mode 100644 index 65cf0eba45c..00000000000 --- a/src/icons/skin/build-icons/icons/completed.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - diff --git a/src/icons/skin/build-icons/icons/downloading.svg b/src/icons/skin/build-icons/icons/downloading.svg deleted file mode 100644 index 54ffa444333..00000000000 --- a/src/icons/skin/build-icons/icons/downloading.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - diff --git a/src/icons/skin/build-icons/icons/error.svg b/src/icons/skin/build-icons/icons/error.svg deleted file mode 100644 index 33f3b4f166c..00000000000 --- a/src/icons/skin/build-icons/icons/error.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - diff --git a/src/icons/skin/build-icons/icons/filteractive.svg b/src/icons/skin/build-icons/icons/filteractive.svg deleted file mode 100644 index 445b7a101b1..00000000000 --- a/src/icons/skin/build-icons/icons/filteractive.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - diff --git a/src/icons/skin/build-icons/icons/filterall.svg b/src/icons/skin/build-icons/icons/filterall.svg deleted file mode 100644 index b08fc342e1f..00000000000 --- a/src/icons/skin/build-icons/icons/filterall.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - diff --git a/src/icons/skin/build-icons/icons/filterinactive.svg b/src/icons/skin/build-icons/icons/filterinactive.svg deleted file mode 100644 index ee4bdce0c3f..00000000000 --- a/src/icons/skin/build-icons/icons/filterinactive.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - diff --git a/src/icons/skin/build-icons/icons/paused.svg b/src/icons/skin/build-icons/icons/paused.svg deleted file mode 100644 index 6255abf2eca..00000000000 --- a/src/icons/skin/build-icons/icons/paused.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - diff --git a/src/icons/skin/build-icons/icons/queued.svg b/src/icons/skin/build-icons/icons/queued.svg deleted file mode 100644 index 0823efb9d95..00000000000 --- a/src/icons/skin/build-icons/icons/queued.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - diff --git a/src/icons/skin/build-icons/icons/resumed.svg b/src/icons/skin/build-icons/icons/resumed.svg deleted file mode 100644 index ea37ade3aa5..00000000000 --- a/src/icons/skin/build-icons/icons/resumed.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - diff --git a/src/icons/skin/build-icons/icons/stalledDL.svg b/src/icons/skin/build-icons/icons/stalledDL.svg deleted file mode 100644 index 1886deb5b8f..00000000000 --- a/src/icons/skin/build-icons/icons/stalledDL.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - diff --git a/src/icons/skin/build-icons/icons/stalledUP.svg b/src/icons/skin/build-icons/icons/stalledUP.svg deleted file mode 100644 index 80480475209..00000000000 --- a/src/icons/skin/build-icons/icons/stalledUP.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - diff --git a/src/icons/skin/build-icons/icons/uploading.svg b/src/icons/skin/build-icons/icons/uploading.svg deleted file mode 100644 index 731567cdb78..00000000000 --- a/src/icons/skin/build-icons/icons/uploading.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - diff --git a/src/icons/skin/checking.png b/src/icons/skin/checking.png deleted file mode 100644 index 2d55d7ffaa8..00000000000 Binary files a/src/icons/skin/checking.png and /dev/null differ diff --git a/src/icons/skin/completed.png b/src/icons/skin/completed.png deleted file mode 100644 index 56849ca3441..00000000000 Binary files a/src/icons/skin/completed.png and /dev/null differ diff --git a/src/icons/skin/downloading.png b/src/icons/skin/downloading.png deleted file mode 100644 index 4e319f8203d..00000000000 Binary files a/src/icons/skin/downloading.png and /dev/null differ diff --git a/src/icons/skin/error.png b/src/icons/skin/error.png deleted file mode 100644 index 709a490ccd1..00000000000 Binary files a/src/icons/skin/error.png and /dev/null differ diff --git a/src/icons/skin/filteractive.png b/src/icons/skin/filteractive.png deleted file mode 100644 index 821777651f8..00000000000 Binary files a/src/icons/skin/filteractive.png and /dev/null differ diff --git a/src/icons/skin/filterall.png b/src/icons/skin/filterall.png deleted file mode 100644 index 23146341a48..00000000000 Binary files a/src/icons/skin/filterall.png and /dev/null differ diff --git a/src/icons/skin/filterinactive.png b/src/icons/skin/filterinactive.png deleted file mode 100644 index 66346e51093..00000000000 Binary files a/src/icons/skin/filterinactive.png and /dev/null differ diff --git a/src/icons/skin/paused.png b/src/icons/skin/paused.png deleted file mode 100644 index a7949da5f81..00000000000 Binary files a/src/icons/skin/paused.png and /dev/null differ diff --git a/src/icons/skin/queued.png b/src/icons/skin/queued.png deleted file mode 100644 index ce1b9989e00..00000000000 Binary files a/src/icons/skin/queued.png and /dev/null differ diff --git a/src/icons/skin/resumed.png b/src/icons/skin/resumed.png deleted file mode 100644 index be711184857..00000000000 Binary files a/src/icons/skin/resumed.png and /dev/null differ diff --git a/src/icons/skin/stalledDL.png b/src/icons/skin/stalledDL.png deleted file mode 100644 index c35b5193ae6..00000000000 Binary files a/src/icons/skin/stalledDL.png and /dev/null differ diff --git a/src/icons/skin/stalledUP.png b/src/icons/skin/stalledUP.png deleted file mode 100644 index 21df43efa0a..00000000000 Binary files a/src/icons/skin/stalledUP.png and /dev/null differ diff --git a/src/icons/skin/uploading.png b/src/icons/skin/uploading.png deleted file mode 100644 index 8e37968c797..00000000000 Binary files a/src/icons/skin/uploading.png and /dev/null differ diff --git a/src/icons/status/build-icons/Gruntfile.js b/src/icons/status/build-icons/Gruntfile.js new file mode 100644 index 00000000000..2a88a463958 --- /dev/null +++ b/src/icons/status/build-icons/Gruntfile.js @@ -0,0 +1,22 @@ +module.exports = function(grunt) { + + grunt.initConfig({ + svg2png: { + all: { + options:{ + size: 256 + }, + files: [ + { + src: ['icons/*.svg'] + } + ] + } + } + }); + + grunt.loadNpmTasks('grunt-svg2png'); + + grunt.registerTask('default', ['svg2png']); + +} \ No newline at end of file diff --git a/src/icons/status/build-icons/icons/checking.svg b/src/icons/status/build-icons/icons/checking.svg new file mode 100644 index 00000000000..b2b95977500 --- /dev/null +++ b/src/icons/status/build-icons/icons/checking.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/status/build-icons/icons/completed.svg b/src/icons/status/build-icons/icons/completed.svg new file mode 100644 index 00000000000..bd881c9094a --- /dev/null +++ b/src/icons/status/build-icons/icons/completed.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/status/build-icons/icons/downloading.svg b/src/icons/status/build-icons/icons/downloading.svg new file mode 100644 index 00000000000..3b9a9484197 --- /dev/null +++ b/src/icons/status/build-icons/icons/downloading.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/status/build-icons/icons/error.svg b/src/icons/status/build-icons/icons/error.svg new file mode 100644 index 00000000000..d6fc063aec3 --- /dev/null +++ b/src/icons/status/build-icons/icons/error.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/status/build-icons/icons/filteractive.svg b/src/icons/status/build-icons/icons/filteractive.svg new file mode 100644 index 00000000000..b6f4dcc761a --- /dev/null +++ b/src/icons/status/build-icons/icons/filteractive.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/status/build-icons/icons/filterall.svg b/src/icons/status/build-icons/icons/filterall.svg new file mode 100644 index 00000000000..62fea4fadd1 --- /dev/null +++ b/src/icons/status/build-icons/icons/filterall.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/status/build-icons/icons/filterinactive.svg b/src/icons/status/build-icons/icons/filterinactive.svg new file mode 100644 index 00000000000..46d0c78c36c --- /dev/null +++ b/src/icons/status/build-icons/icons/filterinactive.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/status/build-icons/icons/paused.svg b/src/icons/status/build-icons/icons/paused.svg new file mode 100644 index 00000000000..a9ecdd82a5e --- /dev/null +++ b/src/icons/status/build-icons/icons/paused.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/status/build-icons/icons/queued.svg b/src/icons/status/build-icons/icons/queued.svg new file mode 100644 index 00000000000..16d802eec18 --- /dev/null +++ b/src/icons/status/build-icons/icons/queued.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/status/build-icons/icons/resumed.svg b/src/icons/status/build-icons/icons/resumed.svg new file mode 100644 index 00000000000..82d9c2a923d --- /dev/null +++ b/src/icons/status/build-icons/icons/resumed.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/status/build-icons/icons/stalledDL.svg b/src/icons/status/build-icons/icons/stalledDL.svg new file mode 100644 index 00000000000..27e7c2b51af --- /dev/null +++ b/src/icons/status/build-icons/icons/stalledDL.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/status/build-icons/icons/stalledUP.svg b/src/icons/status/build-icons/icons/stalledUP.svg new file mode 100644 index 00000000000..4e124fe785d --- /dev/null +++ b/src/icons/status/build-icons/icons/stalledUP.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/status/build-icons/icons/uploading.svg b/src/icons/status/build-icons/icons/uploading.svg new file mode 100644 index 00000000000..4e124fe785d --- /dev/null +++ b/src/icons/status/build-icons/icons/uploading.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/status/build-icons/package.json b/src/icons/status/build-icons/package.json new file mode 100644 index 00000000000..c4e5b5ca349 --- /dev/null +++ b/src/icons/status/build-icons/package.json @@ -0,0 +1,13 @@ +{ + "name": "build-icons", + "version": "1.0.0", + "description": "Convert svg icons to png", + "main": "index.js", + "dependencies": {}, + "devDependencies": { + "grunt": "^0.4.5", + "grunt-svg2png": "git+https://git@github.com/bertyhell/grunt-svg2png.git" + }, + "author": "Bert Verhelst", + "license": "ISC" +} diff --git a/src/icons/status/build-icons/readme.md b/src/icons/status/build-icons/readme.md new file mode 100644 index 00000000000..97c3fd44f99 --- /dev/null +++ b/src/icons/status/build-icons/readme.md @@ -0,0 +1,14 @@ +Convert SVG icons to PNG +------------------------ + +install npm + +Execute: +``` +npm install +``` + +Convert icons by running: +``` +grunt +``` \ No newline at end of file diff --git a/src/icons/status/checking.png b/src/icons/status/checking.png new file mode 100644 index 00000000000..bd1db0a6ee7 Binary files /dev/null and b/src/icons/status/checking.png differ diff --git a/src/icons/status/completed.png b/src/icons/status/completed.png new file mode 100644 index 00000000000..0d1968c7614 Binary files /dev/null and b/src/icons/status/completed.png differ diff --git a/src/icons/status/downloading.png b/src/icons/status/downloading.png new file mode 100644 index 00000000000..76027672baf Binary files /dev/null and b/src/icons/status/downloading.png differ diff --git a/src/icons/status/error.png b/src/icons/status/error.png new file mode 100644 index 00000000000..9b640d24a39 Binary files /dev/null and b/src/icons/status/error.png differ diff --git a/src/icons/status/filteractive.png b/src/icons/status/filteractive.png new file mode 100644 index 00000000000..3c9804f9771 Binary files /dev/null and b/src/icons/status/filteractive.png differ diff --git a/src/icons/status/filterall.png b/src/icons/status/filterall.png new file mode 100644 index 00000000000..b3007f14b16 Binary files /dev/null and b/src/icons/status/filterall.png differ diff --git a/src/icons/status/filterinactive.png b/src/icons/status/filterinactive.png new file mode 100644 index 00000000000..feb7fc5c182 Binary files /dev/null and b/src/icons/status/filterinactive.png differ diff --git a/src/icons/status/paused.png b/src/icons/status/paused.png new file mode 100644 index 00000000000..c28bfc26fb9 Binary files /dev/null and b/src/icons/status/paused.png differ diff --git a/src/icons/status/queued.png b/src/icons/status/queued.png new file mode 100644 index 00000000000..b72363557c6 Binary files /dev/null and b/src/icons/status/queued.png differ diff --git a/src/icons/status/resumed.png b/src/icons/status/resumed.png new file mode 100644 index 00000000000..537da001933 Binary files /dev/null and b/src/icons/status/resumed.png differ diff --git a/src/icons/status/stalledDL.png b/src/icons/status/stalledDL.png new file mode 100644 index 00000000000..2f4f0fb6547 Binary files /dev/null and b/src/icons/status/stalledDL.png differ diff --git a/src/icons/status/stalledUP.png b/src/icons/status/stalledUP.png new file mode 100644 index 00000000000..a4afd3be10f Binary files /dev/null and b/src/icons/status/stalledUP.png differ diff --git a/src/icons/status/uploading.png b/src/icons/status/uploading.png new file mode 100644 index 00000000000..a4afd3be10f Binary files /dev/null and b/src/icons/status/uploading.png differ