Skip to content

Commit

Permalink
fixed: 点击全屏后点击播放列表,界面显示有空白,继续点击播放列表空白一直存在
Browse files Browse the repository at this point in the history
修复点击全屏后点击播放列表,界面显示有空白,继续点击播放列表空白一直存在

Log: 修复点击全屏后点击播放列表,界面显示有空白,继续点击播放列表空白一直存在
Bug: https://pms.uniontech.com/bug-view-225507.html
  • Loading branch information
qingfuliu authored and deepin-bot[bot] committed Nov 2, 2023
1 parent 0d5beef commit b4e7d24
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 16 deletions.
1 change: 1 addition & 0 deletions src/common/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,7 @@ MainWindow::MainWindow(QWidget *parent)
});

connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::sizeModeChanged, this, [=](DGuiApplicationHelper::SizeMode sizeMode) {
m_pToolbox->dSizeModeChanged();
if (m_bMiniMode) return;
m_pCommHintWid->hide();
if (m_pPlaylist && m_pPlaylist->state() == PlaylistWidget::State::Opened)
Expand Down
1 change: 1 addition & 0 deletions src/common/platform/platform_mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,7 @@ Platform_MainWindow::Platform_MainWindow(QWidget *parent)
});

connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::sizeModeChanged, this, [=](DGuiApplicationHelper::SizeMode sizeMode) {
m_pToolbox->dSizeModeChanged();
if (m_bMiniMode) return;
m_pCommHintWid->hide();
if (m_pPlaylist && m_pPlaylist->state() == Platform_PlaylistWidget::State::Opened)
Expand Down
7 changes: 7 additions & 0 deletions src/widgets/platform/platform_playlist_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1349,6 +1349,13 @@ void Platform_PlaylistWidget::togglePopup(bool isShortcut)
fixed.setRect(10, (view_rect.height() - (TOOLBOX_SPACE_HEIGHT + TOOLBOX_HEIGHT + 10) + 5),
view_rect.width() - 20, TOOLBOX_SPACE_HEIGHT + 10);

#ifdef DTKWIDGET_CLASS_DSizeMode
if (DGuiApplicationHelper::instance()->sizeMode() == DGuiApplicationHelper::CompactMode) {
fixed.setRect(10, (view_rect.height() - (TOOLBOX_SPACE_HEIGHT + TOOLBOX_DSIZEMODE_HEIGHT + 10) + 5),
view_rect.width() - 20, TOOLBOX_SPACE_HEIGHT + 10);
}
#endif

QRect shrunk = fixed;
shrunk.setHeight(0);
shrunk.moveBottom(fixed.bottom());
Expand Down
13 changes: 11 additions & 2 deletions src/widgets/platform/platform_toolbox_proxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1383,6 +1383,7 @@ void Platform_ToolboxProxy::initMember()
m_bAnimationFinash = true;
m_bCanPlay = false;
m_bSetListBtnFocus = false;
m_bDsizeModeChanged = false;
}

/**
Expand Down Expand Up @@ -1763,6 +1764,7 @@ void Platform_ToolboxProxy::slotPlayListStateChange(bool isShortcut)

closeAnyPopup();
if (m_pPlaylist->state() == Platform_PlaylistWidget::State::Opened) {
m_bDsizeModeChanged = false;
//窗口绑定渲染不展示动画,故按键状态不做限制
Q_UNUSED(isShortcut);
QRect rcBegin = this->geometry();
Expand All @@ -1780,11 +1782,18 @@ void Platform_ToolboxProxy::slotPlayListStateChange(bool isShortcut)
QRect rcEnd = rcBegin;
rcEnd.setY(rcBegin.y() + TOOLBOX_SPACE_HEIGHT + 7);
#ifdef DTKWIDGET_CLASS_DSizeMode
if (DGuiApplicationHelper::instance()->sizeMode() == DGuiApplicationHelper::CompactMode)
rcEnd.setY(rcBegin.y() + TOOLBOX_SPACE_HEIGHT + 37);
constexpr int8_t height_diff = static_cast<int8_t>(TOOLBOX_HEIGHT - TOOLBOX_DSIZEMODE_HEIGHT);
int y = 0;
if (DGuiApplicationHelper::instance()->sizeMode() == DGuiApplicationHelper::CompactMode){
y= m_bDsizeModeChanged ? (rcBegin.y() + TOOLBOX_SPACE_HEIGHT + 7 + height_diff) : (rcBegin.y() + TOOLBOX_SPACE_HEIGHT + 37);
} else {
y= m_bDsizeModeChanged ? (rcBegin.y() + TOOLBOX_SPACE_HEIGHT + 37 - height_diff) : (rcBegin.y() + TOOLBOX_SPACE_HEIGHT + 7);
}
rcEnd.setY(y);
#endif
setGeometry(rcEnd);
m_pListBtn->setChecked(false);
m_bDsizeModeChanged = false;
}
}

Expand Down
9 changes: 9 additions & 0 deletions src/widgets/platform/platform_toolbox_proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,12 @@ class Platform_ToolboxProxy: public DFloatingWidget
ToolButton *fsBtn() {return m_pFullScreenBtn;}
VolumeButton *volBtn() {return m_pVolBtn;}
void setThumbnailmode(bool is_thumbnailmode) {m_bThumbnailmode = is_thumbnailmode;}
/**
* @brief 在紧凑模式正常模式之间切换的时候调用
*/
inline void dSizeModeChanged() noexcept {
m_bDsizeModeChanged = !m_bDsizeModeChanged;
}

public slots:
/**
Expand Down Expand Up @@ -658,6 +664,7 @@ private slots:
bool m_bAnimationFinash; ///动画是否完成
bool m_bCanPlay; ///判断是否能进行曲目切换的标志位
bool m_bSetListBtnFocus; ///设置播放列表按钮焦点标志位
bool m_bDsizeModeChanged; ///是否在正常模式和紧凑模式之间切换,主要用于播放列表的升降

float m_processAdd;
};
Expand Down Expand Up @@ -751,6 +758,8 @@ public slots:
#define TOOLBOX_TOP_EXTENT 0
#define TOOLBOX_SPACE_HEIGHT 314
#define TOOLBOX_HEIGHT 80
/*紧凑模式下toolbox的高度*/
#define TOOLBOX_DSIZEMODE_HEIGHT 50
#define TOOLBOX_HEIGHT_EXT (TOOLBOX_HEIGHT + TOOLBOX_TOP_EXTENT)
#define TOOLBOX_BUTTON_WIDTH 50
#define TOOLBOX_BUTTON_HEIGHT 50
Expand Down
14 changes: 10 additions & 4 deletions src/widgets/playlist_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1344,15 +1344,21 @@ void PlaylistWidget::togglePopup(bool isShortcut)
QRect view_rect = main_rect.marginsRemoved(QMargins(1, 1, 1, 1));
#endif

int toolbox_height=TOOLBOX_HEIGHT;
#ifdef DTKWIDGET_CLASS_DSizeMode
if (DGuiApplicationHelper::instance()->sizeMode() == DGuiApplicationHelper::CompactMode) {
toolbox_height = TOOLBOX_DSIZEMODE_HEIGHT;
}
#endif

QRect fixed;
if(CompositingManager::get().platform() == X86) {
fixed.setRect(10, (view_rect.height() - (TOOLBOX_SPACE_HEIGHT + TOOLBOX_HEIGHT + 10)),
fixed.setRect(10, (view_rect.height() - (TOOLBOX_SPACE_HEIGHT + toolbox_height + 10)),
view_rect.width() - 20, TOOLBOX_SPACE_HEIGHT + 10);

}
else {
fixed.setRect(10, (view_rect.height() - (TOOLBOX_SPACE_HEIGHT + TOOLBOX_HEIGHT + 10) + 5),
view_rect.width() - 20, TOOLBOX_SPACE_HEIGHT + 10);
fixed.setRect(10, (view_rect.height() - (TOOLBOX_SPACE_HEIGHT + toolbox_height + 10) + 5),
view_rect.width() - 20, TOOLBOX_SPACE_HEIGHT + 10);
}

QRect shrunk = fixed;
Expand Down
41 changes: 31 additions & 10 deletions src/widgets/toolbox_proxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1499,6 +1499,7 @@ void ToolboxProxy::initMember()
m_bAnimationFinash = true;
m_bCanPlay = false;
m_bSetListBtnFocus = false;
m_bDsizeModeChanged = false;
}

/**
Expand Down Expand Up @@ -1825,7 +1826,7 @@ void ToolboxProxy::slotFileLoaded()
if(nIndex == -1) return;
if(nIndex < nNextIndex && !sNextVideoName.isNull()) {
m_pMainWindow->play({sNextVideoName});
} else{
} else {
bool isNext = true;
for(int i = nIndex; i < lstItemInfo.count(); i++) {
PlayItemInfo iteminfo = lstItemInfo.at(i);
Expand Down Expand Up @@ -1881,6 +1882,7 @@ void ToolboxProxy::slotPlayListStateChange(bool isShortcut)

closeAnyPopup();
if (m_pPlaylist->state() == PlaylistWidget::State::Opened) {
m_bDsizeModeChanged = false;
//非x86平台播放列表切换不展示动画,故按键状态不做限制
if(CompositingManager::get().platform() == Platform::X86) {
if (isShortcut && m_pListBtn->isChecked()) {
Expand All @@ -1891,7 +1893,7 @@ void ToolboxProxy::slotPlayListStateChange(bool isShortcut)
}
QRect rcBegin = this->geometry();
QRect rcEnd = rcBegin;
rcEnd.setY(194);
rcEnd.setY(rcBegin.y() - TOOLBOX_SPACE_HEIGHT - 7);
m_bAnimationFinash = false;
m_pPaOpen = new QPropertyAnimation(this, "geometry");
m_pPaOpen->setEasingCurve(QEasingCurve::Linear);
Expand All @@ -1904,16 +1906,11 @@ void ToolboxProxy::slotPlayListStateChange(bool isShortcut)
Q_UNUSED(isShortcut);
QRect rcBegin = this->geometry();
QRect rcEnd = rcBegin;
rcEnd.setY(194);
rcEnd.setY(rcBegin.y() - TOOLBOX_SPACE_HEIGHT - 7);
setGeometry(rcEnd);
m_pListBtn->setChecked(true);
}
} else {
int y = 515;
#ifdef DTKWIDGET_CLASS_DSizeMode
if (DGuiApplicationHelper::instance()->sizeMode() == DGuiApplicationHelper::CompactMode)
y = 543;
#endif
if(CompositingManager::get().platform() == Platform::X86) {
m_bAnimationFinash = false;

Expand All @@ -1926,7 +1923,20 @@ void ToolboxProxy::slotPlayListStateChange(bool isShortcut)

QRect rcBegin = this->geometry();
QRect rcEnd = rcBegin;
rcEnd.setY(y);
if(m_bDsizeModeChanged){
constexpr int8_t height_diff = static_cast<int8_t>(TOOLBOX_HEIGHT - TOOLBOX_DSIZEMODE_HEIGHT);
int y = rcBegin.y() + TOOLBOX_SPACE_HEIGHT + 7;
#ifdef DTKWIDGET_CLASS_DSizeMode
if (DGuiApplicationHelper::instance()->sizeMode() == DGuiApplicationHelper::CompactMode) {
y = rcBegin.y() + TOOLBOX_SPACE_HEIGHT + 7 + height_diff;
} else {
y = rcBegin.y() + TOOLBOX_SPACE_HEIGHT + 7 - height_diff;
}
#endif
rcEnd.setY(y);
} else {
rcEnd.setY(rcBegin.y() + TOOLBOX_SPACE_HEIGHT + 7);
}
m_pPaClose = new QPropertyAnimation(this, "geometry");
m_pPaClose->setEasingCurve(QEasingCurve::Linear);
m_pPaClose->setDuration(POPUP_DURATION);
Expand All @@ -1938,10 +1948,21 @@ void ToolboxProxy::slotPlayListStateChange(bool isShortcut)
Q_UNUSED(isShortcut);
QRect rcBegin = this->geometry();
QRect rcEnd = rcBegin;
rcEnd.setY(y);
if(m_bDsizeModeChanged){
int8_t height_diff = static_cast<int>(TOOLBOX_HEIGHT - TOOLBOX_DSIZEMODE_HEIGHT);
#ifdef DTKWIDGET_CLASS_DSizeMode
if (DGuiApplicationHelper::instance()->sizeMode() != DGuiApplicationHelper::CompactMode) {
height_diff = -height_diff;
}
#endif
rcEnd.setY(rcBegin.y() + TOOLBOX_SPACE_HEIGHT + 7 + height_diff);
} else {
rcEnd.setY(rcBegin.y() + TOOLBOX_SPACE_HEIGHT + 7);
}
setGeometry(rcEnd);
m_pListBtn->setChecked(false);
}
m_bDsizeModeChanged = false;
}
}

Expand Down
9 changes: 9 additions & 0 deletions src/widgets/toolbox_proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,12 @@ class ToolboxProxy: public DFloatingWidget
VolumeButton *volBtn() {return m_pVolBtn;}
void setThumbnailmode(bool is_thumbnailmode) {m_bThumbnailmode = is_thumbnailmode;}
MircastWidget *getMircastWidget() {return m_mircastWidget;}
/**
* @brief 在紧凑模式正常模式之间切换的时候调用
*/
inline void dSizeModeChanged() noexcept {
m_bDsizeModeChanged = !m_bDsizeModeChanged;
}

public slots:
/**
Expand Down Expand Up @@ -656,6 +662,7 @@ private slots:
bool m_bAnimationFinash; ///动画是否完成
bool m_bCanPlay; ///判断是否能进行曲目切换的标志位
bool m_bSetListBtnFocus; ///设置播放列表按钮焦点标志位
bool m_bDsizeModeChanged; ///是否在正常模式和紧凑模式之间切换,主要用于播放列表的升降

float m_processAdd;
};
Expand Down Expand Up @@ -749,6 +756,8 @@ public slots:
#define TOOLBOX_TOP_EXTENT 0
#define TOOLBOX_SPACE_HEIGHT 314
#define TOOLBOX_HEIGHT 80
/*紧凑模式下toolbox的高度*/
#define TOOLBOX_DSIZEMODE_HEIGHT 50
#define TOOLBOX_HEIGHT_EXT (TOOLBOX_HEIGHT + TOOLBOX_TOP_EXTENT)
#define TOOLBOX_BUTTON_WIDTH 50
#define TOOLBOX_BUTTON_HEIGHT 50
Expand Down

0 comments on commit b4e7d24

Please sign in to comment.