aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/downloader.cpp19
-rw-r--r--src/configdialog.cpp25
-rw-r--r--src/configdialog.ui181
3 files changed, 217 insertions, 8 deletions
diff --git a/lib/downloader.cpp b/lib/downloader.cpp
index e025e4f52..b202b4436 100644
--- a/lib/downloader.cpp
+++ b/lib/downloader.cpp
@@ -20,6 +20,8 @@
#include <QApplication>
#include <QStringList>
+#include <QSettings>
+#include <QDir>
#include "downloader.h"
@@ -195,6 +197,21 @@ void Downloader::run()
{
qDebug("Downloader: starting download thread");
m_handle = curl_easy_init();
+
+ //proxy
+ QSettings settings ( QDir::homePath() +"/.qmmp/qmmprc", QSettings::IniFormat );
+ if (settings.value ("Proxy/use_proxy", FALSE).toBool())
+ curl_easy_setopt(m_handle, CURLOPT_PROXY,
+ (settings.value("Proxy/host").toString()+":"+
+ settings.value("Proxy/port").toString()).
+ toLatin1 ().constData ());
+
+ if (settings.value ("Proxy/authentication", FALSE).toBool())
+ curl_easy_setopt(m_handle, CURLOPT_PROXYUSERPWD,
+ (settings.value("Proxy/user").toString()+":"+
+ settings.value("Proxy/passw").toString()).
+ toLatin1 ().constData ());
+
// Set url to download
curl_easy_setopt(m_handle, CURLOPT_URL, m_url.toAscii().constData());
//qDebug("Downloader: url: %s", qPrintable(url));
@@ -276,7 +293,7 @@ void Downloader::readICYMetaData()
{
int size = packet_size * 16;
char packet[size];
- while(m_stream.buf_fill < size && isRunning())
+ while (m_stream.buf_fill < size && isRunning())
{
m_mutex.unlock();
qApp->processEvents();
diff --git a/src/configdialog.cpp b/src/configdialog.cpp
index cae96b05a..58b0b37a7 100644
--- a/src/configdialog.cpp
+++ b/src/configdialog.cpp
@@ -94,10 +94,26 @@ void ConfigDialog::readSettings()
settings.value("FileDialog",QtFileDialogFactory::QtFileDialogFactoryName).toString();
int ind = FileDialog::registeredFactories().indexOf(f_dialogName);
- if(ind != -1)
+ if (ind != -1)
ui.fileDialogComboBox->setCurrentIndex(ind);
else
ui.fileDialogComboBox->setCurrentIndex(0);
+
+ //proxy settings
+ ui.enableProxyCheckBox->setChecked(
+ settings.value ("Proxy/use_proxy", FALSE).toBool());
+ ui.authProxyCheckBox->setChecked(
+ settings.value ("Proxy/authentication", FALSE).toBool());
+
+ ui.hostLineEdit->setText(settings.value("Proxy/host").toString());
+ ui.portLineEdit->setText(settings.value("Proxy/port").toString());
+ ui.proxyUserLineEdit->setText(settings.value("Proxy/user").toString());
+ ui.proxyPasswLineEdit->setText(settings.value("Proxy/passw").toString());
+
+ ui.hostLineEdit->setEnabled(ui.enableProxyCheckBox->isChecked());
+ ui.portLineEdit->setEnabled(ui.enableProxyCheckBox->isChecked());
+ ui.proxyUserLineEdit->setEnabled(ui.authProxyCheckBox->isChecked());
+ ui.proxyPasswLineEdit->setEnabled(ui.authProxyCheckBox->isChecked());
}
void ConfigDialog::changePage ( QListWidgetItem *current, QListWidgetItem *previous )
@@ -342,6 +358,11 @@ void ConfigDialog::saveSettings()
settings.setValue ("Tray/show_tooltip", ui.toolTipCheckBox->isChecked());
settings.setValue ("Tray/hide_on_close",ui.hideToTrayRadioButton->isChecked());
settings.setValue ("FileDialog", ui.fileDialogComboBox->currentText());
+ settings.setValue ("Proxy/use_proxy", ui.enableProxyCheckBox->isChecked());
+ settings.setValue ("Proxy/authentication", ui.authProxyCheckBox->isChecked());
+ settings.setValue ("Proxy/host",ui.hostLineEdit->text());
+ settings.setValue ("Proxy/port",ui.portLineEdit->text());
+ settings.setValue ("Proxy/user",ui.proxyUserLineEdit->text());
+ settings.setValue ("Proxy/passw",ui.proxyPasswLineEdit->text());
}
-
diff --git a/src/configdialog.ui b/src/configdialog.ui
index 9e2c58712..3d1c462ea 100644
--- a/src/configdialog.ui
+++ b/src/configdialog.ui
@@ -124,6 +124,11 @@
<iconset resource="images/images.qrc" >:/advanced.png</iconset>
</property>
</item>
+ <item>
+ <property name="text" >
+ <string>Connectivity</string>
+ </property>
+ </item>
</widget>
</item>
<item>
@@ -760,6 +765,108 @@
</item>
</layout>
</widget>
+ <widget class="QWidget" name="network" >
+ <layout class="QVBoxLayout" >
+ <item>
+ <widget class="QGroupBox" name="groupBox_5" >
+ <property name="title" >
+ <string>Proxy</string>
+ </property>
+ <property name="flat" >
+ <bool>false</bool>
+ </property>
+ <property name="checkable" >
+ <bool>false</bool>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" colspan="2" >
+ <widget class="QCheckBox" name="enableProxyCheckBox" >
+ <property name="text" >
+ <string>Enable proxy usage</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="QLabel" name="label_5" >
+ <property name="text" >
+ <string>Proxy host name:</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1" >
+ <widget class="QLineEdit" name="hostLineEdit" />
+ </item>
+ <item row="2" column="0" >
+ <widget class="QLabel" name="label_6" >
+ <property name="text" >
+ <string>Proxy port:</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1" >
+ <widget class="QLineEdit" name="portLineEdit" />
+ </item>
+ <item row="3" column="0" colspan="2" >
+ <widget class="QCheckBox" name="authProxyCheckBox" >
+ <property name="text" >
+ <string>Use authentication with proxy</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0" >
+ <widget class="QLabel" name="label_7" >
+ <property name="text" >
+ <string>Proxy user name:</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1" >
+ <widget class="QLineEdit" name="proxyUserLineEdit" />
+ </item>
+ <item row="5" column="0" >
+ <widget class="QLabel" name="label_8" >
+ <property name="text" >
+ <string>Proxy password:</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="1" >
+ <widget class="QLineEdit" name="proxyPasswLineEdit" >
+ <property name="echoMode" >
+ <enum>QLineEdit::Password</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
</widget>
</item>
</layout>
@@ -823,7 +930,7 @@
<slot>accept()</slot>
<hints>
<hint type="sourcelabel" >
- <x>510</x>
+ <x>590</x>
<y>364</y>
</hint>
<hint type="destinationlabel" >
@@ -839,12 +946,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel" >
- <x>344</x>
- <y>66</y>
+ <x>550</x>
+ <y>64</y>
</hint>
<hint type="destinationlabel" >
- <x>177</x>
- <y>113</y>
+ <x>383</x>
+ <y>118</y>
</hint>
</hints>
</connection>
@@ -912,5 +1019,69 @@
</hint>
</hints>
</connection>
+ <connection>
+ <sender>enableProxyCheckBox</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>hostLineEdit</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>305</x>
+ <y>52</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>424</x>
+ <y>82</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>enableProxyCheckBox</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>portLineEdit</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>506</x>
+ <y>56</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>506</x>
+ <y>116</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>authProxyCheckBox</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>proxyUserLineEdit</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>318</x>
+ <y>142</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>326</x>
+ <y>163</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>authProxyCheckBox</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>proxyPasswLineEdit</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>264</x>
+ <y>138</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>334</x>
+ <y>204</y>
+ </hint>
+ </hints>
+ </connection>
</connections>
</ui>