mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-12 17:14:00 +02:00
Czeched, polished and finnished
This commit is contained in:
@@ -153,7 +153,7 @@ Account::removeFromConfig()
|
||||
void
|
||||
Account::testConfig()
|
||||
{
|
||||
emit configTestResult( ConfigTestResultSuccess, "" );
|
||||
emit configTestResult( ConfigTestResultSuccess );
|
||||
}
|
||||
|
||||
|
||||
|
@@ -167,7 +167,7 @@ signals:
|
||||
void connectionStateChanged( Tomahawk::Accounts::Account::ConnectionState state );
|
||||
|
||||
void configurationChanged();
|
||||
void configTestResult( int, const QString& );
|
||||
void configTestResult( int, const QString& = QString() );
|
||||
|
||||
protected:
|
||||
virtual void loadFromConfig( const QString &accountId );
|
||||
|
@@ -227,12 +227,7 @@ DelegateConfigWrapper::onConfigTestResult( int code, const QString& message )
|
||||
|
||||
m_invalidData = m_widget->readData();
|
||||
|
||||
QString msg;
|
||||
if (message.isEmpty()){
|
||||
msg = getTestConfigMessage(code);
|
||||
} else {
|
||||
msg = message;
|
||||
}
|
||||
QString msg = !message.isEmpty() ? message : getTestConfigMessage( code );
|
||||
m_errorLabel->setText( QString( "<font color='red'>%1</font>" ).arg( msg ) );
|
||||
}
|
||||
}
|
||||
@@ -242,15 +237,15 @@ DelegateConfigWrapper::getTestConfigMessage( int code )
|
||||
{
|
||||
switch(code) {
|
||||
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:
|
||||
return QObject::tr( "Username or password incorrect." );
|
||||
return tr( "Username or password incorrect." );
|
||||
case Tomahawk::Accounts::ConfigTestResultInvalidAccount:
|
||||
return QObject::tr( "Account rejected by server." );
|
||||
return tr( "Account rejected by server." );
|
||||
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:
|
||||
return QObject::tr( "Your account has expired." );
|
||||
return tr( "Your account has expired." );
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -547,7 +547,7 @@ ResolverAccount::testConfig()
|
||||
}
|
||||
else
|
||||
{
|
||||
emit configTestResult( Accounts::ConfigTestResultSuccess, "" );
|
||||
emit configTestResult( Accounts::ConfigTestResultSuccess );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -564,13 +564,13 @@ ResolverAccount::onTestConfig( const QVariant& result )
|
||||
{
|
||||
tLog() << Q_FUNC_INFO << result;
|
||||
|
||||
if (result.type() == QMetaType::QString)
|
||||
if ( result.type() == QMetaType::QString )
|
||||
{
|
||||
emit configTestResult( Accounts::ConfigTestResultOther, result.toString() );
|
||||
}
|
||||
else
|
||||
{
|
||||
emit configTestResult( result.toInt(), "" );
|
||||
emit configTestResult( result.toInt() );
|
||||
}
|
||||
|
||||
sender()->deleteLater();
|
||||
|
@@ -92,7 +92,7 @@ ScriptJob::reportResultsMap( const QVariantMap& data )
|
||||
void
|
||||
ScriptJob::reportResults( const QVariant& data )
|
||||
{
|
||||
m_data_primitive = data;
|
||||
m_data = data;
|
||||
emit done( data );
|
||||
}
|
||||
|
||||
@@ -102,5 +102,6 @@ ScriptJob::reportFailure( const QString& errorMessage )
|
||||
{
|
||||
emit error( errorMessage );
|
||||
|
||||
reportResultsMap( QVariantMap() );
|
||||
reportResults();
|
||||
reportResultsMap();
|
||||
}
|
||||
|
@@ -65,8 +65,7 @@ protected:
|
||||
bool m_error;
|
||||
QString m_id;
|
||||
scriptobject_ptr m_scriptObject;
|
||||
QVariantMap m_data;
|
||||
QVariant m_data_primitive;
|
||||
QVariant m_data;
|
||||
QString m_methodName;
|
||||
QVariantMap m_arguments;
|
||||
};
|
||||
|
@@ -30,5 +30,5 @@ Tomahawk::SyncScriptJob::SyncScriptJob( const QVariantMap& resultData )
|
||||
void
|
||||
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() ) );
|
||||
}
|
||||
|
Reference in New Issue
Block a user