Dont build proxy config dialog by default, proxy config should really be a system thing - and not a feature you would expect in a music player!

This commit is contained in:
craig.p.drummond
2013-06-24 18:47:53 +00:00
parent e595692ff7
commit d3cee2f516
8 changed files with 48 additions and 5 deletions

View File

@@ -37,6 +37,7 @@ option(ENABLE_CDPARANOIA "Enable CDParanoia libraries(required for AudioCD suppo
option(ENABLE_CDDB "Enable CDDB libraries(either this or MusicBrianz required for AudioCD support)" ON)
option(ENABLE_MUSICBRAINZ "Enable MusicBrianz libraries(either this or CDDB required for AudioCD support)" ON)
option(ENABLE_LAME "Enable LAME libraries(required for AudioCD playback support)" ON)
option(ENABLE_PROXY_CONFIG "Enable proxy config in settings dialog" OFF)
if (ENABLE_QT5)
set(ENABLE_KDE FALSE)
@@ -432,9 +433,12 @@ else (ENABLE_KDE_SUPPORT)
endif (MINGW)
endif (WIN32)
set(CANTATA_SRCS ${CANTATA_SRCS} network/networkproxyfactory.cpp network/proxysettings.cpp)
set(CANTATA_MOC_HDRS ${CANTATA_MOC_HDRS} network/proxysettings.h)
set(CANTATA_UIS ${CANTATA_UIS} network/proxysettings.ui)
set(CANTATA_SRCS ${CANTATA_SRCS} network/networkproxyfactory.cpp)
if (ENABLE_PROXY_CONFIG)
set(CANTATA_SRCS ${CANTATA_SRCS} network/proxysettings.cpp)
set(CANTATA_MOC_HDRS ${CANTATA_MOC_HDRS} network/proxysettings.h)
set(CANTATA_UIS ${CANTATA_UIS} network/proxysettings.ui)
endif (ENABLE_PROXY_CONFIG)
set(CANTATA_RCS ${CANTATA_RCS} cantata_qt.qrc)
if (ENABLE_QT5)
QT5_ADD_RESOURCES(CANTATA_RC_SRCS ${CANTATA_RCS})

View File

@@ -93,6 +93,8 @@
58. Add support for a simple profile where MPD is started by cantata, and
the only settings are the music folder and cover names.
59. Combine Output and Playback config pages.
60. Remove proxy config from settings, and always use system proxy.
To re-enable proxy settings pass -DENABLE_PROXY_CONFIG=ON to cmake.
1.0.3
-----

View File

@@ -69,6 +69,11 @@ The following options may be passed to CMake:
Enable support for Jamendo and Magnatune online services.
Default: ON
-DENABLE_PROXY_CONFIG=ON
Enable support fpor proxy settings in config dialog. If disabled,i
system proxy settings are used.
NOTE: Applies to Qt builds only.
Default: OFF
...windows specific...
-DCANTATA_WINDOWS_INSTALLER_DEST=<folder>

View File

@@ -33,6 +33,7 @@
#cmakedefine ENABLE_REMOTE_DEVICES 1
#cmakedefine ENABLE_ONLINE_SERVICES 1
#cmakedefine TAGLIB_CAN_SAVE_ID3VER 1
#cmakedefine ENABLE_PROXY_CONFIG 1
/*
This is done via CMake add_defintions - as it controls SLOT generation in GtkProxyStyle

View File

@@ -93,9 +93,11 @@ PreferencesDialog::PreferencesDialog(QWidget *parent)
widget->addPage(audiocd, i18n("Audio CD"), Icon("media-optical"), i18n("Audio CD Settings"));
#endif
#ifndef ENABLE_KDE_SUPPORT
#ifdef ENABLE_PROXY_CONFIG
proxy = new ProxySettings(0);
proxy->load();
widget->addPage(proxy, i18nc("Qt-only", "Proxy"), Icon("preferences-system-network"), i18nc("Qt-only", "Proxy Settings"));
#endif // ENABLE_PROXY_CONFIG
QHash<QString, ActionCollection *> map;
map.insert("Cantata", ActionCollection::get());
shortcuts = new ShortcutsSettingsPage(map, widget);
@@ -107,9 +109,9 @@ PreferencesDialog::PreferencesDialog(QWidget *parent)
// widget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
widget->allPagesAdded();
#ifndef ENABLE_KDE_SUPPORT
int h=(widget->minimumHeight()/widget->count())*(widget->count()+1);
int h=(widget->minimumHeight()/widget->count())*11;
setMinimumHeight(h);
setMinimumWidth(h*0.8);
setMinimumWidth(h*1.333);
#endif
setCaption(i18n("Configure"));
setMainWidget(widget);
@@ -136,7 +138,9 @@ void PreferencesDialog::writeSettings()
}
#endif
#ifndef ENABLE_KDE_SUPPORT
#ifdef ENABLE_PROXY_CONFIG
proxy->save();
#endif
shortcuts->save();
#endif
#if defined CDDB_FOUND || defined MUSICBRAINZ5_FOUND

View File

@@ -75,7 +75,9 @@ private:
HttpServerSettings *http;
#endif
#ifndef ENABLE_KDE_SUPPORT
#ifdef ENABLE_PROXY_CONFIG
ProxySettings *proxy;
#endif // ENABLE_PROXY_CONFIG
ShortcutsSettingsPage *shortcuts;
#endif
CacheSettings *cache;

View File

@@ -69,6 +69,7 @@ NetworkProxyFactory * NetworkProxyFactory::self()
void NetworkProxyFactory::reloadSettings()
{
#ifdef ENABLE_PROXY_CONFIG
QMutexLocker l(&mutex);
QSettings s;
@@ -80,10 +81,14 @@ void NetworkProxyFactory::reloadSettings()
port = s.value("port", 8080).toInt();
username = s.value("username").toString();
password = s.value("password").toString();
#else
mode = Mode_System;
#endif
}
QList<QNetworkProxy> NetworkProxyFactory::queryProxy(const QNetworkProxyQuery& query)
{
#ifdef ENABLE_PROXY_CONFIG
QMutexLocker l(&mutex);
QNetworkProxy ret;
@@ -122,4 +127,21 @@ QList<QNetworkProxy> NetworkProxyFactory::queryProxy(const QNetworkProxyQuery& q
}
return QList<QNetworkProxy>() << ret;
#elif defined Q_OS_LINUX && QT_VERSION < 0x050000
Q_UNUSED(query);
QNetworkProxy ret;
if (envUrl.isEmpty()) {
ret.setType(QNetworkProxy::NoProxy);
} else {
ret.setHostName(envUrl.host());
ret.setPort(envUrl.port());
ret.setUser(envUrl.userName());
ret.setPassword(envUrl.password());
ret.setType(envUrl.scheme().startsWith("http") ? QNetworkProxy::HttpProxy : QNetworkProxy::Socks5Proxy);
}
return QList<QNetworkProxy>() << ret;
#else
return systemProxyForQuery(query);
#endif
}

View File

@@ -27,6 +27,7 @@
#include <QMutex>
#include <QNetworkProxyFactory>
#include <QUrl>
#include "config.h"
class NetworkProxyFactory : public QNetworkProxyFactory
{
@@ -49,7 +50,9 @@ private:
NetworkProxyFactory();
private:
#ifdef ENABLE_PROXY_CONFIG
QMutex mutex;
#endif
Mode mode;
QNetworkProxy::ProxyType type;
QString hostname;