#include "widget.h"
#include "./ui_widget.h"

#include <QNetworkReply>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QTimer>
#include <QNetworkProxy>

#include "spdlog/spdlog.h"


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

    m_thread = new QThread();
    m_oneThread = new OneThread(m_thread);
    m_thread->start();


    SPDLOG_INFO("***** Qt Library *****");
}

Widget::~Widget()
{

    delete ui;
}

void Widget::print2(const QString& str, const char* str2, const char* str3, const char* str4, const char* str5)
{
    SPDLOG_INFO("{} {} {} {} {}", str.toStdString(), str2, str3, str4, str5);
}

void print(const QString& str, const char* str2, const char* str3, const char* str4, const char* str5)
{
    SPDLOG_INFO("{}", str.toStdString());
    SPDLOG_INFO("{}", str2);
    SPDLOG_INFO("{}", str3);
    SPDLOG_INFO("{}", str4);
    SPDLOG_INFO("{}", str5);
}


void Widget::on_pBtn_connect_clicked()
{
    SPDLOG_INFO("点击了“连接按钮”");
    qDebug() << "main Thread ID: " << QThread::currentThreadId();
    m_oneThread->addTaskRunOne(&Widget::print2, this, "Hello ", "World ", "this ", "is ", "Qt");
}

void Widget::on_pBtn_downloadFile_clicked()
{
    SPDLOG_INFO("点击了“下载文件”");
    
    
}

