From c854a090e654f9d0f4fe522bbbd8d305ff209e8c Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Tue, 3 May 2011 22:44:14 -0400 Subject: [PATCH] Add autoconnect to twitter dialog. Make dialogs prettier --- src/delegateconfigwrapper.h | 1 + src/settingsdialog.cpp | 2 +- src/sip/jreen/configwidget.ui | 64 +++++++++++++-- src/sip/jreen/googlewrapper/googlewrapper.cpp | 2 + src/sip/twitter/twitter.cpp | 18 ++++- src/sip/twitter/twitter.h | 2 + src/sip/twitter/twitterconfigwidget.cpp | 10 +++ src/sip/twitter/twitterconfigwidget.h | 1 + src/sip/twitter/twitterconfigwidget.ui | 78 ++++++++++++++++--- src/stackedsettingsdialog.ui | 4 +- 10 files changed, 164 insertions(+), 18 deletions(-) diff --git a/src/delegateconfigwrapper.h b/src/delegateconfigwrapper.h index 0476ea8c2..810b46333 100644 --- a/src/delegateconfigwrapper.h +++ b/src/delegateconfigwrapper.h @@ -33,6 +33,7 @@ public: setWindowTitle( title ); QVBoxLayout* v = new QVBoxLayout( this ); + v->setContentsMargins( 0, 0, 0, 0 ); v->addWidget( m_widget ); QDialogButtonBox* buttons = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this ); diff --git a/src/settingsdialog.cpp b/src/settingsdialog.cpp index 82466d9e0..669917ddf 100644 --- a/src/settingsdialog.cpp +++ b/src/settingsdialog.cpp @@ -468,7 +468,7 @@ SettingsDialog::openResolverConfig( const QString& resolver ) { Tomahawk::ExternalResolver* r = TomahawkApp::instance()->resolverForPath( resolver ); if( r && r->configUI() ) { - DelegateConfigWrapper dialog( r->configUI(), "Resolver Config", this ); + DelegateConfigWrapper dialog( r->configUI(), "Resolver Configuration", this ); QWeakPointer< DelegateConfigWrapper > watcher( &dialog ); int ret = dialog.exec(); if( !watcher.isNull() && ret == QDialog::Accepted ) { diff --git a/src/sip/jreen/configwidget.ui b/src/sip/jreen/configwidget.ui index b11a48282..283cda55b 100644 --- a/src/sip/jreen/configwidget.ui +++ b/src/sip/jreen/configwidget.ui @@ -6,14 +6,17 @@ 0 0 - 437 - 207 + 433 + 253 - Form + Jabber Configuration + + 0 + @@ -29,11 +32,23 @@ + + + + + + + :/jabber-icon.png + + + - 12 + 11 + 75 + true @@ -56,6 +71,43 @@ + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Enter your Jabber login to connect with your friends using Tomahawk! + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + @@ -259,6 +311,8 @@ - + + + diff --git a/src/sip/jreen/googlewrapper/googlewrapper.cpp b/src/sip/jreen/googlewrapper/googlewrapper.cpp index 9eeae3acd..dd30c557e 100644 --- a/src/sip/jreen/googlewrapper/googlewrapper.cpp +++ b/src/sip/jreen/googlewrapper/googlewrapper.cpp @@ -39,6 +39,8 @@ GoogleWrapper::GoogleWrapper ( const QString& pluginID ) { m_ui->headerLabel->setText( tr( "Configure this Google Account" ) ); m_ui->emailLabel->setText( tr( "GMail Address" ) ); + m_ui->jabberBlurb->setText( tr( "Enter your GMail login to connect with your friends using Tomahawk!" ) ); + m_ui->logoLabel->setPixmap( QPixmap( ":/gmail-logo.png" ) ); } diff --git a/src/sip/twitter/twitter.cpp b/src/sip/twitter/twitter.cpp index 508c2247d..325a2d97c 100644 --- a/src/sip/twitter/twitter.cpp +++ b/src/sip/twitter/twitter.cpp @@ -141,10 +141,13 @@ QWidget* TwitterPlugin::configWidget() } bool -TwitterPlugin::connectPlugin( bool /*startup*/ ) +TwitterPlugin::connectPlugin( bool startup ) { qDebug() << Q_FUNC_INFO; + if( startup && !twitterAutoConnect() ) + return false; + m_cachedPeers = twitterCachedPeers(); QList peerlist = m_cachedPeers.keys(); qStableSort( peerlist.begin(), peerlist.end() ); @@ -787,4 +790,17 @@ TwitterPlugin::setTwitterCachedPeers( const QHash &cachedPeer TomahawkSettings::instance()->setValue( pluginId() + "/CachedPeers", cachedPeers ); } +void +TwitterPlugin::setTwitterAutoConnect( bool autoConnect ) +{ + TomahawkSettings::instance()->setValue( pluginId() + "/AutoConnect", autoConnect ); +} + +bool +TwitterPlugin::twitterAutoConnect() const +{ + return TomahawkSettings::instance()->value( pluginId() + "/AutoConnect", true ).toBool(); +} + + Q_EXPORT_PLUGIN2( sipfactory, TwitterFactory ) diff --git a/src/sip/twitter/twitter.h b/src/sip/twitter/twitter.h index 154fe7d5f..38ff7457b 100644 --- a/src/sip/twitter/twitter.h +++ b/src/sip/twitter/twitter.h @@ -128,6 +128,8 @@ private: void setTwitterCachedDirectMessagesSinceId( qint64 sinceid ); QHash twitterCachedPeers() const; void setTwitterCachedPeers( const QHash &cachedPeers ); + bool twitterAutoConnect() const; + void setTwitterAutoConnect( bool autoConnect ); QWeakPointer< TomahawkOAuthTwitter > m_twitterAuth; QWeakPointer< QTweetFriendsTimeline > m_friendsTimeline; diff --git a/src/sip/twitter/twitterconfigwidget.cpp b/src/sip/twitter/twitterconfigwidget.cpp index 42eda0600..2e6775aa6 100644 --- a/src/sip/twitter/twitterconfigwidget.cpp +++ b/src/sip/twitter/twitterconfigwidget.cpp @@ -44,6 +44,9 @@ TwitterConfigWidget::TwitterConfigWidget( TwitterPlugin* plugin, QWidget *parent this, SLOT( startPostGotTomahawkStatus() ) ); connect( ui->twitterTweetComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( tweetComboBoxIndexChanged( int ) ) ); + connect( ui->autoConnectCheckbox, SIGNAL( toggled( bool ) ), + this, SLOT( autoConnectToggled( bool ) ) ); + ui->twitterTweetComboBox->setCurrentIndex( 0 ); ui->twitterUserTweetLineEdit->setReadOnly( true ); @@ -184,6 +187,13 @@ TwitterConfigWidget::tweetComboBoxIndexChanged( int index ) ui->twitterTweetGotTomahawkButton->setText( tr( "Tweet!" ) ); } +void +TwitterConfigWidget::autoConnectToggled( bool on ) +{ + m_plugin->setTwitterAutoConnect( on ); +} + + void TwitterConfigWidget::startPostGotTomahawkStatus() { diff --git a/src/sip/twitter/twitterconfigwidget.h b/src/sip/twitter/twitterconfigwidget.h index 3a059bfa8..d6c178d8f 100644 --- a/src/sip/twitter/twitterconfigwidget.h +++ b/src/sip/twitter/twitterconfigwidget.h @@ -55,6 +55,7 @@ private slots: void postGotTomahawkDirectMessageReply( const QTweetDMStatus &status ); void postGotTomahawkStatusUpdateError( QTweetNetBase::ErrorCode, const QString &errorMsg ); void tweetComboBoxIndexChanged( int index ); + void autoConnectToggled( bool on ); private: void authenticateTwitter(); diff --git a/src/sip/twitter/twitterconfigwidget.ui b/src/sip/twitter/twitterconfigwidget.ui index 949b68cbc..d9662243a 100644 --- a/src/sip/twitter/twitterconfigwidget.ui +++ b/src/sip/twitter/twitterconfigwidget.ui @@ -6,8 +6,8 @@ 0 0 - 438 - 266 + 515 + 323 @@ -16,7 +16,61 @@ 0 - + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + :/twitter-icon.png + + + + + + + + 11 + 75 + true + + + + Configure this Twitter account + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + @@ -85,13 +139,10 @@ If connections to peers seem to have been lost, just press the appropriate butto Qt::Vertical - - QSizePolicy::Fixed - 20 - 10 + 40 @@ -175,7 +226,7 @@ If connections to peers seem to have been lost, just press the appropriate butto - + Qt::Vertical @@ -187,8 +238,17 @@ If connections to peers seem to have been lost, just press the appropriate butto + + + + Connect automatically when Tomahawk starts + + + - + + + diff --git a/src/stackedsettingsdialog.ui b/src/stackedsettingsdialog.ui index 2bb477cca..015d2859a 100644 --- a/src/stackedsettingsdialog.ui +++ b/src/stackedsettingsdialog.ui @@ -100,7 +100,7 @@ - 0 + 3 @@ -366,7 +366,7 @@ - Script resolver search for a given track to make it playable. + Script resolvers search for a given track to make it playable.