--- a/.hgignore Tue Mar 13 23:07:58 2018 +0100
+++ b/.hgignore Tue Mar 13 23:19:24 2018 +0100
@@ -35,7 +35,7 @@
misc/liblua/Xcode/build/
misc/libphysfs/Xcode/build/
misc/libphyslayer/Xcode/build/
-moc_*.cxx_parameters
+moc_*.cpp_parameters
*.log
*.cmd
*.patch
--- a/INSTALL.md Tue Mar 13 23:07:58 2018 +0100
+++ b/INSTALL.md Tue Mar 13 23:19:24 2018 +0100
@@ -16,22 +16,29 @@
- CMake >= 2.6.0
- A make program (e.g. GNU Make)
- Free Pascal Compiler (FPC) >= 2.2.4
-- Qt = 4.7.0
+- Qt 5
- SDL >= 2.0
- SDL\_net >= 2.0
- SDL\_mixer >= 2.0
- SDL\_image >= 2.0
- SDL\_ttf >= 2.0
+### Recommended optional dependencies
+
+These are not strictly required to build Hedgewars, but it's
+usually better to have them installed. Hedgewars has fallback mechanisms
+in if these are not found on your system.
+
+- qtstyleplugins (for Qt 5)
+- PhysFS >= 2.0.0
+- Lua = 5.1.0
+
### Optional dependencies
For some additional features, you can optionally install these dependencies:
-- For Hedgewars:
- - PhysFS >= 2.0.0 (recommended)
- - Lua = 5.1.0 (recommended)
- For PNG screenshots:
- - libpng >= 1.2 (recommended)
+ - libpng >= 1.2
- For video recording:
- FFmpeg or Libav
- For the Hedgewars Server:
--- a/QTfrontend/CMakeLists.txt Tue Mar 13 23:07:58 2018 +0100
+++ b/QTfrontend/CMakeLists.txt Tue Mar 13 23:19:24 2018 +0100
@@ -1,24 +1,8 @@
-# Configure for Qt4
-set(QT_MIN_VERSION "4.7.0")
-include(CheckLibraryExists)
+find_package(Qt5 COMPONENTS Core Gui Network Svg Xml OpenGL)
-set(QT_USE_QTCORE TRUE)
-set(QT_USE_QTGUI TRUE)
-set(QT_USE_QTNETWORK TRUE)
-set(QT_USE_QTSVG FALSE)
-set(QT_USE_QTXML FALSE)
-set(QT_USE_QTOPENGL FALSE)
-set(QT_USE_QTMAIN TRUE)
+include_directories(${Qt5Core_PRIVATE_INCLUDE_DIRS})
-find_package(Qt4 REQUIRED)
-include(${QT_USE_FILE})
-
-# https://bugreports.qt-project.org/browse/QTBUG-17333
-if(APPLE AND
- ${QTVERSION} VERSION_GREATER "4.7.0" AND
- ${QTVERSION} VERSION_LESS "4.7.4")
- message(FATAL_ERROR "This version of Qt is known *not* to work, please update or use a lower version")
-endif()
+include(CheckLibraryExists)
find_package(SDL2 REQUIRED)
find_package(SDL2_mixer 2 REQUIRED) #audio in SDLInteraction
@@ -159,9 +143,9 @@
endif()
endif()
-qt4_add_resources(hwfr_rez_src ${hwfr_rez})
+qt5_add_resources(hwfr_rez_src ${hwfr_rez})
-qt4_wrap_cpp(hwfr_moc_srcs ${hwfr_moc_hdrs})
+qt5_wrap_cpp(hwfr_moc_srcs ${hwfr_moc_hdrs})
if(APPLE)
@@ -198,14 +182,14 @@
list(APPEND HW_LINK_LIBS
physfs physlayer
- ${QT_LIBRARIES}
+ Qt5::Core Qt5::Gui Qt5::Network Qt5::Svg Qt5::Xml Qt5::OpenGL
)
list(APPEND HW_LINK_LIBS
${SDL2_LIBRARY}
${SDL2_MIXER_LIBRARIES}
)
-
+
if(WIN32 AND NOT UNIX)
if(NOT SDL2_LIBRARY)
list(APPEND HW_LINK_LIBS SDL2)
--- a/QTfrontend/binds.cpp Tue Mar 13 23:07:58 2018 +0100
+++ b/QTfrontend/binds.cpp Tue Mar 13 23:19:24 2018 +0100
@@ -47,10 +47,10 @@
{"+attack", "space", QT_TRANSLATE_NOOP("binds", "attack"), NULL, QT_TRANSLATE_NOOP("binds (descriptions)", "Fire your selected weapon or trigger an utility item:")},
{"put", "mousel", QT_TRANSLATE_NOOP("binds", "put"), NULL, QT_TRANSLATE_NOOP("binds (descriptions)", "Pick a weapon or a target location under the cursor:")},
{"findhh", "h", QT_TRANSLATE_NOOP("binds", "autocam / find hedgehog"),QT_TRANSLATE_NOOP("binds (categories)", "Camera"), QT_TRANSLATE_NOOP("binds (descriptions)", "Toggle automatic camera / refocus on active hedgehog:")},
- {"+cur_u", "[8]", QT_TRANSLATE_NOOP("binds", "up"), NULL, QT_TRANSLATE_NOOP("binds (descriptions)", "Move the cursor or camera without using the mouse:")},
- {"+cur_l", "[4]", QT_TRANSLATE_NOOP("binds", "left"), NULL, NULL},
- {"+cur_r", "[6]", QT_TRANSLATE_NOOP("binds", "right"), NULL, NULL},
- {"+cur_d", "[2]", QT_TRANSLATE_NOOP("binds", "down"), NULL, NULL},
+ {"+cur_u", "keypad_8", QT_TRANSLATE_NOOP("binds", "up"), NULL, QT_TRANSLATE_NOOP("binds (descriptions)", "Move the cursor or camera without using the mouse:")},
+ {"+cur_l", "keypad_4", QT_TRANSLATE_NOOP("binds", "left"), NULL, NULL},
+ {"+cur_r", "keypad_6", QT_TRANSLATE_NOOP("binds", "right"), NULL, NULL},
+ {"+cur_d", "keypad_2", QT_TRANSLATE_NOOP("binds", "down"), NULL, NULL},
// {"+cur_m", "", QT_TRANSLATE_NOOP("binds", "movement key modifier"), NULL, QT_TRANSLATE_NOOP("binds (descriptions)", "Specify a modifier key to move camera and cursor using your default hog movement keys:")},
{"zoomin", "wheelup", QT_TRANSLATE_NOOP("binds", "zoom in"), NULL, QT_TRANSLATE_NOOP("binds (descriptions)", "Modify the camera's zoom level:")},
{"zoomout", "wheeldown", QT_TRANSLATE_NOOP("binds", "zoom out"), NULL, NULL},
--- a/QTfrontend/main.cpp Tue Mar 13 23:07:58 2018 +0100
+++ b/QTfrontend/main.cpp Tue Mar 13 23:19:24 2018 +0100
@@ -20,7 +20,6 @@
#include <QTranslator>
#include <QLocale>
-#include <QPlastiqueStyle>
#include <QRegExp>
#include <QMap>
#include <QSettings>
@@ -29,6 +28,8 @@
#include <QDesktopWidget>
#include <QLabel>
#include <QLibraryInfo>
+#include <QStyle>
+#include <QStyleFactory>
#include "hwform.h"
#include "hwconsts.h"
@@ -155,8 +156,30 @@
.arg(HWApplication::tr("Hedgewars can use a %1 (e.g. \"%2\") to connect on start.", "command-line").arg(HWApplication::tr("CONNECTSTRING", "command-line")).arg(QString("hwplay://") + NETGAME_DEFAULT_SERVER));
}
-int main(int argc, char *argv[])
-{
+int main(int argc, char *argv[]) {
+ /* Qt5 Base removed Motif, Plastique. These are now in the Qt style plugins
+ (Ubuntu: qt5-style-plugins, which was NOT backported by Debian/Ubuntu to stable/LTS).
+ Windows appears to render best of the remaining options but still isn't quite right. */
+
+ // Try setting Plastique if available
+ QStyle* coreStyle;
+ coreStyle = QStyleFactory::create("Plastique");
+ if(coreStyle != 0) {
+ QApplication::setStyle(coreStyle);
+ qDebug("Qt style set: Plastique");
+ } else {
+ // Use Windows as fallback.
+ // FIXME: Under Windows style, some widgets like scrollbars don't render as nicely
+ coreStyle = QStyleFactory::create("Windows");
+ if(coreStyle != 0) {
+ QApplication::setStyle(coreStyle);
+ qDebug("Qt style set: Windows");
+ } else {
+ // Windows style should not be missing in Qt5 Base. If it does, something went terribly wrong!
+ qWarning("No Qt style could be set! Using the default one.");
+ }
+ }
+
// Since we're calling this first, closeResources() will be the last thing called after main() returns.
atexit(closeResources);
@@ -254,8 +277,6 @@
splash.show();
#endif
- app.setStyle(new QPlastiqueStyle());
-
QDateTime now = QDateTime::currentDateTime();
srand(now.toTime_t());
rand();
@@ -353,13 +374,14 @@
// Fallback to current input locale if "C" locale is returned
if(cc == "C")
- cc = HWApplication::keyboardInputLocale().name();
+ cc = HWApplication::inputMethod()->locale().name();
}
+ qDebug("Frontend uses locale: %s", qPrintable(cc));
// Load locale files into translators
- if (!TranslatorHedgewars.load(QString("physfs://Locale/hedgewars_%1").arg(cc)))
+ if (!TranslatorHedgewars.load(QString("hedgewars_%1").arg(cc), QString("physfs://Locale")))
qWarning("Failed to install Hedgewars translation (%s)", qPrintable(cc));
- if (!TranslatorQt.load(QString("%1/qt_%2").arg(QLibraryInfo::location(QLibraryInfo::TranslationsPath), cc)))
+ if (!TranslatorQt.load(QString("qt_%1").arg(cc), QString(QLibraryInfo::location(QLibraryInfo::TranslationsPath))))
qWarning("Failed to install Qt translation (%s)", qPrintable(cc));
app.installTranslator(&TranslatorHedgewars);
app.installTranslator(&TranslatorQt);
--- a/QTfrontend/model/ammoSchemeModel.cpp Tue Mar 13 23:07:58 2018 +0100
+++ b/QTfrontend/model/ammoSchemeModel.cpp Tue Mar 13 23:19:24 2018 +0100
@@ -974,10 +974,12 @@
return;
}
+ beginResetModel();
+
cfg[cfg.size()-1] = cfg[cfg.size()-1].mid(1);
for(int i = 0; i < cfg.size(); ++i)
netScheme[i] = QVariant(cfg[i]);
- reset();
+ endResetModel();
}
--- a/QTfrontend/model/playerslistmodel.cpp Tue Mar 13 23:07:58 2018 +0100
+++ b/QTfrontend/model/playerslistmodel.cpp Tue Mar 13 23:19:24 2018 +0100
@@ -309,10 +309,10 @@
}
if(index.data(Ignore).toBool())
- setData(index, Qt::gray, Qt::ForegroundRole);
+ setData(index, QColor(Qt::gray), Qt::ForegroundRole);
else
if(index.data(Friend).toBool())
- setData(index, Qt::green, Qt::ForegroundRole);
+ setData(index, QColor(Qt::green), Qt::ForegroundRole);
else
setData(index, QBrush(QColor(0xff, 0xcc, 0x00)), Qt::ForegroundRole);
}
--- a/QTfrontend/net/hwmap.cpp Tue Mar 13 23:07:58 2018 +0100
+++ b/QTfrontend/net/hwmap.cpp Tue Mar 13 23:19:24 2018 +0100
@@ -79,7 +79,7 @@
{
quint8 *buf = (quint8*) readbuffer.constData();
QImage im(buf, 256, 128, QImage::Format_Mono);
- im.setNumColors(2);
+ im.setColorCount(2);
QPixmap px(QSize(256, 128));
QPixmap pxres(px.size());
--- a/QTfrontend/net/netudpwidget.cpp Tue Mar 13 23:07:58 2018 +0100
+++ b/QTfrontend/net/netudpwidget.cpp Tue Mar 13 23:19:24 2018 +0100
@@ -33,15 +33,19 @@
void HWNetUdpModel::updateList()
{
- games.clear();
+ beginResetModel();
+
+ games.clear();
- reset();
+ endResetModel();
- pUdpSocket->writeDatagram("hedgewars client", QHostAddress::Broadcast, NETGAME_DEFAULT_PORT);
+ pUdpSocket->writeDatagram("hedgewars client", QHostAddress::Broadcast, NETGAME_DEFAULT_PORT);
}
void HWNetUdpModel::onClientRead()
{
+ beginResetModel();
+
while (pUdpSocket->hasPendingDatagrams())
{
QByteArray datagram;
@@ -60,7 +64,7 @@
}
}
- reset();
+ endResetModel();
}
QVariant HWNetUdpModel::data(const QModelIndex &index,
--- a/QTfrontend/net/newnetclient.cpp Tue Mar 13 23:07:58 2018 +0100
+++ b/QTfrontend/net/newnetclient.cpp Tue Mar 13 23:19:24 2018 +0100
@@ -242,7 +242,7 @@
void HWNewNet::SendPasswordHash(const QString & hash)
{
// don't send it immediately, only store and check if server asked us for a password
- m_passwordHash = hash.toAscii();
+ m_passwordHash = hash.toLatin1();
maybeSendPassword();
}
@@ -271,7 +271,7 @@
if (lst[0] == "ERROR")
{
if (lst.size() == 2)
- emit Error(HWApplication::translate("server", lst[1].toAscii().constData()));
+ emit Error(HWApplication::translate("server", lst[1].toLatin1().constData()));
else
emit Error("Unknown error");
return;
@@ -280,7 +280,7 @@
if (lst[0] == "WARNING")
{
if (lst.size() == 2)
- emit Warning(HWApplication::translate("server", lst[1].toAscii().constData()));
+ emit Warning(HWApplication::translate("server", lst[1].toLatin1().constData()));
else
emit Warning("Unknown warning");
return;
@@ -447,7 +447,7 @@
while(flags.size() > 1)
{
flags.remove(0, 1);
- char c = flags[0].toAscii();
+ char c = flags[0].toLatin1();
bool inRoom = (netClientState == InRoom || netClientState == InGame);
switch(c)
@@ -673,7 +673,7 @@
}
m_game_connected = false;
Disconnect();
- emit disconnected(HWApplication::translate("server", lst[1].toAscii().constData()));
+ emit disconnected(HWApplication::translate("server", lst[1].toLatin1().constData()));
return;
}
@@ -727,7 +727,7 @@
}
for(int i = 1; i < lst.size(); ++i)
{
- QByteArray em = QByteArray::fromBase64(lst[i].toAscii());
+ QByteArray em = QByteArray::fromBase64(lst[i].toLatin1());
emit FromNet(em);
}
return;
@@ -1155,18 +1155,18 @@
return;
QString hash = QCryptographicHash::hash(
- m_clientSalt.toAscii()
- .append(m_serverSalt.toAscii())
+ m_clientSalt.toLatin1()
+ .append(m_serverSalt.toLatin1())
.append(m_passwordHash)
- .append(cProtoVer->toAscii())
+ .append(cProtoVer->toLatin1())
.append("!hedgewars")
, QCryptographicHash::Sha1).toHex();
m_serverHash = QCryptographicHash::hash(
- m_serverSalt.toAscii()
- .append(m_clientSalt.toAscii())
+ m_serverSalt.toLatin1()
+ .append(m_clientSalt.toLatin1())
.append(m_passwordHash)
- .append(cProtoVer->toAscii())
+ .append(cProtoVer->toLatin1())
.append("!hedgewars")
, QCryptographicHash::Sha1).toHex();
--- a/QTfrontend/net/proto.h Tue Mar 13 23:07:58 2018 +0100
+++ b/QTfrontend/net/proto.h Tue Mar 13 23:19:24 2018 +0100
@@ -22,7 +22,7 @@
#include <QByteArray>
#include <QString>
#include <QStringList>
-
+#include <QObject>
class HWProto : public QObject
{
--- a/QTfrontend/sdlkeys.h Tue Mar 13 23:07:58 2018 +0100
+++ b/QTfrontend/sdlkeys.h Tue Mar 13 23:19:24 2018 +0100
@@ -94,21 +94,21 @@
{"y", "Y"},
{"z", "Z"},
{"delete", QT_TRANSLATE_NOOP("binds (keys)", "Delete")},
- {"[0]", QT_TRANSLATE_NOOP("binds (keys)", "Numpad 0")},
- {"[1]", QT_TRANSLATE_NOOP("binds (keys)", "Numpad 1")},
- {"[2]", QT_TRANSLATE_NOOP("binds (keys)", "Numpad 2")},
- {"[3]", QT_TRANSLATE_NOOP("binds (keys)", "Numpad 3")},
- {"[4]", QT_TRANSLATE_NOOP("binds (keys)", "Numpad 4")},
- {"[5]", QT_TRANSLATE_NOOP("binds (keys)", "Numpad 5")},
- {"[6]", QT_TRANSLATE_NOOP("binds (keys)", "Numpad 6")},
- {"[7]", QT_TRANSLATE_NOOP("binds (keys)", "Numpad 7")},
- {"[8]", QT_TRANSLATE_NOOP("binds (keys)", "Numpad 8")},
- {"[9]", QT_TRANSLATE_NOOP("binds (keys)", "Numpad 9")},
- {"[.]", QT_TRANSLATE_NOOP("binds (keys)", "Numpad .")},
- {"[/]", QT_TRANSLATE_NOOP("binds (keys)", "Numpad /")},
- {"[*]", QT_TRANSLATE_NOOP("binds (keys)", "Numpad *")},
- {"[-]", QT_TRANSLATE_NOOP("binds (keys)", "Numpad -")},
- {"[+]", QT_TRANSLATE_NOOP("binds (keys)", "Numpad +")},
+ {"keypad_0", QT_TRANSLATE_NOOP("binds (keys)", "Numpad 0")},
+ {"keypad_1", QT_TRANSLATE_NOOP("binds (keys)", "Numpad 1")},
+ {"keypad_2", QT_TRANSLATE_NOOP("binds (keys)", "Numpad 2")},
+ {"keypad_3", QT_TRANSLATE_NOOP("binds (keys)", "Numpad 3")},
+ {"keypad_4", QT_TRANSLATE_NOOP("binds (keys)", "Numpad 4")},
+ {"keypad_5", QT_TRANSLATE_NOOP("binds (keys)", "Numpad 5")},
+ {"keypad_6", QT_TRANSLATE_NOOP("binds (keys)", "Numpad 6")},
+ {"keypad_7", QT_TRANSLATE_NOOP("binds (keys)", "Numpad 7")},
+ {"keypad_8", QT_TRANSLATE_NOOP("binds (keys)", "Numpad 8")},
+ {"keypad_9", QT_TRANSLATE_NOOP("binds (keys)", "Numpad 9")},
+ {"keypad_.", QT_TRANSLATE_NOOP("binds (keys)", "Numpad .")},
+ {"keypad_/", QT_TRANSLATE_NOOP("binds (keys)", "Numpad /")},
+ {"keypad_*", QT_TRANSLATE_NOOP("binds (keys)", "Numpad *")},
+ {"keypad_-", QT_TRANSLATE_NOOP("binds (keys)", "Numpad -")},
+ {"keypad_+", QT_TRANSLATE_NOOP("binds (keys)", "Numpad +")},
{"enter", QT_TRANSLATE_NOOP("binds (keys)", "Enter")},
{"equals", QT_TRANSLATE_NOOP("binds (keys)", "Equals")},
{"up", QT_TRANSLATE_NOOP("binds (keys)", "Up")},
--- a/QTfrontend/ui/dialog/upload_video.cpp Tue Mar 13 23:07:58 2018 +0100
+++ b/QTfrontend/ui/dialog/upload_video.cpp Tue Mar 13 23:19:24 2018 +0100
@@ -38,7 +38,7 @@
// User-agent string used in http requests.
// Don't make it a global varibale - crash on linux because of cVersionString
-#define USER_AGENT ("Hedgewars-QtFrontend/" + *cVersionString).toAscii()
+#define USER_AGENT ("Hedgewars-QtFrontend/" + *cVersionString).toLatin1()
// This is developer key obtained from http://code.google.com/apis/youtube/dashboard/
// If you are reusing this code outside Hedgewars, don't use this developer key,
@@ -193,7 +193,7 @@
QString account(QUrl::toPercentEncoding(leAccount->text()));
QString pass(QUrl::toPercentEncoding(lePassword->text()));
- QByteArray data = QString("Email=%1&Passwd=%2&service=youtube&source=Hedgewars").arg(account).arg(pass).toAscii();
+ QByteArray data = QString("Email=%1&Passwd=%2&service=youtube&source=Hedgewars").arg(account).arg(pass).toUtf8();
QNetworkReply *reply = netManager->post(request, data);
connect(reply, SIGNAL(finished()), this, SLOT(authFinished()));
@@ -246,7 +246,7 @@
return;
}
- QByteArray auth = ("GoogleLogin auth=" + authToken).toAscii();
+ QByteArray auth = ("GoogleLogin auth=" + authToken).toLatin1();
// We have authenticated, now we can send metadata and start upload
// Documentation is here: https://developers.google.com/youtube/2.0/developers_guide_protocol_resumable_uploads#Resumable_uploads
--- a/QTfrontend/ui/page/pageadmin.cpp Tue Mar 13 23:07:58 2018 +0100
+++ b/QTfrontend/ui/page/pageadmin.cpp Tue Mar 13 23:19:24 2018 +0100
@@ -98,7 +98,7 @@
<< tr("Expiration")
<< tr("Reason")
);
- twBans->horizontalHeader()->setResizeMode(2, QHeaderView::Stretch);
+ twBans->horizontalHeader()->setSectionResizeMode(2, QHeaderView::Stretch);
twBans->setEditTriggers(QAbstractItemView::NoEditTriggers);
twBans->setSelectionBehavior(QAbstractItemView::SelectRows);
twBans->setSelectionMode(QAbstractItemView::SingleSelection);
--- a/QTfrontend/ui/page/pagegamestats.cpp Tue Mar 13 23:07:58 2018 +0100
+++ b/QTfrontend/ui/page/pagegamestats.cpp Tue Mar 13 23:19:24 2018 +0100
@@ -78,6 +78,7 @@
gbl->addWidget(graphic);
graphic->scale(1.0, -1.0);
graphic->setBackgroundBrush(QBrush(Qt::black));
+ graphic->setRenderHint(QPainter::Antialiasing, true);
labelGameWin = new QLabel(this);
labelGameWin->setTextFormat(Qt::RichText);
@@ -172,27 +173,45 @@
labelGraphTitle->hide();
graphic->hide();
} else {
- QGraphicsScene * scene = new QGraphicsScene();
+ graphic->setScene(Q_NULLPTR);
+ m_scene.reset(new QGraphicsScene(this));
+
+ quint32 maxValue = 0;
+ int maxSize = 0;
+ for(QMap<quint32, QVector<quint32> >::const_iterator i = healthPoints.constBegin(); i != healthPoints.constEnd(); ++i)
+ {
+ maxSize = qMax(maxSize, i.value().size());
+
+ foreach (quint32 v, i.value())
+ maxValue = qMax(maxValue, v);
+ }
+
+ if(maxSize < 2)
+ return;
QMap<quint32, QVector<quint32> >::const_iterator i = healthPoints.constBegin();
while (i != healthPoints.constEnd())
{
quint32 c = i.key();
//QColor clanColor = QColor(qRgb((c >> 16) & 255, (c >> 8) & 255, c & 255));
- QVector<quint32> hps = i.value();
+ const QVector<quint32>& hps = i.value();
QPainterPath path;
if (hps.size())
path.moveTo(0, hps[0]);
for(int t = 1; t < hps.size(); ++t)
- path.lineTo(t, hps[t]);
+ path.lineTo(t * maxValue / (maxSize - 1), hps[t]);
- scene->addPath(path, QPen(c));
+ QPen pen(c);
+ pen.setWidth(2);
+ pen.setCosmetic(true);
+
+ m_scene->addPath(path, pen);
++i;
}
- graphic->setScene(scene);
+ graphic->setScene(m_scene.data());
graphic->fitInView(graphic->sceneRect());
}
}
--- a/QTfrontend/ui/page/pagegamestats.h Tue Mar 13 23:07:58 2018 +0100
+++ b/QTfrontend/ui/page/pagegamestats.h Tue Mar 13 23:19:24 2018 +0100
@@ -70,6 +70,7 @@
unsigned int playerPosition;
quint32 lastColor;
bool defaultGraphTitle;
+ QScopedPointer<QGraphicsScene> m_scene;
protected:
QLayout * bodyLayoutDefinition();
--- a/QTfrontend/ui/page/pagenet.cpp Tue Mar 13 23:07:58 2018 +0100
+++ b/QTfrontend/ui/page/pagenet.cpp Tue Mar 13 23:19:24 2018 +0100
@@ -99,7 +99,7 @@
{
tvServersList->setModel(new HWNetUdpModel(tvServersList));
- tvServersList->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
+ tvServersList->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
static_cast<HWNetServersModel *>(tvServersList->model())->updateList();
--- a/QTfrontend/ui/page/pageroomslist.cpp Tue Mar 13 23:07:58 2018 +0100
+++ b/QTfrontend/ui/page/pageroomslist.cpp Tue Mar 13 23:19:24 2018 +0100
@@ -154,7 +154,7 @@
roomsList = new RoomTableView(this);
roomsList->setSelectionBehavior(QAbstractItemView::SelectRows);
roomsList->verticalHeader()->setVisible(false);
- roomsList->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
+ roomsList->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
roomsList->setAlternatingRowColors(true);
roomsList->setShowGrid(false);
roomsList->setSelectionMode(QAbstractItemView::SingleSelection);
@@ -587,7 +587,7 @@
h->setSortIndicatorShown(true);
h->setSortIndicator(RoomsListModel::StateColumn, Qt::AscendingOrder);
- h->setResizeMode(RoomsListModel::NameColumn, QHeaderView::Stretch);
+ h->setSectionResizeMode(RoomsListModel::NameColumn, QHeaderView::Stretch);
if (!restoreHeaderState())
{
--- a/QTfrontend/ui/page/pagevideos.cpp Tue Mar 13 23:07:58 2018 +0100
+++ b/QTfrontend/ui/page/pagevideos.cpp Tue Mar 13 23:19:24 2018 +0100
@@ -133,8 +133,8 @@
filesTable->setMinimumWidth(400);
QHeaderView * header = filesTable->horizontalHeader();
- header->setResizeMode(vcName, QHeaderView::ResizeToContents);
- header->setResizeMode(vcSize, QHeaderView::Fixed);
+ header->setSectionResizeMode(vcName, QHeaderView::ResizeToContents);
+ header->setSectionResizeMode(vcSize, QHeaderView::Fixed);
header->resizeSection(vcSize, 100);
header->setStretchLastSection(true);
@@ -851,7 +851,7 @@
static QString unprotectPass(QString str)
{
- QByteArray array = QByteArray::fromBase64(str.toAscii());
+ QByteArray array = QByteArray::fromBase64(str.toLatin1());
for (int i = 0; i < array.size(); i++)
array[i] = array[i] ^ 0xC4 ^ i;
return QString::fromUtf8(array);
--- a/QTfrontend/ui/widget/about.cpp Tue Mar 13 23:07:58 2018 +0100
+++ b/QTfrontend/ui/widget/about.cpp Tue Mar 13 23:19:24 2018 +0100
@@ -26,6 +26,7 @@
#include <QMessageBox>
#include <QNetworkReply>
#include <QDebug>
+#include <QMimeData>
#include "hwconsts.h"
#include "SDLInteraction.h"
#include "SDL.h"
--- a/QTfrontend/ui/widget/chatwidget.cpp Tue Mar 13 23:07:58 2018 +0100
+++ b/QTfrontend/ui/widget/chatwidget.cpp Tue Mar 13 23:19:24 2018 +0100
@@ -32,6 +32,7 @@
#include <QSortFilterProxyModel>
#include <QMenu>
#include <QScrollBar>
+#include <QMimeData>
#include "DataManager.h"
#include "hwconsts.h"
@@ -312,7 +313,7 @@
else if (link.scheme() == "hwnick")
{
// decode nick
- QString nick = QString::fromUtf8(QByteArray::fromBase64(link.encodedQuery()));
+ QString nick = QString::fromUtf8(QByteArray::fromBase64(link.query(QUrl::FullyDecoded).toLatin1()));
QModelIndexList mil = chatNicks->model()->match(chatNicks->model()->index(0, 0), Qt::DisplayRole, nick);
bool isOffline = (mil.size() < 1);
@@ -374,10 +375,10 @@
{
if (nickname != m_userNick)
return QString("<a href=\"hwnick://?%1\" class=\"nick\">%2</a>").arg(
- QString(nickname.toUtf8().toBase64())).arg(Qt::escape(nickname));
+ QString(nickname.toUtf8().toBase64())).arg(nickname.toHtmlEscaped());
// unlinked nick (if own one)
- return QString("<span class=\"nick\">%1</span>").arg(Qt::escape(nickname));
+ return QString("<span class=\"nick\">%1</span>").arg(nickname.toHtmlEscaped());
}
const QRegExp HWChatWidget::URLREGEXP = QRegExp("(http(s)?://)?(www\\.)?((([^/:?&#]+\\.)?hedgewars\\.org|code\\.google\\.com|googlecode\\.com|hh\\.unit22\\.org)(/[^ ]*)?)");
@@ -399,7 +400,7 @@
QString HWChatWidget::messageToHTML(const QString & message)
{
- QString formattedStr = Qt::escape(message);
+ QString formattedStr = message.toHtmlEscaped();
// link some urls
formattedStr = formattedStr.replace(URLREGEXP, "<a href=\"http\\2://\\4\">\\4</a>");
return formattedStr;
@@ -606,9 +607,9 @@
{
addLine("msg_PlayerInfo", QString(" >>> %1 - <span class=\"ipaddress\">%2</span> <span class=\"version\">%3</span> <span class=\"location\">%4</span>")
.arg(linkedNick(nick))
- .arg(Qt::escape(ip == "[]"?"":ip))
- .arg(Qt::escape(version))
- .arg(Qt::escape(roomInfo))
+ .arg(QString(ip == "[]"?"":ip).toHtmlEscaped())
+ .arg(version.toHtmlEscaped())
+ .arg(roomInfo.toHtmlEscaped())
);
}
--- a/QTfrontend/ui/widget/feedbackdialog.cpp Tue Mar 13 23:07:58 2018 +0100
+++ b/QTfrontend/ui/widget/feedbackdialog.cpp Tue Mar 13 23:19:24 2018 +0100
@@ -20,7 +20,7 @@
#include <QLineEdit>
#include <QTextBrowser>
#include <QLabel>
-#include <QHttp>
+#include <QNetworkAccessManager>
#include <QSysInfo>
#include <QDebug>
#include <QBuffer>
@@ -474,7 +474,7 @@
this, SLOT(finishedSlot(QNetworkReply*)));
QNetworkRequest header(QUrl("https://hedgewars.org/feedback/?submit"));
- header.setRawHeader("Content-Length", QString::number(body.size()).toAscii());
+ header.setRawHeader("Content-Length", QString::number(body.size()).toLatin1());
header.setRawHeader("Content-Type", "application/x-www-form-urlencoded");
nam->post(header, body);
--- a/QTfrontend/ui/widget/keybinder.cpp Tue Mar 13 23:07:58 2018 +0100
+++ b/QTfrontend/ui/widget/keybinder.cpp Tue Mar 13 23:19:24 2018 +0100
@@ -154,7 +154,7 @@
curTable = new QTableWidget(0, 2);
curTable->verticalHeader()->setVisible(false);
curTable->horizontalHeader()->setVisible(false);
- curTable->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
+ curTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
curTable->verticalHeader()->setDefaultSectionSize(rowHeight);
curTable->setShowGrid(false);
curTable->setStyleSheet("QTableWidget { border: none; } ");
--- a/QTfrontend/ui/widget/mapContainer.cpp Tue Mar 13 23:07:58 2018 +0100
+++ b/QTfrontend/ui/widget/mapContainer.cpp Tue Mar 13 23:19:24 2018 +0100
@@ -984,7 +984,7 @@
{
m_theme = selectedTheme = current.data(ThemeModel::ActualNameRole).toString();
m_themeID = current.row();
- QIcon icon = qVariantValue<QIcon>(current.data(Qt::DecorationRole));
+ QIcon icon = current.data(Qt::DecorationRole).value<QIcon>();
//QSize iconSize = icon.actualSize(QSize(65535, 65535));
//btnTheme->setFixedHeight(64);
//btnTheme->setIconSize(iconSize);
--- a/QTfrontend/ui/widget/togglebutton.cpp Tue Mar 13 23:07:58 2018 +0100
+++ b/QTfrontend/ui/widget/togglebutton.cpp Tue Mar 13 23:19:24 2018 +0100
@@ -30,6 +30,8 @@
pmChecked.load(img);
pmDisabled.load(img);
+ pmDisabled.setDevicePixelRatio(pm.devicePixelRatio());
+
setMaximumWidth(pmChecked.width() + 6);
painter->begin(&pmDisabled);
--- a/QTfrontend/util/FileEngine.h Tue Mar 13 23:07:58 2018 +0100
+++ b/QTfrontend/util/FileEngine.h Tue Mar 13 23:19:24 2018 +0100
@@ -1,9 +1,7 @@
#ifndef _FileEngine_h
#define _FileEngine_h
-#include <QAbstractFileEngine>
-#include <QAbstractFileEngineHandler>
-#include <QAbstractFileEngineIterator>
+#include <private/qabstractfileengine_p.h>
#include <QDateTime>
#include "physfs.h"
--- a/share/hedgewars/Data/Locale/CMakeLists.txt Tue Mar 13 23:07:58 2018 +0100
+++ b/share/hedgewars/Data/Locale/CMakeLists.txt Tue Mar 13 23:19:24 2018 +0100
@@ -1,5 +1,4 @@
-find_package(Qt4 REQUIRED)
-include(${QT_USE_FILE})
+find_package(Qt5 COMPONENTS LinguistTools)
file(GLOB txttrans2 ??.txt)
file(GLOB txttrans5 ?????.txt)
@@ -9,7 +8,7 @@
file(GLOB campaignfiles campaigns_*.txt)
file(GLOB tipfiles tips_*.xml)
-QT4_ADD_TRANSLATION(QM ${tsfiles})
+QT5_ADD_TRANSLATION(QM ${tsfiles})
add_custom_target (release-translation ALL
DEPENDS ${QM}