mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-27 20:58:47 +00:00
Move proxy initialization into shared code
This way we can use the same code on desktop and mobile app. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
76d0763527
commit
97fa132202
4 changed files with 17 additions and 9 deletions
|
@ -41,6 +41,7 @@
|
|||
#include "windowtitleupdate.h"
|
||||
#include "locationinformation.h"
|
||||
#include "preferences/preferencesdialog.h"
|
||||
#include "qt-gui.h"
|
||||
|
||||
#ifndef NO_USERMANUAL
|
||||
#include "usermanual.h"
|
||||
|
@ -1234,15 +1235,7 @@ void MainWindow::readSettings()
|
|||
default_dive_computer_device = getSetting(s, "dive_computer_device");
|
||||
default_dive_computer_download_mode = s.value("dive_computer_download_mode").toInt();
|
||||
s.endGroup();
|
||||
QNetworkProxy proxy;
|
||||
proxy.setType(QNetworkProxy::ProxyType(prefs.proxy_type));
|
||||
proxy.setHostName(prefs.proxy_host);
|
||||
proxy.setPort(prefs.proxy_port);
|
||||
if (prefs.proxy_auth) {
|
||||
proxy.setUser(prefs.proxy_user);
|
||||
proxy.setPassword(prefs.proxy_pass);
|
||||
}
|
||||
QNetworkProxy::setApplicationProxy(proxy);
|
||||
init_proxy();
|
||||
|
||||
// now make sure that the cloud menu items are enabled IFF cloud account is verified
|
||||
enableDisableCloudActions();
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
void init_qt_late();
|
||||
void init_ui();
|
||||
void init_proxy();
|
||||
|
||||
void run_ui();
|
||||
void exit_ui();
|
||||
|
|
|
@ -27,6 +27,19 @@ void init_ui()
|
|||
init_qt_late();
|
||||
}
|
||||
|
||||
void init_proxy()
|
||||
{
|
||||
QNetworkProxy proxy;
|
||||
proxy.setType(QNetworkProxy::ProxyType(prefs.proxy_type));
|
||||
proxy.setHostName(prefs.proxy_host);
|
||||
proxy.setPort(prefs.proxy_port);
|
||||
if (prefs.proxy_auth) {
|
||||
proxy.setUser(prefs.proxy_user);
|
||||
proxy.setPassword(prefs.proxy_pass);
|
||||
}
|
||||
QNetworkProxy::setApplicationProxy(proxy);
|
||||
}
|
||||
|
||||
void run_ui()
|
||||
{
|
||||
qmlRegisterType<QMLManager>("org.subsurfacedivelog.mobile", 1, 0, "QMLManager");
|
||||
|
|
|
@ -57,6 +57,7 @@ int main(int argc, char **argv)
|
|||
taglist_init_global();
|
||||
init_ui();
|
||||
loadPreferences();
|
||||
init_proxy();
|
||||
if (no_filenames) {
|
||||
if (prefs.default_file_behavior == LOCAL_DEFAULT_FILE) {
|
||||
QString defaultFile(prefs.default_filename);
|
||||
|
|
Loading…
Reference in a new issue