| 831 | } |
| 832 | |
| 833 | void GlobalSettings::downloadFile(BString url, BString filePath, BString name, U32 sizeMB, std::function<void(bool)> onCompleted) { |
| 834 | runOnMainUI([url, filePath, name, sizeMB, onCompleted]() { |
| 835 | BString parentPath = Fs::getNativeParentPath(filePath); |
| 836 | if (!Fs::doesNativePathExist(parentPath)) { |
| 837 | Fs::makeNativeDirs(parentPath); |
| 838 | } |
| 839 | std::vector<DownloadItem> items; |
| 840 | items.push_back(DownloadItem(getTranslationWithFormat(Msg::DOWNLOADDLG_LABEL, true, name), url, B(""), filePath, ((U64)sizeMB) * 1024 * 1024)); |
| 841 | new DownloadDlg(Msg::DOWNLOADDLG_TITLE, items, [onCompleted](bool success) { |
| 842 | runOnMainUI([success, onCompleted]() { |
| 843 | GlobalSettings::reloadWineVersions(); |
| 844 | if (!GlobalSettings::defaultFont) { |
| 845 | GlobalSettings::restartUI = true; |
| 846 | } |
| 847 | onCompleted(success); |
| 848 | return false; |
| 849 | }); |
| 850 | }); |
| 851 | return false; |
| 852 | }); |
| 853 | } |
| 854 | |
| 855 | void GlobalSettings::downloadFileSystem(const std::shared_ptr<FileSystemZip>& version, std::function<void(bool)> onCompleted) { |
| 856 | runOnMainUI([version, onCompleted]() { |
nothing calls this directly
no test coverage detected