| 31 | // -------------------------------------------------------------------------------------------------------------------- |
| 32 | |
| 33 | CardinalRemoteUI::CardinalRemoteUI(Window& window, const std::string& templatePath) |
| 34 | : NanoTopLevelWidget(window) |
| 35 | { |
| 36 | CardinalPluginContext* const context = static_cast<CardinalPluginContext*>(rack::contextGet()); |
| 37 | context->nativeWindowId = window.getNativeWindowHandle(); |
| 38 | context->tlw = this; |
| 39 | |
| 40 | // -------------------------------------------------------------------------- |
| 41 | |
| 42 | rack::window::WindowSetPluginRemote(context->window, this); |
| 43 | |
| 44 | // hide "Browse VCV Library" button |
| 45 | rack::widget::Widget* const browser = context->scene->browser->children.back(); |
| 46 | rack::widget::Widget* const headerLayout = browser->children.front(); |
| 47 | rack::widget::Widget* const libraryButton = headerLayout->children.back(); |
| 48 | libraryButton->hide(); |
| 49 | |
| 50 | // Report to user if something is wrong with the installation |
| 51 | std::string errorMessage; |
| 52 | |
| 53 | if (rack::asset::systemDir.empty()) |
| 54 | { |
| 55 | errorMessage = "Failed to locate Cardinal plugin bundle.\n" |
| 56 | "Install Cardinal with its plugin bundle folder intact and try again."; |
| 57 | } |
| 58 | else if (! rack::system::exists(rack::asset::systemDir)) |
| 59 | { |
| 60 | errorMessage = rack::string::f("System directory \"%s\" does not exist. " |
| 61 | "Make sure Cardinal was downloaded and installed correctly.", |
| 62 | rack::asset::systemDir.c_str()); |
| 63 | } |
| 64 | |
| 65 | if (! errorMessage.empty()) |
| 66 | asyncDialog::create(errorMessage.c_str()); |
| 67 | |
| 68 | context->window->step(); |
| 69 | |
| 70 | WindowParametersSetCallback(context->window, this); |
| 71 | |
| 72 | // -------------------------------------------------------------------------- |
| 73 | |
| 74 | addIdleCallback(this); |
| 75 | } |
| 76 | |
| 77 | CardinalRemoteUI::~CardinalRemoteUI() |
| 78 | { |
nothing calls this directly
no test coverage detected