bigsnitch/mainwindow.cpp
2020-08-08 13:44:16 +02:00

45 lines
1.4 KiB
C++

#include "mainwindow.h"
#include "./ui_mainwindow.h"
#include <QtGui>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent),
ui(new Ui::MainWindow)
{
thread = new QThread;
Worker* worker = new Worker();
worker->moveToThread(thread);
//connect(worker, SIGNAL (error(QString)), this, SLOT (errorString(QString)));
connect(thread, SIGNAL (started()), worker, SLOT (process()));
connect(thread, SIGNAL (httpMessage()), worker, SLOT (httpMessage()));
thread->start();
ui->setupUi(this);
ui->historyHTTPTable->setShowGrid(true);
ui->historyHTTPTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
ui->historyHTTPTable->setColumnCount(4);
ui->historyHTTPTable->setRowCount(1);
HTTPData data;
data.index = 1;
data.url = "https://test.com";
data.status = 200;
data.method = "GET";
data.ttl = 44;
ui->historyHTTPTable->setItem(0,0,new QTableWidgetItem(QString::number(data.index)));
ui->historyHTTPTable->setItem(0,1,new QTableWidgetItem(QString::fromStdString(data.method)));
ui->historyHTTPTable->setItem(0,2,new QTableWidgetItem(QString::fromStdString(data.url)));
ui->historyHTTPTable->setItem(0,3,new QTableWidgetItem(QString::number(data.ttl)));
ui->historyHTTPTable->horizontalHeader()->resizeSections(QHeaderView::ResizeToContents);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::httpMessage(HTTPData data) {
qDebug() << data.index;
}