1-更新日志功能

This commit is contained in:
JackLee_CN 2024-11-05 11:27:35 +08:00
parent dfd46be74e
commit 4d9740fe7c
4 changed files with 32 additions and 34 deletions

View File

@ -21,8 +21,8 @@ int main(int argc, char *argv[])
//仅限于windows平台 //仅限于windows平台
#if defined(__WIN32__) #if defined(__WIN32__)
x.title()->set_type(QD_TYPE::QD_EXIT); x.title()->set_type(QD_TYPE::QD_EXIT);
x.title()->set_font_style();
#endif #endif
x.title()->set_font_style();
x.show(); x.show();
return a.exec(); return a.exec();
} }

View File

@ -8,6 +8,7 @@ xsteam_update_ui::xsteam_update_ui()
copyright_tips_txt=new QLabel(tr("Copyright © 2024 JackLee_CN. All rights reserved.")); copyright_tips_txt=new QLabel(tr("Copyright © 2024 JackLee_CN. All rights reserved."));
info = new QTextEdit(); info = new QTextEdit();
info->setReadOnly(true); info->setReadOnly(true);
info->toMarkdown(QTextDocument::MarkdownDialectGitHub);
m_Layout->addWidget(info); m_Layout->addWidget(info);
f_Layout->addItem(sparcer_item); f_Layout->addItem(sparcer_item);
f_Layout->addWidget(copyright_tips_txt); f_Layout->addWidget(copyright_tips_txt);
@ -25,21 +26,13 @@ xsteam_update_ui::~xsteam_update_ui()
} }
void xsteam_update_ui::load_about() void xsteam_update_ui::load_about()
{ {
QFile file(tr(":/res/txt/about.txt")); QFuture<void> future = QtConcurrent::run([=]()
if(file.open(QIODevice::ReadOnly | QIODevice::Text)) {
{ xsteam_curl* _curl=new xsteam_curl();
QString strs; auto log=_curl->get_steam_id_info("https://git.axibug.com/JackLee/XSteam/raw/branch/vcpkg/update.log",NULL);
while(!file.atEnd()) if(log.size()>0)
{ {
QByteArray line = file.readLine(); info->setText(QString::fromStdString(log));
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);
}
} }

View File

@ -9,6 +9,7 @@
#include <QIODevice> #include <QIODevice>
#include <QLabel> #include <QLabel>
#include <version.h> #include <version.h>
#include "xsteam_curl.h"
#include "sui.h" #include "sui.h"
class xsteam_update_ui :public sui{ class xsteam_update_ui :public sui{
Q_OBJECT Q_OBJECT

View File

@ -13,22 +13,26 @@ void xsteam_view::item_clear()
void xsteam_view::init_view(VIEW_MODE view_mode) void xsteam_view::init_view(VIEW_MODE view_mode)
{ {
m_model = new QStandardItemModel(); 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()); if (view_mode == VIEW_MODE::UID_INFO)
m_model->setHorizontalHeaderLabels(ex_uid_table_head_tips); {
setItemDelegate(new xsteam_view_item()); m_model->setColumnCount(ex_uid_table_head_tips.count());
} m_model->setHorizontalHeaderLabels(ex_uid_table_head_tips);
else if (view_mode == VIEW_MODE::ALL_DLC_INFO) setItemDelegate(new xsteam_view_item());
{ }
m_model->setColumnCount(ex_all_dlc_table_head_tips.count()); else if (view_mode == VIEW_MODE::ALL_DLC_INFO)
m_model->setHorizontalHeaderLabels(ex_all_dlc_table_head_tips); {
} m_model->setColumnCount(ex_all_dlc_table_head_tips.count());
else if (view_mode == VIEW_MODE::IN_DLC_INFO) m_model->setHorizontalHeaderLabels(ex_all_dlc_table_head_tips);
{ }
m_model->setColumnCount(ex_in_dlc_table_head_tips.count()); else if (view_mode == VIEW_MODE::IN_DLC_INFO)
m_model->setHorizontalHeaderLabels(ex_in_dlc_table_head_tips); {
} 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); setSelectionMode(QAbstractItemView::SingleSelection);
horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
setSelectionBehavior(QAbstractItemView::SelectRows); setSelectionBehavior(QAbstractItemView::SelectRows);
@ -39,7 +43,7 @@ void xsteam_view::init_view(VIEW_MODE view_mode)
setModel(m_model); setModel(m_model);
} }
void xsteam_view::item_append(UidData& data, VIEW_MODE mode) void xsteam_view::item_append(UidData &data, VIEW_MODE mode)
{ {
QList<QStandardItem *> d_rows; QList<QStandardItem *> d_rows;
std::vector<std::string> dlc_uid; std::vector<std::string> dlc_uid;