ソースを参照

V1.6
1、完成了亮色UI

Apple 6 日 前
コミット
9bf5913c88
27 ファイル変更1230 行追加183 行削除
  1. 7 1
      SQLite.sql
  2. 1 0
      TransmitterSwitch/CMakeLists.txt
  3. 9 4
      TransmitterSwitch/ExecPlanData/plancard.cpp
  4. 2 2
      TransmitterSwitch/FromSQL/FromSQLite.cpp
  5. 30 5
      TransmitterSwitch/FromSQL/FromWebAPI.cpp
  6. 0 0
      TransmitterSwitch/Resource/QSS/dark/SelectDate/calendarheader.qss
  7. 0 64
      TransmitterSwitch/Resource/QSS/dark/SelectDate/calendarnav.qss
  8. 1 0
      TransmitterSwitch/Resource/QSS/dark/pBtn_frequency.qss
  9. 0 0
      TransmitterSwitch/Resource/QSS/white/SelectDate/calendarheader.qss
  10. 0 50
      TransmitterSwitch/Resource/QSS/white/SelectDate/calendarnav.qss
  11. 233 0
      TransmitterSwitch/Resource/QSS/white/copytoother.qss
  12. 76 14
      TransmitterSwitch/Resource/QSS/white/importtemplate.qss
  13. 391 0
      TransmitterSwitch/Resource/QSS/white/managerplan.qss
  14. 96 0
      TransmitterSwitch/Resource/QSS/white/previewplan.qss
  15. 187 0
      TransmitterSwitch/Resource/QSS/white/templatemanager.qss
  16. 10 8
      TransmitterSwitch/Resource/QSS/white/transmitterswitch.qss
  17. 4 8
      TransmitterSwitch/Resource/TransSwitch.qrc
  18. 9 2
      TransmitterSwitch/Template/savetotemplate.cpp
  19. 1 1
      TransmitterSwitch/common/LHHTTPAPI/src/lhhttpapi.cpp
  20. 0 0
      TransmitterSwitch/common/SelectTime/Res/dark/timepartwidget.qss
  21. 0 0
      TransmitterSwitch/common/SelectTime/Res/dark/timewidget.qss
  22. 9 0
      TransmitterSwitch/common/SelectTime/Res/light/timepartwidget.qss
  23. 2 0
      TransmitterSwitch/common/SelectTime/Res/light/timewidget.qss
  24. 8 0
      TransmitterSwitch/common/SelectTime/SelectTime.qrc
  25. 14 6
      TransmitterSwitch/common/SelectTime/timepartwidget.cpp
  26. 12 5
      TransmitterSwitch/common/SelectTime/timewidget.cpp
  27. 128 13
      TransmitterSwitch/transmitterswitch.cpp

+ 7 - 1
SQLite.sql

@@ -1,4 +1,4 @@
--- Active: 1744884470757@@127.0.0.1@3306
+-- Active: 1745229607546@@127.0.0.1@3306
 
 
 
@@ -16,6 +16,10 @@ SELECT EPT.TemplateName, EPT.ChannelID
 FROM tExecPlanTemplate AS EPT
 GROUP BY EPT.TemplateName;
 
+UPDATE tExecPlanTemplate 
+SET TemplateName = '模版2'
+WHERE TemplateName = '模版1';
+
 
 #================================================================================================
 # 表格操作
@@ -26,6 +30,8 @@ SELECT name
 FROM sqlite_master 
 WHERE type='table' AND name='%1';
 
+SELECT *
+FROM sqlite_master;
 
 #创建表格
 CREATE TABLE IF NOT EXISTS "tExecPlanTemplate"

+ 1 - 0
TransmitterSwitch/CMakeLists.txt

@@ -26,6 +26,7 @@ file(GLOB LOCAL_SRC
     ${CMAKE_CURRENT_SOURCE_DIR}/common/ImageBlur/*.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/common/combobox/*.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/common/SelectTime/*.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/common/SelectTime/*.qrc
     ${CMAKE_CURRENT_SOURCE_DIR}/common/date/*.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/common/date/*.qrc
     ${CMAKE_CURRENT_SOURCE_DIR}/common/DropShadow/*.cpp

+ 9 - 4
TransmitterSwitch/ExecPlanData/plancard.cpp

@@ -296,13 +296,17 @@ void PlanCard::setPlanList(const QList<OnePlanItemInfo>& list)
 {
     /* 清空当前的计划列表 */
     clearPlanItem();
+    
     for(const auto& it : list)
     {
-        if(it.ChannelID != m_channelInfo.ChannelID)
+        if(GInfo.isOnlineDB())
         {
-            /* 不是当前频率的计划 */
-            LH_WRITE_ERROR(QString("频率ID不匹配,当前频率ID:%1, 计划频率ID:%2").arg(m_channelInfo.ChannelID).arg(it.ChannelID));
-            continue; 
+            if(it.ChannelID != m_channelInfo.ChannelID)
+            {
+                /* 不是当前频率的计划 */
+                LH_WRITE_ERROR(QString("频率ID不匹配,当前频率ID:%1, 计划频率ID:%2").arg(m_channelInfo.ChannelID).arg(it.ChannelID));
+                continue; 
+            }
         }
         /* 添加计划 */
         PlanInfo info;
@@ -312,6 +316,7 @@ void PlanCard::setPlanList(const QList<OnePlanItemInfo>& list)
         info.offDateTime = it.offDateTime;
         addPlanItem(info);
     }
+    
 }
 
 /* 获取计划列表,适用于PlanCard之间传输数据 */

+ 2 - 2
TransmitterSwitch/FromSQL/FromSQLite.cpp

@@ -46,7 +46,7 @@ void FromSQLite::initDB(const QString dbPath)
     }
     /* 检查表格是否存在 */
     QString strCheckTable = QString(cmd_CheckTable).arg("tExecPlanTemplate");
-    SPDLOG_LOGGER_DEBUG(m_logger,"检查表格是否存在:{}", strCheckTable.toStdString());
+    // SPDLOG_LOGGER_DEBUG(m_logger,"检查表格是否存在:{}", strCheckTable.toStdString());
 
     /* 创建表格 */
     QSqlQuery query(m_DB);
@@ -277,7 +277,7 @@ bool FromSQLite::updateTemplateName(const QMap<OneTemplateInfo, QString>& mapTem
     /* 更新模版名称 */
     for(auto it = mapTemplateName.begin(); it != mapTemplateName.end(); it++)
     {
-        QString strSql = QString(cmd_UpdateTemplateName).arg(it.key().templateName).arg(it.value());
+        QString strSql = QString(cmd_UpdateTemplateName).arg(it.value()).arg(it.key().templateName);
         // SPDLOG_LOGGER_DEBUG(m_logger,"更新模版名称:{}", strSql.toStdString());
         QSqlQuery query(m_DB);
         if(!query.exec(strSql))

+ 30 - 5
TransmitterSwitch/FromSQL/FromWebAPI.cpp

@@ -50,11 +50,26 @@ bool FromWebAPI::initWebApi(const QString& url, const QString& serverID, const Q
         LH_WRITE_ERROR("Load WebAPI failed");
         return false;
     }
-    LH_WRITE_LOG_DEBUG(QString("URL:%1").arg(url));
+    LH_WRITE_LOG(QString("URL:%1").arg(url));
     LH_WRITE_LOG_DEBUG(QString("ServerID:%1").arg(serverID));
     LH_WRITE_LOG_DEBUG(QString("ServerKey:%1").arg(serverKey));
 
-    auto pHttp = m_httpApi->DBInit(url.toStdString().c_str(), true);
+    void* pHttp = nullptr;
+    int i = 0;
+    for(i = 0; i < 3; i++)
+    {
+        pHttp = m_httpApi->DBInit(url.toStdString().c_str(), true);
+        if(pHttp != nullptr)
+        {
+            break;
+        }
+        LH_WRITE_ERROR(QString("设置WebAPI地址失败:%1").arg(m_httpApi->DoGetLastError(&i)));
+    }
+    if(i >= 3)
+    {
+        LH_WRITE_ERROR("WebAPI设置地址错误!");
+        return false;
+    }
     
     int ret = 0;
 
@@ -71,13 +86,23 @@ bool FromWebAPI::initWebApi(const QString& url, const QString& serverID, const Q
 #endif
 
     /* 登录,第二个参数是限制的服务 */
-    // ret = m_httpApi->DBLogin("", serverID, serverKey, m_userToken, true, pHttp);
-    ret = m_httpApi->DBLogin("", serverID, "ESM8C", m_userToken, true, pHttp);
-    if(ret != 0)
+    for(i = 0; i < 3; i++)
     {
+        ret = m_httpApi->DBLogin("", serverID, "ESM8C", m_userToken, true, pHttp);
+        if(ret == 0)
+        {
+            break;
+        }
+        /* 登录失败,等待一段时间 */
+        QThread::msleep(200);
         LH_WRITE_ERROR(QString("Login failed:%1, error info:%2").arg(ret).arg(m_httpApi->DoGetLastError(&ret)));
+    }
+    if(i >= 3)
+    {
+        LH_WRITE_ERROR(QString("登陆WebAPI失败!"));
         return false;
     }
+
     LH_WRITE_LOG("\n");
     LH_WRITE_LOG("WebAPI Login success!");
 

+ 0 - 0
TransmitterSwitch/Resource/QSS/dark/SelectDate/calendarheader.qss


+ 0 - 64
TransmitterSwitch/Resource/QSS/dark/SelectDate/calendarnav.qss

@@ -1,64 +0,0 @@
-
-
-QWidget
-{
-	color: rgba(255,255,255,0.9);
-	background-color: #747578;
-}
-
-
-QPushButton
-{
-	background: transparent;
-}
-
-QPushButton#btnPrevYear::hover
-{
-	image: url(:/Calendar/icon/light/preYear.png);
-	border:none;
-}
-QPushButton#btnPrevYear
-{
-	image: url(:/Calendar/icon/light/preYear_hover.png);
-	border:none;
-}
-
-QPushButton#btnPrevMonth::hover
-{
-	image: url(:/Calendar/icon/light/preMonth.png);
-	border:none;
-}
-QPushButton#btnPrevMonth
-{
-	image: url(:/Calendar/icon/light/preMonth_hover.png);
-	border:none;
-}
-
-QPushButton#btnNextMonth::hover
-{
-	image: url(:/Calendar/icon/light/nextMonth.png);
-	border:none;
-}
-QPushButton#btnNextMonth
-{
-	image: url(:/Calendar/icon/light/nextMonth_hover.png);
-	border:none;
-}
-
-QPushButton#btnNextYear::hover
-{
-	image: url(:/Calendar/icon/light/nextYear.png);
-	border:none;
-}
-QPushButton#btnNextYear
-{
-	image: url(:/Calendar/icon/light/nextYear_hover.png);
-	border:none;
-}
-
-QLabel 
-{
-	font-size: 16px;
-	/* font-weight: 500; */
-	/* color: #3A3F63; */
-}

+ 1 - 0
TransmitterSwitch/Resource/QSS/dark/pBtn_frequency.qss

@@ -2,6 +2,7 @@
 /* 频率按钮样式表 */
 QPushButton
 {
+    color: #B1B3B4;
     /* font-weight: normal; */
     font-size: 14px;
 

+ 0 - 0
TransmitterSwitch/Resource/QSS/white/SelectDate/calendarheader.qss


+ 0 - 50
TransmitterSwitch/Resource/QSS/white/SelectDate/calendarnav.qss

@@ -1,50 +0,0 @@
-QPushButton#btnPrevYear::hover
-{
-	image: url(:/Calendar/icon/light/preYear.png);
-	border:none;
-}
-QPushButton#btnPrevYear
-{
-	image: url(:/Calendar/icon/light/preYear_hover.png);
-	border:none;
-}
-
-QPushButton#btnPrevMonth::hover
-{
-	image: url(:/Calendar/icon/light/preMonth.png);
-	border:none;
-}
-QPushButton#btnPrevMonth
-{
-	image: url(:/Calendar/icon/light/preMonth_hover.png);
-	border:none;
-}
-
-QPushButton#btnNextMonth::hover
-{
-	image: url(:/Calendar/icon/light/nextMonth.png);
-	border:none;
-}
-QPushButton#btnNextMonth
-{
-	image: url(:/Calendar/icon/light/nextMonth_hover.png);
-	border:none;
-}
-
-QPushButton#btnNextYear::hover
-{
-	image: url(:/Calendar/icon/light/nextYear.png);
-	border:none;
-}
-QPushButton#btnNextYear
-{
-	image: url(:/Calendar/icon/light/nextYear_hover.png);
-	border:none;
-}
-
-QLabel 
-{
-	font-size: 16px;
-	/* font-weight: 500; */
-	color: #3A3F63;
-}

+ 233 - 0
TransmitterSwitch/Resource/QSS/white/copytoother.qss

@@ -0,0 +1,233 @@
+QWidget
+{
+    font-size: 14px;
+    color: #3A3F63;
+    line-height: 21px;
+    text-align: left;
+    font-style: normal;
+}
+
+QWidget#widget
+{
+    background: #FFFFFF;
+    border-radius: 8px 8px 8px 8px;
+}
+
+QWidget#widget_Top
+{
+    background: transparent;
+    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;
+}
+
+QWidget#widget_content
+{
+    background: #FFFFFF;
+}
+
+QLabel#label_title
+{
+    font-weight: 500;
+    font-size: 18px;
+    line-height: 24px;
+    text-align: left;
+    font-style: normal;
+    text-transform: none;
+}
+
+
+QPushButton#pBtn_close
+{
+	/* border-image: url(:/ICON/ICON/Dialog_close.png); */
+    background: transparent;
+    border-radius: 4px;
+    qproperty-icon: url(:/ICON/ICON/Close_Light.png);
+    qproperty-iconSize: 20px 20px;
+
+    text-align: center;
+}
+
+QPushButton#pBtn_close[Hover = true]
+{	
+	/* border-image: url(:/ICON/ICON/Dialog_close2.png); */
+    background: transparent;
+    border-radius: 4px;
+    qproperty-icon: url(:/ICON/ICON/Close_pass.png);
+    qproperty-iconSize: 20px 20px;
+    text-align: center;
+    border: 1px solid #4458FE;
+}
+
+
+
+/********* 普通椭圆按钮三种状态效果 *********/
+QPushButton#pBtn_cancel
+{
+	border-radius: 16px;
+	text-align: center;
+    background: #FFFFFF;
+    border: 1px solid #E6E9F4;
+    color: #3A3F63;
+}
+QPushButton#pBtn_cancel:hover
+{
+	text-align: center;
+    background: #FFFFFF;
+    border-radius: 16px;
+    border: 1px solid #4458FE;
+    color: #4458FE;
+}
+
+/********* 带有底色按钮三种状态效果 *********/
+QPushButton#pBtn_ok
+{
+	border-radius: 16px;
+	text-align: center;
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:1 #4F8AFF,stop:0 #4B5EFF);
+}
+
+QPushButton#pBtn_ok:hover
+{
+	border-radius: 16px;
+	text-align: center;
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:0 #5D73FF,stop:1 #6092FF);
+}
+
+/* ==========================================================
+ *  QCheckBox
+ * ========================================================== */
+
+/* 左下角和右下角是直角 */
+QCheckBox#checkBox_list
+{
+    background: transparent;
+
+    font-weight: 500;
+    font-size: 16px;
+    text-align: left;
+    font-style: normal;
+    text-transform: none;
+
+    padding-left: 16px;
+
+    border-top-left-radius: 4px;
+    border-top-right-radius: 4px;
+    border-bottom-left-radius: 0px;
+    border-bottom-right-radius: 0px;
+
+    border: 1px solid #E6E9F4;
+}
+
+QCheckBox
+{
+    background: #FFFFFF;
+
+    font-weight: 400;
+    font-size: 14px;
+    text-align: left;
+    font-style: normal;
+    text-transform: none;
+
+    padding-left: 16px;
+}
+
+QCheckBox::indicator 
+{
+    width: 18px; /* 勾选框的宽度 */
+    height: 18px; /* 勾选框的高度 */
+    border: 0px solid #B3C0E7; /* 勾选框的边框颜色和宽度 */
+    background: transparent; /* 勾选框的背景颜色 */
+    border-radius: 2px; /* 可选:设置圆角 */
+}
+
+QCheckBox::indicator:unchecked 
+{
+    background: transparent; /* 未选中状态的背景颜色 */
+    border-image: url(:/ICON/ICON/CheckBox_UnChecked.png); /* 未选中状态的图标 */
+}
+
+/* 半选中 */
+QCheckBox::indicator:indeterminate
+{
+    background: transparent; /* 未选中状态的背景颜色 */
+    border-image: url(:/ICON/ICON/CheckBox_PartiallyChecked.png); /* 未选中状态的图标 */
+}
+
+QCheckBox::indicator:checked 
+{
+    background: transparent;            /* 选中状态的背景颜色 */
+    border: 0px solid #4458FE;      /* 选中状态的边框颜色 */
+    border-image: url(:/ICON/ICON/CheckBox_Checked.png); /* 选中状态的图标 */
+}
+
+
+/*===============================================================
+ * QScrollBar 滚动条
+ ================================================================*/
+QScrollArea
+{
+	background: transparent;
+	border-top-left-radius: 0px;
+    border-top-right-radius: 0px;
+    border-bottom-left-radius: 4px;
+    border-bottom-right-radius: 4px;
+
+	border-left: 1px solid #E6E9F4;
+    border-right: 1px solid #E6E9F4;
+    border-bottom: 1px solid #E6E9F4;
+}
+
+/* 这里必须设置颜色,不然会显示灰白色 */
+QWidget#widget_spacer
+{
+    background: #FFFFFF;
+}
+
+
+QScrollBar:horizontal, QScrollBar:vertical
+{
+    border:none;
+    background-color: rgba(255, 255, 255, 0);
+    margin: 0px 0px 0px 0px;
+}
+QScrollBar:horizontal
+{
+    height: 12px;
+}
+QScrollBar:vertical
+{
+    width: 6px;
+}
+QScrollBar::handle:horizontal,QScrollBar::handle:vertical
+{
+    background: #E2E2E2;
+    border-radius: 3px;
+    min-width: 8px;
+}
+QScrollBar::handle:horizontal
+{
+    min-width: 8px;
+}
+QScrollBar::handle:vertical
+{
+    min-height: 113px;
+}
+QScrollBar::add-line:horizontal, QScrollBar::sub-line:horizontal,
+QScrollBar::add-line:vertical, QScrollBar::sub-line:vertical
+{
+    background-color: rgba(255, 255, 255, 0);
+    border: none;
+}
+QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal,
+QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical
+{
+    background-color: rgba(255, 255, 255, 0);
+    background: none;
+}
+

+ 76 - 14
TransmitterSwitch/Resource/QSS/white/importtemplate.qss

@@ -1,6 +1,5 @@
 QWidget
 {
-    background: #FFFFFF;
     border-radius: 8px;
 
     /* font-family: 思源黑体R; */
@@ -67,7 +66,7 @@ QPushButton#pBtn_close
     qproperty-iconSize: 20px 20px;
 
     text-align: center;
-    border: 0px solid #438EFF;
+    border: 0px solid #4458FE;
 }
 
 QPushButton#pBtn_close[Hover = true]
@@ -79,24 +78,22 @@ QPushButton#pBtn_close[Hover = true]
     qproperty-iconSize: 20px 20px;
     text-align: center;
 
-    border: 1px solid #438EFF;
+    border: 1px solid #4458FE;
 }
 
 
 
-/********* 普通方框按钮三种状态效果 *********/
+/********* 普通椭圆按钮三种状态效果 *********/
 QPushButton#pBtn_cancel
 {
 	border-radius: 16px;
 	text-align: center;
     background: #FFFFFF;
-    border-radius: 16px;
     border: 1px solid #E6E9F4;
     color: #3A3F63;
 }
 QPushButton#pBtn_cancel:hover
 {
-	border-radius: 16px;
 	text-align: center;
     background: #FFFFFF;
     border-radius: 16px;
@@ -111,7 +108,6 @@ QPushButton#pBtn_ok
 	text-align: center;
     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
@@ -120,24 +116,44 @@ QPushButton#pBtn_ok:hover
 	text-align: center;
     color:white;
     background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:0 #5D73FF,stop:1 #6092FF);
-    border-radius: 16px;
 }
 
+
 /* ==========================================================
- *  QTabelWidget
+ *  QTableWidget
  * ========================================================== */
 
 QTableWidget
 {
-    background: #FFFFFF;
-    padding-left: 0px;
-    border: 0px solid #E6E9F4;
+    background: transparent;
+    padding-left: 16px;
+    border: none;
     text-align: left;
 }
 
+/* 设置标题栏,如果不生效,可能是在UI里面设置了样式表,导致冲突了 */
+QTableWidget QHeaderView
+{
+    background: transparent;
+}
+
+QTableWidget QHeaderView::section
+{
+    background: transparent;
+    padding-left: 16px;
+    font-weight: 500;
+    font-size: 14px;
+
+    
+    border: 0px solid #E6E9F4;
+    border-top: 1px solid #E6E9F4;
+    border-bottom: 1px solid #E6E9F4;
+}
+
+
 QTableWidget::item
 {
-    padding-left: 12px;
+    padding-left: 16px;
     padding-right: 0px;
     padding-top: 0px;
     padding-bottom: 0px;
@@ -151,6 +167,52 @@ QTableWidget::item
 
 QTableWidget::item:selected
 {
-    background: rgba(231,236,255,0.5);
+    color: #FFFFFF;
+    background: #4458FE;
 }
 
+/* ==========================================================
+ *  QCheckBox
+ * ========================================================== */
+
+QCheckBox
+{
+    background: transparent;
+
+    font-weight: 400;
+    font-size: 14px;
+    text-align: left;
+    font-style: normal;
+    text-transform: none;
+
+    /* padding-left: 16px; */
+}
+
+QCheckBox::indicator 
+{
+    width: 20px; /* 勾选框的宽度 */
+    height: 20px; /* 勾选框的高度 */
+    border: none; /* 勾选框的边框颜色和宽度 */
+    background: transparent; /* 勾选框的背景颜色 */
+    border-radius: 2px; /* 可选:设置圆角 */
+}
+
+QCheckBox::indicator:unchecked 
+{
+    background: transparent; /* 未选中状态的背景颜色 */
+    border-image: url(:/ICON/ICON/CheckBox_UnChecked.png); /* 未选中状态的图标 */
+}
+
+/* 半选中 */
+QCheckBox::indicator:indeterminate
+{
+    background: transparent; /* 未选中状态的背景颜色 */
+    border-image: url(:/ICON/ICON/CheckBox_PartiallyChecked.png); /* 未选中状态的图标 */
+}
+
+QCheckBox::indicator:checked 
+{
+    background: transparent;            /* 选中状态的背景颜色 */
+    border: 0px solid #4458FE;      /* 选中状态的边框颜色 */
+    border-image: url(:/ICON/ICON/CheckBox_Checked.png); /* 选中状态的图标 */
+}

+ 391 - 0
TransmitterSwitch/Resource/QSS/white/managerplan.qss

@@ -0,0 +1,391 @@
+
+/* ==========================================================
+ *  通用样式
+ * ========================================================== */
+QWidget
+{
+    font-size: 14px;
+    color: #3A3F63;
+    line-height: 21px;
+    text-align: left;
+    font-style: normal;
+    border-radius: 8px;
+    background: transparent;
+}
+
+QWidget#widget
+{
+    background: rgba(255, 255, 255, 0.01);
+}
+
+QWidget#widget_background
+{
+    background-color: #FFFFFF;
+}
+
+QWidget#widget_top
+{
+    /* background: rgba(108,105,124,0.2); */
+    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_title
+{
+    background: transparent;
+    font-size: 18px;
+    color: #3A3F63;
+    line-height: 27px;
+    text-align: left;
+    font-style: normal;
+    text-transform: uppercase;
+}
+
+QLabel#label_selectChn
+{
+    font-weight: 500;
+    font-size: 16px;
+    color: #3A3F63;
+    line-height: 22px;
+    text-align: left;
+    font-style: normal;
+    text-transform: none;
+}
+
+QLabel#label_x1, #label_x2, #label_x3, #label_x4, #label_x5, #label_x6
+{
+    background: transparent;
+    font-size: 14px;
+    color: #F53F3F;
+    text-align: left;
+    font-style: normal;
+}
+
+QPushButton
+{
+	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_deletePlan, #pBtn_editPlan
+{
+    background: transparent;
+    color: #3A3F63;
+	border: 1px solid #E6E9F4;
+    border-radius: 4px;
+}
+QPushButton#pBtn_deletePlan:hover, #pBtn_editPlan: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;
+}
+
+
+QLabel#label_devWarn,QLabel#label_timeWarn,QLabel#label_actionWarn
+{
+    /* font-weight: 400; */
+    font-size: 14px;
+    color: #D21F21;
+    line-height: 21px;
+    text-align: left;
+    font-style: normal;
+}
+
+/* ==========================================================
+ *  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/ICON/DownArrow_Light.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;
+}
+
+/* ==========================================================
+ *  时间报警红框
+ * ========================================================== */
+
+TimeWidget
+{
+    background: #FFFFFF;
+    /* background: #373639; */
+    border-radius: 4px;
+    padding-left:12px;
+    border: 1px solid #E6E9F4;
+}
+
+TimeWidget:hover
+{
+    background: #FFFFFF;
+    /* background: #373639; */
+    border-radius: 4px;
+    padding-left:12px;
+    border: 1px solid #4458FE;
+}
+
+
+
+
+/* ==========================================================
+ *  日期选择器
+ * ========================================================== */
+
+CalendarDTEdit
+{
+	background: transparent;
+    border-radius: 4px;
+    padding-left:12px;
+    border: 1px solid #E6E9F4;
+}
+
+CalendarDTEdit:hover
+{
+    border-radius: 4px;
+    padding-left:12px;
+    border: 1px solid #4458FE;
+}
+
+CalendarDTEdit[Warn=true]
+{
+    border-radius: 4px;
+    padding-left:12px;
+    border: 1px solid #D21F21;
+}
+
+CalendarDTEdit:!enabled/* 或者disable */
+{
+    background: rgba(0,0,0,0.04);
+    border: 1px solid #E6E9F4;
+}
+
+CalendarDTEdit::drop-down
+{
+ 	padding-right: 8px;
+	width: 16px;
+    image: url(:/ICON/ICON/date_light.png);
+}
+
+/* ==========================================================
+ *  QTabWidget
+ * ========================================================== */
+
+/* 设置 TabBar 的整体背景颜色 */
+QTabBar 
+{
+    background: transparent; /* 整体背景颜色 */
+    border-radius: 2px; /* 圆角 */
+    border: 1px solid #E6E9F4; /* 边框颜色 */
+}
+
+/* 设置标签的默认样式 */
+QTabBar::tab 
+{
+    min-width: 66px; /* 标签最小宽度 */
+    min-height: 28px; /* 标签最小高度 */
+    border-radius: 2px; /* 圆角 */
+    margin: 6px;
+
+    font-weight: 400;
+    font-size: 14px;
+    line-height: 20px;
+    text-align: left;
+    font-style: normal;
+    text-transform: none;
+    /* border: 1px solid #E6E9F4; */
+}
+
+/* 设置选中标签的样式 */
+QTabBar::tab:selected 
+{
+    background: #4458FE; /* 选中标签的背景颜色 */
+    border-radius: 2px; /* 圆角 */
+    margin: 6px; /* 内缩 6px */
+
+    color: #FFFFFF;
+    font-weight: 500;
+    font-size: 14px;
+    line-height: 20px;
+    text-align: left;
+    font-style: normal;
+    text-transform: none;
+}
+
+QTabWidget::pane
+{
+    border: none; /* 去掉边框 */
+}
+
+QWidget#tab_week, #tab_special
+{
+    background: transparent; /* 背景颜色 */
+    border-radius: 0px;
+    border: 0px solid rgba(255,255,255,0.15);
+}

+ 96 - 0
TransmitterSwitch/Resource/QSS/white/previewplan.qss

@@ -0,0 +1,96 @@
+QWidget
+{
+    font-size: 14px;
+    color: #3A3F63;
+    line-height: 21px;
+    text-align: left;
+    font-style: normal;
+}
+
+QWidget#widget
+{
+    background: #FFFFFF;
+    border-radius: 8px 8px 8px 8px;
+}
+
+QWidget#widget_Top
+{
+    background: transparent;
+    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_title
+{
+    font-weight: 500;
+    font-size: 18px;
+    line-height: 24px;
+    text-align: left;
+    font-style: normal;
+    text-transform: none;
+}
+
+QPushButton
+{
+    text-align: center;
+}
+
+QPushButton#pBtn_close
+{
+	/* border-image: url(:/ICON/ICON/Dialog_close.png); */
+    background: transparent;
+    border-radius: 4px;
+    qproperty-icon: url(:/ICON/ICON/Close_Light.png);
+    qproperty-iconSize: 20px 20px;
+}
+
+QPushButton#pBtn_close[Hover = true]
+{	
+	/* border-image: url(:/ICON/ICON/Dialog_close2.png); */
+    background: transparent;
+    border-radius: 4px;
+    qproperty-icon: url(:/ICON/ICON/Close_pass.png);
+    qproperty-iconSize: 20px 20px;
+    border: 1px solid #438EFF;
+}
+
+
+
+/********* 普通椭圆按钮三种状态效果 *********/
+QPushButton#pBtn_cancel
+{
+	border-radius: 16px;
+	text-align: center;
+    background: #FFFFFF;
+    border: 1px solid #E6E9F4;
+    color: #3A3F63;
+}
+QPushButton#pBtn_cancel:hover
+{
+	text-align: center;
+    background: #FFFFFF;
+    border-radius: 16px;
+    border: 1px solid #4458FE;
+    color: #4458FE;
+}
+
+/********* 带有底色按钮三种状态效果 *********/
+QPushButton#pBtn_ok
+{
+	border-radius: 16px;
+	text-align: center;
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:1 #4F8AFF,stop:0 #4B5EFF);
+}
+
+QPushButton#pBtn_ok:hover
+{
+	border-radius: 16px;
+	text-align: center;
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:0 #5D73FF,stop:1 #6092FF);
+}

+ 187 - 0
TransmitterSwitch/Resource/QSS/white/templatemanager.qss

@@ -0,0 +1,187 @@
+
+QWidget
+{
+    font-size: 14px;
+    color: #3A3F63;
+    line-height: 21px;
+    text-align: left;
+    font-style: normal;
+}
+
+QWidget#TemplateManager
+{
+    background: transparent;
+}
+
+QWidget#widget
+{
+    background: #FFFFFF;
+    border-radius: 8px 8px 8px 8px;
+}
+
+QWidget#widget_Top
+{
+    background: transparent;
+    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_title
+{
+    font-weight: 500;
+    font-size: 18px;
+    line-height: 24px;
+    text-align: left;
+    font-style: normal;
+    text-transform: none;
+}
+
+QPushButton
+{
+    text-align: center;
+}
+
+QPushButton#pBtn_close
+{
+	/* border-image: url(:/ICON/ICON/Dialog_close.png); */
+    background: transparent;
+    border-radius: 4px;
+    qproperty-icon: url(:/ICON/ICON/Close_Light.png);
+    qproperty-iconSize: 20px 20px;
+
+    text-align: center;
+}
+
+QPushButton#pBtn_close[Hover = true]
+{	
+	/* border-image: url(:/ICON/ICON/Dialog_close2.png); */
+    background: transparent;
+    border-radius: 4px;
+    qproperty-icon: url(:/ICON/ICON/Close_pass.png);
+    qproperty-iconSize: 20px 20px;
+    border: 1px solid #438EFF;
+}
+
+
+
+/********* 普通椭圆按钮三种状态效果 *********/
+QPushButton#pBtn_cancel
+{
+	border-radius: 16px;
+    background: #FFFFFF;
+    border: 1px solid #E6E9F4;
+    color: #3A3F63;
+}
+QPushButton#pBtn_cancel:hover
+{
+	border-radius: 16px;
+	text-align: center;
+    background: #FFFFFF;
+    border: 1px solid #4458FE;
+    color: #4458FE;
+}
+
+
+/********* 带有底色按钮三种状态效果 *********/
+QPushButton#pBtn_ok
+{
+	border-radius: 16px;
+	text-align: center;
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:1 #4F8AFF,stop:0 #4B5EFF);
+}
+
+QPushButton#pBtn_ok:hover
+{
+	border-radius: 16px;
+	text-align: center;
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:0 #5D73FF,stop:1 #6092FF);
+}
+
+
+/* ==========================================================
+ *  QTableWidget
+ * ========================================================== */
+
+QTableWidget
+{
+    background: transparent;
+    /* padding-left: 16px; */
+    border: 0px solid #E6E9F4;
+    text-align: left;
+}
+
+/* 设置标题栏,如果不生效,可能是在UI里面设置了样式表,导致冲突了 */
+QTableWidget QHeaderView
+{
+    background: transparent;
+}
+
+QTableWidget QHeaderView::section
+{
+    background: transparent;
+    padding-left: 16px;
+    font-weight: 500;
+    font-size: 14px;
+    
+    border: 0px solid #E6E9F4;
+    border-top: 1px solid #E6E9F4;
+    border-bottom: 1px solid #E6E9F4;
+}
+
+
+QTableWidget::item
+{
+    background: transparent;
+
+    padding-left: 16px;
+    padding-right: 0px;
+    padding-top: 0px;
+    padding-bottom: 0px;
+
+    margin: 0px;
+
+    text-align: left;
+
+    border: 0px solid #E6E9F4;
+}
+
+QTableWidget::item:selected
+{
+    color: #FFFFFF;
+    background: #4458FE;
+}
+
+QLineEdit
+{
+    color: #1e1c1c;
+    background: #FFFFFF;
+    border-radius: 4px;
+    /* border: 1px solid #438EFF; */
+}
+
+/* QTableWidget::item:editable
+{
+    color: #464649;
+    background: #438EFF;
+}
+
+QTableWidget::item:focus
+{
+    color: #464649;
+    background: #438EFF;
+} */
+
+/* QCheckBox::indicator
+{
+    width: 16px;
+    height: 16px;
+    border-radius: 4px;
+    background: #B3C0E7;
+} */
+

+ 10 - 8
TransmitterSwitch/Resource/QSS/white/transmitterswitch.qss

@@ -96,11 +96,15 @@ QLabel#label_TipText
     border: 0px solid rgba(255,255,255,0.15);
 }
 
+QPushButton
+{
+    text-align: center;
+}
+
 
 QPushButton#pBtn_editPlan, #pBtn_clearPlan, #pBtn_importPlan, #pBtn_exportPlan, #pBtn_deletePlan, #pBtn_cloneToOther, #pBtn_refresh,
 #pBtn_templateManager
 {
-    text-align: center;
     background-color: #FFFFFF;
     border-radius: 2px 2px 2px 2px;
     border: 1px solid #DAE0F2;
@@ -109,7 +113,7 @@ QPushButton#pBtn_editPlan, #pBtn_clearPlan, #pBtn_importPlan, #pBtn_exportPlan,
 QPushButton#pBtn_editPlan:hover, #pBtn_clearPlan:hover, #pBtn_importPlan:hover, #pBtn_exportPlan:hover, #pBtn_deletePlan:hover, 
 #pBtn_cloneToOther:hover, #pBtn_refresh:hover, #pBtn_templateManager:hover
 {
-    text-align: center;
+    
     color: #4458FE;
     background-color: #FFFFFF;
     border-radius: 2px;
@@ -119,17 +123,15 @@ QPushButton#pBtn_editPlan:hover, #pBtn_clearPlan:hover, #pBtn_importPlan:hover,
 /* 添加按钮 */
 QPushButton#pBtn_addPlan
 {
-    text-align: center;
-    color: #FFFFFF;
-    background: #438EFF;
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:1 #4F8AFF,stop:0 #4B5EFF);
     border-radius: 2px 2px 2px 2px;
 }
 
 QPushButton#pBtn_addPlan:hover
 {
-    text-align: center;
-    color: #FFFFFF;
-    background: #5F9EFF;
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:0 #5D73FF,stop:1 #6092FF);
     border-radius: 2px 2px 2px 2px;
 }
 

+ 4 - 8
TransmitterSwitch/Resource/TransSwitch.qrc

@@ -5,22 +5,18 @@
         <file>QSS/white/transmitterswitch.qss</file>
         <file>QSS/white/warning.qss</file>
         <file>QSS/white/warning.qss</file>
-        <file>QSS/white/SelectTime/timepartwidget.qss</file>
-        <file>QSS/white/SelectTime/timewidget.qss</file>
-        <file>QSS/white/SelectDate/calendarheader.qss</file>
-        <file>QSS/white/SelectDate/calendarnav.qss</file>
         <file>QSS/white/pBtn_frequency.qss</file>
         <file>QSS/white/plancard.qss</file>
+        <file>QSS/white/managerplan.qss</file>
+        <file>QSS/white/templatemanager.qss</file>
+        <file>QSS/white/copytoother.qss</file>
+        <file>QSS/white/previewplan.qss</file>
         <file>QSS/dark/addspecialitem.qss</file>
         <file>QSS/dark/importtemplate.qss</file>
         <file>QSS/dark/savetotemplate.qss</file>
         <file>QSS/dark/transmitterswitch.qss</file>
         <file>QSS/dark/warning.qss</file>
         <file>QSS/dark/warning.qss</file>
-        <file>QSS/dark/SelectTime/timepartwidget.qss</file>
-        <file>QSS/dark/SelectTime/timewidget.qss</file>
-        <file>QSS/dark/SelectDate/calendarheader.qss</file>
-        <file>QSS/dark/SelectDate/calendarnav.qss</file>
         <file>QSS/dark/pBtn_frequency.qss</file>
         <file>QSS/dark/plancard.qss</file>
         <file>QSS/dark/managerplan.qss</file>

+ 9 - 2
TransmitterSwitch/Template/savetotemplate.cpp

@@ -8,6 +8,7 @@
 
 #include "LHQLogAPI.h"
 #include "OneShadowEffect.h"
+#include "UIStyleManager.h"
 
 SaveToTemplate::SaveToTemplate(QWidget *parent) :
     QDialog(parent),
@@ -31,7 +32,7 @@ SaveToTemplate::SaveToTemplate(QWidget *parent) :
     /* 设置提示文本 */
     // ui->lineEdit->setPlaceholderText("请输入模版名称");
     m_placeHolder = "请输入模版名称";
-    m_placeHolderColor = QColor("#B1B3B4");
+    // m_placeHolderColor = QColor("#B1B3B4");
 
     m_list.clear();
 
@@ -93,6 +94,12 @@ void SaveToTemplate::setQSS(QString qssPath)
     {
         LH_WRITE_ERROR(QString("打开文件失败:%1").arg(file.fileName()));
     }
+    if(EPUIStyle.getUIStyle() == enum_UIStyle::UI_Light)
+    {
+        m_placeHolderColor = QColor("#000000");
+    }else {
+        m_placeHolderColor = QColor("#B1B3B4");
+    }
 }
 
 void SaveToTemplate::do_ok()
@@ -207,7 +214,7 @@ bool SaveToTemplate::eventFilter(QObject *watched, QEvent *event)
                 /* 获取占位符字体和颜色 */
                 QFont font = ui->lineEdit->font();
                 painter.setFont(font);
-                QPalette palette = ui->lineEdit->palette();
+                // QPalette palette = ui->lineEdit->palette();
                 painter.setPen(m_placeHolderColor);
                 /* 绘制占位符 */
                 painter.drawText(rect, Qt::AlignLeft | Qt::AlignVCenter, m_placeHolder);

+ 1 - 1
TransmitterSwitch/common/LHHTTPAPI/src/lhhttpapi.cpp

@@ -150,7 +150,7 @@ int lhhttpapi::DBLogin(const QString& pLocalip,const QString &pSerid, const QStr
     if(fnDBLogin == nullptr) return -1;
     //char buffer[LHHTTPAPI_BUFFER_SIZE] = {0};
     char *buffer = new char[LHHTTPAPI_BUFFER_SIZE];
-    int ret =  fnDBLogin(pLocalip.toUtf8().data(),pSerid.toUtf8().data(),appType.toUtf8().data(), buffer, LHHTTPAPI_BUFFER_SIZE,bismulti,phttpip);
+    int ret =  fnDBLogin(pLocalip.toUtf8().data(),pSerid.toUtf8().data(),appType.toUtf8().data(), buffer, LHHTTPAPI_BUFFER_SIZE - 1,bismulti,phttpip);
     pszUserToken = QString::fromUtf8(buffer);
 
     m_strtoken = pszUserToken;

+ 0 - 0
TransmitterSwitch/Resource/QSS/dark/SelectTime/timepartwidget.qss → TransmitterSwitch/common/SelectTime/Res/dark/timepartwidget.qss


+ 0 - 0
TransmitterSwitch/Resource/QSS/dark/SelectTime/timewidget.qss → TransmitterSwitch/common/SelectTime/Res/dark/timewidget.qss


+ 9 - 0
TransmitterSwitch/Resource/QSS/white/SelectTime/timepartwidget.qss → TransmitterSwitch/common/SelectTime/Res/light/timepartwidget.qss

@@ -1,3 +1,12 @@
+
+QWidget
+{
+    border-radius: 0px;
+    background: #FFFFFF;
+}
+
+
+
 QListWidget
 {
 	/* font-family:"Source Han Sans CN"; */

+ 2 - 0
TransmitterSwitch/Resource/QSS/white/SelectTime/timewidget.qss → TransmitterSwitch/common/SelectTime/Res/light/timewidget.qss

@@ -2,10 +2,12 @@ QPushButton
 {
 	border-image: url(:/images/datetime.png);
 }
+
 QPushButton[selected=true]
 {
 	border-image: url(:/images/datetime.png);
 }
+
 QPushButton::hover[selected=true]
 {
 	border-image: url(:/images/cancle.png);

+ 8 - 0
TransmitterSwitch/common/SelectTime/SelectTime.qrc

@@ -0,0 +1,8 @@
+<RCC>
+    <qresource prefix="/">
+    <file>Res/light/timepartwidget.qss</file>
+    <file>Res/light/timewidget.qss</file>
+    <file>Res/dark/timepartwidget.qss</file>
+    <file>Res/dark/timewidget.qss</file>
+    </qresource>
+</RCC>

+ 14 - 6
TransmitterSwitch/common/SelectTime/timepartwidget.cpp

@@ -10,6 +10,7 @@
 // #include "lhstylemanager.h"
 // #include "LHQLogApi.h"
 #include "UIStyleManager.h"
+#include "spdlog/spdlog.h"
 
 TimePartWidget::TimePartWidget(QWidget *parent) :
     QWidget(parent),
@@ -105,8 +106,15 @@ void TimePartWidget::ScrollToSelect()
 /* 设置QSS */
 void TimePartWidget::setQSS()
 {
-    // QString appPath = QCoreApplication::applicationDirPath();
-    QString qssPath = EPUIStyle.getQSSPath() + "/SelectTime/timepartwidget.qss";
+    QString qssPath;
+    if(EPUIStyle.getUIStyle() == enum_UIStyle::UI_Light)
+    {
+        qssPath = QString(":/Res/light/timepartwidget.qss");
+    }
+    else if(EPUIStyle.getUIStyle() == enum_UIStyle::UI_Dark)
+    {
+        qssPath = QString(":/Res/dark/timepartwidget.qss");
+    }
 
     QFile file(qssPath);
     if(file.open(QFile::ReadOnly))
@@ -115,10 +123,10 @@ void TimePartWidget::setQSS()
         setStyleSheet(styleSheet);
         file.close();
     }
-    // else 
-    // {
-    //     LH_WRITE_ERROR("open qss file failed: " + qssPath);
-    // }
+    else 
+    {
+        SPDLOG_ERROR("open qss file failed: {}", qssPath.toStdString());
+    }
 }
 
 void TimePartWidget::enterEvent(QEvent *event)

+ 12 - 5
TransmitterSwitch/common/SelectTime/timewidget.cpp

@@ -8,6 +8,7 @@
 #include "timepartwidget.h"
 #include "shadowwidget.h"
 #include "UIStyleManager.h"
+#include "spdlog/spdlog.h"
 
 TimeWidget::TimeWidget(QWidget *parent , ShowType type) :
     QFrame(parent),
@@ -226,7 +227,13 @@ void TimeWidget::setEditLine(int w, int h)
 /* 设置QSS */
 void TimeWidget::setQSS()
 {
-    QString qssPath = EPUIStyle.getQSSPath() + "/SelectTime/timewidget.qss";
+    QString qssPath;
+    if(EPUIStyle.getUIStyle() == enum_UIStyle::UI_Light)
+    {
+        qssPath = ":/Res/light/timewidget.qss";
+    } else {
+        qssPath = ":/Res/dark/timewidget.qss";
+    }
 
     QFile file(qssPath);
     if(file.open(QFile::ReadOnly))
@@ -235,10 +242,10 @@ void TimeWidget::setQSS()
         setStyleSheet(styleSheet);
         file.close();
     }
-    // else 
-    // {
-    //     LH_WRITE_ERROR("open qss file failed: " + qssPath);
-    // }
+    else 
+    {
+        SPDLOG_ERROR("open qss file failed: {}", qssPath.toStdString());
+    }
 }
 
 /**

+ 128 - 13
TransmitterSwitch/transmitterswitch.cpp

@@ -33,6 +33,7 @@ TransmitterSwitch::TransmitterSwitch(QWidget *parent) :
 {
     ui->setupUi(this);
 
+    LH_WRITE_LOG("================================== TransmitterPlan =================================");
     /* 创建一个布局 */
     QVBoxLayout* layout = new QVBoxLayout(parent);
     layout->setMargin(0);
@@ -175,6 +176,11 @@ void TransmitterSwitch::setWebAPIInfo(const InitData& data)
  */
 void TransmitterSwitch::getExecPlanFromEQM()
 {
+    if(m_fromWebAPI == nullptr)
+    {
+        LH_WRITE_ERROR("未初始化WebAPI");
+        return;
+    }
     /* 判断是在线还是离线模式 */
     if(!GInfo.isOnlineDB())
     {
@@ -260,6 +266,11 @@ void TransmitterSwitch::getExecPlanFromEQM()
 /* 将计划保存到EQM数据库 */
 void TransmitterSwitch::saveExecPlanToEQM()
 {
+    if(m_fromWebAPI == nullptr)
+    {
+        LH_WRITE_ERROR("未初始化WebAPI");
+        return;
+    }
     /* 判断是在线还是离线模式 */
     if(!GInfo.isOnlineDB())
     {
@@ -353,7 +364,11 @@ void TransmitterSwitch::setWebAPIInfoOnly(const InitData& data)
         LH_WRITE_ERROR("WebAPI info is empty");
         return;
     }
-    m_fromWebAPI->initWebApi(data.url, data.serverID, data.serverKey);
+    if(!m_fromWebAPI->initWebApi(data.url, data.serverID, data.serverKey))
+    {
+        LH_WRITE_ERROR("WebAPI init failed");
+        return;
+    }
 }
 
 
@@ -430,6 +445,17 @@ void TransmitterSwitch::clearAll()
     m_listFrequencyBtn.clear();
     /* 清空频率信息 */
     ChnContainer.clearAllChannel();
+    /* 删除数据库连接实例 */
+    if(m_fromWebAPI != nullptr)
+    {
+        delete m_fromWebAPI;
+        m_fromWebAPI = nullptr;
+    }
+    if(m_fromSQLite != nullptr)
+    {
+        delete m_fromSQLite;
+        m_fromSQLite = nullptr;
+    }
 }
 
 
@@ -545,6 +571,12 @@ void TransmitterSwitch::do_pBtnAddExecPlan()
         }
         /* 设置计划列表 */
         pCard->setPlanList(list);
+
+        if(!GInfo.isOnlineDB())
+        {
+            /* 离线模式不需要写入数据库 */
+            continue;
+        }
         /* 写入数据库 */
         QList<OnePlanItemInfo> listPlan;
         pCard->getAllPlanInfo(listPlan);
@@ -599,14 +631,19 @@ void TransmitterSwitch::do_pBtnModifyExecPlan()
     auto list = mapPlanInfo.find(pCard->getChannelInfo().ChannelID);
     pCard->setPlanList(*list);
 
-    int chnID = pCard->getChannelInfo().ChannelID;
-    QList<OnePlanItemInfo> listPlan;
-    pCard->getAllPlanInfo(listPlan);
-    if(!m_fromWebAPI->insertData(chnID, listPlan))
+    /* 在线模式写入数据库,离线模式不需要写入 */
+    if(GInfo.isOnlineDB())
     {
-        LH_WRITE_ERROR(QString("频率ID为%1的计划写入数据库失败").arg(chnID));
-        TipWidget::display(TipWidget::OPERATOR_FAIL, QString("频率<%1>计划写入数据库失败").arg(pCard->getChannelInfo().ChannelName), this);
+        int chnID = pCard->getChannelInfo().ChannelID;
+        QList<OnePlanItemInfo> listPlan;
+        pCard->getAllPlanInfo(listPlan);
+        if(!m_fromWebAPI->insertData(chnID, listPlan))
+        {
+            LH_WRITE_ERROR(QString("频率ID为%1的计划写入数据库失败").arg(chnID));
+            TipWidget::display(TipWidget::OPERATOR_FAIL, QString("频率<%1>计划写入数据库失败").arg(pCard->getChannelInfo().ChannelName), this);
+        }
     }
+    
     TipWidget::display(TipWidget::OPERATOR_OK, "修改计划成功", this);
     /* 调用回调函数 */
     if(m_trackCB != nullptr)
@@ -625,6 +662,15 @@ void TransmitterSwitch::do_pBtnRefresh()
 /* 点击了“是否开启计划”按钮 */
 void TransmitterSwitch::do_pBtnIsOpenPlan()
 {
+    if(!GInfo.isOnlineDB())
+    {
+        return;
+    }
+    if(m_fromWebAPI == nullptr)
+    {
+        LH_WRITE_ERROR("未初始化WebAPI");
+        return;
+    }
     /* 保存“默认计划”和“执行模式” */
     ConfigData config1;
     config1.key = static_cast<int>(enum_ExecPlanConfig::OpenPlan);
@@ -650,6 +696,15 @@ void TransmitterSwitch::do_pBtnIsOpenPlan()
 /* 点击了“执行模式”按钮 */
 void TransmitterSwitch::do_pBtnExecMode()
 {
+    if(!GInfo.isOnlineDB())
+    {
+        return;
+    }
+    if(m_fromWebAPI == nullptr)
+    {
+        LH_WRITE_ERROR("未初始化WebAPI");
+        return;
+    }
     /* 保存“默认计划”和“执行模式” */
     ConfigData config1;
     config1.key = static_cast<int>(enum_ExecPlanConfig::ExecMode);
@@ -713,14 +768,21 @@ void TransmitterSwitch::do_pBtnClearPlan()
     }
     /* 清空计划 */
     pCard->clearPlanItem();
-    /* 删除数据库中的计划 */
-    if(!m_fromWebAPI->deleteOneChnPlan(pCard->getChannelInfo().ChannelID))
+    if(GInfo.isOnlineDB())
     {
-        LH_WRITE_ERROR(QString("频率ID为%1的计划删除失败").arg(pCard->getChannelInfo().ChannelID));
-        TipWidget::display(TipWidget::OPERATOR_FAIL, QString("频率<%1>计划删除失败").arg(pCard->getChannelInfo().ChannelName), this);
+        /* 删除数据库中的计划 */
+        if(!m_fromWebAPI->deleteOneChnPlan(pCard->getChannelInfo().ChannelID))
+        {
+            LH_WRITE_ERROR(QString("频率ID为%1的计划删除失败").arg(pCard->getChannelInfo().ChannelID));
+            TipWidget::display(TipWidget::OPERATOR_FAIL, QString("频率<%1>计划删除失败").arg(pCard->getChannelInfo().ChannelName), this);
+        }else {
+            TipWidget::display(TipWidget::OPERATOR_OK, "清空计划成功", this);
+        }
     }else {
+        /* 离线模式不需要删除数据库中的计划 */
         TipWidget::display(TipWidget::OPERATOR_OK, "清空计划成功", this);
     }
+    
 }
 
 /* 点击了复制到其他频率按钮 */
@@ -929,6 +991,10 @@ void TransmitterSwitch::do_setUIStyle()
     /* 给所有的按钮设置样式 */
     ui->pBtn_allFrequency->setStyleSheet(EPUIStyle.StrQSS_PBtnFrequency);
     // LH_WRITE_LOG(QString("频率按钮设置样式:%1").arg(EPUIStyle.StrQSS_PBtnFrequency));
+    for(auto& it : m_listFrequencyBtn)
+    {
+        it->setStyleSheet(EPUIStyle.StrQSS_PBtnFrequency);
+    }
 }
 
 /* 选择了一个频率按钮,取消其他的选择 */
@@ -1160,10 +1226,8 @@ void TransmitterSwitch::setOneFrequencyMode()
             /* 设置频率信息 */
             GInfo.setChannelInfo(chnInfo);
         }
-        // LH_WRITE_LOG_DEBUG(QString("设置频率信息成功,频率ID:%1,频率名称:%2").arg(GInfo.getChannelInfo().ChannelID).arg(GInfo.getChannelInfo().ChannelName));
         /* 如果设置了特定的频率,删除其他的频率 */
         ChnContainer.deleteOtherChannel(GInfo.getChannelInfo().ChannelID);
-        // LH_WRITE_LOG_DEBUG(QString("map频率ID:%1,频率名称:%2").arg(ChnContainer.getMapChannel().first().ChannelID).arg(ChnContainer.getMapChannel().first().ChannelName));
     }else 
     {
         /* 清空所有频率 */
@@ -1174,6 +1238,8 @@ void TransmitterSwitch::setOneFrequencyMode()
     
     /* 隐藏复制到其他频率的按钮 */
     ui->pBtn_cloneToOther->hide();
+    /* 隐藏全部频率按钮 */
+    ui->pBtn_allFrequency->hide();
 }
 
 /* 设置使用在线或者使用离线数据库,主要是保存模版 */
@@ -1206,6 +1272,12 @@ void TransmitterSwitch::setUseOnlineDB(bool useOnlineDB)
 /* 从EQM数据库导入模版 */
 void TransmitterSwitch::importTemplateFromEQM()
 {
+    if(m_fromWebAPI == nullptr)
+    {
+        LH_WRITE_ERROR("没有初始化FromWebAPI");
+        return;
+    }
+
     QMultiMap<int, OneTemplateInfo> tabList;
     /* 判断有没有选中卡片 */
     auto pCard = PData.getCurrentPlanCard();
@@ -1306,6 +1378,12 @@ void TransmitterSwitch::importTemplateFromEQM()
 /* 从SQLite导入模版 */
 void TransmitterSwitch::importTemplateFromSQLite()
 {
+    if(m_fromSQLite == nullptr)
+    {
+        LH_WRITE_ERROR("没有初始化FromSQLite");
+        return;
+    }
+
     QMultiMap<int, OneTemplateInfo> tabList;
     /* 获取当前选中的卡片 */
     auto pCard = PData.getCurrentPlanCard();
@@ -1374,6 +1452,12 @@ void TransmitterSwitch::importTemplateFromSQLite()
 /* 将模版写入数据库 */
 void TransmitterSwitch::saveTemplateToEQM(ChannelInfo info)
 {
+    if(m_fromWebAPI == nullptr)
+    {
+        LH_WRITE_ERROR("没有初始化FromWebAPI");
+        return;
+    }
+
     auto pCard = PData.findPlanCard(info.ChannelID);
     if(pCard == nullptr)
     {
@@ -1419,6 +1503,12 @@ void TransmitterSwitch::saveTemplateToEQM(ChannelInfo info)
 /* 保存计划到SQLite数据库 */
 void TransmitterSwitch::saveTemplateToSQLite(ChannelInfo info)
 {
+    if(m_fromSQLite == nullptr)
+    {
+        LH_WRITE_ERROR("没有初始化FromSQLite");
+        return;
+    }
+
     auto pCard = PData.findPlanCard(info.ChannelID);
     if(pCard == nullptr)
     {
@@ -1464,6 +1554,12 @@ void TransmitterSwitch::saveTemplateToSQLite(ChannelInfo info)
 /* 从EQM数据库中删除一个模版 */
 void TransmitterSwitch::deleteTemplateFromEQM(OneTemplateInfo info)
 {
+    if(m_fromWebAPI == nullptr)
+    {
+        LH_WRITE_ERROR("没有初始化FromWebAPI");
+        return;
+    }
+
     /* 删除模版 */
     if(m_fromWebAPI->deleteTemplate(info))
     {
@@ -1477,6 +1573,13 @@ void TransmitterSwitch::deleteTemplateFromEQM(OneTemplateInfo info)
 /* 从SQLite数据库中删除一个模版 */
 void TransmitterSwitch::deleteTemplateFromSQLite(OneTemplateInfo info)
 {
+    if(m_fromSQLite == nullptr)
+    {
+        LH_WRITE_ERROR("没有初始化FromSQLite");
+        return;
+    }
+
+
     if(m_fromSQLite->deleteTemplate(info))
     {
         TipWidget::display(TipWidget::OPERATOR_OK, "删除模版成功", this);
@@ -1489,6 +1592,12 @@ void TransmitterSwitch::deleteTemplateFromSQLite(OneTemplateInfo info)
 /* 管理EQM数据库的模版数据 */
 void TransmitterSwitch::manageTemplateFromEQM()
 {
+    if(m_fromWebAPI == nullptr)
+    {
+        LH_WRITE_ERROR("没有初始化FromWebAPI");
+        return;
+    }
+
     /* int是频率ID */
     QMultiMap<int, OneTemplateInfo> tabList;
 
@@ -1567,6 +1676,12 @@ void TransmitterSwitch::manageTemplateFromEQM()
 /* 管理SQLite数据库的模版数据 */
 void TransmitterSwitch::manageTemplateFromSQLite()
 {
+    if (m_fromSQLite == nullptr)
+    {
+        LH_WRITE_ERROR("没有初始化FromSQLite");
+        return;
+    }
+
     QList<OneTemplateInfo> listTemplate;
     /* 获取全部的频率 */
     if(!m_fromSQLite->getTemplateList(GInfo.getChannelInfo().ChannelID, listTemplate))