| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 | 
							- #include "widget.h"
 
- #include "ui_widget.h"
 
- // #include "LHQLogAPI.h"
 
- // #include "lhstylemanager.h"
 
- #include "spdlog/spdlog.h"
 
- // #include "TransmitterswitchInfo.h"
 
- // #include "lhtranmitterswitch.h"
 
- Widget::Widget(QWidget *parent) :
 
-     QWidget(parent),
 
-     ui(new Ui::Widget)
 
- {
 
-     ui->setupUi(this);
 
-     m_tSwitch = new LHTransmitterSwitchAPI();
 
-     if(m_tSwitch->loadLibrary())
 
-     {
 
-         SPDLOG_INFO("load library success");
 
-     }else {
 
-         SPDLOG_ERROR("load library failed");
 
-     }
 
-     /* 设置一个布局 */
 
-     m_layout = new QVBoxLayout(ui->widget_content);
 
-     ui->widget_content->setLayout(m_layout);
 
-     /* 添加一个容器 */
 
-     QWidget* container = new QWidget(this);
 
-     container->setObjectName("container");
 
-     m_layout->addWidget(container);
 
-     container->setStyleSheet(R"(background: transparent;)");
 
-     /* 设置边距为0 */
 
-     m_layout->setMargin(20);
 
-     m_layout->setSpacing(0);
 
-     ui->widget_content->setStyleSheet(R"(background: #000000;)");
 
-     /* 初始化WebAPI */
 
-     InitData initData;
 
-     initData.url = "http://192.1.3.133:31000/v6/";
 
-     initData.serverID = "2e36b53ccd2a433b9a803b98d683ed91";
 
-     initData.serverKey = "TMS";
 
-     m_tSwitch->DoInit(&initData);
 
-     m_tSwitch->DoCreateWindow(1, container);
 
-     // m_tSwitch->DoGetExecPlanFromEQM();
 
-     m_tSwitch->DoSetCallBack(trackCallBack);
 
-     m_style = 1;
 
-     // m_tSwitch->setWebAPIInfo("http://192.1.3.133:31000/v6/", "2e36b53ccd2a433b9a803b98d683ed91", "TMS");
 
-     /* 添加设备信息,测试用 */
 
-     // addTestDevice();
 
-     SPDLOG_INFO("Widget init success");
 
- }
 
- Widget::~Widget()
 
- {
 
- //     if(m_tSwitch != nullptr)
 
- //     {
 
- //         delete m_tSwitch;
 
- //         m_tSwitch = nullptr;
 
- //     }
 
- //     if(m_layout != nullptr)
 
- //     {
 
- //         delete m_layout;
 
- //         m_layout = nullptr;
 
- //     }
 
-     delete ui;
 
- }
 
- /* 导入数据按钮 */
 
- void Widget::on_pBtn_getData_clicked()
 
- {
 
-     if(m_tSwitch == nullptr)
 
-     {
 
-         SPDLOG_DEBUG("TransmitterSwitch is nullptr");
 
-         return;
 
-     }
 
-     m_tSwitch->DoGetExecPlanFromEQM();
 
- }
 
- /* 导出数据按钮 */
 
- void Widget::on_pBtn_saveData_clicked()
 
- {
 
-     if(m_tSwitch == nullptr)
 
-     {
 
-         SPDLOG_DEBUG("TransmitterSwitch is nullptr");
 
-         return;
 
-     }
 
-     m_tSwitch->DoSaveExecPlanToEQM();
 
- }
 
- /* 切换亮色/暗色的按钮 */
 
- void Widget::on_pBtn_light_dark_clicked()
 
- {
 
-     if(m_tSwitch == nullptr)
 
-     {
 
-         SPDLOG_DEBUG("TransmitterSwitch is nullptr");
 
-         return;
 
-     }
 
-     if(m_style == 0)
 
-     {
 
-         m_style = 1;
 
-         /* 当前是亮色,设置为暗色 */
 
-         m_tSwitch->DoShowWindow(m_style, true);
 
-     }else 
 
-     {
 
-         m_style = 0;
 
-         m_tSwitch->DoShowWindow(m_style, true);
 
-     }
 
- }
 
- /* 添加测试用的设备信息 */
 
- // void Widget::addTestDevice()
 
- // {
 
- //     auto devType = DevTypeContainer.getDevType(955);
 
- //     if(devType.PTTypeCode == -1)
 
- //     {
 
- //         return;
 
- //     }
 
- //     DeviceInfo devInfo;
 
- //     devInfo.devName = "衢州台主发射机";
 
- //     devInfo.PTTypeCode = 955;
 
- //     devInfo.DTID = 1;
 
- //     devInfo.DID = 1;
 
- //     devInfo.ChannelID = 1;
 
- //     devInfo.DevType = devType;
 
- //     DeviceContainer.addDevice(devInfo);
 
- //     devInfo.devName = "衢州台备发射机";
 
- //     devInfo.PTTypeCode = 955;
 
- //     devInfo.DTID = 1;
 
- //     devInfo.DID = 2;
 
- //     devInfo.ChannelID = 2;
 
- //     devInfo.DevType = devType;
 
- //     DeviceContainer.addDevice(devInfo);
 
-     
 
- // }
 
- /* 回调函数 */
 
- void Widget::trackCallBack(int actionID, QString strMemo)
 
- {
 
-     SPDLOG_INFO("回调函数: actionID: {}, strMemo: {}", actionID, strMemo.toStdString());
 
- }
 
 
  |