Cockatrice/common
BruebachL f73196841a
Multiple Printings per Deck (#5171)
* Refactor CardInfo Widgets to reside in their appropriate folder and to have a clearer naming structure.

* Added Zach's work on storing printing information in the DeckList (#1)

* Change CardInfo's PixmapCacheKey to be the UUID of the preferred set after database loading has finished. Otherwise, and if no UUID of a preferred set is available, default to the card name.

* Refactor CardDatabase *db global variable to singleton CardDatabaseManager.

This commit refactors the global variable CardDatabase *db into a singleton encapsulated by the DatabaseManager class, accessible via DatabaseManager::getInstance(). This change centralizes access to the database instance, improving code modularity and encapsulation, resolving dependencies on main.h for code that requires access to the database instance.

- Added DatabaseManager class with getInstance() method returning a pointer to the singleton CardDatabase.
- Removed global db variable and updated references across the codebase.
 - Thread-safe static initialization for the singleton.

Impact: This refactor should have no functional impact on the application, as it maintains the same interface for accessing the CardDatabase instance. However, the codebase now benefits from improved encapsulation, lifetime management, and thread-safety.

* fixed db issue an renamed sets to set in picture loader

* canibalized zach work and added it to the decklist builder

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>

* Reintroduce some changes lost in the merge.

* Introduce UUID attribute to abstract_card_item, card_item, deck_view_card, server_card and serverinfo_card.

* Have various game events respect the new UUID attribute on instantiation.

* Correct some calls to default to preferred printing.

* DeckList now tries to assign reasonable defaults for UUID and collectorNumber if none are found in loaded DeckLists.
Rename overloaded DeckListModel findChild() function to findCardChildByNameAndUUID() for clarity.

* canibalized zach work and added it to the decklist builder

* Change getPreferredPrintingForCard to getPreferredSetForCard to reflect refactor.

* Properly update and set the DeckEditor's CardFrame to fetch by name and UUID if a card was selected from the decklist.

* Mainboard/Sideboard swaps should respect the UUID from the old zone instead of just blindly adding preferredPrinting.

* If the card info is null, there's no point in trying to look for the sets.

* Don't define methods twice.

* Convenience method to fetch a specific CardInfoPerSet instance for a cardName and a UUID.

* Check if the uuid starts with card_ when comparing.

* Address pull request comments (nullptr checks and additional comments, mostly.)

* Reformat code so the linter will stop yelling at me.

* DeckList no longer pre-populates uuids.

* Update Event_MoveCard to include the card UUID.

* Update Player::MoveCard to include the card UUID.

* Set the uuid when we set the cardName, in terms of hidden zones.

* [TEST/RevertMe] Set the uuid everywhere to test.

* Don't inline setUUID and mimic setName for AbstractCardItem.

* Revert blindly setting uuid for testing.

* Address PR comments (AbstractCardItem).

* Combine if-statement.

* Re-order uuid to visually align with its field number.

* Remove unnecessary new uuid field from event_move_card.

* Remove unused imports.

* Include cardName in the PixmapCacheKey in order to not break double-faced cards.

* Refactor setCode to cardUUID and introduce new cardSetShortName field.

* Override

* Refactor UUID to be providerId and change QString comparisons with empty string to isEmpty().

* Update translations.

* Change parent to be the first argument.

* Pull Parent argument up for CardItem.

* Pull Parent argument up for CardItem.

* Linter.

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
Co-authored-by: LunaticCat <39006478+LunyaticCat@users.noreply.github.com>
Co-authored-by: luna <yannbrun1507@outlook.fr>
Co-authored-by: ZeldaZach <zahalpern+github@gmail.com>
2024-11-18 21:56:44 -05:00
..
lib Counter expressions (#3534) 2019-02-02 13:56:49 -05:00
pb Multiple Printings per Deck (#5171) 2024-11-18 21:56:44 -05:00
sfmt update sfmt to version 1.5.1 from 1.4.1 (#4124) 2020-10-02 12:13:12 -04:00
CMakeLists.txt Add cmake format (#4618) 2022-05-08 21:22:43 +02:00
color.h Tabs to spaces. 2014-07-08 22:53:02 -04:00
debug_pb_message.cpp Allow up to 100 dice to be rolled at a time (#5047) 2024-06-12 08:37:04 -04:00
debug_pb_message.h implement custom protobuf debug string creation (#4532) 2022-02-23 23:46:23 +01:00
decklist.cpp Multiple Printings per Deck (#5171) 2024-11-18 21:56:44 -05:00
decklist.h Multiple Printings per Deck (#5171) 2024-11-18 21:56:44 -05:00
expression.cpp Support Qt6, Min Qt5.8, Fix Win32, Fix Servatrice 2022-05-06 17:31:08 -04:00
expression.h Counter expressions (#3534) 2019-02-02 13:56:49 -05:00
featureset.cpp Address /W4 compiler warnings for Windows (#4910) 2023-10-15 20:31:13 -04:00
featureset.h Address /W4 compiler warnings for Windows (#4910) 2023-10-15 20:31:13 -04:00
get_pb_extension.cpp clangify everything with the new header sorting (#3908) 2020-03-18 17:36:02 -04:00
get_pb_extension.h Clang-format (#3028) 2018-01-27 10:41:32 +01:00
passwordhasher.cpp miscellaneous refactors (#4521) 2022-01-16 17:58:53 -05:00
passwordhasher.h miscellaneous refactors (#4521) 2022-01-16 17:58:53 -05:00
rng_abstract.cpp clangify everything with the new header sorting (#3908) 2020-03-18 17:36:02 -04:00
rng_abstract.h Clang-format (#3028) 2018-01-27 10:41:32 +01:00
rng_sfmt.cpp Address /W4 compiler warnings for Windows (#4910) 2023-10-15 20:31:13 -04:00
rng_sfmt.h clangify everything with the new header sorting (#3908) 2020-03-18 17:36:02 -04:00
room_message_type.h Fix Mac Builds (#4844) 2023-08-06 22:45:45 -04:00
server.cpp Address /W4 compiler warnings for Windows (#4910) 2023-10-15 20:31:13 -04:00
server.h Support Qt6, Min Qt5.8, Fix Win32, Fix Servatrice 2022-05-06 17:31:08 -04:00
server_abstractuserinterface.cpp clangify everything with the new header sorting (#3908) 2020-03-18 17:36:02 -04:00
server_abstractuserinterface.h apply chat flood prevention in games next to rooms (#4387) 2021-06-28 01:57:46 -04:00
server_arrow.cpp clangify everything with the new header sorting (#3908) 2020-03-18 17:36:02 -04:00
server_arrow.h assign new arrow id when arrow is moved to transformed card (#5012) 2024-03-27 14:47:00 +01:00
server_arrowtarget.cpp Tabs to spaces. 2014-07-08 22:53:02 -04:00
server_arrowtarget.h Clang-format (#3028) 2018-01-27 10:41:32 +01:00
server_card.cpp Multiple Printings per Deck (#5171) 2024-11-18 21:56:44 -05:00
server_card.h Multiple Printings per Deck (#5171) 2024-11-18 21:56:44 -05:00
server_cardzone.cpp Allow Judges to see all information, regardless of room settings (#5053) 2024-06-16 19:12:37 -04:00
server_cardzone.h remove cards being looked at from the count on drawing (#4671) 2022-10-17 16:35:54 -04:00
server_counter.cpp clangify everything with the new header sorting (#3908) 2020-03-18 17:36:02 -04:00
server_counter.h clangify everything with the new header sorting (#3908) 2020-03-18 17:36:02 -04:00
server_database_interface.cpp Overhaul common's CMakeLists.txt 2014-06-11 01:24:34 +02:00
server_database_interface.h Support Qt6, Min Qt5.8, Fix Win32, Fix Servatrice 2022-05-06 17:31:08 -04:00
server_game.cpp Allow Judges to see all information, regardless of room settings (#5053) 2024-06-16 19:12:37 -04:00
server_game.h fix deprecation of QMutex::Recursive in favor of QRecursiveMutex (#4328) 2021-05-01 18:51:17 -04:00
server_player.cpp Multiple Printings per Deck (#5171) 2024-11-18 21:56:44 -05:00
server_player.h Allow up to 100 dice to be rolled at a time (#5047) 2024-06-12 08:37:04 -04:00
server_player_reference.h Clang-format (#3028) 2018-01-27 10:41:32 +01:00
server_protocolhandler.cpp Allow up to 100 dice to be rolled at a time (#5047) 2024-06-12 08:37:04 -04:00
server_protocolhandler.h Support Qt6, Min Qt5.8, Fix Win32, Fix Servatrice 2022-05-06 17:31:08 -04:00
server_remoteuserinterface.cpp clangify everything with the new header sorting (#3908) 2020-03-18 17:36:02 -04:00
server_remoteuserinterface.h apply chat flood prevention in games next to rooms (#4387) 2021-06-28 01:57:46 -04:00
server_response_containers.cpp Allow Judges to see all information, regardless of room settings (#5053) 2024-06-16 19:12:37 -04:00
server_response_containers.h Allow Judges to see all information, regardless of room settings (#5053) 2024-06-16 19:12:37 -04:00
server_room.cpp Allow up to 100 dice to be rolled at a time (#5047) 2024-06-12 08:37:04 -04:00
server_room.h Address /W4 compiler warnings for Windows (#4910) 2023-10-15 20:31:13 -04:00
serverinfo_user_container.cpp Support Qt6, Min Qt5.8, Fix Win32, Fix Servatrice 2022-05-06 17:31:08 -04:00
serverinfo_user_container.h Support Qt6, Min Qt5.8, Fix Win32, Fix Servatrice 2022-05-06 17:31:08 -04:00
trice_limits.h Allow up to 100 dice to be rolled at a time (#5047) 2024-06-12 08:37:04 -04:00
user_level.h Fix Mac Builds (#4844) 2023-08-06 22:45:45 -04:00