diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-01-03 16:39:32 +0100 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-01-03 16:39:32 +0100 |
commit | 85d9f14aa8bac16ab341662c770b64a15c21628b (patch) | |
tree | 422db18e798646cd4bc98abf342f25c09c0bdf1d /lib/settings | |
parent | Download items' width should no longer exceed the list width (diff) | |
download | smolbote-85d9f14aa8bac16ab341662c770b64a15c21628b.tar.xz |
Changed from qbs to cmake
Diffstat (limited to 'lib/settings')
-rw-r--r-- | lib/settings/CMakeLists.txt | 10 | ||||
-rw-r--r-- | lib/settings/configuration.cpp | 4 | ||||
-rw-r--r-- | lib/settings/settings.qbs | 38 |
3 files changed, 14 insertions, 38 deletions
diff --git a/lib/settings/CMakeLists.txt b/lib/settings/CMakeLists.txt new file mode 100644 index 0000000..704c40f --- /dev/null +++ b/lib/settings/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1.0) + +add_library(configuration + configuration.cpp + configuration.h + settingsdialog.cpp + settingsdialog.h + settingsdialog.ui) + +target_link_libraries(configuration Qt5::Widgets)
\ No newline at end of file diff --git a/lib/settings/configuration.cpp b/lib/settings/configuration.cpp index 34d50db..4603779 100644 --- a/lib/settings/configuration.cpp +++ b/lib/settings/configuration.cpp @@ -214,6 +214,8 @@ void Configuration::setValue(std::string path, const T &val) // compiler complained about operator= not taking unsinged ints, longs and long longs if constexpr(std::is_unsigned_v<T> && !std::is_same_v<T, bool>) { setting = static_cast<typename std::make_signed_t<T>>(val); + } else if constexpr(std::is_same_v<T, std::string>) { + setting = static_cast<std::string>(val).c_str(); } else { setting = val; } @@ -240,6 +242,8 @@ void Configuration::setValue(std::string path, const T &val) if constexpr(std::is_unsigned_v<T> && !std::is_same_v<T, bool>) { *userSetting = static_cast<typename std::make_signed_t<T>>(val); + } else if constexpr(std::is_same_v<T, std::string>) { + *userSetting = static_cast<std::string>(val).c_str(); } else { *userSetting = val; } diff --git a/lib/settings/settings.qbs b/lib/settings/settings.qbs deleted file mode 100644 index 0559daa..0000000 --- a/lib/settings/settings.qbs +++ /dev/null @@ -1,38 +0,0 @@ -import qbs - -Project { - name: "Settings" - - StaticLibrary { - name: "settings" - - Depends { name: "cpp" } - - cpp.defines: "C_LIKE_CONFIG" - cpp.cxxLanguageVersion: "c++17" - - files: [ - "configuration.cpp", - "configuration.h" - ] - } - - StaticLibrary { - name: "settingsDialog" - - Depends { name: "cpp" } - - Depends { - name: "Qt" - submodules: ["core", "widgets"] - } - - cpp.cxxLanguageVersion: "c++17" - - files: [ - "settingsdialog.cpp", - "settingsdialog.h", - "settingsdialog.ui", - ] - } -} |