mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-14 01:54:07 +02:00
Some fixes to the dialogs
This commit is contained in:
@@ -156,6 +156,7 @@ AccountDelegate::paint ( QPainter* painter, const QStyleOptionViewItem& option,
|
||||
// Draw config wrench if there is one
|
||||
const bool hasConfigWrench = index.data( AccountModel::HasConfig ).toBool();
|
||||
int rightEdge = opt.rect.right();
|
||||
m_cachedConfigRects[ index ] = QRect();
|
||||
if ( hasConfigWrench )
|
||||
{
|
||||
const QRect confRect = QRect( rightEdge - 2*PADDING - WRENCH_SIZE, center - WRENCH_SIZE / 2, WRENCH_SIZE, WRENCH_SIZE );
|
||||
@@ -170,6 +171,7 @@ AccountDelegate::paint ( QPainter* painter, const QStyleOptionViewItem& option,
|
||||
}
|
||||
|
||||
// Draw individual accounts and add account button for factories
|
||||
m_cachedButtonRects[ index ] = QRect();
|
||||
if ( rowType == Tomahawk::Accounts::AccountModel::TopLevelFactory )
|
||||
{
|
||||
const QList< Account* > accts = index.data( AccountModel::ChildrenOfFactoryRole ).value< QList< Tomahawk::Accounts::Account* > >();
|
||||
@@ -183,7 +185,7 @@ AccountDelegate::paint ( QPainter* painter, const QStyleOptionViewItem& option,
|
||||
Q_ASSERT( !hasConfigWrench );
|
||||
|
||||
// Draw button in center of row
|
||||
btnRect= QRect( opt.rect.right() - PADDING - btnWidth, center - ( installMetrics.height() + 4 ) / 2, btnWidth, installMetrics.height() + 4 );
|
||||
btnRect= QRect( opt.rect.right() - PADDING - btnWidth, center - ( installMetrics.height() + 4 ) / 2, btnWidth, installMetrics.height() + 2*PADDING );
|
||||
rightEdge = btnRect.left();
|
||||
}
|
||||
else
|
||||
|
@@ -52,6 +52,10 @@ AccountFactoryWrapper::AccountFactoryWrapper( AccountFactory* factory, QWidget*
|
||||
connect( m_ui->buttonBox, SIGNAL( accepted() ), this, SLOT( accept() ) );
|
||||
connect( m_ui->buttonBox, SIGNAL( clicked( QAbstractButton*) ), this, SLOT( buttonClicked( QAbstractButton* ) ) );
|
||||
|
||||
|
||||
connect ( AccountManager::instance(), SIGNAL( added( Tomahawk::Accounts::Account* ) ), this, SLOT( load() ) );
|
||||
connect ( AccountManager::instance(), SIGNAL( removed( Tomahawk::Accounts::Account* ) ), this, SLOT( load() ) );
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
setContentsMargins( 0, 0, 0, 0 );
|
||||
m_ui->verticalLayout->setSpacing( 4 );
|
||||
@@ -70,6 +74,10 @@ AccountFactoryWrapper::load()
|
||||
item->setData( 0, AccountRole, QVariant::fromValue< QObject *>( acc ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_ui->accountsList->model()->rowCount() == 0 )
|
||||
accept();
|
||||
|
||||
#ifndef Q_OS_MAC
|
||||
const int padding = 7;
|
||||
#else
|
||||
@@ -133,7 +141,7 @@ AccountFactoryWrapper::buttonClicked( QAbstractButton* button )
|
||||
{
|
||||
m_createAccount = true;
|
||||
emit createAccount( m_factory );
|
||||
accept();
|
||||
// accept();
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
@@ -54,10 +54,9 @@ public slots:
|
||||
|
||||
private slots:
|
||||
void buttonClicked( QAbstractButton* );
|
||||
|
||||
private:
|
||||
void load();
|
||||
|
||||
private:
|
||||
Tomahawk::Accounts::AccountFactory* m_factory;
|
||||
Ui_AccountFactoryWrapper* m_ui;
|
||||
QPushButton* m_addButton;
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>507</width>
|
||||
<height>298</height>
|
||||
<height>150</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@@ -90,6 +90,7 @@ public slots:
|
||||
{
|
||||
m_deleted = true;
|
||||
emit deleted();
|
||||
reject();
|
||||
}
|
||||
else
|
||||
done( QDialog::Rejected );
|
||||
|
@@ -511,11 +511,11 @@ SettingsDialog::openAccountFactoryConfig( AccountFactory* factory )
|
||||
if ( accts.size() == 1 )
|
||||
{
|
||||
// If there's just one, open the config directly w/ the delete button. Otherwise open the multi dialog
|
||||
openAccountConfig( accts.first() );
|
||||
openAccountConfig( accts.first(), true );
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef Q_WS_MAC
|
||||
#ifndef Q_OS_MAC
|
||||
AccountFactoryWrapper dialog( factory, this );
|
||||
QWeakPointer< AccountFactoryWrapper > watcher( &dialog );
|
||||
|
||||
@@ -525,7 +525,7 @@ SettingsDialog::openAccountFactoryConfig( AccountFactory* factory )
|
||||
#else
|
||||
// on osx a sheet needs to be non-modal
|
||||
AccountFactoryWrapper* dialog = new AccountFactoryWrapper( factory, this );
|
||||
connect( dialog, SIGNAL( createAccount( Tomahawk::Accounts::AccountFactory ) ), this, SLOT( createAccountFromFactory( Tomahawk::Accounts::AccountFactory* ) ) );
|
||||
connect( dialog, SIGNAL( createAccount( Tomahawk::Accounts::AccountFactory* ) ), this, SLOT( createAccountFromFactory( Tomahawk::Accounts::AccountFactory* ) ) );
|
||||
|
||||
dialog->show();
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user