Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 651810 | Differences between
and this patch

Collapse All | Expand All

(-)a/QTfrontend/CMakeLists.txt (+2 lines)
Lines 1-5 Link Here
1
find_package(Qt5 COMPONENTS Core Gui Network Widgets)
1
find_package(Qt5 COMPONENTS Core Gui Network Widgets)
2
2
3
include_directories(${Qt5Core_PRIVATE_INCLUDE_DIRS})
4
3
include(CheckLibraryExists)
5
include(CheckLibraryExists)
4
6
5
find_package(SDL2 REQUIRED)
7
find_package(SDL2 REQUIRED)
(-)a/QTfrontend/main.cpp (-3 / +2 lines)
Lines 20-26 Link Here
20
20
21
#include <QTranslator>
21
#include <QTranslator>
22
#include <QLocale>
22
#include <QLocale>
23
#include <QPlastiqueStyle>
24
#include <QRegExp>
23
#include <QRegExp>
25
#include <QMap>
24
#include <QMap>
26
#include <QSettings>
25
#include <QSettings>
Lines 252-258 Link Here
252
    splash.show();
251
    splash.show();
253
#endif
252
#endif
254
253
255
    app.setStyle(new QPlastiqueStyle());
254
    //app.setStyle(new QPlastiqueStyle());
256
255
257
    QDateTime now = QDateTime::currentDateTime();
256
    QDateTime now = QDateTime::currentDateTime();
258
    srand(now.toTime_t());
257
    srand(now.toTime_t());
Lines 332-338 Link Here
332
331
333
            // Fallback to current input locale if "C" locale is returned
332
            // Fallback to current input locale if "C" locale is returned
334
            if(cc == "C")
333
            if(cc == "C")
335
                cc = HWApplication::keyboardInputLocale().name();
334
                cc = HWApplication::inputMethod()->locale().name();
336
        }
335
        }
337
336
338
        // Load locale files into translators
337
        // Load locale files into translators
(-)a/QTfrontend/model/ammoSchemeModel.cpp (-3 / +5 lines)
Lines 569-575 Link Here
569
            << QVariant()              // scriptparam    43
569
            << QVariant()              // scriptparam    43
570
            ;
570
            ;
571
571
572
	QList<QVariant> construction;
572
  QList<QVariant> construction;
573
    construction
573
    construction
574
            << predefSchemesNames[10]  // name           0
574
            << predefSchemesNames[10]  // name           0
575
            << QVariant(false)         // fortsmode      1
575
            << QVariant(false)         // fortsmode      1
Lines 617-623 Link Here
617
            << QVariant()              // scriptparam    43
617
            << QVariant()              // scriptparam    43
618
            ;
618
            ;
619
619
620
	QList<QVariant> hedgeeditor;
620
  QList<QVariant> hedgeeditor;
621
    hedgeeditor
621
    hedgeeditor
622
            << predefSchemesNames[11]  // name           0
622
            << predefSchemesNames[11]  // name           0
623
            << QVariant(false)         // fortsmode      1
623
            << QVariant(false)         // fortsmode      1
Lines 896-905 Link Here
896
        return;
896
        return;
897
    }
897
    }
898
898
899
    beginResetModel();
900
899
    cfg[cfg.size()-1] = cfg[cfg.size()-1].mid(1);
901
    cfg[cfg.size()-1] = cfg[cfg.size()-1].mid(1);
900
902
901
    for(int i = 0; i < cfg.size(); ++i)
903
    for(int i = 0; i < cfg.size(); ++i)
902
        netScheme[i] = QVariant(cfg[i]);
904
        netScheme[i] = QVariant(cfg[i]);
903
905
904
    reset();
906
    endResetModel();
905
}
907
}
(-)a/QTfrontend/model/playerslistmodel.cpp (-2 / +2 lines)
Lines 309-318 Link Here
309
    }
309
    }
310
310
311
    if(index.data(Ignore).toBool())
311
    if(index.data(Ignore).toBool())
312
        setData(index, Qt::gray, Qt::ForegroundRole);
312
        setData(index, QColor(Qt::gray), Qt::ForegroundRole);
313
    else
313
    else
314
    if(index.data(Friend).toBool())
314
    if(index.data(Friend).toBool())
315
        setData(index, Qt::green, Qt::ForegroundRole);
315
        setData(index, QColor(Qt::green), Qt::ForegroundRole);
316
    else
316
    else
317
        setData(index, QBrush(QColor(0xff, 0xcc, 0x00)), Qt::ForegroundRole);
317
        setData(index, QBrush(QColor(0xff, 0xcc, 0x00)), Qt::ForegroundRole);
318
}
318
}
(-)a/QTfrontend/net/hwmap.cpp (-1 / +1 lines)
Lines 79-85 Link Here
79
    {
79
    {
80
        quint8 *buf = (quint8*) readbuffer.constData();
80
        quint8 *buf = (quint8*) readbuffer.constData();
81
        QImage im(buf, 256, 128, QImage::Format_Mono);
81
        QImage im(buf, 256, 128, QImage::Format_Mono);
82
        im.setNumColors(2);
82
        im.setColorCount(2);
83
83
84
        QPixmap px(QSize(256, 128));
84
        QPixmap px(QSize(256, 128));
85
        QPixmap pxres(px.size());
85
        QPixmap pxres(px.size());
(-)a/QTfrontend/net/netudpwidget.cpp (-4 / +8 lines)
Lines 33-47 Link Here
33
33
34
void HWNetUdpModel::updateList()
34
void HWNetUdpModel::updateList()
35
{
35
{
36
    games.clear();
36
  beginResetModel();
37
38
  games.clear();
37
39
38
    reset();
40
  endResetModel();
39
41
40
    pUdpSocket->writeDatagram("hedgewars client", QHostAddress::Broadcast, NETGAME_DEFAULT_PORT);
42
  pUdpSocket->writeDatagram("hedgewars client", QHostAddress::Broadcast, NETGAME_DEFAULT_PORT);
41
}
43
}
42
44
43
void HWNetUdpModel::onClientRead()
45
void HWNetUdpModel::onClientRead()
44
{
46
{
47
    beginResetModel();
48
45
    while (pUdpSocket->hasPendingDatagrams())
49
    while (pUdpSocket->hasPendingDatagrams())
46
    {
50
    {
47
        QByteArray datagram;
51
        QByteArray datagram;
Lines 60-66 Link Here
60
        }
64
        }
61
    }
65
    }
62
66
63
    reset();
67
    endResetModel();
64
}
68
}
65
69
66
QVariant HWNetUdpModel::data(const QModelIndex &index,
70
QVariant HWNetUdpModel::data(const QModelIndex &index,
(-)a/QTfrontend/net/newnetclient.cpp (-12 / +12 lines)
Lines 242-248 Link Here
242
void HWNewNet::SendPasswordHash(const QString & hash)
242
void HWNewNet::SendPasswordHash(const QString & hash)
243
{
243
{
244
    // don't send it immediately, only store and check if server asked us for a password
244
    // don't send it immediately, only store and check if server asked us for a password
245
    m_passwordHash = hash.toAscii();
245
    m_passwordHash = hash.toLatin1();
246
246
247
    maybeSendPassword();
247
    maybeSendPassword();
248
}
248
}
Lines 271-277 Link Here
271
    if (lst[0] == "ERROR")
271
    if (lst[0] == "ERROR")
272
    {
272
    {
273
        if (lst.size() == 2)
273
        if (lst.size() == 2)
274
            emit Error(HWApplication::translate("server", lst[1].toAscii().constData()));
274
            emit Error(HWApplication::translate("server", lst[1].toLatin1().constData()));
275
        else
275
        else
276
            emit Error("Unknown error");
276
            emit Error("Unknown error");
277
        return;
277
        return;
Lines 280-286 Link Here
280
    if (lst[0] == "WARNING")
280
    if (lst[0] == "WARNING")
281
    {
281
    {
282
        if (lst.size() == 2)
282
        if (lst.size() == 2)
283
            emit Warning(HWApplication::translate("server", lst[1].toAscii().constData()));
283
            emit Warning(HWApplication::translate("server", lst[1].toLatin1().constData()));
284
        else
284
        else
285
            emit Warning("Unknown warning");
285
            emit Warning("Unknown warning");
286
        return;
286
        return;
Lines 447-453 Link Here
447
        while(flags.size() > 1)
447
        while(flags.size() > 1)
448
        {
448
        {
449
            flags.remove(0, 1);
449
            flags.remove(0, 1);
450
            char c = flags[0].toAscii();
450
            char c = flags[0].toLatin1();
451
            bool inRoom = (netClientState == InRoom || netClientState == InGame);
451
            bool inRoom = (netClientState == InRoom || netClientState == InGame);
452
452
453
            switch(c)
453
            switch(c)
Lines 673-679 Link Here
673
        }
673
        }
674
        m_game_connected = false;
674
        m_game_connected = false;
675
        Disconnect();
675
        Disconnect();
676
        emit disconnected(HWApplication::translate("server", lst[1].toAscii().constData()));
676
        emit disconnected(HWApplication::translate("server", lst[1].toLatin1().constData()));
677
        return;
677
        return;
678
    }
678
    }
679
679
Lines 727-733 Link Here
727
            }
727
            }
728
            for(int i = 1; i < lst.size(); ++i)
728
            for(int i = 1; i < lst.size(); ++i)
729
            {
729
            {
730
                QByteArray em = QByteArray::fromBase64(lst[i].toAscii());
730
                QByteArray em = QByteArray::fromBase64(lst[i].toLatin1());
731
                emit FromNet(em);
731
                emit FromNet(em);
732
            }
732
            }
733
            return;
733
            return;
Lines 1155-1172 Link Here
1155
        return;
1155
        return;
1156
1156
1157
    QString hash = QCryptographicHash::hash(
1157
    QString hash = QCryptographicHash::hash(
1158
                m_clientSalt.toAscii()
1158
                m_clientSalt.toLatin1()
1159
                .append(m_serverSalt.toAscii())
1159
                .append(m_serverSalt.toLatin1())
1160
                .append(m_passwordHash)
1160
                .append(m_passwordHash)
1161
                .append(cProtoVer->toAscii())
1161
                .append(cProtoVer->toLatin1())
1162
                .append("!hedgewars")
1162
                .append("!hedgewars")
1163
                , QCryptographicHash::Sha1).toHex();
1163
                , QCryptographicHash::Sha1).toHex();
1164
1164
1165
    m_serverHash = QCryptographicHash::hash(
1165
    m_serverHash = QCryptographicHash::hash(
1166
                m_serverSalt.toAscii()
1166
                m_serverSalt.toLatin1()
1167
                .append(m_clientSalt.toAscii())
1167
                .append(m_clientSalt.toLatin1())
1168
                .append(m_passwordHash)
1168
                .append(m_passwordHash)
1169
                .append(cProtoVer->toAscii())
1169
                .append(cProtoVer->toLatin1())
1170
                .append("!hedgewars")
1170
                .append("!hedgewars")
1171
                , QCryptographicHash::Sha1).toHex();
1171
                , QCryptographicHash::Sha1).toHex();
1172
1172
(-)a/QTfrontend/net/proto.h (-1 / +1 lines)
Lines 22-28 Link Here
22
#include <QByteArray>
22
#include <QByteArray>
23
#include <QString>
23
#include <QString>
24
#include <QStringList>
24
#include <QStringList>
25
25
#include <QObject>
26
26
27
class HWProto : public QObject
27
class HWProto : public QObject
28
{
28
{
(-)a/QTfrontend/ui/dialog/upload_video.cpp (-3 / +3 lines)
Lines 38-44 Link Here
38
38
39
// User-agent string used in http requests.
39
// User-agent string used in http requests.
40
// Don't make it a global varibale - crash on linux because of cVersionString
40
// Don't make it a global varibale - crash on linux because of cVersionString
41
#define USER_AGENT ("Hedgewars-QtFrontend/" + *cVersionString).toAscii()
41
#define USER_AGENT ("Hedgewars-QtFrontend/" + *cVersionString).toLatin1()
42
42
43
// This is developer key obtained from http://code.google.com/apis/youtube/dashboard/
43
// This is developer key obtained from http://code.google.com/apis/youtube/dashboard/
44
// If you are reusing this code outside Hedgewars, don't use this developer key,
44
// If you are reusing this code outside Hedgewars, don't use this developer key,
Lines 193-199 Link Here
193
193
194
    QString account(QUrl::toPercentEncoding(leAccount->text()));
194
    QString account(QUrl::toPercentEncoding(leAccount->text()));
195
    QString pass(QUrl::toPercentEncoding(lePassword->text()));
195
    QString pass(QUrl::toPercentEncoding(lePassword->text()));
196
    QByteArray data = QString("Email=%1&Passwd=%2&service=youtube&source=Hedgewars").arg(account).arg(pass).toAscii();
196
    QByteArray data = QString("Email=%1&Passwd=%2&service=youtube&source=Hedgewars").arg(account).arg(pass).toUtf8();
197
197
198
    QNetworkReply *reply = netManager->post(request, data);
198
    QNetworkReply *reply = netManager->post(request, data);
199
    connect(reply, SIGNAL(finished()), this, SLOT(authFinished()));
199
    connect(reply, SIGNAL(finished()), this, SLOT(authFinished()));
Lines 246-252 Link Here
246
        return;
246
        return;
247
    }
247
    }
248
248
249
    QByteArray auth = ("GoogleLogin auth=" + authToken).toAscii();
249
    QByteArray auth = ("GoogleLogin auth=" + authToken).toLatin1();
250
250
251
    // We have authenticated, now we can send metadata and start upload
251
    // We have authenticated, now we can send metadata and start upload
252
    // Documentation is here: https://developers.google.com/youtube/2.0/developers_guide_protocol_resumable_uploads#Resumable_uploads
252
    // Documentation is here: https://developers.google.com/youtube/2.0/developers_guide_protocol_resumable_uploads#Resumable_uploads
(-)a/QTfrontend/ui/page/pageadmin.cpp (-1 / +1 lines)
Lines 98-104 Link Here
98
                              << tr("Expiration")
98
                              << tr("Expiration")
99
                              << tr("Reason")
99
                              << tr("Reason")
100
                    );
100
                    );
