diff --git a/core_qui/core_qui.pri b/core_qui/core_qui.pri index ca5a737..e8980ee 100644 --- a/core_qui/core_qui.pri +++ b/core_qui/core_qui.pri @@ -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 diff --git a/core_qui/source/image/fontawesome-webfont.ttf b/core_qui/resource/image/fontawesome-webfont.ttf similarity index 100% rename from core_qui/source/image/fontawesome-webfont.ttf rename to core_qui/resource/image/fontawesome-webfont.ttf diff --git a/core_qui/source/image/iconfont.ttf b/core_qui/resource/image/iconfont.ttf similarity index 100% rename from core_qui/source/image/iconfont.ttf rename to core_qui/resource/image/iconfont.ttf diff --git a/core_qui/source/image/qt_zh_CN.qm b/core_qui/resource/image/qt_zh_CN.qm similarity index 100% rename from core_qui/source/image/qt_zh_CN.qm rename to core_qui/resource/image/qt_zh_CN.qm diff --git a/core_qui/source/image/widgets.qm b/core_qui/resource/image/widgets.qm similarity index 100% rename from core_qui/source/image/widgets.qm rename to core_qui/resource/image/widgets.qm diff --git a/core_qui/source/qm.qrc b/core_qui/resource/qm.qrc similarity index 100% rename from core_qui/source/qm.qrc rename to core_qui/resource/qm.qrc diff --git a/core_qui/source/ttf.qrc b/core_qui/resource/ttf.qrc similarity index 100% rename from core_qui/source/ttf.qrc rename to core_qui/resource/ttf.qrc diff --git a/videowidget/videowidget.cpp b/videowidget/videowidget.cpp index f895490..283c694 100644 --- a/videowidget/videowidget.cpp +++ b/videowidget/videowidget.cpp @@ -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) @@ -592,7 +590,7 @@ void VideoWidget::checkVideo() QDateTime lastTime = now; int sec = lastTime.secsTo(now); if (sec >= timeout) { - restart(); + restart(this->getUrl()); } } @@ -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() @@ -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 { @@ -969,4 +982,3 @@ void VideoWidget::snap(const QString &fileName) { } - diff --git a/videowidget/videowidget.h b/videowidget/videowidget.h index 6d7ba86..26dd7d4 100644 --- a/videowidget/videowidget.h +++ b/videowidget/videowidget.h @@ -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); };