本文整理汇总了C++中TomahawkSettings类的典型用法代码示例。如果您正苦于以下问题:C++ TomahawkSettings类的具体用法?C++ TomahawkSettings怎么用?C++ TomahawkSettings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TomahawkSettings类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tr
void
TwitterConfigWidget::startPostGotTomahawkStatus()
{
m_postGTtype = ui->twitterTweetComboBox->currentText();
if ( m_postGTtype != "Global Tweet" && ( ui->twitterUserTweetLineEdit->text().isEmpty() || ui->twitterUserTweetLineEdit->text() == "@" ) )
{
QMessageBox::critical( this, tr("Tweetin' Error"), tr("You must enter a user name for this type of tweet.") );
return;
}
qDebug() << "Posting Got Tomahawk status";
TomahawkSettings* s = TomahawkSettings::instance();
if ( s->twitterOAuthToken().isEmpty() || s->twitterOAuthTokenSecret().isEmpty() || s->twitterScreenName().isEmpty() )
{
QMessageBox::critical( this, tr("Tweetin' Error"), tr("Your saved credentials could not be loaded.\nYou may wish to try re-authenticating.") );
emit twitterAuthed( false );
return;
}
TomahawkOAuthTwitter *twitAuth = new TomahawkOAuthTwitter( this );
twitAuth->setNetworkAccessManager( TomahawkUtils::nam() );
twitAuth->setOAuthToken( s->twitterOAuthToken().toLatin1() );
twitAuth->setOAuthTokenSecret( s->twitterOAuthTokenSecret().toLatin1() );
QTweetAccountVerifyCredentials *credVerifier = new QTweetAccountVerifyCredentials( twitAuth, this );
connect( credVerifier, SIGNAL( parsedUser(const QTweetUser &) ), SLOT( postGotTomahawkStatusAuthVerifyReply(const QTweetUser &) ) );
credVerifier->verify();
}
示例2: qDebug
void
TwitterConfigWidget::authenticateVerifyReply( const QTweetUser &user )
{
qDebug() << Q_FUNC_INFO;
if ( user.id() == 0 )
{
QMessageBox::critical( this, tr("Tweetin' Error"), tr("The credentials could not be verified.\nYou may wish to try re-authenticating.") );
emit twitterAuthed( false );
return;
}
TomahawkSettings* s = TomahawkSettings::instance();
s->setTwitterScreenName( user.screenName() );
s->setTwitterCachedFriendsSinceId( 0 );
s->setTwitterCachedMentionsSinceId( 0 );
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 );
m_plugin->connectPlugin( false );
emit twitterAuthed( true );
}
示例3: QWidget
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(authenticateTwitter()));
connect(ui->twitterTweetGotTomahawkButton, SIGNAL(pressed()),
this, SLOT(startPostGotTomahawkStatus()));
TomahawkSettings* s = TomahawkSettings::instance();
if ( s->twitterOAuthToken().isEmpty() || s->twitterOAuthTokenSecret().isEmpty() )
{
ui->twitterStatusLabel->setText("Status: No saved credentials");
ui->twitterAuthenticateButton->setText( "Authenticate" );
ui->twitterInstructionsBox->setVisible( false );
}
else
{
ui->twitterStatusLabel->setText("Status: Credentials saved");
ui->twitterAuthenticateButton->setText( "Re-authenticate" );
ui->twitterInstructionsBox->setVisible( true );
}
}
示例4: tr
void
TomahawkWindow::addPeerManually()
{
TomahawkSettings* s = TomahawkSettings::instance();
bool ok;
QString addr = QInputDialog::getText( this, tr( "Connect To Peer" ),
tr( "Enter peer address:" ), QLineEdit::Normal,
s->value( "connip" ).toString(), &ok ); // FIXME
if ( !ok )
return;
s->setValue( "connip", addr );
QString ports = QInputDialog::getText( this, tr( "Connect To Peer" ),
tr( "Enter peer port:" ), QLineEdit::Normal,
s->value( "connport", "50210" ).toString(), &ok );
if ( !ok )
return;
s->setValue( "connport", ports );
int port = ports.toInt();
QString key = QInputDialog::getText( this, tr( "Connect To Peer" ),
tr( "Enter peer key:" ), QLineEdit::Normal,
"whitelist", &ok );
if ( !ok )
return;
qDebug() << "Attempting to connect to" << addr;
Servent::instance()->connectToPeer( addr, port, key );
}
示例5: saveGeometry
void
TomahawkWindow::saveSettings()
{
TomahawkSettings* s = TomahawkSettings::instance();
s->setMainWindowGeometry( saveGeometry() );
s->setMainWindowState( saveState() );
s->setMainWindowSplitterState( ui->splitter->saveState() );
}
示例6: QString
void
PlaylistUpdaterInterface::save()
{
TomahawkSettings* s = TomahawkSettings::instance();
const QString key = QString( "playlistupdaters/%1" ).arg( m_playlist->guid() );
if ( !s->contains( QString( "%1/type" ).arg( key ) ) )
{
s->setValue( QString( "%1/type" ).arg( key ), type() );
}
saveToSettings( key );
}
示例7:
void
HostDialog::saveSettings()
{
TomahawkSettings* s = TomahawkSettings::instance();
s->setAutoDetectExternalIp( ui->autoDetectIpCheckBox->isChecked() );
s->setExternalHostname( ui->staticHostName->text() );
s->setExternalPort( ui->staticPort->value() );
s->sync();
}
示例8: tDebug
TrackView::~TrackView()
{
tDebug() << Q_FUNC_INFO << ( m_guid.isEmpty() ? QString( "with empty guid" ) : QString( "with guid %1" ).arg( m_guid ) );
if ( !m_guid.isEmpty() && proxyModel()->playlistInterface() )
{
tDebug() << Q_FUNC_INFO << "Storing shuffle & random mode settings for guid" << m_guid;
TomahawkSettings* s = TomahawkSettings::instance();
s->setShuffleState( m_guid, proxyModel()->playlistInterface()->shuffled() );
s->setRepeatMode( m_guid, proxyModel()->playlistInterface()->repeatMode() );
}
}
示例9:
void
Account::removeFromConfig()
{
TomahawkSettings* s = TomahawkSettings::instance();
s->beginGroup( "accounts/" + m_accountId );
s->remove( "accountfriendlyname" );
s->remove( "enabled" );
s->remove( "credentials" );
s->remove( "configuration" );
s->remove( "acl" );
s->remove( "types" );
s->endGroup();
s->remove( "accounts/" + m_accountId );
}
示例10: QDialog
HostDialog::HostDialog( QWidget* parent )
: QDialog( parent )
, ui( new Ui::HostDialog )
{
ui->setupUi( this );
TomahawkSettings* s = TomahawkSettings::instance();
connect( ui->autoDetectIpCheckBox, SIGNAL( toggled( bool ) ),
SLOT( toggleAutoDetectIp( bool ) ) );
ui->staticHostName->setText( s->externalHostname() );
ui->staticPort->setValue( s->externalPort() );
ui->autoDetectIpCheckBox->setChecked( s->autoDetectExternalIp() );
}
示例11: playlistForInterface
void
ViewManager::loadCurrentPlaylistSettings()
{
TomahawkSettings* s = TomahawkSettings::instance();
Tomahawk::playlist_ptr pl = playlistForInterface( currentPlaylistInterface() );
if ( !pl.isNull() ) {
currentPlaylistInterface()->setShuffled( s->shuffleState( pl->guid() ));
currentPlaylistInterface()->setRepeatMode( s->repeatMode( pl->guid() ));
} else {
Tomahawk::dynplaylist_ptr dynPl = dynamicPlaylistForInterface( currentPlaylistInterface() );
if ( !dynPl.isNull() ) {
currentPlaylistInterface()->setShuffled( s->shuffleState( dynPl->guid() ));
}
}
}
示例12: QWidget
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 );
}
}
示例13: QString
void
Account::loadFromConfig( const QString& accountId )
{
m_accountId = accountId;
TomahawkSettings* s = TomahawkSettings::instance();
s->beginGroup( "accounts/" + m_accountId );
m_accountFriendlyName = s->value( "accountfriendlyname", QString() ).toString();
m_enabled = s->value( "enabled", false ).toBool();
m_credentials = s->value( "credentials", QVariantHash() ).toHash();
m_configuration = s->value( "configuration", QVariantHash() ).toHash();
m_acl = s->value( "acl", QVariantMap() ).toMap();
m_types = s->value( "types", QStringList() ).toStringList();
s->endGroup();
}
示例14: setWindowOpacity
void
TomahawkWindow::loadSettings()
{
TomahawkSettings* s = TomahawkSettings::instance();
// Workaround for broken window geometry restoring on Qt Cocoa when setUnifiedTitleAndToolBarOnMac is true.
// See http://bugreports.qt.nokia.com/browse/QTBUG-3116 and
// http://lists.qt.nokia.com/pipermail/qt-interest/2009-August/011491.html
// for the 'fix'
#ifdef QT_MAC_USE_COCOA
bool workaround = !isVisible();
if ( workaround )
{
// make "invisible"
setWindowOpacity( 0 );
// let Qt update its frameStruts
show();
}
#endif
if ( !s->mainWindowGeometry().isEmpty() )
restoreGeometry( s->mainWindowGeometry() );
if ( !s->mainWindowState().isEmpty() )
restoreState( s->mainWindowState() );
if ( !s->mainWindowSplitterState().isEmpty() )
ui->splitter->restoreState( s->mainWindowSplitterState() );
#ifdef QT_MAC_USE_COCOA
if ( workaround )
{
// Make it visible again
setWindowOpacity( 1 );
}
#endif
}
示例15: qDebug
void
TwitterConfigWidget::startPostGotTomahawkStatus()
{
qDebug() << "Posting Got Tomahawk status";
TomahawkSettings* s = TomahawkSettings::instance();
if ( s->twitterOAuthToken().isEmpty() || s->twitterOAuthTokenSecret().isEmpty() )
{
QMessageBox::critical( 0, QString("Tweetin' Error"), QString("Your saved credentials could not be loaded.\nYou may wish to try re-authenticating.") );
return;
}
TomahawkOAuthTwitter *twitAuth = new TomahawkOAuthTwitter( this );
twitAuth->setNetworkAccessManager( TomahawkUtils::nam() );
twitAuth->setOAuthToken( s->twitterOAuthToken().toLatin1() );
twitAuth->setOAuthTokenSecret( s->twitterOAuthTokenSecret().toLatin1() );
QTweetAccountVerifyCredentials *credVerifier = new QTweetAccountVerifyCredentials( twitAuth, this );
connect( credVerifier, SIGNAL( parsedUser(const QTweetUser &) ), SLOT( postGotTomahawkStatusAuthVerifyReply(const QTweetUser &) ) );
credVerifier->verify();
}