Skip to content

chore: clean up the logic of greeter and lockscreen#735

Open
calsys456 wants to merge 2 commits intolinuxdeepin:masterfrom
calsys456:master
Open

chore: clean up the logic of greeter and lockscreen#735
calsys456 wants to merge 2 commits intolinuxdeepin:masterfrom
calsys456:master

Conversation

@calsys456
Copy link
Collaborator

  • chore: clean up the logic of greeter and lockscreen
    This makes the code more clean, clear and robustic.

  • feat: listen to the Lock/Unlock signal of org.freedesktop.login1.Session
    Use systemd-logind for lock & unlock is much more portable and robustic.

Paired with linuxdeepin/ddm#83

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @calsys456, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: calsys456

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

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request cleans up and refactors the greeter and lockscreen logic in Treeland, making the code more maintainable and robust. The PR integrates with systemd-logind for lock/unlock signals and centralizes greeter state management in the GreeterProxy singleton.

Changes:

  • Refactored GreeterProxy to be a comprehensive singleton managing all greeter/lockscreen state with proper DBus signal listeners for systemd-logind session Lock/Unlock events
  • Renamed "logined" to "loggedIn" throughout the codebase for correct English naming
  • Removed the QML GreeterModel singleton and simplified QML component structure, eliminating the WallpaperController.ScaleWithoutAnimation state in favor of conditional animation enablement
  • Updated SessionModel to track currentIndex as a property instead of lastIndex, simplifying session selection

Reviewed changes

Copilot reviewed 26 out of 26 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
src/greeter/greeterproxy.h Complete rewrite with extensive documentation, new properties (isLocked, failedAttempts, showShutdownView, showAnimation, hasActiveSession), and QDBusContext integration
src/greeter/greeterproxy.cpp Refactored implementation with systemd-logind signal listeners (SessionNew, SessionRemoved, Lock, Unlock), centralizing lock/unlock logic
src/greeter/sessionmodel.h Changed from lastIndex to currentIndex property with setter
src/greeter/sessionmodel.cpp Refactored to use member variables instead of private class, proper currentIndex tracking
src/greeter/usermodel.h Renamed LoginedRole to LoggedInRole, logined() to loggedIn(), updated method signatures
src/greeter/usermodel.cpp Updated role names and method implementations for the loggedIn renaming
src/greeter/user.h Renamed logined() to loggedIn() and setLogined() to setLoggedIn()
src/greeter/user.cpp Updated member variable and method implementations for loggedIn renaming
src/seat/helper.h Added m_greeterProxy and m_sessionModel members, inlined userModel() and added sessionModel() accessor
src/seat/helper.cpp Added GreeterProxy and SessionModel singleton initialization, passed GreeterProxy to LockScreen constructor
src/core/lockscreen.h Added GreeterProxy* parameter to constructor and m_greeterProxy member
src/core/lockscreen.cpp Delegates lock/unlock/shutdown/switchUser to GreeterProxy instead of calling QML methods directly
src/wallpaper/wallpapercontroller.h Removed ScaleWithoutAnimation enum value
src/wallpaper/wallpapercontroller.cpp Removed ScaleWithoutAnimation case from switch statement
src/plugins/lockscreen/qml/GreeterModel.qml Deleted QML singleton, functionality moved to C++ GreeterProxy
src/plugins/lockscreen/qml/Greeter.qml Simplified to use GreeterProxy properties, removed CurrentMode enum and start() function
src/plugins/lockscreen/qml/LockView.qml Listens to GreeterProxy.lockChanged signal, removed old GreeterModel state handling
src/plugins/lockscreen/qml/UserInput.qml Uses GreeterProxy directly instead of GreeterModel.proxy, listens to failedAttemptsChanged
src/plugins/lockscreen/qml/UserList.qml Fixed typo: model.logined to model.loggedIn
src/plugins/lockscreen/qml/ShutdownView.qml Uses GreeterProxy directly, removed intermediate signals
src/plugins/lockscreen/qml/SessionList.qml Uses SessionModel.currentIndex directly instead of GreeterModel.currentSession
src/plugins/lockscreen/qml/PowerList.qml Uses GreeterProxy directly, removed lock signal propagation
src/plugins/lockscreen/qml/ControlAction.qml Uses GreeterProxy.hasActiveSession and SessionModel.currentIndex
src/plugins/lockscreen/qml/LoginAnimation.qml Checks GreeterProxy.showAnimation to conditionally run or skip animations
src/core/qml/PrimaryOutput.qml Removed ScaleWithoutAnimation state, uses Behavior with GreeterProxy.showAnimation
src/plugins/lockscreen/CMakeLists.txt Removed GreeterModel.qml from build files

This makes the code more clean, clear and robustic.
Use systemd-logind for lock & unlock is much more portable and robustic.
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.

2 participants