更新部分圖標
刪除不需要函數
3
.vscode/settings.json
vendored
@ -110,7 +110,8 @@
|
||||
"qheaderview": "cpp",
|
||||
"qabstractlistmodel": "cpp",
|
||||
"qtconcurrentrun": "cpp",
|
||||
"*.in": "cpp"
|
||||
"*.in": "cpp",
|
||||
"qactiongroup": "cpp"
|
||||
},
|
||||
"Codegeex.RepoIndex": true
|
||||
}
|
@ -44,7 +44,7 @@ endif()
|
||||
|
||||
#设置QT .cmake文件路径
|
||||
#自编译QT静态库
|
||||
SET(QT_STATU "dynamic")
|
||||
SET(QT_STATU "static")
|
||||
|
||||
if(QT_STATU STREQUAL "dynamic")
|
||||
SET(QT_DIR "D:/Dev/Qt/6.8.0/mingw_64/lib/cmake")
|
||||
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 791 B |
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 966 B |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 897 B |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 886 B |
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 678 B |
@ -8,7 +8,7 @@ QPushButton#ico_button{
|
||||
image:url(:/res/img/xsteam.png);
|
||||
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;
|
||||
}
|
||||
QPushButton#BTN_SETS{
|
||||
|
@ -13,13 +13,13 @@ QPushButton#ico_button{
|
||||
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;
|
||||
}
|
||||
|
||||
QPushButton:hover{
|
||||
padding-left:1px;
|
||||
padding-top:1px;
|
||||
padding-left:1px;
|
||||
padding-top:1px;
|
||||
}
|
||||
|
||||
QPushButton#BTN_SETS{
|
||||
|
@ -1,50 +1,50 @@
|
||||
#include "sui_title.h"
|
||||
sui_title::sui_title(QWidget *parent)
|
||||
: QWidget (parent),
|
||||
: QWidget(parent),
|
||||
m_menu(nullptr),
|
||||
s_menu(nullptr),
|
||||
f_menu(nullptr)
|
||||
{
|
||||
m_parent=parent;
|
||||
//给成员变量申请内存
|
||||
m_parent = parent;
|
||||
// 给成员变量申请内存
|
||||
m_icon_button = new QPushButton(/*this*/);
|
||||
m_min_button = new QPushButton(this);
|
||||
m_max_button = new QPushButton(this);
|
||||
m_close_button = new QPushButton(this);
|
||||
//初始化图标Label
|
||||
m_icon_button->setFixedSize(35,35);
|
||||
// 初始化图标Label
|
||||
m_icon_button->setFixedSize(35, 35);
|
||||
m_icon_button->setAutoFillBackground(true);
|
||||
m_icon_button->setFlat(true);
|
||||
|
||||
//设置按钮的固定大小、图片、取消边框
|
||||
m_min_button->setIconSize(QSize(25,25));
|
||||
|
||||
// 设置按钮的固定大小、图片、取消边框
|
||||
m_min_button->setIconSize(QSize(25, 25));
|
||||
m_min_button->setAutoFillBackground(true);
|
||||
m_min_button->setFlat(true);
|
||||
//--
|
||||
m_max_button->setIconSize(QSize(25,25));
|
||||
m_max_button->setIconSize(QSize(25, 25));
|
||||
m_max_button->setAutoFillBackground(true);
|
||||
m_max_button->setFlat(true);
|
||||
//--
|
||||
m_close_button->setIconSize(QSize(25,25));
|
||||
m_close_button->setIconSize(QSize(25, 25));
|
||||
m_close_button->setAutoFillBackground(true);
|
||||
m_close_button->setFlat(true);
|
||||
|
||||
//设置窗口部件的名称
|
||||
|
||||
// 设置窗口部件的名称
|
||||
setObjectName(tr("sui_title"));
|
||||
m_icon_button->setObjectName(tr("ico_button"));
|
||||
m_min_button->setObjectName(tr("min_button"));
|
||||
m_max_button->setObjectName(tr("max_button"));
|
||||
m_close_button->setObjectName(tr("close_button"));
|
||||
//给按钮设置静态tooltip,当鼠标移上去时显示tooltip
|
||||
// 给按钮设置静态tooltip,当鼠标移上去时显示tooltip
|
||||
m_min_button->setToolTip(tr("最小化"));
|
||||
m_max_button->setToolTip(tr("最大化"));
|
||||
m_close_button->setToolTip(tr("关闭"));
|
||||
//标题栏布局
|
||||
m_title_label=new QLabel(this);
|
||||
// 标题栏布局
|
||||
m_title_label = new QLabel(this);
|
||||
m_title_label->setAlignment(Qt::AlignCenter);
|
||||
m_title_label->setObjectName(tr("HEAD_STR"));
|
||||
QFont font = m_title_label->font();
|
||||
font.setPointSize(28);
|
||||
font.setPointSize(28);
|
||||
m_title_label->setFont(font);
|
||||
m_layout = new QHBoxLayout(this);
|
||||
m_layout->setAlignment(Qt::AlignCenter);
|
||||
@ -58,9 +58,9 @@ sui_title::sui_title(QWidget *parent)
|
||||
m_layout->setSpacing(5);
|
||||
m_layout->setContentsMargins(0, 0, 0, 0);
|
||||
setFixedHeight(40);
|
||||
setLayout(m_layout);
|
||||
setLayout(m_layout);
|
||||
QFontDatabase database;
|
||||
foreach(const QString & family, database.families(QFontDatabase::SimplifiedChinese))
|
||||
foreach (const QString &family, database.families(QFontDatabase::SimplifiedChinese))
|
||||
{
|
||||
font_table.append(family);
|
||||
}
|
||||
@ -73,8 +73,9 @@ sui_title::sui_title(QWidget *parent)
|
||||
sui_title::~sui_title()
|
||||
{
|
||||
}
|
||||
void sui_title::connect_slots(){
|
||||
//连接三个按钮的信号槽3
|
||||
void sui_title::connect_slots()
|
||||
{
|
||||
// 连接三个按钮的信号槽3
|
||||
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_max_button, SIGNAL(clicked(bool)), this, SLOT(on_clicked()));
|
||||
@ -83,95 +84,118 @@ void sui_title::connect_slots(){
|
||||
void sui_title::slots_ico_menu()
|
||||
{
|
||||
m_menu = new QMenu();
|
||||
//外观
|
||||
if(!s_menu){
|
||||
QActionGroup* s_QGroup = new QActionGroup(this);
|
||||
// 外观
|
||||
if (!s_menu)
|
||||
{
|
||||
QActionGroup *s_QGroup = new QActionGroup(this);
|
||||
s_menu = new QMenu(tr("外观设置"));
|
||||
for(int i=0;i<=style_table.count()-1;i++){
|
||||
QString sName=QFileInfo(style_table[i]).baseName();
|
||||
QAction* s_Action=new QAction(sName,s_QGroup);
|
||||
for (int i = 0; i <= style_table.count() - 1; i++)
|
||||
{
|
||||
QString sName = QFileInfo(style_table[i]).baseName();
|
||||
QAction *s_Action = new QAction(sName, s_QGroup);
|
||||
s_Action->setObjectName(QString::number(i));
|
||||
s_Action->setCheckable(true);
|
||||
if(i==_data.x_config.style){
|
||||
if (i == _data.x_config.style)
|
||||
{
|
||||
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()));
|
||||
s_menu->addAction(s_Action);
|
||||
}
|
||||
}
|
||||
//字体
|
||||
if(!f_menu){
|
||||
QActionGroup* f_QGroup = new QActionGroup(this);
|
||||
// 字体
|
||||
if (!f_menu)
|
||||
{
|
||||
QActionGroup *f_QGroup = new QActionGroup(this);
|
||||
f_menu = new QMenu(tr("字体设置"));
|
||||
for(int i=0;i<=font_table.count()-1;i++){
|
||||
QAction* f_Action=new QAction(font_table[i],f_QGroup);
|
||||
for (int i = 0; i <= font_table.count() - 1; i++)
|
||||
{
|
||||
QAction *f_Action = new QAction(font_table[i], f_QGroup);
|
||||
f_Action->setObjectName(QString::number(i));
|
||||
f_Action->setCheckable(true);
|
||||
if(i==_data.x_config.font){
|
||||
if (i == _data.x_config.font)
|
||||
{
|
||||
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()));
|
||||
f_menu->addAction(f_Action);
|
||||
}
|
||||
QAction *separator = new QAction(nullptr);
|
||||
separator->setSeparator(true);
|
||||
f_menu->addAction(separator);
|
||||
QActionGroup* b_QGroup = new QActionGroup(this);
|
||||
QAction* b_Action=new QAction("字体加粗",b_QGroup);
|
||||
QActionGroup *b_QGroup = new QActionGroup(this);
|
||||
QAction *b_Action = new QAction("字体加粗", b_QGroup);
|
||||
b_Action->setObjectName("font_bold");
|
||||
b_Action->setCheckable(true);
|
||||
if(_data.x_config.font_bold){
|
||||
if (_data.x_config.font_bold)
|
||||
{
|
||||
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()));
|
||||
f_menu->addAction(b_Action);
|
||||
}
|
||||
m_menu->addMenu(s_menu);
|
||||
m_menu->addMenu(f_menu);
|
||||
m_menu->exec(QCursor::pos());
|
||||
delete m_menu;
|
||||
m_menu=nullptr;
|
||||
m_menu = nullptr;
|
||||
}
|
||||
void sui_title::slots_set_style_change()
|
||||
{
|
||||
if(sender()!=nullptr){
|
||||
_data.x_config.style=sender()->objectName().toInt();
|
||||
if (sender() != nullptr)
|
||||
{
|
||||
_data.x_config.style = sender()->objectName().toInt();
|
||||
}
|
||||
change_style(_data.x_config.style);
|
||||
}
|
||||
void sui_title::slots_set_font_change()
|
||||
{
|
||||
if(sender()!=nullptr){
|
||||
if(sender()->objectName()=="font_bold"){
|
||||
if(_data.x_config.font_bold){
|
||||
_data.x_config.font_bold=0;
|
||||
((QAction*)sender())->setChecked(false);
|
||||
}else{
|
||||
_data.x_config.font_bold=1;
|
||||
((QAction*)sender())->setChecked(true);
|
||||
}
|
||||
}else{
|
||||
_data.x_config.font=sender()->objectName().toInt();
|
||||
}
|
||||
}
|
||||
if (sender() != nullptr)
|
||||
{
|
||||
if (sender()->objectName() == "font_bold")
|
||||
{
|
||||
if (_data.x_config.font_bold)
|
||||
{
|
||||
_data.x_config.font_bold = 0;
|
||||
((QAction *)sender())->setChecked(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
_data.x_config.font_bold = 1;
|
||||
((QAction *)sender())->setChecked(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_data.x_config.font = sender()->objectName().toInt();
|
||||
}
|
||||
}
|
||||
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.setPointSize(10);
|
||||
if( _data.x_config.font_bold){
|
||||
if (_data.x_config.font_bold)
|
||||
{
|
||||
font.setBold(true);
|
||||
}else{
|
||||
}
|
||||
else
|
||||
{
|
||||
font.setBold(false);
|
||||
}
|
||||
}
|
||||
QApplication::setFont(font);
|
||||
}else {
|
||||
qDebug()<<"Failed to load font.";
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
qDebug() << "Failed to load font.";
|
||||
}
|
||||
|
||||
change_style(_data.x_config.style);
|
||||
}
|
||||
void sui_title::change_style(int index){
|
||||
QString style=tr(":/res/qss/")+style_table[index];
|
||||
void sui_title::change_style(int index)
|
||||
{
|
||||
_data.x_config.style=index;
|
||||
QString style = tr(":/res/qss/") + style_table[index];
|
||||
QFile qss(style);
|
||||
if (qss.open(QFile::ReadOnly))
|
||||
{
|
||||
@ -183,61 +207,24 @@ void sui_title::change_style(int index){
|
||||
m_parent->update();
|
||||
}
|
||||
|
||||
//双击标题栏进行界面的最大化/还原
|
||||
// 双击标题栏进行界面的最大化/还原
|
||||
void sui_title::mouseDoubleClickEvent(QMouseEvent *event)
|
||||
{
|
||||
Q_UNUSED(event); //没有实质性的作用,只是用来允许event可以不使用,用来避免编译器警告
|
||||
Q_UNUSED(event); // 没有实质性的作用,只是用来允许event可以不使用,用来避免编译器警告
|
||||
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()
|
||||
{
|
||||
//QObject::Sender()返回发送信号的对象的指针,返回类型为QObject *
|
||||
// QObject::Sender()返回发送信号的对象的指针,返回类型为QObject *
|
||||
QPushButton *pButton = qobject_cast<QPushButton *>(sender());
|
||||
QWidget *pWindow = this->window(); //获得标题栏所在的窗口
|
||||
QWidget *pWindow = this->window(); // 获得标题栏所在的窗口
|
||||
if (pWindow->isWindow())
|
||||
{
|
||||
//判断发送信号的对象使哪个按钮
|
||||
// 判断发送信号的对象使哪个按钮
|
||||
if (pButton == m_min_button)
|
||||
{
|
||||
pWindow->showMinimized(); //窗口最小化显示
|
||||
pWindow->showMinimized(); // 窗口最小化显示
|
||||
}
|
||||
else if (pButton == m_max_button)
|
||||
{
|
||||
@ -250,30 +237,31 @@ void sui_title::on_clicked()
|
||||
}
|
||||
}
|
||||
}
|
||||
//最大化/还原
|
||||
// 最大化/还原
|
||||
void sui_title::up_maximize()
|
||||
{
|
||||
QWidget *pWindow = this->window(); //获得标题栏所在的窗口
|
||||
QWidget *pWindow = this->window(); // 获得标题栏所在的窗口
|
||||
if (pWindow->isWindow())
|
||||
{
|
||||
bool bMaximize = pWindow->isFullScreen(); //判断窗口是不是最大化状态,是则返回true,否则返回false
|
||||
bool bMaximize = pWindow->isFullScreen(); // 判断窗口是不是最大化状态,是则返回true,否则返回false
|
||||
if (bMaximize)
|
||||
{
|
||||
//目前窗口是最大化状态,则最大化/还原的toolTip设置为"Restore"
|
||||
// 目前窗口是最大化状态,则最大化/还原的toolTip设置为"Restore"
|
||||
m_max_button->setToolTip(tr("Restore"));
|
||||
//设置按钮的属性名为"maximizeProperty"
|
||||
// 设置按钮的属性名为"maximizeProperty"
|
||||
m_max_button->setProperty("maximizeProperty", tr("restore"));
|
||||
}
|
||||
else
|
||||
{
|
||||
//目前窗口是还原状态,则最大化/还原的toolTip设置为"Maximize"
|
||||
// 目前窗口是还原状态,则最大化/还原的toolTip设置为"Maximize"
|
||||
m_max_button->setToolTip(tr("Maximize"));
|
||||
//设置按钮的属性名为"maximizeProperty"
|
||||
// 设置按钮的属性名为"maximizeProperty"
|
||||
m_max_button->setProperty("maximizeProperty", tr("maximize"));
|
||||
}
|
||||
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);
|
||||
}
|
@ -13,8 +13,10 @@
|
||||
#include <QFileInfo>
|
||||
#include <QMenu>
|
||||
#include <QDir>
|
||||
#include <QStyleFactory>
|
||||
#include <QActionGroup>
|
||||
#include <QFontDatabase>
|
||||
#include <QStyleFactory>
|
||||
#include "xsteam_ex.h"
|
||||
class sui_title: public QWidget
|
||||
{
|
||||
@ -26,8 +28,6 @@ public:
|
||||
protected:
|
||||
//双击标题栏进行界面的最大化/还原
|
||||
void mouseDoubleClickEvent(QMouseEvent *event);
|
||||
//设置界面标题与图标
|
||||
bool eventFilter(QObject *obj, QEvent *event);
|
||||
private slots:
|
||||
//进行最小化、最大化/还原、关闭操作
|
||||
void on_clicked();
|
||||
|
@ -39,6 +39,7 @@ void xsteam_ui::xsteam_init_info_layout()
|
||||
{
|
||||
info_layout = new QHBoxLayout();
|
||||
info_txt_tag = new QLabel(tr("本工具建议配合SteamTools和Steam++使用"));
|
||||
info_txt_tag->setObjectName("INFO");
|
||||
info_layout->addItem(sparcer_item);
|
||||
info_layout->addWidget(info_txt_tag);
|
||||
info_layout->addItem(sparcer_item);
|
||||
@ -62,6 +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);
|
||||
|
||||
server_layout->addWidget(server_tag);
|
||||
server_layout->addWidget(server_txt);
|
||||
@ -210,7 +212,7 @@ void xsteam_ui::slots_change_src_state(int index)
|
||||
QPixmap xs_pixmap;
|
||||
std::string url;
|
||||
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);
|
||||
for (auto &i : _data.s_data)
|
||||
{
|
||||
@ -229,7 +231,7 @@ void xsteam_ui::slots_change_src_state(int index)
|
||||
}else{
|
||||
_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);
|
||||
delete xs_curl;
|
||||
xs_curl=nullptr;
|
||||
|