mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-27 01:44:31 +02:00
Emscripten: Remove all other blocking prompt calls
This commit is contained in:
@@ -83,11 +83,10 @@ void LargeScreenDialog()
|
||||
message << "Switching to " << scale << "x size mode since your screen was determined to be large enough: ";
|
||||
message << desktopWidth << "x" << desktopHeight << " detected, " << WINDOWW*scale << "x" << WINDOWH*scale << " required";
|
||||
message << "\nTo undo this, hit Cancel. You can change this in settings at any time.";
|
||||
if (!ConfirmPrompt::Blocking("Large screen detected", message.Build()))
|
||||
{
|
||||
new ConfirmPrompt("Large screen detected", message.Build(), { nullptr, []() {
|
||||
GlobalPrefs::Ref().Set("Scale", 1);
|
||||
ui::Engine::Ref().SetScale(1);
|
||||
}
|
||||
} });
|
||||
}
|
||||
|
||||
void TickClient()
|
||||
|
@@ -141,29 +141,36 @@ void FileBrowserActivity::SelectSave(int index)
|
||||
|
||||
void FileBrowserActivity::DeleteSave(int index)
|
||||
{
|
||||
auto &file = files[index];
|
||||
String deleteMessage = "Are you sure you want to delete " + file->GetDisplayName() + ".cps?";
|
||||
if (ConfirmPrompt::Blocking("Delete Save", deleteMessage))
|
||||
{
|
||||
String deleteMessage = "Are you sure you want to delete " + files[index]->GetDisplayName() + ".cps?";
|
||||
new ConfirmPrompt("Delete Save", deleteMessage, { [this, index]() {
|
||||
auto &file = files[index];
|
||||
Platform::RemoveFile(file->GetName());
|
||||
loadDirectory(directory, "");
|
||||
}
|
||||
} });
|
||||
}
|
||||
|
||||
void FileBrowserActivity::RenameSave(int index)
|
||||
{
|
||||
auto &file = files[index];
|
||||
ByteString newName = TextPrompt::Blocking("Rename", "Change save name", file->GetDisplayName(), "", 0).ToUtf8();
|
||||
if (newName.length())
|
||||
{
|
||||
newName = ByteString::Build(directory, PATH_SEP_CHAR, newName, ".cps");
|
||||
if (!Platform::RenameFile(file->GetName(), newName, false))
|
||||
ErrorMessage::Blocking("Error", "Could not rename file");
|
||||
new TextPrompt("Rename", "Change save name", files[index]->GetDisplayName(), "", 0, { [this, index](const String &input) {
|
||||
auto &file = files[index];
|
||||
auto newName = input.ToUtf8();
|
||||
if (newName.length())
|
||||
{
|
||||
newName = ByteString::Build(directory, PATH_SEP_CHAR, newName, ".cps");
|
||||
if (!Platform::RenameFile(file->GetName(), newName, false))
|
||||
{
|
||||
new ErrorMessage("Error", "Could not rename file");
|
||||
}
|
||||
else
|
||||
{
|
||||
loadDirectory(directory, "");
|
||||
}
|
||||
}
|
||||
else
|
||||
loadDirectory(directory, "");
|
||||
}
|
||||
else
|
||||
ErrorMessage::Blocking("Error", "No save name given");
|
||||
{
|
||||
new ErrorMessage("Error", "No save name given");
|
||||
}
|
||||
} });
|
||||
}
|
||||
|
||||
void FileBrowserActivity::cleanup()
|
||||
|
@@ -604,10 +604,9 @@ void GameView::NotifyToolListChanged(GameModel * sender)
|
||||
}
|
||||
else if (identifier.BeginsWith("DEFAULT_PT_LIFECUST_"))
|
||||
{
|
||||
if (ConfirmPrompt::Blocking("Remove custom GOL type", "Are you sure you want to remove " + identifier.Substr(20).FromUtf8() + "?"))
|
||||
{
|
||||
new ConfirmPrompt("Remove custom GOL type", "Are you sure you want to remove " + identifier.Substr(20).FromUtf8() + "?", { [this, identifier]() {
|
||||
c->RemoveCustomGOLType(identifier);
|
||||
}
|
||||
} });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -994,17 +993,12 @@ int GameView::Record(bool record)
|
||||
}
|
||||
else if (!recording)
|
||||
{
|
||||
// block so that the return value is correct
|
||||
bool record = ConfirmPrompt::Blocking("Recording", "You're about to start recording all drawn frames. This will use a load of disk space.");
|
||||
if (record)
|
||||
{
|
||||
time_t startTime = time(NULL);
|
||||
recordingFolder = startTime;
|
||||
Platform::MakeDirectory("recordings");
|
||||
Platform::MakeDirectory(ByteString::Build("recordings", PATH_SEP_CHAR, recordingFolder));
|
||||
recording = true;
|
||||
recordingIndex = 0;
|
||||
}
|
||||
time_t startTime = time(NULL);
|
||||
recordingFolder = startTime;
|
||||
Platform::MakeDirectory("recordings");
|
||||
Platform::MakeDirectory(ByteString::Build("recordings", PATH_SEP_CHAR, recordingFolder));
|
||||
recording = true;
|
||||
recordingIndex = 0;
|
||||
}
|
||||
return recordingFolder;
|
||||
}
|
||||
|
@@ -385,8 +385,9 @@ void PreviewView::OnTick(float dt)
|
||||
c->Update();
|
||||
if (doError)
|
||||
{
|
||||
ErrorMessage::Blocking("Error loading save", doErrorMessage);
|
||||
c->Exit();
|
||||
new ErrorMessage("Error loading save", doErrorMessage, { [this]() {
|
||||
c->Exit();
|
||||
} });
|
||||
}
|
||||
|
||||
if (reportSaveRequest && reportSaveRequest->CheckDone())
|
||||
|
@@ -196,8 +196,9 @@ void ProfileActivity::OnTick(float dt)
|
||||
{
|
||||
if (doError)
|
||||
{
|
||||
ErrorMessage::Blocking("Error", doErrorMessage);
|
||||
Exit();
|
||||
new ErrorMessage("Error", doErrorMessage, { [this]() {
|
||||
Exit();
|
||||
} });
|
||||
}
|
||||
|
||||
if (saveUserInfoRequest && saveUserInfoRequest->CheckDone())
|
||||
|
Reference in New Issue
Block a user