mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-15 10:33:59 +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->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->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
|
||||
LastFmConfig::username() const
|
||||
{
|
||||
@@ -143,3 +148,10 @@ LastFmConfig::onLastFmFinished()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LastFmConfig::showEvent(QShowEvent* event)
|
||||
{
|
||||
loadFromConfig();
|
||||
}
|
||||
|
@@ -37,10 +37,15 @@ public:
|
||||
QString username() const;
|
||||
QString password() const;
|
||||
bool scrobble() const;
|
||||
|
||||
void loadFromConfig();
|
||||
|
||||
public slots:
|
||||
void testLogin( bool );
|
||||
void onLastFmFinished();
|
||||
|
||||
protected:
|
||||
void showEvent( QShowEvent* event );
|
||||
|
||||
private slots:
|
||||
void enableButton();
|
||||
|
@@ -57,6 +57,17 @@ TwitterConfigWidget::TwitterConfigWidget( TwitterAccount* account, QWidget *pare
|
||||
m_ui->twitterTweetComboBox->setCurrentIndex( 0 );
|
||||
m_ui->twitterTweetGotTomahawkButton->setText( tr( "Tweet!" ) );
|
||||
|
||||
}
|
||||
|
||||
TwitterConfigWidget::~TwitterConfigWidget()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TwitterConfigWidget::loadConfig()
|
||||
{
|
||||
QVariantHash credentials = m_account->credentials();
|
||||
|
||||
if ( credentials[ "oauthtoken" ].toString().isEmpty() ||
|
||||
@@ -78,13 +89,8 @@ TwitterConfigWidget::TwitterConfigWidget( TwitterAccount* account, QWidget *pare
|
||||
|
||||
emit twitterAuthed( true );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TwitterConfigWidget::~TwitterConfigWidget()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void
|
||||
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!") );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TwitterConfigWidget::showEvent(QShowEvent* event)
|
||||
{
|
||||
loadConfig();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -50,11 +50,17 @@ class ACCOUNTDLLEXPORT TwitterConfigWidget : public QWidget
|
||||
public:
|
||||
explicit TwitterConfigWidget( TwitterAccount* account = 0, QWidget *parent = 0 );
|
||||
virtual ~TwitterConfigWidget();
|
||||
|
||||
void loadConfig();
|
||||
|
||||
signals:
|
||||
void twitterAuthed( bool authed );
|
||||
|
||||
void sizeHintChanged();
|
||||
|
||||
protected:
|
||||
void showEvent( QShowEvent* event );
|
||||
|
||||
|
||||
private slots:
|
||||
void authDeauthTwitter();
|
||||
|
Reference in New Issue
Block a user