Skip to content

Commit

Permalink
更新代码
Browse files Browse the repository at this point in the history
  • Loading branch information
feiyangqingyun committed Jul 21, 2021
1 parent 0343a5e commit 2146c86
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 24 deletions.
4 changes: 2 additions & 2 deletions core_qui/core_qui.pri
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ SOURCES += \
$$PWD/quitipbox.cpp \
$$PWD/quiwidget.cpp

RESOURCES += $$PWD/source/qm.qrc
RESOURCES += $$PWD/source/ttf.qrc
RESOURCES += $$PWD/resource/qm.qrc
RESOURCES += $$PWD/resource/ttf.qrc
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
46 changes: 29 additions & 17 deletions videowidget/videowidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,22 +199,20 @@ void VideoWidget::dropEvent(QDropEvent *event)
{
//拖放完毕鼠标松开的时候执行
//判断拖放进来的类型,取出文件,进行播放
QString url;
if (event->mimeData()->hasUrls()) {
QString url = event->mimeData()->urls().first().toLocalFile();
this->close();
this->setUrl(url);
this->open();
emit fileDrag(url);
url = event->mimeData()->urls().first().toLocalFile();
} else if (event->mimeData()->hasFormat("application/x-qabstractitemmodeldatalist")) {
QTreeWidget *treeWidget = (QTreeWidget *)event->source();
if (treeWidget != 0) {
QString url = treeWidget->currentItem()->data(0, Qt::UserRole).toString();
this->close();
this->setUrl(url);
this->open();
emit fileDrag(url);
url = treeWidget->currentItem()->data(0, Qt::UserRole).toString();
}
}

if (!url.isEmpty()) {
emit fileDrag(url);
this->restart(url);
}
}

void VideoWidget::dragEnterEvent(QDragEnterEvent *event)
Expand Down Expand Up @@ -592,7 +590,7 @@ void VideoWidget::checkVideo()
QDateTime lastTime = now;
int sec = lastTime.secsTo(now);
if (sec >= timeout) {
restart();
restart(this->getUrl());
}
}

Expand Down Expand Up @@ -922,21 +920,30 @@ void VideoWidget::open()
return;
}


//thread->play();
//thread->start();

if (checkLive) {
timerCheck->start();
}

this->setProperty("isPause", false);
}

void VideoWidget::pause()
{

if (!this->property("isPause").toBool()) {
//thread->pause();
this->setProperty("isPause", true);
}
}

void VideoWidget::next()
{

if (this->property("isPause").toBool()) {
//thread->next();
this->setProperty("isPause", false);
}
}

void VideoWidget::close()
Expand All @@ -945,13 +952,19 @@ void VideoWidget::close()
timerCheck->stop();
}

QTimer::singleShot(1, this, SLOT(clear()));
this->clear();
//QTimer::singleShot(5, this, SLOT(clear()));
}

void VideoWidget::restart(int delayOpen)
void VideoWidget::restart(const QString &url, int delayOpen)
{
//qDebug() << TIMEMS << "restart video" << objectName();
//关闭视频
close();
//重新设置播放地址
setUrl(url);

//打开视频
if (delayOpen > 0) {
QTimer::singleShot(delayOpen, this, SLOT(open()));
} else {
Expand All @@ -969,4 +982,3 @@ void VideoWidget::snap(const QString &fileName)
{

}

10 changes: 5 additions & 5 deletions videowidget/videowidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -360,17 +360,17 @@ public slots:

//打开设备
void open();
//暂停
//暂停播放
void pause();
//继续
//继续播放
void next();
//关闭设备
void close();
//重新加载
void restart(int delayOpen = 500);
//清空
void restart(const QString &url, int delayOpen = 500);
//清空图片
void clear();
//快照
//截图快照
void snap(const QString &fileName);
};

Expand Down

0 comments on commit 2146c86

Please sign in to comment.