-
Notifications
You must be signed in to change notification settings - Fork 33
chore: adapt config refactor from ddm #708
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
DDM simplified its configuration system for simplicity and better maintainence, adapt this change.
|
[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. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Reviewer's GuideAdapt greeter session and user models to the new centralized Config API, replacing the old Configuration API usage and updating how session directories and last-used session/user are read and watched. Sequence diagram for greeter session model initialization and refreshsequenceDiagram
actor Greeter
participant SessionModel
participant mainConfig
participant QFileSystem
participant QFileSystemWatcher
participant stateConfig
Greeter ->> SessionModel: construct
SessionModel ->> mainConfig: get QStringList X11 SessionDir
mainConfig -->> SessionModel: x11SessionDir
SessionModel ->> mainConfig: get QStringList Wayland SessionDir
mainConfig -->> SessionModel: waylandSessionDir
SessionModel ->> QFileSystem: exists /dev/dri
QFileSystem -->> SessionModel: dri_active
alt dri_active is true
SessionModel ->> SessionModel: populate WaylandSession with waylandSessionDir
end
SessionModel ->> SessionModel: populate X11Session with x11SessionDir
SessionModel ->> QFileSystemWatcher: create and addPaths waylandSessionDir
SessionModel ->> QFileSystemWatcher: addPaths x11SessionDir
loop on directoryChanged
QFileSystemWatcher ->> SessionModel: directoryChanged
SessionModel ->> QFileSystem: exists /dev/dri
QFileSystem -->> SessionModel: dri_active
SessionModel ->> SessionModel: clear sessions and displayNames
alt dri_active is true
SessionModel ->> SessionModel: populate WaylandSession with waylandSessionDir
end
SessionModel ->> SessionModel: populate X11Session with x11SessionDir
SessionModel ->> stateConfig: get QString Last Session
stateConfig -->> SessionModel: lastSession
SessionModel ->> SessionModel: update lastIndex based on lastSession
end
Sequence diagram for resolving last user via new Config APIsequenceDiagram
actor Greeter
participant UserModel
participant stateConfig
Greeter ->> UserModel: construct
UserModel ->> UserModel: load users into users list
UserModel ->> UserModel: lastUser()
UserModel ->> stateConfig: get QString Last User
stateConfig -->> UserModel: lastUserName
UserModel ->> UserModel: find matching user and set lastIndex
Greeter ->> UserModel: lastUser()
UserModel ->> stateConfig: get QString Last User
stateConfig -->> UserModel: lastUserName
UserModel -->> Greeter: lastUserName
Class diagram for updated greeter config usageclassDiagram
class SessionModel {
+SessionModel(QObject parent)
+~SessionModel()
-void populate(DDM_Session_Type type, QStringList dirPaths)
}
class SessionModelPrivate {
-QVector~SessionPtr~ sessions
-QStringList displayNames
-int lastIndex
}
class UserModel {
+UserModel(QObject parent)
+~UserModel()
+int lastIndex() const
+QString lastUser()
}
class UserModelPrivate {
-QVector~UserPtr~ users
-int lastIndex
}
class Config {
+T get~T~(QString group, QString key)
}
class mainConfig {
}
class stateConfig {
}
SessionModel --> SessionModelPrivate : uses
UserModel --> UserModelPrivate : uses
SessionModel --> mainConfig : reads X11 SessionDir
SessionModel --> mainConfig : reads Wayland SessionDir
SessionModel --> stateConfig : reads Last Session
UserModel --> stateConfig : reads Last User
mainConfig --> Config : instance of
stateConfig --> Config : instance of
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey - I've left some high level feedback:
- The QStringLists for X11/Wayland session directories are captured and copied into the directoryChanged lambda; consider moving these lists into the SessionModelPrivate and referencing them there so you avoid repeated copies and keep the watched paths in sync if the configuration is ever reloaded.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The QStringLists for X11/Wayland session directories are captured and copied into the directoryChanged lambda; consider moving these lists into the SessionModelPrivate and referencing them there so you avoid repeated copies and keep the watched paths in sync if the configuration is ever reloaded.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this 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 PR adapts Treeland's greeter session and user models to use the simplified configuration API introduced in DDM (related to linuxdeepin/ddm#77). The changes migrate from the old Configuration.h header with hierarchical field accessors to the new Config.h header with a generic get<T>() method.
Changes:
- Updated include directives from
Configuration.htoConfig.hin session and user models - Migrated configuration access from
stateConfig.Last.User.get()tostateConfig.get<QString>("Last", "User") - Refactored session directory retrieval to read values once at construction time and capture them in lambda for file system watcher callback
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/greeter/usermodel.cpp | Updated config header and migrated last user retrieval to new API |
| src/greeter/sessionmodel.cpp | Updated config header, migrated session directory and last session retrieval to new API, refactored to read config values once and capture in lambda |
DDM simplified its configuration system for simplicity and better maintainence, adapt this change.
Related with linuxdeepin/ddm#77
Summary by Sourcery
Adapt greeter session and user models to the new shared configuration API and keys.
Enhancements: