Skip to content

Commit

Permalink
Merge branch 'release/2.1.7'
Browse files Browse the repository at this point in the history
  • Loading branch information
guidotack committed Jan 10, 2018
2 parents 8a78000 + 28027a9 commit a2867b4
Show file tree
Hide file tree
Showing 12 changed files with 317 additions and 149 deletions.
9 changes: 9 additions & 0 deletions MiniZincIDE/CHANGES
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
2017-05-17
v2.1.7
- Update to MiniZinc 2.1.7.
- Fix problem where files with a . in the filename could not be run (bug #44).
- Fix font settings (were not saved reliably on some platforms).
- Enable generic interface for submitting assignments (not just to Coursera).
- Fix output handling for solvers that do not run mzn2fzn.
- Fix hidden solution display when there are exactly as many solutions as the
configured threshold for hiding solutions (bug #42).
- Add configuration option to print timing information for each solution.
v2.1.6
- Update to MiniZinc 2.1.6.
v2.1.5
Expand Down
8 changes: 4 additions & 4 deletions 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.6
VERSION = 2.1.7
DEFINES += MINIZINC_IDE_VERSION=\\\"$$VERSION\\\"

bundled {
Expand Down Expand Up @@ -60,7 +60,7 @@ SOURCES += main.cpp\
project.cpp \
htmlwindow.cpp \
htmlpage.cpp \
courserasubmission.cpp
moocsubmission.cpp

HEADERS += mainwindow.h \
codeeditor.h \
Expand All @@ -78,7 +78,7 @@ HEADERS += mainwindow.h \
rtfexporter.h \
htmlwindow.h \
htmlpage.h \
courserasubmission.h
moocsubmission.h

FORMS += \
mainwindow.ui \
Expand All @@ -90,7 +90,7 @@ FORMS += \
paramdialog.ui \
checkupdatedialog.ui \
htmlwindow.ui \
courserasubmission.ui
moocsubmission.ui

RESOURCES += \
minizincide.qrc
Expand Down
Binary file added MiniZincIDE/images/application-certificate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 41 additions & 19 deletions MiniZincIDE/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "help.h"
#include "paramdialog.h"
#include "checkupdatedialog.h"
#include "courserasubmission.h"
#include "moocsubmission.h"

#include <QtGlobal>
#ifdef Q_OS_WIN
Expand Down Expand Up @@ -226,7 +226,8 @@ IDE::IDE(int& argc, char* argv[]) : QApplication(argc,argv) {
}
defaultFont.setStyleHint(QFont::TypeWriter);
defaultFont.setPointSize(13);
QFont editorFont = settings.value("editorFont", defaultFont).value<QFont>();
QFont editorFont;
editorFont.fromString(settings.value("editorFont", defaultFont.toString()).value<QString>());
bool darkMode = settings.value("darkMode", false).value<bool>();
settings.endGroup();

Expand Down Expand Up @@ -368,7 +369,7 @@ void IDE::setEditorFont(QFont font)
{
QSettings settings;
settings.beginGroup("MainWindow");
settings.setValue("editorFont", font);
settings.setValue("editorFont", font.toString());
settings.endGroup();
for (QSet<MainWindow*>::iterator it = IDE::instance()->mainWindows.begin();
it != IDE::instance()->mainWindows.end(); ++it) {
Expand Down Expand Up @@ -714,7 +715,7 @@ void MainWindow::init(const QString& projectFile)
tabChange(0);
tb->setTabButton(0, QTabBar::LeftSide, 0);

ui->actionSubmit_to_Coursera->setVisible(false);
ui->actionSubmit_to_MOOC->setVisible(false);

connect(ui->outputConsole, SIGNAL(anchorClicked(QUrl)), this, SLOT(errorClicked(QUrl)));

Expand All @@ -731,7 +732,7 @@ void MainWindow::init(const QString& projectFile)
}
defaultFont.setStyleHint(QFont::TypeWriter);
defaultFont.setPointSize(13);
editorFont = settings.value("editorFont", defaultFont).value<QFont>();
editorFont.fromString(settings.value("editorFont", defaultFont.toString()).value<QString>());
darkMode = settings.value("darkMode", false).value<bool>();
ui->actionDark_mode->setChecked(darkMode);
ui->outputConsole->setFont(editorFont);
Expand Down Expand Up @@ -911,21 +912,21 @@ void MainWindow::updateUiProcessRunning(bool pr)
ui->actionCompile->setEnabled(false);
fakeStopAction->setEnabled(false);
ui->actionStop->setEnabled(true);
ui->actionSubmit_to_Coursera->setEnabled(false);
ui->actionSubmit_to_MOOC->setEnabled(false);
} else {
bool isMzn = false;
bool isFzn = false;
if (curEditor) {
isMzn = QFileInfo(curEditor->filepath).completeSuffix()=="mzn";
isFzn = QFileInfo(curEditor->filepath).completeSuffix()=="fzn";
isMzn = curEditor->filepath=="" || QFileInfo(curEditor->filepath).suffix()=="mzn";
isFzn = QFileInfo(curEditor->filepath).suffix()=="fzn";
}
fakeRunAction->setEnabled(! (isMzn || isFzn));
ui->actionRun->setEnabled(isMzn || isFzn);
fakeCompileAction->setEnabled(!isMzn);
ui->actionCompile->setEnabled(isMzn);
fakeStopAction->setEnabled(true);
ui->actionStop->setEnabled(false);
ui->actionSubmit_to_Coursera->setEnabled(true);
ui->actionSubmit_to_MOOC->setEnabled(true);
}
}

Expand Down Expand Up @@ -1210,7 +1211,7 @@ void MainWindow::closeEvent(QCloseEvent* e) {

QSettings settings;
settings.beginGroup("MainWindow");
settings.setValue("editorFont", editorFont);
settings.setValue("editorFont", editorFont.toString());
settings.setValue("darkMode", darkMode);
settings.setValue("size", size());
settings.setValue("pos", pos());
Expand Down Expand Up @@ -1689,7 +1690,7 @@ void MainWindow::readOutput()
if (solutionCount!=solutionLimit && solutionCount > 1) {
addOutput("<div style='color:blue;'>[ "+QString().number(solutionCount-1)+" more solutions ]</div>");
}
for (int i=hiddenSolutions.size()-2; i<hiddenSolutions.size(); i++) {
for (int i=std::max(0,hiddenSolutions.size()-2); i<hiddenSolutions.size(); i++) {
addOutput(hiddenSolutions[i], false);
}
}
Expand All @@ -1698,6 +1699,8 @@ void MainWindow::readOutput()
}
}
}
// Reset read channel so readyRead() signal is triggered correctly
readProc->setReadChannel(QProcess::StandardOutput);
}

