From 77a27e730b2e8baed2a8b954e4da5bb162d9d824 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Sun, 4 Jun 2017 13:06:28 +0200 Subject: Browser class refactoring --- src/main.cpp | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index e1f4c5c..bf4c29f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -26,15 +26,10 @@ int main(int argc, char *argv[]) { Browser app(argc, argv); - app.setApplicationName("smolbote"); -#ifdef GIT_VERSION - app.setApplicationVersion(GIT_VERSION); -#else - app.setApplicationVersion("1.0.0"); -#endif - app.setWindowIcon(QIcon(QLatin1String(":/icon.svg"))); - // This lets the web view automatically scale on high-dpi displays. - app.setAttribute(Qt::AA_EnableHighDpiScaling); + if(app.isRunning()) { + qDebug("Another instance is running, returning..."); + return 0; + } QCommandLineParser parser; parser.setApplicationDescription("yet another Qt browser"); @@ -45,12 +40,24 @@ int main(int argc, char *argv[]) parser.addOption(configOption); QCommandLineOption profileOption(QStringList() << "p" << "profile", "Use this profile.", "PROFILE"); parser.addOption(profileOption); + QCommandLineOption nopluginsOption(QStringList() << "n" << "noplugins", "Don't load plugins"); + parser.addOption(nopluginsOption); parser.process(app); + + app.setWindowIcon(QIcon(QLatin1String(":/icon.svg"))); + // This lets the web view automatically scale on high-dpi displays. + app.setAttribute(Qt::AA_EnableHighDpiScaling); + + // Set configuration app.setConfigPath(parser.value(configOption)); - if(!app.prepare(parser.positionalArguments())) { - return 0; + // Load profiles + app.loadProfiles(); + + // Load plugins + if(!parser.isSet(nopluginsOption)) { + app.loadPlugins(); } MainWindow *w = new MainWindow(parser.positionalArguments()); -- cgit v1.2.1