Merge remote-tracking branch 'origin/master' into jo-remove-name-filters-from-settings
|
@ -16,7 +16,7 @@ InstallDir "$PROGRAMFILES\Cockatrice"
|
||||||
!define MUI_HEADERIMAGE_UNBITMAP "${NSIS_SOURCE_PATH}\cmake\headerimage.bmp"
|
!define MUI_HEADERIMAGE_UNBITMAP "${NSIS_SOURCE_PATH}\cmake\headerimage.bmp"
|
||||||
!define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of Cockatrice.$\r$\n$\r$\nClick Next to continue."
|
!define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of Cockatrice.$\r$\n$\r$\nClick Next to continue."
|
||||||
!define MUI_FINISHPAGE_RUN "$INSTDIR/oracle.exe"
|
!define MUI_FINISHPAGE_RUN "$INSTDIR/oracle.exe"
|
||||||
!define MUI_FINISHPAGE_RUN_TEXT "Run card database downloader now"
|
!define MUI_FINISHPAGE_RUN_TEXT "Run 'Oracle' now to update your card database"
|
||||||
!define MUI_FINISHPAGE_RUN_PARAMETERS "-dlsets"
|
!define MUI_FINISHPAGE_RUN_PARAMETERS "-dlsets"
|
||||||
|
|
||||||
!insertmacro MUI_PAGE_WELCOME
|
!insertmacro MUI_PAGE_WELCOME
|
||||||
|
|
|
@ -31,12 +31,14 @@
|
||||||
<file>resources/icon_view.svg</file>
|
<file>resources/icon_view.svg</file>
|
||||||
<file>resources/hr.jpg</file>
|
<file>resources/hr.jpg</file>
|
||||||
<file alias="resources/appicon.svg">resources/cockatrice.svg</file>
|
<file alias="resources/appicon.svg">resources/cockatrice.svg</file>
|
||||||
|
|
||||||
<file>resources/add_to_sideboard.svg</file>
|
<file>resources/add_to_sideboard.svg</file>
|
||||||
<file>resources/decrement.svg</file>
|
<file>resources/decrement.svg</file>
|
||||||
<file>resources/increment.svg</file>
|
<file>resources/increment.svg</file>
|
||||||
<file>resources/remove_row.svg</file>
|
<file>resources/remove_row.svg</file>
|
||||||
<file>resources/arrow_left_green.svg</file>
|
<file>resources/arrow_left_green.svg</file>
|
||||||
<file>resources/arrow_right_green.svg</file>
|
<file>resources/arrow_right_green.svg</file>
|
||||||
|
|
||||||
<file>resources/icon_ready_start.svg</file>
|
<file>resources/icon_ready_start.svg</file>
|
||||||
<file>resources/icon_not_ready_start.svg</file>
|
<file>resources/icon_not_ready_start.svg</file>
|
||||||
<file>resources/icon_conceded.svg</file>
|
<file>resources/icon_conceded.svg</file>
|
||||||
|
@ -320,8 +322,11 @@
|
||||||
|
|
||||||
<file>resources/userlevels/normal.svg</file>
|
<file>resources/userlevels/normal.svg</file>
|
||||||
<file>resources/userlevels/registered.svg</file>
|
<file>resources/userlevels/registered.svg</file>
|
||||||
|
<file>resources/userlevels/registered_buddy.svg</file>
|
||||||
<file>resources/userlevels/moderator.svg</file>
|
<file>resources/userlevels/moderator.svg</file>
|
||||||
|
<file>resources/userlevels/moderator_buddy.svg</file>
|
||||||
<file>resources/userlevels/admin.svg</file>
|
<file>resources/userlevels/admin.svg</file>
|
||||||
|
<file>resources/userlevels/admin_buddy.svg</file>
|
||||||
|
|
||||||
<file>resources/news/exclamation_mark.svg</file>
|
<file>resources/news/exclamation_mark.svg</file>
|
||||||
<file>resources/news/question_mark.svg</file>
|
<file>resources/news/question_mark.svg</file>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
<svg
|
<svg
|
||||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
xmlns:cc="http://creativecommons.org/ns#"
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
@ -13,9 +14,9 @@
|
||||||
height="64"
|
height="64"
|
||||||
id="svg2646"
|
id="svg2646"
|
||||||
sodipodi:version="0.32"
|
sodipodi:version="0.32"
|
||||||
inkscape:version="0.46"
|
inkscape:version="0.48.5 r10040"
|
||||||
version="1.0"
|
version="1.0"
|
||||||
sodipodi:docname="decrement.svg"
|
sodipodi:docname="deck_editor_decrement.svg"
|
||||||
inkscape:output_extension="org.inkscape.output.svg.inkscape">
|
inkscape:output_extension="org.inkscape.output.svg.inkscape">
|
||||||
<defs
|
<defs
|
||||||
id="defs2648">
|
id="defs2648">
|
||||||
|
@ -161,15 +162,16 @@
|
||||||
inkscape:pageopacity="0.0"
|
inkscape:pageopacity="0.0"
|
||||||
inkscape:pageshadow="2"
|
inkscape:pageshadow="2"
|
||||||
inkscape:zoom="7.625"
|
inkscape:zoom="7.625"
|
||||||
inkscape:cx="-58.636066"
|
inkscape:cx="26.34754"
|
||||||
inkscape:cy="34.091284"
|
inkscape:cy="29.107677"
|
||||||
inkscape:document-units="px"
|
inkscape:document-units="px"
|
||||||
inkscape:current-layer="layer2"
|
inkscape:current-layer="layer2"
|
||||||
showgrid="false"
|
showgrid="false"
|
||||||
inkscape:window-width="1272"
|
inkscape:window-width="1445"
|
||||||
inkscape:window-height="723"
|
inkscape:window-height="893"
|
||||||
inkscape:window-x="0"
|
inkscape:window-x="0"
|
||||||
inkscape:window-y="25" />
|
inkscape:window-y="25"
|
||||||
|
inkscape:window-maximized="0" />
|
||||||
<metadata
|
<metadata
|
||||||
id="metadata2651">
|
id="metadata2651">
|
||||||
<rdf:RDF>
|
<rdf:RDF>
|
||||||
|
@ -192,7 +194,7 @@
|
||||||
inkscape:label="Pfeil"
|
inkscape:label="Pfeil"
|
||||||
style="display:inline">
|
style="display:inline">
|
||||||
<rect
|
<rect
|
||||||
style="fill:#96ff96;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:3;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;display:inline"
|
style="fill:#ff7672;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:3;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;display:inline"
|
||||||
id="rect3548"
|
id="rect3548"
|
||||||
width="14.386732"
|
width="14.386732"
|
||||||
height="59.259636"
|
height="59.259636"
|
||||||
|
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.2 KiB |
|
@ -1,5 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
<svg
|
<svg
|
||||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
xmlns:cc="http://creativecommons.org/ns#"
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
@ -13,9 +14,9 @@
|
||||||
height="64"
|
height="64"
|
||||||
id="svg2646"
|
id="svg2646"
|
||||||
sodipodi:version="0.32"
|
sodipodi:version="0.32"
|
||||||
inkscape:version="0.46"
|
inkscape:version="0.48.5 r10040"
|
||||||
version="1.0"
|
version="1.0"
|
||||||
sodipodi:docname="remove_row.svg"
|
sodipodi:docname="deck_editor_remove_row.svg"
|
||||||
inkscape:output_extension="org.inkscape.output.svg.inkscape">
|
inkscape:output_extension="org.inkscape.output.svg.inkscape">
|
||||||
<defs
|
<defs
|
||||||
id="defs2648">
|
id="defs2648">
|
||||||
|
@ -316,15 +317,16 @@
|
||||||
inkscape:pageopacity="0.0"
|
inkscape:pageopacity="0.0"
|
||||||
inkscape:pageshadow="2"
|
inkscape:pageshadow="2"
|
||||||
inkscape:zoom="7.625"
|
inkscape:zoom="7.625"
|
||||||
inkscape:cx="-50.74814"
|
inkscape:cx="-27.27273"
|
||||||
inkscape:cy="31.784541"
|
inkscape:cy="30.210771"
|
||||||
inkscape:document-units="px"
|
inkscape:document-units="px"
|
||||||
inkscape:current-layer="layer2"
|
inkscape:current-layer="layer2"
|
||||||
showgrid="false"
|
showgrid="false"
|
||||||
inkscape:window-width="1272"
|
inkscape:window-width="1272"
|
||||||
inkscape:window-height="723"
|
inkscape:window-height="723"
|
||||||
inkscape:window-x="0"
|
inkscape:window-x="0"
|
||||||
inkscape:window-y="25" />
|
inkscape:window-y="25"
|
||||||
|
inkscape:window-maximized="0" />
|
||||||
<metadata
|
<metadata
|
||||||
id="metadata2651">
|
id="metadata2651">
|
||||||
<rdf:RDF>
|
<rdf:RDF>
|
||||||
|
@ -347,7 +349,7 @@
|
||||||
inkscape:label="Pfeil"
|
inkscape:label="Pfeil"
|
||||||
style="display:inline">
|
style="display:inline">
|
||||||
<path
|
<path
|
||||||
style="fill:#96ff96;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:3;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;display:inline"
|
style="fill:#ff7672;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:3;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;display:inline"
|
||||||
d="M 6.433227,14.50946 L 23.923767,32 L 6.433227,49.490541 L 14.50946,57.566773 L 32,40.076233 L 49.490541,57.566773 L 57.566773,49.490541 L 40.076233,32 L 57.566773,14.50946 L 49.490541,6.433227 L 32,23.923767 L 14.50946,6.433227 L 6.433227,14.50946 z"
|
d="M 6.433227,14.50946 L 23.923767,32 L 6.433227,49.490541 L 14.50946,57.566773 L 32,40.076233 L 49.490541,57.566773 L 57.566773,49.490541 L 40.076233,32 L 57.566773,14.50946 L 49.490541,6.433227 L 32,23.923767 L 14.50946,6.433227 L 6.433227,14.50946 z"
|
||||||
id="rect3548" />
|
id="rect3548" />
|
||||||
</g>
|
</g>
|
||||||
|
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
125
cockatrice/resources/userlevels/admin_buddy.svg
Normal file
|
@ -0,0 +1,125 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
viewBox="0 0 64 64"
|
||||||
|
enable-background="new 0 0 64 64"
|
||||||
|
id="svg2"
|
||||||
|
version="1.1"
|
||||||
|
inkscape:version="0.48.5 r10040"
|
||||||
|
width="100%"
|
||||||
|
height="100%"
|
||||||
|
sodipodi:docname="admin_buddy.svg">
|
||||||
|
<metadata
|
||||||
|
id="metadata12">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<defs
|
||||||
|
id="defs10">
|
||||||
|
<linearGradient
|
||||||
|
id="linearGradient5225">
|
||||||
|
<stop
|
||||||
|
style="stop-color:#ffffff;stop-opacity:1;"
|
||||||
|
offset="0"
|
||||||
|
id="stop5227" />
|
||||||
|
<stop
|
||||||
|
style="stop-color:#ffffff;stop-opacity:0;"
|
||||||
|
offset="1"
|
||||||
|
id="stop5229" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient
|
||||||
|
id="linearGradient5219"
|
||||||
|
osb:paint="solid">
|
||||||
|
<stop
|
||||||
|
style="stop-color:#ffffff;stop-opacity:1;"
|
||||||
|
offset="0"
|
||||||
|
id="stop5221" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient
|
||||||
|
id="linearGradient3758">
|
||||||
|
<stop
|
||||||
|
id="stop3760"
|
||||||
|
offset="0"
|
||||||
|
style="stop-color:#0fbb00;stop-opacity:1;" />
|
||||||
|
<stop
|
||||||
|
id="stop3762"
|
||||||
|
offset="1"
|
||||||
|
style="stop-color:#064400;stop-opacity:1;" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient
|
||||||
|
id="linearGradient3750">
|
||||||
|
<stop
|
||||||
|
style="stop-color:#ece400;stop-opacity:1;"
|
||||||
|
offset="0"
|
||||||
|
id="stop3752" />
|
||||||
|
<stop
|
||||||
|
style="stop-color:#ece400;stop-opacity:0;"
|
||||||
|
offset="1"
|
||||||
|
id="stop3754" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient3758-7"
|
||||||
|
id="linearGradient3756-1"
|
||||||
|
x1="1.960216"
|
||||||
|
y1="31.261461"
|
||||||
|
x2="60.456024"
|
||||||
|
y2="31.261461"
|
||||||
|
gradientUnits="userSpaceOnUse" />
|
||||||
|
<linearGradient
|
||||||
|
id="linearGradient3758-7">
|
||||||
|
<stop
|
||||||
|
id="stop3760-4"
|
||||||
|
offset="0"
|
||||||
|
style="stop-color:#ece400;stop-opacity:1;" />
|
||||||
|
<stop
|
||||||
|
id="stop3762-0"
|
||||||
|
offset="1"
|
||||||
|
style="stop-color:#ec8b00;stop-opacity:1;" />
|
||||||
|
</linearGradient>
|
||||||
|
</defs>
|
||||||
|
<sodipodi:namedview
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1"
|
||||||
|
objecttolerance="10"
|
||||||
|
gridtolerance="10"
|
||||||
|
guidetolerance="10"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:window-width="1920"
|
||||||
|
inkscape:window-height="1028"
|
||||||
|
id="namedview8"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:zoom="5.2149125"
|
||||||
|
inkscape:cx="21.988178"
|
||||||
|
inkscape:cy="51.245759"
|
||||||
|
inkscape:window-x="-8"
|
||||||
|
inkscape:window-y="-8"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="svg2" />
|
||||||
|
<path
|
||||||
|
d="M 61.442826,23.621762 38.532402,23.515555 31.556101,0.331013 24.578789,23.515555 1.6673502,23.621765 20.267785,38.422001 10.863888,63.668987 31.556101,47.626631 52.258426,63.668987 42.843404,38.422001 z"
|
||||||
|
id="path4-9"
|
||||||
|
style="fill:#000000;fill-opacity:1"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
|
<path
|
||||||
|
d="M 57.150089,25.064396 37.504323,24.973324 31.522122,5.092503 25.539054,24.973324 5.8924192,25.064399 21.842354,37.75565 13.778482,59.405024 31.522122,45.64865 49.274434,59.405024 41.201022,37.75565 z"
|
||||||
|
id="path4"
|
||||||
|
style="fill:#ff0000;fill-opacity:1;fill-rule:nonzero"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
|
</svg>
|
After Width: | Height: | Size: 3.8 KiB |
147
cockatrice/resources/userlevels/moderator_buddy.svg
Normal file
|
@ -0,0 +1,147 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
viewBox="0 0 64 64"
|
||||||
|
enable-background="new 0 0 64 64"
|
||||||
|
id="svg2"
|
||||||
|
version="1.1"
|
||||||
|
inkscape:version="0.48.5 r10040"
|
||||||
|
width="100%"
|
||||||
|
height="100%"
|
||||||
|
sodipodi:docname="registered_buddy - Copy.svg">
|
||||||
|
<metadata
|
||||||
|
id="metadata12">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<defs
|
||||||
|
id="defs10">
|
||||||
|
<pattern
|
||||||
|
inkscape:stockid="Stripes 1:1 white"
|
||||||
|
id="Strips1_1white"
|
||||||
|
patternTransform="translate(0,0) scale(10,10)"
|
||||||
|
height="1"
|
||||||
|
width="2"
|
||||||
|
patternUnits="userSpaceOnUse"
|
||||||
|
inkscape:collect="always">
|
||||||
|
<rect
|
||||||
|
id="rect4484"
|
||||||
|
height="2"
|
||||||
|
width="1"
|
||||||
|
y="-0.5"
|
||||||
|
x="0"
|
||||||
|
style="fill:white;stroke:none" />
|
||||||
|
</pattern>
|
||||||
|
<linearGradient
|
||||||
|
id="linearGradient5225">
|
||||||
|
<stop
|
||||||
|
style="stop-color:#ffffff;stop-opacity:1;"
|
||||||
|
offset="0"
|
||||||
|
id="stop5227" />
|
||||||
|
<stop
|
||||||
|
style="stop-color:#ffffff;stop-opacity:0;"
|
||||||
|
offset="1"
|
||||||
|
id="stop5229" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient
|
||||||
|
id="linearGradient5219"
|
||||||
|
osb:paint="solid">
|
||||||
|
<stop
|
||||||
|
style="stop-color:#ffffff;stop-opacity:1;"
|
||||||
|
offset="0"
|
||||||
|
id="stop5221" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient
|
||||||
|
id="linearGradient3758">
|
||||||
|
<stop
|
||||||
|
id="stop3760"
|
||||||
|
offset="0"
|
||||||
|
style="stop-color:#0fbb00;stop-opacity:1;" />
|
||||||
|
<stop
|
||||||
|
id="stop3762"
|
||||||
|
offset="1"
|
||||||
|
style="stop-color:#064400;stop-opacity:1;" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient
|
||||||
|
id="linearGradient3750">
|
||||||
|
<stop
|
||||||
|
style="stop-color:#ece400;stop-opacity:1;"
|
||||||
|
offset="0"
|
||||||
|
id="stop3752" />
|
||||||
|
<stop
|
||||||
|
style="stop-color:#ece400;stop-opacity:0;"
|
||||||
|
offset="1"
|
||||||
|
id="stop3754" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient3758-7"
|
||||||
|
id="linearGradient3756-1"
|
||||||
|
x1="1.960216"
|
||||||
|
y1="31.261461"
|
||||||
|
x2="60.456024"
|
||||||
|
y2="31.261461"
|
||||||
|
gradientUnits="userSpaceOnUse" />
|
||||||
|
<linearGradient
|
||||||
|
id="linearGradient3758-7">
|
||||||
|
<stop
|
||||||
|
id="stop3760-4"
|
||||||
|
offset="0"
|
||||||
|
style="stop-color:#ece400;stop-opacity:1;" />
|
||||||
|
<stop
|
||||||
|
id="stop3762-0"
|
||||||
|
offset="1"
|
||||||
|
style="stop-color:#ec8b00;stop-opacity:1;" />
|
||||||
|
</linearGradient>
|
||||||
|
</defs>
|
||||||
|
<sodipodi:namedview
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1"
|
||||||
|
objecttolerance="10"
|
||||||
|
gridtolerance="10"
|
||||||
|
guidetolerance="10"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:window-width="1920"
|
||||||
|
inkscape:window-height="1028"
|
||||||
|
id="namedview8"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:zoom="5.2149125"
|
||||||
|
inkscape:cx="51.90239"
|
||||||
|
inkscape:cy="51.245759"
|
||||||
|
inkscape:window-x="-8"
|
||||||
|
inkscape:window-y="-8"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="svg2" />
|
||||||
|
<path
|
||||||
|
d="M 61.442826,23.621762 38.532402,23.515555 31.556101,0.331013 24.578789,23.515555 1.6673502,23.621765 20.267785,38.422001 10.863888,63.668987 31.556101,47.626631 52.258426,63.668987 42.843404,38.422001 z"
|
||||||
|
id="path4-9"
|
||||||
|
style="fill:#000000;fill-opacity:1"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
|
<path
|
||||||
|
d="M 57.150089,25.064396 37.504323,24.973324 31.522122,5.092503 25.539054,24.973324 5.8924192,25.064399 21.842354,37.75565 13.778482,59.405024 31.522122,45.64865 49.274434,59.405024 41.201022,37.75565 z"
|
||||||
|
id="path4"
|
||||||
|
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
|
<path
|
||||||
|
d="M 57.165891,25.072777 37.520125,24.981707 31.537924,5.1008868 c 0.05101,40.5880862 0.05344,-0.1118618 0,40.5561512 L 49.290236,59.413412 41.216824,37.764038 z"
|
||||||
|
id="path4-1"
|
||||||
|
style="fill:#000000;fill-opacity:1;fill-rule:nonzero"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
sodipodi:nodetypes="ccccccc" />
|
||||||
|
</svg>
|
After Width: | Height: | Size: 4.5 KiB |
115
cockatrice/resources/userlevels/registered_buddy.svg
Normal file
|
@ -0,0 +1,115 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
viewBox="0 0 64 64"
|
||||||
|
enable-background="new 0 0 64 64"
|
||||||
|
id="svg2"
|
||||||
|
version="1.1"
|
||||||
|
inkscape:version="0.48.5 r10040"
|
||||||
|
width="100%"
|
||||||
|
height="100%"
|
||||||
|
sodipodi:docname="buddy_icon.svg">
|
||||||
|
<metadata
|
||||||
|
id="metadata12">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<defs
|
||||||
|
id="defs10">
|
||||||
|
<linearGradient
|
||||||
|
id="linearGradient3758">
|
||||||
|
<stop
|
||||||
|
id="stop3760"
|
||||||
|
offset="0"
|
||||||
|
style="stop-color:#0fbb00;stop-opacity:1;" />
|
||||||
|
<stop
|
||||||
|
id="stop3762"
|
||||||
|
offset="1"
|
||||||
|
style="stop-color:#064400;stop-opacity:1;" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient
|
||||||
|
id="linearGradient3750">
|
||||||
|
<stop
|
||||||
|
style="stop-color:#ece400;stop-opacity:1;"
|
||||||
|
offset="0"
|
||||||
|
id="stop3752" />
|
||||||
|
<stop
|
||||||
|
style="stop-color:#ece400;stop-opacity:0;"
|
||||||
|
offset="1"
|
||||||
|
id="stop3754" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient3758"
|
||||||
|
id="linearGradient3756"
|
||||||
|
x1="1.960216"
|
||||||
|
y1="31.261461"
|
||||||
|
x2="60.456024"
|
||||||
|
y2="31.261461"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
gradientTransform="matrix(0.87626222,0,0,0.87626222,4.174756,4.8555263)" />
|
||||||
|
<linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient3758-7"
|
||||||
|
id="linearGradient3756-1"
|
||||||
|
x1="1.960216"
|
||||||
|
y1="31.261461"
|
||||||
|
x2="60.456024"
|
||||||
|
y2="31.261461"
|
||||||
|
gradientUnits="userSpaceOnUse" />
|
||||||
|
<linearGradient
|
||||||
|
id="linearGradient3758-7">
|
||||||
|
<stop
|
||||||
|
id="stop3760-4"
|
||||||
|
offset="0"
|
||||||
|
style="stop-color:#ece400;stop-opacity:1;" />
|
||||||
|
<stop
|
||||||
|
id="stop3762-0"
|
||||||
|
offset="1"
|
||||||
|
style="stop-color:#ec8b00;stop-opacity:1;" />
|
||||||
|
</linearGradient>
|
||||||
|
</defs>
|
||||||
|
<sodipodi:namedview
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1"
|
||||||
|
objecttolerance="10"
|
||||||
|
gridtolerance="10"
|
||||||
|
guidetolerance="10"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:window-width="1600"
|
||||||
|
inkscape:window-height="1178"
|
||||||
|
id="namedview8"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:zoom="7.375"
|
||||||
|
inkscape:cx="-14.986549"
|
||||||
|
inkscape:cy="23.31428"
|
||||||
|
inkscape:window-x="1912"
|
||||||
|
inkscape:window-y="227"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="svg2" />
|
||||||
|
<path
|
||||||
|
d="M 61.442826,23.621762 38.532402,23.515555 31.556101,0.331013 24.578789,23.515555 1.6673502,23.621765 20.267785,38.422001 10.863888,63.668987 31.556101,47.626631 52.258426,63.668987 42.843404,38.422001 z"
|
||||||
|
id="path4-9"
|
||||||
|
style="fill:#000000;fill-opacity:1"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
|
<path
|
||||||
|
d="M 57.150089,25.064396 37.504323,24.973324 31.522122,5.092503 25.539054,24.973324 5.8924192,25.064399 21.842354,37.75565 13.778482,59.405024 31.522122,45.64865 49.274434,59.405024 41.201022,37.75565 z"
|
||||||
|
id="path4"
|
||||||
|
style="fill:url(#linearGradient3756);fill-opacity:1"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
|
</svg>
|
After Width: | Height: | Size: 3.6 KiB |
|
@ -365,6 +365,7 @@ CardInfo::CardInfo(CardDatabase *_db,
|
||||||
const QString &_name,
|
const QString &_name,
|
||||||
bool _isToken,
|
bool _isToken,
|
||||||
const QString &_manacost,
|
const QString &_manacost,
|
||||||
|
const QString &_cmc,
|
||||||
const QString &_cardtype,
|
const QString &_cardtype,
|
||||||
const QString &_powtough,
|
const QString &_powtough,
|
||||||
const QString &_text,
|
const QString &_text,
|
||||||
|
@ -381,6 +382,7 @@ CardInfo::CardInfo(CardDatabase *_db,
|
||||||
isToken(_isToken),
|
isToken(_isToken),
|
||||||
sets(_sets),
|
sets(_sets),
|
||||||
manacost(_manacost),
|
manacost(_manacost),
|
||||||
|
cmc(_cmc),
|
||||||
cardtype(_cardtype),
|
cardtype(_cardtype),
|
||||||
powtough(_powtough),
|
powtough(_powtough),
|
||||||
text(_text),
|
text(_text),
|
||||||
|
@ -571,6 +573,7 @@ static QXmlStreamWriter &operator<<(QXmlStreamWriter &xml, const CardInfo *info)
|
||||||
xml.writeTextElement("color", colors[i]);
|
xml.writeTextElement("color", colors[i]);
|
||||||
|
|
||||||
xml.writeTextElement("manacost", info->getManaCost());
|
xml.writeTextElement("manacost", info->getManaCost());
|
||||||
|
xml.writeTextElement("cmc", info->getCmc());
|
||||||
xml.writeTextElement("type", info->getCardType());
|
xml.writeTextElement("type", info->getCardType());
|
||||||
if (!info->getPowTough().isEmpty())
|
if (!info->getPowTough().isEmpty())
|
||||||
xml.writeTextElement("pt", info->getPowTough());
|
xml.writeTextElement("pt", info->getPowTough());
|
||||||
|
@ -731,7 +734,7 @@ void CardDatabase::loadCardsFromXml(QXmlStreamReader &xml, bool tokens)
|
||||||
if (xml.readNext() == QXmlStreamReader::EndElement)
|
if (xml.readNext() == QXmlStreamReader::EndElement)
|
||||||
break;
|
break;
|
||||||
if (xml.name() == "card") {
|
if (xml.name() == "card") {
|
||||||
QString name, manacost, type, pt, text;
|
QString name, manacost, cmc, type, pt, text;
|
||||||
QStringList colors;
|
QStringList colors;
|
||||||
QStringMap customPicURLs, customPicURLsHq;
|
QStringMap customPicURLs, customPicURLsHq;
|
||||||
MuidMap muids;
|
MuidMap muids;
|
||||||
|
@ -747,6 +750,8 @@ void CardDatabase::loadCardsFromXml(QXmlStreamReader &xml, bool tokens)
|
||||||
name = xml.readElementText();
|
name = xml.readElementText();
|
||||||
else if (xml.name() == "manacost")
|
else if (xml.name() == "manacost")
|
||||||
manacost = xml.readElementText();
|
manacost = xml.readElementText();
|
||||||
|
else if (xml.name() == "cmc")
|
||||||
|
cmc = xml.readElementText();
|
||||||
else if (xml.name() == "type")
|
else if (xml.name() == "type")
|
||||||
type = xml.readElementText();
|
type = xml.readElementText();
|
||||||
else if (xml.name() == "pt")
|
else if (xml.name() == "pt")
|
||||||
|
@ -779,7 +784,7 @@ void CardDatabase::loadCardsFromXml(QXmlStreamReader &xml, bool tokens)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isToken == tokens) {
|
if (isToken == tokens) {
|
||||||
addCard(new CardInfo(this, name, isToken, manacost, type, pt, text, colors, loyalty, cipt, tableRow, sets, customPicURLs, customPicURLsHq, muids));
|
addCard(new CardInfo(this, name, isToken, manacost, cmc, type, pt, text, colors, loyalty, cipt, tableRow, sets, customPicURLs, customPicURLsHq, muids));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,6 +111,7 @@ private:
|
||||||
bool isToken;
|
bool isToken;
|
||||||
SetList sets;
|
SetList sets;
|
||||||
QString manacost;
|
QString manacost;
|
||||||
|
QString cmc;
|
||||||
QString cardtype;
|
QString cardtype;
|
||||||
QString powtough;
|
QString powtough;
|
||||||
QString text;
|
QString text;
|
||||||
|
@ -126,6 +127,7 @@ public:
|
||||||
const QString &_name = QString(),
|
const QString &_name = QString(),
|
||||||
bool _isToken = false,
|
bool _isToken = false,
|
||||||
const QString &_manacost = QString(),
|
const QString &_manacost = QString(),
|
||||||
|
const QString &_cmc = QString(),
|
||||||
const QString &_cardtype = QString(),
|
const QString &_cardtype = QString(),
|
||||||
const QString &_powtough = QString(),
|
const QString &_powtough = QString(),
|
||||||
const QString &_text = QString(),
|
const QString &_text = QString(),
|
||||||
|
@ -142,12 +144,14 @@ public:
|
||||||
bool getIsToken() const { return isToken; }
|
bool getIsToken() const { return isToken; }
|
||||||
const SetList &getSets() const { return sets; }
|
const SetList &getSets() const { return sets; }
|
||||||
const QString &getManaCost() const { return manacost; }
|
const QString &getManaCost() const { return manacost; }
|
||||||
|
const QString &getCmc() const { return cmc; }
|
||||||
const QString &getCardType() const { return cardtype; }
|
const QString &getCardType() const { return cardtype; }
|
||||||
const QString &getPowTough() const { return powtough; }
|
const QString &getPowTough() const { return powtough; }
|
||||||
const QString &getText() const { return text; }
|
const QString &getText() const { return text; }
|
||||||
const int &getLoyalty() const { return loyalty; }
|
const int &getLoyalty() const { return loyalty; }
|
||||||
bool getCipt() const { return cipt; }
|
bool getCipt() const { return cipt; }
|
||||||
void setManaCost(const QString &_manaCost) { manacost = _manaCost; emit cardInfoChanged(this); }
|
void setManaCost(const QString &_manaCost) { manacost = _manaCost; emit cardInfoChanged(this); }
|
||||||
|
void setCmc(const QString &_cmc) { cmc = _cmc; emit cardInfoChanged(this); }
|
||||||
void setCardType(const QString &_cardType) { cardtype = _cardType; emit cardInfoChanged(this); }
|
void setCardType(const QString &_cardType) { cardtype = _cardType; emit cardInfoChanged(this); }
|
||||||
void setPowTough(const QString &_powTough) { powtough = _powTough; emit cardInfoChanged(this); }
|
void setPowTough(const QString &_powTough) { powtough = _powTough; emit cardInfoChanged(this); }
|
||||||
void setText(const QString &_text) { text = _text; emit cardInfoChanged(this); }
|
void setText(const QString &_text) { text = _text; emit cardInfoChanged(this); }
|
||||||
|
|
|
@ -31,6 +31,8 @@ const char *CardFilter::attrName(Attr a)
|
||||||
return "set";
|
return "set";
|
||||||
case AttrManaCost:
|
case AttrManaCost:
|
||||||
return "mana cost";
|
return "mana cost";
|
||||||
|
case AttrCmc:
|
||||||
|
return "cmc";
|
||||||
default:
|
default:
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ public:
|
||||||
AttrText,
|
AttrText,
|
||||||
AttrSet,
|
AttrSet,
|
||||||
AttrManaCost,
|
AttrManaCost,
|
||||||
|
AttrCmc,
|
||||||
AttrEnd
|
AttrEnd
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QDebug>
|
||||||
#include "chatview.h"
|
#include "chatview.h"
|
||||||
#include "user_level.h"
|
#include "user_level.h"
|
||||||
#include "user_context_menu.h"
|
#include "user_context_menu.h"
|
||||||
|
@ -11,7 +13,7 @@
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "tab_userlists.h"
|
#include "tab_userlists.h"
|
||||||
|
|
||||||
const QColor MENTION_COLOR = QColor(190, 25, 85); // maroon
|
const QColor DEFAULT_MENTION_COLOR = QColor(194, 31, 47);
|
||||||
const QColor OTHER_USER_COLOR = QColor(0, 65, 255); // dark blue
|
const QColor OTHER_USER_COLOR = QColor(0, 65, 255); // dark blue
|
||||||
|
|
||||||
ChatView::ChatView(const TabSupervisor *_tabSupervisor, TabGame *_game, bool _showTimestamps, QWidget *parent)
|
ChatView::ChatView(const TabSupervisor *_tabSupervisor, TabGame *_game, bool _showTimestamps, QWidget *parent)
|
||||||
|
@ -25,8 +27,6 @@ ChatView::ChatView(const TabSupervisor *_tabSupervisor, TabGame *_game, bool _sh
|
||||||
mention = "@" + userName.toLower();
|
mention = "@" + userName.toLower();
|
||||||
|
|
||||||
mentionFormat.setFontWeight(QFont::Bold);
|
mentionFormat.setFontWeight(QFont::Bold);
|
||||||
mentionFormat.setForeground(QBrush(Qt::white));
|
|
||||||
mentionFormat.setBackground(QBrush(MENTION_COLOR));
|
|
||||||
|
|
||||||
mentionFormatOtherUser.setFontWeight(QFont::Bold);
|
mentionFormatOtherUser.setFontWeight(QFont::Bold);
|
||||||
mentionFormatOtherUser.setForeground(Qt::blue);
|
mentionFormatOtherUser.setForeground(Qt::blue);
|
||||||
|
@ -117,8 +117,8 @@ void ChatView::appendMessage(QString message, QString sender, UserLevelFlags use
|
||||||
|
|
||||||
QTextCharFormat senderFormat;
|
QTextCharFormat senderFormat;
|
||||||
if (tabSupervisor && tabSupervisor->getUserInfo() && (sender == QString::fromStdString(tabSupervisor->getUserInfo()->name()))) {
|
if (tabSupervisor && tabSupervisor->getUserInfo() && (sender == QString::fromStdString(tabSupervisor->getUserInfo()->name()))) {
|
||||||
|
senderFormat.setForeground(QBrush(getCustomMentionColor()));
|
||||||
senderFormat.setFontWeight(QFont::Bold);
|
senderFormat.setFontWeight(QFont::Bold);
|
||||||
senderFormat.setForeground(QBrush(MENTION_COLOR));
|
|
||||||
} else {
|
} else {
|
||||||
senderFormat.setForeground(QBrush(OTHER_USER_COLOR));
|
senderFormat.setForeground(QBrush(OTHER_USER_COLOR));
|
||||||
if (playerBold)
|
if (playerBold)
|
||||||
|
@ -129,7 +129,8 @@ void ChatView::appendMessage(QString message, QString sender, UserLevelFlags use
|
||||||
if (!sameSender) {
|
if (!sameSender) {
|
||||||
if (!sender.isEmpty()) {
|
if (!sender.isEmpty()) {
|
||||||
const int pixelSize = QFontInfo(cursor.charFormat().font()).pixelSize();
|
const int pixelSize = QFontInfo(cursor.charFormat().font()).pixelSize();
|
||||||
cursor.insertImage(UserLevelPixmapGenerator::generatePixmap(pixelSize, userLevel).toImage(), QString::number(pixelSize) + "_" + QString::number((int) userLevel));
|
QMap<QString, UserListTWI *> buddyList = tabSupervisor->getUserListsTab()->getBuddyList()->getUsers();
|
||||||
|
cursor.insertImage(UserLevelPixmapGenerator::generatePixmap(pixelSize, userLevel, buddyList.contains(sender)).toImage());
|
||||||
cursor.insertText(" ");
|
cursor.insertText(" ");
|
||||||
}
|
}
|
||||||
cursor.setCharFormat(senderFormat);
|
cursor.setCharFormat(senderFormat);
|
||||||
|
@ -194,12 +195,15 @@ void ChatView::appendMessage(QString message, QString sender, UserLevelFlags use
|
||||||
break;
|
break;
|
||||||
// you have been mentioned
|
// you have been mentioned
|
||||||
if (message.toLower().startsWith(mention)) {
|
if (message.toLower().startsWith(mention)) {
|
||||||
|
mentionFormat.setBackground(QBrush(getCustomMentionColor()));
|
||||||
|
mentionFormat.setForeground(settingsCache->getChatMentionForeground() ? QBrush(Qt::white):QBrush(Qt::black));
|
||||||
cursor.insertText("@" + userName, mentionFormat);
|
cursor.insertText("@" + userName, mentionFormat);
|
||||||
message = message.mid(mention.size());
|
message = message.mid(mention.size());
|
||||||
|
QApplication::alert(this);
|
||||||
}
|
}
|
||||||
// another user has been mentioned
|
// another user has been mentioned
|
||||||
else {
|
else {
|
||||||
int mentionEndIndex = message.indexOf(" ");
|
int mentionEndIndex = message.indexOf(QRegExp("\\W"), 1);// from 1 as @ is non-char
|
||||||
if (mentionEndIndex == -1)
|
if (mentionEndIndex == -1)
|
||||||
mentionEndIndex = message.size(); // there is no text after the mention
|
mentionEndIndex = message.size(); // there is no text after the mention
|
||||||
QString userMention = message.left(mentionEndIndex);
|
QString userMention = message.left(mentionEndIndex);
|
||||||
|
@ -225,6 +229,12 @@ void ChatView::appendMessage(QString message, QString sender, UserLevelFlags use
|
||||||
verticalScrollBar()->setValue(verticalScrollBar()->maximum());
|
verticalScrollBar()->setValue(verticalScrollBar()->maximum());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QColor ChatView::getCustomMentionColor() {
|
||||||
|
QColor customColor;
|
||||||
|
customColor.setNamedColor("#" + settingsCache->getChatMentionColor());
|
||||||
|
return customColor.isValid() ? customColor : DEFAULT_MENTION_COLOR;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the correct case version of the provided username, if no correct casing version
|
Returns the correct case version of the provided username, if no correct casing version
|
||||||
was found then the provided name is not available and will return an empty QString.
|
was found then the provided name is not available and will return an empty QString.
|
||||||
|
|
|
@ -37,6 +37,7 @@ private:
|
||||||
void appendCardTag(QTextCursor &cursor, const QString &cardName);
|
void appendCardTag(QTextCursor &cursor, const QString &cardName);
|
||||||
void appendUrlTag(QTextCursor &cursor, QString url);
|
void appendUrlTag(QTextCursor &cursor, QString url);
|
||||||
QString getNameFromUserList(QMap<QString, UserListTWI *> &userList, QString &userName);
|
QString getNameFromUserList(QMap<QString, UserListTWI *> &userList, QString &userName);
|
||||||
|
QColor getCustomMentionColor();
|
||||||
private slots:
|
private slots:
|
||||||
void openLink(const QUrl &link);
|
void openLink(const QUrl &link);
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -32,7 +32,7 @@ void DeckStatsInterface::queryFinished(QNetworkReply *reply)
|
||||||
QString data(reply->readAll());
|
QString data(reply->readAll());
|
||||||
reply->deleteLater();
|
reply->deleteLater();
|
||||||
|
|
||||||
QRegExp rx("id=\"deckstats_deck_url\" value=\"([^\"]+)\"");
|
QRegExp rx("<meta property=\"og:url\" content=\"([^\"]+)\"/>");
|
||||||
if (!rx.indexIn(data)) {
|
if (!rx.indexIn(data)) {
|
||||||
QMessageBox::critical(0, tr("Error"), tr("The reply from the server could not be parsed."));
|
QMessageBox::critical(0, tr("Error"), tr("The reply from the server could not be parsed."));
|
||||||
deleteLater();
|
deleteLater();
|
||||||
|
@ -53,11 +53,13 @@ void DeckStatsInterface::getAnalyzeRequestData(DeckList *deck, QByteArray *data)
|
||||||
#if QT_VERSION < 0x050000
|
#if QT_VERSION < 0x050000
|
||||||
QUrl params;
|
QUrl params;
|
||||||
params.addQueryItem("deck", deckWithoutTokens.writeToString_Plain());
|
params.addQueryItem("deck", deckWithoutTokens.writeToString_Plain());
|
||||||
|
params.addQueryItem("decktitle", deck->getName());
|
||||||
data->append(params.encodedQuery());
|
data->append(params.encodedQuery());
|
||||||
#else
|
#else
|
||||||
QUrl params;
|
QUrl params;
|
||||||
QUrlQuery urlQuery;
|
QUrlQuery urlQuery;
|
||||||
urlQuery.addQueryItem("deck", deckWithoutTokens.writeToString_Plain());
|
urlQuery.addQueryItem("deck", deckWithoutTokens.writeToString_Plain());
|
||||||
|
urlQuery.addQueryItem("decktitle", deck->getName());
|
||||||
params.setQuery(urlQuery);
|
params.setQuery(urlQuery);
|
||||||
data->append(params.query(QUrl::EncodeReserved));
|
data->append(params.query(QUrl::EncodeReserved));
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -31,13 +31,13 @@ void DlgCreateGame::sharedCtor()
|
||||||
maxPlayersEdit->setMaximum(100);
|
maxPlayersEdit->setMaximum(100);
|
||||||
maxPlayersEdit->setValue(2);
|
maxPlayersEdit->setValue(2);
|
||||||
maxPlayersLabel->setBuddy(maxPlayersEdit);
|
maxPlayersLabel->setBuddy(maxPlayersEdit);
|
||||||
|
|
||||||
QGridLayout *generalGrid = new QGridLayout;
|
QGridLayout *generalGrid = new QGridLayout;
|
||||||
generalGrid->addWidget(descriptionLabel, 0, 0);
|
generalGrid->addWidget(descriptionLabel, 0, 0);
|
||||||
generalGrid->addWidget(descriptionEdit, 0, 1);
|
generalGrid->addWidget(descriptionEdit, 0, 1);
|
||||||
generalGrid->addWidget(maxPlayersLabel, 1, 0);
|
generalGrid->addWidget(maxPlayersLabel, 1, 0);
|
||||||
generalGrid->addWidget(maxPlayersEdit, 1, 1);
|
generalGrid->addWidget(maxPlayersEdit, 1, 1);
|
||||||
|
|
||||||
QVBoxLayout *gameTypeLayout = new QVBoxLayout;
|
QVBoxLayout *gameTypeLayout = new QVBoxLayout;
|
||||||
QMapIterator<int, QString> gameTypeIterator(gameTypes);
|
QMapIterator<int, QString> gameTypeIterator(gameTypes);
|
||||||
while (gameTypeIterator.hasNext()) {
|
while (gameTypeIterator.hasNext()) {
|
||||||
|
@ -48,7 +48,7 @@ void DlgCreateGame::sharedCtor()
|
||||||
}
|
}
|
||||||
QGroupBox *gameTypeGroupBox = new QGroupBox(tr("Game type"));
|
QGroupBox *gameTypeGroupBox = new QGroupBox(tr("Game type"));
|
||||||
gameTypeGroupBox->setLayout(gameTypeLayout);
|
gameTypeGroupBox->setLayout(gameTypeLayout);
|
||||||
|
|
||||||
passwordLabel = new QLabel(tr("&Password:"));
|
passwordLabel = new QLabel(tr("&Password:"));
|
||||||
passwordEdit = new QLineEdit;
|
passwordEdit = new QLineEdit;
|
||||||
passwordLabel->setBuddy(passwordEdit);
|
passwordLabel->setBuddy(passwordEdit);
|
||||||
|
@ -60,18 +60,18 @@ void DlgCreateGame::sharedCtor()
|
||||||
onlyRegisteredCheckBox->setChecked(true);
|
onlyRegisteredCheckBox->setChecked(true);
|
||||||
} else {
|
} else {
|
||||||
onlyBuddiesCheckBox->setEnabled(false);
|
onlyBuddiesCheckBox->setEnabled(false);
|
||||||
onlyRegisteredCheckBox->setEnabled(false);
|
onlyRegisteredCheckBox->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
QGridLayout *joinRestrictionsLayout = new QGridLayout;
|
QGridLayout *joinRestrictionsLayout = new QGridLayout;
|
||||||
joinRestrictionsLayout->addWidget(passwordLabel, 0, 0);
|
joinRestrictionsLayout->addWidget(passwordLabel, 0, 0);
|
||||||
joinRestrictionsLayout->addWidget(passwordEdit, 0, 1);
|
joinRestrictionsLayout->addWidget(passwordEdit, 0, 1);
|
||||||
joinRestrictionsLayout->addWidget(onlyBuddiesCheckBox, 1, 0, 1, 2);
|
joinRestrictionsLayout->addWidget(onlyBuddiesCheckBox, 1, 0, 1, 2);
|
||||||
joinRestrictionsLayout->addWidget(onlyRegisteredCheckBox, 2, 0, 1, 2);
|
joinRestrictionsLayout->addWidget(onlyRegisteredCheckBox, 2, 0, 1, 2);
|
||||||
|
|
||||||
QGroupBox *joinRestrictionsGroupBox = new QGroupBox(tr("Joining restrictions"));
|
QGroupBox *joinRestrictionsGroupBox = new QGroupBox(tr("Joining restrictions"));
|
||||||
joinRestrictionsGroupBox->setLayout(joinRestrictionsLayout);
|
joinRestrictionsGroupBox->setLayout(joinRestrictionsLayout);
|
||||||
|
|
||||||
spectatorsAllowedCheckBox = new QCheckBox(tr("&Spectators allowed"));
|
spectatorsAllowedCheckBox = new QCheckBox(tr("&Spectators allowed"));
|
||||||
spectatorsAllowedCheckBox->setChecked(true);
|
spectatorsAllowedCheckBox->setChecked(true);
|
||||||
connect(spectatorsAllowedCheckBox, SIGNAL(stateChanged(int)), this, SLOT(spectatorsAllowedChanged(int)));
|
connect(spectatorsAllowedCheckBox, SIGNAL(stateChanged(int)), this, SLOT(spectatorsAllowedChanged(int)));
|
||||||
|
@ -94,7 +94,7 @@ void DlgCreateGame::sharedCtor()
|
||||||
|
|
||||||
buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok);
|
buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok);
|
||||||
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||||
|
|
||||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||||
mainLayout->addLayout(grid);
|
mainLayout->addLayout(grid);
|
||||||
mainLayout->addWidget(buttonBox);
|
mainLayout->addWidget(buttonBox);
|
||||||
|
@ -108,10 +108,10 @@ DlgCreateGame::DlgCreateGame(TabRoom *_room, const QMap<int, QString> &_gameType
|
||||||
: QDialog(parent), room(_room), gameTypes(_gameTypes)
|
: QDialog(parent), room(_room), gameTypes(_gameTypes)
|
||||||
{
|
{
|
||||||
sharedCtor();
|
sharedCtor();
|
||||||
|
|
||||||
buttonBox->addButton(QDialogButtonBox::Cancel);
|
buttonBox->addButton(QDialogButtonBox::Cancel);
|
||||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(actOK()));
|
connect(buttonBox, SIGNAL(accepted()), this, SLOT(actOK()));
|
||||||
|
|
||||||
setWindowTitle(tr("Create game"));
|
setWindowTitle(tr("Create game"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ DlgCreateGame::DlgCreateGame(const ServerInfo_Game &gameInfo, const QMap<int, QS
|
||||||
: QDialog(parent), room(0), gameTypes(_gameTypes)
|
: QDialog(parent), room(0), gameTypes(_gameTypes)
|
||||||
{
|
{
|
||||||
sharedCtor();
|
sharedCtor();
|
||||||
|
|
||||||
descriptionEdit->setEnabled(false);
|
descriptionEdit->setEnabled(false);
|
||||||
maxPlayersEdit->setEnabled(false);
|
maxPlayersEdit->setEnabled(false);
|
||||||
passwordEdit->setEnabled(false);
|
passwordEdit->setEnabled(false);
|
||||||
|
@ -129,7 +129,7 @@ DlgCreateGame::DlgCreateGame(const ServerInfo_Game &gameInfo, const QMap<int, QS
|
||||||
spectatorsNeedPasswordCheckBox->setEnabled(false);
|
spectatorsNeedPasswordCheckBox->setEnabled(false);
|
||||||
spectatorsCanTalkCheckBox->setEnabled(false);
|
spectatorsCanTalkCheckBox->setEnabled(false);
|
||||||
spectatorsSeeEverythingCheckBox->setEnabled(false);
|
spectatorsSeeEverythingCheckBox->setEnabled(false);
|
||||||
|
|
||||||
descriptionEdit->setText(QString::fromStdString(gameInfo.description()));
|
descriptionEdit->setText(QString::fromStdString(gameInfo.description()));
|
||||||
maxPlayersEdit->setValue(gameInfo.max_players());
|
maxPlayersEdit->setValue(gameInfo.max_players());
|
||||||
onlyBuddiesCheckBox->setChecked(gameInfo.only_buddies());
|
onlyBuddiesCheckBox->setChecked(gameInfo.only_buddies());
|
||||||
|
@ -138,29 +138,29 @@ DlgCreateGame::DlgCreateGame(const ServerInfo_Game &gameInfo, const QMap<int, QS
|
||||||
spectatorsNeedPasswordCheckBox->setChecked(gameInfo.spectators_need_password());
|
spectatorsNeedPasswordCheckBox->setChecked(gameInfo.spectators_need_password());
|
||||||
spectatorsCanTalkCheckBox->setChecked(gameInfo.spectators_can_chat());
|
spectatorsCanTalkCheckBox->setChecked(gameInfo.spectators_can_chat());
|
||||||
spectatorsSeeEverythingCheckBox->setChecked(gameInfo.spectators_omniscient());
|
spectatorsSeeEverythingCheckBox->setChecked(gameInfo.spectators_omniscient());
|
||||||
|
|
||||||
QSet<int> types;
|
QSet<int> types;
|
||||||
for (int i = 0; i < gameInfo.game_types_size(); ++i)
|
for (int i = 0; i < gameInfo.game_types_size(); ++i)
|
||||||
types.insert(gameInfo.game_types(i));
|
types.insert(gameInfo.game_types(i));
|
||||||
|
|
||||||
QMapIterator<int, QString> gameTypeIterator(gameTypes);
|
QMapIterator<int, QString> gameTypeIterator(gameTypes);
|
||||||
while (gameTypeIterator.hasNext()) {
|
while (gameTypeIterator.hasNext()) {
|
||||||
gameTypeIterator.next();
|
gameTypeIterator.next();
|
||||||
|
|
||||||
QCheckBox *gameTypeCheckBox = gameTypeCheckBoxes.value(gameTypeIterator.key());
|
QCheckBox *gameTypeCheckBox = gameTypeCheckBoxes.value(gameTypeIterator.key());
|
||||||
gameTypeCheckBox->setEnabled(false);
|
gameTypeCheckBox->setEnabled(false);
|
||||||
gameTypeCheckBox->setChecked(types.contains(gameTypeIterator.key()));
|
gameTypeCheckBox->setChecked(types.contains(gameTypeIterator.key()));
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
||||||
|
|
||||||
setWindowTitle(tr("Game information"));
|
setWindowTitle(tr("Game information"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlgCreateGame::actOK()
|
void DlgCreateGame::actOK()
|
||||||
{
|
{
|
||||||
Command_CreateGame cmd;
|
Command_CreateGame cmd;
|
||||||
cmd.set_description(descriptionEdit->text().toStdString());
|
cmd.set_description(descriptionEdit->text().simplified().toStdString());
|
||||||
cmd.set_password(passwordEdit->text().toStdString());
|
cmd.set_password(passwordEdit->text().toStdString());
|
||||||
cmd.set_max_players(maxPlayersEdit->value());
|
cmd.set_max_players(maxPlayersEdit->value());
|
||||||
cmd.set_only_buddies(onlyBuddiesCheckBox->isChecked());
|
cmd.set_only_buddies(onlyBuddiesCheckBox->isChecked());
|
||||||
|
@ -169,18 +169,18 @@ void DlgCreateGame::actOK()
|
||||||
cmd.set_spectators_need_password(spectatorsNeedPasswordCheckBox->isChecked());
|
cmd.set_spectators_need_password(spectatorsNeedPasswordCheckBox->isChecked());
|
||||||
cmd.set_spectators_can_talk(spectatorsCanTalkCheckBox->isChecked());
|
cmd.set_spectators_can_talk(spectatorsCanTalkCheckBox->isChecked());
|
||||||
cmd.set_spectators_see_everything(spectatorsSeeEverythingCheckBox->isChecked());
|
cmd.set_spectators_see_everything(spectatorsSeeEverythingCheckBox->isChecked());
|
||||||
|
|
||||||
QMapIterator<int, QCheckBox *> gameTypeCheckBoxIterator(gameTypeCheckBoxes);
|
QMapIterator<int, QCheckBox *> gameTypeCheckBoxIterator(gameTypeCheckBoxes);
|
||||||
while (gameTypeCheckBoxIterator.hasNext()) {
|
while (gameTypeCheckBoxIterator.hasNext()) {
|
||||||
gameTypeCheckBoxIterator.next();
|
gameTypeCheckBoxIterator.next();
|
||||||
if (gameTypeCheckBoxIterator.value()->isChecked())
|
if (gameTypeCheckBoxIterator.value()->isChecked())
|
||||||
cmd.add_game_type_ids(gameTypeCheckBoxIterator.key());
|
cmd.add_game_type_ids(gameTypeCheckBoxIterator.key());
|
||||||
}
|
}
|
||||||
|
|
||||||
PendingCommand *pend = room->prepareRoomCommand(cmd);
|
PendingCommand *pend = room->prepareRoomCommand(cmd);
|
||||||
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(checkResponse(Response)));
|
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(checkResponse(Response)));
|
||||||
room->sendRoomCommand(pend);
|
room->sendRoomCommand(pend);
|
||||||
|
|
||||||
buttonBox->setEnabled(false);
|
buttonBox->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,11 +50,6 @@ GeneralSettingsPage::GeneralSettingsPage()
|
||||||
pixmapCacheEdit.setSingleStep(64);
|
pixmapCacheEdit.setSingleStep(64);
|
||||||
pixmapCacheEdit.setValue(settingsCache->getPixmapCacheSize());
|
pixmapCacheEdit.setValue(settingsCache->getPixmapCacheSize());
|
||||||
pixmapCacheEdit.setSuffix(" MB");
|
pixmapCacheEdit.setSuffix(" MB");
|
||||||
pixmapCacheEdit.setMinimum(64);
|
|
||||||
pixmapCacheEdit.setMaximum(8192);
|
|
||||||
pixmapCacheEdit.setSingleStep(64);
|
|
||||||
pixmapCacheEdit.setValue(settingsCache->getPixmapCacheSize());
|
|
||||||
pixmapCacheEdit.setSuffix(" MB");
|
|
||||||
picDownloadHqCheckBox.setChecked(settingsCache->getPicDownloadHq());
|
picDownloadHqCheckBox.setChecked(settingsCache->getPicDownloadHq());
|
||||||
picDownloadCheckBox.setChecked(settingsCache->getPicDownload());
|
picDownloadCheckBox.setChecked(settingsCache->getPicDownload());
|
||||||
|
|
||||||
|
@ -571,16 +566,29 @@ void DeckEditorSettingsPage::radioPriceTagSourceClicked(bool checked)
|
||||||
|
|
||||||
MessagesSettingsPage::MessagesSettingsPage()
|
MessagesSettingsPage::MessagesSettingsPage()
|
||||||
{
|
{
|
||||||
|
|
||||||
chatMentionCheckBox.setChecked(settingsCache->getChatMention());
|
chatMentionCheckBox.setChecked(settingsCache->getChatMention());
|
||||||
connect(&chatMentionCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setChatMention(int)));
|
connect(&chatMentionCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setChatMention(int)));
|
||||||
|
|
||||||
ignoreUnregUsersMainChat.setChecked(settingsCache->getIgnoreUnregisteredUsers());
|
ignoreUnregUsersMainChat.setChecked(settingsCache->getIgnoreUnregisteredUsers());
|
||||||
|
ignoreUnregUserMessages.setChecked(settingsCache->getIgnoreUnregisteredUserMessages());
|
||||||
connect(&ignoreUnregUsersMainChat, SIGNAL(stateChanged(int)), settingsCache, SLOT(setIgnoreUnregisteredUsers(int)));
|
connect(&ignoreUnregUsersMainChat, SIGNAL(stateChanged(int)), settingsCache, SLOT(setIgnoreUnregisteredUsers(int)));
|
||||||
|
connect(&ignoreUnregUserMessages, SIGNAL(stateChanged(int)), settingsCache, SLOT(setIgnoreUnregisteredUserMessages(int)));
|
||||||
|
|
||||||
|
invertMentionForeground.setChecked(settingsCache->getChatMentionForeground());
|
||||||
|
connect(&invertMentionForeground, SIGNAL(stateChanged(int)), this, SLOT(updateTextColor(int)));
|
||||||
|
|
||||||
|
mentionColor = new QLineEdit();
|
||||||
|
mentionColor->setText(settingsCache->getChatMentionColor());
|
||||||
|
updateMentionPreview();
|
||||||
|
connect(mentionColor, SIGNAL(textChanged(QString)), this, SLOT(updateColor(QString)));
|
||||||
|
|
||||||
QGridLayout *chatGrid = new QGridLayout;
|
QGridLayout *chatGrid = new QGridLayout;
|
||||||
chatGrid->addWidget(&chatMentionCheckBox, 0, 0);
|
chatGrid->addWidget(&chatMentionCheckBox, 0, 0);
|
||||||
|
chatGrid->addWidget(&invertMentionForeground, 0, 1);
|
||||||
|
chatGrid->addWidget(mentionColor, 0, 2);
|
||||||
chatGrid->addWidget(&ignoreUnregUsersMainChat, 1, 0);
|
chatGrid->addWidget(&ignoreUnregUsersMainChat, 1, 0);
|
||||||
|
chatGrid->addWidget(&hexLabel, 1, 2);
|
||||||
|
chatGrid->addWidget(&ignoreUnregUserMessages, 2, 0);
|
||||||
chatGroupBox = new QGroupBox;
|
chatGroupBox = new QGroupBox;
|
||||||
chatGroupBox->setLayout(chatGrid);
|
chatGroupBox->setLayout(chatGrid);
|
||||||
|
|
||||||
|
@ -618,6 +626,25 @@ MessagesSettingsPage::MessagesSettingsPage()
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MessagesSettingsPage::updateColor(const QString &value) {
|
||||||
|
QColor colorToSet;
|
||||||
|
colorToSet.setNamedColor("#" + value);
|
||||||
|
if (colorToSet.isValid()) {
|
||||||
|
settingsCache->setChatMentionColor(value);
|
||||||
|
updateMentionPreview();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MessagesSettingsPage::updateTextColor(int value) {
|
||||||
|
settingsCache->setChatMentionForeground(value);
|
||||||
|
updateMentionPreview();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MessagesSettingsPage::updateMentionPreview() {
|
||||||
|
mentionColor->setStyleSheet("QLineEdit{background:#" + settingsCache->getChatMentionColor() +
|
||||||
|
";color: " + (settingsCache->getChatMentionForeground() ? "white" : "black") + ";}");
|
||||||
|
}
|
||||||
|
|
||||||
void MessagesSettingsPage::storeSettings()
|
void MessagesSettingsPage::storeSettings()
|
||||||
{
|
{
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
|
@ -650,9 +677,13 @@ void MessagesSettingsPage::retranslateUi()
|
||||||
aAdd->setText(tr("&Add"));
|
aAdd->setText(tr("&Add"));
|
||||||
aRemove->setText(tr("&Remove"));
|
aRemove->setText(tr("&Remove"));
|
||||||
chatGroupBox->setTitle(tr("Chat settings"));
|
chatGroupBox->setTitle(tr("Chat settings"));
|
||||||
chatMentionCheckBox.setText(tr("Enable chat mentions ('@yourusername' in chat log will be highlighted)"));
|
chatMentionCheckBox.setText(tr("Enable chat mentions"));
|
||||||
messageShortcuts->setTitle(tr("In-game message macros"));
|
messageShortcuts->setTitle(tr("In-game message macros"));
|
||||||
ignoreUnregUsersMainChat.setText(tr("Ignore unregistered users in main chat"));
|
ignoreUnregUsersMainChat.setText(tr("Ignore unregistered users in main chat"));
|
||||||
|
ignoreUnregUsersMainChat.setText(tr("Ignore chat room messages sent by unregistered users."));
|
||||||
|
ignoreUnregUserMessages.setText(tr("Ignore private messages sent by unregistered users."));
|
||||||
|
invertMentionForeground.setText(tr("Invert text color"));
|
||||||
|
hexLabel.setText(tr("(Color is hexadecimal)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
DlgSettings::DlgSettings(QWidget *parent)
|
DlgSettings::DlgSettings(QWidget *parent)
|
||||||
|
|
|
@ -156,16 +156,23 @@ public:
|
||||||
private slots:
|
private slots:
|
||||||
void actAdd();
|
void actAdd();
|
||||||
void actRemove();
|
void actRemove();
|
||||||
|
void updateColor(const QString &value);
|
||||||
|
void updateTextColor(int value);
|
||||||
private:
|
private:
|
||||||
QListWidget *messageList;
|
QListWidget *messageList;
|
||||||
QAction *aAdd;
|
QAction *aAdd;
|
||||||
QAction *aRemove;
|
QAction *aRemove;
|
||||||
QCheckBox chatMentionCheckBox;
|
QCheckBox chatMentionCheckBox;
|
||||||
|
QCheckBox invertMentionForeground;
|
||||||
QCheckBox ignoreUnregUsersMainChat;
|
QCheckBox ignoreUnregUsersMainChat;
|
||||||
|
QCheckBox ignoreUnregUserMessages;
|
||||||
QGroupBox *chatGroupBox;
|
QGroupBox *chatGroupBox;
|
||||||
QGroupBox *messageShortcuts;
|
QGroupBox *messageShortcuts;
|
||||||
|
QLineEdit *mentionColor;
|
||||||
|
QLabel hexLabel;
|
||||||
|
|
||||||
void storeSettings();
|
void storeSettings();
|
||||||
|
void updateMentionPreview();
|
||||||
};
|
};
|
||||||
|
|
||||||
class DlgSettings : public QDialog {
|
class DlgSettings : public QDialog {
|
||||||
|
|
|
@ -199,34 +199,31 @@ bool FilterItem::acceptManaCost(const CardInfo *info) const
|
||||||
return (info->getManaCost() == term);
|
return (info->getManaCost() == term);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool FilterItem::acceptCmc(const CardInfo *info) const
|
||||||
|
{
|
||||||
|
return (info->getCmc() == term);
|
||||||
|
}
|
||||||
|
|
||||||
bool FilterItem::acceptCardAttr(const CardInfo *info, CardFilter::Attr attr) const
|
bool FilterItem::acceptCardAttr(const CardInfo *info, CardFilter::Attr attr) const
|
||||||
{
|
{
|
||||||
bool status;
|
|
||||||
|
|
||||||
switch (attr) {
|
switch (attr) {
|
||||||
case CardFilter::AttrName:
|
case CardFilter::AttrName:
|
||||||
status = acceptName(info);
|
return acceptName(info);
|
||||||
break;
|
|
||||||
case CardFilter::AttrType:
|
case CardFilter::AttrType:
|
||||||
status = acceptType(info);
|
return acceptType(info);
|
||||||
break;
|
|
||||||
case CardFilter::AttrColor:
|
case CardFilter::AttrColor:
|
||||||
status = acceptColor(info);
|
return acceptColor(info);
|
||||||
break;
|
|
||||||
case CardFilter::AttrText:
|
case CardFilter::AttrText:
|
||||||
status = acceptText(info);
|
return acceptText(info);
|
||||||
break;
|
|
||||||
case CardFilter::AttrSet:
|
case CardFilter::AttrSet:
|
||||||
status = acceptSet(info);
|
return acceptSet(info);
|
||||||
break;
|
|
||||||
case CardFilter::AttrManaCost:
|
case CardFilter::AttrManaCost:
|
||||||
status = acceptManaCost(info);
|
return acceptManaCost(info);
|
||||||
break;
|
case CardFilter::AttrCmc:
|
||||||
|
return acceptCmc(info);
|
||||||
default:
|
default:
|
||||||
status = true; /* ignore this attribute */
|
return true; /* ignore this attribute */
|
||||||
}
|
}
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* need to define these here to make QT happy, otherwise
|
/* need to define these here to make QT happy, otherwise
|
||||||
|
|
|
@ -117,6 +117,7 @@ public:
|
||||||
bool acceptText(const CardInfo *info) const;
|
bool acceptText(const CardInfo *info) const;
|
||||||
bool acceptSet(const CardInfo *info) const;
|
bool acceptSet(const CardInfo *info) const;
|
||||||
bool acceptManaCost(const CardInfo *info) const;
|
bool acceptManaCost(const CardInfo *info) const;
|
||||||
|
bool acceptCmc(const CardInfo *info) const;
|
||||||
bool acceptCardAttr(const CardInfo *info, CardFilter::Attr attr) const;
|
bool acceptCardAttr(const CardInfo *info, CardFilter::Attr attr) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,7 @@ QVariant GamesModel::data(const QModelIndex &index, int role) const
|
||||||
case Qt::DisplayRole:
|
case Qt::DisplayRole:
|
||||||
return QString::fromStdString(g.creator_info().name());
|
return QString::fromStdString(g.creator_info().name());
|
||||||
case Qt::DecorationRole: {
|
case Qt::DecorationRole: {
|
||||||
QPixmap avatarPixmap = UserLevelPixmapGenerator::generatePixmap(13, (UserLevelFlags)g.creator_info().user_level());
|
QPixmap avatarPixmap = UserLevelPixmapGenerator::generatePixmap(13, (UserLevelFlags)g.creator_info().user_level(), false);
|
||||||
return QIcon(avatarPixmap);
|
return QIcon(avatarPixmap);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -134,12 +134,13 @@ QPixmap CountryPixmapGenerator::generatePixmap(int height, const QString &countr
|
||||||
|
|
||||||
QMap<QString, QPixmap> CountryPixmapGenerator::pmCache;
|
QMap<QString, QPixmap> CountryPixmapGenerator::pmCache;
|
||||||
|
|
||||||
QPixmap UserLevelPixmapGenerator::generatePixmap(int height, UserLevelFlags userLevel)
|
QPixmap UserLevelPixmapGenerator::generatePixmap(int height, UserLevelFlags userLevel, bool isBuddy)
|
||||||
{
|
{
|
||||||
int key = height * 10000 + (int) userLevel;
|
|
||||||
|
int key = height * 10000 + (int) userLevel + (int) isBuddy;
|
||||||
if (pmCache.contains(key))
|
if (pmCache.contains(key))
|
||||||
return pmCache.value(key);
|
return pmCache.value(key);
|
||||||
|
|
||||||
QString levelString;
|
QString levelString;
|
||||||
if (userLevel.testFlag(ServerInfo_User::IsAdmin))
|
if (userLevel.testFlag(ServerInfo_User::IsAdmin))
|
||||||
levelString = "admin";
|
levelString = "admin";
|
||||||
|
@ -149,13 +150,17 @@ QPixmap UserLevelPixmapGenerator::generatePixmap(int height, UserLevelFlags user
|
||||||
levelString = "registered";
|
levelString = "registered";
|
||||||
else
|
else
|
||||||
levelString = "normal";
|
levelString = "normal";
|
||||||
|
|
||||||
|
if (isBuddy)
|
||||||
|
levelString.append("_buddy");
|
||||||
|
|
||||||
QSvgRenderer svg(QString(":/resources/userlevels/" + levelString + ".svg"));
|
QSvgRenderer svg(QString(":/resources/userlevels/" + levelString + ".svg"));
|
||||||
int width = (int) round(height * (double) svg.defaultSize().width() / (double) svg.defaultSize().height());
|
int width = (int) round(height * (double) svg.defaultSize().width() / (double) svg.defaultSize().height());
|
||||||
QPixmap pixmap(width, height);
|
QPixmap pixmap(width, height);
|
||||||
pixmap.fill(Qt::transparent);
|
pixmap.fill(Qt::transparent);
|
||||||
QPainter painter(&pixmap);
|
QPainter painter(&pixmap);
|
||||||
svg.render(&painter, QRectF(0, 0, width, height));
|
svg.render(&painter, QRectF(0, 0, width, height));
|
||||||
|
|
||||||
pmCache.insert(key, pixmap);
|
pmCache.insert(key, pixmap);
|
||||||
return pixmap;
|
return pixmap;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ class UserLevelPixmapGenerator {
|
||||||
private:
|
private:
|
||||||
static QMap<int, QPixmap> pmCache;
|
static QMap<int, QPixmap> pmCache;
|
||||||
public:
|
public:
|
||||||
static QPixmap generatePixmap(int height, UserLevelFlags userLevel);
|
static QPixmap generatePixmap(int height, UserLevelFlags userLevel, bool isBuddy);
|
||||||
static void clear() { pmCache.clear(); }
|
static void clear() { pmCache.clear(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,7 @@ void PlayerListWidget::updatePlayerProperties(const ServerInfo_PlayerProperties
|
||||||
player->setIcon(2, gameStarted ? (prop.conceded() ? concededIcon : QIcon()) : (prop.ready_start() ? readyIcon : notReadyIcon));
|
player->setIcon(2, gameStarted ? (prop.conceded() ? concededIcon : QIcon()) : (prop.ready_start() ? readyIcon : notReadyIcon));
|
||||||
if (prop.has_user_info()) {
|
if (prop.has_user_info()) {
|
||||||
player->setData(3, Qt::UserRole, prop.user_info().user_level());
|
player->setData(3, Qt::UserRole, prop.user_info().user_level());
|
||||||
player->setIcon(3, QIcon(UserLevelPixmapGenerator::generatePixmap(12, UserLevelFlags(prop.user_info().user_level()))));
|
player->setIcon(3, QIcon(UserLevelPixmapGenerator::generatePixmap(12, UserLevelFlags(prop.user_info().user_level()), false)));
|
||||||
player->setText(4, QString::fromStdString(prop.user_info().name()));
|
player->setText(4, QString::fromStdString(prop.user_info().name()));
|
||||||
const QString country = QString::fromStdString(prop.user_info().country());
|
const QString country = QString::fromStdString(prop.user_info().country());
|
||||||
if (!country.isEmpty())
|
if (!country.isEmpty())
|
||||||
|
|
|
@ -98,7 +98,7 @@ void PlayerTarget::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*o
|
||||||
|
|
||||||
QPixmap tempPixmap;
|
QPixmap tempPixmap;
|
||||||
if (fullPixmap.isNull())
|
if (fullPixmap.isNull())
|
||||||
tempPixmap = UserLevelPixmapGenerator::generatePixmap(translatedSize.height(), UserLevelFlags(info->user_level()));
|
tempPixmap = UserLevelPixmapGenerator::generatePixmap(translatedSize.height(), UserLevelFlags(info->user_level()), false);
|
||||||
else
|
else
|
||||||
tempPixmap = fullPixmap.scaled(translatedSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
tempPixmap = fullPixmap.scaled(translatedSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||||
|
|
||||||
|
|
|
@ -45,11 +45,12 @@ SettingsCache::SettingsCache()
|
||||||
minPlayersForMultiColumnLayout = settings->value("interface/min_players_multicolumn", 5).toInt();
|
minPlayersForMultiColumnLayout = settings->value("interface/min_players_multicolumn", 5).toInt();
|
||||||
tapAnimation = settings->value("cards/tapanimation", true).toBool();
|
tapAnimation = settings->value("cards/tapanimation", true).toBool();
|
||||||
chatMention = settings->value("chat/mention", true).toBool();
|
chatMention = settings->value("chat/mention", true).toBool();
|
||||||
|
chatMentionForeground = settings->value("chat/mentionforeground", true).toBool();
|
||||||
|
chatMentionColor = settings->value("chat/mentioncolor", "A6120D").toString();
|
||||||
|
|
||||||
zoneViewSortByName = settings->value("zoneview/sortbyname", true).toBool();
|
zoneViewSortByName = settings->value("zoneview/sortbyname", true).toBool();
|
||||||
zoneViewSortByType = settings->value("zoneview/sortbytype", true).toBool();
|
zoneViewSortByType = settings->value("zoneview/sortbytype", true).toBool();
|
||||||
zoneViewPileView = settings->value("zoneview/pileview", true).toBool();
|
zoneViewPileView = settings->value("zoneview/pileview", true).toBool();
|
||||||
zoneViewShuffle = settings->value("zoneview/shuffle", true).toBool();
|
|
||||||
|
|
||||||
soundEnabled = settings->value("sound/enabled", false).toBool();
|
soundEnabled = settings->value("sound/enabled", false).toBool();
|
||||||
soundPath = settings->value("sound/path").toString();
|
soundPath = settings->value("sound/path").toString();
|
||||||
|
@ -58,6 +59,7 @@ SettingsCache::SettingsCache()
|
||||||
priceTagSource = settings->value("deckeditor/pricetagsource", 0).toInt();
|
priceTagSource = settings->value("deckeditor/pricetagsource", 0).toInt();
|
||||||
|
|
||||||
ignoreUnregisteredUsers = settings->value("chat/ignore_unregistered", false).toBool();
|
ignoreUnregisteredUsers = settings->value("chat/ignore_unregistered", false).toBool();
|
||||||
|
ignoreUnregisteredUserMessages = settings->value("chat/ignore_unregistered_messages", false).toBool();
|
||||||
|
|
||||||
attemptAutoConnect = settings->value("server/auto_connect", 0).toBool();
|
attemptAutoConnect = settings->value("server/auto_connect", 0).toBool();
|
||||||
}
|
}
|
||||||
|
@ -244,6 +246,16 @@ void SettingsCache::setChatMention(int _chatMention) {
|
||||||
settings->setValue("chat/mention", chatMention);
|
settings->setValue("chat/mention", chatMention);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SettingsCache::setChatMentionForeground(int _chatMentionForeground) {
|
||||||
|
chatMentionForeground = _chatMentionForeground;
|
||||||
|
settings->setValue("chat/mentionforeground", chatMentionForeground);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsCache::setChatMentionColor(const QString &_chatMentionColor) {
|
||||||
|
chatMentionColor = _chatMentionColor;
|
||||||
|
settings->setValue("chat/mentioncolor", chatMentionColor);
|
||||||
|
}
|
||||||
|
|
||||||
void SettingsCache::setZoneViewSortByName(int _zoneViewSortByName)
|
void SettingsCache::setZoneViewSortByName(int _zoneViewSortByName)
|
||||||
{
|
{
|
||||||
zoneViewSortByName = _zoneViewSortByName;
|
zoneViewSortByName = _zoneViewSortByName;
|
||||||
|
@ -261,11 +273,6 @@ void SettingsCache::setZoneViewPileView(int _zoneViewPileView){
|
||||||
settings->setValue("zoneview/pileview", zoneViewPileView);
|
settings->setValue("zoneview/pileview", zoneViewPileView);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsCache::setZoneViewShuffle(int _zoneViewShuffle) {
|
|
||||||
zoneViewShuffle = _zoneViewShuffle;
|
|
||||||
settings->setValue("zoneview/shuffle", zoneViewShuffle);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SettingsCache::setSoundEnabled(int _soundEnabled)
|
void SettingsCache::setSoundEnabled(int _soundEnabled)
|
||||||
{
|
{
|
||||||
soundEnabled = _soundEnabled;
|
soundEnabled = _soundEnabled;
|
||||||
|
@ -299,6 +306,12 @@ void SettingsCache::setIgnoreUnregisteredUsers(int _ignoreUnregisteredUsers)
|
||||||
settings->setValue("chat/ignore_unregistered", ignoreUnregisteredUsers);
|
settings->setValue("chat/ignore_unregistered", ignoreUnregisteredUsers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SettingsCache::setIgnoreUnregisteredUserMessages(int _ignoreUnregisteredUserMessages)
|
||||||
|
{
|
||||||
|
ignoreUnregisteredUserMessages = _ignoreUnregisteredUserMessages;
|
||||||
|
settings->setValue("chat/ignore_unregistered_messages", ignoreUnregisteredUserMessages);
|
||||||
|
}
|
||||||
|
|
||||||
void SettingsCache::setMainWindowGeometry(const QByteArray &_mainWindowGeometry)
|
void SettingsCache::setMainWindowGeometry(const QByteArray &_mainWindowGeometry)
|
||||||
{
|
{
|
||||||
mainWindowGeometry = _mainWindowGeometry;
|
mainWindowGeometry = _mainWindowGeometry;
|
||||||
|
|
|
@ -36,6 +36,7 @@ signals:
|
||||||
void soundPathChanged();
|
void soundPathChanged();
|
||||||
void priceTagFeatureChanged(int enabled);
|
void priceTagFeatureChanged(int enabled);
|
||||||
void ignoreUnregisteredUsersChanged();
|
void ignoreUnregisteredUsersChanged();
|
||||||
|
void ignoreUnregisteredUserMessagesChanged();
|
||||||
void pixmapCacheSizeChanged(int newSizeInMBs);
|
void pixmapCacheSizeChanged(int newSizeInMBs);
|
||||||
private:
|
private:
|
||||||
QSettings *settings;
|
QSettings *settings;
|
||||||
|
@ -57,12 +58,15 @@ private:
|
||||||
int minPlayersForMultiColumnLayout;
|
int minPlayersForMultiColumnLayout;
|
||||||
bool tapAnimation;
|
bool tapAnimation;
|
||||||
bool chatMention;
|
bool chatMention;
|
||||||
bool zoneViewSortByName, zoneViewSortByType, zoneViewPileView, zoneViewShuffle;
|
QString chatMentionColor;
|
||||||
|
bool chatMentionForeground;
|
||||||
|
bool zoneViewSortByName, zoneViewSortByType, zoneViewPileView;
|
||||||
bool soundEnabled;
|
bool soundEnabled;
|
||||||
QString soundPath;
|
QString soundPath;
|
||||||
bool priceTagFeature;
|
bool priceTagFeature;
|
||||||
int priceTagSource;
|
int priceTagSource;
|
||||||
bool ignoreUnregisteredUsers;
|
bool ignoreUnregisteredUsers;
|
||||||
|
bool ignoreUnregisteredUserMessages;
|
||||||
QString picUrl;
|
QString picUrl;
|
||||||
QString picUrlHq;
|
QString picUrlHq;
|
||||||
QString picUrlFallback;
|
QString picUrlFallback;
|
||||||
|
@ -83,6 +87,7 @@ public:
|
||||||
QString getTableBgPath() const { return tableBgPath; }
|
QString getTableBgPath() const { return tableBgPath; }
|
||||||
QString getPlayerBgPath() const { return playerBgPath; }
|
QString getPlayerBgPath() const { return playerBgPath; }
|
||||||
QString getCardBackPicturePath() const { return cardBackPicturePath; }
|
QString getCardBackPicturePath() const { return cardBackPicturePath; }
|
||||||
|
QString getChatMentionColor() const { return chatMentionColor; }
|
||||||
bool getPicDownload() const { return picDownload; }
|
bool getPicDownload() const { return picDownload; }
|
||||||
bool getPicDownloadHq() const { return picDownloadHq; }
|
bool getPicDownloadHq() const { return picDownloadHq; }
|
||||||
bool getNotificationsEnabled() const { return notificationsEnabled; }
|
bool getNotificationsEnabled() const { return notificationsEnabled; }
|
||||||
|
@ -96,6 +101,7 @@ public:
|
||||||
int getMinPlayersForMultiColumnLayout() const { return minPlayersForMultiColumnLayout; }
|
int getMinPlayersForMultiColumnLayout() const { return minPlayersForMultiColumnLayout; }
|
||||||
bool getTapAnimation() const { return tapAnimation; }
|
bool getTapAnimation() const { return tapAnimation; }
|
||||||
bool getChatMention() const { return chatMention; }
|
bool getChatMention() const { return chatMention; }
|
||||||
|
bool getChatMentionForeground() const { return chatMentionForeground; }
|
||||||
bool getZoneViewSortByName() const { return zoneViewSortByName; }
|
bool getZoneViewSortByName() const { return zoneViewSortByName; }
|
||||||
bool getZoneViewSortByType() const { return zoneViewSortByType; }
|
bool getZoneViewSortByType() const { return zoneViewSortByType; }
|
||||||
/**
|
/**
|
||||||
|
@ -103,16 +109,12 @@ public:
|
||||||
@return zoneViewPileView if the view should be sorted into pile view.
|
@return zoneViewPileView if the view should be sorted into pile view.
|
||||||
*/
|
*/
|
||||||
bool getZoneViewPileView() const { return zoneViewPileView; }
|
bool getZoneViewPileView() const { return zoneViewPileView; }
|
||||||
/**
|
|
||||||
Returns if the view should be shuffled on closing.
|
|
||||||
@return zoneViewShuffle if the view should be shuffled on closing.
|
|
||||||
*/
|
|
||||||
bool getZoneViewShuffle() const { return zoneViewShuffle; }
|
|
||||||
bool getSoundEnabled() const { return soundEnabled; }
|
bool getSoundEnabled() const { return soundEnabled; }
|
||||||
QString getSoundPath() const { return soundPath; }
|
QString getSoundPath() const { return soundPath; }
|
||||||
bool getPriceTagFeature() const { return priceTagFeature; }
|
bool getPriceTagFeature() const { return priceTagFeature; }
|
||||||
int getPriceTagSource() const { return priceTagSource; }
|
int getPriceTagSource() const { return priceTagSource; }
|
||||||
bool getIgnoreUnregisteredUsers() const { return ignoreUnregisteredUsers; }
|
bool getIgnoreUnregisteredUsers() const { return ignoreUnregisteredUsers; }
|
||||||
|
bool getIgnoreUnregisteredUserMessages() const { return ignoreUnregisteredUserMessages; }
|
||||||
QString getPicUrl() const { return picUrl; }
|
QString getPicUrl() const { return picUrl; }
|
||||||
QString getPicUrlHq() const { return picUrlHq; }
|
QString getPicUrlHq() const { return picUrlHq; }
|
||||||
QString getPicUrlFallback() const { return picUrlFallback; }
|
QString getPicUrlFallback() const { return picUrlFallback; }
|
||||||
|
@ -133,6 +135,7 @@ public slots:
|
||||||
void setTableBgPath(const QString &_tableBgPath);
|
void setTableBgPath(const QString &_tableBgPath);
|
||||||
void setPlayerBgPath(const QString &_playerBgPath);
|
void setPlayerBgPath(const QString &_playerBgPath);
|
||||||
void setCardBackPicturePath(const QString &_cardBackPicturePath);
|
void setCardBackPicturePath(const QString &_cardBackPicturePath);
|
||||||
|
void setChatMentionColor(const QString &_chatMentionColor);
|
||||||
void setPicDownload(int _picDownload);
|
void setPicDownload(int _picDownload);
|
||||||
void setPicDownloadHq(int _picDownloadHq);
|
void setPicDownloadHq(int _picDownloadHq);
|
||||||
void setNotificationsEnabled(int _notificationsEnabled);
|
void setNotificationsEnabled(int _notificationsEnabled);
|
||||||
|
@ -146,15 +149,16 @@ public slots:
|
||||||
void setMinPlayersForMultiColumnLayout(int _minPlayersForMultiColumnLayout);
|
void setMinPlayersForMultiColumnLayout(int _minPlayersForMultiColumnLayout);
|
||||||
void setTapAnimation(int _tapAnimation);
|
void setTapAnimation(int _tapAnimation);
|
||||||
void setChatMention(int _chatMention);
|
void setChatMention(int _chatMention);
|
||||||
|
void setChatMentionForeground(int _chatMentionForeground);
|
||||||
void setZoneViewSortByName(int _zoneViewSortByName);
|
void setZoneViewSortByName(int _zoneViewSortByName);
|
||||||
void setZoneViewSortByType(int _zoneViewSortByType);
|
void setZoneViewSortByType(int _zoneViewSortByType);
|
||||||
void setZoneViewPileView(int _zoneViewPileView);
|
void setZoneViewPileView(int _zoneViewPileView);
|
||||||
void setZoneViewShuffle(int _zoneViewShuffle);
|
|
||||||
void setSoundEnabled(int _soundEnabled);
|
void setSoundEnabled(int _soundEnabled);
|
||||||
void setSoundPath(const QString &_soundPath);
|
void setSoundPath(const QString &_soundPath);
|
||||||
void setPriceTagFeature(int _priceTagFeature);
|
void setPriceTagFeature(int _priceTagFeature);
|
||||||
void setPriceTagSource(int _priceTagSource);
|
void setPriceTagSource(int _priceTagSource);
|
||||||
void setIgnoreUnregisteredUsers(int _ignoreUnregisteredUsers);
|
void setIgnoreUnregisteredUsers(int _ignoreUnregisteredUsers);
|
||||||
|
void setIgnoreUnregisteredUserMessages(int _ignoreUnregisteredUserMessages);
|
||||||
void setPicUrl(const QString &_picUrl);
|
void setPicUrl(const QString &_picUrl);
|
||||||
void setPicUrlHq(const QString &_picUrlHq);
|
void setPicUrlHq(const QString &_picUrlHq);
|
||||||
void setPicUrlFallback(const QString &_picUrlFallback);
|
void setPicUrlFallback(const QString &_picUrlFallback);
|
||||||
|
|
|
@ -276,8 +276,8 @@ TabDeckEditor::TabDeckEditor(TabSupervisor *_tabSupervisor, QWidget *parent)
|
||||||
deckEditToolBar->addAction(aAddCard);
|
deckEditToolBar->addAction(aAddCard);
|
||||||
deckEditToolBar->addAction(aAddCardToSideboard);
|
deckEditToolBar->addAction(aAddCardToSideboard);
|
||||||
deckEditToolBar->addAction(aRemoveCard);
|
deckEditToolBar->addAction(aRemoveCard);
|
||||||
deckEditToolBar->addAction(aIncrement);
|
|
||||||
deckEditToolBar->addAction(aDecrement);
|
deckEditToolBar->addAction(aDecrement);
|
||||||
|
deckEditToolBar->addAction(aIncrement);
|
||||||
deckEditToolBar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
|
deckEditToolBar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
|
||||||
|
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
|
|
|
@ -885,6 +885,7 @@ void TabGame::startGame(bool resuming)
|
||||||
gameInfo.set_started(true);
|
gameInfo.set_started(true);
|
||||||
static_cast<GameScene *>(gameView->scene())->rearrange();
|
static_cast<GameScene *>(gameView->scene())->rearrange();
|
||||||
gameView->show();
|
gameView->show();
|
||||||
|
sayEdit->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabGame::stopGame()
|
void TabGame::stopGame()
|
||||||
|
|
|
@ -18,6 +18,7 @@ TabMessage::TabMessage(TabSupervisor *_tabSupervisor, AbstractClient *_client, c
|
||||||
chatView = new ChatView(tabSupervisor, 0, true);
|
chatView = new ChatView(tabSupervisor, 0, true);
|
||||||
connect(chatView, SIGNAL(showCardInfoPopup(QPoint, QString)), this, SLOT(showCardInfoPopup(QPoint, QString)));
|
connect(chatView, SIGNAL(showCardInfoPopup(QPoint, QString)), this, SLOT(showCardInfoPopup(QPoint, QString)));
|
||||||
connect(chatView, SIGNAL(deleteCardInfoPopup(QString)), this, SLOT(deleteCardInfoPopup(QString)));
|
connect(chatView, SIGNAL(deleteCardInfoPopup(QString)), this, SLOT(deleteCardInfoPopup(QString)));
|
||||||
|
connect(chatView, SIGNAL(addMentionTag(QString)), this, SLOT(addMentionTag(QString)));
|
||||||
sayEdit = new QLineEdit;
|
sayEdit = new QLineEdit;
|
||||||
connect(sayEdit, SIGNAL(returnPressed()), this, SLOT(sendMessage()));
|
connect(sayEdit, SIGNAL(returnPressed()), this, SLOT(sendMessage()));
|
||||||
|
|
||||||
|
@ -43,6 +44,11 @@ TabMessage::~TabMessage()
|
||||||
delete otherUserInfo;
|
delete otherUserInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TabMessage::addMentionTag(QString mentionTag) {
|
||||||
|
sayEdit->insert(mentionTag + " ");
|
||||||
|
sayEdit->setFocus();
|
||||||
|
}
|
||||||
|
|
||||||
void TabMessage::retranslateUi()
|
void TabMessage::retranslateUi()
|
||||||
{
|
{
|
||||||
messageMenu->setTitle(tr("Personal &talk"));
|
messageMenu->setTitle(tr("Personal &talk"));
|
||||||
|
|
|
@ -29,6 +29,7 @@ private slots:
|
||||||
void sendMessage();
|
void sendMessage();
|
||||||
void actLeave();
|
void actLeave();
|
||||||
void messageSent(const Response &response);
|
void messageSent(const Response &response);
|
||||||
|
void addMentionTag(QString mentionTag);
|
||||||
public:
|
public:
|
||||||
TabMessage(TabSupervisor *_tabSupervisor, AbstractClient *_client, const ServerInfo_User &_ownUserInfo, const ServerInfo_User &_otherUserInfo);
|
TabMessage(TabSupervisor *_tabSupervisor, AbstractClient *_client, const ServerInfo_User &_ownUserInfo, const ServerInfo_User &_otherUserInfo);
|
||||||
~TabMessage();
|
~TabMessage();
|
||||||
|
|
|
@ -446,11 +446,21 @@ void TabSupervisor::processGameEventContainer(const GameEventContainer &cont)
|
||||||
|
|
||||||
void TabSupervisor::processUserMessageEvent(const Event_UserMessage &event)
|
void TabSupervisor::processUserMessageEvent(const Event_UserMessage &event)
|
||||||
{
|
{
|
||||||
TabMessage *tab = messageTabs.value(QString::fromStdString(event.sender_name()));
|
QString senderName = QString::fromStdString(event.sender_name());
|
||||||
|
TabMessage *tab = messageTabs.value(senderName);
|
||||||
if (!tab)
|
if (!tab)
|
||||||
tab = messageTabs.value(QString::fromStdString(event.receiver_name()));
|
tab = messageTabs.value(QString::fromStdString(event.receiver_name()));
|
||||||
if (!tab)
|
if (!tab) {
|
||||||
|
UserListTWI *twi = tabUserLists->getAllUsersList()->getUsers().value(senderName);
|
||||||
|
if (twi) {
|
||||||
|
UserLevelFlags userLevel = UserLevelFlags(twi->getUserInfo().user_level());
|
||||||
|
if (settingsCache->getIgnoreUnregisteredUserMessages() &&
|
||||||
|
!userLevel.testFlag(ServerInfo_User::IsRegistered))
|
||||||
|
// Flags are additive, so reg/mod/admin are all IsRegistered
|
||||||
|
return;
|
||||||
|
}
|
||||||
tab = addMessageTab(QString::fromStdString(event.sender_name()), false);
|
tab = addMessageTab(QString::fromStdString(event.sender_name()), false);
|
||||||
|
}
|
||||||
if (!tab)
|
if (!tab)
|
||||||
return;
|
return;
|
||||||
tab->processUserMessageEvent(event);
|
tab->processUserMessageEvent(event);
|
||||||
|
|
|
@ -31,6 +31,7 @@ UserInfoBox::UserInfoBox(AbstractClient *_client, bool _fullInfo, QWidget *paren
|
||||||
mainLayout->addWidget(&genderLabel2, 3, 1, 1, 2);
|
mainLayout->addWidget(&genderLabel2, 3, 1, 1, 2);
|
||||||
mainLayout->addWidget(&countryLabel1, 4, 0, 1, 1);
|
mainLayout->addWidget(&countryLabel1, 4, 0, 1, 1);
|
||||||
mainLayout->addWidget(&countryLabel2, 4, 1, 1, 2);
|
mainLayout->addWidget(&countryLabel2, 4, 1, 1, 2);
|
||||||
|
mainLayout->addWidget(&countryLabel3, 4, 2, 1, 1);
|
||||||
mainLayout->addWidget(&userLevelLabel1, 5, 0, 1, 1);
|
mainLayout->addWidget(&userLevelLabel1, 5, 0, 1, 1);
|
||||||
mainLayout->addWidget(&userLevelLabel2, 5, 1, 1, 1);
|
mainLayout->addWidget(&userLevelLabel2, 5, 1, 1, 1);
|
||||||
mainLayout->addWidget(&userLevelLabel3, 5, 2, 1, 1);
|
mainLayout->addWidget(&userLevelLabel3, 5, 2, 1, 1);
|
||||||
|
@ -59,14 +60,16 @@ void UserInfoBox::updateInfo(const ServerInfo_User &user)
|
||||||
QPixmap avatarPixmap;
|
QPixmap avatarPixmap;
|
||||||
const std::string bmp = user.avatar_bmp();
|
const std::string bmp = user.avatar_bmp();
|
||||||
if (!avatarPixmap.loadFromData((const uchar *) bmp.data(), bmp.size()))
|
if (!avatarPixmap.loadFromData((const uchar *) bmp.data(), bmp.size()))
|
||||||
avatarPixmap = UserLevelPixmapGenerator::generatePixmap(64, userLevel);
|
avatarPixmap = UserLevelPixmapGenerator::generatePixmap(64, userLevel, false);
|
||||||
avatarLabel.setPixmap(avatarPixmap);
|
avatarLabel.setPixmap(avatarPixmap);
|
||||||
|
|
||||||
nameLabel.setText(QString::fromStdString(user.name()));
|
nameLabel.setText(QString::fromStdString(user.name()));
|
||||||
realNameLabel2.setText(QString::fromStdString(user.real_name()));
|
realNameLabel2.setText(QString::fromStdString(user.real_name()));
|
||||||
genderLabel2.setPixmap(GenderPixmapGenerator::generatePixmap(15, user.gender()));
|
genderLabel2.setPixmap(GenderPixmapGenerator::generatePixmap(15, user.gender()));
|
||||||
countryLabel2.setPixmap(CountryPixmapGenerator::generatePixmap(15, QString::fromStdString(user.country())));
|
QString country = QString::fromStdString(user.country());
|
||||||
userLevelLabel2.setPixmap(UserLevelPixmapGenerator::generatePixmap(15, userLevel));
|
countryLabel2.setPixmap(CountryPixmapGenerator::generatePixmap(15, country));
|
||||||
|
countryLabel3.setText(QString("(%1)").arg(country.toUpper()));
|
||||||
|
userLevelLabel2.setPixmap(UserLevelPixmapGenerator::generatePixmap(15, userLevel, false));
|
||||||
QString userLevelText;
|
QString userLevelText;
|
||||||
if (userLevel.testFlag(ServerInfo_User::IsAdmin))
|
if (userLevel.testFlag(ServerInfo_User::IsAdmin))
|
||||||
userLevelText = tr("Administrator");
|
userLevelText = tr("Administrator");
|
||||||
|
|
|
@ -14,8 +14,8 @@ class UserInfoBox : public QWidget {
|
||||||
private:
|
private:
|
||||||
AbstractClient *client;
|
AbstractClient *client;
|
||||||
bool fullInfo;
|
bool fullInfo;
|
||||||
QLabel avatarLabel, nameLabel, realNameLabel1, realNameLabel2, genderLabel1, genderLabel2, countryLabel1,
|
QLabel avatarLabel, nameLabel, realNameLabel1, realNameLabel2, genderLabel1, genderLabel2, countryLabel1,
|
||||||
countryLabel2, userLevelLabel1, userLevelLabel2, userLevelLabel3, accountAgeLebel1, accountAgeLabel2;
|
countryLabel2, countryLabel3, userLevelLabel1, userLevelLabel2, userLevelLabel3, accountAgeLebel1, accountAgeLabel2;
|
||||||
public:
|
public:
|
||||||
UserInfoBox(AbstractClient *_client, bool fullInfo, QWidget *parent = 0, Qt::WindowFlags flags = 0);
|
UserInfoBox(AbstractClient *_client, bool fullInfo, QWidget *parent = 0, Qt::WindowFlags flags = 0);
|
||||||
void retranslateUi();
|
void retranslateUi();
|
||||||
|
|
|
@ -181,7 +181,7 @@ void UserListTWI::setUserInfo(const ServerInfo_User &_userInfo)
|
||||||
userInfo = _userInfo;
|
userInfo = _userInfo;
|
||||||
|
|
||||||
setData(0, Qt::UserRole, userInfo.user_level());
|
setData(0, Qt::UserRole, userInfo.user_level());
|
||||||
setIcon(0, QIcon(UserLevelPixmapGenerator::generatePixmap(12, UserLevelFlags(userInfo.user_level()))));
|
setIcon(0, QIcon(UserLevelPixmapGenerator::generatePixmap(12, UserLevelFlags(userInfo.user_level()), false)));
|
||||||
setIcon(1, QIcon(CountryPixmapGenerator::generatePixmap(12, QString::fromStdString(userInfo.country()))));
|
setIcon(1, QIcon(CountryPixmapGenerator::generatePixmap(12, QString::fromStdString(userInfo.country()))));
|
||||||
setData(2, Qt::UserRole, QString::fromStdString(userInfo.name()));
|
setData(2, Qt::UserRole, QString::fromStdString(userInfo.name()));
|
||||||
setData(2, Qt::DisplayRole, QString::fromStdString(userInfo.name()));
|
setData(2, Qt::DisplayRole, QString::fromStdString(userInfo.name()));
|
||||||
|
|
|
@ -344,6 +344,7 @@ void MainWindow::createMenus()
|
||||||
cockatriceMenu = menuBar()->addMenu(QString());
|
cockatriceMenu = menuBar()->addMenu(QString());
|
||||||
cockatriceMenu->addAction(aConnect);
|
cockatriceMenu->addAction(aConnect);
|
||||||
cockatriceMenu->addAction(aDisconnect);
|
cockatriceMenu->addAction(aDisconnect);
|
||||||
|
cockatriceMenu->addSeparator();
|
||||||
cockatriceMenu->addAction(aSinglePlayer);
|
cockatriceMenu->addAction(aSinglePlayer);
|
||||||
cockatriceMenu->addAction(aWatchReplay);
|
cockatriceMenu->addAction(aWatchReplay);
|
||||||
cockatriceMenu->addSeparator();
|
cockatriceMenu->addSeparator();
|
||||||
|
|
|
@ -101,7 +101,7 @@ ZoneViewWidget::ZoneViewWidget(Player *_player, CardZone *_origZone, int numberC
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_origZone->getIsShufflable() && (numberCards == -1)) {
|
if (_origZone->getIsShufflable() && (numberCards == -1)) {
|
||||||
shuffleCheckBox.setChecked(settingsCache->getZoneViewShuffle());
|
shuffleCheckBox.setChecked(true);
|
||||||
QGraphicsProxyWidget *shuffleProxy = new QGraphicsProxyWidget;
|
QGraphicsProxyWidget *shuffleProxy = new QGraphicsProxyWidget;
|
||||||
shuffleProxy->setWidget(&shuffleCheckBox);
|
shuffleProxy->setWidget(&shuffleCheckBox);
|
||||||
vbox->addItem(shuffleProxy);
|
vbox->addItem(shuffleProxy);
|
||||||
|
@ -225,10 +225,8 @@ void ZoneViewWidget::closeEvent(QCloseEvent *event)
|
||||||
cmd.set_zone_name(zone->getName().toStdString());
|
cmd.set_zone_name(zone->getName().toStdString());
|
||||||
player->sendGameCommand(cmd);
|
player->sendGameCommand(cmd);
|
||||||
}
|
}
|
||||||
if (shuffleCheckBox.isChecked())
|
if (shuffleCheckBox.isChecked())
|
||||||
player->sendGameCommand(Command_Shuffle());
|
player->sendGameCommand(Command_Shuffle());
|
||||||
if (canBeShuffled)
|
|
||||||
settingsCache->setZoneViewShuffle(shuffleCheckBox.isChecked());
|
|
||||||
emit closePressed(this);
|
emit closePressed(this);
|
||||||
deleteLater();
|
deleteLater();
|
||||||
event->accept();
|
event->accept();
|
||||||
|
|
|
@ -106,9 +106,30 @@ void ZoneViewZone::reorganizeCards()
|
||||||
|
|
||||||
int typeColumn = 0;
|
int typeColumn = 0;
|
||||||
int longestRow = 0;
|
int longestRow = 0;
|
||||||
if (pileView && sortByType) // we need sort by type enabled for the feature to work
|
if (pileView && sortByType) { // we need sort by type enabled for the feature to work
|
||||||
setPileViewPositions(cardCount, cardsToDisplay, typeColumn, longestRow);
|
int typeRow = 0;
|
||||||
else {
|
QString lastCardType;
|
||||||
|
for (int i = 0; i < cardCount; i++) {
|
||||||
|
CardItem *c = cardsToDisplay.at(i);
|
||||||
|
QString cardType = c->getInfo()->getMainCardType();
|
||||||
|
|
||||||
|
if (i){ // if not the first card
|
||||||
|
if (cardType == lastCardType)
|
||||||
|
typeRow++; // add below current card
|
||||||
|
else { // if no match then move card to next column
|
||||||
|
typeColumn++;
|
||||||
|
typeRow = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lastCardType = cardType;
|
||||||
|
qreal x = typeColumn * CARD_WIDTH;
|
||||||
|
qreal y = typeRow * CARD_HEIGHT / 3;
|
||||||
|
c->setPos(x + 5, y + 5);
|
||||||
|
c->setRealZValue(i);
|
||||||
|
longestRow = qMax(typeRow, longestRow);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
for (int i = 0; i < cardCount; i++) {
|
for (int i = 0; i < cardCount; i++) {
|
||||||
CardItem *c = cardsToDisplay.at(i);
|
CardItem *c = cardsToDisplay.at(i);
|
||||||
qreal x = (i / rows) * CARD_WIDTH;
|
qreal x = (i / rows) * CARD_WIDTH;
|
||||||
|
@ -128,31 +149,6 @@ void ZoneViewZone::reorganizeCards()
|
||||||
emit optimumRectChanged();
|
emit optimumRectChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZoneViewZone::setPileViewPositions(int cardCount, CardList &cardsToDisplay, int &typeColumn, int &longestRow){
|
|
||||||
int typeRow = 0;
|
|
||||||
bool cardTypeMatch = true;
|
|
||||||
for (int i = 0; i < cardCount; i++) {
|
|
||||||
CardItem *c = cardsToDisplay.at(i);
|
|
||||||
QString cardType = c->getInfo()->getMainCardType();
|
|
||||||
|
|
||||||
if (i){
|
|
||||||
// if not the first card. Last card and this card have a matching main type?
|
|
||||||
cardTypeMatch = cardType.compare(cardsToDisplay.at(i-1)->getInfo()->getMainCardType()) == 0 ? true : false;
|
|
||||||
if (!cardTypeMatch) { // if no match then move card to next column
|
|
||||||
typeColumn++;
|
|
||||||
longestRow = qMax(typeRow, longestRow);
|
|
||||||
typeRow = 0;
|
|
||||||
} else // add below current card
|
|
||||||
typeRow++;
|
|
||||||
}
|
|
||||||
|
|
||||||
qreal x = typeColumn * CARD_WIDTH;
|
|
||||||
qreal y = typeRow * CARD_HEIGHT / 3;
|
|
||||||
c->setPos(x + 5, y + 5);
|
|
||||||
c->setRealZValue(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ZoneViewZone::setSortByName(int _sortByName)
|
void ZoneViewZone::setSortByName(int _sortByName)
|
||||||
{
|
{
|
||||||
sortByName = _sortByName;
|
sortByName = _sortByName;
|
||||||
|
|
|
@ -26,10 +26,6 @@ public:
|
||||||
QRectF boundingRect() const;
|
QRectF boundingRect() const;
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||||
void reorganizeCards();
|
void reorganizeCards();
|
||||||
|
|
||||||
void setPileViewPositions(int cardCount, CardList &cardsToDisplay, int &typeColumn, int &longestRow);
|
|
||||||
|
|
||||||
|
|
||||||
void initializeCards(const QList<const ServerInfo_Card *> &cardList = QList<const ServerInfo_Card *>());
|
void initializeCards(const QList<const ServerInfo_Card *> &cardList = QList<const ServerInfo_Card *>());
|
||||||
void removeCard(int position);
|
void removeCard(int position);
|
||||||
int getNumberCards() const { return numberCards; }
|
int getNumberCards() const { return numberCards; }
|
||||||
|
|
|
@ -56,7 +56,6 @@ Server_Game::Server_Game(const ServerInfo_User &_creatorInfo, int _gameId, const
|
||||||
gameStarted(false),
|
gameStarted(false),
|
||||||
gameClosed(false),
|
gameClosed(false),
|
||||||
gameId(_gameId),
|
gameId(_gameId),
|
||||||
description(_description),
|
|
||||||
password(_password),
|
password(_password),
|
||||||
maxPlayers(_maxPlayers),
|
maxPlayers(_maxPlayers),
|
||||||
gameTypes(_gameTypes),
|
gameTypes(_gameTypes),
|
||||||
|
@ -77,9 +76,10 @@ Server_Game::Server_Game(const ServerInfo_User &_creatorInfo, int _gameId, const
|
||||||
{
|
{
|
||||||
currentReplay = new GameReplay;
|
currentReplay = new GameReplay;
|
||||||
currentReplay->set_replay_id(room->getServer()->getDatabaseInterface()->getNextReplayId());
|
currentReplay->set_replay_id(room->getServer()->getDatabaseInterface()->getNextReplayId());
|
||||||
|
description = _description.simplified();
|
||||||
|
|
||||||
connect(this, SIGNAL(sigStartGameIfReady()), this, SLOT(doStartGameIfReady()), Qt::QueuedConnection);
|
connect(this, SIGNAL(sigStartGameIfReady()), this, SLOT(doStartGameIfReady()), Qt::QueuedConnection);
|
||||||
|
|
||||||
getInfo(*currentReplay->mutable_game_info());
|
getInfo(*currentReplay->mutable_game_info());
|
||||||
|
|
||||||
if (room->getServer()->getGameShouldPing()) {
|
if (room->getServer()->getGameShouldPing()) {
|
||||||
|
@ -93,36 +93,36 @@ Server_Game::~Server_Game()
|
||||||
{
|
{
|
||||||
room->gamesLock.lockForWrite();
|
room->gamesLock.lockForWrite();
|
||||||
gameMutex.lock();
|
gameMutex.lock();
|
||||||
|
|
||||||
gameClosed = true;
|
gameClosed = true;
|
||||||
sendGameEventContainer(prepareGameEvent(Event_GameClosed(), -1));
|
sendGameEventContainer(prepareGameEvent(Event_GameClosed(), -1));
|
||||||
|
|
||||||
QMapIterator<int, Server_Player *> playerIterator(players);
|
QMapIterator<int, Server_Player *> playerIterator(players);
|
||||||
while (playerIterator.hasNext())
|
while (playerIterator.hasNext())
|
||||||
playerIterator.next().value()->prepareDestroy();
|
playerIterator.next().value()->prepareDestroy();
|
||||||
players.clear();
|
players.clear();
|
||||||
|
|
||||||
room->removeGame(this);
|
room->removeGame(this);
|
||||||
delete creatorInfo;
|
delete creatorInfo;
|
||||||
creatorInfo = 0;
|
creatorInfo = 0;
|
||||||
|
|
||||||
gameMutex.unlock();
|
gameMutex.unlock();
|
||||||
room->gamesLock.unlock();
|
room->gamesLock.unlock();
|
||||||
|
|
||||||
currentReplay->set_duration_seconds(secondsElapsed - startTimeOfThisGame);
|
currentReplay->set_duration_seconds(secondsElapsed - startTimeOfThisGame);
|
||||||
replayList.append(currentReplay);
|
replayList.append(currentReplay);
|
||||||
storeGameInformation();
|
storeGameInformation();
|
||||||
|
|
||||||
for (int i = 0; i < replayList.size(); ++i)
|
for (int i = 0; i < replayList.size(); ++i)
|
||||||
delete replayList[i];
|
delete replayList[i];
|
||||||
|
|
||||||
qDebug() << "Server_Game destructor: gameId=" << gameId;
|
qDebug() << "Server_Game destructor: gameId=" << gameId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Server_Game::storeGameInformation()
|
void Server_Game::storeGameInformation()
|
||||||
{
|
{
|
||||||
const ServerInfo_Game &gameInfo = replayList.first()->game_info();
|
const ServerInfo_Game &gameInfo = replayList.first()->game_info();
|
||||||
|
|
||||||
Event_ReplayAdded replayEvent;
|
Event_ReplayAdded replayEvent;
|
||||||
ServerInfo_ReplayMatch *replayMatchInfo = replayEvent.mutable_match_info();
|
ServerInfo_ReplayMatch *replayMatchInfo = replayEvent.mutable_match_info();
|
||||||
replayMatchInfo->set_game_id(gameInfo.game_id());
|
replayMatchInfo->set_game_id(gameInfo.game_id());
|
||||||
|
@ -130,26 +130,26 @@ void Server_Game::storeGameInformation()
|
||||||
replayMatchInfo->set_time_started(QDateTime::currentDateTime().addSecs(-secondsElapsed).toTime_t());
|
replayMatchInfo->set_time_started(QDateTime::currentDateTime().addSecs(-secondsElapsed).toTime_t());
|
||||||
replayMatchInfo->set_length(secondsElapsed);
|
replayMatchInfo->set_length(secondsElapsed);
|
||||||
replayMatchInfo->set_game_name(gameInfo.description());
|
replayMatchInfo->set_game_name(gameInfo.description());
|
||||||
|
|
||||||
const QStringList &allGameTypes = room->getGameTypes();
|
const QStringList &allGameTypes = room->getGameTypes();
|
||||||
QStringList gameTypes;
|
QStringList gameTypes;
|
||||||
for (int i = gameInfo.game_types_size() - 1; i >= 0; --i)
|
for (int i = gameInfo.game_types_size() - 1; i >= 0; --i)
|
||||||
gameTypes.append(allGameTypes[gameInfo.game_types(i)]);
|
gameTypes.append(allGameTypes[gameInfo.game_types(i)]);
|
||||||
|
|
||||||
QSetIterator<QString> playerIterator(allPlayersEver);
|
QSetIterator<QString> playerIterator(allPlayersEver);
|
||||||
while (playerIterator.hasNext())
|
while (playerIterator.hasNext())
|
||||||
replayMatchInfo->add_player_names(playerIterator.next().toStdString());
|
replayMatchInfo->add_player_names(playerIterator.next().toStdString());
|
||||||
|
|
||||||
for (int i = 0; i < replayList.size(); ++i) {
|
for (int i = 0; i < replayList.size(); ++i) {
|
||||||
ServerInfo_Replay *replayInfo = replayMatchInfo->add_replay_list();
|
ServerInfo_Replay *replayInfo = replayMatchInfo->add_replay_list();
|
||||||
replayInfo->set_replay_id(replayList[i]->replay_id());
|
replayInfo->set_replay_id(replayList[i]->replay_id());
|
||||||
replayInfo->set_replay_name(gameInfo.description());
|
replayInfo->set_replay_name(gameInfo.description());
|
||||||
replayInfo->set_duration(replayList[i]->duration_seconds());
|
replayInfo->set_duration(replayList[i]->duration_seconds());
|
||||||
}
|
}
|
||||||
|
|
||||||
QSet<QString> allUsersInGame = allPlayersEver + allSpectatorsEver;
|
QSet<QString> allUsersInGame = allPlayersEver + allSpectatorsEver;
|
||||||
QSetIterator<QString> allUsersIterator(allUsersInGame);
|
QSetIterator<QString> allUsersIterator(allUsersInGame);
|
||||||
|
|
||||||
SessionEvent *sessionEvent = Server_ProtocolHandler::prepareSessionEvent(replayEvent);
|
SessionEvent *sessionEvent = Server_ProtocolHandler::prepareSessionEvent(replayEvent);
|
||||||
Server *server = room->getServer();
|
Server *server = room->getServer();
|
||||||
server->clientsLock.lockForRead();
|
server->clientsLock.lockForRead();
|
||||||
|
@ -160,7 +160,7 @@ void Server_Game::storeGameInformation()
|
||||||
}
|
}
|
||||||
server->clientsLock.unlock();
|
server->clientsLock.unlock();
|
||||||
delete sessionEvent;
|
delete sessionEvent;
|
||||||
|
|
||||||
server->getDatabaseInterface()->storeGameInformation(room->getName(), gameTypes, gameInfo, allPlayersEver, allSpectatorsEver, replayList);
|
server->getDatabaseInterface()->storeGameInformation(room->getName(), gameTypes, gameInfo, allPlayersEver, allSpectatorsEver, replayList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,10 +168,10 @@ void Server_Game::pingClockTimeout()
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&gameMutex);
|
QMutexLocker locker(&gameMutex);
|
||||||
++secondsElapsed;
|
++secondsElapsed;
|
||||||
|
|
||||||
GameEventStorage ges;
|
GameEventStorage ges;
|
||||||
ges.setGameEventContext(Context_PingChanged());
|
ges.setGameEventContext(Context_PingChanged());
|
||||||
|
|
||||||
QList<ServerInfo_PlayerPing *> pingList;
|
QList<ServerInfo_PlayerPing *> pingList;
|
||||||
QMapIterator<int, Server_Player *> playerIterator(players);
|
QMapIterator<int, Server_Player *> playerIterator(players);
|
||||||
bool allPlayersInactive = true;
|
bool allPlayersInactive = true;
|
||||||
|
@ -180,7 +180,7 @@ void Server_Game::pingClockTimeout()
|
||||||
Server_Player *player = playerIterator.next().value();
|
Server_Player *player = playerIterator.next().value();
|
||||||
if (!player->getSpectator())
|
if (!player->getSpectator())
|
||||||
++playerCount;
|
++playerCount;
|
||||||
|
|
||||||
const int oldPingTime = player->getPingTime();
|
const int oldPingTime = player->getPingTime();
|
||||||
player->playerMutex.lock();
|
player->playerMutex.lock();
|
||||||
int newPingTime;
|
int newPingTime;
|
||||||
|
@ -189,20 +189,20 @@ void Server_Game::pingClockTimeout()
|
||||||
else
|
else
|
||||||
newPingTime = -1;
|
newPingTime = -1;
|
||||||
player->playerMutex.unlock();
|
player->playerMutex.unlock();
|
||||||
|
|
||||||
if ((newPingTime != -1) && !player->getSpectator())
|
if ((newPingTime != -1) && !player->getSpectator())
|
||||||
allPlayersInactive = false;
|
allPlayersInactive = false;
|
||||||
|
|
||||||
if ((abs(oldPingTime - newPingTime) > 1) || ((newPingTime == -1) && (oldPingTime != -1)) || ((newPingTime != -1) && (oldPingTime == -1))) {
|
if ((abs(oldPingTime - newPingTime) > 1) || ((newPingTime == -1) && (oldPingTime != -1)) || ((newPingTime != -1) && (oldPingTime == -1))) {
|
||||||
player->setPingTime(newPingTime);
|
player->setPingTime(newPingTime);
|
||||||
|
|
||||||
Event_PlayerPropertiesChanged event;
|
Event_PlayerPropertiesChanged event;
|
||||||
event.mutable_player_properties()->set_ping_seconds(newPingTime);
|
event.mutable_player_properties()->set_ping_seconds(newPingTime);
|
||||||
ges.enqueueGameEvent(event, player->getPlayerId());
|
ges.enqueueGameEvent(event, player->getPlayerId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ges.sendToGame(this);
|
ges.sendToGame(this);
|
||||||
|
|
||||||
const int maxTime = room->getServer()->getMaxGameInactivityTime();
|
const int maxTime = room->getServer()->getMaxGameInactivityTime();
|
||||||
if (allPlayersInactive) {
|
if (allPlayersInactive) {
|
||||||
if (((++inactivityCounter >= maxTime) && (maxTime > 0)) || (playerCount < maxPlayers))
|
if (((++inactivityCounter >= maxTime) && (maxTime > 0)) || (playerCount < maxPlayers))
|
||||||
|
@ -214,7 +214,7 @@ void Server_Game::pingClockTimeout()
|
||||||
int Server_Game::getPlayerCount() const
|
int Server_Game::getPlayerCount() const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&gameMutex);
|
QMutexLocker locker(&gameMutex);
|
||||||
|
|
||||||
QMapIterator<int, Server_Player *> playerIterator(players);
|
QMapIterator<int, Server_Player *> playerIterator(players);
|
||||||
int result = 0;
|
int result = 0;
|
||||||
while (playerIterator.hasNext())
|
while (playerIterator.hasNext())
|
||||||
|
@ -226,7 +226,7 @@ int Server_Game::getPlayerCount() const
|
||||||
int Server_Game::getSpectatorCount() const
|
int Server_Game::getSpectatorCount() const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&gameMutex);
|
QMutexLocker locker(&gameMutex);
|
||||||
|
|
||||||
QMapIterator<int, Server_Player *> playerIterator(players);
|
QMapIterator<int, Server_Player *> playerIterator(players);
|
||||||
int result = 0;
|
int result = 0;
|
||||||
while (playerIterator.hasNext())
|
while (playerIterator.hasNext())
|
||||||
|
@ -244,7 +244,7 @@ void Server_Game::createGameStateChangedEvent(Event_GameStateChanged *event, Ser
|
||||||
event->set_active_phase(0);
|
event->set_active_phase(0);
|
||||||
} else
|
} else
|
||||||
event->set_game_started(false);
|
event->set_game_started(false);
|
||||||
|
|
||||||
QMapIterator<int, Server_Player *> playerIterator(players);
|
QMapIterator<int, Server_Player *> playerIterator(players);
|
||||||
while (playerIterator.hasNext())
|
while (playerIterator.hasNext())
|
||||||
playerIterator.next().value()->getInfo(event->add_player_list(), playerWhosAsking, omniscient, withUserInfo);
|
playerIterator.next().value()->getInfo(event->add_player_list(), playerWhosAsking, omniscient, withUserInfo);
|
||||||
|
@ -255,13 +255,13 @@ void Server_Game::sendGameStateToPlayers()
|
||||||
// game state information for replay and omniscient spectators
|
// game state information for replay and omniscient spectators
|
||||||
Event_GameStateChanged omniscientEvent;
|
Event_GameStateChanged omniscientEvent;
|
||||||
createGameStateChangedEvent(&omniscientEvent, 0, true, false);
|
createGameStateChangedEvent(&omniscientEvent, 0, true, false);
|
||||||
|
|
||||||
GameEventContainer *replayCont = prepareGameEvent(omniscientEvent, -1);
|
GameEventContainer *replayCont = prepareGameEvent(omniscientEvent, -1);
|
||||||
replayCont->set_seconds_elapsed(secondsElapsed - startTimeOfThisGame);
|
replayCont->set_seconds_elapsed(secondsElapsed - startTimeOfThisGame);
|
||||||
replayCont->clear_game_id();
|
replayCont->clear_game_id();
|
||||||
currentReplay->add_event_list()->CopyFrom(*replayCont);
|
currentReplay->add_event_list()->CopyFrom(*replayCont);
|
||||||
delete replayCont;
|
delete replayCont;
|
||||||
|
|
||||||
// If spectators are not omniscient, we need an additional createGameStateChangedEvent call, otherwise we can use the data we used for the replay.
|
// If spectators are not omniscient, we need an additional createGameStateChangedEvent call, otherwise we can use the data we used for the replay.
|
||||||
// All spectators are equal, so we don't need to make a createGameStateChangedEvent call for each one.
|
// All spectators are equal, so we don't need to make a createGameStateChangedEvent call for each one.
|
||||||
Event_GameStateChanged spectatorEvent;
|
Event_GameStateChanged spectatorEvent;
|
||||||
|
@ -269,7 +269,7 @@ void Server_Game::sendGameStateToPlayers()
|
||||||
spectatorEvent = omniscientEvent;
|
spectatorEvent = omniscientEvent;
|
||||||
else
|
else
|
||||||
createGameStateChangedEvent(&spectatorEvent, 0, false, false);
|
createGameStateChangedEvent(&spectatorEvent, 0, false, false);
|
||||||
|
|
||||||
// send game state info to clients according to their role in the game
|
// send game state info to clients according to their role in the game
|
||||||
QMapIterator<int, Server_Player *> playerIterator(players);
|
QMapIterator<int, Server_Player *> playerIterator(players);
|
||||||
while (playerIterator.hasNext()) {
|
while (playerIterator.hasNext()) {
|
||||||
|
@ -280,7 +280,7 @@ void Server_Game::sendGameStateToPlayers()
|
||||||
else {
|
else {
|
||||||
Event_GameStateChanged event;
|
Event_GameStateChanged event;
|
||||||
createGameStateChangedEvent(&event, player, false, false);
|
createGameStateChangedEvent(&event, player, false, false);
|
||||||
|
|
||||||
gec = prepareGameEvent(event, -1);
|
gec = prepareGameEvent(event, -1);
|
||||||
}
|
}
|
||||||
player->sendGameEvent(*gec);
|
player->sendGameEvent(*gec);
|
||||||
|
@ -292,7 +292,7 @@ void Server_Game::doStartGameIfReady()
|
||||||
{
|
{
|
||||||
Server_DatabaseInterface *databaseInterface = room->getServer()->getDatabaseInterface();
|
Server_DatabaseInterface *databaseInterface = room->getServer()->getDatabaseInterface();
|
||||||
QMutexLocker locker(&gameMutex);
|
QMutexLocker locker(&gameMutex);
|
||||||
|
|
||||||
if (getPlayerCount() < maxPlayers)
|
if (getPlayerCount() < maxPlayers)
|
||||||
return;
|
return;
|
||||||
QMapIterator<int, Server_Player *> playerIterator(players);
|
QMapIterator<int, Server_Player *> playerIterator(players);
|
||||||
|
@ -315,7 +315,7 @@ void Server_Game::doStartGameIfReady()
|
||||||
player->setConceded(false);
|
player->setConceded(false);
|
||||||
player->setReadyStart(false);
|
player->setReadyStart(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (firstGameStarted) {
|
if (firstGameStarted) {
|
||||||
currentReplay->set_duration_seconds(secondsElapsed - startTimeOfThisGame);
|
currentReplay->set_duration_seconds(secondsElapsed - startTimeOfThisGame);
|
||||||
replayList.append(currentReplay);
|
replayList.append(currentReplay);
|
||||||
|
@ -324,27 +324,27 @@ void Server_Game::doStartGameIfReady()
|
||||||
ServerInfo_Game *gameInfo = currentReplay->mutable_game_info();
|
ServerInfo_Game *gameInfo = currentReplay->mutable_game_info();
|
||||||
getInfo(*gameInfo);
|
getInfo(*gameInfo);
|
||||||
gameInfo->set_started(false);
|
gameInfo->set_started(false);
|
||||||
|
|
||||||
Event_GameStateChanged omniscientEvent;
|
Event_GameStateChanged omniscientEvent;
|
||||||
createGameStateChangedEvent(&omniscientEvent, 0, true, true);
|
createGameStateChangedEvent(&omniscientEvent, 0, true, true);
|
||||||
|
|
||||||
GameEventContainer *replayCont = prepareGameEvent(omniscientEvent, -1);
|
GameEventContainer *replayCont = prepareGameEvent(omniscientEvent, -1);
|
||||||
replayCont->set_seconds_elapsed(0);
|
replayCont->set_seconds_elapsed(0);
|
||||||
replayCont->clear_game_id();
|
replayCont->clear_game_id();
|
||||||
currentReplay->add_event_list()->CopyFrom(*replayCont);
|
currentReplay->add_event_list()->CopyFrom(*replayCont);
|
||||||
delete replayCont;
|
delete replayCont;
|
||||||
|
|
||||||
startTimeOfThisGame = secondsElapsed;
|
startTimeOfThisGame = secondsElapsed;
|
||||||
} else
|
} else
|
||||||
firstGameStarted = true;
|
firstGameStarted = true;
|
||||||
|
|
||||||
sendGameStateToPlayers();
|
sendGameStateToPlayers();
|
||||||
|
|
||||||
activePlayer = -1;
|
activePlayer = -1;
|
||||||
nextTurn();
|
nextTurn();
|
||||||
|
|
||||||
locker.unlock();
|
locker.unlock();
|
||||||
|
|
||||||
ServerInfo_Game gameInfo;
|
ServerInfo_Game gameInfo;
|
||||||
gameInfo.set_room_id(room->getId());
|
gameInfo.set_room_id(room->getId());
|
||||||
gameInfo.set_game_id(gameId);
|
gameInfo.set_game_id(gameId);
|
||||||
|
@ -360,7 +360,7 @@ void Server_Game::startGameIfReady()
|
||||||
void Server_Game::stopGameIfFinished()
|
void Server_Game::stopGameIfFinished()
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&gameMutex);
|
QMutexLocker locker(&gameMutex);
|
||||||
|
|
||||||
QMapIterator<int, Server_Player *> playerIterator(players);
|
QMapIterator<int, Server_Player *> playerIterator(players);
|
||||||
int playing = 0;
|
int playing = 0;
|
||||||
while (playerIterator.hasNext()) {
|
while (playerIterator.hasNext()) {
|
||||||
|
@ -381,9 +381,9 @@ void Server_Game::stopGameIfFinished()
|
||||||
}
|
}
|
||||||
|
|
||||||
sendGameStateToPlayers();
|
sendGameStateToPlayers();
|
||||||
|
|
||||||
locker.unlock();
|
locker.unlock();
|
||||||
|
|
||||||
ServerInfo_Game gameInfo;
|
ServerInfo_Game gameInfo;
|
||||||
gameInfo.set_room_id(room->getId());
|
gameInfo.set_room_id(room->getId());
|
||||||
gameInfo.set_game_id(gameId);
|
gameInfo.set_game_id(gameId);
|
||||||
|
@ -417,14 +417,14 @@ Response::ResponseCode Server_Game::checkJoin(ServerInfo_User *user, const QStri
|
||||||
}
|
}
|
||||||
if (!spectator && (gameStarted || (getPlayerCount() >= getMaxPlayers())))
|
if (!spectator && (gameStarted || (getPlayerCount() >= getMaxPlayers())))
|
||||||
return Response::RespGameFull;
|
return Response::RespGameFull;
|
||||||
|
|
||||||
return Response::RespOk;
|
return Response::RespOk;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Server_Game::containsUser(const QString &userName) const
|
bool Server_Game::containsUser(const QString &userName) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&gameMutex);
|
QMutexLocker locker(&gameMutex);
|
||||||
|
|
||||||
QMapIterator<int, Server_Player *> playerIterator(players);
|
QMapIterator<int, Server_Player *> playerIterator(players);
|
||||||
while (playerIterator.hasNext())
|
while (playerIterator.hasNext())
|
||||||
if (playerIterator.next().value()->getUserInfo()->name() == userName.toStdString())
|
if (playerIterator.next().value()->getUserInfo()->name() == userName.toStdString())
|
||||||
|
@ -435,14 +435,14 @@ bool Server_Game::containsUser(const QString &userName) const
|
||||||
void Server_Game::addPlayer(Server_AbstractUserInterface *userInterface, ResponseContainer &rc, bool spectator, bool broadcastUpdate)
|
void Server_Game::addPlayer(Server_AbstractUserInterface *userInterface, ResponseContainer &rc, bool spectator, bool broadcastUpdate)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&gameMutex);
|
QMutexLocker locker(&gameMutex);
|
||||||
|
|
||||||
Server_Player *newPlayer = new Server_Player(this, nextPlayerId++, userInterface->copyUserInfo(true, true, true), spectator, userInterface);
|
Server_Player *newPlayer = new Server_Player(this, nextPlayerId++, userInterface->copyUserInfo(true, true, true), spectator, userInterface);
|
||||||
newPlayer->moveToThread(thread());
|
newPlayer->moveToThread(thread());
|
||||||
|
|
||||||
Event_Join joinEvent;
|
Event_Join joinEvent;
|
||||||
newPlayer->getProperties(*joinEvent.mutable_player_properties(), true);
|
newPlayer->getProperties(*joinEvent.mutable_player_properties(), true);
|
||||||
sendGameEventContainer(prepareGameEvent(joinEvent, -1));
|
sendGameEventContainer(prepareGameEvent(joinEvent, -1));
|
||||||
|
|
||||||
const QString playerName = QString::fromStdString(newPlayer->getUserInfo()->name());
|
const QString playerName = QString::fromStdString(newPlayer->getUserInfo()->name());
|
||||||
if (spectator)
|
if (spectator)
|
||||||
allSpectatorsEver.insert(playerName);
|
allSpectatorsEver.insert(playerName);
|
||||||
|
@ -453,7 +453,7 @@ void Server_Game::addPlayer(Server_AbstractUserInterface *userInterface, Respons
|
||||||
hostId = newPlayer->getPlayerId();
|
hostId = newPlayer->getPlayerId();
|
||||||
sendGameEventContainer(prepareGameEvent(Event_GameHostChanged(), hostId));
|
sendGameEventContainer(prepareGameEvent(Event_GameHostChanged(), hostId));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (broadcastUpdate) {
|
if (broadcastUpdate) {
|
||||||
ServerInfo_Game gameInfo;
|
ServerInfo_Game gameInfo;
|
||||||
gameInfo.set_room_id(room->getId());
|
gameInfo.set_room_id(room->getId());
|
||||||
|
@ -462,12 +462,12 @@ void Server_Game::addPlayer(Server_AbstractUserInterface *userInterface, Respons
|
||||||
gameInfo.set_spectators_count(getSpectatorCount());
|
gameInfo.set_spectators_count(getSpectatorCount());
|
||||||
emit gameInfoChanged(gameInfo);
|
emit gameInfoChanged(gameInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((newPlayer->getUserInfo()->user_level() & ServerInfo_User::IsRegistered) && !spectator)
|
if ((newPlayer->getUserInfo()->user_level() & ServerInfo_User::IsRegistered) && !spectator)
|
||||||
room->getServer()->addPersistentPlayer(playerName, room->getId(), gameId, newPlayer->getPlayerId());
|
room->getServer()->addPersistentPlayer(playerName, room->getId(), gameId, newPlayer->getPlayerId());
|
||||||
|
|
||||||
userInterface->playerAddedToGame(gameId, room->getId(), newPlayer->getPlayerId());
|
userInterface->playerAddedToGame(gameId, room->getId(), newPlayer->getPlayerId());
|
||||||
|
|
||||||
createGameJoinedEvent(newPlayer, rc, false);
|
createGameJoinedEvent(newPlayer, rc, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -475,18 +475,18 @@ void Server_Game::removePlayer(Server_Player *player)
|
||||||
{
|
{
|
||||||
room->getServer()->removePersistentPlayer(QString::fromStdString(player->getUserInfo()->name()), room->getId(), gameId, player->getPlayerId());
|
room->getServer()->removePersistentPlayer(QString::fromStdString(player->getUserInfo()->name()), room->getId(), gameId, player->getPlayerId());
|
||||||
players.remove(player->getPlayerId());
|
players.remove(player->getPlayerId());
|
||||||
|
|
||||||
GameEventStorage ges;
|
GameEventStorage ges;
|
||||||
removeArrowsRelatedToPlayer(ges, player);
|
removeArrowsRelatedToPlayer(ges, player);
|
||||||
unattachCards(ges, player);
|
unattachCards(ges, player);
|
||||||
ges.enqueueGameEvent(Event_Leave(), player->getPlayerId());
|
ges.enqueueGameEvent(Event_Leave(), player->getPlayerId());
|
||||||
ges.sendToGame(this);
|
ges.sendToGame(this);
|
||||||
|
|
||||||
bool playerActive = activePlayer == player->getPlayerId();
|
bool playerActive = activePlayer == player->getPlayerId();
|
||||||
bool playerHost = hostId == player->getPlayerId();
|
bool playerHost = hostId == player->getPlayerId();
|
||||||
bool spectator = player->getSpectator();
|
bool spectator = player->getSpectator();
|
||||||
player->prepareDestroy();
|
player->prepareDestroy();
|
||||||
|
|
||||||
if (!getPlayerCount()) {
|
if (!getPlayerCount()) {
|
||||||
gameClosed = true;
|
gameClosed = true;
|
||||||
deleteLater();
|
deleteLater();
|
||||||
|
@ -511,7 +511,7 @@ void Server_Game::removePlayer(Server_Player *player)
|
||||||
if (gameStarted && playerActive)
|
if (gameStarted && playerActive)
|
||||||
nextTurn();
|
nextTurn();
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerInfo_Game gameInfo;
|
ServerInfo_Game gameInfo;
|
||||||
gameInfo.set_room_id(room->getId());
|
gameInfo.set_room_id(room->getId());
|
||||||
gameInfo.set_game_id(gameId);
|
gameInfo.set_game_id(gameId);
|
||||||
|
@ -523,7 +523,7 @@ void Server_Game::removePlayer(Server_Player *player)
|
||||||
void Server_Game::removeArrowsRelatedToPlayer(GameEventStorage &ges, Server_Player *player)
|
void Server_Game::removeArrowsRelatedToPlayer(GameEventStorage &ges, Server_Player *player)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&gameMutex);
|
QMutexLocker locker(&gameMutex);
|
||||||
|
|
||||||
// Remove all arrows of other players pointing to the player being removed or to one of his cards.
|
// Remove all arrows of other players pointing to the player being removed or to one of his cards.
|
||||||
// Also remove all arrows starting at one of his cards. This is necessary since players can create
|
// Also remove all arrows starting at one of his cards. This is necessary since players can create
|
||||||
// arrows that start at another person's cards.
|
// arrows that start at another person's cards.
|
||||||
|
@ -540,7 +540,7 @@ void Server_Game::removeArrowsRelatedToPlayer(GameEventStorage &ges, Server_Play
|
||||||
toDelete.append(a);
|
toDelete.append(a);
|
||||||
} else if (static_cast<Server_Player *>(a->getTargetItem()) == player)
|
} else if (static_cast<Server_Player *>(a->getTargetItem()) == player)
|
||||||
toDelete.append(a);
|
toDelete.append(a);
|
||||||
|
|
||||||
// Don't use else here! It has to happen regardless of whether targetCard == 0.
|
// Don't use else here! It has to happen regardless of whether targetCard == 0.
|
||||||
if (a->getStartCard()->getZone()->getPlayer() == player)
|
if (a->getStartCard()->getZone()->getPlayer() == player)
|
||||||
toDelete.append(a);
|
toDelete.append(a);
|
||||||
|
@ -549,7 +549,7 @@ void Server_Game::removeArrowsRelatedToPlayer(GameEventStorage &ges, Server_Play
|
||||||
Event_DeleteArrow event;
|
Event_DeleteArrow event;
|
||||||
event.set_arrow_id(toDelete[i]->getId());
|
event.set_arrow_id(toDelete[i]->getId());
|
||||||
ges.enqueueGameEvent(event, p->getPlayerId());
|
ges.enqueueGameEvent(event, p->getPlayerId());
|
||||||
|
|
||||||
p->deleteArrow(toDelete[i]->getId());
|
p->deleteArrow(toDelete[i]->getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -558,13 +558,13 @@ void Server_Game::removeArrowsRelatedToPlayer(GameEventStorage &ges, Server_Play
|
||||||
void Server_Game::unattachCards(GameEventStorage &ges, Server_Player *player)
|
void Server_Game::unattachCards(GameEventStorage &ges, Server_Player *player)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&gameMutex);
|
QMutexLocker locker(&gameMutex);
|
||||||
|
|
||||||
QMapIterator<QString, Server_CardZone *> zoneIterator(player->getZones());
|
QMapIterator<QString, Server_CardZone *> zoneIterator(player->getZones());
|
||||||
while (zoneIterator.hasNext()) {
|
while (zoneIterator.hasNext()) {
|
||||||
Server_CardZone *zone = zoneIterator.next().value();
|
Server_CardZone *zone = zoneIterator.next().value();
|
||||||
for (int i = 0; i < zone->getCards().size(); ++i) {
|
for (int i = 0; i < zone->getCards().size(); ++i) {
|
||||||
Server_Card *card = zone->getCards().at(i);
|
Server_Card *card = zone->getCards().at(i);
|
||||||
|
|
||||||
// Make a copy of the list because the original one gets modified during the loop
|
// Make a copy of the list because the original one gets modified during the loop
|
||||||
QList<Server_Card *> attachedCards = card->getAttachedCards();
|
QList<Server_Card *> attachedCards = card->getAttachedCards();
|
||||||
for (int i = 0; i < attachedCards.size(); ++i)
|
for (int i = 0; i < attachedCards.size(); ++i)
|
||||||
|
@ -576,54 +576,54 @@ void Server_Game::unattachCards(GameEventStorage &ges, Server_Player *player)
|
||||||
bool Server_Game::kickPlayer(int playerId)
|
bool Server_Game::kickPlayer(int playerId)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&gameMutex);
|
QMutexLocker locker(&gameMutex);
|
||||||
|
|
||||||
Server_Player *playerToKick = players.value(playerId);
|
Server_Player *playerToKick = players.value(playerId);
|
||||||
if (!playerToKick)
|
if (!playerToKick)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
GameEventContainer *gec = prepareGameEvent(Event_Kicked(), -1);
|
GameEventContainer *gec = prepareGameEvent(Event_Kicked(), -1);
|
||||||
playerToKick->sendGameEvent(*gec);
|
playerToKick->sendGameEvent(*gec);
|
||||||
delete gec;
|
delete gec;
|
||||||
|
|
||||||
removePlayer(playerToKick);
|
removePlayer(playerToKick);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Server_Game::setActivePlayer(int _activePlayer)
|
void Server_Game::setActivePlayer(int _activePlayer)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&gameMutex);
|
QMutexLocker locker(&gameMutex);
|
||||||
|
|
||||||
activePlayer = _activePlayer;
|
activePlayer = _activePlayer;
|
||||||
|
|
||||||
Event_SetActivePlayer event;
|
Event_SetActivePlayer event;
|
||||||
event.set_active_player_id(activePlayer);
|
event.set_active_player_id(activePlayer);
|
||||||
sendGameEventContainer(prepareGameEvent(event, -1));
|
sendGameEventContainer(prepareGameEvent(event, -1));
|
||||||
|
|
||||||
setActivePhase(0);
|
setActivePhase(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Server_Game::setActivePhase(int _activePhase)
|
void Server_Game::setActivePhase(int _activePhase)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&gameMutex);
|
QMutexLocker locker(&gameMutex);
|
||||||
|
|
||||||
QMapIterator<int, Server_Player *> playerIterator(players);
|
QMapIterator<int, Server_Player *> playerIterator(players);
|
||||||
while (playerIterator.hasNext()) {
|
while (playerIterator.hasNext()) {
|
||||||
Server_Player *player = playerIterator.next().value();
|
Server_Player *player = playerIterator.next().value();
|
||||||
QList<Server_Arrow *> toDelete = player->getArrows().values();
|
QList<Server_Arrow *> toDelete = player->getArrows().values();
|
||||||
for (int i = 0; i < toDelete.size(); ++i) {
|
for (int i = 0; i < toDelete.size(); ++i) {
|
||||||
Server_Arrow *a = toDelete[i];
|
Server_Arrow *a = toDelete[i];
|
||||||
|
|
||||||
Event_DeleteArrow event;
|
Event_DeleteArrow event;
|
||||||
event.set_arrow_id(a->getId());
|
event.set_arrow_id(a->getId());
|
||||||
sendGameEventContainer(prepareGameEvent(event, player->getPlayerId()));
|
sendGameEventContainer(prepareGameEvent(event, player->getPlayerId()));
|
||||||
|
|
||||||
player->deleteArrow(a->getId());
|
player->deleteArrow(a->getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
activePhase = _activePhase;
|
activePhase = _activePhase;
|
||||||
|
|
||||||
Event_SetActivePhase event;
|
Event_SetActivePhase event;
|
||||||
event.set_phase(activePhase);
|
event.set_phase(activePhase);
|
||||||
sendGameEventContainer(prepareGameEvent(event, -1));
|
sendGameEventContainer(prepareGameEvent(event, -1));
|
||||||
|
@ -632,7 +632,7 @@ void Server_Game::setActivePhase(int _activePhase)
|
||||||
void Server_Game::nextTurn()
|
void Server_Game::nextTurn()
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&gameMutex);
|
QMutexLocker locker(&gameMutex);
|
||||||
|
|
||||||
const QList<int> keys = players.keys();
|
const QList<int> keys = players.keys();
|
||||||
int listPos = -1;
|
int listPos = -1;
|
||||||
if (activePlayer != -1)
|
if (activePlayer != -1)
|
||||||
|
@ -642,7 +642,7 @@ void Server_Game::nextTurn()
|
||||||
if (listPos == keys.size())
|
if (listPos == keys.size())
|
||||||
listPos = 0;
|
listPos = 0;
|
||||||
} while (players.value(keys[listPos])->getSpectator() || players.value(keys[listPos])->getConceded());
|
} while (players.value(keys[listPos])->getSpectator() || players.value(keys[listPos])->getConceded());
|
||||||
|
|
||||||
setActivePlayer(keys[listPos]);
|
setActivePlayer(keys[listPos]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -663,13 +663,13 @@ void Server_Game::createGameJoinedEvent(Server_Player *player, ResponseContainer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rc.enqueuePostResponseItem(ServerMessage::SESSION_EVENT, Server_AbstractUserInterface::prepareSessionEvent(event1));
|
rc.enqueuePostResponseItem(ServerMessage::SESSION_EVENT, Server_AbstractUserInterface::prepareSessionEvent(event1));
|
||||||
|
|
||||||
Event_GameStateChanged event2;
|
Event_GameStateChanged event2;
|
||||||
event2.set_seconds_elapsed(secondsElapsed);
|
event2.set_seconds_elapsed(secondsElapsed);
|
||||||
event2.set_game_started(gameStarted);
|
event2.set_game_started(gameStarted);
|
||||||
event2.set_active_player_id(activePlayer);
|
event2.set_active_player_id(activePlayer);
|
||||||
event2.set_active_phase(activePhase);
|
event2.set_active_phase(activePhase);
|
||||||
|
|
||||||
QMapIterator<int, Server_Player *> playerIterator(players);
|
QMapIterator<int, Server_Player *> playerIterator(players);
|
||||||
while (playerIterator.hasNext())
|
while (playerIterator.hasNext())
|
||||||
playerIterator.next().value()->getInfo(event2.add_player_list(), player, player->getSpectator() && spectatorsSeeEverything, true);
|
playerIterator.next().value()->getInfo(event2.add_player_list(), player, player->getSpectator() && spectatorsSeeEverything, true);
|
||||||
|
@ -680,7 +680,7 @@ void Server_Game::createGameJoinedEvent(Server_Player *player, ResponseContainer
|
||||||
void Server_Game::sendGameEventContainer(GameEventContainer *cont, GameEventStorageItem::EventRecipients recipients, int privatePlayerId)
|
void Server_Game::sendGameEventContainer(GameEventContainer *cont, GameEventStorageItem::EventRecipients recipients, int privatePlayerId)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&gameMutex);
|
QMutexLocker locker(&gameMutex);
|
||||||
|
|
||||||
cont->set_game_id(gameId);
|
cont->set_game_id(gameId);
|
||||||
QMapIterator<int, Server_Player *> playerIterator(players);
|
QMapIterator<int, Server_Player *> playerIterator(players);
|
||||||
while (playerIterator.hasNext()) {
|
while (playerIterator.hasNext()) {
|
||||||
|
@ -694,7 +694,7 @@ void Server_Game::sendGameEventContainer(GameEventContainer *cont, GameEventStor
|
||||||
cont->clear_game_id();
|
cont->clear_game_id();
|
||||||
currentReplay->add_event_list()->CopyFrom(*cont);
|
currentReplay->add_event_list()->CopyFrom(*cont);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete cont;
|
delete cont;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -714,7 +714,7 @@ GameEventContainer *Server_Game::prepareGameEvent(const ::google::protobuf::Mess
|
||||||
void Server_Game::getInfo(ServerInfo_Game &result) const
|
void Server_Game::getInfo(ServerInfo_Game &result) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&gameMutex);
|
QMutexLocker locker(&gameMutex);
|
||||||
|
|
||||||
result.set_room_id(room->getId());
|
result.set_room_id(room->getId());
|
||||||
result.set_game_id(gameId);
|
result.set_game_id(gameId);
|
||||||
if (gameClosed)
|
if (gameClosed)
|
||||||
|
@ -722,7 +722,7 @@ void Server_Game::getInfo(ServerInfo_Game &result) const
|
||||||
else {
|
else {
|
||||||
for (int i = 0; i < gameTypes.size(); ++i)
|
for (int i = 0; i < gameTypes.size(); ++i)
|
||||||
result.add_game_types(gameTypes[i]);
|
result.add_game_types(gameTypes[i]);
|
||||||
|
|
||||||
result.set_max_players(getMaxPlayers());
|
result.set_max_players(getMaxPlayers());
|
||||||
result.set_description(getDescription().toStdString());
|
result.set_description(getDescription().toStdString());
|
||||||
result.set_with_password(!getPassword().isEmpty());
|
result.set_with_password(!getPassword().isEmpty());
|
||||||
|
|
|
@ -65,6 +65,7 @@ CardInfo *OracleImporter::addCard(const QString &setName,
|
||||||
bool isToken,
|
bool isToken,
|
||||||
int cardId,
|
int cardId,
|
||||||
QString &cardCost,
|
QString &cardCost,
|
||||||
|
QString &cmc,
|
||||||
const QString &cardType,
|
const QString &cardType,
|
||||||
const QString &cardPT,
|
const QString &cardPT,
|
||||||
int cardLoyalty,
|
int cardLoyalty,
|
||||||
|
@ -117,7 +118,7 @@ CardInfo *OracleImporter::addCard(const QString &setName,
|
||||||
|
|
||||||
bool cipt = (cardText.contains(cardName + " enters the battlefield tapped."));
|
bool cipt = (cardText.contains(cardName + " enters the battlefield tapped."));
|
||||||
|
|
||||||
card = new CardInfo(this, cardName, isToken, cardCost, cardType, cardPT, fullCardText, colors, cardLoyalty, cipt);
|
card = new CardInfo(this, cardName, isToken, cardCost, cmc, cardType, cardPT, fullCardText, colors, cardLoyalty, cipt);
|
||||||
int tableRow = 1;
|
int tableRow = 1;
|
||||||
QString mainCardType = card->getMainCardType();
|
QString mainCardType = card->getMainCardType();
|
||||||
if ((mainCardType == "Land") || mArtifact)
|
if ((mainCardType == "Land") || mArtifact)
|
||||||
|
@ -143,6 +144,7 @@ int OracleImporter::importTextSpoiler(CardSet *set, const QVariant &data)
|
||||||
QVariantMap map;
|
QVariantMap map;
|
||||||
QString cardName;
|
QString cardName;
|
||||||
QString cardCost;
|
QString cardCost;
|
||||||
|
QString cmc;
|
||||||
QString cardType;
|
QString cardType;
|
||||||
QString cardPT;
|
QString cardPT;
|
||||||
QString cardText;
|
QString cardText;
|
||||||
|
@ -185,6 +187,7 @@ int OracleImporter::importTextSpoiler(CardSet *set, const QVariant &data)
|
||||||
// add first card's data
|
// add first card's data
|
||||||
cardName = card1->contains("name") ? card1->value("name").toString() : QString("");
|
cardName = card1->contains("name") ? card1->value("name").toString() : QString("");
|
||||||
cardCost = card1->contains("manaCost") ? card1->value("manaCost").toString() : QString("");
|
cardCost = card1->contains("manaCost") ? card1->value("manaCost").toString() : QString("");
|
||||||
|
cmc = card1->contains("cmc") ? card1->value("cmc").toString() : QString("");
|
||||||
cardType = card1->contains("type") ? card1->value("type").toString() : QString("");
|
cardType = card1->contains("type") ? card1->value("type").toString() : QString("");
|
||||||
cardPT = card1->contains("power") || card1->contains("toughness") ? card1->value("power").toString() + QString('/') + card1->value("toughness").toString() : QString("");
|
cardPT = card1->contains("power") || card1->contains("toughness") ? card1->value("power").toString() + QString('/') + card1->value("toughness").toString() : QString("");
|
||||||
cardText = card1->contains("text") ? card1->value("text").toString() : QString("");
|
cardText = card1->contains("text") ? card1->value("text").toString() : QString("");
|
||||||
|
@ -192,18 +195,22 @@ int OracleImporter::importTextSpoiler(CardSet *set, const QVariant &data)
|
||||||
// add second card's data
|
// add second card's data
|
||||||
cardName += card2->contains("name") ? QString(" // ") + card2->value("name").toString() : QString("");
|
cardName += card2->contains("name") ? QString(" // ") + card2->value("name").toString() : QString("");
|
||||||
cardCost += card2->contains("manaCost") ? QString(" // ") + card2->value("manaCost").toString() : QString("");
|
cardCost += card2->contains("manaCost") ? QString(" // ") + card2->value("manaCost").toString() : QString("");
|
||||||
|
cmc += card2->contains("cmc") ? QString(" // ") + card2->value("cmc").toString() : QString("");
|
||||||
cardType += card2->contains("type") ? QString(" // ") + card2->value("type").toString() : QString("");
|
cardType += card2->contains("type") ? QString(" // ") + card2->value("type").toString() : QString("");
|
||||||
cardPT += card2->contains("power") || card2->contains("toughness") ? QString(" // ") + card2->value("power").toString() + QString('/') + card2->value("toughness").toString() : QString("");
|
cardPT += card2->contains("power") || card2->contains("toughness") ? QString(" // ") + card2->value("power").toString() + QString('/') + card2->value("toughness").toString() : QString("");
|
||||||
cardText += card2->contains("text") ? QString("\n\n---\n\n") + card2->value("text").toString() : QString("");
|
cardText += card2->contains("text") ? QString("\n\n---\n\n") + card2->value("text").toString() : QString("");
|
||||||
} else {
|
} else {
|
||||||
// first card od a pair; enqueue for later merging
|
// first card of a pair; enqueue for later merging
|
||||||
splitCards.insert(cardId, map);
|
// Conditional on cardId because promo prints have no muid - see #640
|
||||||
|
if (cardId)
|
||||||
|
splitCards.insert(cardId, map);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// normal cards handling
|
// normal cards handling
|
||||||
cardName = map.contains("name") ? map.value("name").toString() : QString("");
|
cardName = map.contains("name") ? map.value("name").toString() : QString("");
|
||||||
cardCost = map.contains("manaCost") ? map.value("manaCost").toString() : QString("");
|
cardCost = map.contains("manaCost") ? map.value("manaCost").toString() : QString("");
|
||||||
|
cmc = map.contains("cmc") ? map.value("cmc").toString() : QString("");
|
||||||
cardType = map.contains("type") ? map.value("type").toString() : QString("");
|
cardType = map.contains("type") ? map.value("type").toString() : QString("");
|
||||||
cardPT = map.contains("power") || map.contains("toughness") ? map.value("power").toString() + QString('/') + map.value("toughness").toString() : QString("");
|
cardPT = map.contains("power") || map.contains("toughness") ? map.value("power").toString() + QString('/') + map.value("toughness").toString() : QString("");
|
||||||
cardText = map.contains("text") ? map.value("text").toString() : QString("");
|
cardText = map.contains("text") ? map.value("text").toString() : QString("");
|
||||||
|
@ -218,7 +225,7 @@ int OracleImporter::importTextSpoiler(CardSet *set, const QVariant &data)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cardIsToken) {
|
if (!cardIsToken) {
|
||||||
CardInfo *card = addCard(set->getShortName(), cardName, cardIsToken, cardId, cardCost, cardType, cardPT, cardLoyalty, cardText.split("\n"));
|
CardInfo *card = addCard(set->getShortName(), cardName, cardIsToken, cardId, cardCost, cmc, cardType, cardPT, cardLoyalty, cardText.split("\n"));
|
||||||
|
|
||||||
if (!set->contains(card)) {
|
if (!set->contains(card)) {
|
||||||
card->addToSet(set);
|
card->addToSet(set);
|
||||||
|
|
|
@ -32,7 +32,7 @@ private:
|
||||||
QVariantMap setsMap;
|
QVariantMap setsMap;
|
||||||
QString dataDir;
|
QString dataDir;
|
||||||
|
|
||||||
CardInfo *addCard(const QString &setName, QString cardName, bool isToken, int cardId, QString &cardCost, const QString &cardType, const QString &cardPT, int cardLoyalty, const QStringList &cardText);
|
CardInfo *addCard(const QString &setName, QString cardName, bool isToken, int cardId, QString &cardCost, QString &cmc, const QString &cardType, const QString &cardPT, int cardLoyalty, const QStringList &cardText);
|
||||||
signals:
|
signals:
|
||||||
void setIndexChanged(int cardsImported, int setIndex, const QString &setName);
|
void setIndexChanged(int cardsImported, int setIndex, const QString &setName);
|
||||||
void dataReadProgress(int bytesRead, int totalBytes);
|
void dataReadProgress(int bytesRead, int totalBytes);
|
||||||
|
|
|
@ -9,4 +9,4 @@ if [[ $TRAVIS_OS_NAME == "osx" && $QT4 == 0 ]]; then
|
||||||
prefix="-DCMAKE_PREFIX_PATH=/usr/local/Cellar/qt5/5.4.0/"
|
prefix="-DCMAKE_PREFIX_PATH=/usr/local/Cellar/qt5/5.4.0/"
|
||||||
fi
|
fi
|
||||||
cmake .. -DWITH_SERVER=1 -DWITH_QT4=$QT4 $prefix
|
cmake .. -DWITH_SERVER=1 -DWITH_QT4=$QT4 $prefix
|
||||||
make
|
make -j2
|
||||||
|
|