mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-09 17:44:01 -07:00
Merge branch 'master' into 6269/ci/strip-fat-bins
This commit is contained in:
commit
eb3d99c3a0
238 changed files with 3469 additions and 1638 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
FROM fedora:41
|
FROM fedora:43
|
||||||
|
|
||||||
RUN dnf install -y \
|
RUN dnf install -y \
|
||||||
ccache \
|
ccache \
|
||||||
21
.ci/Servatrice_Debian11/Dockerfile
Normal file
21
.ci/Servatrice_Debian11/Dockerfile
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
FROM debian:11
|
||||||
|
|
||||||
|
RUN apt-get update && \
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||||
|
build-essential \
|
||||||
|
ccache \
|
||||||
|
clang-format \
|
||||||
|
cmake \
|
||||||
|
file \
|
||||||
|
g++ \
|
||||||
|
git \
|
||||||
|
libmariadb-dev-compat \
|
||||||
|
libprotobuf-dev \
|
||||||
|
libqt5sql5-mysql \
|
||||||
|
libqt5websockets5-dev \
|
||||||
|
ninja-build \
|
||||||
|
protobuf-compiler \
|
||||||
|
qttools5-dev \
|
||||||
|
qttools5-dev-tools \
|
||||||
|
&& apt-get clean \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
# --ccache [<size>] uses ccache and shows stats, optionally provide size
|
# --ccache [<size>] uses ccache and shows stats, optionally provide size
|
||||||
# --dir <dir> sets the name of the build dir, default is "build"
|
# --dir <dir> sets the name of the build dir, default is "build"
|
||||||
# --target-macos-version <version> sets the min os version - only used for macOS builds
|
# --target-macos-version <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
|
# uses env: BUILDTYPE MAKE_INSTALL MAKE_PACKAGE PACKAGE_TYPE PACKAGE_SUFFIX MAKE_SERVER MAKE_NO_CLIENT MAKE_TEST USE_CCACHE CCACHE_SIZE BUILD_DIR CMAKE_GENERATOR TARGET_MACOS_VERSION
|
||||||
# (correspond to args: --debug/--release --install --package <package type> --suffix <suffix> --server --test --ccache <ccache_size> --dir <dir>)
|
# (correspond to args: --debug/--release --install --package <package type> --suffix <suffix> --server --test --ccache <ccache_size> --dir <dir>)
|
||||||
# exitcode: 1 for failure, 3 for invalid arguments
|
# exitcode: 1 for failure, 3 for invalid arguments
|
||||||
|
|
||||||
|
|
@ -47,6 +47,10 @@ while [[ $# != 0 ]]; do
|
||||||
MAKE_SERVER=1
|
MAKE_SERVER=1
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
'--no-client')
|
||||||
|
MAKE_NO_CLIENT=1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
'--test')
|
'--test')
|
||||||
MAKE_TEST=1
|
MAKE_TEST=1
|
||||||
shift
|
shift
|
||||||
|
|
@ -117,6 +121,9 @@ flags=("-DCMAKE_BUILD_TYPE=$BUILDTYPE")
|
||||||
if [[ $MAKE_SERVER ]]; then
|
if [[ $MAKE_SERVER ]]; then
|
||||||
flags+=("-DWITH_SERVER=1")
|
flags+=("-DWITH_SERVER=1")
|
||||||
fi
|
fi
|
||||||
|
if [[ $MAKE_NO_CLIENT ]]; then
|
||||||
|
flags+=("-DWITH_CLIENT=0" "-DWITH_ORACLE=0" "-DWITH_DBCONVERTER=0")
|
||||||
|
fi
|
||||||
if [[ $MAKE_TEST ]]; then
|
if [[ $MAKE_TEST ]]; then
|
||||||
flags+=("-DTEST=1")
|
flags+=("-DTEST=1")
|
||||||
fi
|
fi
|
||||||
|
|
@ -220,12 +227,12 @@ fi
|
||||||
|
|
||||||
echo "::group::Configure cmake"
|
echo "::group::Configure cmake"
|
||||||
cmake --version
|
cmake --version
|
||||||
echo "Running cmake with flags: ${flags[@]}"
|
echo "Running cmake with flags: ${flags[*]}"
|
||||||
cmake .. "${flags[@]}"
|
cmake .. "${flags[@]}"
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
echo "::group::Build project"
|
echo "::group::Build project"
|
||||||
echo "Running cmake --build with flags: ${buildflags[@]}"
|
echo "Running cmake --build with flags: ${buildflags[*]}"
|
||||||
cmake --build . "${buildflags[@]}"
|
cmake --build . "${buildflags[@]}"
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,8 @@ Available pre-compiled binaries for installation:
|
||||||
• <kbd>Debian 13</kbd> <sub><i>Trixie</i></sub>
|
• <kbd>Debian 13</kbd> <sub><i>Trixie</i></sub>
|
||||||
• <kbd>Debian 12</kbd> <sub><i>Bookworm</i></sub>
|
• <kbd>Debian 12</kbd> <sub><i>Bookworm</i></sub>
|
||||||
• <kbd>Debian 11</kbd> <sub><i>Bullseye</i></sub>
|
• <kbd>Debian 11</kbd> <sub><i>Bullseye</i></sub>
|
||||||
|
• <kbd>Fedora 43</kbd>
|
||||||
• <kbd>Fedora 42</kbd>
|
• <kbd>Fedora 42</kbd>
|
||||||
• <kbd>Fedora 41</kbd>
|
|
||||||
|
|
||||||
<sub>We are also packaged in <kbd>Arch Linux</kbd>'s <a href="https://archlinux.org/packages/extra/x86_64/cockatrice">official extra repository</a>, courtesy of @FFY00.</sub>
|
<sub>We are also packaged in <kbd>Arch Linux</kbd>'s <a href="https://archlinux.org/packages/extra/x86_64/cockatrice">official extra repository</a>, courtesy of @FFY00.</sub>
|
||||||
<sub>General Linux support is available via a <kbd>flatpak</kbd> package at <a href="https://flathub.org/apps/io.github.Cockatrice.cockatrice">Flathub</a>!</sub>
|
<sub>General Linux support is available via a <kbd>flatpak</kbd> package at <a href="https://flathub.org/apps/io.github.Cockatrice.cockatrice">Flathub</a>!</sub>
|
||||||
|
|
|
||||||
14
.github/workflows/desktop-build.yml
vendored
14
.github/workflows/desktop-build.yml
vendored
|
|
@ -114,7 +114,12 @@ jobs:
|
||||||
- distro: Debian
|
- distro: Debian
|
||||||
version: 11
|
version: 11
|
||||||
package: DEB
|
package: DEB
|
||||||
test: skip # Running tests on all distros is superfluous
|
|
||||||
|
- distro: Servatrice_Debian
|
||||||
|
version: 11
|
||||||
|
package: DEB
|
||||||
|
test: skip
|
||||||
|
server_only: yes
|
||||||
|
|
||||||
- distro: Debian
|
- distro: Debian
|
||||||
version: 12
|
version: 12
|
||||||
|
|
@ -126,12 +131,12 @@ jobs:
|
||||||
package: DEB
|
package: DEB
|
||||||
|
|
||||||
- distro: Fedora
|
- distro: Fedora
|
||||||
version: 41
|
version: 42
|
||||||
package: RPM
|
package: RPM
|
||||||
test: skip # Running tests on all distros is superfluous
|
test: skip # Running tests on all distros is superfluous
|
||||||
|
|
||||||
- distro: Fedora
|
- distro: Fedora
|
||||||
version: 42
|
version: 43
|
||||||
package: RPM
|
package: RPM
|
||||||
|
|
||||||
- distro: Ubuntu
|
- distro: Ubuntu
|
||||||
|
|
@ -191,10 +196,11 @@ jobs:
|
||||||
SUFFIX: '-${{matrix.distro}}${{matrix.version}}'
|
SUFFIX: '-${{matrix.distro}}${{matrix.version}}'
|
||||||
package: '${{matrix.package}}'
|
package: '${{matrix.package}}'
|
||||||
CMAKE_GENERATOR: '${{env.CMAKE_GENERATOR}}'
|
CMAKE_GENERATOR: '${{env.CMAKE_GENERATOR}}'
|
||||||
|
NO_CLIENT: ${{matrix.server_only == 'yes' && '--no-client' || '' }}
|
||||||
run: |
|
run: |
|
||||||
source .ci/docker.sh
|
source .ci/docker.sh
|
||||||
RUN --server --release --package "$package" --dir "$BUILD_DIR" \
|
RUN --server --release --package "$package" --dir "$BUILD_DIR" \
|
||||||
--ccache "$CCACHE_SIZE"
|
--ccache "$CCACHE_SIZE" $NO_CLIENT
|
||||||
.ci/name_build.sh
|
.ci/name_build.sh
|
||||||
|
|
||||||
- name: Save compiler cache (ccache)
|
- name: Save compiler cache (ccache)
|
||||||
|
|
|
||||||
2
.github/workflows/desktop-lint.yml
vendored
2
.github/workflows/desktop-lint.yml
vendored
|
|
@ -20,7 +20,7 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
format:
|
format:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-22.04
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
|
|
||||||
1
.github/workflows/docker-release.yml
vendored
1
.github/workflows/docker-release.yml
vendored
|
|
@ -11,6 +11,7 @@ on:
|
||||||
- master
|
- master
|
||||||
paths:
|
paths:
|
||||||
- '.github/workflows/docker-release.yml'
|
- '.github/workflows/docker-release.yml'
|
||||||
|
- 'Dockerfile'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
docker:
|
docker:
|
||||||
|
|
|
||||||
|
|
@ -328,14 +328,19 @@ endif()
|
||||||
|
|
||||||
include(CPack)
|
include(CPack)
|
||||||
|
|
||||||
|
add_subdirectory(${CMAKE_SOURCE_DIR}/libcockatrice_interfaces ${CMAKE_BINARY_DIR}/libcockatrice_interfaces)
|
||||||
add_subdirectory(${CMAKE_SOURCE_DIR}/libcockatrice_protocol ${CMAKE_BINARY_DIR}/libcockatrice_protocol)
|
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_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_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_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_card ${CMAKE_BINARY_DIR}/libcockatrice_card)
|
||||||
add_subdirectory(${CMAKE_SOURCE_DIR}/libcockatrice_utility ${CMAKE_BINARY_DIR}/libcockatrice_utility)
|
add_subdirectory(${CMAKE_SOURCE_DIR}/libcockatrice_utility ${CMAKE_BINARY_DIR}/libcockatrice_utility)
|
||||||
add_subdirectory(${CMAKE_SOURCE_DIR}/libcockatrice_models ${CMAKE_BINARY_DIR}/libcockatrice_models)
|
if(WITH_ORACLE OR WITH_CLIENT)
|
||||||
|
add_subdirectory(${CMAKE_SOURCE_DIR}/libcockatrice_settings ${CMAKE_BINARY_DIR}/libcockatrice_settings)
|
||||||
|
add_subdirectory(${CMAKE_SOURCE_DIR}/libcockatrice_models ${CMAKE_BINARY_DIR}/libcockatrice_models)
|
||||||
|
add_subdirectory(${CMAKE_SOURCE_DIR}/libcockatrice_filters ${CMAKE_BINARY_DIR}/libcockatrice_filters)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(WITH_SERVER)
|
if(WITH_SERVER)
|
||||||
add_subdirectory(servatrice)
|
add_subdirectory(servatrice)
|
||||||
set(CPACK_INSTALL_CMAKE_PROJECTS "Servatrice;Servatrice;ALL;/" ${CPACK_INSTALL_CMAKE_PROJECTS})
|
set(CPACK_INSTALL_CMAKE_PROJECTS "Servatrice;Servatrice;ALL;/" ${CPACK_INSTALL_CMAKE_PROJECTS})
|
||||||
|
|
|
||||||
33
Dockerfile
33
Dockerfile
|
|
@ -1,8 +1,9 @@
|
||||||
FROM ubuntu:24.04
|
# -------- Build Stage --------
|
||||||
|
FROM ubuntu:24.04 AS build
|
||||||
|
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y\
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
build-essential \
|
build-essential \
|
||||||
cmake \
|
cmake \
|
||||||
file \
|
file \
|
||||||
|
|
@ -16,20 +17,28 @@ RUN apt-get update && apt-get install -y\
|
||||||
qt6-tools-dev \
|
qt6-tools-dev \
|
||||||
qt6-tools-dev-tools
|
qt6-tools-dev-tools
|
||||||
|
|
||||||
COPY ./CMakeLists.txt ./LICENSE ./README.md /home/servatrice/code/
|
WORKDIR /src
|
||||||
COPY ./cmake /home/servatrice/code/cmake
|
COPY . .
|
||||||
COPY ./common /home/servatrice/code/common
|
RUN mkdir build && cd build && \
|
||||||
COPY ./servatrice /home/servatrice/code/servatrice
|
cmake .. -DWITH_SERVER=1 -DWITH_CLIENT=0 -DWITH_ORACLE=0 -DWITH_DBCONVERTER=0 && \
|
||||||
|
make -j$(nproc) && \
|
||||||
|
make install
|
||||||
|
|
||||||
WORKDIR /home/servatrice/code
|
|
||||||
|
|
||||||
WORKDIR build
|
# -------- Runtime Stage (clean) --------
|
||||||
RUN cmake .. -DWITH_SERVER=1 -DWITH_CLIENT=0 -DWITH_ORACLE=0 -DWITH_DBCONVERTER=0 &&\
|
FROM ubuntu:24.04
|
||||||
make &&\
|
|
||||||
make install
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
libprotobuf32t64 \
|
||||||
|
libqt6sql6-mysql \
|
||||||
|
libqt6websockets6 \
|
||||||
|
&& apt-get clean \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Only copy installed binaries, not source
|
||||||
|
COPY --from=build /usr/local /usr/local
|
||||||
|
|
||||||
WORKDIR /home/servatrice
|
WORKDIR /home/servatrice
|
||||||
|
|
||||||
EXPOSE 4748
|
EXPOSE 4748
|
||||||
|
|
||||||
ENTRYPOINT [ "servatrice", "--log-to-console" ]
|
ENTRYPOINT [ "servatrice", "--log-to-console" ]
|
||||||
|
|
|
||||||
2
Doxyfile
2
Doxyfile
|
|
@ -991,7 +991,7 @@ WARN_LOGFILE =
|
||||||
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
|
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
|
||||||
# Note: If this tag is empty the current directory is searched.
|
# Note: If this tag is empty the current directory is searched.
|
||||||
|
|
||||||
INPUT = cockatrice common doc/doxygen-groups
|
INPUT = cockatrice doc/doxygen-groups libcockatrice_card libcockatrice_deck_list libcockatrice_filters libcockatrice_interfaces libcockatrice_models libcockatrice_network libcockatrice_protocol libcockatrice_rng libcockatrice_settings libcockatrice_utility
|
||||||
|
|
||||||
# This tag can be used to specify the character encoding of the source files
|
# This tag can be used to specify the character encoding of the source files
|
||||||
# that Doxygen parses. Internally Doxygen uses the UTF-8 encoding. Doxygen uses
|
# that Doxygen parses. Internally Doxygen uses the UTF-8 encoding. Doxygen uses
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,11 @@ set(cockatrice_SOURCES
|
||||||
src/client/network/update/client/release_channel.cpp
|
src/client/network/update/client/release_channel.cpp
|
||||||
src/client/network/update/card_spoiler/spoiler_background_updater.cpp
|
src/client/network/update/card_spoiler/spoiler_background_updater.cpp
|
||||||
src/client/sound_engine.cpp
|
src/client/sound_engine.cpp
|
||||||
|
src/client/settings/cache_settings.cpp
|
||||||
|
src/client/settings/card_counter_settings.cpp
|
||||||
|
src/client/settings/shortcut_treeview.cpp
|
||||||
|
src/client/settings/shortcuts_settings.cpp
|
||||||
|
src/interface/deck_loader/deck_loader.cpp
|
||||||
src/interface/widgets/dialogs/dlg_connect.cpp
|
src/interface/widgets/dialogs/dlg_connect.cpp
|
||||||
src/interface/widgets/dialogs/dlg_convert_deck_to_cod_format.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_create_game.cpp
|
||||||
|
|
@ -42,9 +47,6 @@ set(cockatrice_SOURCES
|
||||||
src/interface/widgets/dialogs/tip_of_the_day.cpp
|
src/interface/widgets/dialogs/tip_of_the_day.cpp
|
||||||
src/filters/deck_filter_string.cpp
|
src/filters/deck_filter_string.cpp
|
||||||
src/filters/filter_builder.cpp
|
src/filters/filter_builder.cpp
|
||||||
src/filters/filter_card.cpp
|
|
||||||
src/filters/filter_string.cpp
|
|
||||||
src/filters/filter_tree.cpp
|
|
||||||
src/filters/filter_tree_model.cpp
|
src/filters/filter_tree_model.cpp
|
||||||
src/filters/syntax_help.cpp
|
src/filters/syntax_help.cpp
|
||||||
src/game/abstract_game.cpp
|
src/game/abstract_game.cpp
|
||||||
|
|
@ -148,6 +150,7 @@ set(cockatrice_SOURCES
|
||||||
src/interface/widgets/deck_editor/deck_editor_deck_dock_widget.cpp
|
src/interface/widgets/deck_editor/deck_editor_deck_dock_widget.cpp
|
||||||
src/interface/widgets/deck_editor/deck_editor_filter_dock_widget.cpp
|
src/interface/widgets/deck_editor/deck_editor_filter_dock_widget.cpp
|
||||||
src/interface/widgets/deck_editor/deck_editor_printing_selector_dock_widget.cpp
|
src/interface/widgets/deck_editor/deck_editor_printing_selector_dock_widget.cpp
|
||||||
|
src/interface/widgets/deck_editor/deck_list_style_proxy.cpp
|
||||||
src/interface/widgets/general/background_sources.cpp
|
src/interface/widgets/general/background_sources.cpp
|
||||||
src/interface/widgets/general/display/banner_widget.cpp
|
src/interface/widgets/general/display/banner_widget.cpp
|
||||||
src/interface/widgets/general/display/bar_widget.cpp
|
src/interface/widgets/general/display/bar_widget.cpp
|
||||||
|
|
@ -360,10 +363,12 @@ if(Qt5_FOUND)
|
||||||
cockatrice
|
cockatrice
|
||||||
libcockatrice_card
|
libcockatrice_card
|
||||||
libcockatrice_deck_list
|
libcockatrice_deck_list
|
||||||
|
libcockatrice_filters
|
||||||
libcockatrice_utility
|
libcockatrice_utility
|
||||||
libcockatrice_network
|
libcockatrice_network
|
||||||
libcockatrice_models
|
libcockatrice_models
|
||||||
libcockatrice_rng
|
libcockatrice_rng
|
||||||
|
libcockatrice_settings
|
||||||
${COCKATRICE_QT_MODULES}
|
${COCKATRICE_QT_MODULES}
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
|
|
@ -371,10 +376,12 @@ else()
|
||||||
cockatrice
|
cockatrice
|
||||||
PUBLIC libcockatrice_card
|
PUBLIC libcockatrice_card
|
||||||
libcockatrice_deck_list
|
libcockatrice_deck_list
|
||||||
|
libcockatrice_filters
|
||||||
libcockatrice_utility
|
libcockatrice_utility
|
||||||
libcockatrice_network
|
libcockatrice_network
|
||||||
libcockatrice_models
|
libcockatrice_models
|
||||||
libcockatrice_rng
|
libcockatrice_rng
|
||||||
|
libcockatrice_settings
|
||||||
${COCKATRICE_QT_MODULES}
|
${COCKATRICE_QT_MODULES}
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
<file>resources/icons/lock.svg</file>
|
<file>resources/icons/lock.svg</file>
|
||||||
<file>resources/icons/not_ready_start.svg</file>
|
<file>resources/icons/not_ready_start.svg</file>
|
||||||
<file>resources/icons/pencil.svg</file>
|
<file>resources/icons/pencil.svg</file>
|
||||||
|
<file>resources/icons/pin.svg</file>
|
||||||
<file>resources/icons/player.svg</file>
|
<file>resources/icons/player.svg</file>
|
||||||
<file>resources/icons/ready_start.svg</file>
|
<file>resources/icons/ready_start.svg</file>
|
||||||
<file>resources/icons/reload.svg</file>
|
<file>resources/icons/reload.svg</file>
|
||||||
|
|
|
||||||
24
cockatrice/resources/icons/pin.svg
Normal file
24
cockatrice/resources/icons/pin.svg
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="64" height="64">
|
||||||
|
<g transform="matrix(0 1 -1 0 99.465813 0)" opacity="0.7">
|
||||||
|
<path fill="#000000" fill-rule="evenodd" clip-rule="evenodd"
|
||||||
|
stroke="#ffffff"
|
||||||
|
stroke-width="4"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
stroke-linecap="round"
|
||||||
|
d="M65.5 62
|
||||||
|
L78 49
|
||||||
|
C73.5 44.5 69.5 42 63 44
|
||||||
|
L45 31 C47 25 46 22 41.5 18
|
||||||
|
L19 41.5
|
||||||
|
C23 45.5 25 46.5 31 45
|
||||||
|
L44 62.5
|
||||||
|
C42.3 69 45 73.5 49 78
|
||||||
|
L61.5 65.5
|
||||||
|
L84 87
|
||||||
|
L87 87
|
||||||
|
L87.5 86.5
|
||||||
|
L87.5 83.5 Z" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
|
||||||
|
After Width: | Height: | Size: 736 B |
|
|
@ -363,6 +363,6 @@
|
||||||
d="m 38.011063,984.77381 -10.143601,-5.23583 -10.063711,5.38779 1.845023,-11.2651 -8.233948,-7.90624 11.283888,-1.72639 4.974851,-10.27411 5.128803,10.19813 11.308575,1.55649 -8.114112,8.02918 z"
|
d="m 38.011063,984.77381 -10.143601,-5.23583 -10.063711,5.38779 1.845023,-11.2651 -8.233948,-7.90624 11.283888,-1.72639 4.974851,-10.27411 5.128803,10.19813 11.308575,1.55649 -8.114112,8.02918 z"
|
||||||
inkscape:transform-center-x="0.094945927"
|
inkscape:transform-center-x="0.094945927"
|
||||||
inkscape:transform-center-y="-3.9764964"
|
inkscape:transform-center-y="-3.9764964"
|
||||||
transform="matrix(2.3768784,0,0,2.4799382,-15.920285,-1400.1716)" />
|
transform="matrix(-2.3768784,0,0,2.4799382,115.920285,-1400.1716)" />
|
||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
|
@ -6,9 +6,10 @@
|
||||||
|
|
||||||
#ifndef INTERFACE_JSON_DECK_PARSER_H
|
#ifndef INTERFACE_JSON_DECK_PARSER_H
|
||||||
#define INTERFACE_JSON_DECK_PARSER_H
|
#define INTERFACE_JSON_DECK_PARSER_H
|
||||||
|
#include "../../../interface/deck_loader/deck_loader.h"
|
||||||
|
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <libcockatrice/models/deck_list/deck_loader.h>
|
|
||||||
|
|
||||||
class IJsonDeckParser
|
class IJsonDeckParser
|
||||||
{
|
{
|
||||||
|
|
@ -23,13 +24,13 @@ class ArchidektJsonParser : public IJsonDeckParser
|
||||||
public:
|
public:
|
||||||
DeckLoader *parse(const QJsonObject &obj) override
|
DeckLoader *parse(const QJsonObject &obj) override
|
||||||
{
|
{
|
||||||
DeckLoader *list = new DeckLoader();
|
DeckLoader *loader = new DeckLoader(nullptr);
|
||||||
|
|
||||||
QString deckName = obj.value("name").toString();
|
QString deckName = obj.value("name").toString();
|
||||||
QString deckDescription = obj.value("description").toString();
|
QString deckDescription = obj.value("description").toString();
|
||||||
|
|
||||||
list->setName(deckName);
|
loader->getDeckList()->setName(deckName);
|
||||||
list->setComments(deckDescription);
|
loader->getDeckList()->setComments(deckDescription);
|
||||||
|
|
||||||
QString outputText;
|
QString outputText;
|
||||||
QTextStream outStream(&outputText);
|
QTextStream outStream(&outputText);
|
||||||
|
|
@ -46,10 +47,10 @@ public:
|
||||||
outStream << quantity << ' ' << cardName << " (" << setName << ") " << collectorNumber << '\n';
|
outStream << quantity << ' ' << cardName << " (" << setName << ") " << collectorNumber << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
list->loadFromStream_Plain(outStream, false);
|
loader->getDeckList()->loadFromStream_Plain(outStream, false);
|
||||||
list->resolveSetNameAndNumberToProviderID();
|
loader->resolveSetNameAndNumberToProviderID();
|
||||||
|
|
||||||
return list;
|
return loader;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -58,13 +59,13 @@ class MoxfieldJsonParser : public IJsonDeckParser
|
||||||
public:
|
public:
|
||||||
DeckLoader *parse(const QJsonObject &obj) override
|
DeckLoader *parse(const QJsonObject &obj) override
|
||||||
{
|
{
|
||||||
DeckLoader *list = new DeckLoader();
|
DeckLoader *loader = new DeckLoader(nullptr);
|
||||||
|
|
||||||
QString deckName = obj.value("name").toString();
|
QString deckName = obj.value("name").toString();
|
||||||
QString deckDescription = obj.value("description").toString();
|
QString deckDescription = obj.value("description").toString();
|
||||||
|
|
||||||
list->setName(deckName);
|
loader->getDeckList()->setName(deckName);
|
||||||
list->setComments(deckDescription);
|
loader->getDeckList()->setComments(deckDescription);
|
||||||
|
|
||||||
QString outputText;
|
QString outputText;
|
||||||
QTextStream outStream(&outputText);
|
QTextStream outStream(&outputText);
|
||||||
|
|
@ -93,8 +94,8 @@ public:
|
||||||
outStream << quantity << ' ' << cardName << " (" << setName << ") " << collectorNumber << '\n';
|
outStream << quantity << ' ' << cardName << " (" << setName << ") " << collectorNumber << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
list->loadFromStream_Plain(outStream, false);
|
loader->getDeckList()->loadFromStream_Plain(outStream, false);
|
||||||
list->resolveSetNameAndNumberToProviderID();
|
loader->resolveSetNameAndNumberToProviderID();
|
||||||
|
|
||||||
QJsonObject commandersObj = obj.value("commanders").toObject();
|
QJsonObject commandersObj = obj.value("commanders").toObject();
|
||||||
if (!commandersObj.isEmpty()) {
|
if (!commandersObj.isEmpty()) {
|
||||||
|
|
@ -105,12 +106,12 @@ public:
|
||||||
QString collectorNumber = cardData.value("cn").toString();
|
QString collectorNumber = cardData.value("cn").toString();
|
||||||
QString providerId = cardData.value("scryfall_id").toString();
|
QString providerId = cardData.value("scryfall_id").toString();
|
||||||
|
|
||||||
list->setBannerCard({commanderName, providerId});
|
loader->getDeckList()->setBannerCard({commanderName, providerId});
|
||||||
list->addCard(commanderName, DECK_ZONE_MAIN, -1, setName, collectorNumber, providerId);
|
loader->getDeckList()->addCard(commanderName, DECK_ZONE_MAIN, -1, setName, collectorNumber, providerId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return loader;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include "../../../../interface/window_main.h"
|
#include "../../../../interface/window_main.h"
|
||||||
#include "../../../../main.h"
|
#include "../../../../main.h"
|
||||||
|
#include "../../../settings/cache_settings.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QCryptographicHash>
|
#include <QCryptographicHash>
|
||||||
|
|
@ -15,7 +16,6 @@
|
||||||
#include <QtConcurrent>
|
#include <QtConcurrent>
|
||||||
#include <libcockatrice/card/database/card_database.h>
|
#include <libcockatrice/card/database/card_database.h>
|
||||||
#include <libcockatrice/card/database/card_database_manager.h>
|
#include <libcockatrice/card/database/card_database_manager.h>
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
|
|
||||||
#define SPOILERS_STATUS_URL "https://raw.githubusercontent.com/Cockatrice/Magic-Spoiler/files/SpoilerSeasonEnabled"
|
#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"
|
#define SPOILERS_URL "https://raw.githubusercontent.com/Cockatrice/Magic-Spoiler/files/spoiler.xml"
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
#include "client_update_checker.h"
|
#include "client_update_checker.h"
|
||||||
|
|
||||||
|
#include "../../../settings/cache_settings.h"
|
||||||
#include "release_channel.h"
|
#include "release_channel.h"
|
||||||
|
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
|
|
||||||
ClientUpdateChecker::ClientUpdateChecker(QObject *parent) : QObject(parent)
|
ClientUpdateChecker::ClientUpdateChecker(QObject *parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
#include "cache_settings.h"
|
#include "cache_settings.h"
|
||||||
|
|
||||||
#include "../../../cockatrice/src/client/network/update/client/release_channel.h"
|
#include "../network/update/client/release_channel.h"
|
||||||
#include "card_counter_settings.h"
|
#include "card_counter_settings.h"
|
||||||
#include "card_override_settings.h"
|
|
||||||
|
|
||||||
#include <QAbstractListModel>
|
#include <QAbstractListModel>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
|
@ -12,9 +11,15 @@
|
||||||
#include <QGlobalStatic>
|
#include <QGlobalStatic>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
|
#include <libcockatrice/settings/card_override_settings.h>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
Q_GLOBAL_STATIC(SettingsCache, settingsCache);
|
Q_GLOBAL_STATIC(SettingsCache, settingsCache)
|
||||||
|
|
||||||
|
SettingsCache &SettingsCache::instance()
|
||||||
|
{
|
||||||
|
return *settingsCache; // returns a QT managed singleton reference
|
||||||
|
}
|
||||||
|
|
||||||
QString SettingsCache::getDataPath()
|
QString SettingsCache::getDataPath()
|
||||||
{
|
{
|
||||||
|
|
@ -61,9 +66,9 @@ void SettingsCache::translateLegacySettings()
|
||||||
QStringList setsGroups = legacySetting.childGroups();
|
QStringList setsGroups = legacySetting.childGroups();
|
||||||
for (int i = 0; i < setsGroups.size(); i++) {
|
for (int i = 0; i < setsGroups.size(); i++) {
|
||||||
legacySetting.beginGroup(setsGroups.at(i));
|
legacySetting.beginGroup(setsGroups.at(i));
|
||||||
cardDatabase().setEnabled(setsGroups.at(i), legacySetting.value("enabled").toBool());
|
cardDatabase()->setEnabled(setsGroups.at(i), legacySetting.value("enabled").toBool());
|
||||||
cardDatabase().setIsKnown(setsGroups.at(i), legacySetting.value("isknown").toBool());
|
cardDatabase()->setIsKnown(setsGroups.at(i), legacySetting.value("isknown").toBool());
|
||||||
cardDatabase().setSortKey(setsGroups.at(i), legacySetting.value("sortkey").toUInt());
|
cardDatabase()->setSortKey(setsGroups.at(i), legacySetting.value("sortkey").toUInt());
|
||||||
legacySetting.endGroup();
|
legacySetting.endGroup();
|
||||||
}
|
}
|
||||||
QStringList setsKeys = legacySetting.allKeys();
|
QStringList setsKeys = legacySetting.allKeys();
|
||||||
|
|
@ -1500,11 +1505,6 @@ void SettingsCache::resetPaths()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsCache &SettingsCache::instance()
|
|
||||||
{
|
|
||||||
return *settingsCache;
|
|
||||||
}
|
|
||||||
|
|
||||||
CardCounterSettings &SettingsCache::cardCounters() const
|
CardCounterSettings &SettingsCache::cardCounters() const
|
||||||
{
|
{
|
||||||
return *cardCounterSettings;
|
return *cardCounterSettings;
|
||||||
|
|
@ -7,15 +7,6 @@
|
||||||
#ifndef SETTINGSCACHE_H
|
#ifndef SETTINGSCACHE_H
|
||||||
#define SETTINGSCACHE_H
|
#define SETTINGSCACHE_H
|
||||||
|
|
||||||
#include "card_database_settings.h"
|
|
||||||
#include "card_override_settings.h"
|
|
||||||
#include "debug_settings.h"
|
|
||||||
#include "download_settings.h"
|
|
||||||
#include "game_filters_settings.h"
|
|
||||||
#include "layouts_settings.h"
|
|
||||||
#include "message_settings.h"
|
|
||||||
#include "recents_settings.h"
|
|
||||||
#include "servers_settings.h"
|
|
||||||
#include "shortcuts_settings.h"
|
#include "shortcuts_settings.h"
|
||||||
|
|
||||||
#include <QDate>
|
#include <QDate>
|
||||||
|
|
@ -23,6 +14,17 @@
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QSize>
|
#include <QSize>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
#include <libcockatrice/interfaces/interface_card_database_path_provider.h>
|
||||||
|
#include <libcockatrice/interfaces/interface_network_settings_provider.h>
|
||||||
|
#include <libcockatrice/settings/card_database_settings.h>
|
||||||
|
#include <libcockatrice/settings/card_override_settings.h>
|
||||||
|
#include <libcockatrice/settings/debug_settings.h>
|
||||||
|
#include <libcockatrice/settings/download_settings.h>
|
||||||
|
#include <libcockatrice/settings/game_filters_settings.h>
|
||||||
|
#include <libcockatrice/settings/layouts_settings.h>
|
||||||
|
#include <libcockatrice/settings/message_settings.h>
|
||||||
|
#include <libcockatrice/settings/recents_settings.h>
|
||||||
|
#include <libcockatrice/settings/servers_settings.h>
|
||||||
#include <libcockatrice/utility/macros.h>
|
#include <libcockatrice/utility/macros.h>
|
||||||
|
|
||||||
inline Q_LOGGING_CATEGORY(SettingsCacheLog, "settings_cache");
|
inline Q_LOGGING_CATEGORY(SettingsCacheLog, "settings_cache");
|
||||||
|
|
@ -132,14 +134,13 @@ inline QStringList defaultTags = {
|
||||||
class QSettings;
|
class QSettings;
|
||||||
class CardCounterSettings;
|
class CardCounterSettings;
|
||||||
|
|
||||||
class SettingsCache : public QObject
|
class SettingsCache : public ICardDatabasePathProvider, public INetworkSettingsProvider
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void langChanged();
|
void langChanged();
|
||||||
void picsPathChanged();
|
void picsPathChanged();
|
||||||
void cardDatabasePathChanged();
|
|
||||||
void themeChanged();
|
void themeChanged();
|
||||||
void homeTabBackgroundSourceChanged();
|
void homeTabBackgroundSourceChanged();
|
||||||
void homeTabBackgroundShuffleFrequencyChanged();
|
void homeTabBackgroundShuffleFrequencyChanged();
|
||||||
|
|
@ -374,19 +375,19 @@ public:
|
||||||
{
|
{
|
||||||
return customPicsPath;
|
return customPicsPath;
|
||||||
}
|
}
|
||||||
QString getCustomCardDatabasePath() const
|
QString getCustomCardDatabasePath() const override
|
||||||
{
|
{
|
||||||
return customCardDatabasePath;
|
return customCardDatabasePath;
|
||||||
}
|
}
|
||||||
QString getCardDatabasePath() const
|
QString getCardDatabasePath() const override
|
||||||
{
|
{
|
||||||
return cardDatabasePath;
|
return cardDatabasePath;
|
||||||
}
|
}
|
||||||
QString getSpoilerCardDatabasePath() const
|
QString getSpoilerCardDatabasePath() const override
|
||||||
{
|
{
|
||||||
return spoilerDatabasePath;
|
return spoilerDatabasePath;
|
||||||
}
|
}
|
||||||
QString getTokenDatabasePath() const
|
QString getTokenDatabasePath() const override
|
||||||
{
|
{
|
||||||
return tokenDatabasePath;
|
return tokenDatabasePath;
|
||||||
}
|
}
|
||||||
|
|
@ -483,7 +484,7 @@ public:
|
||||||
return getLastCardUpdateCheck().daysTo(QDateTime::currentDateTime().date()) >= getCardUpdateCheckInterval() &&
|
return getLastCardUpdateCheck().daysTo(QDateTime::currentDateTime().date()) >= getCardUpdateCheckInterval() &&
|
||||||
getLastCardUpdateCheck() != QDateTime::currentDateTime().date();
|
getLastCardUpdateCheck() != QDateTime::currentDateTime().date();
|
||||||
}
|
}
|
||||||
bool getNotifyAboutUpdates() const
|
bool getNotifyAboutUpdates() const override
|
||||||
{
|
{
|
||||||
return notifyAboutUpdates;
|
return notifyAboutUpdates;
|
||||||
}
|
}
|
||||||
|
|
@ -835,11 +836,11 @@ public:
|
||||||
{
|
{
|
||||||
return rememberGameSettings;
|
return rememberGameSettings;
|
||||||
}
|
}
|
||||||
int getKeepAlive() const
|
int getKeepAlive() const override
|
||||||
{
|
{
|
||||||
return keepalive;
|
return keepalive;
|
||||||
}
|
}
|
||||||
int getTimeOut() const
|
int getTimeOut() const override
|
||||||
{
|
{
|
||||||
return timeout;
|
return timeout;
|
||||||
}
|
}
|
||||||
|
|
@ -849,13 +850,13 @@ public:
|
||||||
}
|
}
|
||||||
void setClientID(const QString &clientID);
|
void setClientID(const QString &clientID);
|
||||||
void setClientVersion(const QString &clientVersion);
|
void setClientVersion(const QString &clientVersion);
|
||||||
void setKnownMissingFeatures(const QString &_knownMissingFeatures);
|
void setKnownMissingFeatures(const QString &_knownMissingFeatures) override;
|
||||||
void setUseTearOffMenus(bool _useTearOffMenus);
|
void setUseTearOffMenus(bool _useTearOffMenus);
|
||||||
void setCardViewInitialRowsMax(int _cardViewInitialRowsMax);
|
void setCardViewInitialRowsMax(int _cardViewInitialRowsMax);
|
||||||
void setCardViewExpandedRowsMax(int value);
|
void setCardViewExpandedRowsMax(int value);
|
||||||
void setCloseEmptyCardView(QT_STATE_CHANGED_T value);
|
void setCloseEmptyCardView(QT_STATE_CHANGED_T value);
|
||||||
void setFocusCardViewSearchBar(QT_STATE_CHANGED_T value);
|
void setFocusCardViewSearchBar(QT_STATE_CHANGED_T value);
|
||||||
QString getClientID()
|
QString getClientID() override
|
||||||
{
|
{
|
||||||
return clientID;
|
return clientID;
|
||||||
}
|
}
|
||||||
|
|
@ -863,7 +864,7 @@ public:
|
||||||
{
|
{
|
||||||
return clientVersion;
|
return clientVersion;
|
||||||
}
|
}
|
||||||
QString getKnownMissingFeatures()
|
QString getKnownMissingFeatures() override
|
||||||
{
|
{
|
||||||
return knownMissingFeatures;
|
return knownMissingFeatures;
|
||||||
}
|
}
|
||||||
|
|
@ -891,9 +892,9 @@ public:
|
||||||
{
|
{
|
||||||
return *shortcutsSettings;
|
return *shortcutsSettings;
|
||||||
}
|
}
|
||||||
CardDatabaseSettings &cardDatabase() const
|
CardDatabaseSettings *cardDatabase() const
|
||||||
{
|
{
|
||||||
return *cardDatabaseSettings;
|
return cardDatabaseSettings;
|
||||||
}
|
}
|
||||||
ServersSettings &servers() const
|
ServersSettings &servers() const
|
||||||
{
|
{
|
||||||
|
|
@ -7,9 +7,8 @@
|
||||||
#ifndef CARD_COUNTER_SETTINGS_H
|
#ifndef CARD_COUNTER_SETTINGS_H
|
||||||
#define CARD_COUNTER_SETTINGS_H
|
#define CARD_COUNTER_SETTINGS_H
|
||||||
|
|
||||||
#include "settings_manager.h"
|
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <libcockatrice/settings/settings_manager.h>
|
||||||
|
|
||||||
class QSettings;
|
class QSettings;
|
||||||
class QColor;
|
class QColor;
|
||||||
|
|
@ -33,6 +33,7 @@ public:
|
||||||
Move_bottom,
|
Move_bottom,
|
||||||
Gameplay,
|
Gameplay,
|
||||||
Drawing,
|
Drawing,
|
||||||
|
Hand,
|
||||||
Chat_room,
|
Chat_room,
|
||||||
Game_window,
|
Game_window,
|
||||||
Load_deck,
|
Load_deck,
|
||||||
|
|
@ -71,6 +72,8 @@ public:
|
||||||
return QApplication::translate("shortcutsTab", "Gameplay");
|
return QApplication::translate("shortcutsTab", "Gameplay");
|
||||||
case Drawing:
|
case Drawing:
|
||||||
return QApplication::translate("shortcutsTab", "Drawing");
|
return QApplication::translate("shortcutsTab", "Drawing");
|
||||||
|
case Hand:
|
||||||
|
return QApplication::translate("shortcutsTab", "Hand");
|
||||||
case Chat_room:
|
case Chat_room:
|
||||||
return QApplication::translate("shortcutsTab", "Chat Room");
|
return QApplication::translate("shortcutsTab", "Chat Room");
|
||||||
case Game_window:
|
case Game_window:
|
||||||
|
|
@ -540,6 +543,9 @@ private:
|
||||||
{"Player/aSelectColumn", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Select All Cards in Column"),
|
{"Player/aSelectColumn", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Select All Cards in Column"),
|
||||||
parseSequenceString("Ctrl+Shift+C"),
|
parseSequenceString("Ctrl+Shift+C"),
|
||||||
ShortcutGroup::Playing_Area)},
|
ShortcutGroup::Playing_Area)},
|
||||||
|
{"Player/aRevealToAll", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Reveal Selected Cards to All Players"),
|
||||||
|
parseSequenceString(""),
|
||||||
|
ShortcutGroup::Playing_Area)},
|
||||||
{"Player/aMoveToBottomLibrary", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Bottom of Library"),
|
{"Player/aMoveToBottomLibrary", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Bottom of Library"),
|
||||||
parseSequenceString("Ctrl+B"),
|
parseSequenceString("Ctrl+B"),
|
||||||
ShortcutGroup::Move_selected)},
|
ShortcutGroup::Move_selected)},
|
||||||
|
|
@ -562,9 +568,6 @@ private:
|
||||||
ShortcutGroup::Move_selected)},
|
ShortcutGroup::Move_selected)},
|
||||||
{"Player/aViewHand",
|
{"Player/aViewHand",
|
||||||
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Hand"), parseSequenceString(""), ShortcutGroup::View)},
|
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Hand"), parseSequenceString(""), ShortcutGroup::View)},
|
||||||
{"Player/aSortHand", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Sort Hand"),
|
|
||||||
parseSequenceString("Ctrl+Shift+H"),
|
|
||||||
ShortcutGroup::View)},
|
|
||||||
{"Player/aViewGraveyard",
|
{"Player/aViewGraveyard",
|
||||||
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Graveyard"), parseSequenceString("F4"), ShortcutGroup::View)},
|
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Graveyard"), parseSequenceString("F4"), ShortcutGroup::View)},
|
||||||
{"Player/aViewLibrary",
|
{"Player/aViewLibrary",
|
||||||
|
|
@ -672,6 +675,22 @@ private:
|
||||||
{"Player/aAlwaysLookAtTopCard", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Always Look At Top Card"),
|
{"Player/aAlwaysLookAtTopCard", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Always Look At Top Card"),
|
||||||
parseSequenceString("Ctrl+Shift+N"),
|
parseSequenceString("Ctrl+Shift+N"),
|
||||||
ShortcutGroup::Drawing)},
|
ShortcutGroup::Drawing)},
|
||||||
|
{"Player/aSortHandByName", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Sort Hand by Name"),
|
||||||
|
parseSequenceString(""),
|
||||||
|
ShortcutGroup::Hand)},
|
||||||
|
{"Player/aSortHandByType", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Sort Hand by Type"),
|
||||||
|
parseSequenceString("Ctrl+Shift+H"),
|
||||||
|
ShortcutGroup::Hand)},
|
||||||
|
{"Player/aSortHandByManaValue", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Sort Hand by Mana Value"),
|
||||||
|
parseSequenceString(""),
|
||||||
|
ShortcutGroup::Hand)},
|
||||||
|
{"Player/aRevealHandToAll", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Reveal Hand to All Players"),
|
||||||
|
parseSequenceString(""),
|
||||||
|
ShortcutGroup::Hand)},
|
||||||
|
{"Player/aRevealRandomHandCardToAll",
|
||||||
|
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Reveal Random Card to All Players"),
|
||||||
|
parseSequenceString(""),
|
||||||
|
ShortcutGroup::Hand)},
|
||||||
{"Player/aRotateViewCW", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Rotate View Clockwise"),
|
{"Player/aRotateViewCW", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Rotate View Clockwise"),
|
||||||
parseSequenceString(""),
|
parseSequenceString(""),
|
||||||
ShortcutGroup::Gameplay)},
|
ShortcutGroup::Gameplay)},
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
#include "sound_engine.h"
|
#include "sound_engine.h"
|
||||||
|
|
||||||
|
#include "settings/cache_settings.h"
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QMediaPlayer>
|
#include <QMediaPlayer>
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
#include <QAudioOutput>
|
#include <QAudioOutput>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
#ifndef COCKATRICE_SETTINGS_CARD_PREFERENCE_PROVIDER_H
|
||||||
|
#define COCKATRICE_SETTINGS_CARD_PREFERENCE_PROVIDER_H
|
||||||
|
#include "../../client/settings/cache_settings.h"
|
||||||
|
|
||||||
|
#include <libcockatrice/interfaces/interface_card_preference_provider.h>
|
||||||
|
|
||||||
|
class SettingsCardPreferenceProvider : public ICardPreferenceProvider
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
QString getCardPreferenceOverride(const QString &cardName) const override
|
||||||
|
{
|
||||||
|
return SettingsCache::instance().cardOverrides().getCardPreferenceOverride(cardName);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool getIncludeRebalancedCards() const override
|
||||||
|
{
|
||||||
|
return SettingsCache::instance().getIncludeRebalancedCards();
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // COCKATRICE_SETTINGS_CARD_PREFERENCE_PROVIDER_H
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
#include "deck_filter_string.h"
|
#include "deck_filter_string.h"
|
||||||
|
|
||||||
#include "filter_string.h"
|
|
||||||
|
|
||||||
#include <libcockatrice/card/database/card_database_manager.h>
|
#include <libcockatrice/card/database/card_database_manager.h>
|
||||||
|
#include <libcockatrice/filters/filter_string.h>
|
||||||
#include <libcockatrice/utility/peglib.h>
|
#include <libcockatrice/utility/peglib.h>
|
||||||
|
|
||||||
static peg::parser search(R"(
|
static peg::parser search(R"(
|
||||||
|
|
@ -118,7 +117,7 @@ static void setupParserRules()
|
||||||
|
|
||||||
return [=](const DeckPreviewWidget *deck, const ExtraDeckSearchInfo &) -> bool {
|
return [=](const DeckPreviewWidget *deck, const ExtraDeckSearchInfo &) -> bool {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
deck->deckLoader->forEachCard([&](InnerDecklistNode *, const DecklistCardNode *node) {
|
deck->deckLoader->getDeckList()->forEachCard([&](InnerDecklistNode *, const DecklistCardNode *node) {
|
||||||
auto cardInfoPtr = CardDatabaseManager::query()->getCardInfo(node->getName());
|
auto cardInfoPtr = CardDatabaseManager::query()->getCardInfo(node->getName());
|
||||||
if (!cardInfoPtr.isNull() && cardFilter.check(cardInfoPtr)) {
|
if (!cardInfoPtr.isNull() && cardFilter.check(cardInfoPtr)) {
|
||||||
count += node->getNumber();
|
count += node->getNumber();
|
||||||
|
|
@ -137,7 +136,7 @@ static void setupParserRules()
|
||||||
search["DeckNameQuery"] = [](const peg::SemanticValues &sv) -> DeckFilter {
|
search["DeckNameQuery"] = [](const peg::SemanticValues &sv) -> DeckFilter {
|
||||||
auto name = std::any_cast<QString>(sv[0]);
|
auto name = std::any_cast<QString>(sv[0]);
|
||||||
return [=](const DeckPreviewWidget *deck, const ExtraDeckSearchInfo &) {
|
return [=](const DeckPreviewWidget *deck, const ExtraDeckSearchInfo &) {
|
||||||
return deck->deckLoader->getName().contains(name, Qt::CaseInsensitive);
|
return deck->deckLoader->getDeckList()->getName().contains(name, Qt::CaseInsensitive);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
#include "filter_builder.h"
|
#include "filter_builder.h"
|
||||||
|
|
||||||
#include "../interface/widgets/utility/custom_line_edit.h"
|
#include "../interface/widgets/utility/custom_line_edit.h"
|
||||||
#include "filter_card.h"
|
|
||||||
|
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
#include <libcockatrice/filters/filter_card.h>
|
||||||
|
|
||||||
FilterBuilder::FilterBuilder(QWidget *parent) : QWidget(parent)
|
FilterBuilder::FilterBuilder(QWidget *parent) : QWidget(parent)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
#include "filter_tree_model.h"
|
#include "filter_tree_model.h"
|
||||||
|
|
||||||
#include "filter_card.h"
|
|
||||||
#include "filter_tree.h"
|
|
||||||
|
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
|
#include <libcockatrice/filters/filter_card.h>
|
||||||
|
#include <libcockatrice/filters/filter_tree.h>
|
||||||
|
|
||||||
FilterTreeModel::FilterTreeModel(QObject *parent) : QAbstractItemModel(parent)
|
FilterTreeModel::FilterTreeModel(QObject *parent) : QAbstractItemModel(parent)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,8 @@
|
||||||
#ifndef FILTERTREEMODEL_H
|
#ifndef FILTERTREEMODEL_H
|
||||||
#define FILTERTREEMODEL_H
|
#define FILTERTREEMODEL_H
|
||||||
|
|
||||||
#include "filter_card.h"
|
|
||||||
|
|
||||||
#include <QAbstractItemModel>
|
#include <QAbstractItemModel>
|
||||||
|
#include <libcockatrice/filters/filter_card.h>
|
||||||
|
|
||||||
class FilterTree;
|
class FilterTree;
|
||||||
class CardFilter;
|
class CardFilter;
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
#include "abstract_card_drag_item.h"
|
#include "abstract_card_drag_item.h"
|
||||||
|
|
||||||
|
#include "../../client/settings/cache_settings.h"
|
||||||
|
|
||||||
#include <QCursor>
|
#include <QCursor>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QGraphicsSceneMouseEvent>
|
#include <QGraphicsSceneMouseEvent>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
|
|
||||||
static const float CARD_WIDTH_HALF = CARD_WIDTH / 2;
|
static const float CARD_WIDTH_HALF = CARD_WIDTH / 2;
|
||||||
static const float CARD_HEIGHT_HALF = CARD_HEIGHT / 2;
|
static const float CARD_HEIGHT_HALF = CARD_HEIGHT / 2;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#include "abstract_card_item.h"
|
#include "abstract_card_item.h"
|
||||||
|
|
||||||
|
#include "../../client/settings/cache_settings.h"
|
||||||
#include "../../interface/card_picture_loader/card_picture_loader.h"
|
#include "../../interface/card_picture_loader/card_picture_loader.h"
|
||||||
#include "../game_scene.h"
|
#include "../game_scene.h"
|
||||||
|
|
||||||
|
|
@ -10,7 +11,6 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <libcockatrice/card/database/card_database.h>
|
#include <libcockatrice/card/database/card_database.h>
|
||||||
#include <libcockatrice/card/database/card_database_manager.h>
|
#include <libcockatrice/card/database/card_database_manager.h>
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
|
|
||||||
AbstractCardItem::AbstractCardItem(QGraphicsItem *parent, const CardRef &cardRef, Player *_owner, int _id)
|
AbstractCardItem::AbstractCardItem(QGraphicsItem *parent, const CardRef &cardRef, Player *_owner, int _id)
|
||||||
: ArrowTarget(_owner, parent), id(_id), cardRef(cardRef), tapped(false), facedown(false), tapAngle(0),
|
: ArrowTarget(_owner, parent), id(_id), cardRef(cardRef), tapped(false), facedown(false), tapAngle(0),
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#include "abstract_counter.h"
|
#include "abstract_counter.h"
|
||||||
|
|
||||||
|
#include "../../client/settings/cache_settings.h"
|
||||||
#include "../../interface/widgets/tabs/tab_game.h"
|
#include "../../interface/widgets/tabs/tab_game.h"
|
||||||
#include "../player/player.h"
|
#include "../player/player.h"
|
||||||
#include "translate_counter_name.h"
|
#include "translate_counter_name.h"
|
||||||
|
|
@ -14,7 +15,6 @@
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <libcockatrice/protocol/pb/command_inc_counter.pb.h>
|
#include <libcockatrice/protocol/pb/command_inc_counter.pb.h>
|
||||||
#include <libcockatrice/protocol/pb/command_set_counter.pb.h>
|
#include <libcockatrice/protocol/pb/command_set_counter.pb.h>
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
#include <libcockatrice/utility/expression.h>
|
#include <libcockatrice/utility/expression.h>
|
||||||
|
|
||||||
AbstractCounter::AbstractCounter(Player *_player,
|
AbstractCounter::AbstractCounter(Player *_player,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#define _USE_MATH_DEFINES
|
#define _USE_MATH_DEFINES
|
||||||
#include "arrow_item.h"
|
#include "arrow_item.h"
|
||||||
|
|
||||||
|
#include "../../client/settings/cache_settings.h"
|
||||||
#include "../player/player.h"
|
#include "../player/player.h"
|
||||||
#include "../player/player_target.h"
|
#include "../player/player_target.h"
|
||||||
#include "../zones/card_zone.h"
|
#include "../zones/card_zone.h"
|
||||||
|
|
@ -15,7 +16,6 @@
|
||||||
#include <libcockatrice/protocol/pb/command_attach_card.pb.h>
|
#include <libcockatrice/protocol/pb/command_attach_card.pb.h>
|
||||||
#include <libcockatrice/protocol/pb/command_create_arrow.pb.h>
|
#include <libcockatrice/protocol/pb/command_create_arrow.pb.h>
|
||||||
#include <libcockatrice/protocol/pb/command_delete_arrow.pb.h>
|
#include <libcockatrice/protocol/pb/command_delete_arrow.pb.h>
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
#include <libcockatrice/utility/color.h>
|
#include <libcockatrice/utility/color.h>
|
||||||
|
|
||||||
ArrowItem::ArrowItem(Player *_player, int _id, ArrowTarget *_startItem, ArrowTarget *_targetItem, const QColor &_color)
|
ArrowItem::ArrowItem(Player *_player, int _id, ArrowTarget *_startItem, ArrowTarget *_targetItem, const QColor &_color)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#include "card_item.h"
|
#include "card_item.h"
|
||||||
|
|
||||||
|
#include "../../client/settings/cache_settings.h"
|
||||||
#include "../../interface/widgets/tabs/tab_game.h"
|
#include "../../interface/widgets/tabs/tab_game.h"
|
||||||
#include "../game_scene.h"
|
#include "../game_scene.h"
|
||||||
#include "../player/player.h"
|
#include "../player/player.h"
|
||||||
|
|
@ -10,14 +11,13 @@
|
||||||
#include "arrow_item.h"
|
#include "arrow_item.h"
|
||||||
#include "card_drag_item.h"
|
#include "card_drag_item.h"
|
||||||
|
|
||||||
|
#include <../../client/settings/card_counter_settings.h>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QGraphicsSceneMouseEvent>
|
#include <QGraphicsSceneMouseEvent>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <libcockatrice/card/card_info.h>
|
#include <libcockatrice/card/card_info.h>
|
||||||
#include <libcockatrice/protocol/pb/serverinfo_card.pb.h>
|
#include <libcockatrice/protocol/pb/serverinfo_card.pb.h>
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
#include <libcockatrice/settings/card_counter_settings.h>
|
|
||||||
|
|
||||||
CardItem::CardItem(Player *_owner, QGraphicsItem *parent, const CardRef &cardRef, int _cardid, CardZoneLogic *_zone)
|
CardItem::CardItem(Player *_owner, QGraphicsItem *parent, const CardRef &cardRef, int _cardid, CardZoneLogic *_zone)
|
||||||
: AbstractCardItem(parent, cardRef, _owner, _cardid), zone(_zone), attacking(false), destroyOnZoneChange(false),
|
: AbstractCardItem(parent, cardRef, _owner, _cardid), zone(_zone), attacking(false), destroyOnZoneChange(false),
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#include "deck_view.h"
|
#include "deck_view.h"
|
||||||
|
|
||||||
|
#include "../../client/settings/cache_settings.h"
|
||||||
#include "../../interface/theme_manager.h"
|
#include "../../interface/theme_manager.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
|
@ -10,7 +11,6 @@
|
||||||
#include <libcockatrice/card/card_info.h>
|
#include <libcockatrice/card/card_info.h>
|
||||||
#include <libcockatrice/deck_list/deck_list.h>
|
#include <libcockatrice/deck_list/deck_list.h>
|
||||||
#include <libcockatrice/deck_list/deck_list_card_node.h>
|
#include <libcockatrice/deck_list/deck_list_card_node.h>
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
|
|
||||||
DeckViewCardDragItem::DeckViewCardDragItem(DeckViewCard *_item,
|
DeckViewCardDragItem::DeckViewCardDragItem(DeckViewCard *_item,
|
||||||
const QPointF &_hotSpot,
|
const QPointF &_hotSpot,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
#include "deck_view_container.h"
|
#include "deck_view_container.h"
|
||||||
|
|
||||||
|
#include "../../client/settings/cache_settings.h"
|
||||||
#include "../../interface/card_picture_loader/card_picture_loader.h"
|
#include "../../interface/card_picture_loader/card_picture_loader.h"
|
||||||
|
#include "../../interface/deck_loader/deck_loader.h"
|
||||||
#include "../../interface/widgets/dialogs/dlg_load_deck.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_clipboard.h"
|
||||||
#include "../../interface/widgets/dialogs/dlg_load_deck_from_website.h"
|
#include "../../interface/widgets/dialogs/dlg_load_deck_from_website.h"
|
||||||
|
|
@ -15,14 +17,12 @@
|
||||||
#include <google/protobuf/descriptor.h>
|
#include <google/protobuf/descriptor.h>
|
||||||
#include <libcockatrice/card/database/card_database.h>
|
#include <libcockatrice/card/database/card_database.h>
|
||||||
#include <libcockatrice/card/database/card_database_manager.h>
|
#include <libcockatrice/card/database/card_database_manager.h>
|
||||||
#include <libcockatrice/models/deck_list/deck_loader.h>
|
|
||||||
#include <libcockatrice/protocol/pb/command_deck_select.pb.h>
|
#include <libcockatrice/protocol/pb/command_deck_select.pb.h>
|
||||||
#include <libcockatrice/protocol/pb/command_ready_start.pb.h>
|
#include <libcockatrice/protocol/pb/command_ready_start.pb.h>
|
||||||
#include <libcockatrice/protocol/pb/command_set_sideboard_lock.pb.h>
|
#include <libcockatrice/protocol/pb/command_set_sideboard_lock.pb.h>
|
||||||
#include <libcockatrice/protocol/pb/command_set_sideboard_plan.pb.h>
|
#include <libcockatrice/protocol/pb/command_set_sideboard_plan.pb.h>
|
||||||
#include <libcockatrice/protocol/pb/response_deck_download.pb.h>
|
#include <libcockatrice/protocol/pb/response_deck_download.pb.h>
|
||||||
#include <libcockatrice/protocol/pending_command.h>
|
#include <libcockatrice/protocol/pending_command.h>
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
#include <libcockatrice/utility/trice_limits.h>
|
#include <libcockatrice/utility/trice_limits.h>
|
||||||
|
|
||||||
ToggleButton::ToggleButton(QWidget *parent) : QPushButton(parent), state(false)
|
ToggleButton::ToggleButton(QWidget *parent) : QPushButton(parent), state(false)
|
||||||
|
|
@ -264,7 +264,7 @@ void DeckViewContainer::loadLocalDeck()
|
||||||
void DeckViewContainer::loadDeckFromFile(const QString &filePath)
|
void DeckViewContainer::loadDeckFromFile(const QString &filePath)
|
||||||
{
|
{
|
||||||
DeckLoader::FileFormat fmt = DeckLoader::getFormatFromName(filePath);
|
DeckLoader::FileFormat fmt = DeckLoader::getFormatFromName(filePath);
|
||||||
DeckLoader deck;
|
DeckLoader deck(this);
|
||||||
|
|
||||||
bool success = deck.loadFromFile(filePath, fmt, true);
|
bool success = deck.loadFromFile(filePath, fmt, true);
|
||||||
|
|
||||||
|
|
@ -276,9 +276,9 @@ void DeckViewContainer::loadDeckFromFile(const QString &filePath)
|
||||||
loadDeckFromDeckLoader(&deck);
|
loadDeckFromDeckLoader(&deck);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeckViewContainer::loadDeckFromDeckLoader(const DeckLoader *deck)
|
void DeckViewContainer::loadDeckFromDeckLoader(DeckLoader *deck)
|
||||||
{
|
{
|
||||||
QString deckString = deck->writeToString_Native();
|
QString deckString = deck->getDeckList()->writeToString_Native();
|
||||||
|
|
||||||
if (deckString.length() > MAX_FILE_LENGTH) {
|
if (deckString.length() > MAX_FILE_LENGTH) {
|
||||||
QMessageBox::critical(this, tr("Error"), tr("Deck is greater than maximum file size."));
|
QMessageBox::critical(this, tr("Error"), tr("Deck is greater than maximum file size."));
|
||||||
|
|
@ -331,8 +331,9 @@ void DeckViewContainer::loadFromWebsite()
|
||||||
void DeckViewContainer::deckSelectFinished(const Response &r)
|
void DeckViewContainer::deckSelectFinished(const Response &r)
|
||||||
{
|
{
|
||||||
const Response_DeckDownload &resp = r.GetExtension(Response_DeckDownload::ext);
|
const Response_DeckDownload &resp = r.GetExtension(Response_DeckDownload::ext);
|
||||||
DeckLoader newDeck(QString::fromStdString(resp.deck()));
|
DeckLoader newDeck(this, new DeckList(QString::fromStdString(resp.deck())));
|
||||||
CardPictureLoader::cacheCardPixmaps(CardDatabaseManager::query()->getCards(newDeck.getCardRefList()));
|
CardPictureLoader::cacheCardPixmaps(
|
||||||
|
CardDatabaseManager::query()->getCards(newDeck.getDeckList()->getCardRefList()));
|
||||||
setDeck(newDeck);
|
setDeck(newDeck);
|
||||||
switchToDeckLoadedView();
|
switchToDeckLoadedView();
|
||||||
}
|
}
|
||||||
|
|
@ -413,8 +414,8 @@ void DeckViewContainer::setSideboardLocked(bool locked)
|
||||||
deckView->resetSideboardPlan();
|
deckView->resetSideboardPlan();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeckViewContainer::setDeck(const DeckLoader &deck)
|
void DeckViewContainer::setDeck(DeckLoader &deck)
|
||||||
{
|
{
|
||||||
deckView->setDeck(deck);
|
deckView->setDeck(*deck.getDeckList());
|
||||||
switchToDeckLoadedView();
|
switchToDeckLoadedView();
|
||||||
}
|
}
|
||||||
|
|
@ -7,8 +7,9 @@
|
||||||
#ifndef DECK_VIEW_CONTAINER_H
|
#ifndef DECK_VIEW_CONTAINER_H
|
||||||
#define DECK_VIEW_CONTAINER_H
|
#define DECK_VIEW_CONTAINER_H
|
||||||
|
|
||||||
|
#include "../../interface/deck_loader/deck_loader.h"
|
||||||
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <libcockatrice/models/deck_list/deck_loader.h>
|
|
||||||
|
|
||||||
class QVBoxLayout;
|
class QVBoxLayout;
|
||||||
class AbstractCardItem;
|
class AbstractCardItem;
|
||||||
|
|
@ -84,12 +85,12 @@ public:
|
||||||
void setReadyStart(bool ready);
|
void setReadyStart(bool ready);
|
||||||
void readyAndUpdate();
|
void readyAndUpdate();
|
||||||
void setSideboardLocked(bool locked);
|
void setSideboardLocked(bool locked);
|
||||||
void setDeck(const DeckLoader &deck);
|
void setDeck(DeckLoader &deck);
|
||||||
void setVisualDeckStorageExists(bool exists);
|
void setVisualDeckStorageExists(bool exists);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void loadDeckFromFile(const QString &filePath);
|
void loadDeckFromFile(const QString &filePath);
|
||||||
void loadDeckFromDeckLoader(const DeckLoader *deck);
|
void loadDeckFromDeckLoader(DeckLoader *deck);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DECK_VIEW_CONTAINER_H
|
#endif // DECK_VIEW_CONTAINER_H
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#include "dlg_create_token.h"
|
#include "dlg_create_token.h"
|
||||||
|
|
||||||
|
#include "../../client/settings/cache_settings.h"
|
||||||
#include "../../interface/widgets/cards/card_info_picture_widget.h"
|
#include "../../interface/widgets/cards/card_info_picture_widget.h"
|
||||||
#include "../../main.h"
|
#include "../../main.h"
|
||||||
|
|
||||||
|
|
@ -20,7 +21,6 @@
|
||||||
#include <libcockatrice/deck_list/deck_list.h>
|
#include <libcockatrice/deck_list/deck_list.h>
|
||||||
#include <libcockatrice/models/database/card_database_model.h>
|
#include <libcockatrice/models/database/card_database_model.h>
|
||||||
#include <libcockatrice/models/database/token/token_display_model.h>
|
#include <libcockatrice/models/database/token/token_display_model.h>
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
#include <libcockatrice/utility/trice_limits.h>
|
#include <libcockatrice/utility/trice_limits.h>
|
||||||
|
|
||||||
DlgCreateToken::DlgCreateToken(const QStringList &_predefinedTokens, QWidget *parent)
|
DlgCreateToken::DlgCreateToken(const QStringList &_predefinedTokens, QWidget *parent)
|
||||||
|
|
@ -199,16 +199,7 @@ void DlgCreateToken::tokenSelectionChanged(const QModelIndex ¤t, const QMo
|
||||||
annotationEdit->setText("");
|
annotationEdit->setText("");
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto &cardProviderId =
|
pic->setCard(CardDatabaseManager::query()->getPreferredCard(cardInfo));
|
||||||
SettingsCache::instance().cardOverrides().getCardPreferenceOverride(cardInfo->getName());
|
|
||||||
if (!cardProviderId.isEmpty()) {
|
|
||||||
CardRef ref;
|
|
||||||
ref.name = cardInfo->getName();
|
|
||||||
ref.providerId = cardProviderId;
|
|
||||||
pic->setCard(CardDatabaseManager::query()->getCard(ref));
|
|
||||||
} else {
|
|
||||||
pic->setCard(CardDatabaseManager::query()->getPreferredCard(cardInfo));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlgCreateToken::updateSearchFieldWithoutUpdatingFilter(const QString &newValue) const
|
void DlgCreateToken::updateSearchFieldWithoutUpdatingFilter(const QString &newValue) const
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
#include "dlg_move_top_cards_until.h"
|
#include "dlg_move_top_cards_until.h"
|
||||||
|
|
||||||
#include "../../filters/filter_string.h"
|
|
||||||
|
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
|
@ -12,6 +10,7 @@
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <libcockatrice/card/database/card_database.h>
|
#include <libcockatrice/card/database/card_database.h>
|
||||||
#include <libcockatrice/card/database/card_database_manager.h>
|
#include <libcockatrice/card/database/card_database_manager.h>
|
||||||
|
#include <libcockatrice/filters/filter_string.h>
|
||||||
|
|
||||||
DlgMoveTopCardsUntil::DlgMoveTopCardsUntil(QWidget *parent, QStringList exprs, uint _numberOfHits, bool autoPlay)
|
DlgMoveTopCardsUntil::DlgMoveTopCardsUntil(QWidget *parent, QStringList exprs, uint _numberOfHits, bool autoPlay)
|
||||||
: QDialog(parent)
|
: QDialog(parent)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#include "game_scene.h"
|
#include "game_scene.h"
|
||||||
|
|
||||||
|
#include "../client/settings/cache_settings.h"
|
||||||
#include "board/card_item.h"
|
#include "board/card_item.h"
|
||||||
#include "phases_toolbar.h"
|
#include "phases_toolbar.h"
|
||||||
#include "player/player.h"
|
#include "player/player.h"
|
||||||
|
|
@ -14,7 +15,6 @@
|
||||||
#include <QGraphicsView>
|
#include <QGraphicsView>
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
#include <QtMath>
|
#include <QtMath>
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
#include "game_view.h"
|
#include "game_view.h"
|
||||||
|
|
||||||
|
#include "../client/settings/cache_settings.h"
|
||||||
#include "game_scene.h"
|
#include "game_scene.h"
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QResizeEvent>
|
#include <QResizeEvent>
|
||||||
#include <QRubberBand>
|
#include <QRubberBand>
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
|
|
||||||
GameView::GameView(GameScene *scene, QWidget *parent) : QGraphicsView(scene, parent), rubberBand(0)
|
GameView::GameView(GameScene *scene, QWidget *parent) : QGraphicsView(scene, parent), rubberBand(0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,10 @@
|
||||||
#include "../player/player.h"
|
#include "../player/player.h"
|
||||||
#include "../zones/card_zone.h"
|
#include "../zones/card_zone.h"
|
||||||
|
|
||||||
|
#include <../../client/settings/card_counter_settings.h>
|
||||||
#include <libcockatrice/protocol/pb/context_move_card.pb.h>
|
#include <libcockatrice/protocol/pb/context_move_card.pb.h>
|
||||||
#include <libcockatrice/protocol/pb/context_mulligan.pb.h>
|
#include <libcockatrice/protocol/pb/context_mulligan.pb.h>
|
||||||
#include <libcockatrice/protocol/pb/serverinfo_user.pb.h>
|
#include <libcockatrice/protocol/pb/serverinfo_user.pb.h>
|
||||||
#include <libcockatrice/settings/card_counter_settings.h>
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
static const QString TABLE_ZONE_NAME = "table";
|
static const QString TABLE_ZONE_NAME = "table";
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#include "card_menu.h"
|
#include "card_menu.h"
|
||||||
|
|
||||||
|
#include "../../../client/settings/card_counter_settings.h"
|
||||||
#include "../../../interface/widgets/tabs/tab_game.h"
|
#include "../../../interface/widgets/tabs/tab_game.h"
|
||||||
#include "../../board/card_item.h"
|
#include "../../board/card_item.h"
|
||||||
#include "../../zones/logic/view_zone_logic.h"
|
#include "../../zones/logic/view_zone_logic.h"
|
||||||
|
|
@ -11,7 +12,6 @@
|
||||||
|
|
||||||
#include <libcockatrice/card/database/card_database_manager.h>
|
#include <libcockatrice/card/database/card_database_manager.h>
|
||||||
#include <libcockatrice/card/relation/card_relation.h>
|
#include <libcockatrice/card/relation/card_relation.h>
|
||||||
#include <libcockatrice/settings/card_counter_settings.h>
|
|
||||||
|
|
||||||
CardMenu::CardMenu(Player *_player, const CardItem *_card, bool _shortcutsActive)
|
CardMenu::CardMenu(Player *_player, const CardItem *_card, bool _shortcutsActive)
|
||||||
: player(_player), card(_card), shortcutsActive(_shortcutsActive)
|
: player(_player), card(_card), shortcutsActive(_shortcutsActive)
|
||||||
|
|
@ -66,6 +66,8 @@ CardMenu::CardMenu(Player *_player, const CardItem *_card, bool _shortcutsActive
|
||||||
aPlayFacedown = new QAction(this);
|
aPlayFacedown = new QAction(this);
|
||||||
connect(aPlayFacedown, &QAction::triggered, playerActions, &PlayerActions::actPlayFacedown);
|
connect(aPlayFacedown, &QAction::triggered, playerActions, &PlayerActions::actPlayFacedown);
|
||||||
|
|
||||||
|
aRevealToAll = new QAction(this);
|
||||||
|
|
||||||
mCardCounters = new QMenu;
|
mCardCounters = new QMenu;
|
||||||
|
|
||||||
for (int i = 0; i < 6; ++i) {
|
for (int i = 0; i < 6; ++i) {
|
||||||
|
|
@ -274,7 +276,7 @@ void CardMenu::createHandOrCustomZoneMenu()
|
||||||
|
|
||||||
QMenu *revealMenu = addMenu(tr("Re&veal to..."));
|
QMenu *revealMenu = addMenu(tr("Re&veal to..."));
|
||||||
|
|
||||||
initContextualPlayersMenu(revealMenu);
|
initContextualPlayersMenu(revealMenu, aRevealToAll);
|
||||||
|
|
||||||
connect(revealMenu, &QMenu::triggered, player->getPlayerActions(), &PlayerActions::actReveal);
|
connect(revealMenu, &QMenu::triggered, player->getPlayerActions(), &PlayerActions::actReveal);
|
||||||
|
|
||||||
|
|
@ -301,9 +303,19 @@ void CardMenu::createHandOrCustomZoneMenu()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CardMenu::initContextualPlayersMenu(QMenu *menu)
|
/**
|
||||||
|
* @brief Populates the menu with an action for each active player.
|
||||||
|
*
|
||||||
|
* The "all players" action is created separately, so it has to be passed into this function.
|
||||||
|
* It will be put at the top of the menu.
|
||||||
|
*
|
||||||
|
* @param menu The menu to add the player actions to.
|
||||||
|
* @param allPlayersAction The action for "all players".
|
||||||
|
*/
|
||||||
|
void CardMenu::initContextualPlayersMenu(QMenu *menu, QAction *allPlayersAction)
|
||||||
{
|
{
|
||||||
menu->addAction(tr("&All players"))->setData(-1);
|
allPlayersAction->setData(-1);
|
||||||
|
menu->addAction(allPlayersAction);
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
|
|
||||||
for (const auto &playerInfo : playersInfo) {
|
for (const auto &playerInfo : playersInfo) {
|
||||||
|
|
@ -431,6 +443,7 @@ void CardMenu::retranslateUi()
|
||||||
aPlay->setText(tr("&Play"));
|
aPlay->setText(tr("&Play"));
|
||||||
aHide->setText(tr("&Hide"));
|
aHide->setText(tr("&Hide"));
|
||||||
aPlayFacedown->setText(tr("Play &Face Down"));
|
aPlayFacedown->setText(tr("Play &Face Down"));
|
||||||
|
aRevealToAll->setText(tr("&All players"));
|
||||||
//: Turn sideways or back again
|
//: Turn sideways or back again
|
||||||
aTap->setText(tr("&Tap / Untap"));
|
aTap->setText(tr("&Tap / Untap"));
|
||||||
aDoesntUntap->setText(tr("Toggle &normal untapping"));
|
aDoesntUntap->setText(tr("Toggle &normal untapping"));
|
||||||
|
|
@ -466,6 +479,9 @@ void CardMenu::setShortcutsActive()
|
||||||
|
|
||||||
aHide->setShortcuts(shortcuts.getShortcut("Player/aHide"));
|
aHide->setShortcuts(shortcuts.getShortcut("Player/aHide"));
|
||||||
aPlay->setShortcuts(shortcuts.getShortcut("Player/aPlay"));
|
aPlay->setShortcuts(shortcuts.getShortcut("Player/aPlay"));
|
||||||
|
aPlayFacedown->setShortcuts(shortcuts.getShortcut("Player/aPlayFacedown"));
|
||||||
|
aRevealToAll->setShortcuts(shortcuts.getShortcut("Player/aRevealToAll"));
|
||||||
|
|
||||||
aTap->setShortcuts(shortcuts.getShortcut("Player/aTap"));
|
aTap->setShortcuts(shortcuts.getShortcut("Player/aTap"));
|
||||||
aDoesntUntap->setShortcuts(shortcuts.getShortcut("Player/aDoesntUntap"));
|
aDoesntUntap->setShortcuts(shortcuts.getShortcut("Player/aDoesntUntap"));
|
||||||
aFlip->setShortcuts(shortcuts.getShortcut("Player/aFlip"));
|
aFlip->setShortcuts(shortcuts.getShortcut("Player/aFlip"));
|
||||||
|
|
@ -480,9 +496,6 @@ void CardMenu::setShortcutsActive()
|
||||||
aSelectRow->setShortcuts(shortcuts.getShortcut("Player/aSelectRow"));
|
aSelectRow->setShortcuts(shortcuts.getShortcut("Player/aSelectRow"));
|
||||||
aSelectColumn->setShortcuts(shortcuts.getShortcut("Player/aSelectColumn"));
|
aSelectColumn->setShortcuts(shortcuts.getShortcut("Player/aSelectColumn"));
|
||||||
|
|
||||||
aPlayFacedown->setShortcuts(shortcuts.getShortcut("Player/aPlayFacedown"));
|
|
||||||
aPlay->setShortcuts(shortcuts.getShortcut("Player/aPlay"));
|
|
||||||
|
|
||||||
static const QStringList colorWords = {"Red", "Yellow", "Green", "Cyan", "Purple", "Magenta"};
|
static const QStringList colorWords = {"Red", "Yellow", "Green", "Cyan", "Purple", "Magenta"};
|
||||||
for (int i = 0; i < aAddCounter.size(); i++) {
|
for (int i = 0; i < aAddCounter.size(); i++) {
|
||||||
aAddCounter[i]->setShortcuts(shortcuts.getShortcut("Player/aCC" + colorWords[i]));
|
aAddCounter[i]->setShortcuts(shortcuts.getShortcut("Player/aCC" + colorWords[i]));
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ public:
|
||||||
QMenu *mCardCounters;
|
QMenu *mCardCounters;
|
||||||
|
|
||||||
QAction *aPlay, *aPlayFacedown;
|
QAction *aPlay, *aPlayFacedown;
|
||||||
|
QAction *aRevealToAll;
|
||||||
QAction *aHide;
|
QAction *aHide;
|
||||||
QAction *aClone;
|
QAction *aClone;
|
||||||
QAction *aSelectAll, *aSelectRow, *aSelectColumn;
|
QAction *aSelectAll, *aSelectRow, *aSelectColumn;
|
||||||
|
|
@ -45,7 +46,7 @@ private:
|
||||||
|
|
||||||
void addRelatedCardActions();
|
void addRelatedCardActions();
|
||||||
void retranslateUi();
|
void retranslateUi();
|
||||||
void initContextualPlayersMenu(QMenu *menu);
|
void initContextualPlayersMenu(QMenu *menu, QAction *allPlayersAction);
|
||||||
void setShortcutsActive();
|
void setShortcutsActive();
|
||||||
void addRelatedCardView();
|
void addRelatedCardView();
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
#include "hand_menu.h"
|
#include "hand_menu.h"
|
||||||
|
|
||||||
|
#include "../../../client/settings/cache_settings.h"
|
||||||
|
#include "../../../client/settings/shortcuts_settings.h"
|
||||||
#include "../../abstract_game.h"
|
#include "../../abstract_game.h"
|
||||||
#include "../../zones/hand_zone.h"
|
#include "../../zones/hand_zone.h"
|
||||||
#include "../player.h"
|
#include "../player.h"
|
||||||
|
|
@ -7,8 +9,6 @@
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
#include <libcockatrice/settings/shortcuts_settings.h>
|
|
||||||
|
|
||||||
HandMenu::HandMenu(Player *_player, PlayerActions *actions, QWidget *parent) : TearOffMenu(parent), player(_player)
|
HandMenu::HandMenu(Player *_player, PlayerActions *actions, QWidget *parent) : TearOffMenu(parent), player(_player)
|
||||||
{
|
{
|
||||||
|
|
@ -17,18 +17,43 @@ HandMenu::HandMenu(Player *_player, PlayerActions *actions, QWidget *parent) : T
|
||||||
connect(aViewHand, &QAction::triggered, actions, &PlayerActions::actViewHand);
|
connect(aViewHand, &QAction::triggered, actions, &PlayerActions::actViewHand);
|
||||||
addAction(aViewHand);
|
addAction(aViewHand);
|
||||||
|
|
||||||
aSortHand = new QAction(this);
|
mSortHand = addMenu(QString());
|
||||||
connect(aSortHand, &QAction::triggered, actions, &PlayerActions::actSortHand);
|
|
||||||
addAction(aSortHand);
|
aSortHandByName = new QAction(this);
|
||||||
|
aSortHandByName->setData(CardList::SortByName);
|
||||||
|
aSortHandByType = new QAction(this);
|
||||||
|
aSortHandByType->setData(CardList::SortByMainType);
|
||||||
|
aSortHandByManaValue = new QAction(this);
|
||||||
|
aSortHandByManaValue->setData(CardList::SortByManaValue);
|
||||||
|
|
||||||
|
connect(aSortHandByType, &QAction::triggered, actions, &PlayerActions::actSortHand);
|
||||||
|
connect(aSortHandByName, &QAction::triggered, actions, &PlayerActions::actSortHand);
|
||||||
|
connect(aSortHandByManaValue, &QAction::triggered, actions, &PlayerActions::actSortHand);
|
||||||
|
|
||||||
|
mSortHand->addAction(aSortHandByName);
|
||||||
|
mSortHand->addAction(aSortHandByType);
|
||||||
|
mSortHand->addAction(aSortHandByManaValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
mRevealHand = addMenu(QString());
|
mRevealHand = addMenu(QString());
|
||||||
connect(mRevealHand, &QMenu::aboutToShow, this, &HandMenu::populateRevealHandMenuWithActivePlayers);
|
connect(mRevealHand, &QMenu::aboutToShow, this, &HandMenu::populateRevealHandMenuWithActivePlayers);
|
||||||
|
|
||||||
|
aRevealHandToAll = new QAction(this);
|
||||||
|
aRevealHandToAll->setData(-1);
|
||||||
|
connect(aRevealHandToAll, &QAction::triggered, this, &HandMenu::onRevealHandTriggered);
|
||||||
|
|
||||||
mRevealRandomHandCard = addMenu(QString());
|
mRevealRandomHandCard = addMenu(QString());
|
||||||
connect(mRevealRandomHandCard, &QMenu::aboutToShow, this,
|
connect(mRevealRandomHandCard, &QMenu::aboutToShow, this,
|
||||||
&HandMenu::populateRevealRandomHandCardMenuWithActivePlayers);
|
&HandMenu::populateRevealRandomHandCardMenuWithActivePlayers);
|
||||||
|
|
||||||
|
aRevealRandomHandCardToAll = new QAction(this);
|
||||||
|
aRevealRandomHandCardToAll->setData(-1);
|
||||||
|
connect(aRevealRandomHandCardToAll, &QAction::triggered, this, &HandMenu::onRevealRandomHandCardTriggered);
|
||||||
|
|
||||||
|
// We still need to add these actions to menu here so that the shortcuts are active right away
|
||||||
|
mRevealHand->addAction(aRevealHandToAll);
|
||||||
|
mRevealRandomHandCard->addAction(aRevealRandomHandCardToAll);
|
||||||
|
|
||||||
addSeparator();
|
addSeparator();
|
||||||
|
|
||||||
aMulligan = new QAction(this);
|
aMulligan = new QAction(this);
|
||||||
|
|
@ -73,7 +98,12 @@ void HandMenu::retranslateUi()
|
||||||
|
|
||||||
if (player->getPlayerInfo()->getLocalOrJudge()) {
|
if (player->getPlayerInfo()->getLocalOrJudge()) {
|
||||||
aViewHand->setText(tr("&View hand"));
|
aViewHand->setText(tr("&View hand"));
|
||||||
aSortHand->setText(tr("&Sort hand"));
|
|
||||||
|
mSortHand->setTitle(tr("Sort hand by..."));
|
||||||
|
aSortHandByName->setText(tr("Name"));
|
||||||
|
aSortHandByType->setText(tr("Type"));
|
||||||
|
aSortHandByManaValue->setText(tr("Mana Value"));
|
||||||
|
|
||||||
aMulligan->setText(tr("Take &mulligan"));
|
aMulligan->setText(tr("Take &mulligan"));
|
||||||
|
|
||||||
mMoveHandMenu->setTitle(tr("&Move hand to..."));
|
mMoveHandMenu->setTitle(tr("&Move hand to..."));
|
||||||
|
|
@ -83,7 +113,10 @@ void HandMenu::retranslateUi()
|
||||||
aMoveHandToRfg->setText(tr("&Exile"));
|
aMoveHandToRfg->setText(tr("&Exile"));
|
||||||
|
|
||||||
mRevealHand->setTitle(tr("&Reveal hand to..."));
|
mRevealHand->setTitle(tr("&Reveal hand to..."));
|
||||||
|
aRevealHandToAll->setText(tr("All players"));
|
||||||
|
|
||||||
mRevealRandomHandCard->setTitle(tr("Reveal r&andom card to..."));
|
mRevealRandomHandCard->setTitle(tr("Reveal r&andom card to..."));
|
||||||
|
aRevealRandomHandCardToAll->setText(tr("All players"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -91,24 +124,30 @@ void HandMenu::setShortcutsActive()
|
||||||
{
|
{
|
||||||
ShortcutsSettings &shortcuts = SettingsCache::instance().shortcuts();
|
ShortcutsSettings &shortcuts = SettingsCache::instance().shortcuts();
|
||||||
aViewHand->setShortcuts(shortcuts.getShortcut("Player/aViewHand"));
|
aViewHand->setShortcuts(shortcuts.getShortcut("Player/aViewHand"));
|
||||||
aSortHand->setShortcuts(shortcuts.getShortcut("Player/aSortHand"));
|
aSortHandByName->setShortcuts(shortcuts.getShortcut("Player/aSortHandByName"));
|
||||||
|
aSortHandByType->setShortcuts(shortcuts.getShortcut("Player/aSortHandByType"));
|
||||||
|
aSortHandByManaValue->setShortcuts(shortcuts.getShortcut("Player/aSortHandByManaValue"));
|
||||||
aMulligan->setShortcuts(shortcuts.getShortcut("Player/aMulligan"));
|
aMulligan->setShortcuts(shortcuts.getShortcut("Player/aMulligan"));
|
||||||
|
aRevealHandToAll->setShortcuts(shortcuts.getShortcut("Player/aRevealHandToAll"));
|
||||||
|
aRevealRandomHandCardToAll->setShortcuts(shortcuts.getShortcut("Player/aRevealRandomHandCardToAll"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandMenu::setShortcutsInactive()
|
void HandMenu::setShortcutsInactive()
|
||||||
{
|
{
|
||||||
aViewHand->setShortcut(QKeySequence());
|
aViewHand->setShortcut(QKeySequence());
|
||||||
aSortHand->setShortcut(QKeySequence());
|
aSortHandByName->setShortcut(QKeySequence());
|
||||||
|
aSortHandByType->setShortcut(QKeySequence());
|
||||||
|
aSortHandByManaValue->setShortcut(QKeySequence());
|
||||||
aMulligan->setShortcut(QKeySequence());
|
aMulligan->setShortcut(QKeySequence());
|
||||||
|
aRevealHandToAll->setShortcut(QKeySequence());
|
||||||
|
aRevealRandomHandCardToAll->setShortcut(QKeySequence());
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandMenu::populateRevealHandMenuWithActivePlayers()
|
void HandMenu::populateRevealHandMenuWithActivePlayers()
|
||||||
{
|
{
|
||||||
mRevealHand->clear();
|
mRevealHand->clear();
|
||||||
|
|
||||||
QAction *allPlayers = mRevealHand->addAction(tr("&All players"));
|
mRevealHand->addAction(aRevealHandToAll);
|
||||||
allPlayers->setData(-1);
|
|
||||||
connect(allPlayers, &QAction::triggered, this, &HandMenu::onRevealHandTriggered);
|
|
||||||
|
|
||||||
mRevealHand->addSeparator();
|
mRevealHand->addSeparator();
|
||||||
|
|
||||||
|
|
@ -126,9 +165,7 @@ void HandMenu::populateRevealRandomHandCardMenuWithActivePlayers()
|
||||||
{
|
{
|
||||||
mRevealRandomHandCard->clear();
|
mRevealRandomHandCard->clear();
|
||||||
|
|
||||||
QAction *allPlayers = mRevealRandomHandCard->addAction(tr("&All players"));
|
mRevealRandomHandCard->addAction(aRevealRandomHandCardToAll);
|
||||||
allPlayers->setData(-1);
|
|
||||||
connect(allPlayers, &QAction::triggered, this, &HandMenu::onRevealRandomHandCardTriggered);
|
|
||||||
|
|
||||||
mRevealRandomHandCard->addSeparator();
|
mRevealRandomHandCard->addSeparator();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,11 +45,18 @@ private:
|
||||||
Player *player;
|
Player *player;
|
||||||
|
|
||||||
QAction *aViewHand = nullptr;
|
QAction *aViewHand = nullptr;
|
||||||
QAction *aSortHand = nullptr;
|
|
||||||
QAction *aMulligan = nullptr;
|
QAction *aMulligan = nullptr;
|
||||||
|
|
||||||
|
QMenu *mSortHand = nullptr;
|
||||||
|
QAction *aSortHandByName = nullptr;
|
||||||
|
QAction *aSortHandByType = nullptr;
|
||||||
|
QAction *aSortHandByManaValue = nullptr;
|
||||||
|
|
||||||
QMenu *mRevealHand = nullptr;
|
QMenu *mRevealHand = nullptr;
|
||||||
|
QAction *aRevealHandToAll = nullptr;
|
||||||
|
|
||||||
QMenu *mRevealRandomHandCard = nullptr;
|
QMenu *mRevealRandomHandCard = nullptr;
|
||||||
|
QAction *aRevealRandomHandCardToAll = nullptr;
|
||||||
|
|
||||||
QMenu *mMoveHandMenu = nullptr;
|
QMenu *mMoveHandMenu = nullptr;
|
||||||
QAction *aMoveHandToTopLibrary = nullptr;
|
QAction *aMoveHandToTopLibrary = nullptr;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
#include "library_menu.h"
|
#include "library_menu.h"
|
||||||
|
|
||||||
|
#include "../../../client/settings/cache_settings.h"
|
||||||
|
#include "../../../client/settings/shortcuts_settings.h"
|
||||||
#include "../../../interface/widgets/tabs/tab_game.h"
|
#include "../../../interface/widgets/tabs/tab_game.h"
|
||||||
#include "../../abstract_game.h"
|
#include "../../abstract_game.h"
|
||||||
#include "../player.h"
|
#include "../player.h"
|
||||||
|
|
@ -7,8 +9,6 @@
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
#include <libcockatrice/settings/shortcuts_settings.h>
|
|
||||||
|
|
||||||
LibraryMenu::LibraryMenu(Player *_player, QWidget *parent) : TearOffMenu(parent), player(_player)
|
LibraryMenu::LibraryMenu(Player *_player, QWidget *parent) : TearOffMenu(parent), player(_player)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,14 @@ void PlayerMenu::retranslateUi()
|
||||||
void PlayerMenu::refreshShortcuts()
|
void PlayerMenu::refreshShortcuts()
|
||||||
{
|
{
|
||||||
if (shortcutsActive) {
|
if (shortcutsActive) {
|
||||||
setShortcutsActive();
|
// Judges get access to every player's menus but only want shortcuts to be set for their own.
|
||||||
|
if (player->getPlayerInfo()->getLocalOrJudge() && !player->getPlayerInfo()->getLocal()) {
|
||||||
|
setShortcutsInactive();
|
||||||
|
} else {
|
||||||
|
setShortcutsActive();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
setShortcutsInactive();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,9 @@
|
||||||
#include "say_menu.h"
|
#include "say_menu.h"
|
||||||
|
|
||||||
|
#include "../../../client/settings/cache_settings.h"
|
||||||
#include "../player.h"
|
#include "../player.h"
|
||||||
#include "../player_actions.h"
|
#include "../player_actions.h"
|
||||||
|
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
|
|
||||||
SayMenu::SayMenu(Player *_player) : player(_player)
|
SayMenu::SayMenu(Player *_player) : player(_player)
|
||||||
{
|
{
|
||||||
connect(&SettingsCache::instance().messages(), &MessageSettings::messageMacrosChanged, this, &SayMenu::initSayMenu);
|
connect(&SettingsCache::instance().messages(), &MessageSettings::messageMacrosChanged, this, &SayMenu::initSayMenu);
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,8 @@ void UtilityMenu::populatePredefinedTokensMenu()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
InnerDecklistNode *tokenZone = dynamic_cast<InnerDecklistNode *>(_deck->getRoot()->findChild(DECK_ZONE_TOKENS));
|
InnerDecklistNode *tokenZone =
|
||||||
|
dynamic_cast<InnerDecklistNode *>(_deck->getDeckList()->getRoot()->findChild(DECK_ZONE_TOKENS));
|
||||||
|
|
||||||
if (tokenZone) {
|
if (tokenZone) {
|
||||||
if (!tokenZone->empty())
|
if (!tokenZone->empty())
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@
|
||||||
#ifndef PLAYER_H
|
#ifndef PLAYER_H
|
||||||
#define PLAYER_H
|
#define PLAYER_H
|
||||||
|
|
||||||
#include "../../filters/filter_string.h"
|
|
||||||
#include "../../interface/widgets/menus/tearoff_menu.h"
|
#include "../../interface/widgets/menus/tearoff_menu.h"
|
||||||
#include "../board/abstract_graphics_item.h"
|
#include "../board/abstract_graphics_item.h"
|
||||||
#include "../dialogs/dlg_create_token.h"
|
#include "../dialogs/dlg_create_token.h"
|
||||||
|
|
@ -24,6 +23,7 @@
|
||||||
#include <QPoint>
|
#include <QPoint>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <libcockatrice/card/card_info.h>
|
#include <libcockatrice/card/card_info.h>
|
||||||
|
#include <libcockatrice/filters/filter_string.h>
|
||||||
#include <libcockatrice/protocol/pb/card_attributes.pb.h>
|
#include <libcockatrice/protocol/pb/card_attributes.pb.h>
|
||||||
#include <libcockatrice/protocol/pb/game_event.pb.h>
|
#include <libcockatrice/protocol/pb/game_event.pb.h>
|
||||||
|
|
||||||
|
|
@ -66,7 +66,7 @@ class Player : public QObject
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void openDeckEditor(const DeckLoader *deck);
|
void openDeckEditor(DeckLoader *deck);
|
||||||
void deckChanged();
|
void deckChanged();
|
||||||
void newCardAdded(AbstractCardItem *card);
|
void newCardAdded(AbstractCardItem *card);
|
||||||
void rearrangeCounters();
|
void rearrangeCounters();
|
||||||
|
|
|
||||||
|
|
@ -139,9 +139,36 @@ void PlayerActions::actViewHand()
|
||||||
player->getGameScene()->toggleZoneView(player, "hand", -1);
|
player->getGameScene()->toggleZoneView(player, "hand", -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The sortHand actions only pass along a single SortOption in its data.
|
||||||
|
* This method fills out the rest of the sort priority list given that option.
|
||||||
|
* @param option The single sort option
|
||||||
|
* @return The sort priority list
|
||||||
|
*/
|
||||||
|
static QList<CardList::SortOption> expandSortOption(CardList::SortOption option)
|
||||||
|
{
|
||||||
|
switch (option) {
|
||||||
|
case CardList::SortByName:
|
||||||
|
return {};
|
||||||
|
case CardList::SortByMainType:
|
||||||
|
return {CardList::SortByMainType, CardList::SortByManaValue};
|
||||||
|
case CardList::SortByManaValue:
|
||||||
|
return {CardList::SortByManaValue, CardList::SortByColors};
|
||||||
|
default:
|
||||||
|
return {option};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void PlayerActions::actSortHand()
|
void PlayerActions::actSortHand()
|
||||||
{
|
{
|
||||||
player->getGraphicsItem()->getHandZoneGraphicsItem()->sortHand();
|
auto *action = qobject_cast<QAction *>(sender());
|
||||||
|
CardList::SortOption option = static_cast<CardList::SortOption>(action->data().toInt());
|
||||||
|
|
||||||
|
QList<CardList::SortOption> sortOptions = expandSortOption(option);
|
||||||
|
|
||||||
|
static QList defaultOptions = {CardList::SortByName, CardList::SortByPrinting};
|
||||||
|
|
||||||
|
player->getGraphicsItem()->getHandZoneGraphicsItem()->sortHand(sortOptions + defaultOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerActions::actViewTopCards()
|
void PlayerActions::actViewTopCards()
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <libcockatrice/card/relation/card_relation_type.h>
|
#include <libcockatrice/card/relation/card_relation_type.h>
|
||||||
|
#include <libcockatrice/filters/filter_string.h>
|
||||||
#include <libcockatrice/protocol/pb/card_attributes.pb.h>
|
#include <libcockatrice/protocol/pb/card_attributes.pb.h>
|
||||||
|
|
||||||
namespace google
|
namespace google
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
#ifndef COCKATRICE_PLAYER_INFO_H
|
#ifndef COCKATRICE_PLAYER_INFO_H
|
||||||
#define COCKATRICE_PLAYER_INFO_H
|
#define COCKATRICE_PLAYER_INFO_H
|
||||||
|
|
||||||
|
#include "../../interface/deck_loader/deck_loader.h"
|
||||||
#include "../zones/hand_zone.h"
|
#include "../zones/hand_zone.h"
|
||||||
#include "../zones/pile_zone.h"
|
#include "../zones/pile_zone.h"
|
||||||
#include "../zones/stack_zone.h"
|
#include "../zones/stack_zone.h"
|
||||||
|
|
@ -14,7 +15,6 @@
|
||||||
#include "player_target.h"
|
#include "player_target.h"
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <libcockatrice/models/deck_list/deck_loader.h>
|
|
||||||
#include <libcockatrice/protocol/pb/serverinfo_user.pb.h>
|
#include <libcockatrice/protocol/pb/serverinfo_user.pb.h>
|
||||||
|
|
||||||
class PlayerInfo : public QObject
|
class PlayerInfo : public QObject
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#include "hand_zone.h"
|
#include "hand_zone.h"
|
||||||
|
|
||||||
|
#include "../../client/settings/cache_settings.h"
|
||||||
#include "../../interface/theme_manager.h"
|
#include "../../interface/theme_manager.h"
|
||||||
#include "../board/card_drag_item.h"
|
#include "../board/card_drag_item.h"
|
||||||
#include "../board/card_item.h"
|
#include "../board/card_item.h"
|
||||||
|
|
@ -7,7 +8,6 @@
|
||||||
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <libcockatrice/protocol/pb/command_move_card.pb.h>
|
#include <libcockatrice/protocol/pb/command_move_card.pb.h>
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
|
|
||||||
HandZone::HandZone(HandZoneLogic *_logic, int _zoneHeight, QGraphicsItem *parent)
|
HandZone::HandZone(HandZoneLogic *_logic, int _zoneHeight, QGraphicsItem *parent)
|
||||||
: SelectZone(_logic, parent), zoneHeight(_zoneHeight)
|
: SelectZone(_logic, parent), zoneHeight(_zoneHeight)
|
||||||
|
|
@ -111,12 +111,13 @@ void HandZone::reorganizeCards()
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandZone::sortHand()
|
void HandZone::sortHand(const QList<CardList::SortOption> &options)
|
||||||
{
|
{
|
||||||
if (getLogic()->getCards().isEmpty()) {
|
if (getLogic()->getCards().isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
getLogic()->sortCards({CardList::SortByMainType, CardList::SortByManaValue, CardList::SortByColorGrouping});
|
|
||||||
|
getLogic()->sortCards(options);
|
||||||
reorganizeCards();
|
reorganizeCards();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ public:
|
||||||
QRectF boundingRect() const override;
|
QRectF boundingRect() const override;
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
||||||
void reorganizeCards() override;
|
void reorganizeCards() override;
|
||||||
void sortHand();
|
void sortHand(const QList<CardList::SortOption> &options);
|
||||||
void setWidth(qreal _width);
|
void setWidth(qreal _width);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
#include "view_zone_logic.h"
|
#include "view_zone_logic.h"
|
||||||
|
|
||||||
|
#include "../../../client/settings/cache_settings.h"
|
||||||
#include "../../board/card_item.h"
|
#include "../../board/card_item.h"
|
||||||
|
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param _player the player that the cards are revealed to.
|
* @param _player the player that the cards are revealed to.
|
||||||
* @param _origZone the zone the cards were revealed from.
|
* @param _origZone the zone the cards were revealed from.
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
#include "select_zone.h"
|
#include "select_zone.h"
|
||||||
|
|
||||||
|
#include "../../client/settings/cache_settings.h"
|
||||||
#include "../board/card_item.h"
|
#include "../board/card_item.h"
|
||||||
#include "../game_scene.h"
|
#include "../game_scene.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QGraphicsSceneMouseEvent>
|
#include <QGraphicsSceneMouseEvent>
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
|
|
||||||
qreal divideCardSpaceInZone(qreal index, int cardCount, qreal totalHeight, qreal cardHeight, bool reverse)
|
qreal divideCardSpaceInZone(qreal index, int cardCount, qreal totalHeight, qreal cardHeight, bool reverse)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#include "stack_zone.h"
|
#include "stack_zone.h"
|
||||||
|
|
||||||
|
#include "../../client/settings/cache_settings.h"
|
||||||
#include "../../interface/theme_manager.h"
|
#include "../../interface/theme_manager.h"
|
||||||
#include "../board/arrow_item.h"
|
#include "../board/arrow_item.h"
|
||||||
#include "../board/card_drag_item.h"
|
#include "../board/card_drag_item.h"
|
||||||
|
|
@ -10,7 +11,6 @@
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
#include <libcockatrice/protocol/pb/command_move_card.pb.h>
|
#include <libcockatrice/protocol/pb/command_move_card.pb.h>
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
|
|
||||||
StackZone::StackZone(StackZoneLogic *_logic, int _zoneHeight, QGraphicsItem *parent)
|
StackZone::StackZone(StackZoneLogic *_logic, int _zoneHeight, QGraphicsItem *parent)
|
||||||
: SelectZone(_logic, parent), zoneHeight(_zoneHeight)
|
: SelectZone(_logic, parent), zoneHeight(_zoneHeight)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#include "table_zone.h"
|
#include "table_zone.h"
|
||||||
|
|
||||||
|
#include "../../client/settings/cache_settings.h"
|
||||||
#include "../../interface/theme_manager.h"
|
#include "../../interface/theme_manager.h"
|
||||||
#include "../board/arrow_item.h"
|
#include "../board/arrow_item.h"
|
||||||
#include "../board/card_drag_item.h"
|
#include "../board/card_drag_item.h"
|
||||||
|
|
@ -13,7 +14,6 @@
|
||||||
#include <libcockatrice/card/card_info.h>
|
#include <libcockatrice/card/card_info.h>
|
||||||
#include <libcockatrice/protocol/pb/command_move_card.pb.h>
|
#include <libcockatrice/protocol/pb/command_move_card.pb.h>
|
||||||
#include <libcockatrice/protocol/pb/command_set_card_attr.pb.h>
|
#include <libcockatrice/protocol/pb/command_set_card_attr.pb.h>
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
|
|
||||||
const QColor TableZone::BACKGROUND_COLOR = QColor(100, 100, 100);
|
const QColor TableZone::BACKGROUND_COLOR = QColor(100, 100, 100);
|
||||||
const QColor TableZone::FADE_MASK = QColor(0, 0, 0, 80);
|
const QColor TableZone::FADE_MASK = QColor(0, 0, 0, 80);
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,12 @@
|
||||||
#ifndef ZONEVIEWERZONE_H
|
#ifndef ZONEVIEWERZONE_H
|
||||||
#define ZONEVIEWERZONE_H
|
#define ZONEVIEWERZONE_H
|
||||||
|
|
||||||
#include "../../filters/filter_string.h"
|
|
||||||
#include "logic/view_zone_logic.h"
|
#include "logic/view_zone_logic.h"
|
||||||
#include "select_zone.h"
|
#include "select_zone.h"
|
||||||
|
|
||||||
#include <QGraphicsLayoutItem>
|
#include <QGraphicsLayoutItem>
|
||||||
#include <QLoggingCategory>
|
#include <QLoggingCategory>
|
||||||
|
#include <libcockatrice/filters/filter_string.h>
|
||||||
#include <libcockatrice/protocol/pb/commands.pb.h>
|
#include <libcockatrice/protocol/pb/commands.pb.h>
|
||||||
|
|
||||||
inline Q_LOGGING_CATEGORY(ViewZoneLog, "view_zone");
|
inline Q_LOGGING_CATEGORY(ViewZoneLog, "view_zone");
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#include "view_zone_widget.h"
|
#include "view_zone_widget.h"
|
||||||
|
|
||||||
|
#include "../../client/settings/cache_settings.h"
|
||||||
#include "../../filters/syntax_help.h"
|
#include "../../filters/syntax_help.h"
|
||||||
#include "../../interface/pixel_map_generator.h"
|
#include "../../interface/pixel_map_generator.h"
|
||||||
#include "../board/card_item.h"
|
#include "../board/card_item.h"
|
||||||
|
|
@ -17,7 +18,6 @@
|
||||||
#include <QStyleOption>
|
#include <QStyleOption>
|
||||||
#include <QStyleOptionTitleBar>
|
#include <QStyleOptionTitleBar>
|
||||||
#include <libcockatrice/protocol/pb/command_shuffle.pb.h>
|
#include <libcockatrice/protocol/pb/command_shuffle.pb.h>
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param _player the player the cards were revealed to.
|
* @param _player the player the cards were revealed to.
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
#include "card_picture_loader.h"
|
#include "card_picture_loader.h"
|
||||||
|
|
||||||
|
#include "../../client/settings/cache_settings.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QBuffer>
|
#include <QBuffer>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
@ -15,7 +17,6 @@
|
||||||
#include <QStatusBar>
|
#include <QStatusBar>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
// never cache more than 300 cards at once for a single deck
|
// never cache more than 300 cards at once for a single deck
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
#include "card_picture_loader_local.h"
|
#include "card_picture_loader_local.h"
|
||||||
|
|
||||||
|
#include "../../client/settings/cache_settings.h"
|
||||||
#include "card_picture_to_load.h"
|
#include "card_picture_to_load.h"
|
||||||
|
|
||||||
#include <QDirIterator>
|
#include <QDirIterator>
|
||||||
#include <QMovie>
|
#include <QMovie>
|
||||||
#include <libcockatrice/card/database/card_database_manager.h>
|
#include <libcockatrice/card/database/card_database_manager.h>
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
|
|
||||||
static constexpr int REFRESH_INTERVAL_MS = 10 * 1000;
|
static constexpr int REFRESH_INTERVAL_MS = 10 * 1000;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#include "card_picture_loader_worker.h"
|
#include "card_picture_loader_worker.h"
|
||||||
|
|
||||||
|
#include "../../client/settings/cache_settings.h"
|
||||||
#include "card_picture_loader_local.h"
|
#include "card_picture_loader_local.h"
|
||||||
#include "card_picture_loader_worker_work.h"
|
#include "card_picture_loader_worker_work.h"
|
||||||
|
|
||||||
|
|
@ -9,7 +10,6 @@
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <libcockatrice/card/database/card_database_manager.h>
|
#include <libcockatrice/card/database/card_database_manager.h>
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
static constexpr int MAX_REQUESTS_PER_SEC = 10;
|
static constexpr int MAX_REQUESTS_PER_SEC = 10;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#include "card_picture_loader_worker_work.h"
|
#include "card_picture_loader_worker_work.h"
|
||||||
|
|
||||||
|
#include "../../client/settings/cache_settings.h"
|
||||||
#include "card_picture_loader_worker.h"
|
#include "card_picture_loader_worker.h"
|
||||||
|
|
||||||
#include <QBuffer>
|
#include <QBuffer>
|
||||||
|
|
@ -11,7 +12,6 @@
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QThreadPool>
|
#include <QThreadPool>
|
||||||
#include <libcockatrice/card/database/card_database_manager.h>
|
#include <libcockatrice/card/database/card_database_manager.h>
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
|
|
||||||
// Card back returned by gatherer when card is not found
|
// Card back returned by gatherer when card is not found
|
||||||
static const QStringList MD5_BLACKLIST = {"db0c48db407a907c16ade38de048a441"};
|
static const QStringList MD5_BLACKLIST = {"db0c48db407a907c16ade38de048a441"};
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,14 @@
|
||||||
#include "card_picture_to_load.h"
|
#include "card_picture_to_load.h"
|
||||||
|
|
||||||
|
#include "../../client/settings/cache_settings.h"
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QDate>
|
#include <QDate>
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <libcockatrice/card/set/card_set_comparator.h>
|
#include <libcockatrice/card/set/card_set_comparator.h>
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
#include <libcockatrice/interfaces/noop_card_set_priority_controller.h>
|
||||||
|
|
||||||
CardPictureToLoad::CardPictureToLoad(const ExactCard &_card)
|
CardPictureToLoad::CardPictureToLoad(const ExactCard &_card)
|
||||||
: card(_card), urlTemplates(SettingsCache::instance().downloads().getAllURLs())
|
: card(_card), urlTemplates(SettingsCache::instance().downloads().getAllURLs())
|
||||||
|
|
@ -33,7 +35,7 @@ QList<CardSetPtr> CardPictureToLoad::extractSetsSorted(const ExactCard &card)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sortedSets.empty()) {
|
if (sortedSets.empty()) {
|
||||||
sortedSets << CardSet::newInstance("", "", "", QDate());
|
sortedSets << CardSet::newInstance(new NoopCardSetPriorityController(), "", "", "", QDate());
|
||||||
}
|
}
|
||||||
std::sort(sortedSets.begin(), sortedSets.end(), SetPriorityComparator());
|
std::sort(sortedSets.begin(), sortedSets.end(), SetPriorityComparator());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,13 @@
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QFutureWatcher>
|
#include <QFutureWatcher>
|
||||||
|
#include <QPrinter>
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
#include <QTextCursor>
|
||||||
|
#include <QTextDocument>
|
||||||
|
#include <QTextStream>
|
||||||
|
#include <QTextTable>
|
||||||
#include <QtConcurrentRun>
|
#include <QtConcurrentRun>
|
||||||
#include <libcockatrice/card/database/card_database.h>
|
#include <libcockatrice/card/database/card_database.h>
|
||||||
#include <libcockatrice/card/database/card_database_manager.h>
|
#include <libcockatrice/card/database/card_database_manager.h>
|
||||||
|
|
@ -20,26 +25,27 @@ const QStringList DeckLoader::ACCEPTED_FILE_EXTENSIONS = {"*.cod", "*.dec", "*.d
|
||||||
const QStringList DeckLoader::FILE_NAME_FILTERS = {
|
const QStringList DeckLoader::FILE_NAME_FILTERS = {
|
||||||
tr("Common deck formats (%1)").arg(ACCEPTED_FILE_EXTENSIONS.join(" ")), tr("All files (*.*)")};
|
tr("Common deck formats (%1)").arg(ACCEPTED_FILE_EXTENSIONS.join(" ")), tr("All files (*.*)")};
|
||||||
|
|
||||||
DeckLoader::DeckLoader() : DeckList(), lastFileName(QString()), lastFileFormat(CockatriceFormat), lastRemoteDeckId(-1)
|
DeckLoader::DeckLoader(QObject *parent)
|
||||||
|
: QObject(parent), deckList(new DeckList()), lastFileFormat(CockatriceFormat), lastRemoteDeckId(-1)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
DeckLoader::DeckLoader(const QString &nativeString)
|
DeckLoader::DeckLoader(QObject *parent, DeckList *_deckList)
|
||||||
: DeckList(nativeString), lastFileName(QString()), lastFileFormat(CockatriceFormat), lastRemoteDeckId(-1)
|
: QObject(parent), deckList(_deckList), lastFileFormat(CockatriceFormat), lastRemoteDeckId(-1)
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
DeckLoader::DeckLoader(const DeckList &other)
|
|
||||||
: DeckList(other), lastFileName(QString()), lastFileFormat(CockatriceFormat), lastRemoteDeckId(-1)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
DeckLoader::DeckLoader(const DeckLoader &other)
|
DeckLoader::DeckLoader(const DeckLoader &other)
|
||||||
: DeckList(other), lastFileName(other.lastFileName), lastFileFormat(other.lastFileFormat),
|
: QObject(), deckList(other.deckList), lastFileName(other.lastFileName), lastFileFormat(other.lastFileFormat),
|
||||||
lastRemoteDeckId(other.lastRemoteDeckId)
|
lastRemoteDeckId(other.lastRemoteDeckId)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DeckLoader::setDeckList(DeckList *_deckList)
|
||||||
|
{
|
||||||
|
deckList = _deckList;
|
||||||
|
}
|
||||||
|
|
||||||
bool DeckLoader::loadFromFile(const QString &fileName, FileFormat fmt, bool userRequest)
|
bool DeckLoader::loadFromFile(const QString &fileName, FileFormat fmt, bool userRequest)
|
||||||
{
|
{
|
||||||
QFile file(fileName);
|
QFile file(fileName);
|
||||||
|
|
@ -50,15 +56,15 @@ bool DeckLoader::loadFromFile(const QString &fileName, FileFormat fmt, bool user
|
||||||
bool result = false;
|
bool result = false;
|
||||||
switch (fmt) {
|
switch (fmt) {
|
||||||
case PlainTextFormat:
|
case PlainTextFormat:
|
||||||
result = loadFromFile_Plain(&file);
|
result = deckList->loadFromFile_Plain(&file);
|
||||||
break;
|
break;
|
||||||
case CockatriceFormat: {
|
case CockatriceFormat: {
|
||||||
result = loadFromFile_Native(&file);
|
result = deckList->loadFromFile_Native(&file);
|
||||||
qCInfo(DeckLoaderLog) << "Loaded from" << fileName << "-" << result;
|
qCInfo(DeckLoaderLog) << "Loaded from" << fileName << "-" << result;
|
||||||
if (!result) {
|
if (!result) {
|
||||||
qCInfo(DeckLoaderLog) << "Retrying as plain format";
|
qCInfo(DeckLoaderLog) << "Retrying as plain format";
|
||||||
file.seek(0);
|
file.seek(0);
|
||||||
result = loadFromFile_Plain(&file);
|
result = deckList->loadFromFile_Plain(&file);
|
||||||
fmt = PlainTextFormat;
|
fmt = PlainTextFormat;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -110,13 +116,13 @@ bool DeckLoader::loadFromFileAsync(const QString &fileName, FileFormat fmt, bool
|
||||||
|
|
||||||
switch (fmt) {
|
switch (fmt) {
|
||||||
case PlainTextFormat:
|
case PlainTextFormat:
|
||||||
return loadFromFile_Plain(&file);
|
return deckList->loadFromFile_Plain(&file);
|
||||||
case CockatriceFormat: {
|
case CockatriceFormat: {
|
||||||
bool result = false;
|
bool result = false;
|
||||||
result = loadFromFile_Native(&file);
|
result = deckList->loadFromFile_Native(&file);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
file.seek(0);
|
file.seek(0);
|
||||||
return loadFromFile_Plain(&file);
|
return deckList->loadFromFile_Plain(&file);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
@ -132,7 +138,7 @@ bool DeckLoader::loadFromFileAsync(const QString &fileName, FileFormat fmt, bool
|
||||||
|
|
||||||
bool DeckLoader::loadFromRemote(const QString &nativeString, int remoteDeckId)
|
bool DeckLoader::loadFromRemote(const QString &nativeString, int remoteDeckId)
|
||||||
{
|
{
|
||||||
bool result = loadFromString_Native(nativeString);
|
bool result = deckList->loadFromString_Native(nativeString);
|
||||||
if (result) {
|
if (result) {
|
||||||
lastFileName = QString();
|
lastFileName = QString();
|
||||||
lastFileFormat = CockatriceFormat;
|
lastFileFormat = CockatriceFormat;
|
||||||
|
|
@ -153,10 +159,10 @@ bool DeckLoader::saveToFile(const QString &fileName, FileFormat fmt)
|
||||||
bool result = false;
|
bool result = false;
|
||||||
switch (fmt) {
|
switch (fmt) {
|
||||||
case PlainTextFormat:
|
case PlainTextFormat:
|
||||||
result = saveToFile_Plain(&file);
|
result = deckList->saveToFile_Plain(&file);
|
||||||
break;
|
break;
|
||||||
case CockatriceFormat:
|
case CockatriceFormat:
|
||||||
result = saveToFile_Native(&file);
|
result = deckList->saveToFile_Native(&file);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -193,11 +199,11 @@ bool DeckLoader::updateLastLoadedTimestamp(const QString &fileName, FileFormat f
|
||||||
// Perform file modifications
|
// Perform file modifications
|
||||||
switch (fmt) {
|
switch (fmt) {
|
||||||
case PlainTextFormat:
|
case PlainTextFormat:
|
||||||
result = saveToFile_Plain(&file);
|
result = deckList->saveToFile_Plain(&file);
|
||||||
break;
|
break;
|
||||||
case CockatriceFormat:
|
case CockatriceFormat:
|
||||||
setLastLoadedTimestamp(QDateTime::currentDateTime().toString());
|
deckList->setLastLoadedTimestamp(QDateTime::currentDateTime().toString());
|
||||||
result = saveToFile_Native(&file);
|
result = deckList->saveToFile_Native(&file);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -296,7 +302,7 @@ QString DeckLoader::exportDeckToDecklist(DecklistWebsite website)
|
||||||
};
|
};
|
||||||
|
|
||||||
// call our struct function for each card in the deck
|
// call our struct function for each card in the deck
|
||||||
forEachCard(formatDeckListForExport);
|
deckList->forEachCard(formatDeckListForExport);
|
||||||
// Remove the extra return at the end of the last cards
|
// Remove the extra return at the end of the last cards
|
||||||
mainBoardCards.chop(3);
|
mainBoardCards.chop(3);
|
||||||
sideBoardCards.chop(3);
|
sideBoardCards.chop(3);
|
||||||
|
|
@ -344,7 +350,7 @@ void DeckLoader::setProviderIdToPreferredPrinting()
|
||||||
SetProviderIdToPreferred setProviderIdToPreferred;
|
SetProviderIdToPreferred setProviderIdToPreferred;
|
||||||
|
|
||||||
// Call the forEachCard method for each card in the deck
|
// Call the forEachCard method for each card in the deck
|
||||||
forEachCard(setProviderIdToPreferred);
|
deckList->forEachCard(setProviderIdToPreferred);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -365,7 +371,7 @@ void DeckLoader::resolveSetNameAndNumberToProviderID()
|
||||||
card->setCardProviderId(providerId);
|
card->setCardProviderId(providerId);
|
||||||
};
|
};
|
||||||
|
|
||||||
forEachCard(setProviderId);
|
deckList->forEachCard(setProviderId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This struct is here to support the forEachCard function call, defined in decklist.
|
// This struct is here to support the forEachCard function call, defined in decklist.
|
||||||
|
|
@ -400,7 +406,7 @@ void DeckLoader::clearSetNamesAndNumbers()
|
||||||
card->setCardProviderId(nullptr);
|
card->setCardProviderId(nullptr);
|
||||||
};
|
};
|
||||||
|
|
||||||
forEachCard(clearSetNameAndNumber);
|
deckList->forEachCard(clearSetNameAndNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
DeckLoader::FileFormat DeckLoader::getFormatFromName(const QString &fileName)
|
DeckLoader::FileFormat DeckLoader::getFormatFromName(const QString &fileName)
|
||||||
|
|
@ -427,8 +433,8 @@ bool DeckLoader::saveToStream_Plain(QTextStream &out, bool addComments, bool add
|
||||||
}
|
}
|
||||||
|
|
||||||
// loop zones
|
// loop zones
|
||||||
for (int i = 0; i < getRoot()->size(); i++) {
|
for (int i = 0; i < deckList->getRoot()->size(); i++) {
|
||||||
const auto *zoneNode = dynamic_cast<InnerDecklistNode *>(getRoot()->at(i));
|
const auto *zoneNode = dynamic_cast<InnerDecklistNode *>(deckList->getRoot()->at(i));
|
||||||
|
|
||||||
saveToStream_DeckZone(out, zoneNode, addComments, addSetNameAndNumber);
|
saveToStream_DeckZone(out, zoneNode, addComments, addSetNameAndNumber);
|
||||||
|
|
||||||
|
|
@ -441,12 +447,12 @@ bool DeckLoader::saveToStream_Plain(QTextStream &out, bool addComments, bool add
|
||||||
|
|
||||||
void DeckLoader::saveToStream_DeckHeader(QTextStream &out) const
|
void DeckLoader::saveToStream_DeckHeader(QTextStream &out) const
|
||||||
{
|
{
|
||||||
if (!getName().isEmpty()) {
|
if (!deckList->getName().isEmpty()) {
|
||||||
out << "// " << getName() << "\n\n";
|
out << "// " << deckList->getName() << "\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!getComments().isEmpty()) {
|
if (!deckList->getComments().isEmpty()) {
|
||||||
QStringList commentRows = getComments().split(QRegularExpression("\n|\r\n|\r"));
|
QStringList commentRows = deckList->getComments().split(QRegularExpression("\n|\r\n|\r"));
|
||||||
for (const QString &row : commentRows) {
|
for (const QString &row : commentRows) {
|
||||||
out << "// " << row << "\n";
|
out << "// " << row << "\n";
|
||||||
}
|
}
|
||||||
|
|
@ -553,7 +559,7 @@ bool DeckLoader::convertToCockatriceFormat(QString fileName)
|
||||||
switch (getFormatFromName(fileName)) {
|
switch (getFormatFromName(fileName)) {
|
||||||
case PlainTextFormat:
|
case PlainTextFormat:
|
||||||
// Save in Cockatrice's native format
|
// Save in Cockatrice's native format
|
||||||
result = saveToFile_Native(&file);
|
result = deckList->saveToFile_Native(&file);
|
||||||
break;
|
break;
|
||||||
case CockatriceFormat:
|
case CockatriceFormat:
|
||||||
qCInfo(DeckLoaderLog) << "File is already in Cockatrice format. No conversion needed.";
|
qCInfo(DeckLoaderLog) << "File is already in Cockatrice format. No conversion needed.";
|
||||||
|
|
@ -603,3 +609,97 @@ QString DeckLoader::getCompleteCardName(const QString &cardName) const
|
||||||
|
|
||||||
return cardName;
|
return cardName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DeckLoader::printDeckListNode(QTextCursor *cursor, InnerDecklistNode *node)
|
||||||
|
{
|
||||||
|
const int totalColumns = 2;
|
||||||
|
|
||||||
|
if (node->height() == 1) {
|
||||||
|
QTextBlockFormat blockFormat;
|
||||||
|
QTextCharFormat charFormat;
|
||||||
|
charFormat.setFontPointSize(11);
|
||||||
|
charFormat.setFontWeight(QFont::Bold);
|
||||||
|
cursor->insertBlock(blockFormat, charFormat);
|
||||||
|
|
||||||
|
QTextTableFormat tableFormat;
|
||||||
|
tableFormat.setCellPadding(0);
|
||||||
|
tableFormat.setCellSpacing(0);
|
||||||
|
tableFormat.setBorder(0);
|
||||||
|
QTextTable *table = cursor->insertTable(node->size() + 1, totalColumns, tableFormat);
|
||||||
|
for (int i = 0; i < node->size(); i++) {
|
||||||
|
auto *card = dynamic_cast<AbstractDecklistCardNode *>(node->at(i));
|
||||||
|
|
||||||
|
QTextCharFormat cellCharFormat;
|
||||||
|
cellCharFormat.setFontPointSize(9);
|
||||||
|
|
||||||
|
QTextTableCell cell = table->cellAt(i, 0);
|
||||||
|
cell.setFormat(cellCharFormat);
|
||||||
|
QTextCursor cellCursor = cell.firstCursorPosition();
|
||||||
|
cellCursor.insertText(QString("%1 ").arg(card->getNumber()));
|
||||||
|
|
||||||
|
cell = table->cellAt(i, 1);
|
||||||
|
cell.setFormat(cellCharFormat);
|
||||||
|
cellCursor = cell.firstCursorPosition();
|
||||||
|
cellCursor.insertText(card->getName());
|
||||||
|
}
|
||||||
|
} else if (node->height() == 2) {
|
||||||
|
QTextBlockFormat blockFormat;
|
||||||
|
QTextCharFormat charFormat;
|
||||||
|
charFormat.setFontPointSize(14);
|
||||||
|
charFormat.setFontWeight(QFont::Bold);
|
||||||
|
|
||||||
|
cursor->insertBlock(blockFormat, charFormat);
|
||||||
|
|
||||||
|
QTextTableFormat tableFormat;
|
||||||
|
tableFormat.setCellPadding(10);
|
||||||
|
tableFormat.setCellSpacing(0);
|
||||||
|
tableFormat.setBorder(0);
|
||||||
|
QVector<QTextLength> constraints;
|
||||||
|
for (int i = 0; i < totalColumns; i++) {
|
||||||
|
constraints << QTextLength(QTextLength::PercentageLength, 100.0 / totalColumns);
|
||||||
|
}
|
||||||
|
tableFormat.setColumnWidthConstraints(constraints);
|
||||||
|
|
||||||
|
QTextTable *table = cursor->insertTable(1, totalColumns, tableFormat);
|
||||||
|
for (int i = 0; i < node->size(); i++) {
|
||||||
|
QTextCursor cellCursor = table->cellAt(0, (i * totalColumns) / node->size()).lastCursorPosition();
|
||||||
|
printDeckListNode(&cellCursor, dynamic_cast<InnerDecklistNode *>(node->at(i)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cursor->movePosition(QTextCursor::End);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeckLoader::printDeckList(QPrinter *printer)
|
||||||
|
{
|
||||||
|
QTextDocument doc;
|
||||||
|
|
||||||
|
QFont font("Serif");
|
||||||
|
font.setStyleHint(QFont::Serif);
|
||||||
|
doc.setDefaultFont(font);
|
||||||
|
|
||||||
|
QTextCursor cursor(&doc);
|
||||||
|
|
||||||
|
QTextBlockFormat headerBlockFormat;
|
||||||
|
QTextCharFormat headerCharFormat;
|
||||||
|
headerCharFormat.setFontPointSize(16);
|
||||||
|
headerCharFormat.setFontWeight(QFont::Bold);
|
||||||
|
|
||||||
|
cursor.insertBlock(headerBlockFormat, headerCharFormat);
|
||||||
|
cursor.insertText(deckList->getName());
|
||||||
|
|
||||||
|
headerCharFormat.setFontPointSize(12);
|
||||||
|
cursor.insertBlock(headerBlockFormat, headerCharFormat);
|
||||||
|
cursor.insertText(deckList->getComments());
|
||||||
|
cursor.insertBlock(headerBlockFormat, headerCharFormat);
|
||||||
|
|
||||||
|
for (int i = 0; i < deckList->getRoot()->size(); i++) {
|
||||||
|
cursor.insertHtml("<br><img src=theme:hr.jpg>");
|
||||||
|
// cursor.insertHtml("<hr>");
|
||||||
|
cursor.insertBlock(headerBlockFormat, headerCharFormat);
|
||||||
|
|
||||||
|
printDeckListNode(&cursor, dynamic_cast<InnerDecklistNode *>(deckList->getRoot()->at(i)));
|
||||||
|
}
|
||||||
|
|
||||||
|
doc.print(printer);
|
||||||
|
}
|
||||||
|
|
@ -8,17 +8,26 @@
|
||||||
#define DECK_LOADER_H
|
#define DECK_LOADER_H
|
||||||
|
|
||||||
#include <QLoggingCategory>
|
#include <QLoggingCategory>
|
||||||
|
#include <QPrinter>
|
||||||
|
#include <QTextCursor>
|
||||||
#include <libcockatrice/deck_list/deck_list.h>
|
#include <libcockatrice/deck_list/deck_list.h>
|
||||||
|
|
||||||
inline Q_LOGGING_CATEGORY(DeckLoaderLog, "deck_loader")
|
inline Q_LOGGING_CATEGORY(DeckLoaderLog, "deck_loader")
|
||||||
|
|
||||||
class DeckLoader : public DeckList
|
class DeckLoader : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
signals:
|
signals:
|
||||||
void deckLoaded();
|
void deckLoaded();
|
||||||
void loadFinished(bool success);
|
void loadFinished(bool success);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
/**
|
||||||
|
* @brief Prints the decklist to the provided QPrinter.
|
||||||
|
* @param printer The printer to render the decklist to.
|
||||||
|
*/
|
||||||
|
void printDeckList(QPrinter *printer);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum FileFormat
|
enum FileFormat
|
||||||
{
|
{
|
||||||
|
|
@ -43,14 +52,15 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
DeckList *deckList;
|
||||||
QString lastFileName;
|
QString lastFileName;
|
||||||
FileFormat lastFileFormat;
|
FileFormat lastFileFormat;
|
||||||
int lastRemoteDeckId;
|
int lastRemoteDeckId;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DeckLoader();
|
DeckLoader(QObject *parent);
|
||||||
explicit DeckLoader(const QString &nativeString);
|
DeckLoader(QObject *parent, DeckList *_deckList);
|
||||||
explicit DeckLoader(const DeckList &other);
|
void setDeckList(DeckList *_deckList);
|
||||||
DeckLoader(const DeckLoader &other);
|
DeckLoader(const DeckLoader &other);
|
||||||
const QString &getLastFileName() const
|
const QString &getLastFileName() const
|
||||||
{
|
{
|
||||||
|
|
@ -93,6 +103,14 @@ public:
|
||||||
bool saveToStream_Plain(QTextStream &out, bool addComments = true, bool addSetNameAndNumber = true) const;
|
bool saveToStream_Plain(QTextStream &out, bool addComments = true, bool addSetNameAndNumber = true) const;
|
||||||
bool convertToCockatriceFormat(QString fileName);
|
bool convertToCockatriceFormat(QString fileName);
|
||||||
|
|
||||||
|
DeckList *getDeckList()
|
||||||
|
{
|
||||||
|
return deckList;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
void printDeckListNode(QTextCursor *cursor, InnerDecklistNode *node);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void saveToStream_DeckHeader(QTextStream &out) const;
|
void saveToStream_DeckHeader(QTextStream &out) const;
|
||||||
void saveToStream_DeckZone(QTextStream &out,
|
void saveToStream_DeckZone(QTextStream &out,
|
||||||
|
|
@ -104,8 +122,8 @@ protected:
|
||||||
QList<DecklistCardNode *> cards,
|
QList<DecklistCardNode *> cards,
|
||||||
bool addComments = true,
|
bool addComments = true,
|
||||||
bool addSetNameAndNumber = true) const;
|
bool addSetNameAndNumber = true) const;
|
||||||
[[nodiscard]] QString getCardZoneFromName(QString cardName, QString currentZoneName) override;
|
[[nodiscard]] QString getCardZoneFromName(QString cardName, QString currentZoneName);
|
||||||
[[nodiscard]] QString getCompleteCardName(const QString &cardName) const override;
|
[[nodiscard]] QString getCompleteCardName(const QString &cardName) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -1,12 +1,13 @@
|
||||||
#include "theme_manager.h"
|
#include "theme_manager.h"
|
||||||
|
|
||||||
|
#include "../../client/settings/cache_settings.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QLibraryInfo>
|
#include <QLibraryInfo>
|
||||||
#include <QPixmapCache>
|
#include <QPixmapCache>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
|
|
||||||
#define NONE_THEME_NAME "Default"
|
#define NONE_THEME_NAME "Default"
|
||||||
#define STYLE_CSS_NAME "style.css"
|
#define STYLE_CSS_NAME "style.css"
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#include "color_identity_widget.h"
|
#include "color_identity_widget.h"
|
||||||
|
|
||||||
|
#include "../../../../client/settings/cache_settings.h"
|
||||||
#include "mana_symbol_widget.h"
|
#include "mana_symbol_widget.h"
|
||||||
|
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
|
|
@ -8,7 +9,6 @@
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
#include <QResizeEvent>
|
#include <QResizeEvent>
|
||||||
#include <QSize>
|
#include <QSize>
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
|
|
||||||
ColorIdentityWidget::ColorIdentityWidget(QWidget *parent, CardInfoPtr _card) : QWidget(parent), card(_card)
|
ColorIdentityWidget::ColorIdentityWidget(QWidget *parent, CardInfoPtr _card) : QWidget(parent), card(_card)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
#include "mana_symbol_widget.h"
|
#include "mana_symbol_widget.h"
|
||||||
|
|
||||||
|
#include "../../../../client/settings/cache_settings.h"
|
||||||
|
|
||||||
#include <QResizeEvent>
|
#include <QResizeEvent>
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
|
|
||||||
ManaSymbolWidget::ManaSymbolWidget(QWidget *parent, QString _symbol, bool _isActive, bool _mayBeToggled)
|
ManaSymbolWidget::ManaSymbolWidget(QWidget *parent, QString _symbol, bool _isActive, bool _mayBeToggled)
|
||||||
: QLabel(parent), symbol(_symbol), isActive(_isActive), mayBeToggled(_mayBeToggled)
|
: QLabel(parent), symbol(_symbol), isActive(_isActive), mayBeToggled(_mayBeToggled)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#include "card_info_frame_widget.h"
|
#include "card_info_frame_widget.h"
|
||||||
|
|
||||||
|
#include "../../../client/settings/cache_settings.h"
|
||||||
#include "../../../game/board/card_item.h"
|
#include "../../../game/board/card_item.h"
|
||||||
#include "card_info_display_widget.h"
|
#include "card_info_display_widget.h"
|
||||||
#include "card_info_picture_widget.h"
|
#include "card_info_picture_widget.h"
|
||||||
|
|
@ -9,7 +10,6 @@
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <libcockatrice/card/database/card_database_manager.h>
|
#include <libcockatrice/card/database/card_database_manager.h>
|
||||||
#include <libcockatrice/card/relation/card_relation.h>
|
#include <libcockatrice/card/relation/card_relation.h>
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
CardInfoFrameWidget::CardInfoFrameWidget(QWidget *parent)
|
CardInfoFrameWidget::CardInfoFrameWidget(QWidget *parent)
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
#include "card_info_picture_enlarged_widget.h"
|
#include "card_info_picture_enlarged_widget.h"
|
||||||
|
|
||||||
|
#include "../../../client/settings/cache_settings.h"
|
||||||
#include "../../../interface/card_picture_loader/card_picture_loader.h"
|
#include "../../../interface/card_picture_loader/card_picture_loader.h"
|
||||||
|
|
||||||
#include <QPainterPath>
|
#include <QPainterPath>
|
||||||
#include <QStylePainter>
|
#include <QStylePainter>
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#include "card_info_picture_widget.h"
|
#include "card_info_picture_widget.h"
|
||||||
|
|
||||||
|
#include "../../../client/settings/cache_settings.h"
|
||||||
#include "../../../game/board/card_item.h"
|
#include "../../../game/board/card_item.h"
|
||||||
#include "../../../interface/card_picture_loader/card_picture_loader.h"
|
#include "../../../interface/card_picture_loader/card_picture_loader.h"
|
||||||
#include "../../../interface/widgets/tabs/tab_supervisor.h"
|
#include "../../../interface/widgets/tabs/tab_supervisor.h"
|
||||||
|
|
@ -12,7 +13,6 @@
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <libcockatrice/card/database/card_database_manager.h>
|
#include <libcockatrice/card/database/card_database_manager.h>
|
||||||
#include <libcockatrice/card/relation/card_relation.h>
|
#include <libcockatrice/card/relation/card_relation.h>
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,9 @@
|
||||||
#include "card_size_widget.h"
|
#include "card_size_widget.h"
|
||||||
|
|
||||||
|
#include "../../../client/settings/cache_settings.h"
|
||||||
#include "../printing_selector/printing_selector.h"
|
#include "../printing_selector/printing_selector.h"
|
||||||
#include "../visual_deck_storage/visual_deck_storage_widget.h"
|
#include "../visual_deck_storage/visual_deck_storage_widget.h"
|
||||||
|
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class CardSizeWidget
|
* @class CardSizeWidget
|
||||||
* @brief A widget for adjusting card sizes using a slider.
|
* @brief A widget for adjusting card sizes using a slider.
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
#include "deck_preview_card_picture_widget.h"
|
#include "deck_preview_card_picture_widget.h"
|
||||||
|
|
||||||
|
#include "../../../client/settings/cache_settings.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QFontMetrics>
|
#include <QFontMetrics>
|
||||||
|
|
@ -7,7 +9,6 @@
|
||||||
#include <QPainterPath>
|
#include <QPainterPath>
|
||||||
#include <QStylePainter>
|
#include <QStylePainter>
|
||||||
#include <QTextOption>
|
#include <QTextOption>
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Constructs a CardPictureWithTextOverlay widget.
|
* @brief Constructs a CardPictureWithTextOverlay widget.
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#include "mana_base_widget.h"
|
#include "mana_base_widget.h"
|
||||||
|
|
||||||
|
#include "../../deck_loader/deck_loader.h"
|
||||||
#include "../general/display/banner_widget.h"
|
#include "../general/display/banner_widget.h"
|
||||||
#include "../general/display/bar_widget.h"
|
#include "../general/display/bar_widget.h"
|
||||||
|
|
||||||
|
|
@ -8,7 +9,6 @@
|
||||||
#include <libcockatrice/card/database/card_database.h>
|
#include <libcockatrice/card/database/card_database.h>
|
||||||
#include <libcockatrice/card/database/card_database_manager.h>
|
#include <libcockatrice/card/database/card_database_manager.h>
|
||||||
#include <libcockatrice/deck_list/deck_list.h>
|
#include <libcockatrice/deck_list/deck_list.h>
|
||||||
#include <libcockatrice/models/deck_list/deck_loader.h>
|
|
||||||
|
|
||||||
ManaBaseWidget::ManaBaseWidget(QWidget *parent, DeckListModel *_deckListModel)
|
ManaBaseWidget::ManaBaseWidget(QWidget *parent, DeckListModel *_deckListModel)
|
||||||
: QWidget(parent), deckListModel(_deckListModel)
|
: QWidget(parent), deckListModel(_deckListModel)
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
#include "mana_curve_widget.h"
|
#include "mana_curve_widget.h"
|
||||||
|
|
||||||
#include "../../../main.h"
|
#include "../../../main.h"
|
||||||
|
#include "../../deck_loader/deck_loader.h"
|
||||||
#include "../general/display/banner_widget.h"
|
#include "../general/display/banner_widget.h"
|
||||||
#include "../general/display/bar_widget.h"
|
#include "../general/display/bar_widget.h"
|
||||||
|
|
||||||
#include <libcockatrice/card/database/card_database.h>
|
#include <libcockatrice/card/database/card_database.h>
|
||||||
#include <libcockatrice/card/database/card_database_manager.h>
|
#include <libcockatrice/card/database/card_database_manager.h>
|
||||||
#include <libcockatrice/deck_list/deck_list.h>
|
#include <libcockatrice/deck_list/deck_list.h>
|
||||||
#include <libcockatrice/models/deck_list/deck_loader.h>
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
ManaCurveWidget::ManaCurveWidget(QWidget *parent, DeckListModel *_deckListModel)
|
ManaCurveWidget::ManaCurveWidget(QWidget *parent, DeckListModel *_deckListModel)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#include "mana_devotion_widget.h"
|
#include "mana_devotion_widget.h"
|
||||||
|
|
||||||
#include "../../../main.h"
|
#include "../../../main.h"
|
||||||
|
#include "../../deck_loader/deck_loader.h"
|
||||||
#include "../general/display/banner_widget.h"
|
#include "../general/display/banner_widget.h"
|
||||||
#include "../general/display/bar_widget.h"
|
#include "../general/display/bar_widget.h"
|
||||||
|
|
||||||
|
|
@ -8,7 +9,6 @@
|
||||||
#include <libcockatrice/card/database/card_database.h>
|
#include <libcockatrice/card/database/card_database.h>
|
||||||
#include <libcockatrice/card/database/card_database_manager.h>
|
#include <libcockatrice/card/database/card_database_manager.h>
|
||||||
#include <libcockatrice/deck_list/deck_list.h>
|
#include <libcockatrice/deck_list/deck_list.h>
|
||||||
#include <libcockatrice/models/deck_list/deck_loader.h>
|
|
||||||
#include <regex>
|
#include <regex>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#include "deck_editor_database_display_widget.h"
|
#include "deck_editor_database_display_widget.h"
|
||||||
|
|
||||||
|
#include "../../../client/settings/cache_settings.h"
|
||||||
#include "../../../filters/syntax_help.h"
|
#include "../../../filters/syntax_help.h"
|
||||||
#include "../../../interface/widgets/tabs/abstract_tab_deck_editor.h"
|
#include "../../../interface/widgets/tabs/abstract_tab_deck_editor.h"
|
||||||
#include "../../../interface/widgets/tabs/tab_supervisor.h"
|
#include "../../../interface/widgets/tabs/tab_supervisor.h"
|
||||||
|
|
@ -14,7 +15,6 @@
|
||||||
#include <QTreeView>
|
#include <QTreeView>
|
||||||
#include <libcockatrice/card/database/card_database_manager.h>
|
#include <libcockatrice/card/database/card_database_manager.h>
|
||||||
#include <libcockatrice/card/relation/card_relation.h>
|
#include <libcockatrice/card/relation/card_relation.h>
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
|
|
||||||
static bool canBeCommander(const CardInfo &cardInfo)
|
static bool canBeCommander(const CardInfo &cardInfo)
|
||||||
{
|
{
|
||||||
|
|
@ -143,7 +143,7 @@ void DeckEditorDatabaseDisplayWidget::updateCard(const QModelIndex ¤t, con
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!current.model()->hasChildren(current.sibling(current.row(), 0))) {
|
if (!current.model()->hasChildren(current.sibling(current.row(), 0))) {
|
||||||
emit cardChanged(getCardOrPinnedPrinting(cardName));
|
emit cardChanged(CardDatabaseManager::query()->getPreferredCard(cardName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -176,21 +176,7 @@ ExactCard DeckEditorDatabaseDisplayWidget::currentCard() const
|
||||||
|
|
||||||
const QString cardName = currentIndex.sibling(currentIndex.row(), 0).data().toString();
|
const QString cardName = currentIndex.sibling(currentIndex.row(), 0).data().toString();
|
||||||
|
|
||||||
return getCardOrPinnedPrinting(cardName);
|
return CardDatabaseManager::query()->getPreferredCard(cardName);
|
||||||
}
|
|
||||||
|
|
||||||
ExactCard DeckEditorDatabaseDisplayWidget::getCardOrPinnedPrinting(QString cardName) const
|
|
||||||
{
|
|
||||||
const auto &cardProviderId = SettingsCache::instance().cardOverrides().getCardPreferenceOverride(cardName);
|
|
||||||
|
|
||||||
ExactCard card = CardDatabaseManager::query()->getCard({cardName});
|
|
||||||
|
|
||||||
if (cardProviderId != "") {
|
|
||||||
return ExactCard(card.getCardPtr(),
|
|
||||||
CardDatabaseManager::query()->getSpecificPrinting({cardName, cardProviderId}));
|
|
||||||
}
|
|
||||||
|
|
||||||
return card;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeckEditorDatabaseDisplayWidget::databaseCustomMenu(QPoint point)
|
void DeckEditorDatabaseDisplayWidget::databaseCustomMenu(QPoint point)
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,6 @@ public:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
ExactCard currentCard() const;
|
ExactCard currentCard() const;
|
||||||
ExactCard getCardOrPinnedPrinting(QString cardName) const;
|
|
||||||
void setFilterTree(FilterTree *filterTree);
|
void setFilterTree(FilterTree *filterTree);
|
||||||
void clearAllDatabaseFilters();
|
void clearAllDatabaseFilters();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,9 @@
|
||||||
#include "deck_editor_deck_dock_widget.h"
|
#include "deck_editor_deck_dock_widget.h"
|
||||||
|
|
||||||
|
#include "../../../client/settings/cache_settings.h"
|
||||||
|
#include "../../deck_loader/deck_loader.h"
|
||||||
|
#include "deck_list_style_proxy.h"
|
||||||
|
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QDockWidget>
|
#include <QDockWidget>
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
|
|
@ -7,7 +11,6 @@
|
||||||
#include <QSplitter>
|
#include <QSplitter>
|
||||||
#include <QTextEdit>
|
#include <QTextEdit>
|
||||||
#include <libcockatrice/card/database/card_database_manager.h>
|
#include <libcockatrice/card/database/card_database_manager.h>
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
#include <libcockatrice/utility/trice_limits.h>
|
#include <libcockatrice/utility/trice_limits.h>
|
||||||
|
|
||||||
DeckEditorDeckDockWidget::DeckEditorDeckDockWidget(AbstractTabDeckEditor *parent)
|
DeckEditorDeckDockWidget::DeckEditorDeckDockWidget(AbstractTabDeckEditor *parent)
|
||||||
|
|
@ -28,9 +31,15 @@ void DeckEditorDeckDockWidget::createDeckDock()
|
||||||
deckModel = new DeckListModel(this);
|
deckModel = new DeckListModel(this);
|
||||||
deckModel->setObjectName("deckModel");
|
deckModel->setObjectName("deckModel");
|
||||||
connect(deckModel, &DeckListModel::deckHashChanged, this, &DeckEditorDeckDockWidget::updateHash);
|
connect(deckModel, &DeckListModel::deckHashChanged, this, &DeckEditorDeckDockWidget::updateHash);
|
||||||
|
|
||||||
|
deckLoader = new DeckLoader(this, deckModel->getDeckList());
|
||||||
|
|
||||||
|
DeckListStyleProxy *proxy = new DeckListStyleProxy(this);
|
||||||
|
proxy->setSourceModel(deckModel);
|
||||||
|
|
||||||
deckView = new QTreeView();
|
deckView = new QTreeView();
|
||||||
deckView->setObjectName("deckView");
|
deckView->setObjectName("deckView");
|
||||||
deckView->setModel(deckModel);
|
deckView->setModel(proxy);
|
||||||
deckView->setUniformRowHeights(true);
|
deckView->setUniformRowHeights(true);
|
||||||
deckView->setSortingEnabled(true);
|
deckView->setSortingEnabled(true);
|
||||||
deckView->sortByColumn(1, Qt::AscendingOrder);
|
deckView->sortByColumn(1, Qt::AscendingOrder);
|
||||||
|
|
@ -110,8 +119,8 @@ void DeckEditorDeckDockWidget::createDeckDock()
|
||||||
activeGroupCriteriaComboBox->addItem(tr("Mana Cost"), DeckListModelGroupCriteria::MANA_COST);
|
activeGroupCriteriaComboBox->addItem(tr("Mana Cost"), DeckListModelGroupCriteria::MANA_COST);
|
||||||
activeGroupCriteriaComboBox->addItem(tr("Colors"), DeckListModelGroupCriteria::COLOR);
|
activeGroupCriteriaComboBox->addItem(tr("Colors"), DeckListModelGroupCriteria::COLOR);
|
||||||
connect(activeGroupCriteriaComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), [this]() {
|
connect(activeGroupCriteriaComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), [this]() {
|
||||||
deckModel->setActiveGroupCriteria(
|
deckModel->setActiveGroupCriteria(static_cast<DeckListModelGroupCriteria::Type>(
|
||||||
static_cast<DeckListModelGroupCriteria>(activeGroupCriteriaComboBox->currentData(Qt::UserRole).toInt()));
|
activeGroupCriteriaComboBox->currentData(Qt::UserRole).toInt()));
|
||||||
deckModel->sort(deckView->header()->sortIndicatorSection(), deckView->header()->sortIndicatorOrder());
|
deckModel->sort(deckView->header()->sortIndicatorSection(), deckView->header()->sortIndicatorOrder());
|
||||||
deckView->expandAll();
|
deckView->expandAll();
|
||||||
deckView->expandAll();
|
deckView->expandAll();
|
||||||
|
|
@ -365,7 +374,10 @@ void DeckEditorDeckDockWidget::syncBannerCardComboBoxSelectionWithDeck()
|
||||||
*/
|
*/
|
||||||
void DeckEditorDeckDockWidget::setDeck(DeckLoader *_deck)
|
void DeckEditorDeckDockWidget::setDeck(DeckLoader *_deck)
|
||||||
{
|
{
|
||||||
deckModel->setDeckList(_deck);
|
deckLoader = _deck;
|
||||||
|
deckModel->setDeckList(deckLoader->getDeckList());
|
||||||
|
connect(deckLoader, &DeckLoader::deckLoaded, deckModel, &DeckListModel::rebuildTree);
|
||||||
|
connect(deckLoader->getDeckList(), &DeckList::deckHashChanged, deckModel, &DeckListModel::deckHashChanged);
|
||||||
|
|
||||||
nameEdit->setText(deckModel->getDeckList()->getName());
|
nameEdit->setText(deckModel->getDeckList()->getName());
|
||||||
commentsEdit->setText(deckModel->getDeckList()->getComments());
|
commentsEdit->setText(deckModel->getDeckList()->getComments());
|
||||||
|
|
@ -382,7 +394,12 @@ void DeckEditorDeckDockWidget::setDeck(DeckLoader *_deck)
|
||||||
emit deckChanged();
|
emit deckChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
DeckLoader *DeckEditorDeckDockWidget::getDeckList()
|
DeckLoader *DeckEditorDeckDockWidget::getDeckLoader()
|
||||||
|
{
|
||||||
|
return deckLoader;
|
||||||
|
}
|
||||||
|
|
||||||
|
DeckList *DeckEditorDeckDockWidget::getDeckList()
|
||||||
{
|
{
|
||||||
return deckModel->getDeckList();
|
return deckModel->getDeckList();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ class DeckEditorDeckDockWidget : public QDockWidget
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit DeckEditorDeckDockWidget(AbstractTabDeckEditor *parent);
|
explicit DeckEditorDeckDockWidget(AbstractTabDeckEditor *parent);
|
||||||
|
DeckLoader *deckLoader;
|
||||||
DeckListModel *deckModel;
|
DeckListModel *deckModel;
|
||||||
QTreeView *deckView;
|
QTreeView *deckView;
|
||||||
QComboBox *bannerCardComboBox;
|
QComboBox *bannerCardComboBox;
|
||||||
|
|
@ -41,12 +42,17 @@ public:
|
||||||
{
|
{
|
||||||
return nameEdit->text().simplified();
|
return nameEdit->text().simplified();
|
||||||
}
|
}
|
||||||
|
QComboBox *getGroupByComboBox()
|
||||||
|
{
|
||||||
|
return activeGroupCriteriaComboBox;
|
||||||
|
}
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void cleanDeck();
|
void cleanDeck();
|
||||||
void updateBannerCardComboBox();
|
void updateBannerCardComboBox();
|
||||||
void setDeck(DeckLoader *_deck);
|
void setDeck(DeckLoader *_deck);
|
||||||
DeckLoader *getDeckList();
|
DeckLoader *getDeckLoader();
|
||||||
|
DeckList *getDeckList();
|
||||||
void actIncrement();
|
void actIncrement();
|
||||||
bool swapCard(const QModelIndex &idx);
|
bool swapCard(const QModelIndex &idx);
|
||||||
void actDecrementCard(const ExactCard &card, QString zoneName);
|
void actDecrementCard(const ExactCard &card, QString zoneName);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#include "deck_editor_filter_dock_widget.h"
|
#include "deck_editor_filter_dock_widget.h"
|
||||||
|
|
||||||
|
#include "../../../client/settings/cache_settings.h"
|
||||||
#include "../../../filters/filter_builder.h"
|
#include "../../../filters/filter_builder.h"
|
||||||
#include "../../../filters/filter_tree_model.h"
|
#include "../../../filters/filter_tree_model.h"
|
||||||
|
|
||||||
|
|
@ -7,7 +8,6 @@
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
#include <libcockatrice/models/database/card_database_model.h>
|
#include <libcockatrice/models/database/card_database_model.h>
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
|
|
||||||
DeckEditorFilterDockWidget::DeckEditorFilterDockWidget(AbstractTabDeckEditor *parent)
|
DeckEditorFilterDockWidget::DeckEditorFilterDockWidget(AbstractTabDeckEditor *parent)
|
||||||
: QDockWidget(parent), deckEditor(parent)
|
: QDockWidget(parent), deckEditor(parent)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
#include "deck_list_style_proxy.h"
|
||||||
|
|
||||||
|
#include <QBrush>
|
||||||
|
#include <QColor>
|
||||||
|
#include <QFont>
|
||||||
|
#include <libcockatrice/models/deck_list/deck_list_model.h>
|
||||||
|
|
||||||
|
QVariant DeckListStyleProxy::data(const QModelIndex &index, int role) const
|
||||||
|
{
|
||||||
|
QVariant value = QIdentityProxyModel::data(index, role);
|
||||||
|
|
||||||
|
const bool isCard = QIdentityProxyModel::data(index, DeckRoles::IsCardRole).toBool();
|
||||||
|
|
||||||
|
if (role == Qt::FontRole && !isCard) {
|
||||||
|
QFont f;
|
||||||
|
f.setBold(true);
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (role == Qt::BackgroundRole) {
|
||||||
|
if (isCard) {
|
||||||
|
const bool legal =
|
||||||
|
true; // TODO: Not implemented yet. QIdentityProxyModel::data(index, DeckRoles::IsLegalRole).toBool();
|
||||||
|
int base = 255 - (index.row() % 2) * 30;
|
||||||
|
return legal ? QBrush(QColor(base, base, base)) : QBrush(QColor(255, base / 3, base / 3));
|
||||||
|
} else {
|
||||||
|
int depth = QIdentityProxyModel::data(index, DeckRoles::DepthRole).toInt();
|
||||||
|
int color = 90 + 60 * depth;
|
||||||
|
return QBrush(QColor(color, 255, color));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (role == Qt::ForegroundRole) {
|
||||||
|
return QBrush(QColor(0, 0, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
#ifndef COCKATRICE_DECK_LIST_STYLE_PROXY_H
|
||||||
|
#define COCKATRICE_DECK_LIST_STYLE_PROXY_H
|
||||||
|
|
||||||
|
#include <QIdentityProxyModel>
|
||||||
|
|
||||||
|
class DeckListStyleProxy : public QIdentityProxyModel
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
using QIdentityProxyModel::QIdentityProxyModel;
|
||||||
|
|
||||||
|
QVariant data(const QModelIndex &index, int role) const override;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // COCKATRICE_DECK_LIST_STYLE_PROXY_H
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
#include "dlg_connect.h"
|
#include "dlg_connect.h"
|
||||||
|
|
||||||
|
#include "../../../client/settings/cache_settings.h"
|
||||||
|
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
@ -12,7 +14,6 @@
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QRadioButton>
|
#include <QRadioButton>
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
#include <libcockatrice/utility/trice_limits.h>
|
#include <libcockatrice/utility/trice_limits.h>
|
||||||
|
|
||||||
DlgConnect::DlgConnect(QWidget *parent) : QDialog(parent)
|
DlgConnect::DlgConnect(QWidget *parent) : QDialog(parent)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#include "dlg_create_game.h"
|
#include "dlg_create_game.h"
|
||||||
|
|
||||||
|
#include "../../../client/settings/cache_settings.h"
|
||||||
#include "../interface/widgets/tabs/tab_room.h"
|
#include "../interface/widgets/tabs/tab_room.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
|
@ -17,7 +18,6 @@
|
||||||
#include <QWizard>
|
#include <QWizard>
|
||||||
#include <libcockatrice/protocol/pb/serverinfo_game.pb.h>
|
#include <libcockatrice/protocol/pb/serverinfo_game.pb.h>
|
||||||
#include <libcockatrice/protocol/pending_command.h>
|
#include <libcockatrice/protocol/pending_command.h>
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
#include <libcockatrice/utility/trice_limits.h>
|
#include <libcockatrice/utility/trice_limits.h>
|
||||||
|
|
||||||
void DlgCreateGame::sharedCtor()
|
void DlgCreateGame::sharedCtor()
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
#include "dlg_default_tags_editor.h"
|
#include "dlg_default_tags_editor.h"
|
||||||
|
|
||||||
|
#include "../../../client/settings/cache_settings.h"
|
||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
|
|
||||||
DlgDefaultTagsEditor::DlgDefaultTagsEditor(QWidget *parent) : QDialog(parent)
|
DlgDefaultTagsEditor::DlgDefaultTagsEditor(QWidget *parent) : QDialog(parent)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
#include "dlg_edit_password.h"
|
#include "dlg_edit_password.h"
|
||||||
|
|
||||||
|
#include "../../../client/settings/cache_settings.h"
|
||||||
|
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
#include <libcockatrice/utility/trice_limits.h>
|
#include <libcockatrice/utility/trice_limits.h>
|
||||||
|
|
||||||
DlgEditPassword::DlgEditPassword(QWidget *parent) : QDialog(parent)
|
DlgEditPassword::DlgEditPassword(QWidget *parent) : QDialog(parent)
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
#include "dlg_edit_user.h"
|
#include "dlg_edit_user.h"
|
||||||
|
|
||||||
|
#include "../../../client/settings/cache_settings.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
#include <libcockatrice/utility/trice_limits.h>
|
#include <libcockatrice/utility/trice_limits.h>
|
||||||
|
|
||||||
DlgEditUser::DlgEditUser(QWidget *parent, QString email, QString country, QString realName) : QDialog(parent)
|
DlgEditUser::DlgEditUser(QWidget *parent, QString email, QString country, QString realName) : QDialog(parent)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
#include "dlg_forgot_password_challenge.h"
|
#include "dlg_forgot_password_challenge.h"
|
||||||
|
|
||||||
|
#include "../../../client/settings/cache_settings.h"
|
||||||
|
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
|
|
@ -7,7 +9,6 @@
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
#include <libcockatrice/utility/trice_limits.h>
|
#include <libcockatrice/utility/trice_limits.h>
|
||||||
|
|
||||||
DlgForgotPasswordChallenge::DlgForgotPasswordChallenge(QWidget *parent) : QDialog(parent)
|
DlgForgotPasswordChallenge::DlgForgotPasswordChallenge(QWidget *parent) : QDialog(parent)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
#include "dlg_forgot_password_request.h"
|
#include "dlg_forgot_password_request.h"
|
||||||
|
|
||||||
|
#include "../../../client/settings/cache_settings.h"
|
||||||
|
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
|
|
@ -7,7 +9,6 @@
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
#include <libcockatrice/utility/trice_limits.h>
|
#include <libcockatrice/utility/trice_limits.h>
|
||||||
|
|
||||||
DlgForgotPasswordRequest::DlgForgotPasswordRequest(QWidget *parent) : QDialog(parent)
|
DlgForgotPasswordRequest::DlgForgotPasswordRequest(QWidget *parent) : QDialog(parent)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
#include "dlg_forgot_password_reset.h"
|
#include "dlg_forgot_password_reset.h"
|
||||||
|
|
||||||
|
#include "../../../client/settings/cache_settings.h"
|
||||||
|
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
|
|
@ -7,7 +9,6 @@
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
#include <libcockatrice/utility/trice_limits.h>
|
#include <libcockatrice/utility/trice_limits.h>
|
||||||
|
|
||||||
DlgForgotPasswordReset::DlgForgotPasswordReset(QWidget *parent) : QDialog(parent)
|
DlgForgotPasswordReset::DlgForgotPasswordReset(QWidget *parent) : QDialog(parent)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#include "dlg_load_deck.h"
|
#include "dlg_load_deck.h"
|
||||||
|
|
||||||
#include <libcockatrice/models/deck_list/deck_loader.h>
|
#include "../../../client/settings/cache_settings.h"
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
#include "../../deck_loader/deck_loader.h"
|
||||||
|
|
||||||
DlgLoadDeck::DlgLoadDeck(QWidget *parent) : QFileDialog(parent, tr("Load Deck"))
|
DlgLoadDeck::DlgLoadDeck(QWidget *parent) : QFileDialog(parent, tr("Load Deck"))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
#include "dlg_load_deck_from_clipboard.h"
|
#include "dlg_load_deck_from_clipboard.h"
|
||||||
|
|
||||||
|
#include "../../../client/settings/cache_settings.h"
|
||||||
|
#include "../../deck_loader/deck_loader.h"
|
||||||
#include "dlg_settings.h"
|
#include "dlg_settings.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
|
@ -11,8 +13,6 @@
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <libcockatrice/models/deck_list/deck_loader.h>
|
|
||||||
#include <libcockatrice/settings/cache_settings.h>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the main layout and connects the signals that are common to all versions of this window
|
* Creates the main layout and connects the signals that are common to all versions of this window
|
||||||
|
|
@ -75,12 +75,12 @@ bool AbstractDlgDeckTextEdit::loadIntoDeck(DeckLoader *deckLoader) const
|
||||||
QString buffer = contentsEdit->toPlainText();
|
QString buffer = contentsEdit->toPlainText();
|
||||||
|
|
||||||
if (buffer.contains("<cockatrice_deck version=\"1\">")) {
|
if (buffer.contains("<cockatrice_deck version=\"1\">")) {
|
||||||
return deckLoader->loadFromString_Native(buffer);
|
return deckLoader->getDeckList()->loadFromString_Native(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
QTextStream stream(&buffer);
|
QTextStream stream(&buffer);
|
||||||
|
|
||||||
if (deckLoader->loadFromStream_Plain(stream, true)) {
|
if (deckLoader->getDeckList()->loadFromStream_Plain(stream, true)) {
|
||||||
if (loadSetNameAndNumberCheckBox->isChecked()) {
|
if (loadSetNameAndNumberCheckBox->isChecked()) {
|
||||||
deckLoader->resolveSetNameAndNumberToProviderID();
|
deckLoader->resolveSetNameAndNumberToProviderID();
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -121,8 +121,7 @@ void DlgLoadDeckFromClipboard::actRefresh()
|
||||||
|
|
||||||
void DlgLoadDeckFromClipboard::actOK()
|
void DlgLoadDeckFromClipboard::actOK()
|
||||||
{
|
{
|
||||||
deckList = new DeckLoader;
|
deckList = new DeckLoader(this);
|
||||||
deckList->setParent(this);
|
|
||||||
|
|
||||||
if (loadIntoDeck(deckList)) {
|
if (loadIntoDeck(deckList)) {
|
||||||
accept();
|
accept();
|
||||||
|
|
|
||||||
|
|
@ -95,9 +95,9 @@ void DlgLoadDeckFromWebsite::accept()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse the plain text deck here
|
// Parse the plain text deck here
|
||||||
DeckLoader *loader = new DeckLoader();
|
DeckLoader *loader = new DeckLoader(this);
|
||||||
QTextStream stream(&deckText);
|
QTextStream stream(&deckText);
|
||||||
loader->loadFromStream_Plain(stream, false);
|
loader->getDeckList()->loadFromStream_Plain(stream, false);
|
||||||
loader->resolveSetNameAndNumberToProviderID();
|
loader->resolveSetNameAndNumberToProviderID();
|
||||||
deck = loader;
|
deck = loader;
|
||||||
|
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue