Browse Source

V1.3.2
1、添加了新增计划页面

Apple 3 tháng trước cách đây
mục cha
commit
6d598c892b

+ 358 - 0
TransmitterSwitch/AddItem/addnormalitem.cpp

@@ -0,0 +1,358 @@
+#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();
+}
+
+
+

+ 95 - 0
TransmitterSwitch/AddItem/addnormalitem.h

@@ -0,0 +1,95 @@
+#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

+ 312 - 0
TransmitterSwitch/AddItem/addnormalitem.ui

@@ -0,0 +1,312 @@
+<?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>

+ 383 - 0
TransmitterSwitch/AddItem/addspecialitem.cpp

@@ -0,0 +1,383 @@
+#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();
+}
+
+

+ 108 - 0
TransmitterSwitch/AddItem/addspecialitem.h

@@ -0,0 +1,108 @@
+#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

+ 355 - 0
TransmitterSwitch/AddItem/addspecialitem.ui

@@ -0,0 +1,355 @@
+<?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>

+ 2 - 7
TransmitterSwitch/CMakeLists.txt

@@ -11,17 +11,15 @@ file(GLOB LOCAL_SRC
     ${CMAKE_CURRENT_SOURCE_DIR}/*.ui
     ${CMAKE_CURRENT_SOURCE_DIR}/*.qrc
 
-    # ${CMAKE_CURRENT_SOURCE_DIR}/StyleManager/*.cpp
-
     ${CMAKE_CURRENT_SOURCE_DIR}/WebAPI/*.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/Resource/*.qrc
-    ${CMAKE_CURRENT_SOURCE_DIR}/WidgetItems/*.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/UserData/*.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}/ManagerPlan/*.cpp
 
     ${CMAKE_CURRENT_SOURCE_DIR}/common/Thread/*.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/common/Shadow/*.cpp
@@ -56,17 +54,14 @@ target_include_directories(${lib_name} PRIVATE
     ${CMAKE_CURRENT_SOURCE_DIR}
     ${CMAKE_CURRENT_SOURCE_DIR}/LHLog
 
-    # ${CMAKE_CURRENT_SOURCE_DIR}/StyleManager
-
-
     ${CMAKE_CURRENT_SOURCE_DIR}/WebAPI
-    ${CMAKE_CURRENT_SOURCE_DIR}/WidgetItems
     ${CMAKE_CURRENT_SOURCE_DIR}/UserData
     ${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}/ManagerPlan
 
     ${CMAKE_CURRENT_SOURCE_DIR}/common
     ${CMAKE_CURRENT_SOURCE_DIR}/common/Thread

+ 92 - 1
TransmitterSwitch/ExecPlanData/plancard.cpp

@@ -1,6 +1,8 @@
 #include "plancard.h"
 #include "ui_plancard.h"
 
+#include <QPainter>
+
 #include "UIStyleManager.h"
 #include "LHQLogAPI.h"
 
@@ -59,6 +61,11 @@ PlanCard::PlanCard(QWidget *parent) :
     /* 设置两列一样宽 */
     auto horWidth = ui->tableView->width();
     ui->tableView->horizontalHeader()->setDefaultSectionSize(horWidth / 2);
+    /* 设置去掉标题 */
+    ui->tableView->horizontalHeader()->setVisible(false);
+
+    /* 设置空白图片和文字的位置 */
+    setSpaceImageAndTextRect();
     
     /* 连接信号和槽 */
     connect(&EPUIStyle, &UIStyleManager::signal_qssChanged, this, &PlanCard::do_setUIStyle);
@@ -115,7 +122,7 @@ void PlanCard::addPlanItem(const enum_WeekDay weekDay, const QDateTime& time, co
             break;
     }
 
-    /* 创建两个项 */
+    /* 创建一个item */
     QStandardItem* item = new QStandardItem();
     item->setText(strTime);
     item->setData(static_cast<int>(weekDay), UserRole_WeekDay);   /* 设置周几 */
@@ -130,6 +137,29 @@ void PlanCard::addPlanItem(const enum_WeekDay weekDay, const QDateTime& time, co
     }else {
         m_model->setItem(m_model->rowCount(), 1, item);
     }
+
+    m_isSpace = false; /* 有数据了 */
+}
+
+/* 删除一项 */
+void PlanCard::deletePlanItem(const enum_WeekDay weekDay, const QDateTime& time, const enum_OnOff onOff)
+{
+    for(auto& it : m_model->findItems(QString(), Qt::MatchContains, 0))
+    {
+        auto item = it->data(UserRole_WeekDay).toInt();
+        if(item == static_cast<int>(weekDay) && it->data(UserRole_Time).toDateTime() == time)
+        {
+            /* 删除该行 */
+            m_model->removeRow(it->row());
+            break;
+        }
+    }
+
+    /* 判断数据有没有空 */
+    if(m_model->rowCount() == 0)
+    {
+        m_isSpace = true; /* 没有数据了 */
+    }
 }
 
 /* 取出所有的计划信息 */
@@ -171,4 +201,65 @@ void PlanCard::setPlanList(const QList<ExecPlanItemInfo>& list)
 void PlanCard::do_setUIStyle()
 {
     this->setStyleSheet(EPUIStyle.StrQSS_PlanCard);
+    /* 打开图片 */
+    if(EPUIStyle.getUIStyle() == enum_UIStyle::UI_Light)
+    {
+       m_spaceImage = QPixmap(":/ICON/ICON/space_light.png");
+    }else {
+        m_spaceImage = QPixmap(":/ICON/ICON/space_dark.png");
+    }
+}
+
+/* 设置空白图片和文字的位置 */
+void PlanCard::setSpaceImageAndTextRect()
+{
+    /* 设置图片大小 */
+    m_rectSpaceImage.setSize(QSize(108, 87));
+    /* 设置文本区域大小 */
+    m_rectSpaceText.setSize(QSize(72, 19));
+    /* 设置空白图片位置 */
+    QPoint pointTable = ui->tableView->mapToParent(QPoint(0, 0));
+    /* 设置空白图片位置,居中显示 */
+    int x = pointTable.x() + (ui->tableView->width() - m_rectSpaceImage.width()) / 2;
+    int y = pointTable.y() + (ui->tableView->height() - m_rectSpaceImage.height() - m_rectSpaceText.height() - 5) / 2;
+    m_rectSpaceImage.moveTo(x, y);
+    /* 设置空白文字位置 */
+    x = pointTable.x() + (ui->tableView->width() - m_rectSpaceText.width()) / 2;
+    y = m_rectSpaceImage.y() + m_rectSpaceImage.height() + 5;
+    m_rectSpaceText.moveTo(x, y);
+
+}
+
+
+/* 绘制事件 */
+void PlanCard::paintEvent(QPaintEvent *event)
+{
+    if(m_isSpace)
+    {
+        QPainter painter(this);
+        /* 绘制图片 */
+        painter.drawPixmap(m_rectSpaceImage, m_spaceImage);
+        /* 绘制文字 */
+        QFont font = painter.font();
+        font.setPixelSize(12);
+        painter.setFont(font);
+        painter.drawText(m_rectSpaceText, Qt::AlignCenter, "暂无相关信息");
+    }
+    QWidget::paintEvent(event);
+}
+
+/* 大小缩放事件 */
+void PlanCard::resizeEvent(QResizeEvent *event)
+{
+    QWidget::resizeEvent(event);
+    /* 设置空白图片和文字的位置 */
+    setSpaceImageAndTextRect();
+}
+
+/* 显示事件,这里获取到的控件大小信息是正确的 */
+void PlanCard::showEvent(QShowEvent *event)
+{
+    QWidget::showEvent(event);
+    /* 设置空白图片和文字的位置 */
+    setSpaceImageAndTextRect();
 }

+ 23 - 4
TransmitterSwitch/ExecPlanData/plancard.h

@@ -53,8 +53,10 @@ public:
     /* 获取频率信息 */
     ChannelInfo& getChannelInfo() { return m_channelInfo; }
 
-    /* 添加一项 */
+    /* 添加一项,这里的一项是开机和关机单独的一个时间 */
     void addPlanItem(const enum_WeekDay weekDay, const QDateTime& time, const enum_OnOff onOff);
