-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add a basic notification system #114
Merged
CHollingworth
merged 13 commits into
CHollingworth:master
from
SnazzyPanda:issue-notification
Jan 3, 2024
Merged
feat: Add a basic notification system #114
CHollingworth
merged 13 commits into
CHollingworth:master
from
SnazzyPanda:issue-notification
Jan 3, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The drag bar would not respond as expected, and instead you could drag on the collapsing header to change the scaling. I believe this behavior broke with the change to ImGui 1.90. This should fix that by making the ID for the header different from the drag bar.
How does the user dismiss notifications? |
The get dismissed when the user clicks them. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds a basic notification system to help us notify users of various errors, warnings, etc.
As part of this change, I had to bump the ImGui version to 1.90, and I have not fully re-tested the interface.
Some of the main changes include:
Lampray/Control/lampNotification.h
to provide functionalityUsage
To add a notification for display, you would just need to include the
Lampray/Control/lampNotification.h
file and then call the related function with your notification message:Lamp::Core::lampNotification::getInstance().pushErrorNotification("Error");
Lamp::Core::lampNotification::getInstance().pushInfoNotification("Info");
Lamp::Core::lampNotification::getInstance().pushWarningNotification("Warning");
Lamp::Core::lampNotification::getInstance().pushSuccessNotification("Success");
type
is a string representation of the notification type ("info", "warning", "success", "error"):Lamp::Core::lampNotification::getInstance().pushNotification("type", "message");
Currently, notifications only get displayed on the main modlist screen. To display them somewhere else, you would need to move or add
Lamp::Core::lampNotification::getInstance().DisplayNotifications();
. Perhaps in the future, we could also find some way to specify notification location (such as "top", "bottom", etc) to have multiple, separate notification areas.The colors used are not currently user configurable, but should be exposed for modifying if needed.
I also implemented a word-wrapping function to try to support longer notification messages. I think it should work fine, but feel free to try to throw some stuff at it to make sure it holds up.
Here is an example of what this currently looks like:
In the screenshot, there are 2 info notifications ("Test Info" and a notification I was using to test longer strings with minimal spaces in them). The error notification at the bottom is showing a more standard message (with spaces throughout) that needs wrapping due to its length.