Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/zealdocs/zeal into cancel…
Browse files Browse the repository at this point in the history
…-download-button
  • Loading branch information
nishanthkarthik committed Nov 8, 2018
2 parents 5edd2e6 + 1062848 commit 6337c76
Show file tree
Hide file tree
Showing 5 changed files with 213 additions and 247 deletions.
11 changes: 4 additions & 7 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,12 @@ before_build:
-DZEAL_PORTABLE_BUILD="${ZEAL_PORTABLE_BUILD}"
cd ..
build:
project: dist\ALL_BUILD.vcxproj
parallel: true
verbosity: minimal
build_script:
- ps: |-
msbuild "dist\ALL_BUILD.vcxproj" /m /verbosity:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
- sh: |-
cmake --build build
test: off
before_package:
after_build:
- ps: |-
$package = "zeal"
Expand Down Expand Up @@ -161,6 +158,7 @@ before_package:
$archiveName = "$deploymentDir.zip"
& 7z a -mx=9 "$archiveName" "$deploymentDir"
test: off
artifacts:
- path: zeal-*.zip
deploy:
Expand All @@ -174,4 +172,3 @@ deploy:
version: $(ZEAL_PKG_VERSION)
publish: true
override: true

13 changes: 9 additions & 4 deletions src/libs/core/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,16 +209,21 @@ void Application::applySettings()

// HTTP Proxy Settings
switch (m_settings->proxyType) {
case Core::Settings::ProxyType::None:
case Settings::ProxyType::None:
QNetworkProxy::setApplicationProxy(QNetworkProxy::NoProxy);
break;

case Core::Settings::ProxyType::System:
case Settings::ProxyType::System:
QNetworkProxyFactory::setUseSystemConfiguration(true);
break;

case Core::Settings::ProxyType::UserDefined: {
QNetworkProxy proxy(QNetworkProxy::HttpProxy, m_settings->proxyHost, m_settings->proxyPort);
case Settings::ProxyType::Http:
case Settings::ProxyType::Socks5: {
const QNetworkProxy::ProxyType type = m_settings->proxyType == Settings::ProxyType::Socks5
? QNetworkProxy::Socks5Proxy
: QNetworkProxy::HttpProxy;

QNetworkProxy proxy(type, m_settings->proxyHost, m_settings->proxyPort);
if (m_settings->proxyAuthenticate) {
proxy.setUser(m_settings->proxyUserName);
proxy.setPassword(m_settings->proxyPassword);
Expand Down
7 changes: 4 additions & 3 deletions src/libs/core/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,10 @@ class Settings : public QObject

// Network
enum ProxyType : unsigned int {
None,
System,
UserDefined
None = 0,
System = 1,
Http = 3,
Socks5 = 4
};
Q_ENUM(ProxyType)

Expand Down
42 changes: 26 additions & 16 deletions src/libs/ui/settingsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,16 +224,21 @@ void SettingsDialog::loadSettings()
case Core::Settings::ProxyType::System:
ui->systemProxySettings->setChecked(true);
break;
case Core::Settings::ProxyType::UserDefined:
case Core::Settings::ProxyType::Http:
ui->manualProxySettings->setChecked(true);
ui->proxyTypeHttpRadioButton->setChecked(true);
break;
case Core::Settings::ProxyType::Socks5:
ui->manualProxySettings->setChecked(true);
ui->proxyTypeSocks5RadioButton->setChecked(true);
break;
}

ui->httpProxy->setText(settings->proxyHost);
ui->httpProxyPort->setValue(settings->proxyPort);
ui->httpProxyNeedsAuth->setChecked(settings->proxyAuthenticate);
ui->httpProxyUser->setText(settings->proxyUserName);
ui->httpProxyPass->setText(settings->proxyPassword);
ui->proxyHostEdit->setText(settings->proxyHost);
ui->proxyPortEdit->setValue(settings->proxyPort);
ui->proxyRequiresAuthCheckBox->setChecked(settings->proxyAuthenticate);
ui->proxyUsernameEdit->setText(settings->proxyUserName);
ui->proxyPasswordEdit->setText(settings->proxyPassword);
}

void SettingsDialog::saveSettings()
Expand Down Expand Up @@ -285,18 +290,23 @@ void SettingsDialog::saveSettings()

// Network Tab
// Proxy settings
if (ui->noProxySettings->isChecked())
if (ui->noProxySettings->isChecked()) {
settings->proxyType = Core::Settings::ProxyType::None;
else if (ui->systemProxySettings->isChecked())
} else if (ui->systemProxySettings->isChecked()) {
settings->proxyType = Core::Settings::ProxyType::System;
else if (ui->manualProxySettings->isChecked())
settings->proxyType = Core::Settings::ProxyType::UserDefined;

settings->proxyHost = ui->httpProxy->text();
settings->proxyPort = ui->httpProxyPort->text().toUShort();
settings->proxyAuthenticate = ui->httpProxyNeedsAuth->isChecked();
settings->proxyUserName = ui->httpProxyUser->text();
settings->proxyPassword = ui->httpProxyPass->text();
} else if (ui->manualProxySettings->isChecked()) {
if (ui->proxyTypeSocks5RadioButton->isChecked()) {
settings->proxyType = Core::Settings::ProxyType::Socks5;
} else {
settings->proxyType = Core::Settings::ProxyType::Http;
}
}

settings->proxyHost = ui->proxyHostEdit->text();
settings->proxyPort = ui->proxyPortEdit->text().toUShort();
settings->proxyAuthenticate = ui->proxyRequiresAuthCheckBox->isChecked();
settings->proxyUserName = ui->proxyUsernameEdit->text();
settings->proxyPassword = ui->proxyPasswordEdit->text();

settings->save();
}
Loading

0 comments on commit 6337c76

Please sign in to comment.