+    /* 删除一项 */
+    void deletePlanItem(const enum_WeekDay weekDay, const QDateTime& time, const enum_OnOff onOff);
 
     /* 取出所有的计划信息 */
     void getAllPlanInfo(QList<ExecPlanItemInfo>& list);
@@ -65,13 +67,30 @@ private slots:
     /* 更改UI外观 */
     void do_setUIStyle();
 
+private:
+    /* 设置空白图片和文字的位置 */
+    void setSpaceImageAndTextRect();
+
+protected:
+    /* 绘制事件 */
+    void paintEvent(QPaintEvent *event) override;
+    /* 大小缩放事件 */
+    void resizeEvent(QResizeEvent *event) override;
+    /* 显示事件 */
+    void showEvent(QShowEvent *event) override;
+
 private:
     Ui::PlanCard *ui;
 
-    ChannelInfo m_channelInfo;   /* 频率信息 */
+    ChannelInfo m_channelInfo;      /* 频率信息 */
+
+    QStandardItemModel* m_model;    /* 表格模型,存储数据 */
+    CSortModel* m_sortModel;        /* 排序模型 */
 
-    QStandardItemModel* m_model;  /* 表格模型,存储数据 */
-    CSortModel* m_sortModel; /* 排序模型 */
+    bool m_isSpace = true;          /* 计划是否为空 */
+    QRect m_rectSpaceImage;         /* 空白图片的矩形区域 */
+    QRect m_rectSpaceText;          /* 空白文字的矩形区域 */
+    QPixmap m_spaceImage;           /* 空白图片 */
 };
 
 #endif // PLANCARD_H

+ 86 - 65
TransmitterSwitch/ExecPlanData/plancard.ui

@@ -14,100 +14,57 @@
    <string>Form</string>
   </property>
   <layout class="QVBoxLayout" name="verticalLayout">
+   <property name="spacing">
+    <number>0</number>
+   </property>
    <property name="leftMargin">
-    <number>12</number>
+    <number>0</number>
    </property>
    <property name="topMargin">
-    <number>12</number>
+    <number>0</number>
    </property>
    <property name="rightMargin">
-    <number>12</number>
+    <number>0</number>
    </property>
    <property name="bottomMargin">
-    <number>12</number>
+    <number>0</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>
+    <widget class="QWidget" name="widget" native="true">
+     <layout class="QVBoxLayout" name="verticalLayout_2">
       <property name="leftMargin">
        <number>0</number>
       </property>
       <property name="topMargin">
-       <number>0</number>
+       <number>12</number>
       </property>
       <property name="rightMargin">
        <number>0</number>
       </property>
       <property name="bottomMargin">
-       <number>0</number>
+       <number>12</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>
+       <widget class="QLabel" name="label_title">
         <property name="minimumSize">
          <size>
           <width>0</width>
-          <height>32</height>
+          <height>22</height>
          </size>
         </property>
         <property name="maximumSize">
          <size>
           <width>16777215</width>
-          <height>32</height>
+          <height>22</height>
          </size>
         </property>
         <property name="text">
-         <string>开机时间</string>
+         <string>标题</string>
         </property>
        </widget>
       </item>
       <item>
-       <widget class="QLabel" name="label_offTime">
+       <widget class="QWidget" name="widget_tableHeader" native="true">
         <property name="sizePolicy">
          <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
           <horstretch>0</horstretch>
@@ -126,17 +83,81 @@
           <height>32</height>
          </size>
         </property>
-        <property name="text">
-         <string>关机时间</string>
-        </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_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>
+         <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>
+        </layout>
        </widget>
       </item>
+      <item>
+       <widget class="QTableView" name="tableView"/>
+      </item>
      </layout>
     </widget>
    </item>
-   <item>
-    <widget class="QTableView" name="tableView"/>
-   </item>
   </layout>
  </widget>
  <resources/>

+ 194 - 0
TransmitterSwitch/ManagerPlan/managerplan.cpp

@@ -0,0 +1,194 @@
+#include "managerplan.h"
+#include "ui_managerplan.h"
+
+
+#include <QMouseEvent>
+#include <QDesktopWidget>
+#include "UIStyleManager.h"
+#include "OneShadowEffect.h"
+
+ManagerPlan::ManagerPlan(QDialog *parent) :
+    QDialog(parent),
+    ui(new Ui::ManagerPlan)
+{
+    ui->setupUi(this);
+
+    /* 设置隐藏边框 */
+    this->setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint);
+    /* 设置底层样式表 */
+    this->setAttribute(Qt::WA_TranslucentBackground);
+
+    /* 创建阴影 */
+    auto pShadow = new OneShadowEffect(this);
+    ui->widget_background->setGraphicsEffect(pShadow);
+
+    /* 获取屏幕大小 */
+    auto screenRect = QApplication::desktop()->availableGeometry();
+    this->resize(screenRect.width(), screenRect.height());
+
+    /* 注册事件过滤器 */
+    ui->cBox_selectChn->installEventFilter(this);
+    ui->pBtn_close->installEventFilter(this);
+
+    /* 设置时间和日期选择Tab */
+    setTabWidget();
+
+    /* 设置默认时间和日期 */
+    auto date = QDate::currentDate();
+    auto time = QTime::fromString("00:00:00", "hh:mm:ss");
+    ui->timeEdit_weekStart->setTime(time);
+    ui->timeEdit_weekEnd->setTime(time);
+    ui->timeEdit_specialStart->setTime(time);
+    ui->timeEdit_specialEnd->setTime(time);
+
+    ui->dateEdit_specialStart->setDisplayFormat("yy-MM-dd");
+    ui->dateEdit_specialEnd->setDisplayFormat("yy-MM-dd");
+    ui->dateEdit_specialStart->setDate(date);
+    ui->dateEdit_specialEnd->setDate(date);
+
+    /* 设置时间图标 */
+    ui->timeEdit_weekStart->setIcon(":/ICON/ICON/Time.png");
+    ui->timeEdit_weekEnd->setIcon(":/ICON/ICON/Time.png");
+    ui->timeEdit_specialStart->setIcon(":/ICON/ICON/Time.png");
+    ui->timeEdit_specialEnd->setIcon(":/ICON/ICON/Time.png");
+
+    ui->timeEdit_weekStart->SetMainWindow(this);
+    ui->timeEdit_weekEnd->SetMainWindow(this);
+    ui->timeEdit_specialStart->SetMainWindow(this);
+    ui->timeEdit_specialEnd->SetMainWindow(this);
+
+    /* 设置可选择的周几 */
+    setWeekDay();
+
+    /* 连接信号和槽 */
+    connect(ui->pBtn_cancel, &QPushButton::clicked, this, &ManagerPlan::close);
+    connect(ui->pBtn_close, &QPushButton::clicked, this, &ManagerPlan::close);
+
+    connect(&EPUIStyle, &UIStyleManager::signal_qssChanged, this, &ManagerPlan::do_setUIStyle);
+    do_setUIStyle();
+
+    /* 设置下拉框阴影 */
+    ui->cBox_selectChn->setViewShadowEffect();
+    ui->cBox_selectWeekStart->setViewShadowEffect();
+    ui->cBox_selectWeekEnd->setViewShadowEffect();
+
+    /* 默认显示周计划 */
+    ui->tabWidget->setCurrentIndex(0);
+}
+
+ManagerPlan::~ManagerPlan()
+{
+    delete ui;
+}
+
+/* 修改UI样式 */
+void ManagerPlan::do_setUIStyle()
+{
+    this->setStyleSheet(EPUIStyle.StrQSS_ManagerPlan);
+}
+
+/* 设置时间和日期选择Tab */
+void ManagerPlan::setTabWidget()
+{
+    /* 设置Tab的大小 */
+    QSize size(ui->tabWidget->width(), ui->tabWidget->height() - ui->tabWidget->tabBar()->height() - 2);
+    /* 设置正常日的Tab */
+    ui->tab_week->resize(size);
+    auto vLayout1 = new QVBoxLayout(ui->tab_week);
+    vLayout1->setContentsMargins(0, 24, 0, 0);
+    vLayout1->setSpacing(12);
+    ui->tab_week->setLayout(vLayout1);
+    vLayout1->addWidget(ui->widget_weekStart);
+    vLayout1->addWidget(ui->widget_weekEnd);
+
+    /* 设置特殊日的Tab */
+    ui->tab_special->resize(size);
+    auto vLayout2 = new QVBoxLayout(ui->tab_special);
+    vLayout2->setContentsMargins(0, 24, 0, 0);
+    vLayout2->setSpacing(12);
+    ui->tab_special->setLayout(vLayout2);
+    vLayout2->addWidget(ui->widget_specialStart);
+    vLayout2->addWidget(ui->widget_specialEnd);
+}
+
+/* 设置可选择的周几 */
+void ManagerPlan::setWeekDay()
+{
+    ui->cBox_selectWeekStart->addItem("星期一", static_cast<int>(enum_WeekDay::WeekDay_Mon));
+    ui->cBox_selectWeekStart->addItem("星期二", static_cast<int>(enum_WeekDay::WeekDay_Tue));
+    ui->cBox_selectWeekStart->addItem("星期三", static_cast<int>(enum_WeekDay::WeekDay_Wed));
+    ui->cBox_selectWeekStart->addItem("星期四", static_cast<int>(enum_WeekDay::WeekDay_Thu));
+    ui->cBox_selectWeekStart->addItem("星期五", static_cast<int>(enum_WeekDay::WeekDay_Fri));
+    ui->cBox_selectWeekStart->addItem("星期六", static_cast<int>(enum_WeekDay::WeekDay_Sat));
+    ui->cBox_selectWeekStart->addItem("星期天", static_cast<int>(enum_WeekDay::WeekDay_Sun));
+
+    ui->cBox_selectWeekEnd->addItem("星期一", static_cast<int>(enum_WeekDay::WeekDay_Mon));
+    ui->cBox_selectWeekEnd->addItem("星期二", static_cast<int>(enum_WeekDay::WeekDay_Tue));
+    ui->cBox_selectWeekEnd->addItem("星期三", static_cast<int>(enum_WeekDay::WeekDay_Wed));
+    ui->cBox_selectWeekEnd->addItem("星期四", static_cast<int>(enum_WeekDay::WeekDay_Thu));
+    ui->cBox_selectWeekEnd->addItem("星期五", static_cast<int>(enum_WeekDay::WeekDay_Fri));
+    ui->cBox_selectWeekEnd->addItem("星期六", static_cast<int>(enum_WeekDay::WeekDay_Sat));
+    ui->cBox_selectWeekEnd->addItem("星期天", static_cast<int>(enum_WeekDay::WeekDay_Sun));
+}
+
+
+/* 鼠标点击事件 */
+void ManagerPlan::mousePressEvent(QMouseEvent *event)
+{
+    m_lastPos = event->globalPos();
+    event->accept();
+}
+
+/* 鼠标移动事件 */
+void ManagerPlan::mouseMoveEvent(QMouseEvent *event)
+{
+    auto point = ui->widget_top->mapToGlobal(QPoint(0, 0));
+    QRect rect(point, ui->widget_top->size());
+
+    if(!rect.contains(m_lastPos))
+    {
+        event->accept();
+        return;
+    }
+
+    int dx = event->globalX() - m_lastPos.x();
+    int dy = event->globalY() - m_lastPos.y();
+    ui->widget_background->move(ui->widget_background->x() + dx, ui->widget_background->y() + dy);
+    m_lastPos = event->globalPos();
+    event->accept();
+}
+
+/* 鼠标释放事件 */
+void ManagerPlan::mouseReleaseEvent(QMouseEvent *event)
+{
+    event->accept();
+}
+
+/* 事件过滤器 */
+bool ManagerPlan::eventFilter(QObject *watched, QEvent *event)
+{
+    if(watched == ui->cBox_selectChn)
+    {
+        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);
+}

+ 45 - 0
TransmitterSwitch/ManagerPlan/managerplan.h

@@ -0,0 +1,45 @@
+#ifndef MANAGERPLAN_H
+#define MANAGERPLAN_H
+
+#include <QDialog>
+
+namespace Ui {
+class ManagerPlan;
+}
+
+class ManagerPlan : public QDialog
+{
+    Q_OBJECT
+
+public:
+    explicit ManagerPlan(QDialog *parent = nullptr);
+    ~ManagerPlan();
+
+public slots:
+    /* 修改UI样式 */
+    void do_setUIStyle();
+
+private:
+    /* 设置时间和日期选择Tab */
+    void setTabWidget();
+    /* 设置可选择的周几 */
+    void setWeekDay();
+
+protected:
+    /* 鼠标点击事件 */
+    void mousePressEvent(QMouseEvent *event) override;
+    /* 鼠标移动事件 */
+    void mouseMoveEvent(QMouseEvent *event) override;
+    /* 鼠标释放事件 */
+    void mouseReleaseEvent(QMouseEvent *event) override;
+
+    /* 事件过滤器 */
+    bool eventFilter(QObject *watched, QEvent *event) override;
+
+private:
+    Ui::ManagerPlan *ui;
+
+    QPoint m_lastPos;                       /* 鼠标点击的位置 */
+};
+
+#endif // MANAGERPLAN_H

+ 1019 - 0
TransmitterSwitch/ManagerPlan/managerplan.ui

