Skip to content

Commit

Permalink
Merge branch 'release/2.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
guidotack committed Dec 14, 2016
2 parents f93349f + 6fe9500 commit d85800d
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 4 deletions.
4 changes: 4 additions & 0 deletions MiniZincIDE/CHANGES
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion MiniZincIDE/MiniZincIDE.pro
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
7 changes: 7 additions & 0 deletions MiniZincIDE/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -2632,6 +2634,7 @@ void MainWindow::saveProject(const QString& f)
}
out << projectFilesRelPath;
out << project.defaultBehaviour();
out << project.mzn2fznPrintStats();
project.setModified(false, true);

} else {
Expand Down Expand Up @@ -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<projectFilesRelPath.size(); i++) {
QFileInfo fi(basePath+projectFilesRelPath[i]);
if (fi.exists()) {
Expand Down
14 changes: 11 additions & 3 deletions MiniZincIDE/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>-181</y>
<width>593</width>
<height>797</height>
<y>-225</y>
<width>595</width>
<height>818</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
Expand Down Expand Up @@ -405,6 +405,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="conf_flatten_stats">
<property name="text">
<string>Statistics for flattening</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="conf_optimize">
<property name="text">
Expand Down Expand Up @@ -554,6 +561,7 @@
<zorder>conf_verbose</zorder>
<zorder>conf_optimize</zorder>
<zorder>autoclear_output</zorder>
<zorder>conf_flatten_stats</zorder>
</widget>
</item>
</layout>
Expand Down
20 changes: 20 additions & 0 deletions MiniZincIDE/project.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -652,6 +668,10 @@ void Project::checkModified()
setModified(true);
return;
}
if (mzn2fznPrintStats() != _mzn2fzn_printStats) {
setModified(true);
return;
}
if (mzn2fznOptimize() != _mzn2fzn_optimize) {
setModified(true);
return;
Expand Down
3 changes: 3 additions & 0 deletions MiniZincIDE/project.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit d85800d

Please sign in to comment.