From: Manuel Nickschas Date: Sat, 25 Oct 2014 21:14:51 +0000 (+0200) Subject: Remove the obsolete Icon and IconLoader classes X-Git-Tag: 0.12-beta1~50 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=f3d6f8088d8be6af9319a99fb8d2fee2837b540a Remove the obsolete Icon and IconLoader classes Removing (hopefully) all traces of the now obsolete icon loading support. --- diff --git a/src/qtui/aboutdlg.cpp b/src/qtui/aboutdlg.cpp index 8bfdad33..14fedb9c 100644 --- a/src/qtui/aboutdlg.cpp +++ b/src/qtui/aboutdlg.cpp @@ -19,10 +19,9 @@ ***************************************************************************/ #include +#include #include "aboutdlg.h" -#include "icon.h" -#include "iconloader.h" #include "quassel.h" AboutDlg::AboutDlg(QWidget *parent) : QDialog(parent) @@ -39,7 +38,7 @@ AboutDlg::AboutDlg(QWidget *parent) : QDialog(parent) ui.contributorTextBrowser->setHtml(contributors()); ui.thanksToTextBrowser->setHtml(thanksTo()); - setWindowIcon(Icon("quassel")); + setWindowIcon(QIcon::fromTheme("quassel", QIcon(":/icons/quassel.png"))); } diff --git a/src/qtui/bufferwidget.cpp b/src/qtui/bufferwidget.cpp index 60a3571b..370ecdc4 100644 --- a/src/qtui/bufferwidget.cpp +++ b/src/qtui/bufferwidget.cpp @@ -18,6 +18,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ +#include #include #include #include @@ -32,7 +33,6 @@ #include "chatviewsearchcontroller.h" #include "chatviewsettings.h" #include "client.h" -#include "iconloader.h" #include "multilineedit.h" #include "qtui.h" #include "settings.h" diff --git a/src/qtui/channellistdlg.cpp b/src/qtui/channellistdlg.cpp index d81ba3af..0bb29380 100644 --- a/src/qtui/channellistdlg.cpp +++ b/src/qtui/channellistdlg.cpp @@ -22,12 +22,11 @@ #include #include +#include #include #include "client.h" #include "clientirclisthelper.h" -#include "icon.h" -#include "iconloader.h" ChannelListDlg::ChannelListDlg(QWidget *parent) : QDialog(parent), @@ -55,7 +54,7 @@ ChannelListDlg::ChannelListDlg(QWidget *parent) ui.searchChannelsButton->setAutoDefault(false); - setWindowIcon(Icon("format-list-unordered")); + setWindowIcon(QIcon::fromTheme("format-list-unordered")); connect(ui.advancedModeLabel, SIGNAL(clicked()), this, SLOT(toggleMode())); connect(ui.searchChannelsButton, SIGNAL(clicked()), this, SLOT(requestSearch())); diff --git a/src/qtui/chatitem.cpp b/src/qtui/chatitem.cpp index 4e199313..9b2e1a64 100644 --- a/src/qtui/chatitem.cpp +++ b/src/qtui/chatitem.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -35,7 +36,6 @@ #include "chatlinemodel.h" #include "chatview.h" #include "contextmenuactionprovider.h" -#include "iconloader.h" #include "mainwin.h" #include "qtui.h" #include "qtuistyle.h" diff --git a/src/qtui/chatmonitorview.cpp b/src/qtui/chatmonitorview.cpp index 3bea4f8e..37197ed4 100644 --- a/src/qtui/chatmonitorview.cpp +++ b/src/qtui/chatmonitorview.cpp @@ -21,6 +21,7 @@ #include "chatmonitorview.h" #include +#include #include #include @@ -29,7 +30,6 @@ #include "chatitem.h" #include "chatscene.h" #include "client.h" -#include "iconloader.h" #include "networkmodel.h" #include "buffermodel.h" #include "messagemodel.h" diff --git a/src/qtui/chatscene.cpp b/src/qtui/chatscene.cpp index f1ef2886..4f3252d8 100644 --- a/src/qtui/chatscene.cpp +++ b/src/qtui/chatscene.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -48,7 +49,6 @@ #include "clientbacklogmanager.h" #include "columnhandleitem.h" #include "contextmenuactionprovider.h" -#include "iconloader.h" #include "mainwin.h" #include "markerlineitem.h" #include "messagefilter.h" diff --git a/src/qtui/chatviewsearchbar.cpp b/src/qtui/chatviewsearchbar.cpp index 7113ab5d..56b5c8f5 100644 --- a/src/qtui/chatviewsearchbar.cpp +++ b/src/qtui/chatviewsearchbar.cpp @@ -20,9 +20,10 @@ #include "chatviewsearchbar.h" +#include + #include "action.h" #include "actioncollection.h" -#include "iconloader.h" #include "qtui.h" ChatViewSearchBar::ChatViewSearchBar(QWidget *parent) diff --git a/src/qtui/coreconfigwizard.cpp b/src/qtui/coreconfigwizard.cpp index 4d065f05..d5d00532 100644 --- a/src/qtui/coreconfigwizard.cpp +++ b/src/qtui/coreconfigwizard.cpp @@ -21,11 +21,11 @@ #include #include #include +#include #include #include "coreconfigwizard.h" #include "coreconnection.h" -#include "iconloader.h" CoreConfigWizard::CoreConfigWizard(CoreConnection *connection, const QList &backends, QWidget *parent) : QWizard(parent), diff --git a/src/qtui/coreconnectdlg.cpp b/src/qtui/coreconnectdlg.cpp index b57e29e1..b89d5d5a 100644 --- a/src/qtui/coreconnectdlg.cpp +++ b/src/qtui/coreconnectdlg.cpp @@ -19,11 +19,11 @@ ***************************************************************************/ #include +#include #include #include "coreconnectdlg.h" -#include "iconloader.h" #include "clientsettings.h" #include "coreaccountsettingspage.h" diff --git a/src/qtui/coreconnectionstatuswidget.cpp b/src/qtui/coreconnectionstatuswidget.cpp index 954004eb..9030a211 100644 --- a/src/qtui/coreconnectionstatuswidget.cpp +++ b/src/qtui/coreconnectionstatuswidget.cpp @@ -20,8 +20,9 @@ #include "coreconnectionstatuswidget.h" +#include + #include "client.h" -#include "iconloader.h" #include "signalproxy.h" CoreConnectionStatusWidget::CoreConnectionStatusWidget(CoreConnection *connection, QWidget *parent) diff --git a/src/qtui/indicatornotificationbackend.cpp b/src/qtui/indicatornotificationbackend.cpp index 20570838..e3cb0e31 100644 --- a/src/qtui/indicatornotificationbackend.cpp +++ b/src/qtui/indicatornotificationbackend.cpp @@ -20,12 +20,14 @@ #include "indicatornotificationbackend.h" +#include +#include + #include #include #include "client.h" #include "clientsettings.h" -#include "iconloader.h" #include "mainwin.h" #include "networkmodel.h" #include "qtui.h" @@ -108,8 +110,8 @@ void IndicatorNotificationBackend::notify(const Notification ¬ification) QModelIndex index = Client::networkModel()->bufferIndex(bufferId); QVariant icon = QtUi::style()->bufferViewItemData(index, Qt::DecorationRole); - if (icon.canConvert()) { - QImage image = icon.value().toImage(); + if (icon.canConvert()) { + QImage image = icon.value().pixmap(16).toImage(); indicator->setIconProperty(image); } diff --git a/src/qtui/inputwidget.cpp b/src/qtui/inputwidget.cpp index 86009a66..09378ccb 100644 --- a/src/qtui/inputwidget.cpp +++ b/src/qtui/inputwidget.cpp @@ -20,11 +20,12 @@ #include "inputwidget.h" +#include + #include "action.h" #include "actioncollection.h" #include "bufferview.h" #include "client.h" -#include "iconloader.h" #include "ircuser.h" #include "networkmodel.h" #include "qtui.h" diff --git a/src/qtui/knotificationbackend.cpp b/src/qtui/knotificationbackend.cpp index 1dd95531..95332a05 100644 --- a/src/qtui/knotificationbackend.cpp +++ b/src/qtui/knotificationbackend.cpp @@ -20,14 +20,13 @@ #include #include +#include #include #include #include "knotificationbackend.h" #include "client.h" -#include "icon.h" -#include "iconloader.h" #include "mainwin.h" #include "networkmodel.h" #include "qtui.h" diff --git a/src/qtui/legacysystemtray.cpp b/src/qtui/legacysystemtray.cpp index 56139e32..d79d5fdc 100644 --- a/src/qtui/legacysystemtray.cpp +++ b/src/qtui/legacysystemtray.cpp @@ -142,7 +142,7 @@ void LegacySystemTray::setState(State state_) } -Icon LegacySystemTray::stateIcon() const +QIcon LegacySystemTray::stateIcon() const { if (mode() == Legacy && state() == NeedsAttention && !_blinkState) return SystemTray::stateIcon(Active); diff --git a/src/qtui/legacysystemtray.h b/src/qtui/legacysystemtray.h index 635554f4..1bbef640 100644 --- a/src/qtui/legacysystemtray.h +++ b/src/qtui/legacysystemtray.h @@ -29,6 +29,7 @@ # include #endif +#include #include #include "systemtray.h" @@ -44,7 +45,7 @@ public: virtual bool isVisible() const; virtual inline bool isSystemTrayAvailable() const; - virtual Icon stateIcon() const; // overriden to care about blinkState + virtual QIcon stateIcon() const; // overriden to care about blinkState public slots: virtual void setState(State state); diff --git a/src/qtui/mainwin.cpp b/src/qtui/mainwin.cpp index c7796ca1..aadddff0 100644 --- a/src/qtui/mainwin.cpp +++ b/src/qtui/mainwin.cpp @@ -20,6 +20,7 @@ #include "mainwin.h" +#include #include #include #include @@ -74,7 +75,6 @@ #include "debuglogwidget.h" #include "debugmessagemodelfilter.h" #include "flatproxymodel.h" -#include "iconloader.h" #include "inputwidget.h" #include "irclistmodel.h" #include "ircconnectionwizard.h" diff --git a/src/qtui/phononnotificationbackend.cpp b/src/qtui/phononnotificationbackend.cpp index f8c613c0..86997644 100644 --- a/src/qtui/phononnotificationbackend.cpp +++ b/src/qtui/phononnotificationbackend.cpp @@ -19,6 +19,7 @@ ***************************************************************************/ #include +#include #include #include @@ -27,7 +28,6 @@ #include "phononnotificationbackend.h" #include "clientsettings.h" -#include "iconloader.h" #include "mainwin.h" #include "qtui.h" diff --git a/src/qtui/settingsdlg.cpp b/src/qtui/settingsdlg.cpp index 39076947..439971c0 100644 --- a/src/qtui/settingsdlg.cpp +++ b/src/qtui/settingsdlg.cpp @@ -18,13 +18,13 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ +#include #include #include #include "settingsdlg.h" #include "client.h" -#include "iconloader.h" SettingsDlg::SettingsDlg(QWidget *parent) : QDialog(parent), diff --git a/src/qtui/settingspagedlg.cpp b/src/qtui/settingspagedlg.cpp index a87a0cf8..a2e27bd1 100644 --- a/src/qtui/settingspagedlg.cpp +++ b/src/qtui/settingspagedlg.cpp @@ -18,13 +18,12 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ +#include #include #include #include "settingspagedlg.h" -#include "iconloader.h" - SettingsPageDlg::SettingsPageDlg(SettingsPage *page, QWidget *parent) : QDialog(parent) { diff --git a/src/qtui/settingspages/aliasessettingspage.cpp b/src/qtui/settingspages/aliasessettingspage.cpp index fe8b26ef..a2ff08af 100644 --- a/src/qtui/settingspages/aliasessettingspage.cpp +++ b/src/qtui/settingspages/aliasessettingspage.cpp @@ -21,10 +21,9 @@ #include "aliasessettingspage.h" #include +#include #include -#include "iconloader.h" - AliasesSettingsPage::AliasesSettingsPage(QWidget *parent) : SettingsPage(tr("IRC"), tr("Aliases"), parent) { diff --git a/src/qtui/settingspages/bufferviewsettingspage.cpp b/src/qtui/settingspages/bufferviewsettingspage.cpp index 42759ee3..f4e99667 100644 --- a/src/qtui/settingspages/bufferviewsettingspage.cpp +++ b/src/qtui/settingspages/bufferviewsettingspage.cpp @@ -20,10 +20,10 @@ #include "bufferviewsettingspage.h" +#include #include #include "client.h" -#include "iconloader.h" #include "network.h" #include "bufferviewconfig.h" #include "bufferviewfilter.h" diff --git a/src/qtui/settingspages/chatmonitorsettingspage.cpp b/src/qtui/settingspages/chatmonitorsettingspage.cpp index f2855eff..24ddd220 100644 --- a/src/qtui/settingspages/chatmonitorsettingspage.cpp +++ b/src/qtui/settingspages/chatmonitorsettingspage.cpp @@ -20,13 +20,14 @@ #include "chatmonitorsettingspage.h" +#include + #include "client.h" #include "networkmodel.h" #include "bufferviewconfig.h" #include "buffermodel.h" #include "bufferview.h" #include "bufferviewfilter.h" -#include "iconloader.h" #include "chatviewsettings.h" #include diff --git a/src/qtui/settingspages/coreaccountsettingspage.cpp b/src/qtui/settingspages/coreaccountsettingspage.cpp index 9b667e0a..a4af64e9 100644 --- a/src/qtui/settingspages/coreaccountsettingspage.cpp +++ b/src/qtui/settingspages/coreaccountsettingspage.cpp @@ -20,10 +20,11 @@ #include "coreaccountsettingspage.h" +#include + #include "client.h" #include "clientsettings.h" #include "coreaccountmodel.h" -#include "iconloader.h" CoreAccountSettingsPage::CoreAccountSettingsPage(QWidget *parent) : SettingsPage(tr("Remote Cores"), QString(), parent), diff --git a/src/qtui/settingspages/identitiessettingspage.cpp b/src/qtui/settingspages/identitiessettingspage.cpp index 254b216c..577e6e9c 100644 --- a/src/qtui/settingspages/identitiessettingspage.cpp +++ b/src/qtui/settingspages/identitiessettingspage.cpp @@ -20,11 +20,11 @@ #include "identitiessettingspage.h" +#include #include #include #include "client.h" -#include "iconloader.h" #include "signalproxy.h" IdentitiesSettingsPage::IdentitiesSettingsPage(QWidget *parent) diff --git a/src/qtui/settingspages/identityeditwidget.cpp b/src/qtui/settingspages/identityeditwidget.cpp index 13be1c94..0f270c7f 100644 --- a/src/qtui/settingspages/identityeditwidget.cpp +++ b/src/qtui/settingspages/identityeditwidget.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -34,7 +35,6 @@ #endif #include "client.h" -#include "iconloader.h" IdentityEditWidget::IdentityEditWidget(QWidget *parent) : QWidget(parent) diff --git a/src/qtui/settingspages/ignorelistsettingspage.cpp b/src/qtui/settingspages/ignorelistsettingspage.cpp index 53306264..badc9aec 100644 --- a/src/qtui/settingspages/ignorelistsettingspage.cpp +++ b/src/qtui/settingspages/ignorelistsettingspage.cpp @@ -21,6 +21,7 @@ #include "ignorelistsettingspage.h" #include +#include #include #include #include @@ -28,7 +29,6 @@ #include #include #include -#include "iconloader.h" IgnoreListSettingsPage::IgnoreListSettingsPage(QWidget *parent) : SettingsPage(tr("IRC"), tr("Ignore List"), parent) diff --git a/src/qtui/settingspages/keysequencewidget.cpp b/src/qtui/settingspages/keysequencewidget.cpp index 38fa2d9c..eb16be46 100644 --- a/src/qtui/settingspages/keysequencewidget.cpp +++ b/src/qtui/settingspages/keysequencewidget.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -39,7 +40,6 @@ #include "action.h" #include "actioncollection.h" -#include "iconloader.h" #include "keysequencewidget.h" KeySequenceButton::KeySequenceButton(KeySequenceWidget *d_, QWidget *parent) diff --git a/src/qtui/settingspages/networkssettingspage.cpp b/src/qtui/settingspages/networkssettingspage.cpp index c951a5e3..71205cbe 100644 --- a/src/qtui/settingspages/networkssettingspage.cpp +++ b/src/qtui/settingspages/networkssettingspage.cpp @@ -19,13 +19,13 @@ ***************************************************************************/ #include +#include #include #include #include "networkssettingspage.h" #include "client.h" -#include "iconloader.h" #include "identity.h" #include "network.h" #include "presetnetworks.h" diff --git a/src/qtui/simplenetworkeditor.cpp b/src/qtui/simplenetworkeditor.cpp index 901170a3..7079913c 100644 --- a/src/qtui/simplenetworkeditor.cpp +++ b/src/qtui/simplenetworkeditor.cpp @@ -20,7 +20,7 @@ #include "simplenetworkeditor.h" -#include "iconloader.h" +#include #include "networkssettingspage.h" diff --git a/src/qtui/snorenotificationbackend.cpp b/src/qtui/snorenotificationbackend.cpp index d217b9f1..6732c549 100644 --- a/src/qtui/snorenotificationbackend.cpp +++ b/src/qtui/snorenotificationbackend.cpp @@ -24,7 +24,6 @@ #include #include "client.h" -#include "iconloader.h" #include "networkmodel.h" #include "systraynotificationbackend.h" #include "qtui.h" @@ -50,7 +49,7 @@ SnoreNotificationBackend::SnoreNotificationBackend (QObject *parent) //TODO: try to get an instance of the tray icon to be able to show popups m_snore = new Snore::SnoreCore(); m_snore->loadPlugins(Snore::SnorePlugin::BACKEND); - m_icon = Snore::Icon(QIcon::fromTheme("quassel").toImage()); + m_icon = Snore::Icon(QIcon::fromTheme("quassel", QIcon(":/icons/quassel.png")).pixmap(48).toImage()); m_application = Snore::Application("Quassel", m_icon); m_application.hints().setValue("WINDOWS_APP_ID","QuasselProject.QuasselIRC"); diff --git a/src/qtui/statusnotifieritem.cpp b/src/qtui/statusnotifieritem.cpp index df04252b..b29a360f 100644 --- a/src/qtui/statusnotifieritem.cpp +++ b/src/qtui/statusnotifieritem.cpp @@ -51,7 +51,7 @@ public: protected: virtual QString iconNameForAction(QAction *action) // TODO Qt 4.7: fixme when we have converted our iconloader { - Icon icon(action->icon()); + QIcon icon(action->icon()); #if QT_VERSION >= 0x040701 // QIcon::name() is in the 4.7 git branch, but it is not in 4.7 TP. // If you get a build error here, you need to update your pre-release diff --git a/src/qtui/systemtray.cpp b/src/qtui/systemtray.cpp index 62c60b85..69006d13 100644 --- a/src/qtui/systemtray.cpp +++ b/src/qtui/systemtray.cpp @@ -26,7 +26,6 @@ #include "action.h" #include "actioncollection.h" #include "client.h" -#include "iconloader.h" #include "qtui.h" #ifdef HAVE_KDE @@ -40,9 +39,9 @@ SystemTray::SystemTray(QWidget *parent) _mode(Invalid), _state(Passive), _shouldBeVisible(true), - _passiveIcon(QIcon::fromTheme("quassel-inactive")), - _activeIcon(QIcon::fromTheme("quassel")), - _needsAttentionIcon(QIcon::fromTheme("quassel-message")), + _passiveIcon(QIcon::fromTheme("quassel-inactive", QIcon(":/icons/quassel-inactive.png"))), + _activeIcon(QIcon::fromTheme("quassel", QIcon(":/icons/quassel.png"))), + _needsAttentionIcon(QIcon::fromTheme("quassel-message", QIcon(":/icons/quassel-message.png"))), _trayMenu(0), _associatedWidget(parent) { @@ -122,13 +121,13 @@ void SystemTray::setMode(Mode mode_) } -Icon SystemTray::stateIcon() const +QIcon SystemTray::stateIcon() const { return stateIcon(state()); } -Icon SystemTray::stateIcon(State state) const +QIcon SystemTray::stateIcon(State state) const { switch (state) { case Passive: @@ -138,7 +137,7 @@ Icon SystemTray::stateIcon(State state) const case NeedsAttention: return _needsAttentionIcon; } - return Icon(); + return QIcon(); } diff --git a/src/qtui/systemtray.h b/src/qtui/systemtray.h index 151d3492..a359ae16 100644 --- a/src/qtui/systemtray.h +++ b/src/qtui/systemtray.h @@ -21,7 +21,7 @@ #ifndef SYSTEMTRAY_H_ #define SYSTEMTRAY_H_ -#include "icon.h" +#include class Action; class QMenu; @@ -84,7 +84,7 @@ public slots: signals: void activated(SystemTray::ActivationReason); - void iconChanged(const Icon &); + void iconChanged(const QIcon &icon); void animationEnabledChanged(bool); void toolTipChanged(const QString &title, const QString &subtitle); void messageClicked(uint notificationId); @@ -97,8 +97,8 @@ protected: virtual void setMode(Mode mode); inline bool shouldBeVisible() const; - virtual Icon stateIcon() const; - Icon stateIcon(State state) const; + virtual QIcon stateIcon() const; + QIcon stateIcon(State state) const; inline QString toolTipTitle() const; inline QString toolTipSubTitle() const; inline QMenu *trayMenu() const; @@ -116,7 +116,7 @@ private: bool _shouldBeVisible; QString _toolTipTitle, _toolTipSubTitle; - Icon _passiveIcon, _activeIcon, _needsAttentionIcon; + QIcon _passiveIcon, _activeIcon, _needsAttentionIcon; bool _animationEnabled; QMenu *_trayMenu; diff --git a/src/qtui/systraynotificationbackend.cpp b/src/qtui/systraynotificationbackend.cpp index 0d9b8df2..551ae98e 100644 --- a/src/qtui/systraynotificationbackend.cpp +++ b/src/qtui/systraynotificationbackend.cpp @@ -21,14 +21,13 @@ #include #include #include +#include #include #include "systraynotificationbackend.h" #include "client.h" #include "clientsettings.h" -#include "icon.h" -#include "iconloader.h" #include "mainwin.h" #include "networkmodel.h" #include "qtui.h" diff --git a/src/qtui/taskbarnotificationbackend.cpp b/src/qtui/taskbarnotificationbackend.cpp index 62cc60b2..da57eb42 100644 --- a/src/qtui/taskbarnotificationbackend.cpp +++ b/src/qtui/taskbarnotificationbackend.cpp @@ -21,12 +21,12 @@ #include #include #include +#include #include #include "taskbarnotificationbackend.h" #include "clientsettings.h" -#include "iconloader.h" #include "mainwin.h" #include "qtui.h" diff --git a/src/qtui/topicwidget.cpp b/src/qtui/topicwidget.cpp index fbf1443e..8e11e197 100644 --- a/src/qtui/topicwidget.cpp +++ b/src/qtui/topicwidget.cpp @@ -20,8 +20,9 @@ #include "topicwidget.h" +#include + #include "client.h" -#include "iconloader.h" #include "networkmodel.h" #include "uisettings.h" #include "graphicalui.h" diff --git a/src/uisupport/CMakeLists.txt b/src/uisupport/CMakeLists.txt index 8be2e95e..0019f515 100644 --- a/src/uisupport/CMakeLists.txt +++ b/src/uisupport/CMakeLists.txt @@ -17,8 +17,6 @@ set(SOURCES flatproxymodel.cpp fontselector.cpp graphicalui.cpp - icon.cpp - iconloader.cpp multilineedit.cpp networkmodelcontroller.cpp nickview.cpp diff --git a/src/uisupport/bufferviewfilter.cpp b/src/uisupport/bufferviewfilter.cpp index 2720fd11..cadebdac 100644 --- a/src/uisupport/bufferviewfilter.cpp +++ b/src/uisupport/bufferviewfilter.cpp @@ -30,7 +30,6 @@ #include "client.h" #include "clientbufferviewconfig.h" #include "graphicalui.h" -#include "iconloader.h" #include "networkmodel.h" #include "uistyle.h" diff --git a/src/uisupport/clearablelineedit.cpp b/src/uisupport/clearablelineedit.cpp index 57d7868e..5d634948 100644 --- a/src/uisupport/clearablelineedit.cpp +++ b/src/uisupport/clearablelineedit.cpp @@ -20,11 +20,10 @@ #include "clearablelineedit.h" +#include #include #include -#include "iconloader.h" - ClearableLineEdit::ClearableLineEdit(QWidget *parent) : QLineEdit(parent) { diff --git a/src/uisupport/contextmenuactionprovider.cpp b/src/uisupport/contextmenuactionprovider.cpp index e605e3b7..32111045 100644 --- a/src/uisupport/contextmenuactionprovider.cpp +++ b/src/uisupport/contextmenuactionprovider.cpp @@ -18,6 +18,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ +#include #include #include #include @@ -27,7 +28,6 @@ #include "buffermodel.h" #include "buffersettings.h" -#include "iconloader.h" #include "clientidentity.h" #include "network.h" #include "util.h" diff --git a/src/uisupport/icon.cpp b/src/uisupport/icon.cpp deleted file mode 100644 index b4b86efd..00000000 --- a/src/uisupport/icon.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005-2014 by the Quassel Project * - * devel@quassel-irc.org * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) version 3. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - ***************************************************************************/ - -#ifndef HAVE_KDE - -#include "icon.h" -#include "iconloader.h" - -Icon::Icon() : QIcon() -{ -} - - -Icon::Icon(const QString &name) : QIcon() -{ - addPixmap(IconLoader::global()->loadIcon(name, IconLoader::Desktop)); -} - - -Icon::Icon(const QIcon ©) : QIcon(copy) -{ -} - - -Icon &Icon::operator=(const Icon &other) -{ - if (this != &other) { - QIcon::operator=(other); - } - return *this; -} - - -#endif diff --git a/src/uisupport/icon.h b/src/uisupport/icon.h deleted file mode 100644 index b794cd69..00000000 --- a/src/uisupport/icon.h +++ /dev/null @@ -1,57 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005-2014 by the Quassel Project * - * devel@quassel-irc.org * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) version 3. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - ***************************************************************************/ - -#ifndef ICON_H_ -#define ICON_H_ - -#ifndef HAVE_KDE - -#include - -/// A very thin wrapper around QIcon -/** This wrapper class allows us to load an icon by its theme name rather than its full file name. - * The overloaded ctor uses IconLoader to locate an icon with this basename in the current theme - * or in Qt Resources. - */ -class Icon : public QIcon -{ -public: - Icon(); - explicit Icon(const QString &iconName); - explicit Icon(const QIcon ©); - - Icon &operator=(const Icon &other); -}; - - -#else /* HAVE_KDE */ -#include -class Icon : public KIcon -{ -public: - inline Icon() : KIcon() {}; - inline explicit Icon(const QString &iconName) : KIcon(iconName) {}; - inline explicit Icon(const QIcon ©) : KIcon(copy) {}; -}; - - -#endif /* HAVE_KDE */ - -#endif diff --git a/src/uisupport/iconloader.cpp b/src/uisupport/iconloader.cpp deleted file mode 100644 index 940c3422..00000000 --- a/src/uisupport/iconloader.cpp +++ /dev/null @@ -1,191 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005-2014 by the Quassel Project * - * devel@quassel-irc.org * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) version 3. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - ***************************************************************************/ - -#ifndef HAVE_KDE - -#include -#include -#include -#include - -#include "iconloader.h" -#include "quassel.h" -#include "util.h" - -IconLoader IconLoader::_iconLoader; -int IconLoader::_groupSize[] = { 48, 22, 22, 16, 32, 22 }; // default sizes taken from Oxygen - -IconLoader *IconLoader::global() -{ - // Workaround: the static _iconLoader might be initialized before the resources it needs - // This way, first call to global() will init it by setting the theme - if (_iconLoader.theme().isEmpty()) - _iconLoader.setTheme("oxygen"); - return &_iconLoader; -} - - -IconLoader::IconLoader(QObject *parent) : QObject(parent) -{ - // setTheme("oxygen"); -} - - -IconLoader::~IconLoader() -{ -} - - -void IconLoader::setTheme(const QString &theme) -{ - _theme = theme; - // check which dirs could contain themed icons - _themedIconDirNames.clear(); - _plainIconDirNames.clear(); - - // First, look for a system theme - // This is supposed to only work on Unix, though other platforms might set $XDG_DATA_DIRS if they please. - QStringList iconDirNames = QString(qgetenv("XDG_DATA_DIRS")).split(':', QString::SkipEmptyParts); - if (!iconDirNames.isEmpty()) { - for (int i = 0; i < iconDirNames.count(); i++) - iconDirNames[i].append(QString("/icons/")); - } -#ifdef Q_OS_UNIX - else { - // Provide a fallback - iconDirNames << "/usr/share/icons/"; - } - // Add our prefix too - QString appDir = QCoreApplication::applicationDirPath(); - int binpos = appDir.lastIndexOf("/bin"); - if (binpos >= 0) { - appDir.replace(binpos, 4, "/share"); - appDir.append("/icons/"); - if (!iconDirNames.contains(appDir)) - iconDirNames.append(appDir); - } -#endif - - // Now look for an icons/ subdir in our data paths - foreach(const QString &dir, Quassel::dataDirPaths()) - iconDirNames << dir + "icons/"; - - // Add our resource path too - iconDirNames << ":/icons/"; - - // Ready do add theme names - foreach(const QString &dir, iconDirNames) { - QString path = dir + theme + '/'; - if (QFile::exists(path)) - _themedIconDirNames << path; - } - foreach(const QString &dir, iconDirNames) { - QString path = dir + "hicolor/"; - if (QFile::exists(path)) - _themedIconDirNames << path; - } - - // We ship some plain (non-themed) icons in $data/pics - foreach(const QString &dir, Quassel::dataDirPaths()) { - QString path = dir + "pics/"; - if (QFile::exists(path)) - _plainIconDirNames << path; - } - // And of course, our resource path - if (QFile::exists(":/pics")) - _plainIconDirNames << ":/pics"; -} - - -// TODO: optionally implement cache (speed/memory tradeoff?) -QPixmap IconLoader::loadIcon(const QString &name, IconLoader::Group group, int size) -{ - if (group < 0 || group >= LastGroup) { - qWarning() << "Invalid icon group!"; - return QPixmap(); - } - if (size == 0) - size = _groupSize[group]; - - QString path = findIconPath(name, size); - if (path.isEmpty()) return QPixmap(); - - // load the icon - return QPixmap(path); -} - - -QString IconLoader::findIconPath(const QString &name, int size) -{ - QString fname = QString("%1.png").arg(name); // we only support PNG so far - // First, look for a themed icon... we don't do anything fancy here, only exact match for both name and size - foreach(QString basedir, _themedIconDirNames) { - QDir sizedir(QString("%1/%2x%2").arg(basedir).arg(QString::number(size))); - if (sizedir.exists()) { - // ignore context, i.e. scan all subdirs - QStringList contextdirs = sizedir.entryList(QDir::Dirs | QDir::NoDotAndDotDot); - foreach(QString dir, contextdirs) { - QString path = QString("%1/%2/%3").arg(sizedir.absolutePath(), dir, fname); - if (QFile::exists(path)) return path; - } - } - } - // Now check the plain dirs - foreach(QString dir, _plainIconDirNames) { - QString path = QString("%1/%2").arg(dir, name); - if (QFile::exists(path)) return path; - } - - qWarning() << "Icon not found:" << name << size; - return QString(); -} - - -// Convenience constructors - -QPixmap DesktopIcon(const QString &name, int force_size) -{ - IconLoader *loader = IconLoader::global(); - return loader->loadIcon(name, IconLoader::Desktop, force_size); -} - - -QPixmap BarIcon(const QString &name, int force_size) -{ - IconLoader *loader = IconLoader::global(); - return loader->loadIcon(name, IconLoader::Toolbar, force_size); -} - - -QPixmap MainBarIcon(const QString &name, int force_size) -{ - IconLoader *loader = IconLoader::global(); - return loader->loadIcon(name, IconLoader::MainToolbar, force_size); -} - - -QPixmap SmallIcon(const QString &name, int force_size) -{ - IconLoader *loader = IconLoader::global(); - return loader->loadIcon(name, IconLoader::Small, force_size); -} - - -#endif diff --git a/src/uisupport/iconloader.h b/src/uisupport/iconloader.h deleted file mode 100644 index ee94db60..00000000 --- a/src/uisupport/iconloader.h +++ /dev/null @@ -1,120 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005-2014 by the Quassel Project * - * devel@quassel-irc.org * - * * - * Based in part on KDE's kiconloader.h * - * This declares a subset of that API. * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) version 3. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - ***************************************************************************/ - -#ifndef ICONLOADER_H_ -#define ICONLOADER_H_ - -#ifndef HAVE_KDE - -#include - -/// Provides basic facilities to load icons from standard locations or resources -/** This implements a (very) basic subset of KIconLoader's API, such that we can use those classes - * interchangeably in Quassel. - * - * We currently (unless somebody does a more fancy implementation ;-)) assume the Oxygen icon theme - * to be used. In particular, this means that we do assume its directory layout and existing icons to - * be present. Though it should be easy to switch to a different theme name, we don't currently support - * any fallback mechanism if this other theme misses an icon for a given size. Also, we only support PNG. - * - * Since we do support integrating the required part of Oxygen into the binary via Qt Resources, this - * should work for everyone for now. - * - * - $XDG_DATA_DIRS/icons/$theme (in order) - * - :/icons/$theme (fallback in case we use Qt Resources) - * - $XDG_DATA_DIRS/apps/quassel/icons/hicolor (our own unthemed icons) - * - :/icons/hicolor - * - $XDG_DATA_DIRS/apps/quassel/pics - * - :/pics - * - * We don't search for size/context dirs in /pics, i.e. for a given $name, we expect pics/$name.png. - */ -class IconLoader : public QObject -{ - Q_OBJECT - -public: - enum Group { - NoGroup = -1, ///< No group - Desktop = 0, ///< Desktop icons - Toolbar, ///< Toolbar icons - MainToolbar, ///< Main toolbar icons - Small, ///< Small icons, e.g. for buttons - Panel, ///< Panel icons - Dialog, ///< Icons for use in dialog title etc. - LastGroup - }; - - /// Standard icon sizes - enum StdSizes { - SizeSmall = 16, ///< Small icons for menu entries - SizeSmallMedium = 22, ///< Slightly larger small icons for toolbars, panels, etc - SizeMedium = 32, ///< Medium-sized icons for the desktop - SizeLarge = 48, ///< Large icons for the panel - SizeHuge = 64, ///< Huge icons for iconviews - SizeEnormous = 128 ///< Enormous icons for iconviews - }; - - explicit IconLoader(QObject *parent = 0); - ~IconLoader(); - - static IconLoader *global(); - - /// Load a pixmap for the given name and group - QPixmap loadIcon(const QString &name, IconLoader::Group group, int size = 0); - - inline QString theme() const; - void setTheme(const QString &name); - -private: - QString findIconPath(const QString &name, int size); - - static IconLoader _iconLoader; - QString _theme; - QStringList _themedIconDirNames; - QStringList _plainIconDirNames; - static int _groupSize[]; -}; - - -// convenience -QPixmap DesktopIcon(const QString &name, int size = 0); -QPixmap BarIcon(const QString &name, int size = 0); -QPixmap MainBarIcon(const QString &name, int size = 0); -QPixmap SmallIcon(const QString &name, int size = 0); -//QPixmap SmallMediumIcon(const QString &name, int size = 0); // not part of KIconLoader - -QString IconLoader::theme() const { return _theme; } - -#else /* HAVE_KDE */ - -#include -class IconLoader : public KIconLoader -{ - Q_OBJECT -}; - - -#endif /* HAVE_KDE */ - -#endif diff --git a/src/uisupport/networkmodelcontroller.cpp b/src/uisupport/networkmodelcontroller.cpp index 0dcd718a..74a5bda4 100644 --- a/src/uisupport/networkmodelcontroller.cpp +++ b/src/uisupport/networkmodelcontroller.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -31,7 +32,6 @@ #include "buffermodel.h" #include "buffersettings.h" -#include "iconloader.h" #include "clientidentity.h" #include "network.h" #include "util.h" diff --git a/src/uisupport/nickviewfilter.cpp b/src/uisupport/nickviewfilter.cpp index 83a7ce33..fdb58710 100644 --- a/src/uisupport/nickviewfilter.cpp +++ b/src/uisupport/nickviewfilter.cpp @@ -22,7 +22,6 @@ #include "buffersettings.h" #include "graphicalui.h" -#include "iconloader.h" #include "networkmodel.h" #include "uistyle.h" diff --git a/src/uisupport/toolbaractionprovider.cpp b/src/uisupport/toolbaractionprovider.cpp index 15d89b0a..00d5cd11 100644 --- a/src/uisupport/toolbaractionprovider.cpp +++ b/src/uisupport/toolbaractionprovider.cpp @@ -18,13 +18,12 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ +#include #include #include #include "toolbaractionprovider.h" -#include "iconloader.h" - ToolBarActionProvider::ToolBarActionProvider(QObject *parent) : NetworkModelController(parent) { diff --git a/src/uisupport/uistyle.cpp b/src/uisupport/uistyle.cpp index d219f270..838cfcad 100644 --- a/src/uisupport/uistyle.cpp +++ b/src/uisupport/uistyle.cpp @@ -19,9 +19,9 @@ ***************************************************************************/ #include +#include #include "buffersettings.h" -#include "iconloader.h" #include "qssparser.h" #include "quassel.h" #include "uistyle.h"