Merge remote-tracking branch 'upstream/master' into first-run-tutorial
|
|
@ -8,10 +8,13 @@ RUN pacman --sync --refresh --sysupgrade --needed --noconfirm \
|
|||
gtest \
|
||||
mariadb-libs \
|
||||
ninja \
|
||||
openssl \
|
||||
protobuf \
|
||||
qt6-base \
|
||||
qt6-declarative \
|
||||
qt6-imageformats \
|
||||
qt6-multimedia \
|
||||
qt6-shadertools \
|
||||
qt6-svg \
|
||||
qt6-tools \
|
||||
qt6-translations \
|
||||
|
|
|
|||
|
|
@ -15,11 +15,14 @@ RUN apt-get update && \
|
|||
libprotobuf-dev \
|
||||
libqt6multimedia6 \
|
||||
libqt6sql6-mysql \
|
||||
libssl-dev \
|
||||
ninja-build \
|
||||
protobuf-compiler \
|
||||
qt6-declarative-dev \
|
||||
qt6-image-formats-plugins \
|
||||
qt6-l10n-tools \
|
||||
qt6-multimedia-dev \
|
||||
qt6-shadertools-dev \
|
||||
qt6-svg-dev \
|
||||
qt6-tools-dev \
|
||||
qt6-tools-dev-tools \
|
||||
|
|
|
|||
|
|
@ -16,11 +16,14 @@ RUN apt-get update && \
|
|||
libprotobuf-dev \
|
||||
libqt6multimedia6 \
|
||||
libqt6sql6-mysql \
|
||||
libssl-dev \
|
||||
ninja-build \
|
||||
protobuf-compiler \
|
||||
qt6-declarative-dev \
|
||||
qt6-image-formats-plugins \
|
||||
qt6-l10n-tools \
|
||||
qt6-multimedia-dev \
|
||||
qt6-shadertools-dev \
|
||||
qt6-svg-dev \
|
||||
qt6-tools-dev \
|
||||
qt6-tools-dev-tools \
|
||||
|
|
|
|||
|
|
@ -7,8 +7,9 @@ RUN dnf install -y \
|
|||
git \
|
||||
mariadb-devel \
|
||||
ninja-build \
|
||||
openssl-devel \
|
||||
protobuf-devel \
|
||||
qt6-{qttools,qtsvg,qtmultimedia,qtwebsockets}-devel \
|
||||
qt6-{qtdeclarative,qtmultimedia,qtshadertools,qtsvg,qttools,qtwebsockets}-devel \
|
||||
qt6-qtimageformats \
|
||||
rpm-build \
|
||||
xz-devel \
|
||||
|
|
|
|||
|
|
@ -7,8 +7,9 @@ RUN dnf install -y \
|
|||
git \
|
||||
mariadb-devel \
|
||||
ninja-build \
|
||||
openssl-devel \
|
||||
protobuf-devel \
|
||||
qt6-{qttools,qtsvg,qtmultimedia,qtwebsockets}-devel \
|
||||
qt6-{qtdeclarative,qtmultimedia,qtshadertools,qtsvg,qttools,qtwebsockets}-devel \
|
||||
qt6-qtimageformats \
|
||||
rpm-build \
|
||||
xz-devel \
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ RUN apt-get update && \
|
|||
libmariadb-dev-compat \
|
||||
libprotobuf-dev \
|
||||
libqt6sql6-mysql \
|
||||
libssl-dev \
|
||||
ninja-build \
|
||||
protobuf-compiler \
|
||||
qt6-tools-dev \
|
||||
|
|
|
|||
|
|
@ -15,11 +15,14 @@ RUN apt-get update && \
|
|||
libprotobuf-dev \
|
||||
libqt6multimedia6 \
|
||||
libqt6sql6-mysql \
|
||||
libssl-dev \
|
||||
ninja-build \
|
||||
protobuf-compiler \
|
||||
qt6-declarative-dev \
|
||||
qt6-image-formats-plugins \
|
||||
qt6-l10n-tools \
|
||||
qt6-multimedia-dev \
|
||||
qt6-shadertools-dev \
|
||||
qt6-svg-dev \
|
||||
qt6-tools-dev \
|
||||
qt6-tools-dev-tools \
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ RUN apt-get update && \
|
|||
cmake \
|
||||
file \
|
||||
g++ \
|
||||
gcovr \
|
||||
git \
|
||||
libgl-dev \
|
||||
liblzma-dev \
|
||||
|
|
@ -16,11 +17,14 @@ RUN apt-get update && \
|
|||
libprotobuf-dev \
|
||||
libqt6multimedia6 \
|
||||
libqt6sql6-mysql \
|
||||
libssl-dev \
|
||||
ninja-build \
|
||||
protobuf-compiler \
|
||||
qt6-declarative-dev \
|
||||
qt6-image-formats-plugins \
|
||||
qt6-l10n-tools \
|
||||
qt6-multimedia-dev \
|
||||
qt6-shadertools-dev \
|
||||
qt6-svg-dev \
|
||||
qt6-tools-dev \
|
||||
qt6-tools-dev-tools \
|
||||
|
|
|
|||
232
.ci/compile.sh
|
|
@ -8,14 +8,17 @@
|
|||
# --suffix <suffix> renames package with this suffix, requires arg
|
||||
# --server compiles servatrice
|
||||
# --test runs tests
|
||||
# --sanitize builds with AddressSanitizer and UndefinedBehaviorSanitizer, gcc/clang only
|
||||
# --coverage instruments the test run for line coverage and prints a gcovr summary, gcc only
|
||||
|
||||
# --debug or --release sets the build type ie CMAKE_BUILD_TYPE
|
||||
# --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"
|
||||
# --cmake-generator <generator> sets CMAKE_GENERATOR as used by cmake
|
||||
# --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 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>)
|
||||
# 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 MAKE_SANITIZE MAKE_COVERAGE
|
||||
# (correspond to args: --debug/--release --install --package <package type> --suffix <suffix> --server --test --sanitize --coverage --ccache <ccache_size> --dir <dir>)
|
||||
# exitcode: 1 for failure, 3 for invalid arguments
|
||||
|
||||
# Read arguments
|
||||
|
|
@ -57,6 +60,14 @@ while [[ $# != 0 ]]; do
|
|||
MAKE_TEST=1
|
||||
shift
|
||||
;;
|
||||
'--sanitize')
|
||||
MAKE_SANITIZE=1
|
||||
shift
|
||||
;;
|
||||
'--coverage')
|
||||
MAKE_COVERAGE=1
|
||||
shift
|
||||
;;
|
||||
'--debug')
|
||||
BUILDTYPE="Debug"
|
||||
shift
|
||||
|
|
@ -131,6 +142,15 @@ if [[ ! $BUILD_DIR ]]; then
|
|||
BUILD_DIR="build"
|
||||
fi
|
||||
mkdir -p "$BUILD_DIR"
|
||||
|
||||
if [[ $MAKE_COVERAGE ]]; then
|
||||
# Resolved while the working directory is still the source root. $0 is relative to the
|
||||
# directory the script was invoked from, so after the cd below it no longer resolves, and
|
||||
# under `set -e` the failed subshell would abort the build rather than just yielding an empty
|
||||
# variable. Only the coverage report needs this, so only coverage pays for it.
|
||||
SRC_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
fi
|
||||
|
||||
cd "$BUILD_DIR"
|
||||
|
||||
# Set minimum CMake Version
|
||||
|
|
@ -147,8 +167,22 @@ fi
|
|||
if [[ $MAKE_TEST ]]; then
|
||||
flags+=("-DTEST=1")
|
||||
fi
|
||||
if [[ $MAKE_SANITIZE ]]; then
|
||||
flags+=("-DENABLE_SANITIZERS=ON")
|
||||
else
|
||||
# The release-package step re-runs cmake in the same build dir, so an
|
||||
# ENABLE_SANITIZERS=ON left over from the debug step would otherwise leak
|
||||
# into the shipped binaries (libasan/libubsan Depends in the DEB).
|
||||
flags+=("-DENABLE_SANITIZERS=OFF")
|
||||
fi
|
||||
if [[ $MAKE_COVERAGE ]]; then
|
||||
flags+=("-DENABLE_COVERAGE=ON")
|
||||
fi
|
||||
if [[ $USE_CCACHE ]]; then
|
||||
flags+=("-DUSE_CCACHE=1")
|
||||
# PCH-aware caching is required or ccache refuses to cache any TU that
|
||||
# consumes a precompiled header, silently recompiling everything on every run.
|
||||
ccache --set-config sloppiness=pch_defines,time_macros
|
||||
if [[ $CCACHE_SIZE ]]; then
|
||||
# note, this setting persists after running the script
|
||||
ccache --max-size "$CCACHE_SIZE"
|
||||
|
|
@ -303,7 +337,50 @@ fi
|
|||
|
||||
if [[ $MAKE_TEST ]]; then
|
||||
echo "::group::Run tests"
|
||||
ctest -C "$BUILDTYPE" --output-on-failure
|
||||
if [[ $MAKE_SANITIZE ]]; then
|
||||
# detect_leaks=0: Qt and the sanitizers' own runtimes both leak at exit by design, and
|
||||
# LeakSanitizer's default is aggressive enough to bury our real findings under hundreds
|
||||
# of process-teardown reports. Malloc/free misuse and use-after-free are what ASan is for
|
||||
# and they stay fully on.
|
||||
# abort_on_error=1: a bad access leaves the process in an unusable state, so continuing
|
||||
# only produces a second, more confusing report from the wreckage.
|
||||
# UBSAN halt_on_error=1: without it UBSan prints "runtime error: ..." but the
|
||||
# process exits 0 (recover mode), so gtest/ctest report a pass and the job
|
||||
# stays green. Combined with -fno-sanitize-recover=undefined at compile time,
|
||||
# the first finding aborts the test process with a non-zero exit.
|
||||
export ASAN_OPTIONS="detect_leaks=0:abort_on_error=1:print_stacktrace=1:symbolize=1"
|
||||
export UBSAN_OPTIONS="print_stacktrace=1:halt_on_error=1:symbolize=1"
|
||||
fi
|
||||
# Every TEST() is its own CTest entry, so the suite is process-spawn bound rather than CPU
|
||||
# bound and -j recovers nearly all of the per-process overhead. The test binaries are safe to
|
||||
# run concurrently: the only one that claims a fixed resource is single_instance_manager_test,
|
||||
# which already scopes its local socket name to its own pid so parallel copies cannot collide.
|
||||
ctest -C "$BUILDTYPE" --output-on-failure -j "${CTEST_JOBS:-4}"
|
||||
echo "::endgroup::"
|
||||
fi
|
||||
|
||||
if [[ $MAKE_COVERAGE ]]; then
|
||||
# gcovr is not a build dependency and is not available everywhere, so a missing one is reported
|
||||
# and skipped rather than failing an otherwise green build.
|
||||
echo "::group::Coverage report"
|
||||
GCOVR="$(command -v gcovr || true)"
|
||||
if [[ -z $GCOVR ]]; then
|
||||
echo "gcovr not found; install it to produce a coverage report"
|
||||
else
|
||||
"$GCOVR" --version
|
||||
# This script configures with `cmake ..`, so the build dir it was started from is the object
|
||||
# directory and the source root is one level up. Both are passed explicitly: gcovr otherwise
|
||||
# walks the current directory and trips over in-tree build directories left by other tooling,
|
||||
# whose stale .gcno files cannot be resolved. --config is named too, so the filters apply no
|
||||
# matter what directory gcovr happens to start from.
|
||||
GCOVR_ARGS=("." --root "$SRC_ROOT" --object-directory "." --config "$SRC_ROOT/gcovr.cfg")
|
||||
"$GCOVR" "${GCOVR_ARGS[@]}" --txt --decisions
|
||||
"$GCOVR" "${GCOVR_ARGS[@]}" --html-details coverage-details.html --html-title "Cockatrice line coverage"
|
||||
"$GCOVR" "${GCOVR_ARGS[@]}" --lcov -o coverage.lcov
|
||||
"$GCOVR" "${GCOVR_ARGS[@]}" --cobertura-pretty -o coverage.xml
|
||||
"$GCOVR" "${GCOVR_ARGS[@]}" --json-summary-pretty -o coverage-summary.json
|
||||
echo "Coverage artifacts written to coverage-details.html, coverage.lcov, coverage.xml and coverage-summary.json"
|
||||
fi
|
||||
echo "::endgroup::"
|
||||
fi
|
||||
|
||||
|
|
@ -324,4 +401,153 @@ if [[ $MAKE_PACKAGE ]]; then
|
|||
BUILD_DIR="$BUILD_DIR" .ci/name_build.sh "$PACKAGE_SUFFIX"
|
||||
echo "::endgroup::"
|
||||
fi
|
||||
|
||||
if [[ $RUNNER_OS == Windows ]]; then
|
||||
echo "::group::Check installer for build-tree artifacts"
|
||||
cd "$BUILD_DIR"
|
||||
package="$(find . -maxdepth 1 -type f -name 'Cockatrice-*.exe' -print -quit)"
|
||||
if [[ ! $package ]]; then
|
||||
echo "::error file=$0::Could not find installer to inspect"
|
||||
exit 1
|
||||
fi
|
||||
seven_zip="$(command -v 7z || true)"
|
||||
if [[ ! $seven_zip ]]; then
|
||||
seven_zip="/c/Program Files/7-Zip/7z.exe"
|
||||
fi
|
||||
if [[ ! -f $seven_zip ]]; then
|
||||
echo "::warning file=$0::7-Zip not found, skipping installer content check"
|
||||
else
|
||||
echo "Inspecting $package"
|
||||
# Fail the build if the installer contains any path left behind by the MSBuild or
|
||||
# Qt AUTOMOC tooling (build-tree artifacts must live in the build dir, not the install)
|
||||
if "$seven_zip" l "$package" |
|
||||
grep -E "_autogen|\.dir[\\/]|\.tlog|(^|[\\/])x64[\\/]|(^|[\\/])\.qt[\\/]|(^|[\\/])\.qsb[\\/]|(^|[\\/])\.lupdate[\\/]|CMakeFiles"; then
|
||||
echo "::error file=$0::Installer contains build-tree artifacts"
|
||||
exit 1
|
||||
fi
|
||||
echo "Installer content is clean"
|
||||
|
||||
# Fail the build if the installer does not carry the runtime the
|
||||
# applications link against - a file that must be there, or a DLL that must
|
||||
# not be. The runtime DLLs reach the package by globbing every *.dll out of
|
||||
# the build output directories, so anything that build produced can ride
|
||||
# along and nothing else in the build objects to it: a Qt module the client
|
||||
# links statically (Qt6Multimedia.dll, Qt6QuickWidgets.dll) can be left out,
|
||||
# and the test framework's gtest.dll can be shipped. Either only surfaces on
|
||||
# a user's machine after an update has already replaced their install, as
|
||||
# "The code execution cannot proceed because Qt6Multimedia.dll was not
|
||||
# found" or "abseil_dll.dll is either not designed to run on Windows or it
|
||||
# contains an error". required-runtime.txt is written by the top level
|
||||
# CMakeLists.txt from the same module lists the targets are built against
|
||||
# plus the vcpkg bin directory the app-local copies come from.
|
||||
if [[ ! -f required-runtime.txt ]]; then
|
||||
echo "::error file=$0::required-runtime.txt not found in the build dir, cannot verify the runtime"
|
||||
exit 1
|
||||
fi
|
||||
# 7-Zip writes CRLF on Windows, so the \r has to come off before any
|
||||
# whole-line comparison below. Normalize separators to /, and strip the
|
||||
# install-root prefixes an NSIS listing may carry, so the entries can be
|
||||
# compared as exact relative paths. -xF keeps a '.' in a DLL name from
|
||||
# being a wildcard; -i because that is how the installed tree behaves -
|
||||
# the uninstaller clears both $INSTDIR\plugins and $INSTDIR\Plugins.
|
||||
# The archive side and the manifest side have to agree on line endings.
|
||||
# CMake writes required-runtime.txt with the platform's line ending and
|
||||
# 7-Zip writes CRLF on Windows, so a trailing \r survives on $entry and
|
||||
# defeats the whole-line match - every entry then reads as missing even
|
||||
# though the listing holds it verbatim.
|
||||
# [$] rather than \$ so the literal dollar is a bracket expression and the
|
||||
# linter does not read these as unexpanded shell variables (SC2016).
|
||||
installer_paths="$("$seven_zip" l -slt "$package" | tr -d '\r' |
|
||||
sed -n 's/^Path = //p' |
|
||||
sed -e 's|\\|/|g' -e 's|^[$]INSTDIR/||' -e 's|^[$]OUTDIR/||' -e 's|^[$]PLUGINSDIR/||' -e 's|^\./||' -e 's|^/||')"
|
||||
manifest="$(tr -d '\r' <required-runtime.txt)"
|
||||
missing=""
|
||||
checked=0
|
||||
while IFS= read -r entry; do
|
||||
if [[ -z $entry || $entry == \#* ]]; then
|
||||
continue
|
||||
fi
|
||||
checked=$((checked + 1))
|
||||
if ! grep -qxiF "$entry" <<<"$installer_paths"; then
|
||||
missing+=" $entry"
|
||||
fi
|
||||
done <<<"$manifest"
|
||||
if [[ -n $missing ]]; then
|
||||
echo "::error file=$0::Installer is missing required runtime files:$missing"
|
||||
# Print both sides of the comparison. A mismatch here has twice been
|
||||
# caused by the shape of 7-Zip's output rather than by a missing file,
|
||||
# and a bare "missing" line cannot tell those apart.
|
||||
echo "required-runtime.txt asked for $checked path(s); 7-Zip listed $(grep -c '' <<<"$installer_paths") path(s)"
|
||||
# Indent with parameter expansion rather than sed 's/^/ /', which the
|
||||
# linter reports as SC2001.
|
||||
echo "--- required ---"
|
||||
echo "${manifest//$'\n'/$'\n '}"
|
||||
echo "--- first 40 paths 7-Zip lists in the installer ---"
|
||||
listed_head="$(head -40 <<<"$installer_paths")"
|
||||
echo "${listed_head//$'\n'/$'\n '}"
|
||||
exit 1
|
||||
fi
|
||||
echo "Installer carries the Qt runtime of every module the three applications link ($checked files)"
|
||||
|
||||
# Now the other direction: a top level DLL in the package that the manifest
|
||||
# does not name. The missing check above cannot see a runtime that was
|
||||
# never expected.
|
||||
#
|
||||
# Two things are reported here and neither may fail the build.
|
||||
#
|
||||
# The test framework is a fact rather than a guess - no shipped executable
|
||||
# links gtest or gmock, and the build output directories the "*.dll" glob
|
||||
# reads are shared with the test targets, so gtest.dll and gmock.dll are
|
||||
# one filter away from shipping in every release. Even so it is reported
|
||||
# instead of enforced: a check that has never passed on a real package has
|
||||
# not earned the right to block a release, and the first Windows run of an
|
||||
# enforcing version is exactly when its own wrong assumptions show up.
|
||||
#
|
||||
# Everything else is expected to be there. required-runtime.txt names the
|
||||
# Qt modules the three applications link, and the protobuf, Abseil,
|
||||
# OpenSSL, liblzma, ffmpeg and Qt debug DLLs in the package come in on the
|
||||
# build output glob instead, because nothing in the build declares them by
|
||||
# name. So this list is a report of what the package carries, not a verdict.
|
||||
# Read it when a dependency is added; do not fail on it.
|
||||
forbidden=""
|
||||
unexpected=""
|
||||
while IFS= read -r entry; do
|
||||
[[ -z $entry ]] && continue
|
||||
# Top level only. A DLL under Plugins/ or a nested image format plugin is
|
||||
# a plugin the platform loads by name, not a runtime the executable
|
||||
# imports, and requiring one here would list all of them every run.
|
||||
[[ $entry == */* ]] && continue
|
||||
if grep -qxiF "$entry" <<<"$manifest"; then
|
||||
continue
|
||||
fi
|
||||
# NSIS extracts its plugins to $PLUGINSDIR, which the path normalization
|
||||
# above strips, so they arrive here looking like payload files. They are
|
||||
# part of the installer, not of the installed tree.
|
||||
if [[ $entry == [Nn][Ss][Dd][Ii][Aa][Ll][Oo][Gg][Ss].dll ||
|
||||
$entry == [Nn][Ss][Ee][Xx][Ee][Cc].dll ||
|
||||
$entry == [Ss][Yy][Ss][Tt][Ee][Mm].dll ||
|
||||
$entry == [Uu][Ss][Ee][Rr][Ii][Nn][Ff][Oo].dll ||
|
||||
$entry == [Ii][Nn][Ee][Tt].dll ]]; then
|
||||
continue
|
||||
fi
|
||||
if [[ $entry == [Gg][Tt][Ee][Ss][Tt]* || $entry == [Gg][Mm][Oo][Cc][Kk]* ]]; then
|
||||
forbidden+=" $entry"
|
||||
else
|
||||
unexpected+=" $entry"
|
||||
fi
|
||||
done < <(grep -i '\.dll$' <<<"$installer_paths")
|
||||
if [[ -n $forbidden ]]; then
|
||||
echo "::warning file=$0::Installer contains test framework DLLs that no shipped executable links:$forbidden"
|
||||
echo "A build output directory shared with the test targets has leaked into the package."
|
||||
fi
|
||||
if [[ -n $unexpected ]]; then
|
||||
echo "Top level DLLs in the package beyond the linked Qt modules:$unexpected"
|
||||
echo "These arrive on the build output glob, not from required-runtime.txt, so they are reported and not required."
|
||||
fi
|
||||
if [[ -z $forbidden && -z $unexpected ]]; then
|
||||
echo "Installer carries no runtime files beyond the linked Qt modules"
|
||||
fi
|
||||
fi
|
||||
echo "::endgroup::"
|
||||
fi
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -13,11 +13,17 @@
|
|||
# --set-cache <location> sets the location to cache the image or for ccache
|
||||
#
|
||||
# requires: docker
|
||||
# uses env: NAME CACHE BUILD GET SAVE INTERACTIVE
|
||||
# uses env: NAME IMAGE_SUFFIX 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
|
||||
# exitcode: 1 for failure, 2 for missing dockerfile, 3 for invalid arguments
|
||||
#
|
||||
# IMAGE_SUFFIX is optional and only appended to the image name, never to NAME, so that a matrix
|
||||
# leg can have its own image and image cache without needing its own directory under .ci. Two legs
|
||||
# building and tagging the same image concurrently would race on `docker build --tag`.
|
||||
# It is deliberately not called SUFFIX: compile.sh already uses SUFFIX for output file names, and
|
||||
# a job-level SUFFIX would be silently overridden by those per-step env blocks.
|
||||
#
|
||||
# exported RUN function will run the BUILD_SCRIPT inside of the docker container.
|
||||
# note that the docker container will not inherit any environment variables!
|
||||
#
|
||||
|
|
@ -81,7 +87,7 @@ if ! [[ $NAME ]]; then
|
|||
return 3
|
||||
fi
|
||||
|
||||
export IMAGE_NAME="${project_name,,}_${NAME,,}" # lower case
|
||||
export IMAGE_NAME="${project_name,,}_${NAME,,}${IMAGE_SUFFIX:+_${IMAGE_SUFFIX,,}}" # lower case
|
||||
|
||||
docker_dir=".ci/$NAME"
|
||||
if ! [[ -r $docker_dir/Dockerfile ]]; then
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@ Available pre-compiled binaries for installation:
|
|||
• <kbd>Windows 10+</kbd>
|
||||
|
||||
<b>macOS</b>
|
||||
• <kbd>macOS 15+</kbd> <sub><i>Sequoia</i></sub> <sub>Apple M</sub>
|
||||
• <kbd>macOS 14+</kbd> <sub><i>Sonoma</i></sub> <sub>Apple M</sub>
|
||||
• <kbd>macOS 13+</kbd> <sub><i>Ventura</i></sub> <sub>Intel</sub>
|
||||
• <kbd>macOS 15+</kbd> <sub><i>Sequoia</i></sub>
|
||||
• <kbd>macOS 14+</kbd> <sub><i>Sonoma</i></sub>
|
||||
• <kbd>macOS 13+</kbd> <sub><i>Ventura (x86)</i></sub>
|
||||
|
||||
<b>Linux</b>
|
||||
• <kbd>Ubuntu 26.04 LTS</kbd> <sub><i>Resolute Racoon</i></sub>
|
||||
|
|
@ -24,10 +24,10 @@ Available pre-compiled binaries for installation:
|
|||
• <kbd>Fedora 44</kbd>
|
||||
• <kbd>Fedora 43</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>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 hosted at <a href="https://flathub.org/apps/io.github.Cockatrice.cockatrice">Flathub</a> (x86 & ARM)!</sub>
|
||||
<sub>Thanks to courtesy of @FFY00, the app is also available in <kbd>Arch Linux</kbd>'s <a href="https://archlinux.org/packages/extra/x86_64/cockatrice">official extra repository</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>
|
||||
<sub>We maintain a <kbd>Docker</kbd> image for "Servatrice" in <a href="https://github.com/Cockatrice/Cockatrice/pkgs/container/servatrice">GHCR</a> (x86 & ARM). You can docker pull it or use our Docker Compose files!</sub>
|
||||
</pre>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
.git/
|
||||
build/
|
||||
.github/
|
||||
.tx/
|
||||
|
|
|
|||
95
.github/workflows/codeql.yml
vendored
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
# GitHub Docs on Code Scanning:
|
||||
# https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning
|
||||
# https://docs.github.com/en/code-security/how-tos/find-and-fix-code-vulnerabilities/manage-your-configuration
|
||||
# https://docs.github.com/en/code-security/reference/code-scanning/workflow-configuration-options
|
||||
#
|
||||
# CodeQL Docs:
|
||||
# https://codeql.github.com/docs/
|
||||
|
||||
name: CodeQL
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
security-events: write # needed to post results
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
|
||||
# Cancel earlier, unfinished runs of this workflow on the same branch
|
||||
concurrency:
|
||||
group: "${{ github.workflow }} @ ${{ github.ref_name }}"
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze (${{ matrix.language }})
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
# https://codeql.github.com/docs/codeql-overview/supported-languages-and-frameworks/
|
||||
- language: cpp
|
||||
build-mode: manual
|
||||
- language: actions
|
||||
build-mode: none
|
||||
|
||||
steps:
|
||||
- name: "Checkout repository"
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: "Initialize CodeQL"
|
||||
uses: github/codeql-action/init@v4
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
build-mode: ${{ matrix.build-mode }}
|
||||
# https://docs.github.com/en/code-security/reference/code-scanning/codeql/codeql-queries/c-cpp-built-in-queries
|
||||
# https://docs.github.com/en/code-security/reference/code-scanning/codeql/codeql-queries/actions-built-in-queries
|
||||
queries: security-extended
|
||||
dependency-caching: true
|
||||
|
||||
- name: "[C++] Install dependencies"
|
||||
if: matrix.language == 'cpp' && matrix.build-mode == 'manual'
|
||||
shell: bash
|
||||
env:
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y --no-install-recommends \
|
||||
cmake \
|
||||
g++ \
|
||||
libgl-dev \
|
||||
liblzma-dev \
|
||||
libmariadb-dev-compat \
|
||||
libprotobuf-dev \
|
||||
ninja-build \
|
||||
protobuf-compiler \
|
||||
qt6-declarative-dev \
|
||||
qt6-multimedia-dev \
|
||||
qt6-shadertools-dev \
|
||||
qt6-svg-dev \
|
||||
qt6-tools-dev \
|
||||
qt6-tools-dev-tools \
|
||||
qt6-websockets-dev
|
||||
|
||||
# Minimize dependency install
|
||||
# Add ccache usage for faster compilation, (install ccache dep, actions/cache step + append DUSE_CCACHE=1 in cmake config, CCACHE env values)
|
||||
|
||||
- name: "[C++] Configure CMake"
|
||||
if: matrix.language == 'cpp' && matrix.build-mode == 'manual'
|
||||
shell: bash
|
||||
run: cmake -S . -B build -G Ninja -DWITH_SERVER=1 -DCMAKE_BUILD_TYPE=Release
|
||||
|
||||
- name: "[C++] Build application"
|
||||
if: matrix.language == 'cpp' && matrix.build-mode == 'manual'
|
||||
shell: bash
|
||||
run: cmake --build build
|
||||
|
||||
- name: "Perform CodeQL Analysis"
|
||||
uses: github/codeql-action/analyze@v4
|
||||
with:
|
||||
category: "/language:${{ matrix.language }}"
|
||||
189
.github/workflows/desktop-build.yml
vendored
|
|
@ -3,7 +3,7 @@ name: Build Desktop
|
|||
permissions:
|
||||
actions: write # needed to delete entries in GHA cache (update ccache)
|
||||
attestations: write # needed to persist the attestation.
|
||||
contents: write
|
||||
contents: write # needed for e.g. vcpkg dependency graph updates
|
||||
id-token: write # needed for signing certificate in attestation
|
||||
|
||||
on:
|
||||
|
|
@ -34,7 +34,7 @@ on:
|
|||
- 'vcpkg.json'
|
||||
- 'vcpkg' # needed to match submodule bumps (gitlink)
|
||||
|
||||
# Cancel earlier, unfinished runs of this workflow on the same branch (unless on release)
|
||||
# Cancel earlier, unfinished runs of this workflow on the same branch (unless on tag --> release)
|
||||
concurrency:
|
||||
group: "${{ github.workflow }} @ ${{ github.ref_name }}"
|
||||
cancel-in-progress: ${{ github.ref_type != 'tag' }}
|
||||
|
|
@ -42,7 +42,7 @@ concurrency:
|
|||
jobs:
|
||||
configure:
|
||||
name: Configure
|
||||
runs-on: ubuntu-slim
|
||||
runs-on: ubuntu-slim # https://github.com/actions/runner-images/blob/main/images/ubuntu-slim/ubuntu-slim-Readme.md
|
||||
outputs:
|
||||
tag: ${{ steps.configure.outputs.tag }}
|
||||
sha: ${{ steps.configure.outputs.sha }}
|
||||
|
|
@ -144,31 +144,47 @@ jobs:
|
|||
|
||||
package: DEB
|
||||
|
||||
name: ${{ matrix.distro }} ${{ matrix.version }}
|
||||
# The one leg that runs the suite under AddressSanitizer and
|
||||
# UndefinedBehaviorSanitizer. Debian 13 and Fedora 44 keep covering the
|
||||
# uninstrumented suite, so nothing is lost by instrumenting this one.
|
||||
sanitize: yes
|
||||
|
||||
- distro: Ubuntu
|
||||
version: 26.04
|
||||
variant: cover # separate image and ccache, same distro
|
||||
|
||||
# The one leg that runs instrumented for line coverage and publishes the report as
|
||||
# a workflow artifact. It is a separate leg rather than a second flag on the
|
||||
# sanitizer leg because the two instruments answer different questions: the
|
||||
# sanitizer leg reports what the run did wrong, the coverage leg reports what the
|
||||
# run never touched at all. Combining them would also slow both down. Packaging is
|
||||
# skipped because the leg above already publishes the DEB for this distro.
|
||||
coverage: yes
|
||||
package: skip
|
||||
|
||||
name: ${{ matrix.distro }} ${{ matrix.version }}${{ matrix.variant && format(' {0}', matrix.variant) || '' }}
|
||||
needs: configure
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-latest # https://github.com/actions/runner-images
|
||||
continue-on-error: ${{ matrix.allow-failure == 'yes' }}
|
||||
timeout-minutes: 70
|
||||
env:
|
||||
CACHE: ${{ github.workspace }}/.cache/${{ matrix.distro }}${{ matrix.version }} # directory for caching docker image and ccache
|
||||
CACHE: ${{ github.workspace }}/.cache/${{ matrix.distro }}${{ matrix.version }}${{ matrix.variant }} # directory for caching docker image and ccache
|
||||
CCACHE_EVICTION_AGE: 7d
|
||||
CCACHE_SIZE: 550M # space of all repo is 10Gi: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policy
|
||||
CCACHE_SIZE: 600M # space of all repo is 10Gi: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policy
|
||||
CMAKE_GENERATOR: 'Ninja'
|
||||
NAME: ${{ matrix.distro }}${{ matrix.version }}
|
||||
IMAGE_SUFFIX: ${{ matrix.variant }}
|
||||
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: "Restore compiler cache (ccache)"
|
||||
id: ccache_restore
|
||||
id: restore_ccache
|
||||
uses: actions/cache/restore@v6
|
||||
env:
|
||||
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
|
||||
with:
|
||||
key: ccache-${{ matrix.distro }}${{ matrix.version }}-${{ env.BRANCH_NAME }}
|
||||
key: ccache-${{ matrix.distro }}${{ matrix.version }}${{ matrix.variant }}
|
||||
path: ${{ env.CACHE }}
|
||||
restore-keys: ccache-${{ matrix.distro }}${{ matrix.version }}-
|
||||
|
||||
- name: "Build ${{ matrix.distro }} ${{ matrix.version }} Docker image"
|
||||
shell: bash
|
||||
|
|
@ -177,10 +193,43 @@ jobs:
|
|||
- name: "Build debug and test"
|
||||
if: matrix.test != 'skip'
|
||||
shell: bash
|
||||
env:
|
||||
sanitize: '${{ matrix.sanitize }}'
|
||||
coverage: '${{ matrix.coverage }}'
|
||||
run: |
|
||||
source .ci/docker.sh
|
||||
RUN --server --debug --test --ccache "$CCACHE_SIZE" \
|
||||
--cmake-generator "$CMAKE_GENERATOR"
|
||||
args=()
|
||||
[[ $GITHUB_REF == "refs/heads/master" ]] && args+=(--evict-ccache "$CCACHE_EVICTION_AGE")
|
||||
args+=(--ccache "$CCACHE_SIZE")
|
||||
args+=(--cmake-generator "$CMAKE_GENERATOR")
|
||||
|
||||
extra=()
|
||||
[[ $sanitize == yes ]] && extra+=(--sanitize)
|
||||
[[ $coverage == yes ]] && extra+=(--coverage)
|
||||
|
||||
RUN --server --debug --test "${extra[@]}" "${args[@]}"
|
||||
|
||||
# RUN bind-mounts the workspace into the container, so the report the build wrote into
|
||||
# build/ is already on the host and no second container is needed to collect it.
|
||||
- name: "Collect coverage report"
|
||||
if: matrix.coverage == 'yes'
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p coverage
|
||||
# --html-details writes one page per source file plus a stylesheet and script, and the
|
||||
# index links to all of them by relative name. Copying the index alone would publish a
|
||||
# report where every link 404s, so the whole family has to travel together.
|
||||
cp build/coverage-details* coverage/
|
||||
cp build/coverage.lcov build/coverage.xml build/coverage-summary.json coverage/
|
||||
ls -la coverage/
|
||||
|
||||
- name: "Upload coverage artifact"
|
||||
if: matrix.coverage == 'yes'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: coverage-report
|
||||
path: coverage/
|
||||
if-no-files-found: warn
|
||||
|
||||
- name: "Build release package"
|
||||
id: build
|
||||
|
|
@ -203,10 +252,10 @@ jobs:
|
|||
|
||||
# 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
|
||||
if: github.ref == 'refs/heads/master' && steps.restore_ccache.outputs.cache-hit
|
||||
continue-on-error: true
|
||||
env:
|
||||
CACHE_PRIMARY_KEY: ${{ steps.ccache_restore.outputs.cache-primary-key }}
|
||||
CACHE_PRIMARY_KEY: ${{ steps.restore_ccache.outputs.cache-primary-key }}
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
if gh cache delete --repo "$GITHUB_REPOSITORY" "$CACHE_PRIMARY_KEY"; then
|
||||
|
|
@ -217,7 +266,7 @@ jobs:
|
|||
if: github.ref == 'refs/heads/master'
|
||||
uses: actions/cache/save@v6
|
||||
with:
|
||||
key: ${{ steps.ccache_restore.outputs.cache-primary-key }}
|
||||
key: ${{ steps.restore_ccache.outputs.cache-primary-key }}
|
||||
path: ${{ env.CACHE }}
|
||||
|
||||
- name: "Upload artifact"
|
||||
|
|
@ -262,74 +311,77 @@ jobs:
|
|||
matrix:
|
||||
include:
|
||||
- os: macOS
|
||||
target: 13
|
||||
runner: macos-15-intel
|
||||
target: 13 # EOL 2025-09-15
|
||||
runner: macos-15-intel # https://github.com/actions/runner-images/blob/main/images/macos/macos-15-Readme.md
|
||||
# macos-26-intel is very slow and fails in CPack during DMG config if not increasing Finder timeout
|
||||
|
||||
ccache_eviction_age: 7d
|
||||
cmake_generator: Ninja
|
||||
make_package: 1
|
||||
override_target: 13
|
||||
package_suffix: "-macOS13_Intel"
|
||||
qt_version: 6.11.0
|
||||
qt_modules: qtimageformats qtmultimedia qtwebsockets
|
||||
qt_version: 6.11.*
|
||||
qt_modules: qtimageformats qtmultimedia qtshadertools qtwebsockets
|
||||
soc: Intel
|
||||
type: Release
|
||||
use_ccache: 1
|
||||
xcode: "16.4"
|
||||
xcode: "26.3"
|
||||
|
||||
- os: macOS
|
||||
target: 14
|
||||
runner: macos-14
|
||||
target: 14 # EOL 2026-??
|
||||
runner: macos-26 # https://github.com/actions/runner-images/blob/main/images/macos/macos-26-arm64-Readme.md
|
||||
|
||||
ccache_eviction_age: 7d
|
||||
cmake_generator: Ninja
|
||||
make_package: 1
|
||||
override_target: 14
|
||||
package_suffix: "-macOS14"
|
||||
qt_version: 6.11.0
|
||||
qt_modules: qtimageformats qtmultimedia qtwebsockets
|
||||
qt_version: 6.11.*
|
||||
qt_modules: qtimageformats qtmultimedia qtshadertools qtwebsockets
|
||||
soc: Apple
|
||||
type: Release
|
||||
use_ccache: 1
|
||||
xcode: "15.4"
|
||||
xcode: "26.6"
|
||||
|
||||
- os: macOS
|
||||
target: 15
|
||||
runner: macos-15
|
||||
runner: macos-26 # https://github.com/actions/runner-images/blob/main/images/macos/macos-26-arm64-Readme.md
|
||||
|
||||
ccache_eviction_age: 7d
|
||||
cmake_generator: Ninja
|
||||
make_package: 1
|
||||
override_target: 15
|
||||
package_suffix: "-macOS15"
|
||||
qt_version: 6.11.0
|
||||
qt_modules: qtimageformats qtmultimedia qtwebsockets
|
||||
qt_version: 6.11.*
|
||||
qt_modules: qtimageformats qtmultimedia qtshadertools qtwebsockets
|
||||
soc: Apple
|
||||
type: Release
|
||||
use_ccache: 1
|
||||
xcode: "16.4"
|
||||
xcode: "26.6"
|
||||
|
||||
- os: macOS
|
||||
target: 15
|
||||
runner: macos-15
|
||||
target: 26
|
||||
runner: macos-26 # https://github.com/actions/runner-images/blob/main/images/macos/macos-26-arm64-Readme.md
|
||||
|
||||
ccache_eviction_age: 7d
|
||||
cmake_generator: Ninja
|
||||
qt_version: 6.11.0
|
||||
qt_modules: qtimageformats qtmultimedia qtwebsockets
|
||||
qt_version: 6.11.*
|
||||
qt_modules: qtimageformats qtmultimedia qtshadertools qtwebsockets
|
||||
soc: Apple
|
||||
type: Debug
|
||||
use_ccache: 1
|
||||
xcode: "16.4"
|
||||
xcode: "26.6"
|
||||
|
||||
- os: Windows
|
||||
target: 10
|
||||
runner: windows-2025
|
||||
runner: windows-2025 # https://github.com/actions/runner-images/blob/main/images/windows/Windows2025-VS2026-Readme.md
|
||||
|
||||
cmake_generator: "Visual Studio 18 2026"
|
||||
cmake_generator_platform: x64
|
||||
make_package: 1
|
||||
package_suffix: "-Win10"
|
||||
qt_version: 6.11.0
|
||||
qt_modules: qtimageformats qtmultimedia qtwebsockets
|
||||
qt_version: 6.11.*
|
||||
qt_modules: qtimageformats qtmultimedia qtshadertools qtwebsockets
|
||||
type: Release
|
||||
|
||||
name: ${{ matrix.os }} ${{ matrix.target }}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }}
|
||||
|
|
@ -338,7 +390,7 @@ jobs:
|
|||
timeout-minutes: 100
|
||||
env:
|
||||
CCACHE_DIR: ${{ github.workspace }}/.cache/
|
||||
CCACHE_SIZE: 550M # space of all repo is 10Gi: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policy
|
||||
CCACHE_SIZE: 600M # space of all repo is 10Gi: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policy
|
||||
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
|
|
@ -348,7 +400,6 @@ jobs:
|
|||
|
||||
- name: "[Windows] Add msbuild to PATH"
|
||||
if: matrix.os == 'Windows'
|
||||
id: add-msbuild
|
||||
uses: microsoft/setup-msbuild@v3
|
||||
with:
|
||||
msbuild-architecture: x64
|
||||
|
|
@ -359,54 +410,54 @@ jobs:
|
|||
|
||||
- name: "[macOS] Restore compiler cache (ccache)"
|
||||
if: matrix.os == 'macOS' && matrix.use_ccache == 1
|
||||
id: ccache_restore
|
||||
id: restore_ccache
|
||||
uses: actions/cache/restore@v6
|
||||
env:
|
||||
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
|
||||
with:
|
||||
key: ccache-${{ matrix.runner }}-${{ matrix.soc }}-${{ matrix.type }}-${{ env.BRANCH_NAME }}
|
||||
key: ccache-${{ matrix.runner }}_${{ matrix.override_target }}-Xcode${{ matrix.xcode }}
|
||||
path: ${{ env.CCACHE_DIR }}
|
||||
restore-keys: ccache-${{ matrix.runner }}-${{ matrix.soc }}-${{ matrix.type }}-
|
||||
|
||||
- name: "Install aqtinstall"
|
||||
- name: "[macOS] Install aqtinstall"
|
||||
if: matrix.os == 'macOS'
|
||||
run: pipx install 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: "[macOS] Resolve latest Qt from ${{ matrix.qt_version }} input"
|
||||
if: matrix.os == 'macOS'
|
||||
env:
|
||||
QT_VERSION: ${{ matrix.qt_version }}
|
||||
id: resolve_qt_version
|
||||
shell: bash
|
||||
run: .ci/resolve_latest_aqt_qt_version.sh "$QT_VERSION"
|
||||
|
||||
- name: "[macOS] Restore thin Qt ${{ steps.resolve_qt_version.outputs.version }} libraries"
|
||||
- name: "[macOS] Restore thin Qt ${{ steps.resolve_qt_version.outputs.version }}"
|
||||
if: matrix.os == 'macOS'
|
||||
id: restore_qt
|
||||
uses: actions/cache/restore@v6
|
||||
with:
|
||||
key: thin-qt-macos-${{ matrix.soc }}-${{ steps.resolve_qt_version.outputs.version }}
|
||||
key: Qt-${{ steps.resolve_qt_version.outputs.version }}-macOS-${{ matrix.soc }}-${{ matrix.qt_modules }}-thin
|
||||
path: ${{ github.workspace }}/Qt
|
||||
|
||||
# Using jurplel/install-qt-action to install Qt without using brew
|
||||
# Qt build using vcpkg either just fails or takes too long to build
|
||||
- name: "[macOS] Install fat Qt ${{ steps.resolve_qt_version.outputs.version }}"
|
||||
- name: "[macOS] Install fat Qt ${{ matrix.qt_version }}"
|
||||
if: matrix.os == 'macOS' && steps.restore_qt.outputs.cache-hit != 'true'
|
||||
uses: jurplel/install-qt-action@v4
|
||||
with:
|
||||
cache: false
|
||||
dir: ${{ github.workspace }}
|
||||
# cache-key-prefix: Qt
|
||||
dir: ${{ github.workspace }} # thinning script depends on this location
|
||||
modules: ${{ matrix.qt_modules }}
|
||||
version: ${{ steps.resolve_qt_version.outputs.version }}
|
||||
version: ${{ matrix.qt_version }}
|
||||
|
||||
- name: "[macOS] Create thin Qt libraries"
|
||||
if: matrix.os == 'macOS' && steps.restore_qt.outputs.cache-hit != 'true'
|
||||
run: .ci/thin_macos_qtlib.sh
|
||||
|
||||
- name: "[macOS] Cache thin Qt libraries"
|
||||
if: matrix.os == 'macOS' && steps.restore_qt.outputs.cache-hit != 'true'
|
||||
if: matrix.os == 'macOS' && steps.restore_qt.outputs.cache-hit != 'true' && github.ref == 'refs/heads/master'
|
||||
uses: actions/cache/save@v6
|
||||
with:
|
||||
key: thin-qt-macos-${{ matrix.soc }}-${{ steps.resolve_qt_version.outputs.version }}
|
||||
key: ${{ steps.restore_qt.outputs.cache-primary-key }}
|
||||
path: ${{ github.workspace }}/Qt
|
||||
|
||||
- name: "[Windows] Install Qt ${{ matrix.qt_version }}"
|
||||
|
|
@ -415,9 +466,10 @@ jobs:
|
|||
with:
|
||||
# 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
|
||||
cache: true
|
||||
cache: ${{ github.ref == 'refs/heads/master' }}
|
||||
cache-key-prefix: Qt
|
||||
modules: ${{ matrix.qt_modules }}
|
||||
version: ${{ steps.resolve_qt_version.outputs.version }}
|
||||
version: ${{ matrix.qt_version }}
|
||||
|
||||
- name: "[Windows] Install NSIS"
|
||||
if: matrix.os == 'Windows'
|
||||
|
|
@ -440,6 +492,7 @@ jobs:
|
|||
CMAKE_GENERATOR: ${{ matrix.cmake_generator }}
|
||||
CMAKE_GENERATOR_PLATFORM: ${{ matrix.cmake_generator_platform }}
|
||||
DEVELOPER_DIR: '/Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer'
|
||||
GITHUB_TOKEN: ${{ github.token }} # needed for vcpkg dependency graph updates, see VCPKG_FEATURE_FLAGS
|
||||
MACOS_CERTIFICATE: ${{ secrets.PROD_MACOS_CERTIFICATE }}
|
||||
MACOS_CERTIFICATE_NAME: ${{ secrets.PROD_MACOS_CERTIFICATE_NAME }}
|
||||
MACOS_CERTIFICATE_PWD: ${{ secrets.PROD_MACOS_CERTIFICATE_PWD }}
|
||||
|
|
@ -448,27 +501,39 @@ jobs:
|
|||
PACKAGE_SUFFIX: '${{ matrix.package_suffix }}'
|
||||
TARGET_MACOS_VERSION: ${{ matrix.override_target }}
|
||||
USE_CCACHE: ${{ matrix.use_ccache }}
|
||||
VCPKG_BINARY_SOURCES: 'clear;files,${{ steps.vcpkg-cache.outputs.path }},readwrite'
|
||||
VCPKG_BINARY_SOURCES: "clear;files,${{ steps.vcpkg-cache.outputs.path }},${{ case(github.ref == 'refs/heads/master', 'readwrite', 'read') }}"
|
||||
VCPKG_DISABLE_METRICS: 1
|
||||
VCPKG_FEATURE_FLAGS: dependencygraph
|
||||
run: .ci/compile.sh --server --test --vcpkg
|
||||
|
||||
# CPack reports a failed makensis run as "Problem running NSIS command"
|
||||
# plus a path to NSISOutput.log, and that log lives only on the runner, so
|
||||
# the actual compile error is otherwise nowhere in the workflow output.
|
||||
# Dump it, or a broken installer script is undiagnosable from CI alone.
|
||||
# shell: bash matters here - the default pwsh resolves `find` to Windows'
|
||||
# text-search find.exe, which errors instead of searching.
|
||||
- name: "Dump NSIS compile log"
|
||||
if: failure() && matrix.os == 'Windows'
|
||||
shell: bash
|
||||
run: find . -name NSISOutput.log -exec cat {} +
|
||||
|
||||
# Delete used cache to emulate a ccache update. See https://github.com/actions/cache/issues/342
|
||||
- name: "[macOS] Delete remote compiler cache (ccache)"
|
||||
if: matrix.os == 'macOS' && matrix.use_ccache == 1 && github.ref == 'refs/heads/master' && steps.ccache_restore.outputs.cache-hit
|
||||
if: matrix.os == 'macOS' && matrix.use_ccache == 1 && github.ref == 'refs/heads/master' && steps.restore_ccache.outputs.cache-hit
|
||||
continue-on-error: true
|
||||
env:
|
||||
CACHE_PRIMARY_KEY: ${{ steps.ccache_restore.outputs.cache-primary-key }}
|
||||
CACHE_PRIMARY_KEY: ${{ steps.restore_ccache.outputs.cache-primary-key }}
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
if gh cache delete --repo "$GITHUB_REPOSITORY" "$CACHE_PRIMARY_KEY"; then
|
||||
echo "Cache deleted successfully"
|
||||
fi
|
||||
|
||||
- name: "[macOS] Save updated compiler cache (ccache)"
|
||||
- name: "[macOS] Cache updated compiler cache (ccache)"
|
||||
if: matrix.os == 'macOS' && matrix.use_ccache == 1 && github.ref == 'refs/heads/master'
|
||||
uses: actions/cache/save@v6
|
||||
with:
|
||||
key: ${{ steps.ccache_restore.outputs.cache-primary-key }}
|
||||
key: ${{ steps.restore_ccache.outputs.cache-primary-key }}
|
||||
path: ${{ env.CCACHE_DIR }}
|
||||
|
||||
- name: "[macOS] Sign app bundle"
|
||||
|
|
|
|||
3
.github/workflows/desktop-lint.yml
vendored
|
|
@ -1,5 +1,8 @@
|
|||
name: Code Style (C++)
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
on:
|
||||
# Push trigger not needed for linting, we do not allow direct pushes to master
|
||||
pull_request:
|
||||
|
|
|
|||
199
.github/workflows/docker-release.yml
vendored
|
|
@ -1,8 +1,8 @@
|
|||
name: Build Docker Image
|
||||
name: Build Docker
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
contents: read # needed to checkout repo
|
||||
packages: write # needed for interacting with GHCR
|
||||
|
||||
on:
|
||||
push:
|
||||
|
|
@ -13,66 +13,185 @@ on:
|
|||
- master
|
||||
paths:
|
||||
- '.github/workflows/docker-release.yml'
|
||||
- '.dockerignore'
|
||||
- 'Dockerfile'
|
||||
- 'docker-compose.yml'
|
||||
- 'docker-compose.yml.windows'
|
||||
release:
|
||||
types:
|
||||
- released # publishing of stable releases
|
||||
workflow_dispatch: # (re)publish the image for an existing stable release
|
||||
inputs:
|
||||
tag:
|
||||
description: 'Existing release tag to build and publish (e.g. 2026-10-03-Release-3.1.0)'
|
||||
required: true
|
||||
type: string
|
||||
latest:
|
||||
description: 'Also update the "latest" tag'
|
||||
required: true
|
||||
type: boolean
|
||||
default: true
|
||||
|
||||
# Cancel earlier, unfinished runs of this workflow on the same branch (unless on release)
|
||||
# Cancel earlier, unfinished runs of this workflow on the same branch (unless publishing)
|
||||
concurrency:
|
||||
group: "${{ github.workflow }} @ ${{ github.ref_name }}"
|
||||
cancel-in-progress: ${{ github.event_name != 'release' }}
|
||||
group: "${{ github.workflow }} @ ${{ inputs.tag || github.ref_name }}"
|
||||
cancel-in-progress: ${{ github.event_name != 'release' && github.event_name != 'workflow_dispatch' }}
|
||||
|
||||
env:
|
||||
GHCR_IMAGE: ghcr.io/cockatrice/servatrice
|
||||
OCI_DESCRIPTION: Server for Cockatrice, a cross-platform virtual tabletop for multiplayer card games
|
||||
OCI_TITLE: Servatrice
|
||||
OCI_URL: https://cockatrice.github.io/
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
name: amd64 & arm64
|
||||
if: ${{ github.repository_owner == 'Cockatrice' }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
# Create one platform-specific image and publish its OCI image manifest per matrix job
|
||||
build:
|
||||
name: "Servatrice (${{ matrix.label }})"
|
||||
if: github.repository_owner == 'Cockatrice'
|
||||
runs-on: ${{ matrix.runner }}
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- label: x86
|
||||
platform: linux/amd64
|
||||
runner: ubuntu-latest # https://github.com/actions/runner-images
|
||||
|
||||
- label: arm
|
||||
platform: linux/arm64
|
||||
runner: ubuntu-24.04-arm # https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Arm64-Readme.md, replace with "ubuntu-latest-arm" once available
|
||||
|
||||
env:
|
||||
CACHE_SCOPE: servatrice-${{ matrix.label }}
|
||||
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: "Docker metadata"
|
||||
id: metadata
|
||||
uses: docker/metadata-action@v6
|
||||
env:
|
||||
DOCKER_METADATA_ANNOTATIONS_LEVELS: index # needed for GHCR
|
||||
with:
|
||||
annotations: |
|
||||
org.opencontainers.image.title=Servatrice
|
||||
org.opencontainers.image.url=https://cockatrice.github.io/
|
||||
org.opencontainers.image.description=Server for Cockatrice, a cross-platform virtual tabletop for multiplayer card games
|
||||
images: |
|
||||
ghcr.io/cockatrice/servatrice
|
||||
labels: |
|
||||
org.opencontainers.image.title=Servatrice
|
||||
org.opencontainers.image.url=https://cockatrice.github.io/
|
||||
org.opencontainers.image.description=Server for Cockatrice, a cross-platform virtual tabletop for multiplayer card games
|
||||
|
||||
- name: "Set up QEMU"
|
||||
uses: docker/setup-qemu-action@v4
|
||||
ref: ${{ case(github.event_name == 'workflow_dispatch', format('refs/tags/{0}', inputs.tag), '') }}
|
||||
|
||||
- name: "Set up Docker buildx"
|
||||
uses: docker/setup-buildx-action@v4
|
||||
|
||||
- name: "Login to GitHub Container Registry (GHCR)"
|
||||
if: github.event_name == 'release' && github.event.release.prerelease == false
|
||||
if: (github.event_name == 'release' && github.event.release.prerelease == false) || github.event_name == 'workflow_dispatch'
|
||||
id: login
|
||||
uses: docker/login-action@v4
|
||||
with:
|
||||
password: ${{ github.token }}
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ github.token }}
|
||||
|
||||
- name: "Build and push Docker image"
|
||||
# Don't push for non-publishing triggers
|
||||
- name: "Build image"
|
||||
if: steps.login.outcome != 'success'
|
||||
uses: docker/build-push-action@v7
|
||||
with:
|
||||
annotations: ${{ steps.metadata.outputs.annotations }}
|
||||
cache-from: type=gha,scope=servatrice
|
||||
cache-to: type=gha,mode=max,scope=servatrice
|
||||
cache-from: type=gha,scope=${{ env.CACHE_SCOPE }}
|
||||
cache-to: ${{ case(github.ref == 'refs/heads/master', format('type=gha,mode=max,scope={0}', env.CACHE_SCOPE), '') }}
|
||||
context: .
|
||||
labels: ${{ steps.metadata.outputs.labels }}
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: ${{ steps.login.outcome == 'success' }}
|
||||
tags: ${{ steps.metadata.outputs.tags }}
|
||||
platforms: ${{ matrix.platform }}
|
||||
push: false
|
||||
|
||||
# Add OCI labels and push single-platform image by digest (without tags)
|
||||
- name: "Build image and push by digest"
|
||||
if: steps.login.outcome == 'success'
|
||||
id: build
|
||||
uses: docker/build-push-action@v7
|
||||
with:
|
||||
cache-from: type=gha,scope=${{ env.CACHE_SCOPE }}
|
||||
cache-to: type=gha,mode=max,scope=${{ env.CACHE_SCOPE }}
|
||||
context: .
|
||||
labels: |
|
||||
org.opencontainers.image.description=${{ env.OCI_DESCRIPTION }}
|
||||
org.opencontainers.image.title=${{ env.OCI_TITLE }}
|
||||
org.opencontainers.image.url=${{ env.OCI_URL }}
|
||||
outputs: type=image,name=${{ env.GHCR_IMAGE }},name-canonical=true,push=true,push-by-digest=true
|
||||
platforms: ${{ matrix.platform }}
|
||||
provenance: mode=max # Do not pass secrets as build arguments with this option
|
||||
sbom: true
|
||||
|
||||
- name: "Export digest"
|
||||
if: steps.login.outcome == 'success'
|
||||
env:
|
||||
DIGEST: ${{ steps.build.outputs.digest }}
|
||||
run: |
|
||||
mkdir -p "$RUNNER_TEMP/digests"
|
||||
touch "$RUNNER_TEMP/digests/${DIGEST#sha256:}"
|
||||
|
||||
- name: "Upload digest"
|
||||
if: steps.login.outcome == 'success'
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
if-no-files-found: error
|
||||
name: digest-${{ matrix.label }}
|
||||
path: ${{ runner.temp }}/digests/*
|
||||
retention-days: 1
|
||||
|
||||
|
||||
# Create an OCI image index from the platform-specific image manifests
|
||||
index:
|
||||
name: "Publish multi-platform Servatrice image"
|
||||
if: github.repository_owner == 'Cockatrice' && ((github.event_name == 'release' && github.event.release.prerelease == false) || github.event_name == 'workflow_dispatch')
|
||||
needs: build
|
||||
runs-on: ubuntu-slim # https://github.com/actions/runner-images/blob/main/images/ubuntu-slim/ubuntu-slim-Readme.md
|
||||
|
||||
steps:
|
||||
- name: "Download digests"
|
||||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
path: ${{ runner.temp }}/digests
|
||||
pattern: digest-*
|
||||
merge-multiple: true
|
||||
|
||||
- name: "Login to GitHub Container Registry (GHCR)"
|
||||
uses: docker/login-action@v4
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ github.token }}
|
||||
|
||||
- name: "Docker metadata"
|
||||
id: metadata
|
||||
uses: docker/metadata-action@v6
|
||||
with:
|
||||
images: ${{ env.GHCR_IMAGE }}
|
||||
flavor: |
|
||||
latest=auto
|
||||
# if semver, also: type=semver,pattern={{version}} / {{major}}.{{minor}}
|
||||
tags: |
|
||||
type=ref,event=tag
|
||||
type=raw,value=${{ inputs.tag }},enable=${{ github.event_name == 'workflow_dispatch' }}
|
||||
type=raw,value=latest,enable=${{ github.event_name == 'workflow_dispatch' && inputs.latest }}
|
||||
|
||||
# Add OCI annotations to image index and publish tags
|
||||
- name: "Create image index"
|
||||
env:
|
||||
DOCKER_TAGS: ${{ steps.metadata.outputs.tags }}
|
||||
working-directory: ${{ runner.temp }}/digests
|
||||
run: |
|
||||
TAG_ARGS=()
|
||||
while IFS= read -r tag; do
|
||||
TAG_ARGS+=(--tag "$tag")
|
||||
done <<< "$DOCKER_TAGS"
|
||||
|
||||
DIGEST_ARGS=()
|
||||
for digest in *; do
|
||||
DIGEST_ARGS+=("$GHCR_IMAGE@sha256:$digest")
|
||||
done
|
||||
|
||||
docker buildx imagetools create \
|
||||
--prefer-index=true \
|
||||
--annotation "index:org.opencontainers.image.description=$OCI_DESCRIPTION" \
|
||||
--annotation "index:org.opencontainers.image.title=$OCI_TITLE" \
|
||||
--annotation "index:org.opencontainers.image.url=$OCI_URL" \
|
||||
"${TAG_ARGS[@]}" \
|
||||
"${DIGEST_ARGS[@]}"
|
||||
|
||||
- name: "Inspect images"
|
||||
env:
|
||||
GITHUB_TAG: ${{ inputs.tag || github.ref_name }}
|
||||
run: |
|
||||
docker buildx imagetools inspect "$GHCR_IMAGE:latest"
|
||||
docker buildx imagetools inspect "$GHCR_IMAGE:$GITHUB_TAG"
|
||||
|
|
|
|||
22
.github/workflows/documentation-build.yml
vendored
|
|
@ -1,5 +1,8 @@
|
|||
name: Generate Docs
|
||||
|
||||
permissions:
|
||||
contents: read # write permission to the destination repo come from 'deploy_key'
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
|
|
@ -11,6 +14,11 @@ on:
|
|||
- published # publishing of stable releases and pre-releases
|
||||
workflow_dispatch:
|
||||
|
||||
# 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' }}
|
||||
|
||||
env:
|
||||
COCKATRICE_REF: ${{ github.ref_name }} # tag name if the commit is tagged, otherwise branch name
|
||||
|
||||
|
|
@ -20,12 +28,13 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
- name: "Checkout"
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: "Install Graphviz"
|
||||
shell: bash
|
||||
run: |
|
||||
sudo apt-get install -y graphviz
|
||||
dot -V
|
||||
|
|
@ -33,9 +42,10 @@ jobs:
|
|||
- name: "Install Doxygen"
|
||||
uses: ssciwr/doxygen-install@v2
|
||||
with:
|
||||
version: "1.16.1"
|
||||
version: "1.18.0"
|
||||
|
||||
- name: "Update Doxygen Configuration"
|
||||
shell: bash
|
||||
run: |
|
||||
git diff Doxyfile
|
||||
doxygen -u Doxyfile
|
||||
|
|
@ -50,9 +60,10 @@ jobs:
|
|||
|
||||
- name: "Generate Documentation"
|
||||
if: always()
|
||||
shell: bash
|
||||
run: doxygen Doxyfile
|
||||
|
||||
- name: "Deploy to cockatrice.github.io"
|
||||
- name: "Deploy to cockatrice.github.io/docs"
|
||||
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
|
||||
uses: peaceiris/actions-gh-pages@v4
|
||||
with:
|
||||
|
|
@ -61,3 +72,8 @@ jobs:
|
|||
external_repository: Cockatrice/cockatrice.github.io
|
||||
publish_branch: master
|
||||
publish_dir: ./docs/html
|
||||
|
||||
- name: Link to Documentation Page
|
||||
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
|
||||
shell: bash
|
||||
run: echo "::notice title=New documentation published::Shortly available at https://cockatrice.github.io/docs/"
|
||||
|
|
|
|||
4
.github/workflows/translations-pull.yml
vendored
|
|
@ -1,5 +1,9 @@
|
|||
name: Update Translations
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
|
|
|
|||
4
.github/workflows/translations-push.yml
vendored
|
|
@ -1,5 +1,9 @@
|
|||
name: Update Translation Source
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
|
|
|
|||
111
CMakeLists.txt
|
|
@ -5,23 +5,27 @@
|
|||
# This file sets all the variables shared between the projects
|
||||
# like the installation path, compilation flags etc..
|
||||
|
||||
# cmake 3.16 is required if using qt6
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
# 3.16 required for Qt6 and target_precompile_headers()
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
# Early detect ccache
|
||||
# Use compiler cache (ccache)
|
||||
option(USE_CCACHE "Cache the build results with ccache" ON)
|
||||
# Treat warnings as errors (Debug builds only)
|
||||
option(WARNING_AS_ERROR "Treat warnings as errors in debug builds" ON)
|
||||
# Check for translation updates
|
||||
option(UPDATE_TRANSLATIONS "Update translations on compile" OFF)
|
||||
# Compile servatrice
|
||||
option(WITH_SERVER "build servatrice" OFF)
|
||||
# Compile cockatrice
|
||||
option(WITH_CLIENT "build cockatrice" ON)
|
||||
# Compile oracle
|
||||
option(WITH_ORACLE "build oracle" ON)
|
||||
# Compile Cockatrice
|
||||
option(WITH_CLIENT "Build Cockatrice client" ON)
|
||||
# Compile Oracle
|
||||
option(WITH_ORACLE "Build Cockatrice card database tool (Oracle)" ON)
|
||||
# Compile Servatrice
|
||||
option(WITH_SERVER "Build Cockatrice server (Servatrice)" OFF)
|
||||
# Compile tests
|
||||
option(TEST "build tests" OFF)
|
||||
option(TEST "Build tests" OFF)
|
||||
# Build with AddressSanitizer and UndefinedBehaviorSanitizer
|
||||
option(ENABLE_SANITIZERS "Build with AddressSanitizer and UndefinedBehaviorSanitizer" OFF)
|
||||
# Build instrumented for GCC line coverage, reported with gcovr
|
||||
option(ENABLE_COVERAGE "Build instrumented for GCC line coverage" OFF)
|
||||
# Use vcpkg regardless of OS
|
||||
option(USE_VCPKG "Use vcpkg regardless of OS" OFF)
|
||||
|
||||
|
|
@ -39,13 +43,24 @@ else()
|
|||
)
|
||||
endif()
|
||||
|
||||
if(USE_CCACHE)
|
||||
# ccache does not support MSVC and must not auto-engage on Windows
|
||||
# (it is installed unintentionally on the Windows CI runner).
|
||||
# NOTE: this keys off the target OS, so a mingw/Ninja configuration on Windows
|
||||
# also opts out of ccache even though the GNUCXX branch below supports it.
|
||||
if(USE_CCACHE AND NOT WIN32)
|
||||
find_program(CCACHE_PROGRAM ccache)
|
||||
if(CCACHE_PROGRAM)
|
||||
# Support Unix Makefiles and Ninja
|
||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
|
||||
# PCH-aware caching, matching .ci/compile.sh: without this ccache refuses
|
||||
# to cache any TU that consumes a precompiled header, so every PCH-backed
|
||||
# target recompiles from scratch on each build.
|
||||
execute_process(COMMAND ${CCACHE_PROGRAM} --set-config sloppiness=pch_defines,time_macros)
|
||||
message(STATUS "Found CCache ${CCACHE_PROGRAM}")
|
||||
endif()
|
||||
elseif(USE_CCACHE AND WIN32)
|
||||
# An explicit opt-in must not disappear silently on Windows.
|
||||
message(STATUS "ccache disabled: not supported for the MSVC toolchain on Windows")
|
||||
endif()
|
||||
|
||||
if(WIN32 OR USE_VCPKG)
|
||||
|
|
@ -75,11 +90,11 @@ endif()
|
|||
|
||||
# A project name is needed for CPack
|
||||
# Version can be overriden by git tags, see cmake/getversion.cmake
|
||||
project("Cockatrice" VERSION 3.1.0)
|
||||
project("Cockatrice" VERSION 3.1.1)
|
||||
|
||||
# Set release name if not provided via env/cmake var
|
||||
if(NOT DEFINED GIT_TAG_RELEASENAME)
|
||||
set(GIT_TAG_RELEASENAME "Graduation Day")
|
||||
set(GIT_TAG_RELEASENAME "Reality Check")
|
||||
endif()
|
||||
|
||||
# Use c++20 for all targets
|
||||
|
|
@ -184,6 +199,9 @@ elseif(CMAKE_COMPILER_IS_GNUCXX)
|
|||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${FLAG}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Reduce compiler I/O by using pipes between stages instead of temp files
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pipe")
|
||||
else()
|
||||
# other: osx/llvm, bsd/llvm
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O2")
|
||||
|
|
@ -192,8 +210,17 @@ else()
|
|||
else()
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall -Wextra")
|
||||
endif()
|
||||
|
||||
# Reduce compiler I/O by using pipes between stages instead of temp files
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pipe")
|
||||
endif()
|
||||
|
||||
# Always included, because they define cockatrice_disable_sanitizers_for() and
|
||||
# cockatrice_disable_coverage_for() for the vendored trees. They only touch the global flags
|
||||
# when ENABLE_SANITIZERS or ENABLE_COVERAGE is on.
|
||||
include(Sanitizers)
|
||||
include(Coverage)
|
||||
|
||||
# GNU systems need to define the Mersenne exponent for the RNG to compile w/o warning
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
||||
add_definitions("-DSFMT_MEXP=19937")
|
||||
|
|
@ -239,11 +266,6 @@ if(WIN32)
|
|||
find_package(OpenSSL REQUIRED)
|
||||
if(OPENSSL_FOUND)
|
||||
include_directories(${OPENSSL_INCLUDE_DIRS})
|
||||
else()
|
||||
message(
|
||||
WARNING
|
||||
"Could not find OpenSSL runtime libraries. They are not required for compiling, but needs to be available at runtime."
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
@ -281,7 +303,7 @@ if(UNIX)
|
|||
if(CPACK_GENERATOR STREQUAL "RPM")
|
||||
set(CPACK_RPM_PACKAGE_LICENSE "GPLv2")
|
||||
set(CPACK_RPM_MAIN_COMPONENT "cockatrice")
|
||||
set(CPACK_RPM_PACKAGE_REQUIRES "protobuf, qt6-qttools, qt6-qtsvg, qt6-qtmultimedia, qt6-qtimageformats")
|
||||
set(CPACK_RPM_PACKAGE_REQUIRES "protobuf, qt6-qtimageformats, qt6-qtmultimedia, qt6-qtsvg, qt6-qttools")
|
||||
set(CPACK_RPM_PACKAGE_GROUP "Amusements/Games")
|
||||
set(CPACK_RPM_PACKAGE_URL "http://github.com/Cockatrice/Cockatrice")
|
||||
# stop directories from making package conflicts
|
||||
|
|
@ -299,7 +321,7 @@ if(UNIX)
|
|||
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
|
||||
set(CPACK_DEBIAN_PACKAGE_SECTION "games")
|
||||
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "http://github.com/Cockatrice/Cockatrice")
|
||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt6multimedia6, libqt6svg6, qt6-qpa-plugins, qt6-image-formats-plugins")
|
||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt6multimedia6, libqt6svg6, qt6-image-formats-plugins, qt6-qpa-plugins")
|
||||
set(CPACK_DEBIAN_PACKAGE_RECOMMENDS "libqt6sql6-mysql") # for connecting servatrice to a mysql db
|
||||
endif()
|
||||
endif()
|
||||
|
|
@ -314,6 +336,55 @@ elseif(WIN32)
|
|||
# Configure file with custom definitions for NSIS.
|
||||
configure_file("${COCKATRICE_CMAKE_PATH}/NSIS.definitions.nsh.in" "${PROJECT_BINARY_DIR}/NSIS.definitions.nsh")
|
||||
|
||||
# Every runtime DLL a Windows install has to contain, as paths relative to the
|
||||
# install root. .ci/compile.sh reads this and fails the build when the packaged
|
||||
# installer is missing one of them, or carries a runtime it does not know about.
|
||||
#
|
||||
# All three applications are packaged into the same directory on Windows, so
|
||||
# this is the union of their Qt module lists, not just the client's: Servatrice
|
||||
# contributes Qt6Sql.dll and Oracle contributes nothing the client lacks, and a
|
||||
# client-only manifest leaves Qt6Sql.dll unasserted even though servatrice.exe
|
||||
# is installed next to cockatrice.exe and cannot start without it.
|
||||
#
|
||||
# A statically linked Qt module ships no runtime DLL, so requiring one would
|
||||
# fail the package check on a static build for no reason. cockatrice/CMakeLists.txt
|
||||
# installs the runtime of every module listed here, and skips static ones the
|
||||
# same way, so the two can never disagree.
|
||||
#
|
||||
# Only the Qt modules, and that is deliberate. protobuf, Abseil, liblzma, zlib
|
||||
# and OpenSSL also ride in on the "*.dll" glob, and a client whose runtime is
|
||||
# absent, stale or of the wrong architecture fails to start with "abseil_dll.dll
|
||||
# is either not designed to run on Windows or it contains an error", so they
|
||||
# are exactly the files worth asserting.
|
||||
#
|
||||
# Their names cannot be derived from the vcpkg bin directory, which is what a
|
||||
# first attempt did and what a Windows build immediately refuted: bin holds
|
||||
# everything vcpkg installed, not everything the applications import. It also
|
||||
# contains gmock.dll, libprotobuf-lite.dll, libprotoc.dll, legacy.dll and three
|
||||
# pthreadVC*.dll FindThreads probes, none of which any shipped executable
|
||||
# links, so requiring them failed a build over a package that was correct.
|
||||
#
|
||||
# Deriving them from the executables' own import tables is the real answer,
|
||||
# and fixup_bundle already walks it to decide what to copy. Until that result
|
||||
# is available to CMake, requiring the vcpkg half would mean guessing names
|
||||
# again, which is what produced this bug report in the first place. So assert
|
||||
# what is derived from the build's own link lists and leave the rest to the
|
||||
# purge in cmake/NSIS.template.in, which removes every DLL regardless of name.
|
||||
set(_required_runtime "")
|
||||
foreach(_qt_module IN LISTS COCKATRICE_QT_MODULES SERVATRICE_QT_MODULES ORACLE_QT_MODULES)
|
||||
get_target_property(_qt_module_type ${_qt_module} TYPE)
|
||||
if(_qt_module_type STREQUAL "SHARED_LIBRARY")
|
||||
string(REGEX REPLACE "^Qt6::" "" _qt_component "${_qt_module}")
|
||||
list(APPEND _required_runtime "Qt6${_qt_component}.dll")
|
||||
endif()
|
||||
endforeach()
|
||||
list(APPEND _required_runtime "Plugins/platforms/qwindows.dll")
|
||||
|
||||
list(REMOVE_DUPLICATES _required_runtime)
|
||||
list(SORT _required_runtime)
|
||||
string(REPLACE ";" "\n" _required_runtime "${_required_runtime}")
|
||||
file(WRITE "${PROJECT_BINARY_DIR}/required-runtime.txt" "${_required_runtime}\n")
|
||||
|
||||
# include vcredist into the package; NSIS will take care of running it
|
||||
if(VCREDISTRUNTIME_FOUND)
|
||||
install(FILES "${VCREDISTRUNTIME_FILE}" DESTINATION ./)
|
||||
|
|
|
|||
54
Dockerfile
|
|
@ -3,35 +3,47 @@ FROM ubuntu:26.04 AS build
|
|||
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
cmake \
|
||||
file \
|
||||
g++ \
|
||||
git \
|
||||
libmariadb-dev-compat \
|
||||
libprotobuf-dev \
|
||||
libqt6sql6-mysql \
|
||||
qt6-websockets-dev \
|
||||
protobuf-compiler \
|
||||
qt6-tools-dev \
|
||||
qt6-tools-dev-tools
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
cmake \
|
||||
ninja-build \
|
||||
file \
|
||||
g++ \
|
||||
git \
|
||||
libmariadb-dev-compat \
|
||||
libprotobuf-dev \
|
||||
libqt6sql6-mysql \
|
||||
libssl-dev \
|
||||
qt6-websockets-dev \
|
||||
protobuf-compiler \
|
||||
qt6-tools-dev \
|
||||
qt6-tools-dev-tools
|
||||
|
||||
WORKDIR /src
|
||||
COPY . .
|
||||
RUN mkdir build && cd build && \
|
||||
cmake .. -DWITH_SERVER=1 -DWITH_CLIENT=0 -DWITH_ORACLE=0 && \
|
||||
make -j$(nproc) && \
|
||||
make install
|
||||
RUN cmake \
|
||||
-S . \
|
||||
-B build \
|
||||
-G Ninja \
|
||||
-DWITH_CLIENT=0 \
|
||||
-DWITH_ORACLE=0 \
|
||||
-DWITH_SERVER=1 \
|
||||
&& cmake --build build \
|
||||
&& cmake --install build
|
||||
|
||||
|
||||
# -------- Runtime Stage (clean) --------
|
||||
FROM ubuntu:26.04
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
libprotobuf32t64 \
|
||||
libqt6sql6-mysql \
|
||||
libqt6websockets6 \
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
libprotobuf32t64 \
|
||||
libqt6sql6-mysql \
|
||||
libqt6websockets6 \
|
||||
libssl3 \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
|
|
|
|||
113
Doxyfile
|
|
@ -1,4 +1,4 @@
|
|||
# Doxyfile 1.16.1
|
||||
# Doxyfile 1.18.0
|
||||
|
||||
# This file describes the settings to be used by the documentation system
|
||||
# Doxygen (www.doxygen.org) for a project.
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
# TAG = value [value, ...]
|
||||
# For lists, items can also be appended using:
|
||||
# TAG += value [value, ...]
|
||||
# Values that contain spaces should be placed between quotes (\" \").
|
||||
# Values that contain spaces should be placed between quotes (" ").
|
||||
#
|
||||
# Note:
|
||||
#
|
||||
|
|
@ -81,7 +81,7 @@ OUTPUT_DIRECTORY = docs
|
|||
# and will distribute the generated files over these directories. Enabling this
|
||||
# option can be useful when feeding Doxygen a huge amount of source files, where
|
||||
# putting all generated files in the same directory would otherwise cause
|
||||
# performance problems for the file system. Adapt CREATE_SUBDIRS_LEVEL to
|
||||
# performance problems for the file system. Adjust CREATE_SUBDIRS_LEVEL to
|
||||
# control the number of sub-directories.
|
||||
# The default value is: NO.
|
||||
|
||||
|
|
@ -802,7 +802,7 @@ 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
|
||||
# The setting NO will disable the traceability 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
|
||||
|
|
@ -855,8 +855,8 @@ SHOW_NAMESPACES = YES
|
|||
# The FILE_VERSION_FILTER tag can be used to specify a program or script that
|
||||
# Doxygen should invoke to get the current version for each file (typically from
|
||||
# the version control system). Doxygen will invoke the program by executing (via
|
||||
# popen()) the command command input-file, where command is the value of the
|
||||
# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided
|
||||
# popen()) the command command input_file, where command is the value of the
|
||||
# FILE_VERSION_FILTER tag, and input_file is the name of an input file provided
|
||||
# by Doxygen. Whatever the program writes to standard output is used as the file
|
||||
# version. For an example see the documentation.
|
||||
|
||||
|
|
@ -1066,25 +1066,11 @@ INPUT_FILE_ENCODING =
|
|||
# provided as Doxygen C comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08,
|
||||
# *.f18, *.f, *.for, *.vhd, *.vhdl, *.ucf, *.qsf and *.ice.
|
||||
|
||||
FILE_PATTERNS = *.cc \
|
||||
*.cxx \
|
||||
*.cxxm \
|
||||
*.cpp \
|
||||
FILE_PATTERNS = *.cpp \
|
||||
*.cppm \
|
||||
*.ccm \
|
||||
*.c++ \
|
||||
*.c++m \
|
||||
*.ii \
|
||||
*.ixx \
|
||||
*.ipp \
|
||||
*.i++ \
|
||||
*.inl \
|
||||
*.h \
|
||||
*.hh \
|
||||
*.hxx \
|
||||
*.hpp \
|
||||
*.h++ \
|
||||
*.markdown \
|
||||
*.md \
|
||||
*.dox \
|
||||
*.proto
|
||||
|
|
@ -1643,8 +1629,8 @@ DOCSET_PUBLISHER_NAME = Publisher
|
|||
# a.o. the download links, offline (the HTML help workshop was already many
|
||||
# years in maintenance mode). You can download the HTML help workshop from the
|
||||
# web archives at Installation executable (see:
|
||||
# http://web.archive.org/web/20160201063255/http://download.microsoft.com/downlo
|
||||
# ad/0/A/9/0A939EF6-E31C-430F-A3DF-DFAE7960D564/htmlhelp.exe).
|
||||
# http://web.archive.org/web/20160201063255/https://download.microsoft.com/downl
|
||||
# oad/0/A/9/0A939EF6-E31C-430F-A3DF-DFAE7960D564/htmlhelp.exe).
|
||||
#
|
||||
# The HTML Help Workshop contains a compiler that can convert all HTML output
|
||||
# generated by Doxygen into a single compiled HTML file (.chm). Compiled HTML
|
||||
|
|
@ -1951,7 +1937,7 @@ MATHJAX_FORMAT = HTML-CSS
|
|||
# output directory using the MATHJAX_RELPATH option. For Mathjax version 2 the
|
||||
# destination directory should contain the MathJax.js script. For instance, if
|
||||
# the mathjax directory is located at the same level as the HTML output
|
||||
# directory, then MATHJAX_RELPATH should be ../mathjax.s For Mathjax versions 3
|
||||
# directory, then MATHJAX_RELPATH should be ../mathjax. For Mathjax versions 3
|
||||
# and 4 the destination directory should contain the tex-<format>.js script
|
||||
# (where <format> is either chtml or svg). The default value points to the
|
||||
# MathJax Content Delivery Network so you can quickly see the result without
|
||||
|
|
@ -2172,9 +2158,8 @@ EXTRA_PACKAGES =
|
|||
#
|
||||
# Note: Only use a user-defined header if you know what you are doing!
|
||||
# Note: The header is subject to change so you typically have to regenerate the
|
||||
# default header when upgrading to a newer version of Doxygen. The following
|
||||
# commands have a special meaning inside the header (and footer): For a
|
||||
# description of the possible markers and block names see the documentation.
|
||||
# default header when upgrading to a newer version of Doxygen. For a description
|
||||
# of the possible markers and block names see the documentation.
|
||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||
|
||||
LATEX_HEADER =
|
||||
|
|
@ -2657,6 +2642,19 @@ HAVE_DOT = YES
|
|||
|
||||
DOT_NUM_THREADS = 0
|
||||
|
||||
# The DOT_BATCH_SIZE specifies the number of dot graphs Doxygen is allowed to
|
||||
# compile in a single invocation of dot. When set to 1 Doxygen will invoke dot
|
||||
# for each graph separately, which can cause significant process creation
|
||||
# overhead especially on systems with many CPU cores. Together with
|
||||
# DOT_NUM_THREADS this setting can be used to optimise the dot processing speed
|
||||
# for a particular system. Doxygen will try to give each thread a balanced batch
|
||||
# of work. If the total number of graphs to process exceeds DOT_NUM_THREADS *
|
||||
# DOT_BATCH_SIZE then additional batches will be created for dot to process.
|
||||
# Minimum value: 1, maximum value: 1000, default value: 50.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
||||
DOT_BATCH_SIZE = 50
|
||||
|
||||
# DOT_COMMON_ATTR is common attributes for nodes, edges and labels of
|
||||
# subgraphs. When you want a differently looking font in the dot files that
|
||||
# Doxygen generates you can specify fontname, fontcolor and fontsize attributes.
|
||||
|
|
@ -2948,6 +2946,58 @@ PLANTUML_INCLUDE_PATH =
|
|||
|
||||
PLANTUMLFILE_DIRS =
|
||||
|
||||
# When using Mermaid diagrams with CLI rendering, the MERMAID_PATH tag should be
|
||||
# used to specify the directory where the mmdc (Mermaid CLI) executable can be
|
||||
# found. If left blank, CLI-based rendering is disabled. For HTML output,
|
||||
# client-side rendering via JavaScript is used by default and does not require
|
||||
# mmdc. For LaTeX/PDF output, mmdc is required to pre-generate images. Doxygen
|
||||
# will generate a warning when CLI rendering is needed but mmdc is not
|
||||
# available.
|
||||
|
||||
MERMAID_PATH =
|
||||
|
||||
# When using Mermaid diagrams, the MERMAID_CONFIG_FILE tag can be used to
|
||||
# specify a JSON configuration file for the Mermaid CLI tool (mmdc). This file
|
||||
# can contain theme settings and other Mermaid configuration options.
|
||||
|
||||
MERMAID_CONFIG_FILE =
|
||||
|
||||
# The MERMAID_RENDER_MODE tag selects how Mermaid diagrams are rendered.
|
||||
# Possible values are: AUTO (use client-side rendering for HTML and mmdc for
|
||||
# LaTeX/PDF and other formats. If MERMAID_PATH is not set, non-HTML diagrams
|
||||
# will produce a warning), CLI (use the mmdc tool to pre-generate images
|
||||
# (requires Node.js and mermaid-js/mermaid-cli). Works for all output formats)
|
||||
# and CLIENT_SIDE (embed mermaid.js in HTML output for client-side rendering.
|
||||
# Does not require mmdc but only works for HTML output).
|
||||
# The default value is: AUTO.
|
||||
|
||||
MERMAID_RENDER_MODE = AUTO
|
||||
|
||||
# The MERMAID_JS_URL tag specifies the URL to load mermaid.js from when using
|
||||
# client-side rendering (MERMAID_RENDER_MODE is CLIENT_SIDE or AUTO). The
|
||||
# default points to the latest Mermaid v11 release on the jsDelivr CDN.
|
||||
#
|
||||
# The default CDN URL requires internet access when viewing the generated
|
||||
# documentation. For offline use, download mermaid.esm.min.mjs and set this to a
|
||||
# relative path, or use MERMAID_RENDER_MODE=CLI to pre-generate images instead.
|
||||
# Examples:
|
||||
# - Latest v11 (default):
|
||||
# https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs
|
||||
# - Pinned version:
|
||||
# https://cdn.jsdelivr.net/npm/mermaid@11.3.0/dist/mermaid.esm.min.mjs
|
||||
# - Local copy: ./mermaid.esm.min.mjs (user must place file in HTML output
|
||||
# directory)
|
||||
# The default value is:
|
||||
# https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs.
|
||||
|
||||
MERMAID_JS_URL = https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs
|
||||
|
||||
# The MERMAIDFILE_DIRS tag can be used to specify one or more directories that
|
||||
# contain Mermaid files that are included in the documentation (see the
|
||||
# \mermaidfile command).
|
||||
|
||||
MERMAIDFILE_DIRS =
|
||||
|
||||
# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
|
||||
# that will be shown in the graph. If the number of nodes in a graph becomes
|
||||
# larger than this value, Doxygen will truncate the graph, which is visualized
|
||||
|
|
@ -2972,15 +3022,6 @@ DOT_GRAPH_MAX_NODES = 50
|
|||
|
||||
MAX_DOT_GRAPH_DEPTH = 0
|
||||
|
||||
# Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output
|
||||
# files in one run (i.e. multiple -o and -T options on the command line). This
|
||||
# makes dot run faster, but since only newer versions of dot (>1.8.10) support
|
||||
# this, this feature is disabled by default.
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
||||
DOT_MULTI_TARGETS = NO
|
||||
|
||||
# If the GENERATE_LEGEND tag is set to YES Doxygen will generate a legend page
|
||||
# explaining the meaning of the various boxes and arrows in the dot generated
|
||||
# graphs.
|
||||
|
|
|
|||
25
README.md
|
|
@ -102,6 +102,7 @@ There are various places where useful information for different needs are mainta
|
|||
- [Official Wiki](https://github.com/Cockatrice/Cockatrice/wiki) `Community supported`
|
||||
- [Official Webpage](https://cockatrice.github.io/)
|
||||
- [Official README](https://github.com/Cockatrice/Cockatrice/blob/master/README.md) `This file`
|
||||
- [Official CONTRIBUTING](https://github.com/Cockatrice/Cockatrice/blob/master/.github/CONTRIBUTING.md)
|
||||
|
||||
Cockatrice tries to use the [Google Developer Documentation Style Guide](https://developers.google.com/style/) to ensure consistent documentation. We encourage you to improve the documentation by suggesting edits based on this guide.
|
||||
|
||||
|
|
@ -149,15 +150,21 @@ You can then
|
|||
<br>
|
||||
|
||||
The following flags (with their non-default values) can be passed to `cmake`:
|
||||
| Flag | Description |
|
||||
| --- | --- |
|
||||
| `-DWITH_SERVER=1` | Build <kbd>Servatrice</kbd> server |
|
||||
| `-DWITH_CLIENT=0` | Don't build <kbd>Cockatrice</kbd> client |
|
||||
| `-DWITH_ORACLE=0` | Don't build <kbd>Oracle</kbd> card database tool |
|
||||
| `-DCMAKE_BUILD_TYPE=Debug` | Compile in debug mode<br> Enables extra logging output, debug symbols, and much more verbose compiler warnings |
|
||||
| `-DWARNING_AS_ERROR=0` | Don't treat compilation warnings as errors in debug mode |
|
||||
| `-DUPDATE_TRANSLATIONS=1` | Configure `make` to update the translation .ts files for new strings in the source code<br> **Note:** `make clean` will remove the .ts files |
|
||||
| `-DTEST=1` | Enable regression tests<br> **Note:** `make test` to run tests, *googletest* will be downloaded if not available |
|
||||
| Flag | Description |
|
||||
| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `-DWITH_SERVER=1` | Build <kbd>Servatrice</kbd> server |
|
||||
| `-DWITH_CLIENT=0` | Don't build <kbd>Cockatrice</kbd> client |
|
||||
| `-DWITH_ORACLE=0` | Don't build <kbd>Oracle</kbd> card database tool |
|
||||
| `-DCMAKE_BUILD_TYPE=Debug` | Compile in debug mode<br> Enables extra logging output, debug symbols, and much more verbose compiler warnings |
|
||||
| `-DWARNING_AS_ERROR=0` | Don't treat compilation warnings as errors in debug mode |
|
||||
| `-DUPDATE_TRANSLATIONS=1` | Configure `make` to update the translation .ts files for new strings in the source code<br> **Note:** `make clean` will remove the .ts files |
|
||||
| `-DTEST=1` | Enable regression tests<br> **Note:** `make test` to run tests, *googletest* will be downloaded if not available |
|
||||
|
||||
> [!TIP]
|
||||
> Build code documentation ([Doxygen](https://www.doxygen.nl)) according to our [configuration](https://github.com/Cockatrice/Cockatrice/blob/master/Doxyfile) into `/docs`:
|
||||
> ```bash
|
||||
> doxygen Doxyfile
|
||||
> ```
|
||||
|
||||
|
||||
# Run
|
||||
|
|
|
|||
75
cmake/Coverage.cmake
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
# Line-coverage instrumentation opt-in, plus per-source opt-out
|
||||
# Input: ENABLE_COVERAGE
|
||||
# Defines: cockatrice_disable_coverage_for
|
||||
#
|
||||
# Included once from the root CMakeLists.txt, immediately after the per-compiler flag
|
||||
# block, so add_compile_options() reaches every library and executable defined below.
|
||||
#
|
||||
# Note the name deliberately shadows CMake's own built-in Modules/Coverage.cmake. It resolves
|
||||
# to this file only because the root CMakeLists.txt puts cmake/ at the front of
|
||||
# CMAKE_MODULE_PATH; if that ever moves, include(Coverage) would silently pick up the built-in
|
||||
# module, which only defines a `COVERAGE` custom target and touches no global flags, so
|
||||
# instrumentation would quietly stop happening rather than erroring.
|
||||
|
||||
include(CheckCXXSourceCompiles)
|
||||
|
||||
# Opt a set of vendored sources out of instrumentation.
|
||||
#
|
||||
# cockatrice_disable_coverage_for(<source> ...)
|
||||
#
|
||||
# Third-party code drags the total down with lines no test can ever reach, and a total that
|
||||
# cannot move is not a useful signal. This is the same carve-out the sanitizer build uses.
|
||||
#
|
||||
# The sources must be named relative to the directory that compiles them. CMake resolves a
|
||||
# source-file property against the directory scope the target was declared in, so calling
|
||||
# this from the root with absolute paths silently does nothing. That is why the call sites
|
||||
# live next to the add_library/add_executable that pull the vendored code in.
|
||||
#
|
||||
# SKIP_PRECOMPILE_HEADERS mirrors the sanitizer helper. The precompiled header carries the
|
||||
# instrumentation flags, and mixing an instrumented PCH with an uninstrumented translation
|
||||
# unit makes GCC reject it.
|
||||
function(cockatrice_disable_coverage_for)
|
||||
if(NOT ENABLE_COVERAGE)
|
||||
return()
|
||||
endif()
|
||||
# There is no -fno-coverage: --coverage is shorthand for -fprofile-arcs -ftest-coverage, so both
|
||||
# halves have to be negated. CC rejects "-fno-coverage" outright, which is how the vendored C
|
||||
# files below hit it first.
|
||||
set_source_files_properties(
|
||||
${ARGN} PROPERTIES COMPILE_OPTIONS "-fno-profile-arcs;-fno-test-coverage" SKIP_PRECOMPILE_HEADERS ON
|
||||
)
|
||||
endfunction()
|
||||
|
||||
if(ENABLE_COVERAGE)
|
||||
# Line coverage needs the compiler's own toolchain, so only GCC is supported. Clang's
|
||||
# equivalent is llvm-cov, which reads a different intermediate format and would need a
|
||||
# separate report path; rejecting it is better than emitting .gcno files that gcovr cannot
|
||||
# read.
|
||||
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
message(FATAL_ERROR "ENABLE_COVERAGE requires GCC, but the compiler is ${CMAKE_CXX_COMPILER_ID}. "
|
||||
"Clang coverage needs llvm-cov and is not wired up."
|
||||
)
|
||||
endif()
|
||||
|
||||
# Probe the way the flag will actually be used: compile AND link. A .gcno file comes from the
|
||||
# compile step, but the runtime that writes .gcda files comes from the link step, so probing
|
||||
# only the compile step would pass on a toolchain that cannot actually produce coverage.
|
||||
set(_cockatrice_saved_required_flags "${CMAKE_REQUIRED_FLAGS}")
|
||||
set(_cockatrice_saved_required_link_options "${CMAKE_REQUIRED_LINK_OPTIONS}")
|
||||
set(CMAKE_REQUIRED_FLAGS "-O0 -g")
|
||||
set(CMAKE_REQUIRED_LINK_OPTIONS -fprofile-arcs -ftest-coverage)
|
||||
check_cxx_source_compiles("int main() { return 0; }" COCKATRICE_HAVE_COVERAGE_FLAGS)
|
||||
set(CMAKE_REQUIRED_FLAGS "${_cockatrice_saved_required_flags}")
|
||||
set(CMAKE_REQUIRED_LINK_OPTIONS "${_cockatrice_saved_required_link_options}")
|
||||
|
||||
if(NOT COCKATRICE_HAVE_COVERAGE_FLAGS)
|
||||
message(FATAL_ERROR "ENABLE_COVERAGE is on, but this toolchain rejected the coverage flags.")
|
||||
endif()
|
||||
|
||||
# -O0 keeps the line mapping honest: at higher optimisation levels the compiler merges and
|
||||
# relocates lines, and the report describes code that no longer exists in that form.
|
||||
add_compile_options(--coverage -O0 -g)
|
||||
add_link_options(--coverage)
|
||||
|
||||
message(STATUS "Coverage instrumentation enabled (--coverage). Report with gcovr over the build dir.")
|
||||
endif()
|
||||
|
|
@ -7,6 +7,12 @@
|
|||
# Output: ORACLE_QT_MODULES
|
||||
# Output: TEST_QT_MODULES
|
||||
|
||||
# Every Qt module an application links against, as the DLL names a Windows
|
||||
# install has to contain. Core is listed explicitly rather than left to arrive
|
||||
# transitively: it is the one module nothing can do without, and required-runtime.txt
|
||||
# is built from these lists, so a module missing here is a runtime the package
|
||||
# check never asserts. That is how Qt6Core.dll went unasserted while every other
|
||||
# Qt module was checked.
|
||||
set(REQUIRED_QT_COMPONENTS Core)
|
||||
if(WITH_SERVER)
|
||||
set(_SERVATRICE_NEEDED Network Sql WebSockets)
|
||||
|
|
@ -14,23 +20,29 @@ endif()
|
|||
if(WITH_CLIENT)
|
||||
set(_COCKATRICE_NEEDED
|
||||
Concurrent
|
||||
Core
|
||||
Gui
|
||||
Multimedia
|
||||
Network
|
||||
PrintSupport
|
||||
ShaderTools
|
||||
Svg
|
||||
WebSockets
|
||||
Widgets
|
||||
Xml
|
||||
Quick
|
||||
QuickWidgets
|
||||
)
|
||||
endif()
|
||||
if(WITH_ORACLE)
|
||||
set(_ORACLE_NEEDED Concurrent Network Svg Widgets)
|
||||
set(_ORACLE_NEEDED Concurrent Network Svg Widgets Xml)
|
||||
endif()
|
||||
if(TEST)
|
||||
# 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)
|
||||
# Test is QtTest: it brings QAbstractItemModelTester and QSignalSpy, which are how the Qt model
|
||||
# and signal contracts get verified without standing up a GUI.
|
||||
set(_TEST_NEEDED Concurrent Network Svg Widgets Test)
|
||||
endif()
|
||||
|
||||
set(REQUIRED_QT_COMPONENTS ${REQUIRED_QT_COMPONENTS} ${_SERVATRICE_NEEDED} ${_COCKATRICE_NEEDED} ${_ORACLE_NEEDED}
|
||||
|
|
|
|||
109
cmake/Sanitizers.cmake
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
# AddressSanitizer + UndefinedBehaviorSanitizer opt-in, plus per-source opt-out
|
||||
# Input: ENABLE_SANITIZERS
|
||||
# Defines: cockatrice_disable_sanitizers_for
|
||||
#
|
||||
# Included once from the root CMakeLists.txt, immediately after the per-compiler flag
|
||||
# block, so add_compile_options() reaches every library and executable defined below.
|
||||
|
||||
include(CheckCXXSourceCompiles)
|
||||
|
||||
# Opt a set of vendored sources out of instrumentation.
|
||||
#
|
||||
# cockatrice_disable_sanitizers_for(<source> ...)
|
||||
#
|
||||
# Sanitizer findings inside vendored code are not actionable for us, and letting them
|
||||
# through buries our own bugs in noise until everyone learns to skip the job.
|
||||
#
|
||||
# The sources must be named relative to the directory that compiles them. CMake resolves a
|
||||
# source-file property against the directory scope the target was declared in, so calling
|
||||
# this from the root with absolute paths silently does nothing. That is why the call sites
|
||||
# live next to the add_library/add_executable that pull the vendored code in.
|
||||
#
|
||||
# SKIP_PRECOMPILE_HEADERS is not optional. The precompiled header is built with the
|
||||
# sanitizer flags, so it defines __SANITIZE_ADDRESS__; a translation unit compiled with
|
||||
# -fno-sanitize=all does not, and GCC then refuses the PCH with
|
||||
# "not used because __SANITIZE_ADDRESS__ not defined", which is a fatal -Werror=invalid-pch
|
||||
# in the servatrice and oracle builds.
|
||||
function(cockatrice_disable_sanitizers_for)
|
||||
if(NOT ENABLE_SANITIZERS)
|
||||
return()
|
||||
endif()
|
||||
set_source_files_properties(${ARGN} PROPERTIES COMPILE_OPTIONS "-fno-sanitize=all" SKIP_PRECOMPILE_HEADERS ON)
|
||||
endfunction()
|
||||
|
||||
if(ENABLE_SANITIZERS)
|
||||
# Probe a flag the way it will actually be used: on the compile step AND the link step.
|
||||
# check_cxx_compiler_flag() only probes the compile step, which makes every sanitizer
|
||||
# flag look unsupported because linking an ASan object without -fsanitize=address leaves
|
||||
# __asan_init undefined. That is a silent misconfiguration rather than an error, so the
|
||||
# probe has to link.
|
||||
function(cockatrice_probe_flag FLAG VARNAME)
|
||||
set(CMAKE_REQUIRED_FLAGS "${FLAG}")
|
||||
set(CMAKE_REQUIRED_LINK_OPTIONS "${FLAG}")
|
||||
check_cxx_source_compiles("int main() { return 0; }" ${VARNAME})
|
||||
unset(CMAKE_REQUIRED_FLAGS)
|
||||
unset(CMAKE_REQUIRED_LINK_OPTIONS)
|
||||
endfunction()
|
||||
|
||||
set(SANITIZER_FLAGS
|
||||
-fsanitize=address,undefined
|
||||
-fno-omit-frame-pointer
|
||||
# UBSan defaults to recover mode: it prints "runtime error: ..." but the
|
||||
# process exits 0, so gtest/ctest report a pass and CI stays green.
|
||||
# -fno-sanitize-recover makes the first finding abort instead. This is
|
||||
# probed like the other cosmetic flags, but CI also sets
|
||||
# UBSAN_OPTIONS=halt_on_error=1 as the runtime-side guarantee.
|
||||
-fno-sanitize-recover=undefined
|
||||
# Qt builds QObject subclasses into raw storage and writes the vptr afterwards, which
|
||||
# the vptr check reports on essentially every QObject instantiation. The check has no
|
||||
# value for us because nothing outside moc-generated code inherits QObject, so it is
|
||||
# off outright rather than suppressed piecemeal.
|
||||
-fno-sanitize=vptr
|
||||
)
|
||||
|
||||
# MSVC has no ASan/UBSan equivalent, and clang-cl would need /fsanitize=address plus a
|
||||
# matching runtime link, which is a separate piece of work.
|
||||
if(MSVC)
|
||||
message(FATAL_ERROR "ENABLE_SANITIZERS is not supported with MSVC")
|
||||
endif()
|
||||
|
||||
# Probe rather than assume, so an older toolchain gets the sanitizers it can support
|
||||
# instead of failing the build on a flag it does not recognize.
|
||||
set(SANITIZER_SUPPORTED_FLAGS)
|
||||
foreach(FLAG ${SANITIZER_FLAGS})
|
||||
string(MAKE_C_IDENTIFIER "COCKATRICE_HAS${FLAG}" _FLAG_VAR)
|
||||
cockatrice_probe_flag("${FLAG}" ${_FLAG_VAR})
|
||||
if(${_FLAG_VAR})
|
||||
list(APPEND SANITIZER_SUPPORTED_FLAGS ${FLAG})
|
||||
else()
|
||||
message(STATUS "Sanitizers: ${FLAG} unsupported by ${CMAKE_CXX_COMPILER_ID}, skipping")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# The whole point of the option is the sanitizers, so an unsupported pair is fatal even
|
||||
# though the cosmetic flags above are allowed to degrade.
|
||||
if(NOT "-fsanitize=address,undefined" IN_LIST SANITIZER_SUPPORTED_FLAGS)
|
||||
message(FATAL_ERROR "ENABLE_SANITIZERS requires -fsanitize=address,undefined, which "
|
||||
"${CMAKE_CXX_COMPILER_ID} does not accept"
|
||||
)
|
||||
endif()
|
||||
|
||||
add_compile_options(${SANITIZER_SUPPORTED_FLAGS})
|
||||
add_link_options(-fsanitize=address,undefined)
|
||||
|
||||
# Recorded so the test tree can label its entries and a plain `make` at the same time
|
||||
# cannot quietly disagree with what CI ran.
|
||||
set(COCKATRICE_SANITIZERS
|
||||
ON
|
||||
CACHE INTERNAL "AddressSanitizer and UBSan are enabled"
|
||||
)
|
||||
else()
|
||||
# ENABLE_SANITIZERS is OFF, but COCKATRICE_SANITIZERS is CACHE INTERNAL, so a
|
||||
# reused build dir (e.g. CI's release-package step reconfiguring the same dir
|
||||
# after the sanitized debug step) would otherwise keep skipping NO_SANITIZE
|
||||
# tests and keep the 300s discovery timeout. Reset it explicitly.
|
||||
set(COCKATRICE_SANITIZERS
|
||||
OFF
|
||||
CACHE INTERNAL "AddressSanitizer and UBSan are enabled" FORCE
|
||||
)
|
||||
endif()
|
||||
55
cmake/pch/qtcore_pch.h
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
/** @file qtcore_pch.h
|
||||
* @brief Precompiled header for all Qt targets (Qt Core only).
|
||||
*
|
||||
* Safe for every target that links Qt Core, including the headless
|
||||
* Servatrice binary. Keep this header free of any widget/gui types.
|
||||
*
|
||||
* Candidates are chosen from IWYU include statistics: a header earns a
|
||||
* spot when it is not already reachable from the rest of this list and
|
||||
* enough translation units re-parse it. Qt headers are stable across
|
||||
* builds, so the precompiled header rarely invalidates.
|
||||
*/
|
||||
|
||||
#include <QBasicTimer>
|
||||
#include <QByteArray>
|
||||
#include <QCommandLineParser>
|
||||
#include <QCoreApplication>
|
||||
#include <QCryptographicHash>
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QElapsedTimer>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QHash>
|
||||
#include <QItemSelectionModel>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonValue>
|
||||
#include <QList>
|
||||
#include <QLoggingCategory>
|
||||
#include <QMap>
|
||||
#include <QMetaEnum>
|
||||
#include <QMetaObject>
|
||||
#include <QMutex>
|
||||
#include <QMutexLocker>
|
||||
#include <QObject>
|
||||
#include <QPointer>
|
||||
#include <QPropertyAnimation>
|
||||
#include <QRandomGenerator>
|
||||
#include <QReadWriteLock>
|
||||
#include <QRegularExpression>
|
||||
#include <QSet>
|
||||
#include <QSettings>
|
||||
#include <QSharedPointer>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QTemporaryDir>
|
||||
#include <QThread>
|
||||
#include <QTimer>
|
||||
#include <QUuid>
|
||||
#include <QVariant>
|
||||
#include <QXmlStreamReader>
|
||||
#include <QXmlStreamWriter>
|
||||
59
cmake/pch/qtwidgets_pch.h
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
/** @file qtwidgets_pch.h
|
||||
* @brief Precompiled header for GUI targets (Cockatrice client, Oracle).
|
||||
*
|
||||
* Includes the Qt Core precompiled header plus the heavy Gui, Widgets and
|
||||
* Network layers that virtually every client translation unit re-parses.
|
||||
* Do not use on Servatrice (headless, QT_DONT_USE_QTGUI).
|
||||
*
|
||||
* Candidates are chosen from IWYU include statistics: a header earns a
|
||||
* spot when it is not already reachable from the rest of this list and
|
||||
* enough translation units re-parse it. Qt headers are stable across
|
||||
* builds, so the precompiled header rarely invalidates.
|
||||
*/
|
||||
|
||||
#include "qtcore_pch.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QApplication>
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
#include <QCompleter>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QDockWidget>
|
||||
#include <QFileDialog>
|
||||
#include <QFormLayout>
|
||||
#include <QFrame>
|
||||
#include <QGraphicsItem>
|
||||
#include <QGraphicsScene>
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
#include <QGraphicsView>
|
||||
#include <QGridLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QHBoxLayout>
|
||||
#include <QHeaderView>
|
||||
#include <QImage>
|
||||
#include <QImageReader>
|
||||
#include <QInputDialog>
|
||||
#include <QLabel>
|
||||
#include <QLayout>
|
||||
#include <QListWidget>
|
||||
#include <QMainWindow>
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#include <QPainter>
|
||||
#include <QPlainTextEdit>
|
||||
#include <QPushButton>
|
||||
#include <QScrollArea>
|
||||
#include <QSpinBox>
|
||||
#include <QSplitter>
|
||||
#include <QStandardItemModel>
|
||||
#include <QTabWidget>
|
||||
#include <QTableWidget>
|
||||
#include <QTableWidgetItem>
|
||||
#include <QToolBar>
|
||||
#include <QToolButton>
|
||||
#include <QTreeWidget>
|
||||
#include <QVBoxLayout>
|
||||
#include <QWidget>
|
||||
|
|
@ -15,6 +15,9 @@ set(cockatrice_SOURCES
|
|||
src/client/network/update/client/client_update_checker.cpp
|
||||
src/client/network/update/client/release_channel.cpp
|
||||
src/client/network/update/card_spoiler/spoiler_background_updater.cpp
|
||||
src/client/latency_graph_widget.cpp
|
||||
src/client/latency_status_widget.cpp
|
||||
src/client/lag_monitor.cpp
|
||||
src/client/sound_engine.cpp
|
||||
src/client/settings/cache_settings.cpp
|
||||
src/client/settings/card_counter_settings.cpp
|
||||
|
|
@ -36,14 +39,20 @@ set(cockatrice_SOURCES
|
|||
src/interface/widgets/dialogs/dlg_forgot_password_challenge.cpp
|
||||
src/interface/widgets/dialogs/dlg_forgot_password_request.cpp
|
||||
src/interface/widgets/dialogs/dlg_forgot_password_reset.cpp
|
||||
src/interface/widgets/dialogs/dlg_invite_to_game.cpp
|
||||
src/interface/widgets/dialogs/dlg_load_deck.cpp
|
||||
src/interface/widgets/dialogs/dlg_load_deck_from_clipboard.cpp
|
||||
src/interface/widgets/dialogs/dlg_load_deck_from_website.cpp
|
||||
src/interface/widgets/dialogs/dlg_load_remote_deck.cpp
|
||||
src/interface/widgets/dialogs/dlg_local_game_options.cpp
|
||||
src/interface/widgets/dialogs/dlg_login_prompt.cpp
|
||||
src/interface/widgets/dialogs/dlg_manage_sets.cpp
|
||||
src/interface/widgets/dialogs/dlg_my_reports.cpp
|
||||
src/interface/widgets/dialogs/dlg_register.cpp
|
||||
src/interface/widgets/dialogs/dlg_report_user.cpp
|
||||
src/interface/widgets/dialogs/dlg_select_set_for_cards.cpp
|
||||
src/interface/widgets/dialogs/dlg_share_deck.cpp
|
||||
src/interface/widgets/dialogs/dlg_shared_decks_preview.cpp
|
||||
src/interface/widgets/dialogs/dlg_settings.cpp
|
||||
src/interface/widgets/dialogs/dlg_startup_card_check.cpp
|
||||
src/interface/widgets/dialogs/dlg_tip_of_the_day.cpp
|
||||
|
|
@ -51,6 +60,9 @@ set(cockatrice_SOURCES
|
|||
src/interface/widgets/dialogs/dlg_view_log.cpp
|
||||
src/interface/widgets/dialogs/override_printing_warning.cpp
|
||||
src/interface/widgets/dialogs/tip_of_the_day.cpp
|
||||
src/interface/widgets/deck_share/deck_share_utils.cpp
|
||||
src/interface/widgets/deck_share/shared_deck_preview_widget.cpp
|
||||
src/interface/widgets/deck_share/share_bar_widget.cpp
|
||||
src/filters/deck_filter_string.cpp
|
||||
src/filters/filter_builder.cpp
|
||||
src/filters/filter_tree_model.cpp
|
||||
|
|
@ -128,6 +140,10 @@ set(cockatrice_SOURCES
|
|||
src/game_graphics/zones/view_zone.cpp
|
||||
src/game_graphics/zones/view_zone_widget.cpp
|
||||
src/game_graphics/board/abstract_graphics_item.cpp
|
||||
src/interface/card_database_update/card_database_update_status_bar.cpp
|
||||
src/interface/card_database_update/card_database_update_status_bar.h
|
||||
src/interface/card_database_update/card_update_progress.cpp
|
||||
src/interface/card_database_update/card_update_progress.h
|
||||
src/interface/card_picture_loader/card_picture_loader.cpp
|
||||
src/interface/card_picture_loader/card_picture_loader_local.cpp
|
||||
src/interface/card_picture_loader/card_picture_loader_request_status_display_widget.cpp
|
||||
|
|
@ -143,7 +159,11 @@ set(cockatrice_SOURCES
|
|||
src/interface/intents/intent_wait_for_database_load.h
|
||||
src/interface/layouts/flow_layout.cpp
|
||||
src/interface/layouts/overlap_layout.cpp
|
||||
src/interface/widgets/utility/card_completer_delegate.cpp
|
||||
src/interface/widgets/utility/card_completer_styler.cpp
|
||||
src/interface/widgets/utility/completer_utils.cpp
|
||||
src/interface/widgets/utility/line_edit_completer.cpp
|
||||
src/interface/widgets/utility/reversed_completer_model.cpp
|
||||
src/interface/pixel_map_generator.cpp
|
||||
src/interface/theme_config.cpp
|
||||
src/interface/theme_manager.cpp
|
||||
|
|
@ -153,8 +173,11 @@ set(cockatrice_SOURCES
|
|||
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/deck_color_identity.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/art_crop_attribution.cpp
|
||||
src/interface/widgets/cards/card_art_utils.cpp
|
||||
src/interface/widgets/cards/card_group_display_widgets/card_group_display_widget.cpp
|
||||
src/interface/widgets/cards/card_group_display_widgets/flat_card_group_display_widget.cpp
|
||||
src/interface/widgets/cards/card_group_display_widgets/overlapped_card_group_display_widget.cpp
|
||||
|
|
@ -203,6 +226,7 @@ set(cockatrice_SOURCES
|
|||
src/interface/widgets/deck_editor/deck_editor_printing_selector_dock_widget.cpp
|
||||
src/interface/widgets/deck_editor/deck_list_style_proxy.cpp
|
||||
src/interface/widgets/deck_editor/deck_state_manager.cpp
|
||||
src/interface/widgets/deck_editor/deck_zone_dialog.cpp
|
||||
src/interface/widgets/deck_editor/printing_disabled_info_widget.cpp
|
||||
src/interface/widgets/general/background_sources.cpp
|
||||
src/interface/widgets/general/display/background_plate_widget.cpp
|
||||
|
|
@ -219,6 +243,7 @@ set(cockatrice_SOURCES
|
|||
src/interface/widgets/general/display/charts/bars/segmented_bar_widget.cpp
|
||||
src/interface/widgets/general/display/charts/pies/color_pie.cpp
|
||||
src/interface/widgets/general/home_styled_button.cpp
|
||||
src/interface/widgets/general/home_tab_button_color.h
|
||||
src/interface/widgets/general/home_widget.cpp
|
||||
src/interface/widgets/general/layout_containers/flow_widget.cpp
|
||||
src/interface/widgets/general/layout_containers/overlap_control_widget.cpp
|
||||
|
|
@ -237,6 +262,10 @@ set(cockatrice_SOURCES
|
|||
src/interface/widgets/printing_selector/printing_selector_card_selection_widget.cpp
|
||||
src/interface/widgets/printing_selector/printing_selector_card_sorting_widget.cpp
|
||||
src/interface/widgets/printing_selector/set_name_and_collectors_number_display_widget.cpp
|
||||
src/interface/widgets/playmat/playmat_collection_dialog.cpp
|
||||
src/interface/widgets/playmat/playmat_collection_dialog.h
|
||||
src/interface/widgets/playmat/playmat_preview_widget.cpp
|
||||
src/interface/widgets/playmat/playmat_settings_dialog.cpp
|
||||
src/interface/widgets/quick_settings/settings_button_widget.cpp
|
||||
src/interface/widgets/quick_settings/settings_popup_widget.cpp
|
||||
src/interface/widgets/replay/replay_manager.cpp
|
||||
|
|
@ -245,6 +274,7 @@ set(cockatrice_SOURCES
|
|||
src/interface/widgets/replay/replay_widget.cpp
|
||||
src/interface/widgets/server/chat_view/chat_view.cpp
|
||||
src/interface/widgets/server/game_filter_configs.cpp
|
||||
src/interface/widgets/server/game_link.cpp
|
||||
src/interface/widgets/server/game_selector.cpp
|
||||
src/interface/widgets/server/game_selector_quick_filter_toolbar.cpp
|
||||
src/interface/widgets/server/games_model.cpp
|
||||
|
|
@ -257,8 +287,10 @@ set(cockatrice_SOURCES
|
|||
src/interface/widgets/server/user/user_context_menu.cpp
|
||||
src/interface/widgets/server/user/user_info_box.cpp
|
||||
src/interface/widgets/server/user/user_info_connection.cpp
|
||||
src/interface/widgets/server/user/user_list_dialog.cpp
|
||||
src/interface/widgets/server/user/user_list_manager.cpp
|
||||
src/interface/widgets/server/user/user_list_painter.cpp
|
||||
src/interface/widgets/server/user/user_list_panel_widget.cpp
|
||||
src/interface/widgets/server/user/user_list_widget.cpp
|
||||
src/interface/widgets/settings_page/abstract_settings_page.cpp
|
||||
src/interface/widgets/settings_page/appearance_settings_page.cpp
|
||||
|
|
@ -273,6 +305,8 @@ set(cockatrice_SOURCES
|
|||
src/interface/widgets/settings_page/user_interface_settings_page.cpp
|
||||
src/interface/widgets/utility/custom_line_edit.cpp
|
||||
src/interface/widgets/utility/get_text_with_max.cpp
|
||||
src/interface/widgets/utility/report_utils.cpp
|
||||
src/interface/widgets/utility/report_utils.h
|
||||
src/interface/widgets/utility/sequence_edit.cpp
|
||||
src/interface/widgets/utility/visibility_change_listener.cpp
|
||||
src/interface/widgets/utility/visibility_change_listener.h
|
||||
|
|
@ -297,9 +331,13 @@ set(cockatrice_SOURCES
|
|||
src/interface/widgets/visual_deck_storage/deck_preview/deck_preview_tag_display_widget.cpp
|
||||
src/interface/widgets/visual_deck_storage/deck_preview/deck_preview_tag_item_widget.cpp
|
||||
src/interface/widgets/visual_deck_storage/deck_preview/deck_preview_widget.cpp
|
||||
src/interface/widgets/visual_deck_storage/deck_preview/public_deck_preview_widget.cpp
|
||||
src/interface/widgets/visual_deck_storage/remote_public_decks_model.cpp
|
||||
src/interface/widgets/visual_deck_storage/visual_deck_storage_folder_display_widget.cpp
|
||||
src/interface/widgets/visual_deck_storage/visual_deck_storage_model.cpp
|
||||
src/interface/widgets/visual_deck_storage/visual_deck_storage_quick_settings_widget.cpp
|
||||
src/interface/widgets/visual_deck_storage/visual_deck_storage_search_widget.cpp
|
||||
src/interface/widgets/visual_deck_storage/visual_deck_storage_sort_filter_proxy_model.cpp
|
||||
src/interface/widgets/visual_deck_storage/visual_deck_storage_sort_widget.cpp
|
||||
src/interface/widgets/visual_deck_storage/visual_deck_storage_tag_filter_widget.cpp
|
||||
src/interface/widgets/visual_deck_storage/visual_deck_storage_widget.cpp
|
||||
|
|
@ -360,10 +398,14 @@ set(cockatrice_SOURCES
|
|||
src/interface/widgets/tabs/tab_card_art_rules.cpp
|
||||
src/interface/widgets/tabs/tab_deck_editor.cpp
|
||||
src/interface/widgets/tabs/tab_deck_storage.cpp
|
||||
src/interface/widgets/tabs/tab_developer.cpp
|
||||
src/interface/widgets/tabs/tab_game.cpp
|
||||
src/interface/widgets/tabs/tab_home.cpp
|
||||
src/interface/widgets/tabs/tab_logs.cpp
|
||||
src/interface/widgets/tabs/tab_message.cpp
|
||||
src/interface/widgets/tabs/tab_moderation.cpp
|
||||
src/interface/widgets/tabs/tab_public_decks.cpp
|
||||
src/interface/widgets/tabs/tab_report.cpp
|
||||
src/interface/widgets/tabs/tab_replays.cpp
|
||||
src/interface/widgets/tabs/tab_room.cpp
|
||||
src/interface/widgets/tabs/tab_server.cpp
|
||||
|
|
@ -377,6 +419,28 @@ set(cockatrice_SOURCES
|
|||
src/interface/widgets/tabs/api/commander_spellbook/commander_bracket_service.cpp
|
||||
src/interface/widgets/tabs/api/commander_spellbook/commander_bracket_widget.cpp
|
||||
src/interface/widgets/tabs/api/commander_spellbook/handle_commander_brackets.cpp
|
||||
src/interface/widgets/onboarding/banner_shader_config.h
|
||||
src/interface/widgets/onboarding/brand_colors.h
|
||||
src/interface/widgets/onboarding/first_run_wizard.cpp
|
||||
src/interface/widgets/onboarding/first_run_wizard.h
|
||||
src/interface/widgets/onboarding/first_run_wizard_page.cpp
|
||||
src/interface/widgets/onboarding/first_run_wizard_page.h
|
||||
src/interface/widgets/onboarding/pages/account_setup_page.cpp
|
||||
src/interface/widgets/onboarding/pages/account_setup_page.h
|
||||
src/interface/widgets/onboarding/pages/card_database_setup_page.cpp
|
||||
src/interface/widgets/onboarding/pages/card_database_setup_page.h
|
||||
src/interface/widgets/onboarding/pages/finish_page.cpp
|
||||
src/interface/widgets/onboarding/pages/finish_page.h
|
||||
src/interface/widgets/onboarding/pages/preferences_setup_page.cpp
|
||||
src/interface/widgets/onboarding/pages/preferences_setup_page.h
|
||||
src/interface/widgets/onboarding/pages/theme_setup_page.cpp
|
||||
src/interface/widgets/onboarding/pages/theme_setup_page.h
|
||||
src/interface/widgets/onboarding/pages/welcome_page.cpp
|
||||
src/interface/widgets/onboarding/pages/welcome_page.h
|
||||
src/interface/widgets/onboarding/shader_banner_widget.cpp
|
||||
src/interface/widgets/onboarding/shader_banner_widget.h
|
||||
src/interface/widgets/onboarding/step_indicator_widget.cpp
|
||||
src/interface/widgets/onboarding/step_indicator_widget.h
|
||||
src/interface/widgets/tabs/api/edhrec/display/commander/edhrec_commander_api_response_bracket_navigation_widget.cpp
|
||||
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
|
||||
|
|
@ -395,6 +459,10 @@ set(cockatrice_SOURCES
|
|||
src/interface/intents/intent_join_server_room.h
|
||||
src/interface/intents/intent_login.cpp
|
||||
src/interface/intents/intent_login.h
|
||||
src/interface/intents/intent_open_server_room_by_name.cpp
|
||||
src/interface/intents/intent_open_server_room_by_name.h
|
||||
src/interface/intents/intent_open_shared_deck.cpp
|
||||
src/interface/intents/intent_open_shared_deck.h
|
||||
src/interface/intents/url_parser.cpp
|
||||
src/interface/intents/url_parser.h
|
||||
src/interface/widgets/server/user/user_info_popup.cpp
|
||||
|
|
@ -471,6 +539,31 @@ qt6_add_executable(
|
|||
MANUAL_FINALIZATION
|
||||
)
|
||||
|
||||
target_precompile_headers(cockatrice PRIVATE "${CMAKE_SOURCE_DIR}/cmake/pch/qtwidgets_pch.h")
|
||||
|
||||
qt6_add_shaders(
|
||||
cockatrice
|
||||
"onboarding_shaders"
|
||||
PREFIX
|
||||
"/onboarding/shaders"
|
||||
BASE
|
||||
"src/interface/widgets/onboarding/shaders"
|
||||
FILES
|
||||
src/interface/widgets/onboarding/shaders/brand_banner.frag
|
||||
src/interface/widgets/onboarding/shaders/brand_plate.frag
|
||||
)
|
||||
|
||||
qt6_add_resources(
|
||||
cockatrice
|
||||
"onboarding_qml"
|
||||
PREFIX
|
||||
"/onboarding/qml"
|
||||
BASE
|
||||
"src/interface/widgets/onboarding/qml"
|
||||
FILES
|
||||
src/interface/widgets/onboarding/qml/BrandBanner.qml
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
cockatrice
|
||||
PUBLIC libcockatrice_card
|
||||
|
|
@ -582,18 +675,53 @@ if(WIN32)
|
|||
set(qtconf_dest_dir .)
|
||||
|
||||
install(
|
||||
DIRECTORY "${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${CMAKE_BUILD_TYPE}/"
|
||||
DIRECTORY "$<TARGET_FILE_DIR:cockatrice>/"
|
||||
DESTINATION ./
|
||||
FILES_MATCHING
|
||||
PATTERN "*.dll"
|
||||
PATTERN "*.pdb" EXCLUDE
|
||||
PATTERN "*.dir*" EXCLUDE
|
||||
PATTERN "*_autogen*" EXCLUDE
|
||||
PATTERN "*.tlog*" EXCLUDE
|
||||
PATTERN "CMakeFiles*" EXCLUDE
|
||||
PATTERN "x64*" EXCLUDE
|
||||
PATTERN ".qt*" EXCLUDE
|
||||
PATTERN ".qsb*" EXCLUDE
|
||||
PATTERN ".lupdate*" EXCLUDE
|
||||
)
|
||||
|
||||
# fixup_bundle further down copies only the DLLs it can find in Cockatrice.exe's
|
||||
# import table, and the glob above only sees DLLs that were already copied next
|
||||
# to the executable. Qt6::Concurrent is linked but never imported - QtConcurrent::run
|
||||
# and QFutureWatcher are header-only in Qt 6 - so neither step ships
|
||||
# Qt6Concurrent.dll, even though required-runtime.txt lists it and the
|
||||
# Windows package check then fails on a package that is fine to run.
|
||||
# Qt6::ShaderTools is skipped for the same reason.
|
||||
#
|
||||
# Install the runtime of every linked module explicitly. An unused DLL costs a
|
||||
# few hundred kilobytes; a missing one is what stops the client starting after
|
||||
# an update, and it stays invisible until then.
|
||||
foreach(_qt_module IN LISTS COCKATRICE_QT_MODULES)
|
||||
get_target_property(_qt_module_type ${_qt_module} TYPE)
|
||||
if(_qt_module_type STREQUAL "SHARED_LIBRARY")
|
||||
install(FILES "$<TARGET_FILE:${_qt_module}>" DESTINATION ./)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
install(
|
||||
DIRECTORY "${CMAKE_BINARY_DIR}/cockatrice/"
|
||||
DESTINATION ./
|
||||
FILES_MATCHING
|
||||
PATTERN "CMakeFiles" EXCLUDE
|
||||
PATTERN "*.ini"
|
||||
PATTERN "CMakeFiles*" EXCLUDE
|
||||
PATTERN "*.dir*" EXCLUDE
|
||||
PATTERN "*_autogen*" EXCLUDE
|
||||
PATTERN "*.tlog*" EXCLUDE
|
||||
PATTERN "*.pdb" EXCLUDE
|
||||
PATTERN "x64*" EXCLUDE
|
||||
PATTERN ".qt*" EXCLUDE
|
||||
PATTERN ".qsb*" EXCLUDE
|
||||
PATTERN ".lupdate*" EXCLUDE
|
||||
)
|
||||
|
||||
# Qt plugins: audio, iconengines, imageformats, multimedia, platforms, printsupport, styles, tls
|
||||
|
|
@ -626,11 +754,15 @@ if(WIN32)
|
|||
PATTERN "tls/qschannelbackend.dll"
|
||||
)
|
||||
|
||||
# The Windows install has no Resources directory: the .qm files go to
|
||||
# ${COCKATRICE_WIN32_QM_INSTALL_DIR} and main.cpp looks for them at
|
||||
# applicationDirPath() + "/translations". The macOS bundle above keeps
|
||||
# Resources/translations, which is correct for it.
|
||||
install(
|
||||
CODE "
|
||||
file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"[Paths]
|
||||
Plugins = Plugins
|
||||
Translations = Resources/translations
|
||||
Translations = translations
|
||||
Data = Resources\")
|
||||
"
|
||||
COMPONENT Runtime
|
||||
|
|
@ -646,10 +778,6 @@ Data = Resources\")
|
|||
"
|
||||
COMPONENT Runtime
|
||||
)
|
||||
|
||||
if(OPENSSL_FOUND)
|
||||
install(FILES ${OPENSSL_INCLUDE_DIRS} DESTINATION ./)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(Qt6LinguistTools_FOUND)
|
||||
|
|
@ -677,6 +805,18 @@ if(Qt6LinguistTools_FOUND)
|
|||
elseif(WIN32)
|
||||
install(FILES ${cockatrice_QM} DESTINATION ${COCKATRICE_WIN32_QM_INSTALL_DIR})
|
||||
endif()
|
||||
|
||||
# Qt attaches the .qm files to the default build target only, so building the executable on its own
|
||||
# (CLion, --target cockatrice) leaves it without any translations: nothing is translated and the
|
||||
# language selector stays empty.
|
||||
# Depend on Qt's own lrelease target instead of attaching the .qm custom commands to a second
|
||||
# target: two independent targets owning the same outputs race on MSBuild/Makefiles and are an
|
||||
# error on Xcode. Older Qt versions already add this dependency themselves.
|
||||
foreach(_lrelease_target Cockatrice_lrelease cockatrice_lrelease)
|
||||
if(TARGET ${_lrelease_target})
|
||||
add_dependencies(cockatrice ${_lrelease_target})
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
qt6_finalize_target(cockatrice)
|
||||
|
|
|
|||
|
|
@ -6,5 +6,4 @@ Name=Cockatrice
|
|||
Exec=cockatrice %U
|
||||
Icon=cockatrice
|
||||
Categories=Game;CardGame;
|
||||
MimeType=application/x-cockatrice;
|
||||
X-Scheme-Handler/cockatrice=true
|
||||
MimeType=application/x-cockatrice;x-scheme-handler/cockatrice;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
<qresource prefix="/">
|
||||
<file>resources/cardback.svg</file>
|
||||
<file>resources/cockatrice.svg</file>
|
||||
<file>resources/cockatrice-logo-white.svg</file>
|
||||
<file>resources/hand.svg</file>
|
||||
<file>resources/hr.jpg</file>
|
||||
|
||||
|
|
@ -61,7 +62,9 @@
|
|||
<file>resources/icons/mana/U.svg</file>
|
||||
<file>resources/icons/mana/W.svg</file>
|
||||
|
||||
<file>resources/backgrounds/home.png</file>
|
||||
<file>resources/backgrounds/home.jpg</file>
|
||||
<file>resources/backgrounds/home-dark.jpg</file>
|
||||
<file>resources/backgrounds/home-light.jpg</file>
|
||||
<file>resources/backgrounds/card_triplet.svg</file>
|
||||
<file>resources/backgrounds/placeholder_printing_selector.svg</file>
|
||||
|
||||
|
|
@ -362,6 +365,8 @@
|
|||
|
||||
<file>resources/usericons/pawn_single.svg</file>
|
||||
<file>resources/usericons/pawn_double.svg</file>
|
||||
<file>resources/usericons/pawn_dev_single.svg</file>
|
||||
<file>resources/usericons/pawn_dev_double.svg</file>
|
||||
<file>resources/usericons/pawn_donator_single.svg</file>
|
||||
<file>resources/usericons/pawn_donator_double.svg</file>
|
||||
<file>resources/usericons/pawn_judge_single.svg</file>
|
||||
|
|
|
|||
BIN
cockatrice/resources/backgrounds/home-dark.jpg
Normal file
|
After Width: | Height: | Size: 2.7 MiB |
BIN
cockatrice/resources/backgrounds/home-light.jpg
Normal file
|
After Width: | Height: | Size: 3.9 MiB |
BIN
cockatrice/resources/backgrounds/home.jpg
Normal file
|
After Width: | Height: | Size: 3.9 MiB |
|
Before Width: | Height: | Size: 12 MiB |
21
cockatrice/resources/cockatrice-logo-white.svg
Normal file
|
After Width: | Height: | Size: 6.8 KiB |
|
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 51 KiB |
|
|
@ -52,8 +52,7 @@
|
|||
id="defs8">
|
||||
<polygon
|
||||
id="s"
|
||||
points="-301930,415571 0,-513674 301930,415571 -488533,-158734 488533,-158734 "
|
||||
transform="scale(1.94676e-6,1.94676e-6)"
|
||||
points="-0.587785,0.809017 0,-1 0.587785,0.809017 -0.951057,-0.309017 0.951057,-0.309017 "
|
||||
style="fill:#ffde00" />
|
||||
<clipPath
|
||||
clipPathUnits="userSpaceOnUse"
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.1 KiB |
|
|
@ -16,6 +16,6 @@
|
|||
<rect id="rect10" height="2.88" width="12.8" y="4.278e-9" x="0"/>
|
||||
<rect id="rect12" height="2.88" width="12.8" y="3.36" x="0" fill="#da121a"/>
|
||||
<polygon id="polygon14" points="0 0 8.6603 5 0 10" fill="#0f47af" transform="scale(.96)"/>
|
||||
<polygon id="polygon16" points="4.1557e5 -3.0193e5 -5.1367e5 0 4.1557e5 3.0193e5 -1.5873e5 -4.8853e5 -1.5873e5 4.8853e5" fill="#fcdd09" transform="matrix(.0000029902 0 0 .0000029902 2.7713 4.8)"/>
|
||||
<polygon id="polygon16" points="4.01394 3.897169 1.23532 4.8 4.01394 5.702831 2.296666 3.3392 2.296666 6.2608" fill="#fcdd09"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.1 KiB |
|
|
@ -52,6 +52,7 @@ In this list of examples below, each entry has an explanation and can be clicked
|
|||
<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>[e:lea OR e:leb](#e:lea OR e:leb) <small>(Cards that appear in Alpha or Beta)</small></dd>
|
||||
<dd>[e<8ED](#e<8ED) <small>(Cards that appear before 8th edition)</small></dd>
|
||||
|
||||
<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>
|
||||
|
|
|
|||
343
cockatrice/resources/usericons/pawn_dev_double.svg
Normal file
|
|
@ -0,0 +1,343 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="100"
|
||||
height="100"
|
||||
id="svg5322"
|
||||
version="1.1"
|
||||
inkscape:version="1.4.2 (ebf0e940, 2025-05-08)"
|
||||
sodipodi:docname="pawn_dev_double.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="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/">
|
||||
<defs
|
||||
id="defs3">
|
||||
<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="perspective5328"/>
|
||||
<inkscape:perspective
|
||||
id="perspective5305"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d"/>
|
||||
<linearGradient
|
||||
id="linearGradient5181">
|
||||
<stop
|
||||
style="stop-color:#0fbb00;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop5183"/>
|
||||
<stop
|
||||
style="stop-color:#064400;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop5185"/>
|
||||
</linearGradient>
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3600-2"
|
||||
id="radialGradient3606-7"
|
||||
cx="324.32715"
|
||||
cy="131.40274"
|
||||
fx="324.32715"
|
||||
fy="131.40274"
|
||||
r="25.501276"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.92332021,0.38403097,-0.41592401,1.0000002,78.192026,-120.05314)"/>
|
||||
<linearGradient
|
||||
id="linearGradient3600-2">
|
||||
<stop
|
||||
style="stop-color:#ffc33d;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop3602-4"/>
|
||||
<stop
|
||||
style="stop-color:#e09900;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop3604-9"/>
|
||||
</linearGradient>
|
||||
<inkscape:perspective
|
||||
id="perspective5478"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d"/>
|
||||
<linearGradient
|
||||
id="linearGradient5189">
|
||||
<stop
|
||||
style="stop-color:#000ec9;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop5191"/>
|
||||
<stop
|
||||
style="stop-color:#000657;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop5193"/>
|
||||
</linearGradient>
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3600-4"
|
||||
id="radialGradient3606-1"
|
||||
cx="324.32715"
|
||||
cy="131.40274"
|
||||
fx="324.32715"
|
||||
fy="131.40274"
|
||||
r="25.501276"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.92332021,0.38403097,-0.41592401,1.0000002,78.192026,-120.05314)"/>
|
||||
<linearGradient
|
||||
id="linearGradient3600-4">
|
||||
<stop
|
||||
style="stop-color:#ffc33d;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop3602-3"/>
|
||||
<stop
|
||||
style="stop-color:#e09900;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop3604-5"/>
|
||||
</linearGradient>
|
||||
<inkscape:perspective
|
||||
id="perspective5559"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d"/>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient5173"
|
||||
id="linearGradient5179"
|
||||
x1="167.33386"
|
||||
y1="178.83276"
|
||||
x2="244.78181"
|
||||
y2="178.83276"
|
||||
gradientUnits="userSpaceOnUse"/>
|
||||
<linearGradient
|
||||
id="linearGradient5173">
|
||||
<stop
|
||||
style="stop-color:#f50000;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop5175"/>
|
||||
<stop
|
||||
style="stop-color:#950000;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop5177"/>
|
||||
</linearGradient>
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3600"
|
||||
id="radialGradient5169"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.92332021,0.38403097,-0.41592401,1.0000002,78.192026,-120.05314)"
|
||||
cx="324.32715"
|
||||
cy="131.40274"
|
||||
fx="324.32715"
|
||||
fy="131.40274"
|
||||
r="25.501276"/>
|
||||
<linearGradient
|
||||
id="linearGradient3600">
|
||||
<stop
|
||||
style="stop-color:#ffc13d;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop3602"/>
|
||||
<stop
|
||||
style="stop-color:#e09900;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop3604"/>
|
||||
</linearGradient>
|
||||
<radialGradient
|
||||
r="25.501276"
|
||||
fy="131.40274"
|
||||
fx="324.32715"
|
||||
cy="131.40274"
|
||||
cx="324.32715"
|
||||
gradientTransform="matrix(0.92332021,0.38403097,-0.41592401,1.0000002,78.192026,-120.05314)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="radialGradient5574"
|
||||
xlink:href="#linearGradient3600"
|
||||
inkscape:collect="always"/>
|
||||
<inkscape:perspective
|
||||
id="perspective5663"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d"/>
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3600-7"
|
||||
id="radialGradient3606-8"
|
||||
cx="324.32715"
|
||||
cy="131.40274"
|
||||
fx="324.32715"
|
||||
fy="131.40274"
|
||||
r="25.501276"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.92332021,0.38403097,-0.41592401,1.0000002,78.192026,-120.05314)"/>
|
||||
<linearGradient
|
||||
id="linearGradient3600-7">
|
||||
<stop
|
||||
style="stop-color:#ffc13d;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop3602-7"/>
|
||||
<stop
|
||||
style="stop-color:#e09900;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop3604-6"/>
|
||||
</linearGradient>
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3600-7"
|
||||
id="radialGradient5254"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.92332021,0.38403097,-0.41592401,1.0000002,78.192026,-120.05314)"
|
||||
cx="324.32715"
|
||||
cy="131.40274"
|
||||
fx="324.32715"
|
||||
fy="131.40274"
|
||||
r="25.501276"/>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient5189-1"
|
||||
id="linearGradient5394"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="385.03503"
|
||||
y1="180.09546"
|
||||
x2="462.48297"
|
||||
y2="180.09546"
|
||||
gradientTransform="matrix(0.96839241,0,0,0.96839241,-360.365,847.52359)"/>
|
||||
<linearGradient
|
||||
id="linearGradient5189-1">
|
||||
<stop
|
||||
style="stop-color:#000ec9;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop5191-0"/>
|
||||
<stop
|
||||
style="stop-color:#000657;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop5193-4"/>
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient5173-1"
|
||||
id="linearGradient5581"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="167.33386"
|
||||
y1="178.83276"
|
||||
x2="244.78181"
|
||||
y2="178.83276"
|
||||
gradientTransform="matrix(0.96839241,0,0,0.96839241,-149.54484,848.74636)"/>
|
||||
<linearGradient
|
||||
id="linearGradient5173-1">
|
||||
<stop
|
||||
style="stop-color:#f50000;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop5175-5"/>
|
||||
<stop
|
||||
style="stop-color:#950000;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop5177-3"/>
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient5181-9"
|
||||
id="linearGradient5782"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="282.50455"
|
||||
y1="181.61069"
|
||||
x2="359.95248"
|
||||
y2="181.61069"
|
||||
gradientTransform="matrix(0.96839241,0,0,0.96839241,-261.07526,846.05625)"/>
|
||||
<linearGradient
|
||||
id="linearGradient5181-9">
|
||||
<stop
|
||||
style="stop-color:#80d600;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop5183-3"/>
|
||||
<stop
|
||||
style="stop-color:#80d600;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop5185-0"/>
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
y2="181.61069"
|
||||
x2="359.95248"
|
||||
y1="181.61069"
|
||||
x1="282.50455"
|
||||
gradientTransform="matrix(0.96839241,0,0,0.96839241,-175.71812,893.2775)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="linearGradient5799"
|
||||
xlink:href="#linearGradient5181-9"
|
||||
inkscape:collect="always"/>
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
inkscape:document-units="mm"
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="6.0735294"
|
||||
inkscape:cx="53.757869"
|
||||
inkscape:cy="53.840194"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
inkscape:window-width="1696"
|
||||
inkscape:window-height="1051"
|
||||
inkscape:window-x="98"
|
||||
inkscape:window-y="1118"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
showguides="true">
|
||||
<sodipodi:guide
|
||||
position="49.829627,61.114263"
|
||||
orientation="1,0"
|
||||
id="guide1"
|
||||
inkscape:locked="false"/>
|
||||
</sodipodi:namedview>
|
||||
<metadata
|
||||
id="metadata4">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
|
||||
<dc:title/>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(0,-952.36218)">
|
||||
<path
|
||||
style="fill-opacity:1;stroke:black;stroke-width:2.78220296;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||
d="M 49.84375 1.71875 C 36.719738 1.71875 26.0625 12.375988 26.0625 25.5 C 26.0625 32.977454 29.538325 39.612734 34.9375 43.96875 C 24.439951 49.943698 17.919149 62.196126 14.3125 75.65625 C 9.0380874 95.34065 30.224013 98.21875 49.84375 98.21875 C 69.463486 98.21875 90.549327 94.96715 85.375 75.65625 C 81.693381 61.916246 75.224585 49.827177 64.8125 43.9375 C 70.181573 39.580662 73.59375 32.953205 73.59375 25.5 C 73.59375 12.375988 62.967762 1.71875 49.84375 1.71875 z "
|
||||
transform="translate(0,952.36218)"
|
||||
id="left"/>
|
||||
<path
|
||||
style="opacity:1;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.73577702;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m 51.28696,1001.834 0,-46.98372 1.434151,0.16768 c 5.155008,0.60274 9.462857,2.72154 12.938257,6.36366 4.74393,4.9715 6.87913,11.35611 6.16464,18.43328 -0.53702,5.31935 -3.09008,10.59498 -6.83833,14.13074 l -1.94072,1.83069 3.04083,2.20427 c 3.58084,2.5957 7.18975,6.4912 9.55296,10.3116 4.89572,7.9144 9.23593,21.4918 8.50487,26.6055 -0.81312,5.6877 -5.43872,9.6977 -13.62216,11.8093 -3.80822,0.9826 -7.68056,1.4713 -14.763321,1.8633 l -4.471177,0.2474 0,-46.9837 z"
|
||||
id="right"
|
||||
inkscape:connector-curvature="0"/>
|
||||
<path
|
||||
d="m 478.409,116.617 c -0.368,-4.271 -3.181,-7.94 -7.2,-9.403 -4.029,-1.472 -8.539,-0.47 -11.57,2.556 l -62.015,62.011 -68.749,-21.768 -21.768,-68.748 62.016,-62.016 c 3.035,-3.032 4.025,-7.543 2.563,-11.565 -1.477,-4.03 -5.137,-6.837 -9.417,-7.207 -37.663,-3.245 -74.566,10.202 -101.247,36.887 -36.542,36.545 -46.219,89.911 -29.083,135.399 -1.873,1.578 -3.721,3.25 -5.544,5.053 L 19.386,373.152 c -0.073,0.071 -0.145,0.149 -0.224,0.219 -24.345,24.346 -24.345,63.959 0,88.309 24.349,24.344 63.672,24.048 88.013,-0.298 0.105,-0.098 0.201,-0.196 0.297,-0.305 L 301.104,252.456 c 1.765,-1.773 3.404,-3.628 4.949,-5.532 45.5,17.167 98.9,7.513 135.474,-29.056 26.675,-26.687 40.131,-63.593 36.882,-101.251 z M 75.98,435.38 c -8.971,8.969 -23.5,8.963 -32.47,0 -8.967,-8.961 -8.967,-23.502 0,-32.466 8.97,-8.963 23.499,-8.963 32.47,0 8.967,8.964 8.967,23.505 0,32.466 z"
|
||||
id="path1"
|
||||
style="display:inline;fill:#A1A1A1;stroke-width:9.87059588;stroke-dasharray:none;fill-opacity:1;stroke:#000000;stroke-opacity:1"
|
||||
transform="matrix(0.19145387,0,0,0.19145387,4.0816072,956.99677)"
|
||||
inkscape:label="wrench" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 12 KiB |
211
cockatrice/resources/usericons/pawn_dev_single.svg
Normal file
|
|
@ -0,0 +1,211 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="100"
|
||||
height="100"
|
||||
id="svg5322"
|
||||
version="1.1"
|
||||
inkscape:version="1.4.2 (ebf0e940, 2025-05-08)"
|
||||
sodipodi:docname="pawn_dev_single.svg"
|
||||
xml:space="preserve"
|
||||
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="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/"><defs
|
||||
id="defs3"><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="perspective5328" /><inkscape:perspective
|
||||
id="perspective5305"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" /><linearGradient
|
||||
id="linearGradient5181"><stop
|
||||
style="stop-color:#0fbb00;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop5183" /><stop
|
||||
style="stop-color:#064400;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop5185" /></linearGradient><radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3600-2"
|
||||
id="radialGradient3606-7"
|
||||
cx="324.32715"
|
||||
cy="131.40274"
|
||||
fx="324.32715"
|
||||
fy="131.40274"
|
||||
r="25.501276"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.92332021,0.38403097,-0.41592401,1.0000002,78.192026,-120.05314)" /><linearGradient
|
||||
id="linearGradient3600-2"><stop
|
||||
style="stop-color:#ffc33d;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop3602-4" /><stop
|
||||
style="stop-color:#e09900;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop3604-9" /></linearGradient><inkscape:perspective
|
||||
id="perspective5478"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" /><linearGradient
|
||||
id="linearGradient5189"><stop
|
||||
style="stop-color:#000ec9;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop5191" /><stop
|
||||
style="stop-color:#000657;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop5193" /></linearGradient><radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3600-4"
|
||||
id="radialGradient3606-1"
|
||||
cx="324.32715"
|
||||
cy="131.40274"
|
||||
fx="324.32715"
|
||||
fy="131.40274"
|
||||
r="25.501276"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.92332021,0.38403097,-0.41592401,1.0000002,78.192026,-120.05314)" /><linearGradient
|
||||
id="linearGradient3600-4"><stop
|
||||
style="stop-color:#ffc33d;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop3602-3" /><stop
|
||||
style="stop-color:#e09900;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop3604-5" /></linearGradient><inkscape:perspective
|
||||
id="perspective5559"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" /><linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient5173"
|
||||
id="linearGradient5179"
|
||||
x1="167.33386"
|
||||
y1="178.83276"
|
||||
x2="244.78181"
|
||||
y2="178.83276"
|
||||
gradientUnits="userSpaceOnUse" /><linearGradient
|
||||
id="linearGradient5173"><stop
|
||||
style="stop-color:#f50000;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop5175" /><stop
|
||||
style="stop-color:#950000;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop5177" /></linearGradient><radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3600"
|
||||
id="radialGradient5169"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.92332021,0.38403097,-0.41592401,1.0000002,78.192026,-120.05314)"
|
||||
cx="324.32715"
|
||||
cy="131.40274"
|
||||
fx="324.32715"
|
||||
fy="131.40274"
|
||||
r="25.501276" /><linearGradient
|
||||
id="linearGradient3600"><stop
|
||||
style="stop-color:#ffc13d;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop3602" /><stop
|
||||
style="stop-color:#e09900;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop3604" /></linearGradient><radialGradient
|
||||
r="25.501276"
|
||||
fy="131.40274"
|
||||
fx="324.32715"
|
||||
cy="131.40274"
|
||||
cx="324.32715"
|
||||
gradientTransform="matrix(0.92332021,0.38403097,-0.41592401,1.0000002,78.192026,-120.05314)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="radialGradient5574"
|
||||
xlink:href="#linearGradient3600"
|
||||
inkscape:collect="always" /><inkscape:perspective
|
||||
id="perspective5663"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" /><radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3600-7"
|
||||
id="radialGradient3606-8"
|
||||
cx="324.32715"
|
||||
cy="131.40274"
|
||||
fx="324.32715"
|
||||
fy="131.40274"
|
||||
r="25.501276"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.92332021,0.38403097,-0.41592401,1.0000002,78.192026,-120.05314)" /><linearGradient
|
||||
id="linearGradient3600-7"><stop
|
||||
style="stop-color:#ffc13d;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop3602-7" /><stop
|
||||
style="stop-color:#e09900;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop3604-6" /></linearGradient><radialGradient
|
||||
r="25.501276"
|
||||
fy="131.40274"
|
||||
fx="324.32715"
|
||||
cy="131.40274"
|
||||
cx="324.32715"
|
||||
gradientTransform="matrix(0.92332021,0.38403097,-0.41592401,1.0000002,78.192026,-120.05314)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="radialGradient5676"
|
||||
xlink:href="#linearGradient3600-7"
|
||||
inkscape:collect="always" /></defs><sodipodi:namedview
|
||||
inkscape:document-units="mm"
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="3.1582091"
|
||||
inkscape:cx="104.64791"
|
||||
inkscape:cy="56.04442"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1027"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="25"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
showguides="true"><sodipodi:guide
|
||||
position="50.002551,111.99556"
|
||||
orientation="1,0"
|
||||
id="guide3"
|
||||
inkscape:locked="false" /></sodipodi:namedview><metadata
|
||||
id="metadata4"><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="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(0,-952.36218)"
|
||||
style="display:inline">
|
||||
<path
|
||||
style="display:inline;opacity:1;fill-opacity:1;stroke:#000000;stroke-width:2.7822;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="M 49.84375,1.71875 C 36.719738,1.71875 26.0625,12.375988 26.0625,25.5 c 0,7.477454 3.475825,14.112734 8.875,18.46875 -10.497549,5.974948 -17.018351,18.227376 -20.625,31.6875 -5.2744126,19.6844 15.911513,22.5625 35.53125,22.5625 19.619736,0 40.705577,-3.2516 35.53125,-22.5625 C 81.693381,61.916246 75.224585,49.827177 64.8125,43.9375 70.181573,39.580662 73.59375,32.953205 73.59375,25.5 c 0,-13.124012 -10.625988,-23.78125 -23.75,-23.78125 z"
|
||||
id="left"
|
||||
sodipodi:insensitive="true"
|
||||
transform="translate(0,952.36218)" />
|
||||
<path
|
||||
d="m 478.409,116.617 c -0.368,-4.271 -3.181,-7.94 -7.2,-9.403 -4.029,-1.472 -8.539,-0.47 -11.57,2.556 l -62.015,62.011 -68.749,-21.768 -21.768,-68.748 62.016,-62.016 c 3.035,-3.032 4.025,-7.543 2.563,-11.565 -1.477,-4.03 -5.137,-6.837 -9.417,-7.207 -37.663,-3.245 -74.566,10.202 -101.247,36.887 -36.542,36.545 -46.219,89.911 -29.083,135.399 -1.873,1.578 -3.721,3.25 -5.544,5.053 L 19.386,373.152 c -0.073,0.071 -0.145,0.149 -0.224,0.219 -24.345,24.346 -24.345,63.959 0,88.309 24.349,24.344 63.672,24.048 88.013,-0.298 0.105,-0.098 0.201,-0.196 0.297,-0.305 L 301.104,252.456 c 1.765,-1.773 3.404,-3.628 4.949,-5.532 45.5,17.167 98.9,7.513 135.474,-29.056 26.675,-26.687 40.131,-63.593 36.882,-101.251 z M 75.98,435.38 c -8.971,8.969 -23.5,8.963 -32.47,0 -8.967,-8.961 -8.967,-23.502 0,-32.466 8.97,-8.963 23.499,-8.963 32.47,0 8.967,8.964 8.967,23.505 0,32.466 z"
|
||||
id="path1"
|
||||
style="display:inline;fill:#A1A1A1;stroke-width:9.87059588;stroke-dasharray:none;fill-opacity:1;stroke:#000000;stroke-opacity:1"
|
||||
transform="matrix(0.19145387,0,0,0.19145387,4.0816072,956.99677)"
|
||||
inkscape:label="wrench" /></g></svg>
|
||||
|
After Width: | Height: | Size: 9.1 KiB |
66
cockatrice/src/client/lag_monitor.cpp
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
#include "lag_monitor.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QCoreApplication>
|
||||
#include <QDateTime>
|
||||
#include <QEvent>
|
||||
#include <QMessageLogger>
|
||||
#include <QTimer>
|
||||
|
||||
LagMonitor::LagMonitor(QObject *parent) : QObject(parent)
|
||||
{
|
||||
qApp->installEventFilter(this);
|
||||
|
||||
timer = new QTimer(this);
|
||||
timer->setInterval(TICK_INTERVAL_MS);
|
||||
connect(timer, &QTimer::timeout, this, &LagMonitor::checkTick);
|
||||
tickClock.start();
|
||||
timer->start();
|
||||
}
|
||||
|
||||
QList<LagMonitor::StallRecord> LagMonitor::recentStalls() const
|
||||
{
|
||||
return stalls;
|
||||
}
|
||||
|
||||
void LagMonitor::clearStalls()
|
||||
{
|
||||
stalls.clear();
|
||||
}
|
||||
|
||||
bool LagMonitor::eventFilter(QObject *obj, QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::ApplicationStateChange) {
|
||||
// The transition may span a suspend or an arbitrary unfocused period;
|
||||
// discard the gap so it cannot be mistaken for a stall.
|
||||
tickClock.restart();
|
||||
}
|
||||
return QObject::eventFilter(obj, event);
|
||||
}
|
||||
|
||||
void LagMonitor::checkTick()
|
||||
{
|
||||
recordGap(tickClock.restart());
|
||||
}
|
||||
|
||||
void LagMonitor::recordGap(qint64 gapMs)
|
||||
{
|
||||
if (gapMs <= STALL_THRESHOLD_MS) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (gapMs > MAX_PLAUSIBLE_STALL_MS) {
|
||||
qCDebug(LagMonitorLog, "Ignoring implausible %lld ms gap (likely suspend)", static_cast<long long>(gapMs));
|
||||
return;
|
||||
}
|
||||
|
||||
const StallRecord record{.timestampMsSinceEpoch = QDateTime::currentMSecsSinceEpoch(), .durationMs = gapMs};
|
||||
|
||||
stalls.append(record);
|
||||
while (stalls.size() > MAX_RECORDED_STALLS) {
|
||||
stalls.removeFirst();
|
||||
}
|
||||
|
||||
qCWarning(LagMonitorLog, "Event loop stalled for %lld ms (threshold: %d ms)", static_cast<long long>(gapMs),
|
||||
STALL_THRESHOLD_MS);
|
||||
}
|
||||
87
cockatrice/src/client/lag_monitor.h
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
/**
|
||||
* @file lag_monitor.h
|
||||
* @ingroup Client
|
||||
*/
|
||||
|
||||
#ifndef LAG_MONITOR_H
|
||||
#define LAG_MONITOR_H
|
||||
|
||||
#include <QElapsedTimer>
|
||||
#include <QList>
|
||||
#include <QLoggingCategory>
|
||||
#include <QObject>
|
||||
#include <QtGlobal>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
inline Q_LOGGING_CATEGORY(LagMonitorLog, "lag_monitor");
|
||||
|
||||
class QTimer;
|
||||
|
||||
/**
|
||||
* @brief Detects main-thread event loop stalls ("UI freezes") from the inside.
|
||||
*
|
||||
* A timer is expected to fire every TICK_INTERVAL_MS of wall time. When the
|
||||
* observed gap greatly exceeds that interval, some other task blocked the
|
||||
* event loop for roughly the overshooting duration. This is what separates
|
||||
* "my client froze" from "the network is lagging" in user reports.
|
||||
*
|
||||
* Gaps that span an application state change (suspend, minimize, focus
|
||||
* loss) are discarded, and implausibly huge gaps are dropped, so operating
|
||||
* system power events do not fabricate stalls. This handling is load-bearing
|
||||
* on Windows, where the monotonic clock used by Qt counts sleep time.
|
||||
*
|
||||
* Healthy operation costs one timer wakeup per tick and two integer
|
||||
* comparisons. Allocations happen only when a stall is actually recorded.
|
||||
*/
|
||||
class LagMonitor : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
struct StallRecord
|
||||
{
|
||||
qint64 timestampMsSinceEpoch = 0; ///< when the stalled period ended
|
||||
qint64 durationMs = 0; ///< approximate length of the freeze; measured tick to tick, so it can exceed the true
|
||||
///< stall by up to TICK_INTERVAL_MS
|
||||
};
|
||||
|
||||
static constexpr int TICK_INTERVAL_MS = 500;
|
||||
static constexpr int STALL_THRESHOLD_MS = 2000;
|
||||
static constexpr int MAX_RECORDED_STALLS = 32;
|
||||
|
||||
/// Gaps beyond this are treated as suspend artifacts rather than stalls.
|
||||
static constexpr qint64 MAX_PLAUSIBLE_STALL_MS = 600000;
|
||||
|
||||
explicit LagMonitor(QObject *parent = nullptr);
|
||||
|
||||
/**
|
||||
* @brief Stalls recorded during this session, oldest first.
|
||||
*
|
||||
* Intended consumers are log output and the diagnostics export. The list
|
||||
* holds at most MAX_RECORDED_STALLS entries.
|
||||
*/
|
||||
QList<StallRecord> recentStalls() const;
|
||||
|
||||
void clearStalls();
|
||||
|
||||
/**
|
||||
* @brief Feeds a measured tick-to-tick gap through the detection logic.
|
||||
*
|
||||
* Split out of checkTick so threshold, plausibility, and trim behavior
|
||||
* stay unit-testable without real timing.
|
||||
*/
|
||||
void recordGap(qint64 gapMs);
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||
|
||||
private slots:
|
||||
void checkTick();
|
||||
|
||||
private:
|
||||
QTimer *timer;
|
||||
QElapsedTimer tickClock; ///< monotonic clock, so wall clock steps do not fabricate stalls
|
||||
QList<StallRecord> stalls;
|
||||
};
|
||||
|
||||
#endif
|
||||
55
cockatrice/src/client/latency_graph_widget.cpp
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
/**
|
||||
* @file latency_graph_widget.cpp
|
||||
* @ingroup Client
|
||||
*/
|
||||
|
||||
#include "latency_graph_widget.h"
|
||||
|
||||
#include <QColor>
|
||||
#include <QPainter>
|
||||
#include <QRectF>
|
||||
#include <QtGlobal>
|
||||
#include <qnumeric.h>
|
||||
|
||||
LatencyGraphWidget::LatencyGraphWidget(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
}
|
||||
|
||||
void LatencyGraphWidget::setSamples(const QList<int> &samplesMs)
|
||||
{
|
||||
samples = samplesMs;
|
||||
update();
|
||||
}
|
||||
|
||||
void LatencyGraphWidget::paintEvent(QPaintEvent * /* event */)
|
||||
{
|
||||
if (samples.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QPainter painter(this);
|
||||
|
||||
// Heights are relative to the window's own worst sample (floored at
|
||||
// MinScaleMs) so the shape of the variance stays readable even when every
|
||||
// value is small.
|
||||
qint64 heightScaleMs = MinScaleMs;
|
||||
for (int sample : samples) {
|
||||
heightScaleMs = qMax(heightScaleMs, static_cast<qint64>(sample));
|
||||
}
|
||||
|
||||
const qreal widthPerBar = static_cast<qreal>(width()) / samples.size();
|
||||
for (int i = 0; i < samples.size(); ++i) {
|
||||
const qreal heightRatio = qBound(0.0, static_cast<double>(samples.at(i)) / heightScaleMs, 1.0);
|
||||
const qreal barHeight = heightRatio * height();
|
||||
|
||||
// Colors follow an absolute quality ramp: a steady good ping stays
|
||||
// green no matter how uniform the window is.
|
||||
const qreal colorRatio = qBound(0.0, static_cast<double>(samples.at(i)) / ColorScaleMs, 1.0);
|
||||
QColor color;
|
||||
color.setHsv(qRound(120.0 * (1.0 - colorRatio)), 255, 255);
|
||||
|
||||
const QRectF bar(static_cast<qreal>(i) * widthPerBar + 1.0, static_cast<qreal>(height()) - barHeight,
|
||||
qMax(1.0, widthPerBar - 2.0), barHeight);
|
||||
painter.fillRect(bar, color);
|
||||
}
|
||||
}
|
||||
45
cockatrice/src/client/latency_graph_widget.h
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/**
|
||||
* @file latency_graph_widget.h
|
||||
* @ingroup Client
|
||||
*/
|
||||
|
||||
#ifndef LATENCY_GRAPH_WIDGET_H
|
||||
#define LATENCY_GRAPH_WIDGET_H
|
||||
|
||||
#include <QList>
|
||||
#include <QWidget>
|
||||
#include <QtGlobal>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
/**
|
||||
* @brief Bar graph of recent network round-trip samples.
|
||||
*
|
||||
* Draws one bar per sample, oldest on the left. Bar height is relative to the
|
||||
* window's own scale so the shape of the variance stays readable, while bar
|
||||
* color maps each sample onto an absolute quality ramp (green at rest through
|
||||
* red at ColorScaleMs) so a steady good ping never looks alarming. Size
|
||||
* agnostic: the status bar embeds a small instance while the latency detail
|
||||
* popup shows a large one.
|
||||
*/
|
||||
class LatencyGraphWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit LatencyGraphWidget(QWidget *parent = nullptr);
|
||||
|
||||
/// Sample in milliseconds that maps to a fully red bar.
|
||||
static constexpr qint64 ColorScaleMs = 500;
|
||||
|
||||
void setSamples(const QList<int> &samplesMs);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
||||
private:
|
||||
/// Floor of the vertical scale in milliseconds. Keeps small windows readable.
|
||||
static constexpr qint64 MinScaleMs = 100;
|
||||
|
||||
QList<int> samples;
|
||||
};
|
||||
|
||||
#endif
|
||||
115
cockatrice/src/client/latency_status_widget.cpp
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
/**
|
||||
* @file latency_status_widget.cpp
|
||||
* @ingroup Client
|
||||
*/
|
||||
|
||||
#include "latency_status_widget.h"
|
||||
|
||||
#include "latency_graph_widget.h"
|
||||
#include "latency_tracker.h"
|
||||
|
||||
#include <QEvent>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QObject>
|
||||
#include <QPoint>
|
||||
#include <QVBoxLayout>
|
||||
#include <qnamespace.h>
|
||||
|
||||
LatencyStatusWidget::LatencyStatusWidget(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
pingLabel = new QLabel(this);
|
||||
pingLabel->setAccessibleName(tr("Ping"));
|
||||
|
||||
latencyGraph = new LatencyGraphWidget(this);
|
||||
latencyGraph->setFixedSize(90, 14);
|
||||
|
||||
auto *layout = new QHBoxLayout(this);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->setSpacing(4);
|
||||
layout->addWidget(latencyGraph);
|
||||
layout->addWidget(pingLabel);
|
||||
|
||||
// Clicking anywhere in the area opens the detail view.
|
||||
for (QObject *child : QList<QObject *>{pingLabel, latencyGraph}) {
|
||||
child->installEventFilter(this);
|
||||
}
|
||||
setCursor(Qt::PointingHandCursor);
|
||||
|
||||
hide();
|
||||
}
|
||||
|
||||
void LatencyStatusWidget::updateData(const LatencyTracker::Stats &stats, const QList<int> &samplesMs)
|
||||
{
|
||||
latestSamples = samplesMs;
|
||||
latencyGraph->setSamples(samplesMs);
|
||||
if (popup && popup->isVisible() && detailGraph) {
|
||||
detailGraph->setSamples(samplesMs);
|
||||
}
|
||||
|
||||
if (stats.sampleCount == 0) {
|
||||
hide();
|
||||
return;
|
||||
}
|
||||
|
||||
const QString statsStr = statsText(stats);
|
||||
|
||||
pingLabel->setText(tr("Ping: %1 ms").arg(stats.lastMs));
|
||||
pingLabel->setToolTip(statsStr);
|
||||
pingLabel->setAccessibleDescription(statsStr);
|
||||
if (popup && popup->isVisible() && detailLabel) {
|
||||
detailLabel->setText(statsStr);
|
||||
}
|
||||
show();
|
||||
}
|
||||
|
||||
bool LatencyStatusWidget::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
if ((watched == pingLabel || watched == latencyGraph) && event->type() == QEvent::MouseButtonPress) {
|
||||
togglePopup();
|
||||
return true;
|
||||
}
|
||||
return QWidget::eventFilter(watched, event);
|
||||
}
|
||||
|
||||
void LatencyStatusWidget::togglePopup()
|
||||
{
|
||||
if (!popup) {
|
||||
popup = new QWidget(this, Qt::Popup | Qt::FramelessWindowHint);
|
||||
auto *layout = new QVBoxLayout(popup);
|
||||
layout->setContentsMargins(8, 8, 8, 8);
|
||||
|
||||
detailLabel = new QLabel(popup);
|
||||
detailLabel->setAccessibleName(tr("Connection latency details"));
|
||||
detailLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
|
||||
|
||||
detailGraph = new LatencyGraphWidget(popup);
|
||||
detailGraph->setFixedSize(280, 80);
|
||||
|
||||
layout->addWidget(detailLabel, 0, Qt::AlignLeft);
|
||||
layout->addWidget(detailGraph, 0, Qt::AlignHCenter);
|
||||
}
|
||||
|
||||
if (popup->isVisible()) {
|
||||
popup->hide();
|
||||
return;
|
||||
}
|
||||
|
||||
// Qt::Popup closes itself on any outside click, so just position and show.
|
||||
if (latestSamples.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
detailGraph->setSamples(latestSamples);
|
||||
detailLabel->setText(pingLabel->toolTip());
|
||||
popup->adjustSize();
|
||||
const QPoint anchor = mapToGlobal(QPoint(width() / 2, 0));
|
||||
popup->move(anchor.x() - popup->width() / 2, anchor.y() - popup->height() - 6);
|
||||
popup->show();
|
||||
}
|
||||
|
||||
QString LatencyStatusWidget::statsText(const LatencyTracker::Stats &stats) const
|
||||
{
|
||||
return tr("Connection quality over the last %n sample(s):", "", stats.sampleCount) + "\n" +
|
||||
tr("Last: %1 ms").arg(stats.lastMs) + "\n" + tr("Median: %1 ms").arg(stats.medianMs) + "\n" +
|
||||
tr("95th percentile: %1 ms").arg(stats.p95Ms) + "\n" + tr("Maximum: %1 ms").arg(stats.maxMs);
|
||||
}
|
||||
52
cockatrice/src/client/latency_status_widget.h
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
/**
|
||||
* @file latency_status_widget.h
|
||||
* @ingroup Client
|
||||
*/
|
||||
|
||||
#ifndef LATENCY_STATUS_WIDGET_H
|
||||
#define LATENCY_STATUS_WIDGET_H
|
||||
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QWidget>
|
||||
#include <libcockatrice/network/client/abstract/latency_tracker.h>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
class QLabel;
|
||||
class LatencyGraphWidget;
|
||||
|
||||
/**
|
||||
* @brief Status bar presentation of server round-trip health.
|
||||
*
|
||||
* Combines the textual "Ping" readout with a small LatencyGraphWidget
|
||||
* sparkline of the rolling sample window. Clicking anywhere in the area opens
|
||||
* a popup with a larger graph and the numeric statistics. It closes on any
|
||||
* outside click. Stays hidden while disconnected or before any samples exist.
|
||||
* Owns all latency display state so MainWindow only needs to forward one
|
||||
* signal here.
|
||||
*/
|
||||
class LatencyStatusWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit LatencyStatusWidget(QWidget *parent = nullptr);
|
||||
|
||||
public slots:
|
||||
void updateData(const LatencyTracker::Stats &stats, const QList<int> &samplesMs);
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *watched, QEvent *event) override;
|
||||
|
||||
private:
|
||||
void togglePopup();
|
||||
QString statsText(const LatencyTracker::Stats &stats) const;
|
||||
|
||||
QLabel *pingLabel = nullptr;
|
||||
LatencyGraphWidget *latencyGraph = nullptr;
|
||||
QWidget *popup = nullptr;
|
||||
LatencyGraphWidget *detailGraph = nullptr;
|
||||
QLabel *detailLabel = nullptr;
|
||||
QList<int> latestSamples;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
#include "remote_connection_controller.h"
|
||||
|
||||
#include "../../../interface/pixel_map_generator.h"
|
||||
#include "../../settings/cache_settings.h"
|
||||
#include "../interface/widgets/dialogs/dlg_connect.h"
|
||||
#include "../interface/widgets/dialogs/dlg_forgot_password_challenge.h"
|
||||
|
|
@ -7,14 +8,25 @@
|
|||
#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 "libcockatrice/protocol/pb/event_connection_closed.pb.h"
|
||||
#include "libcockatrice/protocol/pb/event_server_shutdown.pb.h"
|
||||
|
||||
#include <QChar>
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
#include <QLineEdit>
|
||||
#include <QList>
|
||||
#include <QMessageBox>
|
||||
#include <QPixmap>
|
||||
#include <QStringList>
|
||||
#include <QStringLiteral>
|
||||
#include <QThread>
|
||||
#include <libcockatrice/network/client/remote/remote_client.h>
|
||||
#include <libcockatrice/protocol/pb/response.pb.h>
|
||||
#include <libcockatrice/settings/servers_settings.h>
|
||||
#include <qnamespace.h>
|
||||
|
||||
class QWidget;
|
||||
|
||||
ConnectionController::ConnectionController(QWidget *dialogParent, QObject *parent)
|
||||
: QObject(parent), dialogParent(dialogParent)
|
||||
|
|
@ -44,6 +56,8 @@ void ConnectionController::wireClientSignals()
|
|||
|
||||
connect(remoteClient, &RemoteClient::statusChanged, this, &ConnectionController::onStatusChanged);
|
||||
|
||||
connect(remoteClient, &AbstractClient::pingStatsUpdated, this, &ConnectionController::pingStatsUpdated);
|
||||
|
||||
connect(remoteClient, &RemoteClient::userInfoChanged, this, &ConnectionController::onUserInfoReceived,
|
||||
Qt::BlockingQueuedConnection);
|
||||
|
||||
|
|
@ -178,7 +192,7 @@ void ConnectionController::onServerShutdownEvent(const Event_ServerShutdown &eve
|
|||
"games will be lost.\nReason for shutdown: %1",
|
||||
"", event.minutes())
|
||||
.arg(QString::fromStdString(event.reason())));
|
||||
serverShutdownMessageBox.setIconPixmap(QPixmap("theme:cockatrice").scaled(64, 64));
|
||||
serverShutdownMessageBox.setIconPixmap(themePixmap(QStringLiteral("cockatrice")).scaled(64, 64));
|
||||
serverShutdownMessageBox.setText(tr("Scheduled server shutdown"));
|
||||
serverShutdownMessageBox.setWindowModality(Qt::ApplicationModal);
|
||||
serverShutdownMessageBox.setVisible(true);
|
||||
|
|
@ -296,6 +310,15 @@ void ConnectionController::onLoginError(int r,
|
|||
return;
|
||||
}
|
||||
|
||||
case Response::RespPasswordChangeRequired: {
|
||||
QMessageBox::information(
|
||||
dialogParent, tr("Password Change Required"),
|
||||
tr("An administrator has reset your password. Please contact your server administrator to obtain "
|
||||
"your temporary password, then log in and change it via Account -> Change Password."));
|
||||
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."));
|
||||
|
|
|
|||
|
|
@ -2,17 +2,22 @@
|
|||
#define COCKATRICE_REMOTE_CONNECTION_CONTROLLER_H
|
||||
|
||||
#include "abstract_client.h"
|
||||
#include "latency_tracker.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>
|
||||
#include <QtGlobal>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
class RemoteClient;
|
||||
class ServerInfo_User;
|
||||
class DlgConnect;
|
||||
class Event_ConnectionClosed;
|
||||
class Event_ServerShutdown;
|
||||
class QThread;
|
||||
class QWidget;
|
||||
template <typename T> class QList;
|
||||
|
||||
/**
|
||||
* Owns the RemoteClient and its worker thread.
|
||||
|
|
@ -54,6 +59,10 @@ signals:
|
|||
// action enable/disable logic
|
||||
void statusChanged(ClientStatus status);
|
||||
|
||||
// Forwarded from AbstractClient::pingStatsUpdated. See that signal for the
|
||||
// meaning of the parameters.
|
||||
void pingStatsUpdated(const LatencyTracker::Stats &stats, const QList<int> &samplesMs);
|
||||
|
||||
private slots:
|
||||
// Slots wired directly to RemoteClient signals
|
||||
void onStatusChanged(ClientStatus status);
|
||||
|
|
|
|||
|
|
@ -1,11 +1,22 @@
|
|||
#include "deck_stats_interface.h"
|
||||
|
||||
#include "libcockatrice/card/card_info.h"
|
||||
#include "libcockatrice/card/database/card_database_querier.h"
|
||||
#include "libcockatrice/deck_list/tree/inner_deck_list_node.h"
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QDesktopServices>
|
||||
#include <QMessageBox>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#include <QNetworkRequest>
|
||||
#include <QRegularExpression>
|
||||
#include <QRegularExpressionMatch>
|
||||
#include <QSharedPointer>
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
#include <QUrlQuery>
|
||||
#include <functional>
|
||||
#include <libcockatrice/card/database/card_database_manager.h>
|
||||
#include <libcockatrice/deck_list/deck_list.h>
|
||||
#include <libcockatrice/deck_list/tree/deck_list_card_node.h>
|
||||
|
|
@ -72,7 +83,7 @@ void DeckStatsInterface::copyDeckWithoutTokens(const DeckList &source, DeckList
|
|||
{
|
||||
auto copyIfNotAToken = [&destination](const auto node, const auto card) {
|
||||
CardInfoPtr dbCard = CardDatabaseManager::query()->getCardInfo(card->getName());
|
||||
if (dbCard && !dbCard->getIsToken()) {
|
||||
if (dbCard && !dbCard->getIsToken() && node->getName() != DECK_ZONE_MAYBEBOARD) {
|
||||
DecklistCardNode *addedCard = destination.addCard(card->getName(), node->getName(), -1);
|
||||
addedCard->setNumber(card->getNumber());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@
|
|||
#ifndef DECKSTATS_INTERFACE_H
|
||||
#define DECKSTATS_INTERFACE_H
|
||||
|
||||
#include <libcockatrice/deck_list/deck_list.h>
|
||||
#include <QObject>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
class QByteArray;
|
||||
class QNetworkAccessManager;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,28 @@
|
|||
#include "tapped_out_interface.h"
|
||||
|
||||
#include "libcockatrice/card/card_info.h"
|
||||
#include "libcockatrice/card/database/card_database_querier.h"
|
||||
#include "libcockatrice/deck_list/tree/inner_deck_list_node.h"
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QDebug>
|
||||
#include <QDesktopServices>
|
||||
#include <QList>
|
||||
#include <QMessageBox>
|
||||
#include <QMessageLogger>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#include <QNetworkRequest>
|
||||
#include <QRegularExpression>
|
||||
#include <QRegularExpressionMatch>
|
||||
#include <QRegularExpressionMatchIterator>
|
||||
#include <QSharedPointer>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QUrl>
|
||||
#include <QUrlQuery>
|
||||
#include <QVariant>
|
||||
#include <functional>
|
||||
#include <libcockatrice/card/database/card_database_manager.h>
|
||||
#include <libcockatrice/deck_list/deck_list.h>
|
||||
#include <libcockatrice/deck_list/tree/deck_list_card_node.h>
|
||||
|
|
@ -99,7 +116,7 @@ void TappedOutInterface::copyDeckSplitMainAndSide(const DeckList &source, DeckLi
|
|||
{
|
||||
auto copyMainOrSide = [&mainboard, &sideboard](const auto node, const auto card) {
|
||||
CardInfoPtr dbCard = CardDatabaseManager::query()->getCardInfo(card->getName());
|
||||
if (!dbCard || dbCard->getIsToken()) {
|
||||
if (!dbCard || dbCard->getIsToken() || node->getName() == DECK_ZONE_MAYBEBOARD) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include <QLoggingCategory>
|
||||
#include <QObject>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
inline Q_LOGGING_CATEGORY(TappedOutInterfaceLog, "tapped_out_interface");
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include "deck_link_to_api_transformer.h"
|
||||
|
||||
#include <QRegularExpression>
|
||||
#include <QRegularExpressionMatch>
|
||||
|
||||
namespace DeckLinkToApiTransformer
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,21 +1,35 @@
|
|||
#include "spoiler_background_updater.h"
|
||||
|
||||
#include "../../../../interface/window_main.h"
|
||||
#include "../../../../main.h"
|
||||
#include "../../../settings/cache_settings.h"
|
||||
|
||||
#include <QChar>
|
||||
#include <QCryptographicHash>
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QIODevice>
|
||||
#include <QList>
|
||||
#include <QLocale>
|
||||
#include <QMessageLogger>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#include <QNetworkRequest>
|
||||
#include <QSharedPointer>
|
||||
#include <QSystemTrayIcon>
|
||||
#include <QTimeZone>
|
||||
#include <QUrl>
|
||||
#include <QtConcurrent>
|
||||
#include <QtConcurrentRun>
|
||||
#include <QtGlobal>
|
||||
#include <functional>
|
||||
#include <libcockatrice/card/database/card_database.h>
|
||||
#include <libcockatrice/card/database/card_database_manager.h>
|
||||
#include <libcockatrice/settings/download_settings.h>
|
||||
#include <libcockatrice/settings/paths_settings.h>
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
#include <version_string.h>
|
||||
|
||||
#define SPOILERS_STATUS_URL "https://raw.githubusercontent.com/Cockatrice/Magic-Spoiler/files/SpoilerSeasonEnabled"
|
||||
|
|
|
|||
|
|
@ -10,7 +10,11 @@
|
|||
#include <QByteArray>
|
||||
#include <QLoggingCategory>
|
||||
#include <QObject>
|
||||
#include <QProcess>
|
||||
#include <QString>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
class QProcess;
|
||||
class QUrl;
|
||||
|
||||
inline Q_LOGGING_CATEGORY(SpoilerBackgroundUpdaterLog, "spoiler_background_updater");
|
||||
|
||||
|
|
|
|||
|
|
@ -6,9 +6,12 @@
|
|||
|
||||
#ifndef CLIENT_UPDATE_CHECKER_H
|
||||
#define CLIENT_UPDATE_CHECKER_H
|
||||
#include <QObject>
|
||||
#include "release_channel.h"
|
||||
|
||||
class Release;
|
||||
#include <QMetaObject>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
/**
|
||||
* We use a singleton instance of UpdateChannel, which can cause interference and feedback loops when multiple objects
|
||||
|
|
|
|||
|
|
@ -2,14 +2,27 @@
|
|||
|
||||
#include "version_string.h"
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QDebug>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QMessageBox>
|
||||
#include <QJsonParseError>
|
||||
#include <QJsonValue>
|
||||
#include <QMap>
|
||||
#include <QMessageLogger>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#include <QNetworkRequest>
|
||||
#include <QRegularExpression>
|
||||
#include <QSysInfo>
|
||||
#include <QRegularExpressionMatch>
|
||||
#include <QUrl>
|
||||
#include <QVariant>
|
||||
#include <QVariantMap>
|
||||
#include <QtGlobal>
|
||||
#include <optional>
|
||||
#include <qnamespace.h>
|
||||
#include <qprocessordetection.h>
|
||||
|
||||
#if defined(Q_OS_MACOS)
|
||||
#include <sys/sysctl.h>
|
||||
|
|
@ -26,6 +39,29 @@
|
|||
|
||||
#define GIT_SHORT_HASH_LEN 7
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
#if defined(Q_OS_MACOS) || defined(Q_OS_WIN)
|
||||
// QSysInfo::productVersion() is not guaranteed to start with a number, e.g. it returns
|
||||
// "Server 2022" on Windows Server. Use the first numeric token as the major host version.
|
||||
std::optional<int> getProductVersionMajor()
|
||||
{
|
||||
const QString versionString = QSysInfo::productVersion();
|
||||
bool ok = false;
|
||||
static const QRegularExpression firstNumber(R"((\d+))");
|
||||
const auto match = firstNumber.match(versionString);
|
||||
const int version = match.hasMatch() ? match.captured(1).toInt(&ok) : 0;
|
||||
if (!ok) {
|
||||
qCWarning(ReleaseChannelLog) << "Unable to determine OS version from" << versionString;
|
||||
return std::nullopt;
|
||||
}
|
||||
return version;
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace
|
||||
|
||||
ReleaseChannel::ReleaseChannel() : netMan(new QNetworkAccessManager(this)), response(nullptr), lastRelease(nullptr)
|
||||
{
|
||||
}
|
||||
|
|
@ -43,55 +79,93 @@ void ReleaseChannel::checkForUpdates()
|
|||
connect(response, &QNetworkReply::finished, this, &ReleaseChannel::releaseListFinished);
|
||||
}
|
||||
|
||||
// Different release channel checking functions for different operating systems
|
||||
bool ReleaseChannel::downloadMatchesCurrentOS(const QString &fileName)
|
||||
// Find assets compatible with host platform (Linux is not supported by in-client updater)
|
||||
std::optional<int> ReleaseChannel::getTargetVersionForCurrentOS(const QString &fileName)
|
||||
{
|
||||
#if defined(Q_OS_MACOS)
|
||||
static QRegularExpression version_regex("macOS(\\d+)");
|
||||
auto match = version_regex.match(fileName);
|
||||
if (!match.hasMatch()) {
|
||||
return false;
|
||||
#if defined(Q_OS_WIN) && Q_PROCESSOR_WORDSIZE == 4
|
||||
// The published Windows assets are 64-bit only
|
||||
Q_UNUSED(fileName);
|
||||
return std::nullopt;
|
||||
#endif
|
||||
|
||||
const QRegularExpression *regex = nullptr;
|
||||
|
||||
// Only platforms shipping updater assets (macOS, Windows) need the host version
|
||||
static const std::optional<int> systemVersion =
|
||||
#if defined(Q_OS_MACOS) || defined(Q_OS_WIN)
|
||||
getProductVersionMajor();
|
||||
#else
|
||||
std::nullopt;
|
||||
#endif
|
||||
|
||||
if (!systemVersion) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
auto getSystemVersion = [] {
|
||||
#if defined(Q_OS_MACOS)
|
||||
static const bool isIntel = [] {
|
||||
// QSysInfo does not go through translation layers
|
||||
// We need to use sysctl to reliably detect the underlying architecture
|
||||
char arch[255];
|
||||
size_t len = sizeof(arch);
|
||||
if (sysctlbyname("machdep.cpu.brand_string", arch, &len, nullptr, 0) == 0) {
|
||||
// Intel mac is only supported on macOS 13 versions
|
||||
if (QString::fromUtf8(arch).contains("Intel")) {
|
||||
return 13;
|
||||
}
|
||||
return QString::fromUtf8(arch).contains("Intel");
|
||||
}
|
||||
return false;
|
||||
}();
|
||||
|
||||
return QSysInfo::productVersion().split(".")[0].toInt();
|
||||
};
|
||||
|
||||
// older(smaller) releases are compatible with a newer or the same system version
|
||||
int sys_maj = getSystemVersion();
|
||||
int rel_maj = match.captured(1).toInt();
|
||||
return rel_maj == sys_maj;
|
||||
// Apple (ARM) --> Cockatrice-3.0.0-macOS15.dmg
|
||||
// Apple (x86) --> Cockatrice-3.0.0-macOS15_Intel.dmg
|
||||
static const QRegularExpression macIntelRegex(R"(-macOS(\d+)_Intel\.[^.]+$)",
|
||||
QRegularExpression::CaseInsensitiveOption);
|
||||
static const QRegularExpression macRegex(R"(-macOS(\d+)\.[^.]+$)", QRegularExpression::CaseInsensitiveOption);
|
||||
regex = isIntel ? &macIntelRegex : &macRegex;
|
||||
|
||||
#elif defined(Q_OS_WIN)
|
||||
#if Q_PROCESSOR_WORDSIZE == 4
|
||||
return fileName.contains("32bit");
|
||||
#elif Q_PROCESSOR_WORDSIZE == 8
|
||||
const QString &version = QSysInfo::productVersion();
|
||||
if (version.startsWith("7") || version.startsWith("8")) {
|
||||
return fileName.contains("Win7");
|
||||
} else {
|
||||
return fileName.contains("Win10");
|
||||
}
|
||||
#else
|
||||
// Windows (x86) --> Cockatrice-3.0.0-Windows10.exe
|
||||
static const QRegularExpression winRegex(R"(-(?:Win|Windows)(\d+)\.[^.]+$)",
|
||||
QRegularExpression::CaseInsensitiveOption);
|
||||
regex = &winRegex;
|
||||
|
||||
#else // if the OS doesn't fit one of the above #defines, then it will never match
|
||||
Q_UNUSED(fileName);
|
||||
return false;
|
||||
return std::nullopt;
|
||||
#endif
|
||||
|
||||
#else // If the OS doesn't fit one of the above #defines, then it will never match
|
||||
Q_UNUSED(fileName);
|
||||
return false;
|
||||
#endif
|
||||
// Any asset targeting an OS version up to the current host version works
|
||||
auto match = regex->match(fileName);
|
||||
if (!match.hasMatch()) {
|
||||
return std::nullopt;
|
||||
}
|
||||
const int targetVersion = match.captured(1).toInt();
|
||||
if (targetVersion > *systemVersion) {
|
||||
return std::nullopt;
|
||||
}
|
||||
return targetVersion;
|
||||
}
|
||||
|
||||
// Pick newest targeted version (highest number) amongst all compatible ones
|
||||
QString ReleaseChannel::findBestDownloadUrl(const QVariantList &assets)
|
||||
{
|
||||
QString bestUrl;
|
||||
int bestVersion = -1;
|
||||
for (const auto &rawAsset : assets) {
|
||||
QVariantMap asset = rawAsset.toMap();
|
||||
QString name = asset["name"].toString();
|
||||
QString url = asset["browser_download_url"].toString();
|
||||
auto version = getTargetVersionForCurrentOS(name);
|
||||
if (!version) {
|
||||
continue;
|
||||
}
|
||||
if (*version > bestVersion) {
|
||||
bestVersion = *version;
|
||||
bestUrl = url;
|
||||
}
|
||||
}
|
||||
if (!bestUrl.isEmpty()) {
|
||||
qCInfo(ReleaseChannelLog) << "Best compatible asset=" << bestUrl;
|
||||
}
|
||||
return bestUrl;
|
||||
}
|
||||
|
||||
QString StableReleaseChannel::getManualDownloadUrl() const
|
||||
|
|
@ -138,16 +212,9 @@ void StableReleaseChannel::releaseListFinished()
|
|||
lastRelease->setPublishDate(resultMap["published_at"].toDate());
|
||||
|
||||
if (resultMap.contains("assets")) {
|
||||
auto rawAssets = resultMap["assets"].toList();
|
||||
for (const auto &rawAsset : rawAssets) {
|
||||
QVariantMap asset = rawAsset.toMap();
|
||||
QString name = asset["name"].toString();
|
||||
QString url = asset["browser_download_url"].toString();
|
||||
|
||||
if (downloadMatchesCurrentOS(name)) {
|
||||
lastRelease->setDownloadUrl(url);
|
||||
break;
|
||||
}
|
||||
auto url = findBestDownloadUrl(resultMap["assets"].toList());
|
||||
if (!url.isEmpty()) {
|
||||
lastRelease->setDownloadUrl(url);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -289,21 +356,10 @@ void BetaReleaseChannel::fileListFinished()
|
|||
bool needToUpdate = (QString::compare(shortHash, myHash, Qt::CaseInsensitive) != 0);
|
||||
bool compatibleVersion = false;
|
||||
|
||||
QStringList resultUrlList{};
|
||||
for (QVariant file : resultList) {
|
||||
QVariantMap map = file.toMap();
|
||||
resultUrlList << map["browser_download_url"].toString();
|
||||
}
|
||||
|
||||
resultUrlList.sort();
|
||||
// iterate in reverse so the first item is the latest os version
|
||||
for (auto url = resultUrlList.rbegin(); url < resultUrlList.rend(); ++url) {
|
||||
if (downloadMatchesCurrentOS(*url)) {
|
||||
compatibleVersion = true;
|
||||
lastRelease->setDownloadUrl(*url);
|
||||
qCInfo(ReleaseChannelLog) << "Found compatible version url=" << *url;
|
||||
break;
|
||||
}
|
||||
QString downloadUrl = findBestDownloadUrl(resultList);
|
||||
if (!downloadUrl.isEmpty()) {
|
||||
compatibleVersion = true;
|
||||
lastRelease->setDownloadUrl(downloadUrl);
|
||||
}
|
||||
|
||||
emit finishedCheck(needToUpdate, compatibleVersion, lastRelease);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,9 @@
|
|||
#include <QLoggingCategory>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QVariantMap>
|
||||
#include <QVariantList>
|
||||
#include <optional>
|
||||
#include <qtmetamacros.h>
|
||||
#include <utility>
|
||||
|
||||
inline Q_LOGGING_CATEGORY(ReleaseChannelLog, "release_channel");
|
||||
|
|
@ -96,7 +98,8 @@ protected:
|
|||
Release *lastRelease;
|
||||
|
||||
protected:
|
||||
static bool downloadMatchesCurrentOS(const QString &fileName);
|
||||
static std::optional<int> getTargetVersionForCurrentOS(const QString &fileName);
|
||||
static QString findBestDownloadUrl(const QVariantList &assets);
|
||||
[[nodiscard]] virtual QString getReleaseChannelUrl() const = 0;
|
||||
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,14 @@
|
|||
#include "update_downloader.h"
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QChar>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QIODevice>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkRequest>
|
||||
#include <QUrl>
|
||||
#include <QVariant>
|
||||
|
||||
UpdateDownloader::UpdateDownloader(QObject *parent) : QObject(parent), response(nullptr)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,8 +7,14 @@
|
|||
#ifndef COCKATRICE_UPDATEDOWNLOADER_H
|
||||
#define COCKATRICE_UPDATEDOWNLOADER_H
|
||||
|
||||
#include <QNetworkReply>
|
||||
#include <QObject>
|
||||
#include <QtNetwork>
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
#include <QtGlobal>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
class QNetworkAccessManager;
|
||||
|
||||
class UpdateDownloader : public QObject
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,15 +2,20 @@
|
|||
|
||||
#include "../network/update/client/release_channel.h"
|
||||
#include "card_counter_settings.h"
|
||||
#include "libcockatrice/interfaces/interface_card_database_path_provider.h"
|
||||
#include "shortcuts_settings.h"
|
||||
#include "version_string.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QGlobalStatic>
|
||||
#include <QMessageLogger>
|
||||
#include <QSettings>
|
||||
#include <QSharedPointer>
|
||||
#include <QStandardPaths>
|
||||
#include <QVariant>
|
||||
#include <QtGlobal>
|
||||
#include <libcockatrice/settings/appearance_settings.h>
|
||||
#include <libcockatrice/settings/cache_storage_settings.h>
|
||||
#include <libcockatrice/settings/card_database_settings.h>
|
||||
|
|
@ -110,6 +115,16 @@ SettingsCache::SettingsCache()
|
|||
|
||||
settings = new QSettings(settingsPath + "global.ini", QSettings::IniFormat, this);
|
||||
|
||||
// Both migrations below overwrite per-domain files in place, so snapshot the whole settings
|
||||
// folder first: global.ini is preserved as global.ini.old, but pre-existing per-domain files
|
||||
// (and a re-migration after a downgrade) would otherwise have no way back.
|
||||
if (SettingsMigration::isMigrationPending(settingsPath)) {
|
||||
const QString backupPath = SettingsMigration::backupSettingsDirectory(settingsPath);
|
||||
if (!backupPath.isEmpty()) {
|
||||
qCInfo(SettingsCacheLog) << "[SettingsCache] Settings backed up before migration:" << backupPath;
|
||||
}
|
||||
}
|
||||
|
||||
// Migrate from legacy NativeFormat settings to per-class INI files (runs at most once)
|
||||
if (!isPortableBuild) {
|
||||
SettingsMigration::migrateLegacySettings(settingsPath);
|
||||
|
|
|
|||
|
|
@ -7,11 +7,13 @@
|
|||
#ifndef SETTINGSCACHE_H
|
||||
#define SETTINGSCACHE_H
|
||||
|
||||
#include <QList>
|
||||
#include <QLoggingCategory>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <libcockatrice/interfaces/interface_card_database_path_provider.h>
|
||||
#include <libcockatrice/interfaces/interface_network_settings_provider.h>
|
||||
#include <libcockatrice/utility/macros.h>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
inline Q_LOGGING_CATEGORY(SettingsCacheLog, "settings_cache");
|
||||
|
||||
|
|
@ -58,33 +60,33 @@ signals:
|
|||
void themeChanged();
|
||||
|
||||
private:
|
||||
QSettings *settings;
|
||||
ShortcutsSettings *shortcutsSettings;
|
||||
CardDatabaseSettings *cardDatabaseSettings;
|
||||
ServersSettings *serversSettings;
|
||||
MessageSettings *messageSettings;
|
||||
GameFiltersSettings *gameFiltersSettings;
|
||||
LayoutsSettings *layoutsSettings;
|
||||
DownloadSettings *downloadSettings;
|
||||
RecentsSettings *recentsSettings;
|
||||
CardOverrideSettings *cardOverrideSettings;
|
||||
DebugSettings *debugSettings;
|
||||
CardCounterSettings *cardCounterSettings;
|
||||
TabsSettings *tabsSettings;
|
||||
SoundSettings *soundSettings;
|
||||
GameSettings *gameSettings;
|
||||
ChatSettings *chatSettings;
|
||||
CacheStorageSettings *cacheStorageSettings;
|
||||
UpdatesSettings *updatesSettings;
|
||||
PersonalSettings *personalSettings;
|
||||
CardsDisplaySettings *cardsDisplaySettings;
|
||||
InterfaceSettings *interfaceSettings;
|
||||
DeckEditorSettings *deckEditorSettings;
|
||||
PathsSettings *pathsSettings;
|
||||
VisualDeckStorageSettings *visualDeckStorageSettings;
|
||||
AppearanceSettings *appearanceSettings;
|
||||
NetworkSettings *networkSettings;
|
||||
CommanderBracketSettings *commanderBracketSettings;
|
||||
QSettings *settings = nullptr;
|
||||
ShortcutsSettings *shortcutsSettings = nullptr;
|
||||
CardDatabaseSettings *cardDatabaseSettings = nullptr;
|
||||
ServersSettings *serversSettings = nullptr;
|
||||
MessageSettings *messageSettings = nullptr;
|
||||
GameFiltersSettings *gameFiltersSettings = nullptr;
|
||||
LayoutsSettings *layoutsSettings = nullptr;
|
||||
DownloadSettings *downloadSettings = nullptr;
|
||||
RecentsSettings *recentsSettings = nullptr;
|
||||
CardOverrideSettings *cardOverrideSettings = nullptr;
|
||||
DebugSettings *debugSettings = nullptr;
|
||||
CardCounterSettings *cardCounterSettings = nullptr;
|
||||
TabsSettings *tabsSettings = nullptr;
|
||||
SoundSettings *soundSettings = nullptr;
|
||||
GameSettings *gameSettings = nullptr;
|
||||
ChatSettings *chatSettings = nullptr;
|
||||
CacheStorageSettings *cacheStorageSettings = nullptr;
|
||||
UpdatesSettings *updatesSettings = nullptr;
|
||||
PersonalSettings *personalSettings = nullptr;
|
||||
CardsDisplaySettings *cardsDisplaySettings = nullptr;
|
||||
InterfaceSettings *interfaceSettings = nullptr;
|
||||
DeckEditorSettings *deckEditorSettings = nullptr;
|
||||
PathsSettings *pathsSettings = nullptr;
|
||||
VisualDeckStorageSettings *visualDeckStorageSettings = nullptr;
|
||||
AppearanceSettings *appearanceSettings = nullptr;
|
||||
NetworkSettings *networkSettings = nullptr;
|
||||
CommanderBracketSettings *commanderBracketSettings = nullptr;
|
||||
|
||||
QString themeName;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,15 @@
|
|||
#include "card_counter_settings.h"
|
||||
|
||||
#include "libcockatrice/settings/settings_manager.h"
|
||||
|
||||
#include <QChar>
|
||||
#include <QColor>
|
||||
#include <QSettings>
|
||||
#include <QVariant>
|
||||
#include <QtMath>
|
||||
#include <iterator>
|
||||
|
||||
class QObject;
|
||||
|
||||
CardCounterSettings::CardCounterSettings(const QString &settingsPath, QObject *parent)
|
||||
: SettingsManager(settingsPath + "card_counters.ini", "cards", "counters", parent)
|
||||
|
|
|
|||
|
|
@ -7,10 +7,12 @@
|
|||
#ifndef CARD_COUNTER_SETTINGS_H
|
||||
#define CARD_COUNTER_SETTINGS_H
|
||||
|
||||
#include <QString>
|
||||
#include <libcockatrice/settings/settings_manager.h>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
class QSettings;
|
||||
class QColor;
|
||||
class QObject;
|
||||
|
||||
class CardCounterSettings : public SettingsManager
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,7 +3,24 @@
|
|||
#include "cache_settings.h"
|
||||
#include "shortcuts_settings.h"
|
||||
|
||||
#include <QAbstractItemModel>
|
||||
#include <QAbstractItemView>
|
||||
#include <QFont>
|
||||
#include <QHash>
|
||||
#include <QHeaderView>
|
||||
#include <QList>
|
||||
#include <QModelIndex>
|
||||
#include <QRegularExpression>
|
||||
#include <QSharedPointer>
|
||||
#include <QStandardItem>
|
||||
#include <QStandardItemModel>
|
||||
#include <QStringList>
|
||||
#include <QVariant>
|
||||
#include <algorithm>
|
||||
#include <qnamespace.h>
|
||||
|
||||
class QObject;
|
||||
class QWidget;
|
||||
|
||||
ShortcutFilterProxyModel::ShortcutFilterProxyModel(QObject *parent) : QSortFilterProxyModel(parent)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,8 +8,13 @@
|
|||
#define SHORTCUT_TREEVIEW_H
|
||||
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QStandardItemModel>
|
||||
#include <QString>
|
||||
#include <QTreeView>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
class QObject;
|
||||
class QStandardItemModel;
|
||||
class QWidget;
|
||||
|
||||
/**
|
||||
* Custom implementation of QSortFilterProxyModel that appends the source and parent strings together when filtering
|
||||
|
|
|
|||
|
|
@ -2,9 +2,13 @@
|
|||
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
#include <QMap>
|
||||
#include <QMessageBox>
|
||||
#include <QMessageLogger>
|
||||
#include <QSettings>
|
||||
#include <QSharedPointer>
|
||||
#include <QStringList>
|
||||
#include <utility>
|
||||
#include <QVariant>
|
||||
|
||||
ShortcutKey::ShortcutKey(const QString &_name, QList<QKeySequence> _sequence, ShortcutGroup::Groups _group)
|
||||
: QList<QKeySequence>(_sequence), name(_name), group(_group)
|
||||
|
|
|
|||
|
|
@ -8,9 +8,18 @@
|
|||
#define SHORTCUTSSETTINGS_H
|
||||
|
||||
#include <QApplication>
|
||||
#include <QByteArray>
|
||||
#include <QChar>
|
||||
#include <QHash>
|
||||
#include <QKeySequence>
|
||||
#include <QList>
|
||||
#include <QLoggingCategory>
|
||||
#include <QSettings>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QtGlobal>
|
||||
#include <qtmetamacros.h>
|
||||
#include <utility>
|
||||
|
||||
inline Q_LOGGING_CATEGORY(ShortcutsSettingsLog, "shortcuts_settings");
|
||||
|
||||
|
|
@ -786,6 +795,10 @@ private:
|
|||
ShortcutGroup::Tabs)},
|
||||
{"Tabs/aTabLogs",
|
||||
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Logs"), parseSequenceString(""), ShortcutGroup::Tabs)},
|
||||
{"Tabs/aTabReport",
|
||||
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Report Queue"), parseSequenceString(""), ShortcutGroup::Tabs)},
|
||||
{"Tabs/aTabModeration",
|
||||
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Moderation"), parseSequenceString(""), ShortcutGroup::Tabs)},
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -4,8 +4,15 @@
|
|||
|
||||
#include <QApplication>
|
||||
#include <QAudioOutput>
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QList>
|
||||
#include <QMediaPlayer>
|
||||
#include <QMessageLogger>
|
||||
#include <QStringList>
|
||||
#include <QUrl>
|
||||
#include <QtGlobal>
|
||||
#include <libcockatrice/settings/sound_settings.h>
|
||||
|
||||
#define DEFAULT_THEME_NAME "Default"
|
||||
|
|
@ -94,7 +101,7 @@ QStringMap &SoundEngine::getAvailableThemes()
|
|||
QDir dir;
|
||||
availableThemes.clear();
|
||||
|
||||
// load themes from user profile dir
|
||||
// Load themes from user profile dir
|
||||
|
||||
dir.setPath(SettingsCache::instance().getDataPath() + "/sounds");
|
||||
|
||||
|
|
@ -104,7 +111,7 @@ QStringMap &SoundEngine::getAvailableThemes()
|
|||
}
|
||||
}
|
||||
|
||||
// load themes from cockatrice system dir
|
||||
// Load themes from Cockatrice system dir
|
||||
dir.setPath(qApp->applicationDirPath() +
|
||||
#ifdef Q_OS_MAC
|
||||
"/../Resources/sounds"
|
||||
|
|
|
|||
|
|
@ -7,17 +7,17 @@
|
|||
#ifndef SOUNDENGINE_H
|
||||
#define SOUNDENGINE_H
|
||||
|
||||
#include <QAudioOutput>
|
||||
#include <QLoggingCategory>
|
||||
#include <QMap>
|
||||
#include <QMediaPlayer>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
class QAudioOutput;
|
||||
class QMediaPlayer;
|
||||
|
||||
inline Q_LOGGING_CATEGORY(SoundEngineLog, "sound_engine");
|
||||
|
||||
class QBuffer;
|
||||
|
||||
typedef QMap<QString, QString> QStringMap;
|
||||
|
||||
class SoundEngine : public QObject
|
||||
|
|
|
|||
|
|
@ -13,11 +13,6 @@ public:
|
|||
{
|
||||
return SettingsCache::instance().cardOverrides().getCardPreferenceOverride(cardName);
|
||||
}
|
||||
|
||||
[[nodiscard]] bool getIncludeRebalancedCards() const override
|
||||
{
|
||||
return SettingsCache::instance().cardsDisplay().getIncludeRebalancedCards();
|
||||
}
|
||||
};
|
||||
|
||||
#endif // COCKATRICE_SETTINGS_CARD_PREFERENCE_PROVIDER_H
|
||||
|
|
|
|||
|
|
@ -1,9 +1,27 @@
|
|||
#include "deck_filter_string.h"
|
||||
|
||||
#include "../interface/deck_loader/loaded_deck.h"
|
||||
#include "libcockatrice/card/card_localization.h"
|
||||
#include "libcockatrice/card/database/card_database_querier.h"
|
||||
#include "libcockatrice/deck_list/deck_list.h"
|
||||
#include "libcockatrice/deck_list/tree/deck_list_card_node.h"
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QDebug>
|
||||
#include <QFileInfo>
|
||||
#include <QList>
|
||||
#include <QMessageLogger>
|
||||
#include <QSharedPointer>
|
||||
#include <algorithm>
|
||||
#include <any>
|
||||
#include <libcockatrice/card/database/card_database_manager.h>
|
||||
#include <libcockatrice/filters/filter_string.h>
|
||||
#include <libcockatrice/utility/peglib.h>
|
||||
#include <mutex>
|
||||
#include <qnamespace.h>
|
||||
#include <stddef.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
static peg::parser search(R"(
|
||||
Start <- QueryPartList
|
||||
|
|
@ -43,6 +61,12 @@ NumericValue <- [0-9]+
|
|||
|
||||
static std::once_flag init;
|
||||
|
||||
// The peglib parser is a single permanent object, so the rule actions below cannot see
|
||||
// per-instance state. The card language that the nested [[card name]] search matches
|
||||
// against is passed through this thread-local context, which is live only while a
|
||||
// DeckFilterString is being parsed, and copied into the nested FilterString closures.
|
||||
thread_local CardSearchLanguage deckSearchLanguageContext;
|
||||
|
||||
static void setupParserRules()
|
||||
{
|
||||
// plumbing
|
||||
|
|
@ -52,18 +76,14 @@ static void setupParserRules()
|
|||
|
||||
search["Start"] = passthru;
|
||||
search["QueryPartList"] = [](const peg::SemanticValues &sv) -> DeckFilter {
|
||||
return [=](const DeckPreviewWidget *deck, const ExtraDeckSearchInfo &info) {
|
||||
auto matchesFilter = [&deck, &info](const std::any &query) {
|
||||
return std::any_cast<DeckFilter>(query)(deck, info);
|
||||
};
|
||||
return [=](const DeckSearchData &data) {
|
||||
auto matchesFilter = [&data](const std::any &query) { return std::any_cast<DeckFilter>(query)(data); };
|
||||
return std::all_of(sv.begin(), sv.end(), matchesFilter);
|
||||
};
|
||||
};
|
||||
search["ComplexQueryPart"] = [](const peg::SemanticValues &sv) -> DeckFilter {
|
||||
return [=](const DeckPreviewWidget *deck, const ExtraDeckSearchInfo &info) {
|
||||
auto matchesFilter = [&deck, &info](const std::any &query) {
|
||||
return std::any_cast<DeckFilter>(query)(deck, info);
|
||||
};
|
||||
return [=](const DeckSearchData &data) {
|
||||
auto matchesFilter = [&data](const std::any &query) { return std::any_cast<DeckFilter>(query)(data); };
|
||||
return std::any_of(sv.begin(), sv.end(), matchesFilter);
|
||||
};
|
||||
};
|
||||
|
|
@ -71,9 +91,7 @@ static void setupParserRules()
|
|||
search["QueryPart"] = passthru;
|
||||
search["NotQuery"] = [](const peg::SemanticValues &sv) -> DeckFilter {
|
||||
const auto dependent = std::any_cast<DeckFilter>(sv[0]);
|
||||
return [=](const DeckPreviewWidget *deck, const ExtraDeckSearchInfo &info) -> bool {
|
||||
return !dependent(deck, info);
|
||||
};
|
||||
return [=](const DeckSearchData &data) -> bool { return !dependent(data); };
|
||||
};
|
||||
|
||||
search["String"] = [](const peg::SemanticValues &sv) -> QString {
|
||||
|
|
@ -122,12 +140,12 @@ static void setupParserRules()
|
|||
|
||||
// actual functionality
|
||||
search["DeckContentQuery"] = [](const peg::SemanticValues &sv) -> DeckFilter {
|
||||
auto cardFilter = FilterString(std::any_cast<QString>(sv[0]));
|
||||
auto cardFilter = FilterString(std::any_cast<QString>(sv[0]), deckSearchLanguageContext);
|
||||
auto numberMatcher = sv.size() > 1 ? std::any_cast<NumberMatcher>(sv[1]) : [](int count) { return count > 0; };
|
||||
|
||||
return [=](const DeckPreviewWidget *deck, const ExtraDeckSearchInfo &) -> bool {
|
||||
return [=](const DeckSearchData &data) -> bool {
|
||||
int count = 0;
|
||||
auto cardNodes = deck->deckLoader->getDeck().deckList.getCardNodes();
|
||||
auto cardNodes = data.deck->deckList.getCardNodes();
|
||||
for (auto node : cardNodes) {
|
||||
auto cardInfoPtr = CardDatabaseManager::query()->getCardInfo(node->getName());
|
||||
if (!cardInfoPtr.isNull() && cardFilter.check(cardInfoPtr)) {
|
||||
|
|
@ -146,57 +164,53 @@ static void setupParserRules()
|
|||
|
||||
search["DeckNameQuery"] = [](const peg::SemanticValues &sv) -> DeckFilter {
|
||||
auto name = std::any_cast<QString>(sv[0]);
|
||||
return [=](const DeckPreviewWidget *deck, const ExtraDeckSearchInfo &) {
|
||||
return deck->deckLoader->getDeck().deckList.getName().contains(name, Qt::CaseInsensitive);
|
||||
return [=](const DeckSearchData &data) {
|
||||
return data.deck->deckList.getName().contains(name, Qt::CaseInsensitive);
|
||||
};
|
||||
};
|
||||
|
||||
search["FileNameQuery"] = [](const peg::SemanticValues &sv) -> DeckFilter {
|
||||
auto name = std::any_cast<QString>(sv[0]);
|
||||
return [=](const DeckPreviewWidget *deck, const ExtraDeckSearchInfo &) {
|
||||
auto filename = QFileInfo(deck->filePath).fileName();
|
||||
return [=](const DeckSearchData &data) {
|
||||
auto filename = QFileInfo(data.filePath).fileName();
|
||||
return filename.contains(name, Qt::CaseInsensitive);
|
||||
};
|
||||
};
|
||||
|
||||
search["PathQuery"] = [](const peg::SemanticValues &sv) -> DeckFilter {
|
||||
auto name = std::any_cast<QString>(sv[0]);
|
||||
return [=](const DeckPreviewWidget *, const ExtraDeckSearchInfo &info) {
|
||||
return info.relativeFilePath.contains(name, Qt::CaseInsensitive);
|
||||
};
|
||||
return [=](const DeckSearchData &data) { return data.relativeFilePath.contains(name, Qt::CaseInsensitive); };
|
||||
};
|
||||
|
||||
search["FormatQuery"] = [](const peg::SemanticValues &sv) -> DeckFilter {
|
||||
auto format = std::any_cast<QString>(sv[0]);
|
||||
return [=](const DeckPreviewWidget *deck, const ExtraDeckSearchInfo &) {
|
||||
auto gameFormat = deck->deckLoader->getDeck().deckList.getGameFormat();
|
||||
return [=](const DeckSearchData &data) {
|
||||
auto gameFormat = data.deck->deckList.getGameFormat();
|
||||
return QString::compare(format, gameFormat, Qt::CaseInsensitive) == 0;
|
||||
};
|
||||
};
|
||||
|
||||
search["CommentQuery"] = [](const peg::SemanticValues &sv) -> DeckFilter {
|
||||
auto value = std::any_cast<QString>(sv[0]);
|
||||
return [=](const DeckPreviewWidget *deck, const ExtraDeckSearchInfo &) {
|
||||
auto comments = deck->deckLoader->getDeck().deckList.getComments();
|
||||
return [=](const DeckSearchData &data) {
|
||||
auto comments = data.deck->deckList.getComments();
|
||||
return comments.contains(value, Qt::CaseInsensitive);
|
||||
};
|
||||
};
|
||||
|
||||
search["GenericQuery"] = [](const peg::SemanticValues &sv) -> DeckFilter {
|
||||
auto name = std::any_cast<QString>(sv[0]);
|
||||
return [=](const DeckPreviewWidget *deck, const ExtraDeckSearchInfo &) {
|
||||
return deck->getDisplayName().contains(name, Qt::CaseInsensitive);
|
||||
};
|
||||
return [=](const DeckSearchData &data) { return data.displayName.contains(name, Qt::CaseInsensitive); };
|
||||
};
|
||||
}
|
||||
|
||||
DeckFilterString::DeckFilterString()
|
||||
{
|
||||
filter = [](const DeckPreviewWidget *, const ExtraDeckSearchInfo &) { return false; };
|
||||
filter = [](const DeckSearchData &) { return false; };
|
||||
_error = "Not initialized";
|
||||
}
|
||||
|
||||
DeckFilterString::DeckFilterString(const QString &expr)
|
||||
DeckFilterString::DeckFilterString(const QString &expr, const CardSearchLanguage &searchLanguage)
|
||||
{
|
||||
QByteArray ba = expr.simplified().toUtf8();
|
||||
|
||||
|
|
@ -205,16 +219,18 @@ DeckFilterString::DeckFilterString(const QString &expr)
|
|||
_error = QString();
|
||||
|
||||
if (ba.isEmpty()) {
|
||||
filter = [](const DeckPreviewWidget *, const ExtraDeckSearchInfo &) { return true; };
|
||||
filter = [](const DeckSearchData &) { return true; };
|
||||
return;
|
||||
}
|
||||
|
||||
deckSearchLanguageContext = searchLanguage;
|
||||
|
||||
search.set_logger([&](size_t /*ln*/, size_t col, const std::string &msg) {
|
||||
_error = QString("Error at position %1: %2").arg(col).arg(QString::fromStdString(msg));
|
||||
});
|
||||
|
||||
if (!search.parse(ba.data(), filter)) {
|
||||
qCInfo(DeckFilterStringLog).nospace() << "DeckFilterString error for " << expr << "; " << qPrintable(_error);
|
||||
filter = [](const DeckPreviewWidget *, const ExtraDeckSearchInfo &) { return false; };
|
||||
filter = [](const DeckSearchData &) { return false; };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,35 +7,40 @@
|
|||
#ifndef DECK_FILTER_STRING_H
|
||||
#define DECK_FILTER_STRING_H
|
||||
|
||||
#include "../interface/widgets/visual_deck_storage/deck_preview/deck_preview_widget.h"
|
||||
|
||||
#include <QLoggingCategory>
|
||||
#include <QString>
|
||||
#include <functional>
|
||||
#include <libcockatrice/card/card_localization.h>
|
||||
|
||||
struct CardSearchLanguage;
|
||||
struct LoadedDeck;
|
||||
|
||||
inline Q_LOGGING_CATEGORY(DeckFilterStringLog, "deck_filter_string");
|
||||
|
||||
/**
|
||||
* Extra info relevant to filtering that isn't present in the DeckPreviewWidget
|
||||
* The data a deck search expression is evaluated against.
|
||||
*
|
||||
* This is a data view rather than a widget pointer, so the same filter
|
||||
* expression can be evaluated against a model or a live widget.
|
||||
*/
|
||||
struct ExtraDeckSearchInfo
|
||||
struct DeckSearchData
|
||||
{
|
||||
/**
|
||||
* The relative filepath starting from the deck folder
|
||||
*/
|
||||
QString relativeFilePath;
|
||||
const LoadedDeck *deck = nullptr; ///< The loaded deck. Must not be null.
|
||||
QString filePath; ///< Absolute path of the deck file.
|
||||
QString displayName; ///< Deck name, or the file name if the deck has no name.
|
||||
QString relativeFilePath; ///< File path relative to the deck folder.
|
||||
};
|
||||
|
||||
typedef std::function<bool(const DeckPreviewWidget *, const ExtraDeckSearchInfo &)> DeckFilter;
|
||||
typedef std::function<bool(const DeckSearchData &data)> DeckFilter;
|
||||
|
||||
class DeckFilterString
|
||||
{
|
||||
public:
|
||||
DeckFilterString();
|
||||
explicit DeckFilterString(const QString &expr);
|
||||
bool check(const DeckPreviewWidget *deck, const ExtraDeckSearchInfo &info) const
|
||||
explicit DeckFilterString(const QString &expr, const CardSearchLanguage &searchLanguage = {});
|
||||
bool check(const DeckSearchData &data) const
|
||||
{
|
||||
return filter(deck, info);
|
||||
return filter(data);
|
||||
}
|
||||
|
||||
[[nodiscard]] bool valid() const
|
||||
|
|
|
|||
|
|
@ -1,11 +1,19 @@
|
|||
#include "filter_builder.h"
|
||||
|
||||
#include "../interface/pixel_map_generator.h"
|
||||
#include "../interface/widgets/utility/custom_line_edit.h"
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QGridLayout>
|
||||
#include <QIcon>
|
||||
#include <QPushButton>
|
||||
#include <QSizePolicy>
|
||||
#include <QString>
|
||||
#include <QStringLiteral>
|
||||
#include <QVariant>
|
||||
#include <QtGlobal>
|
||||
#include <libcockatrice/filters/filter_card.h>
|
||||
#include <stddef.h>
|
||||
|
||||
FilterBuilder::FilterBuilder(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
|
|
@ -21,7 +29,7 @@ FilterBuilder::FilterBuilder(QWidget *parent) : QWidget(parent)
|
|||
typeCombo->addItem(CardFilter::typeName(static_cast<CardFilter::Type>(i)), QVariant(i));
|
||||
}
|
||||
|
||||
QPushButton *ok = new QPushButton(QPixmap("theme:icons/increment"), QString());
|
||||
QPushButton *ok = new QPushButton(themePixmap(QStringLiteral("icons/increment")), QString());
|
||||
ok->setObjectName("ok");
|
||||
ok->setMaximumSize(20, 20);
|
||||
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@
|
|||
#define FILTERBUILDER_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
class QCheckBox;
|
||||
class QComboBox;
|
||||
class LineEditUnfocusable;
|
||||
class CardFilter;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,15 @@
|
|||
#include "filter_tree_model.h"
|
||||
|
||||
#include <QFlags>
|
||||
#include <QFont>
|
||||
#include <QString>
|
||||
#include <QVariant>
|
||||
#include <functional>
|
||||
#include <libcockatrice/filters/filter_card.h>
|
||||
#include <libcockatrice/filters/filter_tree.h>
|
||||
#include <stddef.h>
|
||||
|
||||
class QObject;
|
||||
|
||||
FilterTreeModel::FilterTreeModel(QObject *parent) : QAbstractItemModel(parent)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,11 +8,15 @@
|
|||
#define FILTERTREEMODEL_H
|
||||
|
||||
#include <QAbstractItemModel>
|
||||
#include <QList>
|
||||
#include <QModelIndex>
|
||||
#include <libcockatrice/filters/filter_card.h>
|
||||
#include <qnamespace.h>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
class FilterTree;
|
||||
class CardFilter;
|
||||
class FilterTreeNode;
|
||||
class QObject;
|
||||
|
||||
class FilterTreeModel : public QAbstractItemModel
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,8 +1,21 @@
|
|||
#include "syntax_help.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
#include <QFlags>
|
||||
#include <QIODevice>
|
||||
#include <QLineEdit>
|
||||
#include <QMessageLogger>
|
||||
#include <QObject>
|
||||
#include <QRegularExpression>
|
||||
#include <QSharedPointer>
|
||||
#include <QSize>
|
||||
#include <QString>
|
||||
#include <QTextBrowser>
|
||||
#include <QTextDocument>
|
||||
#include <QTextStream>
|
||||
#include <QUrl>
|
||||
#include <qnamespace.h>
|
||||
|
||||
/**
|
||||
* Creates the card search syntax help window
|
||||
|
|
|
|||
|
|
@ -8,9 +8,10 @@
|
|||
#ifndef SEARCH_SYNTAX_HELP_H
|
||||
#define SEARCH_SYNTAX_HELP_H
|
||||
|
||||
#include <QLineEdit>
|
||||
#include <QLoggingCategory>
|
||||
#include <QTextBrowser>
|
||||
|
||||
class QLineEdit;
|
||||
class QTextBrowser;
|
||||
|
||||
inline Q_LOGGING_CATEGORY(SyntaxHelpLog, "syntax_help");
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,18 @@
|
|||
#include "abstract_game.h"
|
||||
|
||||
#include "../interface/widgets/tabs/tab_game.h"
|
||||
#include "game_event_handler.h"
|
||||
#include "game_meta_info.h"
|
||||
#include "game_state.h"
|
||||
#include "libcockatrice/protocol/pb/game_replay.pb.h"
|
||||
#include "player/player_info.h"
|
||||
#include "player/player_logic.h"
|
||||
#include "player/player_manager.h"
|
||||
#include "zones/card_zone_logic.h"
|
||||
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
|
||||
class AbstractClient;
|
||||
|
||||
AbstractGame::AbstractGame(QObject *_parent) : QObject(_parent)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,15 +7,18 @@
|
|||
#ifndef COCKATRICE_ABSTRACT_GAME_H
|
||||
#define COCKATRICE_ABSTRACT_GAME_H
|
||||
|
||||
#include "game_event_handler.h"
|
||||
#include "game_meta_info.h"
|
||||
#include "game_state.h"
|
||||
#include "player/player_manager.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <libcockatrice/protocol/pb/game_replay.pb.h>
|
||||
#include <QString>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
class CardItem;
|
||||
class AbstractClient;
|
||||
class GameEventHandler;
|
||||
class GameMetaInfo;
|
||||
class GameReplay;
|
||||
class GameState;
|
||||
class PlayerManager;
|
||||
|
||||
class AbstractGame : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
#include "arrow_registry.h"
|
||||
|
||||
#include "../game_graphics/board/arrow_item.h"
|
||||
#include "board/arrow_data.h"
|
||||
|
||||
#include <QSharedPointer>
|
||||
|
||||
void ArrowRegistry::insert(QSharedPointer<ArrowData> data, ArrowItem *arrow)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
#ifndef COCKATRICE_ARROW_REGISTRY_H
|
||||
#define COCKATRICE_ARROW_REGISTRY_H
|
||||
|
||||
#include "board/arrow_data.h"
|
||||
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QSet>
|
||||
#include <QSharedPointer>
|
||||
|
||||
class ArrowItem;
|
||||
struct ArrowData;
|
||||
template <class T> class QSharedPointer;
|
||||
|
||||
struct ArrowKey
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
#include "arrow_data.h"
|
||||
|
||||
#include "libcockatrice/protocol/pb/serverinfo_arrow.pb.h"
|
||||
#include "libcockatrice/utility/color.h"
|
||||
|
||||
ArrowData ArrowData::fromProto(const ServerInfo_Arrow &arrow, int creatorId, bool isLocalCreator)
|
||||
{
|
||||
ArrowData data;
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
#include <QColor>
|
||||
#include <QString>
|
||||
#include <libcockatrice/protocol/pb/serverinfo_arrow.pb.h>
|
||||
#include <libcockatrice/utility/color.h>
|
||||
|
||||
class ServerInfo_Arrow;
|
||||
|
||||
struct ArrowData
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,9 +1,14 @@
|
|||
#include "card_list.h"
|
||||
|
||||
#include "../../game_graphics/board/card_item.h"
|
||||
#include "libcockatrice/card/printing/exact_card.h"
|
||||
|
||||
#include <QChar>
|
||||
#include <QDebug>
|
||||
#include <QMessageLogger>
|
||||
#include <QSharedPointer>
|
||||
#include <algorithm>
|
||||
#include <compare>
|
||||
#include <libcockatrice/card/card_info.h>
|
||||
|
||||
CardList::CardList(bool _contentsKnown) : QList<CardItem *>(), contentsKnown(_contentsKnown)
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
#include <QList>
|
||||
#include <QLoggingCategory>
|
||||
#include <QString>
|
||||
#include <functional>
|
||||
|
||||
inline Q_LOGGING_CATEGORY(CardListLog, "card_list");
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#include "card_state.h"
|
||||
|
||||
#include <QSharedPointer>
|
||||
|
||||
void CardState::resetState(bool keepAnnotations)
|
||||
{
|
||||
attacking = false;
|
||||
|
|
|
|||
|
|
@ -3,9 +3,12 @@
|
|||
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
class CardZoneLogic;
|
||||
class CardItem;
|
||||
|
||||
class CardState : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#include "counter_state.h"
|
||||
|
||||
#include "libcockatrice/protocol/pb/serverinfo_counter.pb.h"
|
||||
|
||||
#include <libcockatrice/utility/color.h>
|
||||
|
||||
CounterState::CounterState(int id, const QString &name, const QColor &color, int radius, int value, QObject *parent)
|
||||
|
|
@ -13,12 +15,12 @@ CounterState *CounterState::fromProto(const ServerInfo_Counter &counter, QObject
|
|||
convertColorToQColor(counter.counter_color()), counter.radius(), counter.count(), parent);
|
||||
}
|
||||
|
||||
void CounterState::setValue(int newValue)
|
||||
void CounterState::setValue(int newValue, bool skipDamageAnimation)
|
||||
{
|
||||
if (newValue == value) {
|
||||
return;
|
||||
}
|
||||
int old = value;
|
||||
value = newValue;
|
||||
emit valueChanged(old, newValue);
|
||||
emit valueChanged(old, newValue, skipDamageAnimation);
|
||||
}
|
||||
|
|
@ -4,7 +4,9 @@
|
|||
#include <QColor>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <libcockatrice/protocol/pb/serverinfo_counter.pb.h>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
class ServerInfo_Counter;
|
||||
|
||||
class CounterState : public QObject
|
||||
{
|
||||
|
|
@ -35,10 +37,23 @@ public:
|
|||
return value;
|
||||
}
|
||||
|
||||
void setValue(int newValue);
|
||||
/**
|
||||
* @brief Set the counter value.
|
||||
* @param newValue The new value.
|
||||
* @param skipDamageAnimation When true, valueChanged is emitted with skipDamageAnimation=true, letting views
|
||||
* suppress damage-related feedback (e.g. battlefield shimmer, life counter flash) for values set during replay
|
||||
* rewinds.
|
||||
*/
|
||||
void setValue(int newValue, bool skipDamageAnimation = false);
|
||||
|
||||
signals:
|
||||
void valueChanged(int oldValue, int newValue);
|
||||
/**
|
||||
* @brief Emitted whenever the value changes.
|
||||
* @param oldValue The previous value.
|
||||
* @param newValue The new value.
|
||||
* @param skipDamageAnimation True when the change should not trigger damage/life-change feedback in views.
|
||||
*/
|
||||
void valueChanged(int oldValue, int newValue, bool skipDamageAnimation);
|
||||
|
||||
private:
|
||||
int id;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,17 @@
|
|||
#include "game.h"
|
||||
|
||||
#include "../interface/widgets/tabs/tab_game.h"
|
||||
#include "game_meta_info.h"
|
||||
#include "game_state.h"
|
||||
#include "player/player_manager.h"
|
||||
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QString>
|
||||
#include <libcockatrice/protocol/pb/event_game_joined.pb.h>
|
||||
|
||||
class AbstractClient;
|
||||
class QObject;
|
||||
|
||||
Game::Game(QObject *_parent,
|
||||
bool isLocalGame,
|
||||
QList<AbstractClient *> &_clients,
|
||||
|
|
|
|||
|
|
@ -9,7 +9,14 @@
|
|||
|
||||
#include "abstract_game.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
class AbstractClient;
|
||||
class Event_GameJoined;
|
||||
class QObject;
|
||||
class QString;
|
||||
template <class Key, class T> class QMap;
|
||||
template <typename T> class QList;
|
||||
|
||||
class Game : public AbstractGame
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,9 +1,30 @@
|
|||
#include "game_event_handler.h"
|
||||
|
||||
#include "../game_graphics/log/message_log_widget.h"
|
||||
#include "../interface/widgets/tabs/tab_game.h"
|
||||
#include "abstract_game.h"
|
||||
#include "game_meta_info.h"
|
||||
#include "game_state.h"
|
||||
#include "libcockatrice/protocol/pb/commands.pb.h"
|
||||
#include "libcockatrice/protocol/pb/game_commands.pb.h"
|
||||
#include "libcockatrice/protocol/pb/game_event.pb.h"
|
||||
#include "libcockatrice/protocol/pb/game_event_context.pb.h"
|
||||
#include "libcockatrice/protocol/pb/response.pb.h"
|
||||
#include "libcockatrice/protocol/pb/serverinfo_game.pb.h"
|
||||
#include "libcockatrice/protocol/pb/serverinfo_player.pb.h"
|
||||
#include "libcockatrice/protocol/pb/serverinfo_playerproperties.pb.h"
|
||||
#include "libcockatrice/protocol/pb/serverinfo_user.pb.h"
|
||||
#include "player/player_event_handler.h"
|
||||
#include "player/player_info.h"
|
||||
#include "player/player_logic.h"
|
||||
#include "player/player_manager.h"
|
||||
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QMapIterator>
|
||||
#include <QMessageLogger>
|
||||
#include <QSharedPointer>
|
||||
#include <google/protobuf/descriptor.h>
|
||||
#include <google/protobuf/message.h>
|
||||
#include <google/protobuf/stubs/port.h>
|
||||
#include <libcockatrice/network/client/abstract/abstract_client.h>
|
||||
#include <libcockatrice/protocol/get_pb_extension.h>
|
||||
#include <libcockatrice/protocol/pb/command_concede.pb.h>
|
||||
|
|
@ -13,7 +34,6 @@
|
|||
#include <libcockatrice/protocol/pb/command_next_turn.pb.h>
|
||||
#include <libcockatrice/protocol/pb/command_reverse_turn.pb.h>
|
||||
#include <libcockatrice/protocol/pb/command_set_active_phase.pb.h>
|
||||
#include <libcockatrice/protocol/pb/context_connection_state_changed.pb.h>
|
||||
#include <libcockatrice/protocol/pb/context_deck_select.pb.h>
|
||||
#include <libcockatrice/protocol/pb/event_game_closed.pb.h>
|
||||
#include <libcockatrice/protocol/pb/event_game_host_changed.pb.h>
|
||||
|
|
@ -28,6 +48,8 @@
|
|||
#include <libcockatrice/protocol/pb/event_set_active_player.pb.h>
|
||||
#include <libcockatrice/protocol/pb/game_event_container.pb.h>
|
||||
#include <libcockatrice/protocol/pending_command.h>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
GameEventHandler::GameEventHandler(AbstractGame *_game) : QObject(_game), game(_game)
|
||||
{
|
||||
|
|
@ -229,7 +251,11 @@ void GameEventHandler::handleArrowDeletion(int creatorId, int arrowId)
|
|||
|
||||
void GameEventHandler::handleArrowDeletionFinished(const Response &response, int creatorId, int arrowId)
|
||||
{
|
||||
if (response.response_code() == Response::RespNameNotFound) {
|
||||
// The server confirms the arrow no longer exists whether it deleted it itself
|
||||
// (RespOk, followed by an Event_DeleteArrow broadcast) or never had it
|
||||
// (RespNameNotFound). In both cases the local copy has to go. deleteArrow is
|
||||
// a no-op if the arrow was already removed by the event broadcast.
|
||||
if (response.response_code() == Response::RespOk || response.response_code() == Response::RespNameNotFound) {
|
||||
emit arrowDeleted(creatorId, arrowId);
|
||||
}
|
||||
}
|
||||
|
|
@ -281,12 +307,19 @@ void GameEventHandler::eventGameStateChanged(const Event_GameStateChanged &event
|
|||
emit playerJoined(prop);
|
||||
}
|
||||
player->processPlayerInfo(playerInfo);
|
||||
// Extract playmat from player properties for opponent display
|
||||
if (prop.has_playmat_params()) {
|
||||
player->setPlaymatFromProperties(prop);
|
||||
}
|
||||
if (player->getPlayerInfo()->getLocal()) {
|
||||
emit localPlayerDeckSelected(player, playerId, playerInfo);
|
||||
} else {
|
||||
if (!game->getGameMetaInfo()->proto().share_decklists_on_load()) {
|
||||
continue;
|
||||
}
|
||||
if (!playerInfo.has_deck_list()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
opponentDecksToDisplay.append(
|
||||
qMakePair(playerId, qMakePair(playerName, QString::fromStdString(playerInfo.deck_list()))));
|
||||
|
|
@ -344,6 +377,11 @@ void GameEventHandler::eventPlayerPropertiesChanged(const Event_PlayerProperties
|
|||
const ServerInfo_PlayerProperties &prop = event.player_properties();
|
||||
emit playerPropertiesChanged(prop, eventPlayerId);
|
||||
|
||||
// Update playmat from player properties
|
||||
if (prop.has_playmat_params()) {
|
||||
player->setPlaymatFromProperties(prop);
|
||||
}
|
||||
|
||||
const auto contextType = static_cast<GameEventContext::ContextType>(getPbExtension(context));
|
||||
switch (contextType) {
|
||||
case GameEventContext::READY_START: {
|
||||
|
|
@ -414,12 +452,13 @@ void GameEventHandler::eventJoin(const Event_Join &event, int /*eventPlayerId*/,
|
|||
QString playerName = QString::fromStdString(playerInfo.user_info().name());
|
||||
emit addPlayerToAutoCompleteList(playerName);
|
||||
|
||||
if (game->getPlayerManager()->getPlayers().contains(playerId)) {
|
||||
PlayerManager *playerManager = game->getPlayerManager();
|
||||
if (playerManager->getPlayers().contains(playerId) || playerManager->getSpectators().contains(playerId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (playerInfo.spectator()) {
|
||||
game->getPlayerManager()->addSpectator(playerId, playerInfo);
|
||||
playerManager->addSpectator(playerId, playerInfo);
|
||||
emit logJoinSpectator(playerName);
|
||||
emit spectatorJoined(playerInfo);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -19,23 +19,29 @@
|
|||
|
||||
#include <QLoggingCategory>
|
||||
#include <QObject>
|
||||
#include <QPair>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
#include <libcockatrice/protocol/pb/event_leave.pb.h>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
// IWYU pragma: keep
|
||||
// GameEventContext, ServerInfo_Player and ServerInfo_User are passed by value
|
||||
// to signals and slots, so the moc-generated code needs the complete types.
|
||||
#include <libcockatrice/protocol/pb/game_event_context.pb.h>
|
||||
#include <libcockatrice/protocol/pb/serverinfo_player.pb.h>
|
||||
#include <libcockatrice/protocol/pb/serverinfo_user.pb.h>
|
||||
|
||||
class AbstractClient;
|
||||
class AbstractGame;
|
||||
class CommandContainer;
|
||||
class GameCommand;
|
||||
class GameEventContainer;
|
||||
class GameEventContext;
|
||||
class PendingCommand;
|
||||
class PlayerLogic;
|
||||
class Response;
|
||||
|
||||
class Event_GameStateChanged;
|
||||
class Event_PlayerPropertiesChanged;
|
||||
class Event_Join;
|
||||
class Event_Leave;
|
||||
class Event_GameHostChanged;
|
||||
class Event_GameClosed;
|
||||
class Event_SetActivePlayer;
|
||||
|
|
@ -44,6 +50,15 @@ class Event_GameSay;
|
|||
class Event_Kicked;
|
||||
class Event_ReverseTurn;
|
||||
class Event_Ping;
|
||||
class ServerInfo_PlayerProperties;
|
||||
namespace google
|
||||
{
|
||||
namespace protobuf
|
||||
{
|
||||
class Message;
|
||||
} // namespace protobuf
|
||||
} // namespace google
|
||||
template <typename T> class QList;
|
||||
|
||||
inline Q_LOGGING_CATEGORY(GameEventHandlerLog, "game_event_handler");
|
||||
|
||||
|
|
|
|||
|
|
@ -9,13 +9,16 @@
|
|||
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <libcockatrice/protocol/pb/serverinfo_game.pb.h>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
// Translation layer class to expose protobuf safely and hook it up to Qt Signals.
|
||||
// This class de-couples the domain object (i.e. the GameMetaInfo) from the network object.
|
||||
// If the network object changes, only this class needs to be adjusted.
|
||||
|
||||
class AbstractGame;
|
||||
|
||||
class GameMetaInfo : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
|
|||