This commit is contained in:
Gangphon 2023-04-21 11:06:47 +08:00
parent 8bd2a98dd7
commit f9db8e5e85
11 changed files with 16 additions and 33 deletions

View File

@ -8,7 +8,7 @@ QT += webenginewidgets
greaterThan(QT_MAJOR_VERSION, 5) { greaterThan(QT_MAJOR_VERSION, 5) {
QT += openglwidgets QT += openglwidgets
} }
CONFIG += c++20 CONFIG += c++14
CONFIG += lrelease CONFIG += lrelease
CONFIG += embed_translations CONFIG += embed_translations
# CONFIG += console # CONFIG += console

View File

@ -4,7 +4,6 @@
#include <QPainter> #include <QPainter>
#include <QPainterPath> #include <QPainterPath>
#include <QIcon> #include <QIcon>
#include <windows.h>
BaseWin::BaseWin(QWidget *parent) : QWidget(parent){ BaseWin::BaseWin(QWidget *parent) : QWidget(parent){
setWindowFlag(Qt::FramelessWindowHint); setWindowFlag(Qt::FramelessWindowHint);

View File

@ -11,6 +11,7 @@
#include <QCheckBox> #include <QCheckBox>
#include <QFile> #include <QFile>
#include <QThread> #include <QThread>
#include <QComboBox>
class CtrlAdvancedPanel : public QWidget { class CtrlAdvancedPanel : public QWidget {
Q_OBJECT Q_OBJECT

View File

@ -11,6 +11,7 @@
#include <QLineEdit> #include <QLineEdit>
#include <QGroupBox> #include <QGroupBox>
#include <QCheckBox> #include <QCheckBox>
#include <QComboBox>
struct ApnInfo { struct ApnInfo {
QString apn; QString apn;

View File

@ -154,6 +154,7 @@ public:
avcodec_free_context(&ctx); avcodec_free_context(&ctx);
} }
}; };
class FFPlayer;
class AVFmt { class AVFmt {
friend class FFPlayer; friend class FFPlayer;
public: public:

View File

@ -4,7 +4,7 @@
#include <QGraphicsObject> #include <QGraphicsObject>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QPen> #include <QPen>
#include <float.h>
#define m_handleLen 10 #define m_handleLen 10
class EBase : public QGraphicsObject { class EBase : public QGraphicsObject {

View File

@ -3,6 +3,7 @@
#include "basewin.h" #include "basewin.h"
#include "program/pageeditor.h" #include "program/pageeditor.h"
#include <QListWidget> #include <QListWidget>
#include <QJsonObject>
class ProgPanel; class ProgPanel;
class ProgItem; class ProgItem;

View File

@ -1,5 +1,4 @@
#include "usbdetectdialog.h" #include "usbdetectdialog.h"
#include <windows.h>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QPushButton> #include <QPushButton>
#include <QLabel> #include <QLabel>
@ -65,29 +64,10 @@ UsbDetectDialog::UsbDetectDialog(QWidget *parent) : BaseDlg(parent) {
vBox->addLayout(hBox); vBox->addLayout(hBox);
detectDriver(); detectDriver();
timerId = startTimer(3000);
}
void UsbDetectDialog::timerEvent(QTimerEvent *e) {
if(e->timerId() == timerId) detectDriver();
} }
void UsbDetectDialog::detectDriver() { void UsbDetectDialog::detectDriver() {
auto drives = QDir::drives(); //获取当前系统的盘符 auto drives = QDir::drives(); //获取当前系统的盘符
QStringList movables; fdDrives->clear();
for(auto drive : drives) if(GetDriveType((WCHAR *) drive.filePath().utf16())==2) movables.append(drive.filePath()); foreach(auto drive, drives) fdDrives->addItem(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);
}
} }

View File

@ -8,18 +8,12 @@ class UsbDetectDialog : public BaseDlg {
Q_OBJECT Q_OBJECT
public: public:
explicit UsbDetectDialog(QWidget *parent = nullptr); explicit UsbDetectDialog(QWidget *parent = nullptr);
~UsbDetectDialog() {if(timerId!=0) killTimer(timerId);}
protected:
void timerEvent(QTimerEvent *) override;
signals: signals:
void acceptData(QString string1, QString string2); void acceptData(QString string1, QString string2);
private: private:
void detectDriver(); void detectDriver();
QListWidget *fdDrives; QListWidget *fdDrives;
QLineEdit *fdPassword; QLineEdit *fdPassword;
int timerId = 0;
int lastCnt = 0;
}; };
#endif // USBDETECTDIALOG_H #endif // USBDETECTDIALOG_H

View File

@ -2,6 +2,7 @@
#define VIDEOSPLITTHREAD_H #define VIDEOSPLITTHREAD_H
#include <QThread> #include <QThread>
#include <QPointF>
class VideoSplitThread : public QThread { class VideoSplitThread : public QThread {
Q_OBJECT Q_OBJECT

View File

@ -1,8 +1,9 @@
#include "synctimer.h" #include "synctimer.h"
#include <QDateTime> #include <QDateTime>
#include <QDebug> #include <QDebug>
#ifdef Q_OS_WINDOWS
#include <windows.h> #include <windows.h>
#endif
SyncTimer::SyncTimer(int inter) { SyncTimer::SyncTimer(int inter) {
this->inter = inter; this->inter = inter;
connect(this, &QThread::finished, this, &QThread::deleteLater); connect(this, &QThread::finished, this, &QThread::deleteLater);
@ -11,7 +12,9 @@ void SyncTimer::run(){
qint64 curTime; qint64 curTime;
sleep = inter; sleep = inter;
if(sleep <= 0) return; if(sleep <= 0) return;
#ifdef Q_OS_WINDOWS
timeBeginPeriod(1); timeBeginPeriod(1);
#endif
msleep(sleep); msleep(sleep);
qint64 exeTime = QDateTime::currentMSecsSinceEpoch(); qint64 exeTime = QDateTime::currentMSecsSinceEpoch();
while(inter > 0) { while(inter > 0) {
@ -25,5 +28,7 @@ void SyncTimer::run(){
if(exeTime > curTime) msleep(sleep); if(exeTime > curTime) msleep(sleep);
else exeTime = curTime; else exeTime = curTime;
} }
#ifdef Q_OS_WINDOWS
timeEndPeriod(1); timeEndPeriod(1);
#endif
} }