void JBSubdivisionDlg::Confirm() { try { ValidityCheck(); Error err = app::qt::CreateGadget<app::qt::BackgroundExecutor>(BACKGROUND_EXECUTOR) ->Execute(app::qt::BackgroundTask([this](Progress *p) {return Execute(p); })); if (err != ErrNone) { QMessageBox::warning(this, tr("Warning"), err.Description().c_str()); return; } accept(); } catch(std::exception& e) { QMessageBox::information(this, tr("Information"), e.what()); } }
void FileCompressDlg::Execute() { auto z_path = titan::GetModulePath() + std::string("/7z.exe"); if (!Exists(z_path)) { QMessageBox::warning(this, tr("Warning"), tr("Can't find 7z application!")); return; } Error err; if (!ui.contain_mul_check->isChecked()) { err = app::qt::CreateGadget<app::qt::BackgroundExecutor>(BACKGROUND_EXECUTOR) ->Execute(app::qt::BackgroundTask([this](Progress* p) {return CompressSinglePackage(p); })); } else { err = app::qt::CreateGadget<app::qt::BackgroundExecutor>(BACKGROUND_EXECUTOR) ->Execute(app::qt::BackgroundTask([this](Progress* p) {return CompressMultiPackage(p); })); } QMessageBox::information(this, tr("Information"), err.Description().c_str()); }