# HG changeset patch # User Teemu Piippo # Date 1376182078 -10800 # Node ID 3d3e5f0fc4ccfe762863df59921f2c23cf7411bc # Parent 825d9ed1ee01bc7be1914f611af4c9fb38d72525 made it compile on windows/qt5 diff -r 825d9ed1ee01 -r 3d3e5f0fc4cc src/bytestream.cpp --- a/src/bytestream.cpp Sun Aug 11 03:08:14 2013 +0300 +++ b/src/bytestream.cpp Sun Aug 11 03:47:58 2013 +0300 @@ -210,8 +210,12 @@ void Bytestream::writeString (str val) { growToFit (val.length() + 1); -for (qchar c : val) + for (qchar c : val) +#if (QT_VERSION >= QT_VERSION_CHECK (5, 0, 0)) + doWrite (c.toLatin1()); +#else doWrite (c.toAscii()); +#endif // QT_VERSION doWrite ('\0'); } diff -r 825d9ed1ee01 -r 3d3e5f0fc4cc src/config.cpp --- a/src/config.cpp Sun Aug 11 03:08:14 2013 +0300 +++ b/src/config.cpp Sun Aug 11 03:47:58 2013 +0300 @@ -21,10 +21,6 @@ #include #include #include -#include -#include -#include -#include #include "config.h" #include "ui_configbox.h" #include "misc.h" @@ -52,8 +48,7 @@ // ============================================================================= // ----------------------------------------------------------------------------- -ConfigBox::ConfigBox (QWidget* parent, Qt::WindowFlags f) : QDialog (parent, f), - m_nam (new QNetworkAccessManager (this)) { +ConfigBox::ConfigBox (QWidget* parent, Qt::WindowFlags f) : QDialog (parent, f) { ui = new Ui_ConfigBox; ui->setupUi (this); ui->updateProgress->hide(); diff -r 825d9ed1ee01 -r 3d3e5f0fc4cc src/config.h --- a/src/config.h Sun Aug 11 03:08:14 2013 +0300 +++ b/src/config.h Sun Aug 11 03:47:58 2013 +0300 @@ -54,8 +54,6 @@ private: Ui_ConfigBox* ui; list m_zanBinaries; - QNetworkAccessManager* m_nam; - QNetworkReply* m_reply; }; #endif // CONFIG_H \ No newline at end of file diff -r 825d9ed1ee01 -r 3d3e5f0fc4cc src/demo.cpp --- a/src/demo.cpp Sun Aug 11 03:08:14 2013 +0300 +++ b/src/demo.cpp Sun Aug 11 03:47:58 2013 +0300 @@ -38,7 +38,12 @@ if (skip-- > 0) continue; - if (c.toAscii() == '\034') { +#if (QT_VERSION >= QT_VERSION_CHECK (5, 0, 0)) + if (c.toLatin1() == '\034') +#else + if (c.toAscii() == '\034') +#endif // QT_VERSION + { skip = 1; continue; } @@ -101,8 +106,14 @@ // ============================================================================= // ----------------------------------------------------------------------------- +#ifdef _WIN32 +# define FILE_FLAGS "rb" +#else +# define FILE_FLAGS "r" +#endif // _WIN32 + int launchDemo (str path) { - FILE* fp = fopen (path.toStdString().c_str(), "r"); + FILE* fp = fopen (path.toStdString().c_str(), FILE_FLAGS); if (!fp) { error (fmt (tr ("Couldn't open '%1' for reading: %2"), path, strerror (errno))); @@ -115,8 +126,9 @@ char* buf = new char[fsize]; - if (fread (buf, 1, fsize, fp) != fsize) { - error (tr ("I/O error")); + const size_t bytesRead = fread (buf, 1, fsize, fp); + if (bytesRead != fsize) { + error (fmt (tr ("I/O error: %1 / %2 bytes read"), bytesRead, fsize)); delete[] buf; return 2; } diff -r 825d9ed1ee01 -r 3d3e5f0fc4cc src/src.pro --- a/src/src.pro Sun Aug 11 03:08:14 2013 +0300 +++ b/src/src.pro Sun Aug 11 03:47:58 2013 +0300 @@ -9,6 +9,6 @@ RCC_DIR = ./build/ SOURCES = *.cpp HEADERS = *.h -QT += network +QT += widgets FORMS = ui/*.ui QMAKE_CXXFLAGS += -std=c++0x \ No newline at end of file