From 44421abbe89be2c6a6290182571fff82dfec9651 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Thu, 15 Mar 2018 16:26:38 +0100 Subject: Moved Configuration class into library --- config/CMakeLists.txt | 11 +++++++---- config/settingsdialog.cpp | 3 +++ config/settingsdialog.h | 8 ++++---- 3 files changed, 14 insertions(+), 8 deletions(-) (limited to 'config') diff --git a/config/CMakeLists.txt b/config/CMakeLists.txt index cde4648..9ae0381 100644 --- a/config/CMakeLists.txt +++ b/config/CMakeLists.txt @@ -10,12 +10,15 @@ add_executable(poi-config main.cpp settingsdialog.cpp settingsdialog.h - ../src/configuration.h - ../src/configuration.cpp - ) +) + +target_include_directories(poi-config + PRIVATE ../lib/configuration +) target_link_libraries(poi-config Qt5::Core Qt5::Widgets - ${Boost_LIBRARIES}) + configuration +) install(TARGETS poi-config RUNTIME DESTINATION bin CONFIGURATIONS Release) diff --git a/config/settingsdialog.cpp b/config/settingsdialog.cpp index 56acc01..ef21a47 100644 --- a/config/settingsdialog.cpp +++ b/config/settingsdialog.cpp @@ -24,6 +24,7 @@ SettingsDialog::SettingsDialog(QWidget *parent) setCentralWidget(&treeWidget); treeWidget.setColumnCount(2); + treeWidget.setHeaderLabels({ tr("setting"), tr("value") }); //config.read() @@ -32,6 +33,8 @@ SettingsDialog::SettingsDialog(QWidget *parent) item->setText(0, QString::fromStdString(option->long_name())); item->setText(1, QString::fromStdString(config.value(option->long_name().c_str()).value_or(std::string()))); } + + treeWidget.resizeColumnToContents(0); } SettingsDialog::~SettingsDialog() = default; diff --git a/config/settingsdialog.h b/config/settingsdialog.h index 82cd1be..dc3cc08 100644 --- a/config/settingsdialog.h +++ b/config/settingsdialog.h @@ -6,13 +6,13 @@ * SPDX-License-Identifier: GPL-3.0 */ -#ifndef SETTINGSDIALOG_H -#define SETTINGSDIALOG_H +#ifndef SMOLBOTE_SETTINGSDIALOG_H +#define SMOLBOTE_SETTINGSDIALOG_H -#include "../src/configuration.h" #include #include #include +#include class SettingsDialog : public QMainWindow { @@ -28,4 +28,4 @@ private: Configuration config; }; -#endif // SETTINGSDIALOG_H +#endif // SMOLBOTE_SETTINGSDIALOG_H -- cgit v1.2.1