From f9db8e5e85ae595b866657dddc3846d11f0d7454 Mon Sep 17 00:00:00 2001 From: Gangphon Date: Fri, 21 Apr 2023 11:06:47 +0800 Subject: [PATCH] ledok --- LedOK/LedOK.pro | 2 +- LedOK/basewin.cpp | 1 - LedOK/device/ctrladvancedpanel.h | 1 + LedOK/device/ctrlnetworkpanel.h | 1 + LedOK/ffplayer.h | 1 + LedOK/program/ebase.h | 2 +- LedOK/program/progeditorwin.h | 1 + LedOK/program/usbdetectdialog.cpp | 26 +++----------------------- LedOK/program/usbdetectdialog.h | 6 ------ LedOK/program/videosplitthread.h | 1 + LedOK/synctimer.cpp | 7 ++++++- 11 files changed, 16 insertions(+), 33 deletions(-) diff --git a/LedOK/LedOK.pro b/LedOK/LedOK.pro index 72f0298..8b7649c 100644 --- a/LedOK/LedOK.pro +++ b/LedOK/LedOK.pro @@ -8,7 +8,7 @@ QT += webenginewidgets greaterThan(QT_MAJOR_VERSION, 5) { QT += openglwidgets } -CONFIG += c++20 +CONFIG += c++14 CONFIG += lrelease CONFIG += embed_translations # CONFIG += console diff --git a/LedOK/basewin.cpp b/LedOK/basewin.cpp index 7ce16c3..15d8454 100644 --- a/LedOK/basewin.cpp +++ b/LedOK/basewin.cpp @@ -4,7 +4,6 @@ #include #include #include -#include BaseWin::BaseWin(QWidget *parent) : QWidget(parent){ setWindowFlag(Qt::FramelessWindowHint); diff --git a/LedOK/device/ctrladvancedpanel.h b/LedOK/device/ctrladvancedpanel.h index 52b83a3..e75af53 100644 --- a/LedOK/device/ctrladvancedpanel.h +++ b/LedOK/device/ctrladvancedpanel.h @@ -11,6 +11,7 @@ #include #include #include +#include class CtrlAdvancedPanel : public QWidget { Q_OBJECT diff --git a/LedOK/device/ctrlnetworkpanel.h b/LedOK/device/ctrlnetworkpanel.h index a569c12..4e233f4 100644 --- a/LedOK/device/ctrlnetworkpanel.h +++ b/LedOK/device/ctrlnetworkpanel.h @@ -11,6 +11,7 @@ #include #include #include +#include struct ApnInfo { QString apn; diff --git a/LedOK/ffplayer.h b/LedOK/ffplayer.h index b07e0ff..048017b 100644 --- a/LedOK/ffplayer.h +++ b/LedOK/ffplayer.h @@ -154,6 +154,7 @@ public: avcodec_free_context(&ctx); } }; +class FFPlayer; class AVFmt { friend class FFPlayer; public: diff --git a/LedOK/program/ebase.h b/LedOK/program/ebase.h index 7a88e12..9d74eb3 100644 --- a/LedOK/program/ebase.h +++ b/LedOK/program/ebase.h @@ -4,7 +4,7 @@ #include #include #include - +#include #define m_handleLen 10 class EBase : public QGraphicsObject { diff --git a/LedOK/program/progeditorwin.h b/LedOK/program/progeditorwin.h index 7b252f5..4d87931 100644 --- a/LedOK/program/progeditorwin.h +++ b/LedOK/program/progeditorwin.h @@ -3,6 +3,7 @@ #include "basewin.h" #include "program/pageeditor.h" #include +#include class ProgPanel; class ProgItem; diff --git a/LedOK/program/usbdetectdialog.cpp b/LedOK/program/usbdetectdialog.cpp index 8d16d57..627325d 100644 --- a/LedOK/program/usbdetectdialog.cpp +++ b/LedOK/program/usbdetectdialog.cpp @@ -1,5 +1,4 @@ #include "usbdetectdialog.h" -#include #include #include #include @@ -65,29 +64,10 @@ UsbDetectDialog::UsbDetectDialog(QWidget *parent) : BaseDlg(parent) { vBox->addLayout(hBox); detectDriver(); - timerId = startTimer(3000); -} -void UsbDetectDialog::timerEvent(QTimerEvent *e) { - if(e->timerId() == timerId) detectDriver(); } + void UsbDetectDialog::detectDriver() { auto drives = QDir::drives(); //获取当前系统的盘符 - QStringList movables; - for(auto drive : drives) if(GetDriveType((WCHAR *) drive.filePath().utf16())==2) movables.append(drive.filePath()); - if(movables.size() == lastCnt) return; - if(movables.size() > lastCnt) { - for(auto movable : movables) { - for(int n=0; n < fdDrives->count(); n++) if(movable == fdDrives->item(n)->text()) goto exist; - fdDrives->addItem(movable); - exist:; - } - } else { - fdDrives->clear(); - fdDrives->addItems(movables); - } - lastCnt = movables.size(); - if(lastCnt==1) { - QListWidgetItem *item = fdDrives->item(0); - item->setSelected(true); - } + fdDrives->clear(); + foreach(auto drive, drives) fdDrives->addItem(drive.filePath()); } diff --git a/LedOK/program/usbdetectdialog.h b/LedOK/program/usbdetectdialog.h index 01fbd46..ebd6389 100644 --- a/LedOK/program/usbdetectdialog.h +++ b/LedOK/program/usbdetectdialog.h @@ -8,18 +8,12 @@ class UsbDetectDialog : public BaseDlg { Q_OBJECT public: explicit UsbDetectDialog(QWidget *parent = nullptr); - ~UsbDetectDialog() {if(timerId!=0) killTimer(timerId);} -protected: - void timerEvent(QTimerEvent *) override; signals: void acceptData(QString string1, QString string2); private: void detectDriver(); QListWidget *fdDrives; QLineEdit *fdPassword; - int timerId = 0; - int lastCnt = 0; - }; #endif // USBDETECTDIALOG_H diff --git a/LedOK/program/videosplitthread.h b/LedOK/program/videosplitthread.h index d2ea440..ac7fa79 100644 --- a/LedOK/program/videosplitthread.h +++ b/LedOK/program/videosplitthread.h @@ -2,6 +2,7 @@ #define VIDEOSPLITTHREAD_H #include +#include class VideoSplitThread : public QThread { Q_OBJECT diff --git a/LedOK/synctimer.cpp b/LedOK/synctimer.cpp index 08f245b..2471e42 100644 --- a/LedOK/synctimer.cpp +++ b/LedOK/synctimer.cpp @@ -1,8 +1,9 @@ #include "synctimer.h" #include #include +#ifdef Q_OS_WINDOWS #include - +#endif SyncTimer::SyncTimer(int inter) { this->inter = inter; connect(this, &QThread::finished, this, &QThread::deleteLater); @@ -11,7 +12,9 @@ void SyncTimer::run(){ qint64 curTime; sleep = inter; if(sleep <= 0) return; + #ifdef Q_OS_WINDOWS timeBeginPeriod(1); + #endif msleep(sleep); qint64 exeTime = QDateTime::currentMSecsSinceEpoch(); while(inter > 0) { @@ -25,5 +28,7 @@ void SyncTimer::run(){ if(exeTime > curTime) msleep(sleep); else exeTime = curTime; } + #ifdef Q_OS_WINDOWS timeEndPeriod(1); + #endif }