batch set cases use problem case's export file's folder as the default folder

This commit is contained in:
Roy Qu 2022-04-16 20:43:58 +08:00
parent f6ac7ad1dc
commit 390c403503
1 changed files with 5 additions and 2 deletions

View File

@ -3264,17 +3264,20 @@ void MainWindow::onProblemRunCurrentCase()
void MainWindow::onProblemBatchSetCases()
{
if (QMessageBox::question(this,tr("Batch Set Cases"),
if (mOJProblemModel.count()>0 && QMessageBox::question(this,tr("Batch Set Cases"),
tr("This operation will remove all cases for the current problem.")
+"<br />"
+tr("Do you really want to do that?"),
QMessageBox::Yes| QMessageBox::No,
QMessageBox::No)!=QMessageBox::Yes)
return;
QString folder = QDir::currentPath();
if (!mOJProblemSetModel.exportFilename().isEmpty())
folder = extractFileDir(mOJProblemSetModel.exportFilename());
QStringList files = QFileDialog::getOpenFileNames(
this,
tr("Choose input files"),
QDir::currentPath(),
folder,
tr("Input data files (*.in)"));
if (files.isEmpty())
return;