Commit graph

2717 commits

Author SHA1 Message Date
github-actions[bot]
7201e34b38
Update translation files (#4984)
Co-authored-by: github-actions <github-actions@github.com>
2024-01-18 20:50:28 +01:00
Basile Clement
6d032c378f
Improve drag & drop behavior (#4963)
* Improve drag & drop behavior

This patch tweaks the drag & drop behavior (in particular, the grid
placement) to be more intuitive. More precisely, with this patch the
drag & drop will:

 - Only use the "hot spot" (i.e. position of the cursor on the card)
   for zones where the card is actually displayed around the cursor (in
   particular, not on the table where the card snaps to the grid).

 - Use better boundaries computed with respect to the center of the
   card (rather than its top left corner) for determining which grid
   cell a card should go to

 - Align behavior of the preview and the actual effect when overflow of
   the 3-card stacks occurs

 - Avoid visual glitches where the cursor ends up outside of the card or
   at incorrect offsets when moving the mouse too fast (which translates
   to overflows of the hot spot computation)

* Address review comments

 - Use simpler computation for restricting hotSpot range
 - Prevent dropping cards onto full 3-card slots
2024-01-01 16:51:36 -05:00
ebbit1q
fa727524dc
make cards on the stack slightly overlap to stress order (#4930)
* make cards on the stack slightly overlap to stress order

dragging cards to the stack now places the card at the location it is
dropped

* make default play action append to stack

* add vertical overlap to settings and vertical hand

* Update cockatrice/src/dlg_settings.cpp

Co-authored-by: tooomm <tooomm@users.noreply.github.com>

* Fix format

---------

Co-authored-by: tooomm <tooomm@users.noreply.github.com>
Co-authored-by: ZeldaZach <zahalpern+github@gmail.com>
2023-12-15 14:00:58 -05:00
ebbit1q
28f80e18a0
add ctrl enter as shortcut for ok when setting annotation (#4929) 2023-12-15 13:55:11 -05:00
ebbit1q
4acc8bfe80
put cards on top in a random order (#4960) 2023-12-15 13:51:21 -05:00
Basile Clement
cb18a55338
Support fractional scaling when scaling card images (#4962)
Fixes #4880
2023-12-14 14:24:35 +01:00
Zach H
b73ef58567
Support WebP format for Card Images (#4950)
- Fix #4939
2023-12-09 00:52:14 -05:00
Zach H
519531f3a0
Support escaping single and double quotes in Deck Editor Search Regex Strings (#4948)
- Fix #4946
2023-12-09 00:51:54 -05:00
tooomm
4b8e47d079
Update default theme name (#4944) 2023-11-20 01:01:42 +01:00
transifex-integration[bot]
ed170f7e07
Updates for project Cockatrice and language de (#4942)
* Translate cockatrice/cockatrice_en@source.ts in de

100% translated source file: 'cockatrice/cockatrice_en@source.ts'
on 'de'.

* Translate oracle/oracle_en@source.ts in de

100% translated source file: 'oracle/oracle_en@source.ts'
on 'de'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-11-18 12:10:11 +01:00
transifex-integration[bot]
6bb559874c
Translate cockatrice/cockatrice_en@source.ts in it (#4941)
100% translated source file: 'cockatrice/cockatrice_en@source.ts'
on 'it'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-11-18 08:44:10 +01:00
transifex-integration[bot]
9cd68e25b3
Translate cockatrice/cockatrice_en@source.ts in de (#4937)
100% translated source file: 'cockatrice/cockatrice_en@source.ts'
on 'de'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-11-12 19:22:58 +01:00
transifex-integration[bot]
72ac441598
Updates for project Cockatrice and language de (#4934)
* Translate cockatrice/cockatrice_en@source.ts in de

100% translated source file: 'cockatrice/cockatrice_en@source.ts'
on 'de'.

* Translate cockatrice/cockatrice_en@source.ts in de

100% translated source file: 'cockatrice/cockatrice_en@source.ts'
on 'de'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-11-05 19:15:48 +01:00
tooomm
3e8adae3de
Rename "stack until found" feature (#4871)
* Rename "stack until found" feature

* lint
2023-10-25 18:43:57 +02:00
tooomm
9943133d6d
TOTD: Exchange Gitter for Discord, Fix date format (#4920)
* Update tips_of_the_day.xml

* Delete cockatrice/resources/tips/images/gitter.png

* Add Discord icon

* Update cockatrice.qrc

* date format
2023-10-24 14:26:38 +02:00
tooomm
a5706a47af
Include missing strings for translation (#4919) 2023-10-19 21:58:38 +02:00
github-actions[bot]
b3b911c64d
Update translation files (#4913)
Co-authored-by: github-actions <github-actions@github.com>
2023-10-18 20:41:14 +02:00
github-actions[bot]
05beb4fcaf
Update translation source strings (#4918) 2023-10-18 00:29:56 +02:00
Zach H
186f4289e9
Address /W4 compiler warnings for Windows (#4910) 2023-10-15 20:31:13 -04:00
Zach H
c1b0d50237
Handle Qt6.6 Deprecations (#4908) 2023-10-13 20:53:47 -04:00
transifex-integration[bot]
102be6a350
Translate cockatrice_en@source.ts in en_US [Manual Sync] (#4893)
98% of minimum 80% translated source file: 'cockatrice_en@source.ts'
on 'en_US'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-10-06 22:56:03 +02:00
transifex-integration[bot]
be6152948c
Updates for project Cockatrice and lanuage es on branch master (#4886)
* Translate i18n-default.json in es [Manual Sync]

99% of minimum 80% translated source file: 'i18n-default.json'
on 'es'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* Translate cockatrice_en@source.ts in es [Manual Sync]

98% of minimum 80% translated source file: 'cockatrice_en@source.ts'
on 'es'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* Translate i18n-default.json in es [Manual Sync]

99% of minimum 95% translated source file: 'i18n-default.json'
on 'es'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* Translate cockatrice_en@source.ts in es [Manual Sync]

98% of minimum 95% translated source file: 'cockatrice_en@source.ts'
on 'es'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-10-06 22:52:37 +02:00
transifex-integration[bot]
f14bf4b205
Updates for project Cockatrice and lanuage it on branch master (#4887)
* Translate i18n-default.json in it [Manual Sync]

99% of minimum 80% translated source file: 'i18n-default.json'
on 'it'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* Translate cockatrice_en@source.ts in it [Manual Sync]

98% of minimum 80% translated source file: 'cockatrice_en@source.ts'
on 'it'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* Translate i18n-default.json in it [Manual Sync]

99% of minimum 95% translated source file: 'i18n-default.json'
on 'it'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-10-06 21:37:59 +02:00
transifex-integration[bot]
123ac2ca25
Updates for project Cockatrice and lanuage fr on branch master (#4888)
* Translate cockatrice_en@source.ts in fr [Manual Sync]

98% of minimum 80% translated source file: 'cockatrice_en@source.ts'
on 'fr'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* Translate i18n-default.json in fr [Manual Sync]

99% of minimum 80% translated source file: 'i18n-default.json'
on 'fr'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* Translate i18n-default.json in fr [Manual Sync]

99% of minimum 95% translated source file: 'i18n-default.json'
on 'fr'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-10-06 21:36:56 +02:00
transifex-integration[bot]
7216b976ec
Updates for project Cockatrice and lanuage pt_BR on branch master (#4890)
* Translate cockatrice_en@source.ts in pt_BR [Manual Sync]

98% of minimum 80% translated source file: 'cockatrice_en@source.ts'
on 'pt_BR'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* Translate webclient/src/i18n-default.json in pt_BR

100% translated source file: 'webclient/src/i18n-default.json'
on 'pt_BR'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-10-06 21:36:16 +02:00
Zach H
b0470ab678
Move to OpenSSLv3 (& Drop 32-bit) (#4883) 2023-10-01 17:19:31 -04:00
transifex-integration[bot]
a8ba8b6ab5
Updates for project Cockatrice and lanuage de on branch master (#4867)
* Translate cockatrice/cockatrice_en@source.ts in de

100% translated source file: 'cockatrice/cockatrice_en@source.ts'
on 'de'.

* Translate cockatrice/cockatrice_en@source.ts in de

100% translated source file: 'cockatrice/cockatrice_en@source.ts'
on 'de'.

* Translate cockatrice/cockatrice_en@source.ts in de

100% translated source file: 'cockatrice/cockatrice_en@source.ts'
on 'de'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-09-11 21:24:57 +02:00
github-actions[bot]
e9eb7d6db1
Update translation source strings (#4865)
Co-authored-by: github-actions <github-actions@github.com>
2023-09-01 20:20:19 -04:00
tooomm
56d21321d0
remove translation string (#4860) 2023-08-18 12:34:54 -04:00
ebbit1q
90679d5669
fix issues with #4648 (#4864) 2023-08-18 12:34:17 -04:00
transifex-integration[bot]
ac5dc2578a
Translate cockatrice/cockatrice_en@source.ts in de (#4861)
100% translated source file: 'cockatrice/cockatrice_en@source.ts'
on 'de'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-08-13 20:51:02 +02:00
github-actions[bot]
0d76662311
Update translation source strings (#4843)
Co-authored-by: github-actions <github-actions@github.com>
2023-08-10 22:37:17 +02:00
Zach H
8c539351e3
Fix Mac Builds (#4844) 2023-08-06 22:45:45 -04:00
ebbit1q
e3552fc0ae
add more default shortcuts (#4349)
* add more default shortcuts

replace the ctrl a look at top of library shortcut with ctrl shift n
use ctl a for draw arrow
replace ctrl shift b for toggle sideboard lock
use ctrl b for move card to bottom of library
use ctrl shift l for start local game
add keyboard shortcuts for all 3 counter colors using , . / keys
use ctrl [ ] \ for the "other" counter
add ctrl = as an easy alternative to ctrl + for people without keypads
( on linux ctrl alt keypad + is a special key that is reserved in x
  it produces the XF86_Next_VMode keyboard event which isn't bindable )
use alt u for toggling untapping
use alt l for peeking at cards
use ctrl alt u for unattaching cards
use alt n for set annotation
use alt y for milling one card

* use alt f for flipping cards
2023-08-06 17:56:24 -04:00
ebbit1q
244cb847fb
replace trayicon activation with menu actions (#4632) 2023-08-06 17:55:02 -04:00
ebbit1q
7c20e9ab34
add move cards from top of library until dialog (#4648)
a bit of a hack, the client will use the play top card action and then
compare it with the propmpted expression, as if you were cascading
normally but really fast

the new keybind for this is ctrl shift y

I have ratelimited the action to 10 cards a second
2023-08-06 17:53:07 -04:00
ebbit1q
cb52605928
use a regex to remove all reserved characters from file names (#4804) 2023-08-06 17:46:22 -04:00
Guangcong Luo
bd3100dcda
Update macOS Monterey app icon (#4805) 2023-08-06 17:46:03 -04:00
ebbit1q
afb7c35cfd
add a way to replace the user facing list of disallowed words (#4807) 2023-08-06 17:45:37 -04:00
transifex-integration[bot]
800b21b000
Apply translations in pt_BR (#4801)
100% translated for the source file 'cockatrice/cockatrice_en@source.ts'
on the 'pt_BR' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-05-09 17:07:23 -04:00
ebbit1q
70ab02987a
save sets dialog size (#4791)
* save sets dialog size

* reset sorting when restoring

* add to gitignore
2023-04-29 23:10:59 -04:00
ebbit1q
421da882d8
qt 6.5 compatibility (#4796)
* remove metatypes definitions

* deprecation of QApplication::setActiveWindow
2023-04-29 23:09:26 -04:00
ebbit1q
9ce450d0b0
add _substr_[pos]_[len] to picture download templates (#4762) 2023-04-01 22:29:57 -04:00
tooomm
304ed3cd60
UI: User info dialog updates (#4533) 2023-04-01 21:50:49 -04:00
Basile Clement
55a2f75d16
Make cards rounded (#4765)
* Make cards rounded

Magic cards have rounded corners, and playing cards tend to have rounded
corners as well, but Cockatrice currently displays rectangular cards.

This can cause visual glitches when using image scans where the border
does not extend in the corner, and for this reason Cockatrice always
draws a (rectangular) border around the card to try and make it look a
bit better.

In this patch I take a different approach: rather than try to make
rounded pegs, er, cards, go into a square hole, the hole is now rounded.
More precisely, the AbstractCardItem now has a rounded rectangular shape
(with a corner of 5% of the width of the card, identical to that of
modern M:TG physical cards).

As a side effect, the card drawing gets a bit simplified by getting rid
of transformPainter() when drawing the card outline and using the
QPainter::drawPixmap overloads that takes a target QRectF instead.  This
means we no longer have to bother about card rotation when painting
since that's taken care of by the Graphics View framework (which
transformPainter() undoes).

* format

* Also give PileZone rounded corners

* Forgot untap status + bits of CardDragItem

* fix deckviewcard calculations

* Rounded CardInfoPicture
2023-03-07 01:41:08 +01:00
Basile Clement
c14936c63c
PictureLoader: Replace downloadedPics cache with QNetworkCache (#4756)
* PictureLoader: Replace downloadedPics cache with QNetworkCache

Currently when the "Download card pictures on the fly" option is
enabled, Cockatrice stores downloaded pictures into a downloadedPics
sub-folder, keyed on set and card name. If a picture is found in that
folder, we never try to download a picture for that card ever again
(until it is reprinted in a more recent set, I guess).

This has the unfortunate consequence that if you change the URLs for
downloading card images, the changes are not applied to cards that
already have their picture downloaded. In particular, if you use
localized card pictures (through !sflang!), you get a mix of cards in
different languages depending on the currently configured language at
the time each card was downloaded.

This patch removes that mechanism in favor of setting a
QNetworkDiskCache on the QNetworkAccessManager used by the PictureLoader
to download pictures. The QNetworkDiskCache caches the picture keyed on
their URL: if the URL changes, a new request will be made. In
particular, if you use picture URLs with !sflang! and change the
language, pictures for the current language will be downloaded even for
cards that already have a picture. The QNetworkDiskCache is configured
with a maximum size of 4GB, which should be enough to hold one
high-quality JPEG for each M:TG card in existence.

Note that this does not affect the existing mechanism for defining
custom card art, either through the CUSTOM directory or the set-based
one.  Cockatrice will still read existing cards in the downloadedPics
directory as before, it will just no longer write into that directory
(since pictures are cached by the QNetworkDiskCache instead). To fully
switch to the new cache, users should use the "Delete Downloaded Images"
button in the settings: it will clear the QNetworkDiskCache but also
remove the downloadedPics directory.

* Do not use system cache dir for portable installs

* Add settings for network cache size

* Delete corrupted cache entries

* Use old-style connect() syntax (Qt5 build failure)

* Add setNetworkCacheSizeInMB to test mocks

* setTransferTimeout was added in Qt 5.15

* Improve logging messages

We now have the following messages

 - "Trying to download picture from url: URL" before loading a picture
   when picture download is enabled
 - "Trying to load picture from cache: URL" before loading a picture
   when picture download is disabled (i.e. cache-only offline mode)
 - "Removing corrupted cache file for url URL and retrying (ERR)" when
   when we fail to load a picture from the cache. Usually, this should
   be due to the timeout, in which case ERR will be "Operation
   Canceled".
 - "Download failed for url URL (ERR)" when there was an error
   downloading a picture from the network (ERR is the error message)
 - "Following redirect to URL" and "Following cached redirect to URL"
   when following a redirect (from network/from cache)
 - "Image successfully downloaded from URL" and "Image successfully
   loaded from cached url at URL" on success
 - "Possible cached/downloaded picture at URL could not be loaded" on
   ImageReader error

* Clarify that network cache is on disk

Also migrate "Delete Downloaded Image" to a "Clear" button right next to
the network cache size.

* Remove qPrintable

* Move pixmap cache settings to card sources

* qDebug().nospace()

* some formatting on debug messages

* format

* inverted condition

---------

Co-authored-by: ebbit1q <ebbit1q@gmail.com>
2023-03-03 16:55:17 +01:00
Basile Clement
42e7a8b423
Better support Double-Faced Cards (#4753)
* Better support Double-Faced Cards

This patch allows cards to be (virtually) transformed into other cards
while preserving their state, essentially implemeting the MTG mechanic
of the same name.

On the server side, this is implemented by allowing cards to be "stashed
away". A card that is stashed away is not in any zone, but is instead
owned by another card. When a token is destroyed due to a zone change,
if it had a card stashed away, that card is placed in the target zone
instead of the token.

On the database side, `attach="transform"` is used on `<reverse>` and
`<reverse-related>` to indicate that the created token should be
transformed this way.

Old servers ignore the new field in `Command_CreateToken` and will
perform a regular attachment, as currently.

* Address review comments

* Prevent tokens from being stashed

* format.sh
2023-03-03 16:54:51 +01:00
SlightlyCircuitous
f444ba9665
Corrected edition search syntax (#4752)
* Replaced "e:lea,leb" with "e:lea or e:leb"
* Removed "e:lea,leb -(e:lea e:leb) (Cards that appear in Alpha or Beta but not in both editions)" as this does not produce results in Cockatrice (even when using "or" instead of "," as above)
2023-02-16 12:08:00 +01:00
Basile Clement
9a7b15d19b
Allow revealing specific cards from hand and library (#4743)
Currently Cockatrice allows revealing the whole hand, or one card at
random from the hand. Sometimes, a player needs to reveal a specific
card from their hand instead, which is not supported. To achieve a
similar effect, players usually move the corresponding card (or cards)
to a public zone, then back to their hand. While this works, it is
unsatisfactory (compared to a regular reveal, you can't keep the
"revealed" window around, for one) and somewhat unintuitive.

This patch adds a "Reveal to..." menu to cards and card selections in
the player's hand or in custom zones (this includes looking at the
player's library). This menu allows revealing a card or set of cards to
any given player, or to all players.

To implement this functionality at the protocol level, the existing
RevealCards command is extended to support revealing multiple specific
cards. This is done by making `card_id` a non-packed repeated field in
the `Command_RevealCards` and `Event_RevealCards` protobufs.  Using a
non-packed repeated fields allows maintaining backwards compatibility:
an empty optional field is encoded the same way as an empty non-packed
list, an optional field with a value is encoded the same way as a
one-element non-packed list, and when decoding a multi-elements
non-packed list as an optional, only the last item in the list is read.

Since the RevealCards command already exists, and due to the compatible
encodings, a new client connecting to an old server can reveal a single
specific card from their hand. When trying to reveal multiple cards at
once, the old server will only see the request for one of the cards to
be revealed, and the player will have to reveal each card separately.

On the other hand, `Event_RevealedCards` already has an explicit list of
cards revealed by the server, and the `card_id` field is only used when
exactly one card has been revealed: thus, old and new clients will
behave identically when receiving a new `Event_RevealedCards`. In
particular, if a player using a new client reveals multiple cards from
their hand on a new server, another player using an old client will
correctly see all the revealed cards.

The approach used to build the "Reveal to..." menu is slightly different
from the approach used to build other player selection menus. Because
the "Reveal to..." menu is specific to each card, but must also be
updated whenever a player is added to or removed from the game, I chose
to re-create it on the fly whenever a card is clicked, as that seemed
the safest way to avoid both memory leaks and inconsistent state given
my understanding of the code.
2023-02-07 17:12:04 -05:00
Basile Clement
00c9efe541
Enable buttons for current game when receiving server response (#4737)
* Enable buttons for current game when receiving server response

Previously, upon joining a game, we were unconditionally re-enabling the
"Join" button in the lobby, even if it was not enabled in the first
place, causing #4698. This could also lead to issues where if the user
selects a different game after joining (which they can do in case of
e.g. network connectivity issues), the "Join as spectator" button could
get incorrectly disabled.

This fixes #4698 by re-enabling the buttons based on the state of the
currently selected game at the time the response is received. This also
avoids inconsistencies if a different game has been selected in between
joining and receiving a response from the server.

* Typo: enable gameButton in enableButtons

The "create game" button was incorrectly being disabled in enableButtons
whereas (as the name indicates) it should have been enabled

* Remove misleading comment about race conditions
2023-02-06 13:49:45 +01:00