🐞 fix(UI模块): 修改投屏控制按钮切换逻辑

This commit is contained in:
huheng@kylinos.cn 2022-11-12 13:27:46 +08:00
parent 86486fd689
commit 4581e982f6
3 changed files with 10 additions and 6 deletions

View File

@ -97,11 +97,11 @@ void SuspendTabBar::setDeskBtnState(bool isDesktop)
{
if (isDesktop) {
m_deskBtnState = false;
m_switchDeskBtn->setIcon(QIcon(":/tabbaricon/screenshare.svg"));
m_switchDeskBtn->setIcon(QIcon(":/tabbaricon/desktop.svg"));
m_switchDeskBtn->setToolTip(tr("Back to the desktop"));
} else {
m_deskBtnState = true;
m_switchDeskBtn->setIcon(QIcon(":/tabbaricon/desktop.svg"));
m_switchDeskBtn->setIcon(QIcon(":/tabbaricon/screenshare.svg"));
m_switchDeskBtn->setToolTip(tr("Resume screen projection"));
}
}
@ -257,9 +257,9 @@ void SuspendTabBar::onClicked()
}
} else if (btn == m_switchDeskBtn) {
if (m_deskBtnState) {
Q_EMIT sigBtnClicked(SuspendTabBar::BtnType::ReturnDesktopBtn);
} else {
Q_EMIT sigBtnClicked(SuspendTabBar::BtnType::ScreenShareBtn);
} else {
Q_EMIT sigBtnClicked(SuspendTabBar::BtnType::ReturnDesktopBtn);
}
}
}

View File

@ -49,7 +49,7 @@ private:
QPropertyAnimation *m_setHeightAnimation = nullptr;
bool m_ctrlBtnState = true;
bool m_deskBtnState = true;
bool m_deskBtnState = false;
bool m_isOpen = true;
PublicAttributes::Theme m_theme = PublicAttributes::Theme::Light; // 主题

View File

@ -862,6 +862,10 @@ void MainWindow::slotDisconnect()
{
clearConnectionInfo();
Q_EMIT sigDisconnect();
if (m_suspendTabBar != nullptr) {
m_suspendTabBar->deleteLater();
m_suspendTabBar = nullptr;
}
m_isConnect = false;
m_winFlage = WinFlage::DisconnectWin;
m_uploadPath = "";
@ -1207,7 +1211,7 @@ void MainWindow::slotRequestReceived(PcScreenManage::ScreenMsg msg)
connect(m_suspendTabBar, &SuspendTabBar::sigBtnClicked, this, &MainWindow::slotTabBtnClicked);
}
m_suspendTabBar->setTheme(m_theme);
m_suspendTabBar->setDeskBtnState(true);
m_suspendTabBar->setDeskBtnState(false);
m_suspendTabBar->showTabBar();
} break;
case PcScreenManage::ScreenMsg::ShowView: {