Selaa lähdekoodia

V1.3
1、全新UI

Apple 3 viikkoa sitten
vanhempi
commit
2bf0d5ab7c
49 muutettua tiedostoa jossa 1457 lisäystä ja 3986 poistoa
  1. 27 1
      SwitchOnOff.sql
  2. 0 358
      TransmitterSwitch/AddItem/addnormalitem.cpp
  3. 0 95
      TransmitterSwitch/AddItem/addnormalitem.h
  4. 0 312
      TransmitterSwitch/AddItem/addnormalitem.ui
  5. 0 383
      TransmitterSwitch/AddItem/addspecialitem.cpp
  6. 0 108
      TransmitterSwitch/AddItem/addspecialitem.h
  7. 0 355
      TransmitterSwitch/AddItem/addspecialitem.ui
  8. 6 4
      TransmitterSwitch/CMakeLists.txt
  9. 46 0
      TransmitterSwitch/ExecPlanData/PlanData.cpp
  10. 36 0
      TransmitterSwitch/ExecPlanData/PlanData.h
  11. 174 0
      TransmitterSwitch/ExecPlanData/plancard.cpp
  12. 77 0
      TransmitterSwitch/ExecPlanData/plancard.h
  13. 144 0
      TransmitterSwitch/ExecPlanData/plancard.ui
  14. 0 278
      TransmitterSwitch/ItemData/ItemData.cpp
  15. 0 69
      TransmitterSwitch/ItemData/ItemData.h
  16. 0 488
      TransmitterSwitch/ItemData/oneitem.cpp
  17. 0 125
      TransmitterSwitch/ItemData/oneitem.h
  18. 0 350
      TransmitterSwitch/ItemData/oneitem.ui
  19. BIN
      TransmitterSwitch/Resource/ICON/space_dark.png
  20. BIN
      TransmitterSwitch/Resource/ICON/space_light.png
  21. 0 0
      TransmitterSwitch/Resource/QSS/dark/SelectDate/calendarheader.qss
  22. 0 0
      TransmitterSwitch/Resource/QSS/dark/SelectDate/calendarnav.qss
  23. 0 0
      TransmitterSwitch/Resource/QSS/dark/SelectTime/timepartwidget.qss
  24. 0 0
      TransmitterSwitch/Resource/QSS/dark/SelectTime/timewidget.qss
  25. 0 0
      TransmitterSwitch/Resource/QSS/dark/addnormalitem.qss
  26. 0 0
      TransmitterSwitch/Resource/QSS/dark/addspecialitem.qss
  27. 0 0
      TransmitterSwitch/Resource/QSS/dark/importtemplate.qss
  28. 0 0
      TransmitterSwitch/Resource/QSS/dark/oneitem.qss
  29. 29 0
      TransmitterSwitch/Resource/QSS/dark/pBtn_frequency.qss
  30. 0 0
      TransmitterSwitch/Resource/QSS/dark/savetotemplate.qss
  31. 31 59
      TransmitterSwitch/Resource/QSS/dark/transmitterswitch.qss
  32. 0 0
      TransmitterSwitch/Resource/QSS/dark/warning.qss
  33. 13 12
      TransmitterSwitch/Resource/TransSwitch.qrc
  34. 3 2
      TransmitterSwitch/Template/importtemplate.cpp
  35. 37 59
      TransmitterSwitch/TransmitterSwitchInfo.cpp
  36. 71 58
      TransmitterSwitch/TransmitterSwitchInfo.h
  37. 74 0
      TransmitterSwitch/UIStyle/UIStyleManager.cpp
  38. 72 0
      TransmitterSwitch/UIStyle/UIStyleManager.h
  39. 13 0
      TransmitterSwitch/UserData/pBtnUserData2.cpp
  40. 27 0
      TransmitterSwitch/UserData/pBtnUserData2.h
  41. 72 9
      TransmitterSwitch/WebAPI/FromWebAPI.cpp
  42. 2 0
      TransmitterSwitch/WebAPI/FromWebAPI.h
  43. 2 2
      TransmitterSwitch/common/SelectTime/timepartwidget.cpp
  44. 2 4
      TransmitterSwitch/common/SelectTime/timewidget.cpp
  45. 3 3
      TransmitterSwitch/common/date/calendarwidgetex.cpp
  46. 185 560
      TransmitterSwitch/transmitterswitch.cpp
  47. 16 29
      TransmitterSwitch/transmitterswitch.h
  48. 283 257
      TransmitterSwitch/transmitterswitch.ui
  49. 12 6
      show1/widget.cpp

+ 27 - 1
SwitchOnOff.sql

@@ -1,3 +1,4 @@
+-- Active: 1730791096610@@192.1.2.61@5236@EQM_CESHI
 
 #查询发射机计划
 SELECT *
@@ -174,4 +175,29 @@ WHERE KeyWord = :keyWord;
 
 SELECT *
 FROM tExecPlanConfig
-WHERE KeyWord = :keyWord;
+WHERE KeyWord = :keyWord;
+
+
+#================================================================
+# 获取设备信息
+#================================================================
+
+SELECT Dev.CHNID, Dev.DID, Dev.DTID, Dev.DNAME, Dev.DClass, Chn.CHNNAME, MP.MADDRESS, MP.MNAME, MP.MType, PT.PTTYPECODE, MP.MPID
+FROM "tDevice" AS Dev
+LEFT JOIN "tDeviceType" AS DT ON "Dev"."DTID" = "DT"."DTID"
+LEFT JOIN "tChannel" AS Chn ON "Dev"."CHNID" = "Chn"."CHNID"
+LEFT JOIN "tMonitorPin" AS MP ON "MP"."MPID" IN (
+    SELECT "MPID"
+    FROM "tDevicePin" AS DevPin
+    WHERE "DevPin"."DID" = "Dev"."DID"
+)
+LEFT JOIN "tPinType" AS PT ON "MP"."MType" = "PT"."PTID";
+
+
+
+#================================================================
+# 获取频率信息
+#================================================================
+
+SELECT chn.CHNID, chn.CHNNAME
+FROM tChannel AS chn;

+ 0 - 358
TransmitterSwitch/AddItem/addnormalitem.cpp

@@ -1,358 +0,0 @@
-#include "addnormalitem.h"
-#include "ui_addnormalitem.h"
-
-#include <memory>
-#include <QDebug>
-#include <QListView>
-#include <QFile>
-#include <QApplication>
-#include <QDesktopWidget>
-#include <QPainter>
-#include <QMouseEvent>
-
-#include "common/combobox/customcombobox.h"
-#include "LHQLogAPI.h"
-#include "TransmitterSwitchInfo.h"
-#include "common/SelectTime/timewidget.h"
-#include "ItemData.h"
-#include "OneShadowEffect.h"
-
-// #include "lhstylemanager.h"
-
-AddNormalItem::AddNormalItem(QWidget *parent) :
-    QDialog(parent),
-    ui(new Ui::AddNormalItem)
-{
-    ui->setupUi(this);
-
-    /* 设置无边框 */
-    setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint);
-    /* 设置底层样式表,让最底层的透明 */
-    this->setAttribute(Qt::WA_TranslucentBackground);
-
-    /* 加载QSS */
-    // QFile file(":/QSS/QSS/AddNormalItem_Light.qss");
-    // if(file.open(QIODevice::ReadOnly))
-    // {
-    //     QString stylesheet = file.readAll();
-    //     this->setStyleSheet(stylesheet);
-    //     file.close();
-    // } else
-    // {
-    //     LH_WRITE_ERROR(QString("打开文件失败:%1").arg(file.fileName()));
-    // }
-
-
-    OneShadowEffect *pShadowEffect = new OneShadowEffect(this);
-    ui->widget_background->setGraphicsEffect(pShadowEffect);
-
-
-    ui->label_timeWarn->hide();
-    ui->label_devWarn->hide();
-    ui->label_actionWarn->hide();
-
-    /* 获取屏幕大小 */
-    m_rectScreen = QApplication::desktop()->availableGeometry();
-    this->resize(m_rectScreen.width(), m_rectScreen.height());
-    /* 设置默认时间 */
-    m_time.setHMS(0, 0, 0);
-
-    /* 连接信号和槽 */
-    connect(ui->pBtn_Close, &QPushButton::clicked, this, &QDialog::close);
-    connect(ui->pBtn_cancel, &QPushButton::clicked, this, &QDialog::close);
-    connect(ui->pBtn_ok, &QPushButton::clicked, this, &AddNormalItem::do_ok);
-    connect(ui->pBtn_cancel, &QPushButton::clicked, this, &AddNormalItem::close);
-
-    /* 设备选择 */
-    connect(ui->comBox_devSelect, QOverload<const QString&>::of(&QComboBox::currentTextChanged), this, &AddNormalItem::do_selectDev);
-    /* 动作选择 */
-    connect(ui->comBox_actionSelect,QOverload<const QString&>::of(&QComboBox::currentTextChanged),this, &AddNormalItem::do_selectAction);
-    /* 打开时间选择器 */
-    connect(ui->pBtn_selectTime, &QPushButton::clicked, this, &AddNormalItem::do_selectTime);
-    
-    /* 设置事件过滤器 */
-    ui->comBox_actionSelect->installEventFilter(this);
-    ui->comBox_devSelect->installEventFilter(this);
-    ui->pBtn_Close->installEventFilter(this);
-}
-
-AddNormalItem::~AddNormalItem()
-{
-    delete ui;
-}
-
-/* 设置父指针,时间选择器需要使用 */
-void AddNormalItem::setParentPointer(QWidget* p)
-{
-    m_parent = p;
-    // m_parent->installEventFilter(this);
-}
-
-/* 添加可选设备 */
-void AddNormalItem::setDevice(QMap<QString, DeviceInfo>& mapDev)
-{
-    ui->comBox_devSelect->clear();
-    for(const auto& it : mapDev)
-    {
-        ui->comBox_devSelect->addItem(it.devName);
-    }
-    /* 设置显示第一个设备,并设置可选的动作 */
-    ui->comBox_devSelect->setCurrentIndex(0);
-    m_devName = ui->comBox_devSelect->currentText();
-    setAction(m_devName);
-}
-
-/* 设置周几 */
-void AddNormalItem::setWeekDay(int week)
-{
-    if(week < 0 || week > 6)
-    {
-        return;
-    }
-    m_week = week;
-}
-
-/* 设置QSS */
-void AddNormalItem::setQSS(const QString& qssPath)
-{
-    QString qssFile = qssPath + "/addnormalitem.qss";
-    QFile file(qssFile);
-    if(file.open(QIODevice::ReadOnly))
-    {
-        QString stylesheet = file.readAll();
-        this->setStyleSheet(stylesheet);
-        file.close();
-    } else
-    {
-        LH_WRITE_ERROR(QString("打开文件失败:%1").arg(file.fileName()));
-    }
-
-    /* 设置comboBox阴影,需要先加载样式表,在设置这个阴影 */
-    ui->comBox_devSelect->setViewShadowEffect();
-    ui->comBox_actionSelect->setViewShadowEffect();
-}
-
-/* 进行查重和关闭页面 */
-void AddNormalItem::do_ok()
-{
-    ui->label_timeWarn->hide();
-    ui->label_devWarn->hide();
-    ui->label_actionWarn->hide();
-    setComboBoxWarning(ui->comBox_devSelect,false);
-    setComboBoxWarning(ui->comBox_actionSelect, false);
-    setTimeEditWarning(false);
-
-    /* 检查设备是否为空 */
-    if(ui->comBox_devSelect->currentText().isEmpty())
-    {
-        ui->label_devWarn->setText("不能为空!");
-        ui->label_devWarn->show();
-        setComboBoxWarning(ui->comBox_devSelect, true);
-        return;
-    }
-    /* 检查动作是否为空 */
-    if(ui->comBox_actionSelect->currentText().isEmpty())
-    {
-        ui->label_actionWarn->setText("不能为空!");
-        ui->label_actionWarn->show();
-        setComboBoxWarning(ui->comBox_actionSelect, true);
-    }
-    
-    /* 检查时间是否为空 */
-    if(m_time.isNull())
-    {
-        ui->label_timeWarn->setText("不能为空!");
-        ui->label_timeWarn->show();
-        setTimeEditWarning(true);
-        return;
-    }
-    /* 进行设备查重 */
-    // bool ret = m_p->judgeTimeRepetition(*m_p->m_vecItem[m_p->m_stack->currentIndex()],m_devName,m_time);
-    bool ret = IData.judgeTimeRepetitionWithAdd(m_week, m_devName, m_time);
-    if(ret)
-    {
-        ui->label_timeWarn->setText("一个时间点,单个设备仅能执行一个操作!");
-        ui->label_timeWarn->show();
-        setTimeEditWarning(true);
-        return;
-    }
-    m_isAddDev = true;
-    /* 添加一项计划 */
-    LH_WRITE_LOG_DEBUG(QString("添加一项计划: 设备:%1, 动作:%2, 时间:%3").arg(m_devName).arg(m_action).arg(m_time.toString("hh:mm:ss")));
-
-    /* 发送信号 */
-    emit signal_addNormalItem(m_devName,m_action,m_time);
-    close();
-}
-
-
-/* 选择了设备,设置其对应的动作 */
-void AddNormalItem::do_selectDev()
-{
-    m_devName = ui->comBox_devSelect->currentText();
-    setAction(m_devName);
-}
-
-/* 选择了动作 */
-void AddNormalItem::do_selectAction()
-{
-    m_action = ui->comBox_actionSelect->currentText();
-    m_actionID = ui->comBox_actionSelect->currentData().toInt();
-}
-
-/* 点击了时间选择按钮,打开时间选择器 */
-void AddNormalItem::do_selectTime()
-{
-    // LH_WRITE_LOG_DEBUG("选择时间");
-    std::shared_ptr<TimeWidget> tw = std::make_shared<TimeWidget>(this, TimeWidget::ShowType::Dialog);
-    /* 设置图标 */
-    tw->setIcon(":/ICON/ICON/Time.png");
-    tw->setIconShow(true);
-    tw->setIconSize(16, 16);
-    /* 重新设置大小 */
-    tw->setEditLine(ui->pBtn_selectTime->width(), ui->pBtn_selectTime->height());
-    /* 设置选择框大小 */
-    tw->setTimeAreaWidth(140);
-    /* 移动位置,覆盖显示时间的按钮,获取的坐标是相对于Dialog的位置 */
-    auto pos = ui->pBtn_selectTime->mapTo(this, QPoint(0, 0));
-    tw->move(pos);
-    /* 设置默认的时间 */
-    tw->setTime(m_time);
-
-    tw->execShow();
-    m_time = tw->getTime();
-    // LH_WRITE_LOG_DEBUG(QString("选择时间:%1").arg(m_time.toString("hh:mm:ss")));
-    ui->pBtn_selectTime->setText(m_time.toString("hh:mm:ss"));
-}
-
-/* 设置选择框报警 */
-void AddNormalItem::setComboBoxWarning(QComboBox* bo, bool flag)
-{
-    if(flag)
-    {
-        bo->setProperty("Warn", true);
-    }
-    else
-    {
-        bo->setProperty("Warn", false);
-    }
-
-    bo->style()->unpolish(bo);
-    bo->style()->polish(bo);
-    
-}
-
-/* 设置时间报警 */
-void AddNormalItem::setTimeEditWarning(bool flag)
-{
-    if(flag)
-    {
-        ui->pBtn_selectTime->setProperty("Warn", true);
-    }
-    else
-    {
-        ui->pBtn_selectTime->setProperty("Warn", false);
-    }
-
-    ui->pBtn_selectTime->style()->unpolish(ui->pBtn_selectTime);
-    ui->pBtn_selectTime->style()->polish(ui->pBtn_selectTime);
-}
-
-/* 设置动作 */
-void AddNormalItem::setAction(const QString& devName)
-{
-    QMap<int, QString> devAction;
-    if(!DeviceContainer.getDevAction(devName, devAction))
-    {
-        return;
-    }
-    ui->comBox_actionSelect->clear();
-    for(auto it = devAction.begin();it != devAction.end();it++)
-    {
-        ui->comBox_actionSelect->addItem(it.value(), it.key());
-    }
-}
-
-/* 事件过滤器 */
-bool AddNormalItem::eventFilter(QObject *watched, QEvent *event)
-{
-    if(watched == ui->comBox_devSelect)
-    {
-        if(event->type() == QEvent::Wheel)
-        {
-            return true;
-        }
-    }
-    else if(watched == ui->comBox_actionSelect)
-    {
-        if(event->type() == QEvent::Wheel)
-        {
-            return true;
-        }
-    }
-    else if(watched == ui->pBtn_Close)
-    {
-        if(event->type() == QEvent::Enter)
-        {
-            ui->pBtn_Close->setProperty("Hover", true);
-            ui->pBtn_Close->style()->unpolish(ui->pBtn_Close);
-            ui->pBtn_Close->style()->polish(ui->pBtn_Close);
-            return true;
-        }else if(event->type() == QEvent::Leave)
-        {
-            ui->pBtn_Close->setProperty("Hover", false);
-            ui->pBtn_Close->style()->unpolish(ui->pBtn_Close);
-            ui->pBtn_Close->style()->polish(ui->pBtn_Close);
-            return true;
-        }
-    }
-    return QDialog::eventFilter(watched, event);
-}
-
-/* 绘画事件 */
-// void AddNormalItem::paintEvent(QPaintEvent *event)
-// {
-//     QPainter painter(this);
-//     painter.setRenderHint(QPainter::Antialiasing);
-
-// }
-
-/* 鼠标点击事件 */
-void AddNormalItem::mousePressEvent(QMouseEvent *event)
-{
-    m_lastPos = event->globalPos();
-    event->accept();
-}
-
-/* 鼠标移动事件 */
-void AddNormalItem::mouseMoveEvent(QMouseEvent *event)
-{
-    // QRect rect = this->geometry();
-    auto point = ui->widget_Top->mapToGlobal(QPoint(0, 0));
-    QRect rect(point, ui->widget_Top->size());
-    // LH_WRITE_LOG(QString("rect: %1, %2, %3, %4").arg(rect.left()).arg(rect.top()).arg(rect.right()).arg(rect.bottom()));
-    // LH_WRITE_LOG(QString("lastPos: %1, %2").arg(m_lastPos.x()).arg(m_lastPos.y()));
-    // rect.setBottom(rect.top()+50);
-    if(!rect.contains(m_lastPos))
-    {
-        event->accept();
-        return;
-    }
-
-    int dx = event->globalX() - m_lastPos.x();
-    int dy = event->globalY() - m_lastPos.y();
-    // move(x()+dx, y()+dy);
-    ui->widget_background->move(ui->widget_background->x() + dx, ui->widget_background->y() + dy);
-    // m_shadow->move(ui->widget_background->pos());
-    m_lastPos = event->globalPos();
-    event->accept();
-}
-
-/* 鼠标释放事件 */
-void AddNormalItem::mouseReleaseEvent(QMouseEvent *event)
-{
-    event->accept();
-}
-
-
-

+ 0 - 95
TransmitterSwitch/AddItem/addnormalitem.h

@@ -1,95 +0,0 @@
-#ifndef ADDNORMALITEM_H
-#define ADDNORMALITEM_H
-
-#include <QDialog>
-#include <QTime>
-#include <QComboBox>
-
-class TimeWidget;
-class DeviceInfo;
-class OneShadow;
-
-namespace Ui {
-class AddNormalItem;
-}
-
-class AddNormalItem : public QDialog
-{
-    Q_OBJECT
-
-public:
-    explicit AddNormalItem(QWidget *parent = nullptr);
-    ~AddNormalItem();
-
-    /* 设置父指针,时间选择器需要使用 */
-    void setParentPointer(QWidget* p);
-    /* 添加可选设备 */
-    void setDevice(QMap<QString, DeviceInfo>& mapDev);
-    /* 设置周几 */
-    void setWeekDay(int week);
-
-    /* 获取设别名称 */
-    QString getDevName() const { return m_devName; }
-    /* 获取动作 */
-    QString getAction() const { return m_action; }
-    int getActionID() const { return m_actionID; }
-    /* 获取时间 */
-    QTime getTime() const { return m_time; }
-    /* 判断是否添加设备 */
-    bool isAddDev() const { return m_isAddDev; }
-
-    /* 设置QSS */
-    void setQSS(const QString& qssPath);
-
-signals:
-    /* 添加正常日期的项 */
-    void signal_addNormalItem(QString dev,QString action,QTime time);
-
-private slots:
-    /* 进行查重和关闭页面 */
-    void do_ok();
-    /* 选择了设备,设置其对应的动作 */
-    void do_selectDev();
-    /* 选择了动作 */
-    void do_selectAction();
-    /* 点击了时间选择按钮,打开时间选择器 */
-    void do_selectTime();
-
-private:
-    /* 设置选择框报警 */
-    void setComboBoxWarning(QComboBox* bo,bool flag);
-    /* 设置时间报警 */
-    void setTimeEditWarning(bool flag);
-    void setAction(const QString& devName);
-
-protected:
-    /* 事件过滤器 */
-    bool eventFilter(QObject *watched, QEvent *event) override;
-    /* 绘画事件 */
-    // void paintEvent(QPaintEvent *event) override;
-    /* 鼠标点击事件 */
-    void mousePressEvent(QMouseEvent *event) override;
-    /* 鼠标移动事件 */
-    void mouseMoveEvent(QMouseEvent *event) override;
-    /* 鼠标释放事件 */
-    void mouseReleaseEvent(QMouseEvent *event) override;
-    
-private:
-    Ui::AddNormalItem *ui;
-
-    QWidget* m_parent = nullptr;                    /* 父类指针 */
-    QRect m_rectScreen;                             /* 屏幕大小 */
-    int m_week = -1;                                /* 周几 */
-    bool m_isAddDev = false;                        /* 是否添加设备 */
-
-    QString m_devName;                              /* 选择的设备 */
-    QString m_action;                               /* 选择的动作 */
-    int m_actionID = 0;                             /* 动作ID */
-    QTime m_time;                                   /* 执行的时间 */
-
-    TimeWidget* m_timeWidget = nullptr;             /* 时间选择器 */
-
-    QPoint m_lastPos;                               /* 鼠标点击的位置 */
-};
-
-#endif // ADDNORMALITEM_H

+ 0 - 312
TransmitterSwitch/AddItem/addnormalitem.ui

@@ -1,312 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>AddNormalItem</class>
- <widget class="QDialog" name="AddNormalItem">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>1920</width>
-    <height>1080</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>Dialog</string>
-  </property>
-  <layout class="QVBoxLayout" name="verticalLayout">
-   <property name="spacing">
-    <number>0</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="QWidget" name="widget" native="true">
-     <layout class="QGridLayout" name="gridLayout">
-      <item row="0" column="0">
-       <widget class="QWidget" name="widget_background" native="true">
-        <property name="sizePolicy">
-         <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
-          <horstretch>0</horstretch>
-          <verstretch>0</verstretch>
-         </sizepolicy>
-        </property>
-        <property name="minimumSize">
-         <size>
-          <width>416</width>
-          <height>309</height>
-         </size>
-        </property>
-        <property name="styleSheet">
-         <string notr="true"/>
-        </property>
-        <widget class="QLabel" name="label_NC2_x">
-         <property name="geometry">
-          <rect>
-           <x>32</x>
-           <y>154</y>
-           <width>7</width>
-           <height>14</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; color:#ff0000;&quot;&gt;*&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_NC3">
-         <property name="geometry">
-          <rect>
-           <x>40</x>
-           <y>154</y>
-           <width>70</width>
-           <height>14</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>时间选择:</string>
-         </property>
-        </widget>
-        <widget class="QPushButton" name="pBtn_cancel">
-         <property name="geometry">
-          <rect>
-           <x>248</x>
-           <y>265</y>
-           <width>60</width>
-           <height>32</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>取消</string>
-         </property>
-        </widget>
-        <widget class="QPushButton" name="pBtn_ok">
-         <property name="geometry">
-          <rect>
-           <x>324</x>
-           <y>265</y>
-           <width>60</width>
-           <height>32</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>确定</string>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_iconTime">
-         <property name="geometry">
-          <rect>
-           <x>359</x>
-           <y>153</y>
-           <width>16</width>
-           <height>16</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string/>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_timeWarn">
-         <property name="geometry">
-          <rect>
-           <x>110</x>
-           <y>180</y>
-           <width>281</width>
-           <height>18</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>TextLabel</string>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_NC8_x">
-         <property name="geometry">
-          <rect>
-           <x>32</x>
-           <y>98</y>
-           <width>7</width>
-           <height>14</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; color:#ff0000;&quot;&gt;*&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_NC9">
-         <property name="geometry">
-          <rect>
-           <x>40</x>
-           <y>98</y>
-           <width>70</width>
-           <height>14</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>设备选择:</string>
-         </property>
-        </widget>
-        <widget class="CustomComboBox" name="comBox_devSelect">
-         <property name="geometry">
-          <rect>
-           <x>110</x>
-           <y>89</y>
-           <width>274</width>
-           <height>32</height>
-          </rect>
-         </property>
-         <property name="currentText">
-          <string/>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_NC8_x_2">
-         <property name="geometry">
-          <rect>
-           <x>32</x>
-           <y>210</y>
-           <width>7</width>
-           <height>14</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; color:#ff0000;&quot;&gt;*&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
-         </property>
-        </widget>
-        <widget class="CustomComboBox" name="comBox_actionSelect">
-         <property name="geometry">
-          <rect>
-           <x>110</x>
-           <y>201</y>
-           <width>274</width>
-           <height>32</height>
-          </rect>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_NC9_2">
-         <property name="geometry">
-          <rect>
-           <x>40</x>
-           <y>210</y>
-           <width>70</width>
-           <height>14</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>动作选择:</string>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_devWarn">
-         <property name="geometry">
-          <rect>
-           <x>110</x>
-           <y>126</y>
-           <width>281</width>
-           <height>18</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>TextLabel</string>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_actionWarn">
-         <property name="geometry">
-          <rect>
-           <x>110</x>
-           <y>238</y>
-           <width>281</width>
-           <height>18</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>TextLabel</string>
-         </property>
-        </widget>
-        <widget class="QPushButton" name="pBtn_selectTime">
-         <property name="geometry">
-          <rect>
-           <x>110</x>
-           <y>145</y>
-           <width>274</width>
-           <height>32</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>00:00:00</string>
-         </property>
-        </widget>
-        <widget class="QWidget" name="widget_Top" native="true">
-         <property name="geometry">
-          <rect>
-           <x>0</x>
-           <y>0</y>
-           <width>416</width>
-           <height>56</height>
-          </rect>
-         </property>
-         <widget class="QLabel" name="label_title">
-          <property name="geometry">
-           <rect>
-            <x>32</x>
-            <y>18</y>
-            <width>80</width>
-            <height>18</height>
-           </rect>
-          </property>
-          <property name="text">
-           <string>添加计划</string>
-          </property>
-         </widget>
-         <widget class="QPushButton" name="pBtn_Close">
-          <property name="geometry">
-           <rect>
-            <x>368</x>
-            <y>12</y>
-            <width>32</width>
-            <height>32</height>
-           </rect>
-          </property>
-          <property name="text">
-           <string/>
-          </property>
-         </widget>
-        </widget>
-        <zorder>label_iconTime</zorder>
-        <zorder>label_NC2_x</zorder>
-        <zorder>label_NC3</zorder>
-        <zorder>pBtn_cancel</zorder>
-        <zorder>pBtn_ok</zorder>
-        <zorder>label_timeWarn</zorder>
-        <zorder>label_NC8_x</zorder>
-        <zorder>label_NC9</zorder>
-        <zorder>comBox_devSelect</zorder>
-        <zorder>label_NC8_x_2</zorder>
-        <zorder>comBox_actionSelect</zorder>
-        <zorder>label_NC9_2</zorder>
-        <zorder>label_devWarn</zorder>
-        <zorder>label_actionWarn</zorder>
-        <zorder>pBtn_selectTime</zorder>
-        <zorder>widget_Top</zorder>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <customwidgets>
-  <customwidget>
-   <class>CustomComboBox</class>
-   <extends>QComboBox</extends>
-   <header location="global">customcombobox.h</header>
-  </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>

+ 0 - 383
TransmitterSwitch/AddItem/addspecialitem.cpp

@@ -1,383 +0,0 @@
-#include "addspecialitem.h"
-#include "ui_addspecialitem.h"
-
-#include <memory>
-#include <QDebug>
-#include <QListView>
-#include <QFile>
-#include <QApplication>
-#include <QDesktopWidget>
-#include <QPainter>
-#include <QMouseEvent>
-
-#include "common/combobox/customcombobox.h"
-#include "LHQLogAPI.h"
-#include "TransmitterSwitchInfo.h"
-#include "common/SelectTime/timewidget.h"
-#include "common/date/calendardtedit.h"
-#include "ItemData.h"
-#include "OneShadowEffect.h"
-
-// #include "lhstylemanager.h"
-
-AddSpecialItem::AddSpecialItem(QWidget *parent) :
-    QDialog(parent),
-    ui(new Ui::AddSpecialItem)
-{
-    ui->setupUi(this);
-
-    /* 设置无边框 */
-    setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint);
-    /* 设置底层样式表,让最底层的透明 */
-    this->setAttribute(Qt::WA_TranslucentBackground);
-
-    /* 加载QSS */
-    // QFile file(":/QSS/QSS/AddSpecialItem_Light.qss");
-    // if(file.open(QIODevice::ReadOnly))
-    // {
-    //     QString stylesheet = file.readAll();
-    //     this->setStyleSheet(stylesheet);
-    //     file.close();
-    // } else
-    // {
-    //     LH_WRITE_ERROR(QString("打开文件失败:%1").arg(file.fileName()));
-    // }
-    /* 创建弹窗阴影 */
-    OneShadowEffect *pShadowEffect = new OneShadowEffect(this);
-    ui->widget_background->setGraphicsEffect(pShadowEffect);
-
-    ui->label_timeWarn->hide();
-    ui->label_devWarn->hide();
-    ui->label_actionWarn->hide();
-
-    /* 获取屏幕大小 */
-    m_rectScreen = QApplication::desktop()->availableGeometry();
-    this->resize(m_rectScreen.width(), m_rectScreen.height());
-    /* 设置默认时间 */
-    m_time.setHMS(0, 0, 0);
-    m_date = QDate::currentDate();
-    ui->dateEdit->setDate(m_date);
-    ui->dateEdit->setDisplayFormat("yyyy-MM-dd");
-
-    /* 连接信号和槽 */
-    connect(ui->pBtn_Close, &QPushButton::clicked, this, &QDialog::close);
-    connect(ui->pBtn_cancel, &QPushButton::clicked, this, &QDialog::close);
-    connect(ui->pBtn_ok, &QPushButton::clicked, this, &AddSpecialItem::do_ok);
-    connect(ui->pBtn_cancel, &QPushButton::clicked, this, &AddSpecialItem::close);
-
-    /* 设备选择 */
-    connect(ui->comBox_devSelect, QOverload<const QString&>::of(&QComboBox::currentTextChanged), this, &AddSpecialItem::do_selectDev);
-    /* 动作选择 */
-    connect(ui->comBox_actionSelect,QOverload<const QString&>::of(&QComboBox::currentTextChanged),this, &AddSpecialItem::do_selectAction);
-    /* 打开时间选择器 */
-    connect(ui->pBtn_selectTime, &QPushButton::clicked, this, &AddSpecialItem::do_selectTime);
-    connect(ui->pBtn_iconTime, &QPushButton::clicked, this, &AddSpecialItem::do_selectTime);
-
-    connect(ui->dateEdit, &CalendarDTEdit::dateChanged, this, &AddSpecialItem::do_selectDate);
-    
-    /* 设置事件过滤器 */
-    ui->comBox_actionSelect->installEventFilter(this);
-    ui->comBox_devSelect->installEventFilter(this);
-    ui->pBtn_Close->installEventFilter(this);
-    ui->dateEdit->installEventFilter(this);
-}
-
-AddSpecialItem::~AddSpecialItem()
-{
-    delete ui;
-}
-
-
-/* 设置父指针,时间选择器需要使用 */
-void AddSpecialItem::setParentPointer(QWidget* p)
-{
-    m_parent = p;
-    // m_parent->installEventFilter(this);
-}
-
-/* 添加可选设备 */
-void AddSpecialItem::setDevice(QMap<QString, DeviceInfo>& mapDev)
-{
-    ui->comBox_devSelect->clear();
-    for(const auto& it : mapDev)
-    {
-        ui->comBox_devSelect->addItem(it.devName);
-    }
-    /* 设置显示第一个设备,并设置可选的动作 */
-    ui->comBox_devSelect->setCurrentIndex(0);
-    m_devName = ui->comBox_devSelect->currentText();
-    setAction(m_devName);
-}
-
-/* 设置周几 */
-void AddSpecialItem::setWeekDay(int week)
-{
-    if(week != 7)
-    {
-        return;
-    }
-    m_week = week;
-}
-
-void AddSpecialItem::setQSS(QString qssPath)
-{
-    QString qssFile = qssPath + "/addspecialitem.qss";
-    QFile file(qssFile);
-    if(file.open(QIODevice::ReadOnly))
-    {
-        QString stylesheet = file.readAll();
-        this->setStyleSheet(stylesheet);
-        file.close();
-    } else
-    {
-        LH_WRITE_ERROR(QString("打开文件失败:%1").arg(file.fileName()));
-    }
-
-    /* 设置comboBox阴影 */
-    ui->comBox_devSelect->setViewShadowEffect();
-    ui->comBox_actionSelect->setViewShadowEffect();
-}
-
-
-/* 进行查重和关闭页面 */
-void AddSpecialItem::do_ok()
-{
-    ui->label_timeWarn->hide();
-    ui->label_devWarn->hide();
-    ui->label_actionWarn->hide();
-    setComboBoxWarning(ui->comBox_devSelect,false);
-    setComboBoxWarning(ui->comBox_actionSelect, false);
-    setTimeEditWarning(false);
-
-    /* 检查设备是否为空 */
-    if(ui->comBox_devSelect->currentText().isEmpty())
-    {
-        ui->label_devWarn->setText("不能为空!");
-        ui->label_devWarn->show();
-        setComboBoxWarning(ui->comBox_devSelect, true);
-        return;
-    }
-    /* 检查动作是否为空 */
-    if(ui->comBox_actionSelect->currentText().isEmpty())
-    {
-        ui->label_actionWarn->setText("不能为空!");
-        ui->label_actionWarn->show();
-        setComboBoxWarning(ui->comBox_actionSelect, true);
-    }
-
-    /* 赋值日期 */
-    m_date = ui->dateEdit->date();
-    
-    /* 检查时间是否为空 */
-    if(m_time.isNull())
-    {
-        ui->label_timeWarn->setText("不能为空!");
-        ui->label_timeWarn->show();
-        setTimeEditWarning(true);
-        return;
-    }
-    /* 进行设备查重 */
-    bool ret = IData.judgeDateTimeRepetitionWithAdd(m_week, m_devName, m_date, m_time);
-    if(ret)
-    {
-        ui->label_timeWarn->setText("一个时间点,单个设备仅能执行一个操作!");
-        ui->label_timeWarn->show();
-        setTimeEditWarning(true);
-        return;
-    }
-    m_isAddDev = true;
-    /* 添加一项计划 */
-    LH_WRITE_LOG_DEBUG(QString("添加一项计划: 设备:%1, 动作:%2, 日期:%3, 时间:%4").arg(m_devName).arg(m_action).arg(m_date.toString("yyyy-MM-dd")).arg(m_time.toString("hh:mm:ss")));
-
-    /* 发送信号 */
-    emit signal_AddSpecialItem(m_devName, m_action, m_date, m_time);
-    close();
-}
-
-
-/* 选择了设备,设置其对应的动作 */
-void AddSpecialItem::do_selectDev()
-{
-    m_devName = ui->comBox_devSelect->currentText();
-    setAction(m_devName);
-}
-
-/* 选择了动作 */
-void AddSpecialItem::do_selectAction()
-{
-    m_action = ui->comBox_actionSelect->currentText();
-    m_actionID = ui->comBox_actionSelect->currentData().toInt();
-}
-
-/* 点击了时间选择按钮,打开时间选择器 */
-void AddSpecialItem::do_selectTime()
-{
-    // LH_WRITE_LOG_DEBUG("选择时间");
-    std::shared_ptr<TimeWidget> tw = std::make_shared<TimeWidget>(this, TimeWidget::ShowType::Dialog);
-    /* 设置图标 */
-    tw->setIcon(":/ICON/ICON/Time.png");
-    tw->setIconShow(true);
-    tw->setIconSize(16, 16);
-    /* 重新设置大小 */
-    tw->setEditLine(ui->pBtn_selectTime->width(), ui->pBtn_selectTime->height());
-    /* 设置选择框大小 */
-    tw->setTimeAreaWidth(140);
-    /* 移动位置,覆盖显示时间的按钮,获取的坐标是相对于Dialog的位置 */
-    auto pos = ui->pBtn_selectTime->mapTo(this, QPoint(0, 0));
-    tw->move(pos);
-    /* 设置默认的时间 */
-    tw->setTime(m_time);
-
-    tw->execShow();
-    m_time = tw->getTime();
-    // LH_WRITE_LOG_DEBUG(QString("选择时间:%1").arg(m_time.toString("hh:mm:ss")));
-    ui->pBtn_selectTime->setText(m_time.toString("hh:mm:ss"));
-}
-
-/* 修改了日期 */
-void AddSpecialItem::do_selectDate(const QDate &date)
-{
-    // LH_WRITE_LOG_DEBUG(QString("选择日期:%1").arg(date.toString("yyyy-MM-dd")));
-}
-
-/* 设置选择框报警 */
-void AddSpecialItem::setComboBoxWarning(QComboBox* bo, bool flag)
-{
-    if(flag)
-    {
-        bo->setProperty("Warn", true);
-    }
-    else
-    {
-        bo->setProperty("Warn", false);
-    }
-
-    bo->style()->unpolish(bo);
-    bo->style()->polish(bo);
-    
-}
-
-/* 设置时间报警 */
-void AddSpecialItem::setTimeEditWarning(bool flag)
-{
-    if(flag)
-    {
-        ui->pBtn_selectTime->setProperty("Warn", true);
-    }
-    else
-    {
-        ui->pBtn_selectTime->setProperty("Warn", false);
-    }
-
-    ui->pBtn_selectTime->style()->unpolish(ui->pBtn_selectTime);
-    ui->pBtn_selectTime->style()->polish(ui->pBtn_selectTime);
-}
-
-/* 设置动作 */
-void AddSpecialItem::setAction(const QString& devName)
-{
-    QMap<int, QString> devAction;
-    if(!DeviceContainer.getDevAction(devName, devAction))
-    {
-        return;
-    }
-    ui->comBox_actionSelect->clear();
-    for(auto it = devAction.begin();it != devAction.end();it++)
-    {
-        ui->comBox_actionSelect->addItem(it.value(), it.key());
-    }
-}
-
-/* 事件过滤器 */
-bool AddSpecialItem::eventFilter(QObject *watched, QEvent *event)
-{
-    if(watched == ui->comBox_devSelect)
-    {
-        if(event->type() == QEvent::Wheel)
-        {
-            return true;
-        }
-    }
-    else if(watched == ui->comBox_actionSelect)
-    {
-        if(event->type() == QEvent::Wheel)
-        {
-            return true;
-        }
-    }
-    else if(watched == ui->dateEdit)
-    {
-        if(event->type() == QEvent::Wheel)
-        {
-            return true;
-        }
-    }
-    else if(watched == ui->pBtn_Close)
-    {
-        if(event->type() == QEvent::Enter)
-        {
-            ui->pBtn_Close->setProperty("Hover", true);
-            ui->pBtn_Close->style()->unpolish(ui->pBtn_Close);
-            ui->pBtn_Close->style()->polish(ui->pBtn_Close);
-            return true;
-        }else if(event->type() == QEvent::Leave)
-        {
-            ui->pBtn_Close->setProperty("Hover", false);
-            ui->pBtn_Close->style()->unpolish(ui->pBtn_Close);
-            ui->pBtn_Close->style()->polish(ui->pBtn_Close);
-            return true;
-        }
-    }
-    return QDialog::eventFilter(watched, event);
-}
-
-/* 绘画事件 */
-// void AddSpecialItem::paintEvent(QPaintEvent *event)
-// {
-//     QPainter painter(this);
-//     painter.setRenderHint(QPainter::Antialiasing);
-//     /* 移动到方框下面 */
-//     QPoint pos = ui->widget_background->pos();
-//     pos.setX(pos.x() - 16);
-//     pos.setY(pos.y() - 16);
-//     painter.drawImage(pos, m_shadow->image());
-// }
-
-/* 鼠标点击事件 */
-void AddSpecialItem::mousePressEvent(QMouseEvent *event)
-{
-    m_lastPos = event->globalPos();
-    event->accept();
-}
-
-/* 鼠标移动事件 */
-void AddSpecialItem::mouseMoveEvent(QMouseEvent *event)
-{
-    // QRect rect = this->geometry();
-    auto point = ui->widget_Top->mapToGlobal(QPoint(0, 0));
-    QRect rect(point, ui->widget_Top->size());
-    // LH_WRITE_LOG(QString("rect: %1, %2, %3, %4").arg(rect.left()).arg(rect.top()).arg(rect.right()).arg(rect.bottom()));
-    // LH_WRITE_LOG(QString("lastPos: %1, %2").arg(m_lastPos.x()).arg(m_lastPos.y()));
-    // rect.setBottom(rect.top()+50);
-    if(!rect.contains(m_lastPos))
-    {
-        event->accept();
-        return;
-    }
-
-    int dx = event->globalX() - m_lastPos.x();
-    int dy = event->globalY() - m_lastPos.y();
-    // move(x()+dx, y()+dy);
-    ui->widget_background->move(ui->widget_background->x() + dx, ui->widget_background->y() + dy);
-    // m_shadow->move(ui->widget_background->pos());
-    m_lastPos = event->globalPos();
-    event->accept();
-}
-
-/* 鼠标释放事件 */
-void AddSpecialItem::mouseReleaseEvent(QMouseEvent *event)
-{
-    event->accept();
-}
-
-

+ 0 - 108
TransmitterSwitch/AddItem/addspecialitem.h

@@ -1,108 +0,0 @@
-#ifndef ADDSPECIALITEM_H
-#define ADDSPECIALITEM_H
-
-/**
- * 注意事:
- *  1、这里的日期用的提升方式,提升为CalendarTEdit,日期图标
- *     直接设置的箭头图标,如果想显示出来,需要设置setCalendarPopup为true
-*/
-
-#include <QDialog>
-#include <QTime>
-#include <QDate>
-#include <QComboBox>
-
-class TimeWidget;
-class DeviceInfo;
-
-
-namespace Ui {
-class AddSpecialItem;
-}
-
-class AddSpecialItem : public QDialog
-{
-    Q_OBJECT
-
-public:
-    explicit AddSpecialItem(QWidget *parent = nullptr);
-    ~AddSpecialItem();
-
-    /* 设置父指针,时间选择器需要使用 */
-    void setParentPointer(QWidget* p);
-    /* 添加可选设备 */
-    void setDevice(QMap<QString, DeviceInfo>& mapDev);
-    /* 设置周几 */
-    void setWeekDay(int week);
-
-    /* 获取设别名称 */
-    QString getDevName() const { return m_devName; }
-    /* 获取动作 */
-    QString getAction() const { return m_action; }
-    int getActionID() const { return m_actionID; }
-    /* 获取时间 */
-    QTime getTime() const { return m_time; }
-    /* 获取日期 */
-    QDate getDate() const { return m_date; }
-    /* 判断是否添加设备 */
-    bool isAddDev() const { return m_isAddDev; }
-
-    /* 设置QSS */
-    void setQSS(QString qssPath);
-
-signals:
-    /* 添加特殊日期项 */
-    void signal_AddSpecialItem(QString dev, QString action, QDate date, QTime time);
-
-private slots:
-    /* 进行查重和关闭页面 */
-    void do_ok();
-    /* 选择了设备,设置其对应的动作 */
-    void do_selectDev();
-    /* 选择了动作 */
-    void do_selectAction();
-    /* 点击了时间选择按钮,打开时间选择器 */
-    void do_selectTime();
-    /* 修改了日期 */
-    void do_selectDate(const QDate &date);
-
-private:
-    /* 设置选择框报警 */
-    void setComboBoxWarning(QComboBox* bo,bool flag);
-    /* 设置时间报警 */
-    void setTimeEditWarning(bool flag);
-    void setAction(const QString& devName);
-
-protected:
-    /* 事件过滤器 */
-    bool eventFilter(QObject *watched, QEvent *event) override;
-    /* 绘画事件 */
-    // void paintEvent(QPaintEvent *event) override;
-    /* 鼠标点击事件 */
-    void mousePressEvent(QMouseEvent *event) override;
-    /* 鼠标移动事件 */
-    void mouseMoveEvent(QMouseEvent *event) override;
-    /* 鼠标释放事件 */
-    void mouseReleaseEvent(QMouseEvent *event) override;
-
-private:
-    Ui::AddSpecialItem *ui;
-    
-    QWidget* m_parent = nullptr;                    /* 父类指针 */
-    QRect m_rectScreen;                             /* 屏幕大小 */
-    int m_week = -1;                                /* 周几 */
-    bool m_isAddDev = false;                        /* 是否添加设备 */
-
-    QString m_devName;                              /* 选择的设备 */
-    QString m_action;                               /* 选择的动作 */
-    int m_actionID = 0;                             /* 动作ID */
-    QTime m_time;                                   /* 执行的时间 */
-    QDate m_date;                                   /* 执行的日期 */
-
-    TimeWidget* m_timeWidget = nullptr;             /* 时间选择器 */
-    // OneShadow* m_shadow = nullptr;                  /* 阴影 */
-
-    QPoint m_lastPos;                               /* 鼠标点击的位置 */
-};
-
-#endif // ADDSPECIALITEM_H

+ 0 - 355
TransmitterSwitch/AddItem/addspecialitem.ui

@@ -1,355 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>AddSpecialItem</class>
- <widget class="QDialog" name="AddSpecialItem">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>1150</width>
-    <height>771</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>Dialog</string>
-  </property>
-  <layout class="QVBoxLayout" name="verticalLayout">
-   <property name="spacing">
-    <number>0</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="QWidget" name="widget" native="true">
-     <layout class="QGridLayout" name="gridLayout">
-      <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>
-      <property name="spacing">
-       <number>0</number>
-      </property>
-      <item row="0" column="0">
-       <widget class="QWidget" name="widget_background" native="true">
-        <property name="minimumSize">
-         <size>
-          <width>416</width>
-          <height>385</height>
-         </size>
-        </property>
-        <property name="maximumSize">
-         <size>
-          <width>416</width>
-          <height>385</height>
-         </size>
-        </property>
-        <property name="styleSheet">
-         <string notr="true"/>
-        </property>
-        <widget class="QLabel" name="label_NC2_x">
-         <property name="geometry">
-          <rect>
-           <x>32</x>
-           <y>210</y>
-           <width>7</width>
-           <height>14</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; color:#ff0000;&quot;&gt;*&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_NC3">
-         <property name="geometry">
-          <rect>
-           <x>40</x>
-           <y>210</y>
-           <width>70</width>
-           <height>14</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>时间选择:</string>
-         </property>
-        </widget>
-        <widget class="QPushButton" name="pBtn_cancel">
-         <property name="geometry">
-          <rect>
-           <x>248</x>
-           <y>321</y>
-           <width>60</width>
-           <height>32</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>取消</string>
-         </property>
-        </widget>
-        <widget class="QPushButton" name="pBtn_ok">
-         <property name="geometry">
-          <rect>
-           <x>324</x>
-           <y>321</y>
-           <width>60</width>
-           <height>32</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>确定</string>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_timeWarn">
-         <property name="geometry">
-          <rect>
-           <x>110</x>
-           <y>236</y>
-           <width>250</width>
-           <height>18</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>TextLabel</string>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_NC8_x">
-         <property name="geometry">
-          <rect>
-           <x>32</x>
-           <y>98</y>
-           <width>7</width>
-           <height>14</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; color:#ff0000;&quot;&gt;*&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_NC9">
-         <property name="geometry">
-          <rect>
-           <x>40</x>
-           <y>98</y>
-           <width>70</width>
-           <height>14</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>设备选择:</string>
-         </property>
-        </widget>
-        <widget class="CustomComboBox" name="comBox_devSelect">
-         <property name="geometry">
-          <rect>
-           <x>110</x>
-           <y>89</y>
-           <width>274</width>
-           <height>32</height>
-          </rect>
-         </property>
-         <property name="currentText">
-          <string/>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_NC12_x">
-         <property name="geometry">
-          <rect>
-           <x>32</x>
-           <y>266</y>
-           <width>7</width>
-           <height>14</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; color:#ff0000;&quot;&gt;*&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
-         </property>
-        </widget>
-        <widget class="CustomComboBox" name="comBox_actionSelect">
-         <property name="geometry">
-          <rect>
-           <x>110</x>
-           <y>257</y>
-           <width>274</width>
-           <height>32</height>
-          </rect>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_NC9_2">
-         <property name="geometry">
-          <rect>
-           <x>40</x>
-           <y>266</y>
-           <width>70</width>
-           <height>14</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>动作选择:</string>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_NC10">
-         <property name="geometry">
-          <rect>
-           <x>40</x>
-           <y>154</y>
-           <width>70</width>
-           <height>14</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>日期选择:</string>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_NC2_x_2">
-         <property name="geometry">
-          <rect>
-           <x>32</x>
-           <y>154</y>
-           <width>7</width>
-           <height>14</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; color:#ff0000;&quot;&gt;*&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
-         </property>
-        </widget>
-        <widget class="CalendarDTEdit" name="dateEdit">
-         <property name="geometry">
-          <rect>
-           <x>110</x>
-           <y>145</y>
-           <width>274</width>
-           <height>32</height>
-          </rect>
-         </property>
-         <property name="calendarPopup">
-          <bool>true</bool>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_devWarn">
-         <property name="geometry">
-          <rect>
-           <x>110</x>
-           <y>126</y>
-           <width>250</width>
-           <height>18</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>TextLabel</string>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_actionWarn">
-         <property name="geometry">
-          <rect>
-           <x>110</x>
-           <y>296</y>
-           <width>250</width>
-           <height>18</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>TextLabel</string>
-         </property>
-        </widget>
-        <widget class="QPushButton" name="pBtn_selectTime">
-         <property name="geometry">
-          <rect>
-           <x>110</x>
-           <y>201</y>
-           <width>274</width>
-           <height>32</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>00:00:00</string>
-         </property>
-        </widget>
-        <widget class="QPushButton" name="pBtn_iconTime">
-         <property name="geometry">
-          <rect>
-           <x>359</x>
-           <y>209</y>
-           <width>16</width>
-           <height>16</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string/>
-         </property>
-        </widget>
-        <widget class="QWidget" name="widget_Top" native="true">
-         <property name="geometry">
-          <rect>
-           <x>0</x>
-           <y>0</y>
-           <width>416</width>
-           <height>56</height>
-          </rect>
-         </property>
-         <widget class="QLabel" name="label_title">
-          <property name="geometry">
-           <rect>
-            <x>32</x>
-            <y>18</y>
-            <width>80</width>
-            <height>18</height>
-           </rect>
-          </property>
-          <property name="text">
-           <string>添加计划</string>
-          </property>
-         </widget>
-         <widget class="QPushButton" name="pBtn_Close">
-          <property name="geometry">
-           <rect>
-            <x>368</x>
-            <y>12</y>
-            <width>32</width>
-            <height>32</height>
-           </rect>
-          </property>
-          <property name="text">
-           <string/>
-          </property>
-         </widget>
-        </widget>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <customwidgets>
-  <customwidget>
-   <class>CustomComboBox</class>
-   <extends>QComboBox</extends>
-   <header location="global">customcombobox.h</header>
-  </customwidget>
-  <customwidget>
-   <class>CalendarDTEdit</class>
-   <extends>QDateEdit</extends>
-   <header location="global">calendardtedit.h</header>
-  </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>

