UI: Add svg to the menu

This commit is contained in:
Stardust 2026-05-20 13:52:55 +09:30
parent 37dbfeaff1
commit 69c4c9d186
14 changed files with 124 additions and 22 deletions

View File

@ -300,11 +300,19 @@ menu li .menu-item-glyph.menu-item-icon-svg svg
vertical-align: middle; vertical-align: middle;
} }
menu li .menu-item-glyph.menu-item-icon-svg path menu li .menu-item-glyph.menu-item-icon-svg path,
menu li .menu-item-glyph.menu-item-icon-svg circle
{ {
fill: currentColor; fill: currentColor;
} }
menu li .menu-item-glyph.menu-item-icon-svg path[fill="none"],
menu li .menu-item-glyph.menu-item-icon-svg circle[fill="none"]
{
fill: none;
stroke: currentColor;
}
menu li .menu-item-glyph .menu-item-checkmark menu li .menu-item-glyph .menu-item-checkmark
{ {
position: absolute; position: absolute;

View File

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="4 4 24 24">
<path fill="currentColor" d="m18.8 16 5.5-5.5c.8-.8.8-2 0-2.8-.3-.4-.8-.7-1.3-.7s-1 .2-1.4.6L16 13.2l-5.5-5.5c-.8-.8-2.1-.8-2.8 0-.4.3-.7.8-.7 1.4s.2 1 .6 1.4l5.5 5.5-5.5 5.5c-.3.4-.6.9-.6 1.5 0 .5.2 1 .6 1.4s.9.6 1.4.6 1-.2 1.4-.6l5.5-5.5 5.5 5.5c.8.8 2.1.8 2.8 0 .8-.8.8-2.1 0-2.8z"/>
</svg>

After

Width:  |  Height:  |  Size: 357 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="1.5 1 32 33"><path fill="currentColor" d="M13.2 18.456H8.475a1.25 1.25 0 1 1 0-2.5H13.2a1.25 1.25 0 0 1 0 2.5"/><path fill="currentColor" d="M10.839 20.82a1.25 1.25 0 0 1-1.25-1.25v-4.729a1.25 1.25 0 0 1 2.5 0v4.729a1.25 1.25 0 0 1-1.25 1.25M20.954 18.515a1.251 1.251 0 0 0 0-2.5 1.251 1.251 0 0 0 0 2.5M23.8 15.67a1.251 1.251 0 0 0 0-2.5 1.251 1.251 0 0 0 0 2.5M23.68 21.241a1.251 1.251 0 0 0 0-2.5 1.251 1.251 0 0 0 0 2.5M26.525 18.4a1.251 1.251 0 0 0 0-2.5 1.251 1.251 0 0 0 0 2.5"/><path fill="currentColor" d="M28.886 34.75a4.9 4.9 0 0 1-4.752-3.663l-1.4-4.1a20.45 20.45 0 0 1-10.436-.068l-1.456 4.257a4.72 4.72 0 0 1-1.717 2.549 4.905 4.905 0 0 1-7.9-3.836V19.2c0-.31.038-.868.054-1.08l-.052-.945A10.494 10.494 0 0 1 11.693 6.641a10.4 10.4 0 0 1 3.728.686 3.8 3.8 0 0 0 1.373.235h1.412a3.8 3.8 0 0 0 1.353-.227 10.3 10.3 0 0 1 3.941-.692A10.674 10.674 0 0 1 33.781 17.42v12.472a4.88 4.88 0 0 1-4.895 4.858M23.5 24.141a1.25 1.25 0 0 1 1.183.846l1.841 5.384a2.44 2.44 0 0 0 2.359 1.879 2.38 2.38 0 0 0 2.395-2.358V17.42a8.163 8.163 0 0 0-7.822-8.277 7.8 7.8 0 0 0-3 .524 6.3 6.3 0 0 1-2.255.395h-1.407a6.3 6.3 0 0 1-2.269-.4 7.9 7.9 0 0 0-2.832-.52 7.98 7.98 0 0 0-7.974 7.965l.054.955a2 2 0 0 1 0 .2c-.011.141-.05.66-.05.938v10.692a2.406 2.406 0 0 0 3.871 1.86 2.35 2.35 0 0 0 .855-1.29l1.869-5.475a1.25 1.25 0 0 1 1.59-.777c.062.02 6.155 2.075 11.123.025a1.3 1.3 0 0 1 .469-.094M20.01 8.5"/><path fill="currentColor" d="M18.294 7.261a1.23 1.23 0 0 1-.105-1.184 1.9 1.9 0 0 1 .874-1.04 4.97 4.97 0 0 1 3.637-.163 8.2 8.2 0 0 0 4.595.142A3.68 3.68 0 0 0 29.854 1.5 1.28 1.28 0 0 0 28.6.25a1.26 1.26 0 0 0-1.25 1.25c.066 1.244-1.558 1.378-2.5 1.266-1.574-.186-3.049-.792-4.663-.617a5.18 5.18 0 0 0-3.917 2.183 3.98 3.98 0 0 0-.137 4.19c.836 1.372 3 .117 2.158-1.261Z"/></svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -1 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="800" height="800" viewBox="0 0 512 512"><path d="m93.1 139.6 46.5-46.5-46.5-46.6L139.6 0H0v139.6l46.5-46.5zm0 232.8-46.5 46.5L0 372.4V512h139.6l-46.5-46.5 46.5-46.5zm279.3-232.8H139.6v232.7h232.7V139.6zm-46.6 186.2H186.2V186.2h139.6zM372.4 0l46.5 46.5L372.4 93l46.5 46.5L465.4 93l46.5 46.5V0zm46.5 372.4-46.5 46.5 46.5 46.5-46.5 46.6H512V372.4l-46.5 46.5z"/></svg> <svg xmlns="http://www.w3.org/2000/svg" viewBox="64 64 384 384">
<path fill="currentColor" d="m93.1 139.6 46.5-46.5-46.5-46.6L139.6 0H0v139.6l46.5-46.5zm0 232.8-46.5 46.5L0 372.4V512h139.6l-46.5-46.5 46.5-46.5zm279.3-232.8H139.6v232.7h232.7V139.6zm-46.6 186.2H186.2V186.2h139.6zM372.4 0l46.5 46.5L372.4 93l46.5 46.5L465.4 93l46.5 46.5V0zm46.5 372.4-46.5 46.5 46.5 46.5-46.5 46.6H512V372.4l-46.5 46.5z"/>
</svg>

Before

Width:  |  Height:  |  Size: 432 B

After

Width:  |  Height:  |  Size: 413 B

View File

@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<path fill="currentColor" fill-rule="evenodd" d="M16 16h-3l-2.163-2.662a6.405 6.405 0 0 1-7.758-1.643L0 8l3.08-3.695q.105-.127.217-.248L0 0h3zM5.353 6.588A3 3 0 0 0 8.84 10.88z" clip-rule="evenodd"/>
<path fill="currentColor" d="m16 8-1.772 2.127L7.634 2.01a6.4 6.4 0 0 1 5.287 2.295z"/>
</svg>

After

Width:  |  Height:  |  Size: 360 B

View File

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path fill="currentColor" d="m12 21.5-8-4.7V13l-4-2.4 5-4.7 7-3.3 7.2 3.3 4.8 4.7-4 2.3v3.8zm1-9.3V19l5-3v-2l-2.1 1.2zM6 16l5 3v-6.8l-3.1 3L6 14zm7.4-5.5 2.9 2.7 5.2-3.1-3-2.8zm-10.8-.4 5.1 3.1 2.9-2.7-5.1-3.2zm4.5-3.6 4.9 3 4.9-3L12 4.1z"/>
</svg>

After

Width:  |  Height:  |  Size: 312 B

View File

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9v8.8c0 1.12 0 1.68-.218 2.108a2 2 0 0 1-.874.874C17.48 21 16.92 21 15.8 21H8.2c-1.12 0-1.68 0-2.108-.218a2 2 0 0 1-.874-.874C5 19.48 5 18.92 5 17.8V6.2c0-1.12 0-1.68.218-2.108a2 2 0 0 1 .874-.874C6.52 3 7.08 3 8.2 3H13m6 6-6-6m6 6h-5a1 1 0 0 1-1-1V3"/>
</svg>

After

Width:  |  Height:  |  Size: 435 B

View File

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path fill="currentColor" fill-rule="evenodd" d="M10 5a3 3 0 0 0-3-3H5a3 3 0 0 0-3 3v14a3 3 0 0 0 3 3h2a3 3 0 0 0 3-3zM8 5a1 1 0 0 0-1-1H5a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1zM22 5a3 3 0 0 0-3-3h-2a3 3 0 0 0-3 3v14a3 3 0 0 0 3 3h2a3 3 0 0 0 3-3zm-2 0a1 1 0 0 0-1-1h-2a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1z" clip-rule="evenodd"/>
</svg>

After

Width:  |  Height:  |  Size: 420 B

View File

@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="6 6 36 36">
<path fill="none" stroke="currentColor" stroke-width="2.75" stroke-linecap="round" stroke-linejoin="round" d="M24 8.5A15.5 15.5 0 1 1 8.5 24 15.51 15.51 0 0 1 24 8.5"/>
<circle cx="24" cy="24" r="2.25" fill="currentColor" stroke="none"/>
<path fill="none" stroke="currentColor" stroke-width="2.75" stroke-linecap="round" stroke-linejoin="round" d="M24 21.5V14M26.1 25.35l9.8 6.25"/>
</svg>

After

Width:  |  Height:  |  Size: 457 B

View File

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="48 28 416 456">
<path fill="currentColor" d="M488.188 41.797H23.813C10.719 41.797 0 52.516 0 65.609v311.969c0 13.094 10.719 23.813 23.813 23.813h152.375v46.016h-31.031v22.797h221.688v-22.797h-31.031v-46.016h152.375c13.094 0 23.813-10.719 23.813-23.813V65.609c-.002-13.093-10.721-23.812-23.814-23.812m-7.157 319.125H30.953V72.766h450.078z"/>
</svg>

After

Width:  |  Height:  |  Size: 399 B

View File

@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path fill="none" stroke="currentColor" stroke-width="1.5" d="M11 3h2a1 1 0 0 1 1 1v.569c0 .428.287.8.682.963.396.164.856.102 1.158-.2l.403-.403a1 1 0 0 1 1.414 0l1.414 1.414a1 1 0 0 1 0 1.414l-.402.403c-.303.302-.365.762-.201 1.158s.535.682.963.682H20a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-.569c-.428 0-.8.287-.963.682-.164.396-.102.856.2 1.158l.403.403a1 1 0 0 1 0 1.414l-1.414 1.414a1 1 0 0 1-1.414 0l-.403-.402c-.302-.303-.762-.365-1.158-.201s-.682.535-.682.963V20a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-.569c0-.428-.287-.8-.682-.963-.396-.164-.856-.102-1.158.2l-.403.403a1 1 0 0 1-1.414 0L4.93 17.657a1 1 0 0 1 0-1.414l.402-.403c.303-.302.365-.762.201-1.158S4.997 14 4.57 14H4a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1h.569c.428 0 .8-.287.963-.682.164-.396.102-.856-.2-1.158l-.403-.403a1 1 0 0 1 0-1.414L6.343 4.93a1 1 0 0 1 1.414 0l.403.402c.302.303.762.365 1.158.201S10 4.997 10 4.57V4a1 1 0 0 1 1-1Z"/>
<path fill="none" stroke="currentColor" stroke-width="1.5" d="M14 12a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path fill="currentColor" d="M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18m0-16.5a7.5 7.5 0 1 0 0 15 7.5 7.5 0 0 0 0-15"/>
<path fill="currentColor" d="M14.5 8h-5A1.5 1.5 0 0 0 8 9.5v5A1.5 1.5 0 0 0 9.5 16h5a1.5 1.5 0 0 0 1.5-1.5v-5A1.5 1.5 0 0 0 14.5 8"/>
</svg>

After

Width:  |  Height:  |  Size: 320 B

View File

@ -302,13 +302,67 @@ SciterMainWindow::SciterMainWindow(ISciterUI & sciterUI, const char * windowTitl
m_useSpeedLimit = settings.GetBool(NXOsSetting::UseSpeedLimit); m_useSpeedLimit = settings.GetBool(NXOsSetting::UseSpeedLimit);
m_speedLimit = settings.GetBool(NXOsSetting::SpeedLimit); m_speedLimit = settings.GetBool(NXOsSetting::SpeedLimit);
std::vector<uint8_t> resource; }
if (m_sciterUI.LoadResource("fullscreen.svg", resource))
const char * SciterMainWindow::MenuIconResource(GuiAction action) const
{
switch (action)
{ {
m_fullscreenMenuSvg.assign(reinterpret_cast<const char *>(resource.data()), resource.size()); case GuiAction::LoadFile:
return "open-file.svg";
case GuiAction::ExitApplication:
return "close.svg";
case GuiAction::InstallFirmwareFromFile:
case GuiAction::InstallFirmwareFromFolder:
return "install.svg";
case GuiAction::ToggleFullscreen:
return "fullscreen.svg";
case GuiAction::OpenControllersDialog:
return "controller.svg";
case GuiAction::OpenSystemConfiguration:
return "settings.svg";
case GuiAction::PauseOrContinueEmulation:
return "pause.svg";
case GuiAction::StopEmulation:
return "stop.svg";
case GuiAction::ToggleHideUi:
return "hide-ui.svg";
case GuiAction::ResetWindowSize720p:
case GuiAction::ResetWindowSize900p:
case GuiAction::ResetWindowSize1080p:
return "resize.svg";
default:
return nullptr;
} }
} }
const std::string * SciterMainWindow::MenuIconSvgForResource(const char * resource)
{
if (resource == nullptr)
{
return nullptr;
}
const auto found = m_menuIconSvgs.find(resource);
if (found != m_menuIconSvgs.end())
{
return &found->second;
}
std::vector<uint8_t> data;
if (!m_sciterUI.LoadResource(resource, data) || data.empty())
{
return nullptr;
}
std::string & cached = m_menuIconSvgs[resource];
cached.assign(reinterpret_cast<const char *>(data.data()), data.size());
return &cached;
}
const std::string * SciterMainWindow::MenuIconSvg(GuiAction action)
{
const char * resource = MenuIconResource(action);
return MenuIconSvgForResource(resource);
}
SciterMainWindow::~SciterMainWindow() SciterMainWindow::~SciterMainWindow()
{ {
m_WebBrowser.DetachWindow(); m_WebBrowser.DetachWindow();
@ -360,7 +414,7 @@ void SciterMainWindow::ResetMenu()
MenuBarItemList mainTitleMenu; MenuBarItemList mainTitleMenu;
MenuBarItemList fileMenu; MenuBarItemList fileMenu;
fileMenu.push_back(MenuBarItem(static_cast<int32_t>(GuiAction::LoadFile), "&Load File...", nullptr, HotkeyAccelerator(Hotkey::LoadFile))); fileMenu.push_back(MenuBarItem(static_cast<int32_t>(GuiAction::LoadFile), "&Load File...", nullptr, HotkeyAccelerator(Hotkey::LoadFile), MenuBarItem::CheckState::None, MenuIconSvg(GuiAction::LoadFile)));
Stringlist & recentFiles = uiSettings.recentFiles; Stringlist & recentFiles = uiSettings.recentFiles;
MenuBarItemList RecentFileMenu; MenuBarItemList RecentFileMenu;
@ -373,11 +427,11 @@ void SciterMainWindow::ResetMenu()
RecentFileMenu.push_back(MenuBarItem(static_cast<int32_t>(GuiAction::RecentFileMenuFirst) + recentFileIndex, MenuString.c_str())); RecentFileMenu.push_back(MenuBarItem(static_cast<int32_t>(GuiAction::RecentFileMenuFirst) + recentFileIndex, MenuString.c_str()));
recentFileIndex += 1; recentFileIndex += 1;
} }
fileMenu.emplace_back(MenuBarItem::SUB_MENU, "&Recent File", &RecentFileMenu); fileMenu.push_back(MenuBarItem(MenuBarItem::SUB_MENU, "&Recent File", &RecentFileMenu, nullptr, MenuBarItem::CheckState::None, MenuIconSvgForResource("recent.svg")));
} }
fileMenu.push_back(MenuBarItem(MenuBarItem::SPLITER)); fileMenu.push_back(MenuBarItem(MenuBarItem::SPLITER));
fileMenu.push_back(MenuBarItem(static_cast<int32_t>(GuiAction::ExitApplication), "E&xit", nullptr, HotkeyAccelerator(Hotkey::Exit))); fileMenu.push_back(MenuBarItem(static_cast<int32_t>(GuiAction::ExitApplication), "E&xit", nullptr, HotkeyAccelerator(Hotkey::Exit), MenuBarItem::CheckState::None, MenuIconSvg(GuiAction::ExitApplication)));
mainTitleMenu.push_back(MenuBarItem(MenuBarItem::SUB_MENU, "&File", &fileMenu)); mainTitleMenu.push_back(MenuBarItem(MenuBarItem::SUB_MENU, "&File", &fileMenu));
MenuBarItemList systemMenu; MenuBarItemList systemMenu;
@ -388,8 +442,8 @@ void SciterMainWindow::ResetMenu()
{ {
paused = m_modules.Modules().OperatingSystem().IsEmulationPaused(); paused = m_modules.Modules().OperatingSystem().IsEmulationPaused();
} }
systemMenu.push_back(MenuBarItem(static_cast<int32_t>(GuiAction::PauseOrContinueEmulation),paused ? "Continue" : "Pause",nullptr, HotkeyAccelerator(Hotkey::PauseContinue))); systemMenu.push_back(MenuBarItem(static_cast<int32_t>(GuiAction::PauseOrContinueEmulation), paused ? "Continue" : "Pause", nullptr, HotkeyAccelerator(Hotkey::PauseContinue), MenuBarItem::CheckState::None, MenuIconSvg(GuiAction::PauseOrContinueEmulation)));
systemMenu.push_back(MenuBarItem(static_cast<int32_t>(GuiAction::StopEmulation), "&Stop", nullptr, HotkeyAccelerator(Hotkey::StopEmulation))); systemMenu.push_back(MenuBarItem(static_cast<int32_t>(GuiAction::StopEmulation), "&Stop", nullptr, HotkeyAccelerator(Hotkey::StopEmulation), MenuBarItem::CheckState::None, MenuIconSvg(GuiAction::StopEmulation)));
mainTitleMenu.push_back(MenuBarItem(MenuBarItem::SUB_MENU, "&System", &systemMenu)); mainTitleMenu.push_back(MenuBarItem(MenuBarItem::SUB_MENU, "&System", &systemMenu));
} }
@ -401,29 +455,30 @@ void SciterMainWindow::ResetMenu()
} }
if (m_emulationRunning) if (m_emulationRunning)
{ {
const std::string * fullscreenSvg = m_fullscreenMenuSvg.empty() ? nullptr : &m_fullscreenMenuSvg; viewMenu.push_back(MenuBarItem(static_cast<int32_t>(GuiAction::ToggleFullscreen), "&Fullscreen", nullptr, HotkeyAccelerator(Hotkey::Fullscreen), MenuBarItem::CheckState::None, MenuIconSvg(GuiAction::ToggleFullscreen)));
viewMenu.push_back(MenuBarItem(static_cast<int32_t>(GuiAction::ToggleFullscreen), "&Fullscreen", nullptr, HotkeyAccelerator(Hotkey::Fullscreen), MenuBarItem::CheckState::None, fullscreenSvg));
} }
if (m_emulationRunning) if (m_emulationRunning)
{ {
viewMenu.push_back(MenuBarItem(static_cast<int32_t>(GuiAction::ToggleHideUi), m_hideUi ? "Show &UI" : "Hide &UI", nullptr, HotkeyAccelerator(Hotkey::HideUi))); viewMenu.push_back(MenuBarItem(static_cast<int32_t>(GuiAction::ToggleHideUi), m_hideUi ? "Show &UI" : "Hide &UI", nullptr, HotkeyAccelerator(Hotkey::HideUi), MenuBarItem::CheckState::None, MenuIconSvg(GuiAction::ToggleHideUi)));
} }
MenuBarItemList resetWindowSizeMenu; MenuBarItemList resetWindowSizeMenu;
resetWindowSizeMenu.push_back(MenuBarItem(static_cast<int32_t>(GuiAction::ResetWindowSize720p),"Reset Window Size to 720p")); const std::string * resizeMenuSvg = MenuIconSvg(GuiAction::ResetWindowSize720p);
resetWindowSizeMenu.push_back(MenuBarItem(static_cast<int32_t>(GuiAction::ResetWindowSize900p),"Reset Window Size to 900p")); resetWindowSizeMenu.push_back(MenuBarItem(static_cast<int32_t>(GuiAction::ResetWindowSize720p), "Reset Window Size to 720p", nullptr, nullptr, MenuBarItem::CheckState::None, resizeMenuSvg));
resetWindowSizeMenu.push_back(MenuBarItem(static_cast<int32_t>(GuiAction::ResetWindowSize1080p),"Reset Window Size to 1080p")); resetWindowSizeMenu.push_back(MenuBarItem(static_cast<int32_t>(GuiAction::ResetWindowSize900p), "Reset Window Size to 900p", nullptr, nullptr, MenuBarItem::CheckState::None, resizeMenuSvg));
viewMenu.push_back(MenuBarItem(MenuBarItem::SUB_MENU, "Reset Window Size", &resetWindowSizeMenu)); resetWindowSizeMenu.push_back(MenuBarItem(static_cast<int32_t>(GuiAction::ResetWindowSize1080p), "Reset Window Size to 1080p", nullptr, nullptr, MenuBarItem::CheckState::None, resizeMenuSvg));
viewMenu.push_back(MenuBarItem(MenuBarItem::SUB_MENU, "Reset Window Size", &resetWindowSizeMenu, nullptr, MenuBarItem::CheckState::None, resizeMenuSvg));
mainTitleMenu.push_back(MenuBarItem(MenuBarItem::SUB_MENU, "&View", &viewMenu)); mainTitleMenu.push_back(MenuBarItem(MenuBarItem::SUB_MENU, "&View", &viewMenu));
MenuBarItemList optionsMenu; MenuBarItemList optionsMenu;
optionsMenu.push_back(MenuBarItem(static_cast<int32_t>(GuiAction::OpenControllersDialog), "&Controllers...", nullptr, HotkeyAccelerator(Hotkey::Controllers))); optionsMenu.push_back(MenuBarItem(static_cast<int32_t>(GuiAction::OpenControllersDialog), "&Controllers...", nullptr, HotkeyAccelerator(Hotkey::Controllers), MenuBarItem::CheckState::None, MenuIconSvg(GuiAction::OpenControllersDialog)));
optionsMenu.push_back(MenuBarItem(static_cast<int32_t>(GuiAction::OpenSystemConfiguration), "Confi&gure...", nullptr, HotkeyAccelerator(Hotkey::Configure))); optionsMenu.push_back(MenuBarItem(static_cast<int32_t>(GuiAction::OpenSystemConfiguration), "Confi&gure...", nullptr, HotkeyAccelerator(Hotkey::Configure), MenuBarItem::CheckState::None, MenuIconSvg(GuiAction::OpenSystemConfiguration)));
MenuBarItemList installFirmwareMenu; MenuBarItemList installFirmwareMenu;
if (!m_emulationRunning && m_modules.IsValid()) if (!m_emulationRunning && m_modules.IsValid())
{ {
optionsMenu.push_back(MenuBarItem(MenuBarItem::SPLITER)); optionsMenu.push_back(MenuBarItem(MenuBarItem::SPLITER));
installFirmwareMenu.push_back(MenuBarItem(static_cast<int32_t>(GuiAction::InstallFirmwareFromFile), "Install from &DXCI or ZIP...", nullptr, nullptr)); const std::string * installFirmwareSvg = MenuIconSvg(GuiAction::InstallFirmwareFromFile);
installFirmwareMenu.push_back(MenuBarItem(static_cast<int32_t>(GuiAction::InstallFirmwareFromFolder), "Install from &folder...", nullptr, nullptr)); installFirmwareMenu.push_back(MenuBarItem(static_cast<int32_t>(GuiAction::InstallFirmwareFromFile), "Install from &DXCI or ZIP...", nullptr, nullptr, MenuBarItem::CheckState::None, installFirmwareSvg));
installFirmwareMenu.push_back(MenuBarItem(static_cast<int32_t>(GuiAction::InstallFirmwareFromFolder), "Install from &folder...", nullptr, nullptr, MenuBarItem::CheckState::None, installFirmwareSvg));
optionsMenu.push_back(MenuBarItem(MenuBarItem::SUB_MENU, "Install &Firmware", &installFirmwareMenu)); optionsMenu.push_back(MenuBarItem(MenuBarItem::SUB_MENU, "Install &Firmware", &installFirmwareMenu));
} }
mainTitleMenu.push_back(MenuBarItem(MenuBarItem::SUB_MENU, "&Options", &optionsMenu)); mainTitleMenu.push_back(MenuBarItem(MenuBarItem::SUB_MENU, "&Options", &optionsMenu));

View File

@ -2,6 +2,7 @@
#include "applets/web_browser.h" #include "applets/web_browser.h"
#include "startup_checks.h" #include "startup_checks.h"
#include "user_interface/widgets/rom_browser.h" #include "user_interface/widgets/rom_browser.h"
#include <map>
#include <memory> #include <memory>
#include <string> #include <string>
#include <nxemu-core/modules/system_modules.h> #include <nxemu-core/modules/system_modules.h>
@ -115,6 +116,9 @@ private:
const char * IsMenuBarAccelerator(uint32_t keyCode, uint32_t keyboardState); const char * IsMenuBarAccelerator(uint32_t keyCode, uint32_t keyboardState);
GuiAction HotkeyToGuiAction(const char * hotkeyId); GuiAction HotkeyToGuiAction(const char * hotkeyId);
void OnGuiAction(GuiAction action); void OnGuiAction(GuiAction action);
const char * MenuIconResource(GuiAction action) const;
const std::string * MenuIconSvg(GuiAction action);
const std::string * MenuIconSvgForResource(const char * resource);
void ToggleHideUi(); void ToggleHideUi();
void UpdateUIVisibility(); void UpdateUIVisibility();
@ -177,7 +181,7 @@ private:
uint32_t m_speedLimit; uint32_t m_speedLimit;
bool m_emulationRunning; bool m_emulationRunning;
bool m_pendingStartInFullscreen; bool m_pendingStartInFullscreen;
std::string m_fullscreenMenuSvg; std::map<std::string, std::string> m_menuIconSvgs;
bool m_hideUi; bool m_hideUi;
uint64_t m_lastDiskCacheStatusPostMs; uint64_t m_lastDiskCacheStatusPostMs;
int m_lastPostedDiskCacheStage; int m_lastPostedDiskCacheStage;