-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show warning when JAVA_HOME is not defined (#261)
* #133 Don't crash when JAVA_HOME is not defined and show a warning instead * #133 Add super constructor call * #133 Centralize configuration check and error message production and use them from within the editor plugin * Remove test error * Use getters to prevent modifications outside GDKotlin * Return const reference and mark getter as const
- Loading branch information
Showing
8 changed files
with
135 additions
and
7 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
|
||
#ifdef TOOLS_ENABLED | ||
|
||
#include <editor/editor_settings.h> | ||
#include <scene/gui/texture_rect.h> | ||
#include <scene/gui/rich_text_label.h> | ||
#include <editor/editor_scale.h> | ||
#include "error_dialog.h" | ||
|
||
ErrorDialog::ErrorDialog(): AcceptDialog(), error_message_label(memnew(RichTextLabel)) { | ||
VBoxContainer* about_vbox{memnew(VBoxContainer)}; | ||
add_child(about_vbox); | ||
|
||
HBoxContainer* about_hbox{memnew(HBoxContainer)}; | ||
about_vbox->add_child(about_hbox); | ||
|
||
TextureRect* icon{memnew(TextureRect)}; | ||
icon->set_texture(get_icon("Warning", "EditorIcons")); | ||
about_hbox->add_child(icon); | ||
|
||
about_hbox->add_child(error_message_label); | ||
error_message_label->set_custom_minimum_size(Size2{600, 300} * EDSCALE); | ||
error_message_label->set_v_size_flags(Control::SizeFlags::SIZE_EXPAND_FILL); | ||
|
||
error_message_label->set_scroll_active(true); | ||
error_message_label->set_use_bbcode(true); | ||
} | ||
|
||
void ErrorDialog::show_with_error(const String& error_title, const String& error_message) { | ||
set_title(error_title); | ||
error_message_label->set_bbcode(error_message); | ||
popup_centered_minsize(); | ||
} | ||
|
||
void ErrorDialog::show_with_errors(const String& dialog_title, const Vector<Pair<String, String>>& errors) { | ||
set_title(dialog_title); | ||
String error_message{}; | ||
|
||
for (int i = 0; i < errors.size(); i++) { | ||
Pair<String, String> error = errors[i]; | ||
|
||
if (i != 0) { | ||
error_message += String{"\n\n"}; | ||
} | ||
|
||
error_message += String{"[u]"} + error.first + String{"[/u]"}; | ||
error_message += String{"\n"}; | ||
error_message += error.second; | ||
} | ||
|
||
error_message_label->set_bbcode(error_message); | ||
popup_centered_minsize(); | ||
} | ||
|
||
#endif //TOOLS_ENABLED |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#ifdef TOOLS_ENABLED | ||
|
||
#ifndef GODOT_JVM_ERROR_DIALOG_H | ||
#define GODOT_JVM_ERROR_DIALOG_H | ||
|
||
|
||
#include <scene/gui/dialogs.h> | ||
#include <scene/gui/rich_text_label.h> | ||
|
||
class ErrorDialog : public AcceptDialog { | ||
public: | ||
ErrorDialog(); | ||
|
||
void show_with_error(const String& error_title, const String& error_message); | ||
void show_with_errors(const String& dialog_title, const Vector<Pair<String, String>>& errors); | ||
|
||
private: | ||
RichTextLabel* error_message_label; | ||
}; | ||
|
||
|
||
#endif //GODOT_JVM_ERROR_DIALOG_H | ||
#endif //TOOLS_ENABLED |
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
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
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
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