1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-01 20:00:13 +02:00

Add autoconnect to twitter dialog. Make dialogs prettier

This commit is contained in:
Leo Franchi
2011-05-03 22:44:14 -04:00
parent aa9a3124ef
commit c854a090e6
10 changed files with 164 additions and 18 deletions

View File

@@ -33,6 +33,7 @@ public:
setWindowTitle( title ); setWindowTitle( title );
QVBoxLayout* v = new QVBoxLayout( this ); QVBoxLayout* v = new QVBoxLayout( this );
v->setContentsMargins( 0, 0, 0, 0 );
v->addWidget( m_widget ); v->addWidget( m_widget );
QDialogButtonBox* buttons = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this ); QDialogButtonBox* buttons = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this );

View File

@@ -468,7 +468,7 @@ SettingsDialog::openResolverConfig( const QString& resolver )
{ {
Tomahawk::ExternalResolver* r = TomahawkApp::instance()->resolverForPath( resolver ); Tomahawk::ExternalResolver* r = TomahawkApp::instance()->resolverForPath( resolver );
if( r && r->configUI() ) { if( r && r->configUI() ) {
DelegateConfigWrapper dialog( r->configUI(), "Resolver Config", this ); DelegateConfigWrapper dialog( r->configUI(), "Resolver Configuration", this );
QWeakPointer< DelegateConfigWrapper > watcher( &dialog ); QWeakPointer< DelegateConfigWrapper > watcher( &dialog );
int ret = dialog.exec(); int ret = dialog.exec();
if( !watcher.isNull() && ret == QDialog::Accepted ) { if( !watcher.isNull() && ret == QDialog::Accepted ) {

View File

@@ -6,14 +6,17 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>437</width> <width>433</width>
<height>207</height> <height>253</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Jabber Configuration</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<property name="topMargin">
<number>0</number>
</property>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
@@ -29,11 +32,23 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item>
<widget class="QLabel" name="logoLabel">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="resources.qrc">:/jabber-icon.png</pixmap>
</property>
</widget>
</item>
<item> <item>
<widget class="QLabel" name="headerLabel"> <widget class="QLabel" name="headerLabel">
<property name="font"> <property name="font">
<font> <font>
<pointsize>12</pointsize> <pointsize>11</pointsize>
<weight>75</weight>
<bold>true</bold>
</font> </font>
</property> </property>
<property name="text"> <property name="text">
@@ -56,6 +71,43 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="jabberBlurb">
<property name="text">
<string>Enter your Jabber login to connect with your friends using Tomahawk!</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item> <item>
<widget class="QGroupBox" name="groupBox"> <widget class="QGroupBox" name="groupBox">
<property name="title"> <property name="title">
@@ -259,6 +311,8 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<resources/> <resources>
<include location="resources.qrc"/>
</resources>
<connections/> <connections/>
</ui> </ui>

View File

@@ -39,6 +39,8 @@ GoogleWrapper::GoogleWrapper ( const QString& pluginID )
{ {
m_ui->headerLabel->setText( tr( "Configure this Google Account" ) ); m_ui->headerLabel->setText( tr( "Configure this Google Account" ) );
m_ui->emailLabel->setText( tr( "GMail Address" ) ); 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" ) );
} }

View File

@@ -141,10 +141,13 @@ QWidget* TwitterPlugin::configWidget()
} }
bool bool
TwitterPlugin::connectPlugin( bool /*startup*/ ) TwitterPlugin::connectPlugin( bool startup )
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
if( startup && !twitterAutoConnect() )
return false;
m_cachedPeers = twitterCachedPeers(); m_cachedPeers = twitterCachedPeers();
QList<QString> peerlist = m_cachedPeers.keys(); QList<QString> peerlist = m_cachedPeers.keys();
qStableSort( peerlist.begin(), peerlist.end() ); qStableSort( peerlist.begin(), peerlist.end() );
@@ -787,4 +790,17 @@ TwitterPlugin::setTwitterCachedPeers( const QHash<QString, QVariant> &cachedPeer
TomahawkSettings::instance()->setValue( pluginId() + "/CachedPeers", cachedPeers ); 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 ) Q_EXPORT_PLUGIN2( sipfactory, TwitterFactory )

View File

@@ -128,6 +128,8 @@ private:
void setTwitterCachedDirectMessagesSinceId( qint64 sinceid ); void setTwitterCachedDirectMessagesSinceId( qint64 sinceid );
QHash<QString, QVariant> twitterCachedPeers() const; QHash<QString, QVariant> twitterCachedPeers() const;
void setTwitterCachedPeers( const QHash<QString, QVariant> &cachedPeers ); void setTwitterCachedPeers( const QHash<QString, QVariant> &cachedPeers );
bool twitterAutoConnect() const;
void setTwitterAutoConnect( bool autoConnect );
QWeakPointer< TomahawkOAuthTwitter > m_twitterAuth; QWeakPointer< TomahawkOAuthTwitter > m_twitterAuth;
QWeakPointer< QTweetFriendsTimeline > m_friendsTimeline; QWeakPointer< QTweetFriendsTimeline > m_friendsTimeline;

View File

@@ -44,6 +44,9 @@ TwitterConfigWidget::TwitterConfigWidget( TwitterPlugin* plugin, QWidget *parent
this, SLOT( startPostGotTomahawkStatus() ) ); this, SLOT( startPostGotTomahawkStatus() ) );
connect( ui->twitterTweetComboBox, SIGNAL( currentIndexChanged( int ) ), connect( ui->twitterTweetComboBox, SIGNAL( currentIndexChanged( int ) ),
this, SLOT( tweetComboBoxIndexChanged( int ) ) ); this, SLOT( tweetComboBoxIndexChanged( int ) ) );
connect( ui->autoConnectCheckbox, SIGNAL( toggled( bool ) ),
this, SLOT( autoConnectToggled( bool ) ) );
ui->twitterTweetComboBox->setCurrentIndex( 0 ); ui->twitterTweetComboBox->setCurrentIndex( 0 );
ui->twitterUserTweetLineEdit->setReadOnly( true ); ui->twitterUserTweetLineEdit->setReadOnly( true );
@@ -184,6 +187,13 @@ TwitterConfigWidget::tweetComboBoxIndexChanged( int index )
ui->twitterTweetGotTomahawkButton->setText( tr( "Tweet!" ) ); ui->twitterTweetGotTomahawkButton->setText( tr( "Tweet!" ) );
} }
void
TwitterConfigWidget::autoConnectToggled( bool on )
{
m_plugin->setTwitterAutoConnect( on );
}
void void
TwitterConfigWidget::startPostGotTomahawkStatus() TwitterConfigWidget::startPostGotTomahawkStatus()
{ {

View File

@@ -55,6 +55,7 @@ private slots:
void postGotTomahawkDirectMessageReply( const QTweetDMStatus &status ); void postGotTomahawkDirectMessageReply( const QTweetDMStatus &status );
void postGotTomahawkStatusUpdateError( QTweetNetBase::ErrorCode, const QString &errorMsg ); void postGotTomahawkStatusUpdateError( QTweetNetBase::ErrorCode, const QString &errorMsg );
void tweetComboBoxIndexChanged( int index ); void tweetComboBoxIndexChanged( int index );
void autoConnectToggled( bool on );
private: private:
void authenticateTwitter(); void authenticateTwitter();

View File

@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>438</width> <width>515</width>
<height>266</height> <height>323</height>
</rect> </rect>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
@@ -16,7 +16,61 @@
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_10"> <layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="resources.qrc">:/twitter-icon.png</pixmap>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="font">
<font>
<pointsize>11</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Configure this Twitter account</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item> <item>
<layout class="QVBoxLayout" name="twitterVertLayout"> <layout class="QVBoxLayout" name="twitterVertLayout">
<item> <item>
@@ -85,13 +139,10 @@ If connections to peers seem to have been lost, just press the appropriate butto
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>20</width>
<height>10</height> <height>40</height>
</size> </size>
</property> </property>
</spacer> </spacer>
@@ -175,7 +226,7 @@ If connections to peers seem to have been lost, just press the appropriate butto
</layout> </layout>
</item> </item>
<item> <item>
<spacer name="twitterVertSpacer"> <spacer name="verticalSpacer_2">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
@@ -187,8 +238,17 @@ If connections to peers seem to have been lost, just press the appropriate butto
</property> </property>
</spacer> </spacer>
</item> </item>
<item>
<widget class="QCheckBox" name="autoConnectCheckbox">
<property name="text">
<string>Connect automatically when Tomahawk starts</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<resources/> <resources>
<include location="resources.qrc"/>
</resources>
<connections/> <connections/>
</ui> </ui>

View File

@@ -100,7 +100,7 @@
<item> <item>
<widget class="QStackedWidget" name="stackedWidget"> <widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>3</number>
</property> </property>
<widget class="QWidget" name="accountsPage"> <widget class="QWidget" name="accountsPage">
<layout class="QVBoxLayout" name="verticalLayout_11"> <layout class="QVBoxLayout" name="verticalLayout_11">
@@ -366,7 +366,7 @@
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
<string>Script resolver search for a given track to make it playable.</string> <string>Script resolvers search for a given track to make it playable.</string>
</property> </property>
</widget> </widget>
</item> </item>