更新部分圖標

刪除不需要函數
This commit is contained in:
JackLee_CN 2024-10-21 13:53:24 +08:00
parent 35dd8cb465
commit 4238d3e1fa
12 changed files with 117 additions and 126 deletions

View File

@ -110,7 +110,8 @@
"qheaderview": "cpp", "qheaderview": "cpp",
"qabstractlistmodel": "cpp", "qabstractlistmodel": "cpp",
"qtconcurrentrun": "cpp", "qtconcurrentrun": "cpp",
"*.in": "cpp" "*.in": "cpp",
"qactiongroup": "cpp"
}, },
"Codegeex.RepoIndex": true "Codegeex.RepoIndex": true
} }

View File

@ -44,7 +44,7 @@ endif()
#QT .cmake #QT .cmake
#QT #QT
SET(QT_STATU "dynamic") SET(QT_STATU "static")
if(QT_STATU STREQUAL "dynamic") if(QT_STATU STREQUAL "dynamic")
SET(QT_DIR "D:/Dev/Qt/6.8.0/mingw_64/lib/cmake") SET(QT_DIR "D:/Dev/Qt/6.8.0/mingw_64/lib/cmake")

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 791 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 966 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 897 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 886 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 678 B

View File

@ -8,7 +8,7 @@ QPushButton#ico_button{
image:url(:/res/img/xsteam.png); image:url(:/res/img/xsteam.png);
border:none; border:none;
} }
QLabel#HEAD_STR,QLabel#SRC_SERVER,QLabel#GAME_UID,QLabel#VERSION_TIPS,QLabel#STATE_TIPS,QLabel#VERSION_TIPS_TXT{ QLabel#HEAD_STR,QLabel#SRC_SERVER,QLabel#GAME_UID,QLabel#VERSION_TIPS,QLabel#STATE_TIPS,QLabel#VERSION_TIPS_TXT,QLabel#INFO{
color:#F2F2F2; color:#F2F2F2;
} }
QPushButton#BTN_SETS{ QPushButton#BTN_SETS{

View File

@ -13,7 +13,7 @@ QPushButton#ico_button{
border:none; border:none;
} }
QLabel#HEAD_STR,QLabel#SRC_SERVER,QLabel#GAME_UID,QLabel#VERSION_TIPS,QLabel#STATE_TIPS,QLabel#VERSION_TIPS_TXT{ QLabel#HEAD_STR,QLabel#SRC_SERVER,QLabel#GAME_UID,QLabel#VERSION_TIPS,QLabel#STATE_TIPS,QLabel#VERSION_TIPS_TXT,QLabel#INFO{
color:#404040; color:#404040;
} }

View File

