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

Method runWineOptions

source/ui/controls/optionsView.cpp:328–426  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

326}
327
328void OptionsView::runWineOptions() {
329 ImGui::PushFont(GlobalSettings::largeFont);
330 ImGui::Dummy(ImVec2(0.0f, this->extraVerticalSpacing));
331 SAFE_IMGUI_TEXT(this->wineTitle);
332 ImGui::PopFont();
333
334 ImVec2 size = ImGui::GetWindowContentRegionMax();
335 size.y -= ImGui::GetCursorPosY() + GlobalSettings::scaleFloatUI(8.0f);
336
337 ImGui::PushFont(GlobalSettings::mediumFont);
338 //ImGui::BeginChildFrame(401, size);
339 ImGui::Dummy(ImVec2(0.0f, this->extraVerticalSpacing));
340 for (auto& wine : this->fileSystemVersionsSorted) {
341 ImGui::Dummy(ImVec2(this->extraVerticalSpacing, 0.0f));
342 ImGui::SameLine();
343 ImVec2 pos = ImGui::GetCursorPos();
344 pos.y += this->extraVerticalSpacing;
345 ImGui::SetCursorPos(pos);
346 if (wine.availableVersion && !wine.currentVersion) {
347 BString buttonLabel = getTranslation(Msg::OPTIONSVIEW_WINE_VERSION_INSTALL);
348 buttonLabel += "##";
349 buttonLabel += wine.name;
350 if (ImGui::Button(buttonLabel.c_str())) {
351 download(wine.availableVersion);
352 }
353 ImGui::SameLine();
354 } else if (wine.availableVersion && wine.currentVersion && wine.currentVersion->fsVersion!=wine.availableVersion->fsVersion){
355 BString buttonLabel = getTranslation(Msg::OPTIONSVIEW_WINE_VERSION_UPDATE);
356 buttonLabel += "##";
357 buttonLabel += wine.name;
358 if (ImGui::Button(buttonLabel.c_str())) {
359 download(wine.availableVersion);
360 }
361 ImGui::SameLine();
362 }
363 if (wine.currentVersion) {
364 ImGui::SameLine(pos.x + this->wineButtonFirstColumnWidth);
365 bool buttonPressed = false;
366 BString buttonLabel = getTranslation(Msg::OPTIONSVIEW_WINE_VERSION_DELETE);
367 buttonLabel += "##";
368 buttonLabel += wine.name;
369 if (ImGui::Button(buttonLabel.c_str())) {
370 buttonPressed = true;
371 }
372 bool yes = false;
373 BString label = getTranslationWithFormat(Msg::OPTIONSVIEW_WINE_VERSION_DELETE_CONFIRM_LABEL, true, wine.name);
374 if (!showYesNoMessageBox("confirm"+wine.name, buttonPressed, c_getTranslation(Msg::GENERIC_DLG_CONFIRM_TITLE), label.c_str(), &yes)) {
375 if (yes) {
376 Fs::deleteNativeFile(wine.currentVersion->filePath);
377 // run later, we don't want to change versions while we are iterating them
378 runOnMainUI([this]()->bool {
379 GlobalSettings::reloadWineVersions();
380 this->loadFileSystemVersions();
381 return false;
382 });
383 }
384 }
385 ImGui::SameLine();

Callers 1

OptionsViewMethod · 0.95

Calls 8

ImVec2Class · 0.85
getTranslationFunction · 0.85
getTranslationWithFormatFunction · 0.85
showYesNoMessageBoxFunction · 0.85
c_getTranslationFunction · 0.85
runOnMainUIFunction · 0.85
c_strMethod · 0.45

Tested by

no test coverage detected