Token Manager (Qt6): default checkboxes unchecked; token size 32px
Updates Token Manager to Qt 6. Sets checkboxes default to unchecked and tokenSizeComboBox default to 32 px. Built and validated in alt CI; identical commits here.
Summary by Sourcery
Introduce full token management and rendering for characters in both group and map views, including custom overrides, ghost tokens for removed NPCs, and new user preferences defaulting to 32px icons.
New Features:
- Add TokenManager to load, cache, and upload custom character tokens from a tokens directory
- Allow setting or clearing individual character icons via context menu in the group widget
- Render tokens in the group list and map canvas with support for ghost tokens of removed NPCs
Enhancements:
- Refactor GroupModel to use helper functions for display and tooltip roles and extract insertion logic
- Introduce GhostRegistry to track removed NPC positions and render ghost icons on the map
- Extend CGroupChar and CharacterBatch to pass display names for token lookup and rendering
Build:
- Include tokenmanager.cpp and tokenmanager.h in the build sources
Documentation:
- Update README to point to the wiki build instructions
Reviewer's Guide
This PR adds a new TokenManager to handle custom character icons, integrates token rendering into the group list and map (including NPC ghost tokens), introduces new group preferences (show/hide tokens, map tokens, NPC ghosts, and configurable token size with defaults unchecked and 32px), refactors GroupModel character insertion/removal to use a helper and ghost registry, and updates build and docs accordingly.
Sequence diagram for updating character token and map rendering
sequenceDiagram
actor User
participant GroupWidget
participant TokenManager
participant MapCanvas
User->>GroupWidget: Set icon for character
GroupWidget->>TokenManager: getToken(key)
GroupWidget->>GroupWidget: slot_updateLabels()
GroupWidget->>MapCanvas: sig_characterUpdated(character)
MapCanvas->>TokenManager: getToken(key)
MapCanvas->>MapCanvas: slot_requestUpdate()
MapCanvas->>MapCanvas: paintCharacters() (uses token icon)
Entity relationship diagram for new group manager settings
erDiagram
GROUP_MANAGER_SETTINGS {
bool showTokens
bool showMapTokens
int tokenIconSize
bool showNpcGhosts
QMap tokenOverrides
}
TOKEN_OVERRIDES {
QString characterName
QString tokenKey
}
GROUP_MANAGER_SETTINGS ||--o{ TOKEN_OVERRIDES : contains
Class diagram for new and updated token management classes
classDiagram
class TokenManager {
+QPixmap getToken(key: QString)
+static QString overrideFor(displayName: QString)
+const QMap<QString, QString> &availableFiles()
+MMTextureId textureIdFor(key: QString)
+MMTextureId uploadNow(key: QString, px: QPixmap)
+void rememberUpload(key: QString, id: MMTextureId, tex: SharedMMTexture)
+SharedMMTexture textureById(id: MMTextureId) const
-void scanDirectories()
-QMap<QString, QString> m_availableFiles
-QFileSystemWatcher m_watcher
-QMap<QString, QString> m_tokenPathCache
-QPixmap m_fallbackPixmap
-QHash<QString, MMTextureId> m_textureCache
-QVector<SharedMMTexture> m_ownedTextures
}
class CGroupChar {
-QString m_characterToken
+QString getDisplayName() const
+void setCharacterToken(tokenPath: QString)
+const QString &getCharacterToken() const
+inline bool isMount() const
}
class GhostInfo {
+QString tokenKey
}
class GhostRegistry {
}
TokenManager <.. CGroupChar : uses
CGroupChar <.. GhostRegistry : used for ghost tokens
GhostRegistry <.. GhostInfo : contains
File-Level Changes
| Change | Details | Files |
|---|---|---|
| Add TokenManager for loading, caching and uploading token pixmaps and textures |
|
src/group/tokenmanager.cppsrc/group/tokenmanager.hCMakeLists.txt |
| Integrate tokens into group list UI with context menu actions |
|
src/group/groupwidget.cppsrc/group/groupwidget.h |
| Render map tokens and NPC ghost tokens in CharacterBatch |
|
src/display/Characters.cppsrc/display/Characters.hsrc/display/GhostRegistry.h |
| Add and wire new group preferences for token visibility, map tokens, NPC ghosts, and token size |
|
src/preferences/grouppage.cppsrc/preferences/grouppage.hsrc/configuration/configuration.cppsrc/configuration/configuration.h |
| Refactor GroupModel character insertion/removal and introduce ghost handling helper |
|
src/group/groupwidget.cpp |
| Miscellaneous build updates and documentation tweaks |
|
README.mdCMakeLists.txt |
Tips and commands
Interacting with Sourcery
-
Trigger a new review: Comment
@sourcery-ai reviewon the pull request. - Continue discussions: Reply directly to Sourcery's review comments.
-
Generate a GitHub issue from a review comment: Ask Sourcery to create an
issue from a review comment by replying to it. You can also reply to a
review comment with
@sourcery-ai issueto create an issue from it. -
Generate a pull request title: Write
@sourcery-aianywhere in the pull request title to generate a title at any time. You can also comment@sourcery-ai titleon the pull request to (re-)generate the title at any time. -
Generate a pull request summary: Write
@sourcery-ai summaryanywhere in the pull request body to generate a PR summary at any time exactly where you want it. You can also comment@sourcery-ai summaryon the pull request to (re-)generate the summary at any time. -
Generate reviewer's guide: Comment
@sourcery-ai guideon the pull request to (re-)generate the reviewer's guide at any time. -
Resolve all Sourcery comments: Comment
@sourcery-ai resolveon the pull request to resolve all Sourcery comments. Useful if you've already addressed all the comments and don't want to see them anymore. -
Dismiss all Sourcery reviews: Comment
@sourcery-ai dismisson the pull request to dismiss all existing Sourcery reviews. Especially useful if you want to start fresh with a new review - don't forget to comment@sourcery-ai reviewto trigger a new review!
Customizing Your Experience
Access your dashboard to:
- Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others.
- Change the review language.
- Add, remove or edit custom review instructions.
- Adjust other review settings.
Getting Help
- Contact our support team for questions or feedback.
- Visit our documentation for detailed guides and information.
- Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.