diff --git a/cmake/NSIS.template.in b/cmake/NSIS.template.in
index 5af116470..7b52b7bcc 100644
--- a/cmake/NSIS.template.in
+++ b/cmake/NSIS.template.in
@@ -117,22 +117,21 @@ ${If} $InstDir == ""
; we need to set a default based on the install mode
StrCpy $InstDir $0
${EndIf}
+Call SetModeDestinationFromInstdir
-; --- Detect portable install when using /R (must come BEFORE SetModeDestinationFromInstdir) ---
+; --- Detect portable install when using /R ---
${If} $ReinstallMode = 1
IfFileExists "$InstDir\portable.dat" 0 not_portable
StrCpy $PortableMode 1
Goto portable_done
+
not_portable:
StrCpy $PortableMode 0
+
portable_done:
${EndIf}
-; Now that $PortableMode reflects reality, commit InstDir into the correct slot
-Call SetModeDestinationFromInstdir
-
${If} $ReinstallMode = 1
-${AndIf} $PortableMode = 0
Call AutoUninstallIfNeeded
${EndIf}
diff --git a/cmake/gtest-CMakeLists.txt.in b/cmake/gtest-CMakeLists.txt.in
index 2062d7f8c..2d71a55e5 100644
--- a/cmake/gtest-CMakeLists.txt.in
+++ b/cmake/gtest-CMakeLists.txt.in
@@ -1,16 +1,15 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.2)
project(gtest-download LANGUAGES NONE)
include(ExternalProject)
-externalproject_add(
- googletest
- URL https://github.com/google/googletest/archive/refs/tags/v1.17.0.zip
- URL_HASH SHA1=f638fa0e724760e2ba07ff8cfba32cd644e1ce28
+ExternalProject_Add(googletest
+ URL https://github.com/google/googletest/archive/release-1.11.0.zip
+ URL_HASH SHA1=9ffb7b5923f4a8fcdabf2f42c6540cce299f44c0
SOURCE_DIR "${CMAKE_BINARY_DIR}/gtest-src"
BINARY_DIR "${CMAKE_BINARY_DIR}/gtest-build"
CONFIGURE_COMMAND ""
- BUILD_COMMAND ""
- INSTALL_COMMAND ""
- TEST_COMMAND ""
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ""
+ TEST_COMMAND ""
)
diff --git a/cockatrice/CMakeLists.txt b/cockatrice/CMakeLists.txt
index 60ba06593..6fd009dd9 100644
--- a/cockatrice/CMakeLists.txt
+++ b/cockatrice/CMakeLists.txt
@@ -7,7 +7,6 @@ project(Cockatrice VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${
set(cockatrice_SOURCES
${VERSION_STRING_CPP}
# sort by alphabetical order, so that there is no debate about where to add new sources to the list
- src/client/network/connection_controller/remote_connection_controller.cpp
src/client/network/update/client/update_downloader.cpp
src/client/network/interfaces/deck_stats_interface.cpp
src/client/network/interfaces/tapped_out_interface.cpp
@@ -56,75 +55,68 @@ set(cockatrice_SOURCES
src/filters/filter_tree_model.cpp
src/filters/syntax_help.cpp
src/game/abstract_game.cpp
- src/game/arrow_registry.cpp
- src/game_graphics/board/abstract_card_drag_item.cpp
- src/game_graphics/board/abstract_card_item.cpp
- src/game_graphics/board/abstract_counter.cpp
- src/game/board/arrow_data.cpp
- src/game_graphics/board/arrow_item.cpp
- src/game_graphics/board/arrow_target.cpp
- src/game_graphics/board/card_drag_item.cpp
- src/game_graphics/board/card_item.cpp
+ src/game/board/abstract_card_drag_item.cpp
+ src/game/board/abstract_card_item.cpp
+ src/game/board/abstract_counter.cpp
+ src/game/board/arrow_item.cpp
+ src/game/board/arrow_target.cpp
+ src/game/board/card_drag_item.cpp
+ src/game/board/card_item.cpp
src/game/board/card_list.cpp
- src/game/board/card_state.cpp
- src/game_graphics/board/counter_general.cpp
- src/game/board/counter_state.cpp
- src/game_graphics/board/translate_counter_name.cpp
- src/game_graphics/deckview/deck_view.cpp
- src/game_graphics/deckview/deck_view_container.cpp
- src/game_graphics/deckview/tabbed_deck_view_container.cpp
- src/game_graphics/dialogs/dlg_create_token.cpp
- src/game_graphics/dialogs/dlg_move_top_cards_until.cpp
- src/game_graphics/dialogs/dlg_roll_dice.cpp
+ src/game/board/counter_general.cpp
+ src/game/board/translate_counter_name.cpp
+ src/game/deckview/deck_view.cpp
+ src/game/deckview/deck_view_container.cpp
+ src/game/deckview/tabbed_deck_view_container.cpp
+ src/game/dialogs/dlg_create_token.cpp
+ src/game/dialogs/dlg_move_top_cards_until.cpp
+ src/game/dialogs/dlg_roll_dice.cpp
src/game/game.cpp
src/game/game_event_handler.cpp
src/game/game_meta_info.cpp
- src/game_graphics/game_scene.cpp
+ src/game/game_scene.cpp
src/game/game_state.cpp
- src/game_graphics/game_view.cpp
- src/game_graphics/hand_counter.cpp
- src/game_graphics/log/message_log_widget.cpp
+ src/game/game_view.cpp
+ src/game/hand_counter.cpp
+ src/game/log/message_log_widget.cpp
src/game/phase.cpp
- src/game_graphics/phases_toolbar.cpp
- src/game_graphics/player/menu/card_menu.cpp
- src/game_graphics/player/menu/custom_zone_menu.cpp
- src/game_graphics/player/menu/grave_menu.cpp
- src/game_graphics/player/menu/hand_menu.cpp
- src/game_graphics/player/menu/library_menu.cpp
- src/game_graphics/player/menu/move_menu.cpp
- src/game_graphics/player/menu/player_menu.cpp
- src/game_graphics/player/menu/pt_menu.cpp
- src/game_graphics/player/menu/rfg_menu.cpp
- src/game_graphics/player/menu/say_menu.cpp
- src/game_graphics/player/menu/sideboard_menu.cpp
- src/game_graphics/player/menu/utility_menu.cpp
- src/game_graphics/tally/subtype_tally.cpp
- src/game_graphics/tally/tally.cpp
+ src/game/phases_toolbar.cpp
+ src/game/player/menu/card_menu.cpp
+ src/game/player/menu/custom_zone_menu.cpp
+ src/game/player/menu/grave_menu.cpp
+ src/game/player/menu/hand_menu.cpp
+ src/game/player/menu/library_menu.cpp
+ src/game/player/menu/move_menu.cpp
+ src/game/player/menu/player_menu.cpp
+ src/game/player/menu/pt_menu.cpp
+ src/game/player/menu/rfg_menu.cpp
+ src/game/player/menu/say_menu.cpp
+ src/game/player/menu/sideboard_menu.cpp
+ src/game/player/menu/utility_menu.cpp
+ src/game/player/player.cpp
src/game/player/player_actions.cpp
- src/game_graphics/player/player_area.cpp
- src/game_graphics/player/player_dialogs.cpp
+ src/game/player/player_area.cpp
src/game/player/player_event_handler.cpp
- src/game_graphics/player/player_graphics_item.cpp
+ src/game/player/player_graphics_item.cpp
src/game/player/player_info.cpp
- src/game_graphics/player/player_list_widget.cpp
- src/game/player/player_logic.cpp
+ src/game/player/player_list_widget.cpp
src/game/player/player_manager.cpp
- src/game_graphics/player/player_target.cpp
+ src/game/player/player_target.cpp
src/game/replay.cpp
- src/game/zones/card_zone_logic.cpp
- src/game/zones/hand_zone_logic.cpp
- src/game/zones/pile_zone_logic.cpp
- src/game/zones/stack_zone_logic.cpp
- src/game/zones/table_zone_logic.cpp
- src/game/zones/view_zone_logic.cpp
- src/game_graphics/zones/card_zone.cpp
- src/game_graphics/zones/hand_zone.cpp
- src/game_graphics/zones/pile_zone.cpp
- src/game_graphics/zones/select_zone.cpp
- src/game_graphics/zones/stack_zone.cpp
- src/game_graphics/zones/table_zone.cpp
- src/game_graphics/zones/view_zone.cpp
- src/game_graphics/zones/view_zone_widget.cpp
+ src/game/zones/card_zone.cpp
+ src/game/zones/hand_zone.cpp
+ src/game/zones/logic/card_zone_logic.cpp
+ src/game/zones/logic/hand_zone_logic.cpp
+ src/game/zones/logic/pile_zone_logic.cpp
+ src/game/zones/logic/stack_zone_logic.cpp
+ src/game/zones/logic/table_zone_logic.cpp
+ src/game/zones/logic/view_zone_logic.cpp
+ src/game/zones/pile_zone.cpp
+ src/game/zones/select_zone.cpp
+ src/game/zones/stack_zone.cpp
+ src/game/zones/table_zone.cpp
+ src/game/zones/view_zone.cpp
+ src/game/zones/view_zone_widget.cpp
src/game_graphics/board/abstract_graphics_item.cpp
src/interface/card_picture_loader/card_picture_loader.cpp
src/interface/card_picture_loader/card_picture_loader_local.cpp
@@ -137,13 +129,7 @@ set(cockatrice_SOURCES
src/interface/layouts/overlap_layout.cpp
src/interface/widgets/utility/line_edit_completer.cpp
src/interface/pixel_map_generator.cpp
- src/interface/theme_config.cpp
src/interface/theme_manager.cpp
- src/interface/palette_editor/color_button.cpp
- src/interface/palette_editor/palette_generator.cpp
- src/interface/palette_editor/quick_setup_panel.cpp
- src/interface/palette_editor/palette_grid_widget.cpp
- src/interface/palette_editor/palette_editor_dialog.cpp
src/interface/widgets/cards/additional_info/color_identity_widget.cpp
src/interface/widgets/cards/additional_info/mana_cost_widget.cpp
src/interface/widgets/cards/additional_info/mana_symbol_widget.cpp
@@ -185,7 +171,6 @@ set(cockatrice_SOURCES
src/interface/widgets/deck_analytics/analyzer_modules/mana_distribution/mana_distribution_single_display_widget.cpp
src/interface/widgets/deck_analytics/analyzer_modules/mana_curve/mana_curve_total_widget.cpp
src/interface/widgets/deck_analytics/analyzer_modules/mana_curve/mana_curve_category_widget.cpp
- src/interface/widgets/deck_editor/card_database_view.cpp
src/interface/widgets/deck_editor/deck_list_history_manager_widget.cpp
src/interface/widgets/deck_editor/deck_editor_card_database_dock_widget.cpp
src/interface/widgets/deck_editor/deck_editor_card_info_dock_widget.cpp
@@ -231,30 +216,17 @@ set(cockatrice_SOURCES
src/interface/widgets/replay/replay_manager.cpp
src/interface/widgets/replay/replay_timeline_widget.cpp
src/interface/widgets/server/chat_view/chat_view.cpp
- src/interface/widgets/server/game_filter_configs.cpp
src/interface/widgets/server/game_selector.cpp
src/interface/widgets/server/game_selector_quick_filter_toolbar.cpp
src/interface/widgets/server/games_model.cpp
src/interface/widgets/server/handle_public_servers.cpp
src/interface/widgets/server/remote/remote_decklist_tree_widget.cpp
src/interface/widgets/server/remote/remote_replay_list_tree_widget.cpp
- src/interface/widgets/server/user/user_avatar_provider.cpp
- src/interface/widgets/server/user/user_card_art_provider.cpp
- src/interface/widgets/server/user/user_card_settings_dialog.cpp
src/interface/widgets/server/user/user_context_menu.cpp
src/interface/widgets/server/user/user_info_box.cpp
src/interface/widgets/server/user/user_info_connection.cpp
src/interface/widgets/server/user/user_list_manager.cpp
- src/interface/widgets/server/user/user_list_painter.cpp
src/interface/widgets/server/user/user_list_widget.cpp
- src/interface/widgets/settings_page/appearance_settings_page.cpp
- src/interface/widgets/settings_page/deck_editor_settings_page.cpp
- src/interface/widgets/settings_page/general_settings_page.cpp
- src/interface/widgets/settings_page/messages_settings_page.cpp
- src/interface/widgets/settings_page/shortcut_settings_page.cpp
- src/interface/widgets/settings_page/sound_settings_page.cpp
- src/interface/widgets/settings_page/storage_settings_page.cpp
- src/interface/widgets/settings_page/user_interface_settings_page.cpp
src/interface/widgets/utility/custom_line_edit.cpp
src/interface/widgets/utility/get_text_with_max.cpp
src/interface/widgets/utility/sequence_edit.cpp
@@ -333,7 +305,6 @@ set(cockatrice_SOURCES
src/interface/widgets/tabs/tab.cpp
src/interface/widgets/tabs/tab_account.cpp
src/interface/widgets/tabs/tab_admin.cpp
- src/interface/widgets/tabs/tab_card_art_rules.cpp
src/interface/widgets/tabs/tab_deck_editor.cpp
src/interface/widgets/tabs/tab_deck_storage.cpp
src/interface/widgets/tabs/tab_game.cpp
@@ -354,10 +325,6 @@ set(cockatrice_SOURCES
src/interface/widgets/tabs/api/edhrec/display/commander/edhrec_commander_api_response_bracket_navigation_widget.h
src/interface/widgets/tabs/api/edhrec/display/commander/edhrec_commander_api_response_budget_navigation_widget.cpp
src/interface/widgets/tabs/api/edhrec/display/commander/edhrec_commander_api_response_budget_navigation_widget.h
- src/interface/widgets/utility/compact_push_button.cpp
- src/interface/widgets/utility/compact_push_button.h
- src/interface/widgets/server/user/user_info_popup.cpp
- src/interface/widgets/server/user/user_info_popup.h
)
add_subdirectory(sounds)
diff --git a/cockatrice/cockatrice.qrc b/cockatrice/cockatrice.qrc
index 9c34929b7..37fb145f0 100644
--- a/cockatrice/cockatrice.qrc
+++ b/cockatrice/cockatrice.qrc
@@ -55,7 +55,6 @@
resources/icons/view.svgresources/icons/mana/B.svg
- resources/icons/mana/C.svgresources/icons/mana/G.svgresources/icons/mana/R.svgresources/icons/mana/U.svg
@@ -70,7 +69,6 @@
resources/config/interface.svgresources/config/messages.svgresources/config/deckeditor.svg
- resources/config/storage.svgresources/config/shorcuts.svgresources/config/sound.svgresources/config/debug.ini
diff --git a/cockatrice/cockatrice_en@source.ts b/cockatrice/cockatrice_en@source.ts
index e06972ddc..810b345df 100644
--- a/cockatrice/cockatrice_en@source.ts
+++ b/cockatrice/cockatrice_en@source.ts
@@ -4,7 +4,7 @@
AbstractCounter
-
+ &Set counter...
@@ -12,12 +12,12 @@
AbstractCounterDialog
-
+ Set counter
-
+ New value for counter '%1':
@@ -38,60 +38,60 @@
AbstractTabDeckEditor
-
+ Open in new tab
-
+ Are you sure?
-
+ The decklist has been modified.
Do you want to save the changes?
-
-
-
-
-
-
+
+
+
+
+
+ Error
-
+ Could not open deck at %1
-
+ Could not save remote deck
-
-
+
+ The deck could not be saved.
Please check that the directory is writable and try again.
-
+ Save deck
-
+ The deck could not be saved.
-
+ There are no cards in your deck to be exported
@@ -107,12 +107,12 @@ Please check that the directory is writable and try again.
AdminNotesDialog
-
+ Update Notes
-
+ Admin Notes for %1
@@ -129,227 +129,172 @@ Please check that the directory is writable and try again.
Sideboard
-
-
- Tokens
-
- AppearanceSettingsPage
-
+ seconds
-
+ Error
-
+ Could not create themes directory at '%1'.
-
+ Theme settings
-
+ Current theme:
-
+ Open themes folder
-
+ Home tab background source:
-
+ Home tab background shuffle frequency:
-
+ Disabled
-
+
+ Display card name of background in bottom right:
+
+
+
+ Menu settings
-
+ Show keyboard shortcuts in right-click menus
-
+ Show game filter toolbar above list in room tab
-
+ Card rendering
-
+ Display card names on cards having a picture
-
+ Auto-Rotate cards with sideways layout
-
+ Override all card art with personal set preference (Pre-ProviderID change behavior)
-
- Light
-
-
-
-
- Dark
-
-
-
-
- System
-
-
-
-
- Active theme palette:
-
-
-
-
- Edit theme palette
-
-
-
-
- Home tab settings
-
-
-
-
- Display card name of background in bottom right
-
-
-
-
- Styling settings
-
-
-
-
- Style user list
-
-
-
-
- Card printings
-
-
-
-
+ Bump sets that the deck contains cards from to the top in the printing selector
-
+ Scale cards on mouse over
-
+ Use rounded card corners
-
- Card layout
-
-
-
-
+ Minimum overlap percentage of cards on the stack and in vertical hand
-
+ Maximum initial height for card view window:
-
-
+
+ rows
-
+ Maximum expanded height for card view window:
-
+ Card counters
-
+ Counter %1
-
+ Hand layout
-
+ Display hand horizontally (wastes space)
-
+ Enable left justification
-
+ Table grid layout
-
+ Invert vertical coordinate
-
+ Minimum player count for multi-column layout:
-
+ Maximum font size for information displayed on cards:
@@ -357,12 +302,12 @@ Please check that the directory is writable and try again.
ArchidektApiResponseDeckDisplayWidget
-
+ Back to results
-
+ Open Deck in Deck Editor
@@ -388,111 +333,111 @@ Please check that the directory is writable and try again.
BanDialog
-
+ ban &user name
-
+ ban &IP address
-
+ ban client I&D
-
+ Ban type
-
+ &permanent ban
-
+ &temporary ban
-
+ &Days:
-
+ &Hours:
-
+ &Minutes:
-
+ Duration of the ban
-
+ Please enter the reason for the ban.
This is only saved for moderators and cannot be seen by the banned person.
-
+ Please enter the reason for the ban that will be visible to the banned person.
-
+ Redact all messages from this user in all rooms
-
+ &OK
-
+ &Cancel
-
+ Ban user from server
-
-
-
-
+
+
+
+ Error
-
+ You have to select a name-based, IP-based, clientId based, or some combination of the three to place a ban.
-
+ You must have a value in the name ban when selecting the name ban checkbox.
-
+ You must have a value in the ip ban when selecting the ip ban checkbox.
-
+ You must have a value in the clientid ban when selecting the clientid ban checkbox.
@@ -500,123 +445,59 @@ This is only saved for moderators and cannot be seen by the banned person.
BetaReleaseChannel
-
+ Beta
-
+ No reply received from the release update server.
-
+ Invalid reply received from the release update server.
-
+ No reply received from the file update server.
-
- CardArtPreviewWidget
-
-
- No card selected
-
-
-
-
- CardArtRulesModel
-
-
- Card
-
-
-
-
- ProviderId
-
-
-
-
- Mode
-
-
-
-
- Reason
-
-
-CardDatabaseModel
-
+ Name
-
+ Sets
-
+ Mana cost
-
+ Card type
-
+ P/T
-
+ Color(s)
-
- CardDatabaseView
-
-
- Add to Deck
-
-
-
-
- Add to Sideboard
-
-
-
-
- Select Printing
-
-
-
-
- Show on EDHRec (Commander)
-
-
-
-
- Show on EDHRec (Card)
-
-
-
-
- Show Related cards
-
-
-CardFilter
@@ -745,22 +626,22 @@ This is only saved for moderators and cannot be seen by the banned person.
CardInfoPictureWidget
-
+ View related cards
-
+ Add card to deck
-
+ Mainboard
-
+ Sideboard
@@ -783,12 +664,12 @@ This is only saved for moderators and cannot be seen by the banned person.
-
+ Related cards:
-
+ Unknown card:
@@ -796,146 +677,128 @@ This is only saved for moderators and cannot be seen by the banned person.
CardMenu
-
+ Re&veal to...
-
+ &All players
-
+ View related cards
-
+ Token:
-
+ All tokens
-
+ &Select All
-
+ S&elect Row
-
+ S&elect Column
-
+ &Play
-
+ &Hide
-
+ Play &Face Down
-
+ &Tap / UntapTurn sideways or back again
-
+ Skip &untapping
-
+ T&urn OverTurn face up/face down
-
+ &Peek at card face
-
+ &Clone
-
+ Attac&h to card...
-
+ Unattac&h
-
+ &Draw arrow...
-
+ &Set annotation...
-
- Reduce life by power
-
-
-
-
+ Ca&rd counters
-
+ &Add counter (%1)
-
+ &Remove counter (%1)
-
+ &Set counters (%1)...
-
- CardPictureLoaderCacheMethod
-
-
- Network Cache
-
-
-
-
- Filesystem
-
-
-CardSizeWidget
@@ -947,133 +810,133 @@ This is only saved for moderators and cannot be seen by the banned person.
CardZoneLogic
-
+ their handnominative
-
+ %1's handnominative
-
+ their librarylook at zone
-
+ %1's librarylook at zone
-
+ of their librarytop cards of zone,
-
+ of %1's librarytop cards of zone
-
+ their libraryreveal zone
-
+ %1's libraryreveal zone
-
+ their libraryshuffle
-
+ %1's libraryshuffle
-
+ their librarynominative
-
+ %1's librarynominative
-
+ their graveyardnominative
-
+ %1's graveyardnominative
-
+ their exilenominative
-
+ %1's exilenominative
-
+ their sideboardlook at zone
-
+ %1's sideboardlook at zone
-
+ their sideboardnominative
-
+ %1's sideboardnominative
-
+ their custom zone '%1'nominative
-
+ %1's custom zone '%2'nominative
@@ -1095,424 +958,16 @@ This is only saved for moderators and cannot be seen by the banned person.
-
- ColorButton
-
-
- Click to pick a color
-
-
-
-
- Pick colour
-
-
-
-
- ConnectionController
-
-
-
- The server has reached its maximum user capacity, please check back later.
-
-
-
-
- There are too many concurrent connections from your address.
-
-
-
-
- Banned by moderator
-
-
-
-
- Expected end time: %1
-
-
-
-
- This ban lasts indefinitely.
-
-
-
-
- Scheduled server shutdown.
-
-
-
-
-
- Invalid username.
-
-
-
-
- You have been logged out due to logging in at another location.
-
-
-
-
- Connection closed
-
-
-
-
- The server has terminated your connection.
-Reason: %1
-
-
-
-
- The server is going to be restarted in %n minute(s).
-All running games will be lost.
-Reason for shutdown: %1
-
-
-
-
-
-
-
- Scheduled server shutdown
-
-
-
-
- Failed Login
-
-
-
-
- Your client seems to be missing features this server requires for connection.
-
-
-
-
- To update your client, go to 'Help -> Check for Client Updates'.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Error
-
-
-
-
- Incorrect username or password. Please check your authentication information and try again.
-
-
-
-
- There is already an active session using this user name.
-Please close that session first and re-login.
-
-
-
-
-
- You are banned until %1.
-
-
-
-
-
- You are banned indefinitely.
-
-
-
-
- This server requires user registration. Do you want to register now?
-
-
-
-
- This server requires client IDs. Your client is either failing to generate an ID or you are running a modified client.
-Please close and reopen your client to try again.
-
-
-
-
- An internal error has occurred, please close and reopen Cockatrice before trying again.
-If the error persists, ensure you are running the latest version of the software and if needed contact the software developers.
-
-
-
-
- Account activation
-
-
-
-
- Your account has not been activated yet.
-You need to provide the activation token received in the activation email.
-
-
-
-
- Server Full
-
-
-
-
- Unknown login error: %1
-
-
-
-
-
-
-This usually means that your client version is out of date, and the server sent a reply your client doesn't understand.
-
-
-
-
-
-
-
-
-
- Registration denied
-
-
-
-
- Registration is currently disabled on this server
-
-
-
-
- There is already an existing account with the same user name.
-
-
-
-
- It's mandatory to specify a valid email address when registering.
-
-
-
-
- It appears you are attempting to register a new account on this server yet you already have an account registered with the email provided. This server restricts the number of accounts a user can register per address. Please contact the server operator for further assistance or to obtain your credential information.
-
-
-
-
- Password too short.
-
-
-
-
- Registration failed for a technical problem on the server.
-
-
-
-
- The connection to the server has been lost.
-
-
-
-
- Unknown registration error: %1
-
-
-
-
- Account activation failed
-
-
-
-
- Socket error: %1
-
-
-
-
- Server timeout
-
-
-
-
- You are trying to connect to an obsolete server. Please downgrade your Cockatrice version or connect to a suitable server.
-Local version is %1, remote version is %2.
-
-
-
-
- Your Cockatrice client is obsolete. Please update your Cockatrice version.
-Local version is %1, remote version is %2.
-
-
-
-
-
- Success
-
-
-
-
- Registration accepted.
-Will now login.
-
-
-
-
- Account activation accepted.
-Will now login.
-
-
-
-
- Information
-
-
-
-
- This server supports additional features that your client doesn't have.
-This is most likely not a problem, but this message might mean there is a new version of Cockatrice available or this server is running a custom or pre-release version.
-
-To update your client, go to Help -> Check for Updates.
-
-
-
-
-
-
- Reset Password
-
-
-
-
- Your password has been reset successfully, you can now log in using the new credentials.
-
-
-
-
- Failed to reset user account password, please contact the server operator to reset your password.
-
-
-
-
- Activation request received, please check your email for an activation token.
-
-
-
-
- Connecting to %1...
-
-
-
-
- Registering to %1 as %2...
-
-
-
-
- Disconnected
-
-
-
-
- Connected, logging in at %1
-
-
-
-
- Requesting forgotten password to %1 as %2...
-
-
-
-
- Your username must respect these rules:
-
-
-
-
- is %1 - %2 characters long
-
-
-
-
- can %1 contain lowercase characters
-
-
-
-
-
-
-
- NOT
-
-
-
-
- can %1 contain uppercase characters
-
-
-
-
- can %1 contain numeric characters
-
-
-
-
- can contain the following punctuation: %1
-
-
-
-
- first character can %1 be a punctuation mark
-
-
-
-
- no unacceptable language as specified by these server rules:
- note that the following lines will not be translated
-
-
-
-
- can not contain any of the following words: %1
-
-
-
-
- can not match any of the following expressions: %1
-
-
-
-
- You may only use A-Z, a-z, 0-9, _, ., and - in your username.
-
-
-CustomZoneMenu
-
+ C&ustom Zones
-
-
+
+ View custom zone '%1'
@@ -1520,35 +975,30 @@ To update your client, go to Help -> Check for Updates.
DeckAnalyticsWidget
-
+ Add Panel
-
+ Remove Panel
-
+ Save Layout
-
+ Load Layout
-
-
- Include Sideboard
-
- DeckEditorCardDatabaseDockWidget
-
+ Card Database
@@ -1564,17 +1014,47 @@ To update your client, go to Help -> Check for Updates.
DeckEditorDatabaseDisplayWidget
-
+ Search by card name (or search expressions)
-
+
+ Add to Deck
+
+
+
+
+ Add to Sideboard
+
+
+
+
+ Select Printing
+
+
+
+
+ Show on EDHRec (Commander)
+
+
+
+
+ Show on EDHRec (Card)
+
+
+
+
+ Show Related cards
+
+
+
+ Add card to &maindeck
-
+ Add card to &sideboard
@@ -1607,72 +1087,72 @@ To update your client, go to Help -> Check for Updates.
-
+ Select Printing
-
+ Deck
-
+ Deck &name:
-
+ Banner Card/Tags Visibility Settings
-
+ Show banner card selection menu
-
+ Show tags selection menu
-
+ &Comments:
-
+ Group by:
-
+ Format:
-
+ Hash:
-
+ &Increment number
-
+ &Decrement number
-
+ &Remove row
-
+ Swap card to/from sideboard
@@ -1680,17 +1160,17 @@ To update your client, go to Help -> Check for Updates.
DeckEditorFilterDockWidget
-
+ Filters
-
+ &Clear all filters
-
+ Delete selected
@@ -1821,113 +1301,169 @@ To update your client, go to Help -> Check for Updates.
DeckEditorSettingsPage
-
-
+
+ Update Spoilers
-
+
+ Success
-
+ Download URLs have been reset.
-
+
+ Downloaded card pictures have been reset.
+
+
+
+
+ Error
+
+
+
+
+ One or more downloaded card pictures could not be cleared.
+
+
+
+ Add URL
-
-
+
+ URL:
-
-
+
+ Edit URL
-
+
+ Network Cache Size:
+
+
+
+
+ Redirect Cache TTL:
+
+
+
+
+ How long cached redirects for urls are valid for.
+
+
+
+
+ Picture Cache Size:
+
+
+
+ Add New URL
-
+ Remove URL
-
+
+ Day(s)
+
+
+
+ Updating...
-
+ Choose path
-
+ URL Download Priority
-
+ Spoilers
-
+ Download Spoilers Automatically
-
+ Spoiler Location:
-
+ Last Change
-
+ Spoilers download automatically on launch
-
+ Press the button to manually update without relaunching
-
+ Do not close settings until manual update is complete
-
+ Download card pictures on the fly
-
+ How to add a custom URL
-
+
+ Delete Downloaded Images
+
+
+
+ Reset Download URLs
+
+
+ On-disk cache for downloaded pictures
+
+
+
+
+ In-memory cache for pictures not currently on screen
+
+ DeckListHistoryManagerWidget
@@ -1993,12 +1529,12 @@ To update your client, go to Help -> Check for Updates.
DeckLoader
-
+ Common deck formats (%1)
-
+ All files (*.*)
@@ -2220,27 +1756,27 @@ To update your client, go to Help -> Check for Updates.
-
+ Moved to %1 1 × "%2" (%3)
-
+ Removed "%1" (all copies)
-
+ %1 1 × "%2" (%3)
-
+ Added
-
+ Removed
@@ -2262,74 +1798,74 @@ To update your client, go to Help -> Check for Updates.
DeckViewContainer
-
+ Load deck...
-
+ Load remote deck...
-
+ Load from clipboard...
-
+ Load from website...
-
+ Unload deck
-
+ Ready to start
-
+ Force start
-
+ Sideboard unlocked
-
+ Sideboard locked
-
-
+
+ Error
-
+ The selected file could not be loaded.
-
+ Deck is greater than maximum file size.
-
+ Are you sure you want to force start?
This will kick all non-ready players from the game.
-
+ Cockatrice
@@ -2428,7 +1964,7 @@ This will kick all non-ready players from the game.
-
+ Webpage
@@ -2468,37 +2004,37 @@ This will kick all non-ready players from the game.
-
+ Server URL
-
+ Communication Port
-
+ Unique Server Name
-
+ Connection Warning
-
+ You need to name your new connection profile.
-
+ Connect Warning
-
+ The player name can't be empty.
@@ -2611,17 +2147,17 @@ This will kick all non-ready players from the game.
-
+ Game information
-
+ Error
-
+ Server error.
@@ -2629,97 +2165,97 @@ This will kick all non-ready players from the game.
DlgCreateToken
-
+ &Name:
-
+ Token
-
+ C&olor:
-
+ white
-
+ blue
-
+ black
-
+ red
-
+ green
-
+ multicolor
-
+ colorless
-
+ &P/T:
-
+ &Annotation:
-
+ &Destroy token when it leaves the table
-
+ Create face-down (Only hides name)
-
+ Token data
-
+ Show &all tokens
-
+ Show tokens from this &deck
-
+ Choose token from list
-
+ Create token
@@ -2753,7 +2289,7 @@ This will kick all non-ready players from the game.
-
+ ✖
@@ -2768,12 +2304,12 @@ This will kick all non-ready players from the game.
-
+ Duplicate Tag
-
+ This tag already exists.
@@ -2959,12 +2495,12 @@ To remove your current avatar, confirm without choosing a new image.
-
+ Error
-
+ The chosen name conflicts with an existing card or token.
Make sure to enable the 'Token' set in the "Manage sets" dialog to display them correctly.
@@ -2988,12 +2524,12 @@ Make sure to enable the 'Token' set in the "Manage sets" dia
-
+ Real name:
-
+ Edit user profile
@@ -3031,113 +2567,113 @@ Make sure to enable the 'Token' set in the "Manage sets" dia
-
+ Hide 'buddies only' games
-
+ Hide full games
-
+ Hide games that have started
-
+ Hide password protected games
-
+ Hide 'ignored user' games
-
+ Hide games not created by buddiesHide games not created by buddy
-
+ Hide games with forced open decklists
-
+ &Newer than:
-
+ Game &description:
-
+ &Creator name:
-
+ General
-
+ &Game types
-
+ at &least:
-
+ at &most:
-
+ Maximum player count
-
+ Restrictions
-
+ Show games only if &spectators can watch
-
+ Show spectator password p&rotected games
-
+ Show only if spectators can ch&at
-
+ Show only if spectators can see &hands
-
+ Spectators
-
+ Filter games
@@ -3440,37 +2976,37 @@ https://tappedout.net/mtg-decks/your-deck-name/
DlgMoveTopCardsUntil
-
+ Card name (or search expressions):
-
+ Number of hits:
-
+ Auto play hits
-
+ Put top cards on stack until...
-
+ No cards matching the search expression exists in the card database. Proceed anyways?
-
+ Cockatrice
-
+ Invalid filter
@@ -3529,40 +3065,40 @@ Your email will be used to verify your account.
-
+ Real name:
-
+ Register to server
-
-
-
-
+
+
+
+ Registration Warning
-
+ Your password is too short.
-
+ Your passwords do not match, please try again.
-
+ Your email addresses do not match, please try again.
-
+ The player name can't be empty.
@@ -3570,17 +3106,17 @@ Your email will be used to verify your account.
DlgRollDice
-
+ Number of sides:
-
+ Number of dice:
-
+ Roll Dice
@@ -3631,12 +3167,12 @@ Your email will be used to verify your account.
DlgSettings
-
+ Unknown Error loading card database
-
+ Your card database is invalid.
Cockatrice may not function correctly with an invalid database
@@ -3647,7 +3183,7 @@ Would you like to change your database location setting?
-
+ Your card database version is too old.
This can cause problems loading card information or images
@@ -3658,7 +3194,7 @@ Would you like to change your database location setting?
-
+ Your card database did not finish loading
Please file a ticket at https://github.com/Cockatrice/Cockatrice/issues with your cards.xml attached
@@ -3667,21 +3203,21 @@ Would you like to change your database location setting?
-
+ File Error loading your card database.
Would you like to change your database location setting?
-
+ Your card database was loaded but contains no cards.
Would you like to change your database location setting?
-
+ Unknown card database load status
Please file a ticket at https://github.com/Cockatrice/Cockatrice/issues
@@ -3690,64 +3226,59 @@ Would you like to change your database location setting?
-
-
-
+
+
+ Error
-
+ The path to your deck directory is invalid. Would you like to go back and set the correct path?
-
+ The path to your card pictures directory is invalid. Would you like to go back and set the correct path?
-
+ Settings
-
+ General
-
+ Appearance
-
+ User Interface
-
- Storage
-
-
-
-
+ Card Sources
-
+ Chat
-
+ Sound
-
+ Shortcuts
@@ -3839,9 +3370,9 @@ You can always change this behavior in the 'General' settings tab.
-
-
-
+
+
+ Error
@@ -3893,31 +3424,31 @@ Please visit the download page to update manually.
-
+ Update Available
-
+ A new version of Cockatrice is available!
-
+ New version
-
+ Released
-
+ Changelog
@@ -3927,50 +3458,50 @@ Please visit the download page to update manually.
-
+ Unfortunately, the automatic updater failed to find a compatible download.
You may have to manually download the new version.
-
+ Please check the <a href="%1">releases page</a> on our Github and download the build for your system.
-
-
-
+
+
+ Update Error
-
+ An error occurred while checking for updates:
-
+ An error occurred while downloading an update:
-
+ Installing...
-
+ Cockatrice is unable to open the installer.
-
+ Try to update manually by closing Cockatrice and running the installer.
-
+ Download location
@@ -4060,67 +3591,67 @@ You may have to manually download the new version.
DrawProbabilityWidget
-
+ Draw Probability
-
+ Probability of drawing
-
+ Card Name
-
+ Type
-
+ Subtype
-
+ Mana Value
-
+ At least
-
+ Exactly
-
+ card(s) having drawn at least
-
+ cards
-
+ Category
-
+ Qty
-
+ Odds (%)
@@ -4234,7 +3765,7 @@ You may have to manually download the new version.
FilterBuilder
-
+ Type your filter here
@@ -4265,22 +3796,22 @@ You may have to manually download the new version.
GameEventHandler
-
+ kicked by game host or moderator
-
+ player left the game
-
+ player disconnected from server
-
+ reason unknown
@@ -4288,140 +3819,140 @@ You may have to manually download the new version.
GameSelector
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+ Error
-
+ Please join the appropriate room first.
-
+ Wrong password.
-
+ Spectators are not allowed in this game.
-
+ The game is already full.
-
+ The game does not exist any more.
-
+ This game is only open to registered users.
-
+ This game is only open to its creator's buddies.
-
+ You are being ignored by the creator of this game.
-
+ Join Game
-
+ Spectate Game
-
+ Game Information
-
+ Join Game as Judge
-
+ Spectate Game as Judge
-
+ Join game
-
+ Password:
-
+ Please join the respective room first.
-
+ &Filter games
-
+ C&lear filter
-
+ C&reate
-
+ &Join
-
+ Join as judge
-
+ J&oin as spectator
-
+ Join as judge spectator
-
+ Games shown: %1 / %2
-
+ Games
@@ -4429,32 +3960,32 @@ You may have to manually download the new version.
GameSelectorQuickFilterToolBar
-
+ All types
-
+ Filter by game name...
-
+ Filter by game type/format
-
+ Hide games not created by buddies
-
+ Hide full games
-
+ Hide started games
@@ -4462,12 +3993,12 @@ You may have to manually download the new version.
GamesModel
-
+ >1 day
-
+ %1%2 hrshort age in hours
@@ -4476,12 +4007,12 @@ You may have to manually download the new version.
-
+ new
-
+ %1%2 minshort age in minutes
@@ -4490,83 +4021,83 @@ You may have to manually download the new version.
-
+ password
-
+ buddies only
-
+ reg. users only
-
+ open decklists
+
- can chat
-
+ see hands
-
+ can see hands
-
+ not allowed
-
+ Room
-
+ Age
-
+ Description
-
+ Creator
-
+ Type
-
+ Restrictions
-
+ Players
-
+ Spectators
@@ -4574,158 +4105,143 @@ You may have to manually download the new version.
GeneralSettingsPage
-
+ Reset all paths
-
+ All paths have been reset
-
-
-
-
-
-
-
+
+
+
+
+
+
+ Choose path
-
- Language settings
+
+ Personal settings
-
+ Language:
-
- Version settings
-
-
-
-
- Card database
-
-
-
-
- Startup settings
-
-
-
-
+ Paths (editing disabled in portable mode)
-
+ Paths
-
+ How to help with translations
-
+ Decks directory:
-
+ Filters directory:
-
+ Replays directory:
-
+ Pictures directory:
-
+ Card database:
-
+ Custom database directory:
-
+ Token database:
-
+ Update channel
-
+ Check for client updates on startup
-
+ Check for card database updates on startup
-
+ Don't check
-
+ Prompt for update
-
+ Always update in the background
-
+ Check for card database updates every
-
+ days
-
+ Notify if a feature supported by the server is missing in my client
-
+ Automatically run Oracle when running a new version of Cockatrice
-
+ Show tips on startup
-
+ Last update check on %1 (%2 days ago)
@@ -4733,47 +4249,47 @@ You may have to manually download the new version.
GraveyardMenu
-
+ &Graveyard
-
+ &View graveyard
-
+ &Move graveyard to...
-
+ &Top of library
-
+ &Bottom of library
-
+ &All players
-
+ &Hand
-
+ &Exile
-
+ Reveal random card to...
@@ -4781,88 +4297,88 @@ You may have to manually download the new version.
HandMenu
-
+ &Hand
-
+ &View hand
-
+ Sort hand by...
-
+ Name
-
+ Type
-
+ Mana Value
-
+ Take &mulligan (Choose hand size)
-
+ Take mulligan (Same hand size)
-
+ Take mulligan (Hand size - 1)
-
+ &Move hand to...
-
+ &Top of library
-
+ &Bottom of library
-
+ &Graveyard
-
+ &Exile
-
+ &Reveal hand to...
-
-
+
+ All players
-
+ Reveal r&andom card to...
@@ -4870,52 +4386,52 @@ You may have to manually download the new version.
HomeWidget
-
+ Create New Deck
-
+ Browse Decks
-
+ Browse Card Database
-
+ Browse EDHRec
-
+ Browse Archidekt
-
+ View Replays
-
+ Quit
-
+ Connecting...
-
+ Connect
-
+ Play
@@ -4923,213 +4439,213 @@ You may have to manually download the new version.
LibraryMenu
-
+ &Library
-
+ &View library
-
+ View &top cards of library...
-
+ View bottom cards of library...
-
+ Reveal &library to...
-
+ Lend library to...
-
+ Reveal &top cards to...
-
+ &Top of library...
-
+ &Bottom of library...
-
+ &Always reveal top card
-
+ &Always look at top card
-
+ &Open deck in deck editor
-
+ &Draw card
-
+ D&raw cards...
-
+ &Undo last draw
-
+ Shuffle
-
+ &Play top card
-
+ Play top card &face down
-
+ Put top card on &bottom
-
+ Move top card to grave&yard
-
+ Move top card to e&xile
-
+ Move top cards to &graveyard...
-
+ Move top cards to graveyard face down...
-
+ Move top cards to &exile...
-
+ Move top cards to exile face down...
-
+ Put top cards on stack &until...
-
+ Shuffle top cards...
-
+ &Draw bottom card
-
+ D&raw bottom cards...
-
+ &Play bottom card
-
+ Play bottom card &face down
-
+ Move bottom card to grave&yard
-
+ Move bottom card to e&xile
-
+ Move bottom cards to &graveyard...
-
+ Move bottom cards to graveyard face down...
-
+ Move bottom cards to &exile...
-
+ Move bottom cards to exile face down...
-
+ Put bottom card on &top
-
+ Shuffle bottom cards...
-
-
+
+ &All players
-
+ Reveal top cards of library
-
+ Number of cards: (max. %1)
@@ -5137,300 +4653,655 @@ You may have to manually download the new version.
MainWindow
-
-
+
+
+ The server has reached its maximum user capacity, please check back later.
+
+
+
+
+ There are too many concurrent connections from your address.
+
+
+
+
+ Banned by moderator
+
+
+
+
+ Expected end time: %1
+
+
+
+
+ This ban lasts indefinitely.
+
+
+
+
+ Scheduled server shutdown.
+
+
+
+
+
+ Invalid username.
+
+
+
+
+ You have been logged out due to logging in at another location.
+
+
+
+
+ Connection closed
+
+
+
+
+ The server has terminated your connection.
+Reason: %1
+
+
+
+
+ The server is going to be restarted in %n minute(s).
+All running games will be lost.
+Reason for shutdown: %1
+
+
+
+
+
+
+
+ Scheduled server shutdown
+
+
+
+
+
+ Success
+
+
+
+
+ Registration accepted.
+Will now login.
+
+
+
+
+ Account activation accepted.
+Will now login.
+
+
+
+
+ Player %1
-
+ Load replay
-
+ About Cockatrice
-
+ Version
-
+ Cockatrice Webpage
-
+ Project Manager:
-
+ Past Project Managers:
-
+ Developers:
-
+ Our Developers
-
+ Help Develop!
-
+ Translators:
-
+ Our Translators
-
+ Help Translate!
-
+ Support:
-
+ Report an Issue
-
+ Troubleshooting
-
+ F.A.Q.
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Error
-
- &Connect...
+
+ Server timeout
-
- &Disconnect
+
+ Failed Login
-
- Start &local game...
+
+ Your client seems to be missing features this server requires for connection.
-
- &Watch replay...
+
+ To update your client, go to 'Help -> Check for Client Updates'.
-
- &Full screen
+
+ Incorrect username or password. Please check your authentication information and try again.
-
- &Register to server...
+
+ There is already an active session using this user name.
+Please close that session first and re-login.
-
- &Restore password...
+
+
+ You are banned until %1.
-
- &Settings...
+
+
+ You are banned indefinitely.
-
- &Exit
+
+ This server requires user registration. Do you want to register now?
-
- A&ctions
+
+ This server requires client IDs. Your client is either failing to generate an ID or you are running a modified client.
+Please close and reopen your client to try again.
-
- &Cockatrice
+
+ An internal error has occurred, please close and reopen Cockatrice before trying again.
+If the error persists, ensure you are running the latest version of the software and if needed contact the software developers.
-
- C&ard Database
+
+ Account activation
-
- &Manage sets...
+
+ Your account has not been activated yet.
+You need to provide the activation token received in the activation email.
-
- Edit custom &tokens...
+
+ Server Full
-
- Open custom image folder
+
+ Unknown login error: %1
-
- Open custom sets folder
+
+
+
+This usually means that your client version is out of date, and the server sent a reply your client doesn't understand.
-
- Add custom sets/cards
+
+ Your username must respect these rules:
-
- Reload card database
+
+ is %1 - %2 characters long
-
- Tabs
+
+ can %1 contain lowercase characters
-
- &Help
+
+
+
+
+ NOT
-
- &About Cockatrice
+
+ can %1 contain uppercase characters
-
- &Tip of the Day
+
+ can %1 contain numeric characters
-
- Check for Client Updates
+
+ can contain the following punctuation: %1
-
- Check for Card Updates...
+
+ first character can %1 be a punctuation mark
-
- Check for Card Updates (Automatic)
+
+ no unacceptable language as specified by these server rules:
+ note that the following lines will not be translated
-
- Show Status Bar
+
+ can not contain any of the following words: %1
-
- View &Debug Log
+
+ can not match any of the following expressions: %1
-
- Open Settings Folder
+
+ You may only use A-Z, a-z, 0-9, _, ., and - in your username.
-
- Show/Hide
+
+
+
+
+
+
+ Registration denied
-
- New Version
+
+ Registration is currently disabled on this server
+
+
+
+
+ There is already an existing account with the same user name.
+
+
+
+
+ It's mandatory to specify a valid email address when registering.
+
+
+
+
+ It appears you are attempting to register a new account on this server yet you already have an account registered with the email provided. This server restricts the number of accounts a user can register per address. Please contact the server operator for further assistance or to obtain your credential information.
+
+
+
+
+ Password too short.
+
+
+
+
+ Registration failed for a technical problem on the server.
+
+
+
+
+ The connection to the server has been lost.
+
+
+
+
+ Unknown registration error: %1
+
+
+
+
+ Account activation failed
+
+
+
+
+ Socket error: %1
+
+
+
+
+ You are trying to connect to an obsolete server. Please downgrade your Cockatrice version or connect to a suitable server.
+Local version is %1, remote version is %2.
+
+
+
+
+ Your Cockatrice client is obsolete. Please update your Cockatrice version.
+Local version is %1, remote version is %2.
+
+
+
+
+ Connecting to %1...
+
+
+
+
+ Registering to %1 as %2...
+
+
+
+
+ Disconnected
+ Connected, logging in at %1
+
+
+
+
+
+
+ Requesting forgotten password to %1 as %2...
+
+
+
+
+ &Connect...
+
+
+
+
+ &Disconnect
+
+
+
+
+ Start &local game...
+
+
+
+
+ &Watch replay...
+
+
+
+
+ &Full screen
+
+
+
+
+ &Register to server...
+
+
+
+
+ &Restore password...
+
+
+
+
+ &Settings...
+
+
+
+
+ &Exit
+
+
+
+
+ A&ctions
+
+
+
+
+ &Cockatrice
+
+
+
+
+ C&ard Database
+
+
+
+
+ &Manage sets...
+
+
+
+
+ Edit custom &tokens...
+
+
+
+
+ Open custom image folder
+
+
+
+
+ Open custom sets folder
+
+
+
+
+ Add custom sets/cards
+
+
+
+
+ Reload card database
+
+
+
+
+ Tabs
+
+
+
+
+ &Help
+
+
+
+
+ &About Cockatrice
+
+
+
+
+ &Tip of the Day
+
+
+
+
+ Check for Client Updates
+
+
+
+
+ Check for Card Updates...
+
+
+
+
+ Check for Card Updates (Automatic)
+
+
+
+
+ Show Status Bar
+
+
+
+
+ View &Debug Log
+
+
+
+
+ Open Settings Folder
+
+
+
+
+ Show/Hide
+
+
+
+
+ New Version
+
+
+
+ Congratulations on updating to Cockatrice %1!
Oracle will now launch to update your card database.
-
+ Cockatrice installed
-
+ Congratulations on installing Cockatrice %1!
Oracle will now launch to install the initial card database.
-
+ Card database
-
+ Cockatrice is unable to load the card database.
Do you want to update your card database now?
If unsure or first time user, choose "Yes"
-
-
+
+ Yes
-
-
+
+ No
-
+ Open settings
-
+ New sets found
-
+ %n new set(s) found in the card database
Set code(s): %1
Do you want to enable it/them?
@@ -5440,153 +5311,179 @@ Do you want to enable it/them?
-
- Yes, always enable
-
-
-
-
+ View sets
-
+ Welcome
-
+ Hi! It seems like you're running this version of Cockatrice for the first time.
All the sets in the card database have been enabled.
Read more about changing the set order or disabling specific sets and consequent effects in the "Manage Sets" dialog.
-
+
+ Information
-
+ A card database update is already running.
-
+ Unable to run the card database updater:
-
+ Card database update running.
-
+ Failed to start. The file might be missing, or permissions might be incorrect.
-
+ The process crashed some time after starting successfully.
-
+ Timed out. The process took too long to respond. The last waitFor...() function timed out.
-
+ An error occurred when attempting to write to the process. For example, the process may not be running, or it may have closed its input channel.
-
+ An error occurred when attempting to read from the process. For example, the process may not be running.
-
+ Unknown error occurred.
-
+ The card database updater exited with an error:
%1
-
-
-
-
-
+
+ This server supports additional features that your client doesn't have.
+This is most likely not a problem, but this message might mean there is a new version of Cockatrice available or this server is running a custom or pre-release version.
+
+To update your client, go to Help -> Check for Updates.
+
+
+
+
+
+
+
+ Load sets/cards
-
+ Selected file cannot be found.
-
+ You can only import XML databases at this time.
-
+ The new sets/cards have been added successfully.
Cockatrice will now reload the card database.
-
+ Sets/cards failed to import.
+
+
+
+
+ Reset Password
+
+
+
+
+ Your password has been reset successfully, you can now log in using the new credentials.
+
+
+
+
+ Failed to reset user account password, please contact the server operator to reset your password.
+
+
+
+
+ Activation request received, please check your email for an activation token.
+
+ ManaBaseConfigDialog
-
+ Mana Base Configuration
-
+ Display type:
-
+ pie
-
+ bar
-
+ combinedBar
-
+ Filter Colors (optional):
-
+ OK
-
+ Cancel
@@ -5658,27 +5555,27 @@ Cockatrice will now reload the card database.
ManaDevotionConfigDialog
-
+ Display type:
-
+ pie
-
+ bar
-
+ combinedBar
-
+ Filter Colors (optional):
@@ -5748,297 +5645,297 @@ Cockatrice will now reload the card database.
MessageLogWidget
-
+ from play
-
+ from their graveyard
-
+ from exile
-
+ from their hand
-
+ the top card of %1's library
-
+ the top card of their library
-
+ from the top of %1's library
-
+ from the top of their library
-
+ the bottom card of %1's library
-
+ the bottom card of their library
-
+ from the bottom of %1's library
-
+ from the bottom of their library
-
+ from %1's library
-
+ from their library
-
+ from sideboard
-
+ from the stack
-
+ from custom zone '%1'
-
+ %1 is now keeping the top card %2 revealed.
-
+ %1 is not revealing the top card %2 any longer.
-
+ %1 can now look at top card %2 at any time.
-
+ %1 no longer can look at top card %2 at any time.
-
+ %1 attaches %2 to %3's %4.
-
+ %1 has conceded the game.
-
+ %1 has unconceded the game.
-
+ %1 has restored connection to the game.
-
+ %1 has lost connection to the game.
-
+ %1 points from their %2 to themselves.
-
+ %1 points from their %2 to %3.
-
+ %1 points from %2's %3 to themselves.
-
+ %1 points from %2's %3 to %4.
-
+ %1 points from their %2 to their %3.
-
+ %1 points from their %2 to %3's %4.
-
+ %1 points from %2's %3 to their own %4.
-
+ %1 points from %2's %3 to %4's %5.
-
+ %1 creates a face down token.
-
+ %1 creates token: %2%3.
-
+ %1 has loaded a deck (%2).
-
+ %1 has loaded a deck with %2 sideboard cards (%3).
-
+ %1 destroys %2.
-
+ a card
-
+ %1 gives %2 control over %3.
-
+ %1 puts %2 into play%3 face down.
-
+ %1 puts %2 into play%3.
-
+ %1 puts %2%3 into their graveyard face down.
-
+ %1 puts %2%3 into their graveyard.
-
+ %1 exiles %2%3 face down.
-
+ %1 exiles %2%3.
-
+ %1 moves %2%3 to their hand.
-
+ %1 puts %2%3 into their library.
-
+ %1 puts %2%3 onto the bottom of their library.
-
+ %1 puts %2%3 on top of their library.
-
+ %1 puts %2%3 into their library %4 cards from the top.
-
+ %1 moves %2%3 to sideboard.
-
+ %1 plays %2%3 face down.
-
+ %1 plays %2%3.
-
+ %1 moves %2%3 to custom zone '%4' face down.
-
+ %1 moves %2%3 to custom zone '%4'.
-
+ %1 tries to draw from an empty library
-
+ %1 draws %2 card(s).
@@ -6046,12 +5943,12 @@ Cockatrice will now reload the card database.
-
+ %1 is looking at %2.
-
+ %1 is looking at the %4 %3 card(s) %2.top card for singular, top %3 cards for plural
@@ -6060,72 +5957,72 @@ Cockatrice will now reload the card database.
-
+ bottom
-
+ top
-
+ %1 turns %2 face-down.
-
+ %1 turns %2 face-up.
-
+ The game has been closed.
-
+ The game has started.
-
+ You are flooding the game. Please wait a couple of seconds.
-
+ %1 has joined the game.
-
+ %1 is now watching the game.
-
+ You have been kicked out of the game.
-
+ %1 has left the game (%2).
-
+ %1 is not watching the game any more (%2).
-
+ %1 is not ready to start the game any more.
-
+ %1 shuffles their deck and draws a new hand of %2 card(s).
@@ -6133,28 +6030,28 @@ Cockatrice will now reload the card database.
-
+ %1 shuffles their deck and draws a new hand.
-
+ You are watching a replay of game #%1.
-
+ %1 is ready to start the game.
-
+ cardsan unknown amount of cards
-
+ %1 card(s)a card for singular, %1 cards for plural
@@ -6163,218 +6060,213 @@ Cockatrice will now reload the card database.
-
+ %1 lends %2 to %3.
-
+ %1 reveals %2 to %3.
-
+ %1 reveals %2.
-
+ %1 randomly reveals %2%3 to %4.
-
+ %1 randomly reveals %2%3.
-
+ %1 peeks at face down card #%2.
-
+ %1 peeks at face down card #%2: %3.
-
+ %1 reveals %2%3 to %4.
-
+ %1 reveals %2%3.
-
+ %1 reversed turn order, now it's %2.
-
+ reversed
-
+ normal
-
+ Heads
-
+ Tails
-
+ %1 flipped a coin. It landed as %2.
-
+ %1 rolls a %2 with a %3-sided die.
-
+ %1 flips %2 coins. There are %3 heads and %4 tails.
-
+ %1 rolls a %2-sided dice %3 times: %4.
-
+ %1's turn.
-
+ %1 sets annotation of %2 to %3.
-
- %1 places %2 %3%4 counter(s) on %5 (now %6).
+
+ %1 places %2 "%3" counter(s) on %4 (now %5).
-
- %1 removes %2 %3%4 counter(s) from %5 (now %6).
+
+ %1 removes %2 "%3" counter(s) from %4 (now %5).
-
- %1 failed to undo their last draw.
-
-
-
-
+ %1 sets counter %2 to %3 (%4%5).
-
+ %1 sets %2 to not untap normally.
-
+ %1 sets %2 to untap normally.
-
+ %1 removes the PT of %2.
-
+ %1 changes the PT of %2 from nothing to %4.
-
+ %1 changes the PT of %2 from %3 to %4.
-
+ %1 has locked their sideboard.
-
+ %1 has unlocked their sideboard.
-
+ %1 taps their permanents.
-
+ %1 untaps their permanents.
-
+ %1 taps %2.
-
+ %1 untaps %2.
-
+ %1 shuffles %2.
-
+ %1 shuffles the bottom %3 cards of %2.
-
+ %1 shuffles the top %3 cards of %2.
-
+ %1 shuffles cards %3 - %4 of %2.
-
+ %1 unattaches %2.
-
+ %1 undoes their last draw.
-
+ %1 undoes their last draw (%2).
@@ -6382,115 +6274,110 @@ Cockatrice will now reload the card database.
MessagesSettingsPage
-
+ Word1 Word2 Word3
-
+ Add New Message
-
+ Edit Message
-
+ Remove Message
-
+ Add message
-
-
+
+ Message:
-
+ Edit message
-
+ Chat settings
-
+ Custom alert words
-
+ Enable chat mentions
-
+ Enable mention completer
-
+ In-game message macros
-
+ How to use in-game message macros
-
+ Ignore chat room messages sent by unregistered users
-
+ Ignore private messages sent by unregistered users
-
- Ignore private messages sent by non-buddy users
-
-
-
-
-
+
+ Invert text color
-
+ Enable desktop notifications for private messages
-
+ Enable desktop notification for mentions
-
+ Enable room message history on join
-
-
+
+ (Color is hexadecimal)
-
+ Separate words with a space, alphanumeric characters only
@@ -6498,42 +6385,42 @@ Cockatrice will now reload the card database.
MoveMenu
-
+ Move to
-
+ &Top of library in random order
-
+ X cards from the top of library...
-
+ &Bottom of library in random order
-
+ T&able
-
+ &Hand
-
+ &Graveyard
-
+ &Exile
@@ -6546,47 +6433,47 @@ Cockatrice will now reload the card database.
-
+ Mana Value
-
+ Color(s)
-
+ Loyalty
-
+ Main Card Type
-
+ Mana Cost
-
+ P/T
-
+ Side
-
+ Layout
-
+ Color Identity
@@ -6609,152 +6496,6 @@ Cockatrice will now reload the card database.
-
- PaletteEditorDialog
-
-
-
- Reset
-
-
-
-
-
- Apply
-
-
-
-
-
- Save && Apply
-
-
-
-
- ▼ Edit Palette
-
-
-
-
-
- ▶ Edit Palette
-
-
-
-
- Palette Editor — %1
-
-
-
-
- <b>Palette Editor</b> · %1
-
-
-
-
- This theme ships no default palette files
-
-
-
-
- Replace current colours with the theme author's defaults
-
-
-
-
- Switch between the light and dark palette files
-
-
-
-
- Editing:
-
-
-
-
- Show or hide the per-role colour grid for manual tweaks
-
-
-
-
- ↺ Revert to theme default
-
-
-
-
- Discard unsaved edits and restore the last saved palette
-
-
-
-
- Preview this palette without saving to disk
-
-
-
-
- Write palette-%1.toml and reload the theme
-
-
-
-
- Cannot save: this theme has no directory on disk
-
-
-
-
- Save failed
-
-
-
-
- Could not write %1 to:
-%2
-
-
-
-
- No default found
-
-
-
-
- No default palette file found for the "%1" scheme.
-
-
-
-
- PaletteGridWidget
-
-
- Active
-
-
-
-
- Disabled
-
-
-
-
- Inactive
-
-
-
-
- Normal interactive state
-
-
-
-
- Widget is disabled / not interactive
-
-
-
-
- Window is in background / unfocused
-
-
-Phase
@@ -6821,57 +6562,57 @@ Cockatrice will now reload the card database.
PhasesToolbar
-
+ Untap step
-
+ Upkeep step
-
+ Draw step
-
+ First main phase
-
+ Beginning of combat step
-
+ Declare attackers step
-
+ Declare blockers step
-
+ Combat damage step
-
+ End of combat step
-
+ Second main phase
-
+ End of turn step
@@ -6879,7 +6620,7 @@ Cockatrice will now reload the card database.
PictureLoader
-
+ encode for scryfall's language property, not available for all languages
@@ -6888,142 +6629,151 @@ Cockatrice will now reload the card database.
PlayerActions
-
-
-
-
- grave
-
-
-
-
-
-
-
- exile
-
-
-
-
- PlayerDialogs
-
-
+ View top cards of library
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+ Number of cards: (max. %1)
-
+ View bottom cards of library
-
+ Shuffle top cards of library
-
+ Shuffle bottom cards of library
-
+ Draw hand
-
+ 0 and lower are in comparison to current hand size
-
+ Draw cards
-
+
+
+
+
+ grave
+
+
+
+
+
+
+
+ exile
+
+
+
+ Move top cards to %1
-
+ Move bottom cards to %1
-
+ Draw bottom cards
-
+
+
+ C&reate another %1 token
+
+
+
+ Create tokens
-
+
+ Number:
-
+ Place card X cards from top of library
-
+ Which position should this card be placed:
-
+ (max. %1)
-
+ Change power/toughness
-
+ Change stats to:
-
+ Set annotation
-
+ Please enter the new annotation:
+
+
+ Set counters
+
+ PlayerMenu
-
+ Player "%1"
-
+ &Counters
@@ -7053,7 +6803,7 @@ This setting means you'll only see the default printing for each card, inst
-
+ Printing Selector
@@ -7061,22 +6811,22 @@ This setting means you'll only see the default printing for each card, inst
PrintingSelectorCardOverlayWidget
-
+ Preference
-
+ Pin Printing
-
+ Unpin Printing
-
+ Show Related cards
@@ -7147,57 +6897,57 @@ This setting means you'll only see the default printing for each card, inst
PtMenu
-
+ Power / toughness
-
+ &Increase power
-
+ &Decrease power
-
+ I&ncrease toughness
-
+ D&ecrease toughness
-
+ In&crease power and toughness
-
+ Dec&rease power and toughness
-
+ Increase power and decrease toughness
-
+ Decrease power and increase toughness
-
+ Set &power and toughness...
-
+ Reset p&ower and toughness
@@ -7205,37 +6955,37 @@ This setting means you'll only see the default printing for each card, inst
QMenuBar
-
+ Services
-
+ Hide %1
-
+ Hide Others
-
+ Show All
-
+ Preferences...
-
+ Quit %1
-
+ About %1
@@ -7243,17 +6993,17 @@ This setting means you'll only see the default printing for each card, inst
QObject
-
+ Cockatrice card database (*.xml)
-
+ All files (*.*)
-
+ Cockatrice replays (*.cor)
@@ -7313,177 +7063,110 @@ Are you sure you would like to disable this feature?
QPlatformTheme
-
+ OK
-
+ Save
-
+ Save All
-
+ Open
-
+ &Yes
-
+ Yes to &All
-
+ &No
-
+ N&o to All
-
+ Abort
-
+ Retry
-
+ Ignore
-
+ Close
-
+ Cancel
-
+ Discard
-
+ Help
-
+ Apply
-
+ Reset
-
+ Restore Defaults
-
- QuickSetupPanel
-
-
- %1%
-
-
-
-
- <b>Quick Setup</b>
-
-
-
-
- Generate all palette roles automatically from a single accent colour
-
-
-
-
- Accent:
-
-
-
-
- Primary hue. Used directly for highlights and links.
-At high intensity it also tints buttons and backgrounds.
-
-
-
-
- Intensity:
-
-
-
-
- Subtle
-
-
-
-
- Full colour
-
-
-
-
- 0–30 Subtle tint — only highlights and links change hue
-30–70 Accented — buttons, tooltips, and borders join in
-70–100 Full colour — backgrounds, everything
-
-
-
-
- 70%
-
-
-
-
- Generate ↓
-
-
-
-
- Derive all palette roles from the accent colour above.
-Fine-tune individual colours in the grid afterwards.
-
-
-RemoteDeckList_TreeModel
-
+ Name
-
+ ID
-
+ Upload time
@@ -7491,32 +7174,32 @@ Fine-tune individual colours in the grid afterwards.
RemoteReplayList_TreeModel
-
+ ID
-
+ Name
-
+ Players
-
+ Keep
-
+ Time started
-
+ Duration (sec)
@@ -7524,37 +7207,37 @@ Fine-tune individual colours in the grid afterwards.
RfgMenu
-
+ &Exile
-
+ &View exile
-
+ &Move exile to...
-
+ &Top of library
-
+ &Bottom of library
-
+ &Hand
-
+ &Graveyard
@@ -7600,7 +7283,7 @@ Fine-tune individual colours in the grid afterwards.
SayMenu
-
+ S&ay
@@ -7641,27 +7324,27 @@ Fine-tune individual colours in the grid afterwards.
SetsModel
-
+ Enabled
-
+ Set type
-
+ Set code
-
+ Long name
-
+ Release date
@@ -7669,53 +7352,53 @@ Fine-tune individual colours in the grid afterwards.
ShortcutSettingsPage
-
-
+
+ Restore all default shortcuts
-
+ Do you really want to restore all default shortcuts?
-
+ Clear all default shortcuts
-
+ Do you really want to clear all shortcuts?
-
+ Section:
-
+ Action:
-
+ Shortcut:
-
+ How to set custom shortcuts
-
+ Clear all shortcuts
-
+ Search by shortcut name
@@ -7769,12 +7452,12 @@ Please check your shortcut settings!
SideboardMenu
-
+ &Sideboard
-
+ &View sideboard
@@ -7782,27 +7465,27 @@ Please check your shortcut settings!
SoundSettingsPage
-
+ Enable &sounds
-
+ Current sounds theme:
-
+ Test system sound engine
-
+ Sound settings
-
+ Master volume
@@ -7874,146 +7557,16 @@ Please check your shortcut settings!
-
+ No reply received from the tag update server.
-
+ Invalid reply received from the tag update server.
-
- StorageSettingsPage
-
-
-
-
- Success
-
-
-
-
- Cached card pictures have been reset.
-
-
-
-
- Downloaded card pictures have been reset.
-
-
-
-
- Error
-
-
-
-
- One or more downloaded card pictures could not be cleared.
-
-
-
-
- In-memory (currently loaded) card pictures have been reset.
-
-
-
-
- Card Picture Loader Caching Method:
-
-
-
-
- The network cache is the preferred way of storing images. Downloaded images are stored here until the size of the cache exceeds the configured size. Cockatrice automatically monitors this cache and deletes the least recently seen card images to ensure the cache does not exceed the configured size.
-
-
-
-
- Writing card images directly to a folder on your hard drive is another way of storing images. This does not change how Cockatrice accesses or downloads images. Cockatrice will NOT automatically monitor and clear this folder, so if you enable this option, it is up to you to ensure sufficient available space. It should also be noted that if a provider outage causes you to download the wrong picture (i.e. wrong printing) you will be stuck with it until you manually delete the file, as opposed to using the network cache, which automatically rotates and thus correct errors after a while.
-
-
-
-
- This is the in-memory picture cache used by the application at runtime. It determines how much memory (RAM) Cockatrice can use before it has to fetch card images from the hard disk again. Increasing this will allow more card images to be displayed at once but shouldn't be necessary. Clearing this will make Cockatrice reload all images from the network cache or the disk.
-
-
-
-
- Delete Cached Images
-
-
-
-
- Delete Saved Images
-
-
-
-
- Clear In-Memory Images
-
-
-
-
- Card Picture Loader Cache Method
-
-
-
-
- Network Cache
-
-
-
-
- Filesystem
-
-
-
-
- In-Memory Picture Cache
-
-
-
-
- Network Cache Size:
-
-
-
-
- On-disk cache for downloaded pictures
-
-
-
-
- Redirect Cache TTL:
-
-
-
-
- How long cached redirects for urls are valid for.
-
-
-
-
- Picture Cache Size:
-
-
-
-
- In-memory cache for pictures not currently on screen
-
-
-
-
- Naming scheme:
-
-
-
-
- Day(s)
-
-
-TabAccount
@@ -8149,117 +7702,117 @@ Please check your shortcut settings!
TabArchidekt
-
-
+
+ Desc.
-
-
+
+ AND
-
-
+
+ Require ALL selected colors
-
-
+
+ Deck name...
-
-
+
+ Owner...
-
-
+
+ Packages
-
-
+
+ Advanced Filters
-
+ Bracket:
-
-
+
+ Any
-
-
+
+ Contains card...
-
-
+
+ Commander...
-
-
+
+ Tag...
-
-
+
+ Deck Size
-
+ Cards:
-
-
+
+ Asc.
-
+ Sort by:
-
+ Filter by:
-
+ Display Settings
-
-
+
+ Search
-
-
+
+ Formats
@@ -8269,54 +7822,6 @@ Please check your shortcut settings!
-
- TabCardArtRules
-
-
- Card:
-
-
-
-
- ProviderId:
-
-
-
-
- Mode:
-
-
-
-
- Reason:
-
-
-
-
- Type a card name...
-
-
-
-
- Add rule
-
-
-
-
- Remove rule
-
-
-
-
- Refresh
-
-
-
-
- Card Art Rules
-
-
-TabDeckEditor
@@ -8365,7 +7870,7 @@ Please check your shortcut settings!
-
+ Deck: %1
@@ -8373,49 +7878,55 @@ Please check your shortcut settings!
TabDeckEditorVisual
-
+ Visual Deck: %1
-
+ &Visual Deck Editor
-
-
+
+ Card Info
-
-
+
+ Deck
-
+
+
+ Filters
+
+
+
+ &View
-
+ Printing
-
+ Visible
-
+ Floating
-
+ Reset layout
@@ -8423,22 +7934,22 @@ Please check your shortcut settings!
TabDeckEditorVisualTabWidget
-
+ Visual Deck View
-
+ Visual Database Display
-
+ Deck Analytics
-
+ Sample Hand
@@ -8446,133 +7957,133 @@ Please check your shortcut settings!
TabDeckStorage
-
+ Local file system
-
+ Server deck storage
-
-
+
+ Open in deck editor
-
+ Rename deck or folder
-
+ Upload deck
-
+ Download deck
+
-
-
-
+
+ New folder
+
- Delete
-
+ Open decks folder
-
+ Rename local folder
-
+ Rename local file
-
+ New name:
-
-
-
-
+
+
+
+ Error
-
+ Rename failed
-
-
+
+ Invalid deck file
-
+ Enter deck name
-
+ This decklist does not have a name.
Please enter a name:
-
+ Unnamed deck
-
+ Failed to upload deck to server
-
+ Delete local file
-
+ Are you sure you want to delete the selected files?
-
+ Delete remote decks
-
+ Are you sure you want to delete the selected decks?
-
-
+
+ Name of new folder:
@@ -8644,191 +8155,191 @@ Please enter a name:
TabGame
-
-
-
+
+
+ Replay
-
-
+
+ Game
-
-
+
+ Player List
-
-
+
+ Card Info
-
-
+
+ Messages
-
-
+
+ Replay Timeline
-
+ &Phases
-
+ &Game
-
+ Next &phase
-
+ Next phase with &action
-
+ Next &turn
-
+ Reverse turn order
-
+ &Remove all local arrows
-
+ Rotate View Cl&ockwise
-
+ Rotate View Co&unterclockwise
-
+ Game &information
-
+ Un&concede
-
-
-
+
+
+ &Concede
-
+ &Leave game
-
+ C&lose replay
-
+ &Focus Chat
-
+ &Say:
-
+ Selected cards
-
+ &View
-
+ Visible
-
+ Floating
-
+ Reset layout
-
+ Concede
-
+ Are you sure you want to concede this game?
-
+ Unconcede
-
+ You have already conceded. Do you want to return to this game?
-
+ Leave game
-
+ Are you sure you want to leave this game?
-
+ A player has joined game #%1
-
+ %1 has joined the game
-
+ You have been kicked out of the game.
@@ -8887,114 +8398,114 @@ Please enter a name:
-
+ Username:
-
+ IP Address:
-
+ Game Name:
-
+ GameID:
-
+ Message:
-
+ Main Room
-
+ Game Room
-
+ Private Chat
-
+ Past X Days:
-
+ Today
-
+ Last Hour
-
+ Maximum Results:
-
+ At least one filter is required.
The more information you put in, the more specific your results will be.
-
+ Get User Logs
-
+ Clear Filters
-
+ Filters
-
+ Log Locations
-
+ Date Range
-
+ Maximum Results
-
-
+
+ Message History
-
+ Failed to collect message history information.
-
+ There are no messages for the selected filters.
@@ -9012,27 +8523,27 @@ The more information you put in, the more specific your results will be.
-
+ %1 - Private chat
-
+ This user is ignoring you, they cannot see your messages in main chat and you cannot join their games.
-
+ Private message from
-
+ %1 has left the server.
-
+ %1 has joined the server.
@@ -9040,180 +8551,180 @@ The more information you put in, the more specific your results will be.
TabReplays
-
+ Local file system
-
+ Server replay storage
-
-
+
+ Watch replay
-
+ Rename
-
-
+
+ New folder
-
-
+
+ Delete
-
+ Open replays folder
-
+ Download replay
-
+ Toggle expiration lock
-
+ Get replay share code
-
-
+
+ Look up replay by share code
-
+ Rename local folder
-
+ Rename local file
-
+ New name:
-
+ Error
-
+ Rename failed
-
+ Name of new folder:
-
+ Delete local file
-
+ Are you sure you want to delete the selected files?
-
+ Are you sure you want to delete the selected replays?
-
+ Failed to get code
-
-
+
+ Either this server does not support replay sharing, or does not permit replay sharing for you.
-
-
-
+
+
+ Failed
-
+ Could not get replay code
-
+ Replay Share Code
-
+ Others can use this code to add the replay to their list of remote replays:
%1
-
+ Copy to clipboard
-
+ Replay share code
-
+ Replay code found
-
+ Replay was added, or you already had access to it.
-
+ Replay code not found
-
+ Failed to submit code
-
+ Unexpected error
-
+ Delete remote replay
@@ -9226,62 +8737,47 @@ The more information you put in, the more specific your results will be.
TabRoom
-
- Friends
-
-
-
-
- Online
-
-
-
-
- Ignored
-
-
-
-
+ &Say:
-
+ Chat
-
+ &Room
-
+ &Leave room
-
+ &Clear chat
-
+ Chat Settings...
-
+ mentioned you.
-
+ Click to view
-
+ You are flooding the chat. Please wait a couple of seconds.
@@ -9294,30 +8790,30 @@ The more information you put in, the more specific your results will be.
-
-
-
-
+
+
+
+ Error
-
+ Failed to join the server room: it doesn't exist on the server.
-
+ The server thinks you are in the server room but your client is unable to display it. Try restarting your client.
-
+ You do not have the required permission to join this server room.
-
+ Failed to join the server room due to an unknown error: %1.
@@ -9325,97 +8821,97 @@ The more information you put in, the more specific your results will be.
TabSupervisor
-
+ Deck Editor
-
+ Visual Deck Editor
-
+ EDHRec
-
+ Archidekt
-
+ Home
-
+ &Visual Deck Storage
-
+ Visual Database Display
-
+ Server
-
+ Account
-
+ Deck Storage
-
+ Game Replays
-
+ Administration
-
+ Logs
-
+ Are you sure?
-
+ There are still open games. Are you sure you want to quit?
-
+ Click to view
-
+ Your buddy %1 has signed on!
-
+ Unknown Event
-
+ The server has sent you a message that your client does not understand.
This message might mean there is a new version of Cockatrice available or this server is running a custom or pre-release version.
@@ -9423,38 +8919,38 @@ To update your client, go to Help -> Check for Updates.
-
+ Idle Timeout
-
+ You are about to be logged out due to inactivity.
-
+ Promotion
-
+ You have been promoted. Please log out and back in for changes to take effect.
-
+ Warned
-
+ You have received a warning due to %1.
Please refrain from engaging in this activity or further actions may be taken against you. If you have any questions, please private message a moderator.
-
+ You have received the following message from the server.
(custom messages like these could be untranslated)
@@ -9463,12 +8959,12 @@ Please refrain from engaging in this activity or further actions may be taken ag
TabVisualDatabaseDisplay
-
+ Database Display
-
+ Visual Database Display
@@ -9505,42 +9001,42 @@ Please refrain from engaging in this activity or further actions may be taken ag
TranslateCounterName
-
+ Life
-
+ White
-
+ Blue
-
+ Black
-
+ Red
-
+ Green
-
+ Colorless
-
+ Other
@@ -9548,69 +9044,11 @@ Please refrain from engaging in this activity or further actions may be taken ag
UpdateDownloader
-
+ Could not open the file for reading.
-
- UserCardArtSettingsDialog
-
-
- Card Art Settings
-
-
-
-
- Type a card name...
-
-
-
-
- Card name:
-
-
-
-
- Card ProviderId:
-
-
-
-
- Left margin (%):
-
-
-
-
- Right margin (%):
-
-
-
-
- Vertical offset:
-
-
-
-
- Zoom:
-
-
-
-
- Parameters
-
-
-
-
- Preview
-
-
-
-
- Remove Banner Card
-
-
-UserContextMenu
@@ -9728,7 +9166,7 @@ Please refrain from engaging in this activity or further actions may be taken ag
-
+ Ban History
@@ -9743,87 +9181,77 @@ Please refrain from engaging in this activity or further actions may be taken ag
-
+ Failed to collect ban information.
-
-
-
+
+
+ Warning History
-
+ Warning Time;Moderator;User Name;Reason
-
+ User has never been warned.
-
+ Failed to collect warning information.
-
+ Failed to get admin notes.
-
-
+
+ Success
-
+ Successfully promoted user.
-
+ Successfully demoted user.
-
- Kick Player
-
-
-
-
- Are you sure you want to kick this player from the game?
-
-
-
-
-
-
+
+
+ Failed
-
+ Failed to promote user.
-
+ Failed to demote user.
-
+ Copy hash to clipboard
-
+ Remove this user's messages
@@ -9831,116 +9259,109 @@ Please refrain from engaging in this activity or further actions may be taken ag
UserInfoBox
-
+ Location:
-
+ Account Age:
-
+ Edit
-
+ Change password
-
+ Change avatar
-
+ Administrator
-
+ Moderator
-
+ Registered user
-
-
+
+ Unregistered user
-
+ Judge
-
+ Unknown
-
+ The entered password does not match your account.
-
-
-
-
+
+
+ Information
-
+ User information updated.
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+ Error
-
+ User Information
-
+ Real Name:
-
+ User Level:
-
-
- Edit Banner Card
-
-
-
+ %n Year(s), amount of years (only shown if more than 0)
@@ -9949,7 +9370,7 @@ Please refrain from engaging in this activity or further actions may be taken ag
-
+ %10%n Day(s) %20amount of years (if more than 0), amount of days, date in local short format
@@ -9958,433 +9379,212 @@ Please refrain from engaging in this activity or further actions may be taken ag
-
+ Enter Password
-
+ Password verification is required in order to change your email address
-
-
-
+
+
+ An error occurred while trying to update your user information.
-
- The selected card is blacklisted on this server or another error occurred.
-
-
-
-
- Banner card removed.
-
-
-
-
- Banner card updated.
-
-
-
-
+ This server does not permit you to update your user informations.
-
+ Password changed.
-
+ This server does not permit you to change your password.
-
+ The new password is too short.
-
+ The old password is incorrect.
-
+ Avatar updated.
-
+ This server does not permit you to update your avatar.
-
-
- An error occured while trying to update your avatar.
-
-
- This server does not permit you to update your user informations.
- An error occured while trying to updater your avatar.
-
-
-
-
- UserInfoPopup
-
-
-
- Games
-
-
-
-
- Chat
-
-
-
-
- Open private chat
-
-
-
-
- Profile
-
-
-
-
- View user profile
-
-
-
-
- Show this user's games
-
-
-
-
- − Buddy
-
-
-
-
- Remove from buddy list
-
-
-
-
- + Buddy
-
-
-
-
- Add to buddy list
-
-
-
-
- − Ignore
-
-
-
-
- Remove from ignore list
-
-
-
-
- + Ignore
-
-
-
-
- Add to ignore list
-
-
-
-
- Ban
-
-
-
-
- Ban from server
-
-
-
-
- Warn
-
-
-
-
- Warn user
-
-
-
-
- Ban log
-
-
-
-
- View ban history
-
-
-
-
- Warn log
-
-
-
-
- View warning history
-
-
-
-
- Notes
-
-
-
-
- View admin notes
-
-
-
-
- − Mod
-
-
-
-
- Demote from moderator
-
-
-
-
- + Mod
-
-
-
-
- Promote to moderator
-
-
-
-
- − Judge
-
-
-
-
- Demote from judge
-
-
-
-
- + Judge
-
-
-
-
- Promote to judge
-
-
-
-
- Join game
-
-
-
-
- Spectate
-
-
-
-
-
- Loading games…
-
-
-
-
- Could not load games.
-
-
-
-
- No active games.
+ An error occured while trying to updater your avatar.UserInterfaceSettingsPage
-
+ General interface settings
-
+ &Double-click cards to play them (instead of single-click)
-
+ &Clicking plays all selected cards (instead of just the clicked card)
-
+ &Play all nonlands onto the stack (not the battlefield) by default
-
+ Do not delete &arrows inside of subphases
-
+ Close card view window when last card is removed
-
+ Auto focus search bar when card view window is opened
-
+ Annotate card text on tokens
-
- Show selection count during drag selection
+
+ Show selection counter during drag selection
-
- Show total selection count
+
+ Show total selection counter
-
- Show subtype breakdown in selection tally
-
-
-
-
+ Use tear-off menus, allowing right click menus to persist on screen
-
- Keep game chat focused when clicking in game (Note: disables card view search bar)
-
-
-
-
+ Notifications settings
-
+ Enable notifications in taskbar
-
+ Notify in the taskbar for game events while you are spectating
-
+ Notify in the taskbar when users in your buddy list connect
-
+ Animation settings
-
+ &Tap/untap animation
-
+ Deck editor/storage settings
-
+ Open deck in new tab by default
-
+ Use visual deck storage in game lobby
-
+ Use selection animation for Visual Deck Storage
-
+ When adding a tag in the visual deck storage to a .txt deck:
-
+ do nothing
-
+ ask to convert to .cod
-
+ always convert to .cod
-
+ Default deck editor type
-
+ Classic Deck Editor
-
+ Visual Deck Editor
-
+ Replay settings
-
+ Buffer time for backwards skip via shortcut:
@@ -10392,22 +9592,22 @@ Please refrain from engaging in this activity or further actions may be taken ag
UserListWidget
-
+ Users connected to server: %1
-
+ Users in this room: %1
-
+ Buddies online: %1 / %2
-
+ Ignored users online: %1 / %2
@@ -10415,45 +9615,35 @@ Please refrain from engaging in this activity or further actions may be taken ag
UtilityMenu
-
+ Increment all card counters
-
+ &Untap all permanents
-
+ R&oll die...
-
- Flip coin
-
-
-
-
+ &Create token...
-
+ C&reate another token
-
+ Cr&eate predefined token
-
-
- C&reate another %1 token
-
- VisualDatabaseDisplayColorFilterWidget
@@ -10505,72 +9695,72 @@ Please refrain from engaging in this activity or further actions may be taken ag
VisualDatabaseDisplayFilterToolbarWidget
-
+ Sort by
-
+ Filter by
-
+ Save and load filters
-
+ Filter by exact card name
-
+ Filter by card main-type
-
+ Filter by card sub-type
-
+ Filter by set
-
+ Filter by format legality
-
+ Save/Load
-
+ Name
-
+ Main Type
-
+ Sub Type
-
+ Sets
-
+ Formats
@@ -10578,22 +9768,22 @@ Please refrain from engaging in this activity or further actions may be taken ag
VisualDatabaseDisplayFormatLegalityFilterWidget
-
+ Show formats with at least:
-
+ cards
-
+ Do not display formats with less than this amount of cards in the database
-
+ Filter mode (AND/OR/NOT conjunctions of filters)
@@ -10611,32 +9801,32 @@ Please refrain from engaging in this activity or further actions may be taken ag
VisualDatabaseDisplayMainTypeFilterWidget
-
+ Show main types with at least:
-
+ cards
-
+ Do not display card main-types with less than this amount of cards in the database
-
+ Filter mode (AND/OR/NOT conjunctions of filters)
-
+ Mode: Exact Match
-
+ Mode: Includes
@@ -10644,27 +9834,27 @@ Please refrain from engaging in this activity or further actions may be taken ag
VisualDatabaseDisplayNameFilterWidget
-
+ Filter by name... (Exact match)
-
+ Load from Deck
-
+ Apply all card names in currently loaded deck as exact match name filters
-
+ Load from Clipboard
-
+ Apply all card names in clipboard as exact match name filters
@@ -10672,7 +9862,7 @@ Please refrain from engaging in this activity or further actions may be taken ag
VisualDatabaseDisplayRecentSetFilterSettingsWidget
-
+ Filter to most recent sets
@@ -10680,19 +9870,19 @@ Please refrain from engaging in this activity or further actions may be taken ag
VisualDatabaseDisplaySetFilterWidget
-
+ Search sets...
-
-
+
+ Mode: Exact Match
-
-
+
+ Mode: Includes
@@ -10700,37 +9890,37 @@ Please refrain from engaging in this activity or further actions may be taken ag
VisualDatabaseDisplaySubTypeFilterWidget
-
+ Search subtypes...
-
+ Show sub types with at least:
-
+ cards
-
+ Do not display card sub-types with less than this amount of cards in the database
-
+ Filter mode (AND/OR/NOT conjunctions of filters)
-
+ Mode: Exact Match
-
+ Mode: Includes
@@ -10738,23 +9928,23 @@ Please refrain from engaging in this activity or further actions may be taken ag
VisualDatabaseDisplayWidget
-
+ Search by card name (or search expressions)
-
+ Visual
-
+ Loading database ...
-
+ Clear all filters
@@ -10793,17 +9983,17 @@ Please refrain from engaging in this activity or further actions may be taken ag
-
+ Toggle Layout: Overlap
-
+ Change how cards are displayed within zones (i.e. overlapped or fully visible.)
-
+ Toggle Layout: Flat
@@ -10832,17 +10022,17 @@ Please refrain from engaging in this activity or further actions may be taken ag
VisualDeckEditorWidget
-
+ Type a card name here for suggestions from the database...
-
+ Quick search and add card
-
+ Search for closest match in the database (with auto-suggestions) and add preferred printing to the deck on pressing enter
@@ -10960,43 +10150,43 @@ Please refrain from engaging in this activity or further actions may be taken ag
WarningDialog
-
+ Which warning would you like to send?
-
+ Redact all messages from this user in all rooms
-
+ &OK
-
+ &Cancel
-
+ Warn user for misconduct
-
-
+
+ Error
-
+ User name to send a warning to can not be blank, please specify a user to warn.
-
+ Warning to use can not be blank, please select a valid warning to send.
@@ -11004,133 +10194,133 @@ Please refrain from engaging in this activity or further actions may be taken ag
WndSets
-
+ Move selected set to the top
-
+ Move selected set up
-
+ Move selected set down
-
+ Move selected set to the bottom
-
+ Search by set name, code, or type
-
+ Default order
-
+ Restore original art priority order
-
+ Enable all sets
-
+ Disable all sets
-
+ Enable selected set(s)
-
+ Disable selected set(s)
-
+ Deck Editor
-
+ Use CTRL+A to select all sets in the view.
-
+ Only cards in enabled sets will appear in the card list of the deck editor.
-
+ Image priority is decided in the following order:
-
+ first the CUSTOM Folder (%1), then the Enabled Sets in this dialog (Top to Bottom)%1 is a link to the wiki
-
+ Include cards rebalanced for Alchemy [requires restart]
-
+ Card Art
-
+ How to use custom card art
-
+ Hints
-
+ Note
-
+ Sorting by column allows you to find a set while not changing set priority.
-
+ To enable ordering again, click the column header until this message disappears.
-
+ Use the current sorting as the set priority instead
-
+ Sorts the set priority using the same column
-
+ Manage sets
@@ -11138,72 +10328,72 @@ Please refrain from engaging in this activity or further actions may be taken ag
ZoneViewWidget
-
+ Search by card name (or search expressions)
-
+ Ungrouped
-
+ Group by Type
-
+ Group by Mana Value
-
+ Group by Color
-
+ Unsorted
-
+ Sort by Name
-
+ Sort by Type
-
+ Sort by Mana Cost
-
+ Sort by Colors
-
+ Sort by P/T
-
+ Sort by Set
-
+ shuffle when closing
-
+ pile view
@@ -11211,7 +10401,7 @@ Please refrain from engaging in this activity or further actions may be taken ag
i18n
-
+ English
@@ -11219,12 +10409,12 @@ Please refrain from engaging in this activity or further actions may be taken ag
main
-
+ Connect on startup
-
+ Debug to file
@@ -11238,7 +10428,7 @@ Please refrain from engaging in this activity or further actions may be taken ag
-
+ Deck Editor
@@ -11319,7 +10509,7 @@ Please refrain from engaging in this activity or further actions may be taken ag
-
+ Replays
@@ -11434,129 +10624,129 @@ Please refrain from engaging in this activity or further actions may be taken ag
-
-
+
+ Load Deck from Clipboard...
-
+ Edit Deck in Clipboard, Annotated
-
+ Edit Deck in Clipboard
-
+ New Deck
-
+ Open Custom Pictures Folder
-
+ Print Deck...
-
+ Delete Card
-
-
+
+ Reset Layout
-
+ Save Deck
-
+ Save Deck as...
-
+ Save Deck to Clipboard, Annotated
-
+ Save Deck to Clipboard, Annotated (No Set Info)
-
+ Save Deck to Clipboard
-
+ Save Deck to Clipboard (No Set Info)
-
+ Load Local Deck...
-
+ Load Remote Deck...
-
+ Set Ready to Start
-
+ Toggle Sideboard Lock
-
+ Add Green Counter
-
+ Remove Green Counter
-
+ Set Green Counters...
-
+ Add Red Counter
-
+ Remove Red Counter
-
+ Set Red Counters...
-
+ Add Life Counter
@@ -11566,744 +10756,724 @@ Please refrain from engaging in this activity or further actions may be taken ag
-
- Load deck from online service...
-
-
-
-
- Load from website...
-
-
-
-
+ Unload Deck
-
+ Force Start
-
+ Add Card Counter (F)
-
+ Remove Card Counter (F)
-
+ Set Card Counters (F)...
-
+ Add Card Counter (E)
-
+ Remove Card Counter (E)
-
+ Set Card Counters (E)...
-
+ Add Card Counter(D)
-
+ Remove Card Counter (D)
-
+ Set Card Counters (D)...
-
+ Add Card Counter (C)
-
+ Remove Card Counter (C)
-
+ Set Card Counters (C)...
-
+ Add Card Counter (B)
-
+ Remove Card Counter (B)
-
+ Set Card Counters (B)...
-
+ Add Card Counter (A)
-
+ Remove Card Counter (A)
-
+ Set Card Counters (A)...
-
+ Remove Life Counter
-
+ Set Life Counters...
-
+ Add White Counter
-
+ Remove White Counter
-
+ Set White Counters...
-
+ Add Blue Counter
-
+ Remove Blue Counter
-
+ Set Blue Counters...
-
+ Add Black Counter
-
+ Remove Black Counter
-
+ Set Black Counters...
-
+ Add Colorless Counter
-
+ Remove Colorless Counter
-
+ Set Colorless Counters...
-
+ Add Other Counter
-
+ Remove Other Counter
-
+ Set Other Counters...
-
+ Increment all card counters
-
+ Add Power (+1/+0)
-
+ Remove Power (-1/-0)
-
+ Move Toughness to Power (+1/-1)
-
+ Add Toughness (+0/+1)
-
+ Remove Toughness (-0/-1)
-
+ Move Power to Toughness (-1/+1)
-
+ Add Power and Toughness (+1/+1)
-
+ Remove Power and Toughness (-1/-1)
-
+ Set Power and Toughness...
-
+ Reset Power and Toughness
-
+ Untap
-
+ Upkeep
-
+ Draw
-
+ First Main Phase
-
+ Start Combat
-
+ Attack
-
+ Block
-
+ Damage
-
+ End Combat
-
+ Second Main Phase
-
+ End
-
+ Next Phase
-
+ Next Phase Action
-
+ Next Turn
-
+ Hide Card in Reveal Window
-
+ Tap / Untap Card
-
+ Untap All
-
+ Toggle Skip UntappingToggle Untap
-
+ Turn Card Over
-
+ Peek Card
-
+ Play Card
-
+ Play Card, Face Down
-
+ Attach Card...
-
+ Unattach Card
-
+ Clone Card
-
+ Create Token...
-
+ Create All Related Tokens
-
+ Create Another Token
-
+ Set Annotation...
-
- Reduce Life by Power
-
-
-
-
+ Select All Cards in Zone
-
+ Select All Cards in Row
-
+ Select All Cards in Column
-
+ Reveal Selected Cards to All Players
-
-
+
+ Bottom of Library
-
-
-
-
+
+
+
+ Exile
-
-
-
-
+
+
+
+ Graveyard
-
-
+
+ Hand
-
-
+
+ Top of Library
-
-
+
+ Battlefield, Face Down
-
+ Battlefield
-
+ Library
-
+ Sideboard
-
+ Top Cards of Library
-
+ Bottom Cards of Library
-
+ Close Recent View
-
-
+
+ Stack
-
-
+
+ Graveyard (Multiple)
-
-
+
+ Graveyard (Multiple), Face Down
-
-
+
+ Exile (Multiple)
-
-
+
+ Exile (Multiple), Face Down
-
+ Stack Until Found
-
+ Draw Bottom Card
-
+ Draw Multiple Cards from Bottom...
-
+ Draw Arrow...
-
+ Remove Local Arrows
-
+ Leave Game
-
+ Concede
-
+ Roll Dice...
-
- Flip Coin
-
-
-
-
+ Shuffle Library
-
+ Shuffle Top Cards of Library
-
+ Shuffle Bottom Cards of Library
-
+ Mulligan
-
+ Mulligan (Same hand size)
-
+ Mulligan (Hand size - 1)
-
+ Draw a Card
-
+ Draw Multiple Cards...
-
+ Undo Draw
-
+ Always Reveal Top Card
-
+ Always Look At Top Card
-
+ Sort Hand by Name
-
+ Sort Hand by Type
-
+ Sort Hand by Mana Value
-
+ Reveal Hand to All Players
-
+ Reveal Random Card to All Players
-
+ Rotate View Clockwise
-
+ Rotate View Counterclockwise
-
+ Unfocus Text Box
-
+ Focus Chat
-
+ Clear Chat
-
+ Refresh
-
+ Skip Forward
-
+ Skip Backward
-
+ Skip Forward by a lot
-
+ Skip Backward by a lot
-
+ Play/Pause
-
+ Toggle Fast Forward
-
+ Home
-
+ Visual Deck Storage
-
+ Deck Storage
-
+ Server
-
+ Account
-
+ Administration
-
+ Logs
diff --git a/cockatrice/resources/config/qtlogging.ini b/cockatrice/resources/config/qtlogging.ini
index 7ac0d9ca4..20aa206ce 100644
--- a/cockatrice/resources/config/qtlogging.ini
+++ b/cockatrice/resources/config/qtlogging.ini
@@ -28,8 +28,6 @@
#dlg_tip_of_the_day = true
#dlg_update = true
-#general_settings_page = true
-
#settings_cache = true
#servers_settings = true
#shortcuts_settings = true
diff --git a/cockatrice/resources/config/storage.svg b/cockatrice/resources/config/storage.svg
deleted file mode 100644
index de85228dc..000000000
--- a/cockatrice/resources/config/storage.svg
+++ /dev/null
@@ -1,799 +0,0 @@
-
-
-
-
diff --git a/cockatrice/resources/icons/mana/C.svg b/cockatrice/resources/icons/mana/C.svg
deleted file mode 100644
index eb09fb872..000000000
--- a/cockatrice/resources/icons/mana/C.svg
+++ /dev/null
@@ -1,72 +0,0 @@
-
-
-
-
diff --git a/cockatrice/src/client/network/connection_controller/remote_connection_controller.cpp b/cockatrice/src/client/network/connection_controller/remote_connection_controller.cpp
deleted file mode 100644
index 75cedcafc..000000000
--- a/cockatrice/src/client/network/connection_controller/remote_connection_controller.cpp
+++ /dev/null
@@ -1,587 +0,0 @@
-#include "remote_connection_controller.h"
-
-#include "../../settings/cache_settings.h"
-#include "../interface/widgets/dialogs/dlg_connect.h"
-#include "../interface/widgets/dialogs/dlg_forgot_password_challenge.h"
-#include "../interface/widgets/dialogs/dlg_forgot_password_request.h"
-#include "../interface/widgets/dialogs/dlg_forgot_password_reset.h"
-#include "../interface/widgets/dialogs/dlg_register.h"
-#include "../interface/widgets/utility/get_text_with_max.h"
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-ConnectionController::ConnectionController(QWidget *dialogParent, QObject *parent)
- : QObject(parent), dialogParent(dialogParent)
-{
- remoteClient = new RemoteClient(nullptr, &SettingsCache::instance());
-
- clientThread = new QThread(this);
- remoteClient->moveToThread(clientThread);
- clientThread->start();
-
- wireClientSignals();
-}
-
-ConnectionController::~ConnectionController()
-{
- remoteClient->deleteLater();
- clientThread->wait();
-}
-
-void ConnectionController::wireClientSignals()
-{
- connect(remoteClient, &RemoteClient::connectionClosedEventReceived, this,
- &ConnectionController::onConnectionClosedEvent);
-
- connect(remoteClient, &RemoteClient::serverShutdownEventReceived, this,
- &ConnectionController::onServerShutdownEvent);
-
- connect(remoteClient, &RemoteClient::statusChanged, this, &ConnectionController::onStatusChanged);
-
- connect(remoteClient, &RemoteClient::userInfoChanged, this, &ConnectionController::onUserInfoReceived,
- Qt::BlockingQueuedConnection);
-
- connect(remoteClient, &RemoteClient::loginError, this,
- [this](Response::ResponseCode r, QString rs, quint32 et, QList mf) {
- onLoginError(static_cast(r), rs, et, mf);
- });
-
- connect(remoteClient, &RemoteClient::registerError, this,
- [this](Response::ResponseCode r, QString rs, quint32 et) { onRegisterError(static_cast(r), rs, et); });
-
- connect(remoteClient, &RemoteClient::activateError, this, &ConnectionController::onActivateError);
- connect(remoteClient, &RemoteClient::socketError, this, &ConnectionController::onSocketError);
- connect(remoteClient, &RemoteClient::serverTimeout, this, &ConnectionController::onServerTimeout);
-
- connect(remoteClient, &RemoteClient::protocolVersionMismatch, this,
- &ConnectionController::onProtocolVersionMismatch);
-
- connect(remoteClient, &RemoteClient::registerAccepted, this, &ConnectionController::onRegisterAccepted);
-
- connect(remoteClient, &RemoteClient::registerAcceptedNeedsActivate, this,
- &ConnectionController::onRegisterAcceptedNeedsActivate);
-
- connect(remoteClient, &RemoteClient::activateAccepted, this, &ConnectionController::onActivateAccepted);
-
- connect(remoteClient, &RemoteClient::notifyUserAboutUpdate, this, &ConnectionController::onNotifyUserAboutUpdate);
-
- connect(remoteClient, &RemoteClient::sigForgotPasswordSuccess, this,
- &ConnectionController::onForgotPasswordSuccess);
-
- connect(remoteClient, &RemoteClient::sigForgotPasswordError, this, &ConnectionController::onForgotPasswordError);
-
- connect(remoteClient, &RemoteClient::sigPromptForForgotPasswordReset, this,
- &ConnectionController::onPromptForgotPasswordReset);
-
- connect(remoteClient, &RemoteClient::sigPromptForForgotPasswordChallenge, this,
- &ConnectionController::onPromptForgotPasswordChallenge);
-}
-
-void ConnectionController::connectToServer()
-{
- dlgConnect = new DlgConnect(dialogParent);
- connect(dlgConnect, &DlgConnect::sigStartForgotPasswordRequest, this, &ConnectionController::forgotPasswordRequest);
-
- if (dlgConnect->exec()) {
- remoteClient->connectToServer(dlgConnect->getHost(), static_cast(dlgConnect->getPort()),
- dlgConnect->getPlayerName(), dlgConnect->getPassword());
- }
-}
-
-void ConnectionController::connectToServerDirect(const QString &host,
- unsigned int port,
- const QString &playerName,
- const QString &password)
-{
- remoteClient->connectToServer(host, port, playerName, password);
-}
-
-void ConnectionController::disconnectFromServer()
-{
- remoteClient->disconnectFromServer();
-}
-
-void ConnectionController::registerToServer()
-{
- DlgRegister dlg(dialogParent);
- if (dlg.exec()) {
- remoteClient->registerToServer(dlg.getHost(), static_cast(dlg.getPort()), dlg.getPlayerName(),
- dlg.getPassword(), dlg.getEmail(), dlg.getCountry(), dlg.getRealName());
- }
-}
-
-void ConnectionController::forgotPasswordRequest()
-{
- DlgForgotPasswordRequest dlg(dialogParent);
- if (dlg.exec()) {
- remoteClient->requestForgotPasswordToServer(dlg.getHost(), static_cast(dlg.getPort()),
- dlg.getPlayerName());
- }
-}
-
-void ConnectionController::onConnectionClosedEvent(const Event_ConnectionClosed &event)
-{
- remoteClient->disconnectFromServer();
-
- QString reasonStr;
- switch (event.reason()) {
- case Event_ConnectionClosed::USER_LIMIT_REACHED: {
- reasonStr = tr("The server has reached its maximum user capacity, please check back later.");
- break;
- }
- case Event_ConnectionClosed::TOO_MANY_CONNECTIONS: {
- reasonStr = tr("There are too many concurrent connections from your address.");
- break;
- }
- case Event_ConnectionClosed::BANNED: {
- reasonStr = tr("Banned by moderator");
- if (event.has_end_time()) {
- reasonStr.append(
- "\n" + tr("Expected end time: %1").arg(QDateTime::fromSecsSinceEpoch(event.end_time()).toString()));
- } else {
- reasonStr.append("\n" + tr("This ban lasts indefinitely."));
- }
- if (event.has_reason_str()) {
- reasonStr.append("\n\n" + QString::fromStdString(event.reason_str()));
- }
- break;
- }
- case Event_ConnectionClosed::SERVER_SHUTDOWN: {
- reasonStr = tr("Scheduled server shutdown.");
- break;
- }
- case Event_ConnectionClosed::USERNAMEINVALID: {
- reasonStr = tr("Invalid username.");
- break;
- }
- case Event_ConnectionClosed::LOGGEDINELSEWERE: {
- reasonStr = tr("You have been logged out due to logging in at another location.");
- break;
- }
- default:
- reasonStr = QString::fromStdString(event.reason_str());
- }
-
- QMessageBox::critical(dialogParent, tr("Connection closed"),
- tr("The server has terminated your connection.\nReason: %1").arg(reasonStr));
-}
-
-void ConnectionController::onServerShutdownEvent(const Event_ServerShutdown &event)
-{
- serverShutdownMessageBox.setInformativeText(tr("The server is going to be restarted in %n minute(s).\nAll running "
- "games will be lost.\nReason for shutdown: %1",
- "", event.minutes())
- .arg(QString::fromStdString(event.reason())));
- serverShutdownMessageBox.setIconPixmap(QPixmap("theme:cockatrice").scaled(64, 64));
- serverShutdownMessageBox.setText(tr("Scheduled server shutdown"));
- serverShutdownMessageBox.setWindowModality(Qt::ApplicationModal);
- serverShutdownMessageBox.setVisible(true);
-}
-
-void ConnectionController::onStatusChanged(ClientStatus status)
-{
- // Update the window title first, then let MainWindow handle its own UI
- // state via the forwarded signal
- updateWindowTitle();
- emit statusChanged(status);
-
- // TabSupervisor::stop() needs calling on disconnect; start() is driven by
- // onUserInfoReceived → tabSupervisorStartRequested.
- if (status == StatusDisconnected) {
- emit tabSupervisorStopRequested();
- }
-}
-
-void ConnectionController::onUserInfoReceived(const ServerInfo_User &info)
-{
- emit tabSupervisorStartRequested(info);
-}
-
-void ConnectionController::onLoginError(int r,
- QString reasonStr,
- quint32 endTime,
- const QList &missingFeatures)
-{
- switch (static_cast(r)) {
- case Response::RespClientUpdateRequired: {
- QString formatted = "Missing Features: ";
- for (int i = 0; i < missingFeatures.size(); ++i) {
- formatted.append(QString("\n %1").arg(QChar(0x2022)) + " " + missingFeatures.value(i));
- }
-
- QMessageBox msgBox(dialogParent);
- msgBox.setIcon(QMessageBox::Critical);
- msgBox.setWindowTitle(tr("Failed Login"));
- msgBox.setText(tr("Your client seems to be missing features this server requires for connection.") +
- "\n\n" + tr("To update your client, go to 'Help -> Check for Client Updates'."));
- msgBox.setDetailedText(formatted);
- msgBox.exec();
- break;
- }
-
- case Response::RespWrongPassword: {
- QMessageBox::critical(dialogParent, tr("Error"),
- tr("Incorrect username or password. "
- "Please check your authentication information and try again."));
- break;
- }
-
- case Response::RespWouldOverwriteOldSession: {
- QMessageBox::critical(dialogParent, tr("Error"),
- tr("There is already an active session using this user name.\n"
- "Please close that session first and re-login."));
- break;
- }
-
- case Response::RespUserIsBanned: {
- QString bannedStr =
- endTime ? tr("You are banned until %1.").arg(QDateTime::fromSecsSinceEpoch(endTime).toString())
- : tr("You are banned indefinitely.");
- if (!reasonStr.isEmpty()) {
- bannedStr.append("\n\n" + reasonStr);
- }
- QMessageBox::critical(dialogParent, tr("Error"), bannedStr);
- break;
- }
-
- case Response::RespUsernameInvalid: {
- QMessageBox::critical(dialogParent, tr("Error"), extractInvalidUsernameMessage(reasonStr));
- break;
- }
-
- case Response::RespRegistrationRequired: {
- if (QMessageBox::question(dialogParent, tr("Error"),
- tr("This server requires user registration. Do you want to register now?"),
- QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
- registerToServer();
- }
- return; // don't re-prompt connect
- }
-
- case Response::RespClientIdRequired: {
- QMessageBox::critical(dialogParent, tr("Error"),
- tr("This server requires client IDs. Your client is either failing to generate an "
- "ID or you are running a modified client.\n"
- "Please close and reopen your client to try again."));
- break;
- }
-
- case Response::RespContextError: {
- QMessageBox::critical(dialogParent, tr("Error"),
- tr("An internal error has occurred, please close and reopen Cockatrice before "
- "trying again.\nIf the error persists, ensure you are running the latest "
- "version of the software and if needed contact the software developers."));
- break;
- }
-
- case Response::RespAccountNotActivated: {
- bool ok = false;
- QString token =
- getTextWithMax(dialogParent, tr("Account activation"),
- tr("Your account has not been activated yet.\n"
- "You need to provide the activation token received in the activation email."),
- QLineEdit::Normal, QString(), &ok);
-
- if (ok && !token.isEmpty()) {
- remoteClient->activateToServer(token);
- return;
- }
- remoteClient->disconnectFromServer();
- return;
- }
-
- case Response::RespServerFull: {
- QMessageBox::critical(dialogParent, tr("Server Full"),
- tr("The server has reached its maximum user capacity, please check back later."));
- break;
- }
-
- default: {
- QMessageBox::critical(dialogParent, tr("Error"),
- tr("Unknown login error: %1").arg(r) +
- tr("\nThis usually means that your client version is out of date, and the server "
- "sent a reply your client doesn't understand."));
- break;
- }
- }
-
- // Re-open the connect dialog after any handled error
- connectToServer();
-}
-
-void ConnectionController::onRegisterError(int r, QString reasonStr, quint32 endTime)
-{
- switch (static_cast(r)) {
- case Response::RespRegistrationDisabled: {
- QMessageBox::critical(dialogParent, tr("Registration denied"),
- tr("Registration is currently disabled on this server"));
- break;
- }
- case Response::RespUserAlreadyExists: {
- QMessageBox::critical(dialogParent, tr("Registration denied"),
- tr("There is already an existing account with the same user name."));
- break;
- }
- case Response::RespEmailRequiredToRegister: {
- QMessageBox::critical(dialogParent, tr("Registration denied"),
- tr("It's mandatory to specify a valid email address when registering."));
- break;
- }
- case Response::RespEmailBlackListed: {
- if (reasonStr.isEmpty()) {
- reasonStr =
- "The email address provider used during registration has been blocked from use on this server.";
- }
- QMessageBox::critical(dialogParent, tr("Registration denied"), reasonStr);
- break;
- }
- case Response::RespTooManyRequests: {
- QMessageBox::critical(dialogParent, tr("Registration denied"),
- tr("It appears you are attempting to register a new account on this server yet you "
- "already have an account registered with the email provided. This server "
- "restricts the number of accounts a user can register per address. Please "
- "contact the server operator for further assistance or to obtain your "
- "credential information."));
- break;
- }
- case Response::RespPasswordTooShort: {
- QMessageBox::critical(dialogParent, tr("Registration denied"), tr("Password too short."));
- break;
- }
- case Response::RespUserIsBanned: {
- QString bannedStr =
- endTime ? tr("You are banned until %1.").arg(QDateTime::fromSecsSinceEpoch(endTime).toString())
- : tr("You are banned indefinitely.");
- if (!reasonStr.isEmpty()) {
- bannedStr.append("\n\n" + reasonStr);
- }
- QMessageBox::critical(dialogParent, tr("Error"), bannedStr);
- break;
- }
- case Response::RespUsernameInvalid: {
- QMessageBox::critical(dialogParent, tr("Error"), extractInvalidUsernameMessage(reasonStr));
- break;
- }
- case Response::RespRegistrationFailed: {
- QMessageBox::critical(dialogParent, tr("Error"),
- tr("Registration failed for a technical problem on the server."));
- break;
- }
- case Response::RespNotConnected: {
- QMessageBox::critical(dialogParent, tr("Error"), tr("The connection to the server has been lost."));
- break;
- }
- default: {
- QMessageBox::critical(dialogParent, tr("Error"),
- tr("Unknown registration error: %1").arg(r) +
- tr("\nThis usually means that your client version is out of date, and the server "
- "sent a reply your client doesn't understand."));
- break;
- }
- }
-
- registerToServer();
-}
-
-void ConnectionController::onActivateError()
-{
- QMessageBox::critical(dialogParent, tr("Error"), tr("Account activation failed"));
- remoteClient->disconnectFromServer();
- connectToServer();
-}
-
-void ConnectionController::onSocketError(const QString &errorStr)
-{
- QMessageBox::critical(dialogParent, tr("Error"), tr("Socket error: %1").arg(errorStr));
- connectToServer();
-}
-
-void ConnectionController::onServerTimeout()
-{
- QMessageBox::critical(dialogParent, tr("Error"), tr("Server timeout"));
- connectToServer();
-}
-
-void ConnectionController::onProtocolVersionMismatch(int localVersion, int remoteVersion)
-{
- if (localVersion > remoteVersion) {
- QMessageBox::critical(dialogParent, tr("Error"),
- tr("You are trying to connect to an obsolete server. Please downgrade your Cockatrice "
- "version or connect to a suitable server.\n"
- "Local version is %1, remote version is %2.")
- .arg(localVersion)
- .arg(remoteVersion));
- } else {
- QMessageBox::critical(dialogParent, tr("Error"),
- tr("Your Cockatrice client is obsolete. Please update your Cockatrice version.\n"
- "Local version is %1, remote version is %2.")
- .arg(localVersion)
- .arg(remoteVersion));
- }
-}
-
-void ConnectionController::onRegisterAccepted()
-{
- QMessageBox::information(dialogParent, tr("Success"), tr("Registration accepted.\nWill now login."));
-}
-
-void ConnectionController::onRegisterAcceptedNeedsActivate()
-{
- // Server will send activation email; nothing to display here.
-}
-
-void ConnectionController::onActivateAccepted()
-{
- QMessageBox::information(dialogParent, tr("Success"), tr("Account activation accepted.\nWill now login."));
-}
-
-void ConnectionController::onNotifyUserAboutUpdate()
-{
- QMessageBox::information(
- dialogParent, tr("Information"),
- tr("This server supports additional features that your client doesn't have.\n"
- "This is most likely not a problem, but this message might mean there is a new version of "
- "Cockatrice available or this server is running a custom or pre-release version.\n\n"
- "To update your client, go to Help -> Check for Updates."));
-}
-
-void ConnectionController::onForgotPasswordSuccess()
-{
- QMessageBox::information(
- dialogParent, tr("Reset Password"),
- tr("Your password has been reset successfully, you can now log in using the new credentials."));
- SettingsCache::instance().servers().setFPHostName("");
- SettingsCache::instance().servers().setFPPort("");
- SettingsCache::instance().servers().setFPPlayerName("");
-}
-
-void ConnectionController::onForgotPasswordError()
-{
- QMessageBox::warning(
- dialogParent, tr("Reset Password"),
- tr("Failed to reset user account password, please contact the server operator to reset your password."));
- SettingsCache::instance().servers().setFPHostName("");
- SettingsCache::instance().servers().setFPPort("");
- SettingsCache::instance().servers().setFPPlayerName("");
-}
-
-void ConnectionController::onPromptForgotPasswordReset()
-{
- QMessageBox::information(dialogParent, tr("Reset Password"),
- tr("Activation request received, please check your email for an activation token."));
- DlgForgotPasswordReset dlg(dialogParent);
- if (dlg.exec()) {
- remoteClient->submitForgotPasswordResetToServer(dlg.getHost(), static_cast(dlg.getPort()),
- dlg.getPlayerName(), dlg.getToken(), dlg.getPassword());
- }
-}
-
-void ConnectionController::onPromptForgotPasswordChallenge()
-{
- DlgForgotPasswordChallenge dlg(dialogParent);
- if (dlg.exec()) {
- remoteClient->submitForgotPasswordChallengeToServer(dlg.getHost(), static_cast(dlg.getPort()),
- dlg.getPlayerName(), dlg.getEmail());
- }
-}
-
-void ConnectionController::updateWindowTitle()
-{
- const QString appName = QStringLiteral("Cockatrice");
- QString title;
-
- switch (remoteClient->getStatus()) {
- case StatusConnecting: {
- title = appName + " - " + tr("Connecting to %1...").arg(remoteClient->peerName());
- break;
- }
- case StatusRegistering: {
- title = appName + " - " +
- tr("Registering to %1 as %2...").arg(remoteClient->peerName()).arg(remoteClient->getUserName());
- break;
- }
- case StatusDisconnected: {
- title = appName + " - " + tr("Disconnected");
- break;
- }
- case StatusLoggingIn: {
- title = appName + " - " + tr("Connected, logging in at %1").arg(remoteClient->peerName());
- break;
- }
- case StatusLoggedIn: {
- title = remoteClient->getUserName() + "@" + remoteClient->peerName();
- break;
- }
- case StatusRequestingForgotPassword:
- case StatusSubmitForgotPasswordChallenge:
- case StatusSubmitForgotPasswordReset:
- title = appName + " - " +
- tr("Requesting forgotten password to %1 as %2...")
- .arg(remoteClient->peerName())
- .arg(remoteClient->getUserName());
- break;
- default:
- title = appName;
- }
-
- emit windowTitleChanged(title);
-}
-
-// static
-QString ConnectionController::extractInvalidUsernameMessage(QString &in)
-{
- QString out = tr("Invalid username.") + " ";
- QStringList rules = in.split(QChar('|'));
-
- if (rules.size() == 7 || rules.size() == 9) {
- out += tr("Your username must respect these rules:") + "
" + tr("can contain the following punctuation: %1").arg(rules.at(6).toHtmlEscaped()) + "
";
- }
-
- out += "
" +
- tr("first character can %1 be a punctuation mark").arg((rules.at(5).toInt() > 0) ? "" : tr("NOT")) +
- "
";
-
- if (rules.size() == 9) {
- if (rules.at(7).size() > 0) {
- QString words = rules.at(7).toHtmlEscaped();
- if (words.startsWith("\n")) {
- out += tr("no unacceptable language as specified by these server rules:",
- "note that the following lines will not be translated");
- for (QString &line : words.split("\n", Qt::SkipEmptyParts)) {
- out += "
" + line + "
";
- }
- } else {
- out += "
" + tr("can not contain any of the following words: %1").arg(words) + "
";
- }
- }
-
- if (rules.at(8).size() > 0) {
- out += "
" +
- tr("can not match any of the following expressions: %1").arg(rules.at(8).toHtmlEscaped()) +
- "
";
- }
- }
-
- out += "
";
- } else {
- out += tr("You may only use A-Z, a-z, 0-9, _, ., and - in your username.");
- }
-
- return out;
-}
\ No newline at end of file
diff --git a/cockatrice/src/client/network/connection_controller/remote_connection_controller.h b/cockatrice/src/client/network/connection_controller/remote_connection_controller.h
deleted file mode 100644
index 7486bc81a..000000000
--- a/cockatrice/src/client/network/connection_controller/remote_connection_controller.h
+++ /dev/null
@@ -1,98 +0,0 @@
-#ifndef COCKATRICE_REMOTE_CONNECTION_CONTROLLER_H
-#define COCKATRICE_REMOTE_CONNECTION_CONTROLLER_H
-
-#include "abstract_client.h"
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-class RemoteClient;
-class ServerInfo_User;
-class DlgConnect;
-
-/**
- * Owns the RemoteClient and its worker thread.
- * Encapsulates all connection, authentication, and registration logic so that
- * MainWindow only needs to react to high-level signals.
- */
-class ConnectionController : public QObject
-{
- Q_OBJECT
-
-public:
- explicit ConnectionController(QWidget *dialogParent, QObject *parent = nullptr);
- ~ConnectionController() override;
-
- RemoteClient *client() const
- {
- return remoteClient;
- }
-
- void registerToServer();
- void forgotPasswordRequest();
- void connectToServer();
- void
- connectToServerDirect(const QString &host, unsigned int port, const QString &playerName, const QString &password);
- void disconnectFromServer();
-
- void refreshWindowTitle()
- {
- updateWindowTitle();
- }
-
-signals:
- void windowTitleChanged(const QString &title);
-
- void tabSupervisorStartRequested(const ServerInfo_User &info);
- void tabSupervisorStopRequested();
-
- // Passes the raw ClientStatus through so MainWindow can drive its own
- // action enable/disable logic
- void statusChanged(ClientStatus status);
-
-private slots:
- // Slots wired directly to RemoteClient signals
- void onStatusChanged(ClientStatus status);
- void onUserInfoReceived(const ServerInfo_User &info);
- void onLoginError(int r, QString reasonStr, quint32 endTime, const QList &missingFeatures);
- void onRegisterAccepted();
- void onRegisterAcceptedNeedsActivate();
- void onRegisterError(int r, QString reasonStr, quint32 endTime);
- void onActivateAccepted();
- void onActivateError();
- void onProtocolVersionMismatch(int localVersion, int remoteVersion);
- void onNotifyUserAboutUpdate();
- void onConnectionClosedEvent(const Event_ConnectionClosed &event);
- void onServerShutdownEvent(const Event_ServerShutdown &event);
- void onSocketError(const QString &errorStr);
- void onServerTimeout();
-
- // Forgot-password flow
- void onForgotPasswordSuccess();
- void onForgotPasswordError();
- void onPromptForgotPasswordReset();
- void onPromptForgotPasswordChallenge();
-
-private:
- void wireClientSignals();
- void updateWindowTitle();
-
- /** Parse the server's pipe-delimited username-rule string into HTML. */
- static QString extractInvalidUsernameMessage(QString &in);
-
- RemoteClient *remoteClient{nullptr};
- QThread *clientThread{nullptr};
- QWidget *dialogParent{nullptr}; // used as parent for QMessageBox / dialog calls
-
- // Persistent so it can be updated in-place by onServerShutdownEvent
- QMessageBox serverShutdownMessageBox;
-
- // Kept as a member so the forgot-password signal can be wired to it
- DlgConnect *dlgConnect{nullptr};
-};
-
-#endif // COCKATRICE_REMOTE_CONNECTION_CONTROLLER_H
diff --git a/cockatrice/src/client/network/interfaces/deck_stats_interface.cpp b/cockatrice/src/client/network/interfaces/deck_stats_interface.cpp
index 8689a19e9..0298daa6b 100644
--- a/cockatrice/src/client/network/interfaces/deck_stats_interface.cpp
+++ b/cockatrice/src/client/network/interfaces/deck_stats_interface.cpp
@@ -6,12 +6,12 @@
#include
#include
#include
-#include
#include
#include
#include
-DeckStatsInterface::DeckStatsInterface(QObject *parent) : QObject(parent)
+DeckStatsInterface::DeckStatsInterface(CardDatabase &_cardDatabase, QObject *parent)
+ : QObject(parent), cardDatabase(_cardDatabase)
{
manager = new QNetworkAccessManager(this);
connect(manager, &QNetworkAccessManager::finished, this, &DeckStatsInterface::queryFinished);
@@ -70,8 +70,8 @@ void DeckStatsInterface::analyzeDeck(const DeckList &deck)
void DeckStatsInterface::copyDeckWithoutTokens(const DeckList &source, DeckList &destination)
{
- auto copyIfNotAToken = [&destination](const auto node, const auto card) {
- CardInfoPtr dbCard = CardDatabaseManager::query()->getCardInfo(card->getName());
+ auto copyIfNotAToken = [this, &destination](const auto node, const auto card) {
+ CardInfoPtr dbCard = cardDatabase.query()->getCardInfo(card->getName());
if (dbCard && !dbCard->getIsToken()) {
DecklistCardNode *addedCard = destination.addCard(card->getName(), node->getName(), -1);
addedCard->setNumber(card->getNumber());
diff --git a/cockatrice/src/client/network/interfaces/deck_stats_interface.h b/cockatrice/src/client/network/interfaces/deck_stats_interface.h
index 09bf998de..7dc841027 100644
--- a/cockatrice/src/client/network/interfaces/deck_stats_interface.h
+++ b/cockatrice/src/client/network/interfaces/deck_stats_interface.h
@@ -1,12 +1,13 @@
/**
* @file deck_stats_interface.h
* @ingroup ApiInterfaces
+ * @brief TODO: Document this.
*/
-//! \todo Document this file.
#ifndef DECKSTATS_INTERFACE_H
#define DECKSTATS_INTERFACE_H
+#include
#include
class QByteArray;
@@ -20,6 +21,8 @@ class DeckStatsInterface : public QObject
private:
QNetworkAccessManager *manager;
+ CardDatabase &cardDatabase;
+
/**
* Deckstats doesn't recognize token cards, and instead tries to find the
* closest non-token card instead. So we construct a new deck which has no
@@ -32,7 +35,7 @@ private slots:
void getAnalyzeRequestData(const DeckList &deck, QByteArray &data);
public:
- explicit DeckStatsInterface(QObject *parent = nullptr);
+ explicit DeckStatsInterface(CardDatabase &_cardDatabase, QObject *parent = nullptr);
void analyzeDeck(const DeckList &deck);
};
diff --git a/cockatrice/src/client/network/interfaces/tapped_out_interface.cpp b/cockatrice/src/client/network/interfaces/tapped_out_interface.cpp
index 5dc77fa2c..af377d176 100644
--- a/cockatrice/src/client/network/interfaces/tapped_out_interface.cpp
+++ b/cockatrice/src/client/network/interfaces/tapped_out_interface.cpp
@@ -6,12 +6,12 @@
#include
#include
#include
-#include
#include
#include
#include
-TappedOutInterface::TappedOutInterface(QObject *parent) : QObject(parent)
+TappedOutInterface::TappedOutInterface(CardDatabase &_cardDatabase, QObject *parent)
+ : QObject(parent), cardDatabase(_cardDatabase)
{
manager = new QNetworkAccessManager(this);
connect(manager, &QNetworkAccessManager::finished, this, &TappedOutInterface::queryFinished);
@@ -97,18 +97,16 @@ void TappedOutInterface::analyzeDeck(const DeckList &deck)
void TappedOutInterface::copyDeckSplitMainAndSide(const DeckList &source, DeckList &mainboard, DeckList &sideboard)
{
- auto copyMainOrSide = [&mainboard, &sideboard](const auto node, const auto card) {
- CardInfoPtr dbCard = CardDatabaseManager::query()->getCardInfo(card->getName());
- if (!dbCard || dbCard->getIsToken()) {
+ auto copyMainOrSide = [this, &mainboard, &sideboard](const auto node, const auto card) {
+ CardInfoPtr dbCard = cardDatabase.query()->getCardInfo(card->getName());
+ if (!dbCard || dbCard->getIsToken())
return;
- }
DecklistCardNode *addedCard;
- if (node->getName() == DECK_ZONE_SIDE) {
+ if (node->getName() == DECK_ZONE_SIDE)
addedCard = sideboard.addCard(card->getName(), node->getName(), -1);
- } else {
+ else
addedCard = mainboard.addCard(card->getName(), node->getName(), -1);
- }
addedCard->setNumber(card->getNumber());
};
diff --git a/cockatrice/src/client/network/interfaces/tapped_out_interface.h b/cockatrice/src/client/network/interfaces/tapped_out_interface.h
index 32f9369d5..0ea9c8358 100644
--- a/cockatrice/src/client/network/interfaces/tapped_out_interface.h
+++ b/cockatrice/src/client/network/interfaces/tapped_out_interface.h
@@ -1,14 +1,14 @@
/**
* @file tapped_out_interface.h
* @ingroup ApiInterfaces
+ * @brief TODO: Document this.
*/
-//! \todo Document this file.
#ifndef TAPPEDOUT_INTERFACE_H
#define TAPPEDOUT_INTERFACE_H
-#include
-#include
+#include
+#include
inline Q_LOGGING_CATEGORY(TappedOutInterfaceLog, "tapped_out_interface");
@@ -29,13 +29,14 @@ class TappedOutInterface : public QObject
private:
QNetworkAccessManager *manager;
+ CardDatabase &cardDatabase;
void copyDeckSplitMainAndSide(const DeckList &source, DeckList &mainboard, DeckList &sideboard);
private slots:
void queryFinished(QNetworkReply *reply);
void getAnalyzeRequestData(const DeckList &deck, QByteArray &data);
public:
- explicit TappedOutInterface(QObject *parent = nullptr);
+ explicit TappedOutInterface(CardDatabase &_cardDatabase, QObject *parent = nullptr);
void analyzeDeck(const DeckList &deck);
};
diff --git a/cockatrice/src/client/network/parsers/deck_link_to_api_transformer.h b/cockatrice/src/client/network/parsers/deck_link_to_api_transformer.h
index bbdd70c97..1e2372fd1 100644
--- a/cockatrice/src/client/network/parsers/deck_link_to_api_transformer.h
+++ b/cockatrice/src/client/network/parsers/deck_link_to_api_transformer.h
@@ -1,8 +1,8 @@
/**
* @file deck_link_to_api_transformer.h
* @ingroup ApiInterfaces
+ * @brief TODO: Document this.
*/
-//! \todo Document this file.
#ifndef DECK_LINK_TO_API_TRANSFORMER_H
#define DECK_LINK_TO_API_TRANSFORMER_H
diff --git a/cockatrice/src/client/network/parsers/interface_json_deck_parser.h b/cockatrice/src/client/network/parsers/interface_json_deck_parser.h
index 87fde4d54..1818aa35c 100644
--- a/cockatrice/src/client/network/parsers/interface_json_deck_parser.h
+++ b/cockatrice/src/client/network/parsers/interface_json_deck_parser.h
@@ -1,8 +1,8 @@
/**
* @file interface_json_deck_parser.h
* @ingroup ApiInterfaces
+ * @brief TODO: Document this.
*/
-//! \todo Document this file.
#ifndef INTERFACE_JSON_DECK_PARSER_H
#define INTERFACE_JSON_DECK_PARSER_H
diff --git a/cockatrice/src/client/network/update/card_spoiler/spoiler_background_updater.h b/cockatrice/src/client/network/update/card_spoiler/spoiler_background_updater.h
index 03d4897a2..a2feb5ccf 100644
--- a/cockatrice/src/client/network/update/card_spoiler/spoiler_background_updater.h
+++ b/cockatrice/src/client/network/update/card_spoiler/spoiler_background_updater.h
@@ -1,8 +1,8 @@
/**
* @file spoiler_background_updater.h
* @ingroup Client
+ * @brief TODO: Document this.
*/
-//! \todo Document this file.
#ifndef COCKATRICE_SPOILER_DOWNLOADER_H
#define COCKATRICE_SPOILER_DOWNLOADER_H
diff --git a/cockatrice/src/client/network/update/client/client_update_checker.h b/cockatrice/src/client/network/update/client/client_update_checker.h
index 1a89de533..4e6f279c3 100644
--- a/cockatrice/src/client/network/update/client/client_update_checker.h
+++ b/cockatrice/src/client/network/update/client/client_update_checker.h
@@ -1,8 +1,8 @@
/**
* @file client_update_checker.h
* @ingroup ClientUpdate
+ * @brief TODO: Document this.
*/
-//! \todo Document this file.
#ifndef CLIENT_UPDATE_CHECKER_H
#define CLIENT_UPDATE_CHECKER_H
diff --git a/cockatrice/src/client/network/update/client/release_channel.cpp b/cockatrice/src/client/network/update/client/release_channel.cpp
index 260167bc8..9edfe7caf 100644
--- a/cockatrice/src/client/network/update/client/release_channel.cpp
+++ b/cockatrice/src/client/network/update/client/release_channel.cpp
@@ -129,9 +129,8 @@ void StableReleaseChannel::releaseListFinished()
return;
}
- if (!lastRelease) {
+ if (!lastRelease)
lastRelease = new Release;
- }
lastRelease->setName(resultMap["name"].toString());
lastRelease->setDescriptionUrl(resultMap["html_url"].toString());
@@ -247,9 +246,8 @@ void BetaReleaseChannel::releaseListFinished()
return;
}
- if (lastRelease == nullptr) {
+ if (lastRelease == nullptr)
lastRelease = new Release;
- }
lastRelease->setCommitHash(resultMap["target_commitish"].toString());
lastRelease->setPublishDate(resultMap["published_at"].toDate());
diff --git a/cockatrice/src/client/network/update/client/release_channel.h b/cockatrice/src/client/network/update/client/release_channel.h
index c56d0cfce..93e6b985d 100644
--- a/cockatrice/src/client/network/update/client/release_channel.h
+++ b/cockatrice/src/client/network/update/client/release_channel.h
@@ -1,8 +1,8 @@
/**
* @file release_channel.h
* @ingroup ClientUpdate
+ * @brief TODO: Document this.
*/
-//! \todo Document this file.
#ifndef RELEASECHANNEL_H
#define RELEASECHANNEL_H
diff --git a/cockatrice/src/client/network/update/client/update_downloader.cpp b/cockatrice/src/client/network/update/client/update_downloader.cpp
index a71bcf8f8..c0f3e945c 100644
--- a/cockatrice/src/client/network/update/client/update_downloader.cpp
+++ b/cockatrice/src/client/network/update/client/update_downloader.cpp
@@ -10,9 +10,8 @@ UpdateDownloader::UpdateDownloader(QObject *parent) : QObject(parent), response(
void UpdateDownloader::beginDownload(QUrl downloadUrl)
{
// Save the original URL because we need it for the filename
- if (originalUrl.isEmpty()) {
+ if (originalUrl.isEmpty())
originalUrl = downloadUrl;
- }
response = netMan->get(QNetworkRequest(downloadUrl));
connect(response, &QNetworkReply::finished, this, &UpdateDownloader::fileFinished);
@@ -22,9 +21,8 @@ void UpdateDownloader::beginDownload(QUrl downloadUrl)
void UpdateDownloader::downloadError(QNetworkReply::NetworkError)
{
- if (response == nullptr) {
+ if (response == nullptr)
return;
- }
emit error(response->errorString().toUtf8());
}
diff --git a/cockatrice/src/client/network/update/client/update_downloader.h b/cockatrice/src/client/network/update/client/update_downloader.h
index 9a0caccbc..d70759038 100644
--- a/cockatrice/src/client/network/update/client/update_downloader.h
+++ b/cockatrice/src/client/network/update/client/update_downloader.h
@@ -1,8 +1,8 @@
/**
* @file update_downloader.h
* @ingroup ClientUpdate
+ * @brief TODO: Document this.
*/
-//! \todo Document this file.
#ifndef COCKATRICE_UPDATEDOWNLOADER_H
#define COCKATRICE_UPDATEDOWNLOADER_H
diff --git a/cockatrice/src/client/settings/cache_settings.cpp b/cockatrice/src/client/settings/cache_settings.cpp
index b6bc8a47d..9a46c6426 100644
--- a/cockatrice/src/client/settings/cache_settings.cpp
+++ b/cockatrice/src/client/settings/cache_settings.cpp
@@ -1,7 +1,5 @@
#include "cache_settings.h"
-#include "../../interface/card_picture_loader/card_picture_loader_cache_method.h"
-#include "../../interface/card_picture_loader/card_picture_loader_local_schemes.h"
#include "../network/update/client/release_channel.h"
#include "card_counter_settings.h"
#include "version_string.h"
@@ -26,11 +24,10 @@ SettingsCache &SettingsCache::instance()
QString SettingsCache::getDataPath()
{
- if (isPortableBuild) {
+ if (isPortableBuild)
return qApp->applicationDirPath() + "/data";
- } else {
+ else
return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation);
- }
}
QString SettingsCache::getSettingsPath()
@@ -40,11 +37,10 @@ QString SettingsCache::getSettingsPath()
QString SettingsCache::getCachePath() const
{
- if (isPortableBuild) {
+ if (isPortableBuild)
return qApp->applicationDirPath() + "/cache";
- } else {
+ else
return QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
- }
}
QString SettingsCache::getNetworkCachePath() const
@@ -54,17 +50,14 @@ QString SettingsCache::getNetworkCachePath() const
void SettingsCache::translateLegacySettings()
{
- if (isPortableBuild) {
+ if (isPortableBuild)
return;
- }
// Layouts
QFile layoutFile(getSettingsPath() + "layouts/deckLayout.ini");
- if (layoutFile.exists()) {
- if (layoutFile.copy(getSettingsPath() + "layouts.ini")) {
+ if (layoutFile.exists())
+ if (layoutFile.copy(getSettingsPath() + "layouts.ini"))
layoutFile.remove();
- }
- }
QStringList usedKeys;
QSettings legacySetting;
@@ -123,11 +116,10 @@ void SettingsCache::translateLegacySettings()
gameFilters().setHideIgnoredUserGames(legacySetting.value("hide_ignored_user_games").toBool());
gameFilters().setMinPlayers(legacySetting.value("min_players").toInt());
- if (legacySetting.value("max_players").toInt() > 1) {
+ if (legacySetting.value("max_players").toInt() > 1)
gameFilters().setMaxPlayers(legacySetting.value("max_players").toInt());
- } else {
+ else
gameFilters().setMaxPlayers(99); // This prevents a bug where no games will show if max was not set before
- }
QStringList allFilters = legacySetting.allKeys();
for (int i = 0; i < allFilters.size(); ++i) {
@@ -143,9 +135,8 @@ void SettingsCache::translateLegacySettings()
QStringList allLegacyKeys = legacySetting.allKeys();
for (int i = 0; i < allLegacyKeys.size(); ++i) {
- if (usedKeys.contains(allLegacyKeys.at(i))) {
+ if (usedKeys.contains(allLegacyKeys.at(i)))
continue;
- }
settings->setValue(allLegacyKeys.at(i), legacySetting.value(allLegacyKeys.at(i)));
}
}
@@ -156,9 +147,8 @@ QString SettingsCache::getSafeConfigPath(QString configEntry, QString defaultPat
// if the config settings is empty or refers to a not-existing folder,
// ensure that the defaut path exists and return it
if (tmp.isEmpty() || !QDir(tmp).exists()) {
- if (!QDir().mkpath(defaultPath)) {
+ if (!QDir().mkpath(defaultPath))
qCInfo(SettingsCacheLog) << "[SettingsCache] Could not create folder:" << defaultPath;
- }
tmp = defaultPath;
}
return tmp;
@@ -169,9 +159,8 @@ QString SettingsCache::getSafeConfigFilePath(QString configEntry, QString defaul
QString tmp = settings->value(configEntry).toString();
// if the config settings is empty or refers to a not-existing file,
// return the default Path
- if (!QFile::exists(tmp) || tmp.isEmpty()) {
+ if (!QFile::exists(tmp) || tmp.isEmpty())
tmp = std::move(defaultPath);
- }
return tmp;
}
@@ -179,9 +168,8 @@ SettingsCache::SettingsCache()
{
// first, figure out if we are running in portable mode
isPortableBuild = QFile::exists(qApp->applicationDirPath() + "/portable.dat");
- if (isPortableBuild) {
+ if (isPortableBuild)
qCInfo(SettingsCacheLog) << "Portable mode enabled";
- }
// define a dummy context that will be used where needed
QString dummy = QT_TRANSLATE_NOOP("i18n", "English");
@@ -201,9 +189,8 @@ SettingsCache::SettingsCache()
cardCounterSettings = new CardCounterSettings(settingsPath, this);
- if (!QFile(settingsPath + "global.ini").exists()) {
+ if (!QFile(settingsPath + "global.ini").exists())
translateLegacySettings();
- }
// updates - don't reorder them or their index in the settings won't match
// append channels one by one, or msvc will add them in the wrong order.
@@ -270,26 +257,14 @@ SettingsCache::SettingsCache()
settings->setValue("personal/pixmapCacheSize", pixmapCacheSize);
settings->setValue("personal/picturedownloadhq", false);
settings->setValue("revert/pixmapCacheSize", true);
- } else {
+ } else
pixmapCacheSize = settings->value("personal/pixmapCacheSize", PIXMAPCACHE_SIZE_DEFAULT).toInt();
- }
// sanity check
- if (pixmapCacheSize < PIXMAPCACHE_SIZE_MIN || pixmapCacheSize > PIXMAPCACHE_SIZE_MAX) {
+ if (pixmapCacheSize < PIXMAPCACHE_SIZE_MIN || pixmapCacheSize > PIXMAPCACHE_SIZE_MAX)
pixmapCacheSize = PIXMAPCACHE_SIZE_DEFAULT;
- }
networkCacheSize = settings->value("personal/networkCacheSize", NETWORK_CACHE_SIZE_DEFAULT).toInt();
redirectCacheTtl = settings->value("personal/redirectCacheTtl", NETWORK_REDIRECT_CACHE_TTL_DEFAULT).toInt();
- cardPictureLoaderCacheMethod =
- settings
- ->value("personal/cardPictureLoaderCacheMethod",
- static_cast(CardPictureLoaderCacheMethod::CacheMethod::NETWORK_CACHE))
- .toInt();
- localCardImageStorageNamingScheme =
- settings
- ->value("personal/localCardImageStorageNamingScheme",
- static_cast(CardPictureLoaderLocalSchemes::NamingScheme::Set_Folder_Name_Set_Collector))
- .toInt();
picDownload = settings->value("personal/picturedownload", true).toBool();
showStatusBar = settings->value("personal/showStatusBar", false).toBool();
@@ -309,11 +284,9 @@ SettingsCache::SettingsCache()
cardViewExpandedRowsMax = settings->value("interface/cardViewExpandedRowsMax", 20).toInt();
closeEmptyCardView = settings->value("interface/closeEmptyCardView", true).toBool();
focusCardViewSearchBar = settings->value("interface/focusCardViewSearchBar", true).toBool();
- keepGameChatFocus = settings->value("interface/keepGameChatFocus", false).toBool();
showDragSelectionCount = settings->value("interface/showlassoselectioncount", true).toBool();
showTotalSelectionCount = settings->value("interface/showpersistentselectioncount", true).toBool();
- showSubtypeSelectionTally = settings->value("interface/showsubtypeselectiontally", true).toBool();
showShortcuts = settings->value("menu/showshortcuts", true).toBool();
showGameSelectorFilterToolbar = settings->value("menu/showgameselectorfiltertoolbar", true).toBool();
@@ -372,7 +345,6 @@ SettingsCache::SettingsCache()
openDeckInNewTab = settings->value("editor/openDeckInNewTab", false).toBool();
rewindBufferingMs = settings->value("replay/rewindBufferingMs", 200).toInt();
- styleUserList = settings->value("appearance/styleUserList", true).toBool();
chatMention = settings->value("chat/mention", true).toBool();
chatMentionCompleter = settings->value("chat/mentioncompleter", true).toBool();
chatMentionForeground = settings->value("chat/mentionforeground", true).toBool();
@@ -391,7 +363,6 @@ SettingsCache::SettingsCache()
ignoreUnregisteredUsers = settings->value("chat/ignore_unregistered", false).toBool();
ignoreUnregisteredUserMessages = settings->value("chat/ignore_unregistered_messages", false).toBool();
- ignoreNonBuddyUserMessages = settings->value("chat/ignore_nonbuddy_messages", false).toBool();
scaleCards = settings->value("cards/scaleCards", true).toBool();
verticalCardOverlapPercent = settings->value("cards/verticalCardOverlapPercent", 33).toInt();
@@ -460,13 +431,6 @@ void SettingsCache::setFocusCardViewSearchBar(QT_STATE_CHANGED_T value)
settings->setValue("interface/focusCardViewSearchBar", focusCardViewSearchBar);
}
-void SettingsCache::setKeepGameChatFocus(QT_STATE_CHANGED_T value)
-{
- keepGameChatFocus = value;
- settings->setValue("interface/keepGameChatFocus", keepGameChatFocus);
- emit keepGameChatFocusChanged(keepGameChatFocus);
-}
-
void SettingsCache::setKnownMissingFeatures(const QString &_knownMissingFeatures)
{
knownMissingFeatures = _knownMissingFeatures;
@@ -806,9 +770,8 @@ void SettingsCache::setPrintingSelectorCardSize(int _printingSelectorCardSize)
void SettingsCache::setIncludeRebalancedCards(bool _includeRebalancedCards)
{
- if (includeRebalancedCards == _includeRebalancedCards) {
+ if (includeRebalancedCards == _includeRebalancedCards)
return;
- }
includeRebalancedCards = _includeRebalancedCards;
settings->setValue("cards/includerebalancedcards", includeRebalancedCards);
@@ -1047,13 +1010,6 @@ void SettingsCache::setRewindBufferingMs(int _rewindBufferingMs)
settings->setValue("replay/rewindBufferingMs", rewindBufferingMs);
}
-void SettingsCache::setStyleUserList(QT_STATE_CHANGED_T _styleUserList)
-{
- styleUserList = static_cast(_styleUserList);
- settings->setValue("appearance/styleUserList", styleUserList);
- emit styleUserListChanged();
-}
-
void SettingsCache::setChatMention(QT_STATE_CHANGED_T _chatMention)
{
chatMention = static_cast(_chatMention);
@@ -1135,12 +1091,6 @@ void SettingsCache::setIgnoreUnregisteredUserMessages(QT_STATE_CHANGED_T _ignore
settings->setValue("chat/ignore_unregistered_messages", ignoreUnregisteredUserMessages);
}
-void SettingsCache::setIgnoreNonBuddyUserMessages(QT_STATE_CHANGED_T _ignoreNonBuddyUserMessages)
-{
- ignoreNonBuddyUserMessages = static_cast(_ignoreNonBuddyUserMessages);
- settings->setValue("chat/ignore_nonbuddy_messages", ignoreNonBuddyUserMessages);
-}
-
void SettingsCache::setPixmapCacheSize(const int _pixmapCacheSize)
{
pixmapCacheSize = _pixmapCacheSize;
@@ -1148,13 +1098,6 @@ void SettingsCache::setPixmapCacheSize(const int _pixmapCacheSize)
emit pixmapCacheSizeChanged(pixmapCacheSize);
}
-void SettingsCache::setCardImageCacheMethod(const CardPictureLoaderCacheMethod::CacheMethod _cardImageCachingMethod)
-{
- cardPictureLoaderCacheMethod = static_cast(_cardImageCachingMethod);
- settings->setValue("personal/cardPictureLoaderCacheMethod", cardPictureLoaderCacheMethod);
- emit cardPictureLoaderCacheMethodChanged(cardPictureLoaderCacheMethod);
-}
-
void SettingsCache::setNetworkCacheSizeInMB(const int _networkCacheSize)
{
networkCacheSize = _networkCacheSize;
@@ -1169,14 +1112,6 @@ void SettingsCache::setNetworkRedirectCacheTtl(const int _redirectCacheTtl)
emit redirectCacheTtlChanged(redirectCacheTtl);
}
-void SettingsCache::setLocalCardImageStorageNamingScheme(
- const CardPictureLoaderLocalSchemes::NamingScheme _localCardImageStorageNamingScheme)
-{
- localCardImageStorageNamingScheme = static_cast(_localCardImageStorageNamingScheme);
- settings->setValue("personal/localCardImageStorageNamingScheme", localCardImageStorageNamingScheme);
- emit localCardImageStorageNamingSchemeChanged(localCardImageStorageNamingScheme);
-}
-
void SettingsCache::setClientID(const QString &_clientID)
{
clientID = _clientID;
@@ -1375,9 +1310,8 @@ void SettingsCache::setMaxFontSize(int _max)
void SettingsCache::setRoundCardCorners(bool _roundCardCorners)
{
- if (_roundCardCorners == roundCardCorners) {
+ if (_roundCardCorners == roundCardCorners)
return;
- }
roundCardCorners = _roundCardCorners;
settings->setValue("cards/roundcardcorners", _roundCardCorners);
@@ -1396,12 +1330,6 @@ void SettingsCache::setShowTotalSelectionCount(QT_STATE_CHANGED_T _showTotalSele
settings->setValue("interface/showpersistentselectioncount", showTotalSelectionCount);
}
-void SettingsCache::setShowSubtypeSelectionTally(QT_STATE_CHANGED_T _showSubtypeSelectionTally)
-{
- showSubtypeSelectionTally = static_cast(_showSubtypeSelectionTally);
- settings->setValue("interface/showsubtypeselectiontally", showSubtypeSelectionTally);
-}
-
void SettingsCache::loadPaths()
{
QString dataPath = getDataPath();
diff --git a/cockatrice/src/client/settings/cache_settings.h b/cockatrice/src/client/settings/cache_settings.h
index 29af89587..0cd5ceb68 100644
--- a/cockatrice/src/client/settings/cache_settings.h
+++ b/cockatrice/src/client/settings/cache_settings.h
@@ -1,14 +1,12 @@
/**
* @file cache_settings.h
* @ingroup Settings
+ * @brief TODO: Document this.
*/
-//! \todo Document this file.
#ifndef SETTINGSCACHE_H
#define SETTINGSCACHE_H
-#include "../../interface/card_picture_loader/card_picture_loader_cache_method.h"
-#include "../../interface/card_picture_loader/card_picture_loader_local_schemes.h"
#include "shortcuts_settings.h"
#include
@@ -183,20 +181,15 @@ signals:
void soundThemeChanged();
void ignoreUnregisteredUsersChanged();
void ignoreUnregisteredUserMessagesChanged();
- void ignoreNonBuddyUserMessagesChanged();
void pixmapCacheSizeChanged(int newSizeInMBs);
void networkCacheSizeChanged(int newSizeInMBs);
void redirectCacheTtlChanged(int newTtl);
- void cardPictureLoaderCacheMethodChanged(int cardPictureLoaderCacheMethod);
- void localCardImageStorageNamingSchemeChanged(int localCardImageStorageNamingScheme);
void masterVolumeChanged(int value);
- void styleUserListChanged();
void chatMentionCompleterChanged();
void downloadSpoilerTimeIndexChanged();
void downloadSpoilerStatusChanged();
void useTearOffMenusChanged(bool state);
void roundCardCornersChanged(bool roundCardCorners);
- void keepGameChatFocusChanged(bool value);
private:
QSettings *settings;
@@ -285,7 +278,6 @@ private:
bool autoRotateSidewaysLayoutCards;
bool openDeckInNewTab;
int rewindBufferingMs;
- bool styleUserList;
bool chatMention;
bool chatMentionCompleter;
QString chatMentionColor;
@@ -298,7 +290,6 @@ private:
QString soundThemeName;
bool ignoreUnregisteredUsers;
bool ignoreUnregisteredUserMessages;
- bool ignoreNonBuddyUserMessages;
QString picUrl;
QString picUrlFallback;
QString clientID;
@@ -309,12 +300,9 @@ private:
int cardViewExpandedRowsMax;
bool closeEmptyCardView;
bool focusCardViewSearchBar;
- bool keepGameChatFocus;
int pixmapCacheSize;
int networkCacheSize;
int redirectCacheTtl;
- int cardPictureLoaderCacheMethod;
- int localCardImageStorageNamingScheme;
bool scaleCards;
int verticalCardOverlapPercent;
bool showMessagePopups;
@@ -355,7 +343,6 @@ private:
bool showStatusBar;
bool showDragSelectionCount;
bool showTotalSelectionCount;
- bool showSubtypeSelectionTally;
public:
SettingsCache();
@@ -479,10 +466,6 @@ public:
{
return showTotalSelectionCount;
}
- [[nodiscard]] bool getShowSubtypeSelectionTally() const
- {
- return showSubtypeSelectionTally;
- }
[[nodiscard]] bool getNotificationsEnabled() const
{
return notificationsEnabled;
@@ -745,10 +728,6 @@ public:
{
return rewindBufferingMs;
}
- [[nodiscard]] bool getStyleUserList() const
- {
- return styleUserList;
- }
[[nodiscard]] bool getChatMention() const
{
return chatMention;
@@ -803,18 +782,10 @@ public:
{
return ignoreUnregisteredUserMessages;
}
- [[nodiscard]] bool getIgnoreNonBuddyUserMessages() const
- {
- return ignoreNonBuddyUserMessages;
- }
[[nodiscard]] int getPixmapCacheSize() const
{
return pixmapCacheSize;
}
- [[nodiscard]] CardPictureLoaderCacheMethod::CacheMethod getCardPictureLoaderCacheMethod() const
- {
- return static_cast(cardPictureLoaderCacheMethod);
- }
[[nodiscard]] int getNetworkCacheSizeInMB() const
{
return networkCacheSize;
@@ -823,10 +794,6 @@ public:
{
return redirectCacheTtl;
}
- [[nodiscard]] CardPictureLoaderLocalSchemes::NamingScheme getLocalCardImageStorageNamingScheme() const
- {
- return static_cast(localCardImageStorageNamingScheme);
- }
[[nodiscard]] bool getScaleCards() const
{
return scaleCards;
@@ -948,7 +915,6 @@ public:
void setCardViewExpandedRowsMax(int value);
void setCloseEmptyCardView(QT_STATE_CHANGED_T value);
void setFocusCardViewSearchBar(QT_STATE_CHANGED_T value);
- void setKeepGameChatFocus(QT_STATE_CHANGED_T value);
QString getClientID() override
{
return clientID;
@@ -981,10 +947,6 @@ public:
{
return focusCardViewSearchBar;
}
- [[nodiscard]] bool getKeepGameChatFocus() const
- {
- return keepGameChatFocus;
- }
[[nodiscard]] ShortcutsSettings &shortcuts() const
{
return *shortcutsSettings;
@@ -1124,7 +1086,6 @@ public slots:
void setAutoRotateSidewaysLayoutCards(QT_STATE_CHANGED_T _autoRotateSidewaysLayoutCards);
void setOpenDeckInNewTab(QT_STATE_CHANGED_T _openDeckInNewTab);
void setRewindBufferingMs(int _rewindBufferingMs);
- void setStyleUserList(QT_STATE_CHANGED_T _styleUserList);
void setChatMention(QT_STATE_CHANGED_T _chatMention);
void setChatMentionCompleter(QT_STATE_CHANGED_T _chatMentionCompleter);
void setChatMentionForeground(QT_STATE_CHANGED_T _chatMentionForeground);
@@ -1136,13 +1097,9 @@ public slots:
void setSoundThemeName(const QString &_soundThemeName);
void setIgnoreUnregisteredUsers(QT_STATE_CHANGED_T _ignoreUnregisteredUsers);
void setIgnoreUnregisteredUserMessages(QT_STATE_CHANGED_T _ignoreUnregisteredUserMessages);
- void setIgnoreNonBuddyUserMessages(QT_STATE_CHANGED_T _ignoreNonBuddyUserMessages);
void setPixmapCacheSize(const int _pixmapCacheSize);
- void setCardImageCacheMethod(CardPictureLoaderCacheMethod::CacheMethod _cardImageCachingMethod);
void setNetworkCacheSizeInMB(const int _networkCacheSize);
void setNetworkRedirectCacheTtl(const int _redirectCacheTtl);
- void setLocalCardImageStorageNamingScheme(
- const CardPictureLoaderLocalSchemes::NamingScheme _localCardImageStorageNamingScheme);
void setCardScaling(const QT_STATE_CHANGED_T _scaleCards);
void setStackCardOverlapPercent(const int _verticalCardOverlapPercent);
void setShowMessagePopups(const QT_STATE_CHANGED_T _showMessagePopups);
@@ -1181,6 +1138,5 @@ public slots:
void setRoundCardCorners(bool _roundCardCorners);
void setShowDragSelectionCount(QT_STATE_CHANGED_T _showDragSelectionCount);
void setShowTotalSelectionCount(QT_STATE_CHANGED_T _showTotalSelectionCount);
- void setShowSubtypeSelectionTally(QT_STATE_CHANGED_T _showSubtypeSelectionTally);
};
#endif
diff --git a/cockatrice/src/client/settings/card_counter_settings.cpp b/cockatrice/src/client/settings/card_counter_settings.cpp
index 662ae0c7d..399365c99 100644
--- a/cockatrice/src/client/settings/card_counter_settings.cpp
+++ b/cockatrice/src/client/settings/card_counter_settings.cpp
@@ -15,9 +15,8 @@ void CardCounterSettings::setColor(int counterId, const QColor &color)
QString key = QString("cards/counters/%1/color").arg(counterId);
- if (settings.value(key).value() == color) {
+ if (settings.value(key).value() == color)
return;
- }
settings.setValue(key, color);
emit colorChanged(counterId, color);
diff --git a/cockatrice/src/client/settings/card_counter_settings.h b/cockatrice/src/client/settings/card_counter_settings.h
index 2ac658177..b1d467d67 100644
--- a/cockatrice/src/client/settings/card_counter_settings.h
+++ b/cockatrice/src/client/settings/card_counter_settings.h
@@ -1,8 +1,8 @@
/**
* @file card_counter_settings.h
* @ingroup GameSettings
+ * @brief TODO: Document this.
*/
-//! \todo Document this file.
#ifndef CARD_COUNTER_SETTINGS_H
#define CARD_COUNTER_SETTINGS_H
diff --git a/cockatrice/src/client/settings/shortcut_treeview.h b/cockatrice/src/client/settings/shortcut_treeview.h
index afaf7e7ed..8d74a6f1e 100644
--- a/cockatrice/src/client/settings/shortcut_treeview.h
+++ b/cockatrice/src/client/settings/shortcut_treeview.h
@@ -1,8 +1,8 @@
/**
* @file shortcut_treeview.h
* @ingroup CoreSettings
+ * @brief TODO: Document this.
*/
-//! \todo Document this file.
#ifndef SHORTCUT_TREEVIEW_H
#define SHORTCUT_TREEVIEW_H
diff --git a/cockatrice/src/client/settings/shortcuts_settings.cpp b/cockatrice/src/client/settings/shortcuts_settings.cpp
index 2ff65ab6f..53c6f6a23 100644
--- a/cockatrice/src/client/settings/shortcuts_settings.cpp
+++ b/cockatrice/src/client/settings/shortcuts_settings.cpp
@@ -64,13 +64,8 @@ ShortcutsSettings::ShortcutsSettings(const QString &settingsPath, QObject *paren
}
}
-/**
- * @brief Migrates legacy shortcut key names to current naming scheme.
- *
- * PR 5079 changed Textbox/unfocusTextBox to Player/unfocusTextBox and
- * tab_game/aFocusChat to Player/aFocusChat. This migration allows players
- * to keep their already configured shortcuts.
- */
+/// PR 5079 changes Textbox/unfocusTextBox to Player/unfocusTextBox and tab_game/aFocusChat to Player/aFocusChat.
+/// A migration is necessary to let players keep their already configured shortcuts.
void ShortcutsSettings::migrateShortcuts()
{
if (QFile(settingsFilePath).exists()) {
@@ -241,7 +236,9 @@ bool ShortcutsSettings::isValid(const QString &name, const QString &sequences) c
return findOverlaps(name, sequences).isEmpty();
}
-/** @brief Checks if the shortcut is a shortcut that is active in all windows. */
+/**
+ * Checks if the shortcut is a shortcut that is active in all windows
+ */
static bool isAlwaysActiveShortcut(const QString &shortcutName)
{
return shortcutName.startsWith("MainWindow") || shortcutName.startsWith("Tabs");
diff --git a/cockatrice/src/client/settings/shortcuts_settings.h b/cockatrice/src/client/settings/shortcuts_settings.h
index 95155b8d1..d9ea494dc 100644
--- a/cockatrice/src/client/settings/shortcuts_settings.h
+++ b/cockatrice/src/client/settings/shortcuts_settings.h
@@ -1,8 +1,8 @@
/**
* @file shortcuts_settings.h
* @ingroup CoreSettings
+ * @brief TODO: Document this.
*/
-//! \todo Document this file.
#ifndef SHORTCUTSSETTINGS_H
#define SHORTCUTSSETTINGS_H
@@ -223,10 +223,6 @@ private:
{"TabDeckEditor/aLoadDeck", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Load Deck..."),
parseSequenceString("Ctrl+O"),
ShortcutGroup::Deck_Editor)},
- {"TabDeckEditor/aLoadDeckFromWebsite",
- ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Load deck from online service..."),
- parseSequenceString("Ctrl+Shift+O"),
- ShortcutGroup::Deck_Editor)},
{"TabDeckEditor/aLoadDeckFromClipboard",
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Load Deck from Clipboard..."),
parseSequenceString("Ctrl+Shift+V"),
@@ -287,10 +283,6 @@ private:
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Load Deck from Clipboard..."),
parseSequenceString("Ctrl+Shift+V"),
ShortcutGroup::Game_Lobby)},
- {"DeckViewContainer/loadFromWebsiteButton",
- ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Load from website..."),
- parseSequenceString("Ctrl+Shift+O"),
- ShortcutGroup::Game_Lobby)},
{"DeckViewContainer/unloadDeckButton", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Unload Deck"),
parseSequenceString("Ctrl+Alt+U"),
ShortcutGroup::Game_Lobby)},
@@ -545,9 +537,6 @@ private:
{"Player/aSetAnnotation", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Set Annotation..."),
parseSequenceString("Alt+N"),
ShortcutGroup::Playing_Area)},
- {"Player/aReduceLifeByPower", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Reduce Life by Power"),
- parseSequenceString("Ctrl+Shift+L"),
- ShortcutGroup::Playing_Area)},
{"Player/aSelectAll", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Select All Cards in Zone"),
parseSequenceString("Ctrl+A"),
ShortcutGroup::Playing_Area)},
diff --git a/cockatrice/src/client/sound_engine.cpp b/cockatrice/src/client/sound_engine.cpp
index e592b5ea0..31cb2a35e 100644
--- a/cockatrice/src/client/sound_engine.cpp
+++ b/cockatrice/src/client/sound_engine.cpp
@@ -105,9 +105,8 @@ QStringMap &SoundEngine::getAvailableThemes()
dir.setPath(SettingsCache::instance().getDataPath() + "/sounds");
for (const QString &themeName : dir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot, QDir::Name)) {
- if (!availableThemes.contains(themeName)) {
+ if (!availableThemes.contains(themeName))
availableThemes.insert(themeName, dir.absoluteFilePath(themeName));
- }
}
// load themes from cockatrice system dir
@@ -122,9 +121,8 @@ QStringMap &SoundEngine::getAvailableThemes()
);
for (const QString &themeName : dir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot, QDir::Name)) {
- if (!availableThemes.contains(themeName)) {
+ if (!availableThemes.contains(themeName))
availableThemes.insert(themeName, dir.absoluteFilePath(themeName));
- }
}
return availableThemes;
diff --git a/cockatrice/src/client/sound_engine.h b/cockatrice/src/client/sound_engine.h
index 0c201523a..f45cccf7d 100644
--- a/cockatrice/src/client/sound_engine.h
+++ b/cockatrice/src/client/sound_engine.h
@@ -1,8 +1,8 @@
/**
* @file sound_engine.h
* @ingroup Core
+ * @brief TODO: Document this.
*/
-//! \todo Document this file.
#ifndef SOUNDENGINE_H
#define SOUNDENGINE_H
diff --git a/cockatrice/src/filters/deck_filter_string.cpp b/cockatrice/src/filters/deck_filter_string.cpp
index dd873cfa5..6b671831d 100644
--- a/cockatrice/src/filters/deck_filter_string.cpp
+++ b/cockatrice/src/filters/deck_filter_string.cpp
@@ -88,27 +88,20 @@ static void setupParserRules()
const auto arg = std::any_cast(sv[1]);
const auto op = std::any_cast(sv[0]);
- if (op == ">") {
+ if (op == ">")
return [=](const int s) { return s > arg; };
- }
- if (op == ">=") {
+ if (op == ">=")
return [=](const int s) { return s >= arg; };
- }
- if (op == "<") {
+ if (op == "<")
return [=](const int s) { return s < arg; };
- }
- if (op == "<=") {
+ if (op == "<=")
return [=](const int s) { return s <= arg; };
- }
- if (op == "=") {
+ if (op == "=")
return [=](const int s) { return s == arg; };
- }
- if (op == ":") {
+ if (op == ":")
return [=](const int s) { return s == arg; };
- }
- if (op == "!=") {
+ if (op == "!=")
return [=](const int s) { return s != arg; };
- }
return [](int) { return false; };
};
diff --git a/cockatrice/src/filters/deck_filter_string.h b/cockatrice/src/filters/deck_filter_string.h
index 916b629ee..1b43d770d 100644
--- a/cockatrice/src/filters/deck_filter_string.h
+++ b/cockatrice/src/filters/deck_filter_string.h
@@ -1,8 +1,8 @@
/**
* @file deck_filter_string.h
* @ingroup DeckStorageWidgets
+ * @brief TODO: Document this.
*/
-//! \todo Document this file.
#ifndef DECK_FILTER_STRING_H
#define DECK_FILTER_STRING_H
diff --git a/cockatrice/src/filters/filter_builder.cpp b/cockatrice/src/filters/filter_builder.cpp
index 785f753e7..7178ce95a 100644
--- a/cockatrice/src/filters/filter_builder.cpp
+++ b/cockatrice/src/filters/filter_builder.cpp
@@ -11,15 +11,13 @@ FilterBuilder::FilterBuilder(QWidget *parent) : QWidget(parent)
{
filterCombo = new QComboBox;
filterCombo->setObjectName("filterCombo");
- for (int i = 0; i < CardFilter::AttrEnd; i++) {
+ for (int i = 0; i < CardFilter::AttrEnd; i++)
filterCombo->addItem(CardFilter::attrName(static_cast(i)), QVariant(i));
- }
typeCombo = new QComboBox;
typeCombo->setObjectName("typeCombo");
- for (int i = 0; i < CardFilter::TypeEnd; i++) {
+ for (int i = 0; i < CardFilter::TypeEnd; i++)
typeCombo->addItem(CardFilter::typeName(static_cast(i)), QVariant(i));
- }
QPushButton *ok = new QPushButton(QPixmap("theme:icons/increment"), QString());
ok->setObjectName("ok");
@@ -55,9 +53,8 @@ FilterBuilder::~FilterBuilder()
void FilterBuilder::destroyFilter()
{
- if (fltr) {
+ if (fltr)
delete fltr;
- }
}
static int comboCurrentIntData(const QComboBox *combo)
@@ -70,9 +67,8 @@ void FilterBuilder::emit_add()
QString txt;
txt = edit->text();
- if (txt.length() < 1) {
+ if (txt.length() < 1)
return;
- }
destroyFilter();
fltr = new CardFilter(txt, static_cast(comboCurrentIntData(typeCombo)),
diff --git a/cockatrice/src/filters/filter_builder.h b/cockatrice/src/filters/filter_builder.h
index 98fe3fd02..74872e3cd 100644
--- a/cockatrice/src/filters/filter_builder.h
+++ b/cockatrice/src/filters/filter_builder.h
@@ -1,8 +1,8 @@
/**
* @file filter_builder.h
* @ingroup CardDatabaseModelFilters
+ * @brief TODO: Document this.
*/
-//! \todo Document this file.
#ifndef FILTERBUILDER_H
#define FILTERBUILDER_H
diff --git a/cockatrice/src/filters/filter_tree_model.cpp b/cockatrice/src/filters/filter_tree_model.cpp
index 33b54530e..f0a02ec79 100644
--- a/cockatrice/src/filters/filter_tree_model.cpp
+++ b/cockatrice/src/filters/filter_tree_model.cpp
@@ -23,9 +23,8 @@ void FilterTreeModel::proxyBeginInsertRow(const FilterTreeNode *node, int i)
int idx;
idx = node->index();
- if (idx >= 0) {
+ if (idx >= 0)
beginInsertRows(createIndex(idx, 0, (void *)node), i, i);
- }
}
void FilterTreeModel::proxyEndInsertRow(const FilterTreeNode *node, int)
@@ -33,9 +32,8 @@ void FilterTreeModel::proxyEndInsertRow(const FilterTreeNode *node, int)
int idx;
idx = node->index();
- if (idx >= 0) {
+ if (idx >= 0)
endInsertRows();
- }
}
void FilterTreeModel::proxyBeginRemoveRow(const FilterTreeNode *node, int i)
@@ -43,9 +41,8 @@ void FilterTreeModel::proxyBeginRemoveRow(const FilterTreeNode *node, int i)
int idx;
idx = node->index();
- if (idx >= 0) {
+ if (idx >= 0)
beginRemoveRows(createIndex(idx, 0, (void *)node), i, i);
- }
}
void FilterTreeModel::proxyEndRemoveRow(const FilterTreeNode *node, int)
@@ -53,9 +50,8 @@ void FilterTreeModel::proxyEndRemoveRow(const FilterTreeNode *node, int)
int idx;
idx = node->index();
- if (idx >= 0) {
+ if (idx >= 0)
endRemoveRows();
- }
}
FilterTreeNode *FilterTreeModel::indexToNode(const QModelIndex &idx) const
@@ -63,14 +59,12 @@ FilterTreeNode *FilterTreeModel::indexToNode(const QModelIndex &idx) const
void *ip;
FilterTreeNode *node;
- if (!idx.isValid()) {
+ if (!idx.isValid())
return fTree;
- }
ip = idx.internalPointer();
- if (ip == NULL) {
+ if (ip == NULL)
return fTree;
- }
node = static_cast(ip);
return node;
@@ -151,16 +145,14 @@ int FilterTreeModel::rowCount(const QModelIndex &parent) const
const FilterTreeNode *node;
int result;
- if (parent.column() > 0) {
+ if (parent.column() > 0)
return 0;
- }
node = indexToNode(parent);
- if (node) {
+ if (node)
result = node->childCount();
- } else {
+ else
result = 0;
- }
return result;
}
@@ -174,17 +166,14 @@ QVariant FilterTreeModel::data(const QModelIndex &index, int role) const
{
const FilterTreeNode *node;
- if (!index.isValid()) {
+ if (!index.isValid())
return QVariant();
- }
- if (index.column() >= columnCount()) {
+ if (index.column() >= columnCount())
return QVariant();
- }
node = indexToNode(index);
- if (node == NULL) {
+ if (node == NULL)
return QVariant();
- }
switch (role) {
case Qt::FontRole:
@@ -201,11 +190,10 @@ QVariant FilterTreeModel::data(const QModelIndex &index, int role) const
case Qt::WhatsThisRole:
return node->text();
case Qt::CheckStateRole:
- if (node->isEnabled()) {
+ if (node->isEnabled())
return Qt::Checked;
- } else {
+ else
return Qt::Unchecked;
- }
default:
return QVariant();
}
@@ -217,27 +205,22 @@ bool FilterTreeModel::setData(const QModelIndex &index, const QVariant &value, i
{
FilterTreeNode *node;
- if (!index.isValid()) {
+ if (!index.isValid())
return false;
- }
- if (index.column() >= columnCount()) {
+ if (index.column() >= columnCount())
return false;
- }
- if (role != Qt::CheckStateRole) {
+ if (role != Qt::CheckStateRole)
return false;
- }
node = indexToNode(index);
- if (node == NULL || node == fTree) {
+ if (node == NULL || node == fTree)
return false;
- }
Qt::CheckState state = static_cast(value.toInt());
- if (state == Qt::Checked) {
+ if (state == Qt::Checked)
node->enable();
- } else {
+ else
node->disable();
- }
emit dataChanged(index, index);
return true;
@@ -248,19 +231,16 @@ Qt::ItemFlags FilterTreeModel::flags(const QModelIndex &index) const
const FilterTreeNode *node;
Qt::ItemFlags result;
- if (!index.isValid()) {
+ if (!index.isValid())
return Qt::NoItemFlags;
- }
node = indexToNode(index);
- if (node == NULL) {
+ if (node == NULL)
return Qt::NoItemFlags;
- }
result = Qt::ItemIsEnabled;
- if (node == fTree) {
+ if (node == fTree)
return result;
- }
result |= Qt::ItemIsSelectable;
result |= Qt::ItemIsUserCheckable;
@@ -272,9 +252,8 @@ QModelIndex FilterTreeModel::nodeIndex(const FilterTreeNode *node, int row, int
{
FilterTreeNode *child;
- if (column > 0 || row >= node->childCount()) {
+ if (column > 0 || row >= node->childCount())
return QModelIndex();
- }
child = node->nodeAt(row);
return createIndex(row, column, child);
@@ -284,14 +263,12 @@ QModelIndex FilterTreeModel::index(int row, int column, const QModelIndex &paren
{
const FilterTreeNode *node;
- if (!hasIndex(row, column, parent)) {
+ if (!hasIndex(row, column, parent))
return QModelIndex();
- }
node = indexToNode(parent);
- if (node == NULL) {
+ if (node == NULL)
return QModelIndex();
- }
return nodeIndex(node, row, column);
}
@@ -302,21 +279,18 @@ QModelIndex FilterTreeModel::parent(const QModelIndex &ind) const
FilterTreeNode *parent;
QModelIndex idx;
- if (!ind.isValid()) {
+ if (!ind.isValid())
return QModelIndex();
- }
node = indexToNode(ind);
- if (node == NULL || node == fTree) {
+ if (node == NULL || node == fTree)
return QModelIndex();
- }
parent = node->parent();
if (parent) {
int row = parent->index();
- if (row < 0) {
+ if (row < 0)
return QModelIndex();
- }
idx = createIndex(row, 0, parent);
return idx;
}
@@ -330,22 +304,18 @@ bool FilterTreeModel::removeRows(int row, int count, const QModelIndex &parent)
int i, last;
last = row + count - 1;
- if (!parent.isValid() || count < 1 || row < 0) {
+ if (!parent.isValid() || count < 1 || row < 0)
return false;
- }
node = indexToNode(parent);
- if (node == NULL || last >= node->childCount()) {
+ if (node == NULL || last >= node->childCount())
return false;
- }
- for (i = 0; i < count; i++) {
+ for (i = 0; i < count; i++)
node->deleteAt(row);
- }
- if (node != fTree && node->childCount() < 1) {
+ if (node != fTree && node->childCount() < 1)
return removeRow(parent.row(), parent.parent());
- }
return true;
}
diff --git a/cockatrice/src/filters/filter_tree_model.h b/cockatrice/src/filters/filter_tree_model.h
index 7452f7a61..c6666a838 100644
--- a/cockatrice/src/filters/filter_tree_model.h
+++ b/cockatrice/src/filters/filter_tree_model.h
@@ -1,8 +1,8 @@
/**
* @file filter_tree_model.h
* @ingroup CardDatabaseModelFilters
+ * @brief TODO: Document this.
*/
-//! \todo Document this file.
#ifndef FILTERTREEMODEL_H
#define FILTERTREEMODEL_H
diff --git a/cockatrice/src/filters/syntax_help.h b/cockatrice/src/filters/syntax_help.h
index d06fe03e5..7e5ef3e0e 100644
--- a/cockatrice/src/filters/syntax_help.h
+++ b/cockatrice/src/filters/syntax_help.h
@@ -2,8 +2,8 @@
* @file syntax_help.h
* @ingroup CardDatabaseModelFilters
* @ingroup DeckStorageWidgets
+ * @brief TODO: Document this.
*/
-//! \todo Document this file.
#ifndef SEARCH_SYNTAX_HELP_H
#define SEARCH_SYNTAX_HELP_H
diff --git a/cockatrice/src/game/abstract_game.cpp b/cockatrice/src/game/abstract_game.cpp
index c20003ece..9216f9174 100644
--- a/cockatrice/src/game/abstract_game.cpp
+++ b/cockatrice/src/game/abstract_game.cpp
@@ -1,9 +1,9 @@
#include "abstract_game.h"
#include "../interface/widgets/tabs/tab_game.h"
-#include "player/player_logic.h"
+#include "player/player.h"
-AbstractGame::AbstractGame(QObject *_parent) : QObject(_parent)
+AbstractGame::AbstractGame(TabGame *_tab) : QObject(_tab), tab(_tab)
{
gameMetaInfo = new GameMetaInfo(this);
gameEventHandler = new GameEventHandler(this);
@@ -24,11 +24,10 @@ AbstractClient *AbstractGame::getClientForPlayer(int playerId) const
}
return gameState->getClients().at(playerId);
- } else if (gameState->getClients().isEmpty()) {
+ } else if (gameState->getClients().isEmpty())
return nullptr;
- } else {
+ else
return gameState->getClients().first();
- }
}
void AbstractGame::loadReplay(GameReplay *replay)
@@ -44,15 +43,13 @@ void AbstractGame::setActiveCard(CardItem *card)
CardItem *AbstractGame::getCard(int playerId, const QString &zoneName, int cardId) const
{
- PlayerLogic *player = playerManager->getPlayer(playerId);
- if (!player) {
+ Player *player = playerManager->getPlayer(playerId);
+ if (!player)
return nullptr;
- }
CardZoneLogic *zone = player->getZones().value(zoneName, 0);
- if (!zone) {
+ if (!zone)
return nullptr;
- }
return zone->getCard(cardId);
}
\ No newline at end of file
diff --git a/cockatrice/src/game/abstract_game.h b/cockatrice/src/game/abstract_game.h
index 5115ed5ca..cb4dbac2a 100644
--- a/cockatrice/src/game/abstract_game.h
+++ b/cockatrice/src/game/abstract_game.h
@@ -1,8 +1,8 @@
/**
* @file abstract_game.h
* @ingroup GameLogic
+ * @brief TODO: Document this.
*/
-//! \todo Document this file.
#ifndef COCKATRICE_ABSTRACT_GAME_H
#define COCKATRICE_ABSTRACT_GAME_H
@@ -16,19 +16,26 @@
#include
class CardItem;
+class TabGame;
class AbstractGame : public QObject
{
Q_OBJECT
public:
- explicit AbstractGame(QObject *parent);
+ explicit AbstractGame(TabGame *tab);
+ TabGame *tab;
GameMetaInfo *gameMetaInfo;
GameState *gameState;
GameEventHandler *gameEventHandler;
PlayerManager *playerManager;
CardItem *activeCard;
+ TabGame *getTab() const
+ {
+ return tab;
+ }
+
GameMetaInfo *getGameMetaInfo()
{
return gameMetaInfo;
diff --git a/cockatrice/src/game/arrow_registry.cpp b/cockatrice/src/game/arrow_registry.cpp
deleted file mode 100644
index 286764b3b..000000000
--- a/cockatrice/src/game/arrow_registry.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-#include "arrow_registry.h"
-
-#include "../game_graphics/board/arrow_item.h"
-
-void ArrowRegistry::insert(QSharedPointer data, ArrowItem *arrow)
-{
- const ArrowKey key{data->creatorId, data->id};
-
- if (auto *existing = take(data->creatorId, data->id)) {
- existing->delArrow();
- }
-
- dataStore.insert(key, data);
- items.insert(key, arrow);
- byPlayer[data->creatorId].insert(data->id);
-}
-
-ArrowItem *ArrowRegistry::take(int creatorId, int arrowId)
-{
- const ArrowKey key{creatorId, arrowId};
- dataStore.remove(key);
- auto &playerSet = byPlayer[creatorId];
- playerSet.remove(arrowId);
- if (playerSet.isEmpty()) {
- byPlayer.remove(creatorId);
- }
- return items.take(key);
-}
-
-ArrowItem *ArrowRegistry::get(int creatorId, int arrowId) const
-{
- return items.value(ArrowKey{creatorId, arrowId}, nullptr);
-}
-
-bool ArrowRegistry::contains(int creatorId, int arrowId) const
-{
- return items.contains(ArrowKey{creatorId, arrowId});
-}
-
-QSet ArrowRegistry::idsForPlayer(int playerId) const
-{
- return byPlayer.value(playerId);
-}
-
-QList ArrowRegistry::all() const
-{
- return items.values();
-}
\ No newline at end of file
diff --git a/cockatrice/src/game/arrow_registry.h b/cockatrice/src/game/arrow_registry.h
deleted file mode 100644
index ef98229a2..000000000
--- a/cockatrice/src/game/arrow_registry.h
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifndef COCKATRICE_ARROW_REGISTRY_H
-#define COCKATRICE_ARROW_REGISTRY_H
-
-#include "board/arrow_data.h"
-
-#include
-#include
-#include
-
-class ArrowItem;
-
-struct ArrowKey
-{
- int creatorId;
- int arrowId;
-
- bool operator<(const ArrowKey &other) const
- {
- if (creatorId != other.creatorId) {
- return creatorId < other.creatorId;
- }
- return arrowId < other.arrowId;
- }
-};
-
-class ArrowRegistry
-{
-public:
- void insert(QSharedPointer data, ArrowItem *arrow);
- ArrowItem *take(int creatorId, int arrowId);
-
- [[nodiscard]] ArrowItem *get(int creatorId, int arrowId) const;
- [[nodiscard]] bool contains(int creatorId, int arrowId) const;
- [[nodiscard]] QSet idsForPlayer(int playerId) const;
- [[nodiscard]] QList all() const;
-
-private:
- QMap> dataStore;
- QMap items;
- QMap> byPlayer;
-};
-
-#endif
\ No newline at end of file
diff --git a/cockatrice/src/game_graphics/board/abstract_card_drag_item.cpp b/cockatrice/src/game/board/abstract_card_drag_item.cpp
similarity index 98%
rename from cockatrice/src/game_graphics/board/abstract_card_drag_item.cpp
rename to cockatrice/src/game/board/abstract_card_drag_item.cpp
index 026efd60d..8e3def4ca 100644
--- a/cockatrice/src/game_graphics/board/abstract_card_drag_item.cpp
+++ b/cockatrice/src/game/board/abstract_card_drag_item.cpp
@@ -25,12 +25,11 @@ AbstractCardDragItem::AbstractCardDragItem(AbstractCardItem *_item,
setCursor(Qt::ClosedHandCursor);
setZValue(ZValues::DRAG_ITEM);
}
- if (item->getTapped()) {
+ if (item->getTapped())
setTransform(QTransform()
.translate(CardDimensions::WIDTH_HALF_F, CardDimensions::HEIGHT_HALF_F)
.rotate(90)
.translate(-CardDimensions::WIDTH_HALF_F, -CardDimensions::HEIGHT_HALF_F));
- }
setCacheMode(DeviceCoordinateCache);
diff --git a/cockatrice/src/game_graphics/board/abstract_card_drag_item.h b/cockatrice/src/game/board/abstract_card_drag_item.h
similarity index 97%
rename from cockatrice/src/game_graphics/board/abstract_card_drag_item.h
rename to cockatrice/src/game/board/abstract_card_drag_item.h
index 1cbeb4fe7..fe3b87983 100644
--- a/cockatrice/src/game_graphics/board/abstract_card_drag_item.h
+++ b/cockatrice/src/game/board/abstract_card_drag_item.h
@@ -1,8 +1,8 @@
/**
* @file abstract_card_drag_item.h
* @ingroup GameGraphicsCards
+ * @brief TODO: Document this.
*/
-//! \todo Document this file.
#ifndef ABSTRACTCARDDRAGITEM_H
#define ABSTRACTCARDDRAGITEM_H
diff --git a/cockatrice/src/game_graphics/board/abstract_card_item.cpp b/cockatrice/src/game/board/abstract_card_item.cpp
similarity index 90%
rename from cockatrice/src/game_graphics/board/abstract_card_item.cpp
rename to cockatrice/src/game/board/abstract_card_item.cpp
index 86b3e27c8..9ec6ada9a 100644
--- a/cockatrice/src/game_graphics/board/abstract_card_item.cpp
+++ b/cockatrice/src/game/board/abstract_card_item.cpp
@@ -13,7 +13,7 @@
#include
#include
-AbstractCardItem::AbstractCardItem(QGraphicsItem *parent, const CardRef &cardRef, PlayerLogic *_owner, int _id)
+AbstractCardItem::AbstractCardItem(QGraphicsItem *parent, const CardRef &cardRef, Player *_owner, int _id)
: ArrowTarget(_owner, parent), id(_id), cardRef(cardRef), tapped(false), facedown(false), tapAngle(0),
bgColor(Qt::transparent), isHovered(false), realZValue(0)
{
@@ -85,12 +85,7 @@ const CardInfo &AbstractCardItem::getCardInfo() const
void AbstractCardItem::setRealZValue(qreal _zValue)
{
realZValue = _zValue;
- // During hover, zValue is overridden to HOVERED_CARD. Layout operations
- // like reorganizeCards() call setRealZValue() on all cards including the
- // hovered one — skip setZValue() here to avoid clobbering the override.
- if (!isHovered) {
- setZValue(_zValue);
- }
+ setZValue(_zValue);
}
QSizeF AbstractCardItem::getTranslatedSize(QPainter *painter) const
@@ -131,9 +126,8 @@ void AbstractCardItem::paintPicture(QPainter *painter, const QSizeF &translatedS
// don't even spend time trying to load the picture if our size is too small
if (translatedSize.width() > 10) {
CardPictureLoader::getPixmap(translatedPixmap, exactCard, translatedSize.toSize());
- if (translatedPixmap.isNull()) {
+ if (translatedPixmap.isNull())
paintImage = false;
- }
} else {
paintImage = false;
}
@@ -158,9 +152,9 @@ void AbstractCardItem::paintPicture(QPainter *painter, const QSizeF &translatedS
painter->setBackground(Qt::black);
painter->setBackgroundMode(Qt::OpaqueMode);
QString nameStr;
- if (facedown) {
+ if (facedown)
nameStr = "# " + QString::number(id);
- } else {
+ else {
QString prefix = "";
if (SettingsCache::instance().debug().getShowCardId()) {
prefix = "#" + QString::number(id) + " ";
@@ -187,12 +181,10 @@ void AbstractCardItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *
if (isSelected() || isHovered) {
QPen pen;
- if (isHovered) {
+ if (isHovered)
pen.setColor(Qt::yellow);
- }
- if (isSelected()) {
+ if (isSelected())
pen.setColor(Qt::red);
- }
pen.setWidth(0); // Cosmetic pen
painter->setPen(pen);
painter->drawPath(shape());
@@ -218,20 +210,11 @@ void AbstractCardItem::setCardRef(const CardRef &_cardRef)
void AbstractCardItem::setHovered(bool _hovered)
{
- if (isHovered == _hovered) {
+ if (isHovered == _hovered)
return;
- }
- if (_hovered) {
+ if (_hovered)
processHoverEvent();
- } else {
- // Mark the hovered card's current scene footprint dirty so overlapped
- // sibling zones (e.g. StackZone) repaint after the card moves away.
- if (scene()) {
- scene()->update(sceneBoundingRect());
- }
- }
-
isHovered = _hovered;
setZValue(_hovered ? ZValues::HOVERED_CARD : realZValue);
setScale(_hovered && SettingsCache::instance().getScaleCards() ? 1.1 : 1);
@@ -282,14 +265,13 @@ void AbstractCardItem::cacheBgColor()
void AbstractCardItem::setTapped(bool _tapped, bool canAnimate)
{
- if (tapped == _tapped) {
+ if (tapped == _tapped)
return;
- }
tapped = _tapped;
- if (SettingsCache::instance().getTapAnimation() && canAnimate) {
+ if (SettingsCache::instance().getTapAnimation() && canAnimate)
static_cast(scene())->registerAnimationItem(this);
- } else {
+ else {
tapAngle = tapped ? 90 : 0;
setTransform(QTransform()
.translate(CardDimensions::WIDTH_HALF_F, CardDimensions::HEIGHT_HALF_F)
@@ -315,19 +297,17 @@ void AbstractCardItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
scene()->clearSelection();
setSelected(true);
}
- if (event->button() == Qt::LeftButton) {
+ if (event->button() == Qt::LeftButton)
setCursor(Qt::ClosedHandCursor);
- } else if (event->button() == Qt::MiddleButton) {
+ else if (event->button() == Qt::MiddleButton)
emit showCardInfoPopup(event->screenPos(), cardRef);
- }
event->accept();
}
void AbstractCardItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
- if (event->button() == Qt::MiddleButton) {
+ if (event->button() == Qt::MiddleButton)
emit deleteCardInfoPopup(cardRef.name);
- }
// This function ensures the parent function doesn't mess around with our selection.
event->accept();
@@ -343,7 +323,6 @@ QVariant AbstractCardItem::itemChange(QGraphicsItem::GraphicsItemChange change,
if (change == ItemSelectedHasChanged) {
update();
return value;
- } else {
+ } else
return ArrowTarget::itemChange(change, value);
- }
}
diff --git a/cockatrice/src/game_graphics/board/abstract_card_item.h b/cockatrice/src/game/board/abstract_card_item.h
similarity index 83%
rename from cockatrice/src/game_graphics/board/abstract_card_item.h
rename to cockatrice/src/game/board/abstract_card_item.h
index bdb5f7cf1..7d2c29cae 100644
--- a/cockatrice/src/game_graphics/board/abstract_card_item.h
+++ b/cockatrice/src/game/board/abstract_card_item.h
@@ -1,20 +1,20 @@
/**
* @file abstract_card_item.h
* @ingroup GameGraphicsCards
- * @brief Base class for graphical card items, providing shared rendering, identity, and interaction logic.
+ * @brief TODO: Document this.
*/
#ifndef ABSTRACTCARDITEM_H
#define ABSTRACTCARDITEM_H
+#include "../../game_graphics/board/graphics_item_type.h"
#include "../card_dimensions.h"
#include "arrow_target.h"
-#include "graphics_item_type.h"
#include
#include
-class PlayerLogic;
+class Player;
class AbstractCardItem : public ArrowTarget
{
@@ -44,11 +44,6 @@ signals:
void deleteCardInfoPopup(QString cardName);
void sigPixmapUpdated();
void cardShiftClicked(QString cardName);
- void rightClicked(AbstractCardItem *card, QPoint screenPos);
- void playSelected(AbstractCardItem *card);
- void playSelectedFaceDown(AbstractCardItem *card);
- void hideSelected(AbstractCardItem *card);
- void selectionChanged(AbstractCardItem *card, bool selected);
public:
enum
@@ -61,7 +56,7 @@ public:
}
explicit AbstractCardItem(QGraphicsItem *parent = nullptr,
const CardRef &cardRef = {},
- PlayerLogic *_owner = nullptr,
+ Player *_owner = nullptr,
int _id = -1);
~AbstractCardItem() override;
QRectF boundingRect() const override;
@@ -101,10 +96,6 @@ public:
}
void setRealZValue(qreal _zValue);
void setHovered(bool _hovered);
- bool getIsHovered() const
- {
- return isHovered;
- }
QString getColor() const
{
return color;
diff --git a/cockatrice/src/game_graphics/board/abstract_counter.cpp b/cockatrice/src/game/board/abstract_counter.cpp
similarity index 55%
rename from cockatrice/src/game_graphics/board/abstract_counter.cpp
rename to cockatrice/src/game/board/abstract_counter.cpp
index 219dd456e..08d19ec8a 100644
--- a/cockatrice/src/game_graphics/board/abstract_counter.cpp
+++ b/cockatrice/src/game/board/abstract_counter.cpp
@@ -1,15 +1,14 @@
#include "abstract_counter.h"
#include "../../client/settings/cache_settings.h"
-#include "../../game/player/player_actions.h"
-#include "../../game/player/player_logic.h"
-#include "../../game_graphics/board/translate_counter_name.h"
#include "../../interface/widgets/tabs/tab_game.h"
+#include "../player/player.h"
+#include "../player/player_actions.h"
+#include "translate_counter_name.h"
#include
#include
#include
-#include
#include
#include
#include
@@ -17,24 +16,24 @@
#include
#include
-AbstractCounter::AbstractCounter(CounterState *state,
- PlayerLogic *_player,
+AbstractCounter::AbstractCounter(Player *_player,
+ int _id,
+ const QString &_name,
bool _shownInCounterArea,
+ int _value,
bool _useNameForShortcut,
QGraphicsItem *parent)
- : QGraphicsItem(parent), player(_player), id(state->getId()), name(state->getName()), value(state->getValue()),
- color(state->getColor()), radius(state->getRadius()), useNameForShortcut(_useNameForShortcut),
- shownInCounterArea(_shownInCounterArea)
+ : QGraphicsItem(parent), player(_player), id(_id), name(_name), value(_value),
+ useNameForShortcut(_useNameForShortcut), hovered(false), aDec(nullptr), aInc(nullptr), dialogSemaphore(false),
+ deleteAfterDialog(false), shownInCounterArea(_shownInCounterArea)
{
setAcceptHoverEvents(true);
- connect(state, &CounterState::valueChanged, this, [this](int, int newValue) {
- value = newValue;
- update();
- });
+ shortcutActive = false;
if (player->getPlayerInfo()->getLocalOrJudge()) {
- menu = new TearOffMenu(TranslateCounterName::getDisplayName(state->getName()));
+ QString displayName = TranslateCounterName::getDisplayName(_name);
+ menu = new TearOffMenu(displayName);
aSet = new QAction(this);
connect(aSet, &QAction::triggered, this, &AbstractCounter::setCounter);
menu->addAction(aSet);
@@ -42,18 +41,16 @@ AbstractCounter::AbstractCounter(CounterState *state,
for (int i = 10; i >= -10; --i) {
if (i == 0) {
menu->addSeparator();
- continue;
+ } else {
+ QAction *aIncrement = new QAction(QString(i < 0 ? "%1" : "+%1").arg(i), this);
+ if (i == -1)
+ aDec = aIncrement;
+ else if (i == 1)
+ aInc = aIncrement;
+ aIncrement->setData(i);
+ connect(aIncrement, &QAction::triggered, this, &AbstractCounter::incrementCounter);
+ menu->addAction(aIncrement);
}
- auto *a = new QAction(QString(i < 0 ? "%1" : "+%1").arg(i), this);
- if (i == -1) {
- aDec = a;
- }
- if (i == 1) {
- aInc = a;
- }
- a->setData(i);
- connect(a, &QAction::triggered, this, &AbstractCounter::incrementCounter);
- menu->addAction(a);
}
} else {
menu = nullptr;
@@ -72,35 +69,39 @@ AbstractCounter::~AbstractCounter()
void AbstractCounter::delCounter()
{
- if (dialogSemaphore) {
+ if (dialogSemaphore)
deleteAfterDialog = true;
- } else {
+ else
deleteLater();
- }
}
void AbstractCounter::retranslateUi()
{
- if (aSet) {
+ if (menu) {
aSet->setText(tr("&Set counter..."));
}
}
void AbstractCounter::setShortcutsActive()
{
- if (!menu || !player->getPlayerInfo()->getLocal()) {
+ if (!menu) {
return;
}
- ShortcutsSettings &sc = SettingsCache::instance().shortcuts();
- shortcutActive = true;
+ if (!player->getPlayerInfo()->getLocal()) {
+ return;
+ }
+
+ ShortcutsSettings &shortcuts = SettingsCache::instance().shortcuts();
if (name == "life") {
- aSet->setShortcuts(sc.getShortcut("Player/aSet"));
- aDec->setShortcuts(sc.getShortcut("Player/aDec"));
- aInc->setShortcuts(sc.getShortcut("Player/aInc"));
+ shortcutActive = true;
+ aSet->setShortcuts(shortcuts.getShortcut("Player/aSet"));
+ aDec->setShortcuts(shortcuts.getShortcut("Player/aDec"));
+ aInc->setShortcuts(shortcuts.getShortcut("Player/aInc"));
} else if (useNameForShortcut) {
- aSet->setShortcuts(sc.getShortcut("Player/aSetCounter_" + name));
- aDec->setShortcuts(sc.getShortcut("Player/aDecCounter_" + name));
- aInc->setShortcuts(sc.getShortcut("Player/aIncCounter_" + name));
+ shortcutActive = true;
+ aSet->setShortcuts(shortcuts.getShortcut("Player/aSetCounter_" + name));
+ aDec->setShortcuts(shortcuts.getShortcut("Player/aDecCounter_" + name));
+ aInc->setShortcuts(shortcuts.getShortcut("Player/aIncCounter_" + name));
}
}
@@ -125,32 +126,43 @@ void AbstractCounter::refreshShortcuts()
}
}
-void AbstractCounter::mousePressEvent(QGraphicsSceneMouseEvent *event)
+void AbstractCounter::setValue(int _value)
{
- if (!isUnderMouse() || !player->getPlayerInfo()->getLocalOrJudge()) {
- event->ignore();
- return;
- }
-
- if (event->button() == Qt::MiddleButton || QApplication::keyboardModifiers() & Qt::ShiftModifier) {
- if (menu) {
- menu->exec(event->screenPos());
- }
- } else {
- Command_IncCounter cmd;
- cmd.set_counter_id(id);
- cmd.set_delta(event->button() == Qt::LeftButton ? 1 : -1);
- player->getPlayerActions()->sendGameCommand(cmd);
- }
- event->accept();
+ value = _value;
+ update();
}
-void AbstractCounter::hoverEnterEvent(QGraphicsSceneHoverEvent *)
+void AbstractCounter::mousePressEvent(QGraphicsSceneMouseEvent *event)
+{
+ if (isUnderMouse() && player->getPlayerInfo()->getLocalOrJudge()) {
+ if (event->button() == Qt::MiddleButton || (QApplication::keyboardModifiers() & Qt::ShiftModifier)) {
+ if (menu)
+ menu->exec(event->screenPos());
+ event->accept();
+ } else if (event->button() == Qt::LeftButton) {
+ Command_IncCounter cmd;
+ cmd.set_counter_id(id);
+ cmd.set_delta(1);
+ player->getPlayerActions()->sendGameCommand(cmd);
+ event->accept();
+ } else if (event->button() == Qt::RightButton) {
+ Command_IncCounter cmd;
+ cmd.set_counter_id(id);
+ cmd.set_delta(-1);
+ player->getPlayerActions()->sendGameCommand(cmd);
+ event->accept();
+ }
+ } else
+ event->ignore();
+}
+
+void AbstractCounter::hoverEnterEvent(QGraphicsSceneHoverEvent * /*event*/)
{
hovered = true;
update();
}
-void AbstractCounter::hoverLeaveEvent(QGraphicsSceneHoverEvent *)
+
+void AbstractCounter::hoverLeaveEvent(QGraphicsSceneHoverEvent * /*event*/)
{
hovered = false;
update();
@@ -158,36 +170,34 @@ void AbstractCounter::hoverLeaveEvent(QGraphicsSceneHoverEvent *)
void AbstractCounter::incrementCounter()
{
+ const int delta = static_cast(sender())->data().toInt();
Command_IncCounter cmd;
cmd.set_counter_id(id);
- cmd.set_delta(static_cast(sender())->data().toInt());
+ cmd.set_delta(delta);
player->getPlayerActions()->sendGameCommand(cmd);
}
void AbstractCounter::setCounter()
{
- QWidget *parent = nullptr;
- if (auto *view = scene() ? scene()->views().value(0) : nullptr) {
- parent = view->window();
- }
-
dialogSemaphore = true;
- AbstractCounterDialog dlg(name, QString::number(value), parent);
- const int ok = dlg.exec();
- dialogSemaphore = false;
+ AbstractCounterDialog dialog(name, QString::number(value), player->getGame()->getTab());
+ const int ok = dialog.exec();
if (deleteAfterDialog) {
deleteLater();
return;
}
- if (!ok) {
+ dialogSemaphore = false;
+
+ if (!ok)
return;
- }
Expression exp(value);
+ int newValue = static_cast(exp.parse(dialog.textValue()));
+
Command_SetCounter cmd;
cmd.set_counter_id(id);
- cmd.set_value(static_cast(exp.parse(dlg.textValue())));
+ cmd.set_value(newValue);
player->getPlayerActions()->sendGameCommand(cmd);
}
@@ -221,9 +231,8 @@ void AbstractCounterDialog::changeValue(int diff)
{
bool ok;
int curValue = textValue().toInt(&ok);
- if (!ok) {
+ if (!ok)
return;
- }
curValue += diff;
setTextValue(QString::number(curValue));
}
diff --git a/cockatrice/src/game_graphics/board/abstract_counter.h b/cockatrice/src/game/board/abstract_counter.h
similarity index 70%
rename from cockatrice/src/game_graphics/board/abstract_counter.h
rename to cockatrice/src/game/board/abstract_counter.h
index b319a722d..074650d54 100644
--- a/cockatrice/src/game_graphics/board/abstract_counter.h
+++ b/cockatrice/src/game/board/abstract_counter.h
@@ -1,20 +1,19 @@
/**
* @file abstract_counter.h
* @ingroup GameGraphicsPlayers
+ * @brief TODO: Document this.
*/
-//! \todo Document this file.
#ifndef COUNTER_H
#define COUNTER_H
-#include "../../game/board/counter_state.h"
#include "../../interface/widgets/menus/tearoff_menu.h"
#include "../player/menu/abstract_player_component.h"
#include
#include
-class PlayerLogic;
+class Player;
class QAction;
class QKeyEvent;
class QMenu;
@@ -26,26 +25,22 @@ class AbstractCounter : public QObject, public QGraphicsItem, public AbstractPla
Q_INTERFACES(QGraphicsItem)
protected:
- PlayerLogic *player;
+ Player *player;
int id;
QString name;
int value;
- QColor color;
- int radius;
- bool hovered = false;
- bool useNameForShortcut;
+ bool useNameForShortcut, hovered;
void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override;
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override;
private:
- QAction *aSet = nullptr, *aDec = nullptr, *aInc = nullptr;
- TearOffMenu *menu = nullptr;
- bool dialogSemaphore = false;
- bool deleteAfterDialog = false;
+ QAction *aSet, *aDec, *aInc;
+ TearOffMenu *menu;
+ bool dialogSemaphore, deleteAfterDialog;
bool shownInCounterArea;
- bool shortcutActive = false;
+ bool shortcutActive;
private slots:
void refreshShortcuts();
@@ -53,14 +48,17 @@ private slots:
void setCounter();
public:
- AbstractCounter(CounterState *state,
- PlayerLogic *player,
- bool shownInCounterArea,
- bool useNameForShortcut = false,
+ AbstractCounter(Player *_player,
+ int _id,
+ const QString &_name,
+ bool _shownInCounterArea,
+ int _value,
+ bool _useNameForShortcut = false,
QGraphicsItem *parent = nullptr);
~AbstractCounter() override;
void retranslateUi() override;
+ void setValue(int _value);
void setShortcutsActive() override;
void setShortcutsInactive() override;
void delCounter();
@@ -69,6 +67,7 @@ public:
{
return menu;
}
+
int getId() const
{
return id;
@@ -77,22 +76,14 @@ public:
{
return name;
}
- QColor getColor() const
+ bool getShownInCounterArea() const
{
- return color;
- }
- int getRadius() const
- {
- return radius;
+ return shownInCounterArea;
}
int getValue() const
{
return value;
}
- bool getShownInCounterArea() const
- {
- return shownInCounterArea;
- }
};
class AbstractCounterDialog : public QInputDialog
diff --git a/cockatrice/src/game/board/arrow_data.cpp b/cockatrice/src/game/board/arrow_data.cpp
deleted file mode 100644
index 9e89deed0..000000000
--- a/cockatrice/src/game/board/arrow_data.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-#include "arrow_data.h"
-
-ArrowData ArrowData::fromProto(const ServerInfo_Arrow &arrow, int creatorId, bool isLocalCreator)
-{
- ArrowData data;
- data.creatorId = creatorId;
- data.isLocalCreator = isLocalCreator;
- data.id = arrow.id();
- data.startPlayerId = arrow.start_player_id();
- data.startZone = QString::fromStdString(arrow.start_zone());
- data.startCardId = arrow.start_card_id();
- data.targetPlayerId = arrow.target_player_id();
- data.color = convertColorToQColor(arrow.arrow_color());
-
- if (arrow.has_target_zone()) {
- data.targetZone = QString::fromStdString(arrow.target_zone());
- data.targetCardId = arrow.target_card_id();
- }
-
- return data;
-}
\ No newline at end of file
diff --git a/cockatrice/src/game/board/arrow_data.h b/cockatrice/src/game/board/arrow_data.h
deleted file mode 100644
index 2752f97e3..000000000
--- a/cockatrice/src/game/board/arrow_data.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef COCKATRICE_ARROW_DATA_H
-#define COCKATRICE_ARROW_DATA_H
-
-#include
-#include
-#include
-#include
-
-struct ArrowData
-{
- int creatorId = -1;
- bool isLocalCreator = false;
- int id = -1;
- int startPlayerId = -1;
- QString startZone = "";
- int startCardId = -1;
- int targetPlayerId = -1;
- QString targetZone = "";
- int targetCardId = -1;
- QColor color = "";
-
- static ArrowData fromProto(const ServerInfo_Arrow &arrow, int creatorId, bool isLocalCreator);
-
- bool isPlayerTargeted() const
- {
- return targetZone.isEmpty();
- }
-};
-
-#endif // COCKATRICE_ARROW_DATA_H
diff --git a/cockatrice/src/game_graphics/board/arrow_item.cpp b/cockatrice/src/game/board/arrow_item.cpp
similarity index 57%
rename from cockatrice/src/game_graphics/board/arrow_item.cpp
rename to cockatrice/src/game/board/arrow_item.cpp
index af6a6bf36..60585a774 100644
--- a/cockatrice/src/game_graphics/board/arrow_item.cpp
+++ b/cockatrice/src/game/board/arrow_item.cpp
@@ -2,8 +2,8 @@
#include "arrow_item.h"
#include "../../client/settings/cache_settings.h"
-#include "../../game/player/player_actions.h"
-#include "../../game/player/player_logic.h"
+#include "../player/player.h"
+#include "../player/player_actions.h"
#include "../player/player_target.h"
#include "../z_values.h"
#include "../zones/card_zone.h"
@@ -21,49 +21,46 @@
#include
#include
-ArrowItem::ArrowItem(QSharedPointer _data, ArrowTarget *_startItem, ArrowTarget *_targetItem)
- : data(std::move(_data)), startItem(_startItem), targetItem(_targetItem)
+ArrowItem::ArrowItem(Player *_player, int _id, ArrowTarget *_startItem, ArrowTarget *_targetItem, const QColor &_color)
+ : QGraphicsItem(), player(_player), id(_id), startItem(_startItem), targetItem(_targetItem), targetLocked(false),
+ color(_color), fullColor(true)
{
setZValue(ZValues::ARROWS);
- auto doUpdate = [this]() {
- if (startItem && targetItem) {
- updatePath();
- }
- };
+ if (startItem)
+ startItem->addArrowFrom(this);
+ if (targetItem)
+ targetItem->addArrowTo(this);
- if (startItem) {
- connect(startItem, &ArrowTarget::scenePositionChanged, this, doUpdate);
- connect(startItem, &QObject::destroyed, this, &ArrowItem::onTargetDestroyed);
- }
- if (targetItem) {
- connect(targetItem, &ArrowTarget::scenePositionChanged, this, doUpdate);
- connect(targetItem, &QObject::destroyed, this, &ArrowItem::onTargetDestroyed);
- }
-
- if (startItem && targetItem) {
+ if (startItem && targetItem)
updatePath();
- }
}
-void ArrowItem::onTargetDestroyed()
+ArrowItem::~ArrowItem()
{
- emit requestDeletion(data->creatorId, data->id);
}
void ArrowItem::delArrow()
{
+ if (startItem) {
+ startItem->removeArrowFrom(this);
+ startItem = 0;
+ }
+
if (targetItem) {
targetItem->setBeingPointedAt(false);
+ targetItem->removeArrowTo(this);
+ targetItem = 0;
}
+
+ player->removeArrow(this);
deleteLater();
}
void ArrowItem::updatePath()
{
- if (!targetItem) {
+ if (!targetItem)
return;
- }
QPointF endPoint = targetItem->mapToScene(
QPointF(targetItem->boundingRect().width() / 2, targetItem->boundingRect().height() / 2));
@@ -78,9 +75,8 @@ void ArrowItem::updatePath(const QPointF &endPoint)
headWidth / qPow(2, 0.5); // aka headWidth / sqrt (2) but this produces a compile error with MSVC++
const double phi = 15;
- if (!startItem) {
+ if (!startItem)
return;
- }
QPointF startPoint =
startItem->mapToScene(QPointF(startItem->boundingRect().width() / 2, startItem->boundingRect().height() / 2));
@@ -88,9 +84,9 @@ void ArrowItem::updatePath(const QPointF &endPoint)
qreal lineLength = line.length();
prepareGeometryChange();
- if (lineLength < 30) {
+ if (lineLength < 30)
path = QPainterPath();
- } else {
+ else {
QPointF c(lineLength / 2, qTan(phi * M_PI / 180) * lineLength);
QPainterPath centerLine;
@@ -126,24 +122,24 @@ void ArrowItem::updatePath(const QPointF &endPoint)
void ArrowItem::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/)
{
- QColor paintColor(data->color);
- if (fullColor) {
+ QColor paintColor(color);
+ if (fullColor)
paintColor.setAlpha(200);
- } else {
+ else
paintColor.setAlpha(150);
- }
painter->setBrush(paintColor);
painter->drawPath(path);
}
void ArrowItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
- if (!data->isLocalCreator) {
+ if (!player->getPlayerInfo()->getLocal()) {
event->ignore();
return;
}
- for (auto *item : scene()->items(event->scenePos())) {
+ QList colliding = scene()->items(event->scenePos());
+ for (QGraphicsItem *item : colliding) {
if (qgraphicsitem_cast(item)) {
event->ignore();
return;
@@ -152,109 +148,95 @@ void ArrowItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
event->accept();
if (event->button() == Qt::RightButton) {
- emit requestDeletion(data->creatorId, data->id);
+ Command_DeleteArrow cmd;
+ cmd.set_arrow_id(id);
+ player->getPlayerActions()->sendGameCommand(cmd);
}
}
-// ArrowDragItem
-
-ArrowDragItem::ArrowDragItem(PlayerLogic *_owner, ArrowTarget *_startItem, const QColor &_color, int _deleteInPhase)
- : ArrowItem(QSharedPointer::create(ArrowData{.creatorId = _owner->getPlayerInfo()->getId(),
- .isLocalCreator = true,
- .id = -1,
- .color = _color}),
- _startItem,
- nullptr),
- player(_owner), deleteInPhase(_deleteInPhase)
+ArrowDragItem::ArrowDragItem(Player *_owner, ArrowTarget *_startItem, const QColor &_color, int _deleteInPhase)
+ : ArrowItem(_owner, -1, _startItem, 0, _color), deleteInPhase(_deleteInPhase)
{
}
-void ArrowDragItem::addChildArrow(ArrowDragItem *child)
+void ArrowDragItem::addChildArrow(ArrowDragItem *childArrow)
{
- childArrows.append(child);
+ childArrows.append(childArrow);
}
void ArrowDragItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
- if (targetLocked || !startItem) {
+ // This ensures that if a mouse move event happens after a call to delArrow(),
+ // the event will be discarded as it would create some stray pointers.
+ if (targetLocked || !startItem)
return;
- }
- const QPointF endPos = event->scenePos();
+ QPointF endPos = event->scenePos();
- ArrowTarget *cursorItem = nullptr;
+ QList colliding = scene()->items(endPos);
+ ArrowTarget *cursorItem = 0;
qreal cursorItemZ = -1;
- for (auto *item : scene()->items(endPos)) {
- ArrowTarget *candidate = nullptr;
- if (auto *card = qgraphicsitem_cast(item)) {
- candidate = card;
- } else if (auto *pt = qgraphicsitem_cast(item)) {
- candidate = pt;
- }
-
- if (candidate && candidate->zValue() > cursorItemZ) {
- cursorItem = candidate;
- cursorItemZ = candidate->zValue();
+ for (int i = colliding.size() - 1; i >= 0; i--) {
+ if (qgraphicsitem_cast(colliding.at(i)) || qgraphicsitem_cast(colliding.at(i))) {
+ if (colliding.at(i)->zValue() > cursorItemZ) {
+ cursorItem = static_cast(colliding.at(i));
+ cursorItemZ = cursorItem->zValue();
+ }
}
}
- if (cursorItem != targetItem) {
- if (targetItem) {
- disconnect(positionConnection);
- targetItem->setBeingPointedAt(false);
- }
-
- targetItem = cursorItem;
- fullColor = (cursorItem != nullptr);
-
- if (cursorItem && cursorItem != startItem) {
- cursorItem->setBeingPointedAt(true);
- positionConnection =
- connect(cursorItem, &ArrowTarget::scenePositionChanged, this, [this]() { updatePath(); });
- }
+ if ((cursorItem != targetItem) && targetItem) {
+ targetItem->setBeingPointedAt(false);
+ targetItem->removeArrowTo(this);
+ }
+ if (!cursorItem) {
+ fullColor = false;
+ targetItem = 0;
+ updatePath(endPos);
+ } else {
+ if (cursorItem != targetItem) {
+ fullColor = true;
+ if (cursorItem != startItem) {
+ cursorItem->setBeingPointedAt(true);
+ cursorItem->addArrowTo(this);
+ }
+ targetItem = cursorItem;
+ }
+ updatePath();
}
-
- targetItem ? updatePath() : updatePath(endPos);
update();
- for (auto *child : childArrows) {
+ for (ArrowDragItem *child : childArrows) {
child->mouseMoveEvent(event);
}
}
void ArrowDragItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
- if (!startItem) {
+ if (!startItem)
return;
- }
- if (targetItem && targetItem != startItem) {
- CardItem *startCard = qgraphicsitem_cast(startItem);
+ if (targetItem && (targetItem != startItem)) {
+ CardZoneLogic *startZone = static_cast(startItem)->getZone();
// For now, we can safely assume that the start item is always a card.
// The target item can be a player as well.
- if (!startCard) {
- delArrow();
- return;
- }
-
- CardZoneLogic *startZone = startCard->getZone();
+ CardItem *startCard = qgraphicsitem_cast(startItem);
+ CardItem *targetCard = qgraphicsitem_cast(targetItem);
Command_CreateArrow cmd;
- cmd.mutable_arrow_color()->CopyFrom(convertQColorToColor(data->color));
+ cmd.mutable_arrow_color()->CopyFrom(convertQColorToColor(color));
cmd.set_start_player_id(startZone->getPlayer()->getPlayerInfo()->getId());
cmd.set_start_zone(startZone->getName().toStdString());
cmd.set_start_card_id(startCard->getId());
- if (auto *targetCard = qgraphicsitem_cast(targetItem)) {
+ if (targetCard) {
CardZoneLogic *targetZone = targetCard->getZone();
cmd.set_target_player_id(targetZone->getPlayer()->getPlayerInfo()->getId());
cmd.set_target_zone(targetZone->getName().toStdString());
cmd.set_target_card_id(targetCard->getId());
- } else if (auto *targetPlayer = qgraphicsitem_cast(targetItem)) {
+ } else { // failed to cast target to card, this means it's a player
+ PlayerTarget *targetPlayer = qgraphicsitem_cast(targetItem);
cmd.set_target_player_id(targetPlayer->getOwner()->getPlayerInfo()->getId());
- } else {
- delArrow();
- return;
}
// if the card is in hand then we will move the card to stack or table as part of drawing the arrow
@@ -264,11 +246,10 @@ void ArrowDragItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
bool playToStack = SettingsCache::instance().getPlayToStack();
if (ci && ((!playToStack && ci->getUiAttributes().tableRow == 3) ||
(playToStack && ci->getUiAttributes().tableRow != 0 &&
- startCard->getZone()->getName() != ZoneNames::STACK))) {
+ startCard->getZone()->getName() != ZoneNames::STACK)))
cmd.set_start_zone(ZoneNames::STACK);
- } else {
+ else
cmd.set_start_zone(playToStack ? ZoneNames::STACK : ZoneNames::TABLE);
- }
}
if (deleteInPhase != 0) {
@@ -277,116 +258,111 @@ void ArrowDragItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
player->getPlayerActions()->sendGameCommand(cmd);
}
-
delArrow();
- for (auto *child : childArrows) {
+
+ for (ArrowDragItem *child : childArrows) {
child->mouseReleaseEvent(event);
}
}
-// ArrowAttachItem
ArrowAttachItem::ArrowAttachItem(ArrowTarget *_startItem)
- : ArrowItem(
- QSharedPointer::create(ArrowData{.creatorId = _startItem->getOwner()->getPlayerInfo()->getId(),
- .isLocalCreator = true,
- .id = -1,
- .color = Qt::green}),
- _startItem,
- nullptr),
- player(_startItem->getOwner())
+ : ArrowItem(_startItem->getOwner(), -1, _startItem, 0, Qt::green)
{
}
-void ArrowAttachItem::addChildArrow(ArrowAttachItem *child)
+void ArrowAttachItem::addChildArrow(ArrowAttachItem *childArrow)
{
- childArrows.append(child);
+ childArrows.append(childArrow);
}
void ArrowAttachItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
- if (targetLocked || !startItem) {
+ if (targetLocked || !startItem)
return;
- }
- const QPointF endPos = event->scenePos();
+ QPointF endPos = event->scenePos();
- ArrowTarget *cursorItem = nullptr;
+ QList colliding = scene()->items(endPos);
+ ArrowTarget *cursorItem = 0;
qreal cursorItemZ = -1;
- for (auto *item : scene()->items(endPos)) {
- if (auto *card = qgraphicsitem_cast(item)) {
- if (card->zValue() > cursorItemZ) {
- cursorItem = card;
- cursorItemZ = card->zValue();
+ for (int i = colliding.size() - 1; i >= 0; i--) {
+ if (qgraphicsitem_cast(colliding.at(i))) {
+ if (colliding.at(i)->zValue() > cursorItemZ) {
+ cursorItem = static_cast(colliding.at(i));
+ cursorItemZ = cursorItem->zValue();
}
}
}
- if (cursorItem != targetItem) {
- if (targetItem) {
- disconnect(positionConnection);
- targetItem->setBeingPointedAt(false);
- }
-
- targetItem = cursorItem;
- fullColor = (cursorItem != nullptr);
-
- if (cursorItem && cursorItem != startItem) {
- cursorItem->setBeingPointedAt(true);
- positionConnection =
- connect(cursorItem, &ArrowTarget::scenePositionChanged, this, [this]() { updatePath(); });
- }
+ if ((cursorItem != targetItem) && targetItem) {
+ targetItem->setBeingPointedAt(false);
+ }
+ if (!cursorItem) {
+ fullColor = false;
+ targetItem = 0;
+ updatePath(endPos);
+ } else {
+ fullColor = true;
+ if (cursorItem != startItem) {
+ cursorItem->setBeingPointedAt(true);
+ }
+ targetItem = cursorItem;
+ updatePath();
}
-
- targetItem ? updatePath() : updatePath(endPos);
update();
- for (auto *child : childArrows) {
+ for (ArrowAttachItem *child : childArrows) {
child->mouseMoveEvent(event);
}
}
-void ArrowAttachItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
-{
- if (!startItem) {
- return;
- }
-
- // Attaching could move startItem under the current cursor position, causing all children to retarget to it right
- // before they are processed. Prevent that.
- for (auto *child : childArrows) {
- child->setTargetLocked(true);
- }
-
- if (targetItem && targetItem != startItem) {
- auto *startCard = qgraphicsitem_cast(startItem);
- auto *targetCard = qgraphicsitem_cast(targetItem);
- if (startCard && targetCard) {
- attachCards(startCard, targetCard);
- }
- }
-
- delArrow();
- for (auto *child : childArrows) {
- child->mouseReleaseEvent(event);
- }
-}
-
void ArrowAttachItem::attachCards(CardItem *startCard, const CardItem *targetCard)
{
+ // do nothing if target is already attached to another card or is not in play
if (targetCard->getAttachedTo() || targetCard->getZone()->getName() != ZoneNames::TABLE) {
return;
}
+ CardZoneLogic *startZone = startCard->getZone();
+ CardZoneLogic *targetZone = targetCard->getZone();
+
// move card onto table first if attaching from some other zone
- if (startCard->getZone()->getName() != ZoneNames::TABLE) {
+ if (startZone->getName() != ZoneNames::TABLE) {
player->getPlayerActions()->playCardToTable(startCard, false);
}
Command_AttachCard cmd;
cmd.set_start_zone(ZoneNames::TABLE);
cmd.set_card_id(startCard->getId());
- cmd.set_target_player_id(targetCard->getZone()->getPlayer()->getPlayerInfo()->getId());
- cmd.set_target_zone(targetCard->getZone()->getName().toStdString());
+ cmd.set_target_player_id(targetZone->getPlayer()->getPlayerInfo()->getId());
+ cmd.set_target_zone(targetZone->getName().toStdString());
cmd.set_target_card_id(targetCard->getId());
+
player->getPlayerActions()->sendGameCommand(cmd);
-}
\ No newline at end of file
+}
+
+void ArrowAttachItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
+{
+ if (!startItem)
+ return;
+
+ // Attaching could move startItem under the current cursor position, causing all children to retarget to it right
+ // before they are processed. Prevent that.
+ for (ArrowAttachItem *child : childArrows) {
+ child->setTargetLocked(true);
+ }
+
+ if (targetItem && (targetItem != startItem)) {
+ auto startCard = qgraphicsitem_cast(startItem);
+ auto targetCard = qgraphicsitem_cast(targetItem);
+ if (startCard && targetCard) {
+ attachCards(startCard, targetCard);
+ }
+ }
+
+ delArrow();
+
+ for (ArrowAttachItem *child : childArrows) {
+ child->mouseReleaseEvent(event);
+ }
+}
diff --git a/cockatrice/src/game_graphics/board/arrow_item.h b/cockatrice/src/game/board/arrow_item.h
similarity index 64%
rename from cockatrice/src/game_graphics/board/arrow_item.h
rename to cockatrice/src/game/board/arrow_item.h
index 1c306e065..cb78ee066 100644
--- a/cockatrice/src/game_graphics/board/arrow_item.h
+++ b/cockatrice/src/game/board/arrow_item.h
@@ -1,44 +1,40 @@
+/**
+ * @file arrow_item.h
+ * @ingroup GameGraphics
+ * @brief TODO: Document this.
+ */
+
#ifndef ARROWITEM_H
#define ARROWITEM_H
-#include "../../game/board/arrow_data.h"
-#include "arrow_target.h"
-
#include
-#include
-#include
class CardItem;
class QGraphicsSceneMouseEvent;
-class PlayerLogic;
+class QMenu;
+class Player;
+class ArrowTarget;
class ArrowItem : public QObject, public QGraphicsItem
{
Q_OBJECT
Q_INTERFACES(QGraphicsItem)
-signals:
- void requestDeletion(int creatorId, int id);
-
private:
QPainterPath path;
+ QMenu *menu;
protected:
- QSharedPointer data;
- QPointer startItem;
- QPointer targetItem;
- bool targetLocked = false;
- bool fullColor = true;
-
+ Player *player;
+ int id;
+ ArrowTarget *startItem, *targetItem;
+ bool targetLocked;
+ QColor color;
+ bool fullColor;
void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
public:
- ArrowItem(QSharedPointer _data, ArrowTarget *_startItem, ArrowTarget *_targetItem);
-
- void onTargetDestroyed();
- void delArrow();
- void updatePath();
- void updatePath(const QPointF &endPoint);
-
+ ArrowItem(Player *_player, int _id, ArrowTarget *_startItem, ArrowTarget *_targetItem, const QColor &color);
+ ~ArrowItem() override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
[[nodiscard]] QRectF boundingRect() const override
{
@@ -48,13 +44,24 @@ public:
{
return path;
}
+ void updatePath();
+ void updatePath(const QPointF &endPoint);
+
[[nodiscard]] int getId() const
{
- return data->id;
+ return id;
}
- [[nodiscard]] int getCreatorId() const
+ [[nodiscard]] Player *getPlayer() const
{
- return data->creatorId;
+ return player;
+ }
+ void setStartItem(ArrowTarget *_item)
+ {
+ startItem = _item;
+ }
+ void setTargetItem(ArrowTarget *_item)
+ {
+ targetItem = _item;
}
[[nodiscard]] ArrowTarget *getStartItem() const
{
@@ -68,20 +75,19 @@ public:
{
targetLocked = _targetLocked;
}
+ void delArrow();
};
class ArrowDragItem : public ArrowItem
{
Q_OBJECT
private:
- PlayerLogic *player;
int deleteInPhase;
QList childArrows;
- QMetaObject::Connection positionConnection;
public:
- ArrowDragItem(PlayerLogic *_owner, ArrowTarget *_startItem, const QColor &_color, int _deleteInPhase);
- void addChildArrow(ArrowDragItem *child);
+ ArrowDragItem(Player *_owner, ArrowTarget *_startItem, const QColor &_color, int _deleteInPhase);
+ void addChildArrow(ArrowDragItem *childArrow);
protected:
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
@@ -92,18 +98,17 @@ class ArrowAttachItem : public ArrowItem
{
Q_OBJECT
private:
- PlayerLogic *player;
QList childArrows;
- QMetaObject::Connection positionConnection;
+
void attachCards(CardItem *startCard, const CardItem *targetCard);
public:
explicit ArrowAttachItem(ArrowTarget *_startItem);
- void addChildArrow(ArrowAttachItem *child);
+ void addChildArrow(ArrowAttachItem *childArrow);
protected:
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
};
-#endif
\ No newline at end of file
+#endif // ARROWITEM_H
diff --git a/cockatrice/src/game/board/arrow_target.cpp b/cockatrice/src/game/board/arrow_target.cpp
new file mode 100644
index 000000000..2dbd913fa
--- /dev/null
+++ b/cockatrice/src/game/board/arrow_target.cpp
@@ -0,0 +1,41 @@
+#include "arrow_target.h"
+
+#include "../player/player.h"
+#include "arrow_item.h"
+
+ArrowTarget::ArrowTarget(Player *_owner, QGraphicsItem *parent)
+ : AbstractGraphicsItem(parent), owner(_owner), beingPointedAt(false)
+{
+ setFlag(ItemSendsScenePositionChanges);
+}
+
+ArrowTarget::~ArrowTarget()
+{
+ for (int i = 0; i < arrowsFrom.size(); ++i) {
+ arrowsFrom[i]->setStartItem(0);
+ arrowsFrom[i]->delArrow();
+ }
+ for (int i = 0; i < arrowsTo.size(); ++i) {
+ arrowsTo[i]->setTargetItem(0);
+ arrowsTo[i]->delArrow();
+ }
+}
+
+void ArrowTarget::setBeingPointedAt(bool _beingPointedAt)
+{
+ beingPointedAt = _beingPointedAt;
+ update();
+}
+
+QVariant ArrowTarget::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
+{
+ if (change == ItemScenePositionHasChanged && scene()) {
+ for (auto *arrow : arrowsFrom)
+ arrow->updatePath();
+
+ for (auto *arrow : arrowsTo)
+ arrow->updatePath();
+ }
+
+ return QGraphicsItem::itemChange(change, value);
+}
diff --git a/cockatrice/src/game/board/arrow_target.h b/cockatrice/src/game/board/arrow_target.h
new file mode 100644
index 000000000..55f4ef678
--- /dev/null
+++ b/cockatrice/src/game/board/arrow_target.h
@@ -0,0 +1,70 @@
+/**
+ * @file arrow_target.h
+ * @ingroup GameGraphics
+ * @brief TODO: Document this.
+ */
+
+#ifndef ARROWTARGET_H
+#define ARROWTARGET_H
+
+#include "../../game_graphics/board/abstract_graphics_item.h"
+
+#include
+
+class Player;
+class ArrowItem;
+
+class ArrowTarget : public AbstractGraphicsItem
+{
+ Q_OBJECT
+protected:
+ Player *owner;
+
+private:
+ bool beingPointedAt;
+ QList arrowsFrom, arrowsTo;
+
+public:
+ explicit ArrowTarget(Player *_owner, QGraphicsItem *parent = nullptr);
+ ~ArrowTarget() override;
+
+ [[nodiscard]] Player *getOwner() const
+ {
+ return owner;
+ }
+
+ void setBeingPointedAt(bool _beingPointedAt);
+ [[nodiscard]] bool getBeingPointedAt() const
+ {
+ return beingPointedAt;
+ }
+
+ [[nodiscard]] const QList &getArrowsFrom() const
+ {
+ return arrowsFrom;
+ }
+ void addArrowFrom(ArrowItem *arrow)
+ {
+ arrowsFrom.append(arrow);
+ }
+ void removeArrowFrom(ArrowItem *arrow)
+ {
+ arrowsFrom.removeOne(arrow);
+ }
+ [[nodiscard]] const QList &getArrowsTo() const
+ {
+ return arrowsTo;
+ }
+ void addArrowTo(ArrowItem *arrow)
+ {
+ arrowsTo.append(arrow);
+ }
+ void removeArrowTo(ArrowItem *arrow)
+ {
+ arrowsTo.removeOne(arrow);
+ }
+
+protected:
+ QVariant itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) override;
+};
+#endif
diff --git a/cockatrice/src/game_graphics/board/card_drag_item.cpp b/cockatrice/src/game/board/card_drag_item.cpp
similarity index 90%
rename from cockatrice/src/game_graphics/board/card_drag_item.cpp
rename to cockatrice/src/game/board/card_drag_item.cpp
index 49467c5c9..5ae56ccba 100644
--- a/cockatrice/src/game_graphics/board/card_drag_item.cpp
+++ b/cockatrice/src/game/board/card_drag_item.cpp
@@ -24,9 +24,8 @@ void CardDragItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
{
AbstractCardDragItem::paint(painter, option, widget);
- if (occupied) {
+ if (occupied)
painter->fillPath(shape(), QColor(200, 0, 0, 100));
- }
}
void CardDragItem::updatePosition(const QPointF &cursorScenePos)
@@ -39,19 +38,16 @@ void CardDragItem::updatePosition(const QPointF &cursorScenePos)
ZoneViewZone *zoneViewZone = 0;
for (int i = colliding.size() - 1; i >= 0; i--) {
CardZone *temp = qgraphicsitem_cast(colliding.at(i));
- if (!cardZone) {
+ if (!cardZone)
cardZone = temp;
- }
- if (!zoneViewZone) {
+ if (!zoneViewZone)
zoneViewZone = qobject_cast(temp);
- }
}
CardZone *cursorZone = 0;
- if (zoneViewZone) {
+ if (zoneViewZone)
cursorZone = zoneViewZone;
- } else if (cardZone) {
+ else if (cardZone)
cursorZone = cardZone;
- }
// Always update the current zone, even if its null, to cancel the drag
// instead of dropping cards into an non-intuitive location.
@@ -63,9 +59,8 @@ void CardDragItem::updatePosition(const QPointF &cursorScenePos)
QPointF newPos = cursorScenePos - hotSpot;
if (newPos != pos()) {
- for (int i = 0; i < childDrags.size(); i++) {
+ for (int i = 0; i < childDrags.size(); i++)
childDrags[i]->setPos(newPos + childDrags[i]->getHotSpot());
- }
setPos(newPos);
}
@@ -83,27 +78,23 @@ void CardDragItem::updatePosition(const QPointF &cursorScenePos)
// position.
TableZone *tableZone = qobject_cast(cursorZone);
QPointF closestGridPoint;
- if (tableZone) {
+ if (tableZone)
closestGridPoint = tableZone->closestGridPoint(cursorPosInZone);
- } else {
+ else
closestGridPoint = cursorPosInZone - hotSpot;
- }
QPointF newPos = zonePos + closestGridPoint;
if (newPos != pos()) {
- for (int i = 0; i < childDrags.size(); i++) {
+ for (int i = 0; i < childDrags.size(); i++)
childDrags[i]->setPos(newPos + childDrags[i]->getHotSpot());
- }
setPos(newPos);
bool newOccupied = false;
TableZone *table = qobject_cast(cursorZone);
- if (table) {
- if (table->getCardFromCoords(closestGridPoint)) {
+ if (table)
+ if (table->getCardFromCoords(closestGridPoint))
newOccupied = true;
- }
- }
if (newOccupied != occupied) {
occupied = newOccupied;
update();
diff --git a/cockatrice/src/game_graphics/board/card_drag_item.h b/cockatrice/src/game/board/card_drag_item.h
similarity index 96%
rename from cockatrice/src/game_graphics/board/card_drag_item.h
rename to cockatrice/src/game/board/card_drag_item.h
index 74d25ad04..930c6be6f 100644
--- a/cockatrice/src/game_graphics/board/card_drag_item.h
+++ b/cockatrice/src/game/board/card_drag_item.h
@@ -1,8 +1,8 @@
/**
* @file card_drag_item.h
* @ingroup GameGraphicsCards
+ * @brief TODO: Document this.
*/
-//! \todo Document this file.
#ifndef CARDDRAGITEM_H
#define CARDDRAGITEM_H
diff --git a/cockatrice/src/game_graphics/board/card_item.cpp b/cockatrice/src/game/board/card_item.cpp
similarity index 68%
rename from cockatrice/src/game_graphics/board/card_item.cpp
rename to cockatrice/src/game/board/card_item.cpp
index cabe988c2..62de4a02e 100644
--- a/cockatrice/src/game_graphics/board/card_item.cpp
+++ b/cockatrice/src/game/board/card_item.cpp
@@ -1,12 +1,12 @@
#include "card_item.h"
#include "../../client/settings/cache_settings.h"
-#include "../../game/phase.h"
-#include "../../game/player/player_actions.h"
-#include "../../game/player/player_logic.h"
-#include "../../game/zones/view_zone_logic.h"
#include "../../interface/widgets/tabs/tab_game.h"
#include "../game_scene.h"
+#include "../phase.h"
+#include "../player/player.h"
+#include "../player/player_actions.h"
+#include "../zones/logic/view_zone_logic.h"
#include "../zones/table_zone.h"
#include "../zones/view_zone.h"
#include "arrow_item.h"
@@ -20,19 +20,15 @@
#include
#include
-CardItem::CardItem(PlayerLogic *_owner,
- QGraphicsItem *parent,
- const CardRef &cardRef,
- int _cardid,
- CardZoneLogic *_zone)
- : AbstractCardItem(parent, cardRef, _owner, _cardid), state(new CardState(this, _zone)), dragItem(nullptr)
+CardItem::CardItem(Player *_owner, QGraphicsItem *parent, const CardRef &cardRef, int _cardid, CardZoneLogic *_zone)
+ : AbstractCardItem(parent, cardRef, _owner, _cardid), zone(_zone), attacking(false), destroyOnZoneChange(false),
+ doesntUntap(false), dragItem(nullptr), attachedTo(nullptr)
{
owner->addCard(this);
connect(&SettingsCache::instance().cardCounters(), &CardCounterSettings::colorChanged, this, [this](int counterId) {
- if (state->getCounters().contains(counterId)) {
+ if (counters.contains(counterId))
update();
- }
});
}
@@ -40,7 +36,7 @@ void CardItem::prepareDelete()
{
if (owner != nullptr) {
if (owner->getGame()->getActiveCard() == this) {
- emit owner->requestCardMenuUpdate(nullptr);
+ owner->getPlayerMenu()->updateCardMenu(nullptr);
owner->getGame()->setActiveCard(nullptr);
}
owner = nullptr;
@@ -51,24 +47,23 @@ void CardItem::prepareDelete()
attachedCards.first()->setAttachedTo(nullptr);
}
- if (state->getAttachedTo() != nullptr) {
- state->getAttachedTo()->removeAttachedCard(this);
- state->setAttachedTo(nullptr);
+ if (attachedTo != nullptr) {
+ attachedTo->removeAttachedCard(this);
+ attachedTo = nullptr;
}
}
void CardItem::deleteLater()
{
prepareDelete();
- if (scene()) {
+ if (scene())
static_cast(scene())->unregisterAnimationItem(this);
- }
AbstractCardItem::deleteLater();
}
void CardItem::setZone(CardZoneLogic *_zone)
{
- state->setZone(_zone);
+ zone = _zone;
}
void CardItem::retranslateUi()
@@ -83,23 +78,23 @@ void CardItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
AbstractCardItem::paint(painter, option, widget);
int i = 0;
- QMapIterator counterIterator(state->getCounters());
+ QMapIterator counterIterator(counters);
while (counterIterator.hasNext()) {
counterIterator.next();
QColor _color = cardCounterSettings.color(counterIterator.key());
- paintNumberEllipse(counterIterator.value(), 14, _color, i, state->getCounters().size(), painter);
+ paintNumberEllipse(counterIterator.value(), 14, _color, i, counters.size(), painter);
++i;
}
QSizeF translatedSize = getTranslatedSize(painter);
qreal scaleFactor = translatedSize.width() / boundingRect().width();
- if (!state->getPT().isEmpty()) {
+ if (!pt.isEmpty()) {
painter->save();
transformPainter(painter, translatedSize, tapAngle);
- if (!getFaceDown() && state->getPT() == exactCard.getInfo().getPowTough()) {
+ if (!getFaceDown() && pt == exactCard.getInfo().getPowTough()) {
painter->setPen(Qt::white);
} else {
painter->setPen(QColor(255, 150, 0)); // dark orange
@@ -110,11 +105,11 @@ void CardItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
painter->drawText(QRectF(4 * scaleFactor, 4 * scaleFactor, translatedSize.width() - 10 * scaleFactor,
translatedSize.height() - 8 * scaleFactor),
- Qt::AlignRight | Qt::AlignBottom, state->getPT());
+ Qt::AlignRight | Qt::AlignBottom, pt);
painter->restore();
}
- if (!state->getAnnotation().isEmpty()) {
+ if (!annotation.isEmpty()) {
painter->save();
transformPainter(painter, translatedSize, tapAngle);
@@ -124,7 +119,7 @@ void CardItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
painter->drawText(QRectF(4 * scaleFactor, 4 * scaleFactor, translatedSize.width() - 8 * scaleFactor,
translatedSize.height() - 8 * scaleFactor),
- Qt::AlignCenter | Qt::TextWrapAnywhere, state->getAnnotation());
+ Qt::AlignCenter | Qt::TextWrapAnywhere, annotation);
painter->restore();
}
@@ -132,7 +127,7 @@ void CardItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
painter->fillPath(shape(), QBrush(QColor(255, 0, 0, 100)));
}
- if (state->getDoesntUntap()) {
+ if (doesntUntap) {
painter->save();
painter->setRenderHint(QPainter::Antialiasing, false);
@@ -151,66 +146,69 @@ void CardItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
void CardItem::setAttacking(bool _attacking)
{
- state->setAttacking(_attacking);
+ attacking = _attacking;
update();
}
void CardItem::setCounter(int _id, int _value)
{
- state->setCounter(_id, _value);
+ if (_value)
+ counters.insert(_id, _value);
+ else
+ counters.remove(_id);
update();
}
void CardItem::setAnnotation(const QString &_annotation)
{
- state->setAnnotation(_annotation);
+ annotation = _annotation;
update();
}
void CardItem::setDoesntUntap(bool _doesntUntap)
{
- state->setDoesntUntap(_doesntUntap);
+ doesntUntap = _doesntUntap;
update();
}
void CardItem::setPT(const QString &_pt)
{
- state->setPT(_pt);
+ pt = _pt;
update();
}
void CardItem::setAttachedTo(CardItem *_attachedTo)
{
- if (state->getAttachedTo() != nullptr) {
- state->getAttachedTo()->removeAttachedCard(this);
+ if (attachedTo != nullptr) {
+ attachedTo->removeAttachedCard(this);
}
gridPoint.setX(-1);
- state->setAttachedTo(_attachedTo);
- if (state->getAttachedTo() != nullptr) {
+ attachedTo = _attachedTo;
+ if (attachedTo != nullptr) {
// If the zone is being torn down, it might already be null by the time a card tries to un-attach all its
// attached cards
- if (state->getAttachedTo()->getZone() == nullptr) {
+ if (attachedTo->zone == nullptr) {
deleteLater();
} else {
- emit state->getAttachedTo()->getZone()->cardAdded(this);
- state->getAttachedTo()->addAttachedCard(this);
- if (state->getZone() != state->getAttachedTo()->getZone()) {
- state->getAttachedTo()->getZone()->reorganizeCards();
+ emit attachedTo->zone->cardAdded(this);
+ attachedTo->addAttachedCard(this);
+ if (zone != attachedTo->getZone()) {
+ attachedTo->getZone()->reorganizeCards();
}
}
} else {
// If the zone is being torn down, it might already be null by the time a card tries to un-attach all its
// attached cards
- if (state->getZone() == nullptr) {
+ if (zone == nullptr) {
deleteLater();
} else {
- emit state->getZone()->cardAdded(this);
+ emit zone->cardAdded(this);
}
}
- if (state->getZone() != nullptr) {
- state->getZone()->reorganizeCards();
+ if (zone != nullptr) {
+ zone->reorganizeCards();
}
}
@@ -219,23 +217,28 @@ void CardItem::setAttachedTo(CardItem *_attachedTo)
*/
void CardItem::resetState(bool keepAnnotations)
{
- state->resetState(keepAnnotations);
+ attacking = false;
+ counters.clear();
+ pt.clear();
+ if (!keepAnnotations) {
+ annotation.clear();
+ }
+ attachedTo = 0;
attachedCards.clear();
setTapped(false, false);
setDoesntUntap(false);
- if (scene()) {
+ if (scene())
static_cast(scene())->unregisterAnimationItem(this);
- }
update();
}
void CardItem::processCardInfo(const ServerInfo_Card &_info)
{
- state->clearCounters();
+ counters.clear();
const int counterListSize = _info.counter_list_size();
for (int i = 0; i < counterListSize; ++i) {
const ServerInfo_CardCounter &counterInfo = _info.counter_list(i);
- state->insertCounter(counterInfo.id(), counterInfo.value());
+ counters.insert(counterInfo.id(), counterInfo.value());
}
setId(_info.id());
@@ -272,12 +275,11 @@ void CardItem::deleteDragItem()
void CardItem::drawArrow(const QColor &arrowColor)
{
- if (owner->getGame()->getPlayerManager()->isSpectator()) {
+ if (owner->getGame()->getPlayerManager()->isSpectator())
return;
- }
auto *game = owner->getGame();
- PlayerLogic *arrowOwner = game->getPlayerManager()->getActiveLocalPlayer(game->getGameState()->getActivePlayer());
+ Player *arrowOwner = game->getPlayerManager()->getActiveLocalPlayer(game->getGameState()->getActivePlayer());
int phase = 0; // 0 means to not set the phase
if (SettingsCache::instance().getDoNotDeleteArrowsInSubPhases()) {
int currentPhase = game->getGameState()->getCurrentPhase();
@@ -289,12 +291,10 @@ void CardItem::drawArrow(const QColor &arrowColor)
for (const auto &item : scene()->selectedItems()) {
CardItem *card = qgraphicsitem_cast(item);
- if (card == nullptr || card == this) {
+ if (card == nullptr || card == this)
continue;
- }
- if (card->getZone() != state->getZone()) {
+ if (card->getZone() != zone)
continue;
- }
ArrowDragItem *childArrow = new ArrowDragItem(arrowOwner, card, arrowColor, phase);
scene()->addItem(childArrow);
@@ -304,9 +304,8 @@ void CardItem::drawArrow(const QColor &arrowColor)
void CardItem::drawAttachArrow()
{
- if (owner->getGame()->getPlayerManager()->isSpectator()) {
+ if (owner->getGame()->getPlayerManager()->isSpectator())
return;
- }
auto *arrow = new ArrowAttachItem(this);
scene()->addItem(arrow);
@@ -314,12 +313,10 @@ void CardItem::drawAttachArrow()
for (const auto &item : scene()->selectedItems()) {
CardItem *card = qgraphicsitem_cast(item);
- if (card == nullptr) {
+ if (card == nullptr)
continue;
- }
- if (card->getZone() != state->getZone()) {
+ if (card->getZone() != zone)
continue;
- }
ArrowAttachItem *childArrow = new ArrowAttachItem(card);
scene()->addItem(childArrow);
@@ -331,32 +328,27 @@ void CardItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
if (event->buttons().testFlag(Qt::RightButton)) {
if ((event->screenPos() - event->buttonDownScreenPos(Qt::RightButton)).manhattanLength() <
- 2 * QApplication::startDragDistance()) {
+ 2 * QApplication::startDragDistance())
return;
- }
QColor arrowColor = Qt::red;
- if (event->modifiers().testFlag(Qt::ControlModifier)) {
+ if (event->modifiers().testFlag(Qt::ControlModifier))
arrowColor = Qt::yellow;
- } else if (event->modifiers().testFlag(Qt::AltModifier)) {
+ else if (event->modifiers().testFlag(Qt::AltModifier))
arrowColor = Qt::blue;
- } else if (event->modifiers().testFlag(Qt::ShiftModifier)) {
+ else if (event->modifiers().testFlag(Qt::ShiftModifier))
arrowColor = Qt::green;
- }
drawArrow(arrowColor);
} else if (event->buttons().testFlag(Qt::LeftButton)) {
if ((event->screenPos() - event->buttonDownScreenPos(Qt::LeftButton)).manhattanLength() <
- 2 * QApplication::startDragDistance()) {
+ 2 * QApplication::startDragDistance())
return;
- }
- if (const ZoneViewZoneLogic *view = qobject_cast(state->getZone())) {
- if (view->getRevealZone() && !view->getWriteableRevealZone()) {
+ if (const ZoneViewZoneLogic *view = qobject_cast(zone)) {
+ if (view->getRevealZone() && !view->getWriteableRevealZone())
return;
- }
- } else if (!owner->getPlayerInfo()->getLocalOrJudge()) {
+ } else if (!owner->getPlayerInfo()->getLocalOrJudge())
return;
- }
bool forceFaceDown = event->modifiers().testFlag(Qt::ShiftModifier);
@@ -368,16 +360,14 @@ void CardItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
int childIndex = 0;
for (const auto &item : scene()->selectedItems()) {
CardItem *card = static_cast(item);
- if ((card == this) || (card->getZone() != state->getZone())) {
+ if ((card == this) || (card->getZone() != zone))
continue;
- }
++childIndex;
QPointF childPos;
- if (state->getZone()->getHasCardAttr()) {
+ if (zone->getHasCardAttr())
childPos = card->pos() - pos();
- } else {
+ else
childPos = QPointF(childIndex * CardDimensions::WIDTH_HALF_F, 0);
- }
CardDragItem *drag =
new CardDragItem(card, card->getId(), childPos, card->getFaceDown() || forceFaceDown, dragItem);
drag->setPos(dragItem->pos() + childPos);
@@ -390,57 +380,22 @@ void CardItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
void CardItem::playCard(bool faceDown)
{
// Do nothing if the card belongs to another player
- if (!owner->getPlayerInfo()->getLocalOrJudge()) {
+ if (!owner->getPlayerInfo()->getLocalOrJudge())
return;
- }
- TableZoneLogic *tz = qobject_cast(state->getZone());
- if (tz) {
+ TableZoneLogic *tz = qobject_cast(zone);
+ if (tz)
emit tz->toggleTapped();
- } else {
+ else {
if (SettingsCache::instance().getClickPlaysAllSelected()) {
- if (faceDown) {
- emit playSelectedFaceDown(this);
- } else {
- emit playSelected(this);
- }
+ faceDown ? zone->getPlayer()->getPlayerActions()->actPlayFacedown()
+ : zone->getPlayer()->getPlayerActions()->actPlay();
} else {
- state->getZone()->getPlayer()->getPlayerActions()->playCard(this, faceDown);
+ zone->getPlayer()->getPlayerActions()->playCard(this, faceDown);
}
}
}
-QVariantList CardItem::parsePT(const QString &pt)
-{
- QVariantList ptList = QVariantList();
- if (!pt.isEmpty()) {
- int sep = pt.indexOf('/');
- if (sep == 0) {
- ptList.append(QVariant(pt.mid(1))); // cut off starting '/' and take full string
- } else {
- int start = 0;
- for (;;) {
- QString item = pt.mid(start, sep - start);
- if (item.isEmpty()) {
- ptList.append(QVariant(QString()));
- } else if (item[0] == '+') {
- ptList.append(QVariant(item.mid(1).toInt())); // add as int
- } else if (item[0] == '-') {
- ptList.append(QVariant(item.toInt())); // add as int
- } else {
- ptList.append(QVariant(item)); // add as qstring
- }
- if (sep == -1) {
- break;
- }
- start = sep + 1;
- sep = pt.indexOf('/', start);
- }
- }
- }
- return ptList;
-}
-
/**
* @brief returns true if the zone is a unwritable reveal zone view (eg a card reveal window). Will return false if zone
* is nullptr.
@@ -461,11 +416,11 @@ static bool isUnwritableRevealZone(CardZoneLogic *zone)
*/
void CardItem::handleClickedToPlay(bool shiftHeld)
{
- if (isUnwritableRevealZone(state->getZone())) {
+ if (isUnwritableRevealZone(zone)) {
if (SettingsCache::instance().getClickPlaysAllSelected()) {
- emit hideSelected(this);
+ zone->getPlayer()->getPlayerActions()->actHide();
} else {
- state->getZone()->removeCard(this);
+ zone->removeCard(this);
}
} else {
playCard(shiftHeld);
@@ -474,15 +429,21 @@ void CardItem::handleClickedToPlay(bool shiftHeld)
void CardItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
- if (event->button() == Qt::RightButton && owner != nullptr) {
- emit rightClicked(this, event->screenPos());
- return;
- }
- if ((event->modifiers() != Qt::AltModifier) && (event->button() == Qt::LeftButton) &&
- (!SettingsCache::instance().getDoubleClickToPlay())) {
+ if (event->button() == Qt::RightButton) {
+
+ if (owner != nullptr) {
+ owner->getGame()->setActiveCard(this);
+ if (QMenu *cardMenu = owner->getPlayerMenu()->updateCardMenu(this)) {
+ cardMenu->popup(event->screenPos());
+ return;
+ }
+ }
+ } else if ((event->modifiers() != Qt::AltModifier) && (event->button() == Qt::LeftButton) &&
+ (!SettingsCache::instance().getDoubleClickToPlay())) {
handleClickedToPlay(event->modifiers().testFlag(Qt::ShiftModifier));
}
- if (owner != nullptr) {
+
+ if (owner != nullptr) { // cards without owner will be deleted
setCursor(Qt::OpenHandCursor);
}
AbstractCardItem::mouseReleaseEvent(event);
@@ -501,9 +462,8 @@ bool CardItem::animationEvent()
{
int rotation = ROTATION_DEGREES_PER_FRAME;
bool animationIncomplete = true;
- if (!tapped) {
+ if (!tapped)
rotation *= -1;
- }
tapAngle += rotation;
if (tapped && (tapAngle > 90)) {
@@ -528,14 +488,14 @@ bool CardItem::animationEvent()
QVariant CardItem::itemChange(GraphicsItemChange change, const QVariant &value)
{
if ((change == ItemSelectedHasChanged) && owner != nullptr) {
- bool selected = value.toBool();
-
- if (selected) {
+ if (value == true) {
owner->getGame()->setActiveCard(this);
+ owner->getPlayerMenu()->updateCardMenu(this);
+ } else if (owner->getGameScene()->selectedItems().isEmpty()) {
+
+ owner->getGame()->setActiveCard(nullptr);
+ owner->getPlayerMenu()->updateCardMenu(nullptr);
}
-
- emit selectionChanged(this, selected);
}
-
return AbstractCardItem::itemChange(change, value);
-}
\ No newline at end of file
+}
diff --git a/cockatrice/src/game_graphics/board/card_item.h b/cockatrice/src/game/board/card_item.h
similarity index 65%
rename from cockatrice/src/game_graphics/board/card_item.h
rename to cockatrice/src/game/board/card_item.h
index 37f3bab50..da2097a2c 100644
--- a/cockatrice/src/game_graphics/board/card_item.h
+++ b/cockatrice/src/game/board/card_item.h
@@ -1,14 +1,13 @@
/**
* @file card_item.h
* @ingroup GameGraphicsCards
+ * @brief TODO: Document this.
*/
-//! \todo Document this file.
#ifndef CARDITEM_H
#define CARDITEM_H
-#include "../../game/board/card_state.h"
-#include "../../game/zones/card_zone_logic.h"
+#include "../zones/logic/card_zone_logic.h"
#include "abstract_card_item.h"
#include
@@ -17,20 +16,27 @@ class CardDatabase;
class CardDragItem;
class CardZone;
class ServerInfo_Card;
-class PlayerLogic;
+class Player;
class QAction;
class QColor;
+const int MAX_COUNTERS_ON_CARD = 999;
const int ROTATION_DEGREES_PER_FRAME = 10;
class CardItem : public AbstractCardItem
{
Q_OBJECT
private:
- CardState *state;
-
+ CardZoneLogic *zone;
+ bool attacking;
+ QMap counters;
+ QString annotation;
+ QString pt;
+ bool destroyOnZoneChange;
+ bool doesntUntap;
QPoint gridPoint;
CardDragItem *dragItem;
+ CardItem *attachedTo;
QList attachedCards;
void prepareDelete();
@@ -47,20 +53,16 @@ public:
{
return Type;
}
- explicit CardItem(PlayerLogic *_owner,
+ explicit CardItem(Player *_owner,
QGraphicsItem *parent = nullptr,
const CardRef &cardRef = {},
int _cardid = -1,
CardZoneLogic *_zone = nullptr);
void retranslateUi();
- [[nodiscard]] CardState *getState() const
- {
- return state;
- }
[[nodiscard]] CardZoneLogic *getZone() const
{
- return state->getZone();
+ return zone;
}
void setZone(CardZoneLogic *_zone);
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
@@ -76,50 +78,50 @@ public:
{
return gridPoint;
}
- [[nodiscard]] PlayerLogic *getOwner() const
+ [[nodiscard]] Player *getOwner() const
{
return owner;
}
- void setOwner(PlayerLogic *_owner)
+ void setOwner(Player *_owner)
{
owner = _owner;
}
[[nodiscard]] bool getAttacking() const
{
- return state->getAttacking();
+ return attacking;
}
void setAttacking(bool _attacking);
[[nodiscard]] const QMap &getCounters() const
{
- return state->getCounters();
+ return counters;
}
void setCounter(int _id, int _value);
[[nodiscard]] QString getAnnotation() const
{
- return state->getAnnotation();
+ return annotation;
}
void setAnnotation(const QString &_annotation);
[[nodiscard]] bool getDoesntUntap() const
{
- return state->getDoesntUntap();
+ return doesntUntap;
}
void setDoesntUntap(bool _doesntUntap);
[[nodiscard]] QString getPT() const
{
- return state->getPT();
+ return pt;
}
void setPT(const QString &_pt);
[[nodiscard]] bool getDestroyOnZoneChange() const
{
- return state->getDestroyOnZoneChange();
+ return destroyOnZoneChange;
}
void setDestroyOnZoneChange(bool _destroy)
{
- state->setDestroyOnZoneChange(_destroy);
+ destroyOnZoneChange = _destroy;
}
[[nodiscard]] CardItem *getAttachedTo() const
{
- return state->getAttachedTo();
+ return attachedTo;
}
void setAttachedTo(CardItem *_attachedTo);
void addAttachedCard(CardItem *card)
@@ -144,26 +146,6 @@ public:
void drawAttachArrow();
void playCard(bool faceDown);
- /**
- * @brief Parses a string representing a p/t in order to extract the values from it.
- *
- * If the string contains '/', the string will be split at the '/' and each side will be parsed separately,
- * which means the result list will have two elements.
- *
- * If '/' is not found, then the entire string is parsed together, which means the result list will
- * have a single element.
- *
- * If either side of the split is empty, there will also only be a single element in the result list.
- *
- * This function will attempt to parse each substring as an int first, handling plus and minus prefixes.
- * If successful, it will put the parsed value into the QVariant as an int.
- * If failed, it will just put the substring into the QVariant as a QString.
- *
- * @param pt The p/t string
- * @return A QVariantList that can contain one or two elements, where each QVariant can be either int or QString
- */
- static QVariantList parsePT(const QString &pt);
-
protected:
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
diff --git a/cockatrice/src/game/board/card_list.cpp b/cockatrice/src/game/board/card_list.cpp
index 0080b5ae6..c324ca10a 100644
--- a/cockatrice/src/game/board/card_list.cpp
+++ b/cockatrice/src/game/board/card_list.cpp
@@ -1,6 +1,6 @@
#include "card_list.h"
-#include "../../game_graphics/board/card_item.h"
+#include "card_item.h"
#include
#include
diff --git a/cockatrice/src/game/board/card_list.h b/cockatrice/src/game/board/card_list.h
index 85a6848b7..07be33b32 100644
--- a/cockatrice/src/game/board/card_list.h
+++ b/cockatrice/src/game/board/card_list.h
@@ -1,8 +1,8 @@
/**
* @file card_list.h
* @ingroup GameLogicCards
+ * @brief TODO: Document this.
*/
-//! \todo Document this file.
#ifndef CARDLIST_H
#define CARDLIST_H
diff --git a/cockatrice/src/game/board/card_state.cpp b/cockatrice/src/game/board/card_state.cpp
deleted file mode 100644
index 4319400d7..000000000
--- a/cockatrice/src/game/board/card_state.cpp
+++ /dev/null
@@ -1,111 +0,0 @@
-#include "card_state.h"
-
-void CardState::resetState(bool keepAnnotations)
-{
- attacking = false;
- counters.clear();
- pt.clear();
- if (!keepAnnotations) {
- annotation.clear();
- }
- attachedTo = nullptr;
-}
-
-void CardState::setZone(CardZoneLogic *_zone)
-{
- if (zone == _zone) {
- return;
- }
-
- zone = _zone;
- emit zoneChanged(this, zone);
- emit stateChanged();
-}
-
-void CardState::setAttacking(bool _attacking)
-{
- if (attacking == _attacking) {
- return;
- }
- attacking = _attacking;
- emit attackingChanged(_attacking);
- emit stateChanged();
-}
-
-void CardState::insertCounter(int id, int value)
-{
- counters.insert(id, value);
-
- emit countersChanged(counters);
- emit stateChanged();
-}
-
-void CardState::setCounter(int id, int value)
-{
- if (value) {
- counters[id] = value;
- } else {
- counters.remove(id);
- }
-
- emit countersChanged(counters);
- emit stateChanged();
-}
-
-void CardState::clearCounters()
-{
- counters.clear();
- emit countersChanged(counters);
- emit stateChanged();
-}
-
-void CardState::setAnnotation(const QString &_annotation)
-{
- if (annotation == _annotation) {
- return;
- }
- annotation = _annotation;
- emit annotationChanged(annotation);
- emit stateChanged();
-}
-
-void CardState::setPT(const QString &_pt)
-{
- if (pt == _pt) {
- return;
- }
- pt = _pt;
- emit ptChanged(pt);
- emit stateChanged();
-}
-
-void CardState::setDoesntUntap(bool _doesntUntap)
-{
- if (doesntUntap == _doesntUntap) {
- return;
- }
- doesntUntap = _doesntUntap;
- emit doesntUntapChanged(_doesntUntap);
- emit stateChanged();
-}
-
-void CardState::setDestroyOnZoneChange(bool _destroyOnZoneChange)
-{
- if (destroyOnZoneChange == _destroyOnZoneChange) {
- return;
- }
-
- destroyOnZoneChange = _destroyOnZoneChange;
- emit destroyOnZoneChangeChanged(_destroyOnZoneChange);
- emit stateChanged();
-}
-
-void CardState::setAttachedTo(CardItem *_attachedTo)
-{
- if (attachedTo == _attachedTo) {
- return;
- }
- attachedTo = _attachedTo;
- emit attachedToChanged(_attachedTo);
- emit stateChanged();
-}
\ No newline at end of file
diff --git a/cockatrice/src/game/board/card_state.h b/cockatrice/src/game/board/card_state.h
deleted file mode 100644
index 0498b1aa2..000000000
--- a/cockatrice/src/game/board/card_state.h
+++ /dev/null
@@ -1,103 +0,0 @@
-#ifndef COCKATRICE_CARD_STATE_H
-#define COCKATRICE_CARD_STATE_H
-
-#include
-#include
-
-class CardZoneLogic;
-class CardItem;
-class CardState : public QObject
-{
- Q_OBJECT
-
-private:
- bool attacking = false;
- QMap counters;
- QString annotation;
- QString pt;
- bool doesntUntap = false;
- bool destroyOnZoneChange = false;
-
- CardItem *attachedTo = nullptr;
- CardZoneLogic *zone = nullptr;
-
-signals:
- void stateChanged();
-
- void attackingChanged(bool newValue);
- void countersChanged(const QMap &newCounters);
- void annotationChanged(const QString &newAnnotation);
- void ptChanged(const QString &newPt);
- void doesntUntapChanged(bool newValue);
- void destroyOnZoneChangeChanged(bool newValue);
- void attachedToChanged(CardItem *newAttachedTo);
- void zoneChanged(CardState *changedCard, CardZoneLogic *newZone);
-
-public:
- explicit CardState(QObject *parent, CardZoneLogic *_zone) : QObject(parent), zone(_zone)
- {
- }
-
- void resetState(bool keepAnnotations);
-
- CardZoneLogic *getZone() const
- {
- return zone;
- }
-
- void setZone(CardZoneLogic *_zone);
-
- bool getAttacking() const
- {
- return attacking;
- }
- void setAttacking(bool _attacking);
-
- const QMap &getCounters() const
- {
- return counters;
- }
-
- void insertCounter(int id, int value);
-
- void setCounter(int id, int value);
-
- void clearCounters();
-
- QString getAnnotation() const
- {
- return annotation;
- }
-
- void setAnnotation(const QString &_annotation);
-
- QString getPT() const
- {
- return pt;
- }
-
- void setPT(const QString &_pt);
-
- bool getDoesntUntap() const
- {
- return doesntUntap;
- }
-
- void setDoesntUntap(bool _doesntUntap);
-
- bool getDestroyOnZoneChange() const
- {
- return destroyOnZoneChange;
- }
-
- void setDestroyOnZoneChange(bool _destroyOnZoneChange);
-
- CardItem *getAttachedTo() const
- {
- return attachedTo;
- }
-
- void setAttachedTo(CardItem *_attachedTo);
-};
-
-#endif // COCKATRICE_CARD_STATE_H
diff --git a/cockatrice/src/game_graphics/board/counter_general.cpp b/cockatrice/src/game/board/counter_general.cpp
similarity index 65%
rename from cockatrice/src/game_graphics/board/counter_general.cpp
rename to cockatrice/src/game/board/counter_general.cpp
index 379c6f837..d68486a1b 100644
--- a/cockatrice/src/game_graphics/board/counter_general.cpp
+++ b/cockatrice/src/game/board/counter_general.cpp
@@ -1,12 +1,19 @@
#include "counter_general.h"
+#include "../../game_graphics/board/abstract_graphics_item.h"
#include "../../interface/pixel_map_generator.h"
-#include "abstract_graphics_item.h"
#include
-GeneralCounter::GeneralCounter(CounterState *state, PlayerLogic *player, bool useNameForShortcut, QGraphicsItem *parent)
- : AbstractCounter(state, player, true, useNameForShortcut, parent)
+GeneralCounter::GeneralCounter(Player *_player,
+ int _id,
+ const QString &_name,
+ const QColor &_color,
+ int _radius,
+ int _value,
+ bool useNameForShortcut,
+ QGraphicsItem *parent)
+ : AbstractCounter(_player, _id, _name, true, _value, useNameForShortcut, parent), color(_color), radius(_radius)
{
setCacheMode(DeviceCoordinateCache);
}
diff --git a/cockatrice/src/game_graphics/board/counter_general.h b/cockatrice/src/game/board/counter_general.h
similarity index 62%
rename from cockatrice/src/game_graphics/board/counter_general.h
rename to cockatrice/src/game/board/counter_general.h
index 0a2e882ce..3db1d7bb4 100644
--- a/cockatrice/src/game_graphics/board/counter_general.h
+++ b/cockatrice/src/game/board/counter_general.h
@@ -1,8 +1,8 @@
/**
* @file counter_general.h
* @ingroup GameGraphicsPlayers
+ * @brief TODO: Document this.
*/
-//! \todo Document this file.
#ifndef COUNTER_GENERAL_H
#define COUNTER_GENERAL_H
@@ -12,10 +12,17 @@
class GeneralCounter : public AbstractCounter
{
Q_OBJECT
+private:
+ QColor color;
+ int radius;
public:
- GeneralCounter(CounterState *state,
- PlayerLogic *player,
+ GeneralCounter(Player *_player,
+ int _id,
+ const QString &_name,
+ const QColor &_color,
+ int _radius,
+ int _value,
bool useNameForShortcut = false,
QGraphicsItem *parent = nullptr);
QRectF boundingRect() const override;
diff --git a/cockatrice/src/game/board/counter_state.cpp b/cockatrice/src/game/board/counter_state.cpp
deleted file mode 100644
index 6da18b662..000000000
--- a/cockatrice/src/game/board/counter_state.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-#include "counter_state.h"
-
-#include
-
-CounterState::CounterState(int id, const QString &name, const QColor &color, int radius, int value, QObject *parent)
- : QObject(parent), id(id), name(name), color(color), radius(radius), value(value)
-{
-}
-
-CounterState *CounterState::fromProto(const ServerInfo_Counter &counter, QObject *parent)
-{
- return new CounterState(counter.id(), QString::fromStdString(counter.name()),
- convertColorToQColor(counter.counter_color()), counter.radius(), counter.count(), parent);
-}
-
-void CounterState::setValue(int newValue)
-{
- if (newValue == value) {
- return;
- }
- int old = value;
- value = newValue;
- emit valueChanged(old, newValue);
-}
\ No newline at end of file
diff --git a/cockatrice/src/game/board/counter_state.h b/cockatrice/src/game/board/counter_state.h
deleted file mode 100644
index 0f2f16b55..000000000
--- a/cockatrice/src/game/board/counter_state.h
+++ /dev/null
@@ -1,51 +0,0 @@
-#ifndef COCKATRICE_COUNTER_STATE_H
-#define COCKATRICE_COUNTER_STATE_H
-
-#include
-#include
-#include
-#include
-
-class CounterState : public QObject
-{
- Q_OBJECT
-public:
- CounterState(int id, const QString &name, const QColor &color, int radius, int value, QObject *parent = nullptr);
-
- static CounterState *fromProto(const ServerInfo_Counter &counter, QObject *parent = nullptr);
-
- int getId() const
- {
- return id;
- }
- QString getName() const
- {
- return name;
- }
- QColor getColor() const
- {
- return color;
- }
- int getRadius() const
- {
- return radius;
- }
- int getValue() const
- {
- return value;
- }
-
- void setValue(int newValue);
-
-signals:
- void valueChanged(int oldValue, int newValue);
-
-private:
- int id;
- QString name;
- QColor color;
- int radius;
- int value;
-};
-
-#endif // COCKATRICE_COUNTER_STATE_H
diff --git a/cockatrice/src/game_graphics/board/translate_counter_name.cpp b/cockatrice/src/game/board/translate_counter_name.cpp
similarity index 100%
rename from cockatrice/src/game_graphics/board/translate_counter_name.cpp
rename to cockatrice/src/game/board/translate_counter_name.cpp
diff --git a/cockatrice/src/game_graphics/board/translate_counter_name.h b/cockatrice/src/game/board/translate_counter_name.h
similarity index 94%
rename from cockatrice/src/game_graphics/board/translate_counter_name.h
rename to cockatrice/src/game/board/translate_counter_name.h
index ba3a94fa5..fdb277c11 100644
--- a/cockatrice/src/game_graphics/board/translate_counter_name.h
+++ b/cockatrice/src/game/board/translate_counter_name.h
@@ -1,8 +1,8 @@
/**
* @file translate_counter_name.h
* @ingroup GameGraphicsPlayers
+ * @brief TODO: Document this.
*/
-//! \todo Document this file.
#ifndef TRANSLATECOUNTERNAME_H
#define TRANSLATECOUNTERNAME_H
diff --git a/cockatrice/src/game_graphics/card_dimensions.h b/cockatrice/src/game/card_dimensions.h
similarity index 76%
rename from cockatrice/src/game_graphics/card_dimensions.h
rename to cockatrice/src/game/card_dimensions.h
index c59a01b48..255d0bc04 100644
--- a/cockatrice/src/game_graphics/card_dimensions.h
+++ b/cockatrice/src/game/card_dimensions.h
@@ -12,16 +12,16 @@
*/
namespace CardDimensions
{
-/** @brief Card width in pixels. */
+/// Card width in pixels
constexpr int WIDTH = 72;
-/** @brief Card height in pixels. */
+/// Card height in pixels
constexpr int HEIGHT = 102;
-/** @brief Pre-converted for floating-point contexts (Z-value calculations). */
+/// Pre-converted for floating-point contexts (Z-value calculations)
constexpr qreal WIDTH_F = static_cast(WIDTH);
constexpr qreal HEIGHT_F = static_cast(HEIGHT);
-/** @brief Half-dimensions for centering and rotation transforms. */
+/// Half-dimensions for centering and rotation transforms
constexpr qreal WIDTH_HALF_F = WIDTH_F / 2;
constexpr qreal HEIGHT_HALF_F = HEIGHT_F / 2;
} // namespace CardDimensions
diff --git a/cockatrice/src/game_graphics/deckview/deck_view.cpp b/cockatrice/src/game/deckview/deck_view.cpp
similarity index 90%
rename from cockatrice/src/game_graphics/deckview/deck_view.cpp
rename to cockatrice/src/game/deckview/deck_view.cpp
index a5d0fa3bc..620dfaa5f 100644
--- a/cockatrice/src/game_graphics/deckview/deck_view.cpp
+++ b/cockatrice/src/game/deckview/deck_view.cpp
@@ -24,21 +24,17 @@ void DeckViewCardDragItem::updatePosition(const QPointF &cursorScenePos)
QList colliding = scene()->items(cursorScenePos);
DeckViewCardContainer *cursorZone = 0;
- for (int i = colliding.size() - 1; i >= 0; i--) {
- if ((cursorZone = qgraphicsitem_cast(colliding.at(i)))) {
+ for (int i = colliding.size() - 1; i >= 0; i--)
+ if ((cursorZone = qgraphicsitem_cast(colliding.at(i))))
break;
- }
- }
- if (!cursorZone) {
+ if (!cursorZone)
return;
- }
currentZone = cursorZone;
QPointF newPos = cursorScenePos;
if (newPos != pos()) {
- for (int i = 0; i < childDrags.size(); i++) {
+ for (int i = 0; i < childDrags.size(); i++)
childDrags[i]->setPos(newPos + childDrags[i]->getHotSpot());
- }
setPos(newPos);
}
}
@@ -108,13 +104,11 @@ void DeckViewCard::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
void DeckViewCard::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
if ((event->screenPos() - event->buttonDownScreenPos(Qt::LeftButton)).manhattanLength() <
- 2 * QApplication::startDragDistance()) {
+ 2 * QApplication::startDragDistance())
return;
- }
- if (static_cast(scene())->getLocked()) {
+ if (static_cast(scene())->getLocked())
return;
- }
delete dragItem;
dragItem = new DeckViewCardDragItem(this, event->pos());
@@ -126,9 +120,8 @@ void DeckViewCard::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
int j = 0;
for (int i = 0; i < sel.size(); i++) {
auto *c = static_cast(sel.at(i));
- if (c == this) {
+ if (c == this)
continue;
- }
++j;
auto childPos = QPointF(j * CardDimensions::WIDTH_HALF_F, 0);
auto *drag = new DeckViewCardDragItem(c, childPos, dragItem);
@@ -140,9 +133,8 @@ void DeckViewCard::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
void DeckView::mouseDoubleClickEvent(QMouseEvent *event)
{
- if (static_cast(scene())->getLocked()) {
+ if (static_cast(scene())->getLocked())
return;
- }
if (event->button() == Qt::LeftButton) {
QList result;
@@ -155,13 +147,12 @@ void DeckView::mouseDoubleClickEvent(QMouseEvent *event)
m.set_card_name(c->getName().toStdString());
m.set_start_zone(zone->getName().toStdString());
- if (zone->getName() == DECK_ZONE_MAIN) {
+ if (zone->getName() == DECK_ZONE_MAIN)
m.set_target_zone(DECK_ZONE_SIDE);
- } else if (zone->getName() == DECK_ZONE_SIDE) {
+ else if (zone->getName() == DECK_ZONE_SIDE)
m.set_target_zone(DECK_ZONE_MAIN);
- } else { // Trying to move from another zone
+ else // Trying to move from another zone
m.set_target_zone(zone->getName().toStdString());
- }
result.append(m);
}
@@ -241,9 +232,8 @@ QList> DeckViewCardContainer::getRowsAndCols() const
{
QList> result;
QList cardTypeList = cardsByType.uniqueKeys();
- for (int i = 0; i < cardTypeList.size(); ++i) {
+ for (int i = 0; i < cardTypeList.size(); ++i)
result.append(QPair(1, cardsByType.count(cardTypeList[i])));
- }
return result;
}
@@ -272,9 +262,8 @@ QSizeF DeckViewCardContainer::calculateBoundingRect(const QList>
// Calculate space needed for cards
for (int i = 0; i < rowsAndCols.size(); ++i) {
totalHeight += CardDimensions::HEIGHT_F * rowsAndCols[i].first + paddingY;
- if (CardDimensions::WIDTH_F * rowsAndCols[i].second > totalWidth) {
+ if (CardDimensions::WIDTH_F * rowsAndCols[i].second > totalWidth)
totalWidth = CardDimensions::WIDTH_F * rowsAndCols[i].second;
- }
}
return QSizeF(getCardTypeTextWidth() + totalWidth, totalHeight + separatorY + paddingY);
@@ -282,9 +271,8 @@ QSizeF DeckViewCardContainer::calculateBoundingRect(const QList>
bool DeckViewCardContainer::sortCardsByName(DeckViewCard *c1, DeckViewCard *c2)
{
- if (c1 && c2) {
+ if (c1 && c2)
return c1->getName() < c2->getName();
- }
return false;
}
@@ -334,17 +322,15 @@ DeckViewScene::~DeckViewScene()
void DeckViewScene::clearContents()
{
QMapIterator i(cardContainers);
- while (i.hasNext()) {
+ while (i.hasNext())
delete i.next().value();
- }
cardContainers.clear();
}
void DeckViewScene::setDeck(const DeckList &_deck)
{
- if (deck) {
+ if (deck)
delete deck;
- }
deck = new DeckList(_deck.writeToString_Native());
rebuildTree();
@@ -356,19 +342,8 @@ void DeckViewScene::rebuildTree()
{
clearContents();
- if (!deck) {
+ if (!deck)
return;
- }
-
- QStringList requiredZones = {DECK_ZONE_MAIN, DECK_ZONE_SIDE};
-
- for (const QString &zoneName : requiredZones) {
- if (!cardContainers.contains(zoneName)) {
- auto *container = new DeckViewCardContainer(zoneName);
- cardContainers.insert(zoneName, container);
- addItem(container);
- }
- }
for (auto *currentZone : deck->getZoneNodes()) {
DeckViewCardContainer *container = cardContainers.value(currentZone->getName(), 0);
@@ -380,9 +355,8 @@ void DeckViewScene::rebuildTree()
for (int j = 0; j < currentZone->size(); j++) {
auto *currentCard = dynamic_cast(currentZone->at(j));
- if (!currentCard) {
+ if (!currentCard)
continue;
- }
for (int k = 0; k < currentCard->getNumber(); ++k) {
auto *newCard = new DeckViewCard(container, currentCard->toCardRef(), currentZone->getName());
@@ -399,21 +373,18 @@ void DeckViewScene::applySideboardPlan(const QList &plan)
const MoveCard_ToZone &m = plan[i];
DeckViewCardContainer *start = cardContainers.value(QString::fromStdString(m.start_zone()));
DeckViewCardContainer *target = cardContainers.value(QString::fromStdString(m.target_zone()));
- if (!start || !target) {
+ if (!start || !target)
continue;
- }
DeckViewCard *card = 0;
const QList &cardList = start->getCards();
- for (int j = 0; j < cardList.size(); ++j) {
+ for (int j = 0; j < cardList.size(); ++j)
if (cardList[j]->getName() == QString::fromStdString(m.card_name())) {
card = cardList[j];
break;
}
- }
- if (!card) {
+ if (!card)
continue;
- }
start->removeCard(card);
target->addCard(card);
@@ -434,9 +405,8 @@ void DeckViewScene::rearrangeItems()
rowsAndColsList.append(rowsAndCols);
cardCountList.append(QList());
- for (int j = 0; j < rowsAndCols.size(); ++j) {
+ for (int j = 0; j < rowsAndCols.size(); ++j)
cardCountList[i].append(rowsAndCols[j].second);
- }
}
qreal totalHeight, totalWidth;
@@ -447,27 +417,23 @@ void DeckViewScene::rearrangeItems()
for (int i = 0; i < contList.size(); ++i) {
QSizeF contSize = contList[i]->calculateBoundingRect(rowsAndColsList[i]);
totalHeight += contSize.height() + spacing;
- if (contSize.width() > totalWidth) {
+ if (contSize.width() > totalWidth)
totalWidth = contSize.width();
- }
}
// We're done when the aspect ratio shifts from too high to too low.
- if (totalWidth / totalHeight <= optimalAspectRatio) {
+ if (totalWidth / totalHeight <= optimalAspectRatio)
break;
- }
// Find category with highest column count
int maxIndex1 = -1, maxIndex2 = -1, maxCols = 0;
- for (int i = 0; i < rowsAndColsList.size(); ++i) {
- for (int j = 0; j < rowsAndColsList[i].size(); ++j) {
+ for (int i = 0; i < rowsAndColsList.size(); ++i)
+ for (int j = 0; j < rowsAndColsList[i].size(); ++j)
if (rowsAndColsList[i][j].second > maxCols) {
maxIndex1 = i;
maxIndex2 = j;
maxCols = rowsAndColsList[i][j].second;
}
- }
- }
// Add row to category
const int maxRows = rowsAndColsList[maxIndex1][maxIndex2].first;
@@ -485,9 +451,8 @@ void DeckViewScene::rearrangeItems()
}
totalWidth = totalHeight * optimalAspectRatio;
- for (int i = 0; i < contList.size(); ++i) {
+ for (int i = 0; i < contList.size(); ++i)
contList[i]->setWidth(totalWidth);
- }
setSceneRect(QRectF(0, 0, totalWidth, totalHeight));
}
@@ -505,7 +470,7 @@ QList DeckViewScene::getSideboardPlan() const
while (containerIterator.hasNext()) {
DeckViewCardContainer *cont = containerIterator.next().value();
const QList cardList = cont->getCards();
- for (int i = 0; i < cardList.size(); ++i) {
+ for (int i = 0; i < cardList.size(); ++i)
if (cardList[i]->getOriginZone() != cont->getName()) {
MoveCard_ToZone m;
m.set_card_name(cardList[i]->getName().toStdString());
@@ -513,7 +478,6 @@ QList DeckViewScene::getSideboardPlan() const
m.set_target_zone(cont->getName().toStdString());
result.append(m);
}
- }
}
return result;
}
diff --git a/cockatrice/src/game_graphics/deckview/deck_view.h b/cockatrice/src/game/deckview/deck_view.h
similarity index 99%
rename from cockatrice/src/game_graphics/deckview/deck_view.h
rename to cockatrice/src/game/deckview/deck_view.h
index f996fd4da..5abc558bd 100644
--- a/cockatrice/src/game_graphics/deckview/deck_view.h
+++ b/cockatrice/src/game/deckview/deck_view.h
@@ -1,8 +1,8 @@
/**
* @file deck_view.h
* @ingroup Lobby
+ * @brief TODO: Document this.
*/
-//! \todo Document this file.
#ifndef DECKVIEW_H
#define DECKVIEW_H
diff --git a/cockatrice/src/game_graphics/deckview/deck_view_container.cpp b/cockatrice/src/game/deckview/deck_view_container.cpp
similarity index 98%
rename from cockatrice/src/game_graphics/deckview/deck_view_container.cpp
rename to cockatrice/src/game/deckview/deck_view_container.cpp
index d476a5012..44b2be6d1 100644
--- a/cockatrice/src/game_graphics/deckview/deck_view_container.cpp
+++ b/cockatrice/src/game/deckview/deck_view_container.cpp
@@ -19,7 +19,7 @@
#include
#include
#include
-#include
+#include
ToggleButton::ToggleButton(QWidget *parent) : QPushButton(parent), state(false)
{
@@ -209,7 +209,6 @@ void DeckViewContainer::refreshShortcuts()
loadLocalButton->setShortcut(shortcuts.getSingleShortcut("DeckViewContainer/loadLocalButton"));
loadRemoteButton->setShortcut(shortcuts.getSingleShortcut("DeckViewContainer/loadRemoteButton"));
loadFromClipboardButton->setShortcut(shortcuts.getSingleShortcut("DeckViewContainer/loadFromClipboardButton"));
- loadFromWebsiteButton->setShortcut(shortcuts.getSingleShortcut("DeckViewContainer/loadFromWebsiteButton"));
unloadDeckButton->setShortcut(shortcuts.getSingleShortcut("DeckViewContainer/unloadDeckButton"));
readyStartButton->setShortcut(shortcuts.getSingleShortcut("DeckViewContainer/readyStartButton"));
sideboardLockButton->setShortcut(shortcuts.getSingleShortcut("DeckViewContainer/sideboardLockButton"));
@@ -252,9 +251,8 @@ void DeckViewContainer::unloadDeck()
void DeckViewContainer::loadLocalDeck()
{
DlgLoadDeck dialog(this);
- if (!dialog.exec()) {
+ if (!dialog.exec())
return;
- }
loadDeckFromFile(dialog.selectedFiles().at(0));
}
@@ -366,9 +364,8 @@ void DeckViewContainer::sideboardPlanChanged()
{
Command_SetSideboardPlan cmd;
const QList &newPlan = deckView->getSideboardPlan();
- for (const auto &i : newPlan) {
+ for (const auto &i : newPlan)
cmd.add_move_list()->CopyFrom(i);
- }
parentGame->getGame()->getGameEventHandler()->sendGameCommand(cmd, playerId);
}
@@ -407,9 +404,8 @@ void DeckViewContainer::setSideboardLocked(bool locked)
{
sideboardLockButton->setState(!locked);
deckView->setLocked(readyStartButton->getState() || !sideboardLockButton->getState());
- if (locked) {
+ if (locked)
deckView->resetSideboardPlan();
- }
}
void DeckViewContainer::setDeck(const DeckList &deck)
diff --git a/cockatrice/src/game_graphics/deckview/deck_view_container.h b/cockatrice/src/game/deckview/deck_view_container.h
similarity index 98%
rename from cockatrice/src/game_graphics/deckview/deck_view_container.h
rename to cockatrice/src/game/deckview/deck_view_container.h
index ec024bace..6d685cd79 100644
--- a/cockatrice/src/game_graphics/deckview/deck_view_container.h
+++ b/cockatrice/src/game/deckview/deck_view_container.h
@@ -1,8 +1,8 @@
/**
* @file deck_view_container.h
* @ingroup Lobby
+ * @brief TODO: Document this.
*/
-//! \todo Document this file.
#ifndef DECK_VIEW_CONTAINER_H
#define DECK_VIEW_CONTAINER_H
diff --git a/cockatrice/src/game_graphics/deckview/tabbed_deck_view_container.cpp b/cockatrice/src/game/deckview/tabbed_deck_view_container.cpp
similarity index 100%
rename from cockatrice/src/game_graphics/deckview/tabbed_deck_view_container.cpp
rename to cockatrice/src/game/deckview/tabbed_deck_view_container.cpp
diff --git a/cockatrice/src/game_graphics/deckview/tabbed_deck_view_container.h b/cockatrice/src/game/deckview/tabbed_deck_view_container.h
similarity index 95%
rename from cockatrice/src/game_graphics/deckview/tabbed_deck_view_container.h
rename to cockatrice/src/game/deckview/tabbed_deck_view_container.h
index 7cfa8c9aa..c34eef1ef 100644
--- a/cockatrice/src/game_graphics/deckview/tabbed_deck_view_container.h
+++ b/cockatrice/src/game/deckview/tabbed_deck_view_container.h
@@ -1,8 +1,8 @@
/**
* @file tabbed_deck_view_container.h
* @ingroup Lobby
+ * @brief TODO: Document this.
*/
-//! \todo Document this file.
#ifndef TABBED_DECK_VIEW_CONTAINER_H
#define TABBED_DECK_VIEW_CONTAINER_H
diff --git a/cockatrice/src/game_graphics/dialogs/dlg_create_token.cpp b/cockatrice/src/game/dialogs/dlg_create_token.cpp
similarity index 98%
rename from cockatrice/src/game_graphics/dialogs/dlg_create_token.cpp
rename to cockatrice/src/game/dialogs/dlg_create_token.cpp
index 1a9dc59b2..df264f065 100644
--- a/cockatrice/src/game_graphics/dialogs/dlg_create_token.cpp
+++ b/cockatrice/src/game/dialogs/dlg_create_token.cpp
@@ -20,7 +20,7 @@
#include
#include
#include
-#include
+#include
DlgCreateToken::DlgCreateToken(const QStringList &_predefinedTokens, QWidget *parent)
: QDialog(parent), predefinedTokens(_predefinedTokens)
@@ -101,9 +101,8 @@ DlgCreateToken::DlgCreateToken(const QStringList &_predefinedTokens, QWidget *pa
chooseTokenView->resizeColumnToContents(0);
chooseTokenView->setWordWrap(true);
- if (!deckHeaderState.isNull()) {
+ if (!deckHeaderState.isNull())
chooseTokenView->header()->restoreState(deckHeaderState);
- }
chooseTokenView->header()->setStretchLastSection(false);
chooseTokenView->header()->hideSection(1); // Sets
@@ -186,9 +185,8 @@ void DlgCreateToken::tokenSelectionChanged(const QModelIndex ¤t, const QMo
const QChar cardColor = cardInfo->getColorChar();
colorEdit->setCurrentIndex(colorEdit->findData(cardColor, Qt::UserRole, Qt::MatchFixedString));
ptEdit->setText(cardInfo->getPowTough());
- if (SettingsCache::instance().getAnnotateTokens()) {
+ if (SettingsCache::instance().getAnnotateTokens())
annotationEdit->setText(cardInfo->getText());
- }
} else {
nameEdit->setText("");
colorEdit->setCurrentIndex(colorEdit->findData(QString(), Qt::UserRole, Qt::MatchFixedString));
diff --git a/cockatrice/src/game_graphics/dialogs/dlg_create_token.h b/cockatrice/src/game/dialogs/dlg_create_token.h
similarity index 98%
rename from cockatrice/src/game_graphics/dialogs/dlg_create_token.h
rename to cockatrice/src/game/dialogs/dlg_create_token.h
index 281e161fc..9a18f1a57 100644
--- a/cockatrice/src/game_graphics/dialogs/dlg_create_token.h
+++ b/cockatrice/src/game/dialogs/dlg_create_token.h
@@ -1,8 +1,8 @@
/**
* @file dlg_create_token.h
* @ingroup GameDialogs
+ * @brief TODO: Document this.
*/
-//! \todo Document this file.
#ifndef DLG_CREATETOKEN_H
#define DLG_CREATETOKEN_H
diff --git a/cockatrice/src/game_graphics/dialogs/dlg_move_top_cards_until.cpp b/cockatrice/src/game/dialogs/dlg_move_top_cards_until.cpp
similarity index 100%
rename from cockatrice/src/game_graphics/dialogs/dlg_move_top_cards_until.cpp
rename to cockatrice/src/game/dialogs/dlg_move_top_cards_until.cpp
diff --git a/cockatrice/src/game_graphics/dialogs/dlg_move_top_cards_until.h b/cockatrice/src/game/dialogs/dlg_move_top_cards_until.h
similarity index 97%
rename from cockatrice/src/game_graphics/dialogs/dlg_move_top_cards_until.h
rename to cockatrice/src/game/dialogs/dlg_move_top_cards_until.h
index ac9d41a94..20ba11c5c 100644
--- a/cockatrice/src/game_graphics/dialogs/dlg_move_top_cards_until.h
+++ b/cockatrice/src/game/dialogs/dlg_move_top_cards_until.h
@@ -1,8 +1,8 @@
/**
* @file dlg_move_top_cards_until.h
* @ingroup GameDialogs
+ * @brief TODO: Document this.
*/
-//! \todo Document this file.
#ifndef DLG_MOVE_TOP_CARDS_UNTIL_H
#define DLG_MOVE_TOP_CARDS_UNTIL_H
diff --git a/cockatrice/src/game_graphics/dialogs/dlg_roll_dice.cpp b/cockatrice/src/game/dialogs/dlg_roll_dice.cpp
similarity index 97%
rename from cockatrice/src/game_graphics/dialogs/dlg_roll_dice.cpp
rename to cockatrice/src/game/dialogs/dlg_roll_dice.cpp
index 4f5d5b861..dfb3d0bc5 100644
--- a/cockatrice/src/game_graphics/dialogs/dlg_roll_dice.cpp
+++ b/cockatrice/src/game/dialogs/dlg_roll_dice.cpp
@@ -5,7 +5,7 @@
#include
#include