This commit is contained in:
Aria 2025-03-21 22:23:30 +11:00
commit 9c94d113d3
Signed by untrusted user who does not match committer: aria
GPG key ID: 19AB7AA462B8AB3B
10260 changed files with 1237388 additions and 0 deletions

View file

@ -0,0 +1,30 @@
#include "StarPopupInterface.hpp"
#include "StarGuiReader.hpp"
#include "StarRoot.hpp"
#include "StarLabelWidget.hpp"
#include "StarRandom.hpp"
#include "StarAssets.hpp"
namespace Star {
PopupInterface::PopupInterface() {
auto assets = Root::singleton().assets();
GuiReader reader;
reader.registerCallback("close", [=](Widget*) { dismiss(); });
reader.registerCallback("ok", [=](Widget*) { dismiss(); });
reader.construct(assets->json("/interface/windowconfig/popup.config:paneLayout"), this);
}
void PopupInterface::displayMessage(String const& message, String const& title, String const& subtitle, Maybe<String> const& onShowSound) {
setTitleString(title, subtitle);
fetchChild<LabelWidget>("message")->setText(message);
show();
auto sound = onShowSound.value(Random::randValueFrom(Root::singleton().assets()->json("/interface/windowconfig/popup.config:onShowSound").toArray(), "").toString());
if (!sound.empty())
context()->playAudio(sound);
}
}