From 8fc08800a48970248ca80f48c4a5a7f28c548663 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Thu, 12 Jun 2014 23:47:01 +0200 Subject: [PATCH 01/66] CPack generator; removed old prepareMacRelease.sh By now tested on OSX only --- CMakeLists.txt | 42 +++++++++++++++++++++++++++ prepareMacRelease.sh | 67 -------------------------------------------- 2 files changed, 42 insertions(+), 67 deletions(-) delete mode 100644 prepareMacRelease.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index 8c3219cc4..b0e779fb9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,11 +68,51 @@ set(CMAKE_AUTOMOC TRUE) # Find other needed libraries FIND_PACKAGE(Protobuf REQUIRED) +# Package builder +set(CPACK_PACKAGE_CONTACT "Daenyth+github@gmail.com") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${PROJECT_NAME}) +set(CPACK_PACKAGE_VENDOR "Cockatrice Development Team") +set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md") +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING") +set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}") +set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}") +set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}") + +if(UNIX) + if(APPLE) + set(CPACK_GENERATOR DragNDrop ${CPACK_GENERATOR}) + set(CPACK_GENERATOR "DragNDrop") + set(CPACK_DMG_FORMAT "UDBZ") + set(CPACK_DMG_VOLUME_NAME "${PROJECT_NAME}") + set(CPACK_SYSTEM_NAME "OSX") + set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}") + set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/cockatrice/resources/appicon.icns") + else() + # linux + set(CPACK_GENERATOR DEB ${CPACK_GENERATOR}) + set(CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}/${PROJECT_VERSION}") + set(CPACK_STRIP_FILES "bin/${PROJECT_NAME}") + set(CPACK_SOURCE_STRIP_FILES "") + endif() +elseif(WIN32) + set(CPACK_GENERATOR NSIS ${CPACK_GENERATOR}) + set(CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}\\\\${PROJECT_VERSION}") + set(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\${PROJECT_NAME}.exe") + set(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} ${PROJECT_NAME}") + set(CPACK_NSIS_HELP_LINK "https://github.com/Daenyth/Cockatrice") + set(CPACK_NSIS_URL_INFO_ABOUT "https://github.com/Daenyth/Cockatrice") + set(CPACK_NSIS_CONTACT "Daenyth+github@gmail.com") + set(CPACK_NSIS_MODIFY_PATH ON) +endif() + +include(CPack) + # Compile servatrice (default off) option(WITH_SERVER "build servatrice" OFF) add_subdirectory(common) if(WITH_SERVER) add_subdirectory(servatrice) + SET(CPACK_INSTALL_CMAKE_PROJECTS "servatrice;servatrice;ALL;/" ${CPACK_INSTALL_CMAKE_PROJECTS}) endif() # Compile cockatrice (default on) @@ -81,12 +121,14 @@ if(WITH_CLIENT) add_subdirectory(cockatrice) add_subdirectory(sounds) add_subdirectory(zonebg) + SET(CPACK_INSTALL_CMAKE_PROJECTS "cockatrice;cockatrice;ALL;/" ${CPACK_INSTALL_CMAKE_PROJECTS}) endif() # Compile oracle (default on) option(WITH_ORACLE "build oracle" ON) if(WITH_ORACLE) add_subdirectory(oracle) + SET(CPACK_INSTALL_CMAKE_PROJECTS "release/oracle.app;oracle;ALL;/" ${CPACK_INSTALL_CMAKE_PROJECTS}) endif() # Compile testclient (default off) diff --git a/prepareMacRelease.sh b/prepareMacRelease.sh deleted file mode 100644 index d1f58e26d..000000000 --- a/prepareMacRelease.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/sh - -FRAMEWORKS="Core Gui Multimedia Network Svg Xml" -DATE=`date '+%Y%m%d'` -#QTDIR="/Users/brukie/QtSDK/Desktop/Qt/474/gcc" -QTLIB="/Users/brukie/qt_leopard/lib" -QTPLUGINS="/Users/brukie/qt_leopard/plugins" -PROTOBUF="/Users/brukie/protobuf_leopard" -DIR=cockatrice_mac_$DATE -if [ -d $DIR ]; then echo "delete old dir first"; exit 1; fi - -mkdir $DIR - -cp -R build/cockatrice/cockatrice.app $DIR -cp -R build/oracle/oracle.app $DIR -mkdir $DIR/Frameworks -cp -R sounds zonebg $DIR -mkdir $DIR/translations -cp build/cockatrice/*.qm $DIR/translations -cp -R $QTPLUGINS $DIR/PlugIns -for f in $FRAMEWORKS; do - cp -R $QTLIB/Qt"$f".framework $DIR/Frameworks -done -find $DIR/Frameworks -name '*debug*'|xargs -n 1 rm -f -find $DIR/Frameworks -name 'Headers'|xargs -n 1 rm -rf -find $DIR/PlugIns -name '*debug*'|xargs -n 1 rm -f -cp $PROTOBUF/lib/libprotobuf.7.dylib $DIR/Frameworks - -cd $DIR -for f in $FRAMEWORKS; do - echo "Framework $f" - echo "step 1" - install_name_tool -id @executable_path/../../../Frameworks/Qt"$f".framework/Versions/4/Qt"$f" Frameworks/Qt"$f".framework/Versions/4/Qt"$f" - for g in $FRAMEWORKS; do - install_name_tool -change $QTLIB/Qt"$f".framework/Versions/4/Qt"$f" @executable_path/../../../Frameworks/Qt"$f".framework/Versions/4/Qt"$f" Frameworks/Qt"$g".framework/Versions/4/Qt"$g" - done - echo "step 2" - for g in cockatrice oracle; do - install_name_tool -change $QTLIB/Qt"$f".framework/Versions/4/Qt"$f" @executable_path/../../../Frameworks/Qt"$f".framework/Versions/4/Qt"$f" "$g".app/Contents/MacOS/$g - done - echo "step 3" - for g in `find . -name '*.dylib'`; do - install_name_tool -change $QTLIB/Qt"$f".framework/Versions/4/Qt"$f" @executable_path/../../../Frameworks/Qt"$f".framework/Versions/4/Qt"$f" "$g" - done -done - -install_name_tool -id @executable_path/../../../libprotobuf.7.dylib Frameworks/libprotobuf.7.dylib -install_name_tool -change $PROTOBUF/lib/libprotobuf.7.dylib @executable_path/../../../Frameworks/libprotobuf.7.dylib cockatrice.app/Contents/MacOS/cockatrice - -cd .. - -VOL=cockatrice_mac_${DATE} -DMG="tmp-$VOL.dmg" - -SIZE=`du -sk $DIR | cut -f1` -SIZE=$((${SIZE}/1000+10)) -hdiutil create "$DMG" -megabytes ${SIZE} -ov -type UDIF -fs HFS+ -volname "$VOL" - -hdid "$DMG" -cp -R "${DIR}" "/Volumes/$VOL" -hdiutil detach "/Volumes/$VOL" -#osascript -e "tell application "Finder" to eject disk "$VOL"" && - -# convert to compressed image, delete temp image -rm -f "${VOL}.dmg" -hdiutil convert "$DMG" -format UDZO -o "${VOL}.dmg" -rm -f "$DMG" From 501ef1306b0b03a411013e0fad8ce4765454def7 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Sat, 21 Jun 2014 16:59:31 +0200 Subject: [PATCH 02/66] Workaround permission problem in ixup_bundle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without this change, make install and make package would require “sudo” under osx --- cockatrice/CMakeLists.txt | 1 + oracle/CMakeLists.txt | 1 + servatrice/CMakeLists.txt | 1 + 3 files changed, 3 insertions(+) diff --git a/cockatrice/CMakeLists.txt b/cockatrice/CMakeLists.txt index 499836dd1..c0cb47685 100644 --- a/cockatrice/CMakeLists.txt +++ b/cockatrice/CMakeLists.txt @@ -206,6 +206,7 @@ Plugins = Plugins\") install(CODE " file(GLOB_RECURSE QTPLUGINS \"${plugin_dest_dir}/*.dylib\") + set(BU_CHMOD_BUNDLE_ITEMS ON) include(BundleUtilities) fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/cockatrice.app\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR}\") " COMPONENT Runtime) diff --git a/oracle/CMakeLists.txt b/oracle/CMakeLists.txt index 2eada38cf..d9b5df755 100644 --- a/oracle/CMakeLists.txt +++ b/oracle/CMakeLists.txt @@ -71,6 +71,7 @@ Plugins = Plugins\") install(CODE " file(GLOB_RECURSE QTPLUGINS \"${plugin_dest_dir}/*.dylib\") + set(BU_CHMOD_BUNDLE_ITEMS ON) include(BundleUtilities) fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/oracle.app\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR}\") " COMPONENT Runtime) diff --git a/servatrice/CMakeLists.txt b/servatrice/CMakeLists.txt index 799cecbd8..19575ca1e 100644 --- a/servatrice/CMakeLists.txt +++ b/servatrice/CMakeLists.txt @@ -78,6 +78,7 @@ Plugins = Plugins\") install(CODE " file(GLOB_RECURSE QTPLUGINS \"${plugin_dest_dir}/*.dylib\") + set(BU_CHMOD_BUNDLE_ITEMS ON) include(BundleUtilities) fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/servatrice.app\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR}\") " COMPONENT Runtime) From 87d4309aaa51796fe47ead153cc4a31223a63e8e Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Sat, 21 Jun 2014 17:28:27 +0200 Subject: [PATCH 03/66] Fix qt.conf file creation for "make package" --- cockatrice/CMakeLists.txt | 4 +++- oracle/CMakeLists.txt | 4 +++- servatrice/CMakeLists.txt | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cockatrice/CMakeLists.txt b/cockatrice/CMakeLists.txt index c0cb47685..535c5ac3c 100644 --- a/cockatrice/CMakeLists.txt +++ b/cockatrice/CMakeLists.txt @@ -183,8 +183,10 @@ add_custom_command( ) if(APPLE) + # this needs to be relative set(plugin_dest_dir ./cockatrice.app/Contents/Plugins) - set(qtconf_dest_dir ./cockatrice.app/Contents/Resources) + # instead, this needs an absolute path (for make package to work) + set(qtconf_dest_dir ${CMAKE_INSTALL_PREFIX}/cockatrice.app/Contents/Resources) # note: no codecs in qt5 # note: phonon_backend => mediaservice diff --git a/oracle/CMakeLists.txt b/oracle/CMakeLists.txt index d9b5df755..46502cc4a 100644 --- a/oracle/CMakeLists.txt +++ b/oracle/CMakeLists.txt @@ -48,8 +48,10 @@ IF (NOT WIN32 AND NOT APPLE) ENDIF (NOT WIN32 AND NOT APPLE) if(APPLE) + # this needs to be relative set(plugin_dest_dir ./oracle.app/Contents/Plugins) - set(qtconf_dest_dir ./oracle.app/Contents/Resources) + # instead, this needs an absolute path (for make) + set(qtconf_dest_dir ${CMAKE_INSTALL_PREFIX}/oracle.app/Contents/Resources) # note: no codecs in qt5 # note: phonon_backend => mediaservice diff --git a/servatrice/CMakeLists.txt b/servatrice/CMakeLists.txt index 19575ca1e..9a66fe3b1 100644 --- a/servatrice/CMakeLists.txt +++ b/servatrice/CMakeLists.txt @@ -55,8 +55,10 @@ elseif(WIN32) endif() if(APPLE) + # this needs to be relative set(plugin_dest_dir ./servatrice.app/Contents/Plugins) - set(qtconf_dest_dir ./servatrice.app/Contents/Resources) + # instead, this needs an absolute path (for make) + set(qtconf_dest_dir ${CMAKE_INSTALL_PREFIX}/servatrice.app/Contents/Resources) # note: no codecs in qt5 # note: phonon_backend => mediaservice From d74703f7af3edfaf78a98ae9524d607981ac43e4 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Sat, 21 Jun 2014 17:28:58 +0200 Subject: [PATCH 04/66] osx: install sounds and zonebg as cockatrice's resources --- sounds/CMakeLists.txt | 2 +- zonebg/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sounds/CMakeLists.txt b/sounds/CMakeLists.txt index e38c9090b..cd9f6c331 100644 --- a/sounds/CMakeLists.txt +++ b/sounds/CMakeLists.txt @@ -6,7 +6,7 @@ FILE(GLOB sounds "${CMAKE_CURRENT_SOURCE_DIR}/*.raw") if(UNIX) if(APPLE) - INSTALL(FILES ${sounds} DESTINATION sounds/) + INSTALL(FILES ${sounds} DESTINATION cockatrice.app/Contents/Resources/sounds/) else() # Assume linux INSTALL(FILES ${sounds} DESTINATION share/cockatrice/sounds/) diff --git a/zonebg/CMakeLists.txt b/zonebg/CMakeLists.txt index 961c4e12a..e2904502d 100644 --- a/zonebg/CMakeLists.txt +++ b/zonebg/CMakeLists.txt @@ -6,7 +6,7 @@ FILE(GLOB zonebg "${CMAKE_CURRENT_SOURCE_DIR}/*.*") if(UNIX) if(APPLE) - INSTALL(FILES ${zonebg} DESTINATION zonebg/) + INSTALL(FILES ${zonebg} DESTINATION cockatrice.app/Contents/Resources/zonebg/) else() # Assume linux INSTALL(FILES ${zonebg} DESTINATION share/cockatrice/zonebg/) From b743ba4e6e0e7cf7c4bf67c2fb76be1d88cebd9b Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Sat, 21 Jun 2014 18:15:27 +0200 Subject: [PATCH 05/66] Partially revert previous commits; ensure the bundle is fixed up correctly --- cockatrice/CMakeLists.txt | 4 +--- oracle/CMakeLists.txt | 4 +--- servatrice/CMakeLists.txt | 4 +--- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/cockatrice/CMakeLists.txt b/cockatrice/CMakeLists.txt index 535c5ac3c..4303f567a 100644 --- a/cockatrice/CMakeLists.txt +++ b/cockatrice/CMakeLists.txt @@ -183,9 +183,7 @@ add_custom_command( ) if(APPLE) - # this needs to be relative - set(plugin_dest_dir ./cockatrice.app/Contents/Plugins) - # instead, this needs an absolute path (for make package to work) + set(plugin_dest_dir ${CMAKE_INSTALL_PREFIX}/cockatrice.app/Contents/Plugins) set(qtconf_dest_dir ${CMAKE_INSTALL_PREFIX}/cockatrice.app/Contents/Resources) # note: no codecs in qt5 diff --git a/oracle/CMakeLists.txt b/oracle/CMakeLists.txt index 46502cc4a..e42b154be 100644 --- a/oracle/CMakeLists.txt +++ b/oracle/CMakeLists.txt @@ -48,9 +48,7 @@ IF (NOT WIN32 AND NOT APPLE) ENDIF (NOT WIN32 AND NOT APPLE) if(APPLE) - # this needs to be relative - set(plugin_dest_dir ./oracle.app/Contents/Plugins) - # instead, this needs an absolute path (for make) + set(plugin_dest_dir ${CMAKE_INSTALL_PREFIX}/oracle.app/Contents/Plugins) set(qtconf_dest_dir ${CMAKE_INSTALL_PREFIX}/oracle.app/Contents/Resources) # note: no codecs in qt5 diff --git a/servatrice/CMakeLists.txt b/servatrice/CMakeLists.txt index 9a66fe3b1..5b65c2f9d 100644 --- a/servatrice/CMakeLists.txt +++ b/servatrice/CMakeLists.txt @@ -55,9 +55,7 @@ elseif(WIN32) endif() if(APPLE) - # this needs to be relative - set(plugin_dest_dir ./servatrice.app/Contents/Plugins) - # instead, this needs an absolute path (for make) + set(plugin_dest_dir ${CMAKE_INSTALL_PREFIX}/servatrice.app/Contents/Plugins) set(qtconf_dest_dir ${CMAKE_INSTALL_PREFIX}/servatrice.app/Contents/Resources) # note: no codecs in qt5 From f9554267d41c52d0262594739e90034d190043a7 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Sat, 21 Jun 2014 19:04:42 +0200 Subject: [PATCH 06/66] This finally fixes both make install and make package --- cockatrice/CMakeLists.txt | 15 +++++++++------ oracle/CMakeLists.txt | 9 ++++++--- servatrice/CMakeLists.txt | 9 ++++++--- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/cockatrice/CMakeLists.txt b/cockatrice/CMakeLists.txt index 4303f567a..f60669269 100644 --- a/cockatrice/CMakeLists.txt +++ b/cockatrice/CMakeLists.txt @@ -183,8 +183,10 @@ add_custom_command( ) if(APPLE) - set(plugin_dest_dir ${CMAKE_INSTALL_PREFIX}/cockatrice.app/Contents/Plugins) - set(qtconf_dest_dir ${CMAKE_INSTALL_PREFIX}/cockatrice.app/Contents/Resources) + # this needs to be relative + set(plugin_dest_dir cockatrice.app/Contents/Plugins) + # instead, this needs an absolute path (for make package to work) + set(qtconf_dest_dir cockatrice.app/Contents/Resources) # note: no codecs in qt5 # note: phonon_backend => mediaservice @@ -199,13 +201,14 @@ if(APPLE) endif() install(CODE " - file(WRITE \"${qtconf_dest_dir}/qt.conf\" \"[Paths] -Plugins = Plugins\") - " COMPONENT Runtime) + file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"[Paths] +Plugins = Plugins +Translations = Resources/translations\") + " COMPONENT Runtime) install(CODE " file(GLOB_RECURSE QTPLUGINS - \"${plugin_dest_dir}/*.dylib\") + \"\${CMAKE_INSTALL_PREFIX}/${plugin_dest_dir}/*.dylib\") set(BU_CHMOD_BUNDLE_ITEMS ON) include(BundleUtilities) fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/cockatrice.app\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR}\") diff --git a/oracle/CMakeLists.txt b/oracle/CMakeLists.txt index e42b154be..55b63050b 100644 --- a/oracle/CMakeLists.txt +++ b/oracle/CMakeLists.txt @@ -48,7 +48,9 @@ IF (NOT WIN32 AND NOT APPLE) ENDIF (NOT WIN32 AND NOT APPLE) if(APPLE) - set(plugin_dest_dir ${CMAKE_INSTALL_PREFIX}/oracle.app/Contents/Plugins) + # this needs to be relative + set(plugin_dest_dir oracle.app/Contents/Plugins) + # instead, this needs an absolute path (for make) set(qtconf_dest_dir ${CMAKE_INSTALL_PREFIX}/oracle.app/Contents/Resources) # note: no codecs in qt5 @@ -65,12 +67,13 @@ if(APPLE) install(CODE " file(WRITE \"${qtconf_dest_dir}/qt.conf\" \"[Paths] -Plugins = Plugins\") +Plugins = Plugins +Translations = Resources/translations\") " COMPONENT Runtime) install(CODE " file(GLOB_RECURSE QTPLUGINS - \"${plugin_dest_dir}/*.dylib\") + \"\${CMAKE_INSTALL_PREFIX}/${plugin_dest_dir}/*.dylib\") set(BU_CHMOD_BUNDLE_ITEMS ON) include(BundleUtilities) fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/oracle.app\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR}\") diff --git a/servatrice/CMakeLists.txt b/servatrice/CMakeLists.txt index 5b65c2f9d..8c44c05ba 100644 --- a/servatrice/CMakeLists.txt +++ b/servatrice/CMakeLists.txt @@ -55,7 +55,9 @@ elseif(WIN32) endif() if(APPLE) - set(plugin_dest_dir ${CMAKE_INSTALL_PREFIX}/servatrice.app/Contents/Plugins) + # this needs to be relative + set(plugin_dest_dir servatrice.app/Contents/Plugins) + # instead, this needs an absolute path (for make) set(qtconf_dest_dir ${CMAKE_INSTALL_PREFIX}/servatrice.app/Contents/Resources) # note: no codecs in qt5 @@ -72,12 +74,13 @@ if(APPLE) install(CODE " file(WRITE \"${qtconf_dest_dir}/qt.conf\" \"[Paths] -Plugins = Plugins\") +Plugins = Plugins +Translations = Resources/translations\") " COMPONENT Runtime) install(CODE " file(GLOB_RECURSE QTPLUGINS - \"${plugin_dest_dir}/*.dylib\") + \"\${CMAKE_INSTALL_PREFIX}/${plugin_dest_dir}/*.dylib\") set(BU_CHMOD_BUNDLE_ITEMS ON) include(BundleUtilities) fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/servatrice.app\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR}\") From e39cfb7968fc2f8ebd33e46d852fb4820b07b591 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Sat, 21 Jun 2014 19:09:41 +0200 Subject: [PATCH 07/66] Osx: removed plugins path detection and fixed translation path detection --- cockatrice/src/main.cpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/cockatrice/src/main.cpp b/cockatrice/src/main.cpp index ef57655a0..4c953e510 100644 --- a/cockatrice/src/main.cpp +++ b/cockatrice/src/main.cpp @@ -80,15 +80,6 @@ int main(int argc, char *argv[]) if (app.arguments().contains("--debug-output")) qInstallMsgHandler(myMessageOutput); -#ifdef Q_OS_MAC - QDir baseDir(app.applicationDirPath()); - baseDir.cdUp(); - baseDir.cdUp(); - baseDir.cdUp(); - QDir pluginsDir = baseDir; - pluginsDir.cd("PlugIns"); - app.addLibraryPath(pluginsDir.absolutePath()); -#endif #ifdef Q_OS_WIN app.addLibraryPath(app.applicationDirPath() + "/plugins"); #endif @@ -100,11 +91,12 @@ int main(int argc, char *argv[]) if (translationPath.isEmpty()) { #ifdef Q_OS_MAC - QDir translationsDir = baseDir; + QDir translationsDir = app.applicationDirPath(); + translationsDir.cd(".."); + translationsDir.cd("Resources"); translationsDir.cd("translations"); translationPath = translationsDir.absolutePath(); -#endif -#ifdef Q_OS_WIN +#elif Q_OS_WIN translationPath = app.applicationDirPath() + "/translations"; #endif } From 8305927fa2f7337a7d8f80830f03d13cc7157081 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Sun, 22 Jun 2014 21:11:39 +0200 Subject: [PATCH 08/66] Port "make package" fix to oracle and servatrice --- cockatrice/CMakeLists.txt | 3 +-- oracle/CMakeLists.txt | 9 ++++----- servatrice/CMakeLists.txt | 7 +++---- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/cockatrice/CMakeLists.txt b/cockatrice/CMakeLists.txt index f60669269..170721b4e 100644 --- a/cockatrice/CMakeLists.txt +++ b/cockatrice/CMakeLists.txt @@ -183,9 +183,8 @@ add_custom_command( ) if(APPLE) - # this needs to be relative + # these needs to be relative to CMAKE_INSTALL_PREFIX set(plugin_dest_dir cockatrice.app/Contents/Plugins) - # instead, this needs an absolute path (for make package to work) set(qtconf_dest_dir cockatrice.app/Contents/Resources) # note: no codecs in qt5 diff --git a/oracle/CMakeLists.txt b/oracle/CMakeLists.txt index 55b63050b..05bcd494b 100644 --- a/oracle/CMakeLists.txt +++ b/oracle/CMakeLists.txt @@ -48,10 +48,9 @@ IF (NOT WIN32 AND NOT APPLE) ENDIF (NOT WIN32 AND NOT APPLE) if(APPLE) - # this needs to be relative + # these needs to be relative to CMAKE_INSTALL_PREFIX set(plugin_dest_dir oracle.app/Contents/Plugins) - # instead, this needs an absolute path (for make) - set(qtconf_dest_dir ${CMAKE_INSTALL_PREFIX}/oracle.app/Contents/Resources) + set(qtconf_dest_dir oracle.app/Contents/Resources) # note: no codecs in qt5 # note: phonon_backend => mediaservice @@ -66,10 +65,10 @@ if(APPLE) endif() install(CODE " - file(WRITE \"${qtconf_dest_dir}/qt.conf\" \"[Paths] + file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"[Paths] Plugins = Plugins Translations = Resources/translations\") - " COMPONENT Runtime) + " COMPONENT Runtime) install(CODE " file(GLOB_RECURSE QTPLUGINS diff --git a/servatrice/CMakeLists.txt b/servatrice/CMakeLists.txt index 8c44c05ba..c1aefed1c 100644 --- a/servatrice/CMakeLists.txt +++ b/servatrice/CMakeLists.txt @@ -55,10 +55,9 @@ elseif(WIN32) endif() if(APPLE) - # this needs to be relative + # these needs to be relative to CMAKE_INSTALL_PREFIX set(plugin_dest_dir servatrice.app/Contents/Plugins) - # instead, this needs an absolute path (for make) - set(qtconf_dest_dir ${CMAKE_INSTALL_PREFIX}/servatrice.app/Contents/Resources) + set(qtconf_dest_dir servatrice.app/Contents/Resources) # note: no codecs in qt5 # note: phonon_backend => mediaservice @@ -73,7 +72,7 @@ if(APPLE) endif() install(CODE " - file(WRITE \"${qtconf_dest_dir}/qt.conf\" \"[Paths] + file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"[Paths] Plugins = Plugins Translations = Resources/translations\") " COMPONENT Runtime) From 2b371fd96b8b61a237405b32a22a768de93f3974 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Sun, 22 Jun 2014 21:19:10 +0200 Subject: [PATCH 09/66] OSX: get translation path from qt.conf instead of hardcoding it --- cockatrice/src/main.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cockatrice/src/main.cpp b/cockatrice/src/main.cpp index 84975fb17..18c8b56e7 100644 --- a/cockatrice/src/main.cpp +++ b/cockatrice/src/main.cpp @@ -91,11 +91,7 @@ int main(int argc, char *argv[]) if (translationPath.isEmpty()) { #ifdef Q_OS_MAC - QDir translationsDir = app.applicationDirPath(); - translationsDir.cd(".."); - translationsDir.cd("Resources"); - translationsDir.cd("translations"); - translationPath = translationsDir.absolutePath(); + translationPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath); #elif Q_OS_WIN translationPath = app.applicationDirPath() + "/translations"; #endif From 45c71c09cd8274eec7bf3ed183ce99b8f9bf0205 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Sun, 22 Jun 2014 23:21:29 +0200 Subject: [PATCH 10/66] OSX: Handle zonebg for first time installations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If none of the gameboard images is set and and the user’s data directory doesn’t contain a “zonebg” directory, create the directory, copy contents from cockatrice’s app bundle and sets the config accordingly. --- cockatrice/CMakeLists.txt | 3 ++- cockatrice/src/main.cpp | 22 ++++++++++++++++++++++ cockatrice/src/settingscache.cpp | 26 ++++++++++++++++++++++++++ cockatrice/src/settingscache.h | 1 + 4 files changed, 51 insertions(+), 1 deletion(-) diff --git a/cockatrice/CMakeLists.txt b/cockatrice/CMakeLists.txt index 170721b4e..8cfca2577 100644 --- a/cockatrice/CMakeLists.txt +++ b/cockatrice/CMakeLists.txt @@ -202,7 +202,8 @@ if(APPLE) install(CODE " file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"[Paths] Plugins = Plugins -Translations = Resources/translations\") +Translations = Resources/translations +Data = Resources\") " COMPONENT Runtime) install(CODE " diff --git a/cockatrice/src/main.cpp b/cockatrice/src/main.cpp index 18c8b56e7..f3e2ad16f 100644 --- a/cockatrice/src/main.cpp +++ b/cockatrice/src/main.cpp @@ -126,6 +126,28 @@ int main(int argc, char *argv[]) QDir().mkpath(dataDir + "/pics"); settingsCache->setPicsPath(dataDir + "/pics"); } +#ifdef Q_OS_MAC + if(settingsCache->getHandBgPath().isEmpty() && + settingsCache->getStackBgPath().isEmpty() && + settingsCache->getTableBgPath().isEmpty() && + settingsCache->getPlayerBgPath().isEmpty()) + { + QString srcDir = QLibraryInfo::location(QLibraryInfo::DataPath); + QString destDir = dataDir + "/zonebg"; + QDir tmpDir(destDir); + if(!tmpDir.exists()) + { + // try to install the default images for the current user and set the settigs value + settingsCache->copyPath(srcDir + "/zonebg", destDir); + + settingsCache->setHandBgPath(destDir + "/fabric_green.png"); + settingsCache->setStackBgPath(destDir + "/fabric_red.png"); + settingsCache->setTableBgPath(destDir + "/fabric_blue.png"); + settingsCache->setPlayerBgPath(destDir + "/fabric_gray.png"); + } + } +#endif + if (!db->getLoadSuccess() || !QDir(settingsCache->getDeckPath()).exists() || settingsCache->getDeckPath().isEmpty() || settingsCache->getPicsPath().isEmpty() || !QDir(settingsCache->getPicsPath()).exists()) { DlgSettings dlgSettings; dlgSettings.show(); diff --git a/cockatrice/src/settingscache.cpp b/cockatrice/src/settingscache.cpp index ac5c130fb..ee4fc6356 100644 --- a/cockatrice/src/settingscache.cpp +++ b/cockatrice/src/settingscache.cpp @@ -1,5 +1,6 @@ #include "settingscache.h" #include +#include SettingsCache::SettingsCache() { @@ -256,3 +257,28 @@ void SettingsCache::setMainWindowGeometry(const QByteArray &_mainWindowGeometry) mainWindowGeometry = _mainWindowGeometry; settings->setValue("interface/main_window_geometry", mainWindowGeometry); } + +void SettingsCache::copyPath(const QString &src, const QString &dst) +{ + // test source && return if inexistent + QDir dir(src); + if (! dir.exists()) + return; + // test destination && create if inexistent + QDir tmpDir(dst); + if (!tmpDir.exists()) + { + tmpDir.setPath(QDir::rootPath()); + tmpDir.mkdir(dst); + } + + foreach (QString d, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) { + QString dst_path = dst + QDir::separator() + d; + dir.mkpath(dst_path); + copyPath(src+ QDir::separator() + d, dst_path); + } + + foreach (QString f, dir.entryList(QDir::Files)) { + QFile::copy(src + QDir::separator() + f, dst + QDir::separator() + f); + } +} diff --git a/cockatrice/src/settingscache.h b/cockatrice/src/settingscache.h index 5156772dd..5ae11c9e7 100644 --- a/cockatrice/src/settingscache.h +++ b/cockatrice/src/settingscache.h @@ -89,6 +89,7 @@ public: bool getIgnoreUnregisteredUsers() const { return ignoreUnregisteredUsers; } QString getPicUrl() const { return picUrl; } QString getPicUrlHq() const { return picUrlHq; } + void copyPath(const QString &src, const QString &dst); public slots: void setMainWindowGeometry(const QByteArray &_mainWindowGeometry); void setLang(const QString &_lang); From d396b3dfacd6a46b62adcef00be9adae5bb6c28f Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Sun, 22 Jun 2014 23:24:44 +0200 Subject: [PATCH 11/66] Zonebg: avoid installing the CMakeLists.txt file --- zonebg/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zonebg/CMakeLists.txt b/zonebg/CMakeLists.txt index e2904502d..b250a44b0 100644 --- a/zonebg/CMakeLists.txt +++ b/zonebg/CMakeLists.txt @@ -2,7 +2,7 @@ # # Installs default "zone background" files -FILE(GLOB zonebg "${CMAKE_CURRENT_SOURCE_DIR}/*.*") +FILE(GLOB zonebg "${CMAKE_CURRENT_SOURCE_DIR}/*.png" "${CMAKE_CURRENT_SOURCE_DIR}/*.jpg") if(UNIX) if(APPLE) From fef005d0422031b35578182ada78a8939dfe6620 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Sun, 22 Jun 2014 23:29:42 +0200 Subject: [PATCH 12/66] OSX: Handle sounds for first time installations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the sounds path is unset in the settings and a “sounds” directory doesn’t exists in the user’s data directory, install the sounds files and set the settings value accordingly --- cockatrice/src/main.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cockatrice/src/main.cpp b/cockatrice/src/main.cpp index f3e2ad16f..bce3075cf 100644 --- a/cockatrice/src/main.cpp +++ b/cockatrice/src/main.cpp @@ -146,6 +146,20 @@ int main(int argc, char *argv[]) settingsCache->setPlayerBgPath(destDir + "/fabric_gray.png"); } } + + if(settingsCache->getSoundPath().isEmpty()) + { + QString srcDir = QLibraryInfo::location(QLibraryInfo::DataPath); + QString destDir = dataDir + "/sounds"; + QDir tmpDir(destDir); + if(!tmpDir.exists()) + { + // try to install the default sounds for the current user and set the settigs value + settingsCache->copyPath(srcDir + "/sounds", destDir); + + settingsCache->setSoundPath(destDir); + } + } #endif if (!db->getLoadSuccess() || !QDir(settingsCache->getDeckPath()).exists() || settingsCache->getDeckPath().isEmpty() || settingsCache->getPicsPath().isEmpty() || !QDir(settingsCache->getPicsPath()).exists()) { From 377433b5cc0b465ba2a50e0062fa2284b8f48052 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Thu, 12 Jun 2014 23:47:01 +0200 Subject: [PATCH 13/66] CPack generator; removed old prepareMacRelease.sh By now tested on OSX only --- CMakeLists.txt | 42 +++++++++++++++++++++++++++ prepareMacRelease.sh | 67 -------------------------------------------- 2 files changed, 42 insertions(+), 67 deletions(-) delete mode 100644 prepareMacRelease.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index c8756e903..2791a0aee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -79,11 +79,51 @@ set(CMAKE_AUTOMOC TRUE) # Find other needed libraries FIND_PACKAGE(Protobuf REQUIRED) +# Package builder +set(CPACK_PACKAGE_CONTACT "Daenyth+github@gmail.com") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${PROJECT_NAME}) +set(CPACK_PACKAGE_VENDOR "Cockatrice Development Team") +set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md") +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING") +set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}") +set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}") +set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}") + +if(UNIX) + if(APPLE) + set(CPACK_GENERATOR DragNDrop ${CPACK_GENERATOR}) + set(CPACK_GENERATOR "DragNDrop") + set(CPACK_DMG_FORMAT "UDBZ") + set(CPACK_DMG_VOLUME_NAME "${PROJECT_NAME}") + set(CPACK_SYSTEM_NAME "OSX") + set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}") + set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/cockatrice/resources/appicon.icns") + else() + # linux + set(CPACK_GENERATOR DEB ${CPACK_GENERATOR}) + set(CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}/${PROJECT_VERSION}") + set(CPACK_STRIP_FILES "bin/${PROJECT_NAME}") + set(CPACK_SOURCE_STRIP_FILES "") + endif() +elseif(WIN32) + set(CPACK_GENERATOR NSIS ${CPACK_GENERATOR}) + set(CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}\\\\${PROJECT_VERSION}") + set(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\${PROJECT_NAME}.exe") + set(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} ${PROJECT_NAME}") + set(CPACK_NSIS_HELP_LINK "https://github.com/Daenyth/Cockatrice") + set(CPACK_NSIS_URL_INFO_ABOUT "https://github.com/Daenyth/Cockatrice") + set(CPACK_NSIS_CONTACT "Daenyth+github@gmail.com") + set(CPACK_NSIS_MODIFY_PATH ON) +endif() + +include(CPack) + # Compile servatrice (default off) option(WITH_SERVER "build servatrice" OFF) add_subdirectory(common) if(WITH_SERVER) add_subdirectory(servatrice) + SET(CPACK_INSTALL_CMAKE_PROJECTS "servatrice;servatrice;ALL;/" ${CPACK_INSTALL_CMAKE_PROJECTS}) endif() # Compile cockatrice (default on) @@ -92,12 +132,14 @@ if(WITH_CLIENT) add_subdirectory(cockatrice) add_subdirectory(sounds) add_subdirectory(zonebg) + SET(CPACK_INSTALL_CMAKE_PROJECTS "cockatrice;cockatrice;ALL;/" ${CPACK_INSTALL_CMAKE_PROJECTS}) endif() # Compile oracle (default on) option(WITH_ORACLE "build oracle" ON) if(WITH_ORACLE) add_subdirectory(oracle) + SET(CPACK_INSTALL_CMAKE_PROJECTS "release/oracle.app;oracle;ALL;/" ${CPACK_INSTALL_CMAKE_PROJECTS}) endif() # Compile testclient (default off) diff --git a/prepareMacRelease.sh b/prepareMacRelease.sh deleted file mode 100644 index d1f58e26d..000000000 --- a/prepareMacRelease.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/sh - -FRAMEWORKS="Core Gui Multimedia Network Svg Xml" -DATE=`date '+%Y%m%d'` -#QTDIR="/Users/brukie/QtSDK/Desktop/Qt/474/gcc" -QTLIB="/Users/brukie/qt_leopard/lib" -QTPLUGINS="/Users/brukie/qt_leopard/plugins" -PROTOBUF="/Users/brukie/protobuf_leopard" -DIR=cockatrice_mac_$DATE -if [ -d $DIR ]; then echo "delete old dir first"; exit 1; fi - -mkdir $DIR - -cp -R build/cockatrice/cockatrice.app $DIR -cp -R build/oracle/oracle.app $DIR -mkdir $DIR/Frameworks -cp -R sounds zonebg $DIR -mkdir $DIR/translations -cp build/cockatrice/*.qm $DIR/translations -cp -R $QTPLUGINS $DIR/PlugIns -for f in $FRAMEWORKS; do - cp -R $QTLIB/Qt"$f".framework $DIR/Frameworks -done -find $DIR/Frameworks -name '*debug*'|xargs -n 1 rm -f -find $DIR/Frameworks -name 'Headers'|xargs -n 1 rm -rf -find $DIR/PlugIns -name '*debug*'|xargs -n 1 rm -f -cp $PROTOBUF/lib/libprotobuf.7.dylib $DIR/Frameworks - -cd $DIR -for f in $FRAMEWORKS; do - echo "Framework $f" - echo "step 1" - install_name_tool -id @executable_path/../../../Frameworks/Qt"$f".framework/Versions/4/Qt"$f" Frameworks/Qt"$f".framework/Versions/4/Qt"$f" - for g in $FRAMEWORKS; do - install_name_tool -change $QTLIB/Qt"$f".framework/Versions/4/Qt"$f" @executable_path/../../../Frameworks/Qt"$f".framework/Versions/4/Qt"$f" Frameworks/Qt"$g".framework/Versions/4/Qt"$g" - done - echo "step 2" - for g in cockatrice oracle; do - install_name_tool -change $QTLIB/Qt"$f".framework/Versions/4/Qt"$f" @executable_path/../../../Frameworks/Qt"$f".framework/Versions/4/Qt"$f" "$g".app/Contents/MacOS/$g - done - echo "step 3" - for g in `find . -name '*.dylib'`; do - install_name_tool -change $QTLIB/Qt"$f".framework/Versions/4/Qt"$f" @executable_path/../../../Frameworks/Qt"$f".framework/Versions/4/Qt"$f" "$g" - done -done - -install_name_tool -id @executable_path/../../../libprotobuf.7.dylib Frameworks/libprotobuf.7.dylib -install_name_tool -change $PROTOBUF/lib/libprotobuf.7.dylib @executable_path/../../../Frameworks/libprotobuf.7.dylib cockatrice.app/Contents/MacOS/cockatrice - -cd .. - -VOL=cockatrice_mac_${DATE} -DMG="tmp-$VOL.dmg" - -SIZE=`du -sk $DIR | cut -f1` -SIZE=$((${SIZE}/1000+10)) -hdiutil create "$DMG" -megabytes ${SIZE} -ov -type UDIF -fs HFS+ -volname "$VOL" - -hdid "$DMG" -cp -R "${DIR}" "/Volumes/$VOL" -hdiutil detach "/Volumes/$VOL" -#osascript -e "tell application "Finder" to eject disk "$VOL"" && - -# convert to compressed image, delete temp image -rm -f "${VOL}.dmg" -hdiutil convert "$DMG" -format UDZO -o "${VOL}.dmg" -rm -f "$DMG" From 99f3519da579b07005141635252238a62e068888 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Sat, 21 Jun 2014 16:59:31 +0200 Subject: [PATCH 14/66] Workaround permission problem in ixup_bundle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without this change, make install and make package would require “sudo” under osx --- cockatrice/CMakeLists.txt | 1 + oracle/CMakeLists.txt | 1 + servatrice/CMakeLists.txt | 1 + 3 files changed, 3 insertions(+) diff --git a/cockatrice/CMakeLists.txt b/cockatrice/CMakeLists.txt index 499836dd1..c0cb47685 100644 --- a/cockatrice/CMakeLists.txt +++ b/cockatrice/CMakeLists.txt @@ -206,6 +206,7 @@ Plugins = Plugins\") install(CODE " file(GLOB_RECURSE QTPLUGINS \"${plugin_dest_dir}/*.dylib\") + set(BU_CHMOD_BUNDLE_ITEMS ON) include(BundleUtilities) fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/cockatrice.app\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR}\") " COMPONENT Runtime) diff --git a/oracle/CMakeLists.txt b/oracle/CMakeLists.txt index 2eada38cf..d9b5df755 100644 --- a/oracle/CMakeLists.txt +++ b/oracle/CMakeLists.txt @@ -71,6 +71,7 @@ Plugins = Plugins\") install(CODE " file(GLOB_RECURSE QTPLUGINS \"${plugin_dest_dir}/*.dylib\") + set(BU_CHMOD_BUNDLE_ITEMS ON) include(BundleUtilities) fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/oracle.app\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR}\") " COMPONENT Runtime) diff --git a/servatrice/CMakeLists.txt b/servatrice/CMakeLists.txt index 799cecbd8..19575ca1e 100644 --- a/servatrice/CMakeLists.txt +++ b/servatrice/CMakeLists.txt @@ -78,6 +78,7 @@ Plugins = Plugins\") install(CODE " file(GLOB_RECURSE QTPLUGINS \"${plugin_dest_dir}/*.dylib\") + set(BU_CHMOD_BUNDLE_ITEMS ON) include(BundleUtilities) fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/servatrice.app\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR}\") " COMPONENT Runtime) From 41c7ce8022f5714628095524b68d660fcfdfc262 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Sat, 21 Jun 2014 17:28:27 +0200 Subject: [PATCH 15/66] Fix qt.conf file creation for "make package" --- cockatrice/CMakeLists.txt | 4 +++- oracle/CMakeLists.txt | 4 +++- servatrice/CMakeLists.txt | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cockatrice/CMakeLists.txt b/cockatrice/CMakeLists.txt index c0cb47685..535c5ac3c 100644 --- a/cockatrice/CMakeLists.txt +++ b/cockatrice/CMakeLists.txt @@ -183,8 +183,10 @@ add_custom_command( ) if(APPLE) + # this needs to be relative set(plugin_dest_dir ./cockatrice.app/Contents/Plugins) - set(qtconf_dest_dir ./cockatrice.app/Contents/Resources) + # instead, this needs an absolute path (for make package to work) + set(qtconf_dest_dir ${CMAKE_INSTALL_PREFIX}/cockatrice.app/Contents/Resources) # note: no codecs in qt5 # note: phonon_backend => mediaservice diff --git a/oracle/CMakeLists.txt b/oracle/CMakeLists.txt index d9b5df755..46502cc4a 100644 --- a/oracle/CMakeLists.txt +++ b/oracle/CMakeLists.txt @@ -48,8 +48,10 @@ IF (NOT WIN32 AND NOT APPLE) ENDIF (NOT WIN32 AND NOT APPLE) if(APPLE) + # this needs to be relative set(plugin_dest_dir ./oracle.app/Contents/Plugins) - set(qtconf_dest_dir ./oracle.app/Contents/Resources) + # instead, this needs an absolute path (for make) + set(qtconf_dest_dir ${CMAKE_INSTALL_PREFIX}/oracle.app/Contents/Resources) # note: no codecs in qt5 # note: phonon_backend => mediaservice diff --git a/servatrice/CMakeLists.txt b/servatrice/CMakeLists.txt index 19575ca1e..9a66fe3b1 100644 --- a/servatrice/CMakeLists.txt +++ b/servatrice/CMakeLists.txt @@ -55,8 +55,10 @@ elseif(WIN32) endif() if(APPLE) + # this needs to be relative set(plugin_dest_dir ./servatrice.app/Contents/Plugins) - set(qtconf_dest_dir ./servatrice.app/Contents/Resources) + # instead, this needs an absolute path (for make) + set(qtconf_dest_dir ${CMAKE_INSTALL_PREFIX}/servatrice.app/Contents/Resources) # note: no codecs in qt5 # note: phonon_backend => mediaservice From 1b2c839ff03d9b248575361f5ab95218bb4b0f32 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Sat, 21 Jun 2014 17:28:58 +0200 Subject: [PATCH 16/66] osx: install sounds and zonebg as cockatrice's resources --- sounds/CMakeLists.txt | 2 +- zonebg/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sounds/CMakeLists.txt b/sounds/CMakeLists.txt index e38c9090b..cd9f6c331 100644 --- a/sounds/CMakeLists.txt +++ b/sounds/CMakeLists.txt @@ -6,7 +6,7 @@ FILE(GLOB sounds "${CMAKE_CURRENT_SOURCE_DIR}/*.raw") if(UNIX) if(APPLE) - INSTALL(FILES ${sounds} DESTINATION sounds/) + INSTALL(FILES ${sounds} DESTINATION cockatrice.app/Contents/Resources/sounds/) else() # Assume linux INSTALL(FILES ${sounds} DESTINATION share/cockatrice/sounds/) diff --git a/zonebg/CMakeLists.txt b/zonebg/CMakeLists.txt index 961c4e12a..e2904502d 100644 --- a/zonebg/CMakeLists.txt +++ b/zonebg/CMakeLists.txt @@ -6,7 +6,7 @@ FILE(GLOB zonebg "${CMAKE_CURRENT_SOURCE_DIR}/*.*") if(UNIX) if(APPLE) - INSTALL(FILES ${zonebg} DESTINATION zonebg/) + INSTALL(FILES ${zonebg} DESTINATION cockatrice.app/Contents/Resources/zonebg/) else() # Assume linux INSTALL(FILES ${zonebg} DESTINATION share/cockatrice/zonebg/) From 6d1de0c61797b10a26314ececee44e4a36e35d35 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Sat, 21 Jun 2014 18:15:27 +0200 Subject: [PATCH 17/66] Partially revert previous commits; ensure the bundle is fixed up correctly --- cockatrice/CMakeLists.txt | 4 +--- oracle/CMakeLists.txt | 4 +--- servatrice/CMakeLists.txt | 4 +--- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/cockatrice/CMakeLists.txt b/cockatrice/CMakeLists.txt index 535c5ac3c..4303f567a 100644 --- a/cockatrice/CMakeLists.txt +++ b/cockatrice/CMakeLists.txt @@ -183,9 +183,7 @@ add_custom_command( ) if(APPLE) - # this needs to be relative - set(plugin_dest_dir ./cockatrice.app/Contents/Plugins) - # instead, this needs an absolute path (for make package to work) + set(plugin_dest_dir ${CMAKE_INSTALL_PREFIX}/cockatrice.app/Contents/Plugins) set(qtconf_dest_dir ${CMAKE_INSTALL_PREFIX}/cockatrice.app/Contents/Resources) # note: no codecs in qt5 diff --git a/oracle/CMakeLists.txt b/oracle/CMakeLists.txt index 46502cc4a..e42b154be 100644 --- a/oracle/CMakeLists.txt +++ b/oracle/CMakeLists.txt @@ -48,9 +48,7 @@ IF (NOT WIN32 AND NOT APPLE) ENDIF (NOT WIN32 AND NOT APPLE) if(APPLE) - # this needs to be relative - set(plugin_dest_dir ./oracle.app/Contents/Plugins) - # instead, this needs an absolute path (for make) + set(plugin_dest_dir ${CMAKE_INSTALL_PREFIX}/oracle.app/Contents/Plugins) set(qtconf_dest_dir ${CMAKE_INSTALL_PREFIX}/oracle.app/Contents/Resources) # note: no codecs in qt5 diff --git a/servatrice/CMakeLists.txt b/servatrice/CMakeLists.txt index 9a66fe3b1..5b65c2f9d 100644 --- a/servatrice/CMakeLists.txt +++ b/servatrice/CMakeLists.txt @@ -55,9 +55,7 @@ elseif(WIN32) endif() if(APPLE) - # this needs to be relative - set(plugin_dest_dir ./servatrice.app/Contents/Plugins) - # instead, this needs an absolute path (for make) + set(plugin_dest_dir ${CMAKE_INSTALL_PREFIX}/servatrice.app/Contents/Plugins) set(qtconf_dest_dir ${CMAKE_INSTALL_PREFIX}/servatrice.app/Contents/Resources) # note: no codecs in qt5 From b44365b73c63f6029074b7e338502b769239f2a2 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Sat, 21 Jun 2014 19:04:42 +0200 Subject: [PATCH 18/66] This finally fixes both make install and make package --- cockatrice/CMakeLists.txt | 15 +++++++++------ oracle/CMakeLists.txt | 9 ++++++--- servatrice/CMakeLists.txt | 9 ++++++--- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/cockatrice/CMakeLists.txt b/cockatrice/CMakeLists.txt index 4303f567a..f60669269 100644 --- a/cockatrice/CMakeLists.txt +++ b/cockatrice/CMakeLists.txt @@ -183,8 +183,10 @@ add_custom_command( ) if(APPLE) - set(plugin_dest_dir ${CMAKE_INSTALL_PREFIX}/cockatrice.app/Contents/Plugins) - set(qtconf_dest_dir ${CMAKE_INSTALL_PREFIX}/cockatrice.app/Contents/Resources) + # this needs to be relative + set(plugin_dest_dir cockatrice.app/Contents/Plugins) + # instead, this needs an absolute path (for make package to work) + set(qtconf_dest_dir cockatrice.app/Contents/Resources) # note: no codecs in qt5 # note: phonon_backend => mediaservice @@ -199,13 +201,14 @@ if(APPLE) endif() install(CODE " - file(WRITE \"${qtconf_dest_dir}/qt.conf\" \"[Paths] -Plugins = Plugins\") - " COMPONENT Runtime) + file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"[Paths] +Plugins = Plugins +Translations = Resources/translations\") + " COMPONENT Runtime) install(CODE " file(GLOB_RECURSE QTPLUGINS - \"${plugin_dest_dir}/*.dylib\") + \"\${CMAKE_INSTALL_PREFIX}/${plugin_dest_dir}/*.dylib\") set(BU_CHMOD_BUNDLE_ITEMS ON) include(BundleUtilities) fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/cockatrice.app\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR}\") diff --git a/oracle/CMakeLists.txt b/oracle/CMakeLists.txt index e42b154be..55b63050b 100644 --- a/oracle/CMakeLists.txt +++ b/oracle/CMakeLists.txt @@ -48,7 +48,9 @@ IF (NOT WIN32 AND NOT APPLE) ENDIF (NOT WIN32 AND NOT APPLE) if(APPLE) - set(plugin_dest_dir ${CMAKE_INSTALL_PREFIX}/oracle.app/Contents/Plugins) + # this needs to be relative + set(plugin_dest_dir oracle.app/Contents/Plugins) + # instead, this needs an absolute path (for make) set(qtconf_dest_dir ${CMAKE_INSTALL_PREFIX}/oracle.app/Contents/Resources) # note: no codecs in qt5 @@ -65,12 +67,13 @@ if(APPLE) install(CODE " file(WRITE \"${qtconf_dest_dir}/qt.conf\" \"[Paths] -Plugins = Plugins\") +Plugins = Plugins +Translations = Resources/translations\") " COMPONENT Runtime) install(CODE " file(GLOB_RECURSE QTPLUGINS - \"${plugin_dest_dir}/*.dylib\") + \"\${CMAKE_INSTALL_PREFIX}/${plugin_dest_dir}/*.dylib\") set(BU_CHMOD_BUNDLE_ITEMS ON) include(BundleUtilities) fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/oracle.app\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR}\") diff --git a/servatrice/CMakeLists.txt b/servatrice/CMakeLists.txt index 5b65c2f9d..8c44c05ba 100644 --- a/servatrice/CMakeLists.txt +++ b/servatrice/CMakeLists.txt @@ -55,7 +55,9 @@ elseif(WIN32) endif() if(APPLE) - set(plugin_dest_dir ${CMAKE_INSTALL_PREFIX}/servatrice.app/Contents/Plugins) + # this needs to be relative + set(plugin_dest_dir servatrice.app/Contents/Plugins) + # instead, this needs an absolute path (for make) set(qtconf_dest_dir ${CMAKE_INSTALL_PREFIX}/servatrice.app/Contents/Resources) # note: no codecs in qt5 @@ -72,12 +74,13 @@ if(APPLE) install(CODE " file(WRITE \"${qtconf_dest_dir}/qt.conf\" \"[Paths] -Plugins = Plugins\") +Plugins = Plugins +Translations = Resources/translations\") " COMPONENT Runtime) install(CODE " file(GLOB_RECURSE QTPLUGINS - \"${plugin_dest_dir}/*.dylib\") + \"\${CMAKE_INSTALL_PREFIX}/${plugin_dest_dir}/*.dylib\") set(BU_CHMOD_BUNDLE_ITEMS ON) include(BundleUtilities) fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/servatrice.app\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR}\") From 2a5f6181aa0996bd3b143f15bdf6f0d83433d7bc Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Sat, 21 Jun 2014 19:09:41 +0200 Subject: [PATCH 19/66] Osx: removed plugins path detection and fixed translation path detection --- cockatrice/src/main.cpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/cockatrice/src/main.cpp b/cockatrice/src/main.cpp index d0664bf94..0ac4042a1 100644 --- a/cockatrice/src/main.cpp +++ b/cockatrice/src/main.cpp @@ -88,15 +88,6 @@ int main(int argc, char *argv[]) if (app.arguments().contains("--debug-output")) qInstallMsgHandler(myMessageOutput); -#ifdef Q_OS_MAC - QDir baseDir(app.applicationDirPath()); - baseDir.cdUp(); - baseDir.cdUp(); - baseDir.cdUp(); - QDir pluginsDir = baseDir; - pluginsDir.cd("PlugIns"); - app.addLibraryPath(pluginsDir.absolutePath()); -#endif #ifdef Q_OS_WIN app.addLibraryPath(app.applicationDirPath() + "/plugins"); #endif @@ -108,11 +99,12 @@ int main(int argc, char *argv[]) if (translationPath.isEmpty()) { #ifdef Q_OS_MAC - QDir translationsDir = baseDir; + QDir translationsDir = app.applicationDirPath(); + translationsDir.cd(".."); + translationsDir.cd("Resources"); translationsDir.cd("translations"); translationPath = translationsDir.absolutePath(); -#endif -#ifdef Q_OS_WIN +#elif Q_OS_WIN translationPath = app.applicationDirPath() + "/translations"; #endif } From 2eebddea9a070234091284ab33516c22eda02f62 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Sun, 22 Jun 2014 21:11:39 +0200 Subject: [PATCH 20/66] Port "make package" fix to oracle and servatrice --- cockatrice/CMakeLists.txt | 3 +-- oracle/CMakeLists.txt | 9 ++++----- servatrice/CMakeLists.txt | 7 +++---- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/cockatrice/CMakeLists.txt b/cockatrice/CMakeLists.txt index f60669269..170721b4e 100644 --- a/cockatrice/CMakeLists.txt +++ b/cockatrice/CMakeLists.txt @@ -183,9 +183,8 @@ add_custom_command( ) if(APPLE) - # this needs to be relative + # these needs to be relative to CMAKE_INSTALL_PREFIX set(plugin_dest_dir cockatrice.app/Contents/Plugins) - # instead, this needs an absolute path (for make package to work) set(qtconf_dest_dir cockatrice.app/Contents/Resources) # note: no codecs in qt5 diff --git a/oracle/CMakeLists.txt b/oracle/CMakeLists.txt index 55b63050b..05bcd494b 100644 --- a/oracle/CMakeLists.txt +++ b/oracle/CMakeLists.txt @@ -48,10 +48,9 @@ IF (NOT WIN32 AND NOT APPLE) ENDIF (NOT WIN32 AND NOT APPLE) if(APPLE) - # this needs to be relative + # these needs to be relative to CMAKE_INSTALL_PREFIX set(plugin_dest_dir oracle.app/Contents/Plugins) - # instead, this needs an absolute path (for make) - set(qtconf_dest_dir ${CMAKE_INSTALL_PREFIX}/oracle.app/Contents/Resources) + set(qtconf_dest_dir oracle.app/Contents/Resources) # note: no codecs in qt5 # note: phonon_backend => mediaservice @@ -66,10 +65,10 @@ if(APPLE) endif() install(CODE " - file(WRITE \"${qtconf_dest_dir}/qt.conf\" \"[Paths] + file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"[Paths] Plugins = Plugins Translations = Resources/translations\") - " COMPONENT Runtime) + " COMPONENT Runtime) install(CODE " file(GLOB_RECURSE QTPLUGINS diff --git a/servatrice/CMakeLists.txt b/servatrice/CMakeLists.txt index 8c44c05ba..c1aefed1c 100644 --- a/servatrice/CMakeLists.txt +++ b/servatrice/CMakeLists.txt @@ -55,10 +55,9 @@ elseif(WIN32) endif() if(APPLE) - # this needs to be relative + # these needs to be relative to CMAKE_INSTALL_PREFIX set(plugin_dest_dir servatrice.app/Contents/Plugins) - # instead, this needs an absolute path (for make) - set(qtconf_dest_dir ${CMAKE_INSTALL_PREFIX}/servatrice.app/Contents/Resources) + set(qtconf_dest_dir servatrice.app/Contents/Resources) # note: no codecs in qt5 # note: phonon_backend => mediaservice @@ -73,7 +72,7 @@ if(APPLE) endif() install(CODE " - file(WRITE \"${qtconf_dest_dir}/qt.conf\" \"[Paths] + file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"[Paths] Plugins = Plugins Translations = Resources/translations\") " COMPONENT Runtime) From 55c4c464e4a27d1f216415f2608dd7ba4b28ebfb Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Sun, 22 Jun 2014 21:19:10 +0200 Subject: [PATCH 21/66] OSX: get translation path from qt.conf instead of hardcoding it --- cockatrice/src/main.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cockatrice/src/main.cpp b/cockatrice/src/main.cpp index 0ac4042a1..e6d16c34c 100644 --- a/cockatrice/src/main.cpp +++ b/cockatrice/src/main.cpp @@ -99,11 +99,7 @@ int main(int argc, char *argv[]) if (translationPath.isEmpty()) { #ifdef Q_OS_MAC - QDir translationsDir = app.applicationDirPath(); - translationsDir.cd(".."); - translationsDir.cd("Resources"); - translationsDir.cd("translations"); - translationPath = translationsDir.absolutePath(); + translationPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath); #elif Q_OS_WIN translationPath = app.applicationDirPath() + "/translations"; #endif From 0b4701c42fe21cbec6366190985e619297516954 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Sun, 22 Jun 2014 23:21:29 +0200 Subject: [PATCH 22/66] OSX: Handle zonebg for first time installations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If none of the gameboard images is set and and the user’s data directory doesn’t contain a “zonebg” directory, create the directory, copy contents from cockatrice’s app bundle and sets the config accordingly. --- cockatrice/CMakeLists.txt | 3 ++- cockatrice/src/main.cpp | 23 +++++++++++++++++++++++ cockatrice/src/settingscache.cpp | 26 ++++++++++++++++++++++++++ cockatrice/src/settingscache.h | 1 + 4 files changed, 52 insertions(+), 1 deletion(-) diff --git a/cockatrice/CMakeLists.txt b/cockatrice/CMakeLists.txt index 170721b4e..8cfca2577 100644 --- a/cockatrice/CMakeLists.txt +++ b/cockatrice/CMakeLists.txt @@ -202,7 +202,8 @@ if(APPLE) install(CODE " file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"[Paths] Plugins = Plugins -Translations = Resources/translations\") +Translations = Resources/translations +Data = Resources\") " COMPONENT Runtime) install(CODE " diff --git a/cockatrice/src/main.cpp b/cockatrice/src/main.cpp index e6d16c34c..130fea528 100644 --- a/cockatrice/src/main.cpp +++ b/cockatrice/src/main.cpp @@ -133,6 +133,29 @@ int main(int argc, char *argv[]) QDir().mkpath(dataDir + "/pics"); settingsCache->setPicsPath(dataDir + "/pics"); } + +#ifdef Q_OS_MAC + if(settingsCache->getHandBgPath().isEmpty() && + settingsCache->getStackBgPath().isEmpty() && + settingsCache->getTableBgPath().isEmpty() && + settingsCache->getPlayerBgPath().isEmpty()) + { + QString srcDir = QLibraryInfo::location(QLibraryInfo::DataPath); + QString destDir = dataDir + "/zonebg"; + QDir tmpDir(destDir); + if(!tmpDir.exists()) + { + // try to install the default images for the current user and set the settigs value + settingsCache->copyPath(srcDir + "/zonebg", destDir); + + settingsCache->setHandBgPath(destDir + "/fabric_green.png"); + settingsCache->setStackBgPath(destDir + "/fabric_red.png"); + settingsCache->setTableBgPath(destDir + "/fabric_blue.png"); + settingsCache->setPlayerBgPath(destDir + "/fabric_gray.png"); + } + } +#endif + if (!settingsValid() || db->getLoadStatus() != Ok) { qDebug("main(): invalid settings or load status"); DlgSettings dlgSettings; diff --git a/cockatrice/src/settingscache.cpp b/cockatrice/src/settingscache.cpp index ac5c130fb..ee4fc6356 100644 --- a/cockatrice/src/settingscache.cpp +++ b/cockatrice/src/settingscache.cpp @@ -1,5 +1,6 @@ #include "settingscache.h" #include +#include SettingsCache::SettingsCache() { @@ -256,3 +257,28 @@ void SettingsCache::setMainWindowGeometry(const QByteArray &_mainWindowGeometry) mainWindowGeometry = _mainWindowGeometry; settings->setValue("interface/main_window_geometry", mainWindowGeometry); } + +void SettingsCache::copyPath(const QString &src, const QString &dst) +{ + // test source && return if inexistent + QDir dir(src); + if (! dir.exists()) + return; + // test destination && create if inexistent + QDir tmpDir(dst); + if (!tmpDir.exists()) + { + tmpDir.setPath(QDir::rootPath()); + tmpDir.mkdir(dst); + } + + foreach (QString d, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) { + QString dst_path = dst + QDir::separator() + d; + dir.mkpath(dst_path); + copyPath(src+ QDir::separator() + d, dst_path); + } + + foreach (QString f, dir.entryList(QDir::Files)) { + QFile::copy(src + QDir::separator() + f, dst + QDir::separator() + f); + } +} diff --git a/cockatrice/src/settingscache.h b/cockatrice/src/settingscache.h index 5156772dd..5ae11c9e7 100644 --- a/cockatrice/src/settingscache.h +++ b/cockatrice/src/settingscache.h @@ -89,6 +89,7 @@ public: bool getIgnoreUnregisteredUsers() const { return ignoreUnregisteredUsers; } QString getPicUrl() const { return picUrl; } QString getPicUrlHq() const { return picUrlHq; } + void copyPath(const QString &src, const QString &dst); public slots: void setMainWindowGeometry(const QByteArray &_mainWindowGeometry); void setLang(const QString &_lang); From d06d64537e38365a4ee1f1786daa261b3e26f517 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Sun, 22 Jun 2014 23:24:44 +0200 Subject: [PATCH 23/66] Zonebg: avoid installing the CMakeLists.txt file --- zonebg/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zonebg/CMakeLists.txt b/zonebg/CMakeLists.txt index e2904502d..b250a44b0 100644 --- a/zonebg/CMakeLists.txt +++ b/zonebg/CMakeLists.txt @@ -2,7 +2,7 @@ # # Installs default "zone background" files -FILE(GLOB zonebg "${CMAKE_CURRENT_SOURCE_DIR}/*.*") +FILE(GLOB zonebg "${CMAKE_CURRENT_SOURCE_DIR}/*.png" "${CMAKE_CURRENT_SOURCE_DIR}/*.jpg") if(UNIX) if(APPLE) From 66c87a1ee62add27f4a967ed3150bfe5068d012f Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Sun, 22 Jun 2014 23:29:42 +0200 Subject: [PATCH 24/66] OSX: Handle sounds for first time installations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the sounds path is unset in the settings and a “sounds” directory doesn’t exists in the user’s data directory, install the sounds files and set the settings value accordingly --- cockatrice/src/main.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cockatrice/src/main.cpp b/cockatrice/src/main.cpp index 130fea528..370c1b1a7 100644 --- a/cockatrice/src/main.cpp +++ b/cockatrice/src/main.cpp @@ -154,6 +154,20 @@ int main(int argc, char *argv[]) settingsCache->setPlayerBgPath(destDir + "/fabric_gray.png"); } } + + if(settingsCache->getSoundPath().isEmpty()) + { + QString srcDir = QLibraryInfo::location(QLibraryInfo::DataPath); + QString destDir = dataDir + "/sounds"; + QDir tmpDir(destDir); + if(!tmpDir.exists()) + { + // try to install the default sounds for the current user and set the settigs value + settingsCache->copyPath(srcDir + "/sounds", destDir); + + settingsCache->setSoundPath(destDir); + } + } #endif if (!settingsValid() || db->getLoadStatus() != Ok) { From c54f7b9245bf86c4961517dea6b0c75dafa77ede Mon Sep 17 00:00:00 2001 From: Daenyth Date: Sun, 22 Jun 2014 20:14:22 -0400 Subject: [PATCH 25/66] Log on failed path copy --- cockatrice/src/settingscache.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cockatrice/src/settingscache.cpp b/cockatrice/src/settingscache.cpp index ee4fc6356..ccd65845a 100644 --- a/cockatrice/src/settingscache.cpp +++ b/cockatrice/src/settingscache.cpp @@ -269,7 +269,10 @@ void SettingsCache::copyPath(const QString &src, const QString &dst) if (!tmpDir.exists()) { tmpDir.setPath(QDir::rootPath()); - tmpDir.mkdir(dst); + if (!tmpDir.mkdir(dst) && !tmpDir.exists()) { + // TODO: this is probably not good. + qDebug() << "copyPath(): Failed to create dir: " << dst; + } } foreach (QString d, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) { From 46ceeadbbd142f5e8c1373dce38a071a4714731c Mon Sep 17 00:00:00 2001 From: woogerboy21 Date: Mon, 23 Jun 2014 03:41:46 -0400 Subject: [PATCH 26/66] updated code structure cleaned code structure up for clarity --- servatrice/src/server_logger.cpp | 48 +++++++++++++++++++------------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/servatrice/src/server_logger.cpp b/servatrice/src/server_logger.cpp index bfd979fd0..076480356 100644 --- a/servatrice/src/server_logger.cpp +++ b/servatrice/src/server_logger.cpp @@ -5,11 +5,13 @@ #include #include #include +#include #ifdef Q_OS_UNIX # include # include # include #endif +using namespace std; ServerLogger::ServerLogger(bool _logToConsole, QObject *parent) : QObject(parent), logToConsole(_logToConsole), flushRunning(false) @@ -51,37 +53,45 @@ void ServerLogger::logMessage(QString message, void *caller) //filter out all log entries based on loglevel value in configuration file QSettings *settings = new QSettings("servatrice.ini", QSettings::IniFormat); - int found = 0; int capture = 0; int loglevel = 0; + int found = 0; int capture = 0; int loglevel = 0; list lst_str; loglevel = settings->value("server/loglevel").toInt(); + + switch (loglevel) { case 1: + capture = 0; break; case 2: - // filter message log data - found = message.indexOf("Adding room: ID=", Qt::CaseInsensitive); if (found != -1){ capture = 1; } - found = message.indexOf("Starting status update clock", Qt::CaseInsensitive); if (found != -1){ capture = 1; } - found = message.indexOf("Starting server on port", Qt::CaseInsensitive); if (found != -1){ capture = 1; } - found = message.indexOf("Server listening.", Qt::CaseInsensitive); if (found != -1){ capture = 1; } - found = message.indexOf("Server::loginUser:", Qt::CaseInsensitive); if (found != -1){ capture = 1; } - found = message.indexOf("Server::removeClient:", Qt::CaseInsensitive); if (found != -1){ capture = 1; } - found = message.indexOf("Command_Login.ext", Qt::CaseInsensitive); if (found != -1){ capture = 1; } - found = message.indexOf("Command_RoomSay.ext", Qt::CaseInsensitive); if (found != -1){ capture = 1; } - found = message.indexOf("Command_Message.ext", Qt::CaseInsensitive); if (found != -1){ capture = 1; } - found = message.indexOf("Command_GameSay.ext", Qt::CaseInsensitive); if (found != -1){ capture = 1; } - if (capture != 0){ - bufferMutex.lock(); - buffer.append(QDateTime::currentDateTime().toString() + " " + callerString + message); - bufferMutex.unlock(); + lst_str.push_back("Adding room: ID="); + lst_str.push_back("Starting status update clock"); + lst_str.push_back("Starting server on port"); + lst_str.push_back("Server listening."); + lst_str.push_back("Server::loginUser:"); + lst_str.push_back("Server::removeClient:"); + lst_str.push_back("Command_Login.ext"); + lst_str.push_back("Command_RoomSay.ext"); + lst_str.push_back("Command_Message.ext"); + lst_str.push_back("Command_GameSay.ext"); + for (list::iterator i = lst_str.begin(); i != lst_str.end(); i++) + { + if(message.indexOf((*i).c_str(), Qt::CaseInsensitive) != -1) { + capture = 1; + break; + } } break; default: - bufferMutex.lock(); - buffer.append(QDateTime::currentDateTime().toString() + " " + callerString + message); - bufferMutex.unlock(); + capture = 1; + } + + if (capture != 0){ + bufferMutex.lock(); + buffer.append(QDateTime::currentDateTime().toString() + " " + callerString + message); + bufferMutex.unlock(); } emit sigFlushBuffer(); } From ec00bdebed8e7ef839f147dcce2ffc75202b6535 Mon Sep 17 00:00:00 2001 From: woogerboy21 Date: Mon, 23 Jun 2014 09:18:49 -0400 Subject: [PATCH 27/66] verbose incrementation removed un-used variables changed switch case to increase verbose level as loglevel increases captured unset loglevel to default to highest verbose log level --- servatrice/src/server_logger.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/servatrice/src/server_logger.cpp b/servatrice/src/server_logger.cpp index 076480356..a5c33bc8b 100644 --- a/servatrice/src/server_logger.cpp +++ b/servatrice/src/server_logger.cpp @@ -53,9 +53,10 @@ void ServerLogger::logMessage(QString message, void *caller) //filter out all log entries based on loglevel value in configuration file QSettings *settings = new QSettings("servatrice.ini", QSettings::IniFormat); - int found = 0; int capture = 0; int loglevel = 0; list lst_str; - loglevel = settings->value("server/loglevel").toInt(); - + int capture = 0; list lst_str; + int loglevel = settings->value("server/loglevel").toInt(); + if (!loglevel) + loglevel = 999; switch (loglevel) { From f7635f9e4936ac96e715a2ef447a6a0ce087e71b Mon Sep 17 00:00:00 2001 From: Daenyth Date: Mon, 23 Jun 2014 21:12:25 -0400 Subject: [PATCH 28/66] Don't recursive remove program files/cockatrice. This should prevent deleting old deck files --- nsis/cockatrice.nsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nsis/cockatrice.nsi b/nsis/cockatrice.nsi index 33cc496b2..2cce2f5e3 100644 --- a/nsis/cockatrice.nsi +++ b/nsis/cockatrice.nsi @@ -115,7 +115,7 @@ SetShellVarContext all Delete "$INSTDIR\QtMultimedia4.dll" RMDir "$INSTDIR" - RMDir /r "$SMPROGRAMS\Cockatrice" + RMDir "$SMPROGRAMS\Cockatrice" DeleteRegKey HKCU "Software\Cockatrice" DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" From f1e6aebabae4669652b6c5f03b7305b1be2c6306 Mon Sep 17 00:00:00 2001 From: Daenyth Date: Mon, 23 Jun 2014 21:21:08 -0400 Subject: [PATCH 29/66] Set cockatrice path settings to use appdata instead of instdir Putting user stuff in program files is bad --- nsis/cockatrice.nsi | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/nsis/cockatrice.nsi b/nsis/cockatrice.nsi index 2cce2f5e3..ede4c05da 100644 --- a/nsis/cockatrice.nsi +++ b/nsis/cockatrice.nsi @@ -1,7 +1,7 @@ !include "MUI2.nsh" !include "FileFunc.nsh" -!define /date TIMESTAMP "%Y%m%d" +!define /date TIMESTAMP "%Y%m%d" !searchparse /file ../build/cockatrice/version_string.cpp '= "' VERSION '";' Name "Cockatrice" @@ -52,7 +52,7 @@ Section "Application" SecApplication SetOutPath "$INSTDIR\zonebg" File /r ..\zonebg\*.* - + SetOutPath "$INSTDIR\plugins" SetOutPath "$INSTDIR\plugins\codecs" File "${QTDIR}\plugins\codecs\qcncodecs4.dll" @@ -67,7 +67,7 @@ Section "Application" SecApplication SetOutPath "$INSTDIR\sounds" File /r ..\sounds\*.* - + SetOutPath "$INSTDIR\translations" File /r ..\build\cockatrice\*.qm @@ -83,10 +83,10 @@ Section "Application" SecApplication SectionEnd Section "Update configuration" SecUpdateConfig - WriteRegStr HKCU "Software\Cockatrice\Cockatrice\paths" "carddatabase" "$INSTDIR\cards.xml" - WriteRegStr HKCU "Software\Cockatrice\Cockatrice\paths" "decks" "$INSTDIR\decks" - WriteRegStr HKCU "Software\Cockatrice\Cockatrice\paths" "pics" "$INSTDIR\pics" - WriteRegStr HKCU "Software\Cockatrice\Cockatrice\sound" "path" "$INSTDIR\sounds" + WriteRegStr HKCU "Software\Cockatrice\Cockatrice\paths" "carddatabase" "$APPDATA\cards.xml" + WriteRegStr HKCU "Software\Cockatrice\Cockatrice\paths" "decks" "$APPDATA\decks" + WriteRegStr HKCU "Software\Cockatrice\Cockatrice\paths" "pics" "$APPDATA\pics" + WriteRegStr HKCU "Software\Cockatrice\Cockatrice\sound" "path" "$APPDATA\sounds" SectionEnd Section "Start menu item" SecStartMenu From fc599972f3449f3b4ac98ac93a3a44dd96be1680 Mon Sep 17 00:00:00 2001 From: Daenyth Date: Mon, 23 Jun 2014 21:25:09 -0400 Subject: [PATCH 30/66] Write to APPDATA/Cockatrice, not APPDATA --- nsis/cockatrice.nsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nsis/cockatrice.nsi b/nsis/cockatrice.nsi index ede4c05da..88e7bdab9 100644 --- a/nsis/cockatrice.nsi +++ b/nsis/cockatrice.nsi @@ -83,10 +83,10 @@ Section "Application" SecApplication SectionEnd Section "Update configuration" SecUpdateConfig - WriteRegStr HKCU "Software\Cockatrice\Cockatrice\paths" "carddatabase" "$APPDATA\cards.xml" - WriteRegStr HKCU "Software\Cockatrice\Cockatrice\paths" "decks" "$APPDATA\decks" - WriteRegStr HKCU "Software\Cockatrice\Cockatrice\paths" "pics" "$APPDATA\pics" - WriteRegStr HKCU "Software\Cockatrice\Cockatrice\sound" "path" "$APPDATA\sounds" + WriteRegStr HKCU "Software\Cockatrice\Cockatrice\paths" "carddatabase" "$APPDATA\Cockatrice\cards.xml" + WriteRegStr HKCU "Software\Cockatrice\Cockatrice\paths" "decks" "$APPDATA\Cockatrice\decks" + WriteRegStr HKCU "Software\Cockatrice\Cockatrice\paths" "pics" "$APPDATA\Cockatrice\pics" + WriteRegStr HKCU "Software\Cockatrice\Cockatrice\sound" "path" "$APPDATA\Cockatrice\sounds" SectionEnd Section "Start menu item" SecStartMenu From e925403bc5c425463948a6991e0fdc3eee06a328 Mon Sep 17 00:00:00 2001 From: Daenyth Date: Mon, 23 Jun 2014 22:18:40 -0400 Subject: [PATCH 31/66] Log cardname when downloading --- cockatrice/src/carddatabase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cockatrice/src/carddatabase.cpp b/cockatrice/src/carddatabase.cpp index c9c3756fb..6760e068d 100644 --- a/cockatrice/src/carddatabase.cpp +++ b/cockatrice/src/carddatabase.cpp @@ -169,7 +169,7 @@ void PictureLoader::startNextPicDownload() QUrl url(picUrl); QNetworkRequest req(url); - qDebug() << "starting picture download:" << req.url(); + qDebug() << "starting picture download:" << cardBeingDownloaded.getCard()->getName() << "Url:" << req.url(); networkManager->get(req); } From 632e7f487c3d5be276bbc0d8bd5da24d55084287 Mon Sep 17 00:00:00 2001 From: Daenyth Date: Mon, 23 Jun 2014 23:15:53 -0400 Subject: [PATCH 32/66] Add debugging to file for windows --- nsis/cockatrice.nsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nsis/cockatrice.nsi b/nsis/cockatrice.nsi index 33cc496b2..90ebfe507 100644 --- a/nsis/cockatrice.nsi +++ b/nsis/cockatrice.nsi @@ -91,7 +91,7 @@ SectionEnd Section "Start menu item" SecStartMenu createDirectory "$SMPROGRAMS\Cockatrice" - createShortCut "$SMPROGRAMS\Cockatrice\Cockatrice.lnk" "$INSTDIR\cockatrice.exe" + createShortCut "$SMPROGRAMS\Cockatrice\Cockatrice.lnk" "$INSTDIR\cockatrice.exe" '--debug-output' createShortCut "$SMPROGRAMS\Cockatrice\Oracle.lnk" "$INSTDIR\oracle.exe" createShortCut "$SMPROGRAMS\Cockatrice\Usermanual.lnk" "$INSTDIR\Usermanual.pdf" SectionEnd From 0420f4f7af85ffc1fc35b25b852fa73ce11c1c87 Mon Sep 17 00:00:00 2001 From: Daenyth Date: Mon, 23 Jun 2014 23:44:13 -0400 Subject: [PATCH 33/66] Log download failures --- cockatrice/src/carddatabase.cpp | 16 ++++++++++------ cockatrice/src/carddatabase.h | 2 -- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/cockatrice/src/carddatabase.cpp b/cockatrice/src/carddatabase.cpp index 6760e068d..2e5c0ec72 100644 --- a/cockatrice/src/carddatabase.cpp +++ b/cockatrice/src/carddatabase.cpp @@ -132,7 +132,7 @@ void PictureLoader::processLoadQueue() } continue; } - + emit imageLoaded(ptl.getCard(), image); } } @@ -176,6 +176,10 @@ void PictureLoader::startNextPicDownload() void PictureLoader::picDownloadFinished(QNetworkReply *reply) { QString picsPath = _picsPath; + if (reply->error()) { + qDebug() << "Download failed:" << reply->errorString(); + } + const QByteArray &picData = reply->readAll(); QImage testImage; if (testImage.loadFromData(picData)) { @@ -189,17 +193,17 @@ void PictureLoader::picDownloadFinished(QNetworkReply *reply) QDir dir(QString(picsPath + "/downloadedPics")); dir.mkdir(cardBeingDownloaded.getSetName()); } - + QString suffix; if (!cardBeingDownloaded.getStripped()) suffix = ".full"; - + QFile newPic(picsPath + "/downloadedPics/" + cardBeingDownloaded.getSetName() + "/" + cardBeingDownloaded.getCard()->getCorrectedName() + suffix + ".jpg"); if (!newPic.open(QIODevice::WriteOnly)) return; newPic.write(picData); newPic.close(); - + emit imageLoaded(cardBeingDownloaded.getCard(), testImage); } else if (cardBeingDownloaded.getHq()) { qDebug() << "HQ: received invalid picture. URL:" << reply->request().url(); @@ -216,7 +220,7 @@ void PictureLoader::picDownloadFinished(QNetworkReply *reply) } else emit imageLoaded(cardBeingDownloaded.getCard(), QImage()); } - + reply->deleteLater(); startNextPicDownload(); } @@ -224,7 +228,7 @@ void PictureLoader::picDownloadFinished(QNetworkReply *reply) void PictureLoader::loadImage(CardInfo *card, bool stripped) { QMutexLocker locker(&mutex); - + loadQueue.append(PictureToLoad(card, stripped)); emit startLoadQueue(); } diff --git a/cockatrice/src/carddatabase.h b/cockatrice/src/carddatabase.h index bd3fd419e..5e83080c8 100644 --- a/cockatrice/src/carddatabase.h +++ b/cockatrice/src/carddatabase.h @@ -53,10 +53,8 @@ public: bool getStripped() const { return stripped; } QString getSetName() const { return sortedSets[setIndex]->getShortName(); } bool nextSet(); - bool getHq() const { return hq; } void setHq(bool _hq) { hq = _hq; } - }; class PictureLoader : public QObject { From e5d9692d780d964eb99bebaca8178521ee86ee32 Mon Sep 17 00:00:00 2001 From: Daenyth Date: Tue, 24 Jun 2014 00:14:59 -0400 Subject: [PATCH 34/66] Fall back to plain text load when xml load fails --- cockatrice/src/deck_loader.cpp | 19 +++++++++++++++---- common/decklist.cpp | 23 ++++++++++++++++------- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/cockatrice/src/deck_loader.cpp b/cockatrice/src/deck_loader.cpp index 6a907ed75..4443b43b3 100644 --- a/cockatrice/src/deck_loader.cpp +++ b/cockatrice/src/deck_loader.cpp @@ -1,5 +1,6 @@ #include #include +#include #include "deck_loader.h" #include "decklist.h" @@ -44,18 +45,28 @@ bool DeckLoader::loadFromFile(const QString &fileName, FileFormat fmt) QFile file(fileName); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) return false; - + bool result = false; switch (fmt) { case PlainTextFormat: result = loadFromFile_Plain(&file); break; - case CockatriceFormat: result = loadFromFile_Native(&file); break; + case CockatriceFormat: + result = loadFromFile_Native(&file); + qDebug() << "Loaded from" << fileName << "-" << result; + if (!result) { + qDebug() << "Retying as plain format"; + file.seek(0); + result = loadFromFile_Plain(&file); + fmt = PlainTextFormat; + } + break; } if (result) { lastFileName = fileName; lastFileFormat = fmt; - + emit deckLoaded(); } + qDebug() << "Deck was loaded -" << result; return result; } @@ -66,7 +77,7 @@ bool DeckLoader::loadFromRemote(const QString &nativeString, int remoteDeckId) lastFileName = QString(); lastFileFormat = CockatriceFormat; lastRemoteDeckId = remoteDeckId; - + emit deckLoaded(); } return result; diff --git a/common/decklist.cpp b/common/decklist.cpp index 8ba9378e9..e81a0629b 100644 --- a/common/decklist.cpp +++ b/common/decklist.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include "decklist.h" SideboardPlan::SideboardPlan(const QString &_name, const QList &_moveList) @@ -441,6 +442,11 @@ void DeckList::write(QXmlStreamWriter *xml) bool DeckList::loadFromXml(QXmlStreamReader *xml) { + if (xml->error()) { + qDebug() << "Error loading deck from xml: " << xml->errorString(); + return false; + } + cleanList(); while (!xml->atEnd()) { xml->readNext(); @@ -455,6 +461,10 @@ bool DeckList::loadFromXml(QXmlStreamReader *xml) } } updateDeckHash(); + if (xml->error()) { + qDebug() << "Error loading deck from xml: " << xml->errorString(); + return false; + } return true; } @@ -477,8 +487,7 @@ QString DeckList::writeToString_Native() bool DeckList::loadFromFile_Native(QIODevice *device) { QXmlStreamReader xml(device); - loadFromXml(&xml); - return true; + return loadFromXml(&xml); } bool DeckList::saveToFile_Native(QIODevice *device) @@ -496,7 +505,7 @@ bool DeckList::saveToFile_Native(QIODevice *device) bool DeckList::loadFromStream_Plain(QTextStream &in) { cleanList(); - + InnerDecklistNode *main = 0, *side = 0; bool inSideboard = false; @@ -530,7 +539,7 @@ bool DeckList::loadFromStream_Plain(QTextStream &in) line.remove(rx); rx.setPattern("\\(.*\\)"); line.remove(rx); - //Filter out post card name editions + //Filter out post card name editions rx.setPattern("\\|.*$"); line.remove(rx); line = line.simplified(); @@ -543,10 +552,10 @@ bool DeckList::loadFromStream_Plain(QTextStream &in) continue; QString cardName = line.mid(i + 1); - // Common differences between cockatrice's card names - // and what's commonly used in decklists + // Common differences between cockatrice's card names + // and what's commonly used in decklists rx.setPattern("’"); - cardName.replace(rx, "'"); + cardName.replace(rx, "'"); rx.setPattern("Æ"); cardName.replace(rx, "AE"); rx.setPattern("^Aether"); From df659e58fe4fdf5f6e815f49a60a1b96458a5418 Mon Sep 17 00:00:00 2001 From: Daenyth Date: Tue, 24 Jun 2014 20:49:03 -0400 Subject: [PATCH 35/66] Mask set shortcodes for windows illegal filenames Ref #122 --- cockatrice/src/carddatabase.cpp | 24 ++++++++++++++++++------ cockatrice/src/carddatabase.h | 3 ++- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/cockatrice/src/carddatabase.cpp b/cockatrice/src/carddatabase.cpp index 2e5c0ec72..5a942b0f8 100644 --- a/cockatrice/src/carddatabase.cpp +++ b/cockatrice/src/carddatabase.cpp @@ -16,12 +16,6 @@ const int CardDatabase::versionNeeded = 3; -CardSet::CardSet(const QString &_shortName, const QString &_longName) - : shortName(_shortName), longName(_longName) -{ - updateSortKey(); -} - QXmlStreamWriter &operator<<(QXmlStreamWriter &xml, const CardSet *set) { xml.writeStartElement("set"); @@ -32,6 +26,24 @@ QXmlStreamWriter &operator<<(QXmlStreamWriter &xml, const CardSet *set) return xml; } +CardSet::CardSet(const QString &_shortName, const QString &_longName) + : shortName(_shortName), longName(_longName) +{ + updateSortKey(); +} + +QString CardSet::getCorrectedShortName() const +{ + // Because windows is horrible. + QSet invalidFileNames; + invalidFileNames << "CON" << "PRN" << "AUX" << "NUL" << "COM1" << "COM2" << + "COM3" << "COM4" << "COM5" << "COM6" << "COM7" << "COM8" << "COM9" << + "LPT1" << "LPT2" << "LPT3" << "LPT4" << "LPT5" << "LPT6" << "LPT7" << + "LPT8" << "LPT9"; + + return invalidFileNames.contains(shortName) ? shortName + "_" : shortName; +} + void CardSet::setSortKey(unsigned int _sortKey) { sortKey = _sortKey; diff --git a/cockatrice/src/carddatabase.h b/cockatrice/src/carddatabase.h index 5e83080c8..70d77bca0 100644 --- a/cockatrice/src/carddatabase.h +++ b/cockatrice/src/carddatabase.h @@ -26,6 +26,7 @@ private: unsigned int sortKey; public: CardSet(const QString &_shortName = QString(), const QString &_longName = QString()); + QString getCorrectedShortName() const; QString getShortName() const { return shortName; } QString getLongName() const { return longName; } int getSortKey() const { return sortKey; } @@ -51,7 +52,7 @@ public: PictureToLoad(CardInfo *_card = 0, bool _stripped = false, bool _hq = true); CardInfo *getCard() const { return card; } bool getStripped() const { return stripped; } - QString getSetName() const { return sortedSets[setIndex]->getShortName(); } + QString getSetName() const { return sortedSets[setIndex]->getCorrectedShortName(); } bool nextSet(); bool getHq() const { return hq; } void setHq(bool _hq) { hq = _hq; } From d811fee2f3f168434576abcba6182819894f8109 Mon Sep 17 00:00:00 2001 From: Daenyth Date: Wed, 25 Jun 2014 00:11:55 -0400 Subject: [PATCH 36/66] Include missing qdebug Dunno how I missed that. Fix #128 --- cockatrice/src/settingscache.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/cockatrice/src/settingscache.cpp b/cockatrice/src/settingscache.cpp index 136150392..892630f53 100644 --- a/cockatrice/src/settingscache.cpp +++ b/cockatrice/src/settingscache.cpp @@ -1,5 +1,6 @@ #include "settingscache.h" #include +#include #include SettingsCache::SettingsCache() From 0b8782149730e70f14ed66d7ac3122960c39b530 Mon Sep 17 00:00:00 2001 From: Daenyth Date: Wed, 25 Jun 2014 00:58:58 -0400 Subject: [PATCH 37/66] Add rough draft for .travis.yml --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..3dfa5f1ba --- /dev/null +++ b/.travis.yml @@ -0,0 +1,5 @@ +language: cpp +compiler: + - gcc + - clang +script: mkdir build && cd build && cmake .. && make From 0dd4661b7ca460fe0448535b691493449d968b89 Mon Sep 17 00:00:00 2001 From: Daenyth Date: Wed, 25 Jun 2014 01:14:43 -0400 Subject: [PATCH 38/66] Add travis build icon to README --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 957a0249d..ca8796b4f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Cockatrice +[![Build Status](https://travis-ci.org/Daenyth/Cockatrice.svg?branch=master)](https://travis-ci.org/Daenyth/Cockatrice) + Cockatrice is an open-source multiplatform software for playing card games, such as Magic: The Gathering, over a network. It is fully client-server based to prevent any kind of cheating, though it supports single-player games without From 478c7f234fd6180a8469726ea0b7c6a4d4b49b97 Mon Sep 17 00:00:00 2001 From: Daenyth Date: Wed, 25 Jun 2014 01:17:12 -0400 Subject: [PATCH 39/66] Set up dependencies for travis --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 3dfa5f1ba..65f86165e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,3 +3,6 @@ compiler: - gcc - clang script: mkdir build && cd build && cmake .. && make +before_install: + - sudo apt-get update -qq + - sudo apt-get install -y qtmobility-dev libprotobuf-dev protobuf-compiler From ba1fc86f29d8c1e3babb48994871c45679f4904d Mon Sep 17 00:00:00 2001 From: Daenyth Date: Wed, 25 Jun 2014 01:18:52 -0400 Subject: [PATCH 40/66] Install qt dep for travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 65f86165e..0475769dc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,4 +5,4 @@ compiler: script: mkdir build && cd build && cmake .. && make before_install: - sudo apt-get update -qq - - sudo apt-get install -y qtmobility-dev libprotobuf-dev protobuf-compiler + - sudo apt-get install -y qtmobility-dev libprotobuf-dev protobuf-compiler libqt4-dev From 44445704e74ee146881235688732f24ba9796a05 Mon Sep 17 00:00:00 2001 From: Daenyth Date: Wed, 25 Jun 2014 01:21:24 -0400 Subject: [PATCH 41/66] Install qt-multimedia-dev for travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0475769dc..4affbd712 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,4 +5,4 @@ compiler: script: mkdir build && cd build && cmake .. && make before_install: - sudo apt-get update -qq - - sudo apt-get install -y qtmobility-dev libprotobuf-dev protobuf-compiler libqt4-dev + - sudo apt-get install -y qtmobility-dev libprotobuf-dev protobuf-compiler libqt4-dev qtmultimedia-dev From 8a331e30c67e8a5ec63abbb9ca0a746427e011a3 Mon Sep 17 00:00:00 2001 From: Daenyth Date: Wed, 25 Jun 2014 01:24:14 -0400 Subject: [PATCH 42/66] Don't install qtmultimedia - not needed --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4affbd712..0475769dc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,4 +5,4 @@ compiler: script: mkdir build && cd build && cmake .. && make before_install: - sudo apt-get update -qq - - sudo apt-get install -y qtmobility-dev libprotobuf-dev protobuf-compiler libqt4-dev qtmultimedia-dev + - sudo apt-get install -y qtmobility-dev libprotobuf-dev protobuf-compiler libqt4-dev From 5ea59908a8b0ccf7562dffca3bee391904b8481d Mon Sep 17 00:00:00 2001 From: Daenyth Date: Wed, 25 Jun 2014 01:29:06 -0400 Subject: [PATCH 43/66] Cache apt for travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 0475769dc..378c7e485 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,3 +6,4 @@ script: mkdir build && cd build && cmake .. && make before_install: - sudo apt-get update -qq - sudo apt-get install -y qtmobility-dev libprotobuf-dev protobuf-compiler libqt4-dev +cache: apt From 0eb00fe39caf6054a7c2f11e61eb3e143d91f4f4 Mon Sep 17 00:00:00 2001 From: Daenyth Date: Wed, 25 Jun 2014 01:31:43 -0400 Subject: [PATCH 44/66] Add build-essential to travis cfg This can't be causing the failure can it? It can't find QtMultimedia.. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 378c7e485..07f05b952 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,5 +5,5 @@ compiler: script: mkdir build && cd build && cmake .. && make before_install: - sudo apt-get update -qq - - sudo apt-get install -y qtmobility-dev libprotobuf-dev protobuf-compiler libqt4-dev + - sudo apt-get install -y qtmobility-dev libprotobuf-dev protobuf-compiler libqt4-dev build-essential cache: apt From 1c9540befab7523b4941c5b8b9e60e6ab7bf957f Mon Sep 17 00:00:00 2001 From: Daenyth Date: Wed, 25 Jun 2014 01:48:30 -0400 Subject: [PATCH 45/66] Set cmake module path to local for findqtmobility --- cockatrice/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/cockatrice/CMakeLists.txt b/cockatrice/CMakeLists.txt index 8cfca2577..b4de656a6 100644 --- a/cockatrice/CMakeLists.txt +++ b/cockatrice/CMakeLists.txt @@ -126,6 +126,7 @@ if(APPLE) ENDIF(APPLE) if (NOT QT_QTMULTIMEDIA_FOUND) + SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) FIND_PACKAGE(QtMobility REQUIRED) endif (NOT QT_QTMULTIMEDIA_FOUND) From aee86ce45a4d30fcca4d4d1879b67bd46eacce9e Mon Sep 17 00:00:00 2001 From: Daenyth Date: Wed, 25 Jun 2014 01:53:19 -0400 Subject: [PATCH 46/66] Mark QGraphicsItem for AbstractGraphicsItem --- cockatrice/src/abstractgraphicsitem.h | 1 + 1 file changed, 1 insertion(+) diff --git a/cockatrice/src/abstractgraphicsitem.h b/cockatrice/src/abstractgraphicsitem.h index 83cbf0db7..f838dcd3b 100644 --- a/cockatrice/src/abstractgraphicsitem.h +++ b/cockatrice/src/abstractgraphicsitem.h @@ -14,6 +14,7 @@ enum GraphicsItemType { class AbstractGraphicsItem : public QObject, public QGraphicsItem { Q_OBJECT + Q_INTERFACES(QGraphicsItem) protected: void paintNumberEllipse(int number, int radius, const QColor &color, int position, int count, QPainter *painter); public: From 312acb3402b45cd5d50d3a49058b2fc76b15da9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=20Morschh=C3=A4user?= Date: Wed, 25 Jun 2014 09:16:00 +0200 Subject: [PATCH 47/66] Recompiled usermanual. --- doc/usermanual/Usermanual.pdf | Bin 2880215 -> 2880364 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/doc/usermanual/Usermanual.pdf b/doc/usermanual/Usermanual.pdf index 3d279df3822720f6834a29441e735641695dc866..3d2d562da7bb5e1bde81915eb51a7a2cda0a3679 100644 GIT binary patch delta 13878 zcmajlV{j(H+bI0lwr$(V#>Pe)+qQ8B8*J=5wr$(CZD(U+PyWwy^x@R|R@bjF(=}5y z)zwqoeXShTfL`AiqI8d4fY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u) BCF}qI From 2d400e55c780e3b4633e92d2463a8bd20c5b936a Mon Sep 17 00:00:00 2001 From: Gavin Bisesi Date: Wed, 25 Jun 2014 11:33:40 -0400 Subject: [PATCH 48/66] Add OSX build flag to travis yml --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 07f05b952..2d1f870e1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,7 @@ language: cpp +os: + - linux + - osx compiler: - gcc - clang From bda01b2044e454978ba158defb632ee9a47afd5c Mon Sep 17 00:00:00 2001 From: Gavin Bisesi Date: Wed, 25 Jun 2014 11:48:48 -0400 Subject: [PATCH 49/66] Install dependencies for travis more generally --- .travis.yml | 4 +--- travis-dependencies.sh | 9 +++++++++ 2 files changed, 10 insertions(+), 3 deletions(-) create mode 100755 travis-dependencies.sh diff --git a/.travis.yml b/.travis.yml index 2d1f870e1..803f316c3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,5 @@ compiler: - gcc - clang script: mkdir build && cd build && cmake .. && make -before_install: - - sudo apt-get update -qq - - sudo apt-get install -y qtmobility-dev libprotobuf-dev protobuf-compiler libqt4-dev build-essential +install: ./travis-dependencies.sh cache: apt diff --git a/travis-dependencies.sh b/travis-dependencies.sh new file mode 100755 index 000000000..533a213b1 --- /dev/null +++ b/travis-dependencies.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +if [[ $TRAVIS_OS_NAME == "osx" ]] ; then + brew update + brew install qt cmake protobuf +else + sudo apt-get update -qq + sudo apt-get install -y qtmobility-dev libprotobuf-dev protobuf-compiler libqt4-dev +fi From fcc62a1e1fdbc0612fcb4272df2fd7193be7ff1e Mon Sep 17 00:00:00 2001 From: Gavin Bisesi Date: Wed, 25 Jun 2014 17:09:17 -0400 Subject: [PATCH 50/66] Use defined(Q_OS_WIN) in #elif to satisfy MSVC It's always windows. --- cockatrice/src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cockatrice/src/main.cpp b/cockatrice/src/main.cpp index 370c1b1a7..c618c1ae5 100644 --- a/cockatrice/src/main.cpp +++ b/cockatrice/src/main.cpp @@ -100,7 +100,7 @@ int main(int argc, char *argv[]) if (translationPath.isEmpty()) { #ifdef Q_OS_MAC translationPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath); -#elif Q_OS_WIN +#elif defined(Q_OS_WIN) translationPath = app.applicationDirPath() + "/translations"; #endif } From 91a96643f03395242acf2bf3ab30d40aa832c967 Mon Sep 17 00:00:00 2001 From: woogerboy21 Date: Thu, 26 Jun 2014 00:38:43 -0400 Subject: [PATCH 51/66] updated filtering code rewrote filtering code to allow for user input code only filters on single string at the moment (still needs updated). --- servatrice/src/server_logger.cpp | 55 +++++++++----------------------- 1 file changed, 15 insertions(+), 40 deletions(-) diff --git a/servatrice/src/server_logger.cpp b/servatrice/src/server_logger.cpp index a5c33bc8b..1fff3f8ba 100644 --- a/servatrice/src/server_logger.cpp +++ b/servatrice/src/server_logger.cpp @@ -5,13 +5,11 @@ #include #include #include -#include #ifdef Q_OS_UNIX # include # include # include #endif -using namespace std; ServerLogger::ServerLogger(bool _logToConsole, QObject *parent) : QObject(parent), logToConsole(_logToConsole), flushRunning(false) @@ -53,48 +51,25 @@ void ServerLogger::logMessage(QString message, void *caller) //filter out all log entries based on loglevel value in configuration file QSettings *settings = new QSettings("servatrice.ini", QSettings::IniFormat); - int capture = 0; list lst_str; - int loglevel = settings->value("server/loglevel").toInt(); - if (!loglevel) - loglevel = 999; + bool shouldWeWriteLog = settings->value("server/writelog").toBool(); + //allowedLogStatements << "Adding room: ID=" << "Starting status update clock" << "Starting server on port" << + // "Server listening." << "Server::loginUser:" << "Server::removeClient:" << "Command_Login.ext" << + // "Command_RoomSay.ext" << "Command_Message.ext" << "Command_GameSay.ext"; - switch (loglevel) - { - case 1: - capture = 0; - break; + if (shouldWeWriteLog){ + QString logFilters = settings->value("server/logfilters").toString(); + bool shouldWeSkipLine = false; + if (!logFilters.trimmed().isEmpty()) + shouldWeSkipLine = !message.contains(logFilters); + + if (shouldWeSkipLine) + return; - case 2: - // filter message log data - lst_str.push_back("Adding room: ID="); - lst_str.push_back("Starting status update clock"); - lst_str.push_back("Starting server on port"); - lst_str.push_back("Server listening."); - lst_str.push_back("Server::loginUser:"); - lst_str.push_back("Server::removeClient:"); - lst_str.push_back("Command_Login.ext"); - lst_str.push_back("Command_RoomSay.ext"); - lst_str.push_back("Command_Message.ext"); - lst_str.push_back("Command_GameSay.ext"); - for (list::iterator i = lst_str.begin(); i != lst_str.end(); i++) - { - if(message.indexOf((*i).c_str(), Qt::CaseInsensitive) != -1) { - capture = 1; - break; - } - } - break; - - default: - capture = 1; - } - - if (capture != 0){ bufferMutex.lock(); - buffer.append(QDateTime::currentDateTime().toString() + " " + callerString + message); - bufferMutex.unlock(); + buffer.append(QDateTime::currentDateTime().toString() + " " + callerString + message); + bufferMutex.unlock(); + emit sigFlushBuffer(); } - emit sigFlushBuffer(); } void ServerLogger::flushBuffer() From 977cf7340ab50d471e47a7d1d11bcfa004938b1f Mon Sep 17 00:00:00 2001 From: woogerboy21 Date: Thu, 26 Jun 2014 00:40:21 -0400 Subject: [PATCH 52/66] settings update/addition updated settings name (loglevel) to a more descriptive name (writelog) added logfilters setting to allow user defined filters. --- servatrice/servatrice.ini.example | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/servatrice/servatrice.ini.example b/servatrice/servatrice.ini.example index 5c5e2488c..c50ff9f1a 100644 --- a/servatrice/servatrice.ini.example +++ b/servatrice/servatrice.ini.example @@ -5,7 +5,8 @@ logfile=server.log name="My Cockatrice server" id=1 number_pools=1 -loglevel=0 +writelog=1 +logfilters="" [servernetwork] active=0 From 365de1fdd059ad93688953dfe2ece88d66ff9d5b Mon Sep 17 00:00:00 2001 From: woogerboy21 Date: Thu, 26 Jun 2014 14:38:57 -0400 Subject: [PATCH 53/66] added multiple filter capabilities changed the single qstring log filtering to qstringlist to allow multiple filtering capabilities --- servatrice/src/server_logger.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/servatrice/src/server_logger.cpp b/servatrice/src/server_logger.cpp index 1fff3f8ba..0264c2fdb 100644 --- a/servatrice/src/server_logger.cpp +++ b/servatrice/src/server_logger.cpp @@ -49,19 +49,25 @@ void ServerLogger::logMessage(QString message, void *caller) if (caller) callerString = QString::number((qulonglong) caller, 16) + " "; - //filter out all log entries based on loglevel value in configuration file + //filter out all log entries based on values in configuration file QSettings *settings = new QSettings("servatrice.ini", QSettings::IniFormat); bool shouldWeWriteLog = settings->value("server/writelog").toBool(); - //allowedLogStatements << "Adding room: ID=" << "Starting status update clock" << "Starting server on port" << - // "Server listening." << "Server::loginUser:" << "Server::removeClient:" << "Command_Login.ext" << - // "Command_RoomSay.ext" << "Command_Message.ext" << "Command_GameSay.ext"; if (shouldWeWriteLog){ QString logFilters = settings->value("server/logfilters").toString(); + QStringList listlogFilters = logFilters.split(",", QString::SkipEmptyParts); bool shouldWeSkipLine = false; - if (!logFilters.trimmed().isEmpty()) - shouldWeSkipLine = !message.contains(logFilters); - + if (!logFilters.trimmed().isEmpty()){ + shouldWeSkipLine = true; + foreach(QString logFilter, listlogFilters){ + if (message.contains(logFilter, Qt::CaseInsensitive)){ + shouldWeSkipLine = false; + break; + } + } + } + + if (shouldWeSkipLine) return; From b83fe95b058d9b898881ce1f3a7940b6bf52b6bd Mon Sep 17 00:00:00 2001 From: woogerboy21 Date: Thu, 26 Jun 2014 14:46:22 -0400 Subject: [PATCH 54/66] removed extra un-needed empty line. removed extra un-needed empty line. --- servatrice/src/server_logger.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/servatrice/src/server_logger.cpp b/servatrice/src/server_logger.cpp index 0264c2fdb..9566ba17c 100644 --- a/servatrice/src/server_logger.cpp +++ b/servatrice/src/server_logger.cpp @@ -67,7 +67,6 @@ void ServerLogger::logMessage(QString message, void *caller) } } - if (shouldWeSkipLine) return; From 080fd326ed3d672e66d74e73a5f36a241918cc75 Mon Sep 17 00:00:00 2001 From: arxanas Date: Thu, 26 Jun 2014 16:57:47 -0400 Subject: [PATCH 55/66] Fixed #131: Compiles on OS X now. --- cockatrice/src/carddatabase.cpp | 4 ++-- cockatrice/src/carddatabase.h | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cockatrice/src/carddatabase.cpp b/cockatrice/src/carddatabase.cpp index 5a942b0f8..1677cf697 100644 --- a/cockatrice/src/carddatabase.cpp +++ b/cockatrice/src/carddatabase.cpp @@ -275,7 +275,7 @@ CardInfo::CardInfo(CardDatabase *_db, bool _cipt, int _tableRow, const SetList &_sets, - QMap _muIds) + MuidMap _muIds) : db(_db), name(_name), isToken(_isToken), @@ -610,7 +610,7 @@ void CardDatabase::loadCardsFromXml(QXmlStreamReader &xml) if (xml.name() == "card") { QString name, manacost, type, pt, text; QStringList colors; - QMap muids; + MuidMap muids; SetList sets; int tableRow = 0; int loyalty = 0; diff --git a/cockatrice/src/carddatabase.h b/cockatrice/src/carddatabase.h index 70d77bca0..28d56d135 100644 --- a/cockatrice/src/carddatabase.h +++ b/cockatrice/src/carddatabase.h @@ -20,6 +20,9 @@ class QNetworkRequest; typedef QMap QStringMap; +// If we don't typedef this, CardInfo::CardInfo will refuse to compile on OS X. +typedef QMap MuidMap; + class CardSet : public QList { private: QString shortName, longName; @@ -100,7 +103,7 @@ private: QString text; QStringList colors; int loyalty; - QMap muIds; + MuidMap muIds; bool cipt; int tableRow; QPixmap *pixmap; @@ -118,7 +121,7 @@ public: bool _cipt = false, int _tableRow = 0, const SetList &_sets = SetList(), - QMap muids = QMap()); + MuidMap muids = MuidMap()); ~CardInfo(); const QString &getName() const { return name; } bool getIsToken() const { return isToken; } From f685bd2abe58013b03da0a87a3b6b5fd2dc2847b Mon Sep 17 00:00:00 2001 From: woogerboy21 Date: Fri, 27 Jun 2014 18:18:03 -0400 Subject: [PATCH 56/66] formatting 4 space indent + code flow rewrite for easier readability. --- servatrice/src/server_logger.cpp | 165 ++++++++++++++++--------------- 1 file changed, 83 insertions(+), 82 deletions(-) diff --git a/servatrice/src/server_logger.cpp b/servatrice/src/server_logger.cpp index 9566ba17c..2dbbc5e52 100644 --- a/servatrice/src/server_logger.cpp +++ b/servatrice/src/server_logger.cpp @@ -12,121 +12,122 @@ #endif ServerLogger::ServerLogger(bool _logToConsole, QObject *parent) - : QObject(parent), logToConsole(_logToConsole), flushRunning(false) + : QObject(parent), logToConsole(_logToConsole), flushRunning(false) { } ServerLogger::~ServerLogger() { - flushBuffer(); - // This does not work with the destroyed() signal as this destructor is called after the main event loop is done. - thread()->quit(); + flushBuffer(); + // This does not work with the destroyed() signal as this destructor is called after the main event loop is done. + thread()->quit(); } void ServerLogger::startLog(const QString &logFileName) { - if (!logFileName.isEmpty()) { - logFile = new QFile("server.log", this); - logFile->open(QIODevice::Append); + if (!logFileName.isEmpty()) { + logFile = new QFile("server.log", this); + logFile->open(QIODevice::Append); #ifdef Q_OS_UNIX - ::socketpair(AF_UNIX, SOCK_STREAM, 0, sigHupFD); + ::socketpair(AF_UNIX, SOCK_STREAM, 0, sigHupFD); - snHup = new QSocketNotifier(sigHupFD[1], QSocketNotifier::Read, this); - connect(snHup, SIGNAL(activated(int)), this, SLOT(handleSigHup())); + snHup = new QSocketNotifier(sigHupFD[1], QSocketNotifier::Read, this); + connect(snHup, SIGNAL(activated(int)), this, SLOT(handleSigHup())); #endif - } else - logFile = 0; - - connect(this, SIGNAL(sigFlushBuffer()), this, SLOT(flushBuffer()), Qt::QueuedConnection); + } else + logFile = 0; + + connect(this, SIGNAL(sigFlushBuffer()), this, SLOT(flushBuffer()), Qt::QueuedConnection); } void ServerLogger::logMessage(QString message, void *caller) { - if (!logFile) - return; - - QString callerString; - if (caller) - callerString = QString::number((qulonglong) caller, 16) + " "; - - //filter out all log entries based on values in configuration file - QSettings *settings = new QSettings("servatrice.ini", QSettings::IniFormat); - bool shouldWeWriteLog = settings->value("server/writelog").toBool(); - - if (shouldWeWriteLog){ - QString logFilters = settings->value("server/logfilters").toString(); - QStringList listlogFilters = logFilters.split(",", QString::SkipEmptyParts); - bool shouldWeSkipLine = false; - if (!logFilters.trimmed().isEmpty()){ - shouldWeSkipLine = true; - foreach(QString logFilter, listlogFilters){ - if (message.contains(logFilter, Qt::CaseInsensitive)){ - shouldWeSkipLine = false; - break; - } - } - } + if (!logFile) + return; + + QString callerString; + if (caller) + callerString = QString::number((qulonglong) caller, 16) + " "; + + //filter out all log entries based on values in configuration file + QSettings *settings = new QSettings("servatrice.ini", QSettings::IniFormat); + bool shouldWeWriteLog = settings->value("server/writelog").toBool(); + QString logFilters = settings->value("server/logfilters").toString(); + QStringList listlogFilters = logFilters.split(",", QString::SkipEmptyParts); + bool shouldWeSkipLine = false; + + if (!shouldWeWriteLog) + return; - if (shouldWeSkipLine) - return; + if (!logFilters.trimmed().isEmpty()){ + shouldWeSkipLine = true; + foreach(QString logFilter, listlogFilters){ + if (message.contains(logFilter, Qt::CaseInsensitive)){ + shouldWeSkipLine = false; + break; + } + } + } - bufferMutex.lock(); - buffer.append(QDateTime::currentDateTime().toString() + " " + callerString + message); - bufferMutex.unlock(); - emit sigFlushBuffer(); - } + if (shouldWeSkipLine) + return; + + bufferMutex.lock(); + buffer.append(QDateTime::currentDateTime().toString() + " " + callerString + message); + bufferMutex.unlock(); + emit sigFlushBuffer(); } void ServerLogger::flushBuffer() { - if (flushRunning) - return; - - flushRunning = true; - QTextStream stream(logFile); - forever { - bufferMutex.lock(); - if (buffer.isEmpty()) { - bufferMutex.unlock(); - flushRunning = false; - return; - } - QString message = buffer.takeFirst(); - bufferMutex.unlock(); - - stream << message << "\n"; - stream.flush(); - - if (logToConsole) - std::cout << message.toStdString() << std::endl; - } + if (flushRunning) + return; + + flushRunning = true; + QTextStream stream(logFile); + forever { + bufferMutex.lock(); + if (buffer.isEmpty()) { + bufferMutex.unlock(); + flushRunning = false; + return; + } + QString message = buffer.takeFirst(); + bufferMutex.unlock(); + + stream << message << "\n"; + stream.flush(); + + if (logToConsole) + std::cout << message.toStdString() << std::endl; + } } void ServerLogger::hupSignalHandler(int /*unused*/) { #ifdef Q_OS_UNIX - if (!logFile) - return; - - char a = 1; - ::write(sigHupFD[0], &a, sizeof(a)); + if (!logFile) + return; + + char a = 1; + ::write(sigHupFD[0], &a, sizeof(a)); #endif } void ServerLogger::handleSigHup() { #ifdef Q_OS_UNIX - if (!logFile) - return; - - snHup->setEnabled(false); - char tmp; - ::read(sigHupFD[1], &tmp, sizeof(tmp)); - - logFile->close(); - logFile->open(QIODevice::Append); - - snHup->setEnabled(true); + if (!logFile) + return; + + snHup->setEnabled(false); + char tmp; + ::read(sigHupFD[1], &tmp, sizeof(tmp)); + + logFile->close(); + logFile->open(QIODevice::Append); + + snHup->setEnabled(true); #endif } From 1d02e0d5ec3288d90272e426e79056c78b007be3 Mon Sep 17 00:00:00 2001 From: Daenyth Date: Fri, 27 Jun 2014 20:00:29 -0400 Subject: [PATCH 57/66] Clarify comment about typedef for OSX compiling --- cockatrice/src/carddatabase.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cockatrice/src/carddatabase.h b/cockatrice/src/carddatabase.h index 28d56d135..09edeff4a 100644 --- a/cockatrice/src/carddatabase.h +++ b/cockatrice/src/carddatabase.h @@ -20,7 +20,7 @@ class QNetworkRequest; typedef QMap QStringMap; -// If we don't typedef this, CardInfo::CardInfo will refuse to compile on OS X. +// If we don't typedef this, CardInfo::CardInfo will refuse to compile on OS X < 10.9 typedef QMap MuidMap; class CardSet : public QList { From d3b4ef38a0b068e0f2c54178044a97fd70097a02 Mon Sep 17 00:00:00 2001 From: Daenyth Date: Fri, 27 Jun 2014 20:42:19 -0400 Subject: [PATCH 58/66] Compile servatrice on travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 803f316c3..74f6feff6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,6 @@ os: compiler: - gcc - clang -script: mkdir build && cd build && cmake .. && make +script: mkdir build && cd build && cmake .. -DWITH_SERVER=1 && make install: ./travis-dependencies.sh cache: apt From 6d3fe428e73530bfb34a2368f86518a56657ed3e Mon Sep 17 00:00:00 2001 From: Daenyth Date: Fri, 27 Jun 2014 22:19:23 -0400 Subject: [PATCH 59/66] Fix some warnings Ref #127 --- CMakeLists.txt | 4 ++-- cockatrice/src/abstractclient.h | 2 +- cockatrice/src/carddatabase.cpp | 8 ++++---- cockatrice/src/cardfilter.h | 2 +- cockatrice/src/decklistmodel.cpp | 3 +++ cockatrice/src/filtertree.h | 4 ++-- cockatrice/src/main.cpp | 2 +- cockatrice/src/main.h | 2 ++ common/decklist.cpp | 3 +++ common/server_response_containers.cpp | 2 +- oracle/src/oracleimporter.h | 2 +- 11 files changed, 21 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 97142397f..5404e120f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,8 +58,8 @@ IF(MSVC) #set(CMAKE_CXX_FLAGS_DEBUG "/Zi") ELSEIF (CMAKE_COMPILER_IS_GNUCXX) # linux/gcc, bsd/gcc, windows/mingw - set(CMAKE_CXX_FLAGS_RELEASE "-s -O2") - set(CMAKE_CXX_FLAGS_DEBUG "-ggdb -O0") + set(CMAKE_CXX_FLAGS_RELEASE "-s -O2 -Wall -Wextra -pedantic -Werror -Wcast-align -Wmissing-declarations -Winline -Wno-long-long -Wno-error=extra -Wno-unused-parameter -Wno-inline -Wno-delete-non-virtual-dtor -Wno-error=sign-compare -Wno-reorder -Wno-missing-declarations") + set(CMAKE_CXX_FLAGS_DEBUG "-ggdb -O0 -Wall -Wextra -pedantic -Werror -Wcast-align -Wmissing-declarations -Winline -Wno-long-long -Wno-error=extra -Wno-error=unused-parameter -Wno-inline -Wno-error=delete-non-virtual-dtor -W-noerror=sign-compare -Wno-error=reorder -Wno-error=missing-declarations") ELSE() # other: osx/llvm, bsd/llvm set(CMAKE_CXX_FLAGS_RELEASE "-O2") diff --git a/cockatrice/src/abstractclient.h b/cockatrice/src/abstractclient.h index 130c85b52..4dc9af2bf 100644 --- a/cockatrice/src/abstractclient.h +++ b/cockatrice/src/abstractclient.h @@ -31,7 +31,7 @@ enum ClientStatus { StatusConnecting, StatusAwaitingWelcome, StatusLoggingIn, - StatusLoggedIn, + StatusLoggedIn }; class AbstractClient : public QObject { diff --git a/cockatrice/src/carddatabase.cpp b/cockatrice/src/carddatabase.cpp index 1677cf697..eff101f94 100644 --- a/cockatrice/src/carddatabase.cpp +++ b/cockatrice/src/carddatabase.cpp @@ -16,7 +16,7 @@ const int CardDatabase::versionNeeded = 3; -QXmlStreamWriter &operator<<(QXmlStreamWriter &xml, const CardSet *set) +static QXmlStreamWriter &operator<<(QXmlStreamWriter &xml, const CardSet *set) { xml.writeStartElement("set"); xml.writeTextElement("name", set->getShortName()); @@ -280,13 +280,13 @@ CardInfo::CardInfo(CardDatabase *_db, name(_name), isToken(_isToken), sets(_sets), - muIds(_muIds), manacost(_manacost), cardtype(_cardtype), powtough(_powtough), text(_text), colors(_colors), loyalty(_loyalty), + muIds(_muIds), cipt(_cipt), tableRow(_tableRow), pixmap(NULL) @@ -434,7 +434,7 @@ int CardInfo::getPreferredMuId() return muIds[getPreferredSet()->getShortName()]; } -QXmlStreamWriter &operator<<(QXmlStreamWriter &xml, const CardInfo *info) +static QXmlStreamWriter &operator<<(QXmlStreamWriter &xml, const CardInfo *info) { xml.writeStartElement("card"); xml.writeTextElement("name", info->getName()); @@ -473,7 +473,7 @@ QXmlStreamWriter &operator<<(QXmlStreamWriter &xml, const CardInfo *info) } CardDatabase::CardDatabase(QObject *parent) - : QObject(parent), loadStatus(NotLoaded), noCard(0) + : QObject(parent), noCard(0), loadStatus(NotLoaded) { connect(settingsCache, SIGNAL(picsPathChanged()), this, SLOT(picsPathChanged())); connect(settingsCache, SIGNAL(cardDatabasePathChanged()), this, SLOT(loadCardDatabase())); diff --git a/cockatrice/src/cardfilter.h b/cockatrice/src/cardfilter.h index 47a85ea61..e5f881233 100644 --- a/cockatrice/src/cardfilter.h +++ b/cockatrice/src/cardfilter.h @@ -26,9 +26,9 @@ public: }; private: + QString trm; enum Type t; enum Attr a; - QString trm; public: CardFilter(QString term, Type type, Attr attr) : trm(term), t(type), a(attr) {}; diff --git a/cockatrice/src/decklistmodel.cpp b/cockatrice/src/decklistmodel.cpp index 00d92faea..a98ee261e 100644 --- a/cockatrice/src/decklistmodel.cpp +++ b/cockatrice/src/decklistmodel.cpp @@ -340,6 +340,9 @@ void DeckListModel::sort(int column, Qt::SortOrder order) break; case 2: sortMethod = ByPrice; + break; + default: + sortMethod = ByName; } root->setSortMethod(sortMethod); sortHelper(root, order); diff --git a/cockatrice/src/filtertree.h b/cockatrice/src/filtertree.h index 9a5fc5313..a6c4536d6 100644 --- a/cockatrice/src/filtertree.h +++ b/cockatrice/src/filtertree.h @@ -66,7 +66,7 @@ public: const CardFilter::Attr attr; LogicMap(CardFilter::Attr a, FilterTree *parent) - : attr(a), p(parent) {} + : p(parent), attr(a) {} const FilterItemList *findTypeList(CardFilter::Type type) const; FilterItemList *typeList(CardFilter::Type type); FilterTreeNode *parent() const; @@ -81,7 +81,7 @@ public: const CardFilter::Type type; FilterItemList(CardFilter::Type t, LogicMap *parent) - : type(t), p(parent) {} + : p(parent), type(t) {} CardFilter::Attr attr() const { return p->attr; } FilterTreeNode *parent() const { return p; } int termIndex(const QString &term) const; diff --git a/cockatrice/src/main.cpp b/cockatrice/src/main.cpp index c618c1ae5..22e1fe129 100644 --- a/cockatrice/src/main.cpp +++ b/cockatrice/src/main.cpp @@ -55,7 +55,7 @@ QString translationPath = TRANSLATION_PATH; QString translationPath = QString(); #endif -void myMessageOutput(QtMsgType /*type*/, const char *msg) +static void myMessageOutput(QtMsgType /*type*/, const char *msg) { QFile file("qdebug.txt"); file.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text); diff --git a/cockatrice/src/main.h b/cockatrice/src/main.h index 4a1d234f0..9237f23cb 100644 --- a/cockatrice/src/main.h +++ b/cockatrice/src/main.h @@ -13,4 +13,6 @@ extern QString translationPath; void installNewTranslator(); +bool settingsValid(); + #endif diff --git a/common/decklist.cpp b/common/decklist.cpp index e81a0629b..c07215562 100644 --- a/common/decklist.cpp +++ b/common/decklist.cpp @@ -180,6 +180,7 @@ bool InnerDecklistNode::compare(AbstractDecklistNode *other) const case 2: return comparePrice(other); } + return 0; } bool InnerDecklistNode::compareNumber(AbstractDecklistNode *other) const @@ -226,6 +227,7 @@ bool AbstractDecklistCardNode::compare(AbstractDecklistNode *other) const case ByPrice: return compareTotalPrice(other); } + return 0; } bool AbstractDecklistCardNode::compareNumber(AbstractDecklistNode *other) const @@ -351,6 +353,7 @@ DeckList::DeckList() root = new InnerDecklistNode; } +// TODO: http://qt-project.org/doc/qt-4.8/qobject.html#no-copy-constructor-or-assignment-operator DeckList::DeckList(const DeckList &other) : name(other.name), comments(other.comments), diff --git a/common/server_response_containers.cpp b/common/server_response_containers.cpp index 8b6d27300..bc36222ef 100644 --- a/common/server_response_containers.cpp +++ b/common/server_response_containers.cpp @@ -64,7 +64,7 @@ void GameEventStorage::sendToGame(Server_Game *game) } ResponseContainer::ResponseContainer(int _cmdId) - : responseExtension(0), cmdId(_cmdId) + : cmdId(_cmdId), responseExtension(0) { } diff --git a/oracle/src/oracleimporter.h b/oracle/src/oracleimporter.h index 1f705eeb2..4c36a211c 100644 --- a/oracle/src/oracleimporter.h +++ b/oracle/src/oracleimporter.h @@ -17,7 +17,7 @@ public: bool getImport() const { return import; } void setImport(bool _import) { import = _import; } SetToDownload(const QString &_shortName, const QString &_longName, const QVariant &_cards, bool _import) - : shortName(_shortName), longName(_longName), cards(_cards), import(_import) { } + : shortName(_shortName), longName(_longName), import(_import), cards(_cards) { } bool operator<(const SetToDownload &set) const { return longName.compare(set.longName, Qt::CaseInsensitive) < 0; } }; From 38aa1f60ed3f9ce19509de753c61a59bcf56b289 Mon Sep 17 00:00:00 2001 From: Daenyth Date: Fri, 27 Jun 2014 22:50:21 -0400 Subject: [PATCH 60/66] Don't pass warn/err flags for release mode build. It's making travis complicated --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5404e120f..96894f172 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,7 +58,7 @@ IF(MSVC) #set(CMAKE_CXX_FLAGS_DEBUG "/Zi") ELSEIF (CMAKE_COMPILER_IS_GNUCXX) # linux/gcc, bsd/gcc, windows/mingw - set(CMAKE_CXX_FLAGS_RELEASE "-s -O2 -Wall -Wextra -pedantic -Werror -Wcast-align -Wmissing-declarations -Winline -Wno-long-long -Wno-error=extra -Wno-unused-parameter -Wno-inline -Wno-delete-non-virtual-dtor -Wno-error=sign-compare -Wno-reorder -Wno-missing-declarations") + set(CMAKE_CXX_FLAGS_RELEASE "-s -O2") set(CMAKE_CXX_FLAGS_DEBUG "-ggdb -O0 -Wall -Wextra -pedantic -Werror -Wcast-align -Wmissing-declarations -Winline -Wno-long-long -Wno-error=extra -Wno-error=unused-parameter -Wno-inline -Wno-error=delete-non-virtual-dtor -W-noerror=sign-compare -Wno-error=reorder -Wno-error=missing-declarations") ELSE() # other: osx/llvm, bsd/llvm From c0bd7db658fb54d6f5834f1e99838c150b94379a Mon Sep 17 00:00:00 2001 From: Daenyth Date: Fri, 27 Jun 2014 22:57:24 -0400 Subject: [PATCH 61/66] Install libgcrypt on osx travis --- travis-dependencies.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/travis-dependencies.sh b/travis-dependencies.sh index 533a213b1..0c6c62e65 100755 --- a/travis-dependencies.sh +++ b/travis-dependencies.sh @@ -2,7 +2,7 @@ if [[ $TRAVIS_OS_NAME == "osx" ]] ; then brew update - brew install qt cmake protobuf + brew install qt cmake protobuf libgcrypt else sudo apt-get update -qq sudo apt-get install -y qtmobility-dev libprotobuf-dev protobuf-compiler libqt4-dev From 4c2a553f03da8f04aafe613c943f7296458086e9 Mon Sep 17 00:00:00 2001 From: Daenyth Date: Sat, 28 Jun 2014 00:36:08 -0400 Subject: [PATCH 62/66] Have servatrice inform players of sideboard size Ref #142 --- cockatrice/src/messagelogwidget.cpp | 12 ++++++++---- cockatrice/src/messagelogwidget.h | 2 +- cockatrice/src/tab_game.cpp | 5 ++++- common/decklist.cpp | 17 ++++++++++++++++- common/decklist.h | 4 +++- common/pb/context_deck_select.proto | 9 +++++---- common/server_player.cpp | 1 + 7 files changed, 38 insertions(+), 12 deletions(-) diff --git a/cockatrice/src/messagelogwidget.cpp b/cockatrice/src/messagelogwidget.cpp index ec9b90cb2..cdf173b2d 100644 --- a/cockatrice/src/messagelogwidget.cpp +++ b/cockatrice/src/messagelogwidget.cpp @@ -86,12 +86,16 @@ void MessageLogWidget::logLeaveSpectator(QString name) appendHtml(tr("%1 is not watching the game any more.").arg(sanitizeHtml(name))); } -void MessageLogWidget::logDeckSelect(Player *player, QString deckHash) +void MessageLogWidget::logDeckSelect(Player *player, QString deckHash, int sideboardSize) { - if (isFemale(player)) - appendHtml(tr("%1 has loaded a deck (%2).", "female").arg(sanitizeHtml(player->getName())).arg(deckHash)); + const char* gender = isFemale(player) ? "female" : "male"; + if (sideboardSize < 0) + appendHtml(tr("%1 has loaded a deck (%2).", gender).arg(sanitizeHtml(player->getName())).arg(deckHash)); else - appendHtml(tr("%1 has loaded a deck (%2).", "male").arg(sanitizeHtml(player->getName())).arg(deckHash)); + appendHtml(tr("%1 has loaded a deck with (%2) sideboard cards (%3).", gender). + arg(sanitizeHtml(player->getName())). + arg(sideboardSize). + arg(deckHash)); } void MessageLogWidget::logReadyStart(Player *player) diff --git a/cockatrice/src/messagelogwidget.h b/cockatrice/src/messagelogwidget.h index 1747a3389..2b12b3c50 100644 --- a/cockatrice/src/messagelogwidget.h +++ b/cockatrice/src/messagelogwidget.h @@ -48,7 +48,7 @@ public slots: void logKicked(); void logJoinSpectator(QString name); void logLeaveSpectator(QString name); - void logDeckSelect(Player *player, QString deckHash); + void logDeckSelect(Player *player, QString deckHash, int sideboardSize); void logReadyStart(Player *player); void logNotReadyStart(Player *player); void logSetSideboardLock(Player *player, bool locked); diff --git a/cockatrice/src/tab_game.cpp b/cockatrice/src/tab_game.cpp index cee000374..b99fff020 100644 --- a/cockatrice/src/tab_game.cpp +++ b/cockatrice/src/tab_game.cpp @@ -1012,7 +1012,10 @@ void TabGame::eventPlayerPropertiesChanged(const Event_PlayerPropertiesChanged & break; } case GameEventContext::DECK_SELECT: { - messageLog->logDeckSelect(player, QString::fromStdString(context.GetExtension(Context_DeckSelect::ext).deck_hash())); + Context_DeckSelect deckSelect = context.GetExtension(Context_DeckSelect::ext); + messageLog->logDeckSelect(player, + QString::fromStdString(deckSelect.deck_hash()), + deckSelect.sideboard_size()); break; } case GameEventContext::SET_SIDEBOARD_LOCK: { diff --git a/common/decklist.cpp b/common/decklist.cpp index c07215562..90b5cb7e6 100644 --- a/common/decklist.cpp +++ b/common/decklist.cpp @@ -633,12 +633,27 @@ QStringList DeckList::getCardList() const return result.toList(); } +int DeckList::getSideboardSize() const +{ + int size = 0; + for (int i = 0; i < root->size(); ++i) { + InnerDecklistNode *node = dynamic_cast(root->at(i)); + if (node->getName() != "side") + continue; + for (int j = 0; j < node->size(); j++) { + DecklistCardNode *card = dynamic_cast(node->at(j)); + size += card->getNumber(); + } + } + return size; +} + DecklistCardNode *DeckList::addCard(const QString &cardName, const QString &zoneName) { InnerDecklistNode *zoneNode = dynamic_cast(root->findChild(zoneName)); if (!zoneNode) zoneNode = new InnerDecklistNode(zoneName, root); - + DecklistCardNode *node = new DecklistCardNode(cardName, 1, zoneNode); updateDeckHash(); return node; diff --git a/common/decklist.h b/common/decklist.h index 94df407a7..2eed52fc6 100644 --- a/common/decklist.h +++ b/common/decklist.h @@ -160,7 +160,9 @@ public: void cleanList(); bool isEmpty() const { return root->isEmpty() && name.isEmpty() && comments.isEmpty() && sideboardPlans.isEmpty(); } QStringList getCardList() const; - + + int getSideboardSize() const; + QString getDeckHash() const { return deckHash; } void updateDeckHash(); diff --git a/common/pb/context_deck_select.proto b/common/pb/context_deck_select.proto index df4a95b56..f36c8b6c2 100644 --- a/common/pb/context_deck_select.proto +++ b/common/pb/context_deck_select.proto @@ -1,8 +1,9 @@ import "game_event_context.proto"; message Context_DeckSelect { - extend GameEventContext { - optional Context_DeckSelect ext = 1002; - } - optional string deck_hash = 1; + extend GameEventContext { + optional Context_DeckSelect ext = 1002; + } + optional string deck_hash = 1; + optional int32 sideboard_size = 2 [default = -1]; } diff --git a/common/server_player.cpp b/common/server_player.cpp index a029abed2..76cd260d0 100644 --- a/common/server_player.cpp +++ b/common/server_player.cpp @@ -657,6 +657,7 @@ Response::ResponseCode Server_Player::cmdDeckSelect(const Command_DeckSelect &cm Context_DeckSelect context; context.set_deck_hash(deck->getDeckHash().toStdString()); + context.set_sideboard_size(deck->getSideboardSize()); ges.setGameEventContext(context); Response_DeckDownload *re = new Response_DeckDownload; From 8d31fe6cbc5d1260cf1ca34df05b70f8666bf75c Mon Sep 17 00:00:00 2001 From: Daenyth Date: Sat, 28 Jun 2014 09:04:45 -0400 Subject: [PATCH 63/66] Clean up deck load chat message --- cockatrice/src/messagelogwidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cockatrice/src/messagelogwidget.cpp b/cockatrice/src/messagelogwidget.cpp index cdf173b2d..d40b10682 100644 --- a/cockatrice/src/messagelogwidget.cpp +++ b/cockatrice/src/messagelogwidget.cpp @@ -92,7 +92,7 @@ void MessageLogWidget::logDeckSelect(Player *player, QString deckHash, int sideb if (sideboardSize < 0) appendHtml(tr("%1 has loaded a deck (%2).", gender).arg(sanitizeHtml(player->getName())).arg(deckHash)); else - appendHtml(tr("%1 has loaded a deck with (%2) sideboard cards (%3).", gender). + appendHtml(tr("%1 has loaded a deck with %2 sideboard cards (%3).", gender). arg(sanitizeHtml(player->getName())). arg(sideboardSize). arg(deckHash)); From ec3690fd292cb7405b523145ee0e22729aeee02e Mon Sep 17 00:00:00 2001 From: Daenyth Date: Sat, 28 Jun 2014 11:04:12 -0400 Subject: [PATCH 64/66] Fix typo in gcc opts --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 96894f172..400eb161d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,7 +59,7 @@ IF(MSVC) ELSEIF (CMAKE_COMPILER_IS_GNUCXX) # linux/gcc, bsd/gcc, windows/mingw set(CMAKE_CXX_FLAGS_RELEASE "-s -O2") - set(CMAKE_CXX_FLAGS_DEBUG "-ggdb -O0 -Wall -Wextra -pedantic -Werror -Wcast-align -Wmissing-declarations -Winline -Wno-long-long -Wno-error=extra -Wno-error=unused-parameter -Wno-inline -Wno-error=delete-non-virtual-dtor -W-noerror=sign-compare -Wno-error=reorder -Wno-error=missing-declarations") + set(CMAKE_CXX_FLAGS_DEBUG "-ggdb -O0 -Wall -Wextra -pedantic -Werror -Wcast-align -Wmissing-declarations -Winline -Wno-long-long -Wno-error=extra -Wno-error=unused-parameter -Wno-inline -Wno-error=delete-non-virtual-dtor -Wno-error=sign-compare -Wno-error=reorder -Wno-error=missing-declarations") ELSE() # other: osx/llvm, bsd/llvm set(CMAKE_CXX_FLAGS_RELEASE "-O2") From 4d6f46b06ec766d5135180abbb468eaa51668398 Mon Sep 17 00:00:00 2001 From: Daenyth Date: Sun, 29 Jun 2014 14:46:06 -0400 Subject: [PATCH 65/66] Change client ping send interval to 9 sec --- cockatrice/src/remoteclient.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cockatrice/src/remoteclient.cpp b/cockatrice/src/remoteclient.cpp index 0eae13abe..e0d3d8604 100644 --- a/cockatrice/src/remoteclient.cpp +++ b/cockatrice/src/remoteclient.cpp @@ -15,7 +15,7 @@ RemoteClient::RemoteClient(QObject *parent) : AbstractClient(parent), timeRunning(0), lastDataReceived(0), messageInProgress(false), handshakeStarted(false), messageLength(0) { timer = new QTimer(this); - timer->setInterval(1000); + timer->setInterval(9000); connect(timer, SIGNAL(timeout()), this, SLOT(ping())); socket = new QTcpSocket(this); @@ -23,7 +23,7 @@ RemoteClient::RemoteClient(QObject *parent) connect(socket, SIGNAL(connected()), this, SLOT(slotConnected())); connect(socket, SIGNAL(readyRead()), this, SLOT(readData())); connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(slotSocketError(QAbstractSocket::SocketError))); - + connect(this, SIGNAL(serverIdentificationEventReceived(const Event_ServerIdentification &)), this, SLOT(processServerIdentificationEvent(const Event_ServerIdentification &))); connect(this, SIGNAL(connectionClosedEventReceived(Event_ConnectionClosed)), this, SLOT(processConnectionClosedEvent(Event_ConnectionClosed))); connect(this, SIGNAL(sigConnectToServer(QString, unsigned int, QString, QString)), this, SLOT(doConnectToServer(QString, unsigned int, QString, QString))); @@ -47,12 +47,12 @@ void RemoteClient::slotConnected() { timeRunning = lastDataReceived = 0; timer->start(); - + // dirty hack to be compatible with v14 server sendCommandContainer(CommandContainer()); getNewCmdId(); // end of hack - + setStatus(StatusAwaitingWelcome); } @@ -208,7 +208,7 @@ void RemoteClient::ping() pend->deleteLater(); } } - + int maxTime = timeRunning - lastDataReceived; emit maxPingTime(maxTime, maxTimeout); if (maxTime >= maxTimeout) { From f730dca14c84d9f764f66c825418d973058c1f7a Mon Sep 17 00:00:00 2001 From: arxanas Date: Tue, 1 Jul 2014 02:29:25 -0400 Subject: [PATCH 66/66] Fix #155: Vanguard card names no longer conflict with regular card names. --- oracle/src/oracleimporter.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/oracle/src/oracleimporter.cpp b/oracle/src/oracleimporter.cpp index 70972d92d..241924e3b 100644 --- a/oracle/src/oracleimporter.cpp +++ b/oracle/src/oracleimporter.cpp @@ -197,6 +197,11 @@ int OracleImporter::importTextSpoiler(CardSet *set, const QVariant &data) cardText = map.contains("text") ? map.value("text").toString() : QString(""); cardId = map.contains("multiverseid") ? map.value("multiverseid").toInt() : 0; cardLoyalty = map.contains("loyalty") ? map.value("loyalty").toInt() : 0; + + // Distinguish Vanguard cards from regular cards of the same name. + if (map.value("layout") == "vanguard") { + cardName += " Avatar"; + } } CardInfo *card = addCard(set->getShortName(), cardName, false, cardId, cardCost, cardType, cardPT, cardLoyalty, cardText.split("\n"));