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

Method loadFileSystemVersions

source/ui/controls/optionsView.cpp:239–326  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

237}
238
239void OptionsView::loadFileSystemVersions() {
240 this->wineButtonTotalColumnWidth = 0;
241 this->wineButtonFirstColumnWidth = 0;
242 this->fileSystemVersions.clear();
243 this->fileSystemVersionsSorted.clear();
244
245 for (auto& fileSystem : GlobalSettings::availableFileSystemVersions) {
246 OptionsViewWineVersion v;
247 v.availableVersion = fileSystem;
248 v.name = fileSystem->name;
249
250 U64 size = fileSystem->size;
251 std::shared_ptr<FileSystemZip> dep = fileSystem->getMissingDependency();
252 if (dep) {
253 size += dep->size;
254 }
255 v.size = BString::valueOf(size);
256 this->fileSystemVersions[v.name] = v;
257 }
258
259 for (auto& fileSystem : GlobalSettings::fileSystemVersions) {
260 if (fileSystem->size == 0) {
261 fileSystem->size = (U32)(Fs::getNativeFileSize(fileSystem->filePath) / 1024 / 1024);
262 }
263 if (this->fileSystemVersions.count(fileSystem->name)) {
264 OptionsViewWineVersion& v = this->fileSystemVersions[fileSystem->name];
265 v.currentVersion = fileSystem;
266 } else {
267 OptionsViewWineVersion v;
268 v.availableVersion = fileSystem;
269 v.name = fileSystem->name;
270
271 U64 size = fileSystem->size;
272 std::shared_ptr<FileSystemZip> dep = fileSystem->getMissingDependency();
273 if (dep) {
274 size += dep->size;
275 }
276 v.size = BString::valueOf(size);
277 this->fileSystemVersions[v.name] = v;
278 }
279 }
280 float leftColumn = 0;
281 float rightColumn = 0;
282
283 ImGui::PushFont(GlobalSettings::mediumFont);
284 for (auto& wine : this->fileSystemVersions) {
285 float width = 0.0f;
286 if (wine.second.availableVersion && !wine.second.currentVersion) {
287 width += ImGui::CalcTextSize(c_getTranslation(Msg::OPTIONSVIEW_WINE_VERSION_INSTALL)).x;
288 width += ImGui::GetStyle().FramePadding.x * 2;
289 if (width > leftColumn) {
290 leftColumn = width;
291 }
292 } else if (wine.second.availableVersion && wine.second.currentVersion && wine.second.currentVersion->fsVersion != wine.second.availableVersion->fsVersion) {
293 width += ImGui::CalcTextSize(c_getTranslation(Msg::OPTIONSVIEW_WINE_VERSION_UPDATE)).x;
294 width += ImGui::GetStyle().FramePadding.x * 2;
295 if (width > leftColumn) {
296 leftColumn = width;

Callers 2

runWineOptionsMethod · 0.95
downloadMethod · 0.95

Calls 6

c_getTranslationFunction · 0.85
getMissingDependencyMethod · 0.80
sortFunction · 0.50
clearMethod · 0.45
countMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected