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

Method downloadOpenGL

source/ui/data/globalSettings.cpp:797–831  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

795}
796
797void GlobalSettings::downloadOpenGL(std::function<void(bool)> onCompleted) {
798 runOnMainUI([onCompleted]() {
799 BString size = BString::valueOf(GlobalSettings::alternativeOpenGlDownloadSizeMB());
800 new YesNoDlg(Msg::DOWNLOAD_OPENGL_TITLE, getTranslationWithFormat(Msg::DOWNLOAD_OPENGL, true, size), [onCompleted](bool yes) {
801 if (yes) {
802 BString url = GlobalSettings::alternativeOpenGlUrl();
803 BString fileName = Fs::getFileNameFromPath(url);
804 BString zipPath = GlobalSettings::getAlternativeOpenGlFolder().stringByApppendingPath(fileName);
805 U32 sizeMB = GlobalSettings::alternativeOpenGlDownloadSizeMB();
806
807 GlobalSettings::downloadFile(url, zipPath, fileName, sizeMB, [onCompleted, zipPath, fileName](bool sucess) {
808 if (!sucess) {
809 onCompleted(false);
810 } else {
811 BString destDir = GlobalSettings::getAlternativeOpenGlFolder();
812 runOnMainUI([onCompleted, fileName, zipPath, destDir]() {
813 new UnzipDlg(Msg::UNZIP_DLG_TITLE, fileName, zipPath, destDir, [onCompleted, zipPath](bool success) {
814 if (!success) {
815 onCompleted(false);
816 } else {
817 Fs::deleteNativeFile(zipPath);
818 onCompleted(true);
819 }
820 });
821 return false;
822 });
823 }
824 });
825 } else {
826 onCompleted(false);
827 }
828 });
829 return false;
830 });
831}
832
833void GlobalSettings::downloadFile(BString url, BString filePath, BString name, U32 sizeMB, std::function<void(bool)> onCompleted) {
834 runOnMainUI([url, filePath, name, sizeMB, onCompleted]() {

Callers

nothing calls this directly

Calls 4

runOnMainUIFunction · 0.85
getTranslationWithFormatFunction · 0.85
downloadFileFunction · 0.85

Tested by

no test coverage detected