Drop Qt4, libgcrypt, qtmobility dependencies
This commit is contained in:
parent
e3fb308ea1
commit
bb5292aa8d
54 changed files with 96 additions and 818 deletions
10
.github/CONTRIBUTING.md
vendored
10
.github/CONTRIBUTING.md
vendored
|
@ -4,16 +4,6 @@
|
|||
|
||||
Cockatrice is written in C++-03, so do not use C++11 constructs such as `auto`.
|
||||
|
||||
Cockatrice support both Qt 4 and Qt 5, so make sure that your code compiles
|
||||
with both. If there have been breaking changes between Qt 4 and 5, use a
|
||||
statement such as
|
||||
|
||||
#if QT_VERSION >= 0x500000
|
||||
doSomethingWithQt5();
|
||||
#else
|
||||
doSomethingWithQt4();
|
||||
#endif
|
||||
|
||||
For consistency, use Qt data structures where possible, such as `QString` over
|
||||
`std::string` or `QList` over `std::vector`.
|
||||
|
||||
|
|
14
.travis.yml
14
.travis.yml
|
@ -2,26 +2,20 @@ language: cpp
|
|||
matrix:
|
||||
fast_finish: true
|
||||
include:
|
||||
# linux precise debug build, precise + gcc + qt4
|
||||
- os: linux
|
||||
env: QT4=1 BUILDTYPE=Debug DIST=precise
|
||||
# linux debug build, trusty + gcc + qt5
|
||||
- os: linux
|
||||
dist: trusty
|
||||
env: QT4=0 BUILDTYPE=Debug DIST=trusty
|
||||
env: BUILDTYPE=Debug DIST=trusty
|
||||
# osx debug build, osx + clang + qt5
|
||||
- os: osx
|
||||
env: QT4=0 BUILDTYPE=Debug
|
||||
# linux precise release build, precise + gcc + qt4
|
||||
- os: linux
|
||||
env: QT4=1 BUILDTYPE=Release DIST=precise
|
||||
env: BUILDTYPE=Debug
|
||||
# linux trusty release build, precise + gcc + qt5
|
||||
- os: linux
|
||||
dist: trusty
|
||||
env: QT4=0 BUILDTYPE=Release DIST=trusty
|
||||
env: BUILDTYPE=Release DIST=trusty
|
||||
# osx release build, osx + gcc + qt5
|
||||
- os: osx
|
||||
env: QT4=0 BUILDTYPE=Release
|
||||
env: BUILDTYPE=Release
|
||||
script: ./travis-compile.sh
|
||||
install: ./travis-dependencies.sh
|
||||
cache: apt
|
||||
|
|
|
@ -110,17 +110,11 @@ IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
|||
ADD_DEFINITIONS("-DSFMT_MEXP=19937")
|
||||
ENDIF()
|
||||
|
||||
# Find Qt and enable the needed features
|
||||
# Default is Qt5 unless WITH_QT4 option is enabled
|
||||
option(WITH_QT4 "Force the use of Qt4 libraries" OFF)
|
||||
# Find Qt5
|
||||
OPTION(UPDATE_TRANSLATIONS "Update translations on compile" OFF)
|
||||
MESSAGE(STATUS "UPDATE TRANSLATIONS: ${UPDATE_TRANSLATIONS}")
|
||||
|
||||
IF(NOT WITH_QT4)
|
||||
# First known not-broken Qt5 version (5.0.2 available on old ubuntus is buggy).
|
||||
FIND_PACKAGE(Qt5Widgets 5.0.3)
|
||||
ENDIF()
|
||||
|
||||
FIND_PACKAGE(Qt5Widgets 5.0.3 REQUIRED)
|
||||
IF(Qt5Widgets_FOUND)
|
||||
MESSAGE(STATUS "Found Qt ${Qt5Widgets_VERSION_STRING}")
|
||||
|
||||
|
@ -141,27 +135,7 @@ IF(Qt5Widgets_FOUND)
|
|||
ENDIF()
|
||||
|
||||
ELSE()
|
||||
FIND_PACKAGE(Qt4 4.8.0 REQUIRED)
|
||||
IF(QT4_FOUND)
|
||||
# Old FindQt4.cmake modules used the same flag with different case
|
||||
SET(Qt4_FOUND TRUE)
|
||||
ENDIF()
|
||||
IF(Qt4_FOUND)
|
||||
MESSAGE(STATUS "Found Qt ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}")
|
||||
|
||||
IF(UPDATE_TRANSLATIONS)
|
||||
IF(NOT QT_LUPDATE_EXECUTABLE)
|
||||
MESSAGE(WARNING "Qt's lupdate not found.")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(NOT QT_LRELEASE_EXECUTABLE)
|
||||
MESSAGE(WARNING "Qt's lrelease not found.")
|
||||
ENDIF()
|
||||
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "No Qt4 or Qt5 found!")
|
||||
ENDIF()
|
||||
MESSAGE(FATAL_ERROR "No Qt5 found!")
|
||||
ENDIF()
|
||||
|
||||
set(CMAKE_AUTOMOC TRUE)
|
||||
|
@ -200,9 +174,7 @@ if(UNIX)
|
|||
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
|
||||
set(CPACK_DEBIAN_PACKAGE_SECTION "games")
|
||||
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "http://github.com/Cockatrice/Cockatrice")
|
||||
IF(Qt5Widgets_FOUND)
|
||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt5multimedia5-plugins, libqt5svg5")
|
||||
ENDIF()
|
||||
endif()
|
||||
elseif(WIN32)
|
||||
set(CPACK_GENERATOR NSIS ${CPACK_GENERATOR})
|
||||
|
|
|
@ -27,7 +27,7 @@ COPY servatrice/ servatrice/
|
|||
COPY README.md README.md
|
||||
|
||||
WORKDIR build
|
||||
RUN cmake .. -DWITH_QT4=0 -DWITH_SERVER=1 -DWITH_CLIENT=0 -DWITH_ORACLE=0 &&\
|
||||
RUN cmake .. -DWITH_SERVER=1 -DWITH_CLIENT=0 -DWITH_ORACLE=0 &&\
|
||||
make &&\
|
||||
make install
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
# Cockatrice
|
||||
|
||||
Cockatrice is an open-source multiplatform supported program for playing tabletop card games over a network. The program's server design prevents any kind of client modifications to gain an unfair advantage in a game. The client also has a built in single-player mode where you can brew without being connected to a server. This project is written in C++/Qt with support for both Qt4 and Qt5.<br>
|
||||
Cockatrice is an open-source multiplatform supported program for playing tabletop card games over a network. The program's server design prevents any kind of client modifications to gain an unfair advantage in a game. The client also has a built in single-player mode where you can brew without being connected to a server. This project is written in C++ and is using the Qt5 libraries.<br>
|
||||
|
||||
|
||||
# Downloads
|
||||
|
@ -60,10 +60,6 @@ Dependencies:
|
|||
Oracle can optionally use zlib to load zipped files:
|
||||
- [zlib](http://www.zlib.net/) (no https!)
|
||||
|
||||
The server requires an additional dependency when compiled under Qt4:
|
||||
- [libgcrypt](https://www.gnu.org/software/libgcrypt/)
|
||||
|
||||
|
||||
To compile:
|
||||
|
||||
mkdir build
|
||||
|
@ -87,7 +83,6 @@ The following flags can be passed to `cmake`:
|
|||
- `-DWITH_CLIENT=0` Whether to build the client (default 1 = yes).
|
||||
- `-DWITH_ORACLE=0` Whether to build oracle (default 1 = yes).
|
||||
- `-DPORTABLE=1` Build portable versions of client & oracle (default 0 = no).
|
||||
- `-DWITH_QT4=1` Force compilation to use Qt4 instead of Qt5 (default 0 = no).
|
||||
- `-DCMAKE_BUILD_TYPE=Debug` Compile in debug mode. Enables extra logging output, debug symbols, and much more verbose compiler warnings (default `Release`).
|
||||
- `-DUPDATE_TRANSLATIONS=1` Configure `make` to update the translation .ts files for new strings in the source code. Note: Running `make clean` will remove the .ts files (default 0 = no).
|
||||
- `-DTEST=1` Enable regression tests (default 0 = no). Note: needs googletest, will be downloaded on the fly if unavailable. To run tests: ```make test```.
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
# -*- cmake -*-
|
||||
|
||||
# Copied from http://code.google.com/p/emeraldviewer/
|
||||
|
||||
# - Find libgcrypt
|
||||
# Find the libgcrypt includes and library
|
||||
# This module defines
|
||||
# LIBGCRYPT_INCLUDE_DIR, where to find gcrypt.h, etc.
|
||||
# LIBGCRYPT_LIBRARIES, the libraries needed to use libgcrypt.
|
||||
# LIBGCRYPT_FOUND, If false, do not try to use libgcrypt.
|
||||
# also defined, but not for general use are
|
||||
# LIBGCRYPT_LIBRARY, where to find the libgcrypt library.
|
||||
|
||||
FIND_PATH(LIBGCRYPT_INCLUDE_DIR gcrypt.h)
|
||||
|
||||
SET(LIBGCRYPT_NAMES ${LIBGCRYPT_NAMES} gcrypt)
|
||||
FIND_LIBRARY(LIBGCRYPT_LIBRARY
|
||||
NAMES ${LIBGCRYPT_NAMES}
|
||||
)
|
||||
|
||||
IF (LIBGCRYPT_LIBRARY AND LIBGCRYPT_INCLUDE_DIR)
|
||||
SET(LIBGCRYPT_LIBRARIES ${LIBGCRYPT_LIBRARY})
|
||||
SET(LIBGCRYPT_FOUND "YES")
|
||||
ELSE (LIBGCRYPT_LIBRARY AND LIBGCRYPT_INCLUDE_DIR)
|
||||
SET(LIBGCRYPT_FOUND "NO")
|
||||
ENDIF (LIBGCRYPT_LIBRARY AND LIBGCRYPT_INCLUDE_DIR)
|
||||
|
||||
|
||||
IF (LIBGCRYPT_FOUND)
|
||||
IF (NOT LIBGCRYPT_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found libgcrypt: '${LIBGCRYPT_LIBRARIES}' and header in '${LIBGCRYPT_INCLUDE_DIR}'")
|
||||
ENDIF (NOT LIBGCRYPT_FIND_QUIETLY)
|
||||
ELSE (LIBGCRYPT_FOUND)
|
||||
IF (LIBGCRYPT_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Could not find libgcrypt library")
|
||||
ENDIF (LIBGCRYPT_FIND_REQUIRED)
|
||||
ENDIF (LIBGCRYPT_FOUND)
|
||||
|
||||
# Deprecated declarations.
|
||||
SET (NATIVE_LIBGCRYPT_INCLUDE_PATH ${LIBGCRYPT_INCLUDE_DIR} )
|
||||
GET_FILENAME_COMPONENT (NATIVE_LIBGCRYPT_LIB_PATH ${LIBGCRYPT_LIBRARY} PATH)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
LIBGCRYPT_LIBRARY
|
||||
LIBGCRYPT_INCLUDE_DIR
|
||||
)
|
|
@ -1,158 +0,0 @@
|
|||
INCLUDE(FindQt4)
|
||||
|
||||
set(MOBILITY_CONFIG_MKSPECS_FILE "")
|
||||
IF(EXISTS "${QT_MKSPECS_DIR}/features/mobilityconfig.prf")
|
||||
set(MOBILITY_CONFIG_MKSPECS_FILE "${QT_MKSPECS_DIR}/features/mobilityconfig.prf")
|
||||
ELSEIF(EXISTS "${QT_MKSPECS_DIR}/features/mobility.prf")
|
||||
set(MOBILITY_CONFIG_MKSPECS_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/mobilityconfig.prf")
|
||||
ENDIF()
|
||||
|
||||
macro(export_component component)
|
||||
IF(NOT ${MOBILITY_CONFIG_MKSPECS_FILE} STREQUAL "")
|
||||
FILE(READ ${MOBILITY_CONFIG_MKSPECS_FILE} MOBILITY_FILE_CONTENTS)
|
||||
STRING(TOLOWER ${component} _COMPONENT)
|
||||
IF(${MOBILITY_FILE_CONTENTS} MATCHES "MOBILITY_CONFIG=.*${_COMPONENT}.*")
|
||||
STRING(TOUPPER ${component} _COMPONENT)
|
||||
SET(QT_MOBILITY_${_COMPONENT}_FOUND 1)
|
||||
SET(QT_MOBILITY_${_COMPONENT}_INCLUDE_DIR ${QT_MOBILITY_PARENT_INCLUDE_DIR}/Qt${component})
|
||||
SET(QT_MOBILITY_${_COMPONENT}_LIBRARY Qt${component})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
endmacro()
|
||||
|
||||
set(VERSION_INFO "")
|
||||
set(FEATURE_FILE_PREFIX "${QT_MKSPECS_DIR}/features/mobility")
|
||||
|
||||
if(DEFINED MOBILITY_VERSION)
|
||||
if(MOBILITY_VERSION STREQUAL "1.1" AND EXISTS "${FEATURE_FILE_PREFIX}11.prf")
|
||||
set(MOBILITY_PRF_FILE "${FEATURE_FILE_PREFIX}11.prf")
|
||||
set(VERSION_INFO "1.1")
|
||||
elseif(MOBILITY_VERSION STREQUAL "1.2" AND EXISTS "${FEATURE_FILE_PREFIX}12.prf")
|
||||
set(MOBILITY_PRF_FILE "${FEATURE_FILE_PREFIX}12.prf")
|
||||
set(VERSION_INFO "1.2")
|
||||
elseif(MOBILITY_VERSION STREQUAL "default" AND EXISTS "${FEATURE_FILE_PREFIX}.prf")
|
||||
set(MOBILITY_PRF_FILE "${FEATURE_FILE_PREFIX}.prf")
|
||||
set(VERSION_INFO "system's default")
|
||||
else()
|
||||
message(STATUS "Couldn't find QtMobility version: ${MOBILITY_VERSION}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED MOBILITY_PRF_FILE)
|
||||
if(EXISTS "${FEATURE_FILE_PREFIX}.prf")
|
||||
set(MOBILITY_PRF_FILE "${FEATURE_FILE_PREFIX}.prf")
|
||||
set(VERSION_INFO "system's default")
|
||||
elseif(EXISTS "${FEATURE_FILE_PREFIX}12.prf")
|
||||
set(MOBILITY_PRF_FILE "${FEATURE_FILE_PREFIX}12.prf")
|
||||
set(VERSION_INFO "1.2")
|
||||
elseif(EXISTS "${FEATURE_FILE_PREFIX}11.prf")
|
||||
set(MOBILITY_PRF_FILE "${FEATURE_FILE_PREFIX}11.prf")
|
||||
set(VERSION_INFO "1.1")
|
||||
else()
|
||||
message(FATAL_ERROR "Couldn't find any version of QtMobility.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
message(STATUS "Using QtMobility version: ${VERSION_INFO}")
|
||||
|
||||
IF(DEFINED MOBILITY_PRF_FILE)
|
||||
FILE(READ ${MOBILITY_PRF_FILE} MOBILITY_FILE_CONTENTS)
|
||||
|
||||
STRING(REGEX MATCH "MOBILITY_PREFIX=([^\n]+)" QT_MOBILITY_PREFIX "${MOBILITY_FILE_CONTENTS}")
|
||||
SET(QT_MOBILITY_PREFIX ${CMAKE_MATCH_1})
|
||||
|
||||
STRING(REGEX MATCH "MOBILITY_INCLUDE=([^\n]+)" QT_MOBILITY_INCLUDE_DIR "${MOBILITY_FILE_CONTENTS}")
|
||||
SET(QT_MOBILITY_INCLUDE_DIR ${CMAKE_MATCH_1})
|
||||
|
||||
STRING(REGEX MATCH "MOBILITY_LIB=([^\n]+)" "\\1" QT_MOBILITY_LIBRARY "${MOBILITY_FILE_CONTENTS}")
|
||||
SET(QT_MOBILITY_LIBRARY_DIR ${CMAKE_MATCH_1})
|
||||
|
||||
#VERSION
|
||||
IF(NOT ${MOBILITY_CONFIG_MKSPECS_FILE} STREQUAL "")
|
||||
FILE(READ ${MOBILITY_CONFIG_MKSPECS_FILE} MOBILITY_CONFIG_FILE_CONTENTS)
|
||||
STRING(REGEX MATCH "MOBILITY_VERSION = ([^\n]+)" QT_MOBILITY_VERSION "${MOBILITY_CONFIG_FILE_CONTENTS}")
|
||||
SET(QT_MOBILITY_VERSION ${CMAKE_MATCH_1})
|
||||
|
||||
STRING(REGEX MATCH "MOBILITY_MAJOR_VERSION = ([^\n]+)" QT_MOBILITY_MAJOR_VERSION "${MOBILITY_CONFIG_FILE_CONTENTS}")
|
||||
SET(QT_MOBILITY_MAJOR_VERSION ${CMAKE_MATCH_1})
|
||||
|
||||
STRING(REGEX MATCH "MOBILITY_MINOR_VERSION = ([^\n]+)" QT_MOBILITY_MINOR_VERSION "${MOBILITY_CONFIG_FILE_CONTENTS}")
|
||||
SET(QT_MOBILITY_MINOR_VERSION ${CMAKE_MATCH_1})
|
||||
|
||||
STRING(REGEX MATCH "MOBILITY_PATCH_VERSION = ([^\n]+)" QT_MOBILITY_PATCH_VERSION "${MOBILITY_CONFIG_FILE_CONTENTS}")
|
||||
SET(QT_MOBILITY_PATCH_VERSION ${CMAKE_MATCH_1})
|
||||
ELSE()
|
||||
SET(QT_MOBILITY_VERSION 1.0.0)
|
||||
SET(QT_MOBILITY_MAJOR_VERSION 1)
|
||||
SET(QT_MOBILITY_MINOR_VERSION 0)
|
||||
SET(QT_MOBILITY_PATCH_VERSION 0)
|
||||
ENDIF()
|
||||
|
||||
SET(QT_MOBILITY_PARENT_INCLUDE_DIR ${QT_MOBILITY_INCLUDE_DIR})
|
||||
SET(QT_MOBILITY_INCLUDE_DIR ${QT_MOBILITY_INCLUDE_DIR}/QtMobility)
|
||||
|
||||
IF(QtMobility_FIND_VERSION_EXACT)
|
||||
IF(QT_MOBILITY_VERSION VERSION_EQUAL QtMobility_FIND_VERSION)
|
||||
SET(QT_MOBILITY_FOUND TRUE)
|
||||
ELSE()
|
||||
SET(QT_MOBILITY_FOUND FALSE)
|
||||
IF(QT_MOBILITY_VERSION VERSION_LESS QtMobility_FIND_VERSION)
|
||||
SET(QT_MOBILITY_TOO_OLD TRUE)
|
||||
ELSE()
|
||||
SET(QT_MOBILITY_TOO_NEW TRUE)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ELSE()
|
||||
IF(QT_MOBILITY_VERSION VERSION_LESS QtMobility_FIND_VERSION)
|
||||
SET(QT_MOBILITY_FOUND FALSE)
|
||||
SET(QT_MOBILITY_TOO_OLD TRUE)
|
||||
ELSE()
|
||||
SET(QT_MOBILITY_FOUND TRUE)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ELSE()
|
||||
SET(QT_MOBILITY_FOUND NOTFOUND)
|
||||
SET(QT_MOBILITY_PREFIX NOTFOUND)
|
||||
SET(QT_MOBILITY_INCLUDE NOTFOUND)
|
||||
SET(QT_MOBILITY_LIB NOTFOUND)
|
||||
ENDIF()
|
||||
|
||||
IF(NOT QT_MOBILITY_FOUND)
|
||||
if(QT_MOBILITY_TOO_OLD)
|
||||
MESSAGE(FATAL_ERROR "The installed QtMobility version ${QT_MOBILITY_VERSION} it too old, version ${QtMobility_FIND_VERSION} is required.")
|
||||
ELSEIF(QT_MOBILITY_TOO_NEW)
|
||||
MESSAGE(FATAL_ERROR "The installed QtMobility version ${QT_MOBILITY_VERSION} it too new, version ${QtMobility_FIND_VERSION} is required.")
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "QtMobility not found.")
|
||||
ENDIF()
|
||||
ELSE()
|
||||
export_component(Bearer)
|
||||
export_component(Feedback)
|
||||
export_component(Gallery)
|
||||
export_component(PublishSubscribe)
|
||||
export_component(Location)
|
||||
export_component(Organizer)
|
||||
export_component(ServiceFramework)
|
||||
export_component(SystemInfo)
|
||||
export_component(Contacts)
|
||||
export_component(Messaging)
|
||||
export_component(Versit)
|
||||
export_component(Sensors)
|
||||
# VersitOrganizer
|
||||
if(${QT_MOBILITY_CONTACTS_FOUND} AND ${QT_MOBILITY_VERSIT_FOUND})
|
||||
SET(QT_MOBILITY_VERSITORGANIZER_FOUND 1)
|
||||
SET(QT_MOBILITY_VERSITORGANIZER_INCLUDE_DIR ${QT_MOBILITY_PARENT_INCLUDE_DIR}/QtVersitOrganizer)
|
||||
SET(QT_MOBILITY_VERSITORGANIZER_LIBRARY QtVersitOrganizer)
|
||||
endif()
|
||||
|
||||
# MultimediaKit - it's just 'multimedia' in the .prf file.
|
||||
IF(NOT ${MOBILITY_CONFIG_MKSPECS_FILE} STREQUAL "")
|
||||
FILE(READ ${MOBILITY_CONFIG_MKSPECS_FILE} MOBILITY_FILE_CONTENTS)
|
||||
IF(${MOBILITY_FILE_CONTENTS} MATCHES "MOBILITY_CONFIG=.*multimedia.*")
|
||||
SET(QT_MOBILITY_MULTIMEDIAKIT_FOUND 1)
|
||||
SET(QT_MOBILITY_MULTIMEDIAKIT_INCLUDE_DIR ${QT_MOBILITY_PARENT_INCLUDE_DIR}/QtMultimediaKit)
|
||||
SET(QT_MOBILITY_MULTIMEDIAKIT_LIBRARY QtMultimediaKit)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
ENDIF()
|
|
@ -139,36 +139,6 @@ ENDIF(APPLE)
|
|||
|
||||
set(COCKATRICE_LIBS)
|
||||
|
||||
# Qt4 stuff
|
||||
if(Qt4_FOUND)
|
||||
if (NOT QT_QTMULTIMEDIA_FOUND)
|
||||
FIND_PACKAGE(QtMobility REQUIRED)
|
||||
endif()
|
||||
|
||||
SET(QT_USE_QTNETWORK TRUE)
|
||||
SET(QT_USE_QTMULTIMEDIA TRUE)
|
||||
SET(QT_USE_QTSVG TRUE)
|
||||
|
||||
# Include directories
|
||||
INCLUDE(${QT_USE_FILE})
|
||||
INCLUDE_DIRECTORIES(${QT_INCLUDES})
|
||||
INCLUDE_DIRECTORIES(${QT_MOBILITY_INCLUDE_DIR})
|
||||
INCLUDE_DIRECTORIES(${QT_MOBILITY_MULTIMEDIAKIT_INCLUDE_DIR})
|
||||
LIST(APPEND COCKATRICE_LIBS ${QT_LIBRARIES})
|
||||
LIST(APPEND COCKATRICE_LIBS ${QT_QTMAIN_LIBRARY})
|
||||
LIST(APPEND COCKATRICE_LIBS ${QT_MOBILITY_MULTIMEDIAKIT_LIBRARY})
|
||||
|
||||
# Let cmake chew Qt4's translations and resource files
|
||||
# Note: header files are MOC-ed automatically by cmake
|
||||
IF(UPDATE_TRANSLATIONS)
|
||||
QT4_CREATE_TRANSLATION(cockatrice_QM ${translate_SRCS} ${cockatrice_TS})
|
||||
ELSE(UPDATE_TRANSLATIONS)
|
||||
QT4_ADD_TRANSLATION(cockatrice_QM ${cockatrice_TS})
|
||||
ENDIF(UPDATE_TRANSLATIONS)
|
||||
|
||||
QT4_ADD_RESOURCES(cockatrice_RESOURCES_RCC ${cockatrice_RESOURCES})
|
||||
endif()
|
||||
|
||||
# qt5 stuff
|
||||
if(Qt5Widgets_FOUND)
|
||||
include_directories(${Qt5Widgets_INCLUDE_DIRS})
|
||||
|
@ -245,20 +215,12 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
|
|||
# Build cockatrice binary and link it
|
||||
ADD_EXECUTABLE(cockatrice WIN32 MACOSX_BUNDLE ${cockatrice_SOURCES} ${cockatrice_QM} ${cockatrice_RESOURCES_RCC} ${cockatrice_MOC_SRCS})
|
||||
|
||||
if(Qt4_FOUND)
|
||||
if(MSVC)
|
||||
set(QT_USE_QTMAIN true)
|
||||
endif()
|
||||
TARGET_LINK_LIBRARIES(cockatrice cockatrice_common ${COCKATRICE_LIBS})
|
||||
endif()
|
||||
if(Qt5Widgets_FOUND)
|
||||
if(MSVC)
|
||||
if(MSVC)
|
||||
TARGET_LINK_LIBRARIES(cockatrice cockatrice_common Qt5::WinMain)
|
||||
else()
|
||||
else()
|
||||
TARGET_LINK_LIBRARIES(cockatrice cockatrice_common)
|
||||
endif()
|
||||
qt5_use_modules(cockatrice ${COCKATRICE_LIBS})
|
||||
endif()
|
||||
qt5_use_modules(cockatrice ${COCKATRICE_LIBS})
|
||||
|
||||
if(UNIX)
|
||||
if(APPLE)
|
||||
|
@ -291,11 +253,9 @@ if(APPLE)
|
|||
set(qtconf_dest_dir cockatrice.app/Contents/Resources)
|
||||
get_filename_component(QT_LIBRARY_DIR "${QT_LIBRARY_DIR}/.." ABSOLUTE)
|
||||
|
||||
# qt4: codecs, iconengines, imageformats
|
||||
# qt5: audio, iconengines, imageformats, platforms, printsupport
|
||||
|
||||
# qt5 plugins: audio, iconengines, imageformats, platforms, printsupport
|
||||
install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime
|
||||
FILES_MATCHING REGEX "(audio|codecs|iconengines|imageformats|platforms|printsupport)/.*\\.dylib"
|
||||
FILES_MATCHING REGEX "(audio|iconengines|imageformats|platforms|printsupport)/.*\\.dylib"
|
||||
REGEX ".*_debug\\.dylib" EXCLUDE)
|
||||
|
||||
install(CODE "
|
||||
|
@ -319,11 +279,9 @@ if(WIN32)
|
|||
set(plugin_dest_dir Plugins)
|
||||
set(qtconf_dest_dir .)
|
||||
|
||||
# qt4: codecs, iconengines, imageformats
|
||||
# qt5: audio, iconengines, imageformats, platforms, printsupport
|
||||
|
||||
# qt5 plugins: audio, iconengines, imageformats, platforms, printsupport
|
||||
install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime
|
||||
FILES_MATCHING REGEX "(audio|codecs|iconengines|imageformats|platforms|printsupport)/.*[^d]\\.dll")
|
||||
FILES_MATCHING REGEX "(audio|iconengines|imageformats|platforms|printsupport)/.*[^d]\\.dll")
|
||||
|
||||
install(CODE "
|
||||
file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"[Paths]
|
||||
|
|
|
@ -12,11 +12,7 @@
|
|||
AbstractCounter::AbstractCounter(Player *_player, int _id, const QString &_name, bool _shownInCounterArea, int _value, QGraphicsItem *parent)
|
||||
: QGraphicsItem(parent), player(_player), id(_id), name(_name), value(_value), hovered(false), aDec(0), aInc(0), dialogSemaphore(false), deleteAfterDialog(false), shownInCounterArea(_shownInCounterArea)
|
||||
{
|
||||
#if QT_VERSION < 0x050000
|
||||
setAcceptsHoverEvents(true);
|
||||
#else
|
||||
setAcceptHoverEvents(true);
|
||||
#endif
|
||||
|
||||
shortcutActive = false;
|
||||
|
||||
|
@ -149,12 +145,7 @@ void AbstractCounter::setCounter()
|
|||
bool ok;
|
||||
dialogSemaphore = true;
|
||||
int newValue =
|
||||
#if QT_VERSION < 0x050000
|
||||
QInputDialog::getInteger(
|
||||
#else
|
||||
QInputDialog::getInt(
|
||||
#endif
|
||||
0, tr("Set counter"), tr("New value for counter '%1':").arg(name), value, -2000000000, 2000000000, 1, &ok);
|
||||
QInputDialog::getInt(0, tr("Set counter"), tr("New value for counter '%1':").arg(name), value, -2000000000, 2000000000, 1, &ok);
|
||||
if (deleteAfterDialog) {
|
||||
deleteLater();
|
||||
return;
|
||||
|
|
|
@ -6,10 +6,7 @@
|
|||
#include <QRegExp>
|
||||
#include <QMessageBox>
|
||||
#include <QDesktopServices>
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
#include <QUrlQuery>
|
||||
#endif
|
||||
|
||||
DeckStatsInterface::DeckStatsInterface(
|
||||
CardDatabase &_cardDatabase,
|
||||
|
@ -50,19 +47,12 @@ void DeckStatsInterface::getAnalyzeRequestData(DeckList *deck, QByteArray *data)
|
|||
DeckList deckWithoutTokens;
|
||||
copyDeckWithoutTokens(*deck, deckWithoutTokens);
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
QUrl params;
|
||||
params.addQueryItem("deck", deckWithoutTokens.writeToString_Plain());
|
||||
params.addQueryItem("decktitle", deck->getName());
|
||||
data->append(params.encodedQuery());
|
||||
#else
|
||||
QUrl params;
|
||||
QUrlQuery urlQuery;
|
||||
urlQuery.addQueryItem("deck", deckWithoutTokens.writeToString_Plain());
|
||||
urlQuery.addQueryItem("decktitle", deck->getName());
|
||||
params.setQuery(urlQuery);
|
||||
data->append(params.query(QUrl::EncodeReserved));
|
||||
#endif
|
||||
}
|
||||
|
||||
void DeckStatsInterface::analyzeDeck(DeckList *deck)
|
||||
|
|
|
@ -65,11 +65,7 @@ void DeckViewCardDragItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|||
DeckViewCard::DeckViewCard(const QString &_name, const QString &_originZone, QGraphicsItem *parent)
|
||||
: AbstractCardItem(_name, 0, -1, parent), originZone(_originZone), dragItem(0)
|
||||
{
|
||||
#if QT_VERSION < 0x050000
|
||||
setAcceptsHoverEvents(true);
|
||||
#else
|
||||
setAcceptHoverEvents(true);
|
||||
#endif
|
||||
}
|
||||
|
||||
DeckViewCard::~DeckViewCard()
|
||||
|
|
|
@ -83,11 +83,8 @@ DlgCreateToken::DlgCreateToken(const QStringList &_predefinedTokens, QWidget *pa
|
|||
chooseTokenView->setWordWrap(true);
|
||||
chooseTokenView->setColumnWidth(0, 130);
|
||||
chooseTokenView->setColumnWidth(3, 178);
|
||||
#if QT_VERSION < 0x050000
|
||||
chooseTokenView->header()->setResizeMode(4, QHeaderView::ResizeToContents);
|
||||
#else
|
||||
chooseTokenView->header()->setSectionResizeMode(4, QHeaderView::ResizeToContents);
|
||||
#endif
|
||||
|
||||
connect(chooseTokenView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex, QModelIndex)), this, SLOT(tokenSelectionChanged(QModelIndex, QModelIndex)));
|
||||
|
||||
if (predefinedTokens.isEmpty())
|
||||
|
|
|
@ -77,13 +77,9 @@ DlgEditTokens::DlgEditTokens(QWidget *parent)
|
|||
chooseTokenView->header()->setStretchLastSection(false);
|
||||
chooseTokenView->header()->hideSection(1);
|
||||
chooseTokenView->header()->hideSection(2);
|
||||
#if QT_VERSION < 0x050000
|
||||
chooseTokenView->header()->setResizeMode(3, QHeaderView::ResizeToContents);
|
||||
chooseTokenView->header()->setResizeMode(4, QHeaderView::ResizeToContents);
|
||||
#else
|
||||
chooseTokenView->header()->setSectionResizeMode(3, QHeaderView::ResizeToContents);
|
||||
chooseTokenView->header()->setSectionResizeMode(4, QHeaderView::ResizeToContents);
|
||||
#endif
|
||||
|
||||
connect(chooseTokenView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex, QModelIndex)), this, SLOT(tokenSelectionChanged(QModelIndex, QModelIndex)));
|
||||
|
||||
QAction *aAddToken = new QAction(tr("Add token"), this);
|
||||
|
|
|
@ -697,11 +697,6 @@ SoundSettingsPage::SoundSettingsPage()
|
|||
connect(masterVolumeSlider, SIGNAL(valueChanged(int)), masterVolumeSpinBox, SLOT(setValue(int)));
|
||||
connect(masterVolumeSpinBox, SIGNAL(valueChanged(int)), masterVolumeSlider, SLOT(setValue(int)));
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
masterVolumeSlider->setEnabled(false);
|
||||
masterVolumeSpinBox->setEnabled(false);
|
||||
#endif
|
||||
|
||||
QGridLayout *soundGrid = new QGridLayout;
|
||||
soundGrid->addWidget(&soundEnabledCheckBox, 0, 0, 1, 3);
|
||||
soundGrid->addWidget(&masterVolumeLabel, 1, 0);
|
||||
|
@ -736,12 +731,7 @@ void SoundSettingsPage::retranslateUi() {
|
|||
themeLabel.setText(tr("Current sounds theme:"));
|
||||
soundTestButton.setText(tr("Test system sound engine"));
|
||||
soundGroupBox->setTitle(tr("Sound settings"));
|
||||
#if QT_VERSION < 0x050000
|
||||
masterVolumeLabel.setText(tr("Master volume requires QT5"));
|
||||
#else
|
||||
masterVolumeLabel.setText(tr("Master volume"));
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
DlgSettings::DlgSettings(QWidget *parent)
|
||||
|
|
|
@ -54,11 +54,8 @@ GameSelector::GameSelector(AbstractClient *_client, const TabSupervisor *_tabSup
|
|||
if (showfilters && restoresettings)
|
||||
gameListProxyModel->loadFilterParameters(gameTypeMap);
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
gameListView->header()->setResizeMode(0, QHeaderView::ResizeToContents);
|
||||
#else
|
||||
gameListView->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
|
||||
#endif
|
||||
|
||||
filterButton = new QPushButton;
|
||||
filterButton->setIcon(QPixmap("theme:icons/search"));
|
||||
connect(filterButton, SIGNAL(clicked()), this, SLOT(actSetFilter()));
|
||||
|
|
|
@ -30,11 +30,7 @@ void HandCounter::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*op
|
|||
painter->save();
|
||||
QSize translatedSize = painter->combinedTransform().mapRect(boundingRect()).size().toSize();
|
||||
QPixmap cachedPixmap;
|
||||
#if QT_VERSION >= 0x040600
|
||||
if (!QPixmapCache::find("handCounter" + QString::number(translatedSize.width()), &cachedPixmap)) {
|
||||
#else
|
||||
if (!QPixmapCache::find("handCounter" + QString::number(translatedSize.width()), cachedPixmap)) {
|
||||
#endif
|
||||
cachedPixmap = QPixmap("theme:hand").scaled(translatedSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
QPixmapCache::insert("handCounter" + QString::number(translatedSize.width()), cachedPixmap);
|
||||
}
|
||||
|
|
|
@ -55,16 +55,6 @@ ThemeManager *themeManager;
|
|||
const QString translationPrefix = "cockatrice";
|
||||
QString translationPath;
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
static void myMessageOutput(QtMsgType /*type*/, const char *msg)
|
||||
{
|
||||
QFile file("qdebug.txt");
|
||||
file.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text);
|
||||
QTextStream out(&file);
|
||||
out << msg << endl;
|
||||
file.close();
|
||||
}
|
||||
#else
|
||||
static void myMessageOutput(QtMsgType /*type*/, const QMessageLogContext &, const QString &msg)
|
||||
{
|
||||
QFile file("qdebug.txt");
|
||||
|
@ -73,7 +63,6 @@ static void myMessageOutput(QtMsgType /*type*/, const QMessageLogContext &, cons
|
|||
out << msg << endl;
|
||||
file.close();
|
||||
}
|
||||
#endif
|
||||
|
||||
void installNewTranslator()
|
||||
{
|
||||
|
@ -103,22 +92,12 @@ int main(int argc, char *argv[])
|
|||
QApplication app(argc, argv);
|
||||
|
||||
if (app.arguments().contains("--debug-output"))
|
||||
{
|
||||
#if QT_VERSION < 0x050000
|
||||
qInstallMsgHandler(myMessageOutput);
|
||||
#else
|
||||
qInstallMessageHandler(myMessageOutput);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
app.addLibraryPath(app.applicationDirPath() + "/plugins");
|
||||
#endif
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
// gone in Qt5, all source files _MUST_ be utf8-encoded
|
||||
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
|
||||
#endif
|
||||
|
||||
QCoreApplication::setOrganizationName("Cockatrice");
|
||||
QCoreApplication::setOrganizationDomain("cockatrice.de");
|
||||
QCoreApplication::setApplicationName("Cockatrice");
|
||||
|
@ -158,9 +137,8 @@ int main(int argc, char *argv[])
|
|||
|
||||
ui.show();
|
||||
qDebug("main(): ui.show() finished");
|
||||
#if QT_VERSION > 0x050000
|
||||
|
||||
app.setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
#endif
|
||||
app.exec();
|
||||
|
||||
qDebug("Event loop finished, terminating...");
|
||||
|
|
|
@ -13,11 +13,7 @@ PileZone::PileZone(Player *_p, const QString &_name, bool _isShufflable, bool _c
|
|||
: CardZone(_p, _name, false, _isShufflable, _contentsKnown, parent)
|
||||
{
|
||||
setCacheMode(DeviceCoordinateCache); // Do not move this line to the parent constructor!
|
||||
#if QT_VERSION < 0x050000
|
||||
setAcceptsHoverEvents(true);
|
||||
#else
|
||||
setAcceptHoverEvents(true);
|
||||
#endif
|
||||
setCursor(Qt::OpenHandCursor);
|
||||
|
||||
setTransform(QTransform().translate((float) CARD_WIDTH / 2, (float) CARD_HEIGHT / 2).rotate(90).translate((float) -CARD_WIDTH / 2, (float) -CARD_HEIGHT / 2));
|
||||
|
|
|
@ -516,13 +516,7 @@ void Player::playerListActionTriggered()
|
|||
} else if (menu == mRevealTopCard) {
|
||||
int decksize = zones.value("deck")->getCards().size();
|
||||
bool ok;
|
||||
int number =
|
||||
#if QT_VERSION < 0x050000
|
||||
QInputDialog::getInteger(
|
||||
#else
|
||||
QInputDialog::getInt(
|
||||
#endif
|
||||
0, tr("Reveal top cards of library"), tr("Number of cards: (max. %1)").arg(decksize), defaultNumberTopCards, 1, decksize, 1, &ok);
|
||||
int number = QInputDialog::getInt(0, tr("Reveal top cards of library"), tr("Number of cards: (max. %1)").arg(decksize), defaultNumberTopCards, 1, decksize, 1, &ok);
|
||||
if (ok) {
|
||||
cmd.set_zone_name("deck");
|
||||
cmd.set_top_cards(number);
|
||||
|
@ -867,13 +861,7 @@ void Player::actViewLibrary()
|
|||
void Player::actViewTopCards()
|
||||
{
|
||||
bool ok;
|
||||
int number =
|
||||
#if QT_VERSION < 0x050000
|
||||
QInputDialog::getInteger(
|
||||
#else
|
||||
QInputDialog::getInt(
|
||||
#endif
|
||||
0, tr("View top cards of library"), tr("Number of cards:"), defaultNumberTopCards, 1, 2000000000, 1, &ok);
|
||||
int number = QInputDialog::getInt(0, tr("View top cards of library"), tr("Number of cards:"), defaultNumberTopCards, 1, 2000000000, 1, &ok);
|
||||
if (ok) {
|
||||
defaultNumberTopCards = number;
|
||||
static_cast<GameScene *>(scene())->toggleZoneView(this, "deck", number);
|
||||
|
@ -928,13 +916,7 @@ void Player::actMulligan()
|
|||
|
||||
void Player::actDrawCards()
|
||||
{
|
||||
int number =
|
||||
#if QT_VERSION < 0x050000
|
||||
QInputDialog::getInteger(
|
||||
#else
|
||||
QInputDialog::getInt(
|
||||
#endif
|
||||
0, tr("Draw cards"), tr("Number:"));
|
||||
int number = QInputDialog::getInt(0, tr("Draw cards"), tr("Number:"));
|
||||
if (number) {
|
||||
Command_DrawCards cmd;
|
||||
cmd.set_number(number);
|
||||
|
@ -949,13 +931,7 @@ void Player::actUndoDraw()
|
|||
|
||||
void Player::actMoveTopCardsToGrave()
|
||||
{
|
||||
int number =
|
||||
#if QT_VERSION < 0x050000
|
||||
QInputDialog::getInteger(
|
||||
#else
|
||||
QInputDialog::getInt(
|
||||
#endif
|
||||
0, tr("Move top cards to grave"), tr("Number:"));
|
||||
int number = QInputDialog::getInt(0, tr("Move top cards to grave"), tr("Number:"));
|
||||
if (!number)
|
||||
return;
|
||||
|
||||
|
@ -978,13 +954,7 @@ void Player::actMoveTopCardsToGrave()
|
|||
|
||||
void Player::actMoveTopCardsToExile()
|
||||
{
|
||||
int number =
|
||||
#if QT_VERSION < 0x050000
|
||||
QInputDialog::getInteger(
|
||||
#else
|
||||
QInputDialog::getInt(
|
||||
#endif
|
||||
0, tr("Move top cards to exile"), tr("Number:"));
|
||||
int number = QInputDialog::getInt(0, tr("Move top cards to exile"), tr("Number:"));
|
||||
if (!number)
|
||||
return;
|
||||
|
||||
|
@ -1059,13 +1029,7 @@ void Player::actUntapAll()
|
|||
void Player::actRollDie()
|
||||
{
|
||||
bool ok;
|
||||
int sides =
|
||||
#if QT_VERSION < 0x050000
|
||||
QInputDialog::getInteger(
|
||||
#else
|
||||
QInputDialog::getInt(
|
||||
#endif
|
||||
static_cast<QWidget *>(parent()), tr("Roll die"), tr("Number of sides:"), 20, 2, 1000, 1, &ok);
|
||||
int sides = QInputDialog::getInt(static_cast<QWidget *>(parent()), tr("Roll die"), tr("Number of sides:"), 20, 2, 1000, 1, &ok);
|
||||
if (ok) {
|
||||
Command_RollDie cmd;
|
||||
cmd.set_sides(sides);
|
||||
|
@ -2269,13 +2233,7 @@ void Player::actCardCounterTrigger()
|
|||
case 11: {
|
||||
bool ok;
|
||||
dialogSemaphore = true;
|
||||
int number =
|
||||
#if QT_VERSION < 0x050000
|
||||
QInputDialog::getInteger(
|
||||
#else
|
||||
QInputDialog::getInt(
|
||||
#endif
|
||||
0, tr("Set counters"), tr("Number:"), 0, 0, MAX_COUNTERS_ON_CARD, 1, &ok);
|
||||
int number = QInputDialog::getInt(0, tr("Set counters"), tr("Number:"), 0, 0, MAX_COUNTERS_ON_CARD, 1, &ok);
|
||||
dialogSemaphore = false;
|
||||
if (clearCardsToDelete())
|
||||
return;
|
||||
|
|
|
@ -81,11 +81,7 @@ void PlayerTarget::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*o
|
|||
QSize translatedSize = translatedRect.size().toSize();
|
||||
QPixmap cachedPixmap;
|
||||
const QString cacheKey = "avatar" + QString::number(translatedSize.width()) + "_" + QString::number(info->user_level()) + "_" + QString::number(fullPixmap.cacheKey());
|
||||
#if QT_VERSION >= 0x040600
|
||||
if (!QPixmapCache::find(cacheKey, &cachedPixmap)) {
|
||||
#else
|
||||
if (!QPixmapCache::find(cacheKey, cachedPixmap)) {
|
||||
#endif
|
||||
cachedPixmap = QPixmap(translatedSize.width(), translatedSize.height());
|
||||
|
||||
QPainter tempPainter(&cachedPixmap);
|
||||
|
|
|
@ -12,11 +12,6 @@
|
|||
#include "main.h"
|
||||
#include "carddatabase.h"
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
// for Qt::escape()
|
||||
#include <QtGui/qtextdocument.h>
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
@ -137,12 +132,7 @@ void DBPriceUpdater::downloadFinished()
|
|||
if(resultMap.contains("errors"))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("A problem has occured while fetching card prices:") +
|
||||
"<br/>" +
|
||||
#if QT_VERSION < 0x050000
|
||||
Qt::escape(resultMap["errors"].toList().first().toString())
|
||||
#else
|
||||
resultMap["errors"].toList().first().toString().toHtmlEscaped()
|
||||
#endif
|
||||
"<br/>" + resultMap["errors"].toList().first().toString().toHtmlEscaped()
|
||||
);
|
||||
reply->deleteLater();
|
||||
if(urls.isEmpty())
|
||||
|
|
|
@ -283,11 +283,7 @@ RemoteDeckList_TreeWidget::RemoteDeckList_TreeWidget(AbstractClient *_client, QW
|
|||
setModel(proxyModel);
|
||||
connect(treeModel, SIGNAL(treeRefreshed()), this, SLOT(expandAll()));
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
header()->setResizeMode(QHeaderView::ResizeToContents);
|
||||
#else
|
||||
header()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||
#endif
|
||||
setUniformRowHeights(true);
|
||||
setSortingEnabled(true);
|
||||
proxyModel->sort(0, Qt::AscendingOrder);
|
||||
|
|
|
@ -278,11 +278,7 @@ RemoteReplayList_TreeWidget::RemoteReplayList_TreeWidget(AbstractClient *_client
|
|||
proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
|
||||
setModel(proxyModel);
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
header()->setResizeMode(QHeaderView::ResizeToContents);
|
||||
#else
|
||||
header()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||
#endif
|
||||
header()->setStretchLastSection(false);
|
||||
setUniformRowHeights(true);
|
||||
setSortingEnabled(true);
|
||||
|
|
|
@ -4,22 +4,15 @@
|
|||
#include <QDir>
|
||||
#include <QDebug>
|
||||
#include <QApplication>
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
#include <QStandardPaths>
|
||||
#else
|
||||
#include <QDesktopServices>
|
||||
#endif
|
||||
#include <QStandardPaths>
|
||||
|
||||
QString SettingsCache::getDataPath()
|
||||
{
|
||||
return
|
||||
#ifdef PORTABLE_BUILD
|
||||
qApp->applicationDirPath() + "/data/";
|
||||
#elif QT_VERSION >= 0x050000
|
||||
QStandardPaths::writableLocation(QStandardPaths::DataLocation);
|
||||
#else
|
||||
QDesktopServices::storageLocation(QDesktopServices::DataLocation);
|
||||
QStandardPaths::writableLocation(QStandardPaths::DataLocation);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -7,11 +7,7 @@
|
|||
#include <QDebug>
|
||||
#include <QFileInfo>
|
||||
#include <QLibraryInfo>
|
||||
#if QT_VERSION < 0x050000
|
||||
#include <QDesktopServices>
|
||||
#else
|
||||
#include <QStandardPaths>
|
||||
#endif
|
||||
#include <QStandardPaths>
|
||||
|
||||
#define DEFAULT_THEME_NAME "Default"
|
||||
#define TEST_SOUND_FILENAME "player_join"
|
||||
|
@ -47,13 +43,8 @@ void SoundEngine::soundEnabledChanged()
|
|||
if(!player)
|
||||
{
|
||||
QAudioFormat format;
|
||||
#if QT_VERSION < 0x050000
|
||||
format.setFrequency(44100);
|
||||
format.setChannels(1);
|
||||
#else
|
||||
format.setSampleRate(44100);
|
||||
format.setChannelCount(1);
|
||||
#endif
|
||||
format.setSampleSize(16);
|
||||
format.setCodec("audio/pcm");
|
||||
format.setByteOrder(QAudioFormat::LittleEndian);
|
||||
|
@ -88,9 +79,8 @@ void SoundEngine::playSound(QString fileName)
|
|||
inputBuffer->close();
|
||||
inputBuffer->setData(audioData[fileName]);
|
||||
inputBuffer->open(QIODevice::ReadOnly);
|
||||
#if QT_VERSION >= 0x050000
|
||||
|
||||
player->setVolume(settingsCache->getMasterVolume() / 100.0);
|
||||
#endif
|
||||
player->stop();
|
||||
player->start(inputBuffer);
|
||||
}
|
||||
|
@ -119,8 +109,6 @@ QStringMap & SoundEngine::getAvailableThemes()
|
|||
dir =
|
||||
#ifdef PORTABLE_BUILD
|
||||
qApp->applicationDirPath() +
|
||||
#elif QT_VERSION < 0x050000
|
||||
QDesktopServices::storageLocation(QDesktopServices::DataLocation) +
|
||||
#else
|
||||
QStandardPaths::standardLocations(QStandardPaths::DataLocation).first() +
|
||||
#endif
|
||||
|
|
|
@ -60,11 +60,7 @@ void TabDeckEditor::createDeckDock()
|
|||
deckView->setUniformRowHeights(true);
|
||||
deckView->setSortingEnabled(true);
|
||||
deckView->sortByColumn(1, Qt::AscendingOrder);
|
||||
#if QT_VERSION < 0x050000
|
||||
deckView->header()->setResizeMode(QHeaderView::ResizeToContents);
|
||||
#else
|
||||
deckView->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||
#endif
|
||||
deckView->installEventFilter(&deckViewKeySignals);
|
||||
connect(deckView->selectionModel(), SIGNAL(currentRowChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(updateCardInfoRight(const QModelIndex &, const QModelIndex &)));
|
||||
connect(deckView, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(actSwapCard()));
|
||||
|
|
|
@ -38,11 +38,7 @@ TabDeckStorage::TabDeckStorage(TabSupervisor *_tabSupervisor, AbstractClient *_c
|
|||
localDirView->setColumnHidden(1, true);
|
||||
localDirView->setRootIndex(localDirModel->index(localDirModel->rootPath(), 0));
|
||||
localDirView->setSortingEnabled(true);
|
||||
#if QT_VERSION < 0x050000
|
||||
localDirView->header()->setResizeMode(QHeaderView::ResizeToContents);
|
||||
#else
|
||||
localDirView->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||
#endif
|
||||
localDirView->header()->setSortIndicator(0, Qt::AscendingOrder);
|
||||
|
||||
leftToolBar = new QToolBar;
|
||||
|
|
|
@ -1581,10 +1581,7 @@ void TabGame::createMessageDock(bool bReplay)
|
|||
completer = new QCompleter(autocompleteUserList, sayEdit);
|
||||
completer->setCaseSensitivity(Qt::CaseInsensitive);
|
||||
completer->setMaxVisibleItems(5);
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
completer->setFilterMode(Qt::MatchStartsWith);
|
||||
#endif
|
||||
|
||||
sayEdit->setCompleter(completer);
|
||||
actCompleterChanged();
|
||||
|
|
|
@ -17,9 +17,7 @@
|
|||
#include "pb/response_viewlog_history.pb.h"
|
||||
|
||||
#include <QtGui>
|
||||
#if QT_VERSION >= 0x050000
|
||||
#include <QtWidgets>
|
||||
#endif
|
||||
|
||||
TabLog::TabLog(TabSupervisor *_tabSupervisor, AbstractClient *_client, QWidget *parent)
|
||||
: Tab(_tabSupervisor, parent), client(_client)
|
||||
|
|
|
@ -36,11 +36,7 @@ TabReplays::TabReplays(TabSupervisor *_tabSupervisor, AbstractClient *_client)
|
|||
localDirView->setColumnHidden(1, true);
|
||||
localDirView->setRootIndex(localDirModel->index(localDirModel->rootPath(), 0));
|
||||
localDirView->setSortingEnabled(true);
|
||||
#if QT_VERSION < 0x050000
|
||||
localDirView->header()->setResizeMode(QHeaderView::ResizeToContents);
|
||||
#else
|
||||
localDirView->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||
#endif
|
||||
localDirView->header()->setSortIndicator(0, Qt::AscendingOrder);
|
||||
|
||||
leftToolBar = new QToolBar;
|
||||
|
|
|
@ -118,10 +118,7 @@ TabRoom::TabRoom(TabSupervisor *_tabSupervisor, AbstractClient *_client, ServerI
|
|||
completer = new QCompleter(autocompleteUserList, sayEdit);
|
||||
completer->setCaseSensitivity(Qt::CaseInsensitive);
|
||||
completer->setMaxVisibleItems(5);
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
completer->setFilterMode(Qt::MatchStartsWith);
|
||||
#endif
|
||||
|
||||
sayEdit->setCompleter(completer);
|
||||
actCompleterChanged();
|
||||
|
|
|
@ -28,17 +28,11 @@ RoomSelector::RoomSelector(AbstractClient *_client, QWidget *parent)
|
|||
roomList->setRootIsDecorated(false);
|
||||
roomList->setColumnCount(5);
|
||||
roomList->header()->setStretchLastSection(false);
|
||||
#if QT_VERSION < 0x050000
|
||||
roomList->header()->setResizeMode(0, QHeaderView::ResizeToContents);
|
||||
roomList->header()->setResizeMode(1, QHeaderView::Stretch);
|
||||
roomList->header()->setResizeMode(2, QHeaderView::ResizeToContents);
|
||||
roomList->header()->setResizeMode(3, QHeaderView::ResizeToContents);
|
||||
#else
|
||||
roomList->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
|
||||
roomList->header()->setSectionResizeMode(1, QHeaderView::Stretch);
|
||||
roomList->header()->setSectionResizeMode(2, QHeaderView::ResizeToContents);
|
||||
roomList->header()->setSectionResizeMode(3, QHeaderView::ResizeToContents);
|
||||
#endif
|
||||
|
||||
joinButton = new QPushButton;
|
||||
connect(joinButton, SIGNAL(clicked()), this, SLOT(joinClicked()));
|
||||
QHBoxLayout *buttonLayout = new QHBoxLayout;
|
||||
|
|
|
@ -35,11 +35,7 @@ TableZone::TableZone(Player *_p, QGraphicsItem *parent)
|
|||
currentMinimumWidth = width;
|
||||
|
||||
setCacheMode(DeviceCoordinateCache);
|
||||
#if QT_VERSION < 0x050000
|
||||
setAcceptsHoverEvents(true);
|
||||
#else
|
||||
setAcceptHoverEvents(true);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -5,11 +5,7 @@
|
|||
#include <QColor>
|
||||
#include <QPixmapCache>
|
||||
#include <QLibraryInfo>
|
||||
#if QT_VERSION < 0x050000
|
||||
#include <QDesktopServices>
|
||||
#else
|
||||
#include <QStandardPaths>
|
||||
#endif
|
||||
#include <QStandardPaths>
|
||||
|
||||
#define DEFAULT_THEME_NAME "Default"
|
||||
#define STYLE_CSS_NAME "style.css"
|
||||
|
@ -45,8 +41,6 @@ QStringMap & ThemeManager::getAvailableThemes()
|
|||
dir =
|
||||
#ifdef PORTABLE_BUILD
|
||||
qApp->applicationDirPath() +
|
||||
#elif QT_VERSION < 0x050000
|
||||
QDesktopServices::storageLocation(QDesktopServices::DataLocation) +
|
||||
#else
|
||||
QStandardPaths::standardLocations(QStandardPaths::DataLocation).first() +
|
||||
#endif
|
||||
|
|
|
@ -12,10 +12,8 @@
|
|||
#include "pending_command.h"
|
||||
|
||||
#include <QtGui>
|
||||
#if QT_VERSION >= 0x050000
|
||||
#include <QtWidgets>
|
||||
#include <QSignalMapper>
|
||||
#endif
|
||||
|
||||
#include "pb/commands.pb.h"
|
||||
#include "pb/session_commands.pb.h"
|
||||
|
|
|
@ -311,11 +311,7 @@ UserList::UserList(TabSupervisor *_tabSupervisor, AbstractClient *_client, UserL
|
|||
|
||||
userTree = new QTreeWidget;
|
||||
userTree->setColumnCount(3);
|
||||
#if QT_VERSION < 0x050000
|
||||
userTree->header()->setResizeMode(QHeaderView::ResizeToContents);
|
||||
#else
|
||||
userTree->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||
#endif
|
||||
userTree->setHeaderHidden(true);
|
||||
userTree->setRootIsDecorated(false);
|
||||
userTree->setIconSize(QSize(20, 12));
|
||||
|
|
|
@ -31,12 +31,7 @@
|
|||
#include <QSystemTrayIcon>
|
||||
#include <QApplication>
|
||||
#include <QtNetwork>
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
#include <QtGui/qtextdocument.h> // for Qt::escape()
|
||||
#else
|
||||
#include <QtConcurrent>
|
||||
#endif
|
||||
#include <QtConcurrent>
|
||||
|
||||
#include "main.h"
|
||||
#include "window_main.h"
|
||||
|
@ -397,15 +392,7 @@ QString MainWindow::extractInvalidUsernameMessage(QString & in)
|
|||
out += "<li>" + tr("can %1 contain numeric characters").arg((rules.at(4).toInt() > 0) ? "" : tr("NOT")) + "</li>";
|
||||
|
||||
if (rules.at(6).size() > 0)
|
||||
{
|
||||
out += "<li>" + tr("can contain the following punctuation: %1").arg(
|
||||
#if QT_VERSION < 0x050000
|
||||
Qt::escape(rules.at(6))
|
||||
#else
|
||||
rules.at(6).toHtmlEscaped()
|
||||
#endif
|
||||
) + "</li>";
|
||||
}
|
||||
out += "<li>" + tr("can contain the following punctuation: %1").arg(rules.at(6).toHtmlEscaped()) + "</li>";
|
||||
|
||||
out += "<li>" + tr("first character can %1 be a punctuation mark").arg((rules.at(5).toInt() > 0) ? "" : tr("NOT")) + "</li>";
|
||||
out += "</ul>";
|
||||
|
|
|
@ -70,13 +70,8 @@ WndSets::WndSets(QWidget *parent)
|
|||
view->setDropIndicatorShown(true);
|
||||
view->setDragDropMode(QAbstractItemView::InternalMove);
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
view->header()->setResizeMode(QHeaderView::Stretch);
|
||||
view->header()->setResizeMode(SetsModel::LongNameCol, QHeaderView::ResizeToContents);
|
||||
#else
|
||||
view->header()->setSectionResizeMode(QHeaderView::Stretch);
|
||||
view->header()->setSectionResizeMode(SetsModel::LongNameCol, QHeaderView::ResizeToContents);
|
||||
#endif
|
||||
|
||||
view->sortByColumn(SetsModel::SortKeyCol, Qt::AscendingOrder);
|
||||
view->setColumnHidden(SetsModel::SortKeyCol, true);
|
||||
|
|
|
@ -30,21 +30,10 @@ SET(common_SOURCES
|
|||
|
||||
set(ORACLE_LIBS)
|
||||
|
||||
# Qt4 stuff
|
||||
if(Qt4_FOUND)
|
||||
# Include directories
|
||||
INCLUDE(${QT_USE_FILE})
|
||||
include_directories(${QT_INCLUDES})
|
||||
endif()
|
||||
|
||||
# qt5 stuff
|
||||
if(Qt5Widgets_FOUND)
|
||||
include_directories(${Qt5Widgets_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
INCLUDE_DIRECTORIES(pb)
|
||||
INCLUDE_DIRECTORIES(sfmt)
|
||||
INCLUDE_DIRECTORIES(${PROTOBUF_INCLUDE_DIR})
|
||||
include_directories(${Qt5Widgets_INCLUDE_DIRS})
|
||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
add_library(cockatrice_common ${common_SOURCES} ${common_MOC_SRCS})
|
||||
|
|
|
@ -47,28 +47,6 @@ ENDIF(APPLE)
|
|||
|
||||
set(ORACLE_LIBS)
|
||||
|
||||
# Qt4 stuff
|
||||
if(Qt4_FOUND)
|
||||
SET(QT_USE_QTNETWORK TRUE)
|
||||
SET(QT_USE_QTSVG TRUE)
|
||||
|
||||
# Include directories
|
||||
INCLUDE(${QT_USE_FILE})
|
||||
include_directories(${QT_INCLUDES})
|
||||
LIST(APPEND ORACLE_LIBS ${QT_QTMAIN_LIBRARY})
|
||||
LIST(APPEND ORACLE_LIBS ${QT_LIBRARIES})
|
||||
|
||||
# Let cmake chew Qt4's translations and resource files
|
||||
# Note: header files are MOC-ed automatically by cmake
|
||||
IF(UPDATE_TRANSLATIONS)
|
||||
QT4_CREATE_TRANSLATION(oracle_QM ${translate_SRCS} ${oracle_TS})
|
||||
ELSE(UPDATE_TRANSLATIONS)
|
||||
QT4_ADD_TRANSLATION(oracle_QM ${oracle_TS})
|
||||
ENDIF(UPDATE_TRANSLATIONS)
|
||||
|
||||
QT4_ADD_RESOURCES(oracle_RESOURCES_RCC ${oracle_RESOURCES})
|
||||
endif()
|
||||
|
||||
# qt5 stuff
|
||||
if(Qt5Widgets_FOUND)
|
||||
include_directories(${Qt5Widgets_INCLUDE_DIRS})
|
||||
|
@ -131,18 +109,10 @@ ENDIF()
|
|||
# Build oracle binary and link it
|
||||
ADD_EXECUTABLE(oracle WIN32 MACOSX_BUNDLE ${oracle_SOURCES} ${oracle_QM} ${oracle_RESOURCES_RCC} ${oracle_MOC_SRCS})
|
||||
|
||||
if(Qt4_FOUND)
|
||||
if(MSVC)
|
||||
set(QT_USE_QTMAIN true)
|
||||
endif()
|
||||
TARGET_LINK_LIBRARIES(oracle ${ORACLE_LIBS})
|
||||
endif()
|
||||
if(Qt5Widgets_FOUND)
|
||||
if(MSVC)
|
||||
if(MSVC)
|
||||
TARGET_LINK_LIBRARIES(oracle Qt5::WinMain)
|
||||
endif()
|
||||
qt5_use_modules(oracle ${ORACLE_LIBS})
|
||||
endif()
|
||||
qt5_use_modules(oracle ${ORACLE_LIBS})
|
||||
|
||||
IF(ZLIB_FOUND)
|
||||
TARGET_LINK_LIBRARIES(oracle ${ZLIB_LIBRARIES})
|
||||
|
@ -182,11 +152,9 @@ if(APPLE)
|
|||
set(qtconf_dest_dir oracle.app/Contents/Resources)
|
||||
get_filename_component(QT_LIBRARY_DIR "${QT_LIBRARY_DIR}/.." ABSOLUTE)
|
||||
|
||||
# qt4: codecs, iconengines, imageformats
|
||||
# qt5: iconengines, platforms
|
||||
|
||||
# qt5 plugins: iconengines, platforms
|
||||
install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime
|
||||
FILES_MATCHING REGEX "(codecs|iconengines|platforms)/.*\\.dylib"
|
||||
FILES_MATCHING REGEX "(iconengines|platforms)/.*\\.dylib"
|
||||
REGEX ".*_debug\\.dylib" EXCLUDE)
|
||||
|
||||
install(CODE "
|
||||
|
@ -218,11 +186,10 @@ IF(WIN32)
|
|||
list(APPEND libSearchDirs ${ZLIB_DLL_DIR})
|
||||
ENDIF()
|
||||
|
||||
# qt4: codecs, iconengines, imageformats
|
||||
# qt5: iconengines, imageformats, platforms
|
||||
# qt5 plugins: iconengines, platforms
|
||||
|
||||
install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime
|
||||
FILES_MATCHING REGEX "(codecs|iconengines|platforms)/.*[^d]\\.dll")
|
||||
FILES_MATCHING REGEX "(iconengines|platforms)/.*[^d]\\.dll")
|
||||
|
||||
install(CODE "
|
||||
file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"[Paths]
|
||||
|
|
|
@ -30,11 +30,6 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
QApplication app(argc, argv);
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
// gone in Qt5, all source files _MUST_ be utf8-encoded
|
||||
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
|
||||
#endif
|
||||
|
||||
QCoreApplication::setOrganizationName("Cockatrice");
|
||||
QCoreApplication::setOrganizationDomain("cockatrice");
|
||||
// this can't be changed, as it influences the default savepath for cards.xml
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
#include "oracleimporter.h"
|
||||
#if QT_VERSION < 0x050000
|
||||
#include <QtGui>
|
||||
#else
|
||||
#include <QtWidgets>
|
||||
#endif
|
||||
|
||||
#include <QtWidgets>
|
||||
#include <QDebug>
|
||||
|
||||
#include "qt-json/json.h"
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
#include <QtGui>
|
||||
#if QT_VERSION < 0x050000
|
||||
#include <QDesktopServices>
|
||||
#else
|
||||
#include <QStandardPaths>
|
||||
#include <QtConcurrent>
|
||||
#endif
|
||||
#include <QStandardPaths>
|
||||
#include <QtConcurrent>
|
||||
#include <QAbstractButton>
|
||||
#include <QBuffer>
|
||||
#include <QCheckBox>
|
||||
|
|
|
@ -38,22 +38,6 @@ ENDIF(APPLE)
|
|||
|
||||
set(SERVATRICE_LIBS)
|
||||
|
||||
# Qt4 stuff
|
||||
if(Qt4_FOUND)
|
||||
SET(QT_USE_QTNETWORK TRUE)
|
||||
SET(QT_USE_QTSQL TRUE)
|
||||
|
||||
# Include directories
|
||||
INCLUDE(${QT_USE_FILE})
|
||||
include_directories(${QT_INCLUDES})
|
||||
LIST(APPEND SERVATRICE_LIBS ${QT_LIBRARIES})
|
||||
|
||||
# Libgcrypt is required only with Qt4 to support SHA512 hashing
|
||||
FIND_PACKAGE(Libgcrypt REQUIRED)
|
||||
INCLUDE_DIRECTORIES(${LIBGCRYPT_INCLUDE_DIR})
|
||||
QT4_ADD_RESOURCES(servatrice_RESOURCES_RCC ${servatrice_RESOURCES})
|
||||
endif()
|
||||
|
||||
# qt5 stuff
|
||||
if(Qt5Widgets_FOUND)
|
||||
include_directories(${Qt5Widgets_INCLUDE_DIRS})
|
||||
|
@ -118,20 +102,12 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
|
|||
# Build servatrice binary and link it
|
||||
ADD_EXECUTABLE(servatrice MACOSX_BUNDLE ${servatrice_SOURCES} ${servatrice_RESOURCES_RCC} ${servatrice_MOC_SRCS})
|
||||
|
||||
if(Qt4_FOUND)
|
||||
if(MSVC)
|
||||
set(QT_USE_QTMAIN true)
|
||||
endif()
|
||||
TARGET_LINK_LIBRARIES(servatrice cockatrice_common ${SERVATRICE_LIBS} ${LIBGCRYPT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT})
|
||||
endif()
|
||||
if(Qt5Widgets_FOUND)
|
||||
if(MSVC)
|
||||
TARGET_LINK_LIBRARIES(servatrice cockatrice_common ${LIBGCRYPT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} Qt5::WinMain)
|
||||
else()
|
||||
TARGET_LINK_LIBRARIES(servatrice cockatrice_common ${LIBGCRYPT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT})
|
||||
endif()
|
||||
qt5_use_modules(servatrice ${SERVATRICE_LIBS})
|
||||
if(MSVC)
|
||||
TARGET_LINK_LIBRARIES(servatrice cockatrice_common ${CMAKE_THREAD_LIBS_INIT} Qt5::WinMain)
|
||||
else()
|
||||
TARGET_LINK_LIBRARIES(servatrice cockatrice_common ${CMAKE_THREAD_LIBS_INIT})
|
||||
endif()
|
||||
qt5_use_modules(servatrice ${SERVATRICE_LIBS})
|
||||
|
||||
# install rules
|
||||
if(UNIX)
|
||||
|
@ -168,11 +144,9 @@ if(APPLE)
|
|||
set(qtconf_dest_dir servatrice.app/Contents/Resources)
|
||||
get_filename_component(QT_LIBRARY_DIR "${QT_LIBRARY_DIR}/.." ABSOLUTE)
|
||||
|
||||
# qt4: codecs, sqldrivers
|
||||
# qt5: platforms, sqldrivers
|
||||
|
||||
# qt5 plugins: platforms, sqldrivers/mysql
|
||||
install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime
|
||||
FILES_MATCHING REGEX "(codecs/.*|platforms/.*|sqldrivers/libqsqlmysql)\\.dylib"
|
||||
FILES_MATCHING REGEX "(platforms/.*|sqldrivers/libqsqlmysql)\\.dylib"
|
||||
REGEX ".*_debug\\.dylib" EXCLUDE)
|
||||
|
||||
install(CODE "
|
||||
|
@ -195,11 +169,9 @@ if(WIN32)
|
|||
set(plugin_dest_dir Plugins)
|
||||
set(qtconf_dest_dir .)
|
||||
|
||||
# qt4: codecs, sqldrivers
|
||||
# qt5: platforms, sqldrivers
|
||||
|
||||
# qt5 plugins: platforms, sqldrivers/mysql
|
||||
install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime
|
||||
FILES_MATCHING REGEX "(codecs/.*|platforms/.*|sqldrivers/qsqlmysql)\\.dll"
|
||||
FILES_MATCHING REGEX "(platforms/.*|sqldrivers/qsqlmysql)\\.dll"
|
||||
REGEX ".*d\\.dll" EXCLUDE)
|
||||
|
||||
install(CODE "
|
||||
|
|
|
@ -45,13 +45,8 @@ SmtpClient *smtpClient;
|
|||
|
||||
void testRNG();
|
||||
void testHash();
|
||||
#if QT_VERSION < 0x050000
|
||||
void myMessageOutput(QtMsgType type, const char *msg);
|
||||
void myMessageOutput2(QtMsgType type, const char *msg);
|
||||
#else
|
||||
void myMessageOutput(QtMsgType type, const QMessageLogContext &, const QString &msg);
|
||||
void myMessageOutput2(QtMsgType type, const QMessageLogContext &, const QString &msg);
|
||||
#endif
|
||||
|
||||
/* Implementations */
|
||||
|
||||
|
@ -100,18 +95,6 @@ void testHash()
|
|||
std::cerr << startTime.secsTo(endTime) << "secs" << std::endl;
|
||||
}
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
void myMessageOutput(QtMsgType /*type*/, const char *msg)
|
||||
{
|
||||
logger->logMessage(msg);
|
||||
}
|
||||
|
||||
void myMessageOutput2(QtMsgType /*type*/, const char *msg)
|
||||
{
|
||||
logger->logMessage(msg);
|
||||
std::cerr << msg << std::endl;
|
||||
}
|
||||
#else
|
||||
void myMessageOutput(QtMsgType /*type*/, const QMessageLogContext &, const QString &msg)
|
||||
{
|
||||
logger->logMessage(msg);
|
||||
|
@ -122,7 +105,6 @@ void myMessageOutput2(QtMsgType /*type*/, const QMessageLogContext &, const QStr
|
|||
logger->logMessage(msg);
|
||||
std::cerr << msg.toStdString() << std::endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
@ -141,11 +123,6 @@ int main(int argc, char *argv[])
|
|||
|
||||
qRegisterMetaType<QList<int> >("QList<int>");
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
// gone in Qt5, all source files _MUST_ be utf8-encoded
|
||||
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
|
||||
#endif
|
||||
|
||||
configPath = SettingsCache::guessConfigurationPath(configPath);
|
||||
qWarning() << "Using configuration file: " << configPath;
|
||||
settingsCache = new SettingsCache(configPath);
|
||||
|
@ -158,17 +135,10 @@ int main(int argc, char *argv[])
|
|||
loggerThread->start();
|
||||
QMetaObject::invokeMethod(logger, "startLog", Qt::BlockingQueuedConnection, Q_ARG(QString, settingsCache->value("server/logfile", QString("server.log")).toString()));
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
if (logToConsole)
|
||||
qInstallMsgHandler(myMessageOutput);
|
||||
else
|
||||
qInstallMsgHandler(myMessageOutput2);
|
||||
#else
|
||||
if (logToConsole)
|
||||
qInstallMessageHandler(myMessageOutput);
|
||||
else
|
||||
qInstallMessageHandler(myMessageOutput2);
|
||||
#endif
|
||||
|
||||
signalhandler = new SignalHandler();
|
||||
|
||||
|
@ -193,11 +163,7 @@ int main(int argc, char *argv[])
|
|||
std::cerr << "-------------------------" << std::endl;
|
||||
std::cerr << "Server initialized." << std::endl;
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
qInstallMsgHandler(myMessageOutput);
|
||||
#else
|
||||
qInstallMessageHandler(myMessageOutput);
|
||||
#endif
|
||||
|
||||
retval = app.exec();
|
||||
|
||||
|
|
|
@ -1,44 +1,13 @@
|
|||
#include "passwordhasher.h"
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <gcrypt.h>
|
||||
#endif
|
||||
|
||||
#include <QCryptographicHash>
|
||||
#include "rng_sfmt.h"
|
||||
|
||||
void PasswordHasher::initialize()
|
||||
{
|
||||
#if QT_VERSION < 0x050000
|
||||
// These calls are required by libgcrypt before we use any of its functions.
|
||||
gcry_check_version(0);
|
||||
gcry_control(GCRYCTL_DISABLE_SECMEM, 0);
|
||||
gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0);
|
||||
#endif
|
||||
// dummy
|
||||
}
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
QString PasswordHasher::computeHash(const QString &password, const QString &salt)
|
||||
{
|
||||
const int algo = GCRY_MD_SHA512;
|
||||
const int rounds = 1000;
|
||||
|
||||
QByteArray passwordBuffer = (salt + password).toUtf8();
|
||||
int hashLen = gcry_md_get_algo_dlen(algo);
|
||||
char *hash = new char[hashLen], *tmp = new char[hashLen];
|
||||
gcry_md_hash_buffer(algo, hash, passwordBuffer.data(), passwordBuffer.size());
|
||||
for (int i = 1; i < rounds; ++i) {
|
||||
memcpy(tmp, hash, hashLen);
|
||||
gcry_md_hash_buffer(algo, hash, tmp, hashLen);
|
||||
}
|
||||
QString hashedPass = salt + QString(QByteArray(hash, hashLen).toBase64());
|
||||
delete[] tmp;
|
||||
delete[] hash;
|
||||
return hashedPass;
|
||||
}
|
||||
#else
|
||||
QString PasswordHasher::computeHash(const QString &password, const QString &salt)
|
||||
{
|
||||
QCryptographicHash::Algorithm algo = QCryptographicHash::Sha512;
|
||||
|
@ -51,7 +20,6 @@ QString PasswordHasher::computeHash(const QString &password, const QString &salt
|
|||
QString hashedPass = salt + QString(hash.toBase64());
|
||||
return hashedPass;
|
||||
}
|
||||
#endif
|
||||
|
||||
QString PasswordHasher::generateRandomSalt(const int len)
|
||||
{
|
||||
|
|
|
@ -81,11 +81,7 @@ Servatrice_GameServer::~Servatrice_GameServer()
|
|||
}
|
||||
}
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
void Servatrice_GameServer::incomingConnection(int socketDescriptor)
|
||||
#else
|
||||
void Servatrice_GameServer::incomingConnection(qintptr socketDescriptor)
|
||||
#endif
|
||||
{
|
||||
// Determine connection pool with smallest client count
|
||||
int minClientCount = -1;
|
||||
|
@ -110,11 +106,7 @@ void Servatrice_GameServer::incomingConnection(qintptr socketDescriptor)
|
|||
QMetaObject::invokeMethod(ssi, "initConnection", Qt::QueuedConnection, Q_ARG(int, socketDescriptor));
|
||||
}
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
void Servatrice_IslServer::incomingConnection(int socketDescriptor)
|
||||
#else
|
||||
void Servatrice_IslServer::incomingConnection(qintptr socketDescriptor)
|
||||
#endif
|
||||
{
|
||||
QThread *thread = new QThread;
|
||||
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
|
||||
|
@ -317,16 +309,13 @@ bool Servatrice::initServer()
|
|||
if (!certFile.open(QIODevice::ReadOnly))
|
||||
throw QString("Error opening certificate file: %1").arg(certFileName);
|
||||
QSslCertificate cert(&certFile);
|
||||
#if QT_VERSION < 0x050000
|
||||
if (!cert.isValid())
|
||||
throw(QString("Invalid certificate."));
|
||||
#else
|
||||
|
||||
const QDateTime currentTime = QDateTime::currentDateTime();
|
||||
if(currentTime < cert.effectiveDate() ||
|
||||
currentTime > cert.expiryDate() ||
|
||||
cert.isBlacklisted())
|
||||
throw(QString("Invalid certificate."));
|
||||
#endif
|
||||
|
||||
qDebug() << "Loading private key...";
|
||||
QFile keyFile(keyFileName);
|
||||
if (!keyFile.open(QIODevice::ReadOnly))
|
||||
|
|
|
@ -53,11 +53,7 @@ public:
|
|||
Servatrice_GameServer(Servatrice *_server, int _numberPools, const QSqlDatabase &_sqlDatabase, QObject *parent = 0);
|
||||
~Servatrice_GameServer();
|
||||
protected:
|
||||
#if QT_VERSION < 0x050000
|
||||
void incomingConnection(int socketDescriptor);
|
||||
#else
|
||||
void incomingConnection(qintptr socketDescriptor);
|
||||
#endif
|
||||
};
|
||||
|
||||
class Servatrice_IslServer : public QTcpServer {
|
||||
|
@ -70,11 +66,7 @@ public:
|
|||
Servatrice_IslServer(Servatrice *_server, const QSslCertificate &_cert, const QSslKey &_privateKey, QObject *parent = 0)
|
||||
: QTcpServer(parent), server(_server), cert(_cert), privateKey(_privateKey) { }
|
||||
protected:
|
||||
#if QT_VERSION < 0x050000
|
||||
void incomingConnection(int socketDescriptor);
|
||||
#else
|
||||
void incomingConnection(qintptr socketDescriptor);
|
||||
#endif
|
||||
};
|
||||
|
||||
class ServerProperties {
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
#include "settingscache.h"
|
||||
#include <QCoreApplication>
|
||||
#include <QFile>
|
||||
#if QT_VERSION >= 0x050000
|
||||
#include <QStandardPaths>
|
||||
#else
|
||||
#include <QDesktopServices>
|
||||
#endif
|
||||
#include <QStandardPaths>
|
||||
|
||||
SettingsCache::SettingsCache(const QString & fileName, QSettings::Format format, QObject * parent)
|
||||
:QSettings(fileName, format, parent)
|
||||
|
@ -36,10 +32,6 @@ QString SettingsCache::guessConfigurationPath(QString & specificPath)
|
|||
return guessFileName;
|
||||
#endif
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
guessFileName = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/" + fileName;
|
||||
#else
|
||||
guessFileName = QDesktopServices::storageLocation(QDesktopServices::DataLocation) + "/" + fileName;
|
||||
#endif
|
||||
return guessFileName;
|
||||
}
|
||||
|
|
|
@ -26,9 +26,6 @@
|
|||
#include "qxthmac.h"
|
||||
#include <QtGlobal>
|
||||
|
||||
#if QT_VERSION >= 0x040300
|
||||
|
||||
|
||||
/*
|
||||
\class QxtHmac
|
||||
|
||||
|
@ -207,5 +204,3 @@ bool QxtHmac::verify(const QByteArray& key, const QByteArray& hmac, const QByteA
|
|||
d->ohash->addData(inner);
|
||||
return hmac == d->ohash->result();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -27,11 +27,6 @@
|
|||
#define QXTHMAC_H
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
#if QT_VERSION < 0x040300
|
||||
# warning QxtHmac requires Qt 4.3.0 or greater
|
||||
#else
|
||||
|
||||
#include <QCryptographicHash>
|
||||
#include "qxtglobal.h"
|
||||
|
||||
|
@ -61,4 +56,3 @@ private:
|
|||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -10,35 +10,22 @@ endif()
|
|||
target_link_libraries(carddatabase_test ${GTEST_BOTH_LIBRARIES})
|
||||
add_test(NAME carddatabase_test COMMAND carddatabase_test)
|
||||
|
||||
# Qt4 stuff
|
||||
if(Qt4_FOUND)
|
||||
SET(QT_USE_QTNETWORK TRUE)
|
||||
SET(QT_USE_QTMULTIMEDIA TRUE)
|
||||
|
||||
# Include directories
|
||||
INCLUDE(${QT_USE_FILE})
|
||||
INCLUDE_DIRECTORIES(${QT_INCLUDES})
|
||||
TARGET_LINK_LIBRARIES(carddatabase_test ${QT_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# qt5 stuff
|
||||
if(Qt5Widgets_FOUND)
|
||||
include_directories(${Qt5Widgets_INCLUDE_DIRS})
|
||||
list(APPEND COCKATRICE_LIBS Widgets)
|
||||
include_directories(${Qt5Widgets_INCLUDE_DIRS})
|
||||
list(APPEND COCKATRICE_LIBS Widgets)
|
||||
|
||||
# QtConcurrent
|
||||
find_package(Qt5Concurrent)
|
||||
if(Qt5Concurrent_FOUND)
|
||||
# QtConcurrent
|
||||
find_package(Qt5Concurrent)
|
||||
if(Qt5Concurrent_FOUND)
|
||||
include_directories(${Qt5Concurrent_INCLUDE_DIRS})
|
||||
list(APPEND ORACLE_LIBS Concurrent)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# QtNetwork
|
||||
find_package(Qt5Network)
|
||||
if(Qt5Network_FOUND)
|
||||
# QtNetwork
|
||||
find_package(Qt5Network)
|
||||
if(Qt5Network_FOUND)
|
||||
include_directories(${Qt5Network_INCLUDE_DIRS})
|
||||
list(APPEND COCKATRICE_LIBS Network)
|
||||
endif()
|
||||
|
||||
qt5_use_modules(carddatabase_test ${COCKATRICE_LIBS})
|
||||
endif()
|
||||
|
||||
qt5_use_modules(carddatabase_test ${COCKATRICE_LIBS})
|
||||
|
|
|
@ -7,19 +7,19 @@ set -e
|
|||
mkdir build
|
||||
cd build
|
||||
prefix=""
|
||||
if [[ $TRAVIS_OS_NAME == "osx" && $QT4 == 0 ]]; then
|
||||
if [[ $TRAVIS_OS_NAME == "osx" ]]; then
|
||||
prefix="-DCMAKE_PREFIX_PATH=$(echo /usr/local/Cellar/qt5/5.*/)"
|
||||
fi
|
||||
if [[ $TRAVIS_OS_NAME == "linux" && $QT4 == 0 ]]; then
|
||||
if [[ $TRAVIS_OS_NAME == "linux" ]]; then
|
||||
prefix="-DCMAKE_PREFIX_PATH=$(echo /opt/qt5*/lib/cmake/)"
|
||||
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$(echo /opt/qt5*/lib/)"
|
||||
fi
|
||||
|
||||
if [[ $BUILDTYPE == "Debug" ]]; then
|
||||
cmake .. -DWITH_SERVER=1 -DTEST=1 -DCMAKE_BUILD_TYPE=$BUILDTYPE -DWITH_QT4=$QT4 $prefix
|
||||
cmake .. -DWITH_SERVER=1 -DTEST=1 -DCMAKE_BUILD_TYPE=$BUILDTYPE $prefix
|
||||
make -j2
|
||||
make test
|
||||
else
|
||||
cmake .. -DWITH_SERVER=1 -DCMAKE_BUILD_TYPE=$BUILDTYPE -DWITH_QT4=$QT4 $prefix
|
||||
cmake .. -DWITH_SERVER=1 -DCMAKE_BUILD_TYPE=$BUILDTYPE $prefix
|
||||
make package -j2
|
||||
fi
|
||||
|
|
|
@ -2,30 +2,20 @@
|
|||
|
||||
if [[ $TRAVIS_OS_NAME == "osx" ]] ; then
|
||||
brew update > /dev/null
|
||||
if (( QT4 )); then
|
||||
brew install qt protobuf libgcrypt > /dev/null
|
||||
else
|
||||
brew install qt5 protobuf libgcrypt > /dev/null
|
||||
fi
|
||||
brew install qt5 protobuf > /dev/null
|
||||
brew unlink cmake
|
||||
brew upgrade cmake
|
||||
|
||||
else
|
||||
# common prerequisites
|
||||
sudo add-apt-repository -y ppa:smspillaz/cmake-master
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get -y purge cmake
|
||||
sudo apt-get install -y libprotobuf-dev protobuf-compiler cmake bc
|
||||
|
||||
if (( QT4 )); then
|
||||
# qt4 prerequisites
|
||||
sudo apt-get install -y qtmobility-dev libqt4-dev
|
||||
else
|
||||
# qt5 prerequisites
|
||||
sudo apt-get install -y libprotobuf-dev protobuf-compiler \
|
||||
sudo apt-get install -y \
|
||||
libprotobuf-dev protobuf-compiler \
|
||||
cmake \
|
||||
bc \
|
||||
qt5-default qttools5-dev qttools5-dev-tools \
|
||||
qtmultimedia5-dev libqt5multimedia5-plugins libqt5svg5-dev libqt5sql5-mysql
|
||||
fi
|
||||
|
||||
# prerequisites for tests
|
||||
if [[ $BUILDTYPE == "Debug" ]]; then
|
||||
|
|
Loading…
Reference in a new issue