if (process != NULL) {
Expand Down Expand Up @@ -1725,6 +1728,8 @@ void MainWindow::readOutput()
addOutput(l,false);
}
}
// Reset read channel so readyRead() signal is triggered correctly
process->setReadChannel(QProcess::StandardOutput);
}

if (outputProcess != NULL) {
Expand All @@ -1742,6 +1747,8 @@ void MainWindow::readOutput()
}
addOutput(l,false);
}
// Reset read channel so readyRead() signal is triggered correctly
outputProcess->setReadChannel(QProcess::StandardOutput);
}
}

Expand Down Expand Up @@ -2252,6 +2259,9 @@ void MainWindow::runCompiledFzn(int exitcode, QProcess::ExitStatus exitstatus)
process->start(executable,args,getMznDistribPath());
if (runSolns2Out) {
QStringList outargs;
if (project.printTiming()) {
outargs << "--output-time";
}
outargs << currentFznTarget.left(currentFznTarget.length()-4)+".ozn";
outputProcess->start("solns2out",outargs,getMznDistribPath());
}
Expand Down Expand Up @@ -2701,6 +2711,7 @@ void MainWindow::saveProject(const QString& f)
out << project.defaultBehaviour();
out << project.mzn2fznPrintStats();
out << project.n_compress_solutions();
out << project.printTiming();
project.setModified(false, true);

} else {
Expand Down Expand Up @@ -2815,17 +2826,28 @@ void MainWindow::loadProject(const QString& filepath)
in >> p_i;
project.n_compress_solutions(p_i, true);
}
if (version==104 && !in.atEnd()) {
in >> p_b;
project.printTiming(p_b, true);
}
QStringList missingFiles;
for (int i=0; i<projectFilesRelPath.size(); i++) {
QFileInfo fi(basePath+projectFilesRelPath[i]);
if (fi.exists()) {
project.addFile(ui->projectView, projectSort, basePath+projectFilesRelPath[i]);
} else {
QMessageBox::warning(this, "MiniZinc IDE", "Could not find file in project: "+basePath+projectFilesRelPath[i]);
missingFiles.append(basePath+projectFilesRelPath[i]);
}
}
if (!missingFiles.empty()) {
QMessageBox::warning(this, "MiniZinc IDE", "Could not find files in project:\n"+missingFiles.join("\n"));
}

