1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-23 09:19:41 +01:00

start towards info

This commit is contained in:
Leo Franchi 2012-04-20 16:04:36 -04:00
parent ddd0af895f
commit f7fcfcb452
8 changed files with 39 additions and 2 deletions

View File

@ -134,9 +134,9 @@ AccountDelegate::paint ( QPainter* painter, const QStyleOptionViewItem& option,
QFont authorFont = opt.font;
authorFont.setItalic( true );
authorFont.setPointSize( authorFont.pointSize() - 1 );
#ifdef Q_OS_MAC
#ifdef Q_OS_MAC
authorFont.setPointSize( authorFont.pointSize() - 1 );
#endif
#endif
const QFontMetrics authorMetrics( authorFont );
QFont descFont = authorFont;
@ -658,4 +658,16 @@ AccountDelegate::checkRectForIndex( const QStyleOptionViewItem& option, const QM
}
void
AccountDelegate::startInstalling( const QPersistentModelIndex& idx )
{
qDebug() << "START INSTALLING:" << idx.data( Qt::DisplayRole ).toString();
}
void
AccountDelegate::doneInstalling ( const QPersistentModelIndex& idx )
{
qDebug() << "STOP INSTALLING:" << idx.data( Qt::DisplayRole ).toString();
}

View File

@ -38,6 +38,10 @@ public:
virtual void paint ( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const;
virtual QSize sizeHint ( const QStyleOptionViewItem& option, const QModelIndex& index ) const;
public slots:
void startInstalling( const QPersistentModelIndex& idx );
void doneInstalling ( const QPersistentModelIndex& idx );
protected:
virtual bool editorEvent( QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index );
@ -64,6 +68,7 @@ private:
mutable QHash< QPersistentModelIndex, QRect > m_cachedStarRects;
mutable QHash< QPersistentModelIndex, QRect > m_cachedConfigRects;
mutable QHash< QPersistentModelIndex, QSize > m_sizeHints;
mutable QHash< QPersistentModelIndex, QMovie* > m_loadingSpinners;
mutable int m_accountRowHeight;
};

View File

@ -451,6 +451,7 @@ AccountModel::setData( const QModelIndex& index, const QVariant& value, int role
qDebug() << "Kicked off fetch+install, now waiting";
m_waitingForAtticaInstall.insert( resolver.id() );
emit startInstalling( index );
AtticaManager::instance()->installResolver( resolver );
return true;
}
@ -571,6 +572,10 @@ AccountModel::accountAdded( Account* account )
AccountManager::instance()->enableAccount( account );
m_waitingForAtticaInstall.remove( attica->atticaId() );
// find index to emit doneInstalling for
const QModelIndex idx = index( i, 0, QModelIndex() );
emit doneInstalling( idx );
}
if ( thisIsTheOne )

View File

@ -94,6 +94,8 @@ signals:
void createAccount( Tomahawk::Accounts::AccountFactory* factory );
void scrollTo( const QModelIndex& idx );
void startInstalling( const QPersistentModelIndex& idx );
void doneInstalling( const QPersistentModelIndex& idx );
private slots:
void loadData();

View File

@ -36,6 +36,8 @@ void
AccountModelFilterProxy::setSourceModel( QAbstractItemModel* sourceModel )
{
connect( sourceModel, SIGNAL( scrollTo( QModelIndex ) ), this, SLOT( onScrollTo( QModelIndex ) ) );
connect( sourceModel, SIGNAL( startInstalling( QPersistentModelIndex ) ), this, SIGNAL( startInstalling( QPersistentModelIndex ) ) );
connect( sourceModel, SIGNAL( doneInstalling( QPersistentModelIndex ) ), this, SIGNAL( doneInstalling( QPersistentModelIndex ) ) );
QSortFilterProxyModel::setSourceModel( sourceModel );
}

View File

@ -40,6 +40,9 @@ public:
signals:
void scrollTo( const QModelIndex& idx );
void startInstalling( const QPersistentModelIndex& idx );
void doneInstalling( const QPersistentModelIndex& idx );
protected:
virtual bool filterAcceptsRow ( int sourceRow, const QModelIndex& sourceParent ) const;

View File

@ -0,0 +1,6 @@
#include "LoadingSpinnerPixmap.h"
LoadingSpinnerPixmap::LoadingSpinnerPixmap(QObject *parent) :
QObject(parent)
{
}

View File

@ -114,6 +114,8 @@ SettingsDialog::SettingsDialog( QWidget *parent )
m_accountProxy = new AccountModelFilterProxy( m_accountModel );
m_accountProxy->setSourceModel( m_accountModel );
connect( m_accountProxy, SIGNAL( startInstalling( QPersistentModelIndex ) ), accountDelegate, SLOT( startInstalling(QPersistentModelIndex) ) );
connect( m_accountProxy, SIGNAL( doneInstalling( QPersistentModelIndex ) ), accountDelegate, SLOT( doneInstalling(QPersistentModelIndex) ) );
connect( m_accountProxy, SIGNAL( scrollTo( QModelIndex ) ), this, SLOT( scrollTo( QModelIndex ) ) );
ui->accountsView->setModel( m_accountProxy );