!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)
{
QDBusMessage result = usdInterface->call("externalDoAction", actionType, "screensaver");
if (result.type() == QDBusMessage::ErrorMessage) {
qWarning() << "setDefaultDevice error:" << result.errorMessage();
QDBusPendingCall result = usdInterface->asyncCall("externalDoAction", actionType, "screensaver");
if (result.error().type() == QDBusMessage::ErrorMessage) {
qWarning() << "usdExternalDoAction error~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" ;
return false;
}
return true;

View File

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

View File

@ -232,45 +232,48 @@ void LockWidget::keyReleaseEvent(QKeyEvent *e)
onShowVirtualKeyboard();
}
// 监听按键事件实现快捷键功能
switch (e->key()) {
case Qt::Key_VolumeMute:
Q_EMIT m_modelLockDialog->usdExternalDoAction(MIC_MUTE_KEY);
break;
case Qt::Key_VolumeDown:
Q_EMIT m_modelLockDialog->usdExternalDoAction(VOLUME_DOWN_KEY);
break;
case Qt::Key_VolumeUp:
Q_EMIT m_modelLockDialog->usdExternalDoAction(VOLUME_UP_KEY);
break;
case Qt::Key_MonBrightnessUp:
Q_EMIT m_modelLockDialog->usdExternalDoAction(BRIGHT_UP_KEY);
break;
case Qt::Key_MonBrightnessDown:
Q_EMIT m_modelLockDialog->usdExternalDoAction(BRIGHT_DOWN_KEY);
break;
case Qt::Key_TouchpadOn:
Q_EMIT m_modelLockDialog->usdExternalDoAction(TOUCHPAD_ON_KEY);
break;
case Qt::Key_TouchpadOff:
Q_EMIT m_modelLockDialog->usdExternalDoAction(TOUCHPAD_OFF_KEY);
break;
default:
break;
}
// 实现锁屏截图功能
QKeySequence keySequence = QKeySequence(e->modifiers() + e->key());
if (keySequence == listFromString(m_areaScreenShot)) {
Q_EMIT m_modelLockDialog->usdExternalDoAction(AREA_SCREENSHOT_KEY);
} else if (keySequence == listFromString(m_areaScreenShot2)) {
Q_EMIT m_modelLockDialog->usdExternalDoAction(AREA_SCREENSHOT_KEY);
} else if (keySequence == listFromString(m_screenShot)) {
Q_EMIT m_modelLockDialog->usdExternalDoAction(SCREENSHOT_KEY);
} else if (keySequence == listFromString(m_screenShot2)) {
Q_EMIT m_modelLockDialog->usdExternalDoAction(SCREENSHOT_KEY);
} else if (keySequence == listFromString(m_windowScreenshot)) {
Q_EMIT m_modelLockDialog->usdExternalDoAction(WINDOW_SCREENSHOT_KEY);
if (m_modelLockDialog->isUseWayland()) {
// 监听按键事件实现快捷键功能
switch (e->key()) {
case Qt::Key_VolumeMute:
Q_EMIT m_modelLockDialog->usdExternalDoAction(MIC_MUTE_KEY);
break;
case Qt::Key_VolumeDown:
Q_EMIT m_modelLockDialog->usdExternalDoAction(VOLUME_DOWN_KEY);
break;
case Qt::Key_VolumeUp:
Q_EMIT m_modelLockDialog->usdExternalDoAction(VOLUME_UP_KEY);
break;
case Qt::Key_MonBrightnessUp:
Q_EMIT m_modelLockDialog->usdExternalDoAction(BRIGHT_UP_KEY);
break;
case Qt::Key_MonBrightnessDown:
Q_EMIT m_modelLockDialog->usdExternalDoAction(BRIGHT_DOWN_KEY);
break;
case Qt::Key_TouchpadOn:
Q_EMIT m_modelLockDialog->usdExternalDoAction(TOUCHPAD_ON_KEY);
break;
case Qt::Key_TouchpadOff:
Q_EMIT m_modelLockDialog->usdExternalDoAction(TOUCHPAD_OFF_KEY);
break;
default:
break;
}
// 实现锁屏截图功能
QKeySequence keySequence = QKeySequence(e->modifiers() + e->key());
if (keySequence == listFromString(m_areaScreenShot)) {
Q_EMIT m_modelLockDialog->usdExternalDoAction(AREA_SCREENSHOT_KEY);
} else if (keySequence == listFromString(m_areaScreenShot2)) {
Q_EMIT m_modelLockDialog->usdExternalDoAction(AREA_SCREENSHOT_KEY);
} else if (keySequence == listFromString(m_screenShot)) {
Q_EMIT m_modelLockDialog->usdExternalDoAction(SCREENSHOT_KEY);
} else if (keySequence == listFromString(m_screenShot2)) {
Q_EMIT m_modelLockDialog->usdExternalDoAction(SCREENSHOT_KEY);
} else if (keySequence == listFromString(m_windowScreenshot)) {
Q_EMIT m_modelLockDialog->usdExternalDoAction(WINDOW_SCREENSHOT_KEY);
}
}
}