forked from osmocom/wireshark
Qt: Fix our Expert Info foreground color logic.
Set the foreground color of an expert info item only when we set its background color, otherwise we show black text on a dark background. Remove an unneeded include while we're here. Change-Id: Ibb835d26d7aa18bfb406b7820b321dc372aed599 Ping-Bug: 15511 Reviewed-on: https://code.wireshark.org/review/32534 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
0b69783eb6
commit
e7dc592406
|
@ -9,7 +9,6 @@
|
|||
*/
|
||||
|
||||
#include "expert_info_model.h"
|
||||
#include <ui/qt/utils/color_utils.h>
|
||||
|
||||
#include "file.h"
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ QVariant ExpertInfoProxyModel::data(const QModelIndex &proxy_index, int role) co
|
|||
{
|
||||
source_index = mapToSource(proxy_index);
|
||||
|
||||
//only color base row
|
||||
// only color base row
|
||||
if (!source_index.isValid() || source_index.parent().isValid())
|
||||
return QVariant();
|
||||
|
||||
|
@ -117,8 +117,28 @@ QVariant ExpertInfoProxyModel::data(const QModelIndex &proxy_index, int role) co
|
|||
}
|
||||
break;
|
||||
case Qt::ForegroundRole:
|
||||
// XXX Use plain colors until our users demand to be blinded.
|
||||
return QBrush(ColorUtils::expert_color_foreground);
|
||||
{
|
||||
source_index = mapToSource(proxy_index);
|
||||
|
||||
// only color base row
|
||||
if (!source_index.isValid() || source_index.parent().isValid())
|
||||
return QVariant();
|
||||
|
||||
ExpertPacketItem* item = static_cast<ExpertPacketItem*>(source_index.internalPointer());
|
||||
if (item == NULL)
|
||||
return QVariant();
|
||||
|
||||
// provide foreground color for groups
|
||||
switch(item->severity()) {
|
||||
case(PI_COMMENT):
|
||||
case(PI_CHAT):
|
||||
case(PI_NOTE):
|
||||
case(PI_WARN):
|
||||
case(PI_ERROR):
|
||||
return QBrush(ColorUtils::expert_color_foreground);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Qt::TextAlignmentRole:
|
||||
switch (proxy_index.column())
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue