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 | |
parent | Profile window fixes (diff) | |
download | smolbote-01452936bdab960bbb8a3a1fea36cabc196e5982.tar.xz |
Implemented --default-config
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | src/main.cpp | 21 |
2 files changed, 22 insertions, 3 deletions
@@ -5,7 +5,7 @@ _yet another Qt browser_ The aim is to create a small, fast and clean web browser. * minimal - just a browser, not a platform -* configurable - settings file in plain sight and plain text +* configurable - settings in plain sight and plain text ### What's up with the name?! It's a small boat. @@ -13,6 +13,6 @@ It's a small boat. ### Sounds dumb, how do I use it? You make it yourself after taking a cursory glance at BUILDING.md. -### Reporting bugs, or throwing code into the pot +### Reporting bugs, or throwing code into the bucket Use the facilities present at the repository. For more information, glance at CONTRIBUTING.md. 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); |