MCPcopy Create free account
hub / github.com/MiniZinc/MiniZincIDE / saveProject

Method saveProject

MiniZincIDE/mainwindow.cpp:2177–2211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2175}
2176
2177void MainWindow::saveProject(const QString& f)
2178{
2179 QString filepath = f;
2180 if (filepath.isEmpty()) {
2181 filepath = QFileDialog::getSaveFileName(this, "Save project", getLastPath(), "MiniZinc projects (*.mzp)");
2182 if (!filepath.isNull()) {
2183 setLastPath(QFileInfo(filepath).absolutePath() + fileDialogSuffix);
2184 }
2185 }
2186 if (filepath.isEmpty()) {
2187 return;
2188 }
2189
2190 auto& p = getProject();
2191 if (p.projectFile() != filepath && IDE::instance()->projects.contains(filepath)) {
2192 QMessageBox::warning(this,"MiniZinc IDE","Cannot overwrite existing open project.",
2193 QMessageBox::Ok);
2194 return;
2195 }
2196
2197 if (p.projectFile() != filepath) {
2198 IDE::instance()->projects.remove(p.projectFile());
2199 IDE::instance()->projects.insert(filepath, this);
2200 p.projectFile(filepath);
2201 }
2202 p.openTabsChanged(getOpenFiles(), ui->tabWidget->currentIndex());
2203 p.activeSolverConfigChanged(getCurrentSolverConfig());
2204 try {
2205 p.saveProject();
2206 } catch (FileError& f) {
2207 QMessageBox::critical(this, "MiniZinc IDE", f.message(), QMessageBox::Ok);
2208 }
2209
2210 updateRecentProjects(p.projectFile());
2211}
2212
2213void MainWindow::loadProject(const QString& filepath)
2214{

Callers

nothing calls this directly

Calls 6

projectFileMethod · 0.80
containsMethod · 0.80
removeMethod · 0.80
openTabsChangedMethod · 0.80
currentIndexMethod · 0.80

Tested by

no test coverage detected