Ejemplo n.º 1
0
TwitterConfigWidget::TwitterConfigWidget( SipPlugin* plugin, QWidget *parent ) :
    QWidget( parent ),
    ui( new Ui::TwitterConfigWidget ),
    m_plugin( plugin )
{
    ui->setupUi( this );

    connect( ui->twitterAuthenticateButton, SIGNAL( pressed() ),
            this, SLOT( authDeauthTwitter() ) );
    connect( ui->twitterTweetGotTomahawkButton, SIGNAL( pressed() ),
            this, SLOT( startPostGotTomahawkStatus() ) );
    connect( ui->twitterTweetComboBox, SIGNAL( currentIndexChanged( int ) ),
            this, SLOT( tweetComboBoxIndexChanged( int ) ) );

    ui->twitterTweetComboBox->setCurrentIndex( 0 );
    ui->twitterUserTweetLineEdit->setReadOnly( true );
    ui->twitterUserTweetLineEdit->setEnabled( false );
    
    TomahawkSettings* s = TomahawkSettings::instance();
    if ( s->twitterOAuthToken().isEmpty() || s->twitterOAuthTokenSecret().isEmpty() || s->twitterScreenName().isEmpty() )
    {
        ui->twitterStatusLabel->setText( tr( "Status: No saved credentials" ) );
        ui->twitterAuthenticateButton->setText( tr( "Authenticate" ) );
        ui->twitterInstructionsInfoLabel->setVisible( false );
        ui->twitterGlobalTweetLabel->setVisible( false );
        ui->twitterTweetGotTomahawkButton->setVisible( false );
        ui->twitterUserTweetLineEdit->setVisible( false );
        ui->twitterTweetComboBox->setVisible( false );
        
        emit twitterAuthed( false );
    }
    else
    {
        ui->twitterStatusLabel->setText( tr( "Status: Credentials saved for %1" ).arg( s->twitterScreenName() ) );
        ui->twitterAuthenticateButton->setText( tr( "De-authenticate" ) );
        ui->twitterInstructionsInfoLabel->setVisible( true );
        ui->twitterGlobalTweetLabel->setVisible( true );
        ui->twitterTweetGotTomahawkButton->setVisible( true );
        ui->twitterUserTweetLineEdit->setVisible( true );
        ui->twitterTweetComboBox->setVisible( true );

        emit twitterAuthed( true );
    }

}
Ejemplo n.º 2
0
TwitterConfigWidget::TwitterConfigWidget( TwitterPlugin* plugin, QWidget *parent ) :
    QWidget( parent ),
    ui( new Ui::TwitterConfigWidget ),
    m_plugin( plugin )
{
    ui->setupUi( this );

    connect( ui->twitterAuthenticateButton, SIGNAL( pressed() ),
            this, SLOT( authDeauthTwitter() ) );
    connect( ui->twitterTweetGotTomahawkButton, SIGNAL( pressed() ),
            this, SLOT( startPostGotTomahawkStatus() ) );
    connect( ui->twitterTweetComboBox, SIGNAL( currentIndexChanged( int ) ),
            this, SLOT( tweetComboBoxIndexChanged( int ) ) );

    ui->twitterTweetComboBox->setCurrentIndex( 0 );
    ui->twitterTweetGotTomahawkButton->setText( tr( "Tweet!" ) );

    if ( m_plugin->twitterOAuthToken().isEmpty() || m_plugin->twitterOAuthTokenSecret().isEmpty() || m_plugin->twitterScreenName().isEmpty() )
    {
        ui->twitterStatusLabel->setText( tr( "Status: No saved credentials" ) );
        ui->twitterAuthenticateButton->setText( tr( "Authenticate" ) );
        ui->twitterSyncGroupBox->setVisible( false );

        emit twitterAuthed( false );
    }
    else
    {
        ui->twitterStatusLabel->setText( tr( "Status: Credentials saved for %1" ).arg( m_plugin->twitterScreenName() ) );
        ui->twitterAuthenticateButton->setText( tr( "De-authenticate" ) );
        ui->twitterSyncGroupBox->setVisible( true );
        ui->twitterUserTweetLineEdit->setVisible( false );

        emit twitterAuthed( true );
    }

}