diff --git a/src/accounts/twitter/TwitterAccount.cpp b/src/accounts/twitter/TwitterAccount.cpp index 9345782d1..12b368cb7 100644 --- a/src/accounts/twitter/TwitterAccount.cpp +++ b/src/accounts/twitter/TwitterAccount.cpp @@ -227,8 +227,11 @@ TwitterAccount::connectAuthVerifyReply( const QTweetUser &user ) QPixmap -TwitterAccount::icon() const { - return QPixmap( ":/twitter-icon.png" ); +TwitterAccount::icon() const +{ + if ( connectionState() == Connected ) + return QPixmap( ":/twitter-icon.png" ); + return QPixmap( ":/twitter-offline-icon.png" ); } diff --git a/src/accounts/twitter/resources.qrc b/src/accounts/twitter/resources.qrc index fc7df302f..db832b626 100644 --- a/src/accounts/twitter/resources.qrc +++ b/src/accounts/twitter/resources.qrc @@ -1,5 +1,6 @@ -<!DOCTYPE RCC><RCC version="1.0"> -<qresource> -<file>twitter-icon.png</file> -</qresource> +<RCC> + <qresource prefix="/"> + <file>twitter-icon.png</file> + <file>twitter-offline-icon.png</file> + </qresource> </RCC> diff --git a/src/accounts/twitter/twitter-offline-icon.png b/src/accounts/twitter/twitter-offline-icon.png new file mode 100644 index 000000000..be52bdfba Binary files /dev/null and b/src/accounts/twitter/twitter-offline-icon.png differ diff --git a/src/accounts/xmpp/XmppAccount.cpp b/src/accounts/xmpp/XmppAccount.cpp index afe8d8f7f..9dedb08d4 100644 --- a/src/accounts/xmpp/XmppAccount.cpp +++ b/src/accounts/xmpp/XmppAccount.cpp @@ -53,6 +53,14 @@ XmppAccount::~XmppAccount() delete m_xmppSipPlugin.data(); } +QPixmap +XmppAccount::icon() const +{ + if ( connectionState() == Connected ) + return QPixmap( ":/xmpp-icon.png" ); + return QPixmap( ":/xmpp-offline-icon.png" ); +} + void XmppAccount::authenticate() diff --git a/src/accounts/xmpp/XmppAccount.h b/src/accounts/xmpp/XmppAccount.h index 2de8852d1..61d230846 100644 --- a/src/accounts/xmpp/XmppAccount.h +++ b/src/accounts/xmpp/XmppAccount.h @@ -63,7 +63,7 @@ public: XmppAccount( const QString &accountId ); virtual ~XmppAccount(); - QPixmap icon() const { return QPixmap( ":/xmpp-icon.png" ); } + QPixmap icon() const; void authenticate(); void deauthenticate(); diff --git a/src/accounts/xmpp/googlewrapper/GoogleWrapper.cpp b/src/accounts/xmpp/googlewrapper/GoogleWrapper.cpp index a5395a385..6dd45fcf4 100644 --- a/src/accounts/xmpp/googlewrapper/GoogleWrapper.cpp +++ b/src/accounts/xmpp/googlewrapper/GoogleWrapper.cpp @@ -98,7 +98,9 @@ GoogleWrapper::~GoogleWrapper() QPixmap GoogleWrapper::icon() const { - return QPixmap( ":/gmail-logo.png" ); + if ( connectionState() == Connected ) + return QPixmap( ":/gmail-logo.png" ); + return QPixmap( ":/gmail-offline-logo.png" ); } diff --git a/src/accounts/xmpp/googlewrapper/gmail-offline-logo.png b/src/accounts/xmpp/googlewrapper/gmail-offline-logo.png new file mode 100644 index 000000000..1d91fffa2 Binary files /dev/null and b/src/accounts/xmpp/googlewrapper/gmail-offline-logo.png differ diff --git a/src/accounts/xmpp/googlewrapper/resources.qrc b/src/accounts/xmpp/googlewrapper/resources.qrc index b3838d682..7c85f6b38 100644 --- a/src/accounts/xmpp/googlewrapper/resources.qrc +++ b/src/accounts/xmpp/googlewrapper/resources.qrc @@ -1,5 +1,6 @@ -<!DOCTYPE RCC><RCC version="1.0"> -<qresource> -<file>gmail-logo.png</file> -</qresource> +<RCC> + <qresource prefix="/"> + <file>gmail-logo.png</file> + <file>gmail-offline-logo.png</file> + </qresource> </RCC> diff --git a/src/accounts/xmpp/resources.qrc b/src/accounts/xmpp/resources.qrc index 7240db9d3..70888b9cf 100644 --- a/src/accounts/xmpp/resources.qrc +++ b/src/accounts/xmpp/resources.qrc @@ -1,5 +1,6 @@ -<!DOCTYPE RCC><RCC version="1.0"> -<qresource> -<file>xmpp-icon.png</file> -</qresource> +<RCC> + <qresource prefix="/"> + <file>xmpp-icon.png</file> + <file>xmpp-offline-icon.png</file> + </qresource> </RCC> diff --git a/src/accounts/xmpp/xmpp-offline-icon.png b/src/accounts/xmpp/xmpp-offline-icon.png new file mode 100644 index 000000000..0f1d1095a Binary files /dev/null and b/src/accounts/xmpp/xmpp-offline-icon.png differ diff --git a/src/widgets/AccountWidget.cpp b/src/widgets/AccountWidget.cpp index da57f01e4..69a19673b 100644 --- a/src/widgets/AccountWidget.cpp +++ b/src/widgets/AccountWidget.cpp @@ -139,16 +139,16 @@ AccountWidget::~AccountWidget() void AccountWidget::update( const QPersistentModelIndex& idx, int accountIdx ) { - const QPixmap &pixmap = static_cast< QPixmap >( idx.data( Qt::DecorationRole ).value< QPixmap >() ); - QSize pixmapSize( 32, 32 ); - m_imageLabel->setPixmap( pixmap.scaled( pixmapSize, Qt::KeepAspectRatio, Qt::SmoothTransformation ) ); - m_imageLabel->setFixedSize( pixmapSize ); - Tomahawk::Accounts::Account* account = idx.data( Tomahawk::Accounts::AccountModel::ChildrenOfFactoryRole ) .value< QList< Tomahawk::Accounts::Account* > >().at( accountIdx ); if ( account ) { + const QPixmap& pixmap = account->icon(); + QSize pixmapSize( 32, 32 ); + m_imageLabel->setPixmap( pixmap.scaled( pixmapSize, Qt::KeepAspectRatio, Qt::SmoothTransformation ) ); + m_imageLabel->setFixedSize( pixmapSize ); + QFontMetrics fm = m_idLabel->fontMetrics(); m_idLabel->setText( account->accountFriendlyName() ); m_idLabel->setToolTip( "<b>" + diff --git a/src/widgets/AccountsToolButton.cpp b/src/widgets/AccountsToolButton.cpp index 67777a75a..991eeec38 100644 --- a/src/widgets/AccountsToolButton.cpp +++ b/src/widgets/AccountsToolButton.cpp @@ -96,3 +96,12 @@ AccountsToolButton::popupHidden() //SLOT { setDown( false ); } + + +QSize +AccountsToolButton::sizeHint() const +{ + QSize size = QToolButton::sizeHint(); + size.rwidth() *= 3; + return size; +} diff --git a/src/widgets/AccountsToolButton.h b/src/widgets/AccountsToolButton.h index 2524dd26b..d5a74b442 100644 --- a/src/widgets/AccountsToolButton.h +++ b/src/widgets/AccountsToolButton.h @@ -34,6 +34,8 @@ class DLLEXPORT AccountsToolButton : public QToolButton public: explicit AccountsToolButton( QWidget* parent = 0 ); + QSize sizeHint() const; + protected: void mousePressEvent( QMouseEvent *event );