From 4d9740fe7cb38cacec9f7b1acc92f693fbfde75a Mon Sep 17 00:00:00 2001 From: JackLee_CN <809262979@qq.com> Date: Tue, 5 Nov 2024 11:27:35 +0800 Subject: [PATCH] =?UTF-8?q?1-=E6=9B=B4=E6=96=B0=E6=97=A5=E5=BF=97=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.cpp | 2 +- src/xsteam_update_ui.cpp | 27 ++++++++++----------------- src/xsteam_update_ui.h | 1 + src/xsteam_view.cpp | 36 ++++++++++++++++++++---------------- 4 files changed, 32 insertions(+), 34 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 40cdd90..9fc3e2e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -21,8 +21,8 @@ int main(int argc, char *argv[]) //仅限于windows平台 #if defined(__WIN32__) x.title()->set_type(QD_TYPE::QD_EXIT); - x.title()->set_font_style(); #endif + x.title()->set_font_style(); x.show(); return a.exec(); } diff --git a/src/xsteam_update_ui.cpp b/src/xsteam_update_ui.cpp index b7a7ee2..2c8e7a0 100644 --- a/src/xsteam_update_ui.cpp +++ b/src/xsteam_update_ui.cpp @@ -8,6 +8,7 @@ xsteam_update_ui::xsteam_update_ui() copyright_tips_txt=new QLabel(tr("Copyright © 2024 JackLee_CN. All rights reserved.")); info = new QTextEdit(); info->setReadOnly(true); + info->toMarkdown(QTextDocument::MarkdownDialectGitHub); m_Layout->addWidget(info); f_Layout->addItem(sparcer_item); f_Layout->addWidget(copyright_tips_txt); @@ -25,21 +26,13 @@ xsteam_update_ui::~xsteam_update_ui() } void xsteam_update_ui::load_about() { - QFile file(tr(":/res/txt/about.txt")); - if(file.open(QIODevice::ReadOnly | QIODevice::Text)) - { - QString strs; - while(!file.atEnd()) - { - QByteArray line = file.readLine(); - strs.append(QString::fromStdString(line.data())); - } - strs.append(QString::fromStdString("编译环境")+"\n"); - strs.append("qt_version:"+QString::fromStdString(QT_VERSION_STR)+"\n"); - strs.append("gcc_version:"+QString::fromStdString(GCC_GXX_VERSION_STR)+"\n"); - strs.append("g++_version:"+QString::fromStdString(GCC_GXX_VERSION_STR)+"\n"); - strs.append("libcurl_version:"+QString::fromStdString(LIBCURL_VERSION_STR)+"\n"); - strs.append("libgit2_version:"+QString::fromStdString(LIBGIT2_VERSION_STR)+"\n"); - info->setPlainText(strs); - } + QFuture future = QtConcurrent::run([=]() + { + xsteam_curl* _curl=new xsteam_curl(); + auto log=_curl->get_steam_id_info("https://git.axibug.com/JackLee/XSteam/raw/branch/vcpkg/update.log",NULL); + if(log.size()>0) + { + info->setText(QString::fromStdString(log)); + } + }); } \ No newline at end of file diff --git a/src/xsteam_update_ui.h b/src/xsteam_update_ui.h index 8e59839..5af120c 100644 --- a/src/xsteam_update_ui.h +++ b/src/xsteam_update_ui.h @@ -9,6 +9,7 @@ #include #include #include +#include "xsteam_curl.h" #include "sui.h" class xsteam_update_ui :public sui{ Q_OBJECT diff --git a/src/xsteam_view.cpp b/src/xsteam_view.cpp index 5b8bdfa..d717df3 100644 --- a/src/xsteam_view.cpp +++ b/src/xsteam_view.cpp @@ -13,22 +13,26 @@ void xsteam_view::item_clear() void xsteam_view::init_view(VIEW_MODE view_mode) { m_model = new QStandardItemModel(); - if (view_mode == VIEW_MODE::UID_INFO) + auto view = [=](VIEW_MODE view_mode) { - m_model->setColumnCount(ex_uid_table_head_tips.count()); - m_model->setHorizontalHeaderLabels(ex_uid_table_head_tips); - setItemDelegate(new xsteam_view_item()); - } - else if (view_mode == VIEW_MODE::ALL_DLC_INFO) - { - m_model->setColumnCount(ex_all_dlc_table_head_tips.count()); - m_model->setHorizontalHeaderLabels(ex_all_dlc_table_head_tips); - } - else if (view_mode == VIEW_MODE::IN_DLC_INFO) - { - m_model->setColumnCount(ex_in_dlc_table_head_tips.count()); - m_model->setHorizontalHeaderLabels(ex_in_dlc_table_head_tips); - } + if (view_mode == VIEW_MODE::UID_INFO) + { + m_model->setColumnCount(ex_uid_table_head_tips.count()); + m_model->setHorizontalHeaderLabels(ex_uid_table_head_tips); + setItemDelegate(new xsteam_view_item()); + } + else if (view_mode == VIEW_MODE::ALL_DLC_INFO) + { + m_model->setColumnCount(ex_all_dlc_table_head_tips.count()); + m_model->setHorizontalHeaderLabels(ex_all_dlc_table_head_tips); + } + else if (view_mode == VIEW_MODE::IN_DLC_INFO) + { + m_model->setColumnCount(ex_in_dlc_table_head_tips.count()); + m_model->setHorizontalHeaderLabels(ex_in_dlc_table_head_tips); + } + }; + view(view_mode); setSelectionMode(QAbstractItemView::SingleSelection); horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); setSelectionBehavior(QAbstractItemView::SelectRows); @@ -39,7 +43,7 @@ void xsteam_view::init_view(VIEW_MODE view_mode) setModel(m_model); } -void xsteam_view::item_append(UidData& data, VIEW_MODE mode) +void xsteam_view::item_append(UidData &data, VIEW_MODE mode) { QList d_rows; std::vector dlc_uid;