2023-02-15 00:45:45 +02:00
|
|
|
/*
|
|
|
|
* VcmiSettingsWindow.cpp, part of VCMI engine
|
|
|
|
*
|
|
|
|
* Authors: listed in file AUTHORS in main folder
|
|
|
|
*
|
|
|
|
* License: GNU General Public License v2.0 or later
|
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#include "StdInc.h"
|
|
|
|
|
2023-02-18 18:58:22 +02:00
|
|
|
#include "OtherOptionsTab.h"
|
2023-02-15 00:45:45 +02:00
|
|
|
|
2023-08-23 14:07:50 +02:00
|
|
|
#include "../../../lib/filesystem/ResourcePath.h"
|
2023-02-15 00:45:45 +02:00
|
|
|
#include "../../gui/CGuiHandler.h"
|
|
|
|
#include "../../widgets/Buttons.h"
|
|
|
|
#include "CConfigHandler.h"
|
|
|
|
|
|
|
|
static void setBoolSetting(std::string group, std::string field, bool value)
|
|
|
|
{
|
|
|
|
Settings fullscreen = settings.write[group][field];
|
|
|
|
fullscreen->Bool() = value;
|
|
|
|
}
|
|
|
|
|
2023-02-18 18:58:22 +02:00
|
|
|
OtherOptionsTab::OtherOptionsTab() : InterfaceObjectConfigurable()
|
2023-02-15 00:45:45 +02:00
|
|
|
{
|
|
|
|
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
|
|
|
|
|
2023-09-01 23:26:14 +02:00
|
|
|
const JsonNode config(JsonPath::builtin("config/widgets/settings/otherOptionsTab.json"));
|
2023-02-18 18:49:43 +02:00
|
|
|
addCallback("availableCreaturesAsDwellingLabelChanged", [](bool value)
|
|
|
|
{
|
|
|
|
return setBoolSetting("gameTweaks", "availableCreaturesAsDwellingLabel", value);
|
|
|
|
});
|
|
|
|
addCallback("compactTownCreatureInfoChanged", [](bool value)
|
|
|
|
{
|
|
|
|
return setBoolSetting("gameTweaks", "compactTownCreatureInfo", value);
|
|
|
|
});
|
2023-02-15 00:45:45 +02:00
|
|
|
build(config);
|
|
|
|
|
|
|
|
std::shared_ptr<CToggleButton> availableCreaturesAsDwellingLabelCheckbox = widget<CToggleButton>("availableCreaturesAsDwellingLabelCheckbox");
|
2023-02-18 18:49:43 +02:00
|
|
|
availableCreaturesAsDwellingLabelCheckbox->setSelected(settings["gameTweaks"]["availableCreaturesAsDwellingLabel"].Bool());
|
2023-02-15 00:45:45 +02:00
|
|
|
|
|
|
|
std::shared_ptr<CToggleButton> compactTownCreatureInfo = widget<CToggleButton>("compactTownCreatureInfoCheckbox");
|
2023-02-18 18:49:43 +02:00
|
|
|
compactTownCreatureInfo->setSelected(settings["gameTweaks"]["compactTownCreatureInfo"].Bool());
|
2023-02-15 00:45:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|