1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-28 11:42:42 +01:00

Added offline account icons.

This commit is contained in:
Teo Mrnjavac 2012-08-14 15:17:04 +02:00
parent f313ba473e
commit eb559dd0a0
13 changed files with 48 additions and 21 deletions

View File

@ -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" );
}

View File

@ -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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@ -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()

View File

@ -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();

View File

@ -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" );
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

@ -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>

View File

@ -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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@ -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>" +

View File

@ -96,3 +96,12 @@ AccountsToolButton::popupHidden() //SLOT
{
setDown( false );
}
QSize
AccountsToolButton::sizeHint() const
{
QSize size = QToolButton::sizeHint();
size.rwidth() *= 3;
return size;
}

View File

@ -34,6 +34,8 @@ class DLLEXPORT AccountsToolButton : public QToolButton
public:
explicit AccountsToolButton( QWidget* parent = 0 );
QSize sizeHint() const;
protected:
void mousePressEvent( QMouseEvent *event );