38 using json::utility::jsonObject;
42 bool hasMenus =
false;
45 parser.
parse(description);
47 if (description.contains(
"menuStructure", json::utility::variantTypeEnum::jJSONObject))
49 menuParser.
parse(
const_cast<jsonObject&
>(description.getObject(
"menuStructure")));
83 for (
const auto& [text, function] : parser.
items)
85 mainWindow->addTrayMenuItem(text, function.functionName, function.moduleName);
90 auto& mainMenu = mainWindow->createMainMenu(menuParser.
mainMenuName);
94 const jsonObject& item = get<jsonObject>(i.data.front().second);
97 const std::string& type = item.getString(
"itemType");
101 mainMenu->addMenuItem(std::make_unique<MenuItem>(text, item.getString(
"functionName"), item.getString(
"moduleName")));
105 uint64_t popupId = item.getUnsignedInt(
"popupId");
106 Menu* popupMenu =
nullptr;
110 const jsonObject& popupItem = get<jsonObject>(j.data.front().second);
112 if (popupItem.getUnsignedInt(
"menuId") == popupId)
114 popupMenu = &mainWindow->addPopupMenu(
utility::to_wstring(popupItem.getString(
"menuName"), codepage));
130 if (description.contains(
"hotkeys", json::utility::variantTypeEnum::jJSONArray))
135 if (description.contains(
"children", json::utility::variantTypeEnum::jJSONArray))
137 const auto& children = description.getArray(
"children");
139 for (
const auto& i : children)
141 const auto& [componentName, data] = get<jsonObject>(i.data.front().second).data.front();
142 const auto& description = get<jsonObject>(data);
146 deserializer->deserialize(componentName, description, mainWindow);
Deserialize MainWindow from JSON.
void deserialize(const std::string &componentName, const json::utility::jsonObject &description, std::unique_ptr< MainWindowT > &mainWindow) const
MainWindow has no parent, you must manage the pointer.
Parse MainWindowParser specific properties.
void parse(const json::utility::jsonObject &description) override
uint16_t trayIconResource
std::vector< std::pair< std::wstring, BaseMainWindow::Function > > items