<commit_before>#include "feedbackdialog.h"
#include "ui_feedbackdialog.h"

#include <QFileDialog>
#include <QFileInfo>

#include "toggl_api.h"

FeedbackDialog::FeedbackDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::FeedbackDialog)
{
    ui->setupUi(this);

    ui->topic->addItem("Bug report");
    ui->topic->addItem("Feature request");
    ui->topic->addItem("Other");
    ui->topic->setCurrentIndex(0);
}

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

void FeedbackDialog::on_uploadImageButton_clicked()
{
    path = QFileDialog::getOpenFileName(this, "Select an image to upload");
    QFileInfo info(path);
    ui->selectedImageFilename->setText(info.fileName());
}

void FeedbackDialog::on_sendButton_clicked()
{
    QString content = ui->content->toPlainText();
    if (content.isEmpty())
    {
        ui->content->setFocus();
        return;
    }
    if (!TogglApi::instance->sendFeedback(ui->topic->currentText(),
                                         ui->content->toPlainText(),
                                         path))
    {
        return;
    }
    ui->topic->setCurrentIndex(0);
    ui->content->clear();
    ui->selectedImageFilename->setText("");
    path = "";
    hide();
}<commit_msg>Tell user that feedback was sent<commit_after>#include "feedbackdialog.h"
#include "ui_feedbackdialog.h"

#include <QFileDialog>
#include <QFileInfo>
#include <QMessageBox>

#include "toggl_api.h"

FeedbackDialog::FeedbackDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::FeedbackDialog)
{
    ui->setupUi(this);

    ui->topic->addItem("Bug report");
    ui->topic->addItem("Feature request");
    ui->topic->addItem("Other");
    ui->topic->setCurrentIndex(0);
}

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

void FeedbackDialog::on_uploadImageButton_clicked()
{
    path = QFileDialog::getOpenFileName(this, "Select an image to upload");
    QFileInfo info(path);
    ui->selectedImageFilename->setText(info.fileName());
}

void FeedbackDialog::on_sendButton_clicked()
{
    QString content = ui->content->toPlainText();
    if (content.isEmpty())
    {
        ui->content->setFocus();
        return;
    }
    if (!TogglApi::instance->sendFeedback(ui->topic->currentText(),
                                         ui->content->toPlainText(),
                                         path))
    {
        return;
    }
    ui->topic->setCurrentIndex(0);
    ui->content->clear();
    ui->selectedImageFilename->setText("");
    path = "";
    hide();

    QMessageBox(QMessageBox::Information,
                "Thank you!",
                "Your feedback was sent successfully.",
                QMessageBox::Ok).exec();
}
{'fraction_non_alphanumeric': 0.154132539091586, 'fraction_numerical': 0.0014892032762472078, 'mean_word_length': 2.9055232558139537, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 60, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1205792', 'n_tokens_mistral': 826, 'n_tokens_neox': 816, 'n_words': 128}