Merge remote-tracking branch 'Cockatrice/master' into 1505_fix

This commit is contained in:
Jeff 2015-09-12 17:23:40 -04:00
commit 73677e16f6
274 changed files with 40317 additions and 15128 deletions

3
.gitignore vendored
View file

@ -4,5 +4,4 @@ build*
.directory
mysql.cnf
.DS_Store
.idea/
.tx/
.idea/

13
.tx/config Normal file
View file

@ -0,0 +1,13 @@
[main]
host = https://www.transifex.com
[cockatrice.cockatrice]
file_filter = cockatrice/translations/cockatrice_<lang>.ts
source_file = cockatrice/translations/cockatrice_en.ts
source_lang = en
[cockatrice.oracle]
file_filter = oracle/translations/oracle_<lang>.ts
source_file = oracle/translations/oracle_en.ts
source_lang = en

View file

@ -221,7 +221,7 @@ option(WITH_CLIENT "build cockatrice" ON)
if(WITH_CLIENT)
add_subdirectory(cockatrice)
add_subdirectory(sounds)
add_subdirectory(zonebg)
add_subdirectory(themes)
SET(CPACK_INSTALL_CMAKE_PROJECTS "cockatrice;cockatrice;ALL;/" ${CPACK_INSTALL_CMAKE_PROJECTS})
endif()

View file

@ -63,9 +63,10 @@ To compile:
The following flags can be passed to `cmake`:
- `-DWITH_SERVER=1` Build the server
- `-DWITH_CLIENT=0` Do not build the client
- `-DWITH_ORACLE=0` Do not build Oracle
- `-DWITH_SERVER=1` Build the server.
- `-DWITH_CLIENT=0` Do not build the client.
- `-DWITH_ORACLE=0` Do not build oracle.
- `-DPORTABLE=1` Build portable versions of client & oracle.
- `-DWITH_QT4=1` Force compilation to use Qt4 instead of Qt5.
- `-DCMAKE_BUILD_TYPE=Debug` Compile in debug mode. Enables extra logging output, debug symbols, and much more verbose compiler warnings.
- `-DUPDATE_TRANSLATIONS=1` Configure `make` to update the translation .ts files for new strings in the source code. Note: Running `make clean` will remove the .ts files.

View file

@ -6,8 +6,8 @@ PROJECT(cockatrice)
SET(cockatrice_SOURCES
src/abstractcounter.cpp
src/counter_general.cpp
src/dlg_creategame.cpp
src/counter_general.cpp
src/dlg_creategame.cpp
src/dlg_filter_games.cpp
src/dlg_connect.cpp
src/dlg_create_token.cpp
@ -87,6 +87,7 @@ SET(cockatrice_SOURCES
src/playerlistwidget.cpp
src/pixmapgenerator.cpp
src/settingscache.cpp
src/thememanager.cpp
src/localserver.cpp
src/localserverinterface.cpp
src/localclient.cpp
@ -98,6 +99,12 @@ SET(cockatrice_SOURCES
src/sequenceEdit/sequenceedit.cpp
src/sequenceEdit/shortcutstab.cpp
src/lineeditcompleter.cpp
src/settings/settingsmanager.cpp
src/settings/carddatabasesettings.cpp
src/settings/serverssettings.cpp
src/settings/messagesettings.cpp
src/settings/gamefilterssettings.cpp
src/settings/layoutssettings.cpp
${VERSION_STRING_CPP}
)
@ -130,22 +137,14 @@ set(COCKATRICE_LIBS)
# Qt4 stuff
if(Qt4_FOUND)
if (NOT QT_QTMULTIMEDIA_FOUND)
FIND_PACKAGE(QtMobility REQUIRED)
endif()
SET(QT_USE_QTNETWORK TRUE)
SET(QT_USE_QTMULTIMEDIA TRUE)
SET(QT_USE_QTSVG TRUE)
# Include directories
INCLUDE(${QT_USE_FILE})
INCLUDE_DIRECTORIES(${QT_INCLUDES})
INCLUDE_DIRECTORIES(${QT_MOBILITY_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${QT_MOBILITY_MULTIMEDIAKIT_INCLUDE_DIR})
LIST(APPEND COCKATRICE_LIBS ${QT_LIBRARIES})
LIST(APPEND COCKATRICE_LIBS ${QT_QTMAIN_LIBRARY})
LIST(APPEND COCKATRICE_LIBS ${QT_MOBILITY_MULTIMEDIAKIT_LIBRARY})
# Let cmake chew Qt4's translations and resource files
# Note: header files are MOC-ed automatically by cmake
@ -274,11 +273,11 @@ if(APPLE)
set(plugin_dest_dir cockatrice.app/Contents/Plugins)
set(qtconf_dest_dir cockatrice.app/Contents/Resources)
# qt4: codecs, iconengines, imageformats, phonon_backend
# qt4: codecs, iconengines, imageformats
# qt5: audio, iconengines, imageformats, platforms, printsupport
install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime
FILES_MATCHING REGEX "(audio|codecs|iconengines|imageformats|phonon_backend|platforms|printsupport)/.*\\.dylib"
FILES_MATCHING REGEX "(audio|codecs|iconengines|imageformats|platforms|printsupport)/.*\\.dylib"
REGEX ".*_debug\\.dylib" EXCLUDE)
install(CODE "
@ -302,11 +301,11 @@ if(WIN32)
set(plugin_dest_dir Plugins)
set(qtconf_dest_dir .)
# qt4: codecs, iconengines, imageformats, phonon_backend
# qt4: codecs, iconengines, imageformats
# qt5: audio, iconengines, imageformats, platforms, printsupport
install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime
FILES_MATCHING REGEX "(audio|codecs|iconengines|imageformats|phonon_backend|platforms|printsupport)/.*[^d]\\.dll")
FILES_MATCHING REGEX "(audio|codecs|iconengines|imageformats|platforms|printsupport)/.*[^d]\\.dll")
install(CODE "
file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"[Paths]
@ -327,3 +326,8 @@ Data = Resources\")
install(FILES ${WIN32SSLRUNTIME_LIBRARIES} DESTINATION ./)
endif()
endif()
#Compile a portable version, default off
option(PORTABLE "portable build" OFF)
IF(PORTABLE)
add_definitions(-DPORTABLE_BUILD)
endif()

View file

@ -1,57 +1,58 @@
<RCC>
<qresource prefix="/">
<file alias="back.svg">resources/back.svg</file>
<file>resources/lock.svg</file>
<file>resources/icon_delete.svg</file>
<file>resources/icon_tab_changed.svg</file>
<file>resources/icon_config_general.svg</file>
<file>resources/icon_config_appearance.svg</file>
<file>resources/icon_config_interface.svg</file>
<file>resources/icon_config_messages.svg</file>
<file>resources/icon_config_deckeditor.svg</file>
<file>resources/icon_config_sound.svg</file>
<file>resources/phases/icon_phase_untap.svg</file>
<file>resources/phases/icon_phase_upkeep.svg</file>
<file>resources/phases/icon_phase_draw.svg</file>
<file>resources/phases/icon_phase_main1.svg</file>
<file>resources/phases/icon_phase_combat_start.svg</file>
<file>resources/phases/icon_phase_combat_attackers.svg</file>
<file>resources/phases/icon_phase_combat_blockers.svg</file>
<file>resources/phases/icon_phase_combat_damage.svg</file>
<file>resources/phases/icon_phase_combat_end.svg</file>
<file>resources/phases/icon_phase_main2.svg</file>
<file>resources/phases/icon_phase_cleanup.svg</file>
<file>resources/phases/icon_phase_nextturn.svg</file>
<file>resources/icon_settings.svg</file>
<qresource prefix="/" >
<file>resources/back.svg</file>
<file>resources/cockatrice.svg</file>
<file>resources/hand.svg</file>
<file>resources/pencil.svg</file>
<file>resources/icon_search_black.svg</file>
<file>resources/icon_clearsearch.svg</file>
<file>resources/icon_update.png</file>
<file>resources/icon_view.svg</file>
<file>resources/hr.jpg</file>
<file alias="resources/appicon.svg">resources/cockatrice.svg</file>
<file>resources/add_to_sideboard.svg</file>
<file>resources/decrement.svg</file>
<file>resources/increment.svg</file>
<file>resources/remove_row.svg</file>
<file>resources/arrow_left_green.svg</file>
<file>resources/arrow_right_green.svg</file>
<file>resources/arrow_top_green.svg</file>
<file>resources/arrow_up_green.svg</file>
<file>resources/arrow_down_green.svg</file>
<file>resources/arrow_bottom_green.svg</file>
<file>resources/icon_ready_start.svg</file>
<file>resources/icon_not_ready_start.svg</file>
<file>resources/icon_conceded.svg</file>
<file>resources/icon_player.svg</file>
<file>resources/icon_spectator.svg</file>
<file>resources/replay_start.svg</file>
<file>resources/replay_fastforward.svg</file>
<file>resources/replay_pause.svg</file>
<file>resources/genders/male.svg</file>
<file>resources/genders/female.svg</file>
<file>resources/genders/unknown.svg</file>
<file>resources/icons/arrow_bottom_green.svg</file>
<file>resources/icons/arrow_down_green.svg</file>
<file>resources/icons/arrow_left_green.svg</file>
<file>resources/icons/arrow_right_blue.svg</file>
<file>resources/icons/arrow_right_green.svg</file>
<file>resources/icons/arrow_top_green.svg</file>
<file>resources/icons/arrow_up_green.svg</file>
<file>resources/icons/clearsearch.svg</file>
<file>resources/icons/conceded.svg</file>
<file>resources/icons/decrement.svg</file>
<file>resources/icons/delete.svg</file>
<file>resources/icons/increment.svg</file>
<file>resources/icons/lock.svg</file>
<file>resources/icons/not_ready_start.svg</file>
<file>resources/icons/pencil.svg</file>
<file>resources/icons/player.svg</file>
<file>resources/icons/ready_start.svg</file>
<file>resources/icons/remove_row.svg</file>
<file>resources/icons/search.svg</file>
<file>resources/icons/settings.svg</file>
<file>resources/icons/spectator.svg</file>
<file>resources/icons/tab_changed.svg</file>
<file>resources/icons/update.png</file>
<file>resources/icons/view.svg</file>
<file>resources/config/general.svg</file>
<file>resources/config/appearance.svg</file>
<file>resources/config/interface.svg</file>
<file>resources/config/messages.svg</file>
<file>resources/config/deckeditor.svg</file>
<file>resources/config/shorcuts.svg</file>
<file>resources/config/sound.svg</file>
<file>resources/counters/w.svg</file>
<file>resources/counters/w_highlight.svg</file>
<file>resources/counters/u.svg</file>
<file>resources/counters/u_highlight.svg</file>
<file>resources/counters/b.svg</file>
<file>resources/counters/b_highlight.svg</file>
<file>resources/counters/r.svg</file>
<file>resources/counters/r_highlight.svg</file>
<file>resources/counters/g.svg</file>
<file>resources/counters/g_highlight.svg</file>
<file>resources/counters/storm.svg</file>
<file>resources/counters/storm_highlight.svg</file>
<file>resources/counters/general.svg</file>
<file>resources/counters/general_highlight.svg</file>
<file>resources/countries/ad.svg</file>
<file>resources/countries/ae.svg</file>
<file>resources/countries/af.svg</file>
@ -301,20 +302,28 @@
<file>resources/countries/za.svg</file>
<file>resources/countries/zm.svg</file>
<file>resources/countries/zw.svg</file>
<file>resources/counters/w.svg</file>
<file>resources/counters/w_highlight.svg</file>
<file>resources/counters/u.svg</file>
<file>resources/counters/u_highlight.svg</file>
<file>resources/counters/b.svg</file>
<file>resources/counters/b_highlight.svg</file>
<file>resources/counters/r.svg</file>
<file>resources/counters/r_highlight.svg</file>
<file>resources/counters/g.svg</file>
<file>resources/counters/g_highlight.svg</file>
<file>resources/counters/storm.svg</file>
<file>resources/counters/storm_highlight.svg</file>
<file>resources/counters/general.svg</file>
<file>resources/counters/general_highlight.svg</file>
<file>resources/genders/male.svg</file>
<file>resources/genders/female.svg</file>
<file>resources/genders/unknown.svg</file>
<file>resources/phases/untap.svg</file>
<file>resources/phases/upkeep.svg</file>
<file>resources/phases/draw.svg</file>
<file>resources/phases/main1.svg</file>
<file>resources/phases/combat_start.svg</file>
<file>resources/phases/combat_attackers.svg</file>
<file>resources/phases/combat_blockers.svg</file>
<file>resources/phases/combat_damage.svg</file>
<file>resources/phases/combat_end.svg</file>
<file>resources/phases/main2.svg</file>
<file>resources/phases/cleanup.svg</file>
<file>resources/phases/nextturn.svg</file>
<file>resources/replay/start.svg</file>
<file>resources/replay/fastforward.svg</file>
<file>resources/replay/pause.svg</file>
<file>resources/userlevels/normal.svg</file>
<file>resources/userlevels/registered.svg</file>
<file>resources/userlevels/registered_buddy.svg</file>
@ -322,8 +331,5 @@
<file>resources/userlevels/moderator_buddy.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/question_mark.svg</file>
<file>resources/icon_config_shorcuts.svg</file>
</qresource>
</RCC>

View file

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View file

Before

Width:  |  Height:  |  Size: 8.7 KiB

After

Width:  |  Height:  |  Size: 8.7 KiB

View file

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View file

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View file

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View file

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

View file

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

View file

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View file

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View file

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View file

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View file

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View file

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View file

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View file

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

View file

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

View file

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

View file

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View file

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

View file

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View file

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View file

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

View file

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

View file

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View file

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View file

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

View file

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View file

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View file

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

View file

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

View file

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View file

@ -1,75 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<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:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="100"
height="100"
id="svg2858"
version="1.1"
inkscape:version="0.48.0 r9654"
sodipodi:docname="icon_tab_changed.svg">
<defs
id="defs2860">
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 526.18109 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="744.09448 : 526.18109 : 1"
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
id="perspective2866" />
<inkscape:perspective
id="perspective2853"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="5"
inkscape:cx="4.1"
inkscape:cy="49.523097"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1280"
inkscape:window-height="949"
inkscape:window-x="0"
inkscape:window-y="25"
inkscape:window-maximized="1" />
<metadata
id="metadata2863">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-952.36218)">
<path
style="font-size:253.89010620000001950px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#e50000;fill-opacity:1;stroke:#000000;stroke-width:2.39700006999999982;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline;font-family:Century Schoolbook L;-inkscape-font-specification:Century Schoolbook L Medium"
d="m 53.225642,1018.5513 c 0.486911,-13.2677 1.704142,-22.64046 4.016877,-30.55249 3.895149,-13.38951 4.138607,-14.48503 4.138607,-19.23224 0,-7.66855 -4.260334,-12.17232 -11.320268,-12.17232 -7.181659,0 -11.441984,4.50377 -11.441984,12.17232 0,3.16481 0.60863,7.18167 1.704135,10.83336 4.868924,16.06746 5.720972,21.30157 6.45134,38.95137 l 6.451293,0 m -3.286511,6.8165 c -6.207884,0 -11.320257,5.1124 -11.320257,11.3204 0,6.2079 5.112373,11.4419 11.198528,11.4419 6.451342,0 11.563724,-5.1124 11.563724,-11.4419 0,-6.208 -5.112382,-11.3204 -11.441995,-11.3204"
id="text3838" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 3.1 KiB

View file

@ -1,105 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<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"
width="100"
height="100"
id="svg2858"
version="1.1"
inkscape:version="0.48.0 r9654"
sodipodi:docname="exclamation_mark.svg">
<defs
id="defs2860">
<linearGradient
inkscape:collect="always"
id="linearGradient3795">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop3797" />
<stop
style="stop-color:#000000;stop-opacity:0;"
offset="1"
id="stop3799" />
</linearGradient>
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 526.18109 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="744.09448 : 526.18109 : 1"
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
id="perspective2866" />
<inkscape:perspective
id="perspective2853"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3795"
id="linearGradient3801"
x1="29.834375"
y1="999.20284"
x2="72.173357"
y2="999.20284"
gradientUnits="userSpaceOnUse" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="5"
inkscape:cx="24.413577"
inkscape:cy="49.523097"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1280"
inkscape:window-height="949"
inkscape:window-x="0"
inkscape:window-y="25"
inkscape:window-maximized="1" />
<metadata
id="metadata2863">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-952.36218)">
<text
xml:space="preserve"
style="font-size:129.98471069px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#e00000;fill-opacity:1;stroke:#000000;stroke-width:1.78699994;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;font-family:Rachana;-inkscape-font-specification:Rachana"
x="18.646267"
y="1045.775"
id="text3791"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3793"
x="18.646267"
y="1045.775"
style="fill:#e00000;fill-opacity:1;stroke-width:1.78699994;stroke-miterlimit:4;stroke-dasharray:none">?</tspan></text>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 3.4 KiB

View file

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View file

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

View file

Before

Width:  |  Height:  |  Size: 145 KiB

After

Width:  |  Height:  |  Size: 145 KiB

View file

Before

Width:  |  Height:  |  Size: 7.8 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

View file

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View file

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View file

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View file

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

View file

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View file

Before

Width:  |  Height:  |  Size: 8.3 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

View file

Before

Width:  |  Height:  |  Size: 8.7 KiB

After

Width:  |  Height:  |  Size: 8.7 KiB

View file

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View file

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

View file

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View file

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View file

@ -1,100 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<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"
width="32px"
height="32px"
id="svg3320"
version="1.1"
inkscape:version="0.48.5 r10040"
sodipodi:docname="replay_stop.svg">
<defs
id="defs3322">
<linearGradient
id="linearGradient2237">
<stop
style="stop-color:#006000;stop-opacity:1;"
offset="0"
id="stop2239" />
<stop
style="stop-color:#48ff00;stop-opacity:1;"
offset="1"
id="stop2241" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3207"
id="linearGradient3998"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.8996584,0,0,0.8996584,543.08369,-117.97095)"
x1="293.33597"
y1="423.03891"
x2="330.00668"
y2="472.74878" />
<linearGradient
id="linearGradient3207">
<stop
id="stop3209"
offset="0"
style="stop-color:#ffffff;stop-opacity:1;" />
<stop
id="stop3211"
offset="1"
style="stop-color:#48ff00;stop-opacity:0;" />
</linearGradient>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="22.395604"
inkscape:cx="12.669812"
inkscape:cy="27.464311"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:grid-bbox="true"
inkscape:document-units="px"
inkscape:window-width="1099"
inkscape:window-height="800"
inkscape:window-x="128"
inkscape:window-y="20"
inkscape:window-maximized="0">
<inkscape:grid
type="xygrid"
id="grid2990" />
</sodipodi:namedview>
<metadata
id="metadata3325">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<rect
style="fill:#b60000;fill-opacity:1;fill-rule:nonzero;stroke:#3f0000;stroke-opacity:1;stroke-width:0.8;stroke-miterlimit:4;stroke-dasharray:none"
id="rect2994"
width="20.271835"
height="20.271835"
x="5.8940139"
y="5.2983313" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.8 KiB

View file

@ -19,6 +19,7 @@
#include "get_pb_extension.h"
#include <google/protobuf/descriptor.h>
#include "client_metatypes.h"
#include "featureset.h"
AbstractClient::AbstractClient(QObject *parent)
: QObject(parent), nextCmdId(0), status(StatusDisconnected)
@ -45,6 +46,10 @@ AbstractClient::AbstractClient(QObject *parent)
qRegisterMetaType<ServerInfo_User>("ServerInfo_User");
qRegisterMetaType<QList<ServerInfo_User> >("QList<ServerInfo_User>");
qRegisterMetaType<Event_ReplayAdded>("Event_ReplayAdded");
qRegisterMetaType<QList<QString> >("missingFeatures");
FeatureSet features;
features.initalizeFeatureList(clientFeatures);
connect(this, SIGNAL(sigQueuePendingCommand(PendingCommand *)), this, SLOT(queuePendingCommand(PendingCommand *)));
}

View file

@ -25,6 +25,7 @@ class Event_NotifyUser;
class Event_ConnectionClosed;
class Event_ServerShutdown;
class Event_ReplayAdded;
class FeatureSet;
enum ClientStatus {
StatusDisconnected,
@ -96,6 +97,8 @@ public:
static PendingCommand *prepareRoomCommand(const ::google::protobuf::Message &cmd, int roomId);
static PendingCommand *prepareModeratorCommand(const ::google::protobuf::Message &cmd);
static PendingCommand *prepareAdminCommand(const ::google::protobuf::Message &cmd);
QMap<QString, bool> clientFeatures;
};
#endif

View file

@ -1,12 +1,12 @@
#include "carddatabase.h"
#include "settingscache.h"
#include "thememanager.h"
#include <QCryptographicHash>
#include <QDir>
#include <QDirIterator>
#include <QFile>
#include <QTextStream>
#include <QSettings>
#include <QSvgRenderer>
#include <QPainter>
#include <QUrl>
#include <QSet>
@ -50,46 +50,29 @@ QString CardSet::getCorrectedShortName() const
return invalidFileNames.contains(shortName) ? shortName + "_" : shortName;
}
void CardSet::loadSetOptions()
{
sortKey = settingsCache->cardDatabase().getSortKey(shortName);
enabled = settingsCache->cardDatabase().isEnabled(shortName);
isknown = settingsCache->cardDatabase().isKnown(shortName);
}
void CardSet::setSortKey(unsigned int _sortKey)
{
sortKey = _sortKey;
QSettings settings;
settings.beginGroup("sets");
settings.beginGroup(shortName);
settings.setValue("sortkey", sortKey);
}
void CardSet::loadSetOptions()
{
QSettings settings;
settings.beginGroup("sets");
settings.beginGroup(shortName);
sortKey = settings.value("sortkey", 0).toInt();
enabled = settings.value("enabled", false).toBool();
isknown = settings.value("isknown", false).toBool();
// qDebug() << "load set" << shortName << "key" << sortKey;
settingsCache->cardDatabase().setSortKey(shortName,_sortKey);
}
void CardSet::setEnabled(bool _enabled)
{
enabled = _enabled;
QSettings settings;
settings.beginGroup("sets");
settings.beginGroup(shortName);
settings.setValue("enabled", enabled);
settingsCache->cardDatabase().setEnabled(shortName,_enabled);
}
void CardSet::setIsKnown(bool _isknown)
{
isknown = _isknown;
QSettings settings;
settings.beginGroup("sets");
settings.beginGroup(shortName);
settings.setValue("isknown", isknown);
settingsCache->cardDatabase().setIsKnown(shortName,_isknown);
}
class SetList::KeyCompareFunctor {
@ -642,7 +625,7 @@ void CardInfo::loadPixmap(QPixmap &pixmap)
pixmap = QPixmap();
if (getName().isEmpty()) {
pixmap.load(settingsCache->getCardBackPicturePath());
pixmap = themeManager->getCardBackPixmap();
return;
}
@ -672,15 +655,11 @@ void CardInfo::getPixmap(QSize size, QPixmap &pixmap)
QPixmap bigPixmap;
loadPixmap(bigPixmap);
if (bigPixmap.isNull()) {
if (!getName().isEmpty()) {
if (getName().isEmpty()) {
pixmap = themeManager->getCardBackPixmap();
} else {
pixmap = QPixmap(); // null
return;
} else {
QSvgRenderer svg(QString(":/back.svg"));
bigPixmap = QPixmap(svg.defaultSize());
bigPixmap.fill(Qt::transparent);
QPainter painter(&bigPixmap);
svg.render(&painter);
}
}
@ -808,7 +787,7 @@ CardDatabase::CardDatabase(QObject *parent)
noCard = new CardInfo(this);
QPixmap tmp;
noCard->loadPixmap(tmp); // cache pixmap for card back
connect(settingsCache, SIGNAL(cardBackPicturePathChanged()), noCard, SLOT(updatePixmapCache()));
connect(themeManager, SIGNAL(themeChanged()), noCard, SLOT(updatePixmapCache()));
}
CardDatabase::~CardDatabase()
@ -1253,4 +1232,4 @@ bool CardDatabase::hasDetectedFirstRun()
}
return false;
}
}

View file

@ -11,6 +11,7 @@
#include "pixmapgenerator.h"
#include "settingscache.h"
#include "tab_userlists.h"
#include "soundengine.h"
const QColor DEFAULT_MENTION_COLOR = QColor(194, 31, 47);
const QColor OTHER_USER_COLOR = QColor(0, 65, 255); // dark blue
@ -276,6 +277,7 @@ void ChatView::checkMention(QTextCursor &cursor, QString &message, QString &send
if (userName.toLower() == fullMentionUpToSpaceOrEnd.toLower()) // Is this user you?
{
// You have received a valid mention!!
soundEngine->playSound("chat_mention");
mentionFormat.setBackground(QBrush(getCustomMentionColor()));
mentionFormat.setForeground(settingsCache->getChatMentionForeground() ? QBrush(Qt::white) : QBrush(Qt::black));
cursor.insertText(mention, mentionFormat);
@ -301,6 +303,7 @@ void ChatView::checkMention(QTextCursor &cursor, QString &message, QString &send
if (isModeratorSendingGlobal(userLevel, fullMentionUpToSpaceOrEnd)) {
// Moderator Sending Global Message
soundEngine->playSound("all_mention");
mentionFormat.setBackground(QBrush(getCustomMentionColor()));
mentionFormat.setForeground(settingsCache->getChatMentionForeground() ? QBrush(Qt::white) : QBrush(Qt::black));
cursor.insertText("@" + fullMentionUpToSpaceOrEnd, mentionFormat);

View file

@ -24,6 +24,6 @@ Q_DECLARE_METATYPE(Event_UserMessage)
Q_DECLARE_METATYPE(ServerInfo_User)
Q_DECLARE_METATYPE(QList<ServerInfo_User>)
Q_DECLARE_METATYPE(Event_ReplayAdded)
Q_DECLARE_METATYPE(QList<QString>)
#endif

View file

@ -469,7 +469,7 @@ void DeckListModel::printDeckList(QPrinter *printer)
cursor.insertBlock(headerBlockFormat, headerCharFormat);
for (int i = 0; i < root->size(); i++) {
cursor.insertHtml("<br><img src=:/resources/hr.jpg>");
cursor.insertHtml("<br><img src=theme:hr.jpg>");
//cursor.insertHtml("<hr>");
cursor.insertBlock(headerBlockFormat, headerCharFormat);

View file

@ -5,6 +5,7 @@
#include "decklist.h"
#include "carddatabase.h"
#include "settingscache.h"
#include "thememanager.h"
#include "main.h"
DeckViewCardDragItem::DeckViewCardDragItem(DeckViewCard *_item, const QPointF &_hotSpot, AbstractCardDragItem *parentDrag)
@ -128,10 +129,6 @@ void DeckViewCard::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
DeckViewCardContainer::DeckViewCardContainer(const QString &_name)
: QGraphicsItem(), name(_name), width(0), height(0)
{
QString bgPath = settingsCache->getTableBgPath();
if (!bgPath.isEmpty())
bgPixmap.load(bgPath);
setCacheMode(DeviceCoordinateCache);
}
@ -144,17 +141,7 @@ void DeckViewCardContainer::paint(QPainter *painter, const QStyleOptionGraphicsI
{
qreal totalTextWidth = getCardTypeTextWidth();
if (bgPixmap.isNull()) {
QLinearGradient grad1(0, 0, 1, 0);
grad1.setCoordinateMode(QGradient::ObjectBoundingMode);
grad1.setColorAt(0, QColor(30, 30, 30));
grad1.setColorAt(1, QColor(80, 80, 80));
painter->fillRect(QRectF(0, 0, width, height), QBrush(grad1));
painter->fillRect(boundingRect(), QColor(0, 0, 0, 80));
}
else
painter->fillRect(boundingRect(), QBrush(bgPixmap));
painter->fillRect(boundingRect(), themeManager->getTableBgBrush());
painter->setPen(QColor(255, 255, 255, 100));
painter->drawLine(QPointF(0, separatorY), QPointF(width, separatorY));

View file

@ -53,7 +53,6 @@ private:
QMultiMap<QString, DeckViewCard *> cardsByType;
QList<QPair<int, int> > currentRowsAndCols;
qreal width, height;
QPixmap bgPixmap;
int getCardTypeTextWidth() const;
public:
enum { Type = typeDeckViewCardContainer };

View file

@ -1,4 +1,3 @@
#include <QSettings>
#include <QLabel>
#include <QCheckBox>
#include <QComboBox>
@ -11,25 +10,23 @@
#include <QKeyEvent>
#include <iostream>
#include "dlg_connect.h"
#include "settingscache.h"
DlgConnect::DlgConnect(QWidget *parent)
: QDialog(parent)
{
QSettings settings;
settings.beginGroup("server");
previousHostButton = new QRadioButton(tr("Previous Host"), this);
previousHosts = new QComboBox(this);
previousHosts->installEventFilter(new DeleteHighlightedItemWhenShiftDelPressedEventFilter);
QStringList previousHostList = settings.value("previoushosts").toStringList();
QStringList previousHostList = settingsCache->servers().getPreviousHostList();
if (previousHostList.isEmpty()) {
previousHostList << "cockatrice.woogerworks.com";
previousHostList << "vps.poixen.com";
previousHostList << "chickatrice.net";
}
previousHosts->addItems(previousHostList);
previousHosts->setCurrentIndex(settings.value("previoushostindex").toInt());
previousHosts->setCurrentIndex(settingsCache->servers().getPrevioushostindex());
newHostButton = new QRadioButton(tr("New Host"), this);
@ -39,28 +36,28 @@ DlgConnect::DlgConnect(QWidget *parent)
hostLabel->setBuddy(hostEdit);
portLabel = new QLabel(tr("&Port:"));
portEdit = new QLineEdit(settings.value("port", "4747").toString());
portEdit = new QLineEdit(settingsCache->servers().getPort("4747"));
portLabel->setBuddy(portEdit);
playernameLabel = new QLabel(tr("Player &name:"));
playernameEdit = new QLineEdit(settings.value("playername", "Player").toString());
playernameEdit = new QLineEdit(settingsCache->servers().getPlayerName("Player"));
playernameLabel->setBuddy(playernameEdit);
passwordLabel = new QLabel(tr("P&assword:"));
passwordEdit = new QLineEdit(settings.value("password").toString());
passwordEdit = new QLineEdit(settingsCache->servers().getPassword());
passwordLabel->setBuddy(passwordEdit);
passwordEdit->setEchoMode(QLineEdit::Password);
savePasswordCheckBox = new QCheckBox(tr("&Save password"));
savePasswordCheckBox->setChecked(settings.value("save_password", 1).toInt());
savePasswordCheckBox->setChecked(settingsCache->servers().getSavePassword());
autoConnectCheckBox = new QCheckBox(tr("A&uto connect at start"));
if(savePasswordCheckBox->isChecked())
{
autoConnectCheckBox->setChecked(settings.value("auto_connect", 0).toInt());
autoConnectCheckBox->setChecked(settingsCache->servers().getAutoConnect());
autoConnectCheckBox->setEnabled(true);
} else {
settings.setValue("auto_connect", 0);
settingsCache->servers().setAutoConnect(0);
autoConnectCheckBox->setChecked(0);
autoConnectCheckBox->setEnabled(false);
}
@ -98,7 +95,7 @@ DlgConnect::DlgConnect(QWidget *parent)
connect(previousHostButton, SIGNAL(toggled(bool)), this, SLOT(previousHostSelected(bool)));
connect(newHostButton, SIGNAL(toggled(bool)), this, SLOT(newHostSelected(bool)));
if (settings.value("previoushostlogin", 1).toInt())
if (settingsCache->servers().getPreviousHostLogin())
previousHostButton->setChecked(true);
else
newHostButton->setChecked(true);
@ -133,14 +130,12 @@ void DlgConnect::passwordSaved(int state)
void DlgConnect::actOk()
{
QSettings settings;
settings.beginGroup("server");
settings.setValue("port", portEdit->text());
settings.setValue("playername", playernameEdit->text());
settings.setValue("password", savePasswordCheckBox->isChecked() ? passwordEdit->text() : QString());
settings.setValue("save_password", savePasswordCheckBox->isChecked() ? 1 : 0);
settings.setValue("auto_connect", autoConnectCheckBox->isChecked() ? 1 : 0);
settings.setValue("previoushostlogin", previousHostButton->isChecked() ? 1 : 0);
settingsCache->servers().setPort(portEdit->text());
settingsCache->servers().setPlayerName(playernameEdit->text());
settingsCache->servers().setPassword(savePasswordCheckBox->isChecked() ? passwordEdit->text() : QString());
settingsCache->servers().setSavePassword(savePasswordCheckBox->isChecked() ? 1 : 0);
settingsCache->servers().setAutoConnect(autoConnectCheckBox->isChecked() ? 1 : 0);
settingsCache->servers().setPreviousHostLogin(previousHostButton->isChecked() ? 1 : 0);
QStringList hostList;
if (newHostButton->isChecked())
@ -151,9 +146,8 @@ void DlgConnect::actOk()
if(!previousHosts->itemText(i).trimmed().isEmpty())
hostList << previousHosts->itemText(i);
settings.setValue("previoushosts", hostList);
settings.setValue("previoushostindex", previousHosts->currentIndex());
settings.endGroup();
settingsCache->servers().setPreviousHostList(hostList);
settingsCache->servers().setPrevioushostindex(previousHosts->currentIndex());
accept();
}
@ -165,12 +159,8 @@ QString DlgConnect::getHost() const {
void DlgConnect::actCancel()
{
QSettings settings;
settings.beginGroup("server");
settings.setValue("save_password", savePasswordCheckBox->isChecked() ? 1 : 0);
settings.setValue("auto_connect", autoConnectCheckBox->isChecked() ? 1 : 0);
settings.endGroup();
settingsCache->servers().setSavePassword(savePasswordCheckBox->isChecked() ? 1 : 0);
settingsCache->servers().setAutoConnect( autoConnectCheckBox->isChecked() ? 1 : 0);
reject();
}

View file

@ -3,21 +3,19 @@
#include <QHBoxLayout>
#include <QLabel>
#include <QMessageBox>
#include <QSettings>
#include "settingscache.h"
#include "dlg_edit_password.h"
DlgEditPassword::DlgEditPassword(QWidget *parent)
: QDialog(parent)
{
QSettings settings;
settings.beginGroup("server");
oldPasswordLabel = new QLabel(tr("Old password:"));
oldPasswordEdit = new QLineEdit();
if(settings.value("save_password", 1).toInt())
oldPasswordEdit->setText(settings.value("password").toString());
if(settingsCache->servers().getSavePassword())
oldPasswordEdit->setText(settingsCache->servers().getPassword());
oldPasswordLabel->setBuddy(oldPasswordEdit);
oldPasswordEdit->setEchoMode(QLineEdit::Password);
@ -62,12 +60,8 @@ void DlgEditPassword::actOk()
return;
}
QSettings settings;
settings.beginGroup("server");
// always save the password so it will be picked up by the connect dialog
settings.setValue("password", newPasswordEdit->text());
settings.endGroup();
settingsCache->servers().setPassword(newPasswordEdit->text());
accept();
}

View file

@ -83,10 +83,10 @@ DlgEditTokens::DlgEditTokens(CardDatabaseModel *_cardDatabaseModel, QWidget *par
connect(chooseTokenView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex, QModelIndex)), this, SLOT(tokenSelectionChanged(QModelIndex, QModelIndex)));
QAction *aAddToken = new QAction(tr("Add token"), this);
aAddToken->setIcon(QIcon(":/resources/increment.svg"));
aAddToken->setIcon(QIcon("theme:icons/increment.svg"));
connect(aAddToken, SIGNAL(triggered()), this, SLOT(actAddToken()));
QAction *aRemoveToken = new QAction(tr("Remove token"), this);
aRemoveToken->setIcon(QIcon(":/resources/decrement.svg"));
aRemoveToken->setIcon(QIcon("theme:icons/decrement.svg"));
connect(aRemoveToken, SIGNAL(triggered()), this, SLOT(actRemoveToken()));
QToolBar *databaseToolBar = new QToolBar;

View file

@ -1,4 +1,3 @@
#include <QSettings>
#include <QLabel>
#include <QGridLayout>
#include <QHBoxLayout>
@ -19,9 +18,9 @@ DlgEditUser::DlgEditUser(QWidget *parent, QString email, int gender, QString cou
genderLabel = new QLabel(tr("Pronouns:"));
genderEdit = new QComboBox();
genderLabel->setBuddy(genderEdit);
genderEdit->insertItem(0, QIcon(":/resources/genders/unknown.svg"), tr("Neutral"));
genderEdit->insertItem(1, QIcon(":/resources/genders/male.svg"), tr("Masculine"));
genderEdit->insertItem(2, QIcon(":/resources/genders/female.svg"), tr("Feminine"));
genderEdit->insertItem(0, QIcon("theme:genders/unknown.svg"), tr("Neutral"));
genderEdit->insertItem(1, QIcon("theme:genders/male.svg"), tr("Masculine"));
genderEdit->insertItem(2, QIcon("theme:genders/female.svg"), tr("Feminine"));
genderEdit->setCurrentIndex(gender + 1);
countryLabel = new QLabel(tr("Country:"));
@ -34,7 +33,7 @@ DlgEditUser::DlgEditUser(QWidget *parent, QString email, int gender, QString cou
int i = 1;
foreach(QString c, countries)
{
countryEdit->addItem(QPixmap(":/resources/countries/" + c + ".svg"), c);
countryEdit->addItem(QPixmap("theme:countries/" + c.toLower() + ".svg"), c);
if (c == country)
countryEdit->setCurrentIndex(i);

View file

@ -9,7 +9,6 @@
#include <QVBoxLayout>
#include <QGridLayout>
#include <QDialogButtonBox>
#include <QSettings>
#include <QCryptographicHash>
DlgFilterGames::DlgFilterGames(const QMap<int, QString> &_allGameTypes, const GamesProxyModel *_gamesProxyModel, QWidget *parent)
@ -17,9 +16,6 @@ DlgFilterGames::DlgFilterGames(const QMap<int, QString> &_allGameTypes, const Ga
allGameTypes(_allGameTypes),
gamesProxyModel(_gamesProxyModel)
{
QSettings settings;
settings.beginGroup("filter_games");
unavailableGamesVisibleCheckBox = new QCheckBox(tr("Show &unavailable games"));
unavailableGamesVisibleCheckBox->setChecked(gamesProxyModel->getUnavailableGamesVisible());

View file

@ -1,4 +1,3 @@
#include <QSettings>
#include <QLabel>
#include <QCheckBox>
#include <QGridLayout>
@ -14,23 +13,20 @@
DlgRegister::DlgRegister(QWidget *parent)
: QDialog(parent)
{
QSettings settings;
settings.beginGroup("server");
hostLabel = new QLabel(tr("&Host:"));
hostEdit = new QLineEdit(settings.value("hostname", "cockatrice.woogerworks.com").toString());
hostEdit = new QLineEdit(settingsCache->servers().getHostname("cockatrice.woogerworks.com"));
hostLabel->setBuddy(hostEdit);
portLabel = new QLabel(tr("&Port:"));
portEdit = new QLineEdit(settings.value("port", "4747").toString());
portLabel = new QLabel(tr("&Port:"));
portEdit = new QLineEdit(settingsCache->servers().getPort("4747"));
portLabel->setBuddy(portEdit);
playernameLabel = new QLabel(tr("Player &name:"));
playernameEdit = new QLineEdit(settings.value("playername", "Player").toString());
playernameLabel = new QLabel(tr("Player &name:"));
playernameEdit = new QLineEdit(settingsCache->servers().getPlayerName("Player"));
playernameLabel->setBuddy(playernameEdit);
passwordLabel = new QLabel(tr("P&assword:"));
passwordEdit = new QLineEdit(settings.value("password").toString());
passwordLabel = new QLabel(tr("P&assword:"));
passwordEdit = new QLineEdit(settingsCache->servers().getPassword());
passwordLabel->setBuddy(passwordEdit);
passwordEdit->setEchoMode(QLineEdit::Password);
@ -50,19 +46,268 @@ DlgRegister::DlgRegister(QWidget *parent)
genderLabel = new QLabel(tr("Pronouns:"));
genderEdit = new QComboBox();
genderLabel->setBuddy(genderEdit);
genderEdit->insertItem(0, QIcon(":/resources/genders/unknown.svg"), tr("Neutral"));
genderEdit->insertItem(1, QIcon(":/resources/genders/male.svg"), tr("Masculine"));
genderEdit->insertItem(2, QIcon(":/resources/genders/female.svg"), tr("Feminine"));
genderEdit->insertItem(0, QIcon("theme:genders/unknown.svg"), tr("Neutral"));
genderEdit->insertItem(1, QIcon("theme:genders/male.svg"), tr("Masculine"));
genderEdit->insertItem(2, QIcon("theme:genders/female.svg"), tr("Feminine"));
genderEdit->setCurrentIndex(0);
countryLabel = new QLabel(tr("Country:"));
countryEdit = new QComboBox();
countryLabel->setBuddy(countryEdit);
countryEdit->insertItem(0, tr("Undefined"));
countryEdit->addItem(QPixmap("theme:countries/ad.svg"), "ad");
countryEdit->addItem(QIcon("theme:countries/ae.svg"), "ae");
countryEdit->addItem(QIcon("theme:countries/af.svg"), "af");
countryEdit->addItem(QIcon("theme:countries/ag.svg"), "ag");
countryEdit->addItem(QIcon("theme:countries/ai.svg"), "ai");
countryEdit->addItem(QIcon("theme:countries/al.svg"), "al");
countryEdit->addItem(QIcon("theme:countries/am.svg"), "am");
countryEdit->addItem(QIcon("theme:countries/ao.svg"), "ao");
countryEdit->addItem(QIcon("theme:countries/aq.svg"), "aq");
countryEdit->addItem(QIcon("theme:countries/ar.svg"), "ar");
countryEdit->addItem(QIcon("theme:countries/as.svg"), "as");
countryEdit->addItem(QIcon("theme:countries/at.svg"), "at");
countryEdit->addItem(QIcon("theme:countries/au.svg"), "au");
countryEdit->addItem(QIcon("theme:countries/aw.svg"), "aw");
countryEdit->addItem(QIcon("theme:countries/ax.svg"), "ax");
countryEdit->addItem(QIcon("theme:countries/az.svg"), "az");
countryEdit->addItem(QIcon("theme:countries/ba.svg"), "ba");
countryEdit->addItem(QIcon("theme:countries/bb.svg"), "bb");
countryEdit->addItem(QIcon("theme:countries/bd.svg"), "bd");
countryEdit->addItem(QIcon("theme:countries/be.svg"), "be");
countryEdit->addItem(QIcon("theme:countries/bf.svg"), "bf");
countryEdit->addItem(QIcon("theme:countries/bg.svg"), "bg");
countryEdit->addItem(QIcon("theme:countries/bh.svg"), "bh");
countryEdit->addItem(QIcon("theme:countries/bi.svg"), "bi");
countryEdit->addItem(QIcon("theme:countries/bj.svg"), "bj");
countryEdit->addItem(QIcon("theme:countries/bl.svg"), "bl");
countryEdit->addItem(QIcon("theme:countries/bm.svg"), "bm");
countryEdit->addItem(QIcon("theme:countries/bn.svg"), "bn");
countryEdit->addItem(QIcon("theme:countries/bo.svg"), "bo");
countryEdit->addItem(QIcon("theme:countries/bq.svg"), "bq");
countryEdit->addItem(QIcon("theme:countries/br.svg"), "br");
countryEdit->addItem(QIcon("theme:countries/bs.svg"), "bs");
countryEdit->addItem(QIcon("theme:countries/bt.svg"), "bt");
countryEdit->addItem(QIcon("theme:countries/bv.svg"), "bv");
countryEdit->addItem(QIcon("theme:countries/bw.svg"), "bw");
countryEdit->addItem(QIcon("theme:countries/by.svg"), "by");
countryEdit->addItem(QIcon("theme:countries/bz.svg"), "bz");
countryEdit->addItem(QIcon("theme:countries/ca.svg"), "ca");
countryEdit->addItem(QIcon("theme:countries/cc.svg"), "cc");
countryEdit->addItem(QIcon("theme:countries/cd.svg"), "cd");
countryEdit->addItem(QIcon("theme:countries/cf.svg"), "cf");
countryEdit->addItem(QIcon("theme:countries/cg.svg"), "cg");
countryEdit->addItem(QIcon("theme:countries/ch.svg"), "ch");
countryEdit->addItem(QIcon("theme:countries/ci.svg"), "ci");
countryEdit->addItem(QIcon("theme:countries/ck.svg"), "ck");
countryEdit->addItem(QIcon("theme:countries/cl.svg"), "cl");
countryEdit->addItem(QIcon("theme:countries/cm.svg"), "cm");
countryEdit->addItem(QIcon("theme:countries/cn.svg"), "cn");
countryEdit->addItem(QIcon("theme:countries/co.svg"), "co");
countryEdit->addItem(QIcon("theme:countries/cr.svg"), "cr");
countryEdit->addItem(QIcon("theme:countries/cu.svg"), "cu");
countryEdit->addItem(QIcon("theme:countries/cv.svg"), "cv");
countryEdit->addItem(QIcon("theme:countries/cw.svg"), "cw");
countryEdit->addItem(QIcon("theme:countries/cx.svg"), "cx");
countryEdit->addItem(QIcon("theme:countries/cy.svg"), "cy");
countryEdit->addItem(QIcon("theme:countries/cz.svg"), "cz");
countryEdit->addItem(QIcon("theme:countries/de.svg"), "de");
countryEdit->addItem(QIcon("theme:countries/dj.svg"), "dj");
countryEdit->addItem(QIcon("theme:countries/dk.svg"), "dk");
countryEdit->addItem(QIcon("theme:countries/dm.svg"), "dm");
countryEdit->addItem(QIcon("theme:countries/do.svg"), "do");
countryEdit->addItem(QIcon("theme:countries/dz.svg"), "dz");
countryEdit->addItem(QIcon("theme:countries/ec.svg"), "ec");
countryEdit->addItem(QIcon("theme:countries/ee.svg"), "ee");
countryEdit->addItem(QIcon("theme:countries/eg.svg"), "eg");
countryEdit->addItem(QIcon("theme:countries/eh.svg"), "eh");
countryEdit->addItem(QIcon("theme:countries/er.svg"), "er");
countryEdit->addItem(QIcon("theme:countries/es.svg"), "es");
countryEdit->addItem(QIcon("theme:countries/et.svg"), "et");
countryEdit->addItem(QIcon("theme:countries/fi.svg"), "fi");
countryEdit->addItem(QIcon("theme:countries/fj.svg"), "fj");
countryEdit->addItem(QIcon("theme:countries/fk.svg"), "fk");
countryEdit->addItem(QIcon("theme:countries/fm.svg"), "fm");
countryEdit->addItem(QIcon("theme:countries/fo.svg"), "fo");
countryEdit->addItem(QIcon("theme:countries/fr.svg"), "fr");
countryEdit->addItem(QIcon("theme:countries/ga.svg"), "ga");
countryEdit->addItem(QIcon("theme:countries/gb.svg"), "gb");
countryEdit->addItem(QIcon("theme:countries/gd.svg"), "gd");
countryEdit->addItem(QIcon("theme:countries/ge.svg"), "ge");
countryEdit->addItem(QIcon("theme:countries/gf.svg"), "gf");
countryEdit->addItem(QIcon("theme:countries/gg.svg"), "gg");
countryEdit->addItem(QIcon("theme:countries/gh.svg"), "gh");
countryEdit->addItem(QIcon("theme:countries/gi.svg"), "gi");
countryEdit->addItem(QIcon("theme:countries/gl.svg"), "gl");
countryEdit->addItem(QIcon("theme:countries/gm.svg"), "gm");
countryEdit->addItem(QIcon("theme:countries/gn.svg"), "gn");
countryEdit->addItem(QIcon("theme:countries/gp.svg"), "gp");
countryEdit->addItem(QIcon("theme:countries/gq.svg"), "gq");
countryEdit->addItem(QIcon("theme:countries/gr.svg"), "gr");
countryEdit->addItem(QIcon("theme:countries/gs.svg"), "gs");
countryEdit->addItem(QIcon("theme:countries/gt.svg"), "gt");
countryEdit->addItem(QIcon("theme:countries/gu.svg"), "gu");
countryEdit->addItem(QIcon("theme:countries/gw.svg"), "gw");
countryEdit->addItem(QIcon("theme:countries/gy.svg"), "gy");
countryEdit->addItem(QIcon("theme:countries/hk.svg"), "hk");
countryEdit->addItem(QIcon("theme:countries/hm.svg"), "hm");
countryEdit->addItem(QIcon("theme:countries/hn.svg"), "hn");
countryEdit->addItem(QIcon("theme:countries/hr.svg"), "hr");
countryEdit->addItem(QIcon("theme:countries/ht.svg"), "ht");
countryEdit->addItem(QIcon("theme:countries/hu.svg"), "hu");
countryEdit->addItem(QIcon("theme:countries/id.svg"), "id");
countryEdit->addItem(QIcon("theme:countries/ie.svg"), "ie");
countryEdit->addItem(QIcon("theme:countries/il.svg"), "il");
countryEdit->addItem(QIcon("theme:countries/im.svg"), "im");
countryEdit->addItem(QIcon("theme:countries/in.svg"), "in");
countryEdit->addItem(QIcon("theme:countries/io.svg"), "io");
countryEdit->addItem(QIcon("theme:countries/iq.svg"), "iq");
countryEdit->addItem(QIcon("theme:countries/ir.svg"), "ir");
countryEdit->addItem(QIcon("theme:countries/is.svg"), "is");
countryEdit->addItem(QIcon("theme:countries/it.svg"), "it");
countryEdit->addItem(QIcon("theme:countries/je.svg"), "je");
countryEdit->addItem(QIcon("theme:countries/jm.svg"), "jm");
countryEdit->addItem(QIcon("theme:countries/jo.svg"), "jo");
countryEdit->addItem(QIcon("theme:countries/jp.svg"), "jp");
countryEdit->addItem(QIcon("theme:countries/ke.svg"), "ke");
countryEdit->addItem(QIcon("theme:countries/kg.svg"), "kg");
countryEdit->addItem(QIcon("theme:countries/kh.svg"), "kh");
countryEdit->addItem(QIcon("theme:countries/ki.svg"), "ki");
countryEdit->addItem(QIcon("theme:countries/km.svg"), "km");
countryEdit->addItem(QIcon("theme:countries/kn.svg"), "kn");
countryEdit->addItem(QIcon("theme:countries/kp.svg"), "kp");
countryEdit->addItem(QIcon("theme:countries/kr.svg"), "kr");
countryEdit->addItem(QIcon("theme:countries/kw.svg"), "kw");
countryEdit->addItem(QIcon("theme:countries/ky.svg"), "ky");
countryEdit->addItem(QIcon("theme:countries/kz.svg"), "kz");
countryEdit->addItem(QIcon("theme:countries/la.svg"), "la");
countryEdit->addItem(QIcon("theme:countries/lb.svg"), "lb");
countryEdit->addItem(QIcon("theme:countries/lc.svg"), "lc");
countryEdit->addItem(QIcon("theme:countries/li.svg"), "li");
countryEdit->addItem(QIcon("theme:countries/lk.svg"), "lk");
countryEdit->addItem(QIcon("theme:countries/lr.svg"), "lr");
countryEdit->addItem(QIcon("theme:countries/ls.svg"), "ls");
countryEdit->addItem(QIcon("theme:countries/lt.svg"), "lt");
countryEdit->addItem(QIcon("theme:countries/lu.svg"), "lu");
countryEdit->addItem(QIcon("theme:countries/lv.svg"), "lv");
countryEdit->addItem(QIcon("theme:countries/ly.svg"), "ly");
countryEdit->addItem(QIcon("theme:countries/ma.svg"), "ma");
countryEdit->addItem(QIcon("theme:countries/mc.svg"), "mc");
countryEdit->addItem(QIcon("theme:countries/md.svg"), "md");
countryEdit->addItem(QIcon("theme:countries/me.svg"), "me");
countryEdit->addItem(QIcon("theme:countries/mf.svg"), "mf");
countryEdit->addItem(QIcon("theme:countries/mg.svg"), "mg");
countryEdit->addItem(QIcon("theme:countries/mh.svg"), "mh");
countryEdit->addItem(QIcon("theme:countries/mk.svg"), "mk");
countryEdit->addItem(QIcon("theme:countries/ml.svg"), "ml");
countryEdit->addItem(QIcon("theme:countries/mm.svg"), "mm");
countryEdit->addItem(QIcon("theme:countries/mn.svg"), "mn");
countryEdit->addItem(QIcon("theme:countries/mo.svg"), "mo");
countryEdit->addItem(QIcon("theme:countries/mp.svg"), "mp");
countryEdit->addItem(QIcon("theme:countries/mq.svg"), "mq");
countryEdit->addItem(QIcon("theme:countries/mr.svg"), "mr");
countryEdit->addItem(QIcon("theme:countries/ms.svg"), "ms");
countryEdit->addItem(QIcon("theme:countries/mt.svg"), "mt");
countryEdit->addItem(QIcon("theme:countries/mu.svg"), "mu");
countryEdit->addItem(QIcon("theme:countries/mv.svg"), "mv");
countryEdit->addItem(QIcon("theme:countries/mw.svg"), "mw");
countryEdit->addItem(QIcon("theme:countries/mx.svg"), "mx");
countryEdit->addItem(QIcon("theme:countries/my.svg"), "my");
countryEdit->addItem(QIcon("theme:countries/mz.svg"), "mz");
countryEdit->addItem(QIcon("theme:countries/na.svg"), "na");
countryEdit->addItem(QIcon("theme:countries/nc.svg"), "nc");
countryEdit->addItem(QIcon("theme:countries/ne.svg"), "ne");
countryEdit->addItem(QIcon("theme:countries/nf.svg"), "nf");
countryEdit->addItem(QIcon("theme:countries/ng.svg"), "ng");
countryEdit->addItem(QIcon("theme:countries/ni.svg"), "ni");
countryEdit->addItem(QIcon("theme:countries/nl.svg"), "nl");
countryEdit->addItem(QIcon("theme:countries/no.svg"), "no");
countryEdit->addItem(QIcon("theme:countries/np.svg"), "np");
countryEdit->addItem(QIcon("theme:countries/nr.svg"), "nr");
countryEdit->addItem(QIcon("theme:countries/nu.svg"), "nu");
countryEdit->addItem(QIcon("theme:countries/nz.svg"), "nz");
countryEdit->addItem(QIcon("theme:countries/om.svg"), "om");
countryEdit->addItem(QIcon("theme:countries/pa.svg"), "pa");
countryEdit->addItem(QIcon("theme:countries/pe.svg"), "pe");
countryEdit->addItem(QIcon("theme:countries/pf.svg"), "pf");
countryEdit->addItem(QIcon("theme:countries/pg.svg"), "pg");
countryEdit->addItem(QIcon("theme:countries/ph.svg"), "ph");
countryEdit->addItem(QIcon("theme:countries/pk.svg"), "pk");
countryEdit->addItem(QIcon("theme:countries/pl.svg"), "pl");
countryEdit->addItem(QIcon("theme:countries/pm.svg"), "pm");
countryEdit->addItem(QIcon("theme:countries/pn.svg"), "pn");
countryEdit->addItem(QIcon("theme:countries/pr.svg"), "pr");
countryEdit->addItem(QIcon("theme:countries/ps.svg"), "ps");
countryEdit->addItem(QIcon("theme:countries/pt.svg"), "pt");
countryEdit->addItem(QIcon("theme:countries/pw.svg"), "pw");
countryEdit->addItem(QIcon("theme:countries/py.svg"), "py");
countryEdit->addItem(QIcon("theme:countries/qa.svg"), "qa");
countryEdit->addItem(QIcon("theme:countries/re.svg"), "re");
countryEdit->addItem(QIcon("theme:countries/ro.svg"), "ro");
countryEdit->addItem(QIcon("theme:countries/rs.svg"), "rs");
countryEdit->addItem(QIcon("theme:countries/ru.svg"), "ru");
countryEdit->addItem(QIcon("theme:countries/rw.svg"), "rw");
countryEdit->addItem(QIcon("theme:countries/sa.svg"), "sa");
countryEdit->addItem(QIcon("theme:countries/sb.svg"), "sb");
countryEdit->addItem(QIcon("theme:countries/sc.svg"), "sc");
countryEdit->addItem(QIcon("theme:countries/sd.svg"), "sd");
countryEdit->addItem(QIcon("theme:countries/se.svg"), "se");
countryEdit->addItem(QIcon("theme:countries/sg.svg"), "sg");
countryEdit->addItem(QIcon("theme:countries/sh.svg"), "sh");
countryEdit->addItem(QIcon("theme:countries/si.svg"), "si");
countryEdit->addItem(QIcon("theme:countries/sj.svg"), "sj");
countryEdit->addItem(QIcon("theme:countries/sk.svg"), "sk");
countryEdit->addItem(QIcon("theme:countries/sl.svg"), "sl");
countryEdit->addItem(QIcon("theme:countries/sm.svg"), "sm");
countryEdit->addItem(QIcon("theme:countries/sn.svg"), "sn");
countryEdit->addItem(QIcon("theme:countries/so.svg"), "so");
countryEdit->addItem(QIcon("theme:countries/sr.svg"), "sr");
countryEdit->addItem(QIcon("theme:countries/ss.svg"), "ss");
countryEdit->addItem(QIcon("theme:countries/st.svg"), "st");
countryEdit->addItem(QIcon("theme:countries/sv.svg"), "sv");
countryEdit->addItem(QIcon("theme:countries/sx.svg"), "sx");
countryEdit->addItem(QIcon("theme:countries/sy.svg"), "sy");
countryEdit->addItem(QIcon("theme:countries/sz.svg"), "sz");
countryEdit->addItem(QIcon("theme:countries/tc.svg"), "tc");
countryEdit->addItem(QIcon("theme:countries/td.svg"), "td");
countryEdit->addItem(QIcon("theme:countries/tf.svg"), "tf");
countryEdit->addItem(QIcon("theme:countries/tg.svg"), "tg");
countryEdit->addItem(QIcon("theme:countries/th.svg"), "th");
countryEdit->addItem(QIcon("theme:countries/tj.svg"), "tj");
countryEdit->addItem(QIcon("theme:countries/tk.svg"), "tk");
countryEdit->addItem(QIcon("theme:countries/tl.svg"), "tl");
countryEdit->addItem(QIcon("theme:countries/tm.svg"), "tm");
countryEdit->addItem(QIcon("theme:countries/tn.svg"), "tn");
countryEdit->addItem(QIcon("theme:countries/to.svg"), "to");
countryEdit->addItem(QIcon("theme:countries/tr.svg"), "tr");
countryEdit->addItem(QIcon("theme:countries/tt.svg"), "tt");
countryEdit->addItem(QIcon("theme:countries/tv.svg"), "tv");
countryEdit->addItem(QIcon("theme:countries/tw.svg"), "tw");
countryEdit->addItem(QIcon("theme:countries/tz.svg"), "tz");
countryEdit->addItem(QIcon("theme:countries/ua.svg"), "ua");
countryEdit->addItem(QIcon("theme:countries/ug.svg"), "ug");
countryEdit->addItem(QIcon("theme:countries/um.svg"), "um");
countryEdit->addItem(QIcon("theme:countries/us.svg"), "us");
countryEdit->addItem(QIcon("theme:countries/uy.svg"), "uy");
countryEdit->addItem(QIcon("theme:countries/uz.svg"), "uz");
countryEdit->addItem(QIcon("theme:countries/va.svg"), "va");
countryEdit->addItem(QIcon("theme:countries/vc.svg"), "vc");
countryEdit->addItem(QIcon("theme:countries/ve.svg"), "ve");
countryEdit->addItem(QIcon("theme:countries/vg.svg"), "vg");
countryEdit->addItem(QIcon("theme:countries/vi.svg"), "vi");
countryEdit->addItem(QIcon("theme:countries/vn.svg"), "vn");
countryEdit->addItem(QIcon("theme:countries/vu.svg"), "vu");
countryEdit->addItem(QIcon("theme:countries/wf.svg"), "wf");
countryEdit->addItem(QIcon("theme:countries/ws.svg"), "ws");
countryEdit->addItem(QIcon("theme:countries/ye.svg"), "ye");
countryEdit->addItem(QIcon("theme:countries/yt.svg"), "yt");
countryEdit->addItem(QIcon("theme:countries/za.svg"), "za");
countryEdit->addItem(QIcon("theme:countries/zm.svg"), "zm");
countryEdit->addItem(QIcon("theme:countries/zw.svg"), "zw");
countryEdit->setCurrentIndex(0);
QStringList countries = settingsCache->getCountries();
foreach(QString c, countries)
countryEdit->addItem(QPixmap(":/resources/countries/" + c + ".svg"), c);
countryEdit->addItem(QPixmap("theme:countries/" + c.toLower() + ".svg"), c);
realnameLabel = new QLabel(tr("Real name:"));
realnameEdit = new QLineEdit();
@ -117,14 +362,11 @@ void DlgRegister::actOk()
return;
}
QSettings settings;
settings.beginGroup("server");
settings.setValue("hostname", hostEdit->text());
settings.setValue("port", portEdit->text());
settings.setValue("playername", playernameEdit->text());
settingsCache->servers().setHostName(hostEdit->text());
settingsCache->servers().setPort(portEdit->text());
settingsCache->servers().setPlayerName(playernameEdit->text());
// always save the password so it will be picked up by the connect dialog
settings.setValue("password", passwordEdit->text());
settings.endGroup();
settingsCache->servers().setPassword(passwordEdit->text());
accept();
}

View file

@ -13,7 +13,6 @@
#include <QToolBar>
#include <QTranslator>
#include <QAction>
#include <QSettings>
#include <QApplication>
#include <QInputDialog>
#include <QSpinBox>
@ -26,6 +25,7 @@
#include "dlg_settings.h"
#include "main.h"
#include "settingscache.h"
#include "thememanager.h"
#include "priceupdater.h"
#include "soundengine.h"
#include "sequenceEdit/shortcutstab.h"
@ -45,6 +45,7 @@ GeneralSettingsPage::GeneralSettingsPage()
picDownloadCheckBox.setChecked(settingsCache->getPicDownload());
picDownloadHqCheckBox.setChecked(settingsCache->getPicDownloadHq());
updateNotificationCheckBox.setChecked(settingsCache->getNotifyAboutUpdates());
pixmapCacheEdit.setMinimum(PIXMAPCACHE_SIZE_MIN);
// 2047 is the max value to avoid overflowing of QPixmapCache::setCacheLimit(int size)
@ -64,19 +65,21 @@ GeneralSettingsPage::GeneralSettingsPage()
connect(&picDownloadHqCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setPicDownloadHq(int)));
connect(&pixmapCacheEdit, SIGNAL(valueChanged(int)), settingsCache, SLOT(setPixmapCacheSize(int)));
connect(&picDownloadHqCheckBox, SIGNAL(clicked(bool)), this, SLOT(setEnabledStatus(bool)));
connect(&updateNotificationCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setNotifyAboutUpdate(int)));
connect(highQualityURLEdit, SIGNAL(textChanged(QString)), settingsCache, SLOT(setPicUrlHq(QString)));
QGridLayout *personalGrid = new QGridLayout;
personalGrid->addWidget(&languageLabel, 0, 0);
personalGrid->addWidget(&languageBox, 0, 1);
personalGrid->addWidget(&pixmapCacheLabel, 1, 0, 1, 1);
personalGrid->addWidget(&pixmapCacheEdit, 1, 1, 1, 1);
personalGrid->addWidget(&picDownloadCheckBox, 2, 0, 1, 2);
personalGrid->addWidget(&picDownloadHqCheckBox, 3, 0, 1, 2);
personalGrid->addWidget(&clearDownloadedPicsButton, 4, 0, 1, 1);
personalGrid->addWidget(&highQualityURLLabel, 5, 0, 1, 1);
personalGrid->addWidget(highQualityURLEdit, 5, 1, 1, 1);
personalGrid->addWidget(&highQualityURLLinkLabel, 6, 1, 1, 1);
personalGrid->addWidget(&pixmapCacheLabel, 1, 0);
personalGrid->addWidget(&pixmapCacheEdit, 1, 1);
personalGrid->addWidget(&updateNotificationCheckBox, 2, 0);
personalGrid->addWidget(&picDownloadCheckBox, 3, 0);
personalGrid->addWidget(&picDownloadHqCheckBox, 4, 0);
personalGrid->addWidget(&highQualityURLLabel, 5, 0);
personalGrid->addWidget(highQualityURLEdit, 5, 1);
personalGrid->addWidget(&highQualityURLLinkLabel, 6, 1);
personalGrid->addWidget(&clearDownloadedPicsButton, 6, 0);
highQualityURLLinkLabel.setTextInteractionFlags(Qt::LinksAccessibleByMouse);
highQualityURLLinkLabel.setOpenExternalLinks(true);
@ -246,6 +249,7 @@ void GeneralSettingsPage::retranslateUi()
highQualityURLLabel.setText(tr("Custom Card Download URL:"));
highQualityURLLinkLabel.setText(QString("<a href='%1'>%2</a>").arg(LINKING_FAQ_URL).arg(tr("Linking FAQ")));
clearDownloadedPicsButton.setText(tr("Reset/Clear Downloaded Pictures"));
updateNotificationCheckBox.setText(tr("Notify when new client features are available"));
}
void GeneralSettingsPage::setEnabledStatus(bool status)
@ -255,67 +259,23 @@ void GeneralSettingsPage::setEnabledStatus(bool status)
AppearanceSettingsPage::AppearanceSettingsPage()
{
QIcon deleteIcon(":/resources/icon_delete.svg");
handBgEdit = new QLineEdit(settingsCache->getHandBgPath());
handBgEdit->setReadOnly(true);
QPushButton *handBgClearButton = new QPushButton(deleteIcon, QString());
connect(handBgClearButton, SIGNAL(clicked()), this, SLOT(handBgClearButtonClicked()));
QPushButton *handBgButton = new QPushButton("...");
connect(handBgButton, SIGNAL(clicked()), this, SLOT(handBgButtonClicked()));
stackBgEdit = new QLineEdit(settingsCache->getStackBgPath());
stackBgEdit->setReadOnly(true);
QPushButton *stackBgClearButton = new QPushButton(deleteIcon, QString());
connect(stackBgClearButton, SIGNAL(clicked()), this, SLOT(stackBgClearButtonClicked()));
QPushButton *stackBgButton = new QPushButton("...");
connect(stackBgButton, SIGNAL(clicked()), this, SLOT(stackBgButtonClicked()));
QString themeName = settingsCache->getThemeName();
tableBgEdit = new QLineEdit(settingsCache->getTableBgPath());
tableBgEdit->setReadOnly(true);
QPushButton *tableBgClearButton = new QPushButton(deleteIcon, QString());
connect(tableBgClearButton, SIGNAL(clicked()), this, SLOT(tableBgClearButtonClicked()));
QPushButton *tableBgButton = new QPushButton("...");
connect(tableBgButton, SIGNAL(clicked()), this, SLOT(tableBgButtonClicked()));
playerAreaBgEdit = new QLineEdit(settingsCache->getPlayerBgPath());
playerAreaBgEdit->setReadOnly(true);
QPushButton *playerAreaBgClearButton = new QPushButton(deleteIcon, QString());
connect(playerAreaBgClearButton, SIGNAL(clicked()), this, SLOT(playerAreaBgClearButtonClicked()));
QPushButton *playerAreaBgButton = new QPushButton("...");
connect(playerAreaBgButton, SIGNAL(clicked()), this, SLOT(playerAreaBgButtonClicked()));
cardBackPicturePathEdit = new QLineEdit(settingsCache->getCardBackPicturePath());
cardBackPicturePathEdit->setReadOnly(true);
QPushButton *cardBackPicturePathClearButton = new QPushButton(deleteIcon, QString());
connect(cardBackPicturePathClearButton, SIGNAL(clicked()), this, SLOT(cardBackPicturePathClearButtonClicked()));
QPushButton *cardBackPicturePathButton = new QPushButton("...");
connect(cardBackPicturePathButton, SIGNAL(clicked()), this, SLOT(cardBackPicturePathButtonClicked()));
QGridLayout *zoneBgGrid = new QGridLayout;
zoneBgGrid->addWidget(&handBgLabel, 0, 0);
zoneBgGrid->addWidget(handBgEdit, 0, 1);
zoneBgGrid->addWidget(handBgClearButton, 0, 2);
zoneBgGrid->addWidget(handBgButton, 0, 3);
zoneBgGrid->addWidget(&stackBgLabel, 1, 0);
zoneBgGrid->addWidget(stackBgEdit, 1, 1);
zoneBgGrid->addWidget(stackBgClearButton, 1, 2);
zoneBgGrid->addWidget(stackBgButton, 1, 3);
zoneBgGrid->addWidget(&tableBgLabel, 2, 0);
zoneBgGrid->addWidget(tableBgEdit, 2, 1);
zoneBgGrid->addWidget(tableBgClearButton, 2, 2);
zoneBgGrid->addWidget(tableBgButton, 2, 3);
zoneBgGrid->addWidget(&playerAreaBgLabel, 3, 0);
zoneBgGrid->addWidget(playerAreaBgEdit, 3, 1);
zoneBgGrid->addWidget(playerAreaBgClearButton, 3, 2);
zoneBgGrid->addWidget(playerAreaBgButton, 3, 3);
zoneBgGrid->addWidget(&cardBackPicturePathLabel, 4, 0);
zoneBgGrid->addWidget(cardBackPicturePathEdit, 4, 1);
zoneBgGrid->addWidget(cardBackPicturePathClearButton, 4, 2);
zoneBgGrid->addWidget(cardBackPicturePathButton, 4, 3);
QStringList themeDirs = themeManager->getAvailableThemes().keys();
for (int i = 0; i < themeDirs.size(); i++) {
themeBox.addItem(themeDirs[i]);
if (themeDirs[i] == themeName)
themeBox.setCurrentIndex(i);
}
zoneBgGroupBox = new QGroupBox;
zoneBgGroupBox->setLayout(zoneBgGrid);
connect(&themeBox, SIGNAL(currentIndexChanged(int)), this, SLOT(themeBoxChanged(int)));
QGridLayout *themeGrid = new QGridLayout;
themeGrid->addWidget(&themeLabel, 0, 0);
themeGrid->addWidget(&themeBox, 0, 1);
themeGroupBox = new QGroupBox;
themeGroupBox->setLayout(themeGrid);
displayCardNamesCheckBox.setChecked(settingsCache->getDisplayCardNames());
connect(&displayCardNamesCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setDisplayCardNames(int)));
@ -360,7 +320,7 @@ AppearanceSettingsPage::AppearanceSettingsPage()
tableGroupBox->setLayout(tableGrid);
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(zoneBgGroupBox);
mainLayout->addWidget(themeGroupBox);
mainLayout->addWidget(cardsGroupBox);
mainLayout->addWidget(handGroupBox);
mainLayout->addWidget(tableGroupBox);
@ -368,14 +328,17 @@ AppearanceSettingsPage::AppearanceSettingsPage()
setLayout(mainLayout);
}
void AppearanceSettingsPage::themeBoxChanged(int index)
{
QStringList themeDirs = themeManager->getAvailableThemes().keys();
if(index >= 0 && index < themeDirs.count())
settingsCache->setThemeName(themeDirs.at(index));
}
void AppearanceSettingsPage::retranslateUi()
{
zoneBgGroupBox->setTitle(tr("Zone background pictures"));
handBgLabel.setText(tr("Hand background:"));
stackBgLabel.setText(tr("Stack background:"));
tableBgLabel.setText(tr("Table background:"));
playerAreaBgLabel.setText(tr("Player info background:"));
cardBackPicturePathLabel.setText(tr("Card back:"));
themeGroupBox->setTitle(tr("Theme settings"));
themeLabel.setText(tr("Current theme:"));
cardsGroupBox->setTitle(tr("Card rendering"));
displayCardNamesCheckBox.setText(tr("Display card names on cards having a picture"));
@ -390,86 +353,6 @@ void AppearanceSettingsPage::retranslateUi()
minPlayersForMultiColumnLayoutLabel.setText(tr("Minimum player count for multi-column layout:"));
}
void AppearanceSettingsPage::handBgClearButtonClicked()
{
handBgEdit->setText(QString());
settingsCache->setHandBgPath(QString());
}
void AppearanceSettingsPage::handBgButtonClicked()
{
QString path = QFileDialog::getOpenFileName(this, tr("Choose path"));
if (path.isEmpty())
return;
handBgEdit->setText(path);
settingsCache->setHandBgPath(path);
}
void AppearanceSettingsPage::stackBgClearButtonClicked()
{
stackBgEdit->setText(QString());
settingsCache->setStackBgPath(QString());
}
void AppearanceSettingsPage::stackBgButtonClicked()
{
QString path = QFileDialog::getOpenFileName(this, tr("Choose path"));
if (path.isEmpty())
return;
stackBgEdit->setText(path);
settingsCache->setStackBgPath(path);
}
void AppearanceSettingsPage::tableBgClearButtonClicked()
{
tableBgEdit->setText(QString());
settingsCache->setTableBgPath(QString());
}
void AppearanceSettingsPage::tableBgButtonClicked()
{
QString path = QFileDialog::getOpenFileName(this, tr("Choose path"));
if (path.isEmpty())
return;
tableBgEdit->setText(path);
settingsCache->setTableBgPath(path);
}
void AppearanceSettingsPage::playerAreaBgClearButtonClicked()
{
playerAreaBgEdit->setText(QString());
settingsCache->setPlayerBgPath(QString());
}
void AppearanceSettingsPage::playerAreaBgButtonClicked()
{
QString path = QFileDialog::getOpenFileName(this, tr("Choose path"));
if (path.isEmpty())
return;
playerAreaBgEdit->setText(path);
settingsCache->setPlayerBgPath(path);
}
void AppearanceSettingsPage::cardBackPicturePathClearButtonClicked()
{
cardBackPicturePathEdit->setText(QString());
settingsCache->setCardBackPicturePath(QString());
}
void AppearanceSettingsPage::cardBackPicturePathButtonClicked()
{
QString path = QFileDialog::getOpenFileName(this, tr("Choose path"));
if (path.isEmpty())
return;
cardBackPicturePathEdit->setText(path);
settingsCache->setCardBackPicturePath(path);
}
UserInterfaceSettingsPage::UserInterfaceSettingsPage()
{
notificationsEnabledCheckBox.setChecked(settingsCache->getNotificationsEnabled());
@ -632,18 +515,17 @@ MessagesSettingsPage::MessagesSettingsPage()
highlightGroupBox = new QGroupBox;
highlightGroupBox->setLayout(highlightNotice);
QSettings settings;
messageList = new QListWidget;
settings.beginGroup("messages");
int count = settings.value("count", 0).toInt();
int count = settingsCache->messages().getCount();
for (int i = 0; i < count; i++)
messageList->addItem(settings.value(QString("msg%1").arg(i)).toString());
messageList->addItem(settingsCache->messages().getMessageAt(i));
aAdd = new QAction(this);
aAdd->setIcon(QIcon(":/resources/increment.svg"));
aAdd->setIcon(QIcon("theme:icons/increment.svg"));
connect(aAdd, SIGNAL(triggered()), this, SLOT(actAdd()));
aRemove = new QAction(this);
aRemove->setIcon(QIcon(":/resources/decrement.svg"));
aRemove->setIcon(QIcon("theme:icons/decrement.svg"));
connect(aRemove, SIGNAL(triggered()), this, SLOT(actRemove()));
QToolBar *messageToolBar = new QToolBar;
@ -709,11 +591,9 @@ void MessagesSettingsPage::updateHighlightPreview() {
void MessagesSettingsPage::storeSettings()
{
QSettings settings;
settings.beginGroup("messages");
settings.setValue("count", messageList->count());
settingsCache->messages().setCount(messageList->count());
for (int i = 0; i < messageList->count(); i++)
settings.setValue(QString("msg%1").arg(i), messageList->item(i)->text());
settingsCache->messages().setMessageAt(i, messageList->item(i)->text());
}
void MessagesSettingsPage::actAdd()
@ -755,7 +635,7 @@ void MessagesSettingsPage::retranslateUi()
SoundSettingsPage::SoundSettingsPage()
{
QIcon deleteIcon(":/resources/icon_delete.svg");
QIcon deleteIcon("theme:icons/delete.svg");
soundEnabledCheckBox.setChecked(settingsCache->getSoundEnabled());
connect(&soundEnabledCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setSoundEnabled(int)));
@ -766,7 +646,7 @@ SoundSettingsPage::SoundSettingsPage()
connect(soundPathClearButton, SIGNAL(clicked()), this, SLOT(soundPathClearButtonClicked()));
QPushButton *soundPathButton = new QPushButton("...");
connect(soundPathButton, SIGNAL(clicked()), this, SLOT(soundPathButtonClicked()));
connect(&soundTestButton, SIGNAL(clicked()), soundEngine, SLOT(playerJoined()));
connect(&soundTestButton, SIGNAL(clicked()), soundEngine, SLOT(testSound()));
masterVolumeSlider = new QSlider(Qt::Horizontal);
masterVolumeSlider->setMinimum(0);
@ -774,7 +654,7 @@ SoundSettingsPage::SoundSettingsPage()
masterVolumeSlider->setValue(settingsCache->getMasterVolume());
masterVolumeSlider->setToolTip(QString::number(settingsCache->getMasterVolume()));
connect(settingsCache, SIGNAL(masterVolumeChanged(int)), this, SLOT(masterVolumeChanged(int)));
connect(masterVolumeSlider, SIGNAL(sliderReleased()), soundEngine, SLOT(playerJoined()));
connect(masterVolumeSlider, SIGNAL(sliderReleased()), soundEngine, SLOT(testSound()));
connect(masterVolumeSlider, SIGNAL(valueChanged(int)), settingsCache, SLOT(setMasterVolume(int)));
@ -892,37 +772,37 @@ void DlgSettings::createIcons()
generalButton = new QListWidgetItem(contentsWidget);
generalButton->setTextAlignment(Qt::AlignHCenter);
generalButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
generalButton->setIcon(QIcon(":/resources/icon_config_general.svg"));
generalButton->setIcon(QIcon("theme:config/general.svg"));
appearanceButton = new QListWidgetItem(contentsWidget);
appearanceButton->setTextAlignment(Qt::AlignHCenter);
appearanceButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
appearanceButton->setIcon(QIcon(":/resources/icon_config_appearance.svg"));
appearanceButton->setIcon(QIcon("theme:config/appearance.svg"));
userInterfaceButton = new QListWidgetItem(contentsWidget);
userInterfaceButton->setTextAlignment(Qt::AlignHCenter);
userInterfaceButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
userInterfaceButton->setIcon(QIcon(":/resources/icon_config_interface.svg"));
userInterfaceButton->setIcon(QIcon("theme:config/interface.svg"));
deckEditorButton = new QListWidgetItem(contentsWidget);
deckEditorButton->setTextAlignment(Qt::AlignHCenter);
deckEditorButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
deckEditorButton->setIcon(QIcon(":/resources/icon_config_deckeditor.svg"));
deckEditorButton->setIcon(QIcon("theme:config/deckeditor.svg"));
messagesButton = new QListWidgetItem(contentsWidget);
messagesButton->setTextAlignment(Qt::AlignHCenter);
messagesButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
messagesButton->setIcon(QIcon(":/resources/icon_config_messages.svg"));
messagesButton->setIcon(QIcon("theme:config/messages.svg"));
soundButton = new QListWidgetItem(contentsWidget);
soundButton->setTextAlignment(Qt::AlignHCenter);
soundButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
soundButton->setIcon(QIcon(":/resources/icon_config_sound.svg"));
soundButton->setIcon(QIcon("theme:config/sound.svg"));
shortcutsButton = new QListWidgetItem(contentsWidget);
shortcutsButton->setTextAlignment(Qt::AlignHCenter);
shortcutsButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
shortcutsButton->setIcon(QIcon(":/resources/icon_config_shorcuts.svg"));
shortcutsButton->setIcon(QIcon("theme:config/shorcuts.svg"));
connect(contentsWidget, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), this, SLOT(changePage(QListWidgetItem *, QListWidgetItem *)));
}
@ -1037,4 +917,7 @@ void DlgSettings::retranslateUi()
for (int i = 0; i < pagesWidget->count(); i++)
dynamic_cast<AbstractSettingsPage *>(pagesWidget->widget(i))->retranslateUi();
contentsWidget->reset();
}

View file

@ -60,6 +60,7 @@ private:
QComboBox languageBox;
QCheckBox picDownloadCheckBox;
QCheckBox picDownloadHqCheckBox;
QCheckBox updateNotificationCheckBox;
QLabel languageLabel;
QLabel pixmapCacheLabel;
QLabel deckPathLabel;
@ -75,40 +76,17 @@ private:
class AppearanceSettingsPage : public AbstractSettingsPage {
Q_OBJECT
private slots:
void handBgClearButtonClicked();
void handBgButtonClicked();
void stackBgClearButtonClicked();
void stackBgButtonClicked();
void tableBgClearButtonClicked();
void tableBgButtonClicked();
void playerAreaBgClearButtonClicked();
void playerAreaBgButtonClicked();
void cardBackPicturePathClearButtonClicked();
void cardBackPicturePathButtonClicked();
signals:
void handBgChanged(const QString &path);
void stackBgChanged(const QString &path);
void tableBgChanged(const QString &path);
void playerAreaBgChanged(const QString &path);
void cardBackPicturePathChanged(const QString &path);
void themeBoxChanged(int index);
private:
QLabel handBgLabel;
QLabel stackBgLabel;
QLabel tableBgLabel;
QLabel playerAreaBgLabel;
QLabel cardBackPicturePathLabel;
QLabel themeLabel;
QComboBox themeBox;
QLabel minPlayersForMultiColumnLayoutLabel;
QLineEdit *handBgEdit;
QLineEdit *stackBgEdit;
QLineEdit *tableBgEdit;
QLineEdit *playerAreaBgEdit;
QLineEdit *cardBackPicturePathEdit;
QCheckBox displayCardNamesCheckBox;
QCheckBox cardScalingCheckBox;
QCheckBox horizontalHandCheckBox;
QCheckBox leftJustifiedHandCheckBox;
QCheckBox invertVerticalCoordinateCheckBox;
QGroupBox *zoneBgGroupBox;
QGroupBox *themeGroupBox;
QGroupBox *cardsGroupBox;
QGroupBox *handGroupBox;
QGroupBox *tableGroupBox;

View file

@ -26,7 +26,7 @@ FilterBuilder::FilterBuilder(QWidget *parent)
QVariant(i)
);
QPushButton *ok = new QPushButton(QIcon(":/resources/increment.svg"), QString());
QPushButton *ok = new QPushButton(QIcon("theme:icons/increment.svg"), QString());
ok->setObjectName("ok");
ok->setMaximumSize(20, 20);

View file

@ -60,10 +60,10 @@ GameSelector::GameSelector(AbstractClient *_client, const TabSupervisor *_tabSup
gameListView->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
#endif
filterButton = new QPushButton;
filterButton->setIcon(QIcon(":/resources/icon_search_black.svg"));
filterButton->setIcon(QIcon("theme:icons/search.svg"));
connect(filterButton, SIGNAL(clicked()), this, SLOT(actSetFilter()));
clearFilterButton = new QPushButton;
clearFilterButton->setIcon(QIcon(":/resources/icon_clearsearch.svg"));
clearFilterButton->setIcon(QIcon("theme:icons/clearsearch.svg"));
clearFilterButton->setEnabled(true);
connect(clearFilterButton, SIGNAL(clicked()), this, SLOT(actClearFilter()));

View file

@ -1,12 +1,12 @@
#include "gamesmodel.h"
#include "pb/serverinfo_game.pb.h"
#include "pixmapgenerator.h"
#include "settingscache.h"
#include <QDebug>
#include <QIcon>
#include <QStringList>
#include <QDateTime>
#include <QSettings>
#include <QCryptographicHash>
enum GameListColumn {ROOM, CREATED, DESCRIPTION, CREATOR, GAME_TYPE, RESTRICTIONS, PLAYERS, SPECTATORS};
@ -283,19 +283,17 @@ void GamesProxyModel::resetFilterParameters()
void GamesProxyModel::loadFilterParameters(const QMap<int, QString> &allGameTypes)
{
QSettings settings;
settings.beginGroup("filter_games");
unavailableGamesVisible = settings.value("unavailable_games_visible", false).toBool();
showPasswordProtectedGames = settings.value("show_password_protected_games", true).toBool();
gameNameFilter = settings.value("game_name_filter", "").toString();
maxPlayersFilterMin = settings.value("min_players", 1).toInt();
maxPlayersFilterMax = settings.value("max_players", DEFAULT_MAX_PLAYERS_MAX).toInt();
unavailableGamesVisible = settingsCache->gameFilters().isUnavailableGamesVisible();
showPasswordProtectedGames = settingsCache->gameFilters().isShowPasswordProtectedGames();
gameNameFilter = settingsCache->gameFilters().getGameNameFilter();
maxPlayersFilterMin = settingsCache->gameFilters().getMinPlayers();
maxPlayersFilterMax = settingsCache->gameFilters().getMaxPlayers();
QMapIterator<int, QString> gameTypesIterator(allGameTypes);
while (gameTypesIterator.hasNext()) {
gameTypesIterator.next();
if (settings.value("game_type/" + hashGameType(gameTypesIterator.value()), false).toBool()) {
if (settingsCache->gameFilters().isGameTypeEnabled(gameTypesIterator.value())){
gameTypeFilter.insert(gameTypesIterator.key());
}
}
@ -305,28 +303,19 @@ void GamesProxyModel::loadFilterParameters(const QMap<int, QString> &allGameType
void GamesProxyModel::saveFilterParameters(const QMap<int, QString> &allGameTypes)
{
QSettings settings;
settings.beginGroup("filter_games");
settings.setValue("unavailable_games_visible", unavailableGamesVisible);
settings.setValue(
"show_password_protected_games",
showPasswordProtectedGames
);
settings.setValue("game_name_filter", gameNameFilter);
settingsCache->gameFilters().setUnavailableGamesVisible(unavailableGamesVisible);
settingsCache->gameFilters().setShowPasswordProtectedGames(showPasswordProtectedGames);
settingsCache->gameFilters().setGameNameFilter(gameNameFilter);
QMapIterator<int, QString> gameTypeIterator(allGameTypes);
while (gameTypeIterator.hasNext()) {
gameTypeIterator.next();
settings.setValue(
"game_type/" + hashGameType(gameTypeIterator.value()),
gameTypeFilter.contains(gameTypeIterator.key())
);
bool enabled = gameTypeFilter.contains(gameTypeIterator.key());
settingsCache->gameFilters().setGameTypeEnabled(gameTypeIterator.value(),enabled);
}
settings.setValue("min_players", maxPlayersFilterMin);
settings.setValue("max_players", maxPlayersFilterMax);
settingsCache->gameFilters().setMinPlayers(maxPlayersFilterMin);
settingsCache->gameFilters().setMaxPlayers(maxPlayersFilterMax);
}
bool GamesProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &/*sourceParent*/) const
@ -367,7 +356,3 @@ bool GamesProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &/*sourc
return true;
}
QString GamesProxyModel::hashGameType(const QString &gameType) const {
return QCryptographicHash::hash(gameType.toUtf8(), QCryptographicHash::Md5).toHex();
}

View file

@ -52,13 +52,7 @@ private:
QSet<int> gameTypeFilter;
int maxPlayersFilterMin, maxPlayersFilterMax;
static const int DEFAULT_MAX_PLAYERS_MAX = 99;
/*
* The game type might contain special characters, so to use it in
* QSettings we just hash it.
*/
QString hashGameType(const QString &gameType) const;
static const int DEFAULT_MAX_PLAYERS_MAX = 99;
public:
GamesProxyModel(QObject *parent = 0, ServerInfo_User *_ownUser = 0);

View file

@ -36,7 +36,7 @@ void HandCounter::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*op
#else
if (!QPixmapCache::find("handCounter" + QString::number(translatedSize.width()), cachedPixmap)) {
#endif
QSvgRenderer svg(QString(":/resources/hand.svg"));
QSvgRenderer svg(QString("theme:hand.svg"));
cachedPixmap = QPixmap(translatedSize);
cachedPixmap.fill(Qt::transparent);
QPainter painter(&cachedPixmap);

View file

@ -1,6 +1,7 @@
#include <QPainter>
#include "handzone.h"
#include "settingscache.h"
#include "thememanager.h"
#include "player.h"
#include "carddragitem.h"
#include "carditem.h"
@ -10,16 +11,13 @@
HandZone::HandZone(Player *_p, bool _contentsKnown, int _zoneHeight, QGraphicsItem *parent)
: SelectZone(_p, "hand", false, false, _contentsKnown, parent), zoneHeight(_zoneHeight)
{
connect(settingsCache, SIGNAL(handBgPathChanged()), this, SLOT(updateBgPixmap()));
updateBgPixmap();
connect(themeManager, SIGNAL(themeChanged()), this, SLOT(updateBg()));
updateBg();
setCacheMode(DeviceCoordinateCache);
}
void HandZone::updateBgPixmap()
void HandZone::updateBg()
{
QString bgPath = settingsCache->getHandBgPath();
if (!bgPath.isEmpty())
bgPixmap.load(bgPath);
update();
}
@ -77,10 +75,7 @@ QRectF HandZone::boundingRect() const
void HandZone::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/)
{
if (bgPixmap.isNull())
painter->fillRect(boundingRect(), QColor(30, 30, 30));
else
painter->fillRect(boundingRect(), QBrush(bgPixmap));
painter->fillRect(boundingRect(), themeManager->getHandBgBrush());
}
void HandZone::reorganizeCards()

View file

@ -7,9 +7,8 @@ class HandZone : public SelectZone {
Q_OBJECT
private:
qreal width, zoneHeight;
QPixmap bgPixmap;
private slots:
void updateBgPixmap();
void updateBg();
public slots:
void updateOrientation();
public:

View file

@ -26,7 +26,6 @@
#include <QTranslator>
#include <QLibraryInfo>
#include <QDateTime>
#include <QSettings>
#include <QIcon>
#include <QDir>
#include <QDesktopServices>
@ -34,15 +33,16 @@
#include <QSystemTrayIcon>
#include "QtNetwork/QNetworkInterface"
#include <QCryptographicHash>
#include "main.h"
#include "window_main.h"
#include "dlg_settings.h"
#include "carddatabase.h"
#include "settingscache.h"
#include "thememanager.h"
#include "pixmapgenerator.h"
#include "rng_sfmt.h"
#include "soundengine.h"
#include "featureset.h"
//Q_IMPORT_PLUGIN(qjpeg)
@ -52,7 +52,7 @@ SettingsCache *settingsCache;
RNG_Abstract *rng;
SoundEngine *soundEngine;
QSystemTrayIcon *trayIcon;
ThemeManager *themeManager;
const QString translationPrefix = "cockatrice";
#ifdef TRANSLATION_PATH
@ -147,6 +147,7 @@ int main(int argc, char *argv[])
rng = new RNG_SFMT;
settingsCache = new SettingsCache;
themeManager = new ThemeManager;
db = new CardDatabase;
qtTranslator = new QTranslator;
@ -154,12 +155,15 @@ int main(int argc, char *argv[])
installNewTranslator();
qsrand(QDateTime::currentDateTime().toTime_t());
#if QT_VERSION < 0x050000
#ifdef PORTABLE_BUILD
const QString dataDir = "data/";
#elif QT_VERSION < 0x050000
const QString dataDir = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
#else
const QString dataDir = QStandardPaths::standardLocations(QStandardPaths::DataLocation).first();
#endif
if (!db->getLoadSuccess())
if (!db->loadCardDatabase(dataDir + "/cards.xml"))
settingsCache->setCardDatabasePath(dataDir + "/cards.xml");
@ -210,17 +214,17 @@ int main(int argc, char *argv[])
if (settingsValid()) {
qDebug("main(): starting main program");
soundEngine = new SoundEngine;
qDebug("main(): SoundEngine constructor finished");
MainWindow ui;
qDebug("main(): MainWindow constructor finished");
QIcon icon(":/resources/appicon.svg");
QIcon icon("theme:cockatrice.svg");
ui.setWindowIcon(icon);
settingsCache->setClientID(generateClientID());
qDebug() << "ClientID In Cache: " << settingsCache->getClientID();
ui.show();
qDebug("main(): ui.show() finished");

View file

@ -37,7 +37,7 @@ bool MessageLogWidget::userIsFemale() const
void MessageLogWidget::logGameJoined(int gameId)
{
soundEngine->playerJoined();
soundEngine->playSound("player_join");
if (userIsFemale())
appendHtmlServerMessage(tr("You have joined game #%1.", "female").arg("<font color=\"blue\">"+ QString::number(gameId) + "</font>"));
else
@ -54,7 +54,7 @@ void MessageLogWidget::logReplayStarted(int gameId)
void MessageLogWidget::logJoin(Player *player)
{
soundEngine->playerJoined();
soundEngine->playSound("player_join");
if (isFemale(player))
appendHtmlServerMessage(tr("%1 has joined the game.", "female").arg(sanitizeHtml(player->getName())));
else
@ -63,6 +63,7 @@ void MessageLogWidget::logJoin(Player *player)
void MessageLogWidget::logLeave(Player *player)
{
soundEngine->playSound("player_leave");
if (isFemale(player))
appendHtmlServerMessage(tr("%1 has left the game.", "female").arg(sanitizeHtml(player->getName())));
else
@ -81,11 +82,13 @@ void MessageLogWidget::logKicked()
void MessageLogWidget::logJoinSpectator(QString name)
{
soundEngine->playSound("spectator_join");
appendHtmlServerMessage(tr("%1 is now watching the game.").arg(sanitizeHtml(name)));
}
void MessageLogWidget::logLeaveSpectator(QString name)
{
soundEngine->playSound("spectator_leave");
appendHtmlServerMessage(tr("%1 is not watching the game any more.").arg(sanitizeHtml(name)));
}
@ -134,6 +137,7 @@ void MessageLogWidget::logSetSideboardLock(Player *player, bool locked)
void MessageLogWidget::logConcede(Player *player)
{
soundEngine->playSound("player_concede");
if (isFemale(player))
appendHtmlServerMessage(tr("%1 has conceded the game.", "female").arg(sanitizeHtml(player->getName())));
else
@ -148,11 +152,13 @@ void MessageLogWidget::logGameStart()
void MessageLogWidget::logConnectionStateChanged(Player *player, bool connectionState)
{
if (connectionState) {
soundEngine->playSound("player_reconnect");
if (isFemale(player))
appendHtmlServerMessage(tr("%1 has restored connection to the game.", "female").arg(sanitizeHtml(player->getName())));
else
appendHtmlServerMessage(tr("%1 has restored connection to the game.", "male").arg(sanitizeHtml(player->getName())));
} else {
soundEngine->playSound("player_disconnect");
if (isFemale(player))
appendHtmlServerMessage(tr("%1 has lost connection to the game.", "female").arg(sanitizeHtml(player->getName())));
else
@ -172,6 +178,7 @@ void MessageLogWidget::logSpectatorSay(QString spectatorName, UserLevelFlags spe
void MessageLogWidget::logShuffle(Player *player, CardZone *zone)
{
soundEngine->playSound("shuffle");
if (currentContext != MessageContext_Mulligan) {
appendHtmlServerMessage((isFemale(player)
? tr("%1 shuffles %2.", "female")
@ -183,6 +190,7 @@ void MessageLogWidget::logShuffle(Player *player, CardZone *zone)
void MessageLogWidget::logRollDie(Player *player, int sides, int roll)
{
soundEngine->playSound("roll_dice");
if (isFemale(player))
appendHtmlServerMessage(tr("%1 rolls a %2 with a %3-sided die.", "female").arg(sanitizeHtml(player->getName())).arg("<font color=\"blue\">" + QString::number(roll) + "</font>").arg("<font color=\"blue\">" + QString::number(sides) + "</font>"));
else
@ -194,6 +202,7 @@ void MessageLogWidget::logDrawCards(Player *player, int number)
if (currentContext == MessageContext_Mulligan)
mulliganPlayer = player;
else {
soundEngine->playSound("draw_card");
if (isFemale(player))
appendHtmlServerMessage(tr("%1 draws %2 card(s).", "female").arg(sanitizeHtml(player->getName())).arg("<font color=\"blue\">" + QString::number(number) + "</font>"));
else
@ -296,6 +305,7 @@ void MessageLogWidget::doMoveCard(LogMoveCard &attributes)
QString finalStr;
if (targetName == "table") {
soundEngine->playSound("play_card");
if (moveCardTapped.value(attributes.card))
finalStr = tr("%1 puts %2 into play tapped%3.");
else
@ -318,6 +328,7 @@ void MessageLogWidget::doMoveCard(LogMoveCard &attributes)
} else if (targetName == "sb")
finalStr = tr("%1 moves %2%3 to sideboard.");
else if (targetName == "stack") {
soundEngine->playSound("play_card");
finalStr = tr("%1 plays %2%3.");
}
@ -565,7 +576,10 @@ void MessageLogWidget::logSetCardCounter(Player *player, QString cardName, int c
void MessageLogWidget::logSetTapped(Player *player, CardItem *card, bool tapped)
{
soundEngine->tap();
if (tapped)
soundEngine->playSound("tap_card");
else
soundEngine->playSound("untap_card");
if (currentContext == MessageContext_MoveCard)
moveCardTapped.insert(card, tapped);
@ -603,6 +617,9 @@ void MessageLogWidget::logSetTapped(Player *player, CardItem *card, bool tapped)
void MessageLogWidget::logSetCounter(Player *player, QString counterName, int value, int oldValue)
{
if (counterName == "life")
soundEngine->playSound("life_change");
QString str;
if (isFemale(player))
str = tr("%1 sets counter %2 to %3 (%4%5).", "female");
@ -799,17 +816,17 @@ void MessageLogWidget::logSetActivePhase(int phase)
{
QString phaseName;
switch (phase) {
case 0: phaseName = tr("untap step"); break;
case 1: phaseName = tr("upkeep step"); break;
case 2: phaseName = tr("draw step"); break;
case 3: phaseName = tr("first main phase"); break;
case 4: phaseName = tr("beginning of combat step"); break;
case 5: phaseName = tr("declare attackers step"); soundEngine->attack(); break;
case 6: phaseName = tr("declare blockers step"); break;
case 7: phaseName = tr("combat damage step"); break;
case 8: phaseName = tr("end of combat step"); break;
case 9: phaseName = tr("second main phase"); break;
case 10: phaseName = tr("ending phase"); soundEngine->endStep(); break;
case 0: phaseName = tr("untap step"); soundEngine->playSound("untap_step"); break;
case 1: phaseName = tr("upkeep step"); soundEngine->playSound("upkeep_step"); break;
case 2: phaseName = tr("draw step"); soundEngine->playSound("draw_step"); break;
case 3: phaseName = tr("first main phase"); soundEngine->playSound("main_1"); break;
case 4: phaseName = tr("beginning of combat step"); soundEngine->playSound("start_combat"); break;
case 5: phaseName = tr("declare attackers step"); soundEngine->playSound("attack_step"); break;
case 6: phaseName = tr("declare blockers step"); soundEngine->playSound("block_step"); break;
case 7: phaseName = tr("combat damage step"); soundEngine->playSound("damage_step"); break;
case 8: phaseName = tr("end of combat step"); soundEngine->playSound("end_combat"); break;
case 9: phaseName = tr("second main phase"); soundEngine->playSound("main_2"); break;
case 10: phaseName = tr("ending phase"); soundEngine->playSound("end_step"); break;
}
appendHtml("<font color=\"green\"><b>" + QDateTime::currentDateTime().toString("[hh:mm:ss] ") + tr("It is now the %1.").arg(phaseName) + "</b></font>");
}

View file

@ -16,7 +16,7 @@ QPixmap PhasePixmapGenerator::generatePixmap(int height, QString name)
if (pmCache.contains(key))
return pmCache.value(key);
QSvgRenderer svg(QString(":/resources/phases/icon_phase_" + name + ".svg"));
QSvgRenderer svg(QString("theme:phases/" + name + ".svg"));
QPixmap pixmap(height, height);
pixmap.fill(Qt::transparent);
@ -36,13 +36,13 @@ QPixmap CounterPixmapGenerator::generatePixmap(int height, QString name, bool hi
if (pmCache.contains(key))
return pmCache.value(key);
QSvgRenderer svg(QString(":/resources/counters/" + name + ".svg"));
QSvgRenderer svg(QString("theme:counters/" + name + ".svg"));
if (!svg.isValid()) {
name = "general";
if (highlight)
name.append("_highlight");
svg.load(QString(":/resources/counters/" + name + ".svg"));
svg.load(QString("theme:counters/" + name + ".svg"));
}
int width = (int) round(height * (double) svg.defaultSize().width() / (double) svg.defaultSize().height());
@ -98,7 +98,7 @@ QPixmap GenderPixmapGenerator::generatePixmap(int height, int _gender)
default: genderStr = "unknown";
};
QSvgRenderer svg(QString(":/resources/genders/" + genderStr + ".svg"));
QSvgRenderer svg(QString("theme:genders/" + genderStr + ".svg"));
int width = (int) round(height * (double) svg.defaultSize().width() / (double) svg.defaultSize().height());
QPixmap pixmap(width, height);
pixmap.fill(Qt::transparent);
@ -119,7 +119,7 @@ QPixmap CountryPixmapGenerator::generatePixmap(int height, const QString &countr
if (pmCache.contains(key))
return pmCache.value(key);
QSvgRenderer svg(QString(":/resources/countries/" + countryCode.toLower() + ".svg"));
QSvgRenderer svg(QString("theme:countries/" + countryCode.toLower() + ".svg"));
int width = (int) round(height * (double) svg.defaultSize().width() / (double) svg.defaultSize().height());
QPixmap pixmap(width, height);
pixmap.fill(Qt::transparent);
@ -154,7 +154,7 @@ QPixmap UserLevelPixmapGenerator::generatePixmap(int height, UserLevelFlags user
if (isBuddy)
levelString.append("_buddy");
QSvgRenderer svg(QString(":/resources/userlevels/" + levelString + ".svg"));
QSvgRenderer svg(QString("theme:userlevels/" + levelString + ".svg"));
int width = (int) round(height * (double) svg.defaultSize().width() / (double) svg.defaultSize().height());
QPixmap pixmap(width, height);
pixmap.fill(Qt::transparent);
@ -175,7 +175,7 @@ QPixmap LockPixmapGenerator::generatePixmap(int height)
if (pmCache.contains(key))
return pmCache.value(key);
QSvgRenderer svg(QString(":/resources/lock.svg"));
QSvgRenderer svg(QString("theme:icons/lock.svg"));
int width = (int) round(height * (double) svg.defaultSize().width() / (double) svg.defaultSize().height());
QPixmap pixmap(width, height);
pixmap.fill(Qt::transparent);

View file

@ -15,12 +15,12 @@
#include "tab_game.h"
#include "gamescene.h"
#include "settingscache.h"
#include "thememanager.h"
#include "dlg_create_token.h"
#include "carddatabase.h"
#include "color.h"
#include "deck_loader.h"
#include "main.h"
#include <QSettings>
#include <QPainter>
#include <QMenu>
#include <QDebug>
@ -69,25 +69,18 @@ PlayerArea::PlayerArea(QGraphicsItem *parentItem)
: QObject(), QGraphicsItem(parentItem)
{
setCacheMode(DeviceCoordinateCache);
connect(settingsCache, SIGNAL(playerBgPathChanged()), this, SLOT(updateBgPixmap()));
updateBgPixmap();
connect(themeManager, SIGNAL(themeChanged()), this, SLOT(updateBg()));
updateBg();
}
void PlayerArea::updateBgPixmap()
void PlayerArea::updateBg()
{
QString bgPath = settingsCache->getPlayerBgPath();
if (bgPath.isEmpty())
bgPixmapBrush = QBrush(QColor(200, 200, 200));
else {
qDebug() << "loading" << bgPath;
bgPixmapBrush = QBrush(QPixmap(bgPath));
}
update();
}
void PlayerArea::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/)
{
painter->fillRect(bRect, bgPixmapBrush);
painter->fillRect(bRect, themeManager->getPlayerBgBrush());
}
void PlayerArea::setSize(qreal width, qreal height)
@ -832,12 +825,10 @@ void Player::initSayMenu()
{
sayMenu->clear();
QSettings settings;
settings.beginGroup("messages");
int count = settings.value("count", 0).toInt();
int count = settingsCache->messages().getCount();
for (int i = 0; i < count; i++) {
QAction *newAction = new QAction(settings.value(QString("msg%1").arg(i)).toString(), this);
QAction *newAction = new QAction(settingsCache->messages().getMessageAt(i), this);
if (i <= 10){
newAction->setShortcut(QKeySequence("Ctrl+" + QString::number((i + 1) % 10)));
}

View file

@ -60,10 +60,9 @@ class PlayerArea : public QObject, public QGraphicsItem {
Q_OBJECT
Q_INTERFACES(QGraphicsItem)
private:
QBrush bgPixmapBrush;
QRectF bRect;
private slots:
void updateBgPixmap();
void updateBg();
public:
enum { Type = typeOther };
int type() const { return Type; }

View file

@ -50,12 +50,12 @@ bool PlayerListTWI::operator<(const QTreeWidgetItem &other) const
PlayerListWidget::PlayerListWidget(TabSupervisor *_tabSupervisor, AbstractClient *_client, TabGame *_game, QWidget *parent)
: QTreeWidget(parent), tabSupervisor(_tabSupervisor), client(_client), game(_game), gameStarted(false)
{
readyIcon = QIcon(":/resources/icon_ready_start.svg");
notReadyIcon = QIcon(":/resources/icon_not_ready_start.svg");
concededIcon = QIcon(":/resources/icon_conceded.svg");
playerIcon = QIcon(":/resources/icon_player.svg");
spectatorIcon = QIcon(":/resources/icon_spectator.svg");
lockIcon = QIcon(":/resources/lock.svg");
readyIcon = QIcon("theme:icons/ready_start.svg");
notReadyIcon = QIcon("theme:icons/not_ready_start.svg");
concededIcon = QIcon("theme:icons/conceded.svg");
playerIcon = QIcon("theme:icons/player.svg");
spectatorIcon = QIcon("theme:icons/spectator.svg");
lockIcon = QIcon("theme:icons/lock.svg");
if (tabSupervisor) {
itemDelegate = new PlayerListItemDelegate(this);

View file

@ -1,3 +1,4 @@
#include <QList>
#include <QTimer>
#include <QThread>
#include "remoteclient.h"
@ -81,7 +82,6 @@ void RemoteClient::processServerIdentificationEvent(const Event_ServerIdentifica
cmdRegister.set_country(country.toStdString());
cmdRegister.set_real_name(realName.toStdString());
cmdRegister.set_clientid(settingsCache->getClientID().toStdString());
PendingCommand *pend = prepareSessionCommand(cmdRegister);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(registerResponse(Response)));
sendCommand(pend);
@ -105,8 +105,7 @@ void RemoteClient::processServerIdentificationEvent(const Event_ServerIdentifica
doLogin();
}
void RemoteClient::doLogin()
{
void RemoteClient::doLogin() {
setStatus(StatusLoggingIn);
Command_Login cmdLogin;
@ -114,6 +113,13 @@ void RemoteClient::doLogin()
cmdLogin.set_password(password.toStdString());
cmdLogin.set_clientid(settingsCache->getClientID().toStdString());
cmdLogin.set_clientver(VERSION_STRING);
if (!clientFeatures.isEmpty()) {
QMap<QString, bool>::iterator i;
for (i = clientFeatures.begin(); i != clientFeatures.end(); ++i)
cmdLogin.add_clientfeatures(i.key().toStdString().c_str());
}
PendingCommand *pend = prepareSessionCommand(cmdLogin);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(loginResponse(Response)));
sendCommand(pend);
@ -140,8 +146,17 @@ void RemoteClient::loginResponse(const Response &response)
for (int i = resp.ignore_list_size() - 1; i >= 0; --i)
ignoreList.append(resp.ignore_list(i));
emit ignoreListReceived(ignoreList);
if (resp.missing_features_size() > 0 && settingsCache->getNotifyAboutUpdates())
emit notifyUserAboutUpdate();
} else {
emit loginError(response.response_code(), QString::fromStdString(resp.denied_reason_str()), resp.denied_end_time());
QList<QString> missingFeatures;
if (resp.missing_features_size() > 0) {
for (int i = 0; i < resp.missing_features_size(); ++i)
missingFeatures << QString::fromStdString(resp.missing_features(i));
}
emit loginError(response.response_code(), QString::fromStdString(resp.denied_reason_str()), resp.denied_end_time(), missingFeatures);
setStatus(StatusDisconnecting);
}
}

View file

@ -11,7 +11,7 @@ class RemoteClient : public AbstractClient {
signals:
void maxPingTime(int seconds, int maxSeconds);
void serverTimeout();
void loginError(Response::ResponseCode resp, QString reasonStr, quint32 endTime);
void loginError(Response::ResponseCode resp, QString reasonStr, quint32 endTime, QList<QString> missingFeatures);
void registerError(Response::ResponseCode resp, QString reasonStr, quint32 endTime);
void activateError();
void socketError(const QString &errorString);
@ -21,6 +21,7 @@ signals:
void sigRegisterToServer(const QString &hostname, unsigned int port, const QString &_userName, const QString &_password, const QString &_email, const int _gender, const QString &_country, const QString &_realname);
void sigActivateToServer(const QString &_token);
void sigDisconnectFromServer();
void notifyUserAboutUpdate();
private slots:
void slotConnected();
void readData();

View file

@ -35,7 +35,7 @@ RemoteReplayList_TreeModel::RemoteReplayList_TreeModel(AbstractClient *_client,
QFileIconProvider fip;
dirIcon = fip.icon(QFileIconProvider::Folder);
fileIcon = fip.icon(QFileIconProvider::File);
lockIcon = QIcon(":/resources/lock.svg");
lockIcon = QIcon("theme:icons/lock.svg");
refreshTree();
}

View file

@ -25,8 +25,8 @@ SequenceEdit::SequenceEdit(QString _shorcutName, QWidget *parent) : QWidget(pare
clearButton->setMaximumHeight(lineEdit->height());
defaultButton->setMaximumHeight(lineEdit->height());
clearButton->setIcon(QIcon(":/resources/icon_clearsearch.svg"));
defaultButton->setIcon(QIcon(":/resources/icon_update.png"));
clearButton->setIcon(QIcon("theme:icons/clearsearch.svg"));
defaultButton->setIcon(QIcon("theme:icons/update.png"));
clearButton->setAttribute(Qt::WA_LayoutUsesWidgetRect);
defaultButton->setAttribute(Qt::WA_LayoutUsesWidgetRect);

View file

@ -596,7 +596,7 @@ public:
gridLayout_4->addWidget(lbl_abstractCounter_aInc, 1, 0, 1, 1);
abstractCounter_Inc = new SequenceEdit("Player/Inc",groupBox_4);
abstractCounter_Inc = new SequenceEdit("Player/aInc",groupBox_4);
abstractCounter_Inc->setObjectName("abstractCounter_Inc");
gridLayout_4->addWidget(abstractCounter_Inc, 1, 1, 1, 1);

View file

@ -0,0 +1,36 @@
#include "carddatabasesettings.h"
CardDatabaseSettings::CardDatabaseSettings(QString settingPath, QObject *parent)
: SettingsManager(settingPath+"cardDatabase.ini", parent)
{
}
void CardDatabaseSettings::setSortKey(QString shortName, unsigned int sortKey)
{
setValue(sortKey,"sortkey", "sets", shortName);
}
void CardDatabaseSettings::setEnabled(QString shortName, bool enabled)
{
setValue(enabled, "enabled", "sets", shortName);
}
void CardDatabaseSettings::setIsKnown(QString shortName, bool isknown)
{
setValue(isknown, "isknown", "sets", shortName);
}
unsigned int CardDatabaseSettings::getSortKey(QString shortName)
{
return getValue("sortkey", "sets", shortName).toUInt();
}
bool CardDatabaseSettings::isEnabled(QString shortName)
{
return getValue("enabled", "sets", shortName).toBool();
}
bool CardDatabaseSettings::isKnown(QString shortName)
{
return getValue("isknown", "sets", shortName).toBool();
}

View file

@ -0,0 +1,34 @@
#ifndef CARDDATABASESETTINGS_H
#define CARDDATABASESETTINGS_H
#include "settingsmanager.h"
#include <QObject>
#include <QVariant>
#include <QSettings>
class CardDatabaseSettings : public SettingsManager
{
Q_OBJECT
friend class SettingsCache;
public:
void setSortKey(QString shortName, unsigned int sortKey);
void setEnabled(QString shortName, bool enabled);
void setIsKnown(QString shortName, bool isknown);
unsigned int getSortKey(QString shortName);
bool isEnabled(QString shortName);
bool isKnown(QString shortName);
signals:
public slots:
private:
CardDatabaseSettings(QString settingPath, QObject *parent = 0);
CardDatabaseSettings( const CardDatabaseSettings& /*other*/ );
CardDatabaseSettings( CardDatabaseSettings& /*other*/ );
CardDatabaseSettings( volatile const CardDatabaseSettings& /*other*/ );
CardDatabaseSettings( volatile CardDatabaseSettings& /*other*/ );
};
#endif // CARDDATABASESETTINGS_H

View file

@ -0,0 +1,88 @@
#include "gamefilterssettings.h"
#include <QCryptographicHash>
GameFiltersSettings::GameFiltersSettings(QString settingPath, QObject *parent)
: SettingsManager(settingPath+"gamefilters.ini", parent)
{
}
/*
* The game type might contain special characters, so to use it in
* QSettings we just hash it.
*/
QString GameFiltersSettings::hashGameType(const QString &gameType) const
{
return QCryptographicHash::hash(gameType.toUtf8(), QCryptographicHash::Md5).toHex();
}
void GameFiltersSettings::setUnavailableGamesVisible(bool enabled)
{
setValue(enabled, "unavailable_games_visible","filter_games");
}
bool GameFiltersSettings::isUnavailableGamesVisible()
{
QVariant previous = getValue("unavailable_games_visible","filter_games");
return previous == QVariant() ? false : previous.toBool();
}
void GameFiltersSettings::setShowPasswordProtectedGames(bool show)
{
setValue(show, "show_password_protected_games","filter_games");
}
bool GameFiltersSettings::isShowPasswordProtectedGames()
{
QVariant previous = getValue("show_password_protected_games","filter_games");
return previous == QVariant() ? true : previous.toBool();
}
void GameFiltersSettings::setGameNameFilter(QString gameName)
{
setValue(gameName, "game_name_filter","filter_games");
}
QString GameFiltersSettings::getGameNameFilter()
{
return getValue("game_name_filter","filter_games").toString();
}
void GameFiltersSettings::setMinPlayers(int min)
{
setValue(min, "min_players","filter_games");
}
int GameFiltersSettings::getMinPlayers()
{
QVariant previous = getValue("min_players","filter_games");
return previous == QVariant() ? 1 : previous.toInt();
}
void GameFiltersSettings::setMaxPlayers(int max)
{
setValue(max, "max_players","filter_games");
}
int GameFiltersSettings::getMaxPlayers()
{
QVariant previous = getValue("max_players","filter_games");
return previous == QVariant() ? 99 : previous.toInt();
}
void GameFiltersSettings::setGameTypeEnabled(QString gametype, bool enabled)
{
setValue(enabled, "game_type/"+hashGameType(gametype),"filter_games");
}
void GameFiltersSettings::setGameHashedTypeEnabled(QString gametypeHASHED, bool enabled)
{
setValue(enabled, gametypeHASHED,"filter_games");
}
bool GameFiltersSettings::isGameTypeEnabled(QString gametype)
{
QVariant previous = getValue("game_type/"+hashGameType(gametype),"filter_games");
return previous == QVariant() ? false : previous.toBool();
}

View file

@ -0,0 +1,39 @@
#ifndef GAMEFILTERSSETTINGS_H
#define GAMEFILTERSSETTINGS_H
#include "settingsmanager.h"
class GameFiltersSettings : public SettingsManager
{
Q_OBJECT
friend class SettingsCache;
public:
bool isUnavailableGamesVisible();
bool isShowPasswordProtectedGames();
QString getGameNameFilter();
int getMinPlayers();
int getMaxPlayers();
bool isGameTypeEnabled(QString gametype);
void setUnavailableGamesVisible(bool enabled);
void setShowPasswordProtectedGames(bool show);
void setGameNameFilter(QString gameName);
void setMinPlayers(int min);
void setMaxPlayers(int max);
void setGameTypeEnabled(QString gametype, bool enabled);
void setGameHashedTypeEnabled(QString gametypeHASHED, bool enabled);
signals:
public slots:
private:
GameFiltersSettings(QString settingPath,QObject *parent = 0);
GameFiltersSettings( const GameFiltersSettings& /*other*/ );
GameFiltersSettings( GameFiltersSettings& /*other*/ );
GameFiltersSettings( volatile const GameFiltersSettings& /*other*/ );
GameFiltersSettings( volatile GameFiltersSettings& /*other*/ );
QString hashGameType(const QString &gameType) const;
};
#endif // GAMEFILTERSSETTINGS_H

View file

@ -0,0 +1,59 @@
#include "layoutssettings.h"
LayoutsSettings::LayoutsSettings(QString settingPath, QObject *parent)
: SettingsManager(settingPath+"layouts.ini", parent)
{
}
const QByteArray LayoutsSettings::getDeckEditorLayoutState()
{
return getValue("layouts/deckEditor_state").toByteArray();
}
void LayoutsSettings::setDeckEditorLayoutState(const QByteArray &value)
{
setValue(value,"layouts/deckEditor_state");
}
const QByteArray LayoutsSettings::getDeckEditorGeometry()
{
return getValue("layouts/deckEditor_geometry").toByteArray();
}
void LayoutsSettings::setDeckEditorGeometry(const QByteArray &value)
{
setValue(value,"layouts/deckEditor_geometry");
}
const QSize LayoutsSettings::getDeckEditorCardSize()
{
QVariant previous = getValue("layouts/deckEditor_CardSize");
return previous == QVariant() ? QSize(250,500) : previous.toSize();
}
void LayoutsSettings::setDeckEditorCardSize(const QSize &value)
{
setValue(value,"layouts/deckEditor_CardSize");
}
const QSize LayoutsSettings::getDeckEditorDeckSize()
{
QVariant previous = getValue("layouts/deckEditor_DeckSize");
return previous == QVariant() ? QSize(250,360) : previous.toSize();
}
void LayoutsSettings::setDeckEditorDeckSize(const QSize &value)
{
setValue(value,"layouts/deckEditor_DeckSize");
}
const QSize LayoutsSettings::getDeckEditorFilterSize()
{
QVariant previous = getValue("layouts/deckEditor_FilterSize");
return previous == QVariant() ? QSize(250,250) : previous.toSize();
}
void LayoutsSettings::setDeckEditorFilterSize(const QSize &value)
{
setValue(value,"layouts/deckEditor_FilterSize");
}

View file

@ -0,0 +1,36 @@
#ifndef LAYOUTSSETTINGS_H
#define LAYOUTSSETTINGS_H
#include "settingsmanager.h"
#include <QSize>
class LayoutsSettings : public SettingsManager
{
Q_OBJECT
friend class SettingsCache;
public:
void setDeckEditorLayoutState(const QByteArray &value);
void setDeckEditorGeometry(const QByteArray &value);
void setDeckEditorCardSize(const QSize &value);
void setDeckEditorDeckSize(const QSize &value);
void setDeckEditorFilterSize(const QSize &value);
const QByteArray getDeckEditorLayoutState();
const QByteArray getDeckEditorGeometry();
const QSize getDeckEditorCardSize();
const QSize getDeckEditorDeckSize();
const QSize getDeckEditorFilterSize();
signals:
public slots:
private:
LayoutsSettings(QString settingPath,QObject *parent = 0);
LayoutsSettings( const LayoutsSettings& /*other*/ );
LayoutsSettings( LayoutsSettings& /*other*/ );
LayoutsSettings( volatile const LayoutsSettings& /*other*/ );
LayoutsSettings( volatile LayoutsSettings& /*other*/ );
};
#endif // LAYOUTSSETTINGS_H

View file

@ -0,0 +1,26 @@
#include "messagesettings.h"
MessageSettings::MessageSettings(QString settingPath, QObject *parent)
: SettingsManager(settingPath+"messages.ini",parent)
{
}
QString MessageSettings::getMessageAt(int index)
{
return getValue(QString("msg%1").arg(index),"messages").toString();
}
int MessageSettings::getCount()
{
return getValue("count", "messages").toInt();
}
void MessageSettings::setCount(int count)
{
setValue(count,"count","messages");
}
void MessageSettings::setMessageAt(int index, QString message)
{
setValue(message,QString("msg%1").arg(index),"messages");
}

View file

@ -0,0 +1,29 @@
#ifndef MESSAGESETTINGS_H
#define MESSAGESETTINGS_H
#include "settingsmanager.h"
class MessageSettings : public SettingsManager
{
Q_OBJECT
friend class SettingsCache;
public:
int getCount();
QString getMessageAt(int index);
void setCount(int count);
void setMessageAt(int index, QString message);
signals:
public slots:
private:
MessageSettings(QString settingPath, QObject *parent = 0);
MessageSettings( const MessageSettings& /*other*/ );
MessageSettings( MessageSettings& /*other*/ );
MessageSettings( volatile const MessageSettings& /*other*/ );
MessageSettings( volatile MessageSettings& /*other*/ );
};
#endif // MESSAGESETTINGS_H

View file

@ -0,0 +1,102 @@
#include "serverssettings.h"
ServersSettings::ServersSettings(QString settingPath, QObject *parent)
: SettingsManager(settingPath+"servers.ini", parent)
{
}
void ServersSettings::setPreviousHostLogin(int previous)
{
setValue(previous, "previoushostlogin", "server");
}
int ServersSettings::getPreviousHostLogin()
{
QVariant previous = getValue("previoushostlogin", "server");
return previous == QVariant() ? 1 : previous.toInt();
}
void ServersSettings::setPreviousHostList(QStringList list)
{
setValue(list, "previoushosts", "server");
}
QStringList ServersSettings::getPreviousHostList()
{
return getValue("previoushosts", "server").toStringList();
}
void ServersSettings::setPrevioushostindex(int index)
{
setValue(index, "previoushostindex", "server");
}
int ServersSettings::getPrevioushostindex()
{
return getValue("previoushostindex", "server").toInt();
}
void ServersSettings::setHostName(QString hostname)
{
setValue(hostname, "hostname", "server");
}
QString ServersSettings::getHostname(QString defaultHost)
{
QVariant hostname = getValue("hostname","server");
return hostname == QVariant() ? defaultHost : hostname.toString();
}
void ServersSettings::setPort(QString port)
{
setValue(port, "port", "server");
}
QString ServersSettings::getPort(QString defaultPort)
{
QVariant port = getValue("port","server");
return port == QVariant() ? defaultPort : port.toString();
}
void ServersSettings::setPlayerName(QString playerName)
{
setValue(playerName, "playername", "server");
}
QString ServersSettings::getPlayerName(QString defaultName)
{
QVariant name = getValue("playername", "server");
return name == QVariant() ? defaultName : name.toString();
}
void ServersSettings::setPassword(QString password)
{
setValue(password, "password", "server");
}
QString ServersSettings::getPassword()
{
return getValue("password", "server").toString();
}
void ServersSettings::setSavePassword(int save)
{
setValue(save, "save_password", "server");
}
int ServersSettings::getSavePassword()
{
QVariant save = getValue("save_password", "server");
return save == QVariant() ? 1 : save.toInt();
}
void ServersSettings::setAutoConnect(int autoconnect)
{
setValue(autoconnect, "auto_connect", "server");
}
int ServersSettings::getAutoConnect()
{
QVariant autoconnect = getValue("auto_connect", "server");
return autoconnect == QVariant() ? 0 : autoconnect.toInt();
}

View file

@ -0,0 +1,44 @@
#ifndef SERVERSSETTINGS_H
#define SERVERSSETTINGS_H
#include "settingsmanager.h"
#include <QObject>
class ServersSettings : public SettingsManager
{
Q_OBJECT
friend class SettingsCache;
public:
int getPreviousHostLogin();
QStringList getPreviousHostList();
int getPrevioushostindex();
QString getHostname(QString defaultHost = "");
QString getPort(QString defaultPort = "");
QString getPlayerName(QString defaultName = "");
QString getPassword();
int getSavePassword();
int getAutoConnect();
void setPreviousHostLogin(int previous);
void setPreviousHostList(QStringList list);
void setPrevioushostindex(int index);
void setHostName(QString hostname);
void setPort(QString port);
void setPlayerName(QString playerName);
void setPassword(QString password);
void setSavePassword(int save);
void setAutoConnect(int autoconnect);
signals:
public slots:
private:
ServersSettings(QString settingPath,QObject *parent = 0);
ServersSettings( const ServersSettings& /*other*/ );
ServersSettings( ServersSettings& /*other*/ );
ServersSettings( volatile const ServersSettings& /*other*/ );
ServersSettings( volatile ServersSettings& /*other*/ );
};
#endif // SERVERSSETTINGS_H

View file

@ -0,0 +1,43 @@
#include "settingsmanager.h"
SettingsManager::SettingsManager(QString settingPath, QObject *parent)
: QObject(parent),
settings(settingPath, QSettings::IniFormat)
{
}
void SettingsManager::setValue(QVariant value, QString name, QString group, QString subGroup)
{
if(!group.isEmpty())
settings.beginGroup(group);
if(!subGroup.isEmpty())
settings.beginGroup(subGroup);
settings.setValue(name, value);
if(!subGroup.isEmpty())
settings.endGroup();
if(!group.isEmpty())
settings.endGroup();
}
QVariant SettingsManager::getValue(QString name, QString group, QString subGroup)
{
if(!group.isEmpty())
settings.beginGroup(group);
if(!subGroup.isEmpty())
settings.beginGroup(subGroup);
QVariant value = settings.value(name);
if(!subGroup.isEmpty())
settings.endGroup();
if(!group.isEmpty())
settings.endGroup();
return value;
}

Some files were not shown because too many files have changed in this diff Show more