1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-11 16:44:05 +02:00

Fix up non-mac with new qocoa widget

This commit is contained in:
Leo Franchi
2012-08-08 16:08:49 -04:00
parent fc712fba19
commit 8f86171130
7 changed files with 77 additions and 72 deletions

View File

@@ -237,16 +237,17 @@ SettingsDialog::SettingsDialog(QObject *parent )
connect( m_advancedWidgetUi->staticIpRadioButton, SIGNAL( toggled(bool) ), SLOT( toggleRemoteMode() ) );
connect( m_advancedWidgetUi->upnpRadioButton, SIGNAL( toggled(bool) ), SLOT( toggleRemoteMode() ) );
connect( m_advancedWidgetUi->enableProxyCheckBox, SIGNAL( toggled(bool) ), SLOT( toggleProxyEnabled() ) );
// connect( this, SIGNAL( rejected() ), SLOT( onRejected() ) );
connect( m_dialog, SIGNAL( accepted() ), SLOT( saveSettings() ) );
connect( m_dialog, SIGNAL( rejected() ), SLOT( onRejected() ) );
}
SettingsDialog::~SettingsDialog()
void
SettingsDialog::saveSettings()
{
qDebug() << Q_FUNC_INFO;
if ( !m_rejected )
{
TomahawkSettings* s = TomahawkSettings::instance();
s->setCrashReporterEnabled( m_advancedWidgetUi->checkBoxReporter->checkState() == Qt::Checked );
@@ -287,10 +288,11 @@ SettingsDialog::~SettingsDialog()
proxyFactory->setNoProxyHosts( s->proxyNoProxyHosts().split( ' ', QString::SkipEmptyParts ) );
}
}
}
else
qDebug() << "Settings dialog cancelled, NOT saving prefs.";
}
SettingsDialog::~SettingsDialog()
{
m_accountsWidget->deleteLater();
m_collectionWidget->deleteLater();
m_advancedWidget->deleteLater();
@@ -311,17 +313,6 @@ SettingsDialog::serventReady()
}
//void
//SettingsDialog::changePage( QAction *action )
//{
// int index = m_settingsGroup->actions().indexOf( action );
// if( ui->stackedWidget->currentIndex() != index )
// {
// ui->stackedWidget->setCurrentIndex( index );
// }
//}
void
SettingsDialog::onRejected()
{
@@ -417,7 +408,7 @@ SettingsDialog::openAccountFactoryConfig( AccountFactory* factory )
}
#ifndef Q_OS_MAC
AccountFactoryWrapper dialog( factory, this );
AccountFactoryWrapper dialog( factory, 0 );
QWeakPointer< AccountFactoryWrapper > watcher( &dialog );
dialog.exec();

View File

@@ -106,9 +106,10 @@ private slots:
void requiresRestart();
private:
void createIcons();
private slots:
void saveSettings();
private:
Ui_Settings_Accounts* m_accountsWidgetUi;
QWidget* m_accountsWidget;

View File

@@ -100,6 +100,7 @@ TomahawkWindow::TomahawkWindow( QWidget* parent )
, m_searchWidget( 0 )
, m_audioControls( new AudioControls( this ) )
, m_trayIcon( new TomahawkTrayIcon( this ) )
, m_settingsDialog( 0 )
, m_audioRetryCounter( 0 )
{
setWindowIcon( QIcon( RESPATH "icons/tomahawk-icon-128x128.png" ) );
@@ -809,8 +810,10 @@ TomahawkWindow::onHistoryForwardAvailable( bool avail )
void
TomahawkWindow::showSettingsDialog()
{
SettingsDialog win;
win.show();
if ( !m_settingsDialog )
m_settingsDialog = new SettingsDialog;
m_settingsDialog->show();
}

View File

@@ -37,6 +37,7 @@
#include <shobjidl.h>
#endif
class SettingsDialog;
namespace Tomahawk
{
namespace Accounts
@@ -184,6 +185,7 @@ private:
QueueView* m_queueView;
AnimatedSplitter* m_sidebar;
JobStatusSortModel* m_jobsModel;
SettingsDialog* m_settingsDialog;
// Menus and menu actions: Accounts menu
QMenuBar *m_menuBar;

View File

@@ -409,7 +409,7 @@ IF( APPLE )
/System/Library/Frameworks/Security.framework
)
ELSE( APPLE )
SET( libGuiSources ${libGuiSources} thirdparty/Qocoa/qsearchfield.cpp thirdparty/Qocoa/qtoolbartabdialog_nonmac.cpp )
SET( libGuiSources ${libGuiSources} thirdparty/Qocoa/qsearchfield.cpp thirdparty/Qocoa/qtoolbartabdialog.cpp )
ENDIF( APPLE )
IF(LIBLASTFM_FOUND)

View File

@@ -19,11 +19,12 @@ public slots:
return;
const int idx = toolbar->actions().indexOf(action);
Q_ASSERT(idx > -1);
if (idx < 0)
// There's a left spacer, so we want 1 less
Q_ASSERT(idx > 0);
if (idx < 1)
return;
stack->setCurrentIndex(idx);
stack->setCurrentIndex(idx - 1);
}
void accepted() {
@@ -133,7 +134,7 @@ void QToolbarTabDialog::setCurrentIndex(int index)
return;
Q_ASSERT(index < pimpl->toolbar->actions().length());
Q_ASSERT(index < pimpl->toolbar->actions().length() + 1);
Q_ASSERT(index < pimpl->stack->count());
if (index < 0 || index > pimpl->toolbar->actions().length())
return;
@@ -142,6 +143,11 @@ void QToolbarTabDialog::setCurrentIndex(int index)
if (pimpl->stack->currentIndex() != index)
pimpl->stack->setCurrentIndex(index);
// 1 spacer item before the first action
QAction* toCheck = pimpl->toolbar->actions().at(index + 1);
if (pimpl->actionGroup->checkedAction() != toCheck)
toCheck->setChecked(true);
}
void QToolbarTabDialog::show()
@@ -164,4 +170,4 @@ void QToolbarTabDialog::hide()
pimpl->dialog.data()->hide();
}
#include "moc_qtoolbartabdialog_nonmac.cpp"
#include "qtoolbartabdialog.moc"

View File

@@ -68,6 +68,8 @@ SourceTreeView::SourceTreeView( QWidget* parent )
setAttribute( Qt::WA_MacShowFocusRect, 0 );
setContentsMargins( 0, 0, 0, 0 );
tDebug() << "POINT SIZEL" << font().pointSize();
QFont fnt;
fnt.setPointSize( font().pointSize() - 1 );
setFont( fnt );