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:
parent
f313ba473e
commit
eb559dd0a0
@ -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" );
|
||||
}
|
||||
|
||||
|
||||
|
@ -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>
|
||||
|
BIN
src/accounts/twitter/twitter-offline-icon.png
Normal file
BIN
src/accounts/twitter/twitter-offline-icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.6 KiB |
@ -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()
|
||||
|
@ -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();
|
||||
|
@ -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" );
|
||||
}
|
||||
|
||||
|
||||
|
BIN
src/accounts/xmpp/googlewrapper/gmail-offline-logo.png
Normal file
BIN
src/accounts/xmpp/googlewrapper/gmail-offline-logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.6 KiB |
@ -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>
|
||||
|
@ -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>
|
||||
|
BIN
src/accounts/xmpp/xmpp-offline-icon.png
Normal file
BIN
src/accounts/xmpp/xmpp-offline-icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
@ -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>" +
|
||||
|
@ -96,3 +96,12 @@ AccountsToolButton::popupHidden() //SLOT
|
||||
{
|
||||
setDown( false );
|
||||
}
|
||||
|
||||
|
||||
QSize
|
||||
AccountsToolButton::sizeHint() const
|
||||
{
|
||||
QSize size = QToolButton::sizeHint();
|
||||
size.rwidth() *= 3;
|
||||
return size;
|
||||
}
|
||||
|
@ -34,6 +34,8 @@ class DLLEXPORT AccountsToolButton : public QToolButton
|
||||
public:
|
||||
explicit AccountsToolButton( QWidget* parent = 0 );
|
||||
|
||||
QSize sizeHint() const;
|
||||
|
||||
protected:
|
||||
void mousePressEvent( QMouseEvent *event );
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user