for (int i=0; i<openFiles.size(); i++) {
openFile(basePath+openFiles[i],false);
QFileInfo fi(basePath+openFiles[i]);
if (fi.exists()) {
openFile(basePath+openFiles[i],false);
}
}
setupDznMenu();
project.currentDataFileIndex(dataFileIndex, true);
Expand Down Expand Up @@ -3003,16 +3025,16 @@ void MainWindow::on_conf_data_file_activated(const QString &arg1)
}
}

void MainWindow::on_actionSubmit_to_Coursera_triggered()
void MainWindow::on_actionSubmit_to_MOOC_triggered()
{
courseraSubmission = new CourseraSubmission(this, project.coursera());
connect(courseraSubmission, SIGNAL(finished(int)), this, SLOT(courseraFinished(int)));
moocSubmission = new MOOCSubmission(this, project.moocAssignment());
connect(moocSubmission, SIGNAL(finished(int)), this, SLOT(moocFinished(int)));
setEnabled(false);
courseraSubmission->show();
moocSubmission->show();
}

void MainWindow::courseraFinished(int) {
courseraSubmission->deleteLater();
void MainWindow::moocFinished(int) {
moocSubmission->deleteLater();
setEnabled(true);
}

Expand Down
8 changes: 4 additions & 4 deletions MiniZincIDE/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include "paramdialog.h"
#include "project.h"
#include "htmlwindow.h"
#include "courserasubmission.h"
#include "moocsubmission.h"

namespace Ui {
class MainWindow;
Expand Down Expand Up @@ -260,7 +260,7 @@ private slots:

void on_actionNewData_file_triggered();

void on_actionSubmit_to_Coursera_triggered();
void on_actionSubmit_to_MOOC_triggered();

void fileRenamed(const QString&, const QString&);

Expand All @@ -279,7 +279,7 @@ private slots:

void on_actionDark_mode_toggled(bool arg1);

void courseraFinished(int);
void moocFinished(int);

void on_defaultBehaviourButton_toggled(bool checked);

Expand Down Expand Up @@ -349,7 +349,7 @@ private slots:
QAction* fakeCompileAction;
QAction* minimizeAction;
QTextStream* outputBuffer;
CourseraSubmission* courseraSubmission;
MOOCSubmission* moocSubmission;
bool processRunning;

void createEditor(const QString& path, bool openAsModified, bool isNewFile, bool readOnly=false);
Expand Down
24 changes: 16 additions & 8 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>0</y>
<width>607</width>
<height>878</height>
<y>-306</y>
<width>608</width>
<height>899</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
Expand Down Expand Up @@ -455,7 +455,7 @@
<item>
<widget class="QCheckBox" name="conf_flatten_stats">
<property name="text">
<string>Statistics for flattening</string>
<string>Output statistics for flattening</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -593,10 +593,17 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="conf_solver_timing">
<property name="text">
<string>Output timing information</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="conf_stats">
<property name="text">
<string>Statistics for solving</string>
<string>Output statistics for solving</string>
</property>
</widget>
</item>
Expand All @@ -609,6 +616,7 @@
<zorder>conf_optimize</zorder>
<zorder>autoclear_output</zorder>
<zorder>conf_flatten_stats</zorder>
<zorder>conf_solver_timing</zorder>
</widget>
</item>
</layout>
Expand Down Expand Up @@ -705,7 +713,7 @@
<addaction name="actionRun"/>
<addaction name="actionStop"/>
<addaction name="actionCompile"/>
<addaction name="actionSubmit_to_Coursera"/>
<addaction name="actionSubmit_to_MOOC"/>
<addaction name="separator"/>
<addaction name="actionManage_solvers"/>
<addaction name="separator"/>
Expand Down Expand Up @@ -828,7 +836,7 @@
<addaction name="separator"/>
<addaction name="actionRun"/>
<addaction name="actionStop"/>
<addaction name="actionSubmit_to_Coursera"/>
<addaction name="actionSubmit_to_MOOC"/>
<addaction name="actionShow_project_explorer"/>
</widget>
<widget class="QDockWidget" name="projectExplorerDockWidget">
Expand Down Expand Up @@ -1330,7 +1338,7 @@
<bool>false</bool>
</property>
</action>
<action name="actionSubmit_to_Coursera">
<action name="actionSubmit_to_MOOC">
<property name="icon">
<iconset resource="minizincide.qrc">
<normaloff>:/icons/images/coursera.png</normaloff>:/icons/images/coursera.png</iconset>
Expand Down
1 change: 1 addition & 0 deletions MiniZincIDE/minizincide.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@
<file>images/package-x-generic.png</file>
<file>images/coursera.png</file>
<file>images/[email protected]</file>
<file>images/application-certificate.png</file>
</qresource>
</RCC>
Loading

0 comments on commit a2867b4

Please sign in to comment.