mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-07-31 11:20:22 +02:00
Style fix and timeout fix
This commit is contained in:
@@ -110,13 +110,19 @@ ChartsPlugin::getInfo( uint requestId, Tomahawk::InfoSystem::InfoRequestData req
|
|||||||
{
|
{
|
||||||
dataError( requestId, requestData );
|
dataError( requestId, requestData );
|
||||||
break;
|
break;
|
||||||
}else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
foreach(QVariant resource, m_chartResources)
|
foreach( QVariant resource, m_chartResources )
|
||||||
if(resource.toString() == hash["chart_source"])
|
{
|
||||||
|
if( resource.toString() == hash["chart_source"] )
|
||||||
|
{
|
||||||
foundSource = true;
|
foundSource = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!foundSource){
|
if( !foundSource )
|
||||||
|
{
|
||||||
dataError( requestId, requestData );
|
dataError( requestId, requestData );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -398,7 +398,7 @@ LastFmPlugin::notInCacheSlot( uint requestId, QHash<QString, QString> criteria,
|
|||||||
emit info( requestId, requestData, QVariant() );
|
emit info( requestId, requestData, QVariant() );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bool foundSource;
|
|
||||||
InfoCriteriaHash hash = requestData.input.value< Tomahawk::InfoSystem::InfoCriteriaHash >();
|
InfoCriteriaHash hash = requestData.input.value< Tomahawk::InfoSystem::InfoCriteriaHash >();
|
||||||
switch ( requestData.type )
|
switch ( requestData.type )
|
||||||
{
|
{
|
||||||
@@ -409,9 +409,11 @@ LastFmPlugin::notInCacheSlot( uint requestId, QHash<QString, QString> criteria,
|
|||||||
{
|
{
|
||||||
dataError( requestId, requestData );
|
dataError( requestId, requestData );
|
||||||
break;
|
break;
|
||||||
}else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if("last.fm" != hash["chart_source"]){
|
if( "last.fm" != hash["chart_source"] )
|
||||||
|
{
|
||||||
dataError( requestId, requestData );
|
dataError( requestId, requestData );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -66,14 +66,14 @@ WhatsHotWidget::WhatsHotWidget( QWidget* parent )
|
|||||||
//set crumb widgets
|
//set crumb widgets
|
||||||
SiblingCrumbButtonFactory * crumbFactory = new SiblingCrumbButtonFactory;
|
SiblingCrumbButtonFactory * crumbFactory = new SiblingCrumbButtonFactory;
|
||||||
|
|
||||||
m_crumbModelLeft = new QStandardItemModel(this);
|
m_crumbModelLeft = new QStandardItemModel( this );
|
||||||
|
|
||||||
ui->breadCrumbLeft->setButtonFactory(crumbFactory);
|
ui->breadCrumbLeft->setButtonFactory( crumbFactory );
|
||||||
ui->breadCrumbLeft->setModel(m_crumbModelLeft);
|
ui->breadCrumbLeft->setModel( m_crumbModelLeft );
|
||||||
ui->breadCrumbLeft->setRootIcon(QIcon( RESPATH "images/charts.png" ));
|
ui->breadCrumbLeft->setRootIcon(QIcon( RESPATH "images/charts.png" ));
|
||||||
ui->breadCrumbLeft->setUseAnimation(true);
|
ui->breadCrumbLeft->setUseAnimation( true );
|
||||||
|
|
||||||
connect(ui->breadCrumbLeft, SIGNAL(currentIndexChanged(QModelIndex)), SLOT(leftCrumbIndexChanged(QModelIndex)));
|
connect( ui->breadCrumbLeft, SIGNAL( currentIndexChanged( QModelIndex ) ), SLOT( leftCrumbIndexChanged(QModelIndex) ) );
|
||||||
|
|
||||||
m_albumsModel = new AlbumModel( ui->additionsView );
|
m_albumsModel = new AlbumModel( ui->additionsView );
|
||||||
ui->additionsView->setAlbumModel( m_albumsModel );
|
ui->additionsView->setAlbumModel( m_albumsModel );
|
||||||
@@ -121,7 +121,7 @@ WhatsHotWidget::WhatsHotWidget( QWidget* parent )
|
|||||||
|
|
||||||
connect( Tomahawk::InfoSystem::InfoSystem::instance(), SIGNAL( finished( QString ) ), SLOT( infoSystemFinished( QString ) ) );
|
connect( Tomahawk::InfoSystem::InfoSystem::instance(), SIGNAL( finished( QString ) ), SLOT( infoSystemFinished( QString ) ) );
|
||||||
|
|
||||||
QTimer::singleShot( 2000, this, SLOT( fetchData() ) );
|
QTimer::singleShot( 0, this, SLOT( fetchData() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -142,7 +142,7 @@ WhatsHotWidget::fetchData()
|
|||||||
requestData.input = QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( artistInfo );
|
requestData.input = QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( artistInfo );
|
||||||
|
|
||||||
requestData.type = Tomahawk::InfoSystem::InfoChartCapabilities;
|
requestData.type = Tomahawk::InfoSystem::InfoChartCapabilities;
|
||||||
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( requestData, 2000, true );
|
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( requestData, 20000, true );
|
||||||
|
|
||||||
tDebug( LOGVERBOSE ) << "WhatsHot: requested InfoChartCapabilities";
|
tDebug( LOGVERBOSE ) << "WhatsHot: requested InfoChartCapabilities";
|
||||||
}
|
}
|
||||||
@@ -269,7 +269,7 @@ void
|
|||||||
WhatsHotWidget::leftCrumbIndexChanged( QModelIndex index )
|
WhatsHotWidget::leftCrumbIndexChanged( QModelIndex index )
|
||||||
{
|
{
|
||||||
tDebug( LOGVERBOSE ) << "WhatsHot:: left crumb changed" << index.data();
|
tDebug( LOGVERBOSE ) << "WhatsHot:: left crumb changed" << index.data();
|
||||||
QStandardItem* item = m_crumbModelLeft->itemFromIndex(index);
|
QStandardItem* item = m_crumbModelLeft->itemFromIndex( index );
|
||||||
if( !item )
|
if( !item )
|
||||||
return;
|
return;
|
||||||
if( !item->data().isValid() )
|
if( !item->data().isValid() )
|
||||||
@@ -277,7 +277,7 @@ WhatsHotWidget::leftCrumbIndexChanged( QModelIndex index )
|
|||||||
|
|
||||||
|
|
||||||
QList<QModelIndex> indexes;
|
QList<QModelIndex> indexes;
|
||||||
while (index.parent().isValid())
|
while ( index.parent().isValid() )
|
||||||
{
|
{
|
||||||
indexes.prepend(index);
|
indexes.prepend(index);
|
||||||
index = index.parent();
|
index = index.parent();
|
||||||
@@ -287,19 +287,19 @@ WhatsHotWidget::leftCrumbIndexChanged( QModelIndex index )
|
|||||||
const QString chartId = item->data().toString();
|
const QString chartId = item->data().toString();
|
||||||
|
|
||||||
Tomahawk::InfoSystem::InfoCriteriaHash criteria;
|
Tomahawk::InfoSystem::InfoCriteriaHash criteria;
|
||||||
criteria.insert("chart_id", chartId);
|
criteria.insert( "chart_id", chartId );
|
||||||
/// Remember to lower the source!
|
/// Remember to lower the source!
|
||||||
criteria.insert("chart_source", index.data().toString().toLower());
|
criteria.insert( "chart_source", index.data().toString().toLower() );
|
||||||
|
|
||||||
Tomahawk::InfoSystem::InfoRequestData requestData;
|
Tomahawk::InfoSystem::InfoRequestData requestData;
|
||||||
QVariantMap customData;
|
QVariantMap customData;
|
||||||
customData.insert("whatshot_side", "left");
|
customData.insert( "whatshot_side", "left" );
|
||||||
requestData.caller = s_whatsHotIdentifier;
|
requestData.caller = s_whatsHotIdentifier;
|
||||||
requestData.customData = customData;
|
requestData.customData = customData;
|
||||||
requestData.input = QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( criteria );
|
requestData.input = QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( criteria );
|
||||||
|
|
||||||
requestData.type = Tomahawk::InfoSystem::InfoChart;
|
requestData.type = Tomahawk::InfoSystem::InfoChart;
|
||||||
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( requestData, 2000, true );
|
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( requestData, 20000, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -326,28 +326,31 @@ WhatsHotWidget::parseNode(QStandardItem* parentItem, const QString &label, const
|
|||||||
tDebug( LOGVERBOSE ) << "WhatsHot:: parsing " << label;
|
tDebug( LOGVERBOSE ) << "WhatsHot:: parsing " << label;
|
||||||
|
|
||||||
QStandardItem *sourceItem = new QStandardItem(label);
|
QStandardItem *sourceItem = new QStandardItem(label);
|
||||||
|
|
||||||
if( data.canConvert<QList<Tomahawk::InfoSystem::Chart> >() )
|
if( data.canConvert<QList<Tomahawk::InfoSystem::Chart> >() )
|
||||||
{
|
{
|
||||||
QList<Tomahawk::InfoSystem::Chart> charts = data.value<QList<Tomahawk::InfoSystem::Chart> >();
|
QList<Tomahawk::InfoSystem::Chart> charts = data.value<QList<Tomahawk::InfoSystem::Chart> >();
|
||||||
foreach( Tomahawk::InfoSystem::Chart chart, charts)
|
foreach( Tomahawk::InfoSystem::Chart chart, charts)
|
||||||
{
|
{
|
||||||
QStandardItem *childItem= new QStandardItem(chart.label);
|
QStandardItem *childItem= new QStandardItem( chart.label );
|
||||||
childItem->setData(chart.id);
|
childItem->setData( chart.id );
|
||||||
sourceItem->appendRow(childItem);
|
sourceItem->appendRow( childItem );
|
||||||
}
|
}
|
||||||
} else if( data.canConvert<QVariantMap>() )
|
}
|
||||||
|
else if( data.canConvert<QVariantMap>() )
|
||||||
{
|
{
|
||||||
QVariantMap dataMap = data.toMap();
|
QVariantMap dataMap = data.toMap();
|
||||||
foreach(const QString childLabel,dataMap.keys())
|
foreach( const QString childLabel,dataMap.keys() )
|
||||||
{
|
{
|
||||||
QStandardItem *childItem = parseNode( sourceItem, childLabel, dataMap[childLabel] );
|
QStandardItem *childItem = parseNode( sourceItem, childLabel, dataMap[childLabel] );
|
||||||
sourceItem->appendRow(childItem);
|
sourceItem->appendRow( childItem );
|
||||||
}
|
}
|
||||||
} else if ( data.canConvert<QVariantList>() )
|
}
|
||||||
|
else if ( data.canConvert<QVariantList>() )
|
||||||
{
|
{
|
||||||
QVariantList dataList = data.toList();
|
QVariantList dataList = data.toList();
|
||||||
|
|
||||||
foreach(const QVariant value, dataList)
|
foreach( const QVariant value, dataList )
|
||||||
{
|
{
|
||||||
QStandardItem *childItem= new QStandardItem(value.toString());
|
QStandardItem *childItem= new QStandardItem(value.toString());
|
||||||
sourceItem->appendRow(childItem);
|
sourceItem->appendRow(childItem);
|
||||||
@@ -356,7 +359,7 @@ WhatsHotWidget::parseNode(QStandardItem* parentItem, const QString &label, const
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
QStandardItem *childItem= new QStandardItem(data.toString());
|
QStandardItem *childItem= new QStandardItem(data.toString());
|
||||||
sourceItem->appendRow(childItem);
|
sourceItem->appendRow( childItem );
|
||||||
}
|
}
|
||||||
return sourceItem;
|
return sourceItem;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user