parent
b0b2ba4948
commit
a918f47a99
|
@ -98,12 +98,7 @@ Curtain::Curtain(QWidget *parent) : QWidget(parent), m_view(new QWebEngineView(t
|
|||
});
|
||||
}
|
||||
|
||||
Curtain::~Curtain()
|
||||
{
|
||||
if (m_suspendTabBar1 != nullptr) {
|
||||
delete m_suspendTabBar1;
|
||||
}
|
||||
}
|
||||
Curtain::~Curtain() {}
|
||||
|
||||
void Curtain::setTheme(PublicAttributes::Theme theme)
|
||||
{
|
||||
|
@ -111,31 +106,22 @@ void Curtain::setTheme(PublicAttributes::Theme theme)
|
|||
if (m_suspendTabBar) {
|
||||
m_suspendTabBar->setTheme(m_theme);
|
||||
}
|
||||
if (m_suspendTabBar1 != nullptr) {
|
||||
m_suspendTabBar1->setTheme(m_theme);
|
||||
}
|
||||
}
|
||||
|
||||
void Curtain::showView()
|
||||
{
|
||||
if (m_suspendTabBar1 != nullptr) {
|
||||
m_suspendTabBar1->hideTabBar();
|
||||
if (isHidden()) {
|
||||
show();
|
||||
showMaximized();
|
||||
showFullScreen();
|
||||
}
|
||||
show();
|
||||
showMaximized();
|
||||
showFullScreen();
|
||||
}
|
||||
|
||||
void Curtain::hideView()
|
||||
{
|
||||
hide();
|
||||
if (m_suspendTabBar1 == nullptr) {
|
||||
m_suspendTabBar1 = new SuspendTabBar(SuspendTabBar::Display::Whole, true);
|
||||
connect(m_suspendTabBar1, &SuspendTabBar::sigBtnClicked, this, &Curtain::slotTabBtnClicked);
|
||||
if (!isHidden()) {
|
||||
hide();
|
||||
}
|
||||
m_suspendTabBar1->setTheme(m_theme);
|
||||
m_suspendTabBar1->setDeskBtnState(true);
|
||||
m_suspendTabBar1->showTabBar();
|
||||
}
|
||||
|
||||
void Curtain::hideTabBar()
|
||||
|
@ -182,20 +168,13 @@ void Curtain::slotTabBtnClicked(SuspendTabBar::BtnType type)
|
|||
switch (type) {
|
||||
case SuspendTabBar::BtnType::ControlBtn: {
|
||||
// 暂时先模拟键盘进入反控
|
||||
showView();
|
||||
hideTabBar();
|
||||
QString common = "xdotool key ctrl+h";
|
||||
system(common.toUtf8().constData());
|
||||
Q_EMIT sigStateChange(Curtain::States::Control);
|
||||
} break;
|
||||
case SuspendTabBar::BtnType::ReturnDesktopBtn: {
|
||||
hideView();
|
||||
Q_EMIT sigStateChange(Curtain::States::ReturnDesktop);
|
||||
} break;
|
||||
case SuspendTabBar::BtnType::ScreenShareBtn: {
|
||||
showView();
|
||||
Q_EMIT sigStateChange(Curtain::States::ScreenShare);
|
||||
} break;
|
||||
case SuspendTabBar::BtnType::ExitBtn: {
|
||||
hideView();
|
||||
Q_EMIT sigStateChange(Curtain::States::Exit);
|
||||
|
|
|
@ -98,7 +98,6 @@ private:
|
|||
QString m_url = "";
|
||||
PublicAttributes::Theme m_theme = PublicAttributes::Theme::Light; // 主题
|
||||
SuspendTabBar *m_suspendTabBar = nullptr;
|
||||
SuspendTabBar *m_suspendTabBar1 = nullptr;
|
||||
};
|
||||
|
||||
#endif // CURTAIN_H
|
||||
|
|
|
@ -41,9 +41,6 @@ void PcScreenManage::setTheme(PublicAttributes::Theme theme)
|
|||
if (m_curtain != nullptr) {
|
||||
m_curtain->setTheme(m_theme);
|
||||
}
|
||||
if (m_suspendTabBar != nullptr) {
|
||||
m_suspendTabBar->setTheme(m_theme);
|
||||
}
|
||||
}
|
||||
|
||||
bool PcScreenManage::isSupport()
|
||||
|
@ -181,9 +178,14 @@ void PcScreenManage::startControl()
|
|||
|
||||
void PcScreenManage::startedControl()
|
||||
{
|
||||
qInfo() << "Enter anti control.";
|
||||
ScreenManageMsg message;
|
||||
message.set_msg(ScreenManageMsg::STARTEDCONTROL);
|
||||
sendMessage(message);
|
||||
showView();
|
||||
m_curtain->hideTabBar();
|
||||
QString common = "xdotool key ctrl+h";
|
||||
system(common.toUtf8().constData());
|
||||
}
|
||||
|
||||
void PcScreenManage::exitControl()
|
||||
|
@ -221,11 +223,6 @@ void PcScreenManage::closePcScreenService()
|
|||
void PcScreenManage::closeCurtain()
|
||||
{
|
||||
qInfo() << "Closing curtain...";
|
||||
if (m_suspendTabBar != nullptr) {
|
||||
m_suspendTabBar->hideTabBar();
|
||||
delete m_suspendTabBar;
|
||||
m_suspendTabBar = nullptr;
|
||||
}
|
||||
if (m_curtain != nullptr) {
|
||||
ScreenManageMsg message;
|
||||
message.set_msg(ScreenManageMsg::CURTAINEXIT);
|
||||
|
@ -322,11 +319,7 @@ void PcScreenManage::onMessageReadyRead()
|
|||
disconnected();
|
||||
} break;
|
||||
case ScreenManageMsg::STARTEDCONTROL: {
|
||||
qInfo() << "Enter anti control.";
|
||||
m_suspendTabBar = new SuspendTabBar(SuspendTabBar::Display::Part, true);
|
||||
connect(m_suspendTabBar, &SuspendTabBar::sigBtnClicked, this, &PcScreenManage::slotTabBtnClicked);
|
||||
m_suspendTabBar->setTheme(m_theme);
|
||||
m_suspendTabBar->showTabBar();
|
||||
Q_EMIT sigRequestReceived(ScreenMsg::StartedControl);
|
||||
} break;
|
||||
case ScreenManageMsg::EXITCONTROL: {
|
||||
qInfo() << "Exit anti control.";
|
||||
|
@ -335,11 +328,7 @@ void PcScreenManage::onMessageReadyRead()
|
|||
system(common.toUtf8().constData());
|
||||
m_curtain->showTabBar();
|
||||
} else {
|
||||
if (m_suspendTabBar != nullptr) {
|
||||
m_suspendTabBar->hideTabBar();
|
||||
delete m_suspendTabBar;
|
||||
m_suspendTabBar = nullptr;
|
||||
}
|
||||
Q_EMIT sigRequestReceived(ScreenMsg::ExitControl);
|
||||
}
|
||||
} break;
|
||||
}
|
||||
|
@ -390,7 +379,6 @@ void PcScreenManage::slotStateChange(Curtain::States state)
|
|||
switch (state) {
|
||||
case Curtain::States::Control: {
|
||||
// 进入反控
|
||||
m_curtain->hideTabBar();
|
||||
startedControl();
|
||||
} break;
|
||||
case Curtain::States::ReturnDesktop: {
|
||||
|
@ -401,30 +389,7 @@ void PcScreenManage::slotStateChange(Curtain::States state)
|
|||
} break;
|
||||
case Curtain::States::Exit: {
|
||||
disconnected();
|
||||
Q_EMIT sigRequestReceived(ScreenMsg::HideView);
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
void PcScreenManage::slotTabBtnClicked(SuspendTabBar::BtnType type)
|
||||
{
|
||||
switch (type) {
|
||||
case SuspendTabBar::BtnType::ControlBtn: {
|
||||
// 退出反控
|
||||
exitControl();
|
||||
if (m_suspendTabBar != nullptr) {
|
||||
m_suspendTabBar->hideTabBar();
|
||||
delete m_suspendTabBar;
|
||||
m_suspendTabBar = nullptr;
|
||||
}
|
||||
} break;
|
||||
case SuspendTabBar::BtnType::ExitBtn: {
|
||||
if (m_suspendTabBar != nullptr) {
|
||||
m_suspendTabBar->hideTabBar();
|
||||
delete m_suspendTabBar;
|
||||
m_suspendTabBar = nullptr;
|
||||
}
|
||||
disconnected();
|
||||
Q_EMIT sigRequestReceived(ScreenMsg::Exit);
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ public:
|
|||
ExitControl = 8, // 退出反控
|
||||
HideView = 9, // 隐藏投屏
|
||||
ShowView = 10, // 显示投屏
|
||||
Exit = 11, // 主动退出
|
||||
};
|
||||
Q_ENUM(ScreenMsg)
|
||||
|
||||
|
@ -79,7 +80,6 @@ private Q_SLOTS:
|
|||
void handleStateChange(QAbstractSocket::SocketState state);
|
||||
void slotSocketDisconnect();
|
||||
void slotStateChange(Curtain::States state);
|
||||
void slotTabBtnClicked(SuspendTabBar::BtnType type);
|
||||
// void slotEnterControl(bool isControl);
|
||||
|
||||
private:
|
||||
|
@ -89,7 +89,6 @@ private:
|
|||
QThread *m_pcScreenThread = nullptr; //投屏服务线程
|
||||
Curtain *m_curtain = nullptr; // 投屏幕布
|
||||
Control *m_control = nullptr; // 反控
|
||||
SuspendTabBar *m_suspendTabBar = nullptr;
|
||||
// QDBusInterface *m_dbusInterface = nullptr; // 反控dbus
|
||||
|
||||
QString m_address = ""; // 客服端ip
|
||||
|
|
|
@ -168,6 +168,7 @@ void SuspendTabBar::initWholeUI()
|
|||
m_switchDeskBtn->setFocusPolicy(Qt::NoFocus);
|
||||
m_exitBtn->setFocusPolicy(Qt::NoFocus);
|
||||
|
||||
m_ctrlBtnState = true;
|
||||
m_controlBtn->setIcon(QIcon(":/tabbaricon/control.svg"));
|
||||
m_switchDeskBtn->setIcon(QIcon(":/tabbaricon/desktop.svg"));
|
||||
|
||||
|
@ -206,6 +207,7 @@ void SuspendTabBar::initPartUI()
|
|||
m_controlBtn->setFocusPolicy(Qt::NoFocus);
|
||||
m_exitBtn->setFocusPolicy(Qt::NoFocus);
|
||||
|
||||
m_ctrlBtnState = false;
|
||||
m_controlBtn->setIcon(QIcon(":/tabbaricon/controlclose.svg"));
|
||||
|
||||
m_controlBtn->setToolTip(tr("Counter control (activate Ctrl+H, cancel Ctrl+G)"));
|
||||
|
@ -248,7 +250,11 @@ void SuspendTabBar::onClicked()
|
|||
kdk::KToolButton *btn = qobject_cast<kdk::KToolButton *>(sender());
|
||||
|
||||
if (btn == m_controlBtn) {
|
||||
Q_EMIT sigBtnClicked(SuspendTabBar::BtnType::ControlBtn);
|
||||
if (m_ctrlBtnState) {
|
||||
Q_EMIT sigBtnClicked(SuspendTabBar::BtnType::ControlBtn);
|
||||
} else {
|
||||
Q_EMIT sigBtnClicked(SuspendTabBar::BtnType::CloseControlBtn);
|
||||
}
|
||||
} else if (btn == m_switchDeskBtn) {
|
||||
if (m_deskBtnState) {
|
||||
Q_EMIT sigBtnClicked(SuspendTabBar::BtnType::ReturnDesktopBtn);
|
||||
|
|
|
@ -25,6 +25,7 @@ public:
|
|||
|
||||
enum BtnType {
|
||||
ControlBtn = 0, // 反控按钮
|
||||
CloseControlBtn, // 关闭反控
|
||||
ReturnDesktopBtn, // 返回桌面
|
||||
ScreenShareBtn, // 投屏
|
||||
ExitBtn, // 退出
|
||||
|
|
|
@ -328,6 +328,9 @@ void MainWindow::changeLightTheme()
|
|||
if (m_pcScreen != nullptr) {
|
||||
m_pcScreen->setTheme(m_theme);
|
||||
}
|
||||
if (m_suspendTabBar != nullptr) {
|
||||
m_suspendTabBar->setTheme(m_theme);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::changeDarkTheme()
|
||||
|
@ -346,6 +349,9 @@ void MainWindow::changeDarkTheme()
|
|||
if (m_pcScreen != nullptr) {
|
||||
m_pcScreen->setTheme(m_theme);
|
||||
}
|
||||
if (m_suspendTabBar != nullptr) {
|
||||
m_suspendTabBar->setTheme(m_theme);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::initUI()
|
||||
|
@ -1090,12 +1096,35 @@ void MainWindow::slotRequestReceived(PcScreenManage::ScreenMsg msg)
|
|||
m_messageBox->addButton(QString(tr("OK")), QMessageBox::AcceptRole);
|
||||
m_messageBox->show();
|
||||
} break;
|
||||
case PcScreenManage::ScreenMsg::StartedControl: {
|
||||
m_suspendTabBar = new SuspendTabBar(SuspendTabBar::Display::Part, true, this);
|
||||
connect(m_suspendTabBar, &SuspendTabBar::sigBtnClicked, this, &MainWindow::slotTabBtnClicked);
|
||||
m_suspendTabBar->setTheme(m_theme);
|
||||
m_suspendTabBar->showTabBar();
|
||||
} break;
|
||||
case PcScreenManage::ScreenMsg::ExitControl: {
|
||||
if (m_suspendTabBar != nullptr) {
|
||||
m_suspendTabBar->hideTabBar();
|
||||
delete m_suspendTabBar;
|
||||
m_suspendTabBar = nullptr;
|
||||
}
|
||||
} break;
|
||||
case PcScreenManage::ScreenMsg::HideView: {
|
||||
show();
|
||||
if (m_suspendTabBar == nullptr) {
|
||||
m_suspendTabBar = new SuspendTabBar(SuspendTabBar::Display::Whole, true, this);
|
||||
connect(m_suspendTabBar, &SuspendTabBar::sigBtnClicked, this, &MainWindow::slotTabBtnClicked);
|
||||
}
|
||||
m_suspendTabBar->setTheme(m_theme);
|
||||
m_suspendTabBar->setDeskBtnState(true);
|
||||
m_suspendTabBar->showTabBar();
|
||||
} break;
|
||||
case PcScreenManage::ScreenMsg::ShowView: {
|
||||
hide();
|
||||
} break;
|
||||
case PcScreenManage::ScreenMsg::Exit: {
|
||||
show();
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1674,6 +1703,48 @@ void MainWindow::slotExitPcScreen()
|
|||
}
|
||||
}
|
||||
|
||||
void MainWindow::slotTabBtnClicked(SuspendTabBar::BtnType type)
|
||||
{
|
||||
switch (type) {
|
||||
case SuspendTabBar::BtnType::ControlBtn: {
|
||||
// 开始反控
|
||||
if (m_suspendTabBar != nullptr) {
|
||||
m_suspendTabBar->hideTabBar();
|
||||
delete m_suspendTabBar;
|
||||
m_suspendTabBar = nullptr;
|
||||
}
|
||||
m_pcScreen->startedControl();
|
||||
} break;
|
||||
case SuspendTabBar::BtnType::CloseControlBtn: {
|
||||
// 退出反控
|
||||
if (m_suspendTabBar != nullptr) {
|
||||
m_suspendTabBar->hideTabBar();
|
||||
delete m_suspendTabBar;
|
||||
m_suspendTabBar = nullptr;
|
||||
}
|
||||
m_pcScreen->exitControl();
|
||||
} break;
|
||||
case SuspendTabBar::BtnType::ScreenShareBtn: {
|
||||
if (m_suspendTabBar != nullptr) {
|
||||
m_suspendTabBar->hideTabBar();
|
||||
delete m_suspendTabBar;
|
||||
m_suspendTabBar = nullptr;
|
||||
}
|
||||
hide();
|
||||
m_pcScreen->showView();
|
||||
} break;
|
||||
case SuspendTabBar::BtnType::ExitBtn: {
|
||||
if (m_suspendTabBar != nullptr) {
|
||||
m_suspendTabBar->hideTabBar();
|
||||
delete m_suspendTabBar;
|
||||
m_suspendTabBar = nullptr;
|
||||
}
|
||||
m_connectedWin->restoreScreenButton();
|
||||
m_pcScreen->disconnected();
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::slotMobileFileListSearchClicked()
|
||||
{
|
||||
qInfo() << "show null search widget";
|
||||
|
|
|
@ -180,6 +180,7 @@ private:
|
|||
QMessageBox *m_messageBox = nullptr; // 请求提示框
|
||||
LoadDialog *m_loadDialog = nullptr; //加载动画
|
||||
LoadAnimation *m_loadAnimation = nullptr; // 打开/更新加载界面
|
||||
SuspendTabBar *m_suspendTabBar = nullptr; // 投屏控制
|
||||
QTimer *m_timer = nullptr; // 连接加载定时器,连接超时处理
|
||||
|
||||
int m_fileSyncIndex = 2; // 手机文件同步堆栈窗口索引
|
||||
|
@ -258,6 +259,7 @@ public Q_SLOTS:
|
|||
void slotConnectedWinBtnClicked(ConnectedWin::BtnType type);
|
||||
void slotExitMobileScreen();
|
||||
void slotExitPcScreen();
|
||||
void slotTabBtnClicked(SuspendTabBar::BtnType type);
|
||||
void slotSetSearchInfoFinish(bool isUpdated, QString searchInfoPath);
|
||||
void slotMobileFileListSearchClicked();
|
||||
void slotSearchKeyword(QString query);
|
||||
|
|
Loading…
Reference in New Issue