@@ -0,0 +1,1019 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ManagerPlan</class>
+ <widget class="QDialog" name="ManagerPlan">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>1118</width>
+    <height>975</height>
+   </rect>
+  </property>
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </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">
+     <layout class="QGridLayout" name="gridLayout">
+      <item row="0" column="0">
+       <widget class="QWidget" name="widget_background" native="true">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="minimumSize">
+         <size>
+          <width>682</width>
+          <height>732</height>
+         </size>
+        </property>
+        <property name="maximumSize">
+         <size>
+          <width>682</width>
+          <height>732</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_top" 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>63</height>
+            </size>
+           </property>
+           <property name="maximumSize">
+            <size>
+             <width>16777215</width>
+             <height>63</height>
+            </size>
+           </property>
+           <widget class="QLabel" name="label_title">
+            <property name="geometry">
+             <rect>
+              <x>32</x>
+              <y>19</y>
+              <width>72</width>
+              <height>24</height>
+             </rect>
+            </property>
+            <property name="text">
+             <string>新增</string>
+            </property>
+           </widget>
+           <widget class="QPushButton" name="pBtn_close">
+            <property name="geometry">
+             <rect>
+              <x>634</x>
+              <y>15</y>
+              <width>32</width>
+              <height>32</height>
+             </rect>
+            </property>
+            <property name="text">
+             <string/>
+            </property>
+           </widget>
+          </widget>
+         </item>
+         <item>
+          <spacer name="verticalSpacer">
+           <property name="orientation">
+            <enum>Qt::Vertical</enum>
+           </property>
+           <property name="sizeType">
+            <enum>QSizePolicy::Fixed</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>20</width>
+             <height>32</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item>
+          <widget class="QWidget" name="widget_addPlan" 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>140</height>
+            </size>
+           </property>
+           <property name="maximumSize">
+            <size>
+             <width>16777215</width>
+             <height>140</height>
+            </size>
+           </property>
+           <widget class="QLabel" name="label_selectChn">
+            <property name="geometry">
+             <rect>
+              <x>32</x>
+              <y>0</y>
+              <width>72</width>
+              <height>24</height>
+             </rect>
+            </property>
+            <property name="text">
+             <string>选择频率</string>
+            </property>
+           </widget>
+           <widget class="QWidget" name="widget_2" native="true">
+            <property name="geometry">
+             <rect>
+              <x>32</x>
+              <y>38</y>
+              <width>618</width>
+              <height>32</height>
+             </rect>
+            </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_x1">
+               <property name="minimumSize">
+                <size>
+                 <width>10</width>
+                 <height>10</height>
+                </size>
+               </property>
+               <property name="maximumSize">
+                <size>
+                 <width>10</width>
+                 <height>10</height>
+                </size>
+               </property>
+               <property name="text">
+                <string>*</string>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QLabel" name="label_2">
+               <property name="minimumSize">
+                <size>
+                 <width>70</width>
+                 <height>14</height>
+                </size>
+               </property>
+               <property name="maximumSize">
+                <size>
+                 <width>70</width>
+                 <height>16777215</height>
+                </size>
+               </property>
+               <property name="text">
+                <string>频率名称:</string>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="CustomComboBox" name="cBox_selectChn">
+               <property name="minimumSize">
+                <size>
+                 <width>0</width>
+                 <height>32</height>
+                </size>
+               </property>
+               <property name="maximumSize">
+                <size>
+                 <width>538</width>
+                 <height>32</height>
+                </size>
+               </property>
+              </widget>
+             </item>
+            </layout>
+           </widget>
+           <widget class="QLabel" name="label_selectChn_2">
+            <property name="geometry">
+             <rect>
+              <x>32</x>
+              <y>102</y>
+              <width>72</width>
+              <height>24</height>
+             </rect>
+            </property>
+            <property name="text">
+             <string>添加计划</string>
+            </property>
+           </widget>
+          </widget>
+         </item>
+         <item>
+          <widget class="QWidget" name="widget_editPlan" native="true">
+           <layout class="QHBoxLayout" name="horizontalLayout_4">
+            <property name="spacing">
+             <number>20</number>
+            </property>
+            <property name="leftMargin">
+             <number>32</number>
+            </property>
+            <property name="topMargin">
+             <number>0</number>
+            </property>
+            <property name="rightMargin">
+             <number>32</number>
+            </property>
+            <property name="bottomMargin">
+             <number>0</number>
+            </property>
+            <item>
+             <widget class="PlanCard" name="widget_planCard" native="true">
+              <property name="minimumSize">
+               <size>
+                <width>262</width>
+                <height>0</height>
+               </size>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QWidget" name="widget_edit" native="true">
+              <property name="sizePolicy">
+               <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+                <horstretch>0</horstretch>
+                <verstretch>0</verstretch>
+               </sizepolicy>
+              </property>
+              <layout class="QVBoxLayout" name="verticalLayout_3">
+               <property name="spacing">
+                <number>10</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="QTabWidget" name="tabWidget">
+                 <property name="sizePolicy">
+                  <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+                   <horstretch>0</horstretch>
+                   <verstretch>0</verstretch>
+                  </sizepolicy>
+                 </property>
+                 <property name="minimumSize">
+                  <size>
+                   <width>0</width>
+                   <height>176</height>
+                  </size>
+                 </property>
+                 <property name="maximumSize">
+                  <size>
+                   <width>16777215</width>
+                   <height>16777215</height>
+                  </size>
+                 </property>
+                 <property name="currentIndex">
+                  <number>1</number>
+                 </property>
+                 <widget class="QWidget" name="tab_week">
+                  <attribute name="title">
+                   <string>周计划</string>
+                  </attribute>
+                  <widget class="QWidget" name="widget_weekStart" native="true">
+                   <property name="geometry">
+                    <rect>
+                     <x>0</x>
+                     <y>24</y>
+                     <width>330</width>
+                     <height>32</height>
+                    </rect>
+                   </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_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="QLabel" name="label_x2">
+                      <property name="minimumSize">
+                       <size>
+                        <width>10</width>
+                        <height>10</height>
+                       </size>
+                      </property>
+                      <property name="maximumSize">
+                       <size>
+                        <width>10</width>
+                        <height>10</height>
+                       </size>
+                      </property>
+                      <property name="text">
+                       <string>*</string>
+                      </property>
+                     </widget>
+                    </item>
+                    <item>
+                     <widget class="QLabel" name="label_3">
+                      <property name="minimumSize">
+                       <size>
+                        <width>70</width>
+                        <height>14</height>
+                       </size>
+                      </property>
+                      <property name="maximumSize">
+                       <size>
+                        <width>70</width>
+                        <height>16777215</height>
+                       </size>
+                      </property>
+                      <property name="text">
+                       <string>开机时间:</string>
+                      </property>
+                     </widget>
+                    </item>
+                    <item>
+                     <widget class="CustomComboBox" name="cBox_selectWeekStart">
+                      <property name="minimumSize">
+                       <size>
+                        <width>124</width>
+                        <height>32</height>
+                       </size>
+                      </property>
+                      <property name="maximumSize">
+                       <size>
+                        <width>538</width>
+                        <height>32</height>
+                       </size>
+                      </property>
+                     </widget>
+                    </item>
+                    <item>
+                     <spacer name="horizontalSpacer_2">
+                      <property name="orientation">
+                       <enum>Qt::Horizontal</enum>
+                      </property>
+                      <property name="sizeHint" stdset="0">
+                       <size>
+                        <width>40</width>
+                        <height>20</height>
+                       </size>
+                      </property>
+                     </spacer>
+                    </item>
+                    <item>
+                     <widget class="TimeWidget" name="timeEdit_weekStart">
+                      <property name="minimumSize">
+                       <size>
+                        <width>124</width>
+                        <height>32</height>
+                       </size>
+                      </property>
+                      <property name="maximumSize">
+                       <size>
+                        <width>16777215</width>
+                        <height>32</height>
+                       </size>
+                      </property>
+                     </widget>
+                    </item>
+                   </layout>
+                  </widget>
+                  <widget class="QWidget" name="widget_weekEnd" native="true">
+                   <property name="geometry">
+                    <rect>
+                     <x>0</x>
+                     <y>80</y>
+                     <width>330</width>
+                     <height>32</height>
+                    </rect>
+                   </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_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>0</number>
+                    </property>
+                    <property name="bottomMargin">
+                     <number>0</number>
+                    </property>
+                    <item>
+                     <widget class="QLabel" name="label_x3">
+                      <property name="minimumSize">
+                       <size>
+                        <width>10</width>
+                        <height>10</height>
+                       </size>
+                      </property>
+                      <property name="maximumSize">
+                       <size>
+                        <width>10</width>
+                        <height>10</height>
+                       </size>
+                      </property>
+                      <property name="text">
+                       <string>*</string>
+                      </property>
+                     </widget>
+                    </item>
+                    <item>
+                     <widget class="QLabel" name="label_4">
+                      <property name="minimumSize">
+                       <size>
+                        <width>70</width>
+                        <height>14</height>
+                       </size>
+                      </property>
+                      <property name="maximumSize">
+                       <size>
+                        <width>70</width>
+                        <height>16777215</height>
+                       </size>
+                      </property>
+                      <property name="text">
+                       <string>关机时间:</string>
+                      </property>
+                     </widget>
+                    </item>
+                    <item>
+                     <widget class="CustomComboBox" name="cBox_selectWeekEnd">
+                      <property name="minimumSize">
+                       <size>
+                        <width>124</width>
+                        <height>32</height>
+                       </size>
+                      </property>
+                      <property name="maximumSize">
+                       <size>
+                        <width>538</width>
+                        <height>32</height>
+                       </size>
+                      </property>
+                     </widget>
+                    </item>
+                    <item>
+                     <spacer name="horizontalSpacer_3">
+                      <property name="orientation">
+                       <enum>Qt::Horizontal</enum>
+                      </property>
+                      <property name="sizeHint" stdset="0">
+                       <size>
+                        <width>40</width>
+                        <height>20</height>
+                       </size>
+                      </property>
+                     </spacer>
+                    </item>
+                    <item>
+                     <widget class="TimeWidget" name="timeEdit_weekEnd">
+                      <property name="minimumSize">
+                       <size>
+                        <width>124</width>
+                        <height>32</height>
+                       </size>
+                      </property>
+                      <property name="maximumSize">
+                       <size>
+                        <width>16777215</width>
+                        <height>32</height>
+                       </size>
+                      </property>
+                     </widget>
+                    </item>
+                   </layout>
+                  </widget>
+                 </widget>
+                 <widget class="QWidget" name="tab_special">
+                  <attribute name="title">
+                   <string>特殊日</string>
+                  </attribute>
+                  <widget class="QWidget" name="widget_specialStart" native="true">
+                   <property name="geometry">
+                    <rect>
+                     <x>0</x>
+                     <y>24</y>
+                     <width>330</width>
+                     <height>32</height>
+                    </rect>
+                   </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_6">
+                    <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_x4">
+                      <property name="minimumSize">
+                       <size>
+                        <width>10</width>
+                        <height>10</height>
+                       </size>
+                      </property>
+                      <property name="maximumSize">
+                       <size>
+                        <width>10</width>
+                        <height>10</height>
+                       </size>
+                      </property>
+                      <property name="text">
+                       <string>*</string>
+                      </property>
+                     </widget>
+                    </item>
+                    <item>
+                     <widget class="QLabel" name="label_5">
+                      <property name="minimumSize">
+                       <size>
+                        <width>70</width>
+                        <height>14</height>
+                       </size>
+                      </property>
+                      <property name="maximumSize">
+                       <size>
+                        <width>70</width>
+                        <height>16777215</height>
+                       </size>
+                      </property>
+                      <property name="text">
+                       <string>开机时间:</string>
+                      </property>
+                     </widget>
+                    </item>
+                    <item>
+                     <widget class="CalendarDTEdit" name="dateEdit_specialStart">
+                      <property name="minimumSize">
+                       <size>
+                        <width>124</width>
+                        <height>32</height>
+                       </size>
+                      </property>
+                     </widget>
+                    </item>
+                    <item>
+                     <spacer name="horizontalSpacer_4">
+                      <property name="orientation">
+                       <enum>Qt::Horizontal</enum>
+                      </property>
+                      <property name="sizeHint" stdset="0">
+                       <size>
+                        <width>40</width>
+                        <height>20</height>
+                       </size>
+                      </property>
+                     </spacer>
+                    </item>
+                    <item>
+                     <widget class="TimeWidget" name="timeEdit_specialStart">
+                      <property name="minimumSize">
+                       <size>
+                        <width>124</width>
+                        <height>32</height>
+                       </size>
+                      </property>
+                      <property name="maximumSize">
+                       <size>
+                        <width>16777215</width>
+                        <height>32</height>
+                       </size>
+                      </property>
+                     </widget>
+                    </item>
+                   </layout>
+                  </widget>
+                  <widget class="QWidget" name="widget_specialEnd" native="true">
+                   <property name="geometry">
+                    <rect>
+                     <x>0</x>
+                     <y>80</y>
+                     <width>330</width>
+                     <height>32</height>
+                    </rect>
+                   </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_7">
+                    <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_x5">
+                      <property name="minimumSize">
+                       <size>
+                        <width>10</width>
+                        <height>10</height>
+                       </size>
+                      </property>
+                      <property name="maximumSize">
+                       <size>
+                        <width>10</width>
+                        <height>10</height>
+                       </size>
+                      </property>
+                      <property name="text">
+                       <string>*</string>
+                      </property>
+                     </widget>
+                    </item>
+                    <item>
+                     <widget class="QLabel" name="label_6">
+                      <property name="minimumSize">
+                       <size>
+                        <width>70</width>
+                        <height>14</height>
+                       </size>
+                      </property>
+                      <property name="maximumSize">
+                       <size>
+                        <width>70</width>
+                        <height>16777215</height>
+                       </size>
+                      </property>
+                      <property name="text">
+                       <string>关机时间:</string>
+                      </property>
+                     </widget>
+                    </item>
+                    <item>
+                     <widget class="CalendarDTEdit" name="dateEdit_specialEnd">
+                      <property name="minimumSize">
+                       <size>
+                        <width>124</width>
+                        <height>32</height>
+                       </size>
+                      </property>
+                     </widget>
+                    </item>
+                    <item>
+                     <spacer name="horizontalSpacer_5">
+                      <property name="orientation">
+                       <enum>Qt::Horizontal</enum>
+                      </property>
+                      <property name="sizeHint" stdset="0">
+                       <size>
+                        <width>40</width>
+                        <height>20</height>
+                       </size>
+                      </property>
+                     </spacer>
+                    </item>
+                    <item>
+                     <widget class="TimeWidget" name="timeEdit_specialEnd">
+                      <property name="minimumSize">
+                       <size>
+                        <width>124</width>
+                        <height>32</height>
+                       </size>
+                      </property>
+                      <property name="maximumSize">
+                       <size>
+                        <width>16777215</width>
+                        <height>32</height>
+                       </size>
+                      </property>
+                     </widget>
+                    </item>
+                   </layout>
+                  </widget>
+                 </widget>
+                </widget>
+               </item>
+               <item>
+                <widget class="QWidget" name="widget_pBtn" native="true">
+                 <property name="minimumSize">
+                  <size>
+                   <width>0</width>
+                   <height>32</height>
+                  </size>
+                 </property>
+                 <widget class="QPushButton" name="pBtn_addPlan">
+                  <property name="geometry">
+                   <rect>
+                    <x>0</x>
+                    <y>0</y>
+                    <width>68</width>
+                    <height>32</height>
+                   </rect>
+                  </property>
+                  <property name="text">
+                   <string>添加</string>
+                  </property>
+                 </widget>
+                 <widget class="QPushButton" name="pBtn_editPlan">
+                  <property name="geometry">
+                   <rect>
+                    <x>76</x>
+                    <y>0</y>
+                    <width>68</width>
+                    <height>32</height>
+                   </rect>
+                  </property>
+                  <property name="text">
+                   <string>修改</string>
+                  </property>
+                 </widget>
+                 <widget class="QPushButton" name="pBtn_deletePlan">
+                  <property name="geometry">
+                   <rect>
+                    <x>152</x>
+                    <y>0</y>
+                    <width>68</width>
+                    <height>32</height>
+                   </rect>
+                  </property>
+                  <property name="text">
+                   <string>删除</string>
+                  </property>
+                 </widget>
+                </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>182</height>
+                  </size>
+                 </property>
+                </spacer>
+               </item>
+              </layout>
+             </widget>
+            </item>
+           </layout>
+          </widget>
+         </item>
+         <item>
+          <widget class="QWidget" name="widget_bottom" native="true">
+           <property name="minimumSize">
+            <size>
+             <width>0</width>
+             <height>96</height>
+            </size>
+           </property>
+           <property name="maximumSize">
+            <size>
+             <width>16777215</width>
+             <height>96</height>
+            </size>
+           </property>
+           <layout class="QHBoxLayout" name="horizontalLayout_5">
+            <property name="spacing">
+             <number>8</number>
+            </property>
+            <property name="leftMargin">
+             <number>32</number>
+            </property>
+            <property name="topMargin">
+             <number>0</number>
+            </property>
+            <property name="rightMargin">
+             <number>32</number>
+            </property>
+            <property name="bottomMargin">
+             <number>0</number>
+            </property>
+            <item>
+             <widget class="QPushButton" name="pBtn_saveTotemplate">
+              <property name="minimumSize">
+               <size>
+                <width>110</width>
+                <height>32</height>
+               </size>
+              </property>
+              <property name="text">
+               <string>保存为模版</string>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <spacer name="horizontalSpacer">
+              <property name="orientation">
+               <enum>Qt::Horizontal</enum>
+              </property>
+              <property name="sizeHint" stdset="0">
+               <size>
+                <width>295</width>
+                <height>20</height>
+               </size>
+              </property>
+             </spacer>
+            </item>
+            <item>
+             <widget class="QPushButton" name="pBtn_cancel">
+              <property name="minimumSize">
+               <size>
+                <width>68</width>
+                <height>32</height>
+               </size>
+              </property>
+              <property name="text">
+               <string>取消</string>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QPushButton" name="pBtn_ok">
+              <property name="minimumSize">
+               <size>
+                <width>68</width>
+                <height>32</height>
+               </size>
+              </property>
+              <property name="text">
+               <string>确定</string>
+              </property>
+             </widget>
+            </item>
+           </layout>
+          </widget>
+         </item>
+        </layout>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>CustomComboBox</class>
+   <extends>QComboBox</extends>
+   <header location="global">customcombobox.h</header>
+  </customwidget>
+  <customwidget>
+   <class>PlanCard</class>
+   <extends>QWidget</extends>
+   <header location="global">plancard.h</header>
+   <container>1</container>
+  </customwidget>
+  <customwidget>
+   <class>CalendarDTEdit</class>
+   <extends>QDateEdit</extends>
+   <header location="global">calendardtedit.h</header>
+  </customwidget>
+  <customwidget>
+   <class>TimeWidget</class>
+   <extends>QTimeEdit</extends>
+   <header location="global">timewidget.h</header>
+  </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>

