<commit_before>#include "mainwindow.h"
#include "ui_mainwindow.h"

#include "embeddedapp.h"

#include <server/server.h>
#include <Cutelyst/Context>
#include <Cutelyst/Response>

#include <QMessageBox>

#include <QNetworkReply>
#include <QNetworkAccessManager>

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
    , m_server(new Cutelyst::Server{this})
    , m_app(new EmbeddedApp{m_server})
    , m_nam(new QNetworkAccessManager{this})
    , m_serverReceivedHeaders(new QStandardItemModel{this})
    , m_clientReceivedHeaders(new QStandardItemModel{this})
{
    ui->setupUi(this);
    ui->serverReceivedHeaders->setModel(m_serverReceivedHeaders);
    ui->clientReceivedHeaders->setModel(m_clientReceivedHeaders);

    connect(ui->serverPortSB, &QSpinBox::valueChanged, this, [=] {
        updateUrl();
    });
    connect(ui->clientSendPB, &QPushButton::clicked, this, &MainWindow::clientSend);
    connect(ui->serverListenPB, &QPushButton::clicked, this, &MainWindow::listenClicked);
    connect(ui->serverStopListenPB, &QPushButton::clicked, this, [=] {
        ui->serverStopListenPB->setEnabled(false);
        m_server->stop();
    });

    connect(m_server, &Cutelyst::Server::ready, this, [=] {
        ui->serverStopListenPB->setEnabled(true);
    });
    connect(m_server, &Cutelyst::Server::stopped, this, [=] {
        ui->serverListenPB->setEnabled(true);
    });
    connect(m_server, &Cutelyst::Server::errorOccured, this, [=] (const QString &message) {
        ui->serverListenPB->setEnabled(true);
        ui->serverStopListenPB->setEnabled(false);
        QMessageBox::critical(this, tr("Failed to start server"), message);
    });

    connect(m_app, &EmbeddedApp::indexCalled, this, &MainWindow::indexCalled);
    updateUrl();
}

MainWindow::~MainWindow()
{<commit_msg>Fix example Qt5 overload<commit_after>#include "mainwindow.h"
#include "ui_mainwindow.h"

#include "embeddedapp.h"

#include <server/server.h>
#include <Cutelyst/Context>
#include <Cutelyst/Response>

#include <QMessageBox>

#include <QNetworkReply>
#include <QNetworkAccessManager>

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
    , m_server(new Cutelyst::Server{this})
    , m_app(new EmbeddedApp{m_server})
    , m_nam(new QNetworkAccessManager{this})
    , m_serverReceivedHeaders(new QStandardItemModel{this})
    , m_clientReceivedHeaders(new QStandardItemModel{this})
{
    ui->setupUi(this);
    ui->serverReceivedHeaders->setModel(m_serverReceivedHeaders);
    ui->clientReceivedHeaders->setModel(m_clientReceivedHeaders);

    connect(ui->serverPortSB, QOverload<int>::of(&QSpinBox::valueChanged), this, &MainWindow::updateUrl);
    connect(ui->clientSendPB, &QPushButton::clicked, this, &MainWindow::clientSend);
    connect(ui->serverListenPB, &QPushButton::clicked, this, &MainWindow::listenClicked);
    connect(ui->serverStopListenPB, &QPushButton::clicked, this, [=] {
        ui->serverStopListenPB->setEnabled(false);
        m_server->stop();
    });

    connect(m_server, &Cutelyst::Server::ready, this, [=] {
        ui->serverStopListenPB->setEnabled(true);
    });
    connect(m_server, &Cutelyst::Server::stopped, this, [=] {
        ui->serverListenPB->setEnabled(true);
    });
    connect(m_server, &Cutelyst::Server::errorOccured, this, [=] (const QString &message) {
        ui->serverListenPB->setEnabled(true);
        ui->serverStopListenPB->setEnabled(false);
        QMessageBox::critical(this, tr("Failed to start server"), message);
    });

    connect(m_app, &EmbeddedApp::indexCalled, this, &MainWindow::indexCalled);
    updateUrl();
}

MainWindow::~MainWindow()
{
{'fraction_non_alphanumeric': 0.1541587645624492, 'fraction_numerical': 0.000270929287455974, 'mean_word_length': 5.247038917089679, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 56, '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': '1774731', 'n_tokens_mistral': 1212, 'n_tokens_neox': 1202, 'n_words': 165}