1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-21 08:19:42 +01: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 );
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 );

View File

@ -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 ) {

View File

@ -6,14 +6,17 @@
<rect>
<x>0</x>
<y>0</y>
<width>437</width>
<height>207</height>
<width>433</width>
<height>253</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
<string>Jabber Configuration</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="topMargin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
@ -29,11 +32,23 @@
</property>
</spacer>
</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>
<widget class="QLabel" name="headerLabel">
<property name="font">
<font>
<pointsize>12</pointsize>
<pointsize>11</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
@ -56,6 +71,43 @@
</item>
</layout>
</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>
<widget class="QGroupBox" name="groupBox">
<property name="title">
@ -259,6 +311,8 @@
</item>
</layout>
</widget>
<resources/>
<resources>
<include location="resources.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -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" ) );
}

View File

@ -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<QString> peerlist = m_cachedPeers.keys();
qStableSort( peerlist.begin(), peerlist.end() );
@ -787,4 +790,17 @@ TwitterPlugin::setTwitterCachedPeers( const QHash<QString, QVariant> &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 )

View File

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

View File

@ -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()
{

View File

@ -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();

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>438</width>
<height>266</height>
<width>515</width>
<height>323</height>
</rect>
</property>
<property name="minimumSize">
@ -16,7 +16,61 @@
<height>0</height>
</size>
</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>
<layout class="QVBoxLayout" name="twitterVertLayout">
<item>
@ -85,13 +139,10 @@ If connections to peers seem to have been lost, just press the appropriate butto
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
<height>40</height>
</size>
</property>
</spacer>
@ -175,7 +226,7 @@ If connections to peers seem to have been lost, just press the appropriate butto
</layout>
</item>
<item>
<spacer name="twitterVertSpacer">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
@ -187,8 +238,17 @@ If connections to peers seem to have been lost, just press the appropriate butto
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="autoConnectCheckbox">
<property name="text">
<string>Connect automatically when Tomahawk starts</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<resources>
<include location="resources.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -100,7 +100,7 @@
<item>
<widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex">
<number>0</number>
<number>3</number>
</property>
<widget class="QWidget" name="accountsPage">
<layout class="QVBoxLayout" name="verticalLayout_11">
@ -366,7 +366,7 @@
<item>
<widget class="QLabel" name="label">
<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>
</widget>
</item>