+ 422 - 0
TransmitterSwitch/Resource/QSS/dark/managerplan.qss

@@ -0,0 +1,422 @@
+
+/* ==========================================================
+ *  通用样式
+ * ========================================================== */
+QWidget
+{
+    font-size: 14px;
+    color: #D2D2D2;
+    line-height: 21px;
+    text-align: left;
+    font-style: normal;
+    border-radius: 8px;
+    background: transparent;
+}
+
+QWidget#widget
+{
+    background: rgba(0,0,0,0.01);
+}
+
+QWidget#widget_background
+{
+    background-color: #464649;
+}
+
+QWidget#widget_top
+{
+    /* background: rgba(108,105,124,0.2); */
+    border-top-left-radius: 8px;
+    border-top-right-radius: 8px;
+    border-bottom-left-radius: 0px;
+    border-bottom-right-radius: 0px;
+    border-bottom: 1px solid rgba(255,255,255,0.15);
+}
+
+QLabel#label_title
+{
+    background: transparent;
+    font-size: 18px;
+    color: #EBEBEB;
+    line-height: 27px;
+    text-align: left;
+    font-style: normal;
+    text-transform: uppercase;
+}
+
+QLabel#label_x1, #label_x2, #label_x3, #label_x4, #label_x5, #label_x6
+{
+    background: transparent;
+    font-size: 14px;
+    color: #F53F3F;
+    text-align: left;
+    font-style: normal;
+}
+
+QPushButton
+{
+	text-align: center;
+}
+
+QPushButton#pBtn_close
+{
+    background: transparent;
+    border-radius: 4px;
+    qproperty-icon: url(:/ICON/ICON/Close_Dark.png);
+    qproperty-iconSize: 20px 20px;
+}
+QPushButton#pBtn_close[Hover = true]
+{    
+    background: transparent;
+    border-radius: 4px;
+    qproperty-icon: url(:/ICON/ICON/Close_pass.png);
+    qproperty-iconSize: 20px 20px;
+
+    border: 1px solid #438EFF;
+}
+
+/********* 普通椭圆按钮三种状态效果 *********/
+QPushButton#pBtn_cancel, #pBtn_saveTotemplate
+{
+    color: #EBEBEB;
+    border: 1px solid rgba(255,255,255,0.25);
+    border-radius: 16px;
+    background: transparent;
+}
+QPushButton#pBtn_cancel:hover, #pBtn_saveTotemplate:hover
+{
+    color: #EBEBEB;
+    border: 1px solid rgba(255,255,255,0.25);
+    border-radius: 16px;
+    background: rgba(0,0,0,0.15);
+}
+
+
+/********* 带有底色椭圆按钮三种状态效果 *********/
+QPushButton#pBtn_ok
+{
+    color:white;
+    background: #438EFF;
+    border-radius: 16px;
+}
+
+QPushButton#pBtn_ok:hover
+{
+    color:white;
+    background: #5F9EFF;
+    border-radius: 16px;
+}
+
+/********* 普通方框按钮三种状态效果 *********/
+QPushButton#pBtn_deletePlan, #pBtn_editPlan
+{
+    color: #EBEBEB;
+    border: 1px solid rgba(255,255,255,0.25);
+    border-radius: 4px;
+    background: transparent;
+}
+QPushButton#pBtn_deletePlan:hover, #pBtn_editPlan:hover
+{
+    color: #EBEBEB;
+    border: 1px solid rgba(255,255,255,0.25);
+    border-radius: 4px;
+    background: rgba(0,0,0,0.15);
+}
+
+
+/********* 带有底色方框按钮三种状态效果 *********/
+QPushButton#pBtn_addPlan
+{
+    color:white;
+    background: #438EFF;
+    border-radius: 4px;
+}
+
+QPushButton#pBtn_addPlan:hover
+{
+    color:white;
+    background: #5F9EFF;
+    border-radius: 4px;
+}
+
+
+QLabel#label_devWarn,QLabel#label_timeWarn,QLabel#label_actionWarn
+{
+    /* font-weight: 400; */
+    font-size: 14px;
+    color: #D21F21;
+    line-height: 21px;
+    text-align: left;
+    font-style: normal;
+}
+
+/* ==========================================================
+ *  QComboBox(这个是在用的)
+ * ========================================================== */
+
+QComboBox:enabled
+{
+    background: transparent;
+    border: 1px solid rgba(255,255,255,0.15);
+    border-radius: 4px;
+    font-size:14px;
+    /* font-weight: 400; */
+    color:#D2D2D2;
+    padding-left: 12px;
+}
+
+
+QComboBox:enabled[Warn=true]
+{
+    background-color: transparent;
+    border: 1px solid #D21F21;
+    border-radius: 4px;
+    font-size:14px;
+    /* font-weight: 400; */
+    color:#3A3F63;
+    padding-left: 12px;
+}
+
+/* 不能编辑的时候的样式,setEnable(false) */
+QComboBox:!enabled
+{
+    background:rgba(0,0,0,0.04);
+	border: 1px solid #E6E9F4;
+    border-radius: 4px;
+    font-size:14px;
+    /* font-weight: 400; */
+    color:rgba(58,63,99,0.65);
+    padding-left: 12px;
+}
+
+QComboBox:hover
+{
+    border: 1px solid #438EFF;
+    border-radius: 4px;
+    background:transparent;
+}
+
+/* 下拉箭头所在的位置方框 */
+QComboBox::drop-down
+{
+    width: 24px;
+    border: none;
+}
+/* 下拉箭头图标 */
+QComboBox::down-arrow
+{
+    image: url(:/ICON/ICON/DownArrow_Dark.png);
+    height:16px;
+    width:16px;
+}
+
+/* 下拉条样式,就是view,整个下拉窗体的样式 */
+QComboBox QAbstractItemView
+{
+    background-color: #5C5E61;
+    margin: 12px;
+    outline:0px;
+    font-size:14px;
+    /* color: #3A3F63; */
+    border-radius: 4px;
+}
+
+/* 使下面两句生效,需要加上如下语句 */
+/* m_comBoxDev->setView(new QListView()); */
+QComboBox QAbstractItemView::item
+{
+    background-color: #5C5E61;
+    border-radius:4px;
+    color: #D2D2D2;
+    padding-left: 12px;
+    height: 32px;
+}
+
+QComboBox QAbstractItemView::item:hover
+{
+    color: #FFFFFF;
+    border-radius:4px;
+    background-color: #438EFF;
+}
+
+QComboBox QAbstractItemView::item:selected
+{
+    color: #FFFFFF;
+    border-radius:4px;
+    background-color: #438EFF;
+}
+
+/******** combobox 滚动条  *********/
+QComboBox QScrollBar::vertical{ /*主体部分*/
+    width:8px;
+    background:transparent;
+    border:none;
+    border-radius:5px;
+}
+QComboBox QScrollBar::handle::vertical{ /*滑块主体*/
+    width: 8px;
+    background: #E2E2E2;
+    border-radius: 3px;
+    min-width: 8px;
+}
+QComboBox QScrollBar::handle::vertical::hover{
+    background:transparent;
+}
+QComboBox QScrollBar::add-line::vertical{/*上箭头*/
+    border:none;
+}
+QComboBox QScrollBar::sub-line::vertical{/*下箭头*/
+    border:none;
+}
+
+
+/* ==========================================================
+ *  时间报警红框
+ * ========================================================== */
+
+TimeWidget
+{
+    background: transparent;
+    /* background: #373639; */
+    border-radius: 4px;
+    padding-left:12px;
+    border: 1px solid rgba(255,255,255,0.15);
+}
+TimeWidget:hover
+{
+    background: transparent;
+    /* background: #373639; */
+    border-radius: 4px;
+    padding-left:12px;
+    border: 1px solid #438EFF;
+}
+
+QPushButton#pBtn_selectTime
+{
+    /* font-family: 思源黑体R; */
+    background: transparent;
+    border: 1px solid rgba(255,255,255,0.15);
+    border-radius: 4px;
+    font-size: 14px;
+    /* font-weight: 400; */
+    padding-left: 12px;
+    text-align: left;
+}
+
+QPushButton#pBtn_selectTime:hover
+{
+    /* font-family: 思源黑体R; */
+    background: transparent;
+    border: 1px solid #438EFF;
+    border-radius: 4px;
+    font-size: 14px;
+    /* font-weight: 400; */
+    padding-left: 12px;
+    text-align: left;
+}
+/* 报警红框 */
+QPushButton#pBtn_selectTime[Warn=true]
+{
+	background: transparent;
+    border-radius: 4px;
+    padding-left:12px;
+    border: 1px solid #D21F21;
+}
+
+
+/* ==========================================================
+ *  日期选择器
+ * ========================================================== */
+
+CalendarDTEdit
+{
+	background: transparent;
+    border-radius: 4px;
+    padding-left:12px;
+    border: 1px solid rgba(255,255,255,0.15);
+}
+
+CalendarDTEdit:hover
+{
+	background: transparent;
+    border-radius: 4px;
+    padding-left:12px;
+    border: 1px solid #438EFF;
+}
+
+CalendarDTEdit[Warn=true]
+{
+	background: transparent;
+    border-radius: 4px;
+    padding-left:12px;
+    border: 1px solid #D21F21;
+}
+
+CalendarDTEdit:!enabled/* 或者disable */
+{
+    background: rgba(0,0,0,0.04);
+    border: 1px solid #E6E9F4;
+}
+
+CalendarDTEdit::drop-down
+{
+ 	padding-right:8px;
+	width: 16px;
+    image: url(:/ICON/ICON/date_dark.png);
+}
+
+/* ==========================================================
+ *  QTabWidget
+ * ========================================================== */
+
+/* 设置 TabBar 的整体背景颜色 */
+QTabBar 
+{
+    background: #555557; /* 整体背景颜色 */
+    border-radius: 2px; /* 圆角 */
+}
+
+/* 设置标签的默认样式 */
+QTabBar::tab 
+{
+    min-width: 66px; /* 标签最小宽度 */
+    min-height: 28px; /* 标签最小高度 */
+    border-radius: 2px; /* 圆角 */
+    margin: 6px;
+
+    font-weight: 400;
+    font-size: 14px;
+    color: #B1B3B4;
+    line-height: 20px;
+    text-align: left;
+    font-style: normal;
+    text-transform: none;
+}
+
+/* 设置选中标签的样式 */
+QTabBar::tab:selected 
+{
+    background: #438EFF; /* 选中标签的背景颜色 */
+    border-radius: 2px; /* 圆角 */
+    margin: 6px; /* 内缩 6px */
+
+    font-weight: 500;
+    font-size: 14px;
+    color: #FFFFFF;
+    line-height: 20px;
+    text-align: left;
+    font-style: normal;
+    text-transform: none;
+}
+
+QTabWidget::pane
+{
+    border: none; /* 去掉边框 */
+}
+
+QWidget#tab_week, #tab_special
+{
+    background: #464649;
+    border-radius: 0px;
+    border: 0px solid rgba(255,255,255,0.15);
+}

+ 71 - 0
TransmitterSwitch/Resource/QSS/dark/plancard.qss

@@ -0,0 +1,71 @@
+
+/* ================================================================
+ * 外框
+ * ================================================================ */
+
+QWidget#widget
+{
+    border-radius: 4px 4px 4px 4px;
+    border: 1px solid rgba(255,255,255,0.15);
+}
+
+QWidget#widget[isSelected = "true"]
+{
+    border-radius: 4px 4px 4px 4px;
+    border: 1px solid #438EFF;
+}
+
+
+
+/* 标题 */
+QLabel#label_title
+{
+    font-weight: 500;
+    font-size: 16px;
+    color: #D2D2D2;
+    line-height: 22px;
+    text-align: left;
+    font-style: normal;
+    text-transform: none;
+
+    padding-left: 12px;
+}
+
+
+/* ================================================================
+ * TableView
+ * ================================================================ */
+
+/* 表格标题 */
+QWidget#widget_tableHeader
+{
+    background: #313539;
+    border-radius: 0px 0px 0px 0px;
+}
+
+QLabel#label_onTime, #label_offTime
+{
+    font-weight: 500;
+    font-size: 14px;
+    color: #D2D2D2;
+    line-height: 22px;
+    text-align: left;
+    font-style: normal;
+    text-transform: none;
+
+    padding-left: 12px;
+}
+
+QTableView#tableView
+{
+    font-weight: 400;
+    font-size: 14px;
+    color: #B1B3B4;
+    line-height: 22px;
+    text-align: left;
+    font-style: normal;
+    text-transform: none;
+
+    padding-left: 12px;
+    border: 0px;
+}

