Skip to content

Commit

Permalink
Merge commit '7ac99e4' into pythonplugin
Browse files Browse the repository at this point in the history
  • Loading branch information
dbrnz committed Apr 4, 2018
2 parents c77cf01 + 7ac99e4 commit e010c71
Show file tree
Hide file tree
Showing 32 changed files with 251 additions and 182 deletions.
2 changes: 1 addition & 1 deletion doc/downloads/index.js
Expand Up @@ -18,7 +18,7 @@ var jsonData = { "versions": [
}
]
},
{ "major": 0, "minor": 0, "patch": 0, "day": 23, "month": 12, "year": 2017, "type": 2,
{ "major": 0, "minor": 0, "patch": 0, "day": 12, "month": 1, "year": 2018, "type": 2,
"platforms": [
{ "name": "Windows", "supported": "Windows 7 and later",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion doc/user/whatIsNew.js
@@ -1,5 +1,5 @@
var jsonData = { "versions": [
{ "anchor": "latest", "description": "Latest snapshot", "day": 23, "month": 12, "year": 2017,
{ "anchor": "latest", "description": "Latest snapshot", "day": 12, "month": 1, "year": 2018,
"categories": [
{ "name": "General",
"entries": [
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/miscellaneous/Core/src/centralwidget.cpp
Expand Up @@ -895,9 +895,9 @@ QString CentralWidget::openRemoteFile(const QString &pUrl,

if (createStatus != FileManager::Created) {
#ifdef QT_DEBUG
qFatal("FATAL ERROR | %s:%d: the remote file was not created.", __FILE__, __LINE__);
qFatal("FATAL ERROR | %s:%d: '%s' did not get created.", __FILE__, __LINE__, qPrintable(fileNameOrUrl));
#endif
return tr("FATAL ERROR | %s:%d: the remote file was not created.").arg(__FILE__, __LINE__);
return tr("FATAL ERROR | %s:%d: '%s' did not get created.").arg(__FILE__, __LINE__).arg(fileNameOrUrl);
} else {
return QString("");
}
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/miscellaneous/Core/src/coreplugin.cpp
Expand Up @@ -695,7 +695,7 @@ void CorePlugin::newFile()
// Make sure that the file has indeed been created

if (createStatus != FileManager::Created)
qFatal("FATAL ERROR | %s:%d: the new file was not created.", __FILE__, __LINE__);
qFatal("FATAL ERROR | %s:%d: the new file did not get created.", __FILE__, __LINE__);
#endif
}

Expand Down
110 changes: 101 additions & 9 deletions src/plugins/miscellaneous/Core/src/propertyeditorwidget.cpp
Expand Up @@ -100,17 +100,29 @@ IntegerEditorWidget::IntegerEditorWidget(QWidget *pParent) :
{
// Set a validator that accepts any integer

static const QRegularExpression IntegerRegEx = QRegularExpression("^[+-]?\\d*$");
static const QRegularExpression IntegerRegEx = QRegularExpression("^[+-]?\\d+$");

setValidator(new QRegularExpressionValidator(IntegerRegEx, this));
}

//==============================================================================

IntegerGe0EditorWidget::IntegerGe0EditorWidget(QWidget *pParent) :
TextEditorWidget(pParent)
{
// Set a validator that accepts zero or any strictly positive integer

static const QRegularExpression IntegerGe0RegEx = QRegularExpression("^[+]?\\d+$");

setValidator(new QRegularExpressionValidator(IntegerGe0RegEx, this));
}

//==============================================================================

IntegerGt0EditorWidget::IntegerGt0EditorWidget(QWidget *pParent) :
TextEditorWidget(pParent)
{
// Set a validator that accepts any strictly positif integer
// Set a validator that accepts any strictly positive integer

static const QRegularExpression IntegerGt0RegEx = QRegularExpression("^[+]?[1-9]\\d*$");

Expand All @@ -131,12 +143,24 @@ DoubleEditorWidget::DoubleEditorWidget(QWidget *pParent) :

//==============================================================================

DoubleGe0EditorWidget::DoubleGe0EditorWidget(QWidget *pParent) :
TextEditorWidget(pParent)
{
// Set a validator that accepts zero or any strictly positive double

static const QRegularExpression DoubleGe0RegEx = QRegularExpression("^[+]?(\\d+(\\.\\d*)?|\\.\\d+)([eE][+-]?\\d+)?$");

setValidator(new QRegularExpressionValidator(DoubleGe0RegEx, this));
}

//==============================================================================

DoubleGt0EditorWidget::DoubleGt0EditorWidget(QWidget *pParent) :
TextEditorWidget(pParent)
{
// Set a validator that accepts any strictly positif double
// Set a validator that accepts any strictly positive double

static const QRegularExpression DoubleGt0RegEx = QRegularExpression("^[+]?(([1-9]\\d*)?(\\.\\d*)?|[0]?\\.\\d+)([eE][+-]?\\d+)?$");
static const QRegularExpression DoubleGt0RegEx = QRegularExpression("^[+]?([1-9]\\d*(\\.\\d*)?|[0]?\\.\\d+)([eE][+-]?\\d+)?$");

setValidator(new QRegularExpressionValidator(DoubleGt0RegEx, this));
}
Expand Down Expand Up @@ -325,6 +349,10 @@ QWidget * PropertyItemDelegate::createEditor(QWidget *pParent,
case Property::Integer:
editor = new IntegerEditorWidget(pParent);

break;
case Property::IntegerGe0:
editor = new IntegerGe0EditorWidget(pParent);

break;
case Property::IntegerGt0:
editor = new IntegerGt0EditorWidget(pParent);
Expand All @@ -333,6 +361,10 @@ QWidget * PropertyItemDelegate::createEditor(QWidget *pParent,
case Property::Double:
editor = new DoubleEditorWidget(pParent);

break;
case Property::DoubleGe0:
editor = new DoubleGe0EditorWidget(pParent);

break;
case Property::DoubleGt0:
editor = new DoubleGt0EditorWidget(pParent);
Expand Down Expand Up @@ -781,9 +813,11 @@ QVariant Property::valueAsVariant() const
case Color:
return value();
case Integer:
case IntegerGe0:
case IntegerGt0:
return integerValue();
case Double:
case DoubleGe0:
case DoubleGt0:
return doubleValue();
case Boolean:
Expand All @@ -805,8 +839,10 @@ QString Property::valueAsString() const
case Section:
case String:
case Integer:
case IntegerGe0:
case IntegerGt0:
case Double:
case DoubleGe0:
case DoubleGt0:
case List:
case Color:
Expand Down Expand Up @@ -838,6 +874,8 @@ void Property::setIntegerValue(const int &pIntegerValue,

if (mType == Integer)
setValue(QString::number(pIntegerValue), false, pEmitSignal);
else if (mType == IntegerGe0)
setValue(QString::number((pIntegerValue >= 0)?pIntegerValue:1), false, pEmitSignal);
else if (mType == IntegerGt0)
setValue(QString::number((pIntegerValue > 0)?pIntegerValue:1), false, pEmitSignal);
}
Expand All @@ -862,6 +900,8 @@ void Property::setDoubleValue(const double &pDoubleValue,

if (mType == Double)
setValue(QString::number(pDoubleValue, 'g', 15), false, pEmitSignal);
else if (mType == DoubleGe0)
setValue(QString::number((pDoubleValue >= 0.0)?pDoubleValue:1.0, 'g', 15), false, pEmitSignal);
else if (mType == DoubleGt0)
setValue(QString::number((pDoubleValue > 0.0)?pDoubleValue:1.0, 'g', 15), false, pEmitSignal);
}
Expand Down Expand Up @@ -1552,10 +1592,35 @@ Property * PropertyEditorWidget::addIntegerProperty(Property *pParent)

//==============================================================================

Property * PropertyEditorWidget::addIntegerGe0Property(const int &pValue,
Property *pParent)
{
// Add a zero or strictly positive integer property and return its
// information

Property *res = addProperty(Property::IntegerGe0, pParent);

res->setIntegerValue(pValue);

return res;
}

//==============================================================================

Property * PropertyEditorWidget::addIntegerGe0Property(Property *pParent)
{
// Add a zero or strictly positive integer property and return its
// information

return addIntegerGe0Property(1, pParent);
}

//==============================================================================

Property * PropertyEditorWidget::addIntegerGt0Property(const int &pValue,
Property *pParent)
{
// Add a strictly positif integer property and return its information
// Add a strictly positive integer property and return its information

Property *res = addProperty(Property::IntegerGt0, pParent);

Expand All @@ -1568,7 +1633,7 @@ Property * PropertyEditorWidget::addIntegerGt0Property(const int &pValue,

Property * PropertyEditorWidget::addIntegerGt0Property(Property *pParent)
{
// Add a strictly positif integer property and return its information
// Add a strictly positive integer property and return its information

return addIntegerGt0Property(1, pParent);
}
Expand Down Expand Up @@ -1598,10 +1663,35 @@ Property * PropertyEditorWidget::addDoubleProperty(Property *pParent)

//==============================================================================

Property * PropertyEditorWidget::addDoubleGe0Property(const double &pValue,
Property *pParent)
{
// Add a zero or strictly positive double property and return its
// information

Property *res = addProperty(Property::DoubleGe0, pParent);

res->setDoubleValue(pValue);

return res;
}

//==============================================================================

Property * PropertyEditorWidget::addDoubleGe0Property(Property *pParent)
{
// Add a zero or strictly positive double property and return its
// information

return addDoubleGe0Property(1.0, pParent);
}

//==============================================================================

Property * PropertyEditorWidget::addDoubleGt0Property(const double &pValue,
Property *pParent)
{
// Add a strictly positif double property and return its information
// Add a strictly positive double property and return its information

Property *res = addProperty(Property::DoubleGt0, pParent);

Expand All @@ -1614,9 +1704,9 @@ Property * PropertyEditorWidget::addDoubleGt0Property(const double &pValue,

Property * PropertyEditorWidget::addDoubleGt0Property(Property *pParent)
{
// Add a strictly positif double property and return its information
// Add a strictly positive double property and return its information

return addDoubleProperty(1.0, pParent);
return addDoubleGt0Property(1.0, pParent);
}

//==============================================================================
Expand Down Expand Up @@ -2024,8 +2114,10 @@ void PropertyEditorWidget::editProperty(Property *pProperty,
Property::Type propertyType = mProperty->type();

if ( (propertyType == Property::Integer)
|| (propertyType == Property::IntegerGe0)
|| (propertyType == Property::IntegerGt0)
|| (propertyType == Property::Double)
|| (propertyType == Property::DoubleGe0)
|| (propertyType == Property::DoubleGt0)
|| (propertyType == Property::Color)) {
TextEditorWidget *propertyEditor = static_cast<TextEditorWidget *>(mPropertyEditor);
Expand Down
28 changes: 28 additions & 0 deletions src/plugins/miscellaneous/Core/src/propertyeditorwidget.h
Expand Up @@ -77,6 +77,16 @@ class IntegerEditorWidget : public TextEditorWidget

//==============================================================================

class IntegerGe0EditorWidget : public TextEditorWidget
{
Q_OBJECT

public:
explicit IntegerGe0EditorWidget(QWidget *pParent);
};

//==============================================================================

class IntegerGt0EditorWidget : public TextEditorWidget
{
Q_OBJECT
Expand All @@ -97,6 +107,16 @@ class DoubleEditorWidget : public TextEditorWidget

//==============================================================================

class DoubleGe0EditorWidget : public TextEditorWidget
{
Q_OBJECT

public:
explicit DoubleGe0EditorWidget(QWidget *pParent);
};

//==============================================================================

class DoubleGt0EditorWidget : public TextEditorWidget
{
Q_OBJECT
Expand Down Expand Up @@ -212,8 +232,10 @@ class CORE_EXPORT Property : public QObject
Section,
String,
Integer,
IntegerGe0,
IntegerGt0,
Double,
DoubleGe0,
DoubleGt0,
List,
Boolean,
Expand Down Expand Up @@ -365,12 +387,18 @@ class CORE_EXPORT PropertyEditorWidget : public TreeViewWidget
Property * addIntegerProperty(const int &pValue, Property *pParent = 0);
Property * addIntegerProperty(Property *pParent = 0);

Property * addIntegerGe0Property(const int &pValue, Property *pParent = 0);
Property * addIntegerGe0Property(Property *pParent = 0);

Property * addIntegerGt0Property(const int &pValue, Property *pParent = 0);
Property * addIntegerGt0Property(Property *pParent = 0);

Property * addDoubleProperty(const double &pValue, Property *pParent = 0);
Property * addDoubleProperty(Property *pParent = 0);

Property * addDoubleGe0Property(const double &pValue, Property *pParent = 0);
Property * addDoubleGe0Property(Property *pParent = 0);

Property * addDoubleGt0Property(const double &pValue, Property *pParent = 0);
Property * addDoubleGt0Property(Property *pParent = 0);

Expand Down
Expand Up @@ -38,9 +38,9 @@ SimulationExperimentViewInformationSimulationWidget::SimulationExperimentViewInf
{
// Populate our property editor

mStartingPointProperty = addDoubleProperty(0.0);
mEndingPointProperty = addDoubleProperty(1000.0);
mPointIntervalProperty = addDoubleProperty(1.0);
mStartingPointProperty = addDoubleGe0Property(0.0);
mEndingPointProperty = addDoubleGt0Property(1000.0);
mPointIntervalProperty = addDoubleGt0Property(1.0);
}

//==============================================================================
Expand Down
Expand Up @@ -225,11 +225,31 @@ SimulationExperimentViewInformationSolversWidgetData * SimulationExperimentViewI
property = addIntegerProperty(solverInterfaceProperty.defaultValue().toInt(),
solversProperty);

break;
case Solver::Property::IntegerGe0:
property = addIntegerGe0Property(solverInterfaceProperty.defaultValue().toInt(),
solversProperty);

break;
case Solver::Property::IntegerGt0:
property = addIntegerGt0Property(solverInterfaceProperty.defaultValue().toInt(),
solversProperty);

break;
case Solver::Property::Double:
property = addDoubleProperty(solverInterfaceProperty.defaultValue().toDouble(),
solversProperty);

break;
case Solver::Property::DoubleGe0:
property = addDoubleGe0Property(solverInterfaceProperty.defaultValue().toDouble(),
solversProperty);

break;
case Solver::Property::DoubleGt0:
property = addDoubleGt0Property(solverInterfaceProperty.defaultValue().toDouble(),
solversProperty);

break;
case Solver::Property::List:
property = addListProperty(solverInterfaceProperty.listValues(),
Expand Down

0 comments on commit e010c71

Please sign in to comment.