aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2017-08-04 15:50:41 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2017-08-04 15:50:41 +0200
commit01452936bdab960bbb8a3a1fea36cabc196e5982 (patch)
treedb07d463496d4c02373f5f136095521cddb4fa9e /src/main.cpp
parentProfile window fixes (diff)
downloadsmolbote-01452936bdab960bbb8a3a1fea36cabc196e5982.tar.xz
Implemented --default-config
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 960c11c..789a3e6 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -18,11 +18,25 @@
**
******************************************************************************/
+#include <iostream>
#include "browser.h"
#include "mainwindow.h"
#include <QApplication>
#include <QCommandLineParser>
+/**
+ * @brief printPoiToml Print the built-in config (if any)
+ * @param output std::ostream to print to
+ */
+void printPoiToml(std::ostream &output)
+{
+ QFile conf(":/poi.toml");
+ if(conf.open(QIODevice::ReadOnly)) {
+ output << conf.readAll().toStdString() << std::endl;
+ conf.close();
+ }
+}
+
int main(int argc, char *argv[])
{
//
@@ -40,7 +54,7 @@ int main(int argc, char *argv[])
QCommandLineOption configOption(QStringList() << "c" << "config", "Set configuration file.", "PATH");
parser.addOption(configOption);
- QCommandLineOption defaultConfigOption(QStringList() << "default-config", "Print default configuration");
+ QCommandLineOption defaultConfigOption(QStringList() << "default-config", "Print default configuration.");
parser.addOption(defaultConfigOption);
QCommandLineOption profileOption(QStringList() << "p" << "profile", "Use this profile.", "PROFILE");
@@ -62,6 +76,11 @@ int main(int argc, char *argv[])
parser.process(app);
+ if(parser.isSet(defaultConfigOption)) {
+ printPoiToml(std::cout);
+ return 0;
+ }
+
app.setWindowIcon(QIcon(QLatin1String(":/icon.svg")));
// This lets the web view automatically scale on high-dpi displays.
app.setAttribute(Qt::AA_EnableHighDpiScaling);