fix(投屏): 解决加载动画时关闭投屏崩溃问题
解决加载动画时关闭投屏崩溃问题 Closes 133256 【手机助手】开启投屏后偶现应用崩溃
This commit is contained in:
parent
7df6ced653
commit
cbcee33e2d
|
@ -84,6 +84,7 @@ void VideoForm::initUI()
|
|||
m_videoWidget->setMouseTracking(true);
|
||||
ui->keepRatioWidget->setMouseTracking(true);
|
||||
m_titleHeight = TITLE_HEIGHT;
|
||||
m_loadTimer = new QTimer(this);
|
||||
}
|
||||
|
||||
void VideoForm::initConnect()
|
||||
|
@ -92,10 +93,14 @@ void VideoForm::initConnect()
|
|||
connect(ui->title, &VideoTitle::sigMaxButtonClicked, this, &VideoForm::onMaxButtonClick);
|
||||
connect(ui->title, &VideoTitle::sigFullScreen, this, &VideoForm::onFullScreen);
|
||||
connect(ui->title, &VideoTitle::sigScroll, this, &VideoForm::onScrollTrigger);
|
||||
connect(m_loadTimer, &QTimer::timeout, this, [this](){
|
||||
m_isLoading = true;
|
||||
});
|
||||
}
|
||||
|
||||
void VideoForm::deleteUI()
|
||||
{
|
||||
m_isLoading = false;
|
||||
this->hide();
|
||||
if (!m_device) {
|
||||
return;
|
||||
|
@ -124,18 +129,23 @@ const QSize &VideoForm::frameSize()
|
|||
|
||||
void VideoForm::updateRender(const AVFrame *frame)
|
||||
{
|
||||
|
||||
|
||||
if (m_videoWidget->isHidden()) {
|
||||
this->show();
|
||||
updateShowSize(QSize(frame->width, frame->height));
|
||||
m_loadingWidget->resize(this->size());
|
||||
m_loadingWidget->show();
|
||||
GenerateTools::delayMs(1000);
|
||||
if (m_loadingWidget) {
|
||||
m_loadingWidget->close();
|
||||
if (m_loadTimer) {
|
||||
m_loadTimer->start(500);
|
||||
}
|
||||
m_videoWidget->show();
|
||||
updateShowSize(QSize(frame->width, frame->height));
|
||||
if (m_isLoading) {
|
||||
if (m_loadingWidget) {
|
||||
m_loadingWidget->close();
|
||||
}
|
||||
m_videoWidget->show();
|
||||
} else {
|
||||
m_loadingWidget->resize(this->size());
|
||||
m_loadingWidget->show();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
updateShowSize(QSize(frame->width, frame->height));
|
||||
|
||||
|
|
|
@ -128,6 +128,8 @@ private:
|
|||
QGSettings *m_panelSetting = nullptr;
|
||||
// outside member
|
||||
QPointer<BaseDevice> m_device;
|
||||
bool m_isLoading = false;
|
||||
QTimer *m_loadTimer = nullptr;
|
||||
};
|
||||
|
||||
#endif // VIDEOFORM_H
|
||||
|
|
Loading…
Reference in New Issue