mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
Change main settings tabs to toggle group + fix json commas
This commit is contained in:
parent
1d37f8a62e
commit
c2ef3331ef
@ -3,7 +3,7 @@
|
|||||||
"images" :
|
"images" :
|
||||||
[
|
[
|
||||||
{ "frame" : 0, "file" : "square-normal.png"},
|
{ "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" : 2, "file" : "square-pressed.png"},
|
||||||
{ "frame" : 3, "file" : "square-normal-selected.png"}
|
{ "frame" : 3, "file" : "square-normal-selected.png"}
|
||||||
]
|
]
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"basepath" : "buttons/",
|
|
||||||
"images" :
|
|
||||||
[
|
|
||||||
{ "frame" : 0, "file" : "square-normal.png"},
|
|
||||||
{ "frame" : 1, "file" : "square-pressed.png"}
|
|
||||||
]
|
|
||||||
}
|
|
@ -3,8 +3,8 @@
|
|||||||
"images" :
|
"images" :
|
||||||
[
|
[
|
||||||
{ "frame" : 0, "file" : "triplewide-normal.png"},
|
{ "frame" : 0, "file" : "triplewide-normal.png"},
|
||||||
{ "frame" : 1, "file" : "triplewide-pressed-selected.png"}
|
{ "frame" : 1, "file" : "triplewide-pressed-selected.png"},
|
||||||
{ "frame" : 2, "file" : "triplewide-pressed.png"}
|
{ "frame" : 2, "file" : "triplewide-pressed.png"},
|
||||||
{ "frame" : 3, "file" : "triplewide-normal-selected.png"}
|
{ "frame" : 3, "file" : "triplewide-normal-selected.png"}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -33,11 +33,7 @@ SettingsMainContainer::SettingsMainContainer(BattleInterface * parentBattleUi) :
|
|||||||
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
|
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
|
||||||
|
|
||||||
const JsonNode config(ResourceID("config/widgets/settings/settingsMainContainer.json"));
|
const JsonNode config(ResourceID("config/widgets/settings/settingsMainContainer.json"));
|
||||||
addCallback("activateGeneralTab", [this](int) { openTab(0); });
|
addCallback("activateSettingsTab", [this](int tabId) { openTab(tabId); });
|
||||||
addCallback("activateAdventureTab", [this](int) { openTab(1); });
|
|
||||||
addCallback("activateBattleTab", [this](int) { openTab(2); });
|
|
||||||
addCallback("activateVcmiSettingsTab", [this](int) { openTab(3); });
|
|
||||||
|
|
||||||
addCallback("loadGame", [this](int) { loadGameButtonCallback(); });
|
addCallback("loadGame", [this](int) { loadGameButtonCallback(); });
|
||||||
addCallback("saveGame", [this](int) { saveGameButtonCallback(); });
|
addCallback("saveGame", [this](int) { saveGameButtonCallback(); });
|
||||||
addCallback("restartGame", [this](int) { restartGameButtonCallback(); });
|
addCallback("restartGame", [this](int) { restartGameButtonCallback(); });
|
||||||
@ -72,7 +68,10 @@ SettingsMainContainer::SettingsMainContainer(BattleInterface * parentBattleUi) :
|
|||||||
defaultTabIndex = settings["general"]["lastSettingsTab"].Integer();
|
defaultTabIndex = settings["general"]["lastSettingsTab"].Integer();
|
||||||
|
|
||||||
parentBattleInterface = parentBattleUi;
|
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)
|
std::shared_ptr<CIntObject> SettingsMainContainer::createTab(size_t index)
|
||||||
|
@ -9,12 +9,20 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name": "activateGeneralOptionsButton",
|
"name": "settingsTabs",
|
||||||
"type": "button",
|
"type": "toggleGroup",
|
||||||
|
"position": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"items":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"index": 0,
|
||||||
|
"type": "toggleButton",
|
||||||
"position": {"x": 0, "y": 0},
|
"position": {"x": 0, "y": 0},
|
||||||
"image": "buttons/quadwide",
|
"image": "buttons/quadwide",
|
||||||
"help": "vcmi.settingsMainWindow.systemTab",
|
"help": "vcmi.settingsMainWindow.systemTab",
|
||||||
"callback": "activateGeneralTab",
|
|
||||||
"items":
|
"items":
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
@ -29,12 +37,11 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name": "activateAdventureOptionsButton",
|
"index": 1,
|
||||||
"type": "button",
|
"type": "toggleButton",
|
||||||
"position": {"x": 150, "y": 0},
|
"position": {"x": 150, "y": 0},
|
||||||
"image": "buttons/quadwide",
|
"image": "buttons/quadwide",
|
||||||
"help": "vcmi.settingsMainWindow.adventureTab",
|
"help": "vcmi.settingsMainWindow.adventureTab",
|
||||||
"callback": "activateAdventureTab",
|
|
||||||
"items":
|
"items":
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
@ -49,12 +56,11 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name": "activateBattleOptionsButton",
|
"index": 2,
|
||||||
"type": "button",
|
"type": "toggleButton",
|
||||||
"position": {"x": 300, "y": 0},
|
"position": {"x": 300, "y": 0},
|
||||||
"image": "buttons/quadwide",
|
"image": "buttons/quadwide",
|
||||||
"help": "vcmi.settingsMainWindow.battleTab",
|
"help": "vcmi.settingsMainWindow.battleTab",
|
||||||
"callback": "activateBattleTab",
|
|
||||||
"items":
|
"items":
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
@ -69,12 +75,11 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name": "activateVcmiSettingsButton",
|
"index": 3,
|
||||||
"type": "button",
|
"type": "toggleButton",
|
||||||
"position": {"x": 450, "y": 0},
|
"position": {"x": 450, "y": 0},
|
||||||
"image": "buttons/quadwide",
|
"image": "buttons/quadwide",
|
||||||
"help": "vcmi.settingsMainWindow.otherTab",
|
"help": "vcmi.settingsMainWindow.otherTab",
|
||||||
"callback": "activateVcmiSettingsTab",
|
|
||||||
"items":
|
"items":
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
@ -86,6 +91,9 @@
|
|||||||
"text": "vcmi.settingsMainWindow.otherTab.hover"
|
"text": "vcmi.settingsMainWindow.otherTab.hover"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"callback": "activateSettingsTab"
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user