1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Change main settings tabs to toggle group + fix json commas

This commit is contained in:
Dydzio 2023-02-16 21:37:37 +01:00
parent 1d37f8a62e
commit c2ef3331ef
5 changed files with 83 additions and 84 deletions

View File

@ -3,7 +3,7 @@
"images" :
[
{ "frame" : 0, "file" : "square-normal.png"},
{ "frame" : 1, "file" : "square-pressed-selected.png"}
{ "frame" : 1, "file" : "square-pressed-selected.png"},
{ "frame" : 2, "file" : "square-pressed.png"},
{ "frame" : 3, "file" : "square-normal-selected.png"}
]

View File

@ -1,8 +0,0 @@
{
"basepath" : "buttons/",
"images" :
[
{ "frame" : 0, "file" : "square-normal.png"},
{ "frame" : 1, "file" : "square-pressed.png"}
]
}

View File

@ -3,8 +3,8 @@
"images" :
[
{ "frame" : 0, "file" : "triplewide-normal.png"},
{ "frame" : 1, "file" : "triplewide-pressed-selected.png"}
{ "frame" : 2, "file" : "triplewide-pressed.png"}
{ "frame" : 1, "file" : "triplewide-pressed-selected.png"},
{ "frame" : 2, "file" : "triplewide-pressed.png"},
{ "frame" : 3, "file" : "triplewide-normal-selected.png"}
]
}

View File

@ -33,11 +33,7 @@ SettingsMainContainer::SettingsMainContainer(BattleInterface * parentBattleUi) :
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
const JsonNode config(ResourceID("config/widgets/settings/settingsMainContainer.json"));
addCallback("activateGeneralTab", [this](int) { openTab(0); });
addCallback("activateAdventureTab", [this](int) { openTab(1); });
addCallback("activateBattleTab", [this](int) { openTab(2); });
addCallback("activateVcmiSettingsTab", [this](int) { openTab(3); });
addCallback("activateSettingsTab", [this](int tabId) { openTab(tabId); });
addCallback("loadGame", [this](int) { loadGameButtonCallback(); });
addCallback("saveGame", [this](int) { saveGameButtonCallback(); });
addCallback("restartGame", [this](int) { restartGameButtonCallback(); });
@ -72,7 +68,10 @@ SettingsMainContainer::SettingsMainContainer(BattleInterface * parentBattleUi) :
defaultTabIndex = settings["general"]["lastSettingsTab"].Integer();
parentBattleInterface = parentBattleUi;
tabContentArea = std::make_shared<CTabbedInt>(std::bind(&SettingsMainContainer::createTab, this, _1), Point(0, 50), defaultTabIndex);
tabContentArea = std::make_shared<CTabbedInt>(std::bind(&SettingsMainContainer::createTab, this, _1), Point(0, 40), defaultTabIndex);
std::shared_ptr<CToggleGroup> mainTabs = widget<CToggleGroup>("settingsTabs");
mainTabs->setSelected(defaultTabIndex);
}
std::shared_ptr<CIntObject> SettingsMainContainer::createTab(size_t index)

View File

@ -9,12 +9,20 @@
},
{
"name": "activateGeneralOptionsButton",
"type": "button",
"name": "settingsTabs",
"type": "toggleGroup",
"position": {
"x": 0,
"y": 0
},
"items":
[
{
"index": 0,
"type": "toggleButton",
"position": {"x": 0, "y": 0},
"image": "buttons/quadwide",
"help": "vcmi.settingsMainWindow.systemTab",
"callback": "activateGeneralTab",
"items":
[
{
@ -29,12 +37,11 @@
},
{
"name": "activateAdventureOptionsButton",
"type": "button",
"index": 1,
"type": "toggleButton",
"position": {"x": 150, "y": 0},
"image": "buttons/quadwide",
"help": "vcmi.settingsMainWindow.adventureTab",
"callback": "activateAdventureTab",
"items":
[
{
@ -49,12 +56,11 @@
},
{
"name": "activateBattleOptionsButton",
"type": "button",
"index": 2,
"type": "toggleButton",
"position": {"x": 300, "y": 0},
"image": "buttons/quadwide",
"help": "vcmi.settingsMainWindow.battleTab",
"callback": "activateBattleTab",
"items":
[
{
@ -69,12 +75,11 @@
},
{
"name": "activateVcmiSettingsButton",
"type": "button",
"index": 3,
"type": "toggleButton",
"position": {"x": 450, "y": 0},
"image": "buttons/quadwide",
"help": "vcmi.settingsMainWindow.otherTab",
"callback": "activateVcmiSettingsTab",
"items":
[
{
@ -86,6 +91,9 @@
"text": "vcmi.settingsMainWindow.otherTab.hover"
}
]
}
],
"callback": "activateSettingsTab"
},
{