Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Donald Haase
Cockatrice
Commits
f83d5830
Commit
f83d5830
authored
Jul 10, 2014
by
Gavin Bisesi
Browse files
Merge pull request #126 from ctrlaltca/cmake_qt5
Qt5 support
parents
86fa8f30
ea8c55b2
Changes
44
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
f83d5830
...
@@ -7,13 +7,21 @@
...
@@ -7,13 +7,21 @@
cmake_minimum_required
(
VERSION 2.6
)
cmake_minimum_required
(
VERSION 2.6
)
if
(
POLICY CMP0020
)
cmake_policy
(
SET CMP0020 OLD
)
endif
()
if
(
POLICY CMP0043
)
cmake_policy
(
SET CMP0043 OLD
)
endif
()
if
(
POLICY CMP0048
)
cmake_policy
(
SET CMP0048 OLD
)
endif
()
set
(
PROJECT_NAME
"Cockatrice"
)
set
(
PROJECT_NAME
"Cockatrice"
)
set
(
PROJECT_VERSION_MAJOR 0
)
set
(
PROJECT_VERSION_MINOR 0
)
set
(
PROJECT_VERSION_PATCH 1
)
set
(
PROJECT_VERSION
${
PROJECT_VERSION_MAJOR
}
.
${
PROJECT_VERSION_MINOR
}
.
${
PROJECT_VERSION_PATCH
}
)
# Def
u
alt to "Release" build type
# Defa
u
lt to "Release" build type
# User-provided value for CMAKE_BUILD_TYPE must be checked before the PROJECT() call
# User-provided value for CMAKE_BUILD_TYPE must be checked before the PROJECT() call
IF
(
DEFINED CMAKE_BUILD_TYPE
)
IF
(
DEFINED CMAKE_BUILD_TYPE
)
SET
(
CMAKE_BUILD_TYPE
${
CMAKE_BUILD_TYPE
}
CACHE STRING
"Type of build"
)
SET
(
CMAKE_BUILD_TYPE
${
CMAKE_BUILD_TYPE
}
CACHE STRING
"Type of build"
)
...
@@ -24,9 +32,19 @@ ENDIF()
...
@@ -24,9 +32,19 @@ ENDIF()
# A project name is needed for CPack
# A project name is needed for CPack
PROJECT
(
"
${
PROJECT_NAME
}
"
)
PROJECT
(
"
${
PROJECT_NAME
}
"
)
# Set conventional loops
# Set conventional loops
set
(
CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true
)
set
(
CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true
)
# Search path for cmake modules
SET
(
CMAKE_MODULE_PATH
${
PROJECT_SOURCE_DIR
}
/cmake
)
# Retrieve git version hash
include
(
getversion
)
# Create a header and a cpp file containing the version hash
include
(
createversionfile
)
# Define a proper install path
# Define a proper install path
if
(
UNIX
)
if
(
UNIX
)
if
(
APPLE
)
if
(
APPLE
)
...
@@ -71,8 +89,33 @@ IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
...
@@ -71,8 +89,33 @@ IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
ADD_DEFINITIONS
(
"-DSFMT_MEXP=19937"
)
ADD_DEFINITIONS
(
"-DSFMT_MEXP=19937"
)
ENDIF
()
ENDIF
()
#Find Qt4 and enable the needed features
# Find Qt and enable the needed features
FIND_PACKAGE
(
Qt4 REQUIRED
)
# Default is Qt5 unless WITH_QT4 option is enabled
option
(
WITH_QT4
"Force thr use of Qt4 libraries"
OFF
)
IF
(
NOT WITH_QT4
)
FIND_PACKAGE
(
Qt5Widgets
)
ENDIF
()
IF
(
Qt5Widgets_FOUND
)
MESSAGE
(
STATUS
"Found Qt
${
Qt5Widgets_VERSION_STRING
}
"
)
if
(
UNIX AND NOT APPLE AND
"
${
CMAKE_SYSTEM_PROCESSOR
}
"
STREQUAL
"x86_64"
)
# FIX: Qt was built with -reduce-relocations
add_definitions
(
-fPIC
)
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
}
"
)
ELSE
()
MESSAGE
(
FATAL_ERROR
"No Qt4 or Qt5 found!"
)
ENDIF
()
ENDIF
()
set
(
CMAKE_AUTOMOC TRUE
)
set
(
CMAKE_AUTOMOC TRUE
)
...
@@ -83,8 +126,8 @@ FIND_PACKAGE(Protobuf REQUIRED)
...
@@ -83,8 +126,8 @@ FIND_PACKAGE(Protobuf REQUIRED)
set
(
CPACK_PACKAGE_CONTACT
"Daenyth+github@gmail.com"
)
set
(
CPACK_PACKAGE_CONTACT
"Daenyth+github@gmail.com"
)
set
(
CPACK_PACKAGE_DESCRIPTION_SUMMARY
${
PROJECT_NAME
}
)
set
(
CPACK_PACKAGE_DESCRIPTION_SUMMARY
${
PROJECT_NAME
}
)
set
(
CPACK_PACKAGE_VENDOR
"Cockatrice Development Team"
)
set
(
CPACK_PACKAGE_VENDOR
"Cockatrice Development Team"
)
set
(
CPACK_PACKAGE_DESCRIPTION_FILE
"
${
CMAKE_CURREN
T_SOURCE_DIR
}
/README.md"
)
set
(
CPACK_PACKAGE_DESCRIPTION_FILE
"
${
PROJEC
T_SOURCE_DIR
}
/README.md"
)
set
(
CPACK_RESOURCE_FILE_LICENSE
"
${
CMAKE_CURREN
T_SOURCE_DIR
}
/COPYING"
)
set
(
CPACK_RESOURCE_FILE_LICENSE
"
${
PROJEC
T_SOURCE_DIR
}
/COPYING"
)
set
(
CPACK_PACKAGE_VERSION_MAJOR
"
${
PROJECT_VERSION_MAJOR
}
"
)
set
(
CPACK_PACKAGE_VERSION_MAJOR
"
${
PROJECT_VERSION_MAJOR
}
"
)
set
(
CPACK_PACKAGE_VERSION_MINOR
"
${
PROJECT_VERSION_MINOR
}
"
)
set
(
CPACK_PACKAGE_VERSION_MINOR
"
${
PROJECT_VERSION_MINOR
}
"
)
set
(
CPACK_PACKAGE_VERSION_PATCH
"
${
PROJECT_VERSION_PATCH
}
"
)
set
(
CPACK_PACKAGE_VERSION_PATCH
"
${
PROJECT_VERSION_PATCH
}
"
)
...
@@ -96,7 +139,7 @@ if(UNIX)
...
@@ -96,7 +139,7 @@ if(UNIX)
set
(
CPACK_DMG_FORMAT
"UDBZ"
)
set
(
CPACK_DMG_FORMAT
"UDBZ"
)
set
(
CPACK_DMG_VOLUME_NAME
"
${
PROJECT_NAME
}
"
)
set
(
CPACK_DMG_VOLUME_NAME
"
${
PROJECT_NAME
}
"
)
set
(
CPACK_SYSTEM_NAME
"OSX"
)
set
(
CPACK_SYSTEM_NAME
"OSX"
)
set
(
CPACK_PACKAGE_FILE_NAME
"
${
PROJECT_NAME
}
-
${
PROJECT_VERSION
}
"
)
set
(
CPACK_PACKAGE_FILE_NAME
"
${
PROJECT_NAME
}
-
osx_git-
${
PROJECT_VERSION
}
"
)
set
(
CPACK_PACKAGE_ICON
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/cockatrice/resources/appicon.icns"
)
set
(
CPACK_PACKAGE_ICON
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/cockatrice/resources/appicon.icns"
)
else
()
else
()
# linux
# linux
...
@@ -107,13 +150,13 @@ if(UNIX)
...
@@ -107,13 +150,13 @@ if(UNIX)
endif
()
endif
()
elseif
(
WIN32
)
elseif
(
WIN32
)
set
(
CPACK_GENERATOR NSIS
${
CPACK_GENERATOR
}
)
set
(
CPACK_GENERATOR NSIS
${
CPACK_GENERATOR
}
)
set
(
CPACK_PACKAGE_
INSTALL_DIRECTORY
"
${
PROJECT_NAME
}
\\\\
${
PROJECT_VERSION
}
"
)
set
(
CPACK_PACKAGE_
FILE_NAME
"
${
PROJECT_NAME
}
_win32_git-
${
PROJECT_VERSION
}
"
)
set
(
CPACK_NSIS_INSTALLED_ICON_NAME
"bin
\\\\
${
PROJECT_NAME
}
.exe"
)
set
(
CPACK_NSIS_DISPLAY_NAME
"
${
CPACK_PACKAGE_INSTALL_DIRECTORY
}
${
PROJECT_NAME
}
"
)
# Configure file with custom definitions for NSIS.
set
(
CPACK_NSIS_HELP_LINK
"https://github.com/Daenyth/Cockatrice"
)
configure_file
(
set
(
CPACK_NSIS_URL_INFO_ABOUT
"https://github.com/Daenyth/Cockatrice"
)
${
CMAKE_MODULE_PATH
}
/NSIS.definitions.nsh.in
set
(
CPACK_NSIS_CONTACT
"Daenyth+github@gmail.com"
)
${
PROJECT_BINARY_DIR
}
/NSIS.definitions.nsh
set
(
CPACK_NSIS_MODIFY_PATH ON
)
)
endif
()
endif
()
include
(
CPack
)
include
(
CPack
)
...
...
servatric
e/FindLibgcrypt.cmake
→
cmak
e/FindLibgcrypt.cmake
View file @
f83d5830
File moved
c
ockatric
e/FindQtMobility.cmake
→
c
mak
e/FindQtMobility.cmake
View file @
f83d5830
File moved
cmake/NSIS.definitions.nsh.in
0 → 100644
View file @
f83d5830
!define NSIS_PROJECT_NAME "@PROJECT_NAME@"
!define NSIS_SOURCE_PATH "@PROJECT_SOURCE_DIR@"
!define NSIS_BINARY_PATH "@PROJECT_BINARY_DIR@"
\ No newline at end of file
nsis/cockatrice.nsi
→
cmake/NSIS.template.in
View file @
f83d5830
!include ..\..\..\NSIS.definitions.nsh
!include "MUI2.nsh"
!include "MUI2.nsh"
!include "FileFunc.nsh"
!include "FileFunc.nsh"
!define /date TIMESTAMP "%Y%m%d"
Name "${NSIS_PROJECT_NAME}"
!searchparse /file ../build/cockatrice/version_string.cpp '= "' VERSION '";'
OutFile "@CPACK_TOPLEVEL_DIRECTORY@/@CPACK_OUTPUT_FILE_NAME@"
Name "Cockatrice"
OutFile "cockatrice_win32_${TIMESTAMP}_git-${VERSION}.exe"
SetCompressor /SOLID lzma
SetCompressor /SOLID lzma
InstallDir "$PROGRAMFILES\Cockatrice"
InstallDir "$PROGRAMFILES\Cockatrice"
; set the Qt install dir here (and make sure you use the latest 4.8 version for packaging)
!define QTDIR "C:\Qt\4.8.6"
!define MUI_ABORTWARNING
!define MUI_ABORTWARNING
!define MUI_WELCOMEFINISHPAGE_BITMAP "leftimage.bmp"
!define MUI_WELCOMEFINISHPAGE_BITMAP "
${NSIS_SOURCE_PATH}\cmake\
leftimage.bmp"
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "leftimage.bmp"
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "
${NSIS_SOURCE_PATH}\cmake\
leftimage.bmp"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "headerimage.bmp"
!define MUI_HEADERIMAGE_BITMAP "
${NSIS_SOURCE_PATH}\cmake\
headerimage.bmp"
!define MUI_HEADERIMAGE_UNBITMAP "headerimage.bmp"
!define MUI_HEADERIMAGE_UNBITMAP "
${NSIS_SOURCE_PATH}\cmake\
headerimage.bmp"
!define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of Cockatrice.$\r$\n$\r$\nClick Next to continue."
!define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of Cockatrice.$\r$\n$\r$\nClick Next to continue."
!define MUI_FINISHPAGE_RUN "$INSTDIR/oracle.exe"
!define MUI_FINISHPAGE_RUN "$INSTDIR/oracle.exe"
!define MUI_FINISHPAGE_RUN_TEXT "Run card database downloader now"
!define MUI_FINISHPAGE_RUN_TEXT "Run card database downloader now"
!define MUI_FINISHPAGE_RUN_PARAMETERS "-dlsets"
!define MUI_FINISHPAGE_RUN_PARAMETERS "-dlsets"
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "
..
\COPYING"
!insertmacro MUI_PAGE_LICENSE "
${NSIS_SOURCE_PATH}
\COPYING"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_INSTFILES
...
@@ -39,37 +34,8 @@ InstallDir "$PROGRAMFILES\Cockatrice"
...
@@ -39,37 +34,8 @@ InstallDir "$PROGRAMFILES\Cockatrice"
Section "Application" SecApplication
Section "Application" SecApplication
SetShellVarContext all
SetShellVarContext all
SetOutPath "$INSTDIR"
SetOutPath "$INSTDIR"
File ..\build\cockatrice\Release\cockatrice.exe
File ..\build\oracle\Release\oracle.exe
File ..\doc\usermanual\Usermanual.pdf
File ..\build\protobuf-2.5.0\protobuf-2.5.0\vsprojects\Release\libprotobuf.lib
File "${QTDIR}\bin\QtCore4.dll"
File "${QTDIR}\bin\QtGui4.dll"
File "${QTDIR}\bin\QtNetwork4.dll"
File "${QTDIR}\bin\QtSvg4.dll"
File "${QTDIR}\bin\QtXml4.dll"
File "${QTDIR}\bin\QtMultimedia4.dll"
SetOutPath "$INSTDIR\zonebg"
File /r ..\zonebg\*.*
SetOutPath "$INSTDIR\plugins"
SetOutPath "$INSTDIR\plugins\codecs"
File "${QTDIR}\plugins\codecs\qcncodecs4.dll"
File "${QTDIR}\plugins\codecs\qjpcodecs4.dll"
File "${QTDIR}\plugins\codecs\qkrcodecs4.dll"
File "${QTDIR}\plugins\codecs\qtwcodecs4.dll"
SetOutPath "$INSTDIR\plugins\iconengines"
File "${QTDIR}\plugins\iconengines\qsvgicon4.dll"
SetOutPath "$INSTDIR\plugins\imageformats"
File "${QTDIR}\plugins\imageformats\qjpeg4.dll"
File "${QTDIR}\plugins\imageformats\qsvg4.dll"
SetOutPath "$INSTDIR\sounds"
File /r ..\sounds\*.*
SetOutPath "$INSTDIR\translations"
File /r "${NSIS_BINARY_PATH}\Release\*.*"
File /r ..\build\cockatrice\*.qm
WriteUninstaller "$INSTDIR\uninstall.exe"
WriteUninstaller "$INSTDIR\uninstall.exe"
${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
...
@@ -107,12 +73,10 @@ SetShellVarContext all
...
@@ -107,12 +73,10 @@ SetShellVarContext all
Delete "$INSTDIR\oracle.exe"
Delete "$INSTDIR\oracle.exe"
Delete "$INSTDIR\Usermanual.pdf"
Delete "$INSTDIR\Usermanual.pdf"
Delete "$INSTDIR\libprotobuf.lib"
Delete "$INSTDIR\libprotobuf.lib"
Delete "$INSTDIR\QtCore4.dll"
Delete "$INSTDIR\Qt*.dll"
Delete "$INSTDIR\QtGui4.dll"
Delete "$INSTDIR\icu*.dll"
Delete "$INSTDIR\QtNetwork4.dll"
Delete "$INSTDIR\qt.conf"
Delete "$INSTDIR\QtSvg4.dll"
Delete "$INSTDIR\qdebug.txt"
Delete "$INSTDIR\QtXml4.dll"
Delete "$INSTDIR\QtMultimedia4.dll"
RMDir "$INSTDIR"
RMDir "$INSTDIR"
RMDir "$SMPROGRAMS\Cockatrice"
RMDir "$SMPROGRAMS\Cockatrice"
...
...
cmake/createversionfile.cmake
0 → 100644
View file @
f83d5830
set
(
VERSION_STRING_CPP
"
${
PROJECT_BINARY_DIR
}
/version_string.cpp"
)
set
(
VERSION_STRING_H
"
${
PROJECT_BINARY_DIR
}
/version_string.h"
)
INCLUDE_DIRECTORIES
(
${
PROJECT_BINARY_DIR
}
)
set
(
hstring
"extern const char *VERSION_STRING
\;\n
"
)
set
(
cppstring
"const char * VERSION_STRING =
\"
${
PROJECT_VERSION
}
\"\;\n
"
)
file
(
WRITE
${
PROJECT_BINARY_DIR
}
/version_string.cpp.txt
${
cppstring
}
)
file
(
WRITE
${
PROJECT_BINARY_DIR
}
/version_string.h.txt
${
hstring
}
)
execute_process
(
COMMAND
${
CMAKE_COMMAND
}
-E copy_if_different
${
PROJECT_BINARY_DIR
}
/version_string.h.txt
${
VERSION_STRING_H
}
)
execute_process
(
COMMAND
${
CMAKE_COMMAND
}
-E copy_if_different
${
PROJECT_BINARY_DIR
}
/version_string.cpp.txt
${
VERSION_STRING_CPP
}
)
c
ommon
/getversion.cmake
→
c
make
/getversion.cmake
View file @
f83d5830
...
@@ -15,15 +15,5 @@ else()
...
@@ -15,15 +15,5 @@ else()
message
(
WARNING
"Git not found. Build will not contain git revision info."
)
message
(
WARNING
"Git not found. Build will not contain git revision info."
)
endif
()
endif
()
set
(
hstring
"extern const char *VERSION_STRING
\;\n
"
)
set
(
PROJECT_VERSION_MAJOR
${
GIT_COMMIT_ID
}
)
set
(
cppstring
"const char * VERSION_STRING =
\"
${
GIT_COMMIT_ID
}
\"\;\n
"
)
set
(
PROJECT_VERSION
${
GIT_COMMIT_ID
}
)
\ No newline at end of file
file
(
WRITE version_string.cpp.txt
${
cppstring
}
)
file
(
WRITE version_string.h.txt
${
hstring
}
)
execute_process
(
COMMAND
${
CMAKE_COMMAND
}
-E copy_if_different version_string.h.txt
${
CMAKE_CURRENT_BINARY_DIR
}
/version_string.h
)
execute_process
(
COMMAND
${
CMAKE_COMMAND
}
-E copy_if_different version_string.cpp.txt
${
CMAKE_CURRENT_BINARY_DIR
}
/version_string.cpp
)
nsis
/headerimage.bmp
→
cmake
/headerimage.bmp
View file @
f83d5830
File moved
nsis
/leftimage.bmp
→
cmake
/leftimage.bmp
View file @
f83d5830
File moved
cockatrice/CMakeLists.txt
View file @
f83d5830
...
@@ -90,7 +90,7 @@ SET(cockatrice_SOURCES
...
@@ -90,7 +90,7 @@ SET(cockatrice_SOURCES
src/qt-json/json.cpp
src/qt-json/json.cpp
src/soundengine.cpp
src/soundengine.cpp
src/pending_command.cpp
src/pending_command.cpp
${
CMAKE_CURRENT_BINARY_DIR
}
/version_string.cpp
${
VERSION_STRING_CPP
}
)
)
if
(
UNIX AND NOT APPLE
)
if
(
UNIX AND NOT APPLE
)
...
@@ -125,41 +125,119 @@ if(APPLE)
...
@@ -125,41 +125,119 @@ if(APPLE)
set
(
cockatrice_SOURCES
${
cockatrice_SOURCES
}
${
CMAKE_CURRENT_SOURCE_DIR
}
/resources/appicon.icns
)
set
(
cockatrice_SOURCES
${
cockatrice_SOURCES
}
${
CMAKE_CURRENT_SOURCE_DIR
}
/resources/appicon.icns
)
ENDIF
(
APPLE
)
ENDIF
(
APPLE
)
if
(
NOT QT_QTMULTIMEDIA_FOUND
)
set
(
COCKATRICE_LIBS
)
SET
(
CMAKE_MODULE_PATH
${
CMAKE_CURRENT_SOURCE_DIR
}
)
FIND_PACKAGE
(
QtMobility REQUIRED
)
endif
(
NOT QT_QTMULTIMEDIA_FOUND
)
SET
(
QT_USE_QTNETWORK TRUE
)
# Qt4 stuff
SET
(
QT_USE_QTMULTIMEDIA TRUE
)
if
(
Qt4_FOUND
)
SET
(
QT_USE_QTXML TRUE
)
if
(
NOT QT_QTMULTIMEDIA_FOUND
)
SET
(
QT_USE_QTSVG TRUE
)
FIND_PACKAGE
(
QtMobility REQUIRED
)
endif
()
SET
(
QT_USE_QTNETWORK TRUE
)
SET
(
QT_USE_QTMULTIMEDIA TRUE
)
SET
(
QT_USE_QTXML 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
QT4_ADD_TRANSLATION
(
cockatrice_QM
${
cockatrice_TS
}
)
QT4_ADD_RESOURCES
(
cockatrice_RESOURCES_RCC
${
cockatrice_RESOURCES
}
)
endif
()
# qt5 stuff
if
(
Qt5Widgets_FOUND
)
include_directories
(
${
Qt5Widgets_INCLUDE_DIRS
}
)
list
(
APPEND COCKATRICE_LIBS Widgets
)
# QtNetwork
find_package
(
Qt5Network
)
if
(
Qt5Network_FOUND
)
include_directories
(
${
Qt5Network_INCLUDE_DIRS
}
)
list
(
APPEND COCKATRICE_LIBS Network
)
endif
()
# QtMultimedia
find_package
(
Qt5Multimedia
)
if
(
Qt5Multimedia_FOUND
)
include_directories
(
${
Qt5Multimedia_INCLUDE_DIRS
}
)
list
(
APPEND COCKATRICE_LIBS Multimedia
)
endif
()
# QtPrinter
find_package
(
Qt5PrintSupport
)
if
(
Qt5PrintSupport_FOUND
)
include_directories
(
${
Qt5PrintSupport_INCLUDE_DIRS
}
)
list
(
APPEND COCKATRICE_LIBS PrintSupport
)
endif
()
# QtXml
find_package
(
Qt5Xml
)
if
(
Qt5Xml_FOUND
)
include_directories
(
${
Qt5Xml_INCLUDE_DIRS
}
)
list
(
APPEND COCKATRICE_LIBS Xml
)
endif
()
# QtSvg
find_package
(
Qt5Svg
)
if
(
Qt5Svg_FOUND
)
include_directories
(
${
Qt5Svg_INCLUDE_DIRS
}
)
list
(
APPEND COCKATRICE_LIBS Svg
)
endif
()
# Qt5LinguistTools
find_package
(
Qt5LinguistTools
)
if
(
Qt5LinguistTools_FOUND
)
include_directories
(
${
Qt5LinguistTools_INCLUDE_DIRS
}
)
list
(
APPEND COCKATRICE_LIBS LinguistTools
)
endif
()
# Let cmake chew Qt5's translations and resource files
# Note: header files are MOC-ed automatically by cmake
QT5_ADD_TRANSLATION
(
cockatrice_QM
${
cockatrice_TS
}
)
QT5_ADD_RESOURCES
(
cockatrice_RESOURCES_RCC
${
cockatrice_RESOURCES
}
)
# guess plugins and libraries directory
set
(
QT_PLUGINS_DIR
"
${
Qt5Widgets_DIR
}
/../../../plugins"
)
get_target_property
(
QT_LIBRARY_DIR Qt5::Core LOCATION
)
get_filename_component
(
QT_LIBRARY_DIR
${
QT_LIBRARY_DIR
}
PATH
)
endif
()
# Declare path variables
# Declare path variables
set
(
ICONDIR share/icons CACHE STRING
"icon dir"
)
set
(
ICONDIR share/icons CACHE STRING
"icon dir"
)
set
(
DESKTOPDIR share/applications CACHE STRING
"desktop file destination"
)
set
(
DESKTOPDIR share/applications CACHE STRING
"desktop file destination"
)
# Let cmake chew Qt4's translations and resource files
# Note: header files are MOC-ed automatically by cmake
QT4_ADD_TRANSLATION
(
cockatrice_QM
${
cockatrice_TS
}
)
QT4_ADD_RESOURCES
(
cockatrice_RESOURCES_RCC
${
cockatrice_RESOURCES
}
)
# Include directories
# Include directories
INCLUDE
(
${
QT_USE_FILE
}
)
INCLUDE_DIRECTORIES
(
../common
)
INCLUDE_DIRECTORIES
(
../common
)
INCLUDE_DIRECTORIES
(
${
PROTOBUF_INCLUDE_DIR
}
)
INCLUDE_DIRECTORIES
(
${
PROTOBUF_INCLUDE_DIR
}
)
INCLUDE_DIRECTORIES
(
${
CMAKE_BINARY_DIR
}
/common
)
INCLUDE_DIRECTORIES
(
${
CMAKE_BINARY_DIR
}
/common
)
INCLUDE_DIRECTORIES
(
${
CMAKE_CURRENT_BINARY_DIR
}
)
INCLUDE_DIRECTORIES
(
${
CMAKE_CURRENT_BINARY_DIR
}
)
INCLUDE_DIRECTORIES
(
${
QT_MOBILITY_INCLUDE_DIR
}
)
INCLUDE_DIRECTORIES
(
${
QT_MOBILITY_MULTIMEDIAKIT_INCLUDE_DIR
}
)
# Build cockatrice binary and link it
# Build cockatrice binary and link it
ADD_EXECUTABLE
(
cockatrice WIN32 MACOSX_BUNDLE
${
cockatrice_SOURCES
}
${
cockatrice_QM
}
${
cockatrice_RESOURCES_RCC
}
${
cockatrice_MOC_SRCS
}
)
ADD_EXECUTABLE
(
cockatrice WIN32 MACOSX_BUNDLE
${
cockatrice_SOURCES
}
${
cockatrice_QM
}
${
cockatrice_RESOURCES_RCC
}
${
cockatrice_MOC_SRCS
}
)
TARGET_LINK_LIBRARIES
(
cockatrice cockatrice_common
${
QT_QTMAIN_LIBRARY
}
${
QT_LIBRARIES
}
${
QT_MOBILITY_MULTIMEDIAKIT_LIBRARY
}
)
if
(
MSVC
)
if
(
Qt4_FOUND
)
set_target_properties
(
cockatrice PROPERTIES LINK_FLAGS
"/SUBSYSTEM:WINDOWS"
)
if
(
MSVC
)
endif
(
MSVC
)
set
(
QT_USE_QTMAIN true
)
endif
()
TARGET_LINK_LIBRARIES
(
cockatrice cockatrice_common
${
COCKATRICE_LIBS
}
)
endif
()
if
(
Qt5Widgets_FOUND
)
if
(
MSVC
)
TARGET_LINK_LIBRARIES
(
cockatrice cockatrice_common Qt5::WinMain
)
else
()
TARGET_LINK_LIBRARIES
(
cockatrice cockatrice_common
)
endif
()
qt5_use_modules
(
cockatrice
${
COCKATRICE_LIBS
}
)
endif
()
if
(
UNIX
)
if
(
UNIX
)
if
(
APPLE
)
if
(
APPLE
)
...
@@ -178,11 +256,6 @@ elseif(WIN32)
...
@@ -178,11 +256,6 @@ elseif(WIN32)
INSTALL
(
FILES
${
cockatrice_QM
}
DESTINATION ./translations
)
INSTALL
(
FILES
${
cockatrice_QM
}
DESTINATION ./translations
)
endif
()
endif
()
add_custom_command
(
OUTPUT
${
CMAKE_CURRENT_BINARY_DIR
}
/version_string.cpp
${
CMAKE_CURRENT_BINARY_DIR
}
/version_string.h
COMMAND
${
CMAKE_COMMAND
}
-DSOURCE_DIR=
${
CMAKE_CURRENT_SOURCE_DIR
}
-P
${
CMAKE_CURRENT_SOURCE_DIR
}
/../common/getversion.cmake
)
if
(
APPLE
)
if
(
APPLE
)
# these needs to be relative to CMAKE_INSTALL_PREFIX
# these needs to be relative to CMAKE_INSTALL_PREFIX
set
(
plugin_dest_dir cockatrice.app/Contents/Plugins
)
set
(
plugin_dest_dir cockatrice.app/Contents/Plugins
)
...
@@ -215,3 +288,36 @@ Data = Resources\")
...
@@ -215,3 +288,36 @@ Data = Resources\")
fixup_bundle(
\"\$
{CMAKE_INSTALL_PREFIX}/cockatrice.app
\"
\"\$
{QTPLUGINS}
\"
\"
${
QT_LIBRARY_DIR
}
\"
)
fixup_bundle(
\"\$
{CMAKE_INSTALL_PREFIX}/cockatrice.app
\"
\"\$
{QTPLUGINS}
\"
\"
${
QT_LIBRARY_DIR
}
\"
)
"
COMPONENT Runtime
)
"
COMPONENT Runtime
)
endif
()
endif
()
if
(
WIN32
)
# these needs to be relative to CMAKE_INSTALL_PREFIX
set
(
plugin_dest_dir Plugins
)
set
(
qtconf_dest_dir .
)
# note: no codecs in qt5
# note: phonon_backend => mediaservice
# note: needs platform on osx
if
(
CMAKE_BUILD_TYPE STREQUAL
"Debug"
)
install
(
DIRECTORY
"
${
QT_PLUGINS_DIR
}
/"
DESTINATION
${
plugin_dest_dir
}
COMPONENT Runtime
FILES_MATCHING REGEX
"(codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/.*d
\\
.dll"
)
else
()
install
(
DIRECTORY
"
${
QT_PLUGINS_DIR
}
/"
DESTINATION
${
plugin_dest_dir
}
COMPONENT Runtime
FILES_MATCHING REGEX
"(codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/.*[^d]
\\
.dll"
)
endif
()
install
(
CODE
"
file(WRITE
\"\$
{CMAKE_INSTALL_PREFIX}/
${
qtconf_dest_dir
}
/qt.conf
\"
\"
[Paths]
Plugins = Plugins
Translations = Resources/translations
Data = Resources
\"
)
"
COMPONENT Runtime
)
install
(
CODE
"
file(GLOB_RECURSE QTPLUGINS
\"\$
{CMAKE_INSTALL_PREFIX}/
${
plugin_dest_dir
}
/*.dll
\"
)
set(BU_CHMOD_BUNDLE_ITEMS ON)
include(BundleUtilities)
fixup_bundle(
\"\$
{CMAKE_INSTALL_PREFIX}/cockatrice.exe
\"
\"\$
{QTPLUGINS}
\"
\"
${
QT_LIBRARY_DIR
}
\"
)
"
COMPONENT Runtime
)
endif
()
\ No newline at end of file
cockatrice/src/abstractcounter.cpp
View file @
f83d5830
...
@@ -11,8 +11,12 @@
...
@@ -11,8 +11,12 @@
AbstractCounter
::
AbstractCounter
(
Player
*
_player
,
int
_id
,
const
QString
&
_name
,
bool
_shownInCounterArea
,
int
_value
,
QGraphicsItem
*
parent
)
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
)
:
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
);
setAcceptsHoverEvents
(
true
);
#else
setAcceptHoverEvents
(
true
);
#endif
if
(
player
->
getLocal
())
{
if
(
player
->
getLocal
())
{
menu
=
new
QMenu
(
name
);
menu
=
new
QMenu
(
name
);
aSet
=
new
QAction
(
this
);
aSet
=
new
QAction
(
this
);
...
@@ -129,7 +133,13 @@ void AbstractCounter::setCounter()
...
@@ -129,7 +133,13 @@ void AbstractCounter::setCounter()
{
{
bool
ok
;
bool
ok
;
dialogSemaphore
=
true
;
dialogSemaphore
=
true
;
int
newValue
=
QInputDialog
::
getInteger
(
0
,
tr
(
"Set counter"
),
tr
(
"New value for counter '%1':"
).
arg
(
name
),
value
,
-
2000000000
,
2000000000
,
1
,
&
ok
);
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
);
if
(
deleteAfterDialog
)
{
if
(
deleteAfterDialog
)
{
deleteLater
();
deleteLater
();
return
;
return
;
...
...
cockatrice/src/carddatabasemodel.cpp
View file @
f83d5830
...
@@ -68,6 +68,8 @@ QVariant CardDatabaseModel::headerData(int section, Qt::Orientation orientation,
...
@@ -68,6 +68,8 @@ QVariant CardDatabaseModel::headerData(int section, Qt::Orientation orientation,
void
CardDatabaseModel
::
updateCardList
()
void
CardDatabaseModel
::
updateCardList
()
{
{
beginResetModel
();
for
(
int
i
=
0
;
i
<
cardList
.
size
();
++
i
)
for
(
int
i
=
0
;
i
<
cardList
.
size
();
++
i
)
disconnect
(
cardList
[
i
],
0
,
this
,
0
);
disconnect
(
cardList
[
i
],
0
,
this
,
0
);
...
@@ -75,7 +77,7 @@ void CardDatabaseModel::updateCardList()
...
@@ -75,7 +77,7 @@ void CardDatabaseModel::updateCardList()
for
(
int
i
=
0
;
i
<
cardList
.
size
();
++
i
)
for
(
int
i
=
0
;
i
<
cardList
.
size
();
++
i
)
connect
(
cardList
[
i
],
SIGNAL
(
cardInfoChanged
(
CardInfo
*
)),
this
,
SLOT
(
cardInfoChanged
(
CardInfo
*
)));
connect
(
cardList
[
i
],
SIGNAL
(
cardInfoChanged
(
CardInfo
*
)),
this
,
SLOT
(
cardInfoChanged
(
CardInfo
*
)));
reset
();
endResetModel
();
}
}
void
CardDatabaseModel
::
cardInfoChanged
(
CardInfo
*
card
)
void
CardDatabaseModel
::
cardInfoChanged
(
CardInfo
*
card
)
...
...
cockatrice/src/decklistmodel.cpp
View file @
f83d5830
...
@@ -30,6 +30,8 @@ DeckListModel::~DeckListModel()
...
@@ -30,6 +30,8 @@ DeckListModel::~DeckListModel()
void
DeckListModel
::
rebuildTree
()
void
DeckListModel
::
rebuildTree
()
{
{
beginResetModel
();
root
->
clearTree
();
root
->
clearTree
();
InnerDecklistNode
*
listRoot
=
deckList
->
getRoot
();
InnerDecklistNode
*
listRoot
=
deckList
->
getRoot
();
for
(
int
i
=
0
;
i
<
listRoot
->
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
listRoot
->
size
();
i
++
)
{
...
@@ -55,7 +57,7 @@ void DeckListModel::rebuildTree()
...
@@ -55,7 +57,7 @@ void DeckListModel::rebuildTree()
}
}
}
}
reset
();
endResetModel
();
}
}
int
DeckListModel
::
rowCount
(
const
QModelIndex
&
parent
)
const
int
DeckListModel
::
rowCount
(
const
QModelIndex
&
parent
)
const
...
...
cockatrice/src/deckstats_interface.cpp
View file @
f83d5830
...
@@ -7,6 +7,10 @@
...
@@ -7,6 +7,10 @@
#include
<QMessageBox>
#include
<QMessageBox>
#include
<QDesktopServices>
#include
<QDesktopServices>
#if QT_VERSION >= 0x050000
#include
<QUrlQuery>
#endif
DeckStatsInterface
::
DeckStatsInterface
(
QObject
*
parent
)
DeckStatsInterface
::
DeckStatsInterface
(
QObject
*
parent
)
:
QObject
(
parent
)
:
QObject
(
parent
)
{
{
...
@@ -39,12 +43,29 @@ void DeckStatsInterface::queryFinished(QNetworkReply *reply)
...
@@ -39,12 +43,29 @@ void DeckStatsInterface::queryFinished(QNetworkReply *reply)
deleteLater
();
deleteLater
();
}
}
void
DeckStatsInterface
::
analyzeDeck
(
DeckList
*
deck
)
#if QT_VERSION < 0x050000
void
DeckStatsInterface
::
getAnalyzeRequestData
(
DeckList
*
deck
,
QByteArray
*
data
)
{
{
QUrl
params
;
QUrl
params
;
params
.
addQueryItem
(
"deck"
,
deck
->
writeToString_Plain
());
params
.
addQueryItem
(
"deck"
,
deck
->
writeToString_Plain
());
data
->
append
(
params
.
encodedQuery
());
}
#else
void
DeckStatsInterface
::
getAnalyzeRequestData
(
DeckList
*
deck
,
QByteArray
*
data
)
{
QUrl
params
;
QUrlQuery
urlQuery
;
urlQuery
.
addQueryItem
(
"deck"
,
deck
->
writeToString_Plain
());
params
.
setQuery
(
urlQuery
);
data
->
append
(
params
.
query
(
QUrl
::
EncodeReserved
));
}
#endif
void
DeckStatsInterface
::
analyzeDeck
(
DeckList
*
deck
)
{
QByteArray
data
;
QByteArray
data
;
data
.
append
(
params
.
encodedQuery
()
);
getAnalyzeRequestData
(
deck
,
&
data
);
QNetworkRequest
request
(
QUrl
(
"http://deckstats.net/index.php"
));
QNetworkRequest
request
(
QUrl
(
"http://deckstats.net/index.php"
));
request
.
setHeader
(
QNetworkRequest
::
ContentTypeHeader
,
"application/x-www-form-urlencoded"
);
request
.
setHeader
(
QNetworkRequest
::
ContentTypeHeader
,
"application/x-www-form-urlencoded"
);
...
...
cockatrice/src/deckstats_interface.h
View file @
f83d5830
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
#include
<QObject>
#include
<QObject>
class
QByteArray
;
class
QNetworkAccessManager
;
class
QNetworkAccessManager
;
class
QNetworkReply
;
class
QNetworkReply
;
class
DeckList
;
class
DeckList
;
...
@@ -13,6 +14,7 @@ private:
...
@@ -13,6 +14,7 @@ private:
QNetworkAccessManager
*
manager
;
QNetworkAccessManager
*
manager
;
private
slots
:
private
slots
:
void
queryFinished
(
QNetworkReply
*
reply
);
void
queryFinished
(
QNetworkReply
*
reply
);
void
getAnalyzeRequestData
(
DeckList
*
deck
,
QByteArray
*
data
);
public:
public:
DeckStatsInterface
(
QObject
*
parent
=
0
);
DeckStatsInterface
(
QObject
*
parent
=
0
);
void
analyzeDeck
(
DeckList
*
deck
);
void
analyzeDeck
(
DeckList
*
deck
);
...
...
cockatrice/src/deckview.cpp
View file @
f83d5830
...
@@ -64,7 +64,11 @@ void DeckViewCardDragItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
...
@@ -64,7 +64,11 @@ void DeckViewCardDragItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
DeckViewCard
::
DeckViewCard
(
const
QString
&
_name
,
const
QString
&
_originZone
,
QGraphicsItem
*
parent
)
DeckViewCard
::
DeckViewCard
(
const
QString
&
_name
,
const
QString
&
_originZone
,
QGraphicsItem
*
parent
)
:
AbstractCardItem
(
_name
,
0
,
-
1
,
parent
),
originZone
(
_originZone
),
dragItem
(
0
)
:
AbstractCardItem
(
_name
,
0
,
-
1
,
parent
),
originZone
(
_originZone
),
dragItem
(
0
)
{
{
#if QT_VERSION < 0x050000
setAcceptsHoverEvents
(
true
);
setAcceptsHoverEvents
(
true
);
#else
setAcceptHoverEvents
(
true
);
#endif
}
}
DeckViewCard
::~
DeckViewCard
()
DeckViewCard
::~
DeckViewCard
()
...
...
cockatrice/src/dlg_create_token.cpp
View file @
f83d5830
...
@@ -79,8 +79,13 @@ DlgCreateToken::DlgCreateToken(const QStringList &_predefinedTokens, QWidget *pa
...
@@ -79,8 +79,13 @@ DlgCreateToken::DlgCreateToken(const QStringList &_predefinedTokens, QWidget *pa
chooseTokenView
->
header
()
->
setStretchLastSection
(
false
);
chooseTokenView
->
header
()
->
setStretchLastSection
(
false
);
chooseTokenView
->
header
()
->
hideSection
(
1
);
chooseTokenView
->
header
()
->
hideSection
(
1
);
chooseTokenView
->
header
()
->
hideSection
(
2
);
chooseTokenView
->
header
()
->
hideSection
(
2
);
#if QT_VERSION < 0x050000
chooseTokenView
->
header
()
->
setResizeMode
(
3
,
QHeaderView
::
ResizeToContents
);
chooseTokenView
->
header
()
->
setResizeMode
(
3
,
QHeaderView
::
ResizeToContents
);
chooseTokenView
->
header
()
->
setResizeMode
(
4
,
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
)));
connect
(
chooseTokenView
->
selectionModel
(),
SIGNAL
(
currentRowChanged
(
QModelIndex
,
QModelIndex
)),
this
,
SLOT
(
tokenSelectionChanged
(
QModelIndex
,
QModelIndex
)));
if
(
predefinedTokens
.
isEmpty
())
if
(
predefinedTokens
.
isEmpty
())
...
...
cockatrice/src/dlg_edit_tokens.cpp
View file @
f83d5830
...
@@ -73,8 +73,13 @@ DlgEditTokens::DlgEditTokens(CardDatabaseModel *_cardDatabaseModel, QWidget *par
...
@@ -73,8 +73,13 @@ DlgEditTokens::DlgEditTokens(CardDatabaseModel *_cardDatabaseModel, QWidget *par
chooseTokenView
->
header
()
->
setStretchLastSection
(
false
);
chooseTokenView
->
header
()
->
setStretchLastSection
(
false
);
chooseTokenView
->
header
()
->
hideSection
(
1
);
chooseTokenView
->
header
()
->
hideSection
(
1
);
chooseTokenView
->
header
()
->
hideSection
(
2
);
chooseTokenView
->
header
()
->
hideSection
(
2
);
#if QT_VERSION < 0x050000
chooseTokenView
->
header
()
->
setResizeMode
(
3
,
QHeaderView
::
ResizeToContents
);
chooseTokenView
->
header
()
->
setResizeMode
(
3
,
QHeaderView
::
ResizeToContents
);
chooseTokenView
->
header
()
->
setResizeMode
(
4
,
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
)));
connect
(
chooseTokenView
->
selectionModel
(),
SIGNAL
(
currentRowChanged
(
QModelIndex
,
QModelIndex
)),
this
,
SLOT
(
tokenSelectionChanged
(
QModelIndex
,
QModelIndex
)));
QAction
*
aAddToken
=
new
QAction
(
tr
(
"Add token"
),
this
);
QAction
*
aAddToken
=
new
QAction
(
tr
(
"Add token"
),
this
);
...
...
cockatrice/src/gameselector.cpp
View file @
f83d5830
...
@@ -33,8 +33,11 @@ GameSelector::GameSelector(AbstractClient *_client, const TabSupervisor *_tabSup
...
@@ -33,8 +33,11 @@ GameSelector::GameSelector(AbstractClient *_client, const TabSupervisor *_tabSup
gameListView
->
header
()
->
hideSection
(
1
);
gameListView
->
header
()
->
hideSection
(
1
);
else
else
gameListProxyModel
->
setUnavailableGamesVisible
(
true
);
gameListProxyModel
->
setUnavailableGamesVisible
(
true
);
#if QT_VERSION < 0x050000
gameListView
->
header
()
->
setResizeMode
(
1
,
QHeaderView
::
ResizeToContents
);
gameListView
->
header
()
->
setResizeMode
(
1
,
QHeaderView
::
ResizeToContents
);
#else
gameListView
->
header
()
->
setSectionResizeMode
(
1
,
QHeaderView
::
ResizeToContents
);
#endif
filterButton
=
new
QPushButton
;
filterButton
=
new
QPushButton
;
filterButton
->
setIcon
(
QIcon
(
":/resources/icon_search.svg"
));
filterButton
->
setIcon
(
QIcon
(
":/resources/icon_search.svg"
));
connect
(
filterButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
actSetFilter
()));
connect
(
filterButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
actSetFilter
()));
...
...
cockatrice/src/main.cpp
View file @
f83d5830
...
@@ -55,6 +55,7 @@ QString translationPath = TRANSLATION_PATH;
...
@@ -55,6 +55,7 @@ QString translationPath = TRANSLATION_PATH;
QString
translationPath
=
QString
();
QString
translationPath
=
QString
();
#endif
#endif
#if QT_VERSION < 0x050000
static
void
myMessageOutput
(
QtMsgType
/*type*/
,
const
char
*
msg
)
static
void
myMessageOutput
(
QtMsgType
/*type*/
,
const
char
*
msg
)
{
{
QFile
file
(
"qdebug.txt"
);
QFile
file
(
"qdebug.txt"
);
...
@@ -63,6 +64,16 @@ static void myMessageOutput(QtMsgType /*type*/, const char *msg)
...
@@ -63,6 +64,16 @@ static void myMessageOutput(QtMsgType /*type*/, const char *msg)
out
<<
msg
<<
endl
;
out
<<
msg
<<
endl
;
file
.
close
();
file
.
close
();
}
}
#else
static
void
myMessageOutput
(
QtMsgType
/*type*/
,
const
QMessageLogContext
&
,
const
QString
&
msg
)
{
QFile
file
(
"qdebug.txt"
);
file
.
open
(
QIODevice
::
WriteOnly
|
QIODevice
::
Truncate
|
QIODevice
::
Text
);
QTextStream
out
(
&
file
);
out
<<
msg
<<
endl
;
file
.
close
();
}
#endif
void
installNewTranslator
()
void
installNewTranslator
()
{
{
...
@@ -87,11 +98,21 @@ int main(int argc, char *argv[])
...
@@ -87,11 +98,21 @@ int main(int argc, char *argv[])
QApplication
app
(
argc
,
argv
);
QApplication
app
(
argc
,
argv
);
if
(
app
.
arguments
().
contains
(
"--debug-output"
))
if
(
app
.
arguments
().
contains
(
"--debug-output"
))
{
#if QT_VERSION < 0x050000
qInstallMsgHandler
(
myMessageOutput
);
qInstallMsgHandler
(
myMessageOutput
);
#else
qInstallMessageHandler
(
myMessageOutput
);
#endif
}
#ifdef Q_OS_WIN
#ifdef Q_OS_WIN
app
.
addLibraryPath
(
app
.
applicationDirPath
()
+
"/plugins"
);
app
.
addLibraryPath
(
app
.
applicationDirPath
()
+
"/plugins"
);
#endif
#endif
#if QT_VERSION < 0x050000
// gone in Qt5, all source files _MUST_ be utf8-encoded
QTextCodec
::
setCodecForCStrings
(
QTextCodec
::
codecForName
(
"UTF-8"
));
QTextCodec
::
setCodecForCStrings
(
QTextCodec
::
codecForName
(
"UTF-8"
));
#endif
QCoreApplication
::
setOrganizationName
(
"Cockatrice"
);
QCoreApplication
::
setOrganizationName
(
"Cockatrice"
);
QCoreApplication
::
setOrganizationDomain
(
"cockatrice.de"
);
QCoreApplication
::
setOrganizationDomain
(
"cockatrice.de"
);
...
@@ -114,8 +135,13 @@ int main(int argc, char *argv[])
...
@@ -114,8 +135,13 @@ int main(int argc, char *argv[])
installNewTranslator
();
installNewTranslator
();
qsrand
(
QDateTime
::
currentDateTime
().
toTime_t
());
qsrand
(
QDateTime
::
currentDateTime
().
toTime_t
());
bool
startMainProgram
=
true
;
#if QT_VERSION < 0x050000
const
QString
dataDir
=
QDesktopServices
::
storageLocation
(
QDesktopServices
::
DataLocation
);
const
QString
dataDir
=
QDesktopServices
::
storageLocation
(
QDesktopServices
::
DataLocation
);
#else
const
QString
dataDir
=
QStandardPaths
::
standardLocations
(
QStandardPaths
::
DataLocation
).
first
();
#endif
if
(
!
db
->
getLoadSuccess
())
if
(
!
db
->
getLoadSuccess
())
if
(
db
->
loadCardDatabase
(
dataDir
+
"/cards.xml"
))
if
(
db
->
loadCardDatabase
(
dataDir
+
"/cards.xml"
))
settingsCache
->
setCardDatabasePath
(
dataDir
+
"/cards.xml"
);
settingsCache
->
setCardDatabasePath
(
dataDir
+
"/cards.xml"
);
...
...
Prev
1
2
3
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment