Skip to content

Commit

Permalink
Minor fixes for extends modifiers, matching parentheses colors etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
adeas31 committed Dec 1, 2015
1 parent 2c0784f commit c8c490f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 28 deletions.
45 changes: 24 additions & 21 deletions OMEdit/OMEditGUI/Component/ComponentProperties.cpp
Expand Up @@ -764,27 +764,30 @@ void ComponentParameters::fetchExtendsModifiers()
QMap<QString, QString>::iterator extendsModifiersIterator;
for (extendsModifiersIterator = extendsModifiersMap.begin(); extendsModifiersIterator != extendsModifiersMap.end(); ++extendsModifiersIterator) {
// since first word is component name so we remove it.
QString parameterName = StringHandler::removeFirstWordAfterDot(extendsModifiersIterator.key());
parameterName = StringHandler::getFirstWordBeforeDot(parameterName);
Parameter *pParameter = findParameter(parameterName);
if (pParameter) {
if (extendsModifiersIterator.key().compare(parameterName + ".start") == 0) {
QString start = extendsModifiersIterator.value();
if (!start.isEmpty()) {
pParameter->setGroupBox("Initialization");
pParameter->setShowStartAttribute(true);
pParameter->setValueWidget(start, false);
QString componentName = StringHandler::getFirstWordBeforeDot(extendsModifiersIterator.key());
if (mpComponent->getName().compare(componentName) == 0) {
QString parameterName = StringHandler::removeFirstWordAfterDot(extendsModifiersIterator.key());
parameterName = StringHandler::getFirstWordBeforeDot(parameterName);
Parameter *pParameter = findParameter(parameterName);
if (pParameter) {
if (extendsModifiersIterator.key().compare(parameterName + ".start") == 0) {
QString start = extendsModifiersIterator.value();
if (!start.isEmpty()) {
pParameter->setGroupBox("Initialization");
pParameter->setShowStartAttribute(true);
pParameter->setValueWidget(start, false);
}
}
}
else if (extendsModifiersIterator.key().compare(parameterName + ".fixed") == 0) {
QString fixed = extendsModifiersIterator.value();
if (!fixed.isEmpty()) {
pParameter->setGroupBox("Initialization");
pParameter->setShowStartAttribute(true);
pParameter->setFixedState(fixed, false);
else if (extendsModifiersIterator.key().compare(parameterName + ".fixed") == 0) {
QString fixed = extendsModifiersIterator.value();
if (!fixed.isEmpty()) {
pParameter->setGroupBox("Initialization");
pParameter->setShowStartAttribute(true);
pParameter->setFixedState(fixed, false);
}
} else {
pParameter->setValueWidget(extendsModifiersIterator.value(), false);
}
} else {
pParameter->setValueWidget(extendsModifiersIterator.value(), false);
}
}
}
Expand Down Expand Up @@ -851,7 +854,7 @@ void ComponentParameters::updateComponentParameters()
valueChanged = true;
/* If the component is inherited then add the modifier value into the extends. */
if (mpComponent->isInheritedComponent()) {
newComponentExtendsModifiersMap.insert(componentModifierKey, componentModifierValue);
newComponentExtendsModifiersMap.insert(mpComponent->getName() + "." + componentModifierKey, componentModifierValue);
} else {
newComponentModifiersMap.insert(componentModifierKey, componentModifierValue);
}
Expand All @@ -862,7 +865,7 @@ void ComponentParameters::updateComponentParameters()
componentModifierValue = pParameter->getFixedState();
/* If the component is inherited then add the modifier value into the extends. */
if (mpComponent->isInheritedComponent()) {
newComponentExtendsModifiersMap.insert(componentModifierKey, componentModifierValue);
newComponentExtendsModifiersMap.insert(mpComponent->getName() + "." + componentModifierKey, componentModifierValue);
} else {
newComponentModifiersMap.insert(componentModifierKey, componentModifierValue);
}
Expand Down
5 changes: 3 additions & 2 deletions OMEdit/OMEditGUI/Editors/BaseEditor.cpp
Expand Up @@ -431,8 +431,9 @@ BaseEditor::PlainTextEdit::PlainTextEdit(BaseEditor *pBaseEditor)
// line numbers widget
mpLineNumberArea = new LineNumberArea(mpBaseEditor);
// parentheses matcher
mParenthesesMatchFormat.setBackground(Qt::green);
mParenthesesMisMatchFormat.setBackground(palette().color(QPalette::Base).value() < 128 ? Qt::darkRed : Qt::red);
mParenthesesMatchFormat.setForeground(Qt::red);
mParenthesesMatchFormat.setBackground(QColor(160, 238, 160));
mParenthesesMisMatchFormat.setBackground(Qt::red);

updateLineNumberAreaWidth(0);
updateHighlights();
Expand Down
8 changes: 3 additions & 5 deletions OMEdit/OMEditGUI/Modeling/LibraryTreeWidget.cpp
Expand Up @@ -561,11 +561,9 @@ void LibraryTreeItem::removeInheritedClasses()
disconnect(pLibraryTreeItem, SIGNAL(loaded(LibraryTreeItem*)), this, SLOT(handleLoaded(LibraryTreeItem*)));
disconnect(pLibraryTreeItem, SIGNAL(unLoaded()), this, SLOT(handleUnloaded()));
disconnect(pLibraryTreeItem, SIGNAL(shapeAdded(ShapeAnnotation*,GraphicsView*)),
this, SLOT(handleShapeAdded(ShapeAnnotation*,GraphicsView*)));
disconnect(pLibraryTreeItem, SIGNAL(componentAdded(Component*)),
this, SLOT(handleComponentAdded(Component*)));
disconnect(pLibraryTreeItem, SIGNAL(connectionAdded(LineAnnotation*)),
this, SLOT(handleConnectionAdded(LibraryTreeItem*,LineAnnotation*)));
this, SLOT(handleShapeAdded(ShapeAnnotation*,GraphicsView*)));
disconnect(pLibraryTreeItem, SIGNAL(componentAdded(Component*)), this, SLOT(handleComponentAdded(Component*)));
disconnect(pLibraryTreeItem, SIGNAL(connectionAdded(LineAnnotation*)), this, SLOT(handleConnectionAdded(LineAnnotation*)));
disconnect(pLibraryTreeItem, SIGNAL(iconUpdated()), this, SLOT(handleIconUpdated()));
}
mInheritedClasses.clear();
Expand Down

0 comments on commit c8c490f

Please sign in to comment.