| 123 | |
| 124 | |
| 125 | void Model::appendContextMenu(ui::Menu* menu, bool inBrowser) { |
| 126 | // plugin |
| 127 | menu->addChild(createMenuItem("Plugin: " + plugin->name, "", [=]() { |
| 128 | patchUtils::openBrowser(plugin->pluginUrl); |
| 129 | }, plugin->pluginUrl == "")); |
| 130 | |
| 131 | // version |
| 132 | menu->addChild(createMenuLabel("Version: " + plugin->version)); |
| 133 | |
| 134 | // author |
| 135 | if (plugin->author != "") { |
| 136 | menu->addChild(createMenuItem("Author: " + plugin->author, "", [=]() { |
| 137 | patchUtils::openBrowser(plugin->authorUrl); |
| 138 | }, plugin->authorUrl.empty())); |
| 139 | } |
| 140 | |
| 141 | // license |
| 142 | std::string license = plugin->license; |
| 143 | if (string::startsWith(license, "https://") || string::startsWith(license, "http://")) { |
| 144 | menu->addChild(createMenuItem("License: Open in browser", "", [=]() { |
| 145 | patchUtils::openBrowser(license); |
| 146 | })); |
| 147 | } |
| 148 | else if (license != "") { |
| 149 | menu->addChild(createMenuLabel("License: " + license)); |
| 150 | } |
| 151 | |
| 152 | // tags |
| 153 | if (!tagIds.empty()) { |
| 154 | menu->addChild(createMenuLabel("Tags:")); |
| 155 | for (int tagId : tagIds) { |
| 156 | menu->addChild(createMenuLabel("• " + tag::getTag(tagId))); |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | menu->addChild(new ui::MenuSeparator); |
| 161 | |
| 162 | // manual |
| 163 | std::string manualUrl = getManualUrl(); |
| 164 | if (manualUrl != "") { |
| 165 | menu->addChild(createMenuItem("User manual", RACK_MOD_CTRL_NAME "+F1", [=]() { |
| 166 | patchUtils::openBrowser(manualUrl); |
| 167 | })); |
| 168 | } |
| 169 | |
| 170 | // donate |
| 171 | if (plugin->donateUrl != "") { |
| 172 | menu->addChild(createMenuItem("Donate", "", [=]() { |
| 173 | patchUtils::openBrowser(plugin->donateUrl); |
| 174 | })); |
| 175 | } |
| 176 | |
| 177 | // source code |
| 178 | if (plugin->sourceUrl != "") { |
| 179 | menu->addChild(createMenuItem("Source code", "", [=]() { |
| 180 | patchUtils::openBrowser(plugin->sourceUrl); |
| 181 | })); |
| 182 | } |
no test coverage detected