<commit_before>#include <rai/qt/qt.hpp>

#include <boost/property_tree/json_parser.hpp>

#include <sstream>

namespace
{
void show_line_error (QLineEdit & line)
{
	line.setStyleSheet ("QLineEdit { color: red }");
}
void show_line_ok (QLineEdit & line)
{
	line.setStyleSheet ("QLineEdit { color: black }");
}
void show_label_error (QLabel & label)
{
	label.setStyleSheet ("QLabel { color: red }");
}
void show_label_ok (QLabel & label)
{
	label.setStyleSheet ("QLabel { color: black }");
}
}

bool rai_qt::eventloop_processor::event (QEvent * event_a)
{
	assert(dynamic_cast <rai_qt::eventloop_event *>(event_a) != nullptr);
	static_cast <rai_qt::eventloop_event *> (event_a)->action ();
	return true;
}

rai_qt::eventloop_event::eventloop_event (std::function <void ()> const & action_a) :
QEvent (QEvent::Type::User),
action (action_a)
{
}

rai_qt::self_pane::self_pane (rai_qt::wallet & wallet_a, rai::account const & account_a) :
window (new QWidget),
layout (new QVBoxLayout),
self_layout (new QHBoxLayout),
self_window (new QWidget),
your_account_label (new QLabel ("Your RaiBlocks account:")),
account_window (new QWidget),
account_layout (new QHBoxLayout),
account_text (new QLabel),
copy_button (new QPushButton ("Copy")),
balance_window (new QWidget),
balance_layout (new QHBoxLayout),
balance_label (new QLabel),
ratio_group (new QButtonGroup),
mrai (new QRadioButton ("Mrai")),
krai (new QRadioButton ("krai")),
rai (new QRadioButton ("rai")),
wallet (wallet_a)
{
    ratio_group->addButton (mrai);
    ratio_group->addButton (krai);
    ratio_group->addButton (rai);
    ratio_group->setId (mrai, 0);
    ratio_group->setId (krai, 1);
    ratio_group->setId (rai, 2);

	version = new QLabel (boost::str (boost::format ("Version %1%.%2%.%3%") % RAIBLOCKS_VERSION_MAJOR % RAIBLOCKS_VERSION_MINOR % RAIBLOCKS_VERSION_PATCH).c_str ());
	self_layout->addWidget (your_account_label);
	self_layout->addStretch ();
	self_layout->addWidget (version);
	self_layout->setContentsMargins (0, 0, 0, 0);
	self_window->setLayout (self_layout);

	auto font (QFontDatabase::systemFont (QFontDatabase::FixedFont));
	font.setPointSize (account_text->font().pointSize());
	account_text->setFont (font);
	account_layout->addWidget (account_text);
	account_layout->addWidget (copy_button);
	account_layout->setContentsMargins (0, 0, 0, 0);
	account_window->setLayout (account_layout);
	layout->addWidget (self_window);
	layout->addWidget (account_window);
	balance_layout->addWidget (balance_label);
	balance_layout->addStretch ();
	balance_layout->addWidget (mrai);
	balance_layout->addWidget (krai);
	balance_layout->addWidget (rai);
	balance_layout->setContentsMargins (0, 0, 0, 0);
	balance_window->setLayout (balance_layout);
	layout->addWidget (balance_window);
	layout->setContentsMargins (5, 5, 5, 5);
	window->setLayout (layout);

	QObject::connect (copy_button, &QPushButton::clicked, [this] ()
	{
		this->wallet.application.clipboard ()->setText (QString (this->wallet.account.to_account ().c_str ()));
	});	
    QObject::connect (mrai, &QRadioButton::toggled, [this] ()
    {
        if (mrai->isChecked ())
        {
			this->wallet.change_rendering_ratio (rai::Mrai_ratio);
        }
    });	
    QObject::connect (krai, &QRadioButton::toggled, [this] ()
    {
        if (krai->isChecked ())
        {
			this->wallet.change_rendering_ratio (rai::krai_ratio);
        }
    });	
    QObject::connect (rai, &QRadioButton::toggled, [this] ()
    {
        if (rai->isChecked ())
        {
			this->wallet.change_rendering_ratio (rai::rai_ratio);
        }
    });
	krai->click ();<commit_msg>Switched default unit to Mrai not krai<commit_after>#include <rai/qt/qt.hpp>

#include <boost/property_tree/json_parser.hpp>

#include <sstream>

namespace
{
void show_line_error (QLineEdit & line)
{
	line.setStyleSheet ("QLineEdit { color: red }");
}
void show_line_ok (QLineEdit & line)
{
	line.setStyleSheet ("QLineEdit { color: black }");
}
void show_label_error (QLabel & label)
{
	label.setStyleSheet ("QLabel { color: red }");
}
void show_label_ok (QLabel & label)
{
	label.setStyleSheet ("QLabel { color: black }");
}
}

bool rai_qt::eventloop_processor::event (QEvent * event_a)
{
	assert(dynamic_cast <rai_qt::eventloop_event *>(event_a) != nullptr);
	static_cast <rai_qt::eventloop_event *> (event_a)->action ();
	return true;
}

rai_qt::eventloop_event::eventloop_event (std::function <void ()> const & action_a) :
QEvent (QEvent::Type::User),
action (action_a)
{
}

rai_qt::self_pane::self_pane (rai_qt::wallet & wallet_a, rai::account const & account_a) :
window (new QWidget),
layout (new QVBoxLayout),
self_layout (new QHBoxLayout),
self_window (new QWidget),
your_account_label (new QLabel ("Your RaiBlocks account:")),
account_window (new QWidget),
account_layout (new QHBoxLayout),
account_text (new QLabel),
copy_button (new QPushButton ("Copy")),
balance_window (new QWidget),
balance_layout (new QHBoxLayout),
balance_label (new QLabel),
ratio_group (new QButtonGroup),
mrai (new QRadioButton ("Mrai")),
krai (new QRadioButton ("krai")),
rai (new QRadioButton ("rai")),
wallet (wallet_a)
{
    ratio_group->addButton (mrai);
    ratio_group->addButton (krai);
    ratio_group->addButton (rai);
    ratio_group->setId (mrai, 0);
    ratio_group->setId (krai, 1);
    ratio_group->setId (rai, 2);

	version = new QLabel (boost::str (boost::format ("Version %1%.%2%.%3%") % RAIBLOCKS_VERSION_MAJOR % RAIBLOCKS_VERSION_MINOR % RAIBLOCKS_VERSION_PATCH).c_str ());
	self_layout->addWidget (your_account_label);
	self_layout->addStretch ();
	self_layout->addWidget (version);
	self_layout->setContentsMargins (0, 0, 0, 0);
	self_window->setLayout (self_layout);

	auto font (QFontDatabase::systemFont (QFontDatabase::FixedFont));
	font.setPointSize (account_text->font().pointSize());
	account_text->setFont (font);
	account_layout->addWidget (account_text);
	account_layout->addWidget (copy_button);
	account_layout->setContentsMargins (0, 0, 0, 0);
	account_window->setLayout (account_layout);
	layout->addWidget (self_window);
	layout->addWidget (account_window);
	balance_layout->addWidget (balance_label);
	balance_layout->addStretch ();
	balance_layout->addWidget (mrai);
	balance_layout->addWidget (krai);
	balance_layout->addWidget (rai);
	balance_layout->setContentsMargins (0, 0, 0, 0);
	balance_window->setLayout (balance_layout);
	layout->addWidget (balance_window);
	layout->setContentsMargins (5, 5, 5, 5);
	window->setLayout (layout);

	QObject::connect (copy_button, &QPushButton::clicked, [this] ()
	{
		this->wallet.application.clipboard ()->setText (QString (this->wallet.account.to_account ().c_str ()));
	});	
    QObject::connect (mrai, &QRadioButton::toggled, [this] ()
    {
        if (mrai->isChecked ())
        {
			this->wallet.change_rendering_ratio (rai::Mrai_ratio);
        }
    });	
    QObject::connect (krai, &QRadioButton::toggled, [this] ()
    {
        if (krai->isChecked ())
        {
			this->wallet.change_rendering_ratio (rai::krai_ratio);
        }
    });	
    QObject::connect (rai, &QRadioButton::toggled, [this] ()
    {
        if (rai->isChecked ())
        {
			this->wallet.change_rendering_ratio (rai::rai_ratio);
        }
    });
	mrai->click ();
{'fraction_non_alphanumeric': 0.15610702897546097, 'fraction_numerical': 0.006100097046998475, 'mean_word_length': 5.367166813768756, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 95, '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': '7505851', 'n_tokens_mistral': 2610, 'n_tokens_neox': 2623, 'n_words': 492}