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