mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 13:47:26 +02:00
fix creating factory and other first start issue
This commit is contained in:
@@ -632,28 +632,15 @@ AccountDelegate::drawConfigWrench ( QPainter* painter, QStyleOptionViewItemV4& o
|
|||||||
QRect
|
QRect
|
||||||
AccountDelegate::checkRectForIndex( const QStyleOptionViewItem& option, const QModelIndex& idx ) const
|
AccountDelegate::checkRectForIndex( const QStyleOptionViewItem& option, const QModelIndex& idx ) const
|
||||||
{
|
{
|
||||||
// the checkbox for this row was hit
|
|
||||||
const AccountModel::RowType rowType = static_cast< AccountModel::RowType >( idx.data( AccountModel::RowTypeRole ).toInt() );
|
|
||||||
|
|
||||||
QStyleOptionViewItemV4 opt = option;
|
QStyleOptionViewItemV4 opt = option;
|
||||||
initStyleOption( &opt, idx );
|
initStyleOption( &opt, idx );
|
||||||
|
|
||||||
if ( rowType == AccountModel::TopLevelAccount || rowType == AccountModel::TopLevelFactory )
|
|
||||||
{
|
|
||||||
// Top level item, return the corresponding rect
|
// Top level item, return the corresponding rect
|
||||||
const int ypos = ( opt.rect.top() + opt.rect.height() / 2 ) - ( WRENCH_SIZE / 2 );
|
const int ypos = ( opt.rect.top() + opt.rect.height() / 2 ) - ( WRENCH_SIZE / 2 );
|
||||||
QRect checkRect = QRect( PADDING, ypos, WRENCH_SIZE, WRENCH_SIZE );
|
const QRect checkRect = QRect( PADDING, ypos, WRENCH_SIZE, WRENCH_SIZE );
|
||||||
return checkRect;
|
|
||||||
} /*else if ( rowType == AccountModel::ChildAccount )
|
return checkRect;
|
||||||
{
|
|
||||||
// Return smaller rect of individual child account
|
|
||||||
const int smallWrenchSize = opt.rect.height() - PADDING;
|
|
||||||
int ypos = ( opt.rect.center().y() ) - ( smallWrenchSize / 2 );
|
|
||||||
QRect checkRect = QRect( opt.rect.left() + PADDING, ypos, smallWrenchSize, smallWrenchSize );
|
|
||||||
return checkRect;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
return QRect();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -81,6 +81,7 @@ GoogleWrapper::GoogleWrapper ( const QString& pluginID )
|
|||||||
config->m_ui->headerLabel->setText( tr( "Configure this Google Account" ) );
|
config->m_ui->headerLabel->setText( tr( "Configure this Google Account" ) );
|
||||||
config->m_ui->emailLabel->setText( tr( "Google Address" ) );
|
config->m_ui->emailLabel->setText( tr( "Google Address" ) );
|
||||||
config->m_ui->xmppBlurb->setText( tr( "Enter your Google login to connect with your friends using Tomahawk!" ) );
|
config->m_ui->xmppBlurb->setText( tr( "Enter your Google login to connect with your friends using Tomahawk!" ) );
|
||||||
|
config->m_ui->xmppUsername->setPlaceholderText( tr( "username@gmail.com" ) );
|
||||||
config->m_ui->logoLabel->setPixmap( QPixmap( ":/gmail-logo.png" ) );
|
config->m_ui->logoLabel->setPixmap( QPixmap( ":/gmail-logo.png" ) );
|
||||||
config->m_ui->xmppServer->setText( "talk.google.com" );
|
config->m_ui->xmppServer->setText( "talk.google.com" );
|
||||||
config->m_ui->xmppPort->setValue( 5222 );
|
config->m_ui->xmppPort->setValue( 5222 );
|
||||||
|
@@ -57,12 +57,16 @@ void
|
|||||||
XmppConfigWidget::saveConfig()
|
XmppConfigWidget::saveConfig()
|
||||||
{
|
{
|
||||||
QVariantHash credentials = m_account->credentials();
|
QVariantHash credentials = m_account->credentials();
|
||||||
credentials[ "username" ] = m_ui->xmppUsername->text();
|
credentials[ "username" ] = m_ui->xmppUsername->text().trimmed();
|
||||||
credentials[ "password" ] = m_ui->xmppPassword->text();
|
credentials[ "password" ] = m_ui->xmppPassword->text().trimmed();
|
||||||
credentials[ "server" ] = m_ui->xmppServer->text();
|
|
||||||
credentials[ "port" ] = m_ui->xmppPort->text();
|
QVariantHash configuration = m_account->configuration();
|
||||||
|
configuration[ "server" ] = m_ui->xmppServer->text().trimmed();
|
||||||
|
configuration[ "port" ] = m_ui->xmppPort->text().trimmed();
|
||||||
|
|
||||||
m_account->setAccountFriendlyName( m_ui->xmppUsername->text() );
|
m_account->setAccountFriendlyName( m_ui->xmppUsername->text() );
|
||||||
m_account->setCredentials( credentials );
|
m_account->setCredentials( credentials );
|
||||||
|
m_account->setConfiguration( configuration);
|
||||||
m_account->sync();
|
m_account->sync();
|
||||||
|
|
||||||
static_cast< XmppSipPlugin* >( m_account->sipPlugin() )->checkSettings();
|
static_cast< XmppSipPlugin* >( m_account->sipPlugin() )->checkSettings();
|
||||||
|
@@ -33,6 +33,13 @@ AccountModel::AccountModel( QObject* parent )
|
|||||||
: QAbstractListModel( parent )
|
: QAbstractListModel( parent )
|
||||||
{
|
{
|
||||||
connect( AtticaManager::instance(), SIGNAL( resolversLoaded( Attica::Content::List ) ), this, SLOT( loadData() ) );
|
connect( AtticaManager::instance(), SIGNAL( resolversLoaded( Attica::Content::List ) ), this, SLOT( loadData() ) );
|
||||||
|
|
||||||
|
connect( AccountManager::instance(), SIGNAL( added( Tomahawk::Accounts::Account* ) ), this, SLOT( accountAdded( Tomahawk::Accounts::Account* ) ) );
|
||||||
|
connect( AccountManager::instance(), SIGNAL( removed( Tomahawk::Accounts::Account* ) ), this, SLOT( accountRemoved( Tomahawk::Accounts::Account* ) ) );
|
||||||
|
connect( AccountManager::instance(), SIGNAL( stateChanged( Account* ,Accounts::Account::ConnectionState ) ), this, SLOT( accountStateChanged( Account*, Accounts::Account::ConnectionState ) ) );
|
||||||
|
|
||||||
|
connect( AtticaManager::instance(), SIGNAL( resolverInstalled( QString ) ), this, SLOT( atticaInstalled( QString ) ) );
|
||||||
|
|
||||||
loadData();
|
loadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,12 +77,6 @@ AccountModel::loadData()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
connect ( AccountManager::instance(), SIGNAL( added( Tomahawk::Accounts::Account* ) ), this, SLOT( accountAdded( Tomahawk::Accounts::Account* ) ) );
|
|
||||||
connect ( AccountManager::instance(), SIGNAL( removed( Tomahawk::Accounts::Account* ) ), this, SLOT( accountRemoved( Tomahawk::Accounts::Account* ) ) );
|
|
||||||
connect ( AccountManager::instance(), SIGNAL( stateChanged( Account* ,Accounts::Account::ConnectionState ) ), this, SLOT( accountStateChanged( Account*, Accounts::Account::ConnectionState ) ) );
|
|
||||||
|
|
||||||
connect( AtticaManager::instance(), SIGNAL( resolverInstalled( QString ) ), this, SLOT( atticaInstalled( QString ) ) );
|
|
||||||
|
|
||||||
endResetModel();
|
endResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -296,8 +297,14 @@ AccountModel::setData( const QModelIndex& index, const QVariant& value, int role
|
|||||||
switch ( node->type )
|
switch ( node->type )
|
||||||
{
|
{
|
||||||
case AccountModelNode::UniqueFactoryType:
|
case AccountModelNode::UniqueFactoryType:
|
||||||
Q_ASSERT( node->accounts.size() == 1 );
|
if ( node->accounts.isEmpty() )
|
||||||
acct = node->accounts.first();
|
{
|
||||||
|
// No account for this unique factory, create it
|
||||||
|
// Don't add it to node->accounts here, slot attached to accountmanager::accountcreated will do it for us
|
||||||
|
acct = node->factory->createAccount();
|
||||||
|
AccountManager::instance()->addAccount( acct );
|
||||||
|
TomahawkSettings::instance()->addAccount( acct->accountId() );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case AccountModelNode::AtticaType:
|
case AccountModelNode::AtticaType:
|
||||||
{
|
{
|
||||||
@@ -411,6 +418,7 @@ void
|
|||||||
AccountModel::accountAdded( Account* account )
|
AccountModel::accountAdded( Account* account )
|
||||||
{
|
{
|
||||||
// Find the factory this belongs up, and update
|
// Find the factory this belongs up, and update
|
||||||
|
qDebug() << "IN ACCOUNT ADDED!!!!";
|
||||||
AccountFactory* factory = AccountManager::instance()->factoryForAccount( account );
|
AccountFactory* factory = AccountManager::instance()->factoryForAccount( account );
|
||||||
AtticaResolverAccount* attica = qobject_cast< AtticaResolverAccount* >( account );
|
AtticaResolverAccount* attica = qobject_cast< AtticaResolverAccount* >( account );
|
||||||
for ( int i = 0; i < m_accounts.size(); i++ )
|
for ( int i = 0; i < m_accounts.size(); i++ )
|
||||||
@@ -421,8 +429,6 @@ AccountModel::accountAdded( Account* account )
|
|||||||
{
|
{
|
||||||
n->accounts << account;
|
n->accounts << account;
|
||||||
thisIsTheOne = true;
|
thisIsTheOne = true;
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
else if ( attica && n->atticaContent.id() == attica->atticaId() )
|
else if ( attica && n->atticaContent.id() == attica->atticaId() )
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user