1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-14 04:49:43 +01:00

Process events while parsing potentially very long script responses

This commit is contained in:
Dominik Schmidt 2016-01-18 00:14:52 +01:00
parent 53de4319b6
commit 1025e77d3e
3 changed files with 12 additions and 0 deletions

View File

@ -34,7 +34,9 @@
// TODO:
#include "../Result.h"
#include "../Track.h"
#include <QTime>
#include <QCoreApplication>
using namespace Tomahawk;
@ -261,6 +263,8 @@ ScriptAccount::parseResultVariantList( const QVariantList& reslist )
foreach( const QVariant& rv, reslist )
{
QCoreApplication::processEvents();
QVariantMap m = rv.toMap();
int duration = m.value( "duration", 0 ).toInt();

View File

@ -28,6 +28,8 @@
#include "ScriptJob.h"
#include "ScriptCommand_AllArtists.h"
#include <QCoreApplication>
using namespace Tomahawk;
ScriptCommand_AllAlbums::ScriptCommand_AllAlbums( const Tomahawk::collection_ptr& collection,
@ -153,6 +155,8 @@ ScriptCommand_AllAlbums::parseAlbumVariantList( const QList< Tomahawk::artist_pt
bool useArtistList = ( artists.length() > 1 );
for( int i = 0; i < reslist.length(); i++ )
{
QCoreApplication::processEvents();
const QString val = reslist[ i ].toString();
if ( val.trimmed().isEmpty() )
continue;

View File

@ -27,6 +27,8 @@
#include "utils/Logger.h"
#include "../Typedefs.h"
#include <QCoreApplication>
using namespace Tomahawk;
ScriptCommand_AllArtists::ScriptCommand_AllArtists( const Tomahawk::collection_ptr& collection,
@ -112,6 +114,8 @@ ScriptCommand_AllArtists::parseArtistVariantList( const QVariantList& reslist )
foreach( const QVariant& rv, reslist )
{
QCoreApplication::processEvents();
const QString val = rv.toString();
if ( val.trimmed().isEmpty() )
continue;