diff --git a/src/libtomahawk/accounts/DelegateConfigWrapper.cpp b/src/libtomahawk/accounts/DelegateConfigWrapper.cpp index 84ba787d7..fbb151f20 100644 --- a/src/libtomahawk/accounts/DelegateConfigWrapper.cpp +++ b/src/libtomahawk/accounts/DelegateConfigWrapper.cpp @@ -22,6 +22,7 @@ #include "../utils/Logger.h" #include +#include DelegateConfigWrapper::DelegateConfigWrapper( Tomahawk::Accounts::Account* account, QWidget* parent, Qt::WindowFlags flags ) @@ -32,6 +33,7 @@ DelegateConfigWrapper::DelegateConfigWrapper( Tomahawk::Accounts::Account* accou , m_buttons( nullptr ) , m_okButton( nullptr ) , m_deleteButton( nullptr ) + , m_errorLabel( new QLabel( this ) ) , m_deleted( false ) { setWindowTitle( tr("%1 Config" ).arg( account->accountFriendlyName() ) ); @@ -65,6 +67,9 @@ DelegateConfigWrapper::DelegateConfigWrapper( Tomahawk::Accounts::Account* accou else if ( m_widget ) h->setContentsMargins( m_widget->contentsMargins() ); + m_errorLabel->setAlignment( Qt::AlignCenter ); + v->addWidget( m_errorLabel ); + v->addLayout( h ); setLayout( v ); @@ -119,6 +124,7 @@ DelegateConfigWrapper::closed( QAbstractButton* b ) return; } + m_errorLabel->setText( "" ); m_account->testConfig(); } else if ( b == m_deleteButton ) @@ -182,12 +188,13 @@ DelegateConfigWrapper::onConfigTestResult( Tomahawk::Accounts::ConfigTestResultT if( result == Tomahawk::Accounts::ConfigTestResultSuccess ) { + m_errorLabel->setText( "" ); closeDialog( QDialog::Accepted ); } else { // TODO: make this nicer - QMessageBox::critical( this, tr( "Error" ), tr( "Your config is invalid and can't be saved." ) ); + m_errorLabel->setText( QString( "%1" ).arg( tr( "Your config is invalid." ) ) ); } } diff --git a/src/libtomahawk/accounts/DelegateConfigWrapper.h b/src/libtomahawk/accounts/DelegateConfigWrapper.h index e24b0f60d..af9f3fc71 100644 --- a/src/libtomahawk/accounts/DelegateConfigWrapper.h +++ b/src/libtomahawk/accounts/DelegateConfigWrapper.h @@ -26,8 +26,11 @@ #include #include + class AccountConfigWidget; +class QLabel; + class DelegateConfigWrapper : public QDialog { Q_OBJECT @@ -64,6 +67,7 @@ private: QWidget* m_aboutW; QDialogButtonBox* m_buttons; QPushButton *m_okButton, *m_deleteButton; + QLabel* m_errorLabel; bool m_deleted; };