Skip to content

Commit

Permalink
Merge branch 'release/2.2.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
guidotack committed Sep 5, 2018
2 parents 409c488 + b9723d7 commit c960e7c
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 15 deletions.
16 changes: 16 additions & 0 deletions MiniZincIDE/CHANGES
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
2017-05-17
v2.2.1
- Improve dark mode by changing line numbers to dark background.
- Make parameter input dialog scrollable.
- Fix solution compression limit, and output one solution per
block of compressed solutions.
v2.2.0
- Update to MiniZinc 2.2.0.
- Change solver configuration interface to work with new MiniZinc 2.2.0
solver configurations.
- Add support for solution checker models.
- Better process management (to make sure solvers are terminated).
- Change project files to be based on JSON format.
- Better support for solver HTML output (used e.g. for Globalizer and FindMUS).
- Fix shift left/shift right functionality.
- Support for running models without saving them first.
- Fix file dialogs to use correct file extensions.
v2.1.7
- Update to MiniZinc 2.1.7.
- Fix problem where files with a . in the filename could not be run (bug #44).
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.2.0
VERSION = 2.2.1
DEFINES += MINIZINC_IDE_VERSION=\\\"$$VERSION\\\"

bundled {
Expand Down
19 changes: 16 additions & 3 deletions MiniZincIDE/codeeditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,19 @@ int CodeEditor::matchRight(QTextBlock block, QChar b, int i, int nRight)

void CodeEditor::paintLineNumbers(QPaintEvent *event)
{
QColor backgroundColor;
QColor foregroundActiveColor;
QColor foregroundInactiveColor;
if (darkMode) {
backgroundColor = QColor(0x26, 0x26, 0x26);
foregroundActiveColor = Qt::white;
foregroundInactiveColor = Qt::darkGray;
} else {
backgroundColor = QColor(Qt::lightGray).lighter(120);
foregroundActiveColor = Qt::black;
foregroundInactiveColor = Qt::gray;
}

QPainter painter(lineNumbers);
QFont lineNoFont = font();
QFontMetrics fm(lineNoFont);
Expand All @@ -331,7 +344,7 @@ void CodeEditor::paintLineNumbers(QPaintEvent *event)
QFontMetrics fm2(lineNoFont);
int heightDiff = (origFontHeight-fm2.height());
painter.setFont(lineNoFont);
painter.fillRect(event->rect(), QColor(Qt::lightGray).lighter(120));
painter.fillRect(event->rect(), backgroundColor);

QTextBlock block = firstVisibleBlock();
int blockNumber = block.blockNumber();
Expand All @@ -344,9 +357,9 @@ void CodeEditor::paintLineNumbers(QPaintEvent *event)
if (block.isVisible() && bottom >= event->rect().top()) {
QString number = QString::number(blockNumber + 1);
if (blockNumber == curLine)
painter.setPen(Qt::black);
painter.setPen(foregroundActiveColor);
else
painter.setPen(Qt::gray);
painter.setPen(foregroundInactiveColor);
int textTop = top+fontMetrics().leading()+heightDiff;
painter.drawText(0, textTop, lineNumbers->width(), fm2.height(),
Qt::AlignRight, number);
Expand Down
9 changes: 6 additions & 3 deletions MiniZincIDE/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1693,7 +1693,7 @@ void MainWindow::compileOrRun()
}
isOptimisation = true;
solutionCount = 0;
solutionLimit = ui->defaultBehaviourButton->isChecked() ? 100 : ui->conf_compressSolutionLimit->value();
solutionLimit = ui->conf_compressSolutionLimit->value();
hiddenSolutions.clear();
inJSONHandler = false;
curJSONHandler = 0;
Expand Down Expand Up @@ -1841,7 +1841,10 @@ void MainWindow::readOutput()
hiddenSolutions.back() += l;
}
if (solutionLimit != 0 && solutionCount == solutionLimit) {
addOutput("<div style='color:blue;'>[ "+QString().number(solutionLimit)+" more solutions ]</div>");
addOutput("<div style='color:blue;'>[ "+QString().number(solutionLimit-1)+" more solutions ]</div>");
for (int i=std::max(0,hiddenSolutions.size()-2); i<hiddenSolutions.size(); i++) {
addOutput(hiddenSolutions[i], false);
}
solutionCount = 0;
solutionLimit *= 2;
}
Expand Down Expand Up @@ -2025,7 +2028,7 @@ void MainWindow::compileAndRun(const QString& modelPath, const QString& addition
}

solutionCount = 0;
solutionLimit = ui->defaultBehaviourButton->isChecked() ? 100 : ui->conf_compressSolutionLimit->value();
solutionLimit = ui->conf_compressSolutionLimit->value();
hiddenSolutions.clear();
inJSONHandler = false;
curJSONHandler = 0;
Expand Down
18 changes: 10 additions & 8 deletions MiniZincIDE/paramdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <QComboBox>
#include <QFileInfo>
#include <QDebug>
#include <QScrollArea>

ParamDialog::ParamDialog(QWidget *parent) :
QDialog(parent),
Expand All @@ -37,12 +38,18 @@ void ParamDialog::getParams(QStringList params, const QStringList& dataFiles, QS

QWidget* manual = new QWidget;
manual->setLayout(formLayout);

tw->addTab(manual, "Enter parameters");
bool fillPrevious = previousParams == params;
for (int i=0; i<params.size(); i++) {
QLineEdit* e = new QLineEdit(fillPrevious ? previousValues[i] : "");
le.append(e);
formLayout->addRow(new QLabel(params[i]+" ="), le.back());
}
QScrollArea* scrollArea = new QScrollArea;
scrollArea->setWidget(manual);
tw->addTab(scrollArea, "Enter parameters");

selectedFiles = NULL;

bool fillPrevious = previousParams == params;
if (dataFiles.size() > 0) {
selectedFiles = new QListWidget(this);
selectedFiles->setSelectionMode(QAbstractItemView::ExtendedSelection);
Expand All @@ -57,11 +64,6 @@ void ParamDialog::getParams(QStringList params, const QStringList& dataFiles, QS
if (!fillPrevious || !previousWasManual)
tw->setCurrentIndex(1);
}
for (int i=0; i<params.size(); i++) {
QLineEdit* e = new QLineEdit(fillPrevious ? previousValues[i] : "");
le.append(e);
formLayout->addRow(new QLabel(params[i]+" ="), le.back());
}
mainLayout->addRow(tw);
ui->frame->setLayout(mainLayout);
if (selectedFiles==NULL || selectedFiles->selectedItems().size()==0)
Expand Down

0 comments on commit c960e7c

Please sign in to comment.