101
        twBans->horizontalHeader()->setResizeMode(2, QHeaderView::Stretch);
101
        twBans->horizontalHeader()->setSectionResizeMode(2, QHeaderView::Stretch);
102
        twBans->setEditTriggers(QAbstractItemView::NoEditTriggers);
102
        twBans->setEditTriggers(QAbstractItemView::NoEditTriggers);
103
        twBans->setSelectionBehavior(QAbstractItemView::SelectRows);
103
        twBans->setSelectionBehavior(QAbstractItemView::SelectRows);
104
        twBans->setSelectionMode(QAbstractItemView::SingleSelection);
104
        twBans->setSelectionMode(QAbstractItemView::SingleSelection);
(-)a/QTfrontend/ui/page/pagenet.cpp (-1 / +1 lines)
Lines 99-105 Link Here
99
{
99
{
100
    tvServersList->setModel(new HWNetUdpModel(tvServersList));
100
    tvServersList->setModel(new HWNetUdpModel(tvServersList));
101
101
102
    tvServersList->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
102
    tvServersList->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
103
103
104
    static_cast<HWNetServersModel *>(tvServersList->model())->updateList();
104
    static_cast<HWNetServersModel *>(tvServersList->model())->updateList();
105
105
(-)a/QTfrontend/ui/page/pageroomslist.cpp (-2 / +2 lines)
Lines 154-160 Link Here
154
    roomsList = new RoomTableView(this);
154
    roomsList = new RoomTableView(this);
155
    roomsList->setSelectionBehavior(QAbstractItemView::SelectRows);
155
    roomsList->setSelectionBehavior(QAbstractItemView::SelectRows);
156
    roomsList->verticalHeader()->setVisible(false);
156
    roomsList->verticalHeader()->setVisible(false);
157
    roomsList->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
157
    roomsList->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
158
    roomsList->setAlternatingRowColors(true);
158
    roomsList->setAlternatingRowColors(true);
159
    roomsList->setShowGrid(false);
159
    roomsList->setShowGrid(false);
160
    roomsList->setSelectionMode(QAbstractItemView::SingleSelection);
160
    roomsList->setSelectionMode(QAbstractItemView::SingleSelection);
Lines 587-593 Link Here
587
587
588
    h->setSortIndicatorShown(true);
588
    h->setSortIndicatorShown(true);
589
    h->setSortIndicator(RoomsListModel::StateColumn, Qt::AscendingOrder);
589
    h->setSortIndicator(RoomsListModel::StateColumn, Qt::AscendingOrder);
590
    h->setResizeMode(RoomsListModel::NameColumn, QHeaderView::Stretch);
590
    h->setSectionResizeMode(RoomsListModel::NameColumn, QHeaderView::Stretch);
591
591
592
    if (!restoreHeaderState())
592
    if (!restoreHeaderState())
593
    {
593
    {
(-)a/QTfrontend/ui/page/pagevideos.cpp (-3 / +3 lines)
Lines 133-140 Link Here
133
        filesTable->setMinimumWidth(400);
133
        filesTable->setMinimumWidth(400);
134
134
135
        QHeaderView * header = filesTable->horizontalHeader();
135
        QHeaderView * header = filesTable->horizontalHeader();
136
        header->setResizeMode(vcName, QHeaderView::ResizeToContents);
136
        header->setSectionResizeMode(vcName, QHeaderView::ResizeToContents);
137
        header->setResizeMode(vcSize, QHeaderView::Fixed);
137
        header->setSectionResizeMode(vcSize, QHeaderView::Fixed);
138
        header->resizeSection(vcSize, 100);
138
        header->resizeSection(vcSize, 100);
139
        header->setStretchLastSection(true);
139
        header->setStretchLastSection(true);
140
140
Lines 851-857 Link Here
851
851
852
static QString unprotectPass(QString str)
852
static QString unprotectPass(QString str)
853
{
853
{
854
    QByteArray array = QByteArray::fromBase64(str.toAscii());
854
    QByteArray array = QByteArray::fromBase64(str.toLatin1());
855
    for (int i = 0; i < array.size(); i++)
855
    for (int i = 0; i < array.size(); i++)
856
        array[i] = array[i] ^ 0xC4 ^ i;
856
        array[i] = array[i] ^ 0xC4 ^ i;
857
    return QString::fromUtf8(array);
857
    return QString::fromUtf8(array);
(-)a/QTfrontend/ui/widget/about.cpp (+1 lines)
Lines 26-31 Link Here
26
#include <QMessageBox>
26
#include <QMessageBox>
27
#include <QNetworkReply>
27
#include <QNetworkReply>
28
#include <QDebug>
28
#include <QDebug>
29
#include <QMimeData>
29
#include "hwconsts.h"
30
#include "hwconsts.h"
30
#include "SDLInteraction.h"
31
#include "SDLInteraction.h"
31
#include "SDL.h"
32
#include "SDL.h"
(-)a/QTfrontend/ui/widget/chatwidget.cpp (-7 / +8 lines)
Lines 32-37 Link Here
32
#include <QSortFilterProxyModel>
32
#include <QSortFilterProxyModel>
33
#include <QMenu>
33
#include <QMenu>
34
#include <QScrollBar>
34
#include <QScrollBar>
35
#include <QMimeData>
35
36
36
#include "DataManager.h"
37
#include "DataManager.h"
37
#include "hwconsts.h"
38
#include "hwconsts.h"
Lines 312-318 Link Here
312
    else if (link.scheme() == "hwnick")
313
    else if (link.scheme() == "hwnick")
313
    {
314
    {
314
        // decode nick
315
        // decode nick
315
        QString nick = QString::fromUtf8(QByteArray::fromBase64(link.encodedQuery()));
316
        QString nick = QString::fromUtf8(QByteArray::fromBase64(link.query(QUrl::FullyDecoded).toLatin1()));
316
        QModelIndexList mil = chatNicks->model()->match(chatNicks->model()->index(0, 0), Qt::DisplayRole, nick);
317
        QModelIndexList mil = chatNicks->model()->match(chatNicks->model()->index(0, 0), Qt::DisplayRole, nick);
317
318
318
        bool isOffline = (mil.size() < 1);
319
        bool isOffline = (mil.size() < 1);
Lines 374-383 Link Here
374
{
375
{
375
    if (nickname != m_userNick)
376
    if (nickname != m_userNick)
376
        return QString("<a href=\"hwnick://?%1\" class=\"nick\">%2</a>").arg(
377
        return QString("<a href=\"hwnick://?%1\" class=\"nick\">%2</a>").arg(
377
                   QString(nickname.toUtf8().toBase64())).arg(Qt::escape(nickname));
378
                   QString(nickname.toUtf8().toBase64())).arg(nickname.toHtmlEscaped());
378
379
379
    // unlinked nick (if own one)
380
    // unlinked nick (if own one)
380
    return QString("<span class=\"nick\">%1</span>").arg(Qt::escape(nickname));
381
    return QString("<span class=\"nick\">%1</span>").arg(nickname.toHtmlEscaped());
381
}
382
}
382
383
383
const QRegExp HWChatWidget::URLREGEXP = QRegExp("(http(s)?://)?(www\\.)?((([^/:?&#]+\\.)?hedgewars\\.org|code\\.google\\.com|googlecode\\.com|hh\\.unit22\\.org)(/[^ ]*)?)");
384
const QRegExp HWChatWidget::URLREGEXP = QRegExp("(http(s)?://)?(www\\.)?((([^/:?&#]+\\.)?hedgewars\\.org|code\\.google\\.com|googlecode\\.com|hh\\.unit22\\.org)(/[^ ]*)?)");
Lines 399-405 Link Here
399
400
400
QString HWChatWidget::messageToHTML(const QString & message)
401
QString HWChatWidget::messageToHTML(const QString & message)
401
{
402
{
402
    QString formattedStr = Qt::escape(message);
403
    QString formattedStr = message.toHtmlEscaped();
403
    // link some urls
404
    // link some urls
404
    formattedStr = formattedStr.replace(URLREGEXP, "<a href=\"http\\2://\\4\">\\4</a>");
405
    formattedStr = formattedStr.replace(URLREGEXP, "<a href=\"http\\2://\\4\">\\4</a>");
405
    return formattedStr;
406
    return formattedStr;
Lines 606-614 Link Here
606
{
607
{
607
    addLine("msg_PlayerInfo", QString(" >>> %1 - <span class=\"ipaddress\">%2</span> <span class=\"version\">%3</span> <span class=\"location\">%4</span>")
608
    addLine("msg_PlayerInfo", QString(" >>> %1 - <span class=\"ipaddress\">%2</span> <span class=\"version\">%3</span> <span class=\"location\">%4</span>")
608
        .arg(linkedNick(nick))
609
        .arg(linkedNick(nick))
609
        .arg(Qt::escape(ip == "[]"?"":ip))
610
        .arg(QString(ip == "[]"?"":ip).toHtmlEscaped())
610
        .arg(Qt::escape(version))
611
        .arg(version.toHtmlEscaped())
611
        .arg(Qt::escape(roomInfo))
612
        .arg(roomInfo.toHtmlEscaped())
612
    );
613
    );
613
}
614
}
614
615
(-)a/QTfrontend/ui/widget/feedbackdialog.cpp (-2 / +2 lines)
Lines 20-26 Link Here
20
#include <QLineEdit>
20
#include <QLineEdit>
21
#include <QTextBrowser>
21
#include <QTextBrowser>
22
#include <QLabel>
22
#include <QLabel>
23
#include <QHttp>
23
#include <QNetworkAccessManager>
24
#include <QSysInfo>
24
#include <QSysInfo>
25
#include <QDebug>
25
#include <QDebug>
26
#include <QBuffer>
26
#include <QBuffer>
Lines 474-480 Link Here
474
            this, SLOT(finishedSlot(QNetworkReply*)));
474
            this, SLOT(finishedSlot(QNetworkReply*)));
475
475
476
    QNetworkRequest header(QUrl("https://hedgewars.org/feedback/?submit"));
476
    QNetworkRequest header(QUrl("https://hedgewars.org/feedback/?submit"));
477
    header.setRawHeader("Content-Length", QString::number(body.size()).toAscii());
477
    header.setRawHeader("Content-Length", QString::number(body.size()).toLatin1());
478
    header.setRawHeader("Content-Type", "application/x-www-form-urlencoded");
478
    header.setRawHeader("Content-Type", "application/x-www-form-urlencoded");
479
479
480
    nam->post(header, body);
480
    nam->post(header, body);
(-)a/QTfrontend/ui/widget/keybinder.cpp (-1 / +1 lines)
Lines 154-160 Link Here
154
            curTable = new QTableWidget(0, 2);
154
            curTable = new QTableWidget(0, 2);
155
            curTable->verticalHeader()->setVisible(false);
155
            curTable->verticalHeader()->setVisible(false);
156
            curTable->horizontalHeader()->setVisible(false);
156
            curTable->horizontalHeader()->setVisible(false);
157
            curTable->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
157
            curTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
158
            curTable->verticalHeader()->setDefaultSectionSize(rowHeight);
158
            curTable->verticalHeader()->setDefaultSectionSize(rowHeight);
159
            curTable->setShowGrid(false);
159
            curTable->setShowGrid(false);
160
            curTable->setStyleSheet("QTableWidget { border: none; } ");
160
            curTable->setStyleSheet("QTableWidget { border: none; } ");
(-)a/QTfrontend/ui/widget/mapContainer.cpp (-1 / +1 lines)
Lines 984-990 Link Here
984
{
984
{
985
    m_theme = selectedTheme = current.data(ThemeModel::ActualNameRole).toString();
985
    m_theme = selectedTheme = current.data(ThemeModel::ActualNameRole).toString();
986
    m_themeID = current.row();
986
    m_themeID = current.row();
987
    QIcon icon = qVariantValue<QIcon>(current.data(Qt::DecorationRole));
987
    QIcon icon = current.data(Qt::DecorationRole).value<QIcon>();
988
    //QSize iconSize = icon.actualSize(QSize(65535, 65535));
988
    //QSize iconSize = icon.actualSize(QSize(65535, 65535));
989
    //btnTheme->setFixedHeight(64);
989
    //btnTheme->setFixedHeight(64);
990
    //btnTheme->setIconSize(iconSize);
990
    //btnTheme->setIconSize(iconSize);
(-)a/QTfrontend/util/FileEngine.h (-22 / +14 lines)
Lines 1-9 Link Here
1
#ifndef _FileEngine_h
1
#ifndef _FileEngine_h
2
#define _FileEngine_h
2
#define _FileEngine_h
3
3
4
#include <QAbstractFileEngine>
4
#include <private/qabstractfileengine_p.h>
5
#include <QAbstractFileEngineHandler>
6
#include <QAbstractFileEngineIterator>
7
#include <QDateTime>
5
#include <QDateTime>
8
6
9
#include "physfs.h"
7
#include "physfs.h"
10
-- a/QTfrontend/game.cpp
8
++ b/QTfrontend/game.cpp
Lines 536-542 void HWGame::abort() Link Here
536
void HWGame::sendCampaignVar(const QByteArray &varToSend)
536
void HWGame::sendCampaignVar(const QByteArray &varToSend)
537
{
537
{
538
    QString varToFind = QString::fromUtf8(varToSend);
538
    QString varToFind = QString::fromUtf8(varToSend);
539
    QSettings teamfile(QString("physfs://Teams/%1.hwt").arg(campaignTeam), QSettings::IniFormat, 0);
539
    QSettings teamfile(QString(cfgdir->absolutePath() + "/Teams/%1.hwt").arg(campaignTeam), QSettings::IniFormat, 0);
540
    teamfile.setIniCodec("UTF-8");
540
    teamfile.setIniCodec("UTF-8");
541
    QString varValue = teamfile.value("Campaign " + campaign + "/" + varToFind, "").toString();
541
    QString varValue = teamfile.value("Campaign " + campaign + "/" + varToFind, "").toString();
542
    QByteArray command;
542
    QByteArray command;
Lines 553-559 void HWGame::writeCampaignVar(const QByteArray & varVal) Link Here
553
    QString varToWrite = QString::fromUtf8(varVal.left(i));
553
    QString varToWrite = QString::fromUtf8(varVal.left(i));
554
    QString varValue = QString::fromUtf8(varVal.mid(i + 1));
554
    QString varValue = QString::fromUtf8(varVal.mid(i + 1));
555
555
556
    QSettings teamfile(QString("physfs://Teams/%1.hwt").arg(campaignTeam), QSettings::IniFormat, 0);
556
    QSettings teamfile(QString(cfgdir->absolutePath() + "/Teams/%1.hwt").arg(campaignTeam), QSettings::IniFormat, 0);
557
    teamfile.setIniCodec("UTF-8");
557
    teamfile.setIniCodec("UTF-8");
558
    teamfile.setValue("Campaign " + campaign + "/" + varToWrite, varValue);
558
    teamfile.setValue("Campaign " + campaign + "/" + varToWrite, varValue);
559
}
559
}
560
-- a/QTfrontend/team.cpp
560
++ b/QTfrontend/team.cpp
Lines 171-177 HWTeam & HWTeam::operator = (const HWTeam & other) Link Here
171
171
172
bool HWTeam::loadFromFile()
172
bool HWTeam::loadFromFile()
173
{
173
{
174
    QSettings teamfile(QString("physfs://Teams/%1.hwt").arg(DataManager::safeFileName(m_name)), QSettings::IniFormat, 0);
174
    QSettings teamfile(QString(cfgdir->absolutePath() + "/Teams/%1.hwt").arg(DataManager::safeFileName(m_name)), QSettings::IniFormat, 0);
175
    teamfile.setIniCodec("UTF-8");
175
    teamfile.setIniCodec("UTF-8");
176
    m_name = teamfile.value("Team/Name", m_name).toString();
176
    m_name = teamfile.value("Team/Name", m_name).toString();
177
    m_grave = teamfile.value("Team/Grave", "Statue").toString();
177
    m_grave = teamfile.value("Team/Grave", "Statue").toString();
Lines 204-210 bool HWTeam::loadFromFile() Link Here
204
204
205
bool HWTeam::fileExists()
205
bool HWTeam::fileExists()
206
{
206
{
207
    QFile f(QString("physfs://Teams/%1.hwt").arg(DataManager::safeFileName(m_name)));
207
    QFile f(QString(cfgdir->absolutePath() + "/Teams/%1.hwt").arg(DataManager::safeFileName(m_name)));
208
    return f.exists();
208
    return f.exists();
209
}
209
}
210
210
Lines 220-226 bool HWTeam::deleteFile() Link Here
220
{
220
{
221
    if(m_isNetTeam)
221
    if(m_isNetTeam)
222
        return false;
222
        return false;
223
    QFile cfgfile(QString("physfs://Teams/%1.hwt").arg(DataManager::safeFileName(m_name)));
223
    QFile cfgfile(QString(cfgdir->absolutePath() + "/Teams/%1.hwt").arg(DataManager::safeFileName(m_name)));
224
    cfgfile.remove();
224
    cfgfile.remove();
225
    return true;
225
    return true;
226
}
226
}
Lines 229-240 bool HWTeam::saveToFile() Link Here
229
{
229
{
230
    if (OldTeamName != m_name)
230
    if (OldTeamName != m_name)
231
    {
231
    {
232
        QFile cfgfile(QString("physfs://Teams/%1.hwt").arg(DataManager::safeFileName(OldTeamName)));
232
        QFile cfgfile(QString(cfgdir->absolutePath() + "/Teams/%1.hwt").arg(DataManager::safeFileName(OldTeamName)));
233
        cfgfile.remove();
233
        cfgfile.remove();
234
        OldTeamName = m_name;
234
        OldTeamName = m_name;
235
    }
235
    }
236
236
237
    QString fileName = QString("physfs://Teams/%1.hwt").arg(DataManager::safeFileName(m_name));
237
    QString fileName = QString(cfgdir->absolutePath() + "/Teams/%1.hwt").arg(DataManager::safeFileName(m_name));
238
    DataManager::ensureFileExists(fileName);
238
    DataManager::ensureFileExists(fileName);
239
    QSettings teamfile(fileName, QSettings::IniFormat, 0);
239
    QSettings teamfile(fileName, QSettings::IniFormat, 0);
240
    teamfile.setIniCodec("UTF-8");
240
    teamfile.setIniCodec("UTF-8");
241
-- a/QTfrontend/ui/page/pagedata.cpp
241
++ b/QTfrontend/ui/page/pagedata.cpp
Lines 31-38 Link Here
31
#include "pagedata.h"
31
#include "pagedata.h"
32
#include "databrowser.h"
32
#include "databrowser.h"
33
#include "hwconsts.h"
33
#include "hwconsts.h"
34
#include "DataManager.h"
35
#include "FileEngine.h"
36
34
37
QLayout * PageDataDownload::bodyLayoutDefinition()
35
QLayout * PageDataDownload::bodyLayoutDefinition()
38
{
36
{
Lines 197-205 void PageDataDownload::fileDownloaded() Link Here
197
        out.write(reply->readAll());
195
        out.write(reply->readAll());
198
196
199
        out.close();
197
        out.close();
200
201
        // now mount it
202
        FileEngineHandler::mount(fileName);
203
    }
198
    }
204
}
199
}
205
200
Lines 229-235 void PageDataDownload::onPageLeave() Link Here
229
    if (m_contentDownloaded)
224
    if (m_contentDownloaded)
230
    {
225
    {
231
        m_contentDownloaded = false;
226
        m_contentDownloaded = false;
232
        //DataManager::instance().reload();
233
    }
227
    }
234
}
228
}
235
229
236
-- a/QTfrontend/util/DataManager.cpp
230
++ b/QTfrontend/util/DataManager.cpp
Lines 172-182 QString DataManager::settingsFileName() Link Here
172
{
172
{
173
    if(m_settingsFileName.isEmpty())
173
    if(m_settingsFileName.isEmpty())
174
    {
174
    {
175
        QFile settingsFile("physfs://settings.ini");
175
        QFile settingsFile(cfgdir->absoluteFilePath("settings.ini"));
176
176
177
        if(!settingsFile.exists())
177
        if(!settingsFile.exists())
178
        {
178
        {
179
            QFile oldSettingsFile("physfs://hedgewars.ini");
179
            QFile oldSettingsFile(cfgdir->absoluteFilePath("hedgewars.ini"));
180
180
181
            settingsFile.open(QFile::WriteOnly);
181
            settingsFile.open(QFile::WriteOnly);
182
            settingsFile.close();
182
            settingsFile.close();

Return to bug 651810