+ 5 - 3
TransmitterSwitch/Resource/TransSwitch.qrc

@@ -12,10 +12,8 @@
         <file>QSS/white/SelectTime/timewidget.qss</file>
         <file>QSS/white/SelectDate/calendarheader.qss</file>
         <file>QSS/white/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>
@@ -25,6 +23,8 @@
         <file>QSS/dark/SelectDate/calendarheader.qss</file>
         <file>QSS/dark/SelectDate/calendarnav.qss</file>
         <file>QSS/dark/pBtn_frequency.qss</file>
+        <file>QSS/dark/plancard.qss</file>
+        <file>QSS/dark/managerplan.qss</file>
     </qresource>
     <qresource prefix="/ICON">
         <file>Tip/Complete2x.png</file>
@@ -46,10 +46,12 @@
         <file>ICON/date_dark.png</file>
         <file>ICON/date_light.png</file>
         <file>ICON/DownArrow_Light.png</file>
+        <file>ICON/DownArrow_Dark.png</file>
         <file>ICON/Close_Dark.png</file>
         <file>ICON/Close_Light.png</file>
         <file>ICON/Close_pass.png</file>
-        <file>ICON/DownArrow_Dark.png</file>
+        <file>ICON/space_dark.png</file>
+        <file>ICON/space_light.png</file>
     </qresource>
     <qresource prefix="/Font">
         <!-- <file>font/SiYuanBlack_ttf/SiYuanBlack_Bold.ttf</file>

+ 26 - 0
TransmitterSwitch/UIStyle/UIStyleManager.cpp

@@ -69,6 +69,32 @@ void UIStyleManager::readQSSFile()
     }else {
         LH_WRITE_ERROR(QString("打开样式表失败: %1").arg(qssPath));
     }
+
+    /* 打开PlanCard样式 */
+    qssPath.clear();
+    qssPath = EPUIStyle.getQSSPath() + "/plancard.qss";
+    file.setFileName(qssPath);
+    if(file.open(QFile::ReadOnly))
+    {
+        QString qss = file.readAll();
+        StrQSS_PlanCard = qss;
+        file.close();
+    }else {
+        LH_WRITE_ERROR(QString("打开样式表失败: %1").arg(qssPath));
+    }
+
+    /* 打开ManagerPlan样式 */
+    qssPath.clear();
+    qssPath = EPUIStyle.getQSSPath() + "/managerplan.qss";
+    file.setFileName(qssPath);
+    if(file.open(QFile::ReadOnly))
+    {
+        QString qss = file.readAll();
+        StrQSS_ManagerPlan = qss;
+        file.close();
+    }else {
+        LH_WRITE_ERROR(QString("打开样式表失败: %1").arg(qssPath));
+    }
 }
 
 

+ 1 - 0
TransmitterSwitch/UIStyle/UIStyleManager.h

@@ -42,6 +42,7 @@ public:
     QString StrQSS_TransmitterSwitch;       /* 主窗口样式表 */
     QString StrQSS_PBtnFrequency;           /* 频率按钮样式表 */
     QString StrQSS_PlanCard;                /* 计划卡片样式表 */
+    QString StrQSS_ManagerPlan;             /* 计划管理窗口样式表 */
 
     /* 获取样式表路径 */
     QString getQSSPath();

+ 7 - 7
TransmitterSwitch/WebAPI/FromWebAPI.cpp

