diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2017-08-04 15:50:41 +0200 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2017-08-04 15:50:41 +0200 |
commit | 01452936bdab960bbb8a3a1fea36cabc196e5982 (patch) | |
tree | db07d463496d4c02373f5f136095521cddb4fa9e /src | |
parent | Profile window fixes (diff) | |
download | smolbote-01452936bdab960bbb8a3a1fea36cabc196e5982.tar.xz |
Implemented --default-config
Diffstat (limited to 'src')
-rw-r--r-- | src/main.cpp | 21 |
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); |