| 105 | |
| 106 | |
| 107 | void Model::appendContextMenu(ui::Menu* menu, bool inBrowser) { |
| 108 | // plugin |
| 109 | menu->addChild(createMenuItem(string::translate("Model.plugin") + plugin->name, "", [=]() { |
| 110 | system::openBrowser(plugin->pluginUrl); |
| 111 | }, plugin->pluginUrl == "")); |
| 112 | |
| 113 | // version |
| 114 | menu->addChild(createMenuLabel(string::translate("Model.version") + plugin->version)); |
| 115 | |
| 116 | // author |
| 117 | if (plugin->author != "") { |
| 118 | menu->addChild(createMenuItem(string::translate("Model.author") + plugin->author, "", [=]() { |
| 119 | system::openBrowser(plugin->authorUrl); |
| 120 | }, plugin->authorUrl.empty())); |
| 121 | } |
| 122 | |
| 123 | // license |
| 124 | std::string license = plugin->license; |
| 125 | if (string::startsWith(license, "https://") || string::startsWith(license, "http://")) { |
| 126 | menu->addChild(createMenuItem(string::translate("Model.licenseBrowser"), "", [=]() { |
| 127 | system::openBrowser(license); |
| 128 | })); |
| 129 | } |
| 130 | else if (license != "") { |
| 131 | menu->addChild(createMenuLabel(string::translate("Model.license") + license)); |
| 132 | } |
| 133 | |
| 134 | // tags |
| 135 | if (!tagIds.empty()) { |
| 136 | menu->addChild(createMenuLabel(string::translate("Model.tags"))); |
| 137 | for (int tagId : tagIds) { |
| 138 | std::string tag = string::translate("tag." + tag::getTag(tagId)); |
| 139 | menu->addChild(createMenuLabel("• " + tag)); |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | menu->addChild(new ui::MenuSeparator); |
| 144 | |
| 145 | // VCV Library page |
| 146 | menu->addChild(createMenuItem(string::translate("Model.library"), "", [=]() { |
| 147 | system::openBrowser("https://library.vcvrack.com/" + plugin->slug + "/" + slug); |
| 148 | })); |
| 149 | |
| 150 | // modularGridUrl |
| 151 | if (modularGridUrl != "") { |
| 152 | menu->addChild(createMenuItem(string::translate("Model.modularGrid"), "", [=]() { |
| 153 | system::openBrowser(modularGridUrl); |
| 154 | })); |
| 155 | } |
| 156 | |
| 157 | // manual |
| 158 | std::string manualUrl = getManualUrl(); |
| 159 | if (manualUrl != "") { |
| 160 | menu->addChild(createMenuItem(string::translate("Model.manual"), widget::getKeyCommandName(GLFW_KEY_F1, RACK_MOD_CTRL), [=]() { |
| 161 | system::openBrowser(manualUrl); |
| 162 | })); |
| 163 | } |
| 164 |
no test coverage detected