Some fixes

This commit is contained in:
Cacodemon345
2025-08-10 00:48:43 +06:00
parent d279a6e36d
commit e2248fdad7

View File

@@ -211,7 +211,7 @@ illegal_chars:
if (dialog.exec() > 0) { if (dialog.exec() > 0) {
std::atomic_bool finished{false}; std::atomic_bool finished{false};
std::atomic_int errCode; std::atomic_bool errCode;
auto vmDir = QDir(vmm_path).canonicalPath(); auto vmDir = QDir(vmm_path).canonicalPath();
vmDir.append("/"); vmDir.append("/");
vmDir.append(edit->text()); vmDir.append(edit->text());
@@ -233,6 +233,7 @@ illegal_chars:
progDialog->setAutoReset(false); progDialog->setAutoReset(false);
progDialog->setAttribute(Qt::WA_DeleteOnClose, true); progDialog->setAttribute(Qt::WA_DeleteOnClose, true);
progDialog->setValue(0); progDialog->setValue(0);
progDialog->setWindowTitle(tr("Clone"));
progDialog->show(); progDialog->show();
QString srcPath = selected_sysconfig->config_dir; QString srcPath = selected_sysconfig->config_dir;
QString dstPath = vmDir; QString dstPath = vmDir;
@@ -246,9 +247,9 @@ illegal_chars:
} }
copyThread.join(); copyThread.join();
progDialog->close(); progDialog->close();
if (errCode) { if (!errCode) {
QDir(dstPath).removeRecursively(); QDir(dstPath).removeRecursively();
QMessageBox::critical(this, tr("Clone"), tr("Failed to clone VM: %1").arg(errCode), QMessageBox::Ok); QMessageBox::critical(this, tr("Clone"), tr("Failed to clone VM."), QMessageBox::Ok);
return; return;
} }
@@ -269,7 +270,7 @@ illegal_chars:
ui->listView->setCurrentIndex(mapped_index); ui->listView->setCurrentIndex(mapped_index);
} else { } else {
QDir(dstPath).removeRecursively(); QDir(dstPath).removeRecursively();
QMessageBox::critical(this, tr("Clone"), tr("Failed to clone VM for an unknown reason."), QMessageBox::Ok); QMessageBox::critical(this, tr("Clone"), tr("Failed to clone VM."), QMessageBox::Ok);
return; return;
} }
} }