MCPcopy Create free account
hub / github.com/VCVRack/Rack / appendContextMenu

Method appendContextMenu

src/plugin/Model.cpp:107–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105
106
107void 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

Callers 2

createContextMenuMethod · 0.45
createContextMenuMethod · 0.45

Calls 10

createMenuItemFunction · 0.85
translateFunction · 0.85
openBrowserFunction · 0.85
createMenuLabelFunction · 0.85
startsWithFunction · 0.85
getTagFunction · 0.85
getKeyCommandNameFunction · 0.85
openDirectoryFunction · 0.85
addChildMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected