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

Method openCompiledFzn

MiniZincIDE/mainwindow.cpp:1517–1554  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1515}
1516
1517void MainWindow::openCompiledFzn(const QString& fzn)
1518{
1519 QFile file(fzn);
1520 int fsize = file.size() / (1024 * 1024);
1521 if (fsize > 10) {
1522 QMessageBox::StandardButton sb =
1523 QMessageBox::warning(this, "MiniZinc IDE",
1524 QString("Compilation resulted in a large FlatZinc file (")+
1525 QString().setNum(fsize)+" MB). Opening "
1526 "the file may slow down the IDE and potentially "
1527 "affect its stability. Do you want to open it anyway, save it, or discard the file?",
1528 QMessageBox::Open | QMessageBox::Discard | QMessageBox::Save);
1529 switch (sb) {
1530 case QMessageBox::Save:
1531 {
1532 bool success = true;
1533 do {
1534 QString savepath = QFileDialog::getSaveFileName(this,"Save FlatZinc",getLastPath(),"FlatZinc files (*.fzn)");
1535 if (!savepath.isNull() && !savepath.isEmpty()) {
1536 QFile oldfile(savepath);
1537 if (oldfile.exists()) {
1538 if (!oldfile.remove()) {
1539 success = false;
1540 }
1541 }
1542 file.copy(savepath);
1543 }
1544 } while (!success);
1545 return;
1546 }
1547 case QMessageBox::Discard:
1548 return;
1549 default:
1550 break;
1551 }
1552 }
1553 createEditor(fzn, !fzn.endsWith(".mzc"), !fzn.endsWith(".mzc"), false);
1554}
1555
1556void MainWindow::profileCompiledFzn(const QVector<TimingEntry>& timing, const QVector<PathEntry>& paths)
1557{

Callers

nothing calls this directly

Calls 3

removeMethod · 0.80
copyMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected