summary refs log tree commit diff
path: root/src/main.cc
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-06-09 16:03:14 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-06-09 16:03:14 +0300
commitb89257a34b2a98b737f4ae544f7e436b9000b240 (patch)
tree81d7f355721541afbd91dc9a085abbb4666f3565 /src/main.cc
parentInstall missing dependencies in travis-ci/appveyor (diff)
downloadnheko-b89257a34b2a98b737f4ae544f7e436b9000b240.tar.xz
Migrate to mtxclient for the http calls
Diffstat (limited to 'src/main.cc')
-rw-r--r--src/main.cc46
1 files changed, 16 insertions, 30 deletions
diff --git a/src/main.cc b/src/main.cc

index bd3a212c..1df8d0c9 100644 --- a/src/main.cc +++ b/src/main.cc
@@ -22,15 +22,17 @@ #include <QLabel> #include <QLayout> #include <QLibraryInfo> -#include <QNetworkProxy> #include <QPalette> #include <QPoint> #include <QPushButton> #include <QSettings> +#include <QStandardPaths> #include <QTranslator> #include "Config.h" +#include "Logging.hpp" #include "MainWindow.h" +#include "MatrixClient.h" #include "RaisedButton.h" #include "RunGuard.h" #include "version.hpp" @@ -46,32 +48,6 @@ screenCenter(int width, int height) return QPoint(x, y); } -void -setupProxy() -{ - QSettings settings; - - /** - To set up a SOCKS proxy: - [user] - proxy\socks\host=<> - proxy\socks\port=<> - proxy\socks\user=<> - proxy\socks\password=<> - **/ - if (settings.contains("user/proxy/socks/host")) { - QNetworkProxy proxy; - proxy.setType(QNetworkProxy::Socks5Proxy); - proxy.setHostName(settings.value("user/proxy/socks/host").toString()); - proxy.setPort(settings.value("user/proxy/socks/port").toInt()); - if (settings.contains("user/proxy/socks/user")) - proxy.setUser(settings.value("user/proxy/socks/user").toString()); - if (settings.contains("user/proxy/socks/password")) - proxy.setPassword(settings.value("user/proxy/socks/password").toString()); - QNetworkProxy::setApplicationProxy(proxy); - } -} - int main(int argc, char *argv[]) { @@ -133,7 +109,17 @@ main(int argc, char *argv[]) QFontDatabase::addApplicationFont(":/fonts/fonts/EmojiOne/emojione-android.ttf"); app.setWindowIcon(QIcon(":/logos/nheko.png")); - qSetMessagePattern("%{time process}: [%{type}] - %{message}"); + + http::init(); + + try { + log::init(QString("%1/nheko.log") + .arg(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)) + .toStdString()); + } catch (const spdlog::spdlog_ex &ex) { + std::cout << "Log initialization failed: " << ex.what() << std::endl; + std::exit(1); + } QSettings settings; @@ -154,8 +140,6 @@ main(int argc, char *argv[]) appTranslator.load("nheko_" + lang, ":/translations"); app.installTranslator(&appTranslator); - setupProxy(); - MainWindow w; // Move the MainWindow to the center @@ -167,5 +151,7 @@ main(int argc, char *argv[]) QObject::connect(&app, &QApplication::aboutToQuit, &w, &MainWindow::saveCurrentWindowSize); + log::main()->info("starting nheko {}", nheko::version); + return app.exec(); }