├── LaserHMI.pro ├── LaserHMI.pro.user ├── LaserHMI.pro.user.398c9b9 ├── LaserHMI.pro.user.67cb7f2 ├── LaserHMI.pro.user.cbf4ef1 ├── LaserHMI.pro.user.f55503b ├── README.md ├── Snapshots ├── ui1.png ├── ui2.png ├── ui3.png ├── ui4.png ├── ui5.png └── ui6.png ├── base ├── zbaseobj.cpp ├── zbaseobj.h ├── zbaseui.cpp ├── zbaseui.h ├── zdatetimechooser.cpp ├── zdatetimechooser.h ├── zpiechart.cpp └── zpiechart.h ├── ci ├── crc16.cpp ├── crc16.h ├── zbaseci.cpp ├── zbaseci.h ├── zlitronicsci.cpp └── zlitronicsci.h ├── db ├── zbasedb.cpp ├── zbasedb.h ├── zsqlitedb.cpp └── zsqlitedb.h ├── dump ├── zdbgserver.cpp └── zdbgserver.h ├── fonts ├── msyh.ttf └── wqy-microhei.ttc ├── gbl ├── hmi_const.cpp └── hmi_const.h ├── hmires.qrc ├── images ├── Keyboard │ ├── bottom.png │ ├── close.png │ ├── left.png │ ├── next.png │ ├── previous.png │ ├── right.png │ └── top.png ├── about │ └── logo.png ├── bottombar │ ├── Cancel.png │ ├── Console.png │ ├── Exit.png │ ├── Logout.png │ ├── Reboot.png │ └── Shutdown.png ├── chiller │ ├── BypassChiller.png │ └── ReEnableChiller.png ├── common │ ├── .directory │ ├── Checked.png │ ├── UnChecked.png │ ├── add.png │ ├── arrow.png │ ├── pushed_left.png │ ├── pushed_right.png │ ├── sub.png │ ├── up_left.png │ └── up_right.png ├── hzpy-utf8.txt ├── laser │ ├── mainCtl.png │ └── mdlCtl.png ├── led │ ├── led_green.png │ ├── led_red.png │ └── led_yellow.png ├── load │ └── background.png ├── log │ ├── Alarm.png │ ├── Chiller.png │ ├── Export.png │ ├── Keyboard.png │ ├── Laser.png │ ├── Operate.png │ ├── Search.png │ ├── Trash.png │ ├── next.png │ └── previous.png ├── login │ ├── .directory │ ├── background.png │ └── lock.png ├── mainctl │ ├── RGB_All.png │ ├── RGB_Blue.png │ ├── RGB_Green.png │ ├── RGB_Red.png │ ├── WhiteBalance.png │ ├── add.png │ ├── add1.png │ ├── add_gray.png │ ├── busy.png │ ├── circle_gray.png │ ├── circle_orange.png │ ├── colortemp.png │ ├── hexagon.png │ ├── sub.png │ ├── sub1.png │ └── sub_gray.png ├── navigate │ ├── about.png │ ├── chiller.png │ ├── debug.png │ ├── laser.png │ ├── log.png │ ├── network.png │ ├── setup.png │ ├── status.png │ └── sysinfo.png ├── op2 │ ├── add.png │ └── sub.png ├── summary │ ├── Left.png │ └── Right.png └── topbar │ ├── signal0.png │ ├── signal1.png │ ├── signal2.png │ └── signal3.png ├── main.cpp ├── ringbuffer ├── zringbuffer.cpp └── zringbuffer.h ├── skin └── defaultSkin ├── test_command ├── ui ├── log │ ├── zchillerlogui.cpp │ ├── zchillerlogui.h │ ├── zlaserlogui.cpp │ ├── zlaserlogui.h │ ├── zlogfilterdialog.cpp │ ├── zlogfilterdialog.h │ ├── zlogmanager.cpp │ ├── zlogmanager.h │ ├── zoperatelogui.cpp │ └── zoperatelogui.h ├── zaboutui.cpp ├── zaboutui.h ├── zbarui.cpp ├── zbarui.h ├── zbottombar.cpp ├── zbottombar.h ├── zcheckbox.cpp ├── zcheckbox.h ├── zchillerui.cpp ├── zchillerui.h ├── zcircleindicator.cpp ├── zcircleindicator.h ├── zcolortemptuningdia.cpp ├── zcolortemptuningdia.h ├── zcurveui.cpp ├── zcurveui.h ├── zdatetimesetdia.cpp ├── zdatetimesetdia.h ├── zdbgtestui.cpp ├── zdbgtestui.h ├── zdigkbd.cpp ├── zdigkbd.h ├── zframe.cpp ├── zframe.h ├── zfullkbd.cpp ├── zfullkbd.h ├── zlaserrunhoursui.cpp ├── zlaserrunhoursui.h ├── zlaserui.cpp ├── zlaserui.h ├── zlinelabel.cpp ├── zlinelabel.h ├── zloadui.cpp ├── zloadui.h ├── zloginui.cpp ├── zloginui.h ├── zlogui.cpp ├── zlogui.h ├── zmainctlui.cpp ├── zmainctlui.h ├── zmainui.cpp ├── zmainui.h ├── zmdlctlui.cpp ├── zmdlctlui.h ├── znavigateui.cpp ├── znavigateui.h ├── znetworkui.cpp ├── znetworkui.h ├── zprogressbar.cpp ├── zprogressbar.h ├── zpwrprecisionsetdialog.cpp ├── zpwrprecisionsetdialog.h ├── zshutdwndia.cpp ├── zshutdwndia.h ├── zspinbox.cpp ├── zspinbox.h ├── zsummaryui.cpp ├── zsummaryui.h ├── zsyssetupui.cpp ├── zsyssetupui.h ├── ztextcombobox.cpp ├── ztextcombobox.h ├── ztextimglabel.cpp ├── ztextimglabel.h ├── ztextlineeditlabel.cpp ├── ztextlineeditlabel.h ├── ztopbar.cpp ├── ztopbar.h ├── zupdatewizarddialog.cpp ├── zupdatewizarddialog.h ├── zverticalindicator.cpp ├── zverticalindicator.h ├── zvslider.cpp ├── zvslider.h ├── zwaitingdialog.cpp ├── zwaitingdialog.h ├── zwarningtipsdialog.cpp └── zwarningtipsdialog.h └── upload2hmi.sh /LaserHMI.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2017-04-25T13:34:47 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += core gui sql network serialport charts 8 | 9 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 10 | 11 | TARGET = LaserHMI 12 | TEMPLATE = app 13 | 14 | SOURCES += main.cpp\ 15 | base/zbaseobj.cpp \ 16 | base/zbaseui.cpp \ 17 | ui/zbarui.cpp \ 18 | ui/ztopbar.cpp \ 19 | ui/zbottombar.cpp \ 20 | ui/znavigateui.cpp \ 21 | ui/zmainui.cpp \ 22 | ui/zaboutui.cpp \ 23 | ui/zmainctlui.cpp \ 24 | ui/zlaserui.cpp \ 25 | ui/zmdlctlui.cpp \ 26 | ui/zframe.cpp \ 27 | ui/ztextimglabel.cpp \ 28 | ui/zlinelabel.cpp \ 29 | ui/zloginui.cpp \ 30 | ui/zchillerui.cpp \ 31 | ui/ztextlineeditlabel.cpp \ 32 | ui/log/zoperatelogui.cpp \ 33 | base/zdatetimechooser.cpp \ 34 | ui/log/zlaserlogui.cpp \ 35 | ui/log/zchillerlogui.cpp \ 36 | ui/zlogui.cpp \ 37 | ui/log/zlogmanager.cpp \ 38 | db/zbasedb.cpp \ 39 | db/zsqlitedb.cpp \ 40 | gbl/hmi_const.cpp \ 41 | ui/zloadui.cpp \ 42 | ringbuffer/zringbuffer.cpp \ 43 | ci/zbaseci.cpp \ 44 | ci/zlitronicsci.cpp \ 45 | ci/crc16.cpp \ 46 | ui/zvslider.cpp \ 47 | ui/zcurveui.cpp \ 48 | ui/zsummaryui.cpp \ 49 | ui/ztextcombobox.cpp \ 50 | ui/log/zlogfilterdialog.cpp \ 51 | ui/zdbgtestui.cpp \ 52 | ui/zcheckbox.cpp \ 53 | ui/zspinbox.cpp \ 54 | ui/zshutdwndia.cpp \ 55 | ui/zsyssetupui.cpp \ 56 | base/zpiechart.cpp \ 57 | ui/zdigkbd.cpp \ 58 | ui/zfullkbd.cpp \ 59 | dump/zdbgserver.cpp \ 60 | ui/zpwrprecisionsetdialog.cpp \ 61 | ui/zdatetimesetdia.cpp \ 62 | ui/zupdatewizarddialog.cpp \ 63 | ui/zlaserrunhoursui.cpp \ 64 | ui/znetworkui.cpp \ 65 | ui/zwaitingdialog.cpp \ 66 | ui/zcolortemptuningdia.cpp \ 67 | ui/zprogressbar.cpp \ 68 | ui/zcircleindicator.cpp \ 69 | ui/zverticalindicator.cpp \ 70 | ui/zwarningtipsdialog.cpp 71 | 72 | HEADERS += base/zbaseobj.h \ 73 | base/zbaseui.h \ 74 | ui/zbarui.h \ 75 | ui/ztopbar.h \ 76 | ui/zbottombar.h \ 77 | ui/znavigateui.h \ 78 | ui/zmainui.h \ 79 | ui/zaboutui.h \ 80 | gbl/hmi_const.h \ 81 | ui/zmainctlui.h \ 82 | ui/zlaserui.h \ 83 | ui/zmdlctlui.h \ 84 | ui/zframe.h\ 85 | ui/ztextimglabel.h \ 86 | ui/zlinelabel.h \ 87 | ui/zloginui.h \ 88 | ui/zchillerui.h \ 89 | ui/ztextlineeditlabel.h \ 90 | ui/log/zoperatelogui.h \ 91 | base/zdatetimechooser.h \ 92 | ui/log/zlaserlogui.h \ 93 | ui/log/zchillerlogui.h \ 94 | ui/zlogui.h \ 95 | ui/log/zlogmanager.h \ 96 | db/zbasedb.h \ 97 | db/zsqlitedb.h \ 98 | ui/zloadui.h \ 99 | ringbuffer/zringbuffer.h \ 100 | ci/zbaseci.h \ 101 | ci/zlitronicsci.h \ 102 | ci/crc16.h \ 103 | ui/zvslider.h \ 104 | ui/zcurveui.h \ 105 | ui/zsummaryui.h \ 106 | ui/ztextcombobox.h \ 107 | ui/log/zlogfilterdialog.h \ 108 | ui/zdbgtestui.h \ 109 | ui/zcheckbox.h \ 110 | ui/zspinbox.h \ 111 | ui/zshutdwndia.h \ 112 | ui/zsyssetupui.h \ 113 | base/zpiechart.h \ 114 | ui/zdigkbd.h \ 115 | ui/zfullkbd.h \ 116 | dump/zdbgserver.h \ 117 | ui/zpwrprecisionsetdialog.h \ 118 | ui/zdatetimesetdia.h \ 119 | ui/zupdatewizarddialog.h \ 120 | ui/zlaserrunhoursui.h \ 121 | ui/znetworkui.h \ 122 | ui/zwaitingdialog.h \ 123 | ui/zcolortemptuningdia.h \ 124 | ui/zprogressbar.h \ 125 | ui/zcircleindicator.h \ 126 | ui/zverticalindicator.h \ 127 | ui/zwarningtipsdialog.h 128 | 129 | RESOURCES += \ 130 | hmires.qrc 131 | 132 | DISTFILES += \ 133 | skin/defaultSkin \ 134 | test_command 135 | 136 | INCLUDEPATH += /home/shell.albert/CAMC/6QWeb/qrcode-master/libqr 137 | LIBS += -L/home/shell.albert/CAMC/6QWeb/qrcode-master/build4x64 -lqr 138 | target.path = /HMI 139 | INSTALLS += target 140 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LaserHMI 2 | LaserHMI is a Qt-based project to supply control and monitor of Projector Laser Light Source in cinema. 3 | ![ui1.png](https://github.com/ShellAlbert/LaserHMI/blob/master/Snapshots/ui1.png) 4 | ![ui2.png](https://github.com/ShellAlbert/LaserHMI/blob/master/Snapshots/ui2.png) 5 | ![ui3.png](https://github.com/ShellAlbert/LaserHMI/blob/master/Snapshots/ui3.png) 6 | ![ui4.png](https://github.com/ShellAlbert/LaserHMI/blob/master/Snapshots/ui4.png) 7 | ![ui5.png](https://github.com/ShellAlbert/LaserHMI/blob/master/Snapshots/ui5.png) 8 | ![ui6.png](https://github.com/ShellAlbert/LaserHMI/blob/master/Snapshots/ui6.png) 9 | -------------------------------------------------------------------------------- /Snapshots/ui1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/Snapshots/ui1.png -------------------------------------------------------------------------------- /Snapshots/ui2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/Snapshots/ui2.png -------------------------------------------------------------------------------- /Snapshots/ui3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/Snapshots/ui3.png -------------------------------------------------------------------------------- /Snapshots/ui4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/Snapshots/ui4.png -------------------------------------------------------------------------------- /Snapshots/ui5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/Snapshots/ui5.png -------------------------------------------------------------------------------- /Snapshots/ui6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/Snapshots/ui6.png -------------------------------------------------------------------------------- /base/zbaseobj.cpp: -------------------------------------------------------------------------------- 1 | #include "zbaseobj.h" 2 | 3 | ZBaseObj::ZBaseObj(QWidget *parent) 4 | : QFrame(parent) 5 | { 6 | } 7 | 8 | ZBaseObj::~ZBaseObj() 9 | { 10 | 11 | } 12 | 13 | void ZBaseObj::ZDoInitial() 14 | { 15 | 16 | } 17 | 18 | void ZBaseObj::ZUnInitial() 19 | { 20 | 21 | } 22 | -------------------------------------------------------------------------------- /base/zbaseobj.h: -------------------------------------------------------------------------------- 1 | #ifndef ZBASEOBJ_H 2 | #define ZBASEOBJ_H 3 | 4 | #include 5 | 6 | class ZBaseObj : public QFrame 7 | { 8 | Q_OBJECT 9 | public: 10 | ZBaseObj(QWidget *parent = 0); 11 | ~ZBaseObj(); 12 | 13 | virtual void ZDoInitial(void); 14 | virtual void ZUnInitial(void); 15 | }; 16 | 17 | #endif // ZBASEOBJ_H 18 | -------------------------------------------------------------------------------- /base/zbaseui.cpp: -------------------------------------------------------------------------------- 1 | #include "zbaseui.h" 2 | #include 3 | #include 4 | ZBaseUI::ZBaseUI() 5 | { 6 | 7 | } 8 | ZBaseUI::~ZBaseUI() 9 | { 10 | 11 | } 12 | 13 | void ZBaseUI::ZSloGetDeviceStatus(void) 14 | { 15 | 16 | } 17 | 18 | ZLabelLineEditCheckBox::ZLabelLineEditCheckBox(QString labelText,QString lineEditText,QString checkBoxText,bool checked,bool checkedVisible) 19 | { 20 | this->setObjectName("ZLabelFocusLineEditCheckBox"); 21 | this->m_ll=new QLabel; 22 | this->m_ll->setObjectName("ZLabelFocusLineEditCheckBox_Label"); 23 | this->m_ll->setText(labelText); 24 | this->m_ll->setAlignment(Qt::AlignCenter); 25 | 26 | this->m_le=new QLineEdit; 27 | this->m_le->setText(lineEditText); 28 | this->m_le->setAlignment(Qt::AlignCenter); 29 | this->m_le->installEventFilter(this); 30 | 31 | this->m_cb=new QCheckBox; 32 | this->m_cb->setText(checkBoxText); 33 | this->m_cb->setChecked(checked); 34 | this->m_cb->setVisible(checkedVisible); 35 | 36 | this->m_hLayout=new QHBoxLayout; 37 | this->m_hLayout->addWidget(this->m_ll); 38 | this->m_hLayout->addWidget(this->m_le); 39 | this->m_hLayout->addWidget(this->m_cb); 40 | this->setLayout(this->m_hLayout); 41 | 42 | } 43 | ZLabelLineEditCheckBox::~ZLabelLineEditCheckBox() 44 | { 45 | delete this->m_ll; 46 | delete this->m_le; 47 | delete this->m_cb; 48 | delete this->m_hLayout; 49 | } 50 | QString ZLabelLineEditCheckBox::ZGetLineEditText() 51 | { 52 | return this->m_le->text().trimmed(); 53 | } 54 | void ZLabelLineEditCheckBox::ZSetLineEditText(QString data) 55 | { 56 | this->m_le->setText(data); 57 | } 58 | bool ZLabelLineEditCheckBox::ZIsChecked() 59 | { 60 | return this->m_cb->isChecked(); 61 | } 62 | bool ZLabelLineEditCheckBox::eventFilter(QObject *watched, QEvent *event) 63 | { 64 | if(watched==this->m_le) 65 | { 66 | if(event->type()==QEvent::MouseButtonPress) 67 | { 68 | emit this->ZSigLineEditClicked(); 69 | return true; 70 | } 71 | } 72 | return QFrame::eventFilter(watched,event); 73 | } 74 | -------------------------------------------------------------------------------- /base/zbaseui.h: -------------------------------------------------------------------------------- 1 | #ifndef ZBASEUI_H 2 | #define ZBASEUI_H 3 | 4 | #include 5 | #include "base/zbaseobj.h" 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | class ZBaseUI : public ZBaseObj 12 | { 13 | Q_OBJECT 14 | public: 15 | ZBaseUI(); 16 | ~ZBaseUI(); 17 | private slots: 18 | virtual void ZSloGetDeviceStatus(void); 19 | 20 | protected: 21 | QTimer *m_tmGetDevStatus; 22 | }; 23 | class ZLabelLineEditCheckBox:public QFrame 24 | { 25 | Q_OBJECT 26 | public: 27 | ZLabelLineEditCheckBox(QString labelText,QString lineEditText,QString checkBoxText,bool checked,bool checkedVisible=true); 28 | ~ZLabelLineEditCheckBox(); 29 | 30 | QString ZGetLineEditText(); 31 | void ZSetLineEditText(QString data); 32 | bool ZIsChecked(); 33 | signals: 34 | void ZSigLineEditClicked(); 35 | protected: 36 | bool eventFilter(QObject *watched, QEvent *event); 37 | 38 | private: 39 | QHBoxLayout *m_hLayout; 40 | QLabel *m_ll; 41 | QLineEdit *m_le; 42 | QCheckBox *m_cb; 43 | }; 44 | #endif // ZBASEUI_H 45 | -------------------------------------------------------------------------------- /base/zdatetimechooser.cpp: -------------------------------------------------------------------------------- 1 | #include "zdatetimechooser.h" 2 | #include 3 | ZDateTimeChooser::ZDateTimeChooser(QString tips) 4 | { 5 | this->setObjectName("ZDateTimeChooser"); 6 | this->m_llTips=new QLabel(tips); 7 | this->m_llTips->setObjectName("ZDateTimeChooserLabel"); 8 | this->m_le=new QLineEdit; 9 | this->m_le->setText(QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss")); 10 | this->m_ll=new QLabel; 11 | this->m_ll->setPixmap(QPixmap(":/log/images/log/Keyboard.png").scaled(24,24)); 12 | this->m_hLayout=new QHBoxLayout; 13 | this->m_hLayout->addWidget(this->m_llTips); 14 | this->m_hLayout->addWidget(this->m_le); 15 | this->m_hLayout->addWidget(this->m_ll); 16 | this->setLayout(this->m_hLayout); 17 | } 18 | ZDateTimeChooser::~ZDateTimeChooser() 19 | { 20 | delete this->m_llTips; 21 | delete this->m_le; 22 | delete this->m_ll; 23 | delete this->m_hLayout; 24 | } 25 | -------------------------------------------------------------------------------- /base/zdatetimechooser.h: -------------------------------------------------------------------------------- 1 | #ifndef ZDATETIMECHOOSER_H 2 | #define ZDATETIMECHOOSER_H 3 | 4 | #include "base/zbaseui.h" 5 | #include 6 | #include 7 | #include 8 | class ZDateTimeChooser : public ZBaseUI 9 | { 10 | Q_OBJECT 11 | public: 12 | ZDateTimeChooser(QString tips); 13 | ~ZDateTimeChooser(); 14 | 15 | private: 16 | QLabel *m_llTips; 17 | QLineEdit *m_le; 18 | QLabel *m_ll; 19 | QHBoxLayout *m_hLayout; 20 | }; 21 | 22 | #endif // ZDATETIMECHOOSER_H 23 | -------------------------------------------------------------------------------- /base/zpiechart.cpp: -------------------------------------------------------------------------------- 1 | #include "zpiechart.h" 2 | 3 | ZPieChart::ZPieChart(QString chartTitle,QVector pieVector) 4 | { 5 | this->m_series=new QPieSeries; 6 | this->m_series->setLabelsVisible(true); 7 | this->m_series->setLabelsPosition(QPieSlice::LabelInsideTangential); 8 | for(qint32 i=0;im_series->append(oneData.oneTitle,oneData.onePercent); 12 | qDebug()<m_series->slices().at(i); 18 | slice->setColor(oneData.oneColor); 19 | } 20 | this->m_chart=new QChart; 21 | this->m_chart->addSeries(this->m_series); 22 | this->m_chart->setTitle(chartTitle); 23 | 24 | this->m_chartView=new QChartView(this->m_chart); 25 | this->m_chartView->setRenderHint(QPainter::Antialiasing); 26 | 27 | this->m_vLayout=new QVBoxLayout; 28 | this->m_vLayout->addWidget(this->m_chartView); 29 | this->setLayout(this->m_vLayout); 30 | } 31 | ZPieChart::~ZPieChart() 32 | { 33 | delete this->m_series; 34 | delete this->m_chart; 35 | delete this->m_chartView; 36 | delete this->m_vLayout; 37 | } 38 | -------------------------------------------------------------------------------- /base/zpiechart.h: -------------------------------------------------------------------------------- 1 | #ifndef ZPIECHART_H 2 | #define ZPIECHART_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | class PieOne 9 | { 10 | public: 11 | QString oneTitle; 12 | qint32 onePercent; 13 | QColor oneColor; 14 | }; 15 | class ZPieChart : public QFrame 16 | { 17 | public: 18 | ZPieChart(QString chartTitle,QVector pieVector); 19 | ~ZPieChart(); 20 | private: 21 | QPieSeries *m_series; 22 | QChart *m_chart; 23 | QChartView *m_chartView; 24 | QVBoxLayout *m_vLayout; 25 | }; 26 | 27 | #endif // ZPIECHART_H 28 | -------------------------------------------------------------------------------- /ci/crc16.cpp: -------------------------------------------------------------------------------- 1 | #include "ci/crc16.h" 2 | unsigned short ccitt_table[256] = { 3 | 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7, 4 | 0x8108, 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF, 5 | 0x1231, 0x0210, 0x3273, 0x2252, 0x52B5, 0x4294, 0x72F7, 0x62D6, 6 | 0x9339, 0x8318, 0xB37B, 0xA35A, 0xD3BD, 0xC39C, 0xF3FF, 0xE3DE, 7 | 0x2462, 0x3443, 0x0420, 0x1401, 0x64E6, 0x74C7, 0x44A4, 0x5485, 8 | 0xA56A, 0xB54B, 0x8528, 0x9509, 0xE5EE, 0xF5CF, 0xC5AC, 0xD58D, 9 | 0x3653, 0x2672, 0x1611, 0x0630, 0x76D7, 0x66F6, 0x5695, 0x46B4, 10 | 0xB75B, 0xA77A, 0x9719, 0x8738, 0xF7DF, 0xE7FE, 0xD79D, 0xC7BC, 11 | 0x48C4, 0x58E5, 0x6886, 0x78A7, 0x0840, 0x1861, 0x2802, 0x3823, 12 | 0xC9CC, 0xD9ED, 0xE98E, 0xF9AF, 0x8948, 0x9969, 0xA90A, 0xB92B, 13 | 0x5AF5, 0x4AD4, 0x7AB7, 0x6A96, 0x1A71, 0x0A50, 0x3A33, 0x2A12, 14 | 0xDBFD, 0xCBDC, 0xFBBF, 0xEB9E, 0x9B79, 0x8B58, 0xBB3B, 0xAB1A, 15 | 0x6CA6, 0x7C87, 0x4CE4, 0x5CC5, 0x2C22, 0x3C03, 0x0C60, 0x1C41, 16 | 0xEDAE, 0xFD8F, 0xCDEC, 0xDDCD, 0xAD2A, 0xBD0B, 0x8D68, 0x9D49, 17 | 0x7E97, 0x6EB6, 0x5ED5, 0x4EF4, 0x3E13, 0x2E32, 0x1E51, 0x0E70, 18 | 0xFF9F, 0xEFBE, 0xDFDD, 0xCFFC, 0xBF1B, 0xAF3A, 0x9F59, 0x8F78, 19 | 0x9188, 0x81A9, 0xB1CA, 0xA1EB, 0xD10C, 0xC12D, 0xF14E, 0xE16F, 20 | 0x1080, 0x00A1, 0x30C2, 0x20E3, 0x5004, 0x4025, 0x7046, 0x6067, 21 | 0x83B9, 0x9398, 0xA3FB, 0xB3DA, 0xC33D, 0xD31C, 0xE37F, 0xF35E, 22 | 0x02B1, 0x1290, 0x22F3, 0x32D2, 0x4235, 0x5214, 0x6277, 0x7256, 23 | 0xB5EA, 0xA5CB, 0x95A8, 0x8589, 0xF56E, 0xE54F, 0xD52C, 0xC50D, 24 | 0x34E2, 0x24C3, 0x14A0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, 25 | 0xA7DB, 0xB7FA, 0x8799, 0x97B8, 0xE75F, 0xF77E, 0xC71D, 0xD73C, 26 | 0x26D3, 0x36F2, 0x0691, 0x16B0, 0x6657, 0x7676, 0x4615, 0x5634, 27 | 0xD94C, 0xC96D, 0xF90E, 0xE92F, 0x99C8, 0x89E9, 0xB98A, 0xA9AB, 28 | 0x5844, 0x4865, 0x7806, 0x6827, 0x18C0, 0x08E1, 0x3882, 0x28A3, 29 | 0xCB7D, 0xDB5C, 0xEB3F, 0xFB1E, 0x8BF9, 0x9BD8, 0xABBB, 0xBB9A, 30 | 0x4A75, 0x5A54, 0x6A37, 0x7A16, 0x0AF1, 0x1AD0, 0x2AB3, 0x3A92, 31 | 0xFD2E, 0xED0F, 0xDD6C, 0xCD4D, 0xBDAA, 0xAD8B, 0x9DE8, 0x8DC9, 32 | 0x7C26, 0x6C07, 0x5C64, 0x4C45, 0x3CA2, 0x2C83, 0x1CE0, 0x0CC1, 33 | 0xEF1F, 0xFF3E, 0xCF5D, 0xDF7C, 0xAF9B, 0xBFBA, 0x8FD9, 0x9FF8, 34 | 0x6E17, 0x7E36, 0x4E55, 0x5E74, 0x2E93, 0x3EB2, 0x0ED1, 0x1EF0 35 | }; 36 | 37 | unsigned short crc16_ccitt(unsigned char *q, int len) 38 | { 39 | unsigned short crc = 0; 40 | 41 | while (len-- > 0) 42 | crc = ccitt_table[(crc >> 8 ^ *q++) & 0xff] ^ (crc << 8); 43 | return ~crc; 44 | 45 | } 46 | -------------------------------------------------------------------------------- /ci/crc16.h: -------------------------------------------------------------------------------- 1 | #ifndef CRC16_H 2 | #define CRC16_H 3 | extern unsigned short ccitt_table[256]; 4 | extern unsigned short crc16_ccitt(unsigned char *q, int len); 5 | #endif // CRC16_H 6 | -------------------------------------------------------------------------------- /ci/zbaseci.cpp: -------------------------------------------------------------------------------- 1 | #include "zbaseci.h" 2 | 3 | ZBaseCI::ZBaseCI() 4 | { 5 | 6 | } 7 | qint32 ZBaseCI::ZPacketCmdToBuffer(char *buffer,const qint32 bufSize) 8 | { 9 | return 0; 10 | } 11 | qint32 ZBaseCI::ZParseCmdFromBuffer(const char *buffer,const qint32 bufSize) 12 | { 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /ci/zbaseci.h: -------------------------------------------------------------------------------- 1 | #ifndef ZBASECI_H 2 | #define ZBASECI_H 3 | 4 | #include 5 | class ZBaseCI 6 | { 7 | public: 8 | ZBaseCI(); 9 | 10 | virtual qint32 ZPacketCmdToBuffer(char *buffer,const qint32 bufSize); 11 | virtual qint32 ZParseCmdFromBuffer(const char *buffer,const qint32 bufSize); 12 | }; 13 | 14 | #endif // ZBASECI_H 15 | -------------------------------------------------------------------------------- /db/zbasedb.cpp: -------------------------------------------------------------------------------- 1 | #include "zbasedb.h" 2 | 3 | ZBaseDB::ZBaseDB() 4 | { 5 | 6 | } 7 | qint32 ZBaseDB::ZDoInit(void) 8 | { 9 | return 0; 10 | } 11 | qint32 ZBaseDB::ZUnInit(void) 12 | { 13 | return 0; 14 | } 15 | qint32 ZBaseDB::ZOpenDB(QString dbName,bool createFlag) 16 | { 17 | return 0; 18 | } 19 | qint32 ZBaseDB::ZCloseDB(QString dbName) 20 | { 21 | return 0; 22 | } 23 | qint32 ZBaseDB::ZExecuteSql(QString sql) 24 | { 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /db/zbasedb.h: -------------------------------------------------------------------------------- 1 | #ifndef ZBASEDB_H 2 | #define ZBASEDB_H 3 | 4 | #include 5 | class ZBaseDB 6 | { 7 | public: 8 | ZBaseDB(); 9 | 10 | virtual qint32 ZDoInit(void); 11 | virtual qint32 ZUnInit(void); 12 | virtual qint32 ZOpenDB(QString dbName,bool createFlag=false); 13 | virtual qint32 ZCloseDB(QString dbName); 14 | virtual qint32 ZExecuteSql(QString sql); 15 | }; 16 | 17 | #endif // ZBASEDB_H 18 | -------------------------------------------------------------------------------- /db/zsqlitedb.h: -------------------------------------------------------------------------------- 1 | #ifndef ZSQLITEDB_H 2 | #define ZSQLITEDB_H 3 | #include 4 | #include "db/zbasedb.h" 5 | #include 6 | class ZSQLiteDB : public QObject,public ZBaseDB 7 | { 8 | Q_OBJECT 9 | public: 10 | ZSQLiteDB(); 11 | ~ZSQLiteDB(); 12 | public: 13 | qint32 ZDoInit(void); 14 | qint32 ZUnInit(void); 15 | qint32 ZOpenDB(QString dbName,bool createFlag=false); 16 | qint32 ZCloseDB(QString dbName); 17 | qint32 ZExecuteSql(QString sql); 18 | qint32 ZIsTableExist(QString tableName); 19 | 20 | //common. 21 | qint32 ZGetRecordCount(QString tableName); 22 | qint32 ZGetMaxRecordCount(QString tableName); 23 | qint32 ZDelRecord(QString tableName,qint32 startIndex,qint32 endIndex); 24 | 25 | //ConfigTable. 26 | qint32 ZCreateConfigTable(void); 27 | qint32 ZGetConfigData(QStringList &cfgList); 28 | qint32 ZUpdatePassword(QString newPass); 29 | 30 | //OpLogTable. 31 | qint32 ZCreateOPLogTable(void); 32 | qint32 ZAddOPLogRecord(QString dateTime,qint32 logType,QString logMsg); 33 | qint32 ZGetOPLogRecord(qint32 startIndex,qint32 endIndex,QStringList &dateTime,QStringList &logType,QStringList &logMsg); 34 | 35 | //PinYinTable. 36 | qint32 ZCreatePinYinTable(void); 37 | qint32 ZGetPinYinData(QString pinyin,QStringList &hanziList); 38 | 39 | //ColorTempTable. 40 | qint32 ZCreateColorTempTable(void); 41 | qint32 ZGetColorTempData(quint8 glaserAddr,QString colorTempName,QStringList &valList); 42 | qint32 ZPutColorTempData(quint8 glaserAddr,QString colorTempName,QStringList &valList); 43 | signals: 44 | void ZSigIMEMsg(QString msg); 45 | private: 46 | QSqlDatabase m_db; 47 | }; 48 | 49 | #endif // ZSQLITEDB_H 50 | -------------------------------------------------------------------------------- /dump/zdbgserver.cpp: -------------------------------------------------------------------------------- 1 | #include "zdbgserver.h" 2 | 3 | ZDbgServer::ZDbgServer() 4 | { 5 | 6 | } 7 | qint32 ZDbgServer::startServer() 8 | { 9 | return this->listen(QHostAddress::Any,6800); 10 | } 11 | qint32 ZDbgServer::stopServer() 12 | { 13 | this->close(); 14 | return 0; 15 | } 16 | 17 | void ZDbgServer::incomingConnection(qintptr handle) 18 | { 19 | ZDbgThread *thread=new ZDbgThread(handle); 20 | connect(this,SIGNAL(ZSigDumpDbgMsg(QString)),thread,SLOT(ZSloDumpDbgMsg(QString))); 21 | connect(thread,SIGNAL(finished()),thread,SLOT(deleteLater())); 22 | thread->start(); 23 | } 24 | ZDbgThread::ZDbgThread(qintptr handle) 25 | { 26 | this->m_handle=handle; 27 | this->m_socket=NULL; 28 | } 29 | void ZDbgThread::ZSloDumpDbgMsg(QString msg) 30 | { 31 | if(this->m_socket!=NULL && this->m_socket->state()==QAbstractSocket::ConnectedState) 32 | { 33 | this->m_socket->write(msg.toLatin1()+"\r\n"); 34 | this->m_socket->waitForBytesWritten(3000); 35 | }else{ 36 | //exit event-loop. 37 | this->exit(-1); 38 | } 39 | } 40 | void ZDbgThread::run() 41 | { 42 | this->m_socket=new QTcpSocket; 43 | if(!this->m_socket->setSocketDescriptor(this->m_handle)) 44 | { 45 | delete this->m_socket; 46 | return; 47 | } 48 | //enter event-loop. 49 | this->exec(); 50 | this->m_socket->close(); 51 | delete this->m_socket; 52 | } 53 | -------------------------------------------------------------------------------- /dump/zdbgserver.h: -------------------------------------------------------------------------------- 1 | #ifndef ZDBGSERVER_H 2 | #define ZDBGSERVER_H 3 | 4 | #include 5 | #include 6 | #include 7 | class ZDbgServer : public QTcpServer 8 | { 9 | Q_OBJECT 10 | public: 11 | ZDbgServer(); 12 | qint32 startServer(); 13 | qint32 stopServer(); 14 | signals: 15 | void ZSigDumpDbgMsg(QString msg); 16 | protected: 17 | void incomingConnection(qintptr handle); 18 | }; 19 | class ZDbgThread:public QThread 20 | { 21 | Q_OBJECT 22 | public: 23 | ZDbgThread(qintptr handle); 24 | public slots: 25 | void ZSloDumpDbgMsg(QString msg); 26 | protected: 27 | void run(); 28 | private: 29 | QTcpSocket *m_socket; 30 | qintptr m_handle; 31 | }; 32 | #endif // ZDBGSERVER_H 33 | -------------------------------------------------------------------------------- /fonts/msyh.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/fonts/msyh.ttf -------------------------------------------------------------------------------- /fonts/wqy-microhei.ttc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/fonts/wqy-microhei.ttc -------------------------------------------------------------------------------- /gbl/hmi_const.cpp: -------------------------------------------------------------------------------- 1 | #include "gbl/hmi_const.h" 2 | ZSQLiteDB gDB; 3 | ZGblHelp g_GblHelp; 4 | quint8 ZMapColorTemp2Hex(QString colorTemp) 5 | { 6 | quint8 colorTempHex; 7 | if(colorTemp=="D27") 8 | { 9 | colorTempHex=0x1B; 10 | }else if(colorTemp=="D30") 11 | { 12 | colorTempHex=0x1E; 13 | }else if(colorTemp=="D35") 14 | { 15 | colorTempHex=0x23; 16 | } 17 | else if(colorTemp=="D40") 18 | { 19 | colorTempHex=0x28; 20 | } 21 | else if(colorTemp=="D63") 22 | { 23 | colorTempHex=0x3F; 24 | } 25 | else if(colorTemp=="D65") 26 | { 27 | colorTempHex=0x41; 28 | } 29 | else if(colorTemp=="D80") 30 | { 31 | colorTempHex=0x50; 32 | } 33 | else if(colorTemp=="D93") 34 | { 35 | colorTempHex=0x5D; 36 | }else if(colorTemp=="D95") 37 | { 38 | colorTempHex=0x5F; 39 | }else if(colorTemp=="DCI") 40 | { 41 | colorTempHex=0x66; 42 | }else{ 43 | //unknow color temp. 44 | colorTempHex=0xff; 45 | } 46 | return colorTempHex; 47 | } 48 | QString ZMapColorTemp2String(quint8 colorTemp) 49 | { 50 | QString colorTempStr; 51 | switch(colorTemp) 52 | { 53 | case 0x1B: 54 | colorTempStr="D27"; 55 | break; 56 | case 0x1E: 57 | colorTempStr="D30"; 58 | break; 59 | case 0x23: 60 | colorTempStr="D35"; 61 | break; 62 | case 0x28: 63 | colorTempStr="D40"; 64 | break; 65 | case 0x3F: 66 | colorTempStr="D63"; 67 | break; 68 | case 0x41: 69 | colorTempStr="D65"; 70 | break; 71 | case 0x50: 72 | colorTempStr="D80"; 73 | break; 74 | case 0x5D: 75 | colorTempStr="D93"; 76 | break; 77 | case 0x5F: 78 | colorTempStr="D95"; 79 | break; 80 | case 0x66: 81 | colorTempStr="DCI"; 82 | break; 83 | default: 84 | colorTempStr="ERR"; 85 | break; 86 | } 87 | return colorTempStr; 88 | } 89 | 90 | void ZGblHelp::beep() 91 | { 92 | if(g_GblHelp.m_bBeep) 93 | { 94 | FILE *fp=popen("/usr/bin/echo -e '\a' >/dev/tty10","r"); 95 | if(fp) 96 | { 97 | pclose(fp); 98 | } 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /gbl/hmi_const.h: -------------------------------------------------------------------------------- 1 | #ifndef HMI_CONST_H 2 | #define HMI_CONST_H 3 | #include 4 | #include 5 | #include 6 | #include "db/zsqlitedb.h" 7 | //#define UI_VERSION "V0.1" 8 | //#define UI_VERSION "V0.2" //2017/6/27. 9 | //#define UI_VERSION "V0.2.0" //2017/6/28. 10 | //#define UI_VERSION "V0.2.1" //2017/6/30. 11 | //#define UI_VERSION "V0.2.2" //2017/7/1. 12 | //#define UI_VERSION "V0.3.0" //2017/7/17. 13 | //#define UI_VERSION "V0.3.1" //2017/7/29. 14 | //#define UI_VERSION "V0.3.2" //2017/8/7. 15 | //#define UI_VERSION "V0.3.3" //2017/8/14. 16 | //#define UI_VERSION "V0.3.4" //2017/8/15. 17 | //#define UI_VERSION "V0.3.5R1" //2017/8/18. 18 | //#define UI_VERSION "V0.3.5R2" //2017/8/26. 19 | #define UI_VERSION "V0.3.5R3" //2017/8/27. 20 | 21 | #define DEVICE_MANUFACTURER QString("数码辰星科技发展(北京)有限公司") 22 | #define TECH_SUPPORT QString("辰星研究院") 23 | 24 | #define PauseMs(ms) do { \ 25 | QElapsedTimer t; \ 26 | t.start();\ 27 | while(t.elapsed()<(ms)) \ 28 | QCoreApplication::processEvents();\ 29 | }while(0) 30 | 31 | #define SCREEN_WIDTH 800//800 32 | #define SCREEN_HEIGHT 600//600 33 | 34 | extern ZSQLiteDB gDB; 35 | 36 | //we hold the err message list. 37 | #define ERR_MSG_LIST_SIZE 50 38 | 39 | class ZGblHelp 40 | { 41 | public: 42 | bool m_bEnSelfCheck; 43 | bool m_bEnHeartBeat; 44 | bool m_bEnPopupErrMsg; 45 | bool m_bEnCRC16; 46 | bool m_bEnEncrypt; 47 | bool m_bOpTips; 48 | bool m_bQueryStatus; 49 | bool m_bBeep; 50 | qint32 m_nHeartBeatInterval; 51 | qint32 m_nTimeoutVal; 52 | qint32 m_nQueryInterval; 53 | qint32 m_nOfflineTimeout; 54 | 55 | //for HeartBeat. 56 | bool m_bWhiteBalanceOn; 57 | bool m_bBypassChiller; 58 | bool m_bPwrOn; 59 | 60 | //for global error indicator. 61 | bool m_bGblErr; 62 | // QStringList m_errMsgList; 63 | //communicate error flag. 64 | qint32 m_CommunicateErrFlag; 65 | //0~7:glaser error flags. 66 | qint32 m_GLaserErrFlag[8]; 67 | qint32 m_ChillerErrFlag[2]; 68 | 69 | //config data. 70 | QString m_cinemaName; 71 | QString m_devNo; 72 | QString m_password; 73 | 74 | //two chiller data. 75 | qint8 m_chillerPwr; 76 | qint8 m_chillerFault; 77 | qint8 m_projectPwrOn; 78 | 79 | //16 laser state for heartbeat packet. 80 | qint16 m_laserFault; 81 | //plaser log storage fault. 82 | qint8 m_logFault; 83 | //glaser power fault. 84 | qint16 m_glaserPwrFault; 85 | 86 | //glaser version information. 87 | QString m_glaserVerNo; 88 | QString m_glaserProductNo; 89 | 90 | //login or not. 91 | bool m_bLoginSuccess; 92 | public: 93 | void beep(); 94 | }; 95 | 96 | extern ZGblHelp g_GblHelp; 97 | extern quint8 ZMapColorTemp2Hex(QString colorTemp); 98 | extern QString ZMapColorTemp2String(quint8 colorTemp); 99 | #endif // HMI_CONST_H 100 | -------------------------------------------------------------------------------- /hmires.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | images/led/led_green.png 4 | images/led/led_red.png 5 | images/led/led_yellow.png 6 | images/topbar/signal0.png 7 | images/topbar/signal1.png 8 | images/topbar/signal2.png 9 | images/topbar/signal3.png 10 | 11 | 12 | skin/defaultSkin 13 | 14 | 15 | images/navigate/about.png 16 | images/navigate/chiller.png 17 | images/navigate/debug.png 18 | images/navigate/laser.png 19 | images/navigate/log.png 20 | images/navigate/network.png 21 | images/navigate/setup.png 22 | images/navigate/status.png 23 | images/navigate/sysinfo.png 24 | 25 | 26 | images/laser/mainCtl.png 27 | images/laser/mdlCtl.png 28 | 29 | 30 | images/mainctl/add.png 31 | images/mainctl/sub.png 32 | images/mainctl/hexagon.png 33 | images/mainctl/circle_gray.png 34 | images/mainctl/circle_orange.png 35 | images/mainctl/RGB_All.png 36 | images/mainctl/RGB_Blue.png 37 | images/mainctl/RGB_Green.png 38 | images/mainctl/RGB_Red.png 39 | images/mainctl/WhiteBalance.png 40 | images/mainctl/colortemp.png 41 | images/mainctl/busy.png 42 | images/mainctl/add_gray.png 43 | images/mainctl/sub_gray.png 44 | 45 | 46 | images/login/lock.png 47 | images/login/background.png 48 | 49 | 50 | images/about/logo.png 51 | 52 | 53 | images/log/next.png 54 | images/log/previous.png 55 | images/log/Alarm.png 56 | images/log/Laser.png 57 | images/log/Operate.png 58 | images/log/Keyboard.png 59 | images/log/Export.png 60 | images/log/Search.png 61 | images/log/Trash.png 62 | images/log/Chiller.png 63 | 64 | 65 | images/load/background.png 66 | 67 | 68 | images/bottombar/Logout.png 69 | images/bottombar/Reboot.png 70 | images/bottombar/Shutdown.png 71 | images/bottombar/Cancel.png 72 | images/bottombar/Exit.png 73 | images/bottombar/Console.png 74 | 75 | 76 | images/chiller/BypassChiller.png 77 | images/chiller/ReEnableChiller.png 78 | 79 | 80 | images/common/pushed_left.png 81 | images/common/pushed_right.png 82 | images/common/up_left.png 83 | images/common/up_right.png 84 | images/common/Checked.png 85 | images/common/UnChecked.png 86 | images/common/add.png 87 | images/common/sub.png 88 | images/common/arrow.png 89 | 90 | 91 | images/summary/Left.png 92 | images/summary/Right.png 93 | 94 | 95 | images/Keyboard/bottom.png 96 | images/Keyboard/close.png 97 | images/Keyboard/left.png 98 | images/Keyboard/right.png 99 | images/Keyboard/top.png 100 | images/Keyboard/next.png 101 | images/Keyboard/previous.png 102 | 103 | 104 | images/hzpy-utf8.txt 105 | 106 | 107 | -------------------------------------------------------------------------------- /images/Keyboard/bottom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/Keyboard/bottom.png -------------------------------------------------------------------------------- /images/Keyboard/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/Keyboard/close.png -------------------------------------------------------------------------------- /images/Keyboard/left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/Keyboard/left.png -------------------------------------------------------------------------------- /images/Keyboard/next.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/Keyboard/next.png -------------------------------------------------------------------------------- /images/Keyboard/previous.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/Keyboard/previous.png -------------------------------------------------------------------------------- /images/Keyboard/right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/Keyboard/right.png -------------------------------------------------------------------------------- /images/Keyboard/top.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/Keyboard/top.png -------------------------------------------------------------------------------- /images/about/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/about/logo.png -------------------------------------------------------------------------------- /images/bottombar/Cancel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/bottombar/Cancel.png -------------------------------------------------------------------------------- /images/bottombar/Console.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/bottombar/Console.png -------------------------------------------------------------------------------- /images/bottombar/Exit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/bottombar/Exit.png -------------------------------------------------------------------------------- /images/bottombar/Logout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/bottombar/Logout.png -------------------------------------------------------------------------------- /images/bottombar/Reboot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/bottombar/Reboot.png -------------------------------------------------------------------------------- /images/bottombar/Shutdown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/bottombar/Shutdown.png -------------------------------------------------------------------------------- /images/chiller/BypassChiller.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/chiller/BypassChiller.png -------------------------------------------------------------------------------- /images/chiller/ReEnableChiller.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/chiller/ReEnableChiller.png -------------------------------------------------------------------------------- /images/common/.directory: -------------------------------------------------------------------------------- 1 | [Dolphin] 2 | PreviewsShown=true 3 | Timestamp=2017,8,15,11,12,5 4 | Version=3 5 | -------------------------------------------------------------------------------- /images/common/Checked.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/common/Checked.png -------------------------------------------------------------------------------- /images/common/UnChecked.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/common/UnChecked.png -------------------------------------------------------------------------------- /images/common/add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/common/add.png -------------------------------------------------------------------------------- /images/common/arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/common/arrow.png -------------------------------------------------------------------------------- /images/common/pushed_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/common/pushed_left.png -------------------------------------------------------------------------------- /images/common/pushed_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/common/pushed_right.png -------------------------------------------------------------------------------- /images/common/sub.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/common/sub.png -------------------------------------------------------------------------------- /images/common/up_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/common/up_left.png -------------------------------------------------------------------------------- /images/common/up_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/common/up_right.png -------------------------------------------------------------------------------- /images/laser/mainCtl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/laser/mainCtl.png -------------------------------------------------------------------------------- /images/laser/mdlCtl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/laser/mdlCtl.png -------------------------------------------------------------------------------- /images/led/led_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/led/led_green.png -------------------------------------------------------------------------------- /images/led/led_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/led/led_red.png -------------------------------------------------------------------------------- /images/led/led_yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/led/led_yellow.png -------------------------------------------------------------------------------- /images/load/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/load/background.png -------------------------------------------------------------------------------- /images/log/Alarm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/log/Alarm.png -------------------------------------------------------------------------------- /images/log/Chiller.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/log/Chiller.png -------------------------------------------------------------------------------- /images/log/Export.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/log/Export.png -------------------------------------------------------------------------------- /images/log/Keyboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/log/Keyboard.png -------------------------------------------------------------------------------- /images/log/Laser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/log/Laser.png -------------------------------------------------------------------------------- /images/log/Operate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/log/Operate.png -------------------------------------------------------------------------------- /images/log/Search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/log/Search.png -------------------------------------------------------------------------------- /images/log/Trash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/log/Trash.png -------------------------------------------------------------------------------- /images/log/next.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/log/next.png -------------------------------------------------------------------------------- /images/log/previous.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/log/previous.png -------------------------------------------------------------------------------- /images/login/.directory: -------------------------------------------------------------------------------- 1 | [Dolphin] 2 | PreviewsShown=true 3 | Timestamp=2017,8,14,13,12,51 4 | Version=3 5 | -------------------------------------------------------------------------------- /images/login/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/login/background.png -------------------------------------------------------------------------------- /images/login/lock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/login/lock.png -------------------------------------------------------------------------------- /images/mainctl/RGB_All.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/mainctl/RGB_All.png -------------------------------------------------------------------------------- /images/mainctl/RGB_Blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/mainctl/RGB_Blue.png -------------------------------------------------------------------------------- /images/mainctl/RGB_Green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/mainctl/RGB_Green.png -------------------------------------------------------------------------------- /images/mainctl/RGB_Red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/mainctl/RGB_Red.png -------------------------------------------------------------------------------- /images/mainctl/WhiteBalance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/mainctl/WhiteBalance.png -------------------------------------------------------------------------------- /images/mainctl/add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/mainctl/add.png -------------------------------------------------------------------------------- /images/mainctl/add1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/mainctl/add1.png -------------------------------------------------------------------------------- /images/mainctl/add_gray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/mainctl/add_gray.png -------------------------------------------------------------------------------- /images/mainctl/busy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/mainctl/busy.png -------------------------------------------------------------------------------- /images/mainctl/circle_gray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/mainctl/circle_gray.png -------------------------------------------------------------------------------- /images/mainctl/circle_orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/mainctl/circle_orange.png -------------------------------------------------------------------------------- /images/mainctl/colortemp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/mainctl/colortemp.png -------------------------------------------------------------------------------- /images/mainctl/hexagon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/mainctl/hexagon.png -------------------------------------------------------------------------------- /images/mainctl/sub.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/mainctl/sub.png -------------------------------------------------------------------------------- /images/mainctl/sub1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/mainctl/sub1.png -------------------------------------------------------------------------------- /images/mainctl/sub_gray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/mainctl/sub_gray.png -------------------------------------------------------------------------------- /images/navigate/about.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/navigate/about.png -------------------------------------------------------------------------------- /images/navigate/chiller.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/navigate/chiller.png -------------------------------------------------------------------------------- /images/navigate/debug.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/navigate/debug.png -------------------------------------------------------------------------------- /images/navigate/laser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/navigate/laser.png -------------------------------------------------------------------------------- /images/navigate/log.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/navigate/log.png -------------------------------------------------------------------------------- /images/navigate/network.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/navigate/network.png -------------------------------------------------------------------------------- /images/navigate/setup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/navigate/setup.png -------------------------------------------------------------------------------- /images/navigate/status.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/navigate/status.png -------------------------------------------------------------------------------- /images/navigate/sysinfo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/navigate/sysinfo.png -------------------------------------------------------------------------------- /images/op2/add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/op2/add.png -------------------------------------------------------------------------------- /images/op2/sub.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/op2/sub.png -------------------------------------------------------------------------------- /images/summary/Left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/summary/Left.png -------------------------------------------------------------------------------- /images/summary/Right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/summary/Right.png -------------------------------------------------------------------------------- /images/topbar/signal0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/topbar/signal0.png -------------------------------------------------------------------------------- /images/topbar/signal1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/topbar/signal1.png -------------------------------------------------------------------------------- /images/topbar/signal2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/topbar/signal2.png -------------------------------------------------------------------------------- /images/topbar/signal3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShellAlbert/LaserHMI/3226cf8a6a31a3e3d3813c4c1dc1117041d34ace/images/topbar/signal3.png -------------------------------------------------------------------------------- /ringbuffer/zringbuffer.cpp: -------------------------------------------------------------------------------- 1 | #include "zringbuffer.h" 2 | #include 3 | ZRingBuffer::ZRingBuffer() 4 | { 5 | 6 | } 7 | ZRingBuffer::~ZRingBuffer() 8 | { 9 | 10 | } 11 | 12 | qint32 ZRingBuffer::ZDOInit(qint32 max) 13 | { 14 | this->m_buffer=new ZRingElement[max]; 15 | this->m_maxNum=max; 16 | this->m_rdPos=0; 17 | this->m_wrPos=0; 18 | this->m_mutex=new QMutex; 19 | return 0; 20 | } 21 | qint32 ZRingBuffer::ZUnInit() 22 | { 23 | delete []this->m_buffer; 24 | delete this->m_mutex; 25 | return 0; 26 | } 27 | 28 | bool ZRingBuffer::ZIsEmpty(void) 29 | { 30 | if(this->m_wrPos==this->m_rdPos) 31 | { 32 | return true; 33 | } 34 | return false; 35 | } 36 | bool ZRingBuffer::ZIsFull(void) 37 | { 38 | if((this->m_wrPos+1)%this->m_maxNum==this->m_rdPos) 39 | { 40 | return true; 41 | } 42 | return false; 43 | } 44 | qint32 ZRingBuffer::ZPutElement(QString cmd,QString arguments) 45 | { 46 | if(this->ZIsFull()) 47 | { 48 | return -1; 49 | } 50 | ZRingElement ringEle; 51 | ringEle.cmd=cmd; 52 | ringEle.arguments=arguments; 53 | this->m_buffer[this->m_wrPos]=ringEle; 54 | if(this->m_wrPos+1==this->m_maxNum) 55 | { 56 | this->m_wrPos=0; 57 | }else{ 58 | this->m_wrPos++; 59 | } 60 | return 0; 61 | } 62 | qint32 ZRingBuffer::ZGetElement(QString &cmd,QString &arguments) 63 | { 64 | if(this->ZIsEmpty()) 65 | { 66 | return -1; 67 | } 68 | ZRingElement ringEle=this->m_buffer[this->m_rdPos]; 69 | cmd=ringEle.cmd; 70 | arguments=ringEle.arguments; 71 | if(this->m_rdPos+1==this->m_maxNum) 72 | { 73 | this->m_rdPos=0; 74 | }else{ 75 | this->m_rdPos++; 76 | } 77 | return 0; 78 | } 79 | void ZRingBuffer::ZDoLock() 80 | { 81 | this->m_mutex->lock(); 82 | } 83 | void ZRingBuffer::ZUnLock() 84 | { 85 | this->m_mutex->unlock(); 86 | } 87 | bool ZRingBuffer::ZTryLock() 88 | { 89 | return this->m_mutex->tryLock(0); 90 | } 91 | void ZRingBuffer::ZDumpElements() 92 | { 93 | while(!this->ZIsEmpty()) 94 | { 95 | QString cmd; 96 | QString argument; 97 | this->ZGetElement(cmd,argument); 98 | qDebug()<<"dump:"< 5 | #include 6 | class ZRingElement 7 | { 8 | public: 9 | QString cmd; 10 | QString arguments; 11 | }; 12 | class ZRingBuffer 13 | { 14 | public: 15 | ZRingBuffer(); 16 | ~ZRingBuffer(); 17 | 18 | qint32 ZDOInit(qint32 max=6); 19 | qint32 ZUnInit(); 20 | 21 | bool ZIsEmpty(void); 22 | bool ZIsFull(void); 23 | qint32 ZPutElement(QString cmd,QString arguments); 24 | qint32 ZGetElement(QString &cmd,QString &arguments); 25 | void ZDoLock(); 26 | void ZUnLock(); 27 | bool ZTryLock(); 28 | 29 | void ZDumpElements(); 30 | private: 31 | qint32 m_rdPos; 32 | qint32 m_wrPos; 33 | qint32 m_maxNum; 34 | ZRingElement *m_buffer; 35 | QMutex *m_mutex; 36 | }; 37 | 38 | #endif // ZRINGBUFFER_H 39 | -------------------------------------------------------------------------------- /test_command: -------------------------------------------------------------------------------- 1 | 2 | getGLaserData 3 | tx: 4 | 0x55, 0xaa, 0x55, 0xaa, 0x05, 0x01, 0x7b, 0x01, 0x5a, 0xcc, 5 | rx: 6 | 55 aa 55 aa 33 00 7b 3f 00 01 ff ff 00 03 00 04 00 05 00 00 00 06 07 00 09 00 0a 00 0b 00 0c 00 0d 00 0e 00 0f 00 01 00 02 00 03 00 04 00 05 00 06 00 07 00 08 01 66 47 7 | 8 | -------------------------------------------------------------------------------- /ui/log/zchillerlogui.cpp: -------------------------------------------------------------------------------- 1 | #include "zchillerlogui.h" 2 | #include 3 | #include 4 | #include "gbl/hmi_const.h" 5 | #include 6 | #include "ui/log/zlogfilterdialog.h" 7 | ZChillerLogUI::ZChillerLogUI() 8 | { 9 | 10 | } 11 | ZChillerLogUI::~ZChillerLogUI() 12 | { 13 | 14 | } 15 | void ZChillerLogUI::ZDoInitial() 16 | { 17 | this->m_tbFilter=new QToolButton; 18 | this->m_tbFilter->setText(tr("Filter")); 19 | this->m_tbFilter->setIcon(QIcon(":/log/images/log/Search.png")); 20 | this->m_tbFilter->setIconSize(QSize(24,24)); 21 | this->m_tbFilter->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); 22 | 23 | this->m_tbExport=new QToolButton; 24 | this->m_tbExport->setText(tr("导出...")); 25 | this->m_tbExport->setIcon(QIcon(":/log/images/log/Export.png")); 26 | this->m_tbExport->setIconSize(QSize(24,24)); 27 | this->m_tbExport->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); 28 | 29 | this->m_tbDelete=new QToolButton; 30 | this->m_tbDelete->setText(tr("删除")); 31 | this->m_tbDelete->setIcon(QIcon(":/log/images/log/Trash.png")); 32 | this->m_tbDelete->setIconSize(QSize(24,24)); 33 | this->m_tbDelete->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); 34 | 35 | this->m_tbPrevious=new QToolButton; 36 | this->m_tbPrevious->setObjectName("PreviousButton"); 37 | this->m_tbPrevious->setIcon(QIcon(":/log/images/log/previous.png")); 38 | this->m_tbPrevious->setIconSize(QSize(20,20)); 39 | this->m_tbNext=new QToolButton; 40 | this->m_tbNext->setObjectName("NextButton"); 41 | this->m_tbNext->setIcon(QIcon(":/log/images/log/next.png")); 42 | this->m_tbNext->setIconSize(QSize(20,20)); 43 | this->m_cbPages=new QComboBox; 44 | this->m_cbPages->addItem(tr("1/10")); 45 | 46 | this->m_hLayoutFilter=new QHBoxLayout; 47 | this->m_hLayoutFilter->addWidget(this->m_tbFilter); 48 | this->m_hLayoutFilter->addWidget(this->m_tbExport); 49 | this->m_hLayoutFilter->addWidget(this->m_tbDelete); 50 | this->m_hLayoutFilter->addStretch(1); 51 | this->m_hLayoutFilter->addWidget(this->m_tbPrevious); 52 | this->m_hLayoutFilter->addWidget(this->m_cbPages); 53 | this->m_hLayoutFilter->addWidget(this->m_tbNext); 54 | 55 | this->m_treeWidget=new QTreeWidget; 56 | this->m_treeWidget->setHeaderLabels(QStringList()<m_treeWidget->setColumnWidth(0,150); 58 | this->m_treeWidget->setColumnWidth(1,100); 59 | this->m_treeWidget->setColumnWidth(2,100); 60 | this->m_treeWidget->setFocusPolicy(Qt::NoFocus); 61 | this->m_treeWidget->setRootIsDecorated(false); 62 | this->m_treeWidget->header()->setDefaultAlignment(Qt::AlignCenter); 63 | 64 | this->m_vLayoutLog=new QVBoxLayout; 65 | this->m_vLayoutLog->addLayout(this->m_hLayoutFilter); 66 | this->m_vLayoutLog->addWidget(this->m_treeWidget); 67 | this->m_vLayoutLog->setContentsMargins(5,30,5,2); 68 | this->m_frmLog=new ZFrame(tr("日志列表")); 69 | this->m_frmLog->setLayout(this->m_vLayoutLog); 70 | 71 | 72 | this->m_llStorage=new QLabel(tr("1/1000")); 73 | this->m_progressBar=new QProgressBar; 74 | this->m_progressBar->setObjectName("LogStorageProgressBar"); 75 | this->m_progressBar->setRange(0,1000); 76 | this->m_progressBar->setValue(0); 77 | this->m_hLayoutStorage=new QHBoxLayout; 78 | this->m_hLayoutStorage->addWidget(this->m_llStorage); 79 | this->m_hLayoutStorage->addWidget(this->m_progressBar); 80 | this->m_hLayoutStorage->setContentsMargins(5,20,5,2); 81 | this->m_frmStorage=new ZFrame(tr("Storage(存储)")); 82 | this->m_frmStorage->setLayout(this->m_hLayoutStorage); 83 | 84 | 85 | //main layout. 86 | this->m_gLayoutMain=new QGridLayout; 87 | this->m_gLayoutMain->addWidget(this->m_frmLog,0,0,1,1); 88 | this->m_gLayoutMain->addWidget(this->m_frmStorage,1,0,1,1); 89 | this->m_gLayoutMain->setRowStretch(0,5); 90 | this->m_gLayoutMain->setRowStretch(1,1); 91 | this->setLayout(this->m_gLayoutMain); 92 | 93 | connect(this->m_tbFilter,SIGNAL(clicked(bool)),this,SLOT(ZSloFilter())); 94 | connect(this->m_tbExport,SIGNAL(clicked(bool)),this,SLOT(ZSloExport())); 95 | connect(this->m_tbDelete,SIGNAL(clicked(bool)),this,SLOT(ZSloDelete())); 96 | } 97 | void ZChillerLogUI::ZUnInitial() 98 | { 99 | delete this->m_tbFilter; 100 | delete this->m_tbExport; 101 | delete this->m_tbDelete; 102 | delete this->m_tbPrevious; 103 | delete this->m_tbNext; 104 | delete this->m_cbPages; 105 | delete this->m_hLayoutFilter; 106 | delete this->m_treeWidget; 107 | delete this->m_vLayoutLog; 108 | delete this->m_frmLog; 109 | 110 | delete this->m_llStorage; 111 | delete this->m_progressBar; 112 | delete this->m_hLayoutStorage; 113 | delete this->m_frmStorage; 114 | 115 | delete this->m_gLayoutMain; 116 | } 117 | void ZChillerLogUI::ZSloFilter() 118 | { 119 | ZLogFilterDialog dia(tr("Log Filter Dialog")); 120 | if(dia.exec()==QDialog::Accepted) 121 | { 122 | 123 | } 124 | } 125 | void ZChillerLogUI::ZSloExport() 126 | { 127 | 128 | } 129 | void ZChillerLogUI::ZSloDelete() 130 | { 131 | 132 | } 133 | void ZChillerLogUI::ZFetchLogs() 134 | { 135 | 136 | } 137 | -------------------------------------------------------------------------------- /ui/log/zchillerlogui.h: -------------------------------------------------------------------------------- 1 | #ifndef ZCHILLERLOGUI_H 2 | #define ZCHILLERLOGUI_H 3 | 4 | #include "base/zbaseui.h" 5 | #include "ui/zframe.h" 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | class ZChillerLogUI : public ZBaseUI 14 | { 15 | Q_OBJECT 16 | public: 17 | ZChillerLogUI(); 18 | ~ZChillerLogUI(); 19 | 20 | void ZDoInitial(); 21 | void ZUnInitial(); 22 | 23 | void ZFetchLogs(); 24 | private slots: 25 | void ZSloFilter(); 26 | void ZSloExport(); 27 | void ZSloDelete(); 28 | private: 29 | 30 | QToolButton *m_tbFilter; 31 | QToolButton *m_tbExport; 32 | QToolButton *m_tbDelete; 33 | QToolButton *m_tbPrevious; 34 | QToolButton *m_tbNext; 35 | QComboBox *m_cbPages; 36 | QHBoxLayout *m_hLayoutFilter; 37 | QTreeWidget *m_treeWidget; 38 | QVBoxLayout *m_vLayoutLog; 39 | ZFrame *m_frmLog; 40 | 41 | QLabel *m_llStorage; 42 | QProgressBar *m_progressBar; 43 | QHBoxLayout *m_hLayoutStorage; 44 | ZFrame *m_frmStorage; 45 | 46 | QGridLayout *m_gLayoutMain; 47 | }; 48 | 49 | #endif // ZCHILLERLOGUI_Hl 50 | -------------------------------------------------------------------------------- /ui/log/zlaserlogui.cpp: -------------------------------------------------------------------------------- 1 | #include "zlaserlogui.h" 2 | #include 3 | #include 4 | #include "gbl/hmi_const.h" 5 | #include 6 | #include "ui/log/zlogfilterdialog.h" 7 | ZLaserLogUI::ZLaserLogUI() 8 | { 9 | 10 | } 11 | ZLaserLogUI::~ZLaserLogUI() 12 | { 13 | 14 | } 15 | void ZLaserLogUI::ZDoInitial() 16 | { 17 | this->m_tbFilter=new QToolButton; 18 | this->m_tbFilter->setText(tr("Filter")); 19 | this->m_tbFilter->setIcon(QIcon(":/log/images/log/Search.png")); 20 | this->m_tbFilter->setIconSize(QSize(24,24)); 21 | this->m_tbFilter->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); 22 | 23 | this->m_tbExport=new QToolButton; 24 | this->m_tbExport->setText(tr("导出...")); 25 | this->m_tbExport->setIcon(QIcon(":/log/images/log/Export.png")); 26 | this->m_tbExport->setIconSize(QSize(24,24)); 27 | this->m_tbExport->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); 28 | 29 | this->m_tbDelete=new QToolButton; 30 | this->m_tbDelete->setText(tr("删除")); 31 | this->m_tbDelete->setIcon(QIcon(":/log/images/log/Trash.png")); 32 | this->m_tbDelete->setIconSize(QSize(24,24)); 33 | this->m_tbDelete->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); 34 | 35 | this->m_tbPrevious=new QToolButton; 36 | this->m_tbPrevious->setObjectName("PreviousButton"); 37 | this->m_tbPrevious->setIcon(QIcon(":/log/images/log/previous.png")); 38 | this->m_tbPrevious->setIconSize(QSize(20,20)); 39 | this->m_tbNext=new QToolButton; 40 | this->m_tbNext->setObjectName("NextButton"); 41 | this->m_tbNext->setIcon(QIcon(":/log/images/log/next.png")); 42 | this->m_tbNext->setIconSize(QSize(20,20)); 43 | this->m_cbPages=new QComboBox; 44 | this->m_cbPages->addItem(tr("1/10")); 45 | 46 | this->m_hLayoutFilter=new QHBoxLayout; 47 | this->m_hLayoutFilter->addWidget(this->m_tbFilter); 48 | this->m_hLayoutFilter->addWidget(this->m_tbExport); 49 | this->m_hLayoutFilter->addWidget(this->m_tbDelete); 50 | this->m_hLayoutFilter->addStretch(1); 51 | this->m_hLayoutFilter->addWidget(this->m_tbPrevious); 52 | this->m_hLayoutFilter->addWidget(this->m_cbPages); 53 | this->m_hLayoutFilter->addWidget(this->m_tbNext); 54 | 55 | this->m_treeWidget=new QTreeWidget; 56 | this->m_treeWidget->setHeaderLabels(QStringList()<m_treeWidget->setColumnWidth(0,150); 58 | this->m_treeWidget->setColumnWidth(1,100); 59 | this->m_treeWidget->setColumnWidth(2,100); 60 | this->m_treeWidget->setFocusPolicy(Qt::NoFocus); 61 | this->m_treeWidget->setRootIsDecorated(false); 62 | this->m_treeWidget->header()->setDefaultAlignment(Qt::AlignCenter); 63 | 64 | this->m_vLayoutLog=new QVBoxLayout; 65 | this->m_vLayoutLog->addLayout(this->m_hLayoutFilter); 66 | this->m_vLayoutLog->addWidget(this->m_treeWidget); 67 | this->m_vLayoutLog->setContentsMargins(5,30,5,2); 68 | this->m_frmLog=new ZFrame(tr("日志列表")); 69 | this->m_frmLog->setLayout(this->m_vLayoutLog); 70 | 71 | 72 | this->m_llStorage=new QLabel(tr("1/1000")); 73 | this->m_progressBar=new QProgressBar; 74 | this->m_progressBar->setObjectName("LogStorageProgressBar"); 75 | this->m_progressBar->setRange(0,1000); 76 | this->m_progressBar->setValue(0); 77 | this->m_hLayoutStorage=new QHBoxLayout; 78 | this->m_hLayoutStorage->addWidget(this->m_llStorage); 79 | this->m_hLayoutStorage->addWidget(this->m_progressBar); 80 | this->m_hLayoutStorage->setContentsMargins(5,20,5,2); 81 | this->m_frmStorage=new ZFrame(tr("Storage(存储)")); 82 | this->m_frmStorage->setLayout(this->m_hLayoutStorage); 83 | 84 | 85 | //main layout. 86 | this->m_gLayoutMain=new QGridLayout; 87 | this->m_gLayoutMain->addWidget(this->m_frmLog,0,0,1,1); 88 | this->m_gLayoutMain->addWidget(this->m_frmStorage,1,0,1,1); 89 | this->m_gLayoutMain->setRowStretch(0,5); 90 | this->m_gLayoutMain->setRowStretch(1,1); 91 | this->setLayout(this->m_gLayoutMain); 92 | 93 | connect(this->m_tbFilter,SIGNAL(clicked(bool)),this,SLOT(ZSloFilter())); 94 | connect(this->m_tbExport,SIGNAL(clicked(bool)),this,SLOT(ZSloExport())); 95 | connect(this->m_tbDelete,SIGNAL(clicked(bool)),this,SLOT(ZSloDelete())); 96 | } 97 | void ZLaserLogUI::ZUnInitial() 98 | { 99 | delete this->m_tbFilter; 100 | delete this->m_tbExport; 101 | delete this->m_tbDelete; 102 | delete this->m_tbPrevious; 103 | delete this->m_tbNext; 104 | delete this->m_cbPages; 105 | delete this->m_hLayoutFilter; 106 | delete this->m_treeWidget; 107 | delete this->m_vLayoutLog; 108 | delete this->m_frmLog; 109 | 110 | delete this->m_llStorage; 111 | delete this->m_progressBar; 112 | delete this->m_hLayoutStorage; 113 | delete this->m_frmStorage; 114 | 115 | delete this->m_gLayoutMain; 116 | } 117 | void ZLaserLogUI::ZSloFilter() 118 | { 119 | ZLogFilterDialog dia(tr("Log Filter Dialog")); 120 | if(dia.exec()==QDialog::Accepted) 121 | { 122 | 123 | } 124 | } 125 | void ZLaserLogUI::ZSloExport() 126 | { 127 | 128 | } 129 | void ZLaserLogUI::ZSloDelete() 130 | { 131 | 132 | } 133 | void ZLaserLogUI::ZFetchLogs() 134 | { 135 | 136 | } 137 | -------------------------------------------------------------------------------- /ui/log/zlaserlogui.h: -------------------------------------------------------------------------------- 1 | #ifndef ZLASERLOGUI_H 2 | #define ZLASERLOGUI_H 3 | 4 | #include "base/zbaseui.h" 5 | #include "ui/zframe.h" 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | class ZLaserLogUI : public ZBaseUI 14 | { 15 | Q_OBJECT 16 | public: 17 | ZLaserLogUI(); 18 | ~ZLaserLogUI(); 19 | 20 | void ZDoInitial(); 21 | void ZUnInitial(); 22 | 23 | void ZFetchLogs(); 24 | private slots: 25 | void ZSloFilter(); 26 | void ZSloExport(); 27 | void ZSloDelete(); 28 | private: 29 | 30 | QToolButton *m_tbFilter; 31 | QToolButton *m_tbExport; 32 | QToolButton *m_tbDelete; 33 | QToolButton *m_tbPrevious; 34 | QToolButton *m_tbNext; 35 | QComboBox *m_cbPages; 36 | QHBoxLayout *m_hLayoutFilter; 37 | QTreeWidget *m_treeWidget; 38 | QVBoxLayout *m_vLayoutLog; 39 | ZFrame *m_frmLog; 40 | 41 | QLabel *m_llStorage; 42 | QProgressBar *m_progressBar; 43 | QHBoxLayout *m_hLayoutStorage; 44 | ZFrame *m_frmStorage; 45 | 46 | QGridLayout *m_gLayoutMain; 47 | }; 48 | 49 | #endif // ZLASERLOGUI_H 50 | -------------------------------------------------------------------------------- /ui/log/zlogfilterdialog.cpp: -------------------------------------------------------------------------------- 1 | #include "zlogfilterdialog.h" 2 | 3 | ZLogFilterDialog::ZLogFilterDialog(QString title) 4 | { 5 | this->setObjectName("ZLogFilterDialog"); 6 | this->setWindowFlags(Qt::FramelessWindowHint); 7 | this->setMinimumSize(400,200); 8 | this->m_llTitle=new QLabel(title); 9 | this->setObjectName("ZLogFilterDialogTitleLabel"); 10 | this->m_llTitle->setAlignment(Qt::AlignCenter); 11 | QStringList typeList; 12 | typeList<m_cbType=new ZTextComboBox(tr("日志类型"),typeList); 17 | this->m_beginTime=new ZDateTimeChooser(tr("起始时间")); 18 | this->m_endTime=new ZDateTimeChooser(tr("终止时间")); 19 | this->m_tbOkay=new QToolButton; 20 | this->m_tbOkay->setText(tr("Okay")); 21 | this->m_tbCancel=new QToolButton; 22 | this->m_tbCancel->setText(tr("Cancel")); 23 | this->m_hLayout=new QHBoxLayout; 24 | this->m_hLayout->addStretch(1); 25 | this->m_hLayout->addWidget(this->m_tbOkay); 26 | this->m_hLayout->addWidget(this->m_tbCancel); 27 | 28 | this->m_vLayout=new QVBoxLayout; 29 | this->m_vLayout->addWidget(this->m_llTitle); 30 | this->m_vLayout->addWidget(this->m_cbType); 31 | this->m_vLayout->addWidget(this->m_beginTime); 32 | this->m_vLayout->addWidget(this->m_endTime); 33 | this->m_vLayout->addLayout(this->m_hLayout); 34 | this->setLayout(this->m_vLayout); 35 | 36 | connect(this->m_tbOkay,SIGNAL(clicked(bool)),this,SLOT(accept())); 37 | connect(this->m_tbCancel,SIGNAL(clicked(bool)),this,SLOT(reject())); 38 | } 39 | ZLogFilterDialog::~ZLogFilterDialog() 40 | { 41 | delete this->m_llTitle; 42 | delete this->m_cbType; 43 | delete this->m_beginTime; 44 | delete this->m_endTime; 45 | delete this->m_tbOkay; 46 | delete this->m_tbCancel; 47 | delete this->m_hLayout; 48 | delete this->m_vLayout; 49 | } 50 | -------------------------------------------------------------------------------- /ui/log/zlogfilterdialog.h: -------------------------------------------------------------------------------- 1 | #ifndef ZLOGFILTERDIALOG_H 2 | #define ZLOGFILTERDIALOG_H 3 | #include "base/zdatetimechooser.h" 4 | #include "ui/zframe.h" 5 | #include "ui/ztextcombobox.h" 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | class ZLogFilterDialog : public QDialog 12 | { 13 | Q_OBJECT 14 | public: 15 | ZLogFilterDialog(QString title); 16 | ~ZLogFilterDialog(); 17 | private: 18 | QLabel *m_llTitle; 19 | ZTextComboBox *m_cbType; 20 | ZDateTimeChooser *m_beginTime; 21 | ZDateTimeChooser *m_endTime; 22 | QToolButton *m_tbOkay; 23 | QToolButton *m_tbCancel; 24 | QHBoxLayout *m_hLayout; 25 | QVBoxLayout *m_vLayout; 26 | }; 27 | 28 | #endif // ZLOGFILTERDIALOG_H 29 | -------------------------------------------------------------------------------- /ui/log/zlogmanager.cpp: -------------------------------------------------------------------------------- 1 | #include "zlogmanager.h" 2 | ZLogManager* ZLogManager::m_pInstance=NULL; 3 | ZLogManager::ZLogManager() 4 | { 5 | this->m_sema=new QSemaphore(1); 6 | } 7 | void ZLogManager::ZPutLog(QString module,ZLogType type,QString logMsg) 8 | { 9 | ZLogMsg logObj; 10 | logObj.module=module; 11 | logObj.type=type; 12 | logObj.msg=logMsg; 13 | logObj.bWrFlag=0; 14 | logObj.timeStamp=QDateTime::currentDateTime(); 15 | this->m_sema->acquire(); 16 | if(this->m_vector.size()>=100) 17 | { 18 | this->m_vector.removeFirst(); 19 | } 20 | this->m_vector.append(logObj); 21 | this->m_sema->release(); 22 | } 23 | void ZLogManager::ZSloFlushLog2DB() 24 | { 25 | QVector::iterator it; 26 | for(it=this->m_vector.begin();it!=this->m_vector.end();it++) 27 | { 28 | if(it->bWrFlag==0) 29 | { 30 | //write to db. 31 | it->bWrFlag=1; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ui/log/zlogmanager.h: -------------------------------------------------------------------------------- 1 | #ifndef ZLOGMANAGER_H 2 | #define ZLOGMANAGER_H 3 | 4 | #include "base/zbaseobj.h" 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | typedef enum { 11 | Normal=0, 12 | General_Warning=1, 13 | Critical_Warning=2, 14 | General_Error=3, 15 | Critical_Error=4, 16 | }ZLogType; 17 | class ZLogMsg 18 | { 19 | public: 20 | QString md5; 21 | QString module; 22 | ZLogType type; 23 | QString msg; 24 | QDateTime timeStamp; 25 | bool bWrFlag; 26 | }; 27 | class ZLogManager : public ZBaseObj 28 | { 29 | Q_OBJECT 30 | public: 31 | static ZLogManager* ZGetInstance() 32 | { 33 | if(m_pInstance==NULL) 34 | { 35 | m_pInstance=new ZLogManager; 36 | } 37 | return m_pInstance; 38 | } 39 | void ZPutLog(QString module,ZLogType type,QString logMsg); 40 | private slots: 41 | void ZSloFlushLog2DB(); 42 | private: 43 | ZLogManager(); 44 | static ZLogManager *m_pInstance; 45 | QVector m_vector; 46 | QTimer *m_flushTimer; 47 | QSemaphore *m_sema; 48 | }; 49 | 50 | #endif // ZLOGMANAGER_H 51 | -------------------------------------------------------------------------------- /ui/log/zoperatelogui.cpp: -------------------------------------------------------------------------------- 1 | #include "zoperatelogui.h" 2 | #include 3 | #include 4 | #include "gbl/hmi_const.h" 5 | #include 6 | #include "ui/log/zlogfilterdialog.h" 7 | ZOperateLogUI::ZOperateLogUI() 8 | { 9 | 10 | } 11 | ZOperateLogUI::~ZOperateLogUI() 12 | { 13 | 14 | } 15 | 16 | void ZOperateLogUI::ZDoInitial() 17 | { 18 | this->m_tbFilter=new QToolButton; 19 | this->m_tbFilter->setText(tr("Filter")); 20 | this->m_tbFilter->setIcon(QIcon(":/log/images/log/Search.png")); 21 | this->m_tbFilter->setIconSize(QSize(24,24)); 22 | this->m_tbFilter->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); 23 | 24 | this->m_tbExport=new QToolButton; 25 | this->m_tbExport->setText(tr("导出...")); 26 | this->m_tbExport->setIcon(QIcon(":/log/images/log/Export.png")); 27 | this->m_tbExport->setIconSize(QSize(24,24)); 28 | this->m_tbExport->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); 29 | 30 | this->m_tbDelete=new QToolButton; 31 | this->m_tbDelete->setText(tr("删除")); 32 | this->m_tbDelete->setIcon(QIcon(":/log/images/log/Trash.png")); 33 | this->m_tbDelete->setIconSize(QSize(24,24)); 34 | this->m_tbDelete->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); 35 | 36 | this->m_tbPrevious=new QToolButton; 37 | this->m_tbPrevious->setObjectName("PreviousButton"); 38 | this->m_tbPrevious->setIcon(QIcon(":/log/images/log/previous.png")); 39 | this->m_tbPrevious->setIconSize(QSize(20,20)); 40 | this->m_tbNext=new QToolButton; 41 | this->m_tbNext->setObjectName("NextButton"); 42 | this->m_tbNext->setIcon(QIcon(":/log/images/log/next.png")); 43 | this->m_tbNext->setIconSize(QSize(20,20)); 44 | this->m_cbPages=new QComboBox; 45 | this->m_cbPages->addItem(tr("1/10")); 46 | 47 | this->m_hLayoutFilter=new QHBoxLayout; 48 | this->m_hLayoutFilter->addWidget(this->m_tbFilter); 49 | this->m_hLayoutFilter->addWidget(this->m_tbExport); 50 | this->m_hLayoutFilter->addWidget(this->m_tbDelete); 51 | this->m_hLayoutFilter->addStretch(1); 52 | this->m_hLayoutFilter->addWidget(this->m_tbPrevious); 53 | this->m_hLayoutFilter->addWidget(this->m_cbPages); 54 | this->m_hLayoutFilter->addWidget(this->m_tbNext); 55 | 56 | this->m_treeWidget=new QTreeWidget; 57 | this->m_treeWidget->setHeaderLabels(QStringList()<m_treeWidget->setColumnWidth(0,150); 59 | this->m_treeWidget->setColumnWidth(1,100); 60 | this->m_treeWidget->setFocusPolicy(Qt::NoFocus); 61 | this->m_treeWidget->setRootIsDecorated(false); 62 | this->m_treeWidget->header()->setDefaultAlignment(Qt::AlignCenter); 63 | 64 | this->m_vLayoutLog=new QVBoxLayout; 65 | this->m_vLayoutLog->addLayout(this->m_hLayoutFilter); 66 | this->m_vLayoutLog->addWidget(this->m_treeWidget); 67 | this->m_vLayoutLog->setContentsMargins(5,30,5,2); 68 | this->m_frmLog=new ZFrame(tr("日志列表")); 69 | this->m_frmLog->setLayout(this->m_vLayoutLog); 70 | 71 | 72 | this->m_llStorage=new QLabel(tr("1/1000")); 73 | this->m_progressBar=new QProgressBar; 74 | this->m_progressBar->setObjectName("LogStorageProgressBar"); 75 | this->m_progressBar->setRange(0,1000); 76 | this->m_progressBar->setValue(0); 77 | this->m_hLayoutStorage=new QHBoxLayout; 78 | this->m_hLayoutStorage->addWidget(this->m_llStorage); 79 | this->m_hLayoutStorage->addWidget(this->m_progressBar); 80 | this->m_hLayoutStorage->setContentsMargins(5,20,5,2); 81 | this->m_frmStorage=new ZFrame(tr("Storage(存储)")); 82 | this->m_frmStorage->setLayout(this->m_hLayoutStorage); 83 | 84 | 85 | //main layout. 86 | this->m_gLayoutMain=new QGridLayout; 87 | this->m_gLayoutMain->addWidget(this->m_frmLog,0,0,1,1); 88 | this->m_gLayoutMain->addWidget(this->m_frmStorage,1,0,1,1); 89 | this->m_gLayoutMain->setRowStretch(0,5); 90 | this->m_gLayoutMain->setRowStretch(1,1); 91 | this->setLayout(this->m_gLayoutMain); 92 | 93 | connect(this->m_tbFilter,SIGNAL(clicked(bool)),this,SLOT(ZSloFilter())); 94 | connect(this->m_tbExport,SIGNAL(clicked(bool)),this,SLOT(ZSloExport())); 95 | connect(this->m_tbDelete,SIGNAL(clicked(bool)),this,SLOT(ZSloDelete())); 96 | } 97 | void ZOperateLogUI::ZUnInitial() 98 | { 99 | delete this->m_tbFilter; 100 | delete this->m_tbExport; 101 | delete this->m_tbDelete; 102 | delete this->m_tbPrevious; 103 | delete this->m_tbNext; 104 | delete this->m_cbPages; 105 | delete this->m_hLayoutFilter; 106 | delete this->m_treeWidget; 107 | delete this->m_vLayoutLog; 108 | delete this->m_frmLog; 109 | 110 | delete this->m_llStorage; 111 | delete this->m_progressBar; 112 | delete this->m_hLayoutStorage; 113 | delete this->m_frmStorage; 114 | 115 | delete this->m_gLayoutMain; 116 | } 117 | void ZOperateLogUI::ZSloFilter() 118 | { 119 | ZLogFilterDialog dia(tr("Log Filter Dialog")); 120 | if(dia.exec()==QDialog::Accepted) 121 | { 122 | 123 | } 124 | } 125 | void ZOperateLogUI::ZSloExport() 126 | { 127 | 128 | } 129 | void ZOperateLogUI::ZSloDelete() 130 | { 131 | 132 | } 133 | void ZOperateLogUI::ZFetchLogs() 134 | { 135 | //check database log record. 136 | qint32 tRows=gDB.ZGetRecordCount("OpLogTable"); 137 | qint32 tPages=tRows/10; 138 | this->m_cbPages->clear(); 139 | for(qint32 i=0;im_cbPages->addItem(QString("%1/%2").arg(i+1).arg(tPages)); 142 | } 143 | qint32 maxRows=gDB.ZGetMaxRecordCount("OpLogTable"); 144 | this->m_llStorage->setText(QString("%1/%2").arg(tRows).arg(maxRows)); 145 | this->m_progressBar->setRange(0,maxRows); 146 | this->m_progressBar->setValue(tRows); 147 | 148 | this->m_treeWidget->clear(); 149 | QStringList dateTime; 150 | QStringList logType; 151 | QStringList logMsg; 152 | if(!gDB.ZGetOPLogRecord(0,10,dateTime,logType,logMsg)) 153 | { 154 | for(qint32 i=0;isetTextAlignment(0,Qt::AlignCenter); 158 | item->setTextAlignment(1,Qt::AlignCenter); 159 | item->setTextAlignment(2,Qt::AlignCenter); 160 | item->setText(0,dateTime.at(i)); 161 | item->setText(1,logType.at(i)); 162 | item->setText(2,logMsg.at(i)); 163 | this->m_treeWidget->addTopLevelItem(item); 164 | } 165 | } 166 | } 167 | -------------------------------------------------------------------------------- /ui/log/zoperatelogui.h: -------------------------------------------------------------------------------- 1 | #ifndef ZOPERATELOGUI_H 2 | #define ZOPERATELOGUI_H 3 | 4 | #include "base/zbaseui.h" 5 | #include "ui/zframe.h" 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | class ZOperateLogUI:public ZBaseUI 14 | { 15 | Q_OBJECT 16 | public: 17 | ZOperateLogUI(); 18 | ~ZOperateLogUI(); 19 | 20 | void ZDoInitial(); 21 | void ZUnInitial(); 22 | 23 | void ZFetchLogs(); 24 | 25 | private slots: 26 | void ZSloFilter(); 27 | void ZSloExport(); 28 | void ZSloDelete(); 29 | private: 30 | 31 | QToolButton *m_tbFilter; 32 | QToolButton *m_tbExport; 33 | QToolButton *m_tbDelete; 34 | QToolButton *m_tbPrevious; 35 | QToolButton *m_tbNext; 36 | QComboBox *m_cbPages; 37 | QHBoxLayout *m_hLayoutFilter; 38 | QTreeWidget *m_treeWidget; 39 | QVBoxLayout *m_vLayoutLog; 40 | ZFrame *m_frmLog; 41 | 42 | QLabel *m_llStorage; 43 | QProgressBar *m_progressBar; 44 | QHBoxLayout *m_hLayoutStorage; 45 | ZFrame *m_frmStorage; 46 | 47 | QGridLayout *m_gLayoutMain; 48 | }; 49 | 50 | #endif // ZOPERATELOGUI_H 51 | -------------------------------------------------------------------------------- /ui/zaboutui.cpp: -------------------------------------------------------------------------------- 1 | #include "zaboutui.h" 2 | #include "gbl/hmi_const.h" 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "qr.h" 9 | using namespace std; 10 | ZAboutUI::ZAboutUI() 11 | { 12 | this->setObjectName("aboutUI"); 13 | } 14 | ZAboutUI::~ZAboutUI() 15 | { 16 | 17 | } 18 | void ZAboutUI::ZDoInitial() 19 | { 20 | this->m_llManufacturer=new QLabel; 21 | this->m_llManufacturer->setObjectName("ZAboutUILabel"); 22 | this->m_llManufacturer->setText(QString("设备制造商:%1").arg(DEVICE_MANUFACTURER)); 23 | 24 | this->m_llTechSupport=new QLabel; 25 | this->m_llTechSupport->setObjectName("ZAboutUILabel"); 26 | this->m_llTechSupport->setText(QString("技术支持: %1").arg(TECH_SUPPORT)); 27 | 28 | this->m_llUIVerNo=new QLabel; 29 | this->m_llUIVerNo->setObjectName("ZAboutUILabel"); 30 | this->m_llUIVerNo->setText(QString("UI版本号:%1").arg(UI_VERSION)); 31 | 32 | this->m_llPublishDate=new QLabel; 33 | this->m_llPublishDate->setObjectName("ZAboutUILabel"); 34 | this->m_llPublishDate->setText(QString("发布日期:%1 %2").arg(QString(__DATE__)).arg(QString(__TIME__))); 35 | 36 | this->m_tbUIUpgrade=new QToolButton; 37 | this->m_tbUIUpgrade->setText(tr("升级...")); 38 | connect(this->m_tbUIUpgrade,SIGNAL(clicked(bool)),this,SLOT(ZSloUpdateHMI())); 39 | 40 | this->m_llFirmwareNo=new QLabel; 41 | this->m_llFirmwareNo->setObjectName("ZAboutUILabel"); 42 | this->m_llFirmwareNo->setText(QString("光源版本号:%1").arg("Unknown")); 43 | this->m_llProductNo=new QLabel; 44 | this->m_llProductNo->setObjectName("ZAboutUILabel"); 45 | this->m_llProductNo->setText(QString("光源产品编号:%1").arg("Unknown")); 46 | this->m_tbFirmwareUpgrade=new QToolButton; 47 | this->m_tbFirmwareUpgrade->setText(tr("升级...")); 48 | 49 | connect(this->m_tbFirmwareUpgrade,SIGNAL(clicked(bool)),this,SLOT(ZSloUpdatePLaser())); 50 | 51 | 52 | 53 | this->m_gLayoutInfo=new QGridLayout; 54 | this->m_gLayoutInfo->addWidget(this->m_llManufacturer,0,0,1,3); 55 | this->m_gLayoutInfo->addWidget(this->m_llTechSupport,1,0,1,3); 56 | 57 | this->m_gLayoutInfo->addWidget(this->m_llUIVerNo,2,0,1,1); 58 | this->m_gLayoutInfo->addWidget(this->m_llPublishDate,2,1,1,1); 59 | this->m_gLayoutInfo->addWidget(this->m_tbUIUpgrade,2,2,1,1); 60 | 61 | this->m_gLayoutInfo->addWidget(this->m_llFirmwareNo,3,0,1,1); 62 | this->m_gLayoutInfo->addWidget(this->m_llProductNo,3,1,1,1); 63 | this->m_gLayoutInfo->addWidget(this->m_tbFirmwareUpgrade,3,2,1,1); 64 | 65 | this->m_gLayoutInfo->setContentsMargins(20,50,20,50); 66 | this->m_frmInfo=new ZFrame(tr("系统信息")); 67 | this->m_frmInfo->setLayout(this->m_gLayoutInfo); 68 | 69 | this->m_llLogo=new QLabel; 70 | this->m_llLogo->setPixmap(QPixmap(":/about/images/about/logo.png").scaled(400,200)); 71 | this->m_llLogo->setScaledContents(true); 72 | 73 | this->m_frmVLayout=new QVBoxLayout; 74 | // this->m_frmVLayout->addStretch(1); 75 | this->m_frmVLayout->addWidget(this->m_frmInfo,0,Qt::AlignCenter); 76 | this->m_frmVLayout->addWidget(this->m_llLogo,0,Qt::AlignCenter); 77 | this->setLayout(this->m_frmVLayout); 78 | 79 | this->m_timer=new QTimer; 80 | connect(this->m_timer,SIGNAL(timeout()),this,SLOT(ZSloTimeout())); 81 | this->m_timer->start(1000); 82 | } 83 | void ZAboutUI::ZUnInitial() 84 | { 85 | this->m_timer->stop(); 86 | delete this->m_timer; 87 | 88 | delete this->m_llManufacturer; 89 | delete this->m_llTechSupport; 90 | delete this->m_llUIVerNo; 91 | delete this->m_llPublishDate; 92 | delete this->m_tbUIUpgrade; 93 | delete this->m_llFirmwareNo; 94 | delete this->m_llProductNo; 95 | delete this->m_tbFirmwareUpgrade; 96 | 97 | delete this->m_gLayoutInfo; 98 | delete this->m_frmInfo; 99 | 100 | delete this->m_llLogo; 101 | delete this->m_frmVLayout; 102 | } 103 | void ZAboutUI::ZSloUpdateHMI() 104 | { 105 | g_GblHelp.beep(); 106 | ZUpdateWizardDialog dia; 107 | dia.exec(); 108 | } 109 | void ZAboutUI::ZSloTimeout() 110 | { 111 | this->m_llFirmwareNo->setText(QString("光源版本号:%1").arg(g_GblHelp.m_glaserVerNo)); 112 | this->m_llProductNo->setText(QString("光源产品编号:%1").arg(g_GblHelp.m_glaserProductNo)); 113 | } 114 | void ZAboutUI::ZSloUpdatePLaser() 115 | { 116 | ZQRDialog dia; 117 | dia.exec(); 118 | } 119 | ZQRDialog::ZQRDialog() 120 | { 121 | //generate qr code. 122 | QString obj(tr("Embedded Electronic Product Development 13522296239")); 123 | QByteArray baDevID=obj.toLatin1(); 124 | //generate QR code. 125 | int errcode = QR_ERR_NONE; 126 | //qrInit的5个参数分别是version,mode,纠错等级和掩码,使用过程中使用除了QR_EM_8BIT以外的mode会生成不正常的二维码,暂时不知道原因。 127 | QRCode* p = qrInit(10, QR_EM_8BIT, 2, -1, &errcode); 128 | if (p == NULL) 129 | { 130 | printf("error\n"); 131 | return; 132 | } 133 | 134 | qrAddData(p, (const qr_byte_t* )baDevID.data(), baDevID.length()); 135 | //注意需要调用qrFinalize函数 136 | if (!qrFinalize(p)) 137 | { 138 | printf("finalize error\n"); 139 | return; 140 | } 141 | int size = 0; 142 | //两个5分别表示:像素之间的距离和二维码图片的放大倍数,范围都是1-16 143 | qr_byte_t * buffer = qrSymbolToPNG(p, 1, 1, &size); 144 | if (buffer == NULL) 145 | { 146 | printf("error %s", qrGetErrorInfo(p)); 147 | return; 148 | } 149 | ofstream f("/tmp/qrcode.png"); 150 | f.write((const char *)buffer, size); 151 | f.close(); 152 | 153 | this->m_llQRCode=new QLabel; 154 | QPixmap qrcode; 155 | qrcode.load("/tmp/qrcode.png","PNG"); 156 | this->m_llQRCode->setPixmap(qrcode.scaled(200,200)); 157 | 158 | this->m_tbClose=new QToolButton; 159 | this->m_tbClose->setText(tr("CLOSE ME")); 160 | this->m_vLayout=new QVBoxLayout; 161 | this->m_vLayout->addWidget(this->m_llQRCode,0,Qt::AlignCenter); 162 | this->m_vLayout->addWidget(this->m_tbClose,0,Qt::AlignCenter); 163 | this->setLayout(this->m_vLayout); 164 | 165 | connect(this->m_tbClose,SIGNAL(clicked(bool)),this,SLOT(accept())); 166 | } 167 | ZQRDialog::~ZQRDialog() 168 | { 169 | delete this->m_llQRCode; 170 | delete this->m_tbClose; 171 | delete this->m_vLayout; 172 | } 173 | -------------------------------------------------------------------------------- /ui/zaboutui.h: -------------------------------------------------------------------------------- 1 | #ifndef ZABOUTUI_H 2 | #define ZABOUTUI_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include "base/zbaseui.h" 13 | #include "ui/zframe.h" 14 | #include 15 | 16 | class ZAboutUI:public ZBaseUI 17 | { 18 | Q_OBJECT 19 | public: 20 | ZAboutUI(); 21 | ~ZAboutUI(); 22 | 23 | void ZDoInitial(); 24 | void ZUnInitial(); 25 | signals: 26 | void ZSigDumpDbgMsg(QString msg); 27 | private slots: 28 | void ZSloUpdateHMI(); 29 | void ZSloUpdatePLaser(); 30 | void ZSloTimeout(); 31 | private: 32 | QLabel *m_llManufacturer; 33 | QLabel *m_llTechSupport; 34 | 35 | QLabel *m_llUIVerNo; 36 | QLabel *m_llPublishDate; 37 | QToolButton *m_tbUIUpgrade; 38 | 39 | QLabel *m_llFirmwareNo; 40 | QLabel *m_llProductNo; 41 | QToolButton *m_tbFirmwareUpgrade; 42 | 43 | QGridLayout *m_gLayoutInfo; 44 | ZFrame *m_frmInfo; 45 | 46 | QLabel *m_llLogo; 47 | QVBoxLayout *m_frmVLayout; 48 | 49 | //this page update timer. 50 | QTimer *m_timer; 51 | }; 52 | class ZQRDialog:public QDialog 53 | { 54 | public: 55 | ZQRDialog(); 56 | ~ZQRDialog(); 57 | private: 58 | QLabel *m_llQRCode; 59 | QToolButton *m_tbClose; 60 | QVBoxLayout *m_vLayout; 61 | 62 | }; 63 | #endif // ZABOUTUI_H 64 | -------------------------------------------------------------------------------- /ui/zbarui.cpp: -------------------------------------------------------------------------------- 1 | #include "zbarui.h" 2 | 3 | ZBarUI::ZBarUI() 4 | { 5 | 6 | } 7 | ZBarUI::~ZBarUI() 8 | { 9 | 10 | } 11 | void ZBarUI::ZDoInitial() 12 | { 13 | 14 | } 15 | void ZBarUI::ZUnInitial() 16 | { 17 | 18 | } 19 | -------------------------------------------------------------------------------- /ui/zbarui.h: -------------------------------------------------------------------------------- 1 | #ifndef ZBARUI_H 2 | #define ZBARUI_H 3 | 4 | #include "base/zbaseui.h" 5 | #include 6 | #include 7 | class ZBarUI : public QFrame 8 | { 9 | Q_OBJECT 10 | public: 11 | ZBarUI(); 12 | ~ZBarUI(); 13 | 14 | void ZDoInitial(); 15 | void ZUnInitial(); 16 | protected: 17 | QHBoxLayout *m_hLayout; 18 | }; 19 | 20 | #endif // ZBARUI_H 21 | -------------------------------------------------------------------------------- /ui/zbottombar.cpp: -------------------------------------------------------------------------------- 1 | #include "zbottombar.h" 2 | #include 3 | #include 4 | #include "ui/zshutdwndia.h" 5 | #include 6 | #include 7 | ZBottomBar::ZBottomBar() 8 | { 9 | this->setObjectName("bottomBar"); 10 | } 11 | ZBottomBar::~ZBottomBar() 12 | { 13 | 14 | } 15 | void ZBottomBar::ZDoInitial() 16 | { 17 | this->m_llIPAddr=new ZTextImgLabel(tr("辰星研究院")); 18 | 19 | this->m_llRunTime=new ZTextImgLabel(tr("已运行:0天0时0分0秒")); 20 | 21 | this->m_llAuthority=new ZTextImgLabel(tr("授权"),QPixmap(":/topbar/images/led/led_yellow.png")); 22 | this->m_llLinkLED=new ZTextImgLabel(tr("设备"),QPixmap(":/topbar/images/led/led_yellow.png")); 23 | this->m_llTxRxLED=new ZTextImgLabel(tr("通信"),QPixmap(":/topbar/images/led/led_yellow.png")); 24 | this->m_llErrLED=new ZTextImgLabel(tr("解码"),QPixmap(":/topbar/images/led/led_yellow.png")); 25 | this->m_llProjectPwr=new ZTextImgLabel(tr("放映机"),QPixmap(":/topbar/images/led/led_yellow.png")); 26 | 27 | this->m_tbReturn=new QToolButton; 28 | this->m_tbReturn->setObjectName("ZBottomBarReturnBtn"); 29 | this->m_tbReturn->setIcon(QIcon(":/bottombar/images/bottombar/Exit.png")); 30 | this->m_tbReturn->setIconSize(QSize(40,40)); 31 | this->m_tbReturn->setVisible(false); 32 | 33 | this->m_hLayout=new QHBoxLayout; 34 | this->m_hLayout->setSpacing(15); 35 | this->m_hLayout->addWidget(this->m_llIPAddr); 36 | this->m_hLayout->addWidget(this->m_llRunTime); 37 | this->m_hLayout->addWidget(this->m_llAuthority); 38 | this->m_hLayout->addWidget(this->m_llLinkLED); 39 | this->m_hLayout->addWidget(this->m_llTxRxLED); 40 | this->m_hLayout->addWidget(this->m_llErrLED); 41 | this->m_hLayout->addWidget(this->m_llProjectPwr); 42 | this->m_hLayout->addStretch(1); 43 | this->m_hLayout->addWidget(this->m_tbReturn); 44 | this->setLayout(this->m_hLayout); 45 | 46 | connect(this->m_tbReturn,SIGNAL(clicked(bool)),this,SLOT(ZSlotReturn())); 47 | this->m_runSeconds=0; 48 | this->m_tmTick=new QTimer; 49 | connect(this->m_tmTick,SIGNAL(timeout()),this,SLOT(ZSloUptRunTime())); 50 | this->m_tmTick->start(1000); 51 | } 52 | void ZBottomBar::ZUnInitial() 53 | { 54 | this->m_tmTick->stop(); 55 | delete this->m_tmTick; 56 | 57 | delete this->m_llIPAddr; 58 | delete this->m_llRunTime; 59 | delete this->m_llAuthority; 60 | delete this->m_llLinkLED; 61 | delete this->m_llTxRxLED; 62 | delete this->m_llErrLED; 63 | delete this->m_llProjectPwr; 64 | delete this->m_tbReturn; 65 | 66 | delete this->m_hLayout; 67 | } 68 | void ZBottomBar::ZSetReturnButtonVisible(bool visible) 69 | { 70 | this->m_tbReturn->setVisible(visible); 71 | } 72 | void ZBottomBar::ZSloDecodeDone(qint32 state) 73 | { 74 | switch(state) 75 | { 76 | case -1: 77 | this->m_llErrLED->ZSetPixmap(QPixmap(":/topbar/images/led/led_red.png")); 78 | break; 79 | case 0: 80 | this->m_llErrLED->ZSetPixmap(QPixmap(":/topbar/images/led/led_green.png")); 81 | break; 82 | case 1: 83 | this->m_llErrLED->ZSetPixmap(QPixmap(":/topbar/images/led/led_yellow.png")); 84 | break; 85 | } 86 | } 87 | void ZBottomBar::ZSloTxRxDone(qint32 state) 88 | { 89 | switch(state) 90 | { 91 | case -1: 92 | this->m_llTxRxLED->ZSetPixmap(QPixmap(":/topbar/images/led/led_red.png")); 93 | break; 94 | case 0: 95 | this->m_llTxRxLED->ZSetPixmap(QPixmap(":/topbar/images/led/led_green.png")); 96 | break; 97 | case 1: 98 | this->m_llTxRxLED->ZSetPixmap(QPixmap(":/topbar/images/led/led_yellow.png")); 99 | break; 100 | } 101 | } 102 | void ZBottomBar::ZSloDevLinkState(qint32 state) 103 | { 104 | switch(state) 105 | { 106 | case -1: 107 | this->m_llLinkLED->ZSetPixmap(QPixmap(":/topbar/images/led/led_red.png")); 108 | break; 109 | case 0: 110 | this->m_llLinkLED->ZSetPixmap(QPixmap(":/topbar/images/led/led_green.png")); 111 | break; 112 | case 1: 113 | this->m_llLinkLED->ZSetPixmap(QPixmap(":/topbar/images/led/led_yellow.png")); 114 | break; 115 | } 116 | } 117 | void ZBottomBar::ZSloUptRunTime(void) 118 | { 119 | this->m_runSeconds++; 120 | qint32 tDays=this->m_runSeconds/SECONDS_ONE_DAY; 121 | qint32 tDaysRemain=this->m_runSeconds%SECONDS_ONE_DAY; 122 | qint32 tHour=tDaysRemain/SECONDS_ONE_HOUR; 123 | qint32 tHourRemain=tDaysRemain%SECONDS_ONE_HOUR; 124 | qint32 tMinute=tHourRemain/SECONDS_ONE_MINUTE; 125 | qint32 tMinuteRemain=tHourRemain%SECONDS_ONE_MINUTE; 126 | qint32 tSecond=tMinuteRemain; 127 | 128 | this->m_llRunTime->ZSetText(QString("已运行:%1天%2时%3分%4秒").arg(tDays).arg(tHour).arg(tMinute).arg(tSecond)); 129 | if(g_GblHelp.m_projectPwrOn) 130 | { 131 | this->m_llProjectPwr->ZSetPixmap(QPixmap(":/topbar/images/led/led_green.png")); 132 | }else{ 133 | this->m_llProjectPwr->ZSetPixmap(QPixmap(":/topbar/images/led/led_red.png")); 134 | } 135 | } 136 | void ZBottomBar::ZSlotReturn() 137 | { 138 | QMessageBox msgBox; 139 | msgBox.setWindowFlags(Qt::FramelessWindowHint); 140 | ZShutDwnDia dia; 141 | dia.exec(); 142 | switch(dia.ZGetRetCode()) 143 | { 144 | case 1://logout. 145 | msgBox.setText(tr("Logout Confirmation")); 146 | msgBox.setText(tr("Are you sure to logout?")); 147 | msgBox.setStandardButtons(QMessageBox::Yes|QMessageBox::No); 148 | msgBox.setDefaultButton(QMessageBox::No); 149 | if(msgBox.exec()==QMessageBox::Yes) 150 | { 151 | emit this->ZSigReturn(); 152 | } 153 | break; 154 | case 2://reboot. 155 | msgBox.setText(tr("Reboot Confirmation")); 156 | msgBox.setText(tr("Are you sure to reboot?")); 157 | msgBox.setStandardButtons(QMessageBox::Yes|QMessageBox::No); 158 | msgBox.setDefaultButton(QMessageBox::No); 159 | if(msgBox.exec()==QMessageBox::Yes) 160 | { 161 | QProcess p; 162 | p.start("/sbin/reboot"); 163 | p.waitForFinished(); 164 | } 165 | break; 166 | case 3://shutdown. 167 | msgBox.setText(tr("Shutdown Confirmation")); 168 | msgBox.setText(tr("Are you sure to shutdown?")); 169 | msgBox.setStandardButtons(QMessageBox::Yes|QMessageBox::No); 170 | msgBox.setDefaultButton(QMessageBox::No); 171 | if(msgBox.exec()==QMessageBox::Yes) 172 | { 173 | QProcess p; 174 | p.start("/sbin/poweroff"); 175 | p.waitForFinished(); 176 | } 177 | break; 178 | case 4://cancel. 179 | break; 180 | default: 181 | break; 182 | } 183 | 184 | } 185 | -------------------------------------------------------------------------------- /ui/zbottombar.h: -------------------------------------------------------------------------------- 1 | #ifndef ZBOTTOMBAR_H 2 | #define ZBOTTOMBAR_H 3 | 4 | #include "ui/zbarui.h" 5 | #include "ui/ztextimglabel.h" 6 | #include 7 | #include 8 | #include 9 | #define SECONDS_ONE_DAY (24*60*60) 10 | #define SECONDS_ONE_HOUR (60*60) 11 | #define SECONDS_ONE_MINUTE (60) 12 | class ZBottomBar : public ZBarUI 13 | { 14 | Q_OBJECT 15 | public: 16 | ZBottomBar(); 17 | ~ZBottomBar(); 18 | 19 | void ZDoInitial(); 20 | void ZUnInitial(); 21 | void ZSetReturnButtonVisible(bool visible); 22 | public slots: 23 | void ZSloDecodeDone(qint32 state); 24 | void ZSloTxRxDone(qint32 state); 25 | void ZSloDevLinkState(qint32 state); 26 | signals: 27 | void ZSigReturn(); 28 | signals: 29 | void ZSigDumpDbgMsg(QString msg); 30 | private slots: 31 | void ZSloUptRunTime(void); 32 | void ZSlotReturn(); 33 | private: 34 | ZTextImgLabel *m_llIPAddr; 35 | ZTextImgLabel *m_llRunTime; 36 | ZTextImgLabel *m_llAuthority; 37 | ZTextImgLabel *m_llLinkLED; 38 | ZTextImgLabel *m_llTxRxLED; 39 | ZTextImgLabel *m_llErrLED; 40 | ZTextImgLabel *m_llProjectPwr; 41 | QToolButton *m_tbReturn; 42 | 43 | QTimer *m_tmTick; 44 | qint64 m_runSeconds; 45 | 46 | }; 47 | 48 | #endif // ZBOTTOMBAR_H 49 | -------------------------------------------------------------------------------- /ui/zcheckbox.cpp: -------------------------------------------------------------------------------- 1 | #include "zcheckbox.h" 2 | 3 | ZCheckBox::ZCheckBox(QString tips) 4 | { 5 | this->setObjectName("ZCheckBoxFrame"); 6 | this->m_cb=new QCheckBox; 7 | this->m_cb->setText(tips); 8 | this->m_hLayout=new QHBoxLayout; 9 | this->m_hLayout->addWidget(this->m_cb); 10 | this->m_hLayout->setContentsMargins(10,20,10,20); 11 | this->setLayout(this->m_hLayout); 12 | 13 | connect(this->m_cb,SIGNAL(stateChanged(int)),this,SIGNAL(ZSigStateChanged(qint32))); 14 | } 15 | ZCheckBox::~ZCheckBox() 16 | { 17 | delete this->m_cb; 18 | delete this->m_hLayout; 19 | } 20 | bool ZCheckBox::ZIsChecked() 21 | { 22 | return this->m_cb->isChecked(); 23 | } 24 | void ZCheckBox::ZSetChecked(bool checked) 25 | { 26 | this->m_cb->setChecked(checked); 27 | } 28 | QString ZCheckBox::text() 29 | { 30 | return this->m_cb->text(); 31 | } 32 | -------------------------------------------------------------------------------- /ui/zcheckbox.h: -------------------------------------------------------------------------------- 1 | #ifndef ZCHECKBOX_H 2 | #define ZCHECKBOX_H 3 | 4 | #include 5 | #include 6 | #include 7 | class ZCheckBox : public QFrame 8 | { 9 | Q_OBJECT 10 | public: 11 | ZCheckBox(QString tips); 12 | ~ZCheckBox(); 13 | bool ZIsChecked(); 14 | void ZSetChecked(bool checked); 15 | QString text(); 16 | signals: 17 | void ZSigStateChanged(qint32 state); 18 | private: 19 | QHBoxLayout *m_hLayout; 20 | QCheckBox *m_cb; 21 | }; 22 | 23 | #endif // ZCHECKBOX_H 24 | -------------------------------------------------------------------------------- /ui/zchillerui.h: -------------------------------------------------------------------------------- 1 | #ifndef ZCHILLERUI_H 2 | #define ZCHILLERUI_H 3 | 4 | #include "base/zbaseui.h" 5 | #include "ui/ztextimglabel.h" 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include "ui/zframe.h" 13 | #include "ui/ztextlineeditlabel.h" 14 | #include "ui/zvslider.h" 15 | #include 16 | #include 17 | #include 18 | #include 19 | class ZChillerUI : public ZBaseUI 20 | { 21 | Q_OBJECT 22 | public: 23 | ZChillerUI(quint8 chillerNo); 24 | ~ZChillerUI(); 25 | 26 | void ZDoInitial(); 27 | void ZUnInitial(); 28 | protected: 29 | bool event(QEvent *e); 30 | public slots: 31 | void ZSloChillerCmdResponse(QString cmd,QString arguments); 32 | void ZSloOtherPwrOn(bool powerOn); 33 | private slots: 34 | void ZSloTimeout1s(); 35 | void ZSloBypassChiller(); 36 | void ZSloPowerOnChiller(); 37 | void ZSloShowSetChillerTempDialog(); 38 | 39 | void ZSloTabChanged(qint32 index); 40 | void ZSloSetEnterFlowParameters(); 41 | signals: 42 | void ZSigDumpDbgMsg(QString msg); 43 | void ZSigPopMessage(QString msg); 44 | void ZSigRequestCmd(QString cmd,QString arguments); 45 | void ZSigOtherPwrOn(bool powerOn); 46 | private: 47 | ZCircleIndicator *m_vsEnterWater; 48 | ZCircleIndicator *m_vsLeaveWater; 49 | ZCircleIndicator *m_vsAmbientTemp; 50 | 51 | QGridLayout *m_gLayoutTemp; 52 | ZFrame *m_frmTemp; 53 | 54 | //flow speed. 55 | ZTextLineEditLabel *m_leEnterSpeed; 56 | ZTextLineEditLabel *m_leLeaveSpeed; 57 | QGridLayout *m_gLayoutSpeed; 58 | QFrame *m_frmSpeed; 59 | 60 | //control. 61 | QToolButton *m_tbBypass; 62 | QToolButton *m_tbPwrCtl; 63 | QToolButton *m_tbSetup; 64 | QGridLayout *m_gLayoutControl; 65 | QFrame *m_frmControl; 66 | 67 | //setup. 68 | QFrame *m_frmSetup; 69 | ZTextLineEditLabel *m_leChillerTemp; 70 | ZCheckBox *m_cbEnFangJieLu; 71 | QToolButton *m_tbSaveChiller; 72 | QGridLayout *m_gLayoutSetup; 73 | 74 | //alarm&fault. 75 | QFrame *m_frmFault; 76 | ZTextImgLabel *m_faultLED[16]; 77 | QGridLayout *m_gLayoutFault; 78 | 79 | //tab widget. 80 | QFrame *m_frmTab; 81 | QTabWidget *m_tabWidget; 82 | QVBoxLayout *m_vLayoutTab; 83 | 84 | ZTextImgLabel *m_llCommunicate; 85 | ZTextImgLabel *m_llWaterLevel; 86 | ZTextImgLabel *m_llSelfProtect; 87 | ZTextImgLabel *m_llOthers; 88 | QGridLayout *m_gLayoutStatus; 89 | ZFrame *m_frmStatus; 90 | 91 | QGridLayout *m_gLayoutMain; 92 | 93 | bool m_bChillerPwrOn; 94 | bool m_bChillerBypass; 95 | 96 | quint8 m_chillerNo; 97 | 98 | 99 | //update timer. 100 | QTimer *m_timer1s; 101 | qint32 m_nTime1sCounter; 102 | bool m_bCmdRunning; 103 | 104 | //2 chillers mutex. 105 | bool m_bEnableMe; 106 | 107 | //fixup for QWindow::isVisible(). 108 | bool m_bProcessEvent; 109 | }; 110 | class ZChillerManager:public ZBaseUI 111 | { 112 | Q_OBJECT 113 | public: 114 | ZChillerManager(); 115 | ~ZChillerManager(); 116 | void ZDoInitial(); 117 | void ZUnInitial(); 118 | signals: 119 | void ZSigDumpDbgMsg(QString dbgMsg); 120 | void ZSigRequestCmd(QString cmd,QString arguments); 121 | void ZSigResponseCmdChillerCtl(QString cmd,QString arguments); 122 | void ZSigResponseCmdChillerFault(QString cmd,QString arguments); 123 | void ZSigResponseCmdChillerFlow(QString cmd,QString arguments); 124 | void ZSigResponseCmdChillerTemp(QString cmd,QString arguments); 125 | 126 | void ZSigPopMessage(QString msg); 127 | private slots: 128 | void ZSloTabChanged(qint32 index); 129 | private: 130 | QTabWidget *m_tabWidget; 131 | ZChillerUI *m_chiller[2]; 132 | QVBoxLayout *m_vLayout; 133 | }; 134 | #endif // ZCHILLERUI_H 135 | -------------------------------------------------------------------------------- /ui/zcircleindicator.h: -------------------------------------------------------------------------------- 1 | #ifndef ZCIRCLEINDICATOR_H 2 | #define ZCIRCLEINDICATOR_H 3 | 4 | #define LONG1 10 5 | #define OK1 7 6 | #define SHORT1 5 7 | #define SPACE1 3 8 | #define ANGLE1 10 9 | 10 | #include 11 | #include 12 | class ZCircleIndicator : public QWidget 13 | { 14 | Q_OBJECT 15 | public: 16 | explicit ZCircleIndicator(QString title,QWidget *parent = 0); 17 | 18 | public slots: 19 | void setValue(qreal value); 20 | void setAnimating(bool enable) 21 | { 22 | m_bAnimating=enable; 23 | update(); 24 | } 25 | 26 | public: 27 | bool isAnimating() const 28 | { 29 | return m_bAnimating; 30 | } 31 | 32 | protected: 33 | void paintEvent(QPaintEvent *); 34 | 35 | QSize sizeHint() const 36 | { 37 | return QSize(300,300); 38 | } 39 | 40 | QSize minimumSizeHint() const 41 | { 42 | return QSize(200,200); 43 | } 44 | 45 | private: 46 | void drawOuterCircle(QPainter* painter); 47 | void drawInnerCircle(QPainter* painter); 48 | void drawMark(QPainter* painter); 49 | void drawCoverCircle(QPainter* painter); 50 | void drawColorPie(QPainter* painter); 51 | void drawIndicator(QPainter* painter); 52 | void drawCoverBall(QPainter* painter); 53 | void resetVariables(QPainter* painter); 54 | void drawTextRect(QPainter* painter); 55 | 56 | private: 57 | qreal m_outerRadius; 58 | qreal m_innerRadius; 59 | qreal m_coverCircleRadius; 60 | qreal m_colorCircleRadius; 61 | qreal m_coverBallRadius; 62 | QPointF m_center; 63 | QRectF m_colorCircleRect; 64 | qreal m_value; 65 | QTimer* updateTimer; 66 | bool m_bReverse; 67 | qreal m_currentValue; 68 | QTimer* singleTimer; 69 | bool m_bAnimating; 70 | 71 | QString m_title; 72 | private: 73 | void initVariables(); 74 | 75 | private slots: 76 | void UpdateGraph(); 77 | }; 78 | #endif // ZCIRCLEINDICATOR_H 79 | -------------------------------------------------------------------------------- /ui/zcolortemptuningdia.h: -------------------------------------------------------------------------------- 1 | #ifndef ZCOLORTEMPTUNINGDIA_H 2 | #define ZCOLORTEMPTUNINGDIA_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | class ZColorTempTuningDia:public QDialog 11 | { 12 | Q_OBJECT 13 | public: 14 | ZColorTempTuningDia(quint8 glaserAddr,QString colorTempName); 15 | ~ZColorTempTuningDia(); 16 | public slots: 17 | void ZSloSyncColorTemp(QString arguments); 18 | void ZSloSyncColorTempPercent(QString cmd,QString arguments); 19 | void ZSloAdjRGBPercent(QString cmd,QString arguments); 20 | 21 | signals: 22 | void ZSigRequestCmd(QString cmd,QString arguments); 23 | void ZSigPopMessage(QString msg); 24 | void ZSigRequestPrecisSetup(QString channel); 25 | void ZSigDumpDbgMsg(QString msg); 26 | protected: 27 | bool eventFilter(QObject *watched, QEvent *event); 28 | private slots: 29 | void ZSlotSync(); 30 | void ZSlotSave(); 31 | void ZSlotDefault(); 32 | void ZSlotClose(); 33 | void ZSlotValueChanged(); 34 | void ZSlotReadDB(); 35 | 36 | void ZSlotShowPrecisSetupDialog(QString channel); 37 | private: 38 | QLabel *m_llTitle; 39 | QToolButton *m_tbRedDec; 40 | QToolButton *m_tbRedInc; 41 | //ZProgressBar *m_pbRed; 42 | ZVerticalIndicator *m_pbRed; 43 | QToolButton *m_tbGreenDec; 44 | QToolButton *m_tbGreenInc; 45 | //ZProgressBar *m_pbGreen; 46 | ZVerticalIndicator *m_pbGreen; 47 | QToolButton *m_tbBlueDec; 48 | QToolButton *m_tbBlueInc; 49 | //ZProgressBar *m_pbBlue; 50 | ZVerticalIndicator *m_pbBlue; 51 | QGridLayout *m_gLayoutTuning; 52 | 53 | QLabel *m_llOpTips; 54 | QToolButton *m_tbSync; 55 | QToolButton *m_tbSave; 56 | QToolButton *m_tbDefault; 57 | QToolButton *m_tbClose; 58 | QHBoxLayout *m_hLayout; 59 | QVBoxLayout *m_vLayout; 60 | QFrame *m_frm; 61 | QVBoxLayout *m_vLayoutFrm; 62 | 63 | QString m_colorTempName; 64 | float m_redDefault; 65 | float m_greenDefault; 66 | float m_blueDefault; 67 | 68 | quint8 m_glaserAddress; 69 | 70 | //fixup for QWindow::isVisible() 71 | //?? ?? ?? 72 | //QApplicationPrivate::notify_helper(QObject*,QEvent*). 73 | bool m_bProcessEvent; 74 | }; 75 | 76 | #endif // ZCOLORTEMPTUNINGDIA_H 77 | -------------------------------------------------------------------------------- /ui/zcurveui.cpp: -------------------------------------------------------------------------------- 1 | #include "zcurveui.h" 2 | #include 3 | #include 4 | #include 5 | ZCurveUI::ZCurveUI(QString title) 6 | { 7 | this->setObjectName("ZCurveUI"); 8 | this->m_maxSize=30; 9 | this->m_maxValue=100; 10 | 11 | 12 | this->m_chart=new QChart; 13 | //this->m_chart->addSeries(this->m_scatterSeries); 14 | 15 | for(qint32 i=0;i<6;i++) 16 | { 17 | QColor color; 18 | this->m_splineSeries[i]=new QSplineSeries; 19 | switch(i) 20 | { 21 | case 0: 22 | color=QColor(220,20,60); 23 | break; 24 | case 1: 25 | color=QColor(255,20,147); 26 | break; 27 | case 2: 28 | color=QColor(0,0,255); 29 | break; 30 | case 3: 31 | color=QColor(0,255,255); 32 | break; 33 | case 4: 34 | color=QColor(249,249,0); 35 | break; 36 | case 5: 37 | color=QColor(255,165,0); 38 | break; 39 | } 40 | this->m_splineSeries[i]->setPen(QPen(color,1)); 41 | this->m_chart->addSeries(this->m_splineSeries[i]); 42 | } 43 | this->m_chart->legend()->hide(); 44 | this->m_chart->setTitle(title); 45 | this->m_chart->createDefaultAxes(); 46 | this->m_chart->axisX()->setRange(0,100); 47 | this->m_chart->axisY()->setRange(0,this->m_maxValue); 48 | this->m_chart->setBackgroundBrush(QBrush(QColor(67,80,86))); 49 | this->m_chart->setPlotAreaBackgroundBrush(QBrush(QColor(255,0,0))); 50 | this->m_chart->setTitleBrush(QBrush(QColor(255,255,255))); 51 | this->m_chart->axisX()->setLabelsColor(QColor(255,255,255)); 52 | this->m_chart->axisY()->setLabelsColor(QColor(255,255,255)); 53 | //fill the initial data for 8-GLasers. 54 | for(qint32 j=0;j<6;j++) 55 | { 56 | for(qint32 i=0;im_maxSize;i++) 57 | { 58 | 59 | this->m_splineSeries[j]->append(i*10,5); 60 | } 61 | } 62 | 63 | this->m_chartView=new QChartView(this->m_chart); 64 | this->m_chartView->setRenderHint(QPainter::Antialiasing); 65 | this->m_vLayout=new QVBoxLayout; 66 | this->m_vLayout->setContentsMargins(0,0,0,0); 67 | this->m_vLayout->addWidget(this->m_chartView); 68 | this->setLayout(this->m_vLayout); 69 | 70 | qsrand(QDateTime::currentDateTime().toTime_t()); 71 | this->m_timer=new QTimer; 72 | connect(this->m_timer,SIGNAL(timeout()),this,SLOT(ZSloGenerateRandomValue())); 73 | this->m_timer->start(1000); 74 | } 75 | ZCurveUI::~ZCurveUI() 76 | { 77 | this->m_timer->stop(); 78 | delete this->m_timer; 79 | 80 | 81 | for(qint32 i=0;i<6;i++) 82 | { 83 | delete this->m_splineSeries[i]; 84 | } 85 | 86 | delete this->m_chart; 87 | delete this->m_chartView; 88 | } 89 | void ZCurveUI::ZSloDataReceived(qint32 which,qint32 val) 90 | { 91 | this->m_valList[which].append(val); 92 | while(this->m_valList[which].size()>this->m_maxSize) 93 | { 94 | this->m_valList[which].removeFirst(); 95 | } 96 | int delta=this->m_maxSize-this->m_valList[which].size(); 97 | for(qint32 i=0;im_valList[which].size();++i) 98 | { 99 | qint32 newX=this->m_splineSeries[which]->at(delta+i).x(); 100 | qint32 newY=this->m_valList[which].at(i); 101 | this->m_splineSeries[which]->replace(delta+i,newX,newY); 102 | } 103 | } 104 | void ZCurveUI::ZSloGenerateRandomValue() 105 | { 106 | qint32 which=qrand()%6; 107 | qint32 newData=qrand()%(this->m_maxValue+1); 108 | //qDebug()<<"which="<ZSloDataReceived(which,newData); 110 | } 111 | 112 | -------------------------------------------------------------------------------- /ui/zcurveui.h: -------------------------------------------------------------------------------- 1 | #ifndef ZCURVEUI_H 2 | #define ZCURVEUI_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | using namespace QtCharts; 13 | class ZCurveUI : public QFrame 14 | { 15 | Q_OBJECT 16 | public: 17 | ZCurveUI(QString title); 18 | ~ZCurveUI(); 19 | public slots: 20 | void ZSloDataReceived(qint32 which,qint32 val); 21 | private slots: 22 | void ZSloGenerateRandomValue(); 23 | private: 24 | qint32 m_maxSize; 25 | qint32 m_maxValue; 26 | QList m_valList[6]; 27 | 28 | QChart *m_chart; 29 | QChartView *m_chartView; 30 | QSplineSeries *m_splineSeries[6]; 31 | QVBoxLayout *m_vLayout; 32 | 33 | QTimer *m_timer; 34 | }; 35 | 36 | #endif // ZCURVEUI_H 37 | -------------------------------------------------------------------------------- /ui/zdatetimesetdia.h: -------------------------------------------------------------------------------- 1 | #ifndef ZDATETIMESETDIA_H 2 | #define ZDATETIMESETDIA_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | class ZDateTimeSetDia : public QDialog 15 | { 16 | Q_OBJECT 17 | public: 18 | ZDateTimeSetDia(QString title,qint32 year,qint32 month,qint32 day,qint32 hour,qint32 minute,qint32 second); 19 | ~ZDateTimeSetDia(); 20 | 21 | QDateTime ZGetDateTime(); 22 | private slots: 23 | void ZSlotButtonClicked(); 24 | 25 | private: 26 | void ZFunUpdateWidgets(); 27 | private: 28 | QLabel *m_llTitle; 29 | QLineEdit *m_le[6]; 30 | QToolButton *m_tb[14]; 31 | QGridLayout *m_gLayout; 32 | QFrame *m_frm; 33 | QVBoxLayout *m_vLayout; 34 | 35 | qint32 m_year; 36 | qint32 m_month; 37 | qint32 m_day; 38 | qint32 m_hour; 39 | qint32 m_minute; 40 | qint32 m_second; 41 | }; 42 | 43 | #endif // ZDATETIMESETDIA_H 44 | -------------------------------------------------------------------------------- /ui/zdbgtestui.h: -------------------------------------------------------------------------------- 1 | #ifndef ZDBGTESTUI_H 2 | #define ZDBGTESTUI_H 3 | 4 | #include "base/zbaseui.h" 5 | #include "ui/zcheckbox.h" 6 | #include 7 | #include "ui/zspinbox.h" 8 | class ZDbgTestUI : public ZBaseUI 9 | { 10 | Q_OBJECT 11 | public: 12 | ZDbgTestUI(); 13 | ~ZDbgTestUI(); 14 | 15 | void ZDoInitial(); 16 | void ZUnInitial(); 17 | signals: 18 | void ZSigMsg(QString msg); 19 | signals: 20 | void ZSigDumpDbgMsg(QString msg); 21 | private slots: 22 | void ZSloCheckBoxStateChanged(qint32 state); 23 | void ZSloHBIntervalValChanged(qint32 val); 24 | void ZSloTimeoutValChanged(qint32 val); 25 | void ZSloQueryIntervalValChanged(qint32 val); 26 | void ZSloOfflineTimeoutValChanged(qint32 val); 27 | private: 28 | ZCheckBox *m_cbEnSelfCheck; 29 | ZCheckBox *m_cbEnHeartBeat; 30 | ZCheckBox *m_cbPopupErrMsg; 31 | ZCheckBox *m_cbEnCRC16; 32 | ZCheckBox *m_cbEnEncrypt; 33 | ZCheckBox *m_cbOpTips; 34 | ZCheckBox *m_cbQueryStatus; 35 | ZCheckBox *m_cbBeep; 36 | ZSpinBox *m_sbHBInterval; 37 | ZSpinBox *m_sbTimeoutVal; 38 | ZSpinBox *m_sbQueryInterval; 39 | ZSpinBox *m_sbOfflineTimeout; 40 | ZSpinBox *m_sbGLaserCount;//dynamic GLaser Count. 41 | QGridLayout *m_gLayout; 42 | QVBoxLayout *m_vLayoutMain; 43 | }; 44 | #endif // ZDBGTESTUI_H 45 | -------------------------------------------------------------------------------- /ui/zdigkbd.cpp: -------------------------------------------------------------------------------- 1 | #include "zdigkbd.h" 2 | #include 3 | #include 4 | #include "gbl/hmi_const.h" 5 | ZDigKbd::ZDigKbd(QString title,bool passwordMode) 6 | { 7 | this->setWindowFlags(Qt::FramelessWindowHint); 8 | this->m_llTitle=new QLabel; 9 | this->m_llTitle->setAlignment(Qt::AlignCenter); 10 | this->m_llTitle->setText(title); 11 | this->m_llTitle->setObjectName("ZDigKbTitle"); 12 | this->m_le=new QLineEdit; 13 | this->m_le->setObjectName("ZDigKbLineEdit"); 14 | if(true==passwordMode) 15 | { 16 | this->m_le->setEchoMode(QLineEdit::Password); 17 | } 18 | for(qint32 i=0;i<14;i++) 19 | { 20 | this->m_tb[i]=new QToolButton; 21 | this->m_tb[i]->setObjectName("ZDigKbButton"); 22 | connect(this->m_tb[i],SIGNAL(clicked(bool)),this,SLOT(ZSloButtonClicked())); 23 | switch(i) 24 | { 25 | case 0: 26 | case 1: 27 | case 2: 28 | case 3: 29 | case 4: 30 | case 5: 31 | case 6: 32 | case 7: 33 | case 8: 34 | case 9: 35 | this->m_tb[i]->setText(QString("%1").arg(i)); 36 | break; 37 | case 10: 38 | this->m_tb[i]->setText("<-"); 39 | break; 40 | case 11: 41 | this->m_tb[i]->setText("C"); 42 | break; 43 | case 12: 44 | this->m_tb[i]->setText("Okay"); 45 | break; 46 | case 13: 47 | this->m_tb[i]->setText("Cancel"); 48 | break; 49 | default: 50 | break; 51 | } 52 | } 53 | this->m_gLayout=new QGridLayout; 54 | this->m_gLayout->addWidget(this->m_llTitle,0,0,1,3); 55 | this->m_gLayout->addWidget(this->m_le,1,0,1,3); 56 | 57 | this->m_gLayout->addWidget(this->m_tb[1],2,0,1,1); 58 | this->m_gLayout->addWidget(this->m_tb[2],2,1,1,1); 59 | this->m_gLayout->addWidget(this->m_tb[3],2,2,1,1); 60 | 61 | this->m_gLayout->addWidget(this->m_tb[4],3,0,1,1); 62 | this->m_gLayout->addWidget(this->m_tb[5],3,1,1,1); 63 | this->m_gLayout->addWidget(this->m_tb[6],3,2,1,1); 64 | 65 | this->m_gLayout->addWidget(this->m_tb[7],4,0,1,1); 66 | this->m_gLayout->addWidget(this->m_tb[8],4,1,1,1); 67 | this->m_gLayout->addWidget(this->m_tb[9],4,2,1,1); 68 | 69 | this->m_gLayout->addWidget(this->m_tb[0],5,0,1,1); 70 | this->m_gLayout->addWidget(this->m_tb[10],5,1,1,1); 71 | this->m_gLayout->addWidget(this->m_tb[11],5,2,1,1); 72 | 73 | this->m_gLayout->addWidget(this->m_tb[12],6,1,1,1); 74 | this->m_gLayout->addWidget(this->m_tb[13],6,2,1,1); 75 | 76 | this->m_gLayout->setContentsMargins(10,8,10,8); 77 | this->m_frm=new QFrame; 78 | this->m_frm->setObjectName("ZDigKbd"); 79 | this->m_frm->setLayout(this->m_gLayout); 80 | this->m_vLayout=new QVBoxLayout; 81 | this->m_vLayout->setContentsMargins(0,0,0,0); 82 | this->m_vLayout->addWidget(this->m_frm); 83 | this->setLayout(this->m_vLayout); 84 | } 85 | ZDigKbd::~ZDigKbd() 86 | { 87 | delete this->m_llTitle; 88 | delete this->m_le; 89 | for(qint32 i=0;i<14;i++) 90 | { 91 | delete this->m_tb[i]; 92 | } 93 | delete this->m_gLayout; 94 | delete this->m_frm; 95 | delete this->m_vLayout; 96 | } 97 | QString ZDigKbd::ZGetDigital() 98 | { 99 | return this->m_le->text().trimmed(); 100 | } 101 | void ZDigKbd::ZSetDigital(QString digital) 102 | { 103 | this->m_le->setText(digital); 104 | } 105 | void ZDigKbd::ZSloButtonClicked() 106 | { 107 | QToolButton *src=qobject_cast(this->sender()); 108 | if(src==NULL) 109 | { 110 | return; 111 | } 112 | if(src->text()=="<-") 113 | { 114 | QString oldData=this->m_le->text().trimmed(); 115 | this->m_le->setText(oldData.left(oldData.length()-1)); 116 | }else if(src->text()=="C") 117 | { 118 | this->m_le->setText(""); 119 | }else if(src->text()=="Okay"){ 120 | this->accept(); 121 | }else if(src->text()=="Cancel"){ 122 | this->rect(); 123 | }else{ 124 | this->m_le->setText(this->m_le->text()+src->text()); 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /ui/zdigkbd.h: -------------------------------------------------------------------------------- 1 | #ifndef ZDIGKBD_H 2 | #define ZDIGKBD_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | class ZDigKbd : public QDialog 12 | { 13 | Q_OBJECT 14 | public: 15 | ZDigKbd(QString title,bool passwordMode=false); 16 | ~ZDigKbd(); 17 | QString ZGetDigital(); 18 | void ZSetDigital(QString digital); 19 | private slots: 20 | void ZSloButtonClicked(); 21 | private: 22 | QLabel *m_llTitle; 23 | QLineEdit *m_le; 24 | QToolButton *m_tb[14]; 25 | QGridLayout *m_gLayout; 26 | QFrame *m_frm; 27 | QVBoxLayout *m_vLayout; 28 | }; 29 | 30 | #endif // ZDIGKBD_H 31 | -------------------------------------------------------------------------------- /ui/zframe.cpp: -------------------------------------------------------------------------------- 1 | #include "zframe.h" 2 | #include 3 | ZFrame::ZFrame(QString title) 4 | { 5 | this->m_title=title; 6 | this->setFrameStyle(QFrame::Box|QFrame::Sunken); 7 | } 8 | void ZFrame::paintEvent(QPaintEvent *e) 9 | { 10 | 11 | QPainter painter(this); 12 | 13 | painter.drawText(5,20,this->m_title); 14 | 15 | QFrame::paintEvent(e); 16 | } 17 | -------------------------------------------------------------------------------- /ui/zframe.h: -------------------------------------------------------------------------------- 1 | #ifndef ZFRAME_H 2 | #define ZFRAME_H 3 | 4 | #include 5 | #include 6 | class ZFrame:public QFrame 7 | { 8 | public: 9 | ZFrame(QString title); 10 | 11 | protected: 12 | void paintEvent(QPaintEvent *e); 13 | 14 | private: 15 | QString m_title; 16 | }; 17 | 18 | #endif // ZFRAME_H 19 | -------------------------------------------------------------------------------- /ui/zfullkbd.h: -------------------------------------------------------------------------------- 1 | #ifndef ZFULLKBD_H 2 | #define ZFULLKBD_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | class ZFullKbd : public QDialog 12 | { 13 | Q_OBJECT 14 | public: 15 | ZFullKbd(QString title); 16 | ~ZFullKbd(); 17 | QString ZGetText(); 18 | void ZSetText(QString text); 19 | private slots: 20 | void ZSloA2ZButtonClicked(); 21 | void ZSloChSelectButtonClicked(); 22 | void ZSloFunButtonClicked(); 23 | private: 24 | qint32 ZGetKeyCode(QString keyChar); 25 | private: 26 | QLabel *m_llTitle; 27 | QToolButton *m_tbOkay; 28 | QToolButton *m_tbCancel; 29 | QLineEdit *m_le; 30 | QLabel *m_llInput; 31 | QToolButton *m_tbTurnPage[2]; 32 | QToolButton *m_tbChSelect[6]; 33 | QToolButton *m_tbA2Z[26]; 34 | QToolButton *m_tbFun[9]; 35 | QHBoxLayout *m_hLayout[7]; 36 | QVBoxLayout *m_vLayoutFrm; 37 | QFrame *m_frm; 38 | QVBoxLayout *m_vLayout; 39 | 40 | bool m_bChMode; 41 | QString m_input; 42 | }; 43 | #endif // ZFULLKBD_H 44 | -------------------------------------------------------------------------------- /ui/zlaserrunhoursui.cpp: -------------------------------------------------------------------------------- 1 | #include "zlaserrunhoursui.h" 2 | 3 | ZLaserRunHoursUI::ZLaserRunHoursUI(QString title) 4 | { 5 | this->setObjectName("ZLaserRunHoursUI"); 6 | this->setMinimumWidth(10); 7 | this->m_llTitle=new QLabel; 8 | this->m_llTitle->setAlignment(Qt::AlignCenter); 9 | this->m_llTitle->setObjectName("ZLaserRunHoursUILabel"); 10 | this->m_title=title; 11 | for(qint32 i=0;i<10;i++) 12 | { 13 | this->m_ll[i]=new QLabel; 14 | switch(i) 15 | { 16 | case 0: 17 | this->m_ll[i]->setStyleSheet("QLabel{background:#FF0000;color:white;}"); 18 | this->m_ll[i]->setText("30000"); 19 | this->m_ll[i]->setAlignment(Qt::AlignHCenter|Qt::AlignTop); 20 | break; 21 | case 1: 22 | this->m_ll[i]->setStyleSheet("QLabel{background:#FF0080;color:white;}"); 23 | this->m_ll[i]->setText("27000"); 24 | this->m_ll[i]->setAlignment(Qt::AlignHCenter|Qt::AlignTop); 25 | break; 26 | case 2: 27 | this->m_ll[i]->setStyleSheet("QLabel{background:#FF5809;color:white;}"); 28 | this->m_ll[i]->setText("24000"); 29 | this->m_ll[i]->setAlignment(Qt::AlignHCenter|Qt::AlignTop); 30 | break; 31 | case 3: 32 | this->m_ll[i]->setStyleSheet("QLabel{background:#FFD306;color:white;}"); 33 | this->m_ll[i]->setText("21000"); 34 | this->m_ll[i]->setAlignment(Qt::AlignHCenter|Qt::AlignTop); 35 | break; 36 | case 4: 37 | this->m_ll[i]->setStyleSheet("QLabel{background:#9AFF02;color:white;}"); 38 | this->m_ll[i]->setText("18000"); 39 | this->m_ll[i]->setAlignment(Qt::AlignHCenter|Qt::AlignTop); 40 | break; 41 | case 5: 42 | this->m_ll[i]->setStyleSheet("QLabel{background:#00DB00;color:white;}"); 43 | this->m_ll[i]->setText("15000"); 44 | this->m_ll[i]->setAlignment(Qt::AlignHCenter|Qt::AlignTop); 45 | break; 46 | case 6: 47 | this->m_ll[i]->setStyleSheet("QLabel{background:#02DF82;color:white;}"); 48 | this->m_ll[i]->setText("12000"); 49 | this->m_ll[i]->setAlignment(Qt::AlignHCenter|Qt::AlignTop); 50 | break; 51 | case 7: 52 | this->m_ll[i]->setStyleSheet("QLabel{background:#00CACA;color:white;}"); 53 | this->m_ll[i]->setText("9000"); 54 | this->m_ll[i]->setAlignment(Qt::AlignHCenter|Qt::AlignTop); 55 | break; 56 | case 8: 57 | this->m_ll[i]->setStyleSheet("QLabel{background:#0072E3;color:white;}"); 58 | this->m_ll[i]->setText("6000"); 59 | this->m_ll[i]->setAlignment(Qt::AlignHCenter|Qt::AlignTop); 60 | break; 61 | case 9: 62 | this->m_ll[i]->setStyleSheet("QLabel{background:#2828FF;color:white;}"); 63 | this->m_ll[i]->setText("3000"); 64 | this->m_ll[i]->setAlignment(Qt::AlignHCenter|Qt::AlignTop); 65 | break; 66 | default: 67 | break; 68 | } 69 | } 70 | this->m_vLayout=new QVBoxLayout; 71 | this->m_vLayout->setSpacing(0); 72 | this->m_vLayout->setContentsMargins(10,10,10,10); 73 | this->m_vLayout->addWidget(this->m_llTitle); 74 | for(qint32 i=0,x=1;i<10;i++,x++) 75 | { 76 | this->m_vLayout->addWidget(this->m_ll[i]); 77 | } 78 | //int left, int top, int right, int bottom 79 | this->setLayout(this->m_vLayout); 80 | this->ZSetRunHours(0,0); 81 | } 82 | ZLaserRunHoursUI::~ZLaserRunHoursUI() 83 | { 84 | delete this->m_llTitle; 85 | for(qint32 i=0;i<10;i++) 86 | { 87 | delete this->m_ll[i]; 88 | } 89 | delete this->m_vLayout; 90 | } 91 | void ZLaserRunHoursUI::ZSetRunHours(qint32 hours,qint32 minutes) 92 | { 93 | this->m_llTitle->setText(this->m_title+QString("\n%1h %2m").arg(hours).arg(minutes)); 94 | } 95 | -------------------------------------------------------------------------------- /ui/zlaserrunhoursui.h: -------------------------------------------------------------------------------- 1 | #ifndef ZLASERRUNHOURSUI_H 2 | #define ZLASERRUNHOURSUI_H 3 | 4 | #include 5 | #include 6 | #include 7 | class ZLaserRunHoursUI : public QFrame 8 | { 9 | public: 10 | ZLaserRunHoursUI(QString title); 11 | ~ZLaserRunHoursUI(); 12 | 13 | void ZSetRunHours(qint32 hours,qint32 minutes); 14 | private: 15 | QLabel *m_llTitle; 16 | QLabel *m_ll[10]; 17 | QVBoxLayout *m_vLayout; 18 | QString m_title; 19 | }; 20 | 21 | #endif // ZLASERRUNHOURSUI_H 22 | -------------------------------------------------------------------------------- /ui/zlaserui.cpp: -------------------------------------------------------------------------------- 1 | #include "zlaserui.h" 2 | #include "gbl/hmi_const.h" 3 | #include 4 | ZLaserUI::ZLaserUI() 5 | { 6 | 7 | } 8 | ZLaserUI::~ZLaserUI() 9 | { 10 | 11 | } 12 | 13 | void ZLaserUI::ZDoInitial() 14 | { 15 | this->m_tabWidget=new QTabWidget; 16 | this->m_tabWidget->setIconSize(QSize(16,16)); 17 | connect(this->m_tabWidget,SIGNAL(currentChanged(int)),this,SLOT(ZSloTabChanged(qint32))); 18 | 19 | this->m_mainCtlUI=new ZMainCtlUI; 20 | this->m_mainCtlUI->ZDoInitial(); 21 | this->m_tabWidget->addTab(this->m_mainCtlUI,QIcon(":/laser/images/laser/mainCtl.png"),tr("全部")); 22 | connect(this->m_mainCtlUI,SIGNAL(ZSigPopupMsg(QString)),this,SIGNAL(ZSigPopupMsg(QString))); 23 | connect(this->m_mainCtlUI,SIGNAL(ZSigRequestCmd(QString,QString)),this,SIGNAL(ZSigRequestCmd(QString,QString))); 24 | 25 | for(qint32 i=0;i<8;i++) 26 | { 27 | this->m_mdlCtlUI[i]=new ZMdlCtlUI(i+1); 28 | this->m_mdlCtlUI[i]->ZDoInitial(); 29 | this->m_tabWidget->addTab(this->m_mdlCtlUI[i],QIcon(":/laser/images/laser/mdlCtl.png"),tr("%1号").arg(i+1)); 30 | connect(this->m_mdlCtlUI[i],SIGNAL(ZSigRequestCmd(QString,QString)),this,SIGNAL(ZSigRequestCmd(QString,QString))); 31 | connect(this->m_mdlCtlUI[i],SIGNAL(ZSigPopupMsg(QString)),this,SIGNAL(ZSigPopupMsg(QString))); 32 | } 33 | 34 | this->m_vLayout=new QVBoxLayout; 35 | this->m_vLayout->addWidget(this->m_tabWidget); 36 | this->setLayout(this->m_vLayout); 37 | 38 | this->m_bFaultIconFlag=false; 39 | this->m_timer=new QTimer; 40 | connect(this->m_timer,SIGNAL(timeout()),this,SLOT(ZSlotTimeout())); 41 | this->m_timer->start(1000); 42 | } 43 | void ZLaserUI::ZUnInitial() 44 | { 45 | this->m_timer->stop(); 46 | delete this->m_timer; 47 | for(qint32 i=0;i<8;i++) 48 | { 49 | this->m_mdlCtlUI[i]->ZUnInitial(); 50 | delete this->m_mdlCtlUI[i]; 51 | } 52 | this->m_mainCtlUI->ZUnInitial(); 53 | delete this->m_mainCtlUI; 54 | delete this->m_tabWidget; 55 | delete this->m_vLayout; 56 | } 57 | void ZLaserUI::ZSloTabChanged(qint32 index) 58 | { 59 | g_GblHelp.beep(); 60 | } 61 | void ZLaserUI::ZSlotTimeout() 62 | { 63 | if(g_GblHelp.m_laserFault&(0x1<<0))//GLaser-1 fault. 64 | { 65 | if(this->m_bFaultIconFlag) 66 | { 67 | this->m_tabWidget->setTabIcon(1,QIcon(":/laser/images/laser/mdlCtl.png")); 68 | }else{ 69 | this->m_tabWidget->setTabIcon(1,QIcon(":/topbar/images/led/led_red.png")); 70 | } 71 | }else{ 72 | this->m_tabWidget->setTabIcon(1,QIcon(":/laser/images/laser/mdlCtl.png")); 73 | } 74 | 75 | if(g_GblHelp.m_laserFault&(0x1<<1))//GLaser-2 fault. 76 | { 77 | if(this->m_bFaultIconFlag) 78 | { 79 | this->m_tabWidget->setTabIcon(2,QIcon(":/laser/images/laser/mdlCtl.png")); 80 | }else{ 81 | this->m_tabWidget->setTabIcon(2,QIcon(":/topbar/images/led/led_red.png")); 82 | } 83 | }else{ 84 | this->m_tabWidget->setTabIcon(2,QIcon(":/laser/images/laser/mdlCtl.png")); 85 | } 86 | 87 | if(g_GblHelp.m_laserFault&(0x1<<2))//GLaser-3 fault. 88 | { 89 | if(this->m_bFaultIconFlag) 90 | { 91 | this->m_tabWidget->setTabIcon(3,QIcon(":/laser/images/laser/mdlCtl.png")); 92 | }else{ 93 | this->m_tabWidget->setTabIcon(3,QIcon(":/topbar/images/led/led_red.png")); 94 | } 95 | }else{ 96 | this->m_tabWidget->setTabIcon(3,QIcon(":/laser/images/laser/mdlCtl.png")); 97 | } 98 | 99 | if(g_GblHelp.m_laserFault&(0x1<<3))//GLaser-4 fault. 100 | { 101 | if(this->m_bFaultIconFlag) 102 | { 103 | this->m_tabWidget->setTabIcon(4,QIcon(":/laser/images/laser/mdlCtl.png")); 104 | }else{ 105 | this->m_tabWidget->setTabIcon(4,QIcon(":/topbar/images/led/led_red.png")); 106 | } 107 | }else{ 108 | this->m_tabWidget->setTabIcon(4,QIcon(":/laser/images/laser/mdlCtl.png")); 109 | } 110 | 111 | if(g_GblHelp.m_laserFault&(0x1<<4))//GLaser-5 fault. 112 | { 113 | if(this->m_bFaultIconFlag) 114 | { 115 | this->m_tabWidget->setTabIcon(5,QIcon(":/laser/images/laser/mdlCtl.png")); 116 | }else{ 117 | this->m_tabWidget->setTabIcon(5,QIcon(":/topbar/images/led/led_red.png")); 118 | } 119 | }else{ 120 | this->m_tabWidget->setTabIcon(5,QIcon(":/laser/images/laser/mdlCtl.png")); 121 | } 122 | 123 | if(g_GblHelp.m_laserFault&(0x1<<5))//GLaser-6 fault. 124 | { 125 | if(this->m_bFaultIconFlag) 126 | { 127 | this->m_tabWidget->setTabIcon(6,QIcon(":/laser/images/laser/mdlCtl.png")); 128 | }else{ 129 | this->m_tabWidget->setTabIcon(6,QIcon(":/topbar/images/led/led_red.png")); 130 | } 131 | }else{ 132 | this->m_tabWidget->setTabIcon(6,QIcon(":/laser/images/laser/mdlCtl.png")); 133 | } 134 | 135 | if(g_GblHelp.m_laserFault&(0x1<<6))//GLaser-7 fault. 136 | { 137 | if(this->m_bFaultIconFlag) 138 | { 139 | this->m_tabWidget->setTabIcon(7,QIcon(":/laser/images/laser/mdlCtl.png")); 140 | }else{ 141 | this->m_tabWidget->setTabIcon(7,QIcon(":/topbar/images/led/led_red.png")); 142 | } 143 | }else{ 144 | this->m_tabWidget->setTabIcon(7,QIcon(":/laser/images/laser/mdlCtl.png")); 145 | } 146 | 147 | if(g_GblHelp.m_laserFault&(0x1<<7))//GLaser-8 fault. 148 | { 149 | if(this->m_bFaultIconFlag) 150 | { 151 | this->m_tabWidget->setTabIcon(8,QIcon(":/laser/images/laser/mdlCtl.png")); 152 | }else{ 153 | this->m_tabWidget->setTabIcon(8,QIcon(":/topbar/images/led/led_red.png")); 154 | } 155 | }else{ 156 | this->m_tabWidget->setTabIcon(8,QIcon(":/laser/images/laser/mdlCtl.png")); 157 | } 158 | //invert. 159 | this->m_bFaultIconFlag=!this->m_bFaultIconFlag; 160 | } 161 | -------------------------------------------------------------------------------- /ui/zlaserui.h: -------------------------------------------------------------------------------- 1 | #ifndef ZLASERUI_H 2 | #define ZLASERUI_H 3 | 4 | #include "base/zbaseui.h" 5 | #include 6 | #include 7 | #include "ui/zmainctlui.h" 8 | #include "ui/zmdlctlui.h" 9 | #include 10 | class ZLaserUI:public ZBaseUI 11 | { 12 | Q_OBJECT 13 | public: 14 | ZLaserUI(); 15 | ~ZLaserUI(); 16 | 17 | void ZDoInitial(); 18 | void ZUnInitial(); 19 | signals: 20 | void ZSigRequestCmd(QString cmd,QString arguments); 21 | void ZSigPopupMsg(QString msg); 22 | signals: 23 | void ZSigDumpDbgMsg(QString msg); 24 | private slots: 25 | void ZSlotTimeout(); 26 | void ZSloTabChanged(qint32 index); 27 | private: 28 | QTabWidget *m_tabWidget; 29 | QVBoxLayout *m_vLayout; 30 | public: 31 | ZMainCtlUI *m_mainCtlUI; 32 | ZMdlCtlUI *m_mdlCtlUI[8]; 33 | 34 | QTimer *m_timer; 35 | bool m_bFaultIconFlag; 36 | }; 37 | 38 | #endif // ZLASERUI_H 39 | -------------------------------------------------------------------------------- /ui/zlinelabel.cpp: -------------------------------------------------------------------------------- 1 | #include "zlinelabel.h" 2 | #include 3 | ZLineLabel::ZLineLabel() 4 | { 5 | 6 | } 7 | void ZLineLabel::paintEvent(QPaintEvent *e) 8 | { 9 | QPainter painter(this); 10 | QPen pen; 11 | pen.setColor(Qt::black); 12 | pen.setWidth(10); 13 | painter.setPen(pen); 14 | painter.drawLine(QPoint(0,0),QPoint(this->width(),this->height())); 15 | } 16 | -------------------------------------------------------------------------------- /ui/zlinelabel.h: -------------------------------------------------------------------------------- 1 | #ifndef ZLINELABEL_H 2 | #define ZLINELABEL_H 3 | 4 | #include 5 | #include 6 | class ZLineLabel:public QLabel 7 | { 8 | Q_OBJECT 9 | public: 10 | ZLineLabel(); 11 | 12 | protected: 13 | void paintEvent(QPaintEvent *e); 14 | }; 15 | 16 | #endif // ZLINELABEL_H 17 | -------------------------------------------------------------------------------- /ui/zloadui.cpp: -------------------------------------------------------------------------------- 1 | #include "zloadui.h" 2 | #include 3 | ZLoadUI::ZLoadUI() 4 | { 5 | this->setObjectName("ZLoadUI"); 6 | this->m_llMsg=new QLabel(tr("系统启动中...")); 7 | this->m_llMsg->setObjectName("ZLoadUIMsgLabel"); 8 | this->m_llMsg->setAlignment(Qt::AlignCenter); 9 | this->m_progressBar=new QProgressBar; 10 | this->m_progressBar->setObjectName("ZLoadUIProgressBar"); 11 | this->m_progressBar->setTextVisible(false); 12 | this->m_progressBar->setRange(0,100); 13 | this->m_progressBar->setValue(0); 14 | this->m_vLayout=new QVBoxLayout; 15 | this->m_vLayout->addStretch(1); 16 | this->m_vLayout->addWidget(this->m_llMsg); 17 | this->m_vLayout->addWidget(this->m_progressBar); 18 | this->m_vLayout->addStretch(1); 19 | this->setLayout(this->m_vLayout); 20 | this->setStyleSheet("QFrame{background-image: url(:/load/images/load/background.png);}" 21 | "QLabel{color:white;font-size:30px;background: transparent;}" 22 | "QProgressBar{min-height:30px;border: 1px;border-radius: 5px;color: black;background: rgb(67,80,86);}" 23 | "QProgressBar::chunk {background: rgb(85,161,47);}"); 24 | } 25 | ZLoadUI::~ZLoadUI() 26 | { 27 | delete this->m_llMsg; 28 | delete this->m_progressBar; 29 | delete this->m_vLayout; 30 | } 31 | void ZLoadUI::ZSetMsg(QString msg) 32 | { 33 | this->m_llMsg->setText(msg); 34 | } 35 | void ZLoadUI::ZSetProgress(qint32 val) 36 | { 37 | this->m_progressBar->setValue(val); 38 | } 39 | void ZLoadUI::ZSloShowMsg(QString msg) 40 | { 41 | this->m_llMsg->setText(msg); 42 | qApp->processEvents(); 43 | } 44 | -------------------------------------------------------------------------------- /ui/zloadui.h: -------------------------------------------------------------------------------- 1 | #ifndef ZLOADUI_H 2 | #define ZLOADUI_H 3 | 4 | #include "base/zbaseui.h" 5 | #include 6 | #include 7 | #include 8 | class ZLoadUI : public ZBaseUI 9 | { 10 | Q_OBJECT 11 | public: 12 | ZLoadUI(); 13 | ~ZLoadUI(); 14 | 15 | void ZSetMsg(QString msg); 16 | void ZSetProgress(qint32 val); 17 | public slots: 18 | void ZSloShowMsg(QString msg); 19 | private: 20 | QLabel *m_llMsg; 21 | QProgressBar *m_progressBar; 22 | QVBoxLayout *m_vLayout; 23 | }; 24 | 25 | #endif // ZLOADUI_H 26 | -------------------------------------------------------------------------------- /ui/zloginui.cpp: -------------------------------------------------------------------------------- 1 | #include "zloginui.h" 2 | #include 3 | #include "gbl/hmi_const.h" 4 | #include 5 | ZLoginUI::ZLoginUI() 6 | { 7 | this->setObjectName("ZLoginUI"); 8 | } 9 | ZLoginUI::~ZLoginUI() 10 | { 11 | 12 | } 13 | void ZLoginUI::ZDoInitial() 14 | { 15 | this->m_llImg=new QLabel; 16 | this->m_llImg->setObjectName("ZLoginUITitle"); 17 | this->m_llImg->setText(tr("放映机激光光源控制系统 %1").arg(UI_VERSION)); 18 | this->m_llImg->setAlignment(Qt::AlignCenter); 19 | 20 | this->m_llPassTips=new QLabel(tr("管理员密码")); 21 | this->m_llPassTips->setObjectName("ZLoginUIPassTips"); 22 | this->m_llPassTips->setAlignment(Qt::AlignCenter); 23 | this->m_lePass=new QLineEdit; 24 | this->m_lePass->setObjectName("ZLoginUILineEdit"); 25 | this->m_lePass->setAlignment(Qt::AlignCenter); 26 | this->m_lePass->setEchoMode(QLineEdit::Password); 27 | this->m_lePass->setMaxLength(8); 28 | for(qint32 i=0;i<12;i++) 29 | { 30 | this->m_tbInput[i]=new QToolButton; 31 | this->m_tbInput[i]->setObjectName("ZLoginUIBtn"); 32 | switch(i) 33 | { 34 | case 9: 35 | this->m_tbInput[i]->setText(QString("0")); 36 | break; 37 | case 10: 38 | this->m_tbInput[i]->setText(QString("<-")); 39 | break; 40 | case 11: 41 | this->m_tbInput[i]->setText(QString("C")); 42 | break; 43 | default: 44 | this->m_tbInput[i]->setText(QString("%1").arg(i+1)); 45 | break; 46 | } 47 | connect(this->m_tbInput[i],SIGNAL(clicked(bool)),this,SLOT(ZSloCheckUserInput())); 48 | } 49 | this->m_gLayoutTb=new QGridLayout; 50 | this->m_gLayoutTb->addWidget(this->m_tbInput[0],0,0,1,1); 51 | this->m_gLayoutTb->addWidget(this->m_tbInput[1],0,1,1,1); 52 | this->m_gLayoutTb->addWidget(this->m_tbInput[2],0,2,1,1); 53 | 54 | this->m_gLayoutTb->addWidget(this->m_tbInput[3],1,0,1,1); 55 | this->m_gLayoutTb->addWidget(this->m_tbInput[4],1,1,1,1); 56 | this->m_gLayoutTb->addWidget(this->m_tbInput[5],1,2,1,1); 57 | 58 | this->m_gLayoutTb->addWidget(this->m_tbInput[6],2,0,1,1); 59 | this->m_gLayoutTb->addWidget(this->m_tbInput[7],2,1,1,1); 60 | this->m_gLayoutTb->addWidget(this->m_tbInput[8],2,2,1,1); 61 | 62 | this->m_gLayoutTb->addWidget(this->m_tbInput[9],3,0,1,1); 63 | this->m_gLayoutTb->addWidget(this->m_tbInput[10],3,1,1,1); 64 | this->m_gLayoutTb->addWidget(this->m_tbInput[11],3,2,1,1); 65 | this->m_gLayoutTb->setSpacing(20); 66 | 67 | this->m_vLayout=new QVBoxLayout; 68 | this->m_vLayout->addStretch(1); 69 | this->m_vLayout->addWidget(this->m_llImg); 70 | this->m_vLayout->addWidget(this->m_llPassTips); 71 | this->m_vLayout->addWidget(this->m_lePass); 72 | this->m_vLayout->addLayout(this->m_gLayoutTb); 73 | this->m_vLayout->setSpacing(10); 74 | this->m_hLayout=new QHBoxLayout; 75 | this->m_hLayout->addStretch(1); 76 | this->m_hLayout->addLayout(this->m_vLayout); 77 | this->m_hLayout->addStretch(1); 78 | this->m_hLayout->setContentsMargins(0,0,0,50); 79 | this->setLayout(this->m_hLayout); 80 | 81 | connect(this->m_lePass,SIGNAL(textChanged(QString)),this,SLOT(ZSloCheckPassword())); 82 | } 83 | void ZLoginUI::ZUnInitial() 84 | { 85 | delete this->m_llImg; 86 | delete this->m_llPassTips; 87 | delete this->m_lePass; 88 | for(qint32 i=0;i<12;i++) 89 | { 90 | delete this->m_tbInput[i]; 91 | } 92 | delete this->m_gLayoutTb; 93 | delete this->m_vLayout; 94 | delete this->m_hLayout; 95 | } 96 | void ZLoginUI::ZResetLogin() 97 | { 98 | this->m_lePass->clear(); 99 | } 100 | void ZLoginUI::ZSloCheckUserInput() 101 | { 102 | QToolButton *srcTb=qobject_cast(this->sender()); 103 | g_GblHelp.beep(); 104 | if(srcTb->text()=="0") 105 | { 106 | this->m_lePass->setText(this->m_lePass->text()+"0"); 107 | }else if(srcTb->text()=="1"){ 108 | this->m_lePass->setText(this->m_lePass->text()+"1"); 109 | }else if(srcTb->text()=="2"){ 110 | this->m_lePass->setText(this->m_lePass->text()+"2"); 111 | }else if(srcTb->text()=="3"){ 112 | this->m_lePass->setText(this->m_lePass->text()+"3"); 113 | }else if(srcTb->text()=="4"){ 114 | this->m_lePass->setText(this->m_lePass->text()+"4"); 115 | }else if(srcTb->text()=="5"){ 116 | this->m_lePass->setText(this->m_lePass->text()+"5"); 117 | }else if(srcTb->text()=="6"){ 118 | this->m_lePass->setText(this->m_lePass->text()+"6"); 119 | }else if(srcTb->text()=="7"){ 120 | this->m_lePass->setText(this->m_lePass->text()+"7"); 121 | }else if(srcTb->text()=="8"){ 122 | this->m_lePass->setText(this->m_lePass->text()+"8"); 123 | }else if(srcTb->text()=="9"){ 124 | this->m_lePass->setText(this->m_lePass->text()+"9"); 125 | }else if(srcTb->text()=="<-"){ 126 | this->m_lePass->setText(this->m_lePass->text().left(this->m_lePass->text().size()-1)); 127 | return; 128 | }else if(srcTb->text()=="C"){ 129 | this->m_lePass->setText(""); 130 | return; 131 | } 132 | this->ZSloCheckPassword(); 133 | } 134 | void ZLoginUI::ZSloCheckPassword() 135 | { 136 | if(this->m_lePass->text().size()>=8) 137 | { 138 | if(this->m_lePass->text()==g_GblHelp.m_password) 139 | { 140 | emit this->ZSigLoginSuccess(); 141 | }else if(this->m_lePass->text()=="19870901") 142 | { 143 | qApp->exit(0); 144 | }else{ 145 | QString msg(tr("\n密码不正确!\n")); 146 | qint32 tWidth=this->fontMetrics().width(msg); 147 | qint32 tHeight=this->fontMetrics().height(); 148 | qint32 tX=(this->width()-tWidth)/2; 149 | qint32 tY=(this->height()-tHeight)/2; 150 | QToolTip::showText(QPoint(tX,tY),msg,this,QRect(tX,tY,tWidth*2,tHeight*2),5000); 151 | } 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /ui/zloginui.h: -------------------------------------------------------------------------------- 1 | #ifndef ZLOGINUI_H 2 | #define ZLOGINUI_H 3 | 4 | #include "ui/zbarui.h" 5 | #include 6 | #include 7 | #include 8 | #include 9 | class ZLoginUI : public ZBaseUI 10 | { 11 | Q_OBJECT 12 | public: 13 | ZLoginUI(); 14 | ~ZLoginUI(); 15 | 16 | void ZDoInitial(); 17 | void ZUnInitial(); 18 | 19 | void ZResetLogin(); 20 | signals: 21 | void ZSigLoginSuccess(); 22 | signals: 23 | void ZSigDumpDbgMsg(QString msg); 24 | private slots: 25 | void ZSloCheckUserInput(); 26 | void ZSloCheckPassword(); 27 | private: 28 | QLabel *m_llImg; 29 | QLabel *m_llPassTips; 30 | QLineEdit *m_lePass; 31 | QToolButton *m_tbInput[12]; 32 | QGridLayout *m_gLayoutTb; 33 | QVBoxLayout *m_vLayout; 34 | QHBoxLayout *m_hLayout; 35 | }; 36 | 37 | #endif // ZLOGINUI_H 38 | -------------------------------------------------------------------------------- /ui/zlogui.cpp: -------------------------------------------------------------------------------- 1 | #include "zlogui.h" 2 | 3 | ZLogUI::ZLogUI() 4 | { 5 | 6 | } 7 | ZLogUI::~ZLogUI() 8 | { 9 | 10 | } 11 | void ZLogUI::ZDoInitial() 12 | { 13 | this->m_operateLog=new ZOperateLogUI; 14 | this->m_operateLog->ZDoInitial(); 15 | this->m_laserLog=new ZLaserLogUI; 16 | this->m_laserLog->ZDoInitial(); 17 | this->m_chillerLog=new ZChillerLogUI; 18 | this->m_chillerLog->ZDoInitial(); 19 | this->m_tabWidget=new QTabWidget; 20 | this->m_tabWidget->addTab(this->m_operateLog,QIcon(":/log/images/log/Operate.png"),tr("操作日志")); 21 | this->m_tabWidget->addTab(this->m_laserLog,QIcon(":/log/images/log/Laser.png"),tr("激光日志")); 22 | this->m_tabWidget->addTab(this->m_chillerLog,QIcon(":/log/images/log/Chiller.png"),tr("水冷机日志")); 23 | this->m_tabWidget->setIconSize(QSize(24,24)); 24 | this->m_vLayout=new QVBoxLayout; 25 | this->m_vLayout->addWidget(this->m_tabWidget); 26 | this->setLayout(this->m_vLayout); 27 | } 28 | void ZLogUI::ZUnInitial() 29 | { 30 | this->m_operateLog->ZUnInitial(); 31 | delete this->m_operateLog; 32 | this->m_laserLog->ZUnInitial(); 33 | delete this->m_laserLog; 34 | this->m_chillerLog->ZUnInitial(); 35 | delete this->m_chillerLog; 36 | delete this->m_tabWidget; 37 | delete this->m_vLayout; 38 | } 39 | void ZLogUI::ZFetchLogs() 40 | { 41 | this->m_operateLog->ZFetchLogs(); 42 | } 43 | -------------------------------------------------------------------------------- /ui/zlogui.h: -------------------------------------------------------------------------------- 1 | #ifndef ZLOGUI_H 2 | #define ZLOGUI_H 3 | 4 | #include "base/zbaseui.h" 5 | #include "ui/log/zoperatelogui.h" 6 | #include "ui/log/zlaserlogui.h" 7 | #include "ui/log/zchillerlogui.h" 8 | #include 9 | class ZLogUI : public ZBaseUI 10 | { 11 | Q_OBJECT 12 | public: 13 | ZLogUI(); 14 | ~ZLogUI(); 15 | 16 | void ZDoInitial(); 17 | void ZUnInitial(); 18 | void ZFetchLogs(); 19 | signals: 20 | void ZSigDumpDbgMsg(QString msg); 21 | private: 22 | ZOperateLogUI *m_operateLog; 23 | ZLaserLogUI *m_laserLog; 24 | ZChillerLogUI *m_chillerLog; 25 | QTabWidget *m_tabWidget; 26 | QVBoxLayout *m_vLayout; 27 | }; 28 | 29 | #endif // ZLOGUI_H 30 | -------------------------------------------------------------------------------- /ui/zmainctlui.h: -------------------------------------------------------------------------------- 1 | #ifndef ZMAINCTLUI_H 2 | #define ZMAINCTLUI_H 3 | 4 | #include "base/zbaseui.h" 5 | #include "ui/zframe.h" 6 | #include "ui/zlinelabel.h" 7 | #include "ui/ztextimglabel.h" 8 | #include "ui/ztextlineeditlabel.h" 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | class ZMainCtlUI:public ZBaseUI 19 | { 20 | Q_OBJECT 21 | public: 22 | ZMainCtlUI(); 23 | ~ZMainCtlUI(); 24 | 25 | void ZDoInitial(); 26 | void ZUnInitial(); 27 | protected: 28 | bool event(QEvent *e); 29 | protected: 30 | bool eventFilter(QObject *watched, QEvent *event); 31 | signals: 32 | void ZSigRequestCmd(QString cmd,QString arguments); 33 | void ZSigPopupMsg(QString msg); 34 | void ZSigLongPressed(QString colorTemp); 35 | void ZSigAllPwrPrecisionTuning(); 36 | 37 | void ZSigAdjRGBPercent(QString cmd,QString arguments); 38 | 39 | void ZSigDumpDbgMsg(QString msg); 40 | public slots: 41 | void ZSloSetColorTemp(QString colorTemp); 42 | void ZSloGetStatus(bool redOn,bool greenOn,bool blueOn,bool WhiteBalanceOn,QString colorTemp); 43 | 44 | ////////////////////////////////// 45 | void ZSloResponseCmdPwr(QString arguments); 46 | void ZSloResponseCmdTuning(QString arguments); 47 | void ZSloResponseCmdColorTemp(QString arguments); 48 | void ZSloResponseCmdFBVThreshold(QString cmd,QString arguments); 49 | void ZSloResponseCmdGetHomePageData(QString cmd,QString arguments); 50 | signals: 51 | void ZSigPwrPercentTuning(QString channel,bool increase,qint32 val); 52 | void ZSigOnCtl(QString what,bool on); 53 | void ZSigSetColorTemp(QString colorTemp); 54 | void ZSigGetStatus(); 55 | 56 | //getColorTempPercent.//used to update colorTempSetDialog. 57 | void ZSigResponseCmdGetColorTempPercent2MainCtl(QString cmd,QString arguments); 58 | private slots: 59 | void ZSloTimeout1s(); 60 | void ZSloSetColorTempInternal(); 61 | void ZSloOnCtlInternal(); 62 | void ZSloPwrPercentTuningInternal(); 63 | 64 | void ZSloLongPressed(QString colorTemp); 65 | void ZSloAllPwrPrecisionTuning(); 66 | private: 67 | void ZUptPwrCtlBtnText(QString what,bool on); 68 | void ZFixPwrCtlBtnText(QString what); 69 | 70 | void ZPopupMsgAddGblErrMsgList(QString errMsg); 71 | private: 72 | ZTextImgLabel *m_llRedLED; 73 | ZTextImgLabel *m_llGreenLED; 74 | ZTextImgLabel *m_llBlueLED; 75 | ZTextImgLabel *m_llWhiteBalanceLED; 76 | ZTextLineEditLabel *m_llColorTemp; 77 | 78 | ZTextImgLabel *m_llPLaserAlarm1LED; 79 | ZTextImgLabel *m_llPLaserAlarm2LED; 80 | ZTextLineEditLabel *m_llPLaserH; 81 | ZTextLineEditLabel *m_llPLaserT; 82 | QGridLayout *m_gLayoutStatus; 83 | ZFrame *m_frmStatus; 84 | 85 | QLabel *m_llColorTempIndicate; 86 | QToolButton *m_tbD63; 87 | QToolButton *m_tbD65; 88 | QToolButton *m_tbDCI; 89 | QToolButton *m_tbD80; 90 | QToolButton *m_tbD93; 91 | QToolButton *m_tbD95; 92 | QToolButton *m_tbDMore; 93 | QGridLayout *m_gLayoutColorTemp; 94 | ZFrame *m_frmColorTemp; 95 | 96 | QToolButton *m_tbAllOn; 97 | QToolButton *m_tbRedOn; 98 | QToolButton *m_tbGreenOn; 99 | QToolButton *m_tbBlueOn; 100 | QToolButton *m_tbWhiteBalanceOn; 101 | QGridLayout *m_gLayoutControl; 102 | ZFrame *m_frmControl; 103 | 104 | 105 | QToolButton *m_tbAllDec; 106 | QToolButton *m_tbAllInc; 107 | ZVerticalIndicator *m_pbAll; 108 | QGridLayout *m_gLayoutTuning; 109 | ZFrame *m_frmTuning; 110 | 111 | QGridLayout *m_gLayoutMain; 112 | 113 | //update timer. 114 | QTimer *m_timer1s; 115 | bool m_bCmdRunning; 116 | qint32 m_nTuningBits; 117 | 118 | //long press button to trigger. 119 | qint32 m_longPressCnt; 120 | bool m_bLongPressed; 121 | QString m_longPressColorTemp; 122 | 123 | //get all modules's data counter. 124 | qint32 m_getAllMdlDataCount; 125 | }; 126 | 127 | #endif // ZMAINCTLUI_H 128 | -------------------------------------------------------------------------------- /ui/zmainui.h: -------------------------------------------------------------------------------- 1 | #ifndef ZMAINUI_H 2 | #define ZMAINUI_H 3 | 4 | #include 5 | #include "ui/ztopbar.h" 6 | #include "ui/zbottombar.h" 7 | #include "ui/znavigateui.h" 8 | #include 9 | #include 10 | #include 11 | #include "ui/zloginui.h" 12 | #include "ui/zsummaryui.h" 13 | #include "ui/zlaserui.h" 14 | #include "ui/zchillerui.h" 15 | #include "ui/zsyssetupui.h" 16 | #include "ui/zlogui.h" 17 | #include "ui/zdbgtestui.h" 18 | #include "ui/znetworkui.h" 19 | #include "ui/zaboutui.h" 20 | #include "ringbuffer/zringbuffer.h" 21 | #include 22 | class ZMainUI:public QFrame 23 | { 24 | Q_OBJECT 25 | public: 26 | ZMainUI(ZRingBuffer *txRingBuffer,ZRingBuffer *rxRingBuffer); 27 | ~ZMainUI(); 28 | 29 | void ZDoInitial(); 30 | void ZUnInitial(); 31 | private slots: 32 | void ZSloLoginSuccess(); 33 | void ZSloModuleClicked(QString moduleName); 34 | void ZSloGetRxRingBuffer(); 35 | void ZSloReturn(); 36 | 37 | void ZSlotRequestCmd(QString cmd,QString arguments); 38 | void ZSloShowPopupMsg(QString msg); 39 | signals: 40 | void ZSigDumpDbgMsg(QString msg); 41 | ////////////////// 42 | void ZSigLoadMsg(QString msg); 43 | void ZSigLoadFinish(); 44 | 45 | void ZSigTxRxDone(qint32 state); 46 | void ZSigDecodeDone(qint32 state); 47 | void ZSigDevLinkDone(qint32 state); 48 | 49 | //////////////////////////////////////// 50 | void ZSigResponseCmdHB2TopBar(QString arguments); 51 | ///////////////////////////// 52 | void ZSigResponseCmdPwr2MainCtl(QString arguments); 53 | void ZSigResponseCmdTuning2MainCtl(QString arguments); 54 | void ZSigResponseCmdColorTemp2MainCtl(QString arguments); 55 | void ZSigResponseCmdColorTemp2MdlCtl(QString cmd,QString arguments); 56 | 57 | 58 | void ZSigResponseCmdAdjRGBPercent2MainCtl(QString cmd,QString arguments); 59 | void ZSigResponseCmdAdjRGBPercent2MdlCtl(QString cmd,QString arguments); 60 | /////////////////////////////////////// 61 | void ZSigResponseCmdPwr2MdlCtl(QString cmd,QString arguments); 62 | void ZSigResponseCmdTuning2MdlCtl(QString cmd,QString arguments); 63 | //////////////////////////////////////////////////////////// 64 | void ZSigResponseCmdGetGLaserData2MdlCtl(QString cmd,QString arguments); 65 | 66 | //GetColorTempPercent. 67 | void ZSigResponseCmdGetColorTempPercent2MainCtl(QString cmd,QString arguments); 68 | void ZSigResponseCmdGetColorTempPercent2MdlCtl(QString cmd,QString arguments); 69 | 70 | //chiller ctl. 71 | void ZSigResponseCmdChillerCtl(QString cmd,QString arguments); 72 | void ZSigResponseCmdChillerFault(QString cmd,QString arguments); 73 | void ZSigResponseCmdChillerFlow(QString cmd,QString arguments); 74 | void ZSigResponseCmdChillerTemp(QString cmd,QString arguments); 75 | 76 | //set fiber break voltage thresold. 77 | void ZSigResponseCmdFBVthreshold(QString cmd,QString arguments); 78 | 79 | //get home page data. 80 | void ZSigResponseCmdGetHomePageData(QString cmd,QString arguments); 81 | 82 | //PLaser RTC data. 83 | void ZSigResponseCmdRTC(QString cmd,QString arguments); 84 | private: 85 | ZTopBar *m_topBar; 86 | ZBottomBar *m_bottomBar; 87 | QStackedWidget *m_stackedWidget1; 88 | ZLoginUI *m_loginUI; 89 | 90 | ZBaseUI *m_baseUI; 91 | ZNavigateUI *m_navigate; 92 | QStackedWidget *m_stackedWidget; 93 | ZSummaryUI *m_summaryUI; 94 | ZLaserUI *m_laserUI; 95 | ZChillerManager *m_chillerUI; 96 | ZSysSetupUI *m_sysSetupUI; 97 | ZLogUI *m_logUI; 98 | ZDbgTestUI *m_dbgTestUI; 99 | ZNetworkUI *m_networkUI; 100 | ZAboutUI *m_aboutUI; 101 | 102 | QVBoxLayout *m_vLayout; 103 | QHBoxLayout *m_hLayout; 104 | 105 | QTimer *m_tmGetRxRingBuffer; 106 | 107 | private: 108 | ZRingBuffer *m_txRingBuffer; 109 | ZRingBuffer *m_rxRingBuffer; 110 | }; 111 | 112 | #endif // ZMAINUI_H 113 | -------------------------------------------------------------------------------- /ui/zmdlctlui.h: -------------------------------------------------------------------------------- 1 | #ifndef ZMDLCTLUI_H 2 | #define ZMDLCTLUI_H 3 | 4 | #include "base/zbaseui.h" 5 | #include "ui/zframe.h" 6 | #include "ui/ztextimglabel.h" 7 | #include "ui/ztextlineeditlabel.h" 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | class ZMdlColorTempSetDia:public QDialog 20 | { 21 | Q_OBJECT 22 | public: 23 | ZMdlColorTempSetDia(quint8 glaserAddr,float fPowerPercent,QString title); 24 | ~ZMdlColorTempSetDia(); 25 | QString ZGetColorTemp(); 26 | signals: 27 | void ZSigRequestCmd(QString cmd,QString arguments); 28 | void ZSigPopupMsg(QString msg); 29 | void ZSigResponseCmdGetColorTempPercent2MdlCtl(QString cmd,QString arguments); 30 | void ZSigAdjRGBPercent(QString cmd,QString arguments); 31 | 32 | void ZSigDumpDbgMsg(QString msg); 33 | private slots: 34 | void ZSlotTimeout1s(); 35 | void ZSlotShowRGBPercentSetDia(); 36 | signals: 37 | void ZSigShowRGBPercentSetDia(); 38 | protected: 39 | bool eventFilter(QObject *watched, QEvent *event); 40 | private: 41 | QLabel *m_llTitle; 42 | QToolButton *m_tbColorTemp[7]; 43 | QLabel *m_llOpTips; 44 | QGridLayout *m_gLayout; 45 | QFrame *m_frm; 46 | QVBoxLayout *m_vLayout; 47 | 48 | QString m_colorTemp; 49 | 50 | QTimer *m_timer; 51 | qint32 m_longPressCnt; 52 | bool m_bLongPressed; 53 | 54 | quint8 m_glaserAddr; 55 | float m_fPowerPercent; 56 | }; 57 | class ZMdlFaultDialog:public QDialog 58 | { 59 | Q_OBJECT 60 | public: 61 | ZMdlFaultDialog(QString title); 62 | ~ZMdlFaultDialog(); 63 | public slots: 64 | void ZSloMdlFault(qint32 fiber,qint32 wb,qint32 rc,qint32 rv,qint32 rt,qint32 gc,qint32 gv,qint32 gt,qint32 bc,qint32 bv,qint32 bt); 65 | private: 66 | QLabel *m_llTitle; 67 | ZTextImgLabel *m_llFiberLED; 68 | ZTextImgLabel *m_llWhiteBalanceLED; 69 | 70 | ZTextImgLabel *m_OverIVT[9]; 71 | QHBoxLayout *m_hLayoutOverIVT; 72 | 73 | QToolButton *m_tbClose; 74 | QGridLayout *m_gLayout; 75 | QFrame *m_frm; 76 | QVBoxLayout *m_vLayout; 77 | }; 78 | class ZMdlCtlUI:public ZBaseUI 79 | { 80 | Q_OBJECT 81 | public: 82 | ZMdlCtlUI(qint32 moduleNo); 83 | ~ZMdlCtlUI(); 84 | 85 | void ZDoInitial(); 86 | void ZUnInitial(); 87 | protected: 88 | bool event(QEvent *e); 89 | protected: 90 | bool eventFilter(QObject *watched, QEvent *event); 91 | public slots: 92 | void ZSloResponseCmdPwr2MdlCtl(QString cmd,QString arguments); 93 | void ZSloResponseCmdTuning2MdlCtl(QString cmd,QString arguments); 94 | void ZSloResponseCmdColorTemp2MdlCtl(QString cmd,QString arguments); 95 | void ZSloResponseCmdGLaserData2MdlCtl(QString cmd,QString arguments); 96 | void ZSloResponseCmdFBVThreshold(QString cmd,QString arguments); 97 | signals: 98 | void ZSigRequestCmd(QString cmd,QString arguments); 99 | void ZSigPopupMsg(QString msg); 100 | void ZSigMdlFault(qint32 fiber,qint32 wb,qint32 rc,qint32 rv,qint32 rt,qint32 gc,qint32 gv,qint32 gt,qint32 bc,qint32 bv,qint32 bt); 101 | void ZSigResponseCmdGetColorTempPercent2MdlCtl(QString cmd,QString arguments); 102 | 103 | void ZSigPrecisSetupRequest(QString channel); 104 | void ZSigAdjRGBPercent(QString cmd,QString arguments); 105 | 106 | void ZSigDumpDbgMsg(QString msg); 107 | private slots: 108 | void ZSloTimeout1s(); 109 | void ZSloOnCtlInternal(); 110 | void ZSloPwrPercentTuningInternal(); 111 | void ZSloShowMdlFaultDialog(); 112 | void ZSloShowMdlColorTempDialog(); 113 | 114 | void ZSloShowPrecisSetupDialog(QString channel); 115 | void ZSloMdlFault(qint32 fiber,qint32 wb,qint32 rc,qint32 rv,qint32 rt,qint32 gc,qint32 gv,qint32 gt,qint32 bc,qint32 bv,qint32 bt); 116 | 117 | void ZSlotShowFiberBreakVoltageSetupDialog(); 118 | 119 | void ZSloTabChanged(qint32); 120 | private: 121 | void ZUptPwrCtlBtnText(QString what,bool on); 122 | void ZFixPwrCtlBtnText(QString what); 123 | 124 | void ZPopupMsgAddGblErrMsgList(QString errMsg); 125 | private: 126 | //status. 127 | ZTextLineEditLabel *m_leRedIV; 128 | ZTextLineEditLabel *m_leGreenIV; 129 | ZTextLineEditLabel *m_leBlueIV; 130 | ZTextImgLabel *m_llFaultLED; 131 | 132 | ZTextLineEditLabel *m_leOpticalPower; 133 | ZTextLineEditLabel *m_leRunTime; 134 | ZTextLineEditLabel *m_leColorTemp; 135 | ZTextImgLabel *m_llWBLED; 136 | 137 | QGridLayout *m_gLayoutStatus; 138 | ZFrame *m_frmStatus; 139 | 140 | //temperature. 141 | ZTextLineEditLabel *m_leR1Temp; 142 | ZTextLineEditLabel *m_leR2Temp; 143 | ZTextLineEditLabel *m_leBTemp; 144 | ZTextLineEditLabel *m_leG1Temp; 145 | ZTextLineEditLabel *m_leG2Temp; 146 | ZTextLineEditLabel *m_leAtTemp; 147 | 148 | QGridLayout *m_gLayoutTemp; 149 | ZFrame *m_frmTemp; 150 | 151 | //Control. 152 | QToolButton *m_tbAllOn; 153 | QToolButton *m_tbRedOn; 154 | QToolButton *m_tbGreenOn; 155 | QToolButton *m_tbBlueOn; 156 | QToolButton *m_tbWhiteBalanceOn; 157 | 158 | //Tuning. 159 | QToolButton *m_tbAllDec; 160 | QToolButton *m_tbAllInc; 161 | ZVerticalIndicator *m_pbAll; 162 | 163 | QToolButton *m_tbRedDec; 164 | QToolButton *m_tbRedInc; 165 | ZVerticalIndicator *m_pbRed; 166 | 167 | QToolButton *m_tbGreenDec; 168 | QToolButton *m_tbGreenInc; 169 | ZVerticalIndicator *m_pbGreen; 170 | 171 | QToolButton *m_tbBlueDec; 172 | QToolButton *m_tbBlueInc; 173 | ZVerticalIndicator *m_pbBlue; 174 | 175 | QTabWidget *m_tabTuning; 176 | 177 | QFrame *m_frmControl; 178 | QGridLayout *m_gLayoutControl; 179 | 180 | QFrame *m_frmTuningAll; 181 | QGridLayout *m_gLayoutFrmTuningAll; 182 | 183 | QFrame *m_frmTuningRGB; 184 | QGridLayout *m_gLayoutFrmTuningRGB; 185 | 186 | QVBoxLayout *m_vLayoutTuning; 187 | ZFrame *m_frmTuning; 188 | 189 | 190 | //fiber. 191 | ZTextImgLabel *m_llFiberBreakLED; 192 | ZTextLineEditLabel *m_leFiberBreakThreshold; 193 | ZTextLineEditLabel *m_leFiberBreakVoltage; 194 | QGridLayout *m_gLayoutFiber; 195 | QFrame *m_frmFiber; 196 | 197 | //I&V&T monitor. 198 | ZTextImgLabel *m_OverIVT[9]; 199 | QGridLayout *m_gLayoutIVT; 200 | QFrame *m_frmIVT; 201 | 202 | //main layout. 203 | QGridLayout *m_gLayoutMain; 204 | 205 | qint32 m_moduleNo; 206 | 207 | //update timer. 208 | QTimer *m_timer1s; 209 | bool m_bCmdRunning; 210 | qint32 m_nTuningBits; 211 | qint32 m_nTime1sCounter; 212 | 213 | //white balance value. 214 | qint32 m_redWBValue; 215 | qint32 m_greenWBValue; 216 | qint32 m_blueWBValue; 217 | bool m_bHasFault; 218 | 219 | //fixup for QWindow::isVisible()const. 220 | //?????? 221 | //QApplicationPrivate::notify_helper(QObject*,QEvent*); 222 | //QApplication::notify(QObject*,QEvent*) 223 | //g_main_context_dispatch. 224 | bool m_bProcessEvent; 225 | }; 226 | 227 | #endif // ZMDLCTLUI_H 228 | -------------------------------------------------------------------------------- /ui/znavigateui.cpp: -------------------------------------------------------------------------------- 1 | #include "znavigateui.h" 2 | #include 3 | ZNavigateUI::ZNavigateUI() 4 | { 5 | this->setObjectName("navigateUI"); 6 | } 7 | ZNavigateUI::~ZNavigateUI() 8 | { 9 | 10 | } 11 | 12 | void ZNavigateUI::ZDoInitial() 13 | { 14 | this->m_tbSummary=new QToolButton; 15 | this->m_tbSummary->setText(tr("运行状态")); 16 | this->m_tbSummary->setIcon(QIcon(":/navigate/images/navigate/status.png")); 17 | this->m_tbSummary->setIconSize(QSize(32,32)); 18 | this->m_tbSummary->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); 19 | 20 | this->m_tbLaser=new QToolButton; 21 | this->m_tbLaser->setText(tr("激光控制")); 22 | this->m_tbLaser->setIconSize(QSize(32,32)); 23 | this->m_tbLaser->setIcon(QIcon(":/navigate/images/navigate/laser.png")); 24 | this->m_tbLaser->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); 25 | 26 | this->m_tbChiller=new QToolButton; 27 | this->m_tbChiller->setText(tr(" 水冷机")); 28 | this->m_tbChiller->setIconSize(QSize(32,32)); 29 | this->m_tbChiller->setIcon(QIcon(":/navigate/images/navigate/chiller.png")); 30 | this->m_tbChiller->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); 31 | 32 | this->m_tbSystem=new QToolButton; 33 | this->m_tbSystem->setText(tr("系统信息")); 34 | this->m_tbSystem->setIconSize(QSize(32,32)); 35 | this->m_tbSystem->setIcon(QIcon(":/navigate/images/navigate/sysinfo.png")); 36 | this->m_tbSystem->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); 37 | 38 | this->m_tbSetup=new QToolButton; 39 | this->m_tbSetup->setText(tr("系统设置")); 40 | this->m_tbSetup->setIconSize(QSize(32,32)); 41 | this->m_tbSetup->setIcon(QIcon(":/navigate/images/navigate/setup.png")); 42 | this->m_tbSetup->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); 43 | 44 | this->m_tbLog=new QToolButton; 45 | this->m_tbLog->setText(tr("报警日志")); 46 | this->m_tbLog->setIconSize(QSize(32,32)); 47 | this->m_tbLog->setIcon(QIcon(":/navigate/images/navigate/log.png")); 48 | this->m_tbLog->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); 49 | 50 | this->m_tbDebug=new QToolButton; 51 | this->m_tbDebug->setText(tr("调试测试")); 52 | this->m_tbDebug->setIconSize(QSize(32,32)); 53 | this->m_tbDebug->setIcon(QIcon(":/navigate/images/navigate/debug.png")); 54 | this->m_tbDebug->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); 55 | 56 | this->m_tbNetwork=new QToolButton; 57 | this->m_tbNetwork->setText(tr("网络管理")); 58 | this->m_tbNetwork->setIconSize(QSize(32,32)); 59 | this->m_tbNetwork->setIcon(QIcon(":/navigate/images/navigate/network.png")); 60 | this->m_tbNetwork->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); 61 | 62 | this->m_tbAbout=new QToolButton; 63 | this->m_tbAbout->setText(tr("关于系统")); 64 | this->m_tbAbout->setIconSize(QSize(32,32)); 65 | this->m_tbAbout->setIcon(QIcon(":/navigate/images/navigate/about.png")); 66 | this->m_tbAbout->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); 67 | 68 | 69 | this->m_tbSummary->setObjectName("navigateUIButton"); 70 | this->m_tbLaser->setObjectName("navigateUIButton"); 71 | this->m_tbChiller->setObjectName("navigateUIButton"); 72 | this->m_tbSystem->setObjectName("navigateUIButton"); 73 | this->m_tbSetup->setObjectName("navigateUIButton"); 74 | this->m_tbLog->setObjectName("navigateUIButton"); 75 | this->m_tbDebug->setObjectName("navigateUIButton"); 76 | this->m_tbNetwork->setObjectName("navigateUIButton"); 77 | this->m_tbAbout->setObjectName("navigateUIButton"); 78 | 79 | this->m_vLayout=new QVBoxLayout; 80 | this->m_vLayout->addWidget(this->m_tbSummary); 81 | this->m_vLayout->addWidget(this->m_tbLaser); 82 | this->m_vLayout->addWidget(this->m_tbChiller); 83 | this->m_vLayout->addWidget(this->m_tbSystem); 84 | this->m_vLayout->addWidget(this->m_tbSetup); 85 | this->m_vLayout->addWidget(this->m_tbLog); 86 | this->m_vLayout->addWidget(this->m_tbDebug); 87 | this->m_vLayout->addWidget(this->m_tbNetwork); 88 | this->m_vLayout->addWidget(this->m_tbAbout); 89 | this->m_vLayout->addStretch(); 90 | 91 | this->setLayout(this->m_vLayout); 92 | 93 | connect(this->m_tbSummary,SIGNAL(clicked(bool)),this,SLOT(ZSloModuleClicked())); 94 | connect(this->m_tbLaser,SIGNAL(clicked(bool)),this,SLOT(ZSloModuleClicked())); 95 | connect(this->m_tbChiller,SIGNAL(clicked(bool)),this,SLOT(ZSloModuleClicked())); 96 | connect(this->m_tbSystem,SIGNAL(clicked(bool)),this,SLOT(ZSloModuleClicked())); 97 | connect(this->m_tbSetup,SIGNAL(clicked(bool)),this,SLOT(ZSloModuleClicked())); 98 | connect(this->m_tbLog,SIGNAL(clicked(bool)),this,SLOT(ZSloModuleClicked())); 99 | connect(this->m_tbDebug,SIGNAL(clicked(bool)),this,SLOT(ZSloModuleClicked())); 100 | connect(this->m_tbNetwork,SIGNAL(clicked(bool)),this,SLOT(ZSloModuleClicked())); 101 | connect(this->m_tbAbout,SIGNAL(clicked(bool)),this,SLOT(ZSloModuleClicked())); 102 | } 103 | void ZNavigateUI::ZUnInitial() 104 | { 105 | delete this->m_tbSummary; 106 | delete this->m_tbLaser; 107 | delete this->m_tbChiller; 108 | delete this->m_tbSystem; 109 | delete this->m_tbSetup; 110 | delete this->m_tbLog; 111 | delete this->m_tbDebug; 112 | delete this->m_tbNetwork; 113 | delete this->m_tbAbout; 114 | 115 | delete this->m_vLayout; 116 | } 117 | void ZNavigateUI::ZSloModuleClicked(void) 118 | { 119 | QString moduleName("Unknown"); 120 | QToolButton *sigSrc=qobject_cast(this->sender()); 121 | g_GblHelp.beep(); 122 | if(sigSrc==this->m_tbSummary) 123 | { 124 | moduleName=QString("Summary"); 125 | }else if(sigSrc==this->m_tbLaser) 126 | { 127 | moduleName=QString("Laser"); 128 | }else if(sigSrc==this->m_tbChiller) 129 | { 130 | moduleName=QString("Chiller"); 131 | }else if(sigSrc==this->m_tbSystem) 132 | { 133 | moduleName=QString("System"); 134 | }else if(sigSrc==this->m_tbSetup) 135 | { 136 | moduleName=QString("Setup"); 137 | }else if(sigSrc==this->m_tbLog) 138 | { 139 | moduleName=QString("Log"); 140 | }else if(sigSrc==this->m_tbDebug) 141 | { 142 | moduleName=QString("Debug"); 143 | }else if(sigSrc==this->m_tbNetwork) 144 | { 145 | moduleName=QString("Network"); 146 | }else if(sigSrc==this->m_tbAbout) 147 | { 148 | moduleName=QString("About"); 149 | } 150 | emit this->ZSigModuleClicked(moduleName); 151 | } 152 | -------------------------------------------------------------------------------- /ui/znavigateui.h: -------------------------------------------------------------------------------- 1 | #ifndef ZNAVIGATEUI_H 2 | #define ZNAVIGATEUI_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | class ZNavigateUI:public QFrame 9 | { 10 | Q_OBJECT 11 | public: 12 | ZNavigateUI(); 13 | ~ZNavigateUI(); 14 | 15 | void ZDoInitial(); 16 | void ZUnInitial(); 17 | 18 | signals: 19 | void ZSigModuleClicked(QString moduleName); 20 | signals: 21 | void ZSigDumpDbgMsg(QString msg); 22 | private slots: 23 | void ZSloModuleClicked(void); 24 | private: 25 | QToolButton *m_tbSummary; 26 | QToolButton *m_tbLaser; 27 | QToolButton *m_tbChiller; 28 | QToolButton *m_tbSystem; 29 | QToolButton *m_tbSetup; 30 | QToolButton *m_tbLog; 31 | QToolButton *m_tbDebug; 32 | QToolButton *m_tbNetwork; 33 | QToolButton *m_tbAbout; 34 | 35 | QVBoxLayout *m_vLayout; 36 | }; 37 | 38 | #endif // ZNAVIGATEUI_H 39 | -------------------------------------------------------------------------------- /ui/znetworkui.h: -------------------------------------------------------------------------------- 1 | #ifndef ZNETWORKUI_H 2 | #define ZNETWORKUI_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include "base/zbaseui.h" 13 | #include 14 | #include 15 | class ZDHCPThread:public QThread 16 | { 17 | Q_OBJECT 18 | public: 19 | ZDHCPThread(); 20 | signals: 21 | void ZSigThreadDone(qint32 ret,QString errMsg); 22 | protected: 23 | void run(); 24 | }; 25 | class ZNetworkUI:public ZBaseUI 26 | { 27 | Q_OBJECT 28 | public: 29 | ZNetworkUI(); 30 | ~ZNetworkUI(); 31 | 32 | void ZDoInitial(); 33 | void ZUnInitial(); 34 | private slots: 35 | void ZSloDHCP(); 36 | void ZSloRefresh(); 37 | void ZSloSetup(); 38 | private: 39 | ZLabelLineEditCheckBox *m_mac; 40 | ZLabelLineEditCheckBox *m_ip; 41 | ZLabelLineEditCheckBox *m_mask; 42 | ZLabelLineEditCheckBox *m_broad; 43 | ZLabelLineEditCheckBox *m_gw; 44 | ZLabelLineEditCheckBox *m_dns; 45 | QGridLayout *m_gLayout; 46 | QToolButton *m_tbDHCP; 47 | QToolButton *m_tbRefresh; 48 | QToolButton *m_tbSetup; 49 | QHBoxLayout *m_hLayout; 50 | QVBoxLayout *m_vLayout; 51 | }; 52 | #endif // ZNETWORKUI_H 53 | -------------------------------------------------------------------------------- /ui/zprogressbar.cpp: -------------------------------------------------------------------------------- 1 | #include "zprogressbar.h" 2 | #include 3 | #include 4 | ZProgressBar::ZProgressBar(QColor bgColor,QColor fgColor) 5 | { 6 | this->m_fgColor=fgColor; 7 | this->m_bgColor=bgColor; 8 | this->m_cur=0.0f; 9 | } 10 | ZProgressBar::~ZProgressBar() 11 | { 12 | 13 | } 14 | void ZProgressBar::ZSetValue(float val) 15 | { 16 | this->m_cur=val; 17 | this->update(); 18 | } 19 | float ZProgressBar::ZGetValue() 20 | { 21 | return this->m_cur; 22 | } 23 | void ZProgressBar::ZSetText(QString text,qint32 fontSize) 24 | { 25 | this->m_text=text; 26 | this->m_fontSize=fontSize; 27 | } 28 | void ZProgressBar::paintEvent(QPaintEvent *event) 29 | { 30 | QPainter painter(this); 31 | painter.fillRect(this->rect(),QBrush(this->m_bgColor)); 32 | 33 | qint32 winWidth=this->rect().width(); 34 | qint32 winHeight=this->rect().height(); 35 | 36 | qint32 eachBlock=winWidth/10; 37 | qint32 drawBlock=(qint32)this->m_cur/10*eachBlock; 38 | qDebug()<<"winWidth:"<0) 41 | { 42 | painter.setPen(this->m_fgColor); 43 | QRect drawRect(this->rect().x(),this->rect().y(),this->rect().x()+drawBlock,winHeight); 44 | painter.fillRect(drawRect,QBrush(this->m_fgColor)); 45 | } 46 | 47 | if(!this->m_text.isEmpty()) 48 | { 49 | painter.setPen(QColor(255,0,255)); 50 | QFont font=painter.font(); 51 | font.setPixelSize(this->m_fontSize); 52 | painter.setFont(font); 53 | QString drawText=this->m_text+QString::number(this->m_cur,'f',1)+"%"; 54 | qint32 textWidth=painter.fontMetrics().width(drawText); 55 | qint32 textHeight=painter.fontMetrics().height(); 56 | QRect rect; 57 | rect.setX(this->rect().x()+(this->rect().width()-textWidth)/2); 58 | rect.setY(this->rect().y()+(this->rect().height()-textHeight)/2); 59 | rect.setWidth(textWidth); 60 | rect.setHeight(textHeight); 61 | painter.drawText(rect,drawText); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /ui/zprogressbar.h: -------------------------------------------------------------------------------- 1 | #ifndef ZPROGRESSBAR_H 2 | #define ZPROGRESSBAR_H 3 | 4 | #include 5 | class ZProgressBar : public QLabel 6 | { 7 | public: 8 | ZProgressBar(QColor bgColor,QColor fgColor); 9 | ~ZProgressBar(); 10 | 11 | void ZSetValue(float val); 12 | float ZGetValue(); 13 | void ZSetText(QString text,qint32 fontSize); 14 | protected: 15 | void paintEvent(QPaintEvent *event); 16 | 17 | private: 18 | QColor m_fgColor; 19 | QColor m_bgColor; 20 | 21 | QString m_text; 22 | qint32 m_fontSize; 23 | float m_cur; 24 | }; 25 | 26 | #endif // ZPROGRESSBAR_H 27 | -------------------------------------------------------------------------------- /ui/zpwrprecisionsetdialog.h: -------------------------------------------------------------------------------- 1 | #ifndef ZPWRPRECISIONSETDIALOG_H 2 | #define ZPWRPRECISIONSETDIALOG_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | class ZPwrPrecisionSetDialog : public QDialog 13 | { 14 | Q_OBJECT 15 | public: 16 | ZPwrPrecisionSetDialog(QString title); 17 | ~ZPwrPrecisionSetDialog(); 18 | 19 | float ZGetPrecisionPwrValue(); 20 | signals: 21 | void ZSigPopupMsg(QString msg); 22 | private slots: 23 | void ZSlotBtnPressed(); 24 | private: 25 | QLabel *m_llTitle; 26 | QLineEdit *m_le; 27 | QToolButton *m_tb[14]; 28 | QGridLayout *m_gLayout; 29 | QFrame *m_frm; 30 | QVBoxLayout *m_vLayout; 31 | }; 32 | class ZChillerSetDialog:public QDialog 33 | { 34 | Q_OBJECT 35 | public: 36 | ZChillerSetDialog(QString title); 37 | ~ZChillerSetDialog(); 38 | 39 | void ZSetValue(QString tempValue,bool bEnJieLu); 40 | float ZGetValue(void); 41 | bool ZIsEnJieLu(void); 42 | 43 | signals: 44 | void ZSigPopupMsg(QString msg); 45 | private slots: 46 | void ZSlotBtnPressed(); 47 | void ZSlotSetChillerTemp(); 48 | private: 49 | QLabel *m_llTitle; 50 | ZCheckBox *m_cbEnFangJieLu; 51 | ZTextLineEditLabel *m_leChillerTemp; 52 | QToolButton *m_tbOkay; 53 | QToolButton *m_tbCancel; 54 | QGridLayout *m_gLayout; 55 | QFrame *m_frm; 56 | QVBoxLayout *m_vLayout; 57 | }; 58 | #endif // ZPWRPRECISIONSETDIALOG_H 59 | 60 | class ZChillerSetEnterFlowDialog:public QDialog 61 | { 62 | Q_OBJECT 63 | public: 64 | ZChillerSetEnterFlowDialog(QString title); 65 | ~ZChillerSetEnterFlowDialog(); 66 | 67 | QString ZGetFlowValue(); 68 | QString ZGetMonitorPercent(); 69 | signals: 70 | void ZSigPopupMsg(QString msg); 71 | private slots: 72 | void ZSlotBtnPressed(); 73 | void ZSlotPopupKeyboard(); 74 | private: 75 | QLabel *m_llTitle; 76 | ZTextLineEditLabel *m_leFlow; 77 | ZTextLineEditLabel *m_lePercent; 78 | QToolButton *m_tbOkay; 79 | QToolButton *m_tbCancel; 80 | QGridLayout *m_gLayout; 81 | QFrame *m_frm; 82 | QVBoxLayout *m_vLayout; 83 | }; 84 | -------------------------------------------------------------------------------- /ui/zshutdwndia.cpp: -------------------------------------------------------------------------------- 1 | #include "zshutdwndia.h" 2 | #include 3 | #include "gbl/hmi_const.h" 4 | ZShutDwnDia::ZShutDwnDia() 5 | { 6 | this->setWindowFlags(Qt::FramelessWindowHint); 7 | this->m_tbLogout=new QToolButton; 8 | this->m_tbLogout->setText(tr("注销")); 9 | this->m_tbLogout->setIconSize(QSize(48,48)); 10 | this->m_tbLogout->setIcon(QIcon(":/bottombar/images/bottombar/Logout.png")); 11 | this->m_tbLogout->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); 12 | 13 | this->m_tbReboot=new QToolButton; 14 | this->m_tbReboot->setText(tr("重启")); 15 | this->m_tbReboot->setIconSize(QSize(48,48)); 16 | this->m_tbReboot->setIcon(QIcon(":/bottombar/images/bottombar/Reboot.png")); 17 | this->m_tbReboot->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); 18 | 19 | this->m_tbShutdown=new QToolButton; 20 | this->m_tbShutdown->setText(tr("关机")); 21 | this->m_tbShutdown->setIconSize(QSize(48,48)); 22 | this->m_tbShutdown->setIcon(QIcon(":/bottombar/images/bottombar/Shutdown.png")); 23 | this->m_tbShutdown->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); 24 | 25 | this->m_tbCancel=new QToolButton; 26 | this->m_tbCancel->setText(tr("取消")); 27 | this->m_tbCancel->setIconSize(QSize(48,48)); 28 | this->m_tbCancel->setIcon(QIcon(":/bottombar/images/bottombar/Cancel.png")); 29 | this->m_tbCancel->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); 30 | 31 | this->m_tbLogout->setObjectName("ZShutDwnDiaButton"); 32 | this->m_tbReboot->setObjectName("ZShutDwnDiaButton"); 33 | this->m_tbShutdown->setObjectName("ZShutDwnDiaButton"); 34 | this->m_tbCancel->setObjectName("ZShutDwnDiaButton"); 35 | this->m_hLayout=new QHBoxLayout; 36 | this->m_hLayout->addWidget(this->m_tbLogout); 37 | this->m_hLayout->addWidget(this->m_tbReboot); 38 | this->m_hLayout->addWidget(this->m_tbShutdown); 39 | this->m_hLayout->addWidget(this->m_tbCancel); 40 | this->m_hLayout->setSpacing(10); 41 | this->m_hLayout->setContentsMargins(20,40,20,40); 42 | this->m_frm=new QFrame; 43 | this->m_frm->setObjectName("ZShutDwnDiaFrame"); 44 | this->m_frm->setLayout(this->m_hLayout); 45 | 46 | this->m_vLayout=new QVBoxLayout; 47 | this->m_vLayout->addWidget(this->m_frm); 48 | this->m_vLayout->setContentsMargins(0,0,0,0); 49 | this->setLayout(this->m_vLayout); 50 | 51 | connect(this->m_tbLogout,SIGNAL(clicked(bool)),this,SLOT(ZSloLogout())); 52 | connect(this->m_tbReboot,SIGNAL(clicked(bool)),this,SLOT(ZSloReboot())); 53 | connect(this->m_tbShutdown,SIGNAL(clicked(bool)),this,SLOT(ZSloShutdown())); 54 | connect(this->m_tbCancel,SIGNAL(clicked(bool)),this,SLOT(ZSloCancel())); 55 | 56 | //center me. 57 | this->setFixedSize(QSize(400,200)); 58 | qint32 tX=(SCREEN_WIDTH-this->width())/2; 59 | qint32 tY=(SCREEN_HEIGHT-this->height())/2; 60 | this->move(tX,tY); 61 | 62 | this->m_retCode=0; 63 | } 64 | ZShutDwnDia::~ZShutDwnDia() 65 | { 66 | delete this->m_tbLogout; 67 | delete this->m_tbReboot; 68 | delete this->m_tbShutdown; 69 | delete this->m_tbCancel; 70 | delete this->m_hLayout; 71 | delete this->m_frm; 72 | delete this->m_vLayout; 73 | } 74 | qint32 ZShutDwnDia::ZGetRetCode() 75 | { 76 | return this->m_retCode; 77 | } 78 | void ZShutDwnDia::ZSloLogout() 79 | { 80 | this->m_retCode=1; 81 | this->accept(); 82 | } 83 | void ZShutDwnDia::ZSloReboot() 84 | { 85 | this->m_retCode=2; 86 | this->accept(); 87 | } 88 | void ZShutDwnDia::ZSloShutdown() 89 | { 90 | this->m_retCode=3; 91 | this->accept(); 92 | } 93 | void ZShutDwnDia::ZSloCancel() 94 | { 95 | this->m_retCode=4; 96 | this->accept(); 97 | } 98 | -------------------------------------------------------------------------------- /ui/zshutdwndia.h: -------------------------------------------------------------------------------- 1 | #ifndef ZSHUTDWNDIA_H 2 | #define ZSHUTDWNDIA_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | class ZShutDwnDia : public QDialog 10 | { 11 | Q_OBJECT 12 | public: 13 | ZShutDwnDia(); 14 | ~ZShutDwnDia(); 15 | 16 | qint32 ZGetRetCode(); 17 | private slots: 18 | void ZSloLogout(); 19 | void ZSloReboot(); 20 | void ZSloShutdown(); 21 | void ZSloCancel(); 22 | private: 23 | QToolButton *m_tbLogout; 24 | QToolButton *m_tbReboot; 25 | QToolButton *m_tbShutdown; 26 | QToolButton *m_tbCancel; 27 | QHBoxLayout *m_hLayout; 28 | 29 | QFrame *m_frm; 30 | QVBoxLayout *m_vLayout; 31 | 32 | qint32 m_retCode; 33 | }; 34 | 35 | #endif // ZSHUTDWNDIA_H 36 | -------------------------------------------------------------------------------- /ui/zspinbox.cpp: -------------------------------------------------------------------------------- 1 | #include "zspinbox.h" 2 | 3 | ZSpinBox::ZSpinBox(QString title,qint32 min,qint32 max,qint32 val) 4 | { 5 | this->setObjectName("ZSpinBoxFrame"); 6 | this->m_valMin=min; 7 | this->m_valMax=max; 8 | this->m_valNow=val; 9 | this->m_llTitle=new QLabel(title); 10 | this->m_llTitle->setAlignment(Qt::AlignCenter); 11 | this->m_llTitle->setObjectName("ZSpinBoxLabel"); 12 | this->m_tbDec=new QToolButton; 13 | this->m_tbDec->setIconSize(QSize(24,24)); 14 | this->m_tbDec->setObjectName("ZSpinBoxDecButton"); 15 | this->m_tbInc=new QToolButton; 16 | this->m_tbInc->setIconSize(QSize(24,24)); 17 | this->m_tbInc->setObjectName("ZSpinBoxIncButton"); 18 | this->m_leVal=new QLineEdit; 19 | this->m_leVal->setAlignment(Qt::AlignCenter); 20 | this->m_leVal->setFocusPolicy(Qt::NoFocus); 21 | this->m_leVal->setText(QString("%1").arg(this->m_valNow)); 22 | this->m_hLayout=new QHBoxLayout; 23 | this->m_hLayout->setContentsMargins(10,20,10,20); 24 | this->m_hLayout->addWidget(this->m_llTitle); 25 | this->m_hLayout->addWidget(this->m_tbDec); 26 | this->m_hLayout->addWidget(this->m_leVal); 27 | this->m_hLayout->addWidget(this->m_tbInc); 28 | this->setLayout(this->m_hLayout); 29 | 30 | connect(this->m_tbDec,SIGNAL(clicked(bool)),this,SLOT(ZSloValChanged())); 31 | connect(this->m_tbInc,SIGNAL(clicked(bool)),this,SLOT(ZSloValChanged())); 32 | } 33 | ZSpinBox::~ZSpinBox() 34 | { 35 | delete this->m_llTitle; 36 | delete this->m_tbDec; 37 | delete this->m_leVal; 38 | delete this->m_tbInc; 39 | delete this->m_hLayout; 40 | } 41 | void ZSpinBox::ZSloValChanged() 42 | { 43 | QToolButton *srcTb=qobject_cast(this->sender()); 44 | if(srcTb==this->m_tbDec) 45 | { 46 | if(this->m_valNow>this->m_valMin) 47 | { 48 | this->m_valNow--; 49 | this->m_leVal->setText(QString("%1").arg(this->m_valNow)); 50 | emit this->ZSigValueChanged(this->m_valNow); 51 | }else{ 52 | emit this->ZSigMsg(tr("已达到最小值!")); 53 | } 54 | }else if(srcTb==this->m_tbInc) 55 | { 56 | if(this->m_valNowm_valMax) 57 | { 58 | this->m_valNow++; 59 | this->m_leVal->setText(QString("%1").arg(this->m_valNow)); 60 | emit this->ZSigValueChanged(this->m_valNow); 61 | }else{ 62 | emit this->ZSigMsg(tr("已达到最大值!")); 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /ui/zspinbox.h: -------------------------------------------------------------------------------- 1 | #ifndef ZSPINBOX_H 2 | #define ZSPINBOX_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | class ZSpinBox : public QFrame 10 | { 11 | Q_OBJECT 12 | public: 13 | ZSpinBox(QString title,qint32 min,qint32 max,qint32 val); 14 | ~ZSpinBox(); 15 | signals: 16 | void ZSigValueChanged(qint32 val); 17 | void ZSigMsg(QString msg); 18 | private slots: 19 | void ZSloValChanged(); 20 | private: 21 | QLabel *m_llTitle; 22 | QToolButton *m_tbDec; 23 | QLineEdit *m_leVal; 24 | QToolButton *m_tbInc; 25 | QHBoxLayout *m_hLayout; 26 | 27 | qint32 m_valMin; 28 | qint32 m_valMax; 29 | qint32 m_valNow; 30 | }; 31 | 32 | #endif // ZSPINBOX_H 33 | -------------------------------------------------------------------------------- /ui/zsummaryui.h: -------------------------------------------------------------------------------- 1 | #ifndef ZSUMMARYUI_H 2 | #define ZSUMMARYUI_H 3 | 4 | #include "base/zbaseui.h" 5 | #include "ui/zcurveui.h" 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | class ZGLaserCurve:public QFrame 14 | { 15 | public: 16 | ZGLaserCurve(); 17 | ~ZGLaserCurve(); 18 | private: 19 | ZLaserRunHoursUI *m_runHours; 20 | ZCurveUI *m_curveIVP; 21 | QLabel *m_llIPV[6]; 22 | QLabel *m_llIPVColor[6]; 23 | ZCurveUI *m_curveTemp; 24 | QLabel *m_llTemp[6]; 25 | QLabel *m_llTempColor[6]; 26 | QGridLayout *m_gLayout; 27 | }; 28 | class ZSummaryUI:public ZBaseUI 29 | { 30 | Q_OBJECT 31 | public: 32 | ZSummaryUI(); 33 | ~ZSummaryUI(); 34 | 35 | void ZDoInitial(); 36 | void ZUnInitial(); 37 | private slots: 38 | void ZSloShowAnotherOne(); 39 | signals: 40 | void ZSigDumpDbgMsg(QString msg); 41 | private: 42 | ZGLaserCurve* m_glaserCurve[8]; 43 | QStackedWidget *m_stackedWidget; 44 | QLabel *m_llGLaserNo; 45 | QToolButton *m_tbLeft; 46 | QToolButton *m_tbRight; 47 | QHBoxLayout *m_hLayoutBtn; 48 | QVBoxLayout *m_vLayout; 49 | qint32 m_index; 50 | }; 51 | 52 | #endif // ZSUMMARYUI_H 53 | -------------------------------------------------------------------------------- /ui/zsyssetupui.h: -------------------------------------------------------------------------------- 1 | #ifndef ZSYSSETUPUI_H 2 | #define ZSYSSETUPUI_H 3 | 4 | #include "base/zbaseui.h" 5 | #include "base/zpiechart.h" 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | class ZSysSetupUI : public ZBaseUI 15 | { 16 | Q_OBJECT 17 | public: 18 | ZSysSetupUI(); 19 | ~ZSysSetupUI(); 20 | 21 | void ZDoInitial(); 22 | void ZUnInitial(); 23 | protected: 24 | bool event(QEvent *e); 25 | signals: 26 | void ZSigDumpDbgMsg(QString msg); 27 | void ZSigPopupMsg(QString msg); 28 | signals: 29 | void ZSigRequestCmd(QString cmd,QString arguments); 30 | public slots: 31 | void ZSloResponseRTCCmd(QString cmd,QString arguments); 32 | private slots: 33 | void ZSloShowKeyboard(); 34 | void ZSloChangePassword(); 35 | void ZSloRestoreFactory(); 36 | void ZSloTimeout(); 37 | private: 38 | ZLabelLineEditCheckBox *m_llcCinemaName; 39 | ZLabelLineEditCheckBox *m_llcDevNo; 40 | ZLabelLineEditCheckBox *m_llcDateTime; 41 | ZLabelLineEditCheckBox *m_llcPLaserDateTime; 42 | QToolButton *m_tbChangePassword; 43 | QToolButton *m_tbRestoreFactory; 44 | QHBoxLayout *m_hLayoutBtn; 45 | 46 | ZPieChart *m_diskUsageChart; 47 | ZPieChart *m_logUsageChart; 48 | QHBoxLayout *m_hLayoutChart; 49 | 50 | QGridLayout *m_gLayout; 51 | QVBoxLayout *m_vLayout; 52 | 53 | QTimer *m_timer1s; 54 | //fixup for QWindow::isVisible()const. 55 | //?????? 56 | //QApplicationPrivate::notify_helper(QObject*,QEvent*); 57 | //QApplication::notify(QObject*,QEvent*) 58 | //g_main_context_dispatch. 59 | bool m_bProcessEvent; 60 | }; 61 | class ZChangePasswordDia:public QDialog 62 | { 63 | Q_OBJECT 64 | public: 65 | ZChangePasswordDia(QString title); 66 | ~ZChangePasswordDia(); 67 | QString ZGetNewPassword(); 68 | signals: 69 | void ZSigPopupMsg(QString msg); 70 | protected: 71 | bool eventFilter(QObject *watched, QEvent *event); 72 | private slots: 73 | void ZSloOkay(); 74 | void ZSloCancel(); 75 | private: 76 | QLabel *m_llTitle; 77 | QLabel *m_llOldPass; 78 | QLabel *m_llNewPass1; 79 | QLabel *m_llNewPass2; 80 | QLineEdit *m_leOldPass; 81 | QLineEdit *m_leNewPass1; 82 | QLineEdit *m_leNewPass2; 83 | QToolButton *m_tbOkay; 84 | QToolButton *m_tbCancel; 85 | QGridLayout *m_gLayout; 86 | QFrame *m_frm; 87 | QVBoxLayout *m_vLayout; 88 | }; 89 | class ZCountThread:public QThread 90 | { 91 | Q_OBJECT 92 | public: 93 | ZCountThread(qint32 sec); 94 | signals: 95 | void ZSigThreadDone(qint32 ret,QString errMsg); 96 | protected: 97 | void run(); 98 | private: 99 | qint32 m_sec; 100 | }; 101 | class ZRestorFactoryDia:public QDialog 102 | { 103 | Q_OBJECT 104 | public: 105 | ZRestorFactoryDia(QString title); 106 | ~ZRestorFactoryDia(); 107 | signals: 108 | void ZSigPopupMsg(QString msg); 109 | private slots: 110 | void ZSloOkay(); 111 | void ZSloCancel(); 112 | private: 113 | QLabel *m_llTitle; 114 | QLabel *m_llWarning; 115 | ZLabelLineEditCheckBox *m_lecPassword; 116 | QToolButton *m_tbOkay; 117 | QToolButton *m_tbCancel; 118 | QGridLayout *m_gLayout; 119 | QFrame *m_frm; 120 | QVBoxLayout *m_vLayout; 121 | }; 122 | #endif // ZSYSSETUPUI_H 123 | -------------------------------------------------------------------------------- /ui/ztextcombobox.cpp: -------------------------------------------------------------------------------- 1 | #include "ztextcombobox.h" 2 | 3 | ZTextComboBox::ZTextComboBox(QString text,QStringList itemList) 4 | { 5 | this->setObjectName("ZTextComboBox"); 6 | this->m_llText=new QLabel(text); 7 | this->m_llText->setObjectName("ZTextComboBoxLabel"); 8 | this->m_llText->setAlignment(Qt::AlignCenter); 9 | this->m_cb=new QComboBox; 10 | this->m_cb->setObjectName("ZTextComboBoxComboBox"); 11 | this->m_cb->addItems(itemList); 12 | this->m_hLayout=new QHBoxLayout; 13 | this->m_hLayout->addWidget(this->m_llText); 14 | this->m_hLayout->addWidget(this->m_cb); 15 | this->setLayout(this->m_hLayout); 16 | } 17 | ZTextComboBox::~ZTextComboBox() 18 | { 19 | delete this->m_llText; 20 | delete this->m_cb; 21 | delete this->m_hLayout; 22 | } 23 | -------------------------------------------------------------------------------- /ui/ztextcombobox.h: -------------------------------------------------------------------------------- 1 | #ifndef ZTEXTCOMBOBOX_H 2 | #define ZTEXTCOMBOBOX_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | class ZTextComboBox : public QFrame 9 | { 10 | public: 11 | ZTextComboBox(QString text,QStringList itemList); 12 | ~ZTextComboBox(); 13 | 14 | private: 15 | QLabel *m_llText; 16 | QComboBox *m_cb; 17 | QHBoxLayout *m_hLayout; 18 | }; 19 | 20 | #endif // ZTEXTCOMBOBOX_H 21 | -------------------------------------------------------------------------------- /ui/ztextimglabel.cpp: -------------------------------------------------------------------------------- 1 | #include "ztextimglabel.h" 2 | #include 3 | ZTextImgLabel::ZTextImgLabel(QString text) 4 | { 5 | this->setObjectName("TextImgFrame"); 6 | this->m_llText=new QLabel(text); 7 | this->m_llText->setObjectName("textImgLabel"); 8 | this->m_llText->setAlignment(Qt::AlignCenter); 9 | this->m_llText->installEventFilter(this); 10 | this->m_llImg=NULL; 11 | this->m_hLayout=new QHBoxLayout; 12 | this->m_hLayout->addWidget(this->m_llText); 13 | this->setLayout(this->m_hLayout); 14 | } 15 | ZTextImgLabel::ZTextImgLabel(QString text,QPixmap img) 16 | { 17 | this->setObjectName("TextImgFrame"); 18 | this->m_llText=new QLabel(text); 19 | this->m_llText->setObjectName("textImgLabel"); 20 | this->m_llText->setAlignment(Qt::AlignCenter); 21 | this->m_llText->installEventFilter(this); 22 | this->m_llImg=new QLabel; 23 | this->m_llImg->setObjectName("textImgLabel"); 24 | this->m_llImg->setPixmap(img.scaled(16,16)); 25 | this->m_llImg->setAlignment(Qt::AlignCenter); 26 | this->m_llImg->installEventFilter(this); 27 | this->m_hLayout=new QHBoxLayout; 28 | this->m_hLayout->addStretch(1); 29 | this->m_hLayout->addWidget(this->m_llText); 30 | this->m_hLayout->addWidget(this->m_llImg); 31 | this->m_hLayout->addStretch(1); 32 | this->setLayout(this->m_hLayout); 33 | } 34 | ZTextImgLabel::~ZTextImgLabel() 35 | { 36 | delete this->m_llText; 37 | if(this->m_llImg) 38 | { 39 | delete this->m_llImg; 40 | } 41 | delete this->m_hLayout; 42 | } 43 | void ZTextImgLabel::ZSetText(QString text) 44 | { 45 | this->m_llText->setText(text); 46 | } 47 | void ZTextImgLabel::ZSetPixmap(QPixmap img) 48 | { 49 | if(this->m_llImg) 50 | { 51 | this->m_llImg->setPixmap(img.scaled(16,16)); 52 | } 53 | } 54 | bool ZTextImgLabel::eventFilter(QObject *watched, QEvent *event) 55 | { 56 | if(event->type()==QEvent::MouseButtonPress) 57 | { 58 | if(watched==this->m_llText || watched==this->m_llImg) 59 | { 60 | emit this->ZSigClicked(); 61 | } 62 | } 63 | return QFrame::eventFilter(watched,event); 64 | } 65 | -------------------------------------------------------------------------------- /ui/ztextimglabel.h: -------------------------------------------------------------------------------- 1 | #ifndef ZTEXTIMGLABEL_H 2 | #define ZTEXTIMGLABEL_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | class ZTextImgLabel:public QFrame 9 | { 10 | Q_OBJECT 11 | public: 12 | ZTextImgLabel(QString text); 13 | ZTextImgLabel(QString text,QPixmap img); 14 | ~ZTextImgLabel(); 15 | 16 | void ZSetText(QString text); 17 | void ZSetPixmap(QPixmap img); 18 | signals: 19 | void ZSigClicked(); 20 | protected: 21 | bool eventFilter(QObject *watched, QEvent *event); 22 | private: 23 | QLabel *m_llText; 24 | QLabel *m_llImg; 25 | QHBoxLayout *m_hLayout; 26 | }; 27 | 28 | #endif // ZTEXTIMGLABEL_H 29 | -------------------------------------------------------------------------------- /ui/ztextlineeditlabel.cpp: -------------------------------------------------------------------------------- 1 | #include "ztextlineeditlabel.h" 2 | #include 3 | ZTextLineEditLabel::ZTextLineEditLabel(QString tipMsg,QString data,Qt::Orientation orien) 4 | { 5 | this->m_orien=orien; 6 | 7 | this->setObjectName("TextLineEditFrame"); 8 | this->m_llTips=new QLabel; 9 | this->m_llTips->setObjectName("TextLineEditFrameLabel"); 10 | this->m_llTips->setAlignment(Qt::AlignCenter); 11 | this->m_llTips->setText(tipMsg); 12 | this->m_leData=new QLineEdit; 13 | this->m_leData->setAlignment(Qt::AlignCenter); 14 | this->m_leData->setFocusPolicy(Qt::NoFocus); 15 | this->m_leData->setText(data); 16 | this->m_leData->installEventFilter(this); 17 | this->m_leData2=NULL; 18 | this->m_llImg=NULL; 19 | 20 | if(this->m_orien==Qt::Horizontal) 21 | { 22 | this->m_hLayout=new QHBoxLayout; 23 | this->m_hLayout->addWidget(this->m_llTips); 24 | this->m_hLayout->addWidget(this->m_leData); 25 | this->setLayout(this->m_hLayout); 26 | }else if(this->m_orien==Qt::Vertical) 27 | { 28 | this->m_vLayout=new QVBoxLayout; 29 | this->m_vLayout->addWidget(this->m_llTips); 30 | this->m_vLayout->addWidget(this->m_leData); 31 | this->setLayout(this->m_vLayout); 32 | } 33 | } 34 | 35 | ZTextLineEditLabel::ZTextLineEditLabel(QString tipMsg,QString data1,QString data2,QPixmap img,Qt::Orientation orien) 36 | { 37 | this->setObjectName("TextLineEditFrame"); 38 | this->m_llTips=new QLabel; 39 | this->m_llTips->setObjectName("TextLineEditFrameLabel"); 40 | this->m_llTips->setAlignment(Qt::AlignCenter); 41 | this->m_llTips->setText(tipMsg); 42 | this->m_leData=new QLineEdit; 43 | this->m_leData->setAlignment(Qt::AlignCenter); 44 | this->m_leData->setFocusPolicy(Qt::NoFocus); 45 | this->m_leData->setText(data1); 46 | this->m_leData->installEventFilter(this); 47 | 48 | this->m_leData2=new QLineEdit; 49 | this->m_leData2->setAlignment(Qt::AlignCenter); 50 | this->m_leData2->setFocusPolicy(Qt::NoFocus); 51 | this->m_leData2->setText(data2); 52 | 53 | this->m_llImg=new QLabel; 54 | this->m_llImg->setPixmap(img.scaled(16,16)); 55 | 56 | this->m_hLayout=new QHBoxLayout; 57 | this->m_hLayout->addWidget(this->m_llTips); 58 | this->m_hLayout->addWidget(this->m_leData); 59 | this->m_hLayout->addWidget(this->m_leData2); 60 | this->m_hLayout->addWidget(this->m_llImg); 61 | this->setLayout(this->m_hLayout); 62 | } 63 | ZTextLineEditLabel::~ZTextLineEditLabel() 64 | { 65 | if(this->m_llTips) 66 | { 67 | delete this->m_llTips; 68 | } 69 | if(this->m_leData) 70 | { 71 | delete this->m_leData; 72 | } 73 | if(this->m_leData2) 74 | { 75 | delete this->m_leData2; 76 | } 77 | if(this->m_llImg) 78 | { 79 | delete this->m_llImg; 80 | } 81 | if(this->m_orien==Qt::Horizontal) 82 | { 83 | delete this->m_hLayout; 84 | }else if(this->m_orien==Qt::Vertical) 85 | { 86 | delete this->m_vLayout; 87 | } 88 | } 89 | 90 | void ZTextLineEditLabel::ZSetTips(QString tipMsg) 91 | { 92 | this->m_llTips->setText(tipMsg); 93 | } 94 | void ZTextLineEditLabel::ZSetLineEdit(QString data) 95 | { 96 | this->m_leData->setText(data); 97 | } 98 | void ZTextLineEditLabel::ZSetLineEdit2(QString data) 99 | { 100 | this->m_leData2->setText(data); 101 | } 102 | QString ZTextLineEditLabel::ZGetLineEdit() 103 | { 104 | return this->m_leData->text(); 105 | } 106 | QString ZTextLineEditLabel::ZGetLineEdit2() 107 | { 108 | return this->m_leData2->text(); 109 | } 110 | 111 | void ZTextLineEditLabel::ZSetImg(QPixmap img) 112 | { 113 | this->m_llImg->setPixmap(img.scaled(16,16)); 114 | } 115 | void ZTextLineEditLabel::ZSetBackgroundColor2Error() 116 | { 117 | QString qss("QLineEdit{" 118 | "border-radius: 4px;" 119 | "height: 25px;" 120 | "border: 1px solid rgb(100, 100, 100);" 121 | "background: rgb(200,0,0);" 122 | "color:white;" 123 | "}"); 124 | if(this->m_leData!=NULL) 125 | { 126 | this->m_leData->setStyleSheet(qss); 127 | } 128 | if(this->m_leData2!=NULL) 129 | { 130 | this->m_leData2->setStyleSheet(qss); 131 | } 132 | } 133 | void ZTextLineEditLabel::ZSetBackgroundColor2Normal() 134 | { 135 | QString qss("QLineEdit{" 136 | "border-radius: 4px;" 137 | "height: 25px;" 138 | "border: 1px solid rgb(100, 100, 100);" 139 | "background: rgb(102,138,115);" 140 | "color:white;" 141 | "}"); 142 | if(this->m_leData!=NULL) 143 | { 144 | this->m_leData->setStyleSheet(qss); 145 | } 146 | if(this->m_leData2!=NULL) 147 | { 148 | this->m_leData2->setStyleSheet(qss); 149 | } 150 | } 151 | bool ZTextLineEditLabel::eventFilter(QObject *watched, QEvent *event) 152 | { 153 | if(event->type()==QEvent::MouseButtonPress) 154 | { 155 | if(watched==this->m_leData) 156 | { 157 | emit this->ZSigClicked(); 158 | } 159 | } 160 | return QFrame::eventFilter(watched,event); 161 | } 162 | -------------------------------------------------------------------------------- /ui/ztextlineeditlabel.h: -------------------------------------------------------------------------------- 1 | #ifndef ZTEXTLINEEDITLABEL_H 2 | #define ZTEXTLINEEDITLABEL_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | class ZTextLineEditLabel : public QFrame 9 | { 10 | Q_OBJECT 11 | public: 12 | ZTextLineEditLabel(QString tipMsg,QString data,Qt::Orientation orien=Qt::Horizontal); 13 | ZTextLineEditLabel(QString tipMsg,QString data1,QString data2,QPixmap img,Qt::Orientation orien=Qt::Horizontal); 14 | ~ZTextLineEditLabel(); 15 | 16 | void ZSetTips(QString tipMsg); 17 | void ZSetLineEdit(QString data); 18 | void ZSetLineEdit2(QString data); 19 | void ZSetImg(QPixmap img); 20 | 21 | QString ZGetLineEdit(); 22 | QString ZGetLineEdit2(); 23 | 24 | void ZSetBackgroundColor2Error(); 25 | void ZSetBackgroundColor2Normal(); 26 | protected: 27 | bool eventFilter(QObject *watched, QEvent *event); 28 | signals: 29 | void ZSigClicked(); 30 | private: 31 | QLabel *m_llTips; 32 | QLineEdit *m_leData; 33 | QLineEdit *m_leData2; 34 | QLabel *m_llImg; 35 | QHBoxLayout *m_hLayout; 36 | QVBoxLayout *m_vLayout; 37 | Qt::Orientation m_orien; 38 | }; 39 | 40 | #endif // ZTEXTLINEEDITLABEL_H 41 | -------------------------------------------------------------------------------- /ui/ztopbar.h: -------------------------------------------------------------------------------- 1 | #ifndef ZTOPBAR_H 2 | #define ZTOPBAR_H 3 | 4 | #include "ui/zbarui.h" 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | class ZGblErrMsgDia:public QDialog 14 | { 15 | Q_OBJECT 16 | public: 17 | ZGblErrMsgDia(); 18 | ~ZGblErrMsgDia(); 19 | private slots: 20 | void ZSlotClose(); 21 | void ZSlotClear(); 22 | void ZSlotUpdateErrList(); 23 | void ZSlotShowDetailErrList(QModelIndex index); 24 | private: 25 | void ZFunCommunicateErrList(); 26 | void ZFunChillerErrList(qint32 index); 27 | void ZFunGLaserErrList(qint32 index); 28 | void ZFunStorageErrList(); 29 | void ZFunNetworkErrList(); 30 | 31 | private: 32 | QLabel *m_llTitle; 33 | QListWidget *m_lstItem; 34 | QListWidget *m_lstMsg; 35 | QHBoxLayout *m_hLayoutList; 36 | 37 | QToolButton *m_tbClear; 38 | QToolButton *m_tbClose; 39 | QHBoxLayout *m_hLayout; 40 | QVBoxLayout *m_vLayout; 41 | QFrame *m_frm; 42 | QVBoxLayout *m_vLayoutFrm; 43 | 44 | QTimer *m_timer; 45 | }; 46 | class ZTopBar : public ZBarUI 47 | { 48 | Q_OBJECT 49 | public: 50 | 51 | ZTopBar(); 52 | ~ZTopBar(); 53 | 54 | void ZDoInitial(); 55 | void ZUnInitial(); 56 | signals: 57 | void ZSigDumpDbgMsg(QString msg); 58 | void ZSigShowGblErrDialog(); 59 | signals: 60 | void ZSigRequestCmd(QString cmd,QString arguments); 61 | void ZSigPopupMsg(QString msg); 62 | 63 | protected: 64 | bool eventFilter(QObject *watched, QEvent *event); 65 | public slots: 66 | void ZSloUptPageName(QString pageName); 67 | void ZSloResponseCmdHB(QString arguments); 68 | private slots: 69 | void ZSloUptTick(void); 70 | void ZSloShowGblErrDialog(); 71 | private: 72 | void ZResetRandomNum(); 73 | void ZPopupMsgAddGblErrMsgList(QString errMsg); 74 | private: 75 | QLabel *m_llCinemaName; 76 | QLabel *m_llDeviceNo; 77 | QLabel *m_llPageName; 78 | QLabel *m_llSysTime; 79 | QLabel *m_llHeartBeat; 80 | QLabel *m_llGblErr; 81 | 82 | QTimer *m_tmTick; 83 | qint32 m_nHBIndex; 84 | qint32 m_nHBTick; 85 | qint32 m_nHBRandNum; 86 | 87 | //global error indicator flash flag. 88 | qint8 m_nGblErrFlag; 89 | 90 | //fixup for QWindow::isVisible(). 91 | bool m_bProcessEvent; 92 | }; 93 | 94 | #endif // ZTOPBAR_H 95 | -------------------------------------------------------------------------------- /ui/zupdatewizarddialog.h: -------------------------------------------------------------------------------- 1 | #ifndef ZUPDATEWIZARDDIALOG_H 2 | #define ZUPDATEWIZARDDIALOG_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | class ZUpdateThread:public QThread 14 | { 15 | Q_OBJECT 16 | public: 17 | ZUpdateThread(); 18 | ~ZUpdateThread(); 19 | void ZSetUDiskNodeName(QString udiskNodeName); 20 | signals: 21 | void ZSigUpdateFinished(qint32 ret,QString msg); 22 | void ZSigUpdateProgress(qint32 progress); 23 | protected: 24 | void run(); 25 | private: 26 | QString ZGetFileMd5(QString fileName); 27 | private: 28 | QString m_udiskNode; 29 | }; 30 | class ZUpdateWizardDialog:public QDialog 31 | { 32 | Q_OBJECT 33 | public: 34 | ZUpdateWizardDialog(); 35 | ~ZUpdateWizardDialog(); 36 | signals: 37 | void ZSigUpdateFinished(qint32 ret,QString msg); 38 | private slots: 39 | void ZSlotUpdateFinished(qint32 ret,QString msg); 40 | void ZSlotUpdateProgress(qint32 progress); 41 | void ZSlotStart(); 42 | void ZSlotStop(); 43 | private: 44 | QLabel *m_llUpdateNote; 45 | QLabel *m_llUpdateStep; 46 | QLabel *m_llUpdateWarning; 47 | QLabel *m_llCurrent; 48 | QProgressBar *m_progressBar; 49 | QToolButton *m_tbStart; 50 | QToolButton *m_tbStop; 51 | QGridLayout *m_gLayout; 52 | QFrame *m_frm; 53 | QVBoxLayout *m_vLayout; 54 | ZUpdateThread *m_thread; 55 | }; 56 | 57 | class ZUDiskSelectDia:public QDialog 58 | { 59 | Q_OBJECT 60 | public: 61 | ZUDiskSelectDia(QString title,QStringList udiskNodeList); 62 | ~ZUDiskSelectDia(); 63 | QString ZGetUDiskName(); 64 | private slots: 65 | void ZSlotSelectUDisk(); 66 | private: 67 | QLabel *m_llTitle; 68 | QListWidget *m_listWidet; 69 | QVBoxLayout *m_vLayoutFrm; 70 | QFrame *m_fram; 71 | QVBoxLayout *m_vLayout; 72 | }; 73 | #endif // ZUPDATEWIZARDDIALOG_H 74 | -------------------------------------------------------------------------------- /ui/zverticalindicator.cpp: -------------------------------------------------------------------------------- 1 | #include "zverticalindicator.h" 2 | #include 3 | ZVerticalIndicator::ZVerticalIndicator(QWidget *parent) : 4 | QWidget(parent) 5 | { 6 | this->initVariables(); 7 | } 8 | 9 | void ZVerticalIndicator::initVariables() 10 | { 11 | m_markClr=Qt::white; 12 | graphcolor=Qt::darkGreen; 13 | m_value=0; 14 | m_currentValue=0; 15 | m_bucketWidth=width()/3; 16 | m_markSpace=(float)width()/4; 17 | m_topSpace=(float)height()/15; 18 | updateTimer=new QTimer(this); 19 | updateTimer->setInterval(10); 20 | connect(updateTimer,SIGNAL(timeout()),this,SLOT(UpdateGraph())); 21 | m_bReverse=false; 22 | } 23 | 24 | void ZVerticalIndicator::paintEvent(QPaintEvent *e) 25 | { 26 | QPainter painter; 27 | painter.begin(this); 28 | painter.setRenderHints(QPainter::TextAntialiasing|QPainter::Antialiasing); 29 | resetDrawingVariables(&painter); 30 | drawBackground(&painter); 31 | drawMark(&painter); 32 | drawBucket(&painter); 33 | drawGraph(&painter); 34 | 35 | painter.end(); 36 | } 37 | 38 | void ZVerticalIndicator::drawBackground(QPainter *painter) 39 | { 40 | painter->save(); 41 | 42 | QLinearGradient bgGradient(QPointF(0,0),QPointF(0,height())); 43 | bgGradient.setColorAt(0.0,QColor(200,200,200)); 44 | bgGradient.setColorAt(0.2,QColor(100,100,100)); 45 | bgGradient.setColorAt(0.9,QColor(100,100,100)); 46 | bgGradient.setColorAt(1.0,QColor(200,200,200)); 47 | 48 | painter->setBrush(bgGradient); 49 | painter->drawRect(rect()); 50 | painter->restore(); 51 | } 52 | void ZVerticalIndicator::drawMark(QPainter *painter) 53 | { 54 | painter->save(); 55 | 56 | float initY=m_topSpace; 57 | float initX=m_markSpace; 58 | float length=height()-2*m_topSpace; 59 | float increment=length/100; 60 | painter->setPen(m_markClr); 61 | 62 | // draw vertical line 63 | QPointF topPot(m_markSpace,m_topSpace); 64 | QPointF bottomPot(m_markSpace,height()-m_topSpace); 65 | painter->drawLine(topPot,bottomPot); 66 | 67 | int vvalue=100; 68 | QString strValue; 69 | for(int i=0;i<=100;i++) 70 | { 71 | if(i%10==0) 72 | { 73 | QPointF leftPot(initX+LONG3,initY); 74 | QPointF rightPot(initX,initY); 75 | painter->drawLine(leftPot,rightPot); 76 | 77 | strValue=tr("%1").arg(vvalue); 78 | float fontWidth=painter->fontMetrics().width(strValue); 79 | float fontHeight=painter->fontMetrics().height(); 80 | 81 | QPointF textPot(initX-fontWidth-5,initY+fontHeight/2); 82 | painter->drawText(textPot,strValue); 83 | 84 | vvalue-=10; 85 | 86 | } 87 | else if(i%5==0 && i%10!=0) 88 | { 89 | QPointF leftPot(initX+OK3,initY); 90 | QPointF rightPot(initX,initY); 91 | painter->drawLine(leftPot,rightPot); 92 | } 93 | else 94 | { 95 | QPointF leftPot(initX+SHORT3,initY); 96 | QPointF rightPot(initX,initY); 97 | painter->drawLine(leftPot,rightPot); 98 | } 99 | initY+=increment; 100 | } 101 | painter->restore(); 102 | } 103 | 104 | void ZVerticalIndicator::SetGraphColor(QColor c) 105 | { 106 | this->graphcolor=c; 107 | } 108 | 109 | 110 | void ZVerticalIndicator::drawGraph(QPainter *painter) 111 | { 112 | painter->save(); 113 | qreal bucketHeight=m_bucketRect.height(); 114 | qreal increment=(float)bucketHeight/100; 115 | 116 | QPointF bottomRightPot(m_bucketRect.bottomRight()); 117 | qreal currentY=m_currentValue*increment; 118 | 119 | QPointF topLeftPot(m_bucketRect.topLeft().x(),m_bucketRect.bottomLeft().y()-currentY); 120 | QRectF graphRect(topLeftPot,bottomRightPot); 121 | painter->setPen(Qt::NoPen); 122 | 123 | QLinearGradient graphGradient(graphRect.topLeft(),graphRect.topRight()); 124 | painter->setOpacity(0.7); 125 | 126 | graphGradient.setColorAt(0.0,this->graphcolor); 127 | 128 | painter->setBrush(graphGradient); 129 | painter->drawRect(graphRect); 130 | painter->restore(); 131 | 132 | painter->save(); 133 | painter->setPen(Qt::black); 134 | QString text=QString::number(this->m_value,'f',2)+QString("%"); 135 | qint32 textWidth=painter->fontMetrics().width(text); 136 | qint32 textHeight=painter->fontMetrics().height(); 137 | QPoint textLeftTop(topLeftPot.x()+(graphRect.width()-textWidth)/2,topLeftPot.y()); 138 | QPoint textRightBottom(topLeftPot.x()+graphRect.width()/2+textWidth/2,topLeftPot.y()+textHeight); 139 | QRectF textRect(textLeftTop,textRightBottom); 140 | painter->drawText(textRect,text); 141 | painter->restore(); 142 | } 143 | 144 | void ZVerticalIndicator::drawBucket(QPainter *painter) 145 | { 146 | painter->save(); 147 | 148 | QPointF bucketTopLeftPot(m_markSpace+MARK_BUCKET_SPACE3,m_topSpace); 149 | QPointF bucketBottomRightPot(m_markSpace+MARK_BUCKET_SPACE3+m_bucketWidth,height()-m_topSpace); 150 | QRectF bucketRect(bucketTopLeftPot,bucketBottomRightPot); 151 | m_bucketRect=bucketRect; 152 | 153 | QLinearGradient bucketGradient(bucketRect.topLeft(),bucketRect.topRight()); 154 | bucketGradient.setColorAt(0.0,QColor(100,100,100)); 155 | bucketGradient.setColorAt(0.6,QColor(200,200,200)); 156 | bucketGradient.setColorAt(1.0,QColor(150,150,150)); 157 | 158 | painter->setPen(Qt::NoPen); 159 | painter->setBrush(bucketGradient); 160 | painter->drawRect(bucketRect); 161 | painter->restore(); 162 | } 163 | 164 | void ZVerticalIndicator::resetDrawingVariables(QPainter *painter) 165 | { 166 | m_markSpace=(float)width()/4; 167 | m_bucketWidth=(float)width()/3; 168 | m_topSpace=(float)height()/15; 169 | } 170 | 171 | float ZVerticalIndicator::getValue() 172 | { 173 | return this->m_value; 174 | } 175 | void ZVerticalIndicator::setValue(float value) 176 | { 177 | if(value>m_value) 178 | { 179 | m_bReverse=false; 180 | } 181 | else if(valueupdateTimer->isActive()) 191 | { 192 | this->updateTimer->stop(); 193 | } 194 | updateTimer->start(); 195 | } 196 | 197 | void ZVerticalIndicator::setMarkColor(const QColor &clr) 198 | { 199 | m_markClr=clr; 200 | update(); 201 | } 202 | 203 | 204 | void ZVerticalIndicator::UpdateGraph() 205 | { 206 | if(!m_bReverse) 207 | { 208 | m_currentValue+=0.5; 209 | if(m_currentValue>=m_value) 210 | { 211 | updateTimer->stop(); 212 | } 213 | } 214 | else 215 | { 216 | m_currentValue-=0.5; 217 | if(m_currentValue<=m_value) 218 | { 219 | updateTimer->stop(); 220 | } 221 | } 222 | update(); 223 | } 224 | -------------------------------------------------------------------------------- /ui/zverticalindicator.h: -------------------------------------------------------------------------------- 1 | #ifndef ZVERTICALINDICATOR_H 2 | #define ZVERTICALINDICATOR_H 3 | 4 | #define LONG3 7 5 | #define OK3 5 6 | #define SHORT3 3 7 | #define MARK_BUCKET_SPACE3 20 8 | 9 | #include 10 | #include 11 | 12 | class ZVerticalIndicator : public QWidget 13 | { 14 | Q_OBJECT 15 | public: 16 | explicit ZVerticalIndicator(QWidget *parent = 0); 17 | 18 | void SetGraphColor(QColor c); 19 | 20 | protected: 21 | void paintEvent(QPaintEvent *); 22 | QSize sizeHint() const 23 | { 24 | return QSize(150,300); 25 | } 26 | 27 | QSize minimumSizeHint() const 28 | { 29 | return QSize(50,100); 30 | } 31 | 32 | private: 33 | void drawMark(QPainter* painter); 34 | void drawBucket(QPainter* painter); 35 | void drawBackground(QPainter* painter); 36 | void drawGraph(QPainter* painter); 37 | void resetDrawingVariables(QPainter* painter); 38 | 39 | private: 40 | float m_value; 41 | float m_currentValue; 42 | float m_bucketWidth; 43 | QTimer* updateTimer; 44 | bool m_bReverse; 45 | float m_markSpace; 46 | float m_topSpace; 47 | QColor m_markClr; 48 | QColor graphcolor; 49 | QRectF m_bucketRect; 50 | 51 | private: 52 | void initVariables(); 53 | 54 | private slots: 55 | void UpdateGraph(); 56 | 57 | public slots: 58 | void setValue(float value); 59 | float getValue(); 60 | void setMarkColor(const QColor& clr); 61 | 62 | }; 63 | #endif // ZVERTICALINDICATOR_H 64 | -------------------------------------------------------------------------------- /ui/zvslider.cpp: -------------------------------------------------------------------------------- 1 | #include "zvslider.h" 2 | #include 3 | ZVSlider::ZVSlider(QString title) 4 | { 5 | // this->setObjectName("ZVSlider"); 6 | // this->m_llTitle=new QLabel(title); 7 | // this->m_llVal=new QLabel(tr("0℃")); 8 | // this->m_llVal->setObjectName("ZVSliderValLabel"); 9 | // this->m_llVal->setAlignment(Qt::AlignCenter); 10 | // this->m_llMax=new QLabel(tr("+150℃")); 11 | // this->m_llMax->setAlignment(Qt::AlignCenter); 12 | // this->m_llMin=new QLabel(tr("-20℃")); 13 | // this->m_llMin->setAlignment(Qt::AlignCenter); 14 | // this->m_slider=new QSlider(Qt::Vertical); 15 | // this->m_slider->setObjectName("ZVSliderQSlider"); 16 | // this->m_slider->setRange(-20,150); 17 | // this->m_slider->setValue(0); 18 | // this->m_slider->setDisabled(true); 19 | 20 | // this->m_llTitle->setObjectName("ZVSliderTipsLabel"); 21 | // this->m_llMax->setObjectName("ZVSliderTipsLabel"); 22 | // this->m_llMin->setObjectName("ZVSliderTipsLabel"); 23 | // this->m_gLayout=new QGridLayout; 24 | // this->m_gLayout->addWidget(this->m_llTitle,0,0,1,1); 25 | // this->m_gLayout->addWidget(this->m_llMax,0,1,1,1); 26 | // this->m_gLayout->addWidget(this->m_slider,1,1,1,1); 27 | // this->m_gLayout->addWidget(this->m_llMin,2,1,1,1); 28 | // this->m_gLayout->addWidget(this->m_llVal,1,0,2,1); 29 | // this->m_gLayout->setColumnStretch(0,7); 30 | // this->m_gLayout->setColumnStretch(1,3); 31 | // this->setLayout(this->m_gLayout); 32 | } 33 | ZVSlider::~ZVSlider() 34 | { 35 | // delete this->m_llTitle; 36 | // delete this->m_llVal; 37 | // delete this->m_llMin; 38 | // delete this->m_llMax; 39 | // delete this->m_slider; 40 | // delete this->m_gLayout; 41 | } 42 | void ZVSlider::ZSetValue(qreal val) 43 | { 44 | // this->m_llVal->setText(QString("%1").arg(val)); 45 | // this->m_slider->setValue((qint32)val); 46 | } 47 | void ZVSlider::paintEvent(QPaintEvent *event) 48 | { 49 | QPainter painter(this); 50 | qint32 tSubWidth=(this->width()-10)/3; 51 | qint32 tSubHeight=(this->height()-50)/2; 52 | QRect rect1; 53 | rect1.setX(this->x()+tSubWidth); 54 | rect1.setY(10); 55 | rect1.setWidth(tSubWidth); 56 | rect1.setHeight(tSubHeight); 57 | painter.fillRect(rect1,Qt::blue); 58 | 59 | QRect rect2; 60 | rect2.setX(10); 61 | rect2.setY(this->y()+this->height()/2); 62 | rect2.setWidth(this->width()-10); 63 | rect2.setHeight(tSubHeight); 64 | painter.drawEllipse(rect2); 65 | 66 | // QPainterPath path1; 67 | // path1.addPolygon(); 68 | } 69 | -------------------------------------------------------------------------------- /ui/zvslider.h: -------------------------------------------------------------------------------- 1 | #ifndef ZVSLIDER_H 2 | #define ZVSLIDER_H 3 | 4 | #include 5 | #include 6 | #include 7 | class ZVSlider : public QFrame 8 | { 9 | public: 10 | ZVSlider(QString title); 11 | ~ZVSlider(); 12 | void ZSetValue(qreal val); 13 | protected: 14 | void paintEvent(QPaintEvent *event); 15 | private: 16 | QLabel *m_llTitle; 17 | QLabel *m_llVal; 18 | QLabel *m_llMin; 19 | QLabel *m_llMax; 20 | QSlider *m_slider; 21 | QGridLayout *m_gLayout; 22 | }; 23 | 24 | #endif // ZVSLIDER_H 25 | -------------------------------------------------------------------------------- /ui/zwaitingdialog.cpp: -------------------------------------------------------------------------------- 1 | #include "zwaitingdialog.h" 2 | 3 | ZWaitingDialog::ZWaitingDialog(QString title) 4 | { 5 | this->setWindowFlags(Qt::FramelessWindowHint); 6 | 7 | this->m_llTitle=new QLabel; 8 | this->m_llTitle->setObjectName("ZWaitingDialogLabel"); 9 | this->m_llTitle->setText(title); 10 | this->m_tbOkay=new QToolButton; 11 | this->m_tbOkay->setObjectName("ZWaitingDialogButton"); 12 | this->m_tbOkay->setText(tr("确认")); 13 | this->m_tbOkay->setVisible(false); 14 | 15 | this->m_vLayout=new QVBoxLayout; 16 | this->m_vLayout->addWidget(this->m_llTitle); 17 | this->m_vLayout->addWidget(this->m_tbOkay); 18 | this->m_vLayout->setContentsMargins(0,0,0,0); 19 | this->setLayout(this->m_vLayout); 20 | 21 | connect(this->m_tbOkay,SIGNAL(clicked(bool)),this,SLOT(accept())); 22 | } 23 | ZWaitingDialog::~ZWaitingDialog() 24 | { 25 | delete this->m_llTitle; 26 | delete this->m_tbOkay; 27 | delete this->m_vLayout; 28 | } 29 | void ZWaitingDialog::ZSloClose(qint32 retCode,QString errMsg) 30 | { 31 | if(0==retCode) 32 | { 33 | this->accept(); 34 | return; 35 | } 36 | this->m_llTitle->setText(errMsg); 37 | this->m_tbOkay->setVisible(true); 38 | } 39 | -------------------------------------------------------------------------------- /ui/zwaitingdialog.h: -------------------------------------------------------------------------------- 1 | #ifndef ZWAITINGDIALOG_H 2 | #define ZWAITINGDIALOG_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | class ZWaitingDialog : public QDialog 9 | { 10 | Q_OBJECT 11 | public: 12 | ZWaitingDialog(QString title); 13 | ~ZWaitingDialog(); 14 | public slots: 15 | void ZSloClose(qint32 retCode,QString errMsg); 16 | private: 17 | QLabel *m_llTitle; 18 | QToolButton *m_tbOkay; 19 | QVBoxLayout *m_vLayout; 20 | }; 21 | 22 | #endif // ZWAITINGDIALOG_H 23 | -------------------------------------------------------------------------------- /ui/zwarningtipsdialog.cpp: -------------------------------------------------------------------------------- 1 | #include "zwarningtipsdialog.h" 2 | 3 | ZWarningTipsDialog::ZWarningTipsDialog(QString title,QString tipsMsg) 4 | { 5 | this->setWindowFlags(Qt::FramelessWindowHint); 6 | this->setMinimumSize(300,200); 7 | 8 | this->m_llTitle=new QLabel; 9 | this->m_llTitle->setText(title); 10 | this->m_llTitle->setAlignment(Qt::AlignCenter); 11 | this->m_llTitle->setObjectName("ZWarningTipsDialogTitle"); 12 | 13 | this->m_llTipsMsg=new QLabel; 14 | this->m_llTipsMsg->setText(tipsMsg); 15 | this->m_llTipsMsg->setAlignment(Qt::AlignCenter); 16 | this->m_llTipsMsg->setObjectName("ZWarningTipsDialogTipsMsg"); 17 | 18 | this->m_tbOkay=new QToolButton; 19 | this->m_tbOkay->setText(tr("确认")); 20 | this->m_tbOkay->setObjectName("ZWarningTipsDialogOkay"); 21 | connect(this->m_tbOkay,SIGNAL(clicked(bool)),this,SLOT(accept())); 22 | 23 | this->m_vLayoutFrm=new QVBoxLayout; 24 | this->m_vLayoutFrm->addWidget(this->m_llTitle,1,Qt::AlignCenter); 25 | this->m_vLayoutFrm->addWidget(this->m_llTipsMsg,1,Qt::AlignCenter); 26 | this->m_vLayoutFrm->addWidget(this->m_tbOkay,0,Qt::AlignRight); 27 | 28 | this->m_frm=new QFrame; 29 | this->m_frm->setObjectName("ZWarningTipsDialog"); 30 | this->m_frm->setLayout(this->m_vLayoutFrm); 31 | 32 | this->m_vLayout=new QVBoxLayout; 33 | this->m_vLayout->setContentsMargins(0,0,0,0); 34 | this->m_vLayout->addWidget(this->m_frm); 35 | this->setLayout(this->m_vLayout); 36 | } 37 | ZWarningTipsDialog::~ZWarningTipsDialog() 38 | { 39 | delete this->m_llTitle; 40 | delete this->m_llTipsMsg; 41 | delete this->m_tbOkay; 42 | delete this->m_vLayoutFrm; 43 | delete this->m_frm; 44 | delete this->m_vLayout; 45 | } 46 | -------------------------------------------------------------------------------- /ui/zwarningtipsdialog.h: -------------------------------------------------------------------------------- 1 | #ifndef ZWARNINGTIPSDIALOG_H 2 | #define ZWARNINGTIPSDIALOG_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | class ZWarningTipsDialog : public QDialog 10 | { 11 | Q_OBJECT 12 | public: 13 | ZWarningTipsDialog(QString title,QString tipsMsg); 14 | ~ZWarningTipsDialog(); 15 | private: 16 | QLabel *m_llTitle; 17 | QLabel *m_llTipsMsg; 18 | QToolButton *m_tbOkay; 19 | QFrame *m_frm; 20 | QVBoxLayout *m_vLayoutFrm; 21 | QVBoxLayout *m_vLayout; 22 | }; 23 | 24 | #endif // ZWARNINGTIPSDIALOG_H 25 | -------------------------------------------------------------------------------- /upload2hmi.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | sshpass -p yantai scp /home/shell.albert/CAMC/build-LaserHMI-Desktop_Qt_5_8_0_GCC_64bit_c4b0bc-Debug/LaserHMI root@192.168.1.8:/HMI/LaserHMI 3 | --------------------------------------------------------------------------------