mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2025-12-21 14:50:26 -08:00
Compare commits
60 Commits
tooomm-dox
...
tooomm-dox
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
067d9797be | ||
|
|
d6db21419c | ||
|
|
367507e054 | ||
|
|
715ee1d6fe | ||
|
|
ad06a81765 | ||
|
|
ebb02b27b2 | ||
|
|
d47dc35885 | ||
|
|
41aca8467a | ||
|
|
cd44392866 | ||
|
|
64bb5355ff | ||
|
|
1198db8891 | ||
|
|
9471adb4f7 | ||
|
|
b29909bdbe | ||
|
|
589e9a15a6 | ||
|
|
c218a66bcd | ||
|
|
8485bbe575 | ||
|
|
5d9d7d3aa5 | ||
|
|
ccdda39e78 | ||
|
|
2e2682aad4 | ||
|
|
a390c8ada7 | ||
|
|
da70344547 | ||
|
|
2b690f8c87 | ||
|
|
c8b419888a | ||
|
|
d3302d521f | ||
|
|
5c1bb27d5c | ||
|
|
dde36183ce | ||
|
|
7c7f2dd8d5 | ||
|
|
edb0a954e2 | ||
|
|
0a239712dd | ||
|
|
95c3434205 | ||
|
|
f0be6972cc | ||
|
|
a799cd097a | ||
|
|
b4e3f2cba9 | ||
|
|
658ae83157 | ||
|
|
d29e72ce72 | ||
|
|
30cc8ad6f9 | ||
|
|
f0ebd28148 | ||
|
|
364d0ca52b | ||
|
|
3ff2df2796 | ||
|
|
d57bec8ec6 | ||
|
|
2b64e65f45 | ||
|
|
eab4d435f8 | ||
|
|
de13c22552 | ||
|
|
8ee7163014 | ||
|
|
c5fde071e7 | ||
|
|
8abd04dab1 | ||
|
|
858361e6d3 | ||
|
|
9ece4bfd9b | ||
|
|
a1a3b02d3a | ||
|
|
bc2ae6c486 | ||
|
|
587a8bc524 | ||
|
|
122926c6cd | ||
|
|
bac6beeb50 | ||
|
|
c75a483ee6 | ||
|
|
1c5bfdbabe | ||
|
|
553952132f | ||
|
|
1931eb11a9 | ||
|
|
65aef396fb | ||
|
|
a21e45ed36 | ||
|
|
adee67115c |
10
.github/workflows/desktop-build.yml
vendored
10
.github/workflows/desktop-build.yml
vendored
@@ -70,7 +70,7 @@ jobs:
|
||||
|
||||
- name: Checkout
|
||||
if: steps.configure.outputs.tag != null
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
@@ -162,11 +162,11 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Restore compiler cache (ccache)
|
||||
id: ccache_restore
|
||||
uses: actions/cache/restore@v4
|
||||
uses: actions/cache/restore@v5
|
||||
env:
|
||||
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
|
||||
with:
|
||||
@@ -205,7 +205,7 @@ jobs:
|
||||
|
||||
- name: Save compiler cache (ccache)
|
||||
if: github.ref == 'refs/heads/master'
|
||||
uses: actions/cache/save@v4
|
||||
uses: actions/cache/save@v5
|
||||
with:
|
||||
path: ${{env.CACHE}}
|
||||
key: ${{ steps.ccache_restore.outputs.cache-primary-key }}
|
||||
@@ -345,7 +345,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
|
||||
2
.github/workflows/desktop-lint.yml
vendored
2
.github/workflows/desktop-lint.yml
vendored
@@ -24,7 +24,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 20 # should be enough to find merge base
|
||||
|
||||
|
||||
2
.github/workflows/docker-release.yml
vendored
2
.github/workflows/docker-release.yml
vendored
@@ -23,7 +23,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Docker metadata
|
||||
id: metadata
|
||||
|
||||
2
.github/workflows/documentation-build.yml
vendored
2
.github/workflows/documentation-build.yml
vendored
@@ -21,7 +21,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Install Graphviz
|
||||
run: |
|
||||
|
||||
4
.github/workflows/translations-pull.yml
vendored
4
.github/workflows/translations-pull.yml
vendored
@@ -20,7 +20,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Pull translated strings from Transifex
|
||||
uses: transifex/cli-action@v2
|
||||
@@ -33,7 +33,7 @@ jobs:
|
||||
- name: Create pull request
|
||||
if: github.event_name != 'pull_request'
|
||||
id: create_pr
|
||||
uses: peter-evans/create-pull-request@v7
|
||||
uses: peter-evans/create-pull-request@v8
|
||||
with:
|
||||
add-paths: |
|
||||
cockatrice/translations/*.ts
|
||||
|
||||
4
.github/workflows/translations-push.yml
vendored
4
.github/workflows/translations-push.yml
vendored
@@ -20,7 +20,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Install lupdate
|
||||
shell: bash
|
||||
@@ -57,7 +57,7 @@ jobs:
|
||||
- name: Create pull request
|
||||
if: github.event_name != 'pull_request'
|
||||
id: create_pr
|
||||
uses: peter-evans/create-pull-request@v7
|
||||
uses: peter-evans/create-pull-request@v8
|
||||
with:
|
||||
add-paths: |
|
||||
cockatrice/cockatrice_en@source.ts
|
||||
|
||||
2
.github/workflows/web-build.yml
vendored
2
.github/workflows/web-build.yml
vendored
@@ -35,7 +35,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v6
|
||||
|
||||
2
.github/workflows/web-lint.yml
vendored
2
.github/workflows/web-lint.yml
vendored
@@ -18,7 +18,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v6
|
||||
|
||||
4
.gitmodules
vendored
4
.gitmodules
vendored
@@ -1,3 +1,7 @@
|
||||
[submodule "vcpkg"]
|
||||
path = vcpkg
|
||||
url = https://github.com/microsoft/vcpkg.git
|
||||
|
||||
[submodule "doxygen-awesome-css"]
|
||||
path = doc/doxygen/theme
|
||||
url = https://github.com/jothepro/doxygen-awesome-css.git
|
||||
|
||||
10
Doxyfile
10
Doxyfile
@@ -1068,7 +1068,8 @@ RECURSIVE = YES
|
||||
|
||||
EXCLUDE = build/ \
|
||||
cmake/ \
|
||||
dbconverter/ \
|
||||
doc/doxygen/theme/docs/ \
|
||||
doc/doxygen/theme/include/ \
|
||||
vcpkg/ \
|
||||
webclient/
|
||||
|
||||
@@ -1431,7 +1432,8 @@ HTML_STYLESHEET =
|
||||
# documentation.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_EXTRA_STYLESHEET = doc/doxygen/css/doxygen_style.css
|
||||
HTML_EXTRA_STYLESHEET = doc/doxygen/css/doxygen_style.css \
|
||||
doc/doxygen/theme/doxygen-awesome.css
|
||||
|
||||
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
|
||||
# other source files which should be copied to the HTML output directory. Note
|
||||
@@ -1454,7 +1456,7 @@ HTML_EXTRA_FILES = doc/doxygen/js/graph_toggle.js
|
||||
# The default value is: AUTO_LIGHT.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_COLORSTYLE = AUTO_DARK
|
||||
HTML_COLORSTYLE = LIGHT # required with doxygen-awesome-css theme, Auto Dark Mode will still work
|
||||
|
||||
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
|
||||
# will adjust the colors in the style sheet and background images according to
|
||||
@@ -1765,7 +1767,7 @@ ECLIPSE_DOC_ID = org.doxygen.Project
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
DISABLE_INDEX = YES
|
||||
DISABLE_INDEX = NO # YES is bugged in the theme, see jothepro/doxygen-awesome-css/issues/201
|
||||
|
||||
# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
|
||||
# structure should be generated to display hierarchical information. If the tag
|
||||
|
||||
11
README.md
11
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-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)
|
||||
@@ -54,6 +55,7 @@ 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.
|
||||
- [Official Website](https://cockatrice.github.io)
|
||||
- [Official Wiki](https://github.com/Cockatrice/Cockatrice/wiki)
|
||||
- [Official Code Documentation](https://cockatrice.github.io/docs)
|
||||
- [Official Discord](https://discord.gg/3Z9yzmA)
|
||||
- [reddit r/Cockatrice](https://reddit.com/r/cockatrice)
|
||||
|
||||
@@ -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>
|
||||
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.
|
||||
|
||||
#### Repository Activity
|
||||

|
||||
|
||||
<details>
|
||||
<summary><b>Kudos to our amazing contributors ❤️</b></summary>
|
||||
<summary><b>Kudos to all our amazing contributors ❤️</b></summary>
|
||||
<br>
|
||||
<a href="https://github.com/Cockatrice/Cockatrice/graphs/contributors">
|
||||
<img src="https://contrib.rocks/image?repo=Cockatrice/Cockatrice" />
|
||||
|
||||
@@ -19,7 +19,10 @@ set(cockatrice_SOURCES
|
||||
src/client/settings/card_counter_settings.cpp
|
||||
src/client/settings/shortcut_treeview.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/loaded_deck.cpp
|
||||
src/interface/widgets/dialogs/dlg_connect.cpp
|
||||
src/interface/widgets/dialogs/dlg_convert_deck_to_cod_format.cpp
|
||||
src/interface/widgets/dialogs/dlg_create_game.cpp
|
||||
@@ -142,6 +145,7 @@ set(cockatrice_SOURCES
|
||||
src/interface/widgets/cards/deck_card_zone_display_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_list_statistics_analyzer.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_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_list_style_proxy.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/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_push_button.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/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_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_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_sub_type_filter_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_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_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/main.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/average_deck/edhrec_average_deck_api_response.cpp
|
||||
src/interface/widgets/tabs/api/edhrec/api_response/average_deck/edhrec_deck_api_response.cpp
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
[Rules]
|
||||
# The default log level is info
|
||||
*.debug = false
|
||||
#*.info = true
|
||||
#*.warning = true
|
||||
#*.critical = true
|
||||
#*.fatal = true
|
||||
|
||||
# Uncomment a rule to see debug level logs for that category,
|
||||
# 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 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>
|
||||
<dd>[f:aggro](#f: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>[f:"red deck wins"](#f:%22red deck wins%22) <small>(Any deck with a filename containing the exact phrase "red deck wins")</small></dd>
|
||||
<dt><u>F</u>ile <u>N</u>ame:</dt>
|
||||
<dd>[fn:aggro](#fn:aggro) <small>(Any deck with a filename containing the word aggro)</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>[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>
|
||||
<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>
|
||||
|
||||
<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>
|
||||
<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>
|
||||
|
||||
@@ -350,11 +350,11 @@
|
||||
style="fill-opacity:1;stroke:black;stroke-width:2.78220296;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||
d="M 49.84375 1.71875 C 36.719738 1.71875 26.0625 12.375988 26.0625 25.5 C 26.0625 32.977454 29.538325 39.612734 34.9375 43.96875 C 24.439951 49.943698 17.919149 62.196126 14.3125 75.65625 C 9.0380874 95.34065 30.224013 98.21875 49.84375 98.21875 C 69.463486 98.21875 90.549327 94.96715 85.375 75.65625 C 81.693381 61.916246 75.224585 49.827177 64.8125 43.9375 C 70.181573 39.580662 73.59375 32.953205 73.59375 25.5 C 73.59375 12.375988 62.967762 1.71875 49.84375 1.71875 z "
|
||||
transform="translate(0,952.36218)"
|
||||
id="right" />
|
||||
id="left" />
|
||||
<path
|
||||
style="opacity:1;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.73577702;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m 51.28696,1001.834 0,-46.98372 1.434151,0.16768 c 5.155008,0.60274 9.462857,2.72154 12.938257,6.36366 4.74393,4.9715 6.87913,11.35611 6.16464,18.43328 -0.53702,5.31935 -3.09008,10.59498 -6.83833,14.13074 l -1.94072,1.83069 3.04083,2.20427 c 3.58084,2.5957 7.18975,6.4912 9.55296,10.3116 4.89572,7.9144 9.23593,21.4918 8.50487,26.6055 -0.81312,5.6877 -5.43872,9.6977 -13.62216,11.8093 -3.80822,0.9826 -7.68056,1.4713 -14.763321,1.8633 l -4.471177,0.2474 0,-46.9837 z"
|
||||
id="left"
|
||||
id="right"
|
||||
inkscape:connector-curvature="0" />
|
||||
<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"
|
||||
|
||||
|
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"
|
||||
d="M 49.84375 1.71875 C 36.719738 1.71875 26.0625 12.375988 26.0625 25.5 C 26.0625 32.977454 29.538325 39.612734 34.9375 43.96875 C 24.439951 49.943698 17.919149 62.196126 14.3125 75.65625 C 9.0380874 95.34065 30.224013 98.21875 49.84375 98.21875 C 69.463486 98.21875 90.549327 94.96715 85.375 75.65625 C 81.693381 61.916246 75.224585 49.827177 64.8125 43.9375 C 70.181573 39.580662 73.59375 32.953205 73.59375 25.5 C 73.59375 12.375988 62.967762 1.71875 49.84375 1.71875 z "
|
||||
transform="translate(0,952.36218)"
|
||||
id="right" />
|
||||
id="left" />
|
||||
<path
|
||||
style="opacity:1;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.73577702;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m 51.28696,1001.834 0,-46.98372 1.434151,0.16768 c 5.155008,0.60274 9.462857,2.72154 12.938257,6.36366 4.74393,4.9715 6.87913,11.35611 6.16464,18.43328 -0.53702,5.31935 -3.09008,10.59498 -6.83833,14.13074 l -1.94072,1.83069 3.04083,2.20427 c 3.58084,2.5957 7.18975,6.4912 9.55296,10.3116 4.89572,7.9144 9.23593,21.4918 8.50487,26.6055 -0.81312,5.6877 -5.43872,9.6977 -13.62216,11.8093 -3.80822,0.9826 -7.68056,1.4713 -14.763321,1.8633 l -4.471177,0.2474 0,-46.9837 z"
|
||||
id="left"
|
||||
id="right"
|
||||
inkscape:connector-curvature="0" />
|
||||
<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"
|
||||
|
||||
|
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"
|
||||
d="M 49.84375 1.71875 C 36.719738 1.71875 26.0625 12.375988 26.0625 25.5 C 26.0625 32.977454 29.538325 39.612734 34.9375 43.96875 C 24.439951 49.943698 17.919149 62.196126 14.3125 75.65625 C 9.0380874 95.34065 30.224013 98.21875 49.84375 98.21875 C 69.463486 98.21875 90.549327 94.96715 85.375 75.65625 C 81.693381 61.916246 75.224585 49.827177 64.8125 43.9375 C 70.181573 39.580662 73.59375 32.953205 73.59375 25.5 C 73.59375 12.375988 62.967762 1.71875 49.84375 1.71875 z "
|
||||
transform="translate(0,952.36218)"
|
||||
id="right" />
|
||||
id="left" />
|
||||
<path
|
||||
style="opacity:1;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.73577702;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m 51.28696,1001.834 0,-46.98372 1.434151,0.16768 c 5.155008,0.60274 9.462857,2.72154 12.938257,6.36366 4.74393,4.9715 6.87913,11.35611 6.16464,18.43328 -0.53702,5.31935 -3.09008,10.59498 -6.83833,14.13074 l -1.94072,1.83069 3.04083,2.20427 c 3.58084,2.5957 7.18975,6.4912 9.55296,10.3116 4.89572,7.9144 9.23593,21.4918 8.50487,26.6055 -0.81312,5.6877 -5.43872,9.6977 -13.62216,11.8093 -3.80822,0.9826 -7.68056,1.4713 -14.763321,1.8633 l -4.471177,0.2474 0,-46.9837 z"
|
||||
id="left"
|
||||
id="right"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
sodipodi:type="star"
|
||||
|
||||
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
@@ -2,13 +2,13 @@
|
||||
|
||||
#include <QDesktopServices>
|
||||
#include <QMessageBox>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#include <QNetworkRequest>
|
||||
#include <QRegularExpression>
|
||||
#include <QUrlQuery>
|
||||
#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)
|
||||
: QObject(parent), cardDatabase(_cardDatabase)
|
||||
@@ -63,6 +63,7 @@ void DeckStatsInterface::analyzeDeck(DeckList *deck)
|
||||
|
||||
QNetworkRequest request(QUrl("https://deckstats.net/index.php"));
|
||||
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
|
||||
request.setHeader(QNetworkRequest::UserAgentHeader, QString("Cockatrice %1").arg(VERSION_STRING));
|
||||
|
||||
manager->post(request, data);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#ifndef DECKSTATS_INTERFACE_H
|
||||
#define DECKSTATS_INTERFACE_H
|
||||
|
||||
#include <QObject>
|
||||
#include <libcockatrice/card/database/card_database.h>
|
||||
#include <libcockatrice/deck_list/deck_list.h>
|
||||
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
|
||||
#include <QDesktopServices>
|
||||
#include <QMessageBox>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#include <QNetworkRequest>
|
||||
#include <QRegularExpression>
|
||||
#include <QUrlQuery>
|
||||
#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)
|
||||
: QObject(parent), cardDatabase(_cardDatabase)
|
||||
@@ -88,6 +88,7 @@ void TappedOutInterface::analyzeDeck(DeckList *deck)
|
||||
|
||||
QNetworkRequest request(QUrl("https://tappedout.net/mtg-decks/paste/"));
|
||||
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
|
||||
request.setHeader(QNetworkRequest::UserAgentHeader, QString("Cockatrice %1").arg(VERSION_STRING));
|
||||
|
||||
manager->post(request, data);
|
||||
}
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
#ifndef TAPPEDOUT_INTERFACE_H
|
||||
#define TAPPEDOUT_INTERFACE_H
|
||||
|
||||
#include <QLoggingCategory>
|
||||
#include <QObject>
|
||||
#include <libcockatrice/card/database/card_database.h>
|
||||
#include <libcockatrice/deck_list/deck_list.h>
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
|
||||
#ifndef 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 <QJsonArray>
|
||||
@@ -16,21 +18,21 @@ class IJsonDeckParser
|
||||
public:
|
||||
virtual ~IJsonDeckParser() = default;
|
||||
|
||||
virtual DeckLoader *parse(const QJsonObject &obj) = 0;
|
||||
virtual DeckList parse(const QJsonObject &obj) = 0;
|
||||
};
|
||||
|
||||
class ArchidektJsonParser : public IJsonDeckParser
|
||||
{
|
||||
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 deckDescription = obj.value("description").toString();
|
||||
|
||||
loader->getDeckList()->setName(deckName);
|
||||
loader->getDeckList()->setComments(deckDescription);
|
||||
deckList.setName(deckName);
|
||||
deckList.setComments(deckDescription);
|
||||
|
||||
QString outputText;
|
||||
QTextStream outStream(&outputText);
|
||||
@@ -47,25 +49,25 @@ public:
|
||||
outStream << quantity << ' ' << cardName << " (" << setName << ") " << collectorNumber << '\n';
|
||||
}
|
||||
|
||||
loader->getDeckList()->loadFromStream_Plain(outStream, false);
|
||||
DeckLoader::resolveSetNameAndNumberToProviderID(loader->getDeckList());
|
||||
deckList.loadFromStream_Plain(outStream, false);
|
||||
deckList.forEachCard(CardNodeFunction::ResolveProviderId());
|
||||
|
||||
return loader;
|
||||
return deckList;
|
||||
}
|
||||
};
|
||||
|
||||
class MoxfieldJsonParser : public IJsonDeckParser
|
||||
{
|
||||
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 deckDescription = obj.value("description").toString();
|
||||
|
||||
loader->getDeckList()->setName(deckName);
|
||||
loader->getDeckList()->setComments(deckDescription);
|
||||
deckList.setName(deckName);
|
||||
deckList.setComments(deckDescription);
|
||||
|
||||
QString outputText;
|
||||
QTextStream outStream(&outputText);
|
||||
@@ -94,8 +96,8 @@ public:
|
||||
outStream << quantity << ' ' << cardName << " (" << setName << ") " << collectorNumber << '\n';
|
||||
}
|
||||
|
||||
loader->getDeckList()->loadFromStream_Plain(outStream, false);
|
||||
DeckLoader::resolveSetNameAndNumberToProviderID(loader->getDeckList());
|
||||
deckList.loadFromStream_Plain(outStream, false);
|
||||
deckList.forEachCard(CardNodeFunction::ResolveProviderId());
|
||||
|
||||
QJsonObject commandersObj = obj.value("commanders").toObject();
|
||||
if (!commandersObj.isEmpty()) {
|
||||
@@ -106,12 +108,12 @@ public:
|
||||
QString collectorNumber = cardData.value("cn").toString();
|
||||
QString providerId = cardData.value("scryfall_id").toString();
|
||||
|
||||
loader->getDeckList()->setBannerCard({commanderName, providerId});
|
||||
loader->getDeckList()->addCard(commanderName, DECK_ZONE_MAIN, -1, setName, collectorNumber, providerId);
|
||||
deckList.setBannerCard({commanderName, providerId});
|
||||
deckList.addCard(commanderName, DECK_ZONE_MAIN, -1, setName, collectorNumber, providerId);
|
||||
}
|
||||
}
|
||||
|
||||
return loader;
|
||||
return deckList;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -4,18 +4,17 @@
|
||||
#include "../../../../main.h"
|
||||
#include "../../../settings/cache_settings.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QCryptographicHash>
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
#include <QLocale>
|
||||
#include <QMessageBox>
|
||||
#include <QNetworkReply>
|
||||
#include <QUrl>
|
||||
#include <QtConcurrent>
|
||||
#include <libcockatrice/card/database/card_database.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_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)
|
||||
{
|
||||
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) {
|
||||
// This will write out to the file (used for spoiler.xml)
|
||||
|
||||
@@ -22,7 +22,7 @@ public:
|
||||
inline QString getCardUpdaterBinaryName()
|
||||
{
|
||||
return "oracle";
|
||||
};
|
||||
}
|
||||
QByteArray getHash(const QString fileName);
|
||||
QByteArray getHash(QByteArray data);
|
||||
static bool deleteSpoilerFile();
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#include "update_downloader.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QUrl>
|
||||
|
||||
UpdateDownloader::UpdateDownloader(QObject *parent) : QObject(parent), response(nullptr)
|
||||
|
||||
@@ -7,9 +7,7 @@
|
||||
#ifndef COCKATRICE_UPDATEDOWNLOADER_H
|
||||
#define COCKATRICE_UPDATEDOWNLOADER_H
|
||||
|
||||
#include <QDate>
|
||||
#include <QObject>
|
||||
#include <QUrl>
|
||||
#include <QtNetwork>
|
||||
|
||||
class UpdateDownloader : public QObject
|
||||
|
||||
@@ -261,6 +261,7 @@ SettingsCache::SettingsCache()
|
||||
doubleClickToPlay = settings->value("interface/doubleclicktoplay", true).toBool();
|
||||
clickPlaysAllSelected = settings->value("interface/clickPlaysAllSelected", true).toBool();
|
||||
playToStack = settings->value("interface/playtostack", true).toBool();
|
||||
doNotDeleteArrowsInSubPhases = settings->value("interface/doNotDeleteArrowsInSubPhases", true).toBool();
|
||||
startingHandSize = settings->value("interface/startinghandsize", 7).toInt();
|
||||
annotateTokens = settings->value("interface/annotatetokens", false).toBool();
|
||||
tabGameSplitterSizes = settings->value("interface/tabgame_splittersizes").toByteArray();
|
||||
@@ -309,10 +310,15 @@ SettingsCache::SettingsCache()
|
||||
settings->value("interface/visualdeckstorageselectionanimation", true).toBool();
|
||||
defaultDeckEditorType = settings->value("interface/defaultDeckEditorType", 1).toInt();
|
||||
visualDatabaseDisplayFilterToMostRecentSetsEnabled =
|
||||
settings->value("interface/visualdatabasedisplayfiltertomostrecentsetsenabled", true).toBool();
|
||||
settings->value("interface/visualdatabasedisplayfiltertomostrecentsetsenabled", false).toBool();
|
||||
visualDatabaseDisplayFilterToMostRecentSetsAmount =
|
||||
settings->value("interface/visualdatabasedisplayfiltertomostrecentsetsamount", 10).toInt();
|
||||
visualDeckEditorSampleHandSize = settings->value("interface/visualdeckeditorsamplehandsize", 7).toInt();
|
||||
visualDeckEditorCardSize = settings->value("interface/visualdeckeditorcardsize", 100).toInt();
|
||||
visualDatabaseDisplayCardSize = settings->value("interface/visualdatabasedisplaycardsize", 100).toInt();
|
||||
edhrecCardSize = settings->value("interface/edhreccardsize", 100).toInt();
|
||||
archidektPreviewSize = settings->value("interface/archidektpreviewsize", 100).toInt();
|
||||
|
||||
horizontalHand = settings->value("hand/horizontal", true).toBool();
|
||||
invertVerticalCoordinate = settings->value("table/invert_vertical", false).toBool();
|
||||
minPlayersForMultiColumnLayout = settings->value("interface/min_players_multicolumn", 4).toInt();
|
||||
@@ -664,6 +670,12 @@ void SettingsCache::setPlayToStack(QT_STATE_CHANGED_T _playToStack)
|
||||
settings->setValue("interface/playtostack", playToStack);
|
||||
}
|
||||
|
||||
void SettingsCache::setDoNotDeleteArrowsInSubPhases(QT_STATE_CHANGED_T _doNotDeleteArrowsInSubPhases)
|
||||
{
|
||||
doNotDeleteArrowsInSubPhases = static_cast<bool>(_doNotDeleteArrowsInSubPhases);
|
||||
settings->setValue("interface/doNotDeleteArrowsInSubPhases", doNotDeleteArrowsInSubPhases);
|
||||
}
|
||||
|
||||
void SettingsCache::setStartingHandSize(int _startingHandSize)
|
||||
{
|
||||
startingHandSize = _startingHandSize;
|
||||
@@ -856,6 +868,34 @@ void SettingsCache::setVisualDeckStorageSelectionAnimation(QT_STATE_CHANGED_T va
|
||||
emit visualDeckStorageSelectionAnimationChanged(visualDeckStorageSelectionAnimation);
|
||||
}
|
||||
|
||||
void SettingsCache::setVisualDeckEditorCardSize(int _visualDeckEditorCardSize)
|
||||
{
|
||||
visualDeckEditorCardSize = _visualDeckEditorCardSize;
|
||||
settings->setValue("interface/visualdeckeditorcardsize", visualDeckEditorCardSize);
|
||||
emit visualDeckEditorCardSizeChanged();
|
||||
}
|
||||
|
||||
void SettingsCache::setVisualDatabaseDisplayCardSize(int _visualDatabaseDisplayCardSize)
|
||||
{
|
||||
visualDatabaseDisplayCardSize = _visualDatabaseDisplayCardSize;
|
||||
settings->setValue("interface/visualdatabasedisplaycardsize", visualDatabaseDisplayCardSize);
|
||||
emit visualDatabaseDisplayCardSizeChanged();
|
||||
}
|
||||
|
||||
void SettingsCache::setEDHRecCardSize(int _edhrecCardSize)
|
||||
{
|
||||
edhrecCardSize = _edhrecCardSize;
|
||||
settings->setValue("interface/edhreccardsize", edhrecCardSize);
|
||||
emit edhRecCardSizeChanged();
|
||||
}
|
||||
|
||||
void SettingsCache::setArchidektPreviewCardSize(int _archidektPreviewCardSize)
|
||||
{
|
||||
archidektPreviewSize = _archidektPreviewCardSize;
|
||||
settings->setValue("interface/archidektpreviewsize", archidektPreviewSize);
|
||||
emit archidektPreviewSizeChanged();
|
||||
}
|
||||
|
||||
void SettingsCache::setDefaultDeckEditorType(int value)
|
||||
{
|
||||
defaultDeckEditorType = value;
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
#include <QDate>
|
||||
#include <QLoggingCategory>
|
||||
#include <QObject>
|
||||
#include <QSize>
|
||||
#include <QStringList>
|
||||
#include <libcockatrice/interfaces/interface_card_database_path_provider.h>
|
||||
@@ -167,6 +166,10 @@ signals:
|
||||
void visualDatabaseDisplayFilterToMostRecentSetsEnabledChanged(bool enabled);
|
||||
void visualDatabaseDisplayFilterToMostRecentSetsAmountChanged(int amount);
|
||||
void visualDeckEditorSampleHandSizeAmountChanged(int amount);
|
||||
void visualDeckEditorCardSizeChanged();
|
||||
void visualDatabaseDisplayCardSizeChanged();
|
||||
void edhRecCardSizeChanged();
|
||||
void archidektPreviewSizeChanged();
|
||||
void horizontalHandChanged();
|
||||
void handJustificationChanged();
|
||||
void invertVerticalCoordinateChanged();
|
||||
@@ -228,6 +231,7 @@ private:
|
||||
bool doubleClickToPlay;
|
||||
bool clickPlaysAllSelected;
|
||||
bool playToStack;
|
||||
bool doNotDeleteArrowsInSubPhases;
|
||||
int startingHandSize;
|
||||
bool annotateTokens;
|
||||
QByteArray tabGameSplitterSizes;
|
||||
@@ -249,6 +253,10 @@ private:
|
||||
QStringList visualDeckStorageDefaultTagsList;
|
||||
bool visualDeckStorageSearchFolderNames;
|
||||
int visualDeckStorageCardSize;
|
||||
int visualDeckEditorCardSize;
|
||||
int visualDatabaseDisplayCardSize;
|
||||
int edhrecCardSize;
|
||||
int archidektPreviewSize;
|
||||
bool visualDeckStorageDrawUnusedColorIdentities;
|
||||
int visualDeckStorageUnusedColorIdentitiesOpacity;
|
||||
int visualDeckStorageTooltipType;
|
||||
@@ -316,8 +324,8 @@ private:
|
||||
int keepalive;
|
||||
int timeout;
|
||||
void translateLegacySettings();
|
||||
QString getSafeConfigPath(QString configEntry, QString defaultPath) const;
|
||||
QString getSafeConfigFilePath(QString configEntry, QString defaultPath) const;
|
||||
[[nodiscard]] QString getSafeConfigPath(QString configEntry, QString defaultPath) const;
|
||||
[[nodiscard]] QString getSafeConfigFilePath(QString configEntry, QString defaultPath) const;
|
||||
void loadPaths();
|
||||
bool rememberGameSettings;
|
||||
QList<ReleaseChannel *> releaseChannels;
|
||||
@@ -329,137 +337,137 @@ public:
|
||||
SettingsCache();
|
||||
QString getDataPath();
|
||||
QString getSettingsPath();
|
||||
QString getCachePath() const;
|
||||
QString getNetworkCachePath() const;
|
||||
const QByteArray &getMainWindowGeometry() const
|
||||
[[nodiscard]] QString getCachePath() const;
|
||||
[[nodiscard]] QString getNetworkCachePath() const;
|
||||
[[nodiscard]] const QByteArray &getMainWindowGeometry() const
|
||||
{
|
||||
return mainWindowGeometry;
|
||||
}
|
||||
const QByteArray &getTokenDialogGeometry() const
|
||||
[[nodiscard]] const QByteArray &getTokenDialogGeometry() const
|
||||
{
|
||||
return tokenDialogGeometry;
|
||||
}
|
||||
const QByteArray &getSetsDialogGeometry() const
|
||||
[[nodiscard]] const QByteArray &getSetsDialogGeometry() const
|
||||
{
|
||||
return setsDialogGeometry;
|
||||
}
|
||||
QString getLang() const
|
||||
[[nodiscard]] QString getLang() const
|
||||
{
|
||||
return lang;
|
||||
}
|
||||
QString getDeckPath() const
|
||||
[[nodiscard]] QString getDeckPath() const
|
||||
{
|
||||
return deckPath;
|
||||
}
|
||||
QString getFiltersPath() const
|
||||
[[nodiscard]] QString getFiltersPath() const
|
||||
{
|
||||
return filtersPath;
|
||||
}
|
||||
QString getReplaysPath() const
|
||||
[[nodiscard]] QString getReplaysPath() const
|
||||
{
|
||||
return replaysPath;
|
||||
}
|
||||
QString getThemesPath() const
|
||||
[[nodiscard]] QString getThemesPath() const
|
||||
{
|
||||
return themesPath;
|
||||
}
|
||||
QString getPicsPath() const
|
||||
[[nodiscard]] QString getPicsPath() const
|
||||
{
|
||||
return picsPath;
|
||||
}
|
||||
QString getRedirectCachePath() const
|
||||
[[nodiscard]] QString getRedirectCachePath() const
|
||||
{
|
||||
return redirectCachePath;
|
||||
}
|
||||
QString getCustomPicsPath() const
|
||||
[[nodiscard]] QString getCustomPicsPath() const
|
||||
{
|
||||
return customPicsPath;
|
||||
}
|
||||
QString getCustomCardDatabasePath() const override
|
||||
[[nodiscard]] QString getCustomCardDatabasePath() const override
|
||||
{
|
||||
return customCardDatabasePath;
|
||||
}
|
||||
QString getCardDatabasePath() const override
|
||||
[[nodiscard]] QString getCardDatabasePath() const override
|
||||
{
|
||||
return cardDatabasePath;
|
||||
}
|
||||
QString getSpoilerCardDatabasePath() const override
|
||||
[[nodiscard]] QString getSpoilerCardDatabasePath() const override
|
||||
{
|
||||
return spoilerDatabasePath;
|
||||
}
|
||||
QString getTokenDatabasePath() const override
|
||||
[[nodiscard]] QString getTokenDatabasePath() const override
|
||||
{
|
||||
return tokenDatabasePath;
|
||||
}
|
||||
QString getThemeName() const
|
||||
[[nodiscard]] QString getThemeName() const
|
||||
{
|
||||
return themeName;
|
||||
}
|
||||
QString getHomeTabBackgroundSource() const
|
||||
[[nodiscard]] QString getHomeTabBackgroundSource() const
|
||||
{
|
||||
return homeTabBackgroundSource;
|
||||
}
|
||||
int getHomeTabBackgroundShuffleFrequency() const
|
||||
[[nodiscard]] int getHomeTabBackgroundShuffleFrequency() const
|
||||
{
|
||||
return homeTabBackgroundShuffleFrequency;
|
||||
}
|
||||
bool getTabVisualDeckStorageOpen() const
|
||||
[[nodiscard]] bool getTabVisualDeckStorageOpen() const
|
||||
{
|
||||
return tabVisualDeckStorageOpen;
|
||||
}
|
||||
bool getTabServerOpen() const
|
||||
[[nodiscard]] bool getTabServerOpen() const
|
||||
{
|
||||
return tabServerOpen;
|
||||
}
|
||||
bool getTabAccountOpen() const
|
||||
[[nodiscard]] bool getTabAccountOpen() const
|
||||
{
|
||||
return tabAccountOpen;
|
||||
}
|
||||
bool getTabDeckStorageOpen() const
|
||||
[[nodiscard]] bool getTabDeckStorageOpen() const
|
||||
{
|
||||
return tabDeckStorageOpen;
|
||||
}
|
||||
bool getTabReplaysOpen() const
|
||||
[[nodiscard]] bool getTabReplaysOpen() const
|
||||
{
|
||||
return tabReplaysOpen;
|
||||
}
|
||||
bool getTabAdminOpen() const
|
||||
[[nodiscard]] bool getTabAdminOpen() const
|
||||
{
|
||||
return tabAdminOpen;
|
||||
}
|
||||
bool getTabLogOpen() const
|
||||
[[nodiscard]] bool getTabLogOpen() const
|
||||
{
|
||||
return tabLogOpen;
|
||||
}
|
||||
QString getChatMentionColor() const
|
||||
[[nodiscard]] QString getChatMentionColor() const
|
||||
{
|
||||
return chatMentionColor;
|
||||
}
|
||||
QString getChatHighlightColor() const
|
||||
[[nodiscard]] QString getChatHighlightColor() const
|
||||
{
|
||||
return chatHighlightColor;
|
||||
}
|
||||
bool getPicDownload() const
|
||||
[[nodiscard]] bool getPicDownload() const
|
||||
{
|
||||
return picDownload;
|
||||
}
|
||||
bool getShowStatusBar() const
|
||||
[[nodiscard]] bool getShowStatusBar() const
|
||||
{
|
||||
return showStatusBar;
|
||||
}
|
||||
bool getNotificationsEnabled() const
|
||||
[[nodiscard]] bool getNotificationsEnabled() const
|
||||
{
|
||||
return notificationsEnabled;
|
||||
}
|
||||
bool getSpectatorNotificationsEnabled() const
|
||||
[[nodiscard]] bool getSpectatorNotificationsEnabled() const
|
||||
{
|
||||
return spectatorNotificationsEnabled;
|
||||
}
|
||||
bool getBuddyConnectNotificationsEnabled() const
|
||||
[[nodiscard]] bool getBuddyConnectNotificationsEnabled() const
|
||||
{
|
||||
return buddyConnectNotificationsEnabled;
|
||||
}
|
||||
bool getCheckUpdatesOnStartup() const
|
||||
[[nodiscard]] bool getCheckUpdatesOnStartup() const
|
||||
{
|
||||
return checkUpdatesOnStartup;
|
||||
}
|
||||
@@ -471,243 +479,263 @@ public:
|
||||
{
|
||||
return startupCardUpdateCheckAlwaysUpdate;
|
||||
}
|
||||
int getCardUpdateCheckInterval() const
|
||||
[[nodiscard]] int getCardUpdateCheckInterval() const
|
||||
{
|
||||
return cardUpdateCheckInterval;
|
||||
}
|
||||
QDate getLastCardUpdateCheck() const
|
||||
[[nodiscard]] QDate getLastCardUpdateCheck() const
|
||||
{
|
||||
return lastCardUpdateCheck;
|
||||
}
|
||||
bool getCardUpdateCheckRequired() const
|
||||
[[nodiscard]] bool getCardUpdateCheckRequired() const
|
||||
{
|
||||
return getLastCardUpdateCheck().daysTo(QDateTime::currentDateTime().date()) >= getCardUpdateCheckInterval() &&
|
||||
getLastCardUpdateCheck() != QDateTime::currentDateTime().date();
|
||||
}
|
||||
bool getNotifyAboutUpdates() const override
|
||||
[[nodiscard]] bool getNotifyAboutUpdates() const override
|
||||
{
|
||||
return notifyAboutUpdates;
|
||||
}
|
||||
bool getNotifyAboutNewVersion() const
|
||||
[[nodiscard]] bool getNotifyAboutNewVersion() const
|
||||
{
|
||||
return notifyAboutNewVersion;
|
||||
}
|
||||
bool getShowTipsOnStartup() const
|
||||
[[nodiscard]] bool getShowTipsOnStartup() const
|
||||
{
|
||||
return showTipsOnStartup;
|
||||
}
|
||||
QList<int> getSeenTips() const
|
||||
[[nodiscard]] QList<int> getSeenTips() const
|
||||
{
|
||||
return seenTips;
|
||||
}
|
||||
int getUpdateReleaseChannelIndex() const
|
||||
[[nodiscard]] int getUpdateReleaseChannelIndex() const
|
||||
{
|
||||
return updateReleaseChannel;
|
||||
}
|
||||
ReleaseChannel *getUpdateReleaseChannel() const
|
||||
[[nodiscard]] ReleaseChannel *getUpdateReleaseChannel() const
|
||||
{
|
||||
return releaseChannels.at(qMax(0, updateReleaseChannel));
|
||||
}
|
||||
QList<ReleaseChannel *> getUpdateReleaseChannels() const
|
||||
[[nodiscard]] QList<ReleaseChannel *> getUpdateReleaseChannels() const
|
||||
{
|
||||
return releaseChannels;
|
||||
}
|
||||
|
||||
bool getDoubleClickToPlay() const
|
||||
[[nodiscard]] bool getDoubleClickToPlay() const
|
||||
{
|
||||
return doubleClickToPlay;
|
||||
}
|
||||
bool getClickPlaysAllSelected() const
|
||||
[[nodiscard]] bool getClickPlaysAllSelected() const
|
||||
{
|
||||
return clickPlaysAllSelected;
|
||||
}
|
||||
bool getPlayToStack() const
|
||||
[[nodiscard]] bool getPlayToStack() const
|
||||
{
|
||||
return playToStack;
|
||||
}
|
||||
int getStartingHandSize() const
|
||||
[[nodiscard]] bool getDoNotDeleteArrowsInSubPhases() const
|
||||
{
|
||||
return doNotDeleteArrowsInSubPhases;
|
||||
}
|
||||
[[nodiscard]] int getStartingHandSize() const
|
||||
{
|
||||
return startingHandSize;
|
||||
}
|
||||
bool getAnnotateTokens() const
|
||||
[[nodiscard]] bool getAnnotateTokens() const
|
||||
{
|
||||
return annotateTokens;
|
||||
}
|
||||
QByteArray getTabGameSplitterSizes() const
|
||||
[[nodiscard]] QByteArray getTabGameSplitterSizes() const
|
||||
{
|
||||
return tabGameSplitterSizes;
|
||||
}
|
||||
bool getShowShortcuts() const
|
||||
[[nodiscard]] bool getShowShortcuts() const
|
||||
{
|
||||
return showShortcuts;
|
||||
}
|
||||
bool getDisplayCardNames() const
|
||||
[[nodiscard]] bool getDisplayCardNames() const
|
||||
{
|
||||
return displayCardNames;
|
||||
}
|
||||
bool getOverrideAllCardArtWithPersonalPreference() const
|
||||
[[nodiscard]] bool getOverrideAllCardArtWithPersonalPreference() const
|
||||
{
|
||||
return overrideAllCardArtWithPersonalPreference;
|
||||
}
|
||||
bool getBumpSetsWithCardsInDeckToTop() const
|
||||
[[nodiscard]] bool getBumpSetsWithCardsInDeckToTop() const
|
||||
{
|
||||
return bumpSetsWithCardsInDeckToTop;
|
||||
}
|
||||
int getPrintingSelectorSortOrder() const
|
||||
[[nodiscard]] int getPrintingSelectorSortOrder() const
|
||||
{
|
||||
return printingSelectorSortOrder;
|
||||
}
|
||||
int getPrintingSelectorCardSize() const
|
||||
[[nodiscard]] int getPrintingSelectorCardSize() const
|
||||
{
|
||||
return printingSelectorCardSize;
|
||||
}
|
||||
bool getIncludeRebalancedCards() const
|
||||
[[nodiscard]] bool getIncludeRebalancedCards() const
|
||||
{
|
||||
return includeRebalancedCards;
|
||||
}
|
||||
bool getPrintingSelectorNavigationButtonsVisible() const
|
||||
[[nodiscard]] bool getPrintingSelectorNavigationButtonsVisible() const
|
||||
{
|
||||
return printingSelectorNavigationButtonsVisible;
|
||||
}
|
||||
bool getDeckEditorBannerCardComboBoxVisible() const
|
||||
[[nodiscard]] bool getDeckEditorBannerCardComboBoxVisible() const
|
||||
{
|
||||
return deckEditorBannerCardComboBoxVisible;
|
||||
}
|
||||
bool getDeckEditorTagsWidgetVisible() const
|
||||
[[nodiscard]] bool getDeckEditorTagsWidgetVisible() const
|
||||
{
|
||||
return deckEditorTagsWidgetVisible;
|
||||
}
|
||||
int getVisualDeckStorageSortingOrder() const
|
||||
[[nodiscard]] int getVisualDeckStorageSortingOrder() const
|
||||
{
|
||||
return visualDeckStorageSortingOrder;
|
||||
}
|
||||
bool getVisualDeckStorageShowFolders() const
|
||||
[[nodiscard]] bool getVisualDeckStorageShowFolders() const
|
||||
{
|
||||
return visualDeckStorageShowFolders;
|
||||
}
|
||||
bool getVisualDeckStorageShowTagFilter() const
|
||||
[[nodiscard]] bool getVisualDeckStorageShowTagFilter() const
|
||||
{
|
||||
return visualDeckStorageShowTagFilter;
|
||||
}
|
||||
QStringList getVisualDeckStorageDefaultTagsList() const
|
||||
[[nodiscard]] QStringList getVisualDeckStorageDefaultTagsList() const
|
||||
{
|
||||
return visualDeckStorageDefaultTagsList;
|
||||
}
|
||||
bool getVisualDeckStorageSearchFolderNames() const
|
||||
[[nodiscard]] bool getVisualDeckStorageSearchFolderNames() const
|
||||
{
|
||||
return visualDeckStorageSearchFolderNames;
|
||||
}
|
||||
bool getVisualDeckStorageShowBannerCardComboBox() const
|
||||
[[nodiscard]] bool getVisualDeckStorageShowBannerCardComboBox() const
|
||||
{
|
||||
return visualDeckStorageShowBannerCardComboBox;
|
||||
}
|
||||
bool getVisualDeckStorageShowTagsOnDeckPreviews() const
|
||||
[[nodiscard]] bool getVisualDeckStorageShowTagsOnDeckPreviews() const
|
||||
{
|
||||
return visualDeckStorageShowTagsOnDeckPreviews;
|
||||
}
|
||||
int getVisualDeckStorageCardSize() const
|
||||
[[nodiscard]] int getVisualDeckStorageCardSize() const
|
||||
{
|
||||
return visualDeckStorageCardSize;
|
||||
}
|
||||
bool getVisualDeckStorageDrawUnusedColorIdentities() const
|
||||
[[nodiscard]] bool getVisualDeckStorageDrawUnusedColorIdentities() const
|
||||
{
|
||||
return visualDeckStorageDrawUnusedColorIdentities;
|
||||
}
|
||||
int getVisualDeckStorageUnusedColorIdentitiesOpacity() const
|
||||
[[nodiscard]] int getVisualDeckStorageUnusedColorIdentitiesOpacity() const
|
||||
{
|
||||
return visualDeckStorageUnusedColorIdentitiesOpacity;
|
||||
}
|
||||
int getVisualDeckStorageTooltipType() const
|
||||
[[nodiscard]] int getVisualDeckStorageTooltipType() const
|
||||
{
|
||||
return visualDeckStorageTooltipType;
|
||||
}
|
||||
bool getVisualDeckStoragePromptForConversion() const
|
||||
[[nodiscard]] bool getVisualDeckStoragePromptForConversion() const
|
||||
{
|
||||
return visualDeckStoragePromptForConversion;
|
||||
}
|
||||
bool getVisualDeckStorageAlwaysConvert() const
|
||||
[[nodiscard]] bool getVisualDeckStorageAlwaysConvert() const
|
||||
{
|
||||
return visualDeckStorageAlwaysConvert;
|
||||
}
|
||||
bool getVisualDeckStorageInGame() const
|
||||
[[nodiscard]] bool getVisualDeckStorageInGame() const
|
||||
{
|
||||
return visualDeckStorageInGame;
|
||||
}
|
||||
bool getVisualDeckStorageSelectionAnimation() const
|
||||
[[nodiscard]] bool getVisualDeckStorageSelectionAnimation() const
|
||||
{
|
||||
return visualDeckStorageSelectionAnimation;
|
||||
}
|
||||
int getDefaultDeckEditorType() const
|
||||
[[nodiscard]] int getVisualDeckEditorCardSize() const
|
||||
{
|
||||
return visualDeckEditorCardSize;
|
||||
}
|
||||
[[nodiscard]] int getVisualDatabaseDisplayCardSize() const
|
||||
{
|
||||
return visualDatabaseDisplayCardSize;
|
||||
}
|
||||
[[nodiscard]] int getEDHRecCardSize() const
|
||||
{
|
||||
return edhrecCardSize;
|
||||
}
|
||||
[[nodiscard]] int getArchidektPreviewSize() const
|
||||
{
|
||||
return archidektPreviewSize;
|
||||
}
|
||||
[[nodiscard]] int getDefaultDeckEditorType() const
|
||||
{
|
||||
return defaultDeckEditorType;
|
||||
}
|
||||
bool getVisualDatabaseDisplayFilterToMostRecentSetsEnabled() const
|
||||
[[nodiscard]] bool getVisualDatabaseDisplayFilterToMostRecentSetsEnabled() const
|
||||
{
|
||||
return visualDatabaseDisplayFilterToMostRecentSetsEnabled;
|
||||
}
|
||||
int getVisualDatabaseDisplayFilterToMostRecentSetsAmount() const
|
||||
[[nodiscard]] int getVisualDatabaseDisplayFilterToMostRecentSetsAmount() const
|
||||
{
|
||||
return visualDatabaseDisplayFilterToMostRecentSetsAmount;
|
||||
}
|
||||
int getVisualDeckEditorSampleHandSize() const
|
||||
[[nodiscard]] int getVisualDeckEditorSampleHandSize() const
|
||||
{
|
||||
return visualDeckEditorSampleHandSize;
|
||||
}
|
||||
bool getHorizontalHand() const
|
||||
[[nodiscard]] bool getHorizontalHand() const
|
||||
{
|
||||
return horizontalHand;
|
||||
}
|
||||
bool getInvertVerticalCoordinate() const
|
||||
[[nodiscard]] bool getInvertVerticalCoordinate() const
|
||||
{
|
||||
return invertVerticalCoordinate;
|
||||
}
|
||||
int getMinPlayersForMultiColumnLayout() const
|
||||
[[nodiscard]] int getMinPlayersForMultiColumnLayout() const
|
||||
{
|
||||
return minPlayersForMultiColumnLayout;
|
||||
}
|
||||
bool getTapAnimation() const
|
||||
[[nodiscard]] bool getTapAnimation() const
|
||||
{
|
||||
return tapAnimation;
|
||||
}
|
||||
bool getAutoRotateSidewaysLayoutCards() const
|
||||
[[nodiscard]] bool getAutoRotateSidewaysLayoutCards() const
|
||||
{
|
||||
return autoRotateSidewaysLayoutCards;
|
||||
}
|
||||
bool getOpenDeckInNewTab() const
|
||||
[[nodiscard]] bool getOpenDeckInNewTab() const
|
||||
{
|
||||
return openDeckInNewTab;
|
||||
}
|
||||
int getRewindBufferingMs() const
|
||||
[[nodiscard]] int getRewindBufferingMs() const
|
||||
{
|
||||
return rewindBufferingMs;
|
||||
}
|
||||
bool getChatMention() const
|
||||
[[nodiscard]] bool getChatMention() const
|
||||
{
|
||||
return chatMention;
|
||||
}
|
||||
bool getChatMentionCompleter() const
|
||||
[[nodiscard]] bool getChatMentionCompleter() const
|
||||
{
|
||||
return chatMentionCompleter;
|
||||
}
|
||||
bool getChatMentionForeground() const
|
||||
[[nodiscard]] bool getChatMentionForeground() const
|
||||
{
|
||||
return chatMentionForeground;
|
||||
}
|
||||
bool getChatHighlightForeground() const
|
||||
[[nodiscard]] bool getChatHighlightForeground() const
|
||||
{
|
||||
return chatHighlightForeground;
|
||||
}
|
||||
/**
|
||||
* Currently selected index for the `Group by X` QComboBox
|
||||
*/
|
||||
int getZoneViewGroupByIndex() const
|
||||
[[nodiscard]] int getZoneViewGroupByIndex() const
|
||||
{
|
||||
return zoneViewGroupByIndex;
|
||||
}
|
||||
/**
|
||||
* Currently selected index for the `Sort by X` QComboBox
|
||||
*/
|
||||
int getZoneViewSortByIndex() const
|
||||
[[nodiscard]] int getZoneViewSortByIndex() const
|
||||
{
|
||||
return zoneViewSortByIndex;
|
||||
}
|
||||
@@ -715,136 +743,136 @@ public:
|
||||
Returns 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;
|
||||
}
|
||||
bool getSoundEnabled() const
|
||||
[[nodiscard]] bool getSoundEnabled() const
|
||||
{
|
||||
return soundEnabled;
|
||||
}
|
||||
QString getSoundThemeName() const
|
||||
[[nodiscard]] QString getSoundThemeName() const
|
||||
{
|
||||
return soundThemeName;
|
||||
}
|
||||
bool getIgnoreUnregisteredUsers() const
|
||||
[[nodiscard]] bool getIgnoreUnregisteredUsers() const
|
||||
{
|
||||
return ignoreUnregisteredUsers;
|
||||
}
|
||||
bool getIgnoreUnregisteredUserMessages() const
|
||||
[[nodiscard]] bool getIgnoreUnregisteredUserMessages() const
|
||||
{
|
||||
return ignoreUnregisteredUserMessages;
|
||||
}
|
||||
int getPixmapCacheSize() const
|
||||
[[nodiscard]] int getPixmapCacheSize() const
|
||||
{
|
||||
return pixmapCacheSize;
|
||||
}
|
||||
int getNetworkCacheSizeInMB() const
|
||||
[[nodiscard]] int getNetworkCacheSizeInMB() const
|
||||
{
|
||||
return networkCacheSize;
|
||||
}
|
||||
int getRedirectCacheTtl() const
|
||||
[[nodiscard]] int getRedirectCacheTtl() const
|
||||
{
|
||||
return redirectCacheTtl;
|
||||
}
|
||||
bool getScaleCards() const
|
||||
[[nodiscard]] bool getScaleCards() const
|
||||
{
|
||||
return scaleCards;
|
||||
}
|
||||
int getStackCardOverlapPercent() const
|
||||
[[nodiscard]] int getStackCardOverlapPercent() const
|
||||
{
|
||||
return verticalCardOverlapPercent;
|
||||
}
|
||||
bool getShowMessagePopup() const
|
||||
[[nodiscard]] bool getShowMessagePopup() const
|
||||
{
|
||||
return showMessagePopups;
|
||||
}
|
||||
bool getShowMentionPopup() const
|
||||
[[nodiscard]] bool getShowMentionPopup() const
|
||||
{
|
||||
return showMentionPopups;
|
||||
}
|
||||
bool getRoomHistory() const
|
||||
[[nodiscard]] bool getRoomHistory() const
|
||||
{
|
||||
return roomHistory;
|
||||
}
|
||||
bool getLeftJustified() const
|
||||
[[nodiscard]] bool getLeftJustified() const
|
||||
{
|
||||
return leftJustified;
|
||||
}
|
||||
int getMasterVolume() const
|
||||
[[nodiscard]] int getMasterVolume() const
|
||||
{
|
||||
return masterVolume;
|
||||
}
|
||||
int getCardInfoViewMode() const
|
||||
[[nodiscard]] int getCardInfoViewMode() const
|
||||
{
|
||||
return cardInfoViewMode;
|
||||
}
|
||||
QStringList getCountries() const;
|
||||
QString getHighlightWords() const
|
||||
[[nodiscard]] QStringList getCountries() const;
|
||||
[[nodiscard]] QString getHighlightWords() const
|
||||
{
|
||||
return highlightWords;
|
||||
}
|
||||
QString getGameDescription() const
|
||||
[[nodiscard]] QString getGameDescription() const
|
||||
{
|
||||
return gameDescription;
|
||||
}
|
||||
int getMaxPlayers() const
|
||||
[[nodiscard]] int getMaxPlayers() const
|
||||
{
|
||||
return maxPlayers;
|
||||
}
|
||||
QString getGameTypes() const
|
||||
[[nodiscard]] QString getGameTypes() const
|
||||
{
|
||||
return gameTypes;
|
||||
}
|
||||
bool getOnlyBuddies() const
|
||||
[[nodiscard]] bool getOnlyBuddies() const
|
||||
{
|
||||
return onlyBuddies;
|
||||
}
|
||||
bool getOnlyRegistered() const
|
||||
[[nodiscard]] bool getOnlyRegistered() const
|
||||
{
|
||||
return onlyRegistered;
|
||||
}
|
||||
bool getSpectatorsAllowed() const
|
||||
[[nodiscard]] bool getSpectatorsAllowed() const
|
||||
{
|
||||
return spectatorsAllowed;
|
||||
}
|
||||
bool getSpectatorsNeedPassword() const
|
||||
[[nodiscard]] bool getSpectatorsNeedPassword() const
|
||||
{
|
||||
return spectatorsNeedPassword;
|
||||
}
|
||||
bool getSpectatorsCanTalk() const
|
||||
[[nodiscard]] bool getSpectatorsCanTalk() const
|
||||
{
|
||||
return spectatorsCanTalk;
|
||||
}
|
||||
bool getSpectatorsCanSeeEverything() const
|
||||
[[nodiscard]] bool getSpectatorsCanSeeEverything() const
|
||||
{
|
||||
return spectatorsCanSeeEverything;
|
||||
}
|
||||
int getDefaultStartingLifeTotal() const
|
||||
[[nodiscard]] int getDefaultStartingLifeTotal() const
|
||||
{
|
||||
return defaultStartingLifeTotal;
|
||||
}
|
||||
bool getShareDecklistsOnLoad() const
|
||||
[[nodiscard]] bool getShareDecklistsOnLoad() const
|
||||
{
|
||||
return shareDecklistsOnLoad;
|
||||
}
|
||||
bool getCreateGameAsSpectator() const
|
||||
[[nodiscard]] bool getCreateGameAsSpectator() const
|
||||
{
|
||||
return createGameAsSpectator;
|
||||
}
|
||||
bool getRememberGameSettings() const
|
||||
[[nodiscard]] bool getRememberGameSettings() const
|
||||
{
|
||||
return rememberGameSettings;
|
||||
}
|
||||
int getKeepAlive() const override
|
||||
[[nodiscard]] int getKeepAlive() const override
|
||||
{
|
||||
return keepalive;
|
||||
}
|
||||
int getTimeOut() const override
|
||||
[[nodiscard]] int getTimeOut() const override
|
||||
{
|
||||
return timeout;
|
||||
}
|
||||
int getMaxFontSize() const
|
||||
[[nodiscard]] int getMaxFontSize() const
|
||||
{
|
||||
return maxFontSize;
|
||||
}
|
||||
@@ -872,73 +900,73 @@ public:
|
||||
{
|
||||
return useTearOffMenus;
|
||||
}
|
||||
int getCardViewInitialRowsMax() const
|
||||
[[nodiscard]] int getCardViewInitialRowsMax() const
|
||||
{
|
||||
return cardViewInitialRowsMax;
|
||||
}
|
||||
int getCardViewExpandedRowsMax() const
|
||||
[[nodiscard]] int getCardViewExpandedRowsMax() const
|
||||
{
|
||||
return cardViewExpandedRowsMax;
|
||||
}
|
||||
bool getCloseEmptyCardView() const
|
||||
[[nodiscard]] bool getCloseEmptyCardView() const
|
||||
{
|
||||
return closeEmptyCardView;
|
||||
}
|
||||
bool getFocusCardViewSearchBar() const
|
||||
[[nodiscard]] bool getFocusCardViewSearchBar() const
|
||||
{
|
||||
return focusCardViewSearchBar;
|
||||
}
|
||||
ShortcutsSettings &shortcuts() const
|
||||
[[nodiscard]] ShortcutsSettings &shortcuts() const
|
||||
{
|
||||
return *shortcutsSettings;
|
||||
}
|
||||
CardDatabaseSettings *cardDatabase() const
|
||||
[[nodiscard]] CardDatabaseSettings *cardDatabase() const
|
||||
{
|
||||
return cardDatabaseSettings;
|
||||
}
|
||||
ServersSettings &servers() const
|
||||
[[nodiscard]] ServersSettings &servers() const
|
||||
{
|
||||
return *serversSettings;
|
||||
}
|
||||
MessageSettings &messages() const
|
||||
[[nodiscard]] MessageSettings &messages() const
|
||||
{
|
||||
return *messageSettings;
|
||||
}
|
||||
GameFiltersSettings &gameFilters() const
|
||||
[[nodiscard]] GameFiltersSettings &gameFilters() const
|
||||
{
|
||||
return *gameFiltersSettings;
|
||||
}
|
||||
LayoutsSettings &layouts() const
|
||||
[[nodiscard]] LayoutsSettings &layouts() const
|
||||
{
|
||||
return *layoutsSettings;
|
||||
}
|
||||
DownloadSettings &downloads() const
|
||||
[[nodiscard]] DownloadSettings &downloads() const
|
||||
{
|
||||
return *downloadSettings;
|
||||
}
|
||||
RecentsSettings &recents() const
|
||||
[[nodiscard]] RecentsSettings &recents() const
|
||||
{
|
||||
return *recentsSettings;
|
||||
}
|
||||
CardOverrideSettings &cardOverrides() const
|
||||
[[nodiscard]] CardOverrideSettings &cardOverrides() const
|
||||
{
|
||||
return *cardOverrideSettings;
|
||||
}
|
||||
DebugSettings &debug() const
|
||||
[[nodiscard]] DebugSettings &debug() const
|
||||
{
|
||||
return *debugSettings;
|
||||
}
|
||||
CardCounterSettings &cardCounters() const;
|
||||
[[nodiscard]] CardCounterSettings &cardCounters() const;
|
||||
|
||||
bool getIsPortableBuild() const
|
||||
[[nodiscard]] bool getIsPortableBuild() const
|
||||
{
|
||||
return isPortableBuild;
|
||||
}
|
||||
bool getDownloadSpoilersStatus() const
|
||||
[[nodiscard]] bool getDownloadSpoilersStatus() const
|
||||
{
|
||||
return mbDownloadSpoilers;
|
||||
}
|
||||
bool getRoundCardCorners() const
|
||||
[[nodiscard]] bool getRoundCardCorners() const
|
||||
{
|
||||
return roundCardCorners;
|
||||
}
|
||||
@@ -984,6 +1012,7 @@ public slots:
|
||||
void setDoubleClickToPlay(QT_STATE_CHANGED_T _doubleClickToPlay);
|
||||
void setClickPlaysAllSelected(QT_STATE_CHANGED_T _clickPlaysAllSelected);
|
||||
void setPlayToStack(QT_STATE_CHANGED_T _playToStack);
|
||||
void setDoNotDeleteArrowsInSubPhases(QT_STATE_CHANGED_T _doNotDeleteArrowsInSubPhases);
|
||||
void setStartingHandSize(int _startingHandSize);
|
||||
void setAnnotateTokens(QT_STATE_CHANGED_T _annotateTokens);
|
||||
void setTabGameSplitterSizes(const QByteArray &_tabGameSplitterSizes);
|
||||
@@ -1012,6 +1041,10 @@ public slots:
|
||||
void setVisualDeckStorageAlwaysConvert(bool _visualDeckStorageAlwaysConvert);
|
||||
void setVisualDeckStorageInGame(QT_STATE_CHANGED_T value);
|
||||
void setVisualDeckStorageSelectionAnimation(QT_STATE_CHANGED_T value);
|
||||
void setVisualDeckEditorCardSize(int _visualDeckEditorCardSize);
|
||||
void setVisualDatabaseDisplayCardSize(int _visualDatabaseDisplayCardSize);
|
||||
void setEDHRecCardSize(int _EDHRecCardSize);
|
||||
void setArchidektPreviewCardSize(int _archidektPreviewCardSize);
|
||||
void setDefaultDeckEditorType(int value);
|
||||
void setVisualDatabaseDisplayFilterToMostRecentSetsEnabled(QT_STATE_CHANGED_T _enabled);
|
||||
void setVisualDatabaseDisplayFilterToMostRecentSetsAmount(int _amount);
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#ifndef CARD_COUNTER_SETTINGS_H
|
||||
#define CARD_COUNTER_SETTINGS_H
|
||||
|
||||
#include <QObject>
|
||||
#include <libcockatrice/settings/settings_manager.h>
|
||||
|
||||
class QSettings;
|
||||
@@ -20,9 +19,9 @@ class CardCounterSettings : public SettingsManager
|
||||
public:
|
||||
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:
|
||||
void setColor(int counterId, const QColor &color);
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#ifndef SHORTCUT_TREEVIEW_H
|
||||
#define SHORTCUT_TREEVIEW_H
|
||||
|
||||
#include <QModelIndex>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QStandardItemModel>
|
||||
#include <QTreeView>
|
||||
@@ -22,7 +21,7 @@ public:
|
||||
explicit ShortcutFilterProxyModel(QObject *parent = nullptr);
|
||||
|
||||
protected:
|
||||
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
|
||||
[[nodiscard]] bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
|
||||
};
|
||||
|
||||
class ShortcutTreeView : public QTreeView
|
||||
|
||||
@@ -99,15 +99,15 @@ public:
|
||||
void setSequence(const QList &_sequence)
|
||||
{
|
||||
QList::operator=(_sequence);
|
||||
};
|
||||
QString getName() const
|
||||
}
|
||||
[[nodiscard]] QString getName() const
|
||||
{
|
||||
return QApplication::translate("shortcutsTab", name.toUtf8().data());
|
||||
};
|
||||
QString getGroupName() const
|
||||
}
|
||||
[[nodiscard]] QString getGroupName() const
|
||||
{
|
||||
return ShortcutGroup::getGroupName(group);
|
||||
};
|
||||
}
|
||||
|
||||
private:
|
||||
QString name;
|
||||
@@ -120,24 +120,24 @@ class ShortcutsSettings : public QObject
|
||||
public:
|
||||
explicit ShortcutsSettings(const QString &settingsFilePath, QObject *parent = nullptr);
|
||||
|
||||
ShortcutKey getDefaultShortcut(const QString &name) const;
|
||||
ShortcutKey getShortcut(const QString &name) const;
|
||||
QKeySequence getSingleShortcut(const QString &name) const;
|
||||
QString getDefaultShortcutString(const QString &name) const;
|
||||
QString getShortcutString(const QString &name) const;
|
||||
QString getShortcutFriendlyName(const QString &shortcutName) const;
|
||||
QList<QString> getAllShortcutKeys() const
|
||||
[[nodiscard]] ShortcutKey getDefaultShortcut(const QString &name) const;
|
||||
[[nodiscard]] ShortcutKey getShortcut(const QString &name) const;
|
||||
[[nodiscard]] QKeySequence getSingleShortcut(const QString &name) const;
|
||||
[[nodiscard]] QString getDefaultShortcutString(const QString &name) const;
|
||||
[[nodiscard]] QString getShortcutString(const QString &name) const;
|
||||
[[nodiscard]] QString getShortcutFriendlyName(const QString &shortcutName) const;
|
||||
[[nodiscard]] QList<QString> getAllShortcutKeys() const
|
||||
{
|
||||
return shortCuts.keys();
|
||||
};
|
||||
}
|
||||
|
||||
void setShortcuts(const QString &name, const QList<QKeySequence> &Sequence);
|
||||
void setShortcuts(const QString &name, const QKeySequence &Sequence);
|
||||
void setShortcuts(const QString &name, const QString &sequences);
|
||||
|
||||
bool isKeyAllowed(const QString &name, const QString &sequences) const;
|
||||
bool isValid(const QString &name, const QString &sequences) const;
|
||||
QStringList findOverlaps(const QString &name, const QString &sequences) const;
|
||||
[[nodiscard]] bool isKeyAllowed(const QString &name, const QString &sequences) const;
|
||||
[[nodiscard]] bool isValid(const QString &name, const QString &sequences) const;
|
||||
[[nodiscard]] QStringList findOverlaps(const QString &name, const QString &sequences) const;
|
||||
|
||||
void resetAllShortcuts();
|
||||
void clearAllShortcuts();
|
||||
@@ -152,8 +152,8 @@ private:
|
||||
QString settingsFilePath;
|
||||
QHash<QString, ShortcutKey> shortCuts;
|
||||
|
||||
QString stringifySequence(const QList<QKeySequence> &Sequence) const;
|
||||
QList<QKeySequence> parseSequenceString(const QString &stringSequence) const;
|
||||
[[nodiscard]] QString stringifySequence(const QList<QKeySequence> &Sequence) const;
|
||||
[[nodiscard]] QList<QKeySequence> parseSequenceString(const QString &stringSequence) const;
|
||||
|
||||
const QHash<QString, ShortcutKey> defaultShortCuts = {
|
||||
{"MainWindow/aCheckCardUpdates", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Check for Card Updates..."),
|
||||
|
||||
@@ -7,15 +7,15 @@
|
||||
class SettingsCardPreferenceProvider : public ICardPreferenceProvider
|
||||
{
|
||||
public:
|
||||
QString getCardPreferenceOverride(const QString &cardName) const override
|
||||
[[nodiscard]] QString getCardPreferenceOverride(const QString &cardName) const override
|
||||
{
|
||||
return SettingsCache::instance().cardOverrides().getCardPreferenceOverride(cardName);
|
||||
}
|
||||
|
||||
bool getIncludeRebalancedCards() const override
|
||||
[[nodiscard]] bool getIncludeRebalancedCards() const override
|
||||
{
|
||||
return SettingsCache::instance().getIncludeRebalancedCards();
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
#endif // COCKATRICE_SETTINGS_CARD_PREFERENCE_PROVIDER_H
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "deck_filter_string.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <libcockatrice/card/database/card_database_manager.h>
|
||||
#include <libcockatrice/filters/filter_string.h>
|
||||
#include <libcockatrice/utility/peglib.h>
|
||||
@@ -12,7 +13,7 @@ QueryPartList <- ComplexQueryPart ( ws ("AND" ws)? ComplexQueryPart)* ws*
|
||||
ComplexQueryPart <- SomewhatComplexQueryPart ws "OR" ws ComplexQueryPart / SomewhatComplexQueryPart
|
||||
SomewhatComplexQueryPart <- [(] QueryPartList [)] / QueryPart
|
||||
|
||||
QueryPart <- NotQuery / DeckContentQuery / DeckNameQuery / FileNameQuery / PathQuery / GenericQuery
|
||||
QueryPart <- NotQuery / DeckContentQuery / DeckNameQuery / FileNameQuery / PathQuery / FormatQuery / GenericQuery
|
||||
|
||||
NotQuery <- ('NOT' ws/'-') SomewhatComplexQueryPart
|
||||
|
||||
@@ -21,8 +22,9 @@ CardSearch <- '[[' CardFilterString ']]'
|
||||
CardFilterString <- (!']]'.)*
|
||||
|
||||
DeckNameQuery <- ([Dd] 'eck')? [Nn] 'ame'? [:] String
|
||||
FileNameQuery <- [Ff] ('ile' 'name'?)? [:] String
|
||||
FileNameQuery <- [Ff] ([Nn] / 'ile' ([Nn] 'ame')?) [:] String
|
||||
PathQuery <- [Pp] 'ath'? [:] String
|
||||
FormatQuery <- [Ff] 'ormat'? [:] String
|
||||
|
||||
GenericQuery <- String
|
||||
|
||||
@@ -117,12 +119,13 @@ static void setupParserRules()
|
||||
|
||||
return [=](const DeckPreviewWidget *deck, const ExtraDeckSearchInfo &) -> bool {
|
||||
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());
|
||||
if (!cardInfoPtr.isNull() && cardFilter.check(cardInfoPtr)) {
|
||||
count += node->getNumber();
|
||||
}
|
||||
});
|
||||
}
|
||||
return numberMatcher(count);
|
||||
};
|
||||
};
|
||||
@@ -136,7 +139,7 @@ static void setupParserRules()
|
||||
search["DeckNameQuery"] = [](const peg::SemanticValues &sv) -> DeckFilter {
|
||||
auto name = std::any_cast<QString>(sv[0]);
|
||||
return [=](const DeckPreviewWidget *deck, const ExtraDeckSearchInfo &) {
|
||||
return deck->deckLoader->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 {
|
||||
auto name = std::any_cast<QString>(sv[0]);
|
||||
return [=](const DeckPreviewWidget *deck, const ExtraDeckSearchInfo &) {
|
||||
|
||||
@@ -10,10 +10,8 @@
|
||||
#include "../interface/widgets/visual_deck_storage/deck_preview/deck_preview_widget.h"
|
||||
|
||||
#include <QLoggingCategory>
|
||||
#include <QMap>
|
||||
#include <QString>
|
||||
#include <functional>
|
||||
#include <utility>
|
||||
|
||||
inline Q_LOGGING_CATEGORY(DeckFilterStringLog, "deck_filter_string");
|
||||
|
||||
@@ -40,7 +38,7 @@ public:
|
||||
return filter(deck, info);
|
||||
}
|
||||
|
||||
bool valid() const
|
||||
[[nodiscard]] bool valid() const
|
||||
{
|
||||
return _error.isEmpty();
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@ public slots:
|
||||
void addFilter(const CardFilter *f);
|
||||
void removeFilter(const CardFilter *f);
|
||||
void clearFiltersOfType(CardFilter::Attr filterType);
|
||||
QList<const CardFilter *> getFiltersOfType(CardFilter::Attr filterType) const;
|
||||
QList<const CardFilter *> allFilters() const;
|
||||
[[nodiscard]] QList<const CardFilter *> getFiltersOfType(CardFilter::Attr filterType) const;
|
||||
[[nodiscard]] QList<const CardFilter *> allFilters() const;
|
||||
|
||||
private slots:
|
||||
void proxyBeginInsertRow(const FilterTreeNode *, int);
|
||||
@@ -34,23 +34,23 @@ private slots:
|
||||
void proxyEndRemoveRow(const FilterTreeNode *, int);
|
||||
|
||||
private:
|
||||
FilterTreeNode *indexToNode(const QModelIndex &idx) const;
|
||||
[[nodiscard]] FilterTreeNode *indexToNode(const QModelIndex &idx) const;
|
||||
QModelIndex nodeIndex(const FilterTreeNode *node, int row, int column) const;
|
||||
|
||||
public:
|
||||
FilterTreeModel(QObject *parent = nullptr);
|
||||
~FilterTreeModel() override;
|
||||
FilterTree *filterTree() const
|
||||
[[nodiscard]] FilterTree *filterTree() const
|
||||
{
|
||||
return fTree;
|
||||
}
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex & /*parent*/ = QModelIndex()) const override;
|
||||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
[[nodiscard]] int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
[[nodiscard]] int columnCount(const QModelIndex & /*parent*/ = QModelIndex()) 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;
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||
QModelIndex parent(const QModelIndex &ind) const override;
|
||||
QModelIndex index(int row, int column, const QModelIndex &parent) const override;
|
||||
[[nodiscard]] Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||
[[nodiscard]] QModelIndex parent(const QModelIndex &ind) const override;
|
||||
[[nodiscard]] QModelIndex index(int row, int column, const QModelIndex &parent) const override;
|
||||
bool removeRows(int row, int count, const QModelIndex &parent) override;
|
||||
void clear();
|
||||
};
|
||||
|
||||
@@ -3,15 +3,14 @@
|
||||
#include "../../client/settings/cache_settings.h"
|
||||
#include "../../interface/widgets/tabs/tab_game.h"
|
||||
#include "../player/player.h"
|
||||
#include "../player/player_actions.h"
|
||||
#include "translate_counter_name.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QApplication>
|
||||
#include <QGraphicsSceneHoverEvent>
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
#include <QKeyEvent>
|
||||
#include <QMenu>
|
||||
#include <QPainter>
|
||||
#include <QString>
|
||||
#include <libcockatrice/protocol/pb/command_inc_counter.pb.h>
|
||||
#include <libcockatrice/protocol/pb/command_set_counter.pb.h>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "../../client/settings/cache_settings.h"
|
||||
#include "../player/player.h"
|
||||
#include "../player/player_actions.h"
|
||||
#include "../player/player_target.h"
|
||||
#include "../zones/card_zone.h"
|
||||
#include "card_item.h"
|
||||
@@ -151,8 +152,8 @@ void ArrowItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
ArrowDragItem::ArrowDragItem(Player *_owner, ArrowTarget *_startItem, const QColor &_color)
|
||||
: ArrowItem(_owner, -1, _startItem, 0, _color)
|
||||
ArrowDragItem::ArrowDragItem(Player *_owner, ArrowTarget *_startItem, const QColor &_color, int _deleteInPhase)
|
||||
: ArrowItem(_owner, -1, _startItem, 0, _color), deleteInPhase(_deleteInPhase)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -231,20 +232,28 @@ void ArrowDragItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
cmd.set_target_player_id(targetZone->getPlayer()->getPlayerInfo()->getId());
|
||||
cmd.set_target_zone(targetZone->getName().toStdString());
|
||||
cmd.set_target_card_id(targetCard->getId());
|
||||
} else {
|
||||
} else { // failed to cast target to card, this means it's a player
|
||||
PlayerTarget *targetPlayer = qgraphicsitem_cast<PlayerTarget *>(targetItem);
|
||||
cmd.set_target_player_id(targetPlayer->getOwner()->getPlayerInfo()->getId());
|
||||
}
|
||||
if (startZone->getName().compare("hand") == 0) {
|
||||
|
||||
// if the card is in hand then we will move the card to stack or table as part of drawing the arrow
|
||||
if (startZone->getName() == "hand") {
|
||||
startCard->playCard(false);
|
||||
CardInfoPtr ci = startCard->getCard().getCardPtr();
|
||||
if (ci && ((!SettingsCache::instance().getPlayToStack() && ci->getUiAttributes().tableRow == 3) ||
|
||||
(SettingsCache::instance().getPlayToStack() && ci->getUiAttributes().tableRow != 0 &&
|
||||
startCard->getZone()->getName().toStdString() != "stack")))
|
||||
bool playToStack = SettingsCache::instance().getPlayToStack();
|
||||
if (ci &&
|
||||
((!playToStack && ci->getUiAttributes().tableRow == 3) ||
|
||||
(playToStack && ci->getUiAttributes().tableRow != 0 && startCard->getZone()->getName() != "stack")))
|
||||
cmd.set_start_zone("stack");
|
||||
else
|
||||
cmd.set_start_zone(SettingsCache::instance().getPlayToStack() ? "stack" : "table");
|
||||
cmd.set_start_zone(playToStack ? "stack" : "table");
|
||||
}
|
||||
|
||||
if (deleteInPhase != 0) {
|
||||
cmd.set_delete_in_phase(deleteInPhase);
|
||||
}
|
||||
|
||||
player->getPlayerActions()->sendGameCommand(cmd);
|
||||
}
|
||||
delArrow();
|
||||
|
||||
@@ -82,10 +82,11 @@ class ArrowDragItem : public ArrowItem
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
int deleteInPhase;
|
||||
QList<ArrowDragItem *> childArrows;
|
||||
|
||||
public:
|
||||
ArrowDragItem(Player *_owner, ArrowTarget *_startItem, const QColor &_color);
|
||||
ArrowDragItem(Player *_owner, ArrowTarget *_startItem, const QColor &_color, int _deleteInPhase);
|
||||
void addChildArrow(ArrowDragItem *childArrow);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
#include "../../client/settings/cache_settings.h"
|
||||
#include "../../interface/widgets/tabs/tab_game.h"
|
||||
#include "../game_scene.h"
|
||||
#include "../phase.h"
|
||||
#include "../player/player.h"
|
||||
#include "../zones/card_zone.h"
|
||||
#include "../player/player_actions.h"
|
||||
#include "../zones/logic/view_zone_logic.h"
|
||||
#include "../zones/table_zone.h"
|
||||
#include "../zones/view_zone.h"
|
||||
@@ -275,9 +276,14 @@ void CardItem::drawArrow(const QColor &arrowColor)
|
||||
if (owner->getGame()->getPlayerManager()->isSpectator())
|
||||
return;
|
||||
|
||||
Player *arrowOwner =
|
||||
owner->getGame()->getPlayerManager()->getActiveLocalPlayer(owner->getGame()->getGameState()->getActivePlayer());
|
||||
ArrowDragItem *arrow = new ArrowDragItem(arrowOwner, this, arrowColor);
|
||||
auto *game = owner->getGame();
|
||||
Player *arrowOwner = game->getPlayerManager()->getActiveLocalPlayer(game->getGameState()->getActivePlayer());
|
||||
int phase = 0; // 0 means to not set the phase
|
||||
if (SettingsCache::instance().getDoNotDeleteArrowsInSubPhases()) {
|
||||
int currentPhase = game->getGameState()->getCurrentPhase();
|
||||
phase = Phases::getLastSubphase(currentPhase) + 1;
|
||||
}
|
||||
ArrowDragItem *arrow = new ArrowDragItem(arrowOwner, this, arrowColor, phase);
|
||||
scene()->addItem(arrow);
|
||||
arrow->grabMouse();
|
||||
|
||||
@@ -288,7 +294,7 @@ void CardItem::drawArrow(const QColor &arrowColor)
|
||||
if (card->getZone() != zone)
|
||||
continue;
|
||||
|
||||
ArrowDragItem *childArrow = new ArrowDragItem(arrowOwner, card, arrowColor);
|
||||
ArrowDragItem *childArrow = new ArrowDragItem(arrowOwner, card, arrowColor, phase);
|
||||
scene()->addItem(childArrow);
|
||||
arrow->addChildArrow(childArrow);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <algorithm>
|
||||
#include <libcockatrice/card/card_info.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,
|
||||
const QPointF &_hotSpot,
|
||||
@@ -343,10 +343,7 @@ void DeckViewScene::rebuildTree()
|
||||
if (!deck)
|
||||
return;
|
||||
|
||||
InnerDecklistNode *listRoot = deck->getRoot();
|
||||
for (int i = 0; i < listRoot->size(); i++) {
|
||||
auto *currentZone = dynamic_cast<InnerDecklistNode *>(listRoot->at(i));
|
||||
|
||||
for (auto *currentZone : deck->getZoneNodes()) {
|
||||
DeckViewCardContainer *container = cardContainers.value(currentZone->getName(), 0);
|
||||
if (!container) {
|
||||
container = new DeckViewCardContainer(currentZone->getName());
|
||||
|
||||
@@ -9,11 +9,8 @@
|
||||
|
||||
#include "../board/abstract_card_drag_item.h"
|
||||
|
||||
#include <QGraphicsScene>
|
||||
#include <QGraphicsView>
|
||||
#include <QMap>
|
||||
#include <QMultiMap>
|
||||
#include <QPixmap>
|
||||
#include <libcockatrice/protocol/pb/move_card_to_zone.pb.h>
|
||||
|
||||
class DeckList;
|
||||
|
||||
@@ -8,13 +8,9 @@
|
||||
#include "../../interface/widgets/dialogs/dlg_load_deck_from_website.h"
|
||||
#include "../../interface/widgets/dialogs/dlg_load_remote_deck.h"
|
||||
#include "../../interface/widgets/tabs/tab_game.h"
|
||||
#include "../game_scene.h"
|
||||
#include "deck_view.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QMouseEvent>
|
||||
#include <QToolButton>
|
||||
#include <google/protobuf/descriptor.h>
|
||||
#include <libcockatrice/card/database/card_database.h>
|
||||
#include <libcockatrice/card/database/card_database_manager.h>
|
||||
#include <libcockatrice/protocol/pb/command_deck_select.pb.h>
|
||||
@@ -263,7 +259,7 @@ void DeckViewContainer::loadLocalDeck()
|
||||
|
||||
void DeckViewContainer::loadDeckFromFile(const QString &filePath)
|
||||
{
|
||||
DeckLoader::FileFormat fmt = DeckLoader::getFormatFromName(filePath);
|
||||
DeckFileFormat::Format fmt = DeckFileFormat::getFormatFromName(filePath);
|
||||
DeckLoader deck(this);
|
||||
|
||||
bool success = deck.loadFromFile(filePath, fmt, true);
|
||||
@@ -273,12 +269,12 @@ void DeckViewContainer::loadDeckFromFile(const QString &filePath)
|
||||
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) {
|
||||
QMessageBox::critical(this, tr("Error"), tr("Deck is greater than maximum file size."));
|
||||
@@ -312,8 +308,8 @@ void DeckViewContainer::loadFromClipboard()
|
||||
return;
|
||||
}
|
||||
|
||||
DeckLoader *deck = dlg.getDeckList();
|
||||
loadDeckFromDeckLoader(deck);
|
||||
DeckList deck = dlg.getDeckList();
|
||||
loadDeckFromDeckList(deck);
|
||||
}
|
||||
|
||||
void DeckViewContainer::loadFromWebsite()
|
||||
@@ -324,16 +320,15 @@ void DeckViewContainer::loadFromWebsite()
|
||||
return;
|
||||
}
|
||||
|
||||
DeckLoader *deck = dlg.getDeck();
|
||||
loadDeckFromDeckLoader(deck);
|
||||
DeckList deck = dlg.getDeck();
|
||||
loadDeckFromDeckList(deck);
|
||||
}
|
||||
|
||||
void DeckViewContainer::deckSelectFinished(const Response &r)
|
||||
{
|
||||
const Response_DeckDownload &resp = r.GetExtension(Response_DeckDownload::ext);
|
||||
DeckLoader newDeck(this, new DeckList(QString::fromStdString(resp.deck())));
|
||||
CardPictureLoader::cacheCardPixmaps(
|
||||
CardDatabaseManager::query()->getCards(newDeck.getDeckList()->getCardRefList()));
|
||||
DeckList newDeck = DeckList(QString::fromStdString(resp.deck()));
|
||||
CardPictureLoader::cacheCardPixmaps(CardDatabaseManager::query()->getCards(newDeck.getCardRefList()));
|
||||
setDeck(newDeck);
|
||||
switchToDeckLoadedView();
|
||||
}
|
||||
@@ -414,8 +409,8 @@ void DeckViewContainer::setSideboardLocked(bool locked)
|
||||
deckView->resetSideboardPlan();
|
||||
}
|
||||
|
||||
void DeckViewContainer::setDeck(DeckLoader &deck)
|
||||
void DeckViewContainer::setDeck(const DeckList &deck)
|
||||
{
|
||||
deckView->setDeck(*deck.getDeckList());
|
||||
deckView->setDeck(deck);
|
||||
switchToDeckLoadedView();
|
||||
}
|
||||
@@ -85,12 +85,12 @@ public:
|
||||
void setReadyStart(bool ready);
|
||||
void readyAndUpdate();
|
||||
void setSideboardLocked(bool locked);
|
||||
void setDeck(DeckLoader &deck);
|
||||
void setDeck(const DeckList &deck);
|
||||
void setVisualDeckStorageExists(bool exists);
|
||||
|
||||
public slots:
|
||||
void loadDeckFromFile(const QString &filePath);
|
||||
void loadDeckFromDeckLoader(DeckLoader *deck);
|
||||
void loadDeckFromDeckList(const DeckList &deck);
|
||||
};
|
||||
|
||||
#endif // DECK_VIEW_CONTAINER_H
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include <QLineEdit>
|
||||
#include <QRadioButton>
|
||||
#include <QTreeView>
|
||||
#include <QVBoxLayout>
|
||||
#include <libcockatrice/card/database/card_database_manager.h>
|
||||
#include <libcockatrice/deck_list/deck_list.h>
|
||||
#include <libcockatrice/models/database/card_database_model.h>
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#define DLG_CREATETOKEN_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QModelIndex>
|
||||
|
||||
class QLabel;
|
||||
class QLineEdit;
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include <libcockatrice/protocol/pb/command_set_active_phase.pb.h>
|
||||
#include <libcockatrice/protocol/pb/context_connection_state_changed.pb.h>
|
||||
#include <libcockatrice/protocol/pb/context_deck_select.pb.h>
|
||||
#include <libcockatrice/protocol/pb/context_ping_changed.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_say.pb.h>
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include "zones/view_zone.h"
|
||||
#include "zones/view_zone_widget.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QBasicTimer>
|
||||
#include <QDebug>
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
|
||||
@@ -7,10 +7,8 @@
|
||||
#ifndef COCKATRICE_GAME_STATE_H
|
||||
#define COCKATRICE_GAME_STATE_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QTimer>
|
||||
#include <libcockatrice/network/client/abstract/abstract_client.h>
|
||||
#include <libcockatrice/protocol/pb/serverinfo_game.pb.h>
|
||||
|
||||
class AbstractGame;
|
||||
class ServerInfo_PlayerProperties;
|
||||
|
||||
@@ -6,12 +6,10 @@
|
||||
#include "../board/translate_counter_name.h"
|
||||
#include "../phase.h"
|
||||
#include "../player/player.h"
|
||||
#include "../zones/card_zone.h"
|
||||
|
||||
#include <../../client/settings/card_counter_settings.h>
|
||||
#include <libcockatrice/protocol/pb/context_move_card.pb.h>
|
||||
#include <libcockatrice/protocol/pb/context_mulligan.pb.h>
|
||||
#include <libcockatrice/protocol/pb/serverinfo_user.pb.h>
|
||||
#include <utility>
|
||||
|
||||
static const QString TABLE_ZONE_NAME = "table";
|
||||
|
||||
@@ -7,12 +7,9 @@
|
||||
#ifndef MESSAGELOGWIDGET_H
|
||||
#define MESSAGELOGWIDGET_H
|
||||
|
||||
#include "../../client/translation.h"
|
||||
#include "../../interface/widgets/server/chat_view/chat_view.h"
|
||||
#include "../zones/logic/card_zone_logic.h"
|
||||
|
||||
#include <libcockatrice/network/server/remote/user_level.h>
|
||||
|
||||
class AbstractGame;
|
||||
class CardItem;
|
||||
class GameEventContext;
|
||||
|
||||
@@ -22,6 +22,28 @@ Phase Phases::getPhase(int phase)
|
||||
}
|
||||
}
|
||||
|
||||
int Phases::getLastSubphase(int phase)
|
||||
{
|
||||
if (0 <= phase && phase < Phases::phaseTypesCount) {
|
||||
return subPhasesEnd[phase];
|
||||
} else {
|
||||
return phase;
|
||||
}
|
||||
}
|
||||
|
||||
QVector<int> getSubPhasesEnd()
|
||||
{
|
||||
QVector<int> array(Phases::phaseTypesCount);
|
||||
for (int phaseEnd = Phases::phaseTypesCount - 1; phaseEnd >= 0;) {
|
||||
int subPhase = phaseEnd;
|
||||
for (; subPhase >= 0 && Phases::phases[phaseEnd].color == Phases::phases[subPhase].color; --subPhase) {
|
||||
array[subPhase] = phaseEnd;
|
||||
}
|
||||
phaseEnd = subPhase;
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
const Phase Phases::unknownPhase(QT_TRANSLATE_NOOP("Phase", "Unknown Phase"), "black", "unknown_phase");
|
||||
const Phase Phases::phases[Phases::phaseTypesCount] = {
|
||||
{QT_TRANSLATE_NOOP("Phase", "Untap"), "green", "untap_step"},
|
||||
@@ -35,3 +57,4 @@ const Phase Phases::phases[Phases::phaseTypesCount] = {
|
||||
{QT_TRANSLATE_NOOP("Phase", "End of Combat"), "red", "end_combat"},
|
||||
{QT_TRANSLATE_NOOP("Phase", "Second Main"), "blue", "main_2"},
|
||||
{QT_TRANSLATE_NOOP("Phase", "End/Cleanup"), "green", "end_step"}};
|
||||
const QVector<int> Phases::subPhasesEnd = getSubPhasesEnd();
|
||||
|
||||
@@ -28,8 +28,10 @@ struct Phases
|
||||
const static int phaseTypesCount = 11;
|
||||
const static Phase unknownPhase;
|
||||
const static Phase phases[phaseTypesCount];
|
||||
const static QVector<int> subPhasesEnd;
|
||||
|
||||
static Phase getPhase(int);
|
||||
static int getLastSubphase(int phase);
|
||||
};
|
||||
|
||||
#endif // PHASE_H
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include "../../abstract_game.h"
|
||||
#include "../player.h"
|
||||
#include "../player_actions.h"
|
||||
#include "grave_menu.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QMenu>
|
||||
|
||||
@@ -3,12 +3,11 @@
|
||||
#include "../../../interface/widgets/tabs/tab_game.h"
|
||||
#include "../../board/card_item.h"
|
||||
#include "../../zones/hand_zone.h"
|
||||
#include "../card_menu_action_type.h"
|
||||
#include "../player_actions.h"
|
||||
#include "../../zones/pile_zone.h"
|
||||
#include "../../zones/table_zone.h"
|
||||
#include "card_menu.h"
|
||||
#include "hand_menu.h"
|
||||
|
||||
#include <libcockatrice/card/database/card_database_manager.h>
|
||||
#include <libcockatrice/protocol/pb/command_reveal_cards.pb.h>
|
||||
|
||||
PlayerMenu::PlayerMenu(Player *_player) : player(_player)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "sideboard_menu.h"
|
||||
|
||||
#include "../player.h"
|
||||
#include "../player_actions.h"
|
||||
|
||||
SideboardMenu::SideboardMenu(Player *player, QMenu *playerMenu) : QMenu(playerMenu)
|
||||
{
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
#include "utility_menu.h"
|
||||
|
||||
#include "../../../interface/deck_loader/deck_loader.h"
|
||||
#include "../player.h"
|
||||
#include "../player_actions.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)
|
||||
{
|
||||
PlayerActions *playerActions = player->getPlayerActions();
|
||||
@@ -56,21 +60,19 @@ void UtilityMenu::populatePredefinedTokensMenu()
|
||||
clear();
|
||||
setEnabled(false);
|
||||
predefinedTokens.clear();
|
||||
DeckLoader *_deck = player->getDeck();
|
||||
const DeckList &deckList = player->getDeck();
|
||||
|
||||
if (!_deck) {
|
||||
if (deckList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
InnerDecklistNode *tokenZone =
|
||||
dynamic_cast<InnerDecklistNode *>(_deck->getDeckList()->getRoot()->findChild(DECK_ZONE_TOKENS));
|
||||
auto tokenCardNodes = deckList.getCardNodes({DECK_ZONE_TOKENS});
|
||||
|
||||
if (tokenZone) {
|
||||
if (!tokenZone->empty())
|
||||
setEnabled(true);
|
||||
if (!tokenCardNodes.isEmpty()) {
|
||||
setEnabled(true);
|
||||
|
||||
for (int i = 0; i < tokenZone->size(); ++i) {
|
||||
const QString tokenName = tokenZone->at(i)->getName();
|
||||
for (int i = 0; i < tokenCardNodes.size(); ++i) {
|
||||
const QString tokenName = tokenCardNodes[i]->getName();
|
||||
predefinedTokens.append(tokenName);
|
||||
QAction *a = addAction(tokenName);
|
||||
if (i < 10) {
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "../zones/pile_zone.h"
|
||||
#include "../zones/stack_zone.h"
|
||||
#include "../zones/table_zone.h"
|
||||
#include "../zones/view_zone.h"
|
||||
#include "player_actions.h"
|
||||
#include "player_target.h"
|
||||
|
||||
#include <QDebug>
|
||||
@@ -32,7 +32,7 @@
|
||||
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)),
|
||||
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();
|
||||
|
||||
@@ -263,10 +263,9 @@ void Player::deleteCard(CardItem *card)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Does a player need a DeckLoader?
|
||||
void Player::setDeck(DeckLoader &_deck)
|
||||
void Player::setDeck(const DeckList &_deck)
|
||||
{
|
||||
deck = new DeckLoader(this, _deck.getDeckList());
|
||||
deck = _deck;
|
||||
|
||||
emit deckChanged();
|
||||
}
|
||||
|
||||
@@ -9,9 +9,12 @@
|
||||
|
||||
#include "../../game_graphics/board/abstract_graphics_item.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 "player_actions.h"
|
||||
#include "player_area.h"
|
||||
#include "player_event_handler.h"
|
||||
#include "player_graphics_item.h"
|
||||
@@ -20,9 +23,7 @@
|
||||
#include <QInputDialog>
|
||||
#include <QLoggingCategory>
|
||||
#include <QMap>
|
||||
#include <QPoint>
|
||||
#include <QTimer>
|
||||
#include <libcockatrice/card/card_info.h>
|
||||
#include <libcockatrice/filters/filter_string.h>
|
||||
#include <libcockatrice/protocol/pb/card_attributes.pb.h>
|
||||
#include <libcockatrice/protocol/pb/game_event.pb.h>
|
||||
@@ -44,7 +45,6 @@ class ArrowTarget;
|
||||
class CardDatabase;
|
||||
class CardZone;
|
||||
class CommandContainer;
|
||||
class DeckLoader;
|
||||
class GameCommand;
|
||||
class GameEvent;
|
||||
class PlayerInfo;
|
||||
@@ -66,7 +66,7 @@ class Player : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
signals:
|
||||
void openDeckEditor(DeckLoader *deck);
|
||||
void openDeckEditor(const LoadedDeck &deck);
|
||||
void deckChanged();
|
||||
void newCardAdded(AbstractCardItem *card);
|
||||
void rearrangeCounters();
|
||||
@@ -113,7 +113,7 @@ public:
|
||||
[[nodiscard]] PlayerActions *getPlayerActions() const
|
||||
{
|
||||
return playerActions;
|
||||
};
|
||||
}
|
||||
|
||||
[[nodiscard]] PlayerEventHandler *getPlayerEventHandler() const
|
||||
{
|
||||
@@ -123,16 +123,16 @@ public:
|
||||
[[nodiscard]] PlayerInfo *getPlayerInfo() const
|
||||
{
|
||||
return playerInfo;
|
||||
};
|
||||
}
|
||||
|
||||
[[nodiscard]] PlayerMenu *getPlayerMenu() const
|
||||
{
|
||||
return playerMenu;
|
||||
}
|
||||
|
||||
void setDeck(DeckLoader &_deck);
|
||||
void setDeck(const DeckList &_deck);
|
||||
|
||||
[[nodiscard]] DeckLoader *getDeck() const
|
||||
[[nodiscard]] const DeckList &getDeck() const
|
||||
{
|
||||
return deck;
|
||||
}
|
||||
@@ -241,7 +241,7 @@ private:
|
||||
bool active;
|
||||
bool conceded;
|
||||
|
||||
DeckLoader *deck;
|
||||
DeckList deck;
|
||||
|
||||
int zoneId;
|
||||
QMap<QString, CardZoneLogic *> zones;
|
||||
|
||||
@@ -5,14 +5,15 @@
|
||||
#include "../board/card_item.h"
|
||||
#include "../dialogs/dlg_move_top_cards_until.h"
|
||||
#include "../dialogs/dlg_roll_dice.h"
|
||||
#include "../zones/hand_zone.h"
|
||||
#include "../zones/logic/view_zone_logic.h"
|
||||
#include "../zones/table_zone.h"
|
||||
#include "card_menu_action_type.h"
|
||||
|
||||
#include <libcockatrice/card/database/card_database_manager.h>
|
||||
#include <libcockatrice/card/relation/card_relation.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_concede.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_flip_card.pb.h>
|
||||
@@ -217,7 +218,7 @@ void PlayerActions::actAlwaysLookAtTopCard()
|
||||
|
||||
void PlayerActions::actOpenDeckInDeckEditor()
|
||||
{
|
||||
emit player->openDeckEditor(player->getDeck());
|
||||
emit player->openDeckEditor({.deckList = player->getDeck()});
|
||||
}
|
||||
|
||||
void PlayerActions::actViewGraveyard()
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#ifndef COCKATRICE_PLAYER_ACTIONS_H
|
||||
#define COCKATRICE_PLAYER_ACTIONS_H
|
||||
#include "../dialogs/dlg_create_token.h"
|
||||
#include "event_processing_options.h"
|
||||
#include "player.h"
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "../board/card_list.h"
|
||||
#include "../zones/view_zone.h"
|
||||
#include "player.h"
|
||||
#include "player_actions.h"
|
||||
|
||||
#include <libcockatrice/protocol/pb/command_set_card_attr.pb.h>
|
||||
#include <libcockatrice/protocol/pb/context_move_card.pb.h>
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
#include "player_graphics_item.h"
|
||||
|
||||
#include "../../interface/widgets/tabs/tab_game.h"
|
||||
#include "../board/abstract_card_item.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)
|
||||
{
|
||||
|
||||
@@ -7,11 +7,6 @@
|
||||
#ifndef 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 <QObject>
|
||||
|
||||
@@ -4,15 +4,11 @@
|
||||
#include "../../interface/widgets/server/user/user_context_menu.h"
|
||||
#include "../../interface/widgets/server/user/user_list_manager.h"
|
||||
#include "../../interface/widgets/server/user/user_list_widget.h"
|
||||
#include "../../interface/widgets/tabs/tab_account.h"
|
||||
#include "../../interface/widgets/tabs/tab_game.h"
|
||||
#include "../../interface/widgets/tabs/tab_supervisor.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QHeaderView>
|
||||
#include <QMenu>
|
||||
#include <QMouseEvent>
|
||||
#include <libcockatrice/network/client/abstract/abstract_client.h>
|
||||
#include <libcockatrice/protocol/pb/command_kick_from_game.pb.h>
|
||||
#include <libcockatrice/protocol/pb/serverinfo_playerproperties.pb.h>
|
||||
#include <libcockatrice/protocol/pb/session_commands.pb.h>
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "../board/abstract_counter.h"
|
||||
#include "../board/arrow_target.h"
|
||||
|
||||
#include <QFont>
|
||||
#include <QPixmap>
|
||||
|
||||
class Player;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "../board/card_drag_item.h"
|
||||
#include "../board/card_item.h"
|
||||
#include "../player/player.h"
|
||||
#include "../player/player_actions.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include <libcockatrice/protocol/pb/command_move_card.pb.h>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "../../board/card_item.h"
|
||||
#include "../../player/player.h"
|
||||
#include "../pile_zone.h"
|
||||
#include "../../player/player_actions.h"
|
||||
#include "../view_zone.h"
|
||||
#include "view_zone_logic.h"
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include <QDebug>
|
||||
#include <libcockatrice/card/database/card_database_manager.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
|
||||
@@ -148,17 +147,24 @@ void CardZoneLogic::moveAllToZone()
|
||||
|
||||
void CardZoneLogic::clearContents()
|
||||
{
|
||||
for (int i = 0; i < cards.size(); i++) {
|
||||
// First gather the cards into a safe temporary list.
|
||||
const CardList toClear = cards;
|
||||
|
||||
// Detach and notify attached cards and zones *before* deleting anything.
|
||||
for (CardItem *card : toClear) {
|
||||
// If an incorrectly implemented server doesn't return attached cards to whom they belong before dropping a
|
||||
// player, we have to return them to avoid a crash.
|
||||
|
||||
const QList<CardItem *> &attachedCards = cards[i]->getAttachedCards();
|
||||
for (auto attachedCard : attachedCards) {
|
||||
const QList<CardItem *> &attachedCards = card->getAttachedCards();
|
||||
for (CardItem *attachedCard : attachedCards) {
|
||||
emit attachedCard->getZone()->cardAdded(attachedCard);
|
||||
}
|
||||
|
||||
player->deleteCard(cards.at(i));
|
||||
}
|
||||
|
||||
// Now request deletions after all manipulations are done.
|
||||
for (CardItem *card : toClear) {
|
||||
player->deleteCard(card);
|
||||
}
|
||||
|
||||
cards.clear();
|
||||
emit cardCountChanged();
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
void rawInsertCard(CardItem *card, int index)
|
||||
{
|
||||
cards.insert(index, card);
|
||||
};
|
||||
}
|
||||
|
||||
[[nodiscard]] const CardList &getCards() const
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "../board/card_drag_item.h"
|
||||
#include "../board/card_item.h"
|
||||
#include "../player/player.h"
|
||||
#include "../player/player_actions.h"
|
||||
#include "logic/pile_zone_logic.h"
|
||||
#include "view_zone.h"
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
#include "../board/card_drag_item.h"
|
||||
#include "../board/card_item.h"
|
||||
#include "../player/player.h"
|
||||
#include "../player/player_actions.h"
|
||||
#include "logic/stack_zone_logic.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include <QSet>
|
||||
#include <libcockatrice/protocol/pb/command_move_card.pb.h>
|
||||
|
||||
StackZone::StackZone(StackZoneLogic *_logic, int _zoneHeight, QGraphicsItem *parent)
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
#include "../board/card_drag_item.h"
|
||||
#include "../board/card_item.h"
|
||||
#include "../player/player.h"
|
||||
#include "../player/player_actions.h"
|
||||
#include "logic/table_zone_logic.h"
|
||||
|
||||
#include <QGraphicsScene>
|
||||
#include <QPainter>
|
||||
#include <QSet>
|
||||
#include <libcockatrice/card/card_info.h>
|
||||
#include <libcockatrice/protocol/pb/command_move_card.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_item.h"
|
||||
#include "../player/player.h"
|
||||
#include "../player/player_actions.h"
|
||||
#include "logic/view_zone_logic.h"
|
||||
|
||||
#include <QBrush>
|
||||
@@ -10,7 +11,6 @@
|
||||
#include <QGraphicsSceneWheelEvent>
|
||||
#include <QPainter>
|
||||
#include <QtMath>
|
||||
#include <libcockatrice/card/card_info.h>
|
||||
#include <libcockatrice/protocol/pb/command_dump_zone.pb.h>
|
||||
#include <libcockatrice/protocol/pb/command_move_card.pb.h>
|
||||
#include <libcockatrice/protocol/pb/response_dump_zone.pb.h>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "../board/card_item.h"
|
||||
#include "../game_scene.h"
|
||||
#include "../player/player.h"
|
||||
#include "../player/player_actions.h"
|
||||
#include "view_zone.h"
|
||||
|
||||
#include <QCheckBox>
|
||||
@@ -16,7 +17,6 @@
|
||||
#include <QPainter>
|
||||
#include <QScrollBar>
|
||||
#include <QStyleOption>
|
||||
#include <QStyleOptionTitleBar>
|
||||
#include <libcockatrice/protocol/pb/command_shuffle.pb.h>
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include <QFileInfo>
|
||||
#include <QMainWindow>
|
||||
#include <QMovie>
|
||||
#include <QNetworkDiskCache>
|
||||
#include <QNetworkRequest>
|
||||
#include <QPainter>
|
||||
#include <QPixmapCache>
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "card_picture_loader_worker.h"
|
||||
|
||||
#include <QLoggingCategory>
|
||||
#include <libcockatrice/card/card_info.h>
|
||||
|
||||
inline Q_LOGGING_CATEGORY(CardPictureLoaderLog, "card_picture_loader");
|
||||
inline Q_LOGGING_CATEGORY(CardPictureLoaderCardBackCacheFailLog, "card_picture_loader.card_back_cache_fail");
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#ifndef PICTURE_LOADER_LOCAL_H
|
||||
#define PICTURE_LOADER_LOCAL_H
|
||||
|
||||
#include <QLoggingCategory>
|
||||
#include <QObject>
|
||||
#include <QTimer>
|
||||
#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.
|
||||
*/
|
||||
QImage tryLoad(const ExactCard &toLoad) const;
|
||||
[[nodiscard]] QImage tryLoad(const ExactCard &toLoad) const;
|
||||
|
||||
private:
|
||||
QString picsPath; ///< Path to standard card image folder
|
||||
@@ -72,10 +70,10 @@ private:
|
||||
* Uses several filename patterns to match card images, in order from
|
||||
* most-specific to least-specific.
|
||||
*/
|
||||
QImage tryLoadCardImageFromDisk(const QString &setName,
|
||||
const QString &correctedCardName,
|
||||
const QString &collectorNumber,
|
||||
const QString &providerId) const;
|
||||
[[nodiscard]] QImage tryLoadCardImageFromDisk(const QString &setName,
|
||||
const QString &correctedCardName,
|
||||
const QString &collectorNumber,
|
||||
const QString &providerId) const;
|
||||
|
||||
private slots:
|
||||
/**
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#ifndef 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 <QLabel>
|
||||
#include <QUrl>
|
||||
#include <QWidget>
|
||||
#include <libcockatrice/card/printing/exact_card.h>
|
||||
|
||||
/**
|
||||
* @class CardPictureLoaderRequestStatusDisplayWidget
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QProgressBar>
|
||||
#include <QTimer>
|
||||
#include <QWidget>
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
#include <QNetworkDiskCache>
|
||||
#include <QNetworkReply>
|
||||
#include <QThread>
|
||||
#include <libcockatrice/card/database/card_database_manager.h>
|
||||
#include <utility>
|
||||
#include <version_string.h>
|
||||
|
||||
static constexpr int MAX_REQUESTS_PER_SEC = 10;
|
||||
|
||||
@@ -87,6 +87,7 @@ QNetworkReply *CardPictureLoaderWorker::makeRequest(const QUrl &url, CardPicture
|
||||
}
|
||||
|
||||
QNetworkRequest req(url);
|
||||
req.setHeader(QNetworkRequest::UserAgentHeader, QString("Cockatrice %1").arg(VERSION_STRING));
|
||||
if (!picDownload) {
|
||||
req.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysCache);
|
||||
}
|
||||
|
||||
@@ -7,11 +7,9 @@
|
||||
#include <QDirIterator>
|
||||
#include <QLoggingCategory>
|
||||
#include <QMovie>
|
||||
#include <QNetworkDiskCache>
|
||||
#include <QNetworkReply>
|
||||
#include <QThread>
|
||||
#include <QThreadPool>
|
||||
#include <libcockatrice/card/database/card_database_manager.h>
|
||||
|
||||
// Card back returned by gatherer when card is not found
|
||||
static const QStringList MD5_BLACKLIST = {"db0c48db407a907c16ade38de048a441"};
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#ifndef PICTURE_TO_LOAD_H
|
||||
#define PICTURE_TO_LOAD_H
|
||||
|
||||
#include <QLoggingCategory>
|
||||
#include <libcockatrice/card/printing/exact_card.h>
|
||||
|
||||
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_manager.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::FILE_NAME_FILTERS = {
|
||||
tr("Common deck formats (%1)").arg(ACCEPTED_FILE_EXTENSIONS.join(" ")), tr("All files (*.*)")};
|
||||
|
||||
DeckLoader::DeckLoader(QObject *parent)
|
||||
: QObject(parent), deckList(new DeckList()), lastFileFormat(CockatriceFormat), lastRemoteDeckId(-1)
|
||||
DeckLoader::DeckLoader(QObject *parent) : QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
DeckLoader::DeckLoader(QObject *parent, DeckList *_deckList)
|
||||
: QObject(parent), deckList(_deckList), lastFileFormat(CockatriceFormat), lastRemoteDeckId(-1)
|
||||
{
|
||||
}
|
||||
|
||||
bool DeckLoader::loadFromFile(const QString &fileName, FileFormat fmt, bool userRequest)
|
||||
bool DeckLoader::loadFromFile(const QString &fileName, DeckFileFormat::Format fmt, bool userRequest)
|
||||
{
|
||||
QFile file(fileName);
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
@@ -43,18 +37,19 @@ bool DeckLoader::loadFromFile(const QString &fileName, FileFormat fmt, bool user
|
||||
}
|
||||
|
||||
bool result = false;
|
||||
DeckList deckList = DeckList();
|
||||
switch (fmt) {
|
||||
case PlainTextFormat:
|
||||
result = deckList->loadFromFile_Plain(&file);
|
||||
case DeckFileFormat::PlainText:
|
||||
result = deckList.loadFromFile_Plain(&file);
|
||||
break;
|
||||
case CockatriceFormat: {
|
||||
result = deckList->loadFromFile_Native(&file);
|
||||
case DeckFileFormat::Cockatrice: {
|
||||
result = deckList.loadFromFile_Native(&file);
|
||||
qCInfo(DeckLoaderLog) << "Loaded from" << fileName << "-" << result;
|
||||
if (!result) {
|
||||
qCInfo(DeckLoaderLog) << "Retrying as plain format";
|
||||
file.seek(0);
|
||||
result = deckList->loadFromFile_Plain(&file);
|
||||
fmt = PlainTextFormat;
|
||||
result = deckList.loadFromFile_Plain(&file);
|
||||
fmt = DeckFileFormat::PlainText;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -64,8 +59,11 @@ bool DeckLoader::loadFromFile(const QString &fileName, FileFormat fmt, bool user
|
||||
}
|
||||
|
||||
if (result) {
|
||||
lastFileName = fileName;
|
||||
lastFileFormat = fmt;
|
||||
loadedDeck.deckList = deckList;
|
||||
loadedDeck.lastLoadInfo = {
|
||||
.fileName = fileName,
|
||||
.fileFormat = fmt,
|
||||
};
|
||||
if (userRequest) {
|
||||
updateLastLoadedTimestamp(fileName, fmt);
|
||||
}
|
||||
@@ -77,7 +75,7 @@ bool DeckLoader::loadFromFile(const QString &fileName, FileFormat fmt, bool user
|
||||
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);
|
||||
|
||||
@@ -86,8 +84,10 @@ bool DeckLoader::loadFromFileAsync(const QString &fileName, FileFormat fmt, bool
|
||||
watcher->deleteLater();
|
||||
|
||||
if (result) {
|
||||
lastFileName = fileName;
|
||||
lastFileFormat = fmt;
|
||||
loadedDeck.lastLoadInfo = {
|
||||
.fileName = fileName,
|
||||
.fileFormat = fmt,
|
||||
};
|
||||
if (userRequest) {
|
||||
updateLastLoadedTimestamp(fileName, fmt);
|
||||
}
|
||||
@@ -104,14 +104,14 @@ bool DeckLoader::loadFromFileAsync(const QString &fileName, FileFormat fmt, bool
|
||||
}
|
||||
|
||||
switch (fmt) {
|
||||
case PlainTextFormat:
|
||||
return deckList->loadFromFile_Plain(&file);
|
||||
case CockatriceFormat: {
|
||||
case DeckFileFormat::PlainText:
|
||||
return loadedDeck.deckList.loadFromFile_Plain(&file);
|
||||
case DeckFileFormat::Cockatrice: {
|
||||
bool result = false;
|
||||
result = deckList->loadFromFile_Native(&file);
|
||||
result = loadedDeck.deckList.loadFromFile_Native(&file);
|
||||
if (!result) {
|
||||
file.seek(0);
|
||||
return deckList->loadFromFile_Plain(&file);
|
||||
return loadedDeck.deckList.loadFromFile_Plain(&file);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -127,18 +127,18 @@ bool DeckLoader::loadFromFileAsync(const QString &fileName, FileFormat fmt, bool
|
||||
|
||||
bool DeckLoader::loadFromRemote(const QString &nativeString, int remoteDeckId)
|
||||
{
|
||||
bool result = deckList->loadFromString_Native(nativeString);
|
||||
bool result = loadedDeck.deckList.loadFromString_Native(nativeString);
|
||||
if (result) {
|
||||
lastFileName = QString();
|
||||
lastFileFormat = CockatriceFormat;
|
||||
lastRemoteDeckId = remoteDeckId;
|
||||
loadedDeck.lastLoadInfo = {
|
||||
.remoteDeckId = remoteDeckId,
|
||||
};
|
||||
|
||||
emit deckLoaded();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool DeckLoader::saveToFile(const QString &fileName, FileFormat fmt)
|
||||
bool DeckLoader::saveToFile(const QString &fileName, DeckFileFormat::Format fmt)
|
||||
{
|
||||
QFile file(fileName);
|
||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
@@ -147,18 +147,20 @@ bool DeckLoader::saveToFile(const QString &fileName, FileFormat fmt)
|
||||
|
||||
bool result = false;
|
||||
switch (fmt) {
|
||||
case PlainTextFormat:
|
||||
result = deckList->saveToFile_Plain(&file);
|
||||
case DeckFileFormat::PlainText:
|
||||
result = loadedDeck.deckList.saveToFile_Plain(&file);
|
||||
break;
|
||||
case CockatriceFormat:
|
||||
result = deckList->saveToFile_Native(&file);
|
||||
case DeckFileFormat::Cockatrice:
|
||||
result = loadedDeck.deckList.saveToFile_Native(&file);
|
||||
qCInfo(DeckLoaderLog) << "Saving to " << fileName << "-" << result;
|
||||
break;
|
||||
}
|
||||
|
||||
if (result) {
|
||||
lastFileName = fileName;
|
||||
lastFileFormat = fmt;
|
||||
loadedDeck.lastLoadInfo = {
|
||||
.fileName = fileName,
|
||||
.fileFormat = fmt,
|
||||
};
|
||||
qCInfo(DeckLoaderLog) << "Deck was saved -" << result;
|
||||
}
|
||||
|
||||
@@ -168,7 +170,7 @@ bool DeckLoader::saveToFile(const QString &fileName, FileFormat fmt)
|
||||
return result;
|
||||
}
|
||||
|
||||
bool DeckLoader::updateLastLoadedTimestamp(const QString &fileName, FileFormat fmt)
|
||||
bool DeckLoader::updateLastLoadedTimestamp(const QString &fileName, DeckFileFormat::Format fmt)
|
||||
{
|
||||
QFileInfo fileInfo(fileName);
|
||||
if (!fileInfo.exists()) {
|
||||
@@ -189,20 +191,22 @@ bool DeckLoader::updateLastLoadedTimestamp(const QString &fileName, FileFormat f
|
||||
|
||||
// Perform file modifications
|
||||
switch (fmt) {
|
||||
case PlainTextFormat:
|
||||
result = deckList->saveToFile_Plain(&file);
|
||||
case DeckFileFormat::PlainText:
|
||||
result = loadedDeck.deckList.saveToFile_Plain(&file);
|
||||
break;
|
||||
case CockatriceFormat:
|
||||
deckList->setLastLoadedTimestamp(QDateTime::currentDateTime().toString());
|
||||
result = deckList->saveToFile_Native(&file);
|
||||
case DeckFileFormat::Cockatrice:
|
||||
loadedDeck.deckList.setLastLoadedTimestamp(QDateTime::currentDateTime().toString());
|
||||
result = loadedDeck.deckList.saveToFile_Native(&file);
|
||||
break;
|
||||
}
|
||||
|
||||
file.close(); // Close the file to ensure changes are flushed
|
||||
|
||||
if (result) {
|
||||
lastFileName = fileName;
|
||||
lastFileFormat = fmt;
|
||||
loadedDeck.lastLoadInfo = {
|
||||
.fileName = fileName,
|
||||
.fileFormat = fmt,
|
||||
};
|
||||
|
||||
// Re-open the file and set the original timestamp
|
||||
if (!file.open(QIODevice::ReadWrite)) {
|
||||
@@ -263,6 +267,20 @@ static QString toDecklistExportString(const DecklistCardNode *card)
|
||||
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
|
||||
*
|
||||
@@ -273,29 +291,11 @@ QString DeckLoader::exportDeckToDecklist(const DeckList *deckList, DecklistWebsi
|
||||
{
|
||||
// Add the base url
|
||||
QString deckString = "https://" + getDomainForWebsite(website) + "/?";
|
||||
// Create two strings to pass to function
|
||||
QString mainBoardCards, sideBoardCards;
|
||||
|
||||
// Set up the function to call
|
||||
auto formatDeckListForExport = [&mainBoardCards, &sideBoardCards](const auto *node, const auto *card) {
|
||||
// Get the card name
|
||||
CardInfoPtr dbCard = CardDatabaseManager::query()->getCardInfo(card->getName());
|
||||
if (!dbCard || dbCard->getIsToken()) {
|
||||
// If it's a token, we don't care about the card.
|
||||
return;
|
||||
}
|
||||
// export all cards in zone
|
||||
QString mainBoardCards = toDecklistExportString(deckList->getCardNodes({DECK_ZONE_MAIN}));
|
||||
QString sideBoardCards = toDecklistExportString(deckList->getCardNodes({DECK_ZONE_SIDE}));
|
||||
|
||||
// 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
|
||||
mainBoardCards.chop(3);
|
||||
sideBoardCards.chop(3);
|
||||
@@ -310,112 +310,6 @@ QString DeckLoader::exportDeckToDecklist(const DeckList *deckList, DecklistWebsi
|
||||
return deckString;
|
||||
}
|
||||
|
||||
// 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 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;
|
||||
@@ -435,9 +329,7 @@ bool DeckLoader::saveToStream_Plain(QTextStream &out,
|
||||
}
|
||||
|
||||
// loop zones
|
||||
for (int i = 0; i < deckList->getRoot()->size(); i++) {
|
||||
const auto *zoneNode = dynamic_cast<InnerDecklistNode *>(deckList->getRoot()->at(i));
|
||||
|
||||
for (auto zoneNode : deckList->getZoneNodes()) {
|
||||
saveToStream_DeckZone(out, zoneNode, addComments, addSetNameAndNumber);
|
||||
|
||||
// end of zone
|
||||
@@ -558,12 +450,12 @@ bool DeckLoader::convertToCockatriceFormat(QString fileName)
|
||||
bool result = false;
|
||||
|
||||
// Perform file modifications based on the detected format
|
||||
switch (getFormatFromName(fileName)) {
|
||||
case PlainTextFormat:
|
||||
switch (DeckFileFormat::getFormatFromName(fileName)) {
|
||||
case DeckFileFormat::PlainText:
|
||||
// Save in Cockatrice's native format
|
||||
result = deckList->saveToFile_Native(&file);
|
||||
result = loadedDeck.deckList.saveToFile_Native(&file);
|
||||
break;
|
||||
case CockatriceFormat:
|
||||
case DeckFileFormat::Cockatrice:
|
||||
qCInfo(DeckLoaderLog) << "File is already in Cockatrice format. No conversion needed.";
|
||||
result = true;
|
||||
break;
|
||||
@@ -582,37 +474,16 @@ bool DeckLoader::convertToCockatriceFormat(QString fileName)
|
||||
} else {
|
||||
qCInfo(DeckLoaderLog) << "Original file deleted successfully:" << fileName;
|
||||
}
|
||||
lastFileName = newFileName;
|
||||
lastFileFormat = CockatriceFormat;
|
||||
loadedDeck.lastLoadInfo = {
|
||||
.fileName = newFileName,
|
||||
.fileFormat = DeckFileFormat::Cockatrice,
|
||||
};
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
QString DeckLoader::getCardZoneFromName(const QString &cardName, QString currentZoneName)
|
||||
{
|
||||
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)
|
||||
void DeckLoader::printDeckListNode(QTextCursor *cursor, const InnerDecklistNode *node)
|
||||
{
|
||||
const int totalColumns = 2;
|
||||
|
||||
@@ -695,12 +566,11 @@ void DeckLoader::printDeckList(QPrinter *printer, const DeckList *deckList)
|
||||
cursor.insertText(deckList->getComments());
|
||||
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("<hr>");
|
||||
cursor.insertBlock(headerBlockFormat, headerCharFormat);
|
||||
|
||||
printDeckListNode(&cursor, dynamic_cast<InnerDecklistNode *>(deckList->getRoot()->at(i)));
|
||||
printDeckListNode(&cursor, zoneNode);
|
||||
}
|
||||
|
||||
doc.print(printer);
|
||||
|
||||
@@ -7,14 +7,16 @@
|
||||
#ifndef DECK_LOADER_H
|
||||
#define DECK_LOADER_H
|
||||
|
||||
#include "loaded_deck.h"
|
||||
|
||||
#include <QLoggingCategory>
|
||||
#include <QPrinter>
|
||||
#include <QTextCursor>
|
||||
#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
|
||||
signals:
|
||||
@@ -22,12 +24,6 @@ signals:
|
||||
void loadFinished(bool success);
|
||||
|
||||
public:
|
||||
enum FileFormat
|
||||
{
|
||||
PlainTextFormat,
|
||||
CockatriceFormat
|
||||
};
|
||||
|
||||
/**
|
||||
* Supported file extensions for decklist files
|
||||
*/
|
||||
@@ -45,53 +41,26 @@ public:
|
||||
};
|
||||
|
||||
private:
|
||||
DeckList *deckList;
|
||||
QString lastFileName;
|
||||
FileFormat lastFileFormat;
|
||||
int lastRemoteDeckId;
|
||||
LoadedDeck loadedDeck;
|
||||
|
||||
public:
|
||||
DeckLoader(QObject *parent);
|
||||
DeckLoader(QObject *parent, DeckList *_deckList);
|
||||
DeckLoader(const DeckLoader &) = delete;
|
||||
DeckLoader &operator=(const DeckLoader &) = delete;
|
||||
|
||||
const QString &getLastFileName() const
|
||||
[[nodiscard]] bool hasNotBeenLoaded() const
|
||||
{
|
||||
return lastFileName;
|
||||
}
|
||||
void setLastFileName(const QString &_lastFileName)
|
||||
{
|
||||
lastFileName = _lastFileName;
|
||||
}
|
||||
FileFormat getLastFileFormat() const
|
||||
{
|
||||
return lastFileFormat;
|
||||
}
|
||||
int getLastRemoteDeckId() const
|
||||
{
|
||||
return lastRemoteDeckId;
|
||||
return loadedDeck.lastLoadInfo.isEmpty();
|
||||
}
|
||||
|
||||
bool hasNotBeenLoaded() const
|
||||
{
|
||||
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 loadFromFile(const QString &fileName, DeckFileFormat::Format fmt, bool userRequest = false);
|
||||
bool loadFromFileAsync(const QString &fileName, DeckFileFormat::Format fmt, bool userRequest);
|
||||
bool loadFromRemote(const QString &nativeString, int remoteDeckId);
|
||||
bool saveToFile(const QString &fileName, FileFormat fmt);
|
||||
bool updateLastLoadedTimestamp(const QString &fileName, FileFormat fmt);
|
||||
bool saveToFile(const QString &fileName, DeckFileFormat::Format fmt);
|
||||
bool updateLastLoadedTimestamp(const QString &fileName, DeckFileFormat::Format fmt);
|
||||
|
||||
static QString exportDeckToDecklist(const DeckList *deckList, DecklistWebsite website);
|
||||
|
||||
static void setProviderIdToPreferredPrinting(const DeckList *deckList);
|
||||
static void resolveSetNameAndNumberToProviderID(const DeckList *deckList);
|
||||
|
||||
static void saveToClipboard(const DeckList *deckList, bool addComments = true, bool addSetNameAndNumber = true);
|
||||
static bool saveToStream_Plain(QTextStream &out,
|
||||
const DeckList *deckList,
|
||||
@@ -107,13 +76,21 @@ public:
|
||||
|
||||
bool convertToCockatriceFormat(QString fileName);
|
||||
|
||||
DeckList *getDeckList()
|
||||
LoadedDeck &getDeck()
|
||||
{
|
||||
return deckList;
|
||||
return loadedDeck;
|
||||
}
|
||||
const LoadedDeck &getDeck() const
|
||||
{
|
||||
return loadedDeck;
|
||||
}
|
||||
void setDeck(const LoadedDeck &deck)
|
||||
{
|
||||
loadedDeck = deck;
|
||||
}
|
||||
|
||||
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_DeckZone(QTextStream &out,
|
||||
@@ -125,9 +102,6 @@ private:
|
||||
QList<DecklistCardNode *> cards,
|
||||
bool addComments = true,
|
||||
bool addSetNameAndNumber = true);
|
||||
|
||||
[[nodiscard]] static QString getCardZoneFromName(const QString &cardName, QString currentZoneName);
|
||||
[[nodiscard]] static QString getCompleteCardName(const QString &cardName);
|
||||
};
|
||||
|
||||
#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;
|
||||
void insertWidgetAtIndex(QWidget *toInsert, int index);
|
||||
|
||||
QSize calculateMinimumSizeHorizontal() const;
|
||||
QSize calculateSizeHintVertical() const;
|
||||
QSize calculateMinimumSizeVertical() const;
|
||||
[[nodiscard]] QSize calculateMinimumSizeHorizontal() const;
|
||||
[[nodiscard]] QSize calculateSizeHintVertical() const;
|
||||
[[nodiscard]] QSize calculateMinimumSizeVertical() const;
|
||||
void addItem(QLayoutItem *item) override;
|
||||
[[nodiscard]] int count() const override;
|
||||
[[nodiscard]] QLayoutItem *itemAt(int index) const override;
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
void layoutSingleColumn(const QVector<QLayoutItem *> &colItems, int x, int y);
|
||||
[[nodiscard]] QSize sizeHint() const override;
|
||||
[[nodiscard]] QSize minimumSize() const override;
|
||||
QSize calculateSizeHintHorizontal() const;
|
||||
[[nodiscard]] QSize calculateSizeHintHorizontal() const;
|
||||
|
||||
protected:
|
||||
QList<QLayoutItem *> items; // List to store layout items
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QPixmap>
|
||||
#include <QRegularExpression>
|
||||
#include <QResizeEvent>
|
||||
#include <QSize>
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QPixmap>
|
||||
#include <QResizeEvent>
|
||||
#include <QSize>
|
||||
#include <qregularexpression.h>
|
||||
|
||||
@@ -23,15 +23,15 @@ public:
|
||||
[[nodiscard]] bool isColorActive() const
|
||||
{
|
||||
return isActive;
|
||||
};
|
||||
}
|
||||
[[nodiscard]] QString getSymbol() const
|
||||
{
|
||||
return symbol;
|
||||
};
|
||||
}
|
||||
[[nodiscard]] QChar getSymbolChar() const
|
||||
{
|
||||
return symbol[0];
|
||||
};
|
||||
}
|
||||
|
||||
void loadManaIcon();
|
||||
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
#include "../card_info_picture_with_text_overlay_widget.h"
|
||||
|
||||
#include <QResizeEvent>
|
||||
#include <libcockatrice/card/card_info_comparator.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_sort_filter_proxy_model.h>
|
||||
|
||||
CardGroupDisplayWidget::CardGroupDisplayWidget(QWidget *parent,
|
||||
DeckListModel *_deckListModel,
|
||||
QItemSelectionModel *_selectionModel,
|
||||
QPersistentModelIndex _trackedIndex,
|
||||
QString _zoneName,
|
||||
QString _cardGroupCategory,
|
||||
@@ -17,8 +17,8 @@ CardGroupDisplayWidget::CardGroupDisplayWidget(QWidget *parent,
|
||||
QStringList _activeSortCriteria,
|
||||
int bannerOpacity,
|
||||
CardSizeWidget *_cardSizeWidget)
|
||||
: QWidget(parent), deckListModel(_deckListModel), trackedIndex(_trackedIndex), zoneName(_zoneName),
|
||||
cardGroupCategory(_cardGroupCategory), activeGroupCriteria(_activeGroupCriteria),
|
||||
: QWidget(parent), deckListModel(_deckListModel), selectionModel(_selectionModel), trackedIndex(_trackedIndex),
|
||||
zoneName(_zoneName), cardGroupCategory(_cardGroupCategory), activeGroupCriteria(_activeGroupCriteria),
|
||||
activeSortCriteria(_activeSortCriteria), cardSizeWidget(_cardSizeWidget)
|
||||
{
|
||||
layout = new QVBoxLayout(this);
|
||||
@@ -32,9 +32,50 @@ CardGroupDisplayWidget::CardGroupDisplayWidget(QWidget *parent,
|
||||
CardGroupDisplayWidget::updateCardDisplays();
|
||||
|
||||
connect(deckListModel, &QAbstractItemModel::rowsInserted, this, &CardGroupDisplayWidget::onCardAddition);
|
||||
if (selectionModel) {
|
||||
connect(selectionModel, &QItemSelectionModel::selectionChanged, this,
|
||||
&CardGroupDisplayWidget::onSelectionChanged);
|
||||
}
|
||||
connect(deckListModel, &QAbstractItemModel::rowsRemoved, this, &CardGroupDisplayWidget::onCardRemoval);
|
||||
}
|
||||
|
||||
void CardGroupDisplayWidget::onSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
|
||||
{
|
||||
auto proxyModel = qobject_cast<QAbstractProxyModel *>(selectionModel->model());
|
||||
|
||||
for (auto &range : selected) {
|
||||
for (int row = range.top(); row <= range.bottom(); ++row) {
|
||||
QModelIndex idx = range.model()->index(row, 0, range.parent());
|
||||
|
||||
if (proxyModel) {
|
||||
idx = proxyModel->mapToSource(idx);
|
||||
}
|
||||
|
||||
auto it = indexToWidgetMap.find(QPersistentModelIndex(idx));
|
||||
if (it != indexToWidgetMap.end()) {
|
||||
if (auto displayWidget = qobject_cast<CardInfoPictureWithTextOverlayWidget *>(it.value())) {
|
||||
displayWidget->setHighlighted(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (auto &range : deselected) {
|
||||
for (int row = range.top(); row <= range.bottom(); ++row) {
|
||||
QModelIndex idx = range.model()->index(row, 0, range.parent());
|
||||
if (proxyModel)
|
||||
idx = proxyModel->mapToSource(idx);
|
||||
|
||||
auto it = indexToWidgetMap.find(QPersistentModelIndex(idx));
|
||||
if (it != indexToWidgetMap.end()) {
|
||||
if (auto displayWidget = qobject_cast<CardInfoPictureWithTextOverlayWidget *>(it.value())) {
|
||||
displayWidget->setHighlighted(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CardGroupDisplayWidget::clearAllDisplayWidgets()
|
||||
{
|
||||
for (auto idx : indexToWidgetMap.keys()) {
|
||||
@@ -138,6 +179,14 @@ void CardGroupDisplayWidget::onActiveSortCriteriaChanged(QStringList _activeSort
|
||||
updateCardDisplays();
|
||||
}
|
||||
|
||||
void CardGroupDisplayWidget::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
QWidget::mousePressEvent(event);
|
||||
if (selectionModel) {
|
||||
selectionModel->clearSelection();
|
||||
}
|
||||
}
|
||||
|
||||
void CardGroupDisplayWidget::onClick(QMouseEvent *event, CardInfoPictureWithTextOverlayWidget *card)
|
||||
{
|
||||
emit cardClicked(event, card);
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
#include "../card_info_picture_with_text_overlay_widget.h"
|
||||
#include "../card_size_widget.h"
|
||||
|
||||
#include <QItemSelectionModel>
|
||||
#include <QLabel>
|
||||
#include <QVBoxLayout>
|
||||
#include <QWidget>
|
||||
#include <libcockatrice/card/card_info.h>
|
||||
#include <libcockatrice/models/deck_list/deck_list_model.h>
|
||||
|
||||
class CardGroupDisplayWidget : public QWidget
|
||||
@@ -24,6 +24,7 @@ class CardGroupDisplayWidget : public QWidget
|
||||
public:
|
||||
CardGroupDisplayWidget(QWidget *parent,
|
||||
DeckListModel *deckListModel,
|
||||
QItemSelectionModel *selectionModel,
|
||||
QPersistentModelIndex trackedIndex,
|
||||
QString zoneName,
|
||||
QString cardGroupCategory,
|
||||
@@ -31,9 +32,11 @@ public:
|
||||
QStringList activeSortCriteria,
|
||||
int bannerOpacity,
|
||||
CardSizeWidget *cardSizeWidget);
|
||||
void onSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
|
||||
void clearAllDisplayWidgets();
|
||||
|
||||
DeckListModel *deckListModel;
|
||||
QItemSelectionModel *selectionModel;
|
||||
QPersistentModelIndex trackedIndex;
|
||||
QHash<QPersistentModelIndex, QWidget *> indexToWidgetMap;
|
||||
QString zoneName;
|
||||
@@ -43,6 +46,7 @@ public:
|
||||
CardSizeWidget *cardSizeWidget;
|
||||
|
||||
public slots:
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void onClick(QMouseEvent *event, CardInfoPictureWithTextOverlayWidget *card);
|
||||
void onHover(const ExactCard &card);
|
||||
virtual QWidget *constructWidgetForIndex(QPersistentModelIndex index);
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
#include "flat_card_group_display_widget.h"
|
||||
|
||||
#include "../card_info_picture_with_text_overlay_widget.h"
|
||||
|
||||
#include <QResizeEvent>
|
||||
#include <libcockatrice/card/card_info_comparator.h>
|
||||
#include <libcockatrice/card/database/card_database_manager.h>
|
||||
#include <libcockatrice/models/deck_list/deck_list_model.h>
|
||||
#include <utility>
|
||||
|
||||
FlatCardGroupDisplayWidget::FlatCardGroupDisplayWidget(QWidget *parent,
|
||||
DeckListModel *_deckListModel,
|
||||
QItemSelectionModel *_selectionModel,
|
||||
QPersistentModelIndex _trackedIndex,
|
||||
QString _zoneName,
|
||||
QString _cardGroupCategory,
|
||||
@@ -19,6 +17,7 @@ FlatCardGroupDisplayWidget::FlatCardGroupDisplayWidget(QWidget *parent,
|
||||
CardSizeWidget *_cardSizeWidget)
|
||||
: CardGroupDisplayWidget(parent,
|
||||
_deckListModel,
|
||||
_selectionModel,
|
||||
std::move(_trackedIndex),
|
||||
_zoneName,
|
||||
_cardGroupCategory,
|
||||
|
||||
@@ -17,6 +17,7 @@ class FlatCardGroupDisplayWidget : public CardGroupDisplayWidget
|
||||
public:
|
||||
FlatCardGroupDisplayWidget(QWidget *parent,
|
||||
DeckListModel *deckListModel,
|
||||
QItemSelectionModel *selectionModel,
|
||||
QPersistentModelIndex trackedIndex,
|
||||
QString zoneName,
|
||||
QString cardGroupCategory,
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
#include "overlapped_card_group_display_widget.h"
|
||||
|
||||
#include "../card_info_picture_with_text_overlay_widget.h"
|
||||
|
||||
#include <QResizeEvent>
|
||||
#include <libcockatrice/card/card_info_comparator.h>
|
||||
#include <libcockatrice/card/database/card_database_manager.h>
|
||||
#include <libcockatrice/models/deck_list/deck_list_model.h>
|
||||
|
||||
OverlappedCardGroupDisplayWidget::OverlappedCardGroupDisplayWidget(QWidget *parent,
|
||||
DeckListModel *_deckListModel,
|
||||
QItemSelectionModel *_selectionModel,
|
||||
QPersistentModelIndex _trackedIndex,
|
||||
QString _zoneName,
|
||||
QString _cardGroupCategory,
|
||||
@@ -18,6 +16,7 @@ OverlappedCardGroupDisplayWidget::OverlappedCardGroupDisplayWidget(QWidget *pare
|
||||
CardSizeWidget *_cardSizeWidget)
|
||||
: CardGroupDisplayWidget(parent,
|
||||
_deckListModel,
|
||||
_selectionModel,
|
||||
_trackedIndex,
|
||||
_zoneName,
|
||||
_cardGroupCategory,
|
||||
|
||||
@@ -17,6 +17,7 @@ class OverlappedCardGroupDisplayWidget : public CardGroupDisplayWidget
|
||||
public:
|
||||
OverlappedCardGroupDisplayWidget(QWidget *parent,
|
||||
DeckListModel *deckListModel,
|
||||
QItemSelectionModel *selectionModel,
|
||||
QPersistentModelIndex trackedIndex,
|
||||
QString zoneName,
|
||||
QString cardGroupCategory,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "card_info_display_widget.h"
|
||||
|
||||
#include "../../../game/board/card_item.h"
|
||||
#include "../../../main.h"
|
||||
#include "card_info_picture_widget.h"
|
||||
#include "card_info_text_widget.h"
|
||||
|
||||
@@ -9,7 +8,6 @@
|
||||
#include <QScreen>
|
||||
#include <QVBoxLayout>
|
||||
#include <libcockatrice/card/database/card_database_manager.h>
|
||||
#include <utility>
|
||||
|
||||
CardInfoDisplayWidget::CardInfoDisplayWidget(const CardRef &cardRef, QWidget *parent, Qt::WindowFlags flags)
|
||||
: QFrame(parent, flags), aspectRatio((qreal)CARD_HEIGHT / (qreal)CARD_WIDTH)
|
||||
@@ -51,7 +49,7 @@ void CardInfoDisplayWidget::setCard(const ExactCard &card)
|
||||
if (exactCard)
|
||||
connect(exactCard.getCardPtr().data(), &QObject::destroyed, this, &CardInfoDisplayWidget::clear);
|
||||
|
||||
text->setCard(exactCard.getCardPtr());
|
||||
text->setCard(exactCard);
|
||||
pic->setCard(exactCard);
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user