@@ -175,13 +175,13 @@ bool FromWebAPI::getDeviceInfo(QMap<QString, DeviceInfo>& mapDevice)
 bool FromWebAPI::getChannelInfo(QMap<int, ChannelInfo>& mapFreq)
 {
     /* 测试,创建几个频率 */
-    for(int i = 0; i < 12; i++)
-    {
-        ChannelInfo freqInfo;
-        freqInfo.ChannelID = i + 1;
-        freqInfo.ChannelName = QString("频率%1").arg(freqInfo.ChannelID);
-        mapFreq.insert(freqInfo.ChannelID, freqInfo);
-    }
+    // for(int i = 0; i < 12; i++)
+    // {
+    //     ChannelInfo freqInfo;
+    //     freqInfo.ChannelID = i + 1;
+    //     freqInfo.ChannelName = QString("频率%1").arg(freqInfo.ChannelID);
+    //     mapFreq.insert(freqInfo.ChannelID, freqInfo);
+    // }
 
 
 

+ 0 - 67
TransmitterSwitch/WidgetItems/widgetitems.cpp

@@ -1,67 +0,0 @@
-#include "widgetitems.h"
-#include "ui_widgetitems.h"
-
-
-
-WidgetItems::WidgetItems(QWidget *parent) :
-    QWidget(parent),
-    ui(new Ui::WidgetItems)
-{
-    ui->setupUi(this);
-
-    /* 设置日期格式 */
-    setDayType(false);
-    /* 设置layout */
-    if(ui->widget_items->layout() != nullptr)
-    {
-        delete ui->widget_items->layout();
-    }
-    m_layout = new QVBoxLayout(ui->widget_items);
-    ui->widget_items->setLayout(m_layout);
-    m_layout->setMargin(0);
-    m_layout->setSpacing(0);
-
-}
-
-WidgetItems::~WidgetItems()
-{
-
-    delete ui;
-}
-
-
-/* 设置日期格式,正常日还是特殊日 */
-void WidgetItems::setDayType(bool isSpecial)
-{
-    if(isSpecial)
-    {
-        /* 显示特殊日期 */
-        ui->label_execDate->show();
-
-        ui->label_num->move(16, 12);
-        ui->label_devName->move(112, 12);
-        ui->label_execDate->move(388, 12);
-        ui->label_execTime->move(536, 12);
-        ui->label_action->move(684, 12);
-        ui->label_operate->move(960, 12);
-    }else
-    {
-        /* 隐藏特殊日期 */
-        ui->label_execDate->hide();
-
-        ui->label_num->move(16, 12);
-        ui->label_devName->move(112, 12);
-        ui->label_execTime->move(388, 12);
-        ui->label_action->move(536, 12);
-        ui->label_operate->move(814, 12);
-    }
-}
-
-
-/* 获取layout,真正存储item的地方 */
-QLayout* WidgetItems::getLayout()
-{
-    return m_layout;
-}
-
-

+ 0 - 29
TransmitterSwitch/WidgetItems/widgetitems.h

@@ -1,29 +0,0 @@
-#ifndef WIDGETITEMS_H
-#define WIDGETITEMS_H
-
-#include <QWidget>
-#include <QVBoxLayout>
-
-namespace Ui {
-class WidgetItems;
-}
-
-class WidgetItems : public QWidget
-{
-    Q_OBJECT
-
-public:
-    explicit WidgetItems(QWidget *parent = nullptr);
-    ~WidgetItems();
-
-    /* 设置日期格式,正常日还是特殊日 */
-    void setDayType(bool isSpecial);
-    /* 获取layout,真正存储item的地方 */
-    QLayout* getLayout();
-private:
-    Ui::WidgetItems *ui;
-
-    QVBoxLayout* m_layout = nullptr;        /* 存储item的地方 */
-};
-
-#endif // WIDGETITEMS_H

+ 0 - 207
TransmitterSwitch/WidgetItems/widgetitems.ui

@@ -1,207 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>WidgetItems</class>
- <widget class="QWidget" name="WidgetItems">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>1459</width>
-    <height>797</height>
-   </rect>
-  </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_items_background" native="true">
-     <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_top" 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>45</height>
-         </size>
-        </property>
-        <property name="maximumSize">
-         <size>
-          <width>16777215</width>
-          <height>45</height>
-         </size>
-        </property>
-        <widget class="QLabel" name="label_num">
-         <property name="geometry">
-          <rect>
-           <x>17</x>
-           <y>11</y>
-           <width>32</width>
-           <height>22</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>序号</string>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_devName">
-         <property name="geometry">
-          <rect>
-           <x>114</x>
-           <y>11</y>
-           <width>32</width>
-           <height>22</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>设备</string>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_execTime">
-         <property name="geometry">
-          <rect>
-           <x>389</x>
-           <y>11</y>
-           <width>72</width>
-           <height>22</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>执行时间</string>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_action">
-         <property name="geometry">
-          <rect>
-           <x>537</x>
-           <y>11</y>
-           <width>32</width>
-           <height>22</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>动作</string>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_operate">
-         <property name="geometry">
-          <rect>
-           <x>814</x>
-           <y>11</y>
-           <width>32</width>
-           <height>22</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>操作</string>
-         </property>
-        </widget>
-        <widget class="QLabel" name="label_execDate">
-         <property name="geometry">
-          <rect>
-           <x>290</x>
-           <y>11</y>
-           <width>72</width>
-           <height>22</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>执行日期</string>
-         </property>
-        </widget>
-       </widget>
-      </item>
-      <item>
-       <widget class="QScrollArea" name="scrollArea">
-        <property name="widgetResizable">
-         <bool>true</bool>
-        </property>
-        <widget class="QWidget" name="scrollAreaWidgetContents">
-         <property name="geometry">
-          <rect>
-           <x>0</x>
-           <y>0</y>
-           <width>1457</width>
-           <height>750</height>
-          </rect>
-         </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>0</number>
-          </property>
-          <property name="bottomMargin">
-           <number>0</number>
-          </property>
-          <item>
-           <widget class="QWidget" name="widget_items" native="true"/>
-          </item>
-          <item>
-           <spacer name="verticalSpacer">
-            <property name="orientation">
-             <enum>Qt::Vertical</enum>
-            </property>
-            <property name="sizeHint" stdset="0">
-             <size>
-              <width>20</width>
-              <height>725</height>
-             </size>
-            </property>
-           </spacer>
-          </item>
-         </layout>
-        </widget>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>

+ 9 - 6
TransmitterSwitch/transmitterswitch.cpp

@@ -10,7 +10,6 @@
 
 
 #include "LHQLogAPI.h"
-#include "widgetitems.h"
 #include "pBtnUserData2.h"
 #include "WebAPI/FromWebAPI.h"
 #include "TransmitterSwitchInfo.h"
@@ -24,6 +23,7 @@
 #include "PlanData.h"
 #include "PlanCard.h"
 #include "flowlayout.h"
+#include "managerplan.h"
 
 
 TransmitterSwitch::TransmitterSwitch(QWidget *parent) :
@@ -314,7 +314,10 @@ void TransmitterSwitch::setTrackCallBack(trackCallBack cb)
 /* 点击了添加计划按钮 */
 void TransmitterSwitch::do_pBtnAddExecPlan()
 {
-    
+    /* 创建新增窗口 */
+    std::shared_ptr<ManagerPlan> mp = std::make_shared<ManagerPlan>();
+
+    mp->exec();
 }
 
 
@@ -552,6 +555,8 @@ void TransmitterSwitch::showOneCard(QPushButton *btn)
     /* 判断是否是显示全部卡片的按钮 */
     if(btn == ui->pBtn_allFrequency)
     {
+        /* 设置卡片间的横向间距 */
+        m_flowlayout->setHorizontalSpacing(m_cardHorSpacing);
         /* 显示全部卡片 */
         for(auto& it : m_listFrequencyBtn)
         {
@@ -566,13 +571,13 @@ void TransmitterSwitch::showOneCard(QPushButton *btn)
                 }
             }
         }
-        /* 设置卡片间的横向间距 */
-        m_flowlayout->setHorizontalSpacing(m_cardHorSpacing);
         /* 刷新布局,刷新了才会让FlowLayout重新布局 */
         ui->scrollAreaContents_Card->updateGeometry();
         return;
     }
 
+    /* 设置卡片间的横向间距 */
+    m_flowlayout->setHorizontalSpacing(0);
     /* 不是显示全部的按钮,隐藏所有卡片 */
     for(auto& it : m_listFrequencyBtn)
     {
@@ -598,8 +603,6 @@ void TransmitterSwitch::showOneCard(QPushButton *btn)
             pCard->show();
         }
     }
-    /* 设置卡片间的横向间距 */
-    m_flowlayout->setHorizontalSpacing(0);
     /* 刷新布局,刷新了才会让FlowLayout重新布局 */
     ui->scrollAreaContents_Card->updateGeometry();
 }