mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-08 17:13:57 -07:00
Merge branch 'master' into ci/delete-merged-caches
This commit is contained in:
commit
0aa0812f0e
456 changed files with 8058 additions and 4000 deletions
|
|
@ -122,7 +122,7 @@ if [[ $MAKE_SERVER ]]; then
|
||||||
flags+=("-DWITH_SERVER=1")
|
flags+=("-DWITH_SERVER=1")
|
||||||
fi
|
fi
|
||||||
if [[ $MAKE_NO_CLIENT ]]; then
|
if [[ $MAKE_NO_CLIENT ]]; then
|
||||||
flags+=("-DWITH_CLIENT=0" "-DWITH_ORACLE=0" "-DWITH_DBCONVERTER=0")
|
flags+=("-DWITH_CLIENT=0" "-DWITH_ORACLE=0")
|
||||||
fi
|
fi
|
||||||
if [[ $MAKE_TEST ]]; then
|
if [[ $MAKE_TEST ]]; then
|
||||||
flags+=("-DTEST=1")
|
flags+=("-DTEST=1")
|
||||||
|
|
@ -246,7 +246,7 @@ fi
|
||||||
|
|
||||||
if [[ $RUNNER_OS == macOS ]]; then
|
if [[ $RUNNER_OS == macOS ]]; then
|
||||||
echo "::group::Inspect Mach-O binaries"
|
echo "::group::Inspect Mach-O binaries"
|
||||||
for app in cockatrice oracle servatrice dbconverter; do
|
for app in cockatrice oracle servatrice; do
|
||||||
binary="$GITHUB_WORKSPACE/build/$app/$app.app/Contents/MacOS/$app"
|
binary="$GITHUB_WORKSPACE/build/$app/$app.app/Contents/MacOS/$app"
|
||||||
echo "Inspecting $app..."
|
echo "Inspecting $app..."
|
||||||
vtool -show-build "$binary"
|
vtool -show-build "$binary"
|
||||||
|
|
|
||||||
42
.github/workflows/desktop-build.yml
vendored
42
.github/workflows/desktop-build.yml
vendored
|
|
@ -166,7 +166,7 @@ jobs:
|
||||||
|
|
||||||
- name: Restore compiler cache (ccache)
|
- name: Restore compiler cache (ccache)
|
||||||
id: ccache_restore
|
id: ccache_restore
|
||||||
uses: actions/cache/restore@v4
|
uses: actions/cache/restore@v5
|
||||||
env:
|
env:
|
||||||
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
|
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
|
||||||
with:
|
with:
|
||||||
|
|
@ -205,7 +205,7 @@ jobs:
|
||||||
|
|
||||||
- name: Save compiler cache (ccache)
|
- name: Save compiler cache (ccache)
|
||||||
if: github.ref == 'refs/heads/master'
|
if: github.ref == 'refs/heads/master'
|
||||||
uses: actions/cache/save@v4
|
uses: actions/cache/save@v5
|
||||||
with:
|
with:
|
||||||
path: ${{env.CACHE}}
|
path: ${{env.CACHE}}
|
||||||
key: ${{ steps.ccache_restore.outputs.cache-primary-key }}
|
key: ${{ steps.ccache_restore.outputs.cache-primary-key }}
|
||||||
|
|
@ -213,7 +213,7 @@ jobs:
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
id: upload_artifact
|
id: upload_artifact
|
||||||
if: matrix.package != 'skip'
|
if: matrix.package != 'skip'
|
||||||
uses: actions/upload-artifact@v5
|
uses: actions/upload-artifact@v6
|
||||||
with:
|
with:
|
||||||
name: ${{matrix.distro}}${{matrix.version}}-package
|
name: ${{matrix.distro}}${{matrix.version}}-package
|
||||||
path: ${{steps.build.outputs.path}}
|
path: ${{steps.build.outputs.path}}
|
||||||
|
|
@ -342,6 +342,11 @@ jobs:
|
||||||
name: ${{matrix.os}} ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }}
|
name: ${{matrix.os}} ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }}
|
||||||
needs: configure
|
needs: configure
|
||||||
runs-on: ${{matrix.runner}}
|
runs-on: ${{matrix.runner}}
|
||||||
|
env:
|
||||||
|
CCACHE_DIR: ${{github.workspace}}/.cache/
|
||||||
|
# Cache size over the entire repo is 10Gi:
|
||||||
|
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policy
|
||||||
|
CCACHE_SIZE: 500M
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
|
@ -356,16 +361,20 @@ jobs:
|
||||||
with:
|
with:
|
||||||
msbuild-architecture: x64
|
msbuild-architecture: x64
|
||||||
|
|
||||||
# Using jianmingyong/ccache-action to setup ccache without using brew
|
|
||||||
# It tries to download a binary of ccache from GitHub Release and falls back to building from source if it fails
|
|
||||||
- name: Setup ccache
|
- name: Setup ccache
|
||||||
|
if: matrix.use_ccache == 1 && matrix.os == 'macOS'
|
||||||
|
run: brew install ccache
|
||||||
|
|
||||||
|
- name: Restore compiler cache (ccache)
|
||||||
if: matrix.use_ccache == 1
|
if: matrix.use_ccache == 1
|
||||||
uses: jianmingyong/ccache-action@v1
|
id: ccache_restore
|
||||||
|
uses: actions/cache/restore@v5
|
||||||
|
env:
|
||||||
|
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
|
||||||
with:
|
with:
|
||||||
install-type: "binary"
|
path: ${{env.CCACHE_DIR}}
|
||||||
ccache-key-prefix: ccache-${{matrix.runner}}-${{matrix.soc}}-${{matrix.type}}
|
key: ccache-${{matrix.runner}}-${{matrix.soc}}-${{matrix.type}}-${{env.BRANCH_NAME}}
|
||||||
max-size: 500M
|
restore-keys: ccache-${{matrix.runner}}-${{matrix.soc}}-${{matrix.type}}-
|
||||||
gh-token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Install Qt ${{matrix.qt_version}}
|
- name: Install Qt ${{matrix.qt_version}}
|
||||||
uses: jurplel/install-qt-action@v4
|
uses: jurplel/install-qt-action@v4
|
||||||
|
|
@ -403,6 +412,15 @@ jobs:
|
||||||
TARGET_MACOS_VERSION: ${{ matrix.override_target }}
|
TARGET_MACOS_VERSION: ${{ matrix.override_target }}
|
||||||
run: .ci/compile.sh --server --test --vcpkg
|
run: .ci/compile.sh --server --test --vcpkg
|
||||||
|
|
||||||
|
- name: Save compiler cache (ccache)
|
||||||
|
if: github.ref == 'refs/heads/master' && matrix.use_ccache == 1
|
||||||
|
uses: actions/cache/save@v5
|
||||||
|
env:
|
||||||
|
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
|
||||||
|
with:
|
||||||
|
path: ${{env.CCACHE_DIR}}
|
||||||
|
key: ccache-${{matrix.runner}}-${{matrix.soc}}-${{matrix.type}}-${{env.BRANCH_NAME}}
|
||||||
|
|
||||||
- name: Sign app bundle
|
- name: Sign app bundle
|
||||||
if: matrix.os == 'macOS' && matrix.make_package && (github.ref == 'refs/heads/master' || needs.configure.outputs.tag != null)
|
if: matrix.os == 'macOS' && matrix.make_package && (github.ref == 'refs/heads/master' || needs.configure.outputs.tag != null)
|
||||||
env:
|
env:
|
||||||
|
|
@ -450,7 +468,7 @@ jobs:
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
id: upload_artifact
|
id: upload_artifact
|
||||||
if: matrix.make_package
|
if: matrix.make_package
|
||||||
uses: actions/upload-artifact@v5
|
uses: actions/upload-artifact@v6
|
||||||
with:
|
with:
|
||||||
name: ${{matrix.artifact_name}}
|
name: ${{matrix.artifact_name}}
|
||||||
path: ${{steps.build.outputs.path}}
|
path: ${{steps.build.outputs.path}}
|
||||||
|
|
@ -458,7 +476,7 @@ jobs:
|
||||||
|
|
||||||
- name: Upload pdb database
|
- name: Upload pdb database
|
||||||
if: matrix.os == 'Windows'
|
if: matrix.os == 'Windows'
|
||||||
uses: actions/upload-artifact@v5
|
uses: actions/upload-artifact@v6
|
||||||
with:
|
with:
|
||||||
name: Windows${{matrix.target}}-debug-pdbs
|
name: Windows${{matrix.target}}-debug-pdbs
|
||||||
path: |
|
path: |
|
||||||
|
|
|
||||||
2
.github/workflows/translations-pull.yml
vendored
2
.github/workflows/translations-pull.yml
vendored
|
|
@ -33,7 +33,7 @@ jobs:
|
||||||
- name: Create pull request
|
- name: Create pull request
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
id: create_pr
|
id: create_pr
|
||||||
uses: peter-evans/create-pull-request@v7
|
uses: peter-evans/create-pull-request@v8
|
||||||
with:
|
with:
|
||||||
add-paths: |
|
add-paths: |
|
||||||
cockatrice/translations/*.ts
|
cockatrice/translations/*.ts
|
||||||
|
|
|
||||||
2
.github/workflows/translations-push.yml
vendored
2
.github/workflows/translations-push.yml
vendored
|
|
@ -57,7 +57,7 @@ jobs:
|
||||||
- name: Create pull request
|
- name: Create pull request
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
id: create_pr
|
id: create_pr
|
||||||
uses: peter-evans/create-pull-request@v7
|
uses: peter-evans/create-pull-request@v8
|
||||||
with:
|
with:
|
||||||
add-paths: |
|
add-paths: |
|
||||||
cockatrice/cockatrice_en@source.ts
|
cockatrice/cockatrice_en@source.ts
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,6 @@ option(WITH_SERVER "build servatrice" OFF)
|
||||||
option(WITH_CLIENT "build cockatrice" ON)
|
option(WITH_CLIENT "build cockatrice" ON)
|
||||||
# Compile oracle
|
# Compile oracle
|
||||||
option(WITH_ORACLE "build oracle" ON)
|
option(WITH_ORACLE "build oracle" ON)
|
||||||
# Compile dbconverter
|
|
||||||
option(WITH_DBCONVERTER "build dbconverter" ON)
|
|
||||||
# Compile tests
|
# Compile tests
|
||||||
option(TEST "build tests" OFF)
|
option(TEST "build tests" OFF)
|
||||||
# Use vcpkg regardless of OS
|
# Use vcpkg regardless of OS
|
||||||
|
|
@ -356,11 +354,6 @@ if(WITH_ORACLE)
|
||||||
set(CPACK_INSTALL_CMAKE_PROJECTS "Oracle;Oracle;ALL;/" ${CPACK_INSTALL_CMAKE_PROJECTS})
|
set(CPACK_INSTALL_CMAKE_PROJECTS "Oracle;Oracle;ALL;/" ${CPACK_INSTALL_CMAKE_PROJECTS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_DBCONVERTER)
|
|
||||||
add_subdirectory(dbconverter)
|
|
||||||
set(CPACK_INSTALL_CMAKE_PROJECTS "Dbconverter;Dbconverter;ALL;/" ${CPACK_INSTALL_CMAKE_PROJECTS})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(TEST)
|
if(TEST)
|
||||||
include(CTest)
|
include(CTest)
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN mkdir build && cd build && \
|
RUN mkdir build && cd build && \
|
||||||
cmake .. -DWITH_SERVER=1 -DWITH_CLIENT=0 -DWITH_ORACLE=0 -DWITH_DBCONVERTER=0 && \
|
cmake .. -DWITH_SERVER=1 -DWITH_CLIENT=0 -DWITH_ORACLE=0 && \
|
||||||
make -j$(nproc) && \
|
make -j$(nproc) && \
|
||||||
make install
|
make install
|
||||||
|
|
||||||
|
|
|
||||||
1
Doxyfile
1
Doxyfile
|
|
@ -1068,7 +1068,6 @@ RECURSIVE = YES
|
||||||
|
|
||||||
EXCLUDE = build/ \
|
EXCLUDE = build/ \
|
||||||
cmake/ \
|
cmake/ \
|
||||||
dbconverter/ \
|
|
||||||
vcpkg/ \
|
vcpkg/ \
|
||||||
webclient/
|
webclient/
|
||||||
|
|
||||||
|
|
|
||||||
19
README.md
19
README.md
|
|
@ -46,7 +46,8 @@ Latest <kbd>beta</kbd> version:
|
||||||
|
|
||||||
- [Magic-Token](https://github.com/Cockatrice/Magic-Token): MtG token data to use in Cockatrice
|
- [Magic-Token](https://github.com/Cockatrice/Magic-Token): MtG token data to use in Cockatrice
|
||||||
- [Magic-Spoiler](https://github.com/Cockatrice/Magic-Spoiler): Script to generate MtG spoiler data from [MTGJSON](https://github.com/mtgjson/mtgjson) to use in Cockatrice
|
- [Magic-Spoiler](https://github.com/Cockatrice/Magic-Spoiler): Script to generate MtG spoiler data from [MTGJSON](https://github.com/mtgjson/mtgjson) to use in Cockatrice
|
||||||
- [cockatrice.github.io](https://github.com/Cockatrice/cockatrice.github.io): Code of the official webpage of the Cockatrice project
|
- [cockatrice.github.io](https://github.com/Cockatrice/cockatrice.github.io): Code of the official Cockatrice webpage
|
||||||
|
- [Cockatrice @Flathub](https://github.com/flathub/io.github.Cockatrice.cockatrice): Configuration for our Linux `flatpak` package
|
||||||
|
|
||||||
|
|
||||||
# Community Resources [](https://discord.gg/3Z9yzmA)
|
# Community Resources [](https://discord.gg/3Z9yzmA)
|
||||||
|
|
@ -54,11 +55,12 @@ Latest <kbd>beta</kbd> version:
|
||||||
Join our [Discord community](https://discord.gg/3Z9yzmA) to connect with other projet contributors (`#dev` channel) or fellow users of the app. Come here to talk about the application, features, or just to hang out.
|
Join our [Discord community](https://discord.gg/3Z9yzmA) to connect with other projet contributors (`#dev` channel) or fellow users of the app. Come here to talk about the application, features, or just to hang out.
|
||||||
- [Official Website](https://cockatrice.github.io)
|
- [Official Website](https://cockatrice.github.io)
|
||||||
- [Official Wiki](https://github.com/Cockatrice/Cockatrice/wiki)
|
- [Official Wiki](https://github.com/Cockatrice/Cockatrice/wiki)
|
||||||
|
- [Official Code Documentation](https://cockatrice.github.io/docs)
|
||||||
- [Official Discord](https://discord.gg/3Z9yzmA)
|
- [Official Discord](https://discord.gg/3Z9yzmA)
|
||||||
- [reddit r/Cockatrice](https://reddit.com/r/cockatrice)
|
- [reddit r/Cockatrice](https://reddit.com/r/cockatrice)
|
||||||
|
|
||||||
>[!IMPORTANT]
|
> [!IMPORTANT]
|
||||||
>For support regarding specific servers, please contact that server's admin/mods and use their dedicated communication channels rather than contacting the team building the software.
|
> For support regarding specific servers, please contact that server's admin/mods and use their dedicated communication channels rather than contacting the team building the software.
|
||||||
|
|
||||||
|
|
||||||
# Contribute
|
# Contribute
|
||||||
|
|
@ -75,10 +77,15 @@ This tag is used for issues that we are looking for somebody to pick up. Often t
|
||||||
For both tags, we're willing to provide help to contributors in showing them where and how they can make changes, as well as code reviews for submitted changes.<br>
|
For both tags, we're willing to provide help to contributors in showing them where and how they can make changes, as well as code reviews for submitted changes.<br>
|
||||||
We'll happily advice on how best to implement a feature, or we can show you where the codebase is doing something similar before you get too far along - put a note on an issue you want to discuss more on!
|
We'll happily advice on how best to implement a feature, or we can show you where the codebase is doing something similar before you get too far along - put a note on an issue you want to discuss more on!
|
||||||
|
|
||||||
|
You can also have a look at our `Todo List` in our [Code Documentation](https://cockatrice.github.io/docs) or search the repo for [`\todo` comments](https://github.com/search?q=repo%3ACockatrice%2FCockatrice%20%5Ctodo&type=code).
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
|
#### Repository Activity
|
||||||
|

|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary><b>Kudos to our amazing contributors ❤️</b></summary>
|
<summary><b>Kudos to all our amazing contributors ❤️</b></summary>
|
||||||
<br>
|
<br>
|
||||||
<a href="https://github.com/Cockatrice/Cockatrice/graphs/contributors">
|
<a href="https://github.com/Cockatrice/Cockatrice/graphs/contributors">
|
||||||
<img src="https://contrib.rocks/image?repo=Cockatrice/Cockatrice" />
|
<img src="https://contrib.rocks/image?repo=Cockatrice/Cockatrice" />
|
||||||
|
|
@ -124,8 +131,8 @@ You can then
|
||||||
make package
|
make package
|
||||||
```
|
```
|
||||||
|
|
||||||
>[!NOTE]
|
> [!NOTE]
|
||||||
>Detailed compiling instructions can be found in the Cockatrice wiki at [Compiling Cockatrice](https://github.com/Cockatrice/Cockatrice/wiki/Compiling-Cockatrice)
|
> Detailed compiling instructions can be found in the Cockatrice wiki at [Compiling Cockatrice](https://github.com/Cockatrice/Cockatrice/wiki/Compiling-Cockatrice)
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,6 @@ tell disk image_name
|
||||||
set position of item "Cockatrice.app" to { 139, 214 }
|
set position of item "Cockatrice.app" to { 139, 214 }
|
||||||
set position of item "Oracle.app" to { 139, 414 }
|
set position of item "Oracle.app" to { 139, 414 }
|
||||||
set position of item "Servatrice.app" to { 139, 614 }
|
set position of item "Servatrice.app" to { 139, 614 }
|
||||||
set position of item "dbconverter.app" to { 1400, 1400 }
|
|
||||||
set position of item "Applications" to { 861, 414 }
|
set position of item "Applications" to { 861, 414 }
|
||||||
end tell
|
end tell
|
||||||
update without registering applications
|
update without registering applications
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,11 @@
|
||||||
# Find a compatible Qt version
|
# Find a compatible Qt version
|
||||||
# Inputs: WITH_SERVER, WITH_CLIENT, WITH_ORACLE, WITH_DBCONVERTER, FORCE_USE_QT5
|
# Inputs: WITH_SERVER, WITH_CLIENT, WITH_ORACLE, FORCE_USE_QT5
|
||||||
# Optional Input: QT6_DIR -- Hint as to where Qt6 lives on the system
|
# Optional Input: QT6_DIR -- Hint as to where Qt6 lives on the system
|
||||||
# Optional Input: QT5_DIR -- Hint as to where Qt5 lives on the system
|
# Optional Input: QT5_DIR -- Hint as to where Qt5 lives on the system
|
||||||
# Output: COCKATRICE_QT_VERSION_NAME -- Example values: Qt5, Qt6
|
# Output: COCKATRICE_QT_VERSION_NAME -- Example values: Qt5, Qt6
|
||||||
# Output: SERVATRICE_QT_MODULES
|
# Output: SERVATRICE_QT_MODULES
|
||||||
# Output: COCKATRICE_QT_MODULES
|
# Output: COCKATRICE_QT_MODULES
|
||||||
# Output: ORACLE_QT_MODULES
|
# Output: ORACLE_QT_MODULES
|
||||||
# Output: DBCONVERTER_QT_MODULES
|
|
||||||
# Output: TEST_QT_MODULES
|
# Output: TEST_QT_MODULES
|
||||||
|
|
||||||
set(REQUIRED_QT_COMPONENTS Core)
|
set(REQUIRED_QT_COMPONENTS Core)
|
||||||
|
|
@ -29,15 +28,12 @@ endif()
|
||||||
if(WITH_ORACLE)
|
if(WITH_ORACLE)
|
||||||
set(_ORACLE_NEEDED Concurrent Network Svg Widgets)
|
set(_ORACLE_NEEDED Concurrent Network Svg Widgets)
|
||||||
endif()
|
endif()
|
||||||
if(WITH_DBCONVERTER)
|
|
||||||
set(_DBCONVERTER_NEEDED Network Widgets)
|
|
||||||
endif()
|
|
||||||
if(TEST)
|
if(TEST)
|
||||||
set(_TEST_NEEDED Widgets)
|
set(_TEST_NEEDED Widgets)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(REQUIRED_QT_COMPONENTS ${REQUIRED_QT_COMPONENTS} ${_SERVATRICE_NEEDED} ${_COCKATRICE_NEEDED} ${_ORACLE_NEEDED}
|
set(REQUIRED_QT_COMPONENTS ${REQUIRED_QT_COMPONENTS} ${_SERVATRICE_NEEDED} ${_COCKATRICE_NEEDED} ${_ORACLE_NEEDED}
|
||||||
${_DBCONVERTER_NEEDED} ${_TEST_NEEDED}
|
${_TEST_NEEDED}
|
||||||
)
|
)
|
||||||
list(REMOVE_DUPLICATES REQUIRED_QT_COMPONENTS)
|
list(REMOVE_DUPLICATES REQUIRED_QT_COMPONENTS)
|
||||||
|
|
||||||
|
|
@ -63,7 +59,7 @@ if(Qt6_FOUND)
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
find_package(
|
find_package(
|
||||||
Qt5 5.8.0
|
Qt5 5.15.2
|
||||||
COMPONENTS ${REQUIRED_QT_COMPONENTS}
|
COMPONENTS ${REQUIRED_QT_COMPONENTS}
|
||||||
QUIET HINTS ${Qt5_DIR}
|
QUIET HINTS ${Qt5_DIR}
|
||||||
)
|
)
|
||||||
|
|
@ -112,7 +108,6 @@ message(DEBUG "QT_LIBRARY_DIR = ${QT_LIBRARY_DIR}")
|
||||||
string(REGEX REPLACE "([^;]+)" "${COCKATRICE_QT_VERSION_NAME}::\\1" SERVATRICE_QT_MODULES "${_SERVATRICE_NEEDED}")
|
string(REGEX REPLACE "([^;]+)" "${COCKATRICE_QT_VERSION_NAME}::\\1" SERVATRICE_QT_MODULES "${_SERVATRICE_NEEDED}")
|
||||||
string(REGEX REPLACE "([^;]+)" "${COCKATRICE_QT_VERSION_NAME}::\\1" COCKATRICE_QT_MODULES "${_COCKATRICE_NEEDED}")
|
string(REGEX REPLACE "([^;]+)" "${COCKATRICE_QT_VERSION_NAME}::\\1" COCKATRICE_QT_MODULES "${_COCKATRICE_NEEDED}")
|
||||||
string(REGEX REPLACE "([^;]+)" "${COCKATRICE_QT_VERSION_NAME}::\\1" ORACLE_QT_MODULES "${_ORACLE_NEEDED}")
|
string(REGEX REPLACE "([^;]+)" "${COCKATRICE_QT_VERSION_NAME}::\\1" ORACLE_QT_MODULES "${_ORACLE_NEEDED}")
|
||||||
string(REGEX REPLACE "([^;]+)" "${COCKATRICE_QT_VERSION_NAME}::\\1" DB_CONVERTER_QT_MODULES "${_DBCONVERTER_NEEDED}")
|
|
||||||
string(REGEX REPLACE "([^;]+)" "${COCKATRICE_QT_VERSION_NAME}::\\1" TEST_QT_MODULES "${_TEST_NEEDED}")
|
string(REGEX REPLACE "([^;]+)" "${COCKATRICE_QT_VERSION_NAME}::\\1" TEST_QT_MODULES "${_TEST_NEEDED}")
|
||||||
|
|
||||||
# Core-only export (useful for headless libs)
|
# Core-only export (useful for headless libs)
|
||||||
|
|
|
||||||
|
|
@ -213,7 +213,6 @@ ${AndIf} ${FileExists} "$INSTDIR\portable.dat"
|
||||||
Delete "$INSTDIR\uninstall.exe"
|
Delete "$INSTDIR\uninstall.exe"
|
||||||
Delete "$INSTDIR\cockatrice.exe"
|
Delete "$INSTDIR\cockatrice.exe"
|
||||||
Delete "$INSTDIR\oracle.exe"
|
Delete "$INSTDIR\oracle.exe"
|
||||||
Delete "$INSTDIR\dbconverter.exe"
|
|
||||||
Delete "$INSTDIR\servatrice.exe"
|
Delete "$INSTDIR\servatrice.exe"
|
||||||
Delete "$INSTDIR\Qt*.dll"
|
Delete "$INSTDIR\Qt*.dll"
|
||||||
Delete "$INSTDIR\libmysql.dll"
|
Delete "$INSTDIR\libmysql.dll"
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
string(LENGTH "$ENV{MACOS_CERTIFICATE_NAME}" MACOS_CERTIFICATE_NAME_LEN)
|
string(LENGTH "$ENV{MACOS_CERTIFICATE_NAME}" MACOS_CERTIFICATE_NAME_LEN)
|
||||||
|
|
||||||
if(APPLE AND MACOS_CERTIFICATE_NAME_LEN GREATER 0)
|
if(APPLE AND MACOS_CERTIFICATE_NAME_LEN GREATER 0)
|
||||||
set(APPLICATIONS "cockatrice" "servatrice" "oracle" "dbconverter")
|
set(APPLICATIONS "cockatrice" "servatrice" "oracle")
|
||||||
foreach(app_name IN LISTS APPLICATIONS)
|
foreach(app_name IN LISTS APPLICATIONS)
|
||||||
set(FULL_APP_PATH "${CPACK_TEMPORARY_INSTALL_DIRECTORY}/${app_name}.app")
|
set(FULL_APP_PATH "${CPACK_TEMPORARY_INSTALL_DIRECTORY}/${app_name}.app")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,10 @@ set(cockatrice_SOURCES
|
||||||
src/client/settings/card_counter_settings.cpp
|
src/client/settings/card_counter_settings.cpp
|
||||||
src/client/settings/shortcut_treeview.cpp
|
src/client/settings/shortcut_treeview.cpp
|
||||||
src/client/settings/shortcuts_settings.cpp
|
src/client/settings/shortcuts_settings.cpp
|
||||||
|
src/interface/deck_loader/card_node_function.cpp
|
||||||
|
src/interface/deck_loader/deck_file_format.cpp
|
||||||
src/interface/deck_loader/deck_loader.cpp
|
src/interface/deck_loader/deck_loader.cpp
|
||||||
|
src/interface/deck_loader/loaded_deck.cpp
|
||||||
src/interface/widgets/dialogs/dlg_connect.cpp
|
src/interface/widgets/dialogs/dlg_connect.cpp
|
||||||
src/interface/widgets/dialogs/dlg_convert_deck_to_cod_format.cpp
|
src/interface/widgets/dialogs/dlg_convert_deck_to_cod_format.cpp
|
||||||
src/interface/widgets/dialogs/dlg_create_game.cpp
|
src/interface/widgets/dialogs/dlg_create_game.cpp
|
||||||
|
|
@ -142,6 +145,7 @@ set(cockatrice_SOURCES
|
||||||
src/interface/widgets/cards/deck_card_zone_display_widget.cpp
|
src/interface/widgets/cards/deck_card_zone_display_widget.cpp
|
||||||
src/interface/widgets/cards/deck_preview_card_picture_widget.cpp
|
src/interface/widgets/cards/deck_preview_card_picture_widget.cpp
|
||||||
src/interface/widgets/deck_analytics/deck_analytics_widget.cpp
|
src/interface/widgets/deck_analytics/deck_analytics_widget.cpp
|
||||||
|
src/interface/widgets/deck_analytics/deck_list_statistics_analyzer.cpp
|
||||||
src/interface/widgets/deck_analytics/mana_base_widget.cpp
|
src/interface/widgets/deck_analytics/mana_base_widget.cpp
|
||||||
src/interface/widgets/deck_analytics/mana_curve_widget.cpp
|
src/interface/widgets/deck_analytics/mana_curve_widget.cpp
|
||||||
src/interface/widgets/deck_analytics/mana_devotion_widget.cpp
|
src/interface/widgets/deck_analytics/mana_devotion_widget.cpp
|
||||||
|
|
@ -153,8 +157,10 @@ set(cockatrice_SOURCES
|
||||||
src/interface/widgets/deck_editor/deck_editor_printing_selector_dock_widget.cpp
|
src/interface/widgets/deck_editor/deck_editor_printing_selector_dock_widget.cpp
|
||||||
src/interface/widgets/deck_editor/deck_list_style_proxy.cpp
|
src/interface/widgets/deck_editor/deck_list_style_proxy.cpp
|
||||||
src/interface/widgets/general/background_sources.cpp
|
src/interface/widgets/general/background_sources.cpp
|
||||||
|
src/interface/widgets/general/display/background_plate_widget.cpp
|
||||||
src/interface/widgets/general/display/banner_widget.cpp
|
src/interface/widgets/general/display/banner_widget.cpp
|
||||||
src/interface/widgets/general/display/bar_widget.cpp
|
src/interface/widgets/general/display/bar_widget.cpp
|
||||||
|
src/interface/widgets/general/display/color_bar.cpp
|
||||||
src/interface/widgets/general/display/dynamic_font_size_label.cpp
|
src/interface/widgets/general/display/dynamic_font_size_label.cpp
|
||||||
src/interface/widgets/general/display/dynamic_font_size_push_button.cpp
|
src/interface/widgets/general/display/dynamic_font_size_push_button.cpp
|
||||||
src/interface/widgets/general/display/labeled_input.cpp
|
src/interface/widgets/general/display/labeled_input.cpp
|
||||||
|
|
@ -196,12 +202,14 @@ set(cockatrice_SOURCES
|
||||||
src/interface/widgets/utility/sequence_edit.cpp
|
src/interface/widgets/utility/sequence_edit.cpp
|
||||||
src/interface/widgets/visual_database_display/visual_database_display_color_filter_widget.cpp
|
src/interface/widgets/visual_database_display/visual_database_display_color_filter_widget.cpp
|
||||||
src/interface/widgets/visual_database_display/visual_database_display_filter_save_load_widget.cpp
|
src/interface/widgets/visual_database_display/visual_database_display_filter_save_load_widget.cpp
|
||||||
|
src/interface/widgets/visual_database_display/visual_database_display_format_legality_filter_widget.cpp
|
||||||
src/interface/widgets/visual_database_display/visual_database_display_main_type_filter_widget.cpp
|
src/interface/widgets/visual_database_display/visual_database_display_main_type_filter_widget.cpp
|
||||||
src/interface/widgets/visual_database_display/visual_database_display_name_filter_widget.cpp
|
src/interface/widgets/visual_database_display/visual_database_display_name_filter_widget.cpp
|
||||||
src/interface/widgets/visual_database_display/visual_database_display_set_filter_widget.cpp
|
src/interface/widgets/visual_database_display/visual_database_display_set_filter_widget.cpp
|
||||||
src/interface/widgets/visual_database_display/visual_database_display_sub_type_filter_widget.cpp
|
src/interface/widgets/visual_database_display/visual_database_display_sub_type_filter_widget.cpp
|
||||||
src/interface/widgets/visual_database_display/visual_database_display_widget.cpp
|
src/interface/widgets/visual_database_display/visual_database_display_widget.cpp
|
||||||
src/interface/widgets/visual_database_display/visual_database_filter_display_widget.cpp
|
src/interface/widgets/visual_database_display/visual_database_filter_display_widget.cpp
|
||||||
|
src/interface/widgets/visual_deck_editor/visual_deck_display_options_widget.cpp
|
||||||
src/interface/widgets/visual_deck_editor/visual_deck_editor_sample_hand_widget.cpp
|
src/interface/widgets/visual_deck_editor/visual_deck_editor_sample_hand_widget.cpp
|
||||||
src/interface/widgets/visual_deck_editor/visual_deck_editor_widget.cpp
|
src/interface/widgets/visual_deck_editor/visual_deck_editor_widget.cpp
|
||||||
src/interface/widgets/visual_deck_storage/deck_preview/deck_preview_color_identity_filter_widget.cpp
|
src/interface/widgets/visual_deck_storage/deck_preview/deck_preview_color_identity_filter_widget.cpp
|
||||||
|
|
@ -220,6 +228,20 @@ set(cockatrice_SOURCES
|
||||||
src/interface/window_main.cpp
|
src/interface/window_main.cpp
|
||||||
src/main.cpp
|
src/main.cpp
|
||||||
src/interface/widgets/tabs/abstract_tab_deck_editor.cpp
|
src/interface/widgets/tabs/abstract_tab_deck_editor.cpp
|
||||||
|
src/interface/widgets/tabs/api/archidekt/tab_archidekt.cpp
|
||||||
|
src/interface/widgets/tabs/api/archidekt/api_response/archidekt_deck_listing_api_response.cpp
|
||||||
|
src/interface/widgets/tabs/api/archidekt/api_response/archidekt_formats.h
|
||||||
|
src/interface/widgets/tabs/api/archidekt/api_response/card/archidekt_api_response_card.cpp
|
||||||
|
src/interface/widgets/tabs/api/archidekt/api_response/card/archidekt_api_response_card_entry.cpp
|
||||||
|
src/interface/widgets/tabs/api/archidekt/api_response/card/archidekt_api_response_edition.cpp
|
||||||
|
src/interface/widgets/tabs/api/archidekt/api_response/deck/archidekt_api_response_deck.cpp
|
||||||
|
src/interface/widgets/tabs/api/archidekt/api_response/deck/archidekt_api_response_deck_category.cpp
|
||||||
|
src/interface/widgets/tabs/api/archidekt/api_response/deck_listings/archidekt_api_response_deck_listing_container.cpp
|
||||||
|
src/interface/widgets/tabs/api/archidekt/api_response/deck_listings/archidekt_api_response_deck_owner.cpp
|
||||||
|
src/interface/widgets/tabs/api/archidekt/display/archidekt_api_response_deck_display_widget.cpp
|
||||||
|
src/interface/widgets/tabs/api/archidekt/display/archidekt_api_response_deck_entry_display_widget.cpp
|
||||||
|
src/interface/widgets/tabs/api/archidekt/display/archidekt_api_response_deck_listings_display_widget.cpp
|
||||||
|
src/interface/widgets/tabs/api/archidekt/display/archidekt_deck_preview_image_display_widget.cpp
|
||||||
src/interface/widgets/tabs/api/edhrec/api_response/archidekt_links/edhrec_api_response_archidekt_links.cpp
|
src/interface/widgets/tabs/api/edhrec/api_response/archidekt_links/edhrec_api_response_archidekt_links.cpp
|
||||||
src/interface/widgets/tabs/api/edhrec/api_response/average_deck/edhrec_average_deck_api_response.cpp
|
src/interface/widgets/tabs/api/edhrec/api_response/average_deck/edhrec_average_deck_api_response.cpp
|
||||||
src/interface/widgets/tabs/api/edhrec/api_response/average_deck/edhrec_deck_api_response.cpp
|
src/interface/widgets/tabs/api/edhrec/api_response/average_deck/edhrec_deck_api_response.cpp
|
||||||
|
|
@ -265,6 +287,10 @@ set(cockatrice_SOURCES
|
||||||
src/interface/widgets/tabs/visual_deck_storage/tab_deck_storage_visual.cpp
|
src/interface/widgets/tabs/visual_deck_storage/tab_deck_storage_visual.cpp
|
||||||
src/interface/key_signals.cpp
|
src/interface/key_signals.cpp
|
||||||
src/interface/logger.cpp
|
src/interface/logger.cpp
|
||||||
|
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
|
||||||
|
src/interface/widgets/tabs/api/edhrec/display/commander/edhrec_commander_api_response_budget_navigation_widget.h
|
||||||
)
|
)
|
||||||
|
|
||||||
add_subdirectory(sounds)
|
add_subdirectory(sounds)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
[Rules]
|
[Rules]
|
||||||
# The default log level is info
|
# The default log level is info
|
||||||
*.debug = false
|
*.debug = false
|
||||||
|
#*.info = true
|
||||||
|
#*.warning = true
|
||||||
|
#*.critical = true
|
||||||
|
#*.fatal = true
|
||||||
|
|
||||||
# Uncomment a rule to see debug level logs for that category,
|
# Uncomment a rule to see debug level logs for that category,
|
||||||
# or set <category> = false to disable logging
|
# or set <category> = false to disable logging
|
||||||
|
|
|
||||||
|
|
@ -15,15 +15,18 @@ searches are case insensitive.
|
||||||
<dd>[n:red n:deck n:wins](#n:red n:deck n:wins) <small>(Any deck with a name containing the words red, deck, and wins)</small></dd>
|
<dd>[n:red n:deck n:wins](#n:red n:deck n:wins) <small>(Any deck with a name containing the words red, deck, and wins)</small></dd>
|
||||||
<dd>[n:"red deck wins"](#n:%22red deck wins%22) <small>(Any deck with a name containing the exact phrase "red deck wins")</small></dd>
|
<dd>[n:"red deck wins"](#n:%22red deck wins%22) <small>(Any deck with a name containing the exact phrase "red deck wins")</small></dd>
|
||||||
|
|
||||||
<dt><u>F</u>ile Name:</dt>
|
<dt><u>F</u>ile <u>N</u>ame:</dt>
|
||||||
<dd>[f:aggro](#f:aggro) <small>(Any deck with a filename containing the word aggro)</small></dd>
|
<dd>[fn:aggro](#fn:aggro) <small>(Any deck with a filename containing the word aggro)</small></dd>
|
||||||
<dd>[f:red f:deck f:wins](#f:red f:deck f:wins) <small>(Any deck with a filename containing the words red, deck, and wins)</small></dd>
|
<dd>[fn:red fn:deck fn:wins](#fn:red fn:deck fn:wins) <small>(Any deck with a filename containing the words red, deck, and wins)</small></dd>
|
||||||
<dd>[f:"red deck wins"](#f:%22red deck wins%22) <small>(Any deck with a filename containing the exact phrase "red deck wins")</small></dd>
|
<dd>[fn:"red deck wins"](#fn:%22red deck wins%22) <small>(Any deck with a filename containing the exact phrase "red deck wins")</small></dd>
|
||||||
|
|
||||||
<dt>Relative <u>P</u>ath (starting from the deck folder):</dt>
|
<dt>Relative <u>P</u>ath (starting from the deck folder):</dt>
|
||||||
<dd>[p:aggro](#p:aggro) <small>(Any deck that has "aggro" somewhere in its relative path)</small></dd>
|
<dd>[p:aggro](#p:aggro) <small>(Any deck that has "aggro" somewhere in its relative path)</small></dd>
|
||||||
<dd>[p:edh/](#p:edh/) <small>(Any deck with "edh/" in its relative path, A.K.A. decks in the "edh" folder)</small></dd>
|
<dd>[p:edh/](#p:edh/) <small>(Any deck with "edh/" in its relative path, A.K.A. decks in the "edh" folder)</small></dd>
|
||||||
|
|
||||||
|
<dt><u>F</u>ormat:</dt>
|
||||||
|
<dd>[f:standard](#f:standard) <small>(Any deck with format set to standard)</small></dd>
|
||||||
|
|
||||||
<dt>Deck Contents (Uses [card search expressions](#cardSearchSyntaxHelp)):</dt>
|
<dt>Deck Contents (Uses [card search expressions](#cardSearchSyntaxHelp)):</dt>
|
||||||
<dd><a href="#[[plains]]">[[plains]]</a> <small>(Any deck that contains at least one card with "plains" in its name)</small></dd>
|
<dd><a href="#[[plains]]">[[plains]]</a> <small>(Any deck that contains at least one card with "plains" in its name)</small></dd>
|
||||||
<dd><a href="#[[t:legendary]]">[[t:legendary]]</a> <small>(Any deck that contains at least one legendary)</small></dd>
|
<dd><a href="#[[t:legendary]]">[[t:legendary]]</a> <small>(Any deck that contains at least one legendary)</small></dd>
|
||||||
|
|
|
||||||
|
|
@ -350,11 +350,11 @@
|
||||||
style="fill-opacity:1;stroke:black;stroke-width:2.78220296;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
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 "
|
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)"
|
transform="translate(0,952.36218)"
|
||||||
id="right" />
|
id="left" />
|
||||||
<path
|
<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"
|
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"
|
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="left"
|
id="right"
|
||||||
inkscape:connector-curvature="0" />
|
inkscape:connector-curvature="0" />
|
||||||
<path
|
<path
|
||||||
style="display:inline;fill:url(#linearGradient3);fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3.77952756;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
|
style="display:inline;fill:url(#linearGradient3);fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3.77952756;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
|
|
@ -321,11 +321,11 @@
|
||||||
style="fill-opacity:1;stroke:black;stroke-width:2.78220296;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
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 "
|
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)"
|
transform="translate(0,952.36218)"
|
||||||
id="right" />
|
id="left" />
|
||||||
<path
|
<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"
|
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"
|
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="left"
|
id="right"
|
||||||
inkscape:connector-curvature="0" />
|
inkscape:connector-curvature="0" />
|
||||||
<path
|
<path
|
||||||
d="m 46.656521,12.167234 18.055171,18.054184 a 6.6081919,6.6078288 0 0 1 -0.126303,9.352065 6.6804126,6.6800456 0 0 1 -8.233169,1.011048 l -7.944268,7.943843 6.463762,6.445343 a 6.9331851,6.9328042 0 0 1 5.741536,2.022073 l 28.057729,28.092294 a 6.9962797,6.9958953 0 0 1 -9.894222,9.893685 L 50.719018,66.907526 A 7.0595711,7.0591833 0 0 1 49.18433,59.270613 l -5.741527,-5.741238 -7.944298,7.943843 A 6.716523,6.7161541 0 0 1 25.134866,69.832263 L 7.079684,51.778091 a 6.716523,6.7161541 0 0 1 8.39566,-10.345064 L 36.31101,20.59853 a 6.716523,6.7161541 0 0 1 10.345612,-8.431329 z"
|
d="m 46.656521,12.167234 18.055171,18.054184 a 6.6081919,6.6078288 0 0 1 -0.126303,9.352065 6.6804126,6.6800456 0 0 1 -8.233169,1.011048 l -7.944268,7.943843 6.463762,6.445343 a 6.9331851,6.9328042 0 0 1 5.741536,2.022073 l 28.057729,28.092294 a 6.9962797,6.9958953 0 0 1 -9.894222,9.893685 L 50.719018,66.907526 A 7.0595711,7.0591833 0 0 1 49.18433,59.270613 l -5.741527,-5.741238 -7.944298,7.943843 A 6.716523,6.7161541 0 0 1 25.134866,69.832263 L 7.079684,51.778091 a 6.716523,6.7161541 0 0 1 8.39566,-10.345064 L 36.31101,20.59853 a 6.716523,6.7161541 0 0 1 10.345612,-8.431329 z"
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
|
@ -340,11 +340,11 @@
|
||||||
style="fill-opacity:1;stroke:black;stroke-width:2.78220296;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
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 "
|
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)"
|
transform="translate(0,952.36218)"
|
||||||
id="right" />
|
id="left" />
|
||||||
<path
|
<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"
|
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"
|
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="left"
|
id="right"
|
||||||
inkscape:connector-curvature="0" />
|
inkscape:connector-curvature="0" />
|
||||||
<path
|
<path
|
||||||
sodipodi:type="star"
|
sodipodi:type="star"
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QNetworkAccessManager>
|
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QNetworkRequest>
|
#include <QNetworkRequest>
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
#include <QUrlQuery>
|
#include <QUrlQuery>
|
||||||
#include <libcockatrice/deck_list/deck_list.h>
|
#include <libcockatrice/deck_list/deck_list.h>
|
||||||
#include <libcockatrice/deck_list/deck_list_card_node.h>
|
#include <libcockatrice/deck_list/tree/deck_list_card_node.h>
|
||||||
|
#include <version_string.h>
|
||||||
|
|
||||||
DeckStatsInterface::DeckStatsInterface(CardDatabase &_cardDatabase, QObject *parent)
|
DeckStatsInterface::DeckStatsInterface(CardDatabase &_cardDatabase, QObject *parent)
|
||||||
: QObject(parent), cardDatabase(_cardDatabase)
|
: QObject(parent), cardDatabase(_cardDatabase)
|
||||||
|
|
@ -43,31 +43,32 @@ void DeckStatsInterface::queryFinished(QNetworkReply *reply)
|
||||||
deleteLater();
|
deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeckStatsInterface::getAnalyzeRequestData(DeckList *deck, QByteArray *data)
|
void DeckStatsInterface::getAnalyzeRequestData(const DeckList &deck, QByteArray &data)
|
||||||
{
|
{
|
||||||
DeckList deckWithoutTokens;
|
DeckList deckWithoutTokens;
|
||||||
copyDeckWithoutTokens(*deck, deckWithoutTokens);
|
copyDeckWithoutTokens(deck, deckWithoutTokens);
|
||||||
|
|
||||||
QUrl params;
|
QUrl params;
|
||||||
QUrlQuery urlQuery;
|
QUrlQuery urlQuery;
|
||||||
urlQuery.addQueryItem("deck", deckWithoutTokens.writeToString_Plain());
|
urlQuery.addQueryItem("deck", deckWithoutTokens.writeToString_Plain());
|
||||||
urlQuery.addQueryItem("decktitle", deck->getName());
|
urlQuery.addQueryItem("decktitle", deck.getName());
|
||||||
params.setQuery(urlQuery);
|
params.setQuery(urlQuery);
|
||||||
data->append(params.query(QUrl::EncodeReserved).toUtf8());
|
data.append(params.query(QUrl::EncodeReserved).toUtf8());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeckStatsInterface::analyzeDeck(DeckList *deck)
|
void DeckStatsInterface::analyzeDeck(const DeckList &deck)
|
||||||
{
|
{
|
||||||
QByteArray data;
|
QByteArray data;
|
||||||
getAnalyzeRequestData(deck, &data);
|
getAnalyzeRequestData(deck, data);
|
||||||
|
|
||||||
QNetworkRequest request(QUrl("https://deckstats.net/index.php"));
|
QNetworkRequest request(QUrl("https://deckstats.net/index.php"));
|
||||||
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
|
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
|
||||||
|
request.setHeader(QNetworkRequest::UserAgentHeader, QString("Cockatrice %1").arg(VERSION_STRING));
|
||||||
|
|
||||||
manager->post(request, data);
|
manager->post(request, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeckStatsInterface::copyDeckWithoutTokens(DeckList &source, DeckList &destination)
|
void DeckStatsInterface::copyDeckWithoutTokens(const DeckList &source, DeckList &destination)
|
||||||
{
|
{
|
||||||
auto copyIfNotAToken = [this, &destination](const auto node, const auto card) {
|
auto copyIfNotAToken = [this, &destination](const auto node, const auto card) {
|
||||||
CardInfoPtr dbCard = cardDatabase.query()->getCardInfo(card->getName());
|
CardInfoPtr dbCard = cardDatabase.query()->getCardInfo(card->getName());
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@
|
||||||
#ifndef DECKSTATS_INTERFACE_H
|
#ifndef DECKSTATS_INTERFACE_H
|
||||||
#define DECKSTATS_INTERFACE_H
|
#define DECKSTATS_INTERFACE_H
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <libcockatrice/card/database/card_database.h>
|
#include <libcockatrice/card/database/card_database.h>
|
||||||
#include <libcockatrice/deck_list/deck_list.h>
|
#include <libcockatrice/deck_list/deck_list.h>
|
||||||
|
|
||||||
|
|
@ -29,15 +28,15 @@ private:
|
||||||
* closest non-token card instead. So we construct a new deck which has no
|
* closest non-token card instead. So we construct a new deck which has no
|
||||||
* tokens.
|
* tokens.
|
||||||
*/
|
*/
|
||||||
void copyDeckWithoutTokens(DeckList &source, DeckList &destination);
|
void copyDeckWithoutTokens(const DeckList &source, DeckList &destination);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void queryFinished(QNetworkReply *reply);
|
void queryFinished(QNetworkReply *reply);
|
||||||
void getAnalyzeRequestData(DeckList *deck, QByteArray *data);
|
void getAnalyzeRequestData(const DeckList &deck, QByteArray &data);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DeckStatsInterface(CardDatabase &_cardDatabase, QObject *parent = nullptr);
|
explicit DeckStatsInterface(CardDatabase &_cardDatabase, QObject *parent = nullptr);
|
||||||
void analyzeDeck(DeckList *deck);
|
void analyzeDeck(const DeckList &deck);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QNetworkAccessManager>
|
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QNetworkRequest>
|
#include <QNetworkRequest>
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
#include <QUrlQuery>
|
#include <QUrlQuery>
|
||||||
#include <libcockatrice/deck_list/deck_list.h>
|
#include <libcockatrice/deck_list/deck_list.h>
|
||||||
#include <libcockatrice/deck_list/deck_list_card_node.h>
|
#include <libcockatrice/deck_list/tree/deck_list_card_node.h>
|
||||||
|
#include <version_string.h>
|
||||||
|
|
||||||
TappedOutInterface::TappedOutInterface(CardDatabase &_cardDatabase, QObject *parent)
|
TappedOutInterface::TappedOutInterface(CardDatabase &_cardDatabase, QObject *parent)
|
||||||
: QObject(parent), cardDatabase(_cardDatabase)
|
: QObject(parent), cardDatabase(_cardDatabase)
|
||||||
|
|
@ -67,32 +67,33 @@ void TappedOutInterface::queryFinished(QNetworkReply *reply)
|
||||||
deleteLater();
|
deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TappedOutInterface::getAnalyzeRequestData(DeckList *deck, QByteArray *data)
|
void TappedOutInterface::getAnalyzeRequestData(const DeckList &deck, QByteArray &data)
|
||||||
{
|
{
|
||||||
DeckList mainboard, sideboard;
|
DeckList mainboard, sideboard;
|
||||||
copyDeckSplitMainAndSide(*deck, mainboard, sideboard);
|
copyDeckSplitMainAndSide(deck, mainboard, sideboard);
|
||||||
|
|
||||||
QUrl params;
|
QUrl params;
|
||||||
QUrlQuery urlQuery;
|
QUrlQuery urlQuery;
|
||||||
urlQuery.addQueryItem("name", deck->getName());
|
urlQuery.addQueryItem("name", deck.getName());
|
||||||
urlQuery.addQueryItem("mainboard", mainboard.writeToString_Plain(false, true));
|
urlQuery.addQueryItem("mainboard", mainboard.writeToString_Plain(false, true));
|
||||||
urlQuery.addQueryItem("sideboard", sideboard.writeToString_Plain(false, true));
|
urlQuery.addQueryItem("sideboard", sideboard.writeToString_Plain(false, true));
|
||||||
params.setQuery(urlQuery);
|
params.setQuery(urlQuery);
|
||||||
data->append(params.query(QUrl::EncodeReserved).toUtf8());
|
data.append(params.query(QUrl::EncodeReserved).toUtf8());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TappedOutInterface::analyzeDeck(DeckList *deck)
|
void TappedOutInterface::analyzeDeck(const DeckList &deck)
|
||||||
{
|
{
|
||||||
QByteArray data;
|
QByteArray data;
|
||||||
getAnalyzeRequestData(deck, &data);
|
getAnalyzeRequestData(deck, data);
|
||||||
|
|
||||||
QNetworkRequest request(QUrl("https://tappedout.net/mtg-decks/paste/"));
|
QNetworkRequest request(QUrl("https://tappedout.net/mtg-decks/paste/"));
|
||||||
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
|
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
|
||||||
|
request.setHeader(QNetworkRequest::UserAgentHeader, QString("Cockatrice %1").arg(VERSION_STRING));
|
||||||
|
|
||||||
manager->post(request, data);
|
manager->post(request, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TappedOutInterface::copyDeckSplitMainAndSide(DeckList &source, DeckList &mainboard, DeckList &sideboard)
|
void TappedOutInterface::copyDeckSplitMainAndSide(const DeckList &source, DeckList &mainboard, DeckList &sideboard)
|
||||||
{
|
{
|
||||||
auto copyMainOrSide = [this, &mainboard, &sideboard](const auto node, const auto card) {
|
auto copyMainOrSide = [this, &mainboard, &sideboard](const auto node, const auto card) {
|
||||||
CardInfoPtr dbCard = cardDatabase.query()->getCardInfo(card->getName());
|
CardInfoPtr dbCard = cardDatabase.query()->getCardInfo(card->getName());
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,6 @@
|
||||||
#ifndef TAPPEDOUT_INTERFACE_H
|
#ifndef TAPPEDOUT_INTERFACE_H
|
||||||
#define TAPPEDOUT_INTERFACE_H
|
#define TAPPEDOUT_INTERFACE_H
|
||||||
|
|
||||||
#include <QLoggingCategory>
|
|
||||||
#include <QObject>
|
|
||||||
#include <libcockatrice/card/database/card_database.h>
|
#include <libcockatrice/card/database/card_database.h>
|
||||||
#include <libcockatrice/deck_list/deck_list.h>
|
#include <libcockatrice/deck_list/deck_list.h>
|
||||||
|
|
||||||
|
|
@ -32,14 +30,14 @@ private:
|
||||||
QNetworkAccessManager *manager;
|
QNetworkAccessManager *manager;
|
||||||
|
|
||||||
CardDatabase &cardDatabase;
|
CardDatabase &cardDatabase;
|
||||||
void copyDeckSplitMainAndSide(DeckList &source, DeckList &mainboard, DeckList &sideboard);
|
void copyDeckSplitMainAndSide(const DeckList &source, DeckList &mainboard, DeckList &sideboard);
|
||||||
private slots:
|
private slots:
|
||||||
void queryFinished(QNetworkReply *reply);
|
void queryFinished(QNetworkReply *reply);
|
||||||
void getAnalyzeRequestData(DeckList *deck, QByteArray *data);
|
void getAnalyzeRequestData(const DeckList &deck, QByteArray &data);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit TappedOutInterface(CardDatabase &_cardDatabase, QObject *parent = nullptr);
|
explicit TappedOutInterface(CardDatabase &_cardDatabase, QObject *parent = nullptr);
|
||||||
void analyzeDeck(DeckList *deck);
|
void analyzeDeck(const DeckList &deck);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@
|
||||||
|
|
||||||
#ifndef INTERFACE_JSON_DECK_PARSER_H
|
#ifndef INTERFACE_JSON_DECK_PARSER_H
|
||||||
#define INTERFACE_JSON_DECK_PARSER_H
|
#define INTERFACE_JSON_DECK_PARSER_H
|
||||||
|
|
||||||
|
#include "../../../interface/deck_loader/card_node_function.h"
|
||||||
#include "../../../interface/deck_loader/deck_loader.h"
|
#include "../../../interface/deck_loader/deck_loader.h"
|
||||||
|
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
|
|
@ -16,21 +18,21 @@ class IJsonDeckParser
|
||||||
public:
|
public:
|
||||||
virtual ~IJsonDeckParser() = default;
|
virtual ~IJsonDeckParser() = default;
|
||||||
|
|
||||||
virtual DeckLoader *parse(const QJsonObject &obj) = 0;
|
virtual DeckList parse(const QJsonObject &obj) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ArchidektJsonParser : public IJsonDeckParser
|
class ArchidektJsonParser : public IJsonDeckParser
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DeckLoader *parse(const QJsonObject &obj) override
|
DeckList parse(const QJsonObject &obj) override
|
||||||
{
|
{
|
||||||
DeckLoader *loader = new DeckLoader(nullptr);
|
DeckList deckList;
|
||||||
|
|
||||||
QString deckName = obj.value("name").toString();
|
QString deckName = obj.value("name").toString();
|
||||||
QString deckDescription = obj.value("description").toString();
|
QString deckDescription = obj.value("description").toString();
|
||||||
|
|
||||||
loader->getDeckList()->setName(deckName);
|
deckList.setName(deckName);
|
||||||
loader->getDeckList()->setComments(deckDescription);
|
deckList.setComments(deckDescription);
|
||||||
|
|
||||||
QString outputText;
|
QString outputText;
|
||||||
QTextStream outStream(&outputText);
|
QTextStream outStream(&outputText);
|
||||||
|
|
@ -47,25 +49,25 @@ public:
|
||||||
outStream << quantity << ' ' << cardName << " (" << setName << ") " << collectorNumber << '\n';
|
outStream << quantity << ' ' << cardName << " (" << setName << ") " << collectorNumber << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
loader->getDeckList()->loadFromStream_Plain(outStream, false);
|
deckList.loadFromStream_Plain(outStream, false);
|
||||||
DeckLoader::resolveSetNameAndNumberToProviderID(loader->getDeckList());
|
deckList.forEachCard(CardNodeFunction::ResolveProviderId());
|
||||||
|
|
||||||
return loader;
|
return deckList;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class MoxfieldJsonParser : public IJsonDeckParser
|
class MoxfieldJsonParser : public IJsonDeckParser
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DeckLoader *parse(const QJsonObject &obj) override
|
DeckList parse(const QJsonObject &obj) override
|
||||||
{
|
{
|
||||||
DeckLoader *loader = new DeckLoader(nullptr);
|
DeckList deckList;
|
||||||
|
|
||||||
QString deckName = obj.value("name").toString();
|
QString deckName = obj.value("name").toString();
|
||||||
QString deckDescription = obj.value("description").toString();
|
QString deckDescription = obj.value("description").toString();
|
||||||
|
|
||||||
loader->getDeckList()->setName(deckName);
|
deckList.setName(deckName);
|
||||||
loader->getDeckList()->setComments(deckDescription);
|
deckList.setComments(deckDescription);
|
||||||
|
|
||||||
QString outputText;
|
QString outputText;
|
||||||
QTextStream outStream(&outputText);
|
QTextStream outStream(&outputText);
|
||||||
|
|
@ -94,8 +96,8 @@ public:
|
||||||
outStream << quantity << ' ' << cardName << " (" << setName << ") " << collectorNumber << '\n';
|
outStream << quantity << ' ' << cardName << " (" << setName << ") " << collectorNumber << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
loader->getDeckList()->loadFromStream_Plain(outStream, false);
|
deckList.loadFromStream_Plain(outStream, false);
|
||||||
DeckLoader::resolveSetNameAndNumberToProviderID(loader->getDeckList());
|
deckList.forEachCard(CardNodeFunction::ResolveProviderId());
|
||||||
|
|
||||||
QJsonObject commandersObj = obj.value("commanders").toObject();
|
QJsonObject commandersObj = obj.value("commanders").toObject();
|
||||||
if (!commandersObj.isEmpty()) {
|
if (!commandersObj.isEmpty()) {
|
||||||
|
|
@ -106,12 +108,12 @@ public:
|
||||||
QString collectorNumber = cardData.value("cn").toString();
|
QString collectorNumber = cardData.value("cn").toString();
|
||||||
QString providerId = cardData.value("scryfall_id").toString();
|
QString providerId = cardData.value("scryfall_id").toString();
|
||||||
|
|
||||||
loader->getDeckList()->setBannerCard({commanderName, providerId});
|
deckList.setBannerCard({commanderName, providerId});
|
||||||
loader->getDeckList()->addCard(commanderName, DECK_ZONE_MAIN, -1, setName, collectorNumber, providerId);
|
deckList.addCard(commanderName, DECK_ZONE_MAIN, -1, setName, collectorNumber, providerId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return loader;
|
return deckList;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,18 +4,17 @@
|
||||||
#include "../../../../main.h"
|
#include "../../../../main.h"
|
||||||
#include "../../../settings/cache_settings.h"
|
#include "../../../settings/cache_settings.h"
|
||||||
|
|
||||||
#include <QApplication>
|
|
||||||
#include <QCryptographicHash>
|
#include <QCryptographicHash>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
#include <QMessageBox>
|
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QtConcurrent>
|
#include <QtConcurrent>
|
||||||
#include <libcockatrice/card/database/card_database.h>
|
#include <libcockatrice/card/database/card_database.h>
|
||||||
#include <libcockatrice/card/database/card_database_manager.h>
|
#include <libcockatrice/card/database/card_database_manager.h>
|
||||||
|
#include <version_string.h>
|
||||||
|
|
||||||
#define SPOILERS_STATUS_URL "https://raw.githubusercontent.com/Cockatrice/Magic-Spoiler/files/SpoilerSeasonEnabled"
|
#define SPOILERS_STATUS_URL "https://raw.githubusercontent.com/Cockatrice/Magic-Spoiler/files/SpoilerSeasonEnabled"
|
||||||
#define SPOILERS_URL "https://raw.githubusercontent.com/Cockatrice/Magic-Spoiler/files/spoiler.xml"
|
#define SPOILERS_URL "https://raw.githubusercontent.com/Cockatrice/Magic-Spoiler/files/spoiler.xml"
|
||||||
|
|
@ -41,7 +40,9 @@ void SpoilerBackgroundUpdater::startSpoilerDownloadProcess(QString url, bool sav
|
||||||
void SpoilerBackgroundUpdater::downloadFromURL(QUrl url, bool saveResults)
|
void SpoilerBackgroundUpdater::downloadFromURL(QUrl url, bool saveResults)
|
||||||
{
|
{
|
||||||
auto *nam = new QNetworkAccessManager(this);
|
auto *nam = new QNetworkAccessManager(this);
|
||||||
QNetworkReply *reply = nam->get(QNetworkRequest(url));
|
auto request = QNetworkRequest(url);
|
||||||
|
request.setHeader(QNetworkRequest::UserAgentHeader, QString("Cockatrice %1").arg(VERSION_STRING));
|
||||||
|
QNetworkReply *reply = nam->get(request);
|
||||||
|
|
||||||
if (saveResults) {
|
if (saveResults) {
|
||||||
// This will write out to the file (used for spoiler.xml)
|
// This will write out to the file (used for spoiler.xml)
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ public:
|
||||||
inline QString getCardUpdaterBinaryName()
|
inline QString getCardUpdaterBinaryName()
|
||||||
{
|
{
|
||||||
return "oracle";
|
return "oracle";
|
||||||
};
|
}
|
||||||
QByteArray getHash(const QString fileName);
|
QByteArray getHash(const QString fileName);
|
||||||
QByteArray getHash(QByteArray data);
|
QByteArray getHash(QByteArray data);
|
||||||
static bool deleteSpoilerFile();
|
static bool deleteSpoilerFile();
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
#include "update_downloader.h"
|
#include "update_downloader.h"
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
UpdateDownloader::UpdateDownloader(QObject *parent) : QObject(parent), response(nullptr)
|
UpdateDownloader::UpdateDownloader(QObject *parent) : QObject(parent), response(nullptr)
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,7 @@
|
||||||
#ifndef COCKATRICE_UPDATEDOWNLOADER_H
|
#ifndef COCKATRICE_UPDATEDOWNLOADER_H
|
||||||
#define COCKATRICE_UPDATEDOWNLOADER_H
|
#define COCKATRICE_UPDATEDOWNLOADER_H
|
||||||
|
|
||||||
#include <QDate>
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QUrl>
|
|
||||||
#include <QtNetwork>
|
#include <QtNetwork>
|
||||||
|
|
||||||
class UpdateDownloader : public QObject
|
class UpdateDownloader : public QObject
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@
|
||||||
|
|
||||||
#include <QDate>
|
#include <QDate>
|
||||||
#include <QLoggingCategory>
|
#include <QLoggingCategory>
|
||||||
#include <QObject>
|
|
||||||
#include <QSize>
|
#include <QSize>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <libcockatrice/interfaces/interface_card_database_path_provider.h>
|
#include <libcockatrice/interfaces/interface_card_database_path_provider.h>
|
||||||
|
|
@ -325,8 +324,8 @@ private:
|
||||||
int keepalive;
|
int keepalive;
|
||||||
int timeout;
|
int timeout;
|
||||||
void translateLegacySettings();
|
void translateLegacySettings();
|
||||||
QString getSafeConfigPath(QString configEntry, QString defaultPath) const;
|
[[nodiscard]] QString getSafeConfigPath(QString configEntry, QString defaultPath) const;
|
||||||
QString getSafeConfigFilePath(QString configEntry, QString defaultPath) const;
|
[[nodiscard]] QString getSafeConfigFilePath(QString configEntry, QString defaultPath) const;
|
||||||
void loadPaths();
|
void loadPaths();
|
||||||
bool rememberGameSettings;
|
bool rememberGameSettings;
|
||||||
QList<ReleaseChannel *> releaseChannels;
|
QList<ReleaseChannel *> releaseChannels;
|
||||||
|
|
@ -338,137 +337,137 @@ public:
|
||||||
SettingsCache();
|
SettingsCache();
|
||||||
QString getDataPath();
|
QString getDataPath();
|
||||||
QString getSettingsPath();
|
QString getSettingsPath();
|
||||||
QString getCachePath() const;
|
[[nodiscard]] QString getCachePath() const;
|
||||||
QString getNetworkCachePath() const;
|
[[nodiscard]] QString getNetworkCachePath() const;
|
||||||
const QByteArray &getMainWindowGeometry() const
|
[[nodiscard]] const QByteArray &getMainWindowGeometry() const
|
||||||
{
|
{
|
||||||
return mainWindowGeometry;
|
return mainWindowGeometry;
|
||||||
}
|
}
|
||||||
const QByteArray &getTokenDialogGeometry() const
|
[[nodiscard]] const QByteArray &getTokenDialogGeometry() const
|
||||||
{
|
{
|
||||||
return tokenDialogGeometry;
|
return tokenDialogGeometry;
|
||||||
}
|
}
|
||||||
const QByteArray &getSetsDialogGeometry() const
|
[[nodiscard]] const QByteArray &getSetsDialogGeometry() const
|
||||||
{
|
{
|
||||||
return setsDialogGeometry;
|
return setsDialogGeometry;
|
||||||
}
|
}
|
||||||
QString getLang() const
|
[[nodiscard]] QString getLang() const
|
||||||
{
|
{
|
||||||
return lang;
|
return lang;
|
||||||
}
|
}
|
||||||
QString getDeckPath() const
|
[[nodiscard]] QString getDeckPath() const
|
||||||
{
|
{
|
||||||
return deckPath;
|
return deckPath;
|
||||||
}
|
}
|
||||||
QString getFiltersPath() const
|
[[nodiscard]] QString getFiltersPath() const
|
||||||
{
|
{
|
||||||
return filtersPath;
|
return filtersPath;
|
||||||
}
|
}
|
||||||
QString getReplaysPath() const
|
[[nodiscard]] QString getReplaysPath() const
|
||||||
{
|
{
|
||||||
return replaysPath;
|
return replaysPath;
|
||||||
}
|
}
|
||||||
QString getThemesPath() const
|
[[nodiscard]] QString getThemesPath() const
|
||||||
{
|
{
|
||||||
return themesPath;
|
return themesPath;
|
||||||
}
|
}
|
||||||
QString getPicsPath() const
|
[[nodiscard]] QString getPicsPath() const
|
||||||
{
|
{
|
||||||
return picsPath;
|
return picsPath;
|
||||||
}
|
}
|
||||||
QString getRedirectCachePath() const
|
[[nodiscard]] QString getRedirectCachePath() const
|
||||||
{
|
{
|
||||||
return redirectCachePath;
|
return redirectCachePath;
|
||||||
}
|
}
|
||||||
QString getCustomPicsPath() const
|
[[nodiscard]] QString getCustomPicsPath() const
|
||||||
{
|
{
|
||||||
return customPicsPath;
|
return customPicsPath;
|
||||||
}
|
}
|
||||||
QString getCustomCardDatabasePath() const override
|
[[nodiscard]] QString getCustomCardDatabasePath() const override
|
||||||
{
|
{
|
||||||
return customCardDatabasePath;
|
return customCardDatabasePath;
|
||||||
}
|
}
|
||||||
QString getCardDatabasePath() const override
|
[[nodiscard]] QString getCardDatabasePath() const override
|
||||||
{
|
{
|
||||||
return cardDatabasePath;
|
return cardDatabasePath;
|
||||||
}
|
}
|
||||||
QString getSpoilerCardDatabasePath() const override
|
[[nodiscard]] QString getSpoilerCardDatabasePath() const override
|
||||||
{
|
{
|
||||||
return spoilerDatabasePath;
|
return spoilerDatabasePath;
|
||||||
}
|
}
|
||||||
QString getTokenDatabasePath() const override
|
[[nodiscard]] QString getTokenDatabasePath() const override
|
||||||
{
|
{
|
||||||
return tokenDatabasePath;
|
return tokenDatabasePath;
|
||||||
}
|
}
|
||||||
QString getThemeName() const
|
[[nodiscard]] QString getThemeName() const
|
||||||
{
|
{
|
||||||
return themeName;
|
return themeName;
|
||||||
}
|
}
|
||||||
QString getHomeTabBackgroundSource() const
|
[[nodiscard]] QString getHomeTabBackgroundSource() const
|
||||||
{
|
{
|
||||||
return homeTabBackgroundSource;
|
return homeTabBackgroundSource;
|
||||||
}
|
}
|
||||||
int getHomeTabBackgroundShuffleFrequency() const
|
[[nodiscard]] int getHomeTabBackgroundShuffleFrequency() const
|
||||||
{
|
{
|
||||||
return homeTabBackgroundShuffleFrequency;
|
return homeTabBackgroundShuffleFrequency;
|
||||||
}
|
}
|
||||||
bool getTabVisualDeckStorageOpen() const
|
[[nodiscard]] bool getTabVisualDeckStorageOpen() const
|
||||||
{
|
{
|
||||||
return tabVisualDeckStorageOpen;
|
return tabVisualDeckStorageOpen;
|
||||||
}
|
}
|
||||||
bool getTabServerOpen() const
|
[[nodiscard]] bool getTabServerOpen() const
|
||||||
{
|
{
|
||||||
return tabServerOpen;
|
return tabServerOpen;
|
||||||
}
|
}
|
||||||
bool getTabAccountOpen() const
|
[[nodiscard]] bool getTabAccountOpen() const
|
||||||
{
|
{
|
||||||
return tabAccountOpen;
|
return tabAccountOpen;
|
||||||
}
|
}
|
||||||
bool getTabDeckStorageOpen() const
|
[[nodiscard]] bool getTabDeckStorageOpen() const
|
||||||
{
|
{
|
||||||
return tabDeckStorageOpen;
|
return tabDeckStorageOpen;
|
||||||
}
|
}
|
||||||
bool getTabReplaysOpen() const
|
[[nodiscard]] bool getTabReplaysOpen() const
|
||||||
{
|
{
|
||||||
return tabReplaysOpen;
|
return tabReplaysOpen;
|
||||||
}
|
}
|
||||||
bool getTabAdminOpen() const
|
[[nodiscard]] bool getTabAdminOpen() const
|
||||||
{
|
{
|
||||||
return tabAdminOpen;
|
return tabAdminOpen;
|
||||||
}
|
}
|
||||||
bool getTabLogOpen() const
|
[[nodiscard]] bool getTabLogOpen() const
|
||||||
{
|
{
|
||||||
return tabLogOpen;
|
return tabLogOpen;
|
||||||
}
|
}
|
||||||
QString getChatMentionColor() const
|
[[nodiscard]] QString getChatMentionColor() const
|
||||||
{
|
{
|
||||||
return chatMentionColor;
|
return chatMentionColor;
|
||||||
}
|
}
|
||||||
QString getChatHighlightColor() const
|
[[nodiscard]] QString getChatHighlightColor() const
|
||||||
{
|
{
|
||||||
return chatHighlightColor;
|
return chatHighlightColor;
|
||||||
}
|
}
|
||||||
bool getPicDownload() const
|
[[nodiscard]] bool getPicDownload() const
|
||||||
{
|
{
|
||||||
return picDownload;
|
return picDownload;
|
||||||
}
|
}
|
||||||
bool getShowStatusBar() const
|
[[nodiscard]] bool getShowStatusBar() const
|
||||||
{
|
{
|
||||||
return showStatusBar;
|
return showStatusBar;
|
||||||
}
|
}
|
||||||
bool getNotificationsEnabled() const
|
[[nodiscard]] bool getNotificationsEnabled() const
|
||||||
{
|
{
|
||||||
return notificationsEnabled;
|
return notificationsEnabled;
|
||||||
}
|
}
|
||||||
bool getSpectatorNotificationsEnabled() const
|
[[nodiscard]] bool getSpectatorNotificationsEnabled() const
|
||||||
{
|
{
|
||||||
return spectatorNotificationsEnabled;
|
return spectatorNotificationsEnabled;
|
||||||
}
|
}
|
||||||
bool getBuddyConnectNotificationsEnabled() const
|
[[nodiscard]] bool getBuddyConnectNotificationsEnabled() const
|
||||||
{
|
{
|
||||||
return buddyConnectNotificationsEnabled;
|
return buddyConnectNotificationsEnabled;
|
||||||
}
|
}
|
||||||
bool getCheckUpdatesOnStartup() const
|
[[nodiscard]] bool getCheckUpdatesOnStartup() const
|
||||||
{
|
{
|
||||||
return checkUpdatesOnStartup;
|
return checkUpdatesOnStartup;
|
||||||
}
|
}
|
||||||
|
|
@ -480,263 +479,263 @@ public:
|
||||||
{
|
{
|
||||||
return startupCardUpdateCheckAlwaysUpdate;
|
return startupCardUpdateCheckAlwaysUpdate;
|
||||||
}
|
}
|
||||||
int getCardUpdateCheckInterval() const
|
[[nodiscard]] int getCardUpdateCheckInterval() const
|
||||||
{
|
{
|
||||||
return cardUpdateCheckInterval;
|
return cardUpdateCheckInterval;
|
||||||
}
|
}
|
||||||
QDate getLastCardUpdateCheck() const
|
[[nodiscard]] QDate getLastCardUpdateCheck() const
|
||||||
{
|
{
|
||||||
return lastCardUpdateCheck;
|
return lastCardUpdateCheck;
|
||||||
}
|
}
|
||||||
bool getCardUpdateCheckRequired() const
|
[[nodiscard]] bool getCardUpdateCheckRequired() const
|
||||||
{
|
{
|
||||||
return getLastCardUpdateCheck().daysTo(QDateTime::currentDateTime().date()) >= getCardUpdateCheckInterval() &&
|
return getLastCardUpdateCheck().daysTo(QDateTime::currentDateTime().date()) >= getCardUpdateCheckInterval() &&
|
||||||
getLastCardUpdateCheck() != QDateTime::currentDateTime().date();
|
getLastCardUpdateCheck() != QDateTime::currentDateTime().date();
|
||||||
}
|
}
|
||||||
bool getNotifyAboutUpdates() const override
|
[[nodiscard]] bool getNotifyAboutUpdates() const override
|
||||||
{
|
{
|
||||||
return notifyAboutUpdates;
|
return notifyAboutUpdates;
|
||||||
}
|
}
|
||||||
bool getNotifyAboutNewVersion() const
|
[[nodiscard]] bool getNotifyAboutNewVersion() const
|
||||||
{
|
{
|
||||||
return notifyAboutNewVersion;
|
return notifyAboutNewVersion;
|
||||||
}
|
}
|
||||||
bool getShowTipsOnStartup() const
|
[[nodiscard]] bool getShowTipsOnStartup() const
|
||||||
{
|
{
|
||||||
return showTipsOnStartup;
|
return showTipsOnStartup;
|
||||||
}
|
}
|
||||||
QList<int> getSeenTips() const
|
[[nodiscard]] QList<int> getSeenTips() const
|
||||||
{
|
{
|
||||||
return seenTips;
|
return seenTips;
|
||||||
}
|
}
|
||||||
int getUpdateReleaseChannelIndex() const
|
[[nodiscard]] int getUpdateReleaseChannelIndex() const
|
||||||
{
|
{
|
||||||
return updateReleaseChannel;
|
return updateReleaseChannel;
|
||||||
}
|
}
|
||||||
ReleaseChannel *getUpdateReleaseChannel() const
|
[[nodiscard]] ReleaseChannel *getUpdateReleaseChannel() const
|
||||||
{
|
{
|
||||||
return releaseChannels.at(qMax(0, updateReleaseChannel));
|
return releaseChannels.at(qMax(0, updateReleaseChannel));
|
||||||
}
|
}
|
||||||
QList<ReleaseChannel *> getUpdateReleaseChannels() const
|
[[nodiscard]] QList<ReleaseChannel *> getUpdateReleaseChannels() const
|
||||||
{
|
{
|
||||||
return releaseChannels;
|
return releaseChannels;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool getDoubleClickToPlay() const
|
[[nodiscard]] bool getDoubleClickToPlay() const
|
||||||
{
|
{
|
||||||
return doubleClickToPlay;
|
return doubleClickToPlay;
|
||||||
}
|
}
|
||||||
bool getClickPlaysAllSelected() const
|
[[nodiscard]] bool getClickPlaysAllSelected() const
|
||||||
{
|
{
|
||||||
return clickPlaysAllSelected;
|
return clickPlaysAllSelected;
|
||||||
}
|
}
|
||||||
bool getPlayToStack() const
|
[[nodiscard]] bool getPlayToStack() const
|
||||||
{
|
{
|
||||||
return playToStack;
|
return playToStack;
|
||||||
}
|
}
|
||||||
bool getDoNotDeleteArrowsInSubPhases() const
|
[[nodiscard]] bool getDoNotDeleteArrowsInSubPhases() const
|
||||||
{
|
{
|
||||||
return doNotDeleteArrowsInSubPhases;
|
return doNotDeleteArrowsInSubPhases;
|
||||||
}
|
}
|
||||||
int getStartingHandSize() const
|
[[nodiscard]] int getStartingHandSize() const
|
||||||
{
|
{
|
||||||
return startingHandSize;
|
return startingHandSize;
|
||||||
}
|
}
|
||||||
bool getAnnotateTokens() const
|
[[nodiscard]] bool getAnnotateTokens() const
|
||||||
{
|
{
|
||||||
return annotateTokens;
|
return annotateTokens;
|
||||||
}
|
}
|
||||||
QByteArray getTabGameSplitterSizes() const
|
[[nodiscard]] QByteArray getTabGameSplitterSizes() const
|
||||||
{
|
{
|
||||||
return tabGameSplitterSizes;
|
return tabGameSplitterSizes;
|
||||||
}
|
}
|
||||||
bool getShowShortcuts() const
|
[[nodiscard]] bool getShowShortcuts() const
|
||||||
{
|
{
|
||||||
return showShortcuts;
|
return showShortcuts;
|
||||||
}
|
}
|
||||||
bool getDisplayCardNames() const
|
[[nodiscard]] bool getDisplayCardNames() const
|
||||||
{
|
{
|
||||||
return displayCardNames;
|
return displayCardNames;
|
||||||
}
|
}
|
||||||
bool getOverrideAllCardArtWithPersonalPreference() const
|
[[nodiscard]] bool getOverrideAllCardArtWithPersonalPreference() const
|
||||||
{
|
{
|
||||||
return overrideAllCardArtWithPersonalPreference;
|
return overrideAllCardArtWithPersonalPreference;
|
||||||
}
|
}
|
||||||
bool getBumpSetsWithCardsInDeckToTop() const
|
[[nodiscard]] bool getBumpSetsWithCardsInDeckToTop() const
|
||||||
{
|
{
|
||||||
return bumpSetsWithCardsInDeckToTop;
|
return bumpSetsWithCardsInDeckToTop;
|
||||||
}
|
}
|
||||||
int getPrintingSelectorSortOrder() const
|
[[nodiscard]] int getPrintingSelectorSortOrder() const
|
||||||
{
|
{
|
||||||
return printingSelectorSortOrder;
|
return printingSelectorSortOrder;
|
||||||
}
|
}
|
||||||
int getPrintingSelectorCardSize() const
|
[[nodiscard]] int getPrintingSelectorCardSize() const
|
||||||
{
|
{
|
||||||
return printingSelectorCardSize;
|
return printingSelectorCardSize;
|
||||||
}
|
}
|
||||||
bool getIncludeRebalancedCards() const
|
[[nodiscard]] bool getIncludeRebalancedCards() const
|
||||||
{
|
{
|
||||||
return includeRebalancedCards;
|
return includeRebalancedCards;
|
||||||
}
|
}
|
||||||
bool getPrintingSelectorNavigationButtonsVisible() const
|
[[nodiscard]] bool getPrintingSelectorNavigationButtonsVisible() const
|
||||||
{
|
{
|
||||||
return printingSelectorNavigationButtonsVisible;
|
return printingSelectorNavigationButtonsVisible;
|
||||||
}
|
}
|
||||||
bool getDeckEditorBannerCardComboBoxVisible() const
|
[[nodiscard]] bool getDeckEditorBannerCardComboBoxVisible() const
|
||||||
{
|
{
|
||||||
return deckEditorBannerCardComboBoxVisible;
|
return deckEditorBannerCardComboBoxVisible;
|
||||||
}
|
}
|
||||||
bool getDeckEditorTagsWidgetVisible() const
|
[[nodiscard]] bool getDeckEditorTagsWidgetVisible() const
|
||||||
{
|
{
|
||||||
return deckEditorTagsWidgetVisible;
|
return deckEditorTagsWidgetVisible;
|
||||||
}
|
}
|
||||||
int getVisualDeckStorageSortingOrder() const
|
[[nodiscard]] int getVisualDeckStorageSortingOrder() const
|
||||||
{
|
{
|
||||||
return visualDeckStorageSortingOrder;
|
return visualDeckStorageSortingOrder;
|
||||||
}
|
}
|
||||||
bool getVisualDeckStorageShowFolders() const
|
[[nodiscard]] bool getVisualDeckStorageShowFolders() const
|
||||||
{
|
{
|
||||||
return visualDeckStorageShowFolders;
|
return visualDeckStorageShowFolders;
|
||||||
}
|
}
|
||||||
bool getVisualDeckStorageShowTagFilter() const
|
[[nodiscard]] bool getVisualDeckStorageShowTagFilter() const
|
||||||
{
|
{
|
||||||
return visualDeckStorageShowTagFilter;
|
return visualDeckStorageShowTagFilter;
|
||||||
}
|
}
|
||||||
QStringList getVisualDeckStorageDefaultTagsList() const
|
[[nodiscard]] QStringList getVisualDeckStorageDefaultTagsList() const
|
||||||
{
|
{
|
||||||
return visualDeckStorageDefaultTagsList;
|
return visualDeckStorageDefaultTagsList;
|
||||||
}
|
}
|
||||||
bool getVisualDeckStorageSearchFolderNames() const
|
[[nodiscard]] bool getVisualDeckStorageSearchFolderNames() const
|
||||||
{
|
{
|
||||||
return visualDeckStorageSearchFolderNames;
|
return visualDeckStorageSearchFolderNames;
|
||||||
}
|
}
|
||||||
bool getVisualDeckStorageShowBannerCardComboBox() const
|
[[nodiscard]] bool getVisualDeckStorageShowBannerCardComboBox() const
|
||||||
{
|
{
|
||||||
return visualDeckStorageShowBannerCardComboBox;
|
return visualDeckStorageShowBannerCardComboBox;
|
||||||
}
|
}
|
||||||
bool getVisualDeckStorageShowTagsOnDeckPreviews() const
|
[[nodiscard]] bool getVisualDeckStorageShowTagsOnDeckPreviews() const
|
||||||
{
|
{
|
||||||
return visualDeckStorageShowTagsOnDeckPreviews;
|
return visualDeckStorageShowTagsOnDeckPreviews;
|
||||||
}
|
}
|
||||||
int getVisualDeckStorageCardSize() const
|
[[nodiscard]] int getVisualDeckStorageCardSize() const
|
||||||
{
|
{
|
||||||
return visualDeckStorageCardSize;
|
return visualDeckStorageCardSize;
|
||||||
}
|
}
|
||||||
bool getVisualDeckStorageDrawUnusedColorIdentities() const
|
[[nodiscard]] bool getVisualDeckStorageDrawUnusedColorIdentities() const
|
||||||
{
|
{
|
||||||
return visualDeckStorageDrawUnusedColorIdentities;
|
return visualDeckStorageDrawUnusedColorIdentities;
|
||||||
}
|
}
|
||||||
int getVisualDeckStorageUnusedColorIdentitiesOpacity() const
|
[[nodiscard]] int getVisualDeckStorageUnusedColorIdentitiesOpacity() const
|
||||||
{
|
{
|
||||||
return visualDeckStorageUnusedColorIdentitiesOpacity;
|
return visualDeckStorageUnusedColorIdentitiesOpacity;
|
||||||
}
|
}
|
||||||
int getVisualDeckStorageTooltipType() const
|
[[nodiscard]] int getVisualDeckStorageTooltipType() const
|
||||||
{
|
{
|
||||||
return visualDeckStorageTooltipType;
|
return visualDeckStorageTooltipType;
|
||||||
}
|
}
|
||||||
bool getVisualDeckStoragePromptForConversion() const
|
[[nodiscard]] bool getVisualDeckStoragePromptForConversion() const
|
||||||
{
|
{
|
||||||
return visualDeckStoragePromptForConversion;
|
return visualDeckStoragePromptForConversion;
|
||||||
}
|
}
|
||||||
bool getVisualDeckStorageAlwaysConvert() const
|
[[nodiscard]] bool getVisualDeckStorageAlwaysConvert() const
|
||||||
{
|
{
|
||||||
return visualDeckStorageAlwaysConvert;
|
return visualDeckStorageAlwaysConvert;
|
||||||
}
|
}
|
||||||
bool getVisualDeckStorageInGame() const
|
[[nodiscard]] bool getVisualDeckStorageInGame() const
|
||||||
{
|
{
|
||||||
return visualDeckStorageInGame;
|
return visualDeckStorageInGame;
|
||||||
}
|
}
|
||||||
bool getVisualDeckStorageSelectionAnimation() const
|
[[nodiscard]] bool getVisualDeckStorageSelectionAnimation() const
|
||||||
{
|
{
|
||||||
return visualDeckStorageSelectionAnimation;
|
return visualDeckStorageSelectionAnimation;
|
||||||
}
|
}
|
||||||
int getVisualDeckEditorCardSize() const
|
[[nodiscard]] int getVisualDeckEditorCardSize() const
|
||||||
{
|
{
|
||||||
return visualDeckEditorCardSize;
|
return visualDeckEditorCardSize;
|
||||||
}
|
}
|
||||||
int getVisualDatabaseDisplayCardSize() const
|
[[nodiscard]] int getVisualDatabaseDisplayCardSize() const
|
||||||
{
|
{
|
||||||
return visualDatabaseDisplayCardSize;
|
return visualDatabaseDisplayCardSize;
|
||||||
}
|
}
|
||||||
int getEDHRecCardSize() const
|
[[nodiscard]] int getEDHRecCardSize() const
|
||||||
{
|
{
|
||||||
return edhrecCardSize;
|
return edhrecCardSize;
|
||||||
}
|
}
|
||||||
int getArchidektPreviewSize() const
|
[[nodiscard]] int getArchidektPreviewSize() const
|
||||||
{
|
{
|
||||||
return archidektPreviewSize;
|
return archidektPreviewSize;
|
||||||
}
|
}
|
||||||
int getDefaultDeckEditorType() const
|
[[nodiscard]] int getDefaultDeckEditorType() const
|
||||||
{
|
{
|
||||||
return defaultDeckEditorType;
|
return defaultDeckEditorType;
|
||||||
}
|
}
|
||||||
bool getVisualDatabaseDisplayFilterToMostRecentSetsEnabled() const
|
[[nodiscard]] bool getVisualDatabaseDisplayFilterToMostRecentSetsEnabled() const
|
||||||
{
|
{
|
||||||
return visualDatabaseDisplayFilterToMostRecentSetsEnabled;
|
return visualDatabaseDisplayFilterToMostRecentSetsEnabled;
|
||||||
}
|
}
|
||||||
int getVisualDatabaseDisplayFilterToMostRecentSetsAmount() const
|
[[nodiscard]] int getVisualDatabaseDisplayFilterToMostRecentSetsAmount() const
|
||||||
{
|
{
|
||||||
return visualDatabaseDisplayFilterToMostRecentSetsAmount;
|
return visualDatabaseDisplayFilterToMostRecentSetsAmount;
|
||||||
}
|
}
|
||||||
int getVisualDeckEditorSampleHandSize() const
|
[[nodiscard]] int getVisualDeckEditorSampleHandSize() const
|
||||||
{
|
{
|
||||||
return visualDeckEditorSampleHandSize;
|
return visualDeckEditorSampleHandSize;
|
||||||
}
|
}
|
||||||
bool getHorizontalHand() const
|
[[nodiscard]] bool getHorizontalHand() const
|
||||||
{
|
{
|
||||||
return horizontalHand;
|
return horizontalHand;
|
||||||
}
|
}
|
||||||
bool getInvertVerticalCoordinate() const
|
[[nodiscard]] bool getInvertVerticalCoordinate() const
|
||||||
{
|
{
|
||||||
return invertVerticalCoordinate;
|
return invertVerticalCoordinate;
|
||||||
}
|
}
|
||||||
int getMinPlayersForMultiColumnLayout() const
|
[[nodiscard]] int getMinPlayersForMultiColumnLayout() const
|
||||||
{
|
{
|
||||||
return minPlayersForMultiColumnLayout;
|
return minPlayersForMultiColumnLayout;
|
||||||
}
|
}
|
||||||
bool getTapAnimation() const
|
[[nodiscard]] bool getTapAnimation() const
|
||||||
{
|
{
|
||||||
return tapAnimation;
|
return tapAnimation;
|
||||||
}
|
}
|
||||||
bool getAutoRotateSidewaysLayoutCards() const
|
[[nodiscard]] bool getAutoRotateSidewaysLayoutCards() const
|
||||||
{
|
{
|
||||||
return autoRotateSidewaysLayoutCards;
|
return autoRotateSidewaysLayoutCards;
|
||||||
}
|
}
|
||||||
bool getOpenDeckInNewTab() const
|
[[nodiscard]] bool getOpenDeckInNewTab() const
|
||||||
{
|
{
|
||||||
return openDeckInNewTab;
|
return openDeckInNewTab;
|
||||||
}
|
}
|
||||||
int getRewindBufferingMs() const
|
[[nodiscard]] int getRewindBufferingMs() const
|
||||||
{
|
{
|
||||||
return rewindBufferingMs;
|
return rewindBufferingMs;
|
||||||
}
|
}
|
||||||
bool getChatMention() const
|
[[nodiscard]] bool getChatMention() const
|
||||||
{
|
{
|
||||||
return chatMention;
|
return chatMention;
|
||||||
}
|
}
|
||||||
bool getChatMentionCompleter() const
|
[[nodiscard]] bool getChatMentionCompleter() const
|
||||||
{
|
{
|
||||||
return chatMentionCompleter;
|
return chatMentionCompleter;
|
||||||
}
|
}
|
||||||
bool getChatMentionForeground() const
|
[[nodiscard]] bool getChatMentionForeground() const
|
||||||
{
|
{
|
||||||
return chatMentionForeground;
|
return chatMentionForeground;
|
||||||
}
|
}
|
||||||
bool getChatHighlightForeground() const
|
[[nodiscard]] bool getChatHighlightForeground() const
|
||||||
{
|
{
|
||||||
return chatHighlightForeground;
|
return chatHighlightForeground;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Currently selected index for the `Group by X` QComboBox
|
* Currently selected index for the `Group by X` QComboBox
|
||||||
*/
|
*/
|
||||||
int getZoneViewGroupByIndex() const
|
[[nodiscard]] int getZoneViewGroupByIndex() const
|
||||||
{
|
{
|
||||||
return zoneViewGroupByIndex;
|
return zoneViewGroupByIndex;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Currently selected index for the `Sort by X` QComboBox
|
* Currently selected index for the `Sort by X` QComboBox
|
||||||
*/
|
*/
|
||||||
int getZoneViewSortByIndex() const
|
[[nodiscard]] int getZoneViewSortByIndex() const
|
||||||
{
|
{
|
||||||
return zoneViewSortByIndex;
|
return zoneViewSortByIndex;
|
||||||
}
|
}
|
||||||
|
|
@ -744,136 +743,136 @@ public:
|
||||||
Returns if the view should be sorted into pile view.
|
Returns if the view should be sorted into pile view.
|
||||||
@return zoneViewPileView if the view should be sorted into pile view.
|
@return zoneViewPileView if the view should be sorted into pile view.
|
||||||
*/
|
*/
|
||||||
bool getZoneViewPileView() const
|
[[nodiscard]] bool getZoneViewPileView() const
|
||||||
{
|
{
|
||||||
return zoneViewPileView;
|
return zoneViewPileView;
|
||||||
}
|
}
|
||||||
bool getSoundEnabled() const
|
[[nodiscard]] bool getSoundEnabled() const
|
||||||
{
|
{
|
||||||
return soundEnabled;
|
return soundEnabled;
|
||||||
}
|
}
|
||||||
QString getSoundThemeName() const
|
[[nodiscard]] QString getSoundThemeName() const
|
||||||
{
|
{
|
||||||
return soundThemeName;
|
return soundThemeName;
|
||||||
}
|
}
|
||||||
bool getIgnoreUnregisteredUsers() const
|
[[nodiscard]] bool getIgnoreUnregisteredUsers() const
|
||||||
{
|
{
|
||||||
return ignoreUnregisteredUsers;
|
return ignoreUnregisteredUsers;
|
||||||
}
|
}
|
||||||
bool getIgnoreUnregisteredUserMessages() const
|
[[nodiscard]] bool getIgnoreUnregisteredUserMessages() const
|
||||||
{
|
{
|
||||||
return ignoreUnregisteredUserMessages;
|
return ignoreUnregisteredUserMessages;
|
||||||
}
|
}
|
||||||
int getPixmapCacheSize() const
|
[[nodiscard]] int getPixmapCacheSize() const
|
||||||
{
|
{
|
||||||
return pixmapCacheSize;
|
return pixmapCacheSize;
|
||||||
}
|
}
|
||||||
int getNetworkCacheSizeInMB() const
|
[[nodiscard]] int getNetworkCacheSizeInMB() const
|
||||||
{
|
{
|
||||||
return networkCacheSize;
|
return networkCacheSize;
|
||||||
}
|
}
|
||||||
int getRedirectCacheTtl() const
|
[[nodiscard]] int getRedirectCacheTtl() const
|
||||||
{
|
{
|
||||||
return redirectCacheTtl;
|
return redirectCacheTtl;
|
||||||
}
|
}
|
||||||
bool getScaleCards() const
|
[[nodiscard]] bool getScaleCards() const
|
||||||
{
|
{
|
||||||
return scaleCards;
|
return scaleCards;
|
||||||
}
|
}
|
||||||
int getStackCardOverlapPercent() const
|
[[nodiscard]] int getStackCardOverlapPercent() const
|
||||||
{
|
{
|
||||||
return verticalCardOverlapPercent;
|
return verticalCardOverlapPercent;
|
||||||
}
|
}
|
||||||
bool getShowMessagePopup() const
|
[[nodiscard]] bool getShowMessagePopup() const
|
||||||
{
|
{
|
||||||
return showMessagePopups;
|
return showMessagePopups;
|
||||||
}
|
}
|
||||||
bool getShowMentionPopup() const
|
[[nodiscard]] bool getShowMentionPopup() const
|
||||||
{
|
{
|
||||||
return showMentionPopups;
|
return showMentionPopups;
|
||||||
}
|
}
|
||||||
bool getRoomHistory() const
|
[[nodiscard]] bool getRoomHistory() const
|
||||||
{
|
{
|
||||||
return roomHistory;
|
return roomHistory;
|
||||||
}
|
}
|
||||||
bool getLeftJustified() const
|
[[nodiscard]] bool getLeftJustified() const
|
||||||
{
|
{
|
||||||
return leftJustified;
|
return leftJustified;
|
||||||
}
|
}
|
||||||
int getMasterVolume() const
|
[[nodiscard]] int getMasterVolume() const
|
||||||
{
|
{
|
||||||
return masterVolume;
|
return masterVolume;
|
||||||
}
|
}
|
||||||
int getCardInfoViewMode() const
|
[[nodiscard]] int getCardInfoViewMode() const
|
||||||
{
|
{
|
||||||
return cardInfoViewMode;
|
return cardInfoViewMode;
|
||||||
}
|
}
|
||||||
QStringList getCountries() const;
|
[[nodiscard]] QStringList getCountries() const;
|
||||||
QString getHighlightWords() const
|
[[nodiscard]] QString getHighlightWords() const
|
||||||
{
|
{
|
||||||
return highlightWords;
|
return highlightWords;
|
||||||
}
|
}
|
||||||
QString getGameDescription() const
|
[[nodiscard]] QString getGameDescription() const
|
||||||
{
|
{
|
||||||
return gameDescription;
|
return gameDescription;
|
||||||
}
|
}
|
||||||
int getMaxPlayers() const
|
[[nodiscard]] int getMaxPlayers() const
|
||||||
{
|
{
|
||||||
return maxPlayers;
|
return maxPlayers;
|
||||||
}
|
}
|
||||||
QString getGameTypes() const
|
[[nodiscard]] QString getGameTypes() const
|
||||||
{
|
{
|
||||||
return gameTypes;
|
return gameTypes;
|
||||||
}
|
}
|
||||||
bool getOnlyBuddies() const
|
[[nodiscard]] bool getOnlyBuddies() const
|
||||||
{
|
{
|
||||||
return onlyBuddies;
|
return onlyBuddies;
|
||||||
}
|
}
|
||||||
bool getOnlyRegistered() const
|
[[nodiscard]] bool getOnlyRegistered() const
|
||||||
{
|
{
|
||||||
return onlyRegistered;
|
return onlyRegistered;
|
||||||
}
|
}
|
||||||
bool getSpectatorsAllowed() const
|
[[nodiscard]] bool getSpectatorsAllowed() const
|
||||||
{
|
{
|
||||||
return spectatorsAllowed;
|
return spectatorsAllowed;
|
||||||
}
|
}
|
||||||
bool getSpectatorsNeedPassword() const
|
[[nodiscard]] bool getSpectatorsNeedPassword() const
|
||||||
{
|
{
|
||||||
return spectatorsNeedPassword;
|
return spectatorsNeedPassword;
|
||||||
}
|
}
|
||||||
bool getSpectatorsCanTalk() const
|
[[nodiscard]] bool getSpectatorsCanTalk() const
|
||||||
{
|
{
|
||||||
return spectatorsCanTalk;
|
return spectatorsCanTalk;
|
||||||
}
|
}
|
||||||
bool getSpectatorsCanSeeEverything() const
|
[[nodiscard]] bool getSpectatorsCanSeeEverything() const
|
||||||
{
|
{
|
||||||
return spectatorsCanSeeEverything;
|
return spectatorsCanSeeEverything;
|
||||||
}
|
}
|
||||||
int getDefaultStartingLifeTotal() const
|
[[nodiscard]] int getDefaultStartingLifeTotal() const
|
||||||
{
|
{
|
||||||
return defaultStartingLifeTotal;
|
return defaultStartingLifeTotal;
|
||||||
}
|
}
|
||||||
bool getShareDecklistsOnLoad() const
|
[[nodiscard]] bool getShareDecklistsOnLoad() const
|
||||||
{
|
{
|
||||||
return shareDecklistsOnLoad;
|
return shareDecklistsOnLoad;
|
||||||
}
|
}
|
||||||
bool getCreateGameAsSpectator() const
|
[[nodiscard]] bool getCreateGameAsSpectator() const
|
||||||
{
|
{
|
||||||
return createGameAsSpectator;
|
return createGameAsSpectator;
|
||||||
}
|
}
|
||||||
bool getRememberGameSettings() const
|
[[nodiscard]] bool getRememberGameSettings() const
|
||||||
{
|
{
|
||||||
return rememberGameSettings;
|
return rememberGameSettings;
|
||||||
}
|
}
|
||||||
int getKeepAlive() const override
|
[[nodiscard]] int getKeepAlive() const override
|
||||||
{
|
{
|
||||||
return keepalive;
|
return keepalive;
|
||||||
}
|
}
|
||||||
int getTimeOut() const override
|
[[nodiscard]] int getTimeOut() const override
|
||||||
{
|
{
|
||||||
return timeout;
|
return timeout;
|
||||||
}
|
}
|
||||||
int getMaxFontSize() const
|
[[nodiscard]] int getMaxFontSize() const
|
||||||
{
|
{
|
||||||
return maxFontSize;
|
return maxFontSize;
|
||||||
}
|
}
|
||||||
|
|
@ -901,73 +900,73 @@ public:
|
||||||
{
|
{
|
||||||
return useTearOffMenus;
|
return useTearOffMenus;
|
||||||
}
|
}
|
||||||
int getCardViewInitialRowsMax() const
|
[[nodiscard]] int getCardViewInitialRowsMax() const
|
||||||
{
|
{
|
||||||
return cardViewInitialRowsMax;
|
return cardViewInitialRowsMax;
|
||||||
}
|
}
|
||||||
int getCardViewExpandedRowsMax() const
|
[[nodiscard]] int getCardViewExpandedRowsMax() const
|
||||||
{
|
{
|
||||||
return cardViewExpandedRowsMax;
|
return cardViewExpandedRowsMax;
|
||||||
}
|
}
|
||||||
bool getCloseEmptyCardView() const
|
[[nodiscard]] bool getCloseEmptyCardView() const
|
||||||
{
|
{
|
||||||
return closeEmptyCardView;
|
return closeEmptyCardView;
|
||||||
}
|
}
|
||||||
bool getFocusCardViewSearchBar() const
|
[[nodiscard]] bool getFocusCardViewSearchBar() const
|
||||||
{
|
{
|
||||||
return focusCardViewSearchBar;
|
return focusCardViewSearchBar;
|
||||||
}
|
}
|
||||||
ShortcutsSettings &shortcuts() const
|
[[nodiscard]] ShortcutsSettings &shortcuts() const
|
||||||
{
|
{
|
||||||
return *shortcutsSettings;
|
return *shortcutsSettings;
|
||||||
}
|
}
|
||||||
CardDatabaseSettings *cardDatabase() const
|
[[nodiscard]] CardDatabaseSettings *cardDatabase() const
|
||||||
{
|
{
|
||||||
return cardDatabaseSettings;
|
return cardDatabaseSettings;
|
||||||
}
|
}
|
||||||
ServersSettings &servers() const
|
[[nodiscard]] ServersSettings &servers() const
|
||||||
{
|
{
|
||||||
return *serversSettings;
|
return *serversSettings;
|
||||||
}
|
}
|
||||||
MessageSettings &messages() const
|
[[nodiscard]] MessageSettings &messages() const
|
||||||
{
|
{
|
||||||
return *messageSettings;
|
return *messageSettings;
|
||||||
}
|
}
|
||||||
GameFiltersSettings &gameFilters() const
|
[[nodiscard]] GameFiltersSettings &gameFilters() const
|
||||||
{
|
{
|
||||||
return *gameFiltersSettings;
|
return *gameFiltersSettings;
|
||||||
}
|
}
|
||||||
LayoutsSettings &layouts() const
|
[[nodiscard]] LayoutsSettings &layouts() const
|
||||||
{
|
{
|
||||||
return *layoutsSettings;
|
return *layoutsSettings;
|
||||||
}
|
}
|
||||||
DownloadSettings &downloads() const
|
[[nodiscard]] DownloadSettings &downloads() const
|
||||||
{
|
{
|
||||||
return *downloadSettings;
|
return *downloadSettings;
|
||||||
}
|
}
|
||||||
RecentsSettings &recents() const
|
[[nodiscard]] RecentsSettings &recents() const
|
||||||
{
|
{
|
||||||
return *recentsSettings;
|
return *recentsSettings;
|
||||||
}
|
}
|
||||||
CardOverrideSettings &cardOverrides() const
|
[[nodiscard]] CardOverrideSettings &cardOverrides() const
|
||||||
{
|
{
|
||||||
return *cardOverrideSettings;
|
return *cardOverrideSettings;
|
||||||
}
|
}
|
||||||
DebugSettings &debug() const
|
[[nodiscard]] DebugSettings &debug() const
|
||||||
{
|
{
|
||||||
return *debugSettings;
|
return *debugSettings;
|
||||||
}
|
}
|
||||||
CardCounterSettings &cardCounters() const;
|
[[nodiscard]] CardCounterSettings &cardCounters() const;
|
||||||
|
|
||||||
bool getIsPortableBuild() const
|
[[nodiscard]] bool getIsPortableBuild() const
|
||||||
{
|
{
|
||||||
return isPortableBuild;
|
return isPortableBuild;
|
||||||
}
|
}
|
||||||
bool getDownloadSpoilersStatus() const
|
[[nodiscard]] bool getDownloadSpoilersStatus() const
|
||||||
{
|
{
|
||||||
return mbDownloadSpoilers;
|
return mbDownloadSpoilers;
|
||||||
}
|
}
|
||||||
bool getRoundCardCorners() const
|
[[nodiscard]] bool getRoundCardCorners() const
|
||||||
{
|
{
|
||||||
return roundCardCorners;
|
return roundCardCorners;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@
|
||||||
#ifndef CARD_COUNTER_SETTINGS_H
|
#ifndef CARD_COUNTER_SETTINGS_H
|
||||||
#define CARD_COUNTER_SETTINGS_H
|
#define CARD_COUNTER_SETTINGS_H
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <libcockatrice/settings/settings_manager.h>
|
#include <libcockatrice/settings/settings_manager.h>
|
||||||
|
|
||||||
class QSettings;
|
class QSettings;
|
||||||
|
|
@ -20,9 +19,9 @@ class CardCounterSettings : public SettingsManager
|
||||||
public:
|
public:
|
||||||
CardCounterSettings(const QString &settingsPath, QObject *parent = nullptr);
|
CardCounterSettings(const QString &settingsPath, QObject *parent = nullptr);
|
||||||
|
|
||||||
QColor color(int counterId) const;
|
[[nodiscard]] QColor color(int counterId) const;
|
||||||
|
|
||||||
QString displayName(int counterId) const;
|
[[nodiscard]] QString displayName(int counterId) const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setColor(int counterId, const QColor &color);
|
void setColor(int counterId, const QColor &color);
|
||||||
|
|
|
||||||
|
|
@ -150,12 +150,7 @@ void ShortcutTreeView::currentChanged(const QModelIndex ¤t, const QModelIn
|
||||||
*/
|
*/
|
||||||
void ShortcutTreeView::updateSearchString(const QString &searchString)
|
void ShortcutTreeView::updateSearchString(const QString &searchString)
|
||||||
{
|
{
|
||||||
#if QT_VERSION > QT_VERSION_CHECK(5, 14, 0)
|
QStringList searchWords = searchString.split(" ", Qt::SkipEmptyParts);
|
||||||
const auto skipEmptyParts = Qt::SkipEmptyParts;
|
|
||||||
#else
|
|
||||||
const auto skipEmptyParts = QString::SkipEmptyParts;
|
|
||||||
#endif
|
|
||||||
QStringList searchWords = searchString.split(" ", skipEmptyParts);
|
|
||||||
|
|
||||||
auto escapeRegex = [](const QString &s) { return QRegularExpression::escape(s); };
|
auto escapeRegex = [](const QString &s) { return QRegularExpression::escape(s); };
|
||||||
std::transform(searchWords.begin(), searchWords.end(), searchWords.begin(), escapeRegex);
|
std::transform(searchWords.begin(), searchWords.end(), searchWords.begin(), escapeRegex);
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@
|
||||||
#ifndef SHORTCUT_TREEVIEW_H
|
#ifndef SHORTCUT_TREEVIEW_H
|
||||||
#define SHORTCUT_TREEVIEW_H
|
#define SHORTCUT_TREEVIEW_H
|
||||||
|
|
||||||
#include <QModelIndex>
|
|
||||||
#include <QSortFilterProxyModel>
|
#include <QSortFilterProxyModel>
|
||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
#include <QTreeView>
|
#include <QTreeView>
|
||||||
|
|
@ -22,7 +21,7 @@ public:
|
||||||
explicit ShortcutFilterProxyModel(QObject *parent = nullptr);
|
explicit ShortcutFilterProxyModel(QObject *parent = nullptr);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
|
[[nodiscard]] bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ShortcutTreeView : public QTreeView
|
class ShortcutTreeView : public QTreeView
|
||||||
|
|
|
||||||
|
|
@ -99,15 +99,15 @@ public:
|
||||||
void setSequence(const QList &_sequence)
|
void setSequence(const QList &_sequence)
|
||||||
{
|
{
|
||||||
QList::operator=(_sequence);
|
QList::operator=(_sequence);
|
||||||
};
|
}
|
||||||
QString getName() const
|
[[nodiscard]] QString getName() const
|
||||||
{
|
{
|
||||||
return QApplication::translate("shortcutsTab", name.toUtf8().data());
|
return QApplication::translate("shortcutsTab", name.toUtf8().data());
|
||||||
};
|
}
|
||||||
QString getGroupName() const
|
[[nodiscard]] QString getGroupName() const
|
||||||
{
|
{
|
||||||
return ShortcutGroup::getGroupName(group);
|
return ShortcutGroup::getGroupName(group);
|
||||||
};
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString name;
|
QString name;
|
||||||
|
|
@ -120,24 +120,24 @@ class ShortcutsSettings : public QObject
|
||||||
public:
|
public:
|
||||||
explicit ShortcutsSettings(const QString &settingsFilePath, QObject *parent = nullptr);
|
explicit ShortcutsSettings(const QString &settingsFilePath, QObject *parent = nullptr);
|
||||||
|
|
||||||
ShortcutKey getDefaultShortcut(const QString &name) const;
|
[[nodiscard]] ShortcutKey getDefaultShortcut(const QString &name) const;
|
||||||
ShortcutKey getShortcut(const QString &name) const;
|
[[nodiscard]] ShortcutKey getShortcut(const QString &name) const;
|
||||||
QKeySequence getSingleShortcut(const QString &name) const;
|
[[nodiscard]] QKeySequence getSingleShortcut(const QString &name) const;
|
||||||
QString getDefaultShortcutString(const QString &name) const;
|
[[nodiscard]] QString getDefaultShortcutString(const QString &name) const;
|
||||||
QString getShortcutString(const QString &name) const;
|
[[nodiscard]] QString getShortcutString(const QString &name) const;
|
||||||
QString getShortcutFriendlyName(const QString &shortcutName) const;
|
[[nodiscard]] QString getShortcutFriendlyName(const QString &shortcutName) const;
|
||||||
QList<QString> getAllShortcutKeys() const
|
[[nodiscard]] QList<QString> getAllShortcutKeys() const
|
||||||
{
|
{
|
||||||
return shortCuts.keys();
|
return shortCuts.keys();
|
||||||
};
|
}
|
||||||
|
|
||||||
void setShortcuts(const QString &name, const QList<QKeySequence> &Sequence);
|
void setShortcuts(const QString &name, const QList<QKeySequence> &Sequence);
|
||||||
void setShortcuts(const QString &name, const QKeySequence &Sequence);
|
void setShortcuts(const QString &name, const QKeySequence &Sequence);
|
||||||
void setShortcuts(const QString &name, const QString &sequences);
|
void setShortcuts(const QString &name, const QString &sequences);
|
||||||
|
|
||||||
bool isKeyAllowed(const QString &name, const QString &sequences) const;
|
[[nodiscard]] bool isKeyAllowed(const QString &name, const QString &sequences) const;
|
||||||
bool isValid(const QString &name, const QString &sequences) const;
|
[[nodiscard]] bool isValid(const QString &name, const QString &sequences) const;
|
||||||
QStringList findOverlaps(const QString &name, const QString &sequences) const;
|
[[nodiscard]] QStringList findOverlaps(const QString &name, const QString &sequences) const;
|
||||||
|
|
||||||
void resetAllShortcuts();
|
void resetAllShortcuts();
|
||||||
void clearAllShortcuts();
|
void clearAllShortcuts();
|
||||||
|
|
@ -152,8 +152,8 @@ private:
|
||||||
QString settingsFilePath;
|
QString settingsFilePath;
|
||||||
QHash<QString, ShortcutKey> shortCuts;
|
QHash<QString, ShortcutKey> shortCuts;
|
||||||
|
|
||||||
QString stringifySequence(const QList<QKeySequence> &Sequence) const;
|
[[nodiscard]] QString stringifySequence(const QList<QKeySequence> &Sequence) const;
|
||||||
QList<QKeySequence> parseSequenceString(const QString &stringSequence) const;
|
[[nodiscard]] QList<QKeySequence> parseSequenceString(const QString &stringSequence) const;
|
||||||
|
|
||||||
const QHash<QString, ShortcutKey> defaultShortCuts = {
|
const QHash<QString, ShortcutKey> defaultShortCuts = {
|
||||||
{"MainWindow/aCheckCardUpdates", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Check for Card Updates..."),
|
{"MainWindow/aCheckCardUpdates", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Check for Card Updates..."),
|
||||||
|
|
|
||||||
|
|
@ -7,15 +7,15 @@
|
||||||
class SettingsCardPreferenceProvider : public ICardPreferenceProvider
|
class SettingsCardPreferenceProvider : public ICardPreferenceProvider
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QString getCardPreferenceOverride(const QString &cardName) const override
|
[[nodiscard]] QString getCardPreferenceOverride(const QString &cardName) const override
|
||||||
{
|
{
|
||||||
return SettingsCache::instance().cardOverrides().getCardPreferenceOverride(cardName);
|
return SettingsCache::instance().cardOverrides().getCardPreferenceOverride(cardName);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool getIncludeRebalancedCards() const override
|
[[nodiscard]] bool getIncludeRebalancedCards() const override
|
||||||
{
|
{
|
||||||
return SettingsCache::instance().getIncludeRebalancedCards();
|
return SettingsCache::instance().getIncludeRebalancedCards();
|
||||||
};
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // COCKATRICE_SETTINGS_CARD_PREFERENCE_PROVIDER_H
|
#endif // COCKATRICE_SETTINGS_CARD_PREFERENCE_PROVIDER_H
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#include "deck_filter_string.h"
|
#include "deck_filter_string.h"
|
||||||
|
|
||||||
|
#include <QFileInfo>
|
||||||
#include <libcockatrice/card/database/card_database_manager.h>
|
#include <libcockatrice/card/database/card_database_manager.h>
|
||||||
#include <libcockatrice/filters/filter_string.h>
|
#include <libcockatrice/filters/filter_string.h>
|
||||||
#include <libcockatrice/utility/peglib.h>
|
#include <libcockatrice/utility/peglib.h>
|
||||||
|
|
@ -12,7 +13,7 @@ QueryPartList <- ComplexQueryPart ( ws ("AND" ws)? ComplexQueryPart)* ws*
|
||||||
ComplexQueryPart <- SomewhatComplexQueryPart ws "OR" ws ComplexQueryPart / SomewhatComplexQueryPart
|
ComplexQueryPart <- SomewhatComplexQueryPart ws "OR" ws ComplexQueryPart / SomewhatComplexQueryPart
|
||||||
SomewhatComplexQueryPart <- [(] QueryPartList [)] / QueryPart
|
SomewhatComplexQueryPart <- [(] QueryPartList [)] / QueryPart
|
||||||
|
|
||||||
QueryPart <- NotQuery / DeckContentQuery / DeckNameQuery / FileNameQuery / PathQuery / GenericQuery
|
QueryPart <- NotQuery / DeckContentQuery / DeckNameQuery / FileNameQuery / PathQuery / FormatQuery / GenericQuery
|
||||||
|
|
||||||
NotQuery <- ('NOT' ws/'-') SomewhatComplexQueryPart
|
NotQuery <- ('NOT' ws/'-') SomewhatComplexQueryPart
|
||||||
|
|
||||||
|
|
@ -21,8 +22,9 @@ CardSearch <- '[[' CardFilterString ']]'
|
||||||
CardFilterString <- (!']]'.)*
|
CardFilterString <- (!']]'.)*
|
||||||
|
|
||||||
DeckNameQuery <- ([Dd] 'eck')? [Nn] 'ame'? [:] String
|
DeckNameQuery <- ([Dd] 'eck')? [Nn] 'ame'? [:] String
|
||||||
FileNameQuery <- [Ff] ('ile' 'name'?)? [:] String
|
FileNameQuery <- [Ff] ([Nn] / 'ile' ([Nn] 'ame')?) [:] String
|
||||||
PathQuery <- [Pp] 'ath'? [:] String
|
PathQuery <- [Pp] 'ath'? [:] String
|
||||||
|
FormatQuery <- [Ff] 'ormat'? [:] String
|
||||||
|
|
||||||
GenericQuery <- String
|
GenericQuery <- String
|
||||||
|
|
||||||
|
|
@ -117,12 +119,13 @@ static void setupParserRules()
|
||||||
|
|
||||||
return [=](const DeckPreviewWidget *deck, const ExtraDeckSearchInfo &) -> bool {
|
return [=](const DeckPreviewWidget *deck, const ExtraDeckSearchInfo &) -> bool {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
deck->deckLoader->getDeckList()->forEachCard([&](InnerDecklistNode *, const DecklistCardNode *node) {
|
auto cardNodes = deck->deckLoader->getDeck().deckList.getCardNodes();
|
||||||
|
for (auto node : cardNodes) {
|
||||||
auto cardInfoPtr = CardDatabaseManager::query()->getCardInfo(node->getName());
|
auto cardInfoPtr = CardDatabaseManager::query()->getCardInfo(node->getName());
|
||||||
if (!cardInfoPtr.isNull() && cardFilter.check(cardInfoPtr)) {
|
if (!cardInfoPtr.isNull() && cardFilter.check(cardInfoPtr)) {
|
||||||
count += node->getNumber();
|
count += node->getNumber();
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
return numberMatcher(count);
|
return numberMatcher(count);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -136,7 +139,7 @@ static void setupParserRules()
|
||||||
search["DeckNameQuery"] = [](const peg::SemanticValues &sv) -> DeckFilter {
|
search["DeckNameQuery"] = [](const peg::SemanticValues &sv) -> DeckFilter {
|
||||||
auto name = std::any_cast<QString>(sv[0]);
|
auto name = std::any_cast<QString>(sv[0]);
|
||||||
return [=](const DeckPreviewWidget *deck, const ExtraDeckSearchInfo &) {
|
return [=](const DeckPreviewWidget *deck, const ExtraDeckSearchInfo &) {
|
||||||
return deck->deckLoader->getDeckList()->getName().contains(name, Qt::CaseInsensitive);
|
return deck->deckLoader->getDeck().deckList.getName().contains(name, Qt::CaseInsensitive);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -155,6 +158,14 @@ static void setupParserRules()
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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 QString::compare(format, gameFormat, Qt::CaseInsensitive) == 0;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
search["GenericQuery"] = [](const peg::SemanticValues &sv) -> DeckFilter {
|
search["GenericQuery"] = [](const peg::SemanticValues &sv) -> DeckFilter {
|
||||||
auto name = std::any_cast<QString>(sv[0]);
|
auto name = std::any_cast<QString>(sv[0]);
|
||||||
return [=](const DeckPreviewWidget *deck, const ExtraDeckSearchInfo &) {
|
return [=](const DeckPreviewWidget *deck, const ExtraDeckSearchInfo &) {
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,8 @@
|
||||||
#include "../interface/widgets/visual_deck_storage/deck_preview/deck_preview_widget.h"
|
#include "../interface/widgets/visual_deck_storage/deck_preview/deck_preview_widget.h"
|
||||||
|
|
||||||
#include <QLoggingCategory>
|
#include <QLoggingCategory>
|
||||||
#include <QMap>
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <utility>
|
|
||||||
|
|
||||||
inline Q_LOGGING_CATEGORY(DeckFilterStringLog, "deck_filter_string");
|
inline Q_LOGGING_CATEGORY(DeckFilterStringLog, "deck_filter_string");
|
||||||
|
|
||||||
|
|
@ -40,7 +38,7 @@ public:
|
||||||
return filter(deck, info);
|
return filter(deck, info);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool valid() const
|
[[nodiscard]] bool valid() const
|
||||||
{
|
{
|
||||||
return _error.isEmpty();
|
return _error.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,8 @@ public slots:
|
||||||
void addFilter(const CardFilter *f);
|
void addFilter(const CardFilter *f);
|
||||||
void removeFilter(const CardFilter *f);
|
void removeFilter(const CardFilter *f);
|
||||||
void clearFiltersOfType(CardFilter::Attr filterType);
|
void clearFiltersOfType(CardFilter::Attr filterType);
|
||||||
QList<const CardFilter *> getFiltersOfType(CardFilter::Attr filterType) const;
|
[[nodiscard]] QList<const CardFilter *> getFiltersOfType(CardFilter::Attr filterType) const;
|
||||||
QList<const CardFilter *> allFilters() const;
|
[[nodiscard]] QList<const CardFilter *> allFilters() const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void proxyBeginInsertRow(const FilterTreeNode *, int);
|
void proxyBeginInsertRow(const FilterTreeNode *, int);
|
||||||
|
|
@ -34,23 +34,23 @@ private slots:
|
||||||
void proxyEndRemoveRow(const FilterTreeNode *, int);
|
void proxyEndRemoveRow(const FilterTreeNode *, int);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FilterTreeNode *indexToNode(const QModelIndex &idx) const;
|
[[nodiscard]] FilterTreeNode *indexToNode(const QModelIndex &idx) const;
|
||||||
QModelIndex nodeIndex(const FilterTreeNode *node, int row, int column) const;
|
QModelIndex nodeIndex(const FilterTreeNode *node, int row, int column) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FilterTreeModel(QObject *parent = nullptr);
|
FilterTreeModel(QObject *parent = nullptr);
|
||||||
~FilterTreeModel() override;
|
~FilterTreeModel() override;
|
||||||
FilterTree *filterTree() const
|
[[nodiscard]] FilterTree *filterTree() const
|
||||||
{
|
{
|
||||||
return fTree;
|
return fTree;
|
||||||
}
|
}
|
||||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
[[nodiscard]] int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||||
int columnCount(const QModelIndex & /*parent*/ = QModelIndex()) const override;
|
[[nodiscard]] int columnCount(const QModelIndex & /*parent*/ = QModelIndex()) const override;
|
||||||
QVariant data(const QModelIndex &index, int role) const override;
|
[[nodiscard]] QVariant data(const QModelIndex &index, int role) const override;
|
||||||
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
|
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
|
||||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
[[nodiscard]] Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||||
QModelIndex parent(const QModelIndex &ind) const override;
|
[[nodiscard]] QModelIndex parent(const QModelIndex &ind) const override;
|
||||||
QModelIndex index(int row, int column, const QModelIndex &parent) const override;
|
[[nodiscard]] QModelIndex index(int row, int column, const QModelIndex &parent) const override;
|
||||||
bool removeRows(int row, int count, const QModelIndex &parent) override;
|
bool removeRows(int row, int count, const QModelIndex &parent) override;
|
||||||
void clear();
|
void clear();
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -3,15 +3,14 @@
|
||||||
#include "../../client/settings/cache_settings.h"
|
#include "../../client/settings/cache_settings.h"
|
||||||
#include "../../interface/widgets/tabs/tab_game.h"
|
#include "../../interface/widgets/tabs/tab_game.h"
|
||||||
#include "../player/player.h"
|
#include "../player/player.h"
|
||||||
|
#include "../player/player_actions.h"
|
||||||
#include "translate_counter_name.h"
|
#include "translate_counter_name.h"
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QGraphicsSceneHoverEvent>
|
|
||||||
#include <QGraphicsSceneMouseEvent>
|
#include <QGraphicsSceneMouseEvent>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QPainter>
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <libcockatrice/protocol/pb/command_inc_counter.pb.h>
|
#include <libcockatrice/protocol/pb/command_inc_counter.pb.h>
|
||||||
#include <libcockatrice/protocol/pb/command_set_counter.pb.h>
|
#include <libcockatrice/protocol/pb/command_set_counter.pb.h>
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "../../client/settings/cache_settings.h"
|
#include "../../client/settings/cache_settings.h"
|
||||||
#include "../player/player.h"
|
#include "../player/player.h"
|
||||||
|
#include "../player/player_actions.h"
|
||||||
#include "../player/player_target.h"
|
#include "../player/player_target.h"
|
||||||
#include "../zones/card_zone.h"
|
#include "../zones/card_zone.h"
|
||||||
#include "card_item.h"
|
#include "card_item.h"
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
#include "../game_scene.h"
|
#include "../game_scene.h"
|
||||||
#include "../phase.h"
|
#include "../phase.h"
|
||||||
#include "../player/player.h"
|
#include "../player/player.h"
|
||||||
#include "../zones/card_zone.h"
|
#include "../player/player_actions.h"
|
||||||
#include "../zones/logic/view_zone_logic.h"
|
#include "../zones/logic/view_zone_logic.h"
|
||||||
#include "../zones/table_zone.h"
|
#include "../zones/table_zone.h"
|
||||||
#include "../zones/view_zone.h"
|
#include "../zones/view_zone.h"
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <libcockatrice/card/card_info.h>
|
#include <libcockatrice/card/card_info.h>
|
||||||
#include <libcockatrice/deck_list/deck_list.h>
|
#include <libcockatrice/deck_list/deck_list.h>
|
||||||
#include <libcockatrice/deck_list/deck_list_card_node.h>
|
#include <libcockatrice/deck_list/tree/deck_list_card_node.h>
|
||||||
|
|
||||||
DeckViewCardDragItem::DeckViewCardDragItem(DeckViewCard *_item,
|
DeckViewCardDragItem::DeckViewCardDragItem(DeckViewCard *_item,
|
||||||
const QPointF &_hotSpot,
|
const QPointF &_hotSpot,
|
||||||
|
|
@ -343,10 +343,7 @@ void DeckViewScene::rebuildTree()
|
||||||
if (!deck)
|
if (!deck)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
InnerDecklistNode *listRoot = deck->getRoot();
|
for (auto *currentZone : deck->getZoneNodes()) {
|
||||||
for (int i = 0; i < listRoot->size(); i++) {
|
|
||||||
auto *currentZone = dynamic_cast<InnerDecklistNode *>(listRoot->at(i));
|
|
||||||
|
|
||||||
DeckViewCardContainer *container = cardContainers.value(currentZone->getName(), 0);
|
DeckViewCardContainer *container = cardContainers.value(currentZone->getName(), 0);
|
||||||
if (!container) {
|
if (!container) {
|
||||||
container = new DeckViewCardContainer(currentZone->getName());
|
container = new DeckViewCardContainer(currentZone->getName());
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,8 @@
|
||||||
|
|
||||||
#include "../board/abstract_card_drag_item.h"
|
#include "../board/abstract_card_drag_item.h"
|
||||||
|
|
||||||
#include <QGraphicsScene>
|
|
||||||
#include <QGraphicsView>
|
#include <QGraphicsView>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QMultiMap>
|
|
||||||
#include <QPixmap>
|
|
||||||
#include <libcockatrice/protocol/pb/move_card_to_zone.pb.h>
|
#include <libcockatrice/protocol/pb/move_card_to_zone.pb.h>
|
||||||
|
|
||||||
class DeckList;
|
class DeckList;
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,9 @@
|
||||||
#include "../../interface/widgets/dialogs/dlg_load_deck_from_website.h"
|
#include "../../interface/widgets/dialogs/dlg_load_deck_from_website.h"
|
||||||
#include "../../interface/widgets/dialogs/dlg_load_remote_deck.h"
|
#include "../../interface/widgets/dialogs/dlg_load_remote_deck.h"
|
||||||
#include "../../interface/widgets/tabs/tab_game.h"
|
#include "../../interface/widgets/tabs/tab_game.h"
|
||||||
#include "../game_scene.h"
|
|
||||||
#include "deck_view.h"
|
#include "deck_view.h"
|
||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QMouseEvent>
|
|
||||||
#include <QToolButton>
|
|
||||||
#include <google/protobuf/descriptor.h>
|
|
||||||
#include <libcockatrice/card/database/card_database.h>
|
#include <libcockatrice/card/database/card_database.h>
|
||||||
#include <libcockatrice/card/database/card_database_manager.h>
|
#include <libcockatrice/card/database/card_database_manager.h>
|
||||||
#include <libcockatrice/protocol/pb/command_deck_select.pb.h>
|
#include <libcockatrice/protocol/pb/command_deck_select.pb.h>
|
||||||
|
|
@ -263,7 +259,7 @@ void DeckViewContainer::loadLocalDeck()
|
||||||
|
|
||||||
void DeckViewContainer::loadDeckFromFile(const QString &filePath)
|
void DeckViewContainer::loadDeckFromFile(const QString &filePath)
|
||||||
{
|
{
|
||||||
DeckLoader::FileFormat fmt = DeckLoader::getFormatFromName(filePath);
|
DeckFileFormat::Format fmt = DeckFileFormat::getFormatFromName(filePath);
|
||||||
DeckLoader deck(this);
|
DeckLoader deck(this);
|
||||||
|
|
||||||
bool success = deck.loadFromFile(filePath, fmt, true);
|
bool success = deck.loadFromFile(filePath, fmt, true);
|
||||||
|
|
@ -273,12 +269,12 @@ void DeckViewContainer::loadDeckFromFile(const QString &filePath)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
loadDeckFromDeckLoader(&deck);
|
loadDeckFromDeckList(deck.getDeck().deckList);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeckViewContainer::loadDeckFromDeckLoader(DeckLoader *deck)
|
void DeckViewContainer::loadDeckFromDeckList(const DeckList &deck)
|
||||||
{
|
{
|
||||||
QString deckString = deck->getDeckList()->writeToString_Native();
|
QString deckString = deck.writeToString_Native();
|
||||||
|
|
||||||
if (deckString.length() > MAX_FILE_LENGTH) {
|
if (deckString.length() > MAX_FILE_LENGTH) {
|
||||||
QMessageBox::critical(this, tr("Error"), tr("Deck is greater than maximum file size."));
|
QMessageBox::critical(this, tr("Error"), tr("Deck is greater than maximum file size."));
|
||||||
|
|
@ -312,8 +308,8 @@ void DeckViewContainer::loadFromClipboard()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DeckLoader *deck = dlg.getDeckList();
|
DeckList deck = dlg.getDeckList();
|
||||||
loadDeckFromDeckLoader(deck);
|
loadDeckFromDeckList(deck);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeckViewContainer::loadFromWebsite()
|
void DeckViewContainer::loadFromWebsite()
|
||||||
|
|
@ -324,16 +320,15 @@ void DeckViewContainer::loadFromWebsite()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DeckLoader *deck = dlg.getDeck();
|
DeckList deck = dlg.getDeck();
|
||||||
loadDeckFromDeckLoader(deck);
|
loadDeckFromDeckList(deck);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeckViewContainer::deckSelectFinished(const Response &r)
|
void DeckViewContainer::deckSelectFinished(const Response &r)
|
||||||
{
|
{
|
||||||
const Response_DeckDownload &resp = r.GetExtension(Response_DeckDownload::ext);
|
const Response_DeckDownload &resp = r.GetExtension(Response_DeckDownload::ext);
|
||||||
DeckLoader newDeck(this, new DeckList(QString::fromStdString(resp.deck())));
|
DeckList newDeck = DeckList(QString::fromStdString(resp.deck()));
|
||||||
CardPictureLoader::cacheCardPixmaps(
|
CardPictureLoader::cacheCardPixmaps(CardDatabaseManager::query()->getCards(newDeck.getCardRefList()));
|
||||||
CardDatabaseManager::query()->getCards(newDeck.getDeckList()->getCardRefList()));
|
|
||||||
setDeck(newDeck);
|
setDeck(newDeck);
|
||||||
switchToDeckLoadedView();
|
switchToDeckLoadedView();
|
||||||
}
|
}
|
||||||
|
|
@ -414,8 +409,8 @@ void DeckViewContainer::setSideboardLocked(bool locked)
|
||||||
deckView->resetSideboardPlan();
|
deckView->resetSideboardPlan();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeckViewContainer::setDeck(DeckLoader &deck)
|
void DeckViewContainer::setDeck(const DeckList &deck)
|
||||||
{
|
{
|
||||||
deckView->setDeck(*deck.getDeckList());
|
deckView->setDeck(deck);
|
||||||
switchToDeckLoadedView();
|
switchToDeckLoadedView();
|
||||||
}
|
}
|
||||||
|
|
@ -85,12 +85,12 @@ public:
|
||||||
void setReadyStart(bool ready);
|
void setReadyStart(bool ready);
|
||||||
void readyAndUpdate();
|
void readyAndUpdate();
|
||||||
void setSideboardLocked(bool locked);
|
void setSideboardLocked(bool locked);
|
||||||
void setDeck(DeckLoader &deck);
|
void setDeck(const DeckList &deck);
|
||||||
void setVisualDeckStorageExists(bool exists);
|
void setVisualDeckStorageExists(bool exists);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void loadDeckFromFile(const QString &filePath);
|
void loadDeckFromFile(const QString &filePath);
|
||||||
void loadDeckFromDeckLoader(DeckLoader *deck);
|
void loadDeckFromDeckList(const DeckList &deck);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DECK_VIEW_CONTAINER_H
|
#endif // DECK_VIEW_CONTAINER_H
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QRadioButton>
|
#include <QRadioButton>
|
||||||
#include <QTreeView>
|
#include <QTreeView>
|
||||||
#include <QVBoxLayout>
|
|
||||||
#include <libcockatrice/card/database/card_database_manager.h>
|
#include <libcockatrice/card/database/card_database_manager.h>
|
||||||
#include <libcockatrice/deck_list/deck_list.h>
|
#include <libcockatrice/deck_list/deck_list.h>
|
||||||
#include <libcockatrice/models/database/card_database_model.h>
|
#include <libcockatrice/models/database/card_database_model.h>
|
||||||
|
|
@ -118,11 +117,7 @@ DlgCreateToken::DlgCreateToken(const QStringList &_predefinedTokens, QWidget *pa
|
||||||
chooseTokenFromDeckRadioButton->setDisabled(true); // No tokens in deck = no need for option
|
chooseTokenFromDeckRadioButton->setDisabled(true); // No tokens in deck = no need for option
|
||||||
} else {
|
} else {
|
||||||
chooseTokenFromDeckRadioButton->setChecked(true);
|
chooseTokenFromDeckRadioButton->setChecked(true);
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
|
||||||
cardDatabaseDisplayModel->setCardNameSet(QSet<QString>(predefinedTokens.begin(), predefinedTokens.end()));
|
cardDatabaseDisplayModel->setCardNameSet(QSet<QString>(predefinedTokens.begin(), predefinedTokens.end()));
|
||||||
#else
|
|
||||||
cardDatabaseDisplayModel->setCardNameSet(QSet<QString>::fromList(predefinedTokens));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto *tokenChooseLayout = new QVBoxLayout;
|
auto *tokenChooseLayout = new QVBoxLayout;
|
||||||
|
|
@ -224,11 +219,7 @@ void DlgCreateToken::actChooseTokenFromAll(bool checked)
|
||||||
void DlgCreateToken::actChooseTokenFromDeck(bool checked)
|
void DlgCreateToken::actChooseTokenFromDeck(bool checked)
|
||||||
{
|
{
|
||||||
if (checked) {
|
if (checked) {
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
|
||||||
cardDatabaseDisplayModel->setCardNameSet(QSet<QString>(predefinedTokens.begin(), predefinedTokens.end()));
|
cardDatabaseDisplayModel->setCardNameSet(QSet<QString>(predefinedTokens.begin(), predefinedTokens.end()));
|
||||||
#else
|
|
||||||
cardDatabaseDisplayModel->setCardNameSet(QSet<QString>::fromList(predefinedTokens));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@
|
||||||
#define DLG_CREATETOKEN_H
|
#define DLG_CREATETOKEN_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QModelIndex>
|
|
||||||
|
|
||||||
class QLabel;
|
class QLabel;
|
||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@
|
||||||
#include <libcockatrice/protocol/pb/command_set_active_phase.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_connection_state_changed.pb.h>
|
||||||
#include <libcockatrice/protocol/pb/context_deck_select.pb.h>
|
#include <libcockatrice/protocol/pb/context_deck_select.pb.h>
|
||||||
#include <libcockatrice/protocol/pb/context_ping_changed.pb.h>
|
|
||||||
#include <libcockatrice/protocol/pb/event_game_closed.pb.h>
|
#include <libcockatrice/protocol/pb/event_game_closed.pb.h>
|
||||||
#include <libcockatrice/protocol/pb/event_game_host_changed.pb.h>
|
#include <libcockatrice/protocol/pb/event_game_host_changed.pb.h>
|
||||||
#include <libcockatrice/protocol/pb/event_game_say.pb.h>
|
#include <libcockatrice/protocol/pb/event_game_say.pb.h>
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@
|
||||||
#include "zones/view_zone.h"
|
#include "zones/view_zone.h"
|
||||||
#include "zones/view_zone_widget.h"
|
#include "zones/view_zone_widget.h"
|
||||||
|
|
||||||
#include <QAction>
|
|
||||||
#include <QBasicTimer>
|
#include <QBasicTimer>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QGraphicsSceneMouseEvent>
|
#include <QGraphicsSceneMouseEvent>
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,8 @@
|
||||||
#ifndef COCKATRICE_GAME_STATE_H
|
#ifndef COCKATRICE_GAME_STATE_H
|
||||||
#define COCKATRICE_GAME_STATE_H
|
#define COCKATRICE_GAME_STATE_H
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <libcockatrice/network/client/abstract/abstract_client.h>
|
#include <libcockatrice/network/client/abstract/abstract_client.h>
|
||||||
#include <libcockatrice/protocol/pb/serverinfo_game.pb.h>
|
|
||||||
|
|
||||||
class AbstractGame;
|
class AbstractGame;
|
||||||
class ServerInfo_PlayerProperties;
|
class ServerInfo_PlayerProperties;
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,10 @@
|
||||||
#include "../board/translate_counter_name.h"
|
#include "../board/translate_counter_name.h"
|
||||||
#include "../phase.h"
|
#include "../phase.h"
|
||||||
#include "../player/player.h"
|
#include "../player/player.h"
|
||||||
#include "../zones/card_zone.h"
|
|
||||||
|
|
||||||
#include <../../client/settings/card_counter_settings.h>
|
#include <../../client/settings/card_counter_settings.h>
|
||||||
#include <libcockatrice/protocol/pb/context_move_card.pb.h>
|
#include <libcockatrice/protocol/pb/context_move_card.pb.h>
|
||||||
#include <libcockatrice/protocol/pb/context_mulligan.pb.h>
|
#include <libcockatrice/protocol/pb/context_mulligan.pb.h>
|
||||||
#include <libcockatrice/protocol/pb/serverinfo_user.pb.h>
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
static const QString TABLE_ZONE_NAME = "table";
|
static const QString TABLE_ZONE_NAME = "table";
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,9 @@
|
||||||
#ifndef MESSAGELOGWIDGET_H
|
#ifndef MESSAGELOGWIDGET_H
|
||||||
#define MESSAGELOGWIDGET_H
|
#define MESSAGELOGWIDGET_H
|
||||||
|
|
||||||
#include "../../client/translation.h"
|
|
||||||
#include "../../interface/widgets/server/chat_view/chat_view.h"
|
#include "../../interface/widgets/server/chat_view/chat_view.h"
|
||||||
#include "../zones/logic/card_zone_logic.h"
|
#include "../zones/logic/card_zone_logic.h"
|
||||||
|
|
||||||
#include <libcockatrice/network/server/remote/user_level.h>
|
|
||||||
|
|
||||||
class AbstractGame;
|
class AbstractGame;
|
||||||
class CardItem;
|
class CardItem;
|
||||||
class GameEventContext;
|
class GameEventContext;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
#include "../../abstract_game.h"
|
#include "../../abstract_game.h"
|
||||||
#include "../player.h"
|
#include "../player.h"
|
||||||
#include "../player_actions.h"
|
#include "../player_actions.h"
|
||||||
#include "grave_menu.h"
|
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,11 @@
|
||||||
#include "../../../interface/widgets/tabs/tab_game.h"
|
#include "../../../interface/widgets/tabs/tab_game.h"
|
||||||
#include "../../board/card_item.h"
|
#include "../../board/card_item.h"
|
||||||
#include "../../zones/hand_zone.h"
|
#include "../../zones/hand_zone.h"
|
||||||
#include "../card_menu_action_type.h"
|
#include "../../zones/pile_zone.h"
|
||||||
#include "../player_actions.h"
|
#include "../../zones/table_zone.h"
|
||||||
#include "card_menu.h"
|
#include "card_menu.h"
|
||||||
#include "hand_menu.h"
|
#include "hand_menu.h"
|
||||||
|
|
||||||
#include <libcockatrice/card/database/card_database_manager.h>
|
|
||||||
#include <libcockatrice/protocol/pb/command_reveal_cards.pb.h>
|
#include <libcockatrice/protocol/pb/command_reveal_cards.pb.h>
|
||||||
|
|
||||||
PlayerMenu::PlayerMenu(Player *_player) : player(_player)
|
PlayerMenu::PlayerMenu(Player *_player) : player(_player)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#include "sideboard_menu.h"
|
#include "sideboard_menu.h"
|
||||||
|
|
||||||
#include "../player.h"
|
#include "../player.h"
|
||||||
|
#include "../player_actions.h"
|
||||||
|
|
||||||
SideboardMenu::SideboardMenu(Player *player, QMenu *playerMenu) : QMenu(playerMenu)
|
SideboardMenu::SideboardMenu(Player *player, QMenu *playerMenu) : QMenu(playerMenu)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,13 @@
|
||||||
#include "utility_menu.h"
|
#include "utility_menu.h"
|
||||||
|
|
||||||
|
#include "../../../interface/deck_loader/deck_loader.h"
|
||||||
#include "../player.h"
|
#include "../player.h"
|
||||||
#include "../player_actions.h"
|
#include "../player_actions.h"
|
||||||
#include "player_menu.h"
|
#include "player_menu.h"
|
||||||
|
|
||||||
|
#include <libcockatrice/deck_list/tree/deck_list_card_node.h>
|
||||||
|
#include <libcockatrice/deck_list/tree/inner_deck_list_node.h>
|
||||||
|
|
||||||
UtilityMenu::UtilityMenu(Player *_player, QMenu *playerMenu) : QMenu(playerMenu), player(_player)
|
UtilityMenu::UtilityMenu(Player *_player, QMenu *playerMenu) : QMenu(playerMenu), player(_player)
|
||||||
{
|
{
|
||||||
PlayerActions *playerActions = player->getPlayerActions();
|
PlayerActions *playerActions = player->getPlayerActions();
|
||||||
|
|
@ -56,21 +60,19 @@ void UtilityMenu::populatePredefinedTokensMenu()
|
||||||
clear();
|
clear();
|
||||||
setEnabled(false);
|
setEnabled(false);
|
||||||
predefinedTokens.clear();
|
predefinedTokens.clear();
|
||||||
DeckLoader *_deck = player->getDeck();
|
const DeckList &deckList = player->getDeck();
|
||||||
|
|
||||||
if (!_deck) {
|
if (deckList.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
InnerDecklistNode *tokenZone =
|
auto tokenCardNodes = deckList.getCardNodes({DECK_ZONE_TOKENS});
|
||||||
dynamic_cast<InnerDecklistNode *>(_deck->getDeckList()->getRoot()->findChild(DECK_ZONE_TOKENS));
|
|
||||||
|
|
||||||
if (tokenZone) {
|
if (!tokenCardNodes.isEmpty()) {
|
||||||
if (!tokenZone->empty())
|
setEnabled(true);
|
||||||
setEnabled(true);
|
|
||||||
|
|
||||||
for (int i = 0; i < tokenZone->size(); ++i) {
|
for (int i = 0; i < tokenCardNodes.size(); ++i) {
|
||||||
const QString tokenName = tokenZone->at(i)->getName();
|
const QString tokenName = tokenCardNodes[i]->getName();
|
||||||
predefinedTokens.append(tokenName);
|
predefinedTokens.append(tokenName);
|
||||||
QAction *a = addAction(tokenName);
|
QAction *a = addAction(tokenName);
|
||||||
if (i < 10) {
|
if (i < 10) {
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
#include "../zones/pile_zone.h"
|
#include "../zones/pile_zone.h"
|
||||||
#include "../zones/stack_zone.h"
|
#include "../zones/stack_zone.h"
|
||||||
#include "../zones/table_zone.h"
|
#include "../zones/table_zone.h"
|
||||||
#include "../zones/view_zone.h"
|
#include "player_actions.h"
|
||||||
#include "player_target.h"
|
#include "player_target.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
@ -32,7 +32,7 @@
|
||||||
Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, AbstractGame *_parent)
|
Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, AbstractGame *_parent)
|
||||||
: QObject(_parent), game(_parent), playerInfo(new PlayerInfo(info, _id, _local, _judge)),
|
: QObject(_parent), game(_parent), playerInfo(new PlayerInfo(info, _id, _local, _judge)),
|
||||||
playerEventHandler(new PlayerEventHandler(this)), playerActions(new PlayerActions(this)), active(false),
|
playerEventHandler(new PlayerEventHandler(this)), playerActions(new PlayerActions(this)), active(false),
|
||||||
conceded(false), deck(nullptr), zoneId(0), dialogSemaphore(false)
|
conceded(false), zoneId(0), dialogSemaphore(false)
|
||||||
{
|
{
|
||||||
initializeZones();
|
initializeZones();
|
||||||
|
|
||||||
|
|
@ -263,10 +263,9 @@ void Player::deleteCard(CardItem *card)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Does a player need a DeckLoader?
|
void Player::setDeck(const DeckList &_deck)
|
||||||
void Player::setDeck(DeckLoader &_deck)
|
|
||||||
{
|
{
|
||||||
deck = new DeckLoader(this, _deck.getDeckList());
|
deck = _deck;
|
||||||
|
|
||||||
emit deckChanged();
|
emit deckChanged();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,12 @@
|
||||||
|
|
||||||
#include "../../game_graphics/board/abstract_graphics_item.h"
|
#include "../../game_graphics/board/abstract_graphics_item.h"
|
||||||
#include "../../interface/widgets/menus/tearoff_menu.h"
|
#include "../../interface/widgets/menus/tearoff_menu.h"
|
||||||
#include "../dialogs/dlg_create_token.h"
|
#include "../interface/deck_loader/loaded_deck.h"
|
||||||
|
#include "../zones/logic/hand_zone_logic.h"
|
||||||
|
#include "../zones/logic/pile_zone_logic.h"
|
||||||
|
#include "../zones/logic/stack_zone_logic.h"
|
||||||
|
#include "../zones/logic/table_zone_logic.h"
|
||||||
#include "menu/player_menu.h"
|
#include "menu/player_menu.h"
|
||||||
#include "player_actions.h"
|
|
||||||
#include "player_area.h"
|
#include "player_area.h"
|
||||||
#include "player_event_handler.h"
|
#include "player_event_handler.h"
|
||||||
#include "player_graphics_item.h"
|
#include "player_graphics_item.h"
|
||||||
|
|
@ -20,9 +23,7 @@
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
#include <QLoggingCategory>
|
#include <QLoggingCategory>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QPoint>
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <libcockatrice/card/card_info.h>
|
|
||||||
#include <libcockatrice/filters/filter_string.h>
|
#include <libcockatrice/filters/filter_string.h>
|
||||||
#include <libcockatrice/protocol/pb/card_attributes.pb.h>
|
#include <libcockatrice/protocol/pb/card_attributes.pb.h>
|
||||||
#include <libcockatrice/protocol/pb/game_event.pb.h>
|
#include <libcockatrice/protocol/pb/game_event.pb.h>
|
||||||
|
|
@ -44,7 +45,6 @@ class ArrowTarget;
|
||||||
class CardDatabase;
|
class CardDatabase;
|
||||||
class CardZone;
|
class CardZone;
|
||||||
class CommandContainer;
|
class CommandContainer;
|
||||||
class DeckLoader;
|
|
||||||
class GameCommand;
|
class GameCommand;
|
||||||
class GameEvent;
|
class GameEvent;
|
||||||
class PlayerInfo;
|
class PlayerInfo;
|
||||||
|
|
@ -66,7 +66,7 @@ class Player : public QObject
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void openDeckEditor(DeckLoader *deck);
|
void openDeckEditor(const LoadedDeck &deck);
|
||||||
void deckChanged();
|
void deckChanged();
|
||||||
void newCardAdded(AbstractCardItem *card);
|
void newCardAdded(AbstractCardItem *card);
|
||||||
void rearrangeCounters();
|
void rearrangeCounters();
|
||||||
|
|
@ -113,7 +113,7 @@ public:
|
||||||
[[nodiscard]] PlayerActions *getPlayerActions() const
|
[[nodiscard]] PlayerActions *getPlayerActions() const
|
||||||
{
|
{
|
||||||
return playerActions;
|
return playerActions;
|
||||||
};
|
}
|
||||||
|
|
||||||
[[nodiscard]] PlayerEventHandler *getPlayerEventHandler() const
|
[[nodiscard]] PlayerEventHandler *getPlayerEventHandler() const
|
||||||
{
|
{
|
||||||
|
|
@ -123,16 +123,16 @@ public:
|
||||||
[[nodiscard]] PlayerInfo *getPlayerInfo() const
|
[[nodiscard]] PlayerInfo *getPlayerInfo() const
|
||||||
{
|
{
|
||||||
return playerInfo;
|
return playerInfo;
|
||||||
};
|
}
|
||||||
|
|
||||||
[[nodiscard]] PlayerMenu *getPlayerMenu() const
|
[[nodiscard]] PlayerMenu *getPlayerMenu() const
|
||||||
{
|
{
|
||||||
return playerMenu;
|
return playerMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setDeck(DeckLoader &_deck);
|
void setDeck(const DeckList &_deck);
|
||||||
|
|
||||||
[[nodiscard]] DeckLoader *getDeck() const
|
[[nodiscard]] const DeckList &getDeck() const
|
||||||
{
|
{
|
||||||
return deck;
|
return deck;
|
||||||
}
|
}
|
||||||
|
|
@ -241,7 +241,7 @@ private:
|
||||||
bool active;
|
bool active;
|
||||||
bool conceded;
|
bool conceded;
|
||||||
|
|
||||||
DeckLoader *deck;
|
DeckList deck;
|
||||||
|
|
||||||
int zoneId;
|
int zoneId;
|
||||||
QMap<QString, CardZoneLogic *> zones;
|
QMap<QString, CardZoneLogic *> zones;
|
||||||
|
|
|
||||||
|
|
@ -5,14 +5,15 @@
|
||||||
#include "../board/card_item.h"
|
#include "../board/card_item.h"
|
||||||
#include "../dialogs/dlg_move_top_cards_until.h"
|
#include "../dialogs/dlg_move_top_cards_until.h"
|
||||||
#include "../dialogs/dlg_roll_dice.h"
|
#include "../dialogs/dlg_roll_dice.h"
|
||||||
|
#include "../zones/hand_zone.h"
|
||||||
#include "../zones/logic/view_zone_logic.h"
|
#include "../zones/logic/view_zone_logic.h"
|
||||||
|
#include "../zones/table_zone.h"
|
||||||
#include "card_menu_action_type.h"
|
#include "card_menu_action_type.h"
|
||||||
|
|
||||||
#include <libcockatrice/card/database/card_database_manager.h>
|
#include <libcockatrice/card/database/card_database_manager.h>
|
||||||
#include <libcockatrice/card/relation/card_relation.h>
|
#include <libcockatrice/card/relation/card_relation.h>
|
||||||
#include <libcockatrice/protocol/pb/command_attach_card.pb.h>
|
#include <libcockatrice/protocol/pb/command_attach_card.pb.h>
|
||||||
#include <libcockatrice/protocol/pb/command_change_zone_properties.pb.h>
|
#include <libcockatrice/protocol/pb/command_change_zone_properties.pb.h>
|
||||||
#include <libcockatrice/protocol/pb/command_concede.pb.h>
|
|
||||||
#include <libcockatrice/protocol/pb/command_create_token.pb.h>
|
#include <libcockatrice/protocol/pb/command_create_token.pb.h>
|
||||||
#include <libcockatrice/protocol/pb/command_draw_cards.pb.h>
|
#include <libcockatrice/protocol/pb/command_draw_cards.pb.h>
|
||||||
#include <libcockatrice/protocol/pb/command_flip_card.pb.h>
|
#include <libcockatrice/protocol/pb/command_flip_card.pb.h>
|
||||||
|
|
@ -217,7 +218,7 @@ void PlayerActions::actAlwaysLookAtTopCard()
|
||||||
|
|
||||||
void PlayerActions::actOpenDeckInDeckEditor()
|
void PlayerActions::actOpenDeckInDeckEditor()
|
||||||
{
|
{
|
||||||
emit player->openDeckEditor(player->getDeck());
|
emit player->openDeckEditor({.deckList = player->getDeck()});
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerActions::actViewGraveyard()
|
void PlayerActions::actViewGraveyard()
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#ifndef COCKATRICE_PLAYER_ACTIONS_H
|
#ifndef COCKATRICE_PLAYER_ACTIONS_H
|
||||||
#define COCKATRICE_PLAYER_ACTIONS_H
|
#define COCKATRICE_PLAYER_ACTIONS_H
|
||||||
|
#include "../dialogs/dlg_create_token.h"
|
||||||
#include "event_processing_options.h"
|
#include "event_processing_options.h"
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
#include "../board/card_list.h"
|
#include "../board/card_list.h"
|
||||||
#include "../zones/view_zone.h"
|
#include "../zones/view_zone.h"
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
|
#include "player_actions.h"
|
||||||
|
|
||||||
#include <libcockatrice/protocol/pb/command_set_card_attr.pb.h>
|
#include <libcockatrice/protocol/pb/command_set_card_attr.pb.h>
|
||||||
#include <libcockatrice/protocol/pb/context_move_card.pb.h>
|
#include <libcockatrice/protocol/pb/context_move_card.pb.h>
|
||||||
|
|
@ -77,14 +78,7 @@ void PlayerEventHandler::eventShuffle(const Event_Shuffle &event)
|
||||||
void PlayerEventHandler::eventRollDie(const Event_RollDie &event)
|
void PlayerEventHandler::eventRollDie(const Event_RollDie &event)
|
||||||
{
|
{
|
||||||
if (!event.values().empty()) {
|
if (!event.values().empty()) {
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
|
||||||
QList<uint> rolls(event.values().begin(), event.values().end());
|
QList<uint> rolls(event.values().begin(), event.values().end());
|
||||||
#else
|
|
||||||
QList<uint> rolls;
|
|
||||||
for (const auto &value : event.values()) {
|
|
||||||
rolls.append(value);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
std::sort(rolls.begin(), rolls.end());
|
std::sort(rolls.begin(), rolls.end());
|
||||||
emit logRollDie(player, static_cast<int>(event.sides()), rolls);
|
emit logRollDie(player, static_cast<int>(event.sides()), rolls);
|
||||||
} else if (event.value()) {
|
} else if (event.value()) {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,12 @@
|
||||||
#include "player_graphics_item.h"
|
#include "player_graphics_item.h"
|
||||||
|
|
||||||
#include "../../interface/widgets/tabs/tab_game.h"
|
#include "../../interface/widgets/tabs/tab_game.h"
|
||||||
|
#include "../board/abstract_card_item.h"
|
||||||
#include "../hand_counter.h"
|
#include "../hand_counter.h"
|
||||||
|
#include "../zones/hand_zone.h"
|
||||||
|
#include "../zones/pile_zone.h"
|
||||||
|
#include "../zones/stack_zone.h"
|
||||||
|
#include "../zones/table_zone.h"
|
||||||
|
|
||||||
PlayerGraphicsItem::PlayerGraphicsItem(Player *_player) : player(_player)
|
PlayerGraphicsItem::PlayerGraphicsItem(Player *_player) : player(_player)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,6 @@
|
||||||
#ifndef COCKATRICE_PLAYER_INFO_H
|
#ifndef COCKATRICE_PLAYER_INFO_H
|
||||||
#define COCKATRICE_PLAYER_INFO_H
|
#define COCKATRICE_PLAYER_INFO_H
|
||||||
|
|
||||||
#include "../../interface/deck_loader/deck_loader.h"
|
|
||||||
#include "../zones/hand_zone.h"
|
|
||||||
#include "../zones/pile_zone.h"
|
|
||||||
#include "../zones/stack_zone.h"
|
|
||||||
#include "../zones/table_zone.h"
|
|
||||||
#include "player_target.h"
|
#include "player_target.h"
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,11 @@
|
||||||
#include "../../interface/widgets/server/user/user_context_menu.h"
|
#include "../../interface/widgets/server/user/user_context_menu.h"
|
||||||
#include "../../interface/widgets/server/user/user_list_manager.h"
|
#include "../../interface/widgets/server/user/user_list_manager.h"
|
||||||
#include "../../interface/widgets/server/user/user_list_widget.h"
|
#include "../../interface/widgets/server/user/user_list_widget.h"
|
||||||
#include "../../interface/widgets/tabs/tab_account.h"
|
|
||||||
#include "../../interface/widgets/tabs/tab_game.h"
|
#include "../../interface/widgets/tabs/tab_game.h"
|
||||||
#include "../../interface/widgets/tabs/tab_supervisor.h"
|
#include "../../interface/widgets/tabs/tab_supervisor.h"
|
||||||
|
|
||||||
#include <QAction>
|
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
#include <QMenu>
|
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <libcockatrice/network/client/abstract/abstract_client.h>
|
|
||||||
#include <libcockatrice/protocol/pb/command_kick_from_game.pb.h>
|
#include <libcockatrice/protocol/pb/command_kick_from_game.pb.h>
|
||||||
#include <libcockatrice/protocol/pb/serverinfo_playerproperties.pb.h>
|
#include <libcockatrice/protocol/pb/serverinfo_playerproperties.pb.h>
|
||||||
#include <libcockatrice/protocol/pb/session_commands.pb.h>
|
#include <libcockatrice/protocol/pb/session_commands.pb.h>
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@
|
||||||
#include "../board/abstract_counter.h"
|
#include "../board/abstract_counter.h"
|
||||||
#include "../board/arrow_target.h"
|
#include "../board/arrow_target.h"
|
||||||
|
|
||||||
#include <QFont>
|
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
|
|
||||||
class Player;
|
class Player;
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
#include "../board/card_drag_item.h"
|
#include "../board/card_drag_item.h"
|
||||||
#include "../board/card_item.h"
|
#include "../board/card_item.h"
|
||||||
#include "../player/player.h"
|
#include "../player/player.h"
|
||||||
|
#include "../player/player_actions.h"
|
||||||
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <libcockatrice/protocol/pb/command_move_card.pb.h>
|
#include <libcockatrice/protocol/pb/command_move_card.pb.h>
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#include "../../board/card_item.h"
|
#include "../../board/card_item.h"
|
||||||
#include "../../player/player.h"
|
#include "../../player/player.h"
|
||||||
#include "../pile_zone.h"
|
#include "../../player/player_actions.h"
|
||||||
#include "../view_zone.h"
|
#include "../view_zone.h"
|
||||||
#include "view_zone_logic.h"
|
#include "view_zone_logic.h"
|
||||||
|
|
||||||
|
|
@ -10,7 +10,6 @@
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <libcockatrice/card/database/card_database_manager.h>
|
#include <libcockatrice/card/database/card_database_manager.h>
|
||||||
#include <libcockatrice/protocol/pb/command_move_card.pb.h>
|
#include <libcockatrice/protocol/pb/command_move_card.pb.h>
|
||||||
#include <libcockatrice/protocol/pb/serverinfo_user.pb.h>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param _player the player that the zone belongs to
|
* @param _player the player that the zone belongs to
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ public:
|
||||||
void rawInsertCard(CardItem *card, int index)
|
void rawInsertCard(CardItem *card, int index)
|
||||||
{
|
{
|
||||||
cards.insert(index, card);
|
cards.insert(index, card);
|
||||||
};
|
}
|
||||||
|
|
||||||
[[nodiscard]] const CardList &getCards() const
|
[[nodiscard]] const CardList &getCards() const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
#include "../board/card_drag_item.h"
|
#include "../board/card_drag_item.h"
|
||||||
#include "../board/card_item.h"
|
#include "../board/card_item.h"
|
||||||
#include "../player/player.h"
|
#include "../player/player.h"
|
||||||
|
#include "../player/player_actions.h"
|
||||||
#include "logic/pile_zone_logic.h"
|
#include "logic/pile_zone_logic.h"
|
||||||
#include "view_zone.h"
|
#include "view_zone.h"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,10 @@
|
||||||
#include "../board/card_drag_item.h"
|
#include "../board/card_drag_item.h"
|
||||||
#include "../board/card_item.h"
|
#include "../board/card_item.h"
|
||||||
#include "../player/player.h"
|
#include "../player/player.h"
|
||||||
|
#include "../player/player_actions.h"
|
||||||
#include "logic/stack_zone_logic.h"
|
#include "logic/stack_zone_logic.h"
|
||||||
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QSet>
|
|
||||||
#include <libcockatrice/protocol/pb/command_move_card.pb.h>
|
#include <libcockatrice/protocol/pb/command_move_card.pb.h>
|
||||||
|
|
||||||
StackZone::StackZone(StackZoneLogic *_logic, int _zoneHeight, QGraphicsItem *parent)
|
StackZone::StackZone(StackZoneLogic *_logic, int _zoneHeight, QGraphicsItem *parent)
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,11 @@
|
||||||
#include "../board/card_drag_item.h"
|
#include "../board/card_drag_item.h"
|
||||||
#include "../board/card_item.h"
|
#include "../board/card_item.h"
|
||||||
#include "../player/player.h"
|
#include "../player/player.h"
|
||||||
|
#include "../player/player_actions.h"
|
||||||
#include "logic/table_zone_logic.h"
|
#include "logic/table_zone_logic.h"
|
||||||
|
|
||||||
#include <QGraphicsScene>
|
#include <QGraphicsScene>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QSet>
|
|
||||||
#include <libcockatrice/card/card_info.h>
|
#include <libcockatrice/card/card_info.h>
|
||||||
#include <libcockatrice/protocol/pb/command_move_card.pb.h>
|
#include <libcockatrice/protocol/pb/command_move_card.pb.h>
|
||||||
#include <libcockatrice/protocol/pb/command_set_card_attr.pb.h>
|
#include <libcockatrice/protocol/pb/command_set_card_attr.pb.h>
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
#include "../board/card_drag_item.h"
|
#include "../board/card_drag_item.h"
|
||||||
#include "../board/card_item.h"
|
#include "../board/card_item.h"
|
||||||
#include "../player/player.h"
|
#include "../player/player.h"
|
||||||
|
#include "../player/player_actions.h"
|
||||||
#include "logic/view_zone_logic.h"
|
#include "logic/view_zone_logic.h"
|
||||||
|
|
||||||
#include <QBrush>
|
#include <QBrush>
|
||||||
|
|
@ -10,7 +11,6 @@
|
||||||
#include <QGraphicsSceneWheelEvent>
|
#include <QGraphicsSceneWheelEvent>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QtMath>
|
#include <QtMath>
|
||||||
#include <libcockatrice/card/card_info.h>
|
|
||||||
#include <libcockatrice/protocol/pb/command_dump_zone.pb.h>
|
#include <libcockatrice/protocol/pb/command_dump_zone.pb.h>
|
||||||
#include <libcockatrice/protocol/pb/command_move_card.pb.h>
|
#include <libcockatrice/protocol/pb/command_move_card.pb.h>
|
||||||
#include <libcockatrice/protocol/pb/response_dump_zone.pb.h>
|
#include <libcockatrice/protocol/pb/response_dump_zone.pb.h>
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
#include "../board/card_item.h"
|
#include "../board/card_item.h"
|
||||||
#include "../game_scene.h"
|
#include "../game_scene.h"
|
||||||
#include "../player/player.h"
|
#include "../player/player.h"
|
||||||
|
#include "../player/player_actions.h"
|
||||||
#include "view_zone.h"
|
#include "view_zone.h"
|
||||||
|
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
|
|
@ -16,7 +17,6 @@
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
#include <QStyleOption>
|
#include <QStyleOption>
|
||||||
#include <QStyleOptionTitleBar>
|
|
||||||
#include <libcockatrice/protocol/pb/command_shuffle.pb.h>
|
#include <libcockatrice/protocol/pb/command_shuffle.pb.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -17,12 +17,7 @@ void AbstractGraphicsItem::paintNumberEllipse(int number,
|
||||||
font.setWeight(QFont::Bold);
|
font.setWeight(QFont::Bold);
|
||||||
|
|
||||||
QFontMetrics fm(font);
|
QFontMetrics fm(font);
|
||||||
double w = 1.3 *
|
double w = 1.3 * fm.horizontalAdvance(numStr);
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
|
|
||||||
fm.horizontalAdvance(numStr);
|
|
||||||
#else
|
|
||||||
fm.width(numStr);
|
|
||||||
#endif
|
|
||||||
double h = fm.height() * 1.3;
|
double h = fm.height() * 1.3;
|
||||||
if (w < h)
|
if (w < h)
|
||||||
w = h;
|
w = h;
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QMovie>
|
#include <QMovie>
|
||||||
#include <QNetworkDiskCache>
|
|
||||||
#include <QNetworkRequest>
|
#include <QNetworkRequest>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QPixmapCache>
|
#include <QPixmapCache>
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@
|
||||||
#include "card_picture_loader_worker.h"
|
#include "card_picture_loader_worker.h"
|
||||||
|
|
||||||
#include <QLoggingCategory>
|
#include <QLoggingCategory>
|
||||||
#include <libcockatrice/card/card_info.h>
|
|
||||||
|
|
||||||
inline Q_LOGGING_CATEGORY(CardPictureLoaderLog, "card_picture_loader");
|
inline Q_LOGGING_CATEGORY(CardPictureLoaderLog, "card_picture_loader");
|
||||||
inline Q_LOGGING_CATEGORY(CardPictureLoaderCardBackCacheFailLog, "card_picture_loader.card_back_cache_fail");
|
inline Q_LOGGING_CATEGORY(CardPictureLoaderCardBackCacheFailLog, "card_picture_loader.card_back_cache_fail");
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
#ifndef PICTURE_LOADER_LOCAL_H
|
#ifndef PICTURE_LOADER_LOCAL_H
|
||||||
#define PICTURE_LOADER_LOCAL_H
|
#define PICTURE_LOADER_LOCAL_H
|
||||||
|
|
||||||
#include <QLoggingCategory>
|
|
||||||
#include <QObject>
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <libcockatrice/card/printing/exact_card.h>
|
#include <libcockatrice/card/printing/exact_card.h>
|
||||||
|
|
||||||
|
|
@ -42,7 +40,7 @@ public:
|
||||||
*
|
*
|
||||||
* Uses a set of name variants and folder paths to attempt to locate the correct image.
|
* Uses a set of name variants and folder paths to attempt to locate the correct image.
|
||||||
*/
|
*/
|
||||||
QImage tryLoad(const ExactCard &toLoad) const;
|
[[nodiscard]] QImage tryLoad(const ExactCard &toLoad) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString picsPath; ///< Path to standard card image folder
|
QString picsPath; ///< Path to standard card image folder
|
||||||
|
|
@ -72,10 +70,10 @@ private:
|
||||||
* Uses several filename patterns to match card images, in order from
|
* Uses several filename patterns to match card images, in order from
|
||||||
* most-specific to least-specific.
|
* most-specific to least-specific.
|
||||||
*/
|
*/
|
||||||
QImage tryLoadCardImageFromDisk(const QString &setName,
|
[[nodiscard]] QImage tryLoadCardImageFromDisk(const QString &setName,
|
||||||
const QString &correctedCardName,
|
const QString &correctedCardName,
|
||||||
const QString &collectorNumber,
|
const QString &collectorNumber,
|
||||||
const QString &providerId) const;
|
const QString &providerId) const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
#ifndef PICTURE_LOADER_REQUEST_STATUS_DISPLAY_WIDGET_H
|
#ifndef PICTURE_LOADER_REQUEST_STATUS_DISPLAY_WIDGET_H
|
||||||
#define PICTURE_LOADER_REQUEST_STATUS_DISPLAY_WIDGET_H
|
#define PICTURE_LOADER_REQUEST_STATUS_DISPLAY_WIDGET_H
|
||||||
|
|
||||||
#include "card_picture_loader_worker_work.h"
|
|
||||||
|
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
#include <QUrl>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
#include <libcockatrice/card/printing/exact_card.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class CardPictureLoaderRequestStatusDisplayWidget
|
* @class CardPictureLoaderRequestStatusDisplayWidget
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QProgressBar>
|
#include <QProgressBar>
|
||||||
#include <QTimer>
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@
|
||||||
#include <QNetworkDiskCache>
|
#include <QNetworkDiskCache>
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <libcockatrice/card/database/card_database_manager.h>
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
#include <version_string.h>
|
||||||
|
|
||||||
static constexpr int MAX_REQUESTS_PER_SEC = 10;
|
static constexpr int MAX_REQUESTS_PER_SEC = 10;
|
||||||
|
|
||||||
|
|
@ -21,9 +21,7 @@ CardPictureLoaderWorker::CardPictureLoaderWorker()
|
||||||
// We need a timeout to ensure requests don't hang indefinitely in case of
|
// We need a timeout to ensure requests don't hang indefinitely in case of
|
||||||
// cache corruption, see related Qt bug: https://bugreports.qt.io/browse/QTBUG-111397
|
// cache corruption, see related Qt bug: https://bugreports.qt.io/browse/QTBUG-111397
|
||||||
// Use Qt's default timeout (30s, as of 2023-02-22)
|
// Use Qt's default timeout (30s, as of 2023-02-22)
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
|
|
||||||
networkManager->setTransferTimeout();
|
networkManager->setTransferTimeout();
|
||||||
#endif
|
|
||||||
cache = new QNetworkDiskCache(this);
|
cache = new QNetworkDiskCache(this);
|
||||||
cache->setCacheDirectory(SettingsCache::instance().getNetworkCachePath());
|
cache->setCacheDirectory(SettingsCache::instance().getNetworkCachePath());
|
||||||
cache->setMaximumCacheSize(1024L * 1024L *
|
cache->setMaximumCacheSize(1024L * 1024L *
|
||||||
|
|
@ -87,6 +85,7 @@ QNetworkReply *CardPictureLoaderWorker::makeRequest(const QUrl &url, CardPicture
|
||||||
}
|
}
|
||||||
|
|
||||||
QNetworkRequest req(url);
|
QNetworkRequest req(url);
|
||||||
|
req.setHeader(QNetworkRequest::UserAgentHeader, QString("Cockatrice %1").arg(VERSION_STRING));
|
||||||
if (!picDownload) {
|
if (!picDownload) {
|
||||||
req.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysCache);
|
req.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysCache);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,9 @@
|
||||||
#include <QDirIterator>
|
#include <QDirIterator>
|
||||||
#include <QLoggingCategory>
|
#include <QLoggingCategory>
|
||||||
#include <QMovie>
|
#include <QMovie>
|
||||||
#include <QNetworkDiskCache>
|
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QThreadPool>
|
#include <QThreadPool>
|
||||||
#include <libcockatrice/card/database/card_database_manager.h>
|
|
||||||
|
|
||||||
// Card back returned by gatherer when card is not found
|
// Card back returned by gatherer when card is not found
|
||||||
static const QStringList MD5_BLACKLIST = {"db0c48db407a907c16ade38de048a441"};
|
static const QStringList MD5_BLACKLIST = {"db0c48db407a907c16ade38de048a441"};
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
#ifndef PICTURE_TO_LOAD_H
|
#ifndef PICTURE_TO_LOAD_H
|
||||||
#define PICTURE_TO_LOAD_H
|
#define PICTURE_TO_LOAD_H
|
||||||
|
|
||||||
#include <QLoggingCategory>
|
|
||||||
#include <libcockatrice/card/printing/exact_card.h>
|
#include <libcockatrice/card/printing/exact_card.h>
|
||||||
|
|
||||||
inline Q_LOGGING_CATEGORY(CardPictureToLoadLog, "card_picture_loader.picture_to_load");
|
inline Q_LOGGING_CATEGORY(CardPictureToLoadLog, "card_picture_loader.picture_to_load");
|
||||||
|
|
|
||||||
40
cockatrice/src/interface/deck_loader/card_node_function.cpp
Normal file
40
cockatrice/src/interface/deck_loader/card_node_function.cpp
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
#include "card_node_function.h"
|
||||||
|
|
||||||
|
#include <libcockatrice/card/database/card_database.h>
|
||||||
|
#include <libcockatrice/card/database/card_database_manager.h>
|
||||||
|
#include <libcockatrice/deck_list/tree/deck_list_card_node.h>
|
||||||
|
|
||||||
|
void CardNodeFunction::SetProviderIdToPreferred::operator()(const InnerDecklistNode *node, DecklistCardNode *card) const
|
||||||
|
{
|
||||||
|
Q_UNUSED(node);
|
||||||
|
PrintingInfo preferredPrinting = CardDatabaseManager::query()->getPreferredPrinting(card->getName());
|
||||||
|
QString providerId = preferredPrinting.getUuid();
|
||||||
|
QString setShortName = preferredPrinting.getSet()->getShortName();
|
||||||
|
QString collectorNumber = preferredPrinting.getProperty("num");
|
||||||
|
|
||||||
|
card->setCardProviderId(providerId);
|
||||||
|
card->setCardCollectorNumber(collectorNumber);
|
||||||
|
card->setCardSetShortName(setShortName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CardNodeFunction::ClearPrintingData::operator()(const InnerDecklistNode *node, DecklistCardNode *card) const
|
||||||
|
{
|
||||||
|
Q_UNUSED(node);
|
||||||
|
card->setCardSetShortName(nullptr);
|
||||||
|
card->setCardCollectorNumber(nullptr);
|
||||||
|
card->setCardProviderId(nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CardNodeFunction::ResolveProviderId::operator()(const InnerDecklistNode *node, DecklistCardNode *card) const
|
||||||
|
{
|
||||||
|
Q_UNUSED(node);
|
||||||
|
// Retrieve the providerId based on setName and collectorNumber
|
||||||
|
QString providerId =
|
||||||
|
CardDatabaseManager::getInstance()
|
||||||
|
->query()
|
||||||
|
->getSpecificPrinting(card->getName(), card->getCardSetShortName(), card->getCardCollectorNumber())
|
||||||
|
.getUuid();
|
||||||
|
|
||||||
|
// Set the providerId on the card
|
||||||
|
card->setCardProviderId(providerId);
|
||||||
|
}
|
||||||
39
cockatrice/src/interface/deck_loader/card_node_function.h
Normal file
39
cockatrice/src/interface/deck_loader/card_node_function.h
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
#ifndef COCKATRICE_DECK_FUNCTION_H
|
||||||
|
#define COCKATRICE_DECK_FUNCTION_H
|
||||||
|
|
||||||
|
class DecklistCardNode;
|
||||||
|
class InnerDecklistNode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Functions to be used with DeckList::forEachCard
|
||||||
|
*/
|
||||||
|
namespace CardNodeFunction
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets the providerId of the card to the preferred printing.
|
||||||
|
*/
|
||||||
|
struct SetProviderIdToPreferred
|
||||||
|
{
|
||||||
|
void operator()(const InnerDecklistNode *node, DecklistCardNode *card) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Clears all fields on the card related to the printing
|
||||||
|
*/
|
||||||
|
struct ClearPrintingData
|
||||||
|
{
|
||||||
|
void operator()(const InnerDecklistNode *node, DecklistCardNode *card) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets the providerId of the card based on its set name and collector number.
|
||||||
|
*/
|
||||||
|
struct ResolveProviderId
|
||||||
|
{
|
||||||
|
void operator()(const InnerDecklistNode *node, DecklistCardNode *card) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace CardNodeFunction
|
||||||
|
|
||||||
|
#endif // COCKATRICE_DECK_FUNCTION_H
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
#include "deck_file_format.h"
|
||||||
|
|
||||||
|
DeckFileFormat::Format DeckFileFormat::getFormatFromName(const QString &fileName)
|
||||||
|
{
|
||||||
|
if (fileName.endsWith(".cod", Qt::CaseInsensitive)) {
|
||||||
|
return Cockatrice;
|
||||||
|
}
|
||||||
|
return PlainText;
|
||||||
|
}
|
||||||
36
cockatrice/src/interface/deck_loader/deck_file_format.h
Normal file
36
cockatrice/src/interface/deck_loader/deck_file_format.h
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
#ifndef COCKATRICE_DECK_FILE_FORMAT_H
|
||||||
|
#define COCKATRICE_DECK_FILE_FORMAT_H
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
namespace DeckFileFormat
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The deck file formats that Cockatrice supports.
|
||||||
|
*/
|
||||||
|
enum Format
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Plaintext deck files, a format that is intended to be widely supported among different programs.
|
||||||
|
* This format does not support Cockatrice specific features such as banner cards or tags.
|
||||||
|
*/
|
||||||
|
PlainText,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is cockatrice's native deck file format, and supports deck metadata such as banner cards and tags.
|
||||||
|
* Stored as .cod files.
|
||||||
|
*/
|
||||||
|
Cockatrice
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines what deck file format the given filename corresponds to.
|
||||||
|
*
|
||||||
|
* @param fileName The filename
|
||||||
|
* @return The deck format
|
||||||
|
*/
|
||||||
|
Format getFormatFromName(const QString &fileName);
|
||||||
|
|
||||||
|
} // namespace DeckFileFormat
|
||||||
|
|
||||||
|
#endif // COCKATRICE_DECK_FILE_FORMAT_H
|
||||||
|
|
@ -18,24 +18,18 @@
|
||||||
#include <libcockatrice/card/database/card_database.h>
|
#include <libcockatrice/card/database/card_database.h>
|
||||||
#include <libcockatrice/card/database/card_database_manager.h>
|
#include <libcockatrice/card/database/card_database_manager.h>
|
||||||
#include <libcockatrice/deck_list/deck_list.h>
|
#include <libcockatrice/deck_list/deck_list.h>
|
||||||
#include <libcockatrice/deck_list/deck_list_card_node.h>
|
#include <libcockatrice/deck_list/tree/deck_list_card_node.h>
|
||||||
|
|
||||||
const QStringList DeckLoader::ACCEPTED_FILE_EXTENSIONS = {"*.cod", "*.dec", "*.dek", "*.txt", "*.mwDeck"};
|
const QStringList DeckLoader::ACCEPTED_FILE_EXTENSIONS = {"*.cod", "*.dec", "*.dek", "*.txt", "*.mwDeck"};
|
||||||
|
|
||||||
const QStringList DeckLoader::FILE_NAME_FILTERS = {
|
const QStringList DeckLoader::FILE_NAME_FILTERS = {
|
||||||
tr("Common deck formats (%1)").arg(ACCEPTED_FILE_EXTENSIONS.join(" ")), tr("All files (*.*)")};
|
tr("Common deck formats (%1)").arg(ACCEPTED_FILE_EXTENSIONS.join(" ")), tr("All files (*.*)")};
|
||||||
|
|
||||||
DeckLoader::DeckLoader(QObject *parent)
|
DeckLoader::DeckLoader(QObject *parent) : QObject(parent)
|
||||||
: QObject(parent), deckList(new DeckList()), lastFileFormat(CockatriceFormat), lastRemoteDeckId(-1)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
DeckLoader::DeckLoader(QObject *parent, DeckList *_deckList)
|
bool DeckLoader::loadFromFile(const QString &fileName, DeckFileFormat::Format fmt, bool userRequest)
|
||||||
: QObject(parent), deckList(_deckList), lastFileFormat(CockatriceFormat), lastRemoteDeckId(-1)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DeckLoader::loadFromFile(const QString &fileName, FileFormat fmt, bool userRequest)
|
|
||||||
{
|
{
|
||||||
QFile file(fileName);
|
QFile file(fileName);
|
||||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||||
|
|
@ -43,18 +37,19 @@ bool DeckLoader::loadFromFile(const QString &fileName, FileFormat fmt, bool user
|
||||||
}
|
}
|
||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
DeckList deckList = DeckList();
|
||||||
switch (fmt) {
|
switch (fmt) {
|
||||||
case PlainTextFormat:
|
case DeckFileFormat::PlainText:
|
||||||
result = deckList->loadFromFile_Plain(&file);
|
result = deckList.loadFromFile_Plain(&file);
|
||||||
break;
|
break;
|
||||||
case CockatriceFormat: {
|
case DeckFileFormat::Cockatrice: {
|
||||||
result = deckList->loadFromFile_Native(&file);
|
result = deckList.loadFromFile_Native(&file);
|
||||||
qCInfo(DeckLoaderLog) << "Loaded from" << fileName << "-" << result;
|
qCInfo(DeckLoaderLog) << "Loaded from" << fileName << "-" << result;
|
||||||
if (!result) {
|
if (!result) {
|
||||||
qCInfo(DeckLoaderLog) << "Retrying as plain format";
|
qCInfo(DeckLoaderLog) << "Retrying as plain format";
|
||||||
file.seek(0);
|
file.seek(0);
|
||||||
result = deckList->loadFromFile_Plain(&file);
|
result = deckList.loadFromFile_Plain(&file);
|
||||||
fmt = PlainTextFormat;
|
fmt = DeckFileFormat::PlainText;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -64,8 +59,11 @@ bool DeckLoader::loadFromFile(const QString &fileName, FileFormat fmt, bool user
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
lastFileName = fileName;
|
loadedDeck.deckList = deckList;
|
||||||
lastFileFormat = fmt;
|
loadedDeck.lastLoadInfo = {
|
||||||
|
.fileName = fileName,
|
||||||
|
.fileFormat = fmt,
|
||||||
|
};
|
||||||
if (userRequest) {
|
if (userRequest) {
|
||||||
updateLastLoadedTimestamp(fileName, fmt);
|
updateLastLoadedTimestamp(fileName, fmt);
|
||||||
}
|
}
|
||||||
|
|
@ -77,7 +75,7 @@ bool DeckLoader::loadFromFile(const QString &fileName, FileFormat fmt, bool user
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DeckLoader::loadFromFileAsync(const QString &fileName, FileFormat fmt, bool userRequest)
|
bool DeckLoader::loadFromFileAsync(const QString &fileName, DeckFileFormat::Format fmt, bool userRequest)
|
||||||
{
|
{
|
||||||
auto *watcher = new QFutureWatcher<bool>(this);
|
auto *watcher = new QFutureWatcher<bool>(this);
|
||||||
|
|
||||||
|
|
@ -86,8 +84,10 @@ bool DeckLoader::loadFromFileAsync(const QString &fileName, FileFormat fmt, bool
|
||||||
watcher->deleteLater();
|
watcher->deleteLater();
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
lastFileName = fileName;
|
loadedDeck.lastLoadInfo = {
|
||||||
lastFileFormat = fmt;
|
.fileName = fileName,
|
||||||
|
.fileFormat = fmt,
|
||||||
|
};
|
||||||
if (userRequest) {
|
if (userRequest) {
|
||||||
updateLastLoadedTimestamp(fileName, fmt);
|
updateLastLoadedTimestamp(fileName, fmt);
|
||||||
}
|
}
|
||||||
|
|
@ -104,14 +104,14 @@ bool DeckLoader::loadFromFileAsync(const QString &fileName, FileFormat fmt, bool
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (fmt) {
|
switch (fmt) {
|
||||||
case PlainTextFormat:
|
case DeckFileFormat::PlainText:
|
||||||
return deckList->loadFromFile_Plain(&file);
|
return loadedDeck.deckList.loadFromFile_Plain(&file);
|
||||||
case CockatriceFormat: {
|
case DeckFileFormat::Cockatrice: {
|
||||||
bool result = false;
|
bool result = false;
|
||||||
result = deckList->loadFromFile_Native(&file);
|
result = loadedDeck.deckList.loadFromFile_Native(&file);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
file.seek(0);
|
file.seek(0);
|
||||||
return deckList->loadFromFile_Plain(&file);
|
return loadedDeck.deckList.loadFromFile_Plain(&file);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
@ -127,18 +127,18 @@ bool DeckLoader::loadFromFileAsync(const QString &fileName, FileFormat fmt, bool
|
||||||
|
|
||||||
bool DeckLoader::loadFromRemote(const QString &nativeString, int remoteDeckId)
|
bool DeckLoader::loadFromRemote(const QString &nativeString, int remoteDeckId)
|
||||||
{
|
{
|
||||||
bool result = deckList->loadFromString_Native(nativeString);
|
bool result = loadedDeck.deckList.loadFromString_Native(nativeString);
|
||||||
if (result) {
|
if (result) {
|
||||||
lastFileName = QString();
|
loadedDeck.lastLoadInfo = {
|
||||||
lastFileFormat = CockatriceFormat;
|
.remoteDeckId = remoteDeckId,
|
||||||
lastRemoteDeckId = remoteDeckId;
|
};
|
||||||
|
|
||||||
emit deckLoaded();
|
emit deckLoaded();
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DeckLoader::saveToFile(const QString &fileName, FileFormat fmt)
|
bool DeckLoader::saveToFile(const QString &fileName, DeckFileFormat::Format fmt)
|
||||||
{
|
{
|
||||||
QFile file(fileName);
|
QFile file(fileName);
|
||||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||||
|
|
@ -147,18 +147,20 @@ bool DeckLoader::saveToFile(const QString &fileName, FileFormat fmt)
|
||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
switch (fmt) {
|
switch (fmt) {
|
||||||
case PlainTextFormat:
|
case DeckFileFormat::PlainText:
|
||||||
result = deckList->saveToFile_Plain(&file);
|
result = loadedDeck.deckList.saveToFile_Plain(&file);
|
||||||
break;
|
break;
|
||||||
case CockatriceFormat:
|
case DeckFileFormat::Cockatrice:
|
||||||
result = deckList->saveToFile_Native(&file);
|
result = loadedDeck.deckList.saveToFile_Native(&file);
|
||||||
qCInfo(DeckLoaderLog) << "Saving to " << fileName << "-" << result;
|
qCInfo(DeckLoaderLog) << "Saving to " << fileName << "-" << result;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
lastFileName = fileName;
|
loadedDeck.lastLoadInfo = {
|
||||||
lastFileFormat = fmt;
|
.fileName = fileName,
|
||||||
|
.fileFormat = fmt,
|
||||||
|
};
|
||||||
qCInfo(DeckLoaderLog) << "Deck was saved -" << result;
|
qCInfo(DeckLoaderLog) << "Deck was saved -" << result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -168,7 +170,7 @@ bool DeckLoader::saveToFile(const QString &fileName, FileFormat fmt)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DeckLoader::updateLastLoadedTimestamp(const QString &fileName, FileFormat fmt)
|
bool DeckLoader::updateLastLoadedTimestamp(const QString &fileName, DeckFileFormat::Format fmt)
|
||||||
{
|
{
|
||||||
QFileInfo fileInfo(fileName);
|
QFileInfo fileInfo(fileName);
|
||||||
if (!fileInfo.exists()) {
|
if (!fileInfo.exists()) {
|
||||||
|
|
@ -189,20 +191,22 @@ bool DeckLoader::updateLastLoadedTimestamp(const QString &fileName, FileFormat f
|
||||||
|
|
||||||
// Perform file modifications
|
// Perform file modifications
|
||||||
switch (fmt) {
|
switch (fmt) {
|
||||||
case PlainTextFormat:
|
case DeckFileFormat::PlainText:
|
||||||
result = deckList->saveToFile_Plain(&file);
|
result = loadedDeck.deckList.saveToFile_Plain(&file);
|
||||||
break;
|
break;
|
||||||
case CockatriceFormat:
|
case DeckFileFormat::Cockatrice:
|
||||||
deckList->setLastLoadedTimestamp(QDateTime::currentDateTime().toString());
|
loadedDeck.deckList.setLastLoadedTimestamp(QDateTime::currentDateTime().toString());
|
||||||
result = deckList->saveToFile_Native(&file);
|
result = loadedDeck.deckList.saveToFile_Native(&file);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
file.close(); // Close the file to ensure changes are flushed
|
file.close(); // Close the file to ensure changes are flushed
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
lastFileName = fileName;
|
loadedDeck.lastLoadInfo = {
|
||||||
lastFileFormat = fmt;
|
.fileName = fileName,
|
||||||
|
.fileFormat = fmt,
|
||||||
|
};
|
||||||
|
|
||||||
// Re-open the file and set the original timestamp
|
// Re-open the file and set the original timestamp
|
||||||
if (!file.open(QIODevice::ReadWrite)) {
|
if (!file.open(QIODevice::ReadWrite)) {
|
||||||
|
|
@ -263,39 +267,35 @@ static QString toDecklistExportString(const DecklistCardNode *card)
|
||||||
return cardString;
|
return cardString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts all cards in the list to their decklist export string and joins them into one string
|
||||||
|
*/
|
||||||
|
static QString toDecklistExportString(const QList<const DecklistCardNode *> &cardNodes)
|
||||||
|
{
|
||||||
|
QString result;
|
||||||
|
|
||||||
|
for (auto cardNode : cardNodes) {
|
||||||
|
result += toDecklistExportString(cardNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Export deck to decklist function, called to format the deck in a way to be sent to a server
|
* Export deck to decklist function, called to format the deck in a way to be sent to a server
|
||||||
*
|
*
|
||||||
* @param deckList The decklist to export
|
* @param deckList The decklist to export
|
||||||
* @param website The website we're sending the deck to
|
* @param website The website we're sending the deck to
|
||||||
*/
|
*/
|
||||||
QString DeckLoader::exportDeckToDecklist(const DeckList *deckList, DecklistWebsite website)
|
QString DeckLoader::exportDeckToDecklist(const DeckList &deckList, DecklistWebsite website)
|
||||||
{
|
{
|
||||||
// Add the base url
|
// Add the base url
|
||||||
QString deckString = "https://" + getDomainForWebsite(website) + "/?";
|
QString deckString = "https://" + getDomainForWebsite(website) + "/?";
|
||||||
// Create two strings to pass to function
|
|
||||||
QString mainBoardCards, sideBoardCards;
|
|
||||||
|
|
||||||
// Set up the function to call
|
// export all cards in zone
|
||||||
auto formatDeckListForExport = [&mainBoardCards, &sideBoardCards](const auto *node, const auto *card) {
|
QString mainBoardCards = toDecklistExportString(deckList.getCardNodes({DECK_ZONE_MAIN}));
|
||||||
// Get the card name
|
QString sideBoardCards = toDecklistExportString(deckList.getCardNodes({DECK_ZONE_SIDE}));
|
||||||
CardInfoPtr dbCard = CardDatabaseManager::query()->getCardInfo(card->getName());
|
|
||||||
if (!dbCard || dbCard->getIsToken()) {
|
|
||||||
// If it's a token, we don't care about the card.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if it's a sideboard card.
|
|
||||||
if (node->getName() == DECK_ZONE_SIDE) {
|
|
||||||
sideBoardCards += toDecklistExportString(card);
|
|
||||||
} else {
|
|
||||||
// If it's a mainboard card, do the same thing, but for the mainboard card string
|
|
||||||
mainBoardCards += toDecklistExportString(card);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// call our struct function for each card in the deck
|
|
||||||
deckList->forEachCard(formatDeckListForExport);
|
|
||||||
// Remove the extra return at the end of the last cards
|
// Remove the extra return at the end of the last cards
|
||||||
mainBoardCards.chop(3);
|
mainBoardCards.chop(3);
|
||||||
sideBoardCards.chop(3);
|
sideBoardCards.chop(3);
|
||||||
|
|
@ -310,113 +310,7 @@ QString DeckLoader::exportDeckToDecklist(const DeckList *deckList, DecklistWebsi
|
||||||
return deckString;
|
return deckString;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This struct is here to support the forEachCard function call, defined in decklist.
|
void DeckLoader::saveToClipboard(const DeckList &deckList, bool addComments, bool addSetNameAndNumber)
|
||||||
// It requires a function to be called for each card, and it will set the providerId to the preferred printing.
|
|
||||||
struct SetProviderIdToPreferred
|
|
||||||
{
|
|
||||||
// Main operator for struct, allowing the foreachcard to work.
|
|
||||||
SetProviderIdToPreferred()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void operator()(const InnerDecklistNode *node, DecklistCardNode *card) const
|
|
||||||
{
|
|
||||||
Q_UNUSED(node);
|
|
||||||
PrintingInfo preferredPrinting = CardDatabaseManager::query()->getPreferredPrinting(card->getName());
|
|
||||||
QString providerId = preferredPrinting.getUuid();
|
|
||||||
QString setShortName = preferredPrinting.getSet()->getShortName();
|
|
||||||
QString collectorNumber = preferredPrinting.getProperty("num");
|
|
||||||
|
|
||||||
card->setCardProviderId(providerId);
|
|
||||||
card->setCardCollectorNumber(collectorNumber);
|
|
||||||
card->setCardSetShortName(setShortName);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function iterates through each card in the decklist and sets the providerId
|
|
||||||
* on each card based on its set name and collector number.
|
|
||||||
*
|
|
||||||
* @param deckList The decklist to modify
|
|
||||||
*/
|
|
||||||
void DeckLoader::setProviderIdToPreferredPrinting(const DeckList *deckList)
|
|
||||||
{
|
|
||||||
// Set up the struct to call.
|
|
||||||
SetProviderIdToPreferred setProviderIdToPreferred;
|
|
||||||
|
|
||||||
// Call the forEachCard method for each card in the deck
|
|
||||||
deckList->forEachCard(setProviderIdToPreferred);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the providerId on each card in the decklist based on its set name and collector number.
|
|
||||||
*
|
|
||||||
* @param deckList The decklist to modify
|
|
||||||
*/
|
|
||||||
void DeckLoader::resolveSetNameAndNumberToProviderID(const DeckList *deckList)
|
|
||||||
{
|
|
||||||
auto setProviderId = [](const auto node, const auto card) {
|
|
||||||
Q_UNUSED(node);
|
|
||||||
// Retrieve the providerId based on setName and collectorNumber
|
|
||||||
QString providerId =
|
|
||||||
CardDatabaseManager::getInstance()
|
|
||||||
->query()
|
|
||||||
->getSpecificPrinting(card->getName(), card->getCardSetShortName(), card->getCardCollectorNumber())
|
|
||||||
.getUuid();
|
|
||||||
|
|
||||||
// Set the providerId on the card
|
|
||||||
card->setCardProviderId(providerId);
|
|
||||||
};
|
|
||||||
|
|
||||||
deckList->forEachCard(setProviderId);
|
|
||||||
}
|
|
||||||
|
|
||||||
// This struct is here to support the forEachCard function call, defined in decklist.
|
|
||||||
// It requires a function to be called for each card, and it will set the providerId.
|
|
||||||
struct ClearSetNameNumberAndProviderId
|
|
||||||
{
|
|
||||||
// Main operator for struct, allowing the foreachcard to work.
|
|
||||||
ClearSetNameNumberAndProviderId()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void operator()(const InnerDecklistNode *node, DecklistCardNode *card) const
|
|
||||||
{
|
|
||||||
Q_UNUSED(node);
|
|
||||||
// Set the providerId on the card
|
|
||||||
card->setCardSetShortName(nullptr);
|
|
||||||
card->setCardCollectorNumber(nullptr);
|
|
||||||
card->setCardProviderId(nullptr);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Clears the set name and numbers on each card in the decklist.
|
|
||||||
*
|
|
||||||
* @param deckList The decklist to modify
|
|
||||||
*/
|
|
||||||
void DeckLoader::clearSetNamesAndNumbers(const DeckList *deckList)
|
|
||||||
{
|
|
||||||
auto clearSetNameAndNumber = [](const auto node, auto card) {
|
|
||||||
Q_UNUSED(node)
|
|
||||||
// Set the providerId on the card
|
|
||||||
card->setCardSetShortName(nullptr);
|
|
||||||
card->setCardCollectorNumber(nullptr);
|
|
||||||
card->setCardProviderId(nullptr);
|
|
||||||
};
|
|
||||||
|
|
||||||
deckList->forEachCard(clearSetNameAndNumber);
|
|
||||||
}
|
|
||||||
|
|
||||||
DeckLoader::FileFormat DeckLoader::getFormatFromName(const QString &fileName)
|
|
||||||
{
|
|
||||||
if (fileName.endsWith(".cod", Qt::CaseInsensitive)) {
|
|
||||||
return CockatriceFormat;
|
|
||||||
}
|
|
||||||
return PlainTextFormat;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DeckLoader::saveToClipboard(const DeckList *deckList, bool addComments, bool addSetNameAndNumber)
|
|
||||||
{
|
{
|
||||||
QString buffer;
|
QString buffer;
|
||||||
QTextStream stream(&buffer);
|
QTextStream stream(&buffer);
|
||||||
|
|
@ -426,7 +320,7 @@ void DeckLoader::saveToClipboard(const DeckList *deckList, bool addComments, boo
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DeckLoader::saveToStream_Plain(QTextStream &out,
|
bool DeckLoader::saveToStream_Plain(QTextStream &out,
|
||||||
const DeckList *deckList,
|
const DeckList &deckList,
|
||||||
bool addComments,
|
bool addComments,
|
||||||
bool addSetNameAndNumber)
|
bool addSetNameAndNumber)
|
||||||
{
|
{
|
||||||
|
|
@ -435,9 +329,7 @@ bool DeckLoader::saveToStream_Plain(QTextStream &out,
|
||||||
}
|
}
|
||||||
|
|
||||||
// loop zones
|
// loop zones
|
||||||
for (int i = 0; i < deckList->getRoot()->size(); i++) {
|
for (auto zoneNode : deckList.getZoneNodes()) {
|
||||||
const auto *zoneNode = dynamic_cast<InnerDecklistNode *>(deckList->getRoot()->at(i));
|
|
||||||
|
|
||||||
saveToStream_DeckZone(out, zoneNode, addComments, addSetNameAndNumber);
|
saveToStream_DeckZone(out, zoneNode, addComments, addSetNameAndNumber);
|
||||||
|
|
||||||
// end of zone
|
// end of zone
|
||||||
|
|
@ -447,14 +339,14 @@ bool DeckLoader::saveToStream_Plain(QTextStream &out,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeckLoader::saveToStream_DeckHeader(QTextStream &out, const DeckList *deckList)
|
void DeckLoader::saveToStream_DeckHeader(QTextStream &out, const DeckList &deckList)
|
||||||
{
|
{
|
||||||
if (!deckList->getName().isEmpty()) {
|
if (!deckList.getName().isEmpty()) {
|
||||||
out << "// " << deckList->getName() << "\n\n";
|
out << "// " << deckList.getName() << "\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!deckList->getComments().isEmpty()) {
|
if (!deckList.getComments().isEmpty()) {
|
||||||
QStringList commentRows = deckList->getComments().split(QRegularExpression("\n|\r\n|\r"));
|
QStringList commentRows = deckList.getComments().split(QRegularExpression("\n|\r\n|\r"));
|
||||||
for (const QString &row : commentRows) {
|
for (const QString &row : commentRows) {
|
||||||
out << "// " << row << "\n";
|
out << "// " << row << "\n";
|
||||||
}
|
}
|
||||||
|
|
@ -542,7 +434,7 @@ void DeckLoader::saveToStream_DeckZoneCards(QTextStream &out,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DeckLoader::convertToCockatriceFormat(QString fileName)
|
bool DeckLoader::convertToCockatriceFormat(const QString &fileName)
|
||||||
{
|
{
|
||||||
// Change the file extension to .cod
|
// Change the file extension to .cod
|
||||||
QFileInfo fileInfo(fileName);
|
QFileInfo fileInfo(fileName);
|
||||||
|
|
@ -558,12 +450,12 @@ bool DeckLoader::convertToCockatriceFormat(QString fileName)
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
// Perform file modifications based on the detected format
|
// Perform file modifications based on the detected format
|
||||||
switch (getFormatFromName(fileName)) {
|
switch (DeckFileFormat::getFormatFromName(fileName)) {
|
||||||
case PlainTextFormat:
|
case DeckFileFormat::PlainText:
|
||||||
// Save in Cockatrice's native format
|
// Save in Cockatrice's native format
|
||||||
result = deckList->saveToFile_Native(&file);
|
result = loadedDeck.deckList.saveToFile_Native(&file);
|
||||||
break;
|
break;
|
||||||
case CockatriceFormat:
|
case DeckFileFormat::Cockatrice:
|
||||||
qCInfo(DeckLoaderLog) << "File is already in Cockatrice format. No conversion needed.";
|
qCInfo(DeckLoaderLog) << "File is already in Cockatrice format. No conversion needed.";
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
|
|
@ -582,37 +474,16 @@ bool DeckLoader::convertToCockatriceFormat(QString fileName)
|
||||||
} else {
|
} else {
|
||||||
qCInfo(DeckLoaderLog) << "Original file deleted successfully:" << fileName;
|
qCInfo(DeckLoaderLog) << "Original file deleted successfully:" << fileName;
|
||||||
}
|
}
|
||||||
lastFileName = newFileName;
|
loadedDeck.lastLoadInfo = {
|
||||||
lastFileFormat = CockatriceFormat;
|
.fileName = newFileName,
|
||||||
|
.fileFormat = DeckFileFormat::Cockatrice,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString DeckLoader::getCardZoneFromName(const QString &cardName, QString currentZoneName)
|
void DeckLoader::printDeckListNode(QTextCursor *cursor, const InnerDecklistNode *node)
|
||||||
{
|
|
||||||
CardInfoPtr card = CardDatabaseManager::query()->getCardInfo(cardName);
|
|
||||||
|
|
||||||
if (card && card->getIsToken()) {
|
|
||||||
return DECK_ZONE_TOKENS;
|
|
||||||
}
|
|
||||||
|
|
||||||
return currentZoneName;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString DeckLoader::getCompleteCardName(const QString &cardName)
|
|
||||||
{
|
|
||||||
if (CardDatabaseManager::getInstance()) {
|
|
||||||
ExactCard temp = CardDatabaseManager::query()->guessCard({cardName});
|
|
||||||
if (temp) {
|
|
||||||
return temp.getName();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return cardName;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DeckLoader::printDeckListNode(QTextCursor *cursor, InnerDecklistNode *node)
|
|
||||||
{
|
{
|
||||||
const int totalColumns = 2;
|
const int totalColumns = 2;
|
||||||
|
|
||||||
|
|
@ -672,7 +543,7 @@ void DeckLoader::printDeckListNode(QTextCursor *cursor, InnerDecklistNode *node)
|
||||||
cursor->movePosition(QTextCursor::End);
|
cursor->movePosition(QTextCursor::End);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeckLoader::printDeckList(QPrinter *printer, const DeckList *deckList)
|
void DeckLoader::printDeckList(QPrinter *printer, const DeckList &deckList)
|
||||||
{
|
{
|
||||||
QTextDocument doc;
|
QTextDocument doc;
|
||||||
|
|
||||||
|
|
@ -688,19 +559,18 @@ void DeckLoader::printDeckList(QPrinter *printer, const DeckList *deckList)
|
||||||
headerCharFormat.setFontWeight(QFont::Bold);
|
headerCharFormat.setFontWeight(QFont::Bold);
|
||||||
|
|
||||||
cursor.insertBlock(headerBlockFormat, headerCharFormat);
|
cursor.insertBlock(headerBlockFormat, headerCharFormat);
|
||||||
cursor.insertText(deckList->getName());
|
cursor.insertText(deckList.getName());
|
||||||
|
|
||||||
headerCharFormat.setFontPointSize(12);
|
headerCharFormat.setFontPointSize(12);
|
||||||
cursor.insertBlock(headerBlockFormat, headerCharFormat);
|
cursor.insertBlock(headerBlockFormat, headerCharFormat);
|
||||||
cursor.insertText(deckList->getComments());
|
cursor.insertText(deckList.getComments());
|
||||||
cursor.insertBlock(headerBlockFormat, headerCharFormat);
|
cursor.insertBlock(headerBlockFormat, headerCharFormat);
|
||||||
|
|
||||||
for (int i = 0; i < deckList->getRoot()->size(); i++) {
|
for (auto zoneNode : deckList.getZoneNodes()) {
|
||||||
cursor.insertHtml("<br><img src=theme:hr.jpg>");
|
cursor.insertHtml("<br><img src=theme:hr.jpg>");
|
||||||
// cursor.insertHtml("<hr>");
|
|
||||||
cursor.insertBlock(headerBlockFormat, headerCharFormat);
|
cursor.insertBlock(headerBlockFormat, headerCharFormat);
|
||||||
|
|
||||||
printDeckListNode(&cursor, dynamic_cast<InnerDecklistNode *>(deckList->getRoot()->at(i)));
|
printDeckListNode(&cursor, zoneNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
doc.print(printer);
|
doc.print(printer);
|
||||||
|
|
|
||||||
|
|
@ -7,14 +7,16 @@
|
||||||
#ifndef DECK_LOADER_H
|
#ifndef DECK_LOADER_H
|
||||||
#define DECK_LOADER_H
|
#define DECK_LOADER_H
|
||||||
|
|
||||||
|
#include "loaded_deck.h"
|
||||||
|
|
||||||
#include <QLoggingCategory>
|
#include <QLoggingCategory>
|
||||||
#include <QPrinter>
|
#include <QPrinter>
|
||||||
#include <QTextCursor>
|
#include <QTextCursor>
|
||||||
#include <libcockatrice/deck_list/deck_list.h>
|
#include <libcockatrice/deck_list/deck_list.h>
|
||||||
|
|
||||||
inline Q_LOGGING_CATEGORY(DeckLoaderLog, "deck_loader")
|
inline Q_LOGGING_CATEGORY(DeckLoaderLog, "deck_loader");
|
||||||
|
|
||||||
class DeckLoader : public QObject
|
class DeckLoader : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
signals:
|
signals:
|
||||||
|
|
@ -22,12 +24,6 @@ signals:
|
||||||
void loadFinished(bool success);
|
void loadFinished(bool success);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum FileFormat
|
|
||||||
{
|
|
||||||
PlainTextFormat,
|
|
||||||
CockatriceFormat
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Supported file extensions for decklist files
|
* Supported file extensions for decklist files
|
||||||
*/
|
*/
|
||||||
|
|
@ -45,56 +41,29 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DeckList *deckList;
|
LoadedDeck loadedDeck;
|
||||||
QString lastFileName;
|
|
||||||
FileFormat lastFileFormat;
|
|
||||||
int lastRemoteDeckId;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DeckLoader(QObject *parent);
|
DeckLoader(QObject *parent);
|
||||||
DeckLoader(QObject *parent, DeckList *_deckList);
|
|
||||||
DeckLoader(const DeckLoader &) = delete;
|
DeckLoader(const DeckLoader &) = delete;
|
||||||
DeckLoader &operator=(const DeckLoader &) = delete;
|
DeckLoader &operator=(const DeckLoader &) = delete;
|
||||||
|
|
||||||
const QString &getLastFileName() const
|
[[nodiscard]] bool hasNotBeenLoaded() const
|
||||||
{
|
{
|
||||||
return lastFileName;
|
return loadedDeck.lastLoadInfo.isEmpty();
|
||||||
}
|
|
||||||
void setLastFileName(const QString &_lastFileName)
|
|
||||||
{
|
|
||||||
lastFileName = _lastFileName;
|
|
||||||
}
|
|
||||||
FileFormat getLastFileFormat() const
|
|
||||||
{
|
|
||||||
return lastFileFormat;
|
|
||||||
}
|
|
||||||
int getLastRemoteDeckId() const
|
|
||||||
{
|
|
||||||
return lastRemoteDeckId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hasNotBeenLoaded() const
|
bool loadFromFile(const QString &fileName, DeckFileFormat::Format fmt, bool userRequest = false);
|
||||||
{
|
bool loadFromFileAsync(const QString &fileName, DeckFileFormat::Format fmt, bool userRequest);
|
||||||
return getLastFileName().isEmpty() && getLastRemoteDeckId() == -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void clearSetNamesAndNumbers(const DeckList *deckList);
|
|
||||||
static FileFormat getFormatFromName(const QString &fileName);
|
|
||||||
|
|
||||||
bool loadFromFile(const QString &fileName, FileFormat fmt, bool userRequest = false);
|
|
||||||
bool loadFromFileAsync(const QString &fileName, FileFormat fmt, bool userRequest);
|
|
||||||
bool loadFromRemote(const QString &nativeString, int remoteDeckId);
|
bool loadFromRemote(const QString &nativeString, int remoteDeckId);
|
||||||
bool saveToFile(const QString &fileName, FileFormat fmt);
|
bool saveToFile(const QString &fileName, DeckFileFormat::Format fmt);
|
||||||
bool updateLastLoadedTimestamp(const QString &fileName, FileFormat fmt);
|
bool updateLastLoadedTimestamp(const QString &fileName, DeckFileFormat::Format fmt);
|
||||||
|
|
||||||
static QString exportDeckToDecklist(const DeckList *deckList, DecklistWebsite website);
|
static QString exportDeckToDecklist(const DeckList &deckList, DecklistWebsite website);
|
||||||
|
|
||||||
static void setProviderIdToPreferredPrinting(const DeckList *deckList);
|
static void saveToClipboard(const DeckList &deckList, bool addComments = true, bool addSetNameAndNumber = true);
|
||||||
static void resolveSetNameAndNumberToProviderID(const DeckList *deckList);
|
|
||||||
|
|
||||||
static void saveToClipboard(const DeckList *deckList, bool addComments = true, bool addSetNameAndNumber = true);
|
|
||||||
static bool saveToStream_Plain(QTextStream &out,
|
static bool saveToStream_Plain(QTextStream &out,
|
||||||
const DeckList *deckList,
|
const DeckList &deckList,
|
||||||
bool addComments = true,
|
bool addComments = true,
|
||||||
bool addSetNameAndNumber = true);
|
bool addSetNameAndNumber = true);
|
||||||
|
|
||||||
|
|
@ -103,18 +72,26 @@ public:
|
||||||
* @param printer The printer to render the decklist to.
|
* @param printer The printer to render the decklist to.
|
||||||
* @param deckList
|
* @param deckList
|
||||||
*/
|
*/
|
||||||
static void printDeckList(QPrinter *printer, const DeckList *deckList);
|
static void printDeckList(QPrinter *printer, const DeckList &deckList);
|
||||||
|
|
||||||
bool convertToCockatriceFormat(QString fileName);
|
bool convertToCockatriceFormat(const QString &fileName);
|
||||||
|
|
||||||
DeckList *getDeckList()
|
LoadedDeck &getDeck()
|
||||||
{
|
{
|
||||||
return deckList;
|
return loadedDeck;
|
||||||
|
}
|
||||||
|
const LoadedDeck &getDeck() const
|
||||||
|
{
|
||||||
|
return loadedDeck;
|
||||||
|
}
|
||||||
|
void setDeck(const LoadedDeck &deck)
|
||||||
|
{
|
||||||
|
loadedDeck = deck;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void printDeckListNode(QTextCursor *cursor, InnerDecklistNode *node);
|
static void printDeckListNode(QTextCursor *cursor, const InnerDecklistNode *node);
|
||||||
static void saveToStream_DeckHeader(QTextStream &out, const DeckList *deckList);
|
static void saveToStream_DeckHeader(QTextStream &out, const DeckList &deckList);
|
||||||
|
|
||||||
static void saveToStream_DeckZone(QTextStream &out,
|
static void saveToStream_DeckZone(QTextStream &out,
|
||||||
const InnerDecklistNode *zoneNode,
|
const InnerDecklistNode *zoneNode,
|
||||||
|
|
@ -125,9 +102,6 @@ private:
|
||||||
QList<DecklistCardNode *> cards,
|
QList<DecklistCardNode *> cards,
|
||||||
bool addComments = true,
|
bool addComments = true,
|
||||||
bool addSetNameAndNumber = true);
|
bool addSetNameAndNumber = true);
|
||||||
|
|
||||||
[[nodiscard]] static QString getCardZoneFromName(const QString &cardName, QString currentZoneName);
|
|
||||||
[[nodiscard]] static QString getCompleteCardName(const QString &cardName);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
11
cockatrice/src/interface/deck_loader/loaded_deck.cpp
Normal file
11
cockatrice/src/interface/deck_loader/loaded_deck.cpp
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
#include "loaded_deck.h"
|
||||||
|
|
||||||
|
bool LoadedDeck::LoadInfo::isEmpty() const
|
||||||
|
{
|
||||||
|
return fileName.isEmpty() && remoteDeckId == NON_REMOTE_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool LoadedDeck::isEmpty() const
|
||||||
|
{
|
||||||
|
return deckList.isEmpty() && lastLoadInfo.isEmpty();
|
||||||
|
}
|
||||||
39
cockatrice/src/interface/deck_loader/loaded_deck.h
Normal file
39
cockatrice/src/interface/deck_loader/loaded_deck.h
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
#ifndef COCKATRICE_LOADED_DECK_H
|
||||||
|
#define COCKATRICE_LOADED_DECK_H
|
||||||
|
|
||||||
|
#include "deck_file_format.h"
|
||||||
|
#include "libcockatrice/deck_list/deck_list.h"
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Represents a deck that was loaded from somewhere.
|
||||||
|
* Contains the DeckList itself, as well as info about where it was loaded from.
|
||||||
|
*/
|
||||||
|
struct LoadedDeck
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Information about where the deck was loaded from.
|
||||||
|
*
|
||||||
|
* For local decks, the remoteDeckId field will always be -1.
|
||||||
|
* For remote decks, fileName will be empty and fileFormat will always be CockatriceFormat
|
||||||
|
*/
|
||||||
|
struct LoadInfo
|
||||||
|
{
|
||||||
|
static constexpr int NON_REMOTE_ID = -1;
|
||||||
|
|
||||||
|
QString fileName = "";
|
||||||
|
DeckFileFormat::Format fileFormat = DeckFileFormat::Cockatrice;
|
||||||
|
int remoteDeckId = NON_REMOTE_ID;
|
||||||
|
|
||||||
|
bool isEmpty() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
DeckList deckList; ///< The decklist itself
|
||||||
|
LoadInfo lastLoadInfo = {}; ///< info about where the deck was loaded from
|
||||||
|
|
||||||
|
bool isEmpty() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // COCKATRICE_LOADED_DECK_H
|
||||||
|
|
@ -23,9 +23,9 @@ public:
|
||||||
~FlowLayout() override;
|
~FlowLayout() override;
|
||||||
void insertWidgetAtIndex(QWidget *toInsert, int index);
|
void insertWidgetAtIndex(QWidget *toInsert, int index);
|
||||||
|
|
||||||
QSize calculateMinimumSizeHorizontal() const;
|
[[nodiscard]] QSize calculateMinimumSizeHorizontal() const;
|
||||||
QSize calculateSizeHintVertical() const;
|
[[nodiscard]] QSize calculateSizeHintVertical() const;
|
||||||
QSize calculateMinimumSizeVertical() const;
|
[[nodiscard]] QSize calculateMinimumSizeVertical() const;
|
||||||
void addItem(QLayoutItem *item) override;
|
void addItem(QLayoutItem *item) override;
|
||||||
[[nodiscard]] int count() const override;
|
[[nodiscard]] int count() const override;
|
||||||
[[nodiscard]] QLayoutItem *itemAt(int index) const override;
|
[[nodiscard]] QLayoutItem *itemAt(int index) const override;
|
||||||
|
|
@ -48,7 +48,7 @@ public:
|
||||||
void layoutSingleColumn(const QVector<QLayoutItem *> &colItems, int x, int y);
|
void layoutSingleColumn(const QVector<QLayoutItem *> &colItems, int x, int y);
|
||||||
[[nodiscard]] QSize sizeHint() const override;
|
[[nodiscard]] QSize sizeHint() const override;
|
||||||
[[nodiscard]] QSize minimumSize() const override;
|
[[nodiscard]] QSize minimumSize() const override;
|
||||||
QSize calculateSizeHintHorizontal() const;
|
[[nodiscard]] QSize calculateSizeHintHorizontal() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QList<QLayoutItem *> items; // List to store layout items
|
QList<QLayoutItem *> items; // List to store layout items
|
||||||
|
|
|
||||||
|
|
@ -57,17 +57,10 @@ void Logger::openLogfileSession()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fileStream.setDevice(&fileHandle);
|
fileStream.setDevice(&fileHandle);
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
|
||||||
fileStream << "Log session started at " << QDateTime::currentDateTime().toString() << Qt::endl;
|
fileStream << "Log session started at " << QDateTime::currentDateTime().toString() << Qt::endl;
|
||||||
fileStream << getClientVersion() << Qt::endl;
|
fileStream << getClientVersion() << Qt::endl;
|
||||||
fileStream << getSystemArchitecture() << Qt::endl;
|
fileStream << getSystemArchitecture() << Qt::endl;
|
||||||
fileStream << getClientInstallInfo() << Qt::endl;
|
fileStream << getClientInstallInfo() << Qt::endl;
|
||||||
#else
|
|
||||||
fileStream << "Log session started at " << QDateTime::currentDateTime().toString() << endl;
|
|
||||||
fileStream << getClientVersion() << endl;
|
|
||||||
fileStream << getSystemArchitecture() << endl;
|
|
||||||
fileStream << getClientInstallInfo() << endl;
|
|
||||||
#endif
|
|
||||||
logToFileEnabled = true;
|
logToFileEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -77,11 +70,7 @@ void Logger::closeLogfileSession()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
logToFileEnabled = false;
|
logToFileEnabled = false;
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
|
||||||
fileStream << "Log session closed at " << QDateTime::currentDateTime().toString() << Qt::endl;
|
fileStream << "Log session closed at " << QDateTime::currentDateTime().toString() << Qt::endl;
|
||||||
#else
|
|
||||||
fileStream << "Log session closed at " << QDateTime::currentDateTime().toString() << endl;
|
|
||||||
#endif
|
|
||||||
fileHandle.close();
|
fileHandle.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -103,11 +92,7 @@ void Logger::internalLog(const QString &message)
|
||||||
std::cerr << message.toStdString() << std::endl; // Print to stdout
|
std::cerr << message.toStdString() << std::endl; // Print to stdout
|
||||||
|
|
||||||
if (logToFileEnabled) {
|
if (logToFileEnabled) {
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
|
||||||
fileStream << message << Qt::endl; // Print to fileStream
|
fileStream << message << Qt::endl; // Print to fileStream
|
||||||
#else
|
|
||||||
fileStream << message << endl; // Print to fileStream
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QPixmap>
|
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
#include <QResizeEvent>
|
#include <QResizeEvent>
|
||||||
#include <QSize>
|
#include <QSize>
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QPixmap>
|
|
||||||
#include <QResizeEvent>
|
#include <QResizeEvent>
|
||||||
#include <QSize>
|
#include <QSize>
|
||||||
#include <qregularexpression.h>
|
#include <qregularexpression.h>
|
||||||
|
|
|
||||||
|
|
@ -23,15 +23,15 @@ public:
|
||||||
[[nodiscard]] bool isColorActive() const
|
[[nodiscard]] bool isColorActive() const
|
||||||
{
|
{
|
||||||
return isActive;
|
return isActive;
|
||||||
};
|
}
|
||||||
[[nodiscard]] QString getSymbol() const
|
[[nodiscard]] QString getSymbol() const
|
||||||
{
|
{
|
||||||
return symbol;
|
return symbol;
|
||||||
};
|
}
|
||||||
[[nodiscard]] QChar getSymbolChar() const
|
[[nodiscard]] QChar getSymbolChar() const
|
||||||
{
|
{
|
||||||
return symbol[0];
|
return symbol[0];
|
||||||
};
|
}
|
||||||
|
|
||||||
void loadManaIcon();
|
void loadManaIcon();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
#include "../card_info_picture_with_text_overlay_widget.h"
|
#include "../card_info_picture_with_text_overlay_widget.h"
|
||||||
|
|
||||||
#include <QResizeEvent>
|
#include <QResizeEvent>
|
||||||
#include <libcockatrice/card/card_info_comparator.h>
|
|
||||||
#include <libcockatrice/card/database/card_database_manager.h>
|
#include <libcockatrice/card/database/card_database_manager.h>
|
||||||
#include <libcockatrice/models/deck_list/deck_list_model.h>
|
#include <libcockatrice/models/deck_list/deck_list_model.h>
|
||||||
#include <libcockatrice/models/deck_list/deck_list_sort_filter_proxy_model.h>
|
#include <libcockatrice/models/deck_list/deck_list_sort_filter_proxy_model.h>
|
||||||
|
|
@ -33,7 +32,10 @@ CardGroupDisplayWidget::CardGroupDisplayWidget(QWidget *parent,
|
||||||
CardGroupDisplayWidget::updateCardDisplays();
|
CardGroupDisplayWidget::updateCardDisplays();
|
||||||
|
|
||||||
connect(deckListModel, &QAbstractItemModel::rowsInserted, this, &CardGroupDisplayWidget::onCardAddition);
|
connect(deckListModel, &QAbstractItemModel::rowsInserted, this, &CardGroupDisplayWidget::onCardAddition);
|
||||||
connect(selectionModel, &QItemSelectionModel::selectionChanged, this, &CardGroupDisplayWidget::onSelectionChanged);
|
if (selectionModel) {
|
||||||
|
connect(selectionModel, &QItemSelectionModel::selectionChanged, this,
|
||||||
|
&CardGroupDisplayWidget::onSelectionChanged);
|
||||||
|
}
|
||||||
connect(deckListModel, &QAbstractItemModel::rowsRemoved, this, &CardGroupDisplayWidget::onCardRemoval);
|
connect(deckListModel, &QAbstractItemModel::rowsRemoved, this, &CardGroupDisplayWidget::onCardRemoval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -89,8 +91,9 @@ QWidget *CardGroupDisplayWidget::constructWidgetForIndex(QPersistentModelIndex i
|
||||||
if (indexToWidgetMap.contains(index)) {
|
if (indexToWidgetMap.contains(index)) {
|
||||||
return indexToWidgetMap[index];
|
return indexToWidgetMap[index];
|
||||||
}
|
}
|
||||||
auto cardName = deckListModel->data(index.sibling(index.row(), 1), Qt::EditRole).toString();
|
auto cardName = index.sibling(index.row(), DeckListModelColumns::CARD_NAME).data(Qt::EditRole).toString();
|
||||||
auto cardProviderId = deckListModel->data(index.sibling(index.row(), 4), Qt::EditRole).toString();
|
auto cardProviderId =
|
||||||
|
index.sibling(index.row(), DeckListModelColumns::CARD_PROVIDER_ID).data(Qt::EditRole).toString();
|
||||||
|
|
||||||
auto widget = new CardInfoPictureWithTextOverlayWidget(getLayoutParent(), true);
|
auto widget = new CardInfoPictureWithTextOverlayWidget(getLayoutParent(), true);
|
||||||
widget->setScaleFactor(cardSizeWidget->getSlider()->value());
|
widget->setScaleFactor(cardSizeWidget->getSlider()->value());
|
||||||
|
|
@ -112,7 +115,7 @@ void CardGroupDisplayWidget::updateCardDisplays()
|
||||||
|
|
||||||
// This doesn't really matter since overwrite the whole lessThan function to just compare dynamically anyway.
|
// This doesn't really matter since overwrite the whole lessThan function to just compare dynamically anyway.
|
||||||
proxy.setSortRole(Qt::EditRole);
|
proxy.setSortRole(Qt::EditRole);
|
||||||
proxy.sort(1, Qt::AscendingOrder);
|
proxy.sort(DeckListModelColumns::CARD_NAME, Qt::AscendingOrder);
|
||||||
|
|
||||||
// 1. trackedIndex is a source index → map it to proxy space
|
// 1. trackedIndex is a source index → map it to proxy space
|
||||||
QModelIndex proxyParent = proxy.mapFromSource(trackedIndex);
|
QModelIndex proxyParent = proxy.mapFromSource(trackedIndex);
|
||||||
|
|
@ -180,7 +183,9 @@ void CardGroupDisplayWidget::onActiveSortCriteriaChanged(QStringList _activeSort
|
||||||
void CardGroupDisplayWidget::mousePressEvent(QMouseEvent *event)
|
void CardGroupDisplayWidget::mousePressEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
QWidget::mousePressEvent(event);
|
QWidget::mousePressEvent(event);
|
||||||
selectionModel->clearSelection();
|
if (selectionModel) {
|
||||||
|
selectionModel->clearSelection();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CardGroupDisplayWidget::onClick(QMouseEvent *event, CardInfoPictureWithTextOverlayWidget *card)
|
void CardGroupDisplayWidget::onClick(QMouseEvent *event, CardInfoPictureWithTextOverlayWidget *card)
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <libcockatrice/card/card_info.h>
|
|
||||||
#include <libcockatrice/models/deck_list/deck_list_model.h>
|
#include <libcockatrice/models/deck_list/deck_list_model.h>
|
||||||
|
|
||||||
class CardGroupDisplayWidget : public QWidget
|
class CardGroupDisplayWidget : public QWidget
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,6 @@
|
||||||
#include "flat_card_group_display_widget.h"
|
#include "flat_card_group_display_widget.h"
|
||||||
|
|
||||||
#include "../card_info_picture_with_text_overlay_widget.h"
|
|
||||||
|
|
||||||
#include <QResizeEvent>
|
#include <QResizeEvent>
|
||||||
#include <libcockatrice/card/card_info_comparator.h>
|
|
||||||
#include <libcockatrice/card/database/card_database_manager.h>
|
#include <libcockatrice/card/database/card_database_manager.h>
|
||||||
#include <libcockatrice/models/deck_list/deck_list_model.h>
|
#include <libcockatrice/models/deck_list/deck_list_model.h>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
#include "card_info_display_widget.h"
|
#include "card_info_display_widget.h"
|
||||||
|
|
||||||
#include "../../../game/board/card_item.h"
|
#include "../../../game/board/card_item.h"
|
||||||
#include "../../../main.h"
|
|
||||||
#include "card_info_picture_widget.h"
|
#include "card_info_picture_widget.h"
|
||||||
#include "card_info_text_widget.h"
|
#include "card_info_text_widget.h"
|
||||||
|
|
||||||
|
|
@ -9,7 +8,6 @@
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <libcockatrice/card/database/card_database_manager.h>
|
#include <libcockatrice/card/database/card_database_manager.h>
|
||||||
#include <utility>
|
|
||||||
|
|
||||||
CardInfoDisplayWidget::CardInfoDisplayWidget(const CardRef &cardRef, QWidget *parent, Qt::WindowFlags flags)
|
CardInfoDisplayWidget::CardInfoDisplayWidget(const CardRef &cardRef, QWidget *parent, Qt::WindowFlags flags)
|
||||||
: QFrame(parent, flags), aspectRatio((qreal)CARD_HEIGHT / (qreal)CARD_WIDTH)
|
: QFrame(parent, flags), aspectRatio((qreal)CARD_HEIGHT / (qreal)CARD_WIDTH)
|
||||||
|
|
@ -51,7 +49,7 @@ void CardInfoDisplayWidget::setCard(const ExactCard &card)
|
||||||
if (exactCard)
|
if (exactCard)
|
||||||
connect(exactCard.getCardPtr().data(), &QObject::destroyed, this, &CardInfoDisplayWidget::clear);
|
connect(exactCard.getCardPtr().data(), &QObject::destroyed, this, &CardInfoDisplayWidget::clear);
|
||||||
|
|
||||||
text->setCard(exactCard.getCardPtr());
|
text->setCard(exactCard);
|
||||||
pic->setCard(exactCard);
|
pic->setCard(exactCard);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <libcockatrice/card/database/card_database_manager.h>
|
#include <libcockatrice/card/database/card_database_manager.h>
|
||||||
#include <libcockatrice/card/relation/card_relation.h>
|
#include <libcockatrice/card/relation/card_relation.h>
|
||||||
#include <utility>
|
|
||||||
|
|
||||||
CardInfoFrameWidget::CardInfoFrameWidget(QWidget *parent)
|
CardInfoFrameWidget::CardInfoFrameWidget(QWidget *parent)
|
||||||
: QTabWidget(parent), viewTransformationButton(nullptr), cardTextOnly(false)
|
: QTabWidget(parent), viewTransformationButton(nullptr), cardTextOnly(false)
|
||||||
|
|
@ -155,7 +154,7 @@ void CardInfoFrameWidget::setCard(const ExactCard &card)
|
||||||
|
|
||||||
setViewTransformationButtonVisibility(hasTransformation(exactCard.getInfo()));
|
setViewTransformationButtonVisibility(hasTransformation(exactCard.getInfo()));
|
||||||
|
|
||||||
text->setCard(exactCard.getCardPtr());
|
text->setCard(exactCard);
|
||||||
pic->setCard(exactCard);
|
pic->setCard(exactCard);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
#include <QPainterPath>
|
#include <QPainterPath>
|
||||||
#include <QStylePainter>
|
#include <QStylePainter>
|
||||||
#include <utility>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Constructs a CardPictureEnlargedWidget.
|
* @brief Constructs a CardPictureEnlargedWidget.
|
||||||
|
|
@ -34,10 +33,13 @@ CardInfoPictureEnlargedWidget::CardInfoPictureEnlargedWidget(QWidget *parent) :
|
||||||
*/
|
*/
|
||||||
void CardInfoPictureEnlargedWidget::loadPixmap(const QSize &size)
|
void CardInfoPictureEnlargedWidget::loadPixmap(const QSize &size)
|
||||||
{
|
{
|
||||||
|
// Handle DPI scaling
|
||||||
|
qreal dpr = devicePixelRatio(); // Get the actual scaling factor
|
||||||
|
QSize availableSize = size * dpr; // Convert to physical pixel size
|
||||||
if (card) {
|
if (card) {
|
||||||
CardPictureLoader::getPixmap(enlargedPixmap, card, size);
|
CardPictureLoader::getPixmap(enlargedPixmap, card, availableSize);
|
||||||
} else {
|
} else {
|
||||||
CardPictureLoader::getCardBackPixmap(enlargedPixmap, size);
|
CardPictureLoader::getCardBackPixmap(enlargedPixmap, availableSize);
|
||||||
}
|
}
|
||||||
pixmapDirty = false;
|
pixmapDirty = false;
|
||||||
}
|
}
|
||||||
|
|
@ -78,25 +80,35 @@ void CardInfoPictureEnlargedWidget::paintEvent(QPaintEvent *event)
|
||||||
loadPixmap(size());
|
loadPixmap(size());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scale the size of the pixmap to fit the widget while maintaining the aspect ratio
|
qreal dpr = enlargedPixmap.devicePixelRatio();
|
||||||
QSize scaledSize = enlargedPixmap.size().scaled(size().width(), size().height(), Qt::KeepAspectRatio);
|
|
||||||
|
|
||||||
// Calculate the position to center the scaled pixmap
|
QSize logicalPixmapSize(enlargedPixmap.width() / dpr, enlargedPixmap.height() / dpr);
|
||||||
QPoint topLeft{(width() - scaledSize.width()) / 2, (height() - scaledSize.height()) / 2};
|
|
||||||
|
|
||||||
// Define the radius for rounded corners
|
// Scale the pixmap to fit the widget (logical → logical)
|
||||||
// Adjust the radius as needed for rounded corners
|
QSize scaledLogicalSize = logicalPixmapSize.scaled(size(), Qt::KeepAspectRatio);
|
||||||
qreal radius = SettingsCache::instance().getRoundCardCorners() ? 0.05 * scaledSize.width() : 0.;
|
|
||||||
|
// Convert scaled logical size → physical size for scaled()
|
||||||
|
QSize scaledPhysicalSize = scaledLogicalSize * dpr;
|
||||||
|
|
||||||
|
// Pixmap scaled in PHYSICAL pixels
|
||||||
|
QPixmap finalPixmap = enlargedPixmap.scaled(scaledPhysicalSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||||
|
|
||||||
|
finalPixmap.setDevicePixelRatio(dpr);
|
||||||
|
|
||||||
|
// Center inside widget
|
||||||
|
QPoint topLeft{(width() - scaledLogicalSize.width()) / 2, (height() - scaledLogicalSize.height()) / 2};
|
||||||
|
|
||||||
|
// Rounded corner radius based on logical width
|
||||||
|
qreal radius = SettingsCache::instance().getRoundCardCorners() ? 0.05 * scaledLogicalSize.width() : 0.0;
|
||||||
|
|
||||||
QStylePainter painter(this);
|
QStylePainter painter(this);
|
||||||
// Fill the background with transparent color to ensure rounded corners are rendered properly
|
// Fill the background with transparent color to ensure rounded corners are rendered properly
|
||||||
painter.fillRect(rect(), Qt::transparent); // Use the transparent background
|
painter.fillRect(rect(), Qt::transparent); // Use the transparent background
|
||||||
|
|
||||||
QPainterPath shape;
|
QPainterPath shape;
|
||||||
shape.addRoundedRect(QRect(topLeft, scaledSize), radius, radius);
|
shape.addRoundedRect(QRect(topLeft, scaledLogicalSize), radius, radius);
|
||||||
painter.setClipPath(shape); // Set the clipping path
|
painter.setClipPath(shape); // Set the clipping path
|
||||||
|
|
||||||
// Draw the pixmap scaled to the calculated size
|
// Draw the pixmap scaled to the calculated size
|
||||||
painter.drawItemPixmap(QRect(topLeft, scaledSize), Qt::AlignCenter,
|
painter.drawPixmap(QRect(topLeft, scaledLogicalSize), finalPixmap);
|
||||||
enlargedPixmap.scaled(scaledSize, Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@
|
||||||
#ifndef CARD_PICTURE_ENLARGED_WIDGET_H
|
#ifndef CARD_PICTURE_ENLARGED_WIDGET_H
|
||||||
#define CARD_PICTURE_ENLARGED_WIDGET_H
|
#define CARD_PICTURE_ENLARGED_WIDGET_H
|
||||||
|
|
||||||
#include <QPixmap>
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <libcockatrice/card/printing/exact_card.h>
|
#include <libcockatrice/card/printing/exact_card.h>
|
||||||
|
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue