mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-19 17:02:15 -07:00
Compare commits
239 commits
a9284596a8
...
779b4d2c95
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
779b4d2c95 | ||
|
|
0155d2b2bc | ||
|
|
96b331746b | ||
|
|
7d6d625ed4 | ||
|
|
e9e3515628 | ||
|
|
7168802bbf | ||
|
|
98c00c55ed | ||
|
|
d2164c3f08 | ||
|
|
8004d4f2d4 | ||
|
|
8751f0605d | ||
|
|
09d817770e | ||
|
|
81a2712b92 | ||
|
|
8dca14933c | ||
|
|
74102aa1ec | ||
|
|
a9003be30f | ||
|
|
6faa0d54e3 | ||
|
|
33e0f8699b | ||
|
|
03d54265fe | ||
|
|
491d1c9187 | ||
|
|
bddf9bd818 | ||
|
|
0549892092 | ||
|
|
10b9a65f17 | ||
|
|
5219cffa6b | ||
|
|
71790d8e10 | ||
|
|
fe31a49f86 | ||
|
|
55c84ca860 | ||
|
|
40b947c1e7 | ||
|
|
40cef0e436 | ||
|
|
9f1c225b7a | ||
|
|
af2f888293 | ||
|
|
7a5b2e9f0e | ||
|
|
021a9f8383 | ||
|
|
cba9ce2b2b | ||
|
|
bb1a5b33a1 | ||
|
|
6ac340026f | ||
|
|
059eeebe89 | ||
|
|
117ea543c5 | ||
|
|
989a5be23b | ||
|
|
f8ce5c2e39 | ||
|
|
20cd7ce73d | ||
|
|
aadee34238 | ||
|
|
7153f7d4c1 | ||
|
|
762e742be0 | ||
|
|
67f6ab66f0 | ||
|
|
7507103bb2 | ||
|
|
fe12f4cbb9 | ||
|
|
d18f3bce47 | ||
|
|
b66743c83c | ||
|
|
1a62f82aee | ||
|
|
5735a44a9a | ||
|
|
dbaf5f2e05 | ||
|
|
9c53dad4b8 | ||
|
|
7814204fe2 | ||
|
|
cdb171f201 | ||
|
|
48e21aad38 | ||
|
|
f223ff387e | ||
|
|
8845a75627 | ||
|
|
caf2bb9ded | ||
|
|
985936a917 | ||
|
|
2c51054e77 | ||
|
|
f7eeaeddcb | ||
|
|
6cace2a8e6 | ||
|
|
6b5f341e10 | ||
|
|
63143f9416 | ||
|
|
efe52b5412 | ||
|
|
0e014c0e5c | ||
|
|
511ccae738 | ||
|
|
0672603755 | ||
|
|
f5f326f65b | ||
|
|
c5702cc8b6 | ||
|
|
4f2f942121 | ||
|
|
a4c2b1411f | ||
|
|
43bee2316e | ||
|
|
19dbb17fb9 | ||
|
|
7c9fbe2be0 | ||
|
|
d30690236a | ||
|
|
ac2e995f15 | ||
|
|
dac611f0f1 | ||
|
|
45ab2602c6 | ||
|
|
5101cc3d74 | ||
|
|
9ac9a0c73a | ||
|
|
314a577807 | ||
|
|
c5ace60f26 | ||
|
|
8953ae3c67 | ||
|
|
b1fe4c85d3 | ||
|
|
a20f3c0fb4 | ||
|
|
9226bc9ddd | ||
|
|
501c4b96d4 | ||
|
|
6ab947418c | ||
|
|
6765831b92 | ||
|
|
98c4e829f8 | ||
|
|
ccb9901b28 | ||
|
|
58a8c7d3df | ||
|
|
655a8e52a1 | ||
|
|
db235ecae8 | ||
|
|
682ac4ed0c | ||
|
|
77978c7178 | ||
|
|
e918856fa4 | ||
|
|
87c4216e80 | ||
|
|
832f70496a | ||
|
|
f97864b72b | ||
|
|
338c56678a | ||
|
|
8cc65b8967 | ||
|
|
2e10b2f5d5 | ||
|
|
92fe406c22 | ||
|
|
d677e2bb70 | ||
|
|
e977f123ce | ||
|
|
f56b672307 | ||
|
|
29c1d7f3e4 | ||
|
|
36aba81b1b | ||
|
|
f9fb03b26b | ||
|
|
d2732ac742 | ||
|
|
9aa5702e14 | ||
|
|
2d412bfe52 | ||
|
|
ac06fb9d1c | ||
|
|
d7b31f2f9d | ||
|
|
635fae101d | ||
|
|
335022c4aa | ||
|
|
dbed6890da | ||
|
|
3ec9ae9772 | ||
|
|
a46ab5cd68 | ||
|
|
690a00aa6c | ||
|
|
ba786a0289 | ||
|
|
9dfac77ba2 | ||
|
|
f3370a4f52 | ||
|
|
7caa88bc58 | ||
|
|
34a5b8b9ce | ||
|
|
d8e3807ec5 | ||
|
|
42bd8164a0 | ||
|
|
abf6e72ad1 | ||
|
|
74cce5ccb2 | ||
|
|
dd053c76df | ||
|
|
5ef428b9d0 | ||
|
|
94ea574c76 | ||
|
|
70b41c2095 | ||
|
|
aa85a39d6a | ||
|
|
51c684251f | ||
|
|
fa2934373c | ||
|
|
414567f8b6 | ||
|
|
bc219191db | ||
|
|
652c8464a7 | ||
|
|
067fe9b534 | ||
|
|
38c85e6db1 | ||
|
|
c5cd7d8700 | ||
|
|
fc453c68a7 | ||
|
|
69c046cca4 | ||
|
|
dd8164611b | ||
|
|
b4a5c863d7 | ||
|
|
4a3d79d00b | ||
|
|
96f436b65e | ||
|
|
cf01dc770b | ||
|
|
ce652de272 | ||
|
|
9bb399606c | ||
|
|
8180d2e3b0 | ||
|
|
33d5721490 | ||
|
|
2b2a6db081 | ||
|
|
aa4592dc9e | ||
|
|
20ad9af989 | ||
|
|
9e2276a59f | ||
|
|
42cec10457 | ||
|
|
95d7e027fc | ||
|
|
8268311fab | ||
|
|
413b4b637b | ||
|
|
e79bbc67b9 | ||
|
|
15a1d5440b | ||
|
|
fd293444c5 | ||
|
|
852429f248 | ||
|
|
4606fcdbd5 | ||
|
|
c375cdbb1a | ||
|
|
f15b70e4ae | ||
|
|
2f10634ca2 | ||
|
|
dead993639 | ||
|
|
bd5cbb89d4 | ||
|
|
14f1925edc | ||
|
|
e39bbd2b31 | ||
|
|
04f06206b7 | ||
|
|
1bcea27a44 | ||
|
|
e7a3ad86eb | ||
|
|
b36ab66583 | ||
|
|
566c876bdc | ||
|
|
43acac5f5d | ||
|
|
846ecb7e8d | ||
|
|
2fba5dcd20 | ||
|
|
2828854d32 | ||
|
|
9794893b63 | ||
|
|
e57ee8e9c9 | ||
|
|
f978407a19 | ||
|
|
59ce70afc5 | ||
|
|
208ccc3a1a | ||
|
|
6f8f9f016a | ||
|
|
7ad2481e3d | ||
|
|
12c667afd7 | ||
|
|
2cb16c9fd0 | ||
|
|
9f00c6f955 | ||
|
|
a90997353b | ||
|
|
c6dc7eee64 | ||
|
|
0f2899b5c7 | ||
|
|
71cf3fabbf | ||
|
|
f0da3cff40 | ||
|
|
485e4d56aa | ||
|
|
99424e460b | ||
|
|
006abf79b1 | ||
|
|
5c3c3bfdba | ||
|
|
189f3a7bbc | ||
|
|
6ab558dd58 | ||
|
|
a7bb5254a3 | ||
|
|
ef87b54b43 | ||
|
|
88d0ebb12d | ||
|
|
bdb42bbbbd | ||
|
|
ac7ff3a0e9 | ||
|
|
1eb6027443 | ||
|
|
edc8691731 | ||
|
|
804a60f1ea | ||
|
|
a80a0531a6 | ||
|
|
24bc713ba8 | ||
|
|
4884640070 | ||
|
|
8d7535c039 | ||
|
|
32aa60bb14 | ||
|
|
3ada27eae1 | ||
|
|
a096a0e3bb | ||
|
|
d410078673 | ||
|
|
bf5891a910 | ||
|
|
c7249dfbd9 | ||
|
|
1b29e0bfa8 | ||
|
|
5cc5767c87 | ||
|
|
165c4ddd2a | ||
|
|
7b64970e97 | ||
|
|
5309dd17be | ||
|
|
364470b3c8 | ||
|
|
915da79cad | ||
|
|
630c71f123 | ||
|
|
0b4e7be596 | ||
|
|
303bd8b607 | ||
|
|
c02cf5e89e | ||
|
|
92f02fa4ee | ||
|
|
49e6cf95c4 | ||
|
|
8a126263a9 | ||
|
|
afdb385770 | ||
|
|
5b8897231d |
1072 changed files with 53256 additions and 90655 deletions
|
|
@ -1,26 +0,0 @@
|
||||||
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 \
|
|
||||||
liblzma-dev \
|
|
||||||
libmariadb-dev-compat \
|
|
||||||
libprotobuf-dev \
|
|
||||||
libqt5multimedia5-plugins \
|
|
||||||
libqt5sql5-mysql \
|
|
||||||
libqt5svg5-dev \
|
|
||||||
libqt5websockets5-dev \
|
|
||||||
ninja-build \
|
|
||||||
protobuf-compiler \
|
|
||||||
qt5-image-formats-plugins \
|
|
||||||
qtmultimedia5-dev \
|
|
||||||
qttools5-dev \
|
|
||||||
qttools5-dev-tools \
|
|
||||||
&& apt-get clean \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
FROM fedora:42
|
FROM fedora:44
|
||||||
|
|
||||||
RUN dnf install -y \
|
RUN dnf install -y \
|
||||||
ccache \
|
ccache \
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
FROM debian:11
|
FROM debian:12
|
||||||
|
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||||
|
|
@ -11,11 +11,11 @@ RUN apt-get update && \
|
||||||
git \
|
git \
|
||||||
libmariadb-dev-compat \
|
libmariadb-dev-compat \
|
||||||
libprotobuf-dev \
|
libprotobuf-dev \
|
||||||
libqt5sql5-mysql \
|
libqt6sql6-mysql \
|
||||||
libqt5websockets5-dev \
|
|
||||||
ninja-build \
|
ninja-build \
|
||||||
protobuf-compiler \
|
protobuf-compiler \
|
||||||
qttools5-dev \
|
qt6-tools-dev \
|
||||||
qttools5-dev-tools \
|
qt6-tools-dev-tools \
|
||||||
|
qt6-websockets-dev \
|
||||||
&& apt-get clean \
|
&& apt-get clean \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
FROM ubuntu:22.04
|
FROM ubuntu:26.04
|
||||||
|
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||||
build-essential \
|
build-essential \
|
||||||
|
ca-certificates \
|
||||||
ccache \
|
ccache \
|
||||||
clang-format \
|
clang-format \
|
||||||
cmake \
|
cmake \
|
||||||
|
|
@ -15,14 +16,14 @@ RUN apt-get update && \
|
||||||
libprotobuf-dev \
|
libprotobuf-dev \
|
||||||
libqt6multimedia6 \
|
libqt6multimedia6 \
|
||||||
libqt6sql6-mysql \
|
libqt6sql6-mysql \
|
||||||
libqt6svg6-dev \
|
|
||||||
libqt6websockets6-dev \
|
|
||||||
ninja-build \
|
ninja-build \
|
||||||
protobuf-compiler \
|
protobuf-compiler \
|
||||||
qt6-image-formats-plugins \
|
qt6-image-formats-plugins \
|
||||||
qt6-l10n-tools \
|
qt6-l10n-tools \
|
||||||
qt6-multimedia-dev \
|
qt6-multimedia-dev \
|
||||||
|
qt6-svg-dev \
|
||||||
qt6-tools-dev \
|
qt6-tools-dev \
|
||||||
qt6-tools-dev-tools \
|
qt6-tools-dev-tools \
|
||||||
|
qt6-websockets-dev \
|
||||||
&& apt-get clean \
|
&& apt-get clean \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
@ -10,9 +10,11 @@
|
||||||
# --test runs tests
|
# --test runs tests
|
||||||
# --debug or --release sets the build type ie CMAKE_BUILD_TYPE
|
# --debug or --release sets the build type ie CMAKE_BUILD_TYPE
|
||||||
# --ccache [<size>] uses ccache and shows stats, optionally provide size
|
# --ccache [<size>] uses ccache and shows stats, optionally provide size
|
||||||
|
# --evict-ccache <age> runs ccache eviction based on given age after build
|
||||||
# --dir <dir> sets the name of the build dir, default is "build"
|
# --dir <dir> sets the name of the build dir, default is "build"
|
||||||
|
# --cmake-generator <generator> sets CMAKE_GENERATOR as used by cmake
|
||||||
# --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_NO_CLIENT 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 CCACHE_EVICTION_AGE 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
|
||||||
|
|
||||||
|
|
@ -71,6 +73,15 @@ while [[ $# != 0 ]]; do
|
||||||
shift
|
shift
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
'--evict-ccache')
|
||||||
|
shift
|
||||||
|
if [[ $# == 0 ]]; then
|
||||||
|
echo "::error file=$0::--evict-ccache expects an argument"
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
CCACHE_EVICTION_AGE=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
'--vcpkg')
|
'--vcpkg')
|
||||||
USE_VCPKG=1
|
USE_VCPKG=1
|
||||||
shift
|
shift
|
||||||
|
|
@ -84,6 +95,15 @@ while [[ $# != 0 ]]; do
|
||||||
BUILD_DIR="$1"
|
BUILD_DIR="$1"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
'--cmake-generator')
|
||||||
|
shift
|
||||||
|
if [[ $# == 0 ]]; then
|
||||||
|
echo "::error file=$0::--cmake-generator expects an argument"
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
export CMAKE_GENERATOR=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
'--target-macos-version')
|
'--target-macos-version')
|
||||||
shift
|
shift
|
||||||
if [[ $# == 0 ]]; then
|
if [[ $# == 0 ]]; then
|
||||||
|
|
@ -183,7 +203,11 @@ if [[ $RUNNER_OS == macOS ]]; then
|
||||||
arch="x64"
|
arch="x64"
|
||||||
fi
|
fi
|
||||||
mkdir -p "$triplets_dir"
|
mkdir -p "$triplets_dir"
|
||||||
cp "../vcpkg/triplets/$arch-osx.cmake" "$triplet_file"
|
triplet_source="../vcpkg/triplets/$arch-osx.cmake"
|
||||||
|
if [[ ! -f "$triplet_source" ]]; then
|
||||||
|
triplet_source="../vcpkg/triplets/community/$arch-osx.cmake"
|
||||||
|
fi
|
||||||
|
cp "$triplet_source" "$triplet_file"
|
||||||
echo "set(VCPKG_CMAKE_SYSTEM_VERSION $TARGET_MACOS_VERSION)" >>"$triplet_file"
|
echo "set(VCPKG_CMAKE_SYSTEM_VERSION $TARGET_MACOS_VERSION)" >>"$triplet_file"
|
||||||
echo "set(VCPKG_OSX_DEPLOYMENT_TARGET $TARGET_MACOS_VERSION)" >>"$triplet_file"
|
echo "set(VCPKG_OSX_DEPLOYMENT_TARGET $TARGET_MACOS_VERSION)" >>"$triplet_file"
|
||||||
flags+=("-DVCPKG_OVERLAY_TRIPLETS=$triplets_dir")
|
flags+=("-DVCPKG_OVERLAY_TRIPLETS=$triplets_dir")
|
||||||
|
|
@ -251,9 +275,16 @@ cmake --build . "${buildflags[@]}"
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
if [[ $USE_CCACHE ]]; then
|
if [[ $USE_CCACHE ]]; then
|
||||||
|
if [[ $CCACHE_EVICTION_AGE ]]; then
|
||||||
|
echo "::group::evict ccache files older than $CCACHE_EVICTION_AGE"
|
||||||
|
ccache --evict-older-than "$CCACHE_EVICTION_AGE"
|
||||||
|
echo "::endgroup::"
|
||||||
|
fi
|
||||||
echo "::group::Show ccache stats again"
|
echo "::group::Show ccache stats again"
|
||||||
ccachestatsverbose
|
ccachestatsverbose
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
elif [[ $CCACHE_EVICTION_AGE ]]; then
|
||||||
|
echo "::error file=$0::ccache eviction is enabled while ccache is disabled!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $RUNNER_OS == macOS ]]; then
|
if [[ $RUNNER_OS == macOS ]]; then
|
||||||
|
|
|
||||||
|
|
@ -3,17 +3,28 @@
|
||||||
# This script is to be used by the ci environment from the project root directory, do not use it from somewhere else.
|
# This script is to be used by the ci environment from the project root directory, do not use it from somewhere else.
|
||||||
|
|
||||||
# Creates or loads docker images to use in compilation, creates RUN function to start compilation on the docker image.
|
# Creates or loads docker images to use in compilation, creates RUN function to start compilation on the docker image.
|
||||||
# <arg> sets the name of the docker image, these correspond to directories in .ci
|
#
|
||||||
|
# usage: source <script> <name> [--get] [--build] [--save] [--interactive] [--set-cache <location>]
|
||||||
|
# <name> sets the name of the docker image, these correspond to directories in .ci
|
||||||
# --get loads the image from a previously saved image cache, will build if no image is found
|
# --get loads the image from a previously saved image cache, will build if no image is found
|
||||||
# --build builds the image from the Dockerfile in .ci/$NAME
|
# --build builds the image from the Dockerfile in .ci/$NAME
|
||||||
# --save stores the image, if an image was loaded it will not be stored
|
# --save stores the image, if an image was loaded it will not be stored
|
||||||
# --interactive immediately starts the image interactively for debugging
|
# --interactive immediately starts the image interactively for debugging
|
||||||
# --set-cache <location> sets the location to cache the image or for ccache
|
# --set-cache <location> sets the location to cache the image or for ccache
|
||||||
|
#
|
||||||
# requires: docker
|
# requires: docker
|
||||||
# uses env: NAME CACHE BUILD GET SAVE INTERACTIVE
|
# uses env: NAME CACHE BUILD GET SAVE INTERACTIVE
|
||||||
# (correspond to args: <name> --set-cache <cache> --build --get --save --interactive)
|
# (correspond to args: <name> --set-cache <cache> --build --get --save --interactive)
|
||||||
# sets env: RUN CCACHE_DIR IMAGE_NAME RUN_ARGS RUN_OPTS BUILD_SCRIPT
|
# sets env: RUN CCACHE_DIR IMAGE_NAME RUN_ARGS RUN_OPTS BUILD_SCRIPT
|
||||||
# exitcode: 1 for failure, 2 for missing dockerfile, 3 for invalid arguments
|
# exitcode: 1 for failure, 2 for missing dockerfile, 3 for invalid arguments
|
||||||
|
#
|
||||||
|
# exported RUN function will run the BUILD_SCRIPT inside of the docker container.
|
||||||
|
# note that the docker container will not inherit any environment variables!
|
||||||
|
#
|
||||||
|
# usage: RUN [arguments for build script]
|
||||||
|
# roughly equivalent to `docker run $IMAGE_NAME bash $BUILD_SCRIPT $@`
|
||||||
|
# uses env: CCACHE_DIR IMAGE_NAME RUN_ARGS RUN_OPTS BUILD_SCRIPT
|
||||||
|
# exitcode: 3 for invalid arguments, returns the returncode of docker run
|
||||||
export BUILD_SCRIPT=".ci/compile.sh"
|
export BUILD_SCRIPT=".ci/compile.sh"
|
||||||
|
|
||||||
project_name="cockatrice"
|
project_name="cockatrice"
|
||||||
|
|
@ -41,12 +52,17 @@ while [[ $# != 0 ]]; do
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
'--set-cache')
|
'--set-cache')
|
||||||
CACHE=$2
|
shift
|
||||||
|
if [[ $# == 0 ]]; then
|
||||||
|
echo "--set-cache expects an argument" >&2
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
CACHE=$1
|
||||||
|
shift
|
||||||
if ! [[ -d $CACHE ]]; then
|
if ! [[ -d $CACHE ]]; then
|
||||||
echo "could not find cache path: $CACHE" >&2
|
echo "could not find cache path: $CACHE" >&2
|
||||||
return 3
|
return 3
|
||||||
fi
|
fi
|
||||||
shift 2
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
if [[ ${1:0:1} == - ]]; then
|
if [[ ${1:0:1} == - ]]; then
|
||||||
|
|
@ -149,10 +165,11 @@ function RUN ()
|
||||||
args+=(--mount "type=bind,source=$CCACHE_DIR,target=/.ccache")
|
args+=(--mount "type=bind,source=$CCACHE_DIR,target=/.ccache")
|
||||||
args+=(--env "CCACHE_DIR=/.ccache")
|
args+=(--env "CCACHE_DIR=/.ccache")
|
||||||
fi
|
fi
|
||||||
if [[ -n "$CMAKE_GENERATOR" ]]; then
|
if [[ $GITHUB_OUTPUT ]]; then
|
||||||
args+=(--env "CMAKE_GENERATOR=$CMAKE_GENERATOR")
|
args+=(--mount "type=bind,source=$GITHUB_OUTPUT,target=/gh_output")
|
||||||
|
args+=(--env "GITHUB_OUTPUT=/gh_output")
|
||||||
fi
|
fi
|
||||||
# shellcheck disable=2086
|
# shellcheck disable=2086
|
||||||
docker run "${args[@]}" $RUN_ARGS "$IMAGE_NAME" bash "$BUILD_SCRIPT" $RUN_OPTS "$@"
|
docker run "${args[@]}" $RUN_ARGS "$IMAGE_NAME" bash "$BUILD_SCRIPT" $RUN_OPTS "$@"
|
||||||
return $?
|
return $?
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
# used by the ci to rename build artifacts
|
# used by the ci to rename build artifacts
|
||||||
# renames the file to [original name][SUFFIX].[original extension]
|
# renames the file to [original name][SUFFIX].[original extension]
|
||||||
# where SUFFIX is either available in the environment or as the first arg
|
# where SUFFIX is either available in the environment or as the first arg
|
||||||
# if MAKE_ZIP is set instead a zip is made
|
|
||||||
# expected to be run in the build directory unless BUILD_DIR is set
|
# expected to be run in the build directory unless BUILD_DIR is set
|
||||||
# adds output to GITHUB_OUTPUT
|
# adds output to GITHUB_OUTPUT
|
||||||
builddir="${BUILD_DIR:=.}"
|
builddir="${BUILD_DIR:=.}"
|
||||||
|
|
@ -22,8 +21,8 @@ set -e
|
||||||
|
|
||||||
# find file
|
# find file
|
||||||
found="$(find "$builddir" -maxdepth 1 -type f -name "$findrx" -print -quit)"
|
found="$(find "$builddir" -maxdepth 1 -type f -name "$findrx" -print -quit)"
|
||||||
path="${found%/*}" # remove all after last /
|
path="${found%/*}" # remove all including first "/" from right side
|
||||||
file="${found##*/}" # remove all before last /
|
file="${found##*/}" # remove all including last "/" from left side
|
||||||
if [[ ! $file ]]; then
|
if [[ ! $file ]]; then
|
||||||
echo "::error file=$0::could not find package"
|
echo "::error file=$0::could not find package"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
@ -35,21 +34,16 @@ if ! cd "$path"; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# set filename
|
# set filename
|
||||||
name="${file%.*}" # remove all after last .
|
name="${file%.*}" # remove all including first "." from right side
|
||||||
new_name="$name$SUFFIX."
|
new_name="$name$SUFFIX"
|
||||||
if [[ $MAKE_ZIP ]]; then
|
extension="${file##*.}" # remove all including last "." from left side
|
||||||
filename="${new_name}zip"
|
filename="$new_name.$extension"
|
||||||
echo "creating zip '$filename' from '$file'"
|
echo "renaming '$file' to '$filename'"
|
||||||
zip "$filename" "$file"
|
mv "$file" "$filename"
|
||||||
else
|
|
||||||
extension="${file##*.}" # remove all before last .
|
|
||||||
filename="$new_name$extension"
|
|
||||||
echo "renaming '$file' to '$filename'"
|
|
||||||
mv "$file" "$filename"
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd "$oldpwd"
|
cd "$oldpwd"
|
||||||
relative_path="$path/$filename"
|
relative_path="$path/$filename"
|
||||||
ls -l "$relative_path"
|
ls -l "$relative_path"
|
||||||
echo "path=$relative_path" >>"$GITHUB_OUTPUT"
|
echo "path=$relative_path" >>"$GITHUB_OUTPUT"
|
||||||
echo "name=$filename" >>"$GITHUB_OUTPUT"
|
echo "name=$new_name" >>"$GITHUB_OUTPUT"
|
||||||
|
echo "fullname=$filename" >>"$GITHUB_OUTPUT"
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,8 @@ else
|
||||||
echo "'$previous' to '$TAG' ($count commits)"
|
echo "'$previous' to '$TAG' ($count commits)"
|
||||||
# --> is the markdown comment escape sequence, emojis are way better
|
# --> is the markdown comment escape sequence, emojis are way better
|
||||||
generated_list="${generated_list//-->/→}"
|
generated_list="${generated_list//-->/→}"
|
||||||
|
# Escape & to preserve it from commit message into markdown output
|
||||||
|
generated_list="${generated_list//&/\\&}"
|
||||||
body="${body//--REPLACE-WITH-GENERATED-LIST--/$generated_list}"
|
body="${body//--REPLACE-WITH-GENERATED-LIST--/$generated_list}"
|
||||||
body="${body//--REPLACE-WITH-COMMIT-COUNT--/$count}"
|
body="${body//--REPLACE-WITH-COMMIT-COUNT--/$count}"
|
||||||
body="${body//--REPLACE-WITH-PREVIOUS-RELEASE-TAG--/$previous}"
|
body="${body//--REPLACE-WITH-PREVIOUS-RELEASE-TAG--/$previous}"
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ Available pre-compiled binaries for installation:
|
||||||
|
|
||||||
<b>Windows</b>
|
<b>Windows</b>
|
||||||
• <kbd>Windows 10+</kbd>
|
• <kbd>Windows 10+</kbd>
|
||||||
• <kbd>Windows 7+</kbd>
|
|
||||||
|
|
||||||
<b>macOS</b>
|
<b>macOS</b>
|
||||||
• <kbd>macOS 15+</kbd> <sub><i>Sequoia</i></sub> <sub>Apple M</sub>
|
• <kbd>macOS 15+</kbd> <sub><i>Sequoia</i></sub> <sub>Apple M</sub>
|
||||||
|
|
@ -18,16 +17,17 @@ Available pre-compiled binaries for installation:
|
||||||
• <kbd>macOS 13+</kbd> <sub><i>Ventura</i></sub> <sub>Intel</sub>
|
• <kbd>macOS 13+</kbd> <sub><i>Ventura</i></sub> <sub>Intel</sub>
|
||||||
|
|
||||||
<b>Linux</b>
|
<b>Linux</b>
|
||||||
|
• <kbd>Ubuntu 26.04 LTS</kbd> <sub><i>Resolute Racoon</i></sub>
|
||||||
• <kbd>Ubuntu 24.04 LTS</kbd> <sub><i>Noble Numbat</i></sub>
|
• <kbd>Ubuntu 24.04 LTS</kbd> <sub><i>Noble Numbat</i></sub>
|
||||||
• <kbd>Ubuntu 22.04 LTS</kbd> <sub><i>Jammy Jellyfish</i></sub>
|
|
||||||
• <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>Fedora 44</kbd>
|
||||||
• <kbd>Fedora 43</kbd>
|
• <kbd>Fedora 43</kbd>
|
||||||
• <kbd>Fedora 42</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>
|
||||||
|
|
||||||
|
<sub>We provide a <kbd>Docker</kbd> image for "Servatrice" in <a href="https://github.com/Cockatrice/Cockatrice/pkgs/container/servatrice">GHCR</a>. You can docker pull it or use our Docker Compose files!</sub>
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -83,7 +83,6 @@ Remove empty headers when done.
|
||||||
### Under the Hood
|
### Under the Hood
|
||||||
### Oracle
|
### Oracle
|
||||||
### Servatrice
|
### Servatrice
|
||||||
### Webatrice
|
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,16 @@ if ! hash aqt; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Resolve latest patch
|
# Resolve latest patch
|
||||||
if ! qt_resolved=$(aqt list-qt mac desktop --spec "$qt_spec" --latest-version); then
|
if [[ $RUNNER_OS == macOS ]]; then
|
||||||
|
if ! qt_resolved=$(aqt list-qt mac desktop --spec "$qt_spec" --latest-version); then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
elif [[ $RUNNER_OS == Windows ]]; then
|
||||||
|
if ! qt_resolved=$(aqt list-qt windows desktop --spec "$qt_spec" --latest-version); then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "aqt command for $RUNNER_OS not defined."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,9 @@ AccessModifierOffset: -4
|
||||||
ColumnLimit: 120
|
ColumnLimit: 120
|
||||||
---
|
---
|
||||||
Language: Cpp
|
Language: Cpp
|
||||||
BreakBeforeBraces: Custom
|
AllowAllParametersOfDeclarationOnNextLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: None
|
||||||
|
BinPackParameters: false
|
||||||
BraceWrapping:
|
BraceWrapping:
|
||||||
AfterClass: true
|
AfterClass: true
|
||||||
AfterControlStatement: false
|
AfterControlStatement: false
|
||||||
|
|
@ -18,16 +20,14 @@ BraceWrapping:
|
||||||
SplitEmptyFunction: true
|
SplitEmptyFunction: true
|
||||||
SplitEmptyRecord: true
|
SplitEmptyRecord: true
|
||||||
SplitEmptyNamespace: true
|
SplitEmptyNamespace: true
|
||||||
AllowShortFunctionsOnASingleLine: None
|
BreakBeforeBraces: Custom
|
||||||
BinPackParameters: false
|
|
||||||
AllowAllParametersOfDeclarationOnNextLine: false
|
|
||||||
IndentCaseLabels: true
|
|
||||||
PointerAlignment: Right
|
|
||||||
SortIncludes: true
|
|
||||||
IncludeBlocks: Regroup
|
IncludeBlocks: Regroup
|
||||||
|
IndentCaseLabels: true
|
||||||
|
InsertBraces: true
|
||||||
|
PointerAlignment: Right
|
||||||
|
RemoveSemicolon: true
|
||||||
|
SortIncludes: true
|
||||||
StatementAttributeLikeMacros: [emit]
|
StatementAttributeLikeMacros: [emit]
|
||||||
# requires clang-format 16
|
|
||||||
# RemoveSemicolon: true
|
|
||||||
---
|
---
|
||||||
Language: Proto
|
Language: Proto
|
||||||
AllowShortFunctionsOnASingleLine: None
|
AllowShortFunctionsOnASingleLine: None
|
||||||
|
|
|
||||||
16
.github/CONTRIBUTING.md
vendored
16
.github/CONTRIBUTING.md
vendored
|
|
@ -209,6 +209,16 @@ nowadays and clean it up for you.
|
||||||
Lines should be 120 characters or less. Please break up lines that are too long
|
Lines should be 120 characters or less. Please break up lines that are too long
|
||||||
into smaller parts, for example at spaces or after opening a brace.
|
into smaller parts, for example at spaces or after opening a brace.
|
||||||
|
|
||||||
|
### Documentation Comments ###
|
||||||
|
|
||||||
|
Use [Doxygen](https://www.doxygen.nl/) for code documentation:
|
||||||
|
|
||||||
|
- **Doc blocks**: Use `/** @brief Description */` (Javadoc-style), not `///`
|
||||||
|
- **Member comments**: Use trailing `///<` for inline member documentation
|
||||||
|
- **TODOs**: Use `//! \todo Description` (Qt-style), Doxygen collects them into a Todo List
|
||||||
|
(uses [Qt-style comments](https://www.doxygen.nl/manual/docblocks.html) with
|
||||||
|
Doxygen's [\todo command](https://www.doxygen.nl/manual/commands.html#cmdtodo))
|
||||||
|
|
||||||
### Memory Management ###
|
### Memory Management ###
|
||||||
|
|
||||||
New code should be written using references over pointers and stack allocation
|
New code should be written using references over pointers and stack allocation
|
||||||
|
|
@ -461,7 +471,11 @@ revoke the tag by doing the following:
|
||||||
git push --delete upstream $TAG_NAME
|
git push --delete upstream $TAG_NAME
|
||||||
git tag -d $TAG_NAME
|
git tag -d $TAG_NAME
|
||||||
```
|
```
|
||||||
You can also do this on GitHub, you'll also want to delete the false release.
|
You can also do this on GitHub.
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> If you want to push a new release to replace it immediately with the same
|
||||||
|
> name you have to delete the automatically created release first!
|
||||||
|
|
||||||
In the first lines of [CMakeLists.txt](
|
In the first lines of [CMakeLists.txt](
|
||||||
https://github.com/Cockatrice/Cockatrice/blob/master/CMakeLists.txt)
|
https://github.com/Cockatrice/Cockatrice/blob/master/CMakeLists.txt)
|
||||||
|
|
|
||||||
5
.github/ISSUE_TEMPLATE/config.yml
vendored
5
.github/ISSUE_TEMPLATE/config.yml
vendored
|
|
@ -1,9 +1,12 @@
|
||||||
blank_issues_enabled: false
|
blank_issues_enabled: false
|
||||||
contact_links:
|
contact_links:
|
||||||
- name: 💬 Discord Community (Get help with server issues, e.g. Login)
|
- name: 💬 Discord Community (Get help with server issues, e.g. Login)
|
||||||
url: https://discord.gg/3Z9yzmA
|
url: https://discord.com/invite/3Z9yzmA
|
||||||
about: Need help with using the client? Want to find some games? Try the Discord server!
|
about: Need help with using the client? Want to find some games? Try the Discord server!
|
||||||
- name: 🌐 Translations (Help improve the localization of the app)
|
- name: 🌐 Translations (Help improve the localization of the app)
|
||||||
url: https://explore.transifex.com/cockatrice/cockatrice/
|
url: https://explore.transifex.com/cockatrice/cockatrice/
|
||||||
# it is not possible to add a link to the wiki to this description
|
# it is not possible to add a link to the wiki to this description
|
||||||
about: For more information and guidance check our Translation FAQ on our wiki!
|
about: For more information and guidance check our Translation FAQ on our wiki!
|
||||||
|
- name: 📖 Code Documentation
|
||||||
|
url: https://cockatrice.github.io/docs/
|
||||||
|
about: Helpful source focusing on developers, but there are also references for users!
|
||||||
|
|
|
||||||
34
.github/dependabot.yml
vendored
34
.github/dependabot.yml
vendored
|
|
@ -2,19 +2,21 @@
|
||||||
|
|
||||||
version: 2
|
version: 2
|
||||||
updates:
|
updates:
|
||||||
# # Enable version updates for git submodules
|
# Enable version updates for git submodules
|
||||||
# Not yet possible to bump only on tags or releases, see:
|
# If SemVer is used, updates will happen to new releases only (not HEAD)
|
||||||
# https://github.com/dependabot/dependabot-core/issues/1639
|
# https://github.com/dependabot/dependabot-core/issues/1639
|
||||||
# https://github.com/dependabot/dependabot-core/issues/2192
|
# https://github.com/dependabot/dependabot-core/issues/2192
|
||||||
# Alternative: Action that updates submodule and can be manually run on demand (workflow_dispatch)
|
- package-ecosystem: "gitsubmodule"
|
||||||
# - package-ecosystem: "gitsubmodule"
|
# Look for `.gitmodules` in the `root` directory
|
||||||
# # Look for `.gitmodules` in the `root` directory
|
directory: "/"
|
||||||
# directory: "/"
|
ignore:
|
||||||
# # Check for updates once a month
|
# Ignore updates for vcpkg (Bump to latest tag not working (no SemVer used)
|
||||||
# schedule:
|
- dependency-name: "vcpkg"
|
||||||
# interval: "monthly"
|
# Check for updates once a month
|
||||||
# # Limit the amout of open PR's (default = 5, disabled = 0, security updates are not impacted)
|
schedule:
|
||||||
# open-pull-requests-limit: 1
|
interval: "monthly"
|
||||||
|
# Limit the amout of open PR's (default = 5, disabled = 0, security updates are not impacted)
|
||||||
|
open-pull-requests-limit: 2
|
||||||
|
|
||||||
# # Enable version updates for Docker
|
# # Enable version updates for Docker
|
||||||
# Not yet possible to bump from one LTS version to the next and skip others, see:
|
# Not yet possible to bump from one LTS version to the next and skip others, see:
|
||||||
|
|
@ -37,13 +39,3 @@ updates:
|
||||||
interval: "weekly"
|
interval: "weekly"
|
||||||
# Limit the amout of open PR's (default = 5, disabled = 0, security updates are not impacted)
|
# Limit the amout of open PR's (default = 5, disabled = 0, security updates are not impacted)
|
||||||
open-pull-requests-limit: 2
|
open-pull-requests-limit: 2
|
||||||
|
|
||||||
# # Enable version updates for npm
|
|
||||||
# - package-ecosystem: "npm"
|
|
||||||
# # Look for `package.json` and `lock` files in the `webclient` subdirectory
|
|
||||||
# directory: "/webclient"
|
|
||||||
# # Check the npm registry for updates once a week
|
|
||||||
# schedule:
|
|
||||||
# interval: "weekly"
|
|
||||||
# # Limit the amout of open PR's (default = 5, disabled = 0, security updates are not impacted)
|
|
||||||
# open-pull-requests-limit: 5
|
|
||||||
|
|
|
||||||
192
.github/workflows/desktop-build.yml
vendored
192
.github/workflows/desktop-build.yml
vendored
|
|
@ -14,10 +14,8 @@ on:
|
||||||
- '*/**' # matches all files not in root
|
- '*/**' # matches all files not in root
|
||||||
- '!**.md'
|
- '!**.md'
|
||||||
- '!.github/**'
|
- '!.github/**'
|
||||||
- '!.husky/**'
|
|
||||||
- '!.tx/**'
|
- '!.tx/**'
|
||||||
- '!doc/**'
|
- '!doc/**'
|
||||||
- '!webclient/**'
|
|
||||||
- '.github/workflows/desktop-build.yml'
|
- '.github/workflows/desktop-build.yml'
|
||||||
- 'CMakeLists.txt'
|
- 'CMakeLists.txt'
|
||||||
- 'vcpkg.json'
|
- 'vcpkg.json'
|
||||||
|
|
@ -29,24 +27,22 @@ on:
|
||||||
- '*/**' # matches all files not in root
|
- '*/**' # matches all files not in root
|
||||||
- '!**.md'
|
- '!**.md'
|
||||||
- '!.github/**'
|
- '!.github/**'
|
||||||
- '!.husky/**'
|
|
||||||
- '!.tx/**'
|
- '!.tx/**'
|
||||||
- '!doc/**'
|
- '!doc/**'
|
||||||
- '!webclient/**'
|
|
||||||
- '.github/workflows/desktop-build.yml'
|
- '.github/workflows/desktop-build.yml'
|
||||||
- 'CMakeLists.txt'
|
- 'CMakeLists.txt'
|
||||||
- 'vcpkg.json'
|
- 'vcpkg.json'
|
||||||
- 'vcpkg'
|
- 'vcpkg'
|
||||||
|
|
||||||
# Cancel earlier, unfinished runs of this workflow on the same branch (unless on master)
|
# Cancel earlier, unfinished runs of this workflow on the same branch (unless on release)
|
||||||
concurrency:
|
concurrency:
|
||||||
group: "${{ github.workflow }} @ ${{ github.ref_name }}"
|
group: "${{ github.workflow }} @ ${{ github.ref_name }}"
|
||||||
cancel-in-progress: ${{ github.ref_name != 'master' }}
|
cancel-in-progress: ${{ github.ref_type != 'tag' }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
configure:
|
configure:
|
||||||
name: Configure
|
name: Configure
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-slim
|
||||||
outputs:
|
outputs:
|
||||||
tag: ${{steps.configure.outputs.tag}}
|
tag: ${{steps.configure.outputs.tag}}
|
||||||
sha: ${{steps.configure.outputs.sha}}
|
sha: ${{steps.configure.outputs.sha}}
|
||||||
|
|
@ -111,12 +107,8 @@ jobs:
|
||||||
package: skip # We are packaged in Arch already
|
package: skip # We are packaged in Arch already
|
||||||
allow-failure: yes
|
allow-failure: yes
|
||||||
|
|
||||||
- distro: Debian
|
|
||||||
version: 11
|
|
||||||
package: DEB
|
|
||||||
|
|
||||||
- distro: Servatrice_Debian
|
- distro: Servatrice_Debian
|
||||||
version: 11
|
version: 12
|
||||||
package: DEB
|
package: DEB
|
||||||
test: skip
|
test: skip
|
||||||
server_only: yes
|
server_only: yes
|
||||||
|
|
@ -131,32 +123,35 @@ jobs:
|
||||||
package: DEB
|
package: DEB
|
||||||
|
|
||||||
- distro: Fedora
|
- distro: Fedora
|
||||||
version: 42
|
version: 43
|
||||||
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: 43
|
version: 44
|
||||||
package: RPM
|
package: RPM
|
||||||
|
|
||||||
- distro: Ubuntu
|
- distro: Ubuntu
|
||||||
version: 22.04
|
version: 24.04
|
||||||
package: DEB
|
package: DEB
|
||||||
|
test: skip # Running tests on all distros is superfluous
|
||||||
|
|
||||||
- distro: Ubuntu
|
- distro: Ubuntu
|
||||||
version: 24.04
|
version: 26.04
|
||||||
package: DEB
|
package: DEB
|
||||||
|
|
||||||
name: ${{matrix.distro}} ${{matrix.version}}
|
name: ${{matrix.distro}} ${{matrix.version}}
|
||||||
needs: configure
|
needs: configure
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
continue-on-error: ${{matrix.allow-failure == 'yes'}}
|
continue-on-error: ${{matrix.allow-failure == 'yes'}}
|
||||||
|
timeout-minutes: 70
|
||||||
env:
|
env:
|
||||||
NAME: ${{matrix.distro}}${{matrix.version}}
|
NAME: ${{matrix.distro}}${{matrix.version}}
|
||||||
CACHE: ${{github.workspace}}/.cache/${{matrix.distro}}${{matrix.version}} # directory for caching docker image and ccache
|
CACHE: ${{github.workspace}}/.cache/${{matrix.distro}}${{matrix.version}} # directory for caching docker image and ccache
|
||||||
# Cache size over the entire repo is 10Gi:
|
# Cache size over the entire repo is 10Gi:
|
||||||
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policy
|
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policy
|
||||||
CCACHE_SIZE: 500M
|
CCACHE_SIZE: 550M
|
||||||
|
CCACHE_EVICTION_AGE: 7d
|
||||||
CMAKE_GENERATOR: 'Ninja'
|
CMAKE_GENERATOR: 'Ninja'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
@ -180,29 +175,45 @@ jobs:
|
||||||
- name: Build debug and test
|
- name: Build debug and test
|
||||||
if: matrix.test != 'skip'
|
if: matrix.test != 'skip'
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
|
||||||
CMAKE_GENERATOR: '${{env.CMAKE_GENERATOR}}'
|
|
||||||
run: |
|
run: |
|
||||||
source .ci/docker.sh
|
source .ci/docker.sh
|
||||||
RUN --server --debug --test --ccache "$CCACHE_SIZE"
|
RUN --server --debug --test --ccache "$CCACHE_SIZE" \
|
||||||
|
--cmake-generator "$CMAKE_GENERATOR"
|
||||||
|
|
||||||
- name: Build release package
|
- name: Build release package
|
||||||
id: build
|
id: build
|
||||||
if: matrix.package != 'skip'
|
if: matrix.package != 'skip'
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
BUILD_DIR: build
|
|
||||||
SUFFIX: '-${{matrix.distro}}${{matrix.version}}'
|
SUFFIX: '-${{matrix.distro}}${{matrix.version}}'
|
||||||
package: '${{matrix.package}}'
|
package: '${{matrix.package}}'
|
||||||
CMAKE_GENERATOR: '${{env.CMAKE_GENERATOR}}'
|
server_only: '${{matrix.server_only}}'
|
||||||
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" \
|
args=()
|
||||||
--ccache "$CCACHE_SIZE" $NO_CLIENT
|
if [[ $server_only == yes ]]; then
|
||||||
.ci/name_build.sh
|
args+=(--no-client)
|
||||||
|
fi
|
||||||
|
if [[ $GITHUB_REF == "refs/heads/master" ]]; then
|
||||||
|
args+=(--evict-ccache "$CCACHE_EVICTION_AGE")
|
||||||
|
fi
|
||||||
|
args+=(--ccache "$CCACHE_SIZE")
|
||||||
|
args+=(--cmake-generator "$CMAKE_GENERATOR")
|
||||||
|
args+=(--suffix "$SUFFIX")
|
||||||
|
RUN --server --release --package "$package" "${args[@]}"
|
||||||
|
|
||||||
- name: Save compiler cache (ccache)
|
# Delete used cache to emulate a ccache update. See https://github.com/actions/cache/issues/342
|
||||||
|
- name: Delete remote compiler cache (ccache)
|
||||||
|
if: github.ref == 'refs/heads/master' && steps.ccache_restore.outputs.cache-hit
|
||||||
|
continue-on-error: true
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
run: |
|
||||||
|
if gh cache delete --repo ${{ github.repository }} ${{ steps.ccache_restore.outputs.cache-primary-key }}; then
|
||||||
|
echo "Cache deleted successfully"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Save updated compiler cache (ccache)
|
||||||
if: github.ref == 'refs/heads/master'
|
if: github.ref == 'refs/heads/master'
|
||||||
uses: actions/cache/save@v5
|
uses: actions/cache/save@v5
|
||||||
with:
|
with:
|
||||||
|
|
@ -212,10 +223,10 @@ jobs:
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
id: upload_artifact
|
id: upload_artifact
|
||||||
if: matrix.package != 'skip'
|
if: matrix.package != 'skip'
|
||||||
uses: actions/upload-artifact@v6
|
uses: actions/upload-artifact@v7
|
||||||
with:
|
with:
|
||||||
name: ${{matrix.distro}}${{matrix.version}}-package
|
|
||||||
path: ${{steps.build.outputs.path}}
|
path: ${{steps.build.outputs.path}}
|
||||||
|
archive: false
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
- name: Upload to release
|
- name: Upload to release
|
||||||
|
|
@ -225,24 +236,24 @@ jobs:
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{github.token}}
|
GH_TOKEN: ${{github.token}}
|
||||||
tag_name: ${{needs.configure.outputs.tag}}
|
tag_name: ${{needs.configure.outputs.tag}}
|
||||||
|
asset_name: ${{steps.build.outputs.fullname}}
|
||||||
asset_path: ${{steps.build.outputs.path}}
|
asset_path: ${{steps.build.outputs.path}}
|
||||||
asset_name: ${{steps.build.outputs.name}}
|
|
||||||
run: gh release upload "$tag_name" "$asset_path#$asset_name"
|
run: gh release upload "$tag_name" "$asset_path#$asset_name"
|
||||||
|
|
||||||
- name: Attest binary provenance
|
- name: Attest binary provenance
|
||||||
id: attestation
|
id: attestation
|
||||||
if: steps.upload_release.outcome == 'success'
|
if: steps.upload_release.outcome == 'success'
|
||||||
uses: actions/attest-build-provenance@v3
|
uses: actions/attest@v4
|
||||||
with:
|
with:
|
||||||
subject-name: ${{steps.build.outputs.name}}
|
subject-path: ${{steps.build.outputs.path}}
|
||||||
subject-digest: sha256:${{ steps.upload_artifact.outputs.artifact-digest }}
|
show-summary: false
|
||||||
|
|
||||||
- name: Verify binary attestation
|
- name: Verify binary attestation
|
||||||
if: steps.attestation.outcome == 'success'
|
if: steps.attestation.outcome == 'success'
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{github.token}}
|
GH_TOKEN: ${{github.token}}
|
||||||
run: gh attestation verify ${{steps.build.outputs.path}} -R Cockatrice/Cockatrice
|
run: gh attestation verify "${{steps.build.outputs.path}}" --repo Cockatrice/Cockatrice
|
||||||
|
|
||||||
build-vcpkg:
|
build-vcpkg:
|
||||||
strategy:
|
strategy:
|
||||||
|
|
@ -258,12 +269,12 @@ jobs:
|
||||||
override_target: 13
|
override_target: 13
|
||||||
make_package: 1
|
make_package: 1
|
||||||
package_suffix: "-macOS13_Intel"
|
package_suffix: "-macOS13_Intel"
|
||||||
artifact_name: macOS13_Intel-package
|
qt_version: 6.11.0
|
||||||
qt_version: 6.6.*
|
|
||||||
qt_arch: clang_64
|
qt_arch: clang_64
|
||||||
qt_modules: qtimageformats qtmultimedia qtwebsockets
|
qt_modules: qtimageformats qtmultimedia qtwebsockets
|
||||||
cmake_generator: Ninja
|
cmake_generator: Ninja
|
||||||
use_ccache: 1
|
use_ccache: 1
|
||||||
|
ccache_eviction_age: 7d
|
||||||
|
|
||||||
- os: macOS
|
- os: macOS
|
||||||
target: 14
|
target: 14
|
||||||
|
|
@ -273,12 +284,12 @@ jobs:
|
||||||
type: Release
|
type: Release
|
||||||
make_package: 1
|
make_package: 1
|
||||||
package_suffix: "-macOS14"
|
package_suffix: "-macOS14"
|
||||||
artifact_name: macOS14-package
|
qt_version: 6.11.0
|
||||||
qt_version: 6.6.*
|
|
||||||
qt_arch: clang_64
|
qt_arch: clang_64
|
||||||
qt_modules: qtimageformats qtmultimedia qtwebsockets
|
qt_modules: qtimageformats qtmultimedia qtwebsockets
|
||||||
cmake_generator: Ninja
|
cmake_generator: Ninja
|
||||||
use_ccache: 1
|
use_ccache: 1
|
||||||
|
ccache_eviction_age: 7d
|
||||||
|
|
||||||
- os: macOS
|
- os: macOS
|
||||||
target: 15
|
target: 15
|
||||||
|
|
@ -288,12 +299,12 @@ jobs:
|
||||||
type: Release
|
type: Release
|
||||||
make_package: 1
|
make_package: 1
|
||||||
package_suffix: "-macOS15"
|
package_suffix: "-macOS15"
|
||||||
artifact_name: macOS15-package
|
qt_version: 6.11.0
|
||||||
qt_version: 6.6.*
|
|
||||||
qt_arch: clang_64
|
qt_arch: clang_64
|
||||||
qt_modules: qtimageformats qtmultimedia qtwebsockets
|
qt_modules: qtimageformats qtmultimedia qtwebsockets
|
||||||
cmake_generator: Ninja
|
cmake_generator: Ninja
|
||||||
use_ccache: 1
|
use_ccache: 1
|
||||||
|
ccache_eviction_age: 7d
|
||||||
|
|
||||||
- os: macOS
|
- os: macOS
|
||||||
target: 15
|
target: 15
|
||||||
|
|
@ -301,33 +312,21 @@ jobs:
|
||||||
soc: Apple
|
soc: Apple
|
||||||
xcode: "16.4"
|
xcode: "16.4"
|
||||||
type: Debug
|
type: Debug
|
||||||
qt_version: 6.6.*
|
qt_version: 6.11.0
|
||||||
qt_arch: clang_64
|
qt_arch: clang_64
|
||||||
qt_modules: qtimageformats qtmultimedia qtwebsockets
|
qt_modules: qtimageformats qtmultimedia qtwebsockets
|
||||||
cmake_generator: Ninja
|
cmake_generator: Ninja
|
||||||
use_ccache: 1
|
use_ccache: 1
|
||||||
|
ccache_eviction_age: 7d
|
||||||
- os: Windows
|
|
||||||
target: 7
|
|
||||||
runner: windows-2022
|
|
||||||
type: Release
|
|
||||||
make_package: 1
|
|
||||||
package_suffix: "-Win7"
|
|
||||||
artifact_name: Windows7-installer
|
|
||||||
qt_version: 5.15.*
|
|
||||||
qt_arch: win64_msvc2019_64
|
|
||||||
cmake_generator: "Visual Studio 17 2022"
|
|
||||||
cmake_generator_platform: x64
|
|
||||||
|
|
||||||
- os: Windows
|
- os: Windows
|
||||||
target: 10
|
target: 10
|
||||||
runner: windows-2022
|
runner: windows-2025
|
||||||
type: Release
|
type: Release
|
||||||
make_package: 1
|
make_package: 1
|
||||||
package_suffix: "-Win10"
|
package_suffix: "-Win10"
|
||||||
artifact_name: Windows10-installer
|
qt_version: 6.11.0
|
||||||
qt_version: 6.6.*
|
qt_arch: win64_msvc2022_64
|
||||||
qt_arch: win64_msvc2019_64
|
|
||||||
qt_modules: qtimageformats qtmultimedia qtwebsockets
|
qt_modules: qtimageformats qtmultimedia qtwebsockets
|
||||||
cmake_generator: "Visual Studio 17 2022"
|
cmake_generator: "Visual Studio 17 2022"
|
||||||
cmake_generator_platform: x64
|
cmake_generator_platform: x64
|
||||||
|
|
@ -335,11 +334,12 @@ jobs:
|
||||||
name: ${{matrix.os}} ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }}
|
name: ${{matrix.os}} ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }}
|
||||||
needs: configure
|
needs: configure
|
||||||
runs-on: ${{matrix.runner}}
|
runs-on: ${{matrix.runner}}
|
||||||
|
timeout-minutes: 100
|
||||||
env:
|
env:
|
||||||
CCACHE_DIR: ${{github.workspace}}/.cache/
|
CCACHE_DIR: ${{github.workspace}}/.cache/
|
||||||
# Cache size over the entire repo is 10Gi:
|
# Cache size over the entire repo is 10Gi:
|
||||||
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policy
|
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policy
|
||||||
CCACHE_SIZE: 500M
|
CCACHE_SIZE: 550M
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
|
@ -350,7 +350,7 @@ jobs:
|
||||||
- name: Add msbuild to PATH
|
- name: Add msbuild to PATH
|
||||||
if: matrix.os == 'Windows'
|
if: matrix.os == 'Windows'
|
||||||
id: add-msbuild
|
id: add-msbuild
|
||||||
uses: microsoft/setup-msbuild@v2
|
uses: microsoft/setup-msbuild@v3
|
||||||
with:
|
with:
|
||||||
msbuild-architecture: x64
|
msbuild-architecture: x64
|
||||||
|
|
||||||
|
|
@ -370,15 +370,12 @@ jobs:
|
||||||
restore-keys: ccache-${{matrix.runner}}-${{matrix.soc}}-${{matrix.type}}-
|
restore-keys: ccache-${{matrix.runner}}-${{matrix.soc}}-${{matrix.type}}-
|
||||||
|
|
||||||
- name: Install aqtinstall
|
- name: Install aqtinstall
|
||||||
if: matrix.os == 'macOS'
|
|
||||||
run: pipx install aqtinstall
|
run: pipx install aqtinstall
|
||||||
|
|
||||||
# Checking if there's a newer, uncached version of Qt available to install via aqtinstall
|
# Resolve given wildcard versions (e.g. Qt 6.6.*) to latest version via aqtinstall to avoid stale caches on new releases
|
||||||
- name: Resolve latest Qt patch version
|
- name: Resolve latest Qt patch version
|
||||||
if: matrix.os == 'macOS'
|
|
||||||
id: resolve_qt_version
|
id: resolve_qt_version
|
||||||
shell: bash
|
shell: bash
|
||||||
# Ouputs the version of Qt to install via aqtinstall
|
|
||||||
run: .ci/resolve_latest_aqt_qt_version.sh "${{matrix.qt_version}}"
|
run: .ci/resolve_latest_aqt_qt_version.sh "${{matrix.qt_version}}"
|
||||||
|
|
||||||
- name: Restore thin Qt ${{ steps.resolve_qt_version.outputs.version }} libraries (${{ matrix.soc }} macOS)
|
- name: Restore thin Qt ${{ steps.resolve_qt_version.outputs.version }} libraries (${{ matrix.soc }} macOS)
|
||||||
|
|
@ -395,10 +392,10 @@ jobs:
|
||||||
if: matrix.os == 'macOS' && steps.restore_qt.outputs.cache-hit != 'true'
|
if: matrix.os == 'macOS' && steps.restore_qt.outputs.cache-hit != 'true'
|
||||||
uses: jurplel/install-qt-action@v4
|
uses: jurplel/install-qt-action@v4
|
||||||
with:
|
with:
|
||||||
cache: false
|
|
||||||
version: ${{ steps.resolve_qt_version.outputs.version }}
|
version: ${{ steps.resolve_qt_version.outputs.version }}
|
||||||
arch: ${{matrix.qt_arch}}
|
arch: ${{matrix.qt_arch}}
|
||||||
modules: ${{matrix.qt_modules}}
|
modules: ${{matrix.qt_modules}}
|
||||||
|
cache: false
|
||||||
dir: ${{github.workspace}}
|
dir: ${{github.workspace}}
|
||||||
|
|
||||||
- name: Thin Qt libraries (${{ matrix.soc }} macOS)
|
- name: Thin Qt libraries (${{ matrix.soc }} macOS)
|
||||||
|
|
@ -416,11 +413,18 @@ jobs:
|
||||||
if: matrix.os == 'Windows'
|
if: matrix.os == 'Windows'
|
||||||
uses: jurplel/install-qt-action@v4
|
uses: jurplel/install-qt-action@v4
|
||||||
with:
|
with:
|
||||||
version: ${{matrix.qt_version}}
|
# qt 6.11.0 only works with aqtinstall directly from git until aqtinstall 3.4 is released
|
||||||
|
aqtsource: git+https://github.com/miurahr/aqtinstall.git
|
||||||
|
version: ${{ steps.resolve_qt_version.outputs.version }}
|
||||||
arch: ${{matrix.qt_arch}}
|
arch: ${{matrix.qt_arch}}
|
||||||
modules: ${{matrix.qt_modules}}
|
modules: ${{matrix.qt_modules}}
|
||||||
cache: true
|
cache: true
|
||||||
|
|
||||||
|
- name: Install NSIS
|
||||||
|
if: matrix.os == 'Windows'
|
||||||
|
shell: bash
|
||||||
|
run: choco install nsis
|
||||||
|
|
||||||
- name: Setup vcpkg cache
|
- name: Setup vcpkg cache
|
||||||
id: vcpkg-cache
|
id: vcpkg-cache
|
||||||
uses: TAServers/vcpkg-cache@v3
|
uses: TAServers/vcpkg-cache@v3
|
||||||
|
|
@ -447,19 +451,30 @@ jobs:
|
||||||
MACOS_CI_KEYCHAIN_PWD: ${{ secrets.PROD_MACOS_CI_KEYCHAIN_PWD }}
|
MACOS_CI_KEYCHAIN_PWD: ${{ secrets.PROD_MACOS_CI_KEYCHAIN_PWD }}
|
||||||
DEVELOPER_DIR: '/Applications/Xcode_${{matrix.xcode}}.app/Contents/Developer'
|
DEVELOPER_DIR: '/Applications/Xcode_${{matrix.xcode}}.app/Contents/Developer'
|
||||||
TARGET_MACOS_VERSION: ${{ matrix.override_target }}
|
TARGET_MACOS_VERSION: ${{ matrix.override_target }}
|
||||||
|
CCACHE_EVICTION_AGE: ${{ matrix.ccache_eviction_age }}
|
||||||
run: .ci/compile.sh --server --test --vcpkg
|
run: .ci/compile.sh --server --test --vcpkg
|
||||||
|
|
||||||
- name: Save compiler cache (ccache)
|
# Delete used cache to emulate a ccache update. See https://github.com/actions/cache/issues/342
|
||||||
|
- name: Delete remote compiler cache (ccache)
|
||||||
|
if: github.ref == 'refs/heads/master' && matrix.use_ccache == 1 && steps.ccache_restore.outputs.cache-hit
|
||||||
|
continue-on-error: true
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
run: |
|
||||||
|
if gh cache delete --repo ${{ github.repository }} ${{ steps.ccache_restore.outputs.cache-primary-key }}; then
|
||||||
|
echo "Cache deleted successfully"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Save updated compiler cache (ccache)
|
||||||
if: github.ref == 'refs/heads/master' && matrix.use_ccache == 1
|
if: github.ref == 'refs/heads/master' && matrix.use_ccache == 1
|
||||||
uses: actions/cache/save@v5
|
uses: actions/cache/save@v5
|
||||||
env:
|
|
||||||
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
|
|
||||||
with:
|
with:
|
||||||
path: ${{env.CCACHE_DIR}}
|
path: ${{env.CCACHE_DIR}}
|
||||||
key: ccache-${{matrix.runner}}-${{matrix.soc}}-${{matrix.type}}-${{env.BRANCH_NAME}}
|
key: ${{ steps.ccache_restore.outputs.cache-primary-key }}
|
||||||
|
|
||||||
- name: Sign app bundle
|
- name: Sign app bundle
|
||||||
if: matrix.os == 'macOS' && matrix.make_package && (github.ref == 'refs/heads/master' || needs.configure.outputs.tag != null)
|
if: matrix.os == 'macOS' && matrix.make_package && needs.configure.outputs.tag != null
|
||||||
|
id: sign_macos
|
||||||
env:
|
env:
|
||||||
MACOS_CERTIFICATE_NAME: ${{ secrets.PROD_MACOS_CERTIFICATE_NAME }}
|
MACOS_CERTIFICATE_NAME: ${{ secrets.PROD_MACOS_CERTIFICATE_NAME }}
|
||||||
MACOS_CI_KEYCHAIN_PWD: ${{ secrets.PROD_MACOS_CI_KEYCHAIN_PWD }}
|
MACOS_CI_KEYCHAIN_PWD: ${{ secrets.PROD_MACOS_CI_KEYCHAIN_PWD }}
|
||||||
|
|
@ -467,11 +482,11 @@ jobs:
|
||||||
if [[ -n "$MACOS_CERTIFICATE_NAME" ]]
|
if [[ -n "$MACOS_CERTIFICATE_NAME" ]]
|
||||||
then
|
then
|
||||||
security unlock-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain
|
security unlock-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain
|
||||||
/usr/bin/codesign --sign="$MACOS_CERTIFICATE_NAME" --entitlements=".ci/macos.entitlements" --options=runtime --force --deep --timestamp --verbose ${{steps.build.outputs.path}}
|
/usr/bin/codesign --sign="$MACOS_CERTIFICATE_NAME" --entitlements=".ci/macos.entitlements" --options=runtime --force --deep --timestamp --verbose "${{steps.build.outputs.path}}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Notarize app bundle
|
- name: Notarize app bundle
|
||||||
if: matrix.os == 'macOS' && matrix.make_package && (github.ref == 'refs/heads/master' || needs.configure.outputs.tag != null)
|
if: steps.sign_macos.outcome == 'success'
|
||||||
env:
|
env:
|
||||||
MACOS_NOTARIZATION_APPLE_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_APPLE_ID }}
|
MACOS_NOTARIZATION_APPLE_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_APPLE_ID }}
|
||||||
MACOS_NOTARIZATION_TEAM_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_TEAM_ID }}
|
MACOS_NOTARIZATION_TEAM_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_TEAM_ID }}
|
||||||
|
|
@ -487,7 +502,7 @@ jobs:
|
||||||
# Therefore, we create a zip file containing our app bundle, so that we can send it to the
|
# Therefore, we create a zip file containing our app bundle, so that we can send it to the
|
||||||
# notarization service
|
# notarization service
|
||||||
echo "Creating temp notarization archive"
|
echo "Creating temp notarization archive"
|
||||||
ditto -c -k --keepParent ${{steps.build.outputs.path}} "notarization.zip"
|
ditto -c -k --keepParent "${{steps.build.outputs.path}}" "notarization.zip"
|
||||||
|
|
||||||
# Here we send the notarization request to the Apple's Notarization service, waiting for the result.
|
# Here we send the notarization request to the Apple's Notarization service, waiting for the result.
|
||||||
# This typically takes a few seconds inside a CI environment, but it might take more depending on the App
|
# This typically takes a few seconds inside a CI environment, but it might take more depending on the App
|
||||||
|
|
@ -499,50 +514,51 @@ jobs:
|
||||||
# Finally, we need to "attach the staple" to our executable, which will allow our app to be
|
# Finally, we need to "attach the staple" to our executable, which will allow our app to be
|
||||||
# validated by macOS even when an internet connection is not available.
|
# validated by macOS even when an internet connection is not available.
|
||||||
echo "Attach staple"
|
echo "Attach staple"
|
||||||
xcrun stapler staple ${{steps.build.outputs.path}}
|
xcrun stapler staple "${{steps.build.outputs.path}}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
id: upload_artifact
|
|
||||||
if: matrix.make_package
|
if: matrix.make_package
|
||||||
uses: actions/upload-artifact@v6
|
id: upload_artifact
|
||||||
|
uses: actions/upload-artifact@v7
|
||||||
with:
|
with:
|
||||||
name: ${{matrix.artifact_name}}
|
|
||||||
path: ${{steps.build.outputs.path}}
|
path: ${{steps.build.outputs.path}}
|
||||||
|
archive: false
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
- name: Upload pdb database
|
- name: Upload PDBs (Program Databases)
|
||||||
if: matrix.os == 'Windows'
|
if: matrix.os == 'Windows' && github.ref_type != 'tag'
|
||||||
uses: actions/upload-artifact@v6
|
uses: actions/upload-artifact@v7
|
||||||
with:
|
with:
|
||||||
name: Windows${{matrix.target}}-debug-pdbs
|
name: ${{steps.build.outputs.name}}-PDBs
|
||||||
path: |
|
path: |
|
||||||
build/cockatrice/Release/*.pdb
|
build/cockatrice/Release/*.pdb
|
||||||
|
build/oracle/Release/*.pdb
|
||||||
build/servatrice/Release/*.pdb
|
build/servatrice/Release/*.pdb
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
- name: Upload to release
|
- name: Upload to release
|
||||||
|
if: needs.configure.outputs.tag != null && matrix.make_package == '1'
|
||||||
id: upload_release
|
id: upload_release
|
||||||
if: needs.configure.outputs.tag != null
|
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{github.token}}
|
GH_TOKEN: ${{github.token}}
|
||||||
tag_name: ${{needs.configure.outputs.tag}}
|
tag_name: ${{needs.configure.outputs.tag}}
|
||||||
|
asset_name: ${{steps.build.outputs.fullname}}
|
||||||
asset_path: ${{steps.build.outputs.path}}
|
asset_path: ${{steps.build.outputs.path}}
|
||||||
asset_name: ${{steps.build.outputs.name}}
|
|
||||||
run: gh release upload "$tag_name" "$asset_path#$asset_name"
|
run: gh release upload "$tag_name" "$asset_path#$asset_name"
|
||||||
|
|
||||||
- name: Attest binary provenance
|
- name: Attest binary provenance
|
||||||
id: attestation
|
|
||||||
if: steps.upload_release.outcome == 'success'
|
if: steps.upload_release.outcome == 'success'
|
||||||
uses: actions/attest-build-provenance@v3
|
id: attestation
|
||||||
|
uses: actions/attest@v4
|
||||||
with:
|
with:
|
||||||
subject-name: ${{steps.build.outputs.name}}
|
subject-path: ${{steps.build.outputs.path}}
|
||||||
subject-digest: sha256:${{ steps.upload_artifact.outputs.artifact-digest }}
|
show-summary: false
|
||||||
|
|
||||||
- name: Verify binary attestation
|
- name: Verify binary attestation
|
||||||
if: steps.attestation.outcome == 'success'
|
if: steps.attestation.outcome == 'success'
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{github.token}}
|
GH_TOKEN: ${{github.token}}
|
||||||
run: gh attestation verify ${{steps.build.outputs.path}} -R Cockatrice/Cockatrice
|
run: gh attestation verify "${{steps.build.outputs.path}}" --repo Cockatrice/Cockatrice
|
||||||
|
|
|
||||||
6
.github/workflows/desktop-lint.yml
vendored
6
.github/workflows/desktop-lint.yml
vendored
|
|
@ -8,10 +8,8 @@ on:
|
||||||
- '!**.md'
|
- '!**.md'
|
||||||
- '!.ci/**'
|
- '!.ci/**'
|
||||||
- '!.github/**'
|
- '!.github/**'
|
||||||
- '!.husky/**'
|
|
||||||
- '!.tx/**'
|
- '!.tx/**'
|
||||||
- '!doc/**'
|
- '!doc/**'
|
||||||
- '!webclient/**'
|
|
||||||
- '.ci/lint_cpp.sh'
|
- '.ci/lint_cpp.sh'
|
||||||
- '.github/workflows/desktop-lint.yml'
|
- '.github/workflows/desktop-lint.yml'
|
||||||
- '.clang-format'
|
- '.clang-format'
|
||||||
|
|
@ -20,13 +18,13 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
format:
|
format:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-slim
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
fetch-depth: 20 # should be enough to find merge base
|
fetch-depth: 20 # should be enough to find merge base
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
|
||||||
33
.github/workflows/docker-release.yml
vendored
33
.github/workflows/docker-release.yml
vendored
|
|
@ -1,9 +1,10 @@
|
||||||
name: Build Docker Image
|
name: Build Docker Image
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
release:
|
||||||
|
types:
|
||||||
|
- released # publishing of stable releases
|
||||||
push:
|
push:
|
||||||
tags:
|
|
||||||
- '*Release*'
|
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
@ -13,21 +14,30 @@ on:
|
||||||
- '.github/workflows/docker-release.yml'
|
- '.github/workflows/docker-release.yml'
|
||||||
- 'Dockerfile'
|
- 'Dockerfile'
|
||||||
|
|
||||||
|
# Cancel earlier, unfinished runs of this workflow on the same branch (unless on release)
|
||||||
|
concurrency:
|
||||||
|
group: "${{ github.workflow }} @ ${{ github.ref_name }}"
|
||||||
|
cancel-in-progress: ${{ github.event_name != 'release' }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
docker:
|
docker:
|
||||||
name: amd64 & arm64
|
name: amd64 & arm64
|
||||||
|
if: ${{ github.repository_owner == 'Cockatrice' }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
packages: write
|
packages: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Docker metadata
|
- name: Docker metadata
|
||||||
id: metadata
|
id: metadata
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v6
|
||||||
|
env:
|
||||||
|
DOCKER_METADATA_ANNOTATIONS_LEVELS: index # needed for GHCR
|
||||||
with:
|
with:
|
||||||
images: |
|
images: |
|
||||||
ghcr.io/cockatrice/servatrice
|
ghcr.io/cockatrice/servatrice
|
||||||
|
|
@ -41,26 +51,27 @@ jobs:
|
||||||
org.opencontainers.image.description=Server for Cockatrice, a cross-platform virtual tabletop for multiplayer card games
|
org.opencontainers.image.description=Server for Cockatrice, a cross-platform virtual tabletop for multiplayer card games
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v4
|
||||||
|
|
||||||
- name: Set up Docker buildx
|
- name: Set up Docker buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v4
|
||||||
|
|
||||||
- name: Login to GitHub Container Registry
|
- name: Login to GitHub Container Registry
|
||||||
if: github.ref_type == 'tag'
|
if: contains(github.event.release.tag_name, 'Release') && github.event.release.target_commitish == 'master'
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v4
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ github.token }}
|
password: ${{ github.token }}
|
||||||
|
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v7
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
push: ${{ github.ref_type == 'tag' }}
|
push: ${{ github.ref_type == 'tag' }}
|
||||||
tags: ${{ steps.metadata.outputs.tags }}
|
tags: ${{ steps.metadata.outputs.tags }}
|
||||||
labels: ${{ steps.metadata.outputs.labels }}
|
labels: ${{ steps.metadata.outputs.labels }}
|
||||||
cache-from: type=gha
|
annotations: ${{ steps.metadata.outputs.annotations }}
|
||||||
cache-to: type=gha,mode=max
|
cache-from: type=gha,scope=servatrice
|
||||||
|
cache-to: type=gha,mode=max,scope=servatrice
|
||||||
|
|
|
||||||
16
.github/workflows/documentation-build.yml
vendored
16
.github/workflows/documentation-build.yml
vendored
|
|
@ -1,9 +1,9 @@
|
||||||
name: Generate Docs
|
name: Generate Docs
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
release:
|
||||||
tags:
|
types:
|
||||||
- '*' # Only re-generate docs when a new tagged version is pushed
|
- published # publishing of stable releases and pre-releases
|
||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
- 'doc/doxygen/**'
|
- 'doc/doxygen/**'
|
||||||
|
|
@ -22,6 +22,8 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
- name: Install Graphviz
|
- name: Install Graphviz
|
||||||
run: |
|
run: |
|
||||||
|
|
@ -29,9 +31,9 @@ jobs:
|
||||||
dot -V
|
dot -V
|
||||||
|
|
||||||
- name: Install Doxygen
|
- name: Install Doxygen
|
||||||
uses: ssciwr/doxygen-install@v1
|
uses: ssciwr/doxygen-install@v2
|
||||||
with:
|
with:
|
||||||
version: "1.14.0"
|
version: "1.16.1"
|
||||||
|
|
||||||
- name: Update Doxygen Configuration
|
- name: Update Doxygen Configuration
|
||||||
run: |
|
run: |
|
||||||
|
|
@ -51,11 +53,11 @@ jobs:
|
||||||
run: doxygen Doxyfile
|
run: doxygen Doxyfile
|
||||||
|
|
||||||
- name: Deploy to cockatrice.github.io
|
- name: Deploy to cockatrice.github.io
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
|
||||||
uses: peaceiris/actions-gh-pages@v4
|
uses: peaceiris/actions-gh-pages@v4
|
||||||
with:
|
with:
|
||||||
deploy_key: ${{ secrets.DOCS_DEPLOY_KEY }}
|
deploy_key: ${{ secrets.DOCS_DEPLOY_KEY }}
|
||||||
external_repository: Cockatrice/cockatrice.github.io
|
external_repository: Cockatrice/cockatrice.github.io
|
||||||
publish_branch: master
|
publish_branch: master
|
||||||
publish_dir: ./docs/html
|
publish_dir: ./docs/html
|
||||||
destination_dir: docs # Docs will live under https://cockatrice.github.io/docs/
|
destination_dir: docs # Docs will live under https://cockatrice.github.io/docs/
|
||||||
|
|
|
||||||
3
.github/workflows/translations-pull.yml
vendored
3
.github/workflows/translations-pull.yml
vendored
|
|
@ -16,7 +16,7 @@ jobs:
|
||||||
if: github.event_name != 'schedule' || github.repository_owner == 'Cockatrice'
|
if: github.event_name != 'schedule' || github.repository_owner == 'Cockatrice'
|
||||||
|
|
||||||
name: Pull languages
|
name: Pull languages
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-slim
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
|
|
@ -38,7 +38,6 @@ jobs:
|
||||||
add-paths: |
|
add-paths: |
|
||||||
cockatrice/translations/*.ts
|
cockatrice/translations/*.ts
|
||||||
oracle/translations/*.ts
|
oracle/translations/*.ts
|
||||||
webclient/public/locales/*/translation.json
|
|
||||||
commit-message: Update translation files
|
commit-message: Update translation files
|
||||||
# author is the owner of the commit
|
# author is the owner of the commit
|
||||||
author: github-actions <github-actions@github.com>
|
author: github-actions <github-actions@github.com>
|
||||||
|
|
|
||||||
4
.github/workflows/translations-push.yml
vendored
4
.github/workflows/translations-push.yml
vendored
|
|
@ -16,7 +16,7 @@ jobs:
|
||||||
if: github.event_name != 'schedule' || github.repository_owner == 'Cockatrice'
|
if: github.event_name != 'schedule' || github.repository_owner == 'Cockatrice'
|
||||||
|
|
||||||
name: Push strings
|
name: Push strings
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-slim
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
|
|
@ -46,7 +46,7 @@ jobs:
|
||||||
|
|
||||||
- name: Render template
|
- name: Render template
|
||||||
id: template
|
id: template
|
||||||
uses: chuhlomin/render-template@v1
|
uses: chuhlomin/render-template/binary@v1
|
||||||
with:
|
with:
|
||||||
template: .ci/update_translation_source_strings_template.md
|
template: .ci/update_translation_source_strings_template.md
|
||||||
vars: |
|
vars: |
|
||||||
|
|
|
||||||
54
.github/workflows/web-build.yml
vendored
54
.github/workflows/web-build.yml
vendored
|
|
@ -1,54 +0,0 @@
|
||||||
name: Build Web
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
paths:
|
|
||||||
- '.husky/**'
|
|
||||||
- 'webclient/**'
|
|
||||||
- '!**.md'
|
|
||||||
- '.github/workflows/web-build.yml'
|
|
||||||
pull_request:
|
|
||||||
paths:
|
|
||||||
- '.husky/**'
|
|
||||||
- 'webclient/**'
|
|
||||||
- '!**.md'
|
|
||||||
- '.github/workflows/web-build.yml'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-web:
|
|
||||||
name: React (Node ${{matrix.node_version}})
|
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
working-directory: webclient
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
node_version:
|
|
||||||
- 16
|
|
||||||
- lts/*
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
|
|
||||||
- name: Setup Node.js
|
|
||||||
uses: actions/setup-node@v6
|
|
||||||
with:
|
|
||||||
node-version: ${{matrix.node_version}}
|
|
||||||
cache: 'npm'
|
|
||||||
cache-dependency-path: 'webclient/package-lock.json'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: npm clean-install
|
|
||||||
|
|
||||||
- name: Build app
|
|
||||||
run: npm run build
|
|
||||||
|
|
||||||
- name: Test app
|
|
||||||
run: npm run test
|
|
||||||
33
.github/workflows/web-lint.yml
vendored
33
.github/workflows/web-lint.yml
vendored
|
|
@ -1,33 +0,0 @@
|
||||||
name: Code Style (TypeScript)
|
|
||||||
|
|
||||||
on:
|
|
||||||
# push trigger not needed for linting, we do not allow direct pushes to master
|
|
||||||
pull_request:
|
|
||||||
paths:
|
|
||||||
- 'webclient/**'
|
|
||||||
- '!**.md'
|
|
||||||
- '.github/workflows/web-lint.yml'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
ESLint:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
working-directory: webclient
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
|
|
||||||
- name: Setup Node.js
|
|
||||||
uses: actions/setup-node@v6
|
|
||||||
with:
|
|
||||||
cache: 'npm'
|
|
||||||
cache-dependency-path: 'webclient/package-lock.json'
|
|
||||||
|
|
||||||
- name: Install ESLint
|
|
||||||
run: npm clean-install --ignore-scripts
|
|
||||||
|
|
||||||
- name: Run ESLint
|
|
||||||
run: npm run lint
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
. "$(dirname "$0")/_/husky.sh"
|
|
||||||
|
|
||||||
cd webclient
|
|
||||||
npm run translate
|
|
||||||
|
|
||||||
git add src/i18n-default.json
|
|
||||||
|
|
@ -16,11 +16,3 @@ source_file = oracle/oracle_en@source.ts
|
||||||
file_filter = oracle/translations/oracle_<lang>.ts
|
file_filter = oracle/translations/oracle_<lang>.ts
|
||||||
type = QT
|
type = QT
|
||||||
minimum_perc = 10
|
minimum_perc = 10
|
||||||
|
|
||||||
[o:cockatrice:p:cockatrice:r:webclient-src-i18n-default-json--master]
|
|
||||||
resource_name = Webclient
|
|
||||||
source_lang = en
|
|
||||||
source_file = webclient/src/i18n-default.json
|
|
||||||
file_filter = webclient/public/locales/<lang>/translation.json
|
|
||||||
type = KEYVALUEJSON
|
|
||||||
minimum_perc = 10
|
|
||||||
|
|
|
||||||
|
|
@ -74,11 +74,11 @@ endif()
|
||||||
|
|
||||||
# A project name is needed for CPack
|
# A project name is needed for CPack
|
||||||
# Version can be overriden by git tags, see cmake/getversion.cmake
|
# Version can be overriden by git tags, see cmake/getversion.cmake
|
||||||
project("Cockatrice" VERSION 2.11.0)
|
project("Cockatrice" VERSION 3.1.0)
|
||||||
|
|
||||||
# Set release name if not provided via env/cmake var
|
# Set release name if not provided via env/cmake var
|
||||||
if(NOT DEFINED GIT_TAG_RELEASENAME)
|
if(NOT DEFINED GIT_TAG_RELEASENAME)
|
||||||
set(GIT_TAG_RELEASENAME "Omenpath")
|
set(GIT_TAG_RELEASENAME "Graduation Day")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Use c++20 for all targets
|
# Use c++20 for all targets
|
||||||
|
|
@ -174,6 +174,7 @@ elseif(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
-Wno-error=delete-non-virtual-dtor
|
-Wno-error=delete-non-virtual-dtor
|
||||||
-Wno-error=sign-compare
|
-Wno-error=sign-compare
|
||||||
-Wno-error=missing-declarations
|
-Wno-error=missing-declarations
|
||||||
|
-Wno-error=sfinae-incomplete # GCC 16+: Qt MOC + protobuf forward decls trigger this
|
||||||
)
|
)
|
||||||
|
|
||||||
foreach(FLAG ${ADDITIONAL_DEBUG_FLAGS})
|
foreach(FLAG ${ADDITIONAL_DEBUG_FLAGS})
|
||||||
|
|
@ -254,7 +255,9 @@ endif()
|
||||||
set(CPACK_PACKAGE_CONTACT "Zach Halpern <zach@cockatrice.us>")
|
set(CPACK_PACKAGE_CONTACT "Zach Halpern <zach@cockatrice.us>")
|
||||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_NAME}")
|
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_NAME}")
|
||||||
set(CPACK_PACKAGE_VENDOR "Cockatrice Development Team")
|
set(CPACK_PACKAGE_VENDOR "Cockatrice Development Team")
|
||||||
set(CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/README.md")
|
set(CPACK_PACKAGE_DESCRIPTION
|
||||||
|
"Cockatrice is an open-source, multiplatform application for playing tabletop card games over a network. The program's server design prevents users from manipulating the game for unfair advantage. The client also provides a single-player mode, which allows users to brew while offline."
|
||||||
|
)
|
||||||
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
|
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
|
||||||
set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
|
set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
|
||||||
set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
|
set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
|
||||||
|
|
@ -328,7 +331,12 @@ include(CPack)
|
||||||
|
|
||||||
add_subdirectory(${CMAKE_SOURCE_DIR}/libcockatrice_interfaces ${CMAKE_BINARY_DIR}/libcockatrice_interfaces)
|
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)
|
if(WITH_CLIENT
|
||||||
|
OR WITH_SERVER
|
||||||
|
OR WITH_ORACLE
|
||||||
|
)
|
||||||
|
add_subdirectory(${CMAKE_SOURCE_DIR}/libcockatrice_network ${CMAKE_BINARY_DIR}/libcockatrice_network)
|
||||||
|
endif()
|
||||||
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_card ${CMAKE_BINARY_DIR}/libcockatrice_card)
|
add_subdirectory(${CMAKE_SOURCE_DIR}/libcockatrice_card ${CMAKE_BINARY_DIR}/libcockatrice_card)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# -------- Build Stage --------
|
# -------- Build Stage --------
|
||||||
FROM ubuntu:24.04 AS build
|
FROM ubuntu:26.04 AS build
|
||||||
|
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
|
@ -26,7 +26,7 @@ RUN mkdir build && cd build && \
|
||||||
|
|
||||||
|
|
||||||
# -------- Runtime Stage (clean) --------
|
# -------- Runtime Stage (clean) --------
|
||||||
FROM ubuntu:24.04
|
FROM ubuntu:26.04
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
libprotobuf32t64 \
|
libprotobuf32t64 \
|
||||||
|
|
|
||||||
99
Doxyfile
99
Doxyfile
|
|
@ -1,4 +1,4 @@
|
||||||
# Doxyfile 1.14.0
|
# Doxyfile 1.16.1
|
||||||
|
|
||||||
# This file describes the settings to be used by the documentation system
|
# This file describes the settings to be used by the documentation system
|
||||||
# Doxygen (www.doxygen.org) for a project.
|
# Doxygen (www.doxygen.org) for a project.
|
||||||
|
|
@ -361,6 +361,20 @@ EXTENSION_MAPPING =
|
||||||
|
|
||||||
MARKDOWN_SUPPORT = YES
|
MARKDOWN_SUPPORT = YES
|
||||||
|
|
||||||
|
# If the MARKDOWN_STRICT tag is enabled then Doxygen treats text in comments as
|
||||||
|
# Markdown formatted also in cases where Doxygen's native markup format
|
||||||
|
# conflicts with that of Markdown. This is only relevant in cases where
|
||||||
|
# backticks are used. Doxygen's native markup style allows a single quote to end
|
||||||
|
# a text fragment started with a backtick and then treat it as a piece of quoted
|
||||||
|
# text, whereas in Markdown such text fragment is treated as verbatim and only
|
||||||
|
# ends when a second matching backtick is found. Also, Doxygen's native markup
|
||||||
|
# format requires double quotes to be escaped when they appear in a backtick
|
||||||
|
# section, whereas this is not needed for Markdown.
|
||||||
|
# The default value is: YES.
|
||||||
|
# This tag requires that the tag MARKDOWN_SUPPORT is set to YES.
|
||||||
|
|
||||||
|
MARKDOWN_STRICT = YES
|
||||||
|
|
||||||
# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up
|
# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up
|
||||||
# to that level are automatically included in the table of contents, even if
|
# to that level are automatically included in the table of contents, even if
|
||||||
# they do not have an id attribute.
|
# they do not have an id attribute.
|
||||||
|
|
@ -392,8 +406,8 @@ AUTOLINK_SUPPORT = YES
|
||||||
|
|
||||||
# This tag specifies a list of words that, when matching the start of a word in
|
# This tag specifies a list of words that, when matching the start of a word in
|
||||||
# the documentation, will suppress auto links generation, if it is enabled via
|
# the documentation, will suppress auto links generation, if it is enabled via
|
||||||
# AUTOLINK_SUPPORT. This list does not affect links explicitly created using \#
|
# AUTOLINK_SUPPORT. This list does not affect links explicitly created using #
|
||||||
# or the \link or commands.
|
# or the \link or \ref commands.
|
||||||
# This tag requires that the tag AUTOLINK_SUPPORT is set to YES.
|
# This tag requires that the tag AUTOLINK_SUPPORT is set to YES.
|
||||||
|
|
||||||
AUTOLINK_IGNORE_WORDS =
|
AUTOLINK_IGNORE_WORDS =
|
||||||
|
|
@ -510,9 +524,9 @@ LOOKUP_CACHE_SIZE = 0
|
||||||
# which effectively disables parallel processing. Please report any issues you
|
# which effectively disables parallel processing. Please report any issues you
|
||||||
# encounter. Generating dot graphs in parallel is controlled by the
|
# encounter. Generating dot graphs in parallel is controlled by the
|
||||||
# DOT_NUM_THREADS setting.
|
# DOT_NUM_THREADS setting.
|
||||||
# Minimum value: 0, maximum value: 32, default value: 1.
|
# Minimum value: 0, maximum value: 512, default value: 1.
|
||||||
|
|
||||||
NUM_PROC_THREADS = 1
|
NUM_PROC_THREADS = 0
|
||||||
|
|
||||||
# If the TIMESTAMP tag is set different from NO then each generated page will
|
# If the TIMESTAMP tag is set different from NO then each generated page will
|
||||||
# contain the date or date and time when the page was generated. Setting this to
|
# contain the date or date and time when the page was generated. Setting this to
|
||||||
|
|
@ -779,6 +793,27 @@ GENERATE_BUGLIST = YES
|
||||||
|
|
||||||
GENERATE_DEPRECATEDLIST= YES
|
GENERATE_DEPRECATEDLIST= YES
|
||||||
|
|
||||||
|
# The GENERATE_REQUIREMENTS tag can be used to enable (YES) or disable (NO) the
|
||||||
|
# requirements page. When enabled, this page is automatically created when at
|
||||||
|
# least one comment block with a \requirement command appears in the input.
|
||||||
|
# The default value is: YES.
|
||||||
|
|
||||||
|
GENERATE_REQUIREMENTS = YES
|
||||||
|
|
||||||
|
# The REQ_TRACEABILITY_INFO tag controls if traceability information is shown on
|
||||||
|
# the requirements page (only relevant when using \requirement comment blocks).
|
||||||
|
# The setting NO will disable the traceablility information altogether. The
|
||||||
|
# setting UNSATISFIED_ONLY will show a list of requirements that are missing a
|
||||||
|
# satisfies relation (through the command: \satisfies). Similarly the setting
|
||||||
|
# UNVERIFIED_ONLY will show a list of requirements that are missing a verifies
|
||||||
|
# relation (through the command: \verifies). Setting the tag to YES (the
|
||||||
|
# default) will show both lists if applicable.
|
||||||
|
# Possible values are: YES, NO, UNSATISFIED_ONLY and UNVERIFIED_ONLY.
|
||||||
|
# The default value is: YES.
|
||||||
|
# This tag requires that the tag GENERATE_REQUIREMENTS is set to YES.
|
||||||
|
|
||||||
|
REQ_TRACEABILITY_INFO = YES
|
||||||
|
|
||||||
# The ENABLED_SECTIONS tag can be used to enable conditional documentation
|
# The ENABLED_SECTIONS tag can be used to enable conditional documentation
|
||||||
# sections, marked by \if <section_label> ... \endif and \cond <section_label>
|
# sections, marked by \if <section_label> ... \endif and \cond <section_label>
|
||||||
# ... \endcond blocks.
|
# ... \endcond blocks.
|
||||||
|
|
@ -1070,8 +1105,7 @@ EXCLUDE = build/ \
|
||||||
cmake/ \
|
cmake/ \
|
||||||
doc/doxygen/theme/docs/ \
|
doc/doxygen/theme/docs/ \
|
||||||
doc/doxygen/theme/include/ \
|
doc/doxygen/theme/include/ \
|
||||||
vcpkg/ \
|
vcpkg/
|
||||||
webclient/
|
|
||||||
|
|
||||||
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
|
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
|
||||||
# directories that are symbolic links (a Unix file system feature) are excluded
|
# directories that are symbolic links (a Unix file system feature) are excluded
|
||||||
|
|
@ -1887,7 +1921,7 @@ USE_MATHJAX = NO
|
||||||
# regards to the different settings, so it is possible that also other MathJax
|
# regards to the different settings, so it is possible that also other MathJax
|
||||||
# settings have to be changed when switching between the different MathJax
|
# settings have to be changed when switching between the different MathJax
|
||||||
# versions.
|
# versions.
|
||||||
# Possible values are: MathJax_2 and MathJax_3.
|
# Possible values are: MathJax_2, MathJax_3 and MathJax_4.
|
||||||
# The default value is: MathJax_2.
|
# The default value is: MathJax_2.
|
||||||
# This tag requires that the tag USE_MATHJAX is set to YES.
|
# This tag requires that the tag USE_MATHJAX is set to YES.
|
||||||
|
|
||||||
|
|
@ -1896,9 +1930,10 @@ MATHJAX_VERSION = MathJax_2
|
||||||
# When MathJax is enabled you can set the default output format to be used for
|
# When MathJax is enabled you can set the default output format to be used for
|
||||||
# the MathJax output. For more details about the output format see MathJax
|
# the MathJax output. For more details about the output format see MathJax
|
||||||
# version 2 (see:
|
# version 2 (see:
|
||||||
# http://docs.mathjax.org/en/v2.7-latest/output.html) and MathJax version 3
|
# https://docs.mathjax.org/en/v2.7/output.html), MathJax version 3 (see:
|
||||||
|
# https://docs.mathjax.org/en/v3.2/output/index.html) and MathJax version 4
|
||||||
# (see:
|
# (see:
|
||||||
# http://docs.mathjax.org/en/latest/web/components/output.html).
|
# https://docs.mathjax.org/en/v4.0/output/index.htm).
|
||||||
# Possible values are: HTML-CSS (which is slower, but has the best
|
# Possible values are: HTML-CSS (which is slower, but has the best
|
||||||
# compatibility. This is the name for Mathjax version 2, for MathJax version 3
|
# compatibility. This is the name for Mathjax version 2, for MathJax version 3
|
||||||
# this will be translated into chtml), NativeMML (i.e. MathML. Only supported
|
# this will be translated into chtml), NativeMML (i.e. MathML. Only supported
|
||||||
|
|
@ -1911,36 +1946,50 @@ MATHJAX_VERSION = MathJax_2
|
||||||
MATHJAX_FORMAT = HTML-CSS
|
MATHJAX_FORMAT = HTML-CSS
|
||||||
|
|
||||||
# When MathJax is enabled you need to specify the location relative to the HTML
|
# When MathJax is enabled you need to specify the location relative to the HTML
|
||||||
# output directory using the MATHJAX_RELPATH option. The destination directory
|
# output directory using the MATHJAX_RELPATH option. For Mathjax version 2 the
|
||||||
# should contain the MathJax.js script. For instance, if the mathjax directory
|
# destination directory should contain the MathJax.js script. For instance, if
|
||||||
# is located at the same level as the HTML output directory, then
|
# the mathjax directory is located at the same level as the HTML output
|
||||||
# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
|
# directory, then MATHJAX_RELPATH should be ../mathjax.s For Mathjax versions 3
|
||||||
# Content Delivery Network so you can quickly see the result without installing
|
# and 4 the destination directory should contain the tex-<format>.js script
|
||||||
# MathJax. However, it is strongly recommended to install a local copy of
|
# (where <format> is either chtml or svg). The default value points to the
|
||||||
# MathJax from https://www.mathjax.org before deployment. The default value is:
|
# MathJax Content Delivery Network so you can quickly see the result without
|
||||||
|
# installing MathJax. However, it is strongly recommended to install a local
|
||||||
|
# copy of MathJax from https://www.mathjax.org before deployment. The default
|
||||||
|
# value is:
|
||||||
# - in case of MathJax version 2: https://cdn.jsdelivr.net/npm/mathjax@2
|
# - in case of MathJax version 2: https://cdn.jsdelivr.net/npm/mathjax@2
|
||||||
# - in case of MathJax version 3: https://cdn.jsdelivr.net/npm/mathjax@3
|
# - in case of MathJax version 3: https://cdn.jsdelivr.net/npm/mathjax@3
|
||||||
|
# - in case of MathJax version 4: https://cdn.jsdelivr.net/npm/mathjax@4
|
||||||
# This tag requires that the tag USE_MATHJAX is set to YES.
|
# This tag requires that the tag USE_MATHJAX is set to YES.
|
||||||
|
|
||||||
MATHJAX_RELPATH =
|
MATHJAX_RELPATH =
|
||||||
|
|
||||||
# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
|
# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
|
||||||
# extension names that should be enabled during MathJax rendering. For example
|
# extension names that should be enabled during MathJax rendering. For example
|
||||||
# for MathJax version 2 (see
|
# for MathJax version 2 (see https://docs.mathjax.org/en/v2.7/tex.html):
|
||||||
# https://docs.mathjax.org/en/v2.7-latest/tex.html#tex-and-latex-extensions):
|
|
||||||
# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
|
# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
|
||||||
# For example for MathJax version 3 (see
|
# For example for MathJax version 3 (see
|
||||||
# http://docs.mathjax.org/en/latest/input/tex/extensions/index.html):
|
# https://docs.mathjax.org/en/v3.2/input/tex/extensions/):
|
||||||
# MATHJAX_EXTENSIONS = ams
|
# MATHJAX_EXTENSIONS = ams
|
||||||
|
# For example for MathJax version 4 (see
|
||||||
|
# https://docs.mathjax.org/en/v4.0/input/tex/extensions/):
|
||||||
|
# MATHJAX_EXTENSIONS = units
|
||||||
|
# Note that for Mathjax version 4 quite a few extensions are already
|
||||||
|
# automatically loaded. To disable a package in Mathjax version 4 one can use
|
||||||
|
# the package name prepended with a minus sign (- like MATHJAX_EXTENSIONS +=
|
||||||
|
# -textmacros)
|
||||||
# This tag requires that the tag USE_MATHJAX is set to YES.
|
# This tag requires that the tag USE_MATHJAX is set to YES.
|
||||||
|
|
||||||
MATHJAX_EXTENSIONS =
|
MATHJAX_EXTENSIONS =
|
||||||
|
|
||||||
# The MATHJAX_CODEFILE tag can be used to specify a file with JavaScript pieces
|
# The MATHJAX_CODEFILE tag can be used to specify a file with JavaScript pieces
|
||||||
# of code that will be used on startup of the MathJax code. See the MathJax site
|
# of code that will be used on startup of the MathJax code. See the Mathjax site
|
||||||
# (see:
|
# for more details:
|
||||||
# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details. For an
|
# - MathJax version 2 (see:
|
||||||
# example see the documentation.
|
# https://docs.mathjax.org/en/v2.7/)
|
||||||
|
# - MathJax version 3 (see:
|
||||||
|
# https://docs.mathjax.org/en/v3.2/)
|
||||||
|
# - MathJax version 4 (see:
|
||||||
|
# https://docs.mathjax.org/en/v4.0/) For an example see the documentation.
|
||||||
# This tag requires that the tag USE_MATHJAX is set to YES.
|
# This tag requires that the tag USE_MATHJAX is set to YES.
|
||||||
|
|
||||||
MATHJAX_CODEFILE =
|
MATHJAX_CODEFILE =
|
||||||
|
|
@ -2601,7 +2650,7 @@ HAVE_DOT = YES
|
||||||
# processors available in the system. You can set it explicitly to a value
|
# processors available in the system. You can set it explicitly to a value
|
||||||
# larger than 0 to get control over the balance between CPU load and processing
|
# larger than 0 to get control over the balance between CPU load and processing
|
||||||
# speed.
|
# speed.
|
||||||
# Minimum value: 0, maximum value: 32, default value: 0.
|
# Minimum value: 0, maximum value: 512, default value: 0.
|
||||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||||
|
|
||||||
DOT_NUM_THREADS = 0
|
DOT_NUM_THREADS = 0
|
||||||
|
|
|
||||||
12
README.md
12
README.md
|
|
@ -8,7 +8,7 @@
|
||||||
<a href="#related-repositories">Related</a> <b>|</b>
|
<a href="#related-repositories">Related</a> <b>|</b>
|
||||||
<a href="#community-resources-">Community</a> <b>|</b>
|
<a href="#community-resources-">Community</a> <b>|</b>
|
||||||
<a href="#contribute">Contribute</a> <b>|</b>
|
<a href="#contribute">Contribute</a> <b>|</b>
|
||||||
<a href="#build---">Build</a> <b>|</b>
|
<a href="#build--">Build</a> <b>|</b>
|
||||||
<a href="#run">Run</a>
|
<a href="#run">Run</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
@ -25,7 +25,6 @@
|
||||||
|
|
||||||
Cockatrice is an open-source, multiplatform application for playing tabletop card games over a network. The program's server design prevents users from manipulating the game for unfair advantage. The client also provides a single-player mode, which allows users to brew while offline.<br><br>
|
Cockatrice is an open-source, multiplatform application for playing tabletop card games over a network. The program's server design prevents users from manipulating the game for unfair advantage. The client also provides a single-player mode, which allows users to brew while offline.<br><br>
|
||||||
This project uses <kbd>C++</kbd> and the <kbd>Qt</kbd> libraries.<br>
|
This project uses <kbd>C++</kbd> and the <kbd>Qt</kbd> libraries.<br>
|
||||||
First work on a webclient with <kbd>Typescript</kbd> was started as well.<br>
|
|
||||||
|
|
||||||
|
|
||||||
# Download [](https://tooomm.github.io/github-release-stats/?username=Cockatrice&repository=Cockatrice&search=0)
|
# Download [](https://tooomm.github.io/github-release-stats/?username=Cockatrice&repository=Cockatrice&search=0)
|
||||||
|
|
@ -48,11 +47,12 @@ Latest <kbd>beta</kbd> version:
|
||||||
- [Magic-Spoiler](https://github.com/Cockatrice/Magic-Spoiler): Code to generate MtG spoiler data from [MTGJSON](https://github.com/mtgjson/mtgjson) for use in Cockatrice
|
- [Magic-Spoiler](https://github.com/Cockatrice/Magic-Spoiler): Code to generate MtG spoiler data from [MTGJSON](https://github.com/mtgjson/mtgjson) for use in Cockatrice
|
||||||
- [cockatrice.github.io](https://github.com/Cockatrice/cockatrice.github.io): Code of the official Cockatrice webpage
|
- [cockatrice.github.io](https://github.com/Cockatrice/cockatrice.github.io): Code of the official Cockatrice webpage
|
||||||
- [io.github.Cockatrice.cockatrice](https://github.com/flathub/io.github.Cockatrice.cockatrice): Configuration of our Linux `flatpak` package hosted at [Flathub](https://flathub.org/en/apps/io.github.Cockatrice.cockatrice)
|
- [io.github.Cockatrice.cockatrice](https://github.com/flathub/io.github.Cockatrice.cockatrice): Configuration of our Linux `flatpak` package hosted at [Flathub](https://flathub.org/en/apps/io.github.Cockatrice.cockatrice)
|
||||||
|
- [Webatrice](https://github.com/Cockatrice/Webatrice): Web client for Cockatrice servers (TypeScript / React)
|
||||||
|
|
||||||
|
|
||||||
# Community Resources [](https://discord.gg/3Z9yzmA)
|
# Community Resources [](https://discord.gg/3Z9yzmA)
|
||||||
|
|
||||||
Join our [Discord community](https://discord.gg/3Z9yzmA) to connect with other projet contributors (`#dev` channel) or fellow users of the app. Come here to talk about the application, features, or just to hang out.
|
Join our [Discord community](https://discord.gg/3Z9yzmA) to connect with other project contributors (`#dev` channel) or fellow users of the app. Come here to talk about the application, features, or just to hang out.
|
||||||
- [Official Website](https://cockatrice.github.io)
|
- [Official Website](https://cockatrice.github.io)
|
||||||
- [Official Wiki](https://github.com/Cockatrice/Cockatrice/wiki)
|
- [Official Wiki](https://github.com/Cockatrice/Cockatrice/wiki)
|
||||||
- [Official Discord](https://discord.gg/3Z9yzmA)
|
- [Official Discord](https://discord.gg/3Z9yzmA)
|
||||||
|
|
@ -107,12 +107,12 @@ Cockatrice tries to use the [Google Developer Documentation Style Guide](https:/
|
||||||
|
|
||||||
### Translation [](https://explore.transifex.com/cockatrice/cockatrice/)
|
### Translation [](https://explore.transifex.com/cockatrice/cockatrice/)
|
||||||
|
|
||||||
Cockatrice uses Transifex to manage translations. You can help us bring <kbd>Cockatrice</kbd>, <kbd>Oracle</kbd> and <kbd>Webatrice</kbd> to your language and just adjust single wordings right from within your browser by visiting our [Transifex project page](https://explore.transifex.com/cockatrice/cockatrice/).<br>
|
Cockatrice uses Transifex to manage translations. You can help us bring <kbd>Cockatrice</kbd> and <kbd>Oracle</kbd> to your language and just adjust single wordings right from within your browser by visiting our [Transifex project page](https://explore.transifex.com/cockatrice/cockatrice/). The [Webatrice](https://github.com/seavor/Webatrice) web client manages its own translations in its repo.<br>
|
||||||
|
|
||||||
Check out our [Translator FAQ](https://github.com/Cockatrice/Cockatrice/wiki/Translation-FAQ) for more information about getting invovled, and join a group of hundreds of others!<br>
|
Check out our [Translator FAQ](https://github.com/Cockatrice/Cockatrice/wiki/Translation-FAQ) for more information about getting involved, and join a group of hundreds of others!<br>
|
||||||
|
|
||||||
|
|
||||||
# Build [](https://github.com/Cockatrice/Cockatrice/actions/workflows/desktop-build.yml?query=branch%3Amaster+event%3Apush) [](https://github.com/Cockatrice/Cockatrice/actions/workflows/docker-release.yml?query=branch%3Amaster+event%3Apush) [](https://github.com/Cockatrice/Cockatrice/actions/workflows/web-build.yml?query=branch%3Amaster+event%3Apush)
|
# Build [](https://github.com/Cockatrice/Cockatrice/actions/workflows/desktop-build.yml?query=branch%3Amaster+event%3Apush) [](https://github.com/Cockatrice/Cockatrice/actions/workflows/docker-release.yml?query=branch%3Amaster+event%3Apush)
|
||||||
|
|
||||||
Dependencies: *(for minimum versions search our [CMake file](https://github.com/Cockatrice/Cockatrice/blob/master/CMakeLists.txt))*
|
Dependencies: *(for minimum versions search our [CMake file](https://github.com/Cockatrice/Cockatrice/blob/master/CMakeLists.txt))*
|
||||||
- [Qt](https://www.qt.io/developers/)
|
- [Qt](https://www.qt.io/developers/)
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,9 @@ if(WITH_ORACLE)
|
||||||
set(_ORACLE_NEEDED Concurrent Network Svg Widgets)
|
set(_ORACLE_NEEDED Concurrent Network Svg Widgets)
|
||||||
endif()
|
endif()
|
||||||
if(TEST)
|
if(TEST)
|
||||||
set(_TEST_NEEDED Widgets)
|
# Union of Qt modules required across all test targets (independent of application targets).
|
||||||
|
# When adding a new test that needs additional Qt modules, add them here rather than in the test's CMakeLists.txt.
|
||||||
|
set(_TEST_NEEDED Concurrent Network Svg Widgets)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(REQUIRED_QT_COMPONENTS ${REQUIRED_QT_COMPONENTS} ${_SERVATRICE_NEEDED} ${_COCKATRICE_NEEDED} ${_ORACLE_NEEDED}
|
set(REQUIRED_QT_COMPONENTS ${REQUIRED_QT_COMPONENTS} ${_SERVATRICE_NEEDED} ${_COCKATRICE_NEEDED} ${_ORACLE_NEEDED}
|
||||||
|
|
@ -40,7 +42,7 @@ list(REMOVE_DUPLICATES REQUIRED_QT_COMPONENTS)
|
||||||
if(NOT FORCE_USE_QT5)
|
if(NOT FORCE_USE_QT5)
|
||||||
# Linguist is now a component in Qt6 instead of an external package
|
# Linguist is now a component in Qt6 instead of an external package
|
||||||
find_package(
|
find_package(
|
||||||
Qt6 6.2.3
|
Qt6 6.4.2
|
||||||
COMPONENTS ${REQUIRED_QT_COMPONENTS} Linguist
|
COMPONENTS ${REQUIRED_QT_COMPONENTS} Linguist
|
||||||
QUIET HINTS ${Qt6_DIR}
|
QUIET HINTS ${Qt6_DIR}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ SetCompressor LZMA
|
||||||
Var NormalDestDir
|
Var NormalDestDir
|
||||||
Var PortableDestDir
|
Var PortableDestDir
|
||||||
Var PortableMode
|
Var PortableMode
|
||||||
|
Var ReinstallMode
|
||||||
|
|
||||||
!include LogicLib.nsh
|
!include LogicLib.nsh
|
||||||
!include FileFunc.nsh
|
!include FileFunc.nsh
|
||||||
|
|
@ -26,14 +27,25 @@ Var PortableMode
|
||||||
!define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of Cockatrice.$\r$\n$\r$\nClick Next to continue."
|
!define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of Cockatrice.$\r$\n$\r$\nClick Next to continue."
|
||||||
!define MUI_FINISHPAGE_RUN "$INSTDIR/cockatrice.exe"
|
!define MUI_FINISHPAGE_RUN "$INSTDIR/cockatrice.exe"
|
||||||
!define MUI_FINISHPAGE_RUN_TEXT "Run 'Cockatrice' now"
|
!define MUI_FINISHPAGE_RUN_TEXT "Run 'Cockatrice' now"
|
||||||
|
!define MUI_ICON "${NSIS_SOURCE_PATH}\cockatrice\resources\appicon.ico"
|
||||||
|
|
||||||
|
!define MUI_PAGE_CUSTOMFUNCTION_PRE SkipIfReinstall
|
||||||
!insertmacro MUI_PAGE_WELCOME
|
!insertmacro MUI_PAGE_WELCOME
|
||||||
|
|
||||||
|
!define MUI_PAGE_CUSTOMFUNCTION_PRE SkipIfReinstall
|
||||||
!insertmacro MUI_PAGE_LICENSE "${NSIS_SOURCE_PATH}\LICENSE"
|
!insertmacro MUI_PAGE_LICENSE "${NSIS_SOURCE_PATH}\LICENSE"
|
||||||
|
|
||||||
Page Custom PortableModePageCreate PortableModePageLeave
|
Page Custom PortableModePageCreate PortableModePageLeave
|
||||||
!define MUI_PAGE_CUSTOMFUNCTION_PRE componentsPagePre
|
!define MUI_PAGE_CUSTOMFUNCTION_PRE componentsPagePre
|
||||||
!insertmacro MUI_PAGE_COMPONENTS
|
!insertmacro MUI_PAGE_COMPONENTS
|
||||||
|
|
||||||
|
!define MUI_PAGE_CUSTOMFUNCTION_PRE SkipIfReinstall
|
||||||
!insertmacro MUI_PAGE_DIRECTORY
|
!insertmacro MUI_PAGE_DIRECTORY
|
||||||
|
|
||||||
|
!define MUI_PAGE_CUSTOMFUNCTION_PRE SkipIfReinstall
|
||||||
!insertmacro MUI_PAGE_INSTFILES
|
!insertmacro MUI_PAGE_INSTFILES
|
||||||
|
|
||||||
|
!define MUI_PAGE_CUSTOMFUNCTION_PRE SkipIfReinstall
|
||||||
!insertmacro MUI_PAGE_FINISH
|
!insertmacro MUI_PAGE_FINISH
|
||||||
|
|
||||||
!insertmacro MUI_UNPAGE_CONFIRM
|
!insertmacro MUI_UNPAGE_CONFIRM
|
||||||
|
|
@ -72,6 +84,7 @@ ${IfNot} ${Errors}
|
||||||
MessageBox MB_ICONINFORMATION|MB_SETFOREGROUND "\
|
MessageBox MB_ICONINFORMATION|MB_SETFOREGROUND "\
|
||||||
/PORTABLE : Install in portable mode$\n\
|
/PORTABLE : Install in portable mode$\n\
|
||||||
/S : Silent install$\n\
|
/S : Silent install$\n\
|
||||||
|
/R : Silent upgrade$\n\
|
||||||
/D=%directory% : Specify destination directory$\n"
|
/D=%directory% : Specify destination directory$\n"
|
||||||
Quit
|
Quit
|
||||||
${EndIf}
|
${EndIf}
|
||||||
|
|
@ -89,6 +102,16 @@ ${Else}
|
||||||
${EndIf}
|
${EndIf}
|
||||||
${EndIf}
|
${EndIf}
|
||||||
|
|
||||||
|
ClearErrors
|
||||||
|
${GetOptions} $9 "/R" $8
|
||||||
|
${IfNot} ${Errors}
|
||||||
|
StrCpy $ReinstallMode 1
|
||||||
|
SetSilent silent
|
||||||
|
SetAutoClose true
|
||||||
|
${Else}
|
||||||
|
StrCpy $ReinstallMode 0
|
||||||
|
${EndIf}
|
||||||
|
|
||||||
${If} $InstDir == ""
|
${If} $InstDir == ""
|
||||||
; User did not use /D to specify a directory,
|
; User did not use /D to specify a directory,
|
||||||
; we need to set a default based on the install mode
|
; we need to set a default based on the install mode
|
||||||
|
|
@ -96,6 +119,22 @@ ${If} $InstDir == ""
|
||||||
${EndIf}
|
${EndIf}
|
||||||
Call SetModeDestinationFromInstdir
|
Call SetModeDestinationFromInstdir
|
||||||
|
|
||||||
|
; --- Detect portable install when using /R ---
|
||||||
|
${If} $ReinstallMode = 1
|
||||||
|
IfFileExists "$InstDir\portable.dat" 0 not_portable
|
||||||
|
StrCpy $PortableMode 1
|
||||||
|
Goto portable_done
|
||||||
|
|
||||||
|
not_portable:
|
||||||
|
StrCpy $PortableMode 0
|
||||||
|
|
||||||
|
portable_done:
|
||||||
|
${EndIf}
|
||||||
|
|
||||||
|
${If} $ReinstallMode = 1
|
||||||
|
Call AutoUninstallIfNeeded
|
||||||
|
${EndIf}
|
||||||
|
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
Function un.onInit
|
Function un.onInit
|
||||||
|
|
@ -125,8 +164,46 @@ ${Else}
|
||||||
${EndIf}
|
${EndIf}
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
|
Function SkipIfReinstall
|
||||||
|
${If} $ReinstallMode = 1
|
||||||
|
Abort
|
||||||
|
${EndIf}
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
|
Function AutoUninstallIfNeeded
|
||||||
|
|
||||||
|
SetShellVarContext all
|
||||||
|
|
||||||
|
; --- 32-bit uninstall ---
|
||||||
|
SetRegView 32
|
||||||
|
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "QuietUninstallString"
|
||||||
|
|
||||||
|
StrCmp $R0 "" done32
|
||||||
|
DetailPrint "Removing previous version (32-bit)..."
|
||||||
|
ExecWait '$R0'
|
||||||
|
|
||||||
|
done32:
|
||||||
|
|
||||||
|
; --- 64-bit uninstall ---
|
||||||
|
${If} ${RunningX64}
|
||||||
|
SetRegView 64
|
||||||
|
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "QuietUninstallString"
|
||||||
|
|
||||||
|
StrCmp $R0 "" done64
|
||||||
|
DetailPrint "Removing previous version (64-bit)..."
|
||||||
|
ExecWait '$R0'
|
||||||
|
|
||||||
|
done64:
|
||||||
|
${EndIf}
|
||||||
|
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
Function PortableModePageCreate
|
Function PortableModePageCreate
|
||||||
|
|
||||||
|
${If} $ReinstallMode = 1
|
||||||
|
Abort
|
||||||
|
${EndIf}
|
||||||
|
|
||||||
Call SetModeDestinationFromInstdir ; If the user clicks BACK on the directory page we will remember their mode specific directory
|
Call SetModeDestinationFromInstdir ; If the user clicks BACK on the directory page we will remember their mode specific directory
|
||||||
!insertmacro MUI_HEADER_TEXT "Install Mode" "Choose how you want to install Cockatrice."
|
!insertmacro MUI_HEADER_TEXT "Install Mode" "Choose how you want to install Cockatrice."
|
||||||
nsDialogs::Create 1018
|
nsDialogs::Create 1018
|
||||||
|
|
@ -158,6 +235,11 @@ ${EndIf}
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
Function componentsPagePre
|
Function componentsPagePre
|
||||||
|
|
||||||
|
${If} $ReinstallMode = 1
|
||||||
|
Return
|
||||||
|
${EndIf}
|
||||||
|
|
||||||
${If} $PortableMode = 0
|
${If} $PortableMode = 0
|
||||||
SetShellVarContext all
|
SetShellVarContext all
|
||||||
|
|
||||||
|
|
@ -167,8 +249,12 @@ ${If} $PortableMode = 0
|
||||||
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "UninstallString"
|
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "UninstallString"
|
||||||
StrCmp $R0 "" done32
|
StrCmp $R0 "" done32
|
||||||
|
|
||||||
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "A previous version of Cockatrice must be uninstalled before installing the new one." IDOK uninst32
|
${If} $ReinstallMode = 0
|
||||||
Abort
|
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "A previous version of Cockatrice must be uninstalled before installing the new one." IDOK uninst32
|
||||||
|
Abort
|
||||||
|
${Else}
|
||||||
|
Goto uninst32
|
||||||
|
${EndIf}
|
||||||
|
|
||||||
uninst32:
|
uninst32:
|
||||||
ClearErrors
|
ClearErrors
|
||||||
|
|
@ -183,8 +269,12 @@ ${If} $PortableMode = 0
|
||||||
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "UninstallString"
|
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "UninstallString"
|
||||||
StrCmp $R0 "" done64
|
StrCmp $R0 "" done64
|
||||||
|
|
||||||
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "A previous version of Cockatrice must be uninstalled before installing the new one." IDOK uninst64
|
${If} $ReinstallMode = 0
|
||||||
Abort
|
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "A previous version of Cockatrice must be uninstalled before installing the new one." IDOK uninst64
|
||||||
|
Abort
|
||||||
|
${Else}
|
||||||
|
Goto uninst64
|
||||||
|
${EndIf}
|
||||||
|
|
||||||
uninst64:
|
uninst64:
|
||||||
ClearErrors
|
ClearErrors
|
||||||
|
|
@ -276,6 +366,12 @@ ${Else}
|
||||||
FileWrite $0 "PORTABLE"
|
FileWrite $0 "PORTABLE"
|
||||||
FileClose $0
|
FileClose $0
|
||||||
${EndIf}
|
${EndIf}
|
||||||
|
|
||||||
|
${If} $ReinstallMode = 1
|
||||||
|
IfFileExists "$INSTDIR\cockatrice.exe" 0 +2
|
||||||
|
Exec '"$INSTDIR\cockatrice.exe"'
|
||||||
|
${EndIf}
|
||||||
|
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
Section "Start menu item" SecStartMenu
|
Section "Start menu item" SecStartMenu
|
||||||
|
|
|
||||||
|
|
@ -213,7 +213,8 @@ set(PROJECT_VERSION_FRIENDLY "${PROJECT_VERSION} (${GIT_COMMIT_DATE_FRIENDLY})")
|
||||||
# Format: <program name>[-ReleaseName]-MAJ.MIN.PATCH[-prerelease_label]
|
# Format: <program name>[-ReleaseName]-MAJ.MIN.PATCH[-prerelease_label]
|
||||||
set(PROJECT_VERSION_FILENAME "${PROJECT_NAME}")
|
set(PROJECT_VERSION_FILENAME "${PROJECT_NAME}")
|
||||||
if(PROJECT_VERSION_RELEASENAME)
|
if(PROJECT_VERSION_RELEASENAME)
|
||||||
set(PROJECT_VERSION_FILENAME "${PROJECT_VERSION_FILENAME}-${PROJECT_VERSION_RELEASENAME}")
|
string(REPLACE " " "-" PROJECT_VERSION_RELEASENAME_SAFE "${PROJECT_VERSION_RELEASENAME}")
|
||||||
|
set(PROJECT_VERSION_FILENAME "${PROJECT_VERSION_FILENAME}-${PROJECT_VERSION_RELEASENAME_SAFE}")
|
||||||
endif()
|
endif()
|
||||||
set(PROJECT_VERSION_FILENAME "${PROJECT_VERSION_FILENAME}-${PROJECT_VERSION}")
|
set(PROJECT_VERSION_FILENAME "${PROJECT_VERSION_FILENAME}-${PROJECT_VERSION}")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,16 @@
|
||||||
cmake_minimum_required(VERSION 3.2)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
|
|
||||||
project(gtest-download LANGUAGES NONE)
|
project(gtest-download LANGUAGES NONE)
|
||||||
|
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
ExternalProject_Add(googletest
|
externalproject_add(
|
||||||
URL https://github.com/google/googletest/archive/release-1.11.0.zip
|
googletest
|
||||||
URL_HASH SHA1=9ffb7b5923f4a8fcdabf2f42c6540cce299f44c0
|
URL https://github.com/google/googletest/archive/refs/tags/v1.17.0.zip
|
||||||
|
URL_HASH SHA1=f638fa0e724760e2ba07ff8cfba32cd644e1ce28
|
||||||
SOURCE_DIR "${CMAKE_BINARY_DIR}/gtest-src"
|
SOURCE_DIR "${CMAKE_BINARY_DIR}/gtest-src"
|
||||||
BINARY_DIR "${CMAKE_BINARY_DIR}/gtest-build"
|
BINARY_DIR "${CMAKE_BINARY_DIR}/gtest-build"
|
||||||
CONFIGURE_COMMAND ""
|
CONFIGURE_COMMAND ""
|
||||||
BUILD_COMMAND ""
|
BUILD_COMMAND ""
|
||||||
INSTALL_COMMAND ""
|
INSTALL_COMMAND ""
|
||||||
TEST_COMMAND ""
|
TEST_COMMAND ""
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ project(Cockatrice VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${
|
||||||
set(cockatrice_SOURCES
|
set(cockatrice_SOURCES
|
||||||
${VERSION_STRING_CPP}
|
${VERSION_STRING_CPP}
|
||||||
# sort by alphabetical order, so that there is no debate about where to add new sources to the list
|
# sort by alphabetical order, so that there is no debate about where to add new sources to the list
|
||||||
|
src/client/network/connection_controller/remote_connection_controller.cpp
|
||||||
src/client/network/update/client/update_downloader.cpp
|
src/client/network/update/client/update_downloader.cpp
|
||||||
src/client/network/interfaces/deck_stats_interface.cpp
|
src/client/network/interfaces/deck_stats_interface.cpp
|
||||||
src/client/network/interfaces/tapped_out_interface.cpp
|
src/client/network/interfaces/tapped_out_interface.cpp
|
||||||
|
|
@ -39,6 +40,7 @@ set(cockatrice_SOURCES
|
||||||
src/interface/widgets/dialogs/dlg_load_deck_from_clipboard.cpp
|
src/interface/widgets/dialogs/dlg_load_deck_from_clipboard.cpp
|
||||||
src/interface/widgets/dialogs/dlg_load_deck_from_website.cpp
|
src/interface/widgets/dialogs/dlg_load_deck_from_website.cpp
|
||||||
src/interface/widgets/dialogs/dlg_load_remote_deck.cpp
|
src/interface/widgets/dialogs/dlg_load_remote_deck.cpp
|
||||||
|
src/interface/widgets/dialogs/dlg_local_game_options.cpp
|
||||||
src/interface/widgets/dialogs/dlg_manage_sets.cpp
|
src/interface/widgets/dialogs/dlg_manage_sets.cpp
|
||||||
src/interface/widgets/dialogs/dlg_register.cpp
|
src/interface/widgets/dialogs/dlg_register.cpp
|
||||||
src/interface/widgets/dialogs/dlg_select_set_for_cards.cpp
|
src/interface/widgets/dialogs/dlg_select_set_for_cards.cpp
|
||||||
|
|
@ -57,12 +59,15 @@ set(cockatrice_SOURCES
|
||||||
src/game/board/abstract_card_drag_item.cpp
|
src/game/board/abstract_card_drag_item.cpp
|
||||||
src/game/board/abstract_card_item.cpp
|
src/game/board/abstract_card_item.cpp
|
||||||
src/game/board/abstract_counter.cpp
|
src/game/board/abstract_counter.cpp
|
||||||
|
src/game/board/arrow_data.cpp
|
||||||
src/game/board/arrow_item.cpp
|
src/game/board/arrow_item.cpp
|
||||||
src/game/board/arrow_target.cpp
|
src/game/board/arrow_target.cpp
|
||||||
src/game/board/card_drag_item.cpp
|
src/game/board/card_drag_item.cpp
|
||||||
src/game/board/card_item.cpp
|
src/game/board/card_item.cpp
|
||||||
src/game/board/card_list.cpp
|
src/game/board/card_list.cpp
|
||||||
|
src/game/board/card_state.cpp
|
||||||
src/game/board/counter_general.cpp
|
src/game/board/counter_general.cpp
|
||||||
|
src/game/board/counter_state.cpp
|
||||||
src/game/board/translate_counter_name.cpp
|
src/game/board/translate_counter_name.cpp
|
||||||
src/game/deckview/deck_view.cpp
|
src/game/deckview/deck_view.cpp
|
||||||
src/game/deckview/deck_view_container.cpp
|
src/game/deckview/deck_view_container.cpp
|
||||||
|
|
@ -92,30 +97,30 @@ set(cockatrice_SOURCES
|
||||||
src/game/player/menu/say_menu.cpp
|
src/game/player/menu/say_menu.cpp
|
||||||
src/game/player/menu/sideboard_menu.cpp
|
src/game/player/menu/sideboard_menu.cpp
|
||||||
src/game/player/menu/utility_menu.cpp
|
src/game/player/menu/utility_menu.cpp
|
||||||
src/game/player/player.cpp
|
|
||||||
src/game/player/player_actions.cpp
|
src/game/player/player_actions.cpp
|
||||||
src/game/player/player_area.cpp
|
src/game/player/player_area.cpp
|
||||||
src/game/player/player_event_handler.cpp
|
src/game/player/player_event_handler.cpp
|
||||||
src/game/player/player_graphics_item.cpp
|
src/game/player/player_graphics_item.cpp
|
||||||
src/game/player/player_info.cpp
|
src/game/player/player_info.cpp
|
||||||
src/game/player/player_list_widget.cpp
|
src/game/player/player_list_widget.cpp
|
||||||
|
src/game/player/player_logic.cpp
|
||||||
src/game/player/player_manager.cpp
|
src/game/player/player_manager.cpp
|
||||||
src/game/player/player_target.cpp
|
src/game/player/player_target.cpp
|
||||||
src/game/replay.cpp
|
src/game/replay.cpp
|
||||||
src/game/zones/card_zone.cpp
|
src/game/zones/card_zone_logic.cpp
|
||||||
src/game/zones/hand_zone.cpp
|
src/game/zones/hand_zone_logic.cpp
|
||||||
src/game/zones/logic/card_zone_logic.cpp
|
src/game/zones/pile_zone_logic.cpp
|
||||||
src/game/zones/logic/hand_zone_logic.cpp
|
src/game/zones/stack_zone_logic.cpp
|
||||||
src/game/zones/logic/pile_zone_logic.cpp
|
src/game/zones/table_zone_logic.cpp
|
||||||
src/game/zones/logic/stack_zone_logic.cpp
|
src/game/zones/view_zone_logic.cpp
|
||||||
src/game/zones/logic/table_zone_logic.cpp
|
src/game_graphics/zones/card_zone.cpp
|
||||||
src/game/zones/logic/view_zone_logic.cpp
|
src/game_graphics/zones/hand_zone.cpp
|
||||||
src/game/zones/pile_zone.cpp
|
src/game_graphics/zones/pile_zone.cpp
|
||||||
src/game/zones/select_zone.cpp
|
src/game_graphics/zones/select_zone.cpp
|
||||||
src/game/zones/stack_zone.cpp
|
src/game_graphics/zones/stack_zone.cpp
|
||||||
src/game/zones/table_zone.cpp
|
src/game_graphics/zones/table_zone.cpp
|
||||||
src/game/zones/view_zone.cpp
|
src/game_graphics/zones/view_zone.cpp
|
||||||
src/game/zones/view_zone_widget.cpp
|
src/game_graphics/zones/view_zone_widget.cpp
|
||||||
src/game_graphics/board/abstract_graphics_item.cpp
|
src/game_graphics/board/abstract_graphics_item.cpp
|
||||||
src/interface/card_picture_loader/card_picture_loader.cpp
|
src/interface/card_picture_loader/card_picture_loader.cpp
|
||||||
src/interface/card_picture_loader/card_picture_loader_local.cpp
|
src/interface/card_picture_loader/card_picture_loader_local.cpp
|
||||||
|
|
@ -128,7 +133,13 @@ set(cockatrice_SOURCES
|
||||||
src/interface/layouts/overlap_layout.cpp
|
src/interface/layouts/overlap_layout.cpp
|
||||||
src/interface/widgets/utility/line_edit_completer.cpp
|
src/interface/widgets/utility/line_edit_completer.cpp
|
||||||
src/interface/pixel_map_generator.cpp
|
src/interface/pixel_map_generator.cpp
|
||||||
|
src/interface/theme_config.cpp
|
||||||
src/interface/theme_manager.cpp
|
src/interface/theme_manager.cpp
|
||||||
|
src/interface/palette_editor/color_button.cpp
|
||||||
|
src/interface/palette_editor/palette_generator.cpp
|
||||||
|
src/interface/palette_editor/quick_setup_panel.cpp
|
||||||
|
src/interface/palette_editor/palette_grid_widget.cpp
|
||||||
|
src/interface/palette_editor/palette_editor_dialog.cpp
|
||||||
src/interface/widgets/cards/additional_info/color_identity_widget.cpp
|
src/interface/widgets/cards/additional_info/color_identity_widget.cpp
|
||||||
src/interface/widgets/cards/additional_info/mana_cost_widget.cpp
|
src/interface/widgets/cards/additional_info/mana_cost_widget.cpp
|
||||||
src/interface/widgets/cards/additional_info/mana_symbol_widget.cpp
|
src/interface/widgets/cards/additional_info/mana_symbol_widget.cpp
|
||||||
|
|
@ -199,6 +210,9 @@ set(cockatrice_SOURCES
|
||||||
src/interface/widgets/general/layout_containers/flow_widget.cpp
|
src/interface/widgets/general/layout_containers/flow_widget.cpp
|
||||||
src/interface/widgets/general/layout_containers/overlap_control_widget.cpp
|
src/interface/widgets/general/layout_containers/overlap_control_widget.cpp
|
||||||
src/interface/widgets/general/layout_containers/overlap_widget.cpp
|
src/interface/widgets/general/layout_containers/overlap_widget.cpp
|
||||||
|
src/interface/widgets/general/tutorial/tutorial_bubble_widget.cpp
|
||||||
|
src/interface/widgets/general/tutorial/tutorial_controller.cpp
|
||||||
|
src/interface/widgets/general/tutorial/tutorial_overlay.cpp
|
||||||
src/interface/widgets/menus/deck_editor_menu.cpp
|
src/interface/widgets/menus/deck_editor_menu.cpp
|
||||||
src/interface/widgets/printing_selector/all_zones_card_amount_widget.cpp
|
src/interface/widgets/printing_selector/all_zones_card_amount_widget.cpp
|
||||||
src/interface/widgets/printing_selector/card_amount_widget.cpp
|
src/interface/widgets/printing_selector/card_amount_widget.cpp
|
||||||
|
|
@ -215,6 +229,7 @@ set(cockatrice_SOURCES
|
||||||
src/interface/widgets/replay/replay_manager.cpp
|
src/interface/widgets/replay/replay_manager.cpp
|
||||||
src/interface/widgets/replay/replay_timeline_widget.cpp
|
src/interface/widgets/replay/replay_timeline_widget.cpp
|
||||||
src/interface/widgets/server/chat_view/chat_view.cpp
|
src/interface/widgets/server/chat_view/chat_view.cpp
|
||||||
|
src/interface/widgets/server/game_filter_configs.cpp
|
||||||
src/interface/widgets/server/game_selector.cpp
|
src/interface/widgets/server/game_selector.cpp
|
||||||
src/interface/widgets/server/game_selector_quick_filter_toolbar.cpp
|
src/interface/widgets/server/game_selector_quick_filter_toolbar.cpp
|
||||||
src/interface/widgets/server/games_model.cpp
|
src/interface/widgets/server/games_model.cpp
|
||||||
|
|
@ -226,6 +241,14 @@ set(cockatrice_SOURCES
|
||||||
src/interface/widgets/server/user/user_info_connection.cpp
|
src/interface/widgets/server/user/user_info_connection.cpp
|
||||||
src/interface/widgets/server/user/user_list_manager.cpp
|
src/interface/widgets/server/user/user_list_manager.cpp
|
||||||
src/interface/widgets/server/user/user_list_widget.cpp
|
src/interface/widgets/server/user/user_list_widget.cpp
|
||||||
|
src/interface/widgets/settings_page/appearance_settings_page.cpp
|
||||||
|
src/interface/widgets/settings_page/deck_editor_settings_page.cpp
|
||||||
|
src/interface/widgets/settings_page/general_settings_page.cpp
|
||||||
|
src/interface/widgets/settings_page/messages_settings_page.cpp
|
||||||
|
src/interface/widgets/settings_page/shortcut_settings_page.cpp
|
||||||
|
src/interface/widgets/settings_page/sound_settings_page.cpp
|
||||||
|
src/interface/widgets/settings_page/storage_settings_page.cpp
|
||||||
|
src/interface/widgets/settings_page/user_interface_settings_page.cpp
|
||||||
src/interface/widgets/utility/custom_line_edit.cpp
|
src/interface/widgets/utility/custom_line_edit.cpp
|
||||||
src/interface/widgets/utility/get_text_with_max.cpp
|
src/interface/widgets/utility/get_text_with_max.cpp
|
||||||
src/interface/widgets/utility/sequence_edit.cpp
|
src/interface/widgets/utility/sequence_edit.cpp
|
||||||
|
|
@ -324,6 +347,8 @@ set(cockatrice_SOURCES
|
||||||
src/interface/widgets/tabs/api/edhrec/display/commander/edhrec_commander_api_response_bracket_navigation_widget.h
|
src/interface/widgets/tabs/api/edhrec/display/commander/edhrec_commander_api_response_bracket_navigation_widget.h
|
||||||
src/interface/widgets/tabs/api/edhrec/display/commander/edhrec_commander_api_response_budget_navigation_widget.cpp
|
src/interface/widgets/tabs/api/edhrec/display/commander/edhrec_commander_api_response_budget_navigation_widget.cpp
|
||||||
src/interface/widgets/tabs/api/edhrec/display/commander/edhrec_commander_api_response_budget_navigation_widget.h
|
src/interface/widgets/tabs/api/edhrec/display/commander/edhrec_commander_api_response_budget_navigation_widget.h
|
||||||
|
src/interface/widgets/utility/compact_push_button.cpp
|
||||||
|
src/interface/widgets/utility/compact_push_button.h
|
||||||
)
|
)
|
||||||
|
|
||||||
add_subdirectory(sounds)
|
add_subdirectory(sounds)
|
||||||
|
|
@ -538,6 +563,7 @@ if(WIN32)
|
||||||
DIRECTORY "${CMAKE_BINARY_DIR}/cockatrice/"
|
DIRECTORY "${CMAKE_BINARY_DIR}/cockatrice/"
|
||||||
DESTINATION ./
|
DESTINATION ./
|
||||||
FILES_MATCHING
|
FILES_MATCHING
|
||||||
|
PATTERN "CMakeFiles" EXCLUDE
|
||||||
PATTERN "*.ini"
|
PATTERN "*.ini"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -563,6 +589,9 @@ if(WIN32)
|
||||||
PATTERN "styles/qopensslbackend.dll"
|
PATTERN "styles/qopensslbackend.dll"
|
||||||
PATTERN "styles/qschannelbackend.dll"
|
PATTERN "styles/qschannelbackend.dll"
|
||||||
PATTERN "styles/qwindowsvistastyle.dll"
|
PATTERN "styles/qwindowsvistastyle.dll"
|
||||||
|
PATTERN "styles/qwindows11style.dll"
|
||||||
|
PATTERN "styles/qmodernwindowsstyle.dll"
|
||||||
|
PATTERN "styles/qmodernwindowsstyled.dll"
|
||||||
PATTERN "tls/qcertonlybackend.dll"
|
PATTERN "tls/qcertonlybackend.dll"
|
||||||
PATTERN "tls/qopensslbackend.dll"
|
PATTERN "tls/qopensslbackend.dll"
|
||||||
PATTERN "tls/qschannelbackend.dll"
|
PATTERN "tls/qschannelbackend.dll"
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
<file>resources/icons/dragon.svg</file>
|
<file>resources/icons/dragon.svg</file>
|
||||||
<file>resources/icons/dropdown_collapsed.svg</file>
|
<file>resources/icons/dropdown_collapsed.svg</file>
|
||||||
<file>resources/icons/dropdown_expanded.svg</file>
|
<file>resources/icons/dropdown_expanded.svg</file>
|
||||||
|
<file>resources/icons/filter.svg</file>
|
||||||
<file>resources/icons/floppy_disk.svg</file>
|
<file>resources/icons/floppy_disk.svg</file>
|
||||||
<file>resources/icons/forgot_password.svg</file>
|
<file>resources/icons/forgot_password.svg</file>
|
||||||
<file>resources/icons/gear.svg</file>
|
<file>resources/icons/gear.svg</file>
|
||||||
|
|
@ -54,6 +55,7 @@
|
||||||
<file>resources/icons/view.svg</file>
|
<file>resources/icons/view.svg</file>
|
||||||
|
|
||||||
<file>resources/icons/mana/B.svg</file>
|
<file>resources/icons/mana/B.svg</file>
|
||||||
|
<file>resources/icons/mana/C.svg</file>
|
||||||
<file>resources/icons/mana/G.svg</file>
|
<file>resources/icons/mana/G.svg</file>
|
||||||
<file>resources/icons/mana/R.svg</file>
|
<file>resources/icons/mana/R.svg</file>
|
||||||
<file>resources/icons/mana/U.svg</file>
|
<file>resources/icons/mana/U.svg</file>
|
||||||
|
|
@ -68,6 +70,7 @@
|
||||||
<file>resources/config/interface.svg</file>
|
<file>resources/config/interface.svg</file>
|
||||||
<file>resources/config/messages.svg</file>
|
<file>resources/config/messages.svg</file>
|
||||||
<file>resources/config/deckeditor.svg</file>
|
<file>resources/config/deckeditor.svg</file>
|
||||||
|
<file>resources/config/storage.svg</file>
|
||||||
<file>resources/config/shorcuts.svg</file>
|
<file>resources/config/shorcuts.svg</file>
|
||||||
<file>resources/config/sound.svg</file>
|
<file>resources/config/sound.svg</file>
|
||||||
<file>resources/config/debug.ini</file>
|
<file>resources/config/debug.ini</file>
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -28,6 +28,8 @@
|
||||||
#dlg_tip_of_the_day = true
|
#dlg_tip_of_the_day = true
|
||||||
#dlg_update = true
|
#dlg_update = true
|
||||||
|
|
||||||
|
#general_settings_page = true
|
||||||
|
|
||||||
#settings_cache = true
|
#settings_cache = true
|
||||||
#servers_settings = true
|
#servers_settings = true
|
||||||
#shortcuts_settings = true
|
#shortcuts_settings = true
|
||||||
|
|
|
||||||
799
cockatrice/resources/config/storage.svg
Normal file
799
cockatrice/resources/config/storage.svg
Normal file
|
|
@ -0,0 +1,799 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
width="62.636364"
|
||||||
|
height="62.090908"
|
||||||
|
id="svg2"
|
||||||
|
sodipodi:version="0.32"
|
||||||
|
inkscape:version="1.4.3 (0d15f75042, 2025-12-25)"
|
||||||
|
sodipodi:docname="storage.svg"
|
||||||
|
inkscape:output_extension="org.inkscape.output.svg.inkscape"
|
||||||
|
version="1.0"
|
||||||
|
xml:space="preserve"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"><defs
|
||||||
|
id="defs4"><linearGradient
|
||||||
|
id="linearGradient3169"><stop
|
||||||
|
style="stop-color:#0000ff;stop-opacity:1;"
|
||||||
|
offset="0"
|
||||||
|
id="stop3171" /><stop
|
||||||
|
style="stop-color:#000067;stop-opacity:1;"
|
||||||
|
offset="1"
|
||||||
|
id="stop3173" /></linearGradient><linearGradient
|
||||||
|
id="linearGradient4766"><stop
|
||||||
|
style="stop-color:#784421;stop-opacity:1;"
|
||||||
|
offset="0"
|
||||||
|
id="stop4768" /><stop
|
||||||
|
style="stop-color:#3d2210;stop-opacity:0;"
|
||||||
|
offset="1"
|
||||||
|
id="stop4770" /></linearGradient><linearGradient
|
||||||
|
id="linearGradient4758"><stop
|
||||||
|
style="stop-color:#a05a2c;stop-opacity:1;"
|
||||||
|
offset="0"
|
||||||
|
id="stop4760" /><stop
|
||||||
|
style="stop-color:#3d2210;stop-opacity:1;"
|
||||||
|
offset="1"
|
||||||
|
id="stop4762" /></linearGradient><inkscape:perspective
|
||||||
|
sodipodi:type="inkscape:persp3d"
|
||||||
|
inkscape:vp_x="0 : 526.18109 : 1"
|
||||||
|
inkscape:vp_y="0 : 1000 : 0"
|
||||||
|
inkscape:vp_z="744.09448 : 526.18109 : 1"
|
||||||
|
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
|
||||||
|
id="perspective10" /><inkscape:perspective
|
||||||
|
id="perspective2484"
|
||||||
|
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
|
||||||
|
inkscape:vp_z="744.09448 : 526.18109 : 1"
|
||||||
|
inkscape:vp_y="0 : 1000 : 0"
|
||||||
|
inkscape:vp_x="0 : 526.18109 : 1"
|
||||||
|
sodipodi:type="inkscape:persp3d" /><linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient4758"
|
||||||
|
id="linearGradient4764"
|
||||||
|
x1="466.09601"
|
||||||
|
y1="485.96021"
|
||||||
|
x2="715.14801"
|
||||||
|
y2="485.96021"
|
||||||
|
gradientUnits="userSpaceOnUse" /><linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient4766"
|
||||||
|
id="linearGradient4772"
|
||||||
|
x1="496.548"
|
||||||
|
y1="485.26816"
|
||||||
|
x2="683.31201"
|
||||||
|
y2="485.26816"
|
||||||
|
gradientUnits="userSpaceOnUse" /><radialGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient3169"
|
||||||
|
id="radialGradient3175"
|
||||||
|
cx="120.07376"
|
||||||
|
cy="56.138123"
|
||||||
|
fx="120.07376"
|
||||||
|
fy="56.138123"
|
||||||
|
r="82.790039"
|
||||||
|
gradientTransform="matrix(1,0,0,0.2116376,0,44.257186)"
|
||||||
|
gradientUnits="userSpaceOnUse" /><linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient6482"
|
||||||
|
id="linearGradient6488"
|
||||||
|
x1="32.18182"
|
||||||
|
y1="3.2835093"
|
||||||
|
x2="32.18182"
|
||||||
|
y2="13.02554"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
gradientTransform="matrix(1.0281354,0,0,1.0429299,85.21874,131.0326)" /><linearGradient
|
||||||
|
id="linearGradient6482"><stop
|
||||||
|
style="stop-color:#ffffff;stop-opacity:1;"
|
||||||
|
offset="0"
|
||||||
|
id="stop6484" /><stop
|
||||||
|
style="stop-color:#00ff00;stop-opacity:0;"
|
||||||
|
offset="1"
|
||||||
|
id="stop6486" /></linearGradient><linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient6464"
|
||||||
|
id="linearGradient6470"
|
||||||
|
x1="32.090908"
|
||||||
|
y1="1.8181819"
|
||||||
|
x2="31.09091"
|
||||||
|
y2="62.909088"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
gradientTransform="translate(0,-0.1818182)" /><linearGradient
|
||||||
|
id="linearGradient6464"><stop
|
||||||
|
style="stop-color:#0061ff;stop-opacity:1;"
|
||||||
|
offset="0"
|
||||||
|
id="stop6466" /><stop
|
||||||
|
style="stop-color:#001c4c;stop-opacity:1;"
|
||||||
|
offset="1"
|
||||||
|
id="stop6468" /></linearGradient><linearGradient
|
||||||
|
y2="62.909088"
|
||||||
|
x2="31.09091"
|
||||||
|
y1="1.8181819"
|
||||||
|
x1="32.090908"
|
||||||
|
gradientTransform="translate(86.2151,131.5372)"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
id="linearGradient4477"
|
||||||
|
xlink:href="#linearGradient6464"
|
||||||
|
inkscape:collect="always" /><linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
id="linearGradient2916"><stop
|
||||||
|
style="stop-color:white;stop-opacity:1;"
|
||||||
|
offset="0"
|
||||||
|
id="stop2918" /><stop
|
||||||
|
style="stop-color:white;stop-opacity:0;"
|
||||||
|
offset="1"
|
||||||
|
id="stop2920" /></linearGradient><linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
id="linearGradient2902"><stop
|
||||||
|
style="stop-color:black;stop-opacity:1;"
|
||||||
|
offset="0"
|
||||||
|
id="stop2905" /><stop
|
||||||
|
style="stop-color:black;stop-opacity:0;"
|
||||||
|
offset="1"
|
||||||
|
id="stop2907" /></linearGradient><linearGradient
|
||||||
|
id="linearGradient2064"><stop
|
||||||
|
id="stop2066"
|
||||||
|
offset="0"
|
||||||
|
style="stop-color:white;stop-opacity:1;" /><stop
|
||||||
|
style="stop-color:#555753;stop-opacity:0.60000002;"
|
||||||
|
offset="0.5"
|
||||||
|
id="stop2070" /><stop
|
||||||
|
id="stop2068"
|
||||||
|
offset="1"
|
||||||
|
style="stop-color:#555753;stop-opacity:0;" /></linearGradient><linearGradient
|
||||||
|
id="linearGradient9641"><stop
|
||||||
|
style="stop-color:white;stop-opacity:1"
|
||||||
|
offset="0"
|
||||||
|
id="stop9643" /><stop
|
||||||
|
style="stop-color:#888a85;stop-opacity:1"
|
||||||
|
offset="1"
|
||||||
|
id="stop9645" /></linearGradient><linearGradient
|
||||||
|
id="linearGradient9633"><stop
|
||||||
|
style="stop-color:#eeeeec;stop-opacity:1"
|
||||||
|
offset="0"
|
||||||
|
id="stop9635" /><stop
|
||||||
|
style="stop-color:#888a85;stop-opacity:1"
|
||||||
|
offset="1"
|
||||||
|
id="stop9639" /></linearGradient><linearGradient
|
||||||
|
id="linearGradient9613"><stop
|
||||||
|
style="stop-color:white;stop-opacity:1"
|
||||||
|
offset="0"
|
||||||
|
id="stop9615" /><stop
|
||||||
|
id="stop9619"
|
||||||
|
offset="0.5"
|
||||||
|
style="stop-color:white;stop-opacity:1;" /><stop
|
||||||
|
style="stop-color:#cccfca;stop-opacity:1"
|
||||||
|
offset="1"
|
||||||
|
id="stop9617" /></linearGradient><linearGradient
|
||||||
|
id="linearGradient8710"><stop
|
||||||
|
style="stop-color:black;stop-opacity:1;"
|
||||||
|
offset="0"
|
||||||
|
id="stop8712" /><stop
|
||||||
|
style="stop-color:white;stop-opacity:1;"
|
||||||
|
offset="1"
|
||||||
|
id="stop8714" /></linearGradient><linearGradient
|
||||||
|
id="linearGradient8631"><stop
|
||||||
|
id="stop8633"
|
||||||
|
offset="0"
|
||||||
|
style="stop-color:#eeeeec;stop-opacity:1" /><stop
|
||||||
|
style="stop-color:#eeeeec;stop-opacity:1;"
|
||||||
|
offset="0.2"
|
||||||
|
id="stop8637" /><stop
|
||||||
|
id="stop8635"
|
||||||
|
offset="1"
|
||||||
|
style="stop-color:#babdb6;stop-opacity:1" /></linearGradient><linearGradient
|
||||||
|
id="linearGradient8625"><stop
|
||||||
|
id="stop8627"
|
||||||
|
offset="0"
|
||||||
|
style="stop-color:white;stop-opacity:1" /><stop
|
||||||
|
id="stop8629"
|
||||||
|
offset="1"
|
||||||
|
style="stop-color:#babdb6;stop-opacity:1" /></linearGradient><linearGradient
|
||||||
|
id="linearGradient8613"><stop
|
||||||
|
style="stop-color:#babdb6;stop-opacity:1"
|
||||||
|
offset="0"
|
||||||
|
id="stop8615" /><stop
|
||||||
|
style="stop-color:#2e3436;stop-opacity:1"
|
||||||
|
offset="1"
|
||||||
|
id="stop8617" /></linearGradient><linearGradient
|
||||||
|
id="linearGradient5740"><stop
|
||||||
|
style="stop-color:#d0d0cb;stop-opacity:1;"
|
||||||
|
offset="0"
|
||||||
|
id="stop5742" /><stop
|
||||||
|
style="stop-color:#babdb6;stop-opacity:1"
|
||||||
|
offset="1"
|
||||||
|
id="stop5744" /></linearGradient><linearGradient
|
||||||
|
id="linearGradient5690"><stop
|
||||||
|
style="stop-color:white;stop-opacity:1;"
|
||||||
|
offset="0"
|
||||||
|
id="stop5692" /><stop
|
||||||
|
style="stop-color:#888a85;stop-opacity:0.59848487"
|
||||||
|
offset="1"
|
||||||
|
id="stop5694" /></linearGradient><linearGradient
|
||||||
|
id="linearGradient2899"><stop
|
||||||
|
id="stop2901"
|
||||||
|
offset="0"
|
||||||
|
style="stop-color:#555753;stop-opacity:1" /><stop
|
||||||
|
id="stop2903"
|
||||||
|
offset="1"
|
||||||
|
style="stop-color:#2e3436;stop-opacity:1" /></linearGradient><linearGradient
|
||||||
|
id="linearGradient3468"><stop
|
||||||
|
style="stop-color:#fdfdfc;stop-opacity:1"
|
||||||
|
offset="0"
|
||||||
|
id="stop3470" /><stop
|
||||||
|
style="stop-color:white;stop-opacity:0.37121212"
|
||||||
|
offset="1"
|
||||||
|
id="stop3472" /></linearGradient><linearGradient
|
||||||
|
id="linearGradient2909"><stop
|
||||||
|
style="stop-color:white;stop-opacity:0;"
|
||||||
|
offset="0"
|
||||||
|
id="stop2911" /><stop
|
||||||
|
id="stop2917"
|
||||||
|
offset="0.5"
|
||||||
|
style="stop-color:white;stop-opacity:1;" /><stop
|
||||||
|
style="stop-color:white;stop-opacity:0;"
|
||||||
|
offset="1"
|
||||||
|
id="stop2913" /></linearGradient><linearGradient
|
||||||
|
id="linearGradient2839"><stop
|
||||||
|
style="stop-color:white;stop-opacity:0.25773194;"
|
||||||
|
offset="0"
|
||||||
|
id="stop2841" /><stop
|
||||||
|
id="stop2847"
|
||||||
|
offset="0.5472973"
|
||||||
|
style="stop-color:white;stop-opacity:1;" /><stop
|
||||||
|
style="stop-color:white;stop-opacity:0.24705882;"
|
||||||
|
offset="0.66243607"
|
||||||
|
id="stop2849" /><stop
|
||||||
|
id="stop2851"
|
||||||
|
offset="0.875"
|
||||||
|
style="stop-color:white;stop-opacity:0.83505154;" /><stop
|
||||||
|
style="stop-color:white;stop-opacity:0;"
|
||||||
|
offset="1"
|
||||||
|
id="stop2843" /></linearGradient><linearGradient
|
||||||
|
id="linearGradient2900"><stop
|
||||||
|
style="stop-color:black;stop-opacity:0;"
|
||||||
|
offset="0"
|
||||||
|
id="stop2902" /><stop
|
||||||
|
id="stop2908"
|
||||||
|
offset="0.5"
|
||||||
|
style="stop-color:black;stop-opacity:1;" /><stop
|
||||||
|
style="stop-color:black;stop-opacity:0;"
|
||||||
|
offset="1"
|
||||||
|
id="stop2904" /></linearGradient><linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient3468"
|
||||||
|
id="linearGradient3474"
|
||||||
|
x1="24.748737"
|
||||||
|
y1="35.354588"
|
||||||
|
x2="24.998737"
|
||||||
|
y2="14.997767"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
gradientTransform="matrix(1,0,0,0.995556,0,-3.931113)" /><radialGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient2902"
|
||||||
|
id="radialGradient4700"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
gradientTransform="matrix(4.095822,0,0,3.101282,-9.53921,-94.5433)"
|
||||||
|
cx="0"
|
||||||
|
cy="17"
|
||||||
|
fx="0"
|
||||||
|
fy="17"
|
||||||
|
r="2" /><radialGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient2902"
|
||||||
|
id="radialGradient4702"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
gradientTransform="matrix(4.095822,0,0,3.101282,38.20996,-10.90025)"
|
||||||
|
cx="0"
|
||||||
|
cy="17"
|
||||||
|
fx="0"
|
||||||
|
fy="17"
|
||||||
|
r="2" /><linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient2900"
|
||||||
|
id="linearGradient4704"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
gradientTransform="matrix(2.047911,0,0,2.067521,1.347566,6.673675)"
|
||||||
|
x1="9.8994951"
|
||||||
|
y1="20"
|
||||||
|
x2="9.8994951"
|
||||||
|
y2="13.979153" /><linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient2909"
|
||||||
|
id="linearGradient4711"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
gradientTransform="matrix(1,0,0,1.42294,10.5,-14.95703)"
|
||||||
|
x1="15.335379"
|
||||||
|
y1="33.06237"
|
||||||
|
x2="20.329321"
|
||||||
|
y2="36.37693" /><linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient2909"
|
||||||
|
id="linearGradient4713"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
gradientTransform="matrix(1,0,0,1.42294,-0.875,-15.04578)"
|
||||||
|
x1="15.335379"
|
||||||
|
y1="33.06237"
|
||||||
|
x2="20.329321"
|
||||||
|
y2="36.37693" /><linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient2909"
|
||||||
|
id="linearGradient4715"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
gradientTransform="matrix(0.459833,0,-0.391165,1.370105,40.62503,-13.29892)"
|
||||||
|
x1="15.335379"
|
||||||
|
y1="33.06237"
|
||||||
|
x2="20.329321"
|
||||||
|
y2="36.37693" /><radialGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient5740"
|
||||||
|
id="radialGradient5748"
|
||||||
|
cx="25.251999"
|
||||||
|
cy="16.47991"
|
||||||
|
fx="25.251999"
|
||||||
|
fy="16.47991"
|
||||||
|
r="21.980215"
|
||||||
|
gradientTransform="matrix(1.032991,-0.596398,0.575121,0.99614,-12.23456,11.55448)"
|
||||||
|
gradientUnits="userSpaceOnUse" /><linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient2064"
|
||||||
|
id="linearGradient5790"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
x1="18.048874"
|
||||||
|
y1="25.461344"
|
||||||
|
x2="22.211937"
|
||||||
|
y2="12.143078"
|
||||||
|
gradientTransform="matrix(0.940224,0,0,0.931632,1.331811,1.401537)" /><linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient8631"
|
||||||
|
id="linearGradient5865"
|
||||||
|
x1="24"
|
||||||
|
y1="36.638382"
|
||||||
|
x2="25.818018"
|
||||||
|
y2="6.8314762"
|
||||||
|
gradientUnits="userSpaceOnUse" /><linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient2839"
|
||||||
|
id="linearGradient7658"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
x1="27.057796"
|
||||||
|
y1="12.669416"
|
||||||
|
x2="32.042896"
|
||||||
|
y2="31.219666" /><linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient5690"
|
||||||
|
id="linearGradient8603"
|
||||||
|
x1="20.304037"
|
||||||
|
y1="24.035707"
|
||||||
|
x2="18.498415"
|
||||||
|
y2="40.647167"
|
||||||
|
gradientUnits="userSpaceOnUse" /><radialGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient8613"
|
||||||
|
id="radialGradient8619"
|
||||||
|
cx="7.5177727"
|
||||||
|
cy="30.573555"
|
||||||
|
fx="7.5177727"
|
||||||
|
fy="30.573555"
|
||||||
|
r="0.53125"
|
||||||
|
gradientTransform="matrix(1.662477,0,0,1.61358,-4.989175,-18.65647)"
|
||||||
|
gradientUnits="userSpaceOnUse" /><radialGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient9613"
|
||||||
|
id="radialGradient8623"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
gradientTransform="matrix(1.389748,0,0,1.348872,-2.91982,-10.63815)"
|
||||||
|
cx="7.5191436"
|
||||||
|
cy="30.304251"
|
||||||
|
fx="7.5191436"
|
||||||
|
fy="30.304251"
|
||||||
|
r="0.53125" /><radialGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient9633"
|
||||||
|
id="radialGradient8664"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
gradientTransform="matrix(1.569487,0,0,1.523325,-4.288627,-15.92107)"
|
||||||
|
cx="7.5336008"
|
||||||
|
cy="30.307562"
|
||||||
|
fx="7.5336008"
|
||||||
|
fy="30.307562"
|
||||||
|
r="0.53125" /><radialGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient8613"
|
||||||
|
id="radialGradient8666"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
gradientTransform="matrix(1.662477,0,0,1.61358,-4.989175,-18.65647)"
|
||||||
|
cx="7.5177727"
|
||||||
|
cy="30.573555"
|
||||||
|
fx="7.5177727"
|
||||||
|
fy="30.573555"
|
||||||
|
r="0.53125" /><radialGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient8625"
|
||||||
|
id="radialGradient8676"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
gradientTransform="matrix(1.662477,0,0,1.61358,-4.989175,-18.65647)"
|
||||||
|
cx="7.4792061"
|
||||||
|
cy="30.36071"
|
||||||
|
fx="7.4792061"
|
||||||
|
fy="30.36071"
|
||||||
|
r="0.53125" /><radialGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient8613"
|
||||||
|
id="radialGradient8678"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
gradientTransform="matrix(1.662477,0,0,1.61358,-4.989175,-18.65647)"
|
||||||
|
cx="7.5177727"
|
||||||
|
cy="30.573555"
|
||||||
|
fx="7.5177727"
|
||||||
|
fy="30.573555"
|
||||||
|
r="0.53125" /><radialGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient9641"
|
||||||
|
id="radialGradient8680"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
gradientTransform="matrix(1.662477,0,0,1.61358,-4.989175,-18.65647)"
|
||||||
|
cx="7.4893188"
|
||||||
|
cy="30.337601"
|
||||||
|
fx="7.4893188"
|
||||||
|
fy="30.337601"
|
||||||
|
r="0.53125" /><radialGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient8613"
|
||||||
|
id="radialGradient8682"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
gradientTransform="matrix(1.662477,0,0,1.61358,-4.989175,-18.65647)"
|
||||||
|
cx="7.5177727"
|
||||||
|
cy="30.573555"
|
||||||
|
fx="7.5177727"
|
||||||
|
fy="30.573555"
|
||||||
|
r="0.53125" /><linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient8710"
|
||||||
|
id="linearGradient8716"
|
||||||
|
x1="40.617188"
|
||||||
|
y1="30.554688"
|
||||||
|
x2="40.710938"
|
||||||
|
y2="30.359375"
|
||||||
|
gradientUnits="userSpaceOnUse" /><linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient8710"
|
||||||
|
id="linearGradient9605"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
x1="40.617188"
|
||||||
|
y1="30.554688"
|
||||||
|
x2="40.710938"
|
||||||
|
y2="30.359375"
|
||||||
|
gradientTransform="matrix(0.602867,-0.797841,0.797841,0.602867,-41.12611,44.62773)" /><linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient8710"
|
||||||
|
id="linearGradient9649"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
x1="40.617188"
|
||||||
|
y1="30.554688"
|
||||||
|
x2="40.710938"
|
||||||
|
y2="30.359375"
|
||||||
|
gradientTransform="rotate(-30.000012,-5.5813167,76.089146)" /><linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient8710"
|
||||||
|
id="linearGradient9654"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
x1="40.617188"
|
||||||
|
y1="30.554688"
|
||||||
|
x2="40.710938"
|
||||||
|
y2="30.359375"
|
||||||
|
gradientTransform="matrix(0.707107,0.527555,-0.707107,0.527555,29.0058,-24.09196)" /><linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient2916"
|
||||||
|
id="linearGradient2973"
|
||||||
|
x1="12.5"
|
||||||
|
y1="43.1875"
|
||||||
|
x2="12.5"
|
||||||
|
y2="34.045513"
|
||||||
|
gradientUnits="userSpaceOnUse" /><linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient2899"
|
||||||
|
id="linearGradient5655"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
x1="53.812813"
|
||||||
|
y1="43.573235"
|
||||||
|
x2="-2.8138931"
|
||||||
|
y2="35.500015"
|
||||||
|
gradientTransform="translate(0,50)" /><linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient2902"
|
||||||
|
id="linearGradient2992"
|
||||||
|
x1="21.9375"
|
||||||
|
y1="39"
|
||||||
|
x2="21.9375"
|
||||||
|
y2="37.995617"
|
||||||
|
gradientUnits="userSpaceOnUse" /><linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient2902"
|
||||||
|
id="linearGradient2910"
|
||||||
|
x1="22.101398"
|
||||||
|
y1="27.658131"
|
||||||
|
x2="22.971142"
|
||||||
|
y2="20.903238"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
gradientTransform="translate(0,2)" /><linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient2916"
|
||||||
|
id="linearGradient2922"
|
||||||
|
x1="24.847851"
|
||||||
|
y1="28.908398"
|
||||||
|
x2="24.847851"
|
||||||
|
y2="25.757175"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
gradientTransform="translate(0,2)" /></defs><sodipodi:namedview
|
||||||
|
id="base"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1.0"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:zoom="5.8830488"
|
||||||
|
inkscape:cx="-3.9945275"
|
||||||
|
inkscape:cy="-14.363301"
|
||||||
|
inkscape:document-units="px"
|
||||||
|
inkscape:current-layer="layer1"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:window-width="2560"
|
||||||
|
inkscape:window-height="1408"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="32"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
fit-margin-top="0"
|
||||||
|
fit-margin-left="0"
|
||||||
|
fit-margin-right="0"
|
||||||
|
fit-margin-bottom="0"
|
||||||
|
inkscape:showpageshadow="0"
|
||||||
|
inkscape:pagecheckerboard="0"
|
||||||
|
inkscape:deskcolor="#505050" /><metadata
|
||||||
|
id="metadata7"><rdf:RDF><cc:Work
|
||||||
|
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><g
|
||||||
|
inkscape:label="Ebene 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1"
|
||||||
|
transform="translate(-86.987816,-132.85536)"><rect
|
||||||
|
style="fill:url(#linearGradient4477);fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-opacity:1"
|
||||||
|
id="rect6462"
|
||||||
|
width="61.636364"
|
||||||
|
height="61.090908"
|
||||||
|
x="87.487816"
|
||||||
|
y="133.35536"
|
||||||
|
ry="5.6363635" /><rect
|
||||||
|
style="fill:url(#linearGradient6488);fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||||
|
id="rect6472"
|
||||||
|
width="59.796619"
|
||||||
|
height="13.251164"
|
||||||
|
x="88.407707"
|
||||||
|
y="134.45705"
|
||||||
|
ry="4.7325583" /><g
|
||||||
|
inkscape:label="Livello 1"
|
||||||
|
id="layer1-3"
|
||||||
|
style="display:inline"
|
||||||
|
transform="matrix(1.1537183,0,0,1.1537183,91.003924,136.40297)"><g
|
||||||
|
id="g3519"
|
||||||
|
style="opacity:0.7"
|
||||||
|
transform="matrix(1.030831,0,0,1.151147,-0.73609,-12.57431)"
|
||||||
|
inkscape:export-filename="/home/lapo/Desktop/uhm.png"
|
||||||
|
inkscape:export-xdpi="90"
|
||||||
|
inkscape:export-ydpi="90"><rect
|
||||||
|
transform="scale(-1)"
|
||||||
|
y="-48.024086"
|
||||||
|
x="-9.5392103"
|
||||||
|
height="12.405126"
|
||||||
|
width="8.1916437"
|
||||||
|
id="rect2884"
|
||||||
|
style="opacity:1;fill:url(#radialGradient4700);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /><rect
|
||||||
|
y="35.618961"
|
||||||
|
x="38.209965"
|
||||||
|
height="12.405126"
|
||||||
|
width="8.1916437"
|
||||||
|
id="rect2894"
|
||||||
|
style="opacity:1;fill:url(#radialGradient4702);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /><rect
|
||||||
|
y="35.618961"
|
||||||
|
x="9.5392103"
|
||||||
|
height="12.405126"
|
||||||
|
width="28.670753"
|
||||||
|
id="rect2898"
|
||||||
|
style="opacity:1;fill:url(#linearGradient4704);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /></g><g
|
||||||
|
id="g5672"
|
||||||
|
transform="translate(0,-48.99747)"><path
|
||||||
|
sodipodi:nodetypes="ccccccccccccc"
|
||||||
|
id="rect2010"
|
||||||
|
d="M 4.5182287,80.500013 H 43.481768 c 0.564099,0 1.018229,0.45413 1.018229,1.018229 v 2.963543 c 0,1.315584 -0.450231,3.018228 -2.455729,3.018228 L 40.5,87.5 v 1 h -33 v -1 l -1.8567713,1.3e-5 c -1.2712053,0 -2.1432282,-0.884627 -2.1432282,-2.255665 v -3.726106 c 0,-0.564099 0.4541297,-1.018229 1.0182282,-1.018229 z"
|
||||||
|
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:url(#linearGradient5655);fill-opacity:1;fill-rule:nonzero;stroke:#2e3436;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.4;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none" /><path
|
||||||
|
transform="translate(0,50)"
|
||||||
|
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:0.1;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient2973);stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dashoffset:1.4;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none"
|
||||||
|
d="m 4.59375,31.59375 v 3.729743 c 0,0.599619 0.3756505,1.104854 0.8863276,1.104854 H 42.426407 c 0.512469,0 0.979843,-0.507235 0.979843,-1.016466 V 31.59375 Z"
|
||||||
|
id="path2076"
|
||||||
|
sodipodi:nodetypes="ccccccc" /><g
|
||||||
|
transform="translate(0,50)"
|
||||||
|
style="opacity:0.5"
|
||||||
|
id="g4706"><path
|
||||||
|
style="opacity:0.109524;fill:url(#linearGradient4711);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||||
|
d="m 26.144738,32.088747 c 0,0 -1.502602,5.533939 -3.226175,5.911253 0,0 6.231378,-0.125771 6.231378,-0.125771 1.387072,-0.317461 3.358758,-5.785482 3.358758,-5.785482 z"
|
||||||
|
id="path2907"
|
||||||
|
sodipodi:nodetypes="ccccc"
|
||||||
|
inkscape:export-filename="/home/lapo/Desktop/uhm.png"
|
||||||
|
inkscape:export-xdpi="90"
|
||||||
|
inkscape:export-ydpi="90" /><path
|
||||||
|
inkscape:export-ydpi="90"
|
||||||
|
inkscape:export-xdpi="90"
|
||||||
|
inkscape:export-filename="/home/lapo/Desktop/uhm.png"
|
||||||
|
sodipodi:nodetypes="ccccc"
|
||||||
|
id="path2892"
|
||||||
|
d="m 14.769738,32 c 0,0 -1.502602,5.533939 -3.226175,5.911253 0,0 6.231378,-0.125771 6.231378,-0.125771 C 19.162013,37.468021 21.133699,32 21.133699,32 Z"
|
||||||
|
style="opacity:0.109524;fill:url(#linearGradient4713);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /><path
|
||||||
|
inkscape:export-ydpi="90"
|
||||||
|
inkscape:export-xdpi="90"
|
||||||
|
inkscape:export-filename="/home/lapo/Desktop/uhm.png"
|
||||||
|
sodipodi:nodetypes="ccccc"
|
||||||
|
id="path2896"
|
||||||
|
d="m 34.886139,32 c 0,0 -2.212224,5.328458 -3.108503,5.691761 0,0 2.899969,-0.121101 2.899969,-0.121101 C 35.402697,37.264987 37.8125,32 37.8125,32 Z"
|
||||||
|
style="opacity:0.109524;fill:url(#linearGradient4715);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /></g></g><path
|
||||||
|
style="fill:url(#radialGradient5748);fill-opacity:1;stroke:#888a85;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1"
|
||||||
|
d="m 11.693127,10.498788 h 24.572566 c 1.68417,0 2.396517,0.117479 3.040019,2.385005 l 5.074491,17.881119 c 0.501024,1.765471 -1.355848,2.735101 -3.040018,2.735101 H 6.6186312 c -1.868408,0 -3.4893833,-1.181417 -3.0400182,-2.735101 L 8.8290448,12.611497 c 0.5683008,-1.964905 1.1799122,-2.112709 2.8640822,-2.112709 z"
|
||||||
|
id="rect1879"
|
||||||
|
sodipodi:nodetypes="cczzcczzc"
|
||||||
|
inkscape:export-filename="/home/lapo/Desktop/uhm.png"
|
||||||
|
inkscape:export-xdpi="90"
|
||||||
|
inkscape:export-ydpi="90" /><path
|
||||||
|
sodipodi:type="inkscape:offset"
|
||||||
|
inkscape:radius="-0.5"
|
||||||
|
inkscape:original="M 11.6875 10.5 C 10.00333 10.5 9.4120513 10.660095 8.84375 12.625 L 3.59375 30.75 C 3.1443849 32.303684 4.7565918 33.500002 6.625 33.5 L 41.34375 33.5 C 43.02792 33.5 44.876024 32.515471 44.375 30.75 L 39.3125 12.875 C 38.668998 10.607474 37.965419 10.5 36.28125 10.5 L 11.6875 10.5 z "
|
||||||
|
style="display:inline;opacity:0.462406;fill:url(#linearGradient7658);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1"
|
||||||
|
id="path5806"
|
||||||
|
d="m 11.6875,11 c -0.826242,0 -1.28475,0.05742 -1.5625,0.242188 -0.2777497,0.184768 -0.5284825,0.580009 -0.8007812,1.521484 l -5.2500001,18.125 c -0.1708248,0.590628 0.021709,1.039316 0.4902344,1.4375 C 5.0329784,32.724356 5.7975106,33.000001 6.625,33 h 34.71875 c 0.744655,0 1.538941,-0.232575 2.03125,-0.609375 0.492309,-0.3768 0.719298,-0.799984 0.519531,-1.503906 l -5.0625,-17.875 C 38.52278,11.922001 38.224454,11.462814 37.910156,11.253906 37.595859,11.044998 37.112699,11 36.28125,11 Z" /><ellipse
|
||||||
|
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;fill:url(#radialGradient8623);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.4;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none"
|
||||||
|
id="path8621"
|
||||||
|
transform="matrix(-2.628602,0,0,1.777765,27.79309,-23.77739)"
|
||||||
|
cx="7.625"
|
||||||
|
cy="30.578125"
|
||||||
|
rx="0.53125"
|
||||||
|
ry="0.515625" /><path
|
||||||
|
style="fill:none;fill-opacity:1;stroke:url(#linearGradient5790);stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
|
||||||
|
d="m 16.110953,12.552805 c -0.573581,0 -1.02837,0.431821 -1.02837,0.989859 l -0.940223,3.230801 c -2.859962,1.276514 -4.6423552,3.099073 -4.6423552,5.123976 0,3.856957 6.4790242,6.987239 14.4853222,6.98724 8.006296,0 14.514705,-3.130284 14.514704,-6.98724 0,-2.039034 -1.835591,-3.875388 -4.730501,-5.153089 l -0.940224,-3.201688 c 0,-0.558038 -0.454788,-0.989859 -1.02837,-0.989859 z"
|
||||||
|
id="path2784"
|
||||||
|
sodipodi:nodetypes="cccssscccc" /><path
|
||||||
|
style="display:inline;fill:none;fill-opacity:1;stroke:url(#linearGradient3474);stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1"
|
||||||
|
d="m 11.6875,11.500005 c -0.803124,0 -1.097168,0.07051 -1.21875,0.155556 -0.121582,0.08504 -0.357707,0.40212 -0.6875,1.306667 l -5.25,18.137786 c -0.1337204,0.366765 -0.054827,0.533865 0.3125,0.84 0.3673267,0.306136 1.066693,0.56 1.78125,0.560001 h 34.71875 c 0.639793,0 1.393345,-0.237954 1.78125,-0.52889 0.387905,-0.290935 0.488311,-0.382809 0.3125,-0.871111 L 38.375,13.242228 c -0.377206,-1.04766 -0.68208,-1.439297 -0.84375,-1.555556 -0.16167,-0.116259 -0.443711,-0.186667 -1.25,-0.186667 z"
|
||||||
|
id="path3394"
|
||||||
|
sodipodi:nodetypes="csccsccsccscc" /><g
|
||||||
|
id="g5657"
|
||||||
|
transform="translate(7,-1)"
|
||||||
|
style="opacity:0.302857"><rect
|
||||||
|
ry="0.74712253"
|
||||||
|
rx="0.75130093"
|
||||||
|
y="35.500008"
|
||||||
|
x="18.499996"
|
||||||
|
height="1.9999924"
|
||||||
|
width="14.000004"
|
||||||
|
id="rect5641"
|
||||||
|
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#eeeeec;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.4;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none" /><rect
|
||||||
|
y="36"
|
||||||
|
x="19"
|
||||||
|
height="1"
|
||||||
|
width="1"
|
||||||
|
id="rect5645"
|
||||||
|
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.4;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none" /><rect
|
||||||
|
y="36"
|
||||||
|
x="22"
|
||||||
|
height="1"
|
||||||
|
width="1"
|
||||||
|
id="rect5647"
|
||||||
|
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.4;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none" /><rect
|
||||||
|
y="36"
|
||||||
|
x="24"
|
||||||
|
height="1"
|
||||||
|
width="1"
|
||||||
|
id="rect5649"
|
||||||
|
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.4;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none" /><rect
|
||||||
|
y="36"
|
||||||
|
x="26"
|
||||||
|
height="1"
|
||||||
|
width="1"
|
||||||
|
id="rect5651"
|
||||||
|
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.4;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none" /><rect
|
||||||
|
y="36"
|
||||||
|
x="29"
|
||||||
|
height="1"
|
||||||
|
width="2"
|
||||||
|
id="rect5653"
|
||||||
|
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.4;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none" /></g><path
|
||||||
|
sodipodi:type="inkscape:offset"
|
||||||
|
inkscape:radius="-0.44194174"
|
||||||
|
inkscape:original="M 16.125 12.5625 C 15.55142 12.5625 15.09375 12.973212 15.09375 13.53125 L 14.15625 16.78125 C 11.296288 18.057765 9.5 19.881347 9.5 21.90625 C 9.5 25.763206 15.993702 28.874999 24 28.875 C 32.006296 28.874999 38.500001 25.763206 38.5 21.90625 C 38.5 19.867215 36.67616 18.027701 33.78125 16.75 L 32.84375 13.53125 C 32.843748 12.973212 32.386082 12.5625 31.8125 12.5625 L 16.125 12.5625 z "
|
||||||
|
style="display:inline;fill:url(#linearGradient5865);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
|
||||||
|
id="path5857"
|
||||||
|
d="m 16.125,13.003906 c -0.362612,0 -0.589844,0.210942 -0.589844,0.527344 a 0.44198593,0.44198593 0 0 1 -0.01758,0.123047 l -0.9375,3.25 a 0.44198593,0.44198593 0 0 1 -0.24414,0.28125 c -1.389903,0.620369 -2.504368,1.368471 -3.25586,2.177734 -0.751491,0.809263 -1.1386718,1.661199 -1.1386717,2.542969 0,1.680455 1.4530107,3.311153 3.9980467,4.533203 2.545037,1.22205 6.114654,1.99414 10.060547,1.994141 3.945892,-1e-6 7.51551,-0.772091 10.060547,-1.994141 2.545037,-1.22205 3.998047,-2.852748 3.998047,-4.533203 0,-0.887751 -0.391823,-1.747213 -1.154297,-2.5625 -0.762474,-0.815287 -1.893636,-1.568394 -3.300781,-2.189453 a 0.44198593,0.44198593 0 0 1 -0.246094,-0.28125 l -0.9375,-3.21875 a 0.44198593,0.44198593 0 0 1 -0.01758,-0.123047 c -10e-7,-0.316404 -0.22723,-0.527344 -0.589844,-0.527344 z" /><ellipse
|
||||||
|
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:0.9;fill:#000000;fill-opacity:0.0530303;fill-rule:nonzero;stroke:url(#linearGradient8603);stroke-width:2.52015;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.4;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none"
|
||||||
|
id="path8595"
|
||||||
|
transform="matrix(0.449978,0,0,0.349909,16.36363,12.21469)"
|
||||||
|
cx="16.970562"
|
||||||
|
cy="25.107418"
|
||||||
|
rx="7.7781744"
|
||||||
|
ry="4.2868347" /><ellipse
|
||||||
|
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;fill:url(#radialGradient8619);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.4;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none"
|
||||||
|
id="path8611"
|
||||||
|
transform="matrix(1.411772,0,0,0.969697,-3.014767,0.848485)"
|
||||||
|
cx="7.625"
|
||||||
|
cy="30.578125"
|
||||||
|
rx="0.53125"
|
||||||
|
ry="0.515625" /><ellipse
|
||||||
|
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;fill:url(#radialGradient8664);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.462594;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.4;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none"
|
||||||
|
id="path8660"
|
||||||
|
transform="matrix(-2.628602,0,0,1.777765,60.79309,-23.77739)"
|
||||||
|
cx="7.625"
|
||||||
|
cy="30.578125"
|
||||||
|
rx="0.53125"
|
||||||
|
ry="0.515625" /><ellipse
|
||||||
|
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;fill:url(#radialGradient8666);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.4;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none"
|
||||||
|
id="path8662"
|
||||||
|
transform="matrix(1.411772,0,0,0.969697,29.98523,0.848485)"
|
||||||
|
cx="7.625"
|
||||||
|
cy="30.578125"
|
||||||
|
rx="0.53125"
|
||||||
|
ry="0.515625" /><ellipse
|
||||||
|
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;fill:url(#radialGradient8676);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.4;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none"
|
||||||
|
id="path8668"
|
||||||
|
transform="matrix(-2.628602,0,0,1.777765,31.79309,-40.77739)"
|
||||||
|
cx="7.625"
|
||||||
|
cy="30.578125"
|
||||||
|
rx="0.53125"
|
||||||
|
ry="0.515625" /><ellipse
|
||||||
|
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;fill:url(#radialGradient8678);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.4;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none"
|
||||||
|
id="path8670"
|
||||||
|
transform="matrix(1.411772,0,0,0.969697,0.985233,-16.15152)"
|
||||||
|
cx="7.625"
|
||||||
|
cy="30.578125"
|
||||||
|
rx="0.53125"
|
||||||
|
ry="0.515625" /><ellipse
|
||||||
|
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;fill:url(#radialGradient8680);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.4;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none"
|
||||||
|
id="path8672"
|
||||||
|
transform="matrix(-2.628602,0,0,1.777765,56.3029,-40.77739)"
|
||||||
|
cx="7.625"
|
||||||
|
cy="30.578125"
|
||||||
|
rx="0.53125"
|
||||||
|
ry="0.515625" /><ellipse
|
||||||
|
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;fill:url(#radialGradient8682);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.4;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none"
|
||||||
|
id="path8674"
|
||||||
|
transform="matrix(1.411772,0,0,0.969697,25.49504,-16.15152)"
|
||||||
|
cx="7.625"
|
||||||
|
cy="30.578125"
|
||||||
|
rx="0.53125"
|
||||||
|
ry="0.515625" /><path
|
||||||
|
style="opacity:0.4;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient8716);stroke-width:0.3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 40.328109,30.261401 0.874999,0.430332"
|
||||||
|
id="path8700" /><path
|
||||||
|
style="display:inline;opacity:0.4;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient9605);stroke-width:0.3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="M 7.330186,30.695906 8.201031,30.257228"
|
||||||
|
id="path9603" /><path
|
||||||
|
style="display:inline;opacity:0.4;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient9649);stroke-width:0.3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 11.263531,13.446473 0.972937,-0.06482"
|
||||||
|
id="path9647" /><path
|
||||||
|
style="display:inline;opacity:0.4;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient9654);stroke-width:0.3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 36.124038,13.147874 0.314427,0.688634"
|
||||||
|
id="path9652" /><rect
|
||||||
|
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:0.12;fill:url(#linearGradient2992);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.681836;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none"
|
||||||
|
id="rect2984"
|
||||||
|
width="32.03125"
|
||||||
|
height="1"
|
||||||
|
x="8"
|
||||||
|
y="38" /><path
|
||||||
|
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:0.12;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient2910);stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none"
|
||||||
|
d="M 10.460155,15.082355 6.8513979,27.675762 C 8.2982685,28.375511 10.625,29.167061 10.429825,31.533131 H 37.299883 C 37.869398,29.640915 39.875,28.375 41.34614,28.25 L 37.498106,15.082355 32.350135,12.523347 H 14.318912 Z"
|
||||||
|
id="path1997"
|
||||||
|
sodipodi:nodetypes="ccccccccc" /><path
|
||||||
|
sodipodi:nodetypes="ccccc"
|
||||||
|
id="path2912"
|
||||||
|
d="m 7.9763979,27.050762 c 1.4468706,0.699749 3.1789321,1.433241 3.4256991,3.357369 H 36.857941 C 37.427456,28.515915 38.875,27.5 40.34614,27.375 Z"
|
||||||
|
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:0.834286;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient2922);stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none" /></g></g></svg>
|
||||||
|
After Width: | Height: | Size: 40 KiB |
|
|
@ -47,6 +47,6 @@ searches are case insensitive.
|
||||||
<dd>[t:aggro OR o:control](#t:aggro OR o:control) <small>(Any deck filename that contains either aggro or control)</small></dd>
|
<dd>[t:aggro OR o:control](#t:aggro OR o:control) <small>(Any deck filename that contains either aggro or control)</small></dd>
|
||||||
|
|
||||||
<dt>Grouping:</dt>
|
<dt>Grouping:</dt>
|
||||||
<dd><a href="#red -([[]]:100 or aggro)">red -([[]]:100 or aggro)</a> <small>(Any deck that has red in its filename but is not 100 cards or has aggro in its filename)</small></dd>
|
<dd><a href="#red -([[]]:100 OR aggro)">red -([[]]:100 OR aggro)</a> <small>(Any deck that has red in its filename but is not 100 cards or has aggro in its filename)</small></dd>
|
||||||
|
|
||||||
</dl>
|
</dl>
|
||||||
|
|
@ -51,16 +51,16 @@ In this list of examples below, each entry has an explanation and can be clicked
|
||||||
|
|
||||||
<dt><u>E</u>dition:</dt>
|
<dt><u>E</u>dition:</dt>
|
||||||
<dd>[set:lea](#set:lea) <small>(Cards that appear in Alpha, which has the set code LEA)</small></dd>
|
<dd>[set:lea](#set:lea) <small>(Cards that appear in Alpha, which has the set code LEA)</small></dd>
|
||||||
<dd>[e:lea or e:leb](#e:lea or e:leb) <small>(Cards that appear in Alpha or Beta)</small></dd>
|
<dd>[e:lea OR e:leb](#e:lea OR e:leb) <small>(Cards that appear in Alpha or Beta)</small></dd>
|
||||||
|
|
||||||
<dt>Negate:</dt>
|
<dt>Negate:</dt>
|
||||||
<dd>[c:wu -c:m](#c:wu -c:m) <small>(Any card that is white or blue, but not multicolored)</small></dd>
|
<dd>[c:wu -c:m](#c:wu -c:m) <small>(Any card that is white or blue, but not multicolored)</small></dd>
|
||||||
|
|
||||||
<dt>Branching:</dt>
|
<dt>Branching:</dt>
|
||||||
<dd>[t:sliver or o:changeling](#t:sliver or o:changeling) <small>(Any card that is either a sliver or has changeling)</small></dd>
|
<dd>[t:sliver OR o:changeling](#t:sliver OR o:changeling) <small>(Any card that is either a sliver or has changeling)</small></dd>
|
||||||
|
|
||||||
<dt>Grouping:</dt>
|
<dt>Grouping:</dt>
|
||||||
<dd><a href="#t:angel -(angel or c:w)">t:angel -(angel or c:w)</a> <small>(Any angel that doesn't have angel in its name and isn't white)</small></dd>
|
<dd><a href="#t:angel -(angel OR c:w)">t:angel -(angel OR c:w)</a> <small>(Any angel that doesn't have angel in its name and isn't white)</small></dd>
|
||||||
|
|
||||||
<dt>Regular Expression:</dt>
|
<dt>Regular Expression:</dt>
|
||||||
<dd>[/^fell/](#/^fell/) <small>(Any card name that begins with "fell")</small></dd>
|
<dd>[/^fell/](#/^fell/) <small>(Any card name that begins with "fell")</small></dd>
|
||||||
|
|
|
||||||
12
cockatrice/resources/icons/filter.svg
Normal file
12
cockatrice/resources/icons/filter.svg
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
|
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||||
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||||
|
<svg fill="#000000" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="800px" height="800px" viewBox="0 0 971.986 971.986"
|
||||||
|
xml:space="preserve">
|
||||||
|
<g>
|
||||||
|
<path d="M370.216,459.3c10.2,11.1,15.8,25.6,15.8,40.6v442c0,26.601,32.1,40.101,51.1,21.4l123.3-141.3
|
||||||
|
c16.5-19.8,25.6-29.601,25.6-49.2V500c0-15,5.7-29.5,15.8-40.601L955.615,75.5c26.5-28.8,6.101-75.5-33.1-75.5h-873
|
||||||
|
c-39.2,0-59.7,46.6-33.1,75.5L370.216,459.3z"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 676 B |
72
cockatrice/resources/icons/mana/C.svg
Normal file
72
cockatrice/resources/icons/mana/C.svg
Normal file
|
|
@ -0,0 +1,72 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
width="169.33115mm"
|
||||||
|
height="169.59981mm"
|
||||||
|
viewBox="0 0 169.33115 169.59981"
|
||||||
|
version="1.1"
|
||||||
|
id="svg1"
|
||||||
|
inkscape:export-filename="C.svg"
|
||||||
|
inkscape:export-xdpi="96.000015"
|
||||||
|
inkscape:export-ydpi="96.000015"
|
||||||
|
inkscape:version="1.4.3 (0d15f75042, 2025-12-25)"
|
||||||
|
sodipodi:docname="colorless.svg"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg">
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="namedview1"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#000000"
|
||||||
|
borderopacity="0.25"
|
||||||
|
inkscape:showpageshadow="2"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pagecheckerboard="0"
|
||||||
|
inkscape:deskcolor="#d1d1d1"
|
||||||
|
inkscape:document-units="mm"
|
||||||
|
inkscape:zoom="0.71535494"
|
||||||
|
inkscape:cx="397.00572"
|
||||||
|
inkscape:cy="536.09751"
|
||||||
|
inkscape:window-width="1853"
|
||||||
|
inkscape:window-height="1011"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="0"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="layer1">
|
||||||
|
<inkscape:page
|
||||||
|
x="0"
|
||||||
|
y="0"
|
||||||
|
width="169.33115"
|
||||||
|
height="169.59981"
|
||||||
|
id="page2"
|
||||||
|
margin="0"
|
||||||
|
bleed="0" />
|
||||||
|
</sodipodi:namedview>
|
||||||
|
<defs
|
||||||
|
id="defs1" />
|
||||||
|
<g
|
||||||
|
inkscape:label="Layer 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1"
|
||||||
|
transform="translate(-20.334425,-63.700102)">
|
||||||
|
<ellipse
|
||||||
|
style="fill:#cccccc;stroke:#000000;stroke-width:0.165333;stroke-linecap:round"
|
||||||
|
id="path1"
|
||||||
|
cx="-30.617094"
|
||||||
|
cy="179.22736"
|
||||||
|
transform="matrix(0.70654605,-0.70766707,0.70654608,0.70766704,0,0)"
|
||||||
|
rx="84.650612"
|
||||||
|
ry="84.65062" />
|
||||||
|
<rect
|
||||||
|
style="fill:none;stroke:#000000;stroke-width:14.5003;stroke-linecap:round;stroke-linejoin:bevel;stroke-dasharray:none"
|
||||||
|
id="rect1"
|
||||||
|
width="84.683701"
|
||||||
|
height="84.683769"
|
||||||
|
x="-221.60611"
|
||||||
|
y="-73.174698"
|
||||||
|
ry="0.084683768"
|
||||||
|
transform="matrix(-0.7073973,-0.70681615,0.7073973,-0.70681615,0,0)" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 2.2 KiB |
|
|
@ -0,0 +1,587 @@
|
||||||
|
#include "remote_connection_controller.h"
|
||||||
|
|
||||||
|
#include "../../settings/cache_settings.h"
|
||||||
|
#include "../interface/widgets/dialogs/dlg_connect.h"
|
||||||
|
#include "../interface/widgets/dialogs/dlg_forgot_password_challenge.h"
|
||||||
|
#include "../interface/widgets/dialogs/dlg_forgot_password_request.h"
|
||||||
|
#include "../interface/widgets/dialogs/dlg_forgot_password_reset.h"
|
||||||
|
#include "../interface/widgets/dialogs/dlg_register.h"
|
||||||
|
#include "../interface/widgets/utility/get_text_with_max.h"
|
||||||
|
|
||||||
|
#include <QDateTime>
|
||||||
|
#include <QLineEdit>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QThread>
|
||||||
|
#include <libcockatrice/network/client/remote/remote_client.h>
|
||||||
|
#include <libcockatrice/protocol/pb/response.pb.h>
|
||||||
|
|
||||||
|
ConnectionController::ConnectionController(QWidget *dialogParent, QObject *parent)
|
||||||
|
: QObject(parent), dialogParent(dialogParent)
|
||||||
|
{
|
||||||
|
remoteClient = new RemoteClient(nullptr, &SettingsCache::instance());
|
||||||
|
|
||||||
|
clientThread = new QThread(this);
|
||||||
|
remoteClient->moveToThread(clientThread);
|
||||||
|
clientThread->start();
|
||||||
|
|
||||||
|
wireClientSignals();
|
||||||
|
}
|
||||||
|
|
||||||
|
ConnectionController::~ConnectionController()
|
||||||
|
{
|
||||||
|
remoteClient->deleteLater();
|
||||||
|
clientThread->wait();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConnectionController::wireClientSignals()
|
||||||
|
{
|
||||||
|
connect(remoteClient, &RemoteClient::connectionClosedEventReceived, this,
|
||||||
|
&ConnectionController::onConnectionClosedEvent);
|
||||||
|
|
||||||
|
connect(remoteClient, &RemoteClient::serverShutdownEventReceived, this,
|
||||||
|
&ConnectionController::onServerShutdownEvent);
|
||||||
|
|
||||||
|
connect(remoteClient, &RemoteClient::statusChanged, this, &ConnectionController::onStatusChanged);
|
||||||
|
|
||||||
|
connect(remoteClient, &RemoteClient::userInfoChanged, this, &ConnectionController::onUserInfoReceived,
|
||||||
|
Qt::BlockingQueuedConnection);
|
||||||
|
|
||||||
|
connect(remoteClient, &RemoteClient::loginError, this,
|
||||||
|
[this](Response::ResponseCode r, QString rs, quint32 et, QList<QString> mf) {
|
||||||
|
onLoginError(static_cast<int>(r), rs, et, mf);
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(remoteClient, &RemoteClient::registerError, this,
|
||||||
|
[this](Response::ResponseCode r, QString rs, quint32 et) { onRegisterError(static_cast<int>(r), rs, et); });
|
||||||
|
|
||||||
|
connect(remoteClient, &RemoteClient::activateError, this, &ConnectionController::onActivateError);
|
||||||
|
connect(remoteClient, &RemoteClient::socketError, this, &ConnectionController::onSocketError);
|
||||||
|
connect(remoteClient, &RemoteClient::serverTimeout, this, &ConnectionController::onServerTimeout);
|
||||||
|
|
||||||
|
connect(remoteClient, &RemoteClient::protocolVersionMismatch, this,
|
||||||
|
&ConnectionController::onProtocolVersionMismatch);
|
||||||
|
|
||||||
|
connect(remoteClient, &RemoteClient::registerAccepted, this, &ConnectionController::onRegisterAccepted);
|
||||||
|
|
||||||
|
connect(remoteClient, &RemoteClient::registerAcceptedNeedsActivate, this,
|
||||||
|
&ConnectionController::onRegisterAcceptedNeedsActivate);
|
||||||
|
|
||||||
|
connect(remoteClient, &RemoteClient::activateAccepted, this, &ConnectionController::onActivateAccepted);
|
||||||
|
|
||||||
|
connect(remoteClient, &RemoteClient::notifyUserAboutUpdate, this, &ConnectionController::onNotifyUserAboutUpdate);
|
||||||
|
|
||||||
|
connect(remoteClient, &RemoteClient::sigForgotPasswordSuccess, this,
|
||||||
|
&ConnectionController::onForgotPasswordSuccess);
|
||||||
|
|
||||||
|
connect(remoteClient, &RemoteClient::sigForgotPasswordError, this, &ConnectionController::onForgotPasswordError);
|
||||||
|
|
||||||
|
connect(remoteClient, &RemoteClient::sigPromptForForgotPasswordReset, this,
|
||||||
|
&ConnectionController::onPromptForgotPasswordReset);
|
||||||
|
|
||||||
|
connect(remoteClient, &RemoteClient::sigPromptForForgotPasswordChallenge, this,
|
||||||
|
&ConnectionController::onPromptForgotPasswordChallenge);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConnectionController::connectToServer()
|
||||||
|
{
|
||||||
|
dlgConnect = new DlgConnect(dialogParent);
|
||||||
|
connect(dlgConnect, &DlgConnect::sigStartForgotPasswordRequest, this, &ConnectionController::forgotPasswordRequest);
|
||||||
|
|
||||||
|
if (dlgConnect->exec()) {
|
||||||
|
remoteClient->connectToServer(dlgConnect->getHost(), static_cast<unsigned int>(dlgConnect->getPort()),
|
||||||
|
dlgConnect->getPlayerName(), dlgConnect->getPassword());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConnectionController::connectToServerDirect(const QString &host,
|
||||||
|
unsigned int port,
|
||||||
|
const QString &playerName,
|
||||||
|
const QString &password)
|
||||||
|
{
|
||||||
|
remoteClient->connectToServer(host, port, playerName, password);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConnectionController::disconnectFromServer()
|
||||||
|
{
|
||||||
|
remoteClient->disconnectFromServer();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConnectionController::registerToServer()
|
||||||
|
{
|
||||||
|
DlgRegister dlg(dialogParent);
|
||||||
|
if (dlg.exec()) {
|
||||||
|
remoteClient->registerToServer(dlg.getHost(), static_cast<unsigned int>(dlg.getPort()), dlg.getPlayerName(),
|
||||||
|
dlg.getPassword(), dlg.getEmail(), dlg.getCountry(), dlg.getRealName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConnectionController::forgotPasswordRequest()
|
||||||
|
{
|
||||||
|
DlgForgotPasswordRequest dlg(dialogParent);
|
||||||
|
if (dlg.exec()) {
|
||||||
|
remoteClient->requestForgotPasswordToServer(dlg.getHost(), static_cast<unsigned int>(dlg.getPort()),
|
||||||
|
dlg.getPlayerName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConnectionController::onConnectionClosedEvent(const Event_ConnectionClosed &event)
|
||||||
|
{
|
||||||
|
remoteClient->disconnectFromServer();
|
||||||
|
|
||||||
|
QString reasonStr;
|
||||||
|
switch (event.reason()) {
|
||||||
|
case Event_ConnectionClosed::USER_LIMIT_REACHED: {
|
||||||
|
reasonStr = tr("The server has reached its maximum user capacity, please check back later.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Event_ConnectionClosed::TOO_MANY_CONNECTIONS: {
|
||||||
|
reasonStr = tr("There are too many concurrent connections from your address.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Event_ConnectionClosed::BANNED: {
|
||||||
|
reasonStr = tr("Banned by moderator");
|
||||||
|
if (event.has_end_time()) {
|
||||||
|
reasonStr.append(
|
||||||
|
"\n" + tr("Expected end time: %1").arg(QDateTime::fromSecsSinceEpoch(event.end_time()).toString()));
|
||||||
|
} else {
|
||||||
|
reasonStr.append("\n" + tr("This ban lasts indefinitely."));
|
||||||
|
}
|
||||||
|
if (event.has_reason_str()) {
|
||||||
|
reasonStr.append("\n\n" + QString::fromStdString(event.reason_str()));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Event_ConnectionClosed::SERVER_SHUTDOWN: {
|
||||||
|
reasonStr = tr("Scheduled server shutdown.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Event_ConnectionClosed::USERNAMEINVALID: {
|
||||||
|
reasonStr = tr("Invalid username.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Event_ConnectionClosed::LOGGEDINELSEWERE: {
|
||||||
|
reasonStr = tr("You have been logged out due to logging in at another location.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
reasonStr = QString::fromStdString(event.reason_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
QMessageBox::critical(dialogParent, tr("Connection closed"),
|
||||||
|
tr("The server has terminated your connection.\nReason: %1").arg(reasonStr));
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConnectionController::onServerShutdownEvent(const Event_ServerShutdown &event)
|
||||||
|
{
|
||||||
|
serverShutdownMessageBox.setInformativeText(tr("The server is going to be restarted in %n minute(s).\nAll running "
|
||||||
|
"games will be lost.\nReason for shutdown: %1",
|
||||||
|
"", event.minutes())
|
||||||
|
.arg(QString::fromStdString(event.reason())));
|
||||||
|
serverShutdownMessageBox.setIconPixmap(QPixmap("theme:cockatrice").scaled(64, 64));
|
||||||
|
serverShutdownMessageBox.setText(tr("Scheduled server shutdown"));
|
||||||
|
serverShutdownMessageBox.setWindowModality(Qt::ApplicationModal);
|
||||||
|
serverShutdownMessageBox.setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConnectionController::onStatusChanged(ClientStatus status)
|
||||||
|
{
|
||||||
|
// Update the window title first, then let MainWindow handle its own UI
|
||||||
|
// state via the forwarded signal
|
||||||
|
updateWindowTitle();
|
||||||
|
emit statusChanged(status);
|
||||||
|
|
||||||
|
// TabSupervisor::stop() needs calling on disconnect; start() is driven by
|
||||||
|
// onUserInfoReceived → tabSupervisorStartRequested.
|
||||||
|
if (status == StatusDisconnected) {
|
||||||
|
emit tabSupervisorStopRequested();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConnectionController::onUserInfoReceived(const ServerInfo_User &info)
|
||||||
|
{
|
||||||
|
emit tabSupervisorStartRequested(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConnectionController::onLoginError(int r,
|
||||||
|
QString reasonStr,
|
||||||
|
quint32 endTime,
|
||||||
|
const QList<QString> &missingFeatures)
|
||||||
|
{
|
||||||
|
switch (static_cast<Response::ResponseCode>(r)) {
|
||||||
|
case Response::RespClientUpdateRequired: {
|
||||||
|
QString formatted = "Missing Features: ";
|
||||||
|
for (int i = 0; i < missingFeatures.size(); ++i) {
|
||||||
|
formatted.append(QString("\n %1").arg(QChar(0x2022)) + " " + missingFeatures.value(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
QMessageBox msgBox(dialogParent);
|
||||||
|
msgBox.setIcon(QMessageBox::Critical);
|
||||||
|
msgBox.setWindowTitle(tr("Failed Login"));
|
||||||
|
msgBox.setText(tr("Your client seems to be missing features this server requires for connection.") +
|
||||||
|
"\n\n" + tr("To update your client, go to 'Help -> Check for Client Updates'."));
|
||||||
|
msgBox.setDetailedText(formatted);
|
||||||
|
msgBox.exec();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case Response::RespWrongPassword: {
|
||||||
|
QMessageBox::critical(dialogParent, tr("Error"),
|
||||||
|
tr("Incorrect username or password. "
|
||||||
|
"Please check your authentication information and try again."));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case Response::RespWouldOverwriteOldSession: {
|
||||||
|
QMessageBox::critical(dialogParent, tr("Error"),
|
||||||
|
tr("There is already an active session using this user name.\n"
|
||||||
|
"Please close that session first and re-login."));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case Response::RespUserIsBanned: {
|
||||||
|
QString bannedStr =
|
||||||
|
endTime ? tr("You are banned until %1.").arg(QDateTime::fromSecsSinceEpoch(endTime).toString())
|
||||||
|
: tr("You are banned indefinitely.");
|
||||||
|
if (!reasonStr.isEmpty()) {
|
||||||
|
bannedStr.append("\n\n" + reasonStr);
|
||||||
|
}
|
||||||
|
QMessageBox::critical(dialogParent, tr("Error"), bannedStr);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case Response::RespUsernameInvalid: {
|
||||||
|
QMessageBox::critical(dialogParent, tr("Error"), extractInvalidUsernameMessage(reasonStr));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case Response::RespRegistrationRequired: {
|
||||||
|
if (QMessageBox::question(dialogParent, tr("Error"),
|
||||||
|
tr("This server requires user registration. Do you want to register now?"),
|
||||||
|
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
|
||||||
|
registerToServer();
|
||||||
|
}
|
||||||
|
return; // don't re-prompt connect
|
||||||
|
}
|
||||||
|
|
||||||
|
case Response::RespClientIdRequired: {
|
||||||
|
QMessageBox::critical(dialogParent, tr("Error"),
|
||||||
|
tr("This server requires client IDs. Your client is either failing to generate an "
|
||||||
|
"ID or you are running a modified client.\n"
|
||||||
|
"Please close and reopen your client to try again."));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case Response::RespContextError: {
|
||||||
|
QMessageBox::critical(dialogParent, tr("Error"),
|
||||||
|
tr("An internal error has occurred, please close and reopen Cockatrice before "
|
||||||
|
"trying again.\nIf the error persists, ensure you are running the latest "
|
||||||
|
"version of the software and if needed contact the software developers."));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case Response::RespAccountNotActivated: {
|
||||||
|
bool ok = false;
|
||||||
|
QString token =
|
||||||
|
getTextWithMax(dialogParent, tr("Account activation"),
|
||||||
|
tr("Your account has not been activated yet.\n"
|
||||||
|
"You need to provide the activation token received in the activation email."),
|
||||||
|
QLineEdit::Normal, QString(), &ok);
|
||||||
|
|
||||||
|
if (ok && !token.isEmpty()) {
|
||||||
|
remoteClient->activateToServer(token);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
remoteClient->disconnectFromServer();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
case Response::RespServerFull: {
|
||||||
|
QMessageBox::critical(dialogParent, tr("Server Full"),
|
||||||
|
tr("The server has reached its maximum user capacity, please check back later."));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default: {
|
||||||
|
QMessageBox::critical(dialogParent, tr("Error"),
|
||||||
|
tr("Unknown login error: %1").arg(r) +
|
||||||
|
tr("\nThis usually means that your client version is out of date, and the server "
|
||||||
|
"sent a reply your client doesn't understand."));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Re-open the connect dialog after any handled error
|
||||||
|
connectToServer();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConnectionController::onRegisterError(int r, QString reasonStr, quint32 endTime)
|
||||||
|
{
|
||||||
|
switch (static_cast<Response::ResponseCode>(r)) {
|
||||||
|
case Response::RespRegistrationDisabled: {
|
||||||
|
QMessageBox::critical(dialogParent, tr("Registration denied"),
|
||||||
|
tr("Registration is currently disabled on this server"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Response::RespUserAlreadyExists: {
|
||||||
|
QMessageBox::critical(dialogParent, tr("Registration denied"),
|
||||||
|
tr("There is already an existing account with the same user name."));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Response::RespEmailRequiredToRegister: {
|
||||||
|
QMessageBox::critical(dialogParent, tr("Registration denied"),
|
||||||
|
tr("It's mandatory to specify a valid email address when registering."));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Response::RespEmailBlackListed: {
|
||||||
|
if (reasonStr.isEmpty()) {
|
||||||
|
reasonStr =
|
||||||
|
"The email address provider used during registration has been blocked from use on this server.";
|
||||||
|
}
|
||||||
|
QMessageBox::critical(dialogParent, tr("Registration denied"), reasonStr);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Response::RespTooManyRequests: {
|
||||||
|
QMessageBox::critical(dialogParent, tr("Registration denied"),
|
||||||
|
tr("It appears you are attempting to register a new account on this server yet you "
|
||||||
|
"already have an account registered with the email provided. This server "
|
||||||
|
"restricts the number of accounts a user can register per address. Please "
|
||||||
|
"contact the server operator for further assistance or to obtain your "
|
||||||
|
"credential information."));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Response::RespPasswordTooShort: {
|
||||||
|
QMessageBox::critical(dialogParent, tr("Registration denied"), tr("Password too short."));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Response::RespUserIsBanned: {
|
||||||
|
QString bannedStr =
|
||||||
|
endTime ? tr("You are banned until %1.").arg(QDateTime::fromSecsSinceEpoch(endTime).toString())
|
||||||
|
: tr("You are banned indefinitely.");
|
||||||
|
if (!reasonStr.isEmpty()) {
|
||||||
|
bannedStr.append("\n\n" + reasonStr);
|
||||||
|
}
|
||||||
|
QMessageBox::critical(dialogParent, tr("Error"), bannedStr);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Response::RespUsernameInvalid: {
|
||||||
|
QMessageBox::critical(dialogParent, tr("Error"), extractInvalidUsernameMessage(reasonStr));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Response::RespRegistrationFailed: {
|
||||||
|
QMessageBox::critical(dialogParent, tr("Error"),
|
||||||
|
tr("Registration failed for a technical problem on the server."));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Response::RespNotConnected: {
|
||||||
|
QMessageBox::critical(dialogParent, tr("Error"), tr("The connection to the server has been lost."));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
QMessageBox::critical(dialogParent, tr("Error"),
|
||||||
|
tr("Unknown registration error: %1").arg(r) +
|
||||||
|
tr("\nThis usually means that your client version is out of date, and the server "
|
||||||
|
"sent a reply your client doesn't understand."));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
registerToServer();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConnectionController::onActivateError()
|
||||||
|
{
|
||||||
|
QMessageBox::critical(dialogParent, tr("Error"), tr("Account activation failed"));
|
||||||
|
remoteClient->disconnectFromServer();
|
||||||
|
connectToServer();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConnectionController::onSocketError(const QString &errorStr)
|
||||||
|
{
|
||||||
|
QMessageBox::critical(dialogParent, tr("Error"), tr("Socket error: %1").arg(errorStr));
|
||||||
|
connectToServer();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConnectionController::onServerTimeout()
|
||||||
|
{
|
||||||
|
QMessageBox::critical(dialogParent, tr("Error"), tr("Server timeout"));
|
||||||
|
connectToServer();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConnectionController::onProtocolVersionMismatch(int localVersion, int remoteVersion)
|
||||||
|
{
|
||||||
|
if (localVersion > remoteVersion) {
|
||||||
|
QMessageBox::critical(dialogParent, tr("Error"),
|
||||||
|
tr("You are trying to connect to an obsolete server. Please downgrade your Cockatrice "
|
||||||
|
"version or connect to a suitable server.\n"
|
||||||
|
"Local version is %1, remote version is %2.")
|
||||||
|
.arg(localVersion)
|
||||||
|
.arg(remoteVersion));
|
||||||
|
} else {
|
||||||
|
QMessageBox::critical(dialogParent, tr("Error"),
|
||||||
|
tr("Your Cockatrice client is obsolete. Please update your Cockatrice version.\n"
|
||||||
|
"Local version is %1, remote version is %2.")
|
||||||
|
.arg(localVersion)
|
||||||
|
.arg(remoteVersion));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConnectionController::onRegisterAccepted()
|
||||||
|
{
|
||||||
|
QMessageBox::information(dialogParent, tr("Success"), tr("Registration accepted.\nWill now login."));
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConnectionController::onRegisterAcceptedNeedsActivate()
|
||||||
|
{
|
||||||
|
// Server will send activation email; nothing to display here.
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConnectionController::onActivateAccepted()
|
||||||
|
{
|
||||||
|
QMessageBox::information(dialogParent, tr("Success"), tr("Account activation accepted.\nWill now login."));
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConnectionController::onNotifyUserAboutUpdate()
|
||||||
|
{
|
||||||
|
QMessageBox::information(
|
||||||
|
dialogParent, tr("Information"),
|
||||||
|
tr("This server supports additional features that your client doesn't have.\n"
|
||||||
|
"This is most likely not a problem, but this message might mean there is a new version of "
|
||||||
|
"Cockatrice available or this server is running a custom or pre-release version.\n\n"
|
||||||
|
"To update your client, go to Help -> Check for Updates."));
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConnectionController::onForgotPasswordSuccess()
|
||||||
|
{
|
||||||
|
QMessageBox::information(
|
||||||
|
dialogParent, tr("Reset Password"),
|
||||||
|
tr("Your password has been reset successfully, you can now log in using the new credentials."));
|
||||||
|
SettingsCache::instance().servers().setFPHostName("");
|
||||||
|
SettingsCache::instance().servers().setFPPort("");
|
||||||
|
SettingsCache::instance().servers().setFPPlayerName("");
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConnectionController::onForgotPasswordError()
|
||||||
|
{
|
||||||
|
QMessageBox::warning(
|
||||||
|
dialogParent, tr("Reset Password"),
|
||||||
|
tr("Failed to reset user account password, please contact the server operator to reset your password."));
|
||||||
|
SettingsCache::instance().servers().setFPHostName("");
|
||||||
|
SettingsCache::instance().servers().setFPPort("");
|
||||||
|
SettingsCache::instance().servers().setFPPlayerName("");
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConnectionController::onPromptForgotPasswordReset()
|
||||||
|
{
|
||||||
|
QMessageBox::information(dialogParent, tr("Reset Password"),
|
||||||
|
tr("Activation request received, please check your email for an activation token."));
|
||||||
|
DlgForgotPasswordReset dlg(dialogParent);
|
||||||
|
if (dlg.exec()) {
|
||||||
|
remoteClient->submitForgotPasswordResetToServer(dlg.getHost(), static_cast<unsigned int>(dlg.getPort()),
|
||||||
|
dlg.getPlayerName(), dlg.getToken(), dlg.getPassword());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConnectionController::onPromptForgotPasswordChallenge()
|
||||||
|
{
|
||||||
|
DlgForgotPasswordChallenge dlg(dialogParent);
|
||||||
|
if (dlg.exec()) {
|
||||||
|
remoteClient->submitForgotPasswordChallengeToServer(dlg.getHost(), static_cast<unsigned int>(dlg.getPort()),
|
||||||
|
dlg.getPlayerName(), dlg.getEmail());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConnectionController::updateWindowTitle()
|
||||||
|
{
|
||||||
|
const QString appName = QStringLiteral("Cockatrice");
|
||||||
|
QString title;
|
||||||
|
|
||||||
|
switch (remoteClient->getStatus()) {
|
||||||
|
case StatusConnecting: {
|
||||||
|
title = appName + " - " + tr("Connecting to %1...").arg(remoteClient->peerName());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case StatusRegistering: {
|
||||||
|
title = appName + " - " +
|
||||||
|
tr("Registering to %1 as %2...").arg(remoteClient->peerName()).arg(remoteClient->getUserName());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case StatusDisconnected: {
|
||||||
|
title = appName + " - " + tr("Disconnected");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case StatusLoggingIn: {
|
||||||
|
title = appName + " - " + tr("Connected, logging in at %1").arg(remoteClient->peerName());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case StatusLoggedIn: {
|
||||||
|
title = remoteClient->getUserName() + "@" + remoteClient->peerName();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case StatusRequestingForgotPassword:
|
||||||
|
case StatusSubmitForgotPasswordChallenge:
|
||||||
|
case StatusSubmitForgotPasswordReset:
|
||||||
|
title = appName + " - " +
|
||||||
|
tr("Requesting forgotten password to %1 as %2...")
|
||||||
|
.arg(remoteClient->peerName())
|
||||||
|
.arg(remoteClient->getUserName());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
title = appName;
|
||||||
|
}
|
||||||
|
|
||||||
|
emit windowTitleChanged(title);
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
QString ConnectionController::extractInvalidUsernameMessage(QString &in)
|
||||||
|
{
|
||||||
|
QString out = tr("Invalid username.") + "<br/>";
|
||||||
|
QStringList rules = in.split(QChar('|'));
|
||||||
|
|
||||||
|
if (rules.size() == 7 || rules.size() == 9) {
|
||||||
|
out += tr("Your username must respect these rules:") + "<ul>";
|
||||||
|
|
||||||
|
out += "<li>" + tr("is %1 - %2 characters long").arg(rules.at(0)).arg(rules.at(1)) + "</li>";
|
||||||
|
out += "<li>" + tr("can %1 contain lowercase characters").arg((rules.at(2).toInt() > 0) ? "" : tr("NOT")) +
|
||||||
|
"</li>";
|
||||||
|
out += "<li>" + tr("can %1 contain uppercase characters").arg((rules.at(3).toInt() > 0) ? "" : tr("NOT")) +
|
||||||
|
"</li>";
|
||||||
|
out +=
|
||||||
|
"<li>" + tr("can %1 contain numeric characters").arg((rules.at(4).toInt() > 0) ? "" : tr("NOT")) + "</li>";
|
||||||
|
|
||||||
|
if (rules.at(6).size() > 0) {
|
||||||
|
out += "<li>" + tr("can contain the following punctuation: %1").arg(rules.at(6).toHtmlEscaped()) + "</li>";
|
||||||
|
}
|
||||||
|
|
||||||
|
out += "<li>" +
|
||||||
|
tr("first character can %1 be a punctuation mark").arg((rules.at(5).toInt() > 0) ? "" : tr("NOT")) +
|
||||||
|
"</li>";
|
||||||
|
|
||||||
|
if (rules.size() == 9) {
|
||||||
|
if (rules.at(7).size() > 0) {
|
||||||
|
QString words = rules.at(7).toHtmlEscaped();
|
||||||
|
if (words.startsWith("\n")) {
|
||||||
|
out += tr("no unacceptable language as specified by these server rules:",
|
||||||
|
"note that the following lines will not be translated");
|
||||||
|
for (QString &line : words.split("\n", Qt::SkipEmptyParts)) {
|
||||||
|
out += "<li>" + line + "</li>";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
out += "<li>" + tr("can not contain any of the following words: %1").arg(words) + "</li>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rules.at(8).size() > 0) {
|
||||||
|
out += "<li>" +
|
||||||
|
tr("can not match any of the following expressions: %1").arg(rules.at(8).toHtmlEscaped()) +
|
||||||
|
"</li>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
out += "</ul>";
|
||||||
|
} else {
|
||||||
|
out += tr("You may only use A-Z, a-z, 0-9, _, ., and - in your username.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,98 @@
|
||||||
|
#ifndef COCKATRICE_REMOTE_CONNECTION_CONTROLLER_H
|
||||||
|
#define COCKATRICE_REMOTE_CONNECTION_CONTROLLER_H
|
||||||
|
|
||||||
|
#include "abstract_client.h"
|
||||||
|
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QString>
|
||||||
|
#include <QThread>
|
||||||
|
#include <libcockatrice/protocol/pb/event_connection_closed.pb.h>
|
||||||
|
#include <libcockatrice/protocol/pb/event_server_shutdown.pb.h>
|
||||||
|
|
||||||
|
class RemoteClient;
|
||||||
|
class ServerInfo_User;
|
||||||
|
class DlgConnect;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Owns the RemoteClient and its worker thread.
|
||||||
|
* Encapsulates all connection, authentication, and registration logic so that
|
||||||
|
* MainWindow only needs to react to high-level signals.
|
||||||
|
*/
|
||||||
|
class ConnectionController : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit ConnectionController(QWidget *dialogParent, QObject *parent = nullptr);
|
||||||
|
~ConnectionController() override;
|
||||||
|
|
||||||
|
RemoteClient *client() const
|
||||||
|
{
|
||||||
|
return remoteClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
void registerToServer();
|
||||||
|
void forgotPasswordRequest();
|
||||||
|
void connectToServer();
|
||||||
|
void
|
||||||
|
connectToServerDirect(const QString &host, unsigned int port, const QString &playerName, const QString &password);
|
||||||
|
void disconnectFromServer();
|
||||||
|
|
||||||
|
void refreshWindowTitle()
|
||||||
|
{
|
||||||
|
updateWindowTitle();
|
||||||
|
}
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void windowTitleChanged(const QString &title);
|
||||||
|
|
||||||
|
void tabSupervisorStartRequested(const ServerInfo_User &info);
|
||||||
|
void tabSupervisorStopRequested();
|
||||||
|
|
||||||
|
// Passes the raw ClientStatus through so MainWindow can drive its own
|
||||||
|
// action enable/disable logic
|
||||||
|
void statusChanged(ClientStatus status);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
// Slots wired directly to RemoteClient signals
|
||||||
|
void onStatusChanged(ClientStatus status);
|
||||||
|
void onUserInfoReceived(const ServerInfo_User &info);
|
||||||
|
void onLoginError(int r, QString reasonStr, quint32 endTime, const QList<QString> &missingFeatures);
|
||||||
|
void onRegisterAccepted();
|
||||||
|
void onRegisterAcceptedNeedsActivate();
|
||||||
|
void onRegisterError(int r, QString reasonStr, quint32 endTime);
|
||||||
|
void onActivateAccepted();
|
||||||
|
void onActivateError();
|
||||||
|
void onProtocolVersionMismatch(int localVersion, int remoteVersion);
|
||||||
|
void onNotifyUserAboutUpdate();
|
||||||
|
void onConnectionClosedEvent(const Event_ConnectionClosed &event);
|
||||||
|
void onServerShutdownEvent(const Event_ServerShutdown &event);
|
||||||
|
void onSocketError(const QString &errorStr);
|
||||||
|
void onServerTimeout();
|
||||||
|
|
||||||
|
// Forgot-password flow
|
||||||
|
void onForgotPasswordSuccess();
|
||||||
|
void onForgotPasswordError();
|
||||||
|
void onPromptForgotPasswordReset();
|
||||||
|
void onPromptForgotPasswordChallenge();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void wireClientSignals();
|
||||||
|
void updateWindowTitle();
|
||||||
|
|
||||||
|
/** Parse the server's pipe-delimited username-rule string into HTML. */
|
||||||
|
static QString extractInvalidUsernameMessage(QString &in);
|
||||||
|
|
||||||
|
RemoteClient *remoteClient{nullptr};
|
||||||
|
QThread *clientThread{nullptr};
|
||||||
|
QWidget *dialogParent{nullptr}; // used as parent for QMessageBox / dialog calls
|
||||||
|
|
||||||
|
// Persistent so it can be updated in-place by onServerShutdownEvent
|
||||||
|
QMessageBox serverShutdownMessageBox;
|
||||||
|
|
||||||
|
// Kept as a member so the forgot-password signal can be wired to it
|
||||||
|
DlgConnect *dlgConnect{nullptr};
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // COCKATRICE_REMOTE_CONNECTION_CONTROLLER_H
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/**
|
/**
|
||||||
* @file deck_stats_interface.h
|
* @file deck_stats_interface.h
|
||||||
* @ingroup ApiInterfaces
|
* @ingroup ApiInterfaces
|
||||||
* @brief TODO: Document this.
|
|
||||||
*/
|
*/
|
||||||
|
//! \todo Document this file.
|
||||||
|
|
||||||
#ifndef DECKSTATS_INTERFACE_H
|
#ifndef DECKSTATS_INTERFACE_H
|
||||||
#define DECKSTATS_INTERFACE_H
|
#define DECKSTATS_INTERFACE_H
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,8 @@ void TappedOutInterface::analyzeDeck(const DeckList &deck)
|
||||||
QNetworkRequest request(QUrl("https://tappedout.net/mtg-decks/paste/"));
|
QNetworkRequest request(QUrl("https://tappedout.net/mtg-decks/paste/"));
|
||||||
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
|
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
|
||||||
request.setHeader(QNetworkRequest::UserAgentHeader, QString("Cockatrice %1").arg(VERSION_STRING));
|
request.setHeader(QNetworkRequest::UserAgentHeader, QString("Cockatrice %1").arg(VERSION_STRING));
|
||||||
|
// we interpret the redirect and open it in the browser instead, do not follow redirects
|
||||||
|
request.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::ManualRedirectPolicy);
|
||||||
|
|
||||||
manager->post(request, data);
|
manager->post(request, data);
|
||||||
}
|
}
|
||||||
|
|
@ -97,14 +99,16 @@ void TappedOutInterface::copyDeckSplitMainAndSide(const DeckList &source, DeckLi
|
||||||
{
|
{
|
||||||
auto copyMainOrSide = [this, &mainboard, &sideboard](const auto node, const auto card) {
|
auto copyMainOrSide = [this, &mainboard, &sideboard](const auto node, const auto card) {
|
||||||
CardInfoPtr dbCard = cardDatabase.query()->getCardInfo(card->getName());
|
CardInfoPtr dbCard = cardDatabase.query()->getCardInfo(card->getName());
|
||||||
if (!dbCard || dbCard->getIsToken())
|
if (!dbCard || dbCard->getIsToken()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
DecklistCardNode *addedCard;
|
DecklistCardNode *addedCard;
|
||||||
if (node->getName() == DECK_ZONE_SIDE)
|
if (node->getName() == DECK_ZONE_SIDE) {
|
||||||
addedCard = sideboard.addCard(card->getName(), node->getName(), -1);
|
addedCard = sideboard.addCard(card->getName(), node->getName(), -1);
|
||||||
else
|
} else {
|
||||||
addedCard = mainboard.addCard(card->getName(), node->getName(), -1);
|
addedCard = mainboard.addCard(card->getName(), node->getName(), -1);
|
||||||
|
}
|
||||||
addedCard->setNumber(card->getNumber());
|
addedCard->setNumber(card->getNumber());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/**
|
/**
|
||||||
* @file tapped_out_interface.h
|
* @file tapped_out_interface.h
|
||||||
* @ingroup ApiInterfaces
|
* @ingroup ApiInterfaces
|
||||||
* @brief TODO: Document this.
|
|
||||||
*/
|
*/
|
||||||
|
//! \todo Document this file.
|
||||||
|
|
||||||
#ifndef TAPPEDOUT_INTERFACE_H
|
#ifndef TAPPEDOUT_INTERFACE_H
|
||||||
#define TAPPEDOUT_INTERFACE_H
|
#define TAPPEDOUT_INTERFACE_H
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/**
|
/**
|
||||||
* @file deck_link_to_api_transformer.h
|
* @file deck_link_to_api_transformer.h
|
||||||
* @ingroup ApiInterfaces
|
* @ingroup ApiInterfaces
|
||||||
* @brief TODO: Document this.
|
|
||||||
*/
|
*/
|
||||||
|
//! \todo Document this file.
|
||||||
|
|
||||||
#ifndef DECK_LINK_TO_API_TRANSFORMER_H
|
#ifndef DECK_LINK_TO_API_TRANSFORMER_H
|
||||||
#define DECK_LINK_TO_API_TRANSFORMER_H
|
#define DECK_LINK_TO_API_TRANSFORMER_H
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* @file interface_json_deck_parser.h
|
* @file interface_json_deck_parser.h
|
||||||
* @ingroup ApiInterfaces
|
* @ingroup ApiInterfaces
|
||||||
* @brief TODO: Document this.
|
|
||||||
*/
|
*/
|
||||||
|
//! \todo Document this file.
|
||||||
|
|
||||||
#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/card_node_function.h"
|
#include "../../../interface/deck_loader/card_node_function.h"
|
||||||
#include "../../../interface/deck_loader/deck_loader.h"
|
|
||||||
|
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
|
#include <libcockatrice/card/import/card_name_normalizer.h>
|
||||||
|
#include <libcockatrice/deck_list/deck_list.h>
|
||||||
|
|
||||||
class IJsonDeckParser
|
class IJsonDeckParser
|
||||||
{
|
{
|
||||||
|
|
@ -49,7 +50,7 @@ public:
|
||||||
outStream << quantity << ' ' << cardName << " (" << setName << ") " << collectorNumber << '\n';
|
outStream << quantity << ' ' << cardName << " (" << setName << ") " << collectorNumber << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
deckList.loadFromStream_Plain(outStream, false);
|
deckList.loadFromStream_Plain(outStream, false, CardNameNormalizer());
|
||||||
deckList.forEachCard(CardNodeFunction::ResolveProviderId());
|
deckList.forEachCard(CardNodeFunction::ResolveProviderId());
|
||||||
|
|
||||||
return deckList;
|
return deckList;
|
||||||
|
|
@ -96,7 +97,7 @@ public:
|
||||||
outStream << quantity << ' ' << cardName << " (" << setName << ") " << collectorNumber << '\n';
|
outStream << quantity << ' ' << cardName << " (" << setName << ") " << collectorNumber << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
deckList.loadFromStream_Plain(outStream, false);
|
deckList.loadFromStream_Plain(outStream, false, CardNameNormalizer());
|
||||||
deckList.forEachCard(CardNodeFunction::ResolveProviderId());
|
deckList.forEachCard(CardNodeFunction::ResolveProviderId());
|
||||||
|
|
||||||
QJsonObject commandersObj = obj.value("commanders").toObject();
|
QJsonObject commandersObj = obj.value("commanders").toObject();
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/**
|
/**
|
||||||
* @file spoiler_background_updater.h
|
* @file spoiler_background_updater.h
|
||||||
* @ingroup Client
|
* @ingroup Client
|
||||||
* @brief TODO: Document this.
|
|
||||||
*/
|
*/
|
||||||
|
//! \todo Document this file.
|
||||||
|
|
||||||
#ifndef COCKATRICE_SPOILER_DOWNLOADER_H
|
#ifndef COCKATRICE_SPOILER_DOWNLOADER_H
|
||||||
#define COCKATRICE_SPOILER_DOWNLOADER_H
|
#define COCKATRICE_SPOILER_DOWNLOADER_H
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/**
|
/**
|
||||||
* @file client_update_checker.h
|
* @file client_update_checker.h
|
||||||
* @ingroup ClientUpdate
|
* @ingroup ClientUpdate
|
||||||
* @brief TODO: Document this.
|
|
||||||
*/
|
*/
|
||||||
|
//! \todo Document this file.
|
||||||
|
|
||||||
#ifndef CLIENT_UPDATE_CHECKER_H
|
#ifndef CLIENT_UPDATE_CHECKER_H
|
||||||
#define CLIENT_UPDATE_CHECKER_H
|
#define CLIENT_UPDATE_CHECKER_H
|
||||||
|
|
|
||||||
|
|
@ -129,8 +129,9 @@ void StableReleaseChannel::releaseListFinished()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!lastRelease)
|
if (!lastRelease) {
|
||||||
lastRelease = new Release;
|
lastRelease = new Release;
|
||||||
|
}
|
||||||
|
|
||||||
lastRelease->setName(resultMap["name"].toString());
|
lastRelease->setName(resultMap["name"].toString());
|
||||||
lastRelease->setDescriptionUrl(resultMap["html_url"].toString());
|
lastRelease->setDescriptionUrl(resultMap["html_url"].toString());
|
||||||
|
|
@ -246,8 +247,9 @@ void BetaReleaseChannel::releaseListFinished()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lastRelease == nullptr)
|
if (lastRelease == nullptr) {
|
||||||
lastRelease = new Release;
|
lastRelease = new Release;
|
||||||
|
}
|
||||||
|
|
||||||
lastRelease->setCommitHash(resultMap["target_commitish"].toString());
|
lastRelease->setCommitHash(resultMap["target_commitish"].toString());
|
||||||
lastRelease->setPublishDate(resultMap["published_at"].toDate());
|
lastRelease->setPublishDate(resultMap["published_at"].toDate());
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/**
|
/**
|
||||||
* @file release_channel.h
|
* @file release_channel.h
|
||||||
* @ingroup ClientUpdate
|
* @ingroup ClientUpdate
|
||||||
* @brief TODO: Document this.
|
|
||||||
*/
|
*/
|
||||||
|
//! \todo Document this file.
|
||||||
|
|
||||||
#ifndef RELEASECHANNEL_H
|
#ifndef RELEASECHANNEL_H
|
||||||
#define RELEASECHANNEL_H
|
#define RELEASECHANNEL_H
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,9 @@ UpdateDownloader::UpdateDownloader(QObject *parent) : QObject(parent), response(
|
||||||
void UpdateDownloader::beginDownload(QUrl downloadUrl)
|
void UpdateDownloader::beginDownload(QUrl downloadUrl)
|
||||||
{
|
{
|
||||||
// Save the original URL because we need it for the filename
|
// Save the original URL because we need it for the filename
|
||||||
if (originalUrl.isEmpty())
|
if (originalUrl.isEmpty()) {
|
||||||
originalUrl = downloadUrl;
|
originalUrl = downloadUrl;
|
||||||
|
}
|
||||||
|
|
||||||
response = netMan->get(QNetworkRequest(downloadUrl));
|
response = netMan->get(QNetworkRequest(downloadUrl));
|
||||||
connect(response, &QNetworkReply::finished, this, &UpdateDownloader::fileFinished);
|
connect(response, &QNetworkReply::finished, this, &UpdateDownloader::fileFinished);
|
||||||
|
|
@ -21,8 +22,9 @@ void UpdateDownloader::beginDownload(QUrl downloadUrl)
|
||||||
|
|
||||||
void UpdateDownloader::downloadError(QNetworkReply::NetworkError)
|
void UpdateDownloader::downloadError(QNetworkReply::NetworkError)
|
||||||
{
|
{
|
||||||
if (response == nullptr)
|
if (response == nullptr) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
emit error(response->errorString().toUtf8());
|
emit error(response->errorString().toUtf8());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/**
|
/**
|
||||||
* @file update_downloader.h
|
* @file update_downloader.h
|
||||||
* @ingroup ClientUpdate
|
* @ingroup ClientUpdate
|
||||||
* @brief TODO: Document this.
|
|
||||||
*/
|
*/
|
||||||
|
//! \todo Document this file.
|
||||||
|
|
||||||
#ifndef COCKATRICE_UPDATEDOWNLOADER_H
|
#ifndef COCKATRICE_UPDATEDOWNLOADER_H
|
||||||
#define COCKATRICE_UPDATEDOWNLOADER_H
|
#define COCKATRICE_UPDATEDOWNLOADER_H
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
#include "cache_settings.h"
|
#include "cache_settings.h"
|
||||||
|
|
||||||
|
#include "../../interface/card_picture_loader/card_picture_loader_cache_method.h"
|
||||||
|
#include "../../interface/card_picture_loader/card_picture_loader_local_schemes.h"
|
||||||
#include "../network/update/client/release_channel.h"
|
#include "../network/update/client/release_channel.h"
|
||||||
#include "card_counter_settings.h"
|
#include "card_counter_settings.h"
|
||||||
#include "version_string.h"
|
#include "version_string.h"
|
||||||
|
|
@ -24,10 +26,11 @@ SettingsCache &SettingsCache::instance()
|
||||||
|
|
||||||
QString SettingsCache::getDataPath()
|
QString SettingsCache::getDataPath()
|
||||||
{
|
{
|
||||||
if (isPortableBuild)
|
if (isPortableBuild) {
|
||||||
return qApp->applicationDirPath() + "/data";
|
return qApp->applicationDirPath() + "/data";
|
||||||
else
|
} else {
|
||||||
return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation);
|
return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SettingsCache::getSettingsPath()
|
QString SettingsCache::getSettingsPath()
|
||||||
|
|
@ -37,10 +40,11 @@ QString SettingsCache::getSettingsPath()
|
||||||
|
|
||||||
QString SettingsCache::getCachePath() const
|
QString SettingsCache::getCachePath() const
|
||||||
{
|
{
|
||||||
if (isPortableBuild)
|
if (isPortableBuild) {
|
||||||
return qApp->applicationDirPath() + "/cache";
|
return qApp->applicationDirPath() + "/cache";
|
||||||
else
|
} else {
|
||||||
return QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
|
return QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SettingsCache::getNetworkCachePath() const
|
QString SettingsCache::getNetworkCachePath() const
|
||||||
|
|
@ -50,14 +54,17 @@ QString SettingsCache::getNetworkCachePath() const
|
||||||
|
|
||||||
void SettingsCache::translateLegacySettings()
|
void SettingsCache::translateLegacySettings()
|
||||||
{
|
{
|
||||||
if (isPortableBuild)
|
if (isPortableBuild) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Layouts
|
// Layouts
|
||||||
QFile layoutFile(getSettingsPath() + "layouts/deckLayout.ini");
|
QFile layoutFile(getSettingsPath() + "layouts/deckLayout.ini");
|
||||||
if (layoutFile.exists())
|
if (layoutFile.exists()) {
|
||||||
if (layoutFile.copy(getSettingsPath() + "layouts.ini"))
|
if (layoutFile.copy(getSettingsPath() + "layouts.ini")) {
|
||||||
layoutFile.remove();
|
layoutFile.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QStringList usedKeys;
|
QStringList usedKeys;
|
||||||
QSettings legacySetting;
|
QSettings legacySetting;
|
||||||
|
|
@ -116,10 +123,11 @@ void SettingsCache::translateLegacySettings()
|
||||||
gameFilters().setHideIgnoredUserGames(legacySetting.value("hide_ignored_user_games").toBool());
|
gameFilters().setHideIgnoredUserGames(legacySetting.value("hide_ignored_user_games").toBool());
|
||||||
gameFilters().setMinPlayers(legacySetting.value("min_players").toInt());
|
gameFilters().setMinPlayers(legacySetting.value("min_players").toInt());
|
||||||
|
|
||||||
if (legacySetting.value("max_players").toInt() > 1)
|
if (legacySetting.value("max_players").toInt() > 1) {
|
||||||
gameFilters().setMaxPlayers(legacySetting.value("max_players").toInt());
|
gameFilters().setMaxPlayers(legacySetting.value("max_players").toInt());
|
||||||
else
|
} else {
|
||||||
gameFilters().setMaxPlayers(99); // This prevents a bug where no games will show if max was not set before
|
gameFilters().setMaxPlayers(99); // This prevents a bug where no games will show if max was not set before
|
||||||
|
}
|
||||||
|
|
||||||
QStringList allFilters = legacySetting.allKeys();
|
QStringList allFilters = legacySetting.allKeys();
|
||||||
for (int i = 0; i < allFilters.size(); ++i) {
|
for (int i = 0; i < allFilters.size(); ++i) {
|
||||||
|
|
@ -135,8 +143,9 @@ void SettingsCache::translateLegacySettings()
|
||||||
|
|
||||||
QStringList allLegacyKeys = legacySetting.allKeys();
|
QStringList allLegacyKeys = legacySetting.allKeys();
|
||||||
for (int i = 0; i < allLegacyKeys.size(); ++i) {
|
for (int i = 0; i < allLegacyKeys.size(); ++i) {
|
||||||
if (usedKeys.contains(allLegacyKeys.at(i)))
|
if (usedKeys.contains(allLegacyKeys.at(i))) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
settings->setValue(allLegacyKeys.at(i), legacySetting.value(allLegacyKeys.at(i)));
|
settings->setValue(allLegacyKeys.at(i), legacySetting.value(allLegacyKeys.at(i)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -147,8 +156,9 @@ QString SettingsCache::getSafeConfigPath(QString configEntry, QString defaultPat
|
||||||
// if the config settings is empty or refers to a not-existing folder,
|
// if the config settings is empty or refers to a not-existing folder,
|
||||||
// ensure that the defaut path exists and return it
|
// ensure that the defaut path exists and return it
|
||||||
if (tmp.isEmpty() || !QDir(tmp).exists()) {
|
if (tmp.isEmpty() || !QDir(tmp).exists()) {
|
||||||
if (!QDir().mkpath(defaultPath))
|
if (!QDir().mkpath(defaultPath)) {
|
||||||
qCInfo(SettingsCacheLog) << "[SettingsCache] Could not create folder:" << defaultPath;
|
qCInfo(SettingsCacheLog) << "[SettingsCache] Could not create folder:" << defaultPath;
|
||||||
|
}
|
||||||
tmp = defaultPath;
|
tmp = defaultPath;
|
||||||
}
|
}
|
||||||
return tmp;
|
return tmp;
|
||||||
|
|
@ -159,8 +169,9 @@ QString SettingsCache::getSafeConfigFilePath(QString configEntry, QString defaul
|
||||||
QString tmp = settings->value(configEntry).toString();
|
QString tmp = settings->value(configEntry).toString();
|
||||||
// if the config settings is empty or refers to a not-existing file,
|
// if the config settings is empty or refers to a not-existing file,
|
||||||
// return the default Path
|
// return the default Path
|
||||||
if (!QFile::exists(tmp) || tmp.isEmpty())
|
if (!QFile::exists(tmp) || tmp.isEmpty()) {
|
||||||
tmp = std::move(defaultPath);
|
tmp = std::move(defaultPath);
|
||||||
|
}
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -168,8 +179,9 @@ SettingsCache::SettingsCache()
|
||||||
{
|
{
|
||||||
// first, figure out if we are running in portable mode
|
// first, figure out if we are running in portable mode
|
||||||
isPortableBuild = QFile::exists(qApp->applicationDirPath() + "/portable.dat");
|
isPortableBuild = QFile::exists(qApp->applicationDirPath() + "/portable.dat");
|
||||||
if (isPortableBuild)
|
if (isPortableBuild) {
|
||||||
qCInfo(SettingsCacheLog) << "Portable mode enabled";
|
qCInfo(SettingsCacheLog) << "Portable mode enabled";
|
||||||
|
}
|
||||||
|
|
||||||
// define a dummy context that will be used where needed
|
// define a dummy context that will be used where needed
|
||||||
QString dummy = QT_TRANSLATE_NOOP("i18n", "English");
|
QString dummy = QT_TRANSLATE_NOOP("i18n", "English");
|
||||||
|
|
@ -189,8 +201,9 @@ SettingsCache::SettingsCache()
|
||||||
|
|
||||||
cardCounterSettings = new CardCounterSettings(settingsPath, this);
|
cardCounterSettings = new CardCounterSettings(settingsPath, this);
|
||||||
|
|
||||||
if (!QFile(settingsPath + "global.ini").exists())
|
if (!QFile(settingsPath + "global.ini").exists()) {
|
||||||
translateLegacySettings();
|
translateLegacySettings();
|
||||||
|
}
|
||||||
|
|
||||||
// updates - don't reorder them or their index in the settings won't match
|
// updates - don't reorder them or their index in the settings won't match
|
||||||
// append channels one by one, or msvc will add them in the wrong order.
|
// append channels one by one, or msvc will add them in the wrong order.
|
||||||
|
|
@ -211,6 +224,7 @@ SettingsCache::SettingsCache()
|
||||||
startupCardUpdateCheckAlwaysUpdate = settings->value("personal/startupCardUpdateCheckAlwaysUpdate", false).toBool();
|
startupCardUpdateCheckAlwaysUpdate = settings->value("personal/startupCardUpdateCheckAlwaysUpdate", false).toBool();
|
||||||
cardUpdateCheckInterval = settings->value("personal/cardUpdateCheckInterval", 7).toInt();
|
cardUpdateCheckInterval = settings->value("personal/cardUpdateCheckInterval", 7).toInt();
|
||||||
lastCardUpdateCheck = settings->value("personal/lastCardUpdateCheck", QDateTime::currentDateTime().date()).toDate();
|
lastCardUpdateCheck = settings->value("personal/lastCardUpdateCheck", QDateTime::currentDateTime().date()).toDate();
|
||||||
|
alwaysEnableNewSets = settings->value("personal/alwaysEnableNewSets", false).toBool();
|
||||||
notifyAboutUpdates = settings->value("personal/updatenotification", true).toBool();
|
notifyAboutUpdates = settings->value("personal/updatenotification", true).toBool();
|
||||||
notifyAboutNewVersion = settings->value("personal/newversionnotification", true).toBool();
|
notifyAboutNewVersion = settings->value("personal/newversionnotification", true).toBool();
|
||||||
|
|
||||||
|
|
@ -256,21 +270,30 @@ SettingsCache::SettingsCache()
|
||||||
settings->setValue("personal/pixmapCacheSize", pixmapCacheSize);
|
settings->setValue("personal/pixmapCacheSize", pixmapCacheSize);
|
||||||
settings->setValue("personal/picturedownloadhq", false);
|
settings->setValue("personal/picturedownloadhq", false);
|
||||||
settings->setValue("revert/pixmapCacheSize", true);
|
settings->setValue("revert/pixmapCacheSize", true);
|
||||||
} else
|
} else {
|
||||||
pixmapCacheSize = settings->value("personal/pixmapCacheSize", PIXMAPCACHE_SIZE_DEFAULT).toInt();
|
pixmapCacheSize = settings->value("personal/pixmapCacheSize", PIXMAPCACHE_SIZE_DEFAULT).toInt();
|
||||||
|
}
|
||||||
// sanity check
|
// sanity check
|
||||||
if (pixmapCacheSize < PIXMAPCACHE_SIZE_MIN || pixmapCacheSize > PIXMAPCACHE_SIZE_MAX)
|
if (pixmapCacheSize < PIXMAPCACHE_SIZE_MIN || pixmapCacheSize > PIXMAPCACHE_SIZE_MAX) {
|
||||||
pixmapCacheSize = PIXMAPCACHE_SIZE_DEFAULT;
|
pixmapCacheSize = PIXMAPCACHE_SIZE_DEFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
networkCacheSize = settings->value("personal/networkCacheSize", NETWORK_CACHE_SIZE_DEFAULT).toInt();
|
networkCacheSize = settings->value("personal/networkCacheSize", NETWORK_CACHE_SIZE_DEFAULT).toInt();
|
||||||
redirectCacheTtl = settings->value("personal/redirectCacheTtl", NETWORK_REDIRECT_CACHE_TTL_DEFAULT).toInt();
|
redirectCacheTtl = settings->value("personal/redirectCacheTtl", NETWORK_REDIRECT_CACHE_TTL_DEFAULT).toInt();
|
||||||
|
cardPictureLoaderCacheMethod =
|
||||||
|
settings
|
||||||
|
->value("personal/cardPictureLoaderCacheMethod",
|
||||||
|
static_cast<int>(CardPictureLoaderCacheMethod::CacheMethod::NETWORK_CACHE))
|
||||||
|
.toInt();
|
||||||
|
localCardImageStorageNamingScheme =
|
||||||
|
settings
|
||||||
|
->value("personal/localCardImageStorageNamingScheme",
|
||||||
|
static_cast<int>(CardPictureLoaderLocalSchemes::NamingScheme::Set_Folder_Name_Set_Collector))
|
||||||
|
.toInt();
|
||||||
|
|
||||||
picDownload = settings->value("personal/picturedownload", true).toBool();
|
picDownload = settings->value("personal/picturedownload", true).toBool();
|
||||||
showStatusBar = settings->value("personal/showStatusBar", false).toBool();
|
showStatusBar = settings->value("personal/showStatusBar", false).toBool();
|
||||||
|
|
||||||
mainWindowGeometry = settings->value("interface/main_window_geometry").toByteArray();
|
|
||||||
tokenDialogGeometry = settings->value("interface/token_dialog_geometry").toByteArray();
|
|
||||||
setsDialogGeometry = settings->value("interface/sets_dialog_geometry").toByteArray();
|
|
||||||
notificationsEnabled = settings->value("interface/notificationsenabled", true).toBool();
|
notificationsEnabled = settings->value("interface/notificationsenabled", true).toBool();
|
||||||
spectatorNotificationsEnabled = settings->value("interface/specnotificationsenabled", false).toBool();
|
spectatorNotificationsEnabled = settings->value("interface/specnotificationsenabled", false).toBool();
|
||||||
buddyConnectNotificationsEnabled = settings->value("interface/buddyconnectnotificationsenabled", true).toBool();
|
buddyConnectNotificationsEnabled = settings->value("interface/buddyconnectnotificationsenabled", true).toBool();
|
||||||
|
|
@ -280,7 +303,6 @@ SettingsCache::SettingsCache()
|
||||||
doNotDeleteArrowsInSubPhases = settings->value("interface/doNotDeleteArrowsInSubPhases", true).toBool();
|
doNotDeleteArrowsInSubPhases = settings->value("interface/doNotDeleteArrowsInSubPhases", true).toBool();
|
||||||
startingHandSize = settings->value("interface/startinghandsize", 7).toInt();
|
startingHandSize = settings->value("interface/startinghandsize", 7).toInt();
|
||||||
annotateTokens = settings->value("interface/annotatetokens", false).toBool();
|
annotateTokens = settings->value("interface/annotatetokens", false).toBool();
|
||||||
tabGameSplitterSizes = settings->value("interface/tabgame_splittersizes").toByteArray();
|
|
||||||
knownMissingFeatures = settings->value("interface/knownmissingfeatures", "").toString();
|
knownMissingFeatures = settings->value("interface/knownmissingfeatures", "").toString();
|
||||||
useTearOffMenus = settings->value("interface/usetearoffmenus", true).toBool();
|
useTearOffMenus = settings->value("interface/usetearoffmenus", true).toBool();
|
||||||
cardViewInitialRowsMax = settings->value("interface/cardViewInitialRowsMax", 14).toInt();
|
cardViewInitialRowsMax = settings->value("interface/cardViewInitialRowsMax", 14).toInt();
|
||||||
|
|
@ -288,6 +310,9 @@ SettingsCache::SettingsCache()
|
||||||
closeEmptyCardView = settings->value("interface/closeEmptyCardView", true).toBool();
|
closeEmptyCardView = settings->value("interface/closeEmptyCardView", true).toBool();
|
||||||
focusCardViewSearchBar = settings->value("interface/focusCardViewSearchBar", true).toBool();
|
focusCardViewSearchBar = settings->value("interface/focusCardViewSearchBar", true).toBool();
|
||||||
|
|
||||||
|
showDragSelectionCount = settings->value("interface/showlassoselectioncount", true).toBool();
|
||||||
|
showTotalSelectionCount = settings->value("interface/showpersistentselectioncount", true).toBool();
|
||||||
|
|
||||||
showShortcuts = settings->value("menu/showshortcuts", true).toBool();
|
showShortcuts = settings->value("menu/showshortcuts", true).toBool();
|
||||||
showGameSelectorFilterToolbar = settings->value("menu/showgameselectorfiltertoolbar", true).toBool();
|
showGameSelectorFilterToolbar = settings->value("menu/showgameselectorfiltertoolbar", true).toBool();
|
||||||
displayCardNames = settings->value("cards/displaycardnames", true).toBool();
|
displayCardNames = settings->value("cards/displaycardnames", true).toBool();
|
||||||
|
|
@ -389,6 +414,13 @@ SettingsCache::SettingsCache()
|
||||||
defaultStartingLifeTotal = settings->value("game/defaultstartinglifetotal", 20).toInt();
|
defaultStartingLifeTotal = settings->value("game/defaultstartinglifetotal", 20).toInt();
|
||||||
shareDecklistsOnLoad = settings->value("game/sharedecklistsonload", false).toBool();
|
shareDecklistsOnLoad = settings->value("game/sharedecklistsonload", false).toBool();
|
||||||
rememberGameSettings = settings->value("game/remembergamesettings", true).toBool();
|
rememberGameSettings = settings->value("game/remembergamesettings", true).toBool();
|
||||||
|
|
||||||
|
// Local game settings use "localgameoptions/" prefix to keep them separate
|
||||||
|
// from server game settings which use "game/" prefix
|
||||||
|
localGameRememberSettings = settings->value("localgameoptions/remembersettings", false).toBool();
|
||||||
|
localGameMaxPlayers = settings->value("localgameoptions/maxplayers", 1).toInt();
|
||||||
|
localGameStartingLifeTotal = settings->value("localgameoptions/startinglifetotal", 20).toInt();
|
||||||
|
|
||||||
clientID = settings->value("personal/clientid", CLIENT_INFO_NOT_SET).toString();
|
clientID = settings->value("personal/clientid", CLIENT_INFO_NOT_SET).toString();
|
||||||
clientVersion = settings->value("personal/clientversion", CLIENT_INFO_NOT_SET).toString();
|
clientVersion = settings->value("personal/clientversion", CLIENT_INFO_NOT_SET).toString();
|
||||||
}
|
}
|
||||||
|
|
@ -713,12 +745,6 @@ void SettingsCache::setAnnotateTokens(QT_STATE_CHANGED_T _annotateTokens)
|
||||||
settings->setValue("interface/annotatetokens", annotateTokens);
|
settings->setValue("interface/annotatetokens", annotateTokens);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsCache::setTabGameSplitterSizes(const QByteArray &_tabGameSplitterSizes)
|
|
||||||
{
|
|
||||||
tabGameSplitterSizes = _tabGameSplitterSizes;
|
|
||||||
settings->setValue("interface/tabgame_splittersizes", tabGameSplitterSizes);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SettingsCache::setShowShortcuts(QT_STATE_CHANGED_T _showShortcuts)
|
void SettingsCache::setShowShortcuts(QT_STATE_CHANGED_T _showShortcuts)
|
||||||
{
|
{
|
||||||
showShortcuts = static_cast<bool>(_showShortcuts);
|
showShortcuts = static_cast<bool>(_showShortcuts);
|
||||||
|
|
@ -769,8 +795,9 @@ void SettingsCache::setPrintingSelectorCardSize(int _printingSelectorCardSize)
|
||||||
|
|
||||||
void SettingsCache::setIncludeRebalancedCards(bool _includeRebalancedCards)
|
void SettingsCache::setIncludeRebalancedCards(bool _includeRebalancedCards)
|
||||||
{
|
{
|
||||||
if (includeRebalancedCards == _includeRebalancedCards)
|
if (includeRebalancedCards == _includeRebalancedCards) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
includeRebalancedCards = _includeRebalancedCards;
|
includeRebalancedCards = _includeRebalancedCards;
|
||||||
settings->setValue("cards/includerebalancedcards", includeRebalancedCards);
|
settings->setValue("cards/includerebalancedcards", includeRebalancedCards);
|
||||||
|
|
@ -1090,24 +1117,6 @@ void SettingsCache::setIgnoreUnregisteredUserMessages(QT_STATE_CHANGED_T _ignore
|
||||||
settings->setValue("chat/ignore_unregistered_messages", ignoreUnregisteredUserMessages);
|
settings->setValue("chat/ignore_unregistered_messages", ignoreUnregisteredUserMessages);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsCache::setMainWindowGeometry(const QByteArray &_mainWindowGeometry)
|
|
||||||
{
|
|
||||||
mainWindowGeometry = _mainWindowGeometry;
|
|
||||||
settings->setValue("interface/main_window_geometry", mainWindowGeometry);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SettingsCache::setTokenDialogGeometry(const QByteArray &_tokenDialogGeometry)
|
|
||||||
{
|
|
||||||
tokenDialogGeometry = _tokenDialogGeometry;
|
|
||||||
settings->setValue("interface/token_dialog_geometry", tokenDialogGeometry);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SettingsCache::setSetsDialogGeometry(const QByteArray &_setsDialogGeometry)
|
|
||||||
{
|
|
||||||
setsDialogGeometry = _setsDialogGeometry;
|
|
||||||
settings->setValue("interface/sets_dialog_geometry", setsDialogGeometry);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SettingsCache::setPixmapCacheSize(const int _pixmapCacheSize)
|
void SettingsCache::setPixmapCacheSize(const int _pixmapCacheSize)
|
||||||
{
|
{
|
||||||
pixmapCacheSize = _pixmapCacheSize;
|
pixmapCacheSize = _pixmapCacheSize;
|
||||||
|
|
@ -1115,6 +1124,13 @@ void SettingsCache::setPixmapCacheSize(const int _pixmapCacheSize)
|
||||||
emit pixmapCacheSizeChanged(pixmapCacheSize);
|
emit pixmapCacheSizeChanged(pixmapCacheSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SettingsCache::setCardImageCacheMethod(const CardPictureLoaderCacheMethod::CacheMethod _cardImageCachingMethod)
|
||||||
|
{
|
||||||
|
cardPictureLoaderCacheMethod = static_cast<int>(_cardImageCachingMethod);
|
||||||
|
settings->setValue("personal/cardPictureLoaderCacheMethod", cardPictureLoaderCacheMethod);
|
||||||
|
emit cardPictureLoaderCacheMethodChanged(cardPictureLoaderCacheMethod);
|
||||||
|
}
|
||||||
|
|
||||||
void SettingsCache::setNetworkCacheSizeInMB(const int _networkCacheSize)
|
void SettingsCache::setNetworkCacheSizeInMB(const int _networkCacheSize)
|
||||||
{
|
{
|
||||||
networkCacheSize = _networkCacheSize;
|
networkCacheSize = _networkCacheSize;
|
||||||
|
|
@ -1129,6 +1145,14 @@ void SettingsCache::setNetworkRedirectCacheTtl(const int _redirectCacheTtl)
|
||||||
emit redirectCacheTtlChanged(redirectCacheTtl);
|
emit redirectCacheTtlChanged(redirectCacheTtl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SettingsCache::setLocalCardImageStorageNamingScheme(
|
||||||
|
const CardPictureLoaderLocalSchemes::NamingScheme _localCardImageStorageNamingScheme)
|
||||||
|
{
|
||||||
|
localCardImageStorageNamingScheme = static_cast<int>(_localCardImageStorageNamingScheme);
|
||||||
|
settings->setValue("personal/localCardImageStorageNamingScheme", localCardImageStorageNamingScheme);
|
||||||
|
emit localCardImageStorageNamingSchemeChanged(localCardImageStorageNamingScheme);
|
||||||
|
}
|
||||||
|
|
||||||
void SettingsCache::setClientID(const QString &_clientID)
|
void SettingsCache::setClientID(const QString &_clientID)
|
||||||
{
|
{
|
||||||
clientID = _clientID;
|
clientID = _clientID;
|
||||||
|
|
@ -1143,257 +1167,21 @@ void SettingsCache::setClientVersion(const QString &_clientVersion)
|
||||||
|
|
||||||
QStringList SettingsCache::getCountries() const
|
QStringList SettingsCache::getCountries() const
|
||||||
{
|
{
|
||||||
static QStringList countries = QStringList() << "ad"
|
static const QStringList countries = {
|
||||||
<< "ae"
|
"ad", "ae", "af", "ag", "ai", "al", "am", "ao", "aq", "ar", "as", "at", "au", "aw", "ax", "az", "ba", "bb",
|
||||||
<< "af"
|
"bd", "be", "bf", "bg", "bh", "bi", "bj", "bl", "bm", "bn", "bo", "bq", "br", "bs", "bt", "bv", "bw", "by",
|
||||||
<< "ag"
|
"bz", "ca", "cc", "cd", "cf", "cg", "ch", "ci", "ck", "cl", "cm", "cn", "co", "cr", "cu", "cv", "cw", "cx",
|
||||||
<< "ai"
|
"cy", "cz", "de", "dj", "dk", "dm", "do", "dz", "ec", "ee", "eg", "eh", "er", "es", "et", "eu", "fi", "fj",
|
||||||
<< "al"
|
"fk", "fm", "fo", "fr", "ga", "gb", "gd", "ge", "gf", "gg", "gh", "gi", "gl", "gm", "gn", "gp", "gq", "gr",
|
||||||
<< "am"
|
"gs", "gt", "gu", "gw", "gy", "hk", "hm", "hn", "hr", "ht", "hu", "id", "ie", "il", "im", "in", "io", "iq",
|
||||||
<< "ao"
|
"ir", "is", "it", "je", "jm", "jo", "jp", "ke", "kg", "kh", "ki", "km", "kn", "kp", "kr", "kw", "ky", "kz",
|
||||||
<< "aq"
|
"la", "lb", "lc", "li", "lk", "lr", "ls", "lt", "lu", "lv", "ly", "ma", "mc", "md", "me", "mf", "mg", "mh",
|
||||||
<< "ar"
|
"mk", "ml", "mm", "mn", "mo", "mp", "mq", "mr", "ms", "mt", "mu", "mv", "mw", "mx", "my", "mz", "na", "nc",
|
||||||
<< "as"
|
"ne", "nf", "ng", "ni", "nl", "no", "np", "nr", "nu", "nz", "om", "pa", "pe", "pf", "pg", "ph", "pk", "pl",
|
||||||
<< "at"
|
"pm", "pn", "pr", "ps", "pt", "pw", "py", "qa", "re", "ro", "rs", "ru", "rw", "sa", "sb", "sc", "sd", "se",
|
||||||
<< "au"
|
"sg", "sh", "si", "sj", "sk", "sl", "sm", "sn", "so", "sr", "ss", "st", "sv", "sx", "sy", "sz", "tc", "td",
|
||||||
<< "aw"
|
"tf", "tg", "th", "tj", "tk", "tl", "tm", "tn", "to", "tr", "tt", "tv", "tw", "tz", "ua", "ug", "um", "us",
|
||||||
<< "ax"
|
"uy", "uz", "va", "vc", "ve", "vg", "vi", "vn", "vu", "wf", "ws", "xk", "ye", "yt", "za", "zm", "zw"};
|
||||||
<< "az"
|
|
||||||
<< "ba"
|
|
||||||
<< "bb"
|
|
||||||
<< "bd"
|
|
||||||
<< "be"
|
|
||||||
<< "bf"
|
|
||||||
<< "bg"
|
|
||||||
<< "bh"
|
|
||||||
<< "bi"
|
|
||||||
<< "bj"
|
|
||||||
<< "bl"
|
|
||||||
<< "bm"
|
|
||||||
<< "bn"
|
|
||||||
<< "bo"
|
|
||||||
<< "bq"
|
|
||||||
<< "br"
|
|
||||||
<< "bs"
|
|
||||||
<< "bt"
|
|
||||||
<< "bv"
|
|
||||||
<< "bw"
|
|
||||||
<< "by"
|
|
||||||
<< "bz"
|
|
||||||
<< "ca"
|
|
||||||
<< "cc"
|
|
||||||
<< "cd"
|
|
||||||
<< "cf"
|
|
||||||
<< "cg"
|
|
||||||
<< "ch"
|
|
||||||
<< "ci"
|
|
||||||
<< "ck"
|
|
||||||
<< "cl"
|
|
||||||
<< "cm"
|
|
||||||
<< "cn"
|
|
||||||
<< "co"
|
|
||||||
<< "cr"
|
|
||||||
<< "cu"
|
|
||||||
<< "cv"
|
|
||||||
<< "cw"
|
|
||||||
<< "cx"
|
|
||||||
<< "cy"
|
|
||||||
<< "cz"
|
|
||||||
<< "de"
|
|
||||||
<< "dj"
|
|
||||||
<< "dk"
|
|
||||||
<< "dm"
|
|
||||||
<< "do"
|
|
||||||
<< "dz"
|
|
||||||
<< "ec"
|
|
||||||
<< "ee"
|
|
||||||
<< "eg"
|
|
||||||
<< "eh"
|
|
||||||
<< "er"
|
|
||||||
<< "es"
|
|
||||||
<< "et"
|
|
||||||
<< "eu"
|
|
||||||
<< "fi"
|
|
||||||
<< "fj"
|
|
||||||
<< "fk"
|
|
||||||
<< "fm"
|
|
||||||
<< "fo"
|
|
||||||
<< "fr"
|
|
||||||
<< "ga"
|
|
||||||
<< "gb"
|
|
||||||
<< "gd"
|
|
||||||
<< "ge"
|
|
||||||
<< "gf"
|
|
||||||
<< "gg"
|
|
||||||
<< "gh"
|
|
||||||
<< "gi"
|
|
||||||
<< "gl"
|
|
||||||
<< "gm"
|
|
||||||
<< "gn"
|
|
||||||
<< "gp"
|
|
||||||
<< "gq"
|
|
||||||
<< "gr"
|
|
||||||
<< "gs"
|
|
||||||
<< "gt"
|
|
||||||
<< "gu"
|
|
||||||
<< "gw"
|
|
||||||
<< "gy"
|
|
||||||
<< "hk"
|
|
||||||
<< "hm"
|
|
||||||
<< "hn"
|
|
||||||
<< "hr"
|
|
||||||
<< "ht"
|
|
||||||
<< "hu"
|
|
||||||
<< "id"
|
|
||||||
<< "ie"
|
|
||||||
<< "il"
|
|
||||||
<< "im"
|
|
||||||
<< "in"
|
|
||||||
<< "io"
|
|
||||||
<< "iq"
|
|
||||||
<< "ir"
|
|
||||||
<< "is"
|
|
||||||
<< "it"
|
|
||||||
<< "je"
|
|
||||||
<< "jm"
|
|
||||||
<< "jo"
|
|
||||||
<< "jp"
|
|
||||||
<< "ke"
|
|
||||||
<< "kg"
|
|
||||||
<< "kh"
|
|
||||||
<< "ki"
|
|
||||||
<< "km"
|
|
||||||
<< "kn"
|
|
||||||
<< "kp"
|
|
||||||
<< "kr"
|
|
||||||
<< "kw"
|
|
||||||
<< "ky"
|
|
||||||
<< "kz"
|
|
||||||
<< "la"
|
|
||||||
<< "lb"
|
|
||||||
<< "lc"
|
|
||||||
<< "li"
|
|
||||||
<< "lk"
|
|
||||||
<< "lr"
|
|
||||||
<< "ls"
|
|
||||||
<< "lt"
|
|
||||||
<< "lu"
|
|
||||||
<< "lv"
|
|
||||||
<< "ly"
|
|
||||||
<< "ma"
|
|
||||||
<< "mc"
|
|
||||||
<< "md"
|
|
||||||
<< "me"
|
|
||||||
<< "mf"
|
|
||||||
<< "mg"
|
|
||||||
<< "mh"
|
|
||||||
<< "mk"
|
|
||||||
<< "ml"
|
|
||||||
<< "mm"
|
|
||||||
<< "mn"
|
|
||||||
<< "mo"
|
|
||||||
<< "mp"
|
|
||||||
<< "mq"
|
|
||||||
<< "mr"
|
|
||||||
<< "ms"
|
|
||||||
<< "mt"
|
|
||||||
<< "mu"
|
|
||||||
<< "mv"
|
|
||||||
<< "mw"
|
|
||||||
<< "mx"
|
|
||||||
<< "my"
|
|
||||||
<< "mz"
|
|
||||||
<< "na"
|
|
||||||
<< "nc"
|
|
||||||
<< "ne"
|
|
||||||
<< "nf"
|
|
||||||
<< "ng"
|
|
||||||
<< "ni"
|
|
||||||
<< "nl"
|
|
||||||
<< "no"
|
|
||||||
<< "np"
|
|
||||||
<< "nr"
|
|
||||||
<< "nu"
|
|
||||||
<< "nz"
|
|
||||||
<< "om"
|
|
||||||
<< "pa"
|
|
||||||
<< "pe"
|
|
||||||
<< "pf"
|
|
||||||
<< "pg"
|
|
||||||
<< "ph"
|
|
||||||
<< "pk"
|
|
||||||
<< "pl"
|
|
||||||
<< "pm"
|
|
||||||
<< "pn"
|
|
||||||
<< "pr"
|
|
||||||
<< "ps"
|
|
||||||
<< "pt"
|
|
||||||
<< "pw"
|
|
||||||
<< "py"
|
|
||||||
<< "qa"
|
|
||||||
<< "re"
|
|
||||||
<< "ro"
|
|
||||||
<< "rs"
|
|
||||||
<< "ru"
|
|
||||||
<< "rw"
|
|
||||||
<< "sa"
|
|
||||||
<< "sb"
|
|
||||||
<< "sc"
|
|
||||||
<< "sd"
|
|
||||||
<< "se"
|
|
||||||
<< "sg"
|
|
||||||
<< "sh"
|
|
||||||
<< "si"
|
|
||||||
<< "sj"
|
|
||||||
<< "sk"
|
|
||||||
<< "sl"
|
|
||||||
<< "sm"
|
|
||||||
<< "sn"
|
|
||||||
<< "so"
|
|
||||||
<< "sr"
|
|
||||||
<< "ss"
|
|
||||||
<< "st"
|
|
||||||
<< "sv"
|
|
||||||
<< "sx"
|
|
||||||
<< "sy"
|
|
||||||
<< "sz"
|
|
||||||
<< "tc"
|
|
||||||
<< "td"
|
|
||||||
<< "tf"
|
|
||||||
<< "tg"
|
|
||||||
<< "th"
|
|
||||||
<< "tj"
|
|
||||||
<< "tk"
|
|
||||||
<< "tl"
|
|
||||||
<< "tm"
|
|
||||||
<< "tn"
|
|
||||||
<< "to"
|
|
||||||
<< "tr"
|
|
||||||
<< "tt"
|
|
||||||
<< "tv"
|
|
||||||
<< "tw"
|
|
||||||
<< "tz"
|
|
||||||
<< "ua"
|
|
||||||
<< "ug"
|
|
||||||
<< "um"
|
|
||||||
<< "us"
|
|
||||||
<< "uy"
|
|
||||||
<< "uz"
|
|
||||||
<< "va"
|
|
||||||
<< "vc"
|
|
||||||
<< "ve"
|
|
||||||
<< "vg"
|
|
||||||
<< "vi"
|
|
||||||
<< "vn"
|
|
||||||
<< "vu"
|
|
||||||
<< "wf"
|
|
||||||
<< "ws"
|
|
||||||
<< "xk"
|
|
||||||
<< "ye"
|
|
||||||
<< "yt"
|
|
||||||
<< "za"
|
|
||||||
<< "zm"
|
|
||||||
<< "zw";
|
|
||||||
|
|
||||||
return countries;
|
return countries;
|
||||||
}
|
}
|
||||||
|
|
@ -1500,12 +1288,36 @@ void SettingsCache::setLastCardUpdateCheck(QDate value)
|
||||||
settings->setValue("personal/lastCardUpdateCheck", lastCardUpdateCheck);
|
settings->setValue("personal/lastCardUpdateCheck", lastCardUpdateCheck);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SettingsCache::setAlwaysEnableNewSets(bool value)
|
||||||
|
{
|
||||||
|
alwaysEnableNewSets = value;
|
||||||
|
settings->setValue("personal/alwaysEnableNewSets", alwaysEnableNewSets);
|
||||||
|
}
|
||||||
|
|
||||||
void SettingsCache::setRememberGameSettings(const bool _rememberGameSettings)
|
void SettingsCache::setRememberGameSettings(const bool _rememberGameSettings)
|
||||||
{
|
{
|
||||||
rememberGameSettings = _rememberGameSettings;
|
rememberGameSettings = _rememberGameSettings;
|
||||||
settings->setValue("game/remembergamesettings", rememberGameSettings);
|
settings->setValue("game/remembergamesettings", rememberGameSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SettingsCache::setLocalGameRememberSettings(bool value)
|
||||||
|
{
|
||||||
|
localGameRememberSettings = value;
|
||||||
|
settings->setValue("localgameoptions/remembersettings", value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsCache::setLocalGameMaxPlayers(int value)
|
||||||
|
{
|
||||||
|
localGameMaxPlayers = value;
|
||||||
|
settings->setValue("localgameoptions/maxplayers", value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsCache::setLocalGameStartingLifeTotal(int value)
|
||||||
|
{
|
||||||
|
localGameStartingLifeTotal = value;
|
||||||
|
settings->setValue("localgameoptions/startinglifetotal", value);
|
||||||
|
}
|
||||||
|
|
||||||
void SettingsCache::setNotifyAboutUpdate(QT_STATE_CHANGED_T _notifyaboutupdate)
|
void SettingsCache::setNotifyAboutUpdate(QT_STATE_CHANGED_T _notifyaboutupdate)
|
||||||
{
|
{
|
||||||
notifyAboutUpdates = static_cast<bool>(_notifyaboutupdate);
|
notifyAboutUpdates = static_cast<bool>(_notifyaboutupdate);
|
||||||
|
|
@ -1539,14 +1351,27 @@ void SettingsCache::setMaxFontSize(int _max)
|
||||||
|
|
||||||
void SettingsCache::setRoundCardCorners(bool _roundCardCorners)
|
void SettingsCache::setRoundCardCorners(bool _roundCardCorners)
|
||||||
{
|
{
|
||||||
if (_roundCardCorners == roundCardCorners)
|
if (_roundCardCorners == roundCardCorners) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
roundCardCorners = _roundCardCorners;
|
roundCardCorners = _roundCardCorners;
|
||||||
settings->setValue("cards/roundcardcorners", _roundCardCorners);
|
settings->setValue("cards/roundcardcorners", _roundCardCorners);
|
||||||
emit roundCardCornersChanged(roundCardCorners);
|
emit roundCardCornersChanged(roundCardCorners);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SettingsCache::setShowDragSelectionCount(QT_STATE_CHANGED_T _showDragSelectionCount)
|
||||||
|
{
|
||||||
|
showDragSelectionCount = static_cast<bool>(_showDragSelectionCount);
|
||||||
|
settings->setValue("interface/showlassoselectioncount", showDragSelectionCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsCache::setShowTotalSelectionCount(QT_STATE_CHANGED_T _showTotalSelectionCount)
|
||||||
|
{
|
||||||
|
showTotalSelectionCount = static_cast<bool>(_showTotalSelectionCount);
|
||||||
|
settings->setValue("interface/showpersistentselectioncount", showTotalSelectionCount);
|
||||||
|
}
|
||||||
|
|
||||||
void SettingsCache::loadPaths()
|
void SettingsCache::loadPaths()
|
||||||
{
|
{
|
||||||
QString dataPath = getDataPath();
|
QString dataPath = getDataPath();
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,14 @@
|
||||||
/**
|
/**
|
||||||
* @file cache_settings.h
|
* @file cache_settings.h
|
||||||
* @ingroup Settings
|
* @ingroup Settings
|
||||||
* @brief TODO: Document this.
|
|
||||||
*/
|
*/
|
||||||
|
//! \todo Document this file.
|
||||||
|
|
||||||
#ifndef SETTINGSCACHE_H
|
#ifndef SETTINGSCACHE_H
|
||||||
#define SETTINGSCACHE_H
|
#define SETTINGSCACHE_H
|
||||||
|
|
||||||
|
#include "../../interface/card_picture_loader/card_picture_loader_cache_method.h"
|
||||||
|
#include "../../interface/card_picture_loader/card_picture_loader_local_schemes.h"
|
||||||
#include "shortcuts_settings.h"
|
#include "shortcuts_settings.h"
|
||||||
|
|
||||||
#include <QDate>
|
#include <QDate>
|
||||||
|
|
@ -184,6 +186,8 @@ signals:
|
||||||
void pixmapCacheSizeChanged(int newSizeInMBs);
|
void pixmapCacheSizeChanged(int newSizeInMBs);
|
||||||
void networkCacheSizeChanged(int newSizeInMBs);
|
void networkCacheSizeChanged(int newSizeInMBs);
|
||||||
void redirectCacheTtlChanged(int newTtl);
|
void redirectCacheTtlChanged(int newTtl);
|
||||||
|
void cardPictureLoaderCacheMethodChanged(int cardPictureLoaderCacheMethod);
|
||||||
|
void localCardImageStorageNamingSchemeChanged(int localCardImageStorageNamingScheme);
|
||||||
void masterVolumeChanged(int value);
|
void masterVolumeChanged(int value);
|
||||||
void chatMentionCompleterChanged();
|
void chatMentionCompleterChanged();
|
||||||
void downloadSpoilerTimeIndexChanged();
|
void downloadSpoilerTimeIndexChanged();
|
||||||
|
|
@ -205,9 +209,6 @@ private:
|
||||||
DebugSettings *debugSettings;
|
DebugSettings *debugSettings;
|
||||||
CardCounterSettings *cardCounterSettings;
|
CardCounterSettings *cardCounterSettings;
|
||||||
|
|
||||||
QByteArray mainWindowGeometry;
|
|
||||||
QByteArray tokenDialogGeometry;
|
|
||||||
QByteArray setsDialogGeometry;
|
|
||||||
QString lang;
|
QString lang;
|
||||||
QString deckPath, filtersPath, replaysPath, picsPath, redirectCachePath, customPicsPath, cardDatabasePath,
|
QString deckPath, filtersPath, replaysPath, picsPath, redirectCachePath, customPicsPath, cardDatabasePath,
|
||||||
customCardDatabasePath, themesPath, spoilerDatabasePath, tokenDatabasePath, themeName, homeTabBackgroundSource;
|
customCardDatabasePath, themesPath, spoilerDatabasePath, tokenDatabasePath, themeName, homeTabBackgroundSource;
|
||||||
|
|
@ -219,6 +220,7 @@ private:
|
||||||
bool checkCardUpdatesOnStartup;
|
bool checkCardUpdatesOnStartup;
|
||||||
int cardUpdateCheckInterval;
|
int cardUpdateCheckInterval;
|
||||||
QDate lastCardUpdateCheck;
|
QDate lastCardUpdateCheck;
|
||||||
|
bool alwaysEnableNewSets;
|
||||||
bool notifyAboutUpdates;
|
bool notifyAboutUpdates;
|
||||||
bool notifyAboutNewVersion;
|
bool notifyAboutNewVersion;
|
||||||
bool showTipsOnStartup;
|
bool showTipsOnStartup;
|
||||||
|
|
@ -238,7 +240,6 @@ private:
|
||||||
bool doNotDeleteArrowsInSubPhases;
|
bool doNotDeleteArrowsInSubPhases;
|
||||||
int startingHandSize;
|
int startingHandSize;
|
||||||
bool annotateTokens;
|
bool annotateTokens;
|
||||||
QByteArray tabGameSplitterSizes;
|
|
||||||
bool showShortcuts;
|
bool showShortcuts;
|
||||||
bool showGameSelectorFilterToolbar;
|
bool showGameSelectorFilterToolbar;
|
||||||
bool displayCardNames;
|
bool displayCardNames;
|
||||||
|
|
@ -306,6 +307,8 @@ private:
|
||||||
int pixmapCacheSize;
|
int pixmapCacheSize;
|
||||||
int networkCacheSize;
|
int networkCacheSize;
|
||||||
int redirectCacheTtl;
|
int redirectCacheTtl;
|
||||||
|
int cardPictureLoaderCacheMethod;
|
||||||
|
int localCardImageStorageNamingScheme;
|
||||||
bool scaleCards;
|
bool scaleCards;
|
||||||
int verticalCardOverlapPercent;
|
int verticalCardOverlapPercent;
|
||||||
bool showMessagePopups;
|
bool showMessagePopups;
|
||||||
|
|
@ -334,10 +337,18 @@ private:
|
||||||
[[nodiscard]] QString getSafeConfigFilePath(QString configEntry, QString defaultPath) const;
|
[[nodiscard]] QString getSafeConfigFilePath(QString configEntry, QString defaultPath) const;
|
||||||
void loadPaths();
|
void loadPaths();
|
||||||
bool rememberGameSettings;
|
bool rememberGameSettings;
|
||||||
|
|
||||||
|
// Local game settings (separate from server game settings in game/*)
|
||||||
|
bool localGameRememberSettings;
|
||||||
|
int localGameMaxPlayers;
|
||||||
|
int localGameStartingLifeTotal;
|
||||||
|
|
||||||
QList<ReleaseChannel *> releaseChannels;
|
QList<ReleaseChannel *> releaseChannels;
|
||||||
bool isPortableBuild;
|
bool isPortableBuild;
|
||||||
bool roundCardCorners;
|
bool roundCardCorners;
|
||||||
bool showStatusBar;
|
bool showStatusBar;
|
||||||
|
bool showDragSelectionCount;
|
||||||
|
bool showTotalSelectionCount;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SettingsCache();
|
SettingsCache();
|
||||||
|
|
@ -345,18 +356,6 @@ public:
|
||||||
QString getSettingsPath();
|
QString getSettingsPath();
|
||||||
[[nodiscard]] QString getCachePath() const;
|
[[nodiscard]] QString getCachePath() const;
|
||||||
[[nodiscard]] QString getNetworkCachePath() const;
|
[[nodiscard]] QString getNetworkCachePath() const;
|
||||||
[[nodiscard]] const QByteArray &getMainWindowGeometry() const
|
|
||||||
{
|
|
||||||
return mainWindowGeometry;
|
|
||||||
}
|
|
||||||
[[nodiscard]] const QByteArray &getTokenDialogGeometry() const
|
|
||||||
{
|
|
||||||
return tokenDialogGeometry;
|
|
||||||
}
|
|
||||||
[[nodiscard]] const QByteArray &getSetsDialogGeometry() const
|
|
||||||
{
|
|
||||||
return setsDialogGeometry;
|
|
||||||
}
|
|
||||||
[[nodiscard]] QString getLang() const
|
[[nodiscard]] QString getLang() const
|
||||||
{
|
{
|
||||||
return lang;
|
return lang;
|
||||||
|
|
@ -465,6 +464,14 @@ public:
|
||||||
{
|
{
|
||||||
return showStatusBar;
|
return showStatusBar;
|
||||||
}
|
}
|
||||||
|
[[nodiscard]] bool getShowDragSelectionCount() const
|
||||||
|
{
|
||||||
|
return showDragSelectionCount;
|
||||||
|
}
|
||||||
|
[[nodiscard]] bool getShowTotalSelectionCount() const
|
||||||
|
{
|
||||||
|
return showTotalSelectionCount;
|
||||||
|
}
|
||||||
[[nodiscard]] bool getNotificationsEnabled() const
|
[[nodiscard]] bool getNotificationsEnabled() const
|
||||||
{
|
{
|
||||||
return notificationsEnabled;
|
return notificationsEnabled;
|
||||||
|
|
@ -502,6 +509,10 @@ public:
|
||||||
return getLastCardUpdateCheck().daysTo(QDateTime::currentDateTime().date()) >= getCardUpdateCheckInterval() &&
|
return getLastCardUpdateCheck().daysTo(QDateTime::currentDateTime().date()) >= getCardUpdateCheckInterval() &&
|
||||||
getLastCardUpdateCheck() != QDateTime::currentDateTime().date();
|
getLastCardUpdateCheck() != QDateTime::currentDateTime().date();
|
||||||
}
|
}
|
||||||
|
[[nodiscard]] bool getAlwaysEnableNewSets() const
|
||||||
|
{
|
||||||
|
return alwaysEnableNewSets;
|
||||||
|
}
|
||||||
[[nodiscard]] bool getNotifyAboutUpdates() const override
|
[[nodiscard]] bool getNotifyAboutUpdates() const override
|
||||||
{
|
{
|
||||||
return notifyAboutUpdates;
|
return notifyAboutUpdates;
|
||||||
|
|
@ -555,10 +566,6 @@ public:
|
||||||
{
|
{
|
||||||
return annotateTokens;
|
return annotateTokens;
|
||||||
}
|
}
|
||||||
[[nodiscard]] QByteArray getTabGameSplitterSizes() const
|
|
||||||
{
|
|
||||||
return tabGameSplitterSizes;
|
|
||||||
}
|
|
||||||
[[nodiscard]] bool getShowShortcuts() const
|
[[nodiscard]] bool getShowShortcuts() const
|
||||||
{
|
{
|
||||||
return showShortcuts;
|
return showShortcuts;
|
||||||
|
|
@ -785,6 +792,10 @@ public:
|
||||||
{
|
{
|
||||||
return pixmapCacheSize;
|
return pixmapCacheSize;
|
||||||
}
|
}
|
||||||
|
[[nodiscard]] CardPictureLoaderCacheMethod::CacheMethod getCardPictureLoaderCacheMethod() const
|
||||||
|
{
|
||||||
|
return static_cast<CardPictureLoaderCacheMethod::CacheMethod>(cardPictureLoaderCacheMethod);
|
||||||
|
}
|
||||||
[[nodiscard]] int getNetworkCacheSizeInMB() const
|
[[nodiscard]] int getNetworkCacheSizeInMB() const
|
||||||
{
|
{
|
||||||
return networkCacheSize;
|
return networkCacheSize;
|
||||||
|
|
@ -793,6 +804,10 @@ public:
|
||||||
{
|
{
|
||||||
return redirectCacheTtl;
|
return redirectCacheTtl;
|
||||||
}
|
}
|
||||||
|
[[nodiscard]] CardPictureLoaderLocalSchemes::NamingScheme getLocalCardImageStorageNamingScheme() const
|
||||||
|
{
|
||||||
|
return static_cast<CardPictureLoaderLocalSchemes::NamingScheme>(localCardImageStorageNamingScheme);
|
||||||
|
}
|
||||||
[[nodiscard]] bool getScaleCards() const
|
[[nodiscard]] bool getScaleCards() const
|
||||||
{
|
{
|
||||||
return scaleCards;
|
return scaleCards;
|
||||||
|
|
@ -882,6 +897,18 @@ public:
|
||||||
{
|
{
|
||||||
return rememberGameSettings;
|
return rememberGameSettings;
|
||||||
}
|
}
|
||||||
|
[[nodiscard]] bool getLocalGameRememberSettings() const
|
||||||
|
{
|
||||||
|
return localGameRememberSettings;
|
||||||
|
}
|
||||||
|
[[nodiscard]] int getLocalGameMaxPlayers() const
|
||||||
|
{
|
||||||
|
return localGameMaxPlayers;
|
||||||
|
}
|
||||||
|
[[nodiscard]] int getLocalGameStartingLifeTotal() const
|
||||||
|
{
|
||||||
|
return localGameStartingLifeTotal;
|
||||||
|
}
|
||||||
[[nodiscard]] int getKeepAlive() const override
|
[[nodiscard]] int getKeepAlive() const override
|
||||||
{
|
{
|
||||||
return keepalive;
|
return keepalive;
|
||||||
|
|
@ -995,9 +1022,6 @@ public:
|
||||||
public slots:
|
public slots:
|
||||||
void setDownloadSpoilerStatus(bool _spoilerStatus);
|
void setDownloadSpoilerStatus(bool _spoilerStatus);
|
||||||
|
|
||||||
void setMainWindowGeometry(const QByteArray &_mainWindowGeometry);
|
|
||||||
void setTokenDialogGeometry(const QByteArray &_tokenDialog);
|
|
||||||
void setSetsDialogGeometry(const QByteArray &_setsDialog);
|
|
||||||
void setLang(const QString &_lang);
|
void setLang(const QString &_lang);
|
||||||
void setShowTipsOnStartup(bool _showTipsOnStartup);
|
void setShowTipsOnStartup(bool _showTipsOnStartup);
|
||||||
void setSeenTips(const QList<int> &_seenTips);
|
void setSeenTips(const QList<int> &_seenTips);
|
||||||
|
|
@ -1034,7 +1058,6 @@ public slots:
|
||||||
void setDoNotDeleteArrowsInSubPhases(QT_STATE_CHANGED_T _doNotDeleteArrowsInSubPhases);
|
void setDoNotDeleteArrowsInSubPhases(QT_STATE_CHANGED_T _doNotDeleteArrowsInSubPhases);
|
||||||
void setStartingHandSize(int _startingHandSize);
|
void setStartingHandSize(int _startingHandSize);
|
||||||
void setAnnotateTokens(QT_STATE_CHANGED_T _annotateTokens);
|
void setAnnotateTokens(QT_STATE_CHANGED_T _annotateTokens);
|
||||||
void setTabGameSplitterSizes(const QByteArray &_tabGameSplitterSizes);
|
|
||||||
void setShowShortcuts(QT_STATE_CHANGED_T _showShortcuts);
|
void setShowShortcuts(QT_STATE_CHANGED_T _showShortcuts);
|
||||||
void setShowGameSelectorFilterToolbar(QT_STATE_CHANGED_T _showGameSelectorFilterToolbar);
|
void setShowGameSelectorFilterToolbar(QT_STATE_CHANGED_T _showGameSelectorFilterToolbar);
|
||||||
void setDisplayCardNames(QT_STATE_CHANGED_T _displayCardNames);
|
void setDisplayCardNames(QT_STATE_CHANGED_T _displayCardNames);
|
||||||
|
|
@ -1089,8 +1112,11 @@ public slots:
|
||||||
void setIgnoreUnregisteredUsers(QT_STATE_CHANGED_T _ignoreUnregisteredUsers);
|
void setIgnoreUnregisteredUsers(QT_STATE_CHANGED_T _ignoreUnregisteredUsers);
|
||||||
void setIgnoreUnregisteredUserMessages(QT_STATE_CHANGED_T _ignoreUnregisteredUserMessages);
|
void setIgnoreUnregisteredUserMessages(QT_STATE_CHANGED_T _ignoreUnregisteredUserMessages);
|
||||||
void setPixmapCacheSize(const int _pixmapCacheSize);
|
void setPixmapCacheSize(const int _pixmapCacheSize);
|
||||||
|
void setCardImageCacheMethod(CardPictureLoaderCacheMethod::CacheMethod _cardImageCachingMethod);
|
||||||
void setNetworkCacheSizeInMB(const int _networkCacheSize);
|
void setNetworkCacheSizeInMB(const int _networkCacheSize);
|
||||||
void setNetworkRedirectCacheTtl(const int _redirectCacheTtl);
|
void setNetworkRedirectCacheTtl(const int _redirectCacheTtl);
|
||||||
|
void setLocalCardImageStorageNamingScheme(
|
||||||
|
const CardPictureLoaderLocalSchemes::NamingScheme _localCardImageStorageNamingScheme);
|
||||||
void setCardScaling(const QT_STATE_CHANGED_T _scaleCards);
|
void setCardScaling(const QT_STATE_CHANGED_T _scaleCards);
|
||||||
void setStackCardOverlapPercent(const int _verticalCardOverlapPercent);
|
void setStackCardOverlapPercent(const int _verticalCardOverlapPercent);
|
||||||
void setShowMessagePopups(const QT_STATE_CHANGED_T _showMessagePopups);
|
void setShowMessagePopups(const QT_STATE_CHANGED_T _showMessagePopups);
|
||||||
|
|
@ -1113,15 +1139,21 @@ public slots:
|
||||||
void setDefaultStartingLifeTotal(const int _defaultStartingLifeTotal);
|
void setDefaultStartingLifeTotal(const int _defaultStartingLifeTotal);
|
||||||
void setShareDecklistsOnLoad(const bool _shareDecklistsOnLoad);
|
void setShareDecklistsOnLoad(const bool _shareDecklistsOnLoad);
|
||||||
void setRememberGameSettings(const bool _rememberGameSettings);
|
void setRememberGameSettings(const bool _rememberGameSettings);
|
||||||
|
void setLocalGameRememberSettings(bool value);
|
||||||
|
void setLocalGameMaxPlayers(int value);
|
||||||
|
void setLocalGameStartingLifeTotal(int value);
|
||||||
void setCheckUpdatesOnStartup(QT_STATE_CHANGED_T value);
|
void setCheckUpdatesOnStartup(QT_STATE_CHANGED_T value);
|
||||||
void setStartupCardUpdateCheckPromptForUpdate(bool value);
|
void setStartupCardUpdateCheckPromptForUpdate(bool value);
|
||||||
void setStartupCardUpdateCheckAlwaysUpdate(bool value);
|
void setStartupCardUpdateCheckAlwaysUpdate(bool value);
|
||||||
void setCardUpdateCheckInterval(int value);
|
void setCardUpdateCheckInterval(int value);
|
||||||
void setLastCardUpdateCheck(QDate value);
|
void setLastCardUpdateCheck(QDate value);
|
||||||
|
void setAlwaysEnableNewSets(bool value);
|
||||||
void setNotifyAboutUpdate(QT_STATE_CHANGED_T _notifyaboutupdate);
|
void setNotifyAboutUpdate(QT_STATE_CHANGED_T _notifyaboutupdate);
|
||||||
void setNotifyAboutNewVersion(QT_STATE_CHANGED_T _notifyaboutnewversion);
|
void setNotifyAboutNewVersion(QT_STATE_CHANGED_T _notifyaboutnewversion);
|
||||||
void setUpdateReleaseChannelIndex(int value);
|
void setUpdateReleaseChannelIndex(int value);
|
||||||
void setMaxFontSize(int _max);
|
void setMaxFontSize(int _max);
|
||||||
void setRoundCardCorners(bool _roundCardCorners);
|
void setRoundCardCorners(bool _roundCardCorners);
|
||||||
|
void setShowDragSelectionCount(QT_STATE_CHANGED_T _showDragSelectionCount);
|
||||||
|
void setShowTotalSelectionCount(QT_STATE_CHANGED_T _showTotalSelectionCount);
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,13 @@ CardCounterSettings::CardCounterSettings(const QString &settingsPath, QObject *p
|
||||||
|
|
||||||
void CardCounterSettings::setColor(int counterId, const QColor &color)
|
void CardCounterSettings::setColor(int counterId, const QColor &color)
|
||||||
{
|
{
|
||||||
|
QSettings settings = getSettings();
|
||||||
|
|
||||||
QString key = QString("cards/counters/%1/color").arg(counterId);
|
QString key = QString("cards/counters/%1/color").arg(counterId);
|
||||||
|
|
||||||
if (settings.value(key).value<QColor>() == color)
|
if (settings.value(key).value<QColor>() == color) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
settings.setValue(key, color);
|
settings.setValue(key, color);
|
||||||
emit colorChanged(counterId, color);
|
emit colorChanged(counterId, color);
|
||||||
|
|
@ -36,7 +39,7 @@ QColor CardCounterSettings::color(int counterId) const
|
||||||
defaultColor = QColor::fromHsv(h, s, v);
|
defaultColor = QColor::fromHsv(h, s, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
return settings.value(QString("cards/counters/%1/color").arg(counterId), defaultColor).value<QColor>();
|
return getSettings().value(QString("cards/counters/%1/color").arg(counterId), defaultColor).value<QColor>();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CardCounterSettings::displayName(int counterId) const
|
QString CardCounterSettings::displayName(int counterId) const
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/**
|
/**
|
||||||
* @file card_counter_settings.h
|
* @file card_counter_settings.h
|
||||||
* @ingroup GameSettings
|
* @ingroup GameSettings
|
||||||
* @brief TODO: Document this.
|
|
||||||
*/
|
*/
|
||||||
|
//! \todo Document this file.
|
||||||
|
|
||||||
#ifndef CARD_COUNTER_SETTINGS_H
|
#ifndef CARD_COUNTER_SETTINGS_H
|
||||||
#define CARD_COUNTER_SETTINGS_H
|
#define CARD_COUNTER_SETTINGS_H
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/**
|
/**
|
||||||
* @file shortcut_treeview.h
|
* @file shortcut_treeview.h
|
||||||
* @ingroup CoreSettings
|
* @ingroup CoreSettings
|
||||||
* @brief TODO: Document this.
|
|
||||||
*/
|
*/
|
||||||
|
//! \todo Document this file.
|
||||||
|
|
||||||
#ifndef SHORTCUT_TREEVIEW_H
|
#ifndef SHORTCUT_TREEVIEW_H
|
||||||
#define SHORTCUT_TREEVIEW_H
|
#define SHORTCUT_TREEVIEW_H
|
||||||
|
|
|
||||||
|
|
@ -64,8 +64,13 @@ ShortcutsSettings::ShortcutsSettings(const QString &settingsPath, QObject *paren
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// PR 5079 changes Textbox/unfocusTextBox to Player/unfocusTextBox and tab_game/aFocusChat to Player/aFocusChat.
|
/**
|
||||||
/// A migration is necessary to let players keep their already configured shortcuts.
|
* @brief Migrates legacy shortcut key names to current naming scheme.
|
||||||
|
*
|
||||||
|
* PR 5079 changed Textbox/unfocusTextBox to Player/unfocusTextBox and
|
||||||
|
* tab_game/aFocusChat to Player/aFocusChat. This migration allows players
|
||||||
|
* to keep their already configured shortcuts.
|
||||||
|
*/
|
||||||
void ShortcutsSettings::migrateShortcuts()
|
void ShortcutsSettings::migrateShortcuts()
|
||||||
{
|
{
|
||||||
if (QFile(settingsFilePath).exists()) {
|
if (QFile(settingsFilePath).exists()) {
|
||||||
|
|
@ -236,9 +241,7 @@ bool ShortcutsSettings::isValid(const QString &name, const QString &sequences) c
|
||||||
return findOverlaps(name, sequences).isEmpty();
|
return findOverlaps(name, sequences).isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** @brief Checks if the shortcut is a shortcut that is active in all windows. */
|
||||||
* Checks if the shortcut is a shortcut that is active in all windows
|
|
||||||
*/
|
|
||||||
static bool isAlwaysActiveShortcut(const QString &shortcutName)
|
static bool isAlwaysActiveShortcut(const QString &shortcutName)
|
||||||
{
|
{
|
||||||
return shortcutName.startsWith("MainWindow") || shortcutName.startsWith("Tabs");
|
return shortcutName.startsWith("MainWindow") || shortcutName.startsWith("Tabs");
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/**
|
/**
|
||||||
* @file shortcuts_settings.h
|
* @file shortcuts_settings.h
|
||||||
* @ingroup CoreSettings
|
* @ingroup CoreSettings
|
||||||
* @brief TODO: Document this.
|
|
||||||
*/
|
*/
|
||||||
|
//! \todo Document this file.
|
||||||
|
|
||||||
#ifndef SHORTCUTSSETTINGS_H
|
#ifndef SHORTCUTSSETTINGS_H
|
||||||
#define SHORTCUTSSETTINGS_H
|
#define SHORTCUTSSETTINGS_H
|
||||||
|
|
@ -501,7 +501,7 @@ private:
|
||||||
{"Player/aUntapAll", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Untap All"),
|
{"Player/aUntapAll", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Untap All"),
|
||||||
parseSequenceString("Ctrl+U"),
|
parseSequenceString("Ctrl+U"),
|
||||||
ShortcutGroup::Playing_Area)},
|
ShortcutGroup::Playing_Area)},
|
||||||
{"Player/aDoesntUntap", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Toggle Untap"),
|
{"Player/aDoesntUntap", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Toggle Skip Untapping"),
|
||||||
parseSequenceString("Alt+U"),
|
parseSequenceString("Alt+U"),
|
||||||
ShortcutGroup::Playing_Area)},
|
ShortcutGroup::Playing_Area)},
|
||||||
{"Player/aFlip", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Turn Card Over"),
|
{"Player/aFlip", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Turn Card Over"),
|
||||||
|
|
@ -513,6 +513,9 @@ private:
|
||||||
{"Player/aPlay", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Play Card"),
|
{"Player/aPlay", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Play Card"),
|
||||||
parseSequenceString(""),
|
parseSequenceString(""),
|
||||||
ShortcutGroup::Playing_Area)},
|
ShortcutGroup::Playing_Area)},
|
||||||
|
{"Player/aPlayFacedown", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Play Card, Face Down"),
|
||||||
|
parseSequenceString(""),
|
||||||
|
ShortcutGroup::Playing_Area)},
|
||||||
{"Player/aAttach", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Attach Card..."),
|
{"Player/aAttach", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Attach Card..."),
|
||||||
parseSequenceString("Ctrl+Alt+A"),
|
parseSequenceString("Ctrl+Alt+A"),
|
||||||
ShortcutGroup::Playing_Area)},
|
ShortcutGroup::Playing_Area)},
|
||||||
|
|
@ -534,6 +537,9 @@ private:
|
||||||
{"Player/aSetAnnotation", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Set Annotation..."),
|
{"Player/aSetAnnotation", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Set Annotation..."),
|
||||||
parseSequenceString("Alt+N"),
|
parseSequenceString("Alt+N"),
|
||||||
ShortcutGroup::Playing_Area)},
|
ShortcutGroup::Playing_Area)},
|
||||||
|
{"Player/aReduceLifeByPower", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Reduce Life by Power"),
|
||||||
|
parseSequenceString("Ctrl+Shift+L"),
|
||||||
|
ShortcutGroup::Playing_Area)},
|
||||||
{"Player/aSelectAll", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Select All Cards in Zone"),
|
{"Player/aSelectAll", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Select All Cards in Zone"),
|
||||||
parseSequenceString("Ctrl+A"),
|
parseSequenceString("Ctrl+A"),
|
||||||
ShortcutGroup::Playing_Area)},
|
ShortcutGroup::Playing_Area)},
|
||||||
|
|
@ -560,12 +566,9 @@ private:
|
||||||
{"Player/aMoveToTopLibrary", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Top of Library"),
|
{"Player/aMoveToTopLibrary", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Top of Library"),
|
||||||
parseSequenceString(""),
|
parseSequenceString(""),
|
||||||
ShortcutGroup::Move_selected)},
|
ShortcutGroup::Move_selected)},
|
||||||
{"Player/aPlayFacedown", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Battlefield, Face Down"),
|
{"Player/aMoveToTable", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Battlefield"),
|
||||||
parseSequenceString(""),
|
parseSequenceString(""),
|
||||||
ShortcutGroup::Move_selected)},
|
ShortcutGroup::Move_selected)},
|
||||||
{"Player/aPlay", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Battlefield"),
|
|
||||||
parseSequenceString(""),
|
|
||||||
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/aViewGraveyard",
|
{"Player/aViewGraveyard",
|
||||||
|
|
@ -598,11 +601,19 @@ private:
|
||||||
{"Player/aMoveTopCardsToGraveyard", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Graveyard (Multiple)"),
|
{"Player/aMoveTopCardsToGraveyard", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Graveyard (Multiple)"),
|
||||||
parseSequenceString("Alt+M"),
|
parseSequenceString("Alt+M"),
|
||||||
ShortcutGroup::Move_top)},
|
ShortcutGroup::Move_top)},
|
||||||
|
{"Player/aMoveTopCardsToGraveyardFaceDown",
|
||||||
|
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Graveyard (Multiple), Face Down"),
|
||||||
|
parseSequenceString(""),
|
||||||
|
ShortcutGroup::Move_top)},
|
||||||
{"Player/aMoveTopCardToExile",
|
{"Player/aMoveTopCardToExile",
|
||||||
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Exile"), parseSequenceString(""), ShortcutGroup::Move_top)},
|
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Exile"), parseSequenceString(""), ShortcutGroup::Move_top)},
|
||||||
{"Player/aMoveTopCardsToExile", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Exile (Multiple)"),
|
{"Player/aMoveTopCardsToExile", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Exile (Multiple)"),
|
||||||
parseSequenceString(""),
|
parseSequenceString(""),
|
||||||
ShortcutGroup::Move_top)},
|
ShortcutGroup::Move_top)},
|
||||||
|
{"Player/aMoveTopCardsToExileFaceDown",
|
||||||
|
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Exile (Multiple), Face Down"),
|
||||||
|
parseSequenceString(""),
|
||||||
|
ShortcutGroup::Move_top)},
|
||||||
{"Player/aMoveTopCardsUntil", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Stack Until Found"),
|
{"Player/aMoveTopCardsUntil", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Stack Until Found"),
|
||||||
parseSequenceString("Ctrl+Shift+Y"),
|
parseSequenceString("Ctrl+Shift+Y"),
|
||||||
ShortcutGroup::Move_top)},
|
ShortcutGroup::Move_top)},
|
||||||
|
|
@ -620,11 +631,19 @@ private:
|
||||||
{"Player/aMoveBottomCardsToGrave", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Graveyard (Multiple)"),
|
{"Player/aMoveBottomCardsToGrave", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Graveyard (Multiple)"),
|
||||||
parseSequenceString(""),
|
parseSequenceString(""),
|
||||||
ShortcutGroup::Move_bottom)},
|
ShortcutGroup::Move_bottom)},
|
||||||
|
{"Player/aMoveBottomCardsToGraveFaceDown",
|
||||||
|
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Graveyard (Multiple), Face Down"),
|
||||||
|
parseSequenceString(""),
|
||||||
|
ShortcutGroup::Move_bottom)},
|
||||||
{"Player/aMoveBottomCardToExile",
|
{"Player/aMoveBottomCardToExile",
|
||||||
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Exile"), parseSequenceString(""), ShortcutGroup::Move_bottom)},
|
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Exile"), parseSequenceString(""), ShortcutGroup::Move_bottom)},
|
||||||
{"Player/aMoveBottomCardsToExile", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Exile (Multiple)"),
|
{"Player/aMoveBottomCardsToExile", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Exile (Multiple)"),
|
||||||
parseSequenceString(""),
|
parseSequenceString(""),
|
||||||
ShortcutGroup::Move_bottom)},
|
ShortcutGroup::Move_bottom)},
|
||||||
|
{"Player/aMoveBottomCardsToExileFaceDown",
|
||||||
|
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Exile (Multiple), Face Down"),
|
||||||
|
parseSequenceString(""),
|
||||||
|
ShortcutGroup::Move_bottom)},
|
||||||
{"Player/aMoveBottomCardToTop", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Top of Library"),
|
{"Player/aMoveBottomCardToTop", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Top of Library"),
|
||||||
parseSequenceString(""),
|
parseSequenceString(""),
|
||||||
ShortcutGroup::Move_bottom)},
|
ShortcutGroup::Move_bottom)},
|
||||||
|
|
@ -648,6 +667,9 @@ private:
|
||||||
{"Player/aRollDie", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Roll Dice..."),
|
{"Player/aRollDie", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Roll Dice..."),
|
||||||
parseSequenceString("Ctrl+I"),
|
parseSequenceString("Ctrl+I"),
|
||||||
ShortcutGroup::Gameplay)},
|
ShortcutGroup::Gameplay)},
|
||||||
|
{"Player/aFlipCoin", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Flip Coin"),
|
||||||
|
parseSequenceString("Ctrl+Shift+I"),
|
||||||
|
ShortcutGroup::Gameplay)},
|
||||||
{"Player/aShuffle", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Shuffle Library"),
|
{"Player/aShuffle", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Shuffle Library"),
|
||||||
parseSequenceString("Ctrl+S"),
|
parseSequenceString("Ctrl+S"),
|
||||||
ShortcutGroup::Gameplay)},
|
ShortcutGroup::Gameplay)},
|
||||||
|
|
|
||||||
|
|
@ -105,8 +105,9 @@ QStringMap &SoundEngine::getAvailableThemes()
|
||||||
dir.setPath(SettingsCache::instance().getDataPath() + "/sounds");
|
dir.setPath(SettingsCache::instance().getDataPath() + "/sounds");
|
||||||
|
|
||||||
for (const QString &themeName : dir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot, QDir::Name)) {
|
for (const QString &themeName : dir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot, QDir::Name)) {
|
||||||
if (!availableThemes.contains(themeName))
|
if (!availableThemes.contains(themeName)) {
|
||||||
availableThemes.insert(themeName, dir.absoluteFilePath(themeName));
|
availableThemes.insert(themeName, dir.absoluteFilePath(themeName));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// load themes from cockatrice system dir
|
// load themes from cockatrice system dir
|
||||||
|
|
@ -121,8 +122,9 @@ QStringMap &SoundEngine::getAvailableThemes()
|
||||||
);
|
);
|
||||||
|
|
||||||
for (const QString &themeName : dir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot, QDir::Name)) {
|
for (const QString &themeName : dir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot, QDir::Name)) {
|
||||||
if (!availableThemes.contains(themeName))
|
if (!availableThemes.contains(themeName)) {
|
||||||
availableThemes.insert(themeName, dir.absoluteFilePath(themeName));
|
availableThemes.insert(themeName, dir.absoluteFilePath(themeName));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return availableThemes;
|
return availableThemes;
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/**
|
/**
|
||||||
* @file sound_engine.h
|
* @file sound_engine.h
|
||||||
* @ingroup Core
|
* @ingroup Core
|
||||||
* @brief TODO: Document this.
|
|
||||||
*/
|
*/
|
||||||
|
//! \todo Document this file.
|
||||||
|
|
||||||
#ifndef SOUNDENGINE_H
|
#ifndef SOUNDENGINE_H
|
||||||
#define SOUNDENGINE_H
|
#define SOUNDENGINE_H
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ GenericQuery <- String
|
||||||
|
|
||||||
NonDoubleQuoteUnlessEscaped <- '\\\"'. / !["].
|
NonDoubleQuoteUnlessEscaped <- '\\\"'. / !["].
|
||||||
NonSingleQuoteUnlessEscaped <- "\\\'". / !['].
|
NonSingleQuoteUnlessEscaped <- "\\\'". / !['].
|
||||||
UnescapedStringListPart <- !['":<>=! ].
|
UnescapedStringListPart <- !['":<>()=! ].
|
||||||
SingleApostropheString <- (UnescapedStringListPart+ ws*)* ['] (UnescapedStringListPart+ ws*)*
|
SingleApostropheString <- (UnescapedStringListPart+ ws*)* ['] (UnescapedStringListPart+ ws*)*
|
||||||
|
|
||||||
String <- SingleApostropheString / UnescapedStringListPart+ / ["] <NonDoubleQuoteUnlessEscaped*> ["] / ['] <NonSingleQuoteUnlessEscaped*> [']
|
String <- SingleApostropheString / UnescapedStringListPart+ / ["] <NonDoubleQuoteUnlessEscaped*> ["] / ['] <NonSingleQuoteUnlessEscaped*> [']
|
||||||
|
|
@ -88,20 +88,27 @@ static void setupParserRules()
|
||||||
const auto arg = std::any_cast<int>(sv[1]);
|
const auto arg = std::any_cast<int>(sv[1]);
|
||||||
const auto op = std::any_cast<QString>(sv[0]);
|
const auto op = std::any_cast<QString>(sv[0]);
|
||||||
|
|
||||||
if (op == ">")
|
if (op == ">") {
|
||||||
return [=](const int s) { return s > arg; };
|
return [=](const int s) { return s > arg; };
|
||||||
if (op == ">=")
|
}
|
||||||
|
if (op == ">=") {
|
||||||
return [=](const int s) { return s >= arg; };
|
return [=](const int s) { return s >= arg; };
|
||||||
if (op == "<")
|
}
|
||||||
|
if (op == "<") {
|
||||||
return [=](const int s) { return s < arg; };
|
return [=](const int s) { return s < arg; };
|
||||||
if (op == "<=")
|
}
|
||||||
|
if (op == "<=") {
|
||||||
return [=](const int s) { return s <= arg; };
|
return [=](const int s) { return s <= arg; };
|
||||||
if (op == "=")
|
}
|
||||||
|
if (op == "=") {
|
||||||
return [=](const int s) { return s == arg; };
|
return [=](const int s) { return s == arg; };
|
||||||
if (op == ":")
|
}
|
||||||
|
if (op == ":") {
|
||||||
return [=](const int s) { return s == arg; };
|
return [=](const int s) { return s == arg; };
|
||||||
if (op == "!=")
|
}
|
||||||
|
if (op == "!=") {
|
||||||
return [=](const int s) { return s != arg; };
|
return [=](const int s) { return s != arg; };
|
||||||
|
}
|
||||||
return [](int) { return false; };
|
return [](int) { return false; };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/**
|
/**
|
||||||
* @file deck_filter_string.h
|
* @file deck_filter_string.h
|
||||||
* @ingroup DeckStorageWidgets
|
* @ingroup DeckStorageWidgets
|
||||||
* @brief TODO: Document this.
|
|
||||||
*/
|
*/
|
||||||
|
//! \todo Document this file.
|
||||||
|
|
||||||
#ifndef DECK_FILTER_STRING_H
|
#ifndef DECK_FILTER_STRING_H
|
||||||
#define DECK_FILTER_STRING_H
|
#define DECK_FILTER_STRING_H
|
||||||
|
|
|
||||||
|
|
@ -11,13 +11,15 @@ FilterBuilder::FilterBuilder(QWidget *parent) : QWidget(parent)
|
||||||
{
|
{
|
||||||
filterCombo = new QComboBox;
|
filterCombo = new QComboBox;
|
||||||
filterCombo->setObjectName("filterCombo");
|
filterCombo->setObjectName("filterCombo");
|
||||||
for (int i = 0; i < CardFilter::AttrEnd; i++)
|
for (int i = 0; i < CardFilter::AttrEnd; i++) {
|
||||||
filterCombo->addItem(CardFilter::attrName(static_cast<CardFilter::Attr>(i)), QVariant(i));
|
filterCombo->addItem(CardFilter::attrName(static_cast<CardFilter::Attr>(i)), QVariant(i));
|
||||||
|
}
|
||||||
|
|
||||||
typeCombo = new QComboBox;
|
typeCombo = new QComboBox;
|
||||||
typeCombo->setObjectName("typeCombo");
|
typeCombo->setObjectName("typeCombo");
|
||||||
for (int i = 0; i < CardFilter::TypeEnd; i++)
|
for (int i = 0; i < CardFilter::TypeEnd; i++) {
|
||||||
typeCombo->addItem(CardFilter::typeName(static_cast<CardFilter::Type>(i)), QVariant(i));
|
typeCombo->addItem(CardFilter::typeName(static_cast<CardFilter::Type>(i)), QVariant(i));
|
||||||
|
}
|
||||||
|
|
||||||
QPushButton *ok = new QPushButton(QPixmap("theme:icons/increment"), QString());
|
QPushButton *ok = new QPushButton(QPixmap("theme:icons/increment"), QString());
|
||||||
ok->setObjectName("ok");
|
ok->setObjectName("ok");
|
||||||
|
|
@ -53,8 +55,9 @@ FilterBuilder::~FilterBuilder()
|
||||||
|
|
||||||
void FilterBuilder::destroyFilter()
|
void FilterBuilder::destroyFilter()
|
||||||
{
|
{
|
||||||
if (fltr)
|
if (fltr) {
|
||||||
delete fltr;
|
delete fltr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int comboCurrentIntData(const QComboBox *combo)
|
static int comboCurrentIntData(const QComboBox *combo)
|
||||||
|
|
@ -67,8 +70,9 @@ void FilterBuilder::emit_add()
|
||||||
QString txt;
|
QString txt;
|
||||||
|
|
||||||
txt = edit->text();
|
txt = edit->text();
|
||||||
if (txt.length() < 1)
|
if (txt.length() < 1) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
destroyFilter();
|
destroyFilter();
|
||||||
fltr = new CardFilter(txt, static_cast<CardFilter::Type>(comboCurrentIntData(typeCombo)),
|
fltr = new CardFilter(txt, static_cast<CardFilter::Type>(comboCurrentIntData(typeCombo)),
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/**
|
/**
|
||||||
* @file filter_builder.h
|
* @file filter_builder.h
|
||||||
* @ingroup CardDatabaseModelFilters
|
* @ingroup CardDatabaseModelFilters
|
||||||
* @brief TODO: Document this.
|
|
||||||
*/
|
*/
|
||||||
|
//! \todo Document this file.
|
||||||
|
|
||||||
#ifndef FILTERBUILDER_H
|
#ifndef FILTERBUILDER_H
|
||||||
#define FILTERBUILDER_H
|
#define FILTERBUILDER_H
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,9 @@ void FilterTreeModel::proxyBeginInsertRow(const FilterTreeNode *node, int i)
|
||||||
int idx;
|
int idx;
|
||||||
|
|
||||||
idx = node->index();
|
idx = node->index();
|
||||||
if (idx >= 0)
|
if (idx >= 0) {
|
||||||
beginInsertRows(createIndex(idx, 0, (void *)node), i, i);
|
beginInsertRows(createIndex(idx, 0, (void *)node), i, i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FilterTreeModel::proxyEndInsertRow(const FilterTreeNode *node, int)
|
void FilterTreeModel::proxyEndInsertRow(const FilterTreeNode *node, int)
|
||||||
|
|
@ -32,8 +33,9 @@ void FilterTreeModel::proxyEndInsertRow(const FilterTreeNode *node, int)
|
||||||
int idx;
|
int idx;
|
||||||
|
|
||||||
idx = node->index();
|
idx = node->index();
|
||||||
if (idx >= 0)
|
if (idx >= 0) {
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FilterTreeModel::proxyBeginRemoveRow(const FilterTreeNode *node, int i)
|
void FilterTreeModel::proxyBeginRemoveRow(const FilterTreeNode *node, int i)
|
||||||
|
|
@ -41,8 +43,9 @@ void FilterTreeModel::proxyBeginRemoveRow(const FilterTreeNode *node, int i)
|
||||||
int idx;
|
int idx;
|
||||||
|
|
||||||
idx = node->index();
|
idx = node->index();
|
||||||
if (idx >= 0)
|
if (idx >= 0) {
|
||||||
beginRemoveRows(createIndex(idx, 0, (void *)node), i, i);
|
beginRemoveRows(createIndex(idx, 0, (void *)node), i, i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FilterTreeModel::proxyEndRemoveRow(const FilterTreeNode *node, int)
|
void FilterTreeModel::proxyEndRemoveRow(const FilterTreeNode *node, int)
|
||||||
|
|
@ -50,8 +53,9 @@ void FilterTreeModel::proxyEndRemoveRow(const FilterTreeNode *node, int)
|
||||||
int idx;
|
int idx;
|
||||||
|
|
||||||
idx = node->index();
|
idx = node->index();
|
||||||
if (idx >= 0)
|
if (idx >= 0) {
|
||||||
endRemoveRows();
|
endRemoveRows();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FilterTreeNode *FilterTreeModel::indexToNode(const QModelIndex &idx) const
|
FilterTreeNode *FilterTreeModel::indexToNode(const QModelIndex &idx) const
|
||||||
|
|
@ -59,12 +63,14 @@ FilterTreeNode *FilterTreeModel::indexToNode(const QModelIndex &idx) const
|
||||||
void *ip;
|
void *ip;
|
||||||
FilterTreeNode *node;
|
FilterTreeNode *node;
|
||||||
|
|
||||||
if (!idx.isValid())
|
if (!idx.isValid()) {
|
||||||
return fTree;
|
return fTree;
|
||||||
|
}
|
||||||
|
|
||||||
ip = idx.internalPointer();
|
ip = idx.internalPointer();
|
||||||
if (ip == NULL)
|
if (ip == NULL) {
|
||||||
return fTree;
|
return fTree;
|
||||||
|
}
|
||||||
|
|
||||||
node = static_cast<FilterTreeNode *>(ip);
|
node = static_cast<FilterTreeNode *>(ip);
|
||||||
return node;
|
return node;
|
||||||
|
|
@ -145,14 +151,16 @@ int FilterTreeModel::rowCount(const QModelIndex &parent) const
|
||||||
const FilterTreeNode *node;
|
const FilterTreeNode *node;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
if (parent.column() > 0)
|
if (parent.column() > 0) {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
node = indexToNode(parent);
|
node = indexToNode(parent);
|
||||||
if (node)
|
if (node) {
|
||||||
result = node->childCount();
|
result = node->childCount();
|
||||||
else
|
} else {
|
||||||
result = 0;
|
result = 0;
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
@ -166,14 +174,17 @@ QVariant FilterTreeModel::data(const QModelIndex &index, int role) const
|
||||||
{
|
{
|
||||||
const FilterTreeNode *node;
|
const FilterTreeNode *node;
|
||||||
|
|
||||||
if (!index.isValid())
|
if (!index.isValid()) {
|
||||||
return QVariant();
|
return QVariant();
|
||||||
if (index.column() >= columnCount())
|
}
|
||||||
|
if (index.column() >= columnCount()) {
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
}
|
||||||
|
|
||||||
node = indexToNode(index);
|
node = indexToNode(index);
|
||||||
if (node == NULL)
|
if (node == NULL) {
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
}
|
||||||
|
|
||||||
switch (role) {
|
switch (role) {
|
||||||
case Qt::FontRole:
|
case Qt::FontRole:
|
||||||
|
|
@ -190,10 +201,11 @@ QVariant FilterTreeModel::data(const QModelIndex &index, int role) const
|
||||||
case Qt::WhatsThisRole:
|
case Qt::WhatsThisRole:
|
||||||
return node->text();
|
return node->text();
|
||||||
case Qt::CheckStateRole:
|
case Qt::CheckStateRole:
|
||||||
if (node->isEnabled())
|
if (node->isEnabled()) {
|
||||||
return Qt::Checked;
|
return Qt::Checked;
|
||||||
else
|
} else {
|
||||||
return Qt::Unchecked;
|
return Qt::Unchecked;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
@ -205,22 +217,27 @@ bool FilterTreeModel::setData(const QModelIndex &index, const QVariant &value, i
|
||||||
{
|
{
|
||||||
FilterTreeNode *node;
|
FilterTreeNode *node;
|
||||||
|
|
||||||
if (!index.isValid())
|
if (!index.isValid()) {
|
||||||
return false;
|
return false;
|
||||||
if (index.column() >= columnCount())
|
}
|
||||||
|
if (index.column() >= columnCount()) {
|
||||||
return false;
|
return false;
|
||||||
if (role != Qt::CheckStateRole)
|
}
|
||||||
|
if (role != Qt::CheckStateRole) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
node = indexToNode(index);
|
node = indexToNode(index);
|
||||||
if (node == NULL || node == fTree)
|
if (node == NULL || node == fTree) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Qt::CheckState state = static_cast<Qt::CheckState>(value.toInt());
|
Qt::CheckState state = static_cast<Qt::CheckState>(value.toInt());
|
||||||
if (state == Qt::Checked)
|
if (state == Qt::Checked) {
|
||||||
node->enable();
|
node->enable();
|
||||||
else
|
} else {
|
||||||
node->disable();
|
node->disable();
|
||||||
|
}
|
||||||
|
|
||||||
emit dataChanged(index, index);
|
emit dataChanged(index, index);
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -231,16 +248,19 @@ Qt::ItemFlags FilterTreeModel::flags(const QModelIndex &index) const
|
||||||
const FilterTreeNode *node;
|
const FilterTreeNode *node;
|
||||||
Qt::ItemFlags result;
|
Qt::ItemFlags result;
|
||||||
|
|
||||||
if (!index.isValid())
|
if (!index.isValid()) {
|
||||||
return Qt::NoItemFlags;
|
return Qt::NoItemFlags;
|
||||||
|
}
|
||||||
|
|
||||||
node = indexToNode(index);
|
node = indexToNode(index);
|
||||||
if (node == NULL)
|
if (node == NULL) {
|
||||||
return Qt::NoItemFlags;
|
return Qt::NoItemFlags;
|
||||||
|
}
|
||||||
|
|
||||||
result = Qt::ItemIsEnabled;
|
result = Qt::ItemIsEnabled;
|
||||||
if (node == fTree)
|
if (node == fTree) {
|
||||||
return result;
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
result |= Qt::ItemIsSelectable;
|
result |= Qt::ItemIsSelectable;
|
||||||
result |= Qt::ItemIsUserCheckable;
|
result |= Qt::ItemIsUserCheckable;
|
||||||
|
|
@ -252,8 +272,9 @@ QModelIndex FilterTreeModel::nodeIndex(const FilterTreeNode *node, int row, int
|
||||||
{
|
{
|
||||||
FilterTreeNode *child;
|
FilterTreeNode *child;
|
||||||
|
|
||||||
if (column > 0 || row >= node->childCount())
|
if (column > 0 || row >= node->childCount()) {
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
|
}
|
||||||
|
|
||||||
child = node->nodeAt(row);
|
child = node->nodeAt(row);
|
||||||
return createIndex(row, column, child);
|
return createIndex(row, column, child);
|
||||||
|
|
@ -263,12 +284,14 @@ QModelIndex FilterTreeModel::index(int row, int column, const QModelIndex &paren
|
||||||
{
|
{
|
||||||
const FilterTreeNode *node;
|
const FilterTreeNode *node;
|
||||||
|
|
||||||
if (!hasIndex(row, column, parent))
|
if (!hasIndex(row, column, parent)) {
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
|
}
|
||||||
|
|
||||||
node = indexToNode(parent);
|
node = indexToNode(parent);
|
||||||
if (node == NULL)
|
if (node == NULL) {
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
|
}
|
||||||
|
|
||||||
return nodeIndex(node, row, column);
|
return nodeIndex(node, row, column);
|
||||||
}
|
}
|
||||||
|
|
@ -279,18 +302,21 @@ QModelIndex FilterTreeModel::parent(const QModelIndex &ind) const
|
||||||
FilterTreeNode *parent;
|
FilterTreeNode *parent;
|
||||||
QModelIndex idx;
|
QModelIndex idx;
|
||||||
|
|
||||||
if (!ind.isValid())
|
if (!ind.isValid()) {
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
|
}
|
||||||
|
|
||||||
node = indexToNode(ind);
|
node = indexToNode(ind);
|
||||||
if (node == NULL || node == fTree)
|
if (node == NULL || node == fTree) {
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
|
}
|
||||||
|
|
||||||
parent = node->parent();
|
parent = node->parent();
|
||||||
if (parent) {
|
if (parent) {
|
||||||
int row = parent->index();
|
int row = parent->index();
|
||||||
if (row < 0)
|
if (row < 0) {
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
|
}
|
||||||
idx = createIndex(row, 0, parent);
|
idx = createIndex(row, 0, parent);
|
||||||
return idx;
|
return idx;
|
||||||
}
|
}
|
||||||
|
|
@ -304,18 +330,22 @@ bool FilterTreeModel::removeRows(int row, int count, const QModelIndex &parent)
|
||||||
int i, last;
|
int i, last;
|
||||||
|
|
||||||
last = row + count - 1;
|
last = row + count - 1;
|
||||||
if (!parent.isValid() || count < 1 || row < 0)
|
if (!parent.isValid() || count < 1 || row < 0) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
node = indexToNode(parent);
|
node = indexToNode(parent);
|
||||||
if (node == NULL || last >= node->childCount())
|
if (node == NULL || last >= node->childCount()) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++) {
|
||||||
node->deleteAt(row);
|
node->deleteAt(row);
|
||||||
|
}
|
||||||
|
|
||||||
if (node != fTree && node->childCount() < 1)
|
if (node != fTree && node->childCount() < 1) {
|
||||||
return removeRow(parent.row(), parent.parent());
|
return removeRow(parent.row(), parent.parent());
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/**
|
/**
|
||||||
* @file filter_tree_model.h
|
* @file filter_tree_model.h
|
||||||
* @ingroup CardDatabaseModelFilters
|
* @ingroup CardDatabaseModelFilters
|
||||||
* @brief TODO: Document this.
|
|
||||||
*/
|
*/
|
||||||
|
//! \todo Document this file.
|
||||||
|
|
||||||
#ifndef FILTERTREEMODEL_H
|
#ifndef FILTERTREEMODEL_H
|
||||||
#define FILTERTREEMODEL_H
|
#define FILTERTREEMODEL_H
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@
|
||||||
* @file syntax_help.h
|
* @file syntax_help.h
|
||||||
* @ingroup CardDatabaseModelFilters
|
* @ingroup CardDatabaseModelFilters
|
||||||
* @ingroup DeckStorageWidgets
|
* @ingroup DeckStorageWidgets
|
||||||
* @brief TODO: Document this.
|
|
||||||
*/
|
*/
|
||||||
|
//! \todo Document this file.
|
||||||
|
|
||||||
#ifndef SEARCH_SYNTAX_HELP_H
|
#ifndef SEARCH_SYNTAX_HELP_H
|
||||||
#define SEARCH_SYNTAX_HELP_H
|
#define SEARCH_SYNTAX_HELP_H
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
#include "abstract_game.h"
|
#include "abstract_game.h"
|
||||||
|
|
||||||
#include "player/player.h"
|
#include "../interface/widgets/tabs/tab_game.h"
|
||||||
|
#include "player/player_logic.h"
|
||||||
|
|
||||||
AbstractGame::AbstractGame(TabGame *_tab) : tab(_tab)
|
AbstractGame::AbstractGame(TabGame *_tab) : QObject(_tab), tab(_tab)
|
||||||
{
|
{
|
||||||
gameMetaInfo = new GameMetaInfo(this);
|
gameMetaInfo = new GameMetaInfo(this);
|
||||||
gameEventHandler = new GameEventHandler(this);
|
gameEventHandler = new GameEventHandler(this);
|
||||||
|
|
@ -23,10 +24,11 @@ AbstractClient *AbstractGame::getClientForPlayer(int playerId) const
|
||||||
}
|
}
|
||||||
|
|
||||||
return gameState->getClients().at(playerId);
|
return gameState->getClients().at(playerId);
|
||||||
} else if (gameState->getClients().isEmpty())
|
} else if (gameState->getClients().isEmpty()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
else
|
} else {
|
||||||
return gameState->getClients().first();
|
return gameState->getClients().first();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractGame::loadReplay(GameReplay *replay)
|
void AbstractGame::loadReplay(GameReplay *replay)
|
||||||
|
|
@ -42,13 +44,15 @@ void AbstractGame::setActiveCard(CardItem *card)
|
||||||
|
|
||||||
CardItem *AbstractGame::getCard(int playerId, const QString &zoneName, int cardId) const
|
CardItem *AbstractGame::getCard(int playerId, const QString &zoneName, int cardId) const
|
||||||
{
|
{
|
||||||
Player *player = playerManager->getPlayer(playerId);
|
PlayerLogic *player = playerManager->getPlayer(playerId);
|
||||||
if (!player)
|
if (!player) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
CardZoneLogic *zone = player->getZones().value(zoneName, 0);
|
CardZoneLogic *zone = player->getZones().value(zoneName, 0);
|
||||||
if (!zone)
|
if (!zone) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
return zone->getCard(cardId);
|
return zone->getCard(cardId);
|
||||||
}
|
}
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/**
|
/**
|
||||||
* @file abstract_game.h
|
* @file abstract_game.h
|
||||||
* @ingroup GameLogic
|
* @ingroup GameLogic
|
||||||
* @brief TODO: Document this.
|
|
||||||
*/
|
*/
|
||||||
|
//! \todo Document this file.
|
||||||
|
|
||||||
#ifndef COCKATRICE_ABSTRACT_GAME_H
|
#ifndef COCKATRICE_ABSTRACT_GAME_H
|
||||||
#define COCKATRICE_ABSTRACT_GAME_H
|
#define COCKATRICE_ABSTRACT_GAME_H
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,13 @@
|
||||||
#include "abstract_card_drag_item.h"
|
#include "abstract_card_drag_item.h"
|
||||||
|
|
||||||
#include "../../client/settings/cache_settings.h"
|
#include "../../client/settings/cache_settings.h"
|
||||||
|
#include "../z_values.h"
|
||||||
|
|
||||||
#include <QCursor>
|
#include <QCursor>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QGraphicsSceneMouseEvent>
|
#include <QGraphicsSceneMouseEvent>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
|
||||||
static const float CARD_WIDTH_HALF = CARD_WIDTH / 2;
|
|
||||||
static const float CARD_HEIGHT_HALF = CARD_HEIGHT / 2;
|
|
||||||
const QColor GHOST_MASK = QColor(255, 255, 255, 50);
|
const QColor GHOST_MASK = QColor(255, 255, 255, 50);
|
||||||
|
|
||||||
AbstractCardDragItem::AbstractCardDragItem(AbstractCardItem *_item,
|
AbstractCardDragItem::AbstractCardDragItem(AbstractCardItem *_item,
|
||||||
|
|
@ -18,19 +17,20 @@ AbstractCardDragItem::AbstractCardDragItem(AbstractCardItem *_item,
|
||||||
{
|
{
|
||||||
if (parentDrag) {
|
if (parentDrag) {
|
||||||
parentDrag->addChildDrag(this);
|
parentDrag->addChildDrag(this);
|
||||||
setZValue(2000000007 + hotSpot.x() * 1000000 + hotSpot.y() * 1000 + 1000);
|
setZValue(ZValues::childDragZValue(hotSpot.x(), hotSpot.y()));
|
||||||
connect(parentDrag, &QObject::destroyed, this, &AbstractCardDragItem::deleteLater);
|
connect(parentDrag, &QObject::destroyed, this, &AbstractCardDragItem::deleteLater);
|
||||||
} else {
|
} else {
|
||||||
hotSpot = QPointF{qBound(0.0, hotSpot.x(), static_cast<qreal>(CARD_WIDTH - 1)),
|
hotSpot = QPointF{qBound(0.0, hotSpot.x(), CardDimensions::WIDTH_F - 1),
|
||||||
qBound(0.0, hotSpot.y(), static_cast<qreal>(CARD_HEIGHT - 1))};
|
qBound(0.0, hotSpot.y(), CardDimensions::HEIGHT_F - 1)};
|
||||||
setCursor(Qt::ClosedHandCursor);
|
setCursor(Qt::ClosedHandCursor);
|
||||||
setZValue(2000000007);
|
setZValue(ZValues::DRAG_ITEM);
|
||||||
}
|
}
|
||||||
if (item->getTapped())
|
if (item->getTapped()) {
|
||||||
setTransform(QTransform()
|
setTransform(QTransform()
|
||||||
.translate(CARD_WIDTH_HALF, CARD_HEIGHT_HALF)
|
.translate(CardDimensions::WIDTH_HALF_F, CardDimensions::HEIGHT_HALF_F)
|
||||||
.rotate(90)
|
.rotate(90)
|
||||||
.translate(-CARD_WIDTH_HALF, -CARD_HEIGHT_HALF));
|
.translate(-CardDimensions::WIDTH_HALF_F, -CardDimensions::HEIGHT_HALF_F));
|
||||||
|
}
|
||||||
|
|
||||||
setCacheMode(DeviceCoordinateCache);
|
setCacheMode(DeviceCoordinateCache);
|
||||||
|
|
||||||
|
|
@ -47,7 +47,7 @@ AbstractCardDragItem::AbstractCardDragItem(AbstractCardItem *_item,
|
||||||
QPainterPath AbstractCardDragItem::shape() const
|
QPainterPath AbstractCardDragItem::shape() const
|
||||||
{
|
{
|
||||||
QPainterPath shape;
|
QPainterPath shape;
|
||||||
qreal cardCornerRadius = SettingsCache::instance().getRoundCardCorners() ? 0.05 * CARD_WIDTH : 0.0;
|
qreal cardCornerRadius = SettingsCache::instance().getRoundCardCorners() ? 0.05 * CardDimensions::WIDTH_F : 0.0;
|
||||||
shape.addRoundedRect(boundingRect(), cardCornerRadius, cardCornerRadius);
|
shape.addRoundedRect(boundingRect(), cardCornerRadius, cardCornerRadius);
|
||||||
return shape;
|
return shape;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/**
|
/**
|
||||||
* @file abstract_card_drag_item.h
|
* @file abstract_card_drag_item.h
|
||||||
* @ingroup GameGraphicsCards
|
* @ingroup GameGraphicsCards
|
||||||
* @brief TODO: Document this.
|
|
||||||
*/
|
*/
|
||||||
|
//! \todo Document this file.
|
||||||
|
|
||||||
#ifndef ABSTRACTCARDDRAGITEM_H
|
#ifndef ABSTRACTCARDDRAGITEM_H
|
||||||
#define ABSTRACTCARDDRAGITEM_H
|
#define ABSTRACTCARDDRAGITEM_H
|
||||||
|
|
@ -34,7 +34,7 @@ public:
|
||||||
AbstractCardDragItem(AbstractCardItem *_item, const QPointF &_hotSpot, AbstractCardDragItem *parentDrag = 0);
|
AbstractCardDragItem(AbstractCardItem *_item, const QPointF &_hotSpot, AbstractCardDragItem *parentDrag = 0);
|
||||||
[[nodiscard]] QRectF boundingRect() const override
|
[[nodiscard]] QRectF boundingRect() const override
|
||||||
{
|
{
|
||||||
return QRectF(0, 0, CARD_WIDTH, CARD_HEIGHT);
|
return QRectF(0, 0, CardDimensions::WIDTH_F, CardDimensions::HEIGHT_F);
|
||||||
}
|
}
|
||||||
[[nodiscard]] QPainterPath shape() const override;
|
[[nodiscard]] QPainterPath shape() const override;
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
#include "../../client/settings/cache_settings.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"
|
||||||
|
#include "../z_values.h"
|
||||||
|
|
||||||
#include <QCursor>
|
#include <QCursor>
|
||||||
#include <QGraphicsScene>
|
#include <QGraphicsScene>
|
||||||
|
|
@ -12,7 +13,7 @@
|
||||||
#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>
|
||||||
|
|
||||||
AbstractCardItem::AbstractCardItem(QGraphicsItem *parent, const CardRef &cardRef, Player *_owner, int _id)
|
AbstractCardItem::AbstractCardItem(QGraphicsItem *parent, const CardRef &cardRef, PlayerLogic *_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),
|
||||||
bgColor(Qt::transparent), isHovered(false), realZValue(0)
|
bgColor(Qt::transparent), isHovered(false), realZValue(0)
|
||||||
{
|
{
|
||||||
|
|
@ -38,13 +39,13 @@ AbstractCardItem::~AbstractCardItem()
|
||||||
|
|
||||||
QRectF AbstractCardItem::boundingRect() const
|
QRectF AbstractCardItem::boundingRect() const
|
||||||
{
|
{
|
||||||
return QRectF(0, 0, CARD_WIDTH, CARD_HEIGHT);
|
return QRectF(0, 0, CardDimensions::WIDTH_F, CardDimensions::HEIGHT_F);
|
||||||
}
|
}
|
||||||
|
|
||||||
QPainterPath AbstractCardItem::shape() const
|
QPainterPath AbstractCardItem::shape() const
|
||||||
{
|
{
|
||||||
QPainterPath shape;
|
QPainterPath shape;
|
||||||
qreal cardCornerRadius = SettingsCache::instance().getRoundCardCorners() ? 0.05 * CARD_WIDTH : 0.0;
|
qreal cardCornerRadius = SettingsCache::instance().getRoundCardCorners() ? 0.05 * CardDimensions::WIDTH_F : 0.0;
|
||||||
shape.addRoundedRect(boundingRect(), cardCornerRadius, cardCornerRadius);
|
shape.addRoundedRect(boundingRect(), cardCornerRadius, cardCornerRadius);
|
||||||
return shape;
|
return shape;
|
||||||
}
|
}
|
||||||
|
|
@ -84,7 +85,12 @@ const CardInfo &AbstractCardItem::getCardInfo() const
|
||||||
void AbstractCardItem::setRealZValue(qreal _zValue)
|
void AbstractCardItem::setRealZValue(qreal _zValue)
|
||||||
{
|
{
|
||||||
realZValue = _zValue;
|
realZValue = _zValue;
|
||||||
setZValue(_zValue);
|
// During hover, zValue is overridden to HOVERED_CARD. Layout operations
|
||||||
|
// like reorganizeCards() call setRealZValue() on all cards including the
|
||||||
|
// hovered one — skip setZValue() here to avoid clobbering the override.
|
||||||
|
if (!isHovered) {
|
||||||
|
setZValue(_zValue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QSizeF AbstractCardItem::getTranslatedSize(QPainter *painter) const
|
QSizeF AbstractCardItem::getTranslatedSize(QPainter *painter) const
|
||||||
|
|
@ -125,8 +131,9 @@ void AbstractCardItem::paintPicture(QPainter *painter, const QSizeF &translatedS
|
||||||
// don't even spend time trying to load the picture if our size is too small
|
// don't even spend time trying to load the picture if our size is too small
|
||||||
if (translatedSize.width() > 10) {
|
if (translatedSize.width() > 10) {
|
||||||
CardPictureLoader::getPixmap(translatedPixmap, exactCard, translatedSize.toSize());
|
CardPictureLoader::getPixmap(translatedPixmap, exactCard, translatedSize.toSize());
|
||||||
if (translatedPixmap.isNull())
|
if (translatedPixmap.isNull()) {
|
||||||
paintImage = false;
|
paintImage = false;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
paintImage = false;
|
paintImage = false;
|
||||||
}
|
}
|
||||||
|
|
@ -151,9 +158,9 @@ void AbstractCardItem::paintPicture(QPainter *painter, const QSizeF &translatedS
|
||||||
painter->setBackground(Qt::black);
|
painter->setBackground(Qt::black);
|
||||||
painter->setBackgroundMode(Qt::OpaqueMode);
|
painter->setBackgroundMode(Qt::OpaqueMode);
|
||||||
QString nameStr;
|
QString nameStr;
|
||||||
if (facedown)
|
if (facedown) {
|
||||||
nameStr = "# " + QString::number(id);
|
nameStr = "# " + QString::number(id);
|
||||||
else {
|
} else {
|
||||||
QString prefix = "";
|
QString prefix = "";
|
||||||
if (SettingsCache::instance().debug().getShowCardId()) {
|
if (SettingsCache::instance().debug().getShowCardId()) {
|
||||||
prefix = "#" + QString::number(id) + " ";
|
prefix = "#" + QString::number(id) + " ";
|
||||||
|
|
@ -180,10 +187,12 @@ void AbstractCardItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *
|
||||||
|
|
||||||
if (isSelected() || isHovered) {
|
if (isSelected() || isHovered) {
|
||||||
QPen pen;
|
QPen pen;
|
||||||
if (isHovered)
|
if (isHovered) {
|
||||||
pen.setColor(Qt::yellow);
|
pen.setColor(Qt::yellow);
|
||||||
if (isSelected())
|
}
|
||||||
|
if (isSelected()) {
|
||||||
pen.setColor(Qt::red);
|
pen.setColor(Qt::red);
|
||||||
|
}
|
||||||
pen.setWidth(0); // Cosmetic pen
|
pen.setWidth(0); // Cosmetic pen
|
||||||
painter->setPen(pen);
|
painter->setPen(pen);
|
||||||
painter->drawPath(shape());
|
painter->drawPath(shape());
|
||||||
|
|
@ -209,15 +218,24 @@ void AbstractCardItem::setCardRef(const CardRef &_cardRef)
|
||||||
|
|
||||||
void AbstractCardItem::setHovered(bool _hovered)
|
void AbstractCardItem::setHovered(bool _hovered)
|
||||||
{
|
{
|
||||||
if (isHovered == _hovered)
|
if (isHovered == _hovered) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (_hovered)
|
if (_hovered) {
|
||||||
processHoverEvent();
|
processHoverEvent();
|
||||||
|
} else {
|
||||||
|
// Mark the hovered card's current scene footprint dirty so overlapped
|
||||||
|
// sibling zones (e.g. StackZone) repaint after the card moves away.
|
||||||
|
if (scene()) {
|
||||||
|
scene()->update(sceneBoundingRect());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
isHovered = _hovered;
|
isHovered = _hovered;
|
||||||
setZValue(_hovered ? 2000000004 : realZValue);
|
setZValue(_hovered ? ZValues::HOVERED_CARD : realZValue);
|
||||||
setScale(_hovered && SettingsCache::instance().getScaleCards() ? 1.1 : 1);
|
setScale(_hovered && SettingsCache::instance().getScaleCards() ? 1.1 : 1);
|
||||||
setTransformOriginPoint(_hovered ? CARD_WIDTH / 2 : 0, _hovered ? CARD_HEIGHT / 2 : 0);
|
setTransformOriginPoint(_hovered ? CardDimensions::WIDTH_HALF_F : 0, _hovered ? CardDimensions::HEIGHT_HALF_F : 0);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -264,18 +282,19 @@ void AbstractCardItem::cacheBgColor()
|
||||||
|
|
||||||
void AbstractCardItem::setTapped(bool _tapped, bool canAnimate)
|
void AbstractCardItem::setTapped(bool _tapped, bool canAnimate)
|
||||||
{
|
{
|
||||||
if (tapped == _tapped)
|
if (tapped == _tapped) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
tapped = _tapped;
|
tapped = _tapped;
|
||||||
if (SettingsCache::instance().getTapAnimation() && canAnimate)
|
if (SettingsCache::instance().getTapAnimation() && canAnimate) {
|
||||||
static_cast<GameScene *>(scene())->registerAnimationItem(this);
|
static_cast<GameScene *>(scene())->registerAnimationItem(this);
|
||||||
else {
|
} else {
|
||||||
tapAngle = tapped ? 90 : 0;
|
tapAngle = tapped ? 90 : 0;
|
||||||
setTransform(QTransform()
|
setTransform(QTransform()
|
||||||
.translate((float)CARD_WIDTH / 2, (float)CARD_HEIGHT / 2)
|
.translate(CardDimensions::WIDTH_HALF_F, CardDimensions::HEIGHT_HALF_F)
|
||||||
.rotate(tapAngle)
|
.rotate(tapAngle)
|
||||||
.translate((float)-CARD_WIDTH / 2, (float)-CARD_HEIGHT / 2));
|
.translate(-CardDimensions::WIDTH_HALF_F, -CardDimensions::HEIGHT_HALF_F));
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -296,17 +315,19 @@ void AbstractCardItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||||
scene()->clearSelection();
|
scene()->clearSelection();
|
||||||
setSelected(true);
|
setSelected(true);
|
||||||
}
|
}
|
||||||
if (event->button() == Qt::LeftButton)
|
if (event->button() == Qt::LeftButton) {
|
||||||
setCursor(Qt::ClosedHandCursor);
|
setCursor(Qt::ClosedHandCursor);
|
||||||
else if (event->button() == Qt::MiddleButton)
|
} else if (event->button() == Qt::MiddleButton) {
|
||||||
emit showCardInfoPopup(event->screenPos(), cardRef);
|
emit showCardInfoPopup(event->screenPos(), cardRef);
|
||||||
|
}
|
||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractCardItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
void AbstractCardItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (event->button() == Qt::MiddleButton)
|
if (event->button() == Qt::MiddleButton) {
|
||||||
emit deleteCardInfoPopup(cardRef.name);
|
emit deleteCardInfoPopup(cardRef.name);
|
||||||
|
}
|
||||||
|
|
||||||
// This function ensures the parent function doesn't mess around with our selection.
|
// This function ensures the parent function doesn't mess around with our selection.
|
||||||
event->accept();
|
event->accept();
|
||||||
|
|
@ -322,6 +343,7 @@ QVariant AbstractCardItem::itemChange(QGraphicsItem::GraphicsItemChange change,
|
||||||
if (change == ItemSelectedHasChanged) {
|
if (change == ItemSelectedHasChanged) {
|
||||||
update();
|
update();
|
||||||
return value;
|
return value;
|
||||||
} else
|
} else {
|
||||||
return ArrowTarget::itemChange(change, value);
|
return ArrowTarget::itemChange(change, value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,20 @@
|
||||||
/**
|
/**
|
||||||
* @file abstract_card_item.h
|
* @file abstract_card_item.h
|
||||||
* @ingroup GameGraphicsCards
|
* @ingroup GameGraphicsCards
|
||||||
* @brief TODO: Document this.
|
* @brief Base class for graphical card items, providing shared rendering, identity, and interaction logic.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef ABSTRACTCARDITEM_H
|
#ifndef ABSTRACTCARDITEM_H
|
||||||
#define ABSTRACTCARDITEM_H
|
#define ABSTRACTCARDITEM_H
|
||||||
|
|
||||||
#include "../../game_graphics/board/graphics_item_type.h"
|
#include "../../game_graphics/board/graphics_item_type.h"
|
||||||
|
#include "../card_dimensions.h"
|
||||||
#include "arrow_target.h"
|
#include "arrow_target.h"
|
||||||
|
|
||||||
#include <libcockatrice/card/printing/exact_card.h>
|
#include <libcockatrice/card/printing/exact_card.h>
|
||||||
#include <libcockatrice/utility/card_ref.h>
|
#include <libcockatrice/utility/card_ref.h>
|
||||||
|
|
||||||
class Player;
|
class PlayerLogic;
|
||||||
|
|
||||||
const int CARD_WIDTH = 72;
|
|
||||||
const int CARD_HEIGHT = 102;
|
|
||||||
|
|
||||||
class AbstractCardItem : public ArrowTarget
|
class AbstractCardItem : public ArrowTarget
|
||||||
{
|
{
|
||||||
|
|
@ -58,7 +56,7 @@ public:
|
||||||
}
|
}
|
||||||
explicit AbstractCardItem(QGraphicsItem *parent = nullptr,
|
explicit AbstractCardItem(QGraphicsItem *parent = nullptr,
|
||||||
const CardRef &cardRef = {},
|
const CardRef &cardRef = {},
|
||||||
Player *_owner = nullptr,
|
PlayerLogic *_owner = nullptr,
|
||||||
int _id = -1);
|
int _id = -1);
|
||||||
~AbstractCardItem() override;
|
~AbstractCardItem() override;
|
||||||
QRectF boundingRect() const override;
|
QRectF boundingRect() const override;
|
||||||
|
|
@ -98,6 +96,10 @@ public:
|
||||||
}
|
}
|
||||||
void setRealZValue(qreal _zValue);
|
void setRealZValue(qreal _zValue);
|
||||||
void setHovered(bool _hovered);
|
void setHovered(bool _hovered);
|
||||||
|
bool getIsHovered() const
|
||||||
|
{
|
||||||
|
return isHovered;
|
||||||
|
}
|
||||||
QString getColor() const
|
QString getColor() const
|
||||||
{
|
{
|
||||||
return color;
|
return color;
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,14 @@
|
||||||
|
|
||||||
#include "../../client/settings/cache_settings.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_actions.h"
|
#include "../player/player_actions.h"
|
||||||
|
#include "../player/player_logic.h"
|
||||||
#include "translate_counter_name.h"
|
#include "translate_counter_name.h"
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QGraphicsSceneMouseEvent>
|
#include <QGraphicsSceneMouseEvent>
|
||||||
|
#include <QGraphicsView>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
@ -16,24 +17,24 @@
|
||||||
#include <libcockatrice/protocol/pb/command_set_counter.pb.h>
|
#include <libcockatrice/protocol/pb/command_set_counter.pb.h>
|
||||||
#include <libcockatrice/utility/expression.h>
|
#include <libcockatrice/utility/expression.h>
|
||||||
|
|
||||||
AbstractCounter::AbstractCounter(Player *_player,
|
AbstractCounter::AbstractCounter(CounterState *state,
|
||||||
int _id,
|
PlayerLogic *_player,
|
||||||
const QString &_name,
|
|
||||||
bool _shownInCounterArea,
|
bool _shownInCounterArea,
|
||||||
int _value,
|
|
||||||
bool _useNameForShortcut,
|
bool _useNameForShortcut,
|
||||||
QGraphicsItem *parent)
|
QGraphicsItem *parent)
|
||||||
: QGraphicsItem(parent), player(_player), id(_id), name(_name), value(_value),
|
: QGraphicsItem(parent), player(_player), id(state->getId()), name(state->getName()), value(state->getValue()),
|
||||||
useNameForShortcut(_useNameForShortcut), hovered(false), aDec(nullptr), aInc(nullptr), dialogSemaphore(false),
|
color(state->getColor()), radius(state->getRadius()), useNameForShortcut(_useNameForShortcut),
|
||||||
deleteAfterDialog(false), shownInCounterArea(_shownInCounterArea)
|
shownInCounterArea(_shownInCounterArea)
|
||||||
{
|
{
|
||||||
setAcceptHoverEvents(true);
|
setAcceptHoverEvents(true);
|
||||||
|
|
||||||
shortcutActive = false;
|
connect(state, &CounterState::valueChanged, this, [this](int, int newValue) {
|
||||||
|
value = newValue;
|
||||||
|
update();
|
||||||
|
});
|
||||||
|
|
||||||
if (player->getPlayerInfo()->getLocalOrJudge()) {
|
if (player->getPlayerInfo()->getLocalOrJudge()) {
|
||||||
QString displayName = TranslateCounterName::getDisplayName(_name);
|
menu = new TearOffMenu(TranslateCounterName::getDisplayName(state->getName()));
|
||||||
menu = new TearOffMenu(displayName);
|
|
||||||
aSet = new QAction(this);
|
aSet = new QAction(this);
|
||||||
connect(aSet, &QAction::triggered, this, &AbstractCounter::setCounter);
|
connect(aSet, &QAction::triggered, this, &AbstractCounter::setCounter);
|
||||||
menu->addAction(aSet);
|
menu->addAction(aSet);
|
||||||
|
|
@ -41,16 +42,18 @@ AbstractCounter::AbstractCounter(Player *_player,
|
||||||
for (int i = 10; i >= -10; --i) {
|
for (int i = 10; i >= -10; --i) {
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
} else {
|
continue;
|
||||||
QAction *aIncrement = new QAction(QString(i < 0 ? "%1" : "+%1").arg(i), this);
|
|
||||||
if (i == -1)
|
|
||||||
aDec = aIncrement;
|
|
||||||
else if (i == 1)
|
|
||||||
aInc = aIncrement;
|
|
||||||
aIncrement->setData(i);
|
|
||||||
connect(aIncrement, &QAction::triggered, this, &AbstractCounter::incrementCounter);
|
|
||||||
menu->addAction(aIncrement);
|
|
||||||
}
|
}
|
||||||
|
auto *a = new QAction(QString(i < 0 ? "%1" : "+%1").arg(i), this);
|
||||||
|
if (i == -1) {
|
||||||
|
aDec = a;
|
||||||
|
}
|
||||||
|
if (i == 1) {
|
||||||
|
aInc = a;
|
||||||
|
}
|
||||||
|
a->setData(i);
|
||||||
|
connect(a, &QAction::triggered, this, &AbstractCounter::incrementCounter);
|
||||||
|
menu->addAction(a);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
menu = nullptr;
|
menu = nullptr;
|
||||||
|
|
@ -69,39 +72,35 @@ AbstractCounter::~AbstractCounter()
|
||||||
|
|
||||||
void AbstractCounter::delCounter()
|
void AbstractCounter::delCounter()
|
||||||
{
|
{
|
||||||
if (dialogSemaphore)
|
if (dialogSemaphore) {
|
||||||
deleteAfterDialog = true;
|
deleteAfterDialog = true;
|
||||||
else
|
} else {
|
||||||
deleteLater();
|
deleteLater();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractCounter::retranslateUi()
|
void AbstractCounter::retranslateUi()
|
||||||
{
|
{
|
||||||
if (menu) {
|
if (aSet) {
|
||||||
aSet->setText(tr("&Set counter..."));
|
aSet->setText(tr("&Set counter..."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractCounter::setShortcutsActive()
|
void AbstractCounter::setShortcutsActive()
|
||||||
{
|
{
|
||||||
if (!menu) {
|
if (!menu || !player->getPlayerInfo()->getLocal()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!player->getPlayerInfo()->getLocal()) {
|
ShortcutsSettings &sc = SettingsCache::instance().shortcuts();
|
||||||
return;
|
shortcutActive = true;
|
||||||
}
|
|
||||||
|
|
||||||
ShortcutsSettings &shortcuts = SettingsCache::instance().shortcuts();
|
|
||||||
if (name == "life") {
|
if (name == "life") {
|
||||||
shortcutActive = true;
|
aSet->setShortcuts(sc.getShortcut("Player/aSet"));
|
||||||
aSet->setShortcuts(shortcuts.getShortcut("Player/aSet"));
|
aDec->setShortcuts(sc.getShortcut("Player/aDec"));
|
||||||
aDec->setShortcuts(shortcuts.getShortcut("Player/aDec"));
|
aInc->setShortcuts(sc.getShortcut("Player/aInc"));
|
||||||
aInc->setShortcuts(shortcuts.getShortcut("Player/aInc"));
|
|
||||||
} else if (useNameForShortcut) {
|
} else if (useNameForShortcut) {
|
||||||
shortcutActive = true;
|
aSet->setShortcuts(sc.getShortcut("Player/aSetCounter_" + name));
|
||||||
aSet->setShortcuts(shortcuts.getShortcut("Player/aSetCounter_" + name));
|
aDec->setShortcuts(sc.getShortcut("Player/aDecCounter_" + name));
|
||||||
aDec->setShortcuts(shortcuts.getShortcut("Player/aDecCounter_" + name));
|
aInc->setShortcuts(sc.getShortcut("Player/aIncCounter_" + name));
|
||||||
aInc->setShortcuts(shortcuts.getShortcut("Player/aIncCounter_" + name));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -126,43 +125,32 @@ void AbstractCounter::refreshShortcuts()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractCounter::setValue(int _value)
|
|
||||||
{
|
|
||||||
value = _value;
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AbstractCounter::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
void AbstractCounter::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (isUnderMouse() && player->getPlayerInfo()->getLocalOrJudge()) {
|
if (!isUnderMouse() || !player->getPlayerInfo()->getLocalOrJudge()) {
|
||||||
if (event->button() == Qt::MiddleButton || (QApplication::keyboardModifiers() & Qt::ShiftModifier)) {
|
|
||||||
if (menu)
|
|
||||||
menu->exec(event->screenPos());
|
|
||||||
event->accept();
|
|
||||||
} else if (event->button() == Qt::LeftButton) {
|
|
||||||
Command_IncCounter cmd;
|
|
||||||
cmd.set_counter_id(id);
|
|
||||||
cmd.set_delta(1);
|
|
||||||
player->getPlayerActions()->sendGameCommand(cmd);
|
|
||||||
event->accept();
|
|
||||||
} else if (event->button() == Qt::RightButton) {
|
|
||||||
Command_IncCounter cmd;
|
|
||||||
cmd.set_counter_id(id);
|
|
||||||
cmd.set_delta(-1);
|
|
||||||
player->getPlayerActions()->sendGameCommand(cmd);
|
|
||||||
event->accept();
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
event->ignore();
|
event->ignore();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event->button() == Qt::MiddleButton || QApplication::keyboardModifiers() & Qt::ShiftModifier) {
|
||||||
|
if (menu) {
|
||||||
|
menu->exec(event->screenPos());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Command_IncCounter cmd;
|
||||||
|
cmd.set_counter_id(id);
|
||||||
|
cmd.set_delta(event->button() == Qt::LeftButton ? 1 : -1);
|
||||||
|
player->getPlayerActions()->sendGameCommand(cmd);
|
||||||
|
}
|
||||||
|
event->accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractCounter::hoverEnterEvent(QGraphicsSceneHoverEvent * /*event*/)
|
void AbstractCounter::hoverEnterEvent(QGraphicsSceneHoverEvent *)
|
||||||
{
|
{
|
||||||
hovered = true;
|
hovered = true;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
void AbstractCounter::hoverLeaveEvent(QGraphicsSceneHoverEvent *)
|
||||||
void AbstractCounter::hoverLeaveEvent(QGraphicsSceneHoverEvent * /*event*/)
|
|
||||||
{
|
{
|
||||||
hovered = false;
|
hovered = false;
|
||||||
update();
|
update();
|
||||||
|
|
@ -170,34 +158,36 @@ void AbstractCounter::hoverLeaveEvent(QGraphicsSceneHoverEvent * /*event*/)
|
||||||
|
|
||||||
void AbstractCounter::incrementCounter()
|
void AbstractCounter::incrementCounter()
|
||||||
{
|
{
|
||||||
const int delta = static_cast<QAction *>(sender())->data().toInt();
|
|
||||||
Command_IncCounter cmd;
|
Command_IncCounter cmd;
|
||||||
cmd.set_counter_id(id);
|
cmd.set_counter_id(id);
|
||||||
cmd.set_delta(delta);
|
cmd.set_delta(static_cast<QAction *>(sender())->data().toInt());
|
||||||
player->getPlayerActions()->sendGameCommand(cmd);
|
player->getPlayerActions()->sendGameCommand(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractCounter::setCounter()
|
void AbstractCounter::setCounter()
|
||||||
{
|
{
|
||||||
|
QWidget *parent = nullptr;
|
||||||
|
if (auto *view = scene() ? scene()->views().value(0) : nullptr) {
|
||||||
|
parent = view->window();
|
||||||
|
}
|
||||||
|
|
||||||
dialogSemaphore = true;
|
dialogSemaphore = true;
|
||||||
AbstractCounterDialog dialog(name, QString::number(value), player->getGame()->getTab());
|
AbstractCounterDialog dlg(name, QString::number(value), parent);
|
||||||
const int ok = dialog.exec();
|
const int ok = dlg.exec();
|
||||||
|
dialogSemaphore = false;
|
||||||
|
|
||||||
if (deleteAfterDialog) {
|
if (deleteAfterDialog) {
|
||||||
deleteLater();
|
deleteLater();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dialogSemaphore = false;
|
if (!ok) {
|
||||||
|
|
||||||
if (!ok)
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Expression exp(value);
|
Expression exp(value);
|
||||||
int newValue = static_cast<int>(exp.parse(dialog.textValue()));
|
|
||||||
|
|
||||||
Command_SetCounter cmd;
|
Command_SetCounter cmd;
|
||||||
cmd.set_counter_id(id);
|
cmd.set_counter_id(id);
|
||||||
cmd.set_value(newValue);
|
cmd.set_value(static_cast<int>(exp.parse(dlg.textValue())));
|
||||||
player->getPlayerActions()->sendGameCommand(cmd);
|
player->getPlayerActions()->sendGameCommand(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -231,8 +221,9 @@ void AbstractCounterDialog::changeValue(int diff)
|
||||||
{
|
{
|
||||||
bool ok;
|
bool ok;
|
||||||
int curValue = textValue().toInt(&ok);
|
int curValue = textValue().toInt(&ok);
|
||||||
if (!ok)
|
if (!ok) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
curValue += diff;
|
curValue += diff;
|
||||||
setTextValue(QString::number(curValue));
|
setTextValue(QString::number(curValue));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,45 +1,51 @@
|
||||||
/**
|
/**
|
||||||
* @file abstract_counter.h
|
* @file abstract_counter.h
|
||||||
* @ingroup GameGraphicsPlayers
|
* @ingroup GameGraphicsPlayers
|
||||||
* @brief TODO: Document this.
|
|
||||||
*/
|
*/
|
||||||
|
//! \todo Document this file.
|
||||||
|
|
||||||
#ifndef COUNTER_H
|
#ifndef COUNTER_H
|
||||||
#define COUNTER_H
|
#define COUNTER_H
|
||||||
|
|
||||||
#include "../../interface/widgets/menus/tearoff_menu.h"
|
#include "../../interface/widgets/menus/tearoff_menu.h"
|
||||||
|
#include "../player/menu/abstract_player_component.h"
|
||||||
|
#include "counter_state.h"
|
||||||
|
|
||||||
#include <QGraphicsItem>
|
#include <QGraphicsItem>
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
|
|
||||||
class Player;
|
class PlayerLogic;
|
||||||
class QAction;
|
class QAction;
|
||||||
class QKeyEvent;
|
class QKeyEvent;
|
||||||
class QMenu;
|
class QMenu;
|
||||||
class QString;
|
class QString;
|
||||||
|
|
||||||
class AbstractCounter : public QObject, public QGraphicsItem
|
class AbstractCounter : public QObject, public QGraphicsItem, public AbstractPlayerComponent
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_INTERFACES(QGraphicsItem)
|
Q_INTERFACES(QGraphicsItem)
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Player *player;
|
PlayerLogic *player;
|
||||||
int id;
|
int id;
|
||||||
QString name;
|
QString name;
|
||||||
int value;
|
int value;
|
||||||
bool useNameForShortcut, hovered;
|
QColor color;
|
||||||
|
int radius;
|
||||||
|
bool hovered = false;
|
||||||
|
bool useNameForShortcut;
|
||||||
|
|
||||||
void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
|
void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
|
||||||
void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override;
|
void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override;
|
||||||
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override;
|
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QAction *aSet, *aDec, *aInc;
|
QAction *aSet = nullptr, *aDec = nullptr, *aInc = nullptr;
|
||||||
TearOffMenu *menu;
|
TearOffMenu *menu = nullptr;
|
||||||
bool dialogSemaphore, deleteAfterDialog;
|
bool dialogSemaphore = false;
|
||||||
|
bool deleteAfterDialog = false;
|
||||||
bool shownInCounterArea;
|
bool shownInCounterArea;
|
||||||
bool shortcutActive;
|
bool shortcutActive = false;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void refreshShortcuts();
|
void refreshShortcuts();
|
||||||
|
|
@ -47,26 +53,22 @@ private slots:
|
||||||
void setCounter();
|
void setCounter();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AbstractCounter(Player *_player,
|
AbstractCounter(CounterState *state,
|
||||||
int _id,
|
PlayerLogic *player,
|
||||||
const QString &_name,
|
bool shownInCounterArea,
|
||||||
bool _shownInCounterArea,
|
bool useNameForShortcut = false,
|
||||||
int _value,
|
|
||||||
bool _useNameForShortcut = false,
|
|
||||||
QGraphicsItem *parent = nullptr);
|
QGraphicsItem *parent = nullptr);
|
||||||
~AbstractCounter() override;
|
~AbstractCounter() override;
|
||||||
|
|
||||||
void retranslateUi();
|
void retranslateUi() override;
|
||||||
void setValue(int _value);
|
void setShortcutsActive() override;
|
||||||
void setShortcutsActive();
|
void setShortcutsInactive() override;
|
||||||
void setShortcutsInactive();
|
|
||||||
void delCounter();
|
void delCounter();
|
||||||
|
|
||||||
QMenu *getMenu() const
|
QMenu *getMenu() const
|
||||||
{
|
{
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getId() const
|
int getId() const
|
||||||
{
|
{
|
||||||
return id;
|
return id;
|
||||||
|
|
@ -75,14 +77,22 @@ public:
|
||||||
{
|
{
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
bool getShownInCounterArea() const
|
QColor getColor() const
|
||||||
{
|
{
|
||||||
return shownInCounterArea;
|
return color;
|
||||||
|
}
|
||||||
|
int getRadius() const
|
||||||
|
{
|
||||||
|
return radius;
|
||||||
}
|
}
|
||||||
int getValue() const
|
int getValue() const
|
||||||
{
|
{
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
bool getShownInCounterArea() const
|
||||||
|
{
|
||||||
|
return shownInCounterArea;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class AbstractCounterDialog : public QInputDialog
|
class AbstractCounterDialog : public QInputDialog
|
||||||
|
|
|
||||||
19
cockatrice/src/game/board/arrow_data.cpp
Normal file
19
cockatrice/src/game/board/arrow_data.cpp
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
#include "arrow_data.h"
|
||||||
|
|
||||||
|
ArrowData ArrowData::fromProto(const ServerInfo_Arrow &arrow)
|
||||||
|
{
|
||||||
|
ArrowData data;
|
||||||
|
data.id = arrow.id();
|
||||||
|
data.startPlayerId = arrow.start_player_id();
|
||||||
|
data.startZone = QString::fromStdString(arrow.start_zone());
|
||||||
|
data.startCardId = arrow.start_card_id();
|
||||||
|
data.targetPlayerId = arrow.target_player_id();
|
||||||
|
data.color = convertColorToQColor(arrow.arrow_color());
|
||||||
|
|
||||||
|
if (arrow.has_target_zone()) {
|
||||||
|
data.targetZone = QString::fromStdString(arrow.target_zone());
|
||||||
|
data.targetCardId = arrow.target_card_id();
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
28
cockatrice/src/game/board/arrow_data.h
Normal file
28
cockatrice/src/game/board/arrow_data.h
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
#ifndef COCKATRICE_ARROW_DATA_H
|
||||||
|
#define COCKATRICE_ARROW_DATA_H
|
||||||
|
|
||||||
|
#include <QColor>
|
||||||
|
#include <QString>
|
||||||
|
#include <libcockatrice/protocol/pb/serverinfo_arrow.pb.h>
|
||||||
|
#include <libcockatrice/utility/color.h>
|
||||||
|
|
||||||
|
struct ArrowData
|
||||||
|
{
|
||||||
|
int id;
|
||||||
|
int startPlayerId;
|
||||||
|
QString startZone;
|
||||||
|
int startCardId;
|
||||||
|
int targetPlayerId;
|
||||||
|
QString targetZone; // empty = targeting a player
|
||||||
|
int targetCardId = -1; // -1 = targeting a player
|
||||||
|
QColor color;
|
||||||
|
|
||||||
|
static ArrowData fromProto(const ServerInfo_Arrow &arrow);
|
||||||
|
|
||||||
|
bool isPlayerTargeted() const
|
||||||
|
{
|
||||||
|
return targetZone.isEmpty();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // COCKATRICE_ARROW_DATA_H
|
||||||
|
|
@ -2,10 +2,11 @@
|
||||||
#include "arrow_item.h"
|
#include "arrow_item.h"
|
||||||
|
|
||||||
#include "../../client/settings/cache_settings.h"
|
#include "../../client/settings/cache_settings.h"
|
||||||
#include "../player/player.h"
|
#include "../../game_graphics/zones/card_zone.h"
|
||||||
#include "../player/player_actions.h"
|
#include "../player/player_actions.h"
|
||||||
|
#include "../player/player_logic.h"
|
||||||
#include "../player/player_target.h"
|
#include "../player/player_target.h"
|
||||||
#include "../zones/card_zone.h"
|
#include "../z_values.h"
|
||||||
#include "card_item.h"
|
#include "card_item.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
@ -18,47 +19,55 @@
|
||||||
#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/utility/color.h>
|
#include <libcockatrice/utility/color.h>
|
||||||
|
#include <libcockatrice/utility/zone_names.h>
|
||||||
|
|
||||||
ArrowItem::ArrowItem(Player *_player, int _id, ArrowTarget *_startItem, ArrowTarget *_targetItem, const QColor &_color)
|
ArrowItem::ArrowItem(PlayerLogic *_player,
|
||||||
: QGraphicsItem(), player(_player), id(_id), startItem(_startItem), targetItem(_targetItem), targetLocked(false),
|
int _id,
|
||||||
color(_color), fullColor(true)
|
ArrowTarget *_startItem,
|
||||||
|
ArrowTarget *_targetItem,
|
||||||
|
const QColor &_color)
|
||||||
|
: player(_player), id(_id), startItem(_startItem), targetItem(_targetItem), color(_color)
|
||||||
{
|
{
|
||||||
setZValue(2000000005);
|
setZValue(ZValues::ARROWS);
|
||||||
|
|
||||||
if (startItem)
|
auto doUpdate = [this]() {
|
||||||
startItem->addArrowFrom(this);
|
if (startItem && targetItem) {
|
||||||
if (targetItem)
|
updatePath();
|
||||||
targetItem->addArrowTo(this);
|
}
|
||||||
|
};
|
||||||
|
|
||||||
if (startItem && targetItem)
|
if (startItem) {
|
||||||
|
connect(startItem, &ArrowTarget::scenePositionChanged, this, doUpdate);
|
||||||
|
connect(startItem, &QObject::destroyed, this, &ArrowItem::onTargetDestroyed);
|
||||||
|
}
|
||||||
|
if (targetItem) {
|
||||||
|
connect(targetItem, &ArrowTarget::scenePositionChanged, this, doUpdate);
|
||||||
|
connect(targetItem, &QObject::destroyed, this, &ArrowItem::onTargetDestroyed);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (startItem && targetItem) {
|
||||||
updatePath();
|
updatePath();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrowItem::~ArrowItem()
|
void ArrowItem::onTargetDestroyed()
|
||||||
{
|
{
|
||||||
|
emit requestDeletion(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArrowItem::delArrow()
|
void ArrowItem::delArrow()
|
||||||
{
|
{
|
||||||
if (startItem) {
|
|
||||||
startItem->removeArrowFrom(this);
|
|
||||||
startItem = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (targetItem) {
|
if (targetItem) {
|
||||||
targetItem->setBeingPointedAt(false);
|
targetItem->setBeingPointedAt(false);
|
||||||
targetItem->removeArrowTo(this);
|
|
||||||
targetItem = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
player->removeArrow(this);
|
|
||||||
deleteLater();
|
deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArrowItem::updatePath()
|
void ArrowItem::updatePath()
|
||||||
{
|
{
|
||||||
if (!targetItem)
|
if (!targetItem) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QPointF endPoint = targetItem->mapToScene(
|
QPointF endPoint = targetItem->mapToScene(
|
||||||
QPointF(targetItem->boundingRect().width() / 2, targetItem->boundingRect().height() / 2));
|
QPointF(targetItem->boundingRect().width() / 2, targetItem->boundingRect().height() / 2));
|
||||||
|
|
@ -73,8 +82,9 @@ void ArrowItem::updatePath(const QPointF &endPoint)
|
||||||
headWidth / qPow(2, 0.5); // aka headWidth / sqrt (2) but this produces a compile error with MSVC++
|
headWidth / qPow(2, 0.5); // aka headWidth / sqrt (2) but this produces a compile error with MSVC++
|
||||||
const double phi = 15;
|
const double phi = 15;
|
||||||
|
|
||||||
if (!startItem)
|
if (!startItem) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QPointF startPoint =
|
QPointF startPoint =
|
||||||
startItem->mapToScene(QPointF(startItem->boundingRect().width() / 2, startItem->boundingRect().height() / 2));
|
startItem->mapToScene(QPointF(startItem->boundingRect().width() / 2, startItem->boundingRect().height() / 2));
|
||||||
|
|
@ -82,9 +92,9 @@ void ArrowItem::updatePath(const QPointF &endPoint)
|
||||||
qreal lineLength = line.length();
|
qreal lineLength = line.length();
|
||||||
|
|
||||||
prepareGeometryChange();
|
prepareGeometryChange();
|
||||||
if (lineLength < 30)
|
if (lineLength < 30) {
|
||||||
path = QPainterPath();
|
path = QPainterPath();
|
||||||
else {
|
} else {
|
||||||
QPointF c(lineLength / 2, qTan(phi * M_PI / 180) * lineLength);
|
QPointF c(lineLength / 2, qTan(phi * M_PI / 180) * lineLength);
|
||||||
|
|
||||||
QPainterPath centerLine;
|
QPainterPath centerLine;
|
||||||
|
|
@ -121,10 +131,11 @@ void ArrowItem::updatePath(const QPointF &endPoint)
|
||||||
void ArrowItem::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/)
|
void ArrowItem::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/)
|
||||||
{
|
{
|
||||||
QColor paintColor(color);
|
QColor paintColor(color);
|
||||||
if (fullColor)
|
if (fullColor) {
|
||||||
paintColor.setAlpha(200);
|
paintColor.setAlpha(200);
|
||||||
else
|
} else {
|
||||||
paintColor.setAlpha(150);
|
paintColor.setAlpha(150);
|
||||||
|
}
|
||||||
painter->setBrush(paintColor);
|
painter->setBrush(paintColor);
|
||||||
painter->drawPath(path);
|
painter->drawPath(path);
|
||||||
}
|
}
|
||||||
|
|
@ -136,8 +147,7 @@ void ArrowItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QGraphicsItem *> colliding = scene()->items(event->scenePos());
|
for (auto *item : scene()->items(event->scenePos())) {
|
||||||
for (QGraphicsItem *item : colliding) {
|
|
||||||
if (qgraphicsitem_cast<CardItem *>(item)) {
|
if (qgraphicsitem_cast<CardItem *>(item)) {
|
||||||
event->ignore();
|
event->ignore();
|
||||||
return;
|
return;
|
||||||
|
|
@ -146,80 +156,86 @@ void ArrowItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||||
|
|
||||||
event->accept();
|
event->accept();
|
||||||
if (event->button() == Qt::RightButton) {
|
if (event->button() == Qt::RightButton) {
|
||||||
Command_DeleteArrow cmd;
|
emit requestDeletion(id);
|
||||||
cmd.set_arrow_id(id);
|
|
||||||
player->getPlayerActions()->sendGameCommand(cmd);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrowDragItem::ArrowDragItem(Player *_owner, ArrowTarget *_startItem, const QColor &_color, int _deleteInPhase)
|
// ArrowDragItem
|
||||||
: ArrowItem(_owner, -1, _startItem, 0, _color), deleteInPhase(_deleteInPhase)
|
|
||||||
|
ArrowDragItem::ArrowDragItem(PlayerLogic *_owner, ArrowTarget *_startItem, const QColor &_color, int _deleteInPhase)
|
||||||
|
: ArrowItem(_owner, -1, _startItem, nullptr, _color), deleteInPhase(_deleteInPhase)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArrowDragItem::addChildArrow(ArrowDragItem *childArrow)
|
void ArrowDragItem::addChildArrow(ArrowDragItem *child)
|
||||||
{
|
{
|
||||||
childArrows.append(childArrow);
|
childArrows.append(child);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArrowDragItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
void ArrowDragItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
// This ensures that if a mouse move event happens after a call to delArrow(),
|
if (targetLocked || !startItem) {
|
||||||
// the event will be discarded as it would create some stray pointers.
|
|
||||||
if (targetLocked || !startItem)
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QPointF endPos = event->scenePos();
|
const QPointF endPos = event->scenePos();
|
||||||
|
|
||||||
QList<QGraphicsItem *> colliding = scene()->items(endPos);
|
ArrowTarget *cursorItem = nullptr;
|
||||||
ArrowTarget *cursorItem = 0;
|
|
||||||
qreal cursorItemZ = -1;
|
qreal cursorItemZ = -1;
|
||||||
for (int i = colliding.size() - 1; i >= 0; i--) {
|
for (auto *item : scene()->items(endPos)) {
|
||||||
if (qgraphicsitem_cast<PlayerTarget *>(colliding.at(i)) || qgraphicsitem_cast<CardItem *>(colliding.at(i))) {
|
ArrowTarget *candidate = nullptr;
|
||||||
if (colliding.at(i)->zValue() > cursorItemZ) {
|
if (auto *card = qgraphicsitem_cast<CardItem *>(item)) {
|
||||||
cursorItem = static_cast<ArrowTarget *>(colliding.at(i));
|
candidate = card;
|
||||||
cursorItemZ = cursorItem->zValue();
|
} else if (auto *pt = qgraphicsitem_cast<PlayerTarget *>(item)) {
|
||||||
}
|
candidate = pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (candidate && candidate->zValue() > cursorItemZ) {
|
||||||
|
cursorItem = candidate;
|
||||||
|
cursorItemZ = candidate->zValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((cursorItem != targetItem) && targetItem) {
|
if (cursorItem != targetItem) {
|
||||||
targetItem->setBeingPointedAt(false);
|
if (targetItem) {
|
||||||
targetItem->removeArrowTo(this);
|
disconnect(positionConnection);
|
||||||
}
|
targetItem->setBeingPointedAt(false);
|
||||||
if (!cursorItem) {
|
}
|
||||||
fullColor = false;
|
|
||||||
targetItem = 0;
|
targetItem = cursorItem;
|
||||||
updatePath(endPos);
|
fullColor = (cursorItem != nullptr);
|
||||||
} else {
|
|
||||||
if (cursorItem != targetItem) {
|
if (cursorItem && cursorItem != startItem) {
|
||||||
fullColor = true;
|
cursorItem->setBeingPointedAt(true);
|
||||||
if (cursorItem != startItem) {
|
positionConnection =
|
||||||
cursorItem->setBeingPointedAt(true);
|
connect(cursorItem, &ArrowTarget::scenePositionChanged, this, [this]() { updatePath(); });
|
||||||
cursorItem->addArrowTo(this);
|
|
||||||
}
|
|
||||||
targetItem = cursorItem;
|
|
||||||
}
|
}
|
||||||
updatePath();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
targetItem ? updatePath() : updatePath(endPos);
|
||||||
update();
|
update();
|
||||||
|
|
||||||
for (ArrowDragItem *child : childArrows) {
|
for (auto *child : childArrows) {
|
||||||
child->mouseMoveEvent(event);
|
child->mouseMoveEvent(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArrowDragItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
void ArrowDragItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (!startItem)
|
if (!startItem) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (targetItem && (targetItem != startItem)) {
|
if (targetItem && targetItem != startItem) {
|
||||||
CardZoneLogic *startZone = static_cast<CardItem *>(startItem)->getZone();
|
CardItem *startCard = qgraphicsitem_cast<CardItem *>(startItem);
|
||||||
// For now, we can safely assume that the start item is always a card.
|
// For now, we can safely assume that the start item is always a card.
|
||||||
// The target item can be a player as well.
|
// The target item can be a player as well.
|
||||||
CardItem *startCard = qgraphicsitem_cast<CardItem *>(startItem);
|
if (!startCard) {
|
||||||
CardItem *targetCard = qgraphicsitem_cast<CardItem *>(targetItem);
|
delArrow();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CardZoneLogic *startZone = startCard->getZone();
|
||||||
|
|
||||||
Command_CreateArrow cmd;
|
Command_CreateArrow cmd;
|
||||||
cmd.mutable_arrow_color()->CopyFrom(convertQColorToColor(color));
|
cmd.mutable_arrow_color()->CopyFrom(convertQColorToColor(color));
|
||||||
|
|
@ -227,27 +243,30 @@ void ArrowDragItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
cmd.set_start_zone(startZone->getName().toStdString());
|
cmd.set_start_zone(startZone->getName().toStdString());
|
||||||
cmd.set_start_card_id(startCard->getId());
|
cmd.set_start_card_id(startCard->getId());
|
||||||
|
|
||||||
if (targetCard) {
|
if (auto *targetCard = qgraphicsitem_cast<CardItem *>(targetItem)) {
|
||||||
CardZoneLogic *targetZone = targetCard->getZone();
|
CardZoneLogic *targetZone = targetCard->getZone();
|
||||||
cmd.set_target_player_id(targetZone->getPlayer()->getPlayerInfo()->getId());
|
cmd.set_target_player_id(targetZone->getPlayer()->getPlayerInfo()->getId());
|
||||||
cmd.set_target_zone(targetZone->getName().toStdString());
|
cmd.set_target_zone(targetZone->getName().toStdString());
|
||||||
cmd.set_target_card_id(targetCard->getId());
|
cmd.set_target_card_id(targetCard->getId());
|
||||||
} else { // failed to cast target to card, this means it's a player
|
} else if (auto *targetPlayer = qgraphicsitem_cast<PlayerTarget *>(targetItem)) {
|
||||||
PlayerTarget *targetPlayer = qgraphicsitem_cast<PlayerTarget *>(targetItem);
|
|
||||||
cmd.set_target_player_id(targetPlayer->getOwner()->getPlayerInfo()->getId());
|
cmd.set_target_player_id(targetPlayer->getOwner()->getPlayerInfo()->getId());
|
||||||
|
} else {
|
||||||
|
delArrow();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the card is in hand then we will move the card to stack or table as part of drawing the arrow
|
// if the card is in hand then we will move the card to stack or table as part of drawing the arrow
|
||||||
if (startZone->getName() == "hand") {
|
if (startZone->getName() == ZoneNames::HAND) {
|
||||||
startCard->playCard(false);
|
startCard->playCard(false);
|
||||||
CardInfoPtr ci = startCard->getCard().getCardPtr();
|
CardInfoPtr ci = startCard->getCard().getCardPtr();
|
||||||
bool playToStack = SettingsCache::instance().getPlayToStack();
|
bool playToStack = SettingsCache::instance().getPlayToStack();
|
||||||
if (ci &&
|
if (ci && ((!playToStack && ci->getUiAttributes().tableRow == 3) ||
|
||||||
((!playToStack && ci->getUiAttributes().tableRow == 3) ||
|
(playToStack && ci->getUiAttributes().tableRow != 0 &&
|
||||||
(playToStack && ci->getUiAttributes().tableRow != 0 && startCard->getZone()->getName() != "stack")))
|
startCard->getZone()->getName() != ZoneNames::STACK))) {
|
||||||
cmd.set_start_zone("stack");
|
cmd.set_start_zone(ZoneNames::STACK);
|
||||||
else
|
} else {
|
||||||
cmd.set_start_zone(playToStack ? "stack" : "table");
|
cmd.set_start_zone(playToStack ? ZoneNames::STACK : ZoneNames::TABLE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (deleteInPhase != 0) {
|
if (deleteInPhase != 0) {
|
||||||
|
|
@ -256,111 +275,109 @@ void ArrowDragItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
|
|
||||||
player->getPlayerActions()->sendGameCommand(cmd);
|
player->getPlayerActions()->sendGameCommand(cmd);
|
||||||
}
|
}
|
||||||
delArrow();
|
|
||||||
|
|
||||||
for (ArrowDragItem *child : childArrows) {
|
delArrow();
|
||||||
|
for (auto *child : childArrows) {
|
||||||
child->mouseReleaseEvent(event);
|
child->mouseReleaseEvent(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ArrowAttachItem
|
||||||
ArrowAttachItem::ArrowAttachItem(ArrowTarget *_startItem)
|
ArrowAttachItem::ArrowAttachItem(ArrowTarget *_startItem)
|
||||||
: ArrowItem(_startItem->getOwner(), -1, _startItem, 0, Qt::green)
|
: ArrowItem(_startItem->getOwner(), -1, _startItem, nullptr, Qt::green)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArrowAttachItem::addChildArrow(ArrowAttachItem *childArrow)
|
void ArrowAttachItem::addChildArrow(ArrowAttachItem *child)
|
||||||
{
|
{
|
||||||
childArrows.append(childArrow);
|
childArrows.append(child);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArrowAttachItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
void ArrowAttachItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (targetLocked || !startItem)
|
if (targetLocked || !startItem) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QPointF endPos = event->scenePos();
|
const QPointF endPos = event->scenePos();
|
||||||
|
|
||||||
QList<QGraphicsItem *> colliding = scene()->items(endPos);
|
ArrowTarget *cursorItem = nullptr;
|
||||||
ArrowTarget *cursorItem = 0;
|
|
||||||
qreal cursorItemZ = -1;
|
qreal cursorItemZ = -1;
|
||||||
for (int i = colliding.size() - 1; i >= 0; i--) {
|
for (auto *item : scene()->items(endPos)) {
|
||||||
if (qgraphicsitem_cast<CardItem *>(colliding.at(i))) {
|
if (auto *card = qgraphicsitem_cast<CardItem *>(item)) {
|
||||||
if (colliding.at(i)->zValue() > cursorItemZ) {
|
if (card->zValue() > cursorItemZ) {
|
||||||
cursorItem = static_cast<ArrowTarget *>(colliding.at(i));
|
cursorItem = card;
|
||||||
cursorItemZ = cursorItem->zValue();
|
cursorItemZ = card->zValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((cursorItem != targetItem) && targetItem) {
|
if (cursorItem != targetItem) {
|
||||||
targetItem->setBeingPointedAt(false);
|
if (targetItem) {
|
||||||
}
|
disconnect(positionConnection);
|
||||||
if (!cursorItem) {
|
targetItem->setBeingPointedAt(false);
|
||||||
fullColor = false;
|
|
||||||
targetItem = 0;
|
|
||||||
updatePath(endPos);
|
|
||||||
} else {
|
|
||||||
fullColor = true;
|
|
||||||
if (cursorItem != startItem) {
|
|
||||||
cursorItem->setBeingPointedAt(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
targetItem = cursorItem;
|
targetItem = cursorItem;
|
||||||
updatePath();
|
fullColor = (cursorItem != nullptr);
|
||||||
|
|
||||||
|
if (cursorItem && cursorItem != startItem) {
|
||||||
|
cursorItem->setBeingPointedAt(true);
|
||||||
|
positionConnection =
|
||||||
|
connect(cursorItem, &ArrowTarget::scenePositionChanged, this, [this]() { updatePath(); });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
targetItem ? updatePath() : updatePath(endPos);
|
||||||
update();
|
update();
|
||||||
|
|
||||||
for (ArrowAttachItem *child : childArrows) {
|
for (auto *child : childArrows) {
|
||||||
child->mouseMoveEvent(event);
|
child->mouseMoveEvent(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArrowAttachItem::attachCards(CardItem *startCard, const CardItem *targetCard)
|
|
||||||
{
|
|
||||||
// do nothing if target is already attached to another card or is not in play
|
|
||||||
if (targetCard->getAttachedTo() || targetCard->getZone()->getName() != "table") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CardZoneLogic *startZone = startCard->getZone();
|
|
||||||
CardZoneLogic *targetZone = targetCard->getZone();
|
|
||||||
|
|
||||||
// move card onto table first if attaching from some other zone
|
|
||||||
if (startZone->getName() != "table") {
|
|
||||||
player->getPlayerActions()->playCardToTable(startCard, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
Command_AttachCard cmd;
|
|
||||||
cmd.set_start_zone("table");
|
|
||||||
cmd.set_card_id(startCard->getId());
|
|
||||||
cmd.set_target_player_id(targetZone->getPlayer()->getPlayerInfo()->getId());
|
|
||||||
cmd.set_target_zone(targetZone->getName().toStdString());
|
|
||||||
cmd.set_target_card_id(targetCard->getId());
|
|
||||||
|
|
||||||
player->getPlayerActions()->sendGameCommand(cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ArrowAttachItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
void ArrowAttachItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (!startItem)
|
if (!startItem) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Attaching could move startItem under the current cursor position, causing all children to retarget to it right
|
// Attaching could move startItem under the current cursor position, causing all children to retarget to it right
|
||||||
// before they are processed. Prevent that.
|
// before they are processed. Prevent that.
|
||||||
for (ArrowAttachItem *child : childArrows) {
|
for (auto *child : childArrows) {
|
||||||
child->setTargetLocked(true);
|
child->setTargetLocked(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (targetItem && (targetItem != startItem)) {
|
if (targetItem && targetItem != startItem) {
|
||||||
auto startCard = qgraphicsitem_cast<CardItem *>(startItem);
|
auto *startCard = qgraphicsitem_cast<CardItem *>(startItem);
|
||||||
auto targetCard = qgraphicsitem_cast<CardItem *>(targetItem);
|
auto *targetCard = qgraphicsitem_cast<CardItem *>(targetItem);
|
||||||
if (startCard && targetCard) {
|
if (startCard && targetCard) {
|
||||||
attachCards(startCard, targetCard);
|
attachCards(startCard, targetCard);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delArrow();
|
delArrow();
|
||||||
|
for (auto *child : childArrows) {
|
||||||
for (ArrowAttachItem *child : childArrows) {
|
|
||||||
child->mouseReleaseEvent(event);
|
child->mouseReleaseEvent(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ArrowAttachItem::attachCards(CardItem *startCard, const CardItem *targetCard)
|
||||||
|
{
|
||||||
|
if (targetCard->getAttachedTo() || targetCard->getZone()->getName() != ZoneNames::TABLE) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// move card onto table first if attaching from some other zone
|
||||||
|
if (startCard->getZone()->getName() != ZoneNames::TABLE) {
|
||||||
|
player->getPlayerActions()->playCardToTable(startCard, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
Command_AttachCard cmd;
|
||||||
|
cmd.set_start_zone(ZoneNames::TABLE);
|
||||||
|
cmd.set_card_id(startCard->getId());
|
||||||
|
cmd.set_target_player_id(targetCard->getZone()->getPlayer()->getPlayerInfo()->getId());
|
||||||
|
cmd.set_target_zone(targetCard->getZone()->getName().toStdString());
|
||||||
|
cmd.set_target_card_id(targetCard->getId());
|
||||||
|
player->getPlayerActions()->sendGameCommand(cmd);
|
||||||
|
}
|
||||||
|
|
@ -1,40 +1,47 @@
|
||||||
/**
|
/**
|
||||||
* @file arrow_item.h
|
* @file arrow_item.h
|
||||||
* @ingroup GameGraphics
|
* @ingroup GameGraphics
|
||||||
* @brief TODO: Document this.
|
|
||||||
*/
|
*/
|
||||||
|
//! \todo Document this file.
|
||||||
|
|
||||||
#ifndef ARROWITEM_H
|
#ifndef ARROWITEM_H
|
||||||
#define ARROWITEM_H
|
#define ARROWITEM_H
|
||||||
|
|
||||||
|
#include "arrow_target.h"
|
||||||
|
|
||||||
#include <QGraphicsItem>
|
#include <QGraphicsItem>
|
||||||
|
#include <QPointer>
|
||||||
|
|
||||||
class CardItem;
|
class CardItem;
|
||||||
class QGraphicsSceneMouseEvent;
|
class QGraphicsSceneMouseEvent;
|
||||||
class QMenu;
|
class QMenu;
|
||||||
class Player;
|
class PlayerLogic;
|
||||||
class ArrowTarget;
|
|
||||||
|
|
||||||
class ArrowItem : public QObject, public QGraphicsItem
|
class ArrowItem : public QObject, public QGraphicsItem
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_INTERFACES(QGraphicsItem)
|
Q_INTERFACES(QGraphicsItem)
|
||||||
|
signals:
|
||||||
|
void requestDeletion(int id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
QMenu *menu;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Player *player;
|
PlayerLogic *player;
|
||||||
int id;
|
int id;
|
||||||
ArrowTarget *startItem, *targetItem;
|
QPointer<ArrowTarget> startItem;
|
||||||
bool targetLocked;
|
QPointer<ArrowTarget> targetItem;
|
||||||
|
bool targetLocked = false;
|
||||||
QColor color;
|
QColor color;
|
||||||
bool fullColor;
|
bool fullColor = true;
|
||||||
|
|
||||||
void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
|
void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ArrowItem(Player *_player, int _id, ArrowTarget *_startItem, ArrowTarget *_targetItem, const QColor &color);
|
ArrowItem(PlayerLogic *_player, int _id, ArrowTarget *_startItem, ArrowTarget *_targetItem, const QColor &_color);
|
||||||
~ArrowItem() override;
|
void onTargetDestroyed();
|
||||||
|
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
||||||
[[nodiscard]] QRectF boundingRect() const override
|
[[nodiscard]] QRectF boundingRect() const override
|
||||||
{
|
{
|
||||||
|
|
@ -44,6 +51,7 @@ public:
|
||||||
{
|
{
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
void updatePath();
|
void updatePath();
|
||||||
void updatePath(const QPointF &endPoint);
|
void updatePath(const QPointF &endPoint);
|
||||||
|
|
||||||
|
|
@ -51,18 +59,10 @@ public:
|
||||||
{
|
{
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
[[nodiscard]] Player *getPlayer() const
|
[[nodiscard]] PlayerLogic *getPlayer() const
|
||||||
{
|
{
|
||||||
return player;
|
return player;
|
||||||
}
|
}
|
||||||
void setStartItem(ArrowTarget *_item)
|
|
||||||
{
|
|
||||||
startItem = _item;
|
|
||||||
}
|
|
||||||
void setTargetItem(ArrowTarget *_item)
|
|
||||||
{
|
|
||||||
targetItem = _item;
|
|
||||||
}
|
|
||||||
[[nodiscard]] ArrowTarget *getStartItem() const
|
[[nodiscard]] ArrowTarget *getStartItem() const
|
||||||
{
|
{
|
||||||
return startItem;
|
return startItem;
|
||||||
|
|
@ -75,6 +75,7 @@ public:
|
||||||
{
|
{
|
||||||
targetLocked = _targetLocked;
|
targetLocked = _targetLocked;
|
||||||
}
|
}
|
||||||
|
|
||||||
void delArrow();
|
void delArrow();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -84,10 +85,11 @@ class ArrowDragItem : public ArrowItem
|
||||||
private:
|
private:
|
||||||
int deleteInPhase;
|
int deleteInPhase;
|
||||||
QList<ArrowDragItem *> childArrows;
|
QList<ArrowDragItem *> childArrows;
|
||||||
|
QMetaObject::Connection positionConnection;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ArrowDragItem(Player *_owner, ArrowTarget *_startItem, const QColor &_color, int _deleteInPhase);
|
ArrowDragItem(PlayerLogic *_owner, ArrowTarget *_startItem, const QColor &_color, int _deleteInPhase);
|
||||||
void addChildArrow(ArrowDragItem *childArrow);
|
void addChildArrow(ArrowDragItem *child);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
|
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
|
||||||
|
|
@ -99,12 +101,12 @@ class ArrowAttachItem : public ArrowItem
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
private:
|
private:
|
||||||
QList<ArrowAttachItem *> childArrows;
|
QList<ArrowAttachItem *> childArrows;
|
||||||
|
QMetaObject::Connection positionConnection;
|
||||||
void attachCards(CardItem *startCard, const CardItem *targetCard);
|
void attachCards(CardItem *startCard, const CardItem *targetCard);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ArrowAttachItem(ArrowTarget *_startItem);
|
explicit ArrowAttachItem(ArrowTarget *_startItem);
|
||||||
void addChildArrow(ArrowAttachItem *childArrow);
|
void addChildArrow(ArrowAttachItem *child);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
|
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
|
||||||
|
|
|
||||||
|
|
@ -1,41 +1,23 @@
|
||||||
#include "arrow_target.h"
|
#include "arrow_target.h"
|
||||||
|
|
||||||
#include "../player/player.h"
|
#include "../player/player_logic.h"
|
||||||
#include "arrow_item.h"
|
#include "arrow_item.h"
|
||||||
|
|
||||||
ArrowTarget::ArrowTarget(Player *_owner, QGraphicsItem *parent)
|
ArrowTarget::ArrowTarget(PlayerLogic *_owner, QGraphicsItem *parent) : AbstractGraphicsItem(parent), owner(_owner)
|
||||||
: AbstractGraphicsItem(parent), owner(_owner), beingPointedAt(false)
|
|
||||||
{
|
{
|
||||||
setFlag(ItemSendsScenePositionChanges);
|
setFlag(ItemSendsScenePositionChanges);
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrowTarget::~ArrowTarget()
|
|
||||||
{
|
|
||||||
for (int i = 0; i < arrowsFrom.size(); ++i) {
|
|
||||||
arrowsFrom[i]->setStartItem(0);
|
|
||||||
arrowsFrom[i]->delArrow();
|
|
||||||
}
|
|
||||||
for (int i = 0; i < arrowsTo.size(); ++i) {
|
|
||||||
arrowsTo[i]->setTargetItem(0);
|
|
||||||
arrowsTo[i]->delArrow();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ArrowTarget::setBeingPointedAt(bool _beingPointedAt)
|
void ArrowTarget::setBeingPointedAt(bool _beingPointedAt)
|
||||||
{
|
{
|
||||||
beingPointedAt = _beingPointedAt;
|
beingPointedAt = _beingPointedAt;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant ArrowTarget::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
|
QVariant ArrowTarget::itemChange(GraphicsItemChange change, const QVariant &value)
|
||||||
{
|
{
|
||||||
if (change == ItemScenePositionHasChanged && scene()) {
|
if (change == ItemScenePositionHasChanged) {
|
||||||
for (auto *arrow : arrowsFrom)
|
emit scenePositionChanged();
|
||||||
arrow->updatePath();
|
|
||||||
|
|
||||||
for (auto *arrow : arrowsTo)
|
|
||||||
arrow->updatePath();
|
|
||||||
}
|
}
|
||||||
|
return AbstractGraphicsItem::itemChange(change, value);
|
||||||
return QGraphicsItem::itemChange(change, value);
|
}
|
||||||
}
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/**
|
/**
|
||||||
* @file arrow_target.h
|
* @file arrow_target.h
|
||||||
* @ingroup GameGraphics
|
* @ingroup GameGraphics
|
||||||
* @brief TODO: Document this.
|
|
||||||
*/
|
*/
|
||||||
|
//! \todo Document this file.
|
||||||
|
|
||||||
#ifndef ARROWTARGET_H
|
#ifndef ARROWTARGET_H
|
||||||
#define ARROWTARGET_H
|
#define ARROWTARGET_H
|
||||||
|
|
@ -11,24 +11,26 @@
|
||||||
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
|
||||||
class Player;
|
class PlayerLogic;
|
||||||
class ArrowItem;
|
class ArrowItem;
|
||||||
|
|
||||||
class ArrowTarget : public AbstractGraphicsItem
|
class ArrowTarget : public AbstractGraphicsItem
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
protected:
|
protected:
|
||||||
Player *owner;
|
PlayerLogic *owner;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool beingPointedAt;
|
bool beingPointedAt = false;
|
||||||
QList<ArrowItem *> arrowsFrom, arrowsTo;
|
|
||||||
|
signals:
|
||||||
|
void scenePositionChanged();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ArrowTarget(Player *_owner, QGraphicsItem *parent = nullptr);
|
explicit ArrowTarget(PlayerLogic *_owner, QGraphicsItem *parent = nullptr);
|
||||||
~ArrowTarget() override;
|
~ArrowTarget() override = default;
|
||||||
|
|
||||||
[[nodiscard]] Player *getOwner() const
|
[[nodiscard]] PlayerLogic *getOwner() const
|
||||||
{
|
{
|
||||||
return owner;
|
return owner;
|
||||||
}
|
}
|
||||||
|
|
@ -39,32 +41,7 @@ public:
|
||||||
return beingPointedAt;
|
return beingPointedAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] const QList<ArrowItem *> &getArrowsFrom() const
|
|
||||||
{
|
|
||||||
return arrowsFrom;
|
|
||||||
}
|
|
||||||
void addArrowFrom(ArrowItem *arrow)
|
|
||||||
{
|
|
||||||
arrowsFrom.append(arrow);
|
|
||||||
}
|
|
||||||
void removeArrowFrom(ArrowItem *arrow)
|
|
||||||
{
|
|
||||||
arrowsFrom.removeOne(arrow);
|
|
||||||
}
|
|
||||||
[[nodiscard]] const QList<ArrowItem *> &getArrowsTo() const
|
|
||||||
{
|
|
||||||
return arrowsTo;
|
|
||||||
}
|
|
||||||
void addArrowTo(ArrowItem *arrow)
|
|
||||||
{
|
|
||||||
arrowsTo.append(arrow);
|
|
||||||
}
|
|
||||||
void removeArrowTo(ArrowItem *arrow)
|
|
||||||
{
|
|
||||||
arrowsTo.removeOne(arrow);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QVariant itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) override;
|
QVariant itemChange(GraphicsItemChange change, const QVariant &value) override;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
#include "card_drag_item.h"
|
#include "card_drag_item.h"
|
||||||
|
|
||||||
|
#include "../../game_graphics/zones/card_zone.h"
|
||||||
|
#include "../../game_graphics/zones/table_zone.h"
|
||||||
|
#include "../../game_graphics/zones/view_zone.h"
|
||||||
#include "../game_scene.h"
|
#include "../game_scene.h"
|
||||||
#include "../zones/card_zone.h"
|
|
||||||
#include "../zones/table_zone.h"
|
|
||||||
#include "../zones/view_zone.h"
|
|
||||||
#include "card_item.h"
|
#include "card_item.h"
|
||||||
|
|
||||||
#include <QCursor>
|
#include <QCursor>
|
||||||
|
|
@ -13,9 +13,10 @@
|
||||||
CardDragItem::CardDragItem(CardItem *_item,
|
CardDragItem::CardDragItem(CardItem *_item,
|
||||||
int _id,
|
int _id,
|
||||||
const QPointF &_hotSpot,
|
const QPointF &_hotSpot,
|
||||||
bool _faceDown,
|
bool _forceFaceDown,
|
||||||
AbstractCardDragItem *parentDrag)
|
AbstractCardDragItem *parentDrag)
|
||||||
: AbstractCardDragItem(_item, _hotSpot, parentDrag), id(_id), faceDown(_faceDown), occupied(false), currentZone(0)
|
: AbstractCardDragItem(_item, _hotSpot, parentDrag), id(_id), forceFaceDown(_forceFaceDown), occupied(false),
|
||||||
|
currentZone(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -23,8 +24,9 @@ void CardDragItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
|
||||||
{
|
{
|
||||||
AbstractCardDragItem::paint(painter, option, widget);
|
AbstractCardDragItem::paint(painter, option, widget);
|
||||||
|
|
||||||
if (occupied)
|
if (occupied) {
|
||||||
painter->fillPath(shape(), QColor(200, 0, 0, 100));
|
painter->fillPath(shape(), QColor(200, 0, 0, 100));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CardDragItem::updatePosition(const QPointF &cursorScenePos)
|
void CardDragItem::updatePosition(const QPointF &cursorScenePos)
|
||||||
|
|
@ -37,16 +39,19 @@ void CardDragItem::updatePosition(const QPointF &cursorScenePos)
|
||||||
ZoneViewZone *zoneViewZone = 0;
|
ZoneViewZone *zoneViewZone = 0;
|
||||||
for (int i = colliding.size() - 1; i >= 0; i--) {
|
for (int i = colliding.size() - 1; i >= 0; i--) {
|
||||||
CardZone *temp = qgraphicsitem_cast<CardZone *>(colliding.at(i));
|
CardZone *temp = qgraphicsitem_cast<CardZone *>(colliding.at(i));
|
||||||
if (!cardZone)
|
if (!cardZone) {
|
||||||
cardZone = temp;
|
cardZone = temp;
|
||||||
if (!zoneViewZone)
|
}
|
||||||
|
if (!zoneViewZone) {
|
||||||
zoneViewZone = qobject_cast<ZoneViewZone *>(temp);
|
zoneViewZone = qobject_cast<ZoneViewZone *>(temp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
CardZone *cursorZone = 0;
|
CardZone *cursorZone = 0;
|
||||||
if (zoneViewZone)
|
if (zoneViewZone) {
|
||||||
cursorZone = zoneViewZone;
|
cursorZone = zoneViewZone;
|
||||||
else if (cardZone)
|
} else if (cardZone) {
|
||||||
cursorZone = cardZone;
|
cursorZone = cardZone;
|
||||||
|
}
|
||||||
|
|
||||||
// Always update the current zone, even if its null, to cancel the drag
|
// Always update the current zone, even if its null, to cancel the drag
|
||||||
// instead of dropping cards into an non-intuitive location.
|
// instead of dropping cards into an non-intuitive location.
|
||||||
|
|
@ -58,8 +63,9 @@ void CardDragItem::updatePosition(const QPointF &cursorScenePos)
|
||||||
QPointF newPos = cursorScenePos - hotSpot;
|
QPointF newPos = cursorScenePos - hotSpot;
|
||||||
|
|
||||||
if (newPos != pos()) {
|
if (newPos != pos()) {
|
||||||
for (int i = 0; i < childDrags.size(); i++)
|
for (int i = 0; i < childDrags.size(); i++) {
|
||||||
childDrags[i]->setPos(newPos + childDrags[i]->getHotSpot());
|
childDrags[i]->setPos(newPos + childDrags[i]->getHotSpot());
|
||||||
|
}
|
||||||
setPos(newPos);
|
setPos(newPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -77,23 +83,27 @@ void CardDragItem::updatePosition(const QPointF &cursorScenePos)
|
||||||
// position.
|
// position.
|
||||||
TableZone *tableZone = qobject_cast<TableZone *>(cursorZone);
|
TableZone *tableZone = qobject_cast<TableZone *>(cursorZone);
|
||||||
QPointF closestGridPoint;
|
QPointF closestGridPoint;
|
||||||
if (tableZone)
|
if (tableZone) {
|
||||||
closestGridPoint = tableZone->closestGridPoint(cursorPosInZone);
|
closestGridPoint = tableZone->closestGridPoint(cursorPosInZone);
|
||||||
else
|
} else {
|
||||||
closestGridPoint = cursorPosInZone - hotSpot;
|
closestGridPoint = cursorPosInZone - hotSpot;
|
||||||
|
}
|
||||||
|
|
||||||
QPointF newPos = zonePos + closestGridPoint;
|
QPointF newPos = zonePos + closestGridPoint;
|
||||||
|
|
||||||
if (newPos != pos()) {
|
if (newPos != pos()) {
|
||||||
for (int i = 0; i < childDrags.size(); i++)
|
for (int i = 0; i < childDrags.size(); i++) {
|
||||||
childDrags[i]->setPos(newPos + childDrags[i]->getHotSpot());
|
childDrags[i]->setPos(newPos + childDrags[i]->getHotSpot());
|
||||||
|
}
|
||||||
setPos(newPos);
|
setPos(newPos);
|
||||||
|
|
||||||
bool newOccupied = false;
|
bool newOccupied = false;
|
||||||
TableZone *table = qobject_cast<TableZone *>(cursorZone);
|
TableZone *table = qobject_cast<TableZone *>(cursorZone);
|
||||||
if (table)
|
if (table) {
|
||||||
if (table->getCardFromCoords(closestGridPoint))
|
if (table->getCardFromCoords(closestGridPoint)) {
|
||||||
newOccupied = true;
|
newOccupied = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (newOccupied != occupied) {
|
if (newOccupied != occupied) {
|
||||||
occupied = newOccupied;
|
occupied = newOccupied;
|
||||||
update();
|
update();
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/**
|
/**
|
||||||
* @file card_drag_item.h
|
* @file card_drag_item.h
|
||||||
* @ingroup GameGraphicsCards
|
* @ingroup GameGraphicsCards
|
||||||
* @brief TODO: Document this.
|
|
||||||
*/
|
*/
|
||||||
|
//! \todo Document this file.
|
||||||
|
|
||||||
#ifndef CARDDRAGITEM_H
|
#ifndef CARDDRAGITEM_H
|
||||||
#define CARDDRAGITEM_H
|
#define CARDDRAGITEM_H
|
||||||
|
|
@ -16,7 +16,7 @@ class CardDragItem : public AbstractCardDragItem
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
private:
|
private:
|
||||||
int id;
|
int id;
|
||||||
bool faceDown;
|
bool forceFaceDown;
|
||||||
bool occupied;
|
bool occupied;
|
||||||
CardZone *currentZone;
|
CardZone *currentZone;
|
||||||
|
|
||||||
|
|
@ -24,15 +24,15 @@ public:
|
||||||
CardDragItem(CardItem *_item,
|
CardDragItem(CardItem *_item,
|
||||||
int _id,
|
int _id,
|
||||||
const QPointF &_hotSpot,
|
const QPointF &_hotSpot,
|
||||||
bool _faceDown,
|
bool _forceFaceDown,
|
||||||
AbstractCardDragItem *parentDrag = 0);
|
AbstractCardDragItem *parentDrag = 0);
|
||||||
int getId() const
|
int getId() const
|
||||||
{
|
{
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
bool getFaceDown() const
|
bool isForceFaceDown() const
|
||||||
{
|
{
|
||||||
return faceDown;
|
return forceFaceDown;
|
||||||
}
|
}
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
||||||
void updatePosition(const QPointF &cursorScenePos) override;
|
void updatePosition(const QPointF &cursorScenePos) override;
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
#include "card_item.h"
|
#include "card_item.h"
|
||||||
|
|
||||||
#include "../../client/settings/cache_settings.h"
|
#include "../../client/settings/cache_settings.h"
|
||||||
|
#include "../../game_graphics/zones/table_zone.h"
|
||||||
|
#include "../../game_graphics/zones/view_zone.h"
|
||||||
#include "../../interface/widgets/tabs/tab_game.h"
|
#include "../../interface/widgets/tabs/tab_game.h"
|
||||||
#include "../game_scene.h"
|
#include "../game_scene.h"
|
||||||
#include "../phase.h"
|
#include "../phase.h"
|
||||||
#include "../player/player.h"
|
|
||||||
#include "../player/player_actions.h"
|
#include "../player/player_actions.h"
|
||||||
#include "../zones/logic/view_zone_logic.h"
|
#include "../player/player_logic.h"
|
||||||
#include "../zones/table_zone.h"
|
#include "../zones/view_zone_logic.h"
|
||||||
#include "../zones/view_zone.h"
|
|
||||||
#include "arrow_item.h"
|
#include "arrow_item.h"
|
||||||
#include "card_drag_item.h"
|
#include "card_drag_item.h"
|
||||||
|
|
||||||
|
|
@ -20,15 +20,19 @@
|
||||||
#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>
|
||||||
|
|
||||||
CardItem::CardItem(Player *_owner, QGraphicsItem *parent, const CardRef &cardRef, int _cardid, CardZoneLogic *_zone)
|
CardItem::CardItem(PlayerLogic *_owner,
|
||||||
: AbstractCardItem(parent, cardRef, _owner, _cardid), zone(_zone), attacking(false), destroyOnZoneChange(false),
|
QGraphicsItem *parent,
|
||||||
doesntUntap(false), dragItem(nullptr), attachedTo(nullptr)
|
const CardRef &cardRef,
|
||||||
|
int _cardid,
|
||||||
|
CardZoneLogic *_zone)
|
||||||
|
: AbstractCardItem(parent, cardRef, _owner, _cardid), state(new CardState(this, _zone)), dragItem(nullptr)
|
||||||
{
|
{
|
||||||
owner->addCard(this);
|
owner->addCard(this);
|
||||||
|
|
||||||
connect(&SettingsCache::instance().cardCounters(), &CardCounterSettings::colorChanged, this, [this](int counterId) {
|
connect(&SettingsCache::instance().cardCounters(), &CardCounterSettings::colorChanged, this, [this](int counterId) {
|
||||||
if (counters.contains(counterId))
|
if (state->getCounters().contains(counterId)) {
|
||||||
update();
|
update();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -47,23 +51,24 @@ void CardItem::prepareDelete()
|
||||||
attachedCards.first()->setAttachedTo(nullptr);
|
attachedCards.first()->setAttachedTo(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attachedTo != nullptr) {
|
if (state->getAttachedTo() != nullptr) {
|
||||||
attachedTo->removeAttachedCard(this);
|
state->getAttachedTo()->removeAttachedCard(this);
|
||||||
attachedTo = nullptr;
|
state->setAttachedTo(nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CardItem::deleteLater()
|
void CardItem::deleteLater()
|
||||||
{
|
{
|
||||||
prepareDelete();
|
prepareDelete();
|
||||||
if (scene())
|
if (scene()) {
|
||||||
static_cast<GameScene *>(scene())->unregisterAnimationItem(this);
|
static_cast<GameScene *>(scene())->unregisterAnimationItem(this);
|
||||||
|
}
|
||||||
AbstractCardItem::deleteLater();
|
AbstractCardItem::deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CardItem::setZone(CardZoneLogic *_zone)
|
void CardItem::setZone(CardZoneLogic *_zone)
|
||||||
{
|
{
|
||||||
zone = _zone;
|
state->setZone(_zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CardItem::retranslateUi()
|
void CardItem::retranslateUi()
|
||||||
|
|
@ -78,23 +83,23 @@ void CardItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
AbstractCardItem::paint(painter, option, widget);
|
AbstractCardItem::paint(painter, option, widget);
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
QMapIterator<int, int> counterIterator(counters);
|
QMapIterator<int, int> counterIterator(state->getCounters());
|
||||||
while (counterIterator.hasNext()) {
|
while (counterIterator.hasNext()) {
|
||||||
counterIterator.next();
|
counterIterator.next();
|
||||||
QColor _color = cardCounterSettings.color(counterIterator.key());
|
QColor _color = cardCounterSettings.color(counterIterator.key());
|
||||||
|
|
||||||
paintNumberEllipse(counterIterator.value(), 14, _color, i, counters.size(), painter);
|
paintNumberEllipse(counterIterator.value(), 14, _color, i, state->getCounters().size(), painter);
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
QSizeF translatedSize = getTranslatedSize(painter);
|
QSizeF translatedSize = getTranslatedSize(painter);
|
||||||
qreal scaleFactor = translatedSize.width() / boundingRect().width();
|
qreal scaleFactor = translatedSize.width() / boundingRect().width();
|
||||||
|
|
||||||
if (!pt.isEmpty()) {
|
if (!state->getPT().isEmpty()) {
|
||||||
painter->save();
|
painter->save();
|
||||||
transformPainter(painter, translatedSize, tapAngle);
|
transformPainter(painter, translatedSize, tapAngle);
|
||||||
|
|
||||||
if (!getFaceDown() && pt == exactCard.getInfo().getPowTough()) {
|
if (!getFaceDown() && state->getPT() == exactCard.getInfo().getPowTough()) {
|
||||||
painter->setPen(Qt::white);
|
painter->setPen(Qt::white);
|
||||||
} else {
|
} else {
|
||||||
painter->setPen(QColor(255, 150, 0)); // dark orange
|
painter->setPen(QColor(255, 150, 0)); // dark orange
|
||||||
|
|
@ -105,11 +110,11 @@ void CardItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
|
|
||||||
painter->drawText(QRectF(4 * scaleFactor, 4 * scaleFactor, translatedSize.width() - 10 * scaleFactor,
|
painter->drawText(QRectF(4 * scaleFactor, 4 * scaleFactor, translatedSize.width() - 10 * scaleFactor,
|
||||||
translatedSize.height() - 8 * scaleFactor),
|
translatedSize.height() - 8 * scaleFactor),
|
||||||
Qt::AlignRight | Qt::AlignBottom, pt);
|
Qt::AlignRight | Qt::AlignBottom, state->getPT());
|
||||||
painter->restore();
|
painter->restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!annotation.isEmpty()) {
|
if (!state->getAnnotation().isEmpty()) {
|
||||||
painter->save();
|
painter->save();
|
||||||
|
|
||||||
transformPainter(painter, translatedSize, tapAngle);
|
transformPainter(painter, translatedSize, tapAngle);
|
||||||
|
|
@ -119,7 +124,7 @@ void CardItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
|
|
||||||
painter->drawText(QRectF(4 * scaleFactor, 4 * scaleFactor, translatedSize.width() - 8 * scaleFactor,
|
painter->drawText(QRectF(4 * scaleFactor, 4 * scaleFactor, translatedSize.width() - 8 * scaleFactor,
|
||||||
translatedSize.height() - 8 * scaleFactor),
|
translatedSize.height() - 8 * scaleFactor),
|
||||||
Qt::AlignCenter | Qt::TextWrapAnywhere, annotation);
|
Qt::AlignCenter | Qt::TextWrapAnywhere, state->getAnnotation());
|
||||||
painter->restore();
|
painter->restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -127,7 +132,7 @@ void CardItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
painter->fillPath(shape(), QBrush(QColor(255, 0, 0, 100)));
|
painter->fillPath(shape(), QBrush(QColor(255, 0, 0, 100)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (doesntUntap) {
|
if (state->getDoesntUntap()) {
|
||||||
painter->save();
|
painter->save();
|
||||||
|
|
||||||
painter->setRenderHint(QPainter::Antialiasing, false);
|
painter->setRenderHint(QPainter::Antialiasing, false);
|
||||||
|
|
@ -146,97 +151,91 @@ void CardItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
|
|
||||||
void CardItem::setAttacking(bool _attacking)
|
void CardItem::setAttacking(bool _attacking)
|
||||||
{
|
{
|
||||||
attacking = _attacking;
|
state->setAttacking(_attacking);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CardItem::setCounter(int _id, int _value)
|
void CardItem::setCounter(int _id, int _value)
|
||||||
{
|
{
|
||||||
if (_value)
|
state->setCounter(_id, _value);
|
||||||
counters.insert(_id, _value);
|
|
||||||
else
|
|
||||||
counters.remove(_id);
|
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CardItem::setAnnotation(const QString &_annotation)
|
void CardItem::setAnnotation(const QString &_annotation)
|
||||||
{
|
{
|
||||||
annotation = _annotation;
|
state->setAnnotation(_annotation);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CardItem::setDoesntUntap(bool _doesntUntap)
|
void CardItem::setDoesntUntap(bool _doesntUntap)
|
||||||
{
|
{
|
||||||
doesntUntap = _doesntUntap;
|
state->setDoesntUntap(_doesntUntap);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CardItem::setPT(const QString &_pt)
|
void CardItem::setPT(const QString &_pt)
|
||||||
{
|
{
|
||||||
pt = _pt;
|
state->setPT(_pt);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CardItem::setAttachedTo(CardItem *_attachedTo)
|
void CardItem::setAttachedTo(CardItem *_attachedTo)
|
||||||
{
|
{
|
||||||
if (attachedTo != nullptr) {
|
if (state->getAttachedTo() != nullptr) {
|
||||||
attachedTo->removeAttachedCard(this);
|
state->getAttachedTo()->removeAttachedCard(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
gridPoint.setX(-1);
|
gridPoint.setX(-1);
|
||||||
attachedTo = _attachedTo;
|
state->setAttachedTo(_attachedTo);
|
||||||
if (attachedTo != nullptr) {
|
if (state->getAttachedTo() != nullptr) {
|
||||||
// If the zone is being torn down, it might already be null by the time a card tries to un-attach all its
|
// If the zone is being torn down, it might already be null by the time a card tries to un-attach all its
|
||||||
// attached cards
|
// attached cards
|
||||||
if (attachedTo->zone == nullptr) {
|
if (state->getAttachedTo()->getZone() == nullptr) {
|
||||||
deleteLater();
|
deleteLater();
|
||||||
} else {
|
} else {
|
||||||
emit attachedTo->zone->cardAdded(this);
|
emit state->getAttachedTo()->getZone()->cardAdded(this);
|
||||||
attachedTo->addAttachedCard(this);
|
state->getAttachedTo()->addAttachedCard(this);
|
||||||
if (zone != attachedTo->getZone()) {
|
if (state->getZone() != state->getAttachedTo()->getZone()) {
|
||||||
attachedTo->getZone()->reorganizeCards();
|
state->getAttachedTo()->getZone()->reorganizeCards();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// If the zone is being torn down, it might already be null by the time a card tries to un-attach all its
|
// If the zone is being torn down, it might already be null by the time a card tries to un-attach all its
|
||||||
// attached cards
|
// attached cards
|
||||||
if (zone == nullptr) {
|
if (state->getZone() == nullptr) {
|
||||||
deleteLater();
|
deleteLater();
|
||||||
} else {
|
} else {
|
||||||
emit zone->cardAdded(this);
|
emit state->getZone()->cardAdded(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (zone != nullptr) {
|
if (state->getZone() != nullptr) {
|
||||||
zone->reorganizeCards();
|
state->getZone()->reorganizeCards();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Resets the fields that should be reset after a zone transition
|
||||||
|
*/
|
||||||
void CardItem::resetState(bool keepAnnotations)
|
void CardItem::resetState(bool keepAnnotations)
|
||||||
{
|
{
|
||||||
attacking = false;
|
state->resetState(keepAnnotations);
|
||||||
facedown = false;
|
|
||||||
counters.clear();
|
|
||||||
pt.clear();
|
|
||||||
if (!keepAnnotations) {
|
|
||||||
annotation.clear();
|
|
||||||
}
|
|
||||||
attachedTo = 0;
|
|
||||||
attachedCards.clear();
|
attachedCards.clear();
|
||||||
setTapped(false, false);
|
setTapped(false, false);
|
||||||
setDoesntUntap(false);
|
setDoesntUntap(false);
|
||||||
if (scene())
|
if (scene()) {
|
||||||
static_cast<GameScene *>(scene())->unregisterAnimationItem(this);
|
static_cast<GameScene *>(scene())->unregisterAnimationItem(this);
|
||||||
|
}
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CardItem::processCardInfo(const ServerInfo_Card &_info)
|
void CardItem::processCardInfo(const ServerInfo_Card &_info)
|
||||||
{
|
{
|
||||||
counters.clear();
|
state->clearCounters();
|
||||||
const int counterListSize = _info.counter_list_size();
|
const int counterListSize = _info.counter_list_size();
|
||||||
for (int i = 0; i < counterListSize; ++i) {
|
for (int i = 0; i < counterListSize; ++i) {
|
||||||
const ServerInfo_CardCounter &counterInfo = _info.counter_list(i);
|
const ServerInfo_CardCounter &counterInfo = _info.counter_list(i);
|
||||||
counters.insert(counterInfo.id(), counterInfo.value());
|
state->insertCounter(counterInfo.id(), counterInfo.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
setId(_info.id());
|
setId(_info.id());
|
||||||
|
|
@ -251,10 +250,10 @@ void CardItem::processCardInfo(const ServerInfo_Card &_info)
|
||||||
setDoesntUntap(_info.doesnt_untap());
|
setDoesntUntap(_info.doesnt_untap());
|
||||||
}
|
}
|
||||||
|
|
||||||
CardDragItem *CardItem::createDragItem(int _id, const QPointF &_pos, const QPointF &_scenePos, bool faceDown)
|
CardDragItem *CardItem::createDragItem(int _id, const QPointF &_pos, const QPointF &_scenePos, bool forceFaceDown)
|
||||||
{
|
{
|
||||||
deleteDragItem();
|
deleteDragItem();
|
||||||
dragItem = new CardDragItem(this, _id, _pos, faceDown);
|
dragItem = new CardDragItem(this, _id, _pos, forceFaceDown);
|
||||||
dragItem->setVisible(false);
|
dragItem->setVisible(false);
|
||||||
scene()->addItem(dragItem);
|
scene()->addItem(dragItem);
|
||||||
dragItem->updatePosition(_scenePos);
|
dragItem->updatePosition(_scenePos);
|
||||||
|
|
@ -273,11 +272,12 @@ void CardItem::deleteDragItem()
|
||||||
|
|
||||||
void CardItem::drawArrow(const QColor &arrowColor)
|
void CardItem::drawArrow(const QColor &arrowColor)
|
||||||
{
|
{
|
||||||
if (owner->getGame()->getPlayerManager()->isSpectator())
|
if (owner->getGame()->getPlayerManager()->isSpectator()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto *game = owner->getGame();
|
auto *game = owner->getGame();
|
||||||
Player *arrowOwner = game->getPlayerManager()->getActiveLocalPlayer(game->getGameState()->getActivePlayer());
|
PlayerLogic *arrowOwner = game->getPlayerManager()->getActiveLocalPlayer(game->getGameState()->getActivePlayer());
|
||||||
int phase = 0; // 0 means to not set the phase
|
int phase = 0; // 0 means to not set the phase
|
||||||
if (SettingsCache::instance().getDoNotDeleteArrowsInSubPhases()) {
|
if (SettingsCache::instance().getDoNotDeleteArrowsInSubPhases()) {
|
||||||
int currentPhase = game->getGameState()->getCurrentPhase();
|
int currentPhase = game->getGameState()->getCurrentPhase();
|
||||||
|
|
@ -289,10 +289,12 @@ void CardItem::drawArrow(const QColor &arrowColor)
|
||||||
|
|
||||||
for (const auto &item : scene()->selectedItems()) {
|
for (const auto &item : scene()->selectedItems()) {
|
||||||
CardItem *card = qgraphicsitem_cast<CardItem *>(item);
|
CardItem *card = qgraphicsitem_cast<CardItem *>(item);
|
||||||
if (card == nullptr || card == this)
|
if (card == nullptr || card == this) {
|
||||||
continue;
|
continue;
|
||||||
if (card->getZone() != zone)
|
}
|
||||||
|
if (card->getZone() != state->getZone()) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
ArrowDragItem *childArrow = new ArrowDragItem(arrowOwner, card, arrowColor, phase);
|
ArrowDragItem *childArrow = new ArrowDragItem(arrowOwner, card, arrowColor, phase);
|
||||||
scene()->addItem(childArrow);
|
scene()->addItem(childArrow);
|
||||||
|
|
@ -302,8 +304,9 @@ void CardItem::drawArrow(const QColor &arrowColor)
|
||||||
|
|
||||||
void CardItem::drawAttachArrow()
|
void CardItem::drawAttachArrow()
|
||||||
{
|
{
|
||||||
if (owner->getGame()->getPlayerManager()->isSpectator())
|
if (owner->getGame()->getPlayerManager()->isSpectator()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto *arrow = new ArrowAttachItem(this);
|
auto *arrow = new ArrowAttachItem(this);
|
||||||
scene()->addItem(arrow);
|
scene()->addItem(arrow);
|
||||||
|
|
@ -311,10 +314,12 @@ void CardItem::drawAttachArrow()
|
||||||
|
|
||||||
for (const auto &item : scene()->selectedItems()) {
|
for (const auto &item : scene()->selectedItems()) {
|
||||||
CardItem *card = qgraphicsitem_cast<CardItem *>(item);
|
CardItem *card = qgraphicsitem_cast<CardItem *>(item);
|
||||||
if (card == nullptr)
|
if (card == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
if (card->getZone() != zone)
|
}
|
||||||
|
if (card->getZone() != state->getZone()) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
ArrowAttachItem *childArrow = new ArrowAttachItem(card);
|
ArrowAttachItem *childArrow = new ArrowAttachItem(card);
|
||||||
scene()->addItem(childArrow);
|
scene()->addItem(childArrow);
|
||||||
|
|
@ -326,46 +331,53 @@ void CardItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (event->buttons().testFlag(Qt::RightButton)) {
|
if (event->buttons().testFlag(Qt::RightButton)) {
|
||||||
if ((event->screenPos() - event->buttonDownScreenPos(Qt::RightButton)).manhattanLength() <
|
if ((event->screenPos() - event->buttonDownScreenPos(Qt::RightButton)).manhattanLength() <
|
||||||
2 * QApplication::startDragDistance())
|
2 * QApplication::startDragDistance()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QColor arrowColor = Qt::red;
|
QColor arrowColor = Qt::red;
|
||||||
if (event->modifiers().testFlag(Qt::ControlModifier))
|
if (event->modifiers().testFlag(Qt::ControlModifier)) {
|
||||||
arrowColor = Qt::yellow;
|
arrowColor = Qt::yellow;
|
||||||
else if (event->modifiers().testFlag(Qt::AltModifier))
|
} else if (event->modifiers().testFlag(Qt::AltModifier)) {
|
||||||
arrowColor = Qt::blue;
|
arrowColor = Qt::blue;
|
||||||
else if (event->modifiers().testFlag(Qt::ShiftModifier))
|
} else if (event->modifiers().testFlag(Qt::ShiftModifier)) {
|
||||||
arrowColor = Qt::green;
|
arrowColor = Qt::green;
|
||||||
|
}
|
||||||
|
|
||||||
drawArrow(arrowColor);
|
drawArrow(arrowColor);
|
||||||
} else if (event->buttons().testFlag(Qt::LeftButton)) {
|
} else if (event->buttons().testFlag(Qt::LeftButton)) {
|
||||||
if ((event->screenPos() - event->buttonDownScreenPos(Qt::LeftButton)).manhattanLength() <
|
if ((event->screenPos() - event->buttonDownScreenPos(Qt::LeftButton)).manhattanLength() <
|
||||||
2 * QApplication::startDragDistance())
|
2 * QApplication::startDragDistance()) {
|
||||||
return;
|
return;
|
||||||
if (const ZoneViewZoneLogic *view = qobject_cast<const ZoneViewZoneLogic *>(zone)) {
|
}
|
||||||
if (view->getRevealZone() && !view->getWriteableRevealZone())
|
if (const ZoneViewZoneLogic *view = qobject_cast<const ZoneViewZoneLogic *>(state->getZone())) {
|
||||||
|
if (view->getRevealZone() && !view->getWriteableRevealZone()) {
|
||||||
return;
|
return;
|
||||||
} else if (!owner->getPlayerInfo()->getLocalOrJudge())
|
}
|
||||||
|
} else if (!owner->getPlayerInfo()->getLocalOrJudge()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
bool forceFaceDown = event->modifiers().testFlag(Qt::ShiftModifier);
|
bool forceFaceDown = event->modifiers().testFlag(Qt::ShiftModifier);
|
||||||
|
|
||||||
// Use the buttonDownPos to align the hot spot with the position when
|
// Use the buttonDownPos to align the hot spot with the position when
|
||||||
// the user originally clicked
|
// the user originally clicked
|
||||||
createDragItem(id, event->buttonDownPos(Qt::LeftButton), event->scenePos(), facedown || forceFaceDown);
|
createDragItem(id, event->buttonDownPos(Qt::LeftButton), event->scenePos(), forceFaceDown);
|
||||||
dragItem->grabMouse();
|
dragItem->grabMouse();
|
||||||
|
|
||||||
int childIndex = 0;
|
int childIndex = 0;
|
||||||
for (const auto &item : scene()->selectedItems()) {
|
for (const auto &item : scene()->selectedItems()) {
|
||||||
CardItem *card = static_cast<CardItem *>(item);
|
CardItem *card = static_cast<CardItem *>(item);
|
||||||
if ((card == this) || (card->getZone() != zone))
|
if ((card == this) || (card->getZone() != state->getZone())) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
++childIndex;
|
++childIndex;
|
||||||
QPointF childPos;
|
QPointF childPos;
|
||||||
if (zone->getHasCardAttr())
|
if (state->getZone()->getHasCardAttr()) {
|
||||||
childPos = card->pos() - pos();
|
childPos = card->pos() - pos();
|
||||||
else
|
} else {
|
||||||
childPos = QPointF(childIndex * CARD_WIDTH / 2, 0);
|
childPos = QPointF(childIndex * CardDimensions::WIDTH_HALF_F, 0);
|
||||||
|
}
|
||||||
CardDragItem *drag =
|
CardDragItem *drag =
|
||||||
new CardDragItem(card, card->getId(), childPos, card->getFaceDown() || forceFaceDown, dragItem);
|
new CardDragItem(card, card->getId(), childPos, card->getFaceDown() || forceFaceDown, dragItem);
|
||||||
drag->setPos(dragItem->pos() + childPos);
|
drag->setPos(dragItem->pos() + childPos);
|
||||||
|
|
@ -378,22 +390,54 @@ void CardItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||||
void CardItem::playCard(bool faceDown)
|
void CardItem::playCard(bool faceDown)
|
||||||
{
|
{
|
||||||
// Do nothing if the card belongs to another player
|
// Do nothing if the card belongs to another player
|
||||||
if (!owner->getPlayerInfo()->getLocalOrJudge())
|
if (!owner->getPlayerInfo()->getLocalOrJudge()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
TableZoneLogic *tz = qobject_cast<TableZoneLogic *>(zone);
|
TableZoneLogic *tz = qobject_cast<TableZoneLogic *>(state->getZone());
|
||||||
if (tz)
|
if (tz) {
|
||||||
emit tz->toggleTapped();
|
emit tz->toggleTapped();
|
||||||
else {
|
} else {
|
||||||
if (SettingsCache::instance().getClickPlaysAllSelected()) {
|
if (SettingsCache::instance().getClickPlaysAllSelected()) {
|
||||||
faceDown ? zone->getPlayer()->getPlayerActions()->actPlayFacedown()
|
faceDown ? state->getZone()->getPlayer()->getPlayerActions()->actPlayFacedown()
|
||||||
: zone->getPlayer()->getPlayerActions()->actPlay();
|
: state->getZone()->getPlayer()->getPlayerActions()->actPlay();
|
||||||
} else {
|
} else {
|
||||||
zone->getPlayer()->getPlayerActions()->playCard(this, faceDown);
|
state->getZone()->getPlayer()->getPlayerActions()->playCard(this, faceDown);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVariantList CardItem::parsePT(const QString &pt)
|
||||||
|
{
|
||||||
|
QVariantList ptList = QVariantList();
|
||||||
|
if (!pt.isEmpty()) {
|
||||||
|
int sep = pt.indexOf('/');
|
||||||
|
if (sep == 0) {
|
||||||
|
ptList.append(QVariant(pt.mid(1))); // cut off starting '/' and take full string
|
||||||
|
} else {
|
||||||
|
int start = 0;
|
||||||
|
for (;;) {
|
||||||
|
QString item = pt.mid(start, sep - start);
|
||||||
|
if (item.isEmpty()) {
|
||||||
|
ptList.append(QVariant(QString()));
|
||||||
|
} else if (item[0] == '+') {
|
||||||
|
ptList.append(QVariant(item.mid(1).toInt())); // add as int
|
||||||
|
} else if (item[0] == '-') {
|
||||||
|
ptList.append(QVariant(item.toInt())); // add as int
|
||||||
|
} else {
|
||||||
|
ptList.append(QVariant(item)); // add as qstring
|
||||||
|
}
|
||||||
|
if (sep == -1) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
start = sep + 1;
|
||||||
|
sep = pt.indexOf('/', start);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ptList;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief returns true if the zone is a unwritable reveal zone view (eg a card reveal window). Will return false if zone
|
* @brief returns true if the zone is a unwritable reveal zone view (eg a card reveal window). Will return false if zone
|
||||||
* is nullptr.
|
* is nullptr.
|
||||||
|
|
@ -414,11 +458,11 @@ static bool isUnwritableRevealZone(CardZoneLogic *zone)
|
||||||
*/
|
*/
|
||||||
void CardItem::handleClickedToPlay(bool shiftHeld)
|
void CardItem::handleClickedToPlay(bool shiftHeld)
|
||||||
{
|
{
|
||||||
if (isUnwritableRevealZone(zone)) {
|
if (isUnwritableRevealZone(state->getZone())) {
|
||||||
if (SettingsCache::instance().getClickPlaysAllSelected()) {
|
if (SettingsCache::instance().getClickPlaysAllSelected()) {
|
||||||
zone->getPlayer()->getPlayerActions()->actHide();
|
state->getZone()->getPlayer()->getPlayerActions()->actHide();
|
||||||
} else {
|
} else {
|
||||||
zone->removeCard(this);
|
state->getZone()->removeCard(this);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
playCard(shiftHeld);
|
playCard(shiftHeld);
|
||||||
|
|
@ -460,8 +504,9 @@ bool CardItem::animationEvent()
|
||||||
{
|
{
|
||||||
int rotation = ROTATION_DEGREES_PER_FRAME;
|
int rotation = ROTATION_DEGREES_PER_FRAME;
|
||||||
bool animationIncomplete = true;
|
bool animationIncomplete = true;
|
||||||
if (!tapped)
|
if (!tapped) {
|
||||||
rotation *= -1;
|
rotation *= -1;
|
||||||
|
}
|
||||||
|
|
||||||
tapAngle += rotation;
|
tapAngle += rotation;
|
||||||
if (tapped && (tapAngle > 90)) {
|
if (tapped && (tapAngle > 90)) {
|
||||||
|
|
@ -474,9 +519,9 @@ bool CardItem::animationEvent()
|
||||||
}
|
}
|
||||||
|
|
||||||
setTransform(QTransform()
|
setTransform(QTransform()
|
||||||
.translate(CARD_WIDTH_HALF, CARD_HEIGHT_HALF)
|
.translate(CardDimensions::WIDTH_HALF_F, CardDimensions::HEIGHT_HALF_F)
|
||||||
.rotate(tapAngle)
|
.rotate(tapAngle)
|
||||||
.translate(-CARD_WIDTH_HALF, -CARD_HEIGHT_HALF));
|
.translate(-CardDimensions::WIDTH_HALF_F, -CardDimensions::HEIGHT_HALF_F));
|
||||||
setHovered(false);
|
setHovered(false);
|
||||||
update();
|
update();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,44 +1,37 @@
|
||||||
/**
|
/**
|
||||||
* @file card_item.h
|
* @file card_item.h
|
||||||
* @ingroup GameGraphicsCards
|
* @ingroup GameGraphicsCards
|
||||||
* @brief TODO: Document this.
|
|
||||||
*/
|
*/
|
||||||
|
//! \todo Document this file.
|
||||||
|
|
||||||
#ifndef CARDITEM_H
|
#ifndef CARDITEM_H
|
||||||
#define CARDITEM_H
|
#define CARDITEM_H
|
||||||
|
|
||||||
#include "../zones/logic/card_zone_logic.h"
|
#include "../zones/card_zone_logic.h"
|
||||||
#include "abstract_card_item.h"
|
#include "abstract_card_item.h"
|
||||||
|
#include "card_state.h"
|
||||||
|
|
||||||
#include <libcockatrice/network/server/remote/game/server_card.h>
|
#include <libcockatrice/network/server/remote/game/server_card.h>
|
||||||
|
#include <libcockatrice/utility/trice_limits.h>
|
||||||
|
|
||||||
class CardDatabase;
|
class CardDatabase;
|
||||||
class CardDragItem;
|
class CardDragItem;
|
||||||
class CardZone;
|
class CardZone;
|
||||||
class ServerInfo_Card;
|
class ServerInfo_Card;
|
||||||
class Player;
|
class PlayerLogic;
|
||||||
class QAction;
|
class QAction;
|
||||||
class QColor;
|
class QColor;
|
||||||
|
|
||||||
const int MAX_COUNTERS_ON_CARD = 999;
|
|
||||||
const float CARD_WIDTH_HALF = CARD_WIDTH / 2;
|
|
||||||
const float CARD_HEIGHT_HALF = CARD_HEIGHT / 2;
|
|
||||||
const int ROTATION_DEGREES_PER_FRAME = 10;
|
const int ROTATION_DEGREES_PER_FRAME = 10;
|
||||||
|
|
||||||
class CardItem : public AbstractCardItem
|
class CardItem : public AbstractCardItem
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
private:
|
private:
|
||||||
CardZoneLogic *zone;
|
CardState *state;
|
||||||
bool attacking;
|
|
||||||
QMap<int, int> counters;
|
|
||||||
QString annotation;
|
|
||||||
QString pt;
|
|
||||||
bool destroyOnZoneChange;
|
|
||||||
bool doesntUntap;
|
|
||||||
QPoint gridPoint;
|
QPoint gridPoint;
|
||||||
CardDragItem *dragItem;
|
CardDragItem *dragItem;
|
||||||
CardItem *attachedTo;
|
|
||||||
QList<CardItem *> attachedCards;
|
QList<CardItem *> attachedCards;
|
||||||
|
|
||||||
void prepareDelete();
|
void prepareDelete();
|
||||||
|
|
@ -55,7 +48,7 @@ public:
|
||||||
{
|
{
|
||||||
return Type;
|
return Type;
|
||||||
}
|
}
|
||||||
explicit CardItem(Player *_owner,
|
explicit CardItem(PlayerLogic *_owner,
|
||||||
QGraphicsItem *parent = nullptr,
|
QGraphicsItem *parent = nullptr,
|
||||||
const CardRef &cardRef = {},
|
const CardRef &cardRef = {},
|
||||||
int _cardid = -1,
|
int _cardid = -1,
|
||||||
|
|
@ -64,7 +57,7 @@ public:
|
||||||
void retranslateUi();
|
void retranslateUi();
|
||||||
[[nodiscard]] CardZoneLogic *getZone() const
|
[[nodiscard]] CardZoneLogic *getZone() const
|
||||||
{
|
{
|
||||||
return zone;
|
return state->getZone();
|
||||||
}
|
}
|
||||||
void setZone(CardZoneLogic *_zone);
|
void setZone(CardZoneLogic *_zone);
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
||||||
|
|
@ -80,50 +73,50 @@ public:
|
||||||
{
|
{
|
||||||
return gridPoint;
|
return gridPoint;
|
||||||
}
|
}
|
||||||
[[nodiscard]] Player *getOwner() const
|
[[nodiscard]] PlayerLogic *getOwner() const
|
||||||
{
|
{
|
||||||
return owner;
|
return owner;
|
||||||
}
|
}
|
||||||
void setOwner(Player *_owner)
|
void setOwner(PlayerLogic *_owner)
|
||||||
{
|
{
|
||||||
owner = _owner;
|
owner = _owner;
|
||||||
}
|
}
|
||||||
[[nodiscard]] bool getAttacking() const
|
[[nodiscard]] bool getAttacking() const
|
||||||
{
|
{
|
||||||
return attacking;
|
return state->getAttacking();
|
||||||
}
|
}
|
||||||
void setAttacking(bool _attacking);
|
void setAttacking(bool _attacking);
|
||||||
[[nodiscard]] const QMap<int, int> &getCounters() const
|
[[nodiscard]] const QMap<int, int> &getCounters() const
|
||||||
{
|
{
|
||||||
return counters;
|
return state->getCounters();
|
||||||
}
|
}
|
||||||
void setCounter(int _id, int _value);
|
void setCounter(int _id, int _value);
|
||||||
[[nodiscard]] QString getAnnotation() const
|
[[nodiscard]] QString getAnnotation() const
|
||||||
{
|
{
|
||||||
return annotation;
|
return state->getAnnotation();
|
||||||
}
|
}
|
||||||
void setAnnotation(const QString &_annotation);
|
void setAnnotation(const QString &_annotation);
|
||||||
[[nodiscard]] bool getDoesntUntap() const
|
[[nodiscard]] bool getDoesntUntap() const
|
||||||
{
|
{
|
||||||
return doesntUntap;
|
return state->getDoesntUntap();
|
||||||
}
|
}
|
||||||
void setDoesntUntap(bool _doesntUntap);
|
void setDoesntUntap(bool _doesntUntap);
|
||||||
[[nodiscard]] QString getPT() const
|
[[nodiscard]] QString getPT() const
|
||||||
{
|
{
|
||||||
return pt;
|
return state->getPT();
|
||||||
}
|
}
|
||||||
void setPT(const QString &_pt);
|
void setPT(const QString &_pt);
|
||||||
[[nodiscard]] bool getDestroyOnZoneChange() const
|
[[nodiscard]] bool getDestroyOnZoneChange() const
|
||||||
{
|
{
|
||||||
return destroyOnZoneChange;
|
return state->getDestroyOnZoneChange();
|
||||||
}
|
}
|
||||||
void setDestroyOnZoneChange(bool _destroy)
|
void setDestroyOnZoneChange(bool _destroy)
|
||||||
{
|
{
|
||||||
destroyOnZoneChange = _destroy;
|
state->setDestroyOnZoneChange(_destroy);
|
||||||
}
|
}
|
||||||
[[nodiscard]] CardItem *getAttachedTo() const
|
[[nodiscard]] CardItem *getAttachedTo() const
|
||||||
{
|
{
|
||||||
return attachedTo;
|
return state->getAttachedTo();
|
||||||
}
|
}
|
||||||
void setAttachedTo(CardItem *_attachedTo);
|
void setAttachedTo(CardItem *_attachedTo);
|
||||||
void addAttachedCard(CardItem *card)
|
void addAttachedCard(CardItem *card)
|
||||||
|
|
@ -142,12 +135,32 @@ public:
|
||||||
void processCardInfo(const ServerInfo_Card &_info);
|
void processCardInfo(const ServerInfo_Card &_info);
|
||||||
|
|
||||||
bool animationEvent();
|
bool animationEvent();
|
||||||
CardDragItem *createDragItem(int _id, const QPointF &_pos, const QPointF &_scenePos, bool faceDown);
|
CardDragItem *createDragItem(int _id, const QPointF &_pos, const QPointF &_scenePos, bool forceFaceDown);
|
||||||
void deleteDragItem();
|
void deleteDragItem();
|
||||||
void drawArrow(const QColor &arrowColor);
|
void drawArrow(const QColor &arrowColor);
|
||||||
void drawAttachArrow();
|
void drawAttachArrow();
|
||||||
void playCard(bool faceDown);
|
void playCard(bool faceDown);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Parses a string representing a p/t in order to extract the values from it.
|
||||||
|
*
|
||||||
|
* If the string contains '/', the string will be split at the '/' and each side will be parsed separately,
|
||||||
|
* which means the result list will have two elements.
|
||||||
|
*
|
||||||
|
* If '/' is not found, then the entire string is parsed together, which means the result list will
|
||||||
|
* have a single element.
|
||||||
|
*
|
||||||
|
* If either side of the split is empty, there will also only be a single element in the result list.
|
||||||
|
*
|
||||||
|
* This function will attempt to parse each substring as an int first, handling plus and minus prefixes.
|
||||||
|
* If successful, it will put the parsed value into the QVariant as an int.
|
||||||
|
* If failed, it will just put the substring into the QVariant as a QString.
|
||||||
|
*
|
||||||
|
* @param pt The p/t string
|
||||||
|
* @return A QVariantList that can contain one or two elements, where each QVariant can be either int or QString
|
||||||
|
*/
|
||||||
|
static QVariantList parsePT(const QString &pt);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
|
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
|
||||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
|
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/**
|
/**
|
||||||
* @file card_list.h
|
* @file card_list.h
|
||||||
* @ingroup GameLogicCards
|
* @ingroup GameLogicCards
|
||||||
* @brief TODO: Document this.
|
|
||||||
*/
|
*/
|
||||||
|
//! \todo Document this file.
|
||||||
|
|
||||||
#ifndef CARDLIST_H
|
#ifndef CARDLIST_H
|
||||||
#define CARDLIST_H
|
#define CARDLIST_H
|
||||||
|
|
|
||||||
111
cockatrice/src/game/board/card_state.cpp
Normal file
111
cockatrice/src/game/board/card_state.cpp
Normal file
|
|
@ -0,0 +1,111 @@
|
||||||
|
#include "card_state.h"
|
||||||
|
|
||||||
|
void CardState::resetState(bool keepAnnotations)
|
||||||
|
{
|
||||||
|
attacking = false;
|
||||||
|
counters.clear();
|
||||||
|
pt.clear();
|
||||||
|
if (!keepAnnotations) {
|
||||||
|
annotation.clear();
|
||||||
|
}
|
||||||
|
attachedTo = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CardState::setZone(CardZoneLogic *_zone)
|
||||||
|
{
|
||||||
|
if (zone == _zone) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
zone = _zone;
|
||||||
|
emit zoneChanged(zone);
|
||||||
|
emit stateChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CardState::setAttacking(bool _attacking)
|
||||||
|
{
|
||||||
|
if (attacking == _attacking) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
attacking = _attacking;
|
||||||
|
emit attackingChanged(_attacking);
|
||||||
|
emit stateChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CardState::insertCounter(int id, int value)
|
||||||
|
{
|
||||||
|
counters.insert(id, value);
|
||||||
|
|
||||||
|
emit countersChanged(counters);
|
||||||
|
emit stateChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CardState::setCounter(int id, int value)
|
||||||
|
{
|
||||||
|
if (value) {
|
||||||
|
counters[id] = value;
|
||||||
|
} else {
|
||||||
|
counters.remove(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
emit countersChanged(counters);
|
||||||
|
emit stateChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CardState::clearCounters()
|
||||||
|
{
|
||||||
|
counters.clear();
|
||||||
|
emit countersChanged(counters);
|
||||||
|
emit stateChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CardState::setAnnotation(const QString &_annotation)
|
||||||
|
{
|
||||||
|
if (annotation == _annotation) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
annotation = _annotation;
|
||||||
|
emit annotationChanged(annotation);
|
||||||
|
emit stateChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CardState::setPT(const QString &_pt)
|
||||||
|
{
|
||||||
|
if (pt == _pt) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
pt = _pt;
|
||||||
|
emit ptChanged(pt);
|
||||||
|
emit stateChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CardState::setDoesntUntap(bool _doesntUntap)
|
||||||
|
{
|
||||||
|
if (doesntUntap == _doesntUntap) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
doesntUntap = _doesntUntap;
|
||||||
|
emit doesntUntapChanged(_doesntUntap);
|
||||||
|
emit stateChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CardState::setDestroyOnZoneChange(bool _destroyOnZoneChange)
|
||||||
|
{
|
||||||
|
if (destroyOnZoneChange == _destroyOnZoneChange) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
destroyOnZoneChange = _destroyOnZoneChange;
|
||||||
|
emit destroyOnZoneChangeChanged(_destroyOnZoneChange);
|
||||||
|
emit stateChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CardState::setAttachedTo(CardItem *_attachedTo)
|
||||||
|
{
|
||||||
|
if (attachedTo == _attachedTo) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
attachedTo = _attachedTo;
|
||||||
|
emit attachedToChanged(_attachedTo);
|
||||||
|
emit stateChanged();
|
||||||
|
}
|
||||||
103
cockatrice/src/game/board/card_state.h
Normal file
103
cockatrice/src/game/board/card_state.h
Normal file
|
|
@ -0,0 +1,103 @@
|
||||||
|
#ifndef COCKATRICE_CARD_STATE_H
|
||||||
|
#define COCKATRICE_CARD_STATE_H
|
||||||
|
|
||||||
|
#include <QMap>
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
class CardZoneLogic;
|
||||||
|
class CardItem;
|
||||||
|
class CardState : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool attacking = false;
|
||||||
|
QMap<int, int> counters;
|
||||||
|
QString annotation;
|
||||||
|
QString pt;
|
||||||
|
bool doesntUntap = false;
|
||||||
|
bool destroyOnZoneChange = false;
|
||||||
|
|
||||||
|
CardItem *attachedTo = nullptr;
|
||||||
|
CardZoneLogic *zone = nullptr;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void stateChanged();
|
||||||
|
|
||||||
|
void attackingChanged(bool newValue);
|
||||||
|
void countersChanged(const QMap<int, int> &newCounters);
|
||||||
|
void annotationChanged(const QString &newAnnotation);
|
||||||
|
void ptChanged(const QString &newPt);
|
||||||
|
void doesntUntapChanged(bool newValue);
|
||||||
|
void destroyOnZoneChangeChanged(bool newValue);
|
||||||
|
void attachedToChanged(CardItem *newAttachedTo);
|
||||||
|
void zoneChanged(CardZoneLogic *newZone);
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit CardState(QObject *parent, CardZoneLogic *_zone) : QObject(parent), zone(_zone)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void resetState(bool keepAnnotations);
|
||||||
|
|
||||||
|
CardZoneLogic *getZone() const
|
||||||
|
{
|
||||||
|
return zone;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setZone(CardZoneLogic *_zone);
|
||||||
|
|
||||||
|
bool getAttacking() const
|
||||||
|
{
|
||||||
|
return attacking;
|
||||||
|
}
|
||||||
|
void setAttacking(bool _attacking);
|
||||||
|
|
||||||
|
const QMap<int, int> &getCounters() const
|
||||||
|
{
|
||||||
|
return counters;
|
||||||
|
}
|
||||||
|
|
||||||
|
void insertCounter(int id, int value);
|
||||||
|
|
||||||
|
void setCounter(int id, int value);
|
||||||
|
|
||||||
|
void clearCounters();
|
||||||
|
|
||||||
|
QString getAnnotation() const
|
||||||
|
{
|
||||||
|
return annotation;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setAnnotation(const QString &_annotation);
|
||||||
|
|
||||||
|
QString getPT() const
|
||||||
|
{
|
||||||
|
return pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setPT(const QString &_pt);
|
||||||
|
|
||||||
|
bool getDoesntUntap() const
|
||||||
|
{
|
||||||
|
return doesntUntap;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setDoesntUntap(bool _doesntUntap);
|
||||||
|
|
||||||
|
bool getDestroyOnZoneChange() const
|
||||||
|
{
|
||||||
|
return destroyOnZoneChange;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setDestroyOnZoneChange(bool _destroyOnZoneChange);
|
||||||
|
|
||||||
|
CardItem *getAttachedTo() const
|
||||||
|
{
|
||||||
|
return attachedTo;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setAttachedTo(CardItem *_attachedTo);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // COCKATRICE_CARD_STATE_H
|
||||||
|
|
@ -5,15 +5,8 @@
|
||||||
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
|
||||||
GeneralCounter::GeneralCounter(Player *_player,
|
GeneralCounter::GeneralCounter(CounterState *state, PlayerLogic *player, bool useNameForShortcut, QGraphicsItem *parent)
|
||||||
int _id,
|
: AbstractCounter(state, player, true, useNameForShortcut, parent)
|
||||||
const QString &_name,
|
|
||||||
const QColor &_color,
|
|
||||||
int _radius,
|
|
||||||
int _value,
|
|
||||||
bool useNameForShortcut,
|
|
||||||
QGraphicsItem *parent)
|
|
||||||
: AbstractCounter(_player, _id, _name, true, _value, useNameForShortcut, parent), color(_color), radius(_radius)
|
|
||||||
{
|
{
|
||||||
setCacheMode(DeviceCoordinateCache);
|
setCacheMode(DeviceCoordinateCache);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/**
|
/**
|
||||||
* @file counter_general.h
|
* @file counter_general.h
|
||||||
* @ingroup GameGraphicsPlayers
|
* @ingroup GameGraphicsPlayers
|
||||||
* @brief TODO: Document this.
|
|
||||||
*/
|
*/
|
||||||
|
//! \todo Document this file.
|
||||||
|
|
||||||
#ifndef COUNTER_GENERAL_H
|
#ifndef COUNTER_GENERAL_H
|
||||||
#define COUNTER_GENERAL_H
|
#define COUNTER_GENERAL_H
|
||||||
|
|
@ -12,17 +12,10 @@
|
||||||
class GeneralCounter : public AbstractCounter
|
class GeneralCounter : public AbstractCounter
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
private:
|
|
||||||
QColor color;
|
|
||||||
int radius;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GeneralCounter(Player *_player,
|
GeneralCounter(CounterState *state,
|
||||||
int _id,
|
PlayerLogic *player,
|
||||||
const QString &_name,
|
|
||||||
const QColor &_color,
|
|
||||||
int _radius,
|
|
||||||
int _value,
|
|
||||||
bool useNameForShortcut = false,
|
bool useNameForShortcut = false,
|
||||||
QGraphicsItem *parent = nullptr);
|
QGraphicsItem *parent = nullptr);
|
||||||
QRectF boundingRect() const override;
|
QRectF boundingRect() const override;
|
||||||
|
|
|
||||||
24
cockatrice/src/game/board/counter_state.cpp
Normal file
24
cockatrice/src/game/board/counter_state.cpp
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
#include "counter_state.h"
|
||||||
|
|
||||||
|
#include <libcockatrice/utility/color.h>
|
||||||
|
|
||||||
|
CounterState::CounterState(int id, const QString &name, const QColor &color, int radius, int value, QObject *parent)
|
||||||
|
: QObject(parent), id(id), name(name), color(color), radius(radius), value(value)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CounterState *CounterState::fromProto(const ServerInfo_Counter &counter, QObject *parent)
|
||||||
|
{
|
||||||
|
return new CounterState(counter.id(), QString::fromStdString(counter.name()),
|
||||||
|
convertColorToQColor(counter.counter_color()), counter.radius(), counter.count(), parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CounterState::setValue(int newValue)
|
||||||
|
{
|
||||||
|
if (newValue == value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int old = value;
|
||||||
|
value = newValue;
|
||||||
|
emit valueChanged(old, newValue);
|
||||||
|
}
|
||||||
51
cockatrice/src/game/board/counter_state.h
Normal file
51
cockatrice/src/game/board/counter_state.h
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
#ifndef COCKATRICE_COUNTER_STATE_H
|
||||||
|
#define COCKATRICE_COUNTER_STATE_H
|
||||||
|
|
||||||
|
#include <QColor>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QString>
|
||||||
|
#include <libcockatrice/protocol/pb/serverinfo_counter.pb.h>
|
||||||
|
|
||||||
|
class CounterState : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
CounterState(int id, const QString &name, const QColor &color, int radius, int value, QObject *parent = nullptr);
|
||||||
|
|
||||||
|
static CounterState *fromProto(const ServerInfo_Counter &counter, QObject *parent = nullptr);
|
||||||
|
|
||||||
|
int getId() const
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
QString getName() const
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
QColor getColor() const
|
||||||
|
{
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
int getRadius() const
|
||||||
|
{
|
||||||
|
return radius;
|
||||||
|
}
|
||||||
|
int getValue() const
|
||||||
|
{
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setValue(int newValue);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void valueChanged(int oldValue, int newValue);
|
||||||
|
|
||||||
|
private:
|
||||||
|
int id;
|
||||||
|
QString name;
|
||||||
|
QColor color;
|
||||||
|
int radius;
|
||||||
|
int value;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // COCKATRICE_COUNTER_STATE_H
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/**
|
/**
|
||||||
* @file translate_counter_name.h
|
* @file translate_counter_name.h
|
||||||
* @ingroup GameGraphicsPlayers
|
* @ingroup GameGraphicsPlayers
|
||||||
* @brief TODO: Document this.
|
|
||||||
*/
|
*/
|
||||||
|
//! \todo Document this file.
|
||||||
|
|
||||||
#ifndef TRANSLATECOUNTERNAME_H
|
#ifndef TRANSLATECOUNTERNAME_H
|
||||||
#define TRANSLATECOUNTERNAME_H
|
#define TRANSLATECOUNTERNAME_H
|
||||||
|
|
|
||||||
29
cockatrice/src/game/card_dimensions.h
Normal file
29
cockatrice/src/game/card_dimensions.h
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
#ifndef CARD_DIMENSIONS_H
|
||||||
|
#define CARD_DIMENSIONS_H
|
||||||
|
|
||||||
|
#include <QtGlobal>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file card_dimensions.h
|
||||||
|
* @brief Canonical card dimension constants for layout and Z-value calculations.
|
||||||
|
*
|
||||||
|
* These values represent the logical pixel dimensions of a standard card graphic.
|
||||||
|
* They are used throughout the game scene for layout, rendering, and Z-value computation.
|
||||||
|
*/
|
||||||
|
namespace CardDimensions
|
||||||
|
{
|
||||||
|
/** @brief Card width in pixels. */
|
||||||
|
constexpr int WIDTH = 72;
|
||||||
|
/** @brief Card height in pixels. */
|
||||||
|
constexpr int HEIGHT = 102;
|
||||||
|
|
||||||
|
/** @brief Pre-converted for floating-point contexts (Z-value calculations). */
|
||||||
|
constexpr qreal WIDTH_F = static_cast<qreal>(WIDTH);
|
||||||
|
constexpr qreal HEIGHT_F = static_cast<qreal>(HEIGHT);
|
||||||
|
|
||||||
|
/** @brief Half-dimensions for centering and rotation transforms. */
|
||||||
|
constexpr qreal WIDTH_HALF_F = WIDTH_F / 2;
|
||||||
|
constexpr qreal HEIGHT_HALF_F = HEIGHT_F / 2;
|
||||||
|
} // namespace CardDimensions
|
||||||
|
|
||||||
|
#endif // CARD_DIMENSIONS_H
|
||||||
|
|
@ -24,17 +24,21 @@ void DeckViewCardDragItem::updatePosition(const QPointF &cursorScenePos)
|
||||||
QList<QGraphicsItem *> colliding = scene()->items(cursorScenePos);
|
QList<QGraphicsItem *> colliding = scene()->items(cursorScenePos);
|
||||||
|
|
||||||
DeckViewCardContainer *cursorZone = 0;
|
DeckViewCardContainer *cursorZone = 0;
|
||||||
for (int i = colliding.size() - 1; i >= 0; i--)
|
for (int i = colliding.size() - 1; i >= 0; i--) {
|
||||||
if ((cursorZone = qgraphicsitem_cast<DeckViewCardContainer *>(colliding.at(i))))
|
if ((cursorZone = qgraphicsitem_cast<DeckViewCardContainer *>(colliding.at(i)))) {
|
||||||
break;
|
break;
|
||||||
if (!cursorZone)
|
}
|
||||||
|
}
|
||||||
|
if (!cursorZone) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
currentZone = cursorZone;
|
currentZone = cursorZone;
|
||||||
|
|
||||||
QPointF newPos = cursorScenePos;
|
QPointF newPos = cursorScenePos;
|
||||||
if (newPos != pos()) {
|
if (newPos != pos()) {
|
||||||
for (int i = 0; i < childDrags.size(); i++)
|
for (int i = 0; i < childDrags.size(); i++) {
|
||||||
childDrags[i]->setPos(newPos + childDrags[i]->getHotSpot());
|
childDrags[i]->setPos(newPos + childDrags[i]->getHotSpot());
|
||||||
|
}
|
||||||
setPos(newPos);
|
setPos(newPos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -95,19 +99,22 @@ void DeckViewCard::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
|
||||||
pen.setJoinStyle(Qt::MiterJoin);
|
pen.setJoinStyle(Qt::MiterJoin);
|
||||||
pen.setColor(originZone == DECK_ZONE_MAIN ? Qt::green : Qt::red);
|
pen.setColor(originZone == DECK_ZONE_MAIN ? Qt::green : Qt::red);
|
||||||
painter->setPen(pen);
|
painter->setPen(pen);
|
||||||
qreal cardRadius = SettingsCache::instance().getRoundCardCorners() ? 0.05 * (CARD_WIDTH - 3) : 0.0;
|
qreal cardRadius = SettingsCache::instance().getRoundCardCorners() ? 0.05 * (CardDimensions::WIDTH_F - 3) : 0.0;
|
||||||
painter->drawRoundedRect(QRectF(1.5, 1.5, CARD_WIDTH - 3., CARD_HEIGHT - 3.), cardRadius, cardRadius);
|
painter->drawRoundedRect(QRectF(1.5, 1.5, CardDimensions::WIDTH_F - 3, CardDimensions::HEIGHT_F - 3), cardRadius,
|
||||||
|
cardRadius);
|
||||||
painter->restore();
|
painter->restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeckViewCard::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
void DeckViewCard::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
if ((event->screenPos() - event->buttonDownScreenPos(Qt::LeftButton)).manhattanLength() <
|
if ((event->screenPos() - event->buttonDownScreenPos(Qt::LeftButton)).manhattanLength() <
|
||||||
2 * QApplication::startDragDistance())
|
2 * QApplication::startDragDistance()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (static_cast<DeckViewScene *>(scene())->getLocked())
|
if (static_cast<DeckViewScene *>(scene())->getLocked()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
delete dragItem;
|
delete dragItem;
|
||||||
dragItem = new DeckViewCardDragItem(this, event->pos());
|
dragItem = new DeckViewCardDragItem(this, event->pos());
|
||||||
|
|
@ -119,10 +126,11 @@ void DeckViewCard::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||||
int j = 0;
|
int j = 0;
|
||||||
for (int i = 0; i < sel.size(); i++) {
|
for (int i = 0; i < sel.size(); i++) {
|
||||||
auto *c = static_cast<DeckViewCard *>(sel.at(i));
|
auto *c = static_cast<DeckViewCard *>(sel.at(i));
|
||||||
if (c == this)
|
if (c == this) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
++j;
|
++j;
|
||||||
auto childPos = QPointF(j * CARD_WIDTH / 2, 0);
|
auto childPos = QPointF(j * CardDimensions::WIDTH_HALF_F, 0);
|
||||||
auto *drag = new DeckViewCardDragItem(c, childPos, dragItem);
|
auto *drag = new DeckViewCardDragItem(c, childPos, dragItem);
|
||||||
drag->setPos(dragItem->pos() + childPos);
|
drag->setPos(dragItem->pos() + childPos);
|
||||||
scene()->addItem(drag);
|
scene()->addItem(drag);
|
||||||
|
|
@ -132,8 +140,9 @@ void DeckViewCard::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||||
|
|
||||||
void DeckView::mouseDoubleClickEvent(QMouseEvent *event)
|
void DeckView::mouseDoubleClickEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (static_cast<DeckViewScene *>(scene())->getLocked())
|
if (static_cast<DeckViewScene *>(scene())->getLocked()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (event->button() == Qt::LeftButton) {
|
if (event->button() == Qt::LeftButton) {
|
||||||
QList<MoveCard_ToZone> result;
|
QList<MoveCard_ToZone> result;
|
||||||
|
|
@ -146,12 +155,13 @@ void DeckView::mouseDoubleClickEvent(QMouseEvent *event)
|
||||||
m.set_card_name(c->getName().toStdString());
|
m.set_card_name(c->getName().toStdString());
|
||||||
m.set_start_zone(zone->getName().toStdString());
|
m.set_start_zone(zone->getName().toStdString());
|
||||||
|
|
||||||
if (zone->getName() == DECK_ZONE_MAIN)
|
if (zone->getName() == DECK_ZONE_MAIN) {
|
||||||
m.set_target_zone(DECK_ZONE_SIDE);
|
m.set_target_zone(DECK_ZONE_SIDE);
|
||||||
else if (zone->getName() == DECK_ZONE_SIDE)
|
} else if (zone->getName() == DECK_ZONE_SIDE) {
|
||||||
m.set_target_zone(DECK_ZONE_MAIN);
|
m.set_target_zone(DECK_ZONE_MAIN);
|
||||||
else // Trying to move from another zone
|
} else { // Trying to move from another zone
|
||||||
m.set_target_zone(zone->getName().toStdString());
|
m.set_target_zone(zone->getName().toStdString());
|
||||||
|
}
|
||||||
|
|
||||||
result.append(m);
|
result.append(m);
|
||||||
}
|
}
|
||||||
|
|
@ -204,7 +214,7 @@ void DeckViewCardContainer::paint(QPainter *painter, const QStyleOptionGraphicsI
|
||||||
painter->setPen(QColor(255, 255, 255, 100));
|
painter->setPen(QColor(255, 255, 255, 100));
|
||||||
painter->drawLine(QPointF(0, yUntilNow - paddingY / 2), QPointF(width, yUntilNow - paddingY / 2));
|
painter->drawLine(QPointF(0, yUntilNow - paddingY / 2), QPointF(width, yUntilNow - paddingY / 2));
|
||||||
}
|
}
|
||||||
qreal thisRowHeight = CARD_HEIGHT * currentRowsAndCols[i].first;
|
qreal thisRowHeight = CardDimensions::HEIGHT_F * currentRowsAndCols[i].first;
|
||||||
QRectF textRect(0, yUntilNow, totalTextWidth, thisRowHeight);
|
QRectF textRect(0, yUntilNow, totalTextWidth, thisRowHeight);
|
||||||
yUntilNow += thisRowHeight + paddingY;
|
yUntilNow += thisRowHeight + paddingY;
|
||||||
|
|
||||||
|
|
@ -231,8 +241,9 @@ QList<QPair<int, int>> DeckViewCardContainer::getRowsAndCols() const
|
||||||
{
|
{
|
||||||
QList<QPair<int, int>> result;
|
QList<QPair<int, int>> result;
|
||||||
QList<QString> cardTypeList = cardsByType.uniqueKeys();
|
QList<QString> cardTypeList = cardsByType.uniqueKeys();
|
||||||
for (int i = 0; i < cardTypeList.size(); ++i)
|
for (int i = 0; i < cardTypeList.size(); ++i) {
|
||||||
result.append(QPair<int, int>(1, cardsByType.count(cardTypeList[i])));
|
result.append(QPair<int, int>(1, cardsByType.count(cardTypeList[i])));
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -260,9 +271,10 @@ QSizeF DeckViewCardContainer::calculateBoundingRect(const QList<QPair<int, int>>
|
||||||
|
|
||||||
// Calculate space needed for cards
|
// Calculate space needed for cards
|
||||||
for (int i = 0; i < rowsAndCols.size(); ++i) {
|
for (int i = 0; i < rowsAndCols.size(); ++i) {
|
||||||
totalHeight += CARD_HEIGHT * rowsAndCols[i].first + paddingY;
|
totalHeight += CardDimensions::HEIGHT_F * rowsAndCols[i].first + paddingY;
|
||||||
if (CARD_WIDTH * rowsAndCols[i].second > totalWidth)
|
if (CardDimensions::WIDTH_F * rowsAndCols[i].second > totalWidth) {
|
||||||
totalWidth = CARD_WIDTH * rowsAndCols[i].second;
|
totalWidth = CardDimensions::WIDTH_F * rowsAndCols[i].second;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return QSizeF(getCardTypeTextWidth() + totalWidth, totalHeight + separatorY + paddingY);
|
return QSizeF(getCardTypeTextWidth() + totalWidth, totalHeight + separatorY + paddingY);
|
||||||
|
|
@ -270,8 +282,9 @@ QSizeF DeckViewCardContainer::calculateBoundingRect(const QList<QPair<int, int>>
|
||||||
|
|
||||||
bool DeckViewCardContainer::sortCardsByName(DeckViewCard *c1, DeckViewCard *c2)
|
bool DeckViewCardContainer::sortCardsByName(DeckViewCard *c1, DeckViewCard *c2)
|
||||||
{
|
{
|
||||||
if (c1 && c2)
|
if (c1 && c2) {
|
||||||
return c1->getName() < c2->getName();
|
return c1->getName() < c2->getName();
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -289,9 +302,10 @@ void DeckViewCardContainer::rearrangeItems(const QList<QPair<int, int>> &rowsAnd
|
||||||
std::sort(row.begin(), row.end(), DeckViewCardContainer::sortCardsByName);
|
std::sort(row.begin(), row.end(), DeckViewCardContainer::sortCardsByName);
|
||||||
for (int j = 0; j < row.size(); ++j) {
|
for (int j = 0; j < row.size(); ++j) {
|
||||||
DeckViewCard *card = row[j];
|
DeckViewCard *card = row[j];
|
||||||
card->setPos(x + (j % tempCols) * CARD_WIDTH, yUntilNow + (j / tempCols) * CARD_HEIGHT);
|
card->setPos(x + (j % tempCols) * CardDimensions::WIDTH_F,
|
||||||
|
yUntilNow + (j / tempCols) * CardDimensions::HEIGHT_F);
|
||||||
}
|
}
|
||||||
yUntilNow += tempRows * CARD_HEIGHT + paddingY;
|
yUntilNow += tempRows * CardDimensions::HEIGHT_F + paddingY;
|
||||||
}
|
}
|
||||||
|
|
||||||
prepareGeometryChange();
|
prepareGeometryChange();
|
||||||
|
|
@ -320,15 +334,17 @@ DeckViewScene::~DeckViewScene()
|
||||||
void DeckViewScene::clearContents()
|
void DeckViewScene::clearContents()
|
||||||
{
|
{
|
||||||
QMapIterator<QString, DeckViewCardContainer *> i(cardContainers);
|
QMapIterator<QString, DeckViewCardContainer *> i(cardContainers);
|
||||||
while (i.hasNext())
|
while (i.hasNext()) {
|
||||||
delete i.next().value();
|
delete i.next().value();
|
||||||
|
}
|
||||||
cardContainers.clear();
|
cardContainers.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeckViewScene::setDeck(const DeckList &_deck)
|
void DeckViewScene::setDeck(const DeckList &_deck)
|
||||||
{
|
{
|
||||||
if (deck)
|
if (deck) {
|
||||||
delete deck;
|
delete deck;
|
||||||
|
}
|
||||||
|
|
||||||
deck = new DeckList(_deck.writeToString_Native());
|
deck = new DeckList(_deck.writeToString_Native());
|
||||||
rebuildTree();
|
rebuildTree();
|
||||||
|
|
@ -340,8 +356,9 @@ void DeckViewScene::rebuildTree()
|
||||||
{
|
{
|
||||||
clearContents();
|
clearContents();
|
||||||
|
|
||||||
if (!deck)
|
if (!deck) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (auto *currentZone : deck->getZoneNodes()) {
|
for (auto *currentZone : deck->getZoneNodes()) {
|
||||||
DeckViewCardContainer *container = cardContainers.value(currentZone->getName(), 0);
|
DeckViewCardContainer *container = cardContainers.value(currentZone->getName(), 0);
|
||||||
|
|
@ -353,8 +370,9 @@ void DeckViewScene::rebuildTree()
|
||||||
|
|
||||||
for (int j = 0; j < currentZone->size(); j++) {
|
for (int j = 0; j < currentZone->size(); j++) {
|
||||||
auto *currentCard = dynamic_cast<DecklistCardNode *>(currentZone->at(j));
|
auto *currentCard = dynamic_cast<DecklistCardNode *>(currentZone->at(j));
|
||||||
if (!currentCard)
|
if (!currentCard) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
for (int k = 0; k < currentCard->getNumber(); ++k) {
|
for (int k = 0; k < currentCard->getNumber(); ++k) {
|
||||||
auto *newCard = new DeckViewCard(container, currentCard->toCardRef(), currentZone->getName());
|
auto *newCard = new DeckViewCard(container, currentCard->toCardRef(), currentZone->getName());
|
||||||
|
|
@ -371,18 +389,21 @@ void DeckViewScene::applySideboardPlan(const QList<MoveCard_ToZone> &plan)
|
||||||
const MoveCard_ToZone &m = plan[i];
|
const MoveCard_ToZone &m = plan[i];
|
||||||
DeckViewCardContainer *start = cardContainers.value(QString::fromStdString(m.start_zone()));
|
DeckViewCardContainer *start = cardContainers.value(QString::fromStdString(m.start_zone()));
|
||||||
DeckViewCardContainer *target = cardContainers.value(QString::fromStdString(m.target_zone()));
|
DeckViewCardContainer *target = cardContainers.value(QString::fromStdString(m.target_zone()));
|
||||||
if (!start || !target)
|
if (!start || !target) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
DeckViewCard *card = 0;
|
DeckViewCard *card = 0;
|
||||||
const QList<DeckViewCard *> &cardList = start->getCards();
|
const QList<DeckViewCard *> &cardList = start->getCards();
|
||||||
for (int j = 0; j < cardList.size(); ++j)
|
for (int j = 0; j < cardList.size(); ++j) {
|
||||||
if (cardList[j]->getName() == QString::fromStdString(m.card_name())) {
|
if (cardList[j]->getName() == QString::fromStdString(m.card_name())) {
|
||||||
card = cardList[j];
|
card = cardList[j];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!card)
|
}
|
||||||
|
if (!card) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
start->removeCard(card);
|
start->removeCard(card);
|
||||||
target->addCard(card);
|
target->addCard(card);
|
||||||
|
|
@ -392,7 +413,7 @@ void DeckViewScene::applySideboardPlan(const QList<MoveCard_ToZone> &plan)
|
||||||
|
|
||||||
void DeckViewScene::rearrangeItems()
|
void DeckViewScene::rearrangeItems()
|
||||||
{
|
{
|
||||||
const int spacing = CARD_HEIGHT / 3;
|
const int spacing = CardDimensions::HEIGHT / 3;
|
||||||
QList<DeckViewCardContainer *> contList = cardContainers.values();
|
QList<DeckViewCardContainer *> contList = cardContainers.values();
|
||||||
|
|
||||||
// Initialize space requirements
|
// Initialize space requirements
|
||||||
|
|
@ -403,8 +424,9 @@ void DeckViewScene::rearrangeItems()
|
||||||
rowsAndColsList.append(rowsAndCols);
|
rowsAndColsList.append(rowsAndCols);
|
||||||
|
|
||||||
cardCountList.append(QList<int>());
|
cardCountList.append(QList<int>());
|
||||||
for (int j = 0; j < rowsAndCols.size(); ++j)
|
for (int j = 0; j < rowsAndCols.size(); ++j) {
|
||||||
cardCountList[i].append(rowsAndCols[j].second);
|
cardCountList[i].append(rowsAndCols[j].second);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal totalHeight, totalWidth;
|
qreal totalHeight, totalWidth;
|
||||||
|
|
@ -415,23 +437,27 @@ void DeckViewScene::rearrangeItems()
|
||||||
for (int i = 0; i < contList.size(); ++i) {
|
for (int i = 0; i < contList.size(); ++i) {
|
||||||
QSizeF contSize = contList[i]->calculateBoundingRect(rowsAndColsList[i]);
|
QSizeF contSize = contList[i]->calculateBoundingRect(rowsAndColsList[i]);
|
||||||
totalHeight += contSize.height() + spacing;
|
totalHeight += contSize.height() + spacing;
|
||||||
if (contSize.width() > totalWidth)
|
if (contSize.width() > totalWidth) {
|
||||||
totalWidth = contSize.width();
|
totalWidth = contSize.width();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We're done when the aspect ratio shifts from too high to too low.
|
// We're done when the aspect ratio shifts from too high to too low.
|
||||||
if (totalWidth / totalHeight <= optimalAspectRatio)
|
if (totalWidth / totalHeight <= optimalAspectRatio) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// Find category with highest column count
|
// Find category with highest column count
|
||||||
int maxIndex1 = -1, maxIndex2 = -1, maxCols = 0;
|
int maxIndex1 = -1, maxIndex2 = -1, maxCols = 0;
|
||||||
for (int i = 0; i < rowsAndColsList.size(); ++i)
|
for (int i = 0; i < rowsAndColsList.size(); ++i) {
|
||||||
for (int j = 0; j < rowsAndColsList[i].size(); ++j)
|
for (int j = 0; j < rowsAndColsList[i].size(); ++j) {
|
||||||
if (rowsAndColsList[i][j].second > maxCols) {
|
if (rowsAndColsList[i][j].second > maxCols) {
|
||||||
maxIndex1 = i;
|
maxIndex1 = i;
|
||||||
maxIndex2 = j;
|
maxIndex2 = j;
|
||||||
maxCols = rowsAndColsList[i][j].second;
|
maxCols = rowsAndColsList[i][j].second;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Add row to category
|
// Add row to category
|
||||||
const int maxRows = rowsAndColsList[maxIndex1][maxIndex2].first;
|
const int maxRows = rowsAndColsList[maxIndex1][maxIndex2].first;
|
||||||
|
|
@ -449,8 +475,9 @@ void DeckViewScene::rearrangeItems()
|
||||||
}
|
}
|
||||||
|
|
||||||
totalWidth = totalHeight * optimalAspectRatio;
|
totalWidth = totalHeight * optimalAspectRatio;
|
||||||
for (int i = 0; i < contList.size(); ++i)
|
for (int i = 0; i < contList.size(); ++i) {
|
||||||
contList[i]->setWidth(totalWidth);
|
contList[i]->setWidth(totalWidth);
|
||||||
|
}
|
||||||
|
|
||||||
setSceneRect(QRectF(0, 0, totalWidth, totalHeight));
|
setSceneRect(QRectF(0, 0, totalWidth, totalHeight));
|
||||||
}
|
}
|
||||||
|
|
@ -468,7 +495,7 @@ QList<MoveCard_ToZone> DeckViewScene::getSideboardPlan() const
|
||||||
while (containerIterator.hasNext()) {
|
while (containerIterator.hasNext()) {
|
||||||
DeckViewCardContainer *cont = containerIterator.next().value();
|
DeckViewCardContainer *cont = containerIterator.next().value();
|
||||||
const QList<DeckViewCard *> cardList = cont->getCards();
|
const QList<DeckViewCard *> cardList = cont->getCards();
|
||||||
for (int i = 0; i < cardList.size(); ++i)
|
for (int i = 0; i < cardList.size(); ++i) {
|
||||||
if (cardList[i]->getOriginZone() != cont->getName()) {
|
if (cardList[i]->getOriginZone() != cont->getName()) {
|
||||||
MoveCard_ToZone m;
|
MoveCard_ToZone m;
|
||||||
m.set_card_name(cardList[i]->getName().toStdString());
|
m.set_card_name(cardList[i]->getName().toStdString());
|
||||||
|
|
@ -476,6 +503,7 @@ QList<MoveCard_ToZone> DeckViewScene::getSideboardPlan() const
|
||||||
m.set_target_zone(cont->getName().toStdString());
|
m.set_target_zone(cont->getName().toStdString());
|
||||||
result.append(m);
|
result.append(m);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/**
|
/**
|
||||||
* @file deck_view.h
|
* @file deck_view.h
|
||||||
* @ingroup Lobby
|
* @ingroup Lobby
|
||||||
* @brief TODO: Document this.
|
|
||||||
*/
|
*/
|
||||||
|
//! \todo Document this file.
|
||||||
|
|
||||||
#ifndef DECKVIEW_H
|
#ifndef DECKVIEW_H
|
||||||
#define DECKVIEW_H
|
#define DECKVIEW_H
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,21 @@ DeckViewContainer::DeckViewContainer(int _playerId, TabGame *parent)
|
||||||
&DeckViewContainer::setVisualDeckStorageExists);
|
&DeckViewContainer::setVisualDeckStorageExists);
|
||||||
|
|
||||||
switchToDeckSelectView();
|
switchToDeckSelectView();
|
||||||
|
generateTutorialSequence();
|
||||||
|
}
|
||||||
|
|
||||||
|
TutorialSequence DeckViewContainer::generateTutorialSequence()
|
||||||
|
{
|
||||||
|
TutorialSequence deckViewContainerSequence;
|
||||||
|
deckViewContainerSequence.name = tr("Loading and selecting decks");
|
||||||
|
|
||||||
|
deckViewContainerSequence.addStep(
|
||||||
|
{this, tr("There are multiple ways to select a deck:\n\n- From a local file"
|
||||||
|
"\n- From the contents of your clipboard\nFrom an external online service")});
|
||||||
|
|
||||||
|
deckViewContainerSequence = visualDeckStorageWidget->generateTutorialSequence(deckViewContainerSequence);
|
||||||
|
|
||||||
|
return deckViewContainerSequence;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -251,8 +266,9 @@ void DeckViewContainer::unloadDeck()
|
||||||
void DeckViewContainer::loadLocalDeck()
|
void DeckViewContainer::loadLocalDeck()
|
||||||
{
|
{
|
||||||
DlgLoadDeck dialog(this);
|
DlgLoadDeck dialog(this);
|
||||||
if (!dialog.exec())
|
if (!dialog.exec()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
loadDeckFromFile(dialog.selectedFiles().at(0));
|
loadDeckFromFile(dialog.selectedFiles().at(0));
|
||||||
}
|
}
|
||||||
|
|
@ -364,8 +380,9 @@ void DeckViewContainer::sideboardPlanChanged()
|
||||||
{
|
{
|
||||||
Command_SetSideboardPlan cmd;
|
Command_SetSideboardPlan cmd;
|
||||||
const QList<MoveCard_ToZone> &newPlan = deckView->getSideboardPlan();
|
const QList<MoveCard_ToZone> &newPlan = deckView->getSideboardPlan();
|
||||||
for (const auto &i : newPlan)
|
for (const auto &i : newPlan) {
|
||||||
cmd.add_move_list()->CopyFrom(i);
|
cmd.add_move_list()->CopyFrom(i);
|
||||||
|
}
|
||||||
parentGame->getGame()->getGameEventHandler()->sendGameCommand(cmd, playerId);
|
parentGame->getGame()->getGameEventHandler()->sendGameCommand(cmd, playerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -404,8 +421,9 @@ void DeckViewContainer::setSideboardLocked(bool locked)
|
||||||
{
|
{
|
||||||
sideboardLockButton->setState(!locked);
|
sideboardLockButton->setState(!locked);
|
||||||
deckView->setLocked(readyStartButton->getState() || !sideboardLockButton->getState());
|
deckView->setLocked(readyStartButton->getState() || !sideboardLockButton->getState());
|
||||||
if (locked)
|
if (locked) {
|
||||||
deckView->resetSideboardPlan();
|
deckView->resetSideboardPlan();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeckViewContainer::setDeck(const DeckList &deck)
|
void DeckViewContainer::setDeck(const DeckList &deck)
|
||||||
|
|
|
||||||
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