Commit 64af5c12 authored by Ulf Hermann's avatar Ulf Hermann
Browse files

QmlProfiler: Deduplicate color selection and saturate colors some more



The original timeline colors are hard to see on certain devices. This
makes them stand out more from the background.

Change-Id: Icf6ef8a8ea360b7f47609f8673c4c6e22b091296
Reviewed-by: default avatarKai Koehne <kai.koehne@digia.com>
Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@digia.com>
parent 998bb897
...@@ -101,6 +101,29 @@ signals: ...@@ -101,6 +101,29 @@ signals:
void expandedChanged(); void expandedChanged();
protected: protected:
enum BoxColorProperties {
EventHueMultiplier = 25,
FractionHueMultiplier = 96,
FractionHueMininimum = 10,
Saturation = 150,
Lightness = 166
};
QColor getEventColor(int index) const
{
return getColorByHue(getEventId(index) * EventHueMultiplier);
}
QColor getFractionColor(double fraction) const
{
return getColorByHue(fraction * FractionHueMultiplier + FractionHueMininimum);
}
QColor getColorByHue(int hue) const
{
return QColor::fromHsl(hue % 360, Saturation, Lightness);
}
explicit AbstractTimelineModel(AbstractTimelineModelPrivate *dd, const QString &name, explicit AbstractTimelineModel(AbstractTimelineModelPrivate *dd, const QString &name,
QObject *parent = 0); QObject *parent = 0);
AbstractTimelineModelPrivate *d_ptr; AbstractTimelineModelPrivate *d_ptr;
......
...@@ -179,7 +179,7 @@ QColor PaintEventsModelProxy::getColor(int index) const ...@@ -179,7 +179,7 @@ QColor PaintEventsModelProxy::getColor(int index) const
fpsFraction = 1.0; fpsFraction = 1.0;
if (fpsFraction < 0.0) if (fpsFraction < 0.0)
fpsFraction = 0.0; fpsFraction = 0.0;
return QColor::fromHsl((fpsFraction*96)+10, 76, 166); return getFractionColor(fpsFraction);
} }
float PaintEventsModelProxy::getHeight(int index) const float PaintEventsModelProxy::getHeight(int index) const
......
...@@ -373,8 +373,7 @@ int BasicTimelineModel::getBindingLoopDest(int index) const ...@@ -373,8 +373,7 @@ int BasicTimelineModel::getBindingLoopDest(int index) const
QColor BasicTimelineModel::getColor(int index) const QColor BasicTimelineModel::getColor(int index) const
{ {
int ndx = getEventId(index); return getEventColor(index);
return QColor::fromHsl((ndx*25)%360, 76, 166);
} }
const QVariantList BasicTimelineModel::getLabelsForCategory(int category) const const QVariantList BasicTimelineModel::getLabelsForCategory(int category) const
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment