<commit_before>#include "pickwidget.h"
#include "ui_pickwidget.h"
using namespace Vipster;

PickWidget::PickWidget(QWidget *parent) :
    BaseWidget(parent),
    ui(new Ui::PickWidget)
{
    ui->setupUi(this);
}

PickWidget::~PickWidget()
{
    delete ui;
}

inline void printDist(QPlainTextEdit& text,
                      size_t idx1, size_t idx2, float dist)
{
    QString tmp = "Dist " +
            QString::number(idx1) + '-' +
            QString::number(idx2) + ": " +
            QString::number(static_cast<double>(dist)) + "Å";
    text.appendPlainText(tmp);
}

inline void printAngle(QPlainTextEdit& text,
                       size_t idx1, size_t idx2, size_t idx3, float ang)
{
    QString tmp = "Angle " +
            QString::number(idx1) + '-' +
            QString::number(idx2) + '-' +
            QString::number(idx3) + ": " +
            QString::number(static_cast<double>(ang)) + "°";
    text.appendPlainText(tmp);
}

inline void printDihed(QPlainTextEdit& text,
                       size_t idx1, size_t idx2, size_t idx3, size_t idx4, float dihed)
{
    QString tmp = "Dihed " +
            QString::number(idx1) + '-' +
            QString::number(idx2) + '-' +
            QString::number(idx3) + '-' +
            QString::number(idx4) + ": " +
            QString::number(static_cast<double>(dihed)) + "°";
    text.appendPlainText(tmp);
}

void PickWidget::updateWidget(guiChange_t change)
{
    if((change & (GuiChange::atoms|GuiChange::selection)) == 0u){
        return;
    }
    auto curSel = master->curSel->asFmt(AtomFmt::Angstrom);
    auto& text = *ui->PickText;
    auto idx = curSel.getIndices().begin();
    text.setPlainText("Atoms:");
    for(const auto& i:curSel){
        text.appendPlainText(QString::number(*idx)+'('+QString::fromStdString(i.name)+')');
        idx++;
    }
    auto nat = curSel.getNat();
    if(nat>4){
        //Don't display additional information when too many atoms are selected
        return;
    }
    /*
     *  |-----|------|-----|-------|
     *  | Nat | Dist | Ang | Dihed |
     *  |-----|------|-----|-------|
     *  | 2   | 1    | -   | -     |
     *  |-----|------|-----|-------|
     *  | 3   | 3    | 3   | -     |
     *  |-----|------|-----|-------|<commit_msg>const-ness error<commit_after>#include "pickwidget.h"
#include "ui_pickwidget.h"
using namespace Vipster;

PickWidget::PickWidget(QWidget *parent) :
    BaseWidget(parent),
    ui(new Ui::PickWidget)
{
    ui->setupUi(this);
}

PickWidget::~PickWidget()
{
    delete ui;
}

inline void printDist(QPlainTextEdit& text,
                      size_t idx1, size_t idx2, float dist)
{
    QString tmp = "Dist " +
            QString::number(idx1) + '-' +
            QString::number(idx2) + ": " +
            QString::number(static_cast<double>(dist)) + "Å";
    text.appendPlainText(tmp);
}

inline void printAngle(QPlainTextEdit& text,
                       size_t idx1, size_t idx2, size_t idx3, float ang)
{
    QString tmp = "Angle " +
            QString::number(idx1) + '-' +
            QString::number(idx2) + '-' +
            QString::number(idx3) + ": " +
            QString::number(static_cast<double>(ang)) + "°";
    text.appendPlainText(tmp);
}

inline void printDihed(QPlainTextEdit& text,
                       size_t idx1, size_t idx2, size_t idx3, size_t idx4, float dihed)
{
    QString tmp = "Dihed " +
            QString::number(idx1) + '-' +
            QString::number(idx2) + '-' +
            QString::number(idx3) + '-' +
            QString::number(idx4) + ": " +
            QString::number(static_cast<double>(dihed)) + "°";
    text.appendPlainText(tmp);
}

void PickWidget::updateWidget(guiChange_t change)
{
    if((change & (GuiChange::atoms|GuiChange::selection)) == 0u){
        return;
    }
    const auto curSel = master->curSel->asFmt(AtomFmt::Angstrom);
    auto& text = *ui->PickText;
    auto idx = curSel.getIndices().begin();
    text.setPlainText("Atoms:");
    for(const auto& i:curSel){
        text.appendPlainText(QString::number(*idx)+'('+QString::fromStdString(i.name)+')');
        idx++;
    }
    auto nat = curSel.getNat();
    if(nat>4){
        //Don't display additional information when too many atoms are selected
        return;
    }
    /*
     *  |-----|------|-----|-------|
     *  | Nat | Dist | Ang | Dihed |
     *  |-----|------|-----|-------|
     *  | 2   | 1    | -   | -     |
     *  |-----|------|-----|-------|
     *  | 3   | 3    | 3   | -     |
     *  |-----|------|-----|-------|
{'fraction_non_alphanumeric': 0.19858313039628073, 'fraction_numerical': 0.011069293779056896, 'mean_word_length': 2.020053475935829, 'pattern_counts': {'":': 6, '<': 9, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4205489', 'n_tokens_mistral': 1567, 'n_tokens_neox': 1553, 'n_words': 252}