Skip to content

Conversation

@add-uos
Copy link
Contributor

@add-uos add-uos commented Dec 16, 2025

pick v20 to v25

starhcq and others added 5 commits December 16, 2025 16:01
fix the command line to show the window picture

pick from: e037b93

Log: fix the command line to show the window picture
Bug: https://pms.uniontech.com/bug-view-276289.html
fix the 'alt print' shotcut not quit

pick from de3e5e6

Log: fix the 'alt print' shotcut not quit
Bug: https://pms.uniontech.com/bug-view-279221.html
修复外接4K屏卡顿不流畅,使用update去更新界面而不是repaint

pick from: b5c424c

Log: 修复外接4K屏卡顿不流畅,使用update去更新界面而不是repaint
Bug:https://pms.uniontech.com/bug-view-255835.html
fix dormant wake up screen jam during screen recording

pick from: ed69c81

Log: fix dormant wake up screen jam during screen recording
Bug: https://pms.uniontech.com/bug-view-280187.html
fix dormant wake up screen jam during screen recording

pick form:73d63eeb3d741ec99e25eac26fef8602418a60a

Log: fix dormant wake up screen jam during screen recording in sw military
Bug: https://pms.uniontech.com/bug-view-280187.html
@deepin-ci-robot
Copy link

deepin pr auto review

我来对这段代码进行审查:

  1. 代码逻辑和功能:
  • 新增了对SW64架构军用版系统的锁屏处理
  • 增加了锁屏时停止录屏的功能
  • 优化了某些架构下的界面刷新机制
  • 在截图完成后增加了自动退出功能
  1. 存在的问题和改进建议:

(1) 代码注释问题:

/**
 * @brief onPowersource 监听锁屏,监听锁屏信号,在锁屏后结束录屏,包括休眠恢复后也会锁屏,也会结束录屏
 * @param flag
 */

注释中的函数名错误,应该是 onLockedStopRecord 而不是 onPowersource。参数说明也不准确,实际参数是 name、map 和 list,而不是 flag。

建议修改为:

/**
 * @brief onLockedStopRecord 监听锁屏信号,在锁屏后结束录屏
 * @param name 接口名称
 * @param map 属性映射表,包含Locked状态
 * @param list 变更的属性列表
 */

(2) 性能优化建议:

QTimer::singleShot(10, [=] {
    exitApp();
});

使用10ms的延迟可能太短,建议适当延长到100ms,确保所有操作都完成:

QTimer::singleShot(100, [=] {
    exitApp();
});

(3) 安全性考虑:

void MainWindow::onLockedStopRecord(const QString &name, QVariantMap map, const QStringList &list)
{
    qDebug() << "Locked will quit!"<<"----------------" << name << map << list;
    
    if (map.value("Locked").value<bool>()) {
        onExit();
    }
}

建议增加错误处理和空值检查:

void MainWindow::onLockedStopRecord(const QString &name, QVariantMap map, const QStringList &list)
{
    qCDebug(dsrApp) << "Locked will quit!" << name << map << list;
    
    if (!map.contains("Locked")) {
        qCWarning(dsrApp) << "No Locked property in the map";
        return;
    }
    
    bool isLocked = map.value("Locked").toBool();
    if (isLocked) {
        onExit();
    }
}

(4) 架构相关代码优化:

#if defined (__mips__) || defined (__aarch64__)

建议使用更清晰的宏定义,并添加注释说明原因:

#if defined (__mips__) || defined (__aarch64__)
    // 在这些架构下使用repaint()会导致界面卡死
    // 问题出现在1052U2、1070和1060等设备上
    update();
#else
    repaint();
#endif

(5) 代码组织:
建议将锁屏相关的代码组织在一起,可以考虑创建一个专门的方法来处理锁屏逻辑:

void MainWindow::setupLockScreenMonitoring()
{
#if defined __sw_64__
    if (DSysInfo::uosEditionType() == DSysInfo::UosEdition::UosMilitary) {
        QDBusConnection::sessionBus().connect("com.deepin.SessionManager",
                                              "/com/deepin/SessionManager",
                                              "org.freedesktop.DBus.Properties",
                                              "PropertiesChanged",
                                              this,
                                              SLOT(onLockedStopRecord(QString, QVariantMap, QStringList)));
    }
#endif
}

(6) 错误处理:
DBUS连接应该增加错误处理:

bool connected = QDBusConnection::sessionBus().connect(...);
if (!connected) {
    qCWarning(dsrApp) << "Failed to connect to SessionManager for lock screen monitoring";
}

(7) 资源清理:
在退出应用时,应该确保正确清理DBUS连接:

void MainWindow::exitApp()
{
    QDBusConnection::sessionBus().disconnect("com.deepin.SessionManager",
                                           "/com/deepin/SessionManager",
                                           "org.freedesktop.DBus.Properties",
                                           "PropertiesChanged",
                                           this,
                                           SLOT(onLockedStopRecord(QString, QVariantMap, QStringList)));
    // 其他清理操作...
}

这些改进将使代码更加健壮、可维护,并提高其安全性和性能。

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: add-uos, lzwind

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@add-uos
Copy link
Contributor Author

add-uos commented Dec 16, 2025

/merge

@deepin-bot deepin-bot bot merged commit d4be697 into linuxdeepin:develop/snipe Dec 16, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants