From 38b63542f3cecd7aae6050e4a79b2fa7532d51d2 Mon Sep 17 00:00:00 2001 From: gangphon Date: Thu, 27 Apr 2023 15:06:24 +0800 Subject: [PATCH] ledok --- LedOK/base/switchcontrol.cpp | 10 +- LedOK/base/switchcontrol.h | 2 - LedOK/device/ctrlhdmipanel.cpp | 37 +-- LedOK/device/ctrlhdmipanel.h | 2 +- LedOK/device/ctrlnetworkpanel.cpp | 10 +- LedOK/gutil/qgui.h | 8 + LedOK/player/eletimer.cpp | 17 +- LedOK/player/eletimer.h | 8 +- LedOK/progpanel.cpp | 8 +- LedOK/program/eaclock.cpp | 3 +- LedOK/program/eaclock.h | 4 +- LedOK/program/edclock.cpp | 9 +- LedOK/program/eenviron.cpp | 15 +- LedOK/program/eenviron.h | 4 +- LedOK/program/egif.cpp | 35 +-- LedOK/program/emultiwin.cpp | 3 +- LedOK/program/etimer.cpp | 8 +- LedOK/program/gentmpthread.cpp | 6 +- LedOK/program/progitem.cpp | 4 +- LedOK/translations/app_en.ts | 419 +++++++++++++++-------------- LedOK/translations/app_ja.ts | 419 +++++++++++++++-------------- LedOK/translations/app_zh_CN.ts | 421 +++++++++++++++--------------- LedOK/translations/app_zh_TW.ts | 419 +++++++++++++++-------------- 23 files changed, 958 insertions(+), 913 deletions(-) diff --git a/LedOK/base/switchcontrol.cpp b/LedOK/base/switchcontrol.cpp index a7f9fa3..78cffd2 100644 --- a/LedOK/base/switchcontrol.cpp +++ b/LedOK/base/switchcontrol.cpp @@ -35,17 +35,9 @@ SwitchControl::SwitchControl(QWidget *parent): QWidget(parent) timer = new QTimer(this); timer->setInterval(5); connect(timer, SIGNAL(timeout()), this, SLOT(updateValue())); - - setFont(QFont("Microsoft Yahei", 10)); } -SwitchControl::~SwitchControl() -{ - -} - -void SwitchControl::mousePressEvent(QMouseEvent *) -{ +void SwitchControl::mousePressEvent(QMouseEvent *) { checked = !checked; //每次移动的步长为宽度的 50分之一 diff --git a/LedOK/base/switchcontrol.h b/LedOK/base/switchcontrol.h index 88dd274..459f70c 100644 --- a/LedOK/base/switchcontrol.h +++ b/LedOK/base/switchcontrol.h @@ -24,9 +24,7 @@ public: ButtonStyle_CircleOut = 2,//外圆形 ButtonStyle_Image = 3 //图片 }; - SwitchControl(QWidget *parent = 0); - ~SwitchControl(); protected: void mousePressEvent(QMouseEvent *); diff --git a/LedOK/device/ctrlhdmipanel.cpp b/LedOK/device/ctrlhdmipanel.cpp index 518420a..b4a687d 100644 --- a/LedOK/device/ctrlhdmipanel.cpp +++ b/LedOK/device/ctrlhdmipanel.cpp @@ -55,26 +55,34 @@ CtrlHdmiPanel::CtrlHdmiPanel(QWidget *parent) : QWidget(parent) { btnGroup->addButton(fdAsync, 0); btnGroup->addButton(fdHdmi, 1); btnGroup->addButton(fdHdmi2, 2); - connect(btnGroup, &QButtonGroup::idToggled, this, [this](int id, bool checked) { - if(! checked) return; + vBox->addSpacing(20); + + hBox = new HBox(vBox); + hBox->addStretch(); + + btnSyncSet = new QPushButton; + btnSyncSet->setMinimumSize(60, 30); + btnSyncSet->setProperty("ssType", "progManageTool"); + connect(btnSyncSet, &QPushButton::clicked, this, [=] { if(gSelCards->isEmpty()) { QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController")); return; } + auto id = btnGroup->checkedId(); QJsonObject json; json.insert("_id", "SyncSwitch"); json.insert("_type", "SyncSwitch"); json.insert("switchOn", (bool)id); if(id) json.insert("number", id); if(gSelCards->count() == 1) { - auto waitingDlg = new WaitingDlg(this, checked ? tr("SyncSwitch") : tr("AnSyncSwitch")); + auto waitingDlg = new WaitingDlg(this, id ? tr("SyncSwitch") : tr("AnSyncSwitch")); Def_CtrlReqPre connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] { Def_CtrlSetReqAfter }); } else { foreach(auto card, *gSelCards) { - if(checked){ + if(id) { Def_CtrlSetMulti(tr("SyncSwitch")) } else { Def_CtrlSetMulti(tr("AnSyncSwitch")) @@ -82,15 +90,13 @@ CtrlHdmiPanel::CtrlHdmiPanel(QWidget *parent) : QWidget(parent) { } } }); + hBox->addWidget(btnSyncSet); + hBox->addSpacing(20); - vBox->addSpacing(20); - - hBox = new HBox(vBox); - hBox->addStretch(); - btnGetSync = new QPushButton; - btnGetSync->setMinimumSize(60, 30); - btnGetSync->setProperty("ssType", "progManageTool"); - connect(btnGetSync, &QPushButton::clicked, this, [this] { + btnSyncGet = new QPushButton; + btnSyncGet->setMinimumSize(60, 30); + btnSyncGet->setProperty("ssType", "progManageTool"); + connect(btnSyncGet, &QPushButton::clicked, this, [this] { if(gSelCards->isEmpty()) { QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController")); return; @@ -132,7 +138,7 @@ CtrlHdmiPanel::CtrlHdmiPanel(QWidget *parent) : QWidget(parent) { } } }); - hBox->addWidget(btnGetSync); + hBox->addWidget(btnSyncGet); hBox->addStretch(); vBox->addStretch(); @@ -294,7 +300,7 @@ CtrlHdmiPanel::CtrlHdmiPanel(QWidget *parent) : QWidget(parent) { auto m_buttonGroup = new QButtonGroup; m_buttonGroup->addButton(fdManual, 0); m_buttonGroup->addButton(fdSchedule, 1); - connect(m_buttonGroup,SIGNAL(buttonClicked(int)),stacked,SLOT(setCurrentIndex(int))); + connect(m_buttonGroup, &QButtonGroup::idClicked, stacked, &QStackedLayout::setCurrentIndex); fdManual->setChecked(true); stacked->setCurrentIndex(0); @@ -344,7 +350,8 @@ void CtrlHdmiPanel::transUi() { fdSchedule->setText(tr("Schedule")); fdAsync->setText(tr("Async")); - btnGetSync->setText(tr("Readback")); + btnSyncSet->setText(tr("Set")); + btnSyncGet->setText(tr("Readback")); tableSche->setHeaderText("start", tr("Start Time")); tableSche->setHeaderText("end", tr("End Time")); diff --git a/LedOK/device/ctrlhdmipanel.h b/LedOK/device/ctrlhdmipanel.h index b70a007..b49d6f7 100644 --- a/LedOK/device/ctrlhdmipanel.h +++ b/LedOK/device/ctrlhdmipanel.h @@ -22,7 +22,7 @@ protected: private: QLabel *lbHdmiCfg; QRadioButton *fdManual, *fdSchedule, *fdAsync, *fdHdmi, *fdHdmi2; - QPushButton *btnGetSync; + QPushButton *btnSyncSet, *btnSyncGet; Table *tableSche; QPushButton *btnScheAdd; diff --git a/LedOK/device/ctrlnetworkpanel.cpp b/LedOK/device/ctrlnetworkpanel.cpp index d6c45a8..dcef59e 100644 --- a/LedOK/device/ctrlnetworkpanel.cpp +++ b/LedOK/device/ctrlnetworkpanel.cpp @@ -13,9 +13,9 @@ CtrlNetworkPanel::CtrlNetworkPanel(QWidget *parent) : QWidget(parent) { auto vBox = new VBox(this); lbLanCfg = new QLabel; - QFont font = lbLanCfg->font(); - font.setPixelSize(16); - lbLanCfg->setFont(font); + auto ftTitle = lbLanCfg->font(); + ftTitle.setPixelSize(16); + lbLanCfg->setFont(ftTitle); lbLanCfg->setAlignment(Qt::AlignCenter); vBox->addWidget(lbLanCfg); @@ -210,7 +210,7 @@ CtrlNetworkPanel::CtrlNetworkPanel(QWidget *parent) : QWidget(parent) { vBox->addWidget(line); label_5 = new QLabel; - label_5->setFont(font); + label_5->setFont(ftTitle); label_5->setAlignment(Qt::AlignCenter); vBox->addWidget(label_5); @@ -445,7 +445,7 @@ CtrlNetworkPanel::CtrlNetworkPanel(QWidget *parent) : QWidget(parent) { vBox->addWidget(line_3); lbCellularConfig = new QLabel; - lbCellularConfig->setFont(font); + lbCellularConfig->setFont(ftTitle); vBox->addWidget(lbCellularConfig, 0, Qt::AlignHCenter); diff --git a/LedOK/gutil/qgui.h b/LedOK/gutil/qgui.h index 4c1efe2..b1391e9 100644 --- a/LedOK/gutil/qgui.h +++ b/LedOK/gutil/qgui.h @@ -63,6 +63,14 @@ public: }; }; +inline QFont qfont(const QString &family, int pixelSize, bool bold = false, bool italic = false) { + QFont font(family); + font.setPixelSize(pixelSize); + if(bold) font.setBold(true); + if(italic) font.setItalic(true); + return font; +} + class NumTable : public QTableWidget { Q_OBJECT public: diff --git a/LedOK/player/eletimer.cpp b/LedOK/player/eletimer.cpp index 056e0f0..e496fa3 100644 --- a/LedOK/player/eletimer.cpp +++ b/LedOK/player/eletimer.cpp @@ -13,11 +13,13 @@ EleTimer::EleTimer(const QJsonObject &json, QWidget *parent) : QWidget{parent} { hasSec = json["hasSec"].toBool(); text = json["text"].toString(); isMultiline = json["isMultiline"].toBool(); - font = json["font"].toString(); - fontSize = json["fontSize"].toInt(); - fontBold = json["fontBold"].toBool(); - fontItalic = json["fontItalic"].toBool(); - fontUnderline = json["fontUnderline"].toBool(); + font = QFont(json["font"].toString()); + font.setPixelSize(json["fontSize"].toInt()); + font.setBold(json["fontBold"].toBool()); + font.setItalic(json["fontItalic"].toBool()); + font.setUnderline(json["fontUnderline"].toBool()); + font.setStyleStrategy(gTextAntialiasing ? QFont::PreferAntialias : QFont::NoAntialias); + textColor = json["textColor"].toString(); auto color = json["backColor"].toString(); backColor = color.isEmpty() ? QColor(0,0,0,0) : color; @@ -52,11 +54,6 @@ void EleTimer::paintEvent(QPaintEvent *){ } if(hasSec) text.append(QString::asprintf("%02d ", secs)).append(tr("sec")).append(" "); text = text.trimmed(); - QFont font(this->font, fontSize); - font.setBold(fontBold); - font.setItalic(fontItalic); - font.setUnderline(fontUnderline); - font.setStyleStrategy(gTextAntialiasing ? QFont::PreferAntialias : QFont::NoAntialias); QPainter painter(this); if(backColor.alpha() != 0) painter.fillRect(rect(), backColor); painter.setFont(font); diff --git a/LedOK/player/eletimer.h b/LedOK/player/eletimer.h index ae9b3d1..9711439 100644 --- a/LedOK/player/eletimer.h +++ b/LedOK/player/eletimer.h @@ -7,16 +7,12 @@ class EleTimer : public QWidget { Q_OBJECT public: - explicit EleTimer(const QJsonObject&, QWidget *parent = nullptr); + explicit EleTimer(const QJsonObject&, QWidget *parent = 0); QDateTime targetTime; QString text; QColor textColor; QColor backColor; - QString font; - int fontSize; - bool fontBold; - bool fontItalic; - bool fontUnderline; + QFont font; bool isDown; bool isMultiline; bool hasDay; diff --git a/LedOK/progpanel.cpp b/LedOK/progpanel.cpp index 36075ca..be28fa1 100644 --- a/LedOK/progpanel.cpp +++ b/LedOK/progpanel.cpp @@ -328,8 +328,8 @@ void ProgPanel::onEditClicked(bool){ for(int i=0; itopLevelItem(i)->checkState(0) == Qt::Checked) { auto item = static_cast(mProgTree->topLevelItem(i)); - auto editor = new ProgEditorWin(item, gMainWin); - editor->show(); + ProgEditorWin editor(item, gMainWin); + editor.exec(); break; } } @@ -353,8 +353,8 @@ void ProgPanel::onCreateNewProgramOnOpenEditProgramWidget(QString name, QSize re auto item = new ProgItem(mProgsDir, name, res.width(), res.height(), remarks, splitWidths, max, mProgTree, this); item->save();//保存pro.json mProgTree->adjustCheckState(); - auto editor = new ProgEditorWin(item, gMainWin); - editor->show(); + ProgEditorWin editor(item, gMainWin); + editor.exec(); } void ProgPanel::onDeleteClicked(bool){ auto res = QMessageBox::information(this, tr("Tip Info"), tr("You will delete the selected solution(s),are you sure?"), QMessageBox::Ok, QMessageBox::Cancel); diff --git a/LedOK/program/eaclock.cpp b/LedOK/program/eaclock.cpp index 169aa01..a89bf01 100644 --- a/LedOK/program/eaclock.cpp +++ b/LedOK/program/eaclock.cpp @@ -44,7 +44,8 @@ EAClock::EAClock(const QJsonObject &json, EBase *multiWin) : EBase(multiWin) { color = widget["textColor"]; m_attr.textColor = color.isString() ? QColor(color.toString()) : Tools::int2Color(color.toInt()); m_attr.text = widget["text"].toString(); - m_attr.textFont = QFont(widget["textFontFamily"].toString(), widget["textFontSize"].toInt()); + m_attr.textFont = QFont(widget["textFontFamily"].toString()); + m_attr.textFont.setPixelSize(widget["textFontSize"].toInt()); m_attr.textFont.setBold(widget["textFontBold"].toBool()); m_attr.textFont.setItalic(widget["textFontItalics"].toBool()); m_attr.textFont.setUnderline(widget["textFontUnderline"].toBool()); diff --git a/LedOK/program/eaclock.h b/LedOK/program/eaclock.h index 785ce4c..b1246af 100644 --- a/LedOK/program/eaclock.h +++ b/LedOK/program/eaclock.h @@ -3,7 +3,7 @@ #include "ebase.h" #include -#include +#include "gutil/qgui.h" class EAClock : public EBase { Q_OBJECT @@ -25,7 +25,7 @@ public: // r*3/4, r / 30 // r, r / 40 QString text;//标题 - QFont textFont{"Arial", 9};//标题字体 + QFont textFont = qfont("Arial", 12);//标题字体 QColor textColor;//标题字体颜色 int playDuration{10};// QString path; diff --git a/LedOK/program/edclock.cpp b/LedOK/program/edclock.cpp index 050debb..a631c24 100644 --- a/LedOK/program/edclock.cpp +++ b/LedOK/program/edclock.cpp @@ -2,17 +2,16 @@ #include "base/locolorselector.h" #include "globaldefine.h" #include "tools.h" -#include +#include "gutil/qgui.h" #include #include -#include #include #include EDClock::EDClock(EBase *multiWin) : EBase(multiWin) { mType = EBase::DClock; m_attr.timeZoneId = QTimeZone::systemTimeZoneId(); - m_attr.font = QFont("Arial", 9); + m_attr.font = qfont("Arial", 12); m_attr.year = true; m_attr.month = true; m_attr.day = true; @@ -35,9 +34,7 @@ EDClock::EDClock(const QJsonObject &json, EBase *multiWin) : EBase(multiWin) { setBaseAttr(json); auto widget = json["widget"]; auto font = widget["font"]; - m_attr.font = QFont(font["family"].toString(), font["size"].toInt()); - m_attr.font.setBold(font["bold"].toBool()); - m_attr.font.setItalic(font["italics"].toBool()); + m_attr.font = qfont(font["family"].toString(), font["size"].toInt(), font["bold"].toBool(), font["italics"].toBool()); m_attr.font.setUnderline(font["underline"].toBool()); m_attr.textColor = Tools::int2Color(font["color"].toInt()); m_attr.timeZoneId = widget["timeZone"].toString().toUtf8(); diff --git a/LedOK/program/eenviron.cpp b/LedOK/program/eenviron.cpp index 9bbb31d..ee4b7d4 100644 --- a/LedOK/program/eenviron.cpp +++ b/LedOK/program/eenviron.cpp @@ -2,7 +2,7 @@ #include "base/locolorselector.h" #include "globaldefine.h" #include "tools.h" -#include +#include "gutil/qgui.h" #include #include #include @@ -39,11 +39,8 @@ QJsonObject EEnviron::genProg(const QJsonObject &json, const QString &dstDir, co oRes["iScrollSpeed"] = widget["scrollSpeed"].toInt(); auto textColor = Tools::int2Color(widget["textColor"].toInt()); - auto font = QFont(widget["fontFamily"].toString(), widget["fontSize"].toInt()); - font.setBold(widget["fontBold"].toBool()); - font.setItalic(widget["fontItalics"].toBool()); + auto font = qfont(widget["fontFamily"].toString(), widget["fontSize"].toInt(), widget["fontBold"].toBool(), widget["fontItalics"].toBool()); font.setUnderline(widget["fontUnderline"].toBool()); - font.setStyleStrategy(gTextAntialiasing ? QFont::PreferAntialias : QFont::NoAntialias); QFontMetricsF metricF(font); oRes["spaceWidth"] = metricF.horizontalAdvance(" "); @@ -136,9 +133,7 @@ EEnviron::EEnviron(const QJsonObject &json, EBase *multiWin): EBase(multiWin){ m_attr.scrollSpeed = widget["scrollSpeed"].toInt(); m_attr.backColor = Tools::int2Color(widget["cBackground"].toInt()); m_attr.align = widget["alignType"].toInt(); - m_attr.font = QFont(widget["fontFamily"].toString(), widget["fontSize"].toInt()); - m_attr.font.setBold(widget["fontBold"].toBool()); - m_attr.font.setItalic(widget["fontItalics"].toBool()); + m_attr.font = qfont(widget["fontFamily"].toString(), widget["fontSize"].toInt(), widget["fontBold"].toBool(), widget["fontItalics"].toBool()); m_attr.font.setUnderline(widget["fontUnderline"].toBool()); m_attr.textColor = Tools::int2Color(widget["textColor"].toInt()); m_attr.playRefresh = json["play"]["refresh"].toInt(); @@ -577,9 +572,7 @@ QWidget* EEnviron::attrWgt() { fdFontFamily->setEditable(false); fdFontFamily->setCurrentText(m_attr.font.family()); connect(fdFontFamily, &QFontComboBox::currentFontChanged, this, [this](const QFont &f) { - QFont font(f.family(), m_attr.font.pixelSize()); - font.setBold(m_attr.font.bold()); - font.setItalic(m_attr.font.italic()); + auto font = qfont(f.family(), m_attr.font.pixelSize(), m_attr.font.bold(), m_attr.font.italic()); font.setUnderline(m_attr.font.underline()); m_attr.font = font; calAttr(); diff --git a/LedOK/program/eenviron.h b/LedOK/program/eenviron.h index 2a485de..03ae1a7 100644 --- a/LedOK/program/eenviron.h +++ b/LedOK/program/eenviron.h @@ -1,7 +1,7 @@ #ifndef EENVIRON_H #define EENVIRON_H #include "ebase.h" -#include +#include "gutil/qgui.h" class EEnviron : public EBase { Q_OBJECT @@ -18,7 +18,7 @@ public: int tempType = 0; int compensation = 0; - QFont font = QFont("Arial", 9); + QFont font = qfont("Arial", 12); QColor textColor = Qt::red; QColor backColor = Qt::transparent; int align = 0; diff --git a/LedOK/program/egif.cpp b/LedOK/program/egif.cpp index 72400e5..c1b8139 100644 --- a/LedOK/program/egif.cpp +++ b/LedOK/program/egif.cpp @@ -15,7 +15,8 @@ EGif *EGif::create(const QString &file, PageListItem *pageItem, EBase *multiWin) auto movie = new QMovie(file); if(! movie->isValid()) { QMessageBox::critical(gMainWin, "Gif Error", Tools::readErrStr(movie->lastError())+": "+movie->lastErrorString()+"\n"+file); - return nullptr; + delete movie; + return 0; } movie->setCacheMode(QMovie::CacheAll); movie->jumpToFrame(0); @@ -32,7 +33,10 @@ EGif *EGif::create(const QJsonObject &json, PageListItem *pageItem, EBase *multi else if(QFileInfo::exists(file = pageItem->mPageDir + "/" + name)) dir = pageItem->mPageDir; else return nullptr; auto movie = new QMovie(file); - if(! movie->isValid()) return nullptr; + if(! movie->isValid()) { + delete movie; + return 0; + } movie->setCacheMode(QMovie::CacheAll); movie->jumpToFrame(0); auto ins = new EGif(movie, dir, name, pageItem, multiWin); @@ -47,15 +51,15 @@ EGif::EGif(QMovie *movie, const QString &dir, const QString &name, PageListItem mType = EBase::Gif; } EGif::~EGif() { - if(mMovie!=nullptr) delete mMovie; + if(mMovie) delete mMovie; } void EGif::paint(QPainter *painter, const QStyleOptionGraphicsItem *a, QWidget *b) { - if(mMovie!=nullptr) { + if(mMovie) { painter->setRenderHints(QPainter::Antialiasing|QPainter::SmoothPixmapTransform); painter->drawPixmap(innerRect(), mMovie->currentPixmap(), QRectF()); - if(timer==nullptr) { + if(timer==0) { auto delay = mMovie->nextFrameDelay(); - if(delay!=0) { + if(delay) { timer = new SyncTimer(delay); connect(timer, &SyncTimer::timeout, this, &EGif::sltNext, Qt::BlockingQueuedConnection); timer->start(); @@ -65,33 +69,33 @@ void EGif::paint(QPainter *painter, const QStyleOptionGraphicsItem *a, QWidget * EBase::paint(painter, a, b); } void EGif::sltNext() { - if(isVisible() && mMovie!=nullptr) { + if(isVisible() && mMovie) { mMovie->jumpToNextFrame(); timer->inter = mMovie->nextFrameDelay(); update(); - } else if(timer!=nullptr) { + } else if(timer) { timer->stop(); - timer = nullptr; + timer = 0; } } void EGif::loadFiles() { - if(mMovie!=nullptr) return; + if(mMovie) return; if(! QFileInfo::exists(mDir + "/" + mName)) return; mMovie = new QMovie(mDir + "/" + mName, QByteArray()); mMovie->setCacheMode(QMovie::CacheAll); mMovie->jumpToFrame(0); } void EGif::freeFiles() { - if(mMovie==nullptr) return; + if(mMovie==0) return; delete mMovie; - mMovie = nullptr; + mMovie = 0; } QWidget* EGif::attrWgt() { - auto wgtAttr = new QWidget(); + auto wgtAttr = new QWidget; auto vBox = new QVBoxLayout(wgtAttr); vBox->setContentsMargins(6, 0, 6, 0); - if(mMultiWin!=nullptr) vBox->setSpacing(3); + if(mMultiWin) vBox->setSpacing(3); addBaseAttrWgt(vBox); @@ -122,6 +126,7 @@ QWidget* EGif::attrWgt() { auto movie = new QMovie(file); if(! movie->isValid()) { QMessageBox::critical(gMainWin, "Gif Error", Tools::readErrStr(movie->lastError())+": "+movie->lastErrorString()+"\n"+file); + delete movie; return; } movie->setCacheMode(QMovie::CacheAll); @@ -131,7 +136,7 @@ QWidget* EGif::attrWgt() { wFile->setText(mName); mDir = fileInfo.absolutePath(); gFileHome = mDir; - if(mMovie!=nullptr) delete mMovie; + if(mMovie) delete mMovie; mMovie = movie; }); hBox->addWidget(bnSelectFile); diff --git a/LedOK/program/emultiwin.cpp b/LedOK/program/emultiwin.cpp index e1e3620..3585783 100644 --- a/LedOK/program/emultiwin.cpp +++ b/LedOK/program/emultiwin.cpp @@ -55,11 +55,10 @@ EMultiWin::~EMultiWin() { void EMultiWin::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { if(inners.isEmpty()) { - QFont font("Arial", 12); QTextOption opt(Qt::AlignCenter); painter->save(); painter->fillRect(rect(),QColor(0, 0, 0)); - painter->setFont(font); + painter->setFont(qfont("Arial", 12)); painter->setPen(QColor(100, 100, 100)); painter->drawText(rect(), tr("Please add media on the right"), opt); painter->restore(); diff --git a/LedOK/program/etimer.cpp b/LedOK/program/etimer.cpp index 90e4de9..3762d79 100644 --- a/LedOK/program/etimer.cpp +++ b/LedOK/program/etimer.cpp @@ -3,7 +3,7 @@ #include "globaldefine.h" #include "base/lodateselector.h" #include "base/locolorselector.h" -#include +#include "gutil/qgui.h" #include #include #include @@ -26,7 +26,7 @@ ETimer::ETimer(EBase *multiWin) : EBase(multiWin) { attr.hasMin = true; attr.hasSec = true; attr.isMultiline = true; - attr.font = QFont("Arial", 9); + attr.font = qfont("Arial", 12); attr.textColor = Qt::red; attr.backColor = Qt::transparent; attr.duration = 10; @@ -44,9 +44,7 @@ ETimer::ETimer(const QJsonObject &json, EBase *multiWin) : EBase(multiWin){ attr.hasSec = json["hasSec"].toBool(); attr.text = json["text"].toString(); attr.isMultiline = json["isMultiline"].toBool(); - attr.font = QFont(json["font"].toString(), json["fontSize"].toInt()); - attr.font.setBold(json["fontBold"].toBool()); - attr.font.setItalic(json["fontItalic"].toBool()); + attr.font = qfont(json["font"].toString(), json["fontSize"].toInt(), json["fontBold"].toBool(), json["fontItalic"].toBool()); attr.font.setUnderline(json["fontUnderline"].toBool()); attr.textColor = json["textColor"].toString(); auto color = json["backColor"].toString(); diff --git a/LedOK/program/gentmpthread.cpp b/LedOK/program/gentmpthread.cpp index f184d4c..f9c89f3 100644 --- a/LedOK/program/gentmpthread.cpp +++ b/LedOK/program/gentmpthread.cpp @@ -463,7 +463,8 @@ QJsonObject GenTmpThread::convertDClock(const QJsonObject &json){ auto fontVal = widget["font"]; auto textColor = Tools::int2Color(fontVal["color"].toInt()); - QFont font(fontVal["family"].toString(), fontVal["size"].toInt()); + QFont font(fontVal["family"].toString()); + font.setPixelSize(fontVal["size"].toInt()); font.setBold(fontVal["bold"].toBool()); font.setItalic(fontVal["italics"].toBool()); font.setUnderline(fontVal["underline"].toBool()); @@ -565,7 +566,8 @@ QJsonObject GenTmpThread::convertTimer(const QJsonObject &json) { oRes["isMultiline"] = json["isMultiline"]; auto text = json["text"].toString(); oRes["text"] = text; - QFont font(json["font"].toString(), json["fontSize"].toInt()); + QFont font(json["font"].toString()); + font.setPixelSize(json["fontSize"].toInt()); font.setBold(json["fontBold"].toBool()); font.setItalic(json["fontItalic"].toBool()); font.setUnderline(json["fontUnderline"].toBool()); diff --git a/LedOK/program/progitem.cpp b/LedOK/program/progitem.cpp index da97cc4..f851bc9 100644 --- a/LedOK/program/progitem.cpp +++ b/LedOK/program/progitem.cpp @@ -63,8 +63,8 @@ QPushButton:hover { m_bnName->setCursor(QCursor(Qt::PointingHandCursor)); mTree->setItemWidget(this, ENUM_PROGRAMLISTHEADERITEM_NAME, m_bnName); connect(m_bnName, &QPushButton::clicked, this, [this] { - auto editor = new ProgEditorWin(this, gMainWin); - editor->show(); + ProgEditorWin editor(this, gMainWin); + editor.exec(); }); m_bnExport = new QPushButton(); m_bnExport->setCursor(QCursor(Qt::PointingHandCursor)); diff --git a/LedOK/translations/app_en.ts b/LedOK/translations/app_en.ts index a9727bc..cc14a31 100644 --- a/LedOK/translations/app_en.ts +++ b/LedOK/translations/app_en.ts @@ -2129,170 +2129,175 @@ CtrlHdmiPanel - + HDMI Configuration Video source configuration - + Manual Manual - + Schedule Schedule - - - - + + + + Tip Tip - - - - + + + + NoSelectedController Please select screen first - + SyncSwitch Switch video source from HDMI-IN port - - + + AnSyncSwitch Switch video source from Async box - + IsSync Readback video source - + Import File - + Save File Save file - - + + Sync Schedule - - + + SetTimingHdmiInTask Set video source form HDMI-IN schedule task - + GetTimingHdmiInTask Get video source form HDMI-IN schedule task - - + + Async Async - - + + Set + Set + + + + Readback Readback - + Start Time Start Time - + End Time End Time - + SUN SUN - + MON MON - + TUE TUE - + WED WED - + THU THU - + FRI FRI - + SAT SAT - + Add Add - - + + Apply Apply - + Clear Clear - + Delete Delete - + Import Import - + Export Export - + By default, the asynchronous content is played, and the synchronous signal content is played in the fixed time period By default, asynchronous content is played, and synchronous hdmi-in port input content is played in a fixed time period @@ -3912,116 +3917,116 @@ EAClock - + Basic Properties Basic properties - + Time Zone Time Zone - + Custom Dial Custom Dial - + Select Select - + Select Dail file Select dial file - + Hour Mark Hour Scale - - + + Circular Circle - - + + Rectangle Rectangle - + Number Number - - - + + + T - + Min Mark Minute Scale - + Color - + Length - + Width Width - + Hour Hand - + Min Hand - + Sec Hand - + Show - + Text Text - + Play Properties - + Play Duration Play Duration - + s s @@ -4141,139 +4146,139 @@ EDClock - + MON MON - + TUE TUE - + WED WED - + THU THU - + FRI FRI - + SAT SAT - + SUN SUN - - + + AM AM - - + + PM PM - + Basic Properties Basic properties - + Time Zone Time Zone - + Year Year - + Month Month - + Day Day - + Hour Hour - + Min. Min. - + Sec. Sec. - + Weekly Day of Week - + Full Year 4-Digit Year - + 12-Hour 12-Hour - + Date Style Date Format - + Time Style Time format - + Display Style Display style - + Multiline Multiline - + Play Properties - + Play Duration Play Duration - + s s @@ -4281,159 +4286,159 @@ EEnviron + + + - - - - - - + + + north north + + + + + + + east + east + + - east - east + + south + south - - - - - south - south - - - - - west west - - + + Temperature Temperature - - + + Humidity Humidity - - + + Noise Noise - + Wind Speed Wind Speed - + Wind Direction Wind Direction - + Basic Properties Basic properties - + Title Title - + Compensation Compensation - + Wind speed Wind speed - + Wind direction Wind direction - + Left Left - + Center Center - + Right Right - + Single scroll Single scroll - + Speed Speed - + ms/pixel ms/pixel - + Back Color Back Color - + Play Properties - + Refresh Cycle Refresh cycle - + min. min. - + Play Duration Play Duration - + s s @@ -4479,73 +4484,73 @@ EMultiWin - + Please add media on the right Please add media on the right. You can add multiple different media. The LED display will play in the order of the list - + Media List Media List - - - + + + Text Text - - - + + + Photo Photo - - - + + + Video Video - - - + + + Gif Gif - - - + + + DClock Clock - - - + + + AClock Analog Clock - - - + + + Select File Select File - - + + Environment Environmental Monitoring - - + + Timer Timer @@ -4864,87 +4869,87 @@ ETimer - + day Days - + hour Hours - + min Mins - + sec Secs - + Basic Properties Basic properties - + Count Down Count Down - + Count Up Count Up - + Time Target Time - + Day Day - + Hour Hour - + Min Min - + Sec Sec - + Multiline Multiline - + Text Text - + Play Properties - + Play Duration Play Duration - + s s @@ -5035,22 +5040,22 @@ EleTimer - + day Days - + hour Hours - + min Mins - + sec Secs @@ -5063,67 +5068,67 @@ Preparing ... - + MON MON - + TUE TUE - + WED WED - + THU THU - + FRI FRI - + SAT SAT - + SUN SUN - + AM AM - + PM PM - + day Days - + hour Hours - + min Mins - + sec Secs @@ -5138,6 +5143,14 @@ Scan program ... + + ImgDlg + + + Screenshot + + + LoColorSelector diff --git a/LedOK/translations/app_ja.ts b/LedOK/translations/app_ja.ts index b9c3179..69c540e 100644 --- a/LedOK/translations/app_ja.ts +++ b/LedOK/translations/app_ja.ts @@ -2129,170 +2129,175 @@ CtrlHdmiPanel - + HDMI Configuration ビデオソースの設定 - + Manual 手動 - + Schedule スケジュール - - - - + + + + Tip 提示 - - - - + + + + NoSelectedController 先に大きいスクリーンを選んでください - + SyncSwitch スイッチのビデオソースをHDMI-IN - - + + AnSyncSwitch 異ステップモードを切り替え - + IsSync 同じ非同期モードを読み返す - + Import File インポートファイル - + Save File 保存 - - + + Sync Schedule 同期モードタイミングタスク - - + + SetTimingHdmiInTask 同期モードタイミングタスクの設定 - + GetTimingHdmiInTask 同期モードタイミングタスクの取得 - - + + Async アシュリン - - + + Set + セット + + + + Readback 読み戻し - + Start Time 開始時間 - + End Time 終了時間 - + SUN 日曜日 - + MON 月曜日 - + TUE 火曜日 - + WED 水曜日 - + THU 木曜日 - + FRI 金曜日 - + SAT 土曜日 - + Add 追加 - - + + Apply 適用 - + Clear クリア - + Delete 削除 - + Import インポート - + Export 出力 - + By default, the asynchronous content is played, and the synchronous signal content is played in the fixed time period 非同期のコンテンツをデフォルトで再生し、同期のHMI-INポートに入力します @@ -3911,116 +3916,116 @@ EAClock - + Basic Properties 基本的な属性 - + Time Zone タイムゾーン - + Custom Dial ユーザー定義の文字盤 - + Select 選択 - + Select Dail file 文字盤の画像を選択 - + Hour Mark 時間目盛り - - + + Circular 円形 - - + + Rectangle 矩形 - + Number デジタル - - - + + + T - + Min Mark 分目盛り - + Color カラー - + Length 長さ - + Width - + Hour Hand 時針 - + Min Hand 分針 - + Sec Hand 秒針 - + Show 表示 - + Text テキスト - + Play Properties 再生方法 - + Play Duration 再生時間 - + s @@ -4140,139 +4145,139 @@ EDClock - + MON 月曜日 - + TUE 火曜日 - + WED 水曜日 - + THU 木曜日 - + FRI 金曜日 - + SAT 土曜日 - + SUN 日曜日 - - + + AM 午前 - - + + PM 午後 - + Basic Properties 基本的な属性 - + Time Zone タイムゾーン - + Year - + Month - + Day - + Hour - + Min. - + Sec. - + Weekly 曜日 - + Full Year 四桁数の年 - + 12-Hour 12時 - + Date Style 日付スタイル - + Time Style タイムスタイル - + Display Style 表示スタイル - + Multiline 複数行表示 - + Play Properties 再生方法 - + Play Duration 再生時間 - + s @@ -4280,159 +4285,159 @@ EEnviron + + + - - - - - - + + + north 北の方 + + + + + + + east + + + - east - + + south + 南の方 - - - - - south - 南の方 - - - - - west 西の方 - - + + Temperature 温度 - - + + Humidity 湿度 - - + + Noise ノイズ - + Wind Speed 風速 - + Wind Direction 風向 - + Basic Properties 基本的な属性 - + Title タイトル - + Compensation 補償 - + Wind speed 風速 - + Wind direction 風向 - + Left 左に寄る - + Center 中央にある - + Right 右に寄る - + Single scroll 1行スクロール - + Speed スピード - + ms/pixel ミリ秒/ピクセル - + Back Color 背景色 - + Play Properties 再生方法 - + Refresh Cycle リフレッシュサイクル - + min. - + Play Duration 再生時間 - + s @@ -4478,73 +4483,73 @@ EMultiWin - + Please add media on the right 右側にメディアを追加してください。複数のメディアに参加できます。LEDディスプレイはリスト順に再生されます - + Media List メディアリスト - - - + + + Text テキスト - - - + + + Photo 写真 - - - + + + Video 動画リスト - - - + + + Gif アニメーション - - - + + + DClock デジタル時計 - - - + + + AClock アナログ時計 - - - + + + Select File ファイルを選択 - - + + Environment 環境モニタリング - - + + Timer タイマー @@ -4863,87 +4868,87 @@ ETimer - + day - + hour - + min - + sec - + Basic Properties 基本的な属性 - + Count Down カウントダウン - + Count Up カウントアップ - + Time 目標時間 - + Day - + Hour - + Min - + Sec - + Multiline 複数行表示 - + Text テキスト - + Play Properties 再生方法 - + Play Duration 再生時間 - + s @@ -5034,22 +5039,22 @@ EleTimer - + day - + hour - + min - + sec @@ -5062,67 +5067,67 @@ 準備... - + MON 月曜日 - + TUE 火曜日 - + WED 水曜日 - + THU 木曜日 - + FRI 金曜日 - + SAT 土曜日 - + SUN 日曜日 - + AM 午前 - + PM 午後 - + day - + hour - + min - + sec @@ -5137,6 +5142,14 @@ スキャン番組… + + ImgDlg + + + Screenshot + スクリーンショット + + LoColorSelector diff --git a/LedOK/translations/app_zh_CN.ts b/LedOK/translations/app_zh_CN.ts index 3833a31..55a257f 100644 --- a/LedOK/translations/app_zh_CN.ts +++ b/LedOK/translations/app_zh_CN.ts @@ -2129,170 +2129,175 @@ CtrlHdmiPanel - + HDMI Configuration 画面输入源配置 - + Manual 手动 - + Schedule 定时 - - - - + + + + Tip 提示 - - - - + + + + NoSelectedController 请先选择大屏幕 - + SyncSwitch 切换同步模式 - - + + AnSyncSwitch 切换异步模式 - + IsSync 回读同异步模式 - + Import File 导入文件 - + Save File 保存文件 - - + + Sync Schedule 同步定时任务 - - + + SetTimingHdmiInTask 设置同步模式定时任务 - + GetTimingHdmiInTask 获取同步模式定时任务 - - + + Async 异步 - - + + Set + 设置 + + + + Readback 回读 - + Start Time 开始时间 - + End Time 结束时间 - + SUN 星期日 - + MON 星期一 - + TUE 星期二 - + WED 星期三 - + THU 星期四 - + FRI 星期五 - + SAT 星期六 - + Add 添加 - - + + Apply 应用 - + Clear 清空 - + Delete 删除 - + Import 导入 - + Export 导出 - + By default, the asynchronous content is played, and the synchronous signal content is played in the fixed time period 默认播放异步内容,定时时间段内播放同步HDMI-IN端口输入内容 @@ -3912,116 +3917,116 @@ EAClock - + Basic Properties 基本属性 - + Time Zone 时区 - + Custom Dial 自定义表盘 - + Select 选择 - + Select Dail file 选择表盘图片 - + Hour Mark 时标 - - + + Circular 圆形 - - + + Rectangle 矩形 - + Number 数字 - - - + + + T - + Min Mark 分标 - + Color 颜色 - + Length - + Width - + Hour Hand 时针 - + Min Hand 分针 - + Sec Hand 秒针 - + Show 显示 - + Text 文本 - + Play Properties 播放方式 - + Play Duration 播放时长 - + s @@ -4141,139 +4146,139 @@ EDClock - + MON 星期一 - + TUE 星期二 - + WED 星期三 - + THU 星期四 - + FRI 星期五 - + SAT 星期六 - + SUN 星期日 - - + + AM 上午 - - + + PM 下午 - + Basic Properties 基本属性 - + Time Zone 时区 - + Year - + Month - + Day - + Hour - + Min. - + Sec. - + Weekly 星期 - + Full Year 四位年 - + 12-Hour 12小时制 - + Date Style 日期风格 - + Time Style 时间风格 - + Display Style 显示风格 - + Multiline 多行显示 - + Play Properties 播放方式 - + Play Duration 播放时长 - + s @@ -4281,159 +4286,159 @@ EEnviron + + + - - - - - - + + + north + + + + + + + east + + + - east - + + south + - - - - - south - - - - - - west 西 - - + + Temperature 温度 - - + + Humidity 湿度 - - + + Noise 噪音 - + Wind Speed 风速 - + Wind Direction 风向 - + Basic Properties 基本属性 - + Title 标题 - + Compensation 补偿 - + Wind speed 风速 - + Wind direction 风向 - + Left 靠左 - + Center 居中 - + Right 靠右 - + Single scroll 单行滚动 - + Speed 速度 - + ms/pixel 毫秒/像素 - + Back Color 背景色 - + Play Properties 播放方式 - + Refresh Cycle 刷新周期 - + min. 分钟 - + Play Duration 播放时长 - + s @@ -4479,73 +4484,73 @@ EMultiWin - + Please add media on the right 请在右边添加媒体,可以加入多个不同媒体,LED显示屏将按列表先后顺序播放 - + Media List 媒体列表 - - - + + + Text 文本 - - - + + + Photo 图片 - - - + + + Video 视频 - - - + + + Gif 动画 - - - + + + DClock 数字时钟 - - - + + + AClock 模拟时钟 - - - + + + Select File 选择文件 - - + + Environment 环境监测 - - + + Timer 计时器 @@ -4864,87 +4869,87 @@ ETimer - + day - + hour - + min - + sec - + Basic Properties 基本属性 - + Count Down 倒计时 - + Count Up 正计时 - + Time 目标时间 - + Day - + Hour - + Min - + Sec - + Multiline 多行显示 - + Text 文本 - + Play Properties 播放方式 - + Play Duration 播放时长 - + s @@ -5035,22 +5040,22 @@ EleTimer - + day - + hour - + min - + sec @@ -5063,67 +5068,67 @@ 准备中... - + MON 星期一 - + TUE 星期二 - + WED 星期三 - + THU 星期四 - + FRI 星期五 - + SAT 星期六 - + SUN 星期日 - + AM 上午 - + PM 下午 - + day - + hour - + min - + sec @@ -5138,6 +5143,14 @@ 扫描节目... + + ImgDlg + + + Screenshot + 屏幕截图 + + LoColorSelector @@ -5563,7 +5576,7 @@ 分辨率 - + Solution Information 节目信息 diff --git a/LedOK/translations/app_zh_TW.ts b/LedOK/translations/app_zh_TW.ts index d412d63..bbdf10f 100644 --- a/LedOK/translations/app_zh_TW.ts +++ b/LedOK/translations/app_zh_TW.ts @@ -2139,170 +2139,175 @@ CtrlHdmiPanel - + HDMI Configuration 畫面輸入源配寘 - + Manual 手動 - + Schedule 定時 - - - - + + + + Tip 提示 - - - - + + + + NoSelectedController 請先選擇大螢幕 - + SyncSwitch 切換同步模式 - - + + AnSyncSwitch 切換異步模式 - + IsSync 回讀同非同步模式 - + Import File 導入檔案 - + Save File 保存 - - + + Sync Schedule 同步定時任務 - - + + SetTimingHdmiInTask 設定同步模式定時任務 - + GetTimingHdmiInTask 獲取同步模式定時任務 - - + + Async BOX - - + + Set + 設定 + + + + Readback 回讀 - + Start Time 開始時間 - + End Time 結束時間 - + SUN 星期日 - + MON 星期一 - + TUE 星期二 - + WED 星期三 - + THU 星期四 - + FRI 星期五 - + SAT 星期六 - + Add 添加 - - + + Apply 應用 - + Clear 清空 - + Delete 删除 - + Import 導入 - + Export 匯出 - + By default, the asynchronous content is played, and the synchronous signal content is played in the fixed time period 默認播放非同步內容,定時時間段內播放同步HDMI-IN埠輸入內容 @@ -3920,116 +3925,116 @@ EAClock - + Basic Properties 基本屬性 - + Time Zone 時區 - + Custom Dial 自定義錶盤 - + Select 選擇 - + Select Dail file 選擇錶盤圖片 - + Hour Mark 時標 - - + + Circular 圓形 - - + + Rectangle 矩形 - + Number 數位 - - - + + + T - + Min Mark 分標 - + Color 顏色 - + Length - + Width - + Hour Hand 時針 - + Min Hand 分針 - + Sec Hand 分針 - + Show 顯示 - + Text 文字 - + Play Properties 播放管道 - + Play Duration 播放時長 - + s @@ -4149,139 +4154,139 @@ EDClock - + MON 星期一 - + TUE 星期二 - + WED 星期三 - + THU 星期四 - + FRI 星期五 - + SAT 星期六 - + SUN 星期日 - - + + AM 上午 - - + + PM 下午 - + Basic Properties 基本屬性 - + Time Zone 時區 - + Year - + Month - + Day - + Hour - + Min. - + Sec. - + Weekly 星期 - + Full Year 四位年 - + 12-Hour 12小時制 - + Date Style 日期風格 - + Time Style 時間風格 - + Display Style 顯示風格 - + Multiline 多行顯示 - + Play Properties 播放管道 - + Play Duration 播放時長 - + s @@ -4289,159 +4294,159 @@ EEnviron + + + - - - - - - + + + north + + + + + + + east + + + - east - + + south + - - - - - south - - - - - - west 西 - - + + Temperature 溫度 - - + + Humidity 濕度 - - + + Noise 譟音 - + Wind Speed 風速 - + Wind Direction 風向 - + Basic Properties 基本屬性 - + Title 標題 - + Compensation 補償 - + Wind speed 風速 - + Wind direction 風向 - + Left 靠左 - + Center 居中 - + Right 靠右 - + Single scroll 單行滾動 - + Speed 速度 - + ms/pixel 毫秒/點數 - + Back Color 背景色 - + Play Properties 播放管道 - + Refresh Cycle 重繪週期 - + min. 分鐘 - + Play Duration 播放時長 - + s @@ -4487,73 +4492,73 @@ EMultiWin - + Please add media on the right 請在右邊添加媒體,可以加入多個不同媒體,LED顯示幕將按清單先後順序播放 - + Media List 媒體清單 - - - + + + Text 文字 - - - + + + Photo 圖片 - - - + + + Video 視頻 - - - + + + Gif 動畫 - - - + + + DClock 數位時鐘 - - - + + + AClock 圓形時鐘 - - - + + + Select File 選擇檔案 - - + + Environment 環境監測 - - + + Timer 計時器 @@ -4872,87 +4877,87 @@ ETimer - + day - + hour - + min - + sec - + Basic Properties 基本屬性 - + Count Down 倒數計時 - + Count Up 正計時 - + Time 目標時間 - + Day - + Hour - + Min - + Sec - + Multiline 多行顯示 - + Text 文字 - + Play Properties 播放管道 - + Play Duration 播放時長 - + s @@ -5043,22 +5048,22 @@ EleTimer - + day - + hour - + min - + sec @@ -5071,67 +5076,67 @@ 準備中… - + MON 星期一 - + TUE 星期二 - + WED 星期三 - + THU 星期四 - + FRI 星期五 - + SAT 星期六 - + SUN 星期日 - + AM 上午 - + PM 下午 - + day - + hour - + min - + sec @@ -5146,6 +5151,14 @@ 掃描節目… + + ImgDlg + + + Screenshot + 螢幕截圖 + + LoColorSelector