Explorar o código

V0.2.1
1、抽象完成了弹窗基类
2、添加了webapi和mqtt功能

Apple hai 3 semanas
pai
achega
6403697575

+ 0 - 0
.vscode/launch.json


+ 6 - 3
CMakeLists.txt

@@ -71,10 +71,12 @@ endif()
 
 #设置库和可执行文件的输出位置
 set(EXECUTABLE_OUTPUT_PATH ${exec_out_path})
-set(LIBRARY_OUTPUT_PATH ${exec_out_path})
+set(LIBRARY_OUTPUT_PATH ${BUILD_LIB_PATH})
 
 #指定库的位置,方便寻找
 link_directories(${BUILD_LIB_PATH})
+link_directories(${BUILD_LIB_PATH}/Debug)
+link_directories(${BUILD_LIB_PATH}/Release)
 
 
 #=========================================================
@@ -98,7 +100,8 @@ endif()
 if(CMAKE_CXX_COMPILER_ID MATCHES GNU)
 #    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
 #    #添加编译参数,这个参数会应用到全局,C和C++都会生效
-   add_compile_options(-Wall -O2)
+   add_compile_options(-Wall -g -O0)
+#    add_compile_options(-O2)
     #添加GCC的宏定义
     add_compile_definitions(GCC)
 endif()
@@ -187,5 +190,5 @@ file(GLOB GLOBAL_SRC
 
 add_subdirectory(${CMAKE_SOURCE_DIR}/SettingLibrary)
 add_subdirectory(${CMAKE_SOURCE_DIR}/show1)
-
+add_subdirectory(${CMAKE_SOURCE_DIR}/show2)
 

+ 29 - 10
SettingLibrary/CMakeLists.txt

@@ -7,6 +7,13 @@ set(libName ACAServerSetting)
 
 #包含源文件
 file(GLOB LOCAL_SRC
+    ${CMAKE_SOURCE_DIR}/External/common/Shadow/*.cpp
+    ${CMAKE_SOURCE_DIR}/External/common/WebAPI/*.cpp
+    ${CMAKE_SOURCE_DIR}/External/common/Thread/*.cpp
+    ${CMAKE_SOURCE_DIR}/External/common/combox/*.cpp
+    ${CMAKE_SOURCE_DIR}/External/module/mqtt/*.cpp
+
+
     ${CMAKE_CURRENT_SOURCE_DIR}/*.qrc
     ${CMAKE_CURRENT_SOURCE_DIR}/*.rc
     ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
@@ -20,25 +27,27 @@ file(GLOB LOCAL_SRC
     ${CMAKE_CURRENT_SOURCE_DIR}/Modules/Noise/*.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/UIStyle/*.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/DialogBase/*.cpp
-
-    # ${CMAKE_SOURCE_DIR}/External/module/Logs/*.cpp
-    # ${CMAKE_SOURCE_DIR}/External/module/ThreadPool/*.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/common/LHLog/*.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/Network/*.cpp
     
+    ${LHQLog_SOURCE_DIRS}/*.cpp
+    ${LHHTTPAPI_SOURCE_DIRS}/*.cpp
 )
 
 
+# 开启PIC
+set(CMAKE_POSITION_INDEPENDENT_CODE ON)
 
 # 生成可执行程序
-
 add_library(${libName} SHARED
     # WIN32
     # ${GLOBAL_SRC}
     ${LOCAL_SRC} 
 )
 
-target_compile_definitions(${libName} PRIVATE
-    ACASERVERSETINFO_LIBRARY
-)
+# target_compile_definitions(${libName} PRIVATE
+#     ACASERVERSETINFO_LIBRARY
+# )
 
 # set_target_properties(${libName} PROPERTIES
 #     DEBUG_POSTFIX d
@@ -51,9 +60,13 @@ target_include_directories(${libName} PRIVATE
     ${CMAKE_CURRENT_SOURCE_DIR}
 
     ${CMAKE_SOURCE_DIR}/External/common
+    ${CMAKE_SOURCE_DIR}/External/common/Shadow
+    ${CMAKE_SOURCE_DIR}/External/common/WebAPI
+    ${CMAKE_SOURCE_DIR}/External/common/Thread
+    ${CMAKE_SOURCE_DIR}/External/common/combox
     ${CMAKE_SOURCE_DIR}/External/module
-    # ${CMAKE_SOURCE_DIR}/External/module/ThreadPool
-    # ${CMAKE_SOURCE_DIR}/External/module/RingQueue
+    ${CMAKE_SOURCE_DIR}/External/module/mqtt
+
 
     ${CMAKE_CURRENT_SOURCE_DIR}/DataBase
     ${CMAKE_CURRENT_SOURCE_DIR}/Modules
@@ -64,19 +77,25 @@ target_include_directories(${libName} PRIVATE
     ${CMAKE_CURRENT_SOURCE_DIR}/Modules/Noise
     ${CMAKE_CURRENT_SOURCE_DIR}/UIStyle
     ${CMAKE_CURRENT_SOURCE_DIR}/DialogBase
+    ${CMAKE_CURRENT_SOURCE_DIR}/common/LHLog
+    ${CMAKE_CURRENT_SOURCE_DIR}/Network
 
     ${spdlog_INCLUDE_DIR}
+    ${LHQLog_INCLUDE_DIRS}
+    ${LHHTTPAPI_INCLUDE_DIRS}
+    ${qmqtt_INCLUDE_DIR}
 )
 
 
 target_link_libraries(${libName} PRIVATE
     Qt${QT_VERSION_MAJOR}::Widgets
     Qt${QT_VERSION_MAJOR}::Core
+    Qt${QT_VERSION_MAJOR}::Network
 
 )
 
 target_link_libraries(${libName} PRIVATE
     ${spdlog_LIBRARY}
-
+    ${qmqtt_LIBRARY}
 )
 

+ 198 - 4
SettingLibrary/DialogBase/DialogBase.cpp

@@ -5,15 +5,30 @@
 #include <QLabel>
 #include <QPushButton>
 #include <QBoxLayout>
-#include <qboxlayout.h>
-#include <qpushbutton.h>
+#include <QStyle>
+
+
+#include "OneShadowEffect.h"
 
 
 DialogBase::DialogBase(QWidget *parent)
     : QDialog(parent)
 {
+    m_logger = spdlog::get("ACASetting");
+    if(m_logger == nullptr)
+    {
+        fmt::print("DialogBase: 未发现ACASetting日志记录器,请检查日志记录器是否已初始化。\n");
+        return;
+    }
 
+    initUI();
+    initSettings();
+    /* 设置qss */
+    connect(&UIStyle, &UIStyleManager::signal_qssChanged, this, &DialogBase::do_setQSS);
+    /* 设置默认的UI */
+    setQSS();
 }
+
 DialogBase::~DialogBase()
 {
 
@@ -22,7 +37,8 @@ DialogBase::~DialogBase()
 /* 设置标题 */
 void DialogBase::setTitle(const QString &title, QSize size)
 {
-
+    m_labelTitle->setText(title);
+    m_labelTitle->setFixedSize(size);
 }
 
 /* 获取标题 */
@@ -31,9 +47,56 @@ QString DialogBase::getTitle() const
     return m_labelTitle ? m_labelTitle->text() : QString();
 }
 
+/* 设置内容容器 */
+bool DialogBase::setContentWidget(QWidget *widget)
+{
+    if(widget == nullptr)
+    {
+        SPDLOG_LOGGER_ERROR(m_logger, "设置内容容器失败,widget为nullptr");
+        return false;
+    }
+    if(m_widgetContent != nullptr)
+    {
+        m_layoutBackground->removeWidget(m_widgetContent);
+        delete m_widgetContent;
+        m_widgetContent = nullptr;
+    }
+    QSize size = widget->size();
+    m_widgetContent = widget;
+    m_layoutBackground->insertWidget(1, m_widgetContent);
+    m_widgetContent->resize(size);
+    return true;
+}
+
+/* 设置低栏容器 */
+bool DialogBase::setBottomWidget(QWidget *widget)
+{
+    if(widget == nullptr)
+    {
+        SPDLOG_LOGGER_ERROR(m_logger, "设置底部容器失败,widget为nullptr");
+        return false;
+    }
+    if(m_widgetBottom != nullptr)
+    {
+        m_layoutBackground->removeWidget(m_widgetBottom);
+        delete m_widgetBottom;
+        m_widgetBottom = nullptr;
+    }
+    m_widgetBottom = widget;
+    m_layoutBackground->insertWidget(2, m_widgetBottom);
+
+    return true;
+}
+
 /* 初始化UI */
 void DialogBase::initUI()
 {
+    /*--------------------- 设置对话框的属性 -----------------------*/
+    this->setWindowFlags(Qt::FramelessWindowHint | Qt::Dialog);
+    this->setAttribute(Qt::WA_TranslucentBackground, true);
+    // this->setObjectName("DialogBase");
+
+
     /*--------------------- 初始化背景容器 -----------------------*/
     m_widgetBackground = new QWidget(this);
     m_widgetBackground->setObjectName("widget_background");
@@ -69,8 +132,84 @@ void DialogBase::initUI()
     m_pBtn_Close = new QPushButton(m_widgetTop);
     m_pBtn_Close->setObjectName("pBtn_Close");
     m_pBtn_Close->resize(32, 32);
+    /* 安装事件过滤器,主要是处理鼠标悬停事件 */
+    m_pBtn_Close->installEventFilter(this);
     /* 重新布局顶栏 */
     layoutTop();
+
+    /*--------------------- 初始化内容栏 -----------------------*/
+    // m_widgetContent = new QWidget(this);
+    // m_layoutBackground->addWidget(m_widgetContent);
+
+    /*--------------------- 初始底栏 -----------------------*/
+    m_widgetBottom = new QWidget(this);
+    m_widgetBottom->setObjectName("widget_bottom");
+    m_widgetBottom->setFixedHeight(88);
+    m_layoutBackground->addWidget(m_widgetBottom);
+    QHBoxLayout* bottomHBoxLayout = new QHBoxLayout(m_widgetBottom);
+    m_widgetBottom->setLayout(bottomHBoxLayout);
+    /* 初始化取消按钮 */
+    m_pBtn_Cancel = new QPushButton(m_widgetBottom);
+    m_pBtn_Cancel->setObjectName("pBtn_Cancel");
+    m_pBtn_Cancel->setText("取消");
+    m_pBtn_Cancel->setFixedSize(60, 32);
+    bottomHBoxLayout->addWidget(m_pBtn_Cancel, 0, Qt::AlignRight | Qt::AlignVCenter);
+    /* 初始化确认按钮 */
+    m_pBtn_OK = new QPushButton(m_widgetBottom);
+    m_pBtn_OK->setObjectName("pBtn_OK");
+    m_pBtn_OK->setText("确定");
+    m_pBtn_OK->setFixedSize(60, 32);
+    bottomHBoxLayout->addWidget(m_pBtn_OK, 0, Qt::AlignRight | Qt::AlignVCenter);
+    /* 添加一个底部横向弹簧 */
+    bottomHBoxLayout->insertStretch(0, 1);
+    /* 设置底部按钮的间距 */
+    bottomHBoxLayout->setContentsMargins(32, 24, 32, 32);
+    bottomHBoxLayout->setSpacing(16);
+
+    /*--------------------- 设置整体背景 -----------------------*/
+    /* 这个背景需要在初始化所有的widget控件之后再设置 */
+    // auto screenRect = QGuiApplication::screenAt(QCursor::pos())->geometry();
+    // this->resize(screenRect.width(), screenRect.height());
+    // /* 设置设置区域居中显示 */
+    // m_widgetBackground->move(screenRect.width() / 2 - m_widgetBackground->width() / 2,
+    //     screenRect.height() / 2 - m_widgetBackground->height() / 2);
+    
+    /*--------------------- 创建阴影 -----------------------*/
+    auto pShadow = new OneShadowEffect(this);
+    m_widgetBackground->setGraphicsEffect(pShadow);
+
+}
+
+/* 初始化其他设置 */
+void DialogBase::initSettings()
+{
+    /* 初始化变量 */
+    m_lastPos = QPoint(0, 0);
+    /* 连接信号和槽 */
+    connect(m_pBtn_Close, &QPushButton::clicked, this, &DialogBase::do_pBtn_Close_Clicked);
+    connect(m_pBtn_OK, &QPushButton::clicked, this, &DialogBase::do_pBtn_OK_Clicked);
+    connect(m_pBtn_Cancel, &QPushButton::clicked, this, &DialogBase::do_pBtnCancel_clicked);
+
+    /* 设置样式表 */
+    // setQSS();
+}
+
+/* 加载QSS */
+void DialogBase::setQSS()
+{
+    /* 获取样式表路径 */
+    QString qssPath = UIStyle.getQSSPath() + "/dialogbase.qss";
+    QFile file(qssPath);
+    if(file.open(QFile::ReadOnly))
+    {
+        QString qss = file.readAll();
+        file.close();
+        this->setStyleSheet(qss);
+    } else
+    {
+        SPDLOG_LOGGER_ERROR(m_logger, "打开QSS文件失败: {}", qssPath.toStdString());
+        SPDLOG_LOGGER_ERROR(m_logger, "错误信息: {}", file.errorString().toStdString());
+    }
 }
 
 /* 设置top栏的位置布局,标题和关闭按钮的高度起始位置不一样,不方便使用布局,所有手动修改坐标
@@ -83,6 +222,19 @@ void DialogBase::layoutTop()
     m_pBtn_Close->move(x, 12);
 }
 
+/* 确认按钮点击事件 */
+void DialogBase::do_pBtn_OK_Clicked()
+{
+    m_isOK = true;
+    this->accept();
+}
+
+/* 设置QSS */
+void DialogBase::do_setQSS(EUIStyle style)
+{
+    setQSS();
+}
+
 /* 重写鼠标按下事件 */
 void DialogBase::mousePressEvent(QMouseEvent *event)
 {
@@ -104,7 +256,8 @@ void DialogBase::mouseMoveEvent(QMouseEvent *event)
 
     int dx = event->globalX() - m_lastPos.x();
     int dy = event->globalY() - m_lastPos.y();
-    m_widgetBackground->move(m_widgetBackground->x() + dx, m_widgetBackground->y() + dy);
+    // m_widgetBackground->move(m_widgetBackground->x() + dx, m_widgetBackground->y() + dy);
+    move(x() + dx, y() + dy);
     m_lastPos = event->globalPos();
     event->accept();
 }
@@ -115,3 +268,44 @@ void DialogBase::mouseReleaseEvent(QMouseEvent *event)
     event->accept();
 }
 
+/* 显示事件 */
+void DialogBase::showEvent(QShowEvent *event)
+{
+    QDialog::showEvent(event);
+
+    /* 重新布局顶栏 */
+    layoutTop();
+}
+
+
+/* 重新设置大小 */
+void DialogBase::resizeEvent(QResizeEvent *event)
+{
+    QDialog::resizeEvent(event);
+
+    /* 重新布局顶栏 */ 
+    layoutTop();
+}
+
+/* 事件过滤器 */
+bool DialogBase::eventFilter(QObject *watched, QEvent *event)
+{
+    if(watched == m_pBtn_Close && event->type() == QEvent::HoverEnter)
+    {
+        m_pBtn_Close->setProperty("Hover", true);
+        m_pBtn_Close->style()->unpolish(m_pBtn_Close);
+        m_pBtn_Close->style()->polish(m_pBtn_Close);
+        m_pBtn_Close->update();
+        return true;
+    }
+    else if(watched == m_pBtn_Close && event->type() == QEvent::HoverLeave)
+    {
+        m_pBtn_Close->setProperty("Hover", false);
+        m_pBtn_Close->style()->unpolish(m_pBtn_Close);
+        m_pBtn_Close->style()->polish(m_pBtn_Close);
+        m_pBtn_Close->update();
+        return true;
+    }
+    return QDialog::eventFilter(watched, event);
+}
+

+ 37 - 2
SettingLibrary/DialogBase/DialogBase.h

@@ -2,6 +2,8 @@
 #define __DIALOGBASE_H__
 
 #include <QDialog>
+#include "spdlog/spdlog.h"
+#include "UIStyleManager.h"
 
 class QMouseEvent;
 class QVBoxLayout;
@@ -13,6 +15,7 @@ class QPoint;
 
 /**
  * @brief 这个基础类主要为了实现弹窗通用的拖动和阴影效果
+ *        1、父类的QSS通过信号来主动设置,避免和子类冲突
  * 
  */
 class DialogBase : public QDialog
@@ -20,7 +23,7 @@ class DialogBase : public QDialog
     Q_OBJECT
 public:
     explicit DialogBase(QWidget *parent = nullptr);
-    ~DialogBase();
+    virtual ~DialogBase();
 
     /* 设置标题 */
     void setTitle(const QString &title, QSize size = QSize(120, 18));
@@ -28,12 +31,36 @@ public:
     /* 获取标题 */
     QString getTitle() const;
 
+protected:
+    /* --------------------------------------------------
+     * 给子类使用的内部接口
+     * --------------------------------------------------*/
+    /* 设置内容容器 */
+    bool setContentWidget(QWidget *widget);
+    /* 设置底栏容器 */
+    bool setBottomWidget(QWidget *widget);
+
 protected:
     /* 初始化UI */
     virtual void initUI();
+    /* 初始化其他设置 */
+    virtual void initSettings();
+    /* 加载QSS */
+    virtual void setQSS();
     /* 设置top栏的位置布局 */
     void layoutTop();
 
+protected slots:
+    /* 关闭按钮点击事件 */
+    void do_pBtn_Close_Clicked() { this->close(); }
+    /* 确认按钮点击事件 */
+    void do_pBtn_OK_Clicked();
+    /* 取消按钮点击事件 */
+    void do_pBtnCancel_clicked() { this->reject(); }
+
+    /* 设置QSS */
+    void do_setQSS(EUIStyle style);
+
 protected:
     /* 重写鼠标按下事件 */
     void mousePressEvent(QMouseEvent *event) override;
@@ -41,10 +68,16 @@ protected:
     void mouseMoveEvent(QMouseEvent *event) override;
     /* 重写鼠标释放事件 */
     void mouseReleaseEvent(QMouseEvent *event) override;
-
+    /* 显示事件 */
+    void showEvent(QShowEvent *event) override;
     /* 重新设置大小 */
+    void resizeEvent(QResizeEvent *event) override;
+
+    /* 事件过滤器 */
+    bool eventFilter(QObject *watched, QEvent *event) override;
 
 protected:
+    std::shared_ptr<spdlog::logger> m_logger = nullptr;
     QPoint m_lastPos;                           /* 鼠标点击的位置 */
 
     QWidget* m_widgetBackground = nullptr;      /* 背景容器,这个才是真正容纳所有内容的容器 */
@@ -58,6 +91,8 @@ protected:
     QPushButton* m_pBtn_Close = nullptr;        /* 关闭按钮 */
     QPushButton* m_pBtn_OK = nullptr;           /* 确认按钮 */
     QPushButton* m_pBtn_Cancel = nullptr;       /* 取消按钮 */
+
+    bool m_isOK = false;                        /* 是否点击了确认按钮 */
 };
 
 

+ 27 - 2
SettingLibrary/Modules/Basic/basicwidget.cpp

@@ -2,22 +2,47 @@
 #include "ui_basicwidget.h"
 #include "compareitemlistdialog.h"
 
+#include "DialogBase.h"
+#include "UIStyleManager.h"
+#include "customcombobox.h"
+
+
 BasicWidget::BasicWidget(QWidget *parent) :
     QWidget(parent),
     ui(new Ui::BasicWidget)
 {
     ui->setupUi(this);
 
-    connect(ui->btnCompareItem, &QPushButton::clicked, this, &BasicWidget::OnBtnCompareItemClicked);
+    
+
+
+
+    connect(ui->pBtn_compareItem, &QPushButton::clicked, this, &BasicWidget::do_pBtn_CompareItemClicked);
+
+    /* 设置UI */
+    UIStyle.registerWidget(this);
+    /* 设置下拉框选项 */
+    ui->comBox_notConsistency->setViewShadowEffect();
+    ui->comBox_driverName->setViewShadowEffect();
+    ui->comBox_recordMode->setViewShadowEffect();
+
+
+    /* 测试用 */
+    ui->comBox_driverName->addItem("AISO");
 }
 
 BasicWidget::~BasicWidget()
 {
+    UIStyle.unregisterWidget(this);
     delete ui;
 }
 
-void BasicWidget::OnBtnCompareItemClicked()
+void BasicWidget::do_pBtn_CompareItemClicked()
 {
     CompareItemListDialog dlg;
     dlg.exec();
+    // DialogBase dlg;
+    // dlg.setTitle("测试标题");
+    // dlg.resize(400, 300);
+    // dlg.exec();
 }

+ 7 - 1
SettingLibrary/Modules/Basic/basicwidget.h

@@ -7,6 +7,11 @@ namespace Ui {
 class BasicWidget;
 }
 
+
+/**
+ * @brief 这个页面的基础信息从mqtt获取
+ * 
+ */
 class BasicWidget : public QWidget
 {
     Q_OBJECT
@@ -16,7 +21,8 @@ public:
     ~BasicWidget();
 
 private slots:
-    void OnBtnCompareItemClicked();
+    /* 对比项配置 */
+    void do_pBtn_CompareItemClicked();
 
 private:
     Ui::BasicWidget *ui;

+ 74 - 182
SettingLibrary/Modules/Basic/basicwidget.ui

@@ -6,7 +6,7 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>352</width>
+    <width>361</width>
     <height>620</height>
    </rect>
   </property>
@@ -14,124 +14,7 @@
    <string>Form</string>
   </property>
   <property name="styleSheet">
-   <string notr="true">QWidget#widget
-{
-	background: transparent;
-	border-bottom: 1px solid #E9E9E9;
-}
-
-QLabel
-{
-	font-weight: 400;
-	font-size: 14px;
-	color: #3A3F63;
-}
-
-QLineEdit
-{
-	background: #FFFFFF;
-	border-radius: 4px;
-	border: 1px solid #E6E9F4;
-	padding-left: 12px;
-	font-weight: 400;
-	font-size: 14px;
-	color: #3A3F63;
-}
-QLineEdit:hover,QLineEdit:focus
-{
-	border: 1px solid #4458FE;
-}
-
-QCheckBox
-{
-	font-weight: 400;
-	font-size: 14px;
-	color: #3A3F63;
-}
-QCheckBox::indicator
-{
-	width: 16px; 
-	height: 16px;
-}
-QCheckBox::indicator:unchecked
-{
-	image: url(:/unchecked.png);
-}
-QCheckBox::indicator:checked
-{
-	image: url(:/checked.png);
-}
-
-QPushButton
-{
-	background: #FFFFFF;
-	border-radius: 4px;
-	border: 1px solid #E6E9F4;
-	font-weight: 500;
-	font-size: 14px;
-	color: #3A3F63;
-}
-QPushButton:hover
-{
-	border: 1px solid #4458FE;
-	color: #4458FE;
-}
-
-QComboBox
-{
-	padding-left: 12px;
-	font-weight: 400;
-	font-size: 14px;
-	color: #3A3F63;
-	background: #FFFFFF;
-	border-radius: 4px;
-	border: 1px solid #E6E9F4;
-}
-QComboBox:hover,QComboBox:on
-{
-	border: 1px solid #4458FE;
-}
-QComboBox QAbstractItemView
-{
-	margin-left: 4px;
-	margin-right: 20px;
-	margin-bottom: 4px;
-	font-size: 14px;
-	background-color: #FFFFFF;
-	outline:0px;
-	border-radius: 4px;
-}
-QComboBox QAbstractItemView::item {
-    border-radius: 4px;
-	color: #3A3F63;
-    height: 40px;
-	background-color: #FFFFFF;
-	font-size: 14px;
-	padding-left: 12px;
-}
-QComboBox QAbstractItemView::item:hover 
-{
-	font-weight: 500;
-    color: #3A3F63;
-	background-color: #EEF2FF;
-}
-QComboBox QAbstractItemView::item:selected
-{
-	font-weight: 500;
-    color: #3A3F63;
-	background-color: #EEF2FF;
-}
-QComboBox::down-arrow
-{
-	padding-right: 8px;
-	width: 16px;
-	image: url(:/down_arrow.png);
-}
-QComboBox::drop-down
-{	
-	width: 16px;
-	background-color: transparent;
-}</string>
+   <string notr="true"/>
   </property>
   <layout class="QVBoxLayout" name="verticalLayout_2">
    <property name="spacing">
@@ -157,8 +40,8 @@ QComboBox::drop-down
      <property name="verticalSpacing">
       <number>16</number>
      </property>
-     <item row="4" column="1">
-      <widget class="QComboBox" name="comboBoxNotConsistency">
+     <item row="1" column="1">
+      <widget class="CustomComboBox" name="comBox_recordMode">
        <property name="minimumSize">
         <size>
          <width>260</width>
@@ -173,23 +56,17 @@ QComboBox::drop-down
        </property>
       </widget>
      </item>
-     <item row="0" column="1">
-      <widget class="QLineEdit" name="lineEditServerIP">
-       <property name="minimumSize">
-        <size>
-         <width>260</width>
-         <height>32</height>
-        </size>
+     <item row="1" column="0">
+      <widget class="QLabel" name="label_2">
+       <property name="text">
+        <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;录音模式:</string>
        </property>
-       <property name="maximumSize">
-        <size>
-         <width>260</width>
-         <height>32</height>
-        </size>
+       <property name="alignment">
+        <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
        </property>
       </widget>
      </item>
-     <item row="4" column="0">
+     <item row="3" column="0">
       <widget class="QLabel" name="label_5">
        <property name="text">
         <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;不一致判断:</string>
@@ -200,7 +77,7 @@ QComboBox::drop-down
       </widget>
      </item>
      <item row="2" column="1">
-      <widget class="QComboBox" name="comboBoxDriverName">
+      <widget class="CustomComboBox" name="comBox_driverName">
        <property name="minimumSize">
         <size>
          <width>260</width>
@@ -215,38 +92,18 @@ QComboBox::drop-down
        </property>
       </widget>
      </item>
-     <item row="2" column="0">
-      <widget class="QLabel" name="label_3">
-       <property name="text">
-        <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;驱动名称:</string>
-       </property>
-       <property name="alignment">
-        <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-       </property>
-      </widget>
-     </item>
-     <item row="3" column="0">
-      <widget class="QLabel" name="label_4">
-       <property name="text">
-        <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;本地IP地址:</string>
-       </property>
-       <property name="alignment">
-        <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-       </property>
-      </widget>
-     </item>
-     <item row="1" column="0">
-      <widget class="QLabel" name="label_2">
+     <item row="0" column="0">
+      <widget class="QLabel" name="label">
        <property name="text">
-        <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;录音模式:</string>
+        <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;服务端IP:</string>
        </property>
        <property name="alignment">
         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
        </property>
       </widget>
      </item>
-     <item row="1" column="1">
-      <widget class="QComboBox" name="comboBoxRecordMode">
+     <item row="3" column="1">
+      <widget class="CustomComboBox" name="comBox_notConsistency">
        <property name="minimumSize">
         <size>
          <width>260</width>
@@ -261,8 +118,8 @@ QComboBox::drop-down
        </property>
       </widget>
      </item>
-     <item row="3" column="1">
-      <widget class="QComboBox" name="comboBoxLocalIP">
+     <item row="0" column="1">
+      <widget class="QLineEdit" name="lineEdit_serverIP">
        <property name="minimumSize">
         <size>
          <width>260</width>
@@ -272,15 +129,15 @@ QComboBox::drop-down
        <property name="maximumSize">
         <size>
          <width>260</width>
-         <height>16777215</height>
+         <height>32</height>
         </size>
        </property>
       </widget>
      </item>
-     <item row="0" column="0">
-      <widget class="QLabel" name="label">
+     <item row="2" column="0">
+      <widget class="QLabel" name="label_3">
        <property name="text">
-        <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;服务端IP:</string>
+        <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;驱动名称:</string>
        </property>
        <property name="alignment">
         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@@ -291,24 +148,33 @@ QComboBox::drop-down
    </item>
    <item>
     <widget class="QWidget" name="widget" native="true">
-     <layout class="QVBoxLayout" name="verticalLayout">
-      <property name="spacing">
-       <number>16</number>
-      </property>
+     <property name="minimumSize">
+      <size>
+       <width>0</width>
+       <height>120</height>
+      </size>
+     </property>
+     <layout class="QGridLayout" name="gridLayout_2">
       <property name="leftMargin">
        <number>0</number>
       </property>
       <property name="topMargin">
-       <number>0</number>
+       <number>12</number>
       </property>
       <property name="rightMargin">
        <number>0</number>
       </property>
       <property name="bottomMargin">
-       <number>24</number>
+       <number>12</number>
+      </property>
+      <property name="horizontalSpacing">
+       <number>0</number>
       </property>
-      <item>
-       <widget class="QCheckBox" name="checkBox">
+      <property name="verticalSpacing">
+       <number>18</number>
+      </property>
+      <item row="0" column="0">
+       <widget class="QCheckBox" name="checkBox_enableMultiCPU">
         <property name="minimumSize">
          <size>
           <width>0</width>
@@ -324,10 +190,16 @@ QComboBox::drop-down
         <property name="text">
          <string>开启多核对比</string>
         </property>
+        <property name="iconSize">
+         <size>
+          <width>16</width>
+          <height>16</height>
+         </size>
+        </property>
        </widget>
       </item>
-      <item>
-       <widget class="QCheckBox" name="checkBox_2">
+      <item row="0" column="1">
+       <widget class="QCheckBox" name="checkBox_enableDebug">
         <property name="minimumSize">
          <size>
           <width>0</width>
@@ -343,10 +215,16 @@ QComboBox::drop-down
         <property name="text">
          <string>开启调试日志</string>
         </property>
+        <property name="iconSize">
+         <size>
+          <width>16</width>
+          <height>16</height>
+         </size>
+        </property>
        </widget>
       </item>
-      <item>
-       <widget class="QCheckBox" name="checkBox_3">
+      <item row="1" column="0" colspan="2">
+       <widget class="QCheckBox" name="checkBox_clearHistoryDir">
         <property name="minimumSize">
          <size>
           <width>0</width>
@@ -364,8 +242,8 @@ QComboBox::drop-down
         </property>
        </widget>
       </item>
-      <item>
-       <widget class="QCheckBox" name="checkBox_4">
+      <item row="2" column="0" colspan="2">
+       <widget class="QCheckBox" name="checkBox_enableSoundCardName">
         <property name="minimumSize">
          <size>
           <width>0</width>
@@ -389,7 +267,7 @@ QComboBox::drop-down
    <item>
     <layout class="QHBoxLayout" name="horizontalLayout">
      <item>
-      <widget class="QPushButton" name="btnRestore">
+      <widget class="QPushButton" name="pBtn_restore">
        <property name="minimumSize">
         <size>
          <width>102</width>
@@ -421,7 +299,7 @@ QComboBox::drop-down
       </spacer>
      </item>
      <item>
-      <widget class="QPushButton" name="btnCompareItem">
+      <widget class="QPushButton" name="pBtn_compareItem">
        <property name="minimumSize">
         <size>
          <width>102</width>
@@ -441,6 +319,13 @@ QComboBox::drop-down
      </item>
     </layout>
    </item>
+   <item>
+    <widget class="QLabel" name="label_tip">
+     <property name="text">
+      <string>可恢复为编辑时的初始字段信息</string>
+     </property>
+    </widget>
+   </item>
    <item>
     <spacer name="verticalSpacer">
      <property name="orientation">
@@ -456,6 +341,13 @@ QComboBox::drop-down
    </item>
   </layout>
  </widget>
+ <customwidgets>
+  <customwidget>
+   <class>CustomComboBox</class>
+   <extends>QComboBox</extends>
+   <header location="global">customcombobox.h</header>
+  </customwidget>
+ </customwidgets>
  <resources/>
  <connections/>
 </ui>

+ 23 - 8
SettingLibrary/Modules/Basic/compareitemlistdialog.cpp

@@ -1,22 +1,37 @@
 #include "compareitemlistdialog.h"
-#include "ui_compareitemlistdialog.h"
+#include "ui_compareitemlistwidget.h"
 #include "compareitemdialog.h"
 
+#include "UIStyleManager.h"
+
 CompareItemListDialog::CompareItemListDialog(QWidget *parent) :
-    QDialog(parent),
-    ui(new Ui::CompareItemListDialog)
+    DialogBase(parent),
+    ui(new Ui::CompareItemListWidget)
 {
-    ui->setupUi(this);
+    QWidget* widgetContent = new QWidget(this);
+    ui->setupUi(widgetContent);
+
+    /* 设置内容 */
+    setContentWidget(widgetContent);
+    
+    /* 设置底栏 */
+    // setBottomWidget(ui->widgetBottom);
+
+    /* 设置标题 */
+    setTitle("对比项列表", QSize(120, 18));
+    
+
+    // connect(ui->btnClose, &QPushButton::clicked, this, &CompareItemListDialog::close);
+    // connect(ui->btnAdd, &QPushButton::clicked, this, &CompareItemListDialog::OnBtnAddClicked);
 
-    setWindowFlag(Qt::FramelessWindowHint);
-    setAttribute(Qt::WA_TranslucentBackground);
+    UIStyle.registerWidget(widgetContent);
 
-    connect(ui->btnClose, &QPushButton::clicked, this, &CompareItemListDialog::close);
-    connect(ui->btnAdd, &QPushButton::clicked, this, &CompareItemListDialog::OnBtnAddClicked);
+    SPDLOG_LOGGER_DEBUG(m_logger, "ObjectName: {}", this->objectName().toStdString());
 }
 
 CompareItemListDialog::~CompareItemListDialog()
 {
+    UIStyle.unregisterWidget(this);
     delete ui;
 }
 

+ 4 - 3
SettingLibrary/Modules/Basic/compareitemlistdialog.h

@@ -2,12 +2,13 @@
 #define COMPAREITEMLISTDIALOG_H
 
 #include <QDialog>
+#include "DialogBase.h"
 
 namespace Ui {
-class CompareItemListDialog;
+class CompareItemListWidget;
 }
 
-class CompareItemListDialog : public QDialog
+class CompareItemListDialog : public DialogBase
 {
     Q_OBJECT
 
@@ -19,7 +20,7 @@ private slots:
     void OnBtnAddClicked();
 
 private:
-    Ui::CompareItemListDialog *ui;
+    Ui::CompareItemListWidget *ui;
 };
 
 #endif // COMPAREITEMLISTDIALOG_H

+ 249 - 0
SettingLibrary/Modules/Basic/compareitemlistwidget.ui

@@ -0,0 +1,249 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>CompareItemListWidget</class>
+ <widget class="QWidget" name="CompareItemListWidget">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>864</width>
+    <height>598</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <widget class="QWidget" name="widgetBottom" native="true">
+   <property name="geometry">
+    <rect>
+     <x>11</x>
+     <y>405</y>
+     <width>581</width>
+     <height>64</height>
+    </rect>
+   </property>
+   <property name="minimumSize">
+    <size>
+     <width>0</width>
+     <height>64</height>
+    </size>
+   </property>
+   <property name="maximumSize">
+    <size>
+     <width>16777215</width>
+     <height>64</height>
+    </size>
+   </property>
+   <layout class="QHBoxLayout" name="horizontalLayout_3">
+    <property name="spacing">
+     <number>16</number>
+    </property>
+    <property name="leftMargin">
+     <number>32</number>
+    </property>
+    <property name="topMargin">
+     <number>0</number>
+    </property>
+    <property name="rightMargin">
+     <number>32</number>
+    </property>
+    <property name="bottomMargin">
+     <number>32</number>
+    </property>
+    <item>
+     <widget class="QPushButton" name="pBtn_enableCPItem">
+      <property name="minimumSize">
+       <size>
+        <width>102</width>
+        <height>32</height>
+       </size>
+      </property>
+      <property name="maximumSize">
+       <size>
+        <width>102</width>
+        <height>32</height>
+       </size>
+      </property>
+      <property name="text">
+       <string>启用对比项</string>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <widget class="QPushButton" name="pBtn_disableCPItem">
+      <property name="minimumSize">
+       <size>
+        <width>102</width>
+        <height>32</height>
+       </size>
+      </property>
+      <property name="maximumSize">
+       <size>
+        <width>102</width>
+        <height>32</height>
+       </size>
+      </property>
+      <property name="text">
+       <string>禁用对比项</string>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <spacer name="horizontalSpacer_2">
+      <property name="orientation">
+       <enum>Qt::Horizontal</enum>
+      </property>
+      <property name="sizeHint" stdset="0">
+       <size>
+        <width>40</width>
+        <height>20</height>
+       </size>
+      </property>
+     </spacer>
+    </item>
+    <item>
+     <widget class="QPushButton" name="pBtn_close">
+      <property name="minimumSize">
+       <size>
+        <width>60</width>
+        <height>32</height>
+       </size>
+      </property>
+      <property name="maximumSize">
+       <size>
+        <width>102</width>
+        <height>32</height>
+       </size>
+      </property>
+      <property name="text">
+       <string>关闭</string>
+      </property>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+  <widget class="QWidget" name="widgetContent" native="true">
+   <property name="geometry">
+    <rect>
+     <x>11</x>
+     <y>11</y>
+     <width>671</width>
+     <height>361</height>
+    </rect>
+   </property>
+   <layout class="QVBoxLayout" name="verticalLayout_2">
+    <property name="spacing">
+     <number>25</number>
+    </property>
+    <property name="leftMargin">
+     <number>32</number>
+    </property>
+    <property name="topMargin">
+     <number>32</number>
+    </property>
+    <property name="rightMargin">
+     <number>32</number>
+    </property>
+    <property name="bottomMargin">
+     <number>32</number>
+    </property>
+    <item>
+     <widget class="QWidget" name="widget" native="true">
+      <layout class="QHBoxLayout" name="horizontalLayout">
+       <property name="spacing">
+        <number>16</number>
+       </property>
+       <property name="leftMargin">
+        <number>0</number>
+       </property>
+       <property name="topMargin">
+        <number>0</number>
+       </property>
+       <property name="rightMargin">
+        <number>0</number>
+       </property>
+       <property name="bottomMargin">
+        <number>0</number>
+       </property>
+       <item>
+        <widget class="QPushButton" name="pBtn_add">
+         <property name="minimumSize">
+          <size>
+           <width>82</width>
+           <height>32</height>
+          </size>
+         </property>
+         <property name="maximumSize">
+          <size>
+           <width>60</width>
+           <height>32</height>
+          </size>
+         </property>
+         <property name="text">
+          <string>+ 新增</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QPushButton" name="pBtn_modify">
+         <property name="minimumSize">
+          <size>
+           <width>60</width>
+           <height>32</height>
+          </size>
+         </property>
+         <property name="maximumSize">
+          <size>
+           <width>60</width>
+           <height>32</height>
+          </size>
+         </property>
+         <property name="text">
+          <string>编辑</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QPushButton" name="pBtn_delete">
+         <property name="minimumSize">
+          <size>
+           <width>60</width>
+           <height>32</height>
+          </size>
+         </property>
+         <property name="maximumSize">
+          <size>
+           <width>60</width>
+           <height>32</height>
+          </size>
+         </property>
+         <property name="text">
+          <string>删除</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <spacer name="horizontalSpacer">
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>40</width>
+           <height>20</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+      </layout>
+     </widget>
+    </item>
+    <item>
+     <widget class="QTableView" name="tableView"/>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 19 - 0
SettingLibrary/Network/FromMQTT.cpp

@@ -0,0 +1,19 @@
+#include "FromMQTT.h"
+
+
+FromMQTT::FromMQTT(QObject* parent)
+{
+
+}
+
+FromMQTT::~FromMQTT()
+{
+
+}
+
+/* 接收到消息,子类继承这个解析消息数据 */
+void FromMQTT::recvMessage(const QMQTT::Message& message)
+{
+
+}
+

+ 23 - 0
SettingLibrary/Network/FromMQTT.h

@@ -0,0 +1,23 @@
+#ifndef _FROMMQTT_H_
+#define _FROMMQTT_H_
+
+
+#include "MQTTBase.h"
+
+
+class FromMQTT : public MQTTBase
+{
+    Q_OBJECT
+public:
+    FromMQTT(QObject* parent = nullptr);
+    ~FromMQTT() override;
+
+
+protected:
+    /* 接收到消息,子类继承这个解析消息数据 */
+    void recvMessage(const QMQTT::Message& message) override;
+
+};
+
+
+#endif // _FROMMQTT_H_

+ 0 - 0
SettingLibrary/Network/FromWebAPI.cpp


+ 14 - 0
SettingLibrary/Network/FromWebAPI.h

@@ -0,0 +1,14 @@
+#include "WebAPIBase.h"
+
+
+
+class FromWebAPI : public WebAPIBase
+{
+public:
+    FromWebAPI();
+    ~FromWebAPI() override;
+
+
+private:
+
+};

+ 3 - 0
SettingLibrary/Resources/QSS.qrc

@@ -1,5 +1,8 @@
 <RCC>
     <qresource prefix="/">
         <file>qss/white/setinfowidget.qss</file>
+        <file>qss/white/dialogbase.qss</file>
+        <file>qss/white/basicwidget.qss</file>
+        <file>qss/white/compareitemlistwidget.qss</file>
     </qresource>
 </RCC>

+ 268 - 0
SettingLibrary/Resources/qss/white/basicwidget.qss

@@ -0,0 +1,268 @@
+QWidget#widget
+{
+	background: transparent;
+	border-bottom: 1px solid #E9E9E9;
+}
+
+QLabel
+{
+	font-weight: 400;
+	font-size: 14px;
+	color: #3A3F63;
+}
+
+QLabel#labeltip
+{
+	font-weight: 400;
+	font-size: 14px;
+	color: rgba(58,63,99,0.8);
+	line-height: 21px;
+	text-align: left;
+	font-style: normal;
+}
+
+/* ==========================================================
+ *  QLineEdit
+ * ========================================================== */
+
+QLineEdit
+{
+	background: #FFFFFF;
+	border-radius: 4px;
+	border: 1px solid #E6E9F4;
+	padding-left: 12px;
+	font-weight: 400;
+	font-size: 14px;
+	color: #3A3F63;
+}
+
+QLineEdit:hover,QLineEdit:focus
+{
+	border: 1px solid #4458FE;
+}
+
+
+/* ==========================================================
+ *  QPushButton
+ * ========================================================== */
+
+QPushButton
+{
+	font-weight: 500;
+	font-size: 14px;
+	text-align: center;
+}
+
+/* QPushButton#pBtn_close
+{
+    background: transparent;
+    border-radius: 4px;
+    qproperty-icon: url(:/ICON/ICON/Close_Light.png);
+    qproperty-iconSize: 20px 20px;
+}
+QPushButton#pBtn_close[Hover = true]
+{    
+    background: transparent;
+    border-radius: 4px;
+    qproperty-icon: url(:/ICON/ICON/Close_pass.png);
+    qproperty-iconSize: 20px 20px;
+
+    border: 1px solid #4458FE;
+} */
+
+/********* 普通椭圆按钮三种状态效果 *********/
+/* QPushButton#pBtn_cancel, #pBtn_saveTotemplate
+{
+    background: transparent;
+    color: #3A3F63;
+	border: 1px solid #E6E9F4;
+	border-radius: 16px;
+}
+QPushButton#pBtn_cancel:hover, #pBtn_saveTotemplate:hover
+{
+    background: transparent;
+	color: #4458FE;
+	border: 1px solid #4458FE;
+    border-radius: 16px;
+} */
+
+
+/********* 带有底色椭圆按钮三种状态效果 *********/
+/* QPushButton#pBtn_ok
+{
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:1 #4F8AFF,stop:0 #4B5EFF);
+    border-radius: 16px;
+}
+
+QPushButton#pBtn_ok:hover
+{
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:0 #5D73FF,stop:1 #6092FF);
+    border-radius: 16px;
+} */
+
+/********* 普通方框按钮三种状态效果 *********/
+QPushButton#pBtn_compareItem, #pBtn_restore
+{
+    background: transparent;
+    color: #3A3F63;
+	border: 1px solid #E6E9F4;
+    border-radius: 4px;
+}
+QPushButton#pBtn_compareItem:hover, #pBtn_restore:hover
+{
+    background: transparent;
+    color: #4458FE;
+	border: 1px solid #4458FE;
+    border-radius: 4px;
+}
+
+
+/********* 带有底色方框按钮三种状态效果 *********/
+/* QPushButton#pBtn_addPlan
+{
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:1 #4F8AFF,stop:0 #4B5EFF);
+    border-radius: 4px;
+}
+
+QPushButton#pBtn_addPlan:hover
+{
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:0 #5D73FF,stop:1 #6092FF);
+    border-radius: 4px;
+} */
+
+
+/* ==========================================================
+ *  QComboBox(这个是在用的)
+ * ========================================================== */
+
+QComboBox:enabled
+{
+    background-color:#FFFFFF;
+    border: 1px solid #E6E9F4;
+    border-radius: 4px;
+    font-size:14px;
+    font-weight: 400;
+    color:#3A3F63;
+    padding-left: 12px;
+}
+
+/* 不能编辑的时候的样式,setEnable(false) */
+QComboBox:!enabled
+{
+    background:rgba(0,0,0,0.04);
+	border: 1px solid #E6E9F4;
+    border-radius: 4px;
+    font-size:14px;
+    font-weight: 400;
+    color:rgba(58,63,99,0.65);
+    padding-left: 12px;
+}
+
+QComboBox:hover
+{
+    border: 1px solid #4458FE;
+    border-radius: 4px;
+    background:transparent;
+}
+
+/* 下拉箭头所在的位置方框 */
+QComboBox::drop-down
+{
+    width: 24px;
+    border: none;
+}
+/* 下拉箭头图标 */
+QComboBox::down-arrow
+{
+    image: url(:/icon/down_arrow.png);
+    height:16px;
+    width:16px;
+}
+
+/* 下拉条样式,就是view,整个下拉窗体的样式 */
+QComboBox QAbstractItemView
+{
+    background-color: #FFFFFF;
+    margin: 12px;
+    outline:0px;
+    font-size:14px;
+    color: #3A3F63;
+    border-radius: 4px;
+}
+
+/* 使下面两句生效,需要加上如下语句 */
+/* m_comBoxDev->setView(new QListView()); */
+QComboBox QAbstractItemView::item
+{
+    background-color: #FFFFFF;
+    border-radius:4px;
+    color: #3A3F63;
+    padding-left: 12px;
+    height: 32px;
+}
+
+QComboBox QAbstractItemView::item:hover
+{
+    border-radius:4px;
+    background-color: #EEF2FF;
+}
+
+/******** combobox 滚动条  *********/
+/*主体部分*/
+QComboBox QScrollBar::vertical
+{ 
+    width:8px;
+    background:transparent;
+    border:none;
+    border-radius:5px;
+}
+/*滑块主体*/
+QComboBox QScrollBar::handle::vertical
+{
+    width: 8px;
+    background: #E2E2E2;
+    border-radius: 3px;
+    min-width: 8px;
+}
+QComboBox QScrollBar::handle::vertical::hover
+{
+    background:transparent;
+}
+/*上箭头*/
+QComboBox QScrollBar::add-line::vertical
+{
+    border:none;
+}
+/*下箭头*/
+QComboBox QScrollBar::sub-line::vertical
+{
+    border:none;
+}
+
+
+/* ==========================================================
+ *  QCheckBox
+ * ========================================================== */
+QCheckBox
+{
+	font-weight: 400;
+	font-size: 14px;
+	color: #3A3F63;
+}
+QCheckBox::indicator
+{
+	width: 16px; 
+	height: 16px;
+}
+QCheckBox::indicator:unchecked
+{
+	image: url(:/icon/unchecked.png);
+}
+QCheckBox::indicator:checked
+{
+	image: url(:/icon/checked.png);
+}

+ 110 - 0
SettingLibrary/Resources/qss/white/compareitemlistwidget.qss

@@ -0,0 +1,110 @@
+
+QWidget
+{
+
+}
+
+/* ==========================================================
+ *  QPushButton
+ * ========================================================== */
+
+QPushButton
+{
+	font-weight: 500;
+	font-size: 14px;
+	text-align: center;
+}
+
+/* QPushButton#pBtn_Close
+{
+    background: transparent;
+    border-radius: 4px;
+    qproperty-icon: url(:/icon/close.png);
+    qproperty-iconSize: 32px 32px;
+}
+
+QPushButton#pBtn_Close[Hover = true]
+{    
+    background: transparent;
+    border-radius: 4px;
+    qproperty-icon: url(:/icon/close_hover.png);
+    qproperty-iconSize: 32px 32px;
+
+    border: 1px solid #4458FE;
+} */
+
+/********* 普通椭圆按钮三种状态效果 *********/
+QPushButton#pBtn_close
+{
+    background: transparent;
+    color: #3A3F63;
+	border: 1px solid #E6E9F4;
+	border-radius: 16px;
+}
+QPushButton#pBtn_close:hover
+{
+    background: transparent;
+	color: #4458FE;
+	border: 1px solid #4458FE;
+    border-radius: 16px;
+}
+
+
+/********* 带有底色椭圆按钮三种状态效果 *********/
+/* QPushButton#pBtn_OK
+{
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:1 #4F8AFF,stop:0 #4B5EFF);
+    border-radius: 16px;
+}
+
+QPushButton#pBtn_OK:hover
+{
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:0 #5D73FF,stop:1 #6092FF);
+    border-radius: 16px;
+} */
+
+/********* 普通方框按钮三种状态效果 *********/
+QPushButton#pBtn_delete, #pBtn_modify, #pBtn_enableCPItem, #pBtn_disableCPItem
+{
+    background: transparent;
+    color: #3A3F63;
+	border: 1px solid #E6E9F4;
+    border-radius: 4px;
+}
+QPushButton#pBtn_delete:hover, #pBtn_modify:hover, #pBtn_enableCPItem:hover, #pBtn_disableCPItem:hover
+{
+    background: transparent;
+    color: #4458FE;
+	border: 1px solid #4458FE;
+    border-radius: 4px;
+}
+
+
+/********* 带有底色方框按钮三种状态效果 *********/
+QPushButton#pBtn_add
+{
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:1 #4F8AFF,stop:0 #4B5EFF);
+    border-radius: 4px;
+}
+
+QPushButton#pBtn_add:hover
+{
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:0 #5D73FF,stop:1 #6092FF);
+    border-radius: 4px;
+}
+
+
+/* ==========================================================
+ *  QTableView
+ * ========================================================== */
+
+QTableView
+{
+	border: none;
+	background: transparent;
+	border-bottom: 1px solid #E6E9F4;
+}

+ 160 - 0
SettingLibrary/Resources/qss/white/dialogbase.qss

@@ -0,0 +1,160 @@
+
+QWidget
+{
+    font-size: 14px;
+    color: #3A3F63;
+    line-height: 22px;
+    text-align: left;
+    font-style: normal;
+    text-transform: none;
+}
+
+QWidget#DialogBase
+{
+    background: transparent;
+    border: none;
+}
+
+/* 整体背景 */
+QWidget#widget_background
+{
+    background: #FFFFFF;
+    border-radius: 8px 8px 8px 8px;
+}
+
+QPushButton
+{
+    color: #3A3F63;
+    line-height: 22px;
+    text-align: center;
+    font-style: normal;
+    text-transform: none;
+}
+
+/*===============================================================
+ * widget_Top
+ ================================================================*/
+QWidget#widget_top
+{
+    border-top-left-radius: 8px;
+    border-top-right-radius: 8px;
+    border-bottom-left-radius: 0px;
+    border-bottom-right-radius: 0px;
+    border-bottom: 1px solid #E6E9F4;
+}
+
+
+QLabel#label_X1
+{
+    text-align: center;
+    color: #F53F3F;
+}
+
+
+QLabel#label_title
+{
+    font-weight: 500;
+    font-size: 18px;
+    color: #3A3F63;
+    line-height: 27px;
+    text-align: left;
+    font-style: normal;
+    text-transform: uppercase;
+}
+
+
+
+
+/* ==========================================================
+ *  QPushButton
+ * ========================================================== */
+
+QPushButton
+{
+	font-weight: 500;
+	font-size: 14px;
+	text-align: center;
+}
+
+QPushButton#pBtn_Close
+{
+    background: transparent;
+    border-radius: 4px;
+    qproperty-icon: url(:/icon/close.png);
+    qproperty-iconSize: 32px 32px;
+}
+
+QPushButton#pBtn_Close[Hover = true]
+{    
+    background: transparent;
+    border-radius: 4px;
+    qproperty-icon: url(:/icon/close_hover.png);
+    qproperty-iconSize: 32px 32px;
+
+    border: 1px solid #4458FE;
+}
+
+/********* 普通椭圆按钮三种状态效果 *********/
+QPushButton#pBtn_Cancel
+{
+    background: transparent;
+    color: #3A3F63;
+	border: 1px solid #E6E9F4;
+	border-radius: 16px;
+}
+QPushButton#pBtn_Cancel:hover
+{
+    background: transparent;
+	color: #4458FE;
+	border: 1px solid #4458FE;
+    border-radius: 16px;
+}
+
+
+/********* 带有底色椭圆按钮三种状态效果 *********/
+QPushButton#pBtn_OK
+{
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:1 #4F8AFF,stop:0 #4B5EFF);
+    border-radius: 16px;
+}
+
+QPushButton#pBtn_OK:hover
+{
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:0 #5D73FF,stop:1 #6092FF);
+    border-radius: 16px;
+}
+
+/********* 普通方框按钮三种状态效果 *********/
+/* QPushButton#pBtn_compareItem, #pBtn_restore
+{
+    background: transparent;
+    color: #3A3F63;
+	border: 1px solid #E6E9F4;
+    border-radius: 4px;
+}
+QPushButton#pBtn_compareItem:hover, #pBtn_restore:hover
+{
+    background: transparent;
+    color: #4458FE;
+	border: 1px solid #4458FE;
+    border-radius: 4px;
+} */
+
+
+/********* 带有底色方框按钮三种状态效果 *********/
+/* QPushButton#pBtn_addPlan
+{
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:1 #4F8AFF,stop:0 #4B5EFF);
+    border-radius: 4px;
+}
+
+QPushButton#pBtn_addPlan:hover
+{
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:0 #5D73FF,stop:1 #6092FF);
+    border-radius: 4px;
+} */
+

+ 6 - 0
SettingLibrary/Resources/qss/white/setinfowidget.qss

@@ -1,3 +1,9 @@
+
+
+/* ==========================================================
+ *  QTabWidget
+ * ========================================================== */
+
 QTabWidget#tabWidget
 {
 	background: #FFFFFF;

+ 5 - 0
SettingLibrary/acaserversetinfo.cpp

@@ -5,6 +5,11 @@ SetInfoManager g_managerObj;
 
 int DoInit(const stInitData* pData)
 {
+    if(pData == nullptr)
+    {
+        return -1; // 参数错误
+    }
+    g_managerObj.Init(pData);
     return 0;
 }
 

+ 133 - 0
SettingLibrary/common/LHLog/LHLogInit.cpp

@@ -0,0 +1,133 @@
+#include "LHLogInit.h"
+
+#include "spdlog/spdlog.h"
+#include "spdlog/sinks/stdout_color_sinks.h"
+#include "LHLog_file_sink.h"
+
+
+#include <string>
+// #include <filesystem>
+#include <QCoreApplication>
+
+
+/* 初始化spdlog,输入的是模组名称,可以为空
+ * lhQLog是一个全局函数,在库LHQLog中定义
+ * 这里获取可执行文件文件夹的路径,使用的是C++17新引入的特性
+ * GCC9会在标准库中,GCC8.3需要手动链接库stdc++fs才可以使用
+ */
+
+std::atomic_bool g_isLogInit(false); // 是否已经初始化日志
+std::shared_ptr<spdlog::sinks::LHLog_file_sink_mt> g_loggerFile = nullptr; // 日志文件记录器
+
+void initLog(QString ModuleName, CLHQLogApi& lhQLog)
+{
+    if(g_isLogInit.load())
+    {
+        return; // 已经初始化过了
+    }
+    try {
+        /* 创建一个控制台sink */
+        auto sink_consolse = std::make_shared<spdlog::sinks::stdout_color_sink_mt>();
+        /* 创建一个文件sink,每天一个,00:00创建新的 */
+        // auto sink_file = std::make_shared<spdlog::sinks::daily_file_sink_mt>("FlowChartLog/log.txt",0,0);
+        /* 自定义的sink */
+        // std::filesystem::path execPath = std::filesystem::current_path();
+        QString execPath = QCoreApplication::applicationDirPath();
+    #if defined(Q_OS_WIN32)
+        #if C_DEBUG
+            QString libName = execPath + "/LHQLogd.dll";
+        #elif C_RELEASE
+            QString libName = execPath + "/LHQLog.dll";
+        #endif
+    #elif defined(Q_OS_LINUX)
+        QString libName = execPath + "/libLHQLog.so";
+    #endif
+        /* 写入文件的sink */
+        g_loggerFile = std::make_shared<spdlog::sinks::LHLog_file_sink_mt>(&lhQLog, libName, ModuleName);
+        /* 给默认记录器用的sink */
+        auto sink_default = std::make_shared<spdlog::sinks::stdout_color_sink_mt>();
+
+        /* 修改输出格式 */
+#if  defined (C_DEBUG)
+        sink_consolse->set_pattern("%^[%Y-%m-%d %H:%M:%S:%e] [%l] [%n] [%s %#] %v%$");
+        // sink_file->set_pattern("[%Y-%m-%d %H:%M:%S] [%^%n%$] [%^%l%$] %s %#: %v");
+        g_loggerFile->set_pattern("%v");
+        sink_default->set_pattern("%^[%Y-%m-%d %H:%M:%S:%e] [%l] [%s %#] %v%$");
+#elif defined(C_RELEASE)
+        sink_consolse->set_pattern("%^[%Y-%m-%d %H:%M:%S:%e] [%l] [%n] %v%$");
+        // sink_file->set_pattern("[%Y-%m-%d %H:%M:%S] [%^%n%$] [%^%l%$] %s %#: %v");
+        sink_custom->set_pattern("%v");
+        sink_default->set_pattern("%^[%Y-%m-%d %H:%M:%S:%e] [%l] %v%$");
+#endif
+
+        /* 日志输出方向,终端和文件 */
+        std::vector<spdlog::sink_ptr> sinks;
+        sinks.push_back(sink_consolse);
+        // sinks.push_back(sink_file);
+        sinks.push_back(g_loggerFile);
+
+        /* 设置默认日志记录器,设置成自定义的sink */
+        spdlog::default_logger()->sinks().clear();
+        spdlog::default_logger()->sinks().push_back(sink_default);
+        spdlog::default_logger()->sinks().push_back(g_loggerFile);
+        // auto vecSinks =  spdlog::default_logger()->sinks();
+        // for(auto& sink : vecSinks)
+        // {
+        //     SPDLOG_INFO("sink name = {}", typeid(*sink).name());
+        // }
+        /* 创建一个标准输出 */
+        auto logger_main = std::make_shared<spdlog::logger>("main",begin(sinks),end(sinks));
+        /* 创建一个 FromWebAPI logger */
+        auto logger_webapi = std::make_shared<spdlog::logger>("FromWebAPI",begin(sinks),end(sinks));
+        /* 创建一个设置动态库统一的logger */
+        auto logger_settings = std::make_shared<spdlog::logger>("ACASetting",begin(sinks),end(sinks));
+
+
+        /* 注册到注册表 */
+        spdlog::register_logger(logger_main);
+        spdlog::register_logger(logger_webapi);
+        spdlog::register_logger(logger_settings);
+
+
+        /* 设置spdlog输出级别,默认的估计不输出debug这个级别
+         * 这是默认的设置,可以在外面单数设置输出方式
+         * release模式下不输出console的日志输出
+         * */
+#if  defined (C_DEBUG)
+        spdlog::set_level(spdlog::level::trace);
+        spdlog::flush_on(spdlog::level::trace);
+#elif defined(C_RELEASE)
+        spdlog::set_level(spdlog::level::info);             /* 只输出info以上的输出 */
+        spdlog::flush_on(spdlog::level::info);              /* 设置刷新等级 */
+        // sink_consolse->set_level(spdlog::level::off);       /* 控制台不输出 */
+        // sink_default->set_level(spdlog::level::off);        /* 默认sink也不输出 */
+#endif
+
+//    SPDLOG_LOGGER_DEBUG(logger_main,"******* 有行号且debug也能输出 *******");
+    }
+    catch (const spdlog::spdlog_ex& ex) {
+        qDebug() << "Log initialization failed: " << ex.what() ;
+    }
+
+    g_isLogInit.store(true);
+}
+
+
+/* 修改日志输出等级,输入1表示 */
+void changeLogLevel(ELogLevel level)
+{
+    if(ELogLevel::Log_Debug == level)
+    {
+        spdlog::set_level(spdlog::level::debug);
+        spdlog::flush_on(spdlog::level::debug);
+        g_loggerFile->set_level(spdlog::level::info);
+    }
+    else if(ELogLevel::Log_Info == level)
+    {
+        spdlog::set_level(spdlog::level::info);
+        spdlog::flush_on(spdlog::level::info);
+        /* 获取写入文件的sink,release模式下不写入文件 */
+        g_loggerFile->set_level(spdlog::level::info);
+    }
+}
+

+ 19 - 0
SettingLibrary/common/LHLog/LHLogInit.h

@@ -0,0 +1,19 @@
+#ifndef LHLOGINIT_H
+#define LHLOGINIT_H
+
+class QString;
+class CLHQLogApi;
+
+enum class ELogLevel
+{
+    Log_Info = 0,
+    Log_Debug = 1
+};
+
+void initLog(QString ModuleName, CLHQLogApi& lhQLog);
+
+/* 修改日志输出等级,输入1表示 */
+void changeLogLevel(ELogLevel level);
+
+
+#endif /* LHLOGINIT_H */

+ 12 - 0
SettingLibrary/setinfomanager.cpp

@@ -2,6 +2,10 @@
 
 #include <QLayout>
 
+#include "entities.h"
+#include "LHLogInit.h"
+#include "LHQLogAPI.h"
+
 SetInfoManager::SetInfoManager(QObject *parent)
     : QObject(parent)
     , m_pWgtSet(nullptr)
@@ -14,6 +18,14 @@ SetInfoManager::~SetInfoManager()
 
 }
 
+/* 初始化,主要是初始化日志库 */
+int SetInfoManager::Init(const stInitData* pData)
+{
+    initLog("ACAServerSetting", g_apiLhQLog);
+
+    return 0;
+}
+
 int SetInfoManager::CreateWindow(int nSkinType, QWidget* parent)
 {
     // 设置皮肤

+ 6 - 0
SettingLibrary/setinfomanager.h

@@ -4,6 +4,9 @@
 #include <QObject>
 #include "setinfowidget.h"
 
+
+struct stInitData;
+
 class SetInfoManager: public QObject
 {
     Q_OBJECT
@@ -11,6 +14,9 @@ public:
     explicit SetInfoManager(QObject *parent = nullptr);
     virtual ~SetInfoManager();
 
+    /* 初始化,主要是初始化日志库 */
+    int Init(const stInitData* pData);
+
     int CreateWindow(int nSkinType, QWidget* parent);
     int ShowWindow(int nSkinType, int nServiceID, bool bShowWindow);
 

+ 58 - 0
show2/CMakeLists.txt

@@ -0,0 +1,58 @@
+cmake_minimum_required(VERSION 3.10)
+
+set(this_exe show2)
+
+
+
+#包含源文件
+file(GLOB LOCAL_SRC
+    ${CMAKE_CURRENT_SOURCE_DIR}/*.qrc
+    ${CMAKE_CURRENT_SOURCE_DIR}/*.rc
+    ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/*.ui
+
+)
+
+
+# 生成可执行程序
+
+add_executable(${this_exe}
+    # WIN32
+    ${GLOBAL_SRC}
+    ${LOCAL_SRC} 
+)
+
+# set_target_properties(${this_exe} PROPERTIES
+    
+# )
+
+
+#添加头文件
+target_include_directories(${this_exe} PRIVATE
+
+    ${CMAKE_CURRENT_SOURCE_DIR}
+
+
+    ${CMAKE_SOURCE_DIR}/External/common
+    ${CMAKE_SOURCE_DIR}/External/module
+    ${CMAKE_SOURCE_DIR}/SettingLibrary
+    ${CMAKE_SOURCE_DIR}/SettingLibrary/DataBase
+    
+    ${spdlog_INCLUDE_DIR}
+)
+
+
+target_link_libraries(${this_exe} PRIVATE
+    Qt${QT_VERSION_MAJOR}::Widgets
+    Qt${QT_VERSION_MAJOR}::Core
+    Qt${QT_VERSION_MAJOR}::Network
+
+)
+# message(STATUS "可执行文件输出位置: ${EXECUTABLE_OUTPUT_PATH}")
+target_link_libraries(${this_exe} PRIVATE
+    ${spdlog_LIBRARY}
+    ACAServerSetting
+)
+
+
+

+ 60 - 0
show2/main.cpp

@@ -0,0 +1,60 @@
+#include "widget.h"
+
+#include <QApplication>
+#include <QFontDatabase>
+#include <qapplication.h>
+#include <qchar.h>
+
+
+#include "spdlog/spdlog.h"
+
+void addFont();
+
+
+int main(int argc, char *argv[])
+{
+    QApplication a(argc, argv);
+
+    /* 从文件加载字体 */
+    addFont();
+
+
+    SPDLOG_INFO("********** ACASetting **********");
+
+
+    Widget w;
+    w.show();
+
+
+    return a.exec();
+}
+
+
+/* 加载字体 */
+void addFont()
+{
+    QString fontPath = QApplication::applicationDirPath() + "/font/SiYuanBlack_ttf";
+    /* 加载字体 */
+    QFontDatabase::addApplicationFont(fontPath + "/SiYuanBlack_Bold.ttf)");
+    QFontDatabase::addApplicationFont(fontPath + "/SiYuanBlack_M.ttf)");
+    QFontDatabase::addApplicationFont(fontPath + "/SiYuanBlack_R.ttf)");
+    /***************************************************
+     * 字体使用方式
+     * id1 ("思源黑体-粗")
+     * id2 ("思源黑体M")
+     * id3 ("思源黑体R")
+    ****************************************************/
+    //    SPDLOG_LOGGER_DEBUG(m_logger,"id1 = {}",QFontDatabase::applicationFontFamilies(id1));
+    //    qDebug() << "id1" << QFontDatabase::applicationFontFamilies(id1);
+    //    qDebug() << "id2" << QFontDatabase::applicationFontFamilies(id2);
+    //    qDebug() << "id3" << QFontDatabase::applicationFontFamilies(id3);
+    QFont font_main;
+   font_main.setFamily("思源黑体R");
+    font_main.setPixelSize(14);
+    QApplication::setFont(font_main);
+}
+
+
+
+
+

+ 43 - 0
show2/widget.cpp

@@ -0,0 +1,43 @@
+#include "widget.h"
+#include "ui_widget.h"
+
+#include <QLayout>
+#include <QVBoxLayout>
+
+#include "spdlog/spdlog.h"
+#include "entities.h"
+// #include "setinfowidget.h"
+
+
+Widget::Widget(QWidget *parent) :
+    QWidget(parent),
+    ui(new Ui::Widget)
+{
+    ui->setupUi(this);
+
+    this->setStyleSheet(R"(background-color: rgb(255, 255, 255);)");
+
+    QVBoxLayout *layout = new QVBoxLayout(this);
+    layout->setContentsMargins(16, 16, 16, 16);
+    layout->setSpacing(8);
+    this->setLayout(layout);
+
+    stInitData initData;
+    m_setInfoManager = new SetInfoManager(this);
+    m_setInfoManager->Init(&initData);
+    m_setInfoManager->CreateWindow(0, this);
+    m_setInfoManager->ShowWindow(1, 1, true);
+
+    // DoInit(&initData);
+    // DoCreateWindow(0, this);
+    // DoShowWindow(1, 1, true);
+
+    // SetInfoWidget *setInfoWidget = new SetInfoWidget(this);
+    // layout->addWidget(setInfoWidget);
+
+}
+
+Widget::~Widget()
+{
+    delete ui;
+}

+ 26 - 0
show2/widget.h

@@ -0,0 +1,26 @@
+#ifndef WIDGET_H
+#define WIDGET_H
+
+#include <QWidget>
+#include "setinfomanager.h"
+
+namespace Ui {
+class Widget;
+}
+
+class Widget : public QWidget
+{
+    Q_OBJECT
+
+public:
+    explicit Widget(QWidget *parent = nullptr);
+    ~Widget();
+
+private:
+    Ui::Widget *ui;
+
+    SetInfoManager* m_setInfoManager = nullptr; // 设置管理器
+
+};
+
+#endif // WIDGET_H

+ 21 - 0
show2/widget.ui

@@ -0,0 +1,21 @@
+<ui version="4.0">
+ <author/>
+ <comment/>
+ <exportmacro/>
+ <class>Widget</class>
+ <widget name="Widget" class="QWidget">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+ </widget>
+ <pixmapfunction/>
+ <connections/>
+</ui>