增加更新功能

This commit is contained in:
JackLee_CN 2024-10-29 07:39:29 +08:00
parent 4238d3e1fa
commit 3c8b1c2e8e
11 changed files with 132 additions and 14 deletions

View File

@ -2,6 +2,7 @@
<qresource prefix="/">
<file>res/img/btn/btn_setting.png</file>
<file>res/img/btn/btn_about.png</file>
<file>res/img/btn/btn_update.png</file>
<file>res/img/btn/net_ok.png</file>
<file>res/img/btn/net_error.png</file>
<file>res/img/btn/net_wait.png</file>

BIN
res/img/btn/btn_update.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 752 B

View File

@ -11,11 +11,17 @@ QPushButton#ico_button{
QLabel#HEAD_STR,QLabel#SRC_SERVER,QLabel#GAME_UID,QLabel#VERSION_TIPS,QLabel#STATE_TIPS,QLabel#VERSION_TIPS_TXT,QLabel#INFO{
color:#F2F2F2;
}
QPushButton#BTN_SETS{
width:25px;
height:25px;
image:url(":/res/img/btn/btn_setting.png");
}
QPushButton#BTN_UPDATE{
width:25px;
height:25px;
image:url(":/res/img/btn/btn_update.png");
}
QPushButton#BTN_ABOUT{
width:25px;
height:25px;
@ -26,9 +32,7 @@ QPushButton:hover{
padding-left:1px;
padding-top:1px;
}
QGroupBox#GAME_INFO_GROUP,QGroupBox#ALL_DLC_GROUP{
color: #F0F0F0F0;
}
QTableView#GAME_INFO_TABLE::item:selected {
background-color: #0078d4;
}

View File

@ -27,14 +27,16 @@ QPushButton#BTN_SETS{
height:25px;
image:url(":/res/img/btn/btn_setting.png");
}
QPushButton#BTN_UPDATE{
width:25px;
height:25px;
image:url(":/res/img/btn/btn_update.png");
}
QPushButton#BTN_ABOUT{
width:25px;
height:25px;
image:url(":/res/img/btn/btn_about.png");
}
QGroupBox#GAME_INFO_GROUP,QGroupBox#ALL_DLC_GROUP{
color: black;
}
QTableView#GAME_INFO_TABLE::item:selected {
background-color: #0078d4;
}

View File

@ -14,7 +14,8 @@ void xsteam_set_ui::init_set()
main_layout = new QVBoxLayout;
foot_layout = new QHBoxLayout;
body_layout = new QVBoxLayout;
src_group=new QGroupBox(tr("设置参数"));
set_group=new QGroupBox(tr("参数设置"));
set_group->setObjectName("SET_GROUP");
steam_layout=new QHBoxLayout;
steam_path_str=new QLabel(tr("Steam路径设置:"));
@ -60,14 +61,14 @@ void xsteam_set_ui::init_set()
body_layout->addLayout(steam_api_layout);
body_layout->addLayout(steam_head_api_layout);
body_layout->addWidget(new QWidget());
src_group->setLayout(body_layout);
set_group->setLayout(body_layout);
_pSaveData = new QPushButton(tr("保存"));
foot_layout->addSpacerItem(sparcer_item);
foot_layout->addWidget(_pSaveData);
foot_layout->addSpacerItem(sparcer_item);
main_layout->addWidget(src_group);
main_layout->addWidget(set_group);
main_layout->addLayout(foot_layout);
main_layout->setStretch(0, 8);
main_layout->setStretch(1, 2);

View File

@ -45,7 +45,7 @@ private:
QVBoxLayout* body_layout;
QHBoxLayout* foot_layout;
QGroupBox* src_group;
QGroupBox* set_group;
QPushButton* _pSaveData={};
QSpacerItem * sparcer_item = new QSpacerItem(0,0,QSizePolicy::Expanding,QSizePolicy::Fixed);

View File

@ -28,7 +28,9 @@ void xsteam_src_edit_ui::init_table_view_style()
void xsteam_src_edit_ui::init_src_edit_ui()
{
setWindowTitle(tr("XSteam源数据"));
src_group = new QGroupBox(tr("数据源信息"));
src_group = new QGroupBox(tr("源信息表"));
src_group->setObjectName("SRC_GROUP");
gr_Layout = new QVBoxLayout();
main_Layout = new QVBoxLayout;
foot_Layout = new QHBoxLayout;

View File

@ -63,7 +63,7 @@ void xsteam_ui::xsteam_init_mind_layout()
btn_run_steamdb->setObjectName("STEAM_DB");
btn_push_manifest = new QPushButton(tr("清单分享"));
btn_push_manifest->setObjectName("PUSH_MANIFEST");
btn_push_manifest->setVisible(false);
//btn_push_manifest->setVisible(false);
server_layout->addWidget(server_tag);
server_layout->addWidget(server_txt);
@ -158,7 +158,11 @@ void xsteam_ui::xsteam_init_foot_layout()
btn_xs_sets = new QPushButton();
btn_xs_sets->setMaximumSize(25, 25);
btn_xs_sets->setObjectName(tr("BTN_SETS"));
btn_xs_update = new QPushButton();
btn_xs_update->setMaximumSize(25, 25);
btn_xs_update->setObjectName(tr("BTN_UPDATE"));
btn_xs_about = new QPushButton();
btn_xs_about->setMaximumSize(25, 25);
btn_xs_about->setObjectName(tr("BTN_ABOUT"));
@ -171,6 +175,7 @@ void xsteam_ui::xsteam_init_foot_layout()
foot_status_data_layout->addItem(sparcer_item);
foot_status_data_layout->addWidget(btn_xs_sets);
foot_status_data_layout->addWidget(btn_xs_update);
foot_status_data_layout->addWidget(btn_xs_about);
foot_layout->addLayout(foot_status_data_layout);
xs_git_fetch = new xsteam_git_fetch();
@ -192,6 +197,7 @@ void xsteam_ui::xsteam_init_connect()
connect(btn_run_steam, SIGNAL(clicked()), this, SLOT(slots_run_steam_steamtools()));
connect(btn_run_steamtools, SIGNAL(clicked()), this, SLOT(slots_run_steam_steamtools()));
connect(btn_xs_about, SIGNAL(clicked()), this, SLOT(slots_open_about()));
connect(btn_xs_update, SIGNAL(clicked()), this, SLOT(slots_open_update()));
connect(btn_fetch_src_data, SIGNAL(clicked()), this, SLOT(slots_fetch_src_data()));
connect(btn_uid_push, SIGNAL(clicked()), this, SLOT(slots_imput_update_uid_push()));
connect(btn_uid_update, SIGNAL(clicked()), this, SLOT(slots_imput_update_uid_push()));
@ -491,6 +497,13 @@ void xsteam_ui::slots_open_server_edit()
connect(xs_src_edit_ui, SIGNAL(signals_update()), this, SLOT(slots_server_combobox_load_data()));
xs_src_edit_ui->exec();
}
void xsteam_ui::slots_open_update()
{
xs_update_ui = xsteam_update_ui::Instance();
xs_update_ui->setMaximumSize(440, 580);
xs_update_ui->setGeometry(((QWidget *)this->parent())->geometry());
xs_update_ui->exec();
}
void xsteam_ui::slots_open_setting()
{
xs_sets_ui = xsteam_set_ui::Instance();

View File

@ -14,6 +14,7 @@
#include "xsteam_src_edit_ui.h"
#include "xsteam_set_ui.h"
#include "xsteam_about_ui.h"
#include "xsteam_update_ui.h"
#include "xsteam_view.h"
#include "xsteam_git_fetch.h"
#include "xsteam_push_manifest.h"
@ -77,10 +78,12 @@ private:
QLabel* version_tips_txt;
QLabel* state_tips_txt;
QPushButton* btn_xs_sets;
QPushButton* btn_xs_about;
QPushButton* btn_xs_update;
QPushButton* btn_xs_about;
xsteam_src_edit_ui* xs_src_edit_ui;
xsteam_set_ui * xs_sets_ui;
xsteam_about_ui* xs_about_ui;
xsteam_update_ui* xs_update_ui;
xsteam_git_fetch* xs_git_fetch;
xsteam_push_manifest* xs_push_manifest;
QSpacerItem * sparcer_item = new QSpacerItem(0,0,QSizePolicy::Expanding,QSizePolicy::Fixed);
@ -90,6 +93,7 @@ private:
private slots:
void slots_open_server_edit();
void slots_open_setting();
void slots_open_update();
void slots_open_about();
void slots_open_steamdb();
void slots_push_manifest();

43
src/xsteam_update_ui.cpp Normal file
View File

@ -0,0 +1,43 @@
#include "xsteam_update_ui.h"
xsteam_update_ui::xsteam_update_ui()
{
m_Layout = new QVBoxLayout();
f_Layout =new QHBoxLayout();
copyright_tips_txt=new QLabel(tr("Copyright © 2024 JackLee_CN. All rights reserved."));
info = new QTextEdit();
info->setReadOnly(true);
m_Layout->addWidget(info);
f_Layout->addItem(sparcer_item);
f_Layout->addWidget(copyright_tips_txt);
f_Layout->addItem(sparcer_item);
m_Layout->addLayout(f_Layout);
load_about();
setWindowTitle(tr("About XSteam"));
m_Layout->setContentsMargins(0, 0, 0, 0);
setLayout(m_Layout);
}
xsteam_update_ui::~xsteam_update_ui()
{
delete this;
}
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);
}
}

48
src/xsteam_update_ui.h Normal file
View File

@ -0,0 +1,48 @@
#ifndef XSTEAM_UPDATE_UI_H
#define XSTEAM_UPDATE_UI_H
#include <QDialog>
#include <QMutex>
#include <QMutexLocker>
#include <QVBoxLayout>
#include <QTextEdit>
#include <QFile>
#include <QIODevice>
#include <QLabel>
#include <version.h>
class xsteam_update_ui :public QDialog{
Q_OBJECT
public:
static xsteam_update_ui *Instance()
{
if (!_instance)
{
static QMutex mutex;
mutex.lock();
if (!_instance)
{
_instance = new xsteam_update_ui();
}
mutex.unlock();
}
return _instance;
}
private:
xsteam_update_ui();
~xsteam_update_ui();
xsteam_update_ui(const xsteam_update_ui &other);
const xsteam_update_ui &operator=(const xsteam_update_ui &other);
static xsteam_update_ui* _instance;
static QMutex mutex;
QVBoxLayout* m_Layout={};
QHBoxLayout* f_Layout={};
QTextEdit* info={};
void load_about();
QLabel* copyright_tips_txt;
QSpacerItem * sparcer_item = new QSpacerItem(0,0,QSizePolicy::Expanding,QSizePolicy::Fixed);
};
xsteam_update_ui *xsteam_update_ui::_instance = {};
QMutex xsteam_update_ui::mutex;
#endif // XSTEAM_UPDATE_UI_H