diff --git a/.ci/compile.sh b/.ci/compile.sh index 7b0f593e9..040345360 100755 --- a/.ci/compile.sh +++ b/.ci/compile.sh @@ -11,7 +11,8 @@ # --debug or --release sets the build type ie CMAKE_BUILD_TYPE # --ccache [] uses ccache and shows stats, optionally provide size # --dir sets the name of the build dir, default is "build" -# uses env: BUILDTYPE MAKE_INSTALL MAKE_PACKAGE PACKAGE_TYPE PACKAGE_SUFFIX MAKE_SERVER MAKE_TEST USE_CCACHE CCACHE_SIZE BUILD_DIR CMAKE_GENERATOR +# --target-macos-version sets the min os version - only used for macOS builds +# uses env: BUILDTYPE MAKE_INSTALL MAKE_PACKAGE PACKAGE_TYPE PACKAGE_SUFFIX MAKE_SERVER MAKE_TEST USE_CCACHE CCACHE_SIZE BUILD_DIR CMAKE_GENERATOR TARGET_MACOS_VERSION # (correspond to args: --debug/--release --install --package --suffix --server --test --ccache --dir ) # exitcode: 1 for failure, 3 for invalid arguments @@ -79,6 +80,15 @@ while [[ $# != 0 ]]; do BUILD_DIR="$1" shift ;; + '--target-macos-version') + shift + if [[ $# == 0 ]]; then + echo "::error file=$0::--target-macos-version expects an argument" + exit 3 + fi + TARGET_MACOS_VERSION="$1" + shift + ;; *) echo "::error file=$0::unrecognized option: $1" exit 3 @@ -139,9 +149,34 @@ function ccachestatsverbose() { # Compile if [[ $RUNNER_OS == macOS ]]; then + if [[ $TARGET_MACOS_VERSION ]]; then + # CMAKE_OSX_DEPLOYMENT_TARGET is a vanilla cmake flag needed to compile to target macOS version + flags+=("-DCMAKE_OSX_DEPLOYMENT_TARGET=$TARGET_MACOS_VERSION") + + # vcpkg dependencies need a vcpkg triplet file to compile to the target macOS version + # an easy way is to copy the x64-osx.cmake file and modify it + triplets_dir="/tmp/cmake/triplets" + triplet_version="custom-triplet" + triplet_file="$triplets_dir/$triplet_version.cmake" + arch=$(uname -m) + if [[ $arch == x86_64 ]]; then + arch="x64" + fi + mkdir -p "$triplets_dir" + cp "../vcpkg/triplets/$arch-osx.cmake" "$triplet_file" + echo "set(VCPKG_CMAKE_SYSTEM_VERSION $TARGET_MACOS_VERSION)" >>"$triplet_file" + echo "set(VCPKG_OSX_DEPLOYMENT_TARGET $TARGET_MACOS_VERSION)" >>"$triplet_file" + flags+=("-DVCPKG_OVERLAY_TRIPLETS=$triplets_dir") + flags+=("-DVCPKG_HOST_TRIPLET=$triplet_version") + flags+=("-DVCPKG_TARGET_TRIPLET=$triplet_version") + echo "::group::Generated triplet $triplet_file" + cat "$triplet_file" + echo "::endgroup::" + fi + echo "::group::Signing Certificate" if [[ -n "$MACOS_CERTIFICATE_NAME" ]]; then - echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12 + echo "$MACOS_CERTIFICATE" | base64 --decode >"certificate.p12" security create-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain security default-keychain -s build.keychain security set-keychain-settings -t 3600 -l build.keychain @@ -153,6 +188,28 @@ if [[ $RUNNER_OS == macOS ]]; then echo "No signing certificate configured. Skipping set up of keychain in macOS environment." fi echo "::endgroup::" + + if [[ $MAKE_PACKAGE ]]; then + # Workaround https://github.com/actions/runner-images/issues/7522 + # have hdiutil repeat the command 10 times in hope of success + hdiutil_script="/tmp/hdiutil.sh" + # shellcheck disable=SC2016 + echo '#!/bin/bash +i=0 +while ! hdiutil "$@"; do + if (( ++i >= 10 )); then + echo "Error: hdiutil failed $i times!" >&2 + break + fi + sleep 1 +done' >"$hdiutil_script" + chmod +x "$hdiutil_script" + flags+=(-DCPACK_COMMAND_HDIUTIL="$hdiutil_script") + fi +elif [[ $RUNNER_OS == Windows ]]; then + # Enable MTT, see https://devblogs.microsoft.com/cppblog/improved-parallelism-in-msbuild/ + # and https://devblogs.microsoft.com/cppblog/cpp-build-throughput-investigation-and-tune-up/#multitooltask-mtt + buildflags+=(-- -p:UseMultiToolTask=true -p:EnableClServerMode=true) fi if [[ $USE_CCACHE ]]; then @@ -167,13 +224,7 @@ cmake .. "${flags[@]}" echo "::endgroup::" echo "::group::Build project" -if [[ $RUNNER_OS == Windows ]]; then - # Enable MTT, see https://devblogs.microsoft.com/cppblog/improved-parallelism-in-msbuild/ - # and https://devblogs.microsoft.com/cppblog/cpp-build-throughput-investigation-and-tune-up/#multitooltask-mtt - cmake --build . "${buildflags[@]}" -- -p:UseMultiToolTask=true -p:EnableClServerMode=true -else - cmake --build . "${buildflags[@]}" -fi +cmake --build . "${buildflags[@]}" echo "::endgroup::" if [[ $USE_CCACHE ]]; then @@ -197,11 +248,6 @@ fi if [[ $MAKE_PACKAGE ]]; then echo "::group::Create package" - if [[ $RUNNER_OS == macOS ]]; then - # Workaround https://github.com/actions/runner-images/issues/7522 - echo "killing XProtectBehaviorService"; sudo pkill -9 XProtect >/dev/null || true; - echo "waiting for XProtectBehaviorService kill"; while pgrep "XProtect"; do sleep 3; done; - fi cmake --build . --target package --config "$BUILDTYPE" echo "::endgroup::" diff --git a/.github/workflows/desktop-build.yml b/.github/workflows/desktop-build.yml index 8a9d6b6b7..fa0706022 100644 --- a/.github/workflows/desktop-build.yml +++ b/.github/workflows/desktop-build.yml @@ -4,25 +4,39 @@ permissions: contents: write id-token: write attestations: write + actions: write # needed for ccache action to be able to delete gha caches on: push: branches: - master - paths-ignore: - - '**.md' - - 'webclient/**' - - '.github/workflows/web-*.yml' - - '.github/workflows/translations-*.yml' - - '.github/workflows/docker-release.yml' + paths: + - '*/**' # matches all files not in root + - '!**.md' + - '!.github/**' + - '!.husky/**' + - '!.tx/**' + - '!doc/**' + - '!webclient/**' + - '.github/workflows/desktop-build.yml' + - 'CMakeLists.txt' + - 'vcpkg.json' + - 'vcpkg' tags: - '*' pull_request: - paths-ignore: - - '**.md' - - 'webclient/**' - - '.github/workflows/web-*.yml' - - '.github/workflows/translations-*.yml' + paths: + - '*/**' # matches all files not in root + - '!**.md' + - '!.github/**' + - '!.husky/**' + - '!.tx/**' + - '!doc/**' + - '!webclient/**' + - '.github/workflows/desktop-build.yml' + - 'CMakeLists.txt' + - 'vcpkg.json' + - 'vcpkg' # Cancel earlier, unfinished runs of this workflow on the same branch (unless on master) concurrency: @@ -232,10 +246,11 @@ jobs: include: - target: 13 soc: Intel - os: macos-13 - xcode: "14.3.1" + os: macos-15-intel + xcode: "16.4" type: Release make_package: 1 + override_target: 13 - target: 14 soc: Apple @@ -247,7 +262,7 @@ jobs: - target: 15 soc: Apple os: macos-15 - xcode: "16.2" + xcode: "16.4" type: Release make_package: 1 @@ -312,6 +327,7 @@ jobs: CMAKE_GENERATOR: '${{env.CMAKE_GENERATOR}}' VCPKG_DISABLE_METRICS: 1 VCPKG_BINARY_SOURCES: 'clear;files,${{ steps.vcpkg-cache.outputs.path }},readwrite' + TARGET_MACOS_VERSION: ${{ matrix.override_target }} run: .ci/compile.sh --server --test --ccache "$CCACHE_SIZE" --vcpkg - name: Sign app bundle diff --git a/.github/workflows/desktop-lint.yml b/.github/workflows/desktop-lint.yml index 39b68eb72..adc4a8860 100644 --- a/.github/workflows/desktop-lint.yml +++ b/.github/workflows/desktop-lint.yml @@ -1,13 +1,22 @@ name: Code Style (C++) on: + # push trigger not needed for linting, we do not allow direct pushes to master pull_request: - paths-ignore: - - '**.md' - - 'webclient/**' - - '.github/workflows/web-*.yml' - - '.github/workflows/translations-*.yml' - - '.github/workflows/docker-release.yml' + paths: + - '*/**' # matches all files not in root + - '!**.md' + - '!.ci/**' + - '!.github/**' + - '!.husky/**' + - '!.tx/**' + - '!doc/**' + - '!webclient/**' + - '.ci/lint_cpp.sh' + - '.github/workflows/desktop-lint.yml' + - '.clang-format' + - '.cmake-format.json' + - 'format.sh' jobs: format: diff --git a/.github/workflows/translations-pull.yml b/.github/workflows/translations-pull.yml index 54bc76b19..7834e06b0 100644 --- a/.github/workflows/translations-pull.yml +++ b/.github/workflows/translations-pull.yml @@ -7,6 +7,7 @@ on: - cron: '0 0 15 1,4,7,10 *' pull_request: paths: + - '.tx/**' - '.github/workflows/translations-pull.yml' jobs: diff --git a/.github/workflows/translations-push.yml b/.github/workflows/translations-push.yml index 5e299bf1f..602845a49 100644 --- a/.github/workflows/translations-push.yml +++ b/.github/workflows/translations-push.yml @@ -7,6 +7,7 @@ on: - cron: '0 0 1 1,4,7,10 *' pull_request: paths: + - '.ci/update_translation_source_strings.sh' - '.github/workflows/translations-push.yml' jobs: @@ -30,10 +31,10 @@ jobs: - name: Update Cockatrice translation source id: cockatrice shell: bash - env: - FILE: 'cockatrice/cockatrice_en@source.ts' - DIRS: 'cockatrice/src common' - run: .ci/update_translation_source_strings.sh + run: | + FILE="cockatrice/cockatrice_en@source.ts" + export DIRS="cockatrice/src $(find . -maxdepth 1 -type d -name 'libcockatrice_*')" + FILE="$FILE" DIRS="$DIRS" .ci/update_translation_source_strings.sh - name: Update Oracle translation source id: oracle diff --git a/.github/workflows/web-build.yml b/.github/workflows/web-build.yml index f328fac88..aba0dbf0b 100644 --- a/.github/workflows/web-build.yml +++ b/.github/workflows/web-build.yml @@ -5,14 +5,16 @@ on: branches: - master paths: - - '.github/workflows/web-*.yml' + - '.husky/**' - 'webclient/**' - '!**.md' + - '.github/workflows/web-build.yml' pull_request: paths: - - '.github/workflows/web-*.yml' + - '.husky/**' - 'webclient/**' - '!**.md' + - '.github/workflows/web-build.yml' jobs: build-web: diff --git a/.github/workflows/web-lint.yml b/.github/workflows/web-lint.yml index 7a962ea55..cb712dd58 100644 --- a/.github/workflows/web-lint.yml +++ b/.github/workflows/web-lint.yml @@ -1,11 +1,12 @@ name: Code Style (TypeScript) on: + # push trigger not needed for linting, we do not allow direct pushes to master pull_request: paths: - - '.github/workflows/web-*.yml' - 'webclient/**' - '!**.md' + - '.github/workflows/web-lint.yml' jobs: ESLint: diff --git a/CMakeLists.txt b/CMakeLists.txt index 4d2e4b145..b4e1c4c71 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -328,7 +328,13 @@ endif() include(CPack) -add_subdirectory(common) +add_subdirectory(${CMAKE_SOURCE_DIR}/libcockatrice_protocol ${CMAKE_BINARY_DIR}/libcockatrice_protocol) +add_subdirectory(${CMAKE_SOURCE_DIR}/libcockatrice_network ${CMAKE_BINARY_DIR}/libcockatrice_network) +add_subdirectory(${CMAKE_SOURCE_DIR}/libcockatrice_deck_list ${CMAKE_BINARY_DIR}/libcockatrice_deck_list) +add_subdirectory(${CMAKE_SOURCE_DIR}/libcockatrice_rng ${CMAKE_BINARY_DIR}/libcockatrice_rng) +add_subdirectory(${CMAKE_SOURCE_DIR}/libcockatrice_settings ${CMAKE_BINARY_DIR}/libcockatrice_settings) +add_subdirectory(${CMAKE_SOURCE_DIR}/libcockatrice_card ${CMAKE_BINARY_DIR}/libcockatrice_card) +add_subdirectory(${CMAKE_SOURCE_DIR}/libcockatrice_utility ${CMAKE_BINARY_DIR}/libcockatrice_utility) if(WITH_SERVER) add_subdirectory(servatrice) set(CPACK_INSTALL_CMAKE_PROJECTS "Servatrice;Servatrice;ALL;/" ${CPACK_INSTALL_CMAKE_PROJECTS}) diff --git a/cockatrice/CMakeLists.txt b/cockatrice/CMakeLists.txt index d2d76bbe5..bd14e3f4d 100644 --- a/cockatrice/CMakeLists.txt +++ b/cockatrice/CMakeLists.txt @@ -7,66 +7,39 @@ 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/card/card_info.cpp - src/card/card_relation.cpp - src/card/card_set.cpp - src/card/card_set_list.cpp - src/card/exact_card.cpp - src/card/printing_info.cpp - src/client/deck_editor_menu.cpp - src/client/get_text_with_max.cpp - src/client/network/client_update_checker.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 src/client/network/parsers/deck_link_to_api_transformer.cpp - src/client/network/release_channel.cpp - src/client/network/replay_timeline_widget.cpp - src/client/network/sets_model.cpp - src/client/network/spoiler_background_updater.cpp - src/client/replay_manager.cpp + src/client/network/update/client/client_update_checker.cpp + src/client/network/update/client/release_channel.cpp + src/client/network/update/card_spoiler/spoiler_background_updater.cpp src/client/sound_engine.cpp - src/client/tapped_out_interface.cpp - src/client/update_downloader.cpp - src/database/card_database.cpp - src/database/card_database_loader.cpp - src/database/card_database_manager.cpp - src/database/card_database_querier.cpp - src/database/model/card_database_model.cpp - src/database/model/card_database_display_model.cpp - src/database/model/card/card_completer_proxy_model.cpp - src/database/model/card/card_search_model.cpp - src/database/model/token/token_display_model.cpp - src/database/model/token/token_edit_model.cpp - src/database/parser/card_database_parser.cpp - src/database/parser/cockatrice_xml_3.cpp - src/database/parser/cockatrice_xml_4.cpp - src/deck/custom_line_edit.cpp - src/deck/deck_list_model.cpp - src/deck/deck_loader.cpp - src/deck/deck_stats_interface.cpp - src/dialogs/dlg_connect.cpp - src/dialogs/dlg_convert_deck_to_cod_format.cpp - src/dialogs/dlg_create_game.cpp - src/dialogs/dlg_default_tags_editor.cpp - src/dialogs/dlg_edit_avatar.cpp - src/dialogs/dlg_edit_password.cpp - src/dialogs/dlg_edit_tokens.cpp - src/dialogs/dlg_edit_user.cpp - src/dialogs/dlg_filter_games.cpp - src/dialogs/dlg_forgot_password_challenge.cpp - src/dialogs/dlg_forgot_password_request.cpp - src/dialogs/dlg_forgot_password_reset.cpp - src/dialogs/dlg_load_deck.cpp - src/dialogs/dlg_load_deck_from_clipboard.cpp - src/dialogs/dlg_load_deck_from_website.cpp - src/dialogs/dlg_load_remote_deck.cpp - src/dialogs/dlg_manage_sets.cpp - src/dialogs/dlg_register.cpp - src/dialogs/dlg_select_set_for_cards.cpp - src/dialogs/dlg_settings.cpp - src/dialogs/dlg_startup_card_check.cpp - src/dialogs/dlg_tip_of_the_day.cpp - src/dialogs/dlg_update.cpp - src/dialogs/dlg_view_log.cpp - src/dialogs/tip_of_the_day.cpp + src/interface/widgets/dialogs/dlg_connect.cpp + src/interface/widgets/dialogs/dlg_convert_deck_to_cod_format.cpp + src/interface/widgets/dialogs/dlg_create_game.cpp + src/interface/widgets/dialogs/dlg_default_tags_editor.cpp + src/interface/widgets/dialogs/dlg_edit_avatar.cpp + src/interface/widgets/dialogs/dlg_edit_password.cpp + src/interface/widgets/dialogs/dlg_edit_tokens.cpp + src/interface/widgets/dialogs/dlg_edit_user.cpp + src/interface/widgets/dialogs/dlg_filter_games.cpp + src/interface/widgets/dialogs/dlg_forgot_password_challenge.cpp + src/interface/widgets/dialogs/dlg_forgot_password_request.cpp + src/interface/widgets/dialogs/dlg_forgot_password_reset.cpp + src/interface/widgets/dialogs/dlg_load_deck.cpp + src/interface/widgets/dialogs/dlg_load_deck_from_clipboard.cpp + src/interface/widgets/dialogs/dlg_load_deck_from_website.cpp + src/interface/widgets/dialogs/dlg_load_remote_deck.cpp + src/interface/widgets/dialogs/dlg_manage_sets.cpp + src/interface/widgets/dialogs/dlg_register.cpp + src/interface/widgets/dialogs/dlg_select_set_for_cards.cpp + src/interface/widgets/dialogs/dlg_settings.cpp + src/interface/widgets/dialogs/dlg_startup_card_check.cpp + src/interface/widgets/dialogs/dlg_tip_of_the_day.cpp + src/interface/widgets/dialogs/dlg_update.cpp + src/interface/widgets/dialogs/dlg_view_log.cpp + src/interface/widgets/dialogs/tip_of_the_day.cpp src/filters/deck_filter_string.cpp src/filters/filter_builder.cpp src/filters/filter_card.cpp @@ -138,9 +111,16 @@ set(cockatrice_SOURCES src/game/zones/table_zone.cpp src/game/zones/view_zone.cpp src/game/zones/view_zone_widget.cpp + src/interface/card_picture_loader/card_picture_loader.cpp + src/interface/card_picture_loader/card_picture_loader_local.cpp + src/interface/card_picture_loader/card_picture_loader_request_status_display_widget.cpp + src/interface/card_picture_loader/card_picture_loader_status_bar.cpp + src/interface/card_picture_loader/card_picture_loader_worker.cpp + src/interface/card_picture_loader/card_picture_loader_worker_work.cpp + src/interface/card_picture_loader/card_picture_to_load.cpp src/interface/layouts/flow_layout.cpp src/interface/layouts/overlap_layout.cpp - src/interface/line_edit_completer.cpp + src/interface/widgets/utility/line_edit_completer.cpp src/interface/pixel_map_generator.cpp src/interface/theme_manager.cpp src/interface/widgets/cards/additional_info/color_identity_widget.cpp @@ -181,6 +161,7 @@ set(cockatrice_SOURCES src/interface/widgets/general/layout_containers/flow_widget.cpp src/interface/widgets/general/layout_containers/overlap_control_widget.cpp src/interface/widgets/general/layout_containers/overlap_widget.cpp + src/interface/widgets/menus/deck_editor_menu.cpp src/interface/widgets/printing_selector/all_zones_card_amount_widget.cpp src/interface/widgets/printing_selector/card_amount_widget.cpp src/interface/widgets/printing_selector/printing_selector.cpp @@ -192,6 +173,22 @@ set(cockatrice_SOURCES src/interface/widgets/printing_selector/set_name_and_collectors_number_display_widget.cpp src/interface/widgets/quick_settings/settings_button_widget.cpp src/interface/widgets/quick_settings/settings_popup_widget.cpp + 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_selector.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_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_widget.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 src/interface/widgets/visual_database_display/visual_database_display_color_filter_widget.cpp src/interface/widgets/visual_database_display/visual_database_display_filter_save_load_widget.cpp src/interface/widgets/visual_database_display/visual_database_display_main_type_filter_widget.cpp @@ -217,94 +214,50 @@ set(cockatrice_SOURCES src/interface/widgets/visual_deck_storage/visual_deck_storage_widget.cpp src/interface/window_main.cpp src/main.cpp - src/picture_loader/picture_loader.cpp - src/picture_loader/picture_loader_local.cpp - src/picture_loader/picture_loader_request_status_display_widget.cpp - src/picture_loader/picture_loader_status_bar.cpp - src/picture_loader/picture_loader_worker.cpp - src/picture_loader/picture_loader_worker_work.cpp - src/picture_loader/picture_to_load.cpp - src/server/abstract_client.cpp - src/server/chat_view/chat_view.cpp - src/server/game_selector.cpp - src/server/games_model.cpp - src/server/handle_public_servers.cpp - src/server/local_client.cpp - src/server/local_server.cpp - src/server/local_server_interface.cpp - src/server/pending_command.cpp - src/server/remote/remote_client.cpp - src/server/remote/remote_decklist_tree_widget.cpp - src/server/remote/remote_replay_list_tree_widget.cpp - src/server/user/user_context_menu.cpp - src/server/user/user_info_box.cpp - src/server/user/user_info_connection.cpp - src/server/user/user_list_manager.cpp - src/server/user/user_list_widget.cpp - src/settings/cache_settings.cpp - src/settings/card_counter_settings.cpp - src/settings/card_database_settings.cpp - src/settings/card_override_settings.cpp - src/settings/debug_settings.cpp - src/settings/download_settings.cpp - src/settings/game_filters_settings.cpp - src/settings/layouts_settings.cpp - src/settings/message_settings.cpp - src/settings/recents_settings.cpp - src/settings/servers_settings.cpp - src/settings/settings_manager.cpp - src/settings/shortcut_treeview.cpp - src/settings/shortcuts_settings.cpp - src/tabs/abstract_tab_deck_editor.cpp - src/tabs/api/edhrec/api_response/archidekt_links/edhrec_api_response_archidekt_links.cpp - src/tabs/api/edhrec/api_response/average_deck/edhrec_average_deck_api_response.cpp - src/tabs/api/edhrec/api_response/average_deck/edhrec_deck_api_response.cpp - src/tabs/api/edhrec/api_response/card_prices/edhrec_api_response_card_prices.cpp - src/tabs/api/edhrec/api_response/cards/edhrec_api_response_card_container.cpp - src/tabs/api/edhrec/api_response/cards/edhrec_api_response_card_details.cpp - src/tabs/api/edhrec/api_response/cards/edhrec_api_response_card_list.cpp - src/tabs/api/edhrec/api_response/cards/edhrec_commander_api_response_commander_details.cpp - src/tabs/api/edhrec/api_response/commander/edhrec_commander_api_response.cpp - src/tabs/api/edhrec/api_response/commander/edhrec_commander_api_response_average_deck_statistics.cpp - src/tabs/api/edhrec/api_response/top_cards/edhrec_top_cards_api_response.cpp - src/tabs/api/edhrec/api_response/top_commanders/edhrec_top_commanders_api_response.cpp - src/tabs/api/edhrec/api_response/top_tags/edhrec_top_tags_api_response.cpp - src/tabs/api/edhrec/display/card_prices/edhrec_api_response_card_prices_display_widget.cpp - src/tabs/api/edhrec/display/cards/edhrec_api_response_card_details_display_widget.cpp - src/tabs/api/edhrec/display/cards/edhrec_api_response_card_inclusion_display_widget.cpp - src/tabs/api/edhrec/display/cards/edhrec_api_response_card_list_display_widget.cpp - src/tabs/api/edhrec/display/cards/edhrec_api_response_card_synergy_display_widget.cpp - src/tabs/api/edhrec/display/commander/edhrec_api_response_commander_details_display_widget.cpp - src/tabs/api/edhrec/display/commander/edhrec_commander_api_response_display_widget.cpp - src/tabs/api/edhrec/display/commander/edhrec_commander_api_response_navigation_widget.cpp - src/tabs/api/edhrec/display/top_cards/edhrec_top_cards_api_response_display_widget.cpp - src/tabs/api/edhrec/display/top_commander/edhrec_top_commanders_api_response_display_widget.cpp - src/tabs/api/edhrec/display/top_tags/edhrec_top_tags_api_response_display_widget.cpp - src/tabs/api/edhrec/tab_edhrec.cpp - src/tabs/api/edhrec/tab_edhrec_main.cpp - src/tabs/tab.cpp - src/tabs/tab_account.cpp - src/tabs/tab_admin.cpp - src/tabs/tab_deck_editor.cpp - src/tabs/tab_deck_storage.cpp - src/tabs/tab_game.cpp - src/tabs/tab_home.cpp - src/tabs/tab_logs.cpp - src/tabs/tab_message.cpp - src/tabs/tab_replays.cpp - src/tabs/tab_room.cpp - src/tabs/tab_server.cpp - src/tabs/tab_supervisor.cpp - src/tabs/tab_visual_database_display.cpp - src/tabs/visual_deck_editor/tab_deck_editor_visual.cpp - src/tabs/visual_deck_editor/tab_deck_editor_visual_tab_widget.cpp - src/tabs/visual_deck_storage/tab_deck_storage_visual.cpp - src/utility/card_info_comparator.cpp - src/utility/deck_list_sort_filter_proxy_model.cpp - src/utility/key_signals.cpp - src/utility/levenshtein.cpp - src/utility/logger.cpp - src/utility/sequence_edit.cpp + src/interface/widgets/tabs/abstract_tab_deck_editor.cpp + src/interface/widgets/tabs/api/edhrec/api_response/archidekt_links/edhrec_api_response_archidekt_links.cpp + src/interface/widgets/tabs/api/edhrec/api_response/average_deck/edhrec_average_deck_api_response.cpp + src/interface/widgets/tabs/api/edhrec/api_response/average_deck/edhrec_deck_api_response.cpp + src/interface/widgets/tabs/api/edhrec/api_response/card_prices/edhrec_api_response_card_prices.cpp + src/interface/widgets/tabs/api/edhrec/api_response/cards/edhrec_api_response_card_container.cpp + src/interface/widgets/tabs/api/edhrec/api_response/cards/edhrec_api_response_card_details.cpp + src/interface/widgets/tabs/api/edhrec/api_response/cards/edhrec_api_response_card_list.cpp + src/interface/widgets/tabs/api/edhrec/api_response/cards/edhrec_commander_api_response_commander_details.cpp + src/interface/widgets/tabs/api/edhrec/api_response/commander/edhrec_commander_api_response.cpp + src/interface/widgets/tabs/api/edhrec/api_response/commander/edhrec_commander_api_response_average_deck_statistics.cpp + src/interface/widgets/tabs/api/edhrec/api_response/top_cards/edhrec_top_cards_api_response.cpp + src/interface/widgets/tabs/api/edhrec/api_response/top_commanders/edhrec_top_commanders_api_response.cpp + src/interface/widgets/tabs/api/edhrec/api_response/top_tags/edhrec_top_tags_api_response.cpp + src/interface/widgets/tabs/api/edhrec/display/card_prices/edhrec_api_response_card_prices_display_widget.cpp + src/interface/widgets/tabs/api/edhrec/display/cards/edhrec_api_response_card_details_display_widget.cpp + src/interface/widgets/tabs/api/edhrec/display/cards/edhrec_api_response_card_inclusion_display_widget.cpp + src/interface/widgets/tabs/api/edhrec/display/cards/edhrec_api_response_card_list_display_widget.cpp + src/interface/widgets/tabs/api/edhrec/display/cards/edhrec_api_response_card_synergy_display_widget.cpp + src/interface/widgets/tabs/api/edhrec/display/commander/edhrec_api_response_commander_details_display_widget.cpp + src/interface/widgets/tabs/api/edhrec/display/commander/edhrec_commander_api_response_display_widget.cpp + src/interface/widgets/tabs/api/edhrec/display/commander/edhrec_commander_api_response_navigation_widget.cpp + src/interface/widgets/tabs/api/edhrec/display/top_cards/edhrec_top_cards_api_response_display_widget.cpp + src/interface/widgets/tabs/api/edhrec/display/top_commander/edhrec_top_commanders_api_response_display_widget.cpp + src/interface/widgets/tabs/api/edhrec/display/top_tags/edhrec_top_tags_api_response_display_widget.cpp + src/interface/widgets/tabs/api/edhrec/tab_edhrec.cpp + src/interface/widgets/tabs/api/edhrec/tab_edhrec_main.cpp + 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_deck_editor.cpp + src/interface/widgets/tabs/tab_deck_storage.cpp + src/interface/widgets/tabs/tab_game.cpp + src/interface/widgets/tabs/tab_home.cpp + src/interface/widgets/tabs/tab_logs.cpp + src/interface/widgets/tabs/tab_message.cpp + src/interface/widgets/tabs/tab_replays.cpp + src/interface/widgets/tabs/tab_room.cpp + src/interface/widgets/tabs/tab_server.cpp + src/interface/widgets/tabs/tab_supervisor.cpp + src/interface/widgets/tabs/tab_visual_database_display.cpp + src/interface/widgets/tabs/visual_deck_editor/tab_deck_editor_visual.cpp + src/interface/widgets/tabs/visual_deck_editor/tab_deck_editor_visual_tab_widget.cpp + src/interface/widgets/tabs/visual_deck_storage/tab_deck_storage_visual.cpp ) add_subdirectory(sounds) @@ -316,15 +269,23 @@ configure_file( set(cockatrice_RESOURCES cockatrice.qrc) if(UPDATE_TRANSLATIONS) + # Cockatrice main sources file(GLOB_RECURSE translate_cockatrice_SRCS ${CMAKE_SOURCE_DIR}/cockatrice/src/*.cpp ${CMAKE_SOURCE_DIR}/cockatrice/src/*.h ) - file(GLOB_RECURSE translate_common_SRCS ${CMAKE_SOURCE_DIR}/common/*.cpp ${CMAKE_SOURCE_DIR}/common/*.h) - set(translate_SRCS ${translate_cockatrice_SRCS} ${translate_common_SRCS}) + + # All libcockatrice_* libraries (recursively) + file(GLOB_RECURSE translate_lib_SRCS ${CMAKE_SOURCE_DIR}/libcockatrice_*/**/*.cpp + ${CMAKE_SOURCE_DIR}/libcockatrice_*/**/*.h + ) + + # Combine all sources for translation + set(translate_SRCS ${translate_cockatrice_SRCS} ${translate_lib_SRCS}) + set(cockatrice_TS "${CMAKE_CURRENT_SOURCE_DIR}/cockatrice_en@source.ts") else() file(GLOB cockatrice_TS "${CMAKE_CURRENT_SOURCE_DIR}/translations/*.ts") -endif(UPDATE_TRANSLATIONS) +endif() if(WIN32) set(cockatrice_SOURCES ${cockatrice_SOURCES} cockatrice.rc) @@ -354,12 +315,6 @@ set(DESKTOPDIR CACHE STRING "desktop file destination" ) -# Include directories -include_directories(../common) -include_directories(${PROTOBUF_INCLUDE_DIR}) -include_directories(${CMAKE_BINARY_DIR}/common) -include_directories(${CMAKE_CURRENT_BINARY_DIR}) - set(COCKATRICE_MAC_QM_INSTALL_DIR "cockatrice.app/Contents/Resources/translations") set(COCKATRICE_UNIX_QM_INSTALL_DIR "share/cockatrice/translations") set(COCKATRICE_WIN32_QM_INSTALL_DIR "translations") @@ -399,9 +354,20 @@ elseif(Qt5_FOUND) endif() if(Qt5_FOUND) - target_link_libraries(cockatrice cockatrice_common ${COCKATRICE_QT_MODULES}) + target_link_libraries( + cockatrice + libcockatrice_card + libcockatrice_deck_list + libcockatrice_utility + libcockatrice_network + libcockatrice_rng + ${COCKATRICE_QT_MODULES} + ) else() - target_link_libraries(cockatrice PUBLIC cockatrice_common ${COCKATRICE_QT_MODULES}) + target_link_libraries( + cockatrice PUBLIC libcockatrice_card libcockatrice_deck_list libcockatrice_utility libcockatrice_network + libcockatrice_rng ${COCKATRICE_QT_MODULES} + ) endif() if(UNIX) diff --git a/cockatrice/cockatrice_en@source.ts b/cockatrice/cockatrice_en@source.ts index 5a3b88d09..c4589d071 100644 --- a/cockatrice/cockatrice_en@source.ts +++ b/cockatrice/cockatrice_en@source.ts @@ -38,66 +38,66 @@ 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 - + No deck was selected to be exported. @@ -118,12 +118,12 @@ Please check that the directory is writable and try again. AllZonesCardAmountWidget - + Mainboard - + Sideboard @@ -146,143 +146,170 @@ Please check that the directory is writable and try again. - - Theme settings + + Enabling this feature will disable the use of the Printing Selector. + +You will not be able to manage printing preferences on a per-deck basis, or see printings other people have selected for their decks. + +You will have to use the Set Manager, available through Card Database -> Manage Sets. + +Are you sure you would like to enable this feature? - - Current theme: + + Disabling this feature will enable the Printing Selector. + +You can now choose printings on a per-deck basis in the Deck Editor and configure which printing gets added to a deck by default by pinning it in the Printing Selector. + +You can also use the Set Manager to adjust custom sort order for printings in the Printing Selector (other sort orders like alphabetical or release date are available). + +Are you sure you would like to disable this feature? - - Open themes folder - - - - - Home tab background source: - - - - - Home tab background shuffle frequency: - - - - - Disabled - - - - - Menu settings - - - - - Show keyboard shortcuts in right-click menus - - - - - 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) [Requires Client restart] - - - - - Bump sets that the deck contains cards from to the top in the printing selector - - - - - Scale cards on mouse over - - - - - Use rounded card corners - - - - - 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 + + Confirm Change - Invert vertical coordinate + Theme settings - Minimum player count for multi-column layout: + Current theme: + Open themes folder + + + + + Home tab background source: + + + + + Home tab background shuffle frequency: + + + + + Disabled + + + + + Menu settings + + + + + Show keyboard shortcuts in right-click menus + + + + + 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) + + + + + Bump sets that the deck contains cards from to the top in the printing selector + + + + + Scale cards on mouse over + + + + + Use rounded card corners + + + + + 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: @@ -290,17 +317,17 @@ Please check that the directory is writable and try again. BackgroundSources - + Theme - + Art crop of random card - + Art crop of background.cod deck file @@ -443,32 +470,32 @@ This is only saved for moderators and cannot be seen by the banned person. CardDatabaseModel - + Name - + Sets - + Mana cost - + Card type - + P/T - + Color(s) @@ -573,22 +600,22 @@ This is only saved for moderators and cannot be seen by the banned person. CardInfoFrameWidget - + Image - + Description - + Both - + View transformation @@ -596,22 +623,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 @@ -619,17 +646,17 @@ This is only saved for moderators and cannot be seen by the banned person. CardInfoTextWidget - + Name: - + Related cards: - + Unknown card: @@ -637,124 +664,124 @@ 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 / Untap Turn sideways or back again - + Toggle &normal untapping - + T&urn Over Turn face up/face down - + &Peek at card face - + &Clone - + Attac&h to card... - + Unattac&h - + &Draw arrow... - + &Set annotation... - + Ca&rd counters - + &Add counter (%1) - + &Remove counter (%1) - + &Set counters (%1)... @@ -762,7 +789,7 @@ This is only saved for moderators and cannot be seen by the banned person. CardSizeWidget - + Card Size @@ -905,7 +932,7 @@ This is only saved for moderators and cannot be seen by the banned person. CockatriceXml3Parser - + Parse error at line %1 col %2: @@ -913,7 +940,7 @@ This is only saved for moderators and cannot be seen by the banned person. CockatriceXml4Parser - + Parse error at line %1 col %2: @@ -935,7 +962,7 @@ This is only saved for moderators and cannot be seen by the banned person. DeckEditorCardInfoDockWidget - + Card Info @@ -943,47 +970,47 @@ This is only saved for moderators and cannot be seen by the banned person. 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 @@ -991,87 +1018,87 @@ This is only saved for moderators and cannot be seen by the banned person. DeckEditorDeckDockWidget - + Banner Card - + Main Type - + Mana Cost - + Colors - + Select Printing - + Deck - + Deck &name: - + Banner Card/Tags Visibility Settings - + Show banner card selection menu - + Show tags selection menu - + &Comments: - + Group by: - + Hash: - + &Increment number - + &Decrement number - + &Remove row - + Swap card to/from sideboard @@ -1079,17 +1106,17 @@ This is only saved for moderators and cannot be seen by the banned person. DeckEditorFilterDockWidget - + Filters - + &Clear all filters - + Delete selected @@ -1097,114 +1124,114 @@ This is only saved for moderators and cannot be seen by the banned person. DeckEditorMenu - + &Deck Editor - + &New deck - + &Load deck... - + Load recent deck... - + Clear - + &Save deck - + Save deck &as... - + Load deck from cl&ipboard... - + Edit deck in clipboard - - + + Annotated - - + + Not Annotated - + Save deck to clipboard - + Annotated (No set info) - + Not Annotated (No set info) - + &Print deck... - + Load deck from online service... - + &Send deck to online service - + Create decklist (decklist.org) - + Create decklist (decklist.xyz) - + Analyze deck (deckstats.net) - + Analyze deck (tappedout.net) - + &Close @@ -1212,7 +1239,7 @@ This is only saved for moderators and cannot be seen by the banned person. DeckEditorPrintingSelectorDockWidget - + Printing Selector @@ -1220,166 +1247,166 @@ This is only saved for moderators and cannot be seen by the banned person. 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 @@ -1428,17 +1455,17 @@ This is only saved for moderators and cannot be seen by the banned person. DeckPreviewColorIdentityFilterWidget - + Mode: Exact Match - + Mode: Includes - + Color identity filter mode (AND/OR/NOT conjunctions of filters) @@ -1446,7 +1473,7 @@ This is only saved for moderators and cannot be seen by the banned person. DeckPreviewDeckTagsDisplayWidget - + Edit tags ... @@ -1454,62 +1481,62 @@ This is only saved for moderators and cannot be seen by the banned person. DeckPreviewTagDialog - + Deck Tags Manager - + Manage your deck tags. Check or uncheck tags as needed, or add new ones: - + Add a new tag (e.g., Aggro️) - + Add Tag - + Filter tags... - + OK - + Edit default tags - + Cancel - + Invalid Input - + Tag name cannot be empty! - + Duplicate Tag - + This tag already exists. @@ -1517,94 +1544,94 @@ This is only saved for moderators and cannot be seen by the banned person. DeckPreviewWidget - + Banner Card - + Open in deck editor - + Edit Tags - + Rename Deck - + Save Deck to Clipboard - + Annotated - + Annotated (No set info) - + Not Annotated - + Not Annotated (No set info) - + Rename File - + Delete File - + Set Banner Card - - + + New name: - - + + Error - + Rename failed - + Delete file - + Are you sure you want to delete the selected file? - + Delete failed @@ -1612,13 +1639,13 @@ This is only saved for moderators and cannot be seen by the banned person. DeckStatsInterface - - + + Error - + The reply from the server could not be parsed. @@ -1648,7 +1675,6 @@ This is only saved for moderators and cannot be seen by the banned person. Unload deck - Unload deck... @@ -1722,148 +1748,148 @@ This will kick all non-ready players from the game. DlgConnect - + Downloading... - + Known Hosts - + Delete the currently selected saved server - + Refresh the server list with known public servers - + New Host - + Name: - + &Host: - + &Port: - + Player &name: - + P&assword: - + &Save password - + A&uto connect - + Automatically connect to the most recent login when Cockatrice opens - + If you have any trouble connecting or registering then contact the server staff for help! - - + + Webpage - + Reset Password - + Forgot password? - + &Connect - + Server - + Login - + Server Contact - + Connect to Server - + 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. @@ -1961,27 +1987,27 @@ This will kick all non-ready players from the game. - + &Clear - + Create game - + Game information - + Error - + Server error. @@ -1989,97 +2015,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 @@ -2087,53 +2113,53 @@ This will kick all non-ready players from the game. DlgDefaultTagsEditor - + Edit Tags - + Add - + Confirm - + Cancel - + Enter a tag and press Enter - - + + - + Invalid Input - + Tag name cannot be empty! - + Duplicate Tag - + This tag already exists. @@ -2141,39 +2167,39 @@ This will kick all non-ready players from the game. DlgEditAvatar - - + + No image chosen. - + To change your avatar, choose a new image. To remove your current avatar, confirm without choosing a new image. - + Browse... - + Change avatar - + Open Image - + Image Files (*.png *.jpg *.bmp) - + Invalid image chosen. @@ -2199,38 +2225,38 @@ To remove your current avatar, confirm without choosing a new image. DlgEditPassword - + Old password: - + New password: - + Confirm new password: - + Change password - - + + Error - + Your password is too short. - + The new passwords don't match. @@ -2238,93 +2264,93 @@ To remove your current avatar, confirm without choosing a new image. DlgEditTokens - + &Name: - + C&olor: - + white - + blue - + black - + red - + green - + multicolor - + colorless - + &P/T: - + &Annotation: - + Token data - - + + Add token - + Remove token - + Edit custom tokens - + Please enter the name of the token: - + 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. @@ -2333,27 +2359,27 @@ Make sure to enable the 'Token' set in the "Manage sets" dia DlgEditUser - + Email: - + Country: - + Undefined - + Real name: - + Edit user profile @@ -2504,52 +2530,52 @@ Make sure to enable the 'Token' set in the "Manage sets" dia DlgForgotPasswordChallenge - + Reset Password Challenge Warning - + A problem has occurred. Please try to request a new password again. - + Enter the information of the server and the account you'd like to request a new password for. - + &Host: - + &Port: - + Player &name: - + Email: - + Reset Password Challenge - + Reset Password Challenge Error - + The email address can't be empty. @@ -2557,37 +2583,37 @@ Make sure to enable the 'Token' set in the "Manage sets" dia DlgForgotPasswordRequest - + Enter the information of the server you'd like to request a new password for. - + &Host: - + &Port: - + Player &name: - + Reset Password Request - + Reset Password Error - + The player name can't be empty. @@ -2595,86 +2621,86 @@ Make sure to enable the 'Token' set in the "Manage sets" dia DlgForgotPasswordReset - + Reset Password Warning - + A problem has occurred. Please try to request a new password again. - + Enter the received token and the new password in order to set your new password. - + &Host: - + &Port: - + Player &name: - + Token: - - + + New Password: - + Reset Password - + The player name can't be empty. - - - - + + + + Reset Password Error - + The token can't be empty. - + The new password can't be empty. - + Error - + Your password is too short. - + The passwords do not match. @@ -2682,7 +2708,7 @@ Make sure to enable the 'Token' set in the "Manage sets" dia DlgLoadDeck - + Load Deck @@ -2766,37 +2792,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 @@ -2804,91 +2830,91 @@ https://tappedout.net/mtg-decks/your-deck-name/ DlgRegister - + Enter your information and the information of the server you'd like to register to. Your email will be used to verify your account. - + &Host: - + &Port: - + Player &name: - + P&assword: - + Password (again): - + Email: - + Email (again): - + Country: - + Undefined - + 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. @@ -2896,17 +2922,17 @@ Your email will be used to verify your account. DlgRollDice - + Number of sides: - + Number of dice: - + Roll Dice @@ -2942,12 +2968,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 @@ -2958,7 +2984,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 @@ -2969,7 +2995,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 @@ -2978,21 +3004,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 @@ -3001,59 +3027,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 - + Card Sources - + Chat - + Sound - + Shortcuts @@ -3061,39 +3087,39 @@ Would you like to change your database location setting? DlgStartupCardCheck - + Card Update Check - + It has been more than %2 days since you last checked your card database for updates. Choose how you would like to run the card database updater. You can always change this behavior in the 'General' settings tab. - + Run in foreground - + Run in background - + Run in background and always from now on - + Don't prompt again and don't run - + Don't run this time @@ -3160,7 +3186,6 @@ Please visit the download page to update manually. Downloading update: %1 - Downloading update... @@ -3237,14 +3262,11 @@ 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. - Unfortunately there are no download packages available for your operating system. -You may have to build from source yourself. Please check the <a href="%1">releases page</a> on our Github and download the build for your system. - Please check the download page manually and visit the wiki for instructions on compiling. @@ -3288,17 +3310,17 @@ You may have to build from source yourself. DlgViewLog - + Clear log when closing - + Copy to clipboard - + Debug Log @@ -3306,12 +3328,12 @@ You may have to build from source yourself. EdhrecApiResponseCardInclusionDisplayWidget - + In %1 decks - + %1% of %2 decks @@ -3319,47 +3341,47 @@ You may have to build from source yourself. EdhrecApiResponseCardPricesDisplayWidget - + Card Hoarder - + Card Kingdom - + Card Market - + Face 2-Face - + Mana Pool - + MTG Stocks - + Scg - + Tcgl - + Tcgplayer @@ -3367,7 +3389,7 @@ You may have to build from source yourself. EdhrecApiResponseCardSynergyDisplayWidget - + %1% Synergy @@ -3375,22 +3397,22 @@ You may have to build from source yourself. EdhrecCommanderApiResponseNavigationWidget - + Combos - + Average Deck - + Game Changers - + Budget @@ -3398,7 +3420,7 @@ You may have to build from source yourself. EdhrecCommanderResponseCommanderDetailsDisplayWidget - + Salt: @@ -3414,22 +3436,22 @@ You may have to build from source yourself. FilterDisplayWidget - + Confirm Delete - + Are you sure you want to delete the filter '%1'? - + Delete Failed - + Failed to delete filter '%1'. @@ -3437,22 +3459,22 @@ You may have to build from source yourself. GameEventHandler - + kicked by game host or moderator - + player left the game - + player disconnected from server - + reason unknown @@ -3460,120 +3482,120 @@ You may have to build from source yourself. 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 - + Password: - + Please join the respective room first. - + &Filter games - + C&lear filter - + C&reate - + &Join - + J&oin as spectator - + Games shown: %1 / %2 - + Games @@ -3581,12 +3603,12 @@ You may have to build from source yourself. GamesModel - + >1 day - + %1%2 hr short age in hours @@ -3595,12 +3617,12 @@ You may have to build from source yourself. - + new - + %1%2 min short age in minutes @@ -3609,83 +3631,83 @@ You may have to build from source yourself. - + 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 @@ -3837,42 +3859,47 @@ You may have to build from source yourself. GraveyardMenu - + &Graveyard - + &View graveyard - + &Move graveyard to... - + &Top of library - + &Bottom of library - + + &All players + + + + &Hand - + &Exile - + Reveal random card to... @@ -3880,105 +3907,111 @@ You may have to build from source yourself. HandMenu - + &Hand - + &View hand - + &Sort hand - + Take &mulligan - + &Move hand to... - + &Top of library - + &Bottom of library - + &Graveyard - + &Exile - + &Reveal hand to... - + Reveal r&andom card to... + + + + &All players + + HomeWidget - + Create New Deck - + Browse Decks - + Browse Card Database - + Browse EDHRec - + View Replays - + Quit - + Connecting... - + Connect - + Play @@ -3986,238 +4019,254 @@ You may have to build from source yourself. 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 &exile... - + 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 &exile... - + Put bottom card on &top - + Shuffle bottom cards... + + + + &All players + + + + + Reveal top cards of library + + + + + Number of cards: (max. %1) + + 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 @@ -4227,602 +4276,602 @@ Reason for shutdown: %1 - + Scheduled server shutdown - - + + Success - + Registration accepted. Will now login. - + Account activation accepted. Will now login. - + Number of players - + Please enter the number of players. - - + + 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 - + Server timeout - + 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'. - + 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. - + 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. - - - - - - + + + + + + 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 - + 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? @@ -4832,81 +4881,81 @@ Do you want to enable it/them? - + 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. @@ -4914,54 +4963,54 @@ 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. @@ -4969,8 +5018,8 @@ Cockatrice will now reload the card database. ManaBaseWidget - - + + Mana Base @@ -4978,8 +5027,8 @@ Cockatrice will now reload the card database. ManaCurveWidget - - + + Mana Curve @@ -4987,8 +5036,8 @@ Cockatrice will now reload the card database. ManaDevotionWidget - - + + Mana Devotion @@ -4996,277 +5045,277 @@ 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. - + %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. - + %1 moves %2%3 to custom zone '%4'. - + %1 tries to draw from an empty library - + %1 draws %2 card(s). @@ -5274,14 +5323,13 @@ Cockatrice will now reload the card database. - + %1 is looking at %2. - + %1 is looking at the %4 %3 card(s) %2. - %1 is looking at the top %3 card(s) %2. top card for singular, top %3 cards for plural @@ -5289,72 +5337,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). @@ -5362,28 +5410,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. - + cards an unknown amount of cards - + %1 card(s) a card for singular, %1 cards for plural @@ -5392,107 +5440,107 @@ 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" counter(s) on %4 (now %5). @@ -5500,7 +5548,7 @@ Cockatrice will now reload the card database. - + %1 removes %2 "%3" counter(s) from %4 (now %5). @@ -5508,97 +5556,97 @@ Cockatrice will now reload the card database. - + %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). @@ -5606,110 +5654,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 - - + + 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 @@ -5755,52 +5803,52 @@ Cockatrice will now reload the card database. Mtg - + Card Type - + Mana Value - + Color(s) - + Loyalty - + Main Card Type - + Mana Cost - + P/T - + Side - + Layout - + Color Identity @@ -5808,17 +5856,17 @@ Cockatrice will now reload the card database. OverlapControlWidget - + Cards to overlap: - + Overlap percentage: - + Overlap direction: @@ -5889,57 +5937,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 @@ -5947,7 +5995,7 @@ Cockatrice will now reload the card database. PictureLoader - + en code for scryfall's language property, not available for all languages @@ -5956,134 +6004,134 @@ Cockatrice will now reload the card database. PlayerActions - + 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 - + Move top cards to grave - + Move top cards to exile - + Move bottom cards to grave - + Move bottom cards to exile - + 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 @@ -6091,32 +6139,17 @@ Cockatrice will now reload the card database. PlayerMenu - - Reveal top cards of library - - - - - Number of cards: (max. %1) - - - - + Player "%1" - + &Counters - - &All players - - - - + S&ay @@ -6124,7 +6157,7 @@ Cockatrice will now reload the card database. PrintingSelector - + Display Navigation Buttons @@ -6132,22 +6165,22 @@ Cockatrice will now reload the card database. PrintingSelectorCardOverlayWidget - + Preference - + Pin Printing - + Unpin Printing - + Show Related cards @@ -6155,7 +6188,7 @@ Cockatrice will now reload the card database. PrintingSelectorCardSearchWidget - + Search by set name or set code @@ -6163,17 +6196,17 @@ Cockatrice will now reload the card database. PrintingSelectorCardSelectionWidget - + Previous Card in Deck - + Bulk Selection - + Next Card in Deck @@ -6181,28 +6214,28 @@ Cockatrice will now reload the card database. PrintingSelectorCardSortingWidget - + Alphabetical - + Preference - + Release Date - - + + Descending - + Ascending @@ -6268,37 +6301,37 @@ Cockatrice will now reload the card database. QMenuBar - + Services - + Hide %1 - + Hide Others - + Show All - + Preferences... - + Quit %1 - + About %1 @@ -6306,42 +6339,42 @@ Cockatrice will now reload the card database. QObject - + Cockatrice card database (*.xml) - + All files (*.*) - + Cockatrice replays (*.cor) - + Maindeck - + Sideboard - + Tokens - + Overwrite Existing File? - + A .cod version of this deck already exists. Overwrite it? @@ -6349,92 +6382,92 @@ Cockatrice will now reload the card database. 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 @@ -6442,17 +6475,17 @@ Cockatrice will now reload the card database. RemoteDeckList_TreeModel - + Name - + ID - + Upload time @@ -6460,32 +6493,32 @@ Cockatrice will now reload the card database. RemoteReplayList_TreeModel - + ID - + Name - + Players - + Keep - + Time started - + Duration (sec) @@ -6531,37 +6564,37 @@ Cockatrice will now reload the card database. RoomSelector - + Rooms - + Joi&n - + Room - + Description - + Permissions - + Players - + Games @@ -6569,32 +6602,32 @@ Cockatrice will now reload the card database. SequenceEdit - + Choose an action from the table - + Hit the key/combination of keys you want to set for this action - + Invalid key - + Shortcut already in use by: - + Clear - + Restore default @@ -6630,53 +6663,53 @@ Cockatrice will now reload the card database. 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 @@ -6684,12 +6717,12 @@ Cockatrice will now reload the card database. ShortcutTreeView - + Action - + Shortcut @@ -6697,13 +6730,13 @@ Cockatrice will now reload the card database. ShortcutsSettings - + Your configuration file contained invalid shortcuts. Please check your shortcut settings! - + The following shortcuts have been set to default: @@ -6712,17 +6745,17 @@ Please check your shortcut settings! ShutdownDialog - + &Reason for shutdown: - + &Time until shutdown (minutes): - + Shut down server @@ -6743,27 +6776,27 @@ Please check your shortcut settings! SoundSettingsPage - + Enable &sounds - + Current sounds theme: - + Test system sound engine - + Sound settings - + Master volume @@ -6848,17 +6881,17 @@ Please check your shortcut settings! TabAccount - + Add to Buddy List - + Add to Ignore List - + Account @@ -6866,112 +6899,112 @@ Please check your shortcut settings! TabAdmin - + Administration - + Update server &message - + &Shut down server - + &Reload configuration - + Server administration functions - + Server moderator functions - + Replay ID - + Grant Replay Access - + Username to Activate - + Force Activate User - + &Unlock functions - + &Lock functions - - + + Success - + Replay access granted - - - - - + + + + + Error - + Unable to grant replay access. Replay ID invalid - + Unable to grant replay access. Internal error - + User successfully activated - + Unable to activate user. Username invalid - + Unable to activate user. User already active - + Unable to activate user. Internal error @@ -6979,53 +7012,53 @@ Please check your shortcut settings! TabDeckEditor - + Card Info - + Deck - + Filters - + &View - + Printing - - - - + + + + Visible - - - - + + + + Floating - + Reset layout - + Deck: %1 @@ -7033,61 +7066,61 @@ Please check your shortcut settings! TabDeckEditorVisual - + Visual Deck: %1 - + &Visual Deck Editor - - + + Card Info - - + + Deck - - + + Filters - + &View - + Printing - - - - + + + + Visible - - - - + + + + Floating - + Reset layout @@ -7095,22 +7128,22 @@ Please check your shortcut settings! TabDeckEditorVisualTabWidget - + Visual Deck View - + Visual Database Display - + Deck Analytics - + Sample Hand @@ -7118,138 +7151,138 @@ 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: - + Deck Storage @@ -7257,17 +7290,17 @@ Please enter a name: TabDeckStorageVisual - + Visual Deck Storage - + Error - + Could not open deck at %1 @@ -7275,7 +7308,7 @@ Please enter a name: TabEdhRec - + EDHREC: @@ -7283,229 +7316,230 @@ Please enter a name: TabEdhRecMain - + &Cards - + Top Commanders - + Tags - + Search for a card ... - + Search - + EDHRec: - EDHREC: 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. @@ -7513,7 +7547,7 @@ Please enter a name: TabHome - + Home @@ -7521,157 +7555,157 @@ Please enter a name: TabLog - + Logs - - - + + + Time;SenderName;SenderIP;Message;TargetID;TargetName - + Room Logs - + Game Logs - + Chat Logs - - + + Error - + You must select at least one filter. - + You have to select a valid number of days to locate. - + 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. @@ -7679,37 +7713,37 @@ The more information you put in, the more specific your results will be. TabMessage - + Private &chat - + &Leave - + %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. @@ -7717,185 +7751,185 @@ 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 - + Game Replays @@ -7903,47 +7937,47 @@ The more information you put in, the more specific your results will be. TabRoom - + &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. @@ -7951,35 +7985,35 @@ The more information you put in, the more specific your results will be. TabServer - + Server - - - - + + + + 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. @@ -7987,92 +8021,92 @@ The more information you put in, the more specific your results will be. TabSupervisor - + Deck Editor - + Visual Deck Editor - + EDHRec - + 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. @@ -8080,38 +8114,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) @@ -8120,7 +8154,7 @@ Please refrain from engaging in this activity or further actions may be taken ag TabVisualDatabaseDisplay - + Visual Database Display @@ -8128,13 +8162,13 @@ Please refrain from engaging in this activity or further actions may be taken ag TappedOutInterface - - + + Error - + Unable to analyze the deck. @@ -8142,13 +8176,13 @@ Please refrain from engaging in this activity or further actions may be taken ag TipsOfTheDay - + File does not exist. - + Failed to open file. @@ -8157,42 +8191,42 @@ Please refrain from engaging in this activity or further actions may be taken ag TranslateCounterName - + Life - + White - + Blue - + Black - + Red - + Green - + Colorless - + Other @@ -8595,137 +8629,137 @@ Please refrain from engaging in this activity or further actions may be taken ag 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 - + Close card view window when last card is removed - + Auto focus search bar when card view window is opened - + Annotate card text on tokens - + Use tear-off menus, allowing right click menus to persist on screen - + 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: @@ -8789,22 +8823,22 @@ Please refrain from engaging in this activity or further actions may be taken ag VisualDatabaseDisplayColorFilterWidget - + Mode: Exact Match - + Mode: Includes - + Mode: Include/Exclude - + Filter mode (AND/OR/NOT conjunctions of filters) @@ -8812,17 +8846,17 @@ Please refrain from engaging in this activity or further actions may be taken ag VisualDatabaseDisplayFilterSaveLoadWidget - + Save Filter - + Save all currently applied filters to a file - + Enter filename... @@ -8830,22 +8864,22 @@ Please refrain from engaging in this activity or further actions may be taken ag VisualDatabaseDisplayMainTypeFilterWidget - + 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 @@ -8853,27 +8887,27 @@ Please refrain from engaging in this activity or further actions may be taken ag VisualDatabaseDisplayNameFilterWidget - + Filter by name... - + 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 @@ -8881,7 +8915,7 @@ Please refrain from engaging in this activity or further actions may be taken ag VisualDatabaseDisplayRecentSetFilterSettingsWidget - + Filter to most recent sets @@ -8889,19 +8923,19 @@ Please refrain from engaging in this activity or further actions may be taken ag VisualDatabaseDisplaySetFilterWidget - + Search sets... - - + + Mode: Exact Match - - + + Mode: Includes @@ -8909,27 +8943,27 @@ Please refrain from engaging in this activity or further actions may be taken ag VisualDatabaseDisplaySubTypeFilterWidget - + Search subtypes... - + 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 @@ -8937,37 +8971,37 @@ Please refrain from engaging in this activity or further actions may be taken ag VisualDatabaseDisplayWidget - + Search by card name (or search expressions) - + Loading database ... - + Clear all filters - + Save and load filters - + Filter by exact card name - + Filter by card sub-type - + Filter by set @@ -8975,12 +9009,12 @@ Please refrain from engaging in this activity or further actions may be taken ag VisualDeckEditorSampleHandWidget - + Draw a new sample hand - + Sample hand size @@ -8988,38 +9022,38 @@ Please refrain from engaging in this activity or further actions may be taken ag VisualDeckEditorWidget - + Click and drag to change the sort order within the groups - + 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 - + Configure how cards are sorted within their groups - - + + Overlap Layout - + Change how cards are displayed within zones (i.e. overlapped or fully visible.) - + Flat Layout @@ -9027,7 +9061,7 @@ Please refrain from engaging in this activity or further actions may be taken ag VisualDeckStorageFolderDisplayWidget - + Deck Storage @@ -9035,47 +9069,47 @@ Please refrain from engaging in this activity or further actions may be taken ag VisualDeckStorageQuickSettingsWidget - + Show Folders - + Show Tag Filter - + Show Tags On Deck Previews - + Show Banner Card Selection Option - + Draw unused Color Identities - + Unused Color Identities Opacity - + Deck tooltip: - + None - + Filepath @@ -9083,7 +9117,7 @@ Please refrain from engaging in this activity or further actions may be taken ag VisualDeckStorageSearchWidget - + Search by filename (or search expression) @@ -9091,22 +9125,22 @@ Please refrain from engaging in this activity or further actions may be taken ag VisualDeckStorageSortWidget - + Sort Alphabetically (Deck Name) - + Sort Alphabetically (Filename) - + Sort by Last Modified - + Sort by Last Loaded @@ -9114,17 +9148,17 @@ Please refrain from engaging in this activity or further actions may be taken ag VisualDeckStorageWidget - + Loading database ... - + Refresh loaded files - + Visual Deck Storage Settings @@ -9383,7 +9417,7 @@ Please refrain from engaging in this activity or further actions may be taken ag i18n - + English @@ -9404,1006 +9438,1005 @@ Please refrain from engaging in this activity or further actions may be taken ag shortcutsTab - + Main Window - - + + Deck Editor - + Game Lobby - + Card Counters - + Player Counters - + Power and Toughness - + Game Phases - + Playing Area - + Move Selected Card - + View - + Move Top Card - + Move Bottom Card - + Gameplay - + Drawing - + Chat Room - + Game Window - + Load Deck from Clipboard - - + + Replays - + Tabs - + Check for Card Updates... - + Connect... - + Disconnect - + Exit - + Full screen - + Register... - + Settings... - + Start a Local Game... - + Watch Replay... - + Analyze Deck (deckstats.net) - Analyze Deck - + Analyze Deck (tappedout.net) - + Clear All Filters - + Clear Selected Filter - + Close - + Remove Card - + Manage Sets... - + Edit Custom Tokens... - + Export Deck (decklist.org) - + Export Deck (decklist.xyz) - + Add Card - + Load Deck... - - + + 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 - + Show Status Bar - + 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 Untap - + Turn Card Over - + Peek Card - + Play Card - + Attach Card... - + Unattach Card - + Clone Card - + Create Token... - + Create All Related Tokens - + Create Another Token - + Set Annotation... - + Select All Cards in Zone - + Select All Cards in Row - + Select All Cards in Column - - + + Bottom of Library - - - - + + + + Exile - - - - + + + + Graveyard - - + + Hand - - + + Top of Library - - - + + + Battlefield, Face Down - + Battlefield - + Sort Hand - + Library - + Sideboard - + Top Cards of Library - + Bottom Cards of Library - + Close Recent View - - + + Stack - - + + Graveyard (Multiple) - - + + Exile (Multiple) - + Stack Until Found - + Draw Bottom Card - + Draw Multiple Cards from Bottom... - + Draw Arrow... - + Remove Local Arrows - + Leave Game - + Concede - + Roll Dice... - + Shuffle Library - + Shuffle Top Cards of Library - + Shuffle Bottom Cards of Library - + Mulligan - + Draw a Card - + Draw Multiple Cards... - + Undo Draw - + Always Reveal Top Card - + Always Look At Top Card - + 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/src/deck/deck_stats_interface.cpp b/cockatrice/src/client/network/interfaces/deck_stats_interface.cpp similarity index 96% rename from cockatrice/src/deck/deck_stats_interface.cpp rename to cockatrice/src/client/network/interfaces/deck_stats_interface.cpp index 96865d9e7..a5cea5358 100644 --- a/cockatrice/src/deck/deck_stats_interface.cpp +++ b/cockatrice/src/client/network/interfaces/deck_stats_interface.cpp @@ -1,8 +1,5 @@ #include "deck_stats_interface.h" -#include "deck_list.h" -#include "deck_list_card_node.h" - #include #include #include @@ -10,6 +7,8 @@ #include #include #include +#include +#include DeckStatsInterface::DeckStatsInterface(CardDatabase &_cardDatabase, QObject *parent) : QObject(parent), cardDatabase(_cardDatabase) diff --git a/cockatrice/src/deck/deck_stats_interface.h b/cockatrice/src/client/network/interfaces/deck_stats_interface.h similarity index 90% rename from cockatrice/src/deck/deck_stats_interface.h rename to cockatrice/src/client/network/interfaces/deck_stats_interface.h index 8a76b35fc..f621fff7c 100644 --- a/cockatrice/src/deck/deck_stats_interface.h +++ b/cockatrice/src/client/network/interfaces/deck_stats_interface.h @@ -7,10 +7,9 @@ #ifndef DECKSTATS_INTERFACE_H #define DECKSTATS_INTERFACE_H -#include "../database/card_database.h" -#include "deck_list.h" - #include +#include +#include class QByteArray; class QNetworkAccessManager; diff --git a/cockatrice/src/client/tapped_out_interface.cpp b/cockatrice/src/client/network/interfaces/tapped_out_interface.cpp similarity index 97% rename from cockatrice/src/client/tapped_out_interface.cpp rename to cockatrice/src/client/network/interfaces/tapped_out_interface.cpp index 43ceb6cdd..d18d811b0 100644 --- a/cockatrice/src/client/tapped_out_interface.cpp +++ b/cockatrice/src/client/network/interfaces/tapped_out_interface.cpp @@ -1,8 +1,5 @@ #include "tapped_out_interface.h" -#include "deck_list.h" -#include "deck_list_card_node.h" - #include #include #include @@ -10,6 +7,8 @@ #include #include #include +#include +#include TappedOutInterface::TappedOutInterface(CardDatabase &_cardDatabase, QObject *parent) : QObject(parent), cardDatabase(_cardDatabase) diff --git a/cockatrice/src/client/tapped_out_interface.h b/cockatrice/src/client/network/interfaces/tapped_out_interface.h similarity index 91% rename from cockatrice/src/client/tapped_out_interface.h rename to cockatrice/src/client/network/interfaces/tapped_out_interface.h index 43e5cdea3..e4e9498a3 100644 --- a/cockatrice/src/client/tapped_out_interface.h +++ b/cockatrice/src/client/network/interfaces/tapped_out_interface.h @@ -7,11 +7,10 @@ #ifndef TAPPEDOUT_INTERFACE_H #define TAPPEDOUT_INTERFACE_H -#include "../database/card_database.h" -#include "deck_list.h" - #include #include +#include +#include inline Q_LOGGING_CATEGORY(TappedOutInterfaceLog, "tapped_out_interface"); 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 e58f31bcc..9b7b61283 100644 --- a/cockatrice/src/client/network/parsers/interface_json_deck_parser.h +++ b/cockatrice/src/client/network/parsers/interface_json_deck_parser.h @@ -6,10 +6,9 @@ #ifndef INTERFACE_JSON_DECK_PARSER_H #define INTERFACE_JSON_DECK_PARSER_H -#include "../../../deck/deck_loader.h" - #include #include +#include class IJsonDeckParser { diff --git a/cockatrice/src/client/network/spoiler_background_updater.cpp b/cockatrice/src/client/network/update/card_spoiler/spoiler_background_updater.cpp similarity index 96% rename from cockatrice/src/client/network/spoiler_background_updater.cpp rename to cockatrice/src/client/network/update/card_spoiler/spoiler_background_updater.cpp index 68fdc4c4c..7dce6a65c 100644 --- a/cockatrice/src/client/network/spoiler_background_updater.cpp +++ b/cockatrice/src/client/network/update/card_spoiler/spoiler_background_updater.cpp @@ -1,10 +1,7 @@ #include "spoiler_background_updater.h" -#include "../../database/card_database.h" -#include "../../database/card_database_manager.h" -#include "../../interface/window_main.h" -#include "../../main.h" -#include "../../settings/cache_settings.h" +#include "../../../../interface/window_main.h" +#include "../../../../main.h" #include #include @@ -16,6 +13,9 @@ #include #include #include +#include +#include +#include #define SPOILERS_STATUS_URL "https://raw.githubusercontent.com/Cockatrice/Magic-Spoiler/files/SpoilerSeasonEnabled" #define SPOILERS_URL "https://raw.githubusercontent.com/Cockatrice/Magic-Spoiler/files/spoiler.xml" diff --git a/cockatrice/src/client/network/spoiler_background_updater.h b/cockatrice/src/client/network/update/card_spoiler/spoiler_background_updater.h similarity index 100% rename from cockatrice/src/client/network/spoiler_background_updater.h rename to cockatrice/src/client/network/update/card_spoiler/spoiler_background_updater.h diff --git a/cockatrice/src/client/network/client_update_checker.cpp b/cockatrice/src/client/network/update/client/client_update_checker.cpp similarity index 94% rename from cockatrice/src/client/network/client_update_checker.cpp rename to cockatrice/src/client/network/update/client/client_update_checker.cpp index 23c52d08d..f965ff6dc 100644 --- a/cockatrice/src/client/network/client_update_checker.cpp +++ b/cockatrice/src/client/network/update/client/client_update_checker.cpp @@ -1,8 +1,9 @@ #include "client_update_checker.h" -#include "../../settings/cache_settings.h" #include "release_channel.h" +#include + ClientUpdateChecker::ClientUpdateChecker(QObject *parent) : QObject(parent) { } diff --git a/cockatrice/src/client/network/client_update_checker.h b/cockatrice/src/client/network/update/client/client_update_checker.h similarity index 100% rename from cockatrice/src/client/network/client_update_checker.h rename to cockatrice/src/client/network/update/client/client_update_checker.h diff --git a/cockatrice/src/client/network/release_channel.cpp b/cockatrice/src/client/network/update/client/release_channel.cpp similarity index 100% rename from cockatrice/src/client/network/release_channel.cpp rename to cockatrice/src/client/network/update/client/release_channel.cpp diff --git a/cockatrice/src/client/network/release_channel.h b/cockatrice/src/client/network/update/client/release_channel.h similarity index 100% rename from cockatrice/src/client/network/release_channel.h rename to cockatrice/src/client/network/update/client/release_channel.h diff --git a/cockatrice/src/client/update_downloader.cpp b/cockatrice/src/client/network/update/client/update_downloader.cpp similarity index 100% rename from cockatrice/src/client/update_downloader.cpp rename to cockatrice/src/client/network/update/client/update_downloader.cpp diff --git a/cockatrice/src/client/update_downloader.h b/cockatrice/src/client/network/update/client/update_downloader.h similarity index 100% rename from cockatrice/src/client/update_downloader.h rename to cockatrice/src/client/network/update/client/update_downloader.h diff --git a/cockatrice/src/client/sound_engine.cpp b/cockatrice/src/client/sound_engine.cpp index fef2df093..05f2d12d8 100644 --- a/cockatrice/src/client/sound_engine.cpp +++ b/cockatrice/src/client/sound_engine.cpp @@ -1,9 +1,8 @@ #include "sound_engine.h" -#include "../settings/cache_settings.h" - #include #include +#include #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) #include diff --git a/cockatrice/src/filters/deck_filter_string.cpp b/cockatrice/src/filters/deck_filter_string.cpp index f107884c3..ad0cdc336 100644 --- a/cockatrice/src/filters/deck_filter_string.cpp +++ b/cockatrice/src/filters/deck_filter_string.cpp @@ -1,8 +1,9 @@ #include "deck_filter_string.h" -#include "../database/card_database_manager.h" #include "filter_string.h" -#include "lib/peglib.h" + +#include +#include static peg::parser search(R"( Start <- QueryPartList diff --git a/cockatrice/src/filters/filter_builder.cpp b/cockatrice/src/filters/filter_builder.cpp index 97056ac60..8f91bcca7 100644 --- a/cockatrice/src/filters/filter_builder.cpp +++ b/cockatrice/src/filters/filter_builder.cpp @@ -1,6 +1,6 @@ #include "filter_builder.h" -#include "../deck/custom_line_edit.h" +#include "../interface/widgets/utility/custom_line_edit.h" #include "filter_card.h" #include diff --git a/cockatrice/src/filters/filter_string.cpp b/cockatrice/src/filters/filter_string.cpp index 02fc1e1ec..3615729f0 100644 --- a/cockatrice/src/filters/filter_string.cpp +++ b/cockatrice/src/filters/filter_string.cpp @@ -1,12 +1,11 @@ #include "filter_string.h" -#include "../../../common/lib/peglib.h" - #include #include #include #include #include +#include static peg::parser search(R"( Start <- QueryPartList diff --git a/cockatrice/src/filters/filter_string.h b/cockatrice/src/filters/filter_string.h index f2b8ce006..4e6cb38bf 100644 --- a/cockatrice/src/filters/filter_string.h +++ b/cockatrice/src/filters/filter_string.h @@ -7,13 +7,13 @@ #ifndef FILTER_STRING_H #define FILTER_STRING_H -#include "../card/card_info.h" #include "filter_tree.h" #include #include #include #include +#include #include inline Q_LOGGING_CATEGORY(FilterStringLog, "filter_string"); diff --git a/cockatrice/src/filters/filter_tree.h b/cockatrice/src/filters/filter_tree.h index 40a6ec54c..350fd2f14 100644 --- a/cockatrice/src/filters/filter_tree.h +++ b/cockatrice/src/filters/filter_tree.h @@ -7,12 +7,12 @@ #ifndef FILTERTREE_H #define FILTERTREE_H -#include "../database/card_database.h" #include "filter_card.h" #include #include #include +#include #include class FilterTreeNode diff --git a/cockatrice/src/game/abstract_game.h b/cockatrice/src/game/abstract_game.h index 08c25772c..cb4dbac2a 100644 --- a/cockatrice/src/game/abstract_game.h +++ b/cockatrice/src/game/abstract_game.h @@ -7,13 +7,13 @@ #ifndef COCKATRICE_ABSTRACT_GAME_H #define COCKATRICE_ABSTRACT_GAME_H -#include "../../../common/pb/game_replay.pb.h" #include "game_event_handler.h" #include "game_meta_info.h" #include "game_state.h" #include "player/player_manager.h" #include +#include class CardItem; class TabGame; diff --git a/cockatrice/src/game/board/abstract_card_drag_item.cpp b/cockatrice/src/game/board/abstract_card_drag_item.cpp index d7b0b7d46..3507a5a27 100644 --- a/cockatrice/src/game/board/abstract_card_drag_item.cpp +++ b/cockatrice/src/game/board/abstract_card_drag_item.cpp @@ -1,11 +1,10 @@ #include "abstract_card_drag_item.h" -#include "../../settings/cache_settings.h" - #include #include #include #include +#include static const float CARD_WIDTH_HALF = CARD_WIDTH / 2; static const float CARD_HEIGHT_HALF = CARD_HEIGHT / 2; diff --git a/cockatrice/src/game/board/abstract_card_item.cpp b/cockatrice/src/game/board/abstract_card_item.cpp index ea23f39c0..2b3811b53 100644 --- a/cockatrice/src/game/board/abstract_card_item.cpp +++ b/cockatrice/src/game/board/abstract_card_item.cpp @@ -1,9 +1,6 @@ #include "abstract_card_item.h" -#include "../../database/card_database.h" -#include "../../database/card_database_manager.h" -#include "../../picture_loader/picture_loader.h" -#include "../../settings/cache_settings.h" +#include "../../interface/card_picture_loader/card_picture_loader.h" #include "../game_scene.h" #include @@ -11,6 +8,9 @@ #include #include #include +#include +#include +#include AbstractCardItem::AbstractCardItem(QGraphicsItem *parent, const CardRef &cardRef, Player *_owner, int _id) : ArrowTarget(_owner, parent), id(_id), cardRef(cardRef), tapped(false), facedown(false), tapAngle(0), @@ -119,11 +119,11 @@ void AbstractCardItem::paintPicture(QPainter *painter, const QSizeF &translatedS if (facedown || cardRef.name.isEmpty()) { // never reveal card color, always paint the card back - PictureLoader::getCardBackPixmap(translatedPixmap, translatedSize.toSize()); + CardPictureLoader::getCardBackPixmap(translatedPixmap, translatedSize.toSize()); } else { // don't even spend time trying to load the picture if our size is too small if (translatedSize.width() > 10) { - PictureLoader::getPixmap(translatedPixmap, exactCard, translatedSize.toSize()); + CardPictureLoader::getPixmap(translatedPixmap, exactCard, translatedSize.toSize()); if (translatedPixmap.isNull()) paintImage = false; } else { diff --git a/cockatrice/src/game/board/abstract_card_item.h b/cockatrice/src/game/board/abstract_card_item.h index 7ec843575..a935c97b6 100644 --- a/cockatrice/src/game/board/abstract_card_item.h +++ b/cockatrice/src/game/board/abstract_card_item.h @@ -7,11 +7,12 @@ #ifndef ABSTRACTCARDITEM_H #define ABSTRACTCARDITEM_H -#include "../../card/exact_card.h" #include "arrow_target.h" -#include "card_ref.h" #include "graphics_item_type.h" +#include +#include + class Player; const int CARD_WIDTH = 72; diff --git a/cockatrice/src/game/board/abstract_counter.cpp b/cockatrice/src/game/board/abstract_counter.cpp index c821dc4f8..44340cc34 100644 --- a/cockatrice/src/game/board/abstract_counter.cpp +++ b/cockatrice/src/game/board/abstract_counter.cpp @@ -1,11 +1,7 @@ #include "abstract_counter.h" -#include "../../settings/cache_settings.h" -#include "../../tabs/tab_game.h" +#include "../../interface/widgets/tabs/tab_game.h" #include "../player/player.h" -#include "expression.h" -#include "pb/command_inc_counter.pb.h" -#include "pb/command_set_counter.pb.h" #include "translate_counter_name.h" #include @@ -16,6 +12,10 @@ #include #include #include +#include +#include +#include +#include AbstractCounter::AbstractCounter(Player *_player, int _id, diff --git a/cockatrice/src/game/board/abstract_counter.h b/cockatrice/src/game/board/abstract_counter.h index 4c39340fa..ea13cb00f 100644 --- a/cockatrice/src/game/board/abstract_counter.h +++ b/cockatrice/src/game/board/abstract_counter.h @@ -7,7 +7,7 @@ #ifndef COUNTER_H #define COUNTER_H -#include "../../interface/tearoff_menu.h" +#include "../../interface/widgets/menus/tearoff_menu.h" #include #include diff --git a/cockatrice/src/game/board/arrow_item.cpp b/cockatrice/src/game/board/arrow_item.cpp index 819fb7927..cc4a4e6aa 100644 --- a/cockatrice/src/game/board/arrow_item.cpp +++ b/cockatrice/src/game/board/arrow_item.cpp @@ -1,22 +1,22 @@ #define _USE_MATH_DEFINES #include "arrow_item.h" -#include "../../card/card_info.h" -#include "../../settings/cache_settings.h" #include "../player/player.h" #include "../player/player_target.h" #include "../zones/card_zone.h" #include "card_item.h" -#include "color.h" -#include "pb/command_attach_card.pb.h" -#include "pb/command_create_arrow.pb.h" -#include "pb/command_delete_arrow.pb.h" #include #include #include #include #include +#include +#include +#include +#include +#include +#include ArrowItem::ArrowItem(Player *_player, int _id, ArrowTarget *_startItem, ArrowTarget *_targetItem, const QColor &_color) : QGraphicsItem(), player(_player), id(_id), startItem(_startItem), targetItem(_targetItem), targetLocked(false), diff --git a/cockatrice/src/game/board/card_item.cpp b/cockatrice/src/game/board/card_item.cpp index da347098f..64f905fee 100644 --- a/cockatrice/src/game/board/card_item.cpp +++ b/cockatrice/src/game/board/card_item.cpp @@ -1,9 +1,6 @@ #include "card_item.h" -#include "../../card/card_info.h" -#include "../../settings/cache_settings.h" -#include "../../settings/card_counter_settings.h" -#include "../../tabs/tab_game.h" +#include "../../interface/widgets/tabs/tab_game.h" #include "../game_scene.h" #include "../player/player.h" #include "../zones/card_zone.h" @@ -12,12 +9,15 @@ #include "../zones/view_zone.h" #include "arrow_item.h" #include "card_drag_item.h" -#include "pb/serverinfo_card.pb.h" #include #include #include #include +#include +#include +#include +#include CardItem::CardItem(Player *_owner, QGraphicsItem *parent, const CardRef &cardRef, int _cardid, CardZoneLogic *_zone) : AbstractCardItem(parent, cardRef, _owner, _cardid), zone(_zone), attacking(false), destroyOnZoneChange(false), diff --git a/cockatrice/src/game/board/card_item.h b/cockatrice/src/game/board/card_item.h index 5408a5f3a..dcaf33520 100644 --- a/cockatrice/src/game/board/card_item.h +++ b/cockatrice/src/game/board/card_item.h @@ -9,7 +9,8 @@ #include "../zones/logic/card_zone_logic.h" #include "abstract_card_item.h" -#include "server/game/server_card.h" + +#include class CardDatabase; class CardDragItem; diff --git a/cockatrice/src/game/board/card_list.cpp b/cockatrice/src/game/board/card_list.cpp index 7ad9048c3..c324ca10a 100644 --- a/cockatrice/src/game/board/card_list.cpp +++ b/cockatrice/src/game/board/card_list.cpp @@ -1,10 +1,10 @@ #include "card_list.h" -#include "../../card/card_info.h" #include "card_item.h" #include #include +#include CardList::CardList(bool _contentsKnown) : QList(), contentsKnown(_contentsKnown) { diff --git a/cockatrice/src/game/deckview/deck_view.cpp b/cockatrice/src/game/deckview/deck_view.cpp index 46b1cc524..da9c97db9 100644 --- a/cockatrice/src/game/deckview/deck_view.cpp +++ b/cockatrice/src/game/deckview/deck_view.cpp @@ -1,16 +1,16 @@ #include "deck_view.h" -#include "../../card/card_info.h" #include "../../interface/theme_manager.h" -#include "../../settings/cache_settings.h" -#include "deck_list.h" -#include "deck_list_card_node.h" #include #include #include #include #include +#include +#include +#include +#include DeckViewCardDragItem::DeckViewCardDragItem(DeckViewCard *_item, const QPointF &_hotSpot, diff --git a/cockatrice/src/game/deckview/deck_view.h b/cockatrice/src/game/deckview/deck_view.h index 06fb7294a..7d01d5670 100644 --- a/cockatrice/src/game/deckview/deck_view.h +++ b/cockatrice/src/game/deckview/deck_view.h @@ -8,13 +8,13 @@ #define DECKVIEW_H #include "../board/abstract_card_drag_item.h" -#include "pb/move_card_to_zone.pb.h" #include #include #include #include #include +#include class DeckList; class InnerDecklistNode; diff --git a/cockatrice/src/game/deckview/deck_view_container.cpp b/cockatrice/src/game/deckview/deck_view_container.cpp index 7dd2da41b..836438739 100644 --- a/cockatrice/src/game/deckview/deck_view_container.cpp +++ b/cockatrice/src/game/deckview/deck_view_container.cpp @@ -1,29 +1,29 @@ #include "deck_view_container.h" -#include "../../database/card_database.h" -#include "../../database/card_database_manager.h" -#include "../../deck/deck_loader.h" -#include "../../dialogs/dlg_load_deck.h" -#include "../../dialogs/dlg_load_deck_from_clipboard.h" -#include "../../dialogs/dlg_load_deck_from_website.h" -#include "../../dialogs/dlg_load_remote_deck.h" -#include "../../picture_loader/picture_loader.h" -#include "../../server/pending_command.h" -#include "../../settings/cache_settings.h" -#include "../../tabs/tab_game.h" +#include "../../interface/card_picture_loader/card_picture_loader.h" +#include "../../interface/widgets/dialogs/dlg_load_deck.h" +#include "../../interface/widgets/dialogs/dlg_load_deck_from_clipboard.h" +#include "../../interface/widgets/dialogs/dlg_load_deck_from_website.h" +#include "../../interface/widgets/dialogs/dlg_load_remote_deck.h" +#include "../../interface/widgets/tabs/tab_game.h" #include "../game_scene.h" #include "deck_view.h" -#include "pb/command_deck_select.pb.h" -#include "pb/command_ready_start.pb.h" -#include "pb/command_set_sideboard_lock.pb.h" -#include "pb/command_set_sideboard_plan.pb.h" -#include "pb/response_deck_download.pb.h" -#include "trice_limits.h" #include #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include ToggleButton::ToggleButton(QWidget *parent) : QPushButton(parent), state(false) { @@ -332,7 +332,7 @@ void DeckViewContainer::deckSelectFinished(const Response &r) { const Response_DeckDownload &resp = r.GetExtension(Response_DeckDownload::ext); DeckLoader newDeck(QString::fromStdString(resp.deck())); - PictureLoader::cacheCardPixmaps(CardDatabaseManager::query()->getCards(newDeck.getCardRefList())); + CardPictureLoader::cacheCardPixmaps(CardDatabaseManager::query()->getCards(newDeck.getCardRefList())); setDeck(newDeck); switchToDeckLoadedView(); } diff --git a/cockatrice/src/game/deckview/deck_view_container.h b/cockatrice/src/game/deckview/deck_view_container.h index 36474b4c2..b61b21468 100644 --- a/cockatrice/src/game/deckview/deck_view_container.h +++ b/cockatrice/src/game/deckview/deck_view_container.h @@ -7,9 +7,8 @@ #ifndef DECK_VIEW_CONTAINER_H #define DECK_VIEW_CONTAINER_H -#include "../../deck/deck_loader.h" - #include +#include class QVBoxLayout; class AbstractCardItem; diff --git a/cockatrice/src/game/deckview/tabbed_deck_view_container.cpp b/cockatrice/src/game/deckview/tabbed_deck_view_container.cpp index 34fb16260..984267cce 100644 --- a/cockatrice/src/game/deckview/tabbed_deck_view_container.cpp +++ b/cockatrice/src/game/deckview/tabbed_deck_view_container.cpp @@ -1,6 +1,6 @@ #include "tabbed_deck_view_container.h" -#include "../../tabs/tab_game.h" +#include "../../interface/widgets/tabs/tab_game.h" #include "deck_view.h" TabbedDeckViewContainer::TabbedDeckViewContainer(int _playerId, TabGame *parent) diff --git a/cockatrice/src/game/dialogs/dlg_create_token.cpp b/cockatrice/src/game/dialogs/dlg_create_token.cpp index 8da2bc722..736b5e55f 100644 --- a/cockatrice/src/game/dialogs/dlg_create_token.cpp +++ b/cockatrice/src/game/dialogs/dlg_create_token.cpp @@ -1,13 +1,7 @@ #include "dlg_create_token.h" -#include "../../database/card_database_manager.h" -#include "../../database/model/card_database_model.h" -#include "../../database/model/token/token_display_model.h" #include "../../interface/widgets/cards/card_info_picture_widget.h" #include "../../main.h" -#include "../../settings/cache_settings.h" -#include "deck_list.h" -#include "trice_limits.h" #include #include @@ -22,6 +16,12 @@ #include #include #include +#include +#include +#include +#include +#include +#include DlgCreateToken::DlgCreateToken(const QStringList &_predefinedTokens, QWidget *parent) : QDialog(parent), predefinedTokens(_predefinedTokens) diff --git a/cockatrice/src/game/dialogs/dlg_move_top_cards_until.cpp b/cockatrice/src/game/dialogs/dlg_move_top_cards_until.cpp index 53b762fb4..3ea164f1e 100644 --- a/cockatrice/src/game/dialogs/dlg_move_top_cards_until.cpp +++ b/cockatrice/src/game/dialogs/dlg_move_top_cards_until.cpp @@ -1,7 +1,5 @@ #include "dlg_move_top_cards_until.h" -#include "../../database/card_database.h" -#include "../../database/card_database_manager.h" #include "../../filters/filter_string.h" #include @@ -12,6 +10,8 @@ #include #include #include +#include +#include DlgMoveTopCardsUntil::DlgMoveTopCardsUntil(QWidget *parent, QStringList exprs, uint _numberOfHits, bool autoPlay) : QDialog(parent) diff --git a/cockatrice/src/game/dialogs/dlg_roll_dice.cpp b/cockatrice/src/game/dialogs/dlg_roll_dice.cpp index 7a1a2bb9b..dfb3d0bc5 100644 --- a/cockatrice/src/game/dialogs/dlg_roll_dice.cpp +++ b/cockatrice/src/game/dialogs/dlg_roll_dice.cpp @@ -1,12 +1,11 @@ #include "dlg_roll_dice.h" -#include "trice_limits.h" - #include #include #include #include #include +#include DlgRollDice::DlgRollDice(QWidget *parent) : QDialog(parent) { diff --git a/cockatrice/src/game/game.cpp b/cockatrice/src/game/game.cpp index d24d4cb51..38477f7f7 100644 --- a/cockatrice/src/game/game.cpp +++ b/cockatrice/src/game/game.cpp @@ -1,7 +1,8 @@ #include "game.h" -#include "../tabs/tab_game.h" -#include "pb/event_game_joined.pb.h" +#include "../interface/widgets/tabs/tab_game.h" + +#include Game::Game(TabGame *_tab, QList &_clients, diff --git a/cockatrice/src/game/game_event_handler.cpp b/cockatrice/src/game/game_event_handler.cpp index d5848ffdb..1cb47f368 100644 --- a/cockatrice/src/game/game_event_handler.cpp +++ b/cockatrice/src/game/game_event_handler.cpp @@ -1,33 +1,34 @@ #include "game_event_handler.h" -#include "../server/abstract_client.h" -#include "../server/pending_command.h" -#include "../tabs/tab_game.h" +#include "../interface/widgets/tabs/tab_game.h" #include "abstract_game.h" -#include "get_pb_extension.h" #include "log/message_log_widget.h" -#include "pb/command_concede.pb.h" -#include "pb/command_delete_arrow.pb.h" -#include "pb/command_game_say.pb.h" -#include "pb/command_leave_game.pb.h" -#include "pb/command_next_turn.pb.h" -#include "pb/command_reverse_turn.pb.h" -#include "pb/command_set_active_phase.pb.h" -#include "pb/context_connection_state_changed.pb.h" -#include "pb/context_deck_select.pb.h" -#include "pb/context_ping_changed.pb.h" -#include "pb/event_game_closed.pb.h" -#include "pb/event_game_host_changed.pb.h" -#include "pb/event_game_say.pb.h" -#include "pb/event_game_state_changed.pb.h" -#include "pb/event_join.pb.h" -#include "pb/event_kicked.pb.h" -#include "pb/event_leave.pb.h" -#include "pb/event_player_properties_changed.pb.h" -#include "pb/event_reverse_turn.pb.h" -#include "pb/event_set_active_phase.pb.h" -#include "pb/event_set_active_player.pb.h" -#include "pb/game_event_container.pb.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include GameEventHandler::GameEventHandler(AbstractGame *_game) : QObject(_game), game(_game) { diff --git a/cockatrice/src/game/game_event_handler.h b/cockatrice/src/game/game_event_handler.h index 4f44cd83e..2709cdcd5 100644 --- a/cockatrice/src/game/game_event_handler.h +++ b/cockatrice/src/game/game_event_handler.h @@ -7,12 +7,12 @@ #ifndef COCKATRICE_GAME_EVENT_HANDLER_H #define COCKATRICE_GAME_EVENT_HANDLER_H -#include "pb/event_leave.pb.h" -#include "pb/serverinfo_player.pb.h" #include "player/event_processing_options.h" #include #include +#include +#include class AbstractClient; class Response; diff --git a/cockatrice/src/game/game_meta_info.h b/cockatrice/src/game/game_meta_info.h index e3c0c22e0..b5f5bfe4f 100644 --- a/cockatrice/src/game/game_meta_info.h +++ b/cockatrice/src/game/game_meta_info.h @@ -7,10 +7,9 @@ #ifndef GAME_META_INFO_H #define GAME_META_INFO_H -#include "pb/serverinfo_game.pb.h" - #include #include +#include // Translation layer class to expose protobuf safely and hook it up to Qt Signals. // This class de-couples the domain object (i.e. the GameMetaInfo) from the network object. diff --git a/cockatrice/src/game/game_scene.cpp b/cockatrice/src/game/game_scene.cpp index 4316e67bf..5af7b2e1d 100644 --- a/cockatrice/src/game/game_scene.cpp +++ b/cockatrice/src/game/game_scene.cpp @@ -1,6 +1,5 @@ #include "game_scene.h" -#include "../settings/cache_settings.h" #include "board/card_item.h" #include "phases_toolbar.h" #include "player/player.h" @@ -15,6 +14,7 @@ #include #include #include +#include #include /** diff --git a/cockatrice/src/game/game_state.h b/cockatrice/src/game/game_state.h index 0ad24633c..b5d6a6572 100644 --- a/cockatrice/src/game/game_state.h +++ b/cockatrice/src/game/game_state.h @@ -7,11 +7,10 @@ #ifndef COCKATRICE_GAME_STATE_H #define COCKATRICE_GAME_STATE_H -#include "../server/abstract_client.h" -#include "pb/serverinfo_game.pb.h" - #include #include +#include +#include class AbstractGame; class ServerInfo_PlayerProperties; diff --git a/cockatrice/src/game/game_view.cpp b/cockatrice/src/game/game_view.cpp index 969e26e14..607f0c85a 100644 --- a/cockatrice/src/game/game_view.cpp +++ b/cockatrice/src/game/game_view.cpp @@ -1,11 +1,11 @@ #include "game_view.h" -#include "../settings/cache_settings.h" #include "game_scene.h" #include #include #include +#include GameView::GameView(GameScene *scene, QWidget *parent) : QGraphicsView(scene, parent), rubberBand(0) { diff --git a/cockatrice/src/game/log/message_log_widget.cpp b/cockatrice/src/game/log/message_log_widget.cpp index ed8a4e49c..b9ad47d61 100644 --- a/cockatrice/src/game/log/message_log_widget.cpp +++ b/cockatrice/src/game/log/message_log_widget.cpp @@ -1,17 +1,17 @@ #include "message_log_widget.h" #include "../../client/sound_engine.h" -#include "../../settings/card_counter_settings.h" -#include "../../tabs/tab_game.h" +#include "../../interface/widgets/tabs/tab_game.h" #include "../board/card_item.h" #include "../board/translate_counter_name.h" #include "../phase.h" #include "../player/player.h" #include "../zones/card_zone.h" -#include "pb/context_move_card.pb.h" -#include "pb/context_mulligan.pb.h" -#include "pb/serverinfo_user.pb.h" +#include +#include +#include +#include #include static const QString TABLE_ZONE_NAME = "table"; diff --git a/cockatrice/src/game/log/message_log_widget.h b/cockatrice/src/game/log/message_log_widget.h index 128d8ba0e..a185cb288 100644 --- a/cockatrice/src/game/log/message_log_widget.h +++ b/cockatrice/src/game/log/message_log_widget.h @@ -8,9 +8,10 @@ #define MESSAGELOGWIDGET_H #include "../../client/translation.h" -#include "../../server/chat_view/chat_view.h" +#include "../../interface/widgets/server/chat_view/chat_view.h" #include "../zones/logic/card_zone_logic.h" -#include "user_level.h" + +#include class AbstractGame; class CardItem; diff --git a/cockatrice/src/game/phases_toolbar.cpp b/cockatrice/src/game/phases_toolbar.cpp index 2fef5321c..5106e40de 100644 --- a/cockatrice/src/game/phases_toolbar.cpp +++ b/cockatrice/src/game/phases_toolbar.cpp @@ -1,16 +1,16 @@ #include "phases_toolbar.h" #include "../interface/pixel_map_generator.h" -#include "pb/command_draw_cards.pb.h" -#include "pb/command_next_turn.pb.h" -#include "pb/command_set_active_phase.pb.h" -#include "pb/command_set_card_attr.pb.h" #include #include #include #include #include +#include +#include +#include +#include PhaseButton::PhaseButton(const QString &_name, QGraphicsItem *parent, QAction *_doubleClickAction, bool _highlightable) : QObject(), QGraphicsItem(parent), name(_name), active(false), highlightable(_highlightable), diff --git a/cockatrice/src/game/player/menu/card_menu.cpp b/cockatrice/src/game/player/menu/card_menu.cpp index 22cc86597..cd73c6d88 100644 --- a/cockatrice/src/game/player/menu/card_menu.cpp +++ b/cockatrice/src/game/player/menu/card_menu.cpp @@ -1,9 +1,6 @@ #include "card_menu.h" -#include "../../../card/card_relation.h" -#include "../../../database/card_database_manager.h" -#include "../../../settings/card_counter_settings.h" -#include "../../../tabs/tab_game.h" +#include "../../../interface/widgets/tabs/tab_game.h" #include "../../board/card_item.h" #include "../../zones/logic/view_zone_logic.h" #include "../card_menu_action_type.h" @@ -12,6 +9,10 @@ #include "move_menu.h" #include "pt_menu.h" +#include +#include +#include + CardMenu::CardMenu(Player *_player, const CardItem *_card, bool _shortcutsActive) : player(_player), card(_card), shortcutsActive(_shortcutsActive) { @@ -488,12 +489,4 @@ void CardMenu::setShortcutsActive() aRemoveCounter[i]->setShortcuts(shortcuts.getShortcut("Player/aRC" + colorWords[i])); aSetCounter[i]->setShortcuts(shortcuts.getShortcut("Player/aSC" + colorWords[i])); } - - // Don't enable always-active shortcuts in local games, since it causes keyboard shortcuts to work inconsistently - // when there are more than 1 player. - if (!player->getGame()->getGameState()->getIsLocalGame()) { - // unattach action is only active in card menu if the active card is attached. - // make unattach shortcut always active so that it consistently works when multiple cards are selected. - player->getGame()->getTab()->addAction(aUnattach); - } } \ No newline at end of file diff --git a/cockatrice/src/game/player/menu/grave_menu.h b/cockatrice/src/game/player/menu/grave_menu.h index 7b4981f38..faaf497b6 100644 --- a/cockatrice/src/game/player/menu/grave_menu.h +++ b/cockatrice/src/game/player/menu/grave_menu.h @@ -7,7 +7,7 @@ #ifndef COCKATRICE_GRAVE_MENU_H #define COCKATRICE_GRAVE_MENU_H -#include "../../../interface/tearoff_menu.h" +#include "../../../interface/widgets/menus/tearoff_menu.h" #include #include diff --git a/cockatrice/src/game/player/menu/hand_menu.cpp b/cockatrice/src/game/player/menu/hand_menu.cpp index 3f506de00..b8908bc3e 100644 --- a/cockatrice/src/game/player/menu/hand_menu.cpp +++ b/cockatrice/src/game/player/menu/hand_menu.cpp @@ -1,7 +1,5 @@ #include "hand_menu.h" -#include "../../../settings/cache_settings.h" -#include "../../../settings/shortcuts_settings.h" #include "../../abstract_game.h" #include "../../zones/hand_zone.h" #include "../player.h" @@ -9,6 +7,8 @@ #include #include +#include +#include HandMenu::HandMenu(Player *_player, PlayerActions *actions, QWidget *parent) : TearOffMenu(parent), player(_player) { diff --git a/cockatrice/src/game/player/menu/hand_menu.h b/cockatrice/src/game/player/menu/hand_menu.h index f37bd794e..f66cf25bb 100644 --- a/cockatrice/src/game/player/menu/hand_menu.h +++ b/cockatrice/src/game/player/menu/hand_menu.h @@ -7,7 +7,7 @@ #ifndef COCKATRICE_HAND_MENU_H #define COCKATRICE_HAND_MENU_H -#include "../../../interface/tearoff_menu.h" +#include "../../../interface/widgets/menus/tearoff_menu.h" #include #include diff --git a/cockatrice/src/game/player/menu/library_menu.cpp b/cockatrice/src/game/player/menu/library_menu.cpp index 704e03e9f..4303a6540 100644 --- a/cockatrice/src/game/player/menu/library_menu.cpp +++ b/cockatrice/src/game/player/menu/library_menu.cpp @@ -1,14 +1,14 @@ #include "library_menu.h" -#include "../../../settings/cache_settings.h" -#include "../../../settings/shortcuts_settings.h" -#include "../../../tabs/tab_game.h" +#include "../../../interface/widgets/tabs/tab_game.h" #include "../../abstract_game.h" #include "../player.h" #include "../player_actions.h" #include #include +#include +#include LibraryMenu::LibraryMenu(Player *_player, QWidget *parent) : TearOffMenu(parent), player(_player) { diff --git a/cockatrice/src/game/player/menu/library_menu.h b/cockatrice/src/game/player/menu/library_menu.h index af7eef4c8..b82a78b12 100644 --- a/cockatrice/src/game/player/menu/library_menu.h +++ b/cockatrice/src/game/player/menu/library_menu.h @@ -7,7 +7,7 @@ #ifndef COCKATRICE_LIBRARY_MENU_H #define COCKATRICE_LIBRARY_MENU_H -#include "../../../interface/tearoff_menu.h" +#include "../../../interface/widgets/menus/tearoff_menu.h" #include #include diff --git a/cockatrice/src/game/player/menu/player_menu.cpp b/cockatrice/src/game/player/menu/player_menu.cpp index 7298d3ca9..f1c461435 100644 --- a/cockatrice/src/game/player/menu/player_menu.cpp +++ b/cockatrice/src/game/player/menu/player_menu.cpp @@ -1,8 +1,6 @@ #include "player_menu.h" -#include "../../../common/pb/command_reveal_cards.pb.h" -#include "../../../database/card_database_manager.h" -#include "../../../tabs/tab_game.h" +#include "../../../interface/widgets/tabs/tab_game.h" #include "../../board/card_item.h" #include "../../zones/hand_zone.h" #include "../card_menu_action_type.h" @@ -10,6 +8,9 @@ #include "card_menu.h" #include "hand_menu.h" +#include +#include + PlayerMenu::PlayerMenu(Player *_player) : player(_player) { playerMenu = new TearOffMenu(); diff --git a/cockatrice/src/game/player/menu/player_menu.h b/cockatrice/src/game/player/menu/player_menu.h index 6d8b67bb0..2019e4397 100644 --- a/cockatrice/src/game/player/menu/player_menu.h +++ b/cockatrice/src/game/player/menu/player_menu.h @@ -7,7 +7,7 @@ #ifndef COCKATRICE_PLAYER_MENU_H #define COCKATRICE_PLAYER_MENU_H -#include "../../../interface/tearoff_menu.h" +#include "../../../interface/widgets/menus/tearoff_menu.h" #include "../player.h" #include "custom_zone_menu.h" #include "grave_menu.h" diff --git a/cockatrice/src/game/player/menu/rfg_menu.h b/cockatrice/src/game/player/menu/rfg_menu.h index 268bc0719..0b4623d2a 100644 --- a/cockatrice/src/game/player/menu/rfg_menu.h +++ b/cockatrice/src/game/player/menu/rfg_menu.h @@ -7,7 +7,7 @@ #ifndef COCKATRICE_RFG_MENU_H #define COCKATRICE_RFG_MENU_H -#include "../../../interface/tearoff_menu.h" +#include "../../../interface/widgets/menus/tearoff_menu.h" #include #include diff --git a/cockatrice/src/game/player/menu/say_menu.cpp b/cockatrice/src/game/player/menu/say_menu.cpp index 3598a1c66..7db8f60be 100644 --- a/cockatrice/src/game/player/menu/say_menu.cpp +++ b/cockatrice/src/game/player/menu/say_menu.cpp @@ -1,9 +1,10 @@ #include "say_menu.h" -#include "../../../settings/cache_settings.h" #include "../player.h" #include "../player_actions.h" +#include + SayMenu::SayMenu(Player *_player) : player(_player) { connect(&SettingsCache::instance().messages(), &MessageSettings::messageMacrosChanged, this, &SayMenu::initSayMenu); diff --git a/cockatrice/src/game/player/player.cpp b/cockatrice/src/game/player/player.cpp index b7faa0868..a18e464d6 100644 --- a/cockatrice/src/game/player/player.cpp +++ b/cockatrice/src/game/player/player.cpp @@ -1,7 +1,7 @@ #include "player.h" #include "../../interface/theme_manager.h" -#include "../../tabs/tab_game.h" +#include "../../interface/widgets/tabs/tab_game.h" #include "../board/arrow_item.h" #include "../board/card_item.h" #include "../board/card_list.h" @@ -12,15 +12,6 @@ #include "../zones/stack_zone.h" #include "../zones/table_zone.h" #include "../zones/view_zone.h" -#include "color.h" -#include "pb/command_attach_card.pb.h" -#include "pb/command_set_card_counter.pb.h" -#include "pb/event_create_arrow.pb.h" -#include "pb/event_create_counter.pb.h" -#include "pb/event_draw_cards.pb.h" -#include "pb/serverinfo_player.pb.h" -#include "pb/serverinfo_user.pb.h" -#include "pb/serverinfo_zone.pb.h" #include "player_target.h" #include @@ -28,6 +19,15 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, AbstractGame *_parent) : QObject(_parent), game(_parent), playerInfo(new PlayerInfo(info, _id, _local, _judge)), diff --git a/cockatrice/src/game/player/player.h b/cockatrice/src/game/player/player.h index 8047f514e..eb62437fa 100644 --- a/cockatrice/src/game/player/player.h +++ b/cockatrice/src/game/player/player.h @@ -7,14 +7,11 @@ #ifndef PLAYER_H #define PLAYER_H -#include "../../card/card_info.h" #include "../../filters/filter_string.h" -#include "../../interface/tearoff_menu.h" +#include "../../interface/widgets/menus/tearoff_menu.h" #include "../board/abstract_graphics_item.h" #include "../dialogs/dlg_create_token.h" #include "menu/player_menu.h" -#include "pb/card_attributes.pb.h" -#include "pb/game_event.pb.h" #include "player_actions.h" #include "player_area.h" #include "player_event_handler.h" @@ -26,6 +23,9 @@ #include #include #include +#include +#include +#include inline Q_LOGGING_CATEGORY(PlayerLog, "player"); diff --git a/cockatrice/src/game/player/player_actions.cpp b/cockatrice/src/game/player/player_actions.cpp index b74db09ce..e37b34604 100644 --- a/cockatrice/src/game/player/player_actions.cpp +++ b/cockatrice/src/game/player/player_actions.cpp @@ -1,31 +1,32 @@ #include "player_actions.h" -#include "../../../common/pb/context_move_card.pb.h" -#include "../../card/card_relation.h" -#include "../../client/get_text_with_max.h" -#include "../../database/card_database_manager.h" -#include "../../tabs/tab_game.h" +#include "../../interface/widgets/tabs/tab_game.h" +#include "../../interface/widgets/utility/get_text_with_max.h" #include "../board/card_item.h" #include "../dialogs/dlg_move_top_cards_until.h" #include "../dialogs/dlg_roll_dice.h" #include "../zones/logic/view_zone_logic.h" #include "card_menu_action_type.h" -#include "pb/command_attach_card.pb.h" -#include "pb/command_change_zone_properties.pb.h" -#include "pb/command_concede.pb.h" -#include "pb/command_create_token.pb.h" -#include "pb/command_draw_cards.pb.h" -#include "pb/command_flip_card.pb.h" -#include "pb/command_game_say.pb.h" -#include "pb/command_move_card.pb.h" -#include "pb/command_mulligan.pb.h" -#include "pb/command_reveal_cards.pb.h" -#include "pb/command_roll_die.pb.h" -#include "pb/command_set_card_attr.pb.h" -#include "pb/command_set_card_counter.pb.h" -#include "pb/command_shuffle.pb.h" -#include "pb/command_undo_draw.pb.h" -#include "trice_limits.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // milliseconds in between triggers of the move top cards until action static constexpr int MOVE_TOP_CARD_UNTIL_INTERVAL = 100; diff --git a/cockatrice/src/game/player/player_actions.h b/cockatrice/src/game/player/player_actions.h index 02991b60b..aba3726e8 100644 --- a/cockatrice/src/game/player/player_actions.h +++ b/cockatrice/src/game/player/player_actions.h @@ -7,12 +7,13 @@ #ifndef COCKATRICE_PLAYER_ACTIONS_H #define COCKATRICE_PLAYER_ACTIONS_H -#include "../../card/card_relation_type.h" #include "event_processing_options.h" #include "player.h" #include #include +#include +#include namespace google { diff --git a/cockatrice/src/game/player/player_event_handler.cpp b/cockatrice/src/game/player/player_event_handler.cpp index 969ffd4d2..972229489 100644 --- a/cockatrice/src/game/player/player_event_handler.cpp +++ b/cockatrice/src/game/player/player_event_handler.cpp @@ -1,34 +1,35 @@ #include "player_event_handler.h" -#include "../../tabs/tab_game.h" +#include "../../interface/widgets/tabs/tab_game.h" #include "../board/arrow_item.h" #include "../board/card_item.h" #include "../board/card_list.h" #include "../zones/view_zone.h" -#include "pb/command_set_card_attr.pb.h" -#include "pb/context_move_card.pb.h" -#include "pb/context_undo_draw.pb.h" -#include "pb/event_attach_card.pb.h" -#include "pb/event_change_zone_properties.pb.h" -#include "pb/event_create_arrow.pb.h" -#include "pb/event_create_counter.pb.h" -#include "pb/event_create_token.pb.h" -#include "pb/event_del_counter.pb.h" -#include "pb/event_delete_arrow.pb.h" -#include "pb/event_destroy_card.pb.h" -#include "pb/event_draw_cards.pb.h" -#include "pb/event_dump_zone.pb.h" -#include "pb/event_flip_card.pb.h" -#include "pb/event_game_say.pb.h" -#include "pb/event_move_card.pb.h" -#include "pb/event_reveal_cards.pb.h" -#include "pb/event_roll_die.pb.h" -#include "pb/event_set_card_attr.pb.h" -#include "pb/event_set_card_counter.pb.h" -#include "pb/event_set_counter.pb.h" -#include "pb/event_shuffle.pb.h" #include "player.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + PlayerEventHandler::PlayerEventHandler(Player *_player) : player(_player) { } diff --git a/cockatrice/src/game/player/player_event_handler.h b/cockatrice/src/game/player/player_event_handler.h index e7d47b0de..5d1ddd4b4 100644 --- a/cockatrice/src/game/player/player_event_handler.h +++ b/cockatrice/src/game/player/player_event_handler.h @@ -9,8 +9,8 @@ #include "event_processing_options.h" #include -#include -#include +#include +#include class CardItem; class CardZoneLogic; diff --git a/cockatrice/src/game/player/player_graphics_item.cpp b/cockatrice/src/game/player/player_graphics_item.cpp index b4553694b..e609591b3 100644 --- a/cockatrice/src/game/player/player_graphics_item.cpp +++ b/cockatrice/src/game/player/player_graphics_item.cpp @@ -1,6 +1,6 @@ #include "player_graphics_item.h" -#include "../../tabs/tab_game.h" +#include "../../interface/widgets/tabs/tab_game.h" #include "../hand_counter.h" PlayerGraphicsItem::PlayerGraphicsItem(Player *_player) : player(_player) diff --git a/cockatrice/src/game/player/player_info.h b/cockatrice/src/game/player/player_info.h index e649b1584..a9353bf60 100644 --- a/cockatrice/src/game/player/player_info.h +++ b/cockatrice/src/game/player/player_info.h @@ -7,8 +7,6 @@ #ifndef COCKATRICE_PLAYER_INFO_H #define COCKATRICE_PLAYER_INFO_H -#include "../../../common/pb/serverinfo_user.pb.h" -#include "../../deck/deck_loader.h" #include "../zones/hand_zone.h" #include "../zones/pile_zone.h" #include "../zones/stack_zone.h" @@ -16,6 +14,8 @@ #include "player_target.h" #include +#include +#include class PlayerInfo : public QObject { diff --git a/cockatrice/src/game/player/player_list_widget.cpp b/cockatrice/src/game/player/player_list_widget.cpp index 9df7e94da..3281d8541 100644 --- a/cockatrice/src/game/player/player_list_widget.cpp +++ b/cockatrice/src/game/player/player_list_widget.cpp @@ -1,21 +1,21 @@ #include "player_list_widget.h" #include "../../interface/pixel_map_generator.h" -#include "../../server/abstract_client.h" -#include "../../server/user/user_context_menu.h" -#include "../../server/user/user_list_manager.h" -#include "../../server/user/user_list_widget.h" -#include "../../tabs/tab_account.h" -#include "../../tabs/tab_game.h" -#include "../../tabs/tab_supervisor.h" -#include "pb/command_kick_from_game.pb.h" -#include "pb/serverinfo_playerproperties.pb.h" -#include "pb/session_commands.pb.h" +#include "../../interface/widgets/server/user/user_context_menu.h" +#include "../../interface/widgets/server/user/user_list_manager.h" +#include "../../interface/widgets/server/user/user_list_widget.h" +#include "../../interface/widgets/tabs/tab_account.h" +#include "../../interface/widgets/tabs/tab_game.h" +#include "../../interface/widgets/tabs/tab_supervisor.h" #include #include #include #include +#include +#include +#include +#include PlayerListItemDelegate::PlayerListItemDelegate(QObject *const parent) : QStyledItemDelegate(parent) { diff --git a/cockatrice/src/game/player/player_manager.h b/cockatrice/src/game/player/player_manager.h index 2c257f7b4..20542d466 100644 --- a/cockatrice/src/game/player/player_manager.h +++ b/cockatrice/src/game/player/player_manager.h @@ -7,10 +7,9 @@ #ifndef COCKATRICE_PLAYER_MANAGER_H #define COCKATRICE_PLAYER_MANAGER_H -#include "pb/serverinfo_playerproperties.pb.h" - #include #include +#include class AbstractGame; class Player; diff --git a/cockatrice/src/game/player/player_target.cpp b/cockatrice/src/game/player/player_target.cpp index 6ece3e261..a7a5cc5e7 100644 --- a/cockatrice/src/game/player/player_target.cpp +++ b/cockatrice/src/game/player/player_target.cpp @@ -1,13 +1,13 @@ #include "player_target.h" #include "../../interface/pixel_map_generator.h" -#include "pb/serverinfo_user.pb.h" #include "player.h" #include #include #include #include +#include PlayerCounter::PlayerCounter(Player *_player, int _id, const QString &_name, int _value, QGraphicsItem *parent) : AbstractCounter(_player, _id, _name, false, _value, false, parent) diff --git a/cockatrice/src/game/replay.cpp b/cockatrice/src/game/replay.cpp index ca57af9bc..6886f817a 100644 --- a/cockatrice/src/game/replay.cpp +++ b/cockatrice/src/game/replay.cpp @@ -1,6 +1,6 @@ #include "replay.h" -#include "../tabs/tab_game.h" +#include "../interface/widgets/tabs/tab_game.h" Replay::Replay(TabGame *_tab, GameReplay *_replay) : AbstractGame(_tab) { diff --git a/cockatrice/src/game/zones/hand_zone.cpp b/cockatrice/src/game/zones/hand_zone.cpp index 19ea272b2..5d63e8a28 100644 --- a/cockatrice/src/game/zones/hand_zone.cpp +++ b/cockatrice/src/game/zones/hand_zone.cpp @@ -1,13 +1,13 @@ #include "hand_zone.h" #include "../../interface/theme_manager.h" -#include "../../settings/cache_settings.h" #include "../board/card_drag_item.h" #include "../board/card_item.h" #include "../player/player.h" -#include "pb/command_move_card.pb.h" #include +#include +#include HandZone::HandZone(HandZoneLogic *_logic, int _zoneHeight, QGraphicsItem *parent) : SelectZone(_logic, parent), zoneHeight(_zoneHeight) diff --git a/cockatrice/src/game/zones/logic/card_zone_logic.cpp b/cockatrice/src/game/zones/logic/card_zone_logic.cpp index 70cb21b8e..b5869489a 100644 --- a/cockatrice/src/game/zones/logic/card_zone_logic.cpp +++ b/cockatrice/src/game/zones/logic/card_zone_logic.cpp @@ -1,16 +1,16 @@ #include "card_zone_logic.h" -#include "../../../database/card_database_manager.h" #include "../../board/card_item.h" #include "../../player/player.h" #include "../pile_zone.h" #include "../view_zone.h" -#include "pb/command_move_card.pb.h" -#include "pb/serverinfo_user.pb.h" #include "view_zone_logic.h" #include #include +#include +#include +#include /** * @param _player the player that the zone belongs to diff --git a/cockatrice/src/game/zones/logic/view_zone_logic.cpp b/cockatrice/src/game/zones/logic/view_zone_logic.cpp index 6050cbadf..e61c126e7 100644 --- a/cockatrice/src/game/zones/logic/view_zone_logic.cpp +++ b/cockatrice/src/game/zones/logic/view_zone_logic.cpp @@ -1,8 +1,9 @@ #include "view_zone_logic.h" -#include "../../../settings/cache_settings.h" #include "../../board/card_item.h" +#include + /** * @param _player the player that the cards are revealed to. * @param _origZone the zone the cards were revealed from. diff --git a/cockatrice/src/game/zones/pile_zone.cpp b/cockatrice/src/game/zones/pile_zone.cpp index 5df91a64d..cafb29038 100644 --- a/cockatrice/src/game/zones/pile_zone.cpp +++ b/cockatrice/src/game/zones/pile_zone.cpp @@ -4,12 +4,12 @@ #include "../board/card_item.h" #include "../player/player.h" #include "logic/pile_zone_logic.h" -#include "pb/command_move_card.pb.h" #include "view_zone.h" #include #include #include +#include PileZone::PileZone(PileZoneLogic *_logic, QGraphicsItem *parent) : CardZone(_logic, parent) { diff --git a/cockatrice/src/game/zones/select_zone.cpp b/cockatrice/src/game/zones/select_zone.cpp index 863edab48..ec24e4f9f 100644 --- a/cockatrice/src/game/zones/select_zone.cpp +++ b/cockatrice/src/game/zones/select_zone.cpp @@ -1,11 +1,11 @@ #include "select_zone.h" -#include "../../settings/cache_settings.h" #include "../board/card_item.h" #include "../game_scene.h" #include #include +#include qreal divideCardSpaceInZone(qreal index, int cardCount, qreal totalHeight, qreal cardHeight, bool reverse) { diff --git a/cockatrice/src/game/zones/stack_zone.cpp b/cockatrice/src/game/zones/stack_zone.cpp index 0eedd5500..4d8c15da8 100644 --- a/cockatrice/src/game/zones/stack_zone.cpp +++ b/cockatrice/src/game/zones/stack_zone.cpp @@ -1,16 +1,16 @@ #include "stack_zone.h" #include "../../interface/theme_manager.h" -#include "../../settings/cache_settings.h" #include "../board/arrow_item.h" #include "../board/card_drag_item.h" #include "../board/card_item.h" #include "../player/player.h" #include "logic/stack_zone_logic.h" -#include "pb/command_move_card.pb.h" #include #include +#include +#include StackZone::StackZone(StackZoneLogic *_logic, int _zoneHeight, QGraphicsItem *parent) : SelectZone(_logic, parent), zoneHeight(_zoneHeight) diff --git a/cockatrice/src/game/zones/table_zone.cpp b/cockatrice/src/game/zones/table_zone.cpp index 4573cc5c3..b0484f984 100644 --- a/cockatrice/src/game/zones/table_zone.cpp +++ b/cockatrice/src/game/zones/table_zone.cpp @@ -1,19 +1,19 @@ #include "table_zone.h" -#include "../../card/card_info.h" #include "../../interface/theme_manager.h" -#include "../../settings/cache_settings.h" #include "../board/arrow_item.h" #include "../board/card_drag_item.h" #include "../board/card_item.h" #include "../player/player.h" #include "logic/table_zone_logic.h" -#include "pb/command_move_card.pb.h" -#include "pb/command_set_card_attr.pb.h" #include #include #include +#include +#include +#include +#include const QColor TableZone::BACKGROUND_COLOR = QColor(100, 100, 100); const QColor TableZone::FADE_MASK = QColor(0, 0, 0, 80); diff --git a/cockatrice/src/game/zones/view_zone.cpp b/cockatrice/src/game/zones/view_zone.cpp index 1eb99f5c1..d5eea9dfe 100644 --- a/cockatrice/src/game/zones/view_zone.cpp +++ b/cockatrice/src/game/zones/view_zone.cpp @@ -1,21 +1,21 @@ #include "view_zone.h" -#include "../../card/card_info.h" -#include "../../server/pending_command.h" #include "../board/card_drag_item.h" #include "../board/card_item.h" #include "../player/player.h" #include "logic/view_zone_logic.h" -#include "pb/command_dump_zone.pb.h" -#include "pb/command_move_card.pb.h" -#include "pb/response_dump_zone.pb.h" -#include "pb/serverinfo_card.pb.h" #include #include #include #include #include +#include +#include +#include +#include +#include +#include /** * @param parent the parent QGraphicsWidget containing the reveal zone diff --git a/cockatrice/src/game/zones/view_zone.h b/cockatrice/src/game/zones/view_zone.h index e452ecedd..06c1e77fb 100644 --- a/cockatrice/src/game/zones/view_zone.h +++ b/cockatrice/src/game/zones/view_zone.h @@ -13,7 +13,7 @@ #include #include -#include +#include inline Q_LOGGING_CATEGORY(ViewZoneLog, "view_zone"); diff --git a/cockatrice/src/game/zones/view_zone_widget.cpp b/cockatrice/src/game/zones/view_zone_widget.cpp index f0615d256..2424feb9b 100644 --- a/cockatrice/src/game/zones/view_zone_widget.cpp +++ b/cockatrice/src/game/zones/view_zone_widget.cpp @@ -2,11 +2,9 @@ #include "../../filters/syntax_help.h" #include "../../interface/pixel_map_generator.h" -#include "../../settings/cache_settings.h" #include "../board/card_item.h" #include "../game_scene.h" #include "../player/player.h" -#include "pb/command_shuffle.pb.h" #include "view_zone.h" #include @@ -18,6 +16,8 @@ #include #include #include +#include +#include /** * @param _player the player the cards were revealed to. diff --git a/cockatrice/src/game/zones/view_zone_widget.h b/cockatrice/src/game/zones/view_zone_widget.h index 862026b21..272ff5560 100644 --- a/cockatrice/src/game/zones/view_zone_widget.h +++ b/cockatrice/src/game/zones/view_zone_widget.h @@ -7,7 +7,6 @@ #ifndef ZONEVIEWWIDGET_H #define ZONEVIEWWIDGET_H -#include "../../utility/macros.h" #include "logic/card_zone_logic.h" #include @@ -15,6 +14,7 @@ #include #include #include +#include class QLabel; class QPushButton; diff --git a/cockatrice/src/picture_loader/picture_loader.cpp b/cockatrice/src/interface/card_picture_loader/card_picture_loader.cpp similarity index 65% rename from cockatrice/src/picture_loader/picture_loader.cpp rename to cockatrice/src/interface/card_picture_loader/card_picture_loader.cpp index 22f81c5dd..56b00e4b8 100644 --- a/cockatrice/src/picture_loader/picture_loader.cpp +++ b/cockatrice/src/interface/card_picture_loader/card_picture_loader.cpp @@ -1,6 +1,4 @@ -#include "picture_loader.h" - -#include "../settings/cache_settings.h" +#include "card_picture_loader.h" #include #include @@ -17,48 +15,51 @@ #include #include #include +#include #include // never cache more than 300 cards at once for a single deck #define CACHED_CARD_PER_DECK_MAX 300 -PictureLoader::PictureLoader() : QObject(nullptr) +CardPictureLoader::CardPictureLoader() : QObject(nullptr) { - worker = new PictureLoaderWorker; - connect(&SettingsCache::instance(), &SettingsCache::picsPathChanged, this, &PictureLoader::picsPathChanged); - connect(&SettingsCache::instance(), &SettingsCache::picDownloadChanged, this, &PictureLoader::picDownloadChanged); + worker = new CardPictureLoaderWorker; + connect(&SettingsCache::instance(), &SettingsCache::picsPathChanged, this, &CardPictureLoader::picsPathChanged); + connect(&SettingsCache::instance(), &SettingsCache::picDownloadChanged, this, + &CardPictureLoader::picDownloadChanged); - connect(worker, &PictureLoaderWorker::imageLoaded, this, &PictureLoader::imageLoaded); + connect(worker, &CardPictureLoaderWorker::imageLoaded, this, &CardPictureLoader::imageLoaded); - statusBar = new PictureLoaderStatusBar(nullptr); + statusBar = new CardPictureLoaderStatusBar(nullptr); QMainWindow *mainWindow = qobject_cast(QApplication::activeWindow()); if (mainWindow) { mainWindow->statusBar()->addPermanentWidget(statusBar); } - connect(worker, &PictureLoaderWorker::imageRequestQueued, statusBar, &PictureLoaderStatusBar::addQueuedImageLoad); - connect(worker, &PictureLoaderWorker::imageRequestSucceeded, statusBar, - &PictureLoaderStatusBar::addSuccessfulImageLoad); + connect(worker, &CardPictureLoaderWorker::imageRequestQueued, statusBar, + &CardPictureLoaderStatusBar::addQueuedImageLoad); + connect(worker, &CardPictureLoaderWorker::imageRequestSucceeded, statusBar, + &CardPictureLoaderStatusBar::addSuccessfulImageLoad); } -PictureLoader::~PictureLoader() +CardPictureLoader::~CardPictureLoader() { worker->deleteLater(); } -void PictureLoader::getCardBackPixmap(QPixmap &pixmap, QSize size) +void CardPictureLoader::getCardBackPixmap(QPixmap &pixmap, QSize size) { QString backCacheKey = "_trice_card_back_" + QString::number(size.width()) + "x" + QString::number(size.height()); if (!QPixmapCache::find(backCacheKey, &pixmap)) { - qCDebug(PictureLoaderLog) << "PictureLoader: cache miss for" << backCacheKey; + qCDebug(CardPictureLoaderLog) << "PictureLoader: cache miss for" << backCacheKey; QPixmap tmpPixmap("theme:cardback"); if (tmpPixmap.isNull()) { - qCWarning(PictureLoaderLog) << "Failed to load 'theme:cardback'! Using fallback pixmap."; + qCWarning(CardPictureLoaderLog) << "Failed to load 'theme:cardback'! Using fallback pixmap."; tmpPixmap = QPixmap(size); tmpPixmap.fill(Qt::gray); // Fallback to a gray pixmap } else { - qCDebug(PictureLoaderLog) << "Successfully loaded 'theme:cardback'."; + qCDebug(CardPictureLoaderLog) << "Successfully loaded 'theme:cardback'."; } pixmap = tmpPixmap.scaled(size, Qt::KeepAspectRatio, Qt::SmoothTransformation); @@ -66,20 +67,21 @@ void PictureLoader::getCardBackPixmap(QPixmap &pixmap, QSize size) } } -void PictureLoader::getCardBackLoadingInProgressPixmap(QPixmap &pixmap, QSize size) +void CardPictureLoader::getCardBackLoadingInProgressPixmap(QPixmap &pixmap, QSize size) { QString backCacheKey = "_trice_card_back_inprogress_" + QString::number(size.width()) + "x" + QString::number(size.height()); if (!QPixmapCache::find(backCacheKey, &pixmap)) { - qCDebug(PictureLoaderCardBackCacheFailLog) << "PictureLoader: cache miss for" << backCacheKey; + qCDebug(CardPictureLoaderCardBackCacheFailLog) << "PictureLoader: cache miss for" << backCacheKey; QPixmap tmpPixmap("theme:cardback"); if (tmpPixmap.isNull()) { - qCWarning(PictureLoaderLog) << "Failed to load 'theme:cardback' for in-progress state! Using fallback."; + qCWarning(CardPictureLoaderLog) << "Failed to load 'theme:cardback' for in-progress state! Using fallback."; tmpPixmap = QPixmap(size); tmpPixmap.fill(Qt::blue); // Fallback with blue color } else { - qCDebug(PictureLoaderCardBackCacheFailLog) << "Successfully loaded 'theme:cardback' for in-progress state."; + qCDebug(CardPictureLoaderCardBackCacheFailLog) + << "Successfully loaded 'theme:cardback' for in-progress state."; } pixmap = tmpPixmap.scaled(size, Qt::KeepAspectRatio, Qt::SmoothTransformation); @@ -87,20 +89,20 @@ void PictureLoader::getCardBackLoadingInProgressPixmap(QPixmap &pixmap, QSize si } } -void PictureLoader::getCardBackLoadingFailedPixmap(QPixmap &pixmap, QSize size) +void CardPictureLoader::getCardBackLoadingFailedPixmap(QPixmap &pixmap, QSize size) { QString backCacheKey = "_trice_card_back_failed_" + QString::number(size.width()) + "x" + QString::number(size.height()); if (!QPixmapCache::find(backCacheKey, &pixmap)) { - qCDebug(PictureLoaderCardBackCacheFailLog) << "PictureLoader: cache miss for" << backCacheKey; + qCDebug(CardPictureLoaderCardBackCacheFailLog) << "PictureLoader: cache miss for" << backCacheKey; QPixmap tmpPixmap("theme:cardback"); if (tmpPixmap.isNull()) { - qCWarning(PictureLoaderLog) << "Failed to load 'theme:cardback' for failed state! Using fallback."; + qCWarning(CardPictureLoaderLog) << "Failed to load 'theme:cardback' for failed state! Using fallback."; tmpPixmap = QPixmap(size); tmpPixmap.fill(Qt::red); // Fallback with red color } else { - qCDebug(PictureLoaderCardBackCacheFailLog) << "Successfully loaded 'theme:cardback' for failed state."; + qCDebug(CardPictureLoaderCardBackCacheFailLog) << "Successfully loaded 'theme:cardback' for failed state."; } pixmap = tmpPixmap.scaled(size, Qt::KeepAspectRatio, Qt::SmoothTransformation); @@ -108,10 +110,10 @@ void PictureLoader::getCardBackLoadingFailedPixmap(QPixmap &pixmap, QSize size) } } -void PictureLoader::getPixmap(QPixmap &pixmap, const ExactCard &card, QSize size) +void CardPictureLoader::getPixmap(QPixmap &pixmap, const ExactCard &card, QSize size) { if (!card) { - qCWarning(PictureLoaderLog) << "getPixmap called with null card!"; + qCWarning(CardPictureLoaderLog) << "getPixmap called with null card!"; return; } @@ -126,13 +128,13 @@ void PictureLoader::getPixmap(QPixmap &pixmap, const ExactCard &card, QSize size QPixmap bigPixmap; if (QPixmapCache::find(key, &bigPixmap)) { if (bigPixmap.isNull()) { - qCDebug(PictureLoaderLog) << "Cached pixmap for key" << key << "is NULL!"; + qCDebug(CardPictureLoaderLog) << "Cached pixmap for key" << key << "is NULL!"; return; } QScreen *screen = qApp->primaryScreen(); qreal dpr = screen ? screen->devicePixelRatio() : 1.0; - qCDebug(PictureLoaderLog) << "Scaling cached image for" << card.getName(); + qCDebug(CardPictureLoaderLog) << "Scaling cached image for" << card.getName(); pixmap = bigPixmap.scaled(size * dpr, Qt::KeepAspectRatio, Qt::SmoothTransformation); pixmap.setDevicePixelRatio(dpr); @@ -141,14 +143,14 @@ void PictureLoader::getPixmap(QPixmap &pixmap, const ExactCard &card, QSize size } // add the card to the load queue - qCDebug(PictureLoaderLog) << "Enqueuing " << card.getName() << " for " << card.getPixmapCacheKey(); + qCDebug(CardPictureLoaderLog) << "Enqueuing " << card.getName() << " for " << card.getPixmapCacheKey(); getInstance().worker->enqueueImageLoad(card); } -void PictureLoader::imageLoaded(const ExactCard &card, const QImage &image) +void CardPictureLoader::imageLoaded(const ExactCard &card, const QImage &image) { if (image.isNull()) { - qCDebug(PictureLoaderLog) << "Caching NULL pixmap for" << card.getName(); + qCDebug(CardPictureLoaderLog) << "Caching NULL pixmap for" << card.getName(); QPixmapCache::insert(card.getPixmapCacheKey(), QPixmap()); } else { if (card.getInfo().getUpsideDownArt()) { @@ -164,7 +166,7 @@ void PictureLoader::imageLoaded(const ExactCard &card, const QImage &image) } // imageLoaded should only be reached if the exactCard isn't already in cache. - // (plus there's a deduplication mechanism in PictureLoaderWorker) + // (plus there's a deduplication mechanism in CardPictureLoaderWorker) // It should be safe to connect the CardInfo here without worrying about redundant connections. connect(card.getCardPtr().data(), &QObject::destroyed, this, [cacheKey = card.getPixmapCacheKey()] { QPixmapCache::remove(cacheKey); }); @@ -172,17 +174,17 @@ void PictureLoader::imageLoaded(const ExactCard &card, const QImage &image) card.emitPixmapUpdated(); } -void PictureLoader::clearPixmapCache() +void CardPictureLoader::clearPixmapCache() { QPixmapCache::clear(); } -void PictureLoader::clearNetworkCache() +void CardPictureLoader::clearNetworkCache() { getInstance().worker->clearNetworkCache(); } -void PictureLoader::cacheCardPixmaps(const QList &cards) +void CardPictureLoader::cacheCardPixmaps(const QList &cards) { QPixmap tmp; int max = qMin(cards.size(), CACHED_CARD_PER_DECK_MAX); @@ -201,17 +203,17 @@ void PictureLoader::cacheCardPixmaps(const QList &cards) } } -void PictureLoader::picDownloadChanged() +void CardPictureLoader::picDownloadChanged() { QPixmapCache::clear(); } -void PictureLoader::picsPathChanged() +void CardPictureLoader::picsPathChanged() { QPixmapCache::clear(); } -bool PictureLoader::hasCustomArt() +bool CardPictureLoader::hasCustomArt() { auto picsPath = SettingsCache::instance().getPicsPath(); QDirIterator it(picsPath, QDir::Dirs | QDir::NoDotAndDotDot); diff --git a/cockatrice/src/picture_loader/picture_loader.h b/cockatrice/src/interface/card_picture_loader/card_picture_loader.h similarity index 53% rename from cockatrice/src/picture_loader/picture_loader.h rename to cockatrice/src/interface/card_picture_loader/card_picture_loader.h index 05a82f708..213231cd9 100644 --- a/cockatrice/src/picture_loader/picture_loader.h +++ b/cockatrice/src/interface/card_picture_loader/card_picture_loader.h @@ -1,40 +1,40 @@ /** - * @file picture_loader.h + * @file card_picture_loader.h * @ingroup PictureLoader * @brief TODO: Document this. */ -#ifndef PICTURELOADER_H -#define PICTURELOADER_H +#ifndef CARD_PICTURE_LOADER_H +#define CARD_PICTURE_LOADER_H -#include "../card/card_info.h" -#include "picture_loader_status_bar.h" -#include "picture_loader_worker.h" +#include "card_picture_loader_status_bar.h" +#include "card_picture_loader_worker.h" #include +#include -inline Q_LOGGING_CATEGORY(PictureLoaderLog, "picture_loader"); -inline Q_LOGGING_CATEGORY(PictureLoaderCardBackCacheFailLog, "picture_loader.card_back_cache_fail"); +inline Q_LOGGING_CATEGORY(CardPictureLoaderLog, "card_picture_loader"); +inline Q_LOGGING_CATEGORY(CardPictureLoaderCardBackCacheFailLog, "card_picture_loader.card_back_cache_fail"); -class PictureLoader : public QObject +class CardPictureLoader : public QObject { Q_OBJECT public: - static PictureLoader &getInstance() + static CardPictureLoader &getInstance() { - static PictureLoader instance; + static CardPictureLoader instance; return instance; } private: - explicit PictureLoader(); - ~PictureLoader() override; + explicit CardPictureLoader(); + ~CardPictureLoader() override; // Singleton - Don't implement copy constructor and assign operator - PictureLoader(PictureLoader const &); - void operator=(PictureLoader const &); + CardPictureLoader(CardPictureLoader const &); + void operator=(CardPictureLoader const &); - PictureLoaderWorker *worker; - PictureLoaderStatusBar *statusBar; + CardPictureLoaderWorker *worker; + CardPictureLoaderStatusBar *statusBar; public: static void getPixmap(QPixmap &pixmap, const ExactCard &card, QSize size); diff --git a/cockatrice/src/picture_loader/picture_loader_local.cpp b/cockatrice/src/interface/card_picture_loader/card_picture_loader_local.cpp similarity index 77% rename from cockatrice/src/picture_loader/picture_loader_local.cpp rename to cockatrice/src/interface/card_picture_loader/card_picture_loader_local.cpp index a939f2c66..a2058b0ed 100644 --- a/cockatrice/src/picture_loader/picture_loader_local.cpp +++ b/cockatrice/src/interface/card_picture_loader/card_picture_loader_local.cpp @@ -1,29 +1,30 @@ -#include "picture_loader_local.h" +#include "card_picture_loader_local.h" -#include "../database/card_database_manager.h" -#include "../settings/cache_settings.h" -#include "picture_to_load.h" +#include "card_picture_to_load.h" #include #include +#include +#include static constexpr int REFRESH_INTERVAL_MS = 10 * 1000; -PictureLoaderLocal::PictureLoaderLocal(QObject *parent) +CardPictureLoaderLocal::CardPictureLoaderLocal(QObject *parent) : QObject(parent), picsPath(SettingsCache::instance().getPicsPath()), customPicsPath(SettingsCache::instance().getCustomPicsPath()) { // Hook up signals to settings - connect(&SettingsCache::instance(), &SettingsCache::picsPathChanged, this, &PictureLoaderLocal::picsPathChanged); + connect(&SettingsCache::instance(), &SettingsCache::picsPathChanged, this, + &CardPictureLoaderLocal::picsPathChanged); refreshIndex(); refreshTimer = new QTimer(this); - connect(refreshTimer, &QTimer::timeout, this, &PictureLoaderLocal::refreshIndex); + connect(refreshTimer, &QTimer::timeout, this, &CardPictureLoaderLocal::refreshIndex); refreshTimer->start(REFRESH_INTERVAL_MS); } -void PictureLoaderLocal::refreshIndex() +void CardPictureLoaderLocal::refreshIndex() { customFolderIndex.clear(); @@ -42,8 +43,8 @@ void PictureLoaderLocal::refreshIndex() } } - qCDebug(PictureLoaderLocalLog) << "Finished indexing local image folder CUSTOM; map now has" - << customFolderIndex.size() << "entries."; + qCDebug(CardPictureLoaderLocalLog) << "Finished indexing local image folder CUSTOM; map now has" + << customFolderIndex.size() << "entries."; } /** @@ -52,7 +53,7 @@ void PictureLoaderLocal::refreshIndex() * @param toLoad The card to load * @return The loaded image, or an empty QImage if loading failed. */ -QImage PictureLoaderLocal::tryLoad(const ExactCard &toLoad) const +QImage CardPictureLoaderLocal::tryLoad(const ExactCard &toLoad) const { PrintingInfo setInstance = toLoad.getPrinting(); @@ -67,15 +68,15 @@ QImage PictureLoaderLocal::tryLoad(const ExactCard &toLoad) const providerId = setInstance.getUuid(); } - qCDebug(PictureLoaderLocalLog).nospace() + qCDebug(CardPictureLoaderLocalLog).nospace() << "[card: " << cardName << " set: " << setName << "]: Attempting to load picture from local"; return tryLoadCardImageFromDisk(setName, correctedCardName, collectorNumber, providerId); } -QImage PictureLoaderLocal::tryLoadCardImageFromDisk(const QString &setName, - const QString &correctedCardName, - const QString &collectorNumber, - const QString &providerId) const +QImage CardPictureLoaderLocal::tryLoadCardImageFromDisk(const QString &setName, + const QString &correctedCardName, + const QString &collectorNumber, + const QString &providerId) const { QImage image; QImageReader imgReader; @@ -134,7 +135,7 @@ QImage PictureLoaderLocal::tryLoadCardImageFromDisk(const QString &setName, imgReader.setFileName(fullPath); if (imgReader.read(&image)) { - qCDebug(PictureLoaderLocalLog).nospace() + qCDebug(CardPictureLoaderLocalLog).nospace() << "[card: " << correctedCardName << " set: " << setName << "] Found picture at: " << fullPath; return image; } @@ -142,12 +143,12 @@ QImage PictureLoaderLocal::tryLoadCardImageFromDisk(const QString &setName, } } - qCDebug(PictureLoaderLocalLog).nospace() + qCDebug(CardPictureLoaderLocalLog).nospace() << "[card: " << correctedCardName << " set: " << setName << "]: Picture NOT found on disk."; return QImage(); } -void PictureLoaderLocal::picsPathChanged() +void CardPictureLoaderLocal::picsPathChanged() { picsPath = SettingsCache::instance().getPicsPath(); customPicsPath = SettingsCache::instance().getCustomPicsPath(); diff --git a/cockatrice/src/picture_loader/picture_loader_local.h b/cockatrice/src/interface/card_picture_loader/card_picture_loader_local.h similarity index 78% rename from cockatrice/src/picture_loader/picture_loader_local.h rename to cockatrice/src/interface/card_picture_loader/card_picture_loader_local.h index 184f43395..1d4325412 100644 --- a/cockatrice/src/picture_loader/picture_loader_local.h +++ b/cockatrice/src/interface/card_picture_loader/card_picture_loader_local.h @@ -1,5 +1,5 @@ /** - * @file picture_loader_local.h + * @file card_picture_loader_local.h * @ingroup PictureLoader * @brief TODO: Document this. */ @@ -7,24 +7,23 @@ #ifndef PICTURE_LOADER_LOCAL_H #define PICTURE_LOADER_LOCAL_H -#include "../card/exact_card.h" - #include #include #include +#include -inline Q_LOGGING_CATEGORY(PictureLoaderLocalLog, "picture_loader.local"); +inline Q_LOGGING_CATEGORY(CardPictureLoaderLocalLog, "card_picture_loader.local"); /** * Handles searching for and loading card images from the local pics and custom image folders. * This class maintains an index of the CUSTOM folder, to avoid repeatedly searching the entire directory. */ -class PictureLoaderLocal : public QObject +class CardPictureLoaderLocal : public QObject { Q_OBJECT public: - explicit PictureLoaderLocal(QObject *parent); + explicit CardPictureLoaderLocal(QObject *parent); QImage tryLoad(const ExactCard &toLoad) const; diff --git a/cockatrice/src/picture_loader/picture_loader_request_status_display_widget.cpp b/cockatrice/src/interface/card_picture_loader/card_picture_loader_request_status_display_widget.cpp similarity index 74% rename from cockatrice/src/picture_loader/picture_loader_request_status_display_widget.cpp rename to cockatrice/src/interface/card_picture_loader/card_picture_loader_request_status_display_widget.cpp index 6403f576c..d1895af06 100644 --- a/cockatrice/src/picture_loader/picture_loader_request_status_display_widget.cpp +++ b/cockatrice/src/interface/card_picture_loader/card_picture_loader_request_status_display_widget.cpp @@ -1,9 +1,9 @@ -#include "picture_loader_request_status_display_widget.h" +#include "card_picture_loader_request_status_display_widget.h" -PictureLoaderRequestStatusDisplayWidget::PictureLoaderRequestStatusDisplayWidget(QWidget *parent, - const QUrl &_url, - const ExactCard &card, - const QString &setName) +CardPictureLoaderRequestStatusDisplayWidget::CardPictureLoaderRequestStatusDisplayWidget(QWidget *parent, + const QUrl &_url, + const ExactCard &card, + const QString &setName) : QWidget(parent) { layout = new QHBoxLayout(this); diff --git a/cockatrice/src/picture_loader/picture_loader_request_status_display_widget.h b/cockatrice/src/interface/card_picture_loader/card_picture_loader_request_status_display_widget.h similarity index 75% rename from cockatrice/src/picture_loader/picture_loader_request_status_display_widget.h rename to cockatrice/src/interface/card_picture_loader/card_picture_loader_request_status_display_widget.h index b74412587..be032ae64 100644 --- a/cockatrice/src/picture_loader/picture_loader_request_status_display_widget.h +++ b/cockatrice/src/interface/card_picture_loader/card_picture_loader_request_status_display_widget.h @@ -1,25 +1,25 @@ /** - * @file picture_loader_request_status_display_widget.h + * @file card_picture_loader_request_status_display_widget.h * @ingroup PictureLoader * @brief TODO: Document this. */ #ifndef PICTURE_LOADER_REQUEST_STATUS_DISPLAY_WIDGET_H #define PICTURE_LOADER_REQUEST_STATUS_DISPLAY_WIDGET_H -#include "picture_loader_worker_work.h" +#include "card_picture_loader_worker_work.h" #include #include #include -class PictureLoaderRequestStatusDisplayWidget : public QWidget +class CardPictureLoaderRequestStatusDisplayWidget : public QWidget { Q_OBJECT public: - PictureLoaderRequestStatusDisplayWidget(QWidget *parent, - const QUrl &url, - const ExactCard &card, - const QString &setName); + CardPictureLoaderRequestStatusDisplayWidget(QWidget *parent, + const QUrl &url, + const ExactCard &card, + const QString &setName); void setFinished() { diff --git a/cockatrice/src/picture_loader/picture_loader_status_bar.cpp b/cockatrice/src/interface/card_picture_loader/card_picture_loader_status_bar.cpp similarity index 54% rename from cockatrice/src/picture_loader/picture_loader_status_bar.cpp rename to cockatrice/src/interface/card_picture_loader/card_picture_loader_status_bar.cpp index 40104bb23..9e7e645bd 100644 --- a/cockatrice/src/picture_loader/picture_loader_status_bar.cpp +++ b/cockatrice/src/interface/card_picture_loader/card_picture_loader_status_bar.cpp @@ -1,8 +1,8 @@ -#include "picture_loader_status_bar.h" +#include "card_picture_loader_status_bar.h" -#include "picture_loader_request_status_display_widget.h" +#include "card_picture_loader_request_status_display_widget.h" -PictureLoaderStatusBar::PictureLoaderStatusBar(QWidget *parent) : QWidget(parent) +CardPictureLoaderStatusBar::CardPictureLoaderStatusBar(QWidget *parent) : QWidget(parent) { layout = new QHBoxLayout(this); progressBar = new QProgressBar(this); @@ -15,19 +15,19 @@ PictureLoaderStatusBar::PictureLoaderStatusBar(QWidget *parent) : QWidget(parent cleaner = new QTimer(this); cleaner->setInterval(1000); - connect(cleaner, &QTimer::timeout, this, &PictureLoaderStatusBar::cleanOldEntries); + connect(cleaner, &QTimer::timeout, this, &CardPictureLoaderStatusBar::cleanOldEntries); cleaner->start(); setLayout(layout); } -void PictureLoaderStatusBar::cleanOldEntries() +void CardPictureLoaderStatusBar::cleanOldEntries() { if (!loadLog || !loadLog->popup) { return; } - for (PictureLoaderRequestStatusDisplayWidget *statusDisplayWidget : - loadLog->popup->findChildren()) { + for (CardPictureLoaderRequestStatusDisplayWidget *statusDisplayWidget : + loadLog->popup->findChildren()) { statusDisplayWidget->queryElapsedSeconds(); if (statusDisplayWidget->getFinished() && QDateTime::fromString(statusDisplayWidget->getStartTime()).secsTo(QDateTime::currentDateTime()) > 10) { @@ -38,17 +38,17 @@ void PictureLoaderStatusBar::cleanOldEntries() } } -void PictureLoaderStatusBar::addQueuedImageLoad(const QUrl &url, const ExactCard &card, const QString &setName) +void CardPictureLoaderStatusBar::addQueuedImageLoad(const QUrl &url, const ExactCard &card, const QString &setName) { - loadLog->addSettingsWidget(new PictureLoaderRequestStatusDisplayWidget(loadLog, url, card, setName)); + loadLog->addSettingsWidget(new CardPictureLoaderRequestStatusDisplayWidget(loadLog, url, card, setName)); progressBar->setMaximum(progressBar->maximum() + 1); } -void PictureLoaderStatusBar::addSuccessfulImageLoad(const QUrl &url) +void CardPictureLoaderStatusBar::addSuccessfulImageLoad(const QUrl &url) { progressBar->setValue(progressBar->value() + 1); - for (PictureLoaderRequestStatusDisplayWidget *statusDisplayWidget : - loadLog->popup->findChildren()) { + for (CardPictureLoaderRequestStatusDisplayWidget *statusDisplayWidget : + loadLog->popup->findChildren()) { if (statusDisplayWidget->getUrl() == url.toString()) { statusDisplayWidget->queryElapsedSeconds(); statusDisplayWidget->setFinished(); diff --git a/cockatrice/src/picture_loader/picture_loader_status_bar.h b/cockatrice/src/interface/card_picture_loader/card_picture_loader_status_bar.h similarity index 68% rename from cockatrice/src/picture_loader/picture_loader_status_bar.h rename to cockatrice/src/interface/card_picture_loader/card_picture_loader_status_bar.h index 366018d0e..b44d2cc20 100644 --- a/cockatrice/src/picture_loader/picture_loader_status_bar.h +++ b/cockatrice/src/interface/card_picture_loader/card_picture_loader_status_bar.h @@ -1,5 +1,5 @@ /** - * @file picture_loader_status_bar.h + * @file card_picture_loader_status_bar.h * @ingroup PictureLoader * @brief TODO: Document this. */ @@ -7,18 +7,18 @@ #ifndef PICTURE_LOADER_STATUS_BAR_H #define PICTURE_LOADER_STATUS_BAR_H -#include "../interface/widgets/quick_settings/settings_button_widget.h" -#include "picture_loader_worker_work.h" +#include "../../interface/widgets/quick_settings/settings_button_widget.h" +#include "card_picture_loader_worker_work.h" #include #include #include -class PictureLoaderStatusBar : public QWidget +class CardPictureLoaderStatusBar : public QWidget { Q_OBJECT public: - explicit PictureLoaderStatusBar(QWidget *parent); + explicit CardPictureLoaderStatusBar(QWidget *parent); public slots: void addQueuedImageLoad(const QUrl &url, const ExactCard &card, const QString &setName); diff --git a/cockatrice/src/picture_loader/picture_loader_worker.cpp b/cockatrice/src/interface/card_picture_loader/card_picture_loader_worker.cpp similarity index 78% rename from cockatrice/src/picture_loader/picture_loader_worker.cpp rename to cockatrice/src/interface/card_picture_loader/card_picture_loader_worker.cpp index 42429d0e3..f92848b22 100644 --- a/cockatrice/src/picture_loader/picture_loader_worker.cpp +++ b/cockatrice/src/interface/card_picture_loader/card_picture_loader_worker.cpp @@ -1,20 +1,20 @@ -#include "picture_loader_worker.h" +#include "card_picture_loader_worker.h" -#include "../database/card_database_manager.h" -#include "../settings/cache_settings.h" -#include "picture_loader_local.h" -#include "picture_loader_worker_work.h" +#include "card_picture_loader_local.h" +#include "card_picture_loader_worker_work.h" #include #include #include #include #include +#include +#include #include static constexpr int MAX_REQUESTS_PER_SEC = 10; -PictureLoaderWorker::PictureLoaderWorker() +CardPictureLoaderWorker::CardPictureLoaderWorker() : QObject(nullptr), picDownload(SettingsCache::instance().getPicDownload()), requestQuota(MAX_REQUESTS_PER_SEC) { networkManager = new QNetworkAccessManager(this); @@ -41,28 +41,28 @@ PictureLoaderWorker::PictureLoaderWorker() cleanStaleEntries(); connect(QCoreApplication::instance(), &QCoreApplication::aboutToQuit, this, - &PictureLoaderWorker::saveRedirectCache); + &CardPictureLoaderWorker::saveRedirectCache); - localLoader = new PictureLoaderLocal(this); + localLoader = new CardPictureLoaderLocal(this); pictureLoaderThread = new QThread; pictureLoaderThread->start(QThread::LowPriority); moveToThread(pictureLoaderThread); - connect(this, &PictureLoaderWorker::imageLoadEnqueued, this, &PictureLoaderWorker::handleImageLoadEnqueued); + connect(this, &CardPictureLoaderWorker::imageLoadEnqueued, this, &CardPictureLoaderWorker::handleImageLoadEnqueued); - connect(&requestTimer, &QTimer::timeout, this, &PictureLoaderWorker::resetRequestQuota); + connect(&requestTimer, &QTimer::timeout, this, &CardPictureLoaderWorker::resetRequestQuota); requestTimer.setInterval(1000); requestTimer.start(); } -PictureLoaderWorker::~PictureLoaderWorker() +CardPictureLoaderWorker::~CardPictureLoaderWorker() { saveRedirectCache(); pictureLoaderThread->deleteLater(); } -void PictureLoaderWorker::queueRequest(const QUrl &url, PictureLoaderWorkerWork *worker) +void CardPictureLoaderWorker::queueRequest(const QUrl &url, CardPictureLoaderWorkerWork *worker) { QUrl cachedRedirect = getCachedRedirect(url); if (!cachedRedirect.isEmpty()) { @@ -77,7 +77,7 @@ void PictureLoaderWorker::queueRequest(const QUrl &url, PictureLoaderWorkerWork } } -QNetworkReply *PictureLoaderWorker::makeRequest(const QUrl &url, PictureLoaderWorkerWork *worker) +QNetworkReply *CardPictureLoaderWorker::makeRequest(const QUrl &url, CardPictureLoaderWorkerWork *worker) { // Check for cached redirects QUrl cachedRedirect = getCachedRedirect(url); @@ -99,7 +99,7 @@ QNetworkReply *PictureLoaderWorker::makeRequest(const QUrl &url, PictureLoaderWo return reply; } -void PictureLoaderWorker::resetRequestQuota() +void CardPictureLoaderWorker::resetRequestQuota() { requestQuota = MAX_REQUESTS_PER_SEC; processQueuedRequests(); @@ -108,7 +108,7 @@ void PictureLoaderWorker::resetRequestQuota() /** * Keeps processing requests from the queue until it is empty or until the quota runs out. */ -void PictureLoaderWorker::processQueuedRequests() +void CardPictureLoaderWorker::processQueuedRequests() { while (requestQuota > 0 && processSingleRequest()) { --requestQuota; @@ -119,7 +119,7 @@ void PictureLoaderWorker::processQueuedRequests() * Immediately processes a single queued request. No-ops if the load queue is empty * @return If a request was processed */ -bool PictureLoaderWorker::processSingleRequest() +bool CardPictureLoaderWorker::processSingleRequest() { if (!requestLoadQueue.isEmpty()) { auto request = requestLoadQueue.takeFirst(); @@ -129,17 +129,17 @@ bool PictureLoaderWorker::processSingleRequest() return false; } -void PictureLoaderWorker::enqueueImageLoad(const ExactCard &card) +void CardPictureLoaderWorker::enqueueImageLoad(const ExactCard &card) { // Send call through a connection to ensure the handling is run on the pictureLoader thread emit imageLoadEnqueued(card); } -void PictureLoaderWorker::handleImageLoadEnqueued(const ExactCard &card) +void CardPictureLoaderWorker::handleImageLoadEnqueued(const ExactCard &card) { // deduplicate loads for the same card if (currentlyLoading.contains(card.getPixmapCacheKey())) { - qCDebug(PictureLoaderWorkerLog()) + qCDebug(CardPictureLoaderWorkerLog()) << "Skipping enqueued" << card.getName() << "because it's already being loaded"; return; } @@ -151,31 +151,31 @@ void PictureLoaderWorker::handleImageLoadEnqueued(const ExactCard &card) handleImageLoaded(card, image); } else { // queue up to load image from remote only after local loading failed - new PictureLoaderWorkerWork(this, card); + new CardPictureLoaderWorkerWork(this, card); } } /** * Called when image loading is done. Failures are indicated by an empty QImage. */ -void PictureLoaderWorker::handleImageLoaded(const ExactCard &card, const QImage &image) +void CardPictureLoaderWorker::handleImageLoaded(const ExactCard &card, const QImage &image) { currentlyLoading.remove(card.getPixmapCacheKey()); emit imageLoaded(card, image); } -void PictureLoaderWorker::cacheRedirect(const QUrl &originalUrl, const QUrl &redirectUrl) +void CardPictureLoaderWorker::cacheRedirect(const QUrl &originalUrl, const QUrl &redirectUrl) { redirectCache[originalUrl] = qMakePair(redirectUrl, QDateTime::currentDateTimeUtc()); // saveRedirectCache(); } -void PictureLoaderWorker::removedCachedUrl(const QUrl &url) +void CardPictureLoaderWorker::removedCachedUrl(const QUrl &url) { networkManager->cache()->remove(url); } -QUrl PictureLoaderWorker::getCachedRedirect(const QUrl &originalUrl) const +QUrl CardPictureLoaderWorker::getCachedRedirect(const QUrl &originalUrl) const { if (redirectCache.contains(originalUrl)) { return redirectCache[originalUrl].first; @@ -183,7 +183,7 @@ QUrl PictureLoaderWorker::getCachedRedirect(const QUrl &originalUrl) const return {}; } -void PictureLoaderWorker::loadRedirectCache() +void CardPictureLoaderWorker::loadRedirectCache() { QSettings settings(cacheFilePath, QSettings::IniFormat); @@ -202,7 +202,7 @@ void PictureLoaderWorker::loadRedirectCache() settings.endArray(); } -void PictureLoaderWorker::saveRedirectCache() const +void CardPictureLoaderWorker::saveRedirectCache() const { QSettings settings(cacheFilePath, QSettings::IniFormat); @@ -217,7 +217,7 @@ void PictureLoaderWorker::saveRedirectCache() const settings.endArray(); } -void PictureLoaderWorker::cleanStaleEntries() +void CardPictureLoaderWorker::cleanStaleEntries() { QDateTime now = QDateTime::currentDateTimeUtc(); @@ -231,7 +231,7 @@ void PictureLoaderWorker::cleanStaleEntries() } } -void PictureLoaderWorker::clearNetworkCache() +void CardPictureLoaderWorker::clearNetworkCache() { networkManager->cache()->clear(); redirectCache.clear(); diff --git a/cockatrice/src/picture_loader/picture_loader_worker.h b/cockatrice/src/interface/card_picture_loader/card_picture_loader_worker.h similarity index 68% rename from cockatrice/src/picture_loader/picture_loader_worker.h rename to cockatrice/src/interface/card_picture_loader/card_picture_loader_worker.h index 778ce71a0..cdee37db3 100644 --- a/cockatrice/src/picture_loader/picture_loader_worker.h +++ b/cockatrice/src/interface/card_picture_loader/card_picture_loader_worker.h @@ -1,5 +1,5 @@ /** - * @file picture_loader_worker.h + * @file card_picture_loader_worker.h * @ingroup PictureLoader * @brief TODO: Document this. */ @@ -7,11 +7,9 @@ #ifndef PICTURE_LOADER_WORKER_H #define PICTURE_LOADER_WORKER_H -#include "../card/card_info.h" -#include "../database/card_database.h" -#include "picture_loader_local.h" -#include "picture_loader_worker_work.h" -#include "picture_to_load.h" +#include "card_picture_loader_local.h" +#include "card_picture_loader_worker_work.h" +#include "card_picture_to_load.h" #include #include @@ -20,6 +18,8 @@ #include #include #include +#include +#include #define REDIRECT_HEADER_NAME "redirects" #define REDIRECT_ORIGINAL_URL "original" @@ -27,22 +27,22 @@ #define REDIRECT_TIMESTAMP "timestamp" #define REDIRECT_CACHE_FILENAME "cache.ini" -inline Q_LOGGING_CATEGORY(PictureLoaderWorkerLog, "picture_loader.worker"); +inline Q_LOGGING_CATEGORY(CardPictureLoaderWorkerLog, "card_picture_loader.worker"); -class PictureLoaderWorkerWork; -class PictureLoaderWorker : public QObject +class CardPictureLoaderWorkerWork; +class CardPictureLoaderWorker : public QObject { Q_OBJECT public: - explicit PictureLoaderWorker(); - ~PictureLoaderWorker() override; + explicit CardPictureLoaderWorker(); + ~CardPictureLoaderWorker() override; - void enqueueImageLoad(const ExactCard &card); // Starts a thread for the image to be loaded - void queueRequest(const QUrl &url, PictureLoaderWorkerWork *worker); // Queues network requests for load threads + void enqueueImageLoad(const ExactCard &card); // Starts a thread for the image to be loaded + void queueRequest(const QUrl &url, CardPictureLoaderWorkerWork *worker); // Queues network requests for load threads void clearNetworkCache(); public slots: - QNetworkReply *makeRequest(const QUrl &url, PictureLoaderWorkerWork *workThread); + QNetworkReply *makeRequest(const QUrl &url, CardPictureLoaderWorkerWork *workThread); void processQueuedRequests(); bool processSingleRequest(); void handleImageLoaded(const ExactCard &card, const QImage &image); @@ -57,12 +57,12 @@ private: QString cacheFilePath; // Path to persistent storage static constexpr int CacheTTLInDays = 30; // TODO: Make user configurable bool picDownload; - QQueue> requestLoadQueue; + QQueue> requestLoadQueue; int requestQuota; QTimer requestTimer; // Timer for refreshing request quota - PictureLoaderLocal *localLoader; + CardPictureLoaderLocal *localLoader; QSet currentlyLoading; // for deduplication purposes. Contains pixmapCacheKey QUrl getCachedRedirect(const QUrl &originalUrl) const; diff --git a/cockatrice/src/picture_loader/picture_loader_worker_work.cpp b/cockatrice/src/interface/card_picture_loader/card_picture_loader_worker_work.cpp similarity index 75% rename from cockatrice/src/picture_loader/picture_loader_worker_work.cpp rename to cockatrice/src/interface/card_picture_loader/card_picture_loader_worker_work.cpp index 4d9fb9354..eae93d46f 100644 --- a/cockatrice/src/picture_loader/picture_loader_worker_work.cpp +++ b/cockatrice/src/interface/card_picture_loader/card_picture_loader_worker_work.cpp @@ -1,8 +1,6 @@ -#include "picture_loader_worker_work.h" +#include "card_picture_loader_worker_work.h" -#include "../database/card_database_manager.h" -#include "../settings/cache_settings.h" -#include "picture_loader_worker.h" +#include "card_picture_loader_worker.h" #include #include @@ -12,19 +10,24 @@ #include #include #include +#include +#include // Card back returned by gatherer when card is not found static const QStringList MD5_BLACKLIST = {"db0c48db407a907c16ade38de048a441"}; -PictureLoaderWorkerWork::PictureLoaderWorkerWork(const PictureLoaderWorker *worker, const ExactCard &toLoad) - : QObject(nullptr), cardToDownload(PictureToLoad(toLoad)), picDownload(SettingsCache::instance().getPicDownload()) +CardPictureLoaderWorkerWork::CardPictureLoaderWorkerWork(const CardPictureLoaderWorker *worker, const ExactCard &toLoad) + : QObject(nullptr), cardToDownload(CardPictureToLoad(toLoad)), + picDownload(SettingsCache::instance().getPicDownload()) { // Hook up signals to the orchestrator - connect(this, &PictureLoaderWorkerWork::requestImageDownload, worker, &PictureLoaderWorker::queueRequest); - connect(this, &PictureLoaderWorkerWork::urlRedirected, worker, &PictureLoaderWorker::cacheRedirect); - connect(this, &PictureLoaderWorkerWork::cachedUrlInvalidated, worker, &PictureLoaderWorker::removedCachedUrl); - connect(this, &PictureLoaderWorkerWork::imageLoaded, worker, &PictureLoaderWorker::handleImageLoaded); - connect(this, &PictureLoaderWorkerWork::requestSucceeded, worker, &PictureLoaderWorker::imageRequestSucceeded); + connect(this, &CardPictureLoaderWorkerWork::requestImageDownload, worker, &CardPictureLoaderWorker::queueRequest); + connect(this, &CardPictureLoaderWorkerWork::urlRedirected, worker, &CardPictureLoaderWorker::cacheRedirect); + connect(this, &CardPictureLoaderWorkerWork::cachedUrlInvalidated, worker, + &CardPictureLoaderWorker::removedCachedUrl); + connect(this, &CardPictureLoaderWorkerWork::imageLoaded, worker, &CardPictureLoaderWorker::handleImageLoaded); + connect(this, &CardPictureLoaderWorkerWork::requestSucceeded, worker, + &CardPictureLoaderWorker::imageRequestSucceeded); // Hook up signals to settings connect(&SettingsCache::instance(), SIGNAL(picDownloadChanged()), this, SLOT(picDownloadChanged())); @@ -32,7 +35,7 @@ PictureLoaderWorkerWork::PictureLoaderWorkerWork(const PictureLoaderWorker *work startNextPicDownload(); } -void PictureLoaderWorkerWork::startNextPicDownload() +void CardPictureLoaderWorkerWork::startNextPicDownload() { QString picUrl = cardToDownload.getCurrentUrl(); @@ -40,7 +43,7 @@ void PictureLoaderWorkerWork::startNextPicDownload() picDownloadFailed(); } else { QUrl url(picUrl); - qCDebug(PictureLoaderWorkerWorkLog).nospace() + qCDebug(CardPictureLoaderWorkerWorkLog).nospace() << "PictureLoader: [card: " << cardToDownload.getCard().getInfo().getCorrectedName() << " set: " << cardToDownload.getSetName() << "]: Trying to fetch picture from url " << url.toDisplayString(); @@ -52,7 +55,7 @@ void PictureLoaderWorkerWork::startNextPicDownload() * Starts another pic download using the next possible url combination for the card. * If all possibilities are exhausted, then concludes the image loading with an empty QImage. */ -void PictureLoaderWorkerWork::picDownloadFailed() +void CardPictureLoaderWorkerWork::picDownloadFailed() { /* Take advantage of short-circuiting here to call the nextUrl until one is not available. Only once nextUrl evaluates to false will this move @@ -61,7 +64,7 @@ void PictureLoaderWorkerWork::picDownloadFailed() if (cardToDownload.nextUrl() || cardToDownload.nextSet()) { startNextPicDownload(); } else { - qCWarning(PictureLoaderWorkerWorkLog).nospace() + qCWarning(CardPictureLoaderWorkerWorkLog).nospace() << "PictureLoader: [card: " << cardToDownload.getCard().getInfo().getCorrectedName() << " set: " << cardToDownload.getSetName() << "]: Picture NOT found, " << (picDownload ? "download failed" : "downloads disabled") @@ -74,7 +77,7 @@ void PictureLoaderWorkerWork::picDownloadFailed() * * @param reply The reply. Takes ownership of the object */ -void PictureLoaderWorkerWork::handleNetworkReply(QNetworkReply *reply) +void CardPictureLoaderWorkerWork::handleNetworkReply(QNetworkReply *reply) { QVariant redirectTarget = reply->attribute(QNetworkRequest::RedirectionTargetAttribute); if (redirectTarget.isValid()) { @@ -102,15 +105,15 @@ static bool imageIsBlackListed(const QByteArray &picData) return MD5_BLACKLIST.contains(md5sum); } -void PictureLoaderWorkerWork::handleFailedReply(const QNetworkReply *reply) +void CardPictureLoaderWorkerWork::handleFailedReply(const QNetworkReply *reply) { if (reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 429) { - qCWarning(PictureLoaderWorkerWorkLog) << "Too many requests."; + qCWarning(CardPictureLoaderWorkerWorkLog) << "Too many requests."; } else { bool isFromCache = reply->attribute(QNetworkRequest::SourceIsFromCacheAttribute).toBool(); if (isFromCache) { - qCDebug(PictureLoaderWorkerWorkLog).nospace() + qCDebug(CardPictureLoaderWorkerWorkLog).nospace() << "PictureLoader: [card: " << cardToDownload.getCard().getName() << " set: " << cardToDownload.getSetName() << "]: Removing corrupted cache file for url " << reply->url().toDisplayString() << " and retrying (" << reply->errorString() << ")"; @@ -119,7 +122,7 @@ void PictureLoaderWorkerWork::handleFailedReply(const QNetworkReply *reply) emit requestImageDownload(reply->url(), this); } else { - qCDebug(PictureLoaderWorkerWorkLog).nospace() + qCDebug(CardPictureLoaderWorkerWorkLog).nospace() << "PictureLoader: [card: " << cardToDownload.getCard().getName() << " set: " << cardToDownload.getSetName() << "]: " << (picDownload ? "Download" : "Cache search") << " failed for url " << reply->url().toDisplayString() << " (" << reply->errorString() << ")"; @@ -129,7 +132,7 @@ void PictureLoaderWorkerWork::handleFailedReply(const QNetworkReply *reply) } } -void PictureLoaderWorkerWork::handleSuccessfulReply(QNetworkReply *reply) +void CardPictureLoaderWorkerWork::handleSuccessfulReply(QNetworkReply *reply) { bool isFromCache = reply->attribute(QNetworkRequest::SourceIsFromCacheAttribute).toBool(); @@ -138,7 +141,7 @@ void PictureLoaderWorkerWork::handleSuccessfulReply(QNetworkReply *reply) if (statusCode == 301 || statusCode == 302 || statusCode == 303 || statusCode == 305 || statusCode == 307 || statusCode == 308) { QUrl redirectUrl = reply->header(QNetworkRequest::LocationHeader).toUrl(); - qCDebug(PictureLoaderWorkerWorkLog).nospace() + qCDebug(CardPictureLoaderWorkerWorkLog).nospace() << "PictureLoader: [card: " << cardToDownload.getCard().getName() << " set: " << cardToDownload.getSetName() << "]: following " << (isFromCache ? "cached redirect" : "redirect") << " to " << redirectUrl.toDisplayString(); @@ -150,7 +153,7 @@ void PictureLoaderWorkerWork::handleSuccessfulReply(QNetworkReply *reply) const QByteArray &picData = reply->peek(reply->size()); if (imageIsBlackListed(picData)) { - qCDebug(PictureLoaderWorkerWorkLog).nospace() + qCDebug(CardPictureLoaderWorkerWorkLog).nospace() << "PictureLoader: [card: " << cardToDownload.getCard().getName() << " set: " << cardToDownload.getSetName() << "]: Picture found, but blacklisted, will consider it as not found"; @@ -161,14 +164,14 @@ void PictureLoaderWorkerWork::handleSuccessfulReply(QNetworkReply *reply) QImage image = tryLoadImageFromReply(reply); if (image.isNull()) { - qCDebug(PictureLoaderWorkerWorkLog).nospace() + qCDebug(CardPictureLoaderWorkerWorkLog).nospace() << "PictureLoader: [card: " << cardToDownload.getCard().getName() << " set: " << cardToDownload.getSetName() << "]: Possible " << (isFromCache ? "cached" : "downloaded") << " picture at " << reply->url().toDisplayString() << " could not be loaded: " << reply->errorString(); picDownloadFailed(); } else { - qCDebug(PictureLoaderWorkerWorkLog).nospace() + qCDebug(CardPictureLoaderWorkerWorkLog).nospace() << "PictureLoader: [card: " << cardToDownload.getCard().getName() << " set: " << cardToDownload.getSetName() << "]: Image successfully " << (isFromCache ? "loaded from cached" : "downloaded from") << " url " << reply->url().toDisplayString(); @@ -181,7 +184,7 @@ void PictureLoaderWorkerWork::handleSuccessfulReply(QNetworkReply *reply) * @param reply The reply to load the image from * @return The loaded image, or an empty QImage if loading failed */ -QImage PictureLoaderWorkerWork::tryLoadImageFromReply(QNetworkReply *reply) +QImage CardPictureLoaderWorkerWork::tryLoadImageFromReply(QNetworkReply *reply) { static constexpr int riffHeaderSize = 12; // RIFF_HEADER_SIZE from webp/format_constants.h auto replyHeader = reply->peek(riffHeaderSize); @@ -208,13 +211,13 @@ QImage PictureLoaderWorkerWork::tryLoadImageFromReply(QNetworkReply *reply) * Call this method when the image has finished being loaded. * @param image The image that was loaded. Empty QImage indicates failure. */ -void PictureLoaderWorkerWork::concludeImageLoad(const QImage &image) +void CardPictureLoaderWorkerWork::concludeImageLoad(const QImage &image) { emit imageLoaded(cardToDownload.getCard(), image); deleteLater(); } -void PictureLoaderWorkerWork::picDownloadChanged() +void CardPictureLoaderWorkerWork::picDownloadChanged() { picDownload = SettingsCache::instance().getPicDownload(); } diff --git a/cockatrice/src/picture_loader/picture_loader_worker_work.h b/cockatrice/src/interface/card_picture_loader/card_picture_loader_worker_work.h similarity index 74% rename from cockatrice/src/picture_loader/picture_loader_worker_work.h rename to cockatrice/src/interface/card_picture_loader/card_picture_loader_worker_work.h index f40cc61b9..c7ccf7566 100644 --- a/cockatrice/src/picture_loader/picture_loader_worker_work.h +++ b/cockatrice/src/interface/card_picture_loader/card_picture_loader_worker_work.h @@ -7,15 +7,15 @@ #ifndef PICTURE_LOADER_WORKER_WORK_H #define PICTURE_LOADER_WORKER_WORK_H -#include "../database/card_database.h" -#include "picture_loader_worker.h" -#include "picture_to_load.h" +#include "card_picture_loader_worker.h" +#include "card_picture_to_load.h" #include #include #include #include #include +#include #define REDIRECT_HEADER_NAME "redirects" #define REDIRECT_ORIGINAL_URL "original" @@ -23,17 +23,17 @@ #define REDIRECT_TIMESTAMP "timestamp" #define REDIRECT_CACHE_FILENAME "cache.ini" -inline Q_LOGGING_CATEGORY(PictureLoaderWorkerWorkLog, "picture_loader.worker"); +inline Q_LOGGING_CATEGORY(CardPictureLoaderWorkerWorkLog, "card_picture_loader.worker"); -class PictureLoaderWorker; +class CardPictureLoaderWorker; -class PictureLoaderWorkerWork : public QObject +class CardPictureLoaderWorkerWork : public QObject { Q_OBJECT public: - explicit PictureLoaderWorkerWork(const PictureLoaderWorker *worker, const ExactCard &toLoad); + explicit CardPictureLoaderWorkerWork(const CardPictureLoaderWorker *worker, const ExactCard &toLoad); - PictureToLoad cardToDownload; + CardPictureToLoad cardToDownload; public slots: void handleNetworkReply(QNetworkReply *reply); @@ -63,7 +63,7 @@ signals: * Emitted when a request did not return a 400 or 500 response */ void requestSucceeded(const QUrl &url); - void requestImageDownload(const QUrl &url, PictureLoaderWorkerWork *instance); + void requestImageDownload(const QUrl &url, CardPictureLoaderWorkerWork *instance); void urlRedirected(const QUrl &originalUrl, const QUrl &redirectUrl); void cachedUrlInvalidated(const QUrl &url); diff --git a/cockatrice/src/picture_loader/picture_to_load.cpp b/cockatrice/src/interface/card_picture_loader/card_picture_to_load.cpp similarity index 93% rename from cockatrice/src/picture_loader/picture_to_load.cpp rename to cockatrice/src/interface/card_picture_loader/card_picture_to_load.cpp index f70f23d33..4f1a27a98 100644 --- a/cockatrice/src/picture_loader/picture_to_load.cpp +++ b/cockatrice/src/interface/card_picture_loader/card_picture_to_load.cpp @@ -1,15 +1,14 @@ -#include "picture_to_load.h" - -#include "../settings/cache_settings.h" -#include "../utility/card_set_comparator.h" +#include "card_picture_to_load.h" #include #include #include #include #include +#include +#include -PictureToLoad::PictureToLoad(const ExactCard &_card) +CardPictureToLoad::CardPictureToLoad(const ExactCard &_card) : card(_card), urlTemplates(SettingsCache::instance().downloads().getAllURLs()) { if (card) { @@ -25,7 +24,7 @@ PictureToLoad::PictureToLoad(const ExactCard &_card) * * @return A list of sets. Will not be empty. */ -QList PictureToLoad::extractSetsSorted(const ExactCard &card) +QList CardPictureToLoad::extractSetsSorted(const ExactCard &card) { QList sortedSets; for (const auto &printings : card.getInfo().getSets()) { @@ -80,7 +79,7 @@ static PrintingInfo findPrintingForSet(const ExactCard &card, const QString &set return setsToPrintings[setName][0]; } -void PictureToLoad::populateSetUrls() +void CardPictureToLoad::populateSetUrls() { /* currentSetUrls is a list, populated each time a new set is requested for a particular card and Urls are removed from it as a download is attempted from each one. Custom Urls for @@ -113,7 +112,7 @@ void PictureToLoad::populateSetUrls() * If we are already at the end of the list, then currentSet is set to empty. * @return If we are already at the end of the list */ -bool PictureToLoad::nextSet() +bool CardPictureToLoad::nextSet() { if (!sortedSets.isEmpty()) { currentSet = sortedSets.takeFirst(); @@ -129,7 +128,7 @@ bool PictureToLoad::nextSet() * If we are already at the end of the list, then currentUrl is set to empty. * @return If we are already at the end of the list */ -bool PictureToLoad::nextUrl() +bool CardPictureToLoad::nextUrl() { if (!currentSetUrls.isEmpty()) { currentUrl = currentSetUrls.takeFirst(); @@ -139,7 +138,7 @@ bool PictureToLoad::nextUrl() return false; } -QString PictureToLoad::getSetName() const +QString CardPictureToLoad::getSetName() const { if (currentSet) { return currentSet->getCorrectedShortName(); @@ -185,7 +184,7 @@ static int parse(const QString &urlTemplate, } QString propertyValue = getProperty(cardPropertyName); if (propertyValue.isEmpty()) { - qCDebug(PictureToLoadLog).nospace() + qCDebug(CardPictureToLoadLog).nospace() << "PictureLoader: [card: " << cardName << " set: " << setName << "]: Requested " << propType << "property (" << cardPropertyName << ") for Url template (" << urlTemplate << ") is not available"; return 1; @@ -193,7 +192,7 @@ static int parse(const QString &urlTemplate, int propLength = propertyValue.length(); if (subStrLen > 0) { if (subStrPos + subStrLen > propLength) { - qCDebug(PictureToLoadLog).nospace() + qCDebug(CardPictureToLoadLog).nospace() << "PictureLoader: [card: " << cardName << " set: " << setName << "]: Requested " << propType << " property (" << cardPropertyName << ") for Url template (" << urlTemplate << ") is smaller than substr specification (" << subStrPos << " + " << subStrLen << " > " @@ -208,7 +207,7 @@ static int parse(const QString &urlTemplate, if (!fillWith.isEmpty()) { int fillLength = fillWith.length(); if (fillLength < propLength) { - qCDebug(PictureToLoadLog).nospace() + qCDebug(CardPictureToLoadLog).nospace() << "PictureLoader: [card: " << cardName << " set: " << setName << "]: Requested " << propType << " property (" << cardPropertyName << ") for Url template (" << urlTemplate << ") is longer than fill specification (" << fillWith << ")"; @@ -225,7 +224,7 @@ static int parse(const QString &urlTemplate, return 0; } -QString PictureToLoad::transformUrl(const QString &urlTemplate) const +QString CardPictureToLoad::transformUrl(const QString &urlTemplate) const { /* This function takes Url templates and substitutes actual card details into the url. This is used for making Urls with follow a predictable format @@ -279,7 +278,7 @@ QString PictureToLoad::transformUrl(const QString &urlTemplate) const * populated in this card, so it should return an empty string, * indicating an invalid Url. */ - qCDebug(PictureToLoadLog).nospace() + qCDebug(CardPictureToLoadLog).nospace() << "PictureLoader: [card: " << cardName << " set: " << setName << "]: Requested information (" << prop << ") for Url template (" << urlTemplate << ") is not available"; return QString(); diff --git a/cockatrice/src/picture_loader/picture_to_load.h b/cockatrice/src/interface/card_picture_loader/card_picture_to_load.h similarity index 76% rename from cockatrice/src/picture_loader/picture_to_load.h rename to cockatrice/src/interface/card_picture_loader/card_picture_to_load.h index 57b406587..b7c0e6a53 100644 --- a/cockatrice/src/picture_loader/picture_to_load.h +++ b/cockatrice/src/interface/card_picture_loader/card_picture_to_load.h @@ -1,5 +1,5 @@ /** - * @file picture_to_load.h + * @file card_picture_to_load.h * @ingroup PictureLoader * @brief TODO: Document this. */ @@ -7,13 +7,12 @@ #ifndef PICTURE_TO_LOAD_H #define PICTURE_TO_LOAD_H -#include "../card/exact_card.h" - #include +#include -inline Q_LOGGING_CATEGORY(PictureToLoadLog, "picture_loader.picture_to_load"); +inline Q_LOGGING_CATEGORY(CardPictureToLoadLog, "card_picture_loader.picture_to_load"); -class PictureToLoad +class CardPictureToLoad { private: ExactCard card; @@ -24,7 +23,7 @@ private: CardSetPtr currentSet; public: - explicit PictureToLoad(const ExactCard &_card); + explicit CardPictureToLoad(const ExactCard &_card); const ExactCard &getCard() const { diff --git a/cockatrice/src/interface/pixel_map_generator.cpp b/cockatrice/src/interface/pixel_map_generator.cpp index 25bd67264..382fff317 100644 --- a/cockatrice/src/interface/pixel_map_generator.cpp +++ b/cockatrice/src/interface/pixel_map_generator.cpp @@ -1,13 +1,12 @@ #include "pixel_map_generator.h" -#include "pb/serverinfo_user.pb.h" - #include #include #include #include #include #include +#include #define DEFAULT_COLOR_UNREGISTERED "#32c8ec"; #define DEFAULT_COLOR_REGISTERED "#5ed900"; diff --git a/cockatrice/src/interface/pixel_map_generator.h b/cockatrice/src/interface/pixel_map_generator.h index dcc4f689f..61d771c79 100644 --- a/cockatrice/src/interface/pixel_map_generator.h +++ b/cockatrice/src/interface/pixel_map_generator.h @@ -7,12 +7,11 @@ #ifndef PIXMAPGENERATOR_H #define PIXMAPGENERATOR_H -#include "user_level.h" - #include #include #include #include +#include inline Q_LOGGING_CATEGORY(PixelMapGeneratorLog, "pixel_map_generator"); diff --git a/cockatrice/src/interface/theme_manager.cpp b/cockatrice/src/interface/theme_manager.cpp index 58a411c99..4cb66e2b1 100644 --- a/cockatrice/src/interface/theme_manager.cpp +++ b/cockatrice/src/interface/theme_manager.cpp @@ -1,13 +1,12 @@ #include "theme_manager.h" -#include "../settings/cache_settings.h" - #include #include #include #include #include #include +#include #define NONE_THEME_NAME "Default" #define STYLE_CSS_NAME "style.css" diff --git a/cockatrice/src/interface/widgets/cards/additional_info/color_identity_widget.cpp b/cockatrice/src/interface/widgets/cards/additional_info/color_identity_widget.cpp index c00fd7cb2..c134b0aff 100644 --- a/cockatrice/src/interface/widgets/cards/additional_info/color_identity_widget.cpp +++ b/cockatrice/src/interface/widgets/cards/additional_info/color_identity_widget.cpp @@ -1,6 +1,5 @@ #include "color_identity_widget.h" -#include "../../../../settings/cache_settings.h" #include "mana_symbol_widget.h" #include @@ -9,6 +8,7 @@ #include #include #include +#include ColorIdentityWidget::ColorIdentityWidget(QWidget *parent, CardInfoPtr _card) : QWidget(parent), card(_card) { diff --git a/cockatrice/src/interface/widgets/cards/additional_info/color_identity_widget.h b/cockatrice/src/interface/widgets/cards/additional_info/color_identity_widget.h index bb6447035..60d69af06 100644 --- a/cockatrice/src/interface/widgets/cards/additional_info/color_identity_widget.h +++ b/cockatrice/src/interface/widgets/cards/additional_info/color_identity_widget.h @@ -7,10 +7,9 @@ #ifndef COLOR_IDENTITY_WIDGET_H #define COLOR_IDENTITY_WIDGET_H -#include "../../../../card/card_info.h" - #include #include +#include class ColorIdentityWidget : public QWidget { diff --git a/cockatrice/src/interface/widgets/cards/additional_info/mana_cost_widget.h b/cockatrice/src/interface/widgets/cards/additional_info/mana_cost_widget.h index e4aac81c4..26a186c59 100644 --- a/cockatrice/src/interface/widgets/cards/additional_info/mana_cost_widget.h +++ b/cockatrice/src/interface/widgets/cards/additional_info/mana_cost_widget.h @@ -7,10 +7,9 @@ #ifndef MANA_COST_WIDGET_H #define MANA_COST_WIDGET_H -#include "../../../../card/card_info.h" - #include #include +#include class ManaCostWidget : public QWidget { diff --git a/cockatrice/src/interface/widgets/cards/additional_info/mana_symbol_widget.cpp b/cockatrice/src/interface/widgets/cards/additional_info/mana_symbol_widget.cpp index aae22190b..942635871 100644 --- a/cockatrice/src/interface/widgets/cards/additional_info/mana_symbol_widget.cpp +++ b/cockatrice/src/interface/widgets/cards/additional_info/mana_symbol_widget.cpp @@ -1,8 +1,7 @@ #include "mana_symbol_widget.h" -#include "../../../../settings/cache_settings.h" - #include +#include ManaSymbolWidget::ManaSymbolWidget(QWidget *parent, QString _symbol, bool _isActive, bool _mayBeToggled) : QLabel(parent), symbol(_symbol), isActive(_isActive), mayBeToggled(_mayBeToggled) diff --git a/cockatrice/src/interface/widgets/cards/card_group_display_widgets/card_group_display_widget.cpp b/cockatrice/src/interface/widgets/cards/card_group_display_widgets/card_group_display_widget.cpp index dcd4cc9aa..94f0e84bd 100644 --- a/cockatrice/src/interface/widgets/cards/card_group_display_widgets/card_group_display_widget.cpp +++ b/cockatrice/src/interface/widgets/cards/card_group_display_widgets/card_group_display_widget.cpp @@ -1,12 +1,12 @@ #include "card_group_display_widget.h" -#include "../../../../database/card_database_manager.h" -#include "../../../../deck/deck_list_model.h" -#include "../../../../utility/card_info_comparator.h" -#include "../../../../utility/deck_list_sort_filter_proxy_model.h" #include "../card_info_picture_with_text_overlay_widget.h" +#include "../libcockatrice_deck_list/libcockatrice/deck_list/deck_list_model.h" +#include "../libcockatrice_deck_list/libcockatrice/deck_list/deck_list_sort_filter_proxy_model.h" #include +#include +#include CardGroupDisplayWidget::CardGroupDisplayWidget(QWidget *parent, DeckListModel *_deckListModel, diff --git a/cockatrice/src/interface/widgets/cards/card_group_display_widgets/card_group_display_widget.h b/cockatrice/src/interface/widgets/cards/card_group_display_widgets/card_group_display_widget.h index 0b74d5c3f..914d234f0 100644 --- a/cockatrice/src/interface/widgets/cards/card_group_display_widgets/card_group_display_widget.h +++ b/cockatrice/src/interface/widgets/cards/card_group_display_widgets/card_group_display_widget.h @@ -7,8 +7,6 @@ #ifndef CARD_GROUP_DISPLAY_WIDGET_H #define CARD_GROUP_DISPLAY_WIDGET_H -#include "../../../../card/card_info.h" -#include "../../../../deck/deck_list_model.h" #include "../../general/display/banner_widget.h" #include "../card_info_picture_with_text_overlay_widget.h" #include "../card_size_widget.h" @@ -16,6 +14,8 @@ #include #include #include +#include +#include class CardGroupDisplayWidget : public QWidget { diff --git a/cockatrice/src/interface/widgets/cards/card_group_display_widgets/flat_card_group_display_widget.cpp b/cockatrice/src/interface/widgets/cards/card_group_display_widgets/flat_card_group_display_widget.cpp index 391edb2da..6d3e841ec 100644 --- a/cockatrice/src/interface/widgets/cards/card_group_display_widgets/flat_card_group_display_widget.cpp +++ b/cockatrice/src/interface/widgets/cards/card_group_display_widgets/flat_card_group_display_widget.cpp @@ -1,11 +1,11 @@ #include "flat_card_group_display_widget.h" -#include "../../../../database/card_database_manager.h" -#include "../../../../deck/deck_list_model.h" -#include "../../../../utility/card_info_comparator.h" #include "../card_info_picture_with_text_overlay_widget.h" +#include "../libcockatrice_deck_list/libcockatrice/deck_list/deck_list_model.h" #include +#include +#include #include FlatCardGroupDisplayWidget::FlatCardGroupDisplayWidget(QWidget *parent, diff --git a/cockatrice/src/interface/widgets/cards/card_group_display_widgets/overlapped_card_group_display_widget.cpp b/cockatrice/src/interface/widgets/cards/card_group_display_widgets/overlapped_card_group_display_widget.cpp index c549ceefe..82b5ec57b 100644 --- a/cockatrice/src/interface/widgets/cards/card_group_display_widgets/overlapped_card_group_display_widget.cpp +++ b/cockatrice/src/interface/widgets/cards/card_group_display_widgets/overlapped_card_group_display_widget.cpp @@ -1,11 +1,11 @@ #include "overlapped_card_group_display_widget.h" -#include "../../../../database/card_database_manager.h" -#include "../../../../deck/deck_list_model.h" -#include "../../../../utility/card_info_comparator.h" #include "../card_info_picture_with_text_overlay_widget.h" #include +#include +#include +#include OverlappedCardGroupDisplayWidget::OverlappedCardGroupDisplayWidget(QWidget *parent, DeckListModel *_deckListModel, diff --git a/cockatrice/src/interface/widgets/cards/card_info_display_widget.cpp b/cockatrice/src/interface/widgets/cards/card_info_display_widget.cpp index d11590a05..c08e0ed3c 100644 --- a/cockatrice/src/interface/widgets/cards/card_info_display_widget.cpp +++ b/cockatrice/src/interface/widgets/cards/card_info_display_widget.cpp @@ -1,6 +1,5 @@ #include "card_info_display_widget.h" -#include "../../../database/card_database_manager.h" #include "../../../game/board/card_item.h" #include "../../../main.h" #include "card_info_picture_widget.h" @@ -9,6 +8,7 @@ #include #include #include +#include #include CardInfoDisplayWidget::CardInfoDisplayWidget(const CardRef &cardRef, QWidget *parent, Qt::WindowFlags flags) diff --git a/cockatrice/src/interface/widgets/cards/card_info_display_widget.h b/cockatrice/src/interface/widgets/cards/card_info_display_widget.h index ed2e03114..d44c4c205 100644 --- a/cockatrice/src/interface/widgets/cards/card_info_display_widget.h +++ b/cockatrice/src/interface/widgets/cards/card_info_display_widget.h @@ -7,12 +7,11 @@ #ifndef CARDINFOWIDGET_H #define CARDINFOWIDGET_H -#include "../../../card/exact_card.h" -#include "card_ref.h" - #include #include #include +#include +#include class CardInfoPictureWidget; class CardInfoTextWidget; diff --git a/cockatrice/src/interface/widgets/cards/card_info_frame_widget.cpp b/cockatrice/src/interface/widgets/cards/card_info_frame_widget.cpp index ddc1efb48..6dad6424b 100644 --- a/cockatrice/src/interface/widgets/cards/card_info_frame_widget.cpp +++ b/cockatrice/src/interface/widgets/cards/card_info_frame_widget.cpp @@ -1,15 +1,15 @@ #include "card_info_frame_widget.h" -#include "../../../card/card_relation.h" -#include "../../../database/card_database_manager.h" #include "../../../game/board/card_item.h" -#include "../../../settings/cache_settings.h" #include "card_info_display_widget.h" #include "card_info_picture_widget.h" #include "card_info_text_widget.h" #include #include +#include +#include +#include #include CardInfoFrameWidget::CardInfoFrameWidget(QWidget *parent) diff --git a/cockatrice/src/interface/widgets/cards/card_info_frame_widget.h b/cockatrice/src/interface/widgets/cards/card_info_frame_widget.h index 65fd0a514..11b991e87 100644 --- a/cockatrice/src/interface/widgets/cards/card_info_frame_widget.h +++ b/cockatrice/src/interface/widgets/cards/card_info_frame_widget.h @@ -7,11 +7,10 @@ #ifndef CARDFRAME_H #define CARDFRAME_H -#include "../../../card/exact_card.h" -#include "card_ref.h" - #include #include +#include +#include class AbstractCardItem; class CardInfoPictureWidget; diff --git a/cockatrice/src/interface/widgets/cards/card_info_picture_art_crop_widget.cpp b/cockatrice/src/interface/widgets/cards/card_info_picture_art_crop_widget.cpp index e7acabce9..451104d17 100644 --- a/cockatrice/src/interface/widgets/cards/card_info_picture_art_crop_widget.cpp +++ b/cockatrice/src/interface/widgets/cards/card_info_picture_art_crop_widget.cpp @@ -1,6 +1,6 @@ #include "card_info_picture_art_crop_widget.h" -#include "../../../picture_loader/picture_loader.h" +#include "../../../interface/card_picture_loader/card_picture_loader.h" CardInfoPictureArtCropWidget::CardInfoPictureArtCropWidget(QWidget *parent) : CardInfoPictureWidget(parent, false, false) @@ -13,9 +13,9 @@ QPixmap CardInfoPictureArtCropWidget::getProcessedBackground(const QSize &target // Load the full-resolution card image, not a pre-scaled one QPixmap fullResPixmap; if (getCard()) { - PictureLoader::getPixmap(fullResPixmap, getCard(), QSize(745, 1040)); // or a high default size + CardPictureLoader::getPixmap(fullResPixmap, getCard(), QSize(745, 1040)); // or a high default size } else { - PictureLoader::getCardBackPixmap(fullResPixmap, QSize(745, 1040)); + CardPictureLoader::getCardBackPixmap(fullResPixmap, QSize(745, 1040)); } // Fail-safe if loading failed diff --git a/cockatrice/src/interface/widgets/cards/card_info_picture_enlarged_widget.cpp b/cockatrice/src/interface/widgets/cards/card_info_picture_enlarged_widget.cpp index 02ba37b74..ead669e7c 100644 --- a/cockatrice/src/interface/widgets/cards/card_info_picture_enlarged_widget.cpp +++ b/cockatrice/src/interface/widgets/cards/card_info_picture_enlarged_widget.cpp @@ -1,10 +1,10 @@ #include "card_info_picture_enlarged_widget.h" -#include "../../../picture_loader/picture_loader.h" -#include "../../../settings/cache_settings.h" +#include "../../../interface/card_picture_loader/card_picture_loader.h" #include #include +#include #include /** @@ -35,9 +35,9 @@ CardInfoPictureEnlargedWidget::CardInfoPictureEnlargedWidget(QWidget *parent) : void CardInfoPictureEnlargedWidget::loadPixmap(const QSize &size) { if (card) { - PictureLoader::getPixmap(enlargedPixmap, card, size); + CardPictureLoader::getPixmap(enlargedPixmap, card, size); } else { - PictureLoader::getCardBackPixmap(enlargedPixmap, size); + CardPictureLoader::getCardBackPixmap(enlargedPixmap, size); } pixmapDirty = false; } diff --git a/cockatrice/src/interface/widgets/cards/card_info_picture_enlarged_widget.h b/cockatrice/src/interface/widgets/cards/card_info_picture_enlarged_widget.h index 07ecd1aab..ec1de166b 100644 --- a/cockatrice/src/interface/widgets/cards/card_info_picture_enlarged_widget.h +++ b/cockatrice/src/interface/widgets/cards/card_info_picture_enlarged_widget.h @@ -8,10 +8,9 @@ #ifndef CARD_PICTURE_ENLARGED_WIDGET_H #define CARD_PICTURE_ENLARGED_WIDGET_H -#include "../../../card/exact_card.h" - #include #include +#include class CardInfoPictureEnlargedWidget final : public QWidget { diff --git a/cockatrice/src/interface/widgets/cards/card_info_picture_widget.cpp b/cockatrice/src/interface/widgets/cards/card_info_picture_widget.cpp index 33f0be946..8b744dc73 100644 --- a/cockatrice/src/interface/widgets/cards/card_info_picture_widget.cpp +++ b/cockatrice/src/interface/widgets/cards/card_info_picture_widget.cpp @@ -1,11 +1,8 @@ #include "card_info_picture_widget.h" -#include "../../../card/card_relation.h" -#include "../../../database/card_database_manager.h" #include "../../../game/board/card_item.h" -#include "../../../picture_loader/picture_loader.h" -#include "../../../settings/cache_settings.h" -#include "../../../tabs/tab_supervisor.h" +#include "../../../interface/card_picture_loader/card_picture_loader.h" +#include "../../../interface/widgets/tabs/tab_supervisor.h" #include "../../window_main.h" #include @@ -13,6 +10,9 @@ #include #include #include +#include +#include +#include #include /** @@ -152,11 +152,11 @@ void CardInfoPictureWidget::updatePixmap() */ void CardInfoPictureWidget::loadPixmap() { - PictureLoader::getCardBackLoadingInProgressPixmap(resizedPixmap, size()); + CardPictureLoader::getCardBackLoadingInProgressPixmap(resizedPixmap, size()); if (exactCard) { - PictureLoader::getPixmap(resizedPixmap, exactCard, size()); + CardPictureLoader::getPixmap(resizedPixmap, exactCard, size()); } else { - PictureLoader::getCardBackLoadingFailedPixmap(resizedPixmap, size()); + CardPictureLoader::getCardBackLoadingFailedPixmap(resizedPixmap, size()); } pixmapDirty = false; diff --git a/cockatrice/src/interface/widgets/cards/card_info_picture_widget.h b/cockatrice/src/interface/widgets/cards/card_info_picture_widget.h index ce918a33e..b628e6982 100644 --- a/cockatrice/src/interface/widgets/cards/card_info_picture_widget.h +++ b/cockatrice/src/interface/widgets/cards/card_info_picture_widget.h @@ -7,12 +7,12 @@ #ifndef CARD_INFO_PICTURE_H #define CARD_INFO_PICTURE_H -#include "../../../card/exact_card.h" #include "card_info_picture_enlarged_widget.h" #include #include #include +#include inline Q_LOGGING_CATEGORY(CardInfoPictureWidgetLog, "card_info_picture_widget"); diff --git a/cockatrice/src/interface/widgets/cards/card_info_text_widget.cpp b/cockatrice/src/interface/widgets/cards/card_info_text_widget.cpp index 8a4b26eb6..f11be533a 100644 --- a/cockatrice/src/interface/widgets/cards/card_info_text_widget.cpp +++ b/cockatrice/src/interface/widgets/cards/card_info_text_widget.cpp @@ -1,7 +1,5 @@ #include "card_info_text_widget.h" -#include "../../../card/card_relation.h" -#include "../../../card/game_specific_terms.h" #include "../../../game/board/card_item.h" #include @@ -10,6 +8,8 @@ #include #include #include +#include +#include CardInfoTextWidget::CardInfoTextWidget(QWidget *parent) : QFrame(parent), info(nullptr) { diff --git a/cockatrice/src/interface/widgets/cards/card_info_text_widget.h b/cockatrice/src/interface/widgets/cards/card_info_text_widget.h index d3cba8994..8711422b0 100644 --- a/cockatrice/src/interface/widgets/cards/card_info_text_widget.h +++ b/cockatrice/src/interface/widgets/cards/card_info_text_widget.h @@ -7,9 +7,8 @@ #ifndef CARDINFOTEXT_H #define CARDINFOTEXT_H -#include "../../../card/card_info.h" - #include +#include class QLabel; class QScrollArea; class QTextEdit; diff --git a/cockatrice/src/interface/widgets/cards/card_size_widget.cpp b/cockatrice/src/interface/widgets/cards/card_size_widget.cpp index 2b81b26d5..c084dac64 100644 --- a/cockatrice/src/interface/widgets/cards/card_size_widget.cpp +++ b/cockatrice/src/interface/widgets/cards/card_size_widget.cpp @@ -1,9 +1,10 @@ #include "card_size_widget.h" -#include "../../../settings/cache_settings.h" #include "../printing_selector/printing_selector.h" #include "../visual_deck_storage/visual_deck_storage_widget.h" +#include + /** * @class CardSizeWidget * @brief A widget for adjusting card sizes using a slider. diff --git a/cockatrice/src/interface/widgets/cards/deck_card_zone_display_widget.cpp b/cockatrice/src/interface/widgets/cards/deck_card_zone_display_widget.cpp index 4a8f55cab..419bdb648 100644 --- a/cockatrice/src/interface/widgets/cards/deck_card_zone_display_widget.cpp +++ b/cockatrice/src/interface/widgets/cards/deck_card_zone_display_widget.cpp @@ -1,11 +1,11 @@ #include "deck_card_zone_display_widget.h" -#include "../../../deck/deck_list_model.h" -#include "../../../utility/card_info_comparator.h" #include "card_group_display_widgets/flat_card_group_display_widget.h" #include "card_group_display_widgets/overlapped_card_group_display_widget.h" #include +#include +#include DeckCardZoneDisplayWidget::DeckCardZoneDisplayWidget(QWidget *parent, DeckListModel *_deckListModel, diff --git a/cockatrice/src/interface/widgets/cards/deck_card_zone_display_widget.h b/cockatrice/src/interface/widgets/cards/deck_card_zone_display_widget.h index 79ddebf6a..976493137 100644 --- a/cockatrice/src/interface/widgets/cards/deck_card_zone_display_widget.h +++ b/cockatrice/src/interface/widgets/cards/deck_card_zone_display_widget.h @@ -7,8 +7,6 @@ #ifndef DECK_CARD_ZONE_DISPLAY_WIDGET_H #define DECK_CARD_ZONE_DISPLAY_WIDGET_H -#include "../../../card/card_info.h" -#include "../../../deck/deck_list_model.h" #include "../general/display/banner_widget.h" #include "../general/layout_containers/overlap_widget.h" #include "../visual_deck_editor/visual_deck_editor_widget.h" @@ -18,6 +16,8 @@ #include #include +#include +#include class DeckCardZoneDisplayWidget : public QWidget { diff --git a/cockatrice/src/interface/widgets/cards/deck_preview_card_picture_widget.cpp b/cockatrice/src/interface/widgets/cards/deck_preview_card_picture_widget.cpp index b284b3f05..dfa7bc025 100644 --- a/cockatrice/src/interface/widgets/cards/deck_preview_card_picture_widget.cpp +++ b/cockatrice/src/interface/widgets/cards/deck_preview_card_picture_widget.cpp @@ -1,7 +1,5 @@ #include "deck_preview_card_picture_widget.h" -#include "../../../settings/cache_settings.h" - #include #include #include @@ -9,6 +7,7 @@ #include #include #include +#include /** * @brief Constructs a CardPictureWithTextOverlay widget. diff --git a/cockatrice/src/interface/widgets/deck_analytics/deck_analytics_widget.h b/cockatrice/src/interface/widgets/deck_analytics/deck_analytics_widget.h index f2ae805d1..3dc62d132 100644 --- a/cockatrice/src/interface/widgets/deck_analytics/deck_analytics_widget.h +++ b/cockatrice/src/interface/widgets/deck_analytics/deck_analytics_widget.h @@ -7,7 +7,6 @@ #ifndef DECK_ANALYTICS_WIDGET_H #define DECK_ANALYTICS_WIDGET_H -#include "../../../deck/deck_list_model.h" #include "../general/layout_containers/flow_widget.h" #include "mana_base_widget.h" #include "mana_curve_widget.h" @@ -17,7 +16,8 @@ #include #include #include -#include +#include +#include class DeckAnalyticsWidget : public QWidget { diff --git a/cockatrice/src/interface/widgets/deck_analytics/mana_base_widget.cpp b/cockatrice/src/interface/widgets/deck_analytics/mana_base_widget.cpp index 11d87be40..f3bbb33fb 100644 --- a/cockatrice/src/interface/widgets/deck_analytics/mana_base_widget.cpp +++ b/cockatrice/src/interface/widgets/deck_analytics/mana_base_widget.cpp @@ -1,14 +1,14 @@ #include "mana_base_widget.h" -#include "../../../database/card_database.h" -#include "../../../database/card_database_manager.h" -#include "../../../deck/deck_loader.h" #include "../general/display/banner_widget.h" #include "../general/display/bar_widget.h" #include #include -#include +#include +#include +#include +#include ManaBaseWidget::ManaBaseWidget(QWidget *parent, DeckListModel *_deckListModel) : QWidget(parent), deckListModel(_deckListModel) diff --git a/cockatrice/src/interface/widgets/deck_analytics/mana_base_widget.h b/cockatrice/src/interface/widgets/deck_analytics/mana_base_widget.h index c0d970db2..9d661c319 100644 --- a/cockatrice/src/interface/widgets/deck_analytics/mana_base_widget.h +++ b/cockatrice/src/interface/widgets/deck_analytics/mana_base_widget.h @@ -7,12 +7,12 @@ #ifndef MANA_BASE_WIDGET_H #define MANA_BASE_WIDGET_H -#include "../../../deck/deck_list_model.h" #include "../general/display/banner_widget.h" #include #include -#include +#include +#include #include class ManaBaseWidget : public QWidget diff --git a/cockatrice/src/interface/widgets/deck_analytics/mana_curve_widget.cpp b/cockatrice/src/interface/widgets/deck_analytics/mana_curve_widget.cpp index 5a4e14dc9..74a368496 100644 --- a/cockatrice/src/interface/widgets/deck_analytics/mana_curve_widget.cpp +++ b/cockatrice/src/interface/widgets/deck_analytics/mana_curve_widget.cpp @@ -1,13 +1,13 @@ #include "mana_curve_widget.h" -#include "../../../database/card_database.h" -#include "../../../database/card_database_manager.h" -#include "../../../deck/deck_loader.h" #include "../../../main.h" #include "../general/display/banner_widget.h" #include "../general/display/bar_widget.h" -#include +#include +#include +#include +#include #include ManaCurveWidget::ManaCurveWidget(QWidget *parent, DeckListModel *_deckListModel) diff --git a/cockatrice/src/interface/widgets/deck_analytics/mana_curve_widget.h b/cockatrice/src/interface/widgets/deck_analytics/mana_curve_widget.h index e025df091..ced7727a5 100644 --- a/cockatrice/src/interface/widgets/deck_analytics/mana_curve_widget.h +++ b/cockatrice/src/interface/widgets/deck_analytics/mana_curve_widget.h @@ -7,11 +7,11 @@ #ifndef MANA_CURVE_WIDGET_H #define MANA_CURVE_WIDGET_H -#include "../../../deck/deck_list_model.h" #include "../general/display/banner_widget.h" #include #include +#include #include class ManaCurveWidget : public QWidget diff --git a/cockatrice/src/interface/widgets/deck_analytics/mana_devotion_widget.cpp b/cockatrice/src/interface/widgets/deck_analytics/mana_devotion_widget.cpp index 4960b009a..09042b8f9 100644 --- a/cockatrice/src/interface/widgets/deck_analytics/mana_devotion_widget.cpp +++ b/cockatrice/src/interface/widgets/deck_analytics/mana_devotion_widget.cpp @@ -1,14 +1,14 @@ #include "mana_devotion_widget.h" -#include "../../../database/card_database.h" -#include "../../../database/card_database_manager.h" -#include "../../../deck/deck_loader.h" #include "../../../main.h" #include "../general/display/banner_widget.h" #include "../general/display/bar_widget.h" -#include #include +#include +#include +#include +#include #include #include #include diff --git a/cockatrice/src/interface/widgets/deck_analytics/mana_devotion_widget.h b/cockatrice/src/interface/widgets/deck_analytics/mana_devotion_widget.h index 003770b51..b4daf8f6a 100644 --- a/cockatrice/src/interface/widgets/deck_analytics/mana_devotion_widget.h +++ b/cockatrice/src/interface/widgets/deck_analytics/mana_devotion_widget.h @@ -7,12 +7,12 @@ #ifndef MANA_DEVOTION_WIDGET_H #define MANA_DEVOTION_WIDGET_H -#include "../../../deck/deck_list_model.h" #include "../general/display/banner_widget.h" #include #include -#include +#include +#include #include class ManaDevotionWidget : public QWidget diff --git a/cockatrice/src/interface/widgets/deck_editor/deck_editor_card_info_dock_widget.h b/cockatrice/src/interface/widgets/deck_editor/deck_editor_card_info_dock_widget.h index dc31d58a7..086ca2ca4 100644 --- a/cockatrice/src/interface/widgets/deck_editor/deck_editor_card_info_dock_widget.h +++ b/cockatrice/src/interface/widgets/deck_editor/deck_editor_card_info_dock_widget.h @@ -8,7 +8,7 @@ #ifndef DECK_EDITOR_CARD_INFO_DOCK_WIDGET_H #define DECK_EDITOR_CARD_INFO_DOCK_WIDGET_H -#include "../../../tabs/abstract_tab_deck_editor.h" +#include "../../../interface/widgets/tabs/abstract_tab_deck_editor.h" #include "../cards/card_info_frame_widget.h" #include diff --git a/cockatrice/src/interface/widgets/deck_editor/deck_editor_database_display_widget.cpp b/cockatrice/src/interface/widgets/deck_editor/deck_editor_database_display_widget.cpp index b0a9f0814..4695eda0b 100644 --- a/cockatrice/src/interface/widgets/deck_editor/deck_editor_database_display_widget.cpp +++ b/cockatrice/src/interface/widgets/deck_editor/deck_editor_database_display_widget.cpp @@ -1,11 +1,8 @@ #include "deck_editor_database_display_widget.h" -#include "../../../card/card_relation.h" -#include "../../../database/card_database_manager.h" #include "../../../filters/syntax_help.h" -#include "../../../settings/cache_settings.h" -#include "../../../tabs/abstract_tab_deck_editor.h" -#include "../../../tabs/tab_supervisor.h" +#include "../../../interface/widgets/tabs/abstract_tab_deck_editor.h" +#include "../../../interface/widgets/tabs/tab_supervisor.h" #include "../../pixel_map_generator.h" #include @@ -15,6 +12,9 @@ #include #include #include +#include +#include +#include static bool canBeCommander(const CardInfo &cardInfo) { @@ -203,7 +203,10 @@ void DeckEditorDatabaseDisplayWidget::databaseCustomMenu(QPoint point) QAction *addToDeck, *addToSideboard, *selectPrinting, *edhRecCommander, *edhRecCard; addToDeck = menu.addAction(tr("Add to Deck")); addToSideboard = menu.addAction(tr("Add to Sideboard")); - selectPrinting = menu.addAction(tr("Select Printing")); + if (!SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference()) { + selectPrinting = menu.addAction(tr("Select Printing")); + connect(selectPrinting, &QAction::triggered, this, [this, card] { deckEditor->showPrintingSelector(); }); + } if (canBeCommander(card.getInfo())) { edhRecCommander = menu.addAction(tr("Show on EDHRec (Commander)")); connect(edhRecCommander, &QAction::triggered, this, @@ -213,7 +216,6 @@ void DeckEditorDatabaseDisplayWidget::databaseCustomMenu(QPoint point) connect(addToDeck, &QAction::triggered, this, &DeckEditorDatabaseDisplayWidget::actAddCardToMainDeck); connect(addToSideboard, &QAction::triggered, this, &DeckEditorDatabaseDisplayWidget::actAddCardToSideboard); - connect(selectPrinting, &QAction::triggered, this, [this, card] { deckEditor->showPrintingSelector(); }); connect(edhRecCard, &QAction::triggered, this, [this, card] { deckEditor->getTabSupervisor()->addEdhrecTab(card.getCardPtr()); }); diff --git a/cockatrice/src/interface/widgets/deck_editor/deck_editor_database_display_widget.h b/cockatrice/src/interface/widgets/deck_editor/deck_editor_database_display_widget.h index a2f803e2c..542b2cb35 100644 --- a/cockatrice/src/interface/widgets/deck_editor/deck_editor_database_display_widget.h +++ b/cockatrice/src/interface/widgets/deck_editor/deck_editor_database_display_widget.h @@ -8,14 +8,14 @@ #ifndef DECK_EDITOR_DATABASE_DISPLAY_WIDGET_H #define DECK_EDITOR_DATABASE_DISPLAY_WIDGET_H -#include "../../../database/model/card_database_display_model.h" -#include "../../../database/model/card_database_model.h" -#include "../../../deck/custom_line_edit.h" -#include "../../../tabs/abstract_tab_deck_editor.h" -#include "../../../utility/key_signals.h" +#include "../../../interface/widgets/tabs/abstract_tab_deck_editor.h" +#include "../utility/custom_line_edit.h" #include #include +#include +#include +#include class AbstractTabDeckEditor; class DeckEditorDatabaseDisplayWidget : public QWidget diff --git a/cockatrice/src/interface/widgets/deck_editor/deck_editor_deck_dock_widget.cpp b/cockatrice/src/interface/widgets/deck_editor/deck_editor_deck_dock_widget.cpp index dc995ff17..f5970c1e6 100644 --- a/cockatrice/src/interface/widgets/deck_editor/deck_editor_deck_dock_widget.cpp +++ b/cockatrice/src/interface/widgets/deck_editor/deck_editor_deck_dock_widget.cpp @@ -1,15 +1,14 @@ #include "deck_editor_deck_dock_widget.h" -#include "../../../database/card_database_manager.h" -#include "../../../settings/cache_settings.h" - #include #include #include #include #include #include -#include +#include +#include +#include DeckEditorDeckDockWidget::DeckEditorDeckDockWidget(AbstractTabDeckEditor *parent) : QDockWidget(parent), deckEditor(parent) @@ -37,11 +36,11 @@ void DeckEditorDeckDockWidget::createDeckDock() deckView->sortByColumn(1, Qt::AscendingOrder); deckView->header()->setSectionResizeMode(QHeaderView::ResizeToContents); deckView->installEventFilter(&deckViewKeySignals); - deckView->setContextMenuPolicy(Qt::CustomContextMenu); deckView->setSelectionMode(QAbstractItemView::ExtendedSelection); connect(deckView->selectionModel(), &QItemSelectionModel::currentRowChanged, this, &DeckEditorDeckDockWidget::updateCard); connect(deckView, &QTreeView::doubleClicked, this, &DeckEditorDeckDockWidget::actSwapCard); + deckView->setContextMenuPolicy(Qt::CustomContextMenu); connect(deckView, &QTreeView::customContextMenuRequested, this, &DeckEditorDeckDockWidget::decklistCustomMenu); connect(&deckViewKeySignals, &KeySignals::onShiftS, this, &DeckEditorDeckDockWidget::actSwapCard); connect(&deckViewKeySignals, &KeySignals::onEnter, this, &DeckEditorDeckDockWidget::actIncrement); @@ -577,13 +576,14 @@ void DeckEditorDeckDockWidget::offsetCountAtIndex(const QModelIndex &idx, int of void DeckEditorDeckDockWidget::decklistCustomMenu(QPoint point) { - QMenu menu; + if (!SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference()) { + QMenu menu; - QAction *selectPrinting = menu.addAction(tr("Select Printing")); + QAction *selectPrinting = menu.addAction(tr("Select Printing")); + connect(selectPrinting, &QAction::triggered, deckEditor, &AbstractTabDeckEditor::showPrintingSelector); - connect(selectPrinting, &QAction::triggered, deckEditor, &AbstractTabDeckEditor::showPrintingSelector); - - menu.exec(deckView->mapToGlobal(point)); + menu.exec(deckView->mapToGlobal(point)); + } } void DeckEditorDeckDockWidget::refreshShortcuts() diff --git a/cockatrice/src/interface/widgets/deck_editor/deck_editor_deck_dock_widget.h b/cockatrice/src/interface/widgets/deck_editor/deck_editor_deck_dock_widget.h index 3cb9bf5e9..06169aa3e 100644 --- a/cockatrice/src/interface/widgets/deck_editor/deck_editor_deck_dock_widget.h +++ b/cockatrice/src/interface/widgets/deck_editor/deck_editor_deck_dock_widget.h @@ -8,10 +8,8 @@ #ifndef DECK_EDITOR_DECK_DOCK_WIDGET_H #define DECK_EDITOR_DECK_DOCK_WIDGET_H -#include "../../../card/card_info.h" -#include "../../../deck/custom_line_edit.h" -#include "../../../tabs/abstract_tab_deck_editor.h" -#include "../../../utility/key_signals.h" +#include "../../../interface/widgets/tabs/abstract_tab_deck_editor.h" +#include "../utility/custom_line_edit.h" #include "../visual_deck_storage/deck_preview/deck_preview_deck_tags_display_widget.h" #include @@ -19,6 +17,8 @@ #include #include #include +#include +#include class DeckListModel; class AbstractTabDeckEditor; diff --git a/cockatrice/src/interface/widgets/deck_editor/deck_editor_filter_dock_widget.cpp b/cockatrice/src/interface/widgets/deck_editor/deck_editor_filter_dock_widget.cpp index 51d0cdbbe..b68ec36eb 100644 --- a/cockatrice/src/interface/widgets/deck_editor/deck_editor_filter_dock_widget.cpp +++ b/cockatrice/src/interface/widgets/deck_editor/deck_editor_filter_dock_widget.cpp @@ -1,13 +1,13 @@ #include "deck_editor_filter_dock_widget.h" -#include "../../../database/model/card_database_model.h" #include "../../../filters/filter_builder.h" #include "../../../filters/filter_tree_model.h" -#include "../../../settings/cache_settings.h" #include #include #include +#include +#include DeckEditorFilterDockWidget::DeckEditorFilterDockWidget(AbstractTabDeckEditor *parent) : QDockWidget(parent), deckEditor(parent) diff --git a/cockatrice/src/interface/widgets/deck_editor/deck_editor_filter_dock_widget.h b/cockatrice/src/interface/widgets/deck_editor/deck_editor_filter_dock_widget.h index 7357e489f..298f6c4e5 100644 --- a/cockatrice/src/interface/widgets/deck_editor/deck_editor_filter_dock_widget.h +++ b/cockatrice/src/interface/widgets/deck_editor/deck_editor_filter_dock_widget.h @@ -8,11 +8,11 @@ #ifndef DECK_EDITOR_FILTER_DOCK_WIDGET_H #define DECK_EDITOR_FILTER_DOCK_WIDGET_H -#include "../../../tabs/abstract_tab_deck_editor.h" -#include "../../../utility/key_signals.h" +#include "../../../interface/widgets/tabs/abstract_tab_deck_editor.h" #include #include +#include class FilterTreeModel; class AbstractTabDeckEditor; diff --git a/cockatrice/src/interface/widgets/deck_editor/deck_editor_printing_selector_dock_widget.cpp b/cockatrice/src/interface/widgets/deck_editor/deck_editor_printing_selector_dock_widget.cpp index 732c74cf2..0c068e043 100644 --- a/cockatrice/src/interface/widgets/deck_editor/deck_editor_printing_selector_dock_widget.cpp +++ b/cockatrice/src/interface/widgets/deck_editor/deck_editor_printing_selector_dock_widget.cpp @@ -1,6 +1,6 @@ #include "deck_editor_printing_selector_dock_widget.h" -#include "../../../tabs/abstract_tab_deck_editor.h" +#include "../../../interface/widgets/tabs/abstract_tab_deck_editor.h" #include diff --git a/cockatrice/src/interface/widgets/deck_editor/deck_editor_printing_selector_dock_widget.h b/cockatrice/src/interface/widgets/deck_editor/deck_editor_printing_selector_dock_widget.h index efb3e6c6b..d7836a938 100644 --- a/cockatrice/src/interface/widgets/deck_editor/deck_editor_printing_selector_dock_widget.h +++ b/cockatrice/src/interface/widgets/deck_editor/deck_editor_printing_selector_dock_widget.h @@ -7,7 +7,7 @@ #ifndef DECK_EDITOR_PRINTING_SELECTOR_DOCK_WIDGET_H #define DECK_EDITOR_PRINTING_SELECTOR_DOCK_WIDGET_H -#include "../../../tabs/abstract_tab_deck_editor.h" +#include "../../../interface/widgets/tabs/abstract_tab_deck_editor.h" #include "../printing_selector/printing_selector.h" #include diff --git a/cockatrice/src/dialogs/dlg_connect.cpp b/cockatrice/src/interface/widgets/dialogs/dlg_connect.cpp similarity index 99% rename from cockatrice/src/dialogs/dlg_connect.cpp rename to cockatrice/src/interface/widgets/dialogs/dlg_connect.cpp index d8cf11487..3f398218e 100644 --- a/cockatrice/src/dialogs/dlg_connect.cpp +++ b/cockatrice/src/interface/widgets/dialogs/dlg_connect.cpp @@ -1,8 +1,5 @@ #include "dlg_connect.h" -#include "../settings/cache_settings.h" -#include "trice_limits.h" - #include #include #include @@ -15,6 +12,8 @@ #include #include #include +#include +#include DlgConnect::DlgConnect(QWidget *parent) : QDialog(parent) { diff --git a/cockatrice/src/dialogs/dlg_connect.h b/cockatrice/src/interface/widgets/dialogs/dlg_connect.h similarity index 92% rename from cockatrice/src/dialogs/dlg_connect.h rename to cockatrice/src/interface/widgets/dialogs/dlg_connect.h index b2afbef4d..e89f0b4d6 100644 --- a/cockatrice/src/dialogs/dlg_connect.h +++ b/cockatrice/src/interface/widgets/dialogs/dlg_connect.h @@ -7,12 +7,12 @@ #ifndef DLG_CONNECT_H #define DLG_CONNECT_H -#include "../server/handle_public_servers.h" -#include "../server/user/user_info_connection.h" -#include "../utility/macros.h" +#include "../interface/widgets/server/handle_public_servers.h" +#include "../interface/widgets/server/user/user_info_connection.h" #include #include +#include class QCheckBox; class QComboBox; diff --git a/cockatrice/src/dialogs/dlg_convert_deck_to_cod_format.cpp b/cockatrice/src/interface/widgets/dialogs/dlg_convert_deck_to_cod_format.cpp similarity index 100% rename from cockatrice/src/dialogs/dlg_convert_deck_to_cod_format.cpp rename to cockatrice/src/interface/widgets/dialogs/dlg_convert_deck_to_cod_format.cpp diff --git a/cockatrice/src/dialogs/dlg_convert_deck_to_cod_format.h b/cockatrice/src/interface/widgets/dialogs/dlg_convert_deck_to_cod_format.h similarity index 100% rename from cockatrice/src/dialogs/dlg_convert_deck_to_cod_format.h rename to cockatrice/src/interface/widgets/dialogs/dlg_convert_deck_to_cod_format.h diff --git a/cockatrice/src/dialogs/dlg_create_game.cpp b/cockatrice/src/interface/widgets/dialogs/dlg_create_game.cpp similarity index 98% rename from cockatrice/src/dialogs/dlg_create_game.cpp rename to cockatrice/src/interface/widgets/dialogs/dlg_create_game.cpp index 81b233dcb..86b002c92 100644 --- a/cockatrice/src/dialogs/dlg_create_game.cpp +++ b/cockatrice/src/interface/widgets/dialogs/dlg_create_game.cpp @@ -1,10 +1,6 @@ #include "dlg_create_game.h" -#include "../server/pending_command.h" -#include "../settings/cache_settings.h" -#include "../tabs/tab_room.h" -#include "pb/serverinfo_game.pb.h" -#include "trice_limits.h" +#include "../interface/widgets/tabs/tab_room.h" #include #include @@ -19,6 +15,10 @@ #include #include #include +#include +#include +#include +#include void DlgCreateGame::sharedCtor() { diff --git a/cockatrice/src/dialogs/dlg_create_game.h b/cockatrice/src/interface/widgets/dialogs/dlg_create_game.h similarity index 97% rename from cockatrice/src/dialogs/dlg_create_game.h rename to cockatrice/src/interface/widgets/dialogs/dlg_create_game.h index ac7592b94..71359a758 100644 --- a/cockatrice/src/dialogs/dlg_create_game.h +++ b/cockatrice/src/interface/widgets/dialogs/dlg_create_game.h @@ -7,10 +7,9 @@ #ifndef DLG_CREATEGAME_H #define DLG_CREATEGAME_H -#include "../utility/macros.h" - #include #include +#include class QCheckBox; class QDialogButtonBox; diff --git a/cockatrice/src/dialogs/dlg_default_tags_editor.cpp b/cockatrice/src/interface/widgets/dialogs/dlg_default_tags_editor.cpp similarity index 98% rename from cockatrice/src/dialogs/dlg_default_tags_editor.cpp rename to cockatrice/src/interface/widgets/dialogs/dlg_default_tags_editor.cpp index fbd737d4a..39b7333c5 100644 --- a/cockatrice/src/dialogs/dlg_default_tags_editor.cpp +++ b/cockatrice/src/interface/widgets/dialogs/dlg_default_tags_editor.cpp @@ -1,9 +1,8 @@ #include "dlg_default_tags_editor.h" -#include "../settings/cache_settings.h" - #include #include +#include DlgDefaultTagsEditor::DlgDefaultTagsEditor(QWidget *parent) : QDialog(parent) { diff --git a/cockatrice/src/dialogs/dlg_default_tags_editor.h b/cockatrice/src/interface/widgets/dialogs/dlg_default_tags_editor.h similarity index 100% rename from cockatrice/src/dialogs/dlg_default_tags_editor.h rename to cockatrice/src/interface/widgets/dialogs/dlg_default_tags_editor.h diff --git a/cockatrice/src/dialogs/dlg_edit_avatar.cpp b/cockatrice/src/interface/widgets/dialogs/dlg_edit_avatar.cpp similarity index 98% rename from cockatrice/src/dialogs/dlg_edit_avatar.cpp rename to cockatrice/src/interface/widgets/dialogs/dlg_edit_avatar.cpp index 98a41bdfa..28be359a3 100644 --- a/cockatrice/src/dialogs/dlg_edit_avatar.cpp +++ b/cockatrice/src/interface/widgets/dialogs/dlg_edit_avatar.cpp @@ -1,7 +1,5 @@ #include "dlg_edit_avatar.h" -#include "trice_limits.h" - #include #include #include @@ -11,6 +9,7 @@ #include #include #include +#include DlgEditAvatar::DlgEditAvatar(QWidget *parent) : QDialog(parent), image() { diff --git a/cockatrice/src/dialogs/dlg_edit_avatar.h b/cockatrice/src/interface/widgets/dialogs/dlg_edit_avatar.h similarity index 100% rename from cockatrice/src/dialogs/dlg_edit_avatar.h rename to cockatrice/src/interface/widgets/dialogs/dlg_edit_avatar.h diff --git a/cockatrice/src/dialogs/dlg_edit_password.cpp b/cockatrice/src/interface/widgets/dialogs/dlg_edit_password.cpp similarity index 96% rename from cockatrice/src/dialogs/dlg_edit_password.cpp rename to cockatrice/src/interface/widgets/dialogs/dlg_edit_password.cpp index bea94ae08..105783210 100644 --- a/cockatrice/src/dialogs/dlg_edit_password.cpp +++ b/cockatrice/src/interface/widgets/dialogs/dlg_edit_password.cpp @@ -1,13 +1,12 @@ #include "dlg_edit_password.h" -#include "../settings/cache_settings.h" -#include "trice_limits.h" - #include #include #include #include #include +#include +#include DlgEditPassword::DlgEditPassword(QWidget *parent) : QDialog(parent) { diff --git a/cockatrice/src/dialogs/dlg_edit_password.h b/cockatrice/src/interface/widgets/dialogs/dlg_edit_password.h similarity index 100% rename from cockatrice/src/dialogs/dlg_edit_password.h rename to cockatrice/src/interface/widgets/dialogs/dlg_edit_password.h diff --git a/cockatrice/src/dialogs/dlg_edit_tokens.cpp b/cockatrice/src/interface/widgets/dialogs/dlg_edit_tokens.cpp similarity index 95% rename from cockatrice/src/dialogs/dlg_edit_tokens.cpp rename to cockatrice/src/interface/widgets/dialogs/dlg_edit_tokens.cpp index 56711dda6..5b18ad3bf 100644 --- a/cockatrice/src/dialogs/dlg_edit_tokens.cpp +++ b/cockatrice/src/interface/widgets/dialogs/dlg_edit_tokens.cpp @@ -1,12 +1,7 @@ #include "dlg_edit_tokens.h" -#include "../client/get_text_with_max.h" -#include "../database/card_database.h" -#include "../database/card_database_manager.h" -#include "../database/model/card_database_model.h" -#include "../database/model/token/token_edit_model.h" +#include "../interface/widgets/utility/get_text_with_max.h" #include "../main.h" -#include "trice_limits.h" #include #include @@ -22,6 +17,11 @@ #include #include #include +#include +#include +#include +#include +#include DlgEditTokens::DlgEditTokens(QWidget *parent) : QDialog(parent), currentCard(nullptr) { diff --git a/cockatrice/src/dialogs/dlg_edit_tokens.h b/cockatrice/src/interface/widgets/dialogs/dlg_edit_tokens.h similarity index 96% rename from cockatrice/src/dialogs/dlg_edit_tokens.h rename to cockatrice/src/interface/widgets/dialogs/dlg_edit_tokens.h index ce3f6d7d4..f19646756 100644 --- a/cockatrice/src/dialogs/dlg_edit_tokens.h +++ b/cockatrice/src/interface/widgets/dialogs/dlg_edit_tokens.h @@ -7,9 +7,8 @@ #ifndef DLG_EDIT_TOKENS_H #define DLG_EDIT_TOKENS_H -#include "../card/card_info.h" - #include +#include class QModelIndex; class CardDatabaseModel; diff --git a/cockatrice/src/dialogs/dlg_edit_user.cpp b/cockatrice/src/interface/widgets/dialogs/dlg_edit_user.cpp similarity index 95% rename from cockatrice/src/dialogs/dlg_edit_user.cpp rename to cockatrice/src/interface/widgets/dialogs/dlg_edit_user.cpp index 7b2af1445..70e99ca28 100644 --- a/cockatrice/src/dialogs/dlg_edit_user.cpp +++ b/cockatrice/src/interface/widgets/dialogs/dlg_edit_user.cpp @@ -1,13 +1,12 @@ #include "dlg_edit_user.h" -#include "../settings/cache_settings.h" -#include "trice_limits.h" - #include #include #include #include #include +#include +#include DlgEditUser::DlgEditUser(QWidget *parent, QString email, QString country, QString realName) : QDialog(parent) { diff --git a/cockatrice/src/dialogs/dlg_edit_user.h b/cockatrice/src/interface/widgets/dialogs/dlg_edit_user.h similarity index 100% rename from cockatrice/src/dialogs/dlg_edit_user.h rename to cockatrice/src/interface/widgets/dialogs/dlg_edit_user.h diff --git a/cockatrice/src/dialogs/dlg_filter_games.cpp b/cockatrice/src/interface/widgets/dialogs/dlg_filter_games.cpp similarity index 100% rename from cockatrice/src/dialogs/dlg_filter_games.cpp rename to cockatrice/src/interface/widgets/dialogs/dlg_filter_games.cpp diff --git a/cockatrice/src/dialogs/dlg_filter_games.h b/cockatrice/src/interface/widgets/dialogs/dlg_filter_games.h similarity index 98% rename from cockatrice/src/dialogs/dlg_filter_games.h rename to cockatrice/src/interface/widgets/dialogs/dlg_filter_games.h index bba68b973..ab07a02d4 100644 --- a/cockatrice/src/dialogs/dlg_filter_games.h +++ b/cockatrice/src/interface/widgets/dialogs/dlg_filter_games.h @@ -7,7 +7,7 @@ #ifndef DLG_FILTER_GAMES_H #define DLG_FILTER_GAMES_H -#include "../server/games_model.h" +#include "../interface/widgets/server/games_model.h" #include #include diff --git a/cockatrice/src/dialogs/dlg_forgot_password_challenge.cpp b/cockatrice/src/interface/widgets/dialogs/dlg_forgot_password_challenge.cpp similarity index 97% rename from cockatrice/src/dialogs/dlg_forgot_password_challenge.cpp rename to cockatrice/src/interface/widgets/dialogs/dlg_forgot_password_challenge.cpp index 4ff237edf..a8999d1e3 100644 --- a/cockatrice/src/dialogs/dlg_forgot_password_challenge.cpp +++ b/cockatrice/src/interface/widgets/dialogs/dlg_forgot_password_challenge.cpp @@ -1,8 +1,5 @@ #include "dlg_forgot_password_challenge.h" -#include "../settings/cache_settings.h" -#include "trice_limits.h" - #include #include #include @@ -10,6 +7,8 @@ #include #include #include +#include +#include DlgForgotPasswordChallenge::DlgForgotPasswordChallenge(QWidget *parent) : QDialog(parent) { diff --git a/cockatrice/src/dialogs/dlg_forgot_password_challenge.h b/cockatrice/src/interface/widgets/dialogs/dlg_forgot_password_challenge.h similarity index 100% rename from cockatrice/src/dialogs/dlg_forgot_password_challenge.h rename to cockatrice/src/interface/widgets/dialogs/dlg_forgot_password_challenge.h diff --git a/cockatrice/src/dialogs/dlg_forgot_password_request.cpp b/cockatrice/src/interface/widgets/dialogs/dlg_forgot_password_request.cpp similarity index 96% rename from cockatrice/src/dialogs/dlg_forgot_password_request.cpp rename to cockatrice/src/interface/widgets/dialogs/dlg_forgot_password_request.cpp index a07bda279..000e7b0f1 100644 --- a/cockatrice/src/dialogs/dlg_forgot_password_request.cpp +++ b/cockatrice/src/interface/widgets/dialogs/dlg_forgot_password_request.cpp @@ -1,8 +1,5 @@ #include "dlg_forgot_password_request.h" -#include "../settings/cache_settings.h" -#include "trice_limits.h" - #include #include #include @@ -10,6 +7,8 @@ #include #include #include +#include +#include DlgForgotPasswordRequest::DlgForgotPasswordRequest(QWidget *parent) : QDialog(parent) { diff --git a/cockatrice/src/dialogs/dlg_forgot_password_request.h b/cockatrice/src/interface/widgets/dialogs/dlg_forgot_password_request.h similarity index 100% rename from cockatrice/src/dialogs/dlg_forgot_password_request.h rename to cockatrice/src/interface/widgets/dialogs/dlg_forgot_password_request.h diff --git a/cockatrice/src/dialogs/dlg_forgot_password_reset.cpp b/cockatrice/src/interface/widgets/dialogs/dlg_forgot_password_reset.cpp similarity index 98% rename from cockatrice/src/dialogs/dlg_forgot_password_reset.cpp rename to cockatrice/src/interface/widgets/dialogs/dlg_forgot_password_reset.cpp index 81ab96b9b..43b6c2fb9 100644 --- a/cockatrice/src/dialogs/dlg_forgot_password_reset.cpp +++ b/cockatrice/src/interface/widgets/dialogs/dlg_forgot_password_reset.cpp @@ -1,8 +1,5 @@ #include "dlg_forgot_password_reset.h" -#include "../settings/cache_settings.h" -#include "trice_limits.h" - #include #include #include @@ -10,6 +7,8 @@ #include #include #include +#include +#include DlgForgotPasswordReset::DlgForgotPasswordReset(QWidget *parent) : QDialog(parent) { diff --git a/cockatrice/src/dialogs/dlg_forgot_password_reset.h b/cockatrice/src/interface/widgets/dialogs/dlg_forgot_password_reset.h similarity index 100% rename from cockatrice/src/dialogs/dlg_forgot_password_reset.h rename to cockatrice/src/interface/widgets/dialogs/dlg_forgot_password_reset.h diff --git a/cockatrice/src/dialogs/dlg_load_deck.cpp b/cockatrice/src/interface/widgets/dialogs/dlg_load_deck.cpp similarity index 85% rename from cockatrice/src/dialogs/dlg_load_deck.cpp rename to cockatrice/src/interface/widgets/dialogs/dlg_load_deck.cpp index 91252a768..9c37fbe50 100644 --- a/cockatrice/src/dialogs/dlg_load_deck.cpp +++ b/cockatrice/src/interface/widgets/dialogs/dlg_load_deck.cpp @@ -1,7 +1,7 @@ #include "dlg_load_deck.h" -#include "../deck/deck_loader.h" -#include "../settings/cache_settings.h" +#include +#include DlgLoadDeck::DlgLoadDeck(QWidget *parent) : QFileDialog(parent, tr("Load Deck")) { diff --git a/cockatrice/src/dialogs/dlg_load_deck.h b/cockatrice/src/interface/widgets/dialogs/dlg_load_deck.h similarity index 100% rename from cockatrice/src/dialogs/dlg_load_deck.h rename to cockatrice/src/interface/widgets/dialogs/dlg_load_deck.h diff --git a/cockatrice/src/dialogs/dlg_load_deck_from_clipboard.cpp b/cockatrice/src/interface/widgets/dialogs/dlg_load_deck_from_clipboard.cpp similarity index 98% rename from cockatrice/src/dialogs/dlg_load_deck_from_clipboard.cpp rename to cockatrice/src/interface/widgets/dialogs/dlg_load_deck_from_clipboard.cpp index 26f92f4e9..6ff31acbd 100644 --- a/cockatrice/src/dialogs/dlg_load_deck_from_clipboard.cpp +++ b/cockatrice/src/interface/widgets/dialogs/dlg_load_deck_from_clipboard.cpp @@ -1,7 +1,5 @@ #include "dlg_load_deck_from_clipboard.h" -#include "../deck/deck_loader.h" -#include "../settings/cache_settings.h" #include "dlg_settings.h" #include @@ -13,6 +11,8 @@ #include #include #include +#include +#include /** * Creates the main layout and connects the signals that are common to all versions of this window diff --git a/cockatrice/src/dialogs/dlg_load_deck_from_clipboard.h b/cockatrice/src/interface/widgets/dialogs/dlg_load_deck_from_clipboard.h similarity index 100% rename from cockatrice/src/dialogs/dlg_load_deck_from_clipboard.h rename to cockatrice/src/interface/widgets/dialogs/dlg_load_deck_from_clipboard.h diff --git a/cockatrice/src/dialogs/dlg_load_deck_from_website.cpp b/cockatrice/src/interface/widgets/dialogs/dlg_load_deck_from_website.cpp similarity index 100% rename from cockatrice/src/dialogs/dlg_load_deck_from_website.cpp rename to cockatrice/src/interface/widgets/dialogs/dlg_load_deck_from_website.cpp diff --git a/cockatrice/src/dialogs/dlg_load_deck_from_website.h b/cockatrice/src/interface/widgets/dialogs/dlg_load_deck_from_website.h similarity index 100% rename from cockatrice/src/dialogs/dlg_load_deck_from_website.h rename to cockatrice/src/interface/widgets/dialogs/dlg_load_deck_from_website.h diff --git a/cockatrice/src/dialogs/dlg_load_remote_deck.cpp b/cockatrice/src/interface/widgets/dialogs/dlg_load_remote_deck.cpp similarity index 95% rename from cockatrice/src/dialogs/dlg_load_remote_deck.cpp rename to cockatrice/src/interface/widgets/dialogs/dlg_load_remote_deck.cpp index 5e2823b57..9abe1949a 100644 --- a/cockatrice/src/dialogs/dlg_load_remote_deck.cpp +++ b/cockatrice/src/interface/widgets/dialogs/dlg_load_remote_deck.cpp @@ -1,7 +1,7 @@ #include "dlg_load_remote_deck.h" +#include "../interface/widgets/server/remote/remote_decklist_tree_widget.h" #include "../main.h" -#include "../server/remote/remote_decklist_tree_widget.h" #include #include diff --git a/cockatrice/src/dialogs/dlg_load_remote_deck.h b/cockatrice/src/interface/widgets/dialogs/dlg_load_remote_deck.h similarity index 100% rename from cockatrice/src/dialogs/dlg_load_remote_deck.h rename to cockatrice/src/interface/widgets/dialogs/dlg_load_remote_deck.h diff --git a/cockatrice/src/dialogs/dlg_manage_sets.cpp b/cockatrice/src/interface/widgets/dialogs/dlg_manage_sets.cpp similarity index 97% rename from cockatrice/src/dialogs/dlg_manage_sets.cpp rename to cockatrice/src/interface/widgets/dialogs/dlg_manage_sets.cpp index 890afc075..564381496 100644 --- a/cockatrice/src/dialogs/dlg_manage_sets.cpp +++ b/cockatrice/src/interface/widgets/dialogs/dlg_manage_sets.cpp @@ -1,11 +1,8 @@ #include "dlg_manage_sets.h" -#include "../client/network/sets_model.h" -#include "../database/card_database_manager.h" -#include "../deck/custom_line_edit.h" +#include "../interface/card_picture_loader/card_picture_loader.h" +#include "../interface/widgets/utility/custom_line_edit.h" #include "../main.h" -#include "../picture_loader/picture_loader.h" -#include "../settings/cache_settings.h" #include #include @@ -22,6 +19,9 @@ #include #include #include +#include +#include +#include #define SORT_RESET -1 @@ -251,7 +251,7 @@ void WndSets::actSave() { model->save(CardDatabaseManager::getInstance()); SettingsCache::instance().setIncludeRebalancedCards(includeRebalancedCards); - PictureLoader::clearPixmapCache(); + CardPictureLoader::clearPixmapCache(); close(); } diff --git a/cockatrice/src/dialogs/dlg_manage_sets.h b/cockatrice/src/interface/widgets/dialogs/dlg_manage_sets.h similarity index 100% rename from cockatrice/src/dialogs/dlg_manage_sets.h rename to cockatrice/src/interface/widgets/dialogs/dlg_manage_sets.h diff --git a/cockatrice/src/dialogs/dlg_register.cpp b/cockatrice/src/interface/widgets/dialogs/dlg_register.cpp similarity index 99% rename from cockatrice/src/dialogs/dlg_register.cpp rename to cockatrice/src/interface/widgets/dialogs/dlg_register.cpp index 05c73179e..e71759554 100644 --- a/cockatrice/src/dialogs/dlg_register.cpp +++ b/cockatrice/src/interface/widgets/dialogs/dlg_register.cpp @@ -1,9 +1,5 @@ #include "dlg_register.h" -#include "../settings/cache_settings.h" -#include "pb/serverinfo_user.pb.h" -#include "trice_limits.h" - #include #include #include @@ -11,6 +7,9 @@ #include #include #include +#include +#include +#include DlgRegister::DlgRegister(QWidget *parent) : QDialog(parent) { diff --git a/cockatrice/src/dialogs/dlg_register.h b/cockatrice/src/interface/widgets/dialogs/dlg_register.h similarity index 100% rename from cockatrice/src/dialogs/dlg_register.h rename to cockatrice/src/interface/widgets/dialogs/dlg_register.h diff --git a/cockatrice/src/dialogs/dlg_select_set_for_cards.cpp b/cockatrice/src/interface/widgets/dialogs/dlg_select_set_for_cards.cpp similarity index 99% rename from cockatrice/src/dialogs/dlg_select_set_for_cards.cpp rename to cockatrice/src/interface/widgets/dialogs/dlg_select_set_for_cards.cpp index 9f20067b2..7c1e33eea 100644 --- a/cockatrice/src/dialogs/dlg_select_set_for_cards.cpp +++ b/cockatrice/src/interface/widgets/dialogs/dlg_select_set_for_cards.cpp @@ -1,7 +1,5 @@ #include "dlg_select_set_for_cards.h" -#include "../database/card_database_manager.h" -#include "../deck/deck_loader.h" #include "../interface/widgets/cards/card_info_picture_widget.h" #include "../interface/widgets/general/layout_containers/flow_widget.h" #include "dlg_select_set_for_cards.h" @@ -17,6 +15,8 @@ #include #include #include +#include +#include #include #include diff --git a/cockatrice/src/dialogs/dlg_select_set_for_cards.h b/cockatrice/src/interface/widgets/dialogs/dlg_select_set_for_cards.h similarity index 96% rename from cockatrice/src/dialogs/dlg_select_set_for_cards.h rename to cockatrice/src/interface/widgets/dialogs/dlg_select_set_for_cards.h index 77f9bd077..278ffc2e4 100644 --- a/cockatrice/src/dialogs/dlg_select_set_for_cards.h +++ b/cockatrice/src/interface/widgets/dialogs/dlg_select_set_for_cards.h @@ -7,7 +7,6 @@ #ifndef DLG_SELECT_SET_FOR_CARDS_H #define DLG_SELECT_SET_FOR_CARDS_H -#include "../deck/deck_list_model.h" #include "../interface/widgets/general/layout_containers/flow_widget.h" #include @@ -17,6 +16,7 @@ #include #include #include +#include class SetEntryWidget; // Forward declaration diff --git a/cockatrice/src/dialogs/dlg_settings.cpp b/cockatrice/src/interface/widgets/dialogs/dlg_settings.cpp similarity index 96% rename from cockatrice/src/dialogs/dlg_settings.cpp rename to cockatrice/src/interface/widgets/dialogs/dlg_settings.cpp index 6948a8e8b..0c4b7797e 100644 --- a/cockatrice/src/dialogs/dlg_settings.cpp +++ b/cockatrice/src/interface/widgets/dialogs/dlg_settings.cpp @@ -1,21 +1,16 @@ #include "dlg_settings.h" -#include "../client/get_text_with_max.h" -#include "../client/network/release_channel.h" -#include "../client/network/spoiler_background_updater.h" +#include "../client/network/update/card_spoiler/spoiler_background_updater.h" +#include "../client/network/update/client/release_channel.h" #include "../client/sound_engine.h" -#include "../database/card_database.h" -#include "../database/card_database_manager.h" -#include "../deck/custom_line_edit.h" +#include "../interface/card_picture_loader/card_picture_loader.h" #include "../interface/theme_manager.h" #include "../interface/widgets/general/background_sources.h" +#include "../interface/widgets/tabs/tab_supervisor.h" +#include "../interface/widgets/utility/custom_line_edit.h" +#include "../interface/widgets/utility/get_text_with_max.h" +#include "../interface/widgets/utility/sequence_edit.h" #include "../main.h" -#include "../picture_loader/picture_loader.h" -#include "../settings/cache_settings.h" -#include "../settings/card_counter_settings.h" -#include "../settings/shortcut_treeview.h" -#include "../tabs/tab_supervisor.h" -#include "../utility/sequence_edit.h" #include #include @@ -48,6 +43,11 @@ #include #include #include +#include +#include +#include +#include +#include #define WIKI_CUSTOM_PIC_URL "https://github.com/Cockatrice/Cockatrice/wiki/Custom-Picture-Download-URLs" #define WIKI_CUSTOM_SHORTCUTS "https://github.com/Cockatrice/Cockatrice/wiki/Custom-Keyboard-Shortcuts" @@ -478,8 +478,8 @@ AppearanceSettingsPage::AppearanceSettingsPage() &SettingsCache::setAutoRotateSidewaysLayoutCards); overrideAllCardArtWithPersonalPreferenceCheckBox.setChecked(settings.getOverrideAllCardArtWithPersonalPreference()); - connect(&overrideAllCardArtWithPersonalPreferenceCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings, - &SettingsCache::setOverrideAllCardArtWithPersonalPreference); + connect(&overrideAllCardArtWithPersonalPreferenceCheckBox, &QCheckBox::QT_STATE_CHANGED, this, + &AppearanceSettingsPage::overrideAllCardArtWithPersonalPreferenceToggled); bumpSetsWithCardsInDeckToTopCheckBox.setChecked(settings.getBumpSetsWithCardsInDeckToTop()); connect(&bumpSetsWithCardsInDeckToTopCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings, @@ -652,6 +652,45 @@ void AppearanceSettingsPage::showShortcutsChanged(QT_STATE_CHANGED_T value) qApp->setAttribute(Qt::AA_DontShowShortcutsInContextMenus, value == 0); // 0 = unchecked } +void AppearanceSettingsPage::overrideAllCardArtWithPersonalPreferenceToggled(QT_STATE_CHANGED_T value) +{ + bool enable = static_cast(value); + + QString message; + if (enable) { + message = tr("Enabling this feature will disable the use of the Printing Selector.\n\n" + "You will not be able to manage printing preferences on a per-deck basis, " + "or see printings other people have selected for their decks.\n\n" + "You will have to use the Set Manager, available through Card Database -> Manage Sets.\n\n" + "Are you sure you would like to enable this feature?"); + } else { + message = + tr("Disabling this feature will enable the Printing Selector.\n\n" + "You can now choose printings on a per-deck basis in the Deck Editor and configure which printing " + "gets added to a deck by default by pinning it in the Printing Selector.\n\n" + "You can also use the Set Manager to adjust custom sort order for printings in the Printing Selector" + " (other sort orders like alphabetical or release date are available).\n\n" + "Are you sure you would like to disable this feature?"); + } + + QMessageBox::StandardButton result = + QMessageBox::question(this, tr("Confirm Change"), message, QMessageBox::Yes | QMessageBox::No); + + if (result == QMessageBox::Yes) { + SettingsCache::instance().setOverrideAllCardArtWithPersonalPreference(value); + // Caches are now invalid. + CardPictureLoader::clearPixmapCache(); + CardPictureLoader::clearNetworkCache(); + } else { + // If user cancels, revert the checkbox/state back + QTimer::singleShot(0, this, [this, enable]() { + overrideAllCardArtWithPersonalPreferenceCheckBox.blockSignals(true); + overrideAllCardArtWithPersonalPreferenceCheckBox.setChecked(!enable); + overrideAllCardArtWithPersonalPreferenceCheckBox.blockSignals(false); + }); + } +} + /** * Updates the settings for cardViewInitialRowsMax. * Forces expanded rows max to always be >= initial rows max @@ -694,8 +733,7 @@ void AppearanceSettingsPage::retranslateUi() displayCardNamesCheckBox.setText(tr("Display card names on cards having a picture")); autoRotateSidewaysLayoutCardsCheckBox.setText(tr("Auto-Rotate cards with sideways layout")); overrideAllCardArtWithPersonalPreferenceCheckBox.setText( - tr("Override all card art with personal set preference (Pre-ProviderID change behavior) [Requires Client " - "restart]")); + tr("Override all card art with personal set preference (Pre-ProviderID change behavior)")); bumpSetsWithCardsInDeckToTopCheckBox.setText( tr("Bump sets that the deck contains cards from to the top in the printing selector")); cardScalingCheckBox.setText(tr("Scale cards on mouse over")); @@ -1086,7 +1124,7 @@ void DeckEditorSettingsPage::resetDownloadedURLsButtonClicked() void DeckEditorSettingsPage::clearDownloadedPicsButtonClicked() { - PictureLoader::clearNetworkCache(); + CardPictureLoader::clearNetworkCache(); // These are not used anymore, but we don't delete them automatically, so // we should do it here lest we leave pictures hanging around on users' diff --git a/cockatrice/src/dialogs/dlg_settings.h b/cockatrice/src/interface/widgets/dialogs/dlg_settings.h similarity index 98% rename from cockatrice/src/dialogs/dlg_settings.h rename to cockatrice/src/interface/widgets/dialogs/dlg_settings.h index bf8dbd2a5..22c9fa1c0 100644 --- a/cockatrice/src/dialogs/dlg_settings.h +++ b/cockatrice/src/interface/widgets/dialogs/dlg_settings.h @@ -7,8 +7,6 @@ #ifndef DLG_SETTINGS_H #define DLG_SETTINGS_H -#include "../utility/macros.h" - #include #include #include @@ -17,6 +15,7 @@ #include #include #include +#include inline Q_LOGGING_CATEGORY(DlgSettingsLog, "dlg_settings"); @@ -105,6 +104,7 @@ private slots: void themeBoxChanged(int index); void openThemeLocation(); void showShortcutsChanged(QT_STATE_CHANGED_T enabled); + void overrideAllCardArtWithPersonalPreferenceToggled(QT_STATE_CHANGED_T enabled); void cardViewInitialRowsMaxChanged(int value); void cardViewExpandedRowsMaxChanged(int value); diff --git a/cockatrice/src/dialogs/dlg_startup_card_check.cpp b/cockatrice/src/interface/widgets/dialogs/dlg_startup_card_check.cpp similarity index 97% rename from cockatrice/src/dialogs/dlg_startup_card_check.cpp rename to cockatrice/src/interface/widgets/dialogs/dlg_startup_card_check.cpp index 5d76bc253..c2a03a55e 100644 --- a/cockatrice/src/dialogs/dlg_startup_card_check.cpp +++ b/cockatrice/src/interface/widgets/dialogs/dlg_startup_card_check.cpp @@ -1,8 +1,7 @@ #include "dlg_startup_card_check.h" -#include "../settings/cache_settings.h" - #include +#include DlgStartupCardCheck::DlgStartupCardCheck(QWidget *parent) : QDialog(parent) { diff --git a/cockatrice/src/dialogs/dlg_startup_card_check.h b/cockatrice/src/interface/widgets/dialogs/dlg_startup_card_check.h similarity index 100% rename from cockatrice/src/dialogs/dlg_startup_card_check.h rename to cockatrice/src/interface/widgets/dialogs/dlg_startup_card_check.h diff --git a/cockatrice/src/dialogs/dlg_tip_of_the_day.cpp b/cockatrice/src/interface/widgets/dialogs/dlg_tip_of_the_day.cpp similarity index 99% rename from cockatrice/src/dialogs/dlg_tip_of_the_day.cpp rename to cockatrice/src/interface/widgets/dialogs/dlg_tip_of_the_day.cpp index eb8e8dc47..6023ac48c 100644 --- a/cockatrice/src/dialogs/dlg_tip_of_the_day.cpp +++ b/cockatrice/src/interface/widgets/dialogs/dlg_tip_of_the_day.cpp @@ -1,6 +1,5 @@ #include "dlg_tip_of_the_day.h" -#include "../settings/cache_settings.h" #include "tip_of_the_day.h" #include @@ -10,6 +9,7 @@ #include #include #include +#include #define MIN_TIP_IMAGE_HEIGHT 200 #define MIN_TIP_IMAGE_WIDTH 200 diff --git a/cockatrice/src/dialogs/dlg_tip_of_the_day.h b/cockatrice/src/interface/widgets/dialogs/dlg_tip_of_the_day.h similarity index 100% rename from cockatrice/src/dialogs/dlg_tip_of_the_day.h rename to cockatrice/src/interface/widgets/dialogs/dlg_tip_of_the_day.h diff --git a/cockatrice/src/dialogs/dlg_update.cpp b/cockatrice/src/interface/widgets/dialogs/dlg_update.cpp similarity index 98% rename from cockatrice/src/dialogs/dlg_update.cpp rename to cockatrice/src/interface/widgets/dialogs/dlg_update.cpp index 0edcb1512..cd7f3e8ba 100644 --- a/cockatrice/src/dialogs/dlg_update.cpp +++ b/cockatrice/src/interface/widgets/dialogs/dlg_update.cpp @@ -1,9 +1,8 @@ #include "dlg_update.h" -#include "../client/network/client_update_checker.h" -#include "../client/network/release_channel.h" +#include "../client/network/update/client/client_update_checker.h" +#include "../client/network/update/client/release_channel.h" #include "../interface/window_main.h" -#include "../settings/cache_settings.h" #include #include @@ -14,6 +13,7 @@ #include #include #include +#include #include DlgUpdate::DlgUpdate(QWidget *parent) : QDialog(parent) diff --git a/cockatrice/src/dialogs/dlg_update.h b/cockatrice/src/interface/widgets/dialogs/dlg_update.h similarity index 95% rename from cockatrice/src/dialogs/dlg_update.h rename to cockatrice/src/interface/widgets/dialogs/dlg_update.h index 45ae92178..daf0b9e47 100644 --- a/cockatrice/src/dialogs/dlg_update.h +++ b/cockatrice/src/interface/widgets/dialogs/dlg_update.h @@ -7,7 +7,7 @@ #ifndef DLG_UPDATE_H #define DLG_UPDATE_H -#include "../client/update_downloader.h" +#include "../client/network/update/client/update_downloader.h" #include #include diff --git a/cockatrice/src/dialogs/dlg_view_log.cpp b/cockatrice/src/interface/widgets/dialogs/dlg_view_log.cpp similarity index 96% rename from cockatrice/src/dialogs/dlg_view_log.cpp rename to cockatrice/src/interface/widgets/dialogs/dlg_view_log.cpp index b60a9767b..7ad8ec9ab 100644 --- a/cockatrice/src/dialogs/dlg_view_log.cpp +++ b/cockatrice/src/interface/widgets/dialogs/dlg_view_log.cpp @@ -1,13 +1,12 @@ #include "dlg_view_log.h" -#include "../settings/cache_settings.h" -#include "../utility/logger.h" - #include #include #include #include #include +#include +#include DlgViewLog::DlgViewLog(QWidget *parent) : QDialog(parent) { diff --git a/cockatrice/src/dialogs/dlg_view_log.h b/cockatrice/src/interface/widgets/dialogs/dlg_view_log.h similarity index 100% rename from cockatrice/src/dialogs/dlg_view_log.h rename to cockatrice/src/interface/widgets/dialogs/dlg_view_log.h diff --git a/cockatrice/src/dialogs/tip_of_the_day.cpp b/cockatrice/src/interface/widgets/dialogs/tip_of_the_day.cpp similarity index 100% rename from cockatrice/src/dialogs/tip_of_the_day.cpp rename to cockatrice/src/interface/widgets/dialogs/tip_of_the_day.cpp diff --git a/cockatrice/src/dialogs/tip_of_the_day.h b/cockatrice/src/interface/widgets/dialogs/tip_of_the_day.h similarity index 100% rename from cockatrice/src/dialogs/tip_of_the_day.h rename to cockatrice/src/interface/widgets/dialogs/tip_of_the_day.h diff --git a/cockatrice/src/interface/widgets/general/home_widget.cpp b/cockatrice/src/interface/widgets/general/home_widget.cpp index 50823db4b..f36f1831a 100644 --- a/cockatrice/src/interface/widgets/general/home_widget.cpp +++ b/cockatrice/src/interface/widgets/general/home_widget.cpp @@ -1,9 +1,6 @@ #include "home_widget.h" -#include "../../../database/card_database_manager.h" -#include "../../../server/remote/remote_client.h" -#include "../../../settings/cache_settings.h" -#include "../../../tabs/tab_supervisor.h" +#include "../../../interface/widgets/tabs/tab_supervisor.h" #include "../../window_main.h" #include "background_sources.h" #include "home_styled_button.h" @@ -12,6 +9,9 @@ #include #include #include +#include +#include +#include HomeWidget::HomeWidget(QWidget *parent, TabSupervisor *_tabSupervisor) : QWidget(parent), tabSupervisor(_tabSupervisor), background("theme:backgrounds/home"), overlay("theme:cockatrice") diff --git a/cockatrice/src/interface/widgets/general/home_widget.h b/cockatrice/src/interface/widgets/general/home_widget.h index 2c22bc29b..23598cc5a 100644 --- a/cockatrice/src/interface/widgets/general/home_widget.h +++ b/cockatrice/src/interface/widgets/general/home_widget.h @@ -7,14 +7,14 @@ #ifndef HOME_WIDGET_H #define HOME_WIDGET_H -#include "../../../server/abstract_client.h" -#include "../../../tabs/tab_supervisor.h" +#include "../../../interface/widgets/tabs/tab_supervisor.h" #include "../cards/card_info_picture_art_crop_widget.h" #include "home_styled_button.h" #include #include #include +#include class HomeWidget : public QWidget { diff --git a/cockatrice/src/interface/widgets/general/layout_containers/overlap_widget.cpp b/cockatrice/src/interface/widgets/general/layout_containers/overlap_widget.cpp index ac5d9f520..89ca38b67 100644 --- a/cockatrice/src/interface/widgets/general/layout_containers/overlap_widget.cpp +++ b/cockatrice/src/interface/widgets/general/layout_containers/overlap_widget.cpp @@ -1,9 +1,9 @@ #include "overlap_widget.h" -#include "../../../../deck/deck_list_model.h" #include "../../../layouts/flow_layout.h" #include +#include /** * @class OverlapWidget diff --git a/cockatrice/src/client/deck_editor_menu.cpp b/cockatrice/src/interface/widgets/menus/deck_editor_menu.cpp similarity index 98% rename from cockatrice/src/client/deck_editor_menu.cpp rename to cockatrice/src/interface/widgets/menus/deck_editor_menu.cpp index b3c46d003..aac488dd1 100644 --- a/cockatrice/src/client/deck_editor_menu.cpp +++ b/cockatrice/src/interface/widgets/menus/deck_editor_menu.cpp @@ -1,7 +1,7 @@ -#include "deck_editor_menu.h" +#include "../../../interface/widgets/menus/deck_editor_menu.h" -#include "../settings/cache_settings.h" -#include "../settings/shortcuts_settings.h" +#include +#include DeckEditorMenu::DeckEditorMenu(AbstractTabDeckEditor *parent) : QMenu(parent), deckEditor(parent) { diff --git a/cockatrice/src/client/deck_editor_menu.h b/cockatrice/src/interface/widgets/menus/deck_editor_menu.h similarity index 94% rename from cockatrice/src/client/deck_editor_menu.h rename to cockatrice/src/interface/widgets/menus/deck_editor_menu.h index 205cf6344..b35f35864 100644 --- a/cockatrice/src/client/deck_editor_menu.h +++ b/cockatrice/src/interface/widgets/menus/deck_editor_menu.h @@ -7,7 +7,7 @@ #ifndef DECK_EDITOR_MENU_H #define DECK_EDITOR_MENU_H -#include "../tabs/abstract_tab_deck_editor.h" +#include "../interface/widgets/tabs/abstract_tab_deck_editor.h" #include diff --git a/cockatrice/src/interface/tearoff_menu.h b/cockatrice/src/interface/widgets/menus/tearoff_menu.h similarity index 95% rename from cockatrice/src/interface/tearoff_menu.h rename to cockatrice/src/interface/widgets/menus/tearoff_menu.h index 30a2542e4..d2b3f3413 100644 --- a/cockatrice/src/interface/tearoff_menu.h +++ b/cockatrice/src/interface/widgets/menus/tearoff_menu.h @@ -6,9 +6,8 @@ #pragma once -#include "../settings/cache_settings.h" - #include +#include class TearOffMenu : public QMenu { diff --git a/cockatrice/src/interface/widgets/printing_selector/all_zones_card_amount_widget.h b/cockatrice/src/interface/widgets/printing_selector/all_zones_card_amount_widget.h index b666a126d..9506f88ea 100644 --- a/cockatrice/src/interface/widgets/printing_selector/all_zones_card_amount_widget.h +++ b/cockatrice/src/interface/widgets/printing_selector/all_zones_card_amount_widget.h @@ -7,12 +7,12 @@ #ifndef ALL_ZONES_CARD_AMOUNT_WIDGET_H #define ALL_ZONES_CARD_AMOUNT_WIDGET_H -#include "../../../deck/deck_list_model.h" -#include "../../../deck/deck_loader.h" #include "card_amount_widget.h" #include #include +#include +#include class AllZonesCardAmountWidget : public QWidget { diff --git a/cockatrice/src/interface/widgets/printing_selector/card_amount_widget.h b/cockatrice/src/interface/widgets/printing_selector/card_amount_widget.h index 49321ed6e..e4863be8a 100644 --- a/cockatrice/src/interface/widgets/printing_selector/card_amount_widget.h +++ b/cockatrice/src/interface/widgets/printing_selector/card_amount_widget.h @@ -8,10 +8,7 @@ #ifndef CARD_AMOUNT_WIDGET_H #define CARD_AMOUNT_WIDGET_H -#include "../../../card/card_info.h" -#include "../../../deck/deck_list_model.h" -#include "../../../deck/deck_loader.h" -#include "../../../tabs/abstract_tab_deck_editor.h" +#include "../../../interface/widgets/tabs/abstract_tab_deck_editor.h" #include "../general/display/dynamic_font_size_push_button.h" #include @@ -19,6 +16,9 @@ #include #include #include +#include +#include +#include class CardAmountWidget : public QWidget { diff --git a/cockatrice/src/interface/widgets/printing_selector/printing_selector.cpp b/cockatrice/src/interface/widgets/printing_selector/printing_selector.cpp index e49fd2c9d..8afd56f9a 100644 --- a/cockatrice/src/interface/widgets/printing_selector/printing_selector.cpp +++ b/cockatrice/src/interface/widgets/printing_selector/printing_selector.cpp @@ -1,8 +1,7 @@ #include "printing_selector.h" -#include "../../../dialogs/dlg_select_set_for_cards.h" -#include "../../../picture_loader/picture_loader.h" -#include "../../../settings/cache_settings.h" +#include "../../../interface/card_picture_loader/card_picture_loader.h" +#include "../../../interface/widgets/dialogs/dlg_select_set_for_cards.h" #include "printing_selector_card_display_widget.h" #include "printing_selector_card_search_widget.h" #include "printing_selector_card_selection_widget.h" @@ -10,6 +9,7 @@ #include #include +#include #include /** diff --git a/cockatrice/src/interface/widgets/printing_selector/printing_selector.h b/cockatrice/src/interface/widgets/printing_selector/printing_selector.h index 1fd27498a..8fc924563 100644 --- a/cockatrice/src/interface/widgets/printing_selector/printing_selector.h +++ b/cockatrice/src/interface/widgets/printing_selector/printing_selector.h @@ -7,8 +7,6 @@ #ifndef PRINTING_SELECTOR_H #define PRINTING_SELECTOR_H -#include "../../../card/card_info.h" -#include "../../../deck/deck_list_model.h" #include "../cards/card_size_widget.h" #include "../general/layout_containers/flow_widget.h" #include "../quick_settings/settings_button_widget.h" @@ -19,6 +17,8 @@ #include #include #include +#include +#include #define BATCH_SIZE 10 diff --git a/cockatrice/src/interface/widgets/printing_selector/printing_selector_card_display_widget.h b/cockatrice/src/interface/widgets/printing_selector/printing_selector_card_display_widget.h index 4bd686cb3..197e1adda 100644 --- a/cockatrice/src/interface/widgets/printing_selector/printing_selector_card_display_widget.h +++ b/cockatrice/src/interface/widgets/printing_selector/printing_selector_card_display_widget.h @@ -7,14 +7,14 @@ #ifndef PRINTING_SELECTOR_CARD_DISPLAY_WIDGET_H #define PRINTING_SELECTOR_CARD_DISPLAY_WIDGET_H -#include "../../../card/card_info.h" -#include "../../../deck/deck_list_model.h" -#include "../../../tabs/abstract_tab_deck_editor.h" +#include "../../../interface/widgets/tabs/abstract_tab_deck_editor.h" #include "printing_selector_card_overlay_widget.h" #include "set_name_and_collectors_number_display_widget.h" #include #include +#include +#include class PrintingSelectorCardDisplayWidget : public QWidget { diff --git a/cockatrice/src/interface/widgets/printing_selector/printing_selector_card_overlay_widget.cpp b/cockatrice/src/interface/widgets/printing_selector/printing_selector_card_overlay_widget.cpp index f537f566b..56e5d1aab 100644 --- a/cockatrice/src/interface/widgets/printing_selector/printing_selector_card_overlay_widget.cpp +++ b/cockatrice/src/interface/widgets/printing_selector/printing_selector_card_overlay_widget.cpp @@ -1,13 +1,13 @@ #include "printing_selector_card_overlay_widget.h" -#include "../../../card/card_relation.h" -#include "../../../database/card_database_manager.h" -#include "../../../settings/cache_settings.h" #include "printing_selector_card_display_widget.h" #include #include #include +#include +#include +#include #include /** diff --git a/cockatrice/src/interface/widgets/printing_selector/printing_selector_card_overlay_widget.h b/cockatrice/src/interface/widgets/printing_selector/printing_selector_card_overlay_widget.h index 84f029f11..8bc865920 100644 --- a/cockatrice/src/interface/widgets/printing_selector/printing_selector_card_overlay_widget.h +++ b/cockatrice/src/interface/widgets/printing_selector/printing_selector_card_overlay_widget.h @@ -7,14 +7,15 @@ #ifndef PRINTING_SELECTOR_CARD_OVERLAY_WIDGET_H #define PRINTING_SELECTOR_CARD_OVERLAY_WIDGET_H -#include "../../../card/card_info.h" -#include "../../../deck/deck_list_model.h" -#include "../../../tabs/abstract_tab_deck_editor.h" +#include "../../../interface/widgets/tabs/abstract_tab_deck_editor.h" #include "../cards/card_info_picture_widget.h" #include "all_zones_card_amount_widget.h" #include "card_amount_widget.h" #include "set_name_and_collectors_number_display_widget.h" +#include +#include + class PrintingSelectorCardOverlayWidget : public QWidget { Q_OBJECT diff --git a/cockatrice/src/interface/widgets/printing_selector/printing_selector_card_selection_widget.cpp b/cockatrice/src/interface/widgets/printing_selector/printing_selector_card_selection_widget.cpp index 5b2935b7b..9c046a51b 100644 --- a/cockatrice/src/interface/widgets/printing_selector/printing_selector_card_selection_widget.cpp +++ b/cockatrice/src/interface/widgets/printing_selector/printing_selector_card_selection_widget.cpp @@ -1,6 +1,6 @@ #include "printing_selector_card_selection_widget.h" -#include "../../../dialogs/dlg_select_set_for_cards.h" +#include "../../../interface/widgets/dialogs/dlg_select_set_for_cards.h" /** * @brief Constructs a PrintingSelectorCardSelectionWidget for navigating through cards in the deck. diff --git a/cockatrice/src/interface/widgets/printing_selector/printing_selector_card_sorting_widget.cpp b/cockatrice/src/interface/widgets/printing_selector/printing_selector_card_sorting_widget.cpp index 2da987762..d95019e80 100644 --- a/cockatrice/src/interface/widgets/printing_selector/printing_selector_card_sorting_widget.cpp +++ b/cockatrice/src/interface/widgets/printing_selector/printing_selector_card_sorting_widget.cpp @@ -1,7 +1,7 @@ #include "printing_selector_card_sorting_widget.h" -#include "../../../settings/cache_settings.h" -#include "../../../utility/card_set_comparator.h" +#include +#include const QString PrintingSelectorCardSortingWidget::SORT_OPTIONS_ALPHABETICAL = tr("Alphabetical"); const QString PrintingSelectorCardSortingWidget::SORT_OPTIONS_PREFERENCE = tr("Preference"); diff --git a/cockatrice/src/client/replay_manager.cpp b/cockatrice/src/interface/widgets/replay/replay_manager.cpp similarity index 99% rename from cockatrice/src/client/replay_manager.cpp rename to cockatrice/src/interface/widgets/replay/replay_manager.cpp index 843632c99..fac3576f2 100644 --- a/cockatrice/src/client/replay_manager.cpp +++ b/cockatrice/src/interface/widgets/replay/replay_manager.cpp @@ -1,6 +1,6 @@ #include "replay_manager.h" -#include "../tabs/tab_game.h" +#include "../interface/widgets/tabs/tab_game.h" #include #include diff --git a/cockatrice/src/client/replay_manager.h b/cockatrice/src/interface/widgets/replay/replay_manager.h similarity index 91% rename from cockatrice/src/client/replay_manager.h rename to cockatrice/src/interface/widgets/replay/replay_manager.h index 55a64768c..9469adcd4 100644 --- a/cockatrice/src/client/replay_manager.h +++ b/cockatrice/src/interface/widgets/replay/replay_manager.h @@ -8,11 +8,11 @@ #ifndef REPLAY_MANAGER_H #define REPLAY_MANAGER_H -#include "network/replay_timeline_widget.h" -#include "pb/game_replay.pb.h" +#include "replay_timeline_widget.h" #include #include +#include class TabGame; diff --git a/cockatrice/src/client/network/replay_timeline_widget.cpp b/cockatrice/src/interface/widgets/replay/replay_timeline_widget.cpp similarity index 99% rename from cockatrice/src/client/network/replay_timeline_widget.cpp rename to cockatrice/src/interface/widgets/replay/replay_timeline_widget.cpp index 1f258bf68..2b9ab72e9 100644 --- a/cockatrice/src/client/network/replay_timeline_widget.cpp +++ b/cockatrice/src/interface/widgets/replay/replay_timeline_widget.cpp @@ -1,11 +1,10 @@ #include "replay_timeline_widget.h" -#include "../../settings/cache_settings.h" - #include #include #include #include +#include ReplayTimelineWidget::ReplayTimelineWidget(QWidget *parent) : QWidget(parent), maxBinValue(1), maxTime(1), timeScaleFactor(1.0), currentVisualTime(0), currentProcessedTime(0), diff --git a/cockatrice/src/client/network/replay_timeline_widget.h b/cockatrice/src/interface/widgets/replay/replay_timeline_widget.h similarity index 97% rename from cockatrice/src/client/network/replay_timeline_widget.h rename to cockatrice/src/interface/widgets/replay/replay_timeline_widget.h index aa9e03e31..e55d408ce 100644 --- a/cockatrice/src/client/network/replay_timeline_widget.h +++ b/cockatrice/src/interface/widgets/replay/replay_timeline_widget.h @@ -7,7 +7,7 @@ #ifndef REPLAY_TIMELINE_WIDGET #define REPLAY_TIMELINE_WIDGET -#include "../../game/player/event_processing_options.h" +#include "../../../game/player/event_processing_options.h" #include #include diff --git a/cockatrice/src/server/chat_view/chat_view.cpp b/cockatrice/src/interface/widgets/server/chat_view/chat_view.cpp similarity index 99% rename from cockatrice/src/server/chat_view/chat_view.cpp rename to cockatrice/src/interface/widgets/server/chat_view/chat_view.cpp index b6a6b3f98..10897b651 100644 --- a/cockatrice/src/server/chat_view/chat_view.cpp +++ b/cockatrice/src/interface/widgets/server/chat_view/chat_view.cpp @@ -2,18 +2,18 @@ #include "../../client/sound_engine.h" #include "../../interface/pixel_map_generator.h" -#include "../../settings/cache_settings.h" -#include "../../tabs/tab_account.h" +#include "../../interface/widgets/tabs/tab_account.h" #include "../user/user_context_menu.h" #include "../user/user_list_manager.h" #include "../user/user_list_proxy.h" -#include "user_level.h" #include #include #include #include #include +#include +#include const QColor DEFAULT_MENTION_COLOR = QColor(194, 31, 47); diff --git a/cockatrice/src/server/chat_view/chat_view.h b/cockatrice/src/interface/widgets/server/chat_view/chat_view.h similarity index 95% rename from cockatrice/src/server/chat_view/chat_view.h rename to cockatrice/src/interface/widgets/server/chat_view/chat_view.h index 924c2ff42..9b2287726 100644 --- a/cockatrice/src/server/chat_view/chat_view.h +++ b/cockatrice/src/interface/widgets/server/chat_view/chat_view.h @@ -8,16 +8,16 @@ #ifndef CHATVIEW_H #define CHATVIEW_H -#include "../../tabs/tab_supervisor.h" +#include "../../interface/widgets/tabs/tab_supervisor.h" #include "../user/user_list_widget.h" -#include "room_message_type.h" -#include "user_level.h" #include #include #include #include #include +#include +#include class AbstractGame; class QTextTable; diff --git a/cockatrice/src/server/game_selector.cpp b/cockatrice/src/interface/widgets/server/game_selector.cpp similarity index 95% rename from cockatrice/src/server/game_selector.cpp rename to cockatrice/src/interface/widgets/server/game_selector.cpp index 3cfd3315a..e3fa1b64f 100644 --- a/cockatrice/src/server/game_selector.cpp +++ b/cockatrice/src/interface/widgets/server/game_selector.cpp @@ -1,18 +1,13 @@ #include "game_selector.h" -#include "../client/get_text_with_max.h" -#include "../dialogs/dlg_create_game.h" -#include "../dialogs/dlg_filter_games.h" -#include "../tabs/tab_account.h" -#include "../tabs/tab_game.h" -#include "../tabs/tab_room.h" -#include "../tabs/tab_supervisor.h" -#include "abstract_client.h" +#include "../interface/widgets/dialogs/dlg_create_game.h" +#include "../interface/widgets/dialogs/dlg_filter_games.h" +#include "../interface/widgets/tabs/tab_account.h" +#include "../interface/widgets/tabs/tab_game.h" +#include "../interface/widgets/tabs/tab_room.h" +#include "../interface/widgets/tabs/tab_supervisor.h" +#include "../interface/widgets/utility/get_text_with_max.h" #include "games_model.h" -#include "pb/response.pb.h" -#include "pb/room_commands.pb.h" -#include "pb/serverinfo_game.pb.h" -#include "pending_command.h" #include "user/user_list_manager.h" #include @@ -26,6 +21,11 @@ #include #include #include +#include +#include +#include +#include +#include GameSelector::GameSelector(AbstractClient *_client, TabSupervisor *_tabSupervisor, diff --git a/cockatrice/src/server/game_selector.h b/cockatrice/src/interface/widgets/server/game_selector.h similarity index 91% rename from cockatrice/src/server/game_selector.h rename to cockatrice/src/interface/widgets/server/game_selector.h index a6cadf141..0ca477fa9 100644 --- a/cockatrice/src/server/game_selector.h +++ b/cockatrice/src/interface/widgets/server/game_selector.h @@ -10,9 +10,9 @@ #include "game_type_map.h" #include -#include -#include -#include +#include +#include +#include class QTreeView; class GamesModel; diff --git a/cockatrice/src/server/game_type_map.h b/cockatrice/src/interface/widgets/server/game_type_map.h similarity index 100% rename from cockatrice/src/server/game_type_map.h rename to cockatrice/src/interface/widgets/server/game_type_map.h diff --git a/cockatrice/src/server/games_model.cpp b/cockatrice/src/interface/widgets/server/games_model.cpp similarity index 99% rename from cockatrice/src/server/games_model.cpp rename to cockatrice/src/interface/widgets/server/games_model.cpp index 5c336738c..f05d47efe 100644 --- a/cockatrice/src/server/games_model.cpp +++ b/cockatrice/src/interface/widgets/server/games_model.cpp @@ -1,9 +1,7 @@ #include "games_model.h" #include "../interface/pixel_map_generator.h" -#include "../settings/cache_settings.h" -#include "../tabs/tab_account.h" -#include "pb/serverinfo_game.pb.h" +#include "../interface/widgets/tabs/tab_account.h" #include "user/user_list_manager.h" #include "user/user_list_widget.h" @@ -13,6 +11,8 @@ #include #include #include +#include +#include enum GameListColumn { diff --git a/cockatrice/src/server/games_model.h b/cockatrice/src/interface/widgets/server/games_model.h similarity index 98% rename from cockatrice/src/server/games_model.h rename to cockatrice/src/interface/widgets/server/games_model.h index 03717bce8..1541b57bf 100644 --- a/cockatrice/src/server/games_model.h +++ b/cockatrice/src/interface/widgets/server/games_model.h @@ -8,7 +8,6 @@ #define GAMESMODEL_H #include "game_type_map.h" -#include "pb/serverinfo_game.pb.h" #include #include @@ -16,6 +15,7 @@ #include #include #include +#include class UserListProxy; diff --git a/cockatrice/src/server/handle_public_servers.cpp b/cockatrice/src/interface/widgets/server/handle_public_servers.cpp similarity index 98% rename from cockatrice/src/server/handle_public_servers.cpp rename to cockatrice/src/interface/widgets/server/handle_public_servers.cpp index cc44ba262..2497ecdcc 100644 --- a/cockatrice/src/server/handle_public_servers.cpp +++ b/cockatrice/src/interface/widgets/server/handle_public_servers.cpp @@ -1,12 +1,11 @@ #include "handle_public_servers.h" -#include "../settings/cache_settings.h" - #include #include #include #include #include +#include #define PUBLIC_SERVERS_JSON "https://cockatrice.github.io/public-servers.json" diff --git a/cockatrice/src/server/handle_public_servers.h b/cockatrice/src/interface/widgets/server/handle_public_servers.h similarity index 100% rename from cockatrice/src/server/handle_public_servers.h rename to cockatrice/src/interface/widgets/server/handle_public_servers.h diff --git a/cockatrice/src/server/remote/remote_decklist_tree_widget.cpp b/cockatrice/src/interface/widgets/server/remote/remote_decklist_tree_widget.cpp similarity index 97% rename from cockatrice/src/server/remote/remote_decklist_tree_widget.cpp rename to cockatrice/src/interface/widgets/server/remote/remote_decklist_tree_widget.cpp index dfed741f9..6ca680c3f 100644 --- a/cockatrice/src/server/remote/remote_decklist_tree_widget.cpp +++ b/cockatrice/src/interface/widgets/server/remote/remote_decklist_tree_widget.cpp @@ -1,14 +1,13 @@ #include "remote_decklist_tree_widget.h" -#include "../abstract_client.h" -#include "../pending_command.h" -#include "pb/command_deck_list.pb.h" -#include "pb/response_deck_list.pb.h" -#include "pb/serverinfo_deckstorage.pb.h" - #include #include #include +#include +#include +#include +#include +#include RemoteDeckList_TreeModel::DirectoryNode::DirectoryNode(const QString &_name, RemoteDeckList_TreeModel::DirectoryNode *_parent) diff --git a/cockatrice/src/server/remote/remote_decklist_tree_widget.h b/cockatrice/src/interface/widgets/server/remote/remote_decklist_tree_widget.h similarity index 100% rename from cockatrice/src/server/remote/remote_decklist_tree_widget.h rename to cockatrice/src/interface/widgets/server/remote/remote_decklist_tree_widget.h diff --git a/cockatrice/src/server/remote/remote_replay_list_tree_widget.cpp b/cockatrice/src/interface/widgets/server/remote/remote_replay_list_tree_widget.cpp similarity index 97% rename from cockatrice/src/server/remote/remote_replay_list_tree_widget.cpp rename to cockatrice/src/interface/widgets/server/remote/remote_replay_list_tree_widget.cpp index 1fa72b20c..a5e8e46df 100644 --- a/cockatrice/src/server/remote/remote_replay_list_tree_widget.cpp +++ b/cockatrice/src/interface/widgets/server/remote/remote_replay_list_tree_widget.cpp @@ -1,14 +1,13 @@ #include "remote_replay_list_tree_widget.h" -#include "../abstract_client.h" -#include "../pending_command.h" -#include "pb/command_replay_list.pb.h" -#include "pb/response_replay_list.pb.h" -#include "pb/serverinfo_replay.pb.h" - #include #include #include +#include +#include +#include +#include +#include const int RemoteReplayList_TreeModel::numberOfColumns = 6; diff --git a/cockatrice/src/server/remote/remote_replay_list_tree_widget.h b/cockatrice/src/interface/widgets/server/remote/remote_replay_list_tree_widget.h similarity index 97% rename from cockatrice/src/server/remote/remote_replay_list_tree_widget.h rename to cockatrice/src/interface/widgets/server/remote/remote_replay_list_tree_widget.h index ccff71c47..d5d70af53 100644 --- a/cockatrice/src/server/remote/remote_replay_list_tree_widget.h +++ b/cockatrice/src/interface/widgets/server/remote/remote_replay_list_tree_widget.h @@ -9,12 +9,11 @@ #ifndef REMOTEREPLAYLIST_TREEWIDGET_H #define REMOTEREPLAYLIST_TREEWIDGET_H -#include "pb/serverinfo_replay.pb.h" -#include "pb/serverinfo_replay_match.pb.h" - #include #include #include +#include +#include class Response; class AbstractClient; diff --git a/cockatrice/src/server/user/user_context_menu.cpp b/cockatrice/src/interface/widgets/server/user/user_context_menu.cpp similarity index 96% rename from cockatrice/src/server/user/user_context_menu.cpp rename to cockatrice/src/interface/widgets/server/user/user_context_menu.cpp index c6782ef18..a255a38d5 100644 --- a/cockatrice/src/server/user/user_context_menu.cpp +++ b/cockatrice/src/interface/widgets/server/user/user_context_menu.cpp @@ -1,22 +1,10 @@ #include "user_context_menu.h" -#include "../../tabs/tab_account.h" -#include "../../tabs/tab_game.h" -#include "../../tabs/tab_supervisor.h" -#include "../abstract_client.h" +#include "../../interface/widgets/tabs/tab_account.h" +#include "../../interface/widgets/tabs/tab_game.h" +#include "../../interface/widgets/tabs/tab_supervisor.h" #include "../chat_view/chat_view.h" #include "../game_selector.h" -#include "../pending_command.h" -#include "pb/command_kick_from_game.pb.h" -#include "pb/commands.pb.h" -#include "pb/moderator_commands.pb.h" -#include "pb/response_ban_history.pb.h" -#include "pb/response_get_admin_notes.pb.h" -#include "pb/response_get_games_of_user.pb.h" -#include "pb/response_get_user_info.pb.h" -#include "pb/response_warn_history.pb.h" -#include "pb/response_warn_list.pb.h" -#include "pb/session_commands.pb.h" #include "user_info_box.h" #include "user_list_manager.h" #include "user_list_proxy.h" @@ -28,6 +16,18 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include UserContextMenu::UserContextMenu(TabSupervisor *_tabSupervisor, QWidget *parent, AbstractGame *_game) : QObject(parent), client(_tabSupervisor->getClient()), tabSupervisor(_tabSupervisor), diff --git a/cockatrice/src/server/user/user_context_menu.h b/cockatrice/src/interface/widgets/server/user/user_context_menu.h similarity index 97% rename from cockatrice/src/server/user/user_context_menu.h rename to cockatrice/src/interface/widgets/server/user/user_context_menu.h index d6f48f836..0056d74ae 100644 --- a/cockatrice/src/server/user/user_context_menu.h +++ b/cockatrice/src/interface/widgets/server/user/user_context_menu.h @@ -7,9 +7,8 @@ #ifndef USER_CONTEXT_MENU_H #define USER_CONTEXT_MENU_H -#include "user_level.h" - #include +#include class AbstractGame; class UserListProxy; diff --git a/cockatrice/src/server/user/user_info_box.cpp b/cockatrice/src/interface/widgets/server/user/user_info_box.cpp similarity index 95% rename from cockatrice/src/server/user/user_info_box.cpp rename to cockatrice/src/interface/widgets/server/user/user_info_box.cpp index cec0c38e8..9ae4a42c2 100644 --- a/cockatrice/src/server/user/user_info_box.cpp +++ b/cockatrice/src/interface/widgets/server/user/user_info_box.cpp @@ -1,16 +1,10 @@ #include "user_info_box.h" -#include "../../client/get_text_with_max.h" -#include "../../dialogs/dlg_edit_avatar.h" -#include "../../dialogs/dlg_edit_password.h" -#include "../../dialogs/dlg_edit_user.h" #include "../../interface/pixel_map_generator.h" -#include "../abstract_client.h" -#include "../pending_command.h" -#include "passwordhasher.h" -#include "pb/response_get_user_info.pb.h" -#include "pb/serverinfo_user.pb.h" -#include "pb/session_commands.pb.h" +#include "../../interface/widgets/dialogs/dlg_edit_avatar.h" +#include "../../interface/widgets/dialogs/dlg_edit_password.h" +#include "../../interface/widgets/dialogs/dlg_edit_user.h" +#include "../../interface/widgets/utility/get_text_with_max.h" #include #include @@ -18,6 +12,12 @@ #include #include #include +#include +#include +#include +#include +#include +#include UserInfoBox::UserInfoBox(AbstractClient *_client, bool _editable, QWidget *parent, Qt::WindowFlags flags) : QWidget(parent, flags), client(_client), editable(_editable) diff --git a/cockatrice/src/server/user/user_info_box.h b/cockatrice/src/interface/widgets/server/user/user_info_box.h similarity index 100% rename from cockatrice/src/server/user/user_info_box.h rename to cockatrice/src/interface/widgets/server/user/user_info_box.h diff --git a/cockatrice/src/server/user/user_info_connection.cpp b/cockatrice/src/interface/widgets/server/user/user_info_connection.cpp similarity index 98% rename from cockatrice/src/server/user/user_info_connection.cpp rename to cockatrice/src/interface/widgets/server/user/user_info_connection.cpp index 50ac129a8..813a9236c 100644 --- a/cockatrice/src/server/user/user_info_connection.cpp +++ b/cockatrice/src/interface/widgets/server/user/user_info_connection.cpp @@ -1,8 +1,7 @@ #include "user_info_connection.h" -#include "../../settings/cache_settings.h" - #include +#include #include UserConnection_Information::UserConnection_Information() = default; diff --git a/cockatrice/src/server/user/user_info_connection.h b/cockatrice/src/interface/widgets/server/user/user_info_connection.h similarity index 100% rename from cockatrice/src/server/user/user_info_connection.h rename to cockatrice/src/interface/widgets/server/user/user_info_connection.h diff --git a/cockatrice/src/server/user/user_list_manager.cpp b/cockatrice/src/interface/widgets/server/user/user_list_manager.cpp similarity index 91% rename from cockatrice/src/server/user/user_list_manager.cpp rename to cockatrice/src/interface/widgets/server/user/user_list_manager.cpp index c74706955..9b930b7f6 100644 --- a/cockatrice/src/server/user/user_list_manager.cpp +++ b/cockatrice/src/interface/widgets/server/user/user_list_manager.cpp @@ -1,16 +1,17 @@ #include "user_list_manager.h" #include "../../client/sound_engine.h" -#include "../abstract_client.h" -#include "../pending_command.h" -#include "pb/event_add_to_list.pb.h" -#include "pb/event_remove_from_list.pb.h" -#include "pb/event_user_joined.pb.h" -#include "pb/event_user_left.pb.h" -#include "pb/response_list_users.pb.h" -#include "pb/session_commands.pb.h" #include "user_info_box.h" +#include +#include +#include +#include +#include +#include +#include +#include + UserListManager::UserListManager(AbstractClient *_client, QObject *parent) : QObject(parent), client(_client), ownUserInfo(nullptr) { diff --git a/cockatrice/src/server/user/user_list_manager.h b/cockatrice/src/interface/widgets/server/user/user_list_manager.h similarity index 97% rename from cockatrice/src/server/user/user_list_manager.h rename to cockatrice/src/interface/widgets/server/user/user_list_manager.h index b02a43808..56f50c0be 100644 --- a/cockatrice/src/server/user/user_list_manager.h +++ b/cockatrice/src/interface/widgets/server/user/user_list_manager.h @@ -7,11 +7,11 @@ #ifndef COCKATRICE_USER_LIST_MANAGER_H #define COCKATRICE_USER_LIST_MANAGER_H -#include "pb/serverinfo_user.pb.h" #include "user_list_proxy.h" #include #include +#include class AbstractClient; class Event_AddToList; diff --git a/cockatrice/src/server/user/user_list_proxy.h b/cockatrice/src/interface/widgets/server/user/user_list_proxy.h similarity index 100% rename from cockatrice/src/server/user/user_list_proxy.h rename to cockatrice/src/interface/widgets/server/user/user_list_proxy.h diff --git a/cockatrice/src/server/user/user_list_widget.cpp b/cockatrice/src/interface/widgets/server/user/user_list_widget.cpp similarity index 97% rename from cockatrice/src/server/user/user_list_widget.cpp rename to cockatrice/src/interface/widgets/server/user/user_list_widget.cpp index d4dad5919..b6d65c5fa 100644 --- a/cockatrice/src/server/user/user_list_widget.cpp +++ b/cockatrice/src/interface/widgets/server/user/user_list_widget.cpp @@ -1,16 +1,9 @@ #include "user_list_widget.h" #include "../../interface/pixel_map_generator.h" -#include "../../tabs/tab_account.h" -#include "../../tabs/tab_supervisor.h" -#include "../abstract_client.h" +#include "../../interface/widgets/tabs/tab_account.h" +#include "../../interface/widgets/tabs/tab_supervisor.h" #include "../game_selector.h" -#include "../pending_command.h" -#include "pb/moderator_commands.pb.h" -#include "pb/response_get_games_of_user.pb.h" -#include "pb/response_get_user_info.pb.h" -#include "pb/session_commands.pb.h" -#include "trice_limits.h" #include "user_context_menu.h" #include "user_list_manager.h" @@ -30,6 +23,13 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include BanDialog::BanDialog(const ServerInfo_User &info, QWidget *parent) : QDialog(parent) { diff --git a/cockatrice/src/server/user/user_list_widget.h b/cockatrice/src/interface/widgets/server/user/user_list_widget.h similarity index 97% rename from cockatrice/src/server/user/user_list_widget.h rename to cockatrice/src/interface/widgets/server/user/user_list_widget.h index 8a1674549..897c01b83 100644 --- a/cockatrice/src/server/user/user_list_widget.h +++ b/cockatrice/src/interface/widgets/server/user/user_list_widget.h @@ -7,15 +7,14 @@ #ifndef USERLIST_H #define USERLIST_H -#include "pb/moderator_commands.pb.h" -#include "user_level.h" - #include #include #include #include #include #include +#include +#include class QTreeWidget; class ServerInfo_User; diff --git a/cockatrice/src/tabs/abstract_tab_deck_editor.cpp b/cockatrice/src/interface/widgets/tabs/abstract_tab_deck_editor.cpp similarity index 93% rename from cockatrice/src/tabs/abstract_tab_deck_editor.cpp rename to cockatrice/src/interface/widgets/tabs/abstract_tab_deck_editor.cpp index 3bd29b577..bee9edcb3 100644 --- a/cockatrice/src/tabs/abstract_tab_deck_editor.cpp +++ b/cockatrice/src/interface/widgets/tabs/abstract_tab_deck_editor.cpp @@ -1,22 +1,14 @@ #include "abstract_tab_deck_editor.h" -#include "../client/tapped_out_interface.h" -#include "../database/card_database_manager.h" -#include "../database/model/card_database_model.h" -#include "../deck/deck_stats_interface.h" -#include "../dialogs/dlg_load_deck.h" -#include "../dialogs/dlg_load_deck_from_clipboard.h" -#include "../dialogs/dlg_load_deck_from_website.h" +#include "../client/network/interfaces/deck_stats_interface.h" +#include "../client/network/interfaces/tapped_out_interface.h" +#include "../interface/card_picture_loader/card_picture_loader.h" #include "../interface/pixel_map_generator.h" #include "../interface/widgets/cards/card_info_frame_widget.h" -#include "../picture_loader/picture_loader.h" -#include "../server/abstract_client.h" -#include "../server/pending_command.h" -#include "../settings/cache_settings.h" -#include "pb/command_deck_upload.pb.h" -#include "pb/response.pb.h" +#include "../interface/widgets/dialogs/dlg_load_deck.h" +#include "../interface/widgets/dialogs/dlg_load_deck_from_clipboard.h" +#include "../interface/widgets/dialogs/dlg_load_deck_from_website.h" #include "tab_supervisor.h" -#include "trice_limits.h" #include #include @@ -39,6 +31,14 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include AbstractTabDeckEditor::AbstractTabDeckEditor(TabSupervisor *_tabSupervisor) : Tab(_tabSupervisor) { @@ -49,6 +49,9 @@ AbstractTabDeckEditor::AbstractTabDeckEditor(TabSupervisor *_tabSupervisor) : Ta cardInfoDockWidget = new DeckEditorCardInfoDockWidget(this); filterDockWidget = new DeckEditorFilterDockWidget(this); printingSelectorDockWidget = new DeckEditorPrintingSelectorDockWidget(this); + connect(&SettingsCache::instance(), &SettingsCache::overrideAllCardArtWithPersonalPreferenceChanged, this, [this] { + printingSelectorDockWidget->setHidden(SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference()); + }); connect(deckDockWidget, &DeckEditorDeckDockWidget::deckChanged, this, &AbstractTabDeckEditor::onDeckChanged); connect(deckDockWidget, &DeckEditorDeckDockWidget::deckModified, this, &AbstractTabDeckEditor::onDeckModified); @@ -161,7 +164,7 @@ void AbstractTabDeckEditor::openDeck(DeckLoader *deck) void AbstractTabDeckEditor::setDeck(DeckLoader *_deck) { deckDockWidget->setDeck(_deck); - PictureLoader::cacheCardPixmaps(CardDatabaseManager::query()->getCards(getDeckList()->getCardRefList())); + CardPictureLoader::cacheCardPixmaps(CardDatabaseManager::query()->getCards(getDeckList()->getCardRefList())); setModified(false); // If they load a deck, make the deck list appear diff --git a/cockatrice/src/tabs/abstract_tab_deck_editor.h b/cockatrice/src/interface/widgets/tabs/abstract_tab_deck_editor.h similarity index 98% rename from cockatrice/src/tabs/abstract_tab_deck_editor.h rename to cockatrice/src/interface/widgets/tabs/abstract_tab_deck_editor.h index e280d747f..bdf35b3da 100644 --- a/cockatrice/src/tabs/abstract_tab_deck_editor.h +++ b/cockatrice/src/interface/widgets/tabs/abstract_tab_deck_editor.h @@ -1,13 +1,12 @@ #ifndef TAB_GENERIC_DECK_EDITOR_H #define TAB_GENERIC_DECK_EDITOR_H -#include "../card/card_info.h" -#include "../client/deck_editor_menu.h" #include "../interface/widgets/deck_editor/deck_editor_card_info_dock_widget.h" #include "../interface/widgets/deck_editor/deck_editor_database_display_widget.h" #include "../interface/widgets/deck_editor/deck_editor_deck_dock_widget.h" #include "../interface/widgets/deck_editor/deck_editor_filter_dock_widget.h" #include "../interface/widgets/deck_editor/deck_editor_printing_selector_dock_widget.h" +#include "../interface/widgets/menus/deck_editor_menu.h" #include "../interface/widgets/visual_deck_storage/deck_preview/deck_preview_deck_tags_display_widget.h" #include "tab.h" @@ -24,6 +23,7 @@ class DeckEditorFilterDockWidget; class DeckEditorPrintingSelectorDockWidget; class DeckPreviewDeckTagsDisplayWidget; class Response; +class FilterTree; class FilterTreeModel; class FilterBuilder; diff --git a/cockatrice/src/tabs/api/edhrec/api_response/archidekt_links/edhrec_api_response_archidekt_links.cpp b/cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/archidekt_links/edhrec_api_response_archidekt_links.cpp similarity index 100% rename from cockatrice/src/tabs/api/edhrec/api_response/archidekt_links/edhrec_api_response_archidekt_links.cpp rename to cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/archidekt_links/edhrec_api_response_archidekt_links.cpp diff --git a/cockatrice/src/tabs/api/edhrec/api_response/archidekt_links/edhrec_api_response_archidekt_links.h b/cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/archidekt_links/edhrec_api_response_archidekt_links.h similarity index 100% rename from cockatrice/src/tabs/api/edhrec/api_response/archidekt_links/edhrec_api_response_archidekt_links.h rename to cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/archidekt_links/edhrec_api_response_archidekt_links.h diff --git a/cockatrice/src/tabs/api/edhrec/api_response/average_deck/edhrec_average_deck_api_response.cpp b/cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/average_deck/edhrec_average_deck_api_response.cpp similarity index 100% rename from cockatrice/src/tabs/api/edhrec/api_response/average_deck/edhrec_average_deck_api_response.cpp rename to cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/average_deck/edhrec_average_deck_api_response.cpp diff --git a/cockatrice/src/tabs/api/edhrec/api_response/average_deck/edhrec_average_deck_api_response.h b/cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/average_deck/edhrec_average_deck_api_response.h similarity index 100% rename from cockatrice/src/tabs/api/edhrec/api_response/average_deck/edhrec_average_deck_api_response.h rename to cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/average_deck/edhrec_average_deck_api_response.h diff --git a/cockatrice/src/tabs/api/edhrec/api_response/average_deck/edhrec_deck_api_response.cpp b/cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/average_deck/edhrec_deck_api_response.cpp similarity index 91% rename from cockatrice/src/tabs/api/edhrec/api_response/average_deck/edhrec_deck_api_response.cpp rename to cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/average_deck/edhrec_deck_api_response.cpp index c25f4e5aa..0f1003a14 100644 --- a/cockatrice/src/tabs/api/edhrec/api_response/average_deck/edhrec_deck_api_response.cpp +++ b/cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/average_deck/edhrec_deck_api_response.cpp @@ -1,12 +1,11 @@ #include "edhrec_deck_api_response.h" -#include "../../../../../deck/deck_loader.h" - #include #include #include #include #include +#include void EdhrecDeckApiResponse::fromJson(const QJsonArray &json) { diff --git a/cockatrice/src/tabs/api/edhrec/api_response/average_deck/edhrec_deck_api_response.h b/cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/average_deck/edhrec_deck_api_response.h similarity index 92% rename from cockatrice/src/tabs/api/edhrec/api_response/average_deck/edhrec_deck_api_response.h rename to cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/average_deck/edhrec_deck_api_response.h index 952162a4e..9aa8ff821 100644 --- a/cockatrice/src/tabs/api/edhrec/api_response/average_deck/edhrec_deck_api_response.h +++ b/cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/average_deck/edhrec_deck_api_response.h @@ -7,13 +7,12 @@ #ifndef EDHREC_DECK_API_RESPONSE_H #define EDHREC_DECK_API_RESPONSE_H -#include "../../../../../deck/deck_loader.h" - #include #include #include #include #include +#include class EdhrecDeckApiResponse { diff --git a/cockatrice/src/tabs/api/edhrec/api_response/card_prices/edhrec_api_response_card_prices.cpp b/cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/card_prices/edhrec_api_response_card_prices.cpp similarity index 100% rename from cockatrice/src/tabs/api/edhrec/api_response/card_prices/edhrec_api_response_card_prices.cpp rename to cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/card_prices/edhrec_api_response_card_prices.cpp diff --git a/cockatrice/src/tabs/api/edhrec/api_response/card_prices/edhrec_api_response_card_prices.h b/cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/card_prices/edhrec_api_response_card_prices.h similarity index 100% rename from cockatrice/src/tabs/api/edhrec/api_response/card_prices/edhrec_api_response_card_prices.h rename to cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/card_prices/edhrec_api_response_card_prices.h diff --git a/cockatrice/src/tabs/api/edhrec/api_response/cards/edhrec_api_response_card_container.cpp b/cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/cards/edhrec_api_response_card_container.cpp similarity index 100% rename from cockatrice/src/tabs/api/edhrec/api_response/cards/edhrec_api_response_card_container.cpp rename to cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/cards/edhrec_api_response_card_container.cpp diff --git a/cockatrice/src/tabs/api/edhrec/api_response/cards/edhrec_api_response_card_container.h b/cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/cards/edhrec_api_response_card_container.h similarity index 100% rename from cockatrice/src/tabs/api/edhrec/api_response/cards/edhrec_api_response_card_container.h rename to cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/cards/edhrec_api_response_card_container.h diff --git a/cockatrice/src/tabs/api/edhrec/api_response/cards/edhrec_api_response_card_details.cpp b/cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/cards/edhrec_api_response_card_details.cpp similarity index 100% rename from cockatrice/src/tabs/api/edhrec/api_response/cards/edhrec_api_response_card_details.cpp rename to cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/cards/edhrec_api_response_card_details.cpp diff --git a/cockatrice/src/tabs/api/edhrec/api_response/cards/edhrec_api_response_card_details.h b/cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/cards/edhrec_api_response_card_details.h similarity index 100% rename from cockatrice/src/tabs/api/edhrec/api_response/cards/edhrec_api_response_card_details.h rename to cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/cards/edhrec_api_response_card_details.h diff --git a/cockatrice/src/tabs/api/edhrec/api_response/cards/edhrec_api_response_card_list.cpp b/cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/cards/edhrec_api_response_card_list.cpp similarity index 100% rename from cockatrice/src/tabs/api/edhrec/api_response/cards/edhrec_api_response_card_list.cpp rename to cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/cards/edhrec_api_response_card_list.cpp diff --git a/cockatrice/src/tabs/api/edhrec/api_response/cards/edhrec_api_response_card_list.h b/cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/cards/edhrec_api_response_card_list.h similarity index 100% rename from cockatrice/src/tabs/api/edhrec/api_response/cards/edhrec_api_response_card_list.h rename to cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/cards/edhrec_api_response_card_list.h diff --git a/cockatrice/src/tabs/api/edhrec/api_response/cards/edhrec_commander_api_response_commander_details.cpp b/cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/cards/edhrec_commander_api_response_commander_details.cpp similarity index 100% rename from cockatrice/src/tabs/api/edhrec/api_response/cards/edhrec_commander_api_response_commander_details.cpp rename to cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/cards/edhrec_commander_api_response_commander_details.cpp diff --git a/cockatrice/src/tabs/api/edhrec/api_response/cards/edhrec_commander_api_response_commander_details.h b/cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/cards/edhrec_commander_api_response_commander_details.h similarity index 100% rename from cockatrice/src/tabs/api/edhrec/api_response/cards/edhrec_commander_api_response_commander_details.h rename to cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/cards/edhrec_commander_api_response_commander_details.h diff --git a/cockatrice/src/tabs/api/edhrec/api_response/commander/edhrec_commander_api_response.cpp b/cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/commander/edhrec_commander_api_response.cpp similarity index 100% rename from cockatrice/src/tabs/api/edhrec/api_response/commander/edhrec_commander_api_response.cpp rename to cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/commander/edhrec_commander_api_response.cpp diff --git a/cockatrice/src/tabs/api/edhrec/api_response/commander/edhrec_commander_api_response.h b/cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/commander/edhrec_commander_api_response.h similarity index 100% rename from cockatrice/src/tabs/api/edhrec/api_response/commander/edhrec_commander_api_response.h rename to cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/commander/edhrec_commander_api_response.h diff --git a/cockatrice/src/tabs/api/edhrec/api_response/commander/edhrec_commander_api_response_average_deck_statistics.cpp b/cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/commander/edhrec_commander_api_response_average_deck_statistics.cpp similarity index 100% rename from cockatrice/src/tabs/api/edhrec/api_response/commander/edhrec_commander_api_response_average_deck_statistics.cpp rename to cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/commander/edhrec_commander_api_response_average_deck_statistics.cpp diff --git a/cockatrice/src/tabs/api/edhrec/api_response/commander/edhrec_commander_api_response_average_deck_statistics.h b/cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/commander/edhrec_commander_api_response_average_deck_statistics.h similarity index 100% rename from cockatrice/src/tabs/api/edhrec/api_response/commander/edhrec_commander_api_response_average_deck_statistics.h rename to cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/commander/edhrec_commander_api_response_average_deck_statistics.h diff --git a/cockatrice/src/tabs/api/edhrec/api_response/top_cards/edhrec_top_cards_api_response.cpp b/cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/top_cards/edhrec_top_cards_api_response.cpp similarity index 100% rename from cockatrice/src/tabs/api/edhrec/api_response/top_cards/edhrec_top_cards_api_response.cpp rename to cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/top_cards/edhrec_top_cards_api_response.cpp diff --git a/cockatrice/src/tabs/api/edhrec/api_response/top_cards/edhrec_top_cards_api_response.h b/cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/top_cards/edhrec_top_cards_api_response.h similarity index 100% rename from cockatrice/src/tabs/api/edhrec/api_response/top_cards/edhrec_top_cards_api_response.h rename to cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/top_cards/edhrec_top_cards_api_response.h diff --git a/cockatrice/src/tabs/api/edhrec/api_response/top_commanders/edhrec_top_commanders_api_response.cpp b/cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/top_commanders/edhrec_top_commanders_api_response.cpp similarity index 100% rename from cockatrice/src/tabs/api/edhrec/api_response/top_commanders/edhrec_top_commanders_api_response.cpp rename to cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/top_commanders/edhrec_top_commanders_api_response.cpp diff --git a/cockatrice/src/tabs/api/edhrec/api_response/top_commanders/edhrec_top_commanders_api_response.h b/cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/top_commanders/edhrec_top_commanders_api_response.h similarity index 100% rename from cockatrice/src/tabs/api/edhrec/api_response/top_commanders/edhrec_top_commanders_api_response.h rename to cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/top_commanders/edhrec_top_commanders_api_response.h diff --git a/cockatrice/src/tabs/api/edhrec/api_response/top_tags/edhrec_top_tags_api_response.cpp b/cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/top_tags/edhrec_top_tags_api_response.cpp similarity index 100% rename from cockatrice/src/tabs/api/edhrec/api_response/top_tags/edhrec_top_tags_api_response.cpp rename to cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/top_tags/edhrec_top_tags_api_response.cpp diff --git a/cockatrice/src/tabs/api/edhrec/api_response/top_tags/edhrec_top_tags_api_response.h b/cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/top_tags/edhrec_top_tags_api_response.h similarity index 100% rename from cockatrice/src/tabs/api/edhrec/api_response/top_tags/edhrec_top_tags_api_response.h rename to cockatrice/src/interface/widgets/tabs/api/edhrec/api_response/top_tags/edhrec_top_tags_api_response.h diff --git a/cockatrice/src/tabs/api/edhrec/display/card_prices/edhrec_api_response_card_prices_display_widget.cpp b/cockatrice/src/interface/widgets/tabs/api/edhrec/display/card_prices/edhrec_api_response_card_prices_display_widget.cpp similarity index 100% rename from cockatrice/src/tabs/api/edhrec/display/card_prices/edhrec_api_response_card_prices_display_widget.cpp rename to cockatrice/src/interface/widgets/tabs/api/edhrec/display/card_prices/edhrec_api_response_card_prices_display_widget.cpp diff --git a/cockatrice/src/tabs/api/edhrec/display/card_prices/edhrec_api_response_card_prices_display_widget.h b/cockatrice/src/interface/widgets/tabs/api/edhrec/display/card_prices/edhrec_api_response_card_prices_display_widget.h similarity index 100% rename from cockatrice/src/tabs/api/edhrec/display/card_prices/edhrec_api_response_card_prices_display_widget.h rename to cockatrice/src/interface/widgets/tabs/api/edhrec/display/card_prices/edhrec_api_response_card_prices_display_widget.h diff --git a/cockatrice/src/tabs/api/edhrec/display/cards/edhrec_api_response_card_details_display_widget.cpp b/cockatrice/src/interface/widgets/tabs/api/edhrec/display/cards/edhrec_api_response_card_details_display_widget.cpp similarity index 96% rename from cockatrice/src/tabs/api/edhrec/display/cards/edhrec_api_response_card_details_display_widget.cpp rename to cockatrice/src/interface/widgets/tabs/api/edhrec/display/cards/edhrec_api_response_card_details_display_widget.cpp index cde18053b..108694d8d 100644 --- a/cockatrice/src/tabs/api/edhrec/display/cards/edhrec_api_response_card_details_display_widget.cpp +++ b/cockatrice/src/interface/widgets/tabs/api/edhrec/display/cards/edhrec_api_response_card_details_display_widget.cpp @@ -1,8 +1,9 @@ #include "edhrec_api_response_card_details_display_widget.h" -#include "../../../../../database/card_database_manager.h" #include "../../tab_edhrec_main.h" +#include + EdhrecApiResponseCardDetailsDisplayWidget::EdhrecApiResponseCardDetailsDisplayWidget( QWidget *parent, const EdhrecApiResponseCardDetails &_toDisplay) diff --git a/cockatrice/src/tabs/api/edhrec/display/cards/edhrec_api_response_card_details_display_widget.h b/cockatrice/src/interface/widgets/tabs/api/edhrec/display/cards/edhrec_api_response_card_details_display_widget.h similarity index 93% rename from cockatrice/src/tabs/api/edhrec/display/cards/edhrec_api_response_card_details_display_widget.h rename to cockatrice/src/interface/widgets/tabs/api/edhrec/display/cards/edhrec_api_response_card_details_display_widget.h index ae0777613..548cdc0af 100644 --- a/cockatrice/src/tabs/api/edhrec/display/cards/edhrec_api_response_card_details_display_widget.h +++ b/cockatrice/src/interface/widgets/tabs/api/edhrec/display/cards/edhrec_api_response_card_details_display_widget.h @@ -7,7 +7,7 @@ #ifndef EDHREC_COMMANDER_API_RESPONSE_CARD_DETAILS_DISPLAY_WIDGET_H #define EDHREC_COMMANDER_API_RESPONSE_CARD_DETAILS_DISPLAY_WIDGET_H -#include "../../../../../interface/widgets/cards/card_info_picture_widget.h" +#include "../../../../../cards/card_info_picture_widget.h" #include "../../api_response/cards/edhrec_api_response_card_details.h" #include "edhrec_api_response_card_inclusion_display_widget.h" #include "edhrec_api_response_card_synergy_display_widget.h" diff --git a/cockatrice/src/tabs/api/edhrec/display/cards/edhrec_api_response_card_inclusion_display_widget.cpp b/cockatrice/src/interface/widgets/tabs/api/edhrec/display/cards/edhrec_api_response_card_inclusion_display_widget.cpp similarity index 100% rename from cockatrice/src/tabs/api/edhrec/display/cards/edhrec_api_response_card_inclusion_display_widget.cpp rename to cockatrice/src/interface/widgets/tabs/api/edhrec/display/cards/edhrec_api_response_card_inclusion_display_widget.cpp diff --git a/cockatrice/src/tabs/api/edhrec/display/cards/edhrec_api_response_card_inclusion_display_widget.h b/cockatrice/src/interface/widgets/tabs/api/edhrec/display/cards/edhrec_api_response_card_inclusion_display_widget.h similarity index 91% rename from cockatrice/src/tabs/api/edhrec/display/cards/edhrec_api_response_card_inclusion_display_widget.h rename to cockatrice/src/interface/widgets/tabs/api/edhrec/display/cards/edhrec_api_response_card_inclusion_display_widget.h index cc5039c53..0174016f7 100644 --- a/cockatrice/src/tabs/api/edhrec/display/cards/edhrec_api_response_card_inclusion_display_widget.h +++ b/cockatrice/src/interface/widgets/tabs/api/edhrec/display/cards/edhrec_api_response_card_inclusion_display_widget.h @@ -7,7 +7,7 @@ #ifndef EDHREC_API_RESPONSE_CARD_INCLUSION_DISPLAY_WIDGET_H #define EDHREC_API_RESPONSE_CARD_INCLUSION_DISPLAY_WIDGET_H -#include "../../../../../interface/widgets/general/display/percent_bar_widget.h" +#include "../../../../../general/display/percent_bar_widget.h" #include "../../api_response/cards/edhrec_api_response_card_details.h" #include diff --git a/cockatrice/src/tabs/api/edhrec/display/cards/edhrec_api_response_card_list_display_widget.cpp b/cockatrice/src/interface/widgets/tabs/api/edhrec/display/cards/edhrec_api_response_card_list_display_widget.cpp similarity index 93% rename from cockatrice/src/tabs/api/edhrec/display/cards/edhrec_api_response_card_list_display_widget.cpp rename to cockatrice/src/interface/widgets/tabs/api/edhrec/display/cards/edhrec_api_response_card_list_display_widget.cpp index 67372fd37..841ef315b 100644 --- a/cockatrice/src/tabs/api/edhrec/display/cards/edhrec_api_response_card_list_display_widget.cpp +++ b/cockatrice/src/interface/widgets/tabs/api/edhrec/display/cards/edhrec_api_response_card_list_display_widget.cpp @@ -1,6 +1,6 @@ #include "edhrec_api_response_card_list_display_widget.h" -#include "../../../../../interface/widgets/general/display/banner_widget.h" +#include "../../../../../general/display/banner_widget.h" #include "edhrec_api_response_card_details_display_widget.h" #include diff --git a/cockatrice/src/tabs/api/edhrec/display/cards/edhrec_api_response_card_list_display_widget.h b/cockatrice/src/interface/widgets/tabs/api/edhrec/display/cards/edhrec_api_response_card_list_display_widget.h similarity index 84% rename from cockatrice/src/tabs/api/edhrec/display/cards/edhrec_api_response_card_list_display_widget.h rename to cockatrice/src/interface/widgets/tabs/api/edhrec/display/cards/edhrec_api_response_card_list_display_widget.h index bb278013f..0ebb9b927 100644 --- a/cockatrice/src/tabs/api/edhrec/display/cards/edhrec_api_response_card_list_display_widget.h +++ b/cockatrice/src/interface/widgets/tabs/api/edhrec/display/cards/edhrec_api_response_card_list_display_widget.h @@ -7,8 +7,8 @@ #ifndef EDHREC_COMMANDER_API_RESPONSE_CARD_LIST_DISPLAY_WIDGET_H #define EDHREC_COMMANDER_API_RESPONSE_CARD_LIST_DISPLAY_WIDGET_H -#include "../../../../../interface/widgets/general/display/banner_widget.h" -#include "../../../../../interface/widgets/general/layout_containers/flow_widget.h" +#include "../../../../../general/display/banner_widget.h" +#include "../../../../../general/layout_containers/flow_widget.h" #include "../../api_response/cards/edhrec_api_response_card_list.h" #include diff --git a/cockatrice/src/tabs/api/edhrec/display/cards/edhrec_api_response_card_synergy_display_widget.cpp b/cockatrice/src/interface/widgets/tabs/api/edhrec/display/cards/edhrec_api_response_card_synergy_display_widget.cpp similarity index 100% rename from cockatrice/src/tabs/api/edhrec/display/cards/edhrec_api_response_card_synergy_display_widget.cpp rename to cockatrice/src/interface/widgets/tabs/api/edhrec/display/cards/edhrec_api_response_card_synergy_display_widget.cpp diff --git a/cockatrice/src/tabs/api/edhrec/display/cards/edhrec_api_response_card_synergy_display_widget.h b/cockatrice/src/interface/widgets/tabs/api/edhrec/display/cards/edhrec_api_response_card_synergy_display_widget.h similarity index 90% rename from cockatrice/src/tabs/api/edhrec/display/cards/edhrec_api_response_card_synergy_display_widget.h rename to cockatrice/src/interface/widgets/tabs/api/edhrec/display/cards/edhrec_api_response_card_synergy_display_widget.h index e6a8c02fe..39d26a409 100644 --- a/cockatrice/src/tabs/api/edhrec/display/cards/edhrec_api_response_card_synergy_display_widget.h +++ b/cockatrice/src/interface/widgets/tabs/api/edhrec/display/cards/edhrec_api_response_card_synergy_display_widget.h @@ -7,7 +7,7 @@ #ifndef EDHREC_API_RESPONSE_CARD_SYNERGY_DISPLAY_WIDGET_H #define EDHREC_API_RESPONSE_CARD_SYNERGY_DISPLAY_WIDGET_H -#include "../../../../../interface/widgets/general/display/percent_bar_widget.h" +#include "../../../../../general/display/percent_bar_widget.h" #include "../../api_response/cards/edhrec_api_response_card_details.h" #include diff --git a/cockatrice/src/tabs/api/edhrec/display/commander/edhrec_api_response_commander_details_display_widget.cpp b/cockatrice/src/interface/widgets/tabs/api/edhrec/display/commander/edhrec_api_response_commander_details_display_widget.cpp similarity index 93% rename from cockatrice/src/tabs/api/edhrec/display/commander/edhrec_api_response_commander_details_display_widget.cpp rename to cockatrice/src/interface/widgets/tabs/api/edhrec/display/commander/edhrec_api_response_commander_details_display_widget.cpp index bf7444b5e..b15d559f5 100644 --- a/cockatrice/src/tabs/api/edhrec/display/commander/edhrec_api_response_commander_details_display_widget.cpp +++ b/cockatrice/src/interface/widgets/tabs/api/edhrec/display/commander/edhrec_api_response_commander_details_display_widget.cpp @@ -1,10 +1,11 @@ #include "edhrec_api_response_commander_details_display_widget.h" -#include "../../../../../database/card_database_manager.h" -#include "../../../../../interface/widgets/cards/card_info_picture_widget.h" +#include "../../../../../cards/card_info_picture_widget.h" #include "../../tab_edhrec_main.h" #include "../card_prices/edhrec_api_response_card_prices_display_widget.h" +#include + EdhrecCommanderResponseCommanderDetailsDisplayWidget::EdhrecCommanderResponseCommanderDetailsDisplayWidget( QWidget *parent, const EdhrecCommanderApiResponseCommanderDetails &_commanderDetails, diff --git a/cockatrice/src/tabs/api/edhrec/display/commander/edhrec_api_response_commander_details_display_widget.h b/cockatrice/src/interface/widgets/tabs/api/edhrec/display/commander/edhrec_api_response_commander_details_display_widget.h similarity index 94% rename from cockatrice/src/tabs/api/edhrec/display/commander/edhrec_api_response_commander_details_display_widget.h rename to cockatrice/src/interface/widgets/tabs/api/edhrec/display/commander/edhrec_api_response_commander_details_display_widget.h index 3ab433a41..295e4228b 100644 --- a/cockatrice/src/tabs/api/edhrec/display/commander/edhrec_api_response_commander_details_display_widget.h +++ b/cockatrice/src/interface/widgets/tabs/api/edhrec/display/commander/edhrec_api_response_commander_details_display_widget.h @@ -7,7 +7,7 @@ #ifndef EDHREC_COMMANDER_API_RESPONSE_COMMANDER_DETAILS_DISPLAY_WIDGET_H #define EDHREC_COMMANDER_API_RESPONSE_COMMANDER_DETAILS_DISPLAY_WIDGET_H -#include "../../../../../interface/widgets/cards/card_info_picture_widget.h" +#include "../../../../../cards/card_info_picture_widget.h" #include "../../api_response/cards/edhrec_commander_api_response_commander_details.h" #include "../card_prices/edhrec_api_response_card_prices_display_widget.h" #include "edhrec_commander_api_response_navigation_widget.h" diff --git a/cockatrice/src/tabs/api/edhrec/display/commander/edhrec_commander_api_response_display_widget.cpp b/cockatrice/src/interface/widgets/tabs/api/edhrec/display/commander/edhrec_commander_api_response_display_widget.cpp similarity index 98% rename from cockatrice/src/tabs/api/edhrec/display/commander/edhrec_commander_api_response_display_widget.cpp rename to cockatrice/src/interface/widgets/tabs/api/edhrec/display/commander/edhrec_commander_api_response_display_widget.cpp index 722a8004c..230858d6c 100644 --- a/cockatrice/src/tabs/api/edhrec/display/commander/edhrec_commander_api_response_display_widget.cpp +++ b/cockatrice/src/interface/widgets/tabs/api/edhrec/display/commander/edhrec_commander_api_response_display_widget.cpp @@ -1,6 +1,6 @@ #include "edhrec_commander_api_response_display_widget.h" -#include "../../../../../interface/widgets/cards/card_info_picture_widget.h" +#include "../../../../../cards/card_info_picture_widget.h" #include "../../api_response/commander/edhrec_commander_api_response.h" #include "../cards/edhrec_api_response_card_list_display_widget.h" #include "edhrec_api_response_commander_details_display_widget.h" diff --git a/cockatrice/src/tabs/api/edhrec/display/commander/edhrec_commander_api_response_display_widget.h b/cockatrice/src/interface/widgets/tabs/api/edhrec/display/commander/edhrec_commander_api_response_display_widget.h similarity index 100% rename from cockatrice/src/tabs/api/edhrec/display/commander/edhrec_commander_api_response_display_widget.h rename to cockatrice/src/interface/widgets/tabs/api/edhrec/display/commander/edhrec_commander_api_response_display_widget.h diff --git a/cockatrice/src/tabs/api/edhrec/display/commander/edhrec_commander_api_response_navigation_widget.cpp b/cockatrice/src/interface/widgets/tabs/api/edhrec/display/commander/edhrec_commander_api_response_navigation_widget.cpp similarity index 100% rename from cockatrice/src/tabs/api/edhrec/display/commander/edhrec_commander_api_response_navigation_widget.cpp rename to cockatrice/src/interface/widgets/tabs/api/edhrec/display/commander/edhrec_commander_api_response_navigation_widget.cpp diff --git a/cockatrice/src/tabs/api/edhrec/display/commander/edhrec_commander_api_response_navigation_widget.h b/cockatrice/src/interface/widgets/tabs/api/edhrec/display/commander/edhrec_commander_api_response_navigation_widget.h similarity index 100% rename from cockatrice/src/tabs/api/edhrec/display/commander/edhrec_commander_api_response_navigation_widget.h rename to cockatrice/src/interface/widgets/tabs/api/edhrec/display/commander/edhrec_commander_api_response_navigation_widget.h diff --git a/cockatrice/src/tabs/api/edhrec/display/top_cards/edhrec_top_cards_api_response_display_widget.cpp b/cockatrice/src/interface/widgets/tabs/api/edhrec/display/top_cards/edhrec_top_cards_api_response_display_widget.cpp similarity index 100% rename from cockatrice/src/tabs/api/edhrec/display/top_cards/edhrec_top_cards_api_response_display_widget.cpp rename to cockatrice/src/interface/widgets/tabs/api/edhrec/display/top_cards/edhrec_top_cards_api_response_display_widget.cpp diff --git a/cockatrice/src/tabs/api/edhrec/display/top_cards/edhrec_top_cards_api_response_display_widget.h b/cockatrice/src/interface/widgets/tabs/api/edhrec/display/top_cards/edhrec_top_cards_api_response_display_widget.h similarity index 100% rename from cockatrice/src/tabs/api/edhrec/display/top_cards/edhrec_top_cards_api_response_display_widget.h rename to cockatrice/src/interface/widgets/tabs/api/edhrec/display/top_cards/edhrec_top_cards_api_response_display_widget.h diff --git a/cockatrice/src/tabs/api/edhrec/display/top_commander/edhrec_top_commanders_api_response_display_widget.cpp b/cockatrice/src/interface/widgets/tabs/api/edhrec/display/top_commander/edhrec_top_commanders_api_response_display_widget.cpp similarity index 100% rename from cockatrice/src/tabs/api/edhrec/display/top_commander/edhrec_top_commanders_api_response_display_widget.cpp rename to cockatrice/src/interface/widgets/tabs/api/edhrec/display/top_commander/edhrec_top_commanders_api_response_display_widget.cpp diff --git a/cockatrice/src/tabs/api/edhrec/display/top_commander/edhrec_top_commanders_api_response_display_widget.h b/cockatrice/src/interface/widgets/tabs/api/edhrec/display/top_commander/edhrec_top_commanders_api_response_display_widget.h similarity index 100% rename from cockatrice/src/tabs/api/edhrec/display/top_commander/edhrec_top_commanders_api_response_display_widget.h rename to cockatrice/src/interface/widgets/tabs/api/edhrec/display/top_commander/edhrec_top_commanders_api_response_display_widget.h diff --git a/cockatrice/src/tabs/api/edhrec/display/top_tags/edhrec_top_tags_api_response_display_widget.cpp b/cockatrice/src/interface/widgets/tabs/api/edhrec/display/top_tags/edhrec_top_tags_api_response_display_widget.cpp similarity index 100% rename from cockatrice/src/tabs/api/edhrec/display/top_tags/edhrec_top_tags_api_response_display_widget.cpp rename to cockatrice/src/interface/widgets/tabs/api/edhrec/display/top_tags/edhrec_top_tags_api_response_display_widget.cpp diff --git a/cockatrice/src/tabs/api/edhrec/display/top_tags/edhrec_top_tags_api_response_display_widget.h b/cockatrice/src/interface/widgets/tabs/api/edhrec/display/top_tags/edhrec_top_tags_api_response_display_widget.h similarity index 100% rename from cockatrice/src/tabs/api/edhrec/display/top_tags/edhrec_top_tags_api_response_display_widget.h rename to cockatrice/src/interface/widgets/tabs/api/edhrec/display/top_tags/edhrec_top_tags_api_response_display_widget.h diff --git a/cockatrice/src/tabs/api/edhrec/tab_edhrec.cpp b/cockatrice/src/interface/widgets/tabs/api/edhrec/tab_edhrec.cpp similarity index 100% rename from cockatrice/src/tabs/api/edhrec/tab_edhrec.cpp rename to cockatrice/src/interface/widgets/tabs/api/edhrec/tab_edhrec.cpp diff --git a/cockatrice/src/tabs/api/edhrec/tab_edhrec.h b/cockatrice/src/interface/widgets/tabs/api/edhrec/tab_edhrec.h similarity index 89% rename from cockatrice/src/tabs/api/edhrec/tab_edhrec.h rename to cockatrice/src/interface/widgets/tabs/api/edhrec/tab_edhrec.h index ac3d7ea11..b6030578c 100644 --- a/cockatrice/src/tabs/api/edhrec/tab_edhrec.h +++ b/cockatrice/src/interface/widgets/tabs/api/edhrec/tab_edhrec.h @@ -7,12 +7,11 @@ #ifndef TAB_EDHREC_H #define TAB_EDHREC_H -#include "../../../card/card_info.h" -#include "../../../interface/widgets/general/layout_containers/flow_widget.h" #include "../../tab.h" #include "display/commander/edhrec_commander_api_response_display_widget.h" #include +#include class TabEdhRec : public Tab { diff --git a/cockatrice/src/tabs/api/edhrec/tab_edhrec_main.cpp b/cockatrice/src/interface/widgets/tabs/api/edhrec/tab_edhrec_main.cpp similarity index 98% rename from cockatrice/src/tabs/api/edhrec/tab_edhrec_main.cpp rename to cockatrice/src/interface/widgets/tabs/api/edhrec/tab_edhrec_main.cpp index 36089886a..97da51cc8 100644 --- a/cockatrice/src/tabs/api/edhrec/tab_edhrec_main.cpp +++ b/cockatrice/src/interface/widgets/tabs/api/edhrec/tab_edhrec_main.cpp @@ -1,8 +1,5 @@ #include "tab_edhrec_main.h" -#include "../../../database/card_database_manager.h" -#include "../../../database/model/card/card_completer_proxy_model.h" -#include "../../../database/model/card/card_search_model.h" #include "../../tab_supervisor.h" #include "api_response/average_deck/edhrec_average_deck_api_response.h" #include "api_response/commander/edhrec_commander_api_response.h" @@ -25,6 +22,9 @@ #include #include #include +#include +#include +#include static bool canBeCommander(const CardInfoPtr &cardInfo) { diff --git a/cockatrice/src/tabs/api/edhrec/tab_edhrec_main.h b/cockatrice/src/interface/widgets/tabs/api/edhrec/tab_edhrec_main.h similarity index 88% rename from cockatrice/src/tabs/api/edhrec/tab_edhrec_main.h rename to cockatrice/src/interface/widgets/tabs/api/edhrec/tab_edhrec_main.h index d9b96ac76..2cca18504 100644 --- a/cockatrice/src/tabs/api/edhrec/tab_edhrec_main.h +++ b/cockatrice/src/interface/widgets/tabs/api/edhrec/tab_edhrec_main.h @@ -7,10 +7,9 @@ #ifndef TAB_EDHREC_MAIN_H #define TAB_EDHREC_MAIN_H -#include "../../../database/card_database.h" -#include "../../../interface/widgets/cards/card_size_widget.h" -#include "../../../interface/widgets/general/layout_containers/flow_widget.h" -#include "../../../interface/widgets/quick_settings/settings_button_widget.h" +#include "../../interface/widgets/cards/card_size_widget.h" +#include "../../interface/widgets/general/layout_containers/flow_widget.h" +#include "../../interface/widgets/quick_settings/settings_button_widget.h" #include "../../tab.h" #include "display/commander/edhrec_commander_api_response_display_widget.h" @@ -18,6 +17,7 @@ #include #include #include +#include class TabEdhRecMain : public Tab { diff --git a/cockatrice/src/tabs/tab.cpp b/cockatrice/src/interface/widgets/tabs/tab.cpp similarity index 100% rename from cockatrice/src/tabs/tab.cpp rename to cockatrice/src/interface/widgets/tabs/tab.cpp diff --git a/cockatrice/src/tabs/tab.h b/cockatrice/src/interface/widgets/tabs/tab.h similarity index 97% rename from cockatrice/src/tabs/tab.h rename to cockatrice/src/interface/widgets/tabs/tab.h index a431aac75..56a9f0b7e 100644 --- a/cockatrice/src/tabs/tab.h +++ b/cockatrice/src/interface/widgets/tabs/tab.h @@ -7,9 +7,8 @@ #ifndef TAB_H #define TAB_H -#include "card_ref.h" - #include +#include class QMenu; class TabSupervisor; diff --git a/cockatrice/src/tabs/tab_account.cpp b/cockatrice/src/interface/widgets/tabs/tab_account.cpp similarity index 90% rename from cockatrice/src/tabs/tab_account.cpp rename to cockatrice/src/interface/widgets/tabs/tab_account.cpp index ba82857fe..e61732f90 100644 --- a/cockatrice/src/tabs/tab_account.cpp +++ b/cockatrice/src/interface/widgets/tabs/tab_account.cpp @@ -1,23 +1,23 @@ #include "tab_account.h" #include "../client/sound_engine.h" -#include "../deck/custom_line_edit.h" -#include "../server/abstract_client.h" -#include "../server/pending_command.h" -#include "../server/user/user_info_box.h" -#include "../server/user/user_list_manager.h" -#include "../server/user/user_list_widget.h" -#include "pb/event_add_to_list.pb.h" -#include "pb/event_remove_from_list.pb.h" -#include "pb/event_user_joined.pb.h" -#include "pb/event_user_left.pb.h" -#include "pb/response_list_users.pb.h" -#include "pb/session_commands.pb.h" +#include "../interface/widgets/server/user/user_info_box.h" +#include "../interface/widgets/server/user/user_list_manager.h" +#include "../interface/widgets/server/user/user_list_widget.h" +#include "../interface/widgets/utility/custom_line_edit.h" #include "tab_supervisor.h" -#include "trice_limits.h" #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include TabAccount::TabAccount(TabSupervisor *_tabSupervisor, AbstractClient *_client, const ServerInfo_User &userInfo) : Tab(_tabSupervisor), client(_client) diff --git a/cockatrice/src/tabs/tab_account.h b/cockatrice/src/interface/widgets/tabs/tab_account.h similarity index 96% rename from cockatrice/src/tabs/tab_account.h rename to cockatrice/src/interface/widgets/tabs/tab_account.h index 4e6abb24b..e09c12eb2 100644 --- a/cockatrice/src/tabs/tab_account.h +++ b/cockatrice/src/interface/widgets/tabs/tab_account.h @@ -7,9 +7,10 @@ #ifndef TAB_ACCOUNT_H #define TAB_ACCOUNT_H -#include "pb/serverinfo_user.pb.h" #include "tab.h" +#include + class AbstractClient; class Event_AddToList; class Event_ListRooms; diff --git a/cockatrice/src/tabs/tab_admin.cpp b/cockatrice/src/interface/widgets/tabs/tab_admin.cpp similarity index 96% rename from cockatrice/src/tabs/tab_admin.cpp rename to cockatrice/src/interface/widgets/tabs/tab_admin.cpp index a3d9e34e8..3ddb53579 100644 --- a/cockatrice/src/tabs/tab_admin.cpp +++ b/cockatrice/src/interface/widgets/tabs/tab_admin.cpp @@ -1,12 +1,5 @@ #include "tab_admin.h" -#include "../server/abstract_client.h" -#include "../server/pending_command.h" -#include "pb/admin_commands.pb.h" -#include "pb/event_replay_added.pb.h" -#include "pb/moderator_commands.pb.h" -#include "trice_limits.h" - #include #include #include @@ -15,6 +8,12 @@ #include #include #include +#include +#include +#include +#include +#include +#include ShutdownDialog::ShutdownDialog(QWidget *parent) : QDialog(parent) { diff --git a/cockatrice/src/tabs/tab_admin.h b/cockatrice/src/interface/widgets/tabs/tab_admin.h similarity index 93% rename from cockatrice/src/tabs/tab_admin.h rename to cockatrice/src/interface/widgets/tabs/tab_admin.h index 60722b778..5b44a6569 100644 --- a/cockatrice/src/tabs/tab_admin.h +++ b/cockatrice/src/interface/widgets/tabs/tab_admin.h @@ -7,11 +7,11 @@ #ifndef TAB_ADMIN_H #define TAB_ADMIN_H -#include "pb/commands.pb.h" -#include "pb/response.pb.h" #include "tab.h" #include +#include +#include class AbstractClient; diff --git a/cockatrice/src/tabs/tab_deck_editor.cpp b/cockatrice/src/interface/widgets/tabs/tab_deck_editor.cpp similarity index 89% rename from cockatrice/src/tabs/tab_deck_editor.cpp rename to cockatrice/src/interface/widgets/tabs/tab_deck_editor.cpp index 1f56f7b7b..517254f80 100644 --- a/cockatrice/src/tabs/tab_deck_editor.cpp +++ b/cockatrice/src/interface/widgets/tabs/tab_deck_editor.cpp @@ -1,21 +1,15 @@ #include "tab_deck_editor.h" -#include "../client/deck_editor_menu.h" -#include "../client/tapped_out_interface.h" -#include "../database/card_database_manager.h" -#include "../database/model/card_database_model.h" -#include "../dialogs/dlg_load_deck.h" -#include "../dialogs/dlg_load_deck_from_clipboard.h" +#include "../client/network/interfaces/tapped_out_interface.h" #include "../filters/filter_builder.h" #include "../filters/filter_tree_model.h" #include "../interface/pixel_map_generator.h" #include "../interface/widgets/cards/card_info_frame_widget.h" #include "../interface/widgets/deck_editor/deck_editor_filter_dock_widget.h" -#include "../server/abstract_client.h" -#include "../server/pending_command.h" -#include "../settings/cache_settings.h" +#include "../interface/widgets/dialogs/dlg_load_deck.h" +#include "../interface/widgets/dialogs/dlg_load_deck_from_clipboard.h" +#include "../interface/widgets/menus/deck_editor_menu.h" #include "tab_supervisor.h" -#include "trice_limits.h" #include #include @@ -38,6 +32,12 @@ #include #include #include +#include +#include +#include +#include +#include +#include TabDeckEditor::TabDeckEditor(TabSupervisor *_tabSupervisor) : AbstractTabDeckEditor(_tabSupervisor) { @@ -93,6 +93,13 @@ void TabDeckEditor::createMenus() aPrintingSelectorDockFloating->setCheckable(true); connect(aPrintingSelectorDockFloating, &QAction::triggered, this, &TabDeckEditor::dockFloatingTriggered); + if (SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference()) { + printingSelectorDockMenu->setEnabled(false); + } + + connect(&SettingsCache::instance(), &SettingsCache::overrideAllCardArtWithPersonalPreferenceChanged, this, + [this](bool enabled) { printingSelectorDockMenu->setEnabled(!enabled); }); + viewMenu->addSeparator(); aResetLayout = viewMenu->addAction(QString()); @@ -171,6 +178,13 @@ void TabDeckEditor::loadLayout() restoreGeometry(layouts.getDeckEditorGeometry()); } + if (SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference()) { + if (!printingSelectorDockWidget->isHidden()) { + printingSelectorDockWidget->setHidden(true); + aPrintingSelectorDockVisible->setChecked(false); + } + } + aCardInfoDockVisible->setChecked(!cardInfoDockWidget->isHidden()); aFilterDockVisible->setChecked(!filterDockWidget->isHidden()); aDeckDockVisible->setChecked(!deckDockWidget->isHidden()); @@ -203,10 +217,11 @@ void TabDeckEditor::loadLayout() void TabDeckEditor::restartLayout() { + aCardInfoDockVisible->setChecked(true); aDeckDockVisible->setChecked(true); aFilterDockVisible->setChecked(true); - aPrintingSelectorDockVisible->setChecked(true); + aPrintingSelectorDockVisible->setChecked(!SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference()); aCardInfoDockFloating->setChecked(false); aDeckDockFloating->setChecked(false); @@ -227,7 +242,7 @@ void TabDeckEditor::restartLayout() deckDockWidget->setVisible(true); cardInfoDockWidget->setVisible(true); filterDockWidget->setVisible(true); - printingSelectorDockWidget->setVisible(true); + printingSelectorDockWidget->setVisible(!SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference()); splitDockWidget(cardInfoDockWidget, printingSelectorDockWidget, Qt::Horizontal); splitDockWidget(printingSelectorDockWidget, deckDockWidget, Qt::Horizontal); diff --git a/cockatrice/src/tabs/tab_deck_editor.h b/cockatrice/src/interface/widgets/tabs/tab_deck_editor.h similarity index 91% rename from cockatrice/src/tabs/tab_deck_editor.h rename to cockatrice/src/interface/widgets/tabs/tab_deck_editor.h index 078560da1..ec953055c 100644 --- a/cockatrice/src/tabs/tab_deck_editor.h +++ b/cockatrice/src/interface/widgets/tabs/tab_deck_editor.h @@ -1,11 +1,12 @@ #ifndef WINDOW_DECKEDITOR_H #define WINDOW_DECKEDITOR_H -#include "../card/card_info.h" #include "../interface/widgets/visual_deck_storage/deck_preview/deck_preview_deck_tags_display_widget.h" -#include "../utility/key_signals.h" #include "abstract_tab_deck_editor.h" +#include +#include + class CardDatabaseModel; class CardDatabaseDisplayModel; class DeckListModel; diff --git a/cockatrice/src/tabs/tab_deck_storage.cpp b/cockatrice/src/interface/widgets/tabs/tab_deck_storage.cpp similarity index 96% rename from cockatrice/src/tabs/tab_deck_storage.cpp rename to cockatrice/src/interface/widgets/tabs/tab_deck_storage.cpp index 898612e6f..165ee0a17 100644 --- a/cockatrice/src/tabs/tab_deck_storage.cpp +++ b/cockatrice/src/interface/widgets/tabs/tab_deck_storage.cpp @@ -1,19 +1,7 @@ #include "tab_deck_storage.h" -#include "../client/get_text_with_max.h" -#include "../deck/deck_loader.h" -#include "../server/pending_command.h" -#include "../server/remote/remote_decklist_tree_widget.h" -#include "../settings/cache_settings.h" -#include "deck_list.h" -#include "pb/command_deck_del.pb.h" -#include "pb/command_deck_del_dir.pb.h" -#include "pb/command_deck_download.pb.h" -#include "pb/command_deck_new_dir.pb.h" -#include "pb/command_deck_upload.pb.h" -#include "pb/response.pb.h" -#include "pb/response_deck_download.pb.h" -#include "pb/response_deck_upload.pb.h" +#include "../interface/widgets/server/remote/remote_decklist_tree_widget.h" +#include "../interface/widgets/utility/get_text_with_max.h" #include #include @@ -29,6 +17,18 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include TabDeckStorage::TabDeckStorage(TabSupervisor *_tabSupervisor, AbstractClient *_client, diff --git a/cockatrice/src/tabs/tab_deck_storage.h b/cockatrice/src/interface/widgets/tabs/tab_deck_storage.h similarity index 94% rename from cockatrice/src/tabs/tab_deck_storage.h rename to cockatrice/src/interface/widgets/tabs/tab_deck_storage.h index ae52bba85..9509d2329 100644 --- a/cockatrice/src/tabs/tab_deck_storage.h +++ b/cockatrice/src/interface/widgets/tabs/tab_deck_storage.h @@ -8,10 +8,11 @@ #ifndef TAB_DECK_STORAGE_H #define TAB_DECK_STORAGE_H -#include "../server/abstract_client.h" -#include "../server/remote/remote_decklist_tree_widget.h" +#include "../interface/widgets/server/remote/remote_decklist_tree_widget.h" #include "tab.h" +#include + class ServerInfo_User; class AbstractClient; class QTreeView; diff --git a/cockatrice/src/tabs/tab_game.cpp b/cockatrice/src/interface/widgets/tabs/tab_game.cpp similarity index 97% rename from cockatrice/src/tabs/tab_game.cpp rename to cockatrice/src/interface/widgets/tabs/tab_game.cpp index c31f548d6..f55450de9 100644 --- a/cockatrice/src/tabs/tab_game.cpp +++ b/cockatrice/src/interface/widgets/tabs/tab_game.cpp @@ -1,9 +1,5 @@ #include "tab_game.h" -#include "../client/network/replay_timeline_widget.h" -#include "../database/card_database.h" -#include "../database/card_database_manager.h" -#include "../dialogs/dlg_create_game.h" #include "../game/board/arrow_item.h" #include "../game/board/card_item.h" #include "../game/deckview/deck_view_container.h" @@ -17,20 +13,15 @@ #include "../game/player/player_list_widget.h" #include "../game/replay.h" #include "../game/zones/card_zone.h" -#include "../interface/line_edit_completer.h" +#include "../interface/card_picture_loader/card_picture_loader.h" #include "../interface/widgets/cards/card_info_frame_widget.h" +#include "../interface/widgets/dialogs/dlg_create_game.h" +#include "../interface/widgets/replay/replay_timeline_widget.h" +#include "../interface/widgets/server/user/user_list_manager.h" +#include "../interface/widgets/utility/line_edit_completer.h" #include "../interface/window_main.h" #include "../main.h" -#include "../picture_loader/picture_loader.h" -#include "../server/abstract_client.h" -#include "../server/user/user_list_manager.h" -#include "../settings/cache_settings.h" -#include "pb/event_game_joined.pb.h" -#include "pb/game_replay.pb.h" -#include "pb/serverinfo_player.pb.h" -#include "pb/serverinfo_user.pb.h" #include "tab_supervisor.h" -#include "trice_limits.h" #include #include @@ -46,6 +37,15 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include TabGame::TabGame(TabSupervisor *_tabSupervisor, GameReplay *_replay) : Tab(_tabSupervisor), sayLabel(nullptr), sayEdit(nullptr) @@ -323,10 +323,11 @@ void TabGame::retranslateUi() } } if (aLeaveGame) { - aLeaveGame->setText(tr("&Leave game")); - } - if (aCloseReplay) { - aCloseReplay->setText(tr("C&lose replay")); + if (replayManager->replay) { + aLeaveGame->setText(tr("C&lose replay")); + } else { + aLeaveGame->setText(tr("&Leave game")); + } } if (aFocusChat) { aFocusChat->setText(tr("&Focus Chat")); @@ -444,9 +445,6 @@ void TabGame::refreshShortcuts() if (aLeaveGame) { aLeaveGame->setShortcuts(shortcuts.getShortcut("Player/aLeaveGame")); } - if (aCloseReplay) { - aCloseReplay->setShortcuts(shortcuts.getShortcut("Player/aCloseReplay")); - } if (aResetLayout) { aResetLayout->setShortcuts(shortcuts.getShortcut("Player/aResetLayout")); } @@ -757,7 +755,7 @@ void TabGame::loadDeckForLocalPlayer(Player *localPlayer, int playerId, ServerIn TabbedDeckViewContainer *deckViewContainer = deckViewContainers.value(playerId); if (playerInfo.has_deck_list()) { DeckLoader newDeck(QString::fromStdString(playerInfo.deck_list())); - PictureLoader::cacheCardPixmaps(CardDatabaseManager::query()->getCards(newDeck.getCardRefList())); + CardPictureLoader::cacheCardPixmaps(CardDatabaseManager::query()->getCards(newDeck.getCardRefList())); deckViewContainer->playerDeckView->setDeck(newDeck); localPlayer->setDeck(newDeck); } @@ -979,7 +977,6 @@ void TabGame::createMenuItems() connect(aLeaveGame, &QAction::triggered, this, &TabGame::closeRequest); aFocusChat = new QAction(this); connect(aFocusChat, &QAction::triggered, sayEdit, qOverload<>(&LineEditCompleter::setFocus)); - aCloseReplay = nullptr; phasesMenu = new TearOffMenu(this); @@ -1029,13 +1026,12 @@ void TabGame::createReplayMenuItems() aGameInfo = nullptr; aConcede = nullptr; aFocusChat = nullptr; - aLeaveGame = nullptr; - aCloseReplay = new QAction(this); - connect(aCloseReplay, &QAction::triggered, this, &TabGame::closeRequest); + aLeaveGame = new QAction(this); + connect(aLeaveGame, &QAction::triggered, this, &TabGame::closeRequest); phasesMenu = nullptr; gameMenu = new QMenu(this); - gameMenu->addAction(aCloseReplay); + gameMenu->addAction(aLeaveGame); aCardMenu = nullptr; diff --git a/cockatrice/src/tabs/tab_game.h b/cockatrice/src/interface/widgets/tabs/tab_game.h similarity index 94% rename from cockatrice/src/tabs/tab_game.h rename to cockatrice/src/interface/widgets/tabs/tab_game.h index eee5769ab..e6ba912f4 100644 --- a/cockatrice/src/tabs/tab_game.h +++ b/cockatrice/src/interface/widgets/tabs/tab_game.h @@ -9,18 +9,18 @@ #ifndef TAB_GAME_H #define TAB_GAME_H -#include "../client/replay_manager.h" #include "../game/abstract_game.h" #include "../game/log/message_log_widget.h" #include "../game/player/player.h" -#include "../interface/tearoff_menu.h" +#include "../interface/widgets/menus/tearoff_menu.h" +#include "../interface/widgets/replay/replay_manager.h" #include "../interface/widgets/visual_deck_storage/visual_deck_storage_widget.h" -#include "pb/event_leave.pb.h" #include "tab.h" #include #include #include +#include class ServerInfo_PlayerProperties; class TabbedDeckViewContainer; @@ -83,8 +83,8 @@ private: QAction *playersSeparator; QMenu *gameMenu, *viewMenu, *cardInfoDockMenu, *messageLayoutDockMenu, *playerListDockMenu, *replayDockMenu; TearOffMenu *phasesMenu; - QAction *aGameInfo, *aConcede, *aLeaveGame, *aCloseReplay, *aNextPhase, *aNextPhaseAction, *aNextTurn, - *aReverseTurn, *aRemoveLocalArrows, *aRotateViewCW, *aRotateViewCCW, *aResetLayout, *aResetReplayLayout; + QAction *aGameInfo, *aConcede, *aLeaveGame, *aNextPhase, *aNextPhaseAction, *aNextTurn, *aReverseTurn, + *aRemoveLocalArrows, *aRotateViewCW, *aRotateViewCCW, *aResetLayout, *aResetReplayLayout; QAction *aCardInfoDockVisible, *aCardInfoDockFloating, *aMessageLayoutDockVisible, *aMessageLayoutDockFloating, *aPlayerListDockVisible, *aPlayerListDockFloating, *aReplayDockVisible, *aReplayDockFloating; QAction *aFocusChat; diff --git a/cockatrice/src/tabs/tab_home.cpp b/cockatrice/src/interface/widgets/tabs/tab_home.cpp similarity index 100% rename from cockatrice/src/tabs/tab_home.cpp rename to cockatrice/src/interface/widgets/tabs/tab_home.cpp diff --git a/cockatrice/src/tabs/tab_home.h b/cockatrice/src/interface/widgets/tabs/tab_home.h similarity index 89% rename from cockatrice/src/tabs/tab_home.h rename to cockatrice/src/interface/widgets/tabs/tab_home.h index 26a372884..3738b73fd 100644 --- a/cockatrice/src/tabs/tab_home.h +++ b/cockatrice/src/interface/widgets/tabs/tab_home.h @@ -8,10 +8,10 @@ #define TAB_HOME_H #include "../interface/widgets/general/home_widget.h" -#include "../server/abstract_client.h" #include "tab.h" #include +#include #include class AbstractClient; diff --git a/cockatrice/src/tabs/tab_logs.cpp b/cockatrice/src/interface/widgets/tabs/tab_logs.cpp similarity index 96% rename from cockatrice/src/tabs/tab_logs.cpp rename to cockatrice/src/interface/widgets/tabs/tab_logs.cpp index 4a791a27e..86e10b755 100644 --- a/cockatrice/src/tabs/tab_logs.cpp +++ b/cockatrice/src/interface/widgets/tabs/tab_logs.cpp @@ -1,12 +1,7 @@ #include "tab_logs.h" -#include "../deck/custom_line_edit.h" -#include "../dialogs/dlg_manage_sets.h" -#include "../server/abstract_client.h" -#include "../server/pending_command.h" -#include "pb/moderator_commands.pb.h" -#include "pb/response_viewlog_history.pb.h" -#include "trice_limits.h" +#include "../interface/widgets/dialogs/dlg_manage_sets.h" +#include "../interface/widgets/utility/custom_line_edit.h" #include #include @@ -20,6 +15,11 @@ #include #include #include +#include +#include +#include +#include +#include TabLog::TabLog(TabSupervisor *_tabSupervisor, AbstractClient *_client) : Tab(_tabSupervisor), client(_client) { diff --git a/cockatrice/src/tabs/tab_logs.h b/cockatrice/src/interface/widgets/tabs/tab_logs.h similarity index 100% rename from cockatrice/src/tabs/tab_logs.h rename to cockatrice/src/interface/widgets/tabs/tab_logs.h diff --git a/cockatrice/src/tabs/tab_message.cpp b/cockatrice/src/interface/widgets/tabs/tab_message.cpp similarity index 89% rename from cockatrice/src/tabs/tab_message.cpp rename to cockatrice/src/interface/widgets/tabs/tab_message.cpp index 6b4b7044b..3e6a86384 100644 --- a/cockatrice/src/tabs/tab_message.cpp +++ b/cockatrice/src/interface/widgets/tabs/tab_message.cpp @@ -1,23 +1,23 @@ #include "tab_message.h" #include "../client/sound_engine.h" -#include "../deck/custom_line_edit.h" +#include "../interface/widgets/server/chat_view/chat_view.h" +#include "../interface/widgets/server/user/user_list_manager.h" +#include "../interface/widgets/utility/custom_line_edit.h" #include "../main.h" -#include "../server/abstract_client.h" -#include "../server/chat_view/chat_view.h" -#include "../server/pending_command.h" -#include "../server/user/user_list_manager.h" -#include "../settings/cache_settings.h" -#include "pb/event_user_message.pb.h" -#include "pb/serverinfo_user.pb.h" -#include "pb/session_commands.pb.h" -#include "trice_limits.h" #include #include #include #include #include +#include +#include +#include +#include +#include +#include +#include TabMessage::TabMessage(TabSupervisor *_tabSupervisor, AbstractClient *_client, diff --git a/cockatrice/src/tabs/tab_message.h b/cockatrice/src/interface/widgets/tabs/tab_message.h similarity index 100% rename from cockatrice/src/tabs/tab_message.h rename to cockatrice/src/interface/widgets/tabs/tab_message.h diff --git a/cockatrice/src/tabs/tab_replays.cpp b/cockatrice/src/interface/widgets/tabs/tab_replays.cpp similarity index 96% rename from cockatrice/src/tabs/tab_replays.cpp rename to cockatrice/src/interface/widgets/tabs/tab_replays.cpp index 2feb41383..836d900b6 100644 --- a/cockatrice/src/tabs/tab_replays.cpp +++ b/cockatrice/src/interface/widgets/tabs/tab_replays.cpp @@ -1,19 +1,6 @@ #include "tab_replays.h" -#include "../server/abstract_client.h" -#include "../server/pending_command.h" -#include "../server/remote/remote_replay_list_tree_widget.h" -#include "../settings/cache_settings.h" -#include "pb/command_replay_delete_match.pb.h" -#include "pb/command_replay_download.pb.h" -#include "pb/command_replay_get_code.pb.h" -#include "pb/command_replay_modify_match.pb.h" -#include "pb/command_replay_submit_code.pb.h" -#include "pb/event_replay_added.pb.h" -#include "pb/game_replay.pb.h" -#include "pb/response.pb.h" -#include "pb/response_replay_download.pb.h" -#include "pb/response_replay_get_code.pb.h" +#include "../interface/widgets/server/remote/remote_replay_list_tree_widget.h" #include "tab_game.h" #include @@ -30,6 +17,19 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include TabReplays::TabReplays(TabSupervisor *_tabSupervisor, AbstractClient *_client, const ServerInfo_User *currentUserInfo) : Tab(_tabSupervisor), client(_client) diff --git a/cockatrice/src/tabs/tab_replays.h b/cockatrice/src/interface/widgets/tabs/tab_replays.h similarity index 97% rename from cockatrice/src/tabs/tab_replays.h rename to cockatrice/src/interface/widgets/tabs/tab_replays.h index 7a29abe1f..bf21ada82 100644 --- a/cockatrice/src/tabs/tab_replays.h +++ b/cockatrice/src/interface/widgets/tabs/tab_replays.h @@ -8,9 +8,10 @@ #ifndef TAB_REPLAYS_H #define TAB_REPLAYS_H -#include "../server/abstract_client.h" #include "tab.h" +#include + class ServerInfo_User; class Response; class AbstractClient; diff --git a/cockatrice/src/tabs/tab_room.cpp b/cockatrice/src/interface/widgets/tabs/tab_room.cpp similarity index 91% rename from cockatrice/src/tabs/tab_room.cpp rename to cockatrice/src/interface/widgets/tabs/tab_room.cpp index ff6507b29..808c888cd 100644 --- a/cockatrice/src/tabs/tab_room.cpp +++ b/cockatrice/src/interface/widgets/tabs/tab_room.cpp @@ -1,25 +1,13 @@ #include "tab_room.h" -#include "../dialogs/dlg_settings.h" +#include "../interface/widgets/dialogs/dlg_settings.h" +#include "../interface/widgets/server/chat_view/chat_view.h" +#include "../interface/widgets/server/game_selector.h" +#include "../interface/widgets/server/user/user_list_manager.h" +#include "../interface/widgets/server/user/user_list_widget.h" #include "../main.h" -#include "../server/abstract_client.h" -#include "../server/chat_view/chat_view.h" -#include "../server/game_selector.h" -#include "../server/pending_command.h" -#include "../server/user/user_list_manager.h" -#include "../server/user/user_list_widget.h" -#include "../settings/cache_settings.h" -#include "get_pb_extension.h" -#include "pb/event_join_room.pb.h" -#include "pb/event_leave_room.pb.h" -#include "pb/event_list_games.pb.h" -#include "pb/event_remove_messages.pb.h" -#include "pb/event_room_say.pb.h" -#include "pb/room_commands.pb.h" -#include "pb/serverinfo_room.pb.h" #include "tab_account.h" #include "tab_supervisor.h" -#include "trice_limits.h" #include #include @@ -32,6 +20,18 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include TabRoom::TabRoom(TabSupervisor *_tabSupervisor, AbstractClient *_client, diff --git a/cockatrice/src/tabs/tab_room.h b/cockatrice/src/interface/widgets/tabs/tab_room.h similarity index 98% rename from cockatrice/src/tabs/tab_room.h rename to cockatrice/src/interface/widgets/tabs/tab_room.h index 3eb1b580f..8aadab499 100644 --- a/cockatrice/src/tabs/tab_room.h +++ b/cockatrice/src/interface/widgets/tabs/tab_room.h @@ -8,7 +8,7 @@ #ifndef TAB_ROOM_H #define TAB_ROOM_H -#include "../interface/line_edit_completer.h" +#include "../interface/widgets/utility/line_edit_completer.h" #include "tab.h" #include diff --git a/cockatrice/src/tabs/tab_server.cpp b/cockatrice/src/interface/widgets/tabs/tab_server.cpp similarity index 95% rename from cockatrice/src/tabs/tab_server.cpp rename to cockatrice/src/interface/widgets/tabs/tab_server.cpp index 069f06313..bd4fa2be3 100644 --- a/cockatrice/src/tabs/tab_server.cpp +++ b/cockatrice/src/interface/widgets/tabs/tab_server.cpp @@ -1,12 +1,6 @@ #include "tab_server.h" -#include "../server/abstract_client.h" -#include "../server/pending_command.h" -#include "../server/user/user_list_widget.h" -#include "pb/event_list_rooms.pb.h" -#include "pb/event_server_message.pb.h" -#include "pb/response_join_room.pb.h" -#include "pb/session_commands.pb.h" +#include "../interface/widgets/server/user/user_list_widget.h" #include "tab_supervisor.h" #include @@ -20,6 +14,12 @@ #include #include #include +#include +#include +#include +#include +#include +#include RoomSelector::RoomSelector(AbstractClient *_client, QWidget *parent) : QGroupBox(parent), client(_client) { diff --git a/cockatrice/src/tabs/tab_server.h b/cockatrice/src/interface/widgets/tabs/tab_server.h similarity index 100% rename from cockatrice/src/tabs/tab_server.h rename to cockatrice/src/interface/widgets/tabs/tab_server.h diff --git a/cockatrice/src/tabs/tab_supervisor.cpp b/cockatrice/src/interface/widgets/tabs/tab_supervisor.cpp similarity index 97% rename from cockatrice/src/tabs/tab_supervisor.cpp rename to cockatrice/src/interface/widgets/tabs/tab_supervisor.cpp index 78fce4516..8eee1d5e0 100644 --- a/cockatrice/src/tabs/tab_supervisor.cpp +++ b/cockatrice/src/interface/widgets/tabs/tab_supervisor.cpp @@ -1,21 +1,10 @@ #include "tab_supervisor.h" #include "../interface/pixel_map_generator.h" +#include "../interface/widgets/server/user/user_list_manager.h" +#include "../interface/widgets/server/user/user_list_widget.h" #include "../main.h" -#include "../server/abstract_client.h" -#include "../server/user/user_list_manager.h" -#include "../server/user/user_list_widget.h" -#include "../settings/cache_settings.h" #include "api/edhrec/tab_edhrec_main.h" -#include "pb/event_game_joined.pb.h" -#include "pb/event_notify_user.pb.h" -#include "pb/event_user_message.pb.h" -#include "pb/game_event_container.pb.h" -#include "pb/game_replay.pb.h" -#include "pb/room_commands.pb.h" -#include "pb/room_event.pb.h" -#include "pb/serverinfo_room.pb.h" -#include "pb/serverinfo_user.pb.h" #include "tab_account.h" #include "tab_admin.h" #include "tab_deck_editor.h" @@ -36,6 +25,17 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include QRect MacOSTabFixStyle::subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const { diff --git a/cockatrice/src/tabs/tab_supervisor.h b/cockatrice/src/interface/widgets/tabs/tab_supervisor.h similarity index 98% rename from cockatrice/src/tabs/tab_supervisor.h rename to cockatrice/src/interface/widgets/tabs/tab_supervisor.h index 014d99825..a3b3d9713 100644 --- a/cockatrice/src/tabs/tab_supervisor.h +++ b/cockatrice/src/interface/widgets/tabs/tab_supervisor.h @@ -8,8 +8,7 @@ #ifndef TAB_SUPERVISOR_H #define TAB_SUPERVISOR_H -#include "../deck/deck_loader.h" -#include "../server/user/user_list_proxy.h" +#include "../interface/widgets/server/user/user_list_proxy.h" #include "abstract_tab_deck_editor.h" #include "api/edhrec/tab_edhrec.h" #include "api/edhrec/tab_edhrec_main.h" @@ -24,6 +23,7 @@ #include #include #include +#include inline Q_LOGGING_CATEGORY(TabSupervisorLog, "tab_supervisor"); diff --git a/cockatrice/src/tabs/tab_visual_database_display.cpp b/cockatrice/src/interface/widgets/tabs/tab_visual_database_display.cpp similarity index 100% rename from cockatrice/src/tabs/tab_visual_database_display.cpp rename to cockatrice/src/interface/widgets/tabs/tab_visual_database_display.cpp diff --git a/cockatrice/src/tabs/tab_visual_database_display.h b/cockatrice/src/interface/widgets/tabs/tab_visual_database_display.h similarity index 100% rename from cockatrice/src/tabs/tab_visual_database_display.h rename to cockatrice/src/interface/widgets/tabs/tab_visual_database_display.h diff --git a/cockatrice/src/tabs/visual_deck_editor/tab_deck_editor_visual.cpp b/cockatrice/src/interface/widgets/tabs/visual_deck_editor/tab_deck_editor_visual.cpp similarity index 92% rename from cockatrice/src/tabs/visual_deck_editor/tab_deck_editor_visual.cpp rename to cockatrice/src/interface/widgets/tabs/visual_deck_editor/tab_deck_editor_visual.cpp index f3ae2e293..5be62a94c 100644 --- a/cockatrice/src/tabs/visual_deck_editor/tab_deck_editor_visual.cpp +++ b/cockatrice/src/interface/widgets/tabs/visual_deck_editor/tab_deck_editor_visual.cpp @@ -1,20 +1,14 @@ #include "tab_deck_editor_visual.h" -#include "../../database/model/card_database_model.h" -#include "../../deck/deck_list_model.h" -#include "../../deck/deck_stats_interface.h" +#include "../../client/network/interfaces/deck_stats_interface.h" #include "../../filters/filter_builder.h" #include "../../interface/pixel_map_generator.h" #include "../../interface/widgets/cards/card_info_frame_widget.h" #include "../../interface/widgets/deck_analytics/deck_analytics_widget.h" #include "../../interface/widgets/visual_deck_editor/visual_deck_editor_widget.h" -#include "../../server/pending_command.h" -#include "../../settings/cache_settings.h" #include "../tab_deck_editor.h" #include "../tab_supervisor.h" -#include "pb/command_deck_upload.pb.h" #include "tab_deck_editor_visual_tab_widget.h" -#include "trice_limits.h" #include #include @@ -33,6 +27,12 @@ #include #include #include +#include +#include +#include +#include +#include +#include TabDeckEditorVisual::TabDeckEditorVisual(TabSupervisor *_tabSupervisor) : AbstractTabDeckEditor(_tabSupervisor) { @@ -126,6 +126,13 @@ void TabDeckEditorVisual::createMenus() aPrintingSelectorDockFloating->setCheckable(true); connect(aPrintingSelectorDockFloating, SIGNAL(triggered()), this, SLOT(dockFloatingTriggered())); + if (SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference()) { + printingSelectorDockMenu->setEnabled(false); + } + + connect(&SettingsCache::instance(), &SettingsCache::overrideAllCardArtWithPersonalPreferenceChanged, this, + [this](bool enabled) { printingSelectorDockMenu->setEnabled(!enabled); }); + viewMenu->addSeparator(); aResetLayout = viewMenu->addAction(QString()); @@ -236,6 +243,13 @@ void TabDeckEditorVisual::loadLayout() restoreGeometry(layouts.getDeckEditorGeometry()); } + if (SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference()) { + if (!printingSelectorDockWidget->isHidden()) { + printingSelectorDockWidget->setHidden(true); + aPrintingSelectorDockVisible->setChecked(false); + } + } + aCardInfoDockVisible->setChecked(!cardInfoDockWidget->isHidden()); aFilterDockVisible->setChecked(!filterDockWidget->isHidden()); aDeckDockVisible->setChecked(!deckDockWidget->isHidden()); @@ -271,7 +285,7 @@ void TabDeckEditorVisual::restartLayout() aCardInfoDockVisible->setChecked(true); aDeckDockVisible->setChecked(true); aFilterDockVisible->setChecked(false); - aPrintingSelectorDockVisible->setChecked(true); + aPrintingSelectorDockVisible->setChecked(!SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference()); aCardInfoDockFloating->setChecked(false); aDeckDockFloating->setChecked(false); @@ -279,22 +293,21 @@ void TabDeckEditorVisual::restartLayout() aPrintingSelectorDockFloating->setChecked(false); setCentralWidget(centralWidget); - addDockWidget(Qt::RightDockWidgetArea, deckDockWidget); addDockWidget(Qt::RightDockWidgetArea, cardInfoDockWidget); addDockWidget(Qt::RightDockWidgetArea, filterDockWidget); addDockWidget(Qt::RightDockWidgetArea, printingSelectorDockWidget); + deckDockWidget->setVisible(true); + cardInfoDockWidget->setVisible(true); + filterDockWidget->setVisible(false); + printingSelectorDockWidget->setVisible(!SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference()); + deckDockWidget->setFloating(false); cardInfoDockWidget->setFloating(false); filterDockWidget->setFloating(false); printingSelectorDockWidget->setFloating(false); - deckDockWidget->setVisible(true); - cardInfoDockWidget->setVisible(true); - filterDockWidget->setVisible(false); - printingSelectorDockWidget->setVisible(true); - splitDockWidget(cardInfoDockWidget, printingSelectorDockWidget, Qt::Vertical); splitDockWidget(cardInfoDockWidget, deckDockWidget, Qt::Horizontal); splitDockWidget(cardInfoDockWidget, filterDockWidget, Qt::Horizontal); diff --git a/cockatrice/src/tabs/visual_deck_editor/tab_deck_editor_visual.h b/cockatrice/src/interface/widgets/tabs/visual_deck_editor/tab_deck_editor_visual.h similarity index 100% rename from cockatrice/src/tabs/visual_deck_editor/tab_deck_editor_visual.h rename to cockatrice/src/interface/widgets/tabs/visual_deck_editor/tab_deck_editor_visual.h diff --git a/cockatrice/src/tabs/visual_deck_editor/tab_deck_editor_visual_tab_widget.cpp b/cockatrice/src/interface/widgets/tabs/visual_deck_editor/tab_deck_editor_visual_tab_widget.cpp similarity index 100% rename from cockatrice/src/tabs/visual_deck_editor/tab_deck_editor_visual_tab_widget.cpp rename to cockatrice/src/interface/widgets/tabs/visual_deck_editor/tab_deck_editor_visual_tab_widget.cpp diff --git a/cockatrice/src/tabs/visual_deck_editor/tab_deck_editor_visual_tab_widget.h b/cockatrice/src/interface/widgets/tabs/visual_deck_editor/tab_deck_editor_visual_tab_widget.h similarity index 100% rename from cockatrice/src/tabs/visual_deck_editor/tab_deck_editor_visual_tab_widget.h rename to cockatrice/src/interface/widgets/tabs/visual_deck_editor/tab_deck_editor_visual_tab_widget.h diff --git a/cockatrice/src/tabs/visual_deck_storage/tab_deck_storage_visual.cpp b/cockatrice/src/interface/widgets/tabs/visual_deck_storage/tab_deck_storage_visual.cpp similarity index 91% rename from cockatrice/src/tabs/visual_deck_storage/tab_deck_storage_visual.cpp rename to cockatrice/src/interface/widgets/tabs/visual_deck_storage/tab_deck_storage_visual.cpp index ea8822213..9dcb5500f 100644 --- a/cockatrice/src/tabs/visual_deck_storage/tab_deck_storage_visual.cpp +++ b/cockatrice/src/interface/widgets/tabs/visual_deck_storage/tab_deck_storage_visual.cpp @@ -1,13 +1,13 @@ #include "tab_deck_storage_visual.h" -#include "../../database/model/card_database_model.h" #include "../../interface/widgets/cards/deck_preview_card_picture_widget.h" #include "../../interface/widgets/visual_deck_storage/visual_deck_storage_widget.h" #include "../tab_supervisor.h" -#include "pb/command_deck_del.pb.h" #include #include +#include +#include TabDeckStorageVisual::TabDeckStorageVisual(TabSupervisor *_tabSupervisor) : Tab(_tabSupervisor), visualDeckStorageWidget(new VisualDeckStorageWidget(this)) diff --git a/cockatrice/src/tabs/visual_deck_storage/tab_deck_storage_visual.h b/cockatrice/src/interface/widgets/tabs/visual_deck_storage/tab_deck_storage_visual.h similarity index 100% rename from cockatrice/src/tabs/visual_deck_storage/tab_deck_storage_visual.h rename to cockatrice/src/interface/widgets/tabs/visual_deck_storage/tab_deck_storage_visual.h diff --git a/cockatrice/src/deck/custom_line_edit.cpp b/cockatrice/src/interface/widgets/utility/custom_line_edit.cpp similarity index 95% rename from cockatrice/src/deck/custom_line_edit.cpp rename to cockatrice/src/interface/widgets/utility/custom_line_edit.cpp index ba521c0fd..532afc114 100644 --- a/cockatrice/src/deck/custom_line_edit.cpp +++ b/cockatrice/src/interface/widgets/utility/custom_line_edit.cpp @@ -1,13 +1,12 @@ #include "custom_line_edit.h" -#include "../settings/cache_settings.h" -#include "../settings/shortcuts_settings.h" - #include #include #include #include #include +#include +#include LineEditUnfocusable::LineEditUnfocusable(QWidget *parent) : QLineEdit(parent) { diff --git a/cockatrice/src/deck/custom_line_edit.h b/cockatrice/src/interface/widgets/utility/custom_line_edit.h similarity index 100% rename from cockatrice/src/deck/custom_line_edit.h rename to cockatrice/src/interface/widgets/utility/custom_line_edit.h diff --git a/cockatrice/src/client/get_text_with_max.cpp b/cockatrice/src/interface/widgets/utility/get_text_with_max.cpp similarity index 100% rename from cockatrice/src/client/get_text_with_max.cpp rename to cockatrice/src/interface/widgets/utility/get_text_with_max.cpp diff --git a/cockatrice/src/client/get_text_with_max.h b/cockatrice/src/interface/widgets/utility/get_text_with_max.h similarity index 95% rename from cockatrice/src/client/get_text_with_max.h rename to cockatrice/src/interface/widgets/utility/get_text_with_max.h index 2e633d494..894eb80f2 100644 --- a/cockatrice/src/client/get_text_with_max.h +++ b/cockatrice/src/interface/widgets/utility/get_text_with_max.h @@ -7,9 +7,8 @@ #ifndef GETTEXTWITHMAX_H #define GETTEXTWITHMAX_H -#include "trice_limits.h" - #include +#include QString getTextWithMax(QWidget *parent, const QString &title, diff --git a/cockatrice/src/interface/line_edit_completer.cpp b/cockatrice/src/interface/widgets/utility/line_edit_completer.cpp similarity index 100% rename from cockatrice/src/interface/line_edit_completer.cpp rename to cockatrice/src/interface/widgets/utility/line_edit_completer.cpp diff --git a/cockatrice/src/interface/line_edit_completer.h b/cockatrice/src/interface/widgets/utility/line_edit_completer.h similarity index 94% rename from cockatrice/src/interface/line_edit_completer.h rename to cockatrice/src/interface/widgets/utility/line_edit_completer.h index 1b2ca14d6..23e4d4aba 100644 --- a/cockatrice/src/interface/line_edit_completer.h +++ b/cockatrice/src/interface/widgets/utility/line_edit_completer.h @@ -7,7 +7,7 @@ #ifndef LINEEDITCOMPLETER_H #define LINEEDITCOMPLETER_H -#include "../deck/custom_line_edit.h" +#include "custom_line_edit.h" #include #include diff --git a/cockatrice/src/utility/sequence_edit.cpp b/cockatrice/src/interface/widgets/utility/sequence_edit.cpp similarity index 99% rename from cockatrice/src/utility/sequence_edit.cpp rename to cockatrice/src/interface/widgets/utility/sequence_edit.cpp index c5f0fd1c1..53776a3b0 100644 --- a/cockatrice/src/utility/sequence_edit.cpp +++ b/cockatrice/src/interface/widgets/utility/sequence_edit.cpp @@ -1,10 +1,9 @@ #include "sequence_edit.h" -#include "../settings/cache_settings.h" - #include #include #include +#include #include SequenceEdit::SequenceEdit(const QString &_shortcutName, QWidget *parent) : QWidget(parent) diff --git a/cockatrice/src/utility/sequence_edit.h b/cockatrice/src/interface/widgets/utility/sequence_edit.h similarity index 100% rename from cockatrice/src/utility/sequence_edit.h rename to cockatrice/src/interface/widgets/utility/sequence_edit.h diff --git a/cockatrice/src/interface/widgets/visual_database_display/visual_database_display_filter_save_load_widget.cpp b/cockatrice/src/interface/widgets/visual_database_display/visual_database_display_filter_save_load_widget.cpp index 15ef4a590..e8c42a28a 100644 --- a/cockatrice/src/interface/widgets/visual_database_display/visual_database_display_filter_save_load_widget.cpp +++ b/cockatrice/src/interface/widgets/visual_database_display/visual_database_display_filter_save_load_widget.cpp @@ -1,13 +1,13 @@ #include "visual_database_display_filter_save_load_widget.h" #include "../../../filters/filter_tree.h" -#include "../../../settings/cache_settings.h" #include "visual_database_filter_display_widget.h" #include #include #include #include +#include VisualDatabaseDisplayFilterSaveLoadWidget::VisualDatabaseDisplayFilterSaveLoadWidget(QWidget *parent, FilterTreeModel *_filterModel) diff --git a/cockatrice/src/interface/widgets/visual_database_display/visual_database_display_main_type_filter_widget.cpp b/cockatrice/src/interface/widgets/visual_database_display/visual_database_display_main_type_filter_widget.cpp index 1fddc9724..8ffb29eca 100644 --- a/cockatrice/src/interface/widgets/visual_database_display/visual_database_display_main_type_filter_widget.cpp +++ b/cockatrice/src/interface/widgets/visual_database_display/visual_database_display_main_type_filter_widget.cpp @@ -1,12 +1,12 @@ #include "visual_database_display_main_type_filter_widget.h" -#include "../../../database/card_database_manager.h" #include "../../../filters/filter_tree.h" #include "../../../filters/filter_tree_model.h" #include #include #include +#include VisualDatabaseDisplayMainTypeFilterWidget::VisualDatabaseDisplayMainTypeFilterWidget(QWidget *parent, FilterTreeModel *_filterModel) diff --git a/cockatrice/src/interface/widgets/visual_database_display/visual_database_display_name_filter_widget.cpp b/cockatrice/src/interface/widgets/visual_database_display/visual_database_display_name_filter_widget.cpp index 75ab238be..33929341e 100644 --- a/cockatrice/src/interface/widgets/visual_database_display/visual_database_display_name_filter_widget.cpp +++ b/cockatrice/src/interface/widgets/visual_database_display/visual_database_display_name_filter_widget.cpp @@ -1,7 +1,7 @@ #include "visual_database_display_name_filter_widget.h" -#include "../../../dialogs/dlg_load_deck_from_clipboard.h" -#include "../../../tabs/abstract_tab_deck_editor.h" +#include "../../../interface/widgets/dialogs/dlg_load_deck_from_clipboard.h" +#include "../../../interface/widgets/tabs/abstract_tab_deck_editor.h" #include diff --git a/cockatrice/src/interface/widgets/visual_database_display/visual_database_display_name_filter_widget.h b/cockatrice/src/interface/widgets/visual_database_display/visual_database_display_name_filter_widget.h index 06f30370a..b98d83523 100644 --- a/cockatrice/src/interface/widgets/visual_database_display/visual_database_display_name_filter_widget.h +++ b/cockatrice/src/interface/widgets/visual_database_display/visual_database_display_name_filter_widget.h @@ -8,7 +8,7 @@ #define VISUAL_DATABASE_DISPLAY_NAME_FILTER_WIDGET_H #include "../../../filters/filter_tree_model.h" -#include "../../../tabs/abstract_tab_deck_editor.h" +#include "../../../interface/widgets/tabs/abstract_tab_deck_editor.h" #include "../general/layout_containers/flow_widget.h" #include diff --git a/cockatrice/src/interface/widgets/visual_database_display/visual_database_display_set_filter_widget.cpp b/cockatrice/src/interface/widgets/visual_database_display/visual_database_display_set_filter_widget.cpp index 6bc27d90f..5a9c1029c 100644 --- a/cockatrice/src/interface/widgets/visual_database_display/visual_database_display_set_filter_widget.cpp +++ b/cockatrice/src/interface/widgets/visual_database_display/visual_database_display_set_filter_widget.cpp @@ -1,14 +1,14 @@ #include "visual_database_display_set_filter_widget.h" -#include "../../../database/card_database_manager.h" #include "../../../filters/filter_tree.h" #include "../../../filters/filter_tree_model.h" -#include "../../../settings/cache_settings.h" #include #include #include #include +#include +#include VisualDatabaseDisplayRecentSetFilterSettingsWidget::VisualDatabaseDisplayRecentSetFilterSettingsWidget(QWidget *parent) : QWidget(parent) diff --git a/cockatrice/src/interface/widgets/visual_database_display/visual_database_display_sub_type_filter_widget.cpp b/cockatrice/src/interface/widgets/visual_database_display/visual_database_display_sub_type_filter_widget.cpp index 9c531ba1a..ece3fca3b 100644 --- a/cockatrice/src/interface/widgets/visual_database_display/visual_database_display_sub_type_filter_widget.cpp +++ b/cockatrice/src/interface/widgets/visual_database_display/visual_database_display_sub_type_filter_widget.cpp @@ -1,6 +1,5 @@ #include "visual_database_display_sub_type_filter_widget.h" -#include "../../../database/card_database_manager.h" #include "../../../filters/filter_tree.h" #include "../../../filters/filter_tree_model.h" @@ -8,6 +7,7 @@ #include #include #include +#include VisualDatabaseDisplaySubTypeFilterWidget::VisualDatabaseDisplaySubTypeFilterWidget(QWidget *parent, FilterTreeModel *_filterModel) diff --git a/cockatrice/src/interface/widgets/visual_database_display/visual_database_display_widget.cpp b/cockatrice/src/interface/widgets/visual_database_display/visual_database_display_widget.cpp index 95a463b23..673a2ec1a 100644 --- a/cockatrice/src/interface/widgets/visual_database_display/visual_database_display_widget.cpp +++ b/cockatrice/src/interface/widgets/visual_database_display/visual_database_display_widget.cpp @@ -1,15 +1,11 @@ #include "visual_database_display_widget.h" -#include "../../../database/card_database.h" -#include "../../../database/card_database_manager.h" -#include "../../../deck/custom_line_edit.h" #include "../../../filters/filter_tree_model.h" #include "../../../filters/syntax_help.h" -#include "../../../settings/cache_settings.h" -#include "../../../utility/card_info_comparator.h" #include "../../pixel_map_generator.h" #include "../cards/card_info_picture_with_text_overlay_widget.h" #include "../quick_settings/settings_button_widget.h" +#include "../utility/custom_line_edit.h" #include "visual_database_display_color_filter_widget.h" #include "visual_database_display_filter_save_load_widget.h" #include "visual_database_display_main_type_filter_widget.h" @@ -19,6 +15,10 @@ #include #include +#include +#include +#include +#include #include #include diff --git a/cockatrice/src/interface/widgets/visual_database_display/visual_database_display_widget.h b/cockatrice/src/interface/widgets/visual_database_display/visual_database_display_widget.h index 947afeae1..0e7c89bab 100644 --- a/cockatrice/src/interface/widgets/visual_database_display/visual_database_display_widget.h +++ b/cockatrice/src/interface/widgets/visual_database_display/visual_database_display_widget.h @@ -7,18 +7,14 @@ #ifndef VISUAL_DATABASE_DISPLAY_WIDGET_H #define VISUAL_DATABASE_DISPLAY_WIDGET_H -#include "../../../database/card_database.h" -#include "../../../database/model/card_database_model.h" -#include "../../../deck/custom_line_edit.h" -#include "../../../deck/deck_list_model.h" #include "../../../filters/filter_tree_model.h" -#include "../../../tabs/abstract_tab_deck_editor.h" -#include "../../../utility/key_signals.h" +#include "../../../interface/widgets/tabs/abstract_tab_deck_editor.h" #include "../../layouts/flow_layout.h" #include "../cards/card_info_picture_with_text_overlay_widget.h" #include "../cards/card_size_widget.h" #include "../general/layout_containers/flow_widget.h" #include "../general/layout_containers/overlap_control_widget.h" +#include "../utility/custom_line_edit.h" #include "visual_database_display_color_filter_widget.h" #include "visual_database_display_filter_save_load_widget.h" #include "visual_database_display_main_type_filter_widget.h" @@ -31,6 +27,10 @@ #include #include #include +#include +#include +#include +#include #include inline Q_LOGGING_CATEGORY(VisualDatabaseDisplayLog, "visual_database_display"); diff --git a/cockatrice/src/interface/widgets/visual_database_display/visual_database_filter_display_widget.cpp b/cockatrice/src/interface/widgets/visual_database_display/visual_database_filter_display_widget.cpp index 3f6c2d104..093a52d72 100644 --- a/cockatrice/src/interface/widgets/visual_database_display/visual_database_filter_display_widget.cpp +++ b/cockatrice/src/interface/widgets/visual_database_display/visual_database_filter_display_widget.cpp @@ -1,13 +1,12 @@ #include "visual_database_filter_display_widget.h" -#include "../../../settings/cache_settings.h" - #include #include #include #include #include #include +#include FilterDisplayWidget::FilterDisplayWidget(QWidget *parent, const QString &filename, FilterTreeModel *_filterModel) : QWidget(parent), filterFilename(filename), filterModel(_filterModel) diff --git a/cockatrice/src/interface/widgets/visual_deck_editor/visual_deck_editor_sample_hand_widget.cpp b/cockatrice/src/interface/widgets/visual_deck_editor/visual_deck_editor_sample_hand_widget.cpp index 0f3fc9e49..ccf4a10ab 100644 --- a/cockatrice/src/interface/widgets/visual_deck_editor/visual_deck_editor_sample_hand_widget.cpp +++ b/cockatrice/src/interface/widgets/visual_deck_editor/visual_deck_editor_sample_hand_widget.cpp @@ -1,10 +1,10 @@ #include "visual_deck_editor_sample_hand_widget.h" -#include "../../../database/card_database_manager.h" -#include "../../../deck/deck_loader.h" -#include "../../../settings/cache_settings.h" #include "../cards/card_info_picture_widget.h" +#include +#include +#include #include VisualDeckEditorSampleHandWidget::VisualDeckEditorSampleHandWidget(QWidget *parent, DeckListModel *_deckListModel) diff --git a/cockatrice/src/interface/widgets/visual_deck_editor/visual_deck_editor_sample_hand_widget.h b/cockatrice/src/interface/widgets/visual_deck_editor/visual_deck_editor_sample_hand_widget.h index 97c3bed28..6aaa6ca23 100644 --- a/cockatrice/src/interface/widgets/visual_deck_editor/visual_deck_editor_sample_hand_widget.h +++ b/cockatrice/src/interface/widgets/visual_deck_editor/visual_deck_editor_sample_hand_widget.h @@ -7,13 +7,13 @@ #ifndef VISUAL_DECK_EDITOR_SAMPLE_HAND_WIDGET_H #define VISUAL_DECK_EDITOR_SAMPLE_HAND_WIDGET_H -#include "../../../deck/deck_list_model.h" #include "../cards/card_size_widget.h" #include "../general/layout_containers/flow_widget.h" #include #include #include +#include class VisualDeckEditorSampleHandWidget : public QWidget { diff --git a/cockatrice/src/interface/widgets/visual_deck_editor/visual_deck_editor_widget.cpp b/cockatrice/src/interface/widgets/visual_deck_editor/visual_deck_editor_widget.cpp index 6a23d8215..d7efab3a7 100644 --- a/cockatrice/src/interface/widgets/visual_deck_editor/visual_deck_editor_widget.cpp +++ b/cockatrice/src/interface/widgets/visual_deck_editor/visual_deck_editor_widget.cpp @@ -1,14 +1,6 @@ #include "visual_deck_editor_widget.h" -#include "../../../database/card_database.h" -#include "../../../database/card_database_manager.h" -#include "../../../database/model/card/card_completer_proxy_model.h" -#include "../../../database/model/card/card_search_model.h" -#include "../../../database/model/card_database_model.h" -#include "../../../deck/deck_list_model.h" -#include "../../../deck/deck_loader.h" #include "../../../main.h" -#include "../../../utility/card_info_comparator.h" #include "../../layouts/overlap_layout.h" #include "../cards/card_info_picture_with_text_overlay_widget.h" #include "../cards/deck_card_zone_display_widget.h" @@ -21,6 +13,14 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include #include VisualDeckEditorWidget::VisualDeckEditorWidget(QWidget *parent, DeckListModel *_deckListModel) diff --git a/cockatrice/src/interface/widgets/visual_deck_editor/visual_deck_editor_widget.h b/cockatrice/src/interface/widgets/visual_deck_editor/visual_deck_editor_widget.h index 5453b6e22..80e41c4f0 100644 --- a/cockatrice/src/interface/widgets/visual_deck_editor/visual_deck_editor_widget.h +++ b/cockatrice/src/interface/widgets/visual_deck_editor/visual_deck_editor_widget.h @@ -7,11 +7,6 @@ #ifndef VISUAL_DECK_EDITOR_H #define VISUAL_DECK_EDITOR_H -#include "../../../database/card_database.h" -#include "../../../database/model/card/card_completer_proxy_model.h" -#include "../../../database/model/card_database_display_model.h" -#include "../../../database/model/card_database_model.h" -#include "../../../deck/deck_list_model.h" #include "../cards/card_info_picture_with_text_overlay_widget.h" #include "../cards/card_size_widget.h" #include "../general/layout_containers/flow_widget.h" @@ -22,6 +17,11 @@ #include #include #include +#include +#include +#include +#include +#include #include class DeckCardZoneDisplayWidget; diff --git a/cockatrice/src/interface/widgets/visual_deck_storage/deck_preview/deck_preview_deck_tags_display_widget.cpp b/cockatrice/src/interface/widgets/visual_deck_storage/deck_preview/deck_preview_deck_tags_display_widget.cpp index 6dc579c5b..4053de89b 100644 --- a/cockatrice/src/interface/widgets/visual_deck_storage/deck_preview/deck_preview_deck_tags_display_widget.cpp +++ b/cockatrice/src/interface/widgets/visual_deck_storage/deck_preview/deck_preview_deck_tags_display_widget.cpp @@ -1,8 +1,7 @@ #include "deck_preview_deck_tags_display_widget.h" -#include "../../../../dialogs/dlg_convert_deck_to_cod_format.h" -#include "../../../../settings/cache_settings.h" -#include "../../../../tabs/tab_deck_editor.h" +#include "../../../../interface/widgets/dialogs/dlg_convert_deck_to_cod_format.h" +#include "../../../../interface/widgets/tabs/tab_deck_editor.h" #include "../../general/layout_containers/flow_widget.h" #include "deck_preview_tag_addition_widget.h" #include "deck_preview_tag_dialog.h" @@ -13,6 +12,7 @@ #include #include #include +#include DeckPreviewDeckTagsDisplayWidget::DeckPreviewDeckTagsDisplayWidget(QWidget *_parent, DeckList *_deckList) : QWidget(_parent), deckList(nullptr) diff --git a/cockatrice/src/interface/widgets/visual_deck_storage/deck_preview/deck_preview_deck_tags_display_widget.h b/cockatrice/src/interface/widgets/visual_deck_storage/deck_preview/deck_preview_deck_tags_display_widget.h index 86f544bd1..ceb02b0f5 100644 --- a/cockatrice/src/interface/widgets/visual_deck_storage/deck_preview/deck_preview_deck_tags_display_widget.h +++ b/cockatrice/src/interface/widgets/visual_deck_storage/deck_preview/deck_preview_deck_tags_display_widget.h @@ -7,10 +7,10 @@ #ifndef DECK_PREVIEW_DECK_TAGS_DISPLAY_WIDGET_H #define DECK_PREVIEW_DECK_TAGS_DISPLAY_WIDGET_H -#include "../../../../deck/deck_loader.h" #include "deck_preview_widget.h" #include +#include inline bool confirmOverwriteIfExists(QWidget *parent, const QString &filePath); diff --git a/cockatrice/src/interface/widgets/visual_deck_storage/deck_preview/deck_preview_tag_addition_widget.cpp b/cockatrice/src/interface/widgets/visual_deck_storage/deck_preview/deck_preview_tag_addition_widget.cpp index df9fa72ae..a8979bae9 100644 --- a/cockatrice/src/interface/widgets/visual_deck_storage/deck_preview/deck_preview_tag_addition_widget.cpp +++ b/cockatrice/src/interface/widgets/visual_deck_storage/deck_preview/deck_preview_tag_addition_widget.cpp @@ -1,13 +1,13 @@ #include "deck_preview_tag_addition_widget.h" -#include "../../../../settings/cache_settings.h" -#include "../../../../tabs/abstract_tab_deck_editor.h" +#include "../../../../interface/widgets/tabs/abstract_tab_deck_editor.h" #include "deck_preview_tag_dialog.h" #include #include #include #include +#include #include DeckPreviewTagAdditionWidget::DeckPreviewTagAdditionWidget(QWidget *_parent, QString _tagName) diff --git a/cockatrice/src/interface/widgets/visual_deck_storage/deck_preview/deck_preview_tag_dialog.cpp b/cockatrice/src/interface/widgets/visual_deck_storage/deck_preview/deck_preview_tag_dialog.cpp index 601a03394..9d130946f 100644 --- a/cockatrice/src/interface/widgets/visual_deck_storage/deck_preview/deck_preview_tag_dialog.cpp +++ b/cockatrice/src/interface/widgets/visual_deck_storage/deck_preview/deck_preview_tag_dialog.cpp @@ -1,7 +1,6 @@ #include "deck_preview_tag_dialog.h" -#include "../../../../dialogs/dlg_default_tags_editor.h" -#include "../../../../settings/cache_settings.h" +#include "../../../../interface/widgets/dialogs/dlg_default_tags_editor.h" #include "deck_preview_tag_item_widget.h" #include @@ -12,6 +11,7 @@ #include #include #include +#include DeckPreviewTagDialog::DeckPreviewTagDialog(const QStringList &knownTags, const QStringList &_activeTags, diff --git a/cockatrice/src/interface/widgets/visual_deck_storage/deck_preview/deck_preview_widget.cpp b/cockatrice/src/interface/widgets/visual_deck_storage/deck_preview/deck_preview_widget.cpp index 695918861..afa6b6d72 100644 --- a/cockatrice/src/interface/widgets/visual_deck_storage/deck_preview/deck_preview_widget.cpp +++ b/cockatrice/src/interface/widgets/visual_deck_storage/deck_preview/deck_preview_widget.cpp @@ -1,7 +1,5 @@ #include "deck_preview_widget.h" -#include "../../../../database/card_database_manager.h" -#include "../../../../settings/cache_settings.h" #include "../../cards/additional_info/color_identity_widget.h" #include "../../cards/deck_preview_card_picture_widget.h" #include "deck_preview_deck_tags_display_widget.h" @@ -15,6 +13,8 @@ #include #include #include +#include +#include DeckPreviewWidget::DeckPreviewWidget(QWidget *_parent, VisualDeckStorageWidget *_visualDeckStorageWidget, diff --git a/cockatrice/src/interface/widgets/visual_deck_storage/deck_preview/deck_preview_widget.h b/cockatrice/src/interface/widgets/visual_deck_storage/deck_preview/deck_preview_widget.h index 152cb3e97..e780f9369 100644 --- a/cockatrice/src/interface/widgets/visual_deck_storage/deck_preview/deck_preview_widget.h +++ b/cockatrice/src/interface/widgets/visual_deck_storage/deck_preview/deck_preview_widget.h @@ -7,7 +7,6 @@ #ifndef DECK_PREVIEW_WIDGET_H #define DECK_PREVIEW_WIDGET_H -#include "../../../../deck/deck_loader.h" #include "../../cards/additional_info/color_identity_widget.h" #include "../../cards/deck_preview_card_picture_widget.h" #include "../visual_deck_storage_widget.h" @@ -19,6 +18,7 @@ #include #include #include +#include class QMenu; class VisualDeckStorageWidget; diff --git a/cockatrice/src/interface/widgets/visual_deck_storage/visual_deck_storage_folder_display_widget.cpp b/cockatrice/src/interface/widgets/visual_deck_storage/visual_deck_storage_folder_display_widget.cpp index 235e62deb..f36b84a1c 100644 --- a/cockatrice/src/interface/widgets/visual_deck_storage/visual_deck_storage_folder_display_widget.cpp +++ b/cockatrice/src/interface/widgets/visual_deck_storage/visual_deck_storage_folder_display_widget.cpp @@ -1,10 +1,10 @@ #include "visual_deck_storage_folder_display_widget.h" -#include "../../../settings/cache_settings.h" #include "deck_preview/deck_preview_widget.h" #include #include +#include VisualDeckStorageFolderDisplayWidget::VisualDeckStorageFolderDisplayWidget( QWidget *parent, diff --git a/cockatrice/src/interface/widgets/visual_deck_storage/visual_deck_storage_quick_settings_widget.cpp b/cockatrice/src/interface/widgets/visual_deck_storage/visual_deck_storage_quick_settings_widget.cpp index 6e269a9b5..19bf070c9 100644 --- a/cockatrice/src/interface/widgets/visual_deck_storage/visual_deck_storage_quick_settings_widget.cpp +++ b/cockatrice/src/interface/widgets/visual_deck_storage/visual_deck_storage_quick_settings_widget.cpp @@ -1,11 +1,11 @@ #include "visual_deck_storage_quick_settings_widget.h" -#include "../../../settings/cache_settings.h" #include "visual_deck_storage_widget.h" #include #include #include +#include VisualDeckStorageQuickSettingsWidget::VisualDeckStorageQuickSettingsWidget(QWidget *parent) : SettingsButtonWidget(parent) diff --git a/cockatrice/src/interface/widgets/visual_deck_storage/visual_deck_storage_search_widget.cpp b/cockatrice/src/interface/widgets/visual_deck_storage/visual_deck_storage_search_widget.cpp index 69fb1025a..18430d698 100644 --- a/cockatrice/src/interface/widgets/visual_deck_storage/visual_deck_storage_search_widget.cpp +++ b/cockatrice/src/interface/widgets/visual_deck_storage/visual_deck_storage_search_widget.cpp @@ -2,10 +2,10 @@ #include "../../../filters/deck_filter_string.h" #include "../../../filters/syntax_help.h" -#include "../../../settings/cache_settings.h" #include "../../pixel_map_generator.h" #include +#include /** * @brief Constructs a PrintingSelectorCardSearchWidget for searching cards by set name or set code. diff --git a/cockatrice/src/interface/widgets/visual_deck_storage/visual_deck_storage_sort_widget.cpp b/cockatrice/src/interface/widgets/visual_deck_storage/visual_deck_storage_sort_widget.cpp index c7917ed44..c68dfdc3b 100644 --- a/cockatrice/src/interface/widgets/visual_deck_storage/visual_deck_storage_sort_widget.cpp +++ b/cockatrice/src/interface/widgets/visual_deck_storage/visual_deck_storage_sort_widget.cpp @@ -1,6 +1,6 @@ #include "visual_deck_storage_sort_widget.h" -#include "../../../settings/cache_settings.h" +#include /** * @brief Constructs a PrintingSelectorCardSortWidget for searching cards by set name or set code. diff --git a/cockatrice/src/interface/widgets/visual_deck_storage/visual_deck_storage_widget.cpp b/cockatrice/src/interface/widgets/visual_deck_storage/visual_deck_storage_widget.cpp index 36f9c7705..164aff8bc 100644 --- a/cockatrice/src/interface/widgets/visual_deck_storage/visual_deck_storage_widget.cpp +++ b/cockatrice/src/interface/widgets/visual_deck_storage/visual_deck_storage_widget.cpp @@ -1,7 +1,5 @@ #include "visual_deck_storage_widget.h" -#include "../../../database/card_database_manager.h" -#include "../../../settings/cache_settings.h" #include "../quick_settings/settings_button_widget.h" #include "deck_preview/deck_preview_widget.h" #include "visual_deck_storage_folder_display_widget.h" @@ -14,6 +12,8 @@ #include #include #include +#include +#include VisualDeckStorageWidget::VisualDeckStorageWidget(QWidget *parent) : QWidget(parent), folderWidget(nullptr) { diff --git a/cockatrice/src/interface/widgets/visual_deck_storage/visual_deck_storage_widget.h b/cockatrice/src/interface/widgets/visual_deck_storage/visual_deck_storage_widget.h index 64741e803..54bbc954f 100644 --- a/cockatrice/src/interface/widgets/visual_deck_storage/visual_deck_storage_widget.h +++ b/cockatrice/src/interface/widgets/visual_deck_storage/visual_deck_storage_widget.h @@ -7,7 +7,6 @@ #ifndef VISUAL_DECK_STORAGE_WIDGET_H #define VISUAL_DECK_STORAGE_WIDGET_H -#include "../../../deck/deck_list_model.h" #include "../cards/card_size_widget.h" #include "../general/layout_containers/flow_widget.h" #include "../quick_settings/settings_button_widget.h" @@ -21,6 +20,7 @@ #include #include +#include class QSpinBox; class VisualDeckStorageSearchWidget; diff --git a/cockatrice/src/interface/window_main.cpp b/cockatrice/src/interface/window_main.cpp index f1117c369..de6c90a98 100644 --- a/cockatrice/src/interface/window_main.cpp +++ b/cockatrice/src/interface/window_main.cpp @@ -19,37 +19,25 @@ ***************************************************************************/ #include "window_main.h" -#include "../client/get_text_with_max.h" -#include "../client/network/client_update_checker.h" -#include "../client/network/release_channel.h" -#include "../database/card_database.h" -#include "../database/card_database_manager.h" -#include "../dialogs/dlg_connect.h" -#include "../dialogs/dlg_edit_tokens.h" -#include "../dialogs/dlg_forgot_password_challenge.h" -#include "../dialogs/dlg_forgot_password_request.h" -#include "../dialogs/dlg_forgot_password_reset.h" -#include "../dialogs/dlg_manage_sets.h" -#include "../dialogs/dlg_register.h" -#include "../dialogs/dlg_settings.h" -#include "../dialogs/dlg_startup_card_check.h" -#include "../dialogs/dlg_tip_of_the_day.h" -#include "../dialogs/dlg_update.h" -#include "../dialogs/dlg_view_log.h" +#include "../client/network/update/client/client_update_checker.h" +#include "../client/network/update/client/release_channel.h" +#include "../interface/widgets/dialogs/dlg_connect.h" +#include "../interface/widgets/dialogs/dlg_edit_tokens.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_manage_sets.h" +#include "../interface/widgets/dialogs/dlg_register.h" +#include "../interface/widgets/dialogs/dlg_settings.h" +#include "../interface/widgets/dialogs/dlg_startup_card_check.h" +#include "../interface/widgets/dialogs/dlg_tip_of_the_day.h" +#include "../interface/widgets/dialogs/dlg_update.h" +#include "../interface/widgets/dialogs/dlg_view_log.h" +#include "../interface/widgets/tabs/tab_game.h" +#include "../interface/widgets/tabs/tab_supervisor.h" #include "../main.h" -#include "../server/local_client.h" -#include "../server/local_server.h" -#include "../server/local_server_interface.h" -#include "../server/remote/remote_client.h" -#include "../settings/cache_settings.h" -#include "../tabs/tab_game.h" -#include "../tabs/tab_supervisor.h" -#include "../utility/logger.h" -#include "pb/event_connection_closed.pb.h" -#include "pb/event_server_shutdown.pb.h" -#include "pb/game_replay.pb.h" -#include "pb/room_commands.pb.h" #include "version_string.h" +#include "widgets/utility/get_text_with_max.h" #include #include @@ -72,6 +60,18 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #define GITHUB_PAGES_URL "https://cockatrice.github.io" #define GITHUB_CONTRIBUTORS_URL "https://github.com/Cockatrice/Cockatrice/graphs/contributors?type=c" diff --git a/cockatrice/src/interface/window_main.h b/cockatrice/src/interface/window_main.h index 3b1b25638..620a09467 100644 --- a/cockatrice/src/interface/window_main.h +++ b/cockatrice/src/interface/window_main.h @@ -25,9 +25,6 @@ #ifndef WINDOW_H #define WINDOW_H -#include "../server/abstract_client.h" -#include "pb/response.pb.h" - #include #include #include @@ -35,6 +32,8 @@ #include #include #include +#include +#include inline Q_LOGGING_CATEGORY(WindowMainLog, "window_main"); inline Q_LOGGING_CATEGORY(WindowMainStartupLog, "window_main.startup"); diff --git a/cockatrice/src/main.cpp b/cockatrice/src/main.cpp index 3a047ef98..2c79297ef 100644 --- a/cockatrice/src/main.cpp +++ b/cockatrice/src/main.cpp @@ -21,16 +21,12 @@ #include "main.h" #include "QtNetwork/QNetworkInterface" -#include "client/network/spoiler_background_updater.h" +#include "client/network/update/card_spoiler/spoiler_background_updater.h" #include "client/sound_engine.h" -#include "dialogs/dlg_settings.h" -#include "featureset.h" #include "interface/pixel_map_generator.h" #include "interface/theme_manager.h" +#include "interface/widgets/dialogs/dlg_settings.h" #include "interface/window_main.h" -#include "rng_sfmt.h" -#include "settings/cache_settings.h" -#include "utility/logger.h" #include "version_string.h" #include @@ -45,6 +41,10 @@ #include #include #include +#include +#include +#include +#include QTranslator *translator, *qtTranslator; RNG_Abstract *rng; diff --git a/cockatrice/src/main.h b/cockatrice/src/main.h index 1cdc4e78d..487abc0ea 100644 --- a/cockatrice/src/main.h +++ b/cockatrice/src/main.h @@ -7,9 +7,8 @@ #ifndef MAIN_H #define MAIN_H -#include "utility/macros.h" - #include +#include inline Q_LOGGING_CATEGORY(MainLog, "main"); inline Q_LOGGING_CATEGORY(QtTranslatorDebug, "qt_translator"); diff --git a/cockatrice/translations/cockatrice_it.ts b/cockatrice/translations/cockatrice_it.ts index 09941a2bd..9fefa58df 100644 --- a/cockatrice/translations/cockatrice_it.ts +++ b/cockatrice/translations/cockatrice_it.ts @@ -58,8 +58,8 @@ Vuoi salvare i cambiamenti? - - + + Error Errore @@ -92,12 +92,12 @@ Controlla se la cartella è valida e prova ancora. Il mazzo non può essere salvato. - + There are no cards in your deck to be exported Non ci sono carte da esportare nel tuo mazzo - + No deck was selected to be exported. Nessun mazzo da esportare è stato selezionato. @@ -118,12 +118,12 @@ Controlla se la cartella è valida e prova ancora. AllZonesCardAmountWidget - + Mainboard Mazzo - + Sideboard Sideboard @@ -131,142 +131,180 @@ Controlla se la cartella è valida e prova ancora. AppearanceSettingsPage - + + seconds + secondi + + + Error Errore - + Could not create themes directory at '%1'. Impossibile creare la cartella dei temi in '%1'. - + Theme settings Impostazioni temi - + Current theme: Tema attuale: - + Open themes folder Apri cartella temi - + + Home tab background source: + Sorgente dello sfondo della Home: + + + + Home tab background shuffle frequency: + Frequenza di modifica dello sfondo della Home: + + + + Disabled + Disattivato + + + Menu settings Impostazioni menù - + Show keyboard shortcuts in right-click menus Mostra scorciatoie da tastiera nel menù del tasto destro del mouse - + Card rendering Visualizzazione delle carte - + Display card names on cards having a picture Visualizza nome delle carte sopra le immagini - + Auto-Rotate cards with sideways layout Ruota automaticamente carte con disposizione orizzontale - + Override all card art with personal set preference (Pre-ProviderID change behavior) [Requires Client restart] Sovrascrivi tutte le immagini delle carte con set personale (Comportamento pre-modifica Provider ID) [richiede riavvio] - + Bump sets that the deck contains cards from to the top in the printing selector Nel selettore di stampa, mostra per primi i set delle carte che il mazzo contiene - + Scale cards on mouse over Ingrandisci la carta sotto il mouse - + Use rounded card corners Usa i bordi delle carte arrotondati - + Minimum overlap percentage of cards on the stack and in vertical hand Sovrapposizione % minima delle carte in pila e nella mano verticale: - + Maximum initial height for card view window: Altezza iniziale massima per la finestra di visualizzazione delle carte: - - + + rows file - + Maximum expanded height for card view window: Altezza massima per la finestra di visualizzazione delle carte: - + Card counters Segnalini della carta - + Counter %1 Segnalino %1 - + Hand layout Disposizione della mano - + Display hand horizontally (wastes space) Disponi la mano orizzontalmente (spreca spazio) - + Enable left justification Allinea a sinistra - + Table grid layout Disposizione delle aree di gioco - + Invert vertical coordinate Inverti disposizione verticale - + Minimum player count for multi-column layout: Numero di giocatori minimo per disposizione multicolonna: - + Maximum font size for information displayed on cards: Dimensione massima carattere per le informazioni mostrate sulle carte: + + BackgroundSources + + + Theme + Tema + + + + Art crop of random card + Illustrazione di una carta casuale + + + + Art crop of background.cod deck file + Illustrazione di un file background.cod + + BanDialog @@ -406,32 +444,32 @@ Questa è visibile solo ai moderatori e non alla persona bannata. CardDatabaseModel - + Name Nome - + Sets Set - + Mana cost Costo - + Card type Tipo - + P/T F/C - + Color(s) Colore @@ -439,96 +477,96 @@ Questa è visibile solo ai moderatori e non alla persona bannata. CardFilter - + AND Logical conjunction operator used in card filter AND - + OR Logical disjunction operator used in card filter OR - + AND NOT Negated logical conjunction operator used in card filter AND NOT - + OR NOT Negated logical disjunction operator used in card filter OR NOT - + Name Nome - + Type Tipo - + Color Colore - + Text Testo - + Set Set - + Mana Cost Costo di mana - + Mana Value Valore di mana - + Rarity Rarità - + Power Forza - + Toughness Costituzione - + Loyalty Fedeltà - + Format Formato - + Main Type Tipo - + Sub Type Sottotipo @@ -536,22 +574,22 @@ Questa è visibile solo ai moderatori e non alla persona bannata. CardInfoFrameWidget - + Image Immagine - + Description Descrizione - + Both Entrambi - + View transformation Visualizza trasformazione @@ -559,22 +597,22 @@ Questa è visibile solo ai moderatori e non alla persona bannata. CardInfoPictureWidget - + View related cards Guarda carte correlate - + Add card to deck Aggiungi la carta al &mazzo - + Mainboard Mazzo - + Sideboard Sideboard @@ -598,16 +636,128 @@ Questa è visibile solo ai moderatori e non alla persona bannata. - CardItem + CardMenu - - &Move to - &Metti in + + Re&veal to... + Ri&vela a... - - &Power / toughness - &Forza / Costituzione + + &All players + &Tutti i giocatori + + + + View related cards + Guarda carte correlate + + + + Token: + Pedina: + + + + All tokens + Tutte le pedine + + + + &Select All + &Seleziona tutto + + + + S&elect Row + S&eleziona fila + + + + S&elect Column + S&eleziona colonna + + + + &Play + &Gioca + + + + &Hide + &Nascondi + + + + Play &Face Down + Gioca a &faccia in giù + + + + &Tap / Untap + Turn sideways or back again + &TAPpa/STAPpa + + + + Toggle &normal untapping + Blocca/Sblocca &STAP normale + + + + T&urn Over + Turn face up/face down + Capovolgi + + + + &Peek at card face + &Sbircia la faccia della carta + + + + &Clone + &Copia + + + + Attac&h to card... + Asse&gna alla carta... + + + + Unattac&h + Tog&li + + + + &Draw arrow... + &Disegna una freccia... + + + + &Set annotation... + &Imposta note... + + + + Ca&rd counters + Segnalini delle ca&rte + + + + &Add counter (%1) + &Aggiungi segnalino (%1) + + + + &Remove counter (%1) + &Rimuovi segnalino (%1) + + + + &Set counters (%1)... + Imposta &segnalini (%1)... @@ -619,135 +769,135 @@ Questa è visibile solo ai moderatori e non alla persona bannata. - CardZone + CardZoneLogic - + their hand nominative la sua mano - + %1's hand nominative Mano di %1 - + their library look at zone il suo grimorio - + %1's library look at zone Grimorio di %1 - + of their library top cards of zone, del suo grimorio - + of %1's library top cards of zone del grimorio di %1 - + their library reveal zone il suo grimorio - + %1's library reveal zone Grimorio di %1 - + their library shuffle il suo grimorio - + %1's library shuffle Grimorio di %1 - + their library nominative il suo grimorio - + %1's library nominative Grimorio di %1 - + their graveyard nominative il suo cimitero - + %1's graveyard nominative Cimitero di %1 - + their exile nominative la sua zona di esilio - + %1's exile nominative Esilio di %1 - + their sideboard look at zone la sua sideboard - + %1's sideboard look at zone Sideboard di %1 - + their sideboard nominative la sua sideboard - + %1's sideboard nominative Sideboard di %1 - + their custom zone '%1' nominative la sua zona personalizzata '%1' - + %1's custom zone '%2' nominative la zona personalizzata '%2' di %1 @@ -756,7 +906,7 @@ Questa è visibile solo ai moderatori e non alla persona bannata. CockatriceXml3Parser - + Parse error at line %1 col %2: Errore di lettura alla riga %1 posizione %2: @@ -764,11 +914,25 @@ Questa è visibile solo ai moderatori e non alla persona bannata. CockatriceXml4Parser - + Parse error at line %1 col %2: Errore di lettura alla riga %1 posizione %2: + + CustomZoneMenu + + + C&ustom Zones + &Zone personalizzate + + + + + View custom zone '%1' + Visualizza la zona personalizzata '%1' + + DeckEditorCardInfoDockWidget @@ -785,42 +949,42 @@ Questa è visibile solo ai moderatori e non alla persona bannata. Cerca per nome della carta (o espressioni di ricerca) - + Add to Deck Aggiungi al mazzo - + Add to Sideboard Aggiungi alla sideboard - + Select Printing Seleziona stampa - - Show on EDHREC (Commander) - Mostra su EDHREC (Commander) - - - - Show on EDHREC (Card) - Mostra su EDHREC (Carta) + + Show on EDHRec (Commander) + Mostra su EDHRec (Commander) + Show on EDHRec (Card) + Mostra su EDHRec (Carta) + + + Show Related cards Mostra carte correlate - + Add card to &maindeck Aggiungi carta al &mazzo - + Add card to &sideboard Aggiungi carta alla &sideboard @@ -848,67 +1012,67 @@ Questa è visibile solo ai moderatori e non alla persona bannata. Colori - + Select Printing Seleziona stampa - + Deck Mazzo - + Deck &name: &Nome mazzo: - + Banner Card/Tags Visibility Settings Impostazioni carta copertina/etichette - + Show banner card selection menu Visualizza menu di selezione carta copertina - + Show tags selection menu Visualizza menu di selezione etichette - + &Comments: &Commenti: - + Group by: Raggruppa per: - + Hash: Hash: - + &Increment number &Aumenta il numero - + &Decrement number &Diminuisci il numero - + &Remove row &Rimuovi carta - + Swap card to/from sideboard Sposta carta in maindeck/sideboard @@ -934,109 +1098,114 @@ Questa è visibile solo ai moderatori e non alla persona bannata. DeckEditorMenu - + &Deck Editor &Editor dei mazzi - + &New deck &Nuovo mazzo - + &Load deck... &Carica mazzo... - + Load recent deck... Carica mazzo recente... - + Clear Svuota - + &Save deck &Salva mazzo - + Save deck &as... Salva mazzo &con nome... - + Load deck from cl&ipboard... Carica mazzo dagli app&unti... - + Edit deck in clipboard Modifica mazzo negli appunti - + Annotated Con annotazioni - - + + Not Annotated Senza annotazioni - + Save deck to clipboard Salva il mazzo negli appunti - + Annotated (No set info) Con annotazioni (senza info set) - + Not Annotated (No set info) Senza annotazioni (senza info set) - + &Print deck... Stam&pa mazzo... - + + Load deck from online service... + Carica mazzo dal servizio online... + + + &Send deck to online service &Invia mazzo al servizio online - + Create decklist (decklist.org) Crea una decklist (decklist.org) - + Create decklist (decklist.xyz) Crea una decklist (decklist.xyz) - + Analyze deck (deckstats.net) Analizza mazzo (deckstats.net) - + Analyze deck (tappedout.net) Analizza mazzo (tappedout.net) - + &Close &Chiudi @@ -1052,166 +1221,166 @@ Questa è visibile solo ai moderatori e non alla persona bannata. DeckEditorSettingsPage - - + + Update Spoilers Aggiorna Spoiler - - + + Success Fatto - + Download URLs have been reset. Gli indirizzi di download sono stati resettati. - + Downloaded card pictures have been reset. Le immagini delle carte scaricate sono state eliminate. - + Error Errore - + One or more downloaded card pictures could not be cleared. Non è stato possibile eliminare alcune delle immagini delle carte scaricate. - + Add URL Aggiungi indirizzo - - + + URL: Indirizzo: - - + + Edit URL Modifica indirizzo: - + Network Cache Size: Dimensione cache di rete: - + Redirect Cache TTL: TTL cache dei reindirizzamenti: - + How long cached redirects for urls are valid for. Per quanto tempo sono validi i reindirizzamenti per gli URL memorizzati nella cache. - + Picture Cache Size: Dimensione cache immagini: - + Add New URL Aggiungi indirizzo URL - + Remove URL Elimina indirizzo URL - + Day(s) Giorno/i - + Updating... Aggiornando... - + Choose path Scegli il percorso - + URL Download Priority Ordine di priorità degli indirizzi - + Spoilers Spoiler - + Download Spoilers Automatically Scarica spoiler automaticamente - + Spoiler Location: Indirizzo spoiler: - + Last Change Ultima modifica - + Spoilers download automatically on launch Scarica spoiler automaticamente all'avvio - + Press the button to manually update without relaunching Premi il pulsante per aggiornare manualmente senza riavviare - + Do not close settings until manual update is complete Non chiudere le impostazioni fino a che l'aggiornamento manuale sia completato - + Download card pictures on the fly Scarica immagini delle carte in tempo reale - + How to add a custom URL Come aggiungere indirizzi personalizzati - + Delete Downloaded Images Elimina immagini scaricate - + Reset Download URLs Resetta indirizzi di download - + On-disk cache for downloaded pictures Cache su disco immagini scaricate - + In-memory cache for pictures not currently on screen Cache in memoria per immagini non attualmente su schermo @@ -1219,27 +1388,27 @@ Questa è visibile solo ai moderatori e non alla persona bannata. DeckListModel - + Count Quantità - + Set Set - + Number Numero - + Provider ID ID Provider - + Card Carta @@ -1247,12 +1416,12 @@ Questa è visibile solo ai moderatori e non alla persona bannata. DeckLoader - + Common deck formats (%1) Formati di mazzo comuni (%1) - + All files (*.*) Tutti i file (*.*) @@ -1354,89 +1523,89 @@ Questa è visibile solo ai moderatori e non alla persona bannata. Carta copertina - + Open in deck editor Apri nell'editor dei mazzi - + Edit Tags Modifica etichette - + Rename Deck Rinomina mazzo - + Save Deck to Clipboard Salva il mazzo negli appunti - + Annotated Con annotazioni - + Annotated (No set info) Con annotazioni (senza info set) - + Not Annotated Senza annotazioni - + Not Annotated (No set info) Senza annotazioni (senza info set) - + Rename File Rinomina file - + Delete File Elimina file - + Set Banner Card Imposta carta copertina - - + + New name: Nuovo nome: - - + + Error Errore - + Rename failed Rinomina non riuscita - + Delete file Elimina file - + Are you sure you want to delete the selected file? Vuoi davvero eliminare il file selezionato? - + Delete failed Eliminazione non riuscita @@ -1444,13 +1613,13 @@ Questa è visibile solo ai moderatori e non alla persona bannata. DeckStatsInterface - - + + Error Errore - + The reply from the server could not be parsed. La risposta del server non può essere analizzata. @@ -1458,71 +1627,76 @@ Questa è visibile solo ai moderatori e non alla persona bannata. DeckViewContainer - + Load deck... Carica mazzo... - + Load remote deck... Carica mazzo remoto... - + Load from clipboard... Carica dagli appunti... - + + Load from website... + Carica dal sito... + + + Unload deck Unload deck... Deseleziona mazzo - + Ready to start Pronto ad iniziare - + Force start Forza avvio - + Sideboard unlocked Sideboard sbloccata - + Sideboard locked Sideboard bloccata - - + + Error Errore - + The selected file could not be loaded. I file selezionati non posso essere caricati. - + Deck is greater than maximum file size. Il mazzo è più grande della dimensione massima del file consentita. - + Are you sure you want to force start? This will kick all non-ready players from the game. Sicuro di voler forzare l'avvio? Ciò espellerà dalla partita tutti i giocatori che non sono pronti. - + Cockatrice Cockatrice @@ -1781,32 +1955,37 @@ Vuoi convertire il mazzo al formato .cod? Punti vita iniziali: - + + Open decklists in lobby + Apri mazzi nella lobby + + + Game setup options Configurazione partita - + &Clear Pulisci - + Create game Crea partita - + Game information Informazioni partita - + Error Errore - + Server error. Errore del server. @@ -2248,77 +2427,82 @@ Assicurati di abilitare il set "Pedine" nella finestra "Organizza Nascondi partite non create dagli amici - + + Hide games with forced open decklists + Nascondi partite con liste di mazzo rivelate + + + &Newer than: &Più nuovo di: - + Game &description: &Descrizione partita: - + &Creator name: Nome &creatore: - + General Generale - + &Game types Tipi di &partita - + at &least: Minimo: - + at &most: Massimo: - + Maximum player count Numero di giocatori - + Restrictions Restrizioni - + Show games only if &spectators can watch Mostra le partite solo se &gli spettatori possono guardare - + Show spectator password p&rotected games Mostra partite protette da password - + Show only if spectators can ch&at Mostra le partite solo se gli spettatori possono guardare - + Show only if spectators can see &hands Mostra le partite solo se gli spettatori possono guardare le mani - + Spectators Spettatori - + Filter games Filtro partite @@ -2527,6 +2711,64 @@ Assicurati di abilitare il set "Pedine" nella finestra "Organizza Lista del mazzo non valida. + + DlgLoadDeckFromWebsite + + + Paste a link to a decklist site here to import it. +(Archidekt, Deckstats, Moxfield, and TappedOut are supported.) + Incolla il link a una lista di mazzo online per importarla. +(Sono supportati Archidekt, Deckstats, Moxfield, e TappedOut). + + + + + + + + Load Deck from Website + Carica Mazzo dal Sito + + + + No parser available for this deck provider. + (Archidekt, Deckstats, Moxfield, and TappedOut are supported.) + Impossibile acquisire lista di mazzo da questo sito. +(Sono supportati Archidekt, Deckstats, Moxfield, e TappedOut). + + + + Network error: %1 + Errore di rete: %1 + + + + Received empty deck data. + Ricevuta lista di mazzo vuota. + + + + Failed to parse deck data: %1 + Impossibile acquisire i dati del mazzo: %1 + + + + The provided URL is not recognized as a valid deck URL. +Valid deck URLs look like this: + +https://archidekt.com/decks/9999999 +https://deckstats.net/decks/99999/9999999-your-deck-name/en +https://moxfield.com/decks/XYZxx-XYZ99Yyy-xyzXzzz +https://tappedout.net/mtg-decks/your-deck-name/ + L'URL fornito non è riconosciuto come valido. +Un URL valido assomiglia a uno di questi: + +https://archidekt.com/decks/9999999 +https://deckstats.net/decks/99999/9999999-nome-del-tuo-mazzo/en +https://moxfield.com/decks/XYZxx-XYZ99Yyy-xyzXzzz +https://tappedout.net/mtg-decks/nome-del-tuo-mazzo/ + + DlgLoadRemoteDeck @@ -2715,12 +2957,12 @@ La tua email verrà utilizzata per verificare il tuo account. DlgSettings - + Unknown Error loading card database Errore sconosciuto durante il caricamento del database delle carte - + Your card database is invalid. Cockatrice may not function correctly with an invalid database @@ -2737,7 +2979,7 @@ Ti consigliamo di avviare oracle per aggiornare il tuo database delle carte. Vuoi modificare le impostazioni della posizione del database della carte? - + Your card database version is too old. This can cause problems loading card information or images @@ -2754,7 +2996,7 @@ Ti consigliamo di avviare oracle per aggiornare il tuo database delle carte. Vuoi modificare le impostazioni della posizione del database della carte? - + Your card database did not finish loading Please file a ticket at https://github.com/Cockatrice/Cockatrice/issues with your cards.xml attached @@ -2766,7 +3008,7 @@ Per favore crea un ticket di assistenza su https://github.com/Cockatrice/Cockatr Desideri modificare l'impostazione della posizione del database? - + File Error loading your card database. Would you like to change your database location setting? @@ -2775,7 +3017,7 @@ Would you like to change your database location setting? Vuoi modificare le impostazioni della posizione del database della carte? - + Your card database was loaded but contains no cards. Would you like to change your database location setting? @@ -2784,7 +3026,7 @@ Would you like to change your database location setting? Vuoi modificare le impostazioni della posizione del database della carte? - + Unknown card database load status Please file a ticket at https://github.com/Cockatrice/Cockatrice/issues @@ -2797,59 +3039,59 @@ https://github.com/Cockatrice/Cockatrice/issues Desideri modificare l'impostazione della posizione del database? - - - + + + Error Errore - + The path to your deck directory is invalid. Would you like to go back and set the correct path? Il percorso della cartella del mazzo non è valido. Vuoi tornare in dietro e impostare il percorso corretto? - + The path to your card pictures directory is invalid. Would you like to go back and set the correct path? Il percorso della cartella delle immagini delle carte è invilido. Vuoi tornare indietro e impostare il percorso corretto? - + Settings Impostazioni - + General Generale - + Appearance Aspetto - + User Interface Interfaccia - + Card Sources Immagini carte - + Chat Chat - + Sound Suoni - + Shortcuts Scorciatoie @@ -3207,7 +3449,7 @@ Dovrai scaricare la nuova versione manualmente. FilterBuilder - + Type your filter here Scrivi il filtro qui @@ -3235,123 +3477,146 @@ Dovrai scaricare la nuova versione manualmente. Impossibile eliminare il filtro '%1'. + + GameEventHandler + + + kicked by game host or moderator + espulso da proprietario del gioco o moderatore + + + + player left the game + il giocatore ha lasciato la partita + + + + player disconnected from server + il giocatore si è disconnesso dal server + + + + reason unknown + ragione sconosciuta + + GameSelector - - - - - - - - - + + + + + + + + + Error Errore - + Please join the appropriate room first. Si prega di entrare prima in una stanza adeguata. - + Wrong password. Password errata. - + Spectators are not allowed in this game. Spettatori non ammessi in questa partita. - + The game is already full. La partita è piena. - + The game does not exist any more. Questa partita non esiste più. - + This game is only open to registered users. Questa partita è solo per utenti registrati. - + This game is only open to its creator's buddies. Questa stanza è aperta solo agli amici del suo creatore. - + You are being ignored by the creator of this game. Sei stato ingnorato dal creatore di questa partita. - + Join Game Entra nella partita - + Spectate Game Osserva partita - + Game Information Informazioni partita - + Join game Entra nella partita - + Password: Password: - + Please join the respective room first. Si prega di entrare prima nella rispettiva stanza. - + &Filter games &Filtra partite - + C&lear filter E&limina filtri - + C&reate Cr&ea - + &Join &Entra - + J&oin as spectator Entra c&ome spettatore - + Games shown: %1 / %2 Partite mostrate: %1 / %2 - + Games Partite @@ -3396,63 +3661,68 @@ Dovrai scaricare la nuova versione manualmente. solo utenti registrati - - + + open decklists + Apri impostazioni + + + + can chat può chattare - + see hands vede mani - + can see hands può vedere mani - + not allowed non ammessi - + Room Stanza - + Age Età - + Description Descrizione - + Creator Creatore - + Type Tipo - + Restrictions Restrizioni - + Players Giocatori - + Spectators Spettatori @@ -3460,147 +3730,474 @@ Dovrai scaricare la nuova versione manualmente. GeneralSettingsPage - + Reset all paths Reimposta tutti i percorsi - + All paths have been reset I percorsi sono stati resettati - - - - - - - + + + + + + + Choose path Seleziona il percorso - + Personal settings Impostazioni personali - + Language: Lingua: - + Paths (editing disabled in portable mode) Destinazioni (non si può personalizzare in modalità portatile) - + Paths Percorsi - + How to help with translations Come aiutare con le traduzioni - + Decks directory: Cartella mazzi: - + Filters directory: Cartella filtri: - + Replays directory: Cartella replay: - + Pictures directory: Cartella immagini: - + Card database: Database carte: - + Custom database directory: Cartella database personalizzata: - + Token database: Database pedine: - + Update channel Canale di aggiornamento: - + Check for client updates on startup Controlla gli aggiornamenti del client all'avvio - + Check for card database updates on startup Controlla gli aggiornamenti delle carte all'avvio - + Don't check Non controllare - + Prompt for update Chiedi se aggiornare - + Always update in the background Aggiorna sempre in background - + Check for card database updates every Controlla gli aggiornamenti delle carte ogni - + days giorni - + Notify if a feature supported by the server is missing in my client Avvisami se una funzionalità supportata dal server manca nel mio programma - + Automatically run Oracle when running a new version of Cockatrice Avvia automaticamente Oracle se Cockatrice è stato aggiornato - + Show tips on startup Mostra suggerimenti all'avvio - + Last update check on %1 (%2 days ago) Ultimo controllo %1 (%2 giorni fa) + + GraveyardMenu + + + &Graveyard + &Cimitero + + + + &View graveyard + &Guarda il cimitero + + + + &Move graveyard to... + &Muovi cimitero in... + + + + &Top of library + &Cima al grimorio + + + + &Bottom of library + &Fondo al grimorio + + + + &Hand + &Mano + + + + &Exile + &Esilio + + + + Reveal random card to... + Rivela carta casuale a... + + + + HandMenu + + + &Hand + &Mano + + + + &View hand + &Vedi mano + + + + &Sort hand + &Ordina mano + + + + Take &mulligan + Mu&lliga + + + + &Move hand to... + &Sposta mano in... + + + + &Top of library + &Cima al grimorio + + + + &Bottom of library + &Fondo al grimorio + + + + &Graveyard + &Cimitero + + + + &Exile + &Esilio + + + + &Reveal hand to... + &Rivela mano a... + + + + Reveal r&andom card to... + Rivela carta c&asuale a... + + + + HomeWidget + + + Create New Deck + Crea un nuovo mazzo + + + + Browse Decks + Esplora i mazzi + + + + Browse Card Database + Esplora il database delle carte + + + + Browse EDHRec + Esplora EDHRec + + + + View Replays + Guarda i replay + + + + Quit + Esci + + + + Connecting... + Connessione in corso... + + + + Connect + Connetti + + + + Play + Gioca + + + + LibraryMenu + + + &Library + &Grimorio + + + + &View library + &Guarda il grimorio + + + + View &top cards of library... + Guarda &le carte in cima al grimorio... + + + + View bottom cards of library... + Guarda le carte in fondo al grimorio... + + + + Reveal &library to... + Rive&la grimorio a... + + + + Lend library to... + Presta il grimorio a... + + + + Reveal &top cards to... + Rivela le &prime carte a... + + + + &Top of library... + &In cima al grimorio... + + + + &Bottom of library... + &In fondo al grimorio... + + + + &Always reveal top card + Rivela &sempre la prima carta + + + + &Always look at top card + &Guarda sempre la prima carta + + + + &Open deck in deck editor + &Apri il mazzo nell'editor dei mazzi + + + + &Draw card + &Pesca una carta + + + + D&raw cards... + P&esca carte... + + + + &Undo last draw + &Annulla l'ultima pescata + + + + Shuffle + Mescola + + + + &Play top card + &Gioca la prima carta + + + + Play top card &face down + Gioca la prima carta a &faccia in giù + + + + Put top card on &bottom + Metti la prima carta in fondo + + + + Move top card to grave&yard + Metti la prima carta nel c&imitero + + + + Move top card to e&xile + E&silia la prima carta + + + + Move top cards to &graveyard... + Metti le prime carte nel &cimitero... + + + + Move top cards to &exile... + &Esilia le prime carte... + + + + Put top cards on stack &until... + Metti le carte in cima alla pila fino a... + + + + Shuffle top cards... + Mescola le carte in cima... + + + + &Draw bottom card + &Pesca l'ultima carta dal fondo + + + + D&raw bottom cards... + P&esca carte dal fondo... + + + + &Play bottom card + &Gioca la carta in fondo + + + + Play bottom card &face down + Gioca la carta in fondo a &faccia in giù + + + + Move bottom card to grave&yard + Metti l'ultima carta nel c&imitero + + + + Move bottom card to e&xile + Metti l'ultima carta in esilio + + + + Move bottom cards to &graveyard... + Metti le ultime carte nel cimitero... + + + + Move bottom cards to &exile... + &Esilia le ultime carte... + + + + Put bottom card on &top + Metti l'ultima carta in cima + + + + Shuffle bottom cards... + Mescola le carte in fondo... + + MainWindow @@ -4463,586 +5060,591 @@ Il database delle carte verrà ricaricato. MessageLogWidget - + from play dal campo di battaglia - + from their graveyard dal suo cimitero - + from exile dall'esilio - + from their hand dalla sua mano - + the top card of %1's library la prima carta del grimorio di %1 - + the top card of their library la prima carta del suo grimorio - + from the top of %1's library dalla cima del grimorio di %1 - + from the top of their library dalla cima del suo grimorio - + the bottom card of %1's library l'ultima carta del grimorio di %1 - + the bottom card of their library l'ultima carta del suo grimorio - + from the bottom of %1's library dal fondo del grimorio di %1 - + from the bottom of their library dal fondo del suo grimorio - + from %1's library dal grimorio di %1 - + from their library dal suo grimorio - + from sideboard dalla sideboard - + from the stack dalla pila - + from custom zone '%1' dalla zona personalizzata '%1' - + %1 is now keeping the top card %2 revealed. %1 sta tenendo la prima carta %2 rivelata. - + %1 is not revealing the top card %2 any longer. %1 non sta più rivelando la prima carta %2. - + %1 can now look at top card %2 at any time. %1 può guardare la prima carta %2 della libreria in qualunque momento. - + %1 no longer can look at top card %2 at any time. %1 non può più guardare la prima carta %2 del mazzo in qualunque momento. - + %1 attaches %2 to %3's %4. %1 assegna %2 a %4 di %3. - + %1 has conceded the game. %1 ha concesso la partita. - + %1 has unconceded the game. %1 ha annullato la concessione della partita. - + %1 has restored connection to the game. %1 ha ripristinato il collegamento alla partita. - + %1 has lost connection to the game. %1 ha perso il collegamento alla partita. - + %1 points from their %2 to themselves. %1 disegna una freccia dal suo %2 a sé stesso. - + %1 points from their %2 to %3. %1 disegna una freccia dal suo %2 a %3. - + %1 points from %2's %3 to themselves. %1 disegna una freccia dal %3 di %2 a sé stesso. - + %1 points from %2's %3 to %4. %1 disegna una freccia dal %3 di %2 a %4. - + %1 points from their %2 to their %3. %1 disegna una freccia dal suo %2 al suo %3. - + %1 points from their %2 to %3's %4. %1 disegna una freccia dal suo %2 a %4 di %3. - + %1 points from %2's %3 to their own %4. %1 disegna una freccia da %3 di %2 al suo %4. - + %1 points from %2's %3 to %4's %5. %1 disegna una freccia dal %3 di %2 al %5 di %4. - + %1 creates a face down token. %1 crea una pedina a faccia in giù. - + %1 creates token: %2%3. %1 crea una pedina: %2%3. - + %1 has loaded a deck (%2). %1 ha caricato un mazzo (%2). - + %1 has loaded a deck with %2 sideboard cards (%3). %1 ha caricato un mazzo con %2 carte nella sideboard (%3). - + %1 destroys %2. %1 distrugge %2. - + a card una carta - + %1 gives %2 control over %3. %1 da il controllo di %3 a %2. - + %1 puts %2 into play%3 face down. %1 mette %2 sul campo di battaglia %3 a faccia in giù. - + %1 puts %2 into play%3. %1 mette %2 sul campo di battaglia%3. - + %1 puts %2%3 into their graveyard. %1 mette %2 nel suo cimitero%3. - + %1 exiles %2%3. %1 esilia %2%3. - + %1 moves %2%3 to their hand. %1 mette %2 in mano%3. - + %1 puts %2%3 into their library. %1 mette %2 nel suo grimorio%3. - + %1 puts %2%3 onto the bottom of their library. %1 mette %2%3 in fondo al proprio grimorio. - + %1 puts %2%3 on top of their library. %1 mette %2 in cima al suo grimorio%3. - + %1 puts %2%3 into their library %4 cards from the top. %1 mette %2%3 nel suo grimorio %4 carte dalla cima. - + %1 moves %2%3 to sideboard. %1 mette %2 nella sideboard%3. - + %1 plays %2%3. %1 gioca %2%3. - + %1 moves %2%3 to custom zone '%4'. %1 mette %2 nella zona personalizzata '%4'%3. - + %1 tries to draw from an empty library %1 prova a pescare da un grimorio vuoto - + %1 draws %2 card(s). %1 pesca una carta.%1 pesca %2 carte.%1 pesca %2 carte. - + %1 is looking at %2. %1 sta guardando %2. - + %1 is looking at the %4 %3 card(s) %2. %1 is looking at the top %3 card(s) %2. top card for singular, top %3 cards for plural %1 sta guardando %3 carta %4 %2.%1 sta guardando %3 carte %4 %2.%1 sta guardando %3 carte %4 %2. - + bottom in fondo - + top in cima - + %1 turns %2 face-down. %1 gira %2 a faccia in giù. - + %1 turns %2 face-up. %1 gira %2 a faccia in su. - + The game has been closed. La partita è stata chiusa. - + The game has started. La partita è iniziata. - + + You are flooding the game. Please wait a couple of seconds. + Stai spammando la partita. Attendi un paio di secondi. + + + %1 has joined the game. %1 è entrato nella partita. - + %1 is now watching the game. %1 sta osservando la partita. - + You have been kicked out of the game. Sei stato cacciato dalla partita. - + %1 has left the game (%2). %1 ha abbandonato la partita (%2). - + %1 is not watching the game any more (%2). %1 non sta più guardando la partita (%2). - + %1 is not ready to start the game any more. %1 non è più pronto a iniziare la partita. - + %1 shuffles their deck and draws a new hand of %2 card(s). %1 mischia il proprio mazzo e pesca una nuova mano di %2 carta.%1 mischia il proprio mazzo e pesca una nuova mano di %2 carte.%1 mischia il proprio mazzo e pesca una nuova mano di %2 carte. - + %1 shuffles their deck and draws a new hand. %1 mischia il proprio mazzo e pesca una nuova mano. - + You are watching a replay of game #%1. Stai guardando il replay della partita #%1. - + %1 is ready to start the game. %1 è pronto a iniziare la partita. - + cards an unknown amount of cards carte - + %1 card(s) a card for singular, %1 cards for plural una carta%1 carte%1 carte - + %1 lends %2 to %3. %1 presta %2 a %3. - + %1 reveals %2 to %3. %1 rivela %2 a %3. - + %1 reveals %2. %1 rivela %2. - + %1 randomly reveals %2%3 to %4. %1 rivela a caso %2%3 a %4. - + %1 randomly reveals %2%3. %1 rivela a caso %2%3. - + %1 peeks at face down card #%2. %1 sbircia la carta a faccia in giù #%2. - + %1 peeks at face down card #%2: %3. %1 sbircia la carta a faccia in giù #%2: %3. - + %1 reveals %2%3 to %4. %1 rivela %2%3 a %4. - + %1 reveals %2%3. %1 rivela %2%3. - + %1 reversed turn order, now it's %2. %1 ha rovesciato l'ordine dei turni, ora è %2. - + reversed invertito - + normal normale - + Heads Testa - + Tails Croce - + %1 flipped a coin. It landed as %2. %1 ha lanciato una moneta. Il risultato è %2. - + %1 rolls a %2 with a %3-sided die. %1 lancia un dado a %3 facce e ottiene %2. - + %1 flips %2 coins. There are %3 heads and %4 tails. %1 lancia %2 monete. Sono uscite %3 teste e %4 croci. - + %1 rolls a %2-sided dice %3 times: %4. %1 lancia un dado a %2 facce %3 volte: %4. - + %1's turn. Turno di %1 - + %1 sets annotation of %2 to %3. %1 imposta le note di %2 a %3. - + %1 places %2 "%3" counter(s) on %4 (now %5). %1 mette %2 segnalino "%3" su %4 (totale %5).%1 mette %2 segnalini "%3" su %4 (totale %5).%1 mette %2 segnalino(i) "%3" su %4 (totale %5). - + %1 removes %2 "%3" counter(s) from %4 (now %5). %1 toglie %2 segnalino "%3" su %4 (totale %5).%1 toglie %2 segnalini "%3" su %4 (totale %5).%1 toglie %2 segnalino(i) "%3" su %4 (totale %5). - + %1 sets counter %2 to %3 (%4%5). %1 imposta il contatore %2 a %3 (%4%5). - + %1 sets %2 to not untap normally. %1 imposta che %2 non STAPpi normalmente. - + %1 sets %2 to untap normally. %1 imposta che %2 STAPpi normalmente. - + %1 removes the PT of %2. %1 elimina i valori F/C di %2. - + %1 changes the PT of %2 from nothing to %4. %1 cambia F/C di %2 da vuota a %4. - + %1 changes the PT of %2 from %3 to %4. %1 cambia F/C di %2 da %3 a %4. - + %1 has locked their sideboard. %1 ha bloccato la sua sideboard. - + %1 has unlocked their sideboard. %1 ha sbloccato la sua sideboard. - + %1 taps their permanents. %1 TAPpa i suoi permanenti. - + %1 untaps their permanents. %1 STAPpa i suoi permanenti. - + %1 taps %2. %1 TAPpa %2. - + %1 untaps %2. %1 STAPpa %2. - + %1 shuffles %2. %1 mescola %2. - + %1 shuffles the bottom %3 cards of %2. %1 mescola le %3 carte sul fondo da %2. - + %1 shuffles the top %3 cards of %2. %1 mescola le prime %3 carte da %2. - + %1 shuffles cards %3 - %4 of %2. %1 mescola le carte %3 - %4 da %2. - + %1 unattaches %2. %1 toglie %2. - + %1 undoes their last draw. %1 annulla la sua ultima pescata. - + %1 undoes their last draw (%2). %1 annulla la sua ultima pescata (%2). @@ -5050,163 +5652,201 @@ Il database delle carte verrà ricaricato. MessagesSettingsPage - + Word1 Word2 Word3 Parola1 Parola2 Parola3 - + Add New Message Aggiungi Nuovo Messaggio - + Edit Message Modifica Messaggio - + Remove Message Rimuovi Messaggio - + Add message Aggiungi messaggio - - + + Message: Messaggio: - + Edit message Modifica messaggio - + Chat settings Impostazioni chat - + Custom alert words Lista parole evidenziate - + Enable chat mentions Abilita menzioni in chat - + Enable mention completer Abilita completamento menzioni - + In-game message macros Messaggi rapidi in partita - + How to use in-game message macros Come usare i messaggi macro in gioco - + Ignore chat room messages sent by unregistered users Ignora i messaggi in chat inviati dagli utenti non registrati - + Ignore private messages sent by unregistered users Ignora i messaggi privati inviati dagli utenti non registrati - - + + Invert text color Inverti colore testo - + Enable desktop notifications for private messages Abilita notifiche desktop per i messaggi privati - + Enable desktop notification for mentions Abilita notifiche sul desktop per le menzioni - + Enable room message history on join Abilita messaggi recenti all'ingresso - - + + (Color is hexadecimal) (Colore in esadecimale) - + Separate words with a space, alphanumeric characters only Separare le parole con uno spazio; solo caratteri alfanumerici + + MoveMenu + + + Move to + &Metti in + + + + &Top of library in random order + &In cima al grimorio in ordine casuale + + + + X cards from the top of library... + Posizione X dalla cima del grimorio... + + + + &Bottom of library in random order + In &fondo al grimorio in ordine casuale + + + + &Hand + &Mano + + + + &Graveyard + &Cimitero + + + + &Exile + &Esilio + + Mtg - + Card Type Tipo - + Mana Value Valore di Mana - + Color(s) Colore - + Loyalty Fedeltà - + Main Card Type Tipo principale - + Mana Cost Costo di mana - + P/T F/C - + Side Lato - + Layout Disposizione - + Color Identity Identità di colore @@ -5353,703 +5993,207 @@ Il database delle carte verrà ricaricato. PictureLoader - + en code for scryfall's language property, not available for all languages it - Player + PlayerActions - - Reveal top cards of library - Rivela le prime carte del grimorio - - - - - - - - - - - - - - - Number of cards: (max. %1) - Numero di carte: (max %1) - - - - &View graveyard - &Guarda il cimitero - - - - &View exile - &Guarda la zona di esilio - - - - Player "%1" - Giocatore "%1" - - - - - - - &Graveyard - &Cimitero - - - - - - - &Exile - &Esilio - - - - &Move hand to... - &Sposta mano in... - - - - - - &Top of library - &Cima al grimorio - - - - - - &Bottom of library - &Fondo al grimorio - - - - &Move graveyard to... - &Muovi cimitero in... - - - - - - - &Hand - &Mano - - - - &Move exile to... - &Muovi esilio in... - - - - &View library - &Guarda il grimorio - - - - &View hand - &Vedi mano - - - - View &top cards of library... - Guarda &le carte in cima al grimorio... - - - - Reveal &library to... - Rive&la grimorio a... - - - - &Always reveal top card - Rivela &sempre la prima carta - - - - &View sideboard - &Guarda la sideboard - - - - &Draw card - &Pesca una carta - - - - D&raw cards... - P&esca carte... - - - - &Undo last draw - &Annulla l'ultima pescata - - - - Take &mulligan - Mu&lliga - - - - Play top card &face down - Gioca la prima carta a faccia in giù - - - - Move top card to grave&yard - Metti la prima carta nel c&imitero - - - - Move top card to e&xile - E&silia la prima carta - - - - Move top cards to &graveyard... - Metti le prime carte nel &cimitero... - - - - Move top cards to &exile... - &Esilia le prime carte... - - - - Put top card on &bottom - Metti la prima carta in &fondo - - - - View bottom cards of library... - Guarda le carte in fondo al grimorio... - - - - Lend library to... - Presta il grimorio a... - - - - Shuffle - Mescola - - - - Put top cards on stack &until... - Take top cards &until... - Metti le carte in cima alla pila fino a... - - - - Shuffle top cards... - Mescola le carte in cima... - - - - Shuffle bottom cards... - Mescola le carte in fondo... - - - - &Reveal hand to... - &Rivela mano a... - - - - Reveal r&andom card to... - Rivela carta c&asuale a... - - - - Reveal random card to... - Rivela carta casuale a... - - - - &Sideboard - &Sideboard - - - - &Library - &Grimorio - - - - &Counters - &Contatori - - - - C&ustom Zones - &Zone personalizzate - - - - - View custom zone '%1' - Visualizza la zona personalizzata '%1' - - - - &Untap all permanents - &STAPpa tutti i permanenti - - - - R&oll die... - L&ancia un dado... - - - - &Create token... - &Crea una pedina... - - - - C&reate another token - C&rea un'altra pedina - - - - Cr&eate predefined token - Cr&ea pedina predefinita - - - - Ca&rd counters - Segnalini delle ca&rte - - - - - &All players - &Tutti i giocatori - - - - S&ay - P&arla - - - - &Select All - Seleziona tutto - - - - S&elect Row - Seleziona fila - - - - S&elect Column - Seleziona colonna - - - - &Play - &Gioca - - - - &Hide - &Nascondi - - - - Play &Face Down - Gioca a &faccia in giù - - - - &Tap / Untap - Turn sideways or back again - &TAPpa/STAPpa - - - - Toggle &normal untapping - Blocca/Sblocca &STAP normale - - - - T&urn Over - Turn face up/face down - Capovolgi - - - - &Peek at card face - &Sbircia la faccia della carta - - - - &Clone - &Copia - - - - Attac&h to card... - Asse&gna alla carta... - - - - Unattac&h - Tog&li - - - - &Draw arrow... - &Disegna una freccia... - - - - &Increase power - &Aumenta forza - - - - &Decrease power - &Diminuisci forza - - - - I&ncrease toughness - A&umenta costituzione - - - - D&ecrease toughness - D&iminuisci costituzione - - - - In&crease power and toughness - Au&menta forza e costituzione - - - - Dec&rease power and toughness - Dim&inuisci forza e costituzione - - - - Increase power and decrease toughness - Aumenta forza e diminuisci costituzione - - - - Decrease power and increase toughness - Diminuisci forza e aumenta costituzione - - - - Set &power and toughness... - Imposta &forza e costituzione... - - - - Reset p&ower and toughness - Resetta &forza e costituzione - - - - &Set annotation... - &Imposta note... - - - - &Add counter (%1) - &Aggiungi segnalino (%1) - - - - &Remove counter (%1) - &Rimuovi segnalino (%1) - - - - &Set counters (%1)... - Imposta &segnalini (%1)... - - - - &Top of library in random order - &In cima al mazzo in ordine casuale - - - - X cards from the top of library... - Posizione X dalla cima del grimorio... - - - - &Bottom of library in random order - In &fondo al grimorio in ordine casuale - - - + View top cards of library Guarda le carte in cima al grimorio - + + + + + + + + + + + + Number of cards: (max. %1) + Numero di carte: (max %1) + + + View bottom cards of library Guarda le carte in fondo al grimorio - + Shuffle top cards of library Mescola le carte in cima al grimorio - + Shuffle bottom cards of library Mescola le carte in fondo al grimorio - - Which position should this card be placed: - In che posizione dovrebbe essere messa questa carta: - - - - (max. %1) - (max %1) - - - + Draw hand Pesca mano - + 0 and lower are in comparison to current hand size 0 e inferiore sono relativi al numero attuale di carte in mano - + Draw cards Pesca carte - - - Number: - Numero: - - - + Move top cards to grave Metti le prime carte nel cimitero - - Reveal &top cards to... - Rivela le &prime carte a... - - - - &Top of library... - &In cima al grimorio... - - - - &Bottom of library... - &In fondo al grimorio... - - - - &Always look at top card - &Vedi sempre la prima carta - - - - &Open deck in deck editor - &Apri il mazzo nell'editor dei mazzi - - - - &Play top card - &Gioca la prima carta - - - - &Draw bottom card - &Pesca l'ultima carta dal fondo - - - - D&raw bottom cards... - P&esca carte dal fondo... - - - - &Play bottom card - &Gioca l'ultima carta dal fondo - - - - Play bottom card &face down - Gioca l'ultima carta dal fondo a &faccia in giù - - - - Move bottom card to grave&yard - Metti l'ultima carta nel cimitero - - - - Move bottom card to e&xile - Metti l'ultima carta in esilio - - - - Move bottom cards to &graveyard... - Metti le ultime carte nel cimitero... - - - - Move bottom cards to &exile... - Metti le ultime carte in esilio... - - - - Put bottom card on &top - Metti l'ultima carta in cima - - - - Selec&ted cards - Carte selezionate - - - + Move top cards to exile Esilia le prime carte - + Move bottom cards to grave Metti le ultime care nel cimitero - + Move bottom cards to exile - Metti le ultime carte in esilio + Esilia le ultime carte - + Draw bottom cards Pesca le ultime carte - - + + C&reate another %1 token C&rea un'altra pedina %1 - + Create tokens Crea pedine - + + + Number: + Numero: + + + Place card X cards from top of library Metti la carta in posizione X dalla cima del grimorio - + + Which position should this card be placed: + In che posizione dovrebbe essere messa questa carta: + + + + (max. %1) + (max %1) + + + Change power/toughness Cambia forza/costituzione - + Change stats to: Cambia valori a: - + Set annotation - Imposta nota + Imposta note - + Please enter the new annotation: Inserisci le nuove note: - + Set counters Imposta i segnalini + + + PlayerMenu - - Re&veal to... - Ri&vela a... + + Reveal top cards of library + Rivela le prime carte del grimorio - - View related cards - Guarda carte correlate + + Number of cards: (max. %1) + Numero di carte: (max %1) - - Token: - Pedina: + + Player "%1" + Giocatore "%1" - - All tokens - Tutte le pedine + + &Counters + &Contatori + + + + &All players + &Tutti i giocatori + + + + S&ay + Invi&a PrintingSelector - + Display Navigation Buttons Visualizza pulsanti di navigazione - - - <b>Warning:</b> You appear to be using custom card art, which has known bugs when also using the printing selector in this version of Cockatrice. - <b>Attenzione:</b> Stai utilizzando la cartella delle immagini personalizzate, che causa dei bug se usato insieme al selettore di stampa in questa versione di Cockatrice. - PrintingSelectorCardOverlayWidget - + Preference Preferenza - + Pin Printing Fissa stampa in cima alla lista - + Unpin Printing Rimuovi stampa dalla cima della lista - + Show Related cards Mostra carte correlate @@ -6109,6 +6253,64 @@ Il database delle carte verrà ricaricato. Ascendente + + PtMenu + + + Power / toughness + Forza / costituzione + + + + &Increase power + &Aumenta forza + + + + &Decrease power + &Diminuisci forza + + + + I&ncrease toughness + A&umenta costituzione + + + + D&ecrease toughness + D&iminuisci costituzione + + + + In&crease power and toughness + Au&menta forza e costituzione + + + + Dec&rease power and toughness + Dimi&nuisci forza e costituzione + + + + Increase power and decrease toughness + Aumenta forza e diminuisci costituzione + + + + Decrease power and increase toughness + Diminuisci forza e aumenta costituzione + + + + Set &power and toughness... + Imposta &forza e costituzione... + + + + Reset p&ower and toughness + Resetta f&orza e costituzione + + QMenuBar @@ -6165,17 +6367,17 @@ Il database delle carte verrà ricaricato. Replay di Cockatrice (*.cor) - + Maindeck Maindeck - + Sideboard Sideboard - + Tokens Token @@ -6334,6 +6536,44 @@ Il database delle carte verrà ricaricato. Durata (sec) + + RfgMenu + + + &Exile + &Esilio + + + + &View exile + &Guarda la zona di esilio + + + + &Move exile to... + &Muovi esilio in... + + + + &Top of library + &Cima al grimorio + + + + &Bottom of library + &Fondo al grimorio + + + + &Hand + &Mano + + + + &Graveyard + &Cimitero + + RoomSelector @@ -6436,53 +6676,53 @@ Il database delle carte verrà ricaricato. ShortcutSettingsPage - - + + Restore all default shortcuts Ripristina scorciatoie predefinite - + Do you really want to restore all default shortcuts? Sei scuro di voler ripristinare tutte le scorciatoie predefinite? - + Clear all default shortcuts Rimuovi tutte le scorciatoie predefinite - + Do you really want to clear all shortcuts? Sei sicuro di voler rimuovere tutte le scorciatoie? - + Section: Sezione: - + Action: Azione: - + Shortcut: Scorciatoia: - + How to set custom shortcuts Come impostare scorciatoie personalizzate - + Clear all shortcuts Elimina tutte le scorciatoie - + Search by shortcut name Cerca per nome della scorciatoia @@ -6535,30 +6775,43 @@ Controlla le impostazioni! Spegni il server + + SideboardMenu + + + &Sideboard + &Sideboard + + + + &View sideboard + &Guarda la sideboard + + SoundSettingsPage - + Enable &sounds Abilita &suoni - + Current sounds theme: Tema sonoro attuale: - + Test system sound engine Prova il funzionamento dei suoni - + Sound settings Impostazioni suoni - + Master volume Volume @@ -6828,68 +7081,61 @@ Controlla le impostazioni! TabDeckEditorVisual - + Visual Deck: %1 Mazzo visuale: %1 - + &Visual Deck Editor Editor &visuale - - + + Card Info Info carta - - + + Deck Mazzo - - + + Filters Filtri - + &View &Visualizza - - Deck Analytics - Analisi mazzo - - - + Printing Stampa - - - - - + + + + Visible Mostra - - - - - + + + + Floating Separata - + Reset layout Reimposta disposizione @@ -7111,226 +7357,215 @@ Please enter a name: - EDHREC: + EDHRec: + EDHREC: EDHREC: TabGame - - - + + + Replay Replay - - + + Game Partita - - + + Player List Giocatori - - + + Card Info Info carta - - + + Messages Messaggi - - + + Replay Timeline Replay - + &Phases &Fasi - + &Game &Partita - + Next &phase Prossima &fase - + Next phase with &action Prossima sottofase + &azione - + Next &turn Prossimo &turno - + Reverse turn order Inverti l'ordine dei turni - + &Remove all local arrows &Rimuovi tutte le frecce - + Rotate View Cl&ockwise Ruota vista in senso &orario - + Rotate View Co&unterclockwise R&uota vista in senso antiorario - + Game &information &Informazioni partita - + Un&concede Rientra in gioco - + &Concede &Concedi - + &Leave game &Lascia partita - + C&lose replay C&hiudi replay - + &Focus Chat Vai alla &chat - + &Say: &Parla: - + + Selected cards + Carte selezionate + + + &View &Visualizza - - - - + + + + Visible Mostra - - - - + + + + Floating Separata - + Reset layout Reimposta disposizione - + Concede Concedi - + Are you sure you want to concede this game? Vuoi veramente concedere la partita? - + Unconcede Annulla concedi - + You have already conceded. Do you want to return to this game? Hai già concesso. Vuoi ritornare in questa partita? - + Leave game Lascia la partita - + Are you sure you want to leave this game? Sei sicuro di voler lasciare la partita? - - You are flooding the game. Please wait a couple of seconds. - Stai spammando la partita. Attendi un paio di secondi. - - - + A player has joined game #%1 Un giocatore si è unito alla partita #%1 - + %1 has joined the game %1 si è unito alla partita - - kicked by game host or moderator - espulso da proprietario del gioco o moderatore - - - - player left the game - il giocatore ha lasciato la partita - - - - player disconnected from server - il giocatore si è disconnesso dal server - - - - reason unknown - ragione sconosciuta - - - + You have been kicked out of the game. Sei stato kickato fuori dalla partita. + + TabHome + + + Home + Home + + TabLog @@ -7531,105 +7766,186 @@ Più informazioni inserisci, più specifici saranno i risultati. TabReplays - + Local file system File locali - + Server replay storage Replay sul server - - + + Watch replay Guarda replay - + Rename Rinomina - - + + New folder Nuova cartella - - + + Delete Elimina - + Open replays folder Apri cartella replay - + Download replay Scarica replay - + Toggle expiration lock Metti/togli blocco scadenza - + + Get replay share code + Ottieni codice di condivisione replay + + + + + Look up replay by share code + Cerca replay dal codice di condivisione + + + Rename local folder Rinomina cartella locale - + Rename local file Rinomina file locale - + New name: Nuovo nome: - + Error Errore - + Rename failed Rinomina non riuscita - + Name of new folder: Nome della nuova cartella: - + Delete local file Elimina il file locale - + Are you sure you want to delete the selected files? Vuoi davvero eliminare i file selezionati? - + Are you sure you want to delete the selected replays? Vuoi davvero eliminare i replay selezionati? - + + Failed to get code + Impossibile ottenere il codice + + + + + Either this server does not support replay sharing, or does not permit replay sharing for you. + O questo server non supporta la condivisione dei replay, o non consente la condivisione dei replay per te. + + + + + + Failed + Fallito + + + + Could not get replay code + Impossibile ottenere il codice replay + + + + Replay Share Code + Codice di condivisione replay + + + + Others can use this code to add the replay to their list of remote replays: +%1 + Altre persone possono usare questo codice per aggiungere il replay alla loro lista di replay remoti: +%1 + + + + Copy to clipboard + Copia negli appunti + + + + Replay share code + Codice di condivisione replay + + + + Replay code found + Codice replay trovato + + + + Replay was added, or you already had access to it. + Il replay è stato aggiunto oppure ne avevi già accesso. + + + + Replay code not found + Codice replay non trovato + + + + Failed to submit code + Impossibile inviare il codice + + + + Unexpected error + Errore inatteso + + + Delete remote replay Elimina replay remoto - + Game Replays Replay partite @@ -7721,87 +8037,92 @@ Più informazioni inserisci, più specifici saranno i risultati. TabSupervisor - + Deck Editor &Editor dei mazzi - + Visual Deck Editor Editor visuale - + EDHRec EDHRec - + + Home + Home + + + &Visual Deck Storage &Galleria mazzi - + Visual Database Display Galleria database - + Server Server - + Account Account - + Deck Storage &Archivio mazzi - + Game Replays &Replay partite - + Administration Amministrazione - + Logs Registri - + Are you sure? Sei sicuro? - + There are still open games. Are you sure you want to quit? Ci sono ancora delle partite aperte. Sei sicuro di voler uscire? - + Click to view Clicca per visualizzare - + Your buddy %1 has signed on! Il tuo amico %1 si è collegato - + Unknown Event Evento sconosciuto. - + 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. @@ -7812,39 +8133,39 @@ Questo messaggio può significare che è disponibile una nuove versione di Cocka Per aggiornare il tuo client, vai su Aiuto -> Controlla aggiornamenti client - + Idle Timeout Timeout inattività - + You are about to be logged out due to inactivity. Stai per essere disconnesso per inattività. - + Promotion Promozione - + You have been promoted. Please log out and back in for changes to take effect. Sei stato promosso. Esci e rientra per dare effetto alle modifiche. - + Warned Avviso - + 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. Hai ricevuto un avviso a causa di %1. Se pregato di evitare di continuare questa attività o potrebbero venire presi ulteriori provvedimenti nel tuoi confronti. Per qualsiasi domanda, manda un messaggio ad un moderatore. - + You have received the following message from the server. (custom messages like these could be untranslated) Hai ricevuto il seguente messaggio dal server. @@ -7862,13 +8183,13 @@ Se pregato di evitare di continuare questa attività o potrebbero venire presi u TappedOutInterface - - + + Error Errore - + Unable to analyze the deck. Impossibile analizzare il mazzo. @@ -8029,99 +8350,121 @@ Se pregato di evitare di continuare questa attività o potrebbero venire presi u Visualizza le note degli amministratori - + + + + Error + Errore + + + + This user does not exist. + L'utente non esiste. + + + + You are being ignored by %1 and can't see their games. + Stai venendo ignorato da %1 e non puoi vedere le sue partite. + + + + Could not get %1's games. + Impossibile ottenere le partite di %1. + + + %1's games Partite di %1 - - - + + + Ban History Storico ban - + Ban Time;Moderator;Ban Length;Ban Reason;Visible Reason Ora Ban;Moderatore;Durata Ban;Ragione Ban;Ragione Visibile - + User has never been banned. L'utente non è mai stato bannato. - + Failed to collect ban information. Impossibile recuperare le informazioni sui ban. - - - + + + Warning History Storico avvisi - + Warning Time;Moderator;User Name;Reason Ora Avviso;Moderatore;Nome Utente;Ragione - + User has never been warned. L'utente non ha mai ricevuto avvisi. - + Failed to collect warning information. Impossibile recuperare le informazioni sugli avvisi. - + Failed to get admin notes. Impossibile ottenere le note degli amministratori - - + + Success Successo - + Successfully promoted user. Utente promosso. - + Successfully demoted user. Utente degradato. - - - + + + Failed Fallito - + Failed to promote user. Promozione fallita. - + Failed to demote user. Degradazione fallita. - + Copy hash to clipboard Copia hash negli appunti - + Remove this user's messages Rimuovi i messaggi di questo utente @@ -8303,137 +8646,137 @@ Se pregato di evitare di continuare questa attività o potrebbero venire presi u UserInterfaceSettingsPage - + General interface settings Impostazioni generali di interfaccia - + &Double-click cards to play them (instead of single-click) &Doppio click sulle carte per giocarle (anzichè un solo click) - + &Clicking plays all selected cards (instead of just the clicked card) &Cliccare gioca tutte le carte selezionate (anziché solo quella cliccata) - + &Play all nonlands onto the stack (not the battlefield) by default Gioca tutte le carte non terra nella &pila (invece che sul campo di battaglia) - + Close card view window when last card is removed Chiudi la finestra di visualizzazione carte quando l'ultima carta viene rimossa - + Auto focus search bar when card view window is opened Passa alla barra di ricerca quando si apre la finestra di visualizzazione carta - + Annotate card text on tokens Annota il testo della carta sulle pedine - + Use tear-off menus, allowing right click menus to persist on screen Usa menù a strappo, permettendo ai menù del tasto destro del mouse di rimanere sullo schermo - + Notifications settings Impostazioni notifiche - + Enable notifications in taskbar Abilita notifiche nella barra delle applicazioni - + Notify in the taskbar for game events while you are spectating Notifica anche per le partite in cui si è solo uno spettatore - + Notify in the taskbar when users in your buddy list connect Notifca quando utenti nella tua lista amici si connettono - + Animation settings Impostazioni delle animazioni - + &Tap/untap animation Animazioni &TAPpa/STAPpa - + Deck editor/storage settings Impostazioni editor/archivio mazzi - + Open deck in new tab by default Apri il mazzo in una nuova scheda automaticamente - + Use visual deck storage in game lobby Usa galleria mazzi nella lobby - + Use selection animation for Visual Deck Storage Mostra animazione al passaggio del mouse nella galleria mazzi - + When adding a tag in the visual deck storage to a .txt deck: Quando aggiungi un'etichetta ad un mazzo in formato .txt nella Galleria mazzi: - + do nothing non fare nulla - + ask to convert to .cod chiedi se convertire in file .cod - + always convert to .cod converti sempre in file .cod - + Default deck editor type Editor dei mazzi predefinito - + Classic Deck Editor Editor classico - + Visual Deck Editor Editor visuale - + Replay settings Impostazioni di riproduzione - + Buffer time for backwards skip via shortcut: Tempo di attesa per saltare indietro dopo aver premuto la scorciatoia @@ -8461,6 +8804,39 @@ Se pregato di evitare di continuare questa attività o potrebbero venire presi u Utenti ignorati online: %1 / %2 + + UtilityMenu + + + Increment all card counters + Aumenta tutti i segnalini della carta + + + + &Untap all permanents + &STAPpa tutti i permanenti + + + + R&oll die... + L&ancia un dado... + + + + &Create token... + &Crea una pedina... + + + + C&reate another token + C&rea un'altra pedina + + + + Cr&eate predefined token + Cr&ea pedina predefinita + + VisualDatabaseDisplayColorFilterWidget @@ -8617,27 +8993,32 @@ Se pregato di evitare di continuare questa attività o potrebbero venire presi u Cerca per nome della carta (o espressioni di ricerca) - + + Loading database ... + Caricamento database... + + + Clear all filters Elimina tutti i filtri - + Save and load filters Salva e carica filtri - + Filter by exact card name Filtra per nome della carta esatto - + Filter by card sub-type Filtra per sottotipo - + Filter by set Filtra per set @@ -8658,38 +9039,38 @@ Se pregato di evitare di continuare questa attività o potrebbero venire presi u VisualDeckEditorWidget - + Click and drag to change the sort order within the groups Clicca e trascina per modificare i criteri di ordinamento all'interno dei gruppi - + Quick search and add card Cerca e aggiungi carta al mazzo - + Search for closest match in the database (with auto-suggestions) and add preferred printing to the deck on pressing enter Cerca per la corrispondenza più prossima nel database (con auto-completamento) e premendo Invio, aggiungi la stampa preferita della carta al mazzo. - + Configure how cards are sorted within their groups Configura l'ordinamento delle carte all'interno dei gruppi - - + + Overlap Layout Disposizione sovrapposta - + Change how cards are displayed within zones (i.e. overlapped or fully visible.) Imposta come le carte vengono mostrate all'interno delle relative sezioni (sovrapposte o affiancate) - + Flat Layout Disposizione affiancata @@ -8985,67 +9366,67 @@ Se pregato di evitare di continuare questa attività o potrebbero venire presi u Cerca per nome della carta (o espressioni di ricerca) - + Ungrouped Non raggruppare - + Group by Type Raggruppa per tipo - + Group by Mana Value Raggruppa per costo - + Group by Color Raggruppa per colore - + Unsorted Non ordinato - + Sort by Name Ordina per nome - + Sort by Type Ordina per tipo - + Sort by Mana Cost Ordina per costo - + Sort by Colors Ordina per colori - + Sort by P/T Ordina per F/C - + Sort by Set Ordina per Set - + shuffle when closing Mescola alla chiusura - + pile view Raggruppa per tipo @@ -9080,7 +9461,7 @@ Se pregato di evitare di continuare questa attività o potrebbero venire presi u - + Deck Editor Editor dei mazzi @@ -9161,7 +9542,7 @@ Se pregato di evitare di continuare questa attività o potrebbero venire presi u - + Replays Replay @@ -9314,7 +9695,7 @@ Se pregato di evitare di continuare questa attività o potrebbero venire presi u - + Reset Layout Reimposta Disposizione @@ -9594,471 +9975,486 @@ Se pregato di evitare di continuare questa attività o potrebbero venire presi u Imposta Contatore Altro... - + + Increment all card counters + Aumenta tutti i segnalini della carta + + + Add Power (+1/+0) Aumenta Forza (+1/+0) - + Remove Power (-1/-0) Diminuisci Forza (-1/-0) - + Move Toughness to Power (+1/-1) Sposta Costituzione a Forza (+1/-1) - + Add Toughness (+0/+1) Aumenta Costituzione (+0/+1) - + Remove Toughness (-0/-1) Riduci Costituzione (-0/-1) - + Move Power to Toughness (-1/+1) Sposta Forza a Costituzione (-1/+1) - + Add Power and Toughness (+1/+1) Aumenta Forza e Costituzione (+1/+1) - + Remove Power and Toughness (-1/-1) Diminuisci Forza e Costituzione (-1/-1) - + Set Power and Toughness... Imposta Forza e Costituzione... - + Reset Power and Toughness Resetta Forza e Costituzione - + Untap STAP - + Upkeep Mantenimento - + Draw Acquisizione - + First Main Phase Prima Fase Principale - + Start Combat Inizio Combattimento - + Attack Dichiarazione attaccanti - + Block Dichiarazione bloccanti - + Damage Danno da combattimento - + End Combat Fine Combattimento - + Second Main Phase Seconda Fase Principale - + End Finale - + Next Phase Fase Successiva - + Next Phase Action Azione della Fase Successiva - + Next Turn Turno Successivo - + Hide Card in Reveal Window Nascondi Carta nella Finestra di Visualizzazione - + Tap / Untap Card TAPpa / STAPpa carta - + Untap All STAPpa Tutto - + Toggle Untap Abilita STAPpa - + Turn Card Over Gira Carta - + Peek Card Sbircia Carta - + Play Card Gioca Carta - + Attach Card... Assegna Carta... - + Unattach Card Togli Carta - + Clone Card Clona Carta - + Create Token... Crea Pedina... - + Create All Related Tokens Crea Tutte le Pedine Correlate - + Create Another Token Crea un'Altra Pedina - + Set Annotation... Imposta Note... - + Select All Cards in Zone Seleziona Tutte le Carte nella Zona - + Select All Cards in Row Seleziona Tutte le Carte nella Riga - + Select All Cards in Column Seleziona Tutte le Carte nella Colonna - - + + Bottom of Library Fondo al Grimorio - - - - + + + + Exile Esilio - - - - + + + + Graveyard Cimitero - - + + Hand Mano - - + + Top of Library Cima al Grimorio - - - + + + Battlefield, Face Down Campo di Battaglia, faccia in giù - + Battlefield Campo di Battaglia - + + Sort Hand + Ordina mano + + + Library Grimorio - + Sideboard Sideboard - + Top Cards of Library Carte in Cima al Grimorio - + Bottom Cards of Library Carte in Fondo al Grimorio - + Close Recent View Chiudi Viste di Recente - - + + Stack Pila - - + + Graveyard (Multiple) Cimitero (multiplo) - - + + Exile (Multiple) Esilia (multiplo) - + Stack Until Found Impila Fino a Trovare - + Draw Bottom Card Pesca Carta in Fondo - + Draw Multiple Cards from Bottom... Pesca Multiple Carte in Fondo - + Draw Arrow... Disegna Freccia... - + Remove Local Arrows Rimuovi Frecce Locali - + Leave Game Abbandona Partita - + Concede Concedi - + Roll Dice... Tira un Dado... - + Shuffle Library Mescola il Grimorio - + Shuffle Top Cards of Library Mescola Carte in Cima al Grimorio - + Shuffle Bottom Cards of Library Mescola Carte in Fondo al Grimorio - + Mulligan Mulligan - + Draw a Card Pesca una Carta - + Draw Multiple Cards... Pesca più Carte... - + Undo Draw Annulla Pescata - + Always Reveal Top Card Rivela Sempre la Carta in Cima - + Always Look At Top Card Guarda Sempre la Carta in Cima - + Rotate View Clockwise Ruota Vista in Senso Orario - + Rotate View Counterclockwise Ruota Vista in Senso Antiorario - + Unfocus Text Box Togli Focus dalla Casella di Testo - + Focus Chat Vai alla chat - + Clear Chat Cancella chat - + Refresh Aggiorna - + Skip Forward Salta Avanti - + Skip Backward Salta Indietro - + Skip Forward by a lot Salta Avanti di Molto - + Skip Backward by a lot Salta Indietro di Molto - + Play/Pause Riproduci/Pausa - + Toggle Fast Forward Attiva/Disattiva Avanzamento Rapido - + + Home + Home + + + Visual Deck Storage Galleria mazzi - + Deck Storage Archivio mazzi - + Server Server - + Account Account - + Administration Amministrazione - + Logs Registri diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt deleted file mode 100644 index cf2f15db1..000000000 --- a/common/CMakeLists.txt +++ /dev/null @@ -1,49 +0,0 @@ -# CMakeLists for common directory -# -# provides the common library - -add_subdirectory(pb) - -set(common_SOURCES - abstract_deck_list_card_node.cpp - abstract_deck_list_node.cpp - debug_pb_message.cpp - deck_list_card_node.cpp - deck_list.cpp - expression.cpp - featureset.cpp - get_pb_extension.cpp - inner_deck_list_node.cpp - passwordhasher.cpp - rng_abstract.cpp - rng_sfmt.cpp - server/game/server_abstract_participant.cpp - server/game/server_arrow.cpp - server/game/server_arrowtarget.cpp - server/game/server_card.cpp - server/game/server_cardzone.cpp - server/game/server_counter.cpp - server/game/server_game.cpp - server/game/server_player.cpp - server/game/server_spectator.cpp - server/server.cpp - server/server_abstractuserinterface.cpp - server/server_database_interface.cpp - server/server_protocolhandler.cpp - server/server_remoteuserinterface.cpp - server/server_response_containers.cpp - server/server_room.cpp - serverinfo_user_container.cpp - sfmt/SFMT.c -) - -set(ORACLE_LIBS) - -include_directories(pb) -include_directories(sfmt) -include_directories(${PROTOBUF_INCLUDE_DIR}) -include_directories(${${COCKATRICE_QT_VERSION_NAME}Core_INCLUDE_DIRS}) -include_directories(${CMAKE_CURRENT_BINARY_DIR}) - -add_library(cockatrice_common ${common_SOURCES} ${common_MOC_SRCS}) -target_link_libraries(cockatrice_common PUBLIC cockatrice_protocol) diff --git a/dbconverter/CMakeLists.txt b/dbconverter/CMakeLists.txt index 4236e1374..acf60bf03 100644 --- a/dbconverter/CMakeLists.txt +++ b/dbconverter/CMakeLists.txt @@ -1,47 +1,37 @@ -# CMakeLists for dbconverter directory - +cmake_minimum_required(VERSION 3.16) project(Dbconverter VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}") -set(dbconverter_SOURCES - src/main.cpp - src/mocks.cpp - ../cockatrice/src/card/card_info.cpp - ../cockatrice/src/card/card_relation.cpp - ../cockatrice/src/card/card_set.cpp - ../cockatrice/src/card/card_set_list.cpp - ../cockatrice/src/card/exact_card.cpp - ../cockatrice/src/card/printing_info.cpp - ../cockatrice/src/database/card_database.cpp - ../cockatrice/src/database/card_database_loader.cpp - ../cockatrice/src/database/card_database_querier.cpp - ../cockatrice/src/database/parser/card_database_parser.cpp - ../cockatrice/src/database/parser/cockatrice_xml_3.cpp - ../cockatrice/src/database/parser/cockatrice_xml_4.cpp - ../cockatrice/src/settings/settings_manager.cpp - ${VERSION_STRING_CPP} +# ------------------------ +# Sources +# ------------------------ +set(dbconverter_SOURCES src/main.cpp src/mocks.cpp ${VERSION_STRING_CPP}) + +# ------------------------ +# Qt configuration +# ------------------------ +set(QT_DONT_USE_QTGUI TRUE) +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTORCC ON) + +# ------------------------ +# Build executable +# ------------------------ +add_executable(dbconverter MACOSX_BUNDLE ${dbconverter_SOURCES}) + +# ------------------------ +# Link libraries +# ------------------------ +target_link_libraries( + dbconverter + PRIVATE libcockatrice_card + PRIVATE libcockatrice_settings + PRIVATE ${DB_CONVERTER_QT_MODULES} ) -set(QT_DONT_USE_QTGUI TRUE) - -if(Qt6_FOUND) - qt6_wrap_cpp( - dbconverter_SOURCES ../cockatrice/src/settings/cache_settings.h ../cockatrice/src/settings/card_database_settings.h - ) -elseif(Qt5_FOUND) - qt5_wrap_cpp( - dbconverter_SOURCES ../cockatrice/src/settings/cache_settings.h ../cockatrice/src/settings/card_database_settings.h - ) -endif() - -# Include directories -include_directories(../common) # Required due to card_ref.h - -# Build servatrice binary and link it -add_executable(dbconverter MACOSX_BUNDLE ${dbconverter_MOC_SRCS} ${dbconverter_SOURCES}) - -target_link_libraries(dbconverter ${DB_CONVERTER_QT_MODULES}) - -# install rules +# ------------------------ +# Install rules +# ------------------------ if(UNIX) if(APPLE) set(MACOSX_BUNDLE_INFO_STRING "${PROJECT_NAME}") @@ -53,19 +43,20 @@ if(UNIX) install(TARGETS dbconverter BUNDLE DESTINATION ./) else() - # Assume linux + # Linux install(TARGETS dbconverter RUNTIME DESTINATION bin/) endif() elseif(WIN32) install(TARGETS dbconverter RUNTIME DESTINATION ./) endif() +# ------------------------ +# Qt plugin handling +# ------------------------ if(APPLE) - # these needs to be relative to CMAKE_INSTALL_PREFIX set(plugin_dest_dir dbconverter.app/Contents/Plugins) set(qtconf_dest_dir dbconverter.app/Contents/Resources) - # Qt plugins: platforms install( DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} @@ -81,7 +72,7 @@ if(APPLE) file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"[Paths] Plugins = Plugins Translations = Resources/translations\") - " + " COMPONENT Runtime ) @@ -89,16 +80,15 @@ Translations = Resources/translations\") CODE " file(GLOB_RECURSE QTPLUGINS \"\${CMAKE_INSTALL_PREFIX}/${plugin_dest_dir}/*.dylib\") - set(BU_CHMOD_BUNDLE_ITEMS ON) - include(BundleUtilities) - fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/dbconverter.app\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR};${MYSQLCLIENT_LIBRARY_DIR}\") - " + set(BU_CHMOD_BUNDLE_ITEMS ON) + include(BundleUtilities) + fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/dbconverter.app\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR};${MYSQLCLIENT_LIBRARY_DIR}\") + " COMPONENT Runtime ) endif() if(WIN32) - # these needs to be relative to CMAKE_INSTALL_PREFIX set(plugin_dest_dir Plugins) set(qtconf_dest_dir .) @@ -109,7 +99,6 @@ if(WIN32) PATTERN "*.dll" ) - # Qt plugins: platforms install( DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} @@ -126,7 +115,7 @@ if(WIN32) file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"[Paths] Plugins = Plugins Translations = Resources/translations\") - " + " COMPONENT Runtime ) @@ -134,10 +123,10 @@ Translations = Resources/translations\") CODE " file(GLOB_RECURSE QTPLUGINS \"\${CMAKE_INSTALL_PREFIX}/${plugin_dest_dir}/*.dll\") - set(BU_CHMOD_BUNDLE_ITEMS ON) - include(BundleUtilities) - fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/dbconverter.exe\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR}\") - " + set(BU_CHMOD_BUNDLE_ITEMS ON) + include(BundleUtilities) + fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/dbconverter.exe\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR}\") + " COMPONENT Runtime ) endif() diff --git a/dbconverter/src/main.h b/dbconverter/src/main.h index ccde6b20e..1fa1335d0 100644 --- a/dbconverter/src/main.h +++ b/dbconverter/src/main.h @@ -1,8 +1,8 @@ #ifndef MAIN_H #define MAIN_H -#include "../../cockatrice/src/database/card_database.h" -#include "../../cockatrice/src/database/parser/cockatrice_xml_4.h" +#include +#include class CardDatabaseConverter : public CardDatabase { diff --git a/dbconverter/src/mocks.cpp b/dbconverter/src/mocks.cpp index 213b42f02..6aa108e57 100644 --- a/dbconverter/src/mocks.cpp +++ b/dbconverter/src/mocks.cpp @@ -448,7 +448,7 @@ void SettingsCache::setRoundCardCorners(bool /* _roundCardCorners */) { } -void PictureLoader::clearPixmapCache(CardInfoPtr /* card */) +void CardPictureLoader::clearPixmapCache(CardInfoPtr /* card */) { } diff --git a/dbconverter/src/mocks.h b/dbconverter/src/mocks.h index 18a50155b..497f76e72 100644 --- a/dbconverter/src/mocks.h +++ b/dbconverter/src/mocks.h @@ -10,13 +10,13 @@ #define PICTURELOADER_H -#include "../../cockatrice/src/database/card_database.h" -#include "../../cockatrice/src/settings/cache_settings.h" -#include "../../cockatrice/src/utility/macros.h" +#include +#include +#include extern SettingsCache *settingsCache; -class PictureLoader +class CardPictureLoader { public: static void clearPixmapCache(CardInfoPtr card); diff --git a/format.sh b/format.sh index 8c60f3f8a..5f4605f55 100755 --- a/format.sh +++ b/format.sh @@ -12,18 +12,24 @@ olddir="$PWD" cd "${BASH_SOURCE%/*}/" || exit 2 # could not find path, this could happen with special links etc. # defaults -include=("common" \ -"cockatrice/src" \ +include=("cockatrice/src" \ "dbconverter/src" \ +"libcockatrice_card" \ +"libcockatrice_deck_list" \ +"libcockatrice_network" \ +"libcockatrice_protocol" \ +"libcockatrice_rng" \ +"libcockatrice_settings" \ +"libcockatrice_utility" \ "oracle/src" \ "servatrice/src" \ "tests") -exclude=("servatrice/src/smtp" \ -"common/sfmt" \ -"common/lib" \ -"oracle/src/zip" \ -"oracle/src/lzma" \ -"oracle/src/qt-json") +exclude=("libcockatrice_rng/libcockatrice/rng/sfmt/" \ +"libcockatrice_utility/libcockatrice/utility/peglib.h" \ +"oracle/src/lzma/" \ +"oracle/src/qt-json/" \ +"oracle/src/zip/" \ +"servatrice/src/smtp/") exts=("cpp" "h" "proto") cf_cmd="clang-format" branch="origin/master" @@ -234,7 +240,7 @@ fi # filter excludes for path in "${exclude[@]}"; do for i in "${!names[@]}"; do - rx="^$path/" + rx="^$path" if [[ ${names[$i]} =~ $rx ]]; then unset "names[$i]" fi diff --git a/libcockatrice_card/CMakeLists.txt b/libcockatrice_card/CMakeLists.txt new file mode 100644 index 000000000..7da560431 --- /dev/null +++ b/libcockatrice_card/CMakeLists.txt @@ -0,0 +1,70 @@ +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTORCC ON) + +set(HEADERS + libcockatrice/card/card_info.h + libcockatrice/card/card_info_comparator.h + libcockatrice/card/database/card_database.h + libcockatrice/card/database/card_database_loader.h + libcockatrice/card/database/card_database_manager.h + libcockatrice/card/database/card_database_querier.h + libcockatrice/card/database/model/card_database_model.h + libcockatrice/card/database/model/card_database_display_model.h + libcockatrice/card/database/model/card/card_completer_proxy_model.h + libcockatrice/card/database/model/card/card_search_model.h + libcockatrice/card/database/model/card_set/card_sets_model.h + libcockatrice/card/database/model/token/token_display_model.h + libcockatrice/card/database/model/token/token_edit_model.h + libcockatrice/card/database/parser/card_database_parser.h + libcockatrice/card/database/parser/cockatrice_xml_3.h + libcockatrice/card/database/parser/cockatrice_xml_4.h + libcockatrice/card/printing/exact_card.h + libcockatrice/card/printing/printing_info.h + libcockatrice/card/set/card_set.h + libcockatrice/card/relation/card_relation.h +) + +if(Qt6_FOUND) + qt6_wrap_cpp(MOC_SOURCES ${HEADERS}) +elseif(Qt5_FOUND) + qt5_wrap_cpp(MOC_SOURCES ${HEADERS}) +endif() + +add_library( + libcockatrice_card STATIC + ${MOC_SOURCES} + libcockatrice/card/card_info.cpp + libcockatrice/card/card_info_comparator.cpp + libcockatrice/card/database/card_database.cpp + libcockatrice/card/database/card_database_loader.cpp + libcockatrice/card/database/card_database_manager.cpp + libcockatrice/card/database/card_database_querier.cpp + libcockatrice/card/database/model/card/card_completer_proxy_model.cpp + libcockatrice/card/database/model/card/card_search_model.cpp + libcockatrice/card/database/model/card_set/card_sets_model.cpp + libcockatrice/card/database/model/card_database_display_model.cpp + libcockatrice/card/database/model/card_database_model.cpp + libcockatrice/card/database/model/token/token_display_model.cpp + libcockatrice/card/database/model/token/token_edit_model.cpp + libcockatrice/card/database/parser/card_database_parser.cpp + libcockatrice/card/database/parser/cockatrice_xml_3.cpp + libcockatrice/card/database/parser/cockatrice_xml_4.cpp + libcockatrice/card/printing/exact_card.cpp + libcockatrice/card/printing/printing_info.cpp + libcockatrice/card/relation/card_relation.cpp + libcockatrice/card/set/card_set.cpp + libcockatrice/card/set/card_set_list.cpp +) + +target_include_directories( + libcockatrice_card + PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} + PUBLIC ${CMAKE_SOURCE_DIR}/cockatrice/src/filters +) + +target_link_libraries( + libcockatrice_card + PUBLIC libcockatrice_settings + PUBLIC ${COCKATRICE_QT_MODULES} +) diff --git a/cockatrice/src/card/card_info.cpp b/libcockatrice_card/libcockatrice/card/card_info.cpp similarity index 97% rename from cockatrice/src/card/card_info.cpp rename to libcockatrice_card/libcockatrice/card/card_info.cpp index 47621e65e..4646b3890 100644 --- a/cockatrice/src/card/card_info.cpp +++ b/libcockatrice_card/libcockatrice/card/card_info.cpp @@ -1,10 +1,9 @@ #include "card_info.h" -#include "../picture_loader/picture_loader.h" -#include "../settings/cache_settings.h" -#include "card_relation.h" #include "game_specific_terms.h" -#include "printing_info.h" +#include "printing/printing_info.h" +#include "relation/card_relation.h" +#include "set/card_set.h" #include #include @@ -12,6 +11,7 @@ #include #include #include +#include #include class CardRelation; diff --git a/cockatrice/src/card/card_info.h b/libcockatrice_card/libcockatrice/card/card_info.h similarity index 99% rename from cockatrice/src/card/card_info.h rename to libcockatrice_card/libcockatrice/card/card_info.h index b9b5e62c4..c2a8453d9 100644 --- a/cockatrice/src/card/card_info.h +++ b/libcockatrice_card/libcockatrice/card/card_info.h @@ -7,7 +7,7 @@ #ifndef CARD_INFO_H #define CARD_INFO_H -#include "printing_info.h" +#include "printing/printing_info.h" #include #include diff --git a/cockatrice/src/utility/card_info_comparator.cpp b/libcockatrice_card/libcockatrice/card/card_info_comparator.cpp similarity index 100% rename from cockatrice/src/utility/card_info_comparator.cpp rename to libcockatrice_card/libcockatrice/card/card_info_comparator.cpp diff --git a/cockatrice/src/utility/card_info_comparator.h b/libcockatrice_card/libcockatrice/card/card_info_comparator.h similarity index 95% rename from cockatrice/src/utility/card_info_comparator.h rename to libcockatrice_card/libcockatrice/card/card_info_comparator.h index 8b02afaf3..bafc303a5 100644 --- a/cockatrice/src/utility/card_info_comparator.h +++ b/libcockatrice_card/libcockatrice/card/card_info_comparator.h @@ -7,7 +7,7 @@ #ifndef CARD_INFO_COMPARATOR_H #define CARD_INFO_COMPARATOR_H -#include "../card/card_info.h" +#include "card_info.h" #include #include diff --git a/cockatrice/src/database/card_database.cpp b/libcockatrice_card/libcockatrice/card/database/card_database.cpp similarity index 97% rename from cockatrice/src/database/card_database.cpp rename to libcockatrice_card/libcockatrice/card/database/card_database.cpp index faa9f5113..6ff5fe02c 100644 --- a/cockatrice/src/database/card_database.cpp +++ b/libcockatrice_card/libcockatrice/card/database/card_database.cpp @@ -1,8 +1,6 @@ #include "card_database.h" -#include "../card/card_relation.h" -#include "../picture_loader/picture_loader.h" -#include "../settings/cache_settings.h" +#include "../relation/card_relation.h" #include "parser/cockatrice_xml_3.h" #include "parser/cockatrice_xml_4.h" @@ -14,6 +12,7 @@ #include #include #include +#include #include CardDatabase::CardDatabase(QObject *parent) : QObject(parent), loadStatus(NotLoaded) diff --git a/cockatrice/src/database/card_database.h b/libcockatrice_card/libcockatrice/card/database/card_database.h similarity index 95% rename from cockatrice/src/database/card_database.h rename to libcockatrice_card/libcockatrice/card/database/card_database.h index 151019143..8c7a78ffe 100644 --- a/cockatrice/src/database/card_database.h +++ b/libcockatrice_card/libcockatrice/card/database/card_database.h @@ -7,9 +7,7 @@ #ifndef CARDDATABASE_H #define CARDDATABASE_H -#include "../card/card_set_list.h" -#include "../card/exact_card.h" -#include "../common/card_ref.h" +#include "../set/card_set_list.h" #include "card_database_loader.h" #include "card_database_querier.h" @@ -20,6 +18,7 @@ #include #include #include +#include #include inline Q_LOGGING_CATEGORY(CardDatabaseLog, "card_database"); diff --git a/cockatrice/src/database/card_database_loader.cpp b/libcockatrice_card/libcockatrice/card/database/card_database_loader.cpp similarity index 98% rename from cockatrice/src/database/card_database_loader.cpp rename to libcockatrice_card/libcockatrice/card/database/card_database_loader.cpp index fbb3e6b67..0c9557418 100644 --- a/cockatrice/src/database/card_database_loader.cpp +++ b/libcockatrice_card/libcockatrice/card/database/card_database_loader.cpp @@ -1,6 +1,5 @@ #include "card_database_loader.h" -#include "../settings/cache_settings.h" #include "card_database.h" #include "parser/cockatrice_xml_3.h" #include "parser/cockatrice_xml_4.h" @@ -9,6 +8,7 @@ #include #include #include +#include CardDatabaseLoader::CardDatabaseLoader(QObject *parent, CardDatabase *db) : QObject(parent), database(db) { diff --git a/cockatrice/src/database/card_database_loader.h b/libcockatrice_card/libcockatrice/card/database/card_database_loader.h similarity index 100% rename from cockatrice/src/database/card_database_loader.h rename to libcockatrice_card/libcockatrice/card/database/card_database_loader.h diff --git a/cockatrice/src/database/card_database_manager.cpp b/libcockatrice_card/libcockatrice/card/database/card_database_manager.cpp similarity index 100% rename from cockatrice/src/database/card_database_manager.cpp rename to libcockatrice_card/libcockatrice/card/database/card_database_manager.cpp diff --git a/cockatrice/src/database/card_database_manager.h b/libcockatrice_card/libcockatrice/card/database/card_database_manager.h similarity index 100% rename from cockatrice/src/database/card_database_manager.h rename to libcockatrice_card/libcockatrice/card/database/card_database_manager.h diff --git a/cockatrice/src/database/card_database_querier.cpp b/libcockatrice_card/libcockatrice/card/database/card_database_querier.cpp similarity index 98% rename from cockatrice/src/database/card_database_querier.cpp rename to libcockatrice_card/libcockatrice/card/database/card_database_querier.cpp index 68cc39c9d..f422c51f9 100644 --- a/cockatrice/src/database/card_database_querier.cpp +++ b/libcockatrice_card/libcockatrice/card/database/card_database_querier.cpp @@ -1,6 +1,8 @@ #include "card_database_querier.h" -#include "../utility/card_set_comparator.h" +#include "../card_info.h" +#include "../printing/exact_card.h" +#include "../set/card_set_comparator.h" #include "card_database.h" #include diff --git a/cockatrice/src/database/card_database_querier.h b/libcockatrice_card/libcockatrice/card/database/card_database_querier.h similarity index 95% rename from cockatrice/src/database/card_database_querier.h rename to libcockatrice_card/libcockatrice/card/database/card_database_querier.h index c30cf49c2..cb440706b 100644 --- a/cockatrice/src/database/card_database_querier.h +++ b/libcockatrice_card/libcockatrice/card/database/card_database_querier.h @@ -7,10 +7,11 @@ #ifndef COCKATRICE_CARD_DATABASE_QUERIER_H #define COCKATRICE_CARD_DATABASE_QUERIER_H -#include "../card/exact_card.h" -#include "../common/card_ref.h" +#include "../card_info.h" +#include "../printing/exact_card.h" #include +#include class CardDatabase; class CardDatabaseQuerier : public QObject diff --git a/cockatrice/src/database/model/card/card_completer_proxy_model.cpp b/libcockatrice_card/libcockatrice/card/database/model/card/card_completer_proxy_model.cpp similarity index 100% rename from cockatrice/src/database/model/card/card_completer_proxy_model.cpp rename to libcockatrice_card/libcockatrice/card/database/model/card/card_completer_proxy_model.cpp diff --git a/cockatrice/src/database/model/card/card_completer_proxy_model.h b/libcockatrice_card/libcockatrice/card/database/model/card/card_completer_proxy_model.h similarity index 100% rename from cockatrice/src/database/model/card/card_completer_proxy_model.h rename to libcockatrice_card/libcockatrice/card/database/model/card/card_completer_proxy_model.h diff --git a/cockatrice/src/database/model/card/card_search_model.cpp b/libcockatrice_card/libcockatrice/card/database/model/card/card_search_model.cpp similarity index 95% rename from cockatrice/src/database/model/card/card_search_model.cpp rename to libcockatrice_card/libcockatrice/card/database/model/card/card_search_model.cpp index d39a2207d..6a930c1da 100644 --- a/cockatrice/src/database/model/card/card_search_model.cpp +++ b/libcockatrice_card/libcockatrice/card/database/model/card/card_search_model.cpp @@ -1,9 +1,10 @@ #include "card_search_model.h" -#include "../../../utility/levenshtein.h" +#include "../card_database_display_model.h" #include "../card_database_model.h" #include +#include CardSearchModel::CardSearchModel(CardDatabaseDisplayModel *sourceModel, QObject *parent) : QAbstractListModel(parent), sourceModel(sourceModel) diff --git a/cockatrice/src/database/model/card/card_search_model.h b/libcockatrice_card/libcockatrice/card/database/model/card/card_search_model.h similarity index 100% rename from cockatrice/src/database/model/card/card_search_model.h rename to libcockatrice_card/libcockatrice/card/database/model/card/card_search_model.h diff --git a/cockatrice/src/database/model/card_database_display_model.cpp b/libcockatrice_card/libcockatrice/card/database/model/card_database_display_model.cpp similarity index 100% rename from cockatrice/src/database/model/card_database_display_model.cpp rename to libcockatrice_card/libcockatrice/card/database/model/card_database_display_model.cpp diff --git a/cockatrice/src/database/model/card_database_display_model.h b/libcockatrice_card/libcockatrice/card/database/model/card_database_display_model.h similarity index 98% rename from cockatrice/src/database/model/card_database_display_model.h rename to libcockatrice_card/libcockatrice/card/database/model/card_database_display_model.h index a1f9366e2..a1e949eba 100644 --- a/cockatrice/src/database/model/card_database_display_model.h +++ b/libcockatrice_card/libcockatrice/card/database/model/card_database_display_model.h @@ -8,7 +8,7 @@ #ifndef COCKATRICE_CARD_DATABASE_DISPLAY_MODEL_H #define COCKATRICE_CARD_DATABASE_DISPLAY_MODEL_H -#include "../../filters/filter_string.h" +#include "filter_string.h" #include #include diff --git a/cockatrice/src/database/model/card_database_model.cpp b/libcockatrice_card/libcockatrice/card/database/model/card_database_model.cpp similarity index 99% rename from cockatrice/src/database/model/card_database_model.cpp rename to libcockatrice_card/libcockatrice/card/database/model/card_database_model.cpp index 02175081b..6144121ac 100644 --- a/cockatrice/src/database/model/card_database_model.cpp +++ b/libcockatrice_card/libcockatrice/card/database/model/card_database_model.cpp @@ -1,5 +1,7 @@ #include "card_database_model.h" +#include "../card_database.h" + #include #define CARDDBMODEL_COLUMNS 6 diff --git a/cockatrice/src/database/model/card_database_model.h b/libcockatrice_card/libcockatrice/card/database/model/card_database_model.h similarity index 100% rename from cockatrice/src/database/model/card_database_model.h rename to libcockatrice_card/libcockatrice/card/database/model/card_database_model.h diff --git a/cockatrice/src/client/network/sets_model.cpp b/libcockatrice_card/libcockatrice/card/database/model/card_set/card_sets_model.cpp similarity index 99% rename from cockatrice/src/client/network/sets_model.cpp rename to libcockatrice_card/libcockatrice/card/database/model/card_set/card_sets_model.cpp index a86b710b5..2af815246 100644 --- a/cockatrice/src/client/network/sets_model.cpp +++ b/libcockatrice_card/libcockatrice/card/database/model/card_set/card_sets_model.cpp @@ -1,4 +1,4 @@ -#include "sets_model.h" +#include "card_sets_model.h" #include diff --git a/cockatrice/src/client/network/sets_model.h b/libcockatrice_card/libcockatrice/card/database/model/card_set/card_sets_model.h similarity index 98% rename from cockatrice/src/client/network/sets_model.h rename to libcockatrice_card/libcockatrice/card/database/model/card_set/card_sets_model.h index d341440d7..6f5911b6e 100644 --- a/cockatrice/src/client/network/sets_model.h +++ b/libcockatrice_card/libcockatrice/card/database/model/card_set/card_sets_model.h @@ -7,12 +7,11 @@ #ifndef SETSMODEL_H #define SETSMODEL_H -#include "../../database/card_database.h" - #include #include #include #include +#include class SetsProxyModel; diff --git a/cockatrice/src/database/model/token/token_display_model.cpp b/libcockatrice_card/libcockatrice/card/database/model/token/token_display_model.cpp similarity index 100% rename from cockatrice/src/database/model/token/token_display_model.cpp rename to libcockatrice_card/libcockatrice/card/database/model/token/token_display_model.cpp diff --git a/cockatrice/src/database/model/token/token_display_model.h b/libcockatrice_card/libcockatrice/card/database/model/token/token_display_model.h similarity index 100% rename from cockatrice/src/database/model/token/token_display_model.h rename to libcockatrice_card/libcockatrice/card/database/model/token/token_display_model.h diff --git a/cockatrice/src/database/model/token/token_edit_model.cpp b/libcockatrice_card/libcockatrice/card/database/model/token/token_edit_model.cpp similarity index 83% rename from cockatrice/src/database/model/token/token_edit_model.cpp rename to libcockatrice_card/libcockatrice/card/database/model/token/token_edit_model.cpp index ad6891d2e..8ce290b03 100644 --- a/cockatrice/src/database/model/token/token_edit_model.cpp +++ b/libcockatrice_card/libcockatrice/card/database/model/token/token_edit_model.cpp @@ -1,5 +1,7 @@ -#include "token_edit_model.h" +#include "../token/token_edit_model.h" +#include "../../../card_info.h" +#include "../card_database_display_model.h" #include "../card_database_model.h" TokenEditModel::TokenEditModel(QObject *parent) : CardDatabaseDisplayModel(parent) diff --git a/cockatrice/src/database/model/token/token_edit_model.h b/libcockatrice_card/libcockatrice/card/database/model/token/token_edit_model.h similarity index 100% rename from cockatrice/src/database/model/token/token_edit_model.h rename to libcockatrice_card/libcockatrice/card/database/model/token/token_edit_model.h diff --git a/cockatrice/src/database/parser/card_database_parser.cpp b/libcockatrice_card/libcockatrice/card/database/parser/card_database_parser.cpp similarity index 100% rename from cockatrice/src/database/parser/card_database_parser.cpp rename to libcockatrice_card/libcockatrice/card/database/parser/card_database_parser.cpp diff --git a/cockatrice/src/database/parser/card_database_parser.h b/libcockatrice_card/libcockatrice/card/database/parser/card_database_parser.h similarity index 97% rename from cockatrice/src/database/parser/card_database_parser.h rename to libcockatrice_card/libcockatrice/card/database/parser/card_database_parser.h index 15a86fbfa..c67e3dafe 100644 --- a/cockatrice/src/database/parser/card_database_parser.h +++ b/libcockatrice_card/libcockatrice/card/database/parser/card_database_parser.h @@ -7,7 +7,7 @@ #ifndef CARDDATABASE_PARSER_H #define CARDDATABASE_PARSER_H -#include "../../card/card_info.h" +#include "../../card_info.h" #include #include diff --git a/cockatrice/src/database/parser/cockatrice_xml_3.cpp b/libcockatrice_card/libcockatrice/card/database/parser/cockatrice_xml_3.cpp similarity index 99% rename from cockatrice/src/database/parser/cockatrice_xml_3.cpp rename to libcockatrice_card/libcockatrice/card/database/parser/cockatrice_xml_3.cpp index 7b584bc22..c56f24480 100644 --- a/cockatrice/src/database/parser/cockatrice_xml_3.cpp +++ b/libcockatrice_card/libcockatrice/card/database/parser/cockatrice_xml_3.cpp @@ -1,7 +1,7 @@ #include "cockatrice_xml_3.h" -#include "../../card/card_relation.h" -#include "../../card/card_relation_type.h" +#include "../../relation/card_relation.h" +#include "../../relation/card_relation_type.h" #include #include diff --git a/cockatrice/src/database/parser/cockatrice_xml_3.h b/libcockatrice_card/libcockatrice/card/database/parser/cockatrice_xml_3.h similarity index 96% rename from cockatrice/src/database/parser/cockatrice_xml_3.h rename to libcockatrice_card/libcockatrice/card/database/parser/cockatrice_xml_3.h index 90130f4d1..50fa9c587 100644 --- a/cockatrice/src/database/parser/cockatrice_xml_3.h +++ b/libcockatrice_card/libcockatrice/card/database/parser/cockatrice_xml_3.h @@ -17,7 +17,6 @@ inline Q_LOGGING_CATEGORY(CockatriceXml3Log, "cockatrice_xml.xml_3_parser"); class CockatriceXml3Parser : public ICardDatabaseParser { Q_OBJECT - Q_INTERFACES(ICardDatabaseParser) public: CockatriceXml3Parser() = default; ~CockatriceXml3Parser() override = default; diff --git a/cockatrice/src/database/parser/cockatrice_xml_4.cpp b/libcockatrice_card/libcockatrice/card/database/parser/cockatrice_xml_4.cpp similarity index 99% rename from cockatrice/src/database/parser/cockatrice_xml_4.cpp rename to libcockatrice_card/libcockatrice/card/database/parser/cockatrice_xml_4.cpp index 1c68e80c3..9c80014bf 100644 --- a/cockatrice/src/database/parser/cockatrice_xml_4.cpp +++ b/libcockatrice_card/libcockatrice/card/database/parser/cockatrice_xml_4.cpp @@ -1,12 +1,12 @@ #include "cockatrice_xml_4.h" -#include "../../card/card_relation.h" -#include "../../settings/cache_settings.h" +#include "../../relation/card_relation.h" #include #include #include #include +#include #include #define COCKATRICE_XML4_TAGNAME "cockatrice_carddatabase" diff --git a/cockatrice/src/database/parser/cockatrice_xml_4.h b/libcockatrice_card/libcockatrice/card/database/parser/cockatrice_xml_4.h similarity index 96% rename from cockatrice/src/database/parser/cockatrice_xml_4.h rename to libcockatrice_card/libcockatrice/card/database/parser/cockatrice_xml_4.h index 389e23712..f438f94b2 100644 --- a/cockatrice/src/database/parser/cockatrice_xml_4.h +++ b/libcockatrice_card/libcockatrice/card/database/parser/cockatrice_xml_4.h @@ -17,7 +17,6 @@ inline Q_LOGGING_CATEGORY(CockatriceXml4Log, "cockatrice_xml.xml_4_parser"); class CockatriceXml4Parser : public ICardDatabaseParser { Q_OBJECT - Q_INTERFACES(ICardDatabaseParser) public: CockatriceXml4Parser() = default; ~CockatriceXml4Parser() override = default; diff --git a/cockatrice/src/card/game_specific_terms.h b/libcockatrice_card/libcockatrice/card/game_specific_terms.h similarity index 100% rename from cockatrice/src/card/game_specific_terms.h rename to libcockatrice_card/libcockatrice/card/game_specific_terms.h diff --git a/cockatrice/src/card/exact_card.cpp b/libcockatrice_card/libcockatrice/card/printing/exact_card.cpp similarity index 96% rename from cockatrice/src/card/exact_card.cpp rename to libcockatrice_card/libcockatrice/card/printing/exact_card.cpp index fbd60071e..993b5b96e 100644 --- a/cockatrice/src/card/exact_card.cpp +++ b/libcockatrice_card/libcockatrice/card/printing/exact_card.cpp @@ -1,5 +1,8 @@ #include "exact_card.h" +#include "../card_info.h" +#include "printing_info.h" + /** * Default constructor. * This will set the CardInfoPtr to null. diff --git a/cockatrice/src/card/exact_card.h b/libcockatrice_card/libcockatrice/card/printing/exact_card.h similarity index 97% rename from cockatrice/src/card/exact_card.h rename to libcockatrice_card/libcockatrice/card/printing/exact_card.h index f0ba25c02..e3d5d828a 100644 --- a/cockatrice/src/card/exact_card.h +++ b/libcockatrice_card/libcockatrice/card/printing/exact_card.h @@ -1,7 +1,7 @@ #ifndef EXACT_CARD_H #define EXACT_CARD_H -#include "card_info.h" +#include "../card_info.h" /** * @class ExactCard diff --git a/cockatrice/src/card/printing_info.cpp b/libcockatrice_card/libcockatrice/card/printing/printing_info.cpp similarity index 90% rename from cockatrice/src/card/printing_info.cpp rename to libcockatrice_card/libcockatrice/card/printing/printing_info.cpp index 3e7735e6b..9de563d78 100644 --- a/cockatrice/src/card/printing_info.cpp +++ b/libcockatrice_card/libcockatrice/card/printing/printing_info.cpp @@ -1,5 +1,7 @@ #include "printing_info.h" +#include "../set/card_set.h" + PrintingInfo::PrintingInfo(const CardSetPtr &_set) : set(_set) { } diff --git a/cockatrice/src/card/printing_info.h b/libcockatrice_card/libcockatrice/card/printing/printing_info.h similarity index 97% rename from cockatrice/src/card/printing_info.h rename to libcockatrice_card/libcockatrice/card/printing/printing_info.h index cf262b6bb..c2afe983a 100644 --- a/cockatrice/src/card/printing_info.h +++ b/libcockatrice_card/libcockatrice/card/printing/printing_info.h @@ -1,7 +1,7 @@ #ifndef COCKATRICE_PRINTING_INFO_H #define COCKATRICE_PRINTING_INFO_H -#include "card_set.h" +#include "../set/card_set.h" #include #include diff --git a/cockatrice/src/card/card_relation.cpp b/libcockatrice_card/libcockatrice/card/relation/card_relation.cpp similarity index 93% rename from cockatrice/src/card/card_relation.cpp rename to libcockatrice_card/libcockatrice/card/relation/card_relation.cpp index 41fbb5617..90e59e439 100644 --- a/cockatrice/src/card/card_relation.cpp +++ b/libcockatrice_card/libcockatrice/card/relation/card_relation.cpp @@ -1,5 +1,7 @@ #include "card_relation.h" +#include "card_relation_type.h" + CardRelation::CardRelation(const QString &_name, CardRelationType _attachType, bool _isCreateAllExclusion, diff --git a/cockatrice/src/card/card_relation.h b/libcockatrice_card/libcockatrice/card/relation/card_relation.h similarity index 100% rename from cockatrice/src/card/card_relation.h rename to libcockatrice_card/libcockatrice/card/relation/card_relation.h diff --git a/cockatrice/src/card/card_relation_type.h b/libcockatrice_card/libcockatrice/card/relation/card_relation_type.h similarity index 100% rename from cockatrice/src/card/card_relation_type.h rename to libcockatrice_card/libcockatrice/card/relation/card_relation_type.h diff --git a/cockatrice/src/card/card_set.cpp b/libcockatrice_card/libcockatrice/card/set/card_set.cpp similarity index 97% rename from cockatrice/src/card/card_set.cpp rename to libcockatrice_card/libcockatrice/card/set/card_set.cpp index 89bc0f6e5..6b4a8f764 100644 --- a/cockatrice/src/card/card_set.cpp +++ b/libcockatrice_card/libcockatrice/card/set/card_set.cpp @@ -1,6 +1,6 @@ #include "card_set.h" -#include "../settings/cache_settings.h" +#include const char *CardSet::TOKENS_SETNAME = "TK"; diff --git a/cockatrice/src/card/card_set.h b/libcockatrice_card/libcockatrice/card/set/card_set.h similarity index 100% rename from cockatrice/src/card/card_set.h rename to libcockatrice_card/libcockatrice/card/set/card_set.h diff --git a/cockatrice/src/utility/card_set_comparator.h b/libcockatrice_card/libcockatrice/card/set/card_set_comparator.h similarity index 96% rename from cockatrice/src/utility/card_set_comparator.h rename to libcockatrice_card/libcockatrice/card/set/card_set_comparator.h index 4089cf42b..53e2cb97d 100644 --- a/cockatrice/src/utility/card_set_comparator.h +++ b/libcockatrice_card/libcockatrice/card/set/card_set_comparator.h @@ -7,7 +7,7 @@ #ifndef SET_PRIORITY_COMPARATOR_H #define SET_PRIORITY_COMPARATOR_H -#include "../card/card_info.h" +#include "../card_info.h" class SetPriorityComparator { diff --git a/cockatrice/src/card/card_set_list.cpp b/libcockatrice_card/libcockatrice/card/set/card_set_list.cpp similarity index 100% rename from cockatrice/src/card/card_set_list.cpp rename to libcockatrice_card/libcockatrice/card/set/card_set_list.cpp diff --git a/cockatrice/src/card/card_set_list.h b/libcockatrice_card/libcockatrice/card/set/card_set_list.h similarity index 100% rename from cockatrice/src/card/card_set_list.h rename to libcockatrice_card/libcockatrice/card/set/card_set_list.h diff --git a/libcockatrice_deck_list/CMakeLists.txt b/libcockatrice_deck_list/CMakeLists.txt new file mode 100644 index 000000000..0464d0f6a --- /dev/null +++ b/libcockatrice_deck_list/CMakeLists.txt @@ -0,0 +1,42 @@ +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTORCC ON) + +set(HEADERS + libcockatrice/deck_list/abstract_deck_list_card_node.h + libcockatrice/deck_list/abstract_deck_list_node.h + libcockatrice/deck_list/deck_list.h + libcockatrice/deck_list/deck_list_card_node.h + libcockatrice/deck_list/deck_list_model.h + libcockatrice/deck_list/deck_list_sort_filter_proxy_model.h + libcockatrice/deck_list/deck_loader.h + libcockatrice/deck_list/inner_deck_list_node.h +) + +if(Qt6_FOUND) + qt6_wrap_cpp(MOC_SOURCES ${HEADERS}) +elseif(Qt5_FOUND) + qt5_wrap_cpp(MOC_SOURCES ${HEADERS}) +endif() + +add_library( + libcockatrice_deck_list STATIC + ${MOC_SOURCES} + libcockatrice/deck_list/abstract_deck_list_card_node.cpp + libcockatrice/deck_list/abstract_deck_list_node.cpp + libcockatrice/deck_list/deck_list.cpp + libcockatrice/deck_list/deck_list_card_node.cpp + libcockatrice/deck_list/deck_list_model.cpp + libcockatrice/deck_list/deck_list_sort_filter_proxy_model.cpp + libcockatrice/deck_list/deck_loader.cpp + libcockatrice/deck_list/inner_deck_list_node.cpp +) + +add_dependencies(libcockatrice_deck_list libcockatrice_protocol) + +target_include_directories(libcockatrice_deck_list PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) + +target_link_libraries( + libcockatrice_deck_list PUBLIC libcockatrice_protocol libcockatrice_card libcockatrice_utility + ${COCKATRICE_QT_MODULES} +) diff --git a/common/abstract_deck_list_card_node.cpp b/libcockatrice_deck_list/libcockatrice/deck_list/abstract_deck_list_card_node.cpp similarity index 100% rename from common/abstract_deck_list_card_node.cpp rename to libcockatrice_deck_list/libcockatrice/deck_list/abstract_deck_list_card_node.cpp diff --git a/common/abstract_deck_list_card_node.h b/libcockatrice_deck_list/libcockatrice/deck_list/abstract_deck_list_card_node.h similarity index 100% rename from common/abstract_deck_list_card_node.h rename to libcockatrice_deck_list/libcockatrice/deck_list/abstract_deck_list_card_node.h diff --git a/common/abstract_deck_list_node.cpp b/libcockatrice_deck_list/libcockatrice/deck_list/abstract_deck_list_node.cpp similarity index 100% rename from common/abstract_deck_list_node.cpp rename to libcockatrice_deck_list/libcockatrice/deck_list/abstract_deck_list_node.cpp diff --git a/common/abstract_deck_list_node.h b/libcockatrice_deck_list/libcockatrice/deck_list/abstract_deck_list_node.h similarity index 100% rename from common/abstract_deck_list_node.h rename to libcockatrice_deck_list/libcockatrice/deck_list/abstract_deck_list_node.h diff --git a/common/deck_list.cpp b/libcockatrice_deck_list/libcockatrice/deck_list/deck_list.cpp similarity index 100% rename from common/deck_list.cpp rename to libcockatrice_deck_list/libcockatrice/deck_list/deck_list.cpp diff --git a/common/deck_list.h b/libcockatrice_deck_list/libcockatrice/deck_list/deck_list.h similarity index 98% rename from common/deck_list.h rename to libcockatrice_deck_list/libcockatrice/deck_list/deck_list.h index 2a70ea4b1..fc0c07405 100644 --- a/common/deck_list.h +++ b/libcockatrice_deck_list/libcockatrice/deck_list/deck_list.h @@ -10,14 +10,14 @@ #ifndef DECKLIST_H #define DECKLIST_H -#include "card_ref.h" #include "inner_deck_list_node.h" #include #include #include #include -#include +#include +#include class AbstractDecklistNode; class DecklistCardNode; diff --git a/common/deck_list_card_node.cpp b/libcockatrice_deck_list/libcockatrice/deck_list/deck_list_card_node.cpp similarity index 100% rename from common/deck_list_card_node.cpp rename to libcockatrice_deck_list/libcockatrice/deck_list/deck_list_card_node.cpp diff --git a/common/deck_list_card_node.h b/libcockatrice_deck_list/libcockatrice/deck_list/deck_list_card_node.h similarity index 99% rename from common/deck_list_card_node.h rename to libcockatrice_deck_list/libcockatrice/deck_list/deck_list_card_node.h index 84a396daf..6d61ed970 100644 --- a/common/deck_list_card_node.h +++ b/libcockatrice_deck_list/libcockatrice/deck_list/deck_list_card_node.h @@ -13,7 +13,8 @@ #define COCKATRICE_DECK_LIST_CARD_NODE_H #include "abstract_deck_list_card_node.h" -#include "card_ref.h" + +#include /** * @class DecklistCardNode diff --git a/cockatrice/src/deck/deck_list_model.cpp b/libcockatrice_deck_list/libcockatrice/deck_list/deck_list_model.cpp similarity index 99% rename from cockatrice/src/deck/deck_list_model.cpp rename to libcockatrice_deck_list/libcockatrice/deck_list/deck_list_model.cpp index 4ff16378c..01ae68a71 100644 --- a/cockatrice/src/deck/deck_list_model.cpp +++ b/libcockatrice_deck_list/libcockatrice/deck_list/deck_list_model.cpp @@ -1,8 +1,5 @@ #include "deck_list_model.h" -#include "../database/card_database_manager.h" -#include "../main.h" -#include "../settings/cache_settings.h" #include "deck_loader.h" #include @@ -13,6 +10,8 @@ #include #include #include +#include +#include DeckListModel::DeckListModel(QObject *parent) : QAbstractItemModel(parent), lastKnownColumn(1), lastKnownOrder(Qt::AscendingOrder) diff --git a/cockatrice/src/deck/deck_list_model.h b/libcockatrice_deck_list/libcockatrice/deck_list/deck_list_model.h similarity index 97% rename from cockatrice/src/deck/deck_list_model.h rename to libcockatrice_deck_list/libcockatrice/deck_list/deck_list_model.h index 28d95a632..e169af395 100644 --- a/cockatrice/src/deck/deck_list_model.h +++ b/libcockatrice_deck_list/libcockatrice/deck_list/deck_list_model.h @@ -1,13 +1,12 @@ #ifndef DECKLISTMODEL_H #define DECKLISTMODEL_H -#include "../card/exact_card.h" -#include "abstract_deck_list_card_node.h" -#include "deck_list.h" -#include "deck_list_card_node.h" - #include #include +#include +#include +#include +#include class DeckLoader; class CardDatabase; diff --git a/cockatrice/src/utility/deck_list_sort_filter_proxy_model.cpp b/libcockatrice_deck_list/libcockatrice/deck_list/deck_list_sort_filter_proxy_model.cpp similarity index 98% rename from cockatrice/src/utility/deck_list_sort_filter_proxy_model.cpp rename to libcockatrice_deck_list/libcockatrice/deck_list/deck_list_sort_filter_proxy_model.cpp index a7776cbec..35fd4d9f8 100644 --- a/cockatrice/src/utility/deck_list_sort_filter_proxy_model.cpp +++ b/libcockatrice_deck_list/libcockatrice/deck_list/deck_list_sort_filter_proxy_model.cpp @@ -1,6 +1,6 @@ #include "deck_list_sort_filter_proxy_model.h" -#include "../deck/deck_list_model.h" +#include "deck_list_model.h" bool DeckListSortFilterProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const { diff --git a/cockatrice/src/utility/deck_list_sort_filter_proxy_model.h b/libcockatrice_deck_list/libcockatrice/deck_list/deck_list_sort_filter_proxy_model.h similarity index 92% rename from cockatrice/src/utility/deck_list_sort_filter_proxy_model.h rename to libcockatrice_deck_list/libcockatrice/deck_list/deck_list_sort_filter_proxy_model.h index af352a56b..0603beace 100644 --- a/cockatrice/src/utility/deck_list_sort_filter_proxy_model.h +++ b/libcockatrice_deck_list/libcockatrice/deck_list/deck_list_sort_filter_proxy_model.h @@ -7,9 +7,8 @@ #ifndef COCKATRICE_DECK_LIST_SORT_FILTER_PROXY_MODEL_H #define COCKATRICE_DECK_LIST_SORT_FILTER_PROXY_MODEL_H -#include "../database/card_database_manager.h" - #include +#include class DeckListSortFilterProxyModel : public QSortFilterProxyModel { diff --git a/cockatrice/src/deck/deck_loader.cpp b/libcockatrice_deck_list/libcockatrice/deck_list/deck_loader.cpp similarity index 98% rename from cockatrice/src/deck/deck_loader.cpp rename to libcockatrice_deck_list/libcockatrice/deck_list/deck_loader.cpp index 8e98422a6..95f4d9224 100644 --- a/cockatrice/src/deck/deck_loader.cpp +++ b/libcockatrice_deck_list/libcockatrice/deck_list/deck_loader.cpp @@ -1,11 +1,5 @@ #include "deck_loader.h" -#include "../database/card_database.h" -#include "../database/card_database_manager.h" -#include "../main.h" -#include "deck_list.h" -#include "deck_list_card_node.h" - #include #include #include @@ -16,6 +10,10 @@ #include #include #include +#include +#include +#include +#include const QStringList DeckLoader::ACCEPTED_FILE_EXTENSIONS = {"*.cod", "*.dec", "*.dek", "*.txt", "*.mwDeck"}; diff --git a/cockatrice/src/deck/deck_loader.h b/libcockatrice_deck_list/libcockatrice/deck_list/deck_loader.h similarity index 98% rename from cockatrice/src/deck/deck_loader.h rename to libcockatrice_deck_list/libcockatrice/deck_list/deck_loader.h index 53c4ef434..f11ded444 100644 --- a/cockatrice/src/deck/deck_loader.h +++ b/libcockatrice_deck_list/libcockatrice/deck_list/deck_loader.h @@ -7,9 +7,8 @@ #ifndef DECK_LOADER_H #define DECK_LOADER_H -#include "deck_list.h" - #include +#include inline Q_LOGGING_CATEGORY(DeckLoaderLog, "deck_loader") diff --git a/common/inner_deck_list_node.cpp b/libcockatrice_deck_list/libcockatrice/deck_list/inner_deck_list_node.cpp similarity index 100% rename from common/inner_deck_list_node.cpp rename to libcockatrice_deck_list/libcockatrice/deck_list/inner_deck_list_node.cpp diff --git a/common/inner_deck_list_node.h b/libcockatrice_deck_list/libcockatrice/deck_list/inner_deck_list_node.h similarity index 100% rename from common/inner_deck_list_node.h rename to libcockatrice_deck_list/libcockatrice/deck_list/inner_deck_list_node.h diff --git a/libcockatrice_network/CMakeLists.txt b/libcockatrice_network/CMakeLists.txt new file mode 100644 index 000000000..3069c0db4 --- /dev/null +++ b/libcockatrice_network/CMakeLists.txt @@ -0,0 +1,14 @@ +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTORCC ON) + +add_subdirectory(libcockatrice/network/client) +add_subdirectory(libcockatrice/network/server) + +add_library(libcockatrice_network INTERFACE) + +target_include_directories(libcockatrice_network INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) + +target_link_libraries( + libcockatrice_network INTERFACE ${COCKATRICE_QT_MODULES} libcockatrice_network_client libcockatrice_network_server +) diff --git a/libcockatrice_network/libcockatrice/network/client/CMakeLists.txt b/libcockatrice_network/libcockatrice/network/client/CMakeLists.txt new file mode 100644 index 000000000..d86210edd --- /dev/null +++ b/libcockatrice_network/libcockatrice/network/client/CMakeLists.txt @@ -0,0 +1,16 @@ +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTORCC ON) + +add_subdirectory(abstract) +add_subdirectory(local) +add_subdirectory(remote) + +add_library(libcockatrice_network_client INTERFACE) + +target_include_directories(libcockatrice_network_client INTERFACE .) + +target_link_libraries( + libcockatrice_network_client INTERFACE ${COCKATRICE_QT_MODULES} libcockatrice_network_client_abstract + libcockatrice_network_client_local libcockatrice_network_client_remote +) diff --git a/libcockatrice_network/libcockatrice/network/client/abstract/CMakeLists.txt b/libcockatrice_network/libcockatrice/network/client/abstract/CMakeLists.txt new file mode 100644 index 000000000..54e4d83e0 --- /dev/null +++ b/libcockatrice_network/libcockatrice/network/client/abstract/CMakeLists.txt @@ -0,0 +1,24 @@ +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTORCC ON) + +set(HEADERS abstract_client.h) + +set(SOURCES abstract_client.cpp) + +if(Qt6_FOUND) + qt6_wrap_cpp(MOC_SOURCES ${HEADERS}) +elseif(Qt5_FOUND) + qt5_wrap_cpp(MOC_SOURCES ${HEADERS}) +endif() + +add_library(libcockatrice_network_client_abstract STATIC ${MOC_SOURCES} ${SOURCES}) + +add_dependencies(libcockatrice_network_client_abstract libcockatrice_protocol libcockatrice_network_server_remote) + +target_include_directories(libcockatrice_network_client_abstract PUBLIC .) + +target_link_libraries( + libcockatrice_network_client_abstract PUBLIC ${COCKATRICE_QT_MODULES} libcockatrice_protocol + libcockatrice_network_server_remote +) diff --git a/cockatrice/src/server/abstract_client.cpp b/libcockatrice_network/libcockatrice/network/client/abstract/abstract_client.cpp similarity index 87% rename from cockatrice/src/server/abstract_client.cpp rename to libcockatrice_network/libcockatrice/network/client/abstract/abstract_client.cpp index 4f3098871..11458768d 100644 --- a/cockatrice/src/server/abstract_client.cpp +++ b/libcockatrice_network/libcockatrice/network/client/abstract/abstract_client.cpp @@ -1,25 +1,24 @@ #include "abstract_client.h" -#include "featureset.h" -#include "get_pb_extension.h" -#include "pb/commands.pb.h" -#include "pb/event_add_to_list.pb.h" -#include "pb/event_connection_closed.pb.h" -#include "pb/event_game_joined.pb.h" -#include "pb/event_list_rooms.pb.h" -#include "pb/event_notify_user.pb.h" -#include "pb/event_remove_from_list.pb.h" -#include "pb/event_replay_added.pb.h" -#include "pb/event_server_identification.pb.h" -#include "pb/event_server_message.pb.h" -#include "pb/event_server_shutdown.pb.h" -#include "pb/event_user_joined.pb.h" -#include "pb/event_user_left.pb.h" -#include "pb/event_user_message.pb.h" -#include "pb/server_message.pb.h" -#include "pending_command.h" - #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include AbstractClient::AbstractClient(QObject *parent) : QObject(parent), nextCmdId(0), status(StatusDisconnected), serverSupportsPasswordHash(false) diff --git a/cockatrice/src/server/abstract_client.h b/libcockatrice_network/libcockatrice/network/client/abstract/abstract_client.h similarity index 97% rename from cockatrice/src/server/abstract_client.h rename to libcockatrice_network/libcockatrice/network/client/abstract/abstract_client.h index e6a812df1..165737e95 100644 --- a/cockatrice/src/server/abstract_client.h +++ b/libcockatrice_network/libcockatrice/network/client/abstract/abstract_client.h @@ -7,12 +7,11 @@ #ifndef ABSTRACTCLIENT_H #define ABSTRACTCLIENT_H -#include "pb/response.pb.h" -#include "pb/serverinfo_user.pb.h" - #include #include #include +#include +#include class PendingCommand; class CommandContainer; diff --git a/libcockatrice_network/libcockatrice/network/client/local/CMakeLists.txt b/libcockatrice_network/libcockatrice/network/client/local/CMakeLists.txt new file mode 100644 index 000000000..3c202904d --- /dev/null +++ b/libcockatrice_network/libcockatrice/network/client/local/CMakeLists.txt @@ -0,0 +1,23 @@ +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTORCC ON) + +set(HEADERS local_client.h) + +set(SOURCES local_client.cpp) + +if(Qt6_FOUND) + qt6_wrap_cpp(MOC_SOURCES ${HEADERS}) +elseif(Qt5_FOUND) + qt5_wrap_cpp(MOC_SOURCES ${HEADERS}) +endif() + +add_library(libcockatrice_network_client_local STATIC ${MOC_SOURCES} ${SOURCES}) + +add_dependencies(libcockatrice_network_client_local libcockatrice_network_client_abstract) + +target_include_directories(libcockatrice_network_client_local PUBLIC .) + +target_link_libraries( + libcockatrice_network_client_local PUBLIC ${COCKATRICE_QT_MODULES} libcockatrice_network_client_abstract +) diff --git a/cockatrice/src/server/local_client.cpp b/libcockatrice_network/libcockatrice/network/client/local/local_client.cpp similarity index 86% rename from cockatrice/src/server/local_client.cpp rename to libcockatrice_network/libcockatrice/network/client/local/local_client.cpp index 734660af1..eefa3a2f3 100644 --- a/cockatrice/src/server/local_client.cpp +++ b/libcockatrice_network/libcockatrice/network/client/local/local_client.cpp @@ -1,8 +1,9 @@ #include "local_client.h" -#include "debug_pb_message.h" -#include "local_server_interface.h" -#include "pb/session_commands.pb.h" +#include "../../server/local/local_server_interface.h" + +#include +#include LocalClient::LocalClient(LocalServerInterface *_lsi, const QString &_playerName, diff --git a/cockatrice/src/server/local_client.h b/libcockatrice_network/libcockatrice/network/client/local/local_client.h similarity index 94% rename from cockatrice/src/server/local_client.h rename to libcockatrice_network/libcockatrice/network/client/local/local_client.h index 2523e1d51..e8c5330ac 100644 --- a/cockatrice/src/server/local_client.h +++ b/libcockatrice_network/libcockatrice/network/client/local/local_client.h @@ -7,7 +7,7 @@ #ifndef LOCALCLIENT_H #define LOCALCLIENT_H -#include "abstract_client.h" +#include "../abstract/abstract_client.h" #include diff --git a/libcockatrice_network/libcockatrice/network/client/remote/CMakeLists.txt b/libcockatrice_network/libcockatrice/network/client/remote/CMakeLists.txt new file mode 100644 index 000000000..01f438b08 --- /dev/null +++ b/libcockatrice_network/libcockatrice/network/client/remote/CMakeLists.txt @@ -0,0 +1,24 @@ +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTORCC ON) + +set(HEADERS remote_client.h) + +set(SOURCES remote_client.cpp) + +if(Qt6_FOUND) + qt6_wrap_cpp(MOC_SOURCES ${HEADERS}) +elseif(Qt5_FOUND) + qt5_wrap_cpp(MOC_SOURCES ${HEADERS}) +endif() + +add_library(libcockatrice_network_client_remote STATIC ${MOC_SOURCES} ${SOURCES}) + +add_dependencies(libcockatrice_network_client_remote libcockatrice_network_client_abstract libcockatrice_protocol) + +target_include_directories(libcockatrice_network_client_remote PUBLIC .) + +target_link_libraries( + libcockatrice_network_client_remote PUBLIC ${COCKATRICE_QT_MODULES} libcockatrice_network_client_abstract + libcockatrice_settings libcockatrice_utility libcockatrice_protocol +) diff --git a/cockatrice/src/server/remote/remote_client.cpp b/libcockatrice_network/libcockatrice/network/client/remote/remote_client.cpp similarity index 97% rename from cockatrice/src/server/remote/remote_client.cpp rename to libcockatrice_network/libcockatrice/network/client/remote/remote_client.cpp index 1d8579c14..fdcbfae88 100644 --- a/cockatrice/src/server/remote/remote_client.cpp +++ b/libcockatrice_network/libcockatrice/network/client/remote/remote_client.cpp @@ -1,18 +1,6 @@ #include "remote_client.h" -#include "../../main.h" -#include "../../settings/cache_settings.h" -#include "../pending_command.h" -#include "debug_pb_message.h" -#include "passwordhasher.h" -#include "pb/event_server_identification.pb.h" -#include "pb/response_activate.pb.h" -#include "pb/response_forgotpasswordrequest.pb.h" -#include "pb/response_login.pb.h" -#include "pb/response_password_salt.pb.h" -#include "pb/response_register.pb.h" -#include "pb/server_message.pb.h" -#include "pb/session_commands.pb.h" +#include "../../../../cockatrice/src/main.h" #include "version_string.h" #include @@ -23,6 +11,18 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const unsigned int protocolVersion = 14; diff --git a/cockatrice/src/server/remote/remote_client.h b/libcockatrice_network/libcockatrice/network/client/remote/remote_client.h similarity index 98% rename from cockatrice/src/server/remote/remote_client.h rename to libcockatrice_network/libcockatrice/network/client/remote/remote_client.h index 365b5b520..d3984d5dd 100644 --- a/cockatrice/src/server/remote/remote_client.h +++ b/libcockatrice_network/libcockatrice/network/client/remote/remote_client.h @@ -7,12 +7,12 @@ #ifndef REMOTECLIENT_H #define REMOTECLIENT_H -#include "../abstract_client.h" -#include "pb/commands.pb.h" +#include "../abstract/abstract_client.h" #include #include #include +#include inline Q_LOGGING_CATEGORY(RemoteClientLog, "remote_client"); diff --git a/libcockatrice_network/libcockatrice/network/server/CMakeLists.txt b/libcockatrice_network/libcockatrice/network/server/CMakeLists.txt new file mode 100644 index 000000000..cbb717ad8 --- /dev/null +++ b/libcockatrice_network/libcockatrice/network/server/CMakeLists.txt @@ -0,0 +1,15 @@ +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTORCC ON) + +add_subdirectory(local) +add_subdirectory(remote) + +add_library(libcockatrice_network_server INTERFACE) + +target_include_directories(libcockatrice_network_server INTERFACE .) + +target_link_libraries( + libcockatrice_network_server INTERFACE ${COCKATRICE_QT_MODULES} libcockatrice_network_server_local + libcockatrice_network_server_remote +) diff --git a/libcockatrice_network/libcockatrice/network/server/local/CMakeLists.txt b/libcockatrice_network/libcockatrice/network/server/local/CMakeLists.txt new file mode 100644 index 000000000..80fb379a4 --- /dev/null +++ b/libcockatrice_network/libcockatrice/network/server/local/CMakeLists.txt @@ -0,0 +1,21 @@ +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTORCC ON) + +set(HEADERS local_server.h local_server_interface.h) + +set(SOURCES local_server.cpp local_server_interface.cpp) + +if(Qt6_FOUND) + qt6_wrap_cpp(MOC_SOURCES ${HEADERS}) +elseif(Qt5_FOUND) + qt5_wrap_cpp(MOC_SOURCES ${HEADERS}) +endif() + +add_library(libcockatrice_network_server_local STATIC ${MOC_SOURCES} ${SOURCES}) + +add_dependencies(libcockatrice_network_server_local libcockatrice_protocol) + +target_include_directories(libcockatrice_network_server_local PUBLIC .) + +target_link_libraries(libcockatrice_network_server_local PUBLIC ${COCKATRICE_QT_MODULES} libcockatrice_protocol) diff --git a/cockatrice/src/server/local_server.cpp b/libcockatrice_network/libcockatrice/network/server/local/local_server.cpp similarity index 98% rename from cockatrice/src/server/local_server.cpp rename to libcockatrice_network/libcockatrice/network/server/local/local_server.cpp index 74ee8601d..8f9d82aa4 100644 --- a/cockatrice/src/server/local_server.cpp +++ b/libcockatrice_network/libcockatrice/network/server/local/local_server.cpp @@ -1,7 +1,8 @@ #include "local_server.h" #include "local_server_interface.h" -#include "server/server_room.h" + +#include <../remote/server_room.h> LocalServer::LocalServer(QObject *parent) : Server(parent) { diff --git a/cockatrice/src/server/local_server.h b/libcockatrice_network/libcockatrice/network/server/local/local_server.h similarity index 94% rename from cockatrice/src/server/local_server.h rename to libcockatrice_network/libcockatrice/network/server/local/local_server.h index 9546e3f9c..70586f6c1 100644 --- a/cockatrice/src/server/local_server.h +++ b/libcockatrice_network/libcockatrice/network/server/local/local_server.h @@ -7,8 +7,8 @@ #ifndef LOCALSERVER_H #define LOCALSERVER_H -#include "server/server.h" -#include "server/server_database_interface.h" +#include <../remote/server.h> +#include <../remote/server_database_interface.h> class LocalServerInterface; diff --git a/cockatrice/src/server/local_server_interface.cpp b/libcockatrice_network/libcockatrice/network/server/local/local_server_interface.cpp similarity index 100% rename from cockatrice/src/server/local_server_interface.cpp rename to libcockatrice_network/libcockatrice/network/server/local/local_server_interface.cpp diff --git a/cockatrice/src/server/local_server_interface.h b/libcockatrice_network/libcockatrice/network/server/local/local_server_interface.h similarity index 94% rename from cockatrice/src/server/local_server_interface.h rename to libcockatrice_network/libcockatrice/network/server/local/local_server_interface.h index 5551b47a5..1ddf5a85a 100644 --- a/cockatrice/src/server/local_server_interface.h +++ b/libcockatrice_network/libcockatrice/network/server/local/local_server_interface.h @@ -7,7 +7,7 @@ #ifndef LOCALSERVERINTERFACE_H #define LOCALSERVERINTERFACE_H -#include "server/server_protocolhandler.h" +#include <../remote/server_protocolhandler.h> class LocalServer; diff --git a/libcockatrice_network/libcockatrice/network/server/remote/CMakeLists.txt b/libcockatrice_network/libcockatrice/network/server/remote/CMakeLists.txt new file mode 100644 index 000000000..e883baa0d --- /dev/null +++ b/libcockatrice_network/libcockatrice/network/server/remote/CMakeLists.txt @@ -0,0 +1,63 @@ +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTORCC ON) + +set(HEADERS + game/server_abstract_participant.h + game/server_abstract_player.h + game/server_arrow.h + game/server_arrowtarget.h + game/server_card.h + game/server_cardzone.h + game/server_counter.h + game/server_game.h + game/server_player.h + game/server_spectator.h + server.h + server_abstractuserinterface.h + server_database_interface.h + server_protocolhandler.h + server_remoteuserinterface.h + server_response_containers.h + server_room.h + serverinfo_user_container.h +) + +if(Qt6_FOUND) + qt6_wrap_cpp(MOC_SOURCES ${HEADERS}) +elseif(Qt5_FOUND) + qt5_wrap_cpp(MOC_SOURCES ${HEADERS}) +endif() + +add_library( + libcockatrice_network_server_remote STATIC + ${MOC_SOURCES} + game/server_abstract_participant.cpp + game/server_abstract_player.cpp + game/server_arrow.cpp + game/server_arrowtarget.cpp + game/server_card.cpp + game/server_cardzone.cpp + game/server_counter.cpp + game/server_game.cpp + game/server_player.cpp + game/server_spectator.cpp + server.cpp + server_abstractuserinterface.cpp + server_database_interface.cpp + server_protocolhandler.cpp + server_remoteuserinterface.cpp + server_response_containers.cpp + server_room.cpp + serverinfo_user_container.cpp +) + +add_dependencies(libcockatrice_network_server_remote libcockatrice_protocol) + +target_include_directories(libcockatrice_network_server_remote PUBLIC .) + +# Make cockatrice_server depend on cockatrice_protocol +target_link_libraries( + libcockatrice_network_server_remote PUBLIC libcockatrice_protocol libcockatrice_utility libcockatrice_rng + libcockatrice_deck_list ${COCKATRICE_QT_MODULES} +) diff --git a/common/server/game/server_abstract_participant.cpp b/libcockatrice_network/libcockatrice/network/server/remote/game/server_abstract_participant.cpp similarity index 83% rename from common/server/game/server_abstract_participant.cpp rename to libcockatrice_network/libcockatrice/network/server/remote/game/server_abstract_participant.cpp index 1ef765d8b..c6a29b275 100644 --- a/common/server/game/server_abstract_participant.cpp +++ b/libcockatrice_network/libcockatrice/network/server/remote/game/server_abstract_participant.cpp @@ -1,81 +1,9 @@ #include "server_abstract_participant.h" -#include "../../color.h" -#include "../../deck_list.h" -#include "../../deck_list_card_node.h" -#include "../../get_pb_extension.h" -#include "../../rng_abstract.h" -#include "../../trice_limits.h" #include "../server.h" #include "../server_abstractuserinterface.h" #include "../server_database_interface.h" #include "../server_room.h" -#include "pb/command_attach_card.pb.h" -#include "pb/command_change_zone_properties.pb.h" -#include "pb/command_concede.pb.h" -#include "pb/command_create_arrow.pb.h" -#include "pb/command_create_counter.pb.h" -#include "pb/command_create_token.pb.h" -#include "pb/command_deck_select.pb.h" -#include "pb/command_del_counter.pb.h" -#include "pb/command_delete_arrow.pb.h" -#include "pb/command_draw_cards.pb.h" -#include "pb/command_dump_zone.pb.h" -#include "pb/command_flip_card.pb.h" -#include "pb/command_game_say.pb.h" -#include "pb/command_inc_card_counter.pb.h" -#include "pb/command_inc_counter.pb.h" -#include "pb/command_kick_from_game.pb.h" -#include "pb/command_leave_game.pb.h" -#include "pb/command_move_card.pb.h" -#include "pb/command_mulligan.pb.h" -#include "pb/command_next_turn.pb.h" -#include "pb/command_ready_start.pb.h" -#include "pb/command_reveal_cards.pb.h" -#include "pb/command_reverse_turn.pb.h" -#include "pb/command_roll_die.pb.h" -#include "pb/command_set_active_phase.pb.h" -#include "pb/command_set_card_attr.pb.h" -#include "pb/command_set_card_counter.pb.h" -#include "pb/command_set_counter.pb.h" -#include "pb/command_set_sideboard_lock.pb.h" -#include "pb/command_set_sideboard_plan.pb.h" -#include "pb/command_shuffle.pb.h" -#include "pb/command_undo_draw.pb.h" -#include "pb/context_concede.pb.h" -#include "pb/context_connection_state_changed.pb.h" -#include "pb/context_deck_select.pb.h" -#include "pb/context_move_card.pb.h" -#include "pb/context_mulligan.pb.h" -#include "pb/context_ready_start.pb.h" -#include "pb/context_set_sideboard_lock.pb.h" -#include "pb/context_undo_draw.pb.h" -#include "pb/event_attach_card.pb.h" -#include "pb/event_change_zone_properties.pb.h" -#include "pb/event_create_arrow.pb.h" -#include "pb/event_create_counter.pb.h" -#include "pb/event_create_token.pb.h" -#include "pb/event_del_counter.pb.h" -#include "pb/event_delete_arrow.pb.h" -#include "pb/event_destroy_card.pb.h" -#include "pb/event_draw_cards.pb.h" -#include "pb/event_dump_zone.pb.h" -#include "pb/event_flip_card.pb.h" -#include "pb/event_game_say.pb.h" -#include "pb/event_move_card.pb.h" -#include "pb/event_player_properties_changed.pb.h" -#include "pb/event_reveal_cards.pb.h" -#include "pb/event_reverse_turn.pb.h" -#include "pb/event_roll_die.pb.h" -#include "pb/event_set_card_attr.pb.h" -#include "pb/event_set_card_counter.pb.h" -#include "pb/event_set_counter.pb.h" -#include "pb/event_shuffle.pb.h" -#include "pb/response.pb.h" -#include "pb/response_deck_download.pb.h" -#include "pb/response_dump_zone.pb.h" -#include "pb/serverinfo_player.pb.h" -#include "pb/serverinfo_user.pb.h" #include "server_arrow.h" #include "server_card.h" #include "server_cardzone.h" @@ -86,6 +14,78 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include Server_AbstractParticipant::Server_AbstractParticipant(Server_Game *_game, int _playerId, @@ -202,7 +202,7 @@ Server_AbstractParticipant::cmdJudge(const Command_Judge &cmd, ResponseContainer return Response::RespFunctionNotAllowed; } - Server_Player *player = this->game->getPlayer(cmd.target_id()); + auto *player = this->game->getPlayer(cmd.target_id()); ges.setForcedByJudge(playerId); if (player == nullptr) { diff --git a/common/server/game/server_abstract_participant.h b/libcockatrice_network/libcockatrice/network/server/remote/game/server_abstract_participant.h similarity index 98% rename from common/server/game/server_abstract_participant.h rename to libcockatrice_network/libcockatrice/network/server/remote/game/server_abstract_participant.h index dcae09741..10fbb3349 100644 --- a/common/server/game/server_abstract_participant.h +++ b/libcockatrice_network/libcockatrice/network/server/remote/game/server_abstract_participant.h @@ -1,12 +1,12 @@ #ifndef ABSTRACT_PARTICIPANT_H #define ABSTRACT_PARTICIPANT_H -#include "../../serverinfo_user_container.h" -#include "pb/card_attributes.pb.h" -#include "pb/response.pb.h" +#include "../serverinfo_user_container.h" #include "server_arrowtarget.h" #include +#include +#include class Server_Game; class Server_AbstractUserInterface; diff --git a/common/server/game/server_player.cpp b/libcockatrice_network/libcockatrice/network/server/remote/game/server_abstract_player.cpp similarity index 65% rename from common/server/game/server_player.cpp rename to libcockatrice_network/libcockatrice/network/server/remote/game/server_abstract_player.cpp index b8b9b7cd5..5ac0a26ad 100644 --- a/common/server/game/server_player.cpp +++ b/libcockatrice_network/libcockatrice/network/server/remote/game/server_abstract_player.cpp @@ -1,124 +1,68 @@ -#include "server_player.h" +#include "server_abstract_player.h" -#include "../../color.h" -#include "../../deck_list.h" -#include "../../deck_list_card_node.h" -#include "../../get_pb_extension.h" -#include "../../rng_abstract.h" -#include "../../trice_limits.h" -#include "../server.h" -#include "../server_abstractuserinterface.h" -#include "../server_database_interface.h" -#include "../server_room.h" -#include "pb/command_attach_card.pb.h" -#include "pb/command_change_zone_properties.pb.h" -#include "pb/command_concede.pb.h" -#include "pb/command_create_arrow.pb.h" -#include "pb/command_create_counter.pb.h" -#include "pb/command_create_token.pb.h" -#include "pb/command_deck_select.pb.h" -#include "pb/command_del_counter.pb.h" -#include "pb/command_delete_arrow.pb.h" -#include "pb/command_draw_cards.pb.h" -#include "pb/command_dump_zone.pb.h" -#include "pb/command_flip_card.pb.h" -#include "pb/command_game_say.pb.h" -#include "pb/command_inc_card_counter.pb.h" -#include "pb/command_inc_counter.pb.h" -#include "pb/command_kick_from_game.pb.h" -#include "pb/command_leave_game.pb.h" -#include "pb/command_move_card.pb.h" -#include "pb/command_mulligan.pb.h" -#include "pb/command_next_turn.pb.h" -#include "pb/command_ready_start.pb.h" -#include "pb/command_reveal_cards.pb.h" -#include "pb/command_reverse_turn.pb.h" -#include "pb/command_roll_die.pb.h" -#include "pb/command_set_active_phase.pb.h" -#include "pb/command_set_card_attr.pb.h" -#include "pb/command_set_card_counter.pb.h" -#include "pb/command_set_counter.pb.h" -#include "pb/command_set_sideboard_lock.pb.h" -#include "pb/command_set_sideboard_plan.pb.h" -#include "pb/command_shuffle.pb.h" -#include "pb/command_undo_draw.pb.h" -#include "pb/context_concede.pb.h" -#include "pb/context_connection_state_changed.pb.h" -#include "pb/context_deck_select.pb.h" -#include "pb/context_move_card.pb.h" -#include "pb/context_mulligan.pb.h" -#include "pb/context_ready_start.pb.h" -#include "pb/context_set_sideboard_lock.pb.h" -#include "pb/context_undo_draw.pb.h" -#include "pb/event_attach_card.pb.h" -#include "pb/event_change_zone_properties.pb.h" -#include "pb/event_create_arrow.pb.h" -#include "pb/event_create_counter.pb.h" -#include "pb/event_create_token.pb.h" -#include "pb/event_del_counter.pb.h" -#include "pb/event_delete_arrow.pb.h" -#include "pb/event_destroy_card.pb.h" -#include "pb/event_draw_cards.pb.h" -#include "pb/event_dump_zone.pb.h" -#include "pb/event_flip_card.pb.h" -#include "pb/event_game_say.pb.h" -#include "pb/event_move_card.pb.h" -#include "pb/event_player_properties_changed.pb.h" -#include "pb/event_reveal_cards.pb.h" -#include "pb/event_reverse_turn.pb.h" -#include "pb/event_roll_die.pb.h" -#include "pb/event_set_card_attr.pb.h" -#include "pb/event_set_card_counter.pb.h" -#include "pb/event_set_counter.pb.h" -#include "pb/event_shuffle.pb.h" -#include "pb/response.pb.h" -#include "pb/response_deck_download.pb.h" -#include "pb/response_dump_zone.pb.h" -#include "pb/serverinfo_player.pb.h" -#include "pb/serverinfo_user.pb.h" #include "server_arrow.h" #include "server_card.h" #include "server_cardzone.h" -#include "server_counter.h" #include "server_game.h" +#include "server_move_card_struct.h" #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -struct MoveCardStruct -{ - Server_Card *card; - int position; - const CardToMove *cardToMove; - int xCoord, yCoord; - MoveCardStruct(Server_Card *_card, int _position, const CardToMove *_cardToMove) - : card(_card), position(_position), cardToMove(_cardToMove), xCoord(_card->getX()), yCoord(_card->getY()) - - { - } - bool operator<(const MoveCardStruct &other) const - { - return (yCoord == other.yCoord && - ((xCoord == other.xCoord && position < other.position) || xCoord < other.xCoord)) || - yCoord < other.yCoord; - } -}; - -Server_Player::Server_Player(Server_Game *_game, - int _playerId, - const ServerInfo_User &_userInfo, - bool _judge, - Server_AbstractUserInterface *_userInterface) - : Server_AbstractParticipant(_game, _playerId, _userInfo, _judge, _userInterface), deck(nullptr), nextCardId(0), - readyStart(false), conceded(false), sideboardLocked(true) +Server_AbstractPlayer::Server_AbstractPlayer(Server_Game *_game, + int _playerId, + const ServerInfo_User &_userInfo, + bool _judge, + Server_AbstractUserInterface *_userInterface) + : Server_AbstractParticipant(_game, _playerId, _userInfo, _judge, _userInterface), conceded(false), deck(nullptr), + sideboardLocked(true), readyStart(false), nextCardId(0) { spectator = false; } -Server_Player::~Server_Player() = default; +Server_AbstractPlayer::~Server_AbstractPlayer() = default; -void Server_Player::prepareDestroy() +void Server_AbstractPlayer::prepareDestroy() { delete deck; deck = nullptr; @@ -129,25 +73,12 @@ void Server_Player::prepareDestroy() deleteLater(); } -int Server_Player::newCardId() +int Server_AbstractPlayer::newCardId() { return nextCardId++; } -int Server_Player::newCounterId() const -{ - int id = 0; - QMapIterator i(counters); - while (i.hasNext()) { - Server_Counter *c = i.next().value(); - if (c->getId() > id) { - id = c->getId(); - } - } - return id + 1; -} - -int Server_Player::newArrowId() const +int Server_AbstractPlayer::newArrowId() const { int id = 0; for (Server_Arrow *a : arrows) { @@ -158,128 +89,41 @@ int Server_Player::newArrowId() const return id + 1; } -void Server_Player::setupZones() +void Server_AbstractPlayer::setupZones() { - // This may need to be customized according to the game rules. - // ------------------------------------------------------------------ - - // Create zones - auto *deckZone = new Server_CardZone(this, "deck", false, ServerInfo_Zone::HiddenZone); - addZone(deckZone); - auto *sbZone = new Server_CardZone(this, "sb", false, ServerInfo_Zone::HiddenZone); - addZone(sbZone); - addZone(new Server_CardZone(this, "table", true, ServerInfo_Zone::PublicZone)); - addZone(new Server_CardZone(this, "hand", false, ServerInfo_Zone::PrivateZone)); - addZone(new Server_CardZone(this, "stack", false, ServerInfo_Zone::PublicZone)); - addZone(new Server_CardZone(this, "grave", false, ServerInfo_Zone::PublicZone)); - addZone(new Server_CardZone(this, "rfg", false, ServerInfo_Zone::PublicZone)); - - addCounter(new Server_Counter(0, "life", makeColor(255, 255, 255), 25, game->getStartingLifeTotal())); - addCounter(new Server_Counter(1, "w", makeColor(255, 255, 150), 20, 0)); - addCounter(new Server_Counter(2, "u", makeColor(150, 150, 255), 20, 0)); - addCounter(new Server_Counter(3, "b", makeColor(150, 150, 150), 20, 0)); - addCounter(new Server_Counter(4, "r", makeColor(250, 150, 150), 20, 0)); - addCounter(new Server_Counter(5, "g", makeColor(150, 255, 150), 20, 0)); - addCounter(new Server_Counter(6, "x", makeColor(255, 255, 255), 20, 0)); - addCounter(new Server_Counter(7, "storm", makeColor(255, 150, 30), 20, 0)); - - // ------------------------------------------------------------------ - - // Assign card ids and create deck from deck list - InnerDecklistNode *listRoot = deck->getRoot(); nextCardId = 0; - for (int i = 0; i < listRoot->size(); ++i) { - auto *currentZone = dynamic_cast(listRoot->at(i)); - Server_CardZone *z; - if (currentZone->getName() == DECK_ZONE_MAIN) { - z = deckZone; - } else if (currentZone->getName() == DECK_ZONE_SIDE) { - z = sbZone; - } else { - continue; - } - - for (int j = 0; j < currentZone->size(); ++j) { - auto *currentCard = dynamic_cast(currentZone->at(j)); - if (!currentCard) { - continue; - } - for (int k = 0; k < currentCard->getNumber(); ++k) { - z->insertCard(new Server_Card(currentCard->toCardRef(), nextCardId++, 0, 0, z), -1, 0); - } - } - } - - const QList &sideboardPlan = deck->getCurrentSideboardPlan(); - for (const auto &m : sideboardPlan) { - const QString startZone = nameFromStdString(m.start_zone()); - const QString targetZone = nameFromStdString(m.target_zone()); - - Server_CardZone *start, *target; - if (startZone == DECK_ZONE_MAIN) { - start = deckZone; - } else if (startZone == DECK_ZONE_SIDE) { - start = sbZone; - } else { - continue; - } - if (targetZone == DECK_ZONE_MAIN) { - target = deckZone; - } else if (targetZone == DECK_ZONE_SIDE) { - target = sbZone; - } else { - continue; - } - - for (int j = 0; j < start->getCards().size(); ++j) { - if (start->getCards()[j]->getName() == nameFromStdString(m.card_name())) { - Server_Card *card = start->getCard(j, nullptr, true); - target->insertCard(card, -1, 0); - break; - } - } - } - - deckZone->shuffle(); } -void Server_Player::clearZones() +void Server_AbstractPlayer::clearZones() { for (Server_CardZone *zone : zones) { delete zone; } zones.clear(); - for (Server_Counter *counter : counters) { - delete counter; - } - counters.clear(); - for (Server_Arrow *arrow : arrows) { delete arrow; } arrows.clear(); - - lastDrawList.clear(); } -void Server_Player::addZone(Server_CardZone *zone) +void Server_AbstractPlayer::addZone(Server_CardZone *zone) { zones.insert(zone->getName(), zone); } -void Server_Player::addArrow(Server_Arrow *arrow) +void Server_AbstractPlayer::addArrow(Server_Arrow *arrow) { arrows.insert(arrow->getId(), arrow); } -void Server_Player::updateArrowId(int id) +void Server_AbstractPlayer::updateArrowId(int id) { auto *arrow = arrows.take(id); arrows.insert(arrow->getId(), arrow); } -bool Server_Player::deleteArrow(int arrowId) +bool Server_AbstractPlayer::deleteArrow(int arrowId) { Server_Arrow *arrow = arrows.value(arrowId, 0); if (!arrow) { @@ -290,76 +134,6 @@ bool Server_Player::deleteArrow(int arrowId) return true; } -void Server_Player::addCounter(Server_Counter *counter) -{ - counters.insert(counter->getId(), counter); -} - -Response::ResponseCode Server_Player::drawCards(GameEventStorage &ges, int number) -{ - Server_CardZone *deckZone = zones.value("deck"); - Server_CardZone *handZone = zones.value("hand"); - if (deckZone->getCards().size() < number) { - number = deckZone->getCards().size(); - } - - Event_DrawCards eventOthers; - eventOthers.set_number(number); - Event_DrawCards eventPrivate(eventOthers); - - for (int i = 0; i < number; ++i) { - Server_Card *card = deckZone->getCard(0, nullptr, true); - handZone->insertCard(card, -1, 0); - lastDrawList.append(card->getId()); - - ServerInfo_Card *cardInfo = eventPrivate.add_cards(); - cardInfo->set_id(card->getId()); - cardInfo->set_name(card->getName().toStdString()); - cardInfo->set_provider_id(card->getProviderId().toStdString()); - } - - ges.enqueueGameEvent(eventPrivate, playerId, GameEventStorageItem::SendToPrivate, playerId); - ges.enqueueGameEvent(eventOthers, playerId, GameEventStorageItem::SendToOthers); - - if (number > 0) { - revealTopCardIfNeeded(deckZone, ges); - int currentKnownCards = deckZone->getCardsBeingLookedAt(); - deckZone->setCardsBeingLookedAt(currentKnownCards - number); - } - - return Response::RespOk; -} - -void Server_Player::revealTopCardIfNeeded(Server_CardZone *zone, GameEventStorage &ges) -{ - if (zone->getCards().isEmpty()) { - return; - } - if (zone->getAlwaysRevealTopCard()) { - Event_RevealCards revealEvent; - revealEvent.set_zone_name(zone->getName().toStdString()); - revealEvent.add_card_id(0); - zone->getCards().first()->getInfo(revealEvent.add_cards()); - - ges.enqueueGameEvent(revealEvent, playerId); - return; - } - if (zone->getAlwaysLookAtTopCard()) { - Event_DumpZone dumpEvent; - dumpEvent.set_zone_owner_id(playerId); - dumpEvent.set_zone_name(zone->getName().toStdString()); - dumpEvent.set_number_cards(1); - ges.enqueueGameEvent(dumpEvent, playerId, GameEventStorageItem::SendToOthers); - - Event_RevealCards revealEvent; - revealEvent.set_zone_name(zone->getName().toStdString()); - revealEvent.set_number_of_cards(1); - revealEvent.add_card_id(0); - zone->getCards().first()->getInfo(revealEvent.add_cards()); - ges.enqueueGameEvent(revealEvent, playerId, GameEventStorageItem::SendToPrivate, playerId); - } -} - /** * Creates the create token event. * By default, will set event's name and color fields to empty if the token is face-down @@ -385,6 +159,7 @@ makeCreateTokenEvent(Server_CardZone *zone, Server_Card *card, int xCoord, int y event.set_y(yCoord); return event; } + static Event_AttachCard makeAttachCardEvent(Server_Card *attachedCard, Server_Card *parentCard = nullptr) { Event_AttachCard event; @@ -423,15 +198,15 @@ shouldDestroyOnMove(const Server_Card *card, const Server_CardZone *startZone, c return true; } -Response::ResponseCode Server_Player::moveCard(GameEventStorage &ges, - Server_CardZone *startzone, - const QList &_cards, - Server_CardZone *targetzone, - int xCoord, - int yCoord, - bool fixFreeSpaces, - bool undoingDraw, - bool isReversed) +Response::ResponseCode Server_AbstractPlayer::moveCard(GameEventStorage &ges, + Server_CardZone *startzone, + const QList &_cards, + Server_CardZone *targetzone, + int xCoord, + int yCoord, + bool fixFreeSpaces, + bool undoingDraw, + bool isReversed) { // Disallow controller change to other zones than the table. if (((targetzone->getType() != ServerInfo_Zone::PublicZone) || !targetzone->hasCoords()) && @@ -490,16 +265,6 @@ Response::ResponseCode Server_Player::moveCard(GameEventStorage &ges, bool sourceBeingLookedAt; int position = startzone->removeCard(card, sourceBeingLookedAt); - // "Undo draw" should only remain valid if the just-drawn card stays within the user's hand (e.g., they only - // reorder their hand). If a just-drawn card leaves the hand then remove cards before it from the list - // (Ignore the case where the card is currently being un-drawn.) - if (startzone->getName() == "hand" && targetzone->getName() != "hand" && !undoingDraw) { - int index = lastDrawList.lastIndexOf(card->getId()); - if (index != -1) { - lastDrawList.erase(lastDrawList.begin(), lastDrawList.begin() + index); - } - } - // Attachment relationships can be retained when moving a card onto the opponent's table if (startzone->getName() != targetzone->getName()) { // Delete all attachment relationships @@ -641,33 +406,15 @@ Response::ResponseCode Server_Player::moveCard(GameEventStorage &ges, ges.enqueueGameEvent(eventPrivate, playerId, GameEventStorageItem::SendToPrivate, playerId); ges.enqueueGameEvent(eventOthers, playerId, GameEventStorageItem::SendToOthers); - if (thisCardProperties->tapped()) { - setCardAttrHelper(ges, targetzone->getPlayer()->getPlayerId(), targetzone->getName(), card->getId(), - AttrTapped, "1"); - } - QString ptString = QString::fromStdString(thisCardProperties->pt()); - if (!ptString.isEmpty()) { - setCardAttrHelper(ges, targetzone->getPlayer()->getPlayerId(), targetzone->getName(), card->getId(), - AttrPT, ptString); - } - - // If card is transferring to a different player, leave an annotation of who actually "owns" the card - const auto &priorAnnotation = card->getAnnotation(); - if (startzone->getPlayer() != targetzone->getPlayer() && !priorAnnotation.contains("Owner:")) { - const auto &ownerAnnotation = - "Owner: " + QString::fromStdString(startzone->getPlayer()->getUserInfo()->name()); - const auto &newAnnotation = - priorAnnotation.isEmpty() ? ownerAnnotation : ownerAnnotation + "\n\n" + priorAnnotation; - setCardAttrHelper(ges, targetzone->getPlayer()->getPlayerId(), targetzone->getName(), card->getId(), - AttrAnnotation, newAnnotation, card); - } - if (originalPosition == 0) { revealTopStart = true; } if (newX == 0) { revealTopTarget = true; } + + // handle side effects for this card + onCardBeingMoved(ges, cardStruct, startzone, targetzone, undoingDraw); } } if (revealTopStart) { @@ -689,7 +436,70 @@ Response::ResponseCode Server_Player::moveCard(GameEventStorage &ges, return Response::RespOk; } -void Server_Player::unattachCard(GameEventStorage &ges, Server_Card *card) +void Server_AbstractPlayer::onCardBeingMoved(GameEventStorage &ges, + const MoveCardStruct &cardStruct, + Server_CardZone *startzone, + Server_CardZone *targetzone, + bool /*undoingDraw*/) +{ + Server_Card *card = cardStruct.card; + const CardToMove *thisCardProperties = cardStruct.cardToMove; + + // set card to be tapped + if (thisCardProperties->tapped()) { + setCardAttrHelper(ges, targetzone->getPlayer()->getPlayerId(), targetzone->getName(), card->getId(), AttrTapped, + "1"); + } + + // set card pt + QString ptString = QString::fromStdString(thisCardProperties->pt()); + if (!ptString.isEmpty()) { + setCardAttrHelper(ges, targetzone->getPlayer()->getPlayerId(), targetzone->getName(), card->getId(), AttrPT, + ptString); + } + + // If card is transferring to a different player, leave an annotation of who actually "owns" the card + const auto &priorAnnotation = card->getAnnotation(); + if (startzone->getPlayer() != targetzone->getPlayer() && !priorAnnotation.contains("Owner:")) { + const auto &ownerAnnotation = "Owner: " + QString::fromStdString(startzone->getPlayer()->getUserInfo()->name()); + const auto &newAnnotation = + priorAnnotation.isEmpty() ? ownerAnnotation : ownerAnnotation + "\n\n" + priorAnnotation; + setCardAttrHelper(ges, targetzone->getPlayer()->getPlayerId(), targetzone->getName(), card->getId(), + AttrAnnotation, newAnnotation, card); + } +} + +void Server_AbstractPlayer::revealTopCardIfNeeded(Server_CardZone *zone, GameEventStorage &ges) +{ + if (zone->getCards().isEmpty()) { + return; + } + if (zone->getAlwaysRevealTopCard()) { + Event_RevealCards revealEvent; + revealEvent.set_zone_name(zone->getName().toStdString()); + revealEvent.add_card_id(0); + zone->getCards().first()->getInfo(revealEvent.add_cards()); + + ges.enqueueGameEvent(revealEvent, playerId); + return; + } + if (zone->getAlwaysLookAtTopCard()) { + Event_DumpZone dumpEvent; + dumpEvent.set_zone_owner_id(playerId); + dumpEvent.set_zone_name(zone->getName().toStdString()); + dumpEvent.set_number_cards(1); + ges.enqueueGameEvent(dumpEvent, playerId, GameEventStorageItem::SendToOthers); + + Event_RevealCards revealEvent; + revealEvent.set_zone_name(zone->getName().toStdString()); + revealEvent.set_number_of_cards(1); + revealEvent.add_card_id(0); + zone->getCards().first()->getInfo(revealEvent.add_cards()); + ges.enqueueGameEvent(revealEvent, playerId, GameEventStorageItem::SendToPrivate, playerId); + } +} + +void Server_AbstractPlayer::unattachCard(GameEventStorage &ges, Server_Card *card) { Server_CardZone *zone = card->getZone(); Server_Card *parentCard = card->getParentCard(); @@ -707,13 +517,13 @@ void Server_Player::unattachCard(GameEventStorage &ges, Server_Card *card) } } -Response::ResponseCode Server_Player::setCardAttrHelper(GameEventStorage &ges, - int targetPlayerId, - const QString &zoneName, - int cardId, - CardAttribute attribute, - const QString &attrValue, - Server_Card *unzonedCard) +Response::ResponseCode Server_AbstractPlayer::setCardAttrHelper(GameEventStorage &ges, + int targetPlayerId, + const QString &zoneName, + int cardId, + CardAttribute attribute, + const QString &attrValue, + Server_Card *unzonedCard) { Server_CardZone *zone = getZones().value(zoneName); if (!zone) { @@ -756,100 +566,7 @@ Response::ResponseCode Server_Player::setCardAttrHelper(GameEventStorage &ges, } Response::ResponseCode -Server_Player::cmdDeckSelect(const Command_DeckSelect &cmd, ResponseContainer &rc, GameEventStorage &ges) -{ - DeckList *newDeck; - if (cmd.has_deck_id()) { - try { - newDeck = game->getRoom()->getServer()->getDatabaseInterface()->getDeckFromDatabase(cmd.deck_id(), - userInfo->id()); - } catch (Response::ResponseCode &r) { - return r; - } - } else { - newDeck = new DeckList(fileFromStdString(cmd.deck())); - } - - if (!newDeck) { - return Response::RespInternalError; - } - - delete deck; - deck = newDeck; - sideboardLocked = true; - - Event_PlayerPropertiesChanged event; - event.mutable_player_properties()->set_sideboard_locked(true); - event.mutable_player_properties()->set_deck_hash(deck->getDeckHash().toStdString()); - ges.enqueueGameEvent(event, playerId); - - Context_DeckSelect context; - context.set_deck_hash(deck->getDeckHash().toStdString()); - context.set_sideboard_size(deck->getSideboardSize()); - if (game->getShareDecklistsOnLoad()) { - context.set_deck_list(deck->writeToString_Native().toStdString()); - } - ges.setGameEventContext(context); - - auto *re = new Response_DeckDownload; - re->set_deck(deck->writeToString_Native().toStdString()); - - rc.setResponseExtension(re); - return Response::RespOk; -} - -Response::ResponseCode Server_Player::cmdSetSideboardPlan(const Command_SetSideboardPlan &cmd, - ResponseContainer & /*rc*/, - GameEventStorage & /*ges*/) -{ - if (readyStart) { - return Response::RespContextError; - } - if (!deck) { - return Response::RespContextError; - } - if (sideboardLocked) { - return Response::RespContextError; - } - - QList sideboardPlan; - for (int i = 0; i < cmd.move_list_size(); ++i) { - sideboardPlan.append(cmd.move_list(i)); - } - deck->setCurrentSideboardPlan(sideboardPlan); - - return Response::RespOk; -} - -Response::ResponseCode Server_Player::cmdSetSideboardLock(const Command_SetSideboardLock &cmd, - ResponseContainer & /*rc*/, - GameEventStorage &ges) -{ - if (readyStart) { - return Response::RespContextError; - } - if (!deck) { - return Response::RespContextError; - } - if (sideboardLocked == cmd.locked()) { - return Response::RespContextError; - } - - sideboardLocked = cmd.locked(); - if (sideboardLocked) { - deck->setCurrentSideboardPlan(QList()); - } - - Event_PlayerPropertiesChanged event; - event.mutable_player_properties()->set_sideboard_locked(sideboardLocked); - ges.enqueueGameEvent(event, playerId); - ges.setGameEventContext(Context_SetSideboardLock()); - - return Response::RespOk; -} - -Response::ResponseCode -Server_Player::cmdConcede(const Command_Concede & /*cmd*/, ResponseContainer & /*rc*/, GameEventStorage &ges) +Server_AbstractPlayer::cmdConcede(const Command_Concede & /*cmd*/, ResponseContainer & /*rc*/, GameEventStorage &ges) { if (!game->getGameStarted()) { return Response::RespGameNotStarted; @@ -921,8 +638,9 @@ Server_Player::cmdConcede(const Command_Concede & /*cmd*/, ResponseContainer & / return Response::RespOk; } -Response::ResponseCode -Server_Player::cmdUnconcede(const Command_Unconcede & /*cmd*/, ResponseContainer & /*rc*/, GameEventStorage &ges) +Response::ResponseCode Server_AbstractPlayer::cmdUnconcede(const Command_Unconcede & /*cmd*/, + ResponseContainer & /*rc*/, + GameEventStorage &ges) { if (!game->getGameStarted()) { return Response::RespGameNotStarted; @@ -946,7 +664,7 @@ Server_Player::cmdUnconcede(const Command_Unconcede & /*cmd*/, ResponseContainer } Response::ResponseCode -Server_Player::cmdReadyStart(const Command_ReadyStart &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges) +Server_AbstractPlayer::cmdReadyStart(const Command_ReadyStart &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges) { if (!deck || game->getGameStarted()) { return Response::RespContextError; @@ -976,76 +694,7 @@ Server_Player::cmdReadyStart(const Command_ReadyStart &cmd, ResponseContainer & } Response::ResponseCode -Server_Player::cmdShuffle(const Command_Shuffle &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges) -{ - if (!game->getGameStarted()) { - return Response::RespGameNotStarted; - } - - if (conceded) { - return Response::RespContextError; - } - - if (cmd.has_zone_name() && cmd.zone_name() != "deck") { - return Response::RespFunctionNotAllowed; - } - - Server_CardZone *zone = zones.value("deck"); - if (!zone) { - return Response::RespNameNotFound; - } - - zone->shuffle(cmd.start(), cmd.end()); - - Event_Shuffle event; - event.set_zone_name(zone->getName().toStdString()); - event.set_start(cmd.start()); - event.set_end(cmd.end()); - ges.enqueueGameEvent(event, playerId); - revealTopCardIfNeeded(zone, ges); - - return Response::RespOk; -} - -Response::ResponseCode -Server_Player::cmdMulligan(const Command_Mulligan &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges) -{ - if (!game->getGameStarted()) { - return Response::RespGameNotStarted; - } - if (conceded) { - return Response::RespContextError; - } - - Server_CardZone *hand = zones.value("hand"); - Server_CardZone *_deck = zones.value("deck"); - int number = cmd.number(); - - if (!hand->getCards().isEmpty()) { - auto cardsToMove = QList(); - for (auto &card : hand->getCards()) { - auto *cardToMove = new CardToMove; - cardToMove->set_card_id(card->getId()); - cardsToMove.append(cardToMove); - } - moveCard(ges, hand, cardsToMove, _deck, -1, 0, false); - qDeleteAll(cardsToMove); - } - - _deck->shuffle(); - ges.enqueueGameEvent(Event_Shuffle(), playerId); - - drawCards(ges, number); - - Context_Mulligan context; - context.set_number(static_cast(hand->getCards().size())); - ges.setGameEventContext(context); - - return Response::RespOk; -} - -Response::ResponseCode -Server_Player::cmdRollDie(const Command_RollDie &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges) const +Server_AbstractPlayer::cmdRollDie(const Command_RollDie &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges) const { if (conceded) { return Response::RespContextError; @@ -1071,7 +720,7 @@ Server_Player::cmdRollDie(const Command_RollDie &cmd, ResponseContainer & /*rc*/ } Response::ResponseCode -Server_Player::cmdDrawCards(const Command_DrawCards &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges) +Server_AbstractPlayer::cmdMoveCard(const Command_MoveCard &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges) { if (!game->getGameStarted()) { return Response::RespGameNotStarted; @@ -1080,44 +729,7 @@ Server_Player::cmdDrawCards(const Command_DrawCards &cmd, ResponseContainer & /* return Response::RespContextError; } - return drawCards(ges, cmd.number()); -} - -Response::ResponseCode -Server_Player::cmdUndoDraw(const Command_UndoDraw & /*cmd*/, ResponseContainer & /*rc*/, GameEventStorage &ges) -{ - if (!game->getGameStarted()) { - return Response::RespGameNotStarted; - } - if (conceded) { - return Response::RespContextError; - } - - if (lastDrawList.isEmpty()) { - return Response::RespContextError; - } - - Response::ResponseCode retVal; - auto *cardToMove = new CardToMove; - cardToMove->set_card_id(lastDrawList.takeLast()); - retVal = moveCard(ges, zones.value("hand"), QList() << cardToMove, zones.value("deck"), 0, 0, - false, true); - delete cardToMove; - - return retVal; -} - -Response::ResponseCode -Server_Player::cmdMoveCard(const Command_MoveCard &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges) -{ - if (!game->getGameStarted()) { - return Response::RespGameNotStarted; - } - if (conceded) { - return Response::RespContextError; - } - - Server_Player *startPlayer = game->getPlayer(cmd.has_start_player_id() ? cmd.start_player_id() : playerId); + Server_AbstractPlayer *startPlayer = game->getPlayer(cmd.has_start_player_id() ? cmd.start_player_id() : playerId); if (!startPlayer) { return Response::RespNameNotFound; } @@ -1130,7 +742,7 @@ Server_Player::cmdMoveCard(const Command_MoveCard &cmd, ResponseContainer & /*rc return Response::RespContextError; } - Server_Player *targetPlayer = game->getPlayer(cmd.target_player_id()); + Server_AbstractPlayer *targetPlayer = game->getPlayer(cmd.target_player_id()); if (!targetPlayer) { return Response::RespNameNotFound; } @@ -1152,7 +764,7 @@ Server_Player::cmdMoveCard(const Command_MoveCard &cmd, ResponseContainer & /*rc } Response::ResponseCode -Server_Player::cmdFlipCard(const Command_FlipCard &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges) +Server_AbstractPlayer::cmdFlipCard(const Command_FlipCard &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges) { if (!game->getGameStarted()) { return Response::RespGameNotStarted; @@ -1200,7 +812,7 @@ Server_Player::cmdFlipCard(const Command_FlipCard &cmd, ResponseContainer & /*rc } Response::ResponseCode -Server_Player::cmdAttachCard(const Command_AttachCard &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges) +Server_AbstractPlayer::cmdAttachCard(const Command_AttachCard &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges) { if (!game->getGameStarted()) { return Response::RespGameNotStarted; @@ -1219,7 +831,7 @@ Server_Player::cmdAttachCard(const Command_AttachCard &cmd, ResponseContainer & return Response::RespNameNotFound; } - Server_Player *targetPlayer = nullptr; + Server_AbstractPlayer *targetPlayer = nullptr; Server_CardZone *targetzone = nullptr; Server_Card *targetCard = nullptr; @@ -1308,7 +920,7 @@ Server_Player::cmdAttachCard(const Command_AttachCard &cmd, ResponseContainer & } Response::ResponseCode -Server_Player::cmdCreateToken(const Command_CreateToken &cmd, ResponseContainer &rc, GameEventStorage &ges) +Server_AbstractPlayer::cmdCreateToken(const Command_CreateToken &cmd, ResponseContainer &rc, GameEventStorage &ges) { if (!game->getGameStarted()) { return Response::RespGameNotStarted; @@ -1483,7 +1095,8 @@ Server_Player::cmdCreateToken(const Command_CreateToken &cmd, ResponseContainer arrowInfo->set_start_player_id(player->getPlayerId()); arrowInfo->set_start_zone(startCard->getZone()->getName().toStdString()); arrowInfo->set_start_card_id(startCard->getId()); - const Server_Player *arrowTargetPlayer = qobject_cast(targetItem); + const Server_AbstractPlayer *arrowTargetPlayer = + qobject_cast(targetItem); if (arrowTargetPlayer != nullptr) { arrowInfo->set_target_player_id(arrowTargetPlayer->getPlayerId()); } else { @@ -1514,11 +1127,11 @@ Server_Player::cmdCreateToken(const Command_CreateToken &cmd, ResponseContainer * Creates and sends the events required to properly communicate the given token creation. * Primarily written to handle creating face-down tokens. */ -void Server_Player::sendCreateTokenEvents(Server_CardZone *zone, - Server_Card *card, - int xCoord, - int yCoord, - GameEventStorage &ges) +void Server_AbstractPlayer::sendCreateTokenEvents(Server_CardZone *zone, + Server_Card *card, + int xCoord, + int yCoord, + GameEventStorage &ges) { // Token is not face-down; things are easy if (!card->getFaceDown()) { @@ -1543,7 +1156,7 @@ void Server_Player::sendCreateTokenEvents(Server_CardZone *zone, } Response::ResponseCode -Server_Player::cmdCreateArrow(const Command_CreateArrow &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges) +Server_AbstractPlayer::cmdCreateArrow(const Command_CreateArrow &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges) { if (!game->getGameStarted()) { return Response::RespGameNotStarted; @@ -1552,8 +1165,8 @@ Server_Player::cmdCreateArrow(const Command_CreateArrow &cmd, ResponseContainer return Response::RespContextError; } - Server_Player *startPlayer = game->getPlayer(cmd.start_player_id()); - Server_Player *targetPlayer = game->getPlayer(cmd.target_player_id()); + Server_AbstractPlayer *startPlayer = game->getPlayer(cmd.start_player_id()); + Server_AbstractPlayer *targetPlayer = game->getPlayer(cmd.target_player_id()); if (!startPlayer || !targetPlayer) { return Response::RespNameNotFound; } @@ -1619,7 +1232,7 @@ Server_Player::cmdCreateArrow(const Command_CreateArrow &cmd, ResponseContainer } Response::ResponseCode -Server_Player::cmdDeleteArrow(const Command_DeleteArrow &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges) +Server_AbstractPlayer::cmdDeleteArrow(const Command_DeleteArrow &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges) { if (!game->getGameStarted()) { return Response::RespGameNotStarted; @@ -1640,7 +1253,7 @@ Server_Player::cmdDeleteArrow(const Command_DeleteArrow &cmd, ResponseContainer } Response::ResponseCode -Server_Player::cmdSetCardAttr(const Command_SetCardAttr &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges) +Server_AbstractPlayer::cmdSetCardAttr(const Command_SetCardAttr &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges) { if (!game->getGameStarted()) { return Response::RespGameNotStarted; @@ -1653,8 +1266,9 @@ Server_Player::cmdSetCardAttr(const Command_SetCardAttr &cmd, ResponseContainer nameFromStdString(cmd.attr_value())); } -Response::ResponseCode -Server_Player::cmdSetCardCounter(const Command_SetCardCounter &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges) +Response::ResponseCode Server_AbstractPlayer::cmdSetCardCounter(const Command_SetCardCounter &cmd, + ResponseContainer & /*rc*/, + GameEventStorage &ges) { if (!game->getGameStarted()) { return Response::RespGameNotStarted; @@ -1685,8 +1299,9 @@ Server_Player::cmdSetCardCounter(const Command_SetCardCounter &cmd, ResponseCont return Response::RespOk; } -Response::ResponseCode -Server_Player::cmdIncCardCounter(const Command_IncCardCounter &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges) +Response::ResponseCode Server_AbstractPlayer::cmdIncCardCounter(const Command_IncCardCounter &cmd, + ResponseContainer & /*rc*/, + GameEventStorage &ges) { if (!game->getGameStarted()) { return Response::RespGameNotStarted; @@ -1722,151 +1337,13 @@ Server_Player::cmdIncCardCounter(const Command_IncCardCounter &cmd, ResponseCont } Response::ResponseCode -Server_Player::cmdIncCounter(const Command_IncCounter &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges) -{ - if (!game->getGameStarted()) { - return Response::RespGameNotStarted; - } - if (conceded) { - return Response::RespContextError; - } - - Server_Counter *c = counters.value(cmd.counter_id(), 0); - if (!c) { - return Response::RespNameNotFound; - } - - c->setCount(c->getCount() + cmd.delta()); - - Event_SetCounter event; - event.set_counter_id(c->getId()); - event.set_value(c->getCount()); - ges.enqueueGameEvent(event, playerId); - - return Response::RespOk; -} - -Response::ResponseCode -Server_Player::cmdCreateCounter(const Command_CreateCounter &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges) -{ - if (!game->getGameStarted()) { - return Response::RespGameNotStarted; - } - if (conceded) { - return Response::RespContextError; - } - - auto *c = new Server_Counter(newCounterId(), nameFromStdString(cmd.counter_name()), cmd.counter_color(), - cmd.radius(), cmd.value()); - addCounter(c); - - Event_CreateCounter event; - ServerInfo_Counter *counterInfo = event.mutable_counter_info(); - counterInfo->set_id(c->getId()); - counterInfo->set_name(c->getName().toStdString()); - counterInfo->mutable_counter_color()->CopyFrom(cmd.counter_color()); - counterInfo->set_radius(c->getRadius()); - counterInfo->set_count(c->getCount()); - ges.enqueueGameEvent(event, playerId); - - return Response::RespOk; -} - -Response::ResponseCode -Server_Player::cmdSetCounter(const Command_SetCounter &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges) -{ - if (!game->getGameStarted()) { - return Response::RespGameNotStarted; - } - if (conceded) { - return Response::RespContextError; - } - - Server_Counter *c = counters.value(cmd.counter_id(), 0); - if (!c) { - return Response::RespNameNotFound; - } - - c->setCount(cmd.value()); - - Event_SetCounter event; - event.set_counter_id(c->getId()); - event.set_value(c->getCount()); - ges.enqueueGameEvent(event, playerId); - - return Response::RespOk; -} - -Response::ResponseCode -Server_Player::cmdDelCounter(const Command_DelCounter &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges) -{ - if (!game->getGameStarted()) { - return Response::RespGameNotStarted; - } - if (conceded) { - return Response::RespContextError; - } - - Server_Counter *counter = counters.value(cmd.counter_id(), 0); - if (!counter) { - return Response::RespNameNotFound; - } - counters.remove(cmd.counter_id()); - delete counter; - - Event_DelCounter event; - event.set_counter_id(cmd.counter_id()); - ges.enqueueGameEvent(event, playerId); - - return Response::RespOk; -} - -Response::ResponseCode -Server_Player::cmdNextTurn(const Command_NextTurn & /*cmd*/, ResponseContainer & /*rc*/, GameEventStorage & /*ges*/) +Server_AbstractPlayer::cmdDumpZone(const Command_DumpZone &cmd, ResponseContainer &rc, GameEventStorage &ges) { if (!game->getGameStarted()) { return Response::RespGameNotStarted; } - if (conceded && !judge) { - return Response::RespContextError; - } - - game->nextTurn(); - return Response::RespOk; -} - -Response::ResponseCode Server_Player::cmdSetActivePhase(const Command_SetActivePhase &cmd, - ResponseContainer & /*rc*/, - GameEventStorage & /*ges*/) -{ - if (!game->getGameStarted()) { - return Response::RespGameNotStarted; - } - - if (!judge) { - if (conceded) { - return Response::RespContextError; - } - - if (game->getActivePlayer() != playerId) { - return Response::RespContextError; - } - } - - game->setActivePhase(cmd.phase()); - - return Response::RespOk; -} - -Response::ResponseCode -Server_Player::cmdDumpZone(const Command_DumpZone &cmd, ResponseContainer &rc, GameEventStorage &ges) -{ - if (!game->getGameStarted()) { - return Response::RespGameNotStarted; - } - - Server_Player *otherPlayer = game->getPlayer(cmd.player_id()); + Server_AbstractPlayer *otherPlayer = game->getPlayer(cmd.player_id()); if (!otherPlayer) { return Response::RespNameNotFound; } @@ -1940,7 +1417,7 @@ Server_Player::cmdDumpZone(const Command_DumpZone &cmd, ResponseContainer &rc, G } Response::ResponseCode -Server_Player::cmdRevealCards(const Command_RevealCards &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges) +Server_AbstractPlayer::cmdRevealCards(const Command_RevealCards &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges) { if (!game->getGameStarted()) { return Response::RespGameNotStarted; @@ -1950,7 +1427,7 @@ Server_Player::cmdRevealCards(const Command_RevealCards &cmd, ResponseContainer } if (cmd.has_player_id()) { - Server_Player *otherPlayer = game->getPlayer(cmd.player_id()); + Server_AbstractPlayer *otherPlayer = game->getPlayer(cmd.player_id()); if (!otherPlayer) return Response::RespNameNotFound; } @@ -2061,9 +1538,9 @@ Server_Player::cmdRevealCards(const Command_RevealCards &cmd, ResponseContainer return Response::RespOk; } -Response::ResponseCode Server_Player::cmdChangeZoneProperties(const Command_ChangeZoneProperties &cmd, - ResponseContainer & /* rc */, - GameEventStorage &ges) +Response::ResponseCode Server_AbstractPlayer::cmdChangeZoneProperties(const Command_ChangeZoneProperties &cmd, + ResponseContainer & /* rc */, + GameEventStorage &ges) { Server_CardZone *zone = zones.value(nameFromStdString(cmd.zone_name())); if (!zone) { @@ -2096,24 +1573,13 @@ Response::ResponseCode Server_Player::cmdChangeZoneProperties(const Command_Chan event.set_always_look_at_top_card(cmd.always_look_at_top_card()); } ges.enqueueGameEvent(event, playerId); - revealTopCardIfNeeded(zone, ges); return Response::RespOk; } -Response::ResponseCode -Server_Player::cmdReverseTurn(const Command_ReverseTurn &cmd, ResponseContainer &rc, GameEventStorage &ges) -{ - - if (!judge && conceded) { - return Response::RespContextError; - } - return Server_AbstractParticipant::cmdReverseTurn(cmd, rc, ges); -} - -void Server_Player::getInfo(ServerInfo_Player *info, - Server_AbstractParticipant *recipient, - bool omniscient, - bool withUserInfo) +void Server_AbstractPlayer::getInfo(ServerInfo_Player *info, + Server_AbstractParticipant *recipient, + bool omniscient, + bool withUserInfo) { getProperties(*info->mutable_properties(), withUserInfo); if (recipient == this) { @@ -2126,16 +1592,12 @@ void Server_Player::getInfo(ServerInfo_Player *info, arrow->getInfo(info->add_arrow_list()); } - for (Server_Counter *counter : counters) { - counter->getInfo(info->add_counter_list()); - } - for (Server_CardZone *zone : zones) { zone->getInfo(info->add_zone_list(), recipient, omniscient); } } -void Server_Player::getPlayerProperties(ServerInfo_PlayerProperties &result) +void Server_AbstractPlayer::getPlayerProperties(ServerInfo_PlayerProperties &result) { result.set_conceded(conceded); result.set_sideboard_locked(sideboardLocked); diff --git a/common/server/game/server_player.h b/libcockatrice_network/libcockatrice/network/server/remote/game/server_abstract_player.h similarity index 55% rename from common/server/game/server_player.h rename to libcockatrice_network/libcockatrice/network/server/remote/game/server_abstract_player.h index fc3e69ee8..4a32b6fef 100644 --- a/common/server/game/server_player.h +++ b/libcockatrice_network/libcockatrice/network/server/remote/game/server_abstract_player.h @@ -1,45 +1,48 @@ -#ifndef PLAYER_H -#define PLAYER_H +#ifndef ABSTRACT_PLAYER_H +#define ABSTRACT_PLAYER_H -#include "../../serverinfo_user_container.h" +#include "../serverinfo_user_container.h" #include "server_abstract_participant.h" #include #include #include +class CardToMove; class DeckList; -class Server_CardZone; -class Server_Counter; class Server_Arrow; class Server_Card; -class CardToMove; +class Server_CardZone; +class Server_Counter; +struct MoveCardStruct; -class Server_Player : public Server_AbstractParticipant +class Server_AbstractPlayer : public Server_AbstractParticipant { Q_OBJECT private: class MoveCardCompareFunctor; - DeckList *deck; - QMap zones; - QMap counters; QMap arrows; - QList lastDrawList; - int nextCardId; - bool readyStart; - bool conceded; - bool sideboardLocked; - void revealTopCardIfNeeded(Server_CardZone *zone, GameEventStorage &ges); + void sendCreateTokenEvents(Server_CardZone *zone, Server_Card *card, int xCoord, int yCoord, GameEventStorage &ges); void getPlayerProperties(ServerInfo_PlayerProperties &result) override; +protected: + bool conceded; + DeckList *deck; + bool sideboardLocked; + QMap zones; + bool readyStart; + int nextCardId; + + void revealTopCardIfNeeded(Server_CardZone *zone, GameEventStorage &ges); + public: - Server_Player(Server_Game *_game, - int _playerId, - const ServerInfo_User &_userInfo, - bool _judge, - Server_AbstractUserInterface *_handler); - ~Server_Player() override; + Server_AbstractPlayer(Server_Game *_game, + int _playerId, + const ServerInfo_User &_userInfo, + bool _judge, + Server_AbstractUserInterface *_handler); + ~Server_AbstractPlayer() override; void prepareDestroy() override; const DeckList *getDeckList() const { @@ -66,29 +69,22 @@ public: { return zones; } - const QMap &getCounters() const - { - return counters; - } const QMap &getArrows() const { return arrows; } int newCardId(); - int newCounterId() const; int newArrowId() const; void addZone(Server_CardZone *zone); void addArrow(Server_Arrow *arrow); void updateArrowId(int id); bool deleteArrow(int arrowId); - void addCounter(Server_Counter *counter); - void clearZones(); - void setupZones(); + virtual void setupZones(); + virtual void clearZones(); - Response::ResponseCode drawCards(GameEventStorage &ges, int number); Response::ResponseCode moveCard(GameEventStorage &ges, Server_CardZone *startzone, const QList &_cards, @@ -98,6 +94,12 @@ public: bool fixFreeSpaces = true, bool undoingDraw = false, bool isReversed = false); + virtual void onCardBeingMoved(GameEventStorage &ges, + const MoveCardStruct &cardStruct, + Server_CardZone *startzone, + Server_CardZone *targetzone, + bool undoingDraw); + void unattachCard(GameEventStorage &ges, Server_Card *card); Response::ResponseCode setCardAttrHelper(GameEventStorage &ges, int targetPlayerId, @@ -107,72 +109,44 @@ public: const QString &attrValue, Server_Card *unzonedCard = nullptr); - Response::ResponseCode + virtual Response::ResponseCode cmdConcede(const Command_Concede &cmd, ResponseContainer &rc, GameEventStorage &ges) override; - Response::ResponseCode + virtual Response::ResponseCode cmdUnconcede(const Command_Unconcede &cmd, ResponseContainer &rc, GameEventStorage &ges) override; - Response::ResponseCode + virtual Response::ResponseCode cmdReadyStart(const Command_ReadyStart &cmd, ResponseContainer &rc, GameEventStorage &ges) override; - Response::ResponseCode - cmdDeckSelect(const Command_DeckSelect &cmd, ResponseContainer &rc, GameEventStorage &ges) override; - Response::ResponseCode - cmdSetSideboardPlan(const Command_SetSideboardPlan &cmd, ResponseContainer &rc, GameEventStorage &ges) override; - Response::ResponseCode - cmdSetSideboardLock(const Command_SetSideboardLock &cmd, ResponseContainer &rc, GameEventStorage &ges) override; - Response::ResponseCode - cmdShuffle(const Command_Shuffle &cmd, ResponseContainer &rc, GameEventStorage &ges) override; - Response::ResponseCode - cmdMulligan(const Command_Mulligan &cmd, ResponseContainer &rc, GameEventStorage &ges) override; - Response::ResponseCode + virtual Response::ResponseCode cmdRollDie(const Command_RollDie &cmd, ResponseContainer &rc, GameEventStorage &ges) const override; - Response::ResponseCode - cmdDrawCards(const Command_DrawCards &cmd, ResponseContainer &rc, GameEventStorage &ges) override; - Response::ResponseCode - cmdUndoDraw(const Command_UndoDraw &cmd, ResponseContainer &rc, GameEventStorage &ges) override; - Response::ResponseCode + virtual Response::ResponseCode cmdMoveCard(const Command_MoveCard &cmd, ResponseContainer &rc, GameEventStorage &ges) override; - Response::ResponseCode + virtual Response::ResponseCode cmdFlipCard(const Command_FlipCard &cmd, ResponseContainer &rc, GameEventStorage &ges) override; - Response::ResponseCode + virtual Response::ResponseCode cmdAttachCard(const Command_AttachCard &cmd, ResponseContainer &rc, GameEventStorage &ges) override; - Response::ResponseCode + virtual Response::ResponseCode cmdCreateToken(const Command_CreateToken &cmd, ResponseContainer &rc, GameEventStorage &ges) override; - Response::ResponseCode + virtual Response::ResponseCode cmdCreateArrow(const Command_CreateArrow &cmd, ResponseContainer &rc, GameEventStorage &ges) override; - Response::ResponseCode + virtual Response::ResponseCode cmdDeleteArrow(const Command_DeleteArrow &cmd, ResponseContainer &rc, GameEventStorage &ges) override; - Response::ResponseCode + virtual Response::ResponseCode cmdSetCardAttr(const Command_SetCardAttr &cmd, ResponseContainer &rc, GameEventStorage &ges) override; - Response::ResponseCode + virtual Response::ResponseCode cmdSetCardCounter(const Command_SetCardCounter &cmd, ResponseContainer &rc, GameEventStorage &ges) override; - Response::ResponseCode + virtual Response::ResponseCode cmdIncCardCounter(const Command_IncCardCounter &cmd, ResponseContainer &rc, GameEventStorage &ges) override; - Response::ResponseCode - cmdIncCounter(const Command_IncCounter &cmd, ResponseContainer &rc, GameEventStorage &ges) override; - Response::ResponseCode - cmdCreateCounter(const Command_CreateCounter &cmd, ResponseContainer &rc, GameEventStorage &ges) override; - Response::ResponseCode - cmdSetCounter(const Command_SetCounter &cmd, ResponseContainer &rc, GameEventStorage &ges) override; - Response::ResponseCode - cmdDelCounter(const Command_DelCounter &cmd, ResponseContainer &rc, GameEventStorage &ges) override; - Response::ResponseCode - cmdNextTurn(const Command_NextTurn &cmd, ResponseContainer &rc, GameEventStorage &ges) override; - Response::ResponseCode - cmdSetActivePhase(const Command_SetActivePhase &cmd, ResponseContainer &rc, GameEventStorage &ges) override; - Response::ResponseCode + virtual Response::ResponseCode cmdDumpZone(const Command_DumpZone &cmd, ResponseContainer &rc, GameEventStorage &ges) override; - Response::ResponseCode + virtual Response::ResponseCode cmdRevealCards(const Command_RevealCards &cmd, ResponseContainer &rc, GameEventStorage &ges) override; - Response::ResponseCode - cmdReverseTurn(const Command_ReverseTurn & /*cmd*/, ResponseContainer & /*rc*/, GameEventStorage &ges) override; - Response::ResponseCode cmdChangeZoneProperties(const Command_ChangeZoneProperties &cmd, - ResponseContainer &rc, - GameEventStorage &ges) override; + virtual Response::ResponseCode cmdChangeZoneProperties(const Command_ChangeZoneProperties &cmd, + ResponseContainer &rc, + GameEventStorage &ges) override; - void getInfo(ServerInfo_Player *info, - Server_AbstractParticipant *playerWhosAsking, - bool omniscient, - bool withUserInfo) override; + virtual void getInfo(ServerInfo_Player *info, + Server_AbstractParticipant *playerWhosAsking, + bool omniscient, + bool withUserInfo) override; }; #endif diff --git a/common/server/game/server_arrow.cpp b/libcockatrice_network/libcockatrice/network/server/remote/game/server_arrow.cpp similarity index 94% rename from common/server/game/server_arrow.cpp rename to libcockatrice_network/libcockatrice/network/server/remote/game/server_arrow.cpp index fe02995d3..e077416bc 100644 --- a/common/server/game/server_arrow.cpp +++ b/libcockatrice_network/libcockatrice/network/server/remote/game/server_arrow.cpp @@ -1,10 +1,11 @@ #include "server_arrow.h" -#include "pb/serverinfo_arrow.pb.h" #include "server_card.h" #include "server_cardzone.h" #include "server_player.h" +#include + Server_Arrow::Server_Arrow(int _id, Server_Card *_startCard, Server_ArrowTarget *_targetItem, const color &_arrowColor) : id(_id), startCard(_startCard), targetItem(_targetItem), arrowColor(_arrowColor) { diff --git a/common/server/game/server_arrow.h b/libcockatrice_network/libcockatrice/network/server/remote/game/server_arrow.h similarity index 95% rename from common/server/game/server_arrow.h rename to libcockatrice_network/libcockatrice/network/server/remote/game/server_arrow.h index 13a6ea2d8..0b3e63550 100644 --- a/common/server/game/server_arrow.h +++ b/libcockatrice_network/libcockatrice/network/server/remote/game/server_arrow.h @@ -1,7 +1,7 @@ #ifndef SERVER_ARROW_H #define SERVER_ARROW_H -#include "pb/color.pb.h" +#include class Server_Card; class Server_ArrowTarget; diff --git a/common/server/game/server_arrowtarget.cpp b/libcockatrice_network/libcockatrice/network/server/remote/game/server_arrowtarget.cpp similarity index 100% rename from common/server/game/server_arrowtarget.cpp rename to libcockatrice_network/libcockatrice/network/server/remote/game/server_arrowtarget.cpp diff --git a/common/server/game/server_arrowtarget.h b/libcockatrice_network/libcockatrice/network/server/remote/game/server_arrowtarget.h similarity index 100% rename from common/server/game/server_arrowtarget.h rename to libcockatrice_network/libcockatrice/network/server/remote/game/server_arrowtarget.h diff --git a/common/server/game/server_card.cpp b/libcockatrice_network/libcockatrice/network/server/remote/game/server_card.cpp similarity index 96% rename from common/server/game/server_card.cpp rename to libcockatrice_network/libcockatrice/network/server/remote/game/server_card.cpp index 323b4d827..86ff2f008 100644 --- a/common/server/game/server_card.cpp +++ b/libcockatrice_network/libcockatrice/network/server/remote/game/server_card.cpp @@ -19,13 +19,13 @@ ***************************************************************************/ #include "server_card.h" -#include "pb/event_set_card_attr.pb.h" -#include "pb/event_set_card_counter.pb.h" -#include "pb/serverinfo_card.pb.h" #include "server_cardzone.h" #include "server_player.h" #include +#include +#include +#include Server_Card::Server_Card(const CardRef &cardRef, int _id, int _coord_x, int _coord_y, Server_CardZone *_zone) : zone(_zone), id(_id), coord_x(_coord_x), coord_y(_coord_y), cardRef(cardRef), tapped(false), attacking(false), diff --git a/common/server/game/server_card.h b/libcockatrice_network/libcockatrice/network/server/remote/game/server_card.h similarity index 97% rename from common/server/game/server_card.h rename to libcockatrice_network/libcockatrice/network/server/remote/game/server_card.h index a24be2046..bc326bbc4 100644 --- a/common/server/game/server_card.h +++ b/libcockatrice_network/libcockatrice/network/server/remote/game/server_card.h @@ -20,13 +20,13 @@ #ifndef SERVER_CARD_H #define SERVER_CARD_H -#include "../../card_ref.h" -#include "pb/card_attributes.pb.h" -#include "pb/serverinfo_card.pb.h" #include "server_arrowtarget.h" #include #include +#include +#include +#include class Server_CardZone; class Event_SetCardCounter; diff --git a/common/server/game/server_cardzone.cpp b/libcockatrice_network/libcockatrice/network/server/remote/game/server_cardzone.cpp similarity index 98% rename from common/server/game/server_cardzone.cpp rename to libcockatrice_network/libcockatrice/network/server/remote/game/server_cardzone.cpp index 44b946fa0..68dcadd35 100644 --- a/common/server/game/server_cardzone.cpp +++ b/libcockatrice_network/libcockatrice/network/server/remote/game/server_cardzone.cpp @@ -19,15 +19,15 @@ ***************************************************************************/ #include "server_cardzone.h" -#include "../rng_abstract.h" -#include "pb/command_move_card.pb.h" +#include "server_abstract_player.h" #include "server_card.h" -#include "server_player.h" #include #include +#include +#include -Server_CardZone::Server_CardZone(Server_Player *_player, +Server_CardZone::Server_CardZone(Server_AbstractPlayer *_player, const QString &_name, bool _has_coords, ServerInfo_Zone::ZoneType _type) diff --git a/common/server/game/server_cardzone.h b/libcockatrice_network/libcockatrice/network/server/remote/game/server_cardzone.h similarity index 92% rename from common/server/game/server_cardzone.h rename to libcockatrice_network/libcockatrice/network/server/remote/game/server_cardzone.h index 4c7318f08..2a30de53d 100644 --- a/common/server/game/server_cardzone.h +++ b/libcockatrice_network/libcockatrice/network/server/remote/game/server_cardzone.h @@ -20,15 +20,14 @@ #ifndef SERVER_CARDZONE_H #define SERVER_CARDZONE_H -#include "pb/serverinfo_zone.pb.h" - #include #include #include #include +#include class Server_Card; -class Server_Player; +class Server_AbstractPlayer; class Server_AbstractParticipant; class Server_Game; class GameEventStorage; @@ -36,7 +35,7 @@ class GameEventStorage; class Server_CardZone { private: - Server_Player *player; + Server_AbstractPlayer *player; QString name; bool has_coords; // having coords means this zone has x and y coordinates ServerInfo_Zone::ZoneType type; @@ -52,7 +51,10 @@ private: void insertCardIntoCoordMap(Server_Card *card, int x, int y); public: - Server_CardZone(Server_Player *_player, const QString &_name, bool _has_coords, ServerInfo_Zone::ZoneType _type); + Server_CardZone(Server_AbstractPlayer *_player, + const QString &_name, + bool _has_coords, + ServerInfo_Zone::ZoneType _type); ~Server_CardZone(); const QList &getCards() const @@ -84,7 +86,7 @@ public: { return name; } - Server_Player *getPlayer() const + Server_AbstractPlayer *getPlayer() const { return player; } diff --git a/common/server/game/server_counter.cpp b/libcockatrice_network/libcockatrice/network/server/remote/game/server_counter.cpp similarity index 88% rename from common/server/game/server_counter.cpp rename to libcockatrice_network/libcockatrice/network/server/remote/game/server_counter.cpp index 3dc5c6d66..b18e11c2b 100644 --- a/common/server/game/server_counter.cpp +++ b/libcockatrice_network/libcockatrice/network/server/remote/game/server_counter.cpp @@ -1,6 +1,6 @@ #include "server_counter.h" -#include "pb/serverinfo_counter.pb.h" +#include Server_Counter::Server_Counter(int _id, const QString &_name, const color &_counterColor, int _radius, int _count) : id(_id), name(_name), counterColor(_counterColor), radius(_radius), count(_count) diff --git a/common/server/game/server_counter.h b/libcockatrice_network/libcockatrice/network/server/remote/game/server_counter.h similarity index 97% rename from common/server/game/server_counter.h rename to libcockatrice_network/libcockatrice/network/server/remote/game/server_counter.h index 3a5f837ae..55aad991c 100644 --- a/common/server/game/server_counter.h +++ b/libcockatrice_network/libcockatrice/network/server/remote/game/server_counter.h @@ -20,9 +20,8 @@ #ifndef SERVER_COUNTER_H #define SERVER_COUNTER_H -#include "pb/color.pb.h" - #include +#include class ServerInfo_Counter; diff --git a/common/server/game/server_game.cpp b/libcockatrice_network/libcockatrice/network/server/remote/game/server_game.cpp similarity index 93% rename from common/server/game/server_game.cpp rename to libcockatrice_network/libcockatrice/network/server/remote/game/server_game.cpp index eb064d878..67c1aa8d6 100644 --- a/common/server/game/server_game.cpp +++ b/libcockatrice_network/libcockatrice/network/server/remote/game/server_game.cpp @@ -19,28 +19,11 @@ ***************************************************************************/ #include "server_game.h" -#include "../../deck_list.h" #include "../server.h" #include "../server_database_interface.h" #include "../server_protocolhandler.h" #include "../server_room.h" -#include "pb/context_connection_state_changed.pb.h" -#include "pb/context_deck_select.pb.h" -#include "pb/context_ping_changed.pb.h" -#include "pb/event_delete_arrow.pb.h" -#include "pb/event_game_closed.pb.h" -#include "pb/event_game_host_changed.pb.h" -#include "pb/event_game_joined.pb.h" -#include "pb/event_game_state_changed.pb.h" -#include "pb/event_join.pb.h" -#include "pb/event_kicked.pb.h" -#include "pb/event_leave.pb.h" -#include "pb/event_player_properties_changed.pb.h" -#include "pb/event_replay_added.pb.h" -#include "pb/event_set_active_phase.pb.h" -#include "pb/event_set_active_player.pb.h" -#include "pb/game_replay.pb.h" -#include "pb/serverinfo_playerping.pb.h" +#include "server_abstract_player.h" #include "server_arrow.h" #include "server_card.h" #include "server_cardzone.h" @@ -50,6 +33,24 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include Server_Game::Server_Game(const ServerInfo_User &_creatorInfo, int _gameId, @@ -221,24 +222,24 @@ void Server_Game::pingClockTimeout() } } -QMap Server_Game::getPlayers() const // copies pointers to new map +QMap Server_Game::getPlayers() const // copies pointers to new map { - QMap players; + QMap players; QMutexLocker locker(&gameMutex); for (int id : participants.keys()) { auto *participant = participants[id]; if (!participant->getSpectator()) { - players[id] = static_cast(participant); + players[id] = static_cast(participant); } } return players; } -Server_Player *Server_Game::getPlayer(int id) const +Server_AbstractPlayer *Server_Game::getPlayer(int id) const { auto *participant = participants.value(id); if (!participant->getSpectator()) { - return static_cast(participant); + return static_cast(participant); } else { return nullptr; } @@ -339,7 +340,7 @@ void Server_Game::doStartGameIfReady(bool forceStartGame) } } - for (Server_Player *player : players.values()) { + for (Server_AbstractPlayer *player : players.values()) { player->setupZones(); } @@ -534,7 +535,7 @@ void Server_Game::removeParticipant(Server_AbstractParticipant *participant, Eve bool spectator = participant->getSpectator(); GameEventStorage ges; if (!spectator) { - auto *player = static_cast(participant); + auto *player = static_cast(participant); removeArrowsRelatedToPlayer(ges, player); unattachCards(ges, player); } @@ -577,14 +578,14 @@ void Server_Game::removeParticipant(Server_AbstractParticipant *participant, Eve emit gameInfoChanged(gameInfo); } -void Server_Game::removeArrowsRelatedToPlayer(GameEventStorage &ges, Server_Player *player) +void Server_Game::removeArrowsRelatedToPlayer(GameEventStorage &ges, Server_AbstractPlayer *player) { QMutexLocker locker(&gameMutex); // Remove all arrows of other players pointing to the player being removed or to one of his cards. // Also remove all arrows starting at one of his cards. This is necessary since players can create // arrows that start at another person's cards. - for (Server_Player *anyPlayer : getPlayers().values()) { + for (Server_AbstractPlayer *anyPlayer : getPlayers().values()) { QList arrows = anyPlayer->getArrows().values(); QList toDelete; for (int i = 0; i < arrows.size(); ++i) { @@ -593,7 +594,7 @@ void Server_Game::removeArrowsRelatedToPlayer(GameEventStorage &ges, Server_Play if (targetCard) { if (targetCard->getZone() != nullptr && targetCard->getZone()->getPlayer() == player) toDelete.append(arrow); - } else if (static_cast(arrow->getTargetItem()) == player) + } else if (static_cast(arrow->getTargetItem()) == player) toDelete.append(arrow); // Don't use else here! It has to happen regardless of whether targetCard == 0. @@ -610,7 +611,7 @@ void Server_Game::removeArrowsRelatedToPlayer(GameEventStorage &ges, Server_Play } } -void Server_Game::unattachCards(GameEventStorage &ges, Server_Player *player) +void Server_Game::unattachCards(GameEventStorage &ges, Server_AbstractPlayer *player) { QMutexLocker locker(&gameMutex); diff --git a/common/server/game/server_game.h b/libcockatrice_network/libcockatrice/network/server/remote/game/server_game.h similarity index 94% rename from common/server/game/server_game.h rename to libcockatrice_network/libcockatrice/network/server/remote/game/server_game.h index 6bb162763..50ffbef36 100644 --- a/common/server/game/server_game.h +++ b/libcockatrice_network/libcockatrice/network/server/remote/game/server_game.h @@ -21,9 +21,6 @@ #define SERVERGAME_H #include "../server_response_containers.h" -#include "pb/event_leave.pb.h" -#include "pb/response.pb.h" -#include "pb/serverinfo_game.pb.h" #include #include @@ -31,12 +28,15 @@ #include #include #include +#include +#include +#include class QTimer; class GameEventContainer; class GameReplay; class Server_Room; -class Server_Player; +class Server_AbstractPlayer; class Server_AbstractParticipant; class ServerInfo_User; class ServerInfo_Game; @@ -130,8 +130,8 @@ public: } int getPlayerCount() const; int getSpectatorCount() const; - QMap getPlayers() const; - Server_Player *getPlayer(int id) const; + QMap getPlayers() const; + Server_AbstractPlayer *getPlayer(int id) const; const QMap &getParticipants() const { return participants; @@ -185,8 +185,8 @@ public: bool judge, bool broadcastUpdate = true); void removeParticipant(Server_AbstractParticipant *participant, Event_Leave::LeaveReason reason); - void removeArrowsRelatedToPlayer(GameEventStorage &ges, Server_Player *player); - void unattachCards(GameEventStorage &ges, Server_Player *player); + void removeArrowsRelatedToPlayer(GameEventStorage &ges, Server_AbstractPlayer *player); + void unattachCards(GameEventStorage &ges, Server_AbstractPlayer *player); bool kickParticipant(int playerId); void startGameIfReady(bool forceStartGame); void stopGameIfFinished(); diff --git a/libcockatrice_network/libcockatrice/network/server/remote/game/server_move_card_struct.h b/libcockatrice_network/libcockatrice/network/server/remote/game/server_move_card_struct.h new file mode 100644 index 000000000..c5b293b6d --- /dev/null +++ b/libcockatrice_network/libcockatrice/network/server/remote/game/server_move_card_struct.h @@ -0,0 +1,26 @@ +#ifndef MOVE_CARD_STRUCT +#define MOVE_CARD_STRUCT + +#include "server_card.h" +class CardToMove; + +struct MoveCardStruct +{ + Server_Card *card; + int position; + const CardToMove *cardToMove; + int xCoord, yCoord; + MoveCardStruct(Server_Card *_card, int _position, const CardToMove *_cardToMove) + : card(_card), position(_position), cardToMove(_cardToMove), xCoord(_card->getX()), yCoord(_card->getY()) + + { + } + bool operator<(const MoveCardStruct &other) const + { + return (yCoord == other.yCoord && + ((xCoord == other.xCoord && position < other.position) || xCoord < other.xCoord)) || + yCoord < other.yCoord; + } +}; + +#endif diff --git a/libcockatrice_network/libcockatrice/network/server/remote/game/server_player.cpp b/libcockatrice_network/libcockatrice/network/server/remote/game/server_player.cpp new file mode 100644 index 000000000..b840a172c --- /dev/null +++ b/libcockatrice_network/libcockatrice/network/server/remote/game/server_player.cpp @@ -0,0 +1,648 @@ +#include "server_player.h" + +#include "../server.h" +#include "../server_abstractuserinterface.h" +#include "../server_database_interface.h" +#include "../server_room.h" +#include "server_arrow.h" +#include "server_card.h" +#include "server_cardzone.h" +#include "server_counter.h" +#include "server_game.h" +#include "server_move_card_struct.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +Server_Player::Server_Player(Server_Game *_game, + int _playerId, + const ServerInfo_User &_userInfo, + bool _judge, + Server_AbstractUserInterface *_userInterface) + : Server_AbstractPlayer(_game, _playerId, _userInfo, _judge, _userInterface) +{ +} + +Server_Player::~Server_Player() = default; + +int Server_Player::newCounterId() const +{ + int id = 0; + QMapIterator i(counters); + while (i.hasNext()) { + Server_Counter *c = i.next().value(); + if (c->getId() > id) { + id = c->getId(); + } + } + return id + 1; +} + +void Server_Player::setupZones() +{ + Server_AbstractPlayer::setupZones(); + + // This may need to be customized according to the game rules. + // ------------------------------------------------------------------ + + // Create zones + auto *deckZone = new Server_CardZone(this, "deck", false, ServerInfo_Zone::HiddenZone); + addZone(deckZone); + auto *sbZone = new Server_CardZone(this, "sb", false, ServerInfo_Zone::HiddenZone); + addZone(sbZone); + addZone(new Server_CardZone(this, "table", true, ServerInfo_Zone::PublicZone)); + addZone(new Server_CardZone(this, "hand", false, ServerInfo_Zone::PrivateZone)); + addZone(new Server_CardZone(this, "stack", false, ServerInfo_Zone::PublicZone)); + addZone(new Server_CardZone(this, "grave", false, ServerInfo_Zone::PublicZone)); + addZone(new Server_CardZone(this, "rfg", false, ServerInfo_Zone::PublicZone)); + + addCounter(new Server_Counter(0, "life", makeColor(255, 255, 255), 25, game->getStartingLifeTotal())); + addCounter(new Server_Counter(1, "w", makeColor(255, 255, 150), 20, 0)); + addCounter(new Server_Counter(2, "u", makeColor(150, 150, 255), 20, 0)); + addCounter(new Server_Counter(3, "b", makeColor(150, 150, 150), 20, 0)); + addCounter(new Server_Counter(4, "r", makeColor(250, 150, 150), 20, 0)); + addCounter(new Server_Counter(5, "g", makeColor(150, 255, 150), 20, 0)); + addCounter(new Server_Counter(6, "x", makeColor(255, 255, 255), 20, 0)); + addCounter(new Server_Counter(7, "storm", makeColor(255, 150, 30), 20, 0)); + + // ------------------------------------------------------------------ + + // Assign card ids and create deck from deck list + InnerDecklistNode *listRoot = deck->getRoot(); + for (int i = 0; i < listRoot->size(); ++i) { + auto *currentZone = dynamic_cast(listRoot->at(i)); + Server_CardZone *z; + if (currentZone->getName() == DECK_ZONE_MAIN) { + z = deckZone; + } else if (currentZone->getName() == DECK_ZONE_SIDE) { + z = sbZone; + } else { + continue; + } + + for (int j = 0; j < currentZone->size(); ++j) { + auto *currentCard = dynamic_cast(currentZone->at(j)); + if (!currentCard) { + continue; + } + for (int k = 0; k < currentCard->getNumber(); ++k) { + z->insertCard(new Server_Card(currentCard->toCardRef(), nextCardId++, 0, 0, z), -1, 0); + } + } + } + + const QList &sideboardPlan = deck->getCurrentSideboardPlan(); + for (const auto &m : sideboardPlan) { + const QString startZone = nameFromStdString(m.start_zone()); + const QString targetZone = nameFromStdString(m.target_zone()); + + Server_CardZone *start, *target; + if (startZone == DECK_ZONE_MAIN) { + start = deckZone; + } else if (startZone == DECK_ZONE_SIDE) { + start = sbZone; + } else { + continue; + } + if (targetZone == DECK_ZONE_MAIN) { + target = deckZone; + } else if (targetZone == DECK_ZONE_SIDE) { + target = sbZone; + } else { + continue; + } + + for (int j = 0; j < start->getCards().size(); ++j) { + if (start->getCards()[j]->getName() == nameFromStdString(m.card_name())) { + Server_Card *card = start->getCard(j, nullptr, true); + target->insertCard(card, -1, 0); + break; + } + } + } + + deckZone->shuffle(); +} + +void Server_Player::clearZones() +{ + Server_AbstractPlayer::clearZones(); + for (Server_Counter *counter : counters) { + delete counter; + } + counters.clear(); + + lastDrawList.clear(); +} + +void Server_Player::addCounter(Server_Counter *counter) +{ + counters.insert(counter->getId(), counter); +} + +Response::ResponseCode Server_Player::drawCards(GameEventStorage &ges, int number) +{ + Server_CardZone *deckZone = zones.value("deck"); + Server_CardZone *handZone = zones.value("hand"); + if (deckZone->getCards().size() < number) { + number = deckZone->getCards().size(); + } + + Event_DrawCards eventOthers; + eventOthers.set_number(number); + Event_DrawCards eventPrivate(eventOthers); + + for (int i = 0; i < number; ++i) { + Server_Card *card = deckZone->getCard(0, nullptr, true); + handZone->insertCard(card, -1, 0); + lastDrawList.append(card->getId()); + + ServerInfo_Card *cardInfo = eventPrivate.add_cards(); + cardInfo->set_id(card->getId()); + cardInfo->set_name(card->getName().toStdString()); + cardInfo->set_provider_id(card->getProviderId().toStdString()); + } + + ges.enqueueGameEvent(eventPrivate, playerId, GameEventStorageItem::SendToPrivate, playerId); + ges.enqueueGameEvent(eventOthers, playerId, GameEventStorageItem::SendToOthers); + + if (number > 0) { + revealTopCardIfNeeded(deckZone, ges); + int currentKnownCards = deckZone->getCardsBeingLookedAt(); + deckZone->setCardsBeingLookedAt(currentKnownCards - number); + } + + return Response::RespOk; +} + +void Server_Player::onCardBeingMoved(GameEventStorage &ges, + const MoveCardStruct &cardStruct, + Server_CardZone *startzone, + Server_CardZone *targetzone, + bool undoingDraw) +{ + Server_AbstractPlayer::onCardBeingMoved(ges, cardStruct, startzone, targetzone, undoingDraw); + + Server_Card *card = cardStruct.card; + + // "Undo draw" should only remain valid if the just-drawn card stays within the user's hand (e.g., they only + // reorder their hand). If a just-drawn card leaves the hand then remove cards before it from the list + // (Ignore the case where the card is currently being un-drawn.) + if (startzone->getName() == "hand" && targetzone->getName() != "hand" && !undoingDraw) { + int index = lastDrawList.lastIndexOf(card->getId()); + if (index != -1) { + lastDrawList.erase(lastDrawList.begin(), lastDrawList.begin() + index); + } + } +} + +Response::ResponseCode +Server_Player::cmdDeckSelect(const Command_DeckSelect &cmd, ResponseContainer &rc, GameEventStorage &ges) +{ + if (game->getGameStarted()) { + return Response::RespContextError; + } + + DeckList *newDeck; + if (cmd.has_deck_id()) { + try { + newDeck = game->getRoom()->getServer()->getDatabaseInterface()->getDeckFromDatabase(cmd.deck_id(), + userInfo->id()); + } catch (Response::ResponseCode &r) { + return r; + } + } else { + newDeck = new DeckList(fileFromStdString(cmd.deck())); + } + + if (!newDeck) { + return Response::RespInternalError; + } + + delete deck; + deck = newDeck; + sideboardLocked = true; + + Event_PlayerPropertiesChanged event; + event.mutable_player_properties()->set_sideboard_locked(true); + event.mutable_player_properties()->set_deck_hash(deck->getDeckHash().toStdString()); + ges.enqueueGameEvent(event, playerId); + + Context_DeckSelect context; + context.set_deck_hash(deck->getDeckHash().toStdString()); + context.set_sideboard_size(deck->getSideboardSize()); + if (game->getShareDecklistsOnLoad()) { + context.set_deck_list(deck->writeToString_Native().toStdString()); + } + ges.setGameEventContext(context); + + auto *re = new Response_DeckDownload; + re->set_deck(deck->writeToString_Native().toStdString()); + + rc.setResponseExtension(re); + return Response::RespOk; +} + +Response::ResponseCode Server_Player::cmdSetSideboardPlan(const Command_SetSideboardPlan &cmd, + ResponseContainer & /*rc*/, + GameEventStorage & /*ges*/) +{ + if (readyStart) { + return Response::RespContextError; + } + if (!deck) { + return Response::RespContextError; + } + if (sideboardLocked) { + return Response::RespContextError; + } + + QList sideboardPlan; + for (int i = 0; i < cmd.move_list_size(); ++i) { + sideboardPlan.append(cmd.move_list(i)); + } + deck->setCurrentSideboardPlan(sideboardPlan); + + return Response::RespOk; +} + +Response::ResponseCode Server_Player::cmdSetSideboardLock(const Command_SetSideboardLock &cmd, + ResponseContainer & /*rc*/, + GameEventStorage &ges) +{ + if (readyStart) { + return Response::RespContextError; + } + if (!deck) { + return Response::RespContextError; + } + if (sideboardLocked == cmd.locked()) { + return Response::RespContextError; + } + + sideboardLocked = cmd.locked(); + if (sideboardLocked) { + deck->setCurrentSideboardPlan(QList()); + } + + Event_PlayerPropertiesChanged event; + event.mutable_player_properties()->set_sideboard_locked(sideboardLocked); + ges.enqueueGameEvent(event, playerId); + ges.setGameEventContext(Context_SetSideboardLock()); + + return Response::RespOk; +} + +Response::ResponseCode +Server_Player::cmdShuffle(const Command_Shuffle &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges) +{ + if (!game->getGameStarted()) { + return Response::RespGameNotStarted; + } + + if (conceded) { + return Response::RespContextError; + } + + if (cmd.has_zone_name() && cmd.zone_name() != "deck") { + return Response::RespFunctionNotAllowed; + } + + Server_CardZone *zone = zones.value("deck"); + if (!zone) { + return Response::RespNameNotFound; + } + + zone->shuffle(cmd.start(), cmd.end()); + + Event_Shuffle event; + event.set_zone_name(zone->getName().toStdString()); + event.set_start(cmd.start()); + event.set_end(cmd.end()); + ges.enqueueGameEvent(event, playerId); + revealTopCardIfNeeded(zone, ges); + + return Response::RespOk; +} + +Response::ResponseCode +Server_Player::cmdMulligan(const Command_Mulligan &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges) +{ + if (!game->getGameStarted()) { + return Response::RespGameNotStarted; + } + if (conceded) { + return Response::RespContextError; + } + + Server_CardZone *hand = zones.value("hand"); + Server_CardZone *_deck = zones.value("deck"); + int number = cmd.number(); + + if (!hand->getCards().isEmpty()) { + auto cardsToMove = QList(); + for (auto &card : hand->getCards()) { + auto *cardToMove = new CardToMove; + cardToMove->set_card_id(card->getId()); + cardsToMove.append(cardToMove); + } + moveCard(ges, hand, cardsToMove, _deck, -1, 0, false); + qDeleteAll(cardsToMove); + } + + _deck->shuffle(); + ges.enqueueGameEvent(Event_Shuffle(), playerId); + + drawCards(ges, number); + + Context_Mulligan context; + context.set_number(static_cast(hand->getCards().size())); + ges.setGameEventContext(context); + + return Response::RespOk; +} + +Response::ResponseCode +Server_Player::cmdDrawCards(const Command_DrawCards &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges) +{ + if (!game->getGameStarted()) { + return Response::RespGameNotStarted; + } + if (conceded) { + return Response::RespContextError; + } + + return drawCards(ges, cmd.number()); +} + +Response::ResponseCode +Server_Player::cmdUndoDraw(const Command_UndoDraw & /*cmd*/, ResponseContainer & /*rc*/, GameEventStorage &ges) +{ + if (!game->getGameStarted()) { + return Response::RespGameNotStarted; + } + if (conceded) { + return Response::RespContextError; + } + + if (lastDrawList.isEmpty()) { + return Response::RespContextError; + } + + Response::ResponseCode retVal; + auto *cardToMove = new CardToMove; + cardToMove->set_card_id(lastDrawList.takeLast()); + retVal = moveCard(ges, zones.value("hand"), QList() << cardToMove, zones.value("deck"), 0, 0, + false, true); + delete cardToMove; + + return retVal; +} + +Response::ResponseCode +Server_Player::cmdIncCounter(const Command_IncCounter &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges) +{ + if (!game->getGameStarted()) { + return Response::RespGameNotStarted; + } + if (conceded) { + return Response::RespContextError; + } + + Server_Counter *c = counters.value(cmd.counter_id(), 0); + if (!c) { + return Response::RespNameNotFound; + } + + c->setCount(c->getCount() + cmd.delta()); + + Event_SetCounter event; + event.set_counter_id(c->getId()); + event.set_value(c->getCount()); + ges.enqueueGameEvent(event, playerId); + + return Response::RespOk; +} + +Response::ResponseCode +Server_Player::cmdCreateCounter(const Command_CreateCounter &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges) +{ + if (!game->getGameStarted()) { + return Response::RespGameNotStarted; + } + if (conceded) { + return Response::RespContextError; + } + + auto *c = new Server_Counter(newCounterId(), nameFromStdString(cmd.counter_name()), cmd.counter_color(), + cmd.radius(), cmd.value()); + addCounter(c); + + Event_CreateCounter event; + ServerInfo_Counter *counterInfo = event.mutable_counter_info(); + counterInfo->set_id(c->getId()); + counterInfo->set_name(c->getName().toStdString()); + counterInfo->mutable_counter_color()->CopyFrom(cmd.counter_color()); + counterInfo->set_radius(c->getRadius()); + counterInfo->set_count(c->getCount()); + ges.enqueueGameEvent(event, playerId); + + return Response::RespOk; +} + +Response::ResponseCode +Server_Player::cmdSetCounter(const Command_SetCounter &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges) +{ + if (!game->getGameStarted()) { + return Response::RespGameNotStarted; + } + if (conceded) { + return Response::RespContextError; + } + + Server_Counter *c = counters.value(cmd.counter_id(), 0); + if (!c) { + return Response::RespNameNotFound; + } + + c->setCount(cmd.value()); + + Event_SetCounter event; + event.set_counter_id(c->getId()); + event.set_value(c->getCount()); + ges.enqueueGameEvent(event, playerId); + + return Response::RespOk; +} + +Response::ResponseCode +Server_Player::cmdDelCounter(const Command_DelCounter &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges) +{ + if (!game->getGameStarted()) { + return Response::RespGameNotStarted; + } + if (conceded) { + return Response::RespContextError; + } + + Server_Counter *counter = counters.value(cmd.counter_id(), 0); + if (!counter) { + return Response::RespNameNotFound; + } + counters.remove(cmd.counter_id()); + delete counter; + + Event_DelCounter event; + event.set_counter_id(cmd.counter_id()); + ges.enqueueGameEvent(event, playerId); + + return Response::RespOk; +} + +Response::ResponseCode +Server_Player::cmdNextTurn(const Command_NextTurn & /*cmd*/, ResponseContainer & /*rc*/, GameEventStorage & /*ges*/) +{ + if (!game->getGameStarted()) { + return Response::RespGameNotStarted; + } + + if (conceded && !judge) { + return Response::RespContextError; + } + + game->nextTurn(); + return Response::RespOk; +} + +Response::ResponseCode Server_Player::cmdSetActivePhase(const Command_SetActivePhase &cmd, + ResponseContainer & /*rc*/, + GameEventStorage & /*ges*/) +{ + if (!game->getGameStarted()) { + return Response::RespGameNotStarted; + } + + if (!judge) { + if (conceded) { + return Response::RespContextError; + } + + if (game->getActivePlayer() != playerId) { + return Response::RespContextError; + } + } + + game->setActivePhase(cmd.phase()); + + return Response::RespOk; +} + +Response::ResponseCode Server_Player::cmdChangeZoneProperties(const Command_ChangeZoneProperties &cmd, + ResponseContainer &rc, + GameEventStorage &ges) +{ + auto ret = Server_AbstractPlayer::cmdChangeZoneProperties(cmd, rc, ges); + + Server_CardZone *zone = zones.value(nameFromStdString(cmd.zone_name())); + if (!zone) { + return Response::RespNameNotFound; + } + + revealTopCardIfNeeded(zone, ges); + return ret; +} + +Response::ResponseCode +Server_Player::cmdReverseTurn(const Command_ReverseTurn &cmd, ResponseContainer &rc, GameEventStorage &ges) +{ + + if (!judge && conceded) { + return Response::RespContextError; + } + return Server_AbstractParticipant::cmdReverseTurn(cmd, rc, ges); +} + +void Server_Player::getInfo(ServerInfo_Player *info, + Server_AbstractParticipant *recipient, + bool omniscient, + bool withUserInfo) +{ + Server_AbstractPlayer::getInfo(info, recipient, omniscient, withUserInfo); + + for (Server_Counter *counter : counters) { + counter->getInfo(info->add_counter_list()); + } +} diff --git a/libcockatrice_network/libcockatrice/network/server/remote/game/server_player.h b/libcockatrice_network/libcockatrice/network/server/remote/game/server_player.h new file mode 100644 index 000000000..5925ed3c2 --- /dev/null +++ b/libcockatrice_network/libcockatrice/network/server/remote/game/server_player.h @@ -0,0 +1,75 @@ +#ifndef PLAYER_H +#define PLAYER_H + +#include "server_abstract_player.h" + +class Server_Player : public Server_AbstractPlayer +{ + Q_OBJECT +private: + QMap counters; + QList lastDrawList; + +public: + Server_Player(Server_Game *_game, + int _playerId, + const ServerInfo_User &_userInfo, + bool _judge, + Server_AbstractUserInterface *_handler); + ~Server_Player() override; + const QMap &getCounters() const + { + return counters; + } + int newCounterId() const; + void addCounter(Server_Counter *counter); + + void setupZones() override; + void clearZones() override; + + Response::ResponseCode drawCards(GameEventStorage &ges, int number); + void onCardBeingMoved(GameEventStorage &ges, + const MoveCardStruct &cardStruct, + Server_CardZone *startzone, + Server_CardZone *targetzone, + bool undoingDraw) override; + + Response::ResponseCode + cmdDeckSelect(const Command_DeckSelect &cmd, ResponseContainer &rc, GameEventStorage &ges) override; + Response::ResponseCode + cmdSetSideboardPlan(const Command_SetSideboardPlan &cmd, ResponseContainer &rc, GameEventStorage &ges) override; + Response::ResponseCode + cmdSetSideboardLock(const Command_SetSideboardLock &cmd, ResponseContainer &rc, GameEventStorage &ges) override; + Response::ResponseCode + cmdShuffle(const Command_Shuffle &cmd, ResponseContainer &rc, GameEventStorage &ges) override; + Response::ResponseCode + cmdMulligan(const Command_Mulligan &cmd, ResponseContainer &rc, GameEventStorage &ges) override; + Response::ResponseCode + cmdDrawCards(const Command_DrawCards &cmd, ResponseContainer &rc, GameEventStorage &ges) override; + Response::ResponseCode + cmdUndoDraw(const Command_UndoDraw &cmd, ResponseContainer &rc, GameEventStorage &ges) override; + Response::ResponseCode + cmdIncCounter(const Command_IncCounter &cmd, ResponseContainer &rc, GameEventStorage &ges) override; + Response::ResponseCode + cmdCreateCounter(const Command_CreateCounter &cmd, ResponseContainer &rc, GameEventStorage &ges) override; + Response::ResponseCode + cmdSetCounter(const Command_SetCounter &cmd, ResponseContainer &rc, GameEventStorage &ges) override; + Response::ResponseCode + cmdDelCounter(const Command_DelCounter &cmd, ResponseContainer &rc, GameEventStorage &ges) override; + Response::ResponseCode + cmdNextTurn(const Command_NextTurn &cmd, ResponseContainer &rc, GameEventStorage &ges) override; + Response::ResponseCode + cmdSetActivePhase(const Command_SetActivePhase &cmd, ResponseContainer &rc, GameEventStorage &ges) override; + Response::ResponseCode + cmdReverseTurn(const Command_ReverseTurn & /*cmd*/, ResponseContainer & /*rc*/, GameEventStorage &ges) override; + Response::ResponseCode cmdChangeZoneProperties(const Command_ChangeZoneProperties &cmd, + ResponseContainer &rc, + GameEventStorage &ges) override; + + void getInfo(ServerInfo_Player *info, + Server_AbstractParticipant *playerWhosAsking, + bool omniscient, + bool withUserInfo) override; +}; + +#endif diff --git a/common/server/game/server_spectator.cpp b/libcockatrice_network/libcockatrice/network/server/remote/game/server_spectator.cpp similarity index 100% rename from common/server/game/server_spectator.cpp rename to libcockatrice_network/libcockatrice/network/server/remote/game/server_spectator.cpp diff --git a/common/server/game/server_spectator.h b/libcockatrice_network/libcockatrice/network/server/remote/game/server_spectator.h similarity index 100% rename from common/server/game/server_spectator.h rename to libcockatrice_network/libcockatrice/network/server/remote/game/server_spectator.h diff --git a/common/room_message_type.h b/libcockatrice_network/libcockatrice/network/server/remote/room_message_type.h similarity index 86% rename from common/room_message_type.h rename to libcockatrice_network/libcockatrice/network/server/remote/room_message_type.h index 7b7ad9aca..5559db965 100644 --- a/common/room_message_type.h +++ b/libcockatrice_network/libcockatrice/network/server/remote/room_message_type.h @@ -6,9 +6,8 @@ // https://github.com/protocolbuffers/protobuf/issues/119 #undef TYPE_BOOL #endif -#include "pb/event_room_say.pb.h" - #include +#include Q_DECLARE_FLAGS(RoomMessageTypeFlags, Event_RoomSay::RoomMessageType) Q_DECLARE_OPERATORS_FOR_FLAGS(RoomMessageTypeFlags) diff --git a/common/server/server.cpp b/libcockatrice_network/libcockatrice/network/server/remote/server.cpp similarity index 98% rename from common/server/server.cpp rename to libcockatrice_network/libcockatrice/network/server/remote/server.cpp index a80c9ee8f..2f1232b8f 100644 --- a/common/server/server.cpp +++ b/libcockatrice_network/libcockatrice/network/server/remote/server.cpp @@ -19,16 +19,8 @@ ***************************************************************************/ #include "server.h" -#include "../debug_pb_message.h" -#include "../featureset.h" #include "game/server_game.h" #include "game/server_player.h" -#include "pb/event_connection_closed.pb.h" -#include "pb/event_list_rooms.pb.h" -#include "pb/event_user_joined.pb.h" -#include "pb/event_user_left.pb.h" -#include "pb/isl_message.pb.h" -#include "pb/session_event.pb.h" #include "server_database_interface.h" #include "server_protocolhandler.h" #include "server_remoteuserinterface.h" @@ -37,6 +29,14 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include Server::Server(QObject *parent) : QObject(parent), nextLocalGameId(0), tcpUserCount(0), webSocketUserCount(0) { diff --git a/common/server/server.h b/libcockatrice_network/libcockatrice/network/server/remote/server.h similarity index 96% rename from common/server/server.h rename to libcockatrice_network/libcockatrice/network/server/remote/server.h index 293aeb5b2..f9dada801 100644 --- a/common/server/server.h +++ b/libcockatrice_network/libcockatrice/network/server/remote/server.h @@ -1,11 +1,6 @@ #ifndef SERVER_H #define SERVER_H -#include "pb/commands.pb.h" -#include "pb/serverinfo_ban.pb.h" -#include "pb/serverinfo_chat_message.pb.h" -#include "pb/serverinfo_user.pb.h" -#include "pb/serverinfo_warning.pb.h" #include "server_player_reference.h" #include @@ -14,6 +9,11 @@ #include #include #include +#include +#include +#include +#include +#include class Server_DatabaseInterface; class Server_Game; diff --git a/common/server/server_abstractuserinterface.cpp b/libcockatrice_network/libcockatrice/network/server/remote/server_abstractuserinterface.cpp similarity index 97% rename from common/server/server_abstractuserinterface.cpp rename to libcockatrice_network/libcockatrice/network/server/remote/server_abstractuserinterface.cpp index 5016a8867..96626a4bf 100644 --- a/common/server/server_abstractuserinterface.cpp +++ b/libcockatrice_network/libcockatrice/network/server/remote/server_abstractuserinterface.cpp @@ -2,8 +2,6 @@ #include "game/server_game.h" #include "game/server_player.h" -#include "pb/event_game_joined.pb.h" -#include "pb/event_game_state_changed.pb.h" #include "server.h" #include "server_player_reference.h" #include "server_response_containers.h" @@ -13,6 +11,8 @@ #include #include #include +#include +#include void Server_AbstractUserInterface::sendProtocolItemByType(ServerMessage::MessageType type, const ::google::protobuf::Message &item) diff --git a/common/server/server_abstractuserinterface.h b/libcockatrice_network/libcockatrice/network/server/remote/server_abstractuserinterface.h similarity index 92% rename from common/server/server_abstractuserinterface.h rename to libcockatrice_network/libcockatrice/network/server/remote/server_abstractuserinterface.h index c65d8a5c4..10a2aee62 100644 --- a/common/server/server_abstractuserinterface.h +++ b/libcockatrice_network/libcockatrice/network/server/remote/server_abstractuserinterface.h @@ -1,13 +1,13 @@ #ifndef SERVER_ABSTRACTUSERINTERFACE #define SERVER_ABSTRACTUSERINTERFACE -#include "../serverinfo_user_container.h" -#include "pb/response.pb.h" -#include "pb/server_message.pb.h" +#include "serverinfo_user_container.h" #include #include #include +#include +#include class SessionEvent; class GameEventContainer; diff --git a/common/server/server_database_interface.cpp b/libcockatrice_network/libcockatrice/network/server/remote/server_database_interface.cpp similarity index 100% rename from common/server/server_database_interface.cpp rename to libcockatrice_network/libcockatrice/network/server/remote/server_database_interface.cpp diff --git a/common/server/server_database_interface.h b/libcockatrice_network/libcockatrice/network/server/remote/server_database_interface.h similarity index 100% rename from common/server/server_database_interface.h rename to libcockatrice_network/libcockatrice/network/server/remote/server_database_interface.h diff --git a/common/server/server_player_reference.h b/libcockatrice_network/libcockatrice/network/server/remote/server_player_reference.h similarity index 100% rename from common/server/server_player_reference.h rename to libcockatrice_network/libcockatrice/network/server/remote/server_player_reference.h diff --git a/common/server/server_protocolhandler.cpp b/libcockatrice_network/libcockatrice/network/server/remote/server_protocolhandler.cpp similarity index 96% rename from common/server/server_protocolhandler.cpp rename to libcockatrice_network/libcockatrice/network/server/remote/server_protocolhandler.cpp index c06ee7624..92dcf4230 100644 --- a/common/server/server_protocolhandler.cpp +++ b/libcockatrice_network/libcockatrice/network/server/remote/server_protocolhandler.cpp @@ -1,25 +1,7 @@ #include "server_protocolhandler.h" -#include "../debug_pb_message.h" -#include "../featureset.h" -#include "../get_pb_extension.h" -#include "../trice_limits.h" #include "game/server_game.h" #include "game/server_player.h" -#include "pb/commands.pb.h" -#include "pb/event_game_joined.pb.h" -#include "pb/event_list_rooms.pb.h" -#include "pb/event_notify_user.pb.h" -#include "pb/event_room_say.pb.h" -#include "pb/event_server_message.pb.h" -#include "pb/event_user_message.pb.h" -#include "pb/response.pb.h" -#include "pb/response_get_games_of_user.pb.h" -#include "pb/response_get_user_info.pb.h" -#include "pb/response_join_room.pb.h" -#include "pb/response_list_users.pb.h" -#include "pb/response_login.pb.h" -#include "pb/serverinfo_user.pb.h" #include "server_database_interface.h" #include "server_room.h" @@ -27,6 +9,24 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include Server_ProtocolHandler::Server_ProtocolHandler(Server *_server, Server_DatabaseInterface *_databaseInterface, diff --git a/common/server/server_protocolhandler.h b/libcockatrice_network/libcockatrice/network/server/remote/server_protocolhandler.h similarity index 97% rename from common/server/server_protocolhandler.h rename to libcockatrice_network/libcockatrice/network/server/remote/server_protocolhandler.h index b80e08c7e..9f3b1f4e7 100644 --- a/common/server/server_protocolhandler.h +++ b/libcockatrice_network/libcockatrice/network/server/remote/server_protocolhandler.h @@ -1,13 +1,13 @@ #ifndef SERVER_PROTOCOLHANDLER_H #define SERVER_PROTOCOLHANDLER_H -#include "pb/response.pb.h" -#include "pb/server_message.pb.h" #include "server.h" #include "server_abstractuserinterface.h" #include #include +#include +#include class Features; class Server_DatabaseInterface; diff --git a/common/server/server_remoteuserinterface.cpp b/libcockatrice_network/libcockatrice/network/server/remote/server_remoteuserinterface.cpp similarity index 92% rename from common/server/server_remoteuserinterface.cpp rename to libcockatrice_network/libcockatrice/network/server/remote/server_remoteuserinterface.cpp index ec9b5d88a..54af5a265 100644 --- a/common/server/server_remoteuserinterface.cpp +++ b/libcockatrice_network/libcockatrice/network/server/remote/server_remoteuserinterface.cpp @@ -1,8 +1,9 @@ #include "server_remoteuserinterface.h" -#include "pb/serverinfo_user.pb.h" #include "server.h" +#include + void Server_RemoteUserInterface::sendProtocolItem(const Response &item) { server->sendIsl_Response(item, userInfo->server_id(), userInfo->session_id()); diff --git a/common/server/server_remoteuserinterface.h b/libcockatrice_network/libcockatrice/network/server/remote/server_remoteuserinterface.h similarity index 100% rename from common/server/server_remoteuserinterface.h rename to libcockatrice_network/libcockatrice/network/server/remote/server_remoteuserinterface.h diff --git a/common/server/server_response_containers.cpp b/libcockatrice_network/libcockatrice/network/server/remote/server_response_containers.cpp similarity index 100% rename from common/server/server_response_containers.cpp rename to libcockatrice_network/libcockatrice/network/server/remote/server_response_containers.cpp diff --git a/common/server/server_response_containers.h b/libcockatrice_network/libcockatrice/network/server/remote/server_response_containers.h similarity index 98% rename from common/server/server_response_containers.h rename to libcockatrice_network/libcockatrice/network/server/remote/server_response_containers.h index 31e00c54e..e533d6692 100644 --- a/common/server/server_response_containers.h +++ b/libcockatrice_network/libcockatrice/network/server/remote/server_response_containers.h @@ -1,10 +1,9 @@ #ifndef SERVER_RESPONSE_CONTAINERS_H #define SERVER_RESPONSE_CONTAINERS_H -#include "pb/server_message.pb.h" - #include #include +#include namespace google { diff --git a/common/server/server_room.cpp b/libcockatrice_network/libcockatrice/network/server/remote/server_room.cpp similarity index 96% rename from common/server/server_room.cpp rename to libcockatrice_network/libcockatrice/network/server/remote/server_room.cpp index badb37642..e94b255bd 100644 --- a/common/server/server_room.cpp +++ b/libcockatrice_network/libcockatrice/network/server/remote/server_room.cpp @@ -1,21 +1,21 @@ #include "server_room.h" -#include "../trice_limits.h" #include "game/server_game.h" -#include "pb/commands.pb.h" -#include "pb/event_join_room.pb.h" -#include "pb/event_leave_room.pb.h" -#include "pb/event_list_games.pb.h" -#include "pb/event_remove_messages.pb.h" -#include "pb/event_room_say.pb.h" -#include "pb/room_commands.pb.h" -#include "pb/serverinfo_chat_message.pb.h" -#include "pb/serverinfo_room.pb.h" #include "server_protocolhandler.h" #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include Server_Room::Server_Room(int _id, int _chatHistorySize, diff --git a/common/server/server_room.h b/libcockatrice_network/libcockatrice/network/server/remote/server_room.h similarity index 96% rename from common/server/server_room.h rename to libcockatrice_network/libcockatrice/network/server/remote/server_room.h index 7e256dc15..34b9063e9 100644 --- a/common/server/server_room.h +++ b/libcockatrice_network/libcockatrice/network/server/remote/server_room.h @@ -1,9 +1,7 @@ #ifndef SERVER_ROOM_H #define SERVER_ROOM_H -#include "../serverinfo_user_container.h" -#include "pb/response.pb.h" -#include "pb/serverinfo_chat_message.pb.h" +#include "serverinfo_user_container.h" #include #include @@ -11,6 +9,8 @@ #include #include #include +#include +#include class Server_DatabaseInterface; class Server_ProtocolHandler; diff --git a/common/serverinfo_user_container.cpp b/libcockatrice_network/libcockatrice/network/server/remote/serverinfo_user_container.cpp similarity index 96% rename from common/serverinfo_user_container.cpp rename to libcockatrice_network/libcockatrice/network/server/remote/serverinfo_user_container.cpp index 597ebd01a..77ff38906 100644 --- a/common/serverinfo_user_container.cpp +++ b/libcockatrice_network/libcockatrice/network/server/remote/serverinfo_user_container.cpp @@ -1,6 +1,6 @@ #include "serverinfo_user_container.h" -#include "pb/serverinfo_user.pb.h" +#include ServerInfo_User_Container::ServerInfo_User_Container(ServerInfo_User *_userInfo) : userInfo(_userInfo) { diff --git a/common/serverinfo_user_container.h b/libcockatrice_network/libcockatrice/network/server/remote/serverinfo_user_container.h similarity index 100% rename from common/serverinfo_user_container.h rename to libcockatrice_network/libcockatrice/network/server/remote/serverinfo_user_container.h diff --git a/common/user_level.h b/libcockatrice_network/libcockatrice/network/server/remote/user_level.h similarity index 85% rename from common/user_level.h rename to libcockatrice_network/libcockatrice/network/server/remote/user_level.h index 5d720c0aa..9b7a0ca88 100644 --- a/common/user_level.h +++ b/libcockatrice_network/libcockatrice/network/server/remote/user_level.h @@ -6,9 +6,8 @@ // https://github.com/protocolbuffers/protobuf/issues/119 #undef TYPE_BOOL #endif -#include "pb/serverinfo_user.pb.h" - #include +#include Q_DECLARE_FLAGS(UserLevelFlags, ServerInfo_User::UserLevelFlag) Q_DECLARE_OPERATORS_FOR_FLAGS(UserLevelFlags) diff --git a/libcockatrice_protocol/CMakeLists.txt b/libcockatrice_protocol/CMakeLists.txt new file mode 100644 index 000000000..64f1ee270 --- /dev/null +++ b/libcockatrice_protocol/CMakeLists.txt @@ -0,0 +1,28 @@ +# Top-level wrapper for the protobuf library + +add_subdirectory(libcockatrice/protocol/pb) + +add_library(libcockatrice_protocol STATIC) + +set(SOURCES libcockatrice/protocol/debug_pb_message.cpp libcockatrice/protocol/featureset.cpp + libcockatrice/protocol/get_pb_extension.cpp libcockatrice/protocol/pending_command.cpp +) + +set(HEADERS libcockatrice/protocol/debug_pb_message.h libcockatrice/protocol/featureset.h + libcockatrice/protocol/get_pb_extension.h libcockatrice/protocol/pending_command.h +) + +target_sources(libcockatrice_protocol PRIVATE ${SOURCES} ${HEADERS}) + +add_dependencies(libcockatrice_protocol libcockatrice_protocol_pb) + +# Link the actual generated protobuf library +target_link_libraries( + libcockatrice_protocol PUBLIC ${COCKATRICE_QT_MODULES} libcockatrice_protocol_pb libcockatrice_utility +) + +# Expose include paths +target_include_directories( + libcockatrice_protocol PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} # points to the generated headers +) diff --git a/common/debug_pb_message.cpp b/libcockatrice_protocol/libcockatrice/protocol/debug_pb_message.cpp similarity index 98% rename from common/debug_pb_message.cpp rename to libcockatrice_protocol/libcockatrice/protocol/debug_pb_message.cpp index dda672689..f0c3448b5 100644 --- a/common/debug_pb_message.cpp +++ b/libcockatrice_protocol/libcockatrice/protocol/debug_pb_message.cpp @@ -1,12 +1,11 @@ #include "debug_pb_message.h" -#include "trice_limits.h" - #include #include #include #include #include +#include // FastFieldValuePrinter is added in protobuf 3.4, going out of our way to add the old FieldValuePrinter is not worth it #if GOOGLE_PROTOBUF_VERSION > 3004000 diff --git a/common/debug_pb_message.h b/libcockatrice_protocol/libcockatrice/protocol/debug_pb_message.h similarity index 100% rename from common/debug_pb_message.h rename to libcockatrice_protocol/libcockatrice/protocol/debug_pb_message.h diff --git a/common/featureset.cpp b/libcockatrice_protocol/libcockatrice/protocol/featureset.cpp similarity index 100% rename from common/featureset.cpp rename to libcockatrice_protocol/libcockatrice/protocol/featureset.cpp diff --git a/common/featureset.h b/libcockatrice_protocol/libcockatrice/protocol/featureset.h similarity index 94% rename from common/featureset.h rename to libcockatrice_protocol/libcockatrice/protocol/featureset.h index da495c4b7..424d0b975 100644 --- a/common/featureset.h +++ b/libcockatrice_protocol/libcockatrice/protocol/featureset.h @@ -2,10 +2,11 @@ #define FEATURESET_H #include +#include #include #include -class FeatureSet +class FeatureSet : public QObject { public: FeatureSet(); diff --git a/common/get_pb_extension.cpp b/libcockatrice_protocol/libcockatrice/protocol/get_pb_extension.cpp similarity index 100% rename from common/get_pb_extension.cpp rename to libcockatrice_protocol/libcockatrice/protocol/get_pb_extension.cpp diff --git a/common/get_pb_extension.h b/libcockatrice_protocol/libcockatrice/protocol/get_pb_extension.h similarity index 100% rename from common/get_pb_extension.h rename to libcockatrice_protocol/libcockatrice/protocol/get_pb_extension.h diff --git a/common/pb/CMakeLists.txt b/libcockatrice_protocol/libcockatrice/protocol/pb/CMakeLists.txt similarity index 90% rename from common/pb/CMakeLists.txt rename to libcockatrice_protocol/libcockatrice/protocol/pb/CMakeLists.txt index dc48823fd..32e7f3238 100644 --- a/common/pb/CMakeLists.txt +++ b/libcockatrice_protocol/libcockatrice/protocol/pb/CMakeLists.txt @@ -171,12 +171,12 @@ if(${Protobuf_VERSION} VERSION_LESS "3.21.0.0") include_directories(${CMAKE_CURRENT_BINARY_DIR}) protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${PROTO_FILES}) - add_library(cockatrice_protocol ${PROTO_SRCS} ${PROTO_HDRS}) - set(cockatrice_protocol_LIBS ${PROTOBUF_LIBRARIES}) + add_library(libcockatrice_protocol_pb ${PROTO_SRCS} ${PROTO_HDRS}) + set(libcockatrice_protocol_pb_LIBS ${PROTOBUF_LIBRARIES}) if(UNIX) - set(cockatrice_protocol_LIBS ${cockatrice_protocol_LIBS} -lpthread) + set(libcockatrice_protocol_pb_LIBS ${libcockatrice_protocol_pb_LIBS} -lpthread) endif(UNIX) - target_link_libraries(cockatrice_protocol ${cockatrice_protocol_LIBS}) + target_link_libraries(libcockatrice_protocol_pb ${libcockatrice_protocol_pb_LIBS}) # ubuntu uses an outdated package for protobuf, 3.1.0 is required if(${Protobuf_VERSION} VERSION_LESS "3.1.0") @@ -188,12 +188,10 @@ if(${Protobuf_VERSION} VERSION_LESS "3.21.0.0") ) endif() else() - add_library(cockatrice_protocol ${PROTO_FILES}) - target_link_libraries(cockatrice_protocol PUBLIC protobuf::libprotobuf) + add_library(libcockatrice_protocol_pb ${PROTO_FILES}) + target_link_libraries(libcockatrice_protocol_pb PUBLIC protobuf::libprotobuf) set(PROTO_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}") - target_include_directories(cockatrice_protocol PUBLIC "${PROTOBUF_INCLUDE_DIRS}") + target_include_directories(libcockatrice_protocol_pb PUBLIC "${PROTOBUF_INCLUDE_DIRS}") - protobuf_generate( - TARGET cockatrice_protocol IMPORT_DIRS "${CMAKE_CURRENT_LIST_DIR}" PROTOC_OUT_DIR "${PROTO_BINARY_DIR}" - ) + protobuf_generate(TARGET libcockatrice_protocol_pb IMPORT_DIRS "." PROTOC_OUT_DIR "${PROTO_BINARY_DIR}") endif() diff --git a/common/pb/admin_commands.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/admin_commands.proto similarity index 100% rename from common/pb/admin_commands.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/admin_commands.proto diff --git a/common/pb/card_attributes.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/card_attributes.proto similarity index 100% rename from common/pb/card_attributes.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/card_attributes.proto diff --git a/common/pb/color.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/color.proto similarity index 100% rename from common/pb/color.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/color.proto diff --git a/common/pb/command_attach_card.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_attach_card.proto similarity index 100% rename from common/pb/command_attach_card.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_attach_card.proto diff --git a/common/pb/command_change_zone_properties.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_change_zone_properties.proto similarity index 100% rename from common/pb/command_change_zone_properties.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_change_zone_properties.proto diff --git a/common/pb/command_concede.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_concede.proto similarity index 100% rename from common/pb/command_concede.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_concede.proto diff --git a/common/pb/command_create_arrow.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_create_arrow.proto similarity index 100% rename from common/pb/command_create_arrow.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_create_arrow.proto diff --git a/common/pb/command_create_counter.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_create_counter.proto similarity index 100% rename from common/pb/command_create_counter.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_create_counter.proto diff --git a/common/pb/command_create_token.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_create_token.proto similarity index 100% rename from common/pb/command_create_token.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_create_token.proto diff --git a/common/pb/command_deck_del.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_deck_del.proto similarity index 100% rename from common/pb/command_deck_del.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_deck_del.proto diff --git a/common/pb/command_deck_del_dir.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_deck_del_dir.proto similarity index 100% rename from common/pb/command_deck_del_dir.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_deck_del_dir.proto diff --git a/common/pb/command_deck_download.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_deck_download.proto similarity index 100% rename from common/pb/command_deck_download.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_deck_download.proto diff --git a/common/pb/command_deck_list.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_deck_list.proto similarity index 100% rename from common/pb/command_deck_list.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_deck_list.proto diff --git a/common/pb/command_deck_new_dir.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_deck_new_dir.proto similarity index 100% rename from common/pb/command_deck_new_dir.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_deck_new_dir.proto diff --git a/common/pb/command_deck_select.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_deck_select.proto similarity index 100% rename from common/pb/command_deck_select.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_deck_select.proto diff --git a/common/pb/command_deck_upload.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_deck_upload.proto similarity index 100% rename from common/pb/command_deck_upload.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_deck_upload.proto diff --git a/common/pb/command_del_counter.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_del_counter.proto similarity index 100% rename from common/pb/command_del_counter.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_del_counter.proto diff --git a/common/pb/command_delete_arrow.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_delete_arrow.proto similarity index 100% rename from common/pb/command_delete_arrow.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_delete_arrow.proto diff --git a/common/pb/command_draw_cards.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_draw_cards.proto similarity index 100% rename from common/pb/command_draw_cards.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_draw_cards.proto diff --git a/common/pb/command_dump_zone.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_dump_zone.proto similarity index 100% rename from common/pb/command_dump_zone.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_dump_zone.proto diff --git a/common/pb/command_flip_card.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_flip_card.proto similarity index 100% rename from common/pb/command_flip_card.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_flip_card.proto diff --git a/common/pb/command_game_say.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_game_say.proto similarity index 100% rename from common/pb/command_game_say.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_game_say.proto diff --git a/common/pb/command_inc_card_counter.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_inc_card_counter.proto similarity index 100% rename from common/pb/command_inc_card_counter.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_inc_card_counter.proto diff --git a/common/pb/command_inc_counter.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_inc_counter.proto similarity index 100% rename from common/pb/command_inc_counter.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_inc_counter.proto diff --git a/common/pb/command_kick_from_game.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_kick_from_game.proto similarity index 100% rename from common/pb/command_kick_from_game.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_kick_from_game.proto diff --git a/common/pb/command_leave_game.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_leave_game.proto similarity index 100% rename from common/pb/command_leave_game.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_leave_game.proto diff --git a/common/pb/command_move_card.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_move_card.proto similarity index 100% rename from common/pb/command_move_card.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_move_card.proto diff --git a/common/pb/command_mulligan.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_mulligan.proto similarity index 100% rename from common/pb/command_mulligan.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_mulligan.proto diff --git a/common/pb/command_next_turn.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_next_turn.proto similarity index 100% rename from common/pb/command_next_turn.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_next_turn.proto diff --git a/common/pb/command_ready_start.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_ready_start.proto similarity index 100% rename from common/pb/command_ready_start.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_ready_start.proto diff --git a/common/pb/command_replay_delete_match.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_replay_delete_match.proto similarity index 100% rename from common/pb/command_replay_delete_match.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_replay_delete_match.proto diff --git a/common/pb/command_replay_download.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_replay_download.proto similarity index 100% rename from common/pb/command_replay_download.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_replay_download.proto diff --git a/common/pb/command_replay_get_code.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_replay_get_code.proto similarity index 100% rename from common/pb/command_replay_get_code.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_replay_get_code.proto diff --git a/common/pb/command_replay_list.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_replay_list.proto similarity index 100% rename from common/pb/command_replay_list.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_replay_list.proto diff --git a/common/pb/command_replay_modify_match.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_replay_modify_match.proto similarity index 100% rename from common/pb/command_replay_modify_match.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_replay_modify_match.proto diff --git a/common/pb/command_replay_submit_code.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_replay_submit_code.proto similarity index 100% rename from common/pb/command_replay_submit_code.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_replay_submit_code.proto diff --git a/common/pb/command_reveal_cards.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_reveal_cards.proto similarity index 100% rename from common/pb/command_reveal_cards.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_reveal_cards.proto diff --git a/common/pb/command_reverse_turn.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_reverse_turn.proto similarity index 100% rename from common/pb/command_reverse_turn.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_reverse_turn.proto diff --git a/common/pb/command_roll_die.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_roll_die.proto similarity index 100% rename from common/pb/command_roll_die.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_roll_die.proto diff --git a/common/pb/command_set_active_phase.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_set_active_phase.proto similarity index 100% rename from common/pb/command_set_active_phase.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_set_active_phase.proto diff --git a/common/pb/command_set_card_attr.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_set_card_attr.proto similarity index 100% rename from common/pb/command_set_card_attr.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_set_card_attr.proto diff --git a/common/pb/command_set_card_counter.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_set_card_counter.proto similarity index 100% rename from common/pb/command_set_card_counter.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_set_card_counter.proto diff --git a/common/pb/command_set_counter.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_set_counter.proto similarity index 100% rename from common/pb/command_set_counter.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_set_counter.proto diff --git a/common/pb/command_set_sideboard_lock.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_set_sideboard_lock.proto similarity index 100% rename from common/pb/command_set_sideboard_lock.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_set_sideboard_lock.proto diff --git a/common/pb/command_set_sideboard_plan.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_set_sideboard_plan.proto similarity index 100% rename from common/pb/command_set_sideboard_plan.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_set_sideboard_plan.proto diff --git a/common/pb/command_shuffle.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_shuffle.proto similarity index 100% rename from common/pb/command_shuffle.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_shuffle.proto diff --git a/common/pb/command_undo_draw.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/command_undo_draw.proto similarity index 100% rename from common/pb/command_undo_draw.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/command_undo_draw.proto diff --git a/common/pb/commands.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/commands.proto similarity index 100% rename from common/pb/commands.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/commands.proto diff --git a/common/pb/context_concede.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/context_concede.proto similarity index 100% rename from common/pb/context_concede.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/context_concede.proto diff --git a/common/pb/context_connection_state_changed.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/context_connection_state_changed.proto similarity index 100% rename from common/pb/context_connection_state_changed.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/context_connection_state_changed.proto diff --git a/common/pb/context_deck_select.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/context_deck_select.proto similarity index 100% rename from common/pb/context_deck_select.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/context_deck_select.proto diff --git a/common/pb/context_move_card.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/context_move_card.proto similarity index 100% rename from common/pb/context_move_card.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/context_move_card.proto diff --git a/common/pb/context_mulligan.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/context_mulligan.proto similarity index 100% rename from common/pb/context_mulligan.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/context_mulligan.proto diff --git a/common/pb/context_ping_changed.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/context_ping_changed.proto similarity index 100% rename from common/pb/context_ping_changed.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/context_ping_changed.proto diff --git a/common/pb/context_ready_start.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/context_ready_start.proto similarity index 100% rename from common/pb/context_ready_start.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/context_ready_start.proto diff --git a/common/pb/context_set_sideboard_lock.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/context_set_sideboard_lock.proto similarity index 100% rename from common/pb/context_set_sideboard_lock.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/context_set_sideboard_lock.proto diff --git a/common/pb/context_undo_draw.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/context_undo_draw.proto similarity index 100% rename from common/pb/context_undo_draw.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/context_undo_draw.proto diff --git a/common/pb/event_add_to_list.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_add_to_list.proto similarity index 100% rename from common/pb/event_add_to_list.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_add_to_list.proto diff --git a/common/pb/event_attach_card.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_attach_card.proto similarity index 100% rename from common/pb/event_attach_card.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_attach_card.proto diff --git a/common/pb/event_change_zone_properties.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_change_zone_properties.proto similarity index 100% rename from common/pb/event_change_zone_properties.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_change_zone_properties.proto diff --git a/common/pb/event_connection_closed.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_connection_closed.proto similarity index 100% rename from common/pb/event_connection_closed.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_connection_closed.proto diff --git a/common/pb/event_create_arrow.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_create_arrow.proto similarity index 100% rename from common/pb/event_create_arrow.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_create_arrow.proto diff --git a/common/pb/event_create_counter.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_create_counter.proto similarity index 100% rename from common/pb/event_create_counter.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_create_counter.proto diff --git a/common/pb/event_create_token.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_create_token.proto similarity index 100% rename from common/pb/event_create_token.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_create_token.proto diff --git a/common/pb/event_del_counter.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_del_counter.proto similarity index 100% rename from common/pb/event_del_counter.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_del_counter.proto diff --git a/common/pb/event_delete_arrow.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_delete_arrow.proto similarity index 100% rename from common/pb/event_delete_arrow.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_delete_arrow.proto diff --git a/common/pb/event_destroy_card.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_destroy_card.proto similarity index 100% rename from common/pb/event_destroy_card.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_destroy_card.proto diff --git a/common/pb/event_draw_cards.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_draw_cards.proto similarity index 100% rename from common/pb/event_draw_cards.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_draw_cards.proto diff --git a/common/pb/event_dump_zone.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_dump_zone.proto similarity index 100% rename from common/pb/event_dump_zone.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_dump_zone.proto diff --git a/common/pb/event_flip_card.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_flip_card.proto similarity index 100% rename from common/pb/event_flip_card.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_flip_card.proto diff --git a/common/pb/event_game_closed.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_game_closed.proto similarity index 100% rename from common/pb/event_game_closed.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_game_closed.proto diff --git a/common/pb/event_game_host_changed.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_game_host_changed.proto similarity index 100% rename from common/pb/event_game_host_changed.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_game_host_changed.proto diff --git a/common/pb/event_game_joined.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_game_joined.proto similarity index 100% rename from common/pb/event_game_joined.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_game_joined.proto diff --git a/common/pb/event_game_say.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_game_say.proto similarity index 100% rename from common/pb/event_game_say.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_game_say.proto diff --git a/common/pb/event_game_state_changed.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_game_state_changed.proto similarity index 100% rename from common/pb/event_game_state_changed.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_game_state_changed.proto diff --git a/common/pb/event_join.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_join.proto similarity index 100% rename from common/pb/event_join.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_join.proto diff --git a/common/pb/event_join_room.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_join_room.proto similarity index 100% rename from common/pb/event_join_room.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_join_room.proto diff --git a/common/pb/event_kicked.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_kicked.proto similarity index 100% rename from common/pb/event_kicked.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_kicked.proto diff --git a/common/pb/event_leave.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_leave.proto similarity index 100% rename from common/pb/event_leave.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_leave.proto diff --git a/common/pb/event_leave_room.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_leave_room.proto similarity index 100% rename from common/pb/event_leave_room.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_leave_room.proto diff --git a/common/pb/event_list_games.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_list_games.proto similarity index 100% rename from common/pb/event_list_games.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_list_games.proto diff --git a/common/pb/event_list_rooms.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_list_rooms.proto similarity index 100% rename from common/pb/event_list_rooms.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_list_rooms.proto diff --git a/common/pb/event_move_card.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_move_card.proto similarity index 100% rename from common/pb/event_move_card.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_move_card.proto diff --git a/common/pb/event_notify_user.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_notify_user.proto similarity index 100% rename from common/pb/event_notify_user.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_notify_user.proto diff --git a/common/pb/event_player_properties_changed.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_player_properties_changed.proto similarity index 100% rename from common/pb/event_player_properties_changed.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_player_properties_changed.proto diff --git a/common/pb/event_remove_from_list.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_remove_from_list.proto similarity index 100% rename from common/pb/event_remove_from_list.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_remove_from_list.proto diff --git a/common/pb/event_remove_messages.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_remove_messages.proto similarity index 100% rename from common/pb/event_remove_messages.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_remove_messages.proto diff --git a/common/pb/event_replay_added.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_replay_added.proto similarity index 100% rename from common/pb/event_replay_added.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_replay_added.proto diff --git a/common/pb/event_reveal_cards.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_reveal_cards.proto similarity index 100% rename from common/pb/event_reveal_cards.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_reveal_cards.proto diff --git a/common/pb/event_reverse_turn.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_reverse_turn.proto similarity index 100% rename from common/pb/event_reverse_turn.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_reverse_turn.proto diff --git a/common/pb/event_roll_die.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_roll_die.proto similarity index 100% rename from common/pb/event_roll_die.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_roll_die.proto diff --git a/common/pb/event_room_say.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_room_say.proto similarity index 100% rename from common/pb/event_room_say.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_room_say.proto diff --git a/common/pb/event_server_complete_list.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_server_complete_list.proto similarity index 100% rename from common/pb/event_server_complete_list.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_server_complete_list.proto diff --git a/common/pb/event_server_identification.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_server_identification.proto similarity index 100% rename from common/pb/event_server_identification.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_server_identification.proto diff --git a/common/pb/event_server_message.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_server_message.proto similarity index 100% rename from common/pb/event_server_message.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_server_message.proto diff --git a/common/pb/event_server_shutdown.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_server_shutdown.proto similarity index 100% rename from common/pb/event_server_shutdown.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_server_shutdown.proto diff --git a/common/pb/event_set_active_phase.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_set_active_phase.proto similarity index 100% rename from common/pb/event_set_active_phase.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_set_active_phase.proto diff --git a/common/pb/event_set_active_player.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_set_active_player.proto similarity index 100% rename from common/pb/event_set_active_player.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_set_active_player.proto diff --git a/common/pb/event_set_card_attr.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_set_card_attr.proto similarity index 100% rename from common/pb/event_set_card_attr.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_set_card_attr.proto diff --git a/common/pb/event_set_card_counter.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_set_card_counter.proto similarity index 100% rename from common/pb/event_set_card_counter.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_set_card_counter.proto diff --git a/common/pb/event_set_counter.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_set_counter.proto similarity index 100% rename from common/pb/event_set_counter.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_set_counter.proto diff --git a/common/pb/event_shuffle.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_shuffle.proto similarity index 100% rename from common/pb/event_shuffle.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_shuffle.proto diff --git a/common/pb/event_user_joined.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_user_joined.proto similarity index 100% rename from common/pb/event_user_joined.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_user_joined.proto diff --git a/common/pb/event_user_left.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_user_left.proto similarity index 100% rename from common/pb/event_user_left.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_user_left.proto diff --git a/common/pb/event_user_message.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/event_user_message.proto similarity index 100% rename from common/pb/event_user_message.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/event_user_message.proto diff --git a/common/pb/game_commands.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/game_commands.proto similarity index 100% rename from common/pb/game_commands.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/game_commands.proto diff --git a/common/pb/game_event.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/game_event.proto similarity index 100% rename from common/pb/game_event.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/game_event.proto diff --git a/common/pb/game_event_container.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/game_event_container.proto similarity index 100% rename from common/pb/game_event_container.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/game_event_container.proto diff --git a/common/pb/game_event_context.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/game_event_context.proto similarity index 100% rename from common/pb/game_event_context.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/game_event_context.proto diff --git a/common/pb/game_replay.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/game_replay.proto similarity index 100% rename from common/pb/game_replay.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/game_replay.proto diff --git a/common/pb/isl_message.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/isl_message.proto similarity index 100% rename from common/pb/isl_message.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/isl_message.proto diff --git a/common/pb/moderator_commands.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/moderator_commands.proto similarity index 100% rename from common/pb/moderator_commands.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/moderator_commands.proto diff --git a/common/pb/move_card_to_zone.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/move_card_to_zone.proto similarity index 100% rename from common/pb/move_card_to_zone.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/move_card_to_zone.proto diff --git a/common/pb/response.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/response.proto similarity index 100% rename from common/pb/response.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/response.proto diff --git a/common/pb/response_activate.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/response_activate.proto similarity index 100% rename from common/pb/response_activate.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/response_activate.proto diff --git a/common/pb/response_adjust_mod.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/response_adjust_mod.proto similarity index 100% rename from common/pb/response_adjust_mod.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/response_adjust_mod.proto diff --git a/common/pb/response_ban_history.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/response_ban_history.proto similarity index 100% rename from common/pb/response_ban_history.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/response_ban_history.proto diff --git a/common/pb/response_deck_download.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/response_deck_download.proto similarity index 100% rename from common/pb/response_deck_download.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/response_deck_download.proto diff --git a/common/pb/response_deck_list.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/response_deck_list.proto similarity index 100% rename from common/pb/response_deck_list.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/response_deck_list.proto diff --git a/common/pb/response_deck_upload.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/response_deck_upload.proto similarity index 100% rename from common/pb/response_deck_upload.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/response_deck_upload.proto diff --git a/common/pb/response_dump_zone.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/response_dump_zone.proto similarity index 100% rename from common/pb/response_dump_zone.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/response_dump_zone.proto diff --git a/common/pb/response_forgotpasswordrequest.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/response_forgotpasswordrequest.proto similarity index 100% rename from common/pb/response_forgotpasswordrequest.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/response_forgotpasswordrequest.proto diff --git a/common/pb/response_get_admin_notes.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/response_get_admin_notes.proto similarity index 100% rename from common/pb/response_get_admin_notes.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/response_get_admin_notes.proto diff --git a/common/pb/response_get_games_of_user.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/response_get_games_of_user.proto similarity index 100% rename from common/pb/response_get_games_of_user.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/response_get_games_of_user.proto diff --git a/common/pb/response_get_user_info.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/response_get_user_info.proto similarity index 100% rename from common/pb/response_get_user_info.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/response_get_user_info.proto diff --git a/common/pb/response_join_room.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/response_join_room.proto similarity index 100% rename from common/pb/response_join_room.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/response_join_room.proto diff --git a/common/pb/response_list_users.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/response_list_users.proto similarity index 100% rename from common/pb/response_list_users.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/response_list_users.proto diff --git a/common/pb/response_login.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/response_login.proto similarity index 100% rename from common/pb/response_login.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/response_login.proto diff --git a/common/pb/response_password_salt.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/response_password_salt.proto similarity index 100% rename from common/pb/response_password_salt.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/response_password_salt.proto diff --git a/common/pb/response_register.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/response_register.proto similarity index 100% rename from common/pb/response_register.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/response_register.proto diff --git a/common/pb/response_replay_download.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/response_replay_download.proto similarity index 100% rename from common/pb/response_replay_download.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/response_replay_download.proto diff --git a/common/pb/response_replay_get_code.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/response_replay_get_code.proto similarity index 100% rename from common/pb/response_replay_get_code.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/response_replay_get_code.proto diff --git a/common/pb/response_replay_list.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/response_replay_list.proto similarity index 100% rename from common/pb/response_replay_list.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/response_replay_list.proto diff --git a/common/pb/response_viewlog_history.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/response_viewlog_history.proto similarity index 100% rename from common/pb/response_viewlog_history.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/response_viewlog_history.proto diff --git a/common/pb/response_warn_history.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/response_warn_history.proto similarity index 100% rename from common/pb/response_warn_history.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/response_warn_history.proto diff --git a/common/pb/response_warn_list.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/response_warn_list.proto similarity index 100% rename from common/pb/response_warn_list.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/response_warn_list.proto diff --git a/common/pb/room_commands.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/room_commands.proto similarity index 100% rename from common/pb/room_commands.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/room_commands.proto diff --git a/common/pb/room_event.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/room_event.proto similarity index 100% rename from common/pb/room_event.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/room_event.proto diff --git a/common/pb/server_message.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/server_message.proto similarity index 100% rename from common/pb/server_message.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/server_message.proto diff --git a/common/pb/serverinfo_arrow.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/serverinfo_arrow.proto similarity index 100% rename from common/pb/serverinfo_arrow.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/serverinfo_arrow.proto diff --git a/common/pb/serverinfo_ban.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/serverinfo_ban.proto similarity index 100% rename from common/pb/serverinfo_ban.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/serverinfo_ban.proto diff --git a/common/pb/serverinfo_card.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/serverinfo_card.proto similarity index 100% rename from common/pb/serverinfo_card.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/serverinfo_card.proto diff --git a/common/pb/serverinfo_cardcounter.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/serverinfo_cardcounter.proto similarity index 100% rename from common/pb/serverinfo_cardcounter.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/serverinfo_cardcounter.proto diff --git a/common/pb/serverinfo_chat_message.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/serverinfo_chat_message.proto similarity index 100% rename from common/pb/serverinfo_chat_message.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/serverinfo_chat_message.proto diff --git a/common/pb/serverinfo_counter.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/serverinfo_counter.proto similarity index 100% rename from common/pb/serverinfo_counter.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/serverinfo_counter.proto diff --git a/common/pb/serverinfo_deckstorage.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/serverinfo_deckstorage.proto similarity index 100% rename from common/pb/serverinfo_deckstorage.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/serverinfo_deckstorage.proto diff --git a/common/pb/serverinfo_game.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/serverinfo_game.proto similarity index 100% rename from common/pb/serverinfo_game.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/serverinfo_game.proto diff --git a/common/pb/serverinfo_gametype.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/serverinfo_gametype.proto similarity index 100% rename from common/pb/serverinfo_gametype.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/serverinfo_gametype.proto diff --git a/common/pb/serverinfo_player.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/serverinfo_player.proto similarity index 100% rename from common/pb/serverinfo_player.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/serverinfo_player.proto diff --git a/common/pb/serverinfo_playerping.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/serverinfo_playerping.proto similarity index 100% rename from common/pb/serverinfo_playerping.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/serverinfo_playerping.proto diff --git a/common/pb/serverinfo_playerproperties.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/serverinfo_playerproperties.proto similarity index 100% rename from common/pb/serverinfo_playerproperties.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/serverinfo_playerproperties.proto diff --git a/common/pb/serverinfo_replay.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/serverinfo_replay.proto similarity index 100% rename from common/pb/serverinfo_replay.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/serverinfo_replay.proto diff --git a/common/pb/serverinfo_replay_match.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/serverinfo_replay_match.proto similarity index 100% rename from common/pb/serverinfo_replay_match.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/serverinfo_replay_match.proto diff --git a/common/pb/serverinfo_room.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/serverinfo_room.proto similarity index 100% rename from common/pb/serverinfo_room.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/serverinfo_room.proto diff --git a/common/pb/serverinfo_user.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/serverinfo_user.proto similarity index 100% rename from common/pb/serverinfo_user.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/serverinfo_user.proto diff --git a/common/pb/serverinfo_warning.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/serverinfo_warning.proto similarity index 100% rename from common/pb/serverinfo_warning.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/serverinfo_warning.proto diff --git a/common/pb/serverinfo_zone.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/serverinfo_zone.proto similarity index 100% rename from common/pb/serverinfo_zone.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/serverinfo_zone.proto diff --git a/common/pb/session_commands.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/session_commands.proto similarity index 100% rename from common/pb/session_commands.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/session_commands.proto diff --git a/common/pb/session_event.proto b/libcockatrice_protocol/libcockatrice/protocol/pb/session_event.proto similarity index 100% rename from common/pb/session_event.proto rename to libcockatrice_protocol/libcockatrice/protocol/pb/session_event.proto diff --git a/cockatrice/src/server/pending_command.cpp b/libcockatrice_protocol/libcockatrice/protocol/pending_command.cpp similarity index 100% rename from cockatrice/src/server/pending_command.cpp rename to libcockatrice_protocol/libcockatrice/protocol/pending_command.cpp diff --git a/cockatrice/src/server/pending_command.h b/libcockatrice_protocol/libcockatrice/protocol/pending_command.h similarity index 88% rename from cockatrice/src/server/pending_command.h rename to libcockatrice_protocol/libcockatrice/protocol/pending_command.h index df452b10a..1d2d9ff17 100644 --- a/cockatrice/src/server/pending_command.h +++ b/libcockatrice_protocol/libcockatrice/protocol/pending_command.h @@ -7,10 +7,9 @@ #ifndef PENDING_COMMAND_H #define PENDING_COMMAND_H -#include "pb/commands.pb.h" -#include "pb/response.pb.h" - #include +#include +#include class PendingCommand : public QObject { diff --git a/libcockatrice_rng/CMakeLists.txt b/libcockatrice_rng/CMakeLists.txt new file mode 100644 index 000000000..0e29e96f2 --- /dev/null +++ b/libcockatrice_rng/CMakeLists.txt @@ -0,0 +1,20 @@ +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTORCC ON) + +set(HEADERS libcockatrice/rng/rng_abstract.h libcockatrice/rng/rng_sfmt.h libcockatrice/rng/sfmt/SFMT.h) + +if(Qt6_FOUND) + qt6_wrap_cpp(MOC_SOURCES ${HEADERS}) +elseif(Qt5_FOUND) + qt5_wrap_cpp(MOC_SOURCES ${HEADERS}) +endif() + +add_library( + libcockatrice_rng STATIC ${MOC_SOURCES} libcockatrice/rng/rng_abstract.cpp libcockatrice/rng/rng_sfmt.cpp + libcockatrice/rng/sfmt/SFMT.c +) + +target_include_directories(libcockatrice_rng PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) + +target_link_libraries(libcockatrice_rng PUBLIC ${COCKATRICE_QT_MODULES}) diff --git a/common/rng_abstract.cpp b/libcockatrice_rng/libcockatrice/rng/rng_abstract.cpp similarity index 100% rename from common/rng_abstract.cpp rename to libcockatrice_rng/libcockatrice/rng/rng_abstract.cpp diff --git a/common/rng_abstract.h b/libcockatrice_rng/libcockatrice/rng/rng_abstract.h similarity index 100% rename from common/rng_abstract.h rename to libcockatrice_rng/libcockatrice/rng/rng_abstract.h diff --git a/common/rng_sfmt.cpp b/libcockatrice_rng/libcockatrice/rng/rng_sfmt.cpp similarity index 100% rename from common/rng_sfmt.cpp rename to libcockatrice_rng/libcockatrice/rng/rng_sfmt.cpp diff --git a/common/rng_sfmt.h b/libcockatrice_rng/libcockatrice/rng/rng_sfmt.h similarity index 100% rename from common/rng_sfmt.h rename to libcockatrice_rng/libcockatrice/rng/rng_sfmt.h diff --git a/common/sfmt/LICENSE.txt b/libcockatrice_rng/libcockatrice/rng/sfmt/LICENSE.txt similarity index 100% rename from common/sfmt/LICENSE.txt rename to libcockatrice_rng/libcockatrice/rng/sfmt/LICENSE.txt diff --git a/common/sfmt/SFMT-common.h b/libcockatrice_rng/libcockatrice/rng/sfmt/SFMT-common.h similarity index 100% rename from common/sfmt/SFMT-common.h rename to libcockatrice_rng/libcockatrice/rng/sfmt/SFMT-common.h diff --git a/common/sfmt/SFMT-params.h b/libcockatrice_rng/libcockatrice/rng/sfmt/SFMT-params.h similarity index 100% rename from common/sfmt/SFMT-params.h rename to libcockatrice_rng/libcockatrice/rng/sfmt/SFMT-params.h diff --git a/common/sfmt/SFMT-params19937.h b/libcockatrice_rng/libcockatrice/rng/sfmt/SFMT-params19937.h similarity index 100% rename from common/sfmt/SFMT-params19937.h rename to libcockatrice_rng/libcockatrice/rng/sfmt/SFMT-params19937.h diff --git a/common/sfmt/SFMT.c b/libcockatrice_rng/libcockatrice/rng/sfmt/SFMT.c similarity index 100% rename from common/sfmt/SFMT.c rename to libcockatrice_rng/libcockatrice/rng/sfmt/SFMT.c diff --git a/common/sfmt/SFMT.h b/libcockatrice_rng/libcockatrice/rng/sfmt/SFMT.h similarity index 100% rename from common/sfmt/SFMT.h rename to libcockatrice_rng/libcockatrice/rng/sfmt/SFMT.h diff --git a/libcockatrice_settings/CMakeLists.txt b/libcockatrice_settings/CMakeLists.txt new file mode 100644 index 000000000..bacb397bf --- /dev/null +++ b/libcockatrice_settings/CMakeLists.txt @@ -0,0 +1,53 @@ +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTORCC ON) + +set(HEADERS + libcockatrice/settings/cache_settings.h + libcockatrice/settings/card_counter_settings.h + libcockatrice/settings/card_database_settings.h + libcockatrice/settings/card_override_settings.h + libcockatrice/settings/debug_settings.h + libcockatrice/settings/download_settings.h + libcockatrice/settings/game_filters_settings.h + libcockatrice/settings/layouts_settings.h + libcockatrice/settings/message_settings.h + libcockatrice/settings/recents_settings.h + libcockatrice/settings/servers_settings.h + libcockatrice/settings/settings_manager.h + libcockatrice/settings/shortcut_treeview.h + libcockatrice/settings/shortcuts_settings.h +) + +if(Qt6_FOUND) + qt6_wrap_cpp(MOC_SOURCES ${HEADERS}) +elseif(Qt5_FOUND) + qt5_wrap_cpp(MOC_SOURCES ${HEADERS}) +endif() + +add_library( + libcockatrice_settings STATIC + ${MOC_SOURCES} + libcockatrice/settings/cache_settings.cpp + libcockatrice/settings/card_counter_settings.cpp + libcockatrice/settings/card_database_settings.cpp + libcockatrice/settings/card_override_settings.cpp + libcockatrice/settings/debug_settings.cpp + libcockatrice/settings/download_settings.cpp + libcockatrice/settings/game_filters_settings.cpp + libcockatrice/settings/layouts_settings.cpp + libcockatrice/settings/message_settings.cpp + libcockatrice/settings/recents_settings.cpp + libcockatrice/settings/servers_settings.cpp + libcockatrice/settings/settings_manager.cpp + libcockatrice/settings/shortcut_treeview.cpp + libcockatrice/settings/shortcuts_settings.cpp +) + +target_include_directories( + libcockatrice_settings + PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} + PUBLIC ${CMAKE_SOURCE_DIR}/cockatrice/src/client/network +) + +target_link_libraries(libcockatrice_settings PUBLIC libcockatrice_utility ${COCKATRICE_QT_MODULES}) diff --git a/cockatrice/src/settings/cache_settings.cpp b/libcockatrice_settings/libcockatrice/settings/cache_settings.cpp similarity index 99% rename from cockatrice/src/settings/cache_settings.cpp rename to libcockatrice_settings/libcockatrice/settings/cache_settings.cpp index 942881958..f730877d1 100644 --- a/cockatrice/src/settings/cache_settings.cpp +++ b/libcockatrice_settings/libcockatrice/settings/cache_settings.cpp @@ -1,6 +1,6 @@ #include "cache_settings.h" -#include "../client/network/release_channel.h" +#include "../../../cockatrice/src/client/network/update/client/release_channel.h" #include "card_counter_settings.h" #include "card_override_settings.h" diff --git a/cockatrice/src/settings/cache_settings.h b/libcockatrice_settings/libcockatrice/settings/cache_settings.h similarity index 99% rename from cockatrice/src/settings/cache_settings.h rename to libcockatrice_settings/libcockatrice/settings/cache_settings.h index 93cd5a837..90eba0cb1 100644 --- a/cockatrice/src/settings/cache_settings.h +++ b/libcockatrice_settings/libcockatrice/settings/cache_settings.h @@ -7,7 +7,6 @@ #ifndef SETTINGSCACHE_H #define SETTINGSCACHE_H -#include "../utility/macros.h" #include "card_database_settings.h" #include "card_override_settings.h" #include "debug_settings.h" @@ -24,6 +23,7 @@ #include #include #include +#include inline Q_LOGGING_CATEGORY(SettingsCacheLog, "settings_cache"); diff --git a/cockatrice/src/settings/card_counter_settings.cpp b/libcockatrice_settings/libcockatrice/settings/card_counter_settings.cpp similarity index 100% rename from cockatrice/src/settings/card_counter_settings.cpp rename to libcockatrice_settings/libcockatrice/settings/card_counter_settings.cpp diff --git a/cockatrice/src/settings/card_counter_settings.h b/libcockatrice_settings/libcockatrice/settings/card_counter_settings.h similarity index 100% rename from cockatrice/src/settings/card_counter_settings.h rename to libcockatrice_settings/libcockatrice/settings/card_counter_settings.h diff --git a/cockatrice/src/settings/card_database_settings.cpp b/libcockatrice_settings/libcockatrice/settings/card_database_settings.cpp similarity index 100% rename from cockatrice/src/settings/card_database_settings.cpp rename to libcockatrice_settings/libcockatrice/settings/card_database_settings.cpp diff --git a/cockatrice/src/settings/card_database_settings.h b/libcockatrice_settings/libcockatrice/settings/card_database_settings.h similarity index 100% rename from cockatrice/src/settings/card_database_settings.h rename to libcockatrice_settings/libcockatrice/settings/card_database_settings.h diff --git a/cockatrice/src/settings/card_override_settings.cpp b/libcockatrice_settings/libcockatrice/settings/card_override_settings.cpp similarity index 100% rename from cockatrice/src/settings/card_override_settings.cpp rename to libcockatrice_settings/libcockatrice/settings/card_override_settings.cpp diff --git a/cockatrice/src/settings/card_override_settings.h b/libcockatrice_settings/libcockatrice/settings/card_override_settings.h similarity index 94% rename from cockatrice/src/settings/card_override_settings.h rename to libcockatrice_settings/libcockatrice/settings/card_override_settings.h index 90a1a1681..d5ee0287b 100644 --- a/cockatrice/src/settings/card_override_settings.h +++ b/libcockatrice_settings/libcockatrice/settings/card_override_settings.h @@ -7,10 +7,10 @@ #ifndef COCKATRICE_CARD_OVERRIDE_SETTINGS_H #define COCKATRICE_CARD_OVERRIDE_SETTINGS_H -#include "../common/card_ref.h" #include "settings_manager.h" #include +#include class CardOverrideSettings : public SettingsManager { diff --git a/cockatrice/src/settings/debug_settings.cpp b/libcockatrice_settings/libcockatrice/settings/debug_settings.cpp similarity index 100% rename from cockatrice/src/settings/debug_settings.cpp rename to libcockatrice_settings/libcockatrice/settings/debug_settings.cpp diff --git a/cockatrice/src/settings/debug_settings.h b/libcockatrice_settings/libcockatrice/settings/debug_settings.h similarity index 100% rename from cockatrice/src/settings/debug_settings.h rename to libcockatrice_settings/libcockatrice/settings/debug_settings.h diff --git a/cockatrice/src/settings/download_settings.cpp b/libcockatrice_settings/libcockatrice/settings/download_settings.cpp similarity index 100% rename from cockatrice/src/settings/download_settings.cpp rename to libcockatrice_settings/libcockatrice/settings/download_settings.cpp diff --git a/cockatrice/src/settings/download_settings.h b/libcockatrice_settings/libcockatrice/settings/download_settings.h similarity index 100% rename from cockatrice/src/settings/download_settings.h rename to libcockatrice_settings/libcockatrice/settings/download_settings.h diff --git a/cockatrice/src/settings/game_filters_settings.cpp b/libcockatrice_settings/libcockatrice/settings/game_filters_settings.cpp similarity index 100% rename from cockatrice/src/settings/game_filters_settings.cpp rename to libcockatrice_settings/libcockatrice/settings/game_filters_settings.cpp diff --git a/cockatrice/src/settings/game_filters_settings.h b/libcockatrice_settings/libcockatrice/settings/game_filters_settings.h similarity index 100% rename from cockatrice/src/settings/game_filters_settings.h rename to libcockatrice_settings/libcockatrice/settings/game_filters_settings.h diff --git a/cockatrice/src/settings/layouts_settings.cpp b/libcockatrice_settings/libcockatrice/settings/layouts_settings.cpp similarity index 100% rename from cockatrice/src/settings/layouts_settings.cpp rename to libcockatrice_settings/libcockatrice/settings/layouts_settings.cpp diff --git a/cockatrice/src/settings/layouts_settings.h b/libcockatrice_settings/libcockatrice/settings/layouts_settings.h similarity index 100% rename from cockatrice/src/settings/layouts_settings.h rename to libcockatrice_settings/libcockatrice/settings/layouts_settings.h diff --git a/cockatrice/src/settings/message_settings.cpp b/libcockatrice_settings/libcockatrice/settings/message_settings.cpp similarity index 100% rename from cockatrice/src/settings/message_settings.cpp rename to libcockatrice_settings/libcockatrice/settings/message_settings.cpp diff --git a/cockatrice/src/settings/message_settings.h b/libcockatrice_settings/libcockatrice/settings/message_settings.h similarity index 100% rename from cockatrice/src/settings/message_settings.h rename to libcockatrice_settings/libcockatrice/settings/message_settings.h diff --git a/cockatrice/src/settings/recents_settings.cpp b/libcockatrice_settings/libcockatrice/settings/recents_settings.cpp similarity index 100% rename from cockatrice/src/settings/recents_settings.cpp rename to libcockatrice_settings/libcockatrice/settings/recents_settings.cpp diff --git a/cockatrice/src/settings/recents_settings.h b/libcockatrice_settings/libcockatrice/settings/recents_settings.h similarity index 100% rename from cockatrice/src/settings/recents_settings.h rename to libcockatrice_settings/libcockatrice/settings/recents_settings.h diff --git a/cockatrice/src/settings/servers_settings.cpp b/libcockatrice_settings/libcockatrice/settings/servers_settings.cpp similarity index 100% rename from cockatrice/src/settings/servers_settings.cpp rename to libcockatrice_settings/libcockatrice/settings/servers_settings.cpp diff --git a/cockatrice/src/settings/servers_settings.h b/libcockatrice_settings/libcockatrice/settings/servers_settings.h similarity index 100% rename from cockatrice/src/settings/servers_settings.h rename to libcockatrice_settings/libcockatrice/settings/servers_settings.h diff --git a/cockatrice/src/settings/settings_manager.cpp b/libcockatrice_settings/libcockatrice/settings/settings_manager.cpp similarity index 100% rename from cockatrice/src/settings/settings_manager.cpp rename to libcockatrice_settings/libcockatrice/settings/settings_manager.cpp diff --git a/cockatrice/src/settings/settings_manager.h b/libcockatrice_settings/libcockatrice/settings/settings_manager.h similarity index 100% rename from cockatrice/src/settings/settings_manager.h rename to libcockatrice_settings/libcockatrice/settings/settings_manager.h diff --git a/cockatrice/src/settings/shortcut_treeview.cpp b/libcockatrice_settings/libcockatrice/settings/shortcut_treeview.cpp similarity index 100% rename from cockatrice/src/settings/shortcut_treeview.cpp rename to libcockatrice_settings/libcockatrice/settings/shortcut_treeview.cpp diff --git a/cockatrice/src/settings/shortcut_treeview.h b/libcockatrice_settings/libcockatrice/settings/shortcut_treeview.h similarity index 100% rename from cockatrice/src/settings/shortcut_treeview.h rename to libcockatrice_settings/libcockatrice/settings/shortcut_treeview.h diff --git a/cockatrice/src/settings/shortcuts_settings.cpp b/libcockatrice_settings/libcockatrice/settings/shortcuts_settings.cpp similarity index 100% rename from cockatrice/src/settings/shortcuts_settings.cpp rename to libcockatrice_settings/libcockatrice/settings/shortcuts_settings.cpp diff --git a/cockatrice/src/settings/shortcuts_settings.h b/libcockatrice_settings/libcockatrice/settings/shortcuts_settings.h similarity index 100% rename from cockatrice/src/settings/shortcuts_settings.h rename to libcockatrice_settings/libcockatrice/settings/shortcuts_settings.h diff --git a/libcockatrice_utility/CMakeLists.txt b/libcockatrice_utility/CMakeLists.txt new file mode 100644 index 000000000..f1e1d4a62 --- /dev/null +++ b/libcockatrice_utility/CMakeLists.txt @@ -0,0 +1,32 @@ +cmake_minimum_required(VERSION 3.16) +project(Utility VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}") + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTORCC ON) + +set(UTILITY_SOURCES + libcockatrice/utility/expression.cpp libcockatrice/utility/key_signals.cpp libcockatrice/utility/levenshtein.cpp + libcockatrice/utility/logger.cpp libcockatrice/utility/passwordhasher.cpp +) + +set(UTILITY_HEADERS + libcockatrice/utility/color.h + libcockatrice/utility/expression.h + libcockatrice/utility/key_signals.h + libcockatrice/utility/levenshtein.h + libcockatrice/utility/logger.h + libcockatrice/utility/macros.h + libcockatrice/utility/passwordhasher.h + libcockatrice/utility/trice_limits.h +) + +add_library(libcockatrice_utility STATIC ${UTILITY_SOURCES} ${UTILITY_HEADERS}) + +target_include_directories(libcockatrice_utility PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) + +target_link_libraries(libcockatrice_utility PUBLIC libcockatrice_rng ${COCKATRICE_QT_MODULES}) + +set(ORACLE_LIBS) + +include_directories(${${COCKATRICE_QT_VERSION_NAME}Core_INCLUDE_DIRS}) diff --git a/common/card_ref.h b/libcockatrice_utility/libcockatrice/utility/card_ref.h similarity index 100% rename from common/card_ref.h rename to libcockatrice_utility/libcockatrice/utility/card_ref.h diff --git a/common/color.h b/libcockatrice_utility/libcockatrice/utility/color.h similarity index 91% rename from common/color.h rename to libcockatrice_utility/libcockatrice/utility/color.h index 1ea3e33df..164c6ffd7 100644 --- a/common/color.h +++ b/libcockatrice_utility/libcockatrice/utility/color.h @@ -5,7 +5,7 @@ #include #endif -#include "pb/color.pb.h" +#include #ifdef QT_GUI_LIB inline QColor convertColorToQColor(const color &c) diff --git a/common/expression.cpp b/libcockatrice_utility/libcockatrice/utility/expression.cpp similarity index 99% rename from common/expression.cpp rename to libcockatrice_utility/libcockatrice/utility/expression.cpp index 9cb40ea3c..3b2e815d1 100644 --- a/common/expression.cpp +++ b/libcockatrice_utility/libcockatrice/utility/expression.cpp @@ -1,6 +1,6 @@ #include "expression.h" -#include "./lib/peglib.h" +#include "peglib.h" #include #include diff --git a/common/expression.h b/libcockatrice_utility/libcockatrice/utility/expression.h similarity index 100% rename from common/expression.h rename to libcockatrice_utility/libcockatrice/utility/expression.h diff --git a/cockatrice/src/utility/key_signals.cpp b/libcockatrice_utility/libcockatrice/utility/key_signals.cpp similarity index 100% rename from cockatrice/src/utility/key_signals.cpp rename to libcockatrice_utility/libcockatrice/utility/key_signals.cpp diff --git a/cockatrice/src/utility/key_signals.h b/libcockatrice_utility/libcockatrice/utility/key_signals.h similarity index 100% rename from cockatrice/src/utility/key_signals.h rename to libcockatrice_utility/libcockatrice/utility/key_signals.h diff --git a/cockatrice/src/utility/levenshtein.cpp b/libcockatrice_utility/libcockatrice/utility/levenshtein.cpp similarity index 100% rename from cockatrice/src/utility/levenshtein.cpp rename to libcockatrice_utility/libcockatrice/utility/levenshtein.cpp diff --git a/cockatrice/src/utility/levenshtein.h b/libcockatrice_utility/libcockatrice/utility/levenshtein.h similarity index 100% rename from cockatrice/src/utility/levenshtein.h rename to libcockatrice_utility/libcockatrice/utility/levenshtein.h diff --git a/cockatrice/src/utility/logger.cpp b/libcockatrice_utility/libcockatrice/utility/logger.cpp similarity index 100% rename from cockatrice/src/utility/logger.cpp rename to libcockatrice_utility/libcockatrice/utility/logger.cpp diff --git a/cockatrice/src/utility/logger.h b/libcockatrice_utility/libcockatrice/utility/logger.h similarity index 100% rename from cockatrice/src/utility/logger.h rename to libcockatrice_utility/libcockatrice/utility/logger.h diff --git a/cockatrice/src/utility/macros.h b/libcockatrice_utility/libcockatrice/utility/macros.h similarity index 100% rename from cockatrice/src/utility/macros.h rename to libcockatrice_utility/libcockatrice/utility/macros.h diff --git a/common/passwordhasher.cpp b/libcockatrice_utility/libcockatrice/utility/passwordhasher.cpp similarity index 96% rename from common/passwordhasher.cpp rename to libcockatrice_utility/libcockatrice/utility/passwordhasher.cpp index bc5f072e8..c40c5f94f 100644 --- a/common/passwordhasher.cpp +++ b/libcockatrice_utility/libcockatrice/utility/passwordhasher.cpp @@ -1,8 +1,7 @@ #include "passwordhasher.h" -#include "rng_sfmt.h" - #include +#include QString PasswordHasher::computeHash(const QString &password, const QString &salt) { diff --git a/common/passwordhasher.h b/libcockatrice_utility/libcockatrice/utility/passwordhasher.h similarity index 100% rename from common/passwordhasher.h rename to libcockatrice_utility/libcockatrice/utility/passwordhasher.h diff --git a/common/lib/peglib.h b/libcockatrice_utility/libcockatrice/utility/peglib.h similarity index 100% rename from common/lib/peglib.h rename to libcockatrice_utility/libcockatrice/utility/peglib.h diff --git a/common/trice_limits.h b/libcockatrice_utility/libcockatrice/utility/trice_limits.h similarity index 100% rename from common/trice_limits.h rename to libcockatrice_utility/libcockatrice/utility/trice_limits.h diff --git a/oracle/CMakeLists.txt b/oracle/CMakeLists.txt index 63b1974e4..0331b287c 100644 --- a/oracle/CMakeLists.txt +++ b/oracle/CMakeLists.txt @@ -1,15 +1,21 @@ -# CMakeLists for oracle directory -# -# provides the oracle binary - +cmake_minimum_required(VERSION 3.16) project(Oracle VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}") -# paths +# ------------------------ +# Paths and directories +# ------------------------ set(DESKTOPDIR share/applications CACHE STRING "path to .desktop files" ) +set(ORACLE_MAC_QM_INSTALL_DIR "oracle.app/Contents/Resources/translations") +set(ORACLE_UNIX_QM_INSTALL_DIR "share/oracle/translations") +set(ORACLE_WIN32_QM_INSTALL_DIR "translations") + +# ------------------------ +# Sources +# ------------------------ set(oracle_SOURCES src/main.cpp src/oraclewizard.cpp @@ -17,34 +23,16 @@ set(oracle_SOURCES src/pagetemplates.cpp src/parsehelpers.cpp src/qt-json/json.cpp - ../cockatrice/src/card/card_info.cpp - ../cockatrice/src/card/card_relation.cpp - ../cockatrice/src/card/card_set.cpp - ../cockatrice/src/card/printing_info.cpp - ../cockatrice/src/client/network/release_channel.cpp - ../cockatrice/src/database/parser/card_database_parser.cpp - ../cockatrice/src/database/parser/cockatrice_xml_3.cpp - ../cockatrice/src/database/parser/cockatrice_xml_4.cpp + ../cockatrice/src/client/network/update/client/release_channel.cpp ../cockatrice/src/interface/theme_manager.cpp ../cockatrice/src/interface/widgets/quick_settings/settings_button_widget.cpp ../cockatrice/src/interface/widgets/quick_settings/settings_popup_widget.cpp - ../cockatrice/src/settings/cache_settings.cpp - ../cockatrice/src/settings/card_counter_settings.cpp - ../cockatrice/src/settings/card_database_settings.cpp - ../cockatrice/src/settings/card_override_settings.cpp - ../cockatrice/src/settings/debug_settings.cpp - ../cockatrice/src/settings/download_settings.cpp - ../cockatrice/src/settings/game_filters_settings.cpp - ../cockatrice/src/settings/layouts_settings.cpp - ../cockatrice/src/settings/message_settings.cpp - ../cockatrice/src/settings/recents_settings.cpp - ../cockatrice/src/settings/servers_settings.cpp - ../cockatrice/src/settings/settings_manager.cpp - ../cockatrice/src/settings/shortcuts_settings.cpp ${VERSION_STRING_CPP} ) -set(oracle_RESOURCES oracle.qrc) +# ------------------------ +# Translations +# ------------------------ if(UPDATE_TRANSLATIONS) file(GLOB_RECURSE translate_oracle_SRCS src/*.cpp src/*.h ../cockatrice/src/settingscache.cpp) @@ -66,37 +54,49 @@ if(APPLE) set(oracle_SOURCES ${oracle_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/resources/appicon.icns) endif(APPLE) +set(oracle_RESOURCES oracle.qrc) + +# ------------------------ +# Qt resources +# ------------------------ if(Qt6_FOUND) qt6_add_resources(oracle_RESOURCES_RCC ${oracle_RESOURCES}) elseif(Qt5_FOUND) qt5_add_resources(oracle_RESOURCES_RCC ${oracle_RESOURCES}) endif() +# ------------------------ +# Include directories +# ------------------------ include_directories(../cockatrice/src) -include_directories(../common) -# Libz is required to support zipped files +# ------------------------ +# Optional libraries +# ------------------------ +# ZLIB find_package(ZLIB) if(ZLIB_FOUND) include_directories(${ZLIB_INCLUDE_DIRS}) add_definitions("-DHAS_ZLIB") - - set(oracle_SOURCES ${oracle_SOURCES} src/zip/unzip.cpp src/zip/zipglobal.cpp) + list(APPEND oracle_SOURCES src/zip/unzip.cpp src/zip/zipglobal.cpp) else() message(STATUS "Oracle: zlib not found; ZIP support disabled") endif() -# LibLZMA is required to support xz files +# LZMA find_package(LibLZMA) if(LIBLZMA_FOUND) include_directories(${LIBLZMA_INCLUDE_DIRS}) add_definitions("-DHAS_LZMA") - - set(oracle_SOURCES ${oracle_SOURCES} src/lzma/decompress.cpp) + list(APPEND oracle_SOURCES src/lzma/decompress.cpp) else() message(STATUS "Oracle: LibLZMA not found; xz support disabled") endif() +# ------------------------ +# Build executable +# ------------------------ + set(ORACLE_MAC_QM_INSTALL_DIR "oracle.app/Contents/Resources/translations") set(ORACLE_UNIX_QM_INSTALL_DIR "share/oracle/translations") set(ORACLE_WIN32_QM_INSTALL_DIR "translations") @@ -133,7 +133,15 @@ elseif(Qt5_FOUND) endif() endif() -target_link_libraries(oracle PUBLIC ${ORACLE_QT_MODULES}) +# ------------------------ +# Link libraries +# ------------------------ +target_link_libraries( + oracle + PUBLIC libcockatrice_card + PUBLIC libcockatrice_settings + PUBLIC ${ORACLE_QT_MODULES} +) if(ZLIB_FOUND) target_link_libraries(oracle PUBLIC ${ZLIB_LIBRARIES}) @@ -143,6 +151,9 @@ if(LIBLZMA_FOUND) target_link_libraries(oracle PUBLIC ${LIBLZMA_LIBRARIES}) endif() +# ------------------------ +# Install rules +# ------------------------ if(UNIX) if(APPLE) set(MACOSX_BUNDLE_INFO_STRING "${PROJECT_NAME}") @@ -168,6 +179,9 @@ if(NOT WIN32 AND NOT APPLE) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/oracle.desktop DESTINATION ${DESKTOPDIR}) endif(NOT WIN32 AND NOT APPLE) +# ------------------------ +# Qt plugin handling +# ------------------------ if(APPLE) # these needs to be relative to CMAKE_INSTALL_PREFIX set(plugin_dest_dir oracle.app/Contents/Plugins) @@ -262,6 +276,9 @@ Translations = Resources/translations\") ) endif() +# ------------------------ +# Qt translations +# ------------------------ if(Qt6_FOUND AND Qt6LinguistTools_FOUND) #Qt6 Translations happen after the executable is built up if(UPDATE_TRANSLATIONS) diff --git a/oracle/oracle_en@source.ts b/oracle/oracle_en@source.ts index e0fd59842..3bdd8bef8 100644 --- a/oracle/oracle_en@source.ts +++ b/oracle/oracle_en@source.ts @@ -248,7 +248,7 @@ OracleImporter - + Dummy set containing tokens diff --git a/oracle/src/main.cpp b/oracle/src/main.cpp index f2930f975..3215f1d44 100644 --- a/oracle/src/main.cpp +++ b/oracle/src/main.cpp @@ -2,7 +2,6 @@ #include "interface/theme_manager.h" #include "oraclewizard.h" -#include "settings/cache_settings.h" #include #include @@ -10,6 +9,7 @@ #include #include #include +#include QTranslator *translator, *qtTranslator; ThemeManager *themeManager; diff --git a/oracle/src/oracleimporter.cpp b/oracle/src/oracleimporter.cpp index 0c53c4ad9..204772857 100644 --- a/oracle/src/oracleimporter.cpp +++ b/oracle/src/oracleimporter.cpp @@ -1,14 +1,14 @@ #include "oracleimporter.h" -#include "database/parser/cockatrice_xml_4.h" #include "parsehelpers.h" #include "qt-json/json.h" #include #include #include -#include #include +#include +#include SplitCardPart::SplitCardPart(const QString &_name, const QString &_text, diff --git a/oracle/src/oracleimporter.h b/oracle/src/oracleimporter.h index 5f40af9ba..3ec6da6e1 100644 --- a/oracle/src/oracleimporter.h +++ b/oracle/src/oracleimporter.h @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include // many users prefer not to see these sets with non english arts diff --git a/oracle/src/oraclewizard.cpp b/oracle/src/oraclewizard.cpp index 0fdd4b8f1..eeadfb8be 100644 --- a/oracle/src/oraclewizard.cpp +++ b/oracle/src/oraclewizard.cpp @@ -2,7 +2,6 @@ #include "main.h" #include "oracleimporter.h" -#include "settings/cache_settings.h" #include "version_string.h" #include @@ -25,6 +24,7 @@ #include #include #include +#include #ifdef HAS_LZMA #include "lzma/decompress.h" diff --git a/servatrice/CMakeLists.txt b/servatrice/CMakeLists.txt index 2b345362a..6e4191beb 100644 --- a/servatrice/CMakeLists.txt +++ b/servatrice/CMakeLists.txt @@ -96,19 +96,18 @@ set(DESKTOPDIR CACHE STRING "desktop file destination" ) -# Include directories -include_directories(../common) -include_directories(${PROTOBUF_INCLUDE_DIR}) -include_directories(${CMAKE_CURRENT_BINARY_DIR}/../common) -include_directories(${CMAKE_CURRENT_BINARY_DIR}) - # Build servatrice binary and link it add_executable(servatrice MACOSX_BUNDLE ${servatrice_MOC_SRCS} ${servatrice_RESOURCES_RCC} ${servatrice_SOURCES}) if(CMAKE_HOST_SYSTEM MATCHES "FreeBSD") - target_link_libraries(servatrice cockatrice_common Threads::Threads ${SERVATRICE_QT_MODULES} ${LIBEXECINFO_LIBRARY}) + target_link_libraries( + servatrice libcockatrice_deck_list libcockatrice_network_server_remote Threads::Threads ${SERVATRICE_QT_MODULES} + ${LIBEXECINFO_LIBRARY} + ) else() - target_link_libraries(servatrice cockatrice_common Threads::Threads ${SERVATRICE_QT_MODULES}) + target_link_libraries( + servatrice libcockatrice_deck_list libcockatrice_network_server_remote Threads::Threads ${SERVATRICE_QT_MODULES} + ) endif() # install rules diff --git a/servatrice/src/isl_interface.cpp b/servatrice/src/isl_interface.cpp index 0c13bcd0f..2269ff314 100644 --- a/servatrice/src/isl_interface.cpp +++ b/servatrice/src/isl_interface.cpp @@ -1,25 +1,25 @@ #include "isl_interface.h" -#include "debug_pb_message.h" -#include "get_pb_extension.h" #include "main.h" -#include "pb/event_game_joined.pb.h" -#include "pb/event_join_room.pb.h" -#include "pb/event_leave_room.pb.h" -#include "pb/event_list_games.pb.h" -#include "pb/event_remove_messages.pb.h" -#include "pb/event_room_say.pb.h" -#include "pb/event_server_complete_list.pb.h" -#include "pb/event_user_joined.pb.h" -#include "pb/event_user_left.pb.h" -#include "pb/event_user_message.pb.h" -#include "pb/isl_message.pb.h" -#include "server/server_protocolhandler.h" -#include "server/server_room.h" #include "server_logger.h" #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include void IslInterface::sharedCtor(const QSslCertificate &cert, const QSslKey &privateKey) { diff --git a/servatrice/src/isl_interface.h b/servatrice/src/isl_interface.h index 19310e07b..27e5b8293 100644 --- a/servatrice/src/isl_interface.h +++ b/servatrice/src/isl_interface.h @@ -1,13 +1,13 @@ #ifndef ISL_INTERFACE_H #define ISL_INTERFACE_H -#include "pb/serverinfo_game.pb.h" -#include "pb/serverinfo_room.pb.h" -#include "pb/serverinfo_user.pb.h" #include "servatrice.h" #include #include +#include +#include +#include class Servatrice; class QSslSocket; diff --git a/servatrice/src/main.cpp b/servatrice/src/main.cpp index c8950d973..b1294a04c 100644 --- a/servatrice/src/main.cpp +++ b/servatrice/src/main.cpp @@ -18,8 +18,6 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#include "passwordhasher.h" -#include "rng_sfmt.h" #include "servatrice.h" #include "server_logger.h" #include "settingscache.h" @@ -34,6 +32,8 @@ #include #include #include +#include +#include RNG_Abstract *rng; ServerLogger *logger; diff --git a/servatrice/src/servatrice.cpp b/servatrice/src/servatrice.cpp index e1288a627..ea3d783bd 100644 --- a/servatrice/src/servatrice.cpp +++ b/servatrice/src/servatrice.cpp @@ -19,17 +19,11 @@ ***************************************************************************/ #include "servatrice.h" -#include "deck_list.h" #include "email_parser.h" -#include "featureset.h" #include "isl_interface.h" #include "main.h" -#include "pb/event_connection_closed.pb.h" -#include "pb/event_server_message.pb.h" -#include "pb/event_server_shutdown.pb.h" #include "servatrice_connection_pool.h" #include "servatrice_database_interface.h" -#include "server/server_room.h" #include "server_logger.h" #include "serversocketinterface.h" #include "settingscache.h" @@ -45,6 +39,12 @@ #include #include #include +#include +#include +#include +#include +#include +#include Servatrice_GameServer::Servatrice_GameServer(Servatrice *_server, int _numberPools, diff --git a/servatrice/src/servatrice.h b/servatrice/src/servatrice.h index c68327c60..62fb382cb 100644 --- a/servatrice/src/servatrice.h +++ b/servatrice/src/servatrice.h @@ -20,8 +20,6 @@ #ifndef SERVATRICE_H #define SERVATRICE_H -#include "server/server.h" - #include #include #include @@ -31,6 +29,7 @@ #include #include #include +#include #include Q_DECLARE_METATYPE(QSqlDatabase) diff --git a/servatrice/src/servatrice_database_interface.cpp b/servatrice/src/servatrice_database_interface.cpp index 289059846..bad16bec3 100644 --- a/servatrice/src/servatrice_database_interface.cpp +++ b/servatrice/src/servatrice_database_interface.cpp @@ -1,8 +1,5 @@ #include "servatrice_database_interface.h" -#include "deck_list.h" -#include "passwordhasher.h" -#include "pb/game_replay.pb.h" #include "servatrice.h" #include "serversocketinterface.h" #include "settingscache.h" @@ -12,6 +9,9 @@ #include #include #include +#include +#include +#include Servatrice_DatabaseInterface::Servatrice_DatabaseInterface(int _instanceId, Servatrice *_server) : instanceId(_instanceId), sqlDatabase(QSqlDatabase()), server(_server) diff --git a/servatrice/src/servatrice_database_interface.h b/servatrice/src/servatrice_database_interface.h index 9eb492953..be1d1ff19 100644 --- a/servatrice/src/servatrice_database_interface.h +++ b/servatrice/src/servatrice_database_interface.h @@ -1,13 +1,12 @@ #ifndef SERVATRICE_DATABASE_INTERFACE_H #define SERVATRICE_DATABASE_INTERFACE_H -#include "server/server.h" -#include "server/server_database_interface.h" - #include #include #include #include +#include +#include #define DATABASE_SCHEMA_VERSION 34 diff --git a/servatrice/src/serversocketinterface.cpp b/servatrice/src/serversocketinterface.cpp index 9b08ee330..4b33aad12 100644 --- a/servatrice/src/serversocketinterface.cpp +++ b/servatrice/src/serversocketinterface.cpp @@ -20,57 +20,12 @@ #include "serversocketinterface.h" -#include "deck_list.h" #include "email_parser.h" #include "main.h" -#include "pb/command_deck_del.pb.h" -#include "pb/command_deck_del_dir.pb.h" -#include "pb/command_deck_download.pb.h" -#include "pb/command_deck_list.pb.h" -#include "pb/command_deck_new_dir.pb.h" -#include "pb/command_deck_upload.pb.h" -#include "pb/command_replay_delete_match.pb.h" -#include "pb/command_replay_download.pb.h" -#include "pb/command_replay_get_code.pb.h" -#include "pb/command_replay_list.pb.h" -#include "pb/command_replay_modify_match.pb.h" -#include "pb/command_replay_submit_code.pb.h" -#include "pb/commands.pb.h" -#include "pb/event_add_to_list.pb.h" -#include "pb/event_connection_closed.pb.h" -#include "pb/event_notify_user.pb.h" -#include "pb/event_remove_from_list.pb.h" -#include "pb/event_replay_added.pb.h" -#include "pb/event_server_identification.pb.h" -#include "pb/event_server_message.pb.h" -#include "pb/event_user_message.pb.h" -#include "pb/response_ban_history.pb.h" -#include "pb/response_deck_download.pb.h" -#include "pb/response_deck_list.pb.h" -#include "pb/response_deck_upload.pb.h" -#include "pb/response_forgotpasswordrequest.pb.h" -#include "pb/response_get_admin_notes.pb.h" -#include "pb/response_password_salt.pb.h" -#include "pb/response_register.pb.h" -#include "pb/response_replay_download.pb.h" -#include "pb/response_replay_get_code.pb.h" -#include "pb/response_replay_list.pb.h" -#include "pb/response_viewlog_history.pb.h" -#include "pb/response_warn_history.pb.h" -#include "pb/response_warn_list.pb.h" -#include "pb/serverinfo_ban.pb.h" -#include "pb/serverinfo_chat_message.pb.h" -#include "pb/serverinfo_deckstorage.pb.h" -#include "pb/serverinfo_replay.pb.h" -#include "pb/serverinfo_user.pb.h" #include "servatrice.h" #include "servatrice_database_interface.h" -#include "server/game/server_player.h" -#include "server/server_response_containers.h" -#include "server/server_room.h" #include "server_logger.h" #include "settingscache.h" -#include "trice_limits.h" #include "version_string.h" #include @@ -80,7 +35,52 @@ #include #include #include +#include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include static const int protocolVersion = 14; diff --git a/servatrice/src/serversocketinterface.h b/servatrice/src/serversocketinterface.h index 9f15e62b8..edf3d9f79 100644 --- a/servatrice/src/serversocketinterface.h +++ b/servatrice/src/serversocketinterface.h @@ -20,12 +20,11 @@ #ifndef SERVERSOCKETINTERFACE_H #define SERVERSOCKETINTERFACE_H -#include "server/server_protocolhandler.h" - #include #include #include #include +#include class Servatrice; class Servatrice_DatabaseInterface; diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f6b2d12d2..6a5eacf54 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -45,9 +45,11 @@ endif() include_directories(${GTEST_INCLUDE_DIRS}) target_link_libraries(dummy_test Threads::Threads ${GTEST_BOTH_LIBRARIES}) -target_link_libraries(expression_test cockatrice_common Threads::Threads ${GTEST_BOTH_LIBRARIES} ${TEST_QT_MODULES}) +target_link_libraries(expression_test libcockatrice_utility Threads::Threads ${GTEST_BOTH_LIBRARIES} ${TEST_QT_MODULES}) target_link_libraries(test_age_formatting Threads::Threads ${GTEST_BOTH_LIBRARIES} ${TEST_QT_MODULES}) -target_link_libraries(password_hash_test cockatrice_common Threads::Threads ${GTEST_BOTH_LIBRARIES} ${TEST_QT_MODULES}) +target_link_libraries( + password_hash_test libcockatrice_utility Threads::Threads ${GTEST_BOTH_LIBRARIES} ${TEST_QT_MODULES} +) add_subdirectory(carddatabase) add_subdirectory(loading_from_clipboard) diff --git a/tests/carddatabase/CMakeLists.txt b/tests/carddatabase/CMakeLists.txt index 913c1cc06..4030cb124 100644 --- a/tests/carddatabase/CMakeLists.txt +++ b/tests/carddatabase/CMakeLists.txt @@ -1,70 +1,63 @@ +cmake_minimum_required(VERSION 3.16) +project(CardDatabaseTests VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}") + +# ------------------------ +# Definitions +# ------------------------ add_definitions("-DCARDDB_DATADIR=\"${CMAKE_CURRENT_SOURCE_DIR}/data/\"") +# ------------------------ +# Qt modules +# ------------------------ set(TEST_QT_MODULES ${COCKATRICE_QT_VERSION_NAME}::Concurrent ${COCKATRICE_QT_VERSION_NAME}::Network ${COCKATRICE_QT_VERSION_NAME}::Widgets ${COCKATRICE_QT_VERSION_NAME}::Svg ) -if(Qt6_FOUND) - qt6_wrap_cpp( - MOCKS_SOURCES ../../cockatrice/src/settings/cache_settings.h ../../cockatrice/src/settings/card_database_settings.h - ) -elseif(Qt5_FOUND) - qt5_wrap_cpp( - MOCKS_SOURCES ../../cockatrice/src/settings/cache_settings.h ../../cockatrice/src/settings/card_database_settings.h - ) -endif() +# ------------------------ +# Card Database Test +# ------------------------ +add_executable(carddatabase_test ${MOCKS_SOURCES} ${VERSION_STRING_CPP} carddatabase_test.cpp mocks.cpp) -add_executable( +target_link_libraries( carddatabase_test - ${MOCKS_SOURCES} - ${VERSION_STRING_CPP} - ../../cockatrice/src/card/card_info.cpp - ../../cockatrice/src/card/card_relation.cpp - ../../cockatrice/src/card/card_set.cpp - ../../cockatrice/src/card/card_set_list.cpp - ../../cockatrice/src/card/exact_card.cpp - ../../cockatrice/src/card/printing_info.cpp - ../../cockatrice/src/database/card_database.cpp - ../../cockatrice/src/database/card_database_loader.cpp - ../../cockatrice/src/database/card_database_querier.cpp - ../../cockatrice/src/database/parser/card_database_parser.cpp - ../../cockatrice/src/database/parser/cockatrice_xml_3.cpp - ../../cockatrice/src/database/parser/cockatrice_xml_4.cpp - ../../cockatrice/src/settings/settings_manager.cpp - carddatabase_test.cpp - mocks.cpp + PRIVATE libcockatrice_card + PRIVATE libcockatrice_settings + PRIVATE Threads::Threads + PRIVATE ${GTEST_BOTH_LIBRARIES} + PRIVATE ${TEST_QT_MODULES} ) + +add_test(NAME carddatabase_test COMMAND carddatabase_test) + +# ------------------------ +# Filter String Test +# ------------------------ add_executable( filter_string_test ${MOCKS_SOURCES} ${VERSION_STRING_CPP} - ../../cockatrice/src/card/card_info.cpp - ../../cockatrice/src/card/card_relation.cpp - ../../cockatrice/src/card/card_set.cpp - ../../cockatrice/src/card/card_set_list.cpp - ../../cockatrice/src/card/exact_card.cpp - ../../cockatrice/src/card/printing_info.cpp - ../../cockatrice/src/database/card_database.cpp - ../../cockatrice/src/database/card_database_loader.cpp - ../../cockatrice/src/database/card_database_querier.cpp - ../../cockatrice/src/database/card_database_manager.cpp - ../../cockatrice/src/database/parser/card_database_parser.cpp - ../../cockatrice/src/database/parser/cockatrice_xml_3.cpp - ../../cockatrice/src/database/parser/cockatrice_xml_4.cpp ../../cockatrice/src/filters/filter_card.cpp ../../cockatrice/src/filters/filter_string.cpp ../../cockatrice/src/filters/filter_tree.cpp - ../../cockatrice/src/settings/settings_manager.cpp filter_string_test.cpp mocks.cpp ) + +target_link_libraries( + filter_string_test + PRIVATE libcockatrice_card + PRIVATE libcockatrice_settings + PRIVATE Threads::Threads + PRIVATE ${GTEST_BOTH_LIBRARIES} + PRIVATE ${TEST_QT_MODULES} +) + +add_test(NAME filter_string_test COMMAND filter_string_test) + +# ------------------------ +# Dependencies on gtest +# ------------------------ if(NOT GTEST_FOUND) add_dependencies(carddatabase_test gtest) add_dependencies(filter_string_test gtest) endif() - -target_link_libraries(carddatabase_test cockatrice_common Threads::Threads ${GTEST_BOTH_LIBRARIES} ${TEST_QT_MODULES}) -target_link_libraries(filter_string_test cockatrice_common Threads::Threads ${GTEST_BOTH_LIBRARIES} ${TEST_QT_MODULES}) - -add_test(NAME carddatabase_test COMMAND carddatabase_test) -add_test(NAME filter_string_test COMMAND filter_string_test) diff --git a/tests/carddatabase/filter_string_test.cpp b/tests/carddatabase/filter_string_test.cpp index 3055bb76a..f0c7d9768 100644 --- a/tests/carddatabase/filter_string_test.cpp +++ b/tests/carddatabase/filter_string_test.cpp @@ -1,8 +1,8 @@ -#include "../../cockatrice/src/database/card_database_manager.h" #include "../../cockatrice/src/filters/filter_string.h" #include "mocks.h" #include "gtest/gtest.h" +#include #define QUERY(name, card, query, match) \ TEST_F(CardQuery, name) \ diff --git a/tests/carddatabase/mocks.cpp b/tests/carddatabase/mocks.cpp index 08d82d765..7d46a68c2 100644 --- a/tests/carddatabase/mocks.cpp +++ b/tests/carddatabase/mocks.cpp @@ -452,7 +452,7 @@ void SettingsCache::setRoundCardCorners(bool /* _roundCardCorners */) { } -void PictureLoader::clearPixmapCache(CardInfoPtr /* card */) +void CardPictureLoader::clearPixmapCache(CardInfoPtr /* card */) { } diff --git a/tests/carddatabase/mocks.h b/tests/carddatabase/mocks.h index 18a50155b..497f76e72 100644 --- a/tests/carddatabase/mocks.h +++ b/tests/carddatabase/mocks.h @@ -10,13 +10,13 @@ #define PICTURELOADER_H -#include "../../cockatrice/src/database/card_database.h" -#include "../../cockatrice/src/settings/cache_settings.h" -#include "../../cockatrice/src/utility/macros.h" +#include +#include +#include extern SettingsCache *settingsCache; -class PictureLoader +class CardPictureLoader { public: static void clearPixmapCache(CardInfoPtr card); diff --git a/tests/expression_test.cpp b/tests/expression_test.cpp index 51c4039a4..4fbe98cb9 100644 --- a/tests/expression_test.cpp +++ b/tests/expression_test.cpp @@ -1,7 +1,6 @@ -#include "../common/expression.h" - #include "gtest/gtest.h" #include +#include #define TEST_EXPR(name, a, b) \ TEST(ExpressionTest, name) \ diff --git a/tests/loading_from_clipboard/CMakeLists.txt b/tests/loading_from_clipboard/CMakeLists.txt index be8ac6374..40e85c66e 100644 --- a/tests/loading_from_clipboard/CMakeLists.txt +++ b/tests/loading_from_clipboard/CMakeLists.txt @@ -1,7 +1,5 @@ add_definitions("-DCARDDB_DATADIR=\"${CMAKE_CURRENT_SOURCE_DIR}/data/\"") -add_executable( - loading_from_clipboard_test ../../common/deck_list.cpp clipboard_testing.cpp loading_from_clipboard_test.cpp -) +add_executable(loading_from_clipboard_test clipboard_testing.cpp loading_from_clipboard_test.cpp) if(NOT GTEST_FOUND) add_dependencies(loading_from_clipboard_test gtest) @@ -12,6 +10,6 @@ set(TEST_QT_MODULES ${COCKATRICE_QT_VERSION_NAME}::Concurrent ${COCKATRICE_QT_VE ) target_link_libraries( - loading_from_clipboard_test cockatrice_common Threads::Threads ${GTEST_BOTH_LIBRARIES} ${TEST_QT_MODULES} + loading_from_clipboard_test libcockatrice_deck_list Threads::Threads ${GTEST_BOTH_LIBRARIES} ${TEST_QT_MODULES} ) add_test(NAME loading_from_clipboard_test COMMAND loading_from_clipboard_test) diff --git a/tests/loading_from_clipboard/clipboard_testing.cpp b/tests/loading_from_clipboard/clipboard_testing.cpp index 943c6a05d..df2806585 100644 --- a/tests/loading_from_clipboard/clipboard_testing.cpp +++ b/tests/loading_from_clipboard/clipboard_testing.cpp @@ -1,8 +1,7 @@ #include "clipboard_testing.h" -#include "../../common/deck_list_card_node.h" - #include +#include void testEmpty(const QString &clipboard) { diff --git a/tests/loading_from_clipboard/clipboard_testing.h b/tests/loading_from_clipboard/clipboard_testing.h index 8f1b215b8..5e9cff915 100644 --- a/tests/loading_from_clipboard/clipboard_testing.h +++ b/tests/loading_from_clipboard/clipboard_testing.h @@ -1,9 +1,8 @@ #ifndef CLIPBOARD_TESTING_H #define CLIPBOARD_TESTING_H -#include "../../common/deck_list.h" - #include "gtest/gtest.h" +#include // using std types because qt types aren't understood by gtest (without this you'll get less nice errors) using CardRows = QVector>; diff --git a/tests/oracle/CMakeLists.txt b/tests/oracle/CMakeLists.txt index 0c11eb751..b89663d6f 100644 --- a/tests/oracle/CMakeLists.txt +++ b/tests/oracle/CMakeLists.txt @@ -6,6 +6,6 @@ endif() set(TEST_QT_MODULES ${COCKATRICE_QT_VERSION_NAME}::Widgets) -target_link_libraries(parse_cipt_test cockatrice_common Threads::Threads ${GTEST_BOTH_LIBRARIES} ${TEST_QT_MODULES}) +target_link_libraries(parse_cipt_test Threads::Threads ${GTEST_BOTH_LIBRARIES} ${TEST_QT_MODULES}) add_test(NAME parse_cipt_test COMMAND parse_cipt_test) diff --git a/tests/password_hash_test.cpp b/tests/password_hash_test.cpp index 84e7c8eb1..38d9b6315 100644 --- a/tests/password_hash_test.cpp +++ b/tests/password_hash_test.cpp @@ -1,8 +1,7 @@ -#include "../common/passwordhasher.h" -#include "../common/rng_abstract.h" -#include "../common/rng_sfmt.h" - #include "gtest/gtest.h" +#include +#include +#include RNG_Abstract *rng; diff --git a/tests/test_age_formatting.cpp b/tests/test_age_formatting.cpp index 4593a7b56..e4fc64cf9 100644 --- a/tests/test_age_formatting.cpp +++ b/tests/test_age_formatting.cpp @@ -1,4 +1,4 @@ -#include "../cockatrice/src/server/user/user_info_box.h" +#include "../cockatrice/src/interface/widgets/server/user/user_info_box.h" #include "gtest/gtest.h" diff --git a/vcpkg b/vcpkg index 29ff5b813..623240005 160000 --- a/vcpkg +++ b/vcpkg @@ -1 +1 @@ -Subproject commit 29ff5b8131d0c6c8fcb8fbaef35992f0d507cd7c +Subproject commit 62324000504cdd27282f8275c99135cfb2bd1dc0