aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2017-06-04 13:06:28 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2017-06-04 13:06:28 +0200
commit77a27e730b2e8baed2a8b954e4da5bb162d9d824 (patch)
treeae3f3b5e95df4d6eeb70cccbd6ac7ea5fe4240cf /src/main.cpp
parentAdding plugin action to the menu bar (diff)
downloadsmolbote-77a27e730b2e8baed2a8b954e4da5bb162d9d824.tar.xz
Browser class refactoring
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp29
1 files changed, 18 insertions, 11 deletions
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());