mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-10 16:14:40 +02:00
Fix up non-mac with new qocoa widget
This commit is contained in:
@@ -237,60 +237,62 @@ 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() ) );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SettingsDialog::saveSettings()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
|
||||
TomahawkSettings* s = TomahawkSettings::instance();
|
||||
|
||||
s->setCrashReporterEnabled( m_advancedWidgetUi->checkBoxReporter->checkState() == Qt::Checked );
|
||||
s->setHttpEnabled( m_advancedWidgetUi->checkBoxHttp->checkState() == Qt::Checked );
|
||||
s->setProxyType( m_advancedWidgetUi->enableProxyCheckBox->isChecked() ? QNetworkProxy::Socks5Proxy : QNetworkProxy::NoProxy );
|
||||
s->setExternalAddressMode( m_advancedWidgetUi->upnpRadioButton->isChecked() ? TomahawkSettings::Upnp : ( m_advancedWidgetUi->lanOnlyRadioButton->isChecked() ? TomahawkSettings::Lan : TomahawkSettings::Static ) );
|
||||
|
||||
s->setExternalHostname( m_advancedWidgetUi->staticHostName->text() );
|
||||
s->setExternalPort( m_advancedWidgetUi->staticPort->value() );
|
||||
|
||||
s->setScannerPaths( m_collectionWidgetUi->dirTree->getCheckedPaths() );
|
||||
s->setWatchForChanges( m_collectionWidgetUi->checkBoxWatchForChanges->isChecked() );
|
||||
s->setScannerTime( m_collectionWidgetUi->scannerTimeSpinBox->value() );
|
||||
s->setEnableEchonestCatalogs( m_collectionWidgetUi->enableEchonestCatalog->isChecked() );
|
||||
|
||||
// s->setNowPlayingEnabled( ui->checkBoxEnableAdium->isChecked() );
|
||||
|
||||
s->applyChanges();
|
||||
s->sync();
|
||||
|
||||
if ( m_restartRequired )
|
||||
QMessageBox::information( 0, tr( "Information" ), tr( "Some changed settings will not take effect until Tomahawk is restarted" ) );
|
||||
|
||||
TomahawkUtils::NetworkProxyFactory* proxyFactory = TomahawkUtils::proxyFactory();
|
||||
if ( !m_advancedWidgetUi->enableProxyCheckBox->isChecked() )
|
||||
{
|
||||
tDebug() << Q_FUNC_INFO << "Got NoProxy selected";
|
||||
proxyFactory->setProxy( QNetworkProxy::NoProxy );
|
||||
}
|
||||
else
|
||||
{
|
||||
tDebug() << Q_FUNC_INFO << "Got Socks5Proxy selected";
|
||||
proxyFactory->setProxy( QNetworkProxy( QNetworkProxy::Socks5Proxy, s->proxyHost(), s->proxyPort(), s->proxyUsername(), s->proxyPassword() ) );
|
||||
if ( !s->proxyNoProxyHosts().isEmpty() )
|
||||
{
|
||||
tDebug() << Q_FUNC_INFO << "noproxy hosts:" << s->proxyNoProxyHosts();
|
||||
tDebug() << Q_FUNC_INFO << "split noproxy line edit is " << s->proxyNoProxyHosts().split( ' ', QString::SkipEmptyParts );
|
||||
proxyFactory->setNoProxyHosts( s->proxyNoProxyHosts().split( ' ', QString::SkipEmptyParts ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SettingsDialog::~SettingsDialog()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
|
||||
if ( !m_rejected )
|
||||
{
|
||||
TomahawkSettings* s = TomahawkSettings::instance();
|
||||
|
||||
s->setCrashReporterEnabled( m_advancedWidgetUi->checkBoxReporter->checkState() == Qt::Checked );
|
||||
s->setHttpEnabled( m_advancedWidgetUi->checkBoxHttp->checkState() == Qt::Checked );
|
||||
s->setProxyType( m_advancedWidgetUi->enableProxyCheckBox->isChecked() ? QNetworkProxy::Socks5Proxy : QNetworkProxy::NoProxy );
|
||||
s->setExternalAddressMode( m_advancedWidgetUi->upnpRadioButton->isChecked() ? TomahawkSettings::Upnp : ( m_advancedWidgetUi->lanOnlyRadioButton->isChecked() ? TomahawkSettings::Lan : TomahawkSettings::Static ) );
|
||||
|
||||
s->setExternalHostname( m_advancedWidgetUi->staticHostName->text() );
|
||||
s->setExternalPort( m_advancedWidgetUi->staticPort->value() );
|
||||
|
||||
s->setScannerPaths( m_collectionWidgetUi->dirTree->getCheckedPaths() );
|
||||
s->setWatchForChanges( m_collectionWidgetUi->checkBoxWatchForChanges->isChecked() );
|
||||
s->setScannerTime( m_collectionWidgetUi->scannerTimeSpinBox->value() );
|
||||
s->setEnableEchonestCatalogs( m_collectionWidgetUi->enableEchonestCatalog->isChecked() );
|
||||
|
||||
// s->setNowPlayingEnabled( ui->checkBoxEnableAdium->isChecked() );
|
||||
|
||||
s->applyChanges();
|
||||
s->sync();
|
||||
|
||||
if ( m_restartRequired )
|
||||
QMessageBox::information( 0, tr( "Information" ), tr( "Some changed settings will not take effect until Tomahawk is restarted" ) );
|
||||
|
||||
TomahawkUtils::NetworkProxyFactory* proxyFactory = TomahawkUtils::proxyFactory();
|
||||
if ( !m_advancedWidgetUi->enableProxyCheckBox->isChecked() )
|
||||
{
|
||||
tDebug() << Q_FUNC_INFO << "Got NoProxy selected";
|
||||
proxyFactory->setProxy( QNetworkProxy::NoProxy );
|
||||
}
|
||||
else
|
||||
{
|
||||
tDebug() << Q_FUNC_INFO << "Got Socks5Proxy selected";
|
||||
proxyFactory->setProxy( QNetworkProxy( QNetworkProxy::Socks5Proxy, s->proxyHost(), s->proxyPort(), s->proxyUsername(), s->proxyPassword() ) );
|
||||
if ( !s->proxyNoProxyHosts().isEmpty() )
|
||||
{
|
||||
tDebug() << Q_FUNC_INFO << "noproxy hosts:" << s->proxyNoProxyHosts();
|
||||
tDebug() << Q_FUNC_INFO << "split noproxy line edit is " << s->proxyNoProxyHosts().split( ' ', QString::SkipEmptyParts );
|
||||
proxyFactory->setNoProxyHosts( s->proxyNoProxyHosts().split( ' ', QString::SkipEmptyParts ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
qDebug() << "Settings dialog cancelled, NOT saving prefs.";
|
||||
|
||||
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();
|
||||
|
@@ -103,12 +103,13 @@ private slots:
|
||||
void serventReady();
|
||||
|
||||
void aclEntryClearButtonClicked();
|
||||
|
||||
|
||||
void requiresRestart();
|
||||
|
||||
private:
|
||||
void createIcons();
|
||||
private slots:
|
||||
void saveSettings();
|
||||
|
||||
private:
|
||||
Ui_Settings_Accounts* m_accountsWidgetUi;
|
||||
QWidget* m_accountsWidget;
|
||||
|
||||
|
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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)
|
||||
|
@@ -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"
|
@@ -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 );
|
||||
|
Reference in New Issue
Block a user