mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-16 11:04:01 +02:00
ported LastFm & Twitter config widgets to load credentials on show
This commit is contained in:
@@ -33,10 +33,6 @@ LastFmConfig::LastFmConfig( LastFmAccount* account )
|
|||||||
m_ui = new Ui_LastFmConfig;
|
m_ui = new Ui_LastFmConfig;
|
||||||
m_ui->setupUi( this );
|
m_ui->setupUi( this );
|
||||||
|
|
||||||
m_ui->username->setText( m_account->username() );
|
|
||||||
m_ui->password->setText( m_account->password() );
|
|
||||||
m_ui->enable->setChecked( m_account->scrobble() );
|
|
||||||
|
|
||||||
connect( m_ui->testLogin, SIGNAL( clicked( bool ) ), this, SLOT( testLogin( bool ) ) );
|
connect( m_ui->testLogin, SIGNAL( clicked( bool ) ), this, SLOT( testLogin( bool ) ) );
|
||||||
|
|
||||||
connect( m_ui->username, SIGNAL( textChanged( QString ) ), this, SLOT( enableButton() ) );
|
connect( m_ui->username, SIGNAL( textChanged( QString ) ), this, SLOT( enableButton() ) );
|
||||||
@@ -62,6 +58,15 @@ LastFmConfig::scrobble() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
LastFmConfig::loadFromConfig()
|
||||||
|
{
|
||||||
|
m_ui->username->setText( m_account->username() );
|
||||||
|
m_ui->password->setText( m_account->password() );
|
||||||
|
m_ui->enable->setChecked( m_account->scrobble() );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QString
|
QString
|
||||||
LastFmConfig::username() const
|
LastFmConfig::username() const
|
||||||
{
|
{
|
||||||
@@ -143,3 +148,10 @@ LastFmConfig::onLastFmFinished()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
LastFmConfig::showEvent(QShowEvent* event)
|
||||||
|
{
|
||||||
|
loadFromConfig();
|
||||||
|
}
|
||||||
|
@@ -37,10 +37,15 @@ public:
|
|||||||
QString username() const;
|
QString username() const;
|
||||||
QString password() const;
|
QString password() const;
|
||||||
bool scrobble() const;
|
bool scrobble() const;
|
||||||
|
|
||||||
|
void loadFromConfig();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void testLogin( bool );
|
void testLogin( bool );
|
||||||
void onLastFmFinished();
|
void onLastFmFinished();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void showEvent( QShowEvent* event );
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void enableButton();
|
void enableButton();
|
||||||
|
@@ -57,6 +57,17 @@ TwitterConfigWidget::TwitterConfigWidget( TwitterAccount* account, QWidget *pare
|
|||||||
m_ui->twitterTweetComboBox->setCurrentIndex( 0 );
|
m_ui->twitterTweetComboBox->setCurrentIndex( 0 );
|
||||||
m_ui->twitterTweetGotTomahawkButton->setText( tr( "Tweet!" ) );
|
m_ui->twitterTweetGotTomahawkButton->setText( tr( "Tweet!" ) );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
TwitterConfigWidget::~TwitterConfigWidget()
|
||||||
|
{
|
||||||
|
delete m_ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TwitterConfigWidget::loadConfig()
|
||||||
|
{
|
||||||
QVariantHash credentials = m_account->credentials();
|
QVariantHash credentials = m_account->credentials();
|
||||||
|
|
||||||
if ( credentials[ "oauthtoken" ].toString().isEmpty() ||
|
if ( credentials[ "oauthtoken" ].toString().isEmpty() ||
|
||||||
@@ -78,13 +89,8 @@ TwitterConfigWidget::TwitterConfigWidget( TwitterAccount* account, QWidget *pare
|
|||||||
|
|
||||||
emit twitterAuthed( true );
|
emit twitterAuthed( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TwitterConfigWidget::~TwitterConfigWidget()
|
|
||||||
{
|
|
||||||
delete m_ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TwitterConfigWidget::authDeauthTwitter()
|
TwitterConfigWidget::authDeauthTwitter()
|
||||||
@@ -290,6 +296,14 @@ TwitterConfigWidget::postGotTomahawkStatusUpdateError( QTweetNetBase::ErrorCode
|
|||||||
QMessageBox::critical( this, tr("Tweetin' Error"), tr("There was an error posting your status -- sorry!") );
|
QMessageBox::critical( this, tr("Tweetin' Error"), tr("There was an error posting your status -- sorry!") );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TwitterConfigWidget::showEvent(QShowEvent* event)
|
||||||
|
{
|
||||||
|
loadConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@@ -50,11 +50,17 @@ class ACCOUNTDLLEXPORT TwitterConfigWidget : public QWidget
|
|||||||
public:
|
public:
|
||||||
explicit TwitterConfigWidget( TwitterAccount* account = 0, QWidget *parent = 0 );
|
explicit TwitterConfigWidget( TwitterAccount* account = 0, QWidget *parent = 0 );
|
||||||
virtual ~TwitterConfigWidget();
|
virtual ~TwitterConfigWidget();
|
||||||
|
|
||||||
|
void loadConfig();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void twitterAuthed( bool authed );
|
void twitterAuthed( bool authed );
|
||||||
|
|
||||||
void sizeHintChanged();
|
void sizeHintChanged();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void showEvent( QShowEvent* event );
|
||||||
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void authDeauthTwitter();
|
void authDeauthTwitter();
|
||||||
|
Reference in New Issue
Block a user