1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

ScopedMessageBox: Replace old AlertWindow uses with new API

This commit is contained in:
reuk 2023-02-22 20:54:45 +00:00
parent 79ed81c24a
commit 39a731de46
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C
55 changed files with 893 additions and 677 deletions

View file

@ -222,16 +222,17 @@ private:
//==============================================================================
void showConnectionErrorMessage (const String& messageText)
{
AlertWindow::showMessageBoxAsync (MessageBoxIconType::WarningIcon,
"Connection error",
messageText,
"OK");
auto options = MessageBoxOptions::makeOptionsOk (MessageBoxIconType::WarningIcon,
"Connection error",
messageText);
messageBox = AlertWindow::showScopedAsync (options, nullptr);
}
//==============================================================================
Slider rotaryKnob;
OSCSender sender1, sender2;
Label senderLabel { {}, "Sender" };
ScopedMessageBox messageBox;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (OSCSenderDemo)
};
@ -273,15 +274,16 @@ private:
void showConnectionErrorMessage (const String& messageText)
{
AlertWindow::showMessageBoxAsync (MessageBoxIconType::WarningIcon,
"Connection error",
messageText,
"OK");
auto options = MessageBoxOptions::makeOptionsOk (MessageBoxIconType::WarningIcon,
"Connection error",
messageText);
messageBox = AlertWindow::showScopedAsync (options, nullptr);
}
//==============================================================================
Slider rotaryKnob;
Label receiverLabel { {}, "Receiver" };
ScopedMessageBox messageBox;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (OSCReceiverDemo)
};
@ -403,28 +405,28 @@ private:
//==============================================================================
void handleConnectError (int failedPort)
{
AlertWindow::showMessageBoxAsync (MessageBoxIconType::WarningIcon,
"OSC Connection error",
"Error: could not connect to port " + String (failedPort),
"OK");
auto options = MessageBoxOptions::makeOptionsOk (MessageBoxIconType::WarningIcon,
"OSC Connection error",
"Error: could not connect to port " + String (failedPort));
messageBox = AlertWindow::showScopedAsync (options, nullptr);
}
//==============================================================================
void handleDisconnectError()
{
AlertWindow::showMessageBoxAsync (MessageBoxIconType::WarningIcon,
"Unknown error",
"An unknown error occurred while trying to disconnect from UDP port.",
"OK");
auto options = MessageBoxOptions::makeOptionsOk (MessageBoxIconType::WarningIcon,
"Unknown error",
"An unknown error occurred while trying to disconnect from UDP port.");
messageBox = AlertWindow::showScopedAsync (options, nullptr);
}
//==============================================================================
void handleInvalidPortNumberEntered()
{
AlertWindow::showMessageBoxAsync (MessageBoxIconType::WarningIcon,
"Invalid port number",
"Error: you have entered an invalid UDP port number.",
"OK");
auto options = MessageBoxOptions::makeOptionsOk (MessageBoxIconType::WarningIcon,
"Invalid port number",
"Error: you have entered an invalid UDP port number.");
messageBox = AlertWindow::showScopedAsync (options, nullptr);
}
//==============================================================================
@ -457,6 +459,8 @@ private:
connectionStatusLabel.setJustificationType (Justification::centredRight);
}
ScopedMessageBox messageBox;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (OSCMonitorDemo)
};