Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4fad542d05 | ||
|
|
5039b11cb7 | ||
|
|
df59bf750f | ||
|
|
9121de301c | ||
|
|
bc3e716681 | ||
|
|
c406ee147b | ||
|
|
5bbbbc37fd | ||
|
|
b309e9e43a | ||
|
|
69f820bb3d | ||
|
|
055f87019c | ||
|
|
e053cdcaf6 | ||
|
|
27b524f52f | ||
|
|
f4ac0fbb26 | ||
|
|
b6068fb0a0 | ||
|
|
924fcd6404 | ||
|
|
a7cc33e89a | ||
|
|
1d34288a91 | ||
|
|
d0cce129dd | ||
|
|
bb441b565c | ||
|
|
27946480cd | ||
|
|
ee897f17ef | ||
|
|
93b9881e75 | ||
|
|
a935bfd0b8 | ||
|
|
d14343b8ac | ||
|
|
959d48f83d | ||
|
|
731f5f05f5 | ||
|
|
9b1ad883a2 | ||
|
|
85611c6cdf | ||
|
|
1034d4adf5 | ||
|
|
f04dac83c6 | ||
|
|
a57c344b11 | ||
|
|
988d05e236 | ||
|
|
2252c180c0 | ||
|
|
a2109df5e9 | ||
|
|
cc5998e863 | ||
|
|
374048c5cd | ||
|
|
83bbc660e1 | ||
|
|
19bf312694 | ||
|
|
046a2fbdc3 | ||
|
|
eedd86e150 | ||
|
|
67c444266f | ||
|
|
e617c667e1 | ||
|
|
a78e5b39a3 | ||
|
|
8a000bdc2b | ||
|
|
54eabb28c8 | ||
|
|
6dff34a589 | ||
|
|
a212e5c037 | ||
|
|
32d2e2e159 | ||
|
|
c8bcfc1390 | ||
|
|
81ce13f3d7 | ||
|
|
bace7cd987 | ||
|
|
507fbae5aa | ||
|
|
6a8c159450 |
@@ -1,40 +0,0 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<manifest package="org.qtproject.example" android:versionName="1.1" xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto" android:versionCode="1">
|
||||
<application android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="PokerTH" android:icon="@drawable/icon">
|
||||
<activity android:name="org.qtproject.qt5.android.bindings.QtActivity" android:label="PokerTH" android:screenOrientation="landscape" android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|locale|fontScale|keyboard|keyboardHidden|navigation">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
<meta-data android:name="android.app.lib_name" android:value="pokerth"/>
|
||||
<meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/>
|
||||
<meta-data android:name="android.app.repository" android:value="default"/>
|
||||
<meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/>
|
||||
<meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/>
|
||||
<!-- Deploy Qt libs as part of package -->
|
||||
<meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/>
|
||||
<meta-data android:name="android.app.bundled_in_lib_resource_id" android:resource="@array/bundled_in_lib"/>
|
||||
<meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/>
|
||||
<!-- Run with local libs -->
|
||||
<meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/>
|
||||
<meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/>
|
||||
<meta-data android:name="android.app.load_local_libs" android:value="-- %%INSERT_LOCAL_LIBS%% --"/>
|
||||
<meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/>
|
||||
<meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/>
|
||||
<!-- Messages maps -->
|
||||
<meta-data android:name="android.app.ministro_not_found_msg" android:value="@string/ministro_not_found_msg"/>
|
||||
<meta-data android:name="android.app.ministro_needed_msg" android:value="@string/ministro_needed_msg"/>
|
||||
<meta-data android:name="android.app.fatal_error_msg" android:value="@string/fatal_error_msg"/>
|
||||
<!-- Messages maps -->
|
||||
<!-- Splash screen -->
|
||||
<meta-data android:name="android.app.splash_screen" android:resource="@layout/splash"/>
|
||||
<!-- Splash screen -->
|
||||
</activity>
|
||||
</application>
|
||||
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="19"/>
|
||||
<supports-screens android:smallScreens="true" android:anyDensity="true" android:largeScreens="true" android:normalScreens="true"/>
|
||||
<!-- %%INSERT_PERMISSIONS -->
|
||||
<!-- %%INSERT_FEATURES -->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
</manifest>
|
||||
@@ -15,7 +15,7 @@ Linux:
|
||||
- libSDL_mixer, libSDL --> http://www.libsdl.org/
|
||||
- libSQLite3 --> http://sqlite.org/
|
||||
- libtinyxml > 2.0 --> http://www.sourceforge.net/projects/tinyxml
|
||||
- protoc >= 2.3.0 (during build), libprotobuf >= 2.3.0 -> http://code.google.com/p/protobuf/downloads/list
|
||||
- protoc >= 2.3.0 (during build), libprotobuf >= 2.3.0 -> https://github.com/google/protobuf
|
||||
- For the server: libircclient 1.3 --> http://www.sourceforge.net/projects/libircclient/
|
||||
|
||||
Windows:
|
||||
@@ -28,7 +28,7 @@ Basic Installation
|
||||
Linux:
|
||||
|
||||
1. Type "cd path/to/the/sources". Then do for example "/usr/qt/4/bin/qmake pokerth.pro" to configure the makefile for your system.
|
||||
Pay attention that the QTDIR environment varialbe points to Qt4 not Qt3. For example QTDIR=/usr/qt/4.
|
||||
Pay attention that the QTDIR environment variable points to Qt4 not Qt3. For example QTDIR=/usr/qt/4.
|
||||
You can set this variable typing: "export QTDIR=/usr/qt/4"
|
||||
|
||||
2. Type "make" to compile the package.
|
||||
|
||||
@@ -1,8 +1,17 @@
|
||||
# QMake pro-file for PokerTH
|
||||
|
||||
TEMPLATE = subdirs
|
||||
SUBDIRS = pokerth_protocol.pro pokerth_db.pro pokerth_lib.pro pokerth_game.pro
|
||||
!mac:!gui_800x480:!client {
|
||||
SUBDIRS = pokerth_protocol.pro pokerth_db.pro pokerth_lib.pro
|
||||
official_server {
|
||||
SUBDIRS += pokerth_dbofficial.pro
|
||||
}
|
||||
qml-client{
|
||||
SUBDIRS += pokerth_qml-client.pro
|
||||
}
|
||||
!qml-client{
|
||||
SUBDIRS += pokerth_game.pro
|
||||
}
|
||||
!mac:!gui_800x480:!client:!qml-client {
|
||||
SUBDIRS += pokerth_server.pro chatcleaner.pro
|
||||
}
|
||||
CONFIG += ordered
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
# QMake pro-file for PokerTH official server DB backend
|
||||
TEMPLATE = lib
|
||||
CODECFORSRC = UTF-8
|
||||
CONFIG += staticlib \
|
||||
thread \
|
||||
exceptions \
|
||||
rtti \
|
||||
stl \
|
||||
warn_on
|
||||
UI_DIR = uics
|
||||
TARGET = lib/pokerth_dbofficial
|
||||
MOC_DIR = mocs
|
||||
OBJECTS_DIR = obj
|
||||
QT -= core \
|
||||
gui
|
||||
|
||||
# PRECOMPILED_HEADER = dbofficial/pch_lib.h
|
||||
INCLUDEPATH += . \
|
||||
./src
|
||||
DEPENDPATH += . \
|
||||
./src
|
||||
|
||||
# Input
|
||||
HEADERS += src/dbofficial/asyncdbauth.h \
|
||||
src/dbofficial/asyncdbcreategame.h \
|
||||
src/dbofficial/asyncdbgameplace.h \
|
||||
src/dbofficial/asyncdbupdatescore.h \
|
||||
src/dbofficial/asyncdbquery.h \
|
||||
src/dbofficial/serverdbthread.h \
|
||||
src/dbofficial/serverdbfactoryinternal.h \
|
||||
src/dbofficial/compositeasyncdbquery.h \
|
||||
src/dbofficial/singleasyncdbquery.h \
|
||||
src/dbofficial/querycontext.h \
|
||||
src/dbofficial/asyncdbendgame.h \
|
||||
src/dbofficial/db_table_defs.h \
|
||||
src/dbofficial/asyncdblogin.h \
|
||||
src/dbofficial/asyncdbreportavatar.h \
|
||||
src/dbofficial/asyncdbreportgame.h \
|
||||
src/dbofficial/asyncdbavatarblacklist.h \
|
||||
src/dbofficial/asyncdbadminplayers.h \
|
||||
src/dbofficial/asyncdbblockplayer.h \
|
||||
src/dbofficial/dbidmanager.h
|
||||
SOURCES += src/dbofficial/asyncdbauth.cpp \
|
||||
src/dbofficial/asyncdbcreategame.cpp \
|
||||
src/dbofficial/asyncdbgameplace.cpp \
|
||||
src/dbofficial/asyncdbupdatescore.cpp \
|
||||
src/dbofficial/asyncdbquery.cpp \
|
||||
src/dbofficial/serverdbthread.cpp \
|
||||
src/dbofficial/serverdbfactoryinternal.cpp \
|
||||
src/dbofficial/singleasyncdbquery.cpp \
|
||||
src/dbofficial/compositeasyncdbquery.cpp \
|
||||
src/dbofficial/querycontext.cpp \
|
||||
src/dbofficial/asyncdbendgame.cpp \
|
||||
src/dbofficial/asyncdblogin.cpp \
|
||||
src/dbofficial/asyncdbreportavatar.cpp \
|
||||
src/dbofficial/asyncdbreportgame.cpp \
|
||||
src/dbofficial/asyncdbavatarblacklist.cpp \
|
||||
src/dbofficial/asyncdbadminplayers.cpp \
|
||||
src/dbofficial/asyncdbblockplayer.cpp \
|
||||
src/dbofficial/dbidmanager.cpp
|
||||
win32 {
|
||||
DEFINES += _WIN32_WINNT=0x0501
|
||||
INCLUDEPATH += ../../../boost/ \
|
||||
../../../GnuTLS/include \
|
||||
../../../curl/include \
|
||||
../../../mysql/include \
|
||||
../../../mysql++/lib \
|
||||
../../../zlib
|
||||
}
|
||||
!win32 {
|
||||
# #### My release static build options
|
||||
# QMAKE_CXXFLAGS += -ffunction-sections -fdata-sections
|
||||
INCLUDEPATH += /usr/include \
|
||||
/usr/include/mysql \
|
||||
/usr/include/mysql++
|
||||
INCLUDEPATH += /opt/boost/include
|
||||
}
|
||||
mac {
|
||||
# make it universal
|
||||
CONFIG += x86
|
||||
CONFIG -= ppc
|
||||
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.4
|
||||
|
||||
# for universal-compilation on PPC-Mac uncomment the following line
|
||||
# on Intel-Mac you have to comment this line out or build will fail.
|
||||
# QMAKE_MAC_SDK=/Developer/SDKs/MacOSX10.4u.sdk/
|
||||
INCLUDEPATH += /Developer/SDKs/MacOSX10.5.sdk/usr/include/
|
||||
INCLUDEPATH += /Library/Frameworks/SDL.framework/Headers
|
||||
INCLUDEPATH += /Library/Frameworks/SDL_mixer.framework/Headers
|
||||
INCLUDEPATH += /opt/local/include/mysql++ \
|
||||
/opt/local/include/mysql5/mysql
|
||||
}
|
||||
@@ -408,11 +408,12 @@ unix:!mac {
|
||||
LIBPATH += $${PREFIX}/lib /opt/gsasl/lib
|
||||
LIB_DIRS = $${PREFIX}/lib \
|
||||
$${PREFIX}/lib64 \
|
||||
$${PREFIX}/lib/x86_64-linux-gnu \
|
||||
$$system(qmake -query QT_INSTALL_LIBS)
|
||||
}
|
||||
android{
|
||||
LIBPATH += $${PREFIX}/lib/armv7
|
||||
LIB_DIRS = $${PREFIX}/lib/armv7
|
||||
LIBPATH += $${PREFIX}/lib/armv5
|
||||
LIB_DIRS = $${PREFIX}/lib/armv5
|
||||
}
|
||||
BOOST_FS = boost_filesystem \
|
||||
boost_filesystem-mt
|
||||
@@ -522,7 +523,7 @@ unix:!mac {
|
||||
$$BOOST_REGEX \
|
||||
$$BOOST_CHRONO \
|
||||
$$BOOST_SYS
|
||||
!count(BOOST_LIBS, 5):error("Unable to find boost libraries in PREFIX=$${PREFIX}/armv5")
|
||||
!count(BOOST_LIBS, 6):error("Unable to find boost libraries in PREFIX=$${PREFIX}lib/armv5")
|
||||
LIBS += -ltinyxml
|
||||
LIBS += $$BOOST_LIBS
|
||||
LIBS += -lgsasl -lidn
|
||||
@@ -614,7 +615,7 @@ mac {
|
||||
OTHER_FILES += docs/infomessage-id-desc.txt
|
||||
official_server {
|
||||
LIBPATH += pkth_stat/daemon_lib/lib
|
||||
LIBS += -lpokerth_closed \
|
||||
LIBS += -lpokerth_dbofficial \
|
||||
-lmysqlpp
|
||||
DEFINES += POKERTH_OFFICIAL_SERVER
|
||||
}
|
||||
@@ -684,3 +685,14 @@ android_test{
|
||||
HEADERS += src/gui/qt/sound/androidapi8dummy.h
|
||||
SOURCES += src/gui/qt/sound/androidapi8dummy.cpp
|
||||
}
|
||||
|
||||
DISTFILES += \
|
||||
android/AndroidManifest.xml \
|
||||
android/gradle/wrapper/gradle-wrapper.jar \
|
||||
android/gradlew \
|
||||
android/res/values/libs.xml \
|
||||
android/build.gradle \
|
||||
android/gradle/wrapper/gradle-wrapper.properties \
|
||||
android/gradlew.bat
|
||||
|
||||
ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
|
||||
|
||||
@@ -251,11 +251,15 @@ win32{
|
||||
win32-g++ {
|
||||
INCLUDEPATH += ../boost/ ../GnuTLS/include ../gsasl/include ../curl/include ../zlib ../sqlite ../openssl/include
|
||||
}
|
||||
DEFINES += _WEBSOCKETPP_CPP11_STL_
|
||||
QMAKE_CXXFLAGS += -std=gnu++11
|
||||
}
|
||||
!win32{
|
||||
##### My release static build options
|
||||
#QMAKE_CXXFLAGS += -ffunction-sections -fdata-sections
|
||||
INCLUDEPATH += $${PREFIX}/include /opt/gsasl/include
|
||||
DEFINES += _WEBSOCKETPP_CPP11_STL_
|
||||
QMAKE_CXXFLAGS += -std=gnu++11
|
||||
}
|
||||
|
||||
mac{
|
||||
|
||||
@@ -33,17 +33,22 @@ win32 {
|
||||
DEFINES += _WIN32_WINNT=0x0501
|
||||
}
|
||||
unix : !mac {
|
||||
INCLUDEPATH += $${PREFIX}/include
|
||||
INCLUDEPATH += $${PREFIX}/include
|
||||
system(protoc pokerth.proto --cpp_out=src/third_party/protobuf)
|
||||
system(protoc chatcleaner.proto --cpp_out=src/third_party/protobuf)
|
||||
system(protoc pokerth.proto --java_out=tests/src)
|
||||
android {
|
||||
system(wine protoc.exe pokerth.proto --cpp_out=src/third_party/protobuf)
|
||||
system(wine protoc.exe chatcleaner.proto --cpp_out=src/third_party/protobuf)
|
||||
system(wine protoc.exe pokerth.proto --java_out=tests/src)
|
||||
}
|
||||
}
|
||||
mac {
|
||||
# make it x86_64 only
|
||||
CONFIG += x86_64
|
||||
CONFIG -= x86
|
||||
CONFIG -= ppc
|
||||
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6
|
||||
# make it x86_64 only
|
||||
CONFIG += x86_64
|
||||
CONFIG -= x86
|
||||
CONFIG -= ppc
|
||||
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6
|
||||
|
||||
# for universal-compilation on PPC-Mac uncomment the following line
|
||||
# on Intel-Mac you have to comment this line out or build will fail.
|
||||
|
||||
@@ -0,0 +1,247 @@
|
||||
QMAKE_MOC = $$QMAKE_MOC -DBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
isEmpty( PREFIX ){
|
||||
PREFIX =/usr
|
||||
}
|
||||
DEFINES += PREFIX=\"$${PREFIX}\"
|
||||
|
||||
TEMPLATE = app
|
||||
CODECFORSRC = UTF-8
|
||||
QT += core qml quick widgets svg sql
|
||||
CONFIG += qt thread embed_manifest_exe exceptions rtti stl warn_on
|
||||
DEFINES += ENABLE_IPV6 TIXML_USE_STL BOOST_FILESYSTEM_DEPRECATED
|
||||
|
||||
DEFINES += QML_CLIENT
|
||||
RESOURCES += src/gui/qml/qml.qrc
|
||||
|
||||
# Additional import path used to resolve QML modules in Qt Creator's code model
|
||||
QML_IMPORT_PATH = \
|
||||
src/gui/qml/views/startview/ \
|
||||
src/gui/qml/views/createlocalgameview/ \
|
||||
src/gui/qml/views/ \
|
||||
src/gui/qml/components/styles/ \
|
||||
src/gui/qml/components/ \
|
||||
src/gui/qml/js/
|
||||
|
||||
# Default rules for deployment.
|
||||
include(src/gui/qml/deployment.pri)
|
||||
|
||||
INCLUDEPATH += . \
|
||||
src \
|
||||
src/config \
|
||||
src/core \
|
||||
src/core/common \
|
||||
src/core/common/qttools \
|
||||
src/core/common/qttools/qthelper \
|
||||
src/gui \
|
||||
src/gui/qml/cpp
|
||||
|
||||
DEPENDPATH += . \
|
||||
src \
|
||||
src/config \
|
||||
src/core \
|
||||
src/core/common \
|
||||
src/core/common/qttools \
|
||||
src/core/common/qttools/qthelper \
|
||||
src/gui \
|
||||
src/gui/qml/cpp
|
||||
|
||||
HEADERS += \
|
||||
src/core/loghelper.h \
|
||||
src/core/common/qttools/qthelper/qthelper.h \
|
||||
src/core/common/qttools/qttoolswrapper.h \
|
||||
src/core/common/qttoolsinterface.h \
|
||||
src/gui/qml/cpp/qmlwrapper.h \
|
||||
src/gui/qml/cpp/qmlconfig.h \
|
||||
src/gui/qml/cpp/startviewimpl.h \
|
||||
src/gui/qml/cpp/createlocalgameviewimpl.h \
|
||||
src/gui/qml/cpp/mylistviewitemdata.h
|
||||
|
||||
|
||||
SOURCES += \
|
||||
src/pokerth.cpp \
|
||||
src/core/common/loghelper_client.cpp \
|
||||
src/core/common/qttools/qthelper/qthelper.cpp \
|
||||
src/core/common/qttools/qttoolswrapper.cpp \
|
||||
src/core/common/qttoolsinterface.cpp \
|
||||
src/gui/qml/cpp/qmlwrapper.cpp \
|
||||
src/gui/qml/cpp/qmlconfig.cpp \
|
||||
src/gui/qml/cpp/createlocalgameviewimpl.cpp \
|
||||
src/gui/qml/cpp/startviewimpl.cpp
|
||||
|
||||
LIBS += \
|
||||
-lpokerth_lib \
|
||||
-lpokerth_db \
|
||||
-lpokerth_protocol \
|
||||
-lcurl
|
||||
|
||||
unix:!mac {
|
||||
# #### My release static build options
|
||||
# QMAKE_CXXFLAGS += -ffunction-sections -fdata-sections
|
||||
# QMAKE_LFLAGS += -Wl,--gc-sections
|
||||
INCLUDEPATH += $${PREFIX}/include
|
||||
QMAKE_LIBDIR += lib
|
||||
!android{
|
||||
LIBPATH += $${PREFIX}/lib /opt/gsasl/lib
|
||||
LIB_DIRS = $${PREFIX}/lib \
|
||||
$${PREFIX}/lib64 \
|
||||
$${PREFIX}/lib/x86_64-linux-gnu \
|
||||
$$system(qmake -query QT_INSTALL_LIBS)
|
||||
}
|
||||
android{
|
||||
LIBPATH += $${PREFIX}/lib/armv5
|
||||
LIB_DIRS = $${PREFIX}/lib/armv5
|
||||
}
|
||||
|
||||
# BEGIN TODO: Cleanup!!! --> This is just a copy from pokerth_game.pro when starting with c++ integration
|
||||
BOOST_FS = boost_filesystem \
|
||||
boost_filesystem-mt
|
||||
BOOST_THREAD = boost_thread \
|
||||
boost_thread-mt
|
||||
BOOST_IOSTREAMS = boost_iostreams \
|
||||
boost_iostreams-mt
|
||||
BOOST_REGEX = boost_regex \
|
||||
boost_regex-mt
|
||||
BOOST_CHRONO = boost_chrono \
|
||||
boost_chrono-mt
|
||||
BOOST_SYS = boost_system \
|
||||
boost_system-mt
|
||||
BOOST_RANDOM = boost_random \
|
||||
boost_random-mt
|
||||
|
||||
# searching in $PREFIX/lib, $PREFIX/lib64 and $$system(qmake -query QT_INSTALL_LIBS)
|
||||
# to override the default '/usr' pass PREFIX
|
||||
# variable to qmake.
|
||||
for(dir, LIB_DIRS):exists($$dir) {
|
||||
for(lib, BOOST_THREAD):exists($${dir}/lib$${lib}.so*) {
|
||||
message("Found $$lib")
|
||||
BOOST_THREAD = -l$$lib
|
||||
}
|
||||
for(lib, BOOST_THREAD):exists($${dir}/lib$${lib}.a) {
|
||||
message("Found $$lib")
|
||||
BOOST_THREAD = -l$$lib
|
||||
}
|
||||
for(lib, BOOST_FS):exists($${dir}/lib$${lib}.so*) {
|
||||
message("Found $$lib")
|
||||
BOOST_FS = -l$$lib
|
||||
}
|
||||
for(lib, BOOST_FS):exists($${dir}/lib$${lib}.a) {
|
||||
message("Found $$lib")
|
||||
BOOST_FS = -l$$lib
|
||||
}
|
||||
for(lib, BOOST_IOSTREAMS):exists($${dir}/lib$${lib}.so*) {
|
||||
message("Found $$lib")
|
||||
BOOST_IOSTREAMS = -l$$lib
|
||||
}
|
||||
for(lib, BOOST_IOSTREAMS):exists($${dir}/lib$${lib}.a) {
|
||||
message("Found $$lib")
|
||||
BOOST_IOSTREAMS = -l$$lib
|
||||
}
|
||||
for(lib, BOOST_REGEX):exists($${dir}/lib$${lib}.so*) {
|
||||
message("Found $$lib")
|
||||
BOOST_REGEX = -l$$lib
|
||||
}
|
||||
for(lib, BOOST_REGEX):exists($${dir}/lib$${lib}.a) {
|
||||
message("Found $$lib")
|
||||
BOOST_REGEX = -l$$lib
|
||||
}
|
||||
for(lib, BOOST_CHRONO):exists($${dir}/lib$${lib}.so*) {
|
||||
message("Found $$lib")
|
||||
BOOST_CHRONO = -l$$lib
|
||||
}
|
||||
for(lib, BOOST_CHRONO):exists($${dir}/lib$${lib}.a) {
|
||||
message("Found $$lib")
|
||||
BOOST_CHRONO = -l$$lib
|
||||
}
|
||||
!android{
|
||||
for(lib, BOOST_RANDOM):exists($${dir}/lib$${lib}.so*) {
|
||||
message("Found $$lib")
|
||||
BOOST_RANDOM = -l$$lib
|
||||
}
|
||||
for(lib, BOOST_RANDOM):exists($${dir}/lib$${lib}.a) {
|
||||
message("Found $$lib")
|
||||
BOOST_RANDOM = -l$$lib
|
||||
}
|
||||
}
|
||||
for(lib, BOOST_SYS):exists($${dir}/lib$${lib}.so*) {
|
||||
message("Found $$lib")
|
||||
BOOST_SYS = -l$$lib
|
||||
}
|
||||
for(lib, BOOST_SYS):exists($${dir}/lib$${lib}.a) {
|
||||
message("Found $$lib")
|
||||
BOOST_SYS = -l$$lib
|
||||
}
|
||||
}
|
||||
!android{
|
||||
BOOST_LIBS = $$BOOST_THREAD \
|
||||
$$BOOST_FS \
|
||||
$$BOOST_IOSTREAMS \
|
||||
$$BOOST_REGEX \
|
||||
$$BOOST_CHRONO \
|
||||
$$BOOST_RANDOM \
|
||||
$$BOOST_SYS
|
||||
!count(BOOST_LIBS, 7):error("Unable to find boost libraries in PREFIX=$${PREFIX}")
|
||||
if($$system(sdl-config --version)):error("sdl-config not found in PATH - libSDL_mixer, libSDL are required!")
|
||||
UNAME = $$system(uname -s)
|
||||
BSD = $$find(UNAME, "BSD")
|
||||
kFreeBSD = $$find(UNAME, "kFreeBSD")
|
||||
LIBS += -lsqlite3 \
|
||||
-ltinyxml \
|
||||
-lprotobuf
|
||||
LIBS += $$BOOST_LIBS
|
||||
LIBS += -lSDL \
|
||||
-lSDL_mixer \
|
||||
-lgsasl
|
||||
!isEmpty( BSD ):isEmpty( kFreeBSD ):LIBS += -lcrypto
|
||||
else:LIBS += -lgcrypt
|
||||
}
|
||||
android{
|
||||
BOOST_LIBS = $$BOOST_THREAD \
|
||||
$$BOOST_FS \
|
||||
$$BOOST_IOSTREAMS \
|
||||
$$BOOST_REGEX \
|
||||
$$BOOST_CHRONO \
|
||||
$$BOOST_SYS
|
||||
!count(BOOST_LIBS, 6):error("Unable to find boost libraries in PREFIX=$${PREFIX}lib/armv5")
|
||||
LIBS += -ltinyxml
|
||||
LIBS += $$BOOST_LIBS
|
||||
LIBS += -lgsasl -lidn
|
||||
LIBS += -lssl -lcrypto -lgcrypt -lgpg-error -lprotobuf-lite
|
||||
|
||||
!android_api8 {
|
||||
#android sound lib for api9 and higher
|
||||
LIBS += -lOpenSLES
|
||||
}
|
||||
}
|
||||
TARGETDEPS += ./lib/libpokerth_lib.a \
|
||||
./lib/libpokerth_db.a \
|
||||
./lib/libpokerth_protocol.a
|
||||
|
||||
!android{
|
||||
# #### My release static libs
|
||||
# LIBS += -lgcrypt_static -lgpg-error_static -lgnutls_static -lSDL_mixer_static -lSDL -lmikmod -lcurl
|
||||
# ### INSTALL ####
|
||||
binary.path += $${PREFIX}/bin/
|
||||
binary.files += pokerth
|
||||
data.path += $${PREFIX}/share/pokerth/data/
|
||||
data.files += data/*
|
||||
pixmap.path += $${PREFIX}/share/pixmaps/
|
||||
pixmap.files += pokerth.png
|
||||
desktop.path += $${PREFIX}/share/applications/
|
||||
desktop.files += pokerth.desktop
|
||||
INSTALLS += binary \
|
||||
data \
|
||||
pixmap \
|
||||
desktop
|
||||
}
|
||||
|
||||
# END TODO: Cleanup!!! --> This is just a copy from pokerth_game.pro when starting with c++ integration
|
||||
|
||||
}
|
||||
|
||||
ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
|
||||
|
||||
contains(ANDROID_TARGET_ARCH,armeabi) {
|
||||
ANDROID_EXTRA_LIBS =
|
||||
}
|
||||
|
||||
@@ -176,6 +176,9 @@ unix : !mac {
|
||||
|
||||
LIBPATH += lib $${PREFIX}/lib /opt/gsasl/lib
|
||||
INCLUDEPATH += $${PREFIX}/include
|
||||
# see issue https://github.com/pokerth/pokerth/issues/282
|
||||
INCLUDEPATH += $${PREFIX}/include/libircclient
|
||||
|
||||
LIB_DIRS = $${PREFIX}/lib $${PREFIX}/lib64 $$system(qmake -query QT_INSTALL_LIBS)
|
||||
BOOST_FS = boost_filesystem boost_filesystem-mt
|
||||
BOOST_THREAD = boost_thread boost_thread-mt
|
||||
@@ -331,7 +334,7 @@ mac {
|
||||
|
||||
official_server {
|
||||
LIBPATH += pkth_stat/daemon_lib/lib
|
||||
LIBS += -lpokerth_closed -lmysqlpp
|
||||
LIBS += -lpokerth_dbofficial -lmysqlpp
|
||||
DEFINES += POKERTH_OFFICIAL_SERVER
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ using namespace std;
|
||||
using namespace boost::filesystem;
|
||||
|
||||
struct AvatarFileState {
|
||||
ifstream inputStream;
|
||||
std::ifstream inputStream;
|
||||
};
|
||||
|
||||
AvatarManager::AvatarManager(bool useExternalServer, const std::string &externalServerAddress,
|
||||
@@ -371,7 +371,7 @@ AvatarManager::StoreAvatarInCache(const MD5Buf &md5buf, AvatarFileType avatarFil
|
||||
path tmpPath(cacheDir);
|
||||
tmpPath /= (md5buf.ToString() + ext);
|
||||
string fileName(tmpPath.file_string());
|
||||
ofstream o(fileName.c_str(), ios_base::out | ios_base::binary | ios_base::trunc);
|
||||
std::ofstream o(fileName.c_str(), ios_base::out | ios_base::binary | ios_base::trunc);
|
||||
if (!o.fail()) {
|
||||
o.write((const char *)data, size);
|
||||
o.close();
|
||||
|
||||
@@ -67,7 +67,7 @@ void
|
||||
internal_log_err(const string &msg)
|
||||
{
|
||||
if (!g_logFile.empty()) {
|
||||
ofstream o(g_logFile.c_str(), ios_base::out | ios_base::app);
|
||||
std::ofstream o(g_logFile.c_str(), ios_base::out | ios_base::app);
|
||||
if (!o.fail()) {
|
||||
o << second_clock::local_time() << " ERR: " << msg;
|
||||
o.flush();
|
||||
@@ -80,7 +80,7 @@ internal_log_msg(const std::string &msg)
|
||||
{
|
||||
if (g_logLevel) {
|
||||
if (!g_logFile.empty()) {
|
||||
ofstream o(g_logFile.c_str(), ios_base::out | ios_base::app);
|
||||
std::ofstream o(g_logFile.c_str(), ios_base::out | ios_base::app);
|
||||
if (!o.fail())
|
||||
o << second_clock::local_time() << " MSG: " << msg;
|
||||
}
|
||||
@@ -92,7 +92,7 @@ internal_log_level(const std::string &msg, int logLevel)
|
||||
{
|
||||
if (g_logLevel >= logLevel) {
|
||||
if (!g_logFile.empty()) {
|
||||
ofstream o(g_logFile.c_str(), ios_base::out | ios_base::app);
|
||||
std::ofstream o(g_logFile.c_str(), ios_base::out | ios_base::app);
|
||||
if (!o.fail())
|
||||
o << second_clock::local_time() << " OUT: " << msg;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2012 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include "nonqthelper.h"
|
||||
|
||||
#include <core/convhelper.h>
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
NonQtHelper::NonQtHelper()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
NonQtHelper::~NonQtHelper()
|
||||
{
|
||||
}
|
||||
|
||||
std::string
|
||||
NonQtHelper::stringToUtf8(const std::string &myString)
|
||||
{
|
||||
return ConvHelper::NativeToUtf8(myString);
|
||||
}
|
||||
|
||||
std::string
|
||||
NonQtHelper::stringFromUtf8(const std::string &myString)
|
||||
{
|
||||
return ConvHelper::Utf8ToNative(myString);
|
||||
}
|
||||
|
||||
std::string
|
||||
NonQtHelper::getDefaultLanguage()
|
||||
{
|
||||
return "en";
|
||||
}
|
||||
|
||||
std::string
|
||||
NonQtHelper::getDataPathStdString(const char *argv0)
|
||||
{
|
||||
boost::filesystem::path startPath(argv0);
|
||||
startPath = startPath.remove_leaf();
|
||||
startPath /= "data";
|
||||
return stringToUtf8(startPath.directory_string());
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2012 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef NONQTHELPER_H
|
||||
#define NONQTHELPER_H
|
||||
|
||||
#ifndef POKERTH_DEDICATED_SERVER
|
||||
#error This file is only for the server.
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
|
||||
class NonQtHelper
|
||||
{
|
||||
|
||||
public:
|
||||
NonQtHelper();
|
||||
|
||||
~NonQtHelper();
|
||||
|
||||
std::string stringToUtf8(const std::string &);
|
||||
std::string stringFromUtf8(const std::string &);
|
||||
std::string getDefaultLanguage();
|
||||
|
||||
std::string getDataPathStdString(const char *argv0);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,74 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2012 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include "nonqttoolswrapper.h"
|
||||
|
||||
#include <nonqthelper/nonqthelper.h>
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
QtToolsInterface *CreateQtToolsWrapper()
|
||||
{
|
||||
return new NonQtToolsWrapper;
|
||||
}
|
||||
|
||||
NonQtToolsWrapper::NonQtToolsWrapper() : myQtHelper(0)
|
||||
{
|
||||
|
||||
myQtHelper = new NonQtHelper();
|
||||
}
|
||||
|
||||
|
||||
NonQtToolsWrapper::~NonQtToolsWrapper()
|
||||
{
|
||||
delete myQtHelper;
|
||||
myQtHelper = 0;
|
||||
}
|
||||
|
||||
std::string NonQtToolsWrapper::stringToUtf8(const std::string &myString)
|
||||
{
|
||||
return myQtHelper->stringToUtf8(myString);
|
||||
}
|
||||
std::string NonQtToolsWrapper::stringFromUtf8(const std::string &myString)
|
||||
{
|
||||
return myQtHelper->stringFromUtf8(myString);
|
||||
}
|
||||
std::string NonQtToolsWrapper::getDefaultLanguage()
|
||||
{
|
||||
return myQtHelper->getDefaultLanguage();
|
||||
}
|
||||
std::string NonQtToolsWrapper::getDataPathStdString(const char * argv0)
|
||||
{
|
||||
return myQtHelper->getDataPathStdString(argv0);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2012 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef NONQTTOOLSWRAPPER_H
|
||||
#define NONQTTOOLSWRAPPER_H
|
||||
|
||||
#include <qttoolsinterface.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
class NonQtHelper;
|
||||
|
||||
class NonQtToolsWrapper : public QtToolsInterface
|
||||
{
|
||||
public:
|
||||
NonQtToolsWrapper();
|
||||
~NonQtToolsWrapper();
|
||||
|
||||
std::string stringToUtf8(const std::string &myString);
|
||||
std::string stringFromUtf8(const std::string &myString);
|
||||
std::string getDefaultLanguage();
|
||||
std::string getDataPathStdString(const char *argv0);
|
||||
|
||||
private:
|
||||
|
||||
NonQtHelper *myQtHelper;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,107 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2012 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
#include "qthelper.h"
|
||||
#include <QtCore>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
QtHelper::QtHelper()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
QtHelper::~QtHelper()
|
||||
{
|
||||
}
|
||||
|
||||
std::string QtHelper::stringToUtf8(const std::string &myString)
|
||||
{
|
||||
|
||||
QString tmpString = QString::fromLocal8Bit(myString.c_str());
|
||||
std::string myUtf8String = tmpString.toUtf8().constData();
|
||||
|
||||
return myUtf8String;
|
||||
}
|
||||
|
||||
std::string QtHelper::stringFromUtf8(const std::string &myString)
|
||||
{
|
||||
QString tmpString = QString::fromUtf8(myString.c_str());
|
||||
|
||||
return tmpString.toLocal8Bit().constData();
|
||||
}
|
||||
|
||||
std::string QtHelper::getDefaultLanguage()
|
||||
{
|
||||
return QLocale::system().name().toStdString();
|
||||
}
|
||||
|
||||
std::string QtHelper::getDataPathStdString(const char * /*argv0*/)
|
||||
{
|
||||
QString path(QCoreApplication::instance()->applicationDirPath());
|
||||
|
||||
#ifdef _WIN32
|
||||
path += "/data/";
|
||||
#else
|
||||
#ifdef __APPLE__
|
||||
if (QRegExp("Contents/MacOS/?$").indexIn(path) != -1) {
|
||||
// pointing into an macosx application bundle
|
||||
path += "/../Resources/data/";
|
||||
} else {
|
||||
path += "/data/";
|
||||
}
|
||||
#else //Unix
|
||||
if (QRegExp("pokerth/?$").indexIn(path) != -1) {
|
||||
// there is an own application directory
|
||||
path += "/data/";
|
||||
} else if (QRegExp("usr/games/bin/?$").indexIn(path) != -1) {
|
||||
// we are in /usr/games/bin (like gentoo linux does)
|
||||
path += "/../../share/games/pokerth/data/";
|
||||
} else if (QRegExp("usr/games/?$").indexIn(path) != -1) {
|
||||
// we are in /usr/games (like Debian linux does)
|
||||
path += "/../share/games/pokerth/";
|
||||
} else if (QRegExp("bin/?$").indexIn(path) != -1) {
|
||||
// we are in a bin directory. e.g. /usr/bin
|
||||
path += "/../share/pokerth/data/";
|
||||
|
||||
} else {
|
||||
path += "/data/";
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
return (QDir::cleanPath(path) + "/").toStdString();
|
||||
}
|
||||
// [01:09] <Zhenech> doitux|mob, mach den pfad als define, und nur wenns nich gesetzt is wildes raten
|
||||
// [01:10] <Zhenech> dann compilieren die distries mit -DDATAPTH="/usr/share/games/pokerth" o.ä.
|
||||
// [01:10] <Zhenech> und du suchst eine liste ab:
|
||||
// [01:10] <Zhenech> ist es in [/usr/share/pokerth, /usr/share/games/pokerth/, /usr/local/..., $PWD/data]
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2012 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
#ifndef QTHELPER_H
|
||||
#define QTHELPER_H
|
||||
|
||||
#ifdef POKERTH_DEDICATED_SERVER
|
||||
#error This file is not for the server.
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
/**
|
||||
@author FThauer FHammer <webmaster@pokerth.net>
|
||||
*/
|
||||
class QtHelper
|
||||
{
|
||||
|
||||
public:
|
||||
QtHelper();
|
||||
|
||||
~QtHelper();
|
||||
|
||||
std::string stringToUtf8(const std::string &);
|
||||
std::string stringFromUtf8(const std::string &);
|
||||
std::string getDefaultLanguage();
|
||||
|
||||
std::string getDataPathStdString(const char *argv0);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,71 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2012 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
#include "qttoolswrapper.h"
|
||||
#include <qthelper/qthelper.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
QtToolsInterface *CreateQtToolsWrapper()
|
||||
{
|
||||
return new QtToolsWrapper;
|
||||
}
|
||||
|
||||
QtToolsWrapper::QtToolsWrapper() : myQtHelper(0)
|
||||
{
|
||||
|
||||
myQtHelper = new QtHelper();
|
||||
}
|
||||
|
||||
|
||||
QtToolsWrapper::~QtToolsWrapper()
|
||||
{
|
||||
delete myQtHelper;
|
||||
myQtHelper = 0;
|
||||
}
|
||||
|
||||
std::string QtToolsWrapper::stringToUtf8(const std::string &myString)
|
||||
{
|
||||
return myQtHelper->stringToUtf8(myString);
|
||||
}
|
||||
std::string QtToolsWrapper::stringFromUtf8(const std::string &myString)
|
||||
{
|
||||
return myQtHelper->stringFromUtf8(myString);
|
||||
}
|
||||
std::string QtToolsWrapper::getDefaultLanguage()
|
||||
{
|
||||
return myQtHelper->getDefaultLanguage();
|
||||
}
|
||||
std::string QtToolsWrapper::getDataPathStdString(const char * argv0)
|
||||
{
|
||||
return myQtHelper->getDataPathStdString(argv0);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2012 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
#ifndef QTTOOLSWRAPPER_H
|
||||
#define QTTOOLSWRAPPER_H
|
||||
|
||||
#include <qttoolsinterface.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
class QtHelper;
|
||||
|
||||
class QtToolsWrapper : public QtToolsInterface
|
||||
{
|
||||
public:
|
||||
QtToolsWrapper();
|
||||
|
||||
~QtToolsWrapper();
|
||||
|
||||
std::string stringToUtf8(const std::string &myString);
|
||||
std::string stringFromUtf8(const std::string &myString);
|
||||
std::string getDefaultLanguage();
|
||||
std::string getDataPathStdString(const char *argv0);
|
||||
|
||||
private:
|
||||
|
||||
QtHelper *myQtHelper;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,37 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2012 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
#include "qttoolsinterface.h"
|
||||
|
||||
QtToolsInterface::~QtToolsInterface()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2012 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
#ifndef QTTOOLSINTERFACE_H
|
||||
#define QTTOOLSINTERFACE_H
|
||||
|
||||
#include <string>
|
||||
|
||||
class QtToolsInterface
|
||||
{
|
||||
public:
|
||||
virtual ~QtToolsInterface();
|
||||
|
||||
//qthelper.cpp
|
||||
virtual std::string stringToUtf8(const std::string &) =0;
|
||||
virtual std::string stringFromUtf8(const std::string &) =0;
|
||||
virtual std::string getDefaultLanguage() =0;
|
||||
virtual std::string getDataPathStdString(const char *argv0) =0;
|
||||
|
||||
|
||||
};
|
||||
|
||||
QtToolsInterface *CreateQtToolsWrapper();
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,76 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2016 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include <dbofficial/asyncdbadminplayers.h>
|
||||
#include <dbofficial/dbidmanager.h>
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
AsyncDBAdminPlayers::AsyncDBAdminPlayers(unsigned queryId, const string &preparedName)
|
||||
: SingleAsyncDBQuery(queryId, preparedName, list<string>())
|
||||
{
|
||||
}
|
||||
|
||||
AsyncDBAdminPlayers::~AsyncDBAdminPlayers()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
AsyncDBAdminPlayers::Init(DBIdManager& /*idManager*/)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
AsyncDBAdminPlayers::HandleResult(mysqlpp::Query &/*query*/, DBIdManager& /*idManager*/, mysqlpp::StoreQueryResult& result, boost::asio::io_service &service, ServerDBCallback &cb)
|
||||
{
|
||||
list<DB_id> adminPlayers;
|
||||
for (size_t i = 0; i < result.num_rows(); ++i) {
|
||||
if (!result[i].empty()) {
|
||||
adminPlayers.push_back(result[i][0]);
|
||||
}
|
||||
}
|
||||
service.post(boost::bind(&ServerDBCallback::PlayerAdminList, &cb, GetId(), adminPlayers));
|
||||
}
|
||||
|
||||
void
|
||||
AsyncDBAdminPlayers::HandleNoResult(mysqlpp::Query &/*query*/, DBIdManager& /*idManager*/, boost::asio::io_service &service, ServerDBCallback &cb)
|
||||
{
|
||||
// This query should always produce a result.
|
||||
HandleError(service, cb);
|
||||
}
|
||||
|
||||
void
|
||||
AsyncDBAdminPlayers::HandleError(boost::asio::io_service &service, ServerDBCallback &cb)
|
||||
{
|
||||
service.post(boost::bind(&ServerDBCallback::QueryError, &cb, "AsyncDBAdminPlayers: Failure."));
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2016 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
/* Async database query for all admin players. */
|
||||
|
||||
#ifndef _ASYNCDBADMINPLAYERS_H_
|
||||
#define _ASYNCDBADMINPLAYERS_H_
|
||||
|
||||
#include <dbofficial/singleasyncdbquery.h>
|
||||
|
||||
|
||||
class AsyncDBAdminPlayers : public SingleAsyncDBQuery
|
||||
{
|
||||
public:
|
||||
AsyncDBAdminPlayers(unsigned queryId, const std::string &preparedName);
|
||||
virtual ~AsyncDBAdminPlayers();
|
||||
|
||||
virtual void Init(DBIdManager& idManager);
|
||||
|
||||
virtual void HandleResult(mysqlpp::Query &query, DBIdManager& idManager, mysqlpp::StoreQueryResult& result, boost::asio::io_service &service, ServerDBCallback &cb);
|
||||
virtual void HandleNoResult(mysqlpp::Query &query, DBIdManager& idManager, boost::asio::io_service &service, ServerDBCallback &cb);
|
||||
virtual void HandleError(boost::asio::io_service &service, ServerDBCallback &cb);
|
||||
|
||||
virtual bool RequiresResultSet() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,84 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2016 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <dbofficial/asyncdbauth.h>
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
AsyncDBAuth::AsyncDBAuth(unsigned queryId, const string &preparedName, const list<string> ¶ms)
|
||||
: SingleAsyncDBQuery(queryId, preparedName, params)
|
||||
{
|
||||
}
|
||||
|
||||
AsyncDBAuth::~AsyncDBAuth()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
AsyncDBAuth::HandleResult(mysqlpp::Query &/*query*/, DBIdManager& /*idManager*/, mysqlpp::StoreQueryResult& result, boost::asio::io_service &service, ServerDBCallback &cb)
|
||||
{
|
||||
if (result.num_rows() != 1) {
|
||||
service.post(boost::bind(&ServerDBCallback::PlayerLoginFailed, &cb, GetId()));
|
||||
} else {
|
||||
int valid = result[0][2];
|
||||
int active = result[0][5];
|
||||
if ((valid != 1) || (active != 1)) {
|
||||
service.post(boost::bind(&ServerDBCallback::PlayerLoginBlocked, &cb, GetId()));
|
||||
} else {
|
||||
mysqlpp::String secret(result[0][1]);
|
||||
mysqlpp::String country(result[0][3]);
|
||||
mysqlpp::String last_login(result[0][4]);
|
||||
boost::shared_ptr<DBPlayerData> tmpData(new DBPlayerData);
|
||||
tmpData->id = result[0][0];
|
||||
secret.to_string(tmpData->secret);
|
||||
if (!country.is_null())
|
||||
country.to_string(tmpData->country);
|
||||
last_login.to_string(tmpData->last_login);
|
||||
|
||||
service.post(boost::bind(&ServerDBCallback::PlayerLoginSuccess, &cb, GetId(), tmpData));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
AsyncDBAuth::HandleNoResult(mysqlpp::Query &/*query*/, DBIdManager& /*idManager*/, boost::asio::io_service &service, ServerDBCallback &cb)
|
||||
{
|
||||
HandleError(service, cb);
|
||||
}
|
||||
|
||||
void
|
||||
AsyncDBAuth::HandleError(boost::asio::io_service &service, ServerDBCallback &cb)
|
||||
{
|
||||
service.post(boost::bind(&ServerDBCallback::PlayerLoginFailed, &cb, GetId()));
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2016 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
/* Async database auth query. */
|
||||
|
||||
#ifndef _ASYNCDBAUTH_H_
|
||||
#define _ASYNCDBAUTH_H_
|
||||
|
||||
#include <dbofficial/singleasyncdbquery.h>
|
||||
|
||||
|
||||
class AsyncDBAuth : public SingleAsyncDBQuery
|
||||
{
|
||||
public:
|
||||
AsyncDBAuth(unsigned queryId, const std::string &preparedName, const std::list<std::string> ¶ms);
|
||||
virtual ~AsyncDBAuth();
|
||||
|
||||
virtual void Init(DBIdManager& /*idManager*/) {}
|
||||
|
||||
virtual void HandleResult(mysqlpp::Query &query, DBIdManager& idManager, mysqlpp::StoreQueryResult& result, boost::asio::io_service &service, ServerDBCallback &cb);
|
||||
virtual void HandleNoResult(mysqlpp::Query &query, DBIdManager& idManager, boost::asio::io_service &service, ServerDBCallback &cb);
|
||||
virtual void HandleError(boost::asio::io_service &service, ServerDBCallback &cb);
|
||||
|
||||
virtual bool RequiresResultSet() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,68 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2016 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <dbofficial/asyncdbavatarblacklist.h>
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
AsyncDBAvatarBlacklist::AsyncDBAvatarBlacklist(unsigned queryId, const string &preparedName, const list<string> ¶ms)
|
||||
: SingleAsyncDBQuery(queryId, preparedName, params)
|
||||
{
|
||||
}
|
||||
|
||||
AsyncDBAvatarBlacklist::~AsyncDBAvatarBlacklist()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
AsyncDBAvatarBlacklist::HandleResult(mysqlpp::Query &/*query*/, DBIdManager& /*idManager*/, mysqlpp::StoreQueryResult& result, boost::asio::io_service &service, ServerDBCallback &cb)
|
||||
{
|
||||
if (result.num_rows() == 0)
|
||||
service.post(boost::bind(&ServerDBCallback::AvatarIsOK, &cb, GetId()));
|
||||
else
|
||||
service.post(boost::bind(&ServerDBCallback::AvatarIsBlacklisted, &cb, GetId()));
|
||||
}
|
||||
|
||||
void
|
||||
AsyncDBAvatarBlacklist::HandleNoResult(mysqlpp::Query &/*query*/, DBIdManager& /*idManager*/, boost::asio::io_service &service, ServerDBCallback &cb)
|
||||
{
|
||||
HandleError(service, cb);
|
||||
}
|
||||
|
||||
void
|
||||
AsyncDBAvatarBlacklist::HandleError(boost::asio::io_service &service, ServerDBCallback &cb)
|
||||
{
|
||||
// If query failed: Avatar is blacklisted.
|
||||
service.post(boost::bind(&ServerDBCallback::AvatarIsBlacklisted, &cb, GetId()));
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2016 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
/* Async database avatar blacklist query. */
|
||||
|
||||
#ifndef _ASYNCDBAVATARBLACKLIST_H_
|
||||
#define _ASYNCDBAVATARBLACKLIST_H_
|
||||
|
||||
#include <dbofficial/singleasyncdbquery.h>
|
||||
|
||||
|
||||
class AsyncDBAvatarBlacklist : public SingleAsyncDBQuery
|
||||
{
|
||||
public:
|
||||
AsyncDBAvatarBlacklist(unsigned queryId, const std::string &preparedName, const std::list<std::string> ¶ms);
|
||||
virtual ~AsyncDBAvatarBlacklist();
|
||||
|
||||
virtual void Init(DBIdManager& /*idManager*/) {}
|
||||
|
||||
virtual void HandleResult(mysqlpp::Query &query, DBIdManager& /*idManager*/, mysqlpp::StoreQueryResult& result, boost::asio::io_service &service, ServerDBCallback &cb);
|
||||
virtual void HandleNoResult(mysqlpp::Query &query, DBIdManager& /*idManager*/, boost::asio::io_service &service, ServerDBCallback &cb);
|
||||
virtual void HandleError(boost::asio::io_service &service, ServerDBCallback &cb);
|
||||
|
||||
virtual bool RequiresResultSet() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,71 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2016 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <dbofficial/asyncdbblockplayer.h>
|
||||
#include <dbofficial/dbidmanager.h>
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
AsyncDBBlockPlayer::AsyncDBBlockPlayer(unsigned queryId, unsigned replyId, const string &preparedName, const list<string> ¶ms)
|
||||
: SingleAsyncDBQuery(queryId, preparedName, params), m_replyId(replyId)
|
||||
{
|
||||
}
|
||||
|
||||
AsyncDBBlockPlayer::~AsyncDBBlockPlayer()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
AsyncDBBlockPlayer::Init(DBIdManager &/*idManager*/)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
AsyncDBBlockPlayer::HandleResult(mysqlpp::Query &/*query*/, DBIdManager &/*idManager*/, mysqlpp::StoreQueryResult &/*result*/, boost::asio::io_service &service, ServerDBCallback &cb)
|
||||
{
|
||||
// This query does not produce a result.
|
||||
HandleError(service, cb);
|
||||
}
|
||||
|
||||
void
|
||||
AsyncDBBlockPlayer::HandleNoResult(mysqlpp::Query &/*query*/, DBIdManager &/*idManager*/, boost::asio::io_service &service, ServerDBCallback &cb)
|
||||
{
|
||||
service.post(boost::bind(&ServerDBCallback::BlockPlayerSuccess, &cb, GetId(), m_replyId));
|
||||
}
|
||||
|
||||
void
|
||||
AsyncDBBlockPlayer::HandleError(boost::asio::io_service &service, ServerDBCallback &cb)
|
||||
{
|
||||
service.post(boost::bind(&ServerDBCallback::BlockPlayerFailed, &cb, GetId(), m_replyId));
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2016 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
/* Async database update to block a player. */
|
||||
|
||||
#ifndef _ASYNCDBBLOCKPLAYER_H_
|
||||
#define _ASYNCDBBLOCKPLAYER_H_
|
||||
|
||||
#include <dbofficial/singleasyncdbquery.h>
|
||||
|
||||
|
||||
class AsyncDBBlockPlayer : public SingleAsyncDBQuery
|
||||
{
|
||||
public:
|
||||
AsyncDBBlockPlayer(unsigned queryId, unsigned replyId, const std::string &preparedName, const std::list<std::string> ¶ms);
|
||||
virtual ~AsyncDBBlockPlayer();
|
||||
|
||||
virtual void Init(DBIdManager& idManager);
|
||||
|
||||
virtual void HandleResult(mysqlpp::Query &query, DBIdManager& idManager, mysqlpp::StoreQueryResult& result, boost::asio::io_service &service, ServerDBCallback &cb);
|
||||
virtual void HandleNoResult(mysqlpp::Query &query, DBIdManager& idManager, boost::asio::io_service &service, ServerDBCallback &cb);
|
||||
virtual void HandleError(boost::asio::io_service &service, ServerDBCallback &cb);
|
||||
|
||||
virtual bool RequiresResultSet() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned m_replyId;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,76 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2016 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <dbofficial/asyncdbcreategame.h>
|
||||
#include <dbofficial/dbidmanager.h>
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
AsyncDBCreateGame::AsyncDBCreateGame(unsigned queryId, const string &preparedName, const list<string> ¶ms)
|
||||
: SingleAsyncDBQuery(queryId, preparedName, params)
|
||||
{
|
||||
}
|
||||
|
||||
AsyncDBCreateGame::~AsyncDBCreateGame()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
AsyncDBCreateGame::HandleResult(mysqlpp::Query &/*query*/, DBIdManager& /*idManager*/, mysqlpp::StoreQueryResult& /*result*/, boost::asio::io_service &service, ServerDBCallback &cb)
|
||||
{
|
||||
// This query does not produce a result.
|
||||
HandleError(service, cb);
|
||||
}
|
||||
|
||||
void
|
||||
AsyncDBCreateGame::HandleNoResult(mysqlpp::Query &query, DBIdManager& idManager, boost::asio::io_service &service, ServerDBCallback &cb)
|
||||
{
|
||||
query.reset();
|
||||
query
|
||||
<< "SELECT LAST_INSERT_ID()";
|
||||
mysqlpp::StoreQueryResult tmpResult = query.store();
|
||||
DB_id insertId = tmpResult[0][0];
|
||||
if (!tmpResult || tmpResult.num_rows() != 1 || insertId == 0) {
|
||||
service.post(boost::bind(&ServerDBCallback::CreateGameFailed, &cb, GetId()));
|
||||
} else {
|
||||
service.post(boost::bind(&ServerDBCallback::CreateGameSuccess, &cb, GetId()));
|
||||
idManager.AddGameId(GetId(), insertId);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
AsyncDBCreateGame::HandleError(boost::asio::io_service &service, ServerDBCallback &cb)
|
||||
{
|
||||
service.post(boost::bind(&ServerDBCallback::CreateGameFailed, &cb, GetId()));
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2016 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
/* Async database create game query. */
|
||||
|
||||
#ifndef _ASYNCDBCREATEGAME_H_
|
||||
#define _ASYNCDBCREATEGAME_H_
|
||||
|
||||
#include <dbofficial/singleasyncdbquery.h>
|
||||
|
||||
|
||||
class AsyncDBCreateGame : public SingleAsyncDBQuery
|
||||
{
|
||||
public:
|
||||
AsyncDBCreateGame(unsigned queryId, const std::string &preparedName, const std::list<std::string> ¶ms);
|
||||
virtual ~AsyncDBCreateGame();
|
||||
|
||||
virtual void Init(DBIdManager& /*idManager*/) {}
|
||||
|
||||
virtual void HandleResult(mysqlpp::Query &query, DBIdManager& idManager, mysqlpp::StoreQueryResult& result, boost::asio::io_service &service, ServerDBCallback &cb);
|
||||
virtual void HandleNoResult(mysqlpp::Query &query, DBIdManager& idManager, boost::asio::io_service &service, ServerDBCallback &cb);
|
||||
virtual void HandleError(boost::asio::io_service &service, ServerDBCallback &cb);
|
||||
|
||||
virtual bool RequiresResultSet() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,77 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2016 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include <dbofficial/asyncdbendgame.h>
|
||||
#include <dbofficial/dbidmanager.h>
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
AsyncDBEndGame::AsyncDBEndGame(unsigned queryId, const string &preparedName, const std::list<std::string> ¶ms)
|
||||
: SingleAsyncDBQuery(queryId, preparedName, params)
|
||||
{
|
||||
}
|
||||
|
||||
AsyncDBEndGame::~AsyncDBEndGame()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
AsyncDBEndGame::Init(DBIdManager& idManager)
|
||||
{
|
||||
std::list<std::string> params;
|
||||
GetParams(params);
|
||||
ostringstream paramStream;
|
||||
paramStream << idManager.GetGameDBId(GetId());
|
||||
// Add game id as last parameter (where-clause).
|
||||
params.push_back(paramStream.str());
|
||||
SetParams(params);
|
||||
}
|
||||
|
||||
void
|
||||
AsyncDBEndGame::HandleResult(mysqlpp::Query &/*query*/, DBIdManager& /*idManager*/, mysqlpp::StoreQueryResult& /*result*/, boost::asio::io_service &service, ServerDBCallback &cb)
|
||||
{
|
||||
// This query does not produce a result.
|
||||
HandleError(service, cb);
|
||||
}
|
||||
|
||||
void
|
||||
AsyncDBEndGame::HandleNoResult(mysqlpp::Query &/*query*/, DBIdManager& /*idManager*/, boost::asio::io_service &/*service*/, ServerDBCallback &/*cb*/)
|
||||
{
|
||||
// Nothing to do.
|
||||
}
|
||||
|
||||
void
|
||||
AsyncDBEndGame::HandleError(boost::asio::io_service &/*service*/, ServerDBCallback &/*cb*/)
|
||||
{
|
||||
// Ignore errors for now (as nothing important is done).
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2016 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
/* Async database end game query. */
|
||||
|
||||
#ifndef _ASYNCDBENDGAME_H_
|
||||
#define _ASYNCDBENDGAME_H_
|
||||
|
||||
#include <dbofficial/singleasyncdbquery.h>
|
||||
|
||||
|
||||
class AsyncDBEndGame : public SingleAsyncDBQuery
|
||||
{
|
||||
public:
|
||||
AsyncDBEndGame(unsigned queryId, const std::string &preparedName, const std::list<std::string> ¶ms);
|
||||
virtual ~AsyncDBEndGame();
|
||||
|
||||
virtual void Init(DBIdManager& idManager);
|
||||
|
||||
virtual void HandleResult(mysqlpp::Query &query, DBIdManager& idManager, mysqlpp::StoreQueryResult& result, boost::asio::io_service &service, ServerDBCallback &cb);
|
||||
virtual void HandleNoResult(mysqlpp::Query &query, DBIdManager& idManager, boost::asio::io_service &service, ServerDBCallback &cb);
|
||||
virtual void HandleError(boost::asio::io_service &service, ServerDBCallback &cb);
|
||||
|
||||
virtual bool RequiresResultSet() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,78 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2016 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <dbofficial/asyncdbgameplace.h>
|
||||
#include <dbofficial/dbidmanager.h>
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
AsyncDBGamePlace::AsyncDBGamePlace(unsigned queryId, const string &preparedName, const list<string> ¶ms)
|
||||
: SingleAsyncDBQuery(queryId, preparedName, params)
|
||||
{
|
||||
}
|
||||
|
||||
AsyncDBGamePlace::~AsyncDBGamePlace()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
AsyncDBGamePlace::Init(DBIdManager& idManager)
|
||||
{
|
||||
std::list<std::string> params;
|
||||
GetParams(params);
|
||||
ostringstream paramStream;
|
||||
paramStream << idManager.GetGameDBId(GetId());
|
||||
// Add game id as first parameter (according to the order in insert).
|
||||
params.push_front(paramStream.str());
|
||||
SetParams(params);
|
||||
}
|
||||
|
||||
void
|
||||
AsyncDBGamePlace::HandleResult(mysqlpp::Query &/*query*/, DBIdManager& /*idManager*/, mysqlpp::StoreQueryResult& /*result*/, boost::asio::io_service &service, ServerDBCallback &cb)
|
||||
{
|
||||
// This query does not produce a result.
|
||||
HandleError(service, cb);
|
||||
}
|
||||
|
||||
void
|
||||
AsyncDBGamePlace::HandleNoResult(mysqlpp::Query &/*query*/, DBIdManager& /*idManager*/, boost::asio::io_service &/*service*/, ServerDBCallback &/*cb*/)
|
||||
{
|
||||
// No action required.
|
||||
}
|
||||
|
||||
void
|
||||
AsyncDBGamePlace::HandleError(boost::asio::io_service &service, ServerDBCallback &cb)
|
||||
{
|
||||
service.post(boost::bind(&ServerDBCallback::QueryError, &cb, "AsyncDBGamePlace: Failure."));
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2016 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
/* Async database set place query. */
|
||||
|
||||
#ifndef _ASYNCDBGAMEPLACE_H_
|
||||
#define _ASYNCDBGAMEPLACE_H_
|
||||
|
||||
#include <dbofficial/singleasyncdbquery.h>
|
||||
|
||||
|
||||
class AsyncDBGamePlace : public SingleAsyncDBQuery
|
||||
{
|
||||
public:
|
||||
AsyncDBGamePlace(unsigned queryId, const std::string &preparedName, const std::list<std::string> ¶ms);
|
||||
virtual ~AsyncDBGamePlace();
|
||||
|
||||
virtual void Init(DBIdManager& idManager);
|
||||
|
||||
virtual void HandleResult(mysqlpp::Query &query, DBIdManager& idManager, mysqlpp::StoreQueryResult& result, boost::asio::io_service &service, ServerDBCallback &cb);
|
||||
virtual void HandleNoResult(mysqlpp::Query &query, DBIdManager& idManager, boost::asio::io_service &service, ServerDBCallback &cb);
|
||||
virtual void HandleError(boost::asio::io_service &service, ServerDBCallback &cb);
|
||||
|
||||
virtual bool RequiresResultSet() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,65 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2016 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <dbofficial/asyncdblogin.h>
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
AsyncDBLogin::AsyncDBLogin(unsigned queryId, const string &preparedName, const list<string> ¶ms)
|
||||
: SingleAsyncDBQuery(queryId, preparedName, params)
|
||||
{
|
||||
}
|
||||
|
||||
AsyncDBLogin::~AsyncDBLogin()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
AsyncDBLogin::HandleResult(mysqlpp::Query &/*query*/, DBIdManager& /*idManager*/, mysqlpp::StoreQueryResult& /*result*/, boost::asio::io_service &service, ServerDBCallback &cb)
|
||||
{
|
||||
// This query does not produce a result.
|
||||
HandleError(service, cb);
|
||||
}
|
||||
|
||||
void
|
||||
AsyncDBLogin::HandleNoResult(mysqlpp::Query &/*query*/, DBIdManager& /*idManager*/, boost::asio::io_service &/*service*/, ServerDBCallback &/*cb*/)
|
||||
{
|
||||
// No action required.
|
||||
}
|
||||
|
||||
void
|
||||
AsyncDBLogin::HandleError(boost::asio::io_service &service, ServerDBCallback &cb)
|
||||
{
|
||||
service.post(boost::bind(&ServerDBCallback::QueryError, &cb, "AsyncDBLogin: Failure."));
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2016 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
/* Async database login query. */
|
||||
|
||||
#ifndef _ASYNCDBLOGIN_H_
|
||||
#define _ASYNCDBLOGIN_H_
|
||||
|
||||
#include <dbofficial/singleasyncdbquery.h>
|
||||
|
||||
|
||||
class AsyncDBLogin : public SingleAsyncDBQuery
|
||||
{
|
||||
public:
|
||||
AsyncDBLogin(unsigned queryId, const std::string &preparedName, const std::list<std::string> ¶ms);
|
||||
virtual ~AsyncDBLogin();
|
||||
|
||||
virtual void Init(DBIdManager& /*idManager*/) {}
|
||||
|
||||
virtual void HandleResult(mysqlpp::Query &query, DBIdManager& idManager, mysqlpp::StoreQueryResult& result, boost::asio::io_service &service, ServerDBCallback &cb);
|
||||
virtual void HandleNoResult(mysqlpp::Query &query, DBIdManager& idManager, boost::asio::io_service &service, ServerDBCallback &cb);
|
||||
virtual void HandleError(boost::asio::io_service &service, ServerDBCallback &cb);
|
||||
|
||||
virtual bool RequiresResultSet() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,40 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2016 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include <dbofficial/asyncdbquery.h>
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
AsyncDBQuery::~AsyncDBQuery()
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2016 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
/* Async database query. */
|
||||
|
||||
#ifndef _ASYNCDBQUERY_H_
|
||||
#define _ASYNCDBQUERY_H_
|
||||
|
||||
#include <boost/asio.hpp>
|
||||
#include <list>
|
||||
#include <mysql++.h>
|
||||
#include <db/serverdbcallback.h>
|
||||
|
||||
class DBIdManager;
|
||||
|
||||
class AsyncDBQuery
|
||||
{
|
||||
public:
|
||||
virtual ~AsyncDBQuery();
|
||||
|
||||
virtual void Init(DBIdManager& idManager) = 0;
|
||||
|
||||
virtual std::string GetPreparedName() const = 0;
|
||||
virtual void GetParams(std::list<std::string> ¶ms) const = 0;
|
||||
virtual void SetParams(const std::list<std::string> ¶ms) = 0;
|
||||
|
||||
virtual void HandleResult(mysqlpp::Query &query, DBIdManager& idManager, mysqlpp::StoreQueryResult& result, boost::asio::io_service &service, ServerDBCallback &cb) = 0;
|
||||
virtual void HandleNoResult(mysqlpp::Query &query, DBIdManager& idManager, boost::asio::io_service &service, ServerDBCallback &cb) = 0;
|
||||
virtual void HandleError(boost::asio::io_service &service, ServerDBCallback &cb) = 0;
|
||||
virtual bool RequiresResultSet() const = 0;
|
||||
virtual bool Next() = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,65 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2016 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <dbofficial/asyncdbreportavatar.h>
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
AsyncDBReportAvatar::AsyncDBReportAvatar(unsigned queryId, unsigned replyId, const string &preparedName, const list<string> ¶ms)
|
||||
: SingleAsyncDBQuery(queryId, preparedName, params), m_replyId(replyId)
|
||||
{
|
||||
}
|
||||
|
||||
AsyncDBReportAvatar::~AsyncDBReportAvatar()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
AsyncDBReportAvatar::HandleResult(mysqlpp::Query &/*query*/, DBIdManager& /*idManager*/, mysqlpp::StoreQueryResult& /*result*/, boost::asio::io_service &service, ServerDBCallback &cb)
|
||||
{
|
||||
// This query does not produce a result.
|
||||
HandleError(service, cb);
|
||||
}
|
||||
|
||||
void
|
||||
AsyncDBReportAvatar::HandleNoResult(mysqlpp::Query &/*query*/, DBIdManager& /*idManager*/, boost::asio::io_service &service, ServerDBCallback &cb)
|
||||
{
|
||||
service.post(boost::bind(&ServerDBCallback::ReportAvatarSuccess, &cb, GetId(), m_replyId));
|
||||
}
|
||||
|
||||
void
|
||||
AsyncDBReportAvatar::HandleError(boost::asio::io_service &service, ServerDBCallback &cb)
|
||||
{
|
||||
service.post(boost::bind(&ServerDBCallback::ReportAvatarFailed, &cb, GetId(), m_replyId));
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2016 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
/* Async database report inappropriate avatar query. */
|
||||
|
||||
#ifndef _ASYNCDBREPORTAVATAR_H_
|
||||
#define _ASYNCDBREPORTAVATAR_H_
|
||||
|
||||
#include <dbofficial/singleasyncdbquery.h>
|
||||
|
||||
|
||||
class AsyncDBReportAvatar : public SingleAsyncDBQuery
|
||||
{
|
||||
public:
|
||||
AsyncDBReportAvatar(unsigned queryId, unsigned replyId, const std::string &preparedName, const std::list<std::string> ¶ms);
|
||||
virtual ~AsyncDBReportAvatar();
|
||||
|
||||
virtual void Init(DBIdManager& /*idManager*/) {}
|
||||
|
||||
virtual void HandleResult(mysqlpp::Query &query, DBIdManager& idManager, mysqlpp::StoreQueryResult& result, boost::asio::io_service &service, ServerDBCallback &cb);
|
||||
virtual void HandleNoResult(mysqlpp::Query &query, DBIdManager& idManager, boost::asio::io_service &service, ServerDBCallback &cb);
|
||||
virtual void HandleError(boost::asio::io_service &service, ServerDBCallback &cb);
|
||||
|
||||
virtual bool RequiresResultSet() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned m_replyId;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,83 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2016 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <dbofficial/asyncdbreportgame.h>
|
||||
#include <dbofficial/dbidmanager.h>
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
AsyncDBReportGame::AsyncDBReportGame(unsigned queryId, unsigned replyId, unsigned gameId, const string &preparedName, const list<string> ¶ms)
|
||||
: SingleAsyncDBQuery(queryId, preparedName, params), m_replyId(replyId), m_gameId(gameId)
|
||||
{
|
||||
}
|
||||
|
||||
AsyncDBReportGame::~AsyncDBReportGame()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
AsyncDBReportGame::Init(DBIdManager& idManager)
|
||||
{
|
||||
std::list<std::string> params;
|
||||
GetParams(params);
|
||||
ostringstream paramStream;
|
||||
unsigned tmpGameId = idManager.GetGameDBId(m_gameId);
|
||||
if (tmpGameId) {
|
||||
paramStream << idManager.GetGameDBId(m_gameId);
|
||||
// Add game id as last parameter (where-clause).
|
||||
params.push_back(paramStream.str());
|
||||
} else {
|
||||
params.push_back("NULL");
|
||||
}
|
||||
SetParams(params);
|
||||
}
|
||||
|
||||
void
|
||||
AsyncDBReportGame::HandleResult(mysqlpp::Query &/*query*/, DBIdManager& /*idManager*/, mysqlpp::StoreQueryResult& /*result*/, boost::asio::io_service &service, ServerDBCallback &cb)
|
||||
{
|
||||
// This query does not produce a result.
|
||||
HandleError(service, cb);
|
||||
}
|
||||
|
||||
void
|
||||
AsyncDBReportGame::HandleNoResult(mysqlpp::Query &/*query*/, DBIdManager& /*idManager*/, boost::asio::io_service &service, ServerDBCallback &cb)
|
||||
{
|
||||
service.post(boost::bind(&ServerDBCallback::ReportGameSuccess, &cb, GetId(), m_replyId));
|
||||
}
|
||||
|
||||
void
|
||||
AsyncDBReportGame::HandleError(boost::asio::io_service &service, ServerDBCallback &cb)
|
||||
{
|
||||
service.post(boost::bind(&ServerDBCallback::ReportGameFailed, &cb, GetId(), m_replyId));
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2016 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
/* Async database report inappropriate avatar query. */
|
||||
|
||||
#ifndef _ASYNCDBREPORTGAME_H_
|
||||
#define _ASYNCDBREPORTGAME_H_
|
||||
|
||||
#include <dbofficial/singleasyncdbquery.h>
|
||||
|
||||
|
||||
class AsyncDBReportGame : public SingleAsyncDBQuery
|
||||
{
|
||||
public:
|
||||
AsyncDBReportGame(unsigned queryId, unsigned replyId, unsigned gameId, const std::string &preparedName, const std::list<std::string> ¶ms);
|
||||
virtual ~AsyncDBReportGame();
|
||||
|
||||
virtual void Init(DBIdManager& idManager);
|
||||
|
||||
virtual void HandleResult(mysqlpp::Query &query, DBIdManager& idManager, mysqlpp::StoreQueryResult& result, boost::asio::io_service &service, ServerDBCallback &cb);
|
||||
virtual void HandleNoResult(mysqlpp::Query &query, DBIdManager& idManager, boost::asio::io_service &service, ServerDBCallback &cb);
|
||||
virtual void HandleError(boost::asio::io_service &service, ServerDBCallback &cb);
|
||||
|
||||
virtual bool RequiresResultSet() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned m_replyId;
|
||||
unsigned m_gameId;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,80 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2016 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include <dbofficial/asyncdbupdatescore.h>
|
||||
#include <dbofficial/dbidmanager.h>
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
AsyncDBUpdateScore::AsyncDBUpdateScore(unsigned queryId, const string &preparedName, const std::list<std::string> ¶ms)
|
||||
: SingleAsyncDBQuery(queryId, preparedName, params)
|
||||
{
|
||||
}
|
||||
|
||||
AsyncDBUpdateScore::~AsyncDBUpdateScore()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
AsyncDBUpdateScore::Init(DBIdManager& idManager)
|
||||
{
|
||||
std::list<std::string> params;
|
||||
GetParams(params);
|
||||
ostringstream paramStream;
|
||||
paramStream << idManager.GetGameDBId(GetId());
|
||||
// Add game id as first parameter (param for stored procedure).
|
||||
params.push_front(paramStream.str());
|
||||
SetParams(params);
|
||||
// Ensure that "update score" is only called once for a game.
|
||||
// This game id cannot be used any more, without re-init.
|
||||
idManager.RemoveGameId(GetId());
|
||||
}
|
||||
|
||||
void
|
||||
AsyncDBUpdateScore::HandleResult(mysqlpp::Query &/*query*/, DBIdManager& /*idManager*/, mysqlpp::StoreQueryResult& /*result*/, boost::asio::io_service &service, ServerDBCallback &cb)
|
||||
{
|
||||
// This query does not produce a result.
|
||||
HandleError(service, cb);
|
||||
}
|
||||
|
||||
void
|
||||
AsyncDBUpdateScore::HandleNoResult(mysqlpp::Query &/*query*/, DBIdManager& idManager, boost::asio::io_service &/*service*/, ServerDBCallback &/*cb*/)
|
||||
{
|
||||
idManager.RemoveGameId(GetId());
|
||||
}
|
||||
|
||||
void
|
||||
AsyncDBUpdateScore::HandleError(boost::asio::io_service &/*service*/, ServerDBCallback &/*cb*/)
|
||||
{
|
||||
// Ignore errors for now (as nothing important is done).
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2016 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
/* Async database query to update the score. */
|
||||
|
||||
#ifndef _ASYNCDBUPDATESCORE_H_
|
||||
#define _ASYNCDBUPDATESCORE_H_
|
||||
|
||||
#include <dbofficial/singleasyncdbquery.h>
|
||||
|
||||
|
||||
class AsyncDBUpdateScore : public SingleAsyncDBQuery
|
||||
{
|
||||
public:
|
||||
AsyncDBUpdateScore(unsigned queryId, const std::string &preparedName, const std::list<std::string> ¶ms);
|
||||
virtual ~AsyncDBUpdateScore();
|
||||
|
||||
virtual void Init(DBIdManager& idManager);
|
||||
|
||||
virtual void HandleResult(mysqlpp::Query &query, DBIdManager& idManager, mysqlpp::StoreQueryResult& result, boost::asio::io_service &service, ServerDBCallback &cb);
|
||||
virtual void HandleNoResult(mysqlpp::Query &query, DBIdManager& idManager, boost::asio::io_service &service, ServerDBCallback &cb);
|
||||
virtual void HandleError(boost::asio::io_service &service, ServerDBCallback &cb);
|
||||
|
||||
virtual bool RequiresResultSet() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,120 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2016 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include <dbofficial/compositeasyncdbquery.h>
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
CompositeAsyncDBQuery::CompositeAsyncDBQuery(const AsyncQueryList &queries)
|
||||
: m_list(queries), m_errorFlag(false), m_lastGameDBId(0)
|
||||
{
|
||||
m_currentQuery = m_list.begin();
|
||||
}
|
||||
|
||||
CompositeAsyncDBQuery::~CompositeAsyncDBQuery()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
CompositeAsyncDBQuery::Init(DBIdManager& idManager)
|
||||
{
|
||||
(*m_currentQuery)->Init(idManager);
|
||||
}
|
||||
|
||||
std::string
|
||||
CompositeAsyncDBQuery::GetPreparedName() const
|
||||
{
|
||||
return (*m_currentQuery)->GetPreparedName();
|
||||
}
|
||||
|
||||
void
|
||||
CompositeAsyncDBQuery::GetParams(std::list<std::string> ¶ms) const
|
||||
{
|
||||
(*m_currentQuery)->GetParams(params);
|
||||
}
|
||||
|
||||
void
|
||||
CompositeAsyncDBQuery::SetParams(const std::list<std::string> ¶ms)
|
||||
{
|
||||
(*m_currentQuery)->SetParams(params);
|
||||
}
|
||||
|
||||
void
|
||||
CompositeAsyncDBQuery::HandleResult(mysqlpp::Query &query, DBIdManager& idManager, mysqlpp::StoreQueryResult& result, boost::asio::io_service &service, ServerDBCallback &cb)
|
||||
{
|
||||
(*m_currentQuery)->HandleResult(query, idManager, result, service, cb);
|
||||
}
|
||||
|
||||
void
|
||||
CompositeAsyncDBQuery::HandleNoResult(mysqlpp::Query &query, DBIdManager& idManager, boost::asio::io_service &service, ServerDBCallback &cb)
|
||||
{
|
||||
(*m_currentQuery)->HandleNoResult(query, idManager, service, cb);
|
||||
}
|
||||
|
||||
void
|
||||
CompositeAsyncDBQuery::HandleError(boost::asio::io_service &service, ServerDBCallback &cb)
|
||||
{
|
||||
(*m_currentQuery)->HandleError(service, cb);
|
||||
m_errorFlag = true;
|
||||
}
|
||||
|
||||
bool
|
||||
CompositeAsyncDBQuery::RequiresResultSet() const
|
||||
{
|
||||
return (*m_currentQuery)->RequiresResultSet();
|
||||
}
|
||||
|
||||
bool
|
||||
CompositeAsyncDBQuery::Next()
|
||||
{
|
||||
bool retVal = false;
|
||||
AsyncQueryList::iterator pos = m_currentQuery;
|
||||
++pos;
|
||||
if (!m_errorFlag && pos != m_list.end()) {
|
||||
m_currentQuery = pos;
|
||||
retVal = true;
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
unsigned
|
||||
CompositeAsyncDBQuery::GetLastGameDBId() const
|
||||
{
|
||||
return m_lastGameDBId;
|
||||
}
|
||||
|
||||
void
|
||||
CompositeAsyncDBQuery::SetLastGameDBId(unsigned id)
|
||||
{
|
||||
m_lastGameDBId = id;
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2016 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
/* Composite async database query. */
|
||||
|
||||
#ifndef _COMPOSITEASYNCDBQUERY_H_
|
||||
#define _COMPOSITEASYNCDBQUERY_H_
|
||||
|
||||
#include <dbofficial/asyncdbquery.h>
|
||||
#include <dbofficial/querycontext.h>
|
||||
|
||||
|
||||
class CompositeAsyncDBQuery : public AsyncDBQuery, public QueryContext
|
||||
{
|
||||
public:
|
||||
typedef std::list<boost::shared_ptr<AsyncDBQuery> > AsyncQueryList;
|
||||
// Note: This list must contain at least one query.
|
||||
CompositeAsyncDBQuery(const AsyncQueryList &queries);
|
||||
virtual ~CompositeAsyncDBQuery();
|
||||
|
||||
virtual void Init(DBIdManager& idManager);
|
||||
|
||||
virtual std::string GetPreparedName() const;
|
||||
virtual void GetParams(std::list<std::string> ¶ms) const;
|
||||
virtual void SetParams(const std::list<std::string> ¶ms);
|
||||
|
||||
virtual void HandleResult(mysqlpp::Query &query, DBIdManager& idManager, mysqlpp::StoreQueryResult& result, boost::asio::io_service &service, ServerDBCallback &cb);
|
||||
virtual void HandleNoResult(mysqlpp::Query &query, DBIdManager& idManager, boost::asio::io_service &service, ServerDBCallback &cb);
|
||||
// One error will cancel the rest of the composite query.
|
||||
virtual void HandleError(boost::asio::io_service &service, ServerDBCallback &cb);
|
||||
|
||||
virtual bool RequiresResultSet() const;
|
||||
virtual bool Next();
|
||||
|
||||
virtual unsigned GetLastGameDBId() const;
|
||||
virtual void SetLastGameDBId(unsigned id);
|
||||
|
||||
private:
|
||||
AsyncQueryList m_list;
|
||||
AsyncQueryList::iterator m_currentQuery;
|
||||
bool m_errorFlag;
|
||||
unsigned m_lastGameDBId;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,78 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2016 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef _DB_TABLE_DEFS_H_
|
||||
#define _DB_TABLE_DEFS_H_
|
||||
|
||||
#define DB_TABLE_PLAYER "player_login"
|
||||
#define DB_TABLE_PLAYER_COL_ID "id"
|
||||
#define DB_TABLE_PLAYER_COL_USERNAME "username"
|
||||
#define DB_TABLE_PLAYER_COL_PASSWORD "password"
|
||||
#define DB_TABLE_PLAYER_COL_VALID "valid"
|
||||
#define DB_TABLE_PLAYER_COL_COUNTRY "country"
|
||||
#define DB_TABLE_PLAYER_COL_LASTLOGIN "last_login"
|
||||
#define DB_TABLE_PLAYER_COL_ACTIVE "aktivator"
|
||||
#define DB_TABLE_PLAYER_COL_AVATARHASH "avatar_hash"
|
||||
#define DB_TABLE_PLAYER_COL_AVATARTYPE "avatar_type"
|
||||
|
||||
#define DB_TABLE_GAME "game"
|
||||
#define DB_TABLE_GAME_COL_ID "idgame"
|
||||
#define DB_TABLE_GAME_COL_NAME "name"
|
||||
#define DB_TABLE_GAME_COL_STARTTIME "start_time"
|
||||
#define DB_TABLE_GAME_COL_ENDTIME "end_time"
|
||||
|
||||
#define DB_TABLE_GAMEPLAYER "game_has_player"
|
||||
#define DB_TABLE_GAMEPLAYER_COL_GAMEID "game_idgame"
|
||||
#define DB_TABLE_GAMEPLAYER_COL_PLAYERID "player_idplayer"
|
||||
#define DB_TABLE_GAMEPLAYER_COL_PLACE "place"
|
||||
|
||||
#define DB_TABLE_REP_AVATAR "reported_avatar"
|
||||
#define DB_TABLE_REP_AVATAR_COL_PLAYERID "idplayer"
|
||||
#define DB_TABLE_REP_AVATAR_COL_AVATARHASH "avatar_hash"
|
||||
#define DB_TABLE_REP_AVATAR_COL_AVATARTYPE "avatar_type"
|
||||
#define DB_TABLE_REP_AVATAR_COL_BY_PLAYERID "by_idplayer"
|
||||
#define DB_TABLE_REP_AVATAR_COL_TIMESTAMP "timestamp"
|
||||
|
||||
#define DB_TABLE_REP_GAME "reported_gamename"
|
||||
#define DB_TABLE_REP_GAME_COL_CREATOR "game_creator_idplayer"
|
||||
#define DB_TABLE_REP_GAME_COL_GAMEID "game_idgame"
|
||||
#define DB_TABLE_REP_GAME_COL_GAMENAME "game_name"
|
||||
#define DB_TABLE_REP_GAME_COL_BY_PLAYERID "by_idplayer"
|
||||
#define DB_TABLE_REP_GAME_COL_TIMESTAMP "timestamp"
|
||||
|
||||
#define DB_TABLE_AVATAR_BLACKLIST "avatar_blacklist"
|
||||
#define DB_TABLE_AVATAR_BLACKLIST_COL_ID "id"
|
||||
#define DB_TABLE_AVATAR_BLACKLIST_COL_AVATAR_HASH "avatar_hash"
|
||||
|
||||
#define DB_TABLE_ADMIN_PLAYER "admin_player"
|
||||
#define DB_TABLE_ADMIN_PLAYER_COL_PLAYERID "admin_idplayer"
|
||||
|
||||
#endif // DB_TABLE_DEFS_H
|
||||
@@ -0,0 +1,61 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2016 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include <dbofficial/dbidmanager.h>
|
||||
|
||||
|
||||
void
|
||||
DBIdManager::AddGameId(unsigned gameId, DB_id databaseId)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_gameIdMapMutex);
|
||||
m_gameIdMap[gameId] = databaseId;
|
||||
}
|
||||
|
||||
void
|
||||
DBIdManager::RemoveGameId(unsigned gameId)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_gameIdMapMutex);
|
||||
m_gameIdMap.erase(gameId);
|
||||
}
|
||||
|
||||
DB_id
|
||||
DBIdManager::GetGameDBId(unsigned gameId) const
|
||||
{
|
||||
DB_id retVal = DB_ID_INVALID;
|
||||
|
||||
boost::mutex::scoped_lock lock(m_gameIdMapMutex);
|
||||
DBMap::const_iterator pos = m_gameIdMap.find(gameId);
|
||||
if (pos != m_gameIdMap.end()) {
|
||||
retVal = pos->second;
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2016 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
/* Manager for database internal ids */
|
||||
|
||||
#ifndef _DBIDMANAGER_H_
|
||||
#define _DBIDMANAGER_H_
|
||||
|
||||
#include <db/dbdefs.h>
|
||||
#include <boost/thread.hpp>
|
||||
#include <map>
|
||||
|
||||
class DBIdManager
|
||||
{
|
||||
public:
|
||||
void AddGameId(unsigned gameId, DB_id databaseId);
|
||||
void RemoveGameId(unsigned gameId);
|
||||
|
||||
DB_id GetGameDBId(unsigned gameId) const;
|
||||
|
||||
protected:
|
||||
typedef std::map<unsigned, DB_id> DBMap;
|
||||
|
||||
private:
|
||||
DBMap m_gameIdMap;
|
||||
mutable boost::mutex m_gameIdMapMutex;
|
||||
};
|
||||
|
||||
#endif // _DBIDMANAGER_H_
|
||||
@@ -0,0 +1,36 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2016 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include <dbofficial/querycontext.h>
|
||||
|
||||
QueryContext::~QueryContext()
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2016 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
/* Interface for a query context */
|
||||
|
||||
#ifndef _QUERYCONTEXT_H_
|
||||
#define _QUERYCONTEXT_H_
|
||||
|
||||
class QueryContext
|
||||
{
|
||||
public:
|
||||
virtual ~QueryContext();
|
||||
|
||||
virtual unsigned GetLastGameDBId() const = 0;
|
||||
virtual void SetLastGameDBId(unsigned id) = 0;
|
||||
};
|
||||
|
||||
#endif // QUERYCONTEXT_H
|
||||
@@ -0,0 +1,48 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2016 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include <dbofficial/serverdbfactoryinternal.h>
|
||||
#include <dbofficial/serverdbthread.h>
|
||||
|
||||
|
||||
ServerDBFactoryInternal::ServerDBFactoryInternal()
|
||||
{
|
||||
}
|
||||
|
||||
ServerDBFactoryInternal::~ServerDBFactoryInternal()
|
||||
{
|
||||
}
|
||||
|
||||
boost::shared_ptr<ServerDBInterface>
|
||||
ServerDBFactoryInternal::CreateServerDBObject(ServerDBCallback &cb, boost::shared_ptr<boost::asio::io_service> ioService)
|
||||
{
|
||||
return boost::shared_ptr<ServerDBInterface>(new ServerDBThread(cb, ioService));
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2016 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
/* Server database factory for closed source db objects. */
|
||||
|
||||
#ifndef _SERVERDBFACTORYINTERNAL_H_
|
||||
#define _SERVERDBFACTORYINTERNAL_H_
|
||||
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <db/serverdbinterface.h>
|
||||
#include <db/serverdbcallback.h>
|
||||
|
||||
class ServerDBFactoryInternal
|
||||
{
|
||||
public:
|
||||
ServerDBFactoryInternal();
|
||||
virtual ~ServerDBFactoryInternal();
|
||||
|
||||
virtual boost::shared_ptr<ServerDBInterface> CreateServerDBObject(
|
||||
ServerDBCallback &cb, boost::shared_ptr<boost::asio::io_service> ioService);
|
||||
};
|
||||
|
||||
typedef ServerDBFactoryInternal DBFactory;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,557 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2016 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include <dbofficial/serverdbthread.h>
|
||||
#include <dbofficial/asyncdbauth.h>
|
||||
#include <dbofficial/asyncdblogin.h>
|
||||
#include <dbofficial/asyncdbavatarblacklist.h>
|
||||
#include <dbofficial/asyncdbcreategame.h>
|
||||
#include <dbofficial/asyncdbendgame.h>
|
||||
#include <dbofficial/asyncdbgameplace.h>
|
||||
#include <dbofficial/asyncdbupdatescore.h>
|
||||
#include <dbofficial/asyncdbreportavatar.h>
|
||||
#include <dbofficial/asyncdbreportgame.h>
|
||||
#include <dbofficial/asyncdbadminplayers.h>
|
||||
#include <dbofficial/asyncdbblockplayer.h>
|
||||
#include <dbofficial/compositeasyncdbquery.h>
|
||||
#include <dbofficial/db_table_defs.h>
|
||||
#include <ctime>
|
||||
#include <sstream>
|
||||
#include <mysql++.h>
|
||||
|
||||
#define QUERY_NICK_PREPARE "nick_template"
|
||||
#define QUERY_LOGIN_PREPARE "login_template"
|
||||
#define QUERY_AVATAR_BLACKLIST_PREPARE "avatar_blacklist_template"
|
||||
#define QUERY_CREATE_GAME_PREPARE "create_game_template"
|
||||
#define QUERY_END_GAME_PREPARE "end_game_template"
|
||||
#define QUERY_GAME_PLAYER_PREPARE "game_player_template"
|
||||
#define QUERY_UPDATE_SCORE_PREPARE "update_score_template"
|
||||
#define QUERY_REPORT_AVATAR_PREPARE "report_avatar_template"
|
||||
#define QUERY_REPORT_GAME_PREPARE "report_game_template"
|
||||
#define QUERY_ADMIN_PLAYER_PREPARE "admin_player_template"
|
||||
#define QUERY_BLOCK_PLAYER_PREPARE "block_player_template"
|
||||
|
||||
using namespace std;
|
||||
|
||||
struct DBConnectionData {
|
||||
DBConnectionData() : conn(false) {}
|
||||
string host;
|
||||
string user;
|
||||
string pwd;
|
||||
string database;
|
||||
string encryptionKey;
|
||||
mysqlpp::Connection conn;
|
||||
};
|
||||
|
||||
ServerDBThread::ServerDBThread(ServerDBCallback &cb, boost::shared_ptr<boost::asio::io_service> ioService)
|
||||
: m_ioService(ioService), m_semaphore(0), m_callback(cb), m_isConnected(false), m_permanentError(false), m_previouslyConnected(false)
|
||||
{
|
||||
m_connData.reset(new DBConnectionData);
|
||||
}
|
||||
|
||||
ServerDBThread::~ServerDBThread()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ServerDBThread::SignalTermination()
|
||||
{
|
||||
Thread::SignalTermination();
|
||||
m_semaphore.post();
|
||||
}
|
||||
|
||||
void
|
||||
ServerDBThread::Init(const string &host, const string &user, const string &pwd,
|
||||
const string &database, const string &encryptionKey)
|
||||
{
|
||||
m_connData->host = host;
|
||||
m_connData->user = user;
|
||||
m_connData->pwd = pwd;
|
||||
m_connData->database = database;
|
||||
m_connData->encryptionKey = encryptionKey;
|
||||
}
|
||||
|
||||
void
|
||||
ServerDBThread::Start()
|
||||
{
|
||||
Run();
|
||||
}
|
||||
|
||||
void
|
||||
ServerDBThread::Stop()
|
||||
{
|
||||
SignalTermination();
|
||||
this->Join(THREAD_WAIT_INFINITE);
|
||||
}
|
||||
|
||||
void
|
||||
ServerDBThread::AsyncPlayerLogin(unsigned requestId, const string &playerName)
|
||||
{
|
||||
if (IsConnected()) {
|
||||
list<string> params;
|
||||
params.push_back(m_connData->encryptionKey);
|
||||
params.push_back(playerName);
|
||||
boost::shared_ptr<AsyncDBQuery> asyncQuery(
|
||||
new AsyncDBAuth(
|
||||
requestId,
|
||||
QUERY_NICK_PREPARE,
|
||||
params));
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_asyncQueueMutex);
|
||||
m_asyncQueue.push(asyncQuery);
|
||||
}
|
||||
m_semaphore.post();
|
||||
} else {
|
||||
// If not connected to database, login fails.
|
||||
m_ioService->post(boost::bind(&ServerDBCallback::PlayerLoginFailed, &m_callback, requestId));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ServerDBThread::AsyncCheckAvatarBlacklist(unsigned requestId, const std::string &avatarHash)
|
||||
{
|
||||
if (IsConnected()) {
|
||||
list<string> params;
|
||||
params.push_back(avatarHash);
|
||||
boost::shared_ptr<AsyncDBQuery> asyncQuery(
|
||||
new AsyncDBAvatarBlacklist(
|
||||
requestId,
|
||||
QUERY_AVATAR_BLACKLIST_PREPARE,
|
||||
params));
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_asyncQueueMutex);
|
||||
m_asyncQueue.push(asyncQuery);
|
||||
}
|
||||
m_semaphore.post();
|
||||
} else {
|
||||
// If not connected to database, all avatars are blacklisted.
|
||||
m_ioService->post(boost::bind(&ServerDBCallback::AvatarIsBlacklisted, &m_callback, requestId));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ServerDBThread::PlayerPostLogin(DB_id playerId, const std::string &avatarHash, const std::string &avatarType)
|
||||
{
|
||||
list<string> params;
|
||||
params.push_back(mysqlpp::DateTime(time(NULL)));
|
||||
params.push_back(avatarHash);
|
||||
params.push_back(avatarType);
|
||||
ostringstream paramStream;
|
||||
paramStream << playerId;
|
||||
params.push_back(paramStream.str());
|
||||
boost::shared_ptr<AsyncDBQuery> asyncQuery(
|
||||
new AsyncDBLogin(
|
||||
playerId,
|
||||
QUERY_LOGIN_PREPARE,
|
||||
params));
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_asyncQueueMutex);
|
||||
m_asyncQueue.push(asyncQuery);
|
||||
}
|
||||
m_semaphore.post();
|
||||
}
|
||||
|
||||
void
|
||||
ServerDBThread::PlayerLogout(DB_id /*playerId*/)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ServerDBThread::AsyncCreateGame(unsigned requestId, const string &gameName)
|
||||
{
|
||||
list<string> params;
|
||||
params.push_back(gameName);
|
||||
params.push_back(mysqlpp::DateTime(time(NULL)));
|
||||
boost::shared_ptr<AsyncDBQuery> asyncQuery(
|
||||
new AsyncDBCreateGame(
|
||||
requestId,
|
||||
QUERY_CREATE_GAME_PREPARE,
|
||||
params));
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_asyncQueueMutex);
|
||||
m_asyncQueue.push(asyncQuery);
|
||||
}
|
||||
m_semaphore.post();
|
||||
}
|
||||
|
||||
void
|
||||
ServerDBThread::SetGamePlayerPlace(unsigned requestId, DB_id playerId, unsigned place)
|
||||
{
|
||||
// The game id param is added later (during init of the async op), because it may be unknown.
|
||||
list<string> params;
|
||||
ostringstream paramStream;
|
||||
paramStream << playerId;
|
||||
params.push_back(paramStream.str());
|
||||
paramStream.str("");
|
||||
paramStream << place;
|
||||
params.push_back(paramStream.str());
|
||||
boost::shared_ptr<AsyncDBQuery> asyncQuery(
|
||||
new AsyncDBGamePlace(
|
||||
requestId,
|
||||
QUERY_GAME_PLAYER_PREPARE,
|
||||
params));
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_asyncQueueMutex);
|
||||
m_asyncQueue.push(asyncQuery);
|
||||
}
|
||||
m_semaphore.post();
|
||||
}
|
||||
|
||||
void
|
||||
ServerDBThread::EndGame(unsigned requestId)
|
||||
{
|
||||
// Set the end time of the game.
|
||||
{
|
||||
list<string> params;
|
||||
params.push_back(mysqlpp::DateTime(time(NULL)));
|
||||
boost::shared_ptr<AsyncDBQuery> asyncQuery(
|
||||
new AsyncDBEndGame(
|
||||
requestId,
|
||||
QUERY_END_GAME_PREPARE,
|
||||
params));
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_asyncQueueMutex);
|
||||
m_asyncQueue.push(asyncQuery);
|
||||
}
|
||||
m_semaphore.post();
|
||||
}
|
||||
// Update the player scores.
|
||||
{
|
||||
list<string> params;
|
||||
boost::shared_ptr<AsyncDBQuery> asyncQuery(
|
||||
new AsyncDBUpdateScore(
|
||||
requestId,
|
||||
QUERY_UPDATE_SCORE_PREPARE,
|
||||
params));
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_asyncQueueMutex);
|
||||
m_asyncQueue.push(asyncQuery);
|
||||
}
|
||||
m_semaphore.post();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ServerDBThread::AsyncReportAvatar(unsigned requestId, unsigned replyId, DB_id reportedPlayerId, const std::string &avatarHash, const std::string &avatarType, DB_id *byPlayerId)
|
||||
{
|
||||
list<string> params;
|
||||
ostringstream paramStream;
|
||||
paramStream << reportedPlayerId;
|
||||
params.push_back(paramStream.str());
|
||||
params.push_back(avatarHash);
|
||||
params.push_back(avatarType);
|
||||
if (byPlayerId) {
|
||||
paramStream.str("");
|
||||
paramStream << *byPlayerId;
|
||||
params.push_back(paramStream.str());
|
||||
} else {
|
||||
params.push_back("NULL");
|
||||
}
|
||||
params.push_back(mysqlpp::DateTime(time(NULL)));
|
||||
|
||||
boost::shared_ptr<AsyncDBQuery> asyncQuery(
|
||||
new AsyncDBReportAvatar(
|
||||
requestId,
|
||||
replyId,
|
||||
QUERY_REPORT_AVATAR_PREPARE,
|
||||
params));
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_asyncQueueMutex);
|
||||
m_asyncQueue.push(asyncQuery);
|
||||
}
|
||||
m_semaphore.post();
|
||||
}
|
||||
|
||||
void
|
||||
ServerDBThread::AsyncReportGame(unsigned requestId, unsigned replyId, DB_id *creatorPlayerId, unsigned gameId, const std::string &gameName, DB_id *byPlayerId)
|
||||
{
|
||||
list<string> params;
|
||||
ostringstream paramStream;
|
||||
if (creatorPlayerId) {
|
||||
paramStream << *creatorPlayerId;
|
||||
params.push_back(paramStream.str());
|
||||
} else {
|
||||
params.push_back("NULL");
|
||||
}
|
||||
params.push_back(gameName);
|
||||
if (byPlayerId) {
|
||||
paramStream.str("");
|
||||
paramStream << *byPlayerId;
|
||||
params.push_back(paramStream.str());
|
||||
} else {
|
||||
params.push_back("NULL");
|
||||
}
|
||||
params.push_back(mysqlpp::DateTime(time(NULL)));
|
||||
|
||||
boost::shared_ptr<AsyncDBQuery> asyncQuery(
|
||||
new AsyncDBReportGame(
|
||||
requestId,
|
||||
replyId,
|
||||
gameId,
|
||||
QUERY_REPORT_GAME_PREPARE,
|
||||
params));
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_asyncQueueMutex);
|
||||
m_asyncQueue.push(asyncQuery);
|
||||
}
|
||||
|
||||
m_semaphore.post();
|
||||
}
|
||||
|
||||
void
|
||||
ServerDBThread::AsyncQueryAdminPlayers(unsigned requestId)
|
||||
{
|
||||
boost::shared_ptr<AsyncDBQuery> asyncQuery(
|
||||
new AsyncDBAdminPlayers(
|
||||
requestId,
|
||||
QUERY_ADMIN_PLAYER_PREPARE));
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_asyncQueueMutex);
|
||||
m_asyncQueue.push(asyncQuery);
|
||||
}
|
||||
|
||||
m_semaphore.post();
|
||||
}
|
||||
|
||||
void
|
||||
ServerDBThread::AsyncBlockPlayer(unsigned requestId, unsigned replyId, DB_id playerId, int valid, int active)
|
||||
{
|
||||
list<string> params;
|
||||
ostringstream paramStream;
|
||||
paramStream << valid;
|
||||
params.push_back(paramStream.str());
|
||||
paramStream.str("");
|
||||
paramStream << active;
|
||||
params.push_back(paramStream.str());
|
||||
paramStream.str("");
|
||||
paramStream << playerId;
|
||||
params.push_back(paramStream.str());
|
||||
boost::shared_ptr<AsyncDBQuery> asyncQuery(
|
||||
new AsyncDBBlockPlayer(
|
||||
requestId,
|
||||
replyId,
|
||||
QUERY_BLOCK_PLAYER_PREPARE,
|
||||
params));
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_asyncQueueMutex);
|
||||
m_asyncQueue.push(asyncQuery);
|
||||
}
|
||||
m_semaphore.post();
|
||||
}
|
||||
|
||||
bool
|
||||
ServerDBThread::IsConnected() const
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_isConnectedMutex);
|
||||
return m_isConnected;
|
||||
}
|
||||
|
||||
void
|
||||
ServerDBThread::Main()
|
||||
{
|
||||
while (!ShouldTerminate() && !HasPermanentError()) {
|
||||
if (HasDBConnection()) {
|
||||
SetConnected(true);
|
||||
m_semaphore.wait();
|
||||
HandleNextQuery();
|
||||
} else {
|
||||
SetConnected(false);
|
||||
EstablishDBConnection();
|
||||
}
|
||||
}
|
||||
m_connData->conn.disconnect();
|
||||
}
|
||||
|
||||
bool
|
||||
ServerDBThread::HasPermanentError() const
|
||||
{
|
||||
return m_permanentError;
|
||||
}
|
||||
|
||||
bool
|
||||
ServerDBThread::HasDBConnection() const
|
||||
{
|
||||
return m_connData->conn.connected();
|
||||
}
|
||||
|
||||
void
|
||||
ServerDBThread::EstablishDBConnection()
|
||||
{
|
||||
m_connData->conn.set_option(new mysqlpp::SetCharsetNameOption("utf8"));
|
||||
if (!m_connData->conn.connect(
|
||||
m_connData->database.c_str(), m_connData->host.c_str(), m_connData->user.c_str(), m_connData->pwd.c_str())) {
|
||||
m_ioService->post(boost::bind(&ServerDBCallback::ConnectFailed, &m_callback, m_connData->conn.error()));
|
||||
if (!m_previouslyConnected)
|
||||
m_permanentError = true;
|
||||
else
|
||||
Msleep(250);
|
||||
} else {
|
||||
mysqlpp::Query prepareNick = m_connData->conn.query();
|
||||
prepareNick
|
||||
<< "PREPARE " QUERY_NICK_PREPARE " FROM " << mysqlpp::quote
|
||||
<< "SELECT " DB_TABLE_PLAYER_COL_ID ", AES_DECRYPT(" DB_TABLE_PLAYER_COL_PASSWORD ", ?), " DB_TABLE_PLAYER_COL_VALID ", TRIM(" DB_TABLE_PLAYER_COL_COUNTRY "), " DB_TABLE_PLAYER_COL_LASTLOGIN ", " DB_TABLE_PLAYER_COL_ACTIVE " FROM " DB_TABLE_PLAYER " WHERE BINARY " DB_TABLE_PLAYER_COL_USERNAME " = ?";
|
||||
mysqlpp::Query prepareAvatarBlacklist = m_connData->conn.query();
|
||||
prepareAvatarBlacklist
|
||||
<< "PREPARE " QUERY_AVATAR_BLACKLIST_PREPARE " FROM " << mysqlpp::quote
|
||||
<< "SELECT " DB_TABLE_AVATAR_BLACKLIST_COL_ID " FROM " DB_TABLE_AVATAR_BLACKLIST " WHERE BINARY " DB_TABLE_AVATAR_BLACKLIST_COL_AVATAR_HASH " = ?";
|
||||
mysqlpp::Query prepareLogin = m_connData->conn.query();
|
||||
prepareLogin
|
||||
<< "PREPARE " QUERY_LOGIN_PREPARE " FROM " << mysqlpp::quote
|
||||
<< "UPDATE " DB_TABLE_PLAYER " SET " DB_TABLE_PLAYER_COL_LASTLOGIN " = ?, " DB_TABLE_PLAYER_COL_AVATARHASH " = ?, " DB_TABLE_PLAYER_COL_AVATARTYPE " = ? WHERE " DB_TABLE_PLAYER_COL_ID " = ?";
|
||||
mysqlpp::Query prepareCreateGame = m_connData->conn.query();
|
||||
prepareCreateGame
|
||||
<< "PREPARE " QUERY_CREATE_GAME_PREPARE " FROM " << mysqlpp::quote
|
||||
<< "INSERT INTO " DB_TABLE_GAME " (" DB_TABLE_GAME_COL_NAME ", " DB_TABLE_GAME_COL_STARTTIME ") VALUES (?, ?)";
|
||||
mysqlpp::Query prepareEndGame = m_connData->conn.query();
|
||||
prepareEndGame
|
||||
<< "PREPARE " QUERY_END_GAME_PREPARE " FROM " << mysqlpp::quote
|
||||
<< "UPDATE " DB_TABLE_GAME " SET "DB_TABLE_GAME_COL_ENDTIME " = ? WHERE " DB_TABLE_GAME_COL_ID " = ?";
|
||||
mysqlpp::Query prepareRelation = m_connData->conn.query();
|
||||
prepareRelation
|
||||
<< "PREPARE " QUERY_GAME_PLAYER_PREPARE " FROM " << mysqlpp::quote
|
||||
<< "INSERT INTO " DB_TABLE_GAMEPLAYER " (" DB_TABLE_GAMEPLAYER_COL_GAMEID ", " DB_TABLE_GAMEPLAYER_COL_PLAYERID ", " DB_TABLE_GAMEPLAYER_COL_PLACE ") VALUES (?, ?, ?)";
|
||||
mysqlpp::Query prepareScore = m_connData->conn.query();
|
||||
prepareScore
|
||||
<< "PREPARE " QUERY_UPDATE_SCORE_PREPARE " FROM " << mysqlpp::quote
|
||||
<< "CALL updatePointsForGame(?)";
|
||||
mysqlpp::Query prepareReportAvatar = m_connData->conn.query();
|
||||
prepareReportAvatar
|
||||
<< "PREPARE " QUERY_REPORT_AVATAR_PREPARE " FROM " << mysqlpp::quote
|
||||
<< "INSERT INTO " DB_TABLE_REP_AVATAR " (" DB_TABLE_REP_AVATAR_COL_PLAYERID ", " DB_TABLE_REP_AVATAR_COL_AVATARHASH ", " DB_TABLE_REP_AVATAR_COL_AVATARTYPE ", " DB_TABLE_REP_AVATAR_COL_BY_PLAYERID ", " DB_TABLE_REP_AVATAR_COL_TIMESTAMP ") VALUES (?, ?, ?, ?, ?)";
|
||||
mysqlpp::Query prepareReportGame = m_connData->conn.query();
|
||||
prepareReportGame
|
||||
<< "PREPARE " QUERY_REPORT_GAME_PREPARE " FROM " << mysqlpp::quote
|
||||
<< "INSERT INTO " DB_TABLE_REP_GAME " (" DB_TABLE_REP_GAME_COL_CREATOR ", " DB_TABLE_REP_GAME_COL_GAMENAME ", " DB_TABLE_REP_GAME_COL_BY_PLAYERID ", " DB_TABLE_REP_GAME_COL_TIMESTAMP ", " DB_TABLE_REP_GAME_COL_GAMEID ") VALUES (?, ?, ?, ?, ?)";
|
||||
mysqlpp::Query prepareAdminPlayer = m_connData->conn.query();
|
||||
prepareAdminPlayer
|
||||
<< "PREPARE " QUERY_ADMIN_PLAYER_PREPARE " FROM " << mysqlpp::quote
|
||||
<< "SELECT " DB_TABLE_ADMIN_PLAYER_COL_PLAYERID " FROM " DB_TABLE_ADMIN_PLAYER;
|
||||
mysqlpp::Query prepareBlockPlayer = m_connData->conn.query();
|
||||
prepareBlockPlayer
|
||||
<< "PREPARE " QUERY_BLOCK_PLAYER_PREPARE " FROM " << mysqlpp::quote
|
||||
<< "UPDATE " DB_TABLE_PLAYER " SET " DB_TABLE_PLAYER_COL_VALID " = ?, " DB_TABLE_PLAYER_COL_ACTIVE " = ? WHERE " DB_TABLE_PLAYER_COL_ID " = ?";
|
||||
|
||||
if (!prepareNick.exec() || !prepareAvatarBlacklist.exec() || !prepareLogin.exec() || !prepareCreateGame.exec()
|
||||
|| !prepareEndGame.exec() || !prepareRelation.exec() || !prepareScore.exec() || !prepareReportAvatar.exec()
|
||||
|| !prepareReportGame.exec() || !prepareAdminPlayer.exec() || !prepareBlockPlayer.exec()) {
|
||||
m_connData->conn.disconnect();
|
||||
m_ioService->post(boost::bind(&ServerDBCallback::ConnectFailed, &m_callback,
|
||||
string(prepareNick.error()) + prepareAvatarBlacklist.error() + prepareLogin.error() + prepareCreateGame.error()
|
||||
+ prepareEndGame.error() + prepareRelation.error() + prepareScore.error() + prepareReportAvatar.error()
|
||||
+ prepareReportGame.error() + prepareAdminPlayer.error() + prepareBlockPlayer.error()));
|
||||
m_permanentError = true;
|
||||
} else {
|
||||
m_ioService->post(boost::bind(&ServerDBCallback::ConnectSuccess, &m_callback));
|
||||
m_previouslyConnected = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ServerDBThread::HandleNextQuery()
|
||||
{
|
||||
boost::shared_ptr<AsyncDBQuery> nextQuery;
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_asyncQueueMutex);
|
||||
if (!m_asyncQueue.empty()) {
|
||||
nextQuery = m_asyncQueue.front();
|
||||
m_asyncQueue.pop();
|
||||
}
|
||||
}
|
||||
if (nextQuery) {
|
||||
do {
|
||||
nextQuery->Init(m_dbIdManager);
|
||||
mysqlpp::Query executeQuery = m_connData->conn.query();
|
||||
executeQuery << "EXECUTE " << nextQuery->GetPreparedName();
|
||||
|
||||
list<string> paramList;
|
||||
nextQuery->GetParams(paramList);
|
||||
if (!paramList.empty()) {
|
||||
executeQuery << " using ";
|
||||
mysqlpp::Query paramQuery = m_connData->conn.query();
|
||||
paramQuery << "SET ";
|
||||
unsigned counter = 1;
|
||||
list<string>::iterator i = paramList.begin();
|
||||
list<string>::iterator end = paramList.end();
|
||||
while (i != end) {
|
||||
if (counter > 1) {
|
||||
paramQuery << ", ";
|
||||
executeQuery << ", ";
|
||||
}
|
||||
paramQuery << "@param" << counter << " = ";
|
||||
if (*i == "NULL") {
|
||||
paramQuery << "NULL";
|
||||
} else {
|
||||
paramQuery << "_utf8" << mysqlpp::quote << *i;
|
||||
}
|
||||
executeQuery << "@param" << counter;
|
||||
++counter;
|
||||
++i;
|
||||
}
|
||||
if (!paramQuery.exec()) {
|
||||
m_connData->conn.disconnect();
|
||||
m_ioService->post(boost::bind(&ServerDBCallback::QueryError, &m_callback, paramQuery.error()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (nextQuery->RequiresResultSet()) {
|
||||
mysqlpp::StoreQueryResult res = executeQuery.store();
|
||||
if (res)
|
||||
nextQuery->HandleResult(executeQuery, m_dbIdManager, res, *m_ioService, m_callback);
|
||||
else
|
||||
nextQuery->HandleError(*m_ioService, m_callback);
|
||||
} else {
|
||||
if (executeQuery.exec())
|
||||
nextQuery->HandleNoResult(executeQuery, m_dbIdManager, *m_ioService, m_callback);
|
||||
else
|
||||
nextQuery->HandleError(*m_ioService, m_callback);
|
||||
}
|
||||
} while (nextQuery->Next()); // Consider composite queries.
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ServerDBThread::SetConnected(bool isConnected)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_isConnectedMutex);
|
||||
m_isConnected = isConnected;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2016 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
/* Server database thread. */
|
||||
|
||||
#ifndef _SERVERDBTHREAD_H_
|
||||
#define _SERVERDBTHREAD_H_
|
||||
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/interprocess/sync/interprocess_semaphore.hpp>
|
||||
#include <boost/enable_shared_from_this.hpp>
|
||||
#include <queue>
|
||||
#include <db/serverdbinterface.h>
|
||||
#include <db/serverdbcallback.h>
|
||||
#include <dbofficial/dbidmanager.h>
|
||||
#include <core/thread.h>
|
||||
|
||||
struct DBConnectionData;
|
||||
class AsyncDBQuery;
|
||||
|
||||
class ServerDBThread : public ServerDBInterface, public Thread, public boost::enable_shared_from_this<ServerDBThread>
|
||||
{
|
||||
public:
|
||||
ServerDBThread(ServerDBCallback &cb, boost::shared_ptr<boost::asio::io_service> ioService);
|
||||
virtual ~ServerDBThread();
|
||||
|
||||
virtual void SignalTermination();
|
||||
|
||||
virtual void Init(const std::string &host, const std::string &user, const std::string &pwd,
|
||||
const std::string &database, const std::string &encryptionKey);
|
||||
|
||||
virtual void Start();
|
||||
virtual void Stop();
|
||||
|
||||
virtual void AsyncPlayerLogin(unsigned requestId, const std::string &playerName);
|
||||
virtual void AsyncCheckAvatarBlacklist(unsigned requestId, const std::string &avatarHash);
|
||||
virtual void PlayerPostLogin(DB_id playerId, const std::string &avatarHash, const std::string &avatarType);
|
||||
virtual void PlayerLogout(DB_id playerId);
|
||||
|
||||
virtual void AsyncCreateGame(unsigned requestId, const std::string &gameName);
|
||||
virtual void SetGamePlayerPlace(unsigned requestId, DB_id playerId, unsigned place);
|
||||
virtual void EndGame(unsigned requestId);
|
||||
|
||||
virtual void AsyncReportAvatar(unsigned requestId, unsigned replyId, DB_id reportedPlayerId, const std::string &avatarHash, const std::string &avatarType, DB_id *byPlayerId);
|
||||
virtual void AsyncReportGame(unsigned requestId, unsigned replyId, DB_id *creatorPlayerId, unsigned gameId, const std::string &gameName, DB_id *byPlayerId);
|
||||
|
||||
virtual void AsyncQueryAdminPlayers(unsigned requestId);
|
||||
virtual void AsyncBlockPlayer(unsigned requestId, unsigned replyId, DB_id playerId, int valid, int active);
|
||||
|
||||
bool IsConnected() const;
|
||||
|
||||
protected:
|
||||
typedef std::queue<boost::shared_ptr<AsyncDBQuery> > AsyncDBQueryQueue;
|
||||
|
||||
// Main function of the thread.
|
||||
virtual void Main();
|
||||
|
||||
bool HasPermanentError() const;
|
||||
bool HasDBConnection() const;
|
||||
void EstablishDBConnection();
|
||||
void HandleNextQuery();
|
||||
|
||||
void SetConnected(bool isConnected);
|
||||
private:
|
||||
|
||||
boost::shared_ptr<boost::asio::io_service> m_ioService;
|
||||
boost::interprocess::interprocess_semaphore m_semaphore;
|
||||
ServerDBCallback &m_callback;
|
||||
boost::shared_ptr<DBConnectionData> m_connData;
|
||||
mutable boost::mutex m_asyncQueueMutex;
|
||||
AsyncDBQueryQueue m_asyncQueue;
|
||||
DBIdManager m_dbIdManager;
|
||||
|
||||
mutable boost::mutex m_isConnectedMutex;
|
||||
bool m_isConnected;
|
||||
bool m_permanentError;
|
||||
bool m_previouslyConnected;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,69 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2016 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include <dbofficial/singleasyncdbquery.h>
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
SingleAsyncDBQuery::SingleAsyncDBQuery(unsigned queryId, const string &preparedName, const list<string> ¶ms)
|
||||
: m_id(queryId), m_preparedName(preparedName), m_params(params)
|
||||
{
|
||||
}
|
||||
|
||||
SingleAsyncDBQuery::~SingleAsyncDBQuery()
|
||||
{
|
||||
}
|
||||
|
||||
unsigned
|
||||
SingleAsyncDBQuery::GetId() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
std::string
|
||||
SingleAsyncDBQuery::GetPreparedName() const
|
||||
{
|
||||
return m_preparedName;
|
||||
}
|
||||
|
||||
void
|
||||
SingleAsyncDBQuery::GetParams(std::list<std::string> ¶ms) const
|
||||
{
|
||||
params = m_params;
|
||||
}
|
||||
|
||||
void
|
||||
SingleAsyncDBQuery::SetParams(const std::list<std::string> ¶ms)
|
||||
{
|
||||
m_params = params;
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2016 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* *
|
||||
* Additional permission under GNU AGPL version 3 section 7 *
|
||||
* *
|
||||
* If you modify this program, or any covered work, by linking or *
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a *
|
||||
* modified version of that library), containing parts covered by the *
|
||||
* terms of the OpenSSL or SSLeay licenses, the authors of PokerTH *
|
||||
* (Felix Hammer, Florian Thauer, Lothar May) grant you additional *
|
||||
* permission to convey the resulting work. *
|
||||
* Corresponding Source for a non-source form of such a combination *
|
||||
* shall include the source code for the parts of OpenSSL used as well *
|
||||
* as that of the covered work. *
|
||||
*****************************************************************************/
|
||||
/* Single (non-composite) async database query. */
|
||||
|
||||
#ifndef _SINGLEASYNCDBQUERY_H_
|
||||
#define _SINGLEASYNCDBQUERY_H_
|
||||
|
||||
#include <dbofficial/asyncdbquery.h>
|
||||
|
||||
class SingleAsyncDBQuery : public AsyncDBQuery
|
||||
{
|
||||
public:
|
||||
SingleAsyncDBQuery(unsigned queryId, const std::string &preparedName, const std::list<std::string> ¶ms);
|
||||
virtual ~SingleAsyncDBQuery();
|
||||
|
||||
unsigned GetId() const;
|
||||
virtual std::string GetPreparedName() const;
|
||||
virtual void GetParams(std::list<std::string> ¶ms) const;
|
||||
virtual void SetParams(const std::list<std::string> ¶ms);
|
||||
|
||||
virtual bool Next()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
const unsigned m_id;
|
||||
std::string m_preparedName;
|
||||
std::list<std::string> m_params;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,126 @@
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Layouts 1.1
|
||||
import QtQuick.Controls 1.2
|
||||
import QtQuick.Controls.Styles 1.2
|
||||
import "../js/colors.js" as GlobalColors
|
||||
import "styles"
|
||||
|
||||
Rectangle {
|
||||
id: selector
|
||||
z:1000
|
||||
visible: false
|
||||
anchors.fill: parent
|
||||
color: "#88000000" //dark transparent background
|
||||
|
||||
property alias container: ctr.children
|
||||
property alias containerSelf: ctr
|
||||
|
||||
property string titleText: ""
|
||||
property string button1Text: ""
|
||||
property string button2Text: ""
|
||||
|
||||
signal button1Clicked
|
||||
signal button2Clicked
|
||||
|
||||
function show() {
|
||||
visible = true;
|
||||
}
|
||||
|
||||
function hide() {
|
||||
visible = false;
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
//set empty MouseArea to prevent the background to be clicked
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: selectorBox
|
||||
visible: true
|
||||
color: "white"
|
||||
height: AppStyle.selectorBoxHeight
|
||||
width: AppStyle.selectorBoxWidth
|
||||
anchors.centerIn: parent;
|
||||
radius: AppStyle.selectorBoxRadius
|
||||
|
||||
ColumnLayout {
|
||||
id: content
|
||||
anchors.fill: parent
|
||||
anchors.margins: AppStyle.selectorBoxContentMargins
|
||||
spacing: AppStyle.columnLayoutSpacing
|
||||
Text {
|
||||
id: title
|
||||
font.pixelSize: AppStyle.selectorBoxTitleFontSize
|
||||
font.bold: AppStyle.selectorBoxTitleFontBold
|
||||
text: titleText
|
||||
anchors.left: parent.left
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: AppStyle.selectorBoxTitleTopMargin
|
||||
Layout.preferredHeight: contentHeight
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: preCtr
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
Rectangle {
|
||||
anchors.fill: preCtr
|
||||
anchors.leftMargin: AppStyle.selectorBoxRealContentLeftMargin
|
||||
anchors.rightMargin: AppStyle.selectorBoxRealContentRightMargin
|
||||
id: ctr
|
||||
//The content goes here
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
width: parent.width
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
spacing: AppStyle.selectorBoxButtonRowLayoutSpacing
|
||||
Layout.preferredHeight: btn1.contentHeight
|
||||
|
||||
Text {
|
||||
id: btn1
|
||||
font.pixelSize: AppStyle.selectorBoxButtonFontSize
|
||||
font.bold: true
|
||||
width: button1Text == "" ? 0 : contentWidth
|
||||
text: button1Text
|
||||
|
||||
|
||||
MouseArea {
|
||||
id: mouse1
|
||||
anchors.fill: parent
|
||||
anchors.margins: AppStyle.selectorBoxButtonMouseAreaMargin
|
||||
onClicked: selector.button1Clicked()
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: mouse1.pressed ? "#55555555" : "#00ffffff"
|
||||
}
|
||||
}
|
||||
}
|
||||
Text {
|
||||
id: btn2
|
||||
font.pixelSize: AppStyle.selectorBoxButtonFontSize
|
||||
font.bold: true
|
||||
width: button2Text == "" ? 0 : contentWidth
|
||||
text: button2Text
|
||||
|
||||
MouseArea {
|
||||
id: mouse2
|
||||
anchors.fill: parent
|
||||
anchors.margins: AppStyle.selectorBoxButtonMouseAreaMargin
|
||||
onClicked: selector.button2Clicked()
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: mouse2.pressed ? "#55555555" : "#00ffffff"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Layouts 1.1
|
||||
import QtQuick.Controls 1.2
|
||||
import QtQuick.Controls.Styles 1.2
|
||||
import "../js/colors.js" as GlobalColors
|
||||
import "../js/tools.js" as GlobalTools
|
||||
import "styles/"
|
||||
|
||||
Item {
|
||||
id: root
|
||||
anchors.fill: parent
|
||||
|
||||
property string titleString: ""
|
||||
property string raiseOnHandsType: ""
|
||||
property string raiseOnHandsInterval: ""
|
||||
property string raiseOnMinutesInterval: ""
|
||||
property int raiseOnHandsMinimum: 1
|
||||
property int raiseOnHandsMaximum: 99
|
||||
property int raiseOnMinutesMinimum: 1
|
||||
property int raiseOnMinutesMaximum: 99
|
||||
property bool ready: false
|
||||
|
||||
signal accepted
|
||||
|
||||
function show(title, type, hands, minutes) {
|
||||
titleString = title
|
||||
raiseOnHandsType = type;
|
||||
raiseOnHandsInterval = hands;
|
||||
raiseOnMinutesInterval = minutes;
|
||||
|
||||
mySelector.show()
|
||||
|
||||
if(raiseOnHandsType == "1") {
|
||||
// textFieldHandsInterval.focus = true;
|
||||
radioBtnRaiseOnHands.checked = true;
|
||||
}
|
||||
else {
|
||||
// textFieldMinutesInterval.focus = true;
|
||||
radioBtnRaiseOnMinutes.checked = true;
|
||||
}
|
||||
}
|
||||
|
||||
function selected(handsType, handsInterval, minutesInterval) {
|
||||
raiseOnHandsType = handsType;
|
||||
raiseOnHandsInterval = handsInterval;
|
||||
raiseOnMinutesInterval = minutesInterval;
|
||||
|
||||
mySelector.hide()
|
||||
root.accepted()
|
||||
}
|
||||
|
||||
MyAbstractSelector {
|
||||
id: mySelector
|
||||
titleText: titleString
|
||||
button1Text: qsTr("CANCEL")
|
||||
onButton1Clicked: hide()
|
||||
button2Text: qsTr("OK")
|
||||
onButton2Clicked: {
|
||||
textFieldHandsInterval.correctValue();
|
||||
textFieldMinutesInterval.correctValue();
|
||||
//return values
|
||||
root.selected(radioBtnRaiseOnHands.checked ? "1": "0", textFieldHandsInterval.text, textFieldMinutesInterval.text);
|
||||
}
|
||||
|
||||
container: ColumnLayout {
|
||||
anchors.fill: parent
|
||||
RowLayout { //Hands interval section
|
||||
spacing: AppStyle.rowLayoutSpacing
|
||||
ExclusiveGroup { id: raiseTypeGroup }
|
||||
RadioButton {
|
||||
id: radioBtnRaiseOnHands
|
||||
exclusiveGroup: raiseTypeGroup
|
||||
style: MyRadioButtonStyle {
|
||||
myRadioBtn: radioBtnRaiseOnHands;
|
||||
labelString: "Every"
|
||||
}
|
||||
onClicked: textFieldHandsInterval.focus = true;
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: textFieldHandsInterval
|
||||
width: AppStyle.textFieldFontSize*2
|
||||
validator: IntValidator{bottom: raiseOnHandsMinimum; top: raiseOnHandsMaximum;}
|
||||
text: raiseOnHandsInterval
|
||||
function correctValue() {
|
||||
text = GlobalTools.correctTextFieldIntegerValue(root, text, raiseOnHandsMinimum);
|
||||
}
|
||||
onFocusChanged: { if(root.ready && !focus) correctValue(); }
|
||||
onEditingFinished: { if(root.ready) correctValue(); }
|
||||
|
||||
style: MyTextFieldStyle {
|
||||
myTextField: textFieldHandsInterval
|
||||
}
|
||||
}
|
||||
Text {
|
||||
id: onHandsString
|
||||
font.pixelSize: AppStyle.selectorBoxValueFontSize
|
||||
text: qsTr("hands")
|
||||
}
|
||||
}
|
||||
RowLayout { //Minutes interval section
|
||||
spacing: AppStyle.rowLayoutSpacing
|
||||
RadioButton {
|
||||
id: radioBtnRaiseOnMinutes
|
||||
exclusiveGroup: raiseTypeGroup
|
||||
style: MyRadioButtonStyle {
|
||||
myRadioBtn: radioBtnRaiseOnMinutes;
|
||||
labelString: "Every"
|
||||
}
|
||||
onClicked: textFieldMinutesInterval.focus = true;
|
||||
}
|
||||
TextField {
|
||||
id: textFieldMinutesInterval
|
||||
validator: IntValidator{bottom: raiseOnMinutesMinimum; top: raiseOnMinutesMaximum;}
|
||||
text: raiseOnMinutesInterval
|
||||
width: AppStyle.textFieldFontSize*2
|
||||
function correctValue() {
|
||||
text = GlobalTools.correctTextFieldIntegerValue(root, text, raiseOnMinutesMinimum);
|
||||
|
||||
}
|
||||
onFocusChanged: { if(root.ready && !focus) correctValue(); }
|
||||
onEditingFinished: { if(root.ready) correctValue(); }
|
||||
|
||||
style: MyTextFieldStyle {
|
||||
myTextField: textFieldMinutesInterval
|
||||
}
|
||||
}
|
||||
Text {
|
||||
id: onMinutesString
|
||||
font.pixelSize: AppStyle.selectorBoxValueFontSize
|
||||
text: qsTr("minutes")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Component.onCompleted: ready = true;
|
||||
}
|
||||
@@ -0,0 +1,285 @@
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Layouts 1.1
|
||||
import QtQuick.Controls 1.2
|
||||
import QtQuick.Controls.Styles 1.2
|
||||
import "../js/colors.js" as GlobalColors
|
||||
import "../js/tools.js" as GlobalTools
|
||||
import "styles"
|
||||
|
||||
Item {
|
||||
id: root
|
||||
anchors.fill: parent
|
||||
|
||||
property string titleString: ""
|
||||
property bool alwaysDoubleBlinds: false
|
||||
property var manualBlindsList
|
||||
property ListModel internalManualBlindsList: ListModel {}
|
||||
property bool afterMBAlwaysDoubleBlinds: false
|
||||
property bool afterMBAlwaysRaiseAbout: false
|
||||
property bool afterMBStayAtLastBlind: false
|
||||
property string afterMBAlwaysRaiseValue: "0"
|
||||
property var parentListViewModel
|
||||
property var parentListViewRoot
|
||||
property int addBlindTextFieldMinValue: 5
|
||||
property int addBlindTextFieldMaxValue: 1000000
|
||||
|
||||
property bool ready: false
|
||||
|
||||
signal accepted
|
||||
|
||||
function show(title, doubleBlinds, list, afterMBDouble, afterMBRaise, afterMBRaiseValue, afterMBStay, parentListModel, parentListRoot) {
|
||||
//initial the class values
|
||||
titleString = title
|
||||
alwaysDoubleBlinds = doubleBlinds;
|
||||
manualBlindsList = list;
|
||||
//to easily edit the array put it into an temporary listmodel
|
||||
internalManualBlindsList.clear();
|
||||
for (var i=0; i < list.length; i++) {
|
||||
internalManualBlindsList.append({"value": list[i]});
|
||||
}
|
||||
|
||||
afterMBAlwaysDoubleBlinds = afterMBDouble;
|
||||
afterMBAlwaysRaiseAbout = afterMBRaise;
|
||||
afterMBAlwaysRaiseValue = afterMBRaiseValue;
|
||||
afterMBStayAtLastBlind = afterMBStay;
|
||||
parentListViewModel = parentListModel;
|
||||
parentListViewRoot = parentListRoot;
|
||||
|
||||
//show the abstract selector with below defined specific content
|
||||
mySelector.show()
|
||||
|
||||
//set the config options to radiobuttons and textfields
|
||||
if(alwaysDoubleBlinds) {
|
||||
radioBtnBlindsRaiseModeAlwaysDouble.checked = true;
|
||||
radioBtnBlindsRaiseModeManualBlindsList.checked = false;
|
||||
}
|
||||
else {
|
||||
radioBtnBlindsRaiseModeManualBlindsList.checked = true;
|
||||
radioBtnBlindsRaiseModeAlwaysDouble.checked = false;
|
||||
}
|
||||
|
||||
//if we are in a createLocalGameView Dialog set min and max from corresponding values in the same list
|
||||
if(parentListViewRoot.myReadableId == "createLocalGameViewRoot") {
|
||||
//get current start blind as minimum and cash as maximum for the textfield
|
||||
var currentStartBlind = 0;
|
||||
var startCash = 0;
|
||||
for (var i=0; i < parentListViewModel.length; i++) {
|
||||
if(parentListViewModel[i].myId == "spinBox_FirstSmallBlind") {
|
||||
currentStartBlind = parentListViewModel[i].myValue;
|
||||
}
|
||||
else if (parentListViewModel[i].myId == "spinBox_StartCash") {
|
||||
startCash = parentListViewModel[i].myValue;
|
||||
|
||||
}
|
||||
}
|
||||
addBlindTextFieldMinValue = currentStartBlind;
|
||||
addBlindTextFieldMaxValue = startCash;
|
||||
|
||||
textFieldAddListBlind.text = addBlindTextFieldMinValue;
|
||||
}
|
||||
|
||||
if(afterMBAlwaysDoubleBlinds) {
|
||||
radioBtnAfterMBAlwaysDouble.checked = true
|
||||
radioBtnAfterMBAlwaysRaiseAbout.checked = false
|
||||
radioBtnAfterMBKeepLastBlind.checked = false
|
||||
}
|
||||
else if (afterMBAlwaysRaiseAbout) {
|
||||
radioBtnAfterMBAlwaysDouble.checked = false
|
||||
radioBtnAfterMBAlwaysRaiseAbout.checked = true
|
||||
radioBtnAfterMBKeepLastBlind.checked = false
|
||||
}
|
||||
else {
|
||||
radioBtnAfterMBAlwaysDouble.checked = false
|
||||
radioBtnAfterMBAlwaysRaiseAbout.checked = false
|
||||
radioBtnAfterMBKeepLastBlind.checked = true
|
||||
}
|
||||
|
||||
textFieldAfterMBAlwaysRaiseAboutValue.text = afterMBAlwaysRaiseValue
|
||||
}
|
||||
|
||||
|
||||
function selected(doubleBlinds, afterMBDouble, afterMBRaise, afterMBRaiseValue, afterMBStay) {
|
||||
alwaysDoubleBlinds = doubleBlinds;
|
||||
afterMBAlwaysDoubleBlinds = afterMBDouble;
|
||||
afterMBAlwaysRaiseAbout = afterMBRaise;
|
||||
afterMBAlwaysRaiseValue = afterMBRaiseValue;
|
||||
afterMBStayAtLastBlind = afterMBStay;
|
||||
|
||||
mySelector.hide()
|
||||
root.accepted()
|
||||
}
|
||||
|
||||
|
||||
MyAbstractSelector {
|
||||
id: mySelector
|
||||
titleText: titleString
|
||||
button1Text: qsTr("CANCEL")
|
||||
onButton1Clicked: hide()
|
||||
button2Text: qsTr("OK")
|
||||
onButton2Clicked: {
|
||||
textFieldAfterMBAlwaysRaiseAboutValue.correctValue();
|
||||
//copy editable internal listmodel to returnable list
|
||||
manualBlindsList = new Array(); //clear at first
|
||||
for (var i=0; i < internalManualBlindsList.count; i++) {
|
||||
manualBlindsList.push(internalManualBlindsList.get(i).value.toString());
|
||||
}
|
||||
//return values
|
||||
root.selected(radioBtnBlindsRaiseModeAlwaysDouble.checked, radioBtnAfterMBAlwaysDouble.checked, radioBtnAfterMBAlwaysRaiseAbout.checked, textFieldAfterMBAlwaysRaiseAboutValue.text, radioBtnAfterMBKeepLastBlind.checked);
|
||||
}
|
||||
|
||||
container: ScrollView {
|
||||
id: scrollView
|
||||
anchors.fill: parent
|
||||
ColumnLayout {
|
||||
width: parent.width
|
||||
spacing: AppStyle.columnLayoutSpacing
|
||||
ExclusiveGroup { id: blindsRaiseModeGroup }
|
||||
RadioButton {
|
||||
id: radioBtnBlindsRaiseModeAlwaysDouble
|
||||
exclusiveGroup: blindsRaiseModeGroup
|
||||
style: MyRadioButtonStyle {
|
||||
myRadioBtn: radioBtnBlindsRaiseModeAlwaysDouble
|
||||
labelString: qsTr("Always double blinds");
|
||||
}
|
||||
}
|
||||
RadioButton {
|
||||
id: radioBtnBlindsRaiseModeManualBlindsList
|
||||
exclusiveGroup: blindsRaiseModeGroup
|
||||
style: MyRadioButtonStyle {
|
||||
myRadioBtn: radioBtnBlindsRaiseModeManualBlindsList
|
||||
labelString: qsTr("Manual blinds list");
|
||||
}
|
||||
}
|
||||
RowLayout {
|
||||
id: listControlsRow
|
||||
width: parent.width
|
||||
spacing: AppStyle.rowLayoutSpacing
|
||||
TextField {
|
||||
id: textFieldAddListBlind
|
||||
anchors.left: parent.left
|
||||
//make space for the prefix
|
||||
anchors.leftMargin: AppStyle.spinBoxSelectorTextFieldPrefixExtraLeftMargin
|
||||
width: Math.round(listControlsRow.width * 0.5)
|
||||
style: MyTextFieldStyle {
|
||||
prefix: "$"
|
||||
myTextField: textFieldAddListBlind
|
||||
}
|
||||
function correctValue() {
|
||||
text = GlobalTools.correctTextFieldIntegerValue(root, text, addBlindTextFieldMinValue, addBlindTextFieldMaxValue);
|
||||
}
|
||||
onFocusChanged: { if(root.ready && !focus) correctValue(); }
|
||||
onEditingFinished: { if(root.ready) correctValue(); }
|
||||
}
|
||||
Text {
|
||||
id: btnAddNewListBlind
|
||||
font.pixelSize: AppStyle.selectorBoxButtonFontSize
|
||||
font.bold: true
|
||||
width: Math.round(listControlsRow.width * 0.5)
|
||||
text: qsTr("ADD BLIND")
|
||||
|
||||
MouseArea {
|
||||
id: mouseAddNewListBlind
|
||||
anchors.fill: parent
|
||||
anchors.margins: AppStyle.selectorBoxButtonMouseAreaMargin
|
||||
onClicked: {
|
||||
textFieldAddListBlind.correctValue();
|
||||
internalManualBlindsList.append({"value": textFieldAddListBlind.text.toString()})
|
||||
}
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: mouseAddNewListBlind.pressed ? "#55555555" : "#00ffffff"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Repeater {
|
||||
id: manualBlindListRepeater
|
||||
width: parent.width
|
||||
model: internalManualBlindsList
|
||||
delegate: RowLayout {
|
||||
spacing: AppStyle.rowLayoutSpacing
|
||||
Text {
|
||||
id: blindInList
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
font.pixelSize: AppStyle.radioButtonLabelFontSize
|
||||
text: "$"+model.value
|
||||
}
|
||||
Text {
|
||||
id: btnRemoveListBlind
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
property int modelIndex: model.index
|
||||
font.pixelSize: AppStyle.selectorBoxButtonFontSize
|
||||
font.bold: true
|
||||
width: Math.round(listControlsRow.width * 0.5)
|
||||
text: qsTr("REMOVE")
|
||||
|
||||
MouseArea {
|
||||
id: mouseRemoveListBlind
|
||||
anchors.fill: parent
|
||||
anchors.margins: AppStyle.selectorBoxButtonMouseAreaMargin
|
||||
onClicked: {
|
||||
internalManualBlindsList.remove(btnRemoveListBlind.modelIndex)
|
||||
}
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: mouseRemoveListBlind.pressed ? "#55555555" : "#00ffffff"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
font.pixelSize: AppStyle.selectorBoxValueFontSize
|
||||
text: qsTr("Afterwards:")
|
||||
}
|
||||
|
||||
ExclusiveGroup { id: afterMBModeGroup }
|
||||
RadioButton {
|
||||
id: radioBtnAfterMBAlwaysDouble
|
||||
exclusiveGroup: afterMBModeGroup
|
||||
style: MyRadioButtonStyle {
|
||||
myRadioBtn: radioBtnAfterMBAlwaysDouble
|
||||
labelString: qsTr("always double blinds");
|
||||
}
|
||||
}
|
||||
RadioButton {
|
||||
id: radioBtnAfterMBAlwaysRaiseAbout
|
||||
exclusiveGroup: afterMBModeGroup
|
||||
style: MyRadioButtonStyle {
|
||||
myRadioBtn: radioBtnAfterMBAlwaysRaiseAbout
|
||||
labelString: qsTr("always raise about");
|
||||
}
|
||||
}
|
||||
TextField {
|
||||
id: textFieldAfterMBAlwaysRaiseAboutValue
|
||||
//make space for the prefix
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: AppStyle.spinBoxSelectorTextFieldPrefixExtraLeftMargin
|
||||
width: radioBtnAfterMBAlwaysRaiseAbout.width
|
||||
style: MyTextFieldStyle {
|
||||
prefix: "$"
|
||||
myTextField: textFieldAfterMBAlwaysRaiseAboutValue
|
||||
}
|
||||
function correctValue() {
|
||||
text = GlobalTools.correctTextFieldIntegerValue(root, text, addBlindTextFieldMinValue, addBlindTextFieldMaxValue);
|
||||
}
|
||||
onFocusChanged: { if(root.ready && !focus) correctValue(); }
|
||||
onEditingFinished: { if(root.ready) correctValue(); }
|
||||
}
|
||||
|
||||
RadioButton {
|
||||
id: radioBtnAfterMBKeepLastBlind
|
||||
exclusiveGroup: afterMBModeGroup
|
||||
style: MyRadioButtonStyle {
|
||||
myRadioBtn: radioBtnAfterMBKeepLastBlind
|
||||
labelString: qsTr("keep last blind");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Component.onCompleted: {
|
||||
ready = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
import QtQuick 2.5
|
||||
import QtQuick.Controls 1.2
|
||||
import QtGraphicalEffects 1.0
|
||||
import QtQuick.Layouts 1.1
|
||||
import QtQuick.Controls.Styles 1.2
|
||||
import "../js/colors.js" as GlobalColors
|
||||
import "styles"
|
||||
|
||||
Item {
|
||||
id: root
|
||||
anchors.fill: parent
|
||||
|
||||
property ListModel internalValuesList: ListModel {}
|
||||
property string valueFromParent
|
||||
property string titleString
|
||||
property string returnValue
|
||||
property bool valueIsIndex
|
||||
|
||||
signal accepted
|
||||
|
||||
function show(title, list, vl, valueIndex) {
|
||||
titleString = title;
|
||||
valueFromParent = vl;
|
||||
returnValue = vl; // <-- initial the returnValue with the preselection to prevent a NULL return when pressing Cancel
|
||||
valueIsIndex = valueIndex;
|
||||
//fill the model
|
||||
internalValuesList.clear();
|
||||
for (var i=0; i < list.length; i++) {
|
||||
internalValuesList.append({"value": list[i]});
|
||||
}
|
||||
mySelector.show()
|
||||
}
|
||||
|
||||
function selected(newString, index) {
|
||||
if(valueIsIndex) {
|
||||
returnValue = index.toString();
|
||||
}
|
||||
else {
|
||||
returnValue = newString
|
||||
}
|
||||
mySelector.hide()
|
||||
root.accepted()
|
||||
}
|
||||
|
||||
MyAbstractSelector {
|
||||
id: mySelector
|
||||
titleText: titleString
|
||||
button1Text: qsTr("CANCEL")
|
||||
onButton1Clicked: hide()
|
||||
|
||||
container: ScrollView {
|
||||
id: scrollView
|
||||
anchors.fill:parent
|
||||
property int yOfCheckedRadioButton: 0
|
||||
ListView {
|
||||
id:listView
|
||||
anchors.fill: parent
|
||||
spacing: Math.round(appWindow.height*0.05)
|
||||
model: internalValuesList
|
||||
delegate: RadioButton {
|
||||
id: radioBtn
|
||||
//check of value is index type and do the corresponding checked? test
|
||||
checked: valueIsIndex ? (parseInt(valueFromParent) == index ? true : false) : (valueFromParent == value ? true : false)
|
||||
onClicked: {
|
||||
root.selected(value, index)
|
||||
}
|
||||
style: MyRadioButtonStyle {
|
||||
myRadioBtn: radioBtn
|
||||
labelString: value
|
||||
}
|
||||
Component.onCompleted: {
|
||||
//set the position of the checked RadioButton to scroll to it later onContentHeightChange
|
||||
if(checked) {
|
||||
var checkedRadioBtnPositionY = Math.round((radioBtn.height + listView.spacing) * index - radioBtn.height * 1.5)
|
||||
if( checkedRadioBtnPositionY > 0)
|
||||
scrollView.yOfCheckedRadioButton = checkedRadioBtnPositionY
|
||||
else
|
||||
scrollView.yOfCheckedRadioButton = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
onContentHeightChanged: {
|
||||
//scroll to the checked RadioButton
|
||||
contentY = scrollView.yOfCheckedRadioButton
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,399 @@
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Layouts 1.1
|
||||
import QtQuick.Window 2.0
|
||||
import QtQuick.Dialogs 1.2
|
||||
import QtQuick.Controls 1.2
|
||||
import QtQuick.Controls.Styles 1.2
|
||||
import "styles"
|
||||
|
||||
Item {
|
||||
id: root
|
||||
property int myListViewsHeight: 0
|
||||
property int myListViewsWidth: 0
|
||||
property var myListViewRoot
|
||||
property var myListViewModel
|
||||
|
||||
property var componentMap: {
|
||||
"ComboBox": myComboBox,
|
||||
"SpinBox": mySpinBox,
|
||||
"BlindsRaiseInterval": myBlindsRaiseInterval,
|
||||
"BlindsRaiseMode": myBlindsRaiseMode
|
||||
}
|
||||
width: myListViewsWidth
|
||||
|
||||
Loader {
|
||||
id: listViewFactoryLoader
|
||||
function setSourceComponent(comp) {
|
||||
sourceComponent = comp;
|
||||
}
|
||||
}
|
||||
|
||||
// ComboBox
|
||||
Component {
|
||||
id: myComboBox
|
||||
Rectangle {
|
||||
MyComboBoxSelector {
|
||||
id: myComboBoxSelector
|
||||
parent: myListViewRoot // this needs to be parent to display the selector over the whole ListView
|
||||
onAccepted: myListViewModel[myComboBoxContent.modelIndex].myValue = myComboBoxSelector.returnValue;
|
||||
}
|
||||
|
||||
id: myComboBoxContent
|
||||
property int modelIndex: model.index
|
||||
color: mouse.pressed ? "#11000000" : "white"
|
||||
width: root.width
|
||||
height: Math.round(textLayout.height*AppStyle.listViewDelegateHeightBasedOnContentFactor)
|
||||
ColumnLayout {
|
||||
id: textLayout
|
||||
spacing: AppStyle.listViewDelegateTitleAndValueSpacing
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
Text {
|
||||
id: comboBoxTitle
|
||||
anchors.left: parent.left
|
||||
anchors.margins: AppStyle.listViewDelegateTitleAndValueMargins
|
||||
color: "black"
|
||||
font.pixelSize: AppStyle.listViewDelegateTitleFontSize
|
||||
text: myTitle
|
||||
Layout.preferredHeight: contentHeight
|
||||
}
|
||||
Text {
|
||||
id: comboBoxValue
|
||||
anchors.left: parent.left
|
||||
anchors.margins: AppStyle.listViewDelegateTitleAndValueMargins
|
||||
color: "grey"
|
||||
font.pixelSize: myValue != "" ? AppStyle.listViewDelegateValueFontSize : 0
|
||||
//setup value from Index if necessary
|
||||
text: myValueIsIndex ? myValuesList[parseInt(myValue)].value : myValue
|
||||
Layout.preferredHeight: contentHeight
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.bottom: parent.bottom
|
||||
width: parent.width - AppStyle.listViewDelegateSeperatorLineIndent
|
||||
height: AppStyle.listViewDelegateSeperatorLineHeight
|
||||
color: "lightgrey"
|
||||
}
|
||||
MouseArea {
|
||||
id: mouse
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
//call selector overlay and set inital values
|
||||
myComboBoxSelector.show(myTitle, myValuesList, myValue, myValueIsIndex)
|
||||
}
|
||||
}
|
||||
Component.onCompleted: {
|
||||
//after building the delegate content set the final height to the root item
|
||||
root.height = Qt.binding(function() { return height })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Spinbox
|
||||
Component {
|
||||
id: mySpinBox
|
||||
Rectangle {
|
||||
MySpinBoxSelector {
|
||||
id: mySpinBoxSelector
|
||||
parent: myListViewRoot // this needs to be parent to display the selector over the whole ListView
|
||||
onAccepted: myListViewModel[mySpinBoxContent.modelIndex].myValue = mySpinBoxSelector.returnValue;
|
||||
}
|
||||
|
||||
id: mySpinBoxContent
|
||||
property int modelIndex: model.index
|
||||
color: mouse.pressed ? "#11000000" : "white"
|
||||
width: root.width
|
||||
height: Math.round(textLayout.height*AppStyle.listViewDelegateHeightBasedOnContentFactor)
|
||||
ColumnLayout {
|
||||
id: textLayout
|
||||
spacing: AppStyle.listViewDelegateTitleAndValueSpacing
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
Text {
|
||||
id: spinBoxTitle
|
||||
anchors.left: parent.left
|
||||
anchors.margins: AppStyle.listViewDelegateTitleAndValueMargins
|
||||
color: "black"
|
||||
font.pixelSize: AppStyle.listViewDelegateTitleFontSize
|
||||
text: myTitle
|
||||
Layout.preferredHeight: contentHeight
|
||||
}
|
||||
Text {
|
||||
id: spinBoxValue
|
||||
anchors.left: parent.left
|
||||
anchors.margins: AppStyle.listViewDelegateTitleAndValueMargins
|
||||
color: "grey"
|
||||
font.pixelSize: myValue != "" ? AppStyle.listViewDelegateValueFontSize : 0
|
||||
text: myPrefix+myValue
|
||||
Layout.preferredHeight: contentHeight
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.bottom: parent.bottom
|
||||
width: parent.width - AppStyle.listViewDelegateSeperatorLineIndent
|
||||
height: AppStyle.listViewDelegateSeperatorLineHeight
|
||||
color: "lightgrey"
|
||||
}
|
||||
MouseArea {
|
||||
id: mouse
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
//call selector overlay and set inital value
|
||||
mySpinBoxSelector.show(myId, myTitle, myMinValue, myMaxValue, myValue, myPrefix)
|
||||
}
|
||||
}
|
||||
Component.onCompleted: {
|
||||
//after building the delegate content set the final height to the root item
|
||||
root.height = Qt.binding(function() { return height })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// BlindsRaiseInterval
|
||||
Component {
|
||||
id: myBlindsRaiseInterval
|
||||
Rectangle {
|
||||
id: myBlindsRaiseIntervalContent
|
||||
MyBlindsRaiseIntervalSelector {
|
||||
id: myBlindsRaiseIntervalSelector
|
||||
parent: myListViewRoot // this needs to be parent to display the selector over the whole ListView
|
||||
onAccepted: {
|
||||
//call update the currentItem with selection from the comboBox selector
|
||||
myListViewModel[myBlindsRaiseIntervalContent.modelIndex].myRaiseOnHandsType = myBlindsRaiseIntervalSelector.raiseOnHandsType;
|
||||
myListViewModel[myBlindsRaiseIntervalContent.modelIndex].myRaiseOnHandsInterval = myBlindsRaiseIntervalSelector.raiseOnHandsInterval;
|
||||
myListViewModel[myBlindsRaiseIntervalContent.modelIndex].myRaiseOnMinutesInterval = myBlindsRaiseIntervalSelector.raiseOnMinutesInterval;
|
||||
//here we also need to trigger the textStringBuild from the model again
|
||||
blindsRaiseIntevalValue.buildTextString();
|
||||
}
|
||||
}
|
||||
|
||||
property int modelIndex: model.index
|
||||
color: mouse.pressed ? "#11000000" : "white"
|
||||
width: root.width
|
||||
height: Math.round(textLayout.height*AppStyle.listViewDelegateHeightBasedOnContentFactor)
|
||||
ColumnLayout {
|
||||
id: textLayout
|
||||
spacing: AppStyle.listViewDelegateTitleAndValueSpacing
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
Text {
|
||||
id: blindsRaiseIntevalTitle
|
||||
anchors.left: parent.left
|
||||
anchors.margins: AppStyle.listViewDelegateTitleAndValueMargins
|
||||
color: "black"
|
||||
font.pixelSize: AppStyle.listViewDelegateTitleFontSize
|
||||
text: myTitle
|
||||
Layout.preferredHeight: blindsRaiseIntevalTitle.contentHeight
|
||||
}
|
||||
Text {
|
||||
id: blindsRaiseIntevalValue
|
||||
anchors.left: parent.left
|
||||
anchors.margins: AppStyle.listViewDelegateTitleAndValueMargins
|
||||
color: "grey"
|
||||
font.pixelSize: AppStyle.listViewDelegateValueFontSize
|
||||
text: ""
|
||||
Layout.preferredHeight: blindsRaiseIntevalValue.contentHeight
|
||||
|
||||
function buildTextString() {
|
||||
if(myRaiseOnHandsType == "1") text = qsTr("Raise blinds every")+" "+myRaiseOnHandsInterval+" "+qsTr("hands");
|
||||
else text = qsTr("Raise blinds every")+" "+myRaiseOnMinutesInterval+" "+qsTr("minutes");
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
buildTextString();
|
||||
}
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.bottom: parent.bottom
|
||||
width: parent.width - AppStyle.listViewDelegateSeperatorLineIndent
|
||||
height: AppStyle.listViewDelegateSeperatorLineHeight
|
||||
color: "lightgrey"
|
||||
}
|
||||
MouseArea {
|
||||
id: mouse
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
//call selector overlay and set inital values
|
||||
myBlindsRaiseIntervalSelector.show(myTitle, myRaiseOnHandsType, myRaiseOnHandsInterval, myRaiseOnMinutesInterval, myListViewModel)
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
//after building the delegate content set the final height to the root item
|
||||
root.height = Qt.binding(function() { return height })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: myBlindsRaiseMode // Always double vs. Manual blinds List
|
||||
Rectangle {
|
||||
id: myBlindsRaiseModeContent
|
||||
MyBlindsRaiseModeSelector {
|
||||
id: myBlindsRaiseModeSelector
|
||||
parent: myListViewRoot // this needs to be parent to display the selector over the whole ListView
|
||||
onAccepted: {
|
||||
//call update the currentItem with selection from the comboBox selector
|
||||
myListViewModel[myBlindsRaiseModeContent.modelIndex].myAlwaysDoubleBlinds = (myBlindsRaiseModeSelector.alwaysDoubleBlinds ? "1" : "0");
|
||||
myListViewModel[myBlindsRaiseModeContent.modelIndex].myManualBlindsList = (myBlindsRaiseModeSelector.manualBlindsList);
|
||||
myListViewModel[myBlindsRaiseModeContent.modelIndex].myAfterMBAlwaysDoubleBlinds = (myBlindsRaiseModeSelector.afterMBAlwaysDoubleBlinds ? "1" : "0");
|
||||
myListViewModel[myBlindsRaiseModeContent.modelIndex].myAfterMBAlwaysRaiseAbout = (myBlindsRaiseModeSelector.afterMBAlwaysRaiseAbout ? "1" : "0");
|
||||
myListViewModel[myBlindsRaiseModeContent.modelIndex].myAfterMBAlwaysRaiseValue = (myBlindsRaiseModeSelector.afterMBAlwaysRaiseValue);
|
||||
myListViewModel[myBlindsRaiseModeContent.modelIndex].myAfterMBStayAtLastBlind = (myBlindsRaiseModeSelector.afterMBStayAtLastBlind ? "1" : "0");
|
||||
//here we also need to trigger the textStringBuild from the model again
|
||||
blindsRaiseModeValue.buildTextString();
|
||||
}
|
||||
}
|
||||
|
||||
property int modelIndex: model.index
|
||||
color: mouse.pressed ? "#11000000" : "white"
|
||||
width: root.width
|
||||
height: Math.round(textLayout.height*AppStyle.listViewDelegateHeightBasedOnContentFactor)
|
||||
ColumnLayout {
|
||||
id: textLayout
|
||||
spacing: AppStyle.listViewDelegateTitleAndValueSpacing
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
Text {
|
||||
id: blindsRaiseModeTitle
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: AppStyle.listViewDelegateTitleAndValueMargins
|
||||
color: "black"
|
||||
font.pixelSize: AppStyle.listViewDelegateTitleFontSize
|
||||
text: myTitle
|
||||
Layout.preferredHeight: contentHeight
|
||||
}
|
||||
Text {
|
||||
id: blindsRaiseModeValue
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: AppStyle.listViewDelegateTitleAndValueMargins
|
||||
color: "grey"
|
||||
font.pixelSize: AppStyle.listViewDelegateValueFontSize
|
||||
text: ""
|
||||
wrapMode: Text.WordWrap //maybe blinds list are too long
|
||||
Layout.preferredHeight: contentHeight
|
||||
|
||||
function buildTextString() {
|
||||
if(myAlwaysDoubleBlinds == "1") {
|
||||
text = qsTr("Always double blinds");
|
||||
}
|
||||
else {
|
||||
//build manual blindsList
|
||||
var tempString = ""
|
||||
for (var i=0; i < myManualBlindsList.length; i++) {
|
||||
tempString = tempString + "$" + myManualBlindsList[i] + ", ";
|
||||
}
|
||||
text = tempString.substring(0, tempString.length - 2);
|
||||
if(myAfterMBAlwaysDoubleBlinds == "1") {
|
||||
text = text + "\n" + qsTr("afterwards always double blinds");
|
||||
}
|
||||
else if (myAfterMBAlwaysRaiseAbout == "1") {
|
||||
text = text + "\n" + qsTr("afterwards always raise about $") + myAfterMBAlwaysRaiseValue;
|
||||
}
|
||||
else {
|
||||
text = text + "\n" + qsTr("afterwards keep last blind")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
buildTextString();
|
||||
}
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.bottom: parent.bottom
|
||||
width: parent.width - AppStyle.listViewDelegateSeperatorLineIndent
|
||||
height: AppStyle.listViewDelegateSeperatorLineHeight
|
||||
color: "lightgrey"
|
||||
}
|
||||
MouseArea {
|
||||
id: mouse
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
//call selector overlay and set inital values
|
||||
myBlindsRaiseModeSelector.show(myTitle, myAlwaysDoubleBlinds == "1", myManualBlindsList, myAfterMBAlwaysDoubleBlinds == "1", myAfterMBAlwaysRaiseAbout == "1", myAfterMBAlwaysRaiseValue, myAfterMBStayAtLastBlind == "1", myListViewModel, myListViewRoot);
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
//after building the delegate content set the final height to the root item
|
||||
root.height = Qt.binding(function() { return height })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
listViewFactoryLoader.setSourceComponent(componentMap[myType])
|
||||
}
|
||||
}
|
||||
|
||||
// Column {
|
||||
// anchors.verticalCenter: parent.verticalCenter
|
||||
// anchors.left: parent.left
|
||||
// anchors.leftMargin: 30
|
||||
// Text {
|
||||
// id: comboBoxTitle
|
||||
// color: "#0F0F0F"
|
||||
// font.pixelSize: parent.height*0.30
|
||||
// renderType: Text.NativeRendering
|
||||
// text: title
|
||||
// anchors.left: parent.left
|
||||
// }
|
||||
// Text {
|
||||
// id: comboBoxValue
|
||||
// color: "#0F0F0F"
|
||||
// font.pixelSize: parent.height*0.30
|
||||
// renderType: Text.NativeRendering
|
||||
// text: value
|
||||
// anchors.left: parent.left
|
||||
// }
|
||||
// }
|
||||
// Rectangle { //seperator
|
||||
// anchors.horizontalCenter: parent.horizontalCenter
|
||||
// anchors.bottom: parent.bottom
|
||||
// width: parent.width - 30
|
||||
// height: 1
|
||||
// color: "lightgrey"
|
||||
// }
|
||||
// MouseArea {
|
||||
// id: mouse
|
||||
// anchors.fill: parent
|
||||
// onClicked: root.clicked()
|
||||
|
||||
// }
|
||||
|
||||
|
||||
// Image {
|
||||
// anchors.right: parent.right
|
||||
// anchors.rightMargin: 20
|
||||
// anchors.verticalCenter: parent.verticalCenter
|
||||
// source: "../../images/navigation_next_item.png"
|
||||
// }
|
||||
|
||||
//// CheckBox {
|
||||
//// id: myCheckBox
|
||||
//// anchors.verticalCenter: parent.verticalCenter
|
||||
//// x: rect1.width-rect1.width*0.10
|
||||
//// style: CheckBoxStyle {
|
||||
//// indicator: Rectangle {
|
||||
//// color: "#FAFAFA"
|
||||
//// implicitWidth: rect1.width*0.04
|
||||
//// implicitHeight: rect1.width*0.04
|
||||
//// radius: 3
|
||||
//// border.color: control.activeFocus ? "darkblue" : "gray"
|
||||
//// border.width: 1
|
||||
//// Rectangle {
|
||||
//// visible: control.checked
|
||||
//// color: "#555"
|
||||
//// border.color: "#333"
|
||||
//// radius: 1
|
||||
//// anchors.margins: 4
|
||||
//// anchors.fill: parent
|
||||
//// }
|
||||
//// }
|
||||
//// }
|
||||
//// }
|
||||
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Layouts 1.1
|
||||
import QtQuick.Controls 1.2
|
||||
import QtQuick.Controls.Styles 1.2
|
||||
import "../js/colors.js" as GlobalColors
|
||||
import "../js/tools.js" as GlobalTools
|
||||
import "styles/"
|
||||
|
||||
Item {
|
||||
id: root
|
||||
anchors.fill: parent
|
||||
|
||||
property string titleString: ""
|
||||
property string prefix: ""
|
||||
property string returnValue: ""
|
||||
property string myIdString: ""
|
||||
property int minValue: 0
|
||||
property int maxValue: 0
|
||||
property int initialTextFieldValue: 0
|
||||
property int initialSliderValue: 0
|
||||
property bool ready: false
|
||||
|
||||
signal accepted
|
||||
|
||||
function show(myId, myTitle, myMinValue, myMaxValue, myValue, myPrefix) {
|
||||
myIdString = myId;
|
||||
titleString = myTitle;
|
||||
minValue = myMinValue;
|
||||
maxValue = myMaxValue;
|
||||
returnValue = myValue;
|
||||
textField.text = myValue;
|
||||
prefix = myPrefix;
|
||||
|
||||
mySelector.show()
|
||||
// textField.focus = true;
|
||||
}
|
||||
|
||||
function selected(newSelection) {
|
||||
returnValue = newSelection;
|
||||
mySelector.hide()
|
||||
root.accepted()
|
||||
}
|
||||
|
||||
MyAbstractSelector {
|
||||
id: mySelector
|
||||
titleText: titleString
|
||||
button1Text: qsTr("CANCEL")
|
||||
onButton1Clicked: hide()
|
||||
button2Text: qsTr("OK")
|
||||
onButton2Clicked: {
|
||||
textField.correctValue();
|
||||
root.selected(textField.text);
|
||||
}
|
||||
|
||||
container: ColumnLayout {
|
||||
anchors.fill: parent
|
||||
TextField {
|
||||
id: textField
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
//make space for the prefix
|
||||
anchors.leftMargin: AppStyle.spinBoxSelectorTextFieldPrefixExtraLeftMargin
|
||||
validator: IntValidator{bottom: minValue; top: maxValue;}
|
||||
|
||||
function correctValue() {
|
||||
text = GlobalTools.correctTextFieldIntegerValue(root, text, minValue);
|
||||
}
|
||||
|
||||
onFocusChanged: { if(root.ready && !focus) correctValue(); }
|
||||
onEditingFinished: { if(root.ready) correctValue(); }
|
||||
|
||||
style: MyTextFieldStyle {
|
||||
prefix: root.prefix
|
||||
myTextField: textField
|
||||
}
|
||||
}
|
||||
Slider {
|
||||
id: slider
|
||||
width: parent.width
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
maximumValue: maxValue
|
||||
minimumValue: minValue
|
||||
//don't initialize the slider value to avoid the stepSize kills the preselection Value
|
||||
//because of the binding to the TextField value
|
||||
stepSize: minimumValue * 10
|
||||
on__HandlePosChanged: {
|
||||
if(root.ready) { //wait until the whole component is ready, otherwise setting min and max changes text field value
|
||||
if (slider.value > minimumValue && slider.value < maximumValue)
|
||||
textField.text = slider.value - minimumValue
|
||||
else
|
||||
textField.text = slider.value
|
||||
}
|
||||
}
|
||||
style: SliderStyle {
|
||||
handle: Rectangle {
|
||||
width: AppStyle.sliderHandleWidth
|
||||
height: width
|
||||
radius: width
|
||||
antialiasing: true
|
||||
color: Qt.lighter(GlobalColors.accentColor, 1.2)
|
||||
}
|
||||
groove: Item {
|
||||
implicitHeight: AppStyle.sliderGrooveHeight
|
||||
implicitWidth: slider.width
|
||||
Rectangle {
|
||||
height: AppStyle.sliderGrooveRectHeight
|
||||
width: slider.width
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: "#666"
|
||||
Rectangle {
|
||||
antialiasing: true
|
||||
radius: 1
|
||||
color: GlobalColors.accentColor
|
||||
height: parent.height
|
||||
width: parent.width * control.value / control.maximumValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Component.onCompleted: ready = true
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
pragma Singleton
|
||||
import QtQuick 2.4
|
||||
import QtQuick.Window 2.0
|
||||
|
||||
QtObject {
|
||||
id: myAppStyle
|
||||
|
||||
property int appHeight: 0
|
||||
property int appWidth: 0
|
||||
|
||||
property int fontSizeH1: Math.round(appHeight*0.10)
|
||||
property int fontSizeH2: Math.round(appHeight*0.09)
|
||||
property int fontSizeH3: Math.round(appHeight*0.08)
|
||||
property int fontSizeH4: Math.round(appHeight*0.07)
|
||||
property int fontSizeH5: Math.round(appHeight*0.06)
|
||||
property int fontSizeH6: Math.round(appHeight*0.05)
|
||||
|
||||
property int radioButtonLabelFontSize: fontSizeH5
|
||||
property int textFieldFontSize: fontSizeH3
|
||||
|
||||
property int rowLayoutSpacing: Math.round(appHeight*0.06)
|
||||
property int columnLayoutSpacing: Math.round(appHeight*0.02)
|
||||
|
||||
//Selector Box (white on darken background)
|
||||
property int selectorBoxHeight: Math.round(appHeight*0.8)
|
||||
property int selectorBoxWidth: Math.round(appWidth*0.6)
|
||||
property int selectorBoxRadius: Math.round(appWidth*0.01)
|
||||
property int selectorBoxTitleFontSize: fontSizeH4
|
||||
property bool selectorBoxTitleFontBold: false
|
||||
property int selectorBoxTitleTopMargin: -Math.round(appHeight*0.02)
|
||||
property int selectorBoxValueFontSize: fontSizeH5
|
||||
property int selectorBoxButtonFontSize: fontSizeH5
|
||||
property int selectorBoxButtonMouseAreaMargin: -Math.round(appHeight*0.02)
|
||||
property int selectorBoxButtonRowLayoutSpacing: Math.round(appHeight*0.10)
|
||||
property bool selectorBoxButtonFontBold: false
|
||||
property int selectorBoxContentMargins: Math.round(appHeight*0.05)
|
||||
property int selectorBoxRealContentLeftMargin: Math.round(appHeight*0.05)
|
||||
property int selectorBoxRealContentRightMargin: Math.round(appHeight*0.05)
|
||||
|
||||
//SpinBoxSelector
|
||||
property int spinBoxSelectorTextFieldPrefixExtraLeftMargin: Math.round(appHeight*0.03)
|
||||
|
||||
//SliderStyle
|
||||
property int sliderHandleWidth: Math.round(appHeight*0.10)
|
||||
property int sliderGrooveHeight: Math.round(appHeight*0.033)
|
||||
property int sliderGrooveRectHeight: Math.round(appHeight*0.025)
|
||||
|
||||
//ListViewDelegate
|
||||
property real listViewDelegateHeightBasedOnContentFactor: 1.5
|
||||
property int listViewDelegateTitleAndValueMargins: 30
|
||||
property int listViewDelegateTitleAndValueSpacing: -3
|
||||
property int listViewDelegateTitleFontSize: fontSizeH5
|
||||
property int listViewDelegateValueFontSize: fontSizeH6
|
||||
property int listViewDelegateSeperatorLineIndent: 30
|
||||
property int listViewDelegateSeperatorLineHeight: 1
|
||||
|
||||
Component.onCompleted: {
|
||||
console.log("pixelDensity: "+Screen.pixelDensity);
|
||||
console.log("logicalPixelDensity: " +Screen.logicalPixelDensity);
|
||||
console.log("devicePixelRatio: " +Screen.devicePixelRatio);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
import QtQuick 2.4
|
||||
import QtQuick.Controls.Styles 1.2
|
||||
import "../../js/colors.js" as GlobalColors
|
||||
import "."
|
||||
|
||||
RadioButtonStyle {
|
||||
property var myRadioBtn
|
||||
property string labelString: ""
|
||||
indicator: Rectangle {
|
||||
implicitWidth: Math.round(appWindow.height*0.05)
|
||||
implicitHeight: Math.round(appWindow.height*0.05)
|
||||
radius: Math.round(appWindow.height*0.03)
|
||||
border.color: myRadioBtn.checked ? GlobalColors.accentColor : "grey"
|
||||
border.width: Math.round(appWindow.height*0.005)
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
visible: control.checked
|
||||
color: myRadioBtn.checked ? GlobalColors.accentColor : "grey"
|
||||
radius: Math.round(appWindow.height*0.03)
|
||||
anchors.margins: Math.round(appWindow.height*0.01)
|
||||
}
|
||||
}
|
||||
label: Text {
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 10
|
||||
font.pixelSize: AppStyle.radioButtonLabelFontSize
|
||||
text: labelString
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: myRadioBtn.clicked()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
import QtQuick 2.4
|
||||
import QtQuick.Controls 1.2
|
||||
import QtQuick.Controls.Styles 1.2
|
||||
import "../../js/colors.js" as GlobalColors
|
||||
import "."
|
||||
|
||||
TextFieldStyle {
|
||||
property string prefix: ""
|
||||
property int prefixIndent: prefix != "" ? AppStyle.textFieldFontSize*0.33 : 0
|
||||
property var myTextField
|
||||
|
||||
textColor: "black"
|
||||
font.pixelSize: AppStyle.textFieldFontSize
|
||||
background: Item { //bottom line with colored focus indicator
|
||||
implicitHeight: AppStyle.textFieldFontSize + Math.round(AppStyle.textFieldFontSize*0.25)
|
||||
implicitWidth: myTextField.width
|
||||
Text { //prefix
|
||||
visible: prefix != "" ? true : false
|
||||
color: "black"
|
||||
font.pixelSize: AppStyle.textFieldFontSize
|
||||
text: prefix
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: -prefixIndent
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin: Math.round(AppStyle.appHeight*0.008)
|
||||
}
|
||||
Rectangle {
|
||||
color: GlobalColors.accentColor
|
||||
opacity: myTextField.activeFocus ? 0.8 : 0
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: - prefixIndent
|
||||
width: myTextField.width + prefixIndent
|
||||
height: Math.round(AppStyle.appHeight*0.005)
|
||||
}
|
||||
Rectangle {
|
||||
color: "black"
|
||||
opacity: myTextField.activeFocus ? 0.6 : 0.4
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin: Math.round(AppStyle.appHeight*0.005)
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: - prefixIndent
|
||||
width: myTextField.width + prefixIndent
|
||||
height: Math.round(AppStyle.appHeight*0.005)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
singleton AppStyle AppStyle.qml
|
||||
@@ -0,0 +1,156 @@
|
||||
#include "createlocalgameviewimpl.h"
|
||||
#include "startviewimpl.h"
|
||||
#include "configfile.h"
|
||||
#include "mylistviewitemdata.h"
|
||||
#include "gamedata.h"
|
||||
#include <QtQml>
|
||||
|
||||
CreateLocalGameViewImpl::CreateLocalGameViewImpl(QObject *parent, QQmlApplicationEngine *e, boost::shared_ptr<ConfigFile> c, StartViewImpl *s )
|
||||
: QObject(parent) ,myQmlEngine(e), myConfig(c), myStartView(s)
|
||||
{
|
||||
//Build the listView data structure
|
||||
MyListViewItemData *item = NULL;
|
||||
|
||||
//ComboBox number of players
|
||||
item = new MyListViewItemData;
|
||||
item->setMyId("comboBox_NumberOfPlayers");
|
||||
item->setMyTitle(tr("Number of players"));
|
||||
item->setMyType("ComboBox");
|
||||
const int n = 9;
|
||||
for (int i = 10; i > (10-n); --i) item->appendToMyValuesList(QString::number(i));
|
||||
item->setMyValueIsIndex(false);
|
||||
myListData.append(item);
|
||||
|
||||
//SpinBox start cash-
|
||||
item = new MyListViewItemData;
|
||||
item->setMyId("spinBox_StartCash");
|
||||
item->setMyTitle(tr("Start cash"));
|
||||
item->setMyType("SpinBox");
|
||||
item->setMyMaxValue("1000000");
|
||||
item->setMyMinValue("1000");
|
||||
item->setMyPrefix("$");
|
||||
myListData.append(item);
|
||||
|
||||
//SpinBox start blind
|
||||
item = new MyListViewItemData;
|
||||
item->setMyId("spinBox_FirstSmallBlind");
|
||||
item->setMyTitle(tr("First small blind"));
|
||||
item->setMyType("SpinBox");
|
||||
item->setMyMaxValue("20000");
|
||||
item->setMyMinValue("5");
|
||||
item->setMyPrefix("$");
|
||||
myListData.append(item);
|
||||
|
||||
//Blinds raise interval selector
|
||||
item = new MyListViewItemData;
|
||||
item->setMyId("selector_BlindsRaiseInterval");
|
||||
item->setMyTitle(tr("Blinds raise interval"));
|
||||
item->setMyType("BlindsRaiseInterval");
|
||||
myListData.append(item);
|
||||
|
||||
//Blinds raise mode selector
|
||||
item = new MyListViewItemData;
|
||||
item->setMyId("selector_BlindsRaiseMode");
|
||||
item->setMyTitle(tr("Blinds raise mode"));
|
||||
item->setMyType("BlindsRaiseMode");
|
||||
myListData.append(item);
|
||||
|
||||
//ComboBox game speed
|
||||
item = new MyListViewItemData;
|
||||
item->setMyId("comboBox_GameSpeed");
|
||||
item->setMyTitle(tr("Game speed"));
|
||||
item->setMyType("ComboBox");
|
||||
const int m = 11;
|
||||
for (int i = 11; i > (11-m); --i) item->appendToMyValuesList(QString::number(i));
|
||||
item->setMyValueIsIndex(false);
|
||||
myListData.append(item);
|
||||
|
||||
myQmlEngine->rootContext()->setContextProperty("CreateLocalGameViewData", QVariant::fromValue(myListData));
|
||||
}
|
||||
|
||||
CreateLocalGameViewImpl::~CreateLocalGameViewImpl()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
MyListViewItemData* CreateLocalGameViewImpl::listItem(QString id)
|
||||
{
|
||||
for (int i = 0; i < myListData.size(); ++i) {
|
||||
if (static_cast<MyListViewItemData*>(myListData.at(i))->myId() == id)
|
||||
return static_cast<MyListViewItemData*>(myListData.at(i));
|
||||
}
|
||||
qDebug("ERROR: listItem in createLocalGameViewImpl could not be found");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void CreateLocalGameViewImpl::readConfigValues()
|
||||
{
|
||||
listItem("comboBox_NumberOfPlayers")->setMyValue(QString::number(myConfig->readConfigInt("NumberOfPlayers")));
|
||||
listItem("spinBox_StartCash")->setMyValue(QString::number(myConfig->readConfigInt("StartCash")));
|
||||
listItem("spinBox_FirstSmallBlind")->setMyValue(QString::number(myConfig->readConfigInt("FirstSmallBlind")));
|
||||
listItem("selector_BlindsRaiseInterval")->setMyRaiseOnHandsType(QString::number(myConfig->readConfigInt("RaiseBlindsAtHands")));
|
||||
listItem("selector_BlindsRaiseInterval")->setMyRaiseOnHandsInterval(QString::number(myConfig->readConfigInt("RaiseSmallBlindEveryHands")));
|
||||
listItem("selector_BlindsRaiseInterval")->setMyRaiseOnMinutesInterval(QString::number(myConfig->readConfigInt("RaiseSmallBlindEveryMinutes")));
|
||||
listItem("selector_BlindsRaiseMode")->setMyAlwaysDoubleBlinds(QString::number(myConfig->readConfigInt("AlwaysDoubleBlinds")));
|
||||
|
||||
std::list<int> myList = myConfig->readConfigIntList("ManualBlindsList");
|
||||
std::list<int>::iterator it1;
|
||||
listItem("selector_BlindsRaiseMode")->clearMyManualBlindsList();
|
||||
for(it1= myList.begin(); it1 != myList.end(); ++it1) {
|
||||
listItem("selector_BlindsRaiseMode")->appendToMyManualBlindsList(QString::number(*it1));
|
||||
}
|
||||
|
||||
listItem("selector_BlindsRaiseMode")->setMyAfterMBAlwaysDoubleBlinds(QString::number(myConfig->readConfigInt("AfterMBAlwaysDoubleBlinds")));
|
||||
listItem("selector_BlindsRaiseMode")->setMyAfterMBAlwaysRaiseAbout(QString::number(myConfig->readConfigInt("AfterMBAlwaysRaiseAbout")));
|
||||
listItem("selector_BlindsRaiseMode")->setMyAfterMBAlwaysRaiseValue(QString::number(myConfig->readConfigInt("AfterMBAlwaysRaiseValue")));
|
||||
listItem("selector_BlindsRaiseMode")->setMyAfterMBStayAtLastBlind(QString::number(myConfig->readConfigInt("AfterMBStayAtLastBlind")));
|
||||
listItem("comboBox_GameSpeed")->setMyValue(QString::number(myConfig->readConfigInt("GameSpeed")));
|
||||
}
|
||||
|
||||
void CreateLocalGameViewImpl::startGame()
|
||||
{
|
||||
qDebug() << "Start Game from CreateLocalGameViewImpl:";
|
||||
qDebug() << "Number of players: " << listItem("comboBox_NumberOfPlayers")->myValue();
|
||||
|
||||
GameData gameData;
|
||||
gameData.maxNumberOfPlayers = listItem("comboBox_NumberOfPlayers")->myValue().toInt();
|
||||
gameData.startMoney = listItem("spinBox_StartCash")->myValue().toInt();
|
||||
gameData.firstSmallBlind = listItem("spinBox_FirstSmallBlind")->myValue().toInt();
|
||||
if(listItem("selector_BlindsRaiseInterval")->myRaiseOnHandsType() == "1") {
|
||||
gameData.raiseIntervalMode = RAISE_ON_HANDNUMBER;
|
||||
gameData.raiseSmallBlindEveryHandsValue = listItem("selector_BlindsRaiseInterval")->myRaiseOnHandsInterval().toInt();
|
||||
} else {
|
||||
gameData.raiseIntervalMode = RAISE_ON_MINUTES;
|
||||
gameData.raiseSmallBlindEveryMinutesValue = listItem("selector_BlindsRaiseInterval")->myRaiseOnMinutesInterval().toInt();
|
||||
}
|
||||
|
||||
if(listItem("selector_BlindsRaiseMode")->myAlwaysDoubleBlinds() == "1") {
|
||||
gameData.raiseMode = DOUBLE_BLINDS;
|
||||
} else {
|
||||
gameData.raiseMode = MANUAL_BLINDS_ORDER;
|
||||
std::list<int> tempBlindList;
|
||||
int i;
|
||||
bool ok = true;
|
||||
for(i = 0; i < listItem("selector_BlindsRaiseMode")->myManualBlindsList().count(); i++) {
|
||||
tempBlindList.push_back(listItem("selector_BlindsRaiseMode")->myManualBlindsList().at(i).toInt());
|
||||
}
|
||||
gameData.manualBlindsList = tempBlindList;
|
||||
|
||||
if(listItem("selector_BlindsRaiseMode")->myAfterMBAlwaysDoubleBlinds() == "1") {
|
||||
gameData.afterManualBlindsMode = AFTERMB_DOUBLE_BLINDS;
|
||||
} else {
|
||||
if(listItem("selector_BlindsRaiseMode")->myAfterMBAlwaysRaiseAbout() == "1") {
|
||||
gameData.afterManualBlindsMode = AFTERMB_RAISE_ABOUT;
|
||||
gameData.afterMBAlwaysRaiseValue = listItem("selector_BlindsRaiseMode")->myAfterMBAlwaysRaiseValue().toInt();
|
||||
} else {
|
||||
gameData.afterManualBlindsMode = AFTERMB_STAY_AT_LAST_BLIND;
|
||||
}
|
||||
}
|
||||
}
|
||||
gameData.guiSpeed = listItem("comboBox_GameSpeed")->myValue().toInt();
|
||||
gameData.delayBetweenHandsSec = 7;
|
||||
gameData.playerActionTimeoutSec = 20;
|
||||
|
||||
myStartView->startLocalGame(gameData);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
#ifndef CREATELOCALGAMEVIEWIMPL_H
|
||||
#define CREATELOCALGAMEVIEWIMPL_H
|
||||
#include "boost/shared_ptr.hpp"
|
||||
#include <QtCore>
|
||||
#include <QQmlListProperty>
|
||||
#include <QQmlApplicationEngine>
|
||||
|
||||
class ConfigFile;
|
||||
class MyListViewItemData;
|
||||
class StartViewImpl;
|
||||
|
||||
class CreateLocalGameViewImpl : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Q_INVOKABLE void readConfigValues();
|
||||
Q_INVOKABLE void startGame();
|
||||
|
||||
CreateLocalGameViewImpl(QObject *parent, QQmlApplicationEngine *engine, boost::shared_ptr<ConfigFile>, StartViewImpl*);
|
||||
~CreateLocalGameViewImpl();
|
||||
|
||||
MyListViewItemData* listItem(QString id);
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
private:
|
||||
QQmlApplicationEngine *myQmlEngine;
|
||||
QList<QObject*> myListData;
|
||||
boost::shared_ptr<ConfigFile> myConfig;
|
||||
StartViewImpl *myStartView;
|
||||
};
|
||||
|
||||
#endif // CREATELOCALGAMEVIEWIMPL_H
|
||||
@@ -0,0 +1,371 @@
|
||||
#ifndef MYLISTVIEWITEMDATA_H
|
||||
#define MYLISTVIEWITEMDATA_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QQmlListProperty>
|
||||
|
||||
class MyListViewItemData : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString myId READ myId WRITE setMyId NOTIFY myIdChanged)
|
||||
Q_PROPERTY(QString myTitle READ myTitle WRITE setMyTitle NOTIFY myTitleChanged)
|
||||
Q_PROPERTY(QString myType READ myType WRITE setMyType NOTIFY myTypeChanged)
|
||||
Q_PROPERTY(QString myValue READ myValue WRITE setMyValue NOTIFY myValueChanged)
|
||||
|
||||
//ComboBox special
|
||||
Q_PROPERTY(QStringList myValuesList READ myValuesList WRITE setMyValuesList NOTIFY myValuesListChanged)
|
||||
Q_PROPERTY(bool myValueIsIndex READ myValueIsIndex WRITE setMyValueIsIndex NOTIFY myValueIsIndexChanged)
|
||||
|
||||
//SpinBox special
|
||||
Q_PROPERTY(QString myMaxValue READ myMaxValue WRITE setMyMaxValue NOTIFY myMaxValueChanged)
|
||||
Q_PROPERTY(QString myMinValue READ myMinValue WRITE setMyMinValue NOTIFY myMinValueChanged)
|
||||
Q_PROPERTY(QString myPrefix READ myPrefix WRITE setMyPrefix NOTIFY myPrefixChanged)
|
||||
|
||||
//BlindsRaiseInterval-Selector special
|
||||
Q_PROPERTY(QString myRaiseOnHandsType READ myRaiseOnHandsType WRITE setMyRaiseOnHandsType NOTIFY myRaiseOnHandsTypeChanged)
|
||||
Q_PROPERTY(QString myRaiseOnHandsInterval READ myRaiseOnHandsInterval WRITE setMyRaiseOnHandsInterval NOTIFY myRaiseOnHandsIntervalChanged)
|
||||
Q_PROPERTY(QString myRaiseOnMinutesInterval READ myRaiseOnMinutesInterval WRITE setMyRaiseOnMinutesInterval NOTIFY myRaiseOnMinutesIntervalChanged)
|
||||
|
||||
//BlindsRaiseMode-Selector special
|
||||
Q_PROPERTY(QString myAlwaysDoubleBlinds READ myAlwaysDoubleBlinds WRITE setMyAlwaysDoubleBlinds NOTIFY myAlwaysDoubleBlindsChanged)
|
||||
Q_PROPERTY(QStringList myManualBlindsList READ myManualBlindsList WRITE setMyManualBlindsList NOTIFY myManualBlindsListChanged)
|
||||
Q_PROPERTY(QString myAfterMBAlwaysDoubleBlinds READ myAfterMBAlwaysDoubleBlinds WRITE setMyAfterMBAlwaysDoubleBlinds NOTIFY myAfterMBAlwaysDoubleBlindsChanged)
|
||||
Q_PROPERTY(QString myAfterMBAlwaysRaiseAbout READ myAfterMBAlwaysRaiseAbout WRITE setMyAfterMBAlwaysRaiseAbout NOTIFY myAfterMBAlwaysRaiseAboutChanged)
|
||||
Q_PROPERTY(QString myAfterMBAlwaysRaiseValue READ myAfterMBAlwaysRaiseValue WRITE setMyAfterMBAlwaysRaiseValue NOTIFY myAfterMBAlwaysRaiseValueChanged)
|
||||
Q_PROPERTY(QString myAfterMBStayAtLastBlind READ myAfterMBStayAtLastBlind WRITE setMyAfterMBStayAtLastBlind NOTIFY myAfterMBStayAtLastBlindChanged)
|
||||
|
||||
QString m_myId;
|
||||
|
||||
QString m_myTitle;
|
||||
|
||||
QString m_myType;
|
||||
|
||||
QString m_myValue;
|
||||
|
||||
bool m_myValueIsIndex;
|
||||
|
||||
QString m_myMaxValue;
|
||||
|
||||
QString m_myMinValue;
|
||||
|
||||
QString m_myPrefix;
|
||||
|
||||
QString m_myRaiseOnHandsType;
|
||||
|
||||
QString m_myRaiseOnHandsInterval;
|
||||
|
||||
QString m_myRaiseOnMinutesInterval;
|
||||
|
||||
QString m_myAlwaysDoubleBlinds;
|
||||
|
||||
QString m_myAfterMBAlwaysDoubleBlinds;
|
||||
|
||||
QString m_myAfterMBAlwaysRaiseAbout;
|
||||
|
||||
QString m_myAfterMBStayAtLastBlind;
|
||||
|
||||
QString m_myAfterMBAlwaysRaiseValue;
|
||||
|
||||
QStringList m_myManualBlindsList;
|
||||
|
||||
QStringList m_myValuesList;
|
||||
|
||||
public:
|
||||
inline MyListViewItemData(QObject *parent = 0) : QObject(parent) {}
|
||||
inline ~MyListViewItemData() {}
|
||||
|
||||
QString myId() const
|
||||
{
|
||||
return m_myId;
|
||||
}
|
||||
|
||||
QString myTitle() const
|
||||
{
|
||||
return m_myTitle;
|
||||
}
|
||||
|
||||
QString myType() const
|
||||
{
|
||||
return m_myType;
|
||||
}
|
||||
|
||||
QString myValue() const
|
||||
{
|
||||
return m_myValue;
|
||||
}
|
||||
|
||||
bool myValueIsIndex() const
|
||||
{
|
||||
return m_myValueIsIndex;
|
||||
}
|
||||
|
||||
QString myMaxValue() const
|
||||
{
|
||||
return m_myMaxValue;
|
||||
}
|
||||
|
||||
QString myMinValue() const
|
||||
{
|
||||
return m_myMinValue;
|
||||
}
|
||||
|
||||
QString myPrefix() const
|
||||
{
|
||||
return m_myPrefix;
|
||||
}
|
||||
|
||||
QString myRaiseOnHandsType() const
|
||||
{
|
||||
return m_myRaiseOnHandsType;
|
||||
}
|
||||
|
||||
QString myRaiseOnHandsInterval() const
|
||||
{
|
||||
return m_myRaiseOnHandsInterval;
|
||||
}
|
||||
|
||||
QString myRaiseOnMinutesInterval() const
|
||||
{
|
||||
return m_myRaiseOnMinutesInterval;
|
||||
}
|
||||
|
||||
QString myAlwaysDoubleBlinds() const
|
||||
{
|
||||
return m_myAlwaysDoubleBlinds;
|
||||
}
|
||||
|
||||
QString myAfterMBAlwaysDoubleBlinds() const
|
||||
{
|
||||
return m_myAfterMBAlwaysDoubleBlinds;
|
||||
}
|
||||
|
||||
QString myAfterMBAlwaysRaiseAbout() const
|
||||
{
|
||||
return m_myAfterMBAlwaysRaiseAbout;
|
||||
}
|
||||
|
||||
QString myAfterMBStayAtLastBlind() const
|
||||
{
|
||||
return m_myAfterMBStayAtLastBlind;
|
||||
}
|
||||
|
||||
QString myAfterMBAlwaysRaiseValue() const
|
||||
{
|
||||
return m_myAfterMBAlwaysRaiseValue;
|
||||
}
|
||||
|
||||
QStringList myManualBlindsList() const
|
||||
{
|
||||
return m_myManualBlindsList;
|
||||
}
|
||||
|
||||
void appendToMyManualBlindsList(QString str)
|
||||
{
|
||||
m_myManualBlindsList.append(str);
|
||||
}
|
||||
|
||||
void clearMyManualBlindsList()
|
||||
{
|
||||
m_myManualBlindsList.clear();
|
||||
}
|
||||
|
||||
QStringList myValuesList() const
|
||||
{
|
||||
return m_myValuesList;
|
||||
}
|
||||
|
||||
void appendToMyValuesList(QString str)
|
||||
{
|
||||
m_myValuesList.append(str);
|
||||
}
|
||||
|
||||
void clearMyValuesList()
|
||||
{
|
||||
m_myValuesList.clear();
|
||||
}
|
||||
signals:
|
||||
|
||||
void myIdChanged(QString myId);
|
||||
|
||||
void myTitleChanged(QString myTitle);
|
||||
|
||||
void myTypeChanged(QString myType);
|
||||
|
||||
void myValueChanged(QString myValue);
|
||||
|
||||
void myValueIsIndexChanged(bool myValueIsIndex);
|
||||
|
||||
void myMaxValueChanged(QString myMaxValue);
|
||||
|
||||
void myMinValueChanged(QString myMinValue);
|
||||
|
||||
void myPrefixChanged(QString myPrefix);
|
||||
|
||||
void myRaiseOnHandsTypeChanged(QString myRaiseOnHandsType);
|
||||
|
||||
void myRaiseOnHandsIntervalChanged(QString myRaiseOnHandsInterval);
|
||||
|
||||
void myRaiseOnMinutesIntervalChanged(QString myRaiseOnMinutesInterval);
|
||||
|
||||
void myAlwaysDoubleBlindsChanged(QString myAlwaysDoubleBlinds);
|
||||
|
||||
void myAfterMBAlwaysDoubleBlindsChanged(QString myAfterMBAlwaysDoubleBlinds);
|
||||
|
||||
void myAfterMBAlwaysRaiseAboutChanged(QString myAfterMBAlwaysRaiseAbout);
|
||||
|
||||
void myAfterMBAlwaysRaiseValueChanged(QString myAfterMBAlwaysRaiseValue);
|
||||
|
||||
void myAfterMBStayAtLastBlindChanged(QString myAfterMBStayAtLastBlind);
|
||||
|
||||
void myManualBlindsListChanged(QStringList myManualBlindsList);
|
||||
|
||||
void myValuesListChanged(QStringList myValuesList);
|
||||
|
||||
public slots:
|
||||
void setMyId(QString myId)
|
||||
{
|
||||
if (m_myId == myId)
|
||||
return;
|
||||
|
||||
m_myId = myId;
|
||||
emit myIdChanged(myId);
|
||||
}
|
||||
void setMyTitle(QString myTitle)
|
||||
{
|
||||
if (m_myTitle == myTitle)
|
||||
return;
|
||||
|
||||
m_myTitle = myTitle;
|
||||
emit myTitleChanged(myTitle);
|
||||
}
|
||||
void setMyType(QString myType)
|
||||
{
|
||||
if (m_myType == myType)
|
||||
return;
|
||||
|
||||
m_myType = myType;
|
||||
emit myTypeChanged(myType);
|
||||
}
|
||||
void setMyValue(QString myValue)
|
||||
{
|
||||
if (m_myValue == myValue)
|
||||
return;
|
||||
|
||||
m_myValue = myValue;
|
||||
emit myValueChanged(myValue);
|
||||
}
|
||||
void setMyValueIsIndex(bool myValueIsIndex)
|
||||
{
|
||||
if (m_myValueIsIndex == myValueIsIndex)
|
||||
return;
|
||||
|
||||
m_myValueIsIndex = myValueIsIndex;
|
||||
emit myValueIsIndexChanged(myValueIsIndex);
|
||||
}
|
||||
void setMyMaxValue(QString myMaxValue)
|
||||
{
|
||||
if (m_myMaxValue == myMaxValue)
|
||||
return;
|
||||
|
||||
m_myMaxValue = myMaxValue;
|
||||
emit myMaxValueChanged(myMaxValue);
|
||||
}
|
||||
void setMyMinValue(QString myMinValue)
|
||||
{
|
||||
if (m_myMinValue == myMinValue)
|
||||
return;
|
||||
|
||||
m_myMinValue = myMinValue;
|
||||
emit myMinValueChanged(myMinValue);
|
||||
}
|
||||
void setMyPrefix(QString myPrefix)
|
||||
{
|
||||
if (m_myPrefix == myPrefix)
|
||||
return;
|
||||
|
||||
m_myPrefix = myPrefix;
|
||||
emit myPrefixChanged(myPrefix);
|
||||
}
|
||||
void setMyRaiseOnHandsType(QString myRaiseOnHandsType)
|
||||
{
|
||||
if (m_myRaiseOnHandsType == myRaiseOnHandsType)
|
||||
return;
|
||||
|
||||
m_myRaiseOnHandsType = myRaiseOnHandsType;
|
||||
emit myRaiseOnHandsTypeChanged(myRaiseOnHandsType);
|
||||
}
|
||||
void setMyRaiseOnHandsInterval(QString myRaiseOnHandsInterval)
|
||||
{
|
||||
if (m_myRaiseOnHandsInterval == myRaiseOnHandsInterval)
|
||||
return;
|
||||
|
||||
m_myRaiseOnHandsInterval = myRaiseOnHandsInterval;
|
||||
emit myRaiseOnHandsIntervalChanged(myRaiseOnHandsInterval);
|
||||
}
|
||||
void setMyRaiseOnMinutesInterval(QString myRaiseOnMinutesInterval)
|
||||
{
|
||||
if (m_myRaiseOnMinutesInterval == myRaiseOnMinutesInterval)
|
||||
return;
|
||||
|
||||
m_myRaiseOnMinutesInterval = myRaiseOnMinutesInterval;
|
||||
emit myRaiseOnMinutesIntervalChanged(myRaiseOnMinutesInterval);
|
||||
}
|
||||
void setMyAlwaysDoubleBlinds(QString myAlwaysDoubleBlinds)
|
||||
{
|
||||
if (m_myAlwaysDoubleBlinds == myAlwaysDoubleBlinds)
|
||||
return;
|
||||
|
||||
m_myAlwaysDoubleBlinds = myAlwaysDoubleBlinds;
|
||||
emit myAlwaysDoubleBlindsChanged(myAlwaysDoubleBlinds);
|
||||
}
|
||||
void setMyAfterMBAlwaysDoubleBlinds(QString myAfterMBAlwaysDoubleBlinds)
|
||||
{
|
||||
if (m_myAfterMBAlwaysDoubleBlinds == myAfterMBAlwaysDoubleBlinds)
|
||||
return;
|
||||
|
||||
m_myAfterMBAlwaysDoubleBlinds = myAfterMBAlwaysDoubleBlinds;
|
||||
emit myAfterMBAlwaysDoubleBlindsChanged(myAfterMBAlwaysDoubleBlinds);
|
||||
}
|
||||
void setMyAfterMBAlwaysRaiseAbout(QString myAfterMBAlwaysRaiseAbout)
|
||||
{
|
||||
if (m_myAfterMBAlwaysRaiseAbout == myAfterMBAlwaysRaiseAbout)
|
||||
return;
|
||||
|
||||
m_myAfterMBAlwaysRaiseAbout = myAfterMBAlwaysRaiseAbout;
|
||||
emit myAfterMBAlwaysRaiseAboutChanged(myAfterMBAlwaysRaiseAbout);
|
||||
}
|
||||
void setMyAfterMBAlwaysRaiseValue(QString myAfterMBAlwaysRaiseValue)
|
||||
{
|
||||
if (m_myAfterMBAlwaysRaiseValue == myAfterMBAlwaysRaiseValue)
|
||||
return;
|
||||
|
||||
m_myAfterMBAlwaysRaiseValue = myAfterMBAlwaysRaiseValue;
|
||||
emit myAfterMBAlwaysRaiseValueChanged(myAfterMBAlwaysRaiseValue);
|
||||
} void setMyAfterMBStayAtLastBlind(QString myAfterMBStayAtLastBlind)
|
||||
{
|
||||
if (m_myAfterMBStayAtLastBlind == myAfterMBStayAtLastBlind)
|
||||
return;
|
||||
|
||||
m_myAfterMBStayAtLastBlind = myAfterMBStayAtLastBlind;
|
||||
emit myAfterMBStayAtLastBlindChanged(myAfterMBStayAtLastBlind);
|
||||
}
|
||||
|
||||
void setMyManualBlindsList(QStringList myManualBlindsList)
|
||||
{
|
||||
if (m_myManualBlindsList == myManualBlindsList)
|
||||
return;
|
||||
|
||||
m_myManualBlindsList = myManualBlindsList;
|
||||
emit myManualBlindsListChanged(myManualBlindsList);
|
||||
}
|
||||
void setMyValuesList(QStringList myValuesList)
|
||||
{
|
||||
if (m_myValuesList == myValuesList)
|
||||
return;
|
||||
|
||||
m_myValuesList = myValuesList;
|
||||
emit myValuesListChanged(myValuesList);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // MYLISTVIEWITEMDATA_H
|
||||
@@ -0,0 +1,43 @@
|
||||
#include "qmlconfig.h"
|
||||
#include "configfile.h"
|
||||
|
||||
QmlConfig::QmlConfig(boost::shared_ptr<ConfigFile> c)
|
||||
:QObject(), myConfig(c)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QmlConfig::~QmlConfig() {}
|
||||
QmlConfig::QmlConfig(const QmlConfig&) :QObject() {}
|
||||
|
||||
QString QmlConfig::readConfigString(QString varName) {
|
||||
return QString::fromUtf8(myConfig->readConfigString(varName.toStdString()).c_str());
|
||||
}
|
||||
|
||||
QStringList QmlConfig::readConfigStringList(QString listName)
|
||||
{
|
||||
std::list<std::string> myList = myConfig->readConfigStringList(listName.toStdString());
|
||||
std::list<std::string>::iterator it1;
|
||||
QStringList returnList;
|
||||
|
||||
for(it1= myList.begin(); it1 != myList.end(); ++it1) {
|
||||
returnList.append(QString::fromStdString(*it1));
|
||||
}
|
||||
return returnList;
|
||||
}
|
||||
|
||||
QString QmlConfig::readConfigIntString(QString varName) {
|
||||
return QString::number(myConfig->readConfigInt(varName.toStdString()));
|
||||
}
|
||||
|
||||
QStringList QmlConfig::readConfigIntStringList(QString listName)
|
||||
{
|
||||
std::list<int> myList = myConfig->readConfigIntList(listName.toStdString());
|
||||
std::list<int>::iterator it1;
|
||||
QStringList returnList;
|
||||
|
||||
for(it1= myList.begin(); it1 != myList.end(); ++it1) {
|
||||
returnList.append(QString::number(*it1,10));
|
||||
}
|
||||
return returnList;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
#ifndef QMLCONFIG_H
|
||||
#define QMLCONFIG_H
|
||||
#include <QtCore>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
class ConfigFile;
|
||||
|
||||
class QmlConfig: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
Q_INVOKABLE QString readConfigString(QString);
|
||||
Q_INVOKABLE QStringList readConfigStringList(QString);
|
||||
Q_INVOKABLE QString readConfigIntString(QString);
|
||||
Q_INVOKABLE QStringList readConfigIntStringList(QString);
|
||||
|
||||
QmlConfig(boost::shared_ptr<ConfigFile>);
|
||||
~QmlConfig();
|
||||
QmlConfig(const QmlConfig&);
|
||||
|
||||
private:
|
||||
boost::shared_ptr<ConfigFile> myConfig;
|
||||
};
|
||||
|
||||
#endif // QMLCONFIG_H
|
||||
@@ -0,0 +1,42 @@
|
||||
#include <QtCore>
|
||||
#include <QtQml>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QQmlContext>
|
||||
#include <configfile.h>
|
||||
|
||||
#include "qmlconfig.h"
|
||||
#include "qmlwrapper.h"
|
||||
#include "startviewimpl.h"
|
||||
#include "createlocalgameviewimpl.h"
|
||||
|
||||
QmlWrapper::QmlWrapper(boost::shared_ptr<ConfigFile> c)
|
||||
:QObject(), myConfig(c)
|
||||
{
|
||||
myQmlEngine = new QQmlApplicationEngine;
|
||||
myQmlConfig = new QmlConfig(myConfig);
|
||||
|
||||
//TODO create Session and Log here
|
||||
|
||||
myStartViewImpl = new StartViewImpl(this);
|
||||
myCreateLocalGameViewImpl = new CreateLocalGameViewImpl(this, myQmlEngine, myConfig, myStartViewImpl);
|
||||
|
||||
//Add c++ content to QML here
|
||||
myQmlEngine->rootContext()->setContextProperty("Config", myQmlConfig);
|
||||
myQmlEngine->rootContext()->setContextProperty("StartViewImpl", myStartViewImpl);
|
||||
myQmlEngine->rootContext()->setContextProperty("CreateLocalGameViewImpl", myCreateLocalGameViewImpl);
|
||||
|
||||
myQmlEngine->load(QUrl(QStringLiteral("qrc:/main.qml")));
|
||||
}
|
||||
|
||||
QmlWrapper::~QmlWrapper()
|
||||
{
|
||||
myQmlEngine->deleteLater();
|
||||
}
|
||||
|
||||
QmlWrapper::QmlWrapper(const QmlWrapper&)
|
||||
:QObject()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
#ifndef QMLWRAPPER_H
|
||||
#define QMLWRAPPER_H
|
||||
#include <QtCore>
|
||||
#include "boost/shared_ptr.hpp"
|
||||
|
||||
class QQmlApplicationEngine;
|
||||
class ConfigFile;
|
||||
class QmlConfig;
|
||||
class CreateLocalGameViewImpl;
|
||||
class StartViewImpl;
|
||||
|
||||
class QmlWrapper: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QmlWrapper(boost::shared_ptr<ConfigFile>);
|
||||
~QmlWrapper();
|
||||
QmlWrapper(const QmlWrapper&);
|
||||
|
||||
public slots:
|
||||
|
||||
private:
|
||||
QQmlApplicationEngine *myQmlEngine;
|
||||
boost::shared_ptr<ConfigFile> myConfig;
|
||||
QmlConfig *myQmlConfig;
|
||||
CreateLocalGameViewImpl *myCreateLocalGameViewImpl;
|
||||
StartViewImpl *myStartViewImpl;
|
||||
};
|
||||
|
||||
#endif // QMLWRAPPER_H
|
||||
@@ -0,0 +1,54 @@
|
||||
#include "startviewimpl.h"
|
||||
#include "mylistviewitemdata.h"
|
||||
#include "gamedata.h"
|
||||
|
||||
StartViewImpl::StartViewImpl(QObject *parent) : QObject(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
StartViewImpl::~StartViewImpl()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void StartViewImpl::startLocalGame(GameData &gd)
|
||||
{
|
||||
// // Stop local game.
|
||||
// myGuiInterface->getMyW()->stopTimer();
|
||||
|
||||
|
||||
// Frage 1. Was ist nochmal ServerGuiInterface? Wofür? Was macht es?
|
||||
|
||||
// if (!myServerGuiInterface) {
|
||||
// // Create pseudo Gui Wrapper for the server.
|
||||
// myServerGuiInterface.reset(new ServerGuiWrapper(myConfig, mySession->getGui(), mySession->getGui(), mySession->getGui()));
|
||||
// {
|
||||
// boost::shared_ptr<Session> session(new Session(myServerGuiInterface.get(), myConfig, 0));
|
||||
// session->init(mySession->getAvatarManager());
|
||||
// myServerGuiInterface->setSession(session);
|
||||
// }
|
||||
// }
|
||||
|
||||
// // Terminate existing network games.
|
||||
// mySession->terminateNetworkClient();
|
||||
// myServerGuiInterface->getSession()->terminateNetworkServer();
|
||||
|
||||
|
||||
|
||||
// Frage 2. Warum an dieser Stelle die StartView-Session an Lobby und StartNetworkDialog?
|
||||
|
||||
// myGameLobbyDialog->setSession(getSession());
|
||||
// myStartNetworkGameDialog->setSession(getSession());
|
||||
|
||||
// myServerGuiInterface->getSession()->startNetworkServer(false,true);
|
||||
// mySession->startNetworkClientForLocalServer(gd);
|
||||
|
||||
// myGuiInterface->getMyW()->show();
|
||||
// myGuiInterface->getMyW()->networkGameModification();
|
||||
|
||||
// assert(getSession());
|
||||
// getSession()->sendStartEvent(true);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
#ifndef STARTVIEWIMPL_H
|
||||
#define STARTVIEWIMPL_H
|
||||
#include <QtCore>
|
||||
|
||||
class CreateLocalGameViewImpl;
|
||||
class GameData;
|
||||
|
||||
class StartViewImpl : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
StartViewImpl(QObject *parent = 0);
|
||||
~StartViewImpl();
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
Q_INVOKABLE void startLocalGame(GameData &gd);
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
#endif // STARTVIEWIMPL_H
|
||||
@@ -0,0 +1,27 @@
|
||||
android-no-sdk {
|
||||
target.path = /data/user/qt
|
||||
export(target.path)
|
||||
INSTALLS += target
|
||||
} else:android {
|
||||
x86 {
|
||||
target.path = /libs/x86
|
||||
} else: armeabi-v7a {
|
||||
target.path = /libs/armeabi-v7a
|
||||
} else {
|
||||
target.path = /libs/armeabi
|
||||
}
|
||||
export(target.path)
|
||||
INSTALLS += target
|
||||
} else:unix {
|
||||
isEmpty(target.path) {
|
||||
qnx {
|
||||
target.path = /tmp/$${TARGET}/bin
|
||||
} else {
|
||||
target.path = /opt/$${TARGET}/bin
|
||||
}
|
||||
export(target.path)
|
||||
}
|
||||
INSTALLS += target
|
||||
}
|
||||
|
||||
export(INSTALLS)
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="white" viewBox="0 0 18 18"><path d="M15 8.25H5.87l4.19-4.19L9 3 3 9l6 6 1.06-1.06-4.19-4.19H15v-1.5z"/></svg>
|
||||
|
After Width: | Height: | Size: 179 B |
|
After Width: | Height: | Size: 317 B |
|
After Width: | Height: | Size: 463 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="white" viewBox="0 0 18 18"><path d="M6.61 11.89L3.5 8.78 2.44 9.84 6.61 14l8.95-8.95L14.5 4z"/></svg>
|
||||
|
After Width: | Height: | Size: 171 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="white" viewBox="0 0 18 18"><path d="M9 5.5c.83 0 1.5-.67 1.5-1.5S9.83 2.5 9 2.5 7.5 3.17 7.5 4 8.17 5.5 9 5.5zm0 2c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5S9.83 7.5 9 7.5zm0 5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5z"/></svg>
|
||||
|
After Width: | Height: | Size: 338 B |
@@ -0,0 +1,295 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 15.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
width="800px" height="800px" viewBox="0 0 800 800" enable-background="new 0 0 800 800" xml:space="preserve">
|
||||
<path fill="#801E18" d="M536.133,712.925c66.804-21.577,129.325-57.317,175.53-110.908c56.564-65.608,77.015-140.425,73.442-225.409
|
||||
c-1.214-31.591-10.896-69.142-25.374-100.533l-0.08-0.1c-39.174-84.88-113.951-142.139-200.696-173.14l-0.08-0.093
|
||||
c-95.3-33.99-197.881-34.774-294.124-3.978c-66.552,21.421-120.761,53.629-162.542,96.632
|
||||
c-54.12,55.665-90.71,134.26-87.516,210.332c4.857,115.098,55.876,212.366,157.272,271.003
|
||||
c109.877,63.543,243.836,74.77,363.972,36.169L536.133,712.925z"/>
|
||||
<g>
|
||||
<g>
|
||||
<path fill="#F2F2F2" d="M361.804,77.386l4.374,37.294c-28.484,2.912-57.11,9.042-85.96,18.295l-16.275-34.932
|
||||
C296.793,87.531,329.41,80.649,361.804,77.386z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#C12D25" d="M459.426,78.306c33.229,4.061,66.335,11.965,99.301,23.724l-18.914,34.531
|
||||
c-2.347-0.905-4.612-1.696-6.88-2.467c-26.667-9.066-53.477-15.25-80.428-18.563c-28.98-3.521-57.574-3.779-86.327-0.851
|
||||
l-4.374-37.294C394.469,74.041,427.006,74.344,459.426,78.306z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#F2F2F2" d="M558.808,102.122c31.755,11.348,60.38,25.22,85.85,41.693l-29.21,29.457
|
||||
c-22.344-14.434-47.56-26.641-75.635-36.711L558.808,102.122z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#C12D25" d="M263.942,98.043l16.071,34.907c-58.905,18.942-106.682,47.295-143.484,85.279l-35.494-23.337
|
||||
C142.911,151.792,197.24,119.513,263.942,98.043z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#F2F2F2" d="M101.035,194.892l35.502,23.345c-18.023,18.627-33.441,39.395-46.103,62.494l-41.752-14.893
|
||||
C63.197,239.561,80.623,215.887,101.035,194.892z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#C12D25" d="M644.657,143.815c51.835,33.466,90.217,77.493,115.297,131.835l-42.726,13.869
|
||||
c-22.213-48.025-56.123-86.688-101.781-116.248L644.657,143.815z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#C12D25" d="M692.234,364.056c2.606,20.29,1.869,40.534-2.232,60.721c-4.235,20.826-12.051,41.589-23.474,62.272
|
||||
c-11.056,20.144-24.304,38.191-39.994,54.279c-31.902,32.78-73.257,57.354-124.08,73.797
|
||||
c-25.044,7.894-49.954,13.147-74.699,15.599c-0.723,0.075-1.448,0.146-2.17,0.217c-1.4,0.135-2.796,0.262-4.191,0.377
|
||||
c-23.983,1.882-45.865,1.416-67.635-1.229c-22.255-2.746-43.769-7.565-65.154-14.532c-1.68-0.55-3.185-1.05-4.694-1.565
|
||||
c-1.952-0.666-3.907-1.349-5.858-2.052c-24.413-8.711-46.306-19.354-65.593-31.914c-39.408-25.479-68.617-58.921-87.736-100.258
|
||||
c-9.525-20.334-15.535-40.568-18.114-60.804c-2.695-20.34-2.004-40.609,2.08-60.825c4.214-20.859,12.037-41.664,23.479-62.432
|
||||
c11.037-20.063,24.287-38.11,39.959-54.119c31.902-32.78,73.273-57.435,124.179-73.784c24.883-8.081,49.68-13.266,74.439-15.797
|
||||
c1.047-0.106,2.096-0.208,3.144-0.306c23.62-2.188,47.151-1.864,70.604,0.982c24.99,3.077,49.317,8.811,73.562,17.281
|
||||
c0.891,0.31,1.781,0.624,2.672,0.943c24.314,8.699,46.125,19.25,65.52,31.822c39.487,25.573,68.886,59.039,87.995,100.456
|
||||
C683.67,323.509,689.564,343.813,692.234,364.056z M674.546,426.452l0.918-4.534c3.082-15.225-0.801-28.978-11.755-41.265
|
||||
c-10.833-12.361-25.45-19.54-43.895-21.794l-18.337-2.24c2.394-16.31,4.368-32.582,6.132-48.798
|
||||
c0.215-1.682,0.477-3.256,0.774-4.717c0.6-2.926,1.343-5.398,2.163-7.411c1.789-4.217,4.301-6.651,7.771-7.803
|
||||
c2.12-0.487,5.443-0.911,10.044-1.178l9.624,0.84l0.936-16.563c-33.125-10.103-66.937-18.799-101.254-25.979l-2.313,17.888
|
||||
c1.304,0.578,4.29,2.265,8.896,4.985c4.407,3.28,7.114,5.454,8.744,7.216c3.156,3.372,5.146,7.014,5.857,10.999
|
||||
c0.682,3.653,0.764,8.227-0.042,13.692c-2.407,16.884-4.915,33.755-7.631,50.683l-85.604-10.46
|
||||
c4.494-23.688,7.955-42.765,10.491-57.309c0.108-0.688,0.232-1.377,0.376-2.073c0.773-3.755,2.058-7.642,3.745-11.777
|
||||
c2.408-4.589,5.144-7.064,8.748-8.304c1.179-0.448,3.806-0.986,7.94-1.833c0.508-0.104,1.038-0.213,1.592-0.328l10.425-0.548
|
||||
l2.623-17.939c-1.322-0.255-2.646-0.507-3.97-0.759c-1.345-0.254-2.689-0.507-4.038-0.756c-1.728-0.323-3.455-0.638-5.187-0.952
|
||||
c-22.304-4.043-44.806-7.469-67.459-10.25c-4.354-0.532-7.894-0.948-11.44-1.347c-3.967-0.447-7.644-0.844-11.324-1.224
|
||||
l-3.812,18.288c2.079,0.722,4.891,1.971,8.638,3.788c4.223,2.593,7.298,4.881,9.201,6.935c3.04,2.949,4.756,6.475,5.319,10.696
|
||||
c0.381,3.608-0.051,8.209-1.165,13.711l-11.189,55.812l-113.216-13.833c6.182-27.043,12.839-53.953,19.896-80.806l6.554,0.554
|
||||
c1.604,0.074,3.317,0.222,5.143,0.444c1.824,0.223,3.762,0.521,5.811,0.894l10.682,2.135c4.883,1.844,8.7,10.937,11.463,27.211
|
||||
c0.25,1.571,0.489,3.129,0.718,4.675c2.196,14.934,3.294,28.654,3.123,41.27l11.14,1.361l20.484-94.177
|
||||
c-62.278-5.869-125.671-7.221-189.964-4.121c-10.307,28.443-19.275,56.311-26.698,83.454l11.214,0.542
|
||||
c6.124-12.284,14.79-25.662,25.942-40.319c10.94-14.594,19.323-22.532,25.188-23.555l29.582-1.867
|
||||
c-7.468,25.39-14.318,50.782-20.671,76.146l-46.252-5.651c-18.442-2.253-35.28,1.082-50.578,10.251
|
||||
c-15.184,9.093-24.313,21.257-27.395,36.481l-0.918,4.533c-0.479,2.366-0.788,4.697-0.926,6.992
|
||||
c-0.751,12.394,3.452,23.758,12.6,34.188c8.986,10.08,20.475,16.841,34.494,20.19c3.069,0.733,6.263,1.304,9.576,1.708
|
||||
l45.07,5.508c-3.38,19.168-6.556,38.362-9.341,57.605c-0.18,1.446-0.404,2.852-0.675,4.211c-0.696,3.472-1.699,6.65-3.008,9.528
|
||||
c-2.141,4.361-4.827,6.661-8.415,8.099c-1.568,0.879-4.364,1.181-8.205,0.974c-0.629-0.033-1.284-0.079-1.969-0.142l-11.424-0.482
|
||||
l-1.749,17.133c1.115,0.27,2.232,0.537,3.351,0.804c34.628,8.256,69.205,15.424,104.015,21.441l3.184-18.198
|
||||
c-3.141-0.967-6.756-2.566-10.93-4.905c-4.642-2.555-7.667-4.589-9.213-5.938c-3.378-3.541-5.049-7.223-5.571-11.389
|
||||
c-0.491-3.487-0.36-7.554,0.207-12.163c0.104-0.854,0.224-1.727,0.355-2.615c3.195-19.282,6.582-38.533,10.175-57.758
|
||||
l114.104,13.942l-12.818,63.819c-1.164,5.751-2.938,10.515-5.012,14.243c-2.44,4.1-5.448,6.967-9.018,8.606
|
||||
c-1.864,0.766-5.336,1.423-10.354,1.723l-10.466,0.296l-3.462,18.086c1.09,0.15,2.176,0.3,3.266,0.449
|
||||
c0.836,0.113,1.675,0.228,2.514,0.34c4.573,0.614,7.563,1.008,10.558,1.393c3.275,0.42,6.556,0.831,9.837,1.232
|
||||
c26.505,3.238,53.163,5.826,79.906,7.724l4.347-17.976c-2.97-0.78-6.291-1.852-9.931-3.371c-3.81-1.63-6.519-3.201-8.171-4.568
|
||||
c-2.821-3.003-4.357-6.426-4.864-10.387c-0.267-4.475,0.107-8.531,0.98-12.899c0.096-0.483,0.198-0.97,0.307-1.461
|
||||
c4.67-21.088,9.086-41.378,13.264-61.032l86.191,10.532c-4.487,19.696-9.341,39.68-14.458,59.966
|
||||
c-1.449,5.634-3.287,10.219-5.48,13.604c-2.158,3.643-5.346,6.404-9.615,8.534c-2.249,1.137-5.639,1.888-10.028,2.098
|
||||
l-10.678,0.854l-4.379,17.637c32.688,1.753,68.732,2.422,107.929,1.984l5.137-16.385c-0.721,0.028-1.507-0.01-2.355-0.113
|
||||
c-2.159-0.264-4.721-0.951-7.617-2.017c-4.37-1.358-6.987-2.465-8.734-3.809c-3.026-2.528-4.539-5.53-4.735-9.04
|
||||
c-0.069-2.406,0.188-5.242,0.83-8.475c0.29-1.47,0.661-3.019,1.116-4.65c4.957-17.981,9.518-36.014,13.662-54.006l16.959,2.072
|
||||
c3.316,0.404,6.575,0.623,9.782,0.656c14.641,0.153,28.171-3.551,40.62-11.012c12.908-7.736,21.411-17.549,25.596-29.522
|
||||
C673.44,431.11,674.067,428.818,674.546,426.452"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#C12D25" d="M229.714,356.004c3.346,0.409,5.927,1.635,7.902,3.871c1.993,2.147,2.699,4.639,2.157,7.313
|
||||
c-0.573,2.835-2.213,4.957-4.977,6.614c-2.762,1.648-5.721,2.288-9.066,1.879l-9.274-1.133l3.983-19.678L229.714,356.004z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#F2F2F2" d="M760.033,275.75c12.288,26.64,20.145,53.247,23.646,79.896l-45.597,4.056
|
||||
c-3.063-23.28-10.063-46.623-20.854-70.183L760.033,275.75z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#F2F2F2" d="M739.273,388.255c-0.006-0.061-0.006-0.121-0.008-0.182c-0.001,0-0.442-10.476-0.447-10.581
|
||||
c-0.252-5.982-0.505-11.965-0.757-17.947l0,0c0.007,0.053,0.014,0.105,0.021,0.157l1.212,28.71
|
||||
C739.287,388.359,739.28,388.308,739.273,388.255z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#F2F2F2" d="M260.268,358.325c1.184,3.633,1.431,7.397,0.612,11.442c-0.82,4.052-2.56,7.655-5.138,10.911
|
||||
c-2.17,2.722-5.079,5.1-8.51,7.086c-7.491,4.566-15.808,6.201-24.977,5.081l-9.274-1.133l-1.722,8.505l-21.204-2.591
|
||||
l12.688-62.679l30.479,3.724c9.168,1.121,16.419,4.748,21.746,10.873C257.449,352.254,259.277,355.218,260.268,358.325z
|
||||
M234.797,373.803c2.764-1.657,4.403-3.779,4.977-6.614c0.542-2.675-0.164-5.166-2.157-7.313
|
||||
c-1.976-2.236-4.557-3.462-7.902-3.871l-9.274-1.133l-3.983,19.678l9.274,1.133C229.076,376.091,232.035,375.451,234.797,373.803"
|
||||
/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#C12D25" d="M575.994,398.144c3.452,0.422,6.21,1.759,8.187,3.987c1.968,2.234,2.763,4.818,2.189,7.654
|
||||
c-0.558,2.755-2.319,4.943-5.091,6.682c-2.764,1.656-5.932,2.345-9.384,1.923l-9.568-1.169l4.099-20.247L575.994,398.144z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#F2F2F2" d="M593.788,428.041l11.969,15.233l-19.415,7.583l-24.572-30.882l-4.606,22.754l-20.91-2.556l12.704-62.758
|
||||
l30.479,3.724c9.07,1.108,16.436,4.667,21.762,10.792c5.359,5.965,7.306,12.843,5.782,20.371
|
||||
C605.34,420.4,600.935,425.672,593.788,428.041z M581.279,416.467c2.771-1.738,4.533-3.927,5.091-6.682
|
||||
c0.573-2.836-0.222-5.42-2.189-7.654c-1.977-2.229-4.734-3.565-8.188-3.987l-9.567-1.17l-4.099,20.247l9.568,1.169
|
||||
C575.348,418.812,578.516,418.123,581.279,416.467"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#FFCB05" d="M738.079,359.704c3.012,23.48,2.14,46.893-2.628,70.241c-4.915,24.09-13.975,48.11-27.189,72.079
|
||||
c-12.685,23.261-28.131,44.113-46.159,62.821c-36.886,37.892-84.662,66.243-143.47,85.196
|
||||
c-29.052,9.229-57.761,15.266-86.456,18.234c-1.758,0.178-3.51,0.339-5.266,0.492c-1.297,0.11-2.209,0.185-3.125,0.256
|
||||
c-25.699,2.019-51.288,1.492-76.77-1.6c-29.92-3.683-59.044-10.661-88.067-21.061c-28.174-10.083-53.289-22.277-75.732-36.722
|
||||
c-4.992-3.234-9.846-6.576-14.558-10.026c-38.355-28.1-67.326-63.416-86.953-106.024c-10.899-23.57-17.774-46.982-20.946-70.269
|
||||
c-3.048-23.537-2.216-46.993,2.52-70.386c4.889-24.137,13.932-48.201,27.153-72.204c12.661-23.1,28.08-43.867,46.102-62.495
|
||||
c36.795-37.991,84.574-66.345,143.478-85.288c29.054-9.227,57.68-15.358,86.163-18.269c28.754-2.93,57.35-2.671,85.786,0.784
|
||||
c27.489,3.378,54.308,9.565,80.971,18.629c2.267,0.77,4.531,1.562,6.798,2.375c28.158,10.161,53.373,22.37,75.716,36.802
|
||||
c45.658,29.56,79.568,68.224,101.781,116.25C728.018,313.079,735.018,336.422,738.079,359.704z M666.526,487.051
|
||||
c11.425-20.685,19.24-41.449,23.474-62.274c4.104-20.187,4.841-40.429,2.232-60.722c-2.669-20.244-8.563-40.546-17.909-60.776
|
||||
c-19.192-41.511-48.591-74.977-88.078-100.549c-19.392-12.57-41.205-23.123-65.313-31.795c-1.097-0.346-1.985-0.659-2.877-0.97
|
||||
c-24.249-8.471-48.569-14.207-72.977-17.21c-24.041-2.916-47.567-3.241-71.188-1.052c-1.048,0.096-2.097,0.198-3.146,0.306
|
||||
c-24.761,2.531-49.557,7.715-74.438,15.795c-50.906,16.351-92.276,41.004-124.177,73.785
|
||||
c-15.675,16.009-28.924,34.056-39.846,54.05c-11.557,20.839-19.382,41.642-23.596,62.5c-4.084,20.218-4.774,40.487-2.078,60.826
|
||||
c2.58,20.233,8.589,40.47,18.033,60.713c19.198,41.427,48.41,74.87,87.817,100.349c19.286,12.558,41.18,23.204,65.415,31.804
|
||||
c2.129,0.813,4.082,1.496,6.035,2.161c1.51,0.517,3.017,1.018,4.525,1.51c21.558,7.024,43.066,11.844,64.696,14.513
|
||||
c22.396,2.72,44.28,3.186,66.263,1.47c3.396-0.28,4.792-0.405,6.191-0.542c0.723-0.07,1.445-0.141,2.17-0.216
|
||||
c24.744-2.451,49.654-7.706,74.7-15.6c50.821-16.44,92.177-41.017,124.079-73.794
|
||||
C642.226,525.238,655.472,507.193,666.526,487.051"/>
|
||||
</g>
|
||||
<g>
|
||||
<polygon fill="#F2F2F2" points="438.854,360.729 454.012,372.208 421.612,393.97 443.86,422.331 424.888,429.727 396.73,394.089
|
||||
391.043,422.186 370.434,419.667 383.105,357.068 403.716,359.587 398.011,387.771 "/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#C12D25" d="M650.109,386.459c9.62,10.885,13.124,23.009,10.418,36.375c-2.721,13.439-10.847,24.149-24.302,32.215
|
||||
c-13.44,7.984-28.315,11.059-44.584,9.071l-401.176-49.019c-1.271-0.155-2.524-0.339-3.756-0.549
|
||||
c-14.537-2.48-26.306-8.769-35.198-18.729c-7.878-9.004-11.64-18.871-11.155-29.63c0.101-2.232,0.384-4.504,0.852-6.813
|
||||
c2.706-13.367,10.839-24.068,24.188-32.146c13.465-8.063,28.413-11.054,44.69-9.065l401.177,49.019
|
||||
C627.532,369.175,640.489,375.574,650.109,386.459z M341.482,407.414c8.939-5.211,14.227-12.37,16.029-21.276
|
||||
c1.787-8.826-0.435-16.813-6.866-23.991c-6.337-7.159-14.864-11.442-25.516-12.744c-10.846-1.325-20.761,0.705-29.514,6.021
|
||||
c-8.958,5.299-14.324,12.357-16.111,21.184c-1.803,8.906,0.498,16.992,6.948,24.084c6.212,7.233,14.864,11.442,25.71,12.768
|
||||
C322.814,414.76,332.605,412.805,341.482,407.414 M443.864,422.336l-22.253-28.365l32.4-21.763l-15.157-11.479l-40.844,27.041
|
||||
l5.704-28.184l-20.609-2.518l-12.672,62.598l20.609,2.519l5.688-28.097l28.157,35.638L443.864,422.336 M586.341,450.857
|
||||
l19.416-7.583l-11.968-15.233c7.146-2.368,11.551-7.641,13.19-15.738c1.523-7.528-0.423-14.405-5.782-20.371
|
||||
c-5.326-6.125-12.691-9.684-21.762-10.792l-30.479-3.724l-12.705,62.759l20.911,2.555l4.606-22.753L586.341,450.857
|
||||
M255.742,380.679c2.578-3.255,4.317-6.859,5.138-10.911c0.818-4.045,0.571-7.81-0.612-11.442c-0.99-3.107-2.818-6.071-5.299-8.78
|
||||
c-5.327-6.125-12.578-9.752-21.747-10.872l-30.479-3.725l-12.688,62.679l21.204,2.591l1.722-8.505l9.274,1.133
|
||||
c9.169,1.121,17.485-0.515,24.977-5.081C250.663,385.778,253.572,383.4,255.742,380.679 M511.946,436.958L518.507,420
|
||||
l-30.966-3.784l1.245-6.151l25.153,3.074l5.827-15.308l-27.815-3.399l1.229-6.071l27.816,3.399l3.541-17.492l-49.313-6.025
|
||||
l-12.688,62.679L511.946,436.958"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#C12D25" d="M321.9,365.356c5.325,0.65,9.647,2.754,12.761,6.376c3.189,3.706,4.405,7.67,3.521,12.044
|
||||
c-0.129,0.637-0.295,1.256-0.496,1.854c-1.228,3.664-3.792,6.615-7.63,8.855c-3.775,2.318-7.958,3.361-12.439,3.196
|
||||
c-0.733-0.027-1.475-0.087-2.224-0.178c-5.521-0.675-9.744-2.767-12.957-6.394c-3.221-3.545-4.322-7.586-3.404-12.119
|
||||
c0.885-4.373,3.512-7.868,8.01-10.635C311.533,365.665,316.38,364.682,321.9,365.356z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#C12D25" d="M48.683,265.839l41.752,14.893c-13.224,24.004-22.266,48.071-27.152,72.206
|
||||
c-4.736,23.393-5.568,46.849-2.521,70.379l-44.903,4.14l-0.62,0.097C8.028,373.31,19.125,319.48,48.683,265.839z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#F2F2F2" d="M350.646,362.146c6.432,7.179,8.653,15.165,6.866,23.991c-1.803,8.906-7.09,16.065-16.029,21.276
|
||||
c-8.877,5.39-18.668,7.346-29.319,6.044c-10.846-1.325-19.498-5.534-25.71-12.769c-6.449-7.091-8.751-15.177-6.948-24.083
|
||||
c1.787-8.826,7.154-15.886,16.111-21.184c8.753-5.315,18.668-7.346,29.514-6.021C335.781,350.704,344.31,354.987,350.646,362.146z
|
||||
M337.686,385.631c0.202-0.599,0.367-1.218,0.496-1.854c0.885-4.374-0.331-8.338-3.521-12.044
|
||||
c-3.113-3.622-7.436-5.726-12.761-6.376c-5.521-0.675-10.367,0.309-14.859,3.001c-4.498,2.767-7.125,6.262-8.01,10.635
|
||||
c-0.918,4.533,0.184,8.574,3.404,12.119c3.213,3.627,7.437,5.719,12.957,6.394c0.749,0.091,1.49,0.15,2.224,0.178
|
||||
c4.481,0.165,8.664-0.878,12.439-3.196C333.894,392.246,336.458,389.295,337.686,385.631"/>
|
||||
</g>
|
||||
<g>
|
||||
<polygon fill="#F2F2F2" points="524.537,374.268 520.996,391.76 493.18,388.36 491.951,394.432 519.768,397.83 513.939,413.138
|
||||
488.786,410.064 487.541,416.216 518.508,419.999 511.946,436.958 462.536,430.921 475.225,368.242 "/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#F2F2F2" d="M60.761,423.323c3.163,23.285,10.047,46.696,20.938,70.268l-42.905,13.765
|
||||
c-12.27-26.728-20.128-53.327-23.555-79.803l0.618-0.089L60.761,423.323z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#C12D25" d="M783.679,355.646c6.958,53.958-4.236,107.775-33.68,161.347l-41.654-14.879
|
||||
c13.134-24.055,22.193-48.08,27.109-72.171c4.765-23.349,5.638-46.76,2.628-70.241L783.679,355.646z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#F2F2F2" d="M663.709,380.652c10.954,12.288,14.837,26.041,11.755,41.266l-0.918,4.535
|
||||
c-0.479,2.366-1.104,4.656-1.88,6.874c-4.184,11.975-12.688,21.785-25.596,29.522c-12.448,7.46-25.979,11.165-40.619,11.011
|
||||
c-3.207-0.033-6.468-0.251-9.782-0.656l-16.961-2.072c-4.142,17.993-8.702,36.025-13.661,54.007
|
||||
c-0.455,1.63-0.825,3.181-1.116,4.65c-0.642,3.231-0.899,6.068-0.831,8.474c0.199,3.512,1.709,6.519,4.735,9.048
|
||||
c1.749,1.338,4.366,2.443,7.683,3.48c3.942,1.391,6.499,2.074,8.655,2.338c0.854,0.104,1.646,0.144,2.371,0.112l-5.137,16.386
|
||||
c-39.196,0.438-75.241-0.232-107.93-1.985l4.38-17.636l10.678-0.854c4.39-0.21,7.779-0.961,10.029-2.098
|
||||
c4.27-2.131,7.457-4.892,9.612-8.535c2.193-3.376,4.033-7.969,5.482-13.602c5.115-20.286,9.97-40.271,14.458-59.968l-86.19-10.531
|
||||
c-4.18,19.653-8.596,39.943-13.265,61.031c-0.108,0.491-0.211,0.979-0.308,1.462c-0.873,4.364-1.246,8.423-1.036,12.092
|
||||
c0.563,4.769,2.099,8.197,4.92,11.193c1.652,1.368,4.363,2.939,8.171,4.567c3.639,1.521,6.961,2.592,9.931,3.373l-4.347,17.976
|
||||
c-26.743-1.897-53.402-4.485-79.907-7.724c-3.281-0.401-6.562-0.813-9.835-1.232c-2.995-0.385-5.986-0.778-8.976-1.179
|
||||
c-2.42-0.327-3.259-0.439-4.097-0.556c-1.088-0.147-2.175-0.297-3.264-0.448l3.461-18.085l10.465-0.297
|
||||
c5.017-0.298,8.489-0.957,10.354-1.723c3.569-1.64,6.578-4.505,9.019-8.606c2.072-3.729,3.847-8.492,5.011-14.243l12.818-63.819
|
||||
L277.938,434.26c-3.592,19.226-6.979,38.476-10.173,57.757c-0.133,0.891-0.254,1.762-0.357,2.616
|
||||
c-0.565,4.608-0.697,8.676-0.207,12.17c0.523,4.158,2.193,7.841,5.27,11.071c1.849,1.658,4.875,3.693,9.516,6.248
|
||||
c4.173,2.338,7.788,3.938,10.93,4.904l-3.185,18.2c-34.809-6.02-69.386-13.187-104.016-21.443
|
||||
c-1.116-0.266-2.232-0.534-3.35-0.803l1.747-17.128l11.428,0.479c0.684,0.061,1.339,0.106,1.968,0.142
|
||||
c3.84,0.205,6.635-0.094,8.203-0.968c3.589-1.442,6.277-3.745,7.935-7.048c1.79-3.937,2.793-7.115,3.488-10.587
|
||||
c0.272-1.358,0.497-2.763,0.676-4.211c2.785-19.241,5.962-38.438,9.341-57.605l-45.069-5.507
|
||||
c-3.314-0.405-6.506-0.976-9.577-1.709c-14.019-3.348-25.508-10.11-34.494-20.188c-9.146-10.433-13.351-21.796-12.601-34.189
|
||||
c0.139-2.296,0.448-4.625,0.927-6.991l0.918-4.534c3.082-15.226,12.211-27.389,27.395-36.482
|
||||
c15.299-9.169,32.136-12.504,50.579-10.25l46.251,5.651c6.353-25.364,13.201-50.748,20.671-76.147l-29.583,1.868
|
||||
c-5.864,1.023-14.246,8.961-25.187,23.555c-11.151,14.656-19.816,28.033-25.942,40.318l-11.213-0.541
|
||||
c7.422-27.145,16.393-55.012,26.697-83.454c64.293-3.101,127.686-1.747,189.963,4.121l-20.483,94.177l-11.138-1.36
|
||||
c0.171-12.616-0.928-26.337-3.125-41.272c-0.229-1.545-0.467-3.102-0.718-4.673c-2.763-16.275-6.579-25.368-11.463-27.211
|
||||
l-10.682-2.135c-2.049-0.373-3.985-0.671-5.811-0.894c-1.823-0.223-3.538-0.371-5.142-0.444l-6.555-0.553
|
||||
c-7.055,26.852-13.712,53.761-19.896,80.804l113.218,13.834l11.188-55.813c1.114-5.502,1.545-10.102,1.166-13.711
|
||||
c-0.564-4.221-2.279-7.747-5.32-10.695c-1.904-2.054-4.979-4.343-9.201-6.935c-3.746-1.818-6.559-3.065-8.457-3.727l3.631-18.35
|
||||
c3.682,0.38,7.357,0.776,11.032,1.191c3.839,0.433,7.38,0.849,10.92,1.281c23.464,2.88,45.971,6.307,68.273,10.349
|
||||
c1.73,0.314,3.458,0.631,5.186,0.952c1.348,0.251,2.693,0.503,4.038,0.757c1.323,0.251,2.647,0.503,3.97,0.759l-2.623,17.939
|
||||
l-10.425,0.548c-0.554,0.114-1.084,0.222-1.592,0.327c-4.135,0.847-6.765,1.385-7.94,1.833c-3.605,1.238-6.34,3.715-8.273,7.354
|
||||
c-2.162,5.086-3.446,8.973-4.221,12.729c-0.142,0.694-0.269,1.386-0.376,2.073c-2.535,14.543-5.997,33.621-10.491,57.307
|
||||
l85.605,10.46c2.716-16.927,5.223-33.799,7.631-50.682c0.807-5.467,0.722-10.039,0.043-13.691
|
||||
c-0.712-3.985-2.704-7.629-5.859-11.001c-1.631-1.76-4.337-3.936-7.999-6.661c-5.351-3.274-8.338-4.962-9.641-5.539l2.312-17.888
|
||||
c34.317,7.18,68.129,15.875,101.254,25.98l-0.934,16.563l-9.626-0.84c-4.602,0.267-7.924,0.689-10.042,1.178
|
||||
c-3.472,1.152-5.982,3.586-7.526,7.213c-1.065,2.602-1.811,5.076-2.408,8c-0.299,1.465-0.562,3.039-0.778,4.726
|
||||
c-1.762,16.208-3.738,32.486-6.128,48.789l18.336,2.241C638.259,361.112,652.877,368.291,663.709,380.652z M636.226,455.049
|
||||
c13.455-8.065,21.58-18.775,24.301-32.215c2.705-13.366-0.798-25.49-10.417-36.375c-9.62-10.885-22.577-17.284-38.847-19.271
|
||||
l-401.176-49.019c-16.277-1.989-31.226,1.001-44.691,9.064c-13.35,8.078-21.481,18.78-24.188,32.146
|
||||
c-0.468,2.31-0.752,4.581-0.853,6.813c-0.484,10.76,3.277,20.627,11.156,29.629c8.892,9.962,20.66,16.251,35.197,18.731
|
||||
c1.232,0.209,2.484,0.393,3.756,0.548l401.176,49.02C607.91,466.108,622.785,463.033,636.226,455.049"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#F2F2F2" d="M708.247,502.102l41.752,14.892c-14.515,26.28-32.071,50.109-52.597,71.165l-35.299-23.313
|
||||
C680.133,546.137,695.578,525.283,708.247,502.102z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#C12D25" d="M81.698,493.591c19.637,42.608,48.605,77.928,86.963,106.026c4.711,3.45,9.563,6.792,14.558,10.025
|
||||
l-29.097,29.389c-51.736-33.455-90.232-77.412-115.329-131.676L81.698,493.591z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#F2F2F2" d="M183.219,609.643c22.441,14.446,47.559,26.641,75.731,36.723l-18.783,34.383
|
||||
c-32.048-11.385-60.673-25.256-86.045-41.717L183.219,609.643z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#C12D25" d="M662.104,564.846l35.299,23.313c-41.646,42.956-95.961,75.163-162.68,96.713l-16.201-34.759
|
||||
C577.442,631.09,625.22,602.736,662.104,564.846z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#F2F2F2" d="M518.521,650.112l16.006,34.735c-32.753,10.523-65.37,17.405-97.975,20.725l-4.374-37.294
|
||||
C460.874,665.31,489.582,659.272,518.521,650.112z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#C12D25" d="M258.95,646.365c29.027,10.4,58.143,17.38,87.391,20.979c26.16,3.174,51.748,3.699,77.446,1.682
|
||||
c0.917-0.072,1.828-0.146,2.745-0.225c2.136-0.185,3.889-0.348,5.646-0.523l4.374,37.294c-32.38,3.288-64.624,2.958-96.736-0.965
|
||||
c-33.375-4.078-66.605-12.042-99.649-23.859L258.95,646.365z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#C74A34" d="M14.535,434.404c-0.404-9.57-0.808-19.139-1.212-28.708c0.308,7.278,0.945,14.563,1.915,21.856
|
||||
l1.212,28.709C15.48,448.969,14.842,441.683,14.535,434.404z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#BFBFBF" d="M38.793,507.355l1.212,28.71c-12.271-26.728-20.128-53.327-23.555-79.804l-1.212-28.709
|
||||
C18.665,454.028,26.523,480.628,38.793,507.355z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#801E18" d="M785.465,376.509c0.403,9.571,0.808,19.141,1.211,28.711c1.982,46.968-9.817,93.818-35.465,140.483
|
||||
l-1.212-28.71C775.646,470.328,787.447,423.478,785.465,376.509z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#BFBFBF" d="M749.999,516.993l1.212,28.71c-14.516,26.28-32.072,50.109-52.597,71.165l-1.212-28.71
|
||||
C717.928,567.103,735.484,543.273,749.999,516.993z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#801E18" d="M154.122,639.031l1.212,28.71c-51.737-33.455-90.233-77.412-115.329-131.676l-1.212-28.71
|
||||
C63.89,561.619,102.386,605.576,154.122,639.031z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#BFBFBF" d="M240.167,680.748l1.211,28.71c-32.047-11.385-60.672-25.256-86.044-41.717l-1.212-28.71
|
||||
C179.494,655.492,208.119,669.363,240.167,680.748z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#801E18" d="M697.402,588.158l1.212,28.71c-41.646,42.956-95.961,75.163-162.68,96.713l-1.212-28.71
|
||||
C601.441,663.321,655.756,631.114,697.402,588.158z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#BFBFBF" d="M534.527,684.848l1.212,28.71c-32.753,10.523-65.37,17.405-97.975,20.725l-1.212-28.71
|
||||
C469.157,702.253,501.774,695.371,534.527,684.848z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#801E18" d="M436.553,705.572l1.212,28.71c-32.38,3.288-64.625,2.958-96.736-0.966
|
||||
c-33.375-4.077-66.605-12.041-99.65-23.858l-1.211-28.71c33.044,11.817,66.274,19.781,99.649,23.859
|
||||
C371.929,708.53,404.173,708.86,436.553,705.572z"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 3.7 MiB |
@@ -0,0 +1,3 @@
|
||||
//global color definition
|
||||
var accentColor = "#FF9800";
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
//global tools definition
|
||||
|
||||
function correctTextFieldIntegerValue(readyComponent, textValue, minValue, maxValue) {
|
||||
if(readyComponent.ready) {
|
||||
var returnValue = "";
|
||||
if(textValue == "" || parseInt(textValue) == 0 || isNaN(parseInt(textValue)) || parseInt(textValue) < parseInt(minValue)) {
|
||||
returnValue = parseInt(minValue);
|
||||
}
|
||||
else if(maxValue && parseInt(textValue) > parseInt(maxValue)) {
|
||||
returnValue = parseInt(maxValue);
|
||||
}
|
||||
else {
|
||||
returnValue = parseInt(textValue); //remove leading "0000"
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,181 @@
|
||||
import QtQuick 2.4
|
||||
import QtQuick.Controls 1.3
|
||||
import QtQuick.Controls.Styles 1.2
|
||||
import QtQuick.Window 2.2
|
||||
import QtQuick.Dialogs 1.2
|
||||
import "views/startview"
|
||||
import "js/colors.js" as GlobalColors
|
||||
import "components/styles"
|
||||
|
||||
ApplicationWindow {
|
||||
id: appWindow
|
||||
title: qsTr("PokerTH - The open source poker app")
|
||||
//send infos about app size to the style
|
||||
width: 1024
|
||||
height: 600
|
||||
minimumWidth: 320
|
||||
minimumHeight: 240
|
||||
visible: true
|
||||
|
||||
onHeightChanged: { AppStyle.appHeight = height }
|
||||
onWidthChanged: { AppStyle.appWidth = width }
|
||||
|
||||
Component.onCompleted: {
|
||||
// initial info about app size for the style
|
||||
AppStyle.appHeight = height
|
||||
AppStyle.appWidth = width
|
||||
}
|
||||
|
||||
|
||||
toolBar: Rectangle {
|
||||
id: toolbar
|
||||
opacity: 1
|
||||
Behavior on opacity { NumberAnimation{} }
|
||||
color: GlobalColors.accentColor
|
||||
width: appWindow.width
|
||||
height: appWindow.height*0.13
|
||||
Behavior on y { NumberAnimation{} }
|
||||
|
||||
function show() {
|
||||
visible = true;
|
||||
y = 0;
|
||||
|
||||
}
|
||||
|
||||
function hide() {
|
||||
y = -height;
|
||||
visible = false;
|
||||
}
|
||||
|
||||
Rectangle { //Shadow
|
||||
y: parent.height
|
||||
width: parent.width
|
||||
height: parent.height*0.07
|
||||
gradient: Gradient {
|
||||
GradientStop { position: 0.0; color: Qt.rgba(0,0,0,0.5) }
|
||||
GradientStop { position: 1.0; color: Qt.rgba(0,0,0,0.0) }
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: toolBarLeftButton
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
antialiasing: true
|
||||
height: parent.height
|
||||
width: parent.height
|
||||
radius: 4
|
||||
color: toolBarLeftButtonMouse.pressed ? Qt.rgba(0,0,0,0.3) : "transparent"
|
||||
property string myIconName: ""
|
||||
property string myIconPath: ""
|
||||
signal clicked();
|
||||
|
||||
function setIconPath(name) {
|
||||
switch(name) {
|
||||
case "PokerTH": myIconPath = "images/pokerth-logo.svg"
|
||||
break;
|
||||
case "back": myIconPath = "images/arrow_back.svg"
|
||||
break;
|
||||
default: myIconPath = ""
|
||||
}
|
||||
}
|
||||
onMyIconNameChanged: setIconPath(myIconName)
|
||||
onClicked: stackView.pop()
|
||||
|
||||
Image {
|
||||
sourceSize.height: parent.height*0.8
|
||||
fillMode: Image.PreserveAspectFit
|
||||
anchors.centerIn: parent
|
||||
source: parent.myIconPath
|
||||
}
|
||||
MouseArea {
|
||||
id: toolBarLeftButtonMouse
|
||||
anchors.fill: parent
|
||||
anchors.margins: -10
|
||||
onClicked: parent.clicked()
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
id: toolBarText
|
||||
font.pixelSize: Math.min(parent.height*0.5, parent.width*0.08)
|
||||
x: toolBarLeftButton.x + toolBarLeftButton.width*1.5
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: "white"
|
||||
text: "PokerTH"
|
||||
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: toolBarRightButton
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.right: parent.right
|
||||
antialiasing: true
|
||||
height: parent.height
|
||||
width: parent.height
|
||||
radius: 4
|
||||
color: toolBarRightButtonMouse.pressed ? Qt.rgba(0,0,0,0.3) : "transparent"
|
||||
property string myIconName: ""
|
||||
property string myIconPath: ""
|
||||
signal clicked();
|
||||
|
||||
function setIconPath(name) {
|
||||
switch(name) {
|
||||
case "accept": myIconPath = "images/check.svg"
|
||||
break;
|
||||
case "more": myIconPath = "images/more_vert.svg"
|
||||
break;
|
||||
default: myIconPath = ""
|
||||
}
|
||||
}
|
||||
onMyIconNameChanged: setIconPath(myIconName)
|
||||
|
||||
Image {
|
||||
sourceSize.height: parent.height*0.8
|
||||
fillMode: Image.PreserveAspectFit
|
||||
anchors.centerIn: parent
|
||||
source: parent.myIconPath
|
||||
}
|
||||
MouseArea {
|
||||
id: toolBarRightButtonMouse
|
||||
anchors.fill: parent
|
||||
anchors.margins: -10
|
||||
onClicked: parent.clicked();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StackView {
|
||||
id: stackView
|
||||
anchors.fill: parent
|
||||
// Implements back key navigation
|
||||
focus: true
|
||||
Keys.onReleased: if (event.key === Qt.Key_Back && stackView.depth > 1) {
|
||||
stackView.pop();
|
||||
event.accepted = true;
|
||||
}
|
||||
|
||||
initialItem: StartView { }
|
||||
|
||||
// delegate: StackViewDelegate {
|
||||
// function transitionFinished(properties)
|
||||
// {
|
||||
// properties.exitItem.opacity = 1
|
||||
// }
|
||||
|
||||
// pushTransition: StackViewTransition {
|
||||
// PropertyAnimation {
|
||||
// target: enterItem
|
||||
// property: "opacity"
|
||||
// from: 0
|
||||
// to: 1
|
||||
// }
|
||||
// PropertyAnimation {
|
||||
// target: exitItem
|
||||
// property: "opacity"
|
||||
// from: 1
|
||||
// to: 0
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>main.qml</file>
|
||||
<file>components/MyListViewDelegateFactory.qml</file>
|
||||
<file>images/arrow_back.svg</file>
|
||||
<file>images/button-default.png</file>
|
||||
<file>images/button-pressed.png</file>
|
||||
<file>images/check.svg</file>
|
||||
<file>images/more_vert.svg</file>
|
||||
<file>images/pokerth-logo.svg</file>
|
||||
<file>images/startViewBackground.png</file>
|
||||
<file>views/startview/StartButton.qml</file>
|
||||
<file>views/startview/StartView.qml</file>
|
||||
<file>views/createlocalgameview/CreateLocalGameView.qml</file>
|
||||
<file>components/MyComboBoxSelector.qml</file>
|
||||
<file>js/colors.js</file>
|
||||
<file>components/MySpinBoxSelector.qml</file>
|
||||
<file>views/gametableview/GameTableView.qml</file>
|
||||
<file>components/MyBlindsRaiseIntervalSelector.qml</file>
|
||||
<file>components/styles/MyTextFieldStyle.qml</file>
|
||||
<file>components/styles/MyRadioButtonStyle.qml</file>
|
||||
<file>js/tools.js</file>
|
||||
<file>components/MyBlindsRaiseModeSelector.qml</file>
|
||||
<file>components/styles/AppStyle.qml</file>
|
||||
<file>components/styles/qmldir</file>
|
||||
<file>components/MyAbstractSelector.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
@@ -0,0 +1,64 @@
|
||||
import QtQuick 2.4
|
||||
import QtQuick.Controls 1.2
|
||||
import QtQuick.Controls.Styles 1.2
|
||||
import QtQuick.Layouts 1.1
|
||||
import "../../components"
|
||||
|
||||
Rectangle {
|
||||
id: createLocalGameViewRoot
|
||||
property string myReadableId: "createLocalGameViewRoot"
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
color: "#FAFAFA"
|
||||
|
||||
ScrollView {
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
|
||||
ListView {
|
||||
id: createLocalGameViewList
|
||||
anchors.fill: parent
|
||||
model: CreateLocalGameViewData
|
||||
delegate: MyListViewDelegateFactory {
|
||||
myListViewsHeight: createLocalGameViewList.height
|
||||
myListViewsWidth: createLocalGameViewList.width
|
||||
myListViewRoot: createLocalGameViewRoot //set this to be able to display the selector over the whole view
|
||||
myListViewModel: CreateLocalGameViewData
|
||||
}
|
||||
Component.onCompleted: {
|
||||
CreateLocalGameViewImpl.readConfigValues()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getListElementValueString(elementName) {
|
||||
//read model and check for the elementName
|
||||
for (var i = 0; i < CreateLocalGameViewData.lenght; i++ ) {
|
||||
if(CreateLocalGameViewData[i].myId == elementName) {
|
||||
return CreateLocalGameViewDat[i].myValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function setupToolBar() {
|
||||
toolbar.show()
|
||||
toolBarRightButton.myIconName = "accept";
|
||||
toolBarLeftButton.myIconName = "back";
|
||||
//send start signal to the session
|
||||
toolBarRightButton.clicked.connect(CreateLocalGameViewImpl.startGame);
|
||||
}
|
||||
|
||||
function clearToolBar() {
|
||||
//disconnect signals from the buttons
|
||||
toolBarRightButton.clicked.disconnect(CreateLocalGameViewImpl.startGame);
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
setupToolBar();
|
||||
}
|
||||
onVisibleChanged: {
|
||||
if(visible) setupToolBar();
|
||||
else clearToolBar();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import QtQuick 2.4
|
||||
import QtQuick.Controls 1.2
|
||||
import QtQuick.Controls.Styles 1.2
|
||||
import QtQuick.Layouts 1.1
|
||||
import "../../components"
|
||||
|
||||
Rectangle {
|
||||
id: gameTableViewRoot
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
|
||||
function setupToolBar() {
|
||||
toolbar.hide();
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
setupToolBar();
|
||||
}
|
||||
onVisibleChanged: {
|
||||
if(visible) setupToolBar()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.2
|
||||
import QtQuick.Controls.Styles 1.2
|
||||
|
||||
Button {
|
||||
property string page
|
||||
|
||||
width: parent.width*0.50
|
||||
height: parent.height/7
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
Component {
|
||||
id: myStyle
|
||||
ButtonStyle {
|
||||
panel: Item {
|
||||
implicitHeight: height
|
||||
implicitWidth: width
|
||||
BorderImage {
|
||||
anchors.fill: parent
|
||||
antialiasing: true
|
||||
border.bottom: 8
|
||||
border.top: 8
|
||||
border.left: 8
|
||||
border.right: 8
|
||||
anchors.margins: control.pressed ? -4 : 0
|
||||
source: control.pressed ? "../../images/button-pressed.png" : "../../images/button-default.png"
|
||||
Text {
|
||||
text: control.text
|
||||
anchors.centerIn: parent
|
||||
color: "white"
|
||||
font.pixelSize: Math.min(parent.width*0.10, parent.height*0.40)
|
||||
renderType: Text.NativeRendering
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
style: myStyle
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
import QtQuick 2.4
|
||||
import QtQuick.Controls 1.2
|
||||
import QtQuick.Layouts 1.1
|
||||
|
||||
Item {
|
||||
id: startView
|
||||
Image {
|
||||
id: background
|
||||
source: "../../images/startViewBackground.png"
|
||||
anchors.fill: parent
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
}
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
StartButton {
|
||||
text: qsTr("Local game")
|
||||
page: "../createlocalgameview/CreateLocalGameView.qml"
|
||||
onClicked: stackView.push(Qt.resolvedUrl(page))
|
||||
//TODO ^^ --> gleich GameTable anzeigen wenn "ShowGameSettingsDialogOnNewGame" == true
|
||||
}
|
||||
|
||||
StartButton {
|
||||
text: qsTr("Internet game")
|
||||
page: "JoinInternetGameView.qml"
|
||||
}
|
||||
|
||||
StartButton {
|
||||
text: qsTr("Logs")
|
||||
page: "LogsView.qml"
|
||||
}
|
||||
}
|
||||
|
||||
function setupToolBar() {
|
||||
toolbar.visible = true;
|
||||
toolBarRightButton.myIconName = "more";
|
||||
toolBarLeftButton.myIconName = "PokerTH";
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
setupToolBar();
|
||||
}
|
||||
onVisibleChanged: {
|
||||
if(visible) setupToolBar()
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifndef ANDROID_TEST
|
||||
#include "QtGui/5.3.0/QtGui/qpa/qplatformnativeinterface.h"
|
||||
#include "QtGui/5.4.0/QtGui/qpa/qplatformnativeinterface.h"
|
||||
#include <jni.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifndef ANDROID_TEST
|
||||
#include "QtGui/5.3.0/QtGui/qpa/qplatformnativeinterface.h"
|
||||
#include "QtGui/5.4.0/QtGui/qpa/qplatformnativeinterface.h"
|
||||
#include <jni.h>
|
||||
#endif
|
||||
#endif
|
||||
@@ -875,7 +875,6 @@ void gameTableImpl::initGui(int speed)
|
||||
|
||||
//set WindowTitle dynamically
|
||||
QString titleString = "";
|
||||
assert(myStartWindow->getSession());
|
||||
if(myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_INTERNET || myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_NETWORK) {
|
||||
GameInfo info(myStartWindow->getSession()->getClientGameInfo(myStartWindow->getSession()->getClientCurrentGameId()));
|
||||
titleString = QString::fromUtf8(info.name.c_str())+" - ";
|
||||
@@ -938,7 +937,6 @@ void gameTableImpl::initGui(int speed)
|
||||
|
||||
boost::shared_ptr<Session> gameTableImpl::getSession()
|
||||
{
|
||||
assert(myStartWindow->getSession().get());
|
||||
return myStartWindow->getSession();
|
||||
}
|
||||
|
||||
@@ -1959,8 +1957,6 @@ void gameTableImpl::meInAction()
|
||||
|
||||
void gameTableImpl::startTimeoutAnimation(int playerId, int timeoutSec)
|
||||
{
|
||||
assert(playerId >= 0 && playerId < myStartWindow->getSession()->getCurrentGame()->getStartQuantityPlayers());
|
||||
|
||||
//beep for player 0
|
||||
if(playerId) {
|
||||
timeoutLabelArray[playerId]->startTimeOutAnimation(timeoutSec, false);
|
||||
@@ -1971,7 +1967,6 @@ void gameTableImpl::startTimeoutAnimation(int playerId, int timeoutSec)
|
||||
|
||||
void gameTableImpl::stopTimeoutAnimation(int playerId)
|
||||
{
|
||||
assert(playerId >= 0 && playerId < myStartWindow->getSession()->getCurrentGame()->getStartQuantityPlayers());
|
||||
timeoutLabelArray[playerId]->stopTimeOutAnimation();
|
||||
}
|
||||
|
||||
@@ -3833,11 +3828,9 @@ void gameTableImpl::leaveCurrentNetworkGame()
|
||||
|
||||
if(!myUniversalMessageDialog->checkIfMesssageWillBeDisplayed(BACKTO_LOBBY_QUESTION)) {
|
||||
|
||||
assert(myStartWindow->getSession());
|
||||
myStartWindow->getSession()->sendLeaveCurrentGame();
|
||||
} else {
|
||||
if (myUniversalMessageDialog->exec(BACKTO_LOBBY_QUESTION, tr("Attention! Do you really want to leave the current game\nand go back to the lobby?"), tr("PokerTH - Internet Game Message"), QPixmap(":/gfx/logoChip3D.png"), QDialogButtonBox::Yes|QDialogButtonBox::No, true) == QDialog::Accepted) {
|
||||
assert(myStartWindow->getSession());
|
||||
myStartWindow->getSession()->sendLeaveCurrentGame();
|
||||
}
|
||||
}
|
||||
@@ -3847,13 +3840,15 @@ void gameTableImpl::leaveCurrentNetworkGame()
|
||||
void gameTableImpl::triggerVoteOnKick(int id)
|
||||
{
|
||||
|
||||
assert(myStartWindow->getSession()->getCurrentGame());
|
||||
PlayerList seatList = myStartWindow->getSession()->getCurrentGame()->getSeatsList();
|
||||
int playerCount = static_cast<int>(seatList->size());
|
||||
if (id < playerCount) {
|
||||
PlayerListIterator pos = seatList->begin();
|
||||
advance(pos, id);
|
||||
myStartWindow->getSession()->startVoteKickPlayer((*pos)->getMyUniqueID());
|
||||
if (myStartWindow->getSession()->getCurrentGame())
|
||||
{
|
||||
PlayerList seatList = myStartWindow->getSession()->getCurrentGame()->getSeatsList();
|
||||
int playerCount = static_cast<int>(seatList->size());
|
||||
if (id < playerCount) {
|
||||
PlayerListIterator pos = seatList->begin();
|
||||
advance(pos, id);
|
||||
myStartWindow->getSession()->startVoteKickPlayer((*pos)->getMyUniqueID());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4473,7 +4468,6 @@ void gameTableImpl::checkActionLabelPosition()
|
||||
|
||||
void gameTableImpl::refreshSpectatorsDisplay()
|
||||
{
|
||||
assert(myStartWindow->getSession());
|
||||
GameInfo info(myStartWindow->getSession()->getClientGameInfo(myStartWindow->getSession()->getClientCurrentGameId()));
|
||||
if(!info.spectatorsDuringGame.empty()) {
|
||||
spectatorIcon->show();
|
||||
|
||||
@@ -290,12 +290,12 @@ void guiLog::logPlayerJoinedMsg(QString playerName)
|
||||
#endif
|
||||
}
|
||||
|
||||
void guiLog::logSpectatorLeftMsg(QString playerName, int wasKicked)
|
||||
void guiLog::logSpectatorLeftMsg(QString /*playerName*/, int /*wasKicked*/)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void guiLog::logSpectatorJoinedMsg(QString playerName)
|
||||
void guiLog::logSpectatorJoinedMsg(QString /*playerName*/)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
@@ -71,9 +71,7 @@ MyAvatarLabel::~MyAvatarLabel()
|
||||
|
||||
void MyAvatarLabel::contextMenuEvent ( QContextMenuEvent *event )
|
||||
{
|
||||
|
||||
assert(myW->getSession()->getCurrentGame());
|
||||
if (myW->getSession()->isNetworkClientRunning()) {
|
||||
if (myW->getSession()->getCurrentGame() && myW->getSession()->isNetworkClientRunning()) {
|
||||
|
||||
boost::shared_ptr<PlayerInterface> humanPlayer = myW->getSession()->getCurrentGame()->getSeatsList()->front();
|
||||
//only active players are allowed to start a vote
|
||||
|
||||
@@ -64,6 +64,7 @@ GuiWrapper::~GuiWrapper()
|
||||
void GuiWrapper::initGui(int speed)
|
||||
{
|
||||
myW->signalInitGui(speed);
|
||||
qDebug("GuiWrapper::initGui");
|
||||
}
|
||||
|
||||
boost::shared_ptr<Session> GuiWrapper::getSession()
|
||||
@@ -78,47 +79,58 @@ void GuiWrapper::setSession(boost::shared_ptr<Session> /*session*/)
|
||||
void GuiWrapper::refreshSet() const
|
||||
{
|
||||
myW->signalRefreshSet();
|
||||
qDebug("GuiWrapper::refreshSet");
|
||||
}
|
||||
void GuiWrapper::refreshCash() const
|
||||
{
|
||||
myW->signalRefreshCash();
|
||||
qDebug("GuiWrapper::refreshCash");
|
||||
}
|
||||
void GuiWrapper::refreshAction(int playerID, int playerAction) const
|
||||
{
|
||||
myW->signalRefreshAction(playerID, playerAction);
|
||||
qDebug("GuiWrapper::refreshAction");
|
||||
}
|
||||
void GuiWrapper::refreshChangePlayer() const
|
||||
{
|
||||
myW->signalRefreshChangePlayer();
|
||||
qDebug("GuiWrapper::refreshChangePlayer");
|
||||
}
|
||||
void GuiWrapper::refreshAll() const
|
||||
{
|
||||
myW->signalRefreshAll();
|
||||
qDebug("GuiWrapper::refreshAll");
|
||||
}
|
||||
void GuiWrapper::refreshPot() const
|
||||
{
|
||||
myW->signalRefreshPot();
|
||||
qDebug("GuiWrapper::refreshPot");
|
||||
}
|
||||
void GuiWrapper::refreshGroupbox(int playerID, int status) const
|
||||
{
|
||||
myW->signalRefreshGroupbox(playerID, status);
|
||||
qDebug("GuiWrapper::refreshGroupbox");
|
||||
}
|
||||
void GuiWrapper::refreshPlayerName() const
|
||||
{
|
||||
myW->signalRefreshPlayerName();
|
||||
qDebug("GuiWrapper::refreshPlayerName");
|
||||
}
|
||||
void GuiWrapper::refreshButton() const
|
||||
{
|
||||
myW->signalRefreshButton();
|
||||
qDebug("GuiWrapper::refreshButton");
|
||||
}
|
||||
void GuiWrapper::refreshGameLabels(GameState state) const
|
||||
{
|
||||
myW->signalRefreshGameLabels(state);
|
||||
qDebug("GuiWrapper::refreshGameLabels");
|
||||
}
|
||||
|
||||
void GuiWrapper::setPlayerAvatar(int myUniqueID, const std::string &myAvatar) const
|
||||
{
|
||||
myW->signalSetPlayerAvatar(myUniqueID, QString::fromUtf8(myAvatar.c_str()));
|
||||
qDebug("GuiWrapper::setPlayerAvatar");
|
||||
}
|
||||
|
||||
|
||||
@@ -126,47 +138,57 @@ void GuiWrapper::waitForGuiUpdateDone() const
|
||||
{
|
||||
myW->signalGuiUpdateDone();
|
||||
myW->waitForGuiUpdateDone();
|
||||
qDebug("GuiWrapper::waitForGuiUpdateDone");
|
||||
}
|
||||
|
||||
void GuiWrapper::dealBeRoCards(int myBeRoID)
|
||||
{
|
||||
myW->signalDealBeRoCards(myBeRoID);
|
||||
qDebug("GuiWrapper::dealBeRoCards");
|
||||
}
|
||||
|
||||
void GuiWrapper::dealHoleCards()
|
||||
{
|
||||
myW->signalDealHoleCards();
|
||||
qDebug("GuiWrapper::dealHoleCards");
|
||||
}
|
||||
void GuiWrapper::dealFlopCards()
|
||||
{
|
||||
myW->signalDealFlopCards0();
|
||||
qDebug("GuiWrapper::dealFlopCard");
|
||||
}
|
||||
void GuiWrapper::dealTurnCard()
|
||||
{
|
||||
myW->signalDealTurnCards0();
|
||||
qDebug("GuiWrapper::dealTurnCard");
|
||||
}
|
||||
void GuiWrapper::dealRiverCard()
|
||||
{
|
||||
myW->signalDealRiverCards0();
|
||||
qDebug("GuiWrapper::dealRiverCard");
|
||||
}
|
||||
|
||||
void GuiWrapper::nextPlayerAnimation()
|
||||
{
|
||||
myW->signalNextPlayerAnimation();
|
||||
qDebug("GuiWrapper::nextPlayerAnimation");
|
||||
}
|
||||
|
||||
void GuiWrapper::beRoAnimation2(int myBeRoID)
|
||||
{
|
||||
myW->signalBeRoAnimation2(myBeRoID);
|
||||
qDebug("GuiWrapper::beRoAnimantion2");
|
||||
}
|
||||
|
||||
void GuiWrapper::preflopAnimation1()
|
||||
{
|
||||
myW->signalPreflopAnimation1();
|
||||
qDebug("GuiWrapper::preflopAnimation1");
|
||||
}
|
||||
void GuiWrapper::preflopAnimation2()
|
||||
{
|
||||
myW->signalPreflopAnimation2();
|
||||
qDebug("GuiWrapper::preFlopAnimation2");
|
||||
}
|
||||
|
||||
void GuiWrapper::flopAnimation1()
|
||||
|
||||