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,83 +9,91 @@
},
{
"name": "activateGeneralOptionsButton",
"type": "button",
"position": {"x": 0, "y": 0},
"image": "buttons/quadwide",
"help": "vcmi.settingsMainWindow.systemTab",
"callback": "activateGeneralTab",
"name": "settingsTabs",
"type": "toggleGroup",
"position": {
"x": 0,
"y": 0
},
"items":
[
{
"name": "generalTabButtonTitle",
"type": "label",
"font": "big",
"alignment": "center",
"color": "yellow",
"text": "core.genrltxt.568"
}
]
},
"index": 0,
"type": "toggleButton",
"position": {"x": 0, "y": 0},
"image": "buttons/quadwide",
"help": "vcmi.settingsMainWindow.systemTab",
"items":
[
{
"name": "generalTabButtonTitle",
"type": "label",
"font": "big",
"alignment": "center",
"color": "yellow",
"text": "core.genrltxt.568"
}
]
},
{
"name": "activateAdventureOptionsButton",
"type": "button",
"position": {"x": 150, "y": 0},
"image": "buttons/quadwide",
"help": "vcmi.settingsMainWindow.adventureTab",
"callback": "activateAdventureTab",
"items":
[
{
"name": "generalTabButtonTitle",
"type": "label",
"font": "big",
"alignment": "center",
"color": "yellow",
"text": "vcmi.settingsMainWindow.adventureTab.hover"
}
]
},
"index": 1,
"type": "toggleButton",
"position": {"x": 150, "y": 0},
"image": "buttons/quadwide",
"help": "vcmi.settingsMainWindow.adventureTab",
"items":
[
{
"name": "generalTabButtonTitle",
"type": "label",
"font": "big",
"alignment": "center",
"color": "yellow",
"text": "vcmi.settingsMainWindow.adventureTab.hover"
}
]
},
{
"name": "activateBattleOptionsButton",
"type": "button",
"position": {"x": 300, "y": 0},
"image": "buttons/quadwide",
"help": "vcmi.settingsMainWindow.battleTab",
"callback": "activateBattleTab",
"items":
[
{
"name": "adventureTabButtonTitle",
"type": "label",
"font": "big",
"alignment": "center",
"color": "yellow",
"text": "core.genrltxt.392"
}
]
},
"index": 2,
"type": "toggleButton",
"position": {"x": 300, "y": 0},
"image": "buttons/quadwide",
"help": "vcmi.settingsMainWindow.battleTab",
"items":
[
{
"name": "adventureTabButtonTitle",
"type": "label",
"font": "big",
"alignment": "center",
"color": "yellow",
"text": "core.genrltxt.392"
}
]
},
{
"name": "activateVcmiSettingsButton",
"type": "button",
"position": {"x": 450, "y": 0},
"image": "buttons/quadwide",
"help": "vcmi.settingsMainWindow.otherTab",
"callback": "activateVcmiSettingsTab",
"items":
[
{
"name": "otherTabButtonTitle",
"type": "label",
"font": "big",
"alignment": "center",
"color": "yellow",
"text": "vcmi.settingsMainWindow.otherTab.hover"
"index": 3,
"type": "toggleButton",
"position": {"x": 450, "y": 0},
"image": "buttons/quadwide",
"help": "vcmi.settingsMainWindow.otherTab",
"items":
[
{
"name": "otherTabButtonTitle",
"type": "label",
"font": "big",
"alignment": "center",
"color": "yellow",
"text": "vcmi.settingsMainWindow.otherTab.hover"
}
]
}
]
],
"callback": "activateSettingsTab"
},
{