!46 修复调用usd快捷键接口卡死的问题 注释部分paintevent打印

Merge pull request !46 from liudunfa/openkylin/nile-dev
This commit is contained in:
杨敏 2023-11-17 07:59:48 +00:00 committed by Gitee
commit 18e371e502
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 58 additions and 55 deletions

View File

@ -26,9 +26,9 @@ UsdHelper::~UsdHelper()
bool UsdHelper::usdExternalDoAction(int actionType) bool UsdHelper::usdExternalDoAction(int actionType)
{ {
QDBusMessage result = usdInterface->call("externalDoAction", actionType, "screensaver"); QDBusPendingCall result = usdInterface->asyncCall("externalDoAction", actionType, "screensaver");
if (result.type() == QDBusMessage::ErrorMessage) { if (result.error().type() == QDBusMessage::ErrorMessage) {
qWarning() << "setDefaultDevice error:" << result.errorMessage(); qWarning() << "usdExternalDoAction error~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" ;
return false; return false;
} }
return true; return true;

View File

@ -691,7 +691,7 @@ void FullBackgroundWidget::initCurrentBackground()
QString FullBackgroundWidget::getDefaultBackgroundPath() QString FullBackgroundWidget::getDefaultBackgroundPath()
{ {
qDebug() << __LINE__ << __FUNCTION__; // qDebug() << __LINE__ << __FUNCTION__;
QString default_background_path = "/usr/share/backgrounds/1-warty-final-ubuntukylin.jpg"; QString default_background_path = "/usr/share/backgrounds/1-warty-final-ubuntukylin.jpg";
QFile file(default_background_path); QFile file(default_background_path);
@ -717,7 +717,7 @@ void FullBackgroundWidget::loadingAllUserBackground()
void FullBackgroundWidget::paintEvent(QPaintEvent *event) void FullBackgroundWidget::paintEvent(QPaintEvent *event)
{ {
qDebug() << __LINE__ << __FUNCTION__; // qDebug() << __LINE__ << __FUNCTION__;
QPainter painter(this); QPainter painter(this);
@ -764,7 +764,7 @@ void FullBackgroundWidget::paintEvent(QPaintEvent *event)
bool FullBackgroundWidget::isOpenGradation() bool FullBackgroundWidget::isOpenGradation()
{ {
qDebug() << __LINE__ << __FUNCTION__; // qDebug() << __LINE__ << __FUNCTION__;
bool isOpenGradation = false; bool isOpenGradation = false;
// return true;//test 一直触发渐变效果 // return true;//test 一直触发渐变效果
if (m_currentUserName.isEmpty() || m_oldUserName.isEmpty()) if (m_currentUserName.isEmpty() || m_oldUserName.isEmpty())
@ -833,7 +833,7 @@ void FullBackgroundWidget::startTransition()
} }
void FullBackgroundWidget::stopTransition() void FullBackgroundWidget::stopTransition()
{ {
qDebug() << __LINE__ << __FUNCTION__; // qDebug() << __LINE__ << __FUNCTION__;
if(m_backgrondGradationTimer && m_backgrondGradationTimer->isActive()) if(m_backgrondGradationTimer && m_backgrondGradationTimer->isActive())
m_backgrondGradationTimer->stop(); m_backgrondGradationTimer->stop();
@ -844,7 +844,7 @@ void FullBackgroundWidget::stopTransition()
void FullBackgroundWidget::drawBackground(QPixmap * backgroundBack, QPixmap * backgroundFront, void FullBackgroundWidget::drawBackground(QPixmap * backgroundBack, QPixmap * backgroundFront,
const QRect &rect, float alpha) const QRect &rect, float alpha)
{ {
qDebug() << __LINE__ << __FUNCTION__; // qDebug() << __LINE__ << __FUNCTION__;
if(backgroundBack->isNull()) if(backgroundBack->isNull())
{ {
@ -887,13 +887,13 @@ void FullBackgroundWidget::drawBackground(QPixmap * backgroundBack, QPixmap * ba
painter1.setPen(Qt::transparent); painter1.setPen(Qt::transparent);
painter1.drawPath(path); painter1.drawPath(path);
} }
qDebug() << __LINE__ << __FUNCTION__<< "===============2"; // qDebug() << __LINE__ << __FUNCTION__<< "===============2";
} }
void FullBackgroundWidget::onRemoveUserBackground(const QString &strUserName) void FullBackgroundWidget::onRemoveUserBackground(const QString &strUserName)
{ {
qDebug() << __LINE__ << __FUNCTION__; // qDebug() << __LINE__ << __FUNCTION__;
if (m_allBackgroundsMap.contains(strUserName)) if (m_allBackgroundsMap.contains(strUserName))
m_allBackgroundsMap.remove(strUserName); m_allBackgroundsMap.remove(strUserName);
@ -901,13 +901,13 @@ void FullBackgroundWidget::onRemoveUserBackground(const QString &strUserName)
QString FullBackgroundWidget::getUserBackgroundPath(const QString &strUserName) QString FullBackgroundWidget::getUserBackgroundPath(const QString &strUserName)
{ {
qDebug() << __LINE__ << __FUNCTION__; // qDebug() << __LINE__ << __FUNCTION__;
for (UserInfoPtr userInfo : m_modelLockDialog->usersInfo()) for (UserInfoPtr userInfo : m_modelLockDialog->usersInfo())
{ {
if (strUserName == userInfo->name()) if (strUserName == userInfo->name())
{ {
qDebug() << __LINE__ << __FUNCTION__ << userInfo->name() << userInfo->backGround(); // qDebug() << __LINE__ << __FUNCTION__ << userInfo->name() << userInfo->backGround();
return userInfo->backGround(); return userInfo->backGround();
} }
@ -917,17 +917,17 @@ QString FullBackgroundWidget::getUserBackgroundPath(const QString &strUserName)
void FullBackgroundWidget::addBackgroundData(const QString &bgPath) void FullBackgroundWidget::addBackgroundData(const QString &bgPath)
{ {
qDebug() << __LINE__ << __FUNCTION__; // qDebug() << __LINE__ << __FUNCTION__;
if (bgPath.isEmpty()) if (bgPath.isEmpty())
{ {
qDebug() << __LINE__ << __FUNCTION__ << bgPath << ":Path is Null"; // qDebug() << __LINE__ << __FUNCTION__ << bgPath << ":Path is Null";
return; return;
} }
QFile file(bgPath); QFile file(bgPath);
if (!file.exists()) if (!file.exists())
{ {
qDebug() << __LINE__ << __FUNCTION__ << "Add background file isn't exists"; // qDebug() << __LINE__ << __FUNCTION__ << "Add background file isn't exists";
return; return;
} }
int width = QApplication::primaryScreen()->geometry().width(); int width = QApplication::primaryScreen()->geometry().width();
@ -942,7 +942,7 @@ void FullBackgroundWidget::addBackgroundData(const QString &bgPath)
bool FullBackgroundWidget::existsBackgroundData(const QString &bgPath) bool FullBackgroundWidget::existsBackgroundData(const QString &bgPath)
{ {
qDebug() << __LINE__ << __FUNCTION__; // qDebug() << __LINE__ << __FUNCTION__;
int width = QApplication::primaryScreen()->geometry().width(); int width = QApplication::primaryScreen()->geometry().width();
int height = QApplication::primaryScreen()->geometry().height(); int height = QApplication::primaryScreen()->geometry().height();
@ -954,7 +954,7 @@ bool FullBackgroundWidget::existsBackgroundData(const QString &bgPath)
void FullBackgroundWidget::onAddUserBackground(const QString &strUserName) void FullBackgroundWidget::onAddUserBackground(const QString &strUserName)
{ {
qDebug() << __LINE__ << __FUNCTION__; // qDebug() << __LINE__ << __FUNCTION__;
FullBackgroundWidget::m_loadingOneBackgroundFuture = QtConcurrent::run([=](){ FullBackgroundWidget::m_loadingOneBackgroundFuture = QtConcurrent::run([=](){
for (UserInfoPtr userInfo : m_modelLockDialog->usersInfo()) for (UserInfoPtr userInfo : m_modelLockDialog->usersInfo())

View File

@ -232,6 +232,8 @@ void LockWidget::keyReleaseEvent(QKeyEvent *e)
onShowVirtualKeyboard(); onShowVirtualKeyboard();
} }
if (m_modelLockDialog->isUseWayland()) {
// 监听按键事件实现快捷键功能 // 监听按键事件实现快捷键功能
switch (e->key()) { switch (e->key()) {
case Qt::Key_VolumeMute: case Qt::Key_VolumeMute:
@ -272,6 +274,7 @@ void LockWidget::keyReleaseEvent(QKeyEvent *e)
} else if (keySequence == listFromString(m_windowScreenshot)) { } else if (keySequence == listFromString(m_windowScreenshot)) {
Q_EMIT m_modelLockDialog->usdExternalDoAction(WINDOW_SCREENSHOT_KEY); Q_EMIT m_modelLockDialog->usdExternalDoAction(WINDOW_SCREENSHOT_KEY);
} }
}
} }
void LockWidget::initUI() void LockWidget::initUI()