Add a popup for when video render is done.

This commit is contained in:
furo 2023-09-12 17:19:24 +02:00
parent 62c0d34129
commit 8f8c9a20c0
3 changed files with 56 additions and 0 deletions

View file

@ -1222,6 +1222,10 @@ int CMenus::Render()
{
pTitle = Localize("Render demo");
}
else if(m_Popup == POPUP_RENDER_DONE)
{
pTitle = Localize("Render complete");
}
#endif
else if(m_Popup == POPUP_PASSWORD)
{
@ -1677,6 +1681,50 @@ int CMenus::Render()
UI()->DoLabel(&Label, Localize("Video name:"), 18.0f, TEXTALIGN_ML);
UI()->DoEditBox(&m_DemoRenderInput, &TextBox, 12.0f);
}
else if(m_Popup == POPUP_RENDER_DONE)
{
CUIRect TextBox, Ok, OpenFolder;
char aFilePath[IO_MAX_PATH_LENGTH];
char aSaveFolder[IO_MAX_PATH_LENGTH];
Storage()->GetCompletePath(Storage()->TYPE_SAVE, "videos", aSaveFolder, sizeof(aSaveFolder));
str_format(aFilePath, sizeof(aFilePath), "%s/%s.mp4", aSaveFolder, m_DemoRenderInput.GetString());
Box.HSplitBottom(20.f, &Box, &Part);
Box.HSplitBottom(24.f, &Box, &Part);
Part.VMargin(80.0f, &Part);
Part.VSplitMid(&OpenFolder, &Ok);
Ok.VMargin(20.0f, &Ok);
OpenFolder.VMargin(20.0f, &OpenFolder);
static CButtonContainer s_ButtonOpenFolder;
if(DoButton_Menu(&s_ButtonOpenFolder, Localize("Videos directory"), 0, &OpenFolder))
{
if(!open_file(aSaveFolder))
{
dbg_msg("menus", "couldn't open file '%s'", aBuf);
}
}
static CButtonContainer s_ButtonOk;
if(DoButton_Menu(&s_ButtonOk, Localize("Ok"), 0, &Ok) || UI()->ConsumeHotkey(CUI::HOTKEY_ENTER))
{
m_Popup = POPUP_NONE;
m_DemoRenderInput.Clear();
}
Box.HSplitBottom(160.f, &Box, &Part);
Part.VSplitLeft(60.0f, 0, &TextBox);
TextBox.VSplitLeft(20.0f, 0, &TextBox);
TextBox.VSplitRight(60.0f, &TextBox, 0);
str_format(aBuf, sizeof(aBuf), Localize("Video was saved to '%s'"), aFilePath);
UI()->DoLabel(&TextBox, aBuf, 18.0f, TEXTALIGN_LEFT);
}
#endif
else if(m_Popup == POPUP_FIRST_LAUNCH)
{

View file

@ -652,6 +652,7 @@ public:
POPUP_LANGUAGE,
POPUP_RENAME_DEMO,
POPUP_RENDER_DEMO,
POPUP_RENDER_DONE,
POPUP_PASSWORD,
POPUP_QUIT,
POPUP_WARNING,

View file

@ -986,6 +986,13 @@ void CMenus::RenderDemoList(CUIRect MainView)
s_Inited = 1;
}
#if defined(CONF_VIDEORECORDER)
if(m_DemoRenderInput.GetLength() > 0)
{
m_Popup = POPUP_RENDER_DONE;
}
#endif
char aFooterLabel[128] = {0};
if(m_DemolistSelectedIndex >= 0)
{