| 226 | } |
| 227 | |
| 228 | void 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; |
no test coverage detected