@ -73,7 +73,8 @@ sui_title::sui_title(QWidget *parent)
sui_title::~sui_title() sui_title::~sui_title()
{ {
} }
void sui_title::connect_slots(){ void sui_title::connect_slots()
{
// 连接三个按钮的信号槽3 // 连接三个按钮的信号槽3
connect(m_icon_button, SIGNAL(clicked(bool)), this, SLOT(slots_ico_menu())); connect(m_icon_button, SIGNAL(clicked(bool)), this, SLOT(slots_ico_menu()));
connect(m_min_button, SIGNAL(clicked(bool)), this, SLOT(on_clicked())); connect(m_min_button, SIGNAL(clicked(bool)), this, SLOT(on_clicked()));
@ -84,15 +85,18 @@ void sui_title::slots_ico_menu()
{ {
m_menu = new QMenu(); m_menu = new QMenu();
// 外观 // 外观
if(!s_menu){ if (!s_menu)
{
QActionGroup *s_QGroup = new QActionGroup(this); QActionGroup *s_QGroup = new QActionGroup(this);
s_menu = new QMenu(tr("外观设置")); s_menu = new QMenu(tr("外观设置"));
for(int i=0;i<=style_table.count()-1;i++){ for (int i = 0; i <= style_table.count() - 1; i++)
{
QString sName = QFileInfo(style_table[i]).baseName(); QString sName = QFileInfo(style_table[i]).baseName();
QAction *s_Action = new QAction(sName, s_QGroup); QAction *s_Action = new QAction(sName, s_QGroup);
s_Action->setObjectName(QString::number(i)); s_Action->setObjectName(QString::number(i));
s_Action->setCheckable(true); s_Action->setCheckable(true);
if(i==_data.x_config.style){ if (i == _data.x_config.style)
{
s_Action->setChecked(true); s_Action->setChecked(true);
} }
connect(s_Action, SIGNAL(triggered(bool)), this, SLOT(slots_set_style_change())); connect(s_Action, SIGNAL(triggered(bool)), this, SLOT(slots_set_style_change()));
@ -100,14 +104,17 @@ void sui_title::slots_ico_menu()
} }
} }
// 字体 // 字体
if(!f_menu){ if (!f_menu)
{
QActionGroup *f_QGroup = new QActionGroup(this); QActionGroup *f_QGroup = new QActionGroup(this);
f_menu = new QMenu(tr("字体设置")); f_menu = new QMenu(tr("字体设置"));
for(int i=0;i<=font_table.count()-1;i++){ for (int i = 0; i <= font_table.count() - 1; i++)
{
QAction *f_Action = new QAction(font_table[i], f_QGroup); QAction *f_Action = new QAction(font_table[i], f_QGroup);
f_Action->setObjectName(QString::number(i)); f_Action->setObjectName(QString::number(i));
f_Action->setCheckable(true); f_Action->setCheckable(true);
if(i==_data.x_config.font){ if (i == _data.x_config.font)
{
f_Action->setChecked(true); f_Action->setChecked(true);
} }
connect(f_Action, SIGNAL(triggered(bool)), this, SLOT(slots_set_font_change())); connect(f_Action, SIGNAL(triggered(bool)), this, SLOT(slots_set_font_change()));
@ -120,7 +127,8 @@ void sui_title::slots_ico_menu()
QAction *b_Action = new QAction("字体加粗", b_QGroup); QAction *b_Action = new QAction("字体加粗", b_QGroup);
b_Action->setObjectName("font_bold"); b_Action->setObjectName("font_bold");
b_Action->setCheckable(true); b_Action->setCheckable(true);
if(_data.x_config.font_bold){ if (_data.x_config.font_bold)
{
b_Action->setChecked(true); b_Action->setChecked(true);
} }
connect(b_Action, SIGNAL(triggered(bool)), this, SLOT(slots_set_font_change())); connect(b_Action, SIGNAL(triggered(bool)), this, SLOT(slots_set_font_change()));
@ -134,43 +142,59 @@ void sui_title::slots_ico_menu()
} }
void sui_title::slots_set_style_change() void sui_title::slots_set_style_change()
{ {
if(sender()!=nullptr){ if (sender() != nullptr)
{
_data.x_config.style = sender()->objectName().toInt(); _data.x_config.style = sender()->objectName().toInt();
} }
change_style(_data.x_config.style); change_style(_data.x_config.style);
} }
void sui_title::slots_set_font_change() void sui_title::slots_set_font_change()
{ {
if(sender()!=nullptr){ if (sender() != nullptr)
if(sender()->objectName()=="font_bold"){ {
if(_data.x_config.font_bold){ if (sender()->objectName() == "font_bold")
{
if (_data.x_config.font_bold)
{
_data.x_config.font_bold = 0; _data.x_config.font_bold = 0;
((QAction *)sender())->setChecked(false); ((QAction *)sender())->setChecked(false);
}else{ }
else
{
_data.x_config.font_bold = 1; _data.x_config.font_bold = 1;
((QAction *)sender())->setChecked(true); ((QAction *)sender())->setChecked(true);
} }
}else{ }
else
{
_data.x_config.font = sender()->objectName().toInt(); _data.x_config.font = sender()->objectName().toInt();
} }
} }
QFont font; QFont font;
if(!font_table[_data.x_config.font].isEmpty()){ if (!font_table[_data.x_config.font].isEmpty())
{
font.setFamily(font_table[_data.x_config.font]); font.setFamily(font_table[_data.x_config.font]);
font.setPointSize(10); font.setPointSize(10);
if( _data.x_config.font_bold){ if (_data.x_config.font_bold)
{
font.setBold(true); font.setBold(true);
}else{ }
else
{
font.setBold(false); font.setBold(false);
} }
QApplication::setFont(font); QApplication::setFont(font);
}else { }
else
{
qDebug() << "Failed to load font."; qDebug() << "Failed to load font.";
} }
change_style(_data.x_config.style); change_style(_data.x_config.style);
} }
void sui_title::change_style(int index){ void sui_title::change_style(int index)
{
_data.x_config.style=index;
QString style = tr(":/res/qss/") + style_table[index]; QString style = tr(":/res/qss/") + style_table[index];
QFile qss(style); QFile qss(style);
if (qss.open(QFile::ReadOnly)) if (qss.open(QFile::ReadOnly))
@ -189,43 +213,6 @@ void sui_title::mouseDoubleClickEvent(QMouseEvent *event)
Q_UNUSED(event); // 没有实质性的作用只是用来允许event可以不使用用来避免编译器警告 Q_UNUSED(event); // 没有实质性的作用只是用来允许event可以不使用用来避免编译器警告
emit m_max_button->clicked(); emit m_max_button->clicked();
} }
//使用事件过滤器监听标题栏所在的窗体,所以当窗体标题、图标等信息发生改变时,标题栏也应该随之改变
bool sui_title::eventFilter(QObject *obj, QEvent *event)
{
qDebug()<<event->type();
switch ( event->type() ) //判断发生事件的类型
{
case QEvent::WindowTitleChange: //窗口标题改变事件
{
QWidget *pWidget = qobject_cast<QWidget *>(obj); //获得发生事件的窗口对象
if (pWidget)
{
//窗体标题改变,则标题栏标题也随之改变
//m_pTitleLabel->setText(pWidget->windowTitle());
return true;
}
}
break;
case QEvent::WindowIconChange: //窗口图标改变事件
{
QWidget *pWidget = qobject_cast<QWidget *>(obj);
if (pWidget)
{
//窗体图标改变,则标题栏图标也随之改变
QIcon icon = pWidget->windowIcon();
//m_pIconLabel->setPixmap(icon.pixmap(m_pIconLabel->size()));
return true;
}
}
break;
case QEvent::Resize:
up_maximize(); //最大化/还原
return true;
default:
return QWidget::eventFilter(obj, event);
}
return QWidget::eventFilter(obj, event);
}
// 进行最小化、最大化/还原、关闭操作 // 进行最小化、最大化/还原、关闭操作
void sui_title::on_clicked() void sui_title::on_clicked()
{ {
@ -274,6 +261,7 @@ void sui_title::up_maximize()
m_max_button->setStyle(QApplication::style()); m_max_button->setStyle(QApplication::style());
} }
} }
void sui_title::set_title_txt(QString str){ void sui_title::set_title_txt(QString str)
{
m_title_label->setText(str); m_title_label->setText(str);
} }

View File

@ -13,8 +13,10 @@
#include <QFileInfo> #include <QFileInfo>
#include <QMenu> #include <QMenu>
#include <QDir> #include <QDir>
#include <QStyleFactory>
#include <QActionGroup> #include <QActionGroup>
#include <QFontDatabase> #include <QFontDatabase>
#include <QStyleFactory>
#include "xsteam_ex.h" #include "xsteam_ex.h"
class sui_title: public QWidget class sui_title: public QWidget
{ {
@ -26,8 +28,6 @@ public:
protected: protected:
//双击标题栏进行界面的最大化/还原 //双击标题栏进行界面的最大化/还原
void mouseDoubleClickEvent(QMouseEvent *event); void mouseDoubleClickEvent(QMouseEvent *event);
//设置界面标题与图标
bool eventFilter(QObject *obj, QEvent *event);
private slots: private slots:
//进行最小化、最大化/还原、关闭操作 //进行最小化、最大化/还原、关闭操作
void on_clicked(); void on_clicked();

View File

@ -39,6 +39,7 @@ void xsteam_ui::xsteam_init_info_layout()
{ {
info_layout = new QHBoxLayout(); info_layout = new QHBoxLayout();
info_txt_tag = new QLabel(tr("本工具建议配合SteamTools和Steam++使用")); info_txt_tag = new QLabel(tr("本工具建议配合SteamTools和Steam++使用"));
info_txt_tag->setObjectName("INFO");
info_layout->addItem(sparcer_item); info_layout->addItem(sparcer_item);
info_layout->addWidget(info_txt_tag); info_layout->addWidget(info_txt_tag);
info_layout->addItem(sparcer_item); info_layout->addItem(sparcer_item);
@ -62,6 +63,7 @@ void xsteam_ui::xsteam_init_mind_layout()
btn_run_steamdb->setObjectName("STEAM_DB"); btn_run_steamdb->setObjectName("STEAM_DB");
btn_push_manifest = new QPushButton(tr("清单分享")); btn_push_manifest = new QPushButton(tr("清单分享"));
btn_push_manifest->setObjectName("PUSH_MANIFEST"); btn_push_manifest->setObjectName("PUSH_MANIFEST");
btn_push_manifest->setVisible(false);
server_layout->addWidget(server_tag); server_layout->addWidget(server_tag);
server_layout->addWidget(server_txt); server_layout->addWidget(server_txt);
@ -210,7 +212,7 @@ void xsteam_ui::slots_change_src_state(int index)
QPixmap xs_pixmap; QPixmap xs_pixmap;
std::string url; std::string url;
xs_pixmap.load(":res/img/btn/net_wait.png"); xs_pixmap.load(":res/img/btn/net_wait.png");
xs_pixmap = xs_pixmap.scaled(25,25,Qt::KeepAspectRatio); xs_pixmap = xs_pixmap.scaled(20,20,Qt::KeepAspectRatio,Qt::SmoothTransformation);
server_state->setPixmap(xs_pixmap); server_state->setPixmap(xs_pixmap);
for (auto &i : _data.s_data) for (auto &i : _data.s_data)
{ {
@ -229,7 +231,7 @@ void xsteam_ui::slots_change_src_state(int index)
}else{ }else{
_pixmap.load(":/res/img/btn/net_error.png"); _pixmap.load(":/res/img/btn/net_error.png");
} }
_pixmap=_pixmap.scaled(25,25,Qt::KeepAspectRatio); _pixmap=_pixmap.scaled(20,20,Qt::KeepAspectRatio,Qt::SmoothTransformation);
server_state->setPixmap(_pixmap); server_state->setPixmap(_pixmap);
delete xs_curl; delete xs_curl;
xs_curl=nullptr; xs_curl=nullptr;