diff --git a/LedOK/Demos/Demo Picture.png b/LedOK/Demos/Demo Picture.png new file mode 100644 index 0000000..c99d7e4 Binary files /dev/null and b/LedOK/Demos/Demo Picture.png differ diff --git a/LedOK/Demos/Demo Video 4K.mp4 b/LedOK/Demos/Demo Video 4K.mp4 new file mode 100644 index 0000000..55c018d Binary files /dev/null and b/LedOK/Demos/Demo Video 4K.mp4 differ diff --git a/LedOK/Demos/Demo Video 720p.mp4 b/LedOK/Demos/Demo Video 720p.mp4 new file mode 100644 index 0000000..9c7344a Binary files /dev/null and b/LedOK/Demos/Demo Video 720p.mp4 differ diff --git a/LedOK/LedOK.pro b/LedOK/LedOK Express.pro similarity index 87% rename from LedOK/LedOK.pro rename to LedOK/LedOK Express.pro index f73c6d7..83760bc 100644 --- a/LedOK/LedOK.pro +++ b/LedOK/LedOK Express.pro @@ -1,242 +1,244 @@ -QT += core gui widgets -QT += multimedia -QT += network -QT += concurrent -QT += serialport -QT += opengl -QT += webenginewidgets -greaterThan(QT_MAJOR_VERSION, 5) { - QT += openglwidgets -} -CONFIG += c++17 -CONFIG += lrelease -CONFIG += embed_translations - -# CONFIG += console - -# You can also make your code fail to compile if you use deprecated APIs. -# In order to do so, uncomment the following line. -# You can also select to disable deprecated APIs only up to a certain version of Qt. -#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 - -TARGET = $$quote(LedOK Express) -VERSION = 1.4.1 -DEFINES += APP_VERSION=\\\"$$VERSION\\\" -msvc { - contains(QT_ARCH, i386) { - QMAKE_LFLAGS += /LARGEADDRESSAWARE - #QMAKE_LFLAGS += -Wl,--large-address-aware - } - lessThan(QT_MAJOR_VERSION, 6) { - QMAKE_CXXFLAGS += -execution-charset:utf-8 - QMAKE_CXXFLAGS += -source-charset:utf-8 - } - - CONFIG += force_debug_info - CONFIG += separate_debug_info -} -win32 { - CONFIG -= debug_and_release - LIBS += -lwinmm - LIBS += -lDbghelp - - RC_ICONS = res/Logo.ico -} -osx { - ICON = res/Logo-raw.png -} - - -copydir.files += AClock -copydir.files += borders -copydir.files += translations -copydir.files += $$quote(y50 param) -copydir.files += $$quote(files) - -win32 { - EXE_SUFFIX = .exe - - copy.files += $$files(ffmpeg/bin/*.dll) - copy.files += 7z/7z.dll - copy.files += 7z/7z.exe - copy.files += $$files(OpenSSL/*.dll) # for https requests - - copy.path = $$OUT_PWD - copydir.path = $$OUT_PWD - CONFIG += file_copies - COPIES += copy - COPIES += copydir -} -osx { - DIR_SUFFIX = -mac - - copy.path = Contents/MacOS - copydir.path = Contents/MacOS - QMAKE_BUNDLE_DATA += copy - QMAKE_BUNDLE_DATA += copydir -} -copy.files += ffmpeg$$DIR_SUFFIX/bin/ffmpeg$$EXE_SUFFIX - -INCLUDEPATH += $$PWD/ffmpeg$$DIR_SUFFIX/include -LIBS += -L$$PWD/ffmpeg$$DIR_SUFFIX/lib/\ - -lavcodec \ - -lavdevice \ - -lavfilter \ - -lavformat \ - -lavutil \ - -lswresample \ - -lswscale - -# Default rules for deployment. -qnx: target.path = /tmp/$${TARGET}/bin -else: unix:!android: target.path = /opt/$${TARGET}/bin -!isEmpty(target.path): INSTALLS += target - -RESOURCES += res.qrc - -SOURCES += \ - base/changepasswordform.cpp \ - base/switchcontrol.cpp \ - base/extendedgroupbox.cpp \ - base/ffutil.cpp \ - base/locolorselector.cpp \ - base/lodateselector.cpp \ - base/loqtitlebar.cpp \ - base/loqtreewidget.cpp \ - gutil/qwaitingdlg.cpp \ - basedlg.cpp \ - basewin.cpp \ - cfg.cpp \ - device/ctrlhdmipanel.cpp \ - device/ctrlnetworkpanel.cpp \ - device/ctrlpowerpanel.cpp \ - device/ctrlpwdpanel.cpp \ - device/ctrltestpanel.cpp \ - device/ctrlvolumepanel.cpp \ - deviceitem.cpp \ - devicepanel.cpp \ - ffplayer.cpp \ - globaldefine.cpp \ - gutil/cpp.cpp \ - gutil/qgui.cpp \ - gutil/qjson.cpp \ - gutil/qnetwork.cpp \ - main.cpp \ - mainwindow.cpp \ - mguangyingpinwidget.cpp \ - player/digiclock.cpp \ - player/eleanaclock.cpp \ - player/elebase.cpp \ - player/eleborder.cpp \ - player/elegif.cpp \ - player/eleimg.cpp \ - player/elemultipng.cpp \ - player/elescroll.cpp \ - player/eletimer.cpp \ - player/elevideo.cpp \ - player/playwin.cpp \ - player/posdlg.cpp \ - progpanel.cpp \ - synctimer.cpp \ - tools.cpp \ - device/ctrladvancedpanel.cpp \ - device/ctrlbrightpanel.cpp \ - device/ctrlverifyclockpanel.cpp \ - device/upgradeapkdialog.cpp \ - program/copydirthread.cpp \ - program/eaclock.cpp \ - program/ebase.cpp \ - program/edclock.cpp \ - program/eenviron.cpp \ - program/egif.cpp \ - program/emultiwin.cpp \ - program/ephoto.cpp \ - program/etext.cpp \ - program/etimer.cpp \ - program/evideo.cpp \ - program/eweb.cpp \ - program/gentmpthread.cpp \ - program/pageeditor.cpp \ - program/pagelistitem.cpp \ - program/progeditorwin.cpp \ - program/progitem.cpp \ - program/sendprogramdialog.cpp \ - program/sendprogthread.cpp \ - program/videosplitthread.cpp \ - -HEADERS += \ - base/changepasswordform.h \ - base/switchcontrol.h \ - base/extendedgroupbox.h \ - base/locolorselector.h \ - base/lodateselector.h \ - base/loqtitlebar.h \ - base/loqtreewidget.h \ - gutil/qwaitingdlg.h \ - basedlg.h \ - basewin.h \ - cfg.h \ - device/ctrlhdmipanel.h \ - device/ctrlnetworkpanel.h \ - device/ctrlpowerpanel.h \ - device/ctrlpwdpanel.h \ - device/ctrltestpanel.h \ - device/ctrlvolumepanel.h \ - deviceitem.h \ - devicepanel.h \ - ffplayer.h \ - globaldefine.h \ - gutil/cpp.h \ - gutil/qgui.h \ - gutil/qjson.h \ - gutil/qnetwork.h \ - mainwindow.h \ - mguangyingpinwidget.h \ - player/digiclock.h \ - player/eleanaclock.h \ - player/elebase.h \ - player/eleborder.h \ - player/elegif.h \ - player/eleimg.h \ - player/elemultipng.h \ - player/elescroll.h \ - player/eletimer.h \ - player/elevideo.h \ - player/playwin.h \ - player/posdlg.h \ - progpanel.h \ - synctimer.h \ - tools.h \ - device/ctrladvancedpanel.h \ - device/ctrlbrightpanel.h \ - device/ctrlverifyclockpanel.h \ - device/upgradeapkdialog.h \ - program/copydirthread.h \ - program/eaclock.h \ - program/ebase.h \ - program/edclock.h \ - program/eenviron.h \ - program/egif.h \ - program/emultiwin.h \ - program/ephoto.h \ - program/etext.h \ - program/etimer.h \ - program/evideo.h \ - program/eweb.h \ - program/gentmpthread.h \ - program/pageeditor.h \ - program/pagelistitem.h \ - program/progeditorwin.h \ - program/progitem.h \ - program/sendprogramdialog.h \ - program/sendprogthread.h \ - program/videosplitthread.h \ - -TRANSLATIONS += \ - ts/app_zh_CN.ts \ - ts/app_zh_TW.ts \ - ts/app_en.ts \ - ts/app_ja.ts \ - ts/app_pt.ts - -include(./xlsx/qtxlsx.pri) +QT += core gui widgets +QT += multimedia +QT += network +QT += concurrent +QT += serialport +QT += opengl +QT += webenginewidgets + +greaterThan(QT_MAJOR_VERSION, 5) { + QT += openglwidgets + CONFIG += c++20 +} else { + CONFIG += c++17 +} + +CONFIG += lrelease +CONFIG += embed_translations + +# CONFIG += console + +# You can also make your code fail to compile if you use deprecated APIs. +# In order to do so, uncomment the following line. +# You can also select to disable deprecated APIs only up to a certain version of Qt. +#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 + +VERSION = 1.4.2 +DEFINES += APP_VERSION=\\\"$$VERSION\\\" +msvc { + contains(QT_ARCH, i386) { + QMAKE_LFLAGS += /LARGEADDRESSAWARE + } +# lessThan(QT_MAJOR_VERSION, 6) { +# QMAKE_CXXFLAGS += -execution-charset:utf-8 +# QMAKE_CXXFLAGS += -source-charset:utf-8 +# } + + CONFIG += force_debug_info + CONFIG += separate_debug_info +} +win32 { + CONFIG -= debug_and_release + LIBS += -lwinmm + LIBS += -lDbghelp + + RC_ICONS = res/Logo.ico +} +osx { + ICON = res/Logo-raw.png +} + + +copydir.files += AClock +copydir.files += borders +copydir.files += Demos +copydir.files += translations +copydir.files += $$quote(y50 param) +copydir.files += $$quote(files) + +win32 { + EXE_SUFFIX = .exe + contains(QT_ARCH, i386) { + DIR_SUFFIX = -32 + copy.files += $$files(OpenSSL/*.dll) # for https requests + } + + copy.files += $$files(ffmpeg$$DIR_SUFFIX/bin/*.dll) + copy.files += 7z/7z.dll + copy.files += 7z/7z.exe + + copy.path = $$OUT_PWD + copydir.path = $$OUT_PWD + CONFIG += file_copies + COPIES += copy + COPIES += copydir +} +osx { + DIR_SUFFIX = -mac + + copy.path = Contents/MacOS + copydir.path = Contents/MacOS + QMAKE_BUNDLE_DATA += copy + QMAKE_BUNDLE_DATA += copydir +} +copy.files += ffmpeg$$DIR_SUFFIX/bin/ffmpeg$$EXE_SUFFIX + +INCLUDEPATH += $$PWD/ffmpeg$$DIR_SUFFIX/include +LIBS += -L$$PWD/ffmpeg$$DIR_SUFFIX/lib/\ + -lavcodec \ + -lavdevice \ + -lavfilter \ + -lavformat \ + -lavutil \ + -lswresample \ + -lswscale + +# Default rules for deployment. +qnx: target.path = /tmp/$${TARGET}/bin +else: unix:!android: target.path = /opt/$${TARGET}/bin +!isEmpty(target.path): INSTALLS += target + +RESOURCES += res.qrc + +SOURCES += \ + base/changepasswordform.cpp \ + base/switchcontrol.cpp \ + base/extendedgroupbox.cpp \ + base/ffutil.cpp \ + base/locolorselector.cpp \ + base/lodateselector.cpp \ + base/loqtitlebar.cpp \ + base/loqtreewidget.cpp \ + gutil/qwaitingdlg.cpp \ + basedlg.cpp \ + basewin.cpp \ + cfg.cpp \ + device/ctrlhdmipanel.cpp \ + device/ctrlnetworkpanel.cpp \ + device/ctrlpowerpanel.cpp \ + device/ctrlpwdpanel.cpp \ + device/ctrltestpanel.cpp \ + device/ctrlvolumepanel.cpp \ + deviceitem.cpp \ + devicepanel.cpp \ + ffplayer.cpp \ + globaldefine.cpp \ + gutil/cpp.cpp \ + gutil/qgui.cpp \ + gutil/qjson.cpp \ + gutil/qnetwork.cpp \ + main.cpp \ + mainwindow.cpp \ + mguangyingpinwidget.cpp \ + player/eleanaclock.cpp \ + player/eleborder.cpp \ + player/eledigiclock.cpp \ + player/elegif.cpp \ + player/elemultipng.cpp \ + player/elescroll.cpp \ + player/eletimer.cpp \ + player/elevideo.cpp \ + player/playwin.cpp \ + player/posdlg.cpp \ + progpanel.cpp \ + synctimer.cpp \ + tools.cpp \ + device/ctrladvancedpanel.cpp \ + device/ctrlbrightpanel.cpp \ + device/ctrlverifyclockpanel.cpp \ + device/upgradeapkdialog.cpp \ + program/copydirthread.cpp \ + program/eaclock.cpp \ + program/ebase.cpp \ + program/edclock.cpp \ + program/eenviron.cpp \ + program/egif.cpp \ + program/emultiwin.cpp \ + program/ephoto.cpp \ + program/etext.cpp \ + program/etimer.cpp \ + program/evideo.cpp \ + program/eweb.cpp \ + program/gentmpthread.cpp \ + program/pageeditor.cpp \ + program/pagelistitem.cpp \ + program/progeditorwin.cpp \ + program/progitem.cpp \ + program/sendprogramdialog.cpp \ + program/sendprogthread.cpp \ + program/videosplitthread.cpp \ + +HEADERS += \ + base/changepasswordform.h \ + base/switchcontrol.h \ + base/extendedgroupbox.h \ + base/locolorselector.h \ + base/lodateselector.h \ + base/loqtitlebar.h \ + base/loqtreewidget.h \ + gutil/qwaitingdlg.h \ + basedlg.h \ + basewin.h \ + cfg.h \ + device/ctrlhdmipanel.h \ + device/ctrlnetworkpanel.h \ + device/ctrlpowerpanel.h \ + device/ctrlpwdpanel.h \ + device/ctrltestpanel.h \ + device/ctrlvolumepanel.h \ + deviceitem.h \ + devicepanel.h \ + ffplayer.h \ + globaldefine.h \ + gutil/cpp.h \ + gutil/qgui.h \ + gutil/qjson.h \ + gutil/qnetwork.h \ + mainwindow.h \ + mguangyingpinwidget.h \ + player/eleanaclock.h \ + player/eleborder.h \ + player/eledigiclock.h \ + player/elegif.h \ + player/elemultipng.h \ + player/elescroll.h \ + player/eletimer.h \ + player/elevideo.h \ + player/playwin.h \ + player/posdlg.h \ + progpanel.h \ + synctimer.h \ + tools.h \ + device/ctrladvancedpanel.h \ + device/ctrlbrightpanel.h \ + device/ctrlverifyclockpanel.h \ + device/upgradeapkdialog.h \ + program/copydirthread.h \ + program/eaclock.h \ + program/ebase.h \ + program/edclock.h \ + program/eenviron.h \ + program/egif.h \ + program/emultiwin.h \ + program/ephoto.h \ + program/etext.h \ + program/etimer.h \ + program/evideo.h \ + program/eweb.h \ + program/gentmpthread.h \ + program/pageeditor.h \ + program/pagelistitem.h \ + program/progeditorwin.h \ + program/progitem.h \ + program/sendprogramdialog.h \ + program/sendprogthread.h \ + program/videosplitthread.h \ + +TRANSLATIONS += \ + ts/app_zh_CN.ts \ + ts/app_zh_TW.ts \ + ts/app_en.ts \ + ts/app_ja.ts \ + ts/app_pt.ts + +include(./xlsx/qtxlsx.pri) diff --git a/LedOK/device/wupgradeapkitem.cpp b/LedOK/device/wupgradeapkitem.cpp deleted file mode 100644 index b1063ae..0000000 --- a/LedOK/device/wupgradeapkitem.cpp +++ /dev/null @@ -1,143 +0,0 @@ -#include "wupgradeapkitem.h" -#include "base/waitingdlg.h" -#include "deviceitem.h" -#include "gutil/qgui.h" -#include "gutil/qnetwork.h" -#include -#include -#include -#include -#include -#include -#include - -wUpgradeApkItem::wUpgradeApkItem(LedCard pLedCard, LoQTreeWidget *parent) : QTreeWidgetItem(UserType), mCard(pLedCard), m_parent(parent) { - setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled); - setCheckState(0, Qt::Unchecked); - m_parent->addTopLevelItem(this); - m_ImageOnline = new QLabel(); - m_ImageOnline->setAlignment(Qt::AlignCenter); - m_parent->setItemWidget(this, Upgrade_ONLINE, m_ImageOnline); - for(int i=1; isetAlignment(Qt::AlignCenter); - mProgress->setStyleSheet("margin-top:8px; margin-bottom:8px; "); - m_parent->setItemWidget(this, Upgrade_PROGRESS, mProgress); - - btnUnlock = new QPushButton; - btnUnlock->setMaximumHeight(40); - auto wgt = new QWidget; - auto vBox = new VBox(wgt); - vBox->setContentsMargins(0,0,0,0); - vBox->addWidget(btnUnlock); - m_parent->setItemWidget(this, Upgrade_ENCRYPT, wgt); - QObject::connect(btnUnlock, &QPushButton::clicked, mProgress, [this] { - if(! mCard.isLocked) return; - bool ok; - auto pwd = QInputDialog::getText(treeWidget(), QObject::tr("Input password"), QObject::tr("Input password"), QLineEdit::Password, QString(), &ok); - if(! ok) return; - QJsonObject json; - json.insert("_id", "VerifyPassword"); - json.insert("_type", "VerifyPassword"); - json.insert("pwd", pwd); - auto waitingDlg = new WaitingDlg(treeWidget(), QObject::tr("VerifyPassword")+" ..."); - waitingDlg->show(); - auto reply = NetReq("http://"+mCard.ip+":2016/settings").timeout(120000).post(json); - waitingDlg->connAbort(reply); - QObject::connect(reply, &QNetworkReply::finished, mProgress, [=] { - QJsonDocument json; - QString err = checkReplyForJson(reply, &json); - if(! err.isEmpty()) { - waitingDlg->close(); - QMessageBox::critical(treeWidget(), QObject::tr("Error"), err); - return; - } - if(! json["result"].toBool()) { - waitingDlg->close(); - QMessageBox::critical(treeWidget(), QObject::tr("Tip Info"), QObject::tr("password is wrong")); - return; - } - waitingDlg->success(); - mCard.isLocked = false; - btnUnlock->setIcon(QIcon(":/res/UnLock.png")); - auto item = findItem(mCard.id); - if(item) { - item->mCard.isLocked = false; - item->btnUnlock->setIcon(QIcon(":/res/UnLock.png")); - } - }); - }); - - SetItemParam(mCard); -} - -void wUpgradeApkItem::OnCheckFpgaVersions() { - QJsonObject json; - json.insert("_id", "CheckHardwareVersions"); - json.insert("_type", "CheckHardwareVersions"); - auto reply = NetReq("http://"+mCard.ip+":2016/settings").timeout(120000).post(json); - QObject::connect(reply, &QNetworkReply::finished, mProgress, [reply, this] { - QJsonDocument json; - QString err = checkReplyForJson(reply, &json); - if(! err.isEmpty()) { - return; - } - QString strBuf; - auto vers = json["versions"].toArray(); - for(int i=0; imCard.HardVersion = strBuf; - } - }); -} -void wUpgradeApkItem::OnCheckSoftVersions() { - QJsonObject json; - json.insert("_id", "CheckSoftVersions"); - json.insert("_type", "CheckSoftVersions"); - auto reply = NetReq("http://"+mCard.ip+":2016/settings").timeout(120000).post(json); - QObject::connect(reply, &QNetworkReply::finished, mProgress, [reply, this] { - QJsonDocument json; - QString err = checkReplyForJson(reply, &json); - if(! err.isEmpty()) { - return; - } - auto apps = json["apps"].toArray(); - foreach(QJsonValue app, apps) { - QString packageName = app["packageName"].toString(); - QString verName = app["versionName"].toString(); - if(packageName=="com.xixun.xixunplayer") setData(Upgrade_XIXUNPLAYER_VERSION, 0, verName); - else if(packageName=="com.xixun.joey.cardsystem") setData(Upgrade_CARDSYSTEM_VERSION, 0, verName); - else if(packageName=="net.sysolution.starter") setData(Upgrade_STARTER_VERSION, 0, verName); - else if(packageName=="net.sysolution.taxiapp") setData(Upgrade_TAXIAPP_VERSION, 0, verName); - else if(packageName=="com.xixun.display") setData(Upgrade_DISPLAYER_VERSION, 0, verName); - else if(packageName=="com.xixun.xy.conn") setData(Upgrade_CONNECTION_VERSION, 0, verName); - else if(packageName=="com.xixun.xy.update") setData(Upgrade_UPDATE_VERSION, 0, verName); - } - }); -} -void wUpgradeApkItem::setResult(QString tip, QColor color) { - setText(Upgrade_Remark, tip); - setToolTip(Upgrade_Remark, tip); - setForeground(Upgrade_Remark, color); -} -void wUpgradeApkItem::SetItemParam(LedCard card) { - mCard.id = card.id; - mCard.ip = card.ip; - mCard.isOnline = card.isOnline; - setData(Upgrade_SCREEN_ID, 0, card.id); - setData(Upgrade_SCREEN_IP, 0, card.ip); - setData(Upgrade_REMARK_NAME, 0, card.alias); - m_ImageOnline->setPixmap(QPixmap(mCard.isOnline ? ":/res/O_Online.png" : ":/res/O_Offline.png")); - OnCheckSoftVersions(); - OnCheckFpgaVersions(); - if(! card.hasPassword) btnUnlock->hide(); - else { - if(! btnUnlock->isVisible()) btnUnlock->show(); - btnUnlock->setIcon(QIcon(card.isLocked ? ":/res/Lock.png" : ":/res/UnLock.png")); //如果已经验证通过密码显示绿色图标 没有验证显示蓝色锁图标 - } -} diff --git a/LedOK/device/wupgradeapkitem.h b/LedOK/device/wupgradeapkitem.h deleted file mode 100644 index fe29fd1..0000000 --- a/LedOK/device/wupgradeapkitem.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef WUPGRADEAPKITEM_H -#define WUPGRADEAPKITEM_H - -#include "globaldefine.h" -#include -#include -#include -#include -#include -#include -#include -#include - -class wUpgradeApkItem : public QTreeWidgetItem { -public: - explicit wUpgradeApkItem(LedCard card, LoQTreeWidget *parent); - void SetItemParam(LedCard p); - void setResult(QString, QColor cr = Qt::blue); - - LedCard mCard; - bool isUpdating{false}; - bool m_lockFlag=true; - QLabel *m_ImageOnline=nullptr; - LoQTreeWidget *m_parent = nullptr; - QProgressBar *mProgress=nullptr; - QPushButton *btnUnlock = nullptr; - - void OnCheckSoftVersions(); - void OnCheckFpgaVersions(); - -private: - void postFileTask(const QString& strUrl, const QString& strFilePath);//需要的数据 -}; -enum ENUM_DEVICE_PUBLISH_HEADERITEM { - Upgrade_Check=0, - Upgrade_SCREEN_ID, - Upgrade_ONLINE, - Upgrade_SCREEN_IP, - Upgrade_ENCRYPT, - Upgrade_REMARK_NAME, - Upgrade_PROGRESS, - Upgrade_Remark, - Upgrade_XIXUNPLAYER_VERSION, - Upgrade_CARDSYSTEM_VERSION, - Upgrade_STARTER_VERSION, - Upgrade_TAXIAPP_VERSION, - Upgrade_DISPLAYER_VERSION, - Upgrade_FPAG_VERSION, - Upgrade_CONNECTION_VERSION, - Upgrade_UPDATE_VERSION, - Upgrade_END, -}; - - -#endif // WPROGRAMPUBLISHITEM_H diff --git a/LedOK/importbninprogramdlg.cpp b/LedOK/importbninprogramdlg.cpp deleted file mode 100644 index aa1b8b3..0000000 --- a/LedOK/importbninprogramdlg.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "importbninprogramdlg.h" -#include "ui_importbninprogramdlg.h" - -ImportBnInProgramDlg::ImportBnInProgramDlg(QWidget *parent) : - LoQDialog(parent), - ui(new Ui::ImportBnInProgramDlg) -{ - ui->setupUi(this); -} - -ImportBnInProgramDlg::~ImportBnInProgramDlg() -{ - delete ui; -} diff --git a/LedOK/importbninprogramdlg.h b/LedOK/importbninprogramdlg.h deleted file mode 100644 index 392994a..0000000 --- a/LedOK/importbninprogramdlg.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef IMPORTBNINPROGRAMDLG_H -#define IMPORTBNINPROGRAMDLG_H - -#include - -namespace Ui { -class ImportBnInProgramDlg; -} - -class ImportBnInProgramDlg : public LoQDialog -{ - Q_OBJECT - -public: - explicit ImportBnInProgramDlg(QWidget *parent = nullptr); - ~ImportBnInProgramDlg(); - -private: - Ui::ImportBnInProgramDlg *ui; -}; - -#endif // IMPORTBNINPROGRAMDLG_H diff --git a/LedOK/importbninprogramdlg.ui b/LedOK/importbninprogramdlg.ui deleted file mode 100644 index 51fd2dd..0000000 --- a/LedOK/importbninprogramdlg.ui +++ /dev/null @@ -1,68 +0,0 @@ - - - ImportBnInProgramDlg - - - - 0 - 0 - 638 - 296 - - - - Dialog - - - - - 10 - 210 - 621 - 32 - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - buttonBox - rejected() - ImportBnInProgramDlg - reject() - - - 316 - 260 - - - 286 - 274 - - - - - buttonBox - accepted() - ImportBnInProgramDlg - accept() - - - 248 - 254 - - - 157 - 274 - - - - - diff --git a/LedOK/importprogramdlg.ui b/LedOK/importprogramdlg.ui deleted file mode 100644 index cb87e5a..0000000 --- a/LedOK/importprogramdlg.ui +++ /dev/null @@ -1,80 +0,0 @@ - - - Dialog - - - Qt::NonModal - - - - 0 - 0 - 320 - 240 - - - - - 320 - 240 - - - - Dialog - - - false - - - - - 10 - 200 - 301 - 32 - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - buttonBox - accepted() - Dialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - Dialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/LedOK/player/digiclock.cpp b/LedOK/player/digiclock.cpp deleted file mode 100644 index f26be86..0000000 --- a/LedOK/player/digiclock.cpp +++ /dev/null @@ -1,239 +0,0 @@ -#include "digiclock.h" -#include "gutil/qgui.h" -#include -#include - -DigiClock::DigiClock(QString prefix, const QJsonObject &layer, QWidget *parent) : QWidget{parent} { - timeZone = QTimeZone(layer["timezone"].toString().toUtf8()); - auto spaceWidth = layer["spaceWidth"].toDouble(); - auto pics = layer["arrayPics"].toArray(); - foreach(QJsonValue pic, pics) imgs.insert(pic["name"].toString(), QPixmap(prefix+pic["id"].toString())); - int dateStyle = layer["dateStyle"].toInt(); - isSingleMonth = dateStyle==1||dateStyle==2||dateStyle==4||dateStyle==6||dateStyle==8||dateStyle==10||dateStyle==12; - QPixmap& timeSep = imgs["maohao"]; - weekly = layer["weekly"].toBool(); - bool hour12 = layer["hour12"].toBool(); - bool AmPm = hour12 ? layer["AmPm"].toBool() : false; - timeptn = hour12 ? "hhmmssa" : "HHmmss"; - bool hour = layer["hour"].toBool(); - bool min = layer["min"].toBool(); - bool sec = layer["sec"].toBool(); - multiline = layer["multiline"].toBool(); - if(multiline) { - QVBoxLayout *vBox = new QVBoxLayout(this); - vBox->setAlignment(Qt::AlignCenter); - vBox->setContentsMargins(0,0,0,0); - vBox->setSpacing(0); - vBox->addStretch(); - QHBoxLayout *hBox = new QHBoxLayout(); - vBox->addLayout(hBox); - hBox->addStretch(); - addDate(dateStyle, layer, hBox); - hBox->addStretch(); - if(weekly) { - hBox = new QHBoxLayout(); - vBox->addLayout(hBox); - hBox->addStretch(); - hBox->addWidget((QWidget*)weekComp); - hBox->addStretch(); - } - hBox = new QHBoxLayout(); - vBox->addLayout(hBox); - hBox->addStretch(); - if(AmPm) { - hBox->addWidget((QWidget*)ampmComp); - hBox->addSpacing(spaceWidth); - } - if(hour) { - hBox->addWidget((QWidget*)hourComps[0]); - hBox->addWidget((QWidget*)hourComps[1]); - } - if(hour&&min) hBox->addWidget((QWidget*)new ImgWgt(timeSep)); - if(min) { - hBox->addWidget((QWidget*)minComps[0]); - hBox->addWidget((QWidget*)minComps[1]); - } - if(min&&sec) hBox->addWidget((QWidget*)new ImgWgt(timeSep)); - if(sec) { - hBox->addWidget((QWidget*)secComps[0]); - hBox->addWidget((QWidget*)secComps[1]); - } - hBox->addStretch(); - vBox->addStretch(); - } else { - QHBoxLayout *hBox = new QHBoxLayout(this); - hBox->setContentsMargins(0,0,0,0); - hBox->setSpacing(0); - hBox->addStretch(); - addDate(dateStyle, layer, hBox); - if(hBox->count()>1) hBox->addSpacing(spaceWidth*2); - if(weekly) { - hBox->addWidget((QWidget*)weekComp); - hBox->addSpacing(spaceWidth*2); - } - if(AmPm) { - hBox->addWidget((QWidget*)ampmComp); - hBox->addSpacing(spaceWidth); - } - if(hour) { - hBox->addWidget((QWidget*)hourComps[0]); - hBox->addWidget((QWidget*)hourComps[1]); - } - if(hour&&min) hBox->addWidget((QWidget*)new ImgWgt(timeSep)); - if(min) { - hBox->addWidget((QWidget*)minComps[0]); - hBox->addWidget((QWidget*)minComps[1]); - } - if(min&&sec) hBox->addWidget((QWidget*)new ImgWgt(timeSep)); - if(sec) { - hBox->addWidget((QWidget*)secComps[0]); - hBox->addWidget((QWidget*)secComps[1]); - } - hBox->addStretch(); - } -} -void DigiClock::addDate(int dateStyle, QJsonObject layer, QHBoxLayout* tar) { - if(dateStyle==0 || dateStyle==1) { - addYear(layer, tar, imgs["YEAR"]); - if(layer["month"].toBool()) { - tar->addWidget((QWidget*)monthComps[0]); - tar->addWidget((QWidget*)monthComps[1]); - tar->addWidget((QWidget*)new ImgWgt(imgs["MONTH"])); - } - if(layer["day"].toBool()) { - tar->addWidget((QWidget*)dayComps[0]); - tar->addWidget((QWidget*)dayComps[1]); - tar->addWidget((QWidget*)new ImgWgt(imgs["DAY"])); - } - } else if(dateStyle==2 || dateStyle==3) { - QPixmap sep = imgs["xiegang"]; - if(layer["month"].toBool()) { - tar->addWidget((QWidget*)monthComps[0]); - tar->addWidget((QWidget*)monthComps[1]); - tar->addWidget((QWidget*)new ImgWgt(sep)); - } - if(layer["day"].toBool()) { - tar->addWidget((QWidget*)dayComps[0]); - tar->addWidget((QWidget*)dayComps[1]); - tar->addWidget((QWidget*)new ImgWgt(sep)); - } - addYear(layer, tar, QPixmap()); - } else if(dateStyle==4 || dateStyle==5) { - QPixmap sep = imgs["xiegang"]; - if(layer["day"].toBool()) { - tar->addWidget((QWidget*)dayComps[0]); - tar->addWidget((QWidget*)dayComps[1]); - tar->addWidget((QWidget*)new ImgWgt(sep)); - } - if(layer["month"].toBool()) { - tar->addWidget((QWidget*)monthComps[0]); - tar->addWidget((QWidget*)monthComps[1]); - tar->addWidget((QWidget*)new ImgWgt(sep)); - } - addYear(layer, tar, QPixmap()); - } else if(dateStyle==6 || dateStyle==7) { - QPixmap sep = imgs["xiegang"]; - addYear(layer, tar, sep); - if(layer["month"].toBool()) { - tar->addWidget((QWidget*)monthComps[0]); - tar->addWidget((QWidget*)monthComps[1]); - tar->addWidget((QWidget*)new ImgWgt(sep)); - } - if(layer["day"].toBool()) { - tar->addWidget((QWidget*)dayComps[0]); - tar->addWidget((QWidget*)dayComps[1]); - } - } else if(dateStyle==8 || dateStyle==9) { - QPixmap sep = imgs["hengxian"]; - if(layer["month"].toBool()) { - tar->addWidget((QWidget*)monthComps[0]); - tar->addWidget((QWidget*)monthComps[1]); - tar->addWidget((QWidget*)new ImgWgt(sep)); - } - if(layer["day"].toBool()) { - tar->addWidget((QWidget*)dayComps[0]); - tar->addWidget((QWidget*)dayComps[1]); - tar->addWidget((QWidget*)new ImgWgt(sep)); - } - addYear(layer, tar, QPixmap()); - } else if(dateStyle==10 || dateStyle==11) { - QPixmap sep = imgs["hengxian"]; - if(layer["day"].toBool()) { - tar->addWidget((QWidget*)dayComps[0]); - tar->addWidget((QWidget*)dayComps[1]); - tar->addWidget((QWidget*)new ImgWgt(sep)); - } - if(layer["month"].toBool()) { - tar->addWidget((QWidget*)monthComps[0]); - tar->addWidget((QWidget*)monthComps[1]); - tar->addWidget((QWidget*)new ImgWgt(sep)); - } - addYear(layer, tar, QPixmap()); - } else if(dateStyle==12 || dateStyle==13) { - QPixmap sep = imgs["hengxian"]; - addYear(layer, tar, sep); - if(layer["month"].toBool()) { - tar->addWidget((QWidget*)monthComps[0]); - tar->addWidget((QWidget*)monthComps[1]); - tar->addWidget((QWidget*)new ImgWgt(sep)); - } - if(layer["day"].toBool()) { - tar->addWidget((QWidget*)dayComps[0]); - tar->addWidget((QWidget*)dayComps[1]); - } - } -} -void DigiClock::addYear(QJsonObject layer, QHBoxLayout* tar, QPixmap sep) { - if(layer["year"].toBool()) { - if(layer["fullYear"].toBool()) { - tar->addWidget((QWidget*)yearComps[0]); - tar->addWidget((QWidget*)yearComps[1]); - } - tar->addWidget((QWidget*)yearComps[2]); - tar->addWidget((QWidget*)yearComps[3]); - if(!sep.isNull()) tar->addWidget((QWidget*)new ImgWgt(sep)); - } -} -void DigiClock::cal() { - QDateTime dt = QDateTime::currentDateTime().toTimeZone(timeZone); - QTime time = dt.time(); - QString hms = time.toString(timeptn); - *ampmComp = imgs[time.hour()<12?"AM":"PM"]; - *hourComps[0] = imgs[hms.mid(0,1)]; - *hourComps[1] = imgs[hms.mid(1,1)]; - *minComps[0] = imgs[hms.mid(2,1)]; - *minComps[1] = imgs[hms.mid(3,1)]; - *secComps[0] = imgs[hms.mid(4,1)]; - *secComps[1] = imgs[hms.mid(5,1)]; - if(yearComps[0]->img.isNull() || (time.hour()==0 && time.second()==0)) { - QDate date = dt.date(); - if(weekly) *weekComp = imgs[weeks[date.dayOfWeek()-1]]; - QString ymd = date.toString("yyyyMMdd"); - *yearComps[0] = imgs[ymd.mid(0,1)]; - *yearComps[1] = imgs[ymd.mid(1,1)]; - *yearComps[2] = imgs[ymd.mid(2,1)]; - *yearComps[3] = imgs[ymd.mid(3,1)]; - QChar ch = ymd.at(4); - if(isSingleMonth && ch=='0') *monthComps[0] = QPixmap(); - else *monthComps[0] = imgs[ymd.mid(4,1)]; - *monthComps[1] = imgs[ymd.mid(5,1)]; - *dayComps[0] = imgs[ymd.mid(6,1)]; - *dayComps[1] = imgs[ymd.mid(7,1)]; - } -} -void DigiClock::showEvent(QShowEvent *) { - if(timerId==0) { - timerId = startTimer(1000, Qt::PreciseTimer); - cal(); - } -} - -void DigiClock::timerEvent(QTimerEvent *) { - if(isVisible()) { - cal(); - update(); - } else if(timerId!=0) { - killTimer(timerId); - timerId = 0; - } -} diff --git a/LedOK/player/elebase.cpp b/LedOK/player/elebase.cpp deleted file mode 100644 index 37cb708..0000000 --- a/LedOK/player/elebase.cpp +++ /dev/null @@ -1 +0,0 @@ -//#include "elebase.h" diff --git a/LedOK/player/elebase.h b/LedOK/player/elebase.h deleted file mode 100644 index 654992a..0000000 --- a/LedOK/player/elebase.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef ELEBASE_H -#define ELEBASE_H -#include - -class EleBase { -public: - QString id; - QString type; - int x; - int y; - int w; - int h; - int startTime; - int endTime; - bool repeat; - - QWidget *wgt{0}; -}; - -#endif // ELEBASE_H diff --git a/LedOK/player/eledigiclock.cpp b/LedOK/player/eledigiclock.cpp new file mode 100644 index 0000000..2585dc3 --- /dev/null +++ b/LedOK/player/eledigiclock.cpp @@ -0,0 +1,231 @@ +#include "eledigiclock.h" + +EleDigiClock::EleDigiClock(QString prefix, const JValue &layer, QWidget *parent) : QWidget{parent} { + timeZone = QTimeZone(layer["timeZone"].toString().toUtf8()); + auto spaceWidth = layer["spaceWidth"].toDouble(); + auto pics = layer["arrayPics"]; + for(auto &pic : pics) imgs[pic["name"].toString()] = QPixmap(prefix+pic["id"].toString()); + int dateStyle = layer["dateStyle"].toInt(); + isSingleMonth = dateStyle==1||dateStyle==2||dateStyle==4||dateStyle==6||dateStyle==8||dateStyle==10||dateStyle==12; + auto& timeSep = imgs["maohao"]; + weekly = layer["weekly"].toBool(); + auto hour12 = layer["hour12"].toBool(); + auto AmPm = hour12 ? layer["AmPm"].toBool() : false; + timeptn = hour12 ? "hhmmssa" : "HHmmss"; + auto hour = layer["hour"].toBool(); + auto min = layer["min"].toBool(); + auto sec = layer["sec"].toBool(); + multiline = layer["multiline"].toBool(); + if(multiline) { + auto vBox = new VBox(this); + vBox->setAlignment(Qt::AlignCenter); + vBox->setContentsMargins(0,0,0,0); + vBox->setSpacing(0); + vBox->addStretch(); + auto hBox = new HBox(vBox); + hBox->addStretch(); + addDate(dateStyle, layer, hBox); + hBox->addStretch(); + if(weekly) { + hBox = new HBox(vBox); + hBox->addStretch(); + hBox->addWidget(weekComp); + hBox->addStretch(); + } + hBox = new HBox(vBox); + hBox->addStretch(); + if(AmPm) { + hBox->addWidget(ampmComp); + hBox->addSpacing(spaceWidth); + } + if(hour) { + hBox->addWidget(hourComps[0]); + hBox->addWidget(hourComps[1]); + } + if(hour&&min) hBox->addWidget(new ImgWgt(timeSep)); + if(min) { + hBox->addWidget(minComps[0]); + hBox->addWidget(minComps[1]); + } + if(min&&sec) hBox->addWidget(new ImgWgt(timeSep)); + if(sec) { + hBox->addWidget(secComps[0]); + hBox->addWidget(secComps[1]); + } + hBox->addStretch(); + vBox->addStretch(); + } else { + auto hBox = new HBox(this); + hBox->setContentsMargins(0,0,0,0); + hBox->setSpacing(0); + hBox->addStretch(); + addDate(dateStyle, layer, hBox); + if(hBox->count()>1) hBox->addSpacing(spaceWidth*2); + if(weekly) { + hBox->addWidget(weekComp); + hBox->addSpacing(spaceWidth*2); + } + if(AmPm) { + hBox->addWidget(ampmComp); + hBox->addSpacing(spaceWidth); + } + if(hour) { + hBox->addWidget(hourComps[0]); + hBox->addWidget(hourComps[1]); + } + if(hour&&min) hBox->addWidget(new ImgWgt(timeSep)); + if(min) { + hBox->addWidget(minComps[0]); + hBox->addWidget(minComps[1]); + } + if(min&&sec) hBox->addWidget(new ImgWgt(timeSep)); + if(sec) { + hBox->addWidget(secComps[0]); + hBox->addWidget(secComps[1]); + } + hBox->addStretch(); + } +} +void EleDigiClock::addDate(int dateStyle, const JValue &layer, HBox *tar) { + if(dateStyle==0 || dateStyle==1) { + addYear(layer, tar, imgs["YEAR"]); + if(layer["month"].toBool()) { + tar->addWidget(monthComps[0]); + tar->addWidget(monthComps[1]); + tar->addWidget(new ImgWgt(imgs["MONTH"])); + } + if(layer["day"].toBool()) { + tar->addWidget(dayComps[0]); + tar->addWidget(dayComps[1]); + tar->addWidget(new ImgWgt(imgs["DAY"])); + } + } else if(dateStyle==2 || dateStyle==3) { + auto& sep = imgs["xiegang"]; + if(layer["month"].toBool()) { + tar->addWidget(monthComps[0]); + tar->addWidget(monthComps[1]); + tar->addWidget(new ImgWgt(sep)); + } + if(layer["day"].toBool()) { + tar->addWidget(dayComps[0]); + tar->addWidget(dayComps[1]); + tar->addWidget(new ImgWgt(sep)); + } + addYear(layer, tar, QPixmap()); + } else if(dateStyle==4 || dateStyle==5) { + auto& sep = imgs["xiegang"]; + if(layer["day"].toBool()) { + tar->addWidget(dayComps[0]); + tar->addWidget(dayComps[1]); + tar->addWidget(new ImgWgt(sep)); + } + if(layer["month"].toBool()) { + tar->addWidget(monthComps[0]); + tar->addWidget(monthComps[1]); + tar->addWidget(new ImgWgt(sep)); + } + addYear(layer, tar, QPixmap()); + } else if(dateStyle==6 || dateStyle==7) { + auto& sep = imgs["xiegang"]; + addYear(layer, tar, sep); + if(layer["month"].toBool()) { + tar->addWidget(monthComps[0]); + tar->addWidget(monthComps[1]); + tar->addWidget(new ImgWgt(sep)); + } + if(layer["day"].toBool()) { + tar->addWidget(dayComps[0]); + tar->addWidget(dayComps[1]); + } + } else if(dateStyle==8 || dateStyle==9) { + auto& sep = imgs["hengxian"]; + if(layer["month"].toBool()) { + tar->addWidget(monthComps[0]); + tar->addWidget(monthComps[1]); + tar->addWidget(new ImgWgt(sep)); + } + if(layer["day"].toBool()) { + tar->addWidget(dayComps[0]); + tar->addWidget(dayComps[1]); + tar->addWidget(new ImgWgt(sep)); + } + addYear(layer, tar, QPixmap()); + } else if(dateStyle==10 || dateStyle==11) { + auto& sep = imgs["hengxian"]; + if(layer["day"].toBool()) { + tar->addWidget(dayComps[0]); + tar->addWidget(dayComps[1]); + tar->addWidget(new ImgWgt(sep)); + } + if(layer["month"].toBool()) { + tar->addWidget(monthComps[0]); + tar->addWidget(monthComps[1]); + tar->addWidget(new ImgWgt(sep)); + } + addYear(layer, tar, QPixmap()); + } else if(dateStyle==12 || dateStyle==13) { + auto& sep = imgs["hengxian"]; + addYear(layer, tar, sep); + if(layer["month"].toBool()) { + tar->addWidget(monthComps[0]); + tar->addWidget(monthComps[1]); + tar->addWidget(new ImgWgt(sep)); + } + if(layer["day"].toBool()) { + tar->addWidget(dayComps[0]); + tar->addWidget(dayComps[1]); + } + } +} +void EleDigiClock::addYear(const JValue &layer, HBox *tar, const QPixmap &sep) { + if(layer["year"].toBool()) { + if(layer["fullYear"].toBool()) { + tar->addWidget(yearComps[0]); + tar->addWidget(yearComps[1]); + } + tar->addWidget(yearComps[2]); + tar->addWidget(yearComps[3]); + if(!sep.isNull()) tar->addWidget(new ImgWgt(sep)); + } +} +void EleDigiClock::cal() { + auto dt = QDateTime::currentDateTime().toTimeZone(timeZone); + auto time = dt.time(); + auto hms = time.toString(timeptn); + *ampmComp = imgs[time.hour()<12?"AM":"PM"]; + *hourComps[0] = imgs[hms.mid(0,1)]; + *hourComps[1] = imgs[hms.mid(1,1)]; + *minComps[0] = imgs[hms.mid(2,1)]; + *minComps[1] = imgs[hms.mid(3,1)]; + *secComps[0] = imgs[hms.mid(4,1)]; + *secComps[1] = imgs[hms.mid(5,1)]; + if(yearComps[0]->img.isNull() || (time.hour()==0 && time.second()==0)) { + auto date = dt.date(); + if(weekly) *weekComp = imgs[weeks[date.dayOfWeek()-1]]; + auto ymd = date.toString("yyyyMMdd"); + *yearComps[0] = imgs[ymd.mid(0,1)]; + *yearComps[1] = imgs[ymd.mid(1,1)]; + *yearComps[2] = imgs[ymd.mid(2,1)]; + *yearComps[3] = imgs[ymd.mid(3,1)]; + *monthComps[0] = isSingleMonth && ymd.at(4)=='0' ? QPixmap() : imgs[ymd.mid(4,1)]; + *monthComps[1] = imgs[ymd.mid(5,1)]; + *dayComps[0] = isSingleMonth && ymd.at(6)=='0' ? QPixmap() : imgs[ymd.mid(6,1)]; + *dayComps[1] = imgs[ymd.mid(7,1)]; + } +} +void EleDigiClock::showEvent(QShowEvent *) { + if(timerId==0) { + timerId = startTimer(1000, Qt::PreciseTimer); + cal(); + } +} + +void EleDigiClock::timerEvent(QTimerEvent *) { + if(isVisible()) { + cal(); + update(); + } else if(timerId) { + killTimer(timerId); + timerId = 0; + } +} diff --git a/LedOK/player/digiclock.h b/LedOK/player/eledigiclock.h similarity index 80% rename from LedOK/player/digiclock.h rename to LedOK/player/eledigiclock.h index 7eebd42..b43d1a1 100644 --- a/LedOK/player/digiclock.h +++ b/LedOK/player/eledigiclock.h @@ -1,67 +1,67 @@ -#ifndef DIGICLOCK_H -#define DIGICLOCK_H - -#include -#include -#include -#include - -class ImgWgt : public QWidget { -public: - ImgWgt(QWidget *parent = nullptr) : QWidget{parent} {} - ImgWgt(const QPixmap &img) :img(img){ - setFixedSize(this->img.size()); - } - ImgWgt(QPixmap &&img) { - this->img = std::move(img); - setFixedSize(this->img.size()); - } - ImgWgt &operator=(const QPixmap &img) { - this->img = img; - setFixedSize(this->img.size()); - return *this; - } - ImgWgt &operator=(QPixmap &&img) { - this->img = std::move(img); - setFixedSize(this->img.size()); - return *this; - } - QPixmap img; -protected: - virtual void paintEvent(QPaintEvent *) override { - if(img.isNull()) return; - QPainter painter(this); - painter.setRenderHints(QPainter::Antialiasing|QPainter::SmoothPixmapTransform); - painter.drawPixmap(0, 0, width(), height(), img); - } -}; - -const QString weeks[7]{"MON","TUE","WED","THU","FRI","SAT","SUN"}; - -class DigiClock : public QWidget { - Q_OBJECT -public: - DigiClock(QString path, const QJsonObject &layer, QWidget *parent = nullptr); - void cal(); - void addDate(int, QJsonObject, QHBoxLayout*); - void addYear(QJsonObject layer, QHBoxLayout* tar, QPixmap sep); - QTimeZone timeZone; - ImgWgt *yearComps[4] {new ImgWgt(), new ImgWgt(), new ImgWgt(), new ImgWgt()}; - ImgWgt *monthComps[2] {new ImgWgt(), new ImgWgt()}; - ImgWgt *dayComps[2] {new ImgWgt(), new ImgWgt()}; - ImgWgt *weekComp = new ImgWgt(), *ampmComp = new ImgWgt(); - ImgWgt *hourComps[2] {new ImgWgt(), new ImgWgt()}; - ImgWgt *minComps[2] {new ImgWgt(), new ImgWgt()}; - ImgWgt *secComps[2] {new ImgWgt(), new ImgWgt()}; - - QMap imgs; - QString timeptn; - bool multiline, weekly, isSingleMonth; - int timerId = 0; - -protected: - void timerEvent(QTimerEvent *) override; - void showEvent(QShowEvent *) override; -}; - -#endif // DIGICLOCK_H +#ifndef ELEDIGICLOCK_H +#define ELEDIGICLOCK_H + +#include "gutil/qjson.h" +#include "gutil/qgui.h" +#include +#include + +class ImgWgt : public QWidget { +public: + ImgWgt(QWidget *parent = nullptr) : QWidget{parent} {} + ImgWgt(const QPixmap &img) :img(img){ + setFixedSize(this->img.size()); + } + ImgWgt(QPixmap &&img) { + this->img = std::move(img); + setFixedSize(this->img.size()); + } + ImgWgt &operator=(const QPixmap &img) { + this->img = img; + setFixedSize(this->img.size()); + return *this; + } + ImgWgt &operator=(QPixmap &&img) { + this->img = std::move(img); + setFixedSize(this->img.size()); + return *this; + } + QPixmap img; +protected: + virtual void paintEvent(QPaintEvent *) override { + if(img.isNull()) return; + QPainter painter(this); + painter.setRenderHints(QPainter::Antialiasing|QPainter::SmoothPixmapTransform); + painter.drawPixmap(0, 0, width(), height(), img); + } +}; + +const QString weeks[7]{"MON","TUE","WED","THU","FRI","SAT","SUN"}; + +class EleDigiClock : public QWidget { + Q_OBJECT +public: + EleDigiClock(QString path, const JValue &layer, QWidget *parent = nullptr); + void cal(); + void addDate(int, const JValue &, HBox*); + void addYear(const JValue &layer, HBox* tar, const QPixmap &sep); + QTimeZone timeZone; + ImgWgt *yearComps[4] {new ImgWgt(), new ImgWgt(), new ImgWgt(), new ImgWgt()}; + ImgWgt *monthComps[2] {new ImgWgt(), new ImgWgt()}; + ImgWgt *dayComps[2] {new ImgWgt(), new ImgWgt()}; + ImgWgt *weekComp = new ImgWgt(), *ampmComp = new ImgWgt(); + ImgWgt *hourComps[2] {new ImgWgt(), new ImgWgt()}; + ImgWgt *minComps[2] {new ImgWgt(), new ImgWgt()}; + ImgWgt *secComps[2] {new ImgWgt(), new ImgWgt()}; + + QMap imgs; + QString timeptn; + bool multiline, weekly, isSingleMonth; + int timerId = 0; + +protected: + void timerEvent(QTimerEvent *) override; + void showEvent(QShowEvent *) override; +}; + +#endif // ELEDIGICLOCK_H diff --git a/LedOK/player/eleimg.cpp b/LedOK/player/eleimg.cpp deleted file mode 100644 index dc91b4c..0000000 --- a/LedOK/player/eleimg.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "eleimg.h" -#include -#include - -EleImg::EleImg(QString path, QWidget *parent) : QWidget{parent} { - img.load(path); -} - -void EleImg::paintEvent(QPaintEvent *){ - QPainter painter(this); - painter.setRenderHints(QPainter::Antialiasing|QPainter::SmoothPixmapTransform); - if(! img.isNull()) painter.drawPixmap(0, 0, width(), height(), img); -} - diff --git a/LedOK/player/eleimg.h b/LedOK/player/eleimg.h deleted file mode 100644 index 3f8e93e..0000000 --- a/LedOK/player/eleimg.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef ELEIMG_H -#define ELEIMG_H - -#include - -class EleImg : public QWidget { - Q_OBJECT -public: - explicit EleImg(QString, QWidget *parent = nullptr); - QPixmap img; -protected: - void paintEvent(QPaintEvent *) override; -}; - -#endif // ELEIMG_H diff --git a/LedOK/x_uimsgonlyclosebtn.cpp b/LedOK/x_uimsgonlyclosebtn.cpp deleted file mode 100644 index 2f68392..0000000 --- a/LedOK/x_uimsgonlyclosebtn.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "x_uimsgonlyclosebtn.h" -#include "ui_x_uimsgonlyclosebtn.h" - -x_uiMsgOnlyCloseBtn::x_uiMsgOnlyCloseBtn(QWidget *parent) : - QDialog(parent), - ui(new Ui::x_uiMsgOnlyCloseBtn) -{ - ui->setupUi(this); -} - -x_uiMsgOnlyCloseBtn::~x_uiMsgOnlyCloseBtn() -{ - delete ui; -} diff --git a/LedOK/x_uimsgonlyclosebtn.h b/LedOK/x_uimsgonlyclosebtn.h deleted file mode 100644 index 2bc1006..0000000 --- a/LedOK/x_uimsgonlyclosebtn.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef X_UIMSGONLYCLOSEBTN_H -#define X_UIMSGONLYCLOSEBTN_H - -#include - -namespace Ui { -class x_uiMsgOnlyCloseBtn; -} - -class x_uiMsgOnlyCloseBtn : public QDialog -{ - Q_OBJECT - -public: - explicit x_uiMsgOnlyCloseBtn(QWidget *parent = nullptr); - ~x_uiMsgOnlyCloseBtn(); - -private: - Ui::x_uiMsgOnlyCloseBtn *ui; -}; - -#endif // X_UIMSGONLYCLOSEBTN_H diff --git a/LedOK/x_uimsgonlyclosebtn.ui b/LedOK/x_uimsgonlyclosebtn.ui deleted file mode 100644 index c6c3d87..0000000 --- a/LedOK/x_uimsgonlyclosebtn.ui +++ /dev/null @@ -1,19 +0,0 @@ - - - x_uiMsgOnlyCloseBtn - - - - 0 - 0 - 400 - 300 - - - - Dialog - - - - -