<commit_before>/*
* Copyright (C) 2008-2012 <NAME> <<EMAIL>>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*/

#include "sessiontreeitem.h"

SessionTreeItem::SessionTreeItem(QTreeWidget* parent) : QTreeWidgetItem(parent)
{
    d.alerted = false;
    d.inactive = true;
    d.highlighted = false;
}

QVariant SessionTreeItem::data(int column, int role) const
{
    if (role == Qt::ForegroundRole)
    {
        if (d.inactive)
            return treeWidget()->palette().color(QPalette::Disabled, QPalette::Highlight);
        if (d.alerted)
            return QColor(Qt::red); // TODO: treeWidget()->palette().color(QPalette::Highlight);
        if (d.highlighted)
            return treeWidget()->palette().color(QPalette::Highlight);
        return treeWidget()->palette().color(QPalette::WindowText);
    }
    return QTreeWidgetItem::data(column, role);
}

void SessionTreeItem::setAlerted(bool alerted)
{
    d.alerted = alerted;
    emitDataChanged();
}

void SessionTreeItem::setInactive(bool inactive)
{
    d.inactive = inactive;
    emitDataChanged();
}

void SessionTreeItem::setHighlighted(bool highlighted)
{
    d.highlighted = highlighted;
    emitDataChanged();
}<commit_msg>SessionTreeItem: use ItemStatus colors<commit_after>/*
* Copyright (C) 2008-2012 <NAME> <<EMAIL>>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*/

#include "sessiontreeitem.h"
#include "treewidget.h"

SessionTreeItem::SessionTreeItem(QTreeWidget* parent) : QTreeWidgetItem(parent)
{
    d.alerted = false;
    d.inactive = true;
    d.highlighted = false;
}

QVariant SessionTreeItem::data(int column, int role) const
{
    if (role == Qt::ForegroundRole)
    {
        TreeWidget* tw = static_cast<TreeWidget*>(treeWidget());
        if (d.inactive)
            return tw->statusColor(TreeWidget::Inactive);
        if (d.alerted)
            return tw->statusColor(TreeWidget::Alert);
        if (d.highlighted)
            return tw->statusColor(TreeWidget::Highlight);
        return tw->statusColor(TreeWidget::Active);
    }
    return QTreeWidgetItem::data(column, role);
}

void SessionTreeItem::setAlerted(bool alerted)
{
    d.alerted = alerted;
    emitDataChanged();
}

void SessionTreeItem::setInactive(bool inactive)
{
    d.inactive = inactive;
    emitDataChanged();
}

void SessionTreeItem::setHighlighted(bool highlighted)
{
    d.highlighted = highlighted;
    emitDataChanged();
}
{'fraction_non_alphanumeric': 0.10830544569516276, 'fraction_numerical': 0.005476118040766657, 'mean_word_length': 3.929535232383808, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7143683', 'n_tokens_mistral': 976, 'n_tokens_neox': 938, 'n_words': 291}