| 455 | } |
| 456 | |
| 457 | void MainWindow::openFile(const QString &path, bool openAsModified, bool focus) |
| 458 | { |
| 459 | QStringList fileNames; |
| 460 | if (path.isEmpty()) { |
| 461 | fileNames = QFileDialog::getOpenFileNames(this, tr("Open File"), getLastPath(), "MiniZinc Files (*.mzn *.dzn *.fzn *.json *.mzp *.mzc *.mpc);;Other (*)"); |
| 462 | if (!fileNames.isEmpty()) { |
| 463 | setLastPath(QFileInfo(fileNames.last()).absolutePath() + fileDialogSuffix); |
| 464 | } |
| 465 | } else { |
| 466 | fileNames << path; |
| 467 | } |
| 468 | |
| 469 | for (auto& fileName : fileNames) { |
| 470 | if (fileName.endsWith(".mzp")) { |
| 471 | openProject(fileName); |
| 472 | } else if (fileName.endsWith(".mpc")) { |
| 473 | QString absPath = QFileInfo(fileName).canonicalFilePath(); |
| 474 | if (ui->config_window->addConfig(absPath)) { |
| 475 | getProject().add(absPath); |
| 476 | ui->configWindow_dockWidget->setVisible(true); |
| 477 | } |
| 478 | } else { |
| 479 | createEditor(fileName, openAsModified, false, false, focus); |
| 480 | } |
| 481 | } |
| 482 | |
| 483 | } |
| 484 | |
| 485 | void MainWindow::tabCloseRequest(int tab) |
| 486 | { |