<commit_before>#include "edit_activity_field_dialog.h"
#include "ui_edit_activity_field_dialog.h"

EditActivityFieldDialog::EditActivityFieldDialog(Activity* activity, QString fieldName, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::EditActivityFieldDialog)
{
    ui->setupUi(this);

    m_activity = activity;
    m_fieldName = fieldName;

    Q_ASSERT(m_activity);
//    Q_ASSERT(m_activity->id > 0);
    Q_ASSERT(m_activity->info);

    // @TODO: make sure field really exists.

    this->setupUi();
}

QVariant EditActivityFieldDialog::newValue() const {
    return ui->propertyLineEdit->text();
}

void EditActivityFieldDialog::setupUi() {
    ui->fieldNameLabel->setText(QStringLiteral("Edit <b>") + m_fieldName + QStringLiteral("</b>"));
}

EditActivityFieldDialog::~EditActivityFieldDialog()
{
    delete ui;
}<commit_msg>Show current field value in activity field editor<commit_after>#include "edit_activity_field_dialog.h"
#include "ui_edit_activity_field_dialog.h"

EditActivityFieldDialog::EditActivityFieldDialog(Activity* activity, QString fieldName, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::EditActivityFieldDialog)
{
    ui->setupUi(this);

    m_activity = activity;
    m_fieldName = fieldName;

    Q_ASSERT(m_activity);
//    Q_ASSERT(m_activity->id > 0);
    Q_ASSERT(m_activity->info);

    // @TODO: make sure field really exists.

    this->setupUi();
}

QVariant EditActivityFieldDialog::newValue() const {
    return ui->propertyLineEdit->text();
}

void EditActivityFieldDialog::setupUi()
{
    ui->fieldNameLabel->setText(QStringLiteral("Edit <b>") + m_fieldName +
                                QStringLiteral("</b> field of \"") + m_activity->displayString() + QStringLiteral("\"."));
    int i = m_activity->info->fieldNames.indexOf(m_fieldName);
    Q_ASSERT(i != -1);
    Q_ASSERT(m_activity->info->fieldNames.count() == m_activity->fieldValues.count());

    ui->propertyLineEdit->setText(m_activity->fieldValues[i]);
}

EditActivityFieldDialog::~EditActivityFieldDialog()
{
    delete ui;
}
{'fraction_non_alphanumeric': 0.1386041971693509, 'fraction_numerical': 0.0014641288433382138, 'mean_word_length': 4.742296918767507, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 34, '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': '2971536', 'n_tokens_mistral': 648, 'n_tokens_neox': 639, 'n_words': 105}