<commit_before>/// HEADER
#include "assign_cluster_class_adapter.h"

/// PROJECT
#include <csapex/msg/io.h>
#include <csapex/utility/register_node_adapter.h>
#include <csapex/view/utility/QtCvImageConverter.h>
#include <csapex/utility/color.hpp>
#include <csapex/utility/assert.h>
#include <utils_vision/utils/histogram.hpp>

/// SYSTEM
#include <QPainter>
#include <QGraphicsSceneEvent>
#include <QGraphicsPixmapItem>
#include <QCheckBox>
#include <QPushButton>
#include <QKeyEvent>

using namespace csapex;
using namespace vision_plugins;

CSAPEX_REGISTER_NODE_ADAPTER_NS(vision_plugins, AssignClusterClassAdapter, vision_plugins::AssignClusterClass)

AssignClusterClassAdapter::AssignClusterClassAdapter(NodeWorkerWeakPtr worker, std::weak_ptr<AssignClusterClass> node, WidgetController* widget_ctrl)
    : DefaultNodeAdapter(worker, widget_ctrl),
      wrapped_(node),
      active_class_(0),
      pixmap_overlay_(nullptr),
      pixmap_(nullptr),
      view_(new QGraphicsView),
      empty(32, 32, QImage::Format_RGB16),
      painter(&empty),
      middle_button_down_(false),
      left_button_down_(false),
      loaded_(false)
{
    auto n = wrapped_.lock();

    painter.setPen(QPen(Qt::red));
    painter.fillRect(QRect(0, 0, empty.width(), empty.height()), Qt::white);
    painter.drawRect(QRect(0, 0, empty.width()-1, empty.height()-1));

    // translate to UI thread via Qt signal
    trackConnection(n->display_request.connect(std::bind(&AssignClusterClassAdapter::displayRequest, this,
                                            std::placeholders::_1, std::placeholders::_2)));
    trackConnection(n->set_class.connect(std::bind(&AssignClusterClassAdapter::setClassRequest, this, std::placeholders::_1)));
    trackConnection(n->set_color.connect(std::bind(&AssignClusterClassAdapter::setColorRequest, this,
                                      std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)));
    trackConnection(n->submit_request.connect(std::bind(&AssignClusterClassAdapter::submitRequest, this)));
    trackConnection(n->drop_request.connect(std::bind(&AssignClusterClassAdapter::dropRequest, this)));
    trackConnection(n->clear_request.connect(std::bind(&AssignClusterClassAdapter::clearRequest, this)));
}
<commit_msg>reigstered qt signal<commit_after>/// HEADER
#include "assign_cluster_class_adapter.h"

/// PROJECT
#include <csapex/msg/io.h>
#include <csapex/utility/register_node_adapter.h>
#include <csapex/view/utility/QtCvImageConverter.h>
#include <csapex/utility/color.hpp>
#include <csapex/utility/assert.h>
#include <utils_vision/utils/histogram.hpp>

/// SYSTEM
#include <QPainter>
#include <QGraphicsSceneEvent>
#include <QGraphicsPixmapItem>
#include <QCheckBox>
#include <QPushButton>
#include <QKeyEvent>

using namespace csapex;
using namespace vision_plugins;

CSAPEX_REGISTER_NODE_ADAPTER_NS(vision_plugins, AssignClusterClassAdapter, vision_plugins::AssignClusterClass)

AssignClusterClassAdapter::AssignClusterClassAdapter(NodeWorkerWeakPtr worker, std::weak_ptr<AssignClusterClass> node, WidgetController* widget_ctrl)
    : DefaultNodeAdapter(worker, widget_ctrl),
      wrapped_(node),
      active_class_(0),
      pixmap_overlay_(nullptr),
      pixmap_(nullptr),
      view_(new QGraphicsView),
      empty(32, 32, QImage::Format_RGB16),
      painter(&empty),
      middle_button_down_(false),
      left_button_down_(false),
      loaded_(false)
{
    qRegisterMetaType < cv::Mat > ("cv::Mat");

    auto n = wrapped_.lock();

    painter.setPen(QPen(Qt::red));
    painter.fillRect(QRect(0, 0, empty.width(), empty.height()), Qt::white);
    painter.drawRect(QRect(0, 0, empty.width()-1, empty.height()-1));

    // translate to UI thread via Qt signal
    trackConnection(n->display_request.connect(std::bind(&AssignClusterClassAdapter::displayRequest, this,
                                            std::placeholders::_1, std::placeholders::_2)));
    trackConnection(n->set_class.connect(std::bind(&AssignClusterClassAdapter::setClassRequest, this, std::placeholders::_1)));
    trackConnection(n->set_color.connect(std::bind(&AssignClusterClassAdapter::setColorRequest, this,
                                      std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)));
    trackConnection(n->submit_request.connect(std::bind(&AssignClusterClassAdapter::submitRequest, this)));
    trackConnection(n->drop_request.connect(std::bind(&AssignClusterClassAdapter::dropRequest, this)));
    trackConnection(n->clear_request.connect(std::bind(&AssignClusterClassAdapter::clearRequest, this)));
}

{'fraction_non_alphanumeric': 0.13601741022850924, 'fraction_numerical': 0.008269858541893362, 'mean_word_length': 5.356846473029045, 'pattern_counts': {'":': 0, '<': 30, '<?xml version=': 0, '>': 42, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2493503', 'n_tokens_mistral': 1400, 'n_tokens_neox': 1394, 'n_words': 201}