+ 6 - 4
TransmitterSwitch/CMakeLists.txt

@@ -17,10 +17,11 @@ file(GLOB LOCAL_SRC
     ${CMAKE_CURRENT_SOURCE_DIR}/Resource/*.qrc
     ${CMAKE_CURRENT_SOURCE_DIR}/WidgetItems/*.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/UserData/*.cpp
-    ${CMAKE_CURRENT_SOURCE_DIR}/AddItem/*.cpp
-    ${CMAKE_CURRENT_SOURCE_DIR}/ItemData/*.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/ExecPlanData/*.cpp
+    # ${CMAKE_CURRENT_SOURCE_DIR}/ItemData/*.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/Template/*.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/warnning/*.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/UIStyle/*.cpp
 
     ${CMAKE_CURRENT_SOURCE_DIR}/common/Thread/*.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/common/Shadow/*.cpp
@@ -61,10 +62,11 @@ target_include_directories(${lib_name} PRIVATE
     ${CMAKE_CURRENT_SOURCE_DIR}/WebAPI
     ${CMAKE_CURRENT_SOURCE_DIR}/WidgetItems
     ${CMAKE_CURRENT_SOURCE_DIR}/UserData
-    ${CMAKE_CURRENT_SOURCE_DIR}/AddItem
-    ${CMAKE_CURRENT_SOURCE_DIR}/ItemData
+    ${CMAKE_CURRENT_SOURCE_DIR}/ExecPlanData
+    # ${CMAKE_CURRENT_SOURCE_DIR}/ItemData
     ${CMAKE_CURRENT_SOURCE_DIR}/Template
     ${CMAKE_CURRENT_SOURCE_DIR}/warnning
+    ${CMAKE_CURRENT_SOURCE_DIR}/UIStyle
 
     ${CMAKE_CURRENT_SOURCE_DIR}/common
     ${CMAKE_CURRENT_SOURCE_DIR}/common/Thread

+ 46 - 0
TransmitterSwitch/ExecPlanData/PlanData.cpp

@@ -0,0 +1,46 @@
+#include "PlanData.h"
+
+
+PlanData::PlanData()
+{
+    /* 初始化计划卡片 */
+    m_mapPlanCard.clear();
+}
+
+/* 新增一个卡片 */
+PlanCard* PlanData::createOneCard(const ChannelInfo& chnInfo)
+{
+    /* 先查找有没有这个频率的卡片 */
+    auto pCard = findPlanCard(chnInfo.ChannelID);
+    if(pCard != nullptr)
+    {
+        /* 已经存在了,直接返回 */
+        return pCard;
+    }
+    pCard = new PlanCard();
+    pCard->setChannelInfo(chnInfo);
+
+    m_mapPlanCard.insert(chnInfo.ChannelID, pCard);
+    return pCard;
+}
+
+/* 删除一个卡片 */
+void PlanData::deleteOneCard(int channelID)
+{
+    if(m_mapPlanCard.contains(channelID))
+    {
+        auto pCard = m_mapPlanCard[channelID];
+        delete pCard;
+        m_mapPlanCard.remove(channelID);
+    }
+}
+
+/* 查找卡片 */
+PlanCard* PlanData::findPlanCard(int channelID)
+{
+    if(m_mapPlanCard.contains(channelID))
+    {
+        return m_mapPlanCard[channelID];
+    }
+    return nullptr;
+}

+ 36 - 0
TransmitterSwitch/ExecPlanData/PlanData.h

@@ -0,0 +1,36 @@
+#ifndef PLANDATA_H
+#define PLANDATA_H
+
+#include "plancard.h"
+
+
+#define PData PlanData::getInstance()
+
+class PlanData
+{
+    PlanData();
+    PlanData(const PlanData& data) = delete;
+    PlanData& operator=(const PlanData& data) = delete;
+public:
+    ~PlanData() {}
+    static PlanData& getInstance()
+    {
+        static PlanData instance;
+        return instance;
+    }
+
+    /* 新增一个卡片 */
+    PlanCard* createOneCard(const ChannelInfo& chnInfo);
+    /* 删除一个卡片 */
+    void deleteOneCard(int channelID);
+
+    /* 查找卡片 */
+    PlanCard* findPlanCard(int channelID);
+    
+
+private:
+    QMap<int, PlanCard*> m_mapPlanCard;    /* 计划卡片 */
+};
+
+
+#endif /* PLANDATA_H */

+ 174 - 0
TransmitterSwitch/ExecPlanData/plancard.cpp

@@ -0,0 +1,174 @@
+#include "plancard.h"
+#include "ui_plancard.h"
+
+#include "UIStyleManager.h"
+#include "LHQLogAPI.h"
+
+
+
+/* 重载比较函数 */
+bool CSortModel::lessThan(const QModelIndex &left, const QModelIndex &right) const
+{
+    /* 先比较是正常日还是特殊日 */
+    auto leftDay = sourceModel()->data(left, UserRole_WeekDay).toInt();
+    auto rightDay = sourceModel()->data(right, UserRole_WeekDay).toInt();
+    if(leftDay != rightDay)
+    {
+        return leftDay < rightDay; /* 比较周几 */
+    }
+    /* 日期类型相等,再比较时间 */
+    auto leftTime = sourceModel()->data(left, UserRole_Time).toDateTime();
+    auto rightTime = sourceModel()->data(right, UserRole_Time).toDateTime();
+    if(leftDay == static_cast<int>(enum_WeekDay::WeekDay_Special))
+    {
+        /* 特殊日,比较日期和时间 */
+        return leftTime < rightTime;
+    }else {
+        /* 正常日,只比较时间 */
+        return leftTime.time() < rightTime.time();
+    }
+}
+
+
+
+
+
+
+
+
+
+PlanCard::PlanCard(QWidget *parent) :
+    QWidget(parent),
+    ui(new Ui::PlanCard)
+{
+    ui->setupUi(this);
+
+    /* 初始化视图模型 */
+    m_model = new QStandardItemModel(this);
+    m_model->setColumnCount(2);  /* 两列 */
+    m_sortModel = new CSortModel(this);
+    m_sortModel->setSourceModel(m_model);
+    m_sortModel->sort(0, Qt::AscendingOrder); /* 默认升序 */
+    /* 设置排序数据 */
+    m_sortModel->setSortRole(QtUserRole::UserRole_Time); /* 设置排序角色 */
+    ui->tableView->setModel(m_sortModel);
+    /* 设置每列的高度 */
+    ui->tableView->verticalHeader()->setMinimumHeight(34);
+    ui->tableView->verticalHeader()->setMaximumHeight(34);
+    ui->tableView->verticalHeader()->setDefaultSectionSize(34);
+    /* 设置两列一样宽 */
+    auto horWidth = ui->tableView->width();
+    ui->tableView->horizontalHeader()->setDefaultSectionSize(horWidth / 2);
+    
+    /* 连接信号和槽 */
+    connect(&EPUIStyle, &UIStyleManager::signal_qssChanged, this, &PlanCard::do_setUIStyle);
+    /* 设置默认的皮肤 */
+    do_setUIStyle();
+}
+
+PlanCard::~PlanCard()
+{
+    delete ui;
+}
+
+/* 设置频率信息 */
+void PlanCard::setChannelInfo(const ChannelInfo& info)
+{
+    m_channelInfo = info;
+    
+    /* 设置标题 */
+    ui->label_title->setText(m_channelInfo.ChannelName);
+}
+
+/* 添加一项 */
+void PlanCard::addPlanItem(const enum_WeekDay weekDay, const QDateTime& time, const enum_OnOff onOff)
+{
+    QString strTime;
+    switch(weekDay)
+    {
+        case enum_WeekDay::WeekDay_Mon:
+        strTime = QString("星期一 %1").arg(time.toString("hh:mm:ss"));
+            break;
+        case enum_WeekDay::WeekDay_Tue:
+        strTime = QString("星期二 %1").arg(time.toString("hh:mm:ss"));
+            break;
+        case enum_WeekDay::WeekDay_Wed:
+        strTime = QString("星期三 %1").arg(time.toString("hh:mm:ss"));
+            break;
+        case enum_WeekDay::WeekDay_Thu:
+        strTime = QString("星期四 %1").arg(time.toString("hh:mm:ss"));
+            break;
+        case enum_WeekDay::WeekDay_Fri:
+        strTime = QString("星期五 %1").arg(time.toString("hh:mm:ss"));
+            break;
+        case enum_WeekDay::WeekDay_Sat:
+        strTime = QString("星期六 %1").arg(time.toString("hh:mm:ss"));
+            break;
+        case enum_WeekDay::WeekDay_Sun:
+        strTime = QString("星期天 %1").arg(time.toString("hh:mm:ss"));
+            break;
+        case enum_WeekDay::WeekDay_Special:
+        strTime = QString("%1").arg(time.toString("yy-MM-dd hh:mm:ss"));
+            break;
+        default:
+            strTime = QString("未知 %1").arg(time.toString("hh:mm:ss"));
+            break;
+    }
+
+    /* 创建两个项 */
+    QStandardItem* item = new QStandardItem();
+    item->setText(strTime);
+    item->setData(static_cast<int>(weekDay), UserRole_WeekDay);   /* 设置周几 */
+    item->setData(time, UserRole_Time);                           /* 设置时间 */
+    item->setData(static_cast<int>(onOff), UserRole_OnOff);                         /* 设置开关状态 */
+
+    /* 添加一个项 */
+    m_model->setRowCount(m_model->rowCount() + 1); /* 添加一行 */
+    if(onOff == enum_OnOff::On)
+    {
+        m_model->setItem(m_model->rowCount(), 0, item);
+    }else {
+        m_model->setItem(m_model->rowCount(), 1, item);
+    }
+}
+
+/* 取出所有的计划信息 */
+void PlanCard::getAllPlanInfo(QList<ExecPlanItemInfo>& list)
+{
+    int rowCount = m_model->rowCount();
+    for(int i = 0; i < rowCount; i++)
+    {
+        auto item1 = m_model->item(i, 0);
+        auto item2 = m_model->item(i, 1);
+        ExecPlanItemInfo info1;
+        info1.ChannelID = m_channelInfo.ChannelID;
+        info1.WeekDay = static_cast<enum_WeekDay>(item1->data(UserRole_WeekDay).toInt());
+        info1.dateTime = item1->data(UserRole_Time).toDateTime();
+        info1.actionID = item1->data(UserRole_OnOff).toInt();
+        info1.actionName = g_ActionName.value(info1.actionID);
+        list.append(info1);
+
+        ExecPlanItemInfo info2;
+        info2.ChannelID = m_channelInfo.ChannelID;
+        info2.WeekDay = static_cast<enum_WeekDay>(item2->data(UserRole_WeekDay).toInt());
+        info2.dateTime = item2->data(UserRole_Time).toDateTime();
+        info2.actionID = item2->data(UserRole_OnOff).toInt();
+        info2.actionName = g_ActionName.value(info2.actionID);
+        list.append(info2);
+    }
+}
+
+/* 设置计划列表 */
+void PlanCard::setPlanList(const QList<ExecPlanItemInfo>& list)
+{
+    for(const auto& it : list)
+    {
+        addPlanItem(it.WeekDay, it.dateTime, static_cast<enum_OnOff>(it.actionID));
+    }
+}
+
+/* 更改UI外观 */
+void PlanCard::do_setUIStyle()
+{
+    this->setStyleSheet(EPUIStyle.StrQSS_PlanCard);
+}

+ 77 - 0
TransmitterSwitch/ExecPlanData/plancard.h

@@ -0,0 +1,77 @@
+#ifndef PLANCARD_H
+#define PLANCARD_H
+
+#include <QWidget>
+#include <QStandardItemModel>
+#include <QSortFilterProxyModel>
+#include "TransmitterSwitchInfo.h"
+
+
+namespace Ui {
+class PlanCard;
+}
+
+/**
+ * @brief 用户枚举值
+ * 
+ */
+enum QtUserRole
+{
+    UserRole_WeekDay = Qt::UserRole + 1,    /* 周几 */
+    UserRole_Time,                          /* 时间 */
+    UserRole_OnOff                          /* 开关机 */
+};
+
+/**
+ * @brief 自定义排序类
+ * 
+ */
+class CSortModel : public QSortFilterProxyModel
+{
+    Q_OBJECT
+public:
+    explicit CSortModel(QObject *parent = nullptr) : QSortFilterProxyModel(parent) {}
+    ~CSortModel() {}
+
+protected:
+    /* 重载比较函数 */
+    bool lessThan(const QModelIndex &left, const QModelIndex &right) const override;
+};
+
+
+
+class PlanCard : public QWidget
+{
+    Q_OBJECT
+
+public:
+    explicit PlanCard(QWidget *parent = nullptr);
+    ~PlanCard();
+
+    /* 设置频率信息 */
+    void setChannelInfo(const ChannelInfo& info);
+    /* 获取频率信息 */
+    ChannelInfo& getChannelInfo() { return m_channelInfo; }
+
+    /* 添加一项 */
+    void addPlanItem(const enum_WeekDay weekDay, const QDateTime& time, const enum_OnOff onOff);
+
+    /* 取出所有的计划信息 */
+    void getAllPlanInfo(QList<ExecPlanItemInfo>& list);
+    /* 设置计划列表 */
+    void setPlanList(const QList<ExecPlanItemInfo>& list);
+
+private slots:
+    /* 更改UI外观 */
+    void do_setUIStyle();
+
+private:
+    Ui::PlanCard *ui;
+
+    ChannelInfo m_channelInfo;   /* 频率信息 */
+
+    QStandardItemModel* m_model;  /* 表格模型,存储数据 */
+    CSortModel* m_sortModel; /* 排序模型 */
+};
+
+#endif // PLANCARD_H

+ 144 - 0
TransmitterSwitch/ExecPlanData/plancard.ui

@@ -0,0 +1,144 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>PlanCard</class>
+ <widget class="QWidget" name="PlanCard">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>340</width>
+    <height>420</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <property name="leftMargin">
+    <number>12</number>
+   </property>
+   <property name="topMargin">
+    <number>12</number>
+   </property>
+   <property name="rightMargin">
+    <number>12</number>
+   </property>
+   <property name="bottomMargin">
+    <number>12</number>
+   </property>
+   <item>
+    <widget class="QLabel" name="label_title">
+     <property name="minimumSize">
+      <size>
+       <width>0</width>
+       <height>22</height>
+      </size>
+     </property>
+     <property name="maximumSize">
+      <size>
+       <width>16777215</width>
+       <height>22</height>
+      </size>
+     </property>
+     <property name="text">
+      <string>标题</string>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QWidget" name="widget_2" native="true">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="minimumSize">
+      <size>
+       <width>0</width>
+       <height>32</height>
+      </size>
+     </property>
+     <property name="maximumSize">
+      <size>
+       <width>16777215</width>
+       <height>32</height>
+      </size>
+     </property>
+     <layout class="QHBoxLayout" name="horizontalLayout">
+      <property name="spacing">
+       <number>0</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="QLabel" name="label_onTime">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="minimumSize">
+         <size>
+          <width>0</width>
+          <height>32</height>
+         </size>
+        </property>
+        <property name="maximumSize">
+         <size>
+          <width>16777215</width>
+          <height>32</height>
+         </size>
+        </property>
+        <property name="text">
+         <string>开机时间</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QLabel" name="label_offTime">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="minimumSize">
+         <size>
+          <width>0</width>
+          <height>32</height>
+         </size>
+        </property>
+        <property name="maximumSize">
+         <size>
+          <width>16777215</width>
+          <height>32</height>
+         </size>
+        </property>
+        <property name="text">
+         <string>关机时间</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <widget class="QTableView" name="tableView"/>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 0 - 278
TransmitterSwitch/ItemData/ItemData.cpp

@@ -1,278 +0,0 @@
-#include "ItemData/ItemData.h"
-#include "LHQLogAPI.h"
-
-
-ItemData::ItemData()
-{
-    /* 创建8个List */
-    for(int i = 0; i < 8; ++i)
-    {
-        QList<OneItem*>* list = new QList<OneItem*>;
-        m_mapItem.insert(i, list);
-    }
-}
-
-
-ItemData::~ItemData()
-{
-    // for(auto it = m_mapItem.begin(); it != m_mapItem.end(); ++it)
-    // {
-    //     for(auto it1 = it.value()->begin(); it1 != it.value()->end(); ++it1)
-    //     {
-    //         delete *it1;
-    //     }
-    //     it.value()->clear();
-    //     delete it.value();
-    // }
-    // m_mapItem.clear();
-}
-
-
-/* 添加一项计划 */
-void ItemData::addOneItem(int week, OneItem* item)
-{
-    if(m_mapItem.find(week) == m_mapItem.end())
-    {
-        return;
-    }
-    m_mapItem[week]->append(item);
-    m_isUpdate = true;
-}
-
-/* 删除一项计划 */
-void ItemData::deleteOneItem(int week, int num)
-{
-    if(m_mapItem.find(week) == m_mapItem.end())
-    {
-        return;
-    }
-    auto list = m_mapItem[week];
-
-    for(auto& it : *list)
-    {
-        if(it->getNum() == num)
-        {
-            auto tmpPtr = it;
-            list->removeOne(it);
-            delete tmpPtr;
-            break;
-        }
-    }
-    m_isUpdate = true;
-}
-
-/* 清空一天的计划 */
-void ItemData::clearOneDay(int week)
-{
-    if(m_mapItem.find(week) == m_mapItem.end())
-    {
-        return;
-    }
-    auto list = m_mapItem[week];
-    for(auto it = list->begin(); it != list->end(); ++it)
-    {
-        delete *it;
-    }
-    list->clear();
-    m_isUpdate = true;
-}
-
-/* 清空所有的计划数据 */
-void ItemData::clearAllItem()
-{
-    for(auto it = m_mapItem.begin(); it != m_mapItem.end(); ++it)
-    {
-        for(auto it1 = it.value()->begin(); it1 != it.value()->end(); ++it1)
-        {
-            delete *it1;
-        }
-        it.value()->clear();
-    }
-    m_isUpdate = true;
-}
-
-
-/* 查找有没有这个项 */
-bool ItemData::findItem(OneItem* item)
-{
-    for(auto it = m_mapItem.begin(); it != m_mapItem.end(); ++it)
-    {
-        QList<OneItem*>* list = it.value();
-        for(const auto& item1 : *list)
-        {
-            if(item1 == item)
-            {
-                return true;
-            }
-        }
-    }
-    return false;
-}
-
-/* 查找有没有这个项 */
-bool ItemData::findItem(int week, OneItem* item)
-{
-    if(m_mapItem.find(week) == m_mapItem.end())
-    {
-        return false;
-    }
-    QList<OneItem*>* list = m_mapItem[week];
-    for(const auto& it : *list)
-    {
-        if(it == item)
-        {
-            return true;
-        }
-    }
-    return false;
-}
-
-/* 获取一天的容器 */
-QList<OneItem*>* ItemData::getOneDay(int week)
-{
-    if(m_mapItem.find(week) == m_mapItem.end())
-    {
-        return nullptr;
-    }
-    return m_mapItem[week];
-}
-
-/* 获取一天的计划 */
-QList<ExecPlanItemInfo> ItemData::getOneDayExecPlan(int week)
-{
-    if(m_mapItem.find(week) == m_mapItem.end())
-    {
-        QList<ExecPlanItemInfo> list;
-        list.clear();
-        return list;
-    }
-    auto list = m_mapItem[week];
-    QList<ExecPlanItemInfo> list1;
-    for(const auto& it : *list)
-    {
-        ExecPlanItemInfo info;
-        info.devName = it->getDevName();
-        info.actionID = it->getActionNum();
-        info.actionName = it->getActionName();
-        info.execTime = it->getExecTime();
-        info.date = it->getDate();
-        info.WeekDay = it->getWeekDay();
-        list1.append(info);
-    }
-    return list1;
-}
-
-
-/* 新增判断是否有重复 */
-bool ItemData::judgeTimeRepetitionWithAdd(int weekDay, const QString& devName, const QTime& time)
-{
-    /* 先查找周几对应的列表 */
-    if(m_mapItem.find(weekDay) == m_mapItem.end())
-    {
-        return false;
-    }
-    auto list = m_mapItem[weekDay];
-    for(const auto& it : *list)
-    {
-        if(it->getDevName() == devName)
-        {
-            if(it->getExecTime() == time)
-            {
-                return true;
-            }
-        }
-    }
-    /* 所有设备都判断完了,没有相同的 */
-    return false;
-}
-
-
-bool ItemData::judgeDateTimeRepetitionWithAdd(int weekDay, const QString& devName, const QDate& date, const QTime& time)
-{
-    /* 先查找周几对应的列表 */
-    if(m_mapItem.find(weekDay) == m_mapItem.end())
-    {
-        return false;
-    }
-    auto list = m_mapItem[weekDay];
-    for(const auto& it : *list)
-    {
-        if(it->getDevName() == devName)
-        {
-            if(it->getDate() == date)
-            {
-                if(it->getExecTime() == time)
-                {
-                    return true;
-                }
-            }
-        }
-    }
-    /* 所有设备都判断完了,没有相同的 */
-    return false;
-}
-
-/* 判断已有的项修改时间后和其他项是否重复 */
-bool ItemData::judgeTimeRepetitionWithEdit(int weekDay, OneItem* item, const QTime& newTime)
-{
-    if(m_mapItem.find(weekDay) == m_mapItem.end())
-    {
-        return false;
-    }
-    auto list = m_mapItem[weekDay];
-
-    for(const auto& it : *list)
-    {
-        /* 先判断名称是否相等 */
-        if(it->getDevName() == item->getDevName())
-        {
-            /* 判断是否是同一个项 */
-            if(it->getUUID() == item->getUUID())
-            {
-                continue;
-            }
-            /* 判断时间是否相同 */
-            if(it->getExecTime() == newTime)
-            {
-                return true;
-            }
-        }
-    }
-    /* 所有设备都判断完了 */
-    return false;
-}
-
-/* 判断特殊日的已有项修改时间后和其他项是否重复 */
-bool ItemData::judgeDateTimeRepetitionWithEdit(int weekDay, OneItem* item, const QDate& newDate, const QTime& newTime)
-{
-    if(m_mapItem.find(weekDay) == m_mapItem.end())
-    {
-        return false;
-    }
-    auto list = m_mapItem[weekDay];
-
-    for(const auto& it : *list)
-    {
-        /* 先判断名称是否相等 */
-        if(it->getDevName() == item->getDevName())
-        {
-            /* 判断是否是同一个项 */
-            if(it->getUUID() == item->getUUID())
-            {
-                continue;
-            }
-            /* 判断日期是否相等 */
-            if(it->getDate() == newDate)
-            {
-                /* 判断时间是否相同 */
-                if(it->getExecTime() == newTime)
-                {
-                    return true;
-                }
-            }
-        }
-    }
-    /* 所有设备都判断完了 */
-    return false;
-}
-

