1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-15 10:33:59 +02:00

Czeched, polished and finnished

This commit is contained in:
Enno Gottschalk
2016-03-02 17:11:01 +01:00
parent 102c9c6846
commit 9a741cd2db
7 changed files with 16 additions and 21 deletions

View File

@@ -153,7 +153,7 @@ Account::removeFromConfig()
void void
Account::testConfig() Account::testConfig()
{ {
emit configTestResult( ConfigTestResultSuccess, "" ); emit configTestResult( ConfigTestResultSuccess );
} }

View File

@@ -167,7 +167,7 @@ signals:
void connectionStateChanged( Tomahawk::Accounts::Account::ConnectionState state ); void connectionStateChanged( Tomahawk::Accounts::Account::ConnectionState state );
void configurationChanged(); void configurationChanged();
void configTestResult( int, const QString& ); void configTestResult( int, const QString& = QString() );
protected: protected:
virtual void loadFromConfig( const QString &accountId ); virtual void loadFromConfig( const QString &accountId );

View File

@@ -227,12 +227,7 @@ DelegateConfigWrapper::onConfigTestResult( int code, const QString& message )
m_invalidData = m_widget->readData(); m_invalidData = m_widget->readData();
QString msg; QString msg = !message.isEmpty() ? message : getTestConfigMessage( code );
if (message.isEmpty()){
msg = getTestConfigMessage(code);
} else {
msg = message;
}
m_errorLabel->setText( QString( "<font color='red'>%1</font>" ).arg( msg ) ); m_errorLabel->setText( QString( "<font color='red'>%1</font>" ).arg( msg ) );
} }
} }
@@ -242,15 +237,15 @@ DelegateConfigWrapper::getTestConfigMessage( int code )
{ {
switch(code) { switch(code) {
case Tomahawk::Accounts::ConfigTestResultCommunicationError: case Tomahawk::Accounts::ConfigTestResultCommunicationError:
return QObject::tr( "Unable to authenticate. Please check your connection." ); return tr( "Unable to authenticate. Please check your connection." );
case Tomahawk::Accounts::ConfigTestResultInvalidCredentials: case Tomahawk::Accounts::ConfigTestResultInvalidCredentials:
return QObject::tr( "Username or password incorrect." ); return tr( "Username or password incorrect." );
case Tomahawk::Accounts::ConfigTestResultInvalidAccount: case Tomahawk::Accounts::ConfigTestResultInvalidAccount:
return QObject::tr( "Account rejected by server." ); return tr( "Account rejected by server." );
case Tomahawk::Accounts::ConfigTestResultPlayingElsewhere: case Tomahawk::Accounts::ConfigTestResultPlayingElsewhere:
return QObject::tr( "Action not allowed, account is in use elsewhere." ); return tr( "Action not allowed, account is in use elsewhere." );
case Tomahawk::Accounts::ConfigTestResultAccountExpired: case Tomahawk::Accounts::ConfigTestResultAccountExpired:
return QObject::tr( "Your account has expired." ); return tr( "Your account has expired." );
} }
} }

View File

@@ -547,7 +547,7 @@ ResolverAccount::testConfig()
} }
else else
{ {
emit configTestResult( Accounts::ConfigTestResultSuccess, "" ); emit configTestResult( Accounts::ConfigTestResultSuccess );
} }
} }
@@ -564,13 +564,13 @@ ResolverAccount::onTestConfig( const QVariant& result )
{ {
tLog() << Q_FUNC_INFO << result; tLog() << Q_FUNC_INFO << result;
if (result.type() == QMetaType::QString) if ( result.type() == QMetaType::QString )
{ {
emit configTestResult( Accounts::ConfigTestResultOther, result.toString() ); emit configTestResult( Accounts::ConfigTestResultOther, result.toString() );
} }
else else
{ {
emit configTestResult( result.toInt(), "" ); emit configTestResult( result.toInt() );
} }
sender()->deleteLater(); sender()->deleteLater();

View File

@@ -92,7 +92,7 @@ ScriptJob::reportResultsMap( const QVariantMap& data )
void void
ScriptJob::reportResults( const QVariant& data ) ScriptJob::reportResults( const QVariant& data )
{ {
m_data_primitive = data; m_data = data;
emit done( data ); emit done( data );
} }
@@ -102,5 +102,6 @@ ScriptJob::reportFailure( const QString& errorMessage )
{ {
emit error( errorMessage ); emit error( errorMessage );
reportResultsMap( QVariantMap() ); reportResults();
reportResultsMap();
} }

View File

@@ -65,8 +65,7 @@ protected:
bool m_error; bool m_error;
QString m_id; QString m_id;
scriptobject_ptr m_scriptObject; scriptobject_ptr m_scriptObject;
QVariantMap m_data; QVariant m_data;
QVariant m_data_primitive;
QString m_methodName; QString m_methodName;
QVariantMap m_arguments; QVariantMap m_arguments;
}; };

View File

@@ -30,5 +30,5 @@ Tomahawk::SyncScriptJob::SyncScriptJob( const QVariantMap& resultData )
void void
Tomahawk::SyncScriptJob::start() Tomahawk::SyncScriptJob::start()
{ {
QMetaObject::invokeMethod( this, "reportResultsMap", Qt::QueuedConnection, Q_ARG( QVariantMap, m_data ) ); QMetaObject::invokeMethod( this, "reportResultsMap", Qt::QueuedConnection, Q_ARG( QVariantMap, m_data.toMap() ) );
} }