MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / loadApps

Function loadApps

source/ui/mainui.cpp:228–319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

226}
227
228void loadApps() {
229 appListViewItems.clear();
230 for (auto& container : BoxedwineData::getContainers()) {
231 for (auto& app : container->getApps()) {
232 appListViewItems.push_back(ListViewItem(app->getName(), app->getIconTexture(), [app](bool right) {
233 if (right) {
234 runOnMainUI([]() {
235 ImGui::OpenPopup("AppOptionsPopup");
236 return false;
237 });
238
239 runOnMainUI([app]() {
240 ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(GlobalSettings::scaleFloatUI(8.0f), GlobalSettings::scaleFloatUI(8.0f)));
241 ImGui::PushStyleColor(ImGuiCol_PopupBg, ImGui::GetColorU32(ImGuiCol_ScrollbarGrab) | 0xFF000000);
242 bool result = false;
243 if (ImGui::BeginPopup("AppOptionsPopup")) {
244 if (ImGui::Selectable(c_getTranslation(Msg::MAIN_BUTTON_SETTINGS))) {
245 gotoView(VIEW_CONTAINERS, app->getContainer()->getDir(), app->getIniFilePath());
246 }
247 if (ImGui::Selectable(c_getTranslation(Msg::CONTAINER_VIEW_DELETE_SHORTCUT))) {
248 BString label = getTranslationWithFormat(Msg::CONTAINER_VIEW_DELETE_SHORTCUT_CONFIRMATION, true, app->getName());
249 runOnMainUI([label, app]() {
250 new YesNoDlg(Msg::GENERIC_DLG_CONFIRM_TITLE, label, [app](bool yes) {
251 if (yes) {
252 runOnMainUI([app]() {
253 app->remove();
254 GlobalSettings::reloadApps();
255 return false;
256 });
257 }
258 });
259 return false;
260 });
261 }
262#ifdef BOXEDWINE_RECORDER
263 if (GlobalSettings::isAutomationEnabled()) {
264 if (ImGui::Selectable(c_getTranslation(Msg::CONTAINER_VIEW_CREATE_AUTOMATION))) {
265 runOnMainUI([app]() {
266 new WaitDlg(Msg::WAITDLG_LAUNCH_APP_TITLE, getTranslationWithFormat(Msg::WAITDLG_LAUNCH_APP_LABEL, true, app->getName()));
267 app->createAutomation();
268 return false;
269 });
270 }
271 if (ImGui::Selectable(c_getTranslation(Msg::CONTAINER_VIEW_RUN_AUTOMATION), false, app->hasAutomation()? 0 : ImGuiSelectableFlags_Disabled)) {
272 runOnMainUI([app]() {
273 new WaitDlg(Msg::WAITDLG_LAUNCH_APP_TITLE, getTranslationWithFormat(Msg::WAITDLG_LAUNCH_APP_LABEL, true, app->getName()));
274 app->runAutomation();
275 return false;
276 });
277 }
278 }
279#endif
280 ImGui::EndPopup();
281 result = true;
282 }
283 ImGui::PopStyleColor();
284 ImGui::PopStyleVar();
285 return result;

Callers 2

uiShowFunction · 0.85
reloadAppsMethod · 0.85

Calls 15

ListViewItemClass · 0.85
runOnMainUIFunction · 0.85
ImVec2Class · 0.85
c_getTranslationFunction · 0.85
gotoViewFunction · 0.85
getTranslationWithFormatFunction · 0.85
getTranslationFunction · 0.85
BFunction · 0.85
getIconTextureMethod · 0.80
getDirMethod · 0.80
getContainerMethod · 0.80
getIniFilePathMethod · 0.80

Tested by

no test coverage detected