+ 0 - 69
TransmitterSwitch/ItemData/ItemData.h

@@ -1,69 +0,0 @@
-#ifndef ITEMDATA_H
-#define ITEMDATA_H
-
-#include "oneitem.h"
-
-
-#define IData ItemData::getInstance()
-
-/**
- * @brief 存储创建的Item
- * 
- */
-class ItemData
-{
-    ItemData();
-    ItemData(const ItemData&) = delete;
-    ItemData& operator=(const ItemData&) = delete;
-
-public:
-    ~ItemData();
-
-    static ItemData& getInstance()
-    {
-        static ItemData instance;
-        return instance;
-    }
-
-    /* 添加一项计划 */
-    void addOneItem(int week, OneItem* item);
-    /* 删除一项计划 */
-    void deleteOneItem(int week, int num);
-    /* 清空一天的计划 */
-    void clearOneDay(int week);
-    /* 清空所有的计划数据 */
-    void clearAllItem();
-
-    /* 查找有没有这个项 */
-    bool findItem(OneItem* item);
-    bool findItem(int week, OneItem* item);
-    /* 获取整个容器 */
-    QMap<int, QList<OneItem*>*>& getMapItem() { return m_mapItem; }
-    /* 获取一天的容器 */
-    QList<OneItem*>* getOneDay(int week);
-    /* 获取一天的计划 */
-    QList<ExecPlanItemInfo> getOneDayExecPlan(int week);
-
-    /* 新增判断是否有重复 */
-    bool judgeTimeRepetitionWithAdd(int weekDay, const QString& devName, const QTime& time);
-    bool judgeDateTimeRepetitionWithAdd(int weekDay, const QString& devName, const QDate& date, const QTime& time);
-    /* 判断已有的项修改时间后和其他项是否重复 */
-    bool judgeTimeRepetitionWithEdit(int weekDay, OneItem* item, const QTime& newTime);
-    /* 判断特殊日的已有项修改时间后和其他项是否重复 */
-    bool judgeDateTimeRepetitionWithEdit(int weekDay, OneItem* item, const QDate& newDate, const QTime& newTime);
-    
-    /* 获取计划是否有更新 */
-    bool isUpdate() { return m_isUpdate; }
-    /* 设置计划是否有更新 */
-    void setUpdate(bool isUpdate) { m_isUpdate = isUpdate; }
-
-private:
-    bool m_isUpdate = false;                        /* 是否有更新计划 */
-    QMap<int, QList<OneItem*>*> m_mapItem;          /* int是周几 */
-
-
-};
-
-
-
-#endif // ITEMDATA_H

+ 0 - 488
TransmitterSwitch/ItemData/oneitem.cpp

@@ -1,488 +0,0 @@
-#include "oneitem.h"
-#include "ui_oneitem.h"
-
-#include <QFile>
-#include <QCalendarWidget>
-
-#include "LHQLogAPI.h"
-#include "TransmitterSwitchInfo.h"
-#include "customcombobox.h"
-#include "calendardtedit.h"
-
-// #include "lhstylemanager.h"
-
-OneItem::OneItem(QWidget *parent, bool isSpecial) :
-    QWidget(parent), m_isSpecial(isSpecial),
-    ui(new Ui::OneItem)
-{
-    ui->setupUi(this);
-
-    init();
-}
-
-OneItem::OneItem(bool isSpecial) : 
-    QWidget(nullptr), m_isSpecial(isSpecial),
-    ui(new Ui::OneItem)
-{
-    ui->setupUi(this);
-
-    init();
-}
-
-OneItem::~OneItem()
-{
-    // LHStyleManager::Instance()->RemoveWidget(this);
-    delete ui;
-}
-
-
-/* 初始化 */
-void OneItem::init()
-{
-    QString qssPath = EPConfig.getQSSPath() + "/oneitem.qss";
-    /* 加载QSS */
-    QFile file(qssPath);
-    if(file.open(QIODevice::ReadOnly))
-    {
-        QString stylesheet = file.readAll();
-        this->setStyleSheet(stylesheet);
-        file.close();
-    } else
-    {
-        LH_WRITE_ERROR(QString("打开文件失败:%1").arg(file.fileName()));
-    }
-    // LHStyleManager::Instance()->AddWidget(this);
-    /* 设置背景透明 */
-    this->setAttribute(Qt::WA_TranslucentBackground);
-    /* 设置无边框 */
-    this->setWindowFlags(Qt::FramelessWindowHint);
-
-    /* 设置定时器 */
-    m_warnTimer.setTimerType(Qt::PreciseTimer);
-    m_warnTimer.setSingleShot(true);
-    connect(&m_warnTimer, &QTimer::timeout, this, &OneItem::hideWarn);
-
-    /* 初始化变量 */
-    m_uuid = QUuid::createUuid();
-    setExecTime(QTime(0,0,0));
-    setDate(QDate(1970,1,1));
-
-
-    /* 根据是否是特殊日移动位置 */
-    layoutInit();
-
-    /* 隐藏时间选择按钮 */
-    ui->pBtn_execDate->hide();
-    ui->pBtn_iconDate->hide();
-    /* 设置日期格式 */
-    ui->dateEdit->setDisplayFormat("yyyy-MM-dd");
-    /* 日期栏禁止滚轮滚动 */
-    ui->dateEdit->installEventFilter(this);
-    // for(auto& it : ui->dateEdit->children())
-    // {
-    //     if(it->objectName() == "qt_spinbox_lineedit")
-    //     {
-    //         it->installEventFilter(this);
-    //     }
-    // }
-    /* 设置日期栏禁止输入 */
-    ui->dateEdit->setManualDisableEdit(true, true);
-
-    /* 设置下拉框背景 */
-    ui->comboBox_devName->setViewShadowEffect();
-    ui->comboBox_action->setViewShadowEffect();
-
-    /* 注册事件过滤器 */
-    ui->comboBox_devName->installEventFilter(this);
-    ui->comboBox_action->installEventFilter(this);
-    ui->pBtn_close->installEventFilter(this);
-
-    /* 连接信号和槽 */
-    connect(ui->comboBox_devName,QOverload<const QString&>::of(&QComboBox::currentTextChanged),this,&OneItem::do_devChanged);
-    connect(ui->comboBox_action,QOverload<const QString&>::of(&QComboBox::currentTextChanged),this,&OneItem::do_actionChanged);
-    connect(ui->pBtn_execTime,&QPushButton::clicked,this,&OneItem::do_pBtn_execTime_clicked);
-    connect(ui->pBtn_iconTime,&QPushButton::clicked,this,&OneItem::do_pBtn_execTime_clicked);
-    connect(ui->pBtn_execDate,&QPushButton::clicked,this,&OneItem::do_pBtn_execDate_clicked);
-    connect(ui->pBtn_iconDate,&QPushButton::clicked,this,&OneItem::do_pBtn_execDate_clicked);
-    connect(ui->pBtn_close, &QPushButton::clicked, this, &OneItem::do_pBtn_close_clicked);
-
-    connect(ui->dateEdit, &QDateEdit::dateChanged, this, &OneItem::do_dateChanged);
-    /* 连接切换样式表的信号和槽 */
-    connect(&EPConfig, &ExecPlanGlobalConfig::signal_oneItemQssChanged, this, &OneItem::do_setQSS);
-}
-
-/* 设置序号 */
-void OneItem::setNum(int num)
-{
-    m_num = num;
-    ui->label_num->setText(QString::number(num));
-}
-
-/* 获取序号 */
-int OneItem::getNum()
-{
-    return m_num;
-}
-
-/* 设置日期 */
-void OneItem::setDate(const QDate& date)
-{
-    m_date = date;
-    ui->pBtn_execDate->setText(date.toString("yyyy-MM-dd"));
-    ui->dateEdit->setDate(date);
-}
-
-/* 获取日期 */
-QDate OneItem::getDate()
-{
-    return m_date;
-}
-
-/* 设置执行时间 */
-void OneItem::setExecTime(const QTime& time)
-{
-    m_time = time;
-    ui->pBtn_execTime->setText(time.toString("hh:mm:ss"));
-}
-
-/* 获取执行时间 */
-QTime OneItem::getExecTime()
-{
-    return m_time;
-}
-
-/* 设置设备名称 */
-void OneItem::setDevName(const QString& dev)
-{
-    ui->comboBox_devName->setCurrentText(dev);
-}
-
-/* 获取设备名称 */
-QString OneItem::getDevName()
-{
-    return ui->comboBox_devName->currentText();
-}
-
-/* 添加设备支持的动作 */
-void OneItem::addActions()
-{
-    auto acts = DevTypeContainer.getDevType(m_devInfo.PTTypeCode);
-    ui->comboBox_action->clear();
-    if(acts.PTTypeCode > 0)
-    {
-        for(auto it = acts.devAction.begin();it != acts.devAction.end();it++)
-        {
-            ui->comboBox_action->addItem(it.value(), it.key());
-        }
-    }
-}
-
-/* 获取动作名称 */
-QString OneItem::getActionName()
-{
-    return ui->comboBox_action->currentText();
-}
-
-/* 获取动作类型 */
-int OneItem::getActionNum()
-{
-    return ui->comboBox_action->currentData().toInt();
-}
-
-/* 设置动作ID */
-void OneItem::setActionNum(int num)
-{
-    ui->comboBox_action->setCurrentIndex(ui->comboBox_action->findData(num));
-}
-
-/* 添加设备 */
-void OneItem::addDevice()
-{
-    auto& mapDev = DeviceContainer.getMapDevice();
-    ui->comboBox_devName->clear();
-    for(const auto& it : mapDev)
-    {
-        ui->comboBox_devName->addItem(it.devName);
-    }
-    /* 设置显示第一个设备,并设置可选的动作 */
-    ui->comboBox_devName->setCurrentIndex(0);
-    addActions();
-}
-
-/* 获取日期类型 */
-bool OneItem::getDateType()
-{
-    return m_isSpecial;
-}
-
-/* 设置警告 */
-void OneItem::setWarningText(QString str, int ms)
-{
-    ui->label_warnning->setText(str);
-    ui->label_warnning->show();
-    if(ms > 0)
-    {
-        m_warnTimer.start(ms);
-    }
-    /* 设置红框 */
-    ui->pBtn_execTime->setProperty("Warn",true);
-    ui->pBtn_execTime->style()->unpolish(ui->pBtn_execTime);
-    ui->pBtn_execTime->style()->polish(ui->pBtn_execTime);
-    ui->pBtn_execDate->setProperty("Warn",true);
-    ui->pBtn_execDate->style()->unpolish(ui->pBtn_execDate);
-    ui->pBtn_execDate->style()->polish(ui->pBtn_execDate);
-
-    ui->dateEdit->setProperty("Warn", true);
-    ui->dateEdit->style()->unpolish(ui->dateEdit);
-    ui->dateEdit->style()->polish(ui->dateEdit);
-}
-
-/* 隐藏警告 */
-void OneItem::hideWarn()
-{
-    ui->label_warnning->clear();
-    /* 取消红框 */
-    ui->pBtn_execTime->setProperty("Warn", false);
-    ui->pBtn_execTime->style()->unpolish(ui->pBtn_execTime);
-    ui->pBtn_execTime->style()->polish(ui->pBtn_execTime);
-    ui->pBtn_execDate->setProperty("Warn", false);
-    ui->pBtn_execDate->style()->unpolish(ui->pBtn_execDate);
-    ui->pBtn_execDate->style()->polish(ui->pBtn_execDate);
-
-    ui->dateEdit->setProperty("Warn", false);
-    ui->dateEdit->style()->unpolish(ui->dateEdit);
-    ui->dateEdit->style()->polish(ui->dateEdit);
-}
-
-/* 获取执行时间的位置 */
-QPoint OneItem::getExecTimePos()
-{
-    return ui->pBtn_execTime->pos();
-}
-
-/* 获取执行日期的位置 */
-QPoint OneItem::getExecDatePos()
-{
-    return ui->pBtn_execDate->pos();
-}
-
-/* 获取执行时间按钮的大小 */
-QSize OneItem::getExecTimeSize()
-{
-    return ui->pBtn_execTime->size();
-}
-
-/* 获取执行日期按钮的大小 */
-QSize OneItem::getExecDateSize()
-{
-    return ui->pBtn_execDate->size();
-}
-
-/* 设置样式表,打开的样式表 */
-void OneItem::do_setQSS(const QString& qss)
-{
-    this->setStyleSheet(qss);
-}
-
-/* 设备改变了 */
-void OneItem::do_devChanged(QString devName)
-{
-    /* 根据选择的设备,设置该设备的动作 */
-    ui->comboBox_action->clear();
-    auto it = DeviceContainer.getDevice(devName);
-    if(it.PTTypeCode > 0)
-    {
-        m_devInfo = it;
-        for(auto it1 = m_devInfo.DevType.devAction.begin();it1 != m_devInfo.DevType.devAction.end();it1++)
-        {
-            ui->comboBox_action->addItem(it1.value(), it1.key());
-        }
-    }else
-    {
-        LH_WRITE_ERROR(QString("没有这个设备:%1").arg(devName));
-        return;
-    }
-    emit signal_devChanged();
-}
-
-/* 动作改变了 */
-void OneItem::do_actionChanged(QString action)
-{
-    emit signal_actionChanged();
-}
-
-/* 执行时间被点击了 */
-void OneItem::do_pBtn_execTime_clicked()
-{
-    emit signal_execTimeClicked(getExecTime());
-}
-
-/* 执行日期被点击了 */
-void OneItem::do_pBtn_execDate_clicked()
-{
-    emit signal_dateClicked(getDate());
-}
-
-/* 关闭按钮被点击了 */
-void OneItem::do_pBtn_close_clicked()
-{
-    emit signal_OneItemDelete(m_weekDay, m_num);
-}
-
-/* 修改了执行日期 */
-void OneItem::do_dateChanged(const QDate date)
-{
-    // LH_WRITE_LOG_DEBUG(QString("日期改变了:%1").arg(date.toString("yyyy-MM-dd")));
-    m_date = date;
-    emit signal_dateClicked(m_date);
-}
-
-
-/* 根据日期类型布局 */
-void OneItem::layoutInit()
-{
-    /* 正常日,日期隐藏 */
-    if(!m_isSpecial)
-    {
-        ui->pBtn_execDate->hide();
-        ui->pBtn_iconDate->hide();
-        ui->dateEdit->hide();
-        /* 序号 */
-        ui->label_num->move(18, 0);
-        /* 设备名称 */
-        ui->comboBox_devName->move(114, 0);
-        /* 执行时间 */
-        ui->pBtn_execTime->move(390, 0);
-        /* 执行时间图标 */
-        ui->pBtn_iconTime->move(498, 8);
-        /* 动作 */
-        ui->comboBox_action->move(538, 0);
-        /* 关闭 */
-        ui->pBtn_close->move(814, 0);
-    }else 
-    {
-        ui->pBtn_execDate->hide();
-        ui->pBtn_iconDate->hide();
-        ui->dateEdit->show();
-        /* 序号 */
-        ui->label_num->move(18, 0);
-        /* 设备名称 */
-        ui->comboBox_devName->move(114, 0);
-        /* 执行日期 */
-        ui->pBtn_execDate->move(390, 0);
-        ui->dateEdit->move(390, 0);
-        /* 执行日期图标 */
-        ui->pBtn_iconDate->move(498, 8);
-        /* 执行时间 */
-        ui->pBtn_execTime->move(539, 0);
-        /* 执行时间图标 */
-        ui->pBtn_iconTime->move(646, 8);
-        /* 动作 */
-        ui->comboBox_action->move(686, 0);
-        /* 关闭 */
-        ui->pBtn_close->move(962, 0);
-    }
-}
-
-
-/* 事件过滤器 */
-bool OneItem::eventFilter(QObject *watched, QEvent *event)
-{
-    if(watched == ui->comboBox_action)
-    {
-        if(event->type() == QEvent::Wheel)
-        {
-            return true;
-        }
-    }
-    else if(watched == ui->comboBox_devName)
-    {
-        if(event->type() == QEvent::Wheel)
-        {
-            return true;
-        }
-    }
-    else if (watched == ui->dateEdit)
-    {
-        if(event->type() == QEvent::Wheel)
-        {
-            return true;
-        }
-        /* 鼠标进入 */
-        else if(event->type() == QEvent::Enter)
-        {
-            ui->dateEdit->setProperty("Hover", true);
-            ui->dateEdit->style()->unpolish(ui->dateEdit);
-            ui->dateEdit->style()->polish(ui->dateEdit);
-            return true;
-        }
-        /* 鼠标离开 */
-        else if(event->type() == QEvent::Leave)
-        {
-            ui->dateEdit->setProperty("Hover", false);
-            ui->dateEdit->style()->unpolish(ui->dateEdit);
-            ui->dateEdit->style()->polish(ui->dateEdit);
-            return true;
-        }
-    }
-    /* QDateEdit栏中间选择日期的位置 */
-    // else if(watched->objectName() == "qt_spinbox_lineedit")
-    // {
-    //     if(event->type() == QEvent::MouseButtonPress)
-    //     {
-    //         LH_WRITE_LOG_DEBUG("点击了日期区域");
-            
-    //         return true;
-    //     }
-    // }
-    else if(watched == ui->pBtn_execTime)
-    {
-        if(event->type() == QEvent::Enter)
-        {
-            ui->pBtn_execTime->setProperty("Hover", true);
-            ui->pBtn_execTime->style()->unpolish(ui->pBtn_execTime);
-            ui->pBtn_execTime->style()->polish(ui->pBtn_execTime);
-            return true;
-        }else if(event->type() == QEvent::Leave)
-        {
-            ui->pBtn_execTime->setProperty("Hover", false);
-            ui->pBtn_execTime->style()->unpolish(ui->pBtn_execTime);
-            ui->pBtn_execTime->style()->polish(ui->pBtn_execTime);
-            return true;
-        }
-    }
-    else if(watched == ui->pBtn_execDate)
-    {
-        if(event->type() == QEvent::Enter)
-        {
-            ui->pBtn_execDate->setProperty("Hover", true);
-            ui->pBtn_execDate->style()->unpolish(ui->pBtn_execDate);
-            ui->pBtn_execDate->style()->polish(ui->pBtn_execDate);
-            return true;
-        }else if(event->type() == QEvent::Leave)
-        {
-            ui->pBtn_execDate->setProperty("Hover", false);
-            ui->pBtn_execDate->style()->unpolish(ui->pBtn_execDate);
-            ui->pBtn_execDate->style()->polish(ui->pBtn_execDate);
-            return true;
-        }
-    }
-    else if(watched == ui->pBtn_close)
-    {
-        if(event->type() == QEvent::Enter)
-        {
-            ui->pBtn_close->setProperty("Hover", true);
-            ui->pBtn_close->style()->unpolish(ui->pBtn_close);
-            ui->pBtn_close->style()->polish(ui->pBtn_close);
-            return true;
-        }else if(event->type() == QEvent::Leave)
-        {
-            ui->pBtn_close->setProperty("Hover", false);
-            ui->pBtn_close->style()->unpolish(ui->pBtn_close);
-            ui->pBtn_close->style()->polish(ui->pBtn_close);
-            return true;
-        }
-    }
-    return QWidget::eventFilter(watched,event);
-}
-

+ 0 - 125
TransmitterSwitch/ItemData/oneitem.h

@@ -1,125 +0,0 @@
-#ifndef ONEITEM_H
-#define ONEITEM_H
-
-#include <QWidget>
-#include <QTimer>
-#include <QUuid>
-
-#include "TransmitterSwitchInfo.h"
-
-namespace Ui {
-class OneItem;
-}
-
-class OneItem : public QWidget
-{
-    Q_OBJECT
-
-public:
-    explicit OneItem(QWidget *parent = nullptr, bool isSpecial = false);
-    explicit OneItem(bool isSpecial = false);
-    ~OneItem();
-
-    /* 初始化 */
-    void init();
-
-    /* 获取UUID */
-    QUuid getUUID() { return m_uuid; }
-    /* 设置周几 */
-    void setWeekDay(int week) { m_weekDay = week; }
-    /* 获取周几 */
-    int getWeekDay() { return m_weekDay; }
-    /* 设置序号 */
-    void setNum(int num);
-    /* 获取序号 */
-    int getNum();
-    /* 设置日期 */
-    void setDate(const QDate& date);
-    /* 获取日期 */
-    QDate getDate();
-    /* 设置执行时间 */
-    void setExecTime(const QTime& time);
-    /* 获取执行时间 */
-    QTime getExecTime();
-    /* 设置设备名称 */
-    void setDevName(const QString& dev);
-    /* 获取设备名称 */
-    QString getDevName();
-    /* 添加设备支持的动作 */
-    void addActions();
-    /* 获取动作名称 */
-    QString getActionName();
-    /* 获取动作ID */
-    int getActionNum();
-    /* 设置动作ID */
-    void setActionNum(int num);
-    /* 添加所有设备 */
-    void addDevice();
-
-    /* 获取日期类型 */
-    bool getDateType();
-    /* 设置警告 */
-    void setWarningText(QString str,int ms = 3000);
-    /* 隐藏警告 */
-    void hideWarn();
-    /* 获取执行时间的位置,相对于该项的位置 */
-    QPoint getExecTimePos();
-    /* 获取执行日期的位置 */
-    QPoint getExecDatePos();
-    /* 获取执行时间按钮的大小 */
-    QSize getExecTimeSize();
-    /* 获取执行日期按钮的大小 */
-    QSize getExecDateSize();
-
-signals:
-    /* 一个OneItem被删除了 */
-    void signal_OneItemDelete(int week, int num);
-    /* 日期被点击了 */
-    void signal_dateClicked(QDate date);
-    /* 执行时间被点击了 */
-    void signal_execTimeClicked(QTime time);
-    /* 设备改变了 */
-    void signal_devChanged();
-    /* 动作修改了 */
-    void signal_actionChanged();
-
-public slots:
-    /* 设置样式表,打开的样式表 */
-    void do_setQSS(const QString& qss);
-
-private slots:
-    /* 设备改变了 */
-    void do_devChanged(QString devName);
-    /* 动作改变了 */
-    void do_actionChanged(QString action);
-    /* 执行时间被点击了 */
-    void do_pBtn_execTime_clicked();
-    /* 执行日期被点击了 */
-    void do_pBtn_execDate_clicked();
-    /* 关闭按钮被点击了 */
-    void do_pBtn_close_clicked();
-    /* 修改了执行日期 */
-    void do_dateChanged(const QDate date);
-
-private:
-    /* 根据日期类型布局 */
-    void layoutInit();
-
-protected:
-    /* 事件过滤器 */
-    bool eventFilter(QObject *watched, QEvent *event);
-
-private:
-    Ui::OneItem *ui;
-    QUuid m_uuid;               /* 项的唯一识别号,做判断的时候使用 */
-    bool m_isSpecial = false;
-    QTimer m_warnTimer;
-    DeviceInfo m_devInfo;
-    
-    int m_weekDay = -1;
-    int m_num = -1;
-    QTime m_time;
-    QDate m_date;
-};
-
-#endif // ONEITEM_H

+ 0 - 350
TransmitterSwitch/ItemData/oneitem.ui

@@ -1,350 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>OneItem</class>
- <widget class="QWidget" name="OneItem">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>1220</width>
-    <height>48</height>
-   </rect>
-  </property>
-  <property name="sizePolicy">
-   <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
-    <horstretch>0</horstretch>
-    <verstretch>0</verstretch>
-   </sizepolicy>
-  </property>
-  <property name="minimumSize">
-   <size>
-    <width>0</width>
-    <height>48</height>
-   </size>
-  </property>
-  <property name="maximumSize">
-   <size>
-    <width>16777215</width>
-    <height>48</height>
-   </size>
-  </property>
-  <property name="windowTitle">
-   <string>Form</string>
-  </property>
-  <layout class="QVBoxLayout" name="verticalLayout">
-   <property name="spacing">
-    <number>0</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="QWidget" name="widget" native="true">
-     <property name="sizePolicy">
-      <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
-     <property name="minimumSize">
-      <size>
-       <width>0</width>
-       <height>48</height>
-      </size>
-     </property>
-     <layout class="QVBoxLayout" name="verticalLayout_2">
-      <property name="spacing">
-       <number>0</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="QWidget" name="widget_content" native="true">
-        <property name="sizePolicy">
-         <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
-          <horstretch>0</horstretch>
-          <verstretch>0</verstretch>
-         </sizepolicy>
-        </property>
-        <property name="minimumSize">
-         <size>
-          <width>0</width>
-          <height>32</height>
-         </size>
-        </property>
-        <widget class="QLabel" name="label_num">
-         <property name="geometry">
-          <rect>
-           <x>18</x>
-           <y>0</y>
-           <width>80</width>
-           <height>32</height>
-          </rect>
-         </property>
-         <property name="sizePolicy">
-          <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
-           <horstretch>0</horstretch>
-           <verstretch>0</verstretch>
-          </sizepolicy>
-         </property>
-         <property name="minimumSize">
-          <size>
-           <width>80</width>
-           <height>32</height>
-          </size>
-         </property>
-         <property name="text">
-          <string>序号</string>
-         </property>
-        </widget>
-        <widget class="CustomComboBox" name="comboBox_devName">
-         <property name="geometry">
-          <rect>
-           <x>114</x>
-           <y>0</y>
-           <width>260</width>
-           <height>32</height>
-          </rect>
-         </property>
-         <property name="sizePolicy">
-          <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
-           <horstretch>0</horstretch>
-           <verstretch>0</verstretch>
-          </sizepolicy>
-         </property>
-         <property name="minimumSize">
-          <size>
-           <width>260</width>
-           <height>32</height>
-          </size>
-         </property>
-         <property name="maximumSize">
-          <size>
-           <width>260</width>
-           <height>16777215</height>
-          </size>
-         </property>
-        </widget>
-        <widget class="QPushButton" name="pBtn_close">
-         <property name="geometry">
-          <rect>
-           <x>962</x>
-           <y>0</y>
-           <width>32</width>
-           <height>32</height>
-          </rect>
-         </property>
-         <property name="minimumSize">
-          <size>
-           <width>32</width>
-           <height>32</height>
-          </size>
-         </property>
-         <property name="maximumSize">
-          <size>
-           <width>32</width>
-           <height>32</height>
-          </size>
-         </property>
-         <property name="text">
-          <string/>
-         </property>
-        </widget>
-        <widget class="CustomComboBox" name="comboBox_action">
-         <property name="geometry">
-          <rect>
-           <x>686</x>
-           <y>0</y>
-           <width>260</width>
-           <height>32</height>
-          </rect>
-         </property>
-         <property name="minimumSize">
-          <size>
-           <width>260</width>
-           <height>32</height>
-          </size>
-         </property>
-         <property name="maximumSize">
-          <size>
-           <width>260</width>
-           <height>32</height>
-          </size>
-         </property>
-        </widget>
-        <widget class="QPushButton" name="pBtn_execDate">
-         <property name="geometry">
-          <rect>
-           <x>390</x>
-           <y>0</y>
-           <width>132</width>
-           <height>32</height>
-          </rect>
-         </property>
-         <property name="sizePolicy">
-          <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
-           <horstretch>0</horstretch>
-           <verstretch>0</verstretch>
-          </sizepolicy>
-         </property>
-         <property name="minimumSize">
-          <size>
-           <width>132</width>
-           <height>32</height>
-          </size>
-         </property>
-         <property name="maximumSize">
-          <size>
-           <width>132</width>
-           <height>32</height>
-          </size>
-         </property>
-         <property name="text">
-          <string>2025-01-16</string>
-         </property>
-        </widget>
-        <widget class="QPushButton" name="pBtn_execTime">
-         <property name="geometry">
-          <rect>
-           <x>538</x>
-           <y>0</y>
-           <width>132</width>
-           <height>32</height>
-          </rect>
-         </property>
-         <property name="sizePolicy">
-          <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
-           <horstretch>0</horstretch>
-           <verstretch>0</verstretch>
-          </sizepolicy>
-         </property>
-         <property name="minimumSize">
-          <size>
-           <width>132</width>
-           <height>32</height>
-          </size>
-         </property>
-         <property name="maximumSize">
-          <size>
-           <width>132</width>
-           <height>32</height>
-          </size>
-         </property>
-         <property name="text">
-          <string>00:00:00</string>
-         </property>
-        </widget>
-        <widget class="QPushButton" name="pBtn_iconDate">
-         <property name="geometry">
-          <rect>
-           <x>500</x>
-           <y>10</y>
-           <width>16</width>
-           <height>16</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string/>
-         </property>
-        </widget>
-        <widget class="QPushButton" name="pBtn_iconTime">
-         <property name="geometry">
-          <rect>
-           <x>640</x>
-           <y>10</y>
-           <width>16</width>
-           <height>16</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string/>
-         </property>
-        </widget>
-        <widget class="CalendarDTEdit" name="dateEdit">
-         <property name="geometry">
-          <rect>
-           <x>390</x>
-           <y>0</y>
-           <width>132</width>
-           <height>32</height>
-          </rect>
-         </property>
-         <property name="sizePolicy">
-          <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
-           <horstretch>0</horstretch>
-           <verstretch>0</verstretch>
-          </sizepolicy>
-         </property>
-         <property name="calendarPopup">
-          <bool>true</bool>
-         </property>
-        </widget>
-        <zorder>label_num</zorder>
-        <zorder>comboBox_devName</zorder>
-        <zorder>pBtn_close</zorder>
-        <zorder>comboBox_action</zorder>
-        <zorder>pBtn_execDate</zorder>
-        <zorder>pBtn_execTime</zorder>
-        <zorder>pBtn_iconTime</zorder>
-        <zorder>pBtn_iconDate</zorder>
-        <zorder>dateEdit</zorder>
-       </widget>
-      </item>
-      <item>
-       <widget class="QLabel" name="label_warnning">
-        <property name="sizePolicy">
-         <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
-          <horstretch>0</horstretch>
-          <verstretch>0</verstretch>
-         </sizepolicy>
-        </property>
-        <property name="maximumSize">
-         <size>
-          <width>16777215</width>
-          <height>16</height>
-         </size>
-        </property>
-        <property name="text">
-         <string/>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <customwidgets>
-  <customwidget>
-   <class>CustomComboBox</class>
-   <extends>QComboBox</extends>
-   <header location="global">customcombobox.h</header>
-  </customwidget>
-  <customwidget>
-   <class>CalendarDTEdit</class>
-   <extends>QDateEdit</extends>
-   <header location="global">calendardtedit.h</header>
-  </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>

BIN
TransmitterSwitch/Resource/ICON/space_dark.png


BIN
TransmitterSwitch/Resource/ICON/space_light.png


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


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


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


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


+ 0 - 0
TransmitterSwitch/Resource/QSS/black/addnormalitem.qss → TransmitterSwitch/Resource/QSS/dark/addnormalitem.qss


+ 0 - 0
TransmitterSwitch/Resource/QSS/black/addspecialitem.qss → TransmitterSwitch/Resource/QSS/dark/addspecialitem.qss


+ 0 - 0
TransmitterSwitch/Resource/QSS/black/importtemplate.qss → TransmitterSwitch/Resource/QSS/dark/importtemplate.qss


+ 0 - 0
TransmitterSwitch/Resource/QSS/black/oneitem.qss → TransmitterSwitch/Resource/QSS/dark/oneitem.qss


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

@@ -0,0 +1,29 @@
+
+/* 频率按钮样式表 */
+
+QPushButton
+{
+    font-weight: normal;
+    font-size: 14px;
+}
+
+QPushButton
+{
+    text-align: left;
+    padding-left: 19px;
+    background: #313539;
+    border-radius: 0px 0px 0px 0px;
+    border: 0px;
+}
+
+QPushButton:checked
+{   
+    text-align: left;
+    padding-left: 19px;
+    background: rgba(67,142,255,0.2);
+    border-radius: 0px;
+    border-right: 2px solid #438EFF;
+}
+
+
+

+ 0 - 0
TransmitterSwitch/Resource/QSS/black/savetotemplate.qss → TransmitterSwitch/Resource/QSS/dark/savetotemplate.qss


+ 31 - 59
TransmitterSwitch/Resource/QSS/black/transmitterswitch.qss → TransmitterSwitch/Resource/QSS/dark/transmitterswitch.qss

@@ -15,14 +15,9 @@ QWidget
 }
 
 /* 整体背景 */
-QWidget
-{
-    background: #202428;
-}
-
 QWidget#widget
 {
-    border-radius: 4px 4px 4px 4px;
+    background: transparent;
 }
 
 QPushButton
@@ -40,6 +35,13 @@ QPushButton
 /*===============================================================
  * widget_Top
  ================================================================*/
+QWidget#widget_top
+{
+    background-color:#202428;
+    border-radius: 4px 4px 4px 4px;
+}
+
+
 QLabel#label_X1
 {
     text-align: center;
@@ -91,78 +93,48 @@ QLabel#label_TipText
     border: 1px solid rgba(255,255,255,0.15);
 }
 
-
-/*===============================================================
- * widget_Content
- ================================================================*/
-QWidget#widget_content
+QPushButton#pBtn_editPlan, #pBtn_clearPlan, #pBtn_importPlan, #pBtn_exportPlan, #pBtn_deletePlan, #pBtn_cloneToOther, #pBtn_refresh
 {
-    border-radius: 0px 0px 0px 0px;
-    border: 1px solid rgba(255,255,255,0.15);
+    background: rgba(255,255,255,0.08);
+    border-radius: 2px 2px 2px 2px;
 }
 
-QWidget#widget_weekpBtn
+QPushButton#pBtn_editPlan:hover, #pBtn_clearPlan:hover, #pBtn_importPlan:hover, #pBtn_exportPlan:hover, #pBtn_deletePlan:hover, 
+#pBtn_cloneToOther:hover, #pBtn_refresh:hover
 {
-    background: #313539;
-    border-radius: 0px 0px 0px 0px;
-    border-right: 1px solid rgba(255,255,255,0.15);
+    background: #1a69b8;
+    border-radius: 2px 2px 2px 2px;
 }
 
-/* 周几按钮 */
-QPushButton#pBtn_Monday, #pBtn_Tuesday, #pBtn_Wednesday, #pBtn_Thursday, #pBtn_Friday, #pBtn_Saturday, #pBtn_Sunday, #pBtn_SpecialDay
+/* 添加按钮 */
+QPushButton#pBtn_addPlan
 {
-    /* font-weight: normal;
-    font-size: 14px; */
-
-    text-align: left;
-    padding-left: 19px;
-    background: #313539;
-    border-radius: 0px 0px 0px 0px;
-    border: 0px;
+    color: #FFFFFF;
+    background: #438EFF;
+    border-radius: 2px 2px 2px 2px;
 }
 
-QPushButton#pBtn_Monday:checked, #pBtn_Tuesday:checked, #pBtn_Wednesday:checked, #pBtn_Thursday:checked, #pBtn_Friday:checked, #pBtn_Saturday:checked, #pBtn_Sunday:checked, #pBtn_SpecialDay:checked
+QPushButton#pBtn_addPlan:hover
 {
-    /* font-weight: normal;
-    font-size: 14px; */
-    
-    text-align: left;
-    padding-left: 19px;
-    background: rgba(67,142,255,0.2);
-    border-radius: 0px;
-    border-right: 2px solid #438EFF;
+    color: #FFFFFF;
+    background: #1a69b8;
+    border-radius: 2px 2px 2px 2px;
 }
 
+
 /*===============================================================
- * widget_bottom
+ * widget_Content
  ================================================================*/
-
-QWidget#widget_bottom
-{
-    border-radius: 0px 0px 0px 0px;
-    border-left: 1px solid rgba(255,255,255,0.15);
-    border-right: 1px solid rgba(255,255,255,0.15);
-    border-bottom: 1px solid rgba(255,255,255,0.15);
-}
-
-QWidget#widget_bottom2
-{
-    border-radius: 0px 0px 0px 0px;
-    border-left: 1px solid rgba(255,255,255,0.15);
-    border-right: 1px solid rgba(255,255,255,0.15);
-    border-bottom: 1px solid rgba(255,255,255,0.15);
-}
-
-QPushButton#pBtn_addPlan, #pBtn_clearPlan, #pBtn_importPlan, #pBtn_exportPlan, #pBtn_savePlan, #pBtn_getPlan
+QWidget#widget_content
 {
-    background: rgba(255,255,255,0.08);
+    background: #202428;
     border-radius: 4px 4px 4px 4px;
 }
 
-QPushButton#pBtn_addPlan:hover, #pBtn_clearPlan:hover, #pBtn_importPlan:hover, #pBtn_exportPlan:hover, #pBtn_savePlan:hover, #pBtn_getPlan:hover
+QWidget#widget_frequency
 {
-    background: #1a69b8;
-    border-radius: 4px 4px 4px 4px;
+    background: #313539;
+    border-radius: 0px 0px 0px 0px;
 }
 
 

+ 0 - 0
TransmitterSwitch/Resource/QSS/black/warning.qss → TransmitterSwitch/Resource/QSS/dark/warning.qss


+ 13 - 12
TransmitterSwitch/Resource/TransSwitch.qrc

@@ -12,18 +12,19 @@
         <file>QSS/white/SelectTime/timewidget.qss</file>
         <file>QSS/white/SelectDate/calendarheader.qss</file>
         <file>QSS/white/SelectDate/calendarnav.qss</file>
-        <file>QSS/black/addnormalitem.qss</file>
-        <file>QSS/black/addspecialitem.qss</file>
-        <file>QSS/black/importtemplate.qss</file>
-        <file>QSS/black/oneitem.qss</file>
-        <file>QSS/black/savetotemplate.qss</file>
-        <file>QSS/black/transmitterswitch.qss</file>
-        <file>QSS/black/warning.qss</file>
-        <file>QSS/black/warning.qss</file>
-        <file>QSS/black/SelectTime/timepartwidget.qss</file>
-        <file>QSS/black/SelectTime/timewidget.qss</file>
-        <file>QSS/black/SelectDate/calendarheader.qss</file>
-        <file>QSS/black/SelectDate/calendarnav.qss</file>
+        <file>QSS/dark/addnormalitem.qss</file>
+        <file>QSS/dark/addspecialitem.qss</file>
+        <file>QSS/dark/importtemplate.qss</file>
+        <file>QSS/dark/oneitem.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>
     </qresource>
     <qresource prefix="/ICON">
         <file>Tip/Complete2x.png</file>

+ 3 - 2
TransmitterSwitch/Template/importtemplate.cpp

@@ -13,6 +13,7 @@
 #include "LHQLogAPI.h"
 #include "OneShadowEffect.h"
 #include "TransmitterSwitchInfo.h"
+#include "UIStyleManager.h"
 
 ImportTemplate::ImportTemplate(QMap<QString, int> tabList, int type, QWidget *parent) :
     QDialog(parent),
