增加设置界面中路径设置功能
This commit is contained in:
parent
807b47b818
commit
8ac8985bd4
11
.vscode/launch.json
vendored
11
.vscode/launch.json
vendored
@ -3,5 +3,14 @@
|
||||
// 悬停以查看现有属性的描述。
|
||||
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": []
|
||||
"configurations": [
|
||||
{
|
||||
"type": "cmake",
|
||||
"request": "launch",
|
||||
"name": "Debug portfile(s)",
|
||||
"cmakeDebugType": "external",
|
||||
"pipeName": "\\\\.\\pipe\\vcpkg_ext_portfile_dbg",
|
||||
"preLaunchTask": "Debug vcpkg commands"
|
||||
}
|
||||
]
|
||||
}
|
13
.vscode/settings.json
vendored
13
.vscode/settings.json
vendored
@ -113,5 +113,16 @@
|
||||
"*.in": "cpp",
|
||||
"qactiongroup": "cpp"
|
||||
},
|
||||
"Codegeex.RepoIndex": true
|
||||
"Codegeex.RepoIndex": true,
|
||||
"editor.gotoLocation.alternativeDeclarationCommand": "editor.action.revealDefinition",
|
||||
"editor.gotoLocation.alternativeDefinitionCommand": "editor.action.revealDefinition",
|
||||
"editor.gotoLocation.alternativeTypeDefinitionCommand": "editor.action.revealDefinition",
|
||||
"editor.selectionHighlight": false,
|
||||
"files.autoSave": "onFocusChange",
|
||||
"editor.suggest.snippetsPreventQuickSuggestions": false,
|
||||
"editor.quickSuggestions": {
|
||||
"other": "on",
|
||||
"comments": "off",
|
||||
"strings": "on"
|
||||
}
|
||||
}
|
@ -148,6 +148,7 @@ SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -s")
|
||||
SET(CMAKE_EXECUTABLE_LINKER_FLAGS "${CMAKE_EXECUTABLE_LINKER_FLAGS} -s")
|
||||
#删除生成EXE符号信息
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s")
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-s")
|
||||
#开启整数溢出检查
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -ftrapv")
|
||||
#开启栈检查
|
||||
|
@ -55,27 +55,25 @@ QPushButton#min_button,QPushButton#max_button,QPushButton#close_button{
|
||||
margin-right:3px;
|
||||
margin-bottom:0px;
|
||||
border-radius:8px;
|
||||
font-family: "Microsoft YaHei";
|
||||
font-weight: bold;
|
||||
font: bold 12px;
|
||||
}
|
||||
|
||||
QPushButton#min_button{
|
||||
image:url(":/res/img/btn/btn_min.png");
|
||||
border:none;
|
||||
width:20px;
|
||||
height:20px;
|
||||
width:25px;
|
||||
height:25px;
|
||||
}
|
||||
QPushButton#max_button{
|
||||
image:url(":/res/img/btn/btn_max.png");
|
||||
border:none;
|
||||
width:20px;
|
||||
height:20px;
|
||||
width:25px;
|
||||
height:25px;
|
||||
}
|
||||
QPushButton#close_button{
|
||||
image:url(":/res/img/btn/btn_close.png");
|
||||
border:none;
|
||||
width:20px;
|
||||
height:20px;
|
||||
width:25px;
|
||||
height:25px;
|
||||
}
|
||||
|
||||
QPushButton#min_button:hover,QPushButton#max_button:hover,QPushButton#close_button:hover{
|
||||
@ -87,3 +85,4 @@ QPushButton#min_button:pressed,QPushButton#max_button:pressed,QPushButton#close_
|
||||
padding-left:1px;
|
||||
padding-top:1px;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ sui_title::sui_title(QWidget *parent)
|
||||
f_menu(nullptr)
|
||||
{
|
||||
m_parent = parent;
|
||||
m_type=QD_TYPE::QD_EXIT;
|
||||
m_type = QD_TYPE::QD_EXIT;
|
||||
// 给成员变量申请内存
|
||||
m_icon_button = new QPushButton(/*this*/);
|
||||
m_min_button = new QPushButton(this);
|
||||
@ -61,12 +61,29 @@ sui_title::sui_title(QWidget *parent)
|
||||
setFixedHeight(40);
|
||||
setLayout(m_layout);
|
||||
set_font_style();
|
||||
connect_slots();
|
||||
connect_slots();
|
||||
}
|
||||
sui_title::~sui_title()
|
||||
{
|
||||
}
|
||||
|
||||
void sui_title::auto_style()
|
||||
{
|
||||
QFuture<void> future = QtConcurrent::run([=]()
|
||||
{
|
||||
QSettings style_set(QSettings::UserScope, "Microsoft", "Windows\\CurrentVersion\\Themes\\Personalize");
|
||||
bool isDark;
|
||||
while (true)
|
||||
{
|
||||
isDark= !style_set.value("AppsUseLightTheme").toBool();
|
||||
if(isDark){
|
||||
change_style(0);
|
||||
}else{
|
||||
change_style(1);
|
||||
}
|
||||
QThread::sleep(5);
|
||||
}
|
||||
});
|
||||
}
|
||||
void sui_title::connect_slots()
|
||||
{
|
||||
// 连接三个按钮的信号槽3
|
||||
@ -134,7 +151,8 @@ void sui_title::slots_ico_menu()
|
||||
delete m_menu;
|
||||
m_menu = nullptr;
|
||||
}
|
||||
void sui_title::set_font_style(){
|
||||
void sui_title::set_font_style()
|
||||
{
|
||||
slots_set_style_change();
|
||||
slots_set_font_change();
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <QActionGroup>
|
||||
#include <QFontDatabase>
|
||||
#include <QStyleFactory>
|
||||
#include <QtConcurrent/QtConcurrent>
|
||||
#include "xsteam_ex.h"
|
||||
|
||||
typedef enum{
|
||||
@ -43,7 +44,8 @@ private:
|
||||
//最大化/还原
|
||||
void up_maximize();
|
||||
void change_style(int);
|
||||
void connect_slots();
|
||||
void connect_slots();
|
||||
void auto_style();
|
||||
private:
|
||||
QWidget *m_parent;
|
||||
QHBoxLayout *m_layout;
|
||||
|
@ -10,90 +10,130 @@ xsteam_set_ui::~xsteam_set_ui()
|
||||
}
|
||||
void xsteam_set_ui::init_set()
|
||||
{
|
||||
main_qwidget=new QWidget;
|
||||
main_qwidget = new QWidget;
|
||||
main_layout = new QVBoxLayout;
|
||||
foot_layout = new QHBoxLayout;
|
||||
body_layout = new QVBoxLayout;
|
||||
set_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路径设置:"));
|
||||
steam_path_edit=new QLineEdit();
|
||||
steam_path_btn=new QPushButton(tr("浏览"));
|
||||
|
||||
steam_layout = new QHBoxLayout;
|
||||
steam_path_str = new QLabel(tr("Steam路径设置:"));
|
||||
steam_path_edit = new QLineEdit();
|
||||
steam_path_btn = new QPushButton(tr("浏览"));
|
||||
steam_path_btn->setObjectName("STEAM_PATH_BTN");
|
||||
steam_layout->addWidget(steam_path_str);
|
||||
steam_layout->addWidget(steam_path_edit);
|
||||
steam_layout->addWidget(steam_path_btn);
|
||||
|
||||
steamtools_layout=new QHBoxLayout;
|
||||
steamtools_path_str=new QLabel(tr("SteamTools路径设置:"));
|
||||
steamtools_path_edit=new QLineEdit();
|
||||
steamtools_path_btn=new QPushButton(tr("浏览"));
|
||||
|
||||
steamtools_layout = new QHBoxLayout;
|
||||
steamtools_path_str = new QLabel(tr("SteamTools路径设置:"));
|
||||
steamtools_path_edit = new QLineEdit();
|
||||
steamtools_path_btn = new QPushButton(tr("浏览"));
|
||||
steamtools_path_btn->setObjectName("STEAMTOOLS_PATH_BTN");
|
||||
steamtools_layout->addWidget(steamtools_path_str);
|
||||
steamtools_layout->addWidget(steamtools_path_edit);
|
||||
steamtools_layout->addWidget(steamtools_path_btn);
|
||||
|
||||
steamtools_st_layout=new QHBoxLayout;
|
||||
steamtools_st_path_str=new QLabel(tr("SteamTools .st路径设置(不建议修改):"));
|
||||
steamtools_st_path_edit=new QLineEdit();
|
||||
steamtools_st_path_btn=new QPushButton(tr("浏览"));
|
||||
|
||||
steamtools_st_layout = new QHBoxLayout;
|
||||
steamtools_st_path_str = new QLabel(tr("SteamTools .st路径设置(不建议修改):"));
|
||||
steamtools_st_path_edit = new QLineEdit();
|
||||
steamtools_st_path_btn = new QPushButton(tr("浏览"));
|
||||
steamtools_st_path_btn->setObjectName("STEAMTOOLS_ST_PATH_BTN");
|
||||
steamtools_st_layout->addWidget(steamtools_st_path_str);
|
||||
steamtools_st_layout->addWidget(steamtools_st_path_edit);
|
||||
steamtools_st_layout->addWidget(steamtools_st_path_btn);
|
||||
|
||||
|
||||
steam_api_layout=new QHBoxLayout;
|
||||
steaminfo_api_path_str=new QLabel(tr("Steam Info Api Url(不建议修改):"));
|
||||
steaminfo_api_path_edit=new QLineEdit();
|
||||
|
||||
steam_api_layout = new QHBoxLayout;
|
||||
steaminfo_api_path_str = new QLabel(tr("Steam Info Api Url(不建议修改):"));
|
||||
steaminfo_api_path_edit = new QLineEdit();
|
||||
steam_api_layout->addWidget(steaminfo_api_path_str);
|
||||
steam_api_layout->addWidget(steaminfo_api_path_edit);
|
||||
|
||||
|
||||
steam_head_api_layout=new QHBoxLayout;
|
||||
steaminfo_head_path_str=new QLabel(tr("Steam Logo Api Url(不建议修改):"));
|
||||
steaminfo_head_path_edit=new QLineEdit();
|
||||
|
||||
steam_head_api_layout = new QHBoxLayout;
|
||||
steaminfo_head_path_str = new QLabel(tr("Steam Logo Api Url(不建议修改):"));
|
||||
steaminfo_head_path_edit = new QLineEdit();
|
||||
steam_head_api_layout->addWidget(steaminfo_head_path_str);
|
||||
steam_head_api_layout->addWidget(steaminfo_head_path_edit);
|
||||
|
||||
|
||||
body_layout->addLayout(steam_layout);
|
||||
body_layout->addLayout(steamtools_layout);
|
||||
body_layout->addLayout(steamtools_st_layout);
|
||||
body_layout->addLayout(steam_api_layout);
|
||||
body_layout->addLayout(steam_head_api_layout);
|
||||
body_layout->addWidget(new QWidget());
|
||||
set_group->setLayout(body_layout);
|
||||
|
||||
body_layout->addLayout(steam_head_api_layout);
|
||||
body_layout->addWidget(new QWidget());
|
||||
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(set_group);
|
||||
main_layout->addLayout(foot_layout);
|
||||
main_layout->setStretch(0, 8);
|
||||
main_layout->setStretch(1, 2);
|
||||
main_layout->setContentsMargins(5, 5, 5, 5);
|
||||
main_layout->setContentsMargins(5, 5, 5, 5);
|
||||
main_qwidget->setLayout(main_layout);
|
||||
layout()->addWidget(main_qwidget);
|
||||
connect_slots();
|
||||
}
|
||||
void xsteam_set_ui::connect_slots(){
|
||||
void xsteam_set_ui::connect_slots()
|
||||
{
|
||||
connect(_pSaveData, SIGNAL(clicked()), this, SLOT(slotsSaveDone()));
|
||||
connect(steam_path_btn, SIGNAL(clicked()), this, SLOT(slots_set_path_change()));
|
||||
connect(steamtools_path_btn, SIGNAL(clicked()), this, SLOT(slots_set_path_change()));
|
||||
connect(steamtools_st_path_btn, SIGNAL(clicked()), this, SLOT(slots_set_path_change()));
|
||||
}
|
||||
void xsteam_set_ui::load_data_set(){
|
||||
void xsteam_set_ui::load_data_set()
|
||||
{
|
||||
steam_path_edit->setText(QString::fromStdString(_data.x_config.steam_dir));
|
||||
steamtools_path_edit->setText(QString::fromStdString(_data.x_config.steamtools_dir));
|
||||
steamtools_st_path_edit->setText(QString::fromStdString(_data.x_config.steamtools_st_dir));
|
||||
steaminfo_api_path_edit->setText(QString::fromStdString(_data.x_config.steam_api_url));
|
||||
steaminfo_head_path_edit->setText(QString::fromStdString(_data.x_config.steam_logo_url));
|
||||
}
|
||||
void xsteam_set_ui::slotsSaveDone(){
|
||||
_data.x_config.steam_dir=steam_path_edit->text().toStdString();
|
||||
_data.x_config.steamtools_dir=steamtools_path_edit->text().toStdString();
|
||||
_data.x_config.steamtools_st_dir=steamtools_st_path_edit->text().toStdString();
|
||||
_data.x_config.steam_api_url=steaminfo_api_path_edit->text().toStdString();
|
||||
_data.x_config.steam_logo_url=steaminfo_head_path_edit->text().toStdString();
|
||||
xsteam_save_data_write();
|
||||
xsteam_msg_tip(nullptr, "保存成功");
|
||||
this->close();
|
||||
void xsteam_set_ui::slotsSaveDone()
|
||||
{
|
||||
_data.x_config.steam_dir = steam_path_edit->text().toStdString();
|
||||
_data.x_config.steamtools_dir = steamtools_path_edit->text().toStdString();
|
||||
_data.x_config.steamtools_st_dir = steamtools_st_path_edit->text().toStdString();
|
||||
_data.x_config.steam_api_url = steaminfo_api_path_edit->text().toStdString();
|
||||
_data.x_config.steam_logo_url = steaminfo_head_path_edit->text().toStdString();
|
||||
xsteam_save_data_write();
|
||||
xsteam_msg_tip(nullptr, "保存成功");
|
||||
this->close();
|
||||
}
|
||||
void xsteam_set_ui::slots_set_path_change()
|
||||
{
|
||||
QString set_dir;
|
||||
if (sender()->objectName() == "STEAM_PATH_BTN")
|
||||
{
|
||||
set_dir = QFileDialog::getExistingDirectory(new QWidget(), "选择目录", steam_path_edit->text());
|
||||
}
|
||||
else if (sender()->objectName() == "STEAMTOOLS_PATH_BTN")
|
||||
{
|
||||
set_dir = QFileDialog::getExistingDirectory(new QWidget(), "选择目录", steamtools_path_edit->text());
|
||||
}
|
||||
else if (sender()->objectName() == "STEAMTOOLS_ST_PATH_BTN")
|
||||
{
|
||||
set_dir = QFileDialog::getExistingDirectory(new QWidget(), "选择目录", steamtools_st_path_edit->text());
|
||||
}
|
||||
|
||||
if (set_dir != nullptr)
|
||||
{
|
||||
if (sender()->objectName() == "STEAM_PATH_BTN")
|
||||
{
|
||||
_data.x_config.steam_dir = set_dir.toStdString();
|
||||
}
|
||||
else if (sender()->objectName() == "STEAMTOOLS_PATH_BTN")
|
||||
{
|
||||
_data.x_config.steamtools_dir = set_dir.toStdString();
|
||||
}
|
||||
else if (sender()->objectName() == "STEAMTOOLS_ST_PATH_BTN")
|
||||
{
|
||||
_data.x_config.steamtools_st_dir = set_dir.toStdString();
|
||||
}
|
||||
load_data_set();
|
||||
}
|
||||
}
|
@ -80,6 +80,7 @@ private:
|
||||
private slots:
|
||||
//void clicked_rightMenu(const QPoint &pos); //右键信号槽函数
|
||||
void slotsSaveDone();
|
||||
void slots_set_path_change();
|
||||
};
|
||||
xsteam_set_ui *xsteam_set_ui::_instance = {};
|
||||
QMutex xsteam_set_ui::mutex;
|
||||
|
Loading…
Reference in New Issue
Block a user