From dc2a505a3529d053cb143817a8fefd2a876a51d2 Mon Sep 17 00:00:00 2001 From: gangphon Date: Mon, 8 May 2023 09:59:15 +0800 Subject: [PATCH] ledok --- LedOK/LedOK.pro | 3 - LedOK/base/updateledset3dialog.cpp | 81 ------------ LedOK/base/updateledset3dialog.h | 30 ----- LedOK/base/updateledset3dialog.ui | 204 ----------------------------- LedOK/device/ctrladvancedpanel.cpp | 33 ++--- LedOK/device/upgradeapkdialog.cpp | 24 ++-- LedOK/passwordindlg.cpp | 2 +- LedOK/player/playwin.cpp | 3 +- LedOK/program/eweb.cpp | 4 +- LedOK/program/eweb.h | 3 +- LedOK/program/progcreatedlg.cpp | 2 + LedOK/program/progeditorwin.cpp | 1 + LedOK/program/progitem.cpp | 2 +- LedOK/translations/app_en.ts | 4 +- LedOK/translations/app_ja.ts | 4 +- LedOK/translations/app_zh_CN.ts | 4 +- LedOK/translations/app_zh_TW.ts | 4 +- 17 files changed, 35 insertions(+), 373 deletions(-) delete mode 100644 LedOK/base/updateledset3dialog.cpp delete mode 100644 LedOK/base/updateledset3dialog.h delete mode 100644 LedOK/base/updateledset3dialog.ui diff --git a/LedOK/LedOK.pro b/LedOK/LedOK.pro index 18e198a..000b9bd 100644 --- a/LedOK/LedOK.pro +++ b/LedOK/LedOK.pro @@ -58,7 +58,6 @@ SOURCES += \ base/softconfigdialog.cpp \ base/switchcontrol.cpp \ base/taesclass.cpp \ - base/updateledset3dialog.cpp \ base/x_checkboxdelegate.cpp \ base/x_spinboxdelegate.cpp \ base/x_timeeditdelegate.cpp \ @@ -148,7 +147,6 @@ HEADERS += \ base/softconfigdialog.h \ base/switchcontrol.h \ base/taesclass.h \ - base/updateledset3dialog.h \ base/x_checkboxdelegate.h \ base/x_spinboxdelegate.h \ base/x_timeeditdelegate.h \ @@ -230,7 +228,6 @@ HEADERS += \ program/wprogrampublishitem.h \ FORMS += \ - base/updateledset3dialog.ui \ base/x_uimsgboxok.ui \ mguangyingpinwidget.ui \ device/controlpowerschedule.ui \ diff --git a/LedOK/base/updateledset3dialog.cpp b/LedOK/base/updateledset3dialog.cpp deleted file mode 100644 index 494ca56..0000000 --- a/LedOK/base/updateledset3dialog.cpp +++ /dev/null @@ -1,81 +0,0 @@ -#include "updateledset3dialog.h" -#include "ui_updateledset3dialog.h" -#include -#include - -extern const QString DEFS_LEDSET_URL = "https://www.ledok.cn/download/definitions/ledset3updates.json"; - -UpdateLedset3Dialog::UpdateLedset3Dialog(QWidget *parent) : - BaseDlg(parent), - ui(new Ui::UpdateLedset3Dialog) -{ - setAttribute(Qt::WA_DeleteOnClose); - ui->setupUi(this); - ui->pushButton_2->setVisible(false); - - QString strCurApkVersion=""; - QSettings settings; - strCurApkVersion = settings.value(DEFS_LEDSET_URL).toString(); - if(strCurApkVersion.isEmpty()) strCurApkVersion="0.0.0"; - strCurApkVersion="0.0.0"; - - ui->label_2->setText(tr("CurVersion")+":"+strCurApkVersion); - ui->label_2->setVisible(false); - - QSimpleUpdater *m_updater=QSimpleUpdater::getInstance(); - connect(ui->pushButton_2, SIGNAL(clicked()), this, SLOT(OnCheckForUpdates())); - connect(m_updater,SIGNAL(checkingFinished(QString)),this,SLOT(updateChangelog(QString))); - connect(m_updater,SIGNAL(downloadFinished(QString,QString)),this,SLOT(OnDownloadFinished(QString,QString))); - - m_updater->getInstance()->setModuleVersion(DEFS_LEDSET_URL,strCurApkVersion); - m_updater->getInstance()->setNotifyOnUpdate(DEFS_LEDSET_URL,false); - m_updater->getInstance()->setNotifyOnFinish(DEFS_LEDSET_URL,false); - m_updater->getInstance()->setCompareBySameString(DEFS_LEDSET_URL,true); - m_updater->getInstance()->checkForUpdates(DEFS_LEDSET_URL); - ui->pushButton->setProperty("ssType", "progManageTool"); - ui->pushButton_2->setProperty("ssType", "progManageTool"); -} - -UpdateLedset3Dialog::~UpdateLedset3Dialog() -{ - delete ui; -} -void UpdateLedset3Dialog::OnDownloadFinished( QString url, QString filepath) -{ - ui->label_2->setText(tr("CurVersion")+":"+m_updater->getInstance()->getLatestVersion(DEFS_LEDSET_URL)); - ui->textEdit->setText(tr("Apk is download finished from internet,you can select LED Screen SYNC firmware now!")); - ui->pushButton_2->setVisible(false); - QSettings settings; - settings.setValue(url, m_strLastestVersion); - settings.setValue("ledset", filepath); -} - -void UpdateLedset3Dialog::OnCheckForUpdates() -{ - m_updater->getInstance()->setNotifyOnUpdate(DEFS_LEDSET_URL,true); - m_updater->getInstance()->setNotifyOnFinish(DEFS_LEDSET_URL,false); - // m_updater->getInstance()->setUseCustomInstallProcedures(DEFS_LEDSET_URL,true); - m_updater->getInstance()->setNoNotifyDownload(DEFS_LEDSET_URL,true); - m_updater->getInstance()->setCompareBySameString(DEFS_LEDSET_URL,true); - m_updater->getInstance()->setMandatoryUpdate(DEFS_LEDSET_URL,false); - m_updater->getInstance()->checkForUpdates(DEFS_LEDSET_URL); - -} -void UpdateLedset3Dialog::updateChangelog(QString strTip) -{ - Q_UNUSED(strTip) - - if(m_updater->getInstance()->getUpdateAvailable(DEFS_LEDSET_URL)) - { - QString strtip=tr("LatestVersion:"); - m_strLastestVersion=m_updater->getInstance()->getLatestVersion(DEFS_LEDSET_URL); - strtip+= m_strLastestVersion +"\r\n"; - strtip+= tr("Update log:")+"\r\n"+m_updater->getInstance()->getChangelog (DEFS_LEDSET_URL) ; - ui->textEdit->setText(strtip); - ui->pushButton_2->setVisible(true); - } - else { - ui->textEdit->setText(tr("The current version is already the latest version,,you can select LED Screen SYNC firmware now!")); - } - disconnect(m_updater,SIGNAL(checkingFinished(QString)),this,SLOT(updateChangelog(QString))); -} diff --git a/LedOK/base/updateledset3dialog.h b/LedOK/base/updateledset3dialog.h deleted file mode 100644 index 716a9f4..0000000 --- a/LedOK/base/updateledset3dialog.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef UPDATELEDSET3DIALOG_H -#define UPDATELEDSET3DIALOG_H - -#include -#include - -namespace Ui { -class UpdateLedset3Dialog; -} - -class UpdateLedset3Dialog : public BaseDlg -{ - Q_OBJECT - -public: - explicit UpdateLedset3Dialog(QWidget *parent = nullptr); - ~UpdateLedset3Dialog(); - -private: - Ui::UpdateLedset3Dialog *ui; - QSimpleUpdater *m_updater; - QString m_strLastestVersion=""; -protected slots: - void OnCheckForUpdates() ; - void updateChangelog(QString); - void OnDownloadFinished( QString url, QString filepath); - -}; - -#endif // UPDATELEDSET3DIALOG_H diff --git a/LedOK/base/updateledset3dialog.ui b/LedOK/base/updateledset3dialog.ui deleted file mode 100644 index 1ddf1e9..0000000 --- a/LedOK/base/updateledset3dialog.ui +++ /dev/null @@ -1,204 +0,0 @@ - - - UpdateLedset3Dialog - - - - 0 - 0 - 381 - 272 - - - - - - 0 - 0 - 382 - 275 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - 0 - - - - - LedSet3.0 Update - - - Qt::AlignCenter - - - - - - - - 30 - 24 - - - - X - - - - - - - - - border-top: 2px solid gray; - - - Qt::Horizontal - - - - - - - - - - - - 0 - 0 - - - - - 64 - 64 - - - - image: url(:/res/ledset.png); - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - 0 - 0 - - - - - 14 - - - - V1.0.0 - - - Qt::AlignCenter - - - - - - - true - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - - 80 - 16777215 - - - - Update - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - pushButton - clicked() - UpdateLedset3Dialog - close() - - - 355 - 22 - - - 190 - 135 - - - - - diff --git a/LedOK/device/ctrladvancedpanel.cpp b/LedOK/device/ctrladvancedpanel.cpp index c1a3430..56cfd3d 100644 --- a/LedOK/device/ctrladvancedpanel.cpp +++ b/LedOK/device/ctrladvancedpanel.cpp @@ -1,9 +1,6 @@ #include "ctrladvancedpanel.h" -#include "deviceitem.h" #include "globaldefine.h" #include "base/waitingdlg.h" -#include "base/changepasswordform.h" -#include "base/updateledset3dialog.h" #include "passwordindlg.h" #include "tools.h" #include "gutil/qgui.h" @@ -927,7 +924,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) { btnLedSet3 = new QPushButton; btnLedSet3->setMinimumHeight(34); btnLedSet3->setProperty("ssType", "progManageTool"); - connect(btnLedSet3, &QPushButton::clicked, this, [this] { + connect(btnLedSet3, &QPushButton::clicked, this, [] { QString strLedSetFile = QApplication::applicationDirPath()+"/LedSet/LedSet3.0.exe"; QFileInfo cc22(strLedSetFile); if(cc22.exists()) { @@ -939,13 +936,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) { if(!strLedsetPath.isEmpty()) { QFileInfo cc(strLedsetPath); if(cc.exists()) QProcess::startDetached(strLedsetPath,QStringList()); - else { - auto res = QMessageBox::question(gMainWin, tr("Tip Info"), tr("Can not find LedSet3.0.exe,down you need download and install it")+strLedsetPath); - if(res == QMessageBox::Yes) { - UpdateLedset3Dialog *pDlg=new UpdateLedset3Dialog(this); - pDlg->exec(); - } - } + else QMessageBox::critical(gMainWin, tr("Tip Info"), tr("Can not find LedSet3.0.exe")+strLedsetPath); return; } QSettings reg1("HKEY_LOCAL_MACHINE\\SOFTWARE\\sysolution\\LedSet3.0", QSettings::NativeFormat); @@ -961,13 +952,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) { QString str2="C:/Program Files (x86)/sysolution/LedSet3.0/LedSet3.0.exe"; QFileInfo cc2(str1); if(cc2.exists()) QProcess::startDetached(str2,QStringList()); - else { - auto res = QMessageBox::question(gMainWin, tr("Tip Info"), tr("Can not find LedSet3.0.exe,down you need download and install it")+strLedsetPath); - if(res == QMessageBox::Yes) { - UpdateLedset3Dialog *pDlg=new UpdateLedset3Dialog(this); - pDlg->exec(); - } - } + else QMessageBox::critical(gMainWin, tr("Tip Info"), tr("Can not find LedSet3.0.exe")+strLedsetPath); } } } else { @@ -978,13 +963,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) { QString str2="C:/Program Files (x86)/sysolution/LedSet3.0/LedSet3.0.exe"; QFileInfo cc2(str1); if(cc2.exists())QProcess::startDetached(str2,QStringList()); - else { - auto res = QMessageBox::question(gMainWin, tr("Tip Info"), tr("Can not find LedSet3.0.exe,down you need download and install it")+strLedsetPath); - if(res == QMessageBox::Yes) { - UpdateLedset3Dialog *pDlg=new UpdateLedset3Dialog(this); - pDlg->exec(); - } - } + else QMessageBox::critical(gMainWin, tr("Tip Info"), tr("Can not find LedSet3.0.exe")+strLedsetPath); } } }); @@ -999,6 +978,10 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) { }); hBox->addWidget(btnLedSet4); +#ifndef Q_OS_WINDOWS + btnLedSet3->setVisible(false); + btnLedSet4->setVisible(false); +#endif auto line = new QFrame; line->setFrameShape(QFrame::HLine); diff --git a/LedOK/device/upgradeapkdialog.cpp b/LedOK/device/upgradeapkdialog.cpp index 390c0c0..54dd6a3 100644 --- a/LedOK/device/upgradeapkdialog.cpp +++ b/LedOK/device/upgradeapkdialog.cpp @@ -12,6 +12,7 @@ #include #include #include +#include UpgradeApkDialog::UpgradeApkDialog(QWidget *parent) : QDialog(parent) { resize(1280, 720); @@ -76,7 +77,9 @@ UpgradeApkDialog::UpgradeApkDialog(QWidget *parent) : QDialog(parent) { return; } QDialog dlg(this); - dlg.setWindowFlag(Qt::WindowContextHelpButtonHint, false); +#ifdef Q_OS_WIN + dlg.setWindowFlag(Qt::WindowContextHelpButtonHint, 0); +#endif dlg.setWindowTitle(tr("Select Online APK")); dlg.resize(800, 500); @@ -105,15 +108,13 @@ UpgradeApkDialog::UpgradeApkDialog(QWidget *parent) : QDialog(parent) { }); vBox->addWidget(table); - auto hBox = new HBox(vBox); - hBox->addStretch(); - auto btnOk = new QPushButton("确定"); - btnOk->setMinimumWidth(80); - connect(btnOk, &QPushButton::clicked, &dlg, [=, &dlg] { + auto btnBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Close); + connect(btnBox, &QDialogButtonBox::rejected, &dlg, &QDialog::reject); + connect(btnBox, &QDialogButtonBox::accepted, &dlg, [=, &dlg] { auto sels = table->selectedRanges(); if(sels.isEmpty()) { - QMessageBox::warning(&dlg, "Warning", "请选择文件"); + QMessageBox::warning(&dlg, "Warning", tr("Please select a file")); return; } auto row = sels[0].topRow(); @@ -122,14 +123,7 @@ UpgradeApkDialog::UpgradeApkDialog(QWidget *parent) : QDialog(parent) { filePath = ""; dlg.accept(); }); - hBox->addWidget(btnOk); - hBox->addStretch(); - - auto btnClose = new QPushButton("关闭"); - btnClose->setMinimumWidth(80); - connect(btnClose, &QPushButton::clicked, &dlg, &QDialog::reject); - hBox->addWidget(btnClose); - hBox->addStretch(); + vBox->addWidget(btnBox); dlg.exec(); }); diff --git a/LedOK/passwordindlg.cpp b/LedOK/passwordindlg.cpp index 4e18ec8..ef4c38e 100644 --- a/LedOK/passwordindlg.cpp +++ b/LedOK/passwordindlg.cpp @@ -27,6 +27,6 @@ PasswordInChDlg::PasswordInChDlg(QWidget *parent) : QDialog(parent) { vBox->addStretch(); btnBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); - vBox->addWidget(btnBox); connect(btnBox, &QDialogButtonBox::rejected, this, &QDialog::reject); + vBox->addWidget(btnBox); } diff --git a/LedOK/player/playwin.cpp b/LedOK/player/playwin.cpp index beb0bbf..68514e4 100644 --- a/LedOK/player/playwin.cpp +++ b/LedOK/player/playwin.cpp @@ -8,7 +8,6 @@ #include "elescroll.h" #include "eletimer.h" #include "elevideo.h" -#include "gutil/qgui.h" #include "posdlg.h" #include #include @@ -20,7 +19,7 @@ #include #include -PlayWin* PlayWin::self = nullptr; +PlayWin* PlayWin::self = 0; QPoint gPlayPos{0, 0}; Page::Page(QWidget *parent) : QWidget{parent} { diff --git a/LedOK/program/eweb.cpp b/LedOK/program/eweb.cpp index 1a4b6de..cafd0b2 100644 --- a/LedOK/program/eweb.cpp +++ b/LedOK/program/eweb.cpp @@ -1,8 +1,10 @@ #include "eweb.h" -#include "program/progeditorwin.h" #include #include #include +#include +#include +#include EWeb::EWeb(EBase *multiWin) : EBase(multiWin) { mType = EBase::Web; diff --git a/LedOK/program/eweb.h b/LedOK/program/eweb.h index 7b08a96..e4bc5bf 100644 --- a/LedOK/program/eweb.h +++ b/LedOK/program/eweb.h @@ -1,8 +1,7 @@ #ifndef EWEB_H #define EWEB_H + #include "ebase.h" -#include "synctimer.h" -#include class EWeb : public EBase { Q_OBJECT diff --git a/LedOK/program/progcreatedlg.cpp b/LedOK/program/progcreatedlg.cpp index e20ed9a..c0b31ad 100644 --- a/LedOK/program/progcreatedlg.cpp +++ b/LedOK/program/progcreatedlg.cpp @@ -5,7 +5,9 @@ #include ProgCreateDlg::ProgCreateDlg(QString name, int width, int height, QString remarks, QString widths, QWidget *parent) : QDialog(parent) { +#ifdef Q_OS_WINDOWS setWindowFlag(Qt::WindowContextHelpButtonHint, 0); +#endif setWindowTitle(tr("Solution Information")); auto vBox = new VBox(this); auto hBox = new HBox(vBox); diff --git a/LedOK/program/progeditorwin.cpp b/LedOK/program/progeditorwin.cpp index 29949fe..9f65902 100644 --- a/LedOK/program/progeditorwin.cpp +++ b/LedOK/program/progeditorwin.cpp @@ -33,6 +33,7 @@ #include #include #include +#include ProgItem *gProgItem{0}; QWidget *gProgEditorWin; diff --git a/LedOK/program/progitem.cpp b/LedOK/program/progitem.cpp index 9e5e097..554af18 100644 --- a/LedOK/program/progitem.cpp +++ b/LedOK/program/progitem.cpp @@ -170,6 +170,7 @@ void ProgItem::onUsbExportProgram() { vBox->addWidget(fdDrives); auto btnBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); + connect(btnBox, &QDialogButtonBox::rejected, &dlg, &QDialog::reject); connect(btnBox, &QDialogButtonBox::accepted, &dlg, [=, &dlg] { auto selects = fdDrives->selectedItems(); if(selects.count() > 0) { @@ -188,7 +189,6 @@ void ProgItem::onUsbExportProgram() { if(fdDrives->count() <= 0) QMessageBox::warning(&dlg, tr("Tip"),tr("No checked USB device")); else QMessageBox::warning(&dlg, tr("Tip"),tr("please select usb device in list")); }); - connect(btnBox, &QDialogButtonBox::rejected, &dlg, &QDialog::reject); vBox->addWidget(btnBox); fdDrives->clear(); diff --git a/LedOK/translations/app_en.ts b/LedOK/translations/app_en.ts index cc14a31..1c7d48a 100644 --- a/LedOK/translations/app_en.ts +++ b/LedOK/translations/app_en.ts @@ -1202,8 +1202,8 @@ - Can not find LedSet3.0.exe,down you need download and install it - Can not find LedSet3.0.exe,down you need download and install it + Can not find LedSet3.0.exe + diff --git a/LedOK/translations/app_ja.ts b/LedOK/translations/app_ja.ts index 69c540e..3d197b7 100644 --- a/LedOK/translations/app_ja.ts +++ b/LedOK/translations/app_ja.ts @@ -1202,8 +1202,8 @@ - Can not find LedSet3.0.exe,down you need download and install it - LEDSET 3.0 . exeを見つけることができません。ダウンロードしてインストールする必要があります + Can not find LedSet3.0.exe + LedSet3.0.exe を見つけることができません diff --git a/LedOK/translations/app_zh_CN.ts b/LedOK/translations/app_zh_CN.ts index 55a257f..bf45ba7 100644 --- a/LedOK/translations/app_zh_CN.ts +++ b/LedOK/translations/app_zh_CN.ts @@ -1202,8 +1202,8 @@ - Can not find LedSet3.0.exe,down you need download and install it - 找不到LedSet3.0.exe,确认下载并安装 + Can not find LedSet3.0.exe + 找不到 LedSet3.0.exe diff --git a/LedOK/translations/app_zh_TW.ts b/LedOK/translations/app_zh_TW.ts index bbdf10f..25f1159 100644 --- a/LedOK/translations/app_zh_TW.ts +++ b/LedOK/translations/app_zh_TW.ts @@ -1254,8 +1254,8 @@ - Can not find LedSet3.0.exe,down you need download and install it - 找不到LedSet3.0.exe,確認下載並安裝 + Can not find LedSet3.0.exe + 找不到 LedSet3.0.exe,確認下載並安裝