ui: new colors and other ui improvements

* smoothing for edge lines
* fixed activation of token not working when multiple tokens active
* changed inheritance arrow
* thicker width for edges on focus
This commit is contained in:
Eberhard Graether
2015-05-24 14:47:52 +02:00
parent bd5de1d271
commit 23da81136f
9 changed files with 57 additions and 95 deletions
+11 -20
View File
@@ -191,21 +191,17 @@ void QtCodeArea::paintEvent(QPaintEvent* event)
int top = blockBoundingGeometry(block).translated(contentOffset()).top();
int blockHeight = blockBoundingRect(block).height();
Colori color = ApplicationSettings::getInstance()->getCodeScopeColor();
Colori colorFocused = ApplicationSettings::getInstance()->getCodeActiveLinkColor();
colorFocused.a /= 2;
QColor qColor;
for (const ScopeAnnotation& scope : m_scopeAnnotations)
{
if (scope.isFocused)
{
qColor.setRgb(colorFocused.r, colorFocused.g, colorFocused.b, colorFocused.a);
qColor = QColor("#90E4EEF2");
}
else
{
qColor.setRgb(color.r, color.g, color.b, color.a);
qColor = QColor("#60E4EEF2");
}
painter.fillRect(
@@ -245,13 +241,7 @@ void QtCodeArea::mouseReleaseEvent(QMouseEvent* event)
if (annotation)
{
const std::vector<Id>& ids = m_fileWidget->getActiveTokenIds();
bool isActive = std::find(ids.begin(), ids.end(), annotation->tokenId) != ids.end();
if (!isActive)
{
MessageActivateTokenLocation(annotation->locationId).dispatch();
}
MessageActivateTokenLocation(annotation->locationId).dispatch();
}
}
}
@@ -409,14 +399,15 @@ void QtCodeArea::createAnnotations(std::shared_ptr<TokenLocationFile> locationFi
void QtCodeArea::annotateText()
{
Colori color;
Id focusedTokenId = m_fileWidget->getFocusedTokenId();
const std::vector<Id>& ids = m_fileWidget->getActiveTokenIds();
const std::vector<std::string>& errorMessages = m_fileWidget->getErrorMessages();
QList<QTextEdit::ExtraSelection> extraSelections;
std::vector<ScopeAnnotation> scopeAnnotations;
QColor color;
QList<QTextEdit::ExtraSelection> extraSelections;
for (const Annotation& annotation: m_annotations)
{
bool isActive = std::find(ids.begin(), ids.end(), annotation.tokenId) != ids.end();
@@ -424,23 +415,23 @@ void QtCodeArea::annotateText()
if (&annotation == m_hoveredAnnotation && errorMessages.size())
{
color = Colori(255, 0, 0, 128);
color.setNamedColor("#80FF0000");
}
else if (errorMessages.size())
{
color = Colori(255, 0, 0, 255);
color.setNamedColor("#FFFF0000");
}
else if (isActive || isFocused)
{
color = ApplicationSettings::getInstance()->getCodeActiveLinkColor();
color.setNamedColor("#90B6D1DD");
}
else
{
color = ApplicationSettings::getInstance()->getCodeLinkColor();
color.setNamedColor("#90EBEBEB");
}
QTextEdit::ExtraSelection selection;
selection.format.setBackground(QColor(color.r, color.g, color.b, color.a));
selection.format.setBackground(color);
ScopeAnnotation scopeAnnotation;
+4 -4
View File
@@ -31,11 +31,11 @@ QtHighlighter::QtHighlighter(QTextDocument *parent)
QColor directiveColor = QColor(27,136,86);
QColor keywordColor = QColor(27,136,86);
QColor typeColor = QColor(208,93,24);
QColor typeColor = QColor("#C1492D");
QColor commentColor = Qt::gray;
QColor numberColor = QColor(153,22,165);
QColor quotationColor = QColor(63,169,245);
QColor functionColor = QColor(172,150,0);
QColor numberColor = QColor("#C1315E");
QColor quotationColor = QColor("#865F9E");
QColor functionColor = QColor("#CC9533");
foreach (const QString &pattern, keywordPatterns)
{
+1
View File
@@ -56,6 +56,7 @@ void QtGraphView::initView()
QGraphicsView* view = new QGraphicsView(widget);
view->setScene(scene);
view->setDragMode(QGraphicsView::ScrollHandDrag);
view->setRenderHints(QPainter::Antialiasing);
widget->layout()->addWidget(view);
}
@@ -110,7 +110,7 @@ void QtGraphEdge::onClick()
message.isAggregation = true;
message.dispatch();
}
else if (!m_isActive)
else
{
MessageActivateTokens message(getData()->getId());
message.isEdge = true;
@@ -35,7 +35,7 @@ Id QtGraphNodeData::getTokenId() const
void QtGraphNodeData::onClick()
{
if (!m_isActive && !m_data->isType(Node::NODE_UNDEFINED | Node::NODE_NAMESPACE))
if (!m_data->isType(Node::NODE_UNDEFINED | Node::NODE_NAMESPACE))
{
MessageActivateTokens(m_data->getId()).dispatch();
}