增加 demo 图片

This commit is contained in:
Gangphon 2023-10-20 18:30:14 +08:00
parent a711980263
commit b3ebcb885d
20 changed files with 542 additions and 1035 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Binary file not shown.

View File

@ -1,242 +1,244 @@
QT += core gui widgets QT += core gui widgets
QT += multimedia QT += multimedia
QT += network QT += network
QT += concurrent QT += concurrent
QT += serialport QT += serialport
QT += opengl QT += opengl
QT += webenginewidgets QT += webenginewidgets
greaterThan(QT_MAJOR_VERSION, 5) {
QT += openglwidgets greaterThan(QT_MAJOR_VERSION, 5) {
} QT += openglwidgets
CONFIG += c++17 CONFIG += c++20
CONFIG += lrelease } else {
CONFIG += embed_translations CONFIG += c++17
}
# CONFIG += console
CONFIG += lrelease
# You can also make your code fail to compile if you use deprecated APIs. CONFIG += embed_translations
# 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. # CONFIG += console
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
# You can also make your code fail to compile if you use deprecated APIs.
TARGET = $$quote(LedOK Express) # In order to do so, uncomment the following line.
VERSION = 1.4.1 # You can also select to disable deprecated APIs only up to a certain version of Qt.
DEFINES += APP_VERSION=\\\"$$VERSION\\\" #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
msvc {
contains(QT_ARCH, i386) { VERSION = 1.4.2
QMAKE_LFLAGS += /LARGEADDRESSAWARE DEFINES += APP_VERSION=\\\"$$VERSION\\\"
#QMAKE_LFLAGS += -Wl,--large-address-aware msvc {
} contains(QT_ARCH, i386) {
lessThan(QT_MAJOR_VERSION, 6) { QMAKE_LFLAGS += /LARGEADDRESSAWARE
QMAKE_CXXFLAGS += -execution-charset:utf-8 }
QMAKE_CXXFLAGS += -source-charset:utf-8 # 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
} CONFIG += force_debug_info
win32 { CONFIG += separate_debug_info
CONFIG -= debug_and_release }
LIBS += -lwinmm win32 {
LIBS += -lDbghelp CONFIG -= debug_and_release
LIBS += -lwinmm
RC_ICONS = res/Logo.ico LIBS += -lDbghelp
}
osx { RC_ICONS = res/Logo.ico
ICON = res/Logo-raw.png }
} osx {
ICON = res/Logo-raw.png
}
copydir.files += AClock
copydir.files += borders
copydir.files += translations copydir.files += AClock
copydir.files += $$quote(y50 param) copydir.files += borders
copydir.files += $$quote(files) copydir.files += Demos
copydir.files += translations
win32 { copydir.files += $$quote(y50 param)
EXE_SUFFIX = .exe copydir.files += $$quote(files)
copy.files += $$files(ffmpeg/bin/*.dll) win32 {
copy.files += 7z/7z.dll EXE_SUFFIX = .exe
copy.files += 7z/7z.exe contains(QT_ARCH, i386) {
copy.files += $$files(OpenSSL/*.dll) # for https requests DIR_SUFFIX = -32
copy.files += $$files(OpenSSL/*.dll) # for https requests
copy.path = $$OUT_PWD }
copydir.path = $$OUT_PWD
CONFIG += file_copies copy.files += $$files(ffmpeg$$DIR_SUFFIX/bin/*.dll)
COPIES += copy copy.files += 7z/7z.dll
COPIES += copydir copy.files += 7z/7z.exe
}
osx { copy.path = $$OUT_PWD
DIR_SUFFIX = -mac copydir.path = $$OUT_PWD
CONFIG += file_copies
copy.path = Contents/MacOS COPIES += copy
copydir.path = Contents/MacOS COPIES += copydir
QMAKE_BUNDLE_DATA += copy }
QMAKE_BUNDLE_DATA += copydir osx {
} DIR_SUFFIX = -mac
copy.files += ffmpeg$$DIR_SUFFIX/bin/ffmpeg$$EXE_SUFFIX
copy.path = Contents/MacOS
INCLUDEPATH += $$PWD/ffmpeg$$DIR_SUFFIX/include copydir.path = Contents/MacOS
LIBS += -L$$PWD/ffmpeg$$DIR_SUFFIX/lib/\ QMAKE_BUNDLE_DATA += copy
-lavcodec \ QMAKE_BUNDLE_DATA += copydir
-lavdevice \ }
-lavfilter \ copy.files += ffmpeg$$DIR_SUFFIX/bin/ffmpeg$$EXE_SUFFIX
-lavformat \
-lavutil \ INCLUDEPATH += $$PWD/ffmpeg$$DIR_SUFFIX/include
-lswresample \ LIBS += -L$$PWD/ffmpeg$$DIR_SUFFIX/lib/\
-lswscale -lavcodec \
-lavdevice \
# Default rules for deployment. -lavfilter \
qnx: target.path = /tmp/$${TARGET}/bin -lavformat \
else: unix:!android: target.path = /opt/$${TARGET}/bin -lavutil \
!isEmpty(target.path): INSTALLS += target -lswresample \
-lswscale
RESOURCES += res.qrc
# Default rules for deployment.
SOURCES += \ qnx: target.path = /tmp/$${TARGET}/bin
base/changepasswordform.cpp \ else: unix:!android: target.path = /opt/$${TARGET}/bin
base/switchcontrol.cpp \ !isEmpty(target.path): INSTALLS += target
base/extendedgroupbox.cpp \
base/ffutil.cpp \ RESOURCES += res.qrc
base/locolorselector.cpp \
base/lodateselector.cpp \ SOURCES += \
base/loqtitlebar.cpp \ base/changepasswordform.cpp \
base/loqtreewidget.cpp \ base/switchcontrol.cpp \
gutil/qwaitingdlg.cpp \ base/extendedgroupbox.cpp \
basedlg.cpp \ base/ffutil.cpp \
basewin.cpp \ base/locolorselector.cpp \
cfg.cpp \ base/lodateselector.cpp \
device/ctrlhdmipanel.cpp \ base/loqtitlebar.cpp \
device/ctrlnetworkpanel.cpp \ base/loqtreewidget.cpp \
device/ctrlpowerpanel.cpp \ gutil/qwaitingdlg.cpp \
device/ctrlpwdpanel.cpp \ basedlg.cpp \
device/ctrltestpanel.cpp \ basewin.cpp \
device/ctrlvolumepanel.cpp \ cfg.cpp \
deviceitem.cpp \ device/ctrlhdmipanel.cpp \
devicepanel.cpp \ device/ctrlnetworkpanel.cpp \
ffplayer.cpp \ device/ctrlpowerpanel.cpp \
globaldefine.cpp \ device/ctrlpwdpanel.cpp \
gutil/cpp.cpp \ device/ctrltestpanel.cpp \
gutil/qgui.cpp \ device/ctrlvolumepanel.cpp \
gutil/qjson.cpp \ deviceitem.cpp \
gutil/qnetwork.cpp \ devicepanel.cpp \
main.cpp \ ffplayer.cpp \
mainwindow.cpp \ globaldefine.cpp \
mguangyingpinwidget.cpp \ gutil/cpp.cpp \
player/digiclock.cpp \ gutil/qgui.cpp \
player/eleanaclock.cpp \ gutil/qjson.cpp \
player/elebase.cpp \ gutil/qnetwork.cpp \
player/eleborder.cpp \ main.cpp \
player/elegif.cpp \ mainwindow.cpp \
player/eleimg.cpp \ mguangyingpinwidget.cpp \
player/elemultipng.cpp \ player/eleanaclock.cpp \
player/elescroll.cpp \ player/eleborder.cpp \
player/eletimer.cpp \ player/eledigiclock.cpp \
player/elevideo.cpp \ player/elegif.cpp \
player/playwin.cpp \ player/elemultipng.cpp \
player/posdlg.cpp \ player/elescroll.cpp \
progpanel.cpp \ player/eletimer.cpp \
synctimer.cpp \ player/elevideo.cpp \
tools.cpp \ player/playwin.cpp \
device/ctrladvancedpanel.cpp \ player/posdlg.cpp \
device/ctrlbrightpanel.cpp \ progpanel.cpp \
device/ctrlverifyclockpanel.cpp \ synctimer.cpp \
device/upgradeapkdialog.cpp \ tools.cpp \
program/copydirthread.cpp \ device/ctrladvancedpanel.cpp \
program/eaclock.cpp \ device/ctrlbrightpanel.cpp \
program/ebase.cpp \ device/ctrlverifyclockpanel.cpp \
program/edclock.cpp \ device/upgradeapkdialog.cpp \
program/eenviron.cpp \ program/copydirthread.cpp \
program/egif.cpp \ program/eaclock.cpp \
program/emultiwin.cpp \ program/ebase.cpp \
program/ephoto.cpp \ program/edclock.cpp \
program/etext.cpp \ program/eenviron.cpp \
program/etimer.cpp \ program/egif.cpp \
program/evideo.cpp \ program/emultiwin.cpp \
program/eweb.cpp \ program/ephoto.cpp \
program/gentmpthread.cpp \ program/etext.cpp \
program/pageeditor.cpp \ program/etimer.cpp \
program/pagelistitem.cpp \ program/evideo.cpp \
program/progeditorwin.cpp \ program/eweb.cpp \
program/progitem.cpp \ program/gentmpthread.cpp \
program/sendprogramdialog.cpp \ program/pageeditor.cpp \
program/sendprogthread.cpp \ program/pagelistitem.cpp \
program/videosplitthread.cpp \ program/progeditorwin.cpp \
program/progitem.cpp \
HEADERS += \ program/sendprogramdialog.cpp \
base/changepasswordform.h \ program/sendprogthread.cpp \
base/switchcontrol.h \ program/videosplitthread.cpp \
base/extendedgroupbox.h \
base/locolorselector.h \ HEADERS += \
base/lodateselector.h \ base/changepasswordform.h \
base/loqtitlebar.h \ base/switchcontrol.h \
base/loqtreewidget.h \ base/extendedgroupbox.h \
gutil/qwaitingdlg.h \ base/locolorselector.h \
basedlg.h \ base/lodateselector.h \
basewin.h \ base/loqtitlebar.h \
cfg.h \ base/loqtreewidget.h \
device/ctrlhdmipanel.h \ gutil/qwaitingdlg.h \
device/ctrlnetworkpanel.h \ basedlg.h \
device/ctrlpowerpanel.h \ basewin.h \
device/ctrlpwdpanel.h \ cfg.h \
device/ctrltestpanel.h \ device/ctrlhdmipanel.h \
device/ctrlvolumepanel.h \ device/ctrlnetworkpanel.h \
deviceitem.h \ device/ctrlpowerpanel.h \
devicepanel.h \ device/ctrlpwdpanel.h \
ffplayer.h \ device/ctrltestpanel.h \
globaldefine.h \ device/ctrlvolumepanel.h \
gutil/cpp.h \ deviceitem.h \
gutil/qgui.h \ devicepanel.h \
gutil/qjson.h \ ffplayer.h \
gutil/qnetwork.h \ globaldefine.h \
mainwindow.h \ gutil/cpp.h \
mguangyingpinwidget.h \ gutil/qgui.h \
player/digiclock.h \ gutil/qjson.h \
player/eleanaclock.h \ gutil/qnetwork.h \
player/elebase.h \ mainwindow.h \
player/eleborder.h \ mguangyingpinwidget.h \
player/elegif.h \ player/eleanaclock.h \
player/eleimg.h \ player/eleborder.h \
player/elemultipng.h \ player/eledigiclock.h \
player/elescroll.h \ player/elegif.h \
player/eletimer.h \ player/elemultipng.h \
player/elevideo.h \ player/elescroll.h \
player/playwin.h \ player/eletimer.h \
player/posdlg.h \ player/elevideo.h \
progpanel.h \ player/playwin.h \
synctimer.h \ player/posdlg.h \
tools.h \ progpanel.h \
device/ctrladvancedpanel.h \ synctimer.h \
device/ctrlbrightpanel.h \ tools.h \
device/ctrlverifyclockpanel.h \ device/ctrladvancedpanel.h \
device/upgradeapkdialog.h \ device/ctrlbrightpanel.h \
program/copydirthread.h \ device/ctrlverifyclockpanel.h \
program/eaclock.h \ device/upgradeapkdialog.h \
program/ebase.h \ program/copydirthread.h \
program/edclock.h \ program/eaclock.h \
program/eenviron.h \ program/ebase.h \
program/egif.h \ program/edclock.h \
program/emultiwin.h \ program/eenviron.h \
program/ephoto.h \ program/egif.h \
program/etext.h \ program/emultiwin.h \
program/etimer.h \ program/ephoto.h \
program/evideo.h \ program/etext.h \
program/eweb.h \ program/etimer.h \
program/gentmpthread.h \ program/evideo.h \
program/pageeditor.h \ program/eweb.h \
program/pagelistitem.h \ program/gentmpthread.h \
program/progeditorwin.h \ program/pageeditor.h \
program/progitem.h \ program/pagelistitem.h \
program/sendprogramdialog.h \ program/progeditorwin.h \
program/sendprogthread.h \ program/progitem.h \
program/videosplitthread.h \ program/sendprogramdialog.h \
program/sendprogthread.h \
TRANSLATIONS += \ program/videosplitthread.h \
ts/app_zh_CN.ts \
ts/app_zh_TW.ts \ TRANSLATIONS += \
ts/app_en.ts \ ts/app_zh_CN.ts \
ts/app_ja.ts \ ts/app_zh_TW.ts \
ts/app_pt.ts ts/app_en.ts \
ts/app_ja.ts \
include(./xlsx/qtxlsx.pri) ts/app_pt.ts
include(./xlsx/qtxlsx.pri)

View File

@ -1,143 +0,0 @@
#include "wupgradeapkitem.h"
#include "base/waitingdlg.h"
#include "deviceitem.h"
#include "gutil/qgui.h"
#include "gutil/qnetwork.h"
#include <QMessageBox>
#include <QJsonArray>
#include <QJsonDocument>
#include <QProgressBar>
#include <globaldefine.h>
#include <QMessageBox>
#include <QInputDialog>
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; i<Upgrade_END; i++) setTextAlignment(i, Qt::AlignCenter);
mProgress = new QProgressBar;
mProgress->setAlignment(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; i<vers.size(); i++) {
if(i) strBuf += "\n";
strBuf += "["+QString::number(i)+"]:"+vers[i].toString();
}
setData(Upgrade_FPAG_VERSION, 0, strBuf);
auto item = findItem(mCard.id);
if(item) {
item->mCard.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")); //如果已经验证通过密码显示绿色图标 没有验证显示蓝色锁图标
}
}

View File

@ -1,55 +0,0 @@
#ifndef WUPGRADEAPKITEM_H
#define WUPGRADEAPKITEM_H
#include "globaldefine.h"
#include <QDir>
#include <QDateTime>
#include <QJsonObject>
#include <QJsonDocument>
#include <QPushButton>
#include <base/loqtreewidget.h>
#include <QProgressBar>
#include <QLabel>
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

View File

@ -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;
}

View File

@ -1,22 +0,0 @@
#ifndef IMPORTBNINPROGRAMDLG_H
#define IMPORTBNINPROGRAMDLG_H
#include <LoQClass/loqdialog.h>
namespace Ui {
class ImportBnInProgramDlg;
}
class ImportBnInProgramDlg : public LoQDialog
{
Q_OBJECT
public:
explicit ImportBnInProgramDlg(QWidget *parent = nullptr);
~ImportBnInProgramDlg();
private:
Ui::ImportBnInProgramDlg *ui;
};
#endif // IMPORTBNINPROGRAMDLG_H

View File

@ -1,68 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ImportBnInProgramDlg</class>
<widget class="QDialog" name="ImportBnInProgramDlg">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>638</width>
<height>296</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry">
<rect>
<x>10</x>
<y>210</y>
<width>621</width>
<height>32</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>ImportBnInProgramDlg</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>ImportBnInProgramDlg</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -1,80 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="windowModality">
<enum>Qt::NonModal</enum>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>320</width>
<height>240</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>320</width>
<height>240</height>
</size>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<property name="sizeGripEnabled">
<bool>false</bool>
</property>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry">
<rect>
<x>10</x>
<y>200</y>
<width>301</width>
<height>32</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>Dialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Dialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -1,239 +0,0 @@
#include "digiclock.h"
#include "gutil/qgui.h"
#include <QJsonObject>
#include <QJsonArray>
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;
}
}

View File

@ -1 +0,0 @@
//#include "elebase.h"

View File

@ -1,20 +0,0 @@
#ifndef ELEBASE_H
#define ELEBASE_H
#include <QWidget>
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

View File

@ -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;
}
}

View File

@ -1,67 +1,67 @@
#ifndef DIGICLOCK_H #ifndef ELEDIGICLOCK_H
#define DIGICLOCK_H #define ELEDIGICLOCK_H
#include <QWidget> #include "gutil/qjson.h"
#include <QTimeZone> #include "gutil/qgui.h"
#include <QPainter> #include <QTimeZone>
#include <QHBoxLayout> #include <QPainter>
class ImgWgt : public QWidget { class ImgWgt : public QWidget {
public: public:
ImgWgt(QWidget *parent = nullptr) : QWidget{parent} {} ImgWgt(QWidget *parent = nullptr) : QWidget{parent} {}
ImgWgt(const QPixmap &img) :img(img){ ImgWgt(const QPixmap &img) :img(img){
setFixedSize(this->img.size()); setFixedSize(this->img.size());
} }
ImgWgt(QPixmap &&img) { ImgWgt(QPixmap &&img) {
this->img = std::move(img); this->img = std::move(img);
setFixedSize(this->img.size()); setFixedSize(this->img.size());
} }
ImgWgt &operator=(const QPixmap &img) { ImgWgt &operator=(const QPixmap &img) {
this->img = img; this->img = img;
setFixedSize(this->img.size()); setFixedSize(this->img.size());
return *this; return *this;
} }
ImgWgt &operator=(QPixmap &&img) { ImgWgt &operator=(QPixmap &&img) {
this->img = std::move(img); this->img = std::move(img);
setFixedSize(this->img.size()); setFixedSize(this->img.size());
return *this; return *this;
} }
QPixmap img; QPixmap img;
protected: protected:
virtual void paintEvent(QPaintEvent *) override { virtual void paintEvent(QPaintEvent *) override {
if(img.isNull()) return; if(img.isNull()) return;
QPainter painter(this); QPainter painter(this);
painter.setRenderHints(QPainter::Antialiasing|QPainter::SmoothPixmapTransform); painter.setRenderHints(QPainter::Antialiasing|QPainter::SmoothPixmapTransform);
painter.drawPixmap(0, 0, width(), height(), img); painter.drawPixmap(0, 0, width(), height(), img);
} }
}; };
const QString weeks[7]{"MON","TUE","WED","THU","FRI","SAT","SUN"}; const QString weeks[7]{"MON","TUE","WED","THU","FRI","SAT","SUN"};
class DigiClock : public QWidget { class EleDigiClock : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
DigiClock(QString path, const QJsonObject &layer, QWidget *parent = nullptr); EleDigiClock(QString path, const JValue &layer, QWidget *parent = nullptr);
void cal(); void cal();
void addDate(int, QJsonObject, QHBoxLayout*); void addDate(int, const JValue &, HBox*);
void addYear(QJsonObject layer, QHBoxLayout* tar, QPixmap sep); void addYear(const JValue &layer, HBox* tar, const QPixmap &sep);
QTimeZone timeZone; QTimeZone timeZone;
ImgWgt *yearComps[4] {new ImgWgt(), new ImgWgt(), new ImgWgt(), new ImgWgt()}; ImgWgt *yearComps[4] {new ImgWgt(), new ImgWgt(), new ImgWgt(), new ImgWgt()};
ImgWgt *monthComps[2] {new ImgWgt(), new ImgWgt()}; ImgWgt *monthComps[2] {new ImgWgt(), new ImgWgt()};
ImgWgt *dayComps[2] {new ImgWgt(), new ImgWgt()}; ImgWgt *dayComps[2] {new ImgWgt(), new ImgWgt()};
ImgWgt *weekComp = new ImgWgt(), *ampmComp = new ImgWgt(); ImgWgt *weekComp = new ImgWgt(), *ampmComp = new ImgWgt();
ImgWgt *hourComps[2] {new ImgWgt(), new ImgWgt()}; ImgWgt *hourComps[2] {new ImgWgt(), new ImgWgt()};
ImgWgt *minComps[2] {new ImgWgt(), new ImgWgt()}; ImgWgt *minComps[2] {new ImgWgt(), new ImgWgt()};
ImgWgt *secComps[2] {new ImgWgt(), new ImgWgt()}; ImgWgt *secComps[2] {new ImgWgt(), new ImgWgt()};
QMap<QString, QPixmap> imgs; QMap<QString, QPixmap> imgs;
QString timeptn; QString timeptn;
bool multiline, weekly, isSingleMonth; bool multiline, weekly, isSingleMonth;
int timerId = 0; int timerId = 0;
protected: protected:
void timerEvent(QTimerEvent *) override; void timerEvent(QTimerEvent *) override;
void showEvent(QShowEvent *) override; void showEvent(QShowEvent *) override;
}; };
#endif // DIGICLOCK_H #endif // ELEDIGICLOCK_H

View File

@ -1,14 +0,0 @@
#include "eleimg.h"
#include <QJsonObject>
#include <QPainter>
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);
}

View File

@ -1,15 +0,0 @@
#ifndef ELEIMG_H
#define ELEIMG_H
#include <QWidget>
class EleImg : public QWidget {
Q_OBJECT
public:
explicit EleImg(QString, QWidget *parent = nullptr);
QPixmap img;
protected:
void paintEvent(QPaintEvent *) override;
};
#endif // ELEIMG_H

View File

@ -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;
}

View File

@ -1,22 +0,0 @@
#ifndef X_UIMSGONLYCLOSEBTN_H
#define X_UIMSGONLYCLOSEBTN_H
#include <QDialog>
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

View File

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>x_uiMsgOnlyCloseBtn</class>
<widget class="QDialog" name="x_uiMsgOnlyCloseBtn">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
</widget>
<resources/>
<connections/>
</ui>