mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-06-28 21:37:50 +02:00
Added error dialog to module manager and fixed typo
This commit is contained in:
@ -4,9 +4,12 @@
|
||||
#include <string>
|
||||
#include <gui/gui.h>
|
||||
|
||||
#define GENERIC_DIALOG_BUTTONS_OK "Ok\0"
|
||||
#define GENERIC_DIALOG_BUTTONS_YES_NO "Yes\0No\0"
|
||||
#define GENERIC_DIALOG_BUTTONS_APPLY_CANCEL "Apply\0Cancel\0"
|
||||
#define GENERIC_DIALOG_BUTTONS_OK_CANCEL "Ok\0Cancel\0"
|
||||
|
||||
#define GENERIC_DIALOG_BUTTON_OK 0
|
||||
#define GENERIC_DIALOG_BUTTON_YES 0
|
||||
#define GENERIC_DIALOG_BUTTON_NO 1
|
||||
#define GENERIC_DIALOG_BUTTON_APPLY 0
|
||||
|
@ -10,8 +10,10 @@ namespace module_manager_menu {
|
||||
std::vector<std::string> modTypes;
|
||||
std::string toBeRemoved;
|
||||
std::string modTypesTxt;
|
||||
std::string errorMessage;
|
||||
int modTypeId;
|
||||
bool confirmOpened = false;
|
||||
bool errorOpen = false;
|
||||
|
||||
void init() {
|
||||
modName[0] = 0;
|
||||
@ -66,6 +68,10 @@ namespace module_manager_menu {
|
||||
modified = true;
|
||||
}
|
||||
|
||||
ImGui::GenericDialog("module_mgr_error_", errorOpen, GENERIC_DIALOG_BUTTONS_OK, [](){
|
||||
ImGui::Text(errorMessage.c_str());
|
||||
});
|
||||
|
||||
// Add module row with slightly different settings
|
||||
ImGui::BeginTable("Module Manager Add Table", 3);
|
||||
ImGui::TableSetupColumn("Name");
|
||||
@ -84,9 +90,14 @@ namespace module_manager_menu {
|
||||
ImGui::TableSetColumnIndex(2);
|
||||
if (strlen(modName) == 0) { style::beginDisabled(); }
|
||||
if (ImGui::Button("+##module_mgr_add_btn", ImVec2(16,0))) {
|
||||
core::moduleManager.createInstance(modName, modTypes[modTypeId]);
|
||||
core::moduleManager.postInit(modName);
|
||||
modified = true;
|
||||
if (!core::moduleManager.createInstance(modName, modTypes[modTypeId])) {
|
||||
core::moduleManager.postInit(modName);
|
||||
modified = true;
|
||||
}
|
||||
else {
|
||||
errorMessage = "Could not create new instance of " + modTypes[modTypeId];
|
||||
errorOpen = true;
|
||||
}
|
||||
}
|
||||
if (strlen(modName) == 0) { style::endDisabled(); }
|
||||
ImGui::EndTable();
|
||||
|
Reference in New Issue
Block a user