Merge branch 'upstream' into 'upstream'

Upstream

See merge request kylinos-src/kylin-connectivity!48
This commit is contained in:
赵杨 2022-10-20 07:34:25 +00:00
commit f63d8c29a3
4 changed files with 37 additions and 14 deletions

View File

@ -32,12 +32,12 @@ void PCScreen::startService()
QThread::msleep(8000);
Q_EMIT sigStartedScreen(m_roomid);
});
connect(m_process, &QProcess::errorOccurred, [&](QProcess::ProcessError error) {
if (!isNormalExit) {
qInfo() << "Screen projection service error:" << error;
Q_EMIT sigStartError();
}
});
// connect(m_process, &QProcess::errorOccurred, [&](QProcess::ProcessError error) {
// if (!isNormalExit) {
// qInfo() << "Screen projection service error:" << error;
// Q_EMIT sigStartError();
// }
// });
getRoomId();
m_process->start(COMMON, QStringList() << m_roomid);
} else {

View File

@ -3,6 +3,7 @@
#include <QDebug>
#include <QGuiApplication>
#include <QScreen>
#include <QFileInfo>
// #define KYLIN_CONNECTIVITY_TOOLS_PATH "/"
// #define KYLIN_CONNECTIVITY_TOOLS_SERVICE "com.kylinos.connectivity.tools"
@ -45,6 +46,15 @@ void PcScreenManage::setTheme(PublicAttributes::Theme theme)
}
}
bool PcScreenManage::isSupport()
{
QFileInfo screencast("/usr/bin/kylin-screencast.AppImage");
QFileInfo controlClient("/usr/bin/anti-control-client");
QFileInfo controlServer("/usr/bin/anti-control-server");
return screencast.isExecutable() && controlClient.isExecutable() && controlServer.isExecutable();
}
void PcScreenManage::disconnected()
{
m_isService = true;

View File

@ -39,6 +39,8 @@ public:
void setTheme(PublicAttributes::Theme theme);
bool isSupport();
// 断开通信通道
void disconnected();
// 连接服务端

View File

@ -1068,14 +1068,14 @@ void MainWindow::slotRequestReceived(PcScreenManage::ScreenMsg msg)
} break;
case PcScreenManage::ScreenMsg::ScreenError: {
// 投屏错误
QString str1 = QString(tr("Screen projection loading error"));
QString str2 =
QString(tr("Please check whether to install the projection expansion package [kylin connectivity tools]"));
m_messageBox = new QMessageBox(this);
m_messageBox->setText(str1 + "\n" + str2);
m_messageBox->setIconPixmap(QIcon::fromTheme("dialog-error").pixmap(MSGICON_W, MSGICON_H));
m_messageBox->addButton(QString(tr("CLOSE")), QMessageBox::AcceptRole);
m_messageBox->show();
// QString str1 = QString(tr("Screen projection loading error"));
// QString str2 =
// QString(tr("Please check whether to install the projection expansion package [kylin connectivity tools]"));
// m_messageBox = new QMessageBox(this);
// m_messageBox->setText(str1 + "\n" + str2);
// m_messageBox->setIconPixmap(QIcon::fromTheme("dialog-error").pixmap(MSGICON_W, MSGICON_H));
// m_messageBox->addButton(QString(tr("CLOSE")), QMessageBox::AcceptRole);
// m_messageBox->show();
} break;
case PcScreenManage::ScreenMsg::Disconnect: {
// 投屏断开
@ -1127,6 +1127,17 @@ void MainWindow::slotUSBConnectOnClicked()
void MainWindow::setScreenOption()
{
if (m_connectInfo.deviceRole == ConnectionService::DeviceRole::RECIPIENT) {
if (!m_pcScreen->isSupport()) {
QString str1 = QString(tr("Screen projection loading error"));
QString str2 =
QString(tr("Please check whether to install the projection expansion package [kylin connectivity tools]"));
m_messageBox = new QMessageBox(this);
m_messageBox->setText(str1 + "\n" + str2);
m_messageBox->setIconPixmap(QIcon::fromTheme("dialog-error").pixmap(MSGICON_W, MSGICON_H));
m_messageBox->addButton(QString(tr("CLOSE")), QMessageBox::AcceptRole);
m_messageBox->show();
return;
}
m_pcScreen->connectService(m_connectInfo.address);
} else {
if (m_connectInfo.deviceType == ConnectionService::DeviceType::ANDROID) {