aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-05-04 21:03:14 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2018-05-04 21:03:14 +0200
commit591e25eb4431e44e8ae28da299e2f024a95c2c03 (patch)
tree5963ced1a971fb630d70125b4b03cc9da3e8c8e2 /src/main.cpp
parentMerge address bar menus (diff)
downloadsmolbote-591e25eb4431e44e8ae28da299e2f024a95c2c03.tar.xz
Stylesheet load setting
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index bfe4ecd..548aec8 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -12,11 +12,15 @@
#include "webengine/webprofile.h"
#include <configuration/configuration.h>
#include <memory>
+#include <QFile>
int main(int argc, char **argv)
{
Browser app(argc, argv);
+ // set this, otherwise the webview becomes black when using a stylesheet
+ app.setAttribute(Qt::AA_DontCreateNativeWidgetSiblings, true);
+
// create and load configuration
std::shared_ptr<Configuration> config = std::make_shared<Configuration>();
if(!config->parseCommandLine(argc, argv)) {
@@ -37,6 +41,15 @@ int main(int argc, char **argv)
// if we are the only instance, set up the browser
if(isSingleInstance) {
+ auto stylesheet = config->value<std::string>("browser.stylesheet");
+ if(stylesheet) {
+ QFile f(QString::fromStdString(stylesheet.value()));
+ if(f.open(QIODevice::ReadOnly)) {
+ app.setStyleSheet(f.readAll());
+ f.close();
+ }
+ }
+
app.setup(QString::fromStdString(config->value<std::string>("profile.default").value()));
QObject::connect(&app, &Browser::messageAvailable, &app, &Browser::createSession);
}