Cockatrice/common/pb
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
..
admin_commands.proto apply clang format to proto files (#4123) 2020-10-02 12:14:05 -04:00
card_attributes.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
CMakeLists.txt Support MacOS 12 & 13. Support Protobuf 23. Deprecate MacOS 11. (#4884) 2023-10-13 14:45:22 -04:00
color.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
command_attach_card.proto apply clang format to proto files (#4123) 2020-10-02 12:14:05 -04:00
command_change_zone_properties.proto Always look at top card (#4238) 2021-03-13 14:54:13 -05:00
command_concede.proto apply clang format to proto files (#4123) 2020-10-02 12:14:05 -04:00
command_create_arrow.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
command_create_counter.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
command_create_token.proto Better support Double-Faced Cards (#4753) 2023-03-03 16:54:51 +01:00
command_deck_del.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
command_deck_del_dir.proto apply clang format to proto files (#4123) 2020-10-02 12:14:05 -04:00
command_deck_download.proto apply clang format to proto files (#4123) 2020-10-02 12:14:05 -04:00
command_deck_list.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
command_deck_new_dir.proto apply clang format to proto files (#4123) 2020-10-02 12:14:05 -04:00
command_deck_select.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
command_deck_upload.proto apply clang format to proto files (#4123) 2020-10-02 12:14:05 -04:00
command_del_counter.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
command_delete_arrow.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
command_draw_cards.proto apply clang format to proto files (#4123) 2020-10-02 12:14:05 -04:00
command_dump_zone.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
command_flip_card.proto apply clang format to proto files (#4123) 2020-10-02 12:14:05 -04:00
command_game_say.proto apply clang format to proto files (#4123) 2020-10-02 12:14:05 -04:00
command_inc_card_counter.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
command_inc_counter.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
command_kick_from_game.proto apply clang format to proto files (#4123) 2020-10-02 12:14:05 -04:00
command_leave_game.proto apply clang format to proto files (#4123) 2020-10-02 12:14:05 -04:00
command_move_card.proto apply clang format to proto files (#4123) 2020-10-02 12:14:05 -04:00
command_mulligan.proto apply clang format to proto files (#4123) 2020-10-02 12:14:05 -04:00
command_next_turn.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
command_ready_start.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
command_replay_delete_match.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
command_replay_download.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
command_replay_list.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
command_replay_modify_match.proto apply clang format to proto files (#4123) 2020-10-02 12:14:05 -04:00
command_reveal_cards.proto Allow revealing specific cards from hand and library (#4743) 2023-02-07 17:12:04 -05:00
command_reverse_turn.proto apply clang format to proto files (#4123) 2020-10-02 12:14:05 -04:00
command_roll_die.proto Allow up to 100 dice to be rolled at a time (#5047) 2024-06-12 08:37:04 -04:00
command_set_active_phase.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
command_set_card_attr.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
command_set_card_counter.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
command_set_counter.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
command_set_sideboard_lock.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
command_set_sideboard_plan.proto apply clang format to proto files (#4123) 2020-10-02 12:14:05 -04:00
command_shuffle.proto apply clang format to proto files (#4123) 2020-10-02 12:14:05 -04:00
command_undo_draw.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
commands.proto apply clang format to proto files (#4123) 2020-10-02 12:14:05 -04:00
context_concede.proto Unconcede (#3515) 2019-01-27 12:50:41 -05:00
context_connection_state_changed.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
context_deck_select.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
context_move_card.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
context_mulligan.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
context_ping_changed.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
context_ready_start.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
context_set_sideboard_lock.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
context_undo_draw.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
event_add_to_list.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
event_attach_card.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
event_change_zone_properties.proto Always look at top card (#4238) 2021-03-13 14:54:13 -05:00
event_connection_closed.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
event_create_arrow.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
event_create_counter.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
event_create_token.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
event_del_counter.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
event_delete_arrow.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
event_destroy_card.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
event_draw_cards.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
event_dump_zone.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
event_flip_card.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
event_game_closed.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
event_game_host_changed.proto apply clang format to proto files (#4123) 2020-10-02 12:14:05 -04:00
event_game_joined.proto Judge mode (#3531) 2019-02-21 14:00:00 -05:00
event_game_say.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
event_game_state_changed.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
event_join.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
event_join_room.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
event_kicked.proto apply clang format to proto files (#4123) 2020-10-02 12:14:05 -04:00
event_leave.proto Specify reason when on game leave; fix #2624 (#2633) 2017-04-24 22:20:08 +02:00
event_leave_room.proto apply clang format to proto files (#4123) 2020-10-02 12:14:05 -04:00
event_list_games.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
event_list_rooms.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
event_move_card.proto Multiple Printings per Deck (#5171) 2024-11-18 21:56:44 -05:00
event_notify_user.proto apply clang format to proto files (#4123) 2020-10-02 12:14:05 -04:00
event_player_properties_changed.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
event_remove_from_list.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
event_remove_messages.proto add option to delete a user's messages (#4362) 2021-09-14 16:05:20 -04:00
event_replay_added.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
event_reveal_cards.proto Allow revealing specific cards from hand and library (#4743) 2023-02-07 17:12:04 -05:00
event_reverse_turn.proto Add a new command to reverse turn order (#3802) 2019-08-27 20:04:27 -04:00
event_roll_die.proto Allow up to 100 dice to be rolled at a time (#5047) 2024-06-12 08:37:04 -04:00
event_room_say.proto apply clang format to proto files (#4123) 2020-10-02 12:14:05 -04:00
event_server_complete_list.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
event_server_identification.proto allow login using hashed passwords (#4464) 2021-11-09 20:00:41 -05:00
event_server_message.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
event_server_shutdown.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
event_set_active_phase.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
event_set_active_player.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
event_set_card_attr.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
event_set_card_counter.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
event_set_counter.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
event_shuffle.proto Move to bottom of library in random order. (#3549) 2019-02-07 14:08:44 -05:00
event_user_joined.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
event_user_left.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
event_user_message.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
game_commands.proto deprecate the gender property from the protocol entirely (#4496) 2021-12-14 01:51:57 -05:00
game_event.proto deprecate the gender property from the protocol entirely (#4496) 2021-12-14 01:51:57 -05:00
game_event_container.proto Judge mode (#3531) 2019-02-21 14:00:00 -05:00
game_event_context.proto Unconcede (#3515) 2019-01-27 12:50:41 -05:00
game_replay.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
isl_message.proto apply clang format to proto files (#4123) 2020-10-02 12:14:05 -04:00
moderator_commands.proto add option to delete a user's messages (#4362) 2021-09-14 16:05:20 -04:00
move_card_to_zone.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
response.proto allow login using hashed passwords (#4464) 2021-11-09 20:00:41 -05:00
response_activate.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
response_adjust_mod.proto apply clang format to proto files (#4123) 2020-10-02 12:14:05 -04:00
response_ban_history.proto apply clang format to proto files (#4123) 2020-10-02 12:14:05 -04:00
response_deck_download.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
response_deck_list.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
response_deck_upload.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
response_dump_zone.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
response_forgotpasswordrequest.proto Simpler forgot password functionality (#2393) 2017-02-15 17:41:40 -05:00
response_get_games_of_user.proto apply clang format to proto files (#4123) 2020-10-02 12:14:05 -04:00
response_get_user_info.proto apply clang format to proto files (#4123) 2020-10-02 12:14:05 -04:00
response_join_room.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
response_list_users.proto apply clang format to proto files (#4123) 2020-10-02 12:14:05 -04:00
response_login.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
response_password_salt.proto allow login using hashed passwords (#4464) 2021-11-09 20:00:41 -05:00
response_register.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
response_replay_download.proto apply clang format to proto files (#4123) 2020-10-02 12:14:05 -04:00
response_replay_list.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
response_viewlog_history.proto apply clang format to proto files (#4123) 2020-10-02 12:14:05 -04:00
response_warn_history.proto apply clang format to proto files (#4123) 2020-10-02 12:14:05 -04:00
response_warn_list.proto apply clang format to proto files (#4123) 2020-10-02 12:14:05 -04:00
room_commands.proto Create game as spectator (#4281) 2021-03-13 14:39:25 -05:00
room_event.proto add option to delete a user's messages (#4362) 2021-09-14 16:05:20 -04:00
server_message.proto apply clang format to proto files (#4123) 2020-10-02 12:14:05 -04:00
serverinfo_arrow.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
serverinfo_ban.proto apply clang format to proto files (#4123) 2020-10-02 12:14:05 -04:00
serverinfo_card.proto Multiple Printings per Deck (#5171) 2024-11-18 21:56:44 -05:00
serverinfo_cardcounter.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
serverinfo_chat_message.proto apply clang format to proto files (#4123) 2020-10-02 12:14:05 -04:00
serverinfo_counter.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
serverinfo_deckstorage.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
serverinfo_game.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
serverinfo_gametype.proto apply clang format to proto files (#4123) 2020-10-02 12:14:05 -04:00
serverinfo_player.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
serverinfo_playerping.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
serverinfo_playerproperties.proto Judge mode (#3531) 2019-02-21 14:00:00 -05:00
serverinfo_replay.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00
serverinfo_replay_match.proto apply clang format to proto files (#4123) 2020-10-02 12:14:05 -04:00
serverinfo_room.proto Smarter rooms (#2484) 2017-03-22 21:45:16 -04:00
serverinfo_user.proto deprecate the gender property from the protocol entirely (#4496) 2021-12-14 01:51:57 -05:00
serverinfo_warning.proto apply clang format to proto files (#4123) 2020-10-02 12:14:05 -04:00
serverinfo_zone.proto Always look at top card (#4238) 2021-03-13 14:54:13 -05:00
session_commands.proto remove unused include in pb file (#4572) 2022-02-12 23:40:47 +01:00
session_event.proto protobuf warnings fixed (#2313) 2016-12-11 19:22:39 +01:00