diff --git a/MiniZincIDE/CHANGES b/MiniZincIDE/CHANGES index bccff1c..ae857a5 100644 --- a/MiniZincIDE/CHANGES +++ b/MiniZincIDE/CHANGES @@ -1,3 +1,7 @@ +2016-12-14 + v2.1.1 + - Add option to print mzn2fzn statistics to project configuration. + - Update to MiniZinc 2.1.1. 2016-11-16 v2.1.0 - Add new bundled solvers: Chuffed, CBC, Gurobi diff --git a/MiniZincIDE/MiniZincIDE.pro b/MiniZincIDE/MiniZincIDE.pro index 5a4380d..e4fae1e 100644 --- a/MiniZincIDE/MiniZincIDE.pro +++ b/MiniZincIDE/MiniZincIDE.pro @@ -19,7 +19,7 @@ greaterThan(QT_MAJOR_VERSION, 4): { TARGET = MiniZincIDE TEMPLATE = app -VERSION = 2.1.0 +VERSION = 2.1.1 DEFINES += MINIZINC_IDE_VERSION=\\\"$$VERSION\\\" bundled { diff --git a/MiniZincIDE/mainwindow.cpp b/MiniZincIDE/mainwindow.cpp index e210468..7db69d0 100755 --- a/MiniZincIDE/mainwindow.cpp +++ b/MiniZincIDE/mainwindow.cpp @@ -1361,6 +1361,8 @@ QStringList MainWindow::parseConf(bool compileOnly, bool useDataFile) ret << "--no-optimize"; if (compileOnly && project.mzn2fznVerbose()) ret << "-v"; + if (compileOnly && project.mzn2fznPrintStats()) + ret << "-s"; if (compileOnly && project.haveExtraArgs() && !project.extraArgs().isEmpty()) ret << "-D" << project.extraArgs(); @@ -2632,6 +2634,7 @@ void MainWindow::saveProject(const QString& f) } out << projectFilesRelPath; out << project.defaultBehaviour(); + out << project.mzn2fznPrintStats(); project.setModified(false, true); } else { @@ -2738,6 +2741,10 @@ void MainWindow::loadProject(const QString& filepath) } else { project.defaultBehaviour(project.n_solutions() == 1 && !project.printAll()); } + if (version==104 && !in.atEnd()) { + in >> p_b; + project.mzn2fznPrintStats(p_b, true); + } for (int i=0; i 0 - -181 - 593 - 797 + -225 + 595 + 818 @@ -405,6 +405,13 @@ + + + + Statistics for flattening + + + @@ -554,6 +561,7 @@ conf_verbose conf_optimize autoclear_output + conf_flatten_stats diff --git a/MiniZincIDE/project.cpp b/MiniZincIDE/project.cpp index 3cd45a5..29dda6a 100644 --- a/MiniZincIDE/project.cpp +++ b/MiniZincIDE/project.cpp @@ -303,6 +303,7 @@ void Project::setModified(bool flag, bool files) haveExtraArgs(haveExtraArgs(),true); extraArgs(extraArgs(),true); mzn2fznVerbose(mzn2fznVerbose(),true); + mzn2fznPrintStats(mzn2fznPrintStats(),true); mzn2fznOptimize(mzn2fznOptimize(),true); currentSolver(currentSolver(),true); n_solutions(n_solutions(),true); @@ -363,6 +364,11 @@ bool Project::mzn2fznVerbose(void) const { return ui->conf_verbose->isChecked(); } + +bool Project::mzn2fznPrintStats() const +{ + return ui->conf_flatten_stats->isChecked(); +} bool Project::mzn2fznOptimize(void) const { return ui->conf_optimize->isChecked(); @@ -492,6 +498,16 @@ void Project::mzn2fznVerbose(bool b, bool init) } } +void Project::mzn2fznPrintStats(bool b, bool init) +{ + if (init) { + _mzn2fzn_printStats = b; + ui->conf_flatten_stats->setChecked(b); + } else { + checkModified(); + } +} + void Project::mzn2fznOptimize(bool b, bool init) { if (init) { @@ -652,6 +668,10 @@ void Project::checkModified() setModified(true); return; } + if (mzn2fznPrintStats() != _mzn2fzn_printStats) { + setModified(true); + return; + } if (mzn2fznOptimize() != _mzn2fzn_optimize) { setModified(true); return; diff --git a/MiniZincIDE/project.h b/MiniZincIDE/project.h index 12b5af7..690a2fb 100644 --- a/MiniZincIDE/project.h +++ b/MiniZincIDE/project.h @@ -71,6 +71,7 @@ class Project : public QStandardItemModel QString extraMzn2FznArgs(void) const; bool autoClearOutput(void) const; bool mzn2fznVerbose(void) const; + bool mzn2fznPrintStats(void) const; bool mzn2fznOptimize(void) const; QString currentSolver(void) const; int n_solutions(void) const; @@ -94,6 +95,7 @@ public slots: void extraMzn2FznArgs(const QString& a, bool init=false); void autoClearOutput(bool b, bool init=false); void mzn2fznVerbose(bool b, bool init=false); + void mzn2fznPrintStats(bool b, bool init=false); void mzn2fznOptimize(bool b, bool init=false); void currentSolver(const QString& s, bool init=false); void n_solutions(int n, bool init=false); @@ -128,6 +130,7 @@ public slots: QString _extraMzn2FznArgs; bool _autoclear_output; bool _mzn2fzn_verbose; + bool _mzn2fzn_printStats; bool _mzn2fzn_optimize; QString _currentSolver; int _n_solutions;