diff --git a/.gitignore b/.gitignore index f84e2b3..c3e225f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,33 +1,19 @@ # C++ objects and libs - *.slo *.lo *.o *.a *.la *.lai -*.so* +*.so +*.so.* *.dll *.dylib -*.exe # Qt-es -/Build* -/build* -SnakeClient/Client/build/ -SnakeClient/SnakeApp/build/ -SnakeServer/Server/build/ -SnakeServer/serverProtocolTests/build/ -SnakeServer/Terminal/build -*.stash -/Release* -/parts/* -/prime/* -/snap/.snapcraft/* -/stage/* -/Build-* -/Release-* -*.stash +object_script.*.Release +object_script.*.Debug +*_plugin_import.cpp /.qmake.cache /.qmake.stash *.pro.user @@ -39,46 +25,43 @@ moc_*.cpp moc_*.h qrc_*.cpp ui_*.h +*.qmlc +*.jsc Makefile* *build-* -*_qml.cpp -*.snap +tests/build/ +src/build/ *.qm -qml_qmlcache.qrc -qmlcache_loader.cpp -snake -SnakeServer/Terminal/build/debug/Terminal +*.prl + +# Qt unit tests +target_wrapper.* # QtCreator -installer/HanoiTowersInstaller *.autosave -installer/installer -# QtCtreator Qml +# QtCreator Qml *.qmlproject.user *.qmlproject.user.* -# QtCtreator CMake +# QtCreator CMake CMakeLists.txt.user* -installer/packages/Snake/data -\.buildconfig -SnakeServer/Daemon/build/* +# QtCreator 4.8< compilation database +compile_commands.json -SnakeServer/Client/build/*/Client +# QtCreator local machine specific files for imported projects +*creator.user* -SnakeServer/Daemon/build/*/Daemon - -SnakeServer/serverProtocolTests/target_wrapper\.sh - -SnakeServer/serverProtocolTests/serverProtocolTests - -deployTests/ - -installer/SnakeInstaller - -Distro/ - -android-build/ - -*.db +CMakeLists.txt.user +CMakeCache.txt +CMakeFiles +CMakeScripts +Testing +Makefile +cmake_install.cmake +install_manifest.txt +compile_commands.json +CTestTestfile.cmake +_deps +*_autogen* diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 6072d35..0000000 --- a/.gitmodules +++ /dev/null @@ -1,10 +0,0 @@ -[submodule "QuasarAppLib"] - path = QuasarAppLib - url = https://github.com/QuasarApp/QuasarAppLib.git - -[submodule "SnakeServer/Qt-Secret"] - path = SnakeServer/Qt-Secret - url = git@github.com:QuasarApp/Qt-Secret.git -[submodule "installer"] - path = installer - url = git@github.com:QuasarApp/DesktopInstaller.git diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..384b03a --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,60 @@ +# +# Copyright (C) 2020-2021 QuasarApp. +# Distributed under the lgplv3 software license, see the accompanying +# Everyone is permitted to copy and distribute verbatim copies +# of this license document, but changing it is not allowed. +# + +cmake_minimum_required(VERSION 3.14) +project(SnakeProject) +if(TARGET ${PROJECT_NAME}) + message("The ${PROJECT_NAME} arledy included in main Project") + return() +endif() + +set(CMAKE_INCLUDE_CURRENT_DIR ON) +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Test QUIET) +find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Test QUIET) + +include(submodules/CMake/ccache.cmake) +include(submodules/CMake/QuasarAppCITargets.cmake) + +# Add sub directories +add_subdirectory(src) + +if (NOT DEFINED SnakeProject_TESTS) + set(SnakeProject_TESTS ON) + + if (DEFINED TARGET_PLATFORM_TOOLCHAIN) + if (${TARGET_PLATFORM_TOOLCHAIN} STREQUAL "wasm32") + set(SnakeProject_TESTS OFF) + endif() + endif() + + if (ANDROID) + set(SnakeProject_TESTS OFF) + endif() + + if (NOT QT_VERSION_MAJOR) + set(SnakeProject_TESTS OFF) + endif() +endif() + + +if (SnakeProject_TESTS) + add_subdirectory(tests) +else() + message("The ${PROJECT_NAME} tests is disabled.") +endif() + +initAll() + +addDoc(${PROJECT_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/doxygen.conf) +addDeployFromCustomFile("SnakeProject" "${CMAKE_CURRENT_SOURCE_DIR}/Deploy/SnakeProject.json") diff --git a/Deploy/SnakeProject.json b/Deploy/SnakeProject.json new file mode 100644 index 0000000..b79b689 --- /dev/null +++ b/Deploy/SnakeProject.json @@ -0,0 +1,19 @@ +{ + "binDir": "./../src/build/Debug/SnakeProjectEaxample", + "clear": true, + "libDir": "./../", + "recursiveDepth": "10", + "deploySystem": false, + "qmlDir": "../", + "ignoreEnv": [ + "./../installer", + "./../Distro", + "./../parts", + "./../snap", + "./../prime", + "./../stage" + ], + "extraLib": "crypto", + "targetDir": "./../DisttibutionKit" +} + diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..65c5ca8 --- /dev/null +++ b/LICENSE @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/QuasarAppLib b/QuasarAppLib deleted file mode 160000 index 553e337..0000000 --- a/QuasarAppLib +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 553e337e6a956534d34dbbfcec42359117aa35d4 diff --git a/README.md b/README.md index 98e10aa..08b0533 100644 --- a/README.md +++ b/README.md @@ -1 +1,15 @@ -# Snake +# CMakeProject +Template repository for cmake project +Fork me and replase SnakeProject to Name of your new project. + +1. Clone this repository +2. Run ./init.sh NewProjectName + +# This template supports next build targets: + +| Command or make target | Description | +|------|------| +| **make test** | The run tests for a project (dependet of Qt Tests, so you need to add Qt in Cmake using CMAKE_PREFIX_PATH) | +| **make doc** | The generate a documentation for a project (dependet of doxygen) | +| **make deploy** | The generate distribution for a project (dependet of CQtDeployer) | +| **make release** | The prepare Qt Installer framework repository for a project, generate a snap package and APK file for android (dependet of CQtDeployer, snapcraft, AndroidDeployer). | diff --git a/SnakeClient/SnakeApp/SnakeApp.pro b/SnakeClient/SnakeApp/SnakeApp.pro deleted file mode 100644 index 4225c5d..0000000 --- a/SnakeClient/SnakeApp/SnakeApp.pro +++ /dev/null @@ -1,116 +0,0 @@ -QT += quick concurrent -CONFIG += c++17 - -# The following define makes your compiler emit warnings if you use -# any feature of Qt which as been marked deprecated (the exact warnings -# depend on your compiler). Please consult the documentation of the -# deprecated API in order to know how to port your code away from it. -DEFINES += QT_DEPRECATED_WARNINGS - -# You can also make your code fail to compile if you use deprecated APIs. -# In order to do so, uncomment the following line. -# You can also select to disable deprecated APIs only up to a certain version of Qt. -#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 - -SOURCES += \ - back-end/ProfileViewItems/mainclient.cpp \ - back-end/ProfileViewItems/mainmenumodel.cpp \ - back-end/ProfileViewItems/networkclient.cpp \ - back-end/ProfileViewItems/notificationdata.cpp \ - back-end/ProfileViewItems/notificationservice.cpp \ - back-end/ProfileViewItems/playerclientdata.cpp \ - back-end/ProfileViewItems/settingsviewmodel.cpp \ - back-end/ProfileViewItems/userview.cpp \ - back-end/asyncimageresponse.cpp \ - back-end/background.cpp \ - back-end/backgrounditem.cpp \ - back-end/baseclass.cpp \ - back-end/box.cpp \ - back-end/clientapp.cpp \ - back-end/controller.cpp \ - back-end/diff.cpp \ - back-end/guiobject.cpp \ - back-end/guiobjectfactory.cpp \ - back-end/head.cpp \ - back-end/imageprovider.cpp \ - back-end/itemworld.cpp \ - back-end/settings.cpp \ - back-end/snake.cpp \ - back-end/world.cpp \ - back-end/main.cpp - - -TARGET = Snake - - -CONFIG(release, debug|release): { - DESTDIR = $$PWD/build/release - -} else { - DESTDIR = $$PWD/build/debug -} - -# Additional import path used to resolve QML modules in Qt Creator's code model -QML_IMPORT_PATH = - -# Additional import path used to resolve QML modules just for Qt Quick Designer -QML_DESIGNER_IMPORT_PATH = - -include($$PWD/../../QuasarAppLib/QuasarLib.pri) -include($$PWD/../../SnakeUtils/SnakeUtils.pri) -include($$PWD/../../SnakeServer/ClientProtocol/ClientProtocol.pri) - -DISTFILES += \ - android/AndroidManifest.xml \ - android/AndroidManifest.xml \ - android/AndroidManifest.xml \ - android/build.gradle \ - android/build.gradle \ - android/gradle/wrapper/gradle-wrapper.jar \ - android/gradle/wrapper/gradle-wrapper.jar \ - android/gradle/wrapper/gradle-wrapper.jar \ - android/gradle/wrapper/gradle-wrapper.properties \ - android/gradle/wrapper/gradle-wrapper.properties \ - android/gradlew \ - android/gradlew \ - android/gradlew \ - android/gradlew.bat \ - android/gradlew.bat \ - android/res/values/libs.xml \ - android/res/values/libs.xml \ - android/res/values/libs.xml \ - android/build.gradle \ - android/gradle/wrapper/gradle-wrapper.properties \ - android/gradlew.bat \ - front-end/PagePopUp.qml - -ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android - -RESOURCES += \ - qml.qrc - -HEADERS += \ - back-end/ProfileViewItems/mainclient.h \ - back-end/ProfileViewItems/mainmenumodel.h \ - back-end/ProfileViewItems/networkclient.h \ - back-end/ProfileViewItems/notificationdata.h \ - back-end/ProfileViewItems/notificationservice.h \ - back-end/ProfileViewItems/playerclientdata.h \ - back-end/ProfileViewItems/settingsviewmodel.h \ - back-end/ProfileViewItems/userview.h \ - back-end/asyncimageresponse.h \ - back-end/background.h \ - back-end/backgrounditem.h \ - back-end/baseclass.h \ - back-end/box.h \ - back-end/clientapp.h \ - back-end/controller.h \ - back-end/diff.h \ - back-end/guiobject.h \ - back-end/guiobjectfactory.h \ - back-end/head.h \ - back-end/imageprovider.h \ - back-end/itemworld.h \ - back-end/settings.h \ - back-end/snake.h \ - back-end/world.h diff --git a/SnakeClient/SnakeApp/android/AndroidManifest.xml b/SnakeClient/SnakeApp/android/AndroidManifest.xml deleted file mode 100644 index 586d919..0000000 --- a/SnakeClient/SnakeApp/android/AndroidManifest.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/SnakeClient/SnakeApp/android/build.gradle b/SnakeClient/SnakeApp/android/build.gradle deleted file mode 100644 index 989d079..0000000 --- a/SnakeClient/SnakeApp/android/build.gradle +++ /dev/null @@ -1,57 +0,0 @@ -buildscript { - repositories { - google() - jcenter() - } - - dependencies { - classpath 'com.android.tools.build:gradle:3.2.0' - } -} - -repositories { - google() - jcenter() -} - -apply plugin: 'com.android.application' - -dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar']) -} - -android { - /******************************************************* - * The following variables: - * - androidBuildToolsVersion, - * - androidCompileSdkVersion - * - qt5AndroidDir - holds the path to qt android files - * needed to build any Qt application - * on Android. - * - * are defined in gradle.properties file. This file is - * updated by QtCreator and androiddeployqt tools. - * Changing them manually might break the compilation! - *******************************************************/ - - compileSdkVersion androidCompileSdkVersion.toInteger() - - buildToolsVersion androidBuildToolsVersion - - sourceSets { - main { - manifest.srcFile 'AndroidManifest.xml' - java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java'] - aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl'] - res.srcDirs = [qt5AndroidDir + '/res', 'res'] - resources.srcDirs = ['src'] - renderscript.srcDirs = ['src'] - assets.srcDirs = ['assets'] - jniLibs.srcDirs = ['libs'] - } - } - - lintOptions { - abortOnError false - } -} diff --git a/SnakeClient/SnakeApp/android/gradle/wrapper/gradle-wrapper.jar b/SnakeClient/SnakeApp/android/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index f6b961f..0000000 Binary files a/SnakeClient/SnakeApp/android/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/SnakeClient/SnakeApp/android/gradle/wrapper/gradle-wrapper.properties b/SnakeClient/SnakeApp/android/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index bf3de21..0000000 --- a/SnakeClient/SnakeApp/android/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/SnakeClient/SnakeApp/android/gradlew b/SnakeClient/SnakeApp/android/gradlew deleted file mode 100755 index cccdd3d..0000000 --- a/SnakeClient/SnakeApp/android/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/SnakeClient/SnakeApp/android/gradlew.bat b/SnakeClient/SnakeApp/android/gradlew.bat deleted file mode 100644 index f955316..0000000 --- a/SnakeClient/SnakeApp/android/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/SnakeClient/SnakeApp/android/res/drawable-hdpi/icon.png b/SnakeClient/SnakeApp/android/res/drawable-hdpi/icon.png deleted file mode 100644 index f7120fc..0000000 Binary files a/SnakeClient/SnakeApp/android/res/drawable-hdpi/icon.png and /dev/null differ diff --git a/SnakeClient/SnakeApp/android/res/drawable-ldpi/icon.png b/SnakeClient/SnakeApp/android/res/drawable-ldpi/icon.png deleted file mode 100644 index f7120fc..0000000 Binary files a/SnakeClient/SnakeApp/android/res/drawable-ldpi/icon.png and /dev/null differ diff --git a/SnakeClient/SnakeApp/android/res/drawable-mdpi/icon.png b/SnakeClient/SnakeApp/android/res/drawable-mdpi/icon.png deleted file mode 100644 index f7120fc..0000000 Binary files a/SnakeClient/SnakeApp/android/res/drawable-mdpi/icon.png and /dev/null differ diff --git a/SnakeClient/SnakeApp/android/res/values/libs.xml b/SnakeClient/SnakeApp/android/res/values/libs.xml deleted file mode 100644 index 4009a77..0000000 --- a/SnakeClient/SnakeApp/android/res/values/libs.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - https://download.qt.io/ministro/android/qt5/qt-5.9 - - - - - - - - - - - - - - - - - - - - diff --git a/SnakeClient/SnakeApp/back-end/ProfileViewItems/mainclient.cpp b/SnakeClient/SnakeApp/back-end/ProfileViewItems/mainclient.cpp deleted file mode 100644 index 7420fdd..0000000 --- a/SnakeClient/SnakeApp/back-end/ProfileViewItems/mainclient.cpp +++ /dev/null @@ -1,180 +0,0 @@ -#include "mainclient.h" -#include "notificationservice.h" -#include "playerclientdata.h" - -#include - -OnlineStatus MainClient::onlineStatus() const { - return _onlineStatus; -} - -void MainClient::setOnlineStatus(OnlineStatus onlineStatus) { - if (_onlineStatus == onlineStatus) - return; - - emit sigOnlineStatusChanged(_onlineStatus = onlineStatus); - pushNotify(onlineStatus); - -} - -void MainClient::clientStatusChanged() { - auto status = OnlineStatus::ClientIsOffline; - - if (isOnline()) { - status = OnlineStatus::AuthorizationRequired; - } - - if (isLogin()) { - status = OnlineStatus::Success; - } - - setOnlineStatus(status); -} - -void MainClient::pushNotify(OnlineStatus onlineStatus) { - - - switch (onlineStatus) { - - case OnlineStatus::Success: { - - NotificationService::getService()->setNotify( - NotificationData(tr("Login status"), tr("Success"))); - - break; - } - - case OnlineStatus::AuthorizationRequired: { - - NotificationService::getService()->setNotify( - NotificationData(tr("Login status"), tr("Authorization Required"))); - - break; - } - - case OnlineStatus::WaitForAnswer: { - - NotificationService::getService()->setNotify( - NotificationData(tr("Login status"), tr("Wait for answer"))); - - break; - } - - case OnlineStatus::AuthorizationFail: { - - NotificationService::getService()->setNotify( - NotificationData(tr("Login result"), tr("Authorization fail") , "", NotificationData::Error)); - - break; - } - - case OnlineStatus::ClientIsOffline: { - - NotificationService::getService()->setNotify( - NotificationData(tr("Login result"), tr("Client is offline"), "", NotificationData::Warning)); - - break; - } - - case OnlineStatus::OfflineMode: { - - NotificationService::getService()->setNotify( - NotificationData(tr("Login result"), tr("Offline Mode"))); - - break; - } - - default: break; - - } -} - -void MainClient::handleReceivePackage(ClientProtocol::Command cmd, const QByteArray &obj) { - switch (cmd) { - - case ClientProtocol::Command::Player: { - auto playerData = QSharedPointer::create(); - playerData->fromBytes(obj); - - _users [playerData->id()] = playerData; - - if (playerData->id() == _currentUserId) { - emit currentUserDataChanged(_users [playerData->id()]); - } - - break; - } - - case ClientProtocol::Command::BadRequest: { - - NotificationService::getService()->setNotify( - NotificationData(tr("Request"), tr("Bad Request"), "", - NotificationData::Error)); - - - break; - } - default: return; - } -} - -void MainClient::handleLoginChanged(bool logined) { - this->setSubscribe(ClientProtocol::Command::Player, logined, _currentUserId); - clientStatusChanged(); - -} - -void MainClient::handleOnlineChanged(bool) { - clientStatusChanged(); -} - -MainClient::MainClient(const QString &addrress, unsigned short port, QObject *ptr): - ClientProtocol::Client (addrress, port, ptr) { - - connect(this, &MainClient::sigIncommingData, - this, &MainClient::handleReceivePackage); - - connect(this, &MainClient::onlineChanged, - this, &MainClient::handleOnlineChanged); - - connect(this, &MainClient::loginChanged, - this, &MainClient::handleLoginChanged); -} - -bool MainClient::login(const QString &gmail, const QByteArray &pass, bool) { - if (!ClientProtocol::Client::login(gmail, pass)) { - setOnlineStatus(OnlineStatus::AuthorizationFail); - return false; - } - - return true; -} - -bool MainClient::registration(const QString &gmail, - const QByteArray &pass) { - - if (!ClientProtocol::Client::registration(gmail, pass)) { - setOnlineStatus(OnlineStatus::AuthorizationFail); - return false; - } - - return true; -} - -void MainClient::playOffline() { - if (_onlineStatus == OnlineStatus::ClientIsOffline) { - setOnlineStatus(OfflineMode); - } -} - -void MainClient::tryConnect(const QString &addrress, unsigned short port) { - setOnlineStatus(ClientIsOffline); - connectToHost(addrress, port); -} - -MainClient::~MainClient() { - for (auto &i: _users) { - i.clear(); - } - _users.clear(); -} diff --git a/SnakeClient/SnakeApp/back-end/ProfileViewItems/mainclient.h b/SnakeClient/SnakeApp/back-end/ProfileViewItems/mainclient.h deleted file mode 100644 index ec1b842..0000000 --- a/SnakeClient/SnakeApp/back-end/ProfileViewItems/mainclient.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef MAINCLIENT_H -#define MAINCLIENT_H -#include - -class PlayerClientData; - -enum OnlineStatus: int { - Success = 0x0, - AuthorizationRequired, - WaitForAnswer, - AuthorizationFail, - ClientIsOffline, - OfflineMode -}; - -class MainClient: public ClientProtocol::Client -{ - Q_OBJECT -private: - QHash> _users; - OnlineStatus _onlineStatus = ClientIsOffline; - - void setOnlineStatus(OnlineStatus onlineStatus); - void clientStatusChanged(); - void pushNotify(OnlineStatus onlineStatus); - -private slots: - void handleReceivePackage(ClientProtocol::Command cmd, const QByteArray& obj); - void handleLoginChanged(bool); - void handleOnlineChanged(bool); - -public: - MainClient(const QString& addrress = LOCAL_SNAKE_SERVER, - unsigned short port = DEFAULT_SNAKE_PORT, - QObject * ptr = nullptr); - bool login(const QString& gmail, const QByteArray &pass, bool registerNewUser = false) override; - bool registration(const QString& gmail, - const QByteArray &pass) override; - void playOffline(); - void tryConnect(const QString &addrress, unsigned short port); - - ~MainClient() override; - - OnlineStatus onlineStatus() const; - -signals: - void sigOnlineStatusChanged(OnlineStatus); - void currentUserDataChanged(QSharedPointer); -}; - -#endif // MAINCLIENT_H diff --git a/SnakeClient/SnakeApp/back-end/ProfileViewItems/mainmenumodel.cpp b/SnakeClient/SnakeApp/back-end/ProfileViewItems/mainmenumodel.cpp deleted file mode 100644 index d7edc60..0000000 --- a/SnakeClient/SnakeApp/back-end/ProfileViewItems/mainmenumodel.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#include "mainmenumodel.h" -#include "settingsviewmodel.h" -#include "userview.h" - -#include -#include -#include "mainclient.h" - -MainMenuModel::MainMenuModel(QObject *ptr): QObject (ptr) { - - if(!ClientProtocol::initClientProtockol()) { - QuasarAppUtils::Params::verboseLog("client protockol not inited", QuasarAppUtils::Error); - } - - _userViewModel = new UserView (this); - _conf = Settings::get(); - _userSettingsModel = new SettingsViewModel(this); - auto adderss = _conf->getValue(SERVER_ADDRESS, SERVER_ADDRESS_DEFAULT).toString(); - auto port = _conf->getValue(SERVER_ADDRESS_PORT, SERVER_ADDRESS_DEFAULT_PORT).toInt(); - _client = new MainClient(adderss, static_cast(port), this); - - connect(_client, &MainClient::sigOnlineStatusChanged, - this , &MainMenuModel::onlineStatusChanged); - - connect(_client, &MainClient::currentUserDataChanged, - _userViewModel , &UserView::setSource); -} - -QObject *MainMenuModel::userViewModel() const { - return _userViewModel; -} - -int MainMenuModel::onlineStatus() const { - return _client->onlineStatus(); -} - -void MainMenuModel::playOffline() { - _client->playOffline(); - _userViewModel->setOffline(true); -} - -void MainMenuModel::tryConnect() { - auto adderss = _conf->getValue(SERVER_ADDRESS, SERVER_ADDRESS_DEFAULT).toString(); - auto port = _conf->getValue(SERVER_ADDRESS_PORT, SERVER_ADDRESS_DEFAULT_PORT).toInt(); - _client->tryConnect(adderss, static_cast(port)); -} - -QObject *MainMenuModel::userSettingsModel() const { - return _userSettingsModel; -} - -void MainMenuModel::login(const QString &email, const QString &pass) { - _client->login(email, pass.toUtf8()); -} - -void MainMenuModel::registerNewUser(const QString &email, - const QString &pass) { - _client->registration(email, pass.toUtf8()); -} diff --git a/SnakeClient/SnakeApp/back-end/ProfileViewItems/mainmenumodel.h b/SnakeClient/SnakeApp/back-end/ProfileViewItems/mainmenumodel.h deleted file mode 100644 index 85f997b..0000000 --- a/SnakeClient/SnakeApp/back-end/ProfileViewItems/mainmenumodel.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef NETWORKPROFILEMAINMODEL_H -#define NETWORKPROFILEMAINMODEL_H - -#include "mainclient.h" - -#include -#include "./../settings.h" - -class UserView; - -class MainClient; -class SettingsViewModel; - -class MainMenuModel : public QObject -{ - Q_OBJECT - - Q_PROPERTY(QObject* userViewModel READ userViewModel NOTIFY userViewModelChanged) - Q_PROPERTY(QObject* userSettingsModel READ userSettingsModel NOTIFY userSettingsModelChanged) - Q_PROPERTY(int onlineStatus READ onlineStatus NOTIFY onlineStatusChanged) - -private: - UserView* _userViewModel = nullptr; - SettingsViewModel* _userSettingsModel = nullptr; - MainClient *_client = nullptr; - Settings *_conf = nullptr; - -public: - MainMenuModel(QObject *ptr = nullptr); - - QObject* userViewModel() const; - QObject* userSettingsModel() const; - - int onlineStatus() const; - Q_INVOKABLE void playOffline(); - Q_INVOKABLE void tryConnect(); - -public slots: - void login(const QString& email, const QString& pass); - void registerNewUser(const QString& email, const QString& pass); - -signals: - void userViewModelChanged(QObject* userViewModel); - void newGame(); - void onlinelChanged(bool online); - void loginChanged(bool login); - void onlineStatusChanged(); - void userSettingsModelChanged(QObject* userSettingsModel); -}; - -#endif // NETWORKPROFILEMAINMODEL_H diff --git a/SnakeClient/SnakeApp/back-end/ProfileViewItems/networkclient.cpp b/SnakeClient/SnakeApp/back-end/ProfileViewItems/networkclient.cpp deleted file mode 100644 index 10b646c..0000000 --- a/SnakeClient/SnakeApp/back-end/ProfileViewItems/networkclient.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include "networkclient.h" -#include "playerclientdata.h" - -#include - -int NetworkClient::loginedPlayer() const { - return _loginedPlayer; -} - -void NetworkClient::handleReceiveData(ClientProtocol::Command cmd, - const QByteArray &obj) { - - if (cmd == ClientProtocol::Command::Player) { - PlayerClientData data; - data.fromBytes(obj); - _playersDats[data.id()] = data; - } - -} - -NetworkClient::NetworkClient() { - -} diff --git a/SnakeClient/SnakeApp/back-end/ProfileViewItems/networkclient.h b/SnakeClient/SnakeApp/back-end/ProfileViewItems/networkclient.h deleted file mode 100644 index 840902b..0000000 --- a/SnakeClient/SnakeApp/back-end/ProfileViewItems/networkclient.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef CLIENT_H -#define CLIENT_H - -#include "playerclientdata.h" - -#include - -class NetworkClient : public ClientProtocol::Client -{ - Q_OBJECT -private: - QHash _playersDats; - int _loginedPlayer; -private slots: - void handleReceiveData(ClientProtocol::Command cmd, const QByteArray& obj); -public: - NetworkClient(); - int loginedPlayer() const; -}; - -#endif // CLIENT_H diff --git a/SnakeClient/SnakeApp/back-end/ProfileViewItems/notificationdata.cpp b/SnakeClient/SnakeApp/back-end/ProfileViewItems/notificationdata.cpp deleted file mode 100644 index 94bbce1..0000000 --- a/SnakeClient/SnakeApp/back-end/ProfileViewItems/notificationdata.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include "notificationdata.h" - -NotificationData::NotificationData(const QString &title, - const QString &text, - const QString &img, Type type) { - - _text = text; - _title = title; - _img = img; - _type = type; -} - -QString NotificationData::text() const { - return _text; -} - -QString NotificationData::img() const { - return _img; -} - -QString NotificationData::title() const { - return _title; -} - -bool NotificationData::operator ==(const NotificationData &righ) { - return _title == righ._title && - _text == righ._text && - _img == righ._img && - _type == righ._type; -} - -bool NotificationData::operator !=(const NotificationData &righ) { - return !operator==(righ); -} - -int NotificationData::type() const { - return _type; -} diff --git a/SnakeClient/SnakeApp/back-end/ProfileViewItems/notificationdata.h b/SnakeClient/SnakeApp/back-end/ProfileViewItems/notificationdata.h deleted file mode 100644 index dc9ad1d..0000000 --- a/SnakeClient/SnakeApp/back-end/ProfileViewItems/notificationdata.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef NOTIFICATIONDATA_H -#define NOTIFICATIONDATA_H -#include - -class NotificationData -{ - Q_GADGET - Q_PROPERTY(QString text READ text) - Q_PROPERTY(QString img READ img) - Q_PROPERTY(QString title READ title) - Q_PROPERTY(int type READ type) - - QString _text; - QString _img; - QString _title; - int _type; - -public: - - enum Type { - Normal, - Warning = 1, - Error = 2, - }; - - explicit NotificationData(const QString& title = "", - const QString& text = "", - const QString& img = "", - Type type = Type::Normal); - - Q_INVOKABLE QString text() const; - Q_INVOKABLE QString img() const; - Q_INVOKABLE QString title() const; - Q_INVOKABLE int type() const; - - bool operator ==(const NotificationData &righ); - bool operator !=(const NotificationData &righ); - -}; - -#endif // NOTIFICATIONDATA_H diff --git a/SnakeClient/SnakeApp/back-end/ProfileViewItems/notificationservice.cpp b/SnakeClient/SnakeApp/back-end/ProfileViewItems/notificationservice.cpp deleted file mode 100644 index 39caa5f..0000000 --- a/SnakeClient/SnakeApp/back-end/ProfileViewItems/notificationservice.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include "notificationservice.h" - -NotificationService::NotificationService(QObject * ptr): QObject (ptr) { - qRegisterMetaType("NotificationData"); - qRegisterMetaType> ("QList"); - -} - -NotificationData NotificationService::notify() const { - return _notify; -} - -void NotificationService::setNotify(const NotificationData& notify) { - if (_notify != notify) - _history.push_back(_notify); - - _notify = notify; - - emit notifyChanged(); -} - -void NotificationService::setNotify(const QString &title, - const QString &text, - const QString &img, - int type) { - - setNotify(NotificationData(title, text, img, - static_cast(type))); -} - -NotificationService *NotificationService::getService() { - static auto service = new NotificationService; - return service; -} - -const QList &NotificationService::history() const { - return _history; -} diff --git a/SnakeClient/SnakeApp/back-end/ProfileViewItems/notificationservice.h b/SnakeClient/SnakeApp/back-end/ProfileViewItems/notificationservice.h deleted file mode 100644 index 75dcef9..0000000 --- a/SnakeClient/SnakeApp/back-end/ProfileViewItems/notificationservice.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef NOTIFICATIONSERVICE_H -#define NOTIFICATIONSERVICE_H - -#include "notificationdata.h" - -#include - -class NotificationService: public QObject -{ - Q_OBJECT - - Q_PROPERTY(NotificationData notify READ notify NOTIFY notifyChanged) - Q_PROPERTY(QList history READ history NOTIFY notifyChanged) - -private: - explicit NotificationService(QObject *ptr = nullptr); - - NotificationData _notify; - QList _history; - -public: - NotificationData notify() const; - void setNotify(const NotificationData ¬ify); - Q_INVOKABLE void setNotify(const QString& title = "", - const QString& text = "", - const QString& img = "", - int type = NotificationData::Normal); - - static NotificationService* getService(); - - const QList & history() const; - -signals: - void notifyChanged(); -}; - - - -#endif // NOTIFICATIONSERVICE_H diff --git a/SnakeClient/SnakeApp/back-end/ProfileViewItems/playerclientdata.cpp b/SnakeClient/SnakeApp/back-end/ProfileViewItems/playerclientdata.cpp deleted file mode 100644 index 509ed40..0000000 --- a/SnakeClient/SnakeApp/back-end/ProfileViewItems/playerclientdata.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "playerclientdata.h" - -PlayerClientData::PlayerClientData() -{ - -} diff --git a/SnakeClient/SnakeApp/back-end/ProfileViewItems/playerclientdata.h b/SnakeClient/SnakeApp/back-end/ProfileViewItems/playerclientdata.h deleted file mode 100644 index fc5a4c5..0000000 --- a/SnakeClient/SnakeApp/back-end/ProfileViewItems/playerclientdata.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef PLAYERCLIENTDATA_H -#define PLAYERCLIENTDATA_H -#include - -class PlayerClientData: public ClientProtocol::Player -{ -public: - PlayerClientData(); -}; - -#endif // PLAYERCLIENTDATA_H diff --git a/SnakeClient/SnakeApp/back-end/ProfileViewItems/settingsviewmodel.cpp b/SnakeClient/SnakeApp/back-end/ProfileViewItems/settingsviewmodel.cpp deleted file mode 100644 index 2279777..0000000 --- a/SnakeClient/SnakeApp/back-end/ProfileViewItems/settingsviewmodel.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#include "settingsviewmodel.h" -#include -#include "settings.h" - -void SettingsViewModel::handleValueChanged(QString key, QVariant value) { - if (key == SERVER_ADDRESS) { - emit hostChanged(value.toString()); - } else if (key == SERVER_ADDRESS_PORT) { - emit portChanged(value.toInt()); - } else if (key == THEME) { - emit themeChanged(value.toInt()); - } -} - -SettingsViewModel::SettingsViewModel(QObject *ptr): - QObject (ptr) { - _cfg = Settings::get(); - - connect(_cfg, &Settings::valueChanged, this , &SettingsViewModel::handleValueChanged); -} - -int SettingsViewModel::port() const { - return _cfg->getValue(SERVER_ADDRESS_PORT, SERVER_ADDRESS_DEFAULT_PORT).toInt(); -} - -QString SettingsViewModel::host() const { - return _cfg->getValue(SERVER_ADDRESS, SERVER_ADDRESS_DEFAULT).toString(); -} - -int SettingsViewModel::theme() const { - return _cfg->getValue(THEME, THEME_DEFAULT).toInt(); -} - -void SettingsViewModel::forceUpdate() { - emit hostChanged(""); - emit portChanged(0); - emit themeChanged(0); - -} - -void SettingsViewModel::toDefault() { - setPort(SERVER_ADDRESS_DEFAULT_PORT); - setHost(SERVER_ADDRESS_DEFAULT); - setTheme(THEME_DEFAULT); -} - -void SettingsViewModel::setPort(int port) { - _cfg->setValue(SERVER_ADDRESS_PORT, port); -} - -void SettingsViewModel::setHost(const QString& host) { - _cfg->setValue(SERVER_ADDRESS, host); -} - -void SettingsViewModel::setTheme(int theme) { - _cfg->setValue(THEME, theme); -} diff --git a/SnakeClient/SnakeApp/back-end/ProfileViewItems/settingsviewmodel.h b/SnakeClient/SnakeApp/back-end/ProfileViewItems/settingsviewmodel.h deleted file mode 100644 index 9727844..0000000 --- a/SnakeClient/SnakeApp/back-end/ProfileViewItems/settingsviewmodel.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef SETTINGSVIEWMODEL_H -#define SETTINGSVIEWMODEL_H - -#include -#include "./../settings.h" - - -class SettingsViewModel: public QObject -{ - Q_OBJECT - Q_PROPERTY(int port READ port WRITE setPort NOTIFY portChanged) - Q_PROPERTY(QString host READ host WRITE setHost NOTIFY hostChanged) - Q_PROPERTY(int theme READ theme WRITE setTheme NOTIFY themeChanged) - -private: - Settings *_cfg = nullptr; - -private slots: - void handleValueChanged(QString key, QVariant value); - -public: - SettingsViewModel(QObject* ptr = nullptr); - int port() const; - QString host() const; - int theme() const; - - Q_INVOKABLE void forceUpdate(); - Q_INVOKABLE void toDefault(); - - -public slots: - void setPort(int port); - void setHost(const QString &host); - void setTheme(int theme); - -signals: - void portChanged(int port); - void hostChanged(const QString &host); - void themeChanged(int theme); -}; - -#endif // SETTINGSVIEWMODEL_H diff --git a/SnakeClient/SnakeApp/back-end/ProfileViewItems/userview.cpp b/SnakeClient/SnakeApp/back-end/ProfileViewItems/userview.cpp deleted file mode 100644 index 66867a9..0000000 --- a/SnakeClient/SnakeApp/back-end/ProfileViewItems/userview.cpp +++ /dev/null @@ -1,78 +0,0 @@ -#include "userview.h" - -const PlayerClientData *UserView::getSource() const { - return _source.data(); -} - -void UserView::setSource(QSharedPointer data) { - - _offline = data == nullptr; - - if (data->id() != _source->id()) { - _source = data; - emit sourceChanged(); - } -} - -bool UserView::offline() const { - return _offline; -} - -void UserView::setOffline(bool offline) { - if (_offline != offline) { - emit offlineChanged(_offline = offline); - } -} - -UserView::UserView(QObject *parent) : QObject(parent) { - -} - -QString UserView::name() const { - if (!_source) { - return tr("Undefined name"); - } - return _source->getName(); -} - -QString UserView::gmail() const { - if (!_source) { - return tr("Undefined gmail"); - } - return _source->getGmail(); -} - -int UserView::money() const { - if (!_source) { - return -1; - } - return static_cast(_source->getMany()); -} - -int UserView::record() const { - if (!_source) { - return -1; - } - return static_cast(_source->getRecord()); -} - -int UserView::avgRecord() const { - if (!_source) { - return -1; - } - return static_cast(_source->getAvgRecord()); -} - -int UserView::cureentSnake() const { - if (!_source) { - return -1; - } - return _source->getCureentSnake(); -} - -int UserView::id() const { - if (!_source) { - return -1; - } - return _source->id(); -} diff --git a/SnakeClient/SnakeApp/back-end/ProfileViewItems/userview.h b/SnakeClient/SnakeApp/back-end/ProfileViewItems/userview.h deleted file mode 100644 index 455f294..0000000 --- a/SnakeClient/SnakeApp/back-end/ProfileViewItems/userview.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef USERVIEW_H -#define USERVIEW_H - -#include "playerclientdata.h" - -#include - -class UserView : public QObject -{ - Q_OBJECT - - Q_PROPERTY(QString name READ name NOTIFY sourceChanged) - Q_PROPERTY(QString gmail READ gmail NOTIFY sourceChanged) - Q_PROPERTY(int money READ money NOTIFY sourceChanged) - Q_PROPERTY(int record READ record NOTIFY sourceChanged) - Q_PROPERTY(int avgRecord READ avgRecord NOTIFY sourceChanged) - Q_PROPERTY(int cureentSnake READ cureentSnake NOTIFY sourceChanged) - Q_PROPERTY(int id READ id NOTIFY sourceChanged) - Q_PROPERTY(bool offline READ offline NOTIFY offlineChanged) - -private: - QSharedPointer _source = nullptr; - - bool _offline = false; - -public: - explicit UserView(QObject *parent = nullptr); - - QString name() const; - QString gmail() const; - int money() const; - int record() const; - int avgRecord() const; - int cureentSnake() const; - int id() const; - - const PlayerClientData *getSource() const; - bool offline() const; - void setOffline(bool offline); - -signals: - - void sourceChanged(); - - void offlineChanged(bool offline); - -public slots: - void setSource(QSharedPointer data); - -}; - -#endif // USERVIEW_H diff --git a/SnakeClient/SnakeApp/back-end/asyncimageresponse.cpp b/SnakeClient/SnakeApp/back-end/asyncimageresponse.cpp deleted file mode 100644 index b6d7113..0000000 --- a/SnakeClient/SnakeApp/back-end/asyncimageresponse.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include "asyncimageresponse.h" - -AsyncImageResponse::AsyncImageResponse() = default; -AsyncImageResponse::~AsyncImageResponse() = default; - -QQuickTextureFactory *AsyncImageResponse::textureFactory() const { - return _texture; -} - -// memory leak ? -void AsyncImageResponse::setResult(const QImage& image) { - _texture = QQuickTextureFactory::textureFactoryForImage(image); - emit finished(); -// deleteLater(); -} - -void AsyncImageResponse::error(const QString &err) { - _errorString = " " + err; -} - -QString AsyncImageResponse::errorString() const { - return QQuickImageResponse::errorString() + _errorString; -} diff --git a/SnakeClient/SnakeApp/back-end/asyncimageresponse.h b/SnakeClient/SnakeApp/back-end/asyncimageresponse.h deleted file mode 100644 index ca04a34..0000000 --- a/SnakeClient/SnakeApp/back-end/asyncimageresponse.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef ASYNCIMAGERESPONSE_H -#define ASYNCIMAGERESPONSE_H - -#include - - -class AsyncImageResponse : public QQuickImageResponse { - -private: - QQuickTextureFactory *_texture = nullptr; - QString _errorString; -public: - - AsyncImageResponse (); - ~AsyncImageResponse () override; - - QQuickTextureFactory *textureFactory() const override; - - void setResult(const QImage &image); - void error(const QString &err); - - QString errorString() const override; -}; -#endif // ASYNCIMAGERESPONSE_H diff --git a/SnakeClient/SnakeApp/back-end/background.cpp b/SnakeClient/SnakeApp/back-end/background.cpp deleted file mode 100644 index 50cd2f2..0000000 --- a/SnakeClient/SnakeApp/back-end/background.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "background.h" - -BackGround::BackGround(double x, double y): ItemWorld (x, y) { - this->setSize(200, 400); - this->setTexture("qrc:/texture/asphalt"); - setBeckGroundObject(true); -} - -void BackGround::render() { - auto wPart = w() / 2; - - if (m_x + wPart < 200) { - setX(wPart); - } -} - -void BackGround::reset() { - setX(0 - w()); - render(); -} diff --git a/SnakeClient/SnakeApp/back-end/background.h b/SnakeClient/SnakeApp/back-end/background.h deleted file mode 100644 index 26e4619..0000000 --- a/SnakeClient/SnakeApp/back-end/background.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef BACKGROUND_H -#define BACKGROUND_H - -#include "itemworld.h" - - -class BackGround : public ItemWorld -{ -public: - BackGround(double x, double y); - - void render() override; - void reset() override; -}; - -#endif // BACKGROUND_H diff --git a/SnakeClient/SnakeApp/back-end/backgrounditem.cpp b/SnakeClient/SnakeApp/back-end/backgrounditem.cpp deleted file mode 100644 index dcdfbea..0000000 --- a/SnakeClient/SnakeApp/back-end/backgrounditem.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include "backgrounditem.h" - -#include - -BackGroundItem::BackGroundItem(double x, double y): - ItemWorld (x, y) { - setBeckGroundObject(true); - reset(); -} - -void BackGroundItem::reset() { - auto tempColor = QColor(rand() % 255, rand() % 255, rand() % 255, 10); - setColor(tempColor.name(QColor::HexArgb)); - auto radius = rand() % 200; - setSize(radius , radius); - - setRadius(radius / 2); - -} diff --git a/SnakeClient/SnakeApp/back-end/backgrounditem.h b/SnakeClient/SnakeApp/back-end/backgrounditem.h deleted file mode 100644 index 6999772..0000000 --- a/SnakeClient/SnakeApp/back-end/backgrounditem.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef BACKGROUNDITEM_H -#define BACKGROUNDITEM_H - -#include "itemworld.h" - - -class BackGroundItem : public ItemWorld -{ -public: - BackGroundItem(double x, double y); - void reset() override; - -}; - -#endif // BACKGROUNDITEM_H diff --git a/SnakeClient/SnakeApp/back-end/baseclass.cpp b/SnakeClient/SnakeApp/back-end/baseclass.cpp deleted file mode 100644 index f635b82..0000000 --- a/SnakeClient/SnakeApp/back-end/baseclass.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include "baseclass.h" - -void BaseClass::setName(const QString &value) { - name = value; -} - -BaseClass::BaseClass() : - name("BaseClass") { -} - -BaseClass::~BaseClass() { - -} - -QString BaseClass::getName() const { - return name; -} diff --git a/SnakeClient/SnakeApp/back-end/baseclass.h b/SnakeClient/SnakeApp/back-end/baseclass.h deleted file mode 100644 index a25ed02..0000000 --- a/SnakeClient/SnakeApp/back-end/baseclass.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef BASECLASS_H -#define BASECLASS_H -#include - -class BaseClass -{ -private: - QString name; -public: - BaseClass(); - virtual void render() = 0; - virtual ~BaseClass(); - QString getName() const; - void setName(const QString &value); -}; - -#endif // BASECLASS_H diff --git a/SnakeClient/SnakeApp/back-end/box.cpp b/SnakeClient/SnakeApp/back-end/box.cpp deleted file mode 100644 index 182bf46..0000000 --- a/SnakeClient/SnakeApp/back-end/box.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "box.h" - -#include - -Box::Box(double x, double y): - ItemWorld (x, y) { - - this->setSize(10, 10); - - setColor(QColor(100, 100, 100).name()); -} - diff --git a/SnakeClient/SnakeApp/back-end/box.h b/SnakeClient/SnakeApp/back-end/box.h deleted file mode 100644 index 7fd71a4..0000000 --- a/SnakeClient/SnakeApp/back-end/box.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef BOX_H -#define BOX_H - -#include "itemworld.h" - -class Box: public ItemWorld -{ -public: - Box(double x, double y); - -}; - -#endif // BOX_H diff --git a/SnakeClient/SnakeApp/back-end/clientapp.cpp b/SnakeClient/SnakeApp/back-end/clientapp.cpp deleted file mode 100644 index 2d9e109..0000000 --- a/SnakeClient/SnakeApp/back-end/clientapp.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include "clientapp.h" -#include "imageprovider.h" -#include "ProfileViewItems/userview.h" -#include -#include - -#include -#include - -QByteArray ClientApp::initTheme() { - int themeIndex = Settings::get()->getValue(THEME, THEME_DEFAULT).toInt(); - - switch (themeIndex) { - case 1: return "Dark"; - default: return "Light"; - } - -} - -ClientApp::ClientApp() { -} - -ClientApp::~ClientApp() { -} - -bool ClientApp::init(QQmlApplicationEngine *engine) { - - qputenv("QT_QUICK_CONTROLS_MATERIAL_THEME", initTheme()); - - qmlRegisterType (); - qmlRegisterType (); - qmlRegisterType (); - qmlRegisterType (); - - auto root = engine->rootContext(); - if (!root) - return false; - - - engine->addImageProvider(QLatin1String("userItems"), new ImageProvider()); - - root->setContextProperty("contr", &contr); - root->setContextProperty("notificationService", NotificationService::getService()); - - engine->load(QUrl(QStringLiteral("qrc:/front-end/main.qml"))); - if (engine->rootObjects().isEmpty()) - return false; - - return true; -} diff --git a/SnakeClient/SnakeApp/back-end/clientapp.h b/SnakeClient/SnakeApp/back-end/clientapp.h deleted file mode 100644 index 8045ff2..0000000 --- a/SnakeClient/SnakeApp/back-end/clientapp.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef CLIENTAPP_H -#define CLIENTAPP_H - -#include "controller.h" -#include "diff.h" - -class QQmlApplicationEngine; - -class ClientApp -{ -private: - Controller contr; - - QByteArray initTheme(); - -public: - ClientApp(); - ~ClientApp(); - bool init(QQmlApplicationEngine* engine); -}; - -#endif // CLIENTAPP_H diff --git a/SnakeClient/SnakeApp/back-end/controller.cpp b/SnakeClient/SnakeApp/back-end/controller.cpp deleted file mode 100644 index 84473de..0000000 --- a/SnakeClient/SnakeApp/back-end/controller.cpp +++ /dev/null @@ -1,154 +0,0 @@ -#include "controller.h" -#include -#include -#include "diff.h" -#include -#include "ProfileViewItems/mainmenumodel.h" -#include - -Controller::Controller() { - srand(static_cast(time(nullptr))); - timer = new QTimer(); - timer->setInterval(1); - - _networkModel = new MainMenuModel(this); - - connect(timer, SIGNAL(timeout()), this, SLOT(update())); - connect(_networkModel, &MainMenuModel::newGame, this, &Controller::handleNewGame); - -} - -Controller::~Controller() { - -} - -bool Controller::nextLvl() { - if (lvl + 1 >= lvls.size()) { - return true; - } - m_generalLong += static_cast(world.getCurrentLong()); - - generateDiff(world.init(lvls.value(++lvl))); - startTimer(); - - - return false; -} - -void Controller::generateDiff(const QMap& objs) { - - auto removeIds = objectsContainer.keys(); - QList addedIds; - - for (auto i = objs.begin(); i != objs.end(); ++i) { - if (objectsContainer.contains(i.key())) { - removeIds.removeOne(i.key()); - } else { - objectsContainer.insert(i.key(), i.value()); - addedIds.push_back(i.key()); - } - } - - if (removeIds.size() || addedIds.size()) { - Diff diff; - - diff.setRemoveIds(removeIds); - diff.setAddedIds(addedIds); - emit gameObjectsChanged(diff); - } -} - -void Controller::update() { - if (pause) { - return; - } - - world.render(); - - if(world.isDefiat()) { - stopTimer(); - if (!_showMenu) { - setShowMenu(true); - } - handleNewGame(); - } - - if (world.isEnd()) { - stopTimer(); - - if (!_showMenu) { - - NotificationData notify(tr(" Next Lvl!!!"), - tr(" You anblock next lvl (%0)" ).arg(lvl), - "qrc:/texture/up"); - - NotificationService::getService()->setNotify(notify); - } - - nextLvl(); - - } - - long_changed(static_cast(world.getCurrentLong())); - generalLongchanged(generalLong()); - -} - -void Controller::handleNewGame() { - - world.resetPosition(); - - WorldRules newGameRules = lvls.first(); - lvl = 0; - m_generalLong = 0; - generateDiff(world.init(newGameRules)); - startTimer(); -} - -QObject *Controller::getGameObject(int id) { - return objectsContainer.value(id, nullptr); -} - -void Controller::startTimer() { - timer->start(); -} - -void Controller::stopTimer() { - timer->stop(); -} - -int Controller::long_() const { - return static_cast(world.getCurrentLong()); -} - -int Controller::generalLong() const { - return m_generalLong + long_(); -} - -QObject *Controller::mainMenuModel() const { - return _networkModel; -} - -void Controller::buttonPress() { - world.reversClick(); -} - -void Controller::setPause(bool p){ - pause = p; - if (!pause) { - world.unPause(); - } -} - -bool Controller::showMenu() const { - return _showMenu; -} - -void Controller::setShowMenu(bool showMenu) { - if (_showMenu == showMenu) - return; - - _showMenu = showMenu; - emit showMenuChanged(_showMenu); -} - diff --git a/SnakeClient/SnakeApp/back-end/controller.h b/SnakeClient/SnakeApp/back-end/controller.h deleted file mode 100644 index 93c0795..0000000 --- a/SnakeClient/SnakeApp/back-end/controller.h +++ /dev/null @@ -1,88 +0,0 @@ -#ifndef CONTROLLER_H -#define CONTROLLER_H - -#include -#include -#include -#include "diff.h" -#include "snake.h" -#include "world.h" - -class MainMenuModel; - -class Controller : public QObject -{ - Q_OBJECT - - Q_PROPERTY(int long_ READ long_ NOTIFY long_changed) - Q_PROPERTY(int generalLong READ generalLong NOTIFY generalLongchanged) - Q_PROPERTY(QObject* mainMenuModel READ mainMenuModel NOTIFY mainMenuModelchanged) - Q_PROPERTY(bool showMenu READ showMenu WRITE setShowMenu NOTIFY showMenuChanged) - -private: - - World world; - QMap objectsContainer; - QTimer *timer = nullptr; - - int lvl = 0; - int m_generalLong = 0; - bool pause = false; - bool _showMenu = true; - - void generateDiff(const QMap &); - - MainMenuModel* _networkModel = nullptr; - -public: - Controller(); - ~Controller(); - - void startTimer(); - void stopTimer(); - - int long_() const; - int generalLong() const; - bool showMenu() const; - - QObject* mainMenuModel() const; - -public slots: - void buttonPress(); - void setPause(bool); - void update(); - - /** - * @brief nextLvl - switch to next lvl from array lvels - * @return true if all levels are passed - */ - bool nextLvl(); - - /** - * @brief newGame - start game from first lvl - */ - void handleNewGame(); - - /** - * @brief getGameObject - * @param id - id of guiObject; - * @return guiObject if (id is not valid return nullptr) - */ - QObject* getGameObject(int id); - - void setShowMenu(bool showMenu); - -signals: - - /** - * @brief gameObjectsChanged - * @param dif - */ - void gameObjectsChanged(const Diff &dif); - void long_changed(int m_long); - void generalLongchanged(int generalLong); - void mainMenuModelchanged(QObject* mainMenuModel); - void showMenuChanged(bool showMenu); -}; - -#endif // CONTROLLER_H diff --git a/SnakeClient/SnakeApp/back-end/diff.cpp b/SnakeClient/SnakeApp/back-end/diff.cpp deleted file mode 100644 index 489a756..0000000 --- a/SnakeClient/SnakeApp/back-end/diff.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "diff.h" - -QList Diff::getRemoveIds() const { - return removeIds; -} - -void Diff::setRemoveIds(const QList &value) { - removeIds = value; -} - -QList Diff::getAddedIds() const { - return addedIds; -} - -void Diff::setAddedIds(const QList &value) { - addedIds = value; -} - -Diff::Diff(){ - -} diff --git a/SnakeClient/SnakeApp/back-end/diff.h b/SnakeClient/SnakeApp/back-end/diff.h deleted file mode 100644 index 7733e7b..0000000 --- a/SnakeClient/SnakeApp/back-end/diff.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef DIFF_H -#define DIFF_H - -#include - -class Diff -{ - Q_GADGET -private: - QList removeIds; - QList addedIds; -public: - explicit Diff(); - - Q_INVOKABLE QList getRemoveIds() const; - void setRemoveIds(const QList &value); - Q_INVOKABLE QList getAddedIds() const; - void setAddedIds(const QList &value); -}; - -Q_DECLARE_METATYPE(Diff) - -#endif // DIFF_H diff --git a/SnakeClient/SnakeApp/back-end/guiobject.cpp b/SnakeClient/SnakeApp/back-end/guiobject.cpp deleted file mode 100644 index 419c576..0000000 --- a/SnakeClient/SnakeApp/back-end/guiobject.cpp +++ /dev/null @@ -1,116 +0,0 @@ -#include "guiobject.h" - -GuiObject::GuiObject(const QString &viewTempalte, QObject *ptr): - QObject (ptr) { - m_viewTemplate = viewTempalte; - generateId(); - -} - -double GuiObject::angle() const { - return m_angle; -} - -QString GuiObject::texture() const { - return m_texture; -} - -void GuiObject::render() { -} - -QRectF GuiObject::rect() const { - return QRectF(m_x - m_w / 2, m_y - m_h / 2, m_w, m_h); -} - -void GuiObject::setAngle(double angle) { - m_angle = angle; - emit angleChanged(m_angle); -} - -int GuiObject::guiId() const { - return m_guiId; -} - -QString GuiObject::color() const { - return m_color; -} - -void GuiObject::setColor(QString color) { - if (m_color == color) - return; - - m_color = color; - emit colorChanged(m_color); -} - -double GuiObject::x() const { - return m_x; -} - -double GuiObject::y() const { - return m_y; -} - -double GuiObject::w() const { - return m_w; -} - -double GuiObject::h() const { - return m_h; -} - -void GuiObject::generateId() { - static int id = 0; - m_guiId = id++; -} - -void GuiObject::setH(double h) { - m_h = h; - emit hChanged(m_h); -} - -void GuiObject::reset() { - setX(-1); - setY(-1); -} - -int GuiObject::radius() const { - return m_radius; -} - -QString GuiObject::viewTemplate() const { - return m_viewTemplate; -} - -void GuiObject::setRadius(int radius) { - if (m_radius == radius) - return; - - m_radius = radius; - emit radiusChanged(m_radius); -} - -void GuiObject::setW(double w) { - m_w = w; - emit wChanged(m_w); - -} - -void GuiObject::setY(double y) { - m_y = y; - emit yChanged(m_y); - -} - -void GuiObject::setX(double x) { - m_x = x; - emit xChanged(m_x); - -} - -void GuiObject::setTexture(const QString &texture) { - m_texture = texture; - emit textureChanged(m_texture); -} - - diff --git a/SnakeClient/SnakeApp/back-end/guiobject.h b/SnakeClient/SnakeApp/back-end/guiobject.h deleted file mode 100644 index dc903ef..0000000 --- a/SnakeClient/SnakeApp/back-end/guiobject.h +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef GUIOBJECT_H -#define GUIOBJECT_H - -#include "baseclass.h" -#include "QObject" - -#include - -class GuiObject:public QObject, public BaseClass -{ - Q_OBJECT -// @todo: add color - Q_PROPERTY(QString color READ color WRITE setColor NOTIFY colorChanged) - Q_PROPERTY(double angle READ angle NOTIFY angleChanged) - Q_PROPERTY(QString texture READ texture NOTIFY textureChanged) - Q_PROPERTY(int guiId READ guiId NOTIFY guiIdChanged) - Q_PROPERTY(QString viewTemplate READ viewTemplate NOTIFY viewTemplateChanged) - Q_PROPERTY(int radius READ radius WRITE setRadius NOTIFY radiusChanged) - - Q_PROPERTY(double x READ x NOTIFY xChanged) - Q_PROPERTY(double y READ y NOTIFY yChanged) - Q_PROPERTY(double w READ w NOTIFY wChanged) - Q_PROPERTY(double h READ h NOTIFY hChanged) - -private: - void generateId(); - QString m_viewTemplate; - -protected: - int m_guiId = -1; - double m_angle = 0; - QString m_texture = ""; - QString m_color = ""; - int m_radius = 0; - - double m_x = 0; - double m_y = 0; - double m_w = 0; - double m_h = 0; - - void setTexture(const QString &texture); - - -public: - GuiObject(const QString& viewTempalte = "GraphicItem", QObject *ptr = nullptr); - - double angle() const; - QString texture() const; - - void render() override; - - QRectF rect() const; - virtual void setAngle(double angle); - int guiId() const; - - QString color() const; - - void setColor(QString color); - - double x() const; - double y() const; - double w() const; - double h() const; - - void setX(double x); - void setY(double y); - void setW(double w); - void setH(double h); - - virtual void reset(); - int radius() const; - QString viewTemplate() const; - -public slots: - - void setRadius(int radius); - -signals: - void angleChanged(double angle); - void textureChanged(QString texture); - void guiIdChanged(int guiId); - void colorChanged(QString color); - void xChanged(double x); - void yChanged(double y); - void wChanged(double w); - void hChanged(double h); - void radiusChanged(int radius); - void viewTemplateChanged(QString viewTemplate); -}; - -#endif // GUIOBJECT_H diff --git a/SnakeClient/SnakeApp/back-end/guiobjectfactory.cpp b/SnakeClient/SnakeApp/back-end/guiobjectfactory.cpp deleted file mode 100644 index 4313c60..0000000 --- a/SnakeClient/SnakeApp/back-end/guiobjectfactory.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include "guiobjectfactory.h" -#include "box.h" -#include -#include "head.h" -#include "background.h" -#include "backgrounditem.h" - -GuiObjectFactory::GuiObjectFactory() {} - -ItemWorld *GuiObjectFactory::generate(const QString &name) { - ItemWorld *obj = nullptr; - if (name == "Box") { - obj = new Box(rand() % 400, 0); - } - else if (name == "BackGround") { - obj = new BackGround(0, 0); - } - else if (name == "BackGroundItem") { - obj = new BackGroundItem(0, 0); - } - - return obj; -} diff --git a/SnakeClient/SnakeApp/back-end/guiobjectfactory.h b/SnakeClient/SnakeApp/back-end/guiobjectfactory.h deleted file mode 100644 index 1d60fe3..0000000 --- a/SnakeClient/SnakeApp/back-end/guiobjectfactory.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef GUIOBJECTFACTORY_H -#define GUIOBJECTFACTORY_H - -#include - -class ItemWorld; - -/** - * @brief The GuiObjectFactory class - * factory of gui ojects; - */ -class GuiObjectFactory -{ -public: - GuiObjectFactory(); - - /** - * @brief generate - generate the child of GuiObject - * by object name. - * @param name - name of class of genereta object - * @return pointer of generated object. - * If method called with not valid name then return nullptr. - */ - static ItemWorld* generate(const QString& name); -}; - -#endif // GUIOBJECTFACTORY_H diff --git a/SnakeClient/SnakeApp/back-end/head.cpp b/SnakeClient/SnakeApp/back-end/head.cpp deleted file mode 100644 index 3701d32..0000000 --- a/SnakeClient/SnakeApp/back-end/head.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#include "head.h" -#include -#include - -void Head::render() { - - - qint64 tempTime = QDateTime::currentMSecsSinceEpoch() - time; - time = QDateTime::currentMSecsSinceEpoch(); - - double my = (m_y + (*speed * 0.55) * sin(m_angle * TO_RADIAN)); - m_y += (my - m_y) / 1000 * tempTime; - - if (*speed < 1) { - setColor(generalSpeadColor); - setRadius(static_cast(m_w * 0.4)); - - } else if (*speed < normSpead) { - setColor(normSpeadColor); - setRadius(static_cast(m_w * 0.5)); - - } else if (*speed < fastSpead) { - setColor(fastSpeadColor); - setRadius(static_cast(m_w * 0.5)); - - } else if (*speed < megaFastSpead) { - setColor(megaFastSpeadColor); - setRadius(static_cast(m_w * 0.4)); - - } - - emit yChanged(m_y); -} - -void Head::reset() { -} - -void Head::unPause() { - time = QDateTime::currentMSecsSinceEpoch(); -} - -Head::Head(double x, double y, double h, double w, double *spead): - GuiObject ("SnakeItem") { - setX(x); - setY(y); - setW(w); - setH(h); - this->speed = spead; -} - -void Head::setAngle(double angle) { - m_angle = angle; - emit angleChanged(m_angle); -} - -Head::~Head() { - -} diff --git a/SnakeClient/SnakeApp/back-end/head.h b/SnakeClient/SnakeApp/back-end/head.h deleted file mode 100644 index 47fb207..0000000 --- a/SnakeClient/SnakeApp/back-end/head.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef HEAD_H -#define HEAD_H -#define TO_RADIAN 0.017453293 - - -#include "guiobject.h" -#include - -class Head : public GuiObject -{ -private: - qint64 time; - double *speed; - const int megaFastSpead = 200; - const int fastSpead = 100; - const int normSpead = 50; - - const QString generalSpeadColor = "#616a6b"; - const QString normSpeadColor = "#5d6d7e"; - const QString fastSpeadColor = "#eb984e"; - const QString megaFastSpeadColor = "#ec7063"; - -public: - Head(double x , double y, double h, double w, double *speed); - void setAngle(double angle) override; - void render() override; - void reset() override; - void unPause(); - ~Head() override; -}; - -#endif // HEAD_H diff --git a/SnakeClient/SnakeApp/back-end/imageprovider.cpp b/SnakeClient/SnakeApp/back-end/imageprovider.cpp deleted file mode 100644 index 6300532..0000000 --- a/SnakeClient/SnakeApp/back-end/imageprovider.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include "asyncimageresponse.h" -#include "imageprovider.h" -#include -#include - -ImageProvider::ImageProvider() = default; -ImageProvider::~ImageProvider() = default; - -QQuickImageResponse *ImageProvider::requestImageResponse(const QString &id, - const QSize &requestedSize) { - - AsyncImageResponse* response = new AsyncImageResponse(); - auto readImage = [id, requestedSize, response]() mutable { - Q_UNUSED(requestedSize); - - auto params = id.split("/"); - - if (params.contains("player")) { - response->setResult(QImage(":/img/defaultuser"). - scaled(requestedSize, Qt::KeepAspectRatioByExpanding)); - - } else if (params.contains("item")) { - response->setResult(QImage(":/img/defaultsnake"). - scaled(requestedSize, Qt::KeepAspectRatioByExpanding)); - } else { - response->error("Wrong first parametr example 'first/last'"); - } - - }; - - QtConcurrent::run(readImage); - - return response; -} - - - diff --git a/SnakeClient/SnakeApp/back-end/imageprovider.h b/SnakeClient/SnakeApp/back-end/imageprovider.h deleted file mode 100644 index 188380e..0000000 --- a/SnakeClient/SnakeApp/back-end/imageprovider.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef IMAGEPROVIDER_H -#define IMAGEPROVIDER_H - -#include -#include - -class ImageProvider: public QQuickAsyncImageProvider -{ -private: -public: - explicit ImageProvider(); - ~ImageProvider() override; - - QQuickImageResponse *requestImageResponse(const QString &id, - const QSize &requestedSize) override; -}; - - -#endif // IMAGEPROVIDER_H diff --git a/SnakeClient/SnakeApp/back-end/itemworld.cpp b/SnakeClient/SnakeApp/back-end/itemworld.cpp deleted file mode 100644 index 5a1e24d..0000000 --- a/SnakeClient/SnakeApp/back-end/itemworld.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include "itemworld.h" -#include "snakeutils.h" -#include -#include -#include - -#define POINT 100 - -ItemWorld::ItemWorld(double x, double y, const QString& guiTemplate): - GuiObject (guiTemplate) { - setLoc(x, y); -} - -void ItemWorld::setBeckGroundObject(bool value) { - beckGroundObject = value; -} - -void ItemWorld::setSize(double h, double w) { - setH(h); - setW(w); -} - -void ItemWorld::setLoc(double x, double y) { - setX(x); - setY(y); -} - -void ItemWorld::render() { - if (m_x + w() < 0) { - m_x = (rand() % 400) + 200; - m_y = rand() % 100; - emit xChanged(m_x); - emit yChanged(m_y); - } -} - -bool ItemWorld::move(const GuiObject *snakeRiger, double dx) { - m_x -= dx; - emit xChanged(m_x); - - return snakeRiger->rect().intersects(rect()) && !beckGroundObject; -} - -bool ItemWorld::isBeckGroundObject() { - return beckGroundObject; -} - -ItemWorld::~ItemWorld() {} diff --git a/SnakeClient/SnakeApp/back-end/itemworld.h b/SnakeClient/SnakeApp/back-end/itemworld.h deleted file mode 100644 index 6159eaf..0000000 --- a/SnakeClient/SnakeApp/back-end/itemworld.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef ITEMWORLD_H -#define ITEMWORLD_H - -#include "guiobject.h" -#include - -class ItemWorld : public GuiObject -{ -private: - bool beckGroundObject = false; -protected: - virtual void setSize(double h, double w); - virtual void setLoc(double x, double y); - void setBeckGroundObject(bool value); - -public: - ItemWorld(double x, double y, const QString& GuiTemplate = "GraphicItem"); - - void render(); - virtual bool move(const GuiObject* snakeRiger, double dx); - bool isBeckGroundObject(); - - ~ItemWorld(); -}; - -#endif // ITEMWORLD_H diff --git a/SnakeClient/SnakeApp/back-end/main.cpp b/SnakeClient/SnakeApp/back-end/main.cpp deleted file mode 100644 index b2301a9..0000000 --- a/SnakeClient/SnakeApp/back-end/main.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include -#include -#include "clientapp.h" - - -int main(int argc, char *argv[]) -{ - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - - QGuiApplication app(argc, argv); - QQmlApplicationEngine engine; - ClientApp client; - - if (!client.init(&engine)) { - return 1; - } - - return app.exec(); -} diff --git a/SnakeClient/SnakeApp/back-end/settings.cpp b/SnakeClient/SnakeApp/back-end/settings.cpp deleted file mode 100644 index d90bd07..0000000 --- a/SnakeClient/SnakeApp/back-end/settings.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "settings.h" diff --git a/SnakeClient/SnakeApp/back-end/settings.h b/SnakeClient/SnakeApp/back-end/settings.h deleted file mode 100644 index f9245d0..0000000 --- a/SnakeClient/SnakeApp/back-end/settings.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef SNAKESETTINGS_H -#define SNAKESETTINGS_H -#include -#include - -#define SERVER_ADDRESS "SERVER_ADDRESS" -#define SERVER_ADDRESS_PORT "SERVER_ADDRESS_PORT" -#define THEME "THEME_GUI" - -#define SERVER_ADDRESS_DEFAULT "quasarapp.ddns.net" -//#define SERVER_ADDRESS_DEFAULT "127.0.0.1" -#define SERVER_ADDRESS_DEFAULT_PORT DEFAULT_SNAKE_PORT -#define THEME_DEFAULT 0 - -using Settings = QuasarAppUtils::Settings; - -#endif // SNAKESETTINGS_H diff --git a/SnakeClient/SnakeApp/back-end/snake.cpp b/SnakeClient/SnakeApp/back-end/snake.cpp deleted file mode 100644 index 7b1416e..0000000 --- a/SnakeClient/SnakeApp/back-end/snake.cpp +++ /dev/null @@ -1,200 +0,0 @@ -#include "snake.h" -#include "guiobject.h" - -#include -#include -#include -#include - -Snake::Snake() { -} - -const QVector &Snake::getItems() const { - return items; -} - -void Snake::render() { - - auto centerX = [](const Head* head) { - return head->x()/* + (head->w() / 2)*/; - }; - - auto centerY = [](const Head* head) { - return head->y() /*+ (head->h() / 2)*/; - }; - - for (int i = items.length() - 1; i >= 0; --i) { - - if (dead) { - items[i]->render(); - continue; - } - - if (i == 0) { - if (isClick) { - if (countClick & 1){ - items[i]->setAngle(45); - } else { - items[i]->setAngle(315); - } - isClick = false; - } - } else { - - double _atan2 = atan2(centerY(items[i - 1]) - centerY(items[i]), - centerX(items[i - 1]) - centerX(items[i])) * 90; - - items[i]->setAngle(_atan2); - } - - items[i]->render(); - } -} - -double Snake::checDistance(int i) { - - auto result = (items[i]->rect().y() - - items[i - 1]->rect().y()) / rataticonDistance; - - return result; - -} - -double Snake::getRataticonDistance() const { - return rataticonDistance; -} - -void Snake::setRataticonDistance(double value) { - rataticonDistance = value; -} - -void Snake::unPause() { - for ( int i = 0; i < items.size(); ++i ) { - items[i]->unPause(); - } -} - -double Snake::sizeByLvl(double lvl , int count) const { - double maxSize = 9; - double minSize = 5; - - double pos = (1 - (lvl / count)); - - QList> snakeGradientSize { - {1, 4}, - {0.99, 7}, - {0.8, 5}, - {0.6, 6}, - {0.0, 3} - }; - - double local = 0; - int index = 0; - - while (index + 1 < snakeGradientSize.size() - && pos <= snakeGradientSize[index].first) { - - maxSize = snakeGradientSize[index].second; - minSize = snakeGradientSize[index + 1].second; - - auto range = snakeGradientSize[index].first - - snakeGradientSize[index + 1].first; - - local = ( range - (snakeGradientSize[index].first - pos)) / - range; - - index++; - } - - return local * (maxSize - minSize) + minSize; -} - -void Snake::changeCountObjects(int count) { - if (count > 0) { - double margin = 60.0 / count; - for ( int i = 0; i < count; ++i ) { - - auto size = sizeByLvl(i, count); - auto obj = new Head(margin * (count - i), - 50, size , size, - this->speed); - - obj->setY(50 + obj->h() / 2); - - items.push_back(obj); - } - - } else { - for ( int i = count; i < 0; ++i ) { - auto obj = items.first(); - items.removeFirst(); - delete obj; - } - } -} - -QMap Snake::init(int size, double *speed) { - - QMap res; - - if (size <= 0) { - return res; - } - - this->speed = speed; - - changeCountObjects(size - items.size()); - - for (auto i : items) { - res[i->guiId()] = i; - } - - dead = false; - - return res; -} - -bool Snake::isInited() const { - return items.size(); -} - -void Snake::clearItems() { - for (auto i : items) { - delete i; - } - items.clear(); -} - -void Snake::resetPosotion() { - double margin = 60.0 / items.size(); - - for ( int i = 0; i < items.size(); ++i ) { - items[i]->setX(margin * (items.size() - i)); - items[i]->setY(50 + items[i]->h() / 2); - items[i]->setAngle(0); - } -} - -void Snake::kill() { - dead = true; -} - -bool Snake::isDead() const { - return dead; -} - -Snake::~Snake() { - clearItems(); -} - -void Snake::clear() { - clearItems(); -} - -void Snake::reverse() { - if (isClick) { - return; - } - isClick = true; - countClick++; -} diff --git a/SnakeClient/SnakeApp/back-end/snake.h b/SnakeClient/SnakeApp/back-end/snake.h deleted file mode 100644 index b919028..0000000 --- a/SnakeClient/SnakeApp/back-end/snake.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef SNAKE_H -#define SNAKE_H - -#define SPEEDSNAKE 10 - -#include -#include "head.h" -#include "baseclass.h" - -class GuiObject; - - - -class Snake : public BaseClass -{ -private: - double rataticonDistance = 1; - QVector items; - double *speed = nullptr; - bool isClick = false; - int countClick = 0; - bool dead = false; - double sizeByLvl(double lvl, int count) const; - void changeCountObjects(int count); - - double checDistance(int i); - void clearItems(); - - -public: - Snake(); - ~Snake() override; - void clear(); - void resetPosotion(); - - void kill(); - bool isDead() const; - - void reverse(); - void render() override; - QMap init(int size, double *speed); - bool isInited() const; - const QVector& getItems() const; - double getMovedLong() const; - double getRataticonDistance() const; - void setRataticonDistance(double value); - int getDeadTimer() const; - void setDeadTimer(int value); - void unPause(); -}; - -#endif // SNAKE_H diff --git a/SnakeClient/SnakeApp/back-end/world.cpp b/SnakeClient/SnakeApp/back-end/world.cpp deleted file mode 100644 index 62f799c..0000000 --- a/SnakeClient/SnakeApp/back-end/world.cpp +++ /dev/null @@ -1,173 +0,0 @@ -#include "background.h" -#include "world.h" - -#include -#include "guiobject.h" -#include "guiobjectfactory.h" -#include -#include - -World::World() { - currentLong = 0; - endLong = 0; - background = ""; -} - -void World::clear() { - clearItems(); - snake.clear(); -} - -double World::getCurrentLong() const { - return currentLong; -} - -QMultiMap World::getItems() const -{ - return items; -} - -void World::unPause() { - time = QDateTime::currentMSecsSinceEpoch(); - snake.unPause(); -} - -void World::clearItems() { - for (auto i : items) { - delete i; - } - oldRules.clear(); - items.clear(); - spead = 0; - d_spead = 0; -} - -void World::changeCountObjects(const QString &name, int count) { - - if (count > 0) { - - for ( int i = 0; i < count; ++i ) { - auto obj = GuiObjectFactory::generate(name); - - if (!obj) { - qWarning() <<"object not created line:" << Q_FUNC_INFO; - break; - } - - items.insertMulti(name, obj); - } - - } else { - for ( int i = count; i < 0; ++i ) { - auto obj = items.value(name); - if (1 != items.remove(name, obj)) { - qWarning() << "World::changeCountObjects error delete object!"; - } - delete obj; - } - } -} - -QMap World::init(WorldRules rules) { - - QMap res; - -// rules["BackGround"] = 1; - - currentLong = -1; - for (auto i = rules.begin(); i != rules.end(); ++i) { - if (i.key() == "Long") { - endLong = rules["Long"]; - currentLong = 0; - } - else if (i.key() == "Spead") { - d_spead = rules["Spead"]; - } - else { - changeCountObjects(i.key(), i.value() - oldRules.value(i.key())); - } - } - - auto snakeItems = snake.init(20, &spead); - - for (auto i = snakeItems.begin(); i != snakeItems.end(); ++i) { - res.insert(i.key(), i.value()); - } - - for (auto i : items) { - res[i->guiId()] = i; - } - - - oldRules = rules; - time = QDateTime::currentMSecsSinceEpoch(); - defiat = false; - return res; -} - -World::~World() { - clearItems(); -} - -void World::render() { - - qint64 tempTime = QDateTime::currentMSecsSinceEpoch() - time; - time = QDateTime::currentMSecsSinceEpoch(); - double dx = spead / 1000 * tempTime; - - spead -= 0.0310 * tempTime; - - if (spead < 0) - spead = 0; - - snake.render(); - auto rig = snake.getItems().first(); - - for (auto i = items.begin(); i != items.end(); ++i) { - defiat |= (*i)->move(rig, dx); - (*i)->render(); - } - - defiat |= (rig->y()< 0 || rig->y() > 100); - - if (!snake.isDead() && defiat) { - snake.kill(); - } - - currentLong += dx; -} - -void World::resetPosition() { - for (auto i : items) { - i->reset(); - } - spead = 0; - - snake.resetPosotion(); -} - -bool World::move() { - return isEnd(); -} - -bool World::isEnd() { - return currentLong >= endLong; -} - -bool World::isDefiat() const { - return defiat && !static_cast(spead); -} - -WorldRules World::currentRules() const { - return oldRules; -} - -void World::reversClick() { - if (snake.isDead()) { - spead = 0; - return; - } - - snake.reverse(); - spead += d_spead; -} diff --git a/SnakeClient/SnakeApp/back-end/world.h b/SnakeClient/SnakeApp/back-end/world.h deleted file mode 100644 index d786634..0000000 --- a/SnakeClient/SnakeApp/back-end/world.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef WORLD_H -#define WORLD_H - -#define SPEEDWORLD 10 - -#include -#include "itemworld.h" -#include "baseclass.h" -#include "snakeutils.h" -#include "snake.h" - -class World : public BaseClass -{ -private: - - Snake snake; - QMultiMap items; - double currentLong = 0; - int endLong; - double spead = 0, d_spead = 0; - QString background; - qint64 time; - bool defiat = false; - WorldRules oldRules; - - void clearItems(); - - void changeCountObjects(const QString &name, int count); - -public: - World(); - void clear(); - QMap init(WorldRules rules); - ~World() override; - void render() override; - void resetPosition(); - bool move(); - bool isEnd(); - bool isDefiat() const; - WorldRules currentRules() const; - void reversClick(); - double getCurrentLong() const; - QMultiMap getItems() const; - void unPause(); -}; - -#endif // WORLD_H diff --git a/SnakeClient/SnakeApp/front-end/About.qml b/SnakeClient/SnakeApp/front-end/About.qml deleted file mode 100644 index 8bcbc05..0000000 --- a/SnakeClient/SnakeApp/front-end/About.qml +++ /dev/null @@ -1,29 +0,0 @@ -import QtQuick 2.9 -import QtQuick.Controls.Material 2.0 -import QtQuick.Controls 2.3 -import QtQuick.Layouts 1.3 - -Page { - - signal close(); - - title: "Page" - header: Rectangle { - height: parent.height * 0.1 - color: "#cccccc" - Label { - id: title - text: qsTr("About") - font.pointSize: 13 - wrapMode: Text.WordWrap - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - anchors.fill: parent; - anchors.margins: 5 - } - } - - contentItem: AboutPage{ - } - -} diff --git a/SnakeClient/SnakeApp/front-end/AboutPage.qml b/SnakeClient/SnakeApp/front-end/AboutPage.qml deleted file mode 100644 index ef34917..0000000 --- a/SnakeClient/SnakeApp/front-end/AboutPage.qml +++ /dev/null @@ -1,72 +0,0 @@ -import QtQuick 2.9 -import QtQuick.Controls 2.3 -import QtQuick.Controls.Material 2.0 -import QtQuick.Layouts 1.3 - -Item { - clip: true - ColumnLayout { - id: columnLayout - anchors.fill: parent - spacing: 10 - - Rectangle { - Layout.preferredHeight: parent.width / 4 - Layout.preferredWidth: parent.width / 4 - Layout.alignment: Qt.AlignHCenter | Qt.AlignTop - color: "#00000000" - Image { - id: aboutLogo - fillMode: Image.PreserveAspectFit - - source: "qrc:/logo/logo" - anchors.margins: 10 - anchors.fill: parent - - } - } - - - - Flickable { - id: flickable - clip: true - flickableDirection: Flickable.VerticalFlick - - Layout.preferredHeight: parent.height - parent.height / 2.8 - - - TextArea.flickable: TextArea { - id: textArea - textFormat: Qt.RichText - wrapMode: TextArea.Wrap - readOnly: true - persistentSelection: true - - leftPadding: 6 - rightPadding: 6 - topPadding: 0 - bottomPadding: 0 - background: null - - text: qsTr("Product of QuasarrApp"); - font.family: "Verdana" - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignTop - - onLinkActivated: Qt.openUrlExternally(link) - } - - ScrollBar.vertical: ScrollBar { } - Layout.fillWidth: true - - } - - } - -} - -/*##^## Designer { - D{i:0;autoSize:true;height:480;width:640} -} - ##^##*/ diff --git a/SnakeClient/SnakeApp/front-end/BasePopUp.qml b/SnakeClient/SnakeApp/front-end/BasePopUp.qml deleted file mode 100644 index 62af5a8..0000000 --- a/SnakeClient/SnakeApp/front-end/BasePopUp.qml +++ /dev/null @@ -1,71 +0,0 @@ -import QtQuick 2.11 -import QtQuick.Controls 2.3 -import QtQuick.Controls.Material 2.0 -import QtQuick.Layouts 1.3 -import QtGraphicalEffects 1.12 - -Dialog { - id : basePopup - width: 200 - height: 100 - x: 0 - y: 0 - - transformOrigin: Item.Center - - property bool autoClose: true - property bool clickClose: true - - property int closeInterval: 15000; - property int margin : 0 - property color backgroundColor: Material.background - - background: Item { - id: bacground - - Rectangle{ - anchors.fill: parent - id: backCorner - color: backgroundColor - radius: metrix.mm - } - - DropShadow { - anchors.fill: parent - source: backCorner - color: "#80000000" - verticalOffset: 10 - samples: 30 - } - } - - function _show() { - - if (autoClose) { - timerAutoClose.start(); - } - - open(); - } - - Timer { - id: timerAutoClose; - running: false; - repeat: false; - interval: closeInterval; - - onTriggered: { - close(); - } - } - - onClosed: { - if (autoClose) - opacity = 0; - } - - closePolicy: (!clickClose || autoClose)? Popup.NoAutoClose: Popup.CloseOnReleaseOutside - - onRejected: close() - -} diff --git a/SnakeClient/SnakeApp/front-end/FrameView.qml b/SnakeClient/SnakeApp/front-end/FrameView.qml deleted file mode 100644 index 33cc8e6..0000000 --- a/SnakeClient/SnakeApp/front-end/FrameView.qml +++ /dev/null @@ -1,32 +0,0 @@ -import QtQuick 2.12 -import QtQuick.Controls.Material 2.12 -import QtQuick.Controls 2.12 -import QtQuick.Layouts 1.3 -import QtGraphicalEffects 1.12 - -Frame { - id: frameVew - property bool translucent: true - property bool showBorder: true - - function _backGroundColor() { - if (translucent) { - if (Material.theme == Material.Dark) { - return "#50000000"; - } - - return "#50ffffff"; - } - - return Material.background; - } - - background: Rectangle { - color: _backGroundColor() - border.color: (Material.theme == Material.Dark)? "#000000": "#cfcfcf" - border.width: (showBorder)? 1 : 0 - radius: metrix.mm - } - - padding: 3 * metrix.mm -} diff --git a/SnakeClient/SnakeApp/front-end/GraphicItem.qml b/SnakeClient/SnakeApp/front-end/GraphicItem.qml deleted file mode 100644 index 3534c99..0000000 --- a/SnakeClient/SnakeApp/front-end/GraphicItem.qml +++ /dev/null @@ -1,38 +0,0 @@ -import QtQuick 2.9 - -Rectangle { - id: graphicItem - property var model: null - property real angle: (model) ? model.angle : 0; - property string texture: (model) ? model.texture : ""; - property int guiId: (model) ? model.guiId : -1; - - z:-1 - property double devX: width / 2 - property double devY: height / 2 - - Image { - id: name - visible: texture.length - source: texture - - anchors.fill: parent; - } - - color: (model) ? model.color : "#11ff32"; - - width: (model) ? model.w * metrix.gamePt: 0; - height: (model) ? model.h * metrix.gamePt: 0; - - x: (model) ? model.x * metrix.gamePt - devX: 0; - y: (model) ? model.y * metrix.gamePt - devY: 0; - - radius: (model) ? model.radius * metrix.gamePt : 0; - - transform: Rotation { - origin.x: devX; - origin.y: devY; - angle: graphicItem.angle; - } - -} diff --git a/SnakeClient/SnakeApp/front-end/ImageView.qml b/SnakeClient/SnakeApp/front-end/ImageView.qml deleted file mode 100644 index 8e492b4..0000000 --- a/SnakeClient/SnakeApp/front-end/ImageView.qml +++ /dev/null @@ -1,83 +0,0 @@ -import QtQuick 2.12 -import QtQuick.Controls.Material 2.12 -import QtQuick.Controls 2.12 -import QtQuick.Layouts 1.3 -import QtGraphicalEffects 1.12 - -Item { - id: imageView - property int size: 50 - property double ratio: 1 - property string drawItem: "" - property bool hovered: false - property bool hold: false - - signal clicked(); - - width: size * ratio - height: size - - Image { - id: img - fillMode: Image.PreserveAspectFit - source: drawItem - sourceSize: Qt.size(width, height) - smooth: true - visible: false - anchors.fill: parent - } - - DropShadow { - anchors.fill: img - horizontalOffset: (hold)? 20: (hovered)? 10: 5 - verticalOffset: (hold)? 20: (hovered)? 10: 5 - radius: 8.0 - samples: 17 - Behavior on horizontalOffset { - - ColorAnimation { - duration: 200 - } - } - - Behavior on verticalOffset { - - ColorAnimation { - duration: 200 - } - } - - - Behavior on color { - - ColorAnimation { - duration: 200 - } - } - color: (hold)? "#80000000": (hovered)? "#60000000": "#40000000" - source: img - } - - MouseArea { - anchors.fill: parent - hoverEnabled: true - - onEntered: { - parent.hovered = true; - } - - onExited: { - parent.hovered = false; - } - - onReleased: { - parent.hold = false; - imageView.clicked(); - } - - onPressed: { - parent.hold = true; - } - } - -} diff --git a/SnakeClient/SnakeApp/front-end/LeftBoxSideBar.qml b/SnakeClient/SnakeApp/front-end/LeftBoxSideBar.qml deleted file mode 100644 index 05e1daa..0000000 --- a/SnakeClient/SnakeApp/front-end/LeftBoxSideBar.qml +++ /dev/null @@ -1,13 +0,0 @@ -import QtQuick 2.0 - -LeftSideBar { - resizeHeight: true; - closedHeight: closedWidth; - openHeight: 10 * metrix.pt; - openWidth: 10 * metrix.pt; - anchors.left: parent.left; - anchors.top: undefined; - anchors.bottom: undefined; - -} - diff --git a/SnakeClient/SnakeApp/front-end/LeftSideBar.qml b/SnakeClient/SnakeApp/front-end/LeftSideBar.qml deleted file mode 100644 index e566da8..0000000 --- a/SnakeClient/SnakeApp/front-end/LeftSideBar.qml +++ /dev/null @@ -1,35 +0,0 @@ -import QtQuick 2.12 -import QtQuick.Controls.Material 2.12 -import QtQuick.Controls 2.12 -import QtQuick.Layouts 1.3 - -SideBar { - id: leftSideBar - anchors.left: parent.left; - anchors.top: parent.top; - anchors.bottom: parent.bottom; - closedWidth: closeButton.width + padding * 2; - openWidth: 10 * metrix.pt; - resizeHeight: false; - - header: - RowLayout { - - Button { - id: closeButton - text: leftSideBar.isOpened? "<" : ">" - - Layout.preferredHeight: metrix.controlPtMaterial; - Layout.preferredWidth: metrix.controlPtMaterial; - - Layout.alignment: Qt.AlignRight | Qt.AlignTop - onClicked: { - if (leftSideBar.isOpened) - leftSideBar.hide(); - else - leftSideBar.show(); - } - - } - } -} diff --git a/SnakeClient/SnakeApp/front-end/LoginView.qml b/SnakeClient/SnakeApp/front-end/LoginView.qml deleted file mode 100644 index e7c1ab8..0000000 --- a/SnakeClient/SnakeApp/front-end/LoginView.qml +++ /dev/null @@ -1,301 +0,0 @@ -import QtQuick 2.12 -import QtQuick.Controls.Material 2.12 -import QtQuick.Controls 2.12 -import QtQuick.Layouts 1.3 -import QtGraphicalEffects 1.12 - -Item { - id: element - - property int loginStatus : 0 - - readonly property int currentView: tabBar.currentIndex - readonly property var resultEnum: [ - qsTr("Success"), // 0 - qsTr("Password must be at least 8 characters"), // 1 - qsTr("Name must be at least 1 characters"), // 2 - qsTr("Passwords must match"), // 3 - - qsTr("The letter must match the pattern 'X@xxxx.xxx'") // 4 - - ] - - signal sigNewUser(var gmail, var password); - signal sigLogin(var gmail, var password); - signal toOffline(); - - - function _checkLogin() { - const pass = loginPass.text; - const email = loginEmail.text; - - if (pass.length < 8) { - return 1; - } - - if (email.search(/[a-z\-A-Z0-9_]+@[a-z\-A-Z0-9_]+\.[a-z\-A-Z0-9_]+/) < 0) { - return 4; - } - - return 0; - - } - - function _checkRegister () { - const pass = registerPassword.text; - const pass2 = registerPassword2.text; - - const email = registerEmail.text; - - if (pass.length < 8) { - return 1; - } - - if (pass !== pass2) { - return 3; - } - - if (email.search(/[a-z\-A-Z0-9_]+@[a-z\-A-Z0-9_]+\.[a-z\-A-Z0-9_]+/) < 0) { - return 4; - } - - return 0; - } - - function checkData(isregisterForm) { - if (isregisterForm) { - return _checkRegister(); - } - - return _checkLogin(); - } - - SwipeView { - id: swipeView - anchors.bottom: bottons.top - anchors.top: tabBar.bottom - anchors.left: parent.left - anchors.right: parent.right - - clip: true - - currentIndex: tabBar.currentIndex - - Item { - id: loginPage - - GridLayout { - id: columnLayout - anchors.fill: parent - columns: 2 - rows: 2 - Label { - text: qsTr("Email") - } - - TextField { - id: loginEmail - placeholderText: "Enter Your Email" - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - Layout.fillWidth: true - } - - - Label { - text: qsTr("Passsword") - } - TextField { - id: loginPass - placeholderText: qsTr("Enter Your passsword") - - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - - echoMode: TextInput.Password - cursorVisible: true - Layout.fillWidth: true - - } - - } - } - - Item { - id: rigisterPage - GridLayout { - - anchors.fill: parent - - columns: 2 - rows: 3 - - Label { - text: qsTr("Email") - } - TextField { - id: registerEmail; - placeholderText: qsTr("Enter Your Email") - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - Layout.fillWidth: true - - } - - Label { - text: qsTr("Password") - } - TextField { - id: registerPassword; - - placeholderText: qsTr("Enter Your passsword") - - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - Layout.fillWidth: true - echoMode: TextInput.Password - cursorVisible: true - } - - Label { - text: qsTr("Repeat password") - } - TextField { - id: registerPassword2; - - placeholderText: qsTr("Enter Your passsword again") - - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - Layout.fillWidth: true - echoMode: TextInput.Password - cursorVisible: true - } - } - } - } - - TabBar { - id: tabBar - anchors.top: parent.top - anchors.topMargin: 0 - anchors.left: parent.left - anchors.leftMargin: 0 - anchors.right: parent.right - anchors.rightMargin: 0 - - TabButton { - id: login - text: qsTr("Sign in") - checkable: false - } - - TabButton { - id: register - text: qsTr("Sign Up") - } - } - - RowLayout { - id : bottons - Button { - text: qsTr("Cancel") - - onClicked: { - Qt.quit() - } - - } - - Item { - Layout.fillWidth: true - } - - Button { - text: tabBar.currentItem.text - - onClicked: { - - const messageIndex = checkData(tabBar.currentIndex); - if (messageIndex === 0) { - - if (tabBar.currentIndex) { - // register request - sigNewUser(registerEmail.text, registerPassword); - } else { - //login request - sigLogin(loginEmail.text, loginPass.text); - } - } else { - - notificationService.setNotify(qsTr("Error"), - resultEnum[messageIndex], - "", - 2); - } - } - - } - - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.right: parent.right - } - - onLoginStatusChanged: { - if (loginStatus === 2) - busy._show(); - else { - busy.close(); - } - } - - PagePopUp { - id: busy - modal: true - autoClose: false; - clickClose: false; - BusyIndicator { - running: true - anchors.fill: parent - } - height: 2 * metrix.controlPtMaterial - width: height - - } - - - FrameView { - visible: loginStatus === 4 - anchors.fill: parent - translucent: false - showBorder: false - ColumnLayout { - anchors.fill: parent - - Label { - text: qsTr("You need connect to server"); - font.pixelSize: metrix.controlPtMaterial; - wrapMode: Text.WordWrap - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - - Layout.fillHeight: true - Layout.fillWidth: true - - } - - Button { - text: qsTr("Use OfflineMode"); - Layout.alignment: Qt.AlignHCenter - - onClicked: { - toOffline(); - } - - } - } - - } -} - -/*##^## Designer { - D{i:0;autoSize:true;height:480;width:640}D{i:3;anchors_height:100;anchors_width:100;anchors_x:228;anchors_y:63} -D{i:1;anchors_height:200;anchors_width:200;anchors_x:205;anchors_y:53}D{i:11;anchors_width:240;anchors_x:226;anchors_y:21} -} - ##^##*/ diff --git a/SnakeClient/SnakeApp/front-end/MainMenu.qml b/SnakeClient/SnakeApp/front-end/MainMenu.qml deleted file mode 100644 index 74147e0..0000000 --- a/SnakeClient/SnakeApp/front-end/MainMenu.qml +++ /dev/null @@ -1,196 +0,0 @@ -import QtQuick 2.9 -import QtQuick.Controls.Material 2.0 -import QtQuick.Controls 2.3 -import QtQuick.Layouts 1.3 - -Item { - id: item1 - property var model: null - readonly property int onlineStatus: (model)? model.onlineStatus: false - - visible: true - z: 1 - - signal playGame(); - - onOnlineStatusChanged: { - if (onlineStatus && onlineStatus !== 5) { - loginPopUp._show(); - } else { - loginPopUp.close(); - } - } - - LeftSideBar { - id: userViewSideBar - openWidth: 7 * metrix.pt; - - openHeight: columnLayout.height - source: UserView { - - anchors.fill: parent; - model: (item1.model)? item1.model.userViewModel: null - visible: userViewSideBar.openFinished - onTryConnect: { - if (item1.model) - item1.model.tryConnect(); - } - } - - } - - - GridLayout { - id: columnLayout - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.left: userViewSideBar.right - anchors.right: parent.right - - anchors.leftMargin: 0 - anchors.rightMargin: 0 - anchors.bottomMargin: 0 - anchors.topMargin: 0 - - columns: 3 - rows: 2 - - - transformOrigin: Item.Center - - - MainMenuButton { - id: play - text: qsTr("Play game") - - onClicked: { - playGame(); - if (model) - model.newGame(); - } - - } - - MainMenuButton { - id: store - text: qsTr("Store") - - } - - MainMenuButton { - id: invitar - text: qsTr("My Items") - } - - MainMenuButton { - id: freands - text: qsTr("My friends") - - } - - MainMenuButton { - id: settings - text: qsTr("My Settings") - - onClicked: { - settingsPopUp._show(); - - } - - } - - MainMenuButton { - id: exit - text: qsTr("Exit") - - onClicked: { - Qt.quit(); - } - } - - } - - PagePopUp { - id: about; - width: parent.width / 2 - height: parent.height / 2; - - source: About {} - } - - PagePopUp { - id: settingsPopUp - source: SettingsView { - id: settingsView - model: item1.model ? item1.model.userSettingsModel: null - } - - standardButtons: Dialog.Save | Dialog.Cancel | Dialog.RestoreDefaults - modal: false; - autoClose: false - clickClose: true - width: 12 * metrix.controlPtMaterial - height: 8 * metrix.controlPtMaterial; - - onAccepted: { - settingsView.save(); - } - - onReset: { - settingsView.reset(); - } - - onOpened: { - settingsView.update(); - } - - } - - - PagePopUp { - id: loginPopUp - source: LoginView { - id: loginView - loginStatus: onlineStatus - - onSigLogin: { - if (!model) { - return; - } - - model.login(gmail, password); - } - onSigNewUser: { - if (!model) { - return; - } - - model.registerNewUser(gmail, password); - - } - - onToOffline: { - if (!model) { - return; - } - - model.playOffline(); - } - } - - visible: true; - modal: true; - autoClose: false - clickClose: false - width: 12 * metrix.controlPtMaterial - height: ((loginView.currentView)? 9 : 7) * metrix.controlPtMaterial; - } - - -} - - -/*##^## Designer { - D{i:0;autoSize:true;height:480;width:640} -} - ##^##*/ diff --git a/SnakeClient/SnakeApp/front-end/MainMenuButton.qml b/SnakeClient/SnakeApp/front-end/MainMenuButton.qml deleted file mode 100644 index 12f6eb0..0000000 --- a/SnakeClient/SnakeApp/front-end/MainMenuButton.qml +++ /dev/null @@ -1,17 +0,0 @@ -import QtQuick 2.12 -import QtQuick.Controls.Material 2.12 -import QtQuick.Controls 2.12 -import QtQuick.Layouts 1.3 - -Button { - id: exit - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - font.pixelSize: height * 0.1 - display: AbstractButton.TextBesideIcon - spacing: 4 - focusPolicy: Qt.StrongFocus - - Layout.preferredHeight: parent.height / (parent.rows + 1) - Layout.preferredWidth: parent.width / (parent.columns + 1) - -} diff --git a/SnakeClient/SnakeApp/front-end/Metrix.qml b/SnakeClient/SnakeApp/front-end/Metrix.qml deleted file mode 100644 index f0bacc8..0000000 --- a/SnakeClient/SnakeApp/front-end/Metrix.qml +++ /dev/null @@ -1,27 +0,0 @@ -import QtQuick 2.0 -import QtQuick.Window 2.12 -import QtQuick.Controls.Material 2.0 -import QtQuick.Controls 2.3 - -Item { - readonly property int pointCount: 100; - readonly property real mm: Screen.pixelDensity - readonly property real sm: 10 * mm - readonly property real dsm: Math.sqrt(Math.pow(Screen.desktopAvailableWidth, 2) + Math.pow(Screen.desktopAvailableHeight, 2)) / sm - readonly property real pt: getfactor(dsm) * sm - readonly property real controlPtMaterial: Material.buttonHeight - readonly property real gamePt: (width < height) ? width / pointCount : height / pointCount; - - function getfactor(dsm) { - if (dsm < 30) { - return 0.5 - } else if ( dsm < 70) { - return 1 - } else if (dsm < 140) { - return 2; - } else - return 4; - } - - anchors.fill: parent; -} diff --git a/SnakeClient/SnakeApp/front-end/NotificationForm.qml b/SnakeClient/SnakeApp/front-end/NotificationForm.qml deleted file mode 100644 index 72445bc..0000000 --- a/SnakeClient/SnakeApp/front-end/NotificationForm.qml +++ /dev/null @@ -1,84 +0,0 @@ -import QtQuick 2.11 -import QtQuick.Controls 2.3 -import QtQuick.Controls.Material 2.0 -import QtQuick.Layouts 1.3 - -BasePopUp { - id : popup - - property string text: qsTr("Message") - property string img: "" - property string titleText: qsTr("Message") - property int type: 0 - - function _getBackGraundColor(type) { - switch(type) { - - case 1: return "#FFC107" - case 2: return "#FF5722" - - } - - return Material.background - } - - autoClose: true; - closeInterval: 5000 - - margins: 0 - margin: 0 - spacing: 0 - - - backgroundColor: _getBackGraundColor(type); - - Page { - id: page - anchors.fill: parent - spacing: 0 - - background: Rectangle { - color: "#00000000" - } - - header: Label { - text: titleText - horizontalAlignment: Text.AlignHCenter - } - - contentItem: - RowLayout { - id: rowLayout - spacing: 5 - clip: true - - Rectangle { - color: "#00000000" - Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter - Layout.preferredWidth: rowLayout.height; - Layout.preferredHeight: rowLayout.height; - - Image { - id: image - fillMode: Image.PreserveAspectCrop - clip: true - anchors.fill: parent; - source: img - } - } - - - Label { - id: message - text: popup.text - Layout.alignment: Qt.AlignRight | Qt.AlignVCenter - Layout.fillHeight: true; - Layout.fillWidth: true; - clip: true - wrapMode: Text.WordWrap - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - } - } - } -} diff --git a/SnakeClient/SnakeApp/front-end/NotificationServiceView.qml b/SnakeClient/SnakeApp/front-end/NotificationServiceView.qml deleted file mode 100644 index fb6d18e..0000000 --- a/SnakeClient/SnakeApp/front-end/NotificationServiceView.qml +++ /dev/null @@ -1,30 +0,0 @@ -import QtQuick 2.12 -import QtQuick.Controls.Material 2.12 -import QtQuick.Controls 2.12 -import QtQuick.Layouts 1.3 -import QtGraphicalEffects 1.12 - -Item { - readonly property var model: notificationService; - readonly property var msg: model.notify - readonly property var history: model.history - - - NotificationForm { - id: notyfyView - titleText : msg.title; - text: (msg)? msg.text: ""; - img: (msg)? msg.img: ""; - type: (msg)? msg.type: 0; - - x: parent.width - width - margin; - y: margin; - - width: 6 * metrix.controlPtMaterial; - height: width * 0.5 - } - - onMsgChanged: { - notyfyView._show(); - } -} diff --git a/SnakeClient/SnakeApp/front-end/PagePopUp.qml b/SnakeClient/SnakeApp/front-end/PagePopUp.qml deleted file mode 100644 index 7c35bb4..0000000 --- a/SnakeClient/SnakeApp/front-end/PagePopUp.qml +++ /dev/null @@ -1,26 +0,0 @@ -import QtQuick 2.11 -import QtQuick.Controls 2.3 -import QtQuick.Controls.Material 2.0 -import QtQuick.Layouts 1.3 - -BasePopUp { - id: pagePopUp - property var source: null - autoClose: false - - Item { - id: sourceVal - anchors.fill: parent - } - - onSourceChanged: { - if (!source) - return; - - source.parent = sourceVal; - source.anchors.fill = sourceVal; - } - - x: parent.width / 2 - width / 2 - y: parent.height / 2 - height / 2 -} diff --git a/SnakeClient/SnakeApp/front-end/PropertyView.qml b/SnakeClient/SnakeApp/front-end/PropertyView.qml deleted file mode 100644 index 6870da8..0000000 --- a/SnakeClient/SnakeApp/front-end/PropertyView.qml +++ /dev/null @@ -1,124 +0,0 @@ -import QtQuick 2.12 -import QtQuick.Controls.Material 2.12 -import QtQuick.Controls 2.12 -import QtQuick.Layouts 1.3 -import QtGraphicalEffects 1.12 - -Item { - id: properyView - - height: 1 * metrix.pt - - property string keyImage: ""; - property string keyText: ""; - - property string valueImage: ""; - property string valueText: ""; - - property int lineWidth : 0.5 * metrix.mm - - property bool hovered: false - property bool hold: false - - Rectangle { - id:background - anchors.fill: parent - color: "#00000000" - - Rectangle { - height: lineWidth - color: (hold)? Material.accent: (hovered)? Material.foreground:"#aaa" - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.right: parent.right - - Behavior on color { - - ColorAnimation { - duration: 100 - } - } - } - } - - DropShadow { - anchors.fill: background - horizontalOffset: 2 - verticalOffset: 2 - radius: 8.0 - samples: 17 - - color: "#80000000"; - source: background - } - - MouseArea { - anchors.fill: parent - hoverEnabled: true - - onEntered: { - parent.hovered = true; - } - - onExited: { - parent.hovered = false; - } - - onReleased: { - parent.hold = false; - } - - onPressed: { - parent.hold = true; - } - } - - RowLayout { - - Label { - text: keyText - visible: keyText - Layout.alignment: Qt.AlignLeft - horizontalAlignment: Text.AlignLeft - - } - - ImageView { - visible: keyImage - drawItem: keyImage - size: parent.height * 0.75 - - Layout.alignment: Qt.AlignLeft - } - - - Label { - text: valueText - visible: valueText - horizontalAlignment: Text.AlignRight - - Layout.fillWidth: true - - Layout.alignment: Qt.AlignRight - - } - - ImageView { - drawItem: valueImage - size: parent.height * 0.75 - visible: valueImage - - Layout.alignment: Qt.AlignRight - - - } - anchors.fill: parent - } - - -} - -/*##^## Designer { - D{i:0;autoSize:true;height:480;width:640} -} - ##^##*/ diff --git a/SnakeClient/SnakeApp/front-end/Scene.qml b/SnakeClient/SnakeApp/front-end/Scene.qml deleted file mode 100644 index 524d48f..0000000 --- a/SnakeClient/SnakeApp/front-end/Scene.qml +++ /dev/null @@ -1,228 +0,0 @@ -import QtQuick 2.11 -import QtQuick.Controls.Material 2.0 -import QtQuick.Controls 2.3 -import QtQuick.Layouts 1.3 - -Item { - id: scene; - z: -2 - - Rectangle { - id: background; - color: "#ffffff" - anchors.fill: parent; - - Behavior on color { - - ColorAnimation { - duration: 5000 - } - } - - z: -3 - - } - - property var model: null; - property var arrayObjects: [] - readonly property bool showMenu: (model)? model.showMenu: false - property bool isPause: false - - function add (cppObjId) { - if (!model) { - console.log("create object fail") - return; - } - var objModel = model.getGameObject(cppObjId); - - if (!objModel) { - console.log("object model not found"); - return; - } - - var viewTemplate = objModel.viewTemplate; - - var temp = Qt.createComponent( viewTemplate + ".qml") - if (temp.status === Component.Ready) { - var obj = temp.createObject(parent) // parent - это обьект на который будет помещен соззданный элемент - obj.model = model.getGameObject(cppObjId); - obj.z = -2; - arrayObjects.push(obj) - } else { - console.log("wrong viewTemplate in model"); - } - } - - function remove(id) { - if (typeof id !== "number" || id < 0) { - console.log("id not found"); - return; - } - - for (var i = 0; i < arrayObjects.length; ++i) { - if (id === arrayObjects[i].guiId) { - arrayObjects.splice(i,1); - } - } - } - - function updateBackgroundColor(lvl) { - switch(lvl % 7) { - case 0: background.color = "#d6eaf8"; break; - case 1: background.color = "#d0ece7"; break; - case 2: background.color = "#d4efdf"; break; - case 3: background.color = "#fcf3cf"; break; - case 4: background.color = "#f6ddcc"; break; - case 5: background.color = "#f2d7d5"; break; - case 6: background.color = "#ebdef0"; break; - case 7: background.color = "#fbfcfc"; break; - - } - } - - Timer { - id: autoTimer; - repeat: true; - running: showMenu; - interval: 1000 - onTriggered: { - interval = Math.random() * 600 - scene.model.buttonPress(); - } - } - - Connections { - target: model; - onGameObjectsChanged: { - if (!dif) { - console.log("dif not found"); - return; - } - - var tempDifRem = []; - tempDifRem = dif.getRemoveIds(); - var tempDifAdd = []; - tempDifAdd = dif.getAddedIds(); - - for (var i = 0; i < tempDifAdd.length; ++i) { - add(tempDifAdd[i]); - } - - for (i = 0; i < tempDifRem.length; ++i) { - remove(tempDifRem[i]); - } - } - } - - Component.onCompleted: { - updateBackgroundColor(0); - model.handleNewGame(); - - } - - MouseArea { - anchors.fill: parent; - - onClicked: { - if (!model || showMenu) { - return; - } - - model.buttonPress(); - } - } - - Button { - id: returnToMenu; - - text: "<<" - - anchors.left: parent.left - anchors.leftMargin: metrix.gamePt - - anchors.top: parent.top - anchors.topMargin: metrix.gamePt - z: 1 - - onClicked: { - if (model) - model.showMenu = true; - } - - visible: !showMenu - } - - Button { - id: pause - - text: (isPause)? "▶" :"||" - - anchors.left: returnToMenu.right - anchors.leftMargin: metrix.gamePt - - anchors.top: parent.top - anchors.topMargin: metrix.gamePt - z: returnToMenu.z - - onClicked: { - isPause = !isPause; - if (model) model.setPause(isPause); - } - - visible: !showMenu - - } - - Button { - id: long_ - Label { - anchors.fill: parent; - - textFormat: Text.AutoText - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - wrapMode: Text.WordWrap - - text: qsTr("lvl long: ") + ((model)? model.long_: "0") - } - - width: 35 * metrix.gamePt; - height: pause.height; - - anchors.left: pause.right - anchors.leftMargin: metrix.gamePt - - anchors.top: parent.top - anchors.topMargin: metrix.gamePt - z: returnToMenu.z - - visible: !showMenu - - } - - Button { - Label { - anchors.fill: parent; - - textFormat: Text.AutoText - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - wrapMode: Text.WordWrap - - text: qsTr("general long: ") + ((model)? model.generalLong: "0") - } - - width: 35 * metrix.gamePt; - height: long_.height; - - anchors.left: long_.right - anchors.leftMargin: metrix.gamePt - - anchors.top: parent.top - anchors.topMargin: metrix.gamePt - z: returnToMenu.z - - visible: !showMenu - - } -} diff --git a/SnakeClient/SnakeApp/front-end/SelectLevelScene.qml b/SnakeClient/SnakeApp/front-end/SelectLevelScene.qml deleted file mode 100644 index 674424e..0000000 --- a/SnakeClient/SnakeApp/front-end/SelectLevelScene.qml +++ /dev/null @@ -1,217 +0,0 @@ -import QtQuick 2.9 -import QtQuick.Controls 2.3 -import QtQuick.Controls.Material 2.0 -import QtQuick.Layouts 1.3 - -Item { - id: item1 - - GridLayout { - id: gridLayout - rows: 8 - columnSpacing: 5 - rowSpacing: 5 - anchors.rightMargin: 200 - anchors.leftMargin: 200 - anchors.bottomMargin: 100 - anchors.topMargin: 50 - anchors.fill: parent - columns: 8 - - RoundButton { - id: roundButton - width: 10*mainWindow.point - height: 10*mainWindow.point - text: "1" - } - - RoundButton { - id: roundButton1 - width: 10*mainWindow.point - height: 10*mainWindow.point - text: "2" - } - - RoundButton { - id: roundButton2 - width: 10*mainWindow.point - height: 10*mainWindow.point - text: "3" - } - - RoundButton { - id: roundButton3 - width: 10*mainWindow.point - height: 10*mainWindow.point - text: "4" - } - - RoundButton { - id: roundButton4 - width: 10*mainWindow.point - height: 10*mainWindow.point - text: "5" - } - - RoundButton { - id: roundButton5 - width: 10*mainWindow.point - height: 10*mainWindow.point - text: "6" - } - - RoundButton { - id: roundButton6 - width: 10*mainWindow.point - height: 10*mainWindow.point - text: "7" - } - - RoundButton { - id: roundButton7 - width: 10*mainWindow.point - height: 10*mainWindow.point - text: "8" - } - - RoundButton { - id: roundButton8 - width: 10*mainWindow.point - height: 10*mainWindow.point - text: "9" - } - - RoundButton { - id: roundButton9 - width: 10*mainWindow.point - height: 10*mainWindow.point - text: "10" - } - - RoundButton { - id: roundButton10 - width: 10*mainWindow.point - height: 10*mainWindow.point - text: "11" - } - - RoundButton { - id: roundButton11 - width: 10*mainWindow.point - height: 10*mainWindow.point - text: "12" - } - - RoundButton { - id: roundButton12 - width: 10*mainWindow.point - height: 10*mainWindow.point - text: "13" - } - - RoundButton { - id: roundButton13 - width: 10*mainWindow.point - height: 10*mainWindow.point - text: "14" - } - - RoundButton { - id: roundButton14 - width: 10*mainWindow.point - height: 10*mainWindow.point - text: "15" - } - - RoundButton { - id: roundButton15 - width: 10*mainWindow.point - height: 10*mainWindow.point - text: "16" - } - - RoundButton { - id: roundButton16 - width: 10*mainWindow.point - height: 10*mainWindow.point - text: "17" - } - - RoundButton { - id: roundButton17 - width: 10*mainWindow.point - height: 10*mainWindow.point - text: "18" - } - - RoundButton { - id: roundButton18 - width: 10*mainWindow.point - height: 10*mainWindow.point - text: "19" - } - - RoundButton { - id: roundButton19 - width: 10*mainWindow.point - height: 10*mainWindow.point - text: "20" - } - - RoundButton { - id: roundButton20 - width: 10*mainWindow.point - height: 10*mainWindow.point - text: "21" - } - - RoundButton { - id: roundButton21 - width: 10*mainWindow.point - height: 10*mainWindow.point - text: "22" - } - - RoundButton { - id: roundButton22 - width: 10*mainWindow.point - height: 10*mainWindow.point - text: "23" - } - - RoundButton { - id: roundButton23 - width: 10*mainWindow.point - height: 10*mainWindow.point - text: "24" - } - - RoundButton { - id: roundButton24 - width: 10*mainWindow.point - height: 10*mainWindow.point - text: "25" - } - - RoundButton { - id: roundButton25 - width: 10*mainWindow.point - height: 10*mainWindow.point - text: "26" - } - } - - Label { - id: label - x: 187 - color: "#795548" - text: qsTr("Select Level") - font.bold: true - font.pixelSize: 30 - anchors.horizontalCenter: parent.horizontalCenter - anchors.top: parent.top - anchors.topMargin: 30 - } - -} - diff --git a/SnakeClient/SnakeApp/front-end/SettingsView.qml b/SnakeClient/SnakeApp/front-end/SettingsView.qml deleted file mode 100644 index 337b0c9..0000000 --- a/SnakeClient/SnakeApp/front-end/SettingsView.qml +++ /dev/null @@ -1,122 +0,0 @@ -import QtQuick 2.12 -import QtQuick.Controls.Material 2.12 -import QtQuick.Controls 2.12 -import QtQuick.Layouts 1.3 - -Item { - id: settingsView - - property var model: null - - function save() { - if (!model) { - return; - } - - model.setPort(port.value); - model.setHost(host.text); - model.setTheme(themeBox.currentIndex); - - } - - function reset() { - if (!model) { - return; - } - - model.toDefault(); - } - - function update() { - if (!model) { - return; - } - model.forceUpdate(); - } - - GridLayout { - - id: columnLayout - rows: 4 - columns: 2 - anchors.fill: parent - - - Label { - text: qsTr("Game Host") - Layout.fillWidth: true - } - - TextField { - id: host; - text: (model)? model.host: "localhost" - Layout.fillHeight: false - Layout.fillWidth: true - horizontalAlignment: Text.AlignLeft - Layout.alignment: Qt.AlignRight | Qt.AlignVCenter - - } - - Label { - text: qsTr("Game Port") - Layout.fillWidth: true - } - - SpinBox { - id: port; - Layout.fillWidth: true - to: 10000 - from: 7000 - antialiasing: false - scale: 1 - Layout.alignment: Qt.AlignRight | Qt.AlignVCenter - - value: (model)? model.port: 7777 - - } - - Label { - text: qsTr("Use Them") - Layout.fillWidth: true - } - - ComboBox { - id: themeBox; - Layout.fillWidth: true - focusPolicy: Qt.NoFocus - - model: [qsTr("Light"), qsTr("Dark")]; - Layout.alignment: Qt.AlignRight | Qt.AlignVCenter - - currentIndex: (settingsView.model)? settingsView.model.theme: 0 - - onCurrentIndexChanged: { - if (((settingsView.model)? settingsView.model.theme: 0) - !== currentIndex) { - themeWarning.visible = true; - } - } - - } - - Item { - Layout.fillHeight: true - Layout.fillWidth: true - - } - - Label { - id: themeWarning - text: qsTr("In order for the new theme to take effect, you need to reload the game."); - - color: "#FF0000" - - wrapMode: Label.WordWrap - - Layout.maximumWidth: themeBox.width - - visible: false; - } - } - -} diff --git a/SnakeClient/SnakeApp/front-end/SideBar.qml b/SnakeClient/SnakeApp/front-end/SideBar.qml deleted file mode 100644 index 1698007..0000000 --- a/SnakeClient/SnakeApp/front-end/SideBar.qml +++ /dev/null @@ -1,103 +0,0 @@ -import QtQuick 2.12 -import QtQuick.Controls.Material 2.12 -import QtQuick.Controls 2.12 - -FrameView { - id: sideBar - property int openHeight: 10 * metrix.pt - property int closedHeight: 1 * metrix.pt - property int openWidth: 10 * metrix.pt - property int closedWidth: 1 * metrix.pt - property int headerHeight : 1 * metrix.controlPtMaterial - - clip: true; - - property bool resizeWidth: true - property bool resizeHeight: true - - property bool isOpened: true - property bool chainAnimation: true - property var source: null - property var header: null - - readonly property bool openFinished: openHeight === height && openWidth == width; - readonly property bool closeFinished: closedHeight === height && closedWidth == width; - - function show() { - if (resizeWidth && !(chainAnimation && resizeHeight)) - width = openWidth; - if (resizeHeight ) - height = openHeight; - - isOpened = true; - - } - - function hide() { - if (resizeWidth && !(chainAnimation && resizeHeight)) - width = closedWidth; - if (resizeHeight ) - height = closedHeight; - - isOpened = false; - } - - Component.onCompleted: { - show(); - } - - onHeightChanged: { - if (isOpened) { - if (height === openHeight) { - sideBar.width = openWidth - } - } - else { - if (height === closedHeight) { - sideBar.width = closedWidth - } - } - } - - Behavior on width { - PropertyAnimation { - duration: 1000 - easing.type: Easing.OutBounce - } - } - - Behavior on height { - PropertyAnimation { - duration: 1000 - easing.type: Easing.OutBounce - } - } - - Item { - id: headerVal - anchors.left: parent.left - anchors.right: parent.right - anchors.top: parent.top - height: headerHeight - } - - Item { - id: sourceVal - - anchors.left: parent.left - anchors.right: parent.right - anchors.top: headerVal.bottom - anchors.bottom: parent.bottom - - } - - onSourceChanged: { - source.parent = sourceVal; - source.anchors.fill = sourceVal; - } - - onHeaderChanged: { - header.parent = headerVal; - header.anchors.fill = headerVal; - } -} diff --git a/SnakeClient/SnakeApp/front-end/SnakeItem.qml b/SnakeClient/SnakeApp/front-end/SnakeItem.qml deleted file mode 100644 index 6614e09..0000000 --- a/SnakeClient/SnakeApp/front-end/SnakeItem.qml +++ /dev/null @@ -1,17 +0,0 @@ -import QtQuick 2.9 - -GraphicItem { - - Behavior on color { - ColorAnimation { - duration: 2000 - } - } - - Behavior on radius { - NumberAnimation { - duration: 2000 - } - } - -} diff --git a/SnakeClient/SnakeApp/front-end/TextInput.qml b/SnakeClient/SnakeApp/front-end/TextInput.qml deleted file mode 100644 index 17ac7c5..0000000 --- a/SnakeClient/SnakeApp/front-end/TextInput.qml +++ /dev/null @@ -1,47 +0,0 @@ -import QtQuick 2.11 -import QtQuick.Controls 2.3 -import QtQuick.Controls.Material 2.0 -import QtQuick.Layouts 1.3 - - -Item { - - signal close(); - - RowLayout { - anchors.fill: parent - Layout.fillWidth: true - Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom - - Label { - text: qsTr("Write you name "); - - } - - TextField { - - id: input; - - Layout.fillWidth: true - horizontalAlignment: Text.AlignHCenter - - } - - Button { - - id: ok - text: qsTr("Ok") - Layout.alignment: Qt.AlignRight | Qt.AlignVCenter - - onClicked: { - if (contr) { - var rec = contr.getRecords() - rec.append(input.text, contr.generalLong); - } - - close(); - - } - } - } -} diff --git a/SnakeClient/SnakeApp/front-end/UserView.qml b/SnakeClient/SnakeApp/front-end/UserView.qml deleted file mode 100644 index 848d3d6..0000000 --- a/SnakeClient/SnakeApp/front-end/UserView.qml +++ /dev/null @@ -1,112 +0,0 @@ -import QtQuick 2.12 -import QtQuick.Controls.Material 2.12 -import QtQuick.Controls 2.12 -import QtQuick.Layouts 1.3 -import QtGraphicalEffects 1.12 - - -Flickable { - id: userVewFlic - - contentWidth: userVew.width - contentHeight: userVew.height - flickableDirection: Flickable.VerticalFlick; - property var model: null - signal tryConnect(); - - ScrollBar.vertical: ScrollBar { - width: metrix.pt - } - - Item { - id: userVew - - width: userVewFlic.width - - ColumnLayout { - id: columnLayout - anchors.fill: parent - - visible: (model)? !model.offline: false; - - ImageView { - drawItem: "image://userItems/player/" + ((model)? model.id: -1).toString() - Layout.fillWidth: true - Layout.fillHeight: true - - } - - PropertyView { - Layout.fillWidth: true - keyText: qsTr("You "); - valueText : (model)? model.name: -1 - - } - - PropertyView { - valueText : ((model)? model.gmail: -1).toString() - Layout.fillWidth: true - keyText: qsTr("You gmail"); - } - - PropertyView { - keyText: qsTr("Money "); - - valueText : ((model)? model.money: -1).toString() - Layout.fillWidth: true - } - - PropertyView { - keyText: qsTr("Record "); - - valueText : ((model)? model.record: -1).toString() - Layout.fillWidth: true - } - - PropertyView { - keyText: qsTr("AvgRecord "); - - valueText : ((model)? model.avgRecord: -1).toString() - Layout.fillWidth: true - - } - - PropertyView { - keyText: qsTr("Snake "); - - valueImage : "image://userItems/item/" + ((model)? model.cureentSnake: -1).toString() - Layout.fillWidth: true - - } - } - - ColumnLayout { - visible: (model)? model.offline: false; - anchors.fill: parent - - Label { - wrapMode: Text.WordWrap - Layout.fillWidth: true - - text: qsTr("Offline mode. Your statistics will be frozen until you login your profile."); - } - - Button { - text: qsTr("try conect to server "); - - Layout.alignment: Qt.AlignHCenter - - onClicked: { - tryConnect(); - } - } - - Item { - Layout.fillHeight: true - - } - } - - } -} - diff --git a/SnakeClient/SnakeApp/front-end/main.qml b/SnakeClient/SnakeApp/front-end/main.qml deleted file mode 100644 index bd8e027..0000000 --- a/SnakeClient/SnakeApp/front-end/main.qml +++ /dev/null @@ -1,40 +0,0 @@ -import QtQuick 2.12 -import QtQuick.Window 2.12 -import QtQuick.Controls 2.12 - -ApplicationWindow { - id: mainWindow; - visible: true; - width: 640; - height: 480; - title: qsTr("SnakeOnTheRoad"); - -// Component.onCompleted: { -// mainWindow.showFullScreen(); -// } - - - Metrix {id: metrix} - - Scene { - id: scane; - model: contr; - anchors.fill: parent; - } - - MainMenu { - - model: (contr)? contr.mainMenuModel: null; - anchors.fill: parent; - visible: scane.showMenu; - - onPlayGame: { - contr.showMenu = false; - } - - } - - NotificationServiceView { - anchors.fill: parent; - } -} diff --git a/SnakeClient/SnakeApp/img/Settings-icon.png b/SnakeClient/SnakeApp/img/Settings-icon.png deleted file mode 100644 index 4c13597..0000000 Binary files a/SnakeClient/SnakeApp/img/Settings-icon.png and /dev/null differ diff --git a/SnakeClient/SnakeApp/img/asphalt.jpg b/SnakeClient/SnakeApp/img/asphalt.jpg deleted file mode 100644 index cf566c2..0000000 Binary files a/SnakeClient/SnakeApp/img/asphalt.jpg and /dev/null differ diff --git a/SnakeClient/SnakeApp/img/box-texture.png b/SnakeClient/SnakeApp/img/box-texture.png deleted file mode 100644 index 9592e5f..0000000 Binary files a/SnakeClient/SnakeApp/img/box-texture.png and /dev/null differ diff --git a/SnakeClient/SnakeApp/img/cogs-solid.svg b/SnakeClient/SnakeApp/img/cogs-solid.svg deleted file mode 100644 index 9cc62a7..0000000 --- a/SnakeClient/SnakeApp/img/cogs-solid.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/SnakeClient/SnakeApp/img/defaultSnake.png b/SnakeClient/SnakeApp/img/defaultSnake.png deleted file mode 100644 index 93a3a3f..0000000 Binary files a/SnakeClient/SnakeApp/img/defaultSnake.png and /dev/null differ diff --git a/SnakeClient/SnakeApp/img/defaultUser.png b/SnakeClient/SnakeApp/img/defaultUser.png deleted file mode 100644 index 178aeec..0000000 Binary files a/SnakeClient/SnakeApp/img/defaultUser.png and /dev/null differ diff --git a/SnakeClient/SnakeApp/img/icon.ico b/SnakeClient/SnakeApp/img/icon.ico deleted file mode 100644 index 53635b1..0000000 Binary files a/SnakeClient/SnakeApp/img/icon.ico and /dev/null differ diff --git a/SnakeClient/SnakeApp/img/logo.png b/SnakeClient/SnakeApp/img/logo.png deleted file mode 100644 index f7120fc..0000000 Binary files a/SnakeClient/SnakeApp/img/logo.png and /dev/null differ diff --git a/SnakeClient/SnakeApp/img/up.svg b/SnakeClient/SnakeApp/img/up.svg deleted file mode 100644 index 25413c8..0000000 --- a/SnakeClient/SnakeApp/img/up.svg +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/SnakeClient/SnakeApp/qml.qrc b/SnakeClient/SnakeApp/qml.qrc deleted file mode 100644 index ce92df9..0000000 --- a/SnakeClient/SnakeApp/qml.qrc +++ /dev/null @@ -1,39 +0,0 @@ - - - front-end/main.qml - front-end/GraphicItem.qml - front-end/MainMenu.qml - qtquickcontrols2.conf - front-end/Scene.qml - front-end/NotificationForm.qml - front-end/SnakeItem.qml - front-end/About.qml - front-end/AboutPage.qml - front-end/BasePopUp.qml - front-end/TextInput.qml - front-end/PagePopUp.qml - front-end/UserView.qml - front-end/ImageView.qml - front-end/PropertyView.qml - front-end/Metrix.qml - front-end/LoginView.qml - front-end/FrameView.qml - front-end/MainMenuButton.qml - front-end/SideBar.qml - front-end/LeftSideBar.qml - front-end/LeftBoxSideBar.qml - front-end/SettingsView.qml - front-end/NotificationServiceView.qml - - - img/up.svg - - - img/logo.png - img/icon.ico - - - img/defaultUser.png - img/defaultSnake.png - - diff --git a/SnakeClient/SnakeApp/qtquickcontrols2.conf b/SnakeClient/SnakeApp/qtquickcontrols2.conf deleted file mode 100644 index 49b52e5..0000000 --- a/SnakeClient/SnakeApp/qtquickcontrols2.conf +++ /dev/null @@ -1,7 +0,0 @@ -[Controls] -Style=Material - -[Material] -Accent=Teal -Primary=BlueGrey -;Theme=Light diff --git a/SnakeClient/SnakeClient.pro b/SnakeClient/SnakeClient.pro deleted file mode 100644 index fb9ca15..0000000 --- a/SnakeClient/SnakeClient.pro +++ /dev/null @@ -1,5 +0,0 @@ -TEMPLATE = subdirs -CONFIG += ordered - -SUBDIRS += \ - SnakeApp diff --git a/SnakeMain.pro b/SnakeMain.pro deleted file mode 100644 index 97ff5a1..0000000 --- a/SnakeMain.pro +++ /dev/null @@ -1,20 +0,0 @@ - -TEMPLATE = subdirs -CONFIG += ordered - -SUBDIRS += \ - QuasarAppLib \ - SnakeUtils \ - SnakeServer \ - SnakeClient \ - - -QuasarAppLib.file = QuasarAppLib/QuasarApp.pro -Snake.file = Snake/snake.pro - -include($$PWD/installer/installerSnake.pri) -include($$PWD/test.pri) - -DISTFILES += \ - doc/librarymodel.qmodel \ - doc/calassdiagramm.qmodel diff --git a/SnakeServer/ClientProtocol/ClientProtocol.pri b/SnakeServer/ClientProtocol/ClientProtocol.pri deleted file mode 100644 index dead322..0000000 --- a/SnakeServer/ClientProtocol/ClientProtocol.pri +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright (C) 2018 - 2019 QuasarApp. -# Distributed under the lgplv3 software license, see the accompanying -# Everyone is permitted to copy and distribute verbatim copies -# of this license document, but changing it is not allowed. -# - -!isEmpty(CLIENTPROTOCOL_LIB):error("ClientProtocol.pri already included") -CLIENTPROTOCOL_LIB = 1 - -#DEPENDS -CONFIG(release, debug|release): { - CLIENTPROTOCOL_LIB_OUTPUT_DIR="$$PWD/build/release" -} else { - CLIENTPROTOCOL_LIB_OUTPUT_DIR="$$PWD/build/debug" -} - -LIBS += -L$$CLIENTPROTOCOL_LIB_OUTPUT_DIR -lClientProtocol - -include($$PWD/ClientProtocolIncludes.pri) -include($$PWD/../Qt-Secret/src/Qt-Secret.pri) - - - diff --git a/SnakeServer/ClientProtocol/ClientProtocol.pro b/SnakeServer/ClientProtocol/ClientProtocol.pro deleted file mode 100644 index f7b8129..0000000 --- a/SnakeServer/ClientProtocol/ClientProtocol.pro +++ /dev/null @@ -1,91 +0,0 @@ -# -# Copyright (C) 2018 - 2019 QuasarApp. -# Distributed under the lgplv3 software license, see the accompanying -# Everyone is permitted to copy and distribute verbatim copies -# of this license document, but changing it is not allowed. -# - -#------------------------------------------------- -# -# Project created by QtCreator 2019-02-12T11:08:54 -# -#------------------------------------------------- - -QT -= gui -QT += network - -CONFIG += c++14 -TARGET = ClientProtocol -TEMPLATE = lib - -DEFINES += CLIENTPROTOCOL_LIBRARY - -# The following define makes your compiler emit warnings if you use -# any feature of Qt which has been marked as deprecated (the exact warnings -# depend on your compiler). Please consult the documentation of the -# deprecated API in order to know how to port your code away from it. -DEFINES += QT_DEPRECATED_WARNINGS - -# You can also make your code fail to compile if you use deprecated APIs. -# In order to do so, uncomment the following line. -# You can also select to disable deprecated APIs only up to a certain version of Qt. -#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 - -CONFIG(release, debug|release): { - DESTDIR = $$PWD/build/release - -} else { - DESTDIR = $$PWD/build/debug -} - -include($$PWD/../../QuasarAppLib/QuasarLib.pri) -include($$PWD/../../SnakeUtils/SnakeUtils.pri) -include($$PWD/../Qt-Secret/src/Qt-Secret.pri) - - -SOURCES += \ - Objects/basenetworkobject.cpp \ - Objects/map.cpp \ - Objects/objdata.cpp \ - Objects/pubkey.cpp \ - Objects/snake.cpp \ - Objects/websocket.cpp \ - clientprotocol.cpp \ - client.cpp \ - Objects/gamedata.cpp \ - Objects/getitem.cpp \ - Objects/login.cpp \ - networkclasssize.cpp \ - Objects/player.cpp \ - rsakeyspool.cpp \ - server.cpp \ - factorynetobjects.cpp \ - connectioninfo.cpp \ - Objects/updateplayerdata.cpp - - -HEADERS += \ - Objects/basenetworkobject.h \ - Objects/map.h \ - Objects/objdata.h \ - Objects/pubkey.h \ - Objects/snake.h \ - Objects/websocket.h \ - clientprotocol.h \ - clientprotocol_global.h \ - Objects/gamedata.h \ - Objects/getitem.h \ - Objects/login.h \ - networkclasssize.h \ - client.h \ - Objects/player.h \ - rsakeyspool.h \ - server.h \ - cp.h \ - config.h \ - factorynetobjects.h \ - connectioninfo.h \ - cpserver.h \ - Objects/updateplayerdata.h - -include($$PWD/ClientProtocolIncludes.pri) diff --git a/SnakeServer/ClientProtocol/ClientProtocolIncludes.pri b/SnakeServer/ClientProtocol/ClientProtocolIncludes.pri deleted file mode 100644 index 0617e71..0000000 --- a/SnakeServer/ClientProtocol/ClientProtocolIncludes.pri +++ /dev/null @@ -1,4 +0,0 @@ -INCLUDEPATH += "$$PWD/" -INCLUDEPATH += "$$PWD/Objects" - - diff --git a/SnakeServer/ClientProtocol/Objects/basenetworkobject.cpp b/SnakeServer/ClientProtocol/Objects/basenetworkobject.cpp deleted file mode 100644 index 8587d54..0000000 --- a/SnakeServer/ClientProtocol/Objects/basenetworkobject.cpp +++ /dev/null @@ -1,98 +0,0 @@ -#include "basenetworkobject.h" - -namespace ClientProtocol { - - - -int BaseNetworkObject::id() const { - return _id; -} - -void BaseNetworkObject::setId(int id) { - _id = id; -} - -quint8 BaseNetworkObject::getClass() const { - return _class; -} - -BaseNetworkObject::BaseNetworkObject() { -} - -BaseNetworkObject *BaseNetworkObject::create() const { - return new BaseNetworkObject(); -} - -BaseNetworkObject::~BaseNetworkObject() { - -} - -NetworkClassSize BaseNetworkObject::classSize() const { - return getTypeSize(_id) + getTypeSize(_class); -} - -QDataStream &BaseNetworkObject::writeToStream(QDataStream &stream) const { - stream << _class; - stream << _id; - return stream; -} - -QDataStream &BaseNetworkObject::readFromStream(QDataStream &stream) { - stream >> _class; - stream >> _id; - return stream; -} - -bool BaseNetworkObject::isValid() const { - return _id >= 0 && _class > 0; -} - -void BaseNetworkObject::toBytes(QByteArray &array) const { - QDataStream stream(&array, QIODevice::WriteOnly); - - writeToStream(stream); - -} - -void BaseNetworkObject::fromBytes(const QByteArray &array) { - QDataStream stream(array); - - readFromStream(stream); -} - -NetworkClassSize getTypeSize(const EncryptionParams ¶ms) { - bool isKey = params.alg & Key; - - switch (params.alg & ~Key) { - case RSA: { - - if (isKey) { - - return { - static_cast(sizeof (int) + - QRSAEncryption::getKeyBytesSize(static_cast(params.baseBits))) - }; - } - - auto baseSize = - static_cast(sizeof (int) + - QRSAEncryption::getKeyBytesSize(static_cast(params.encryptBits))) / 2; - - return {baseSize, baseSize * params.baseBytes()}; - } - - case SHA: { - return {static_cast(sizeof (int) + params.baseBytes())}; - } - default: - return sizeof (int) + 10; - } - - -} - -unsigned int EncryptionParams::baseBytes() const { - return baseBits / 8; -} - -} diff --git a/SnakeServer/ClientProtocol/Objects/basenetworkobject.h b/SnakeServer/ClientProtocol/Objects/basenetworkobject.h deleted file mode 100644 index 2584496..0000000 --- a/SnakeServer/ClientProtocol/Objects/basenetworkobject.h +++ /dev/null @@ -1,89 +0,0 @@ -#ifndef BASENETWORKOBJECT_H -#define BASENETWORKOBJECT_H - -#include "networkclasssize.h" - -#include -#include -#include -#include -#include "config.h" -#include -#include "clientprotocol_global.h" -#include - -namespace ClientProtocol { - -enum cryptoAlghoritms: unsigned int { - RSA = 0x0, - SHA = 0x2, - - Key = 0x100 -}; - -struct EncryptionParams { - unsigned int alg = SHA; - unsigned int baseBits = QRSAEncryption::RSA_256; - unsigned int encryptBits = QRSAEncryption::RSA_256; - - unsigned int baseBytes() const; -}; -NetworkClassSize getTypeSize(const EncryptionParams ¶ms); - -template -NetworkClassSize getTypeSize(const T& type = {}) { - - auto hash = typeid(type).hash_code(); - - if (hash == typeid(QString).hash_code()) { - - return { sizeof (int), sizeof (QChar) * MAX_SIZE}; - - } else if (hash == typeid(QList).hash_code()) { - - return { sizeof (int), sizeof (int) * MAX_SIZE}; - - } else if (hash == typeid(QList).hash_code()) { - - return { sizeof (float), sizeof (float) * MAX_SIZE}; - - } else if (hash == typeid(QStringList).hash_code()) { - - auto size = getTypeSize(); - return {sizeof (int) , size.max + static_cast(sizeof (int) * MAX_SIZE)}; - - } - return sizeof (type); -} - -class CLIENTPROTOCOLSHARED_EXPORT BaseNetworkObject -{ -private: - int _id = -1; -protected: - quint8 _class = 0; - -public: - BaseNetworkObject(); - virtual BaseNetworkObject* create() const; - virtual ~BaseNetworkObject(); - - virtual NetworkClassSize classSize() const; - virtual QDataStream& writeToStream(QDataStream& stream) const; - virtual QDataStream& readFromStream(QDataStream& stream); - virtual bool isValid() const; - void toBytes(QByteArray& array) const; - void fromBytes(const QByteArray& array); - int id() const; - void setId(int id); - quint8 getClass() const; -}; - -template -auto cast(const BaseNetworkObject* obj) { - static_assert (!std::is_pointer(), "Cast working only with pointers!"); - return static_cast(obj); -} - -} -#endif // BASENETWORKOBJECT_H diff --git a/SnakeServer/ClientProtocol/Objects/gamedata.cpp b/SnakeServer/ClientProtocol/Objects/gamedata.cpp deleted file mode 100644 index 2bd4f19..0000000 --- a/SnakeServer/ClientProtocol/Objects/gamedata.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include "gamedata.h" -#include "config.h" -#include "clientprotocol.h" - - -namespace ClientProtocol { - -GameData::GameData() -{ - _class = static_cast(Command::GameData); -} - -QList GameData::getTimeClick() const { - return timeClick; -} - -void GameData::setTimeClick(const QList &value) { - timeClick = value; -} - -int& GameData::operator[](int index) { - return timeClick[index]; -} - -BaseNetworkObject *GameData::create() const { - return new GameData(); -} - -NetworkClassSize GameData::classSize() const { - return UpdatePlayerData::classSize() + - getTypeSize(timeClick); -} - -QDataStream &GameData::writeToStream(QDataStream &stream) const { - UpdatePlayerData::writeToStream(stream); - stream << timeClick; - return stream; -} - -QDataStream &GameData::readFromStream(QDataStream &stream) { - UpdatePlayerData::readFromStream(stream); - stream >> timeClick; - return stream; -} - -bool GameData::isValid() const { - return timeClick.size() > 0 && UpdatePlayerData::isValid(); -} - -} diff --git a/SnakeServer/ClientProtocol/Objects/gamedata.h b/SnakeServer/ClientProtocol/Objects/gamedata.h deleted file mode 100644 index e3cf80a..0000000 --- a/SnakeServer/ClientProtocol/Objects/gamedata.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef GAMEDATA_H -#define GAMEDATA_H - -#include - -namespace ClientProtocol { - - -class CLIENTPROTOCOLSHARED_EXPORT GameData: public UpdatePlayerData -{ -private: - QList timeClick; -public: - GameData(); - QList getTimeClick() const; - void setTimeClick(const QList &value); - int& operator[](int index); - - BaseNetworkObject *create() const override; - NetworkClassSize classSize() const override; - QDataStream &writeToStream(QDataStream &stream) const override; - QDataStream &readFromStream(QDataStream &stream) override; - bool isValid() const override; - -}; - -} -#endif // GAMEDATA_H diff --git a/SnakeServer/ClientProtocol/Objects/getitem.cpp b/SnakeServer/ClientProtocol/Objects/getitem.cpp deleted file mode 100644 index 352a9cf..0000000 --- a/SnakeServer/ClientProtocol/Objects/getitem.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "getitem.h" -#include "clientprotocol.h" - -namespace ClientProtocol { - -GetItem::GetItem() -{ - _class = static_cast(Command::GetItem); -} -} diff --git a/SnakeServer/ClientProtocol/Objects/getitem.h b/SnakeServer/ClientProtocol/Objects/getitem.h deleted file mode 100644 index 06978ae..0000000 --- a/SnakeServer/ClientProtocol/Objects/getitem.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef GETITEM_H -#define GETITEM_H - -#include - -namespace ClientProtocol { - - -class CLIENTPROTOCOLSHARED_EXPORT GetItem : public UpdatePlayerData - -{ -public: - GetItem(); -}; - -} -#endif // GETITEM_H diff --git a/SnakeServer/ClientProtocol/Objects/login.cpp b/SnakeServer/ClientProtocol/Objects/login.cpp deleted file mode 100644 index 078bd8f..0000000 --- a/SnakeServer/ClientProtocol/Objects/login.cpp +++ /dev/null @@ -1,71 +0,0 @@ -#include "login.h" -#include "config.h" -#include "clientprotocol.h" - -namespace ClientProtocol { - -bool Login::getRegisterNewUser() const { - return registerNewUser; -} - -void Login::setRegisterNewUser(bool value) { - registerNewUser = value; -} - -Login::Login() { - _class = static_cast(Command::Login); -} - -BaseNetworkObject *Login::create() const { - return new Login(); -} - -NetworkClassSize Login::classSize() const { - auto size = BaseNetworkObject::classSize(); - EncryptionParams param = { - cryptoAlghoritms::RSA | cryptoAlghoritms::Key, - BASE_HASH_BITS, - BASE_ENCRYPTION_BITS - }; - return size + getTypeSize(param) + getTypeSize(gmail) + getTypeSize(registerNewUser); -} - -QDataStream &Login::writeToStream(QDataStream &stream) const { - BaseNetworkObject::writeToStream(stream); - stream << gmail; - stream << hashRsaPass; - stream << registerNewUser; - return stream; -} - -QDataStream &Login::readFromStream(QDataStream &stream) { - BaseNetworkObject::readFromStream(stream); - stream >> gmail; - stream >> hashRsaPass; - stream >> registerNewUser; - return stream; -} - -bool Login::isValid() const { - return gmail.size() > 5 && - hashRsaPass.size() >= 32 && - hashRsaPass.size() <= 64 && - BaseNetworkObject::isValid(); -} - -QString Login::getGmail() const { - return gmail; -} - -void Login::setGmail(const QString &value) { - gmail = value; -} - -QByteArray Login::getHashPass() const { - return hashRsaPass; -} - -void Login::setHashPass(const QByteArray &value) { - hashRsaPass = value; -} -} diff --git a/SnakeServer/ClientProtocol/Objects/login.h b/SnakeServer/ClientProtocol/Objects/login.h deleted file mode 100644 index 9061765..0000000 --- a/SnakeServer/ClientProtocol/Objects/login.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef LOGIN_H -#define LOGIN_H - -#include "basenetworkobject.h" -namespace ClientProtocol { - -class CLIENTPROTOCOLSHARED_EXPORT Login : public BaseNetworkObject -{ - -private: - QByteArray hashRsaPass; - QString gmail; - bool registerNewUser = false; - -public: - Login(); - - BaseNetworkObject *create() const override; - NetworkClassSize classSize() const override; - QDataStream &writeToStream(QDataStream &stream) const override; - QDataStream &readFromStream(QDataStream &stream) override; - bool isValid() const override; - QString getGmail() const; - void setGmail(const QString &value); - QByteArray getHashPass() const; - void setHashPass(const QByteArray &value); - bool getRegisterNewUser() const; - void setRegisterNewUser(bool value); -}; -} -#endif // LOGIN_H diff --git a/SnakeServer/ClientProtocol/Objects/map.cpp b/SnakeServer/ClientProtocol/Objects/map.cpp deleted file mode 100644 index 9902551..0000000 --- a/SnakeServer/ClientProtocol/Objects/map.cpp +++ /dev/null @@ -1,45 +0,0 @@ -#include "map.h" -#include - -namespace ClientProtocol { - -Map::Map() -{ - _class = static_cast(Command::Map); -} - -BaseNetworkObject *Map::create() const { - return new Map(); -} - -NetworkClassSize Map::classSize() const { - - return BaseNetworkObject::classSize() - + getTypeSize(lvl) - + getTypeSize(lenght) - + getTypeSize(objects); -} - -QDataStream &Map::writeToStream(QDataStream &stream) const { - BaseNetworkObject::writeToStream(stream); - stream << lvl; - stream << lenght; - stream << objects; - - return stream; -} - -QDataStream &Map::readFromStream(QDataStream &stream) { - BaseNetworkObject::readFromStream(stream); - stream >> lvl; - stream >> lenght; - stream >> objects; - return stream; -} - -bool Map::isValid() const { - return lenght > 1 && objects.size() > 1 && - BaseNetworkObject::isValid(); -} - -} diff --git a/SnakeServer/ClientProtocol/Objects/map.h b/SnakeServer/ClientProtocol/Objects/map.h deleted file mode 100644 index f8caa60..0000000 --- a/SnakeServer/ClientProtocol/Objects/map.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef MAP_H -#define MAP_H -#include "basenetworkobject.h" -#include "objdata.h" - -namespace ClientProtocol { - -class CLIENTPROTOCOLSHARED_EXPORT Map : public BaseNetworkObject -{ -private: - quint8 lvl; - quint16 lenght; - QList objects; - -public: - Map(); - - BaseNetworkObject *create() const override; - NetworkClassSize classSize() const override; - QDataStream &writeToStream(QDataStream &stream) const override; - QDataStream &readFromStream(QDataStream &stream) override; - bool isValid() const override; -}; -} -#endif // MAP_H diff --git a/SnakeServer/ClientProtocol/Objects/objdata.cpp b/SnakeServer/ClientProtocol/Objects/objdata.cpp deleted file mode 100644 index 9af67e7..0000000 --- a/SnakeServer/ClientProtocol/Objects/objdata.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include "objdata.h" -#include - -namespace ClientProtocol { - -QDataStream& operator <<(QDataStream &stream, const ObjData &obj) { - stream << obj.id; - stream << obj.x; - stream << obj.y; - stream << obj.rat; - - return stream; -} - -QDataStream& operator >>(QDataStream &stream, ObjData &obj) { - stream >> obj.id; - stream >> obj.x; - stream >> obj.y; - stream >> obj.rat; - - return stream; - -} -} diff --git a/SnakeServer/ClientProtocol/Objects/objdata.h b/SnakeServer/ClientProtocol/Objects/objdata.h deleted file mode 100644 index 530b832..0000000 --- a/SnakeServer/ClientProtocol/Objects/objdata.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef OBJDATA_H -#define OBJDATA_H -#include "clientprotocol_global.h" -namespace ClientProtocol { - -struct CLIENTPROTOCOLSHARED_EXPORT ObjData { - int id; - unsigned short x; - unsigned short y; - unsigned short rat; - - friend QDataStream& operator << (QDataStream& stream, const ObjData& obj); - friend QDataStream& operator >> (QDataStream& stream, ObjData& obj); - -}; -} -#endif // OBJDATA_H diff --git a/SnakeServer/ClientProtocol/Objects/player.cpp b/SnakeServer/ClientProtocol/Objects/player.cpp deleted file mode 100644 index ff991de..0000000 --- a/SnakeServer/ClientProtocol/Objects/player.cpp +++ /dev/null @@ -1,116 +0,0 @@ -#include "player.h" -#include "config.h" -#include - -namespace ClientProtocol { - - -QString Player::getName() const { - return name; -} - -void Player::setName(const QString &value) { - name = value; -} - -QString Player::getGmail() const { - return gmail; -} - -void Player::setGmail(const QString &value) { - gmail = value; -} - -unsigned int Player::getMany() const -{ - return money; -} - -void Player::setMany(unsigned int value) { - money = value; -} - -unsigned int Player::getRecord() const { - return record; -} - -void Player::setRecord(unsigned int value) { - record = value; -} - -QList Player::getItems() const { - return items; -} - -void Player::setItems(const QList &value) { - items = value; -} - -int Player::getCureentSnake() const { - return cureentSnake; -} - -void Player::setCureentSnake(int value) { - cureentSnake = value; -} - - -unsigned int Player::getAvgRecord() const { - return avgRecord; -} - -void Player::setAvgRecord(unsigned int value) { - avgRecord = value; -} - -Player::Player() { - _class = static_cast(Command::Player); - -} - -BaseNetworkObject *Player::create() const { - return new Player(); -} - -NetworkClassSize Player::classSize() const { - - return UpdatePlayerData::classSize() - + getTypeSize(name) - + getTypeSize(gmail) - + getTypeSize(money) - + getTypeSize(record) - + getTypeSize(avgRecord) - + getTypeSize(items) - + getTypeSize(cureentSnake); -} - -QDataStream &Player::writeToStream(QDataStream &stream) const { - UpdatePlayerData::writeToStream(stream); - stream << name; - stream << gmail; - stream << money; - stream << record; - stream << avgRecord; - stream << items; - stream << cureentSnake; - - return stream; -} - -QDataStream &Player::readFromStream(QDataStream &stream) { - UpdatePlayerData::readFromStream(stream); - stream >> name; - stream >> gmail; - stream >> money; - stream >> record; - stream >> avgRecord; - stream >> items; - stream >> cureentSnake; - return stream; -} - -bool Player::isValid() const { - return !name.isNull() && gmail.size() > 5 && - BaseNetworkObject::isValid(); -} -} diff --git a/SnakeServer/ClientProtocol/Objects/player.h b/SnakeServer/ClientProtocol/Objects/player.h deleted file mode 100644 index 88ed364..0000000 --- a/SnakeServer/ClientProtocol/Objects/player.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef PLAYER_H -#define PLAYER_H - -#include "updateplayerdata.h" - - -namespace ClientProtocol { - - -class CLIENTPROTOCOLSHARED_EXPORT Player: public UpdatePlayerData -{ -private: - QString name = "user"; - QString gmail = ""; - - unsigned int money = 0; - unsigned int record = 0; - unsigned int avgRecord = 0; - QList items; - int cureentSnake = -1; - -public: - Player(); - - BaseNetworkObject *create() const override; - NetworkClassSize classSize() const override; - QDataStream &writeToStream(QDataStream &stream) const override; - QDataStream &readFromStream(QDataStream &stream) override; - bool isValid() const override; - QString getName() const; - void setName(const QString &value); - QString getGmail() const; - void setGmail(const QString &value); - unsigned int getMany() const; - void setMany(unsigned int value); - unsigned int getRecord() const; - void setRecord(unsigned int value); - QList getItems() const; - void setItems(const QList &value); - int getCureentSnake() const; - void setCureentSnake(int value); - unsigned int getAvgRecord() const; - void setAvgRecord(unsigned int value); -// QString getHexPass() const; -// void fromHexPass(const QString& passHex); - -}; - -} -#endif // PLAYER_H diff --git a/SnakeServer/ClientProtocol/Objects/pubkey.cpp b/SnakeServer/ClientProtocol/Objects/pubkey.cpp deleted file mode 100644 index 80cf3e1..0000000 --- a/SnakeServer/ClientProtocol/Objects/pubkey.cpp +++ /dev/null @@ -1,62 +0,0 @@ -#include "pubkey.h" -#include "clientprotocol.h" - -namespace ClientProtocol { - -PubKey::PubKey(): - BaseNetworkObject() { - _class = static_cast(Command::PubKey); -} - -QRSAEncryption::Rsa PubKey::getTypeKey() const { - return typeKey; -} - -void PubKey::setTypeKey(const QRSAEncryption::Rsa &value) { - typeKey = value; -} - -QByteArray PubKey::getKey() const { - return key; -} - -void PubKey::setKey(const QByteArray &value) { - key = value; -} - -BaseNetworkObject *PubKey::create() const { - return new PubKey(); -} - -NetworkClassSize PubKey::classSize() const { - EncryptionParams param = { - cryptoAlghoritms::RSA | cryptoAlghoritms::Key, - BASE_ENCRYPTION_BITS - }; - return BaseNetworkObject::classSize() + - getTypeSize(param) + - getTypeSize(int(typeKey)); -} - -QDataStream &PubKey::writeToStream(QDataStream &stream) const { - BaseNetworkObject::writeToStream(stream); - stream << int(typeKey); - stream << key; - return stream; -} - -QDataStream &PubKey::readFromStream(QDataStream &stream) { - BaseNetworkObject::readFromStream(stream); - int _typeKey; - stream >> _typeKey; - typeKey = static_cast(_typeKey); - stream >> key; - return stream; -} - -bool PubKey::isValid() const { - return static_cast(key.size()) == QRSAEncryption::getKeyBytesSize(typeKey) - && BaseNetworkObject::isValid(); -} - -} diff --git a/SnakeServer/ClientProtocol/Objects/pubkey.h b/SnakeServer/ClientProtocol/Objects/pubkey.h deleted file mode 100644 index 913db5c..0000000 --- a/SnakeServer/ClientProtocol/Objects/pubkey.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef PUBKEY_H -#define PUBKEY_H -#include - -#include "basenetworkobject.h" - -namespace ClientProtocol { - -class CLIENTPROTOCOLSHARED_EXPORT PubKey: public BaseNetworkObject -{ -private: - QRSAEncryption::Rsa typeKey; - QByteArray key; - -public: - PubKey(); - - BaseNetworkObject *create() const override; - NetworkClassSize classSize() const override; - QDataStream &writeToStream(QDataStream &stream) const override; - QDataStream &readFromStream(QDataStream &stream) override; - bool isValid() const override; - - QRSAEncryption::Rsa getTypeKey() const; - void setTypeKey(const QRSAEncryption::Rsa &value); - QByteArray getKey() const; - void setKey(const QByteArray &value); -}; -} -#endif // PUBKEY_H diff --git a/SnakeServer/ClientProtocol/Objects/snake.cpp b/SnakeServer/ClientProtocol/Objects/snake.cpp deleted file mode 100644 index f804a53..0000000 --- a/SnakeServer/ClientProtocol/Objects/snake.cpp +++ /dev/null @@ -1,68 +0,0 @@ -#include "snake.h" -#include "clientprotocol.h" - - -namespace ClientProtocol { - -quint8 Snake::getSpeed() const { - return speed; -} - -void Snake::setSpeed(const quint8 &value) { - speed = value; -} - -quint8 Snake::getSnakeClass() const { - return snakeClass; -} - -void Snake::setSnakeClass(const quint8 &value) { - snakeClass = value; -} - -QList Snake::getSkillet() const { - return skillet; -} - -void Snake::setSkillet(const QList &value) { - skillet = value; -} - -BaseNetworkObject *Snake::create() const { - return new Snake(); -} - -NetworkClassSize Snake::classSize() const { - return BaseNetworkObject::classSize() + - getTypeSize(speed) + - getTypeSize(snakeClass) + - getTypeSize(skillet); -} - -QDataStream &Snake::writeToStream(QDataStream &stream) const { - BaseNetworkObject::writeToStream(stream); - stream << speed; - stream << snakeClass; - stream << skillet; - - return stream; -} - -QDataStream &Snake::readFromStream(QDataStream &stream) { - BaseNetworkObject::readFromStream(stream); - stream >> speed; - stream >> snakeClass; - stream >> skillet; - return stream; -} - -bool Snake::isValid() const { - return (speed > 0) && skillet.size() && BaseNetworkObject::isValid(); -} - -Snake::Snake() { - _class = static_cast(Command::Snake); - -} - -} diff --git a/SnakeServer/ClientProtocol/Objects/snake.h b/SnakeServer/ClientProtocol/Objects/snake.h deleted file mode 100644 index 685068e..0000000 --- a/SnakeServer/ClientProtocol/Objects/snake.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef SNAKE_H -#define SNAKE_H - -#include "basenetworkobject.h" - - -namespace ClientProtocol { - -class CLIENTPROTOCOLSHARED_EXPORT Snake: public BaseNetworkObject -{ -private: - quint8 speed; - quint8 snakeClass; - QList skillet; - -public: - Snake(); - quint8 getSpeed() const; - void setSpeed(const quint8 &value); - quint8 getSnakeClass() const; - void setSnakeClass(const quint8 &value); - QList getSkillet() const; - void setSkillet(const QList &value); - - BaseNetworkObject *create() const override; - NetworkClassSize classSize() const override; - QDataStream &writeToStream(QDataStream &stream) const override; - QDataStream &readFromStream(QDataStream &stream) override; - bool isValid() const override; -}; -} -#endif // SNAKE_H diff --git a/SnakeServer/ClientProtocol/Objects/updateplayerdata.cpp b/SnakeServer/ClientProtocol/Objects/updateplayerdata.cpp deleted file mode 100644 index 08df4e0..0000000 --- a/SnakeServer/ClientProtocol/Objects/updateplayerdata.cpp +++ /dev/null @@ -1,49 +0,0 @@ -#include "updateplayerdata.h" -#include "config.h" -#include "clientprotocol.h" - -namespace ClientProtocol { - -UpdatePlayerData::UpdatePlayerData() { - _class = static_cast(Command::UpdatePlayerData); - -} - -QByteArray UpdatePlayerData::getToken() const { - return token; -} - -void UpdatePlayerData::setToken(const QByteArray &value) { - token = value; -} - -BaseNetworkObject *UpdatePlayerData::create() const { - return new UpdatePlayerData(); -} - -NetworkClassSize UpdatePlayerData::classSize() const { - EncryptionParams param = { - cryptoAlghoritms::SHA, - BASE_HASH_BITS - }; - - return BaseNetworkObject::classSize() + getTypeSize(param); -} - -QDataStream &UpdatePlayerData::writeToStream(QDataStream &stream) const { - BaseNetworkObject::writeToStream(stream); - stream << token; - return stream; -} - -QDataStream &UpdatePlayerData::readFromStream(QDataStream &stream) { - BaseNetworkObject::readFromStream(stream); - stream >> token; - return stream; -} - -bool UpdatePlayerData::isValid() const { - return token.size() == 32 && BaseNetworkObject::isValid(); -} - -} diff --git a/SnakeServer/ClientProtocol/Objects/updateplayerdata.h b/SnakeServer/ClientProtocol/Objects/updateplayerdata.h deleted file mode 100644 index 4833c3b..0000000 --- a/SnakeServer/ClientProtocol/Objects/updateplayerdata.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef UPDATEPLAYERDATA_H -#define UPDATEPLAYERDATA_H - -#include "basenetworkobject.h" -namespace ClientProtocol { - - -class CLIENTPROTOCOLSHARED_EXPORT UpdatePlayerData : public BaseNetworkObject -{ -private: - QByteArray token; - -public: - UpdatePlayerData(); - QByteArray getToken() const; - void setToken(const QByteArray &value); - - BaseNetworkObject *create() const override; - NetworkClassSize classSize() const override; - QDataStream &writeToStream(QDataStream &stream) const override; - QDataStream &readFromStream(QDataStream &stream) override; - bool isValid() const override; -}; - -} -#endif // UPDATEPLAYERDATA_H diff --git a/SnakeServer/ClientProtocol/Objects/websocket.cpp b/SnakeServer/ClientProtocol/Objects/websocket.cpp deleted file mode 100644 index 10ae941..0000000 --- a/SnakeServer/ClientProtocol/Objects/websocket.cpp +++ /dev/null @@ -1,71 +0,0 @@ -#include "websocket.h" - -namespace ClientProtocol { - -WebSocket::WebSocket() { - _class = static_cast(Command::WebSocket); -} - -BaseNetworkObject *ClientProtocol::WebSocket::create() const { - return new WebSocket(); -} - -NetworkClassSize WebSocket::classSize() const { - return UpdatePlayerData::classSize() + getTypeSize(_data); - -} - -QDataStream &WebSocket::writeToStream(QDataStream &stream) const { - UpdatePlayerData::writeToStream(stream); - stream << _data; - return stream; -} - -QDataStream &WebSocket::readFromStream(QDataStream &stream) { - UpdatePlayerData::readFromStream(stream); - stream >> _data; - return stream; -} - -bool WebSocket::isValid() const { - return static_cast(_data.cmd) != Command::Undefined && - UpdatePlayerData::isValid(); - -} - -bool WebSocket::isSubscribe() const { - return _data.subscribe; -} - -Command WebSocket::getCommand() const { - return static_cast(_data.cmd); -} - -int WebSocket::getObjectId() const { - return _data.objectId; -} - -void WebSocket::setSubscribe(bool subscribe){ - _data.subscribe = subscribe; -} - -void WebSocket::setCommand(Command cmd) { - _data.cmd = static_cast(cmd); -} - -void WebSocket::setObjectId(int value) { - _data.objectId = value; -} - -QDataStream &operator<<(QDataStream &stream, WebSocketData data) { - stream.writeRawData(reinterpret_cast(&data), sizeof (data)); - return stream; -} - -QDataStream &operator>>(QDataStream &stream, WebSocketData &data) { - stream.readRawData(reinterpret_cast(&data), sizeof (data)); - return stream; - -} - -} diff --git a/SnakeServer/ClientProtocol/Objects/websocket.h b/SnakeServer/ClientProtocol/Objects/websocket.h deleted file mode 100644 index 4b2d238..0000000 --- a/SnakeServer/ClientProtocol/Objects/websocket.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef WEBSOCKET_H -#define WEBSOCKET_H -#include "updateplayerdata.h" -#include "clientprotocol.h" - -namespace ClientProtocol { - -#pragma pack(push, 1) -struct WebSocketData { - unsigned char cmd : 5; - unsigned subscribe : 1; - int objectId : 26; // -1 is all ovjects, or other bumber is number of object - - friend QDataStream& operator<< (QDataStream& stream, WebSocketData data); - friend QDataStream& operator>> (QDataStream& stream, WebSocketData& data); -}; -#pragma pack(pop) - -class CLIENTPROTOCOLSHARED_EXPORT WebSocket : public UpdatePlayerData -{ - WebSocketData _data; -public: - WebSocket(); - - BaseNetworkObject *create() const override; - NetworkClassSize classSize() const override; - QDataStream &writeToStream(QDataStream &stream) const override; - QDataStream &readFromStream(QDataStream &stream) override; - bool isValid() const override; - - bool isSubscribe() const; - Command getCommand() const; - int getObjectId() const; - - void setSubscribe(bool subscribe); - void setCommand(Command cmd) ; - void setObjectId(int value); - -}; -} -#endif // WEBSOCKET_H diff --git a/SnakeServer/ClientProtocol/client.cpp b/SnakeServer/ClientProtocol/client.cpp deleted file mode 100644 index 1e5c1a4..0000000 --- a/SnakeServer/ClientProtocol/client.cpp +++ /dev/null @@ -1,438 +0,0 @@ -#include "client.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include "factorynetobjects.h" -#include "gamedata.h" -#include "getitem.h" -#include "login.h" -#include "updateplayerdata.h" -#include -#include - -#define SOLT "SNAKE" -namespace ClientProtocol { - -Command Client::checkCommand(int sig, Command reqCmd, Type type) { - -#define idx static_cast(sig) - - auto expCmd = static_cast( - _requestsMap[idx].value("expected", - static_cast(Command::Undefined)).toInt()); - - if (expCmd == Command::Undefined || - expCmd != reqCmd || - type != Type::Responke) { - - return Command::Undefined; - } - - _requestsMap[idx]["time"] = QDateTime::currentMSecsSinceEpoch(); - return expCmd; -} - -void Client::updateStatuses(Command extCmd, Command cmd, Type type, const QByteArray& obj) -{ - setOnlineStatus(extCmd != Command::Undefined && type == Type::Responke); - - if (extCmd == Command::Login - && type == Type::Responke) { - - UpdatePlayerData data; - data.fromBytes(obj); - bool validData = data.isValid(); - if (validData) { - _token = data.getToken(); - - } - - _currentUserId = data.id(); - - setLoginStatus(cmd == Command::UpdatePlayerData && validData); - } -} - -bool Client::receiveData(const QByteArray &obj, Header hdr) { - - auto command = static_cast(hdr.command); - auto requesCommand = static_cast(hdr.requestCommand); - - auto type = static_cast(hdr.type); - - if (command == Command::PubKey && !_rsaKey.size()) { - PubKey data; - data.fromBytes(obj); - return setRSAKey(data.getKey());; - } - - if (type != Type::Stream) { - auto expectedCommand = checkCommand(hdr.sig, requesCommand, type); - - if (expectedCommand == Command::Undefined) { - QuasarAppUtils::Params::verboseLog("wrong sig of package"); - return false; - } - - updateStatuses(expectedCommand, command, type, obj); - } else if (_subscribe.contains(hdr.command)) { - _subscribe[hdr.command] = true; - } else { - return false; - } - - emit sigIncommingData(static_cast(hdr.command), obj); - - return true; -} - -bool Client::setRSAKey(const QByteArray& key) { - bool newStatus = QRSAEncryption::isValidRsaKey(key); - setOnlineStatus(newStatus); - - if (newStatus) { - _rsaKey = key; - } - - return newStatus; -} - -void Client::setLoginStatus(bool newStatus) { - if (newStatus != _logined) { - _logined = newStatus; - emit loginChanged(_logined); - } -} - -void Client::setOnlineStatus(bool newOnline) { - if (newOnline != _online) { - _online = newOnline; - emit onlineChanged(_online); - if (!_online) { - _rsaKey = ""; - setLoginStatus(false); - } - } -} - -void Client::incommingData() { - auto array = _destination->readAll(); - - if (_downloadPackage.hdr.isValid()) { - _downloadPackage.data.append(array); - - } else { - memcpy(&_downloadPackage.hdr, - array.data(), sizeof(Header)); - _downloadPackage.data.append(array.mid(sizeof(Header))); - } - - if (_downloadPackage.isValid()) { - if (!receiveData(_downloadPackage.data, _downloadPackage.hdr)) { - // ban - } - - _downloadPackage.reset(); - return; - } -} - -void Client::handleDisconnected() { - setOnlineStatus(false); -} - -Client::Client(const QString &addrress, unsigned short port, QObject *ptr): - QObject (ptr) { - - _destination = new QTcpSocket(this); - connectToHost(addrress, port); - - connect(_destination, &QTcpSocket::readyRead, - this, &Client::incommingData); - - connect(_destination, &QTcpSocket::disconnected, - this, &Client::handleDisconnected); -} - -bool Client::sendPackage(Package &pkg) { - if (!pkg.isValid()) { - return false; - } - - if (!_destination->isValid()) { - qCritical() << "destination server not valid!"; - return false; - } - - if (!_destination->waitForConnected()) { - qCritical() << "no connected to server! " << _destination->errorString(); - return false; - } - - auto index = nextIndex(); - _requestsMap[index] = {{"expected", static_cast(pkg.hdr.command)}}; - pkg.hdr.sig = index; - - QByteArray bytes = pkg.toBytes(); - bool sendet = bytes.size() == _destination->write(bytes); - - return sendet; -} - -unsigned char Client::nextIndex() { - return static_cast((currentIndex++) % 256); -} - -bool Client::ping() { - - Package pcg; - - if (!pcg.create(Command::Ping, Type::Request)) { - return false; - }; - - if (!sendPackage(pcg)) { - return false; - - } - - return true; -} - -/// Do not change the order of this function, -/// as this may lead to the loss of user accounts. -QByteArray Client::generateHash(const QByteArray& pass) const { - auto passHash = QCryptographicHash::hash(pass, QCryptographicHash::Sha256); - return QCryptographicHash::hash(SOLT + passHash, QCryptographicHash::Sha256); -} - -bool Client::login(const QString &gmail, const QByteArray &pass, bool newUser) { - if (!pass.size()) { - return false; - } - - if (!gmail.size()) { - return false; - } - - if (!isOnline()) { - return false; - } - - Package pcg; - - Login login; - - login.setHashPass(QRSAEncryption::encode(generateHash(pass), _rsaKey, QRSAEncryption::RSA_256)); - login.setGmail(gmail); - login.setId(0); - login.setRegisterNewUser(newUser); - - if (!login.isValid()) { - return false; - } - - if (!pcg.create(&login, Type::Request)) { - return false; - }; - - if (!sendPackage(pcg)) { - return false; - - } - - return true; -} - -bool Client::registration(const QString &gmail, - const QByteArray &pass) { - return login(gmail, pass, true); -} - -void Client::loginOut() { - _token = ""; - setLoginStatus(false); -} - -void Client::dissconnectFromHost() { - loginOut(); - _destination->disconnectFromHost(); -} - -void Client::connectToHost(const QString &address, unsigned short port) { - _destination->connectToHost(_address = address, _port = port); -} - -void Client::reconnectToHost() { - _destination->connectToHost(_address, _port); -} - -bool Client::updateData() { - - if (!isLogin()) { - return false; - } - - Package pcg; - - UpdatePlayerData rec; - rec.setToken(_token); - rec.setId(0); - - if (!rec.isValid()) { - return false; - } - - if (!pcg.create(&rec, Type::Request)) { - return false; - }; - - if (!sendPackage(pcg)) { - return false; - } - - return true; -} - -bool Client::savaData(const QList& gameData) { - if (!isLogin()) { - return false; - } - - Package pcg; - - GameData rec; - rec.setToken(_token); - rec.setTimeClick(gameData); - rec.setId(0); - - if (!rec.isValid()) { - return false; - } - - if (!pcg.create(&rec, Type::Request)) { - return false; - }; - - if (!sendPackage(pcg)) { - return false; - } - - return true; -} - -bool Client::getItem(int id) { - - if (!isLogin()) { - return false; - } - - if (id <= 0) { - return false; - } - - Package pcg; - - GetItem rec; - rec.setToken(_token); - rec.setId(id); - - if (!rec.isValid()) { - return false; - } - - if (!pcg.create(&rec, Type::Request)) { - return false; - }; - - if (!sendPackage(pcg)) { - return false; - } - - return true; -} - -bool Client::getPlayer(int id){ - if (!isLogin()) { - return false; - } - - if (id <= 0) { - return false; - } - - Package pcg; - - UpdatePlayerData rec; - rec.setToken(_token); - rec.setId(id); - - if (!rec.isValid()) { - return false; - } - - if (!pcg.create(&rec, Type::Request)) { - return false; - }; - - if (!sendPackage(pcg)) { - return false; - } - - return true; -} - -const bool& Client::isOnline() const { - return _online; -} - -const bool& Client::isLogin() const { - return _logined; -} - -bool Client::setSubscribe(Command cmd, bool subscribe, int id) { - if (!isLogin()) { - return false; - } - - Package pcg; - - WebSocket rec; - rec.setId(0); - rec.setToken(_token); - rec.setCommand(cmd); - rec.setObjectId(id); - rec.setSubscribe(subscribe); - - if (!rec.isValid()) { - return false; - } - - if (!pcg.create(&rec, Type::Stream)) { - return false; - }; - - if (!sendPackage(pcg)) { - return false; - } - - if (subscribe) - _subscribe[static_cast(cmd)] = false; - else { - _subscribe.remove(static_cast(cmd)); - } - - return true; -} - -QHash Client::getSubscribe() const { - return _subscribe; -} - - -} diff --git a/SnakeServer/ClientProtocol/client.h b/SnakeServer/ClientProtocol/client.h deleted file mode 100644 index cff1fd8..0000000 --- a/SnakeServer/ClientProtocol/client.h +++ /dev/null @@ -1,156 +0,0 @@ -#ifndef CLIENT_CP_H -#define CLIENT_CP_H - -#include "clientprotocol_global.h" -#include "clientprotocol.h" -#include -#include - -class QTcpSocket; -class Player; -class BaseItem; -class testSankeServer; - -namespace ClientProtocol { - - -class CLIENTPROTOCOLSHARED_EXPORT Client: public QObject -{ - Q_OBJECT -private: - QTcpSocket *_destination; - Package _downloadPackage; - bool _online = false; - bool _logined = false; - QByteArray _token; - QByteArray _rsaKey; - int currentIndex = 0; - QHash _requestsMap; - QHash _subscribe; // command and data confirmation - QString _address = LOCAL_SNAKE_SERVER; - unsigned short _port = DEFAULT_SNAKE_PORT; - - /** - * @brief checkCommand - return old sendet command if commnad not valid return undefined command - * @param sig - sig package - * @param reqCmd - reqCmd of package - * @param type - type of package - * @return if commnad not valid return undefined command - */ - Command checkCommand(int sig, Command reqCmd, Type type); - bool receiveData(const QByteArray &obj, Header hdr); - bool setRSAKey(const QByteArray &key); - void setLoginStatus(bool newStatus); - void setOnlineStatus(bool newStatus); - bool sendPackage(Package &pkg); - inline unsigned char nextIndex(); - - - QByteArray generateHash(const QByteArray &pass) const; - - void updateStatuses(Command extCmd, Command cmd, Type type, const QByteArray &obj); - -private slots: - void incommingData(); - void handleDisconnected(); - -protected: - int _currentUserId = -1; - - -public: - explicit Client(const QString& addrress = LOCAL_SNAKE_SERVER, - unsigned short port = DEFAULT_SNAKE_PORT, - QObject * ptr = nullptr); - - - /** - * @brief login - register or login a user - * @param gmail - gmail of user - * @param pass - hash of pass of user - * @param error - error ( if all good this variable is empty) - * @return true if message sendet - */ - bool virtual login(const QString& gmail, const QByteArray &pass, bool newUser = false); - - /** - * @brief registration - it is wraper of login method - * @return true if message sendet - */ - bool virtual registration(const QString& gmail, const QByteArray &pass); - - - bool ping(); - - void loginOut(); - void dissconnectFromHost(); - void connectToHost(const QString &addrress, unsigned short port); - void reconnectToHost(); - - /** - * @brief updateData - * @return true if refresh seсcessfully completed - */ - bool updateData(); - - /** - * @brief savedata - * @param gameData - data of lvl - * @return true if all good - */ - bool savaData(const QList &gameData); - - /** - * @brief getItem - * @param id of item - * @return item data - */ - bool getItem(int id); - - /** - * @brief getPlayer - * @param id of player - * @return player data - */ - bool getPlayer(int id); - - /** - * @brief isOnline - * @return true if client is connected to server and get rsapub key - */ - const bool &isOnline() const; - - /** - * @brief isLogin - * @return true if player is online - */ - const bool &isLogin() const; - - /** - * @brief setSubscribe change subscribe of command "cmd" - * @param cmd - command of subscribe - * @param subscribe - boolean barametr. true is subscribe, false is unsubscribe - * @param id - id of object for commands (Player and Item). - * If this parameter is -1 then subscribe on all changes of objects. - * @return true if all good - */ - bool setSubscribe(Command cmd, bool subscribe, int id = -1); - - /** - * @brief getSubscribe - * @return set of current subscribe commands - */ - QHash getSubscribe() const; - - friend class ::testSankeServer; - - -signals: - void sigIncommingData(Command cmd, const QByteArray& obj); - void onlineChanged(bool); - void loginChanged(bool); - -}; - -} -#endif // CLIENT_CP_H diff --git a/SnakeServer/ClientProtocol/clientprotocol.cpp b/SnakeServer/ClientProtocol/clientprotocol.cpp deleted file mode 100644 index f12ece6..0000000 --- a/SnakeServer/ClientProtocol/clientprotocol.cpp +++ /dev/null @@ -1,214 +0,0 @@ -#include "clientprotocol.h" -#include "gamedata.h" -#include "getitem.h" -#include "login.h" -#include "player.h" -#include "updateplayerdata.h" - -#include -#include -#include -#include -#include -#include -#include - -#define DEFAULT_GAME_PORT 7777 - -namespace ClientProtocol { - - -Header::Header() { - reset(); -} - -bool Header::isValid() const { - - if (sizeof (*this) != 4) { - return false; - } - - if (static_cast(command) == Command::Undefined) { - return false; - } - - if (static_cast(type) == Type::Undefined) { - return false; - } - - if (static_cast(type) == Type::Responke) { - return static_cast(command) != Command::Undefined; - } - - return isValidSize(command, size); -} - -void Header::reset() { - size = 0; - command = static_cast(Command::Undefined); - type = static_cast(Type::Responke); -} - -Package::Package() { - reset(); -} - -bool Package::isValid() const { - if (!hdr.isValid()) { - return false; - } - - if (data.size() && hdr.command != data.at(0)) { - return false; - } - - return hdr.size == static_cast (data.size()); -} - -BaseNetworkObject* Package::parse() const { - if (!isValid()) - return nullptr; - - auto obj = FactoryNetObjects::build(hdr.command); - - if (!obj) { - return nullptr; - } - - QDataStream stream(data); - obj->readFromStream(stream); - - return obj; -} - - -bool Package::create(const BaseNetworkObject *obj, Type type, const Header *old) { - - if (!obj) { - return false; - } - - auto command = static_cast(obj->getClass()); - - if (command == Command::Undefined) { - return false; - } - - QDataStream stream(&data, QIODevice::ReadWrite); - obj->writeToStream(stream); - - return create(command, type, old); -} - -bool Package::create(Command cmd, Type type, const QByteArray &data, const Header* old) { - this->data = data; - return create(cmd, type, old); -} - -bool Package::create(Command cmd, Type type, const Header *old) { - - - if (cmd == Command::Undefined) { - return false; - } - - hdr.command = static_cast(cmd); - hdr.type = static_cast(type); - hdr.size = static_cast(data.size()); - - if (type == Type::Responke) { - signPackage(old); - } - - return isValid(); -} - -QByteArray Package::toBytes() const { - QByteArray res; - res.append(reinterpret_cast(const_cast(&hdr)), - sizeof (hdr)); - - res.append(data); - return res; -} - -void Package::reset() { - hdr.reset(); - data.clear(); -} - -bool Package::signPackage(const Header *oldHeader) { - - if (!oldHeader || !oldHeader->isValid()) { - return false; - } - - hdr.sig = oldHeader->sig; - hdr.requestCommand = oldHeader->command; - - return true; -} - -bool isValidSize(quint8 type, unsigned int size) { - - if (!FactoryNetObjects::isInited()) { - return false; - } - - if (!FactoryNetObjects::isRegisteredType(type)) { - return size == 0; - } - - return FactoryNetObjects::getSize(type).isValid(size); -} - -bool initClientProtockol() { - if (!FactoryNetObjects::regType( - static_cast(Command::Login))) { - return false; - } - - if (!FactoryNetObjects::regType( - static_cast(Command::UpdatePlayerData))) { - return false; - } - - if (!FactoryNetObjects::regType( - static_cast(Command::GameData))) { - return false; - } - - if (!FactoryNetObjects::regType( - static_cast(Command::GetItem))) { - return false; - } - - if (!FactoryNetObjects::regType( - static_cast(Command::Player))) { - return false; - } - - if (!FactoryNetObjects::regType( - static_cast(Command::Snake))) { - return false; - } - - if (!FactoryNetObjects::regType( - static_cast(Command::Map))) { - return false; - } - - if (!FactoryNetObjects::regType( - static_cast(Command::PubKey))) { - return false; - } - - if (!FactoryNetObjects::regType( - static_cast(Command::WebSocket))) { - return false; - } - - return true; -} - -} diff --git a/SnakeServer/ClientProtocol/clientprotocol.h b/SnakeServer/ClientProtocol/clientprotocol.h deleted file mode 100644 index ad40b51..0000000 --- a/SnakeServer/ClientProtocol/clientprotocol.h +++ /dev/null @@ -1,188 +0,0 @@ -#ifndef CLIENTPROTOCOL_H -#define CLIENTPROTOCOL_H - -#include "clientprotocol_global.h" - -#include -#include -#include "config.h" - -#define BASE_ENCRYPTION_BITS 256 -#define BASE_RSA_BITS static_cast(BASE_ENCRYPTION_BITS) -#define BASE_HASH_BITS 256 - - -namespace ClientProtocol { - -class BaseNetworkObject; - -enum class Type: quint8 { - Undefined = 0x00, - Responke = 0x01, - Request = 0x02, - Stream = 0x03, -}; - -enum class Command: quint8 { - Undefined = 0x00, - Ping = 0x01, - BadRequest = 0x02, - Login = 0x03, - UpdatePlayerData = 0x04, - GameData = 0x05, - GetItem = 0x06, - Player = 0x07, - Snake = 0x08, - Map = 0x09, - PubKey = 0x0a, - WebSocket = 0x0b -}; - -bool isValidSize(quint8 type, unsigned int size); - -bool CLIENTPROTOCOLSHARED_EXPORT initClientProtockol(); -auto cast(const BaseNetworkObject *obj); -/** - * @brief The Header struct 4 byte - */ -#pragma pack(push, 1) -struct CLIENTPROTOCOLSHARED_EXPORT Header { - /** - * @brief size - size of package data (not header) - */ - unsigned short size: 12; - /** - * @brief type of package see Type - */ - quint8 type: 2; - /** - * @brief command of pacage see Command - */ - quint8 command: 5; - - /** - * @brief command of pacage see Command (rquest from client) - * the server should write to which command it responds - */ - quint8 requestCommand: 5; - - /** - * @brief sig - * signed of package (package number) - */ - unsigned char sig : 8; - - - /** - * @brief Header default constructor - */ - Header(); - - /** - * @brief isValid - * @return true if header is valid - */ - bool isValid() const; - - - /** - * @brief reset - reset all data and set for header invalid status - */ - void reset(); -}; -#pragma pack(pop) - -/** - * @brief The Package struct - */ -struct CLIENTPROTOCOLSHARED_EXPORT Package { - /** - * @brief hdr - header of package - */ - Header hdr; - /** - * @brief data - source data of package - */ - QByteArray data; - - Package(); - - /** - * @brief isValid - * @return true if package is valid - */ - virtual bool isValid() const; - - /** - * @brief parse - * @return Qmap of package (default key if "value") - */ - BaseNetworkObject * parse() const; - - template - bool parse(T& res) { - auto obj = static_cast(parse()); - - if (!obj) - return false; - - res = *obj; - delete obj; - - return true; - } - - /** - * @brief create - fill package - * @param data - data of filled - * @param old header (only for request type) - * @return true if all done - */ - bool create(const BaseNetworkObject *data, Type type, const Header *old = nullptr); - - /** - * @brief create - * @param cmd command of package - * @param type type - * @param data - data of filled - * @param old - header (only for request type) - * @return true if all good - */ - bool create(Command cmd, Type type, const QByteArray& data, const Header* old = nullptr); - - - - /** - * @brief create - * @param cmd command of package - * @param type type - * @param old header (only for request type) - * @return true if all good - */ - bool create(Command cmd, Type type, const Header* old = nullptr); - - /** - * @brief toBytes - * @return bytes array of packag - */ - QByteArray toBytes() const; - - /** - * @brief reset - reset all data and set for package invalid status - */ - void reset(); - - /** - * @brief signPackage sign package from old data - * @param oldHeader old data header - * @return true if all good - */ - bool signPackage(const Header* oldHeader); - - virtual ~Package() = default; - -}; - -} - -#endif // CLIENTPROTOCOL_H diff --git a/SnakeServer/ClientProtocol/clientprotocol_global.h b/SnakeServer/ClientProtocol/clientprotocol_global.h deleted file mode 100644 index 46b61a7..0000000 --- a/SnakeServer/ClientProtocol/clientprotocol_global.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef CLIENTPROTOCOL_GLOBAL_H -#define CLIENTPROTOCOL_GLOBAL_H - -#include - -#if defined(CLIENTPROTOCOL_LIBRARY) -# define CLIENTPROTOCOLSHARED_EXPORT Q_DECL_EXPORT -#else -# define CLIENTPROTOCOLSHARED_EXPORT Q_DECL_IMPORT -#endif - -#endif // CLIENTPROTOCOL_GLOBAL_H diff --git a/SnakeServer/ClientProtocol/config.h b/SnakeServer/ClientProtocol/config.h deleted file mode 100644 index f9b26f0..0000000 --- a/SnakeServer/ClientProtocol/config.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef CONFIG_H -#define CONFIG_H - -#define LOCAL_SNAKE_SERVER "127.0.0.1" - -#define DEFAULT_SNAKE_PORT 7777 -#define MAX_SIZE 100 -#define MIN_SIZE 1 - -#endif // CONFIG_H diff --git a/SnakeServer/ClientProtocol/connectioninfo.cpp b/SnakeServer/ClientProtocol/connectioninfo.cpp deleted file mode 100644 index b680592..0000000 --- a/SnakeServer/ClientProtocol/connectioninfo.cpp +++ /dev/null @@ -1,81 +0,0 @@ -#include "connectioninfo.h" -#include - -namespace ClientProtocol { - - -int Connectioninfo::getKarma() const { - return karma; -} - -void Connectioninfo::setKarma(int value) { - karma = value; - - if (isBaned()) { - disconnect(); - } -} - -RSAKeyPair Connectioninfo::getRSAKey() const { - return RSAKey; -} - -void Connectioninfo::setRSAKey(const RSAKeyPair &value) { - RSAKey = value; -} - -QTcpSocket *Connectioninfo::getSct() const { - return sct; -} - -void Connectioninfo::setSct(QTcpSocket *value) { - sct = value; -} - -QByteArray Connectioninfo::getToken() const { - return token; -} - -void Connectioninfo::setToken(const QByteArray &value) { - token = value; -} - -void Connectioninfo::disconnect() { - if (sct) { - sct->close(); - token = ""; - sct->deleteLater(); - sct = nullptr; - } -} - -void Connectioninfo::ban() { - karma = BANED_KARMA; - disconnect(); -} - -bool Connectioninfo::isBaned() const { - return karma < 1; -} - -void Connectioninfo::unBan() { - karma = RESTORE_KARMA; -} - -bool Connectioninfo::isValid() const { - return sct && !RSAKey.pub.isEmpty() && !RSAKey.priv.isEmpty(); -} - -Connectioninfo::Connectioninfo(QTcpSocket *tcp, int kar, RSAKeyPair keys) { - sct = tcp; - karma = kar; - RSAKey = keys; - token = ""; -} - -Connectioninfo::~Connectioninfo() { - if (sct) { - sct->deleteLater(); - } -} -} diff --git a/SnakeServer/ClientProtocol/connectioninfo.h b/SnakeServer/ClientProtocol/connectioninfo.h deleted file mode 100644 index 4bbba2e..0000000 --- a/SnakeServer/ClientProtocol/connectioninfo.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef CONNECTIONINFO_H -#define CONNECTIONINFO_H - -#include "rsakeyspool.h" -#include "clientprotocol_global.h" - -class QTcpSocket; -namespace ClientProtocol { - -#define NOT_VALID_CARMA 0xFF -#define DEFAULT_KARMA 100 -#define RESTORE_KARMA 20 -#define BANED_KARMA 0 - -class CLIENTPROTOCOLSHARED_EXPORT Connectioninfo { - - QTcpSocket *sct = nullptr; - int karma = DEFAULT_KARMA; - RSAKeyPair RSAKey; - QByteArray token; - -public: - void disconnect(); - - void ban(); - bool isBaned() const; - void unBan(); - - bool isValid() const; - - Connectioninfo(QTcpSocket * tcp = nullptr, - int kar = NOT_VALID_CARMA, - RSAKeyPair keys = RSAKeyPair()); - ~Connectioninfo(); - - int getKarma() const; - void setKarma(int value); - RSAKeyPair getRSAKey() const; - void setRSAKey(const RSAKeyPair &value); - QTcpSocket *getSct() const; - void setSct(QTcpSocket *value); - QByteArray getToken() const; - void setToken(const QByteArray &value); -}; -} -#endif // CONNECTIONINFO_H diff --git a/SnakeServer/ClientProtocol/cp.h b/SnakeServer/ClientProtocol/cp.h deleted file mode 100644 index 569bc01..0000000 --- a/SnakeServer/ClientProtocol/cp.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef CP_H -#define CP_H -#include "server.h" -#include "client.h" - -#endif // CP_H diff --git a/SnakeServer/ClientProtocol/cpserver.h b/SnakeServer/ClientProtocol/cpserver.h deleted file mode 100644 index 265567c..0000000 --- a/SnakeServer/ClientProtocol/cpserver.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef CPSERVER_H -#define CPSERVER_H - -#include "server.h" - -#endif // CPSERVER_H diff --git a/SnakeServer/ClientProtocol/factorynetobjects.cpp b/SnakeServer/ClientProtocol/factorynetobjects.cpp deleted file mode 100644 index cd2785d..0000000 --- a/SnakeServer/ClientProtocol/factorynetobjects.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#include "factorynetobjects.h" -#include "clientprotocol.h" - -namespace ClientProtocol { - -QMap map; -QMap types_sizes; - -BaseNetworkObject *FactoryNetObjects::build(quint8 type) { - if (!map.contains(type)) { - return nullptr; - } - - return map.value(type)->create(); -} - -BaseNetworkObject *FactoryNetObjects::build(quint8 type, const QByteArray &array) { - auto temp = build(type); - - if (!temp) { - return temp; - } - - temp->fromBytes(array); - return temp; -} - -NetworkClassSize FactoryNetObjects::getSize(quint8 type) { - return types_sizes.value(type, 0); -} - -bool FactoryNetObjects::isRegisteredType(quint8 type) { - return map.contains(type); -} - -bool FactoryNetObjects::isInited() { - return map.size(); -} - -} diff --git a/SnakeServer/ClientProtocol/factorynetobjects.h b/SnakeServer/ClientProtocol/factorynetobjects.h deleted file mode 100644 index d614e64..0000000 --- a/SnakeServer/ClientProtocol/factorynetobjects.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef FACTORYNETOBJECTS_H -#define FACTORYNETOBJECTS_H -#include "clientprotocol_global.h" -#include "basenetworkobject.h" -#include -#include -namespace ClientProtocol { - -extern QMap map; -extern QMap types_sizes; - -class CLIENTPROTOCOLSHARED_EXPORT FactoryNetObjects { -private: - -public: - FactoryNetObjects() = delete; - - static BaseNetworkObject *build(quint8 type); - static BaseNetworkObject *build(quint8 type, const QByteArray& array); - - static NetworkClassSize getSize(quint8 type); - static bool isRegisteredType(quint8 type); - static bool isInited(); - - template - static bool regType(quint8 id) { - if (map.contains(id)) { - return false; - } - - auto tempObj = new T(); - map.insert(id, tempObj); - types_sizes.insert(id, tempObj->classSize()); - return true; - } -}; -} - - -#endif // FACTORYNETOBJECTS_H diff --git a/SnakeServer/ClientProtocol/networkclasssize.cpp b/SnakeServer/ClientProtocol/networkclasssize.cpp deleted file mode 100644 index d790614..0000000 --- a/SnakeServer/ClientProtocol/networkclasssize.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include "networkclasssize.h" - -namespace ClientProtocol { - -bool NetworkClassSize::isStaticType() { - return min == max; -} - -NetworkClassSize::NetworkClassSize(unsigned int size) { - operator=(size); -} - -NetworkClassSize::NetworkClassSize(unsigned int min, unsigned int maxDif) { - operator=(min); - max += maxDif; -} - -NetworkClassSize &NetworkClassSize::operator =(unsigned int size) { - min = max = size; - return *this; -} - -NetworkClassSize &NetworkClassSize::operator +(const NetworkClassSize & other) { - min += other.min; - max += other.max; - return *this; -} - -bool NetworkClassSize::isValid(unsigned int size) const { - return size <= max && size >= min; -} -} diff --git a/SnakeServer/ClientProtocol/networkclasssize.h b/SnakeServer/ClientProtocol/networkclasssize.h deleted file mode 100644 index 3581486..0000000 --- a/SnakeServer/ClientProtocol/networkclasssize.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef NETWORKCLASSSIZE_H -#define NETWORKCLASSSIZE_H - -#include "clientprotocol_global.h" - -namespace ClientProtocol { -struct CLIENTPROTOCOLSHARED_EXPORT NetworkClassSize { - unsigned int min = 0; - unsigned int max = 0; - - bool isStaticType(); - - NetworkClassSize(unsigned int size); - NetworkClassSize(unsigned int min, unsigned int max); - - NetworkClassSize& operator = (unsigned int size); - NetworkClassSize& operator + (const NetworkClassSize& ); - - bool isValid(unsigned int size) const; -}; -} - - - -#endif // NETWORKCLASSSIZE_H diff --git a/SnakeServer/ClientProtocol/rsakeyspool.cpp b/SnakeServer/ClientProtocol/rsakeyspool.cpp deleted file mode 100644 index 8367cf8..0000000 --- a/SnakeServer/ClientProtocol/rsakeyspool.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include "rsakeyspool.h" -#include - -namespace ClientProtocol { - -bool RSAKeysPool::take(QRSAEncryption::Rsa rsa, RSAKeyPair& res) { - QMutexLocker locker(&multithread); - - if (pool.value(rsa).isEmpty()) { - emit sigKeyTaked(); - return false; - } - - res = pool.value(rsa).begin().value(); - return true; -} - -void RSAKeysPool::addNewKey(QRSAEncryption::Rsa rsa, const RSAKeyPair& key) { - QMutexLocker locker(&multithread); - pool[rsa].insert(static_cast(time(nullptr)), key); -} - -int RSAKeysPool::size(QRSAEncryption::Rsa rsa) const { - return pool.value(rsa).size(); -} - -} diff --git a/SnakeServer/ClientProtocol/rsakeyspool.h b/SnakeServer/ClientProtocol/rsakeyspool.h deleted file mode 100644 index 402f60a..0000000 --- a/SnakeServer/ClientProtocol/rsakeyspool.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef RSAKEYSPOOL_H -#define RSAKEYSPOOL_H -#include -#include -#include -#include -#include -#include "clientprotocol_global.h" - -namespace ClientProtocol { - -struct RSAKeyPair { - QByteArray pub; - QByteArray priv; -}; - -typedef QMap KeysPool; -typedef QHash PoolData; -class CLIENTPROTOCOLSHARED_EXPORT RSAKeysPool: public QObject { - Q_OBJECT -private: - PoolData pool; - - QMutex multithread; - -public: - bool take(QRSAEncryption::Rsa rsa, RSAKeyPair &res); - void addNewKey(QRSAEncryption::Rsa rsa, const RSAKeyPair& key); - int size(QRSAEncryption::Rsa rsa) const; - -signals: - - void sigKeyTaked(); -}; - -} -#endif // RSAKEYSPOOL_H diff --git a/SnakeServer/ClientProtocol/server.cpp b/SnakeServer/ClientProtocol/server.cpp deleted file mode 100644 index b08d81e..0000000 --- a/SnakeServer/ClientProtocol/server.cpp +++ /dev/null @@ -1,415 +0,0 @@ -#include "server.h" -#include "quasarapp.h" -#include -#include -#include -#include "clientprotocol.h" - -namespace ClientProtocol { - -bool Server::parsePackage(const Package &pkg, QTcpSocket* sender) { - if (!pkg.isValid()) { - QuasarAppUtils::Params::verboseLog("incomming package is not valid!"); - changeKarma(sender->peerAddress().toIPv4Address(), CRITICAL_ERROOR); - return false; - } - - if (!sender->isValid()) { - QuasarAppUtils::Params::verboseLog("incomming package is not valid!"); - changeKarma(sender->peerAddress().toIPv4Address(), LOGICK_ERROOR); - return false; - } - - switch (static_cast(pkg.hdr.command)) { - case Command::Ping: { - - if (static_cast(pkg.hdr.type) != Type::Request) { - return false; - } - - Package pcg; - - if (!(pcg.create(Command::Ping, Type::Responke, &pkg.hdr))) { - return false; - }; - - if (!sendPackage(pcg, sender)) { - QuasarAppUtils::Params::verboseLog("!responce not sendet!"); - } - break; - } - - default: { - - emit incomingReques(pkg.hdr, pkg.data, - sender->peerAddress().toIPv4Address()); - } - } - - return true; -} - -bool Server::sendPackage(const Package &pkg, QTcpSocket * target) { - if (!pkg.isValid()) { - return false; - } - - if (!target || !target->isValid()) { - qCritical() << "destination server not valid!"; - return false; - } - - if (!target->waitForConnected()) { - qCritical() << "no connected to server! " << target->errorString(); - return false; - } - - auto bytes = pkg.toBytes(); - bool sendet = bytes.size() == target->write(bytes); - - return sendet; -} - -void Server::ban(quint32 target) { - if (!_connections[target]) { - _connections[target] = new Connectioninfo(); - } - - _connections[target]->ban(); -} - -void Server::unBan(quint32 target) { - if (!_connections.contains(target)) { - return; - } - - _connections[target]->unBan(); -} - -bool Server::registerSocket(QTcpSocket *socket) { - auto address = socket->peerAddress().toIPv4Address(); - - if (!_pool) { - QuasarAppUtils::Params::verboseLog("key pool is not inited", QuasarAppUtils::Error); - return false; - } - - RSAKeyPair pair; - - if (!_pool->take(BASE_RSA_BITS, pair)) { - QuasarAppUtils::Params::verboseLog("key pool is empty", QuasarAppUtils::Error); - return false; - } - - _connections[address] = new Connectioninfo(socket, DEFAULT_KARMA, - pair); - - connect(socket, &QTcpSocket::readyRead, this, &Server::avelableBytes); - connect(socket, &QTcpSocket::disconnected, this, &Server::handleDisconected); - - if (!sendPubKey(socket, pair.pub)) { - QuasarAppUtils::Params::verboseLog("not sendet pub key to client" - "generate new key!", QuasarAppUtils::Error); - return false; - } - - return true; -} - -bool Server::changeKarma(quint32 addresss, int diff) { - auto ptr = _connections.value(addresss); - if (!ptr) { - return false; - } - - auto objKarma = ptr->getKarma(); - - if (objKarma >= NOT_VALID_CARMA) { - return false; - } - - if (objKarma <= BANED_KARMA) { - return false; - } - - ptr->setKarma(objKarma + diff); - return true; -} - -bool Server::isBaned(const QTcpSocket * adr) const { - auto ptr = _connections.value(adr->peerAddress().toIPv4Address()); - - if (!ptr) { - return false; - } - - return ptr->isBaned(); -} - -int Server::connectionsCount() const { - int count = 0; - for (auto i : _connections) { - if (i->getSct()) { - if (!i->getSct()->isValid()) { - QuasarAppUtils::Params::verboseLog("connection count, findet not valid socket", - QuasarAppUtils::Warning); - } - - count++; - } - } - return count; -} - -bool Server::sendPubKey(QTcpSocket * target, const QByteArray &pubKey) { - - Package pcg; - - PubKey pubkey; - - pubkey.setKey(pubKey); - pubkey.setTypeKey(BASE_RSA_BITS); - pubkey.setId(0); - - if (!pubkey.isValid()) { - return false; - } - - if (!(pcg.create(&pubkey, Type::Request))) { - return false; - }; - - return sendPackage(pcg, target); - -} - -void Server::avelableBytes() { - auto client = dynamic_cast(sender()); - - if (!client) { - return; - } - - auto array = client->readAll(); - - if (_downloadPackage.hdr.isValid()) { - _downloadPackage.data.append(array); - - } else { - _downloadPackage.reset(); - - memcpy(&_downloadPackage.hdr, - array.data(), sizeof(Header)); - - _downloadPackage.data.append(array.mid(sizeof(Header))); - } - - if (_downloadPackage.isValid()) { - parsePackage(_downloadPackage, client); - } - - if (_downloadPackage.data.size() >= _downloadPackage.hdr.size) { - _downloadPackage.reset(); - } -} - -void Server::handleDisconected() { - auto _sender = dynamic_cast(sender()); - - if (_sender) { - // log error - - unsigned int address = _sender->peerAddress().toIPv4Address(); - auto ptr = _connections.value(address); - if (ptr) { - ptr->disconnect(); - } else { - QuasarAppUtils::Params::verboseLog("system error in void Server::handleDisconected()" - " address not valid", - QuasarAppUtils::Error); - } - return; - } - - QuasarAppUtils::Params::verboseLog("system error in void Server::handleDisconected()" - "dynamic_cast fail!", - QuasarAppUtils::Error); -} - -void Server::handleIncommingConnection() { - while (hasPendingConnections()) { - auto socket = nextPendingConnection(); - - if (isBaned(socket)) { - socket->abort(); - continue; - } - - registerSocket(socket); - } -} - -Server::Server(RSAKeysPool *pool, QObject *ptr) : - QTcpServer (ptr) { - - _pool = pool; - connect(this, &Server::newConnection, this, &Server::handleIncommingConnection); -} - -Server::~Server() { - stop(); -} - -bool Server::run(const QString &ip, unsigned short port) { - - if (!listen(QHostAddress(ip), port)) { - QuasarAppUtils::Params::verboseLog("listing fail " + this->errorString(), - QuasarAppUtils::Error); - return false; - } - - return true; -} - -void Server::stop(bool reset) { - close(); - - if (reset) { - - for (auto &&i : _connections) { - i->disconnect(); - } - - _connections.clear(); - } -} - -void Server::badRequest(quint32 address, const Header &req) { - auto client = _connections.value(address); - - if (!client) { - - QuasarAppUtils::Params::verboseLog("Bad request detected, bud responce command not sendet!" - " because client == null", - QuasarAppUtils::Error); - return; - } - - if (!changeKarma(address, REQUEST_ERROR)) { - - QuasarAppUtils::Params::verboseLog("Bad request detected, bud responce command not sendet!" - " because karma not changed", - QuasarAppUtils::Error); - - return; - } - - Package pcg; - if (!(pcg.create(Command::BadRequest, Type::Responke, &req))) { - QuasarAppUtils::Params::verboseLog("Bad request detected, bud responce command not sendet!" - " because package not created", - QuasarAppUtils::Error); - }; - - if (!sendPackage(pcg, client->getSct())) { - - QuasarAppUtils::Params::verboseLog("Bad request detected, bud responce command not sendet!" - " because karma not changed", - QuasarAppUtils::Error); - return; - } - - QuasarAppUtils::Params::verboseLog("Bad request sendet to adderess: " + - client->getSct()->peerAddress().toString(), - QuasarAppUtils::Info); -} - -bool Server::sendResponse(const BaseNetworkObject *resp, quint32 address, const Header *req) { - - Package pcg; - - if (!pcg.create(resp, Type::Responke, req)) { - QuasarAppUtils::Params::verboseLog("Response not sent because package not created", - QuasarAppUtils::Error); - } - - return sendResponse(&pcg, address, req); -} - -bool Server::sendResponse(Package *pcg, quint32 address, const Header *req) { - pcg->signPackage(req); - return sendResponse(*pcg, address); -} - -bool Server::sendResponse(const Package &pcg, quint32 address) -{ - auto client = _connections.value(address); - - if (!client) { - QuasarAppUtils::Params::verboseLog("Response not sent because client == null", - QuasarAppUtils::Error); - return false; - } - - - if (!sendPackage(pcg, client->getSct())) { - QuasarAppUtils::Params::verboseLog("Response not sent!", - QuasarAppUtils::Error); - return false; - } - - return true; -} - -QString Server::getWorkState() const { - if (isListening()) { - if (hasPendingConnections()) - return "overload"; - else { - return "Work"; - } - } - - return "Not running"; -} - -QString Server::connectionState() const { - return QString("%0 / %1").arg(connectionsCount()).arg(maxPendingConnections()); -} - -QStringList Server::baned() const { - QStringList list = {}; - for (auto i = _connections.begin(); i != _connections.end(); ++i) { - if (i.value()->isBaned()) { - list.push_back(QHostAddress(i.key()).toString()); - } - } - - return list; -} - -bool Server::getRSA(quint32 key, RSAKeyPair& res) const { - auto sct = _connections.value(key); - if (sct) { - res = sct->getRSAKey(); - return true; - } - - return false; -} - -QByteArray Server::getToken(quint32 address) const { - return _connections.value(address)->getToken(); -} - -bool Server::setToken(quint32 address, const QByteArray &token) { - if (_connections.contains(address)) { - _connections[address]->setToken(token); - return true; - } - - return false; -} - - -} diff --git a/SnakeServer/ClientProtocol/server.h b/SnakeServer/ClientProtocol/server.h deleted file mode 100644 index 0221116..0000000 --- a/SnakeServer/ClientProtocol/server.h +++ /dev/null @@ -1,80 +0,0 @@ -#ifndef SERVER_CP_H -#define SERVER_CP_H -#include "clientprotocol_global.h" -#include "clientprotocol.h" - -#include -#include "rsakeyspool.h" -#include "connectioninfo.h" - -namespace ClientProtocol { - -#define CRITICAL_ERROOR -50 -#define LOGICK_ERROOR -20 -#define REQUEST_ERROR -5 - - -class CLIENTPROTOCOLSHARED_EXPORT Server : public QTcpServer -{ - Q_OBJECT -private: - Package _downloadPackage; - QHash _connections; - - RSAKeysPool * _pool = nullptr; - bool parsePackage(const Package &pkg, QTcpSocket * sender); - bool sendPackage(const Package &pkg, QTcpSocket * target); - bool registerSocket(QTcpSocket *socket); - bool changeKarma(quint32 addresss, int diff); - inline bool isBaned(const QTcpSocket *) const; - - int connectionsCount() const; - bool sendPubKey(QTcpSocket *target, const QByteArray &pubKey); - - -private slots: - void avelableBytes(); - void handleDisconected(); - - void handleIncommingConnection(); - -public: - explicit Server(RSAKeysPool * pool, QObject * ptr = nullptr); - ~Server() override; - bool run(const QString& ip, unsigned short port); - void stop(bool reset = false); - - void badRequest(quint32 address, const Header &req); - - bool sendResponse(const BaseNetworkObject* resp, quint32 address, - const Header *req = nullptr); - bool sendResponse(Package *pcg, quint32 address, const Header *req = nullptr); - bool sendResponse(const Package &pcg, quint32 address); - - void ban(quint32 target); - void unBan(quint32 target); - - /** - * @brief getWorkState - * @return string of work state - */ - QString getWorkState() const; - - /** - * @brief connectionState - * @return string with count users state - */ - QString connectionState() const; - - QStringList baned() const; - - bool getRSA(quint32, RSAKeyPair & res) const; - QByteArray getToken(quint32 address) const; - bool setToken(quint32 address, const QByteArray &token); - -signals: - void incomingReques(Header hdr, const QByteArray &data, const quint32 &sender); -}; - -} -#endif // SERVER_CP_H diff --git a/SnakeServer/Daemon/Daemon.pro b/SnakeServer/Daemon/Daemon.pro deleted file mode 100644 index ee57c0f..0000000 --- a/SnakeServer/Daemon/Daemon.pro +++ /dev/null @@ -1,36 +0,0 @@ -QT -= gui -QT += network - -CONFIG += c++17 console -CONFIG -= app_bundle - -# The following define makes your compiler emit warnings if you use -# any Qt feature that has been marked deprecated (the exact warnings -# depend on your compiler). Please consult the documentation of the -# deprecated API in order to know how to port your code away from it. -DEFINES += QT_DEPRECATED_WARNINGS - -# You can also make your code fail to compile if it uses deprecated APIs. -# In order to do so, uncomment the following line. -# You can also select to disable deprecated APIs only up to a certain version of Qt. -#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 - -SOURCES += \ - main.cpp - -TARGET = SnakeServer-daemon - -CONFIG(release, debug|release): { - DESTDIR = $$PWD/build/release - -} else { - DESTDIR = $$PWD/build/debug -} - -HEADERS += - -include($$PWD/../../QuasarAppLib/QuasarLib.pri) -include($$PWD/../ServerProtocol/ServerProtocol.pri) -include($$PWD/../ClientProtocol/ClientProtocol.pri) -include($$PWD/../../SnakeUtils/SnakeUtils.pri) -include($$PWD/../Server/Server.pri) diff --git a/SnakeServer/Daemon/SnakeServer.pro b/SnakeServer/Daemon/SnakeServer.pro deleted file mode 100644 index 22c203c..0000000 --- a/SnakeServer/Daemon/SnakeServer.pro +++ /dev/null @@ -1,34 +0,0 @@ -QT -= gui - -CONFIG += c++17 console -CONFIG -= app_bundle - -# The following define makes your compiler emit warnings if you use -# any Qt feature that has been marked deprecated (the exact warnings -# depend on your compiler). Please consult the documentation of the -# deprecated API in order to know how to port your code away from it. -DEFINES += QT_DEPRECATED_WARNINGS - -# You can also make your code fail to compile if it uses deprecated APIs. -# In order to do so, uncomment the following line. -# You can also select to disable deprecated APIs only up to a certain version of Qt. -#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 - -SOURCES += \ - main.cpp \ - serverutils.cpp - -CONFIG(release, debug|release): { - DESTDIR = $$PWD/build/release - -} else { - DESTDIR = $$PWD/build/debug -} - -include($$PWD/../QuasarAppLib/Etalons/qmake/install_prefix.pri) -include($$PWD/../QuasarAppLib/QuasarLib.pri) - -target_dir.files += QUASARAPP_LIB_OUTPUT_DIR - -HEADERS += \ - serverutils.h diff --git a/SnakeServer/Daemon/main.cpp b/SnakeServer/Daemon/main.cpp deleted file mode 100644 index 9eeb09e..0000000 --- a/SnakeServer/Daemon/main.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include -#include -#include -#include -#include - -int main(int argc, char *argv[]) -{ - if (!ServerUtils::parseParams(argc, argv)) { - ServerUtils::helpDaemon(); - return 1; - } - - if (QuasarAppUtils::Params::isEndable("help") || - QuasarAppUtils::Params::isEndable("h")) { - ServerUtils::helpDaemon(); - return 0; - } - - QString address = ""; - unsigned short port = 0; - QString db = ""; - if(QuasarAppUtils::Params::isEndable("address")) { - address = QuasarAppUtils::Params::getStrArg("address"); - } - - if(QuasarAppUtils::Params::isEndable("port")) { - port = static_cast(QuasarAppUtils::Params::getArg("port").toUInt()); - } - - if(QuasarAppUtils::Params::isEndable("db")) { - db = QuasarAppUtils::Params::getStrArg("db"); - } - - - if(ServerUtils::runDaemon()) { - return 0; - } - - QCoreApplication a(argc, argv); - - MainServer mainServer(false, nullptr); - - if (!mainServer.run(address, port, db)) { - QuasarAppUtils::Params::verboseLog("server is not run!"); - ServerUtils::helpDaemon(); - return 1; - } - - return a.exec(); -} diff --git a/SnakeServer/Qt-Secret b/SnakeServer/Qt-Secret deleted file mode 160000 index 29bdfc6..0000000 --- a/SnakeServer/Qt-Secret +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 29bdfc6e8182615b782f2f5abdca6427f718208e diff --git a/SnakeServer/Server/Server.pri b/SnakeServer/Server/Server.pri deleted file mode 100644 index 21b6637..0000000 --- a/SnakeServer/Server/Server.pri +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (C) 2018 - 2019 QuasarApp. -# Distributed under the lgplv3 software license, see the accompanying -# Everyone is permitted to copy and distribute verbatim copies -# of this license document, but changing it is not allowed. -# - -!isEmpty(SERVER_LIB):error("Server.pri already included") -SERVER_LIB = 1 - -#DEPENDS -CONFIG(release, debug|release): { - SERVER_LIB_OUTPUT_DIR="$$PWD/build/release" -} else { - SERVER_LIB_OUTPUT_DIR="$$PWD/build/debug" -} - -LIBS += -L$$SERVER_LIB_OUTPUT_DIR -lServer - -INCLUDEPATH += "$$PWD/" - - - diff --git a/SnakeServer/Server/Server.pro b/SnakeServer/Server/Server.pro deleted file mode 100644 index c669b6f..0000000 --- a/SnakeServer/Server/Server.pro +++ /dev/null @@ -1,59 +0,0 @@ -#------------------------------------------------- -# -# Project created by QtCreator 2019-02-16T12:24:27 -# -#------------------------------------------------- - -QT -= gui -QT += network sql concurrent - -TARGET = Server -TEMPLATE = lib - -DEFINES += SERVER_LIBRARY - -# The following define makes your compiler emit warnings if you use -# any feature of Qt which has been marked as deprecated (the exact warnings -# depend on your compiler). Please consult the documentation of the -# deprecated API in order to know how to port your code away from it. -DEFINES += QT_DEPRECATED_WARNINGS - -# You can also make your code fail to compile if you use deprecated APIs. -# In order to do so, uncomment the following line. -# You can also select to disable deprecated APIs only up to a certain version of Qt. -#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 - -SOURCES += \ - item.cpp \ - keysreactor.cpp \ - mainserver.cpp \ - playerdbdata.cpp \ - sqldbcache.cpp \ - sqldbwriter.cpp \ - websocketcontroller.cpp - -TARGET = Server - -CONFIG(release, debug|release): { - DESTDIR = $$PWD/build/release - -} else { - DESTDIR = $$PWD/build/debug -} - -HEADERS += \ - item.h \ - keysreactor.h \ - mainserver.h \ - playerdbdata.h \ - server_global.h \ - sqldbcache.h \ - sqldbwriter.h \ - websocketcontroller.h - -include($$PWD/../../QuasarAppLib/QuasarLib.pri) -include($$PWD/../ServerProtocol/ServerProtocol.pri) -include($$PWD/../ClientProtocol/ClientProtocol.pri) -include($$PWD/../../SnakeUtils/SnakeUtils.pri) - -RESOURCES += sqlres.qrc diff --git a/SnakeServer/Server/item.cpp b/SnakeServer/Server/item.cpp deleted file mode 100644 index c203c3b..0000000 --- a/SnakeServer/Server/item.cpp +++ /dev/null @@ -1,72 +0,0 @@ -#include "item.h" -#include "factorynetobjects.h" -#include -#include - -int Item::getId() const { - return id; -} - -bool Item::setId(int value) { - id = value; - - if (data.size() < static_cast(sizeof (id) + sizeof (ClientProtocol::Command))) { - return false; - } - - int oldSize = data.size(); - - data.replace(sizeof (ClientProtocol::Command), sizeof (id), - reinterpret_cast(&id), sizeof (id)); - - return data.size() == oldSize; -} - -Item::Item() { - -} - -Item::Item(const ClientProtocol::Package &other) { - hdr = other.hdr; - data = other.data; - ClientProtocol::BaseNetworkObject base; - base.fromBytes(data); - id = base.id(); -} - -Item::Item(const ClientProtocol::BaseNetworkObject *obj) { - if (!create(obj, ClientProtocol::Type::Stream)) { - QuasarAppUtils::Params::verboseLog("Error create Item from BaseNetworkObject", - QuasarAppUtils::VerboseLvl::Error); - } - - id = obj->id(); -} - -Item::Item(ClientProtocol::Command cmd, const QByteArray &data) { - if (!create(cmd, ClientProtocol::Type::Stream, data)) { - QuasarAppUtils::Params::verboseLog("Error create Item from QByteArray", - QuasarAppUtils::VerboseLvl::Error); - } - - ClientProtocol::BaseNetworkObject base; - base.fromBytes(data); - id = base.id(); -} - -Item::~Item() { - -} - -ClientProtocol::Command Item::cmd() const { - return static_cast(hdr.command); -} - -const QByteArray &Item::dataArray() const { - return data; -} - -bool Item::isValid() const { - return ClientProtocol::FactoryNetObjects::isRegisteredType(hdr.type) - && Package::isValid(); -} diff --git a/SnakeServer/Server/item.h b/SnakeServer/Server/item.h deleted file mode 100644 index a8c13c1..0000000 --- a/SnakeServer/Server/item.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef ITEM_H -#define ITEM_H -#include -#include "server_global.h" - -class SERVERSHARED_EXPORT Item : public ClientProtocol::Package -{ -private: - - int id = -1; - -public: - Item(); - Item(const ClientProtocol::Package& other); - Item(const ClientProtocol::BaseNetworkObject* obj); - Item(ClientProtocol::Command cmd, const QByteArray& data); - - ~Item() override; - ClientProtocol::Command cmd() const; - const QByteArray& dataArray() const; - bool isValid() const override; - int getId() const; - bool setId(int value); - template - bool parse(T& res) { - return ClientProtocol::Package::parse(res); - } -}; - -#endif // ITEM_H diff --git a/SnakeServer/Server/keysreactor.cpp b/SnakeServer/Server/keysreactor.cpp deleted file mode 100644 index f7692ff..0000000 --- a/SnakeServer/Server/keysreactor.cpp +++ /dev/null @@ -1,89 +0,0 @@ -#include "keysreactor.h" - -ClientProtocol::RSAKeysPool *KeysReactor::getPool() { - return &_pool; -} - -int KeysReactor::getPoolSize() const { - return _poolSize; -} - -void KeysReactor::setPoolSize(int value) { - if (_poolSize != value) { - _poolSize = value; - handleGenerateNewKeys(); - } -} - -void KeysReactor::generateKeys(QRSAEncryption::Rsa rsa) { - QByteArray pub, priv; - - if (_poolSize > _pool.size(rsa)) { - QRSAEncryption::generatePairKey(pub, priv, rsa); - _pool.addNewKey(rsa, {pub, priv}); - } - - return; -} - -void KeysReactor::handleGenerateNewKeys() { - - auto generatorFunc = [this] (QRSAEncryption::Rsa rsa) { - - if (_mutexs[rsa]) { - return; - } - - _mutexs[rsa] = true; - - QByteArray pub, priv; - - while (_poolSize > _pool.size(rsa)) { - QRSAEncryption::generatePairKey(pub, priv, rsa); - _pool.addNewKey(rsa, {pub, priv}); - } - - _mutexs[rsa] = false; - - return; - }; - - _futures.insert(QRSAEncryption::RSA_64, - QtConcurrent::run(generatorFunc, QRSAEncryption::RSA_64)); - _futures.insert(QRSAEncryption::RSA_128, - QtConcurrent::run(generatorFunc, QRSAEncryption::RSA_128)); - _futures.insert(QRSAEncryption::RSA_256, - QtConcurrent::run(generatorFunc, QRSAEncryption::RSA_256)); - _futures.insert(QRSAEncryption::RSA_512, - QtConcurrent::run(generatorFunc, QRSAEncryption::RSA_512)); - - -} - -KeysReactor::KeysReactor(bool ForceGenerateKey, QObject *ptr): - QObject (ptr) { - - _mutexs[QRSAEncryption::RSA_64] = false; - _mutexs[QRSAEncryption::RSA_128] = false; - _mutexs[QRSAEncryption::RSA_256] = false; - _mutexs[QRSAEncryption::RSA_512] = false; - - if (ForceGenerateKey) { - generateKeys(QRSAEncryption::RSA_64); - generateKeys(QRSAEncryption::RSA_128); - generateKeys(QRSAEncryption::RSA_256); - generateKeys(QRSAEncryption::RSA_512); - } - - handleGenerateNewKeys(); - - connect(&_pool, &ClientProtocol::RSAKeysPool::sigKeyTaked, - this, &KeysReactor::handleGenerateNewKeys); -} - -KeysReactor::~KeysReactor() { - for (auto && i: _futures) { - i.cancel(); - i.waitForFinished(); - } -} diff --git a/SnakeServer/Server/keysreactor.h b/SnakeServer/Server/keysreactor.h deleted file mode 100644 index 55422cf..0000000 --- a/SnakeServer/Server/keysreactor.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef KEYSREACTOR_H -#define KEYSREACTOR_H - -#include -#include -#include -#include "server_global.h" - -#define DEFAULT_KEYPOOL_SIZE 10 - -class SERVERSHARED_EXPORT KeysReactor: public QObject -{ - Q_OBJECT -private: - ClientProtocol::RSAKeysPool _pool; - int _poolSize = DEFAULT_KEYPOOL_SIZE; - QHash _mutexs; - QHash> _futures; - void generateKeys(QRSAEncryption::Rsa); - -private slots: - void handleGenerateNewKeys(); - -public: - KeysReactor(bool ForceGenerateKey, QObject *ptr = nullptr); - - ~KeysReactor() override; - - ClientProtocol::RSAKeysPool* getPool(); - int getPoolSize() const; - void setPoolSize(int value); - -}; - -#endif // KEYSREACTOR_H diff --git a/SnakeServer/Server/mainserver.cpp b/SnakeServer/Server/mainserver.cpp deleted file mode 100644 index 9b4afee..0000000 --- a/SnakeServer/Server/mainserver.cpp +++ /dev/null @@ -1,320 +0,0 @@ -#include "keysreactor.h" -#include "mainserver.h" -#include "playerdbdata.h" -#include "sqldbcache.h" -#include "websocketcontroller.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -QByteArray MainServer::generateTocket(const QString& gmail) const { - - return QCryptographicHash::hash((gmail + QString::number(rand())).toLatin1(), - QCryptographicHash::Sha256); -} - -QByteArray MainServer::registerPlayer(const ClientProtocol::Login& login, - const ClientProtocol::RSAKeyPair& rsa) const { - - if (!login.isValid()) { - return {}; - } - - if (_db->getPlayerId(login.getGmail()) > -1) { - return {}; - } - - PlayerDBData player; - player.setGmail( login.getGmail()); - - player.setPass(QRSAEncryption::decode(login.getHashPass(), rsa.priv, BASE_RSA_BITS)); - - int id = _db->savePlayer(player); - if (id < 0) { - return {}; - } - - player = _db->getPlayer(id); - player.setToken(generateTocket(login.getGmail())); - player.setName(QString("Palyer %0").arg(id)); - - if (!player.isValid()) { - QuasarAppUtils::Params::verboseLog("register Player fail!", - QuasarAppUtils::Warning); - return {}; - } - - if (id != _db->savePlayer(player)) { - return {}; - } - - return player.getToken(); -} - -QByteArray MainServer::loginPlayer(const ClientProtocol::Login& login, - const ClientProtocol::RSAKeyPair& rsa) const { - if (!login.isValid()) { - return {}; - } - - auto pass = QRSAEncryption::decode(login.getHashPass(), rsa.priv, BASE_RSA_BITS); - - if (_db->login(login.getGmail(), pass.toHex())) { - return generateTocket(login.getGmail()); - - } - - return {}; -} - -bool MainServer::restartSrver(const QString &ip, unsigned short port) { - if (_serverDaemon->isListening()) { - _serverDaemon->stop(); - } - - if (!_serverDaemon->run(ip, port)) { - return false; - } - - return true; -} - -void MainServer::handleRequest(ClientProtocol::Header hdr, - const QByteArray& data, - const quint32 &addres) { - - Q_UNUSED(addres); - - - switch (static_cast(hdr.command)) { - case ClientProtocol::Command::Login: { - - ClientProtocol::Login loginData; - loginData.fromBytes(data); - - ClientProtocol::RSAKeyPair keys; - if (!_serverDaemon->getRSA(addres, keys)) { - _serverDaemon->badRequest(addres, hdr); - return; - } - - QByteArray tocken; - if (loginData.getRegisterNewUser()) { - tocken = registerPlayer(loginData, keys); - if (!tocken.size()) { - _serverDaemon->badRequest(addres, hdr); - return; - } - } else { - tocken = loginPlayer(loginData, keys); - - if (!tocken.size()) { - _serverDaemon->badRequest(addres, hdr); - return; - } - } - - ClientProtocol::UpdatePlayerData tockenObj; - tockenObj.setToken(tocken); - tockenObj.setId(_db->getPlayerId(loginData.getGmail())); - - if (!_serverDaemon->sendResponse(&tockenObj, addres, &hdr)) { - QuasarAppUtils::Params::verboseLog("responce not sendet", - QuasarAppUtils::Warning); - return; - } - - break; - } - - case ClientProtocol::Command::GameData: { - break; - } - - case ClientProtocol::Command::UpdatePlayerData: { - ClientProtocol::UpdatePlayerData request; - request.fromBytes(data); - - auto tocken = _serverDaemon->getToken(addres); - - if (!tocken.isEmpty() && tocken == request.getToken()) { - auto player = _db->getPlayer(request.id()); - _serverDaemon->sendResponse(&player, addres, &hdr); - - } - - _serverDaemon->badRequest(addres, hdr); - break; - } - - case ClientProtocol::Command::GetItem: { - - ClientProtocol::GetItem getRequest; - getRequest.fromBytes(data); - - auto tocken = _serverDaemon->getToken(addres); - - if (!tocken.isEmpty() && tocken == getRequest.getToken()) { - auto item = _db->getItem(getRequest.id()); - _serverDaemon->sendResponse(&item, addres, &hdr); - - } - - _serverDaemon->badRequest(addres, hdr); - break; - } - - case ClientProtocol::Command::WebSocket: { - - ClientProtocol::WebSocket websocket; - websocket.fromBytes(data); - - if (websocket.isSubscribe()) { - _websocketctrl->subscribe(addres, websocket.getCommand(), - websocket.getObjectId()); - } else { - _websocketctrl->unsubscribe(addres, websocket.getCommand(), - websocket.getObjectId()); - } - - break; - } - - default: - _serverDaemon->badRequest(addres, hdr); - break; - } -} - -void MainServer::handleTerminalRequest(QVariantMap obj) { - - auto command = static_cast(obj.value("command").toInt()); - QVariantMap res; - - switch (command) { - case ServerProtocol::State: { - res ["Work State"] = _serverDaemon->getWorkState(); - res ["Connections count"] = _serverDaemon->connectionState(); - - auto banedList = _serverDaemon->baned(); - res ["Baned Addresses count"] = banedList.size(); - res ["Baned List"] = banedList; - - break; - } - case ServerProtocol::Ban: { - auto address = obj.value("address").toUInt(); - - _serverDaemon->ban(address); - auto banedList = _serverDaemon->baned(); - res ["Baned List"] = banedList; - - break; - } - - case ServerProtocol::Unban: { - auto address = obj.value("address").toUInt(); - _serverDaemon->unBan(address); - auto banedList = _serverDaemon->baned(); - - res ["Baned List"] = banedList; - break; - } - - case ServerProtocol::Restart: { - auto address = obj.value("address").toString(); - auto port = static_cast(obj.value("port").toInt()); - - if (!restartSrver(address, port)) { - QuasarAppUtils::Params::verboseLog("server restart fail!"); - } - - res ["Work State"] = _serverDaemon->getWorkState(); - res ["Address"] = QString("%0:%1"). - arg(_serverDaemon->serverAddress().toString()). - arg(_serverDaemon->serverPort()); - - - break; - } - - case ServerProtocol::Stop: { - - res ["Res"] = "Server stoped!"; - _terminalPort->sendResponce(res, command); - _serverDaemon->stop(); - QCoreApplication::processEvents(); - QCoreApplication::quit(); - return; - - } - - default: - QuasarAppUtils::Params::verboseLog("server get undefined command!"); - res ["Error"] = "Server get undefined command!"; - break; - } - - _terminalPort->sendResponce(res, command); - return; -} - -MainServer::MainServer(bool forceKeys ,QObject *ptr): - QObject (ptr) { - - _keyReactor = new KeysReactor(forceKeys , this); - _serverDaemon = new ClientProtocol::Server(_keyReactor->getPool(), this); - _websocketctrl = new WebSocketController(_serverDaemon, this); - _terminalPort = new ServerProtocol::Server(this); - - _db = new SqlDBCache(); - - connect(_serverDaemon, &ClientProtocol::Server::incomingReques, - this, &MainServer::handleRequest); - - connect(_terminalPort, &ServerProtocol::Server::incomingRequest, - this, &MainServer::handleTerminalRequest); - - connect(_db, &SqlDBCache::sigItemChanged, - _websocketctrl, &WebSocketController::handleItemChanged); - - connect(_db, &SqlDBCache::sigPlayerChanged, - _websocketctrl, &WebSocketController::handlePlayerChanged); - - if (!ClientProtocol::initClientProtockol()){ - QuasarAppUtils::Params::verboseLog("clientProtocol no inited", QuasarAppUtils::Error); - } - -} - -bool MainServer::run(const QString &ip, unsigned short port, const QString& db, - const QString& terminalServer) { - - if (!_db->initDb((db.size())? db: DEFAULT_DB_PATH)) { - QuasarAppUtils::Params::verboseLog("init db fail!", QuasarAppUtils::Error); - return false; - } - - if (!_terminalPort->run((terminalServer.isEmpty())? DEFAULT_SERVER : terminalServer, true)) { - QuasarAppUtils::Params::verboseLog("run termonal fail!", QuasarAppUtils::Error); - return false; - } - - if (!restartSrver(ip.isEmpty()? LOCAL_SNAKE_SERVER: ip, - port ? port : DEFAULT_SNAKE_PORT)) { - QuasarAppUtils::Params::verboseLog("restart server fail", QuasarAppUtils::Error); - return false; - } - - return true; - -} - -MainServer::~MainServer() { -} diff --git a/SnakeServer/Server/mainserver.h b/SnakeServer/Server/mainserver.h deleted file mode 100644 index 0c75e16..0000000 --- a/SnakeServer/Server/mainserver.h +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef SERVER_H -#define SERVER_H -#include -#include "server_global.h" -#include -#include - -namespace ServerProtocol { - class Server; -} - -namespace ClientProtocol { - class Server; - class BaseNetworkObject; - class Login; - class RSAKeyPair; -} -class KeysReactor; -class SqlDBCache; -class PlayerDBData; -class WebSocketController; - -class SERVERSHARED_EXPORT MainServer: public QObject -{ - Q_OBJECT -private: - ServerProtocol::Server *_terminalPort = nullptr; - ClientProtocol::Server *_serverDaemon= nullptr; - SqlDBCache *_db = nullptr; - KeysReactor *_keyReactor = nullptr; - WebSocketController* _websocketctrl = nullptr; - - bool payItem(int player, int idItem); - bool sellItem(int player, int idItem); - QByteArray generateTocket(const QString& gmail) const; - QByteArray registerPlayer(const ClientProtocol::Login &login, - const ClientProtocol::RSAKeyPair &rsa) const; - QByteArray loginPlayer(const ClientProtocol::Login& login, - const ClientProtocol::RSAKeyPair& rsa) const; - - bool restartSrver(const QString& ip, unsigned short port); - -private slots: - void handleRequest(ClientProtocol::Header hdr, const QByteArray &data, - const quint32& addres); - void handleTerminalRequest(QVariantMap obj); - -public: - MainServer(bool forceKeys, QObject *ptr = nullptr); - bool run(const QString& ip = "", unsigned short port = 0, const QString &db = "", - const QString &terminalServer = ""); - virtual ~MainServer(); - -}; - -#endif // SERVER_H diff --git a/SnakeServer/Server/playerdbdata.cpp b/SnakeServer/Server/playerdbdata.cpp deleted file mode 100644 index ff0b140..0000000 --- a/SnakeServer/Server/playerdbdata.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include "playerdbdata.h" - -int PlayerDBData::getLastOnline() const { - return lastOnline; -} - -void PlayerDBData::setLastOnline(int value) { - lastOnline = value; -} - -int PlayerDBData::getOnlineTime() const { - return onlineTime; -} - -void PlayerDBData::setOnlineTime(int value) { - onlineTime = value; -} - -QByteArray PlayerDBData::getPass() const { - return pass; -} - -void PlayerDBData::setPass(const QByteArray &value) { - pass = value; -} - -QString PlayerDBData::getHexPass() const { - return getPass().toHex(); -} - -void PlayerDBData::fromHexPass(const QString &passHex) { - setPass(QByteArray::fromHex(passHex.toLatin1())); -} - - -PlayerDBData::PlayerDBData() -{ - -} diff --git a/SnakeServer/Server/playerdbdata.h b/SnakeServer/Server/playerdbdata.h deleted file mode 100644 index d765f50..0000000 --- a/SnakeServer/Server/playerdbdata.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef PLAYERDBDATA_H -#define PLAYERDBDATA_H - -#include -#include "server_global.h" - -class SERVERSHARED_EXPORT PlayerDBData: public ClientProtocol::Player -{ -private: - int lastOnline = 0; - int onlineTime = 0; - QByteArray pass = ""; - - -public: - PlayerDBData(); - int getLastOnline() const; - void setLastOnline(int value); - int getOnlineTime() const; - void setOnlineTime(int value); - QByteArray getPass() const; - void setPass(const QByteArray &value); - QString getHexPass() const; - void fromHexPass(const QString &passHex); -}; - -#endif // PLAYERDBDATA_H diff --git a/SnakeServer/Server/server_global.h b/SnakeServer/Server/server_global.h deleted file mode 100644 index 7ce5a72..0000000 --- a/SnakeServer/Server/server_global.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef SERVER_GLOBAL_H -#define SERVER_GLOBAL_H - -#include - -#if defined(SERVER_LIBRARY) -# define SERVERSHARED_EXPORT Q_DECL_EXPORT -#else -# define SERVERSHARED_EXPORT Q_DECL_IMPORT -#endif - -#endif // SERVER_GLOBAL_H diff --git a/SnakeServer/Server/sql/SnakeDB.sql b/SnakeServer/Server/sql/SnakeDB.sql deleted file mode 100644 index b9468a6..0000000 --- a/SnakeServer/Server/sql/SnakeDB.sql +++ /dev/null @@ -1,40 +0,0 @@ -PRAGMA foreign_keys = ON; - -CREATE TABLE IF NOT EXISTS items( - id INTEGER PRIMARY KEY NOT NULL, - type INTEGER NOT NULL, - data BLOB NOT NULL -); - -CREATE TABLE IF NOT EXISTS players( - id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, - name VARCHAR(100) NOT NULL, - pass VARCHAR(32) NOT NULL, - gmail VARCHAR(64) NOT NULL UNIQUE, - money INTEGER NOT NULL DEFAULT 0, - avgrecord INTEGER NOT NULL DEFAULT 0, - record INTEGER NOT NULL DEFAULT 0, - lastOnline date not null DEFAULT 0, - onlinetime INTEGER not null DEFAULT 0, - currentsnake INTEGER DEFAULT NULL, - - FOREIGN KEY(currentsnake) REFERENCES items(id) - ON UPDATE CASCADE - ON DELETE SET NULL - -); - -CREATE TABLE IF NOT EXISTS owners( - player INTEGER NOT NULL, - item INTEGER NOT NULL, - - FOREIGN KEY(player) REFERENCES players(id) - ON UPDATE CASCADE - ON DELETE CASCADE - - FOREIGN KEY(item) REFERENCES items(id) - ON UPDATE CASCADE - ON DELETE CASCADE -); - -CREATE UNIQUE INDEX IF NOT EXISTS iowners ON owners(player,item); diff --git a/SnakeServer/Server/sqldbcache.cpp b/SnakeServer/Server/sqldbcache.cpp deleted file mode 100644 index a9fb3bf..0000000 --- a/SnakeServer/Server/sqldbcache.cpp +++ /dev/null @@ -1,383 +0,0 @@ -#include "sqldbcache.h" -#include "quasarapp.h" -#include "playerdbdata.h" -#include -#include - -#include -#include - -int SqlDBCache::generateIdForItem() const { - if (items.isEmpty()) { - return 0; - } - - return items.lastKey() + 1; -} - -int SqlDBCache::generateIdForPalyer() const { - if (players.isEmpty()) { - return 0; - } - - return players.lastKey() + 1; -} - -bool SqlDBCache::checkPlayer(int id) { - if (players.contains(id)) { - return true; - } - - if (SqlDBWriter::checkPlayer(id)) { - - if (savePlayer(getPlayer(id)) < 0) { - QuasarAppUtils::Params::verboseLog("not saved data into cache " - " SqlDBCashe::checkPlayer"); - } - - return true; - } - - return false; -} - -bool SqlDBCache::checkItem(int idItem, int idOwner) { - - if (idOwner >= 0 ) { - - if (owners.contains(idOwner)) { - auto items = owners.value(idOwner); - return items.contains(idItem); - } - - if (SqlDBWriter::checkItem(idItem)) { - QSet items; - if (!SqlDBWriter::getAllItemsOfPalyer(idOwner, items)) { - QuasarAppUtils::Params::verboseLog("not loaded owners data from cache " - " SqlDBCashe::checkItem"); - } - - owners.insert(idOwner, items); - - return true; - } - - return false; - - } - - if (items.contains(idItem)) { - return true; - } - - if (SqlDBWriter::checkItem(idItem)) { - - auto item = getItem(idItem); - if (saveItem(item) < 0) { - QuasarAppUtils::Params::verboseLog("not saved data into cache " - " SqlDBCashe::checkItem"); - } - - return true; - } - - return false; -} - -void SqlDBCache::globalUpdateDataBasePrivate(qint64 currentTime) { - for (auto item = items.begin(); item != items.end(); ++item) { - if (SqlDBWriter::saveItem(item.value()) < 0) { - QuasarAppUtils::Params::verboseLog("writeUpdateItemIntoDB failed when" - " work globalUpdateDataRelease!!! id=" + - QString::number(item.key()), - QuasarAppUtils::VerboseLvl::Error); - } - } - - for (auto player = players.begin(); player != players.end(); ++player) { - if (SqlDBWriter::savePlayer(player.value()) < 0) { - QuasarAppUtils::Params::verboseLog("writeUpdatePlayerIntoDB failed when" - " work globalUpdateDataRelease!!! id=" + - QString::number(player.key()), - QuasarAppUtils::VerboseLvl::Error); - - } - } - - for (auto owner = owners.begin(); owner != owners.end(); ++owner) { - if (!SqlDBWriter::saveowners(owner.key(), owner.value())) { - QuasarAppUtils::Params::verboseLog("UpdateInfoOfowners failed when" - " work globalUpdateDataRelease!!! id=" + - QString::number(owner.key()), - QuasarAppUtils::VerboseLvl::Error); - } - } - - lastUpdateTime = currentTime; -} - -void SqlDBCache::globalUpdateDataBase(SqlDBCasheWriteMode mode) { - qint64 currentTime = QDateTime::currentMSecsSinceEpoch(); - - if (currentTime - lastUpdateTime > updateInterval || - static_cast(mode & SqlDBCasheWriteMode::Force)) { - - if (static_cast(mode & SqlDBCasheWriteMode::On_New_Thread)) { - - QtConcurrent::run([currentTime, this](){ - globalUpdateDataBasePrivate(currentTime); - }); - - } else { - globalUpdateDataBasePrivate(currentTime); - } - } -} - -bool SqlDBCache::itemIsFreeFrom(int item) const { - return SqlDBWriter::itemIsFreeFrom(item); -} - -SqlDBCache::SqlDBCache(qint64 updateInterval) { - lastUpdateTime = QDateTime::currentMSecsSinceEpoch(); - this->updateInterval = updateInterval; -} - -SqlDBCache::~SqlDBCache() { - globalUpdateDataBase(SqlDBCasheWriteMode::Force); -} - -bool SqlDBCache::initDb(const QString &pdbath) { - if (!SqlDBWriter::initDb(pdbath)) { - return false; - } - - getItem(getLastIdItems()); - getPlayer(getLastIdPlayers()); - - return true; -} - -Item SqlDBCache::getItem(int id) { - if (!isValid()) { - return Item(); - } - - auto item = items.value(id); - - if (item.isValid()) { - return item; - } - - item = SqlDBWriter::getItem(id); - if (item.isValid()) { - items.insert(id, item); - return item; - } - - return Item(); -} - -int SqlDBCache::saveItem(const Item &saveData) { - if (!isValid()) { - return -1; - } - auto item = saveData; - - int id = item.getId(); - - if (id < 0) { - id = generateIdForItem(); - if (!item.setId(id)) { - return -1; - } - } - - if (!item.isValid()) { - return -1; - } - items.insert(id, item); - - globalUpdateDataBase(SqlDBCasheWriteMode::On_New_Thread); - - emit sigItemChanged(id, item); - - return id; -} - -PlayerDBData SqlDBCache::getPlayer(int id) { - if (!isValid()) { - return PlayerDBData(); - } - - auto player = players.value(id); - - if (player.isValid()) { - return player; - } - - player = SqlDBWriter::getPlayer(id); - if (player.isValid()) { - players.insert(id, player); - return player; - } - - return PlayerDBData(); -} - -int SqlDBCache::savePlayer(const PlayerDBData &saveData) { - if (!isValid()) { - return -1; - } - - auto player = saveData; - - int id = player.id(); - - if (id < 0) { - id = generateIdForPalyer(); - player.setId(id); - } - - if (!player.isValid()) { - return -1; - } - - int curSnake = player.getCureentSnake(); - - if (curSnake >= 0 && !checkItem(curSnake, id)) { - return -1; - } - - players.insert(id, player); - playersIds.insert(player.getGmail(), id); - - globalUpdateDataBase(SqlDBCasheWriteMode::On_New_Thread); - emit sigPlayerChanged(id, player); - - return id; -} - -bool SqlDBCache::login(const QString &gmail, const QString &pass) { - if (!isValid()) { - return false; - } - - int id = getPlayerId(gmail); - if (id < 0) { - return false; - } - - auto player = getPlayer(id); - - if (!player.isValid()) { - return false; - } - - return player.getHexPass() == pass; -} - -bool SqlDBCache::giveAwayItem(int player, int item) { - if (!isValid()) { - return false; - } - - if (!checkItem(item, player)) { - return false; - } - - if (owners.contains(player)) { - auto &owner = owners[player]; - owner.remove(item); - - auto &p = players[player]; - - if (p.getCureentSnake() == item) { - p.setCureentSnake(-1); - } - - globalUpdateDataBase(SqlDBCasheWriteMode::On_New_Thread); - - return true; - } - - return false; -} - -bool SqlDBCache::getItem(int player, int item, bool check) { - if (!isValid()) { - return false; - } - - if (!(checkPlayer(player) && checkItem(item))) { - return false; - } - - if (check && !itemIsFreeFrom(item)) { - return false; - } - - if (owners.contains(player)) { - auto &owner = owners[player]; - owner.insert(item); - - globalUpdateDataBase(SqlDBCasheWriteMode::On_New_Thread); - - return true; - } - - QSet items; - if (!getAllItemsOfPalyer(player, items)) { - return false; - } - - if (owners.contains(player)) { - auto &owner = owners[player]; - owner.insert(item); - - globalUpdateDataBase(SqlDBCasheWriteMode::On_New_Thread); - - return true; - } - - return false; -} - -bool SqlDBCache::moveItem(int owner, int receiver, int item) { - if (!(giveAwayItem(owner, item) && getItem(receiver, item, false))) { - return false; - } - - sigItemChanged(item, getItem(item)); - return true; -} - -int SqlDBCache::getPlayerId(const QString &gmail) { - int id = playersIds.value(gmail, -1); - if (id < 0) { - id = SqlDBWriter::getPlayerId(gmail); - - if (id >= 0) { - playersIds[gmail] = id; - } - return id; - } - - return id; -} - -bool SqlDBCache::getAllItemsOfPalyer(int player, QSet &items) { - if (owners.contains(player)) { - items = owners[player]; - return true; - } - - if (SqlDBWriter::getAllItemsOfPalyer(player, items) && - checkPlayer(player)) { - - owners.insert(player, items); - return true; - } - - return false; -} diff --git a/SnakeServer/Server/sqldbcache.h b/SnakeServer/Server/sqldbcache.h deleted file mode 100644 index 80bbc37..0000000 --- a/SnakeServer/Server/sqldbcache.h +++ /dev/null @@ -1,74 +0,0 @@ -#ifndef SQLDBCASHE_H -#define SQLDBCASHE_H -#include "sqldbwriter.h" - -#include -#include -#include -#include -#include -#include "item.h" -#include - -enum class SqlDBCasheWriteMode: int { - Default = 0x0, - On_New_Thread = 0x1, - Force = 0x2, -} ; - -namespace ClientProtocol { - class BaseNetworkObject; -} - -class SERVERSHARED_EXPORT SqlDBCache: public QObject , private SqlDBWriter -{ - Q_OBJECT -private: - qint64 lastUpdateTime = 0; - qint64 updateInterval = DEFAULT_UPDATE_INTERVAL; - - QMap items; - QMap players; - QHash > owners; - QHash playersIds; - - int generateIdForItem() const; - int generateIdForPalyer() const; - - bool checkPlayer(int id) override; - bool checkItem(int idItem, int idOwner = -1) override; - - void globalUpdateDataBasePrivate(qint64 currentTime); - void globalUpdateDataBase(SqlDBCasheWriteMode mode = SqlDBCasheWriteMode::Default); - - bool itemIsFreeFrom(int item) const override ; - -public: - SqlDBCache(qint64 updateInterval = DEFAULT_UPDATE_INTERVAL); - ~SqlDBCache() override; - - bool initDb(const QString &pdbath = DEFAULT_DB_PATH) override; - - Item getItem(int id) override; - int saveItem(const Item& saveData) override; - PlayerDBData getPlayer(int id) override; - int savePlayer(const PlayerDBData &player) override; - - bool login(const QString& gmail, const QString& pass); - - bool giveAwayItem(int player, int item); - bool getItem(int player, int item, bool check = true); - bool moveItem(int owner, int receiver, int item); - int getPlayerId(const QString &gmail) override; - - bool getAllItemsOfPalyer(int player, QSet& items) override; - - friend class testSankeServer; - -signals: - void sigItemChanged(int id, const Item& newData); - void sigPlayerChanged(int id, const PlayerDBData& newData); - -}; - -#endif // SQLDBCASHE_H diff --git a/SnakeServer/Server/sqldbwriter.cpp b/SnakeServer/Server/sqldbwriter.cpp deleted file mode 100644 index abe0c31..0000000 --- a/SnakeServer/Server/sqldbwriter.cpp +++ /dev/null @@ -1,460 +0,0 @@ -#include "playerdbdata.h" -#include "sqldbwriter.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -bool SqlDBWriter::exec(QSqlQuery *sq,const QString& sqlFile) { - QFile f(sqlFile); - bool result = true; - if (f.open(QIODevice::ReadOnly)) { - - QString temp, delimiter = ";"; - QTextStream stream(&f); - stream.setCodec("UTF8"); - - while(!stream.atEnd()) { - temp += stream.readLine(); - if (temp.lastIndexOf("delimiter", -1, Qt::CaseInsensitive) > -1) { - temp.remove("delimiter", Qt::CaseInsensitive); - int last = temp.indexOf(QRegularExpression("[^ \f\n\r\t\v]")) + 1; - int begin = temp.lastIndexOf(QRegularExpression("[^ \f\n\r\t\v]")); - delimiter = temp.mid(begin, last - begin); - temp = ""; - } else { - if (temp.lastIndexOf(delimiter) >- 1) { - temp.remove(delimiter); - result = result && sq->exec(temp); - - if (!result) { - qCritical() << sq->lastError().text(); - f.close(); - return false; - } - - temp = ""; - } - } - } - - f.close(); - return result; - } - return false; -} - -bool SqlDBWriter::enableFK() const { - - QString request = QString("PRAGMA foreign_keys = ON"); - if (!query->exec(request)) { - QuasarAppUtils::Params::verboseLog("request error : " + query->lastError().text()); - return false; - } - - return true; -} - -bool SqlDBWriter::disableFK() const { - - - QString request = QString("PRAGMA foreign_keys = OFF"); - if (!query->exec(request)) { - QuasarAppUtils::Params::verboseLog("request error : " + query->lastError().text()); - return false; - } - - return true; - -} - -int SqlDBWriter::getLastIdItems() { - if (!SqlDBWriter::isValid()) { - return -1; - } - - QString request = QString("SELECT MAX(id) FROM items"); - if (!query->exec(request)) { - QuasarAppUtils::Params::verboseLog("request error : " + query->lastError().text()); - return -1; - } - - if (!query->next()) { - return -1; - } - - auto res = query->value(0).toInt(); - return res; -} - -int SqlDBWriter::getLastIdPlayers() { - if (!SqlDBWriter::isValid()) { - return -1; - } - - QString request = QString("SELECT MAX(id) FROM players"); - if (!query->exec(request)) { - QuasarAppUtils::Params::verboseLog("request error : " + query->lastError().text()); - return -1; - } - - if (!query->next()) { - return -1; - } - - return query->value(0).toInt(); -} - -int SqlDBWriter::getPlayerId(const QString &gmail) { - - if (!SqlDBWriter::isValid()) { - return -1; - } - - QString request = QString("SELECT id from players where gmail='%0'").arg(gmail); - - if (!query->exec(request)) { - QuasarAppUtils::Params::verboseLog("request error : " + query->lastError().text()); - return -1; - } - - if (!query->next()) { - return -1; - } - - return query->value("id").toInt(); -} - -bool SqlDBWriter::checkPlayer(int id) { - - QString request = QString("SELECT id from players where id='%0'").arg(id); - - if (!query->exec(request)) { - QuasarAppUtils::Params::verboseLog("request error : " + query->lastError().text()); - return false; - } - - if (!query->next()) { - return false; - } - - return true; -} - -bool SqlDBWriter::checkItem(int idItem, int idOwner) { - - - if (idOwner >= 0 ) { - if (!SqlDBWriter::checkPlayer(idOwner)) { - return false; - } - - QString request = QString("SELECT item from owners where player='%0' and item='%1'"). - arg(idOwner).arg(idItem); - - if (!query->exec(request)) { - QuasarAppUtils::Params::verboseLog("request error : " + query->lastError().text()); - return false; - } - - if (!query->next()) { - return false; - } - - return true; - } - - QString request = QString("SELECT id from items where id='%0'"). - arg(idItem); - - if (!query->exec(request)) { - QuasarAppUtils::Params::verboseLog("request error : " + query->lastError().text()); - return false; - } - - if (!query->next()) { - return false; - } - - return true; -} - -int SqlDBWriter::savePlayer(const PlayerDBData &player) { - if (!SqlDBWriter::isValid()) { - return -1; - } - - if (!player.isValid()) { - return -1; - } - - QString request; - int id = player.id(); - - int curSnake = player.getCureentSnake(); - - if (curSnake >= 0 && !SqlDBWriter::checkItem(curSnake, id)) { - return -1; - } - - - if (SqlDBWriter::checkPlayer(id)) { - request = QString("UPDATE players SET name='%0', gmail='%1', pass='%2', money='%3'," - " avgrecord='%4', record='%5', lastOnline='%6'," - " onlinetime='%7', currentsnake='%8' WHERE id='%9' ").arg( - player.getName()).arg( - player.getGmail()).arg( - player.getHexPass()).arg( - player.getMany()).arg( - player.getAvgRecord()).arg( - player.getRecord()).arg( - player.getLastOnline()).arg( - player.getOnlineTime()).arg( - (curSnake >= 0)? QString::number(curSnake) : "NULL").arg( - id); - - } else { - request = QString("INSERT INTO players(id, name, gmail, pass, money, avgrecord, record," - " lastOnline, onlinetime, currentsnake) VALUES " - "('%0', '%1', '%2', '%3', '%4', '%5', '%6', '%7', '%8', '%9')").arg( - id).arg( - player.getName()).arg( - player.getGmail()).arg( - player.getHexPass()).arg( - player.getMany()).arg( - player.getAvgRecord()).arg( - player.getRecord()).arg( - player.getLastOnline()).arg( - player.getOnlineTime()).arg( - (curSnake >= 0)? QString::number(curSnake) : "NULL"); - - } - - - if (curSnake < 0 && !disableFK()) { - return false; - } - - - if (!query->exec(request)) { - QuasarAppUtils::Params::verboseLog("request error : " + query->lastError().text()); - return -1; - } - - if (curSnake < 0 && !enableFK()) { - return -1; - } - - return id; -} - -int SqlDBWriter::saveItem(const Item &item) { - if (!SqlDBWriter::isValid()) { - return -1; - } - - if (!item.isValid()) { - return -1; - } - - auto type = item.cmd(); - int id = item.getId(); - - QByteArray bytes = item.dataArray(); - QString request; - - if (SqlDBWriter::checkItem(id)) { - request = QString("UPDATE items SET type='%1', data = :bytes where id = %0"). - arg(id). - arg(static_cast(type)); - } else { - request = QString("INSERT INTO items(id, type, data) VALUES" - "('%0', '%1', :bytes)"). - arg(id). - arg(static_cast(type)); - } - - if (!query->prepare(request)) { - QuasarAppUtils::Params::verboseLog("request error : " + query->lastError().text()); - return -1; - } - - query->bindValue(":bytes", bytes); - - if (!query->exec()) { - QuasarAppUtils::Params::verboseLog("request error : " + query->lastError().text()); - return -1; - } - - return id; -} - -bool SqlDBWriter::getAllItemsOfPalyer(int player, QSet &items) { - if (!SqlDBWriter::isValid()) { - return false; - } - - QString request = QString("SELECT item from owners where player='%0'").arg(player); - - if (!query->exec(request)) { - QuasarAppUtils::Params::verboseLog("request error : " + query->lastError().text()); - return false; - } - - while (query->next()) { - items.insert(query->value(0).toInt()); - } - - return true; -} - -bool SqlDBWriter::saveowners(int player, const QSet items) { - - if (!SqlDBWriter::isValid()) { - return false; - } - - QString request = QString("DELETE from owners where player='%0' "). - arg(player); - - if (!query->exec(request)) { - QuasarAppUtils::Params::verboseLog("request error : " + query->lastError().text()); - return false; - } - - if (items.isEmpty()) { - return true; - } - - request = QString("INSERT INTO owners(player, item) VALUES "); - for (int item: items) { - request.push_back("(" + QString::number(player) + "," + QString::number(item) + ")"); - } - - if (!query->exec(request)) { - QuasarAppUtils::Params::verboseLog(request); - QuasarAppUtils::Params::verboseLog("request error : " + query->lastError().text()); - return false; - } - - return true; -} - -PlayerDBData SqlDBWriter::getPlayer(int id) { - - if (!SqlDBWriter::isValid()) { - return PlayerDBData(); - } - - QString request = QString("SELECT * FROM players WHERE id=%0").arg(id); - if (!query->exec(request)) { - QuasarAppUtils::Params::verboseLog("request error : " + query->lastError().text()); - return PlayerDBData(); - } - - if (!query->next()) { - return PlayerDBData(); - } - - auto player = PlayerDBData(); - - player.setId(id); - player.setName(query->value("name").toString()); - player.setGmail(query->value("gmail").toString()); - player.fromHexPass(query->value("pass").toString()); - player.setMany(query->value("money").toUInt()); - player.setAvgRecord(query->value("avgrecord").toUInt()); - player.setRecord(query->value("record").toUInt()); - player.setLastOnline(query->value("lastOnline").toInt()); - player.setOnlineTime(query->value("onlinetime").toInt()); - player.setCureentSnake(query->value("currentsnake").toInt()); - - return player; -} - -Item SqlDBWriter::getItem(int id) { - - if (!SqlDBWriter::isValid()) { - return Item(); - } - - QString request = QString("SELECT type, data FROM items WHERE id=%0").arg(id); - if (!query->exec(request)) { - QuasarAppUtils::Params::verboseLog("request error : " + query->lastError().text()); - return Item(); - } - - if (!query->next()) { - return Item(); - } - - auto type = static_cast(query->value(0).toUInt()); - auto data = query->value(1).toByteArray(); - - return Item(type, data); -} - -bool SqlDBWriter::itemIsFreeFrom(int item) const { - if (!SqlDBWriter::isValid()) { - return false; - } - - QString request = QString("SELECT player FROM owners WHERE player=%0").arg(item); - if (!query->exec(request)) { - QuasarAppUtils::Params::verboseLog("request error : " + query->lastError().text()); - return false; - } - - return !query->next(); -} - -SqlDBWriter::SqlDBWriter() { - -} - -bool SqlDBWriter::initDb(const QString &databasePath) { - QStringList drivers = QSqlDatabase::drivers(); - db = new QSqlDatabase(); - - *db = QSqlDatabase::addDatabase("QSQLITE", QFileInfo(databasePath).fileName()); - db->setDatabaseName(QFileInfo(databasePath).absoluteFilePath()); - query = new QSqlQuery(*db); - - if (!QDir("").mkpath(QFileInfo(databasePath).absolutePath())) { - return false; - } - - if (!db->open()) { - return false; - } - - if (!exec(query, ":/sql/DB")) { - return false; - } - - initSuccessful = true; - return initSuccessful; -} - -bool SqlDBWriter::isValid() const { - if (!db) { - return false; - } - - return db->isValid() && db->isOpen() && initSuccessful; -} - -SqlDBWriter::~SqlDBWriter() { - if (db) { - delete db; - } - - if (query) { - delete query; - } -} diff --git a/SnakeServer/Server/sqldbwriter.h b/SnakeServer/Server/sqldbwriter.h deleted file mode 100644 index b87d16e..0000000 --- a/SnakeServer/Server/sqldbwriter.h +++ /dev/null @@ -1,64 +0,0 @@ -#ifndef SQLDBWRITER_H -#define SQLDBWRITER_H -#include "item.h" - -#include -#include -#include -#include - -#define DEFAULT_DB_NAME "SnakeDatabase.db" -#define DEFAULT_DB_PATH QDir::homePath() + "/SnakeServer/" + DEFAULT_DB_NAME -#define DEFAULT_UPDATE_INTERVAL 3600000 // 1 hour - -class QSqlQuery; -class QSqlDatabase; -class QSqlQuery; -class PlayerDBData; - -class SERVERSHARED_EXPORT SqlDBWriter -{ -private: - bool exec(QSqlQuery *sq, const QString &sqlFile); - - QSqlDatabase *db = nullptr; - QSqlQuery *query = nullptr; - bool initSuccessful = false; - - bool enableFK() const; - bool disableFK() const; - -protected: - int getLastIdItems(); - int getLastIdPlayers(); - - virtual int getPlayerId(const QString &gmail); - - virtual bool checkPlayer(int id); - virtual bool checkItem(int idItem, int idOwner = -1); - - virtual int savePlayer(const PlayerDBData& player); - virtual int saveItem(const Item &item); - virtual bool saveowners(int player, const QSet); - - virtual bool getAllItemsOfPalyer(int player, QSet& items); - - virtual PlayerDBData getPlayer(int id); - virtual Item getItem(int id); - - virtual bool itemIsFreeFrom(int item) const; - -public: - SqlDBWriter(); - - virtual bool initDb(const QString &path = DEFAULT_DB_PATH); - - virtual bool isValid() const; - - virtual ~SqlDBWriter(); - - friend class testSankeServer; - -}; - -#endif // SQLDBWRITER_H diff --git a/SnakeServer/Server/sqlres.qrc b/SnakeServer/Server/sqlres.qrc deleted file mode 100644 index 3c2c8cd..0000000 --- a/SnakeServer/Server/sqlres.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - sql/SnakeDB.sql - - diff --git a/SnakeServer/Server/websocketcontroller.cpp b/SnakeServer/Server/websocketcontroller.cpp deleted file mode 100644 index 0f21ddb..0000000 --- a/SnakeServer/Server/websocketcontroller.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#include "item.h" -#include "playerdbdata.h" -#include "websocketcontroller.h" -#include - -WebSocketController::WebSocketController(ClientProtocol::Server *server, QObject* obj): - QObject (obj) { - - assert( server ); - _serverDaemon = server; -} - -void WebSocketController::subscribe(quint32 address, ClientProtocol::Command cmd, int id) { - - _subscribs[static_cast(cmd)].insert(address); - - if (cmd == ClientProtocol::Command::Player || cmd == ClientProtocol::Command::GetItem) { - _subscribsObjIds[id].insert(address); - } -} - -void WebSocketController::unsubscribe(quint32 address, ClientProtocol::Command cmd, int id) { - _subscribs[static_cast(cmd)].remove(address); - - if (cmd == ClientProtocol::Command::Player || cmd == ClientProtocol::Command::GetItem) { - _subscribsObjIds[id].remove(address); - } -} - -void WebSocketController::foreachSubscribers(const Item &newData, - const QSet &subscribersList) { - for (auto &&subscriber : subscribersList) { - if (_subscribs.value(static_cast(ClientProtocol::Command::GetItem)).contains(subscriber)) { - _serverDaemon->sendResponse(newData, subscriber); - } - } -} - -void WebSocketController::foreachSubscribers(const PlayerDBData &newData, - const QSet &subscribersList){ - for (auto &&subscriber : subscribersList) { - if (_subscribs.value(static_cast(ClientProtocol::Command::GetItem)).contains(subscriber)) { - _serverDaemon->sendResponse(&newData, subscriber); - } - } -} - -void WebSocketController::handleItemChanged(int id, const Item &newData) { - - foreachSubscribers(newData, _subscribsObjIds.value(id)); - foreachSubscribers(newData, _subscribsObjIds.value(-1)); -} - -void WebSocketController::handlePlayerChanged(int id, const PlayerDBData &newData) { - foreachSubscribers(newData, _subscribsObjIds.value(id)); - foreachSubscribers(newData, _subscribsObjIds.value(-1)); -} diff --git a/SnakeServer/Server/websocketcontroller.h b/SnakeServer/Server/websocketcontroller.h deleted file mode 100644 index e354355..0000000 --- a/SnakeServer/Server/websocketcontroller.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef WEBSOCKETCONTROLLER_H -#define WEBSOCKETCONTROLLER_H -#include -#include -#include -#include - -class Item; -class PlayerDBData; - -namespace ClientProtocol { - class Server; -} - -template -using MultiHash = QHash>; - -class WebSocketController: public QObject -{ - Q_OBJECT -private: - MultiHash _subscribs; - MultiHash _subscribsObjIds; - - ClientProtocol::Server *_serverDaemon = nullptr; - - void foreachSubscribers(const Item &newData, const QSet &subscribersList); - void foreachSubscribers(const PlayerDBData &newData, const QSet &subscribersList); - -public: - WebSocketController(ClientProtocol::Server * server, QObject* obj = nullptr); - void subscribe(quint32 address, ClientProtocol::Command cmd, int id); - void unsubscribe(quint32 address, ClientProtocol::Command cmd, int id); -public slots: - void handleItemChanged(int id, const Item& newData); - void handlePlayerChanged(int id, const PlayerDBData& newData); - -}; - -#endif // WEBSOCKETCONTROLLER_H diff --git a/SnakeServer/ServerProtocol/ServerProtocol.pri b/SnakeServer/ServerProtocol/ServerProtocol.pri deleted file mode 100644 index e0e8fb6..0000000 --- a/SnakeServer/ServerProtocol/ServerProtocol.pri +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (C) 2018 - 2019 QuasarApp. -# Distributed under the lgplv3 software license, see the accompanying -# Everyone is permitted to copy and distribute verbatim copies -# of this license document, but changing it is not allowed. -# - -!isEmpty(SERVERPROTOCOL_LIB):error("ServerProtocol.pri already included") -SERVERPROTOCOL_LIB = 1 - -#DEPENDS -CONFIG(release, debug|release): { - SERVERPROTOCOL_LIB_OUTPUT_DIR="$$PWD/build/release" -} else { - SERVERPROTOCOL_LIB_OUTPUT_DIR="$$PWD/build/debug" -} - -LIBS += -L$$SERVERPROTOCOL_LIB_OUTPUT_DIR -lServerProtocol - -INCLUDEPATH += "$$PWD/" - - - diff --git a/SnakeServer/ServerProtocol/ServerProtocol.pro b/SnakeServer/ServerProtocol/ServerProtocol.pro deleted file mode 100644 index 1da1053..0000000 --- a/SnakeServer/ServerProtocol/ServerProtocol.pro +++ /dev/null @@ -1,52 +0,0 @@ -#------------------------------------------------- -# -# Project created by QtCreator 2019-01-02T12:44:05 -# -#------------------------------------------------- - -QT -= gui -QT += network -TARGET = ServerProtocol -TEMPLATE = lib - -DEFINES += SERVERPROTOCOL_LIBRARY - -# The following define makes your compiler emit warnings if you use -# any feature of Qt which has been marked as deprecated (the exact warnings -# depend on your compiler). Please consult the documentation of the -# deprecated API in order to know how to port your code away from it. -DEFINES += QT_DEPRECATED_WARNINGS - -# You can also make your code fail to compile if you use deprecated APIs. -# In order to do so, uncomment the following line. -# You can also select to disable deprecated APIs only up to a certain version of Qt. -#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 - - -CONFIG(release, debug|release): { - DESTDIR = $$PWD/build/release - -} else { - DESTDIR = $$PWD/build/debug -} - -include($$PWD/../../QuasarAppLib/QuasarLib.pri) - -DISTFILES += \ - ServerProtocol.pri - -SOURCES += \ - serverutils.cpp \ - serverprotocol.cpp \ - server.cpp \ - client.cpp - -HEADERS += \ - serverprotocol.h \ - serverprotocol_global.h \ - serverutils.h \ - server.h \ - client.h \ - sp.h \ - spserver.h - diff --git a/SnakeServer/ServerProtocol/client.cpp b/SnakeServer/ServerProtocol/client.cpp deleted file mode 100644 index f08124d..0000000 --- a/SnakeServer/ServerProtocol/client.cpp +++ /dev/null @@ -1,193 +0,0 @@ -#include "client.h" -#include "serverprotocol.h" - -#include -#include -#include -#include -#include -#include - -namespace ServerProtocol { - -void Client::incommingData() { - auto array = _destination->readAll(); - - if (_downloadPackage.hdr.isValid()) { - _downloadPackage.data.append(array); - - } else { - memcpy(&_downloadPackage.hdr, - array.data(), sizeof(Header)); - _downloadPackage.data.append(array.mid(sizeof(Header))); - } - - if (_downloadPackage.isValid()) { - emit sigIncommingData(_downloadPackage.parse()); - _downloadPackage.reset(); - received = true; - return; - } -} - -Client::Client(const QString& server, QObject *ptr): - QObject (ptr) { - - _destination = new QLocalSocket(this); - - _destination->connectToServer(server); - - connect(_destination, &QLocalSocket::readyRead, - this, &Client::incommingData); - -} - -bool Client::sendPackage(const Package &pkg) { - if (!pkg.isValid()) { - return false; - } - - if (!_destination->isValid()) { - qCritical() << "destination server not valid!"; - return false; - } - - if (!_destination->waitForConnected()) { - qCritical() << "no connected to server! " << _destination->errorString(); - return false; - } - - auto bytes = pkg.toBytes(); - - return bytes.size() == _destination->write(bytes); -} - -bool Client::ping() { - ServerProtocol::Package pkg; - pkg.hdr.command = ServerProtocol::Ping; - pkg.hdr.type = ServerProtocol::Request; - - return sendPackage(pkg); -} - -bool Client::getState() { - - ServerProtocol::Package pkg; - pkg.hdr.command = ServerProtocol::State; - pkg.hdr.type = ServerProtocol::Request; - - return sendPackage(pkg); -} - -bool Client::ban(const QHostAddress &address) { - - ServerProtocol::Package pkg; - pkg.hdr.command = ServerProtocol::Ban; - pkg.hdr.type = ServerProtocol::Request; - - if (address.isNull()) - return false; - - QVariantMap map; - map["address"] = address.toIPv4Address(); - - pkg.fromMap(map); - - return sendPackage(pkg); -} - -bool Client::unBan(const QHostAddress &address) { - - if (address.isNull()) - return false; - - ServerProtocol::Package pkg; - pkg.hdr.command = ServerProtocol::Unban; - pkg.hdr.type = ServerProtocol::Request; - - QVariantMap map; - map["address"] = address.toIPv4Address(); - - pkg.fromMap(map); - - return sendPackage(pkg); -} - -bool Client::restart(const QString &address, unsigned short port) { - - QHostAddress test(address); - - if (test.isNull() || port == 0) { - return false; - } - - ServerProtocol::Package pkg; - pkg.hdr.command = ServerProtocol::Restart; - pkg.hdr.type = ServerProtocol::Request; - - QVariantMap map; - map["address"] = address; - map["port"] = port; - pkg.fromMap(map); - - return sendPackage(pkg); -} - -bool Client::start(const QString &address, unsigned short port) { - QHostAddress test(address); - - QStringList params = {"daemon"}; - - if (!test.isNull()) { - params.push_back("-address"); - params.push_back(address); - - } - - if (port > 0) { - params.push_back("-port"); - params.push_back(QString::number(port)); - } - - QProcess p; - QProcessEnvironment env; - - p.setProcessEnvironment(env); - p.start("snake-d", params); - - if (p.waitForFinished(1000) && p.exitCode() == 0) { - emit sigIncommingData({{"Res", "server started"}}); - } else { - emit sigIncommingData({{"Res", "server started fail " + p.readAll()}}); - } - - return true; -} - -bool Client::stop() { - - ServerProtocol::Package pkg; - pkg.hdr.command = ServerProtocol::Stop; - pkg.hdr.type = ServerProtocol::Request; - - QVariantMap map; - pkg.fromMap(map); - - return sendPackage(pkg); -} - -bool Client::wait(bool & forWait, int msec) { - auto curmsec = QDateTime::currentMSecsSinceEpoch() + msec; - while (curmsec > QDateTime::currentMSecsSinceEpoch() && !forWait) { - QCoreApplication::processEvents(); - } - QCoreApplication::processEvents(); - return forWait; -} - -bool Client::wait(int msec) -{ - received = false; - return wait(received, msec); -} -} diff --git a/SnakeServer/ServerProtocol/client.h b/SnakeServer/ServerProtocol/client.h deleted file mode 100644 index da11278..0000000 --- a/SnakeServer/ServerProtocol/client.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef CLIENT_SP_H -#define CLIENT_SP_H -#include "serverprotocol.h" -#include "serverprotocol_global.h" -#include -#include - -class QLocalSocket; - -namespace ServerProtocol { - -class SERVERPROTOCOLSHARED_EXPORT Client : public QObject -{ - Q_OBJECT -private: - QLocalSocket *_destination; - Package _downloadPackage; - bool received = false; - - bool sendPackage(const Package& pkg); - -private slots: - void incommingData(); - -public: - explicit Client(const QString &server = DEFAULT_SERVER, QObject * ptr = nullptr); - bool ping(); - bool getState(); - bool ban(const QHostAddress& address); - bool unBan(const QHostAddress& address); - bool restart(const QString &address, unsigned short port); - bool start(const QString &address, unsigned short port); - bool stop(); - bool wait(bool &forWait, int msec = 10000); - bool wait(int msec = 10000); - - -signals: - void sigIncommingData(const QVariantMap& map); -}; - -} - - -#endif // CLIENT_SP_H diff --git a/SnakeServer/ServerProtocol/server.cpp b/SnakeServer/ServerProtocol/server.cpp deleted file mode 100644 index d0c582e..0000000 --- a/SnakeServer/ServerProtocol/server.cpp +++ /dev/null @@ -1,152 +0,0 @@ -#include "server.h" -#include -#include -#include -#include -#include -#include - -#include "serverutils.h" -#include "serverprotocol.h" -#include "server.h" - - -namespace ServerProtocol { - -void Server::parsePackage(const Package& pkg) { - if (!pkg.isValid()) { - return; - } - - - switch (pkg.hdr.command) { - case Ping: { - - if (pkg.hdr.type != Request) { - return; - } - - Package resp; - resp.hdr.command = Ping; - resp.hdr.type = Responke; - - QVariantMap data; - data["res"] = "Pong"; - resp.fromMap(data); - - if (!sendPackage(resp)) { - QuasarAppUtils::Params::verboseLog("!responce not sendet!"); - } - - break; - } - - default: { - QVariantMap res; - QDataStream stream(pkg.data); - stream >> res; - res["command"] = pkg.hdr.command; - emit incomingRequest(res); - }; - } -} - -bool Server::sendPackage(Package &pkg) { - if (!pkg.isValid()) { - return false; - } - - if (!_client->isValid()) { - qCritical() << "destination server not valid!"; - return false; - } - - if (!_client->waitForConnected()) { - qCritical() << "no connected to server! " << _client->errorString(); - return false; - } - - auto bytes = pkg.toBytes(); - bool sendet = bytes.size() == _client->write(bytes); - - return sendet; -} - - -void Server::avelableBytes() { - auto array = _client->readAll(); - - if (_downloadPackage.hdr.isValid()) { - _downloadPackage.data.append(array); - - } else { - memcpy(&_downloadPackage.hdr, - array.data(), sizeof(Header)); - _downloadPackage.data.append(array.mid(sizeof(Header))); - } - - if (_downloadPackage.isValid()) { - parsePackage(_downloadPackage); - _downloadPackage.reset(); - return; - } -} - -void Server::incomingConnection(quintptr socketDescriptor) { - _client->setSocketDescriptor(static_cast(socketDescriptor)); - - if (!_client->isValid()) { - QuasarAppUtils::Params::verboseLog("incomingConnection not valid!"); - return; - } - - if (!_client->isOpen() && !_client->open()) { - QuasarAppUtils::Params::verboseLog("incomingConnection not opened!"); - return; - } -} - -Server::Server(QObject *ptr): - QLocalServer (ptr) -{ - _client = new QLocalSocket(this); - - connect(_client, &QLocalSocket::readyRead, - this, &Server::avelableBytes); -} - -Server::~Server() { - close(); -} - -bool Server::run(const QString &name, bool force) { - - if (force) { - QFile::remove("/tmp/" + name); - } - - if (!listen(name)) { - QuasarAppUtils::Params::verboseLog("listing fail " + this->errorString()); - return false; - } - - return true; -} - -bool Server::sendResponce(QVariantMap res, Command command) { - - Package pck; - - pck.hdr.type = ServerProtocol::Responke; - pck.hdr.command = static_cast(command); - - if (res.isEmpty()) { - res["Error"] = "command not supported!"; - } - - pck.fromMap(res); - pck.hdr.size = static_cast(pck.data.size()); - - return sendPackage(pck); -} -} diff --git a/SnakeServer/ServerProtocol/server.h b/SnakeServer/ServerProtocol/server.h deleted file mode 100644 index bbe1bd1..0000000 --- a/SnakeServer/ServerProtocol/server.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef SERVER_SP_H -#define SERVER_SP_H -#include "serverprotocol.h" -#include "serverprotocol_global.h" -#include - -class QLocalSocket; -namespace ServerProtocol { - -class SERVERPROTOCOLSHARED_EXPORT Server: public QLocalServer -{ - Q_OBJECT -private: - QLocalSocket *_client; - Package _downloadPackage; - - void parsePackage(const Package &pkg); - -private slots: - void avelableBytes(); - -protected: - void incomingConnection(quintptr socketDescriptor) override; -public: - explicit Server(QObject * ptr = nullptr); - ~Server() override; - bool run(const QString& name, bool force = false); - bool sendResponce(QVariantMap res, Command command); - - bool sendPackage(Package &pkg); -signals: - void incomingRequest(QVariantMap data); -}; -} -#endif // SERVER_SP_H diff --git a/SnakeServer/ServerProtocol/serverprotocol.cpp b/SnakeServer/ServerProtocol/serverprotocol.cpp deleted file mode 100644 index cf69a1b..0000000 --- a/SnakeServer/ServerProtocol/serverprotocol.cpp +++ /dev/null @@ -1,88 +0,0 @@ -#include "serverprotocol.h" - -#include -#include -#include - - -ServerProtocol::Header::Header() { - reset(); -} - -bool ServerProtocol::Header::isValid() const { - - if (sizeof (*this) != 2) { - return false; - } - - if (type == Type::Request) { - return size < 256; - } - - return size >= 5; -} - -void ServerProtocol::Header::reset() { - size = 0; - command = Undefined; - type = Responke; -} - -ServerProtocol::Package::Package() { - reset(); -} - -bool ServerProtocol::Package::isValid() const { - if (!hdr.isValid()) { - return false; - } - - return hdr.size == data.size(); -} - -QVariantMap ServerProtocol::Package::parse() const { - if (!isValid()) - return QVariantMap(); - - QVariantMap res; - QDataStream stream(data); - - res["command"] = hdr.command; - res["type"] = hdr.type; - - if (hdr.type == Responke) { - stream >> res; - } - - return res; -} - -QByteArray ServerProtocol::Package::toBytes() const { - QByteArray res; - res.append(reinterpret_cast(const_cast(&hdr)), - sizeof (hdr)); - - res.append(data); - return res; -} - -void ServerProtocol::Package::reset() { - hdr.reset(); - data.clear(); -} - -bool ServerProtocol::Package::fromMap(const QVariantMap &map) { - QDataStream stream(&data, QIODevice::ReadWrite); - - stream << map; - - if (data.size() > 1024) { - return false; - } - - hdr.size = static_cast(data.size()); - - return true; - -} - diff --git a/SnakeServer/ServerProtocol/serverprotocol.h b/SnakeServer/ServerProtocol/serverprotocol.h deleted file mode 100644 index 2c0db44..0000000 --- a/SnakeServer/ServerProtocol/serverprotocol.h +++ /dev/null @@ -1,106 +0,0 @@ -#ifndef SERVERPROTOCOL_H -#define SERVERPROTOCOL_H - -#include "serverprotocol_global.h" - -#include - -#define DEFAULT_SERVER "SnnakeServer" - -namespace ServerProtocol { - -enum Type: unsigned char { - Responke = 0, - Request = 1 -}; - -enum Command: unsigned char { - Undefined = 0x00, - Ping = 0x01, - State = 0x02, - Stop = 0x03, - Restart = 0x04, - Unban = 0x05, - Ban = 0x06 -}; - -/** - * @brief The Header struct 2 byte - */ -struct SERVERPROTOCOLSHARED_EXPORT Header { - /** - * @brief size - size of package data (not header) - */ - unsigned short size: 10; - /** - * @brief type of package see Type - */ - unsigned char type: 1; - /** - * @brief command of pacage see Command - */ - unsigned char command: 5; - - /** - * @brief Header default constructor - */ - Header(); - - /** - * @brief isValid - * @return true if header is valid - */ - bool isValid() const; - - - /** - * @brief reset - reset all data and set for header invalid status - */ - void reset(); -}; - -/** - * @brief The Package struct - */ -struct SERVERPROTOCOLSHARED_EXPORT Package { - /** - * @brief hdr - header of package - */ - Header hdr; - /** - * @brief data - source data of package - */ - QByteArray data; - - Package(); - - /** - * @brief isValid - * @return true if package is valid - */ - bool isValid() const; - - /** - * @brief parse - * @return Qmap of package (default key if "value") - */ - QVariantMap parse() const; - - /** - * @brief toBytes - * @return bytes array of packag - */ - QByteArray toBytes() const; - - /** - * @brief reset - reset all data and set for package invalid status - */ - void reset(); - - bool fromMap(const QVariantMap& map); - -}; - -} - -#endif // SERVERPROTOCOL_H diff --git a/SnakeServer/ServerProtocol/serverprotocol_global.h b/SnakeServer/ServerProtocol/serverprotocol_global.h deleted file mode 100644 index 2bbe388..0000000 --- a/SnakeServer/ServerProtocol/serverprotocol_global.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef SERVERPROTOCOL_GLOBAL_H -#define SERVERPROTOCOL_GLOBAL_H - -#include - -#if defined(SERVERPROTOCOL_LIBRARY) -# define SERVERPROTOCOLSHARED_EXPORT Q_DECL_EXPORT -#else -# define SERVERPROTOCOLSHARED_EXPORT Q_DECL_IMPORT -#endif - -#endif // SERVERPROTOCOL_GLOBAL_H diff --git a/SnakeServer/ServerProtocol/serverutils.cpp b/SnakeServer/ServerProtocol/serverutils.cpp deleted file mode 100644 index 19ff40f..0000000 --- a/SnakeServer/ServerProtocol/serverutils.cpp +++ /dev/null @@ -1,75 +0,0 @@ -#include "serverutils.h" -#include -#include -#include - -ServerUtils::ServerUtils() { - -} - -void ServerUtils::helpDaemon() { - - QStringList help = - {{ ""}, - { "Usage: SnakeServer-daemon.sh <[params]> "}, - { ""}, - { "Options:"}, - { " help / h : show help."}, - { " daemon / d : start like daemon."}, - { " -port (port) : start with custom port."}, - { " -address (address) : start with custom address."}, - { " -db (path/to/db.file) : start with custom db"}, - { ""}, - { "General Options:"}}; - - help.append(QuasarAppUtils::Params::getparamsHelp()); - QuasarAppUtils::Params::showHelp(help); - -} - -void ServerUtils::helpClient() { - - QStringList help = - {{ ""}, - { "Usage: Terminal.sh <[params]> "}, - { ""}, - { "Options:"}, - { " help / h : show help."}, - { " ping : debug commnad"}, - { " state : show information about deamon"}, - { " stop : stop server deamon"}, - { " -ban (address) : ban user with address"}, - { " -unban (address) : unban user with address"}, - { " -restart (address:port) : restarrt server deamon with new address and port"}, - { " -start (address:port) : start server deamon with custom address"}, - { " start : start server deamon with default address"}, - { ""}, - { "General Options:"},}; - - help.append(QuasarAppUtils::Params::getparamsHelp()); - QuasarAppUtils::Params::showHelp(help); -} - -bool ServerUtils::runDaemon() { - -#ifdef Q_OS_UNIX - if (QuasarAppUtils::Params::isEndable("daemon") || - QuasarAppUtils::Params::isEndable("d")) { - - int pid = fork(); - if (pid != 0) { - return true; - } - } - -#endif - return false; -} - -bool ServerUtils::parseParams(int argc, char *argv[]) { - if ( !QuasarAppUtils::Params::parseParams(argc, const_cast(argv))) { - return false; - } - - return true; -} diff --git a/SnakeServer/ServerProtocol/serverutils.h b/SnakeServer/ServerProtocol/serverutils.h deleted file mode 100644 index 93d56b1..0000000 --- a/SnakeServer/ServerProtocol/serverutils.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef SERVERUTILS_H -#define SERVERUTILS_H -#include "serverprotocol_global.h" - - -class SERVERPROTOCOLSHARED_EXPORT ServerUtils -{ -public: - - ServerUtils(); - static void helpDaemon(); - static void helpClient(); - /** - * @brief runDaemon - * @return true if app running like a daemon - */ - static bool runDaemon(); - static bool parseParams(int argc, char *argv[]); -}; - -#endif // SERVERUTILS_H diff --git a/SnakeServer/ServerProtocol/sp.h b/SnakeServer/ServerProtocol/sp.h deleted file mode 100644 index f01b74d..0000000 --- a/SnakeServer/ServerProtocol/sp.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef SP_H -#define SP_H - -#include "server.h" -#include "client.h" - -#endif // SP_H diff --git a/SnakeServer/ServerProtocol/spserver.h b/SnakeServer/ServerProtocol/spserver.h deleted file mode 100644 index 28fdc19..0000000 --- a/SnakeServer/ServerProtocol/spserver.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef SPSERVER_H -#define SPSERVER_H - -#include "server.h" - -#endif // SPSERVER_H diff --git a/SnakeServer/SnakeServer.pro b/SnakeServer/SnakeServer.pro deleted file mode 100644 index bdc7db7..0000000 --- a/SnakeServer/SnakeServer.pro +++ /dev/null @@ -1,12 +0,0 @@ - -TEMPLATE = subdirs -CONFIG += ordered - -SUBDIRS += \ - ServerProtocol \ - Qt-Secret \ - ClientProtocol \ - Terminal \ - Server \ - Daemon \ - serverProtocolTests \ diff --git a/SnakeServer/Terminal/Terminal.pro b/SnakeServer/Terminal/Terminal.pro deleted file mode 100644 index 37e2b3d..0000000 --- a/SnakeServer/Terminal/Terminal.pro +++ /dev/null @@ -1,31 +0,0 @@ -QT -= gui -QT += network - -CONFIG += c++14 console -CONFIG -= app_bundle - -# The following define makes your compiler emit warnings if you use -# any Qt feature that has been marked deprecated (the exact warnings -# depend on your compiler). Please consult the documentation of the -# deprecated API in order to know how to port your code away from it. -DEFINES += QT_DEPRECATED_WARNINGS - -# You can also make your code fail to compile if it uses deprecated APIs. -# In order to do so, uncomment the following line. -# You can also select to disable deprecated APIs only up to a certain version of Qt. -#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 - -SOURCES += \ - main.cpp - - -CONFIG(release, debug|release): { - DESTDIR = $$PWD/build/release - -} else { - DESTDIR = $$PWD/build/debug -} - -include($$PWD/../../QuasarAppLib/QuasarLib.pri) -include($$PWD/../ServerProtocol/ServerProtocol.pri) - diff --git a/SnakeServer/Terminal/main.cpp b/SnakeServer/Terminal/main.cpp deleted file mode 100644 index 3344fee..0000000 --- a/SnakeServer/Terminal/main.cpp +++ /dev/null @@ -1,99 +0,0 @@ -#include -#include -#include -#include -#include -#include - -void handleResponcke(const QVariantMap &data) { - for(auto iter = data.begin(); iter != data.end(); ++iter) { - qInfo() << QString("%0: %1").arg( iter.key()).arg(iter.value().toString()); - } - - QCoreApplication::exit(0); -} - -int main(int argc, char *argv[]) -{ - QCoreApplication a(argc, argv); - - QuasarAppUtils::Params::parseParams(argc, const_cast(argv)); - - ServerProtocol::Client cli; - - QObject::connect(&cli, &ServerProtocol::Client::sigIncommingData, - &handleResponcke); - - if (QuasarAppUtils::Params::isEndable("ping")) { - - if (!cli.ping()) { - qCritical() << "command not sendet!"; - return 1; - } - - } else if (QuasarAppUtils::Params::isEndable("help") || - QuasarAppUtils::Params::isEndable("h")) { - - ServerUtils::helpClient(); - return 0; - - } else if (QuasarAppUtils::Params::isEndable("state")) { - - if (!cli.getState()) { - qCritical() << "command not sendet!"; - return 1; - }; - - } else if (QuasarAppUtils::Params::isEndable("ban")) { - - auto address = QuasarAppUtils::Params::getStrArg("ban"); - - if (!cli.ban(QHostAddress(address))) { - qCritical() << "command not sendet!"; - return 1; - } - - } else if (QuasarAppUtils::Params::isEndable("unban")) { - - auto address = QuasarAppUtils::Params::getStrArg("unban"); - if (!cli.unBan(QHostAddress(address))) { - qCritical() << "command not sendet!"; - return 1; - } - - } else if (QuasarAppUtils::Params::isEndable("restart")) { - - QStringList address = QuasarAppUtils::Params::getStrArg("restart").split(":"); - if (!cli.restart(address.value(0), address.value(1).toUShort())) { - qCritical() << "command not sendet!"; - return 1; - } - } else if (QuasarAppUtils::Params::isEndable("stop")) { - - if (!cli.stop()) { - qCritical() << "command not sendet!"; - return 1; - } - } else if (QuasarAppUtils::Params::isEndable("start")) { - - QStringList params = QuasarAppUtils::Params::getStrArg("start").split(":"); - - if (!cli.start(params.value(0), params.value(1).toUShort())) { - qCritical() << "Server not started!"; - return 1; - } - - return 0; - } - else { - ServerUtils::helpClient(); - return 0; - } - - QTimer::singleShot(3000, [&a] { - qCritical() << "server not responsed !"; - a.exit(1); - }); - - return a.exec(); -} diff --git a/SnakeServer/serverProtocolTests/.gitignore b/SnakeServer/serverProtocolTests/.gitignore deleted file mode 100644 index fab7372..0000000 --- a/SnakeServer/serverProtocolTests/.gitignore +++ /dev/null @@ -1,73 +0,0 @@ -# This file is used to ignore files which are generated -# ---------------------------------------------------------------------------- - -*~ -*.autosave -*.a -*.core -*.moc -*.o -*.obj -*.orig -*.rej -*.so -*.so.* -*_pch.h.cpp -*_resource.rc -*.qm -.#* -*.*# -core -!core/ -tags -.DS_Store -.directory -*.debug -Makefile* -*.prl -*.app -moc_*.cpp -ui_*.h -qrc_*.cpp -Thumbs.db -*.res -*.rc -/.qmake.cache -/.qmake.stash - -# qtcreator generated files -*.pro.user* - -# xemacs temporary files -*.flc - -# Vim temporary files -.*.swp - -# Visual Studio generated files -*.ib_pdb_index -*.idb -*.ilk -*.pdb -*.sln -*.suo -*.vcproj -*vcproj.*.*.user -*.ncb -*.sdf -*.opensdf -*.vcxproj -*vcxproj.* - -# MinGW generated files -*.Debug -*.Release - -# Python byte code -*.pyc - -# Binaries -# -------- -*.dll -*.exe - diff --git a/SnakeServer/serverProtocolTests/serverProtocolTests.pro b/SnakeServer/serverProtocolTests/serverProtocolTests.pro deleted file mode 100644 index ca46eaa..0000000 --- a/SnakeServer/serverProtocolTests/serverProtocolTests.pro +++ /dev/null @@ -1,39 +0,0 @@ -QT += testlib network sql -QT -= gui - -CONFIG += qt console warn_on depend_includepath testcase -CONFIG -= app_bundle - -TEMPLATE = app - -TARGET = serverTests - -SOURCES += \ - testutils.cpp \ - tst_testsnakeserver.cpp - -CONFIG(release, debug|release): { - DESTDIR = $$PWD/build/release - -} else { - DESTDIR = $$PWD/build/debug -} - -include($$PWD/../../QuasarAppLib/QuasarLib.pri) -include($$PWD/../ServerProtocol/ServerProtocol.pri) -include($$PWD/../ClientProtocol/ClientProtocol.pri) -include($$PWD/../../SnakeUtils/SnakeUtils.pri) -include($$PWD/../../SnakeServer/Server/Server.pri) - - -HEADERS += \ - testutils.h - -deployTest.commands = cqtdeployer -bin $$DESTDIR clear -qmake $$QMAKE_QMAKE -targetDir $$PWD/deployTests -libDir $$PWD/../../ -recursiveDepth 5 - -test.depends = deployTest -test.commands = $$PWD/deployTests/serverTests.sh - -QMAKE_EXTRA_TARGETS += \ - deployTest \ - test diff --git a/SnakeServer/serverProtocolTests/testutils.cpp b/SnakeServer/serverProtocolTests/testutils.cpp deleted file mode 100644 index 060328e..0000000 --- a/SnakeServer/serverProtocolTests/testutils.cpp +++ /dev/null @@ -1,141 +0,0 @@ -#include "testutils.h" - -#include -#include -#include - -auto terminalFuncPrivate(std::function func, - ServerProtocol::Client& cli, QVariantMap* resMap = nullptr) { - bool isWork = false; - bool received = false; - - QMetaObject::Connection m_connection; - - m_connection = QObject::connect(&cli, &ServerProtocol::Client::sigIncommingData, - [&isWork, &received, &m_connection, resMap] (const QVariantMap& map) { - - isWork = !map.contains("Error"); - received = true; - - if (resMap) - *resMap = map; - - QObject::disconnect(m_connection); - }); - - - if (!func()) { - return false; - } - - if (!cli.wait(received, 1000)) { - return false; - } - - return isWork; -} - -bool clientFuncPrivate(std::function requestFunc, - ClientProtocol::Client& cli, - ClientProtocol::Command* responceCmd = nullptr, - QByteArray* responceArray = nullptr) { - - bool received = false; - QMetaObject::Connection m_connection; - m_connection = QObject::connect(&cli, &ClientProtocol::Client::sigIncommingData, - [ &received, &m_connection, responceCmd, responceArray] - (const ClientProtocol::Command cmd, - const QByteArray& data) { - - received = true; - - if (responceCmd) { - *responceCmd = cmd; - } - - if (responceArray) { - *responceArray = data; - } - - QObject::disconnect(m_connection); - - - }); - - if (!requestFunc()) { - return false; - } - - return TestUtils::wait(received, 1000); -} - -TestUtils::TestUtils() -{ - -} - -bool TestUtils::wait(const bool &forWait, int msec) { - auto curmsec = QDateTime::currentMSecsSinceEpoch() + msec; - while (curmsec > QDateTime::currentMSecsSinceEpoch() && !forWait) { - QCoreApplication::processEvents(); - } - QCoreApplication::processEvents(); - return forWait; -} - - -bool TestUtils::loginFunc( - ClientProtocol::Client &cli, - const QString& login, - const QByteArray& pass, - bool sendResult, - bool loginResult) { - - auto wraper = [&cli, login, pass](){return cli.login(login, pass);}; - bool result = clientFuncPrivate(wraper, cli); - - if (!result) { - return !sendResult; - } - - return loginResult == cli.isLogin(); -} - -bool TestUtils::registerFunc( - ClientProtocol::Client &cli, - const QString& login, - const QByteArray& pass, - bool sendResult, - bool loginResult) { - - auto wraper = [&cli, login, pass](){return cli.registration(login, pass);}; - bool result = clientFuncPrivate(wraper, cli); - - if (!result) { - return !sendResult; - } - - return loginResult == cli.isLogin(); -} - - -bool TestUtils::getState( ServerProtocol::Client& cli, QVariantMap &state) { - auto wraper = [&cli](){return cli.getState();}; - return terminalFuncPrivate(wraper, cli, &state); -} - -bool TestUtils::unBanFunc( ServerProtocol::Client& cli, const QHostAddress& address) { - auto wraper = [&cli, address](){return cli.unBan(address);}; - return terminalFuncPrivate(wraper, cli); -} - - -bool TestUtils::banFunc( ServerProtocol::Client& cli, const QHostAddress& address) { - auto wraper = [&cli, address](){return cli.ban(address);}; - return terminalFuncPrivate(wraper, cli); -} - -bool TestUtils::reconnectFunc(ClientProtocol::Client &cli) { - cli.reconnectToHost(); - return wait(cli.isOnline(), 1000); -} diff --git a/SnakeServer/serverProtocolTests/testutils.h b/SnakeServer/serverProtocolTests/testutils.h deleted file mode 100644 index a334a20..0000000 --- a/SnakeServer/serverProtocolTests/testutils.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef TESTUTILS_H -#define TESTUTILS_H - -#include -#include - -class TestUtils -{ -public: - TestUtils(); - static bool wait(const bool &forWait, int msec); - static bool loginFunc(ClientProtocol::Client &cli, - const QString &login, - const QByteArray &pass, - bool sendResult, - bool loginResult); - static bool getState(ServerProtocol::Client &cli, QVariantMap &state); - static bool unBanFunc(ServerProtocol::Client &cli, const QHostAddress &address); - static bool banFunc(ServerProtocol::Client &cli, const QHostAddress &address); - static bool reconnectFunc(ClientProtocol::Client &cli); - static bool registerFunc(ClientProtocol::Client &cli, const QString &login, - const QByteArray &pass, bool sendResult, bool loginResult); -}; - -#endif // TESTUTILS_H diff --git a/SnakeServer/serverProtocolTests/tst_testsnakeserver.cpp b/SnakeServer/serverProtocolTests/tst_testsnakeserver.cpp deleted file mode 100644 index 3096733..0000000 --- a/SnakeServer/serverProtocolTests/tst_testsnakeserver.cpp +++ /dev/null @@ -1,621 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "factorynetobjects.h" -#include "testutils.h" - -// add necessary includes here - -#define TEST_LOCAL_SERVER QString(DEFAULT_SERVER) + "Test" -#define TEST_SERVER_ADDRESS LOCAL_SNAKE_SERVER -#define TEST_SERVER_PORT 27777 - -class testSankeServer : public QObject -{ - Q_OBJECT - -private: - void testPingServerProtockol(ServerProtocol::Client &cli); - void testStateServerProtockol(ServerProtocol::Client &cli); - void testBanServerProtockol(ServerProtocol::Client& cli); - void testUnBanServerProtockol(ServerProtocol::Client& cli); - void testRestartServerProtockol(ServerProtocol::Client& cli); - void testStopServerProtockol(ServerProtocol::Client& cli); - - void testPingClientProtockol(ClientProtocol::Client& cli); - void testLogin(ClientProtocol::Client& cli); - void testUserData(ClientProtocol::Client& cli); - void testGetItem(ClientProtocol::Client& cli); - void testApplyData(ClientProtocol::Client& cli); - void testWebSockets(ClientProtocol::Client& cli); - void testBanLogin(ClientProtocol::Client &cli, ServerProtocol::Client &term); - - void testBaseSql(); - void testSqlCache(); - -public: - testSankeServer(); - - ~testSankeServer(); - -private slots: - void initTestCase(); - void clianupTestCase(); - - void testProtockols(); -// void testClientProtockol(); - void testSql(); - - -}; - -testSankeServer::testSankeServer() { - QuasarAppUtils::Params::setArg("verbose", 3); - -} - -testSankeServer::~testSankeServer() { - -} - -void testSankeServer::initTestCase() { - ClientProtocol::initClientProtockol(); -} - -void testSankeServer::clianupTestCase() { - -} - -void testSankeServer::testPingServerProtockol(ServerProtocol::Client &cli) { - - - bool isWork = false; - bool received = false; - - QMetaObject::Connection m_connection; - - m_connection = QObject::connect(&cli, &ServerProtocol::Client::sigIncommingData, - [&isWork, &received, &m_connection] (const QVariantMap& map) { - - isWork = map["res"].toString() == "Pong"; - disconnect(m_connection); - received = true; - - - }); - - QVERIFY(cli.ping()); - - QVERIFY(cli.wait(received, 1000)); - - QVERIFY(isWork); - -} - -void testSankeServer::testStateServerProtockol(ServerProtocol::Client& cli) { - QVariantMap map; - QVERIFY(TestUtils::getState(cli, map)); - -} - -void testSankeServer::testBanServerProtockol(ServerProtocol::Client& cli) { - - bool isWork = false; - bool received = false; - - QMetaObject::Connection m_connection; - - m_connection = QObject::connect(&cli, &ServerProtocol::Client::sigIncommingData, - [&isWork, &received, &m_connection] (const QVariantMap& map) { - - isWork = !map.contains("Error"); - received = true; - disconnect(m_connection); - }); - - QVERIFY(!cli.ban(QHostAddress())); - - QVERIFY(cli.ban(QHostAddress("192.192.192.192"))); - QVERIFY(cli.wait(received, 1000)); - - QVERIFY(isWork); - -} - -void testSankeServer::testUnBanServerProtockol(ServerProtocol::Client& cli) -{ - - bool isWork = false; - bool received = false; - - QMetaObject::Connection m_connection; - - m_connection = QObject::connect(&cli, &ServerProtocol::Client::sigIncommingData, - [&isWork, &received, &m_connection] (const QVariantMap& map) { - - isWork = !map.contains("Error"); - received = true; - disconnect(m_connection); - - }); - - QVERIFY(!cli.unBan(QHostAddress())); - - QVERIFY(cli.unBan(QHostAddress("192.192.192.192"))); - QVERIFY(cli.wait(received, 1000)); - - QVERIFY(isWork); - -} - -void testSankeServer::testRestartServerProtockol(ServerProtocol::Client& cli) { - - bool isWork = false; - bool received = false; - - QMetaObject::Connection m_connection; - - m_connection = QObject::connect(&cli, &ServerProtocol::Client::sigIncommingData, - [&isWork, &received, &m_connection] (const QVariantMap& map) { - - isWork = !map.contains("Error"); - received = true; - disconnect(m_connection); - - }); - - QVERIFY(!cli.restart("lolo", 0)); - - QVERIFY(!cli.restart("192.168.1.999", 0)); - QVERIFY(!cli.restart("192.168.1.99", 0)); - QVERIFY(!cli.restart("192.168.1.9", 0)); - - QVERIFY(!cli.restart("-1.168.1.999", 77)); - QVERIFY(!cli.restart("192.168.-1.99", 7777)); - - QVERIFY(cli.restart("127.168.1.9", 3456)); - - cli.wait(received, 1000); - QVERIFY(isWork); - - isWork = false; - received = false; - - m_connection = QObject::connect(&cli, &ServerProtocol::Client::sigIncommingData, - [&isWork, &received, &m_connection] (const QVariantMap& map) { - - isWork = map.value("Address") == QString("%0:%1"). - arg(TEST_SERVER_ADDRESS). - arg(TEST_SERVER_PORT) && - !map.contains("Error"); - received = true; - disconnect(m_connection); - - }); - - QVERIFY(cli.restart(TEST_SERVER_ADDRESS, TEST_SERVER_PORT)); - - cli.wait(received, 1000); - QVERIFY(isWork); - -} - -void testSankeServer::testStopServerProtockol(ServerProtocol::Client& cli) { - - bool isWork = false; - bool received = false; - - QMetaObject::Connection m_connection; - - m_connection = QObject::connect(&cli, &ServerProtocol::Client::sigIncommingData, - [&isWork, &received, &m_connection] (const QVariantMap& map) { - - isWork = !map.contains("Error"); - received = true; - disconnect(m_connection); - - }); - - QVERIFY(cli.stop()); - - cli.wait(received, 1000); - - QVERIFY(!received || isWork); -} - -void testSankeServer::testPingClientProtockol(ClientProtocol::Client &cli) { - - bool isWork = false; - bool received = false; - - QMetaObject::Connection m_connection; - - m_connection = QObject::connect(&cli, &ClientProtocol::Client::sigIncommingData, - [&isWork, &received, &m_connection] (const ClientProtocol::Command cmd, - const QByteArray&) { - - isWork = cmd == ClientProtocol::Command::Ping; - received = true; - disconnect(m_connection); - - - }); - - QVERIFY(cli.ping()); - - QVERIFY(TestUtils::wait(received, 1000)); - - QVERIFY(isWork); - -} - -void testSankeServer::testLogin(ClientProtocol::Client &cli) { - - QVERIFY(TestUtils::loginFunc(cli, "Test@gmail.com", "testpass", true, false)); - - QVERIFY(TestUtils::registerFunc(cli, "Test@gmail.com", "testpass", true, true)); - QVERIFY(TestUtils::registerFunc(cli, "Test@gmail.com", "testpass", true, false)); - - QVERIFY(TestUtils::loginFunc(cli, "Test@gmail.com", "testpass", true, true)); - QVERIFY(TestUtils::loginFunc(cli, "Test@gmail.com", "testpass2", true, false)); - QVERIFY(TestUtils::loginFunc(cli, "Test@gmail.com", "testpass", true, true)); - -} - -void testSankeServer::testBanLogin(ClientProtocol::Client &cli, ServerProtocol::Client &term) { - - QVariantMap state; - TestUtils::getState(term, state); - - for (int i = 0; i < 25 && cli.isOnline(); i++) { - QVERIFY(TestUtils::loginFunc(cli, "Test@gmail.com", "testpass2", true, false) == cli.isOnline()); - } - - TestUtils::getState(term, state); - QVERIFY(state.value("Baned List").toStringList().contains("127.0.0.1")); - QVERIFY(TestUtils::loginFunc(cli, "Test@gmail.com", "testpass", false, false)); - QVERIFY(TestUtils::loginFunc(cli, "Test123@gmail.com", "testpass2", false, false)); - - TestUtils::unBanFunc(term, QHostAddress::LocalHost); - - TestUtils::getState(term, state); - QVERIFY(!state.value("Baned List").toStringList().contains("127.0.0.1")); - - TestUtils::banFunc(term, QHostAddress::LocalHost); - - TestUtils::getState(term, state); - QVERIFY(state.value("Baned List").toStringList().contains("127.0.0.1")); - - TestUtils::unBanFunc(term, QHostAddress::LocalHost); - cli.reconnectToHost(); - - TestUtils::reconnectFunc(cli); - QVERIFY(TestUtils::loginFunc(cli, "Test@gmail.com", "testpass", true, true)); - QVERIFY(TestUtils::loginFunc(cli, "Test123@gmail.com", "testpass2", true, false)); - -} - -void testSankeServer::testUserData(ClientProtocol::Client &cli) { - - cli._token = ""; - QVERIFY(!cli.updateData()); - - cli._token = QCryptographicHash::hash("testtoken", QCryptographicHash::Sha256); - QVERIFY(cli.updateData()); -} - -void testSankeServer::testGetItem(ClientProtocol::Client &cli) { - cli._token = ""; - QVERIFY(!cli.getItem(1)); - - cli._token = QCryptographicHash::hash("testtoken", QCryptographicHash::Sha256); - QVERIFY(cli.getItem(1)); -} - -void testSankeServer::testApplyData(ClientProtocol::Client &cli) { - - cli._token = QCryptographicHash::hash("testtoken", QCryptographicHash::Sha256); - - QVERIFY(!cli.savaData(QList())); - - QList listData = {1}; - - QVERIFY(cli.savaData(listData)); - -} - -void testSankeServer::testWebSockets(ClientProtocol::Client &cli) { - - QVERIFY(cli.setSubscribe(ClientProtocol::Command::Player, true)); - QVERIFY(cli.setSubscribe(ClientProtocol::Command::Player, false)); - - -} - -void testSankeServer::testBaseSql() { - SqlDBWriter db; - QFile::remove("./test.db"); - - bool init = db.initDb("./test.db"); - - if (!init) { - QFile::remove("./test.db"); - } - - QVERIFY(init); - - ClientProtocol::Snake snake; - snake.setSpeed(10); - snake.setSkillet(QList() << 1); - snake.setSnakeClass(0); - - - // TEST ITEM - - ClientProtocol::Snake resSnake; - - QVERIFY(db.saveItem(&snake) < 0); - snake.setId(0); - int id = db.saveItem(&snake); - - QVERIFY(id == 0); - - QVERIFY(db.getItem(id).parse(resSnake)); - - QVERIFY(snake.getSpeed() == resSnake.getSpeed()); - QVERIFY(snake.getSkillet() == resSnake.getSkillet()); - QVERIFY(snake.getSnakeClass() == resSnake.getSnakeClass()); - QVERIFY(snake.getClass() == resSnake.getClass()); - QVERIFY(snake.id() == resSnake.id()); - - resSnake.setSnakeClass(10); - QVERIFY(id == db.saveItem(Item(&resSnake))); - - ClientProtocol::Snake temp; - QVERIFY(db.getItem(id).parse(temp)); - - QVERIFY(temp.getSnakeClass() == 10); - - - // TEST PLAYER - - PlayerDBData player = PlayerDBData(); - - player.setMany(10); - player.setLastOnline(1000); - player.setOnlineTime(1001); - player.setName("test"); - player.fromHexPass("FF"); - player.setGmail("test@gmail.com"); - player.setCureentSnake(0); - - QVERIFY(db.savePlayer(player) < 0); - player.setId(0); - - QVERIFY(db.savePlayer(player) < 0); - player.setCureentSnake(-1); - id = db.savePlayer(player); - QVERIFY(id == 0); - - QVERIFY(!db.saveowners(id, QSet() << 1)); - QVERIFY(db.saveowners(id, QSet() << 0)); - - QSet items; - QVERIFY(db.getAllItemsOfPalyer(id, items)); - QVERIFY(items.contains(0)); - QVERIFY(items.size() == 1); - - - player.setCureentSnake(0); - id = db.savePlayer(player); - - auto resPlayer = db.getPlayer(id); - QVERIFY(resPlayer.isValid()); - QVERIFY(player.getLastOnline() == resPlayer.getLastOnline()); - QVERIFY(player.getMany() == resPlayer.getMany()); - QVERIFY(player.getOnlineTime() == resPlayer.getOnlineTime()); - QVERIFY(player.getName() == resPlayer.getName()); - QVERIFY(player.getPass() == resPlayer.getPass()); - QVERIFY(player.getCureentSnake() == resPlayer.getCureentSnake()); - - - player.setCureentSnake(3); - - QVERIFY(db.savePlayer(player) < 0); - player.setCureentSnake(0); - player.setName("new"); - QVERIFY(db.savePlayer(player) == id); - - resPlayer = db.getPlayer(id); - - QVERIFY(resPlayer.getName() == "new"); - -} - -void testSankeServer::testSqlCache() { - SqlDBCache db; - - QFile::remove("./test2.db"); - - bool init = db.initDb("./test2.db"); - - if (!init) { - QFile::remove("./test2.db"); - } - - QVERIFY(init); - - - ClientProtocol::Snake snake; - snake.setSpeed(10); - snake.setSkillet(QList() << 1); - snake.setSnakeClass(0); - - - // TEST ITEM - - ClientProtocol::Snake resSnake; - - int id = db.saveItem(&snake); - - QVERIFY(id == 0); - snake.setId(id); - - QVERIFY(db.getItem(id).parse(resSnake)); - - QVERIFY(snake.getSpeed() == resSnake.getSpeed()); - QVERIFY(snake.getSkillet() == resSnake.getSkillet()); - QVERIFY(snake.getSnakeClass() == resSnake.getSnakeClass()); - QVERIFY(snake.getClass() == resSnake.getClass()); - QVERIFY(snake.id() == resSnake.id()); - - resSnake.setSnakeClass(10); - QVERIFY(id == db.saveItem(Item(&resSnake))); - - ClientProtocol::Snake temp; - QVERIFY(db.getItem(id).parse(temp)); - - QVERIFY(temp.getSnakeClass() == 10); - - - // TEST PLAYER - - PlayerDBData player = PlayerDBData(); - - player.setMany(10); - player.setLastOnline(1000); - player.setOnlineTime(1001); - player.setName("test"); - player.fromHexPass("FF"); - player.setGmail("test@gmail.com"); - player.setCureentSnake(0); - - QVERIFY(db.savePlayer(player) < 0); - player.setId(0); - - QVERIFY(db.savePlayer(player) < 0); - player.setCureentSnake(-1); - id = db.savePlayer(player); - QVERIFY(id == 0); - - QVERIFY(!db.getItem(id, 1)); - QVERIFY(db.getItem(id, 0)); - - player.setCureentSnake(0); - QVERIFY(db.savePlayer(player) == id); - - auto resPlayer = db.getPlayer(id); - QVERIFY(resPlayer.isValid()); - QVERIFY(player.getLastOnline() == resPlayer.getLastOnline()); - QVERIFY(player.getMany() == resPlayer.getMany()); - QVERIFY(player.getOnlineTime() == resPlayer.getOnlineTime()); - QVERIFY(player.getName() == resPlayer.getName()); - QVERIFY(player.getPass() == resPlayer.getPass()); - QVERIFY(player.getCureentSnake() == resPlayer.getCureentSnake()); - - - player.setCureentSnake(3); - - QVERIFY(db.savePlayer(player) < 0); - player.setCureentSnake(0); - player.setName("new"); - QVERIFY(db.savePlayer(player) == id); - - resPlayer = db.getPlayer(id); - - QVERIFY(resPlayer.getName() == "new"); - - - PlayerDBData second_player = PlayerDBData(); - - second_player.setMany(10); - second_player.setLastOnline(1000); - second_player.setOnlineTime(1001); - second_player.setName("test2"); - second_player.setPass("test2"); - second_player.setGmail("test2@gmail.com"); - second_player.setCureentSnake(-1); - second_player.setId(-1); - - QVERIFY(db.savePlayer(second_player) == 1); - - QVERIFY(db.moveItem(0, 1, 0)); - - QSet items; - QVERIFY(db.getAllItemsOfPalyer(1, items)); - QVERIFY(items.contains(0)); - QVERIFY(items.size() == 1); - - db.updateInterval = 0; - - db.globalUpdateDataBasePrivate(0); - -} - -void testSankeServer::testSql() { - testBaseSql(); - testSqlCache(); -} - -void testSankeServer::testProtockols() { - - int argc =0; - char * argv[] = {nullptr}; - - QCoreApplication app(argc, argv); - - auto serv = new MainServer(true, this); - QVERIFY(serv->run(TEST_SERVER_ADDRESS, TEST_SERVER_PORT , "", TEST_LOCAL_SERVER)); - ServerProtocol::Client cliS(TEST_LOCAL_SERVER); - ClientProtocol::Client cliC(TEST_SERVER_ADDRESS, TEST_SERVER_PORT); - - QVERIFY(TestUtils::wait(cliC.isOnline(), 1000)); - - QTimer::singleShot(0, [this, &app, &cliS, &cliC]() { - - // test client protockol - testPingClientProtockol(cliC); - - testLogin(cliC); - testGetItem(cliC); - testUserData(cliC); - testApplyData(cliC); - testWebSockets(cliC); - testBanLogin(cliC, cliS); - - // test server protockiol - testPingServerProtockol(cliS); - testStateServerProtockol(cliS); - testBanServerProtockol(cliS); - testUnBanServerProtockol(cliS); - testRestartServerProtockol(cliS); - testStopServerProtockol(cliS); - app.exit(0); - }); - - app.exec(); - -} - -//void testSankeServer::testClientProtockol() { - -// auto serv = new ClientProtocol::Server(this); -// QVERIFY(serv->run(TEST_SERVER_ADDRESS, TEST_SERVER_PORT)); - - -//} - -QTEST_APPLESS_MAIN(testSankeServer) - -#include "tst_testsnakeserver.moc" diff --git a/SnakeUtils/SnakeUtils.pri b/SnakeUtils/SnakeUtils.pri deleted file mode 100644 index 8d5f78e..0000000 --- a/SnakeUtils/SnakeUtils.pri +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (C) 2018 - 2019 QuasarApp. -# Distributed under the lgplv3 software license, see the accompanying -# Everyone is permitted to copy and distribute verbatim copies -# of this license document, but changing it is not allowed. -# - -!isEmpty(SNAKEUTILS_LIB):error("SnakeUtils.pri already included") -SNAKEUTILS_LIB = 1 - -#DEPENDS -CONFIG(release, debug|release): { - SNAKEUTILS_LIB_OUTPUT_DIR="$$PWD/build/release" -} else { - SNAKEUTILS_LIB_OUTPUT_DIR="$$PWD/build/debug" -} - -LIBS += -L$$SNAKEUTILS_LIB_OUTPUT_DIR -lSnakeUtils - -INCLUDEPATH += "$$PWD/" - - - diff --git a/SnakeUtils/SnakeUtils.pro b/SnakeUtils/SnakeUtils.pro deleted file mode 100644 index 4c5d9e4..0000000 --- a/SnakeUtils/SnakeUtils.pro +++ /dev/null @@ -1,44 +0,0 @@ -#------------------------------------------------- -# -# Project created by QtCreator 2019-02-19T14:37:16 -# -#------------------------------------------------- - -QT -= gui - -TARGET = SnakeUtils -TEMPLATE = lib - -DEFINES += SNAKEUTILS_LIBRARY - -# The following define makes your compiler emit warnings if you use -# any feature of Qt which has been marked as deprecated (the exact warnings -# depend on your compiler). Please consult the documentation of the -# deprecated API in order to know how to port your code away from it. -DEFINES += QT_DEPRECATED_WARNINGS - -# You can also make your code fail to compile if you use deprecated APIs. -# In order to do so, uncomment the following line. -# You can also select to disable deprecated APIs only up to a certain version of Qt. -#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 - -SOURCES += \ - snakeutils.cpp \ - lvls.cpp - -HEADERS += \ - snakeutils.h \ - snakeutils_global.h \ - lvls.h - -CONFIG(release, debug|release): { - DESTDIR = $$PWD/build/release - -} else { - DESTDIR = $$PWD/build/debug -} - -include($$PWD/../QuasarAppLib/QuasarLib.pri) - -DISTFILES += \ - SnakeUtils.pri diff --git a/SnakeUtils/lvls.cpp b/SnakeUtils/lvls.cpp deleted file mode 100644 index 007b9d5..0000000 --- a/SnakeUtils/lvls.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "lvls.h" - -QList lvls { - WorldRules{{"Long", 500}, {"Box", 2}, {"Spead", 10}, {"BackGroundItem", 10}}, - WorldRules{{"Long", 1000}, {"Box", 4}, {"Spead", 10}, {"BackGroundItem", 10}}, - WorldRules{{"Long", 2000}, {"Box", 8}, {"Spead", 10}, {"BackGroundItem", 10}}, - WorldRules{{"Long", 4000}, {"Box", 16}, {"Spead", 10}, {"BackGroundItem", 10}}, - WorldRules{{"Long", 8000}, {"Box", 32}, {"Spead", 10}, {"BackGroundItem", 10}}, - WorldRules{{"Long", 16000}, {"Box", 64}, {"Spead", 10}, {"BackGroundItem", 10}} - -}; diff --git a/SnakeUtils/lvls.h b/SnakeUtils/lvls.h deleted file mode 100644 index dfcebf7..0000000 --- a/SnakeUtils/lvls.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef LVLS_H -#define LVLS_H - -#include -#include "snakeutils.h" - -extern QList lvls; - -#endif // LVLS_H diff --git a/SnakeUtils/snakeutils.cpp b/SnakeUtils/snakeutils.cpp deleted file mode 100644 index 3570290..0000000 --- a/SnakeUtils/snakeutils.cpp +++ /dev/null @@ -1,3 +0,0 @@ -#include "snakeutils.h" - - diff --git a/SnakeUtils/snakeutils.h b/SnakeUtils/snakeutils.h deleted file mode 100644 index b0fcc70..0000000 --- a/SnakeUtils/snakeutils.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef SNAKEUTILS_H -#define SNAKEUTILS_H - -#include "snakeutils_global.h" - -#include -#include -#include - -/** - * @brief WorldRules - * this map conteins: - * 1. list of generated objects and they count. - * 2. long of world (Long), - * 3. spead of world (Spead), - * !!!Note: all object show on map alltime. - */ -typedef QMap WorldRules; - - -#endif // SNAKEUTILS_H diff --git a/SnakeUtils/snakeutils_global.h b/SnakeUtils/snakeutils_global.h deleted file mode 100644 index 2dfb563..0000000 --- a/SnakeUtils/snakeutils_global.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef SNAKEUTILS_GLOBAL_H -#define SNAKEUTILS_GLOBAL_H - -#include - -#if defined(SNAKEUTILS_LIBRARY) -# define SNAKEUTILSSHARED_EXPORT Q_DECL_EXPORT -#else -# define SNAKEUTILSSHARED_EXPORT Q_DECL_IMPORT -#endif - -#endif // SNAKEUTILS_GLOBAL_H diff --git a/doc/calassdiagramm.png b/doc/calassdiagramm.png deleted file mode 100644 index 1d377d1..0000000 Binary files a/doc/calassdiagramm.png and /dev/null differ diff --git a/doc/calassdiagramm.qmodel b/doc/calassdiagramm.qmodel deleted file mode 100644 index b1e412f..0000000 --- a/doc/calassdiagramm.qmodel +++ /dev/null @@ -1,3829 +0,0 @@ - - - - {879592ec-be4e-4128-b462-28a6f1792f3d} - - - - - - - - {a8ddc489-bd35-401c-9439-dadd43dd4801} - - - CalassDiagramm - - - - - - - {021eead1-b7d6-402e-b115-138ba08b5627} - - - - - - - - - - {021eead1-b7d6-402e-b115-138ba08b5627} - - - CalassDiagramm - - - - - - - - - - - - {8533065c-faec-4867-be02-303ff882ec8f} - - - {1040fc09-15a3-4397-ace6-f04c394b0156} - - - interface - - - QObject - x:120;y:235 - x:-40;y:-30;w:80;h:60 - false - 0 - - - - - - - - - - - {920672dd-f71c-4125-a1b8-06c898093caa} - - - BackEnd - x:570;y:480 - x:-505;y:-315;w:1010;h:630 - - - - - - - - - - - {119b6d7e-cc59-4ee2-bd10-dd4d5182e0cc} - - - {30cf1880-ec6a-418d-a40f-bc737c45b215} - Back-End - Snake - x:245;y:550 - x:-40;y:-30;w:80;h:60 - 0 - - - - - - - - - - - - - {10f8a631-f809-46d6-b191-619b8cbef3b2} - - - {8b2a4c22-5e2e-4f4e-a556-31ec6a3b5c8c} - - - interface - - - Back-End - BaseClass - x:360;y:225 - x:-20;y:-20;w:40;h:40 - 0 - - - - - - - - - - - - - {04511117-b195-4c0d-a09b-a54fa402d241} - - - {99e50838-a9fb-4d59-b7f1-6756f84c227e} - Back-End - Box - x:580;y:420 - x:-40;y:-30;w:80;h:60 - 0 - - - - - - - - - - - - - {4f1e9064-853b-420c-a6e7-16e67ac57a3f} - - - {5f23ec13-fb38-44b8-9d85-69bd3db54622} - Back-End - Controller - x:415;y:660 - x:-310;y:-35;w:620;h:70 - false - 0 - - - - - - - - - - - - - {562d0631-7314-4b8a-87c7-502cea55e5ad} - - - {aeea301c-41ac-473b-be41-27e1ca908383} - Back-End - GuiObject - x:250;y:330 - x:-40;y:-30;w:80;h:60 - 0 - - - - - - - - - - - - - {546c8f00-0253-4a2c-b2ef-a9fbe54fa45f} - - - {0a047959-18af-49f9-8302-dae955310bf3} - Back-End - Head - x:130;y:425 - x:-40;y:-30;w:80;h:60 - 0 - - - - - - - - - - - - - {bb2c76a5-c625-4ed5-a106-dd8ec51463d3} - - - {200e5924-5aea-4e63-bffb-079d5b19e2ea} - Back-End - ItemWorld - x:365;y:420 - x:-40;y:-30;w:80;h:60 - 0 - - - - - - - - - - - - - {d50a158a-7f99-4ee8-bb58-695e265c0047} - - - {816ce4f8-1346-42a6-b8fe-24410c5375fb} - Back-End - World - x:465;y:555 - x:-40;y:-30;w:80;h:60 - 0 - - - - - - - - - - - - - {1590bdda-2951-4077-b37b-2cc03cd4e8e5} - - - {a9e10139-9334-492d-87b7-6e49c7d4bd57} - {8533065c-faec-4867-be02-303ff882ec8f} - {562d0631-7314-4b8a-87c7-502cea55e5ad} - - - - - - - - - - - - - {19ca12fd-ae84-4bb6-99f4-e55ca9ed22ca} - - - {8979dd4f-44f2-4a99-ab0a-ab35449575de} - {10f8a631-f809-46d6-b191-619b8cbef3b2} - {562d0631-7314-4b8a-87c7-502cea55e5ad} - - - - - - - - - - - - - {67cf62d9-ab1e-40cb-a467-ff68582796ef} - - - {34d9eb76-1aca-4665-b370-da094719f939} - {10f8a631-f809-46d6-b191-619b8cbef3b2} - {119b6d7e-cc59-4ee2-bd10-dd4d5182e0cc} - - - - - - - - - - - - - {f2e337d3-c749-4670-bf4b-2b965eb7191b} - - - {eca89a79-7b49-4ca2-a8f1-06457d355da4} - {10f8a631-f809-46d6-b191-619b8cbef3b2} - {d50a158a-7f99-4ee8-bb58-695e265c0047} - - - - - - - - - - - - - {30cfb213-d828-45e8-9942-f12a6039b210} - - - {93b313cb-9107-400e-9db4-95184e9f1219} - {d50a158a-7f99-4ee8-bb58-695e265c0047} - {bb2c76a5-c625-4ed5-a106-dd8ec51463d3} - - - - - * - true - 1 - - - - - - - - - - - - - {c159d283-9292-49bb-9dfc-f9b1b5f5cd54} - - - {e2d6cc26-33b0-4c70-8285-7d6f384d032c} - {bb2c76a5-c625-4ed5-a106-dd8ec51463d3} - {04511117-b195-4c0d-a09b-a54fa402d241} - - - - - - - - - - - - - {9bca1d89-89ca-4dea-9ad8-a103f10700af} - - - {e39576a4-e9c6-4d61-8021-ea8f1db5f0ed} - {119b6d7e-cc59-4ee2-bd10-dd4d5182e0cc} - {546c8f00-0253-4a2c-b2ef-a9fbe54fa45f} - - - - - * - true - 1 - - - - - - - - - - - - - {1552add6-397c-44c6-a599-2f6f35b2c725} - - - {20301be4-f051-48ab-b29a-62e92bb98ddc} - {562d0631-7314-4b8a-87c7-502cea55e5ad} - {546c8f00-0253-4a2c-b2ef-a9fbe54fa45f} - - - - - - - - - - - - - {714fa5eb-fe3a-4a15-9ee5-853e6888ef36} - - - {bb48e216-f61d-420b-a255-9564ccca4bd1} - {562d0631-7314-4b8a-87c7-502cea55e5ad} - {bb2c76a5-c625-4ed5-a106-dd8ec51463d3} - - - - - - - - - - - - - {7579536a-5ed8-4790-8fe5-069e48a0fe81} - - - {01fc145c-4b60-43f5-812c-5111cd13b3e7} - {4f1e9064-853b-420c-a6e7-16e67ac57a3f} - {d50a158a-7f99-4ee8-bb58-695e265c0047} - - - - - * - true - 2 - - - - - - - - - - - - - {f094a7fa-3567-46ce-a66f-0336da69a0d3} - - - {6dc1a08a-ef6e-460a-8c87-fecc3d96c1be} - {d50a158a-7f99-4ee8-bb58-695e265c0047} - {119b6d7e-cc59-4ee2-bd10-dd4d5182e0cc} - - - - - * - true - 2 - - - - - - - - - - - {09729430-478a-49a8-a6ec-b20e268a4f26} - - - FrontEnd - x:570;y:930 - x:-505;y:-95;w:1010;h:190 - - - - - - - - - - - {ae400e64-6ec3-4b9b-abb5-8a03b4d2c97e} - - - {c856b2e6-83cc-4d3a-a603-7f18d989b064} - {8533065c-faec-4867-be02-303ff882ec8f} - {4f1e9064-853b-420c-a6e7-16e67ac57a3f} - - - - - - - - - - - - - {6019d1e1-0b02-49d6-a487-15add6fc001d} - - - {eb954854-9b5e-4ea7-9237-b590bfe8e8c6} - Back-End - GuiObjectFactory - x:595;y:555 - x:-55;y:-30;w:110;h:60 - 0 - - - - - - - - - - - - - {e82376a9-680e-49b9-968f-77b67468b31e} - - - {3f96cc10-43e2-4aef-96c0-63ce559963d9} - {d50a158a-7f99-4ee8-bb58-695e265c0047} - {6019d1e1-0b02-49d6-a487-15add6fc001d} - - - - - 1 - true - 2 - - - - - - - - - - - - - {3d1f0043-257f-4f06-aaf4-d5096b619766} - - - {eac9ab00-70e1-4346-a40e-a09dfa347d20} - Diff - x:205;y:745 - x:-100;y:-30;w:200;h:60 - false - 6 - - - - - - - - - - - - - {75539dce-7e03-41df-8e75-da9b3f9ed58a} - - - {984ace8f-ae77-4590-aa60-030b60fddefa} - {3d1f0043-257f-4f06-aaf4-d5096b619766} - {4f1e9064-853b-420c-a6e7-16e67ac57a3f} - - - 1 - - - - - - - - - - - {2bde9796-53db-4a67-8944-252d87de8730} - - - {7e3f8bf1-3d3a-44d6-8888-e9cae3473683} - ProfileViewItems - MainMenuModel - x:770;y:555 - x:-100;y:-30;w:200;h:60 - false - 0 - - - - - - - - - - - - - {ccc76006-4713-4d75-a8ad-178e47e4a791} - - - {49cf0ec6-7362-4c19-a129-cfc0bb8179b8} - {4f1e9064-853b-420c-a6e7-16e67ac57a3f} - {2bde9796-53db-4a67-8944-252d87de8730} - - - - - 1 - true - 2 - - - - - - - - - - - - - {3149b367-e4a8-4582-9868-2c08d3059097} - - - {8c05ffe4-0340-4093-88f9-6570795713f9} - ProfileViewItems - UserView - x:975;y:410 - x:-40;y:-30;w:80;h:60 - 0 - - - - - - - - - - - - - {279317e4-324c-41b7-9c26-f4f3c7b9c8ea} - - - {c5334666-c506-46b1-9ae1-e7a29630bd03} - {2bde9796-53db-4a67-8944-252d87de8730} - {3149b367-e4a8-4582-9868-2c08d3059097} - - - - - 1 - true - 2 - - - - - - - - - - - - - {8c5183be-0767-4399-a856-633d562f035a} - - - {eb0b85b6-658d-4eff-a2e6-cd2ae7befd6d} - ClientProtocol - Client - x:770;y:415 - x:-40;y:-35;w:80;h:70 - 0 - - - ClientProtocol - - - - - - - - - - - {a55f34e3-8354-4588-9948-498b3d97b05f} - - - {7a93a742-d00d-4e04-80fd-f1739a191669} - {2bde9796-53db-4a67-8944-252d87de8730} - {8c5183be-0767-4399-a856-633d562f035a} - - - - - 1 - true - 2 - - - - - - - - - - - - - {3c479b36-a43f-46ba-a822-2766c16905f2} - - - {27cb7b78-cb1d-4418-8f91-025824839a1b} - ProfileViewItems - PlayerClientData - x:900;y:320 - x:-55;y:-35;w:110;h:70 - 0 - - - - - - - - - - - - - {ff44016a-db4c-4ec0-9281-f0af1a179097} - - - {2c238bae-21c1-46c4-9468-86d8d0bb9115} - {2bde9796-53db-4a67-8944-252d87de8730} - {3c479b36-a43f-46ba-a822-2766c16905f2} - - - - - * - true - 1 - - - - - - - - - - - - - {7125e61b-fb26-40bf-9ba3-3c365f5cf02e} - - - {38c55945-27ed-4d5c-9d38-761b84e9ae80} - Objects - Player - x:900;y:220 - x:-40;y:-35;w:80;h:70 - 0 - - - ClientProtocol - - - - - - - - - - - {800dddfe-52a2-41bb-be8a-462423cacaa0} - - - {238a4ada-2b3e-4084-8e38-e027f0d6482c} - {7125e61b-fb26-40bf-9ba3-3c365f5cf02e} - {3c479b36-a43f-46ba-a822-2766c16905f2} - - - - - - - - - - - - - {e1b86e20-4573-40e5-8728-aa9bf9f7ce69} - - - {6ae5bde6-f310-4c85-91e1-0176aebad87e} - Front-End - MainMenu - x:770;y:910 - x:-60;y:-30;w:120;h:60 - 0 - - - - - - - - - - - - - {a9d28e34-4f36-46a0-abd2-d3a20c864c13} - - - {13cf44a9-a6cc-4438-9271-a36888be9ec6} - {2bde9796-53db-4a67-8944-252d87de8730} - {e1b86e20-4573-40e5-8728-aa9bf9f7ce69} - - - 2 - - - - - - - - - - - {ccc95b75-32bd-4416-883b-7f599c850d7b} - - - {4b5e2d40-ee29-49f3-8812-f8e1eb741f03} - Front-End - UserView - x:975;y:910 - x:-55;y:-30;w:110;h:60 - 0 - - - - - - - - - - - - - {02890804-fedb-4650-8693-caeef3cc10ce} - - - {dbe663e7-34c5-4076-b664-a19e63ab0d7f} - Front-End - Scene - x:300;y:910 - x:-190;y:-30;w:380;h:60 - false - 0 - - - - - - - - - - - - - {5be1f4f5-c5e6-43c3-b120-3a3017e9a304} - - - {b7f55ebe-6eaf-4c19-8061-cd6d747a25fc} - {ccc95b75-32bd-4416-883b-7f599c850d7b} - {e1b86e20-4573-40e5-8728-aa9bf9f7ce69} - - - - - - - - - - - - - {be64c2a0-ec56-4f58-b99a-dfb538a9a02f} - - - {754eb6af-590d-4f81-b3ea-03a9e02bc96c} - {ccc95b75-32bd-4416-883b-7f599c850d7b} - {3149b367-e4a8-4582-9868-2c08d3059097} - - - 2 - - - - - - - - - - - {05b4a353-86f1-4b5c-923b-1f71c0a0a461} - - - {fb37e45e-7c18-4d56-aa70-be4b9c8f87a3} - {4f1e9064-853b-420c-a6e7-16e67ac57a3f} - {e1b86e20-4573-40e5-8728-aa9bf9f7ce69} - - - - - - - - - - - - - {bd67731c-6f06-40d5-8872-3076980e2dc4} - - - {fa7a0308-4c69-4938-844f-fa3049ef7dd5} - {4f1e9064-853b-420c-a6e7-16e67ac57a3f} - {02890804-fedb-4650-8693-caeef3cc10ce} - - - - - - - - - - - - - {954775d1-547a-4f10-84d9-1e676c9b1e60} - - - {3f014984-cf29-47b1-8dd7-1b10e238a6e2} - {3d1f0043-257f-4f06-aaf4-d5096b619766} - {02890804-fedb-4650-8693-caeef3cc10ce} - - - 2 - - - - - - - - - - - {f6d0ad9b-9f95-4299-8150-9c229fabcf04} - - - {cf29b293-1a04-45da-be97-39265f097b77} - {e1b86e20-4573-40e5-8728-aa9bf9f7ce69} - {02890804-fedb-4650-8693-caeef3cc10ce} - - - - - - - - 1564387986182 - General - - - - - - - - - - {027cbd47-7e34-4f5c-b11e-f063a6775cac} - - - - - - - - {027cbd47-7e34-4f5c-b11e-f063a6775cac} - - - Создать комонент - - - - - - - - - - {1040fc09-15a3-4397-ace6-f04c394b0156} - - - - - - - - {1040fc09-15a3-4397-ace6-f04c394b0156} - - - interface - - - - - QObject - - - - - - - {a9e10139-9334-492d-87b7-6e49c7d4bd57} - - - - - - - - {a9e10139-9334-492d-87b7-6e49c7d4bd57} - - - {1040fc09-15a3-4397-ace6-f04c394b0156} - {aeea301c-41ac-473b-be41-27e1ca908383} - - - - - - - - - - {c856b2e6-83cc-4d3a-a603-7f18d989b064} - - - - - - - - {c856b2e6-83cc-4d3a-a603-7f18d989b064} - - - {1040fc09-15a3-4397-ace6-f04c394b0156} - {5f23ec13-fb38-44b8-9d85-69bd3db54622} - - - - - - - - - - - - - - - - - - - - - {38bd349e-2976-43f4-8230-7c565b17d286} - - - - - - - - {38bd349e-2976-43f4-8230-7c565b17d286} - - - BaseClass - - - - - - - - - - {aa8272fc-6662-4c64-bf33-449dd6c537f7} - - - - - - - - {aa8272fc-6662-4c64-bf33-449dd6c537f7} - - - GuiObject - - - - - - - - - - {f3676e6f-ccb1-496a-b512-b6cd1caf474c} - - - - - - - - {f3676e6f-ccb1-496a-b512-b6cd1caf474c} - - - ItemWorld - - - - - - - - - - {e9bcc6d4-20a9-4ae5-8077-c76bfab556d5} - - - - - - - - {e9bcc6d4-20a9-4ae5-8077-c76bfab556d5} - 1 - - - Back-End - - - - - - - {30cf1880-ec6a-418d-a40f-bc737c45b215} - - - - - - - - {30cf1880-ec6a-418d-a40f-bc737c45b215} - 1 - - - Snake - - - - - - - {e39576a4-e9c6-4d61-8021-ea8f1db5f0ed} - - - - - - - - {e39576a4-e9c6-4d61-8021-ea8f1db5f0ed} - - - {30cf1880-ec6a-418d-a40f-bc737c45b215} - {0a047959-18af-49f9-8302-dae955310bf3} - - - - - * - true - 1 - - - - - - - - - - {6dc1a08a-ef6e-460a-8c87-fecc3d96c1be} - - - - - - - - {6dc1a08a-ef6e-460a-8c87-fecc3d96c1be} - - - {816ce4f8-1346-42a6-b8fe-24410c5375fb} - {30cf1880-ec6a-418d-a40f-bc737c45b215} - - - - - * - true - 2 - - - - - - - - - - - - - - - - - - - - - {7f5efa28-2448-403f-aac1-1daed0a402bd} - - - - - - - - {7f5efa28-2448-403f-aac1-1daed0a402bd} - 1 - - - Baseclass - - - - - - - - - - {8b2a4c22-5e2e-4f4e-a556-31ec6a3b5c8c} - - - - - - - - {8b2a4c22-5e2e-4f4e-a556-31ec6a3b5c8c} - 1 - - - interface - - - - - BaseClass - - - - - - - {8979dd4f-44f2-4a99-ab0a-ab35449575de} - - - - - - - - {8979dd4f-44f2-4a99-ab0a-ab35449575de} - - - {8b2a4c22-5e2e-4f4e-a556-31ec6a3b5c8c} - {aeea301c-41ac-473b-be41-27e1ca908383} - - - - - - - - - - {34d9eb76-1aca-4665-b370-da094719f939} - - - - - - - - {34d9eb76-1aca-4665-b370-da094719f939} - - - {8b2a4c22-5e2e-4f4e-a556-31ec6a3b5c8c} - {30cf1880-ec6a-418d-a40f-bc737c45b215} - - - - - - - - - - {eca89a79-7b49-4ca2-a8f1-06457d355da4} - - - - - - - - {eca89a79-7b49-4ca2-a8f1-06457d355da4} - - - {8b2a4c22-5e2e-4f4e-a556-31ec6a3b5c8c} - {816ce4f8-1346-42a6-b8fe-24410c5375fb} - - - - - - - - - - - - - - - - - - - - - {99e50838-a9fb-4d59-b7f1-6756f84c227e} - - - - - - - - {99e50838-a9fb-4d59-b7f1-6756f84c227e} - 1 - - - Box - - - - - - - - - - {5f23ec13-fb38-44b8-9d85-69bd3db54622} - - - - - - - - {5f23ec13-fb38-44b8-9d85-69bd3db54622} - 1 - - - Controller - - - - - - - {fe475b66-3ea8-4a72-be84-1020884bfb0c} - - - - - - - - {fe475b66-3ea8-4a72-be84-1020884bfb0c} - - - {5f23ec13-fb38-44b8-9d85-69bd3db54622} - {0e9152a2-43b7-4021-b067-51b48d88bf23} - - - 1 - - - - - - - - {60b51413-5ac6-4650-a8e0-ffa3c3d7b0a2} - - - - - - - - {60b51413-5ac6-4650-a8e0-ffa3c3d7b0a2} - - - {5f23ec13-fb38-44b8-9d85-69bd3db54622} - {8d34e552-fa29-4a02-97fe-348f6d12b5cf} - - - - - - - - - - {b4071def-6543-48b9-80a5-73d360a8a00f} - - - - - - - - {b4071def-6543-48b9-80a5-73d360a8a00f} - - - {5f23ec13-fb38-44b8-9d85-69bd3db54622} - {eac9ab00-70e1-4346-a40e-a09dfa347d20} - - - - - - - - - - {49cf0ec6-7362-4c19-a129-cfc0bb8179b8} - - - - - - - - {49cf0ec6-7362-4c19-a129-cfc0bb8179b8} - - - {5f23ec13-fb38-44b8-9d85-69bd3db54622} - {7e3f8bf1-3d3a-44d6-8888-e9cae3473683} - - - - - 1 - true - 2 - - - - - - - - - - {fb37e45e-7c18-4d56-aa70-be4b9c8f87a3} - - - - - - - - {fb37e45e-7c18-4d56-aa70-be4b9c8f87a3} - - - {5f23ec13-fb38-44b8-9d85-69bd3db54622} - {6ae5bde6-f310-4c85-91e1-0176aebad87e} - - - - - - - - - - {fa7a0308-4c69-4938-844f-fa3049ef7dd5} - - - - - - - - {fa7a0308-4c69-4938-844f-fa3049ef7dd5} - - - {5f23ec13-fb38-44b8-9d85-69bd3db54622} - {dbe663e7-34c5-4076-b664-a19e63ab0d7f} - - - - - - - - - - - - - - - - - - - - - {aeea301c-41ac-473b-be41-27e1ca908383} - - - - - - - - {aeea301c-41ac-473b-be41-27e1ca908383} - 1 - - - GuiObject - - - - - - - {20301be4-f051-48ab-b29a-62e92bb98ddc} - - - - - - - - {20301be4-f051-48ab-b29a-62e92bb98ddc} - - - {aeea301c-41ac-473b-be41-27e1ca908383} - {0a047959-18af-49f9-8302-dae955310bf3} - - - - - - - - - - {bb48e216-f61d-420b-a255-9564ccca4bd1} - - - - - - - - {bb48e216-f61d-420b-a255-9564ccca4bd1} - - - {aeea301c-41ac-473b-be41-27e1ca908383} - {200e5924-5aea-4e63-bffb-079d5b19e2ea} - - - - - - - - - - - - - - - - - - {782195a1-d585-4f3b-bab8-45a87b3b2040} - 2 - 1 - double x, y, angle - - - - - {cc592760-598c-435d-a14e-1154f6fc21ee} - 2 - 1 - QString texture - - - - - {eba85116-d6ff-4873-b2a0-33ac89e28005} - 2 - 1 - double sizeX, sizeY, radius - - - - - {5329a2aa-4c85-4b44-be9f-9a302dc6d148} - 1 - 2 - GuiObject(QObject *ptr = nullptr) - - - - - {c8f587b9-7719-4a67-8421-f742a9726789} - 1 - 2 - 4 - double getAngle() - - - - - {746bac64-782f-4f2f-a8b9-7ecb254da556} - 1 - 2 - void setAngle(double angle) - - - - - {9589ed54-f743-4fc5-bdff-964a5e6a964a} - 1 - 2 - 4 - double getY() - - - - - {b49cea07-c98b-41b5-b5a7-5ff4b0b7f49a} - 1 - 2 - void setY(double y) - - - - - {ef6a5043-5b40-4aac-b68a-7894c2412d27} - 1 - 2 - 4 - double getX() - - - - - {4e283c49-d384-45d2-96fa-6207bf1643fe} - 1 - 2 - void setX(double x) - - - - - {e13ab166-d212-4975-8e2a-18d358facf05} - 1 - 2 - 4 - QString getTexture() - - - - - {52935fab-5720-4c11-ace2-5d138847c67e} - 1 - 2 - void setTexture(const QString &texture) - - - - - - - - - - - - {0a047959-18af-49f9-8302-dae955310bf3} - - - - - - - - {0a047959-18af-49f9-8302-dae955310bf3} - 1 - - - Head - - - - - - - - - - {200e5924-5aea-4e63-bffb-079d5b19e2ea} - - - - - - - - {200e5924-5aea-4e63-bffb-079d5b19e2ea} - 1 - - - ItemWorld - - - - - - - {e2d6cc26-33b0-4c70-8285-7d6f384d032c} - - - - - - - - {e2d6cc26-33b0-4c70-8285-7d6f384d032c} - - - {200e5924-5aea-4e63-bffb-079d5b19e2ea} - {99e50838-a9fb-4d59-b7f1-6756f84c227e} - - - - - - - - - - - - - - - - - - - - - {816ce4f8-1346-42a6-b8fe-24410c5375fb} - - - - - - - - {816ce4f8-1346-42a6-b8fe-24410c5375fb} - 1 - - - World - - - - - - - {93b313cb-9107-400e-9db4-95184e9f1219} - - - - - - - - {93b313cb-9107-400e-9db4-95184e9f1219} - - - {816ce4f8-1346-42a6-b8fe-24410c5375fb} - {200e5924-5aea-4e63-bffb-079d5b19e2ea} - - - - - * - true - 1 - - - - - - - - - - {01fc145c-4b60-43f5-812c-5111cd13b3e7} - - - - - - - - {01fc145c-4b60-43f5-812c-5111cd13b3e7} - - - {5f23ec13-fb38-44b8-9d85-69bd3db54622} - {816ce4f8-1346-42a6-b8fe-24410c5375fb} - - - - - * - true - 2 - - - - - - - - - - - - - - - - - - - - - {80ceace3-3861-4a5f-a0f6-429cb8bd6722} - - - - - - - - {80ceace3-3861-4a5f-a0f6-429cb8bd6722} - 1 - - - Box - - - - - - - {843d1d44-a098-4da0-bab2-e2b7dd55e820} - - - - - - - - {843d1d44-a098-4da0-bab2-e2b7dd55e820} - 1 - - - include - - - - - {80ceace3-3861-4a5f-a0f6-429cb8bd6722} - {98ea3b76-86aa-47e5-a88d-b16e641d66bf} - - - - - - - - - - - - - - - - - - - - - {d6363cef-4687-44ee-b116-97b60b423dd8} - - - - - - - - {d6363cef-4687-44ee-b116-97b60b423dd8} - 1 - - - Controller - - - - - - - {cf19fc60-8b43-4bdc-8ec0-7c162cecbfc1} - - - - - - - - {cf19fc60-8b43-4bdc-8ec0-7c162cecbfc1} - 1 - - - include - - - - - {d6363cef-4687-44ee-b116-97b60b423dd8} - {bf9b8bf1-9645-4bc0-ad34-e2118d42f0b9} - - - - - - - - - - {4d9ab9bb-a5f3-4a45-841c-c05ba8a60919} - - - - - - - - {4d9ab9bb-a5f3-4a45-841c-c05ba8a60919} - 1 - - - include - - - - - {d6363cef-4687-44ee-b116-97b60b423dd8} - {387c7293-83b9-467c-91e4-5089c6b49b07} - - - - - - - - - - - - - - - - - - - - - {7eb487d0-f596-4510-a04a-26333cb016f4} - - - - - - - - {7eb487d0-f596-4510-a04a-26333cb016f4} - 1 - - - Guiobject - - - - - - - {ad8540f4-ac3c-44c6-97af-7de88cc7d5be} - - - - - - - - {ad8540f4-ac3c-44c6-97af-7de88cc7d5be} - 1 - - - include - - - - - {7eb487d0-f596-4510-a04a-26333cb016f4} - {7f5efa28-2448-403f-aac1-1daed0a402bd} - - - - - - - - - - - - - - - - - - - - - {21b0be17-d1b8-44cd-9cfb-cc5262418f35} - - - - - - - - {21b0be17-d1b8-44cd-9cfb-cc5262418f35} - 1 - - - Head - - - - - - - {0f966f2d-3828-45bf-8711-816b81eb1016} - - - - - - - - {0f966f2d-3828-45bf-8711-816b81eb1016} - 1 - - - include - - - - - {21b0be17-d1b8-44cd-9cfb-cc5262418f35} - {7eb487d0-f596-4510-a04a-26333cb016f4} - - - - - - - - - - - - - - - - - - - - - {98ea3b76-86aa-47e5-a88d-b16e641d66bf} - - - - - - - - {98ea3b76-86aa-47e5-a88d-b16e641d66bf} - 1 - - - Itemworld - - - - - - - {3d234f89-0492-4abc-bbde-9245ff4f5a3b} - - - - - - - - {3d234f89-0492-4abc-bbde-9245ff4f5a3b} - 1 - - - include - - - - - {98ea3b76-86aa-47e5-a88d-b16e641d66bf} - {7eb487d0-f596-4510-a04a-26333cb016f4} - - - - - - - - - - - - - - - - - - - - - {acee2132-ede7-46b3-9748-8905cddf12dd} - - - - - - - - {acee2132-ede7-46b3-9748-8905cddf12dd} - 1 - - - Main - - - - - - - - - - {bf9b8bf1-9645-4bc0-ad34-e2118d42f0b9} - - - - - - - - {bf9b8bf1-9645-4bc0-ad34-e2118d42f0b9} - 1 - - - Snake - - - - - - - {59123ee8-b20a-46f1-b5ae-67210c3c90dd} - - - - - - - - {59123ee8-b20a-46f1-b5ae-67210c3c90dd} - 1 - - - include - - - - - {bf9b8bf1-9645-4bc0-ad34-e2118d42f0b9} - {21b0be17-d1b8-44cd-9cfb-cc5262418f35} - - - - - - - - - - {1b87ae74-42ed-4c36-8402-da96464aa371} - - - - - - - - {1b87ae74-42ed-4c36-8402-da96464aa371} - 1 - - - include - - - - - {bf9b8bf1-9645-4bc0-ad34-e2118d42f0b9} - {7f5efa28-2448-403f-aac1-1daed0a402bd} - - - - - - - - - - - - - - - - - - - - - {387c7293-83b9-467c-91e4-5089c6b49b07} - - - - - - - - {387c7293-83b9-467c-91e4-5089c6b49b07} - 1 - - - World - - - - - - - {02d14635-6813-446c-85b2-54f63bdb2120} - - - - - - - - {02d14635-6813-446c-85b2-54f63bdb2120} - 1 - - - include - - - - - {387c7293-83b9-467c-91e4-5089c6b49b07} - {98ea3b76-86aa-47e5-a88d-b16e641d66bf} - - - - - - - - - - {70d98a71-8f8e-4b4e-b194-b99a482e96d4} - - - - - - - - {70d98a71-8f8e-4b4e-b194-b99a482e96d4} - 1 - - - include - - - - - {387c7293-83b9-467c-91e4-5089c6b49b07} - {7f5efa28-2448-403f-aac1-1daed0a402bd} - - - - - - - - - - - - - - - - - - - - - {57a0b749-e7e8-4596-81f9-7eedd5f20c23} - - - - - - - - - - {57a0b749-e7e8-4596-81f9-7eedd5f20c23} - - - Back-End - - - - - - - - - - - - {eb954854-9b5e-4ea7-9237-b590bfe8e8c6} - - - - - - - - {eb954854-9b5e-4ea7-9237-b590bfe8e8c6} - 1 - - - GuiObjectFactory - - - - - - - {3f96cc10-43e2-4aef-96c0-63ce559963d9} - - - - - - - - {3f96cc10-43e2-4aef-96c0-63ce559963d9} - - - {816ce4f8-1346-42a6-b8fe-24410c5375fb} - {eb954854-9b5e-4ea7-9237-b590bfe8e8c6} - - - - - 1 - true - 2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {0e9152a2-43b7-4021-b067-51b48d88bf23} - - - - - - - - {0e9152a2-43b7-4021-b067-51b48d88bf23} - - - QML Scene - - - - - - - {00a89b55-a11c-46f6-ae56-287d63f5637f} - - - - - - - - {00a89b55-a11c-46f6-ae56-287d63f5637f} - - - {0e9152a2-43b7-4021-b067-51b48d88bf23} - {5f23ec13-fb38-44b8-9d85-69bd3db54622} - - - 2 - - - - - - - - {8c064969-3d23-4bfa-9d24-bc405a68c7d2} - - - - - - - - {8c064969-3d23-4bfa-9d24-bc405a68c7d2} - - - {0e9152a2-43b7-4021-b067-51b48d88bf23} - {8d34e552-fa29-4a02-97fe-348f6d12b5cf} - - - - - - - - - - {aec8e97c-51d5-4db3-9925-cbda4dd01452} - - - - - - - - {aec8e97c-51d5-4db3-9925-cbda4dd01452} - - - {0e9152a2-43b7-4021-b067-51b48d88bf23} - {8d34e552-fa29-4a02-97fe-348f6d12b5cf} - - - - - - - - - - {2e5a2e2d-77af-4074-840f-4b8144df7bdb} - - - - - - - - {2e5a2e2d-77af-4074-840f-4b8144df7bdb} - - - {0e9152a2-43b7-4021-b067-51b48d88bf23} - {eac9ab00-70e1-4346-a40e-a09dfa347d20} - - - - - - - - - - - - - - - - - - - - - {1f442098-3083-4de5-9418-cfedcdc4911b} - - - - - - - - {1f442098-3083-4de5-9418-cfedcdc4911b} - 1 - - - Snake - - - - - - - {2f4799a2-3b05-40a6-a50c-261f3d5025be} - - - - - - - - {2f4799a2-3b05-40a6-a50c-261f3d5025be} - 1 - - - Snake - - - - - - - - - - {ac9a95d0-1eb2-4e9d-8d20-af703111003b} - - - - - - - - {ac9a95d0-1eb2-4e9d-8d20-af703111003b} - 1 - - - Qml - - - - - - - - - - - - - - - - - - - - - {d81fb42e-9df7-4d77-bac0-3ec82b3dee41} - - - - - - - - {d81fb42e-9df7-4d77-bac0-3ec82b3dee41} - 1 - - - Doc - - - - - - - {79ed591f-8e74-4fa9-b8b2-83177217dda8} - - - - - - - - {79ed591f-8e74-4fa9-b8b2-83177217dda8} - 1 - - - Calassdiagramm - - - - - - - - - - - - - - - - - - - - - {eb1d4e8c-23be-49af-99ae-16f21c5f4904} - - - - - - - - {eb1d4e8c-23be-49af-99ae-16f21c5f4904} - - - Новый Instance - - - false - instance - - - - - - - - {8d34e552-fa29-4a02-97fe-348f6d12b5cf} - - - - - - - - {8d34e552-fa29-4a02-97fe-348f6d12b5cf} - - - Objects Diff Interface - - - false - instance - - - - - - - - {b163850b-0cb5-4e82-ac9e-381e8701e38b} - - - - - - - - {b163850b-0cb5-4e82-ac9e-381e8701e38b} - - - Новый Intance - - - false - instance - - - - - - - - {eac9ab00-70e1-4346-a40e-a09dfa347d20} - - - - - - - - {eac9ab00-70e1-4346-a40e-a09dfa347d20} - - - Diff - - - - - - - {984ace8f-ae77-4590-aa60-030b60fddefa} - - - - - - - - {984ace8f-ae77-4590-aa60-030b60fddefa} - - - {eac9ab00-70e1-4346-a40e-a09dfa347d20} - {5f23ec13-fb38-44b8-9d85-69bd3db54622} - - - 1 - - - - - - - - {2ec1fd71-06c6-4724-9d09-d846fa1f423f} - - - - - - - - {2ec1fd71-06c6-4724-9d09-d846fa1f423f} - - - {eac9ab00-70e1-4346-a40e-a09dfa347d20} - {0e9152a2-43b7-4021-b067-51b48d88bf23} - - - - - - - - - - {3f014984-cf29-47b1-8dd7-1b10e238a6e2} - - - - - - - - {3f014984-cf29-47b1-8dd7-1b10e238a6e2} - - - {eac9ab00-70e1-4346-a40e-a09dfa347d20} - {dbe663e7-34c5-4076-b664-a19e63ab0d7f} - - - 2 - - - - - - - - - - - - - - - - - - - {283c0360-30a4-45a0-9e31-99610872d9c5} - - - - - - - - {283c0360-30a4-45a0-9e31-99610872d9c5} - 1 - - - SnakeClient - - - - - - - {d669449c-136b-4a00-959d-c0e77dad4c11} - - - - - - - - {d669449c-136b-4a00-959d-c0e77dad4c11} - 1 - - - Client - - - - - - - {b0e2d377-64aa-4416-aa0f-7a7806e7921a} - - - - - - - - {b0e2d377-64aa-4416-aa0f-7a7806e7921a} - 1 - - - Back-End - - - - - - - {796b776f-d4a7-40fc-a1aa-e99dee0e244c} - - - - - - - - {796b776f-d4a7-40fc-a1aa-e99dee0e244c} - 1 - - - ProfileViewItems - - - - - - - {7e3f8bf1-3d3a-44d6-8888-e9cae3473683} - - - - - - - - {7e3f8bf1-3d3a-44d6-8888-e9cae3473683} - 1 - - - MainMenuModel - - - - - - - {c5334666-c506-46b1-9ae1-e7a29630bd03} - - - - - - - - {c5334666-c506-46b1-9ae1-e7a29630bd03} - - - {7e3f8bf1-3d3a-44d6-8888-e9cae3473683} - {8c05ffe4-0340-4093-88f9-6570795713f9} - - - - - 1 - true - 2 - - - - - - - - - - {7a93a742-d00d-4e04-80fd-f1739a191669} - - - - - - - - {7a93a742-d00d-4e04-80fd-f1739a191669} - - - {7e3f8bf1-3d3a-44d6-8888-e9cae3473683} - {eb0b85b6-658d-4eff-a2e6-cd2ae7befd6d} - - - - - 1 - true - 2 - - - - - - - - - - {2c238bae-21c1-46c4-9468-86d8d0bb9115} - - - - - - - - {2c238bae-21c1-46c4-9468-86d8d0bb9115} - - - {7e3f8bf1-3d3a-44d6-8888-e9cae3473683} - {27cb7b78-cb1d-4418-8f91-025824839a1b} - - - - - * - true - 1 - - - - - - - - - - {13cf44a9-a6cc-4438-9271-a36888be9ec6} - - - - - - - - {13cf44a9-a6cc-4438-9271-a36888be9ec6} - - - {7e3f8bf1-3d3a-44d6-8888-e9cae3473683} - {6ae5bde6-f310-4c85-91e1-0176aebad87e} - - - 2 - - - - - - - - - - - - - - - - - - - {8c05ffe4-0340-4093-88f9-6570795713f9} - - - - - - - - {8c05ffe4-0340-4093-88f9-6570795713f9} - 1 - - - UserView - - - - - - - - - - {27cb7b78-cb1d-4418-8f91-025824839a1b} - - - - - - - - {27cb7b78-cb1d-4418-8f91-025824839a1b} - 1 - - - PlayerClientData - - - - - - - {a9667697-7d4c-4757-bf4f-0ab2568873aa} - - - - - - - - {a9667697-7d4c-4757-bf4f-0ab2568873aa} - - - {27cb7b78-cb1d-4418-8f91-025824839a1b} - {38c55945-27ed-4d5c-9d38-761b84e9ae80} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {d2a6e0a9-4e14-4c26-b4c0-f7f239e19dfd} - - - - - - - - {d2a6e0a9-4e14-4c26-b4c0-f7f239e19dfd} - 1 - - - Front-End - - - - - - - {6ae5bde6-f310-4c85-91e1-0176aebad87e} - - - - - - - - {6ae5bde6-f310-4c85-91e1-0176aebad87e} - 1 - - - MainMenu - - - - - - - {cf29b293-1a04-45da-be97-39265f097b77} - - - - - - - - {cf29b293-1a04-45da-be97-39265f097b77} - - - {6ae5bde6-f310-4c85-91e1-0176aebad87e} - {dbe663e7-34c5-4076-b664-a19e63ab0d7f} - - - - - - - - - - - - - - - - - - - - - {4b5e2d40-ee29-49f3-8812-f8e1eb741f03} - - - - - - - - {4b5e2d40-ee29-49f3-8812-f8e1eb741f03} - 1 - - - UserView - - - - - - - {b7f55ebe-6eaf-4c19-8061-cd6d747a25fc} - - - - - - - - {b7f55ebe-6eaf-4c19-8061-cd6d747a25fc} - - - {4b5e2d40-ee29-49f3-8812-f8e1eb741f03} - {6ae5bde6-f310-4c85-91e1-0176aebad87e} - - - - - - - - - - {754eb6af-590d-4f81-b3ea-03a9e02bc96c} - - - - - - - - {754eb6af-590d-4f81-b3ea-03a9e02bc96c} - - - {4b5e2d40-ee29-49f3-8812-f8e1eb741f03} - {8c05ffe4-0340-4093-88f9-6570795713f9} - - - 2 - - - - - - - - - - - - - - - - - - - {dbe663e7-34c5-4076-b664-a19e63ab0d7f} - - - - - - - - {dbe663e7-34c5-4076-b664-a19e63ab0d7f} - 1 - - - Scene - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {59144cd0-4796-4da3-a967-0ae0bacdf5f2} - - - - - - - - {59144cd0-4796-4da3-a967-0ae0bacdf5f2} - - - qmk MainMenu - - - - - - - {79dba8a4-e8b0-4f96-b405-7663076e9785} - - - - - - - - {79dba8a4-e8b0-4f96-b405-7663076e9785} - - - {59144cd0-4796-4da3-a967-0ae0bacdf5f2} - {7e3f8bf1-3d3a-44d6-8888-e9cae3473683} - - - 2 - - - - - - - - {b8530bc1-b5f0-4a9e-acfb-969901f48cb3} - - - - - - - - {b8530bc1-b5f0-4a9e-acfb-969901f48cb3} - - - {59144cd0-4796-4da3-a967-0ae0bacdf5f2} - {5f23ec13-fb38-44b8-9d85-69bd3db54622} - - - 1 - - - - - - - - - - - - - - - - - - - {d90eff49-65d5-4667-bbbc-d034dea875d4} - - - - - - - - {d90eff49-65d5-4667-bbbc-d034dea875d4} - - - UserView - - - - - - - {fddab005-ecbd-4104-8be1-2b157f36ff3c} - - - - - - - - {fddab005-ecbd-4104-8be1-2b157f36ff3c} - - - {d90eff49-65d5-4667-bbbc-d034dea875d4} - {59144cd0-4796-4da3-a967-0ae0bacdf5f2} - - - - - - - - - - {fd446cc7-6634-4476-adbd-580b314f736f} - - - - - - - - {fd446cc7-6634-4476-adbd-580b314f736f} - - - {d90eff49-65d5-4667-bbbc-d034dea875d4} - {8c05ffe4-0340-4093-88f9-6570795713f9} - - - 2 - - - - - - - - {5dcec008-fc55-477f-8188-4c09482d56bb} - - - - - - - - {5dcec008-fc55-477f-8188-4c09482d56bb} - - - {d90eff49-65d5-4667-bbbc-d034dea875d4} - {6ae5bde6-f310-4c85-91e1-0176aebad87e} - - - - - - - - - - - - - - - - - - - - - {06a33c34-d3d3-4407-a9be-f0b48c7d24d7} - - - - - - - - {06a33c34-d3d3-4407-a9be-f0b48c7d24d7} - 1 - - - SnakeServer - - - - - - - {9b53aa1a-bc2a-48cd-809c-9ea7e1668fdb} - - - - - - - - {9b53aa1a-bc2a-48cd-809c-9ea7e1668fdb} - 1 - - - ClientProtocol - - - - - - - {eb0b85b6-658d-4eff-a2e6-cd2ae7befd6d} - - - - - - - - {eb0b85b6-658d-4eff-a2e6-cd2ae7befd6d} - 1 - - - Client - - - ClientProtocol - - - - - - - - {a98b7369-6a0e-4da6-869e-2b8755cfc148} - - - - - - - - {a98b7369-6a0e-4da6-869e-2b8755cfc148} - 1 - - - Objects - - - - - - - {38c55945-27ed-4d5c-9d38-761b84e9ae80} - - - - - - - - {38c55945-27ed-4d5c-9d38-761b84e9ae80} - 1 - - - Player - - - - - - - {238a4ada-2b3e-4084-8e38-e027f0d6482c} - - - - - - - - {238a4ada-2b3e-4084-8e38-e027f0d6482c} - - - {38c55945-27ed-4d5c-9d38-761b84e9ae80} - {27cb7b78-cb1d-4418-8f91-025824839a1b} - - - - - - - - - - - - - - ClientProtocol - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/librarymodel.qmodel b/doc/librarymodel.qmodel deleted file mode 100644 index 4e1084d..0000000 --- a/doc/librarymodel.qmodel +++ /dev/null @@ -1,1495 +0,0 @@ - - - - {dfea0e90-7910-4ae4-937e-8d4de8fe4774} - - - - - - - - {e8a1d78d-d7dc-4904-b888-2187d5cb3f42} - - - LibraryModel - - - - - - - {a04c0ce6-496f-4d26-9ea2-7ec6bb875cb2} - - - - - - - - - - {a04c0ce6-496f-4d26-9ea2-7ec6bb875cb2} - - - LibraryModel - - - - - - - - - - - - {66a23192-a9ad-4663-84d3-42f3cdcd1c08} - - - {d51b5a71-74cc-42da-a35f-20676c490201} - QuasarAppLib - QuasarApp - x:390;y:60 - x:-60;y:-30;w:120;h:60 - 0 - - - - - - - - - - - - - {c04cb3d2-a9a6-485e-bca2-94f39c01e243} - - - {34dd2fbb-3112-4b22-b369-7fd071dff2a7} - Snake - Snake - x:185;y:395 - x:-50;y:-30;w:100;h:60 - 0 - - - - - - - - - - - - - {787259f9-aabe-4c93-be84-23639f7fbcc3} - - - {3eafef02-7a87-4877-8889-72ea7cb240e9} - ClientProtocol - ClientProtocol - x:190;y:145 - x:-70;y:-30;w:140;h:60 - 0 - - - - - - - - - - - - - {04e5587c-ac50-4f4f-b0b2-f826b70daf1b} - - - {d1deca32-81c8-4f70-8671-17076ea8633b} - Client - Terminal - x:635;y:400 - x:-55;y:-30;w:110;h:60 - 0 - - - - - - - - - - - - - {155d97c2-3148-41d5-8783-709e51e52482} - - - {b4ce19d6-e501-4fa6-82c5-791fab5b94eb} - ServerProtocol - ServerProtocol - x:630;y:145 - x:-70;y:-30;w:140;h:60 - 0 - - - - - - - - - - - - - {5bd34991-4aaa-450d-b716-1e07deb5dfab} - - - {32657f3f-5cc1-470b-a557-dd69c7616889} - Daemon - Daemon - x:395;y:400 - x:-55;y:-30;w:110;h:60 - 0 - - - - - - - - - - - - - {719e7768-fe5e-44fd-a159-e6a18258544d} - - - {97f59dd5-871c-49b7-978d-b25f974d6251} - {7456d55f-3559-46e5-b237-d7430adb61d3} - {66a23192-a9ad-4663-84d3-42f3cdcd1c08} - - - - - - - - - - - - - {40dbfa32-650f-4264-bd8a-82859fa04b45} - - - {cc0dbaf1-ad4e-4376-a985-935b482e7ab9} - {04e5587c-ac50-4f4f-b0b2-f826b70daf1b} - {155d97c2-3148-41d5-8783-709e51e52482} - - - - - - - - - - - - - {7ca29923-fa09-4a36-9454-80250e9b8e4c} - - - {bd120e71-435b-4b77-8dbc-4965cfdb5b86} - {787259f9-aabe-4c93-be84-23639f7fbcc3} - {66a23192-a9ad-4663-84d3-42f3cdcd1c08} - - - - - - - - - - - - - {1b46e4ab-aac0-4351-a421-f5ec73ebc681} - - - {3988bb54-f1c2-49f9-84d7-be11c76353e0} - {c04cb3d2-a9a6-485e-bca2-94f39c01e243} - {7456d55f-3559-46e5-b237-d7430adb61d3} - - - - - - - - - - - - - {2485ae7a-c021-45eb-885d-31c6e625c374} - - - {a7c4b36c-f545-48d1-ad2d-7e49f671c835} - {155d97c2-3148-41d5-8783-709e51e52482} - {66a23192-a9ad-4663-84d3-42f3cdcd1c08} - - - - - - - - - - - - - {6e03d6c1-20ae-45a3-9b6a-878b16d74db9} - - - {9636e57a-651b-4c78-bb85-ecfd66d802e1} - {04e5587c-ac50-4f4f-b0b2-f826b70daf1b} - {66a23192-a9ad-4663-84d3-42f3cdcd1c08} - - - - - - - - - - - - - {6e1ecf72-4476-4891-8e43-eef89da71780} - - - {0fe0f577-4b80-4118-b36e-01f6cc55bebd} - {155d97c2-3148-41d5-8783-709e51e52482} - {66a23192-a9ad-4663-84d3-42f3cdcd1c08} - - - - - - - - - - - - - {7456d55f-3559-46e5-b237-d7430adb61d3} - - - {56f5d199-029a-4d7d-a667-63e884b121c9} - Client - x:185;y:265 - x:-50;y:-30;w:100;h:60 - 0 - - - - - - - - - - - - - {06525499-f6e0-4625-ab68-1c382c9320c2} - - - {03379880-0ad4-4eb8-9e06-c81f1c8f9e26} - Server - x:395;y:265 - x:-50;y:-30;w:100;h:60 - 0 - - - - - - - - - - - - - {fb92c04f-f425-4fbe-b98b-a5c32a6db837} - - - {11bfbdaa-13cf-4fd3-9161-b54d2c49e357} - {06525499-f6e0-4625-ab68-1c382c9320c2} - {66a23192-a9ad-4663-84d3-42f3cdcd1c08} - - - - - - - - - - - - - {834668b7-1943-41d6-a488-148063f7eabd} - - - {d1846a67-a2c7-4eb9-89ea-f1d905dbdaf2} - {06525499-f6e0-4625-ab68-1c382c9320c2} - {155d97c2-3148-41d5-8783-709e51e52482} - - - - - - - - - - - - - {3d0b6e33-e8f0-4d93-9877-c098f98d0766} - - - {e66ff8e1-b4e0-44cd-b7c0-48388d23d78e} - {5bd34991-4aaa-450d-b716-1e07deb5dfab} - {06525499-f6e0-4625-ab68-1c382c9320c2} - - - - - - - - - - - - - {93209e6d-b898-4a65-a499-7700182dcf8c} - - - {a16e9f9d-a7f1-4759-9729-c3ae12cd7534} - {06525499-f6e0-4625-ab68-1c382c9320c2} - {787259f9-aabe-4c93-be84-23639f7fbcc3} - - - - - - - - - - - - - {3ffdc7ca-c9ca-4574-bfcb-036c36e765d2} - - - {6415c533-44d8-4da0-acf0-81e5a137ac1b} - {7456d55f-3559-46e5-b237-d7430adb61d3} - {787259f9-aabe-4c93-be84-23639f7fbcc3} - - - - - - - - - - - - - {d9d1345e-7f2b-4795-991b-329acbef5a3a} - - - {179586c1-7898-4183-9bf5-a77ba74f8f0d} - SnakeUtils - SnakeUtils - x:15;y:145 - x:-60;y:-30;w:120;h:60 - 0 - - - - - - - - - - - - - {c22760ec-b51c-49c2-9046-9b143e53f839} - - - {0ded816f-d6d8-4a25-80dc-523dde93cf81} - {d9d1345e-7f2b-4795-991b-329acbef5a3a} - {7456d55f-3559-46e5-b237-d7430adb61d3} - - - - - - - - - - - - - {e26e74b1-8ca5-437e-b6b1-784bfc2f064f} - - - {e9f56c30-0bd7-4728-bede-81a308bfeb87} - Qt-Secret - Qt-Secret - x:390;y:-25 - x:-55;y:-30;w:110;h:60 - 0 - - - - - - - - - - - - - {e8737647-b81d-4ffc-9590-1be3f88f6863} - - - {0448e403-ef91-4ed8-9a92-6cc96e246407} - {e26e74b1-8ca5-437e-b6b1-784bfc2f064f} - {155d97c2-3148-41d5-8783-709e51e52482} - - - - - - - - - - - - - {d46f31e4-5658-411a-ad00-ed49eccd6d19} - - - {1579610b-168b-45b5-8a9f-8b8f79cb3705} - {e26e74b1-8ca5-437e-b6b1-784bfc2f064f} - {787259f9-aabe-4c93-be84-23639f7fbcc3} - - - - - - - - 1564305456003 - General - - - - - - - - - - {2dfe706c-5751-4433-9565-f86835af13bb} - - - - - - - - {2dfe706c-5751-4433-9565-f86835af13bb} - 1 - - - QuasarAppLib - - - - - - - {d51b5a71-74cc-42da-a35f-20676c490201} - - - - - - - - {d51b5a71-74cc-42da-a35f-20676c490201} - 1 - - - QuasarApp - - - - - - - - - - - - - - - - - - - - - {c544a3f6-c5b6-4f4f-9c40-5d5969e93633} - - - - - - - - {c544a3f6-c5b6-4f4f-9c40-5d5969e93633} - 1 - - - Snake - - - - - - - {34dd2fbb-3112-4b22-b369-7fd071dff2a7} - - - - - - - - {34dd2fbb-3112-4b22-b369-7fd071dff2a7} - 1 - - - Snake - - - - - - - {3988bb54-f1c2-49f9-84d7-be11c76353e0} - - - - - - - - {3988bb54-f1c2-49f9-84d7-be11c76353e0} - - - {34dd2fbb-3112-4b22-b369-7fd071dff2a7} - {56f5d199-029a-4d7d-a667-63e884b121c9} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {d2fbf41a-804d-49c3-b362-89a71531fc8d} - - - - - - - - {d2fbf41a-804d-49c3-b362-89a71531fc8d} - 1 - - - ClientProtocol - - - - - - - {3eafef02-7a87-4877-8889-72ea7cb240e9} - - - - - - - - {3eafef02-7a87-4877-8889-72ea7cb240e9} - 1 - - - ClientProtocol - - - - - - - {bd120e71-435b-4b77-8dbc-4965cfdb5b86} - - - - - - - - {bd120e71-435b-4b77-8dbc-4965cfdb5b86} - - - {3eafef02-7a87-4877-8889-72ea7cb240e9} - {d51b5a71-74cc-42da-a35f-20676c490201} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {4a9e7467-b0c4-4f5a-8041-555c514ef17b} - - - - - - - - {4a9e7467-b0c4-4f5a-8041-555c514ef17b} - 1 - - - Client - - - - - - - {d1deca32-81c8-4f70-8671-17076ea8633b} - - - - - - - - {d1deca32-81c8-4f70-8671-17076ea8633b} - 1 - - - Terminal - - - - - - - {cc0dbaf1-ad4e-4376-a985-935b482e7ab9} - - - - - - - - {cc0dbaf1-ad4e-4376-a985-935b482e7ab9} - - - {d1deca32-81c8-4f70-8671-17076ea8633b} - {b4ce19d6-e501-4fa6-82c5-791fab5b94eb} - - - - - - - - - - {9636e57a-651b-4c78-bb85-ecfd66d802e1} - - - - - - - - {9636e57a-651b-4c78-bb85-ecfd66d802e1} - - - {d1deca32-81c8-4f70-8671-17076ea8633b} - {d51b5a71-74cc-42da-a35f-20676c490201} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {5fcda5bd-7958-4eed-a464-ffe2e6681744} - - - - - - - - {5fcda5bd-7958-4eed-a464-ffe2e6681744} - 1 - - - ServerProtocol - - - - - - - {b4ce19d6-e501-4fa6-82c5-791fab5b94eb} - - - - - - - - {b4ce19d6-e501-4fa6-82c5-791fab5b94eb} - 1 - - - ServerProtocol - - - - - - - {a7c4b36c-f545-48d1-ad2d-7e49f671c835} - - - - - - - - {a7c4b36c-f545-48d1-ad2d-7e49f671c835} - - - {b4ce19d6-e501-4fa6-82c5-791fab5b94eb} - {d51b5a71-74cc-42da-a35f-20676c490201} - - - - - - - - - - {0fe0f577-4b80-4118-b36e-01f6cc55bebd} - - - - - - - - {0fe0f577-4b80-4118-b36e-01f6cc55bebd} - - - {b4ce19d6-e501-4fa6-82c5-791fab5b94eb} - {d51b5a71-74cc-42da-a35f-20676c490201} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {5763646f-1ed3-4f15-bc36-6aead88f6cd3} - - - - - - - - {5763646f-1ed3-4f15-bc36-6aead88f6cd3} - 1 - - - Daemon - - - - - - - {32657f3f-5cc1-470b-a557-dd69c7616889} - - - - - - - - {32657f3f-5cc1-470b-a557-dd69c7616889} - 1 - - - Daemon - - - - - - - {50a42ad1-baf5-41a7-b562-5bf02a1a6c3c} - - - - - - - - {50a42ad1-baf5-41a7-b562-5bf02a1a6c3c} - - - {32657f3f-5cc1-470b-a557-dd69c7616889} - {b4ce19d6-e501-4fa6-82c5-791fab5b94eb} - - - - - - - - - - {ecb68506-18c1-41f3-8b98-8c66e91cbc0e} - - - - - - - - {ecb68506-18c1-41f3-8b98-8c66e91cbc0e} - - - {32657f3f-5cc1-470b-a557-dd69c7616889} - {3eafef02-7a87-4877-8889-72ea7cb240e9} - - - - - - - - - - {f45b5326-c235-436b-8298-517cddf84c79} - - - - - - - - {f45b5326-c235-436b-8298-517cddf84c79} - - - {32657f3f-5cc1-470b-a557-dd69c7616889} - {d51b5a71-74cc-42da-a35f-20676c490201} - - - - - - - - - - {e66ff8e1-b4e0-44cd-b7c0-48388d23d78e} - - - - - - - - {e66ff8e1-b4e0-44cd-b7c0-48388d23d78e} - - - {32657f3f-5cc1-470b-a557-dd69c7616889} - {03379880-0ad4-4eb8-9e06-c81f1c8f9e26} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {56f5d199-029a-4d7d-a667-63e884b121c9} - - - - - - - - {56f5d199-029a-4d7d-a667-63e884b121c9} - - - Client - - - - - - - {97f59dd5-871c-49b7-978d-b25f974d6251} - - - - - - - - {97f59dd5-871c-49b7-978d-b25f974d6251} - - - {56f5d199-029a-4d7d-a667-63e884b121c9} - {d51b5a71-74cc-42da-a35f-20676c490201} - - - - - - - - - - {6415c533-44d8-4da0-acf0-81e5a137ac1b} - - - - - - - - {6415c533-44d8-4da0-acf0-81e5a137ac1b} - - - {56f5d199-029a-4d7d-a667-63e884b121c9} - {3eafef02-7a87-4877-8889-72ea7cb240e9} - - - - - - - - - - - - - - - - - - - - - {03379880-0ad4-4eb8-9e06-c81f1c8f9e26} - - - - - - - - {03379880-0ad4-4eb8-9e06-c81f1c8f9e26} - - - Server - - - - - - - {11bfbdaa-13cf-4fd3-9161-b54d2c49e357} - - - - - - - - {11bfbdaa-13cf-4fd3-9161-b54d2c49e357} - - - {03379880-0ad4-4eb8-9e06-c81f1c8f9e26} - {d51b5a71-74cc-42da-a35f-20676c490201} - - - - - - - - - - {d1846a67-a2c7-4eb9-89ea-f1d905dbdaf2} - - - - - - - - {d1846a67-a2c7-4eb9-89ea-f1d905dbdaf2} - - - {03379880-0ad4-4eb8-9e06-c81f1c8f9e26} - {b4ce19d6-e501-4fa6-82c5-791fab5b94eb} - - - - - - - - - - {a16e9f9d-a7f1-4759-9729-c3ae12cd7534} - - - - - - - - {a16e9f9d-a7f1-4759-9729-c3ae12cd7534} - - - {03379880-0ad4-4eb8-9e06-c81f1c8f9e26} - {3eafef02-7a87-4877-8889-72ea7cb240e9} - - - - - - - - - - - - - - - - - - - - - {4f6ef33d-c575-448e-a0da-f31a5f6434f0} - - - - - - - - {4f6ef33d-c575-448e-a0da-f31a5f6434f0} - 1 - - - SnakeUtils - - - - - - - {179586c1-7898-4183-9bf5-a77ba74f8f0d} - - - - - - - - {179586c1-7898-4183-9bf5-a77ba74f8f0d} - 1 - - - SnakeUtils - - - - - - - {0ded816f-d6d8-4a25-80dc-523dde93cf81} - - - - - - - - {0ded816f-d6d8-4a25-80dc-523dde93cf81} - - - {179586c1-7898-4183-9bf5-a77ba74f8f0d} - {56f5d199-029a-4d7d-a667-63e884b121c9} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {e6099df6-b1b3-4db3-b0ee-296006811b8d} - - - - - - - - {e6099df6-b1b3-4db3-b0ee-296006811b8d} - 1 - - - SnakeServer - - - - - - - {2fa91d20-c7ff-4432-9e89-d4c57d9d0953} - - - - - - - - {2fa91d20-c7ff-4432-9e89-d4c57d9d0953} - 1 - - - Qt-Secret - - - - - - - {e9f56c30-0bd7-4728-bede-81a308bfeb87} - - - - - - - - {e9f56c30-0bd7-4728-bede-81a308bfeb87} - 1 - - - Qt-Secret - - - - - - - {0448e403-ef91-4ed8-9a92-6cc96e246407} - - - - - - - - {0448e403-ef91-4ed8-9a92-6cc96e246407} - - - {e9f56c30-0bd7-4728-bede-81a308bfeb87} - {b4ce19d6-e501-4fa6-82c5-791fab5b94eb} - - - - - - - - - - {1579610b-168b-45b5-8a9f-8b8f79cb3705} - - - - - - - - {1579610b-168b-45b5-8a9f-8b8f79cb3705} - - - {e9f56c30-0bd7-4728-bede-81a308bfeb87} - {3eafef02-7a87-4877-8889-72ea7cb240e9} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doxygen.conf b/doxygen.conf new file mode 100644 index 0000000..b5b1809 --- /dev/null +++ b/doxygen.conf @@ -0,0 +1,2495 @@ +# Doxyfile 1.8.13 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a double hash (##) is considered a comment and is placed in +# front of the TAG it is preceding. +# +# All text after a single hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists, items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (\" \"). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all text +# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv +# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv +# for the list of possible encodings. +# The default value is: UTF-8. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by +# double-quotes, unless you are using Doxywizard) that should identify the +# project for which the documentation is generated. This name is used in the +# title of most generated pages and in a few other places. +# The default value is: My Project. + +PROJECT_NAME = SnakeProject + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. This +# could be handy for archiving the generated documentation or if some version +# control system is used. + +PROJECT_NUMBER = + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer a +# quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = + +# With the PROJECT_LOGO tag one can specify a logo or an icon that is included +# in the documentation. The maximum height of the logo should not exceed 55 +# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy +# the logo to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path +# into which the generated documentation will be written. If a relative path is +# entered, it will be relative to the location where doxygen was started. If +# left blank the current directory will be used. + +OUTPUT_DIRECTORY = docs + +# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- +# directories (in 2 levels) under the output directory of each output format and +# will distribute the generated files over these directories. Enabling this +# option can be useful when feeding doxygen a huge amount of source files, where +# putting all generated files in the same directory would otherwise causes +# performance problems for the file system. +# The default value is: NO. + +CREATE_SUBDIRS = NO + +# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII +# characters to appear in the names of generated files. If set to NO, non-ASCII +# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode +# U+3044. +# The default value is: NO. + +ALLOW_UNICODE_NAMES = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, +# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), +# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, +# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), +# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, +# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, +# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, +# Ukrainian and Vietnamese. +# The default value is: English. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member +# descriptions after the members that are listed in the file and class +# documentation (similar to Javadoc). Set to NO to disable this. +# The default value is: YES. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief +# description of a member or function before the detailed description +# +# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. +# The default value is: YES. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator that is +# used to form the text in various listings. Each string in this list, if found +# as the leading text of the brief description, will be stripped from the text +# and the result, after processing the whole list, is used as the annotated +# text. Otherwise, the brief description is used as-is. If left blank, the +# following values are used ($name is automatically replaced with the name of +# the entity):The $name class, The $name widget, The $name file, is, provides, +# specifies, contains, represents, a, an and the. + +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# doxygen will generate a detailed section even if there is only a brief +# description. +# The default value is: NO. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. +# The default value is: NO. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path +# before files name in the file list and in the header files. If set to NO the +# shortest path that makes the file name unique will be used +# The default value is: YES. + +FULL_PATH_NAMES = YES + +# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. +# Stripping is only done if one of the specified strings matches the left-hand +# part of the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the path to +# strip. +# +# Note that you can specify absolute paths here, but also relative paths, which +# will be relative from the directory where doxygen is started. +# This tag requires that the tag FULL_PATH_NAMES is set to YES. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the +# path mentioned in the documentation of a class, which tells the reader which +# header file to include in order to use a class. If left blank only the name of +# the header file containing the class definition is used. Otherwise one should +# specify the list of include paths that are normally passed to the compiler +# using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but +# less readable) file names. This can be useful is your file systems doesn't +# support long names like on DOS, Mac, or CD-ROM. +# The default value is: NO. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the +# first line (until the first dot) of a Javadoc-style comment as the brief +# description. If set to NO, the Javadoc-style will behave just like regular Qt- +# style comments (thus requiring an explicit @brief command for a brief +# description.) +# The default value is: NO. + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first +# line (until the first dot) of a Qt-style comment as the brief description. If +# set to NO, the Qt-style will behave just like regular Qt-style comments (thus +# requiring an explicit \brief command for a brief description.) +# The default value is: NO. + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a +# multi-line C++ special comment block (i.e. a block of //! or /// comments) as +# a brief description. This used to be the default behavior. The new default is +# to treat a multi-line C++ comment block as a detailed description. Set this +# tag to YES if you prefer the old behavior instead. +# +# Note that setting this tag to YES also means that rational rose comments are +# not recognized any more. +# The default value is: NO. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the +# documentation from any documented member that it re-implements. +# The default value is: YES. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new +# page for each member. If set to NO, the documentation of a member will be part +# of the file/class/namespace that contains it. +# The default value is: NO. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen +# uses this value to replace tabs by spaces in code fragments. +# Minimum value: 1, maximum value: 16, default value: 4. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that act as commands in +# the documentation. An alias has the form: +# name=value +# For example adding +# "sideeffect=@par Side Effects:\n" +# will allow you to put the command \sideeffect (or @sideeffect) in the +# documentation, which will result in a user-defined paragraph with heading +# "Side Effects:". You can put \n's in the value part of an alias to insert +# newlines. + +ALIASES = + +# This tag can be used to specify a number of word-keyword mappings (TCL only). +# A mapping has the form "name=value". For example adding "class=itcl::class" +# will allow you to use the command class in the itcl::class meaning. + +TCL_SUBST = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. For +# instance, some of the names that are used will be different. The list of all +# members will be omitted, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or +# Python sources only. Doxygen will then generate output that is more tailored +# for that language. For instance, namespaces will be presented as packages, +# qualified scopes will look different, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources. Doxygen will then generate output that is tailored for Fortran. +# The default value is: NO. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for VHDL. +# The default value is: NO. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, and +# language is one of the parsers supported by doxygen: IDL, Java, Javascript, +# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran: +# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran: +# Fortran. In the later case the parser tries to guess whether the code is fixed +# or free formatted code, this is the default for Fortran type files), VHDL. For +# instance to make doxygen treat .inc files as Fortran files (default is PHP), +# and .f files as C (default is Fortran), use: inc=Fortran f=C. +# +# Note: For files without extension you can use no_extension as a placeholder. +# +# Note that for custom extensions you also need to set FILE_PATTERNS otherwise +# the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments +# according to the Markdown format, which allows for more readable +# documentation. See http://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you can +# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in +# case of backward compatibilities issues. +# The default value is: YES. + +MARKDOWN_SUPPORT = YES + +# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up +# to that level are automatically included in the table of contents, even if +# they do not have an id attribute. +# Note: This feature currently applies only to Markdown headings. +# Minimum value: 0, maximum value: 99, default value: 0. +# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. + +TOC_INCLUDE_HEADINGS = 0 + +# When enabled doxygen tries to link words that correspond to documented +# classes, or namespaces to their corresponding documentation. Such a link can +# be prevented in individual cases by putting a % sign in front of the word or +# globally by setting AUTOLINK_SUPPORT to NO. +# The default value is: YES. + +AUTOLINK_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should set this +# tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); +# versus func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. +# The default value is: NO. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. +# The default value is: NO. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: +# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen +# will parse them like normal C++ but will assume all classes use public instead +# of private inheritance when no explicit protection keyword is present. +# The default value is: NO. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES will make +# doxygen to replace the get and set methods by a property in the documentation. +# This will only work if the methods are indeed getting or setting a simple +# type. If this is not the case, or you want to show the methods anyway, you +# should set this option to NO. +# The default value is: YES. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. +# The default value is: NO. + +DISTRIBUTE_GROUP_DOC = NO + +# If one adds a struct or class to a group and this option is enabled, then also +# any nested class or struct is added to the same group. By default this option +# is disabled and one has to add nested compounds explicitly via \ingroup. +# The default value is: NO. + +GROUP_NESTED_COMPOUNDS = NO + +# Set the SUBGROUPING tag to YES to allow class member groups of the same type +# (for instance a group of public functions) to be put as a subgroup of that +# type (e.g. under the Public Functions section). Set it to NO to prevent +# subgrouping. Alternatively, this can be done per class using the +# \nosubgrouping command. +# The default value is: YES. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions +# are shown inside the group in which they are included (e.g. using \ingroup) +# instead of on a separate page (for HTML and Man pages) or section (for LaTeX +# and RTF). +# +# Note that this feature does not work in combination with +# SEPARATE_MEMBER_PAGES. +# The default value is: NO. + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions +# with only public data fields or simple typedef fields will be shown inline in +# the documentation of the scope in which they are defined (i.e. file, +# namespace, or group documentation), provided this scope is documented. If set +# to NO, structs, classes, and unions are shown on a separate page (for HTML and +# Man pages) or section (for LaTeX and RTF). +# The default value is: NO. + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or +# enum is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically be +# useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. +# The default value is: NO. + +TYPEDEF_HIDES_STRUCT = NO + +# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This +# cache is used to resolve symbols given their name and scope. Since this can be +# an expensive process and often the same symbol appears multiple times in the +# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small +# doxygen will become slower. If the cache is too large, memory is wasted. The +# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range +# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 +# symbols. At the end of a run doxygen will report the cache usage and suggest +# the optimal cache size from a speed point of view. +# Minimum value: 0, maximum value: 9, default value: 0. + +LOOKUP_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in +# documentation are documented, even if no documentation was available. Private +# class members and static file members will be hidden unless the +# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. +# Note: This will also disable the warnings about undocumented members that are +# normally produced when WARNINGS is set to YES. +# The default value is: NO. + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will +# be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal +# scope will be included in the documentation. +# The default value is: NO. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be +# included in the documentation. +# The default value is: NO. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined +# locally in source files will be included in the documentation. If set to NO, +# only classes defined in header files are included. Does not have any effect +# for Java sources. +# The default value is: YES. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. If set to YES, local methods, +# which are defined in the implementation section but not in the interface are +# included in the documentation. If set to NO, only methods in the interface are +# included. +# The default value is: NO. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base name of +# the file that contains the anonymous namespace. By default anonymous namespace +# are hidden. +# The default value is: NO. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all +# undocumented members inside documented classes or files. If set to NO these +# members will be included in the various overviews, but no documentation +# section is generated. This option has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. If set +# to NO, these classes will be included in the various overviews. This option +# has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend +# (class|struct|union) declarations. If set to NO, these declarations will be +# included in the documentation. +# The default value is: NO. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any +# documentation blocks found inside the body of a function. If set to NO, these +# blocks will be appended to the function's detailed documentation block. +# The default value is: NO. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation that is typed after a +# \internal command is included. If the tag is set to NO then the documentation +# will be excluded. Set it to YES to include the internal documentation. +# The default value is: NO. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file +# names in lower-case letters. If set to YES, upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. +# The default value is: system dependent. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with +# their full class and namespace scopes in the documentation. If set to YES, the +# scope will be hidden. +# The default value is: NO. + +HIDE_SCOPE_NAMES = NO + +# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will +# append additional text to a page's title, such as Class Reference. If set to +# YES the compound reference will be hidden. +# The default value is: NO. + +HIDE_COMPOUND_REFERENCE= NO + +# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of +# the files that are included by a file in the documentation of that file. +# The default value is: YES. + +SHOW_INCLUDE_FILES = YES + +# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each +# grouped member an include statement to the documentation, telling the reader +# which file to include in order to use the member. +# The default value is: NO. + +SHOW_GROUPED_MEMB_INC = NO + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include +# files with double quotes in the documentation rather than with sharp brackets. +# The default value is: NO. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the +# documentation for inline members. +# The default value is: YES. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the +# (detailed) documentation of file and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. +# The default value is: YES. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief +# descriptions of file, namespace and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. Note that +# this will also influence the order of the classes in the class list. +# The default value is: NO. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the +# (brief and detailed) documentation of class members so that constructors and +# destructors are listed first. If set to NO the constructors will appear in the +# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. +# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief +# member documentation. +# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting +# detailed member documentation. +# The default value is: NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy +# of group names into alphabetical order. If set to NO the group names will +# appear in their defined order. +# The default value is: NO. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by +# fully-qualified names, including namespaces. If set to NO, the class list will +# be sorted only by class name, not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the alphabetical +# list. +# The default value is: NO. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper +# type resolution of all parameters of a function it will reject a match between +# the prototype and the implementation of a member function even if there is +# only one candidate or it is obvious which candidate to choose by doing a +# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still +# accept a match between prototype and implementation in such cases. +# The default value is: NO. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo +# list. This list is created by putting \todo commands in the documentation. +# The default value is: YES. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test +# list. This list is created by putting \test commands in the documentation. +# The default value is: YES. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug +# list. This list is created by putting \bug commands in the documentation. +# The default value is: YES. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) +# the deprecated list. This list is created by putting \deprecated commands in +# the documentation. +# The default value is: YES. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional documentation +# sections, marked by \if ... \endif and \cond +# ... \endcond blocks. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the +# initial value of a variable or macro / define can have for it to appear in the +# documentation. If the initializer consists of more lines than specified here +# it will be hidden. Use a value of 0 to hide initializers completely. The +# appearance of the value of individual variables and macros / defines can be +# controlled using \showinitializer or \hideinitializer command in the +# documentation regardless of this setting. +# Minimum value: 0, maximum value: 10000, default value: 30. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at +# the bottom of the documentation of classes and structs. If set to YES, the +# list will mention the files that were used to generate the documentation. +# The default value is: YES. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This +# will remove the Files entry from the Quick Index and from the Folder Tree View +# (if specified). +# The default value is: YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces +# page. This will remove the Namespaces entry from the Quick Index and from the +# Folder Tree View (if specified). +# The default value is: YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command command input-file, where command is the value of the +# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided +# by doxygen. Whatever the program writes to standard output is used as the file +# version. For an example see the documentation. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. You can +# optionally specify a file name after the option, if omitted DoxygenLayout.xml +# will be used as the name of the layout file. +# +# Note that if you run doxygen from a directory containing a file called +# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE +# tag is left empty. + +LAYOUT_FILE = CMake/DoxyStyle/DoxygenLayout.xml + +# The CITE_BIB_FILES tag can be used to specify one or more bib files containing +# the reference definitions. This must be a list of .bib files. The .bib +# extension is automatically appended if omitted. This requires the bibtex tool +# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. +# For LaTeX the style of the bibliography can be controlled using +# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the +# search path. See also \cite for info how to create references. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated to +# standard output by doxygen. If QUIET is set to YES this implies that the +# messages are off. +# The default value is: NO. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES +# this implies that the warnings are on. +# +# Tip: Turn warnings on while writing the documentation. +# The default value is: YES. + +WARNINGS = YES + +# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate +# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: YES. + +WARN_IF_UNDOCUMENTED = YES + +# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some parameters +# in a documented function, or documenting parameters that don't exist or using +# markup commands wrongly. +# The default value is: YES. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that +# are documented, but have no documentation for their parameters or return +# value. If set to NO, doxygen will only warn about wrong or incomplete +# parameter documentation, but not about the absence of documentation. +# The default value is: NO. + +WARN_NO_PARAMDOC = NO + +# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when +# a warning is encountered. +# The default value is: NO. + +WARN_AS_ERROR = NO + +# The WARN_FORMAT tag determines the format of the warning messages that doxygen +# can produce. The string should contain the $file, $line, and $text tags, which +# will be replaced by the file and line number from which the warning originated +# and the warning text. Optionally the format may contain $version, which will +# be replaced by the version of the file (if it could be obtained via +# FILE_VERSION_FILTER) +# The default value is: $file:$line: $text. + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning and error +# messages should be written. If left blank the output is written to standard +# error (stderr). + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag is used to specify the files and/or directories that contain +# documented source files. You may enter file names like myfile.cpp or +# directories like /usr/src/myproject. Separate the files or directories with +# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING +# Note: If this tag is empty the current directory is searched. + +INPUT = ./src \ + ./README.md + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses +# libiconv (or the iconv built into libc) for the transcoding. See the libiconv +# documentation (see: http://www.gnu.org/software/libiconv) for the list of +# possible encodings. +# The default value is: UTF-8. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and +# *.h) to filter out the source-files in the directories. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# read by doxygen. +# +# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, +# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, +# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, +# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, +# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf and *.qsf. + +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.idl \ + *.ddl \ + *.odl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.cs \ + *.d \ + *.php \ + *.php4 \ + *.php5 \ + *.phtml \ + *.inc \ + *.m \ + *.markdown \ + *.md \ + *.mm \ + *.dox \ + *.py \ + *.pyw \ + *.f90 \ + *.f95 \ + *.f03 \ + *.f08 \ + *.f \ + *.for \ + *.tcl \ + *.vhd \ + *.vhdl \ + *.ucf \ + *.qsf + +# The RECURSIVE tag can be used to specify whether or not subdirectories should +# be searched for input files as well. +# The default value is: NO. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. +# The default value is: NO. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories use the pattern */test/* + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or directories +# that contain example code fragments that are included (see the \include +# command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank all +# files are included. + +EXAMPLE_PATTERNS = * + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude commands +# irrespective of the value of the RECURSIVE tag. +# The default value is: NO. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or directories +# that contain images that are to be included in the documentation (see the +# \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command: +# +# +# +# where is the value of the INPUT_FILTER tag, and is the +# name of an input file. Doxygen will then use the output that the filter +# program writes to standard output. If FILTER_PATTERNS is specified, this tag +# will be ignored. +# +# Note that the filter must not add or remove lines; it is applied before the +# code is scanned, but not when the output code is generated. If lines are added +# or removed, the anchors will not be placed correctly. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: pattern=filter +# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how +# filters are used. If the FILTER_PATTERNS tag is empty or if none of the +# patterns match the file name, INPUT_FILTER is applied. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will also be used to filter the input files that are used for +# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). +# The default value is: NO. + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and +# it is also possible to disable source filtering for a specific pattern using +# *.ext= (so without naming a filter). +# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. + +FILTER_SOURCE_PATTERNS = + +# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page +# (index.html). This can be useful if you have a project on for instance GitHub +# and want to reuse the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = ./README.md + +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will be +# generated. Documented entities will be cross-referenced with these sources. +# +# Note: To get rid of all source code in the generated output, make sure that +# also VERBATIM_HEADERS is set to NO. +# The default value is: NO. + +SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body of functions, +# classes and enums directly into the documentation. +# The default value is: NO. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any +# special comment blocks from generated source code fragments. Normal C, C++ and +# Fortran comments will always remain visible. +# The default value is: YES. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES then for each documented +# function all documented functions referencing it will be listed. +# The default value is: NO. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES then for each documented function +# all documented entities called/used by that function will be listed. +# The default value is: NO. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set +# to YES then the hyperlinks from functions in REFERENCES_RELATION and +# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will +# link to the documentation. +# The default value is: YES. + +REFERENCES_LINK_SOURCE = YES + +# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the +# source code will show a tooltip with additional information such as prototype, +# brief description and links to the definition and documentation. Since this +# will make the HTML file larger and loading of large files a bit slower, you +# can opt to disable this feature. +# The default value is: YES. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +SOURCE_TOOLTIPS = YES + +# If the USE_HTAGS tag is set to YES then the references to source code will +# point to the HTML generated by the htags(1) tool instead of doxygen built-in +# source browser. The htags tool is part of GNU's global source tagging system +# (see http://www.gnu.org/software/global/global.html). You will need version +# 4.8.6 or higher. +# +# To use it do the following: +# - Install the latest version of global +# - Enable SOURCE_BROWSER and USE_HTAGS in the config file +# - Make sure the INPUT points to the root of the source tree +# - Run doxygen as normal +# +# Doxygen will invoke htags (and that will in turn invoke gtags), so these +# tools must be available from the command line (i.e. in the search path). +# +# The result: instead of the source browser generated by doxygen, the links to +# source code will now point to the output of htags. +# The default value is: NO. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a +# verbatim copy of the header file for each class for which an include is +# specified. Set to NO to disable this. +# See also: Section \class. +# The default value is: YES. + +VERBATIM_HEADERS = YES + +# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the +# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the +# cost of reduced performance. This can be particularly helpful with template +# rich C++ code for which doxygen's built-in parser lacks the necessary type +# information. +# Note: The availability of this option depends on whether or not doxygen was +# generated with the -Duse-libclang=ON option for CMake. +# The default value is: NO. + +CLANG_ASSISTED_PARSING = NO + +# If clang assisted parsing is enabled you can provide the compiler with command +# line options that you would normally use when invoking the compiler. Note that +# the include paths will already be set by doxygen for the files and directories +# specified with INPUT and INCLUDE_PATH. +# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. + +CLANG_OPTIONS = + +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all +# compounds will be generated. Enable this if the project contains a lot of +# classes, structs, unions or interfaces. +# The default value is: YES. + +ALPHABETICAL_INDEX = YES + +# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in +# which the alphabetical index list will be split. +# Minimum value: 1, maximum value: 20, default value: 5. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all classes will +# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag +# can be used to specify a prefix (or a list of prefixes) that should be ignored +# while generating the index headers. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output +# The default value is: YES. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_OUTPUT = . + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each +# generated HTML page (for example: .htm, .php, .asp). +# The default value is: .html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a user-defined HTML header file for +# each generated HTML page. If the tag is left blank doxygen will generate a +# standard header. +# +# To get valid HTML the header file that includes any scripts and style sheets +# that doxygen needs, which is dependent on the configuration options used (e.g. +# the setting GENERATE_TREEVIEW). It is highly recommended to start with a +# default header using +# doxygen -w html new_header.html new_footer.html new_stylesheet.css +# YourConfigFile +# and then modify the file new_header.html. See also section "Doxygen usage" +# for information on how to generate the default header that doxygen normally +# uses. +# Note: The header is subject to change so you typically have to regenerate the +# default header when upgrading to a newer version of doxygen. For a description +# of the possible markers and block names see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each +# generated HTML page. If the tag is left blank doxygen will generate a standard +# footer. See HTML_HEADER for more information on how to generate a default +# footer and what special commands can be used inside the footer. See also +# section "Doxygen usage" for information on how to generate the default footer +# that doxygen normally uses. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style +# sheet that is used by each HTML page. It can be used to fine-tune the look of +# the HTML output. If left blank doxygen will generate a default style sheet. +# See also section "Doxygen usage" for information on how to generate the style +# sheet that doxygen normally uses. +# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as +# it is more robust and this tag (HTML_STYLESHEET) will in the future become +# obsolete. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_STYLESHEET = + +# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined +# cascading style sheets that are included after the standard style sheets +# created by doxygen. Using this option one can overrule certain style aspects. +# This is preferred over using HTML_STYLESHEET since it does not replace the +# standard style sheet and is therefore more robust against future updates. +# Doxygen will copy the style sheet files to the output directory. +# Note: The order of the extra style sheet files is of importance (e.g. the last +# style sheet in the list overrules the setting of the previous ones in the +# list). For an example see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_STYLESHEET = CMake/DoxyStyle/doxygenStyles.css + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that the +# files will be copied as-is; there are no commands or markers available. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen +# will adjust the colors in the style sheet and background images according to +# this color. Hue is specified as an angle on a colorwheel, see +# http://en.wikipedia.org/wiki/Hue for more information. For instance the value +# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 +# purple, and 360 is red again. +# Minimum value: 0, maximum value: 359, default value: 220. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors +# in the HTML output. For a value of 0 the output will use grayscales only. A +# value of 255 will produce the most vivid colors. +# Minimum value: 0, maximum value: 255, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the +# luminance component of the colors in the HTML output. Values below 100 +# gradually make the output lighter, whereas values above 100 make the output +# darker. The value divided by 100 is the actual gamma applied, so 80 represents +# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not +# change the gamma. +# Minimum value: 40, maximum value: 240, default value: 80. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting this +# to YES can help to show when doxygen was last run and thus if the +# documentation is up to date. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_TIMESTAMP = NO + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries +# shown in the various tree structured indices initially; the user can expand +# and collapse entries dynamically later on. Doxygen will expand the tree to +# such a level that at most the specified number of entries are visible (unless +# a fully collapsed tree already exceeds this amount). So setting the number of +# entries 1 will produce a full collapsed tree by default. 0 is a special value +# representing an infinite number of entries and will result in a full expanded +# tree by default. +# Minimum value: 0, maximum value: 9999, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files will be +# generated that can be used as input for Apple's Xcode 3 integrated development +# environment (see: http://developer.apple.com/tools/xcode/), introduced with +# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a +# Makefile in the HTML output directory. Running make will produce the docset in +# that directory and running make install will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at +# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_DOCSET = NO + +# This tag determines the name of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# The default value is: Doxygen generated docs. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# This tag specifies a string that should uniquely identify the documentation +# set bundle. This should be a reverse domain-name style string, e.g. +# com.mycompany.MyDocSet. Doxygen will append .docset to the name. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. +# The default value is: org.doxygen.Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. +# The default value is: Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three +# additional HTML index files: index.hhp, index.hhc, and index.hhk. The +# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop +# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on +# Windows. +# +# The HTML Help Workshop contains a compiler that can convert all HTML output +# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML +# files are now used as the Windows 98 help format, and will replace the old +# Windows help format (.hlp) on all Windows platforms in the future. Compressed +# HTML files also contain an index, a table of contents, and you can search for +# words in the documentation. The HTML workshop also contains a viewer for +# compressed HTML files. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_HTMLHELP = NO + +# The CHM_FILE tag can be used to specify the file name of the resulting .chm +# file. You can add a path in front of the file if the result should not be +# written to the html output directory. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_FILE = + +# The HHC_LOCATION tag can be used to specify the location (absolute path +# including file name) of the HTML help compiler (hhc.exe). If non-empty, +# doxygen will try to run the HTML help compiler on the generated index.hhp. +# The file has to be specified with full path. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +HHC_LOCATION = + +# The GENERATE_CHI flag controls if a separate .chi index file is generated +# (YES) or that it should be included in the master .chm file (NO). +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +GENERATE_CHI = NO + +# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) +# and project file content. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_INDEX_ENCODING = + +# The BINARY_TOC flag controls whether a binary table of contents is generated +# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it +# enables the Previous and Next buttons. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members to +# the table of contents of the HTML help documentation and to the tree view. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that +# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help +# (.qch) of the generated HTML documentation. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify +# the file name of the resulting .qch file. The path specified is relative to +# the HTML output folder. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help +# Project output. For more information please see Qt Help Project / Namespace +# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt +# Help Project output. For more information please see Qt Help Project / Virtual +# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- +# folders). +# The default value is: doc. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_VIRTUAL_FOLDER = doc + +# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom +# filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's filter section matches. Qt Help Project / Filter Attributes (see: +# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_SECT_FILTER_ATTRS = + +# The QHG_LOCATION tag can be used to specify the location of Qt's +# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the +# generated .qhp file. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be +# generated, together with the HTML files, they form an Eclipse help plugin. To +# install this plugin and make it available under the help contents menu in +# Eclipse, the contents of the directory containing the HTML and XML files needs +# to be copied into the plugins directory of eclipse. The name of the directory +# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. +# After copying Eclipse needs to be restarted before the help appears. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the Eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have this +# name. Each documentation set should have its own identifier. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. + +ECLIPSE_DOC_ID = QuasarApp. + +# If you want full control over the layout of the generated HTML pages it might +# be necessary to disable the index and replace it with your own. The +# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top +# of each HTML page. A value of NO enables the index and the value YES disables +# it. Since the tabs in the index contain the same information as the navigation +# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. If the tag +# value is set to YES, a side panel will be generated containing a tree-like +# index structure (just like the one that is generated for HTML Help). For this +# to work a browser that supports JavaScript, DHTML, CSS and frames is required +# (i.e. any modern browser). Windows users are probably better off using the +# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can +# further fine-tune the look of the index. As an example, the default style +# sheet generated by doxygen has an example that shows how to put an image at +# the root of the tree instead of the PROJECT_NAME. Since the tree basically has +# the same information as the tab index, you could consider setting +# DISABLE_INDEX to YES when enabling this option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_TREEVIEW = YES + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that +# doxygen will group on one line in the generated HTML documentation. +# +# Note that a value of 0 will completely suppress the enum values from appearing +# in the overview section. +# Minimum value: 0, maximum value: 20, default value: 4. +# This tag requires that the tag GENERATE_HTML is set to YES. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used +# to set the initial width (in pixels) of the frame in which the tree is shown. +# Minimum value: 0, maximum value: 1500, default value: 250. +# This tag requires that the tag GENERATE_HTML is set to YES. + +TREEVIEW_WIDTH = 250 + +# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to +# external symbols imported via tag files in a separate window. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of LaTeX formulas included as images in +# the HTML documentation. When you change the font size after a successful +# doxygen run you need to manually remove any form_*.png images from the HTML +# output directory to force them to be regenerated. +# Minimum value: 8, maximum value: 50, default value: 10. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are not +# supported properly for IE 6.0, but are supported on all modern browsers. +# +# Note that when changing this option you need to delete any form_*.png files in +# the HTML output directory before the changes have effect. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see +# http://www.mathjax.org) which uses client side Javascript for the rendering +# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX +# installed or if you want to formulas look prettier in the HTML output. When +# enabled you may also need to install MathJax separately and configure the path +# to it using the MATHJAX_RELPATH option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +USE_MATHJAX = NO + +# When MathJax is enabled you can set the default output format to be used for +# the MathJax output. See the MathJax site (see: +# http://docs.mathjax.org/en/latest/output.html) for more details. +# Possible values are: HTML-CSS (which is slower, but has the best +# compatibility), NativeMML (i.e. MathML) and SVG. +# The default value is: HTML-CSS. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the HTML +# output directory using the MATHJAX_RELPATH option. The destination directory +# should contain the MathJax.js script. For instance, if the mathjax directory +# is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax +# Content Delivery Network so you can quickly see the result without installing +# MathJax. However, it is strongly recommended to install a local copy of +# MathJax from http://www.mathjax.org before deployment. +# The default value is: http://cdn.mathjax.org/mathjax/latest. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest + +# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax +# extension names that should be enabled during MathJax rendering. For example +# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_EXTENSIONS = + +# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces +# of code that will be used on startup of the MathJax code. See the MathJax site +# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# example see the documentation. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_CODEFILE = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box for +# the HTML output. The underlying search engine uses javascript and DHTML and +# should work on any modern browser. Note that when using HTML help +# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) +# there is already a search function so this one should typically be disabled. +# For large projects the javascript based search engine can be slow, then +# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to +# search using the keyboard; to jump to the search box use + S +# (what the is depends on the OS and browser, but it is typically +# , /