Browse Source

Add error information if plugin fails to load

tags/v1.0
falkTX 3 years ago
parent
commit
8df721fde0
3 changed files with 86 additions and 8 deletions
  1. +1
    -1
      Makefile
  2. +1
    -1
      carla
  3. +84
    -6
      plugins/Common/IldaeilUI.cpp

+ 1
- 1
Makefile View File

@@ -39,7 +39,7 @@ endif
# -------------------------------------------------------------- # --------------------------------------------------------------


clean: clean:
$(MAKE) clean -C carla
$(MAKE) distclean -C carla
$(MAKE) clean -C dpf/dgl $(MAKE) clean -C dpf/dgl
$(MAKE) clean -C dpf/utils/lv2-ttl-generator $(MAKE) clean -C dpf/utils/lv2-ttl-generator
$(MAKE) clean -C plugins/FX $(MAKE) clean -C plugins/FX


+ 1
- 1
carla

@@ -1 +1 @@
Subproject commit 2b3924c89c7824bd40d31ba3463aa8e5492b84fb
Subproject commit ac8e58f84d0f2b57f7ee22f9f4f8b29eacd3512f

+ 84
- 6
plugins/Common/IldaeilUI.cpp View File

@@ -67,7 +67,8 @@ class IldaeilUI : public UI,


enum { enum {
kDrawingInit, kDrawingInit,
kDrawingError,
kDrawingErrorInit,
kDrawingErrorDraw,
kDrawingLoading, kDrawingLoading,
kDrawingPluginList, kDrawingPluginList,
kDrawingPluginEmbedUI, kDrawingPluginEmbedUI,
@@ -147,6 +148,8 @@ class IldaeilUI : public UI,
bool fPluginSearchFirstShow; bool fPluginSearchFirstShow;
char fPluginSearchString[0xff]; char fPluginSearchString[0xff];


String fPopupError;

public: public:
IldaeilUI() IldaeilUI()
: UI(kInitialWidth, kInitialHeight), : UI(kInitialWidth, kInitialHeight),
@@ -165,9 +168,13 @@ public:
fPluginSearchActive(false), fPluginSearchActive(false),
fPluginSearchFirstShow(false) fPluginSearchFirstShow(false)
{ {
const double scaleFactor = getScaleFactor();

if (fPlugin == nullptr || fPlugin->fCarlaHostHandle == nullptr) if (fPlugin == nullptr || fPlugin->fCarlaHostHandle == nullptr)
{ {
fDrawingState = kDrawingError;
fDrawingState = kDrawingErrorInit;
fPopupError = "Ildaeil backend failed to init properly, cannot continue.";
setSize(kInitialWidth * scaleFactor * 0.5, kInitialHeight * scaleFactor * 0.5);
return; return;
} }


@@ -177,7 +184,6 @@ public:
style.FrameRounding = 4; style.FrameRounding = 4;


const double padding = style.WindowPadding.y * 2; const double padding = style.WindowPadding.y * 2;
const double scaleFactor = getScaleFactor();


if (d_isNotEqual(scaleFactor, 1.0)) if (d_isNotEqual(scaleFactor, 1.0))
{ {
@@ -396,6 +402,12 @@ public:
showPluginUI(handle); showPluginUI(handle);
return true; return true;
} }
else
{
fPopupError = carla_get_last_error(handle);
d_stdout("got error: %s", fPopupError.buffer());
ImGui::OpenPopup("Plugin Error");
}


return false; return false;
} }
@@ -500,8 +512,12 @@ protected:
case kDrawingPluginList: case kDrawingPluginList:
drawPluginList(); drawPluginList();
break; break;
case kDrawingError:
// TODO display error message
case kDrawingErrorInit:
fDrawingState = kDrawingErrorDraw;
drawError(true);
break;
case kDrawingErrorDraw:
drawError(false);
break; break;
case kDrawingPluginGenericUI: case kDrawingPluginGenericUI:
drawGenericUI(); drawGenericUI();
@@ -510,6 +526,44 @@ protected:
drawTopBar(); drawTopBar();
break; break;
} }

}

void drawError(const bool open)
{
ImGui::SetNextWindowPos(ImVec2(0, 0));
ImGui::SetNextWindowSize(ImVec2(getWidth(), getHeight()));

const int flags = ImGuiWindowFlags_NoSavedSettings
| ImGuiWindowFlags_NoTitleBar
| ImGuiWindowFlags_NoResize
| ImGuiWindowFlags_NoCollapse
| ImGuiWindowFlags_NoScrollbar
| ImGuiWindowFlags_NoScrollWithMouse
| ImGuiWindowFlags_NoCollapse;

if (ImGui::Begin("Error Window", nullptr, flags))
{
if (open)
ImGui::OpenPopup("Engine Error");

const int pflags = ImGuiWindowFlags_NoSavedSettings
| ImGuiWindowFlags_NoResize
| ImGuiWindowFlags_NoCollapse
| ImGuiWindowFlags_NoScrollbar
| ImGuiWindowFlags_NoScrollWithMouse
| ImGuiWindowFlags_NoCollapse
| ImGuiWindowFlags_AlwaysAutoResize
| ImGuiWindowFlags_AlwaysUseWindowPadding;

if (ImGui::BeginPopupModal("Engine Error", nullptr, pflags))
{
ImGui::TextUnformatted(fPopupError.buffer(), nullptr);
ImGui::EndPopup();
}
}

ImGui::End();
} }


void drawTopBar() void drawTopBar()
@@ -689,7 +743,31 @@ protected:


if (ImGui::Begin("Plugin List", nullptr, ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoResize)) if (ImGui::Begin("Plugin List", nullptr, ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoResize))
{ {
if (fPluginSearchFirstShow)
const int pflags = ImGuiWindowFlags_NoSavedSettings
| ImGuiWindowFlags_NoResize
| ImGuiWindowFlags_NoCollapse
| ImGuiWindowFlags_NoScrollbar
| ImGuiWindowFlags_NoScrollWithMouse
| ImGuiWindowFlags_NoCollapse
| ImGuiWindowFlags_AlwaysAutoResize
| ImGuiWindowFlags_AlwaysUseWindowPadding;

if (ImGui::BeginPopupModal("Plugin Error", nullptr, pflags))
{
ImGui::TextWrapped("Failed to load plugin, error was:\n%s", fPopupError.buffer());

ImGui::Separator();

if (ImGui::Button("Ok"))
{
ImGui::CloseCurrentPopup();
}

ImGui::SameLine();
ImGui::Dummy(ImVec2(500 * getScaleFactor(), 1));
ImGui::EndPopup();
}
else if (fPluginSearchFirstShow)
{ {
fPluginSearchFirstShow = false; fPluginSearchFirstShow = false;
ImGui::SetKeyboardFocusHere(); ImGui::SetKeyboardFocusHere();


Loading…
Cancel
Save