From dfd46be74ec5a7f9d3e27c8b1e8ab1c61cbe0d0f Mon Sep 17 00:00:00 2001 From: JackLee_CN <809262979@qq.com> Date: Tue, 5 Nov 2024 11:11:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=A0=B7=E5=BC=8F=E8=B7=9F?= =?UTF-8?q?=E9=9A=8F=E7=B3=BB=E7=BB=9F=E9=97=AE=E9=A2=98=20=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E9=80=89=E6=8B=A9=E9=87=87=E7=94=A8=E9=97=AD=E5=8C=85?= =?UTF-8?q?=E5=BD=A2=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.cpp | 1 + src/sui_sys_style.cpp | 12 +++++------ src/sui_title.cpp | 10 ++++----- src/xsteam_set_ui.cpp | 50 +++++++++++++++++++++++++------------------ src/xsteam_ui.cpp | 7 +++--- 5 files changed, 45 insertions(+), 35 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 12432a2..40cdd90 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -21,6 +21,7 @@ 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.show(); return a.exec(); diff --git a/src/sui_sys_style.cpp b/src/sui_sys_style.cpp index 579c05b..899d6e1 100644 --- a/src/sui_sys_style.cpp +++ b/src/sui_sys_style.cpp @@ -11,20 +11,20 @@ void sui_sys_style::slots_sys_style_thread() //获取系统注册表信息 QSettings style_set(QSettings::UserScope, "Microsoft", "Windows\\CurrentVersion\\Themes\\Personalize"); //当前系统主题状态,默认0-深色主题,1-浅色主题 - bool isDark=true; + bool isDark=style_set.value("AppsUseLightTheme").toBool(); while (true) { //跟随功能是否开启,0-关闭,1-开启 采用bool类型 - if (state) + if (state==1) { //判断当前临时isDark状态是否和系统主题一致&不一致则更新当前软件主题 - if (isDark != !style_set.value("AppsUseLightTheme").toBool()) + if (isDark != style_set.value("AppsUseLightTheme").toBool()) { - emit signals_sys_style_change(!style_set.value("AppsUseLightTheme").toInt()); - isDark = !style_set.value("AppsUseLightTheme").toBool(); + emit signals_sys_style_change(style_set.value("AppsUseLightTheme").toInt()); + isDark = style_set.value("AppsUseLightTheme").toBool(); } } //刷新间隔5秒 - QThread::sleep(5); + QThread::sleep(2); } } \ No newline at end of file diff --git a/src/sui_title.cpp b/src/sui_title.cpp index 174f817..9e545ab 100644 --- a/src/sui_title.cpp +++ b/src/sui_title.cpp @@ -60,7 +60,6 @@ sui_title::sui_title(QWidget *parent) m_layout->setContentsMargins(5, 0, 5, 0); setFixedHeight(40); setLayout(m_layout); - set_font_style(); connect_slots(); } sui_title::~sui_title() @@ -166,16 +165,16 @@ void sui_title::slots_style_system() { if (sender() != nullptr) { - if (_data.x_config.style_system) + if (_data.x_config.style_system!=0) { _data.x_config.style_system = 0; - m_style->state=0; + m_style->state=_data.x_config.style_system; ((QAction *)sender())->setChecked(false); } else { _data.x_config.style_system = 1; - m_style->state=1; + m_style->state=_data.x_config.style_system; ((QAction *)sender())->setChecked(true); } } @@ -246,7 +245,7 @@ void sui_title::change_style(int index) QString _styleSheet = QLatin1String(qss.readAll()); m_parent->setStyleSheet(""); m_parent->setStyleSheet(_styleSheet); - QApplication::setStyle("Fusion"); + //QApplication::setStyle("Fusion"); } qss.close(); //m_parent->update(); @@ -322,6 +321,7 @@ void sui_title::set_type(QD_TYPE _type) m_style = new sui_sys_style(); m_thread=new QThread(); m_style->moveToThread(m_thread); + m_style->state=_data.x_config.style_system; connect(m_style, SIGNAL(signals_sys_style_change(int)), this, SLOT(change_style(int))); connect(m_thread, SIGNAL(started()), m_style, SLOT(slots_sys_style_thread())); m_thread->start(); diff --git a/src/xsteam_set_ui.cpp b/src/xsteam_set_ui.cpp index b192f7e..61c0953 100644 --- a/src/xsteam_set_ui.cpp +++ b/src/xsteam_set_ui.cpp @@ -106,34 +106,42 @@ void xsteam_set_ui::slotsSaveDone() } void xsteam_set_ui::slots_set_path_change() { - QString set_dir; - if (sender()->objectName() == "STEAM_PATH_BTN") + auto select_dir = [=](QString sender_name) { - 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") + QString default_dir; + if (sender_name == "STEAM_PATH_BTN") { - _data.x_config.steam_dir = set_dir.toStdString(); + default_dir = steam_path_edit->text(); } - else if (sender()->objectName() == "STEAMTOOLS_PATH_BTN") + else if (sender_name == "STEAMTOOLS_PATH_BTN") { - _data.x_config.steamtools_dir = set_dir.toStdString(); + default_dir = steamtools_path_edit->text(); } - else if (sender()->objectName() == "STEAMTOOLS_ST_PATH_BTN") + else if (sender_name == "STEAMTOOLS_ST_PATH_BTN") { - _data.x_config.steamtools_st_dir = set_dir.toStdString(); + default_dir = steamtools_st_path_edit->text(); } + return QFileDialog::getExistingDirectory(new QWidget(), "选择目录", default_dir); + }; + auto set_dir = [=](QString sender_name,QString dir_str) + { + if (sender_name == "STEAM_PATH_BTN") + { + _data.x_config.steam_dir = dir_str.toStdString(); + } + else if (sender_name == "STEAMTOOLS_PATH_BTN") + { + _data.x_config.steamtools_dir = dir_str.toStdString(); + } + else if (sender_name == "STEAMTOOLS_ST_PATH_BTN") + { + _data.x_config.steamtools_st_dir = dir_str.toStdString(); + } + }; + QString dir_str=select_dir(sender()->objectName()); + if ( dir_str!= nullptr) + { + set_dir(sender()->objectName(),dir_str); load_data_set(); } } \ No newline at end of file diff --git a/src/xsteam_ui.cpp b/src/xsteam_ui.cpp index 420843f..cabc1a1 100644 --- a/src/xsteam_ui.cpp +++ b/src/xsteam_ui.cpp @@ -42,6 +42,7 @@ void xsteam_ui::xsteam_init_info_layout() info_layout->addItem(sparcer_item); info_layout->addWidget(info_txt_tag); info_layout->addItem(sparcer_item); + info_txt_tag->setVisible(false); } void xsteam_ui::xsteam_init_mind_layout() { @@ -492,7 +493,7 @@ void xsteam_ui::slots_push_manifest() xs_push_manifest = xsteam_push_manifest::Instance(); if (!xs_push_manifest->isVisible()) { - xs_push_manifest->setMaximumSize(width(), height() - 25); + xs_push_manifest->setMaximumSize(width(), height() - 30); xs_push_manifest->setGeometry(geometry()); xs_push_manifest->show(); } @@ -502,7 +503,7 @@ void xsteam_ui::slots_open_server_edit() xs_src_edit_ui = xsteam_src_edit_ui::Instance(); if (!xs_src_edit_ui->isVisible()) { - xs_src_edit_ui->setMaximumSize(width(), height()); + xs_src_edit_ui->setMaximumSize(width(), height()- 30); xs_src_edit_ui->setGeometry(geometry()); connect(xs_src_edit_ui, SIGNAL(signals_update()), this, SLOT(slots_server_combobox_load_data())); xs_src_edit_ui->title()->set_font_style(); @@ -525,7 +526,7 @@ void xsteam_ui::slots_open_setting() xs_sets_ui = xsteam_set_ui::Instance(); if (!xs_sets_ui->isVisible()) { - xs_sets_ui->setMaximumSize(width(), height()); + xs_sets_ui->setMaximumSize(width(), height()- 30); xs_sets_ui->setGeometry(geometry()); xs_sets_ui->title()->set_font_style(); xs_sets_ui->show();