From e33debcbff9468dd468aca0fb42b3e7c01040e06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=20Morschh=C3=A4user?= Date: Tue, 11 Mar 2014 15:02:15 +0100 Subject: [PATCH 01/16] Changed C to Qt file handling. VC warns because fopen may be unsafe. --- cockatrice/src/main.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/cockatrice/src/main.cpp b/cockatrice/src/main.cpp index 595a6534..4821cbf2 100644 --- a/cockatrice/src/main.cpp +++ b/cockatrice/src/main.cpp @@ -19,6 +19,8 @@ ***************************************************************************/ #include +#include +#include #include #include #include @@ -28,7 +30,6 @@ #include #include #include -#include #include "main.h" #include "window_main.h" @@ -56,11 +57,11 @@ QString translationPath = QString(); void myMessageOutput(QtMsgType /*type*/, const char *msg) { - static FILE *f = NULL; - if (!f) - f = fopen("qdebug.txt", "w"); - fprintf(f, "%s\n", msg); - fflush(f); + QFile file("qdebug.txt"); + file.open(QIODevice::WriteOnly | QIODevice::Text); + QTextStream out(&file); + out << msg << "\n"; + file.close(); } void installNewTranslator() From 49227ad44c1821687312a3587ec636e19dd1dc6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=20Morschh=C3=A4user?= Date: Tue, 11 Mar 2014 15:04:26 +0100 Subject: [PATCH 02/16] Fixed VC "'*/' found outside of comment" warning. --- cockatrice/src/abstractcarditem.cpp | 2 +- cockatrice/src/cardzone.cpp | 2 +- cockatrice/src/counter_general.cpp | 2 +- cockatrice/src/handzone.cpp | 2 +- cockatrice/src/phasestoolbar.cpp | 2 +- cockatrice/src/pilezone.cpp | 2 +- cockatrice/src/player.cpp | 4 ++-- cockatrice/src/stackzone.cpp | 2 +- cockatrice/src/tablezone.cpp | 2 +- cockatrice/src/zoneviewzone.cpp | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/cockatrice/src/abstractcarditem.cpp b/cockatrice/src/abstractcarditem.cpp index 7b624572..7ddb903e 100644 --- a/cockatrice/src/abstractcarditem.cpp +++ b/cockatrice/src/abstractcarditem.cpp @@ -143,7 +143,7 @@ void AbstractCardItem::paintPicture(QPainter *painter, const QSizeF &translatedS painter->restore(); } -void AbstractCardItem::paint(QPainter *painter, const QStyleOptionGraphicsItem */*option*/, QWidget */*widget*/) +void AbstractCardItem::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/) { painter->save(); diff --git a/cockatrice/src/cardzone.cpp b/cockatrice/src/cardzone.cpp index f09cac1f..dc26263b 100644 --- a/cockatrice/src/cardzone.cpp +++ b/cockatrice/src/cardzone.cpp @@ -148,7 +148,7 @@ QString CardZone::getTranslatedName(bool hisOwn, GrammaticalCase gc) const return QString(); } -void CardZone::mouseDoubleClickEvent(QGraphicsSceneMouseEvent */*event*/) +void CardZone::mouseDoubleClickEvent(QGraphicsSceneMouseEvent * /*event*/) { if (doubleClickAction) doubleClickAction->trigger(); diff --git a/cockatrice/src/counter_general.cpp b/cockatrice/src/counter_general.cpp index edc44519..e282f1bd 100644 --- a/cockatrice/src/counter_general.cpp +++ b/cockatrice/src/counter_general.cpp @@ -13,7 +13,7 @@ QRectF GeneralCounter::boundingRect() const return QRectF(0, 0, radius * 2, radius * 2); } -void GeneralCounter::paint(QPainter *painter, const QStyleOptionGraphicsItem */*option*/, QWidget */*widget*/) +void GeneralCounter::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/) { QRectF mapRect = painter->combinedTransform().mapRect(boundingRect()); int translatedHeight = mapRect.size().height(); diff --git a/cockatrice/src/handzone.cpp b/cockatrice/src/handzone.cpp index 1799b65f..cd9ba959 100644 --- a/cockatrice/src/handzone.cpp +++ b/cockatrice/src/handzone.cpp @@ -75,7 +75,7 @@ QRectF HandZone::boundingRect() const return QRectF(0, 0, 100, zoneHeight); } -void HandZone::paint(QPainter *painter, const QStyleOptionGraphicsItem */*option*/, QWidget */*widget*/) +void HandZone::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/) { if (bgPixmap.isNull()) painter->fillRect(boundingRect(), Qt::darkGreen); diff --git a/cockatrice/src/phasestoolbar.cpp b/cockatrice/src/phasestoolbar.cpp index 98f27404..af5d2116 100644 --- a/cockatrice/src/phasestoolbar.cpp +++ b/cockatrice/src/phasestoolbar.cpp @@ -85,7 +85,7 @@ void PhaseButton::mousePressEvent(QGraphicsSceneMouseEvent * /*event*/) emit clicked(); } -void PhaseButton::mouseDoubleClickEvent(QGraphicsSceneMouseEvent */*event*/) +void PhaseButton::mouseDoubleClickEvent(QGraphicsSceneMouseEvent * /*event*/) { triggerDoubleClickAction(); } diff --git a/cockatrice/src/pilezone.cpp b/cockatrice/src/pilezone.cpp index d34d4c06..0dbdd566 100644 --- a/cockatrice/src/pilezone.cpp +++ b/cockatrice/src/pilezone.cpp @@ -105,7 +105,7 @@ void PileZone::mouseMoveEvent(QGraphicsSceneMouseEvent *event) setCursor(Qt::OpenHandCursor); } -void PileZone::mouseReleaseEvent(QGraphicsSceneMouseEvent */*event*/) +void PileZone::mouseReleaseEvent(QGraphicsSceneMouseEvent * /*event*/) { setCursor(Qt::OpenHandCursor); } diff --git a/cockatrice/src/player.cpp b/cockatrice/src/player.cpp index 35d5bea9..762b4387 100644 --- a/cockatrice/src/player.cpp +++ b/cockatrice/src/player.cpp @@ -85,7 +85,7 @@ void PlayerArea::updateBgPixmap() update(); } -void PlayerArea::paint(QPainter *painter, const QStyleOptionGraphicsItem */*option*/, QWidget */*widget*/) +void PlayerArea::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/) { painter->fillRect(bRect, bgPixmapBrush); } @@ -1430,7 +1430,7 @@ QRectF Player::boundingRect() const return bRect; } -void Player::paint(QPainter * /*painter*/, const QStyleOptionGraphicsItem */*option*/, QWidget */*widget*/) +void Player::paint(QPainter * /*painter*/, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/) { } diff --git a/cockatrice/src/stackzone.cpp b/cockatrice/src/stackzone.cpp index f3e4767c..a60c4037 100644 --- a/cockatrice/src/stackzone.cpp +++ b/cockatrice/src/stackzone.cpp @@ -46,7 +46,7 @@ QRectF StackZone::boundingRect() const return QRectF(0, 0, 100, zoneHeight); } -void StackZone::paint(QPainter *painter, const QStyleOptionGraphicsItem */*option*/, QWidget */*widget*/) +void StackZone::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/) { if (bgPixmap.isNull()) painter->fillRect(boundingRect(), QColor(113, 43, 43)); diff --git a/cockatrice/src/tablezone.cpp b/cockatrice/src/tablezone.cpp index 49965929..d40ba714 100644 --- a/cockatrice/src/tablezone.cpp +++ b/cockatrice/src/tablezone.cpp @@ -46,7 +46,7 @@ bool TableZone::isInverted() const return ((player->getMirrored() && !settingsCache->getInvertVerticalCoordinate()) || (!player->getMirrored() && settingsCache->getInvertVerticalCoordinate())); } -void TableZone::paint(QPainter *painter, const QStyleOptionGraphicsItem */*option*/, QWidget */*widget*/) +void TableZone::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/) { if (bgPixmap.isNull()) painter->fillRect(boundingRect(), QColor(0, 0, 100)); diff --git a/cockatrice/src/zoneviewzone.cpp b/cockatrice/src/zoneviewzone.cpp index c42dfd0e..e3b34235 100644 --- a/cockatrice/src/zoneviewzone.cpp +++ b/cockatrice/src/zoneviewzone.cpp @@ -31,7 +31,7 @@ QRectF ZoneViewZone::boundingRect() const return bRect; } -void ZoneViewZone::paint(QPainter */*painter*/, const QStyleOptionGraphicsItem */*option*/, QWidget */*widget*/) +void ZoneViewZone::paint(QPainter * /*painter*/, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/) { } From 6e9f81461a602bdfc1e201e43ee9b183313887f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=20Morschh=C3=A4user?= Date: Tue, 11 Mar 2014 15:19:29 +0100 Subject: [PATCH 03/16] Fixed VC++ 'M_PI' : undeclared identifier error. --- cockatrice/src/arrowitem.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cockatrice/src/arrowitem.cpp b/cockatrice/src/arrowitem.cpp index a27b451a..16cac4d1 100644 --- a/cockatrice/src/arrowitem.cpp +++ b/cockatrice/src/arrowitem.cpp @@ -1,9 +1,11 @@ +#define _USE_MATH_DEFINES +#include + #include "arrowitem.h" #include "playertarget.h" #include "carditem.h" #include "cardzone.h" #include "player.h" -#include "math.h" #include #include #include From 80da61dcbb3ea1fc437366cdaca235f83cd05df4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=20Morschh=C3=A4user?= Date: Tue, 11 Mar 2014 16:10:55 +0100 Subject: [PATCH 04/16] Fix MSVC++ compile error caused by missing round() in math.h --- cockatrice/CMakeLists.txt | 1 + cockatrice/src/abstractcarditem.cpp | 5 ++++- cockatrice/src/phasestoolbar.cpp | 5 ++++- cockatrice/src/pixmapgenerator.cpp | 5 ++++- cockatrice/src/playertarget.cpp | 5 ++++- cockatrice/src/replay_timeline_widget.cpp | 5 ++++- cockatrice/src/round.h | 12 ++++++++++++ cockatrice/src/tablezone.cpp | 5 ++++- 8 files changed, 37 insertions(+), 6 deletions(-) create mode 100644 cockatrice/src/round.h diff --git a/cockatrice/CMakeLists.txt b/cockatrice/CMakeLists.txt index 70de75a5..f7ad1910 100644 --- a/cockatrice/CMakeLists.txt +++ b/cockatrice/CMakeLists.txt @@ -82,6 +82,7 @@ SET(cockatrice_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/version_string.cpp ) SET(cockatrice_HEADERS + src/round.h src/abstractcounter.h src/counter_general.h src/dlg_creategame.h diff --git a/cockatrice/src/abstractcarditem.cpp b/cockatrice/src/abstractcarditem.cpp index 7ddb903e..018cc5e0 100644 --- a/cockatrice/src/abstractcarditem.cpp +++ b/cockatrice/src/abstractcarditem.cpp @@ -2,7 +2,10 @@ #include #include #include -#include +#include +#ifdef _WIN32 +#include "round.h" +#endif /* _WIN32 */ #include "carddatabase.h" #include "cardinfowidget.h" #include "abstractcarditem.h" diff --git a/cockatrice/src/phasestoolbar.cpp b/cockatrice/src/phasestoolbar.cpp index af5d2116..b34872f6 100644 --- a/cockatrice/src/phasestoolbar.cpp +++ b/cockatrice/src/phasestoolbar.cpp @@ -3,7 +3,10 @@ #include #include #include -#include +#include +#ifdef _WIN32 +#include "round.h" +#endif /* _WIN32 */ #include "phasestoolbar.h" #include "pixmapgenerator.h" diff --git a/cockatrice/src/pixmapgenerator.cpp b/cockatrice/src/pixmapgenerator.cpp index 7ff7ca98..8bae4853 100644 --- a/cockatrice/src/pixmapgenerator.cpp +++ b/cockatrice/src/pixmapgenerator.cpp @@ -2,7 +2,10 @@ #include "pb/serverinfo_user.pb.h" #include #include -#include +#include +#ifdef _WIN32 +#include "round.h" +#endif /* _WIN32 */ #include QMap PhasePixmapGenerator::pmCache; diff --git a/cockatrice/src/playertarget.cpp b/cockatrice/src/playertarget.cpp index eb18a332..d27f5aa2 100644 --- a/cockatrice/src/playertarget.cpp +++ b/cockatrice/src/playertarget.cpp @@ -5,7 +5,10 @@ #include #include #include -#include +#include +#ifdef _WIN32 +#include "round.h" +#endif /* _WIN32 */ PlayerCounter::PlayerCounter(Player *_player, int _id, const QString &_name, int _value, QGraphicsItem *parent) : AbstractCounter(_player, _id, _name, false, _value, parent) diff --git a/cockatrice/src/replay_timeline_widget.cpp b/cockatrice/src/replay_timeline_widget.cpp index 7934fb0e..6127489f 100644 --- a/cockatrice/src/replay_timeline_widget.cpp +++ b/cockatrice/src/replay_timeline_widget.cpp @@ -2,7 +2,10 @@ #include #include #include -#include +#include +#ifdef _WIN32 +#include "round.h" +#endif /* _WIN32 */ ReplayTimelineWidget::ReplayTimelineWidget(QWidget *parent) : QWidget(parent), maxBinValue(1), maxTime(1), timeScaleFactor(1.0), currentTime(0), currentEvent(0) diff --git a/cockatrice/src/round.h b/cockatrice/src/round.h new file mode 100644 index 00000000..225da636 --- /dev/null +++ b/cockatrice/src/round.h @@ -0,0 +1,12 @@ +#ifndef MSVC_ROUND_FIX +#define MSVC_ROUND_FIX +/** + * This helper function exists only because MS VC++ 2010 does not support round() in + * . round() works with g++ and clang++ but is formally a C++11 extension. + * So this file exists for MS VC++ only. + */ +inline double round(double val) { + return floor(val + 0.5); +} + +#endif /* MSVC_ROUND_FIX */ diff --git a/cockatrice/src/tablezone.cpp b/cockatrice/src/tablezone.cpp index d40ba714..d7fa4218 100644 --- a/cockatrice/src/tablezone.cpp +++ b/cockatrice/src/tablezone.cpp @@ -1,7 +1,10 @@ #include #include #include -#include +#include +#ifdef _WIN32 +#include "round.h" +#endif /* _WIN32 */ #include "tablezone.h" #include "player.h" #include "settingscache.h" From 32ad8ed24cd78cae48355642a6f48954f8292665 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=20Morschh=C3=A4user?= Date: Tue, 11 Mar 2014 16:57:54 +0100 Subject: [PATCH 05/16] Fixed MSVC++ compile error due to sqrt() usage. --- cockatrice/src/arrowitem.cpp | 2 +- cockatrice/src/playertarget.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cockatrice/src/arrowitem.cpp b/cockatrice/src/arrowitem.cpp index 16cac4d1..969be2b4 100644 --- a/cockatrice/src/arrowitem.cpp +++ b/cockatrice/src/arrowitem.cpp @@ -66,7 +66,7 @@ void ArrowItem::updatePath(const QPointF &endPoint) { const double arrowWidth = 15.0; const double headWidth = 40.0; - const double headLength = headWidth / sqrt(2); + const double headLength = headWidth / pow(2, 0.5); // aka headWidth / sqrt (2) but this produces a compile error with MSVC++ const double phi = 15; if (!startItem) diff --git a/cockatrice/src/playertarget.cpp b/cockatrice/src/playertarget.cpp index d27f5aa2..98b266df 100644 --- a/cockatrice/src/playertarget.cpp +++ b/cockatrice/src/playertarget.cpp @@ -90,7 +90,8 @@ void PlayerTarget::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*o cachedPixmap = QPixmap(translatedSize.width(), translatedSize.height()); QPainter tempPainter(&cachedPixmap); - QRadialGradient grad(translatedRect.center(), sqrt(translatedSize.width() * translatedSize.width() + translatedSize.height() * translatedSize.height()) / 2); + // pow(foo, 0.5) equals to sqrt(foo), but using sqrt(foo) in this context will produce a compile error with MSVC++ + QRadialGradient grad(translatedRect.center(), pow(translatedSize.width() * translatedSize.width() + translatedSize.height() * translatedSize.height(), 0.5) / 2); grad.setColorAt(1, Qt::black); grad.setColorAt(0, QColor(180, 180, 180)); tempPainter.fillRect(QRectF(0, 0, translatedSize.width(), translatedSize.height()), grad); From a7c957dfca197b163d94b3900fc0348b86cef1e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=20Morschh=C3=A4user?= Date: Tue, 11 Mar 2014 17:15:51 +0100 Subject: [PATCH 06/16] Fixed CMake files for MSVC++ linker. --- cockatrice/CMakeLists.txt | 9 ++++++++- oracle/CMakeLists.txt | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/cockatrice/CMakeLists.txt b/cockatrice/CMakeLists.txt index f7ad1910..81324700 100644 --- a/cockatrice/CMakeLists.txt +++ b/cockatrice/CMakeLists.txt @@ -221,7 +221,14 @@ INCLUDE_DIRECTORIES(${QT_MOBILITY_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${QT_MOBILITY_MULTIMEDIAKIT_INCLUDE_DIR}) ADD_EXECUTABLE(cockatrice WIN32 MACOSX_BUNDLE ${cockatrice_SOURCES} ${cockatrice_QM} ${cockatrice_RESOURCES_RCC} ${cockatrice_HEADERS_MOC}) -TARGET_LINK_LIBRARIES(cockatrice cockatrice_common ${QT_LIBRARIES} ${QT_MOBILITY_MULTIMEDIAKIT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT}) +TARGET_LINK_LIBRARIES(cockatrice cockatrice_common ${QT_QTMAIN_LIBRARY} ${QT_LIBRARIES} ${QT_MOBILITY_MULTIMEDIAKIT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT}) + +# This check is needed to link cockatrice with MSVC++ +if(WIN32) + if(MSVC) + set_target_properties(cockatrice PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS") + endif() +endif() IF (NOT APPLE) INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/cockatrice DESTINATION bin) diff --git a/oracle/CMakeLists.txt b/oracle/CMakeLists.txt index 41338903..139dacfc 100644 --- a/oracle/CMakeLists.txt +++ b/oracle/CMakeLists.txt @@ -20,7 +20,14 @@ INCLUDE(${QT_USE_FILE}) INCLUDE_DIRECTORIES(../cockatrice/src) ADD_EXECUTABLE(oracle WIN32 MACOSX_BUNDLE ${oracle_SOURCES} ${oracle_HEADERS_MOC}) -TARGET_LINK_LIBRARIES(oracle ${QT_LIBRARIES}) +TARGET_LINK_LIBRARIES(oracle ${QT_QTMAIN_LIBRARY} ${QT_LIBRARIES}) + +# This check is needed to link oracle with MSVC++ +if(WIN32) + if(MSVC) + set_target_properties(oracle PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS") + endif() +endif() IF (NOT APPLE) INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/oracle DESTINATION bin) From a52d77459345680ac532271ffc27e4db4f9ce462 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=20Morschh=C3=A4user?= Date: Tue, 11 Mar 2014 17:41:17 +0100 Subject: [PATCH 07/16] Updated NSIS installer. --- nsis/cockatrice.nsi | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/nsis/cockatrice.nsi b/nsis/cockatrice.nsi index 396b0fc9..2cf3a980 100644 --- a/nsis/cockatrice.nsi +++ b/nsis/cockatrice.nsi @@ -35,34 +35,31 @@ InstallDir "$PROGRAMFILES\Cockatrice" Section "Application" SecApplication SetOutPath "$INSTDIR" - File ..\build\cockatrice\cockatrice.exe - File ..\build\oracle\oracle.exe + File ..\build\cockatrice\Release\cockatrice.exe + File ..\build\oracle\Release\oracle.exe File ..\doc\usermanual\Usermanual.pdf - File C:\MinGW\bin\libstdc++-6.dll - File C:\MinGW\bin\libgcc_s_dw2-1.dll - File C:\MinGW\bin\mingwm10.dll - File C:\MinGW\bin\libprotobuf-8.dll - File C:\Qt\4.8.4\bin\QtCore4.dll - File C:\Qt\4.8.4\bin\QtGui4.dll - File C:\Qt\4.8.4\bin\QtNetwork4.dll - File C:\Qt\4.8.4\bin\QtSvg4.dll - File C:\Qt\4.8.4\bin\QtXml4.dll - File C:\Qt\4.8.4\bin\QtMultimedia4.dll + File ..\build\protobuf-2.5.0\protobuf-2.5.0\vsprojects\Release\libprotobuf.lib + File C:\Qt\4.8.5\bin\QtCore4.dll + File C:\Qt\4.8.5\bin\QtGui4.dll + File C:\Qt\4.8.5\bin\QtNetwork4.dll + File C:\Qt\4.8.5\bin\QtSvg4.dll + File C:\Qt\4.8.5\bin\QtXml4.dll + File C:\Qt\4.8.5\bin\QtMultimedia4.dll SetOutPath "$INSTDIR\zonebg" File /r ..\zonebg\*.* SetOutPath "$INSTDIR\plugins" SetOutPath "$INSTDIR\plugins\codecs" - File C:\Qt\4.8.4\plugins\codecs\qcncodecs4.dll - File C:\Qt\4.8.4\plugins\codecs\qjpcodecs4.dll - File C:\Qt\4.8.4\plugins\codecs\qkrcodecs4.dll - File C:\Qt\4.8.4\plugins\codecs\qtwcodecs4.dll + File C:\Qt\4.8.5\plugins\codecs\qcncodecs4.dll + File C:\Qt\4.8.5\plugins\codecs\qjpcodecs4.dll + File C:\Qt\4.8.5\plugins\codecs\qkrcodecs4.dll + File C:\Qt\4.8.5\plugins\codecs\qtwcodecs4.dll SetOutPath "$INSTDIR\plugins\iconengines" - File C:\Qt\4.8.4\plugins\iconengines\qsvgicon4.dll + File C:\Qt\4.8.5\plugins\iconengines\qsvgicon4.dll SetOutPath "$INSTDIR\plugins\imageformats" - File C:\Qt\4.8.4\plugins\imageformats\qjpeg4.dll - File C:\Qt\4.8.4\plugins\imageformats\qsvg4.dll + File C:\Qt\4.8.5\plugins\imageformats\qjpeg4.dll + File C:\Qt\4.8.5\plugins\imageformats\qsvg4.dll SetOutPath "$INSTDIR\sounds" File /r ..\sounds\*.* From eebdc1b50edf506ca1a9238f57db0f8c95b1a9b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=20Morschh=C3=A4user?= Date: Tue, 11 Mar 2014 17:47:40 +0100 Subject: [PATCH 08/16] Updated NSIS uninstall section. --- nsis/cockatrice.nsi | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/nsis/cockatrice.nsi b/nsis/cockatrice.nsi index 2cf3a980..f3fec373 100644 --- a/nsis/cockatrice.nsi +++ b/nsis/cockatrice.nsi @@ -100,11 +100,8 @@ Section Uninstall Delete "$INSTDIR\uninstall.exe" Delete "$INSTDIR\cockatrice.exe" Delete "$INSTDIR\oracle.exe" - Delete "$INSTDIR\Usermanual.pdf" - Delete "$INSTDIR\libstdc++-6.dll" - Delete "$INSTDIR\libprotobuf-8.dll" - Delete "$INSTDIR\libgcc_s_dw2-1.dll" - Delete "$INSTDIR\mingwm10.dll" + Delete "$INSTDIR\Usermanual.pdf" + Delete "$INSTDIR\libprotobuf.lib" Delete "$INSTDIR\QtCore4.dll" Delete "$INSTDIR\QtGui4.dll" Delete "$INSTDIR\QtNetwork4.dll" From 7c606af63ef80f73e411beaa172f2dd267485f99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=20Morschh=C3=A4user?= Date: Wed, 12 Mar 2014 09:11:01 +0100 Subject: [PATCH 09/16] Fixed warning regarding virtual function overrides. Using C++ standard. See http://msdn.microsoft.com/en-us/library/bb384874(v=vs.90).aspx --- cockatrice/src/decklistmodel.h | 2 +- common/decklist.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cockatrice/src/decklistmodel.h b/cockatrice/src/decklistmodel.h index 2e2c570a..e03a9ff2 100644 --- a/cockatrice/src/decklistmodel.h +++ b/cockatrice/src/decklistmodel.h @@ -19,7 +19,7 @@ public: int getNumber() const { return dataNode->getNumber(); } void setNumber(int _number) { dataNode->setNumber(_number); } float getPrice() const { return dataNode->getPrice(); } - void setPrice(float _price) { dataNode->setPrice(_price); } + void setPrice(const float _price) { dataNode->setPrice(_price); } QString getName() const { return dataNode->getName(); } void setName(const QString &_name) { dataNode->setName(_name); } DecklistCardNode *getDataNode() const { return dataNode; } diff --git a/common/decklist.h b/common/decklist.h index c5535c2d..2e8f4a9b 100644 --- a/common/decklist.h +++ b/common/decklist.h @@ -83,7 +83,7 @@ public: virtual QString getName() const = 0; virtual void setName(const QString &_name) = 0; virtual float getPrice() const = 0; - virtual void setPrice(float _price) = 0; + virtual void setPrice(const float _price) = 0; float getTotalPrice() const { return getNumber() * getPrice(); } int height() const { return 0; } bool compare(AbstractDecklistNode *other) const; From e2615a0ff0d136153cb85f3d6a1f5d23447e17ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=20Morschh=C3=A4user?= Date: Wed, 12 Mar 2014 09:34:25 +0100 Subject: [PATCH 10/16] Fixed warning C4018 <,> signed/unsigned mismatch --- cockatrice/src/gamesmodel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cockatrice/src/gamesmodel.cpp b/cockatrice/src/gamesmodel.cpp index 0ee41f35..9dd7185d 100644 --- a/cockatrice/src/gamesmodel.cpp +++ b/cockatrice/src/gamesmodel.cpp @@ -180,9 +180,9 @@ bool GamesProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &/*sourc if (!gameTypeFilter.isEmpty() && gameTypes.intersect(gameTypeFilter).isEmpty()) return false; - if ((maxPlayersFilterMin != -1) && (game.max_players() < maxPlayersFilterMin)) + if ((maxPlayersFilterMin != -1) && ((int)game.max_players() < maxPlayersFilterMin)) return false; - if ((maxPlayersFilterMax != -1) && (game.max_players() > maxPlayersFilterMax)) + if ((maxPlayersFilterMax != -1) && ((int)game.max_players() > maxPlayersFilterMax)) return false; return true; From da59b51c5ebbe8c0aa678a36a71511e9a7cd9815 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=20Morschh=C3=A4user?= Date: Wed, 12 Mar 2014 10:04:31 +0100 Subject: [PATCH 11/16] Fixed deletion of startmenu folder on uninstall + code indent --- nsis/cockatrice.nsi | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/nsis/cockatrice.nsi b/nsis/cockatrice.nsi index f3fec373..c7398b74 100644 --- a/nsis/cockatrice.nsi +++ b/nsis/cockatrice.nsi @@ -34,6 +34,7 @@ InstallDir "$PROGRAMFILES\Cockatrice" !insertmacro MUI_LANGUAGE "English" Section "Application" SecApplication + SetShellVarContext all SetOutPath "$INSTDIR" File ..\build\cockatrice\Release\cockatrice.exe File ..\build\oracle\Release\oracle.exe @@ -67,9 +68,9 @@ Section "Application" SecApplication SetOutPath "$INSTDIR\translations" File /r ..\build\cockatrice\*.qm - WriteUninstaller "$INSTDIR\uninstall.exe" - ${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2 - IntFmt $0 "0x%08X" $0 + WriteUninstaller "$INSTDIR\uninstall.exe" + ${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2 + IntFmt $0 "0x%08X" $0 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "DisplayName" "Cockatrice" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "UninstallString" "$\"$INSTDIR\uninstall.exe$\"" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S" @@ -93,35 +94,36 @@ Section "Start menu item" SecStartMenu SectionEnd Section Uninstall - RMDir /r "$INSTDIR\zonebg" - RMDir /r "$INSTDIR\plugins" - RMDir /r "$INSTDIR\sounds" +SetShellVarContext all + RMDir /r "$INSTDIR\zonebg" + RMDir /r "$INSTDIR\plugins" + RMDir /r "$INSTDIR\sounds" RMDir /r "$INSTDIR\translations" - Delete "$INSTDIR\uninstall.exe" - Delete "$INSTDIR\cockatrice.exe" - Delete "$INSTDIR\oracle.exe" + Delete "$INSTDIR\uninstall.exe" + Delete "$INSTDIR\cockatrice.exe" + Delete "$INSTDIR\oracle.exe" Delete "$INSTDIR\Usermanual.pdf" Delete "$INSTDIR\libprotobuf.lib" - Delete "$INSTDIR\QtCore4.dll" - Delete "$INSTDIR\QtGui4.dll" - Delete "$INSTDIR\QtNetwork4.dll" - Delete "$INSTDIR\QtSvg4.dll" - Delete "$INSTDIR\QtXml4.dll" + Delete "$INSTDIR\QtCore4.dll" + Delete "$INSTDIR\QtGui4.dll" + Delete "$INSTDIR\QtNetwork4.dll" + Delete "$INSTDIR\QtSvg4.dll" + Delete "$INSTDIR\QtXml4.dll" Delete "$INSTDIR\QtMultimedia4.dll" - RMDir "$INSTDIR" + RMDir "$INSTDIR" RMDir /r "$SMPROGRAMS\Cockatrice" - - DeleteRegKey HKCU "Software\Cockatrice" - DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" + + DeleteRegKey HKCU "Software\Cockatrice" + DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" SectionEnd LangString DESC_SecApplication ${LANG_ENGLISH} "Cockatrice program files" LangString DESC_SecUpdateConfig ${LANG_ENGLISH} "Update the paths in the application settings according to the installation paths." LangString DESC_SecStartMenu ${LANG_ENGLISH} "Create start menu items for Cockatrice and Oracle." !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN - !insertmacro MUI_DESCRIPTION_TEXT ${SecApplication} $(DESC_SecApplication) - !insertmacro MUI_DESCRIPTION_TEXT ${SecUpdateConfig} $(DESC_SecUpdateConfig) - !insertmacro MUI_DESCRIPTION_TEXT ${SecStartMenu} $(DESC_SecStartMenu) + !insertmacro MUI_DESCRIPTION_TEXT ${SecApplication} $(DESC_SecApplication) + !insertmacro MUI_DESCRIPTION_TEXT ${SecUpdateConfig} $(DESC_SecUpdateConfig) + !insertmacro MUI_DESCRIPTION_TEXT ${SecStartMenu} $(DESC_SecStartMenu) !insertmacro MUI_FUNCTION_DESCRIPTION_END From d968f04b02374c9c940e1f9bd4b60b03ce8c06d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=20Morschh=C3=A4user?= Date: Tue, 18 Mar 2014 12:10:46 +0100 Subject: [PATCH 12/16] Improved file handling from commit e33debcb. --- cockatrice/src/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cockatrice/src/main.cpp b/cockatrice/src/main.cpp index 4821cbf2..ef57655a 100644 --- a/cockatrice/src/main.cpp +++ b/cockatrice/src/main.cpp @@ -58,9 +58,9 @@ QString translationPath = QString(); void myMessageOutput(QtMsgType /*type*/, const char *msg) { QFile file("qdebug.txt"); - file.open(QIODevice::WriteOnly | QIODevice::Text); + file.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text); QTextStream out(&file); - out << msg << "\n"; + out << msg << endl; file.close(); } From 0c65fdf3dd64b50ddc1af062960b13e28a6fe53b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=20Morschh=C3=A4user?= Date: Sun, 11 May 2014 14:09:54 +0200 Subject: [PATCH 13/16] Defined a common prefix for the Qt directory --- nsis/cockatrice.nsi | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/nsis/cockatrice.nsi b/nsis/cockatrice.nsi index c7398b74..33cc496b 100644 --- a/nsis/cockatrice.nsi +++ b/nsis/cockatrice.nsi @@ -9,6 +9,9 @@ OutFile "cockatrice_win32_${TIMESTAMP}_git-${VERSION}.exe" SetCompressor /SOLID lzma InstallDir "$PROGRAMFILES\Cockatrice" +; set the Qt install dir here (and make sure you use the latest 4.8 version for packaging) +!define QTDIR "C:\Qt\4.8.6" + !define MUI_ABORTWARNING !define MUI_WELCOMEFINISHPAGE_BITMAP "leftimage.bmp" !define MUI_UNWELCOMEFINISHPAGE_BITMAP "leftimage.bmp" @@ -40,27 +43,27 @@ Section "Application" SecApplication File ..\build\oracle\Release\oracle.exe File ..\doc\usermanual\Usermanual.pdf File ..\build\protobuf-2.5.0\protobuf-2.5.0\vsprojects\Release\libprotobuf.lib - File C:\Qt\4.8.5\bin\QtCore4.dll - File C:\Qt\4.8.5\bin\QtGui4.dll - File C:\Qt\4.8.5\bin\QtNetwork4.dll - File C:\Qt\4.8.5\bin\QtSvg4.dll - File C:\Qt\4.8.5\bin\QtXml4.dll - File C:\Qt\4.8.5\bin\QtMultimedia4.dll + File "${QTDIR}\bin\QtCore4.dll" + File "${QTDIR}\bin\QtGui4.dll" + File "${QTDIR}\bin\QtNetwork4.dll" + File "${QTDIR}\bin\QtSvg4.dll" + File "${QTDIR}\bin\QtXml4.dll" + File "${QTDIR}\bin\QtMultimedia4.dll" SetOutPath "$INSTDIR\zonebg" File /r ..\zonebg\*.* SetOutPath "$INSTDIR\plugins" SetOutPath "$INSTDIR\plugins\codecs" - File C:\Qt\4.8.5\plugins\codecs\qcncodecs4.dll - File C:\Qt\4.8.5\plugins\codecs\qjpcodecs4.dll - File C:\Qt\4.8.5\plugins\codecs\qkrcodecs4.dll - File C:\Qt\4.8.5\plugins\codecs\qtwcodecs4.dll + File "${QTDIR}\plugins\codecs\qcncodecs4.dll" + File "${QTDIR}\plugins\codecs\qjpcodecs4.dll" + File "${QTDIR}\plugins\codecs\qkrcodecs4.dll" + File "${QTDIR}\plugins\codecs\qtwcodecs4.dll" SetOutPath "$INSTDIR\plugins\iconengines" - File C:\Qt\4.8.5\plugins\iconengines\qsvgicon4.dll + File "${QTDIR}\plugins\iconengines\qsvgicon4.dll" SetOutPath "$INSTDIR\plugins\imageformats" - File C:\Qt\4.8.5\plugins\imageformats\qjpeg4.dll - File C:\Qt\4.8.5\plugins\imageformats\qsvg4.dll + File "${QTDIR}\plugins\imageformats\qjpeg4.dll" + File "${QTDIR}\plugins\imageformats\qsvg4.dll" SetOutPath "$INSTDIR\sounds" File /r ..\sounds\*.* From 929bcb55daa00a51ae73254d8eb6517dcf2d2d75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=20Morschh=C3=A4user?= Date: Wed, 18 Jun 2014 12:10:15 +0200 Subject: [PATCH 14/16] Fixed bug in filtertree.cpp --- cockatrice/src/filtertree.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cockatrice/src/filtertree.cpp b/cockatrice/src/filtertree.cpp index 4c28028b..5fc516f3 100644 --- a/cockatrice/src/filtertree.cpp +++ b/cockatrice/src/filtertree.cpp @@ -266,7 +266,7 @@ FilterItemList *FilterTree::attrTypeList(CardFilter::Attr attr, int FilterTree::findTermIndex(CardFilter::Attr attr, CardFilter::Type type, const QString &term) { - attrTypeList(attr, type)->termIndex(term); + return attrTypeList(attr, type)->termIndex(term); } int FilterTree::findTermIndex(const CardFilter *f) From 391e480d7a2d2c3a2fc58e798a4d860d31536526 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=20Morschh=C3=A4user?= Date: Wed, 18 Jun 2014 12:11:58 +0200 Subject: [PATCH 15/16] Restored MSVC linkflags after cmake update. --- cockatrice/CMakeLists.txt | 5 ++++- oracle/CMakeLists.txt | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/cockatrice/CMakeLists.txt b/cockatrice/CMakeLists.txt index 1d915bdb..499836dd 100644 --- a/cockatrice/CMakeLists.txt +++ b/cockatrice/CMakeLists.txt @@ -154,8 +154,11 @@ INCLUDE_DIRECTORIES(${QT_MOBILITY_MULTIMEDIAKIT_INCLUDE_DIR}) # Build cockatrice binary and link it ADD_EXECUTABLE(cockatrice WIN32 MACOSX_BUNDLE ${cockatrice_SOURCES} ${cockatrice_QM} ${cockatrice_RESOURCES_RCC} ${cockatrice_MOC_SRCS}) -TARGET_LINK_LIBRARIES(cockatrice cockatrice_common ${QT_LIBRARIES} ${QT_MOBILITY_MULTIMEDIAKIT_LIBRARY}) +TARGET_LINK_LIBRARIES(cockatrice cockatrice_common ${QT_QTMAIN_LIBRARY} ${QT_LIBRARIES} ${QT_MOBILITY_MULTIMEDIAKIT_LIBRARY}) +if(MSVC) + set_target_properties(cockatrice PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS") +endif(MSVC) if(UNIX) if(APPLE) diff --git a/oracle/CMakeLists.txt b/oracle/CMakeLists.txt index 340ce16a..624d9e96 100644 --- a/oracle/CMakeLists.txt +++ b/oracle/CMakeLists.txt @@ -25,7 +25,11 @@ INCLUDE_DIRECTORIES(../cockatrice/src) # Build oracle binary and link it ADD_EXECUTABLE(oracle WIN32 MACOSX_BUNDLE ${oracle_SOURCES} ${oracle_MOC_SRCS}) -TARGET_LINK_LIBRARIES(oracle ${QT_LIBRARIES}) +TARGET_LINK_LIBRARIES(oracle ${QT_QTMAIN_LIBRARY} ${QT_LIBRARIES}) + +if(MSVC) + set_target_properties(oracle PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS") +endif(MSVC) if(UNIX) if(APPLE) From 0497239cef813195408a838a0e66527f43fb3905 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=20Morschh=C3=A4user?= Date: Wed, 18 Jun 2014 13:42:14 +0200 Subject: [PATCH 16/16] Added MSVC compiler flags to cmake file. --- CMakeLists.txt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c1063ba..c8756e90 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,15 +50,21 @@ elseif(WIN32) endif() # Define proper compilation flags -IF (CMAKE_COMPILER_IS_GNUCC) +IF(MSVC) + # Visual Studio: + # Maximum optimization + set(CMAKE_CXX_FLAGS_RELEASE "/Ox") + # Generate complete debugging information + #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") -else() +ELSE() # other: osx/llvm, bsd/llvm set(CMAKE_CXX_FLAGS_RELEASE "-O2") set(CMAKE_CXX_FLAGS_DEBUG "-g -O0") -ENDIF (CMAKE_COMPILER_IS_GNUCC) +ENDIF() # GNU systems need to define the Mersenne exponent for the RNG to compile w/o warning IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")