diff --git a/CMakeLists.txt b/CMakeLists.txt index be78309e9..b78e0a41d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}) diff --git a/ChangeLog b/ChangeLog index e15b38261..4eeb35ac5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 ----- diff --git a/INSTALL b/INSTALL index 89040db42..9d7ee6af7 100644 --- a/INSTALL +++ b/INSTALL @@ -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= diff --git a/config.h.cmake b/config.h.cmake index a0eb1350a..47f5a8a9d 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -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 diff --git a/gui/preferencesdialog.cpp b/gui/preferencesdialog.cpp index 4f60efb94..2822726b4 100644 --- a/gui/preferencesdialog.cpp +++ b/gui/preferencesdialog.cpp @@ -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 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 diff --git a/gui/preferencesdialog.h b/gui/preferencesdialog.h index 692d6fd2d..ac0e7a0d1 100644 --- a/gui/preferencesdialog.h +++ b/gui/preferencesdialog.h @@ -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; diff --git a/network/networkproxyfactory.cpp b/network/networkproxyfactory.cpp index ebba36819..843dcbc4a 100644 --- a/network/networkproxyfactory.cpp +++ b/network/networkproxyfactory.cpp @@ -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 NetworkProxyFactory::queryProxy(const QNetworkProxyQuery& query) { + #ifdef ENABLE_PROXY_CONFIG QMutexLocker l(&mutex); QNetworkProxy ret; @@ -122,4 +127,21 @@ QList NetworkProxyFactory::queryProxy(const QNetworkProxyQuery& q } return QList() << 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() << ret; + #else + return systemProxyForQuery(query); + #endif } diff --git a/network/networkproxyfactory.h b/network/networkproxyfactory.h index 58f6e54d5..5f2a2e41d 100644 --- a/network/networkproxyfactory.h +++ b/network/networkproxyfactory.h @@ -27,6 +27,7 @@ #include #include #include +#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;