fix(screensaver): preview screensaver

Description: 屏保预览

Log: 无
This commit is contained in:
Yang Min 2023-12-27 14:50:04 +08:00
parent 8a3f4f55ca
commit c84d6d55b4
5 changed files with 35 additions and 2 deletions

View File

@ -314,6 +314,30 @@ void DbusUpperInterface::onShowBlankScreensaver()
}
void DbusUpperInterface::ShowScreensaver()
{
if(m_procLockDialog.state() != QProcess::NotRunning){
if(!lockState){
emitLockState(true);
}
QDBusMessage message;
message = QDBusMessage::createSignal(SS_DBUS_PATH,
SS_DBUS_INTERFACE,
"SecondRunParam");
message<<"Screensaver";
QDBusConnection::sessionBus().send(message);
return ;
}
qDebug() << "only show screensaver";
lockState = false;
QString cmd = QString("/usr/bin/ukui-screensaver-dialog --screensaver");
qDebug() << cmd;
m_procLockDialog.start(cmd);
emitLockState(true);
}
void DbusUpperInterface::LockScreensaver()
{
if(m_procLockDialog.state() != QProcess::NotRunning){
if(!lockState){
@ -958,7 +982,7 @@ void DbusUpperInterface::onLogin1ReqLock()
QJsonObject retObj;
retObj["CmdId"] = LOCK_CMD_ID_LOGIN1_REQ_LOCK;
SendUpdateInfoSig(QString(QJsonDocument(retObj).toJson()));
//ShowScreensaver();
//LockScreensaver();
//调用屏保会导致在两个已登录用户切锁屏,会出现屏保界面,因此改为调用锁屏
Lock();
}

View File

@ -106,6 +106,11 @@ public:
*
*/
void ShowScreensaver();
/**
* @brief
*
*/
void LockScreensaver();
/**
* @brief
*

View File

@ -132,6 +132,7 @@ Screensaver::Screensaver(bool isscreensaver,QWidget *parent):
screenLabel->setText(tr("Picture does not exist"));
screenLabel->adjustSize();
screenLabel->hide();
m_strPreViewTrans = tr("View");
}
Screensaver::~Screensaver()
@ -1097,7 +1098,7 @@ void Screensaver::setPreviewText(bool bVisible)
myPreviewLabel->setAlignment(Qt::AlignCenter);
}
myPreviewLabel->setText(tr("View"));
myPreviewLabel->setText(m_strPreViewTrans);
myPreviewLabel->adjustSize();
myPreviewLabel->setVisible(bVisible);

View File

@ -182,6 +182,7 @@ private:
int m_videoSize;
int m_videoWidth;
int m_videoHeight;
QString m_strPreViewTrans;
protected:
void paintEvent(QPaintEvent *event);

View File

@ -216,6 +216,8 @@ void FullBackgroundWidget::onSecondRunParam(const QString &str)
onShowBlankScreensaver(1000,false);
}else if(str == "SessionIdle"){
onShowSessionIdle();
} else if(str == "Screensaver"){
onShowScreensaver();
}
}