diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-10-20 15:14:24 +0200 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-10-20 15:14:24 +0200 |
commit | 88492823826b3720be4ba29d246848031418bfb5 (patch) | |
tree | 4f17cc7f4ef3f76f869a1d4fcb94722464aa9d0b /lib | |
parent | Hostlist test: test non-empty domain (diff) | |
download | smolbote-88492823826b3720be4ba29d246848031418bfb5.tar.xz |
Add Kconfiglib to parse Kconfig/.config
Diffstat (limited to 'lib')
-rw-r--r-- | lib/configuration/CMakeLists.txt | 6 | ||||
-rw-r--r-- | lib/configuration/configuration.cpp | 24 |
2 files changed, 16 insertions, 14 deletions
diff --git a/lib/configuration/CMakeLists.txt b/lib/configuration/CMakeLists.txt index 581e1eb..def0356 100644 --- a/lib/configuration/CMakeLists.txt +++ b/lib/configuration/CMakeLists.txt @@ -6,14 +6,14 @@ set(CMAKE_AUTOMOC ON) #set(CMAKE_AUTOUIC ON) #set(CMAKE_AUTORCC ON) -configure_file(defaults.h.in ${PROJECT_BINARY_DIR}/lib/configuration/defaults.h) - add_library(configuration configuration.cpp configuration.h) target_include_directories(configuration - PRIVATE ${Boost_INCLUDE_DIRS}) + PRIVATE ${Boost_INCLUDE_DIRS} + PRIVATE ${PROJECT_BINARY_DIR}/include +) target_link_libraries(configuration Qt5::Core Qt5::Widgets diff --git a/lib/configuration/configuration.cpp b/lib/configuration/configuration.cpp index 25f783c..99efb14 100644 --- a/lib/configuration/configuration.cpp +++ b/lib/configuration/configuration.cpp @@ -12,14 +12,14 @@ #include <boost/algorithm/string/predicate.hpp> #include <iostream> #include <QCoreApplication> -#include "defaults.h" +#include "config.h" namespace po = boost::program_options; inline std::string defaultUserConfigLocation() { -#ifdef Path_Config - return Path_Config; +#ifdef CONFIG_PATH_CONFIG + return CONFIG_PATH_CONFIG; #else // try to locate an existing config QString path = QStandardPaths::locate(QStandardPaths::ConfigLocation, "smolbote/smolbote.cfg"); @@ -55,14 +55,16 @@ Configuration::Configuration(QObject *parent) ("browser.locale", po::value<std::string>(), "Set Qt localization.") ("browser.translation", po::value<std::string>(), "Set application localization.") - ("browser.crash.path", po::value<std::string>()->default_value(Path_Crashdump)) - ("browser.crash.handler", po::value<std::string>()) +#ifdef CONFIG_USEBREAKPAD + ("browser.crash.path", po::value<std::string>()->default_value(CONFIG_PATH_CRASHDUMP)) + ("browser.crash.handler", po::value<std::string>()->default_value(CONFIG_PATH_CRASHHANDLER)) +#endif // main window ui ("mainwindow.height", po::value<int>()->default_value(720)) ("mainwindow.width", po::value<int>()->default_value(1280)) ("mainwindow.maximized", po::value<bool>()->default_value(true)) - ("mainwindow.title", po::value<std::string>()->default_value("smolbote")) + ("mainwindow.title", po::value<std::string>()->default_value(CONFIG_POI_NAME)) // main window shortcuts ("mainwindow.shortcuts.newGroup", po::value<std::string>()->default_value("Ctrl+G")) @@ -100,7 +102,7 @@ Configuration::Configuration(QObject *parent) ("subwindow.shortcuts.fullscreen", po::value<std::string>()->default_value("F11")) // Filter settings - ("filter.hosts", po::value<std::string>()->default_value(Path_Filter)) + ("filter.hosts", po::value<std::string>()->default_value(CONFIG_PATH_FILTER)) ("filter.adblock", po::value<std::string>()) ("filter.header", po::value<std::vector<std::string>>()) // ("filter.cookies.block.all", po::value<bool>()->default_value(false)) @@ -108,22 +110,22 @@ Configuration::Configuration(QObject *parent) // ("filter.cookies.path", po::value<std::string>()->default_value("~/.config/smolbote/cookies.d")) // Plugin settings - ("plugins.path", po::value<std::string>()->default_value(Path_Plugins)) + ("plugins.path", po::value<std::string>()->default_value(CONFIG_PATH_PLUGINS)) // Profile settings // default profile name the browser should use; "" is off-the-record ("profile.default", po::value<std::string>()->default_value("")) - ("profile.path", po::value<std::string>()->default_value(Path_Profiles)) + ("profile.path", po::value<std::string>()->default_value(CONFIG_PATH_PROFILES)) ("profile.search", po::value<std::string>()->default_value("https://duckduckgo.com/?q=%1&ia=web")) ("profile.homepage", po::value<std::string>()->default_value("about:blank")) ("profile.newtab", po::value<std::string>()->default_value("about:blank")) // Bookmark settings - ("bookmarks.path", po::value<std::string>()->default_value(Path_Bookmarks)) + ("bookmarks.path", po::value<std::string>()->default_value(CONFIG_PATH_BOOKMARKS)) ("bookmarks.shortcut", po::value<std::string>()->default_value("Ctrl+B")) // Downloads settings - ("downloads.path", po::value<std::string>()->default_value(Path_Downloads)) + ("downloads.path", po::value<std::string>()->default_value(CONFIG_PATH_DOWNLOADS)) ("downloads.shortcut", po::value<std::string>()->default_value("Ctrl+D")) ; } |