mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +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 "windowtitleupdate.h"
|
||||||
#include "locationinformation.h"
|
#include "locationinformation.h"
|
||||||
#include "preferences/preferencesdialog.h"
|
#include "preferences/preferencesdialog.h"
|
||||||
|
#include "qt-gui.h"
|
||||||
|
|
||||||
#ifndef NO_USERMANUAL
|
#ifndef NO_USERMANUAL
|
||||||
#include "usermanual.h"
|
#include "usermanual.h"
|
||||||
|
@ -1234,15 +1235,7 @@ void MainWindow::readSettings()
|
||||||
default_dive_computer_device = getSetting(s, "dive_computer_device");
|
default_dive_computer_device = getSetting(s, "dive_computer_device");
|
||||||
default_dive_computer_download_mode = s.value("dive_computer_download_mode").toInt();
|
default_dive_computer_download_mode = s.value("dive_computer_download_mode").toInt();
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
QNetworkProxy proxy;
|
init_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);
|
|
||||||
|
|
||||||
// now make sure that the cloud menu items are enabled IFF cloud account is verified
|
// now make sure that the cloud menu items are enabled IFF cloud account is verified
|
||||||
enableDisableCloudActions();
|
enableDisableCloudActions();
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
void init_qt_late();
|
void init_qt_late();
|
||||||
void init_ui();
|
void init_ui();
|
||||||
|
void init_proxy();
|
||||||
|
|
||||||
void run_ui();
|
void run_ui();
|
||||||
void exit_ui();
|
void exit_ui();
|
||||||
|
|
|
@ -27,6 +27,19 @@ void init_ui()
|
||||||
init_qt_late();
|
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()
|
void run_ui()
|
||||||
{
|
{
|
||||||
qmlRegisterType<QMLManager>("org.subsurfacedivelog.mobile", 1, 0, "QMLManager");
|
qmlRegisterType<QMLManager>("org.subsurfacedivelog.mobile", 1, 0, "QMLManager");
|
||||||
|
|
|
@ -57,6 +57,7 @@ int main(int argc, char **argv)
|
||||||
taglist_init_global();
|
taglist_init_global();
|
||||||
init_ui();
|
init_ui();
|
||||||
loadPreferences();
|
loadPreferences();
|
||||||
|
init_proxy();
|
||||||
if (no_filenames) {
|
if (no_filenames) {
|
||||||
if (prefs.default_file_behavior == LOCAL_DEFAULT_FILE) {
|
if (prefs.default_file_behavior == LOCAL_DEFAULT_FILE) {
|
||||||
QString defaultFile(prefs.default_filename);
|
QString defaultFile(prefs.default_filename);
|
||||||
|
|
Loading…
Add table
Reference in a new issue