@@ -133,7 +134,7 @@ void ImportTemplate::do_seletctRow(int row, int col)
     {
         /* 弹出框提示确定要删除 */
         std::shared_ptr<Warning> w = std::make_shared<Warning>(this);
-        w->setQSS(EPConfig.getQSSPath());
+        w->setQSS(EPUIStyle.getQSSPath());
         w->setText("是否删除模板?");
         bool flag = false;
         connect(w.get(), &Warning::signal_ok,this,[&](){
@@ -166,7 +167,7 @@ void ImportTemplate::do_seletctRow(int row, int col)
 void ImportTemplate::createRow(int row,int num,const QString &text)
 {
     /* 获取亮色还是暗色 */
-    bool isDark = (EPConfig.getUIStyle() == enum_UIStyle::UI_Dark ? true : false);
+    bool isDark = (EPUIStyle.getUIStyle() == enum_UIStyle::UI_Dark ? true : false);
 
     QTableWidgetItem* item = new QTableWidgetItem;
     item->setData(Qt::DisplayRole,num);

+ 37 - 59
TransmitterSwitch/TransmitterSwitchInfo.cpp

@@ -70,11 +70,10 @@ void ConfigDataContainer::deleteConfigData(int key)
 
 ExecPlanItemInfo::ExecPlanItemInfo()
 {
+    ChannelID = -1;
     ExecType = -1;
-    WeekDay = 0;
-    // num = -1;
-    date = QDate::fromString("1970-01-01","yyyy-MM-dd");
-    execTime = QTime::fromString("00:00:00","hh:mm:ss");
+    WeekDay = enum_WeekDay::WeekDay_Mon;
+    dateTime = QDateTime::fromString("1970-01-01 00:00:00", "yyyy-MM-dd hh:mm:ss");
     devName = "未定义";
     actionID = 0;
     actionName = "未定义";
@@ -82,10 +81,10 @@ ExecPlanItemInfo::ExecPlanItemInfo()
 
 ExecPlanItemInfo::ExecPlanItemInfo(const ExecPlanItemInfo& item)
 {
+    ChannelID = item.ChannelID;
     ExecType = item.ExecType;
     WeekDay = item.WeekDay;
-    date = item.date;
-    execTime = item.execTime;
+    dateTime = item.dateTime;
     actionID = item.actionID;
     devName = item.devName;
     actionName = item.actionName;
@@ -95,19 +94,46 @@ ExecPlanItemInfo& ExecPlanItemInfo::operator=(const ExecPlanItemInfo& item)
 {
     if(this == &item)
         return *this;
+    ChannelID = item.ChannelID;
     ExecType = item.ExecType;
     WeekDay = item.WeekDay;
-    // num = item.num;
-    date = item.date;
-    execTime = item.execTime;
+    dateTime = item.dateTime;
     devName = item.devName;
     actionID = item.actionID;
     actionName = item.actionName;
-    // dateType = item.dateType;
-    // cfgDev = item.cfgDev;
     return *this;
 }
 
+ChannelInfo::ChannelInfo(const ChannelInfo& channel)
+{
+    ChannelID = channel.ChannelID;
+    ChannelName = channel.ChannelName;
+}
+
+ChannelInfo& ChannelInfo::operator=(const ChannelInfo& channel)
+{
+    if(this == &channel)
+        return *this;
+    ChannelID = channel.ChannelID;
+    ChannelName = channel.ChannelName;
+    return *this;
+}
+
+/* 添加一个频率 */
+void MapChannel::addChannel(const ChannelInfo& channelInfo)
+{
+    m_mapChannel.insert(channelInfo.ChannelID, channelInfo);
+}
+
+/* 获取一个频率 */
+ChannelInfo MapChannel::getChannel(int channelID)
+{
+    if(m_mapChannel.contains(channelID))
+    {
+        return m_mapChannel[channelID];
+    }
+    return ChannelInfo();
+}
 
 
 DevTypeInfo::DevTypeInfo()
@@ -247,51 +273,3 @@ void MapDevice::deleteDevice(const QString& devName)
     }
 }
 
-
-ExecPlanGlobalConfig::ExecPlanGlobalConfig()
-{
-    m_qssPath = ":/QSS/QSS";
-}
-
-/* 设置样式表路径 */
-// void ExecPlanGlobalConfig::setQSSPath(const QString& qssPath)
-// {
-//     m_qssPath = qssPath;
-// }
-
-/* 获取样式表路径 */
-QString ExecPlanGlobalConfig::getQSSPath()
-{
-    if(m_UIStyle == enum_UIStyle::UI_Light)
-    {
-        return m_qssPath + m_lightQSS;
-    }
-    else if(m_UIStyle == enum_UIStyle::UI_Dark)
-    {
-        return m_qssPath + m_darkQSS;
-    }
-    return QString();
-}
-
-/* 换肤,修改样式表 */
-void ExecPlanGlobalConfig::setUIStyle(enum_UIStyle style)
-{
-    m_UIStyle = style;
-    /* 打开文件OneItem的样式表,发送特殊换肤信号 */
-    QFile file;
-    QString qssOneItem = getQSSPath() + "/oneitem.qss";
-    file.setFileName(qssOneItem);
-    if(file.open(QIODevice::ReadOnly))
-    {
-        QString qss = file.readAll();
-        file.close();
-        emit signal_oneItemQssChanged(qss);
-    }
-    /* 发送普通换肤信号信号 */
-    emit signal_qssChanged();
-
-    /* 处理事件,让UI接收到换肤信号 */
-    QEventLoop loop;
-    loop.processEvents();
-}
-

+ 71 - 58
TransmitterSwitch/TransmitterSwitchInfo.h

@@ -16,10 +16,21 @@ extern const QMap<int, QString> g_mapTrack;
  * @brief 支持的发射机类型
  * 
  */
-const QMap<int, QString> g_DevTypeInfo = {
+ const QMap<int, QString> g_DevTypeInfo = {
     {955, "衢州台发射机"}
 };
 
+enum class enum_OnOff : int
+{
+    Off = 0,                    /* 关机 */
+    On = 1                      /* 开机 */
+};
+
+const QMap<int, QString> g_ActionName
+{
+    {static_cast<int>(enum_OnOff::On), "开机"},
+    {static_cast<int>(enum_OnOff::Off), "关机"}
+};
 
 
 /* EQM数据库中的主备 */
@@ -36,16 +47,6 @@ enum class enum_Action : int
     Act_OFF = 2,                /* 关机 */
 };
 
-/**
- * @brief UI样式
- * 
- */
-enum class enum_UIStyle
-{
-    UI_Light = 0,               /* 亮色 */
-    UI_Dark = 1                 /* 暗色 */
-};
-
 /**
  * @brief tExecPlanConfig表格的关键字
  * 
@@ -67,6 +68,22 @@ enum class enum_ExecPlanConfig : int
     DefaultPlan_OFF = 1             /* 默认计划开 */
  };
 
+ /**
+  * @brief 周几枚举
+  * 
+  */
+enum class enum_WeekDay : int
+{
+    WeekDay_Mon = 1,               /* 周一 */
+    WeekDay_Tue = 2,               /* 周二 */
+    WeekDay_Wed = 3,               /* 周三 */
+    WeekDay_Thu = 4,               /* 周四 */
+    WeekDay_Fri = 5,               /* 周五 */
+    WeekDay_Sat = 6,               /* 周六 */
+    WeekDay_Sun = 7,               /* 周日 */
+    WeekDay_Special = 8            /* 特殊日 */
+};
+
 /**
  * @brief WebAPI初始化数据
  * 
@@ -167,10 +184,10 @@ private:
  */
 struct ExecPlanItemInfo
 {
+    int ChannelID;                                  /* 频率ID */
     int ExecType;                                   /* 执行类型,0按时刻,1按天 */
-    int WeekDay;                                    /* 周几,数据库里是1-7一周,周8是特殊日 */
-    QDate date;                                     /* 日期 */
-    QTime execTime;                                 /* 执行时间 */
+    enum_WeekDay WeekDay;                           /* 周几,数据库里是1-7一周,周8是特殊日 */
+    QDateTime dateTime;                             /* 时间和日期 */
     QString devName;                                /* 设备名称 */
     int actionID;                                   /* 动作ID */
     QString actionName;                             /* 执行的动作 */
@@ -181,7 +198,45 @@ struct ExecPlanItemInfo
 };
 
 
+/**
+ * @brief 频率信息
+ * 
+ */
+struct ChannelInfo
+{
+    int ChannelID = -1;                         /* 通道ID */
+    QString ChannelName;                        /* 通道名称 */
+
+    ChannelInfo() {}
+    ChannelInfo(const ChannelInfo& channel);
+    ChannelInfo& operator=(const ChannelInfo& channel);
+};
 
+#define ChnContainer MapChannel::getInstance()
+class MapChannel
+{
+    MapChannel() {}
+    MapChannel(const MapChannel& channel) = delete;
+    MapChannel& operator=(const MapChannel& channel) = delete;
+public:
+    ~MapChannel() {}
+
+    static MapChannel& getInstance()
+    {
+        static MapChannel instance;
+        return instance;
+    }
+
+    /* 添加一个频率 */
+    void addChannel(const ChannelInfo& channelInfo);
+    /* 获取一个频率 */
+    ChannelInfo getChannel(int channelID);
+    /* 获取容器 */
+    QMap<int, ChannelInfo>& getMapChannel() { return m_mapChannel; }
+    
+private:
+    QMap<int, ChannelInfo> m_mapChannel;          /* 频率信息,key是通道ID */
+};
 
 /**
  * @brief 存储一个设备类型及端口参数,即这个设备支持哪些端口,在配置页面选择设备的时候使用
@@ -200,6 +255,7 @@ struct DevTypeInfo
 };
 
 
+#define DevTypeContainer MapDevType::getInstance()
 /**
  * @brief 软件支持的设备类型信息
  * 
@@ -229,7 +285,6 @@ private:
 
 };
 
-#define DevTypeContainer MapDevType::getInstance()
 
 
 
@@ -255,7 +310,7 @@ struct DeviceInfo
     int ChannelID;                      /* 通道ID */
 };
 
-
+#define DeviceContainer MapDevice::getInstance()
 class MapDevice
 {
     MapDevice();
@@ -288,53 +343,11 @@ private:
 
 };
 
-#define DeviceContainer MapDevice::getInstance()
 
 
-/**
- * @brief 执行计划页面的全局配置信息
- * 
- */
-class ExecPlanGlobalConfig : public QObject
-{
-    Q_OBJECT
 
-    ExecPlanGlobalConfig();
-    ExecPlanGlobalConfig(const ExecPlanGlobalConfig& config) = delete;
-    ExecPlanGlobalConfig& operator=(const ExecPlanGlobalConfig& config) = delete;
-public:
-    ~ExecPlanGlobalConfig() {}
 
-    static ExecPlanGlobalConfig& getInstance()
-    {
-        static ExecPlanGlobalConfig config;
-        return config;
-    }
-
-    /* 设置样式表路径 */
-    // void setQSSPath(const QString& qssPath);
-    /* 获取样式表路径 */
-    QString getQSSPath();
-    /* 换肤,修改样式表 */
-    void setUIStyle(enum_UIStyle style);
-    /* 获取当前UI风格 */
-    enum_UIStyle getUIStyle() { return m_UIStyle; }
-
-signals:
-    /* 样式表改变了 */
-    void signal_qssChanged();
-    /* OneIten样式表改变了 */
-    void signal_oneItemQssChanged(const QString& qssPath);
-
-private:
-    QString m_qssPath;                      /* 样式表路径 */
-    const QString m_lightQSS = "/white";    /* 亮色样式表路径 */
-    const QString m_darkQSS = "/black";     /* 暗色样式表路径 */
-
-    enum_UIStyle m_UIStyle;                 /* 当前UI样式 */
-};
 
-#define EPConfig ExecPlanGlobalConfig::getInstance()
 
 
 #endif /* TRANSMITTERSWITCHINFO_H */

+ 74 - 0
TransmitterSwitch/UIStyle/UIStyleManager.cpp

@@ -0,0 +1,74 @@
+#include "UIStyleManager.h"
+
+#include <QFile>
+#include <QEventLoop>
+#include "LHQLogAPI.h"
+
+UIStyleManager::UIStyleManager()
+{
+    m_qssPath = ":/QSS/QSS";
+}
+
+
+/* 获取样式表路径 */
+QString UIStyleManager::getQSSPath()
+{
+    if(m_UIStyle == enum_UIStyle::UI_Light)
+    {
+        return m_qssPath + m_lightQSS;
+    }
+    else if(m_UIStyle == enum_UIStyle::UI_Dark)
+    {
+        return m_qssPath + m_darkQSS;
+    }
+    return QString();
+}
+
+/* 换肤,修改样式表 */
+void UIStyleManager::setUIStyle(enum_UIStyle style)
+{
+    m_UIStyle = style;
+   
+    /* 打开所有的QSS文件 */
+    readQSSFile();
+
+    /* 发送普通换肤信号信号 */
+    emit signal_qssChanged();
+
+    /* 处理事件,让UI接收到换肤信号 */
+    QEventLoop loop;
+    loop.processEvents();
+
+    LH_WRITE_LOG(QString("换肤成功,皮肤样式:%1").arg((int)m_UIStyle));
+}
+
+/* 读取qss样式文件调用前需要先设置完成样式类型 */
+void UIStyleManager::readQSSFile()
+{
+    QFile file;
+    /* 打开主窗口样式表 */
+    QString qssPath = getQSSPath() + "/transmitterswitch.qss";
+    file.setFileName(qssPath);
+    if(file.open(QIODevice::ReadOnly))
+    {
+        StrQSS_TransmitterSwitch = file.readAll();
+        file.close();
+    }else {
+        LH_WRITE_ERROR(QString("打开样式表失败: %1").arg(qssPath));
+    }
+
+    /* 打开频率按钮的样式表 */
+    qssPath.clear();
+    qssPath = EPUIStyle.getQSSPath() + "/pBtn_frequency.qss";
+    file.setFileName(qssPath);
+    if(file.open(QFile::ReadOnly))
+    {
+        QString qss = file.readAll();
+        StrQSS_PBtnFrequency = qss;
+        file.close();
+    }else {
+        LH_WRITE_ERROR(QString("打开样式表失败: %1").arg(qssPath));
+    }
+}
+
+

+ 72 - 0
TransmitterSwitch/UIStyle/UIStyleManager.h

@@ -0,0 +1,72 @@
+#ifndef UISTYLEMANAGER_H
+#define UISTYLEMANAGER_H
+
+
+#include <QObject>
+
+
+
+/**
+ * @brief UI样式
+ * 
+ */
+ enum class enum_UIStyle
+ {
+     UI_Light = 0,               /* 亮色 */
+     UI_Dark = 1                 /* 暗色 */
+ };
+
+
+
+#define EPUIStyle UIStyleManager::getInstance()
+/**
+ * @brief 全局皮肤管理器,大部分的UI从这里加载qss文件
+ * 
+ */
+class UIStyleManager : public QObject
+{
+    Q_OBJECT
+
+    UIStyleManager();
+    UIStyleManager(const UIStyleManager& config) = delete;
+    UIStyleManager& operator=(const UIStyleManager& config) = delete;
+public:
+    ~UIStyleManager() {}
+
+    static UIStyleManager& getInstance()
+    {
+        static UIStyleManager config;
+        return config;
+    }
+
+    QString StrQSS_TransmitterSwitch;       /* 主窗口样式表 */
+    QString StrQSS_PBtnFrequency;           /* 频率按钮样式表 */
+    QString StrQSS_PlanCard;                /* 计划卡片样式表 */
+
+    /* 获取样式表路径 */
+    QString getQSSPath();
+    /* 换肤,修改样式表 */
+    void setUIStyle(enum_UIStyle style);
+    /* 获取当前UI风格 */
+    enum_UIStyle getUIStyle() { return m_UIStyle; }
+
+signals:
+    /* 样式表改变了 */
+    void signal_qssChanged();
+
+private:
+    /* 读取qss样式文件 */
+    void readQSSFile();
+
+private:
+    enum_UIStyle m_UIStyle;                 /* 当前UI样式 */
+    QString m_qssPath;                      /* 样式表路径 */
+    const QString m_lightQSS = "/white";    /* 亮色样式表路径 */
+    const QString m_darkQSS = "/dark";      /* 暗色样式表路径 */
+
+    
+};
+
+
+
+#endif /* UISTYLEMANAGER_H */

+ 13 - 0
TransmitterSwitch/UserData/pBtnUserData2.cpp

@@ -0,0 +1,13 @@
+#include "pBtnUserData2.h"
+
+
+
+PBtnUserData2::PBtnUserData2()
+{
+
+}
+PBtnUserData2::~PBtnUserData2()
+{
+
+}
+

+ 27 - 0
TransmitterSwitch/UserData/pBtnUserData2.h

@@ -0,0 +1,27 @@
+#ifndef PBTNUSERDATA_H
+#define PBTNUSERDATA_H
+
+
+#include <QObjectUserData>
+
+#include "transmitterswitchinfo.h"
+
+class PBtnUserData2 : public QObjectUserData
+{
+
+public:
+    PBtnUserData2();
+    ~PBtnUserData2();
+
+    /* 设置频率ID */
+    void setChannelInfo(const ChannelInfo& chn) { m_channelInfo = chn; }
+    /* 获取频率ID */
+    ChannelInfo& getChannelInfo() { return m_channelInfo; }
+
+private:
+    ChannelInfo m_channelInfo;         /* 频率信息 */
+    
+};
+
+
+#endif /* PBTNUSERDATA_H */

+ 72 - 9
TransmitterSwitch/WebAPI/FromWebAPI.cpp

@@ -77,6 +77,7 @@ bool FromWebAPI::initWebApi(const QString& url, const QString& serverID, const Q
         LH_WRITE_ERROR(QString("Login failed:%1, error info:%2").arg(ret).arg(m_httpApi->DoGetLastError(&ret)));
         return false;
     }
+    LH_WRITE_LOG("\n");
     LH_WRITE_LOG("WebAPI Login success!");
 
     return true;
@@ -170,6 +171,68 @@ bool FromWebAPI::getDeviceInfo(QMap<QString, DeviceInfo>& mapDevice)
 }
 
 
+/* 获取频率信息 */
+bool FromWebAPI::getChannelInfo(QMap<int, ChannelInfo>& mapFreq)
+{
+    if(m_httpApi == nullptr)
+    {
+        LH_WRITE_ERROR("WebAPI is nullptr");
+        return false;
+    }
+
+    nJson json0;
+    json0["opName"] = "ESM8C_GetChannel";
+    QString strCmd = QString::fromStdString(json0.dump());
+    QString strRet;
+    auto ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_Select, strCmd, strRet, true);
+    if(ret != 0)
+    {
+        LH_WRITE_ERROR(QString("从数据库获取频率信息失败:%1, 错误信息:%2").arg(ret).arg(m_httpApi->DoGetLastError(&ret)));
+        return false;
+    }
+
+    try 
+    {
+        nJson json1 = nJson::parse(strRet.toStdString());
+        int retCode = json1["code"].get<int>();
+        if(retCode != 0)
+        {
+            LH_WRITE_ERROR("获取频率数据失败");
+            return false;
+        }
+        nJson result = json1["result"];
+        for(auto& it : result)
+        {
+            ChannelInfo freqInfo;
+            freqInfo.ChannelID = it["chnid"].is_null() ? -1 : it["chnid"].get<int>();
+            if(freqInfo.ChannelID <= 0)
+            {
+                LH_WRITE_LOG_DEBUG(QString("通道ID错误:%1").arg(freqInfo.ChannelID));
+                continue;
+            }
+            freqInfo.ChannelName = QString::fromStdString(it["chnname"].get<std::string>());
+            mapFreq.insert(freqInfo.ChannelID, freqInfo);
+        }
+    }
+    catch (const nJson::parse_error& e) {
+        LH_WRITE_ERROR("解析频率信息数据失败");
+        return false;
+    }
+    catch (const nJson::exception& e)
+    {
+        LH_WRITE_ERROR("解析频率信息数据失败");
+        return false;
+    }
+    catch(...)
+    {
+        LH_WRITE_ERROR("解析频率信息数据失败");
+        return false;
+    }
+    LH_WRITE_LOG_DEBUG(QString("获取频率数据成功,频率数目:%1").arg(mapFreq.size()));
+
+    return true;
+}
+
 
 /**
  * @brief 将数据写入EQM数据库,这里不需要模版编号和名称,编号都设置成0
@@ -200,8 +263,8 @@ bool FromWebAPI::insertData(QList<ExecPlanItemInfo>& list)
             nJson json2;
             json2["ExecType"] = it.ExecType;
             json2["WeekDay"] = it.WeekDay;
-            json2["Date"] = it.date.toString("yyyy-MM-dd").toStdString();
-            json2["ExecTime"] = it.execTime.toString("hh:mm:ss").toStdString();
+            json2["Date"] = it.dateTime.date().toString("yyyy-MM-dd").toStdString();
+            json2["ExecTime"] = it.dateTime.time().toString("hh:mm:ss").toStdString();
             json2["DeviceName"] = it.devName.toStdString();
             json2["ActionName"] = it.actionName.toStdString();
             json2["ActionID"] = static_cast<int>(it.actionID);
@@ -316,13 +379,13 @@ bool FromWebAPI::getExecPlanData(QList<ExecPlanItemInfo>& list)
             }
 
             info.ExecType = it["execType"].get<int>();
-            info.WeekDay = it["weekDay"].get<int>();
+            info.WeekDay = static_cast<enum_WeekDay>(it["weekDay"].get<int>());
             auto tmpDate = it["date"].is_null() ? "" : it["date"].get<std::string>();
             if(!tmpDate.empty())
             {
-                info.date = QDate::fromString(QString::fromStdString(tmpDate),"yyyy-MM-dd");
+                info.dateTime.setDate(QDate::fromString(QString::fromStdString(tmpDate),"yyyy-MM-dd"));
             }
-            info.execTime = QTime::fromString(QString::fromStdString(it["execTime"].get<std::string>()),"hh:mm:ss");
+            info.dateTime.setTime(QTime::fromString(QString::fromStdString(it["execTime"].get<std::string>()),"hh:mm:ss"));
             info.actionName = QString::fromStdString(it["actionName"].get<std::string>());
             info.actionID = it["actionID"].get<int>();
 
@@ -734,8 +797,8 @@ bool FromWebAPI::saveTemplate(const QString& templateName, const int type, QList
 
         json2["templateName"] = templateName.toStdString();
         json2["templateType"] = type;
-        json2["execDate"] = it.date.toString("yyyy-MM-dd").toStdString();
-        json2["execTime"] = it.execTime.toString("hh:mm:ss").toStdString();
+        json2["execDate"] = it.dateTime.date().toString("yyyy-MM-dd").toStdString();
+        json2["execTime"] = it.dateTime.time().toString("hh:mm:ss").toStdString();
         json2["deviceName"] = it.devName.toStdString();
         json2["actionName"] = it.actionName.toStdString();
         json2["actionID"] = static_cast<int>(it.actionID);
@@ -809,9 +872,9 @@ bool FromWebAPI::getTemplate(QString templateName, QList<ExecPlanItemInfo>& list
             auto tmpDate = it["execDate"].is_null() ? "" : it["execDate"].get<std::string>();
             if(!tmpDate.empty())
             {
-                info.date = QDate::fromString(QString::fromStdString(tmpDate),"yyyy-MM-dd");
+                info.dateTime.setDate(QDate::fromString(QString::fromStdString(tmpDate),"yyyy-MM-dd"));
             }
-            info.execTime = QTime::fromString(QString::fromStdString(it["execTime"].get<std::string>()),"hh:mm:ss");
+            info.dateTime.setTime(QTime::fromString(QString::fromStdString(it["execTime"].get<std::string>()),"hh:mm:ss"));
             info.actionName = QString::fromStdString(it["actionName"].get<std::string>());
             info.actionID = it["actionID"].get<int>();
 

+ 2 - 0
TransmitterSwitch/WebAPI/FromWebAPI.h

@@ -17,6 +17,8 @@ public:
     
     /* 获取设备信息 */
     bool getDeviceInfo(QMap<QString, DeviceInfo>& mapDevice);
+    /* 获取频率信息 */
+    bool getChannelInfo(QMap<int, ChannelInfo>& mapFreq);
 
     /* 将数据写入EQM数据库 */
     bool insertData(QList<ExecPlanItemInfo>& list);

+ 2 - 2
TransmitterSwitch/common/SelectTime/timepartwidget.cpp

@@ -9,7 +9,7 @@
 #include "mytimedelegate.h"
 // #include "lhstylemanager.h"
 // #include "LHQLogApi.h"
-#include "TransmitterSwitchInfo.h"
+#include "UIStyleManager.h"
 
 TimePartWidget::TimePartWidget(QWidget *parent) :
     QWidget(parent),
@@ -106,7 +106,7 @@ void TimePartWidget::ScrollToSelect()
 void TimePartWidget::setQSS()
 {
     // QString appPath = QCoreApplication::applicationDirPath();
-    QString qssPath = EPConfig.getQSSPath() + "/SelectTime/timepartwidget.qss";
+    QString qssPath = EPUIStyle.getQSSPath() + "/SelectTime/timepartwidget.qss";
 
     QFile file(qssPath);
     if(file.open(QFile::ReadOnly))

+ 2 - 4
TransmitterSwitch/common/SelectTime/timewidget.cpp

@@ -7,9 +7,7 @@
 #include <QFile>
 #include "timepartwidget.h"
 #include "shadowwidget.h"
-// #include "lhstylemanager.h"
-// #include "LHQLogApi.h"
-#include "TransmitterSwitchInfo.h"
+#include "UIStyleManager.h"
 
 TimeWidget::TimeWidget(QWidget *parent , ShowType type) :
     QFrame(parent),
@@ -228,7 +226,7 @@ void TimeWidget::setEditLine(int w, int h)
 /* 设置QSS */
 void TimeWidget::setQSS()
 {
-    QString qssPath = EPConfig.getQSSPath() + "/SelectTime/timewidget.qss";
+    QString qssPath = EPUIStyle.getQSSPath() + "/SelectTime/timewidget.qss";
 
     QFile file(qssPath);
     if(file.open(QFile::ReadOnly))

+ 3 - 3
TransmitterSwitch/common/date/calendarwidgetex.cpp

@@ -16,7 +16,7 @@
 #include "PaintHelper/painthelper.h"
 // #include "StyleManager/lhstylemanager.h"
 //#include "utility/utility.h"
-#include "TransmitterSwitchInfo.h"
+#include "UIStyleManager.h"
 
 CalendarWidgetEx::CalendarWidgetEx(QWidget *parent)
     : QCalendarWidget(parent)
@@ -118,11 +118,11 @@ void CalendarWidgetEx::hideNavigatioinButton(bool bPreYear, bool bPreMon, bool b
 /* 设置UI样式,0亮色,1暗色 */
 void CalendarWidgetEx::setUIStyle()
 {
-    if(EPConfig.getUIStyle() == enum_UIStyle::UI_Light)
+    if(EPUIStyle.getUIStyle() == enum_UIStyle::UI_Light)
     {
         m_style = 0;
     }
-    else if(EPConfig.getUIStyle() == enum_UIStyle::UI_Dark)
+    else if(EPUIStyle.getUIStyle() == enum_UIStyle::UI_Dark)
     {
         m_style = 1;
     }

+ 185 - 560
TransmitterSwitch/transmitterswitch.cpp

@@ -7,24 +7,24 @@
 #include <QList>
 #include <memory>
 #include <QLayout>
-// #include <qlist.h>
-// #include <qstringliteral.h>
+
 
 #include "LHQLogAPI.h"
 #include "widgetitems.h"
-#include "UserData/pBtnUserData.h"
-#include "AddItem/addnormalitem.h"
-#include "AddItem/addspecialitem.h"
+#include "pBtnUserData2.h"
 #include "WebAPI/FromWebAPI.h"
 #include "TransmitterSwitchInfo.h"
-#include "oneitem.h"
-#include "ItemData.h"
 #include "timewidget.h"
 #include "cdate.h"
 #include "savetotemplate.h"
 #include "importtemplate.h"
 #include "warning.h"
 #include "tipwidget.h"
+#include "UIStyleManager.h"
+#include "PlanData.h"
+#include "PlanCard.h"
+
+
 
 TransmitterSwitch::TransmitterSwitch(QWidget *parent) :
     QWidget(parent),
@@ -43,40 +43,40 @@ TransmitterSwitch::TransmitterSwitch(QWidget *parent) :
 
     /* 设置“默认计划”按钮可点击 */
     ui->pBtn_defaultPlan->setCheckable(true);
-    /* 创建一周8天的页面 */
-    createWeekWidget();
+    ui->pBtn_allFrequency->setCheckable(true);
+    connect(ui->pBtn_allFrequency, &QPushButton::clicked, this, &TransmitterSwitch::do_selectFrequencyBtn);
+    
 
     /* 设置提示文本 */
     m_tipText = new QLabel(this);
     m_tipText->resize(936,56);
-    m_tipText->move(456,8);
     m_tipText->setObjectName("label_TipText");
     m_tipText->setText(R"(按时刻执行模式:即以时刻点为单位进行执行,若某日既为普通日和特殊日,在某一时刻皆有执行动作,将优先执行特殊日在此时刻所计划的动作。
 按天执行模式:即以天为单位进行执行,若某日既为普通日和特殊日,则当日一整天优先执行特殊日所计划的动作,普通日计划当日不再执行。)");
     m_tipText->hide();
+    QPoint pos = ui->label_Tip->mapTo(this, ui->label_Tip->pos());
+    m_tipText->move(pos.x() + 2, pos.y() + 2 );     /* 去掉阴影的宽度和高度 */
     ui->label_Tip->installEventFilter(this);
 
     /* 设置默认值 */
     ui->pBtn_defaultPlan->setChecked(true);
     ui->rBtn_moment->setChecked(true);
-    /* 获取今天是周几,设置周几页面 */
-    int day = QDate::currentDate().dayOfWeek() - 1;
-    m_vecWeeks[day]->setChecked(true);
-    ui->stackedWidget_items->setCurrentIndex(day);
+
 
     /* 连接信号和槽 */
     connect(ui->pBtn_addPlan, &QPushButton::clicked, this, &TransmitterSwitch::do_pBtnAddExecPlan);
     connect(ui->pBtn_importPlan, &QPushButton::clicked, this, &TransmitterSwitch::do_importData);
     connect(ui->pBtn_exportPlan, &QPushButton::clicked, this, &TransmitterSwitch::do_exportData);
     connect(ui->pBtn_clearPlan, &QPushButton::clicked, this, &TransmitterSwitch::do_clearCurrentPage);
-    connect(ui->pBtn_savePlan, &QPushButton::clicked, this, &TransmitterSwitch::do_pBtn_savePlan);
-    connect(ui->pBtn_getPlan, &QPushButton::clicked, this, &TransmitterSwitch::do_pBtn_getPlan);
 
     /* 设置QSS */
-    // LHStyleManager::Instance()->AddWidget(this);
-    connect(&EPConfig, &ExecPlanGlobalConfig::signal_qssChanged, this, &TransmitterSwitch::do_setUIStyle);
+    connect(&EPUIStyle, &UIStyleManager::signal_qssChanged, this, &TransmitterSwitch::do_setUIStyle);
     /* 设置默认的皮肤 */
-    EPConfig.setUIStyle(enum_UIStyle::UI_Light);
+    EPUIStyle.setUIStyle(enum_UIStyle::UI_Dark);
+
+    /* 设置默认点击的按钮 */
+    ui->pBtn_allFrequency->setChecked(true);
+
 }
 
 TransmitterSwitch::~TransmitterSwitch()
@@ -100,10 +100,10 @@ void TransmitterSwitch::setQSSPath(const QString &qssPath)
     /* 去掉最后的“/” */
     // if(qssPath.endsWith("/"))
     // {
-    //     EPConfig.setQSSPath(qssPath.left(qssPath.length() - 1));
+    //     EPUIStyle.setQSSPath(qssPath.left(qssPath.length() - 1));
     // } else
     // {
-    //     EPConfig.setQSSPath(qssPath);
+    //     EPUIStyle.setQSSPath(qssPath);
     // }
 }
 
@@ -128,25 +128,23 @@ void TransmitterSwitch::setWebAPIInfo(const QString &url, const QString &serverI
     m_fromWebAPI->initWebApi(url, serverID, serverKey);
     /* 获取支持的设备 */
     m_fromWebAPI->getDeviceInfo(DeviceContainer.getMapDevice());
+    m_fromWebAPI->getChannelInfo(ChnContainer.getMapChannel());
+
+    /* 创建获取到的卡片信息 */
+    createAllCard();
 }
 
 /* 初始化webAPI,重载版 */
 void TransmitterSwitch::setWebAPIInfo(const InitData& data)
 {
-    if(m_fromWebAPI == nullptr)
-    {
-        m_fromWebAPI = new FromWebAPI;
-    }
-    m_fromWebAPI->initWebApi(data.url, data.serverID, data.serverKey);
-    /* 获取支持的设备 */
-    m_fromWebAPI->getDeviceInfo(DeviceContainer.getMapDevice());
+    setWebAPIInfo(data.url, data.serverID, data.serverKey);
 }
 
 /* 获取EQM数据库计划 */
 void TransmitterSwitch::getExecPlanFromEQM()
 {
     /* 清空本地的计划数据 */
-    IData.clearAllItem();
+
 
     /* 获取页面的配置信息 */
     if(m_fromWebAPI->getConfigData(CfgData.getMapConfigData()))
@@ -188,23 +186,16 @@ void TransmitterSwitch::getExecPlanFromEQM()
     /* 添加计划项 */
     for(const auto& it : list)
     {
-        if (it.WeekDay < 8 && it.WeekDay >= 1)
-        {
-            addNormalOneItem(it.WeekDay - 1, it.devName, it.actionID, it.execTime);
-        }
-        else if(it.WeekDay == 8)
-        {
-            addSpecialOneItem(it.WeekDay - 1, it.devName, it.actionID, it.date, it.execTime);
-        }
+        
     }
     /* 排序 */
     for(int i = 0; i < 8; ++i)
     {
-        sortLayout(i);
+        
     }
     /* 获取数据插入到全局变量中,会将更新标志位置true,这里需要手动置为false */
-    IData.setUpdate(false);
 
+    
     /* 调用回调函数 */
     if(m_trackCB != nullptr)
     {
@@ -225,21 +216,21 @@ void TransmitterSwitch::saveExecPlanToEQM()
     {
         execType = 1;
     }
-    for(const auto& it : IData.getMapItem())
-    {
-        for(const auto& it1 : *it)
-        {
-            ExecPlanItemInfo info;
-            info.ExecType = execType;
-            info.devName = it1->getDevName();
-            info.actionID = it1->getActionNum();
-            info.actionName = it1->getActionName();
-            info.execTime = it1->getExecTime();
-            info.date = it1->getDate();
-            info.WeekDay = it1->getWeekDay() + 1;
-            list.push_back(info);
-        }
-    }
+    // for(const auto& it : IData.getMapItem())
+    // {
+    //     for(const auto& it1 : *it)
+    //     {
+    //         ExecPlanItemInfo info;
+    //         info.ExecType = execType;
+    //         info.devName = it1->getDevName();
+    //         info.actionID = it1->getActionNum();
+    //         info.actionName = it1->getActionName();
+    //         info.execTime = it1->getExecTime();
+    //         info.date = it1->getDate();
+    //         info.WeekDay = it1->getWeekDay() + 1;
+    //         list.push_back(info);
+    //     }
+    // }
     /* 写入数据库 */
     if(m_fromWebAPI->insertData(list))
     {
@@ -268,10 +259,10 @@ void TransmitterSwitch::saveExecPlanToEQM()
         config3.key = static_cast<int>(enum_ExecPlanConfig::IsChanged);
     }
     /* 只要数据库和本地更新标志位有一个为true,说明还未被读走,则设置标志位为true */
-    if((config3.value == 1) || IData.isUpdate())
-    {
-        config3.value = 1;
-    }
+    // if((config3.value == 1) || IData.isUpdate())
+    // {
+    //     config3.value = 1;
+    // }
     config3.updateTime = QDateTime::currentDateTime();
     CfgData.updateConfigData(config3);
 
@@ -291,11 +282,11 @@ void TransmitterSwitch::setUIStyle(int style)
 {
     if(style == 0)
     {
-        EPConfig.setUIStyle(enum_UIStyle::UI_Light);
+        EPUIStyle.setUIStyle(enum_UIStyle::UI_Light);
     }
     else if(style == 1)
     {
-        EPConfig.setUIStyle(enum_UIStyle::UI_Dark);
+        EPUIStyle.setUIStyle(enum_UIStyle::UI_Dark);
     }else {
         LH_WRITE_ERROR(QString("错误的样式类型: %1").arg(style));
     }
@@ -312,332 +303,74 @@ void TransmitterSwitch::setTrackCallBack(trackCallBack cb)
 }
 
 
-/* 每周几的按钮点击了,设置stackedWidegt页面 */
-void TransmitterSwitch::do_weekpBtn_clicked()
-{
-    auto pBtn = qobject_cast<QPushButton*>(sender());
-    /* 清除所有选中效果 */
-    for(const auto& it : m_vecWeeks)
-    {
-        if(it != pBtn)
-        {
-            it->setChecked(false);
-        }
-    }
-    pBtn->setChecked(true);
-    auto userData = pBtn->userData(0);
-    auto pBtnUserData = static_cast<PBtnUserData*>(userData);
-    if(pBtnUserData == nullptr)
-    {
-        return;
-    }
-    int index = pBtnUserData->getIndex();
-    ui->stackedWidget_items->setCurrentIndex(index);
-}
-
-
 /* 点击了添加计划按钮 */
 void TransmitterSwitch::do_pBtnAddExecPlan()
 {
-    /* 创建页面,判断是正常日还是特殊日 */
-    if(ui->stackedWidget_items->currentIndex() < 7)
-    {
-        std::shared_ptr<AddNormalItem> atf = std::make_shared<AddNormalItem>(this);
-        atf->setParentPointer(this);
-        atf->setQSS(EPConfig.getQSSPath());
-        /* 设置可选项 */
-        atf->setDevice(DeviceContainer.getMapDevice());
-        /* 设置是周几 */
-        int weekDay = ui->stackedWidget_items->currentIndex();
-        atf->setWeekDay(weekDay);
-        atf->exec();
-        /* 判断是否需要添加计划 */
-        if(atf->isAddDev())
-        {
-            /* 添加计划 */
-            addNormalOneItem(weekDay, atf->getDevName(), atf->getActionID(), atf->getTime());
-        }
-    }
-    else
-    {
-        /* 特殊日 */
-        std::shared_ptr<AddSpecialItem> atf = std::make_shared<AddSpecialItem>(this);
-        atf->setParentPointer(this);
-        atf->setQSS(EPConfig.getQSSPath());
-        /* 设置可选项 */
-        atf->setDevice(DeviceContainer.getMapDevice());
-        /* 设置是周几 */
-        int weekDay = ui->stackedWidget_items->currentIndex();
-        atf->setWeekDay(weekDay);
-        atf->exec();
-        /* 判断是否需要添加计划 */
-        if(atf->isAddDev())
-        {
-            /* 添加计划 */
-            addSpecialOneItem(weekDay, atf->getDevName(), atf->getActionID(), atf->getDate(), atf->getTime());
-        }
-    }
-    /* 排序 */
-    sortLayout(ui->stackedWidget_items->currentIndex());
-}
-
-
-/* 删除一项正常日计划 */
-void TransmitterSwitch::do_deleteOneItem(int week, int index)
-{
-    /* 删除该项 */
-    IData.deleteOneItem(week, index);
-    /* 重新排序 */
-    sortLayout(week);
-}
-
-/* 一个计划修改了设备 */
-void TransmitterSwitch::do_changeDev()
-{
-    /* 判断修改设备后时间是否冲突 */
-    auto one = qobject_cast<OneItem*>(sender());
-    if(one == nullptr)
-    {
-        return;
-    }
-    if(one->getWeekDay() > 0 && one->getWeekDay() < 7)
-    {
-        if(IData.judgeTimeRepetitionWithEdit(one->getWeekDay(), one, one->getExecTime()))
-        {
-            /* 设置时间报警 */
-            one->setWarningText("设备执行时间冲突", -1);
-            return;
-        }
-    }
-    else if(one->getWeekDay() == 7)
-    {
-        if(IData.judgeDateTimeRepetitionWithEdit(one->getWeekDay(), one, one->getDate(), one->getExecTime()))
-        {
-            /* 设置时间报警 */
-            one->setWarningText("设备执行日期时间冲突", -1);
-            return;
-        }
-    }
-    /* 取消报警 */
-    one->hideWarn();
-    /* 设置更新标志位 */
-    IData.setUpdate(true);
-}
-
-/* 点击修改执行时间 */
-void TransmitterSwitch::do_editExecTime(QTime t)
-{
-    /* 获取信号发送者 */
-    auto one = qobject_cast<OneItem*>(sender());
-    /* 创建时间选择控件 */
-    std::shared_ptr<TimeWidget> tw = std::make_shared<TimeWidget>(this, TimeWidget::ShowType::Dialog);
-    /* 设置图标 */
-    tw->setIcon(":/ICON/ICON/Time.png");
-    tw->setIconShow(true);
-    tw->setIconSize(16, 16);
-    /* 重新设置大小 */
-    tw->setEditLine(one->getExecTimeSize().width(), one->getExecTimeSize().height());
-    /* 设置选择框大小 */
-    tw->setTimeAreaWidth(140);
-    /* 移动位置,覆盖显示时间的按钮,获取的坐标是相对于Dialog的位置 */
-    auto pos = one->mapTo(this, one->getExecTimePos());
-    pos.setX(pos.x() - 1);     /* 去掉阴影的宽度 */
-    pos.setY(pos.y());     /* 去掉阴影的高度 */
-    tw->move(pos);
-    /* 设置默认的时间 */
-    tw->setTime(t);
-
-    tw->execShow();
-    auto time = tw->getTime();
-    /* 判断时间有没有修改 */
-    if(time == t)
-    {
-        return;
-    }
-    LH_WRITE_LOG_DEBUG(QString("选择时间:%1").arg(time.toString("hh:mm:ss")));
-    one->setExecTime(time);
-    /* 判断时间是否重复 */
-    if(IData.judgeTimeRepetitionWithEdit(one->getWeekDay(), one, time))
-    {
-        /* 设置时间报警 */
-        one->setWarningText("设备执行时间冲突", -1);
-        return;
-    }
-    /* 取消报警 */
-    one->hideWarn();
-    /* 重新排序 */
-    sortLayout(one->getWeekDay());
-    /* 设置更新标志位 */
-    IData.setUpdate(true);
+    
 }
 
 
-/* 点击修改日期 */
-void TransmitterSwitch::do_editExecDate(QDate d)
-{
-    /* 获取信号发送者 */
-    auto one = qobject_cast<OneItem*>(sender());
-    /* 创建时间选择控件 */
-    // std::shared_ptr<CDate> cd = std::make_shared<CDate>(this);
-
-    // /* 移动位置,日历弹窗没有编辑栏,只有选择日历的时间,日历弹窗自带16px的阴影 */
-    // auto pos = one->mapTo(this, one->getExecDatePos());
-    // pos.setY(pos.y() + 32);     /* 去掉时间显示栏的高度 */
-    // pos.setX(pos.x() - 16);     /* 去掉阴影的宽度 */
-
-    // cd->move(pos);
-    // /* 设置默认的日期 */
-    // cd->setDate(d);
-
-    // cd->execShow();
-    // /* 获取日期 */
-    // auto date = cd->getDate();
-    // LH_WRITE_LOG_DEBUG(QString("选择日期:%1").arg(date.toString("yyyy-MM-dd")));
-    // /* 判断日期有没有修改 */
-    // if(date == d)
-    // {
-    //     return;
-    // }
 
-    one->setDate(d);
-    /* 判断日期时间是否重复 */
-    if(IData.judgeDateTimeRepetitionWithEdit(one->getWeekDay(), one, d, one->getExecTime()))
-    {
-        /* 设置时间报警 */
-        one->setWarningText("设备执行日期时间冲突", -1);
-        return;
-    }
-    /* 取消报警 */
-    one->hideWarn();
-    /* 重新排序 */
-    sortLayout(one->getWeekDay());
-
-    /* 设置更新标志位 */
-    IData.setUpdate(true);
-}
 
-/* 修改了一个动作 */
-void TransmitterSwitch::do_editAction()
-{
-    /* 设置更新标志位 */
-    IData.isUpdate();
-}
 
 /* 导入数据 */
 void TransmitterSwitch::do_importData()
 {
-    /* 获取当前周几 */
-    int weekDay = ui->stackedWidget_items->currentIndex();
-
-    QMap<QString, int> tabList;
-    m_fromWebAPI->getTemplateList(tabList);
-    int type = 0;
-    if(weekDay >=0 && weekDay < 7)
-    {
-        type = 0;
-    }else if(weekDay == 7)
-    {
-        type = 1;
-    }
-    std::shared_ptr<ImportTemplate> itf = std::make_shared<ImportTemplate>(tabList, type, this);
-    itf->setQSSPath(EPConfig.getQSSPath());
-
-    /* 连接信号和槽 */
-    connect(itf.get(), &ImportTemplate::signal_deleteTemplate, this, &TransmitterSwitch::do_deleteTemplate);
-
-
-    itf->exec();
-    if(itf->isOk())
-    {
-        /* 获取模板名称 */
-        auto name = itf->getTemplateName();
-        /* 获取模板内容 */
-        QList<ExecPlanItemInfo> list;
-        list.clear();
-        if(!m_fromWebAPI->getTemplate(name, list))
-        {
-            return;
-        }
-        /* 清除当前页内容 */
-        IData.clearOneDay(weekDay);
-        /* 添加计划项 */
-        if (weekDay < 7 && weekDay >= 0)
-        {
-            for(const auto& it : list)
-            {
-                // LH_WRITE_LOG_DEBUG(QString("DevName:%1, ExecTime:%2").arg(it.devName).arg(it.execTime.toString("hh:mm:ss")));
-                addNormalOneItem(weekDay, it.devName, it.actionID, it.execTime);
-            }
-        }else if (weekDay == 7)
-        {
-            for(const auto& it : list)
-            {
-                addSpecialOneItem(weekDay, it.devName, it.actionID, it.date, it.execTime);
-            }
-        }
-        /* 排序 */
-        sortLayout(weekDay);
-
-        /* 调用回调函数 */
-        if(m_trackCB != nullptr)
-        {
-            m_trackCB(4, g_mapTrack.value(4));
-        }
-    }
+    
 }
 
 /* 导出数据 */
 void TransmitterSwitch::do_exportData()
 {
-    /* 先获取所有的模板名称 */
-    QMap<QString, int> tabList;
-    m_fromWebAPI->getTemplateList(tabList);
-    /* 弹出导出页面 */
-    std::shared_ptr<SaveToTemplate> stt = std::make_shared<SaveToTemplate>(this);
-    stt->setQSS(EPConfig.getQSSPath());
-    /* 注册事件过滤器 */
-    stt->installEventFilter(this);
-    int weekDay = ui->stackedWidget_items->currentIndex();
-    /* 设置周几 */
-    stt->setWeekDay(weekDay);
-    /* 判断当前页是否有计划 */
-    if(IData.getOneDay(weekDay)->size() == 0)
-    {
-        stt->setItemEmpty(true);
-    }else
-    {
-        stt->setItemEmpty(false);
-    }
-    /* 判断当前是正常日还是特殊日 */
-    int type = -1;
-    if(weekDay < 7 && weekDay >= 0)
-    {
-        type = 0;
-    }else if(weekDay == 7)
-    {
-        type = 1;
-    }
-    /* 获取所有的模板名称,并设置 */
-    stt->setTemplateName(tabList, type);
+    // /* 先获取所有的模板名称 */
+    // QMap<QString, int> tabList;
+    // m_fromWebAPI->getTemplateList(tabList);
+    // /* 弹出导出页面 */
+    // std::shared_ptr<SaveToTemplate> stt = std::make_shared<SaveToTemplate>(this);
+    // stt->setQSS(EPUIStyle.getQSSPath());
+    // /* 注册事件过滤器 */
+    // stt->installEventFilter(this);
+    // int weekDay = ui->stackedWidget_items->currentIndex();
+    // /* 设置周几 */
+    // stt->setWeekDay(weekDay);
+    // /* 判断当前页是否有计划 */
+    // if(IData.getOneDay(weekDay)->size() == 0)
+    // {
+    //     stt->setItemEmpty(true);
+    // }else
+    // {
+    //     stt->setItemEmpty(false);
+    // }
+    // /* 判断当前是正常日还是特殊日 */
+    // int type = -1;
+    // if(weekDay < 7 && weekDay >= 0)
+    // {
+    //     type = 0;
+    // }else if(weekDay == 7)
+    // {
+    //     type = 1;
+    // }
+    // /* 获取所有的模板名称,并设置 */
+    // stt->setTemplateName(tabList, type);
 
-    stt->exec();
-    if(stt->isOk())
-    {
-        /* 获取一天的数据 */
-        auto list = IData.getOneDayExecPlan(weekDay);
-        /* 保存到模板 */
-        if(m_fromWebAPI->saveTemplate(stt->getTemplateName(), type, list))
-        {
-            TipWidget::display(TipWidget::OPERATOR_OK, "保存模版成功", this);
-        }else {
-            TipWidget::display(TipWidget::OPERATOR_FAIL, "保存模版失败", this);
-        }
-        /* 调用回调函数 */
-        if(m_trackCB != nullptr)
-        {
-            m_trackCB(3, g_mapTrack.value(3));
-        }
-    }
+    // stt->exec();
+    // if(stt->isOk())
+    // {
+    //     /* 获取一天的数据 */
+    //     auto list = IData.getOneDayExecPlan(weekDay);
+    //     /* 保存到模板 */
+    //     if(m_fromWebAPI->saveTemplate(stt->getTemplateName(), type, list))
+    //     {
+    //         TipWidget::display(TipWidget::OPERATOR_OK, "保存模版成功", this);
+    //     }else {
+    //         TipWidget::display(TipWidget::OPERATOR_FAIL, "保存模版失败", this);
+    //     }
+    //     /* 调用回调函数 */
+    //     if(m_trackCB != nullptr)
+    //     {
+    //         m_trackCB(3, g_mapTrack.value(3));
+    //     }
+    // }
 }
 
 /* 清空当前页计划 */
@@ -645,7 +378,7 @@ void TransmitterSwitch::do_clearCurrentPage()
 {
     /* 跳出弹窗警告 */
     Warning w(this);
-    w.setQSS(EPConfig.getQSSPath());
+    w.setQSS(EPUIStyle.getQSSPath());
     w.setText("是否清空当前页计划?");
     bool flag = false;
     connect(&w,&Warning::signal_ok,this,[&](){
@@ -656,10 +389,10 @@ void TransmitterSwitch::do_clearCurrentPage()
     {
         return;
     }
-    int weekDay = ui->stackedWidget_items->currentIndex();
-    IData.clearOneDay(weekDay);
-    sortLayout(weekDay);
-    LH_WRITE_LOG_DEBUG(QString("计划剩余数目:%1").arg(IData.getOneDay(weekDay)->size()));
+    // int weekDay = ui->stackedWidget_items->currentIndex();
+    // IData.clearOneDay(weekDay);
+    // sortLayout(weekDay);
+    // LH_WRITE_LOG_DEBUG(QString("计划剩余数目:%1").arg(IData.getOneDay(weekDay)->size()));
 }
 
 /* 删除一个模板 */
@@ -673,7 +406,7 @@ void TransmitterSwitch::do_pBtn_savePlan()
 {
     /* 跳出弹窗提示 */
     Warning w(this);
-    w.setQSS(EPConfig.getQSSPath());
+    w.setQSS(EPUIStyle.getQSSPath());
     w.setText("将计划保存到数据库?");
     w.exec();
     if(!w.isOk())
@@ -688,7 +421,7 @@ void TransmitterSwitch::do_pBtn_getPlan()
 {
     /* 跳出弹窗提示 */
     Warning w(this);
-    w.setQSS(EPConfig.getQSSPath());
+    w.setQSS(EPUIStyle.getQSSPath());
     w.setText("从数据库获取计划,将清空当前所有的计划,请注意保存当前计划!");
     w.exec();
     if(!w.isOk())
@@ -701,208 +434,98 @@ void TransmitterSwitch::do_pBtn_getPlan()
 /* 切换亮色/暗色外观 */
 void TransmitterSwitch::do_setUIStyle()
 {
-    QString qssPath = EPConfig.getQSSPath() + "/transmitterswitch.qss";
-    QFile file(qssPath);
-    if(file.open(QFile::ReadOnly))
-    {
-        QString qss = file.readAll();
-        this->setStyleSheet(qss);
-        file.close();
-    }else {
-        LH_WRITE_ERROR(QString("打开样式表失败: %1").arg(qssPath));
-    }
+    
+    this->setStyleSheet(EPUIStyle.StrQSS_TransmitterSwitch);
+
+    /* 给所有的按钮设置样式 */
+    ui->pBtn_allFrequency->setStyleSheet(EPUIStyle.StrQSS_PBtnFrequency);
+    // LH_WRITE_LOG(QString("频率按钮设置样式:%1").arg(EPUIStyle.StrQSS_PBtnFrequency));
 }
 
-/* 创建一周8天的item页面 */
-void TransmitterSwitch::createWeekWidget()
+/* 选择了一个频率按钮,取消其他的选择 */
+void TransmitterSwitch::do_selectFrequencyBtn()
 {
-    /* 将8个按钮的指针存入到数组中,方便后续使用 */
-    m_vecWeeks.push_back(ui->pBtn_Monday);
-    m_vecWeeks.push_back(ui->pBtn_Tuesday);
-    m_vecWeeks.push_back(ui->pBtn_Wednesday);
-    m_vecWeeks.push_back(ui->pBtn_Thursday);
-    m_vecWeeks.push_back(ui->pBtn_Friday);
-    m_vecWeeks.push_back(ui->pBtn_Saturday);
-    m_vecWeeks.push_back(ui->pBtn_Sunday);
-    m_vecWeeks.push_back(ui->pBtn_SpecialDay);
-    
-
-    for(const auto& it : m_vecWeeks)
+    /* 获取信号发送者 */
+    auto btn = qobject_cast<QPushButton*>(sender());
+    if(btn == nullptr)
     {
-        /* 设置每周的按钮可点击 */
-        it->setCheckable(true);
-        connect(it,&QPushButton::clicked,this,&TransmitterSwitch::do_weekpBtn_clicked);
+        return;
     }
-    /* 清空stackedWidget页面 */
-    int wcount = ui->stackedWidget_items->count();
-    for(int i = 0; i < wcount; ++i)
+    if(btn != ui->pBtn_allFrequency)
     {
-        auto widgetItems = ui->stackedWidget_items->widget(i);
-        ui->stackedWidget_items->removeWidget(widgetItems);
-        delete widgetItems;
+        ui->pBtn_allFrequency->setChecked(false);
     }
-    /* 创建Widget页面 */
-    for(int i = 0; i < 7; ++i)
+    /* 取消其他按钮的选择 */
+    for(auto& it : m_listFrequencyBtn)
     {
-        auto widgetItems = new WidgetItems(this);
-        m_vecWidgetItems.push_back(widgetItems);
-        ui->stackedWidget_items->addWidget(widgetItems);
-        /* 设置正常日 */
-        widgetItems->setDayType(false);
-        /* 获取layout,这个才是存储item的区域 */
-        auto layout = widgetItems->getLayout();
-        m_vecLayouts.push_back(layout);
-        /* 给按钮设置用户数据 */
-        auto pBtnUserData = new PBtnUserData();
-        pBtnUserData->setData(widgetItems);
-        pBtnUserData->setIndex(i);
-        m_vecWeeks[i]->setUserData(0, pBtnUserData);
+        if(it != btn)
+        {
+            it->setChecked(false);
+        }
     }
-    /* 创建特殊日 */
-    auto widgetItems = new WidgetItems(this);
-    m_vecWidgetItems.push_back(widgetItems);
-    ui->stackedWidget_items->addWidget(widgetItems);
-    /* 设置特殊日 */
-    widgetItems->setDayType(true);
-    /* 获取layout,这个才是存储item的区域 */
-    auto layout = widgetItems->getLayout();
-    m_vecLayouts.push_back(layout);
-    /* 给按钮设置用户数据 */
-    auto pBtnUserData = new PBtnUserData();
-    pBtnUserData->setData(widgetItems);
-    pBtnUserData->setIndex(7);
-    m_vecWeeks[7]->setUserData(0, pBtnUserData);
-
-    // LH_WRITE_LOG("StackedWidget count: " + QString::number(ui->stackedWidget_items->count()));
+    /* 设置当前按钮的选择状态 */
+    btn->setChecked(true);
 }
 
 
-/* 添加一个正常日的计划 */
-void TransmitterSwitch::addNormalOneItem(int week, QString devName, int actionID, QTime execTime)
-{
-    OneItem* one = new OneItem(false);
-    /* 添加可选的设备 */
-    one->addDevice();
-    /* 设置最小高度 */
-    // one->setMinimumHeight(48);
-    one->setDevName(devName);
-    one->setExecTime(execTime);
-    one->setWeekDay(week);
-    one->setActionNum(actionID);
-
-    /* 连接删除项信号,执行时间改变信号 */
-    connect(one, &OneItem::signal_OneItemDelete, this, &TransmitterSwitch::do_deleteOneItem);
-    connect(one, &OneItem::signal_devChanged, this, &TransmitterSwitch::do_changeDev);
-    connect(one, &OneItem::signal_execTimeClicked, this, &TransmitterSwitch::do_editExecTime);
-    connect(one, &OneItem::signal_actionChanged, this, &TransmitterSwitch::do_editAction);
-
-    /* 添加到容器中 */
-    IData.addOneItem(week, one);
-}
 
-/* 添加一项特殊日计划 */
-void TransmitterSwitch::addSpecialOneItem(int week, QString devName, int actionID, QDate date, QTime execTime)
-{
-    OneItem* one = new OneItem(true);
-    /* 添加可选的设备 */
-    one->addDevice();
-    /* 设置最小高度 */
-    // one->setMinimumHeight(48);
-    one->setDevName(devName);
-    one->setDate(date);
-    one->setExecTime(execTime);
-    one->setWeekDay(week);
-    one->setActionNum(actionID);
-
-    /* 连接删除项信号,执行时间改变信号 */
-    connect(one, &OneItem::signal_OneItemDelete, this, &TransmitterSwitch::do_deleteOneItem);
-    connect(one, &OneItem::signal_devChanged, this, &TransmitterSwitch::do_changeDev);
-    connect(one, &OneItem::signal_execTimeClicked, this, &TransmitterSwitch::do_editExecTime);
-    connect(one, &OneItem::signal_dateClicked, this, &TransmitterSwitch::do_editExecDate);
-    connect(one, &OneItem::signal_actionChanged, this, &TransmitterSwitch::do_editAction);
-
-    /* 添加到容器中 */
-    IData.addOneItem(week, one);
-}
 
-/* 重新排序布局 */
-void TransmitterSwitch::sortLayout(int weekDay)
+/* 添加一个频率,包括左侧按钮和右侧卡片 */
+void TransmitterSwitch::createOneCard(const ChannelInfo& chnInfo)
 {
-    if(weekDay < 8 && weekDay >= 0)
-    {
-        sortItemData(weekDay);
-    }
-    /* 重新布局 */
-    sortLayoutUI(weekDay);
+    /* 创建按钮 */
+    QPushButton* pBtn = new QPushButton(this);
+    pBtn->setObjectName(chnInfo.ChannelName);
+    pBtn->setText(chnInfo.ChannelName);
+    pBtn->setCheckable(true);
+    pBtn->setMinimumHeight(40);
+
+    PBtnUserData2* userData = new PBtnUserData2();
+    userData->setChannelInfo(chnInfo);
+    pBtn->setUserData(1, userData);
+
+    /* 设置按钮的样式表 */
+    pBtn->setStyleSheet(EPUIStyle.StrQSS_PBtnFrequency);
+    /* 连接信号和槽 */
+    connect(pBtn, &QPushButton::clicked, this, &TransmitterSwitch::do_selectFrequencyBtn);
+    m_listFrequencyBtn.push_back(pBtn);
+
+    auto vLayout = qobject_cast<QVBoxLayout*>(ui->widget_frequency->layout());
+    /* 减1是去掉最下面的弹簧 */
+    vLayout->insertWidget(vLayout->count() - 1, pBtn);
+
+    /* 创建卡片 */
+    PlanCard* pCard = PData.createOneCard(chnInfo);
+    pCard->setParent(ui->widget_planContent);
+    /* 排序 */
 }
 
-/* 排序正常日 */
-void TransmitterSwitch::sortItemData(int weekDay)
+/* 删除一个频率 */
+void TransmitterSwitch::deleteOneCard(int channelID)
 {
-    /* 获取当前页容器 */
-    auto list = IData.getOneDay(weekDay);
-    // LH_WRITE_LOG_DEBUG(QString("获取到的容器大小:%1").arg(list->size()));
-    if(list == nullptr)
+    /* 删除按钮 */
+    for(auto it = m_listFrequencyBtn.begin(); it != m_listFrequencyBtn.end(); ++it)
     {
-        return;
-    }
-    /* 将当前页,按时间升序排序 */
-    std::sort(list->begin(), list->end(), [&](OneItem* t1, OneItem* t2) 
-    {
-        /* 按照日期排序,再按照名称排序 */
-        if(t1->getDate() < t2->getDate())
+        auto userData = static_cast<PBtnUserData2*>((*it)->userData(1));
+        if(userData != nullptr && userData->getChannelInfo().ChannelID == channelID)
         {
-            return true;
+            delete *it;
+            m_listFrequencyBtn.erase(it);
+            break;
         }
-        else if(t1->getDate() > t2->getDate())
-        {
-            return false;
-        }
-        else
-        {
-            if(t1->getExecTime() < t2->getExecTime())
-            {
-                return true;
-            }
-            else if(t1->getExecTime() > t2->getExecTime())
-            {
-                return false;
-            }else
-            {
-                return t1->getDevName() < t2->getDevName();
-            }
-        }
-    });
-    /* 设置序号 */
-    int num1 = 1;
-    for(auto& it : *list)
-    {
-        it->setNum(num1);
-        num1++;
     }
-}
 
+    /* 删除卡片 */
+    PData.deleteOneCard(channelID);
+}
 
-/* 重新布局项 */
-void TransmitterSwitch::sortLayoutUI(int weekDay)
+/* 创建所有频率卡片 */
+void TransmitterSwitch::createAllCard()
 {
-    /* 获取数据列表和layout */
-    auto listItem = IData.getOneDay(weekDay);
-    if(listItem == nullptr)
-    {
-        return;
-    }
-    auto layout = m_vecLayouts[weekDay];
-    /* 刷新UI,先清空layout中的所有控件,就是将item的父指针设置为0 */
-    int num1 = 0;
-    for(auto& it : *listItem)
+    for(const auto& it : ChnContainer.getMapChannel())
     {
-        it->setParent(nullptr);
-    }
-    /* 将item重新加入到layout中 */
-    for(auto& it : *listItem)
-    {
-        layout->addWidget(it);
+        /* 创建一个按钮和卡片 */
+        createOneCard(it);
     }
 }
 
@@ -923,15 +546,17 @@ bool TransmitterSwitch::eventFilter(QObject *watched, QEvent *event)
     return QWidget::eventFilter(watched,event);
 }
 
-/* 鼠标点击事件 */
-// void TransmitterSwitch::mousePressEvent(QMouseEvent *event)
-// {
-//     if(event->button() == Qt::LeftButton)
-//     {
-//         LH_WRITE_LOG("鼠标点击了");
-//     }
-//     QWidget::mousePressEvent(event);
-// }
 
+/* 窗口缩放事件 */
+void TransmitterSwitch::resizeEvent(QResizeEvent *event)
+{
+    /* 设置提示文本的位置 */
+    // if(m_tipText != nullptr)
+    // {
+    //     QPoint pos = ui->label_Tip->mapTo(this, ui->label_Tip->pos());
+    //     m_tipText->move(pos.x() + 2, pos.y() + 2 );
+    // }
+    QWidget::resizeEvent(event);
+}
 
 

+ 16 - 29
TransmitterSwitch/transmitterswitch.h

@@ -9,6 +9,7 @@
 class WidgetItems;
 class FromWebAPI;
 struct InitData;
+struct ChannelInfo;
 
 /* 回调函数 */
 using trackCallBack = void(*)(int actionID, QString strMemo);
@@ -40,21 +41,10 @@ public:
     void setTrackCallBack(trackCallBack cb);
 
 private slots:
-    /* 每周几的按钮点击了,设置stackedWidegt页面 */
-    void do_weekpBtn_clicked();
+
     /* 点击了添加计划按钮 */
     void do_pBtnAddExecPlan();
 
-    /* 删除一项正常日计划 */
-    void do_deleteOneItem(int week, int index);
-    /* 一个计划修改了设备 */
-    void do_changeDev();
-    /* 点击修改执行时间 */
-    void do_editExecTime(QTime t);
-    /* 点击修改日期 */
-    void do_editExecDate(QDate d);
-    /* 修改了一个动作 */
-    void do_editAction();
 
     /* 导入模板 */
     void do_importData();
@@ -72,27 +62,24 @@ private slots:
 
     /* 切换亮色/暗色外观 */
     void do_setUIStyle();
+    /* 选择了一个频率按钮,取消其他的选择 */
+    void do_selectFrequencyBtn();
 
 private:
-    /* 创建一周8天的item页面 */
-    void createWeekWidget();
-    /* 添加一个正常日的计划 */
-    void addNormalOneItem(int week, QString devName, int actionID, QTime execTime);
-    /* 添加一项特殊日计划 */
-    void addSpecialOneItem(int week, QString devName, int actionID, QDate date, QTime execTime);
-
-    /* 重新排序布局 */
-    void sortLayout(int weekDay);
-    /* 排序正常日 */
-    void sortItemData(int weekDay);
-    /* 重新布局项 */
-    void sortLayoutUI(int weekDay);
+
+    /* 添加一个频率,包括左侧按钮和右侧卡片 */
+    void createOneCard(const ChannelInfo& chnInfo);
+    /* 删除一个频率 */
+    void deleteOneCard(int channelID);
+
+    /* 创建所有频率卡片 */
+    void createAllCard();
 
 protected:
     /* 事件过滤器 */
-    bool eventFilter(QObject *watched, QEvent *event);
-    /* 鼠标点击事件 */
-    // void mousePressEvent(QMouseEvent *event);
+    bool eventFilter(QObject *watched, QEvent *event) override;
+    /* 窗口缩放事件 */
+    void resizeEvent(QResizeEvent *event) override;
 
 private:
     Ui::TransmitterSwitch *ui;
@@ -100,7 +87,7 @@ private:
     QLabel* m_tipText = nullptr;            /* 提示文本 */
     QString m_styleSheet;                   /* 样式表 */
 
-    QVector<QPushButton*> m_vecWeeks;       /* 存储一周8天的按钮指针,方便后续操作 */
+    QList<QPushButton*> m_listFrequencyBtn; /* 频率按钮列表 */
     QVector<WidgetItems*> m_vecWidgetItems; /* 存储每周8天的item页面 */
     QVector<QLayout*> m_vecLayouts;         /* 存储每周8天的layout,item都添加到这里面 */
 

+ 283 - 257
TransmitterSwitch/transmitterswitch.ui

@@ -33,16 +33,16 @@
     <widget class="QWidget" name="widget" native="true">
      <layout class="QVBoxLayout" name="verticalLayout_2">
       <property name="spacing">
-       <number>0</number>
+       <number>12</number>
       </property>
       <property name="leftMargin">
-       <number>20</number>
+       <number>0</number>
       </property>
       <property name="topMargin">
        <number>0</number>
       </property>
       <property name="rightMargin">
-       <number>20</number>
+       <number>0</number>
       </property>
       <property name="bottomMargin">
        <number>0</number>
@@ -55,260 +55,210 @@
           <height>76</height>
          </size>
         </property>
-        <widget class="QLabel" name="label_NC1">
-         <property name="geometry">
-          <rect>
-           <x>11</x>
-           <y>27</y>
-           <width>72</width>
-           <height>22</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>默认计划</string>
-         </property>
-        </widget>
-        <widget class="QPushButton" name="pBtn_defaultPlan">
-         <property name="geometry">
-          <rect>
-           <x>84</x>
-           <y>26</y>
-           <width>44</width>
-           <height>24</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string/>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_NC2">
-         <property name="geometry">
-          <rect>
-           <x>168</x>
-           <y>27</y>
-           <width>60</width>
-           <height>22</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>执行模式</string>
-         </property>
-        </widget>
-        <widget class="QRadioButton" name="rBtn_moment">
-         <property name="geometry">
-          <rect>
-           <x>240</x>
-           <y>26</y>
-           <width>74</width>
-           <height>24</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>按时刻</string>
-         </property>
-        </widget>
-        <widget class="QRadioButton" name="rBtn_day">
-         <property name="geometry">
-          <rect>
-           <x>340</x>
-           <y>26</y>
-           <width>74</width>
-           <height>24</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>按天</string>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_Tip">
-         <property name="geometry">
-          <rect>
-           <x>414</x>
-           <y>30</y>
-           <width>16</width>
-           <height>16</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string/>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_X1">
-         <property name="geometry">
-          <rect>
-           <x>0</x>
-           <y>35</y>
-           <width>6</width>
-           <height>12</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>*</string>
-         </property>
-        </widget>
-       </widget>
-      </item>
-      <item>
-       <widget class="QWidget" name="widget_content" native="true">
-        <property name="minimumSize">
+        <property name="maximumSize">
          <size>
-          <width>0</width>
-          <height>529</height>
+          <width>16777215</width>
+          <height>76</height>
          </size>
         </property>
-        <layout class="QHBoxLayout" name="horizontalLayout">
+        <layout class="QHBoxLayout" name="horizontalLayout_2">
          <property name="spacing">
-          <number>1</number>
+          <number>0</number>
          </property>
          <property name="leftMargin">
-          <number>1</number>
+          <number>0</number>
          </property>
          <property name="topMargin">
-          <number>1</number>
+          <number>0</number>
          </property>
          <property name="rightMargin">
-          <number>1</number>
+          <number>0</number>
          </property>
          <property name="bottomMargin">
-          <number>1</number>
+          <number>0</number>
          </property>
          <item>
-          <widget class="QWidget" name="widget_weekpBtn" native="true">
-           <property name="minimumSize">
-            <size>
-             <width>120</width>
-             <height>529</height>
-            </size>
-           </property>
-           <layout class="QVBoxLayout" name="verticalLayout_3">
+          <widget class="QWidget" name="widget_topLeft" native="true">
+           <layout class="QHBoxLayout" name="horizontalLayout_3">
             <property name="spacing">
-             <number>0</number>
+             <number>16</number>
             </property>
             <property name="leftMargin">
-             <number>0</number>
+             <number>20</number>
             </property>
             <property name="topMargin">
-             <number>0</number>
+             <number>11</number>
             </property>
             <property name="rightMargin">
-             <number>1</number>
-            </property>
-            <property name="bottomMargin">
-             <number>0</number>
+             <number>11</number>
             </property>
             <item>
-             <widget class="QPushButton" name="pBtn_Monday">
+             <widget class="QPushButton" name="pBtn_addPlan">
+              <property name="sizePolicy">
+               <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+                <horstretch>0</horstretch>
+                <verstretch>0</verstretch>
+               </sizepolicy>
+              </property>
               <property name="minimumSize">
                <size>
-                <width>120</width>
-                <height>40</height>
+                <width>84</width>
+                <height>32</height>
                </size>
               </property>
               <property name="text">
-               <string>星期一</string>
+               <string>+ 新增</string>
               </property>
              </widget>
             </item>
             <item>
-             <widget class="QPushButton" name="pBtn_Tuesday">
+             <widget class="QPushButton" name="pBtn_editPlan">
+              <property name="sizePolicy">
+               <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+                <horstretch>0</horstretch>
+                <verstretch>0</verstretch>
+               </sizepolicy>
+              </property>
               <property name="minimumSize">
                <size>
-                <width>0</width>
-                <height>40</height>
+                <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>
+               <string>修改</string>
               </property>
              </widget>
             </item>
             <item>
-             <widget class="QPushButton" name="pBtn_Wednesday">
+             <widget class="QPushButton" name="pBtn_deletePlan">
               <property name="minimumSize">
                <size>
-                <width>0</width>
-                <height>40</height>
+                <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>
+               <string>删除</string>
               </property>
              </widget>
             </item>
             <item>
-             <widget class="QPushButton" name="pBtn_Thursday">
+             <widget class="QPushButton" name="pBtn_cloneToOther">
               <property name="minimumSize">
                <size>
-                <width>0</width>
-                <height>40</height>
+                <width>144</width>
+                <height>32</height>
+               </size>
+              </property>
+              <property name="maximumSize">
+               <size>
+                <width>144</width>
+                <height>32</height>
                </size>
               </property>
               <property name="text">
-               <string>星期四</string>
+               <string>复制到其他发射机</string>
               </property>
              </widget>
             </item>
             <item>
-             <widget class="QPushButton" name="pBtn_Friday">
+             <widget class="QPushButton" name="pBtn_importPlan">
               <property name="minimumSize">
                <size>
-                <width>0</width>
-                <height>40</height>
+                <width>88</width>
+                <height>32</height>
+               </size>
+              </property>
+              <property name="maximumSize">
+               <size>
+                <width>88</width>
+                <height>32</height>
                </size>
               </property>
               <property name="text">
-               <string>星期五</string>
+               <string>导入模板</string>
               </property>
              </widget>
             </item>
             <item>
-             <widget class="QPushButton" name="pBtn_Saturday">
+             <widget class="QPushButton" name="pBtn_exportPlan">
               <property name="minimumSize">
                <size>
-                <width>0</width>
-                <height>40</height>
+                <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>
+               <string>保存为模版</string>
               </property>
              </widget>
             </item>
             <item>
-             <widget class="QPushButton" name="pBtn_Sunday">
+             <widget class="QPushButton" name="pBtn_clearPlan">
               <property name="minimumSize">
                <size>
-                <width>0</width>
-                <height>40</height>
+                <width>88</width>
+                <height>32</height>
+               </size>
+              </property>
+              <property name="maximumSize">
+               <size>
+                <width>88</width>
+                <height>32</height>
                </size>
               </property>
               <property name="text">
-               <string>星期日</string>
+               <string>清空计划</string>
               </property>
              </widget>
             </item>
             <item>
-             <widget class="QPushButton" name="pBtn_SpecialDay">
+             <widget class="QPushButton" name="pBtn_refresh">
               <property name="minimumSize">
                <size>
-                <width>0</width>
-                <height>40</height>
+                <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>
+               <string>刷新</string>
               </property>
              </widget>
             </item>
             <item>
-             <spacer name="verticalSpacer_2">
+             <spacer name="horizontalSpacer">
               <property name="orientation">
-               <enum>Qt::Vertical</enum>
+               <enum>Qt::Horizontal</enum>
               </property>
               <property name="sizeHint" stdset="0">
                <size>
-                <width>20</width>
-                <height>206</height>
+                <width>40</width>
+                <height>20</height>
                </size>
               </property>
              </spacer>
@@ -317,122 +267,198 @@
           </widget>
          </item>
          <item>
-          <widget class="QStackedWidget" name="stackedWidget_items"/>
+          <widget class="QWidget" name="widget_topRight" native="true">
+           <property name="minimumSize">
+            <size>
+             <width>500</width>
+             <height>0</height>
+            </size>
+           </property>
+           <widget class="QLabel" name="label_X1">
+            <property name="geometry">
+             <rect>
+              <x>16</x>
+              <y>33</y>
+              <width>10</width>
+              <height>10</height>
+             </rect>
+            </property>
+            <property name="text">
+             <string>*</string>
+            </property>
+           </widget>
+           <widget class="QLabel" name="label_NC1">
+            <property name="geometry">
+             <rect>
+              <x>28</x>
+              <y>27</y>
+              <width>96</width>
+              <height>22</height>
+             </rect>
+            </property>
+            <property name="text">
+             <string>是否开启计划</string>
+            </property>
+           </widget>
+           <widget class="QPushButton" name="pBtn_defaultPlan">
+            <property name="geometry">
+             <rect>
+              <x>132</x>
+              <y>26</y>
+              <width>44</width>
+              <height>24</height>
+             </rect>
+            </property>
+            <property name="text">
+             <string/>
+            </property>
+           </widget>
+           <widget class="QLabel" name="label_NC2">
+            <property name="geometry">
+             <rect>
+              <x>218</x>
+              <y>27</y>
+              <width>60</width>
+              <height>22</height>
+             </rect>
+            </property>
+            <property name="text">
+             <string>执行模式</string>
+            </property>
+           </widget>
+           <widget class="QRadioButton" name="rBtn_moment">
+            <property name="geometry">
+             <rect>
+              <x>284</x>
+              <y>26</y>
+              <width>74</width>
+              <height>24</height>
+             </rect>
+            </property>
+            <property name="text">
+             <string>按时刻</string>
+            </property>
+           </widget>
+           <widget class="QRadioButton" name="rBtn_day">
+            <property name="geometry">
+             <rect>
+              <x>374</x>
+              <y>26</y>
+              <width>74</width>
+              <height>24</height>
+             </rect>
+            </property>
+            <property name="text">
+             <string>按天</string>
+            </property>
+           </widget>
+           <widget class="QLabel" name="label_Tip">
+            <property name="geometry">
+             <rect>
+              <x>464</x>
+              <y>30</y>
+              <width>16</width>
+              <height>16</height>
+             </rect>
+            </property>
+            <property name="text">
+             <string/>
+            </property>
+           </widget>
+          </widget>
          </item>
         </layout>
        </widget>
       </item>
       <item>
-       <widget class="QWidget" name="widget_bottom" native="true">
+       <widget class="QWidget" name="widget_content" native="true">
         <property name="minimumSize">
          <size>
           <width>0</width>
-          <height>70</height>
+          <height>529</height>
          </size>
         </property>
-        <widget class="QPushButton" name="pBtn_addPlan">
-         <property name="geometry">
-          <rect>
-           <x>16</x>
-           <y>16</y>
-           <width>96</width>
-           <height>36</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>添加计划</string>
-         </property>
-        </widget>
-        <widget class="QPushButton" name="pBtn_clearPlan">
-         <property name="geometry">
-          <rect>
-           <x>128</x>
-           <y>16</y>
-           <width>96</width>
-           <height>36</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>清空计划</string>
-         </property>
-        </widget>
-        <widget class="QPushButton" name="pBtn_importPlan">
-         <property name="geometry">
-          <rect>
-           <x>241</x>
-           <y>16</y>
-           <width>96</width>
-           <height>36</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>导入模板</string>
-         </property>
-        </widget>
-        <widget class="QPushButton" name="pBtn_exportPlan">
-         <property name="geometry">
-          <rect>
-           <x>353</x>
-           <y>16</y>
-           <width>110</width>
-           <height>36</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>保存为模版</string>
+        <layout class="QHBoxLayout" name="horizontalLayout">
+         <property name="spacing">
+          <number>20</number>
          </property>
-        </widget>
-       </widget>
-      </item>
-      <item>
-       <widget class="QWidget" name="widget_bottom2" native="true">
-        <property name="minimumSize">
-         <size>
-          <width>0</width>
-          <height>70</height>
-         </size>
-        </property>
-        <widget class="QPushButton" name="pBtn_savePlan">
-         <property name="geometry">
-          <rect>
-           <x>16</x>
-           <y>16</y>
-           <width>96</width>
-           <height>36</height>
-          </rect>
+         <property name="leftMargin">
+          <number>20</number>
          </property>
-         <property name="text">
-          <string>保存计划</string>
+         <property name="topMargin">
+          <number>20</number>
          </property>
-        </widget>
-        <widget class="QPushButton" name="pBtn_getPlan">
-         <property name="geometry">
-          <rect>
-           <x>128</x>
-           <y>16</y>
-           <width>96</width>
-           <height>36</height>
-          </rect>
+         <property name="rightMargin">
+          <number>20</number>
          </property>
-         <property name="text">
-          <string>获取计划</string>
+         <property name="bottomMargin">
+          <number>20</number>
          </property>
-        </widget>
+         <item>
+          <widget class="QWidget" name="widget_frequency" native="true">
+           <property name="minimumSize">
+            <size>
+             <width>224</width>
+             <height>529</height>
+            </size>
+           </property>
+           <property name="maximumSize">
+            <size>
+             <width>224</width>
+             <height>16777215</height>
+            </size>
+           </property>
+           <layout class="QVBoxLayout" name="verticalLayout_3">
+            <property name="spacing">
+             <number>0</number>
+            </property>
+            <property name="leftMargin">
+             <number>0</number>
+            </property>
+            <property name="topMargin">
+             <number>0</number>
+            </property>
+            <property name="rightMargin">
+             <number>1</number>
+            </property>
+            <property name="bottomMargin">
+             <number>0</number>
+            </property>
+            <item>
+             <widget class="QPushButton" name="pBtn_allFrequency">
+              <property name="minimumSize">
+               <size>
+                <width>120</width>
+                <height>40</height>
+               </size>
+              </property>
+              <property name="text">
+               <string>全部频率</string>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <spacer name="verticalSpacer_2">
+              <property name="orientation">
+               <enum>Qt::Vertical</enum>
+              </property>
+              <property name="sizeHint" stdset="0">
+               <size>
+                <width>20</width>
+                <height>206</height>
+               </size>
+              </property>
+             </spacer>
+            </item>
+           </layout>
+          </widget>
+         </item>
+         <item>
+          <widget class="QWidget" name="widget_planContent" native="true"/>
+         </item>
+        </layout>
        </widget>
       </item>
-      <item>
-       <spacer name="verticalSpacer">
-        <property name="orientation">
-         <enum>Qt::Vertical</enum>
-        </property>
-        <property name="sizeHint" stdset="0">
-         <size>
-          <width>20</width>
-          <height>203</height>
-         </size>
-        </property>
-       </spacer>
-      </item>
      </layout>
     </widget>
    </item>

+ 12 - 6
show1/widget.cpp

@@ -23,12 +23,18 @@ Widget::Widget(QWidget *parent) :
         SPDLOG_ERROR("load library failed");
     }
     /* 设置一个布局 */
-    // m_layout = new QVBoxLayout(ui->widget_content);
-    // m_layout->addWidget(m_tSwitch);
-    // ui->widget_content->setLayout(m_layout);
+    m_layout = new QVBoxLayout(ui->widget_content);
+    ui->widget_content->setLayout(m_layout);
+    /* 添加一个容器 */
+    QWidget* container = new QWidget(this);
+    container->setObjectName("container");
+    m_layout->addWidget(container);
+    container->setStyleSheet(R"(background: transparent;)");
     /* 设置边距为0 */
-    // m_layout->setMargin(20);
-    // m_layout->setSpacing(0);
+    m_layout->setMargin(20);
+    m_layout->setSpacing(0);
+    ui->widget_content->setStyleSheet(R"(background: #000000;)");
+
 
     /* 初始化WebAPI */
     InitData initData;
@@ -37,7 +43,7 @@ Widget::Widget(QWidget *parent) :
     initData.serverKey = "TMS";
 
     m_tSwitch->DoInit(&initData);
-    m_tSwitch->DoCreateWindow(1, ui->widget_content);
+    m_tSwitch->DoCreateWindow(1, container);
     // m_tSwitch->DoGetExecPlanFromEQM();
     m_tSwitch->DoSetCallBack(trackCallBack);