qt 5.15 compatibility (#4027)
This commit is contained in:
parent
0f0e0193c1
commit
7fa1936d0f
27 changed files with 101 additions and 39 deletions
|
@ -22,7 +22,7 @@ private:
|
||||||
CardInfoText *text;
|
CardInfoText *text;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CardInfoWidget(const QString &cardName, QWidget *parent = nullptr, Qt::WindowFlags f = nullptr);
|
explicit CardInfoWidget(const QString &cardName, QWidget *parent = nullptr, Qt::WindowFlags f = {});
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setCard(CardInfoPtr card);
|
void setCard(CardInfoPtr card);
|
||||||
|
|
|
@ -219,7 +219,11 @@ void ChatView::appendMessage(QString message,
|
||||||
cursor.setCharFormat(defaultFormat);
|
cursor.setCharFormat(defaultFormat);
|
||||||
|
|
||||||
bool mentionEnabled = settingsCache->getChatMention();
|
bool mentionEnabled = settingsCache->getChatMention();
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||||
|
highlightedWords = settingsCache->getHighlightWords().split(' ', Qt::SkipEmptyParts);
|
||||||
|
#else
|
||||||
highlightedWords = settingsCache->getHighlightWords().split(' ', QString::SkipEmptyParts);
|
highlightedWords = settingsCache->getHighlightWords().split(' ', QString::SkipEmptyParts);
|
||||||
|
#endif
|
||||||
|
|
||||||
// parse the message
|
// parse the message
|
||||||
while (message.size()) {
|
while (message.size()) {
|
||||||
|
|
|
@ -81,7 +81,7 @@ public:
|
||||||
bool optionalIsBold = false,
|
bool optionalIsBold = false,
|
||||||
QString optionalFontColor = QString());
|
QString optionalFontColor = QString());
|
||||||
void appendMessage(QString message,
|
void appendMessage(QString message,
|
||||||
RoomMessageTypeFlags messageType = 0,
|
RoomMessageTypeFlags messageType = {},
|
||||||
QString sender = QString(),
|
QString sender = QString(),
|
||||||
UserLevelFlags userLevel = UserLevelFlags(),
|
UserLevelFlags userLevel = UserLevelFlags(),
|
||||||
QString UserPrivLevel = "NONE",
|
QString UserPrivLevel = "NONE",
|
||||||
|
|
|
@ -195,7 +195,7 @@ QModelIndex DeckListModel::parent(const QModelIndex &ind) const
|
||||||
Qt::ItemFlags DeckListModel::flags(const QModelIndex &index) const
|
Qt::ItemFlags DeckListModel::flags(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if (!index.isValid()) {
|
if (!index.isValid()) {
|
||||||
return nullptr;
|
return Qt::NoItemFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt::ItemFlags result = Qt::ItemIsEnabled;
|
Qt::ItemFlags result = Qt::ItemIsEnabled;
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
DlgEditAvatar::DlgEditAvatar(QWidget *parent) : QDialog(parent)
|
DlgEditAvatar::DlgEditAvatar(QWidget *parent) : QDialog(parent), image()
|
||||||
{
|
{
|
||||||
imageLabel = new QLabel(tr("No image chosen."));
|
imageLabel = new QLabel(tr("No image chosen."));
|
||||||
imageLabel->setFixedSize(400, 200);
|
imageLabel->setFixedSize(400, 200);
|
||||||
|
@ -55,7 +55,6 @@ void DlgEditAvatar::actBrowse()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage image;
|
|
||||||
QImageReader imgReader;
|
QImageReader imgReader;
|
||||||
imgReader.setDecideFormatFromContent(true);
|
imgReader.setDecideFormatFromContent(true);
|
||||||
imgReader.setFileName(fileName);
|
imgReader.setFileName(fileName);
|
||||||
|
@ -69,13 +68,9 @@ void DlgEditAvatar::actBrowse()
|
||||||
|
|
||||||
QByteArray DlgEditAvatar::getImage()
|
QByteArray DlgEditAvatar::getImage()
|
||||||
{
|
{
|
||||||
const QPixmap *pix = imageLabel->pixmap();
|
if (image.isNull()) {
|
||||||
if (!pix || pix->isNull())
|
|
||||||
return QByteArray();
|
|
||||||
|
|
||||||
QImage image = pix->toImage();
|
|
||||||
if (image.isNull())
|
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
|
}
|
||||||
|
|
||||||
QByteArray ba;
|
QByteArray ba;
|
||||||
QBuffer buffer(&ba);
|
QBuffer buffer(&ba);
|
||||||
|
|
|
@ -20,6 +20,7 @@ private slots:
|
||||||
void actBrowse();
|
void actBrowse();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
QImage image;
|
||||||
QLabel *textLabel, *imageLabel;
|
QLabel *textLabel, *imageLabel;
|
||||||
QPushButton *browseButton;
|
QPushButton *browseButton;
|
||||||
};
|
};
|
||||||
|
|
|
@ -174,11 +174,11 @@ Qt::ItemFlags FilterTreeModel::flags(const QModelIndex &index) const
|
||||||
Qt::ItemFlags result;
|
Qt::ItemFlags result;
|
||||||
|
|
||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
return 0;
|
return Qt::NoItemFlags;
|
||||||
|
|
||||||
node = indexToNode(index);
|
node = indexToNode(index);
|
||||||
if (node == NULL)
|
if (node == NULL)
|
||||||
return 0;
|
return Qt::NoItemFlags;
|
||||||
|
|
||||||
result = Qt::ItemIsEnabled;
|
result = Qt::ItemIsEnabled;
|
||||||
if (node == fTree)
|
if (node == fTree)
|
||||||
|
|
|
@ -53,10 +53,17 @@ void Logger::openLogfileSession()
|
||||||
fileHandle.setFileName(LOGGER_FILENAME);
|
fileHandle.setFileName(LOGGER_FILENAME);
|
||||||
fileHandle.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text);
|
fileHandle.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text);
|
||||||
fileStream.setDevice(&fileHandle);
|
fileStream.setDevice(&fileHandle);
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||||
|
fileStream << "Log session started at " << QDateTime::currentDateTime().toString() << Qt::endl;
|
||||||
|
fileStream << getClientVersion() << Qt::endl;
|
||||||
|
fileStream << getSystemArchitecture() << Qt::endl;
|
||||||
|
fileStream << getClientInstallInfo() << Qt::endl;
|
||||||
|
#else
|
||||||
fileStream << "Log session started at " << QDateTime::currentDateTime().toString() << endl;
|
fileStream << "Log session started at " << QDateTime::currentDateTime().toString() << endl;
|
||||||
fileStream << getClientVersion() << endl;
|
fileStream << getClientVersion() << endl;
|
||||||
fileStream << getSystemArchitecture() << endl;
|
fileStream << getSystemArchitecture() << endl;
|
||||||
fileStream << getClientInstallInfo() << endl;
|
fileStream << getClientInstallInfo() << endl;
|
||||||
|
#endif
|
||||||
logToFileEnabled = true;
|
logToFileEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +73,11 @@ void Logger::closeLogfileSession()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
logToFileEnabled = false;
|
logToFileEnabled = false;
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||||
|
fileStream << "Log session closed at " << QDateTime::currentDateTime().toString() << Qt::endl;
|
||||||
|
#else
|
||||||
fileStream << "Log session closed at " << QDateTime::currentDateTime().toString() << endl;
|
fileStream << "Log session closed at " << QDateTime::currentDateTime().toString() << endl;
|
||||||
|
#endif
|
||||||
fileHandle.close();
|
fileHandle.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,8 +98,13 @@ void Logger::internalLog(QString message)
|
||||||
emit logEntryAdded(message);
|
emit logEntryAdded(message);
|
||||||
std::cerr << message.toStdString() << std::endl; // Print to stdout
|
std::cerr << message.toStdString() << std::endl; // Print to stdout
|
||||||
|
|
||||||
if (logToFileEnabled)
|
if (logToFileEnabled) {
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||||
|
fileStream << message << Qt::endl; // Print to fileStream
|
||||||
|
#else
|
||||||
fileStream << message << endl; // Print to fileStream
|
fileStream << message << endl; // Print to fileStream
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Logger::getSystemArchitecture()
|
QString Logger::getSystemArchitecture()
|
||||||
|
|
|
@ -144,7 +144,6 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
QLocale::setDefault(QLocale::English);
|
QLocale::setDefault(QLocale::English);
|
||||||
|
|
||||||
qsrand(QDateTime::currentDateTime().toTime_t());
|
|
||||||
qDebug("main(): starting main program");
|
qDebug("main(): starting main program");
|
||||||
|
|
||||||
MainWindow ui;
|
MainWindow ui;
|
||||||
|
|
|
@ -558,7 +558,7 @@ void MessageLogWidget::logRollDie(Player *player, int sides, int roll)
|
||||||
|
|
||||||
void MessageLogWidget::logSay(Player *player, QString message)
|
void MessageLogWidget::logSay(Player *player, QString message)
|
||||||
{
|
{
|
||||||
appendMessage(std::move(message), nullptr, player->getName(), UserLevelFlags(player->getUserInfo()->user_level()),
|
appendMessage(std::move(message), {}, player->getName(), UserLevelFlags(player->getUserInfo()->user_level()),
|
||||||
QString::fromStdString(player->getUserInfo()->privlevel()), true);
|
QString::fromStdString(player->getUserInfo()->privlevel()), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -740,7 +740,7 @@ void MessageLogWidget::logSpectatorSay(QString spectatorName,
|
||||||
QString userPrivLevel,
|
QString userPrivLevel,
|
||||||
QString message)
|
QString message)
|
||||||
{
|
{
|
||||||
appendMessage(std::move(message), nullptr, spectatorName, spectatorUserLevel, userPrivLevel, false);
|
appendMessage(std::move(message), {}, spectatorName, spectatorUserLevel, userPrivLevel, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageLogWidget::logStopDumpZone(Player *player, CardZone *zone)
|
void MessageLogWidget::logStopDumpZone(Player *player, CardZone *zone)
|
||||||
|
|
|
@ -203,8 +203,9 @@ QModelIndex RemoteDeckList_TreeModel::parent(const QModelIndex &ind) const
|
||||||
|
|
||||||
Qt::ItemFlags RemoteDeckList_TreeModel::flags(const QModelIndex &index) const
|
Qt::ItemFlags RemoteDeckList_TreeModel::flags(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if (!index.isValid())
|
if (!index.isValid()) {
|
||||||
return 0;
|
return Qt::NoItemFlags;
|
||||||
|
}
|
||||||
|
|
||||||
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
||||||
}
|
}
|
||||||
|
|
|
@ -199,7 +199,7 @@ QModelIndex RemoteReplayList_TreeModel::parent(const QModelIndex &ind) const
|
||||||
Qt::ItemFlags RemoteReplayList_TreeModel::flags(const QModelIndex &index) const
|
Qt::ItemFlags RemoteReplayList_TreeModel::flags(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
return 0;
|
return Qt::NoItemFlags;
|
||||||
|
|
||||||
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "replay_timeline_widget.h"
|
#include "replay_timeline_widget.h"
|
||||||
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
#include <QPainterPath>
|
||||||
#include <QPalette>
|
#include <QPalette>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
|
@ -96,7 +96,7 @@ QVariant SetsModel::headerData(int section, Qt::Orientation orientation, int rol
|
||||||
Qt::ItemFlags SetsModel::flags(const QModelIndex &index) const
|
Qt::ItemFlags SetsModel::flags(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
return 0;
|
return Qt::NoItemFlags;
|
||||||
|
|
||||||
Qt::ItemFlags flags = QAbstractTableModel::flags(index) | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled;
|
Qt::ItemFlags flags = QAbstractTableModel::flags(index) | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled;
|
||||||
|
|
||||||
|
@ -195,12 +195,12 @@ void SetsModel::swapRows(int oldRow, int newRow)
|
||||||
|
|
||||||
void SetsModel::sort(int column, Qt::SortOrder order)
|
void SetsModel::sort(int column, Qt::SortOrder order)
|
||||||
{
|
{
|
||||||
QMap<QString, CardSetPtr> setMap;
|
QMultiMap<QString, CardSetPtr> setMap;
|
||||||
int numRows = rowCount();
|
int numRows = rowCount();
|
||||||
int row;
|
int row;
|
||||||
|
|
||||||
for (row = 0; row < numRows; ++row)
|
for (row = 0; row < numRows; ++row)
|
||||||
setMap.insertMulti(index(row, column).data(SetsModel::SortRole).toString(), sets.at(row));
|
setMap.insert(index(row, column).data(SetsModel::SortRole).toString(), sets.at(row));
|
||||||
|
|
||||||
QList<CardSetPtr> tmp = setMap.values();
|
QList<CardSetPtr> tmp = setMap.values();
|
||||||
sets.clear();
|
sets.clear();
|
||||||
|
|
|
@ -123,7 +123,7 @@ void TabMessage::processUserMessageEvent(const Event_UserMessage &event)
|
||||||
const UserLevelFlags userLevel(userInfo->user_level());
|
const UserLevelFlags userLevel(userInfo->user_level());
|
||||||
const QString userPriv = QString::fromStdString(userInfo->privlevel());
|
const QString userPriv = QString::fromStdString(userInfo->privlevel());
|
||||||
|
|
||||||
chatView->appendMessage(QString::fromStdString(event.message()), 0, QString::fromStdString(event.sender_name()),
|
chatView->appendMessage(QString::fromStdString(event.message()), {}, QString::fromStdString(event.sender_name()),
|
||||||
userLevel, userPriv, true);
|
userLevel, userPriv, true);
|
||||||
if (tabSupervisor->currentIndex() != tabSupervisor->indexOf(this))
|
if (tabSupervisor->currentIndex() != tabSupervisor->indexOf(this))
|
||||||
soundEngine->playSound("private_message");
|
soundEngine->playSound("private_message");
|
||||||
|
|
|
@ -20,7 +20,7 @@ private:
|
||||||
QPushButton editButton, passwordButton, avatarButton;
|
QPushButton editButton, passwordButton, avatarButton;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UserInfoBox(AbstractClient *_client, bool editable, QWidget *parent = nullptr, Qt::WindowFlags flags = 0);
|
UserInfoBox(AbstractClient *_client, bool editable, QWidget *parent = nullptr, Qt::WindowFlags flags = {});
|
||||||
void retranslateUi();
|
void retranslateUi();
|
||||||
private slots:
|
private slots:
|
||||||
void processResponse(const Response &r);
|
void processResponse(const Response &r);
|
||||||
|
|
|
@ -1120,7 +1120,7 @@ void MainWindow::actCheckCardUpdates()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cardUpdateProcess->start("\"" + updaterCmd + "\"");
|
cardUpdateProcess->start("\"" + updaterCmd + "\"", QStringList());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::cardUpdateError(QProcess::ProcessError err)
|
void MainWindow::cardUpdateError(QProcess::ProcessError err)
|
||||||
|
|
|
@ -84,15 +84,15 @@ ZoneViewWidget::ZoneViewWidget(Player *_player,
|
||||||
scrollBar->setSingleStep(20);
|
scrollBar->setSingleStep(20);
|
||||||
scrollBar->setPageStep(200);
|
scrollBar->setPageStep(200);
|
||||||
connect(scrollBar, SIGNAL(valueChanged(int)), this, SLOT(handleScrollBarChange(int)));
|
connect(scrollBar, SIGNAL(valueChanged(int)), this, SLOT(handleScrollBarChange(int)));
|
||||||
QGraphicsProxyWidget *scrollBarProxy = new QGraphicsProxyWidget;
|
scrollBarProxy = new ScrollableGraphicsProxyWidget;
|
||||||
scrollBarProxy->setWidget(scrollBar);
|
scrollBarProxy->setWidget(scrollBar);
|
||||||
zoneHBox->addItem(scrollBarProxy);
|
zoneHBox->addItem(scrollBarProxy);
|
||||||
|
|
||||||
vbox->addItem(zoneHBox);
|
vbox->addItem(zoneHBox);
|
||||||
|
|
||||||
zone = new ZoneViewZone(player, _origZone, numberCards, _revealZone, _writeableRevealZone, zoneContainer);
|
zone = new ZoneViewZone(player, _origZone, numberCards, _revealZone, _writeableRevealZone, zoneContainer);
|
||||||
connect(zone, SIGNAL(wheelEventReceived(QGraphicsSceneWheelEvent *)), this,
|
connect(zone, SIGNAL(wheelEventReceived(QGraphicsSceneWheelEvent *)), scrollBarProxy,
|
||||||
SLOT(handleWheelEvent(QGraphicsSceneWheelEvent *)));
|
SLOT(recieveWheelEvent(QGraphicsSceneWheelEvent *)));
|
||||||
|
|
||||||
// numberCard is the num of cards we want to reveal from an area. Ex: scry the top 3 cards.
|
// numberCard is the num of cards we want to reveal from an area. Ex: scry the top 3 cards.
|
||||||
// If the number is < 0 then it means that we can make the area sorted and we dont care about the order.
|
// If the number is < 0 then it means that we can make the area sorted and we dont care about the order.
|
||||||
|
@ -192,12 +192,6 @@ void ZoneViewWidget::resizeToZoneContents()
|
||||||
layout()->invalidate();
|
layout()->invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZoneViewWidget::handleWheelEvent(QGraphicsSceneWheelEvent *event)
|
|
||||||
{
|
|
||||||
QWheelEvent wheelEvent(QPoint(), event->delta(), event->buttons(), event->modifiers(), event->orientation());
|
|
||||||
scrollBar->event(&wheelEvent);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ZoneViewWidget::handleScrollBarChange(int value)
|
void ZoneViewWidget::handleScrollBarChange(int value)
|
||||||
{
|
{
|
||||||
zone->setY(-value);
|
zone->setY(-value);
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#define ZONEVIEWWIDGET_H
|
#define ZONEVIEWWIDGET_H
|
||||||
|
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
|
#include <QGraphicsProxyWidget>
|
||||||
#include <QGraphicsWidget>
|
#include <QGraphicsWidget>
|
||||||
|
|
||||||
class QLabel;
|
class QLabel;
|
||||||
|
@ -18,6 +19,16 @@ class QGraphicsSceneMouseEvent;
|
||||||
class QGraphicsSceneWheelEvent;
|
class QGraphicsSceneWheelEvent;
|
||||||
class QStyleOption;
|
class QStyleOption;
|
||||||
|
|
||||||
|
class ScrollableGraphicsProxyWidget : public QGraphicsProxyWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public slots:
|
||||||
|
void recieveWheelEvent(QGraphicsSceneWheelEvent *event)
|
||||||
|
{
|
||||||
|
wheelEvent(event);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class ZoneViewWidget : public QGraphicsWidget
|
class ZoneViewWidget : public QGraphicsWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -27,6 +38,7 @@ private:
|
||||||
|
|
||||||
QPushButton *closeButton;
|
QPushButton *closeButton;
|
||||||
QScrollBar *scrollBar;
|
QScrollBar *scrollBar;
|
||||||
|
ScrollableGraphicsProxyWidget *scrollBarProxy;
|
||||||
QCheckBox sortByNameCheckBox;
|
QCheckBox sortByNameCheckBox;
|
||||||
QCheckBox sortByTypeCheckBox;
|
QCheckBox sortByTypeCheckBox;
|
||||||
QCheckBox shuffleCheckBox;
|
QCheckBox shuffleCheckBox;
|
||||||
|
@ -42,7 +54,6 @@ private slots:
|
||||||
void processSortByName(int value);
|
void processSortByName(int value);
|
||||||
void processSetPileView(int value);
|
void processSetPileView(int value);
|
||||||
void resizeToZoneContents();
|
void resizeToZoneContents();
|
||||||
void handleWheelEvent(QGraphicsSceneWheelEvent *event);
|
|
||||||
void handleScrollBarChange(int value);
|
void handleScrollBarChange(int value);
|
||||||
void zoneDeleted();
|
void zoneDeleted();
|
||||||
void moveEvent(QGraphicsSceneMoveEvent * /* event */);
|
void moveEvent(QGraphicsSceneMoveEvent * /* event */);
|
||||||
|
|
|
@ -216,7 +216,7 @@ int OracleImporter::importCardsFromSet(CardSetPtr currentSet, const QList<QVaria
|
||||||
{"rarity", "rarity"}};
|
{"rarity", "rarity"}};
|
||||||
|
|
||||||
int numCards = 0;
|
int numCards = 0;
|
||||||
QMap<QString, SplitCardPart> splitCards;
|
QMultiMap<QString, SplitCardPart> splitCards;
|
||||||
QString ptSeparator("/");
|
QString ptSeparator("/");
|
||||||
QVariantMap card;
|
QVariantMap card;
|
||||||
QString layout, name, text, colors, colorIdentity, maintype, power, toughness;
|
QString layout, name, text, colors, colorIdentity, maintype, power, toughness;
|
||||||
|
@ -338,7 +338,7 @@ int OracleImporter::importCardsFromSet(CardSetPtr currentSet, const QList<QVaria
|
||||||
// construct full card name
|
// construct full card name
|
||||||
name = additionalNames.join(QString(" // "));
|
name = additionalNames.join(QString(" // "));
|
||||||
SplitCardPart split(index, text, properties, setInfo);
|
SplitCardPart split(index, text, properties, setInfo);
|
||||||
splitCards.insertMulti(name, split);
|
splitCards.insert(name, split);
|
||||||
} else {
|
} else {
|
||||||
// relations
|
// relations
|
||||||
relatedCards.clear();
|
relatedCards.clear();
|
||||||
|
|
|
@ -110,7 +110,11 @@ void IslInterface::initServer()
|
||||||
|
|
||||||
socket->startServerEncryption();
|
socket->startServerEncryption();
|
||||||
if (!socket->waitForEncrypted(5000)) {
|
if (!socket->waitForEncrypted(5000)) {
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
|
||||||
|
QList<QSslError> sslErrors(socket->sslHandshakeErrors());
|
||||||
|
#else
|
||||||
QList<QSslError> sslErrors(socket->sslErrors());
|
QList<QSslError> sslErrors(socket->sslErrors());
|
||||||
|
#endif
|
||||||
if (sslErrors.isEmpty())
|
if (sslErrors.isEmpty())
|
||||||
qDebug() << "[ISL] SSL handshake timeout, terminating connection";
|
qDebug() << "[ISL] SSL handshake timeout, terminating connection";
|
||||||
else
|
else
|
||||||
|
@ -187,7 +191,11 @@ void IslInterface::initClient()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!socket->waitForEncrypted(5000)) {
|
if (!socket->waitForEncrypted(5000)) {
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
|
||||||
|
QList<QSslError> sslErrors(socket->sslHandshakeErrors());
|
||||||
|
#else
|
||||||
QList<QSslError> sslErrors(socket->sslErrors());
|
QList<QSslError> sslErrors(socket->sslErrors());
|
||||||
|
#endif
|
||||||
if (sslErrors.isEmpty())
|
if (sslErrors.isEmpty())
|
||||||
qDebug() << "[ISL] SSL handshake timeout, terminating connection";
|
qDebug() << "[ISL] SSL handshake timeout, terminating connection";
|
||||||
else
|
else
|
||||||
|
|
|
@ -265,7 +265,11 @@ bool Servatrice::initServer()
|
||||||
qDebug() << "Accept registered users only: " << getRegOnlyServerEnabled();
|
qDebug() << "Accept registered users only: " << getRegOnlyServerEnabled();
|
||||||
qDebug() << "Registration enabled: " << getRegistrationEnabled();
|
qDebug() << "Registration enabled: " << getRegistrationEnabled();
|
||||||
if (getRegistrationEnabled()) {
|
if (getRegistrationEnabled()) {
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||||
|
QStringList emailBlackListFilters = getEmailBlackList().split(",", Qt::SkipEmptyParts);
|
||||||
|
#else
|
||||||
QStringList emailBlackListFilters = getEmailBlackList().split(",", QString::SkipEmptyParts);
|
QStringList emailBlackListFilters = getEmailBlackList().split(",", QString::SkipEmptyParts);
|
||||||
|
#endif
|
||||||
qDebug() << "Email blacklist: " << emailBlackListFilters;
|
qDebug() << "Email blacklist: " << emailBlackListFilters;
|
||||||
qDebug() << "Require email address to register: " << getRequireEmailForRegistrationEnabled();
|
qDebug() << "Require email address to register: " << getRequireEmailForRegistrationEnabled();
|
||||||
qDebug() << "Require email activation via token: " << getRequireEmailActivationEnabled();
|
qDebug() << "Require email activation via token: " << getRequireEmailActivationEnabled();
|
||||||
|
@ -568,7 +572,11 @@ void Servatrice::setRequiredFeatures(const QString featureList)
|
||||||
FeatureSet features;
|
FeatureSet features;
|
||||||
serverRequiredFeatureList.clear();
|
serverRequiredFeatureList.clear();
|
||||||
features.initalizeFeatureList(serverRequiredFeatureList);
|
features.initalizeFeatureList(serverRequiredFeatureList);
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||||
|
QStringList listReqFeatures = featureList.split(",", Qt::SkipEmptyParts);
|
||||||
|
#else
|
||||||
QStringList listReqFeatures = featureList.split(",", QString::SkipEmptyParts);
|
QStringList listReqFeatures = featureList.split(",", QString::SkipEmptyParts);
|
||||||
|
#endif
|
||||||
if (!listReqFeatures.isEmpty())
|
if (!listReqFeatures.isEmpty())
|
||||||
foreach (QString reqFeature, listReqFeatures)
|
foreach (QString reqFeature, listReqFeatures)
|
||||||
features.enableRequiredFeature(serverRequiredFeatureList, reqFeature);
|
features.enableRequiredFeature(serverRequiredFeatureList, reqFeature);
|
||||||
|
|
|
@ -146,7 +146,11 @@ bool Servatrice_DatabaseInterface::usernameIsValid(const QString &user, QString
|
||||||
bool allowPunctuationPrefix = settingsCache->value("users/allowpunctuationprefix", false).toBool();
|
bool allowPunctuationPrefix = settingsCache->value("users/allowpunctuationprefix", false).toBool();
|
||||||
QString allowedPunctuation = settingsCache->value("users/allowedpunctuation", "_").toString();
|
QString allowedPunctuation = settingsCache->value("users/allowedpunctuation", "_").toString();
|
||||||
QString disallowedWordsStr = settingsCache->value("users/disallowedwords", "").toString();
|
QString disallowedWordsStr = settingsCache->value("users/disallowedwords", "").toString();
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||||
|
QStringList disallowedWords = disallowedWordsStr.split(",", Qt::SkipEmptyParts);
|
||||||
|
#else
|
||||||
QStringList disallowedWords = disallowedWordsStr.split(",", QString::SkipEmptyParts);
|
QStringList disallowedWords = disallowedWordsStr.split(",", QString::SkipEmptyParts);
|
||||||
|
#endif
|
||||||
disallowedWords.removeDuplicates();
|
disallowedWords.removeDuplicates();
|
||||||
QString disallowedRegExpStr = settingsCache->value("users/disallowedregexp", "").toString();
|
QString disallowedRegExpStr = settingsCache->value("users/disallowedregexp", "").toString();
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,11 @@ void ServerLogger::logMessage(QString message, void *caller)
|
||||||
// filter out all log entries based on values in configuration file
|
// filter out all log entries based on values in configuration file
|
||||||
bool shouldWeWriteLog = settingsCache->value("server/writelog", 1).toBool();
|
bool shouldWeWriteLog = settingsCache->value("server/writelog", 1).toBool();
|
||||||
QString logFilters = settingsCache->value("server/logfilters").toString();
|
QString logFilters = settingsCache->value("server/logfilters").toString();
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||||
|
QStringList listlogFilters = logFilters.split(",", Qt::SkipEmptyParts);
|
||||||
|
#else
|
||||||
QStringList listlogFilters = logFilters.split(",", QString::SkipEmptyParts);
|
QStringList listlogFilters = logFilters.split(",", QString::SkipEmptyParts);
|
||||||
|
#endif
|
||||||
bool shouldWeSkipLine = false;
|
bool shouldWeSkipLine = false;
|
||||||
|
|
||||||
if (!shouldWeWriteLog)
|
if (!shouldWeWriteLog)
|
||||||
|
|
|
@ -808,7 +808,11 @@ Response::ResponseCode AbstractServerSocketInterface::cmdGetWarnList(const Comma
|
||||||
Response_WarnList *re = new Response_WarnList;
|
Response_WarnList *re = new Response_WarnList;
|
||||||
|
|
||||||
QString officialWarnings = settingsCache->value("server/officialwarnings").toString();
|
QString officialWarnings = settingsCache->value("server/officialwarnings").toString();
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||||
|
QStringList warningsList = officialWarnings.split(",", Qt::SkipEmptyParts);
|
||||||
|
#else
|
||||||
QStringList warningsList = officialWarnings.split(",", QString::SkipEmptyParts);
|
QStringList warningsList = officialWarnings.split(",", QString::SkipEmptyParts);
|
||||||
|
#endif
|
||||||
foreach (QString warning, warningsList) {
|
foreach (QString warning, warningsList) {
|
||||||
re->add_warning(warning.toStdString());
|
re->add_warning(warning.toStdString());
|
||||||
}
|
}
|
||||||
|
@ -986,7 +990,11 @@ Response::ResponseCode AbstractServerSocketInterface::cmdRegisterAccount(const C
|
||||||
|
|
||||||
QString emailBlackList = servatrice->getEmailBlackList();
|
QString emailBlackList = servatrice->getEmailBlackList();
|
||||||
QString emailAddress = QString::fromStdString(cmd.email());
|
QString emailAddress = QString::fromStdString(cmd.email());
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||||
|
QStringList emailBlackListFilters = emailBlackList.split(",", Qt::SkipEmptyParts);
|
||||||
|
#else
|
||||||
QStringList emailBlackListFilters = emailBlackList.split(",", QString::SkipEmptyParts);
|
QStringList emailBlackListFilters = emailBlackList.split(",", QString::SkipEmptyParts);
|
||||||
|
#endif
|
||||||
|
|
||||||
// verify that users email/provider is not blacklisted
|
// verify that users email/provider is not blacklisted
|
||||||
if (!emailBlackList.trimmed().isEmpty()) {
|
if (!emailBlackList.trimmed().isEmpty()) {
|
||||||
|
|
|
@ -12,7 +12,11 @@ SettingsCache::SettingsCache(const QString &fileName, QSettings::Format format,
|
||||||
isPortableBuild = QFile::exists(qApp->applicationDirPath() + "/portable.dat");
|
isPortableBuild = QFile::exists(qApp->applicationDirPath() + "/portable.dat");
|
||||||
|
|
||||||
QStringList disallowedRegExpStr =
|
QStringList disallowedRegExpStr =
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||||
|
value("users/disallowedregexp", "").toString().split(",", Qt::SkipEmptyParts);
|
||||||
|
#else
|
||||||
value("users/disallowedregexp", "").toString().split(",", QString::SkipEmptyParts);
|
value("users/disallowedregexp", "").toString().split(",", QString::SkipEmptyParts);
|
||||||
|
#endif
|
||||||
disallowedRegExpStr.removeDuplicates();
|
disallowedRegExpStr.removeDuplicates();
|
||||||
for (const QString ®ExpStr : disallowedRegExpStr) {
|
for (const QString ®ExpStr : disallowedRegExpStr) {
|
||||||
disallowedRegExp.append(QRegExp(regExpStr));
|
disallowedRegExp.append(QRegExp(regExpStr));
|
||||||
|
|
|
@ -362,7 +362,11 @@ void QxtSmtpPrivate::authenticate()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||||
|
QStringList auth = extensions["AUTH"].toUpper().split(' ', Qt::SkipEmptyParts);
|
||||||
|
#else
|
||||||
QStringList auth = extensions["AUTH"].toUpper().split(' ', QString::SkipEmptyParts);
|
QStringList auth = extensions["AUTH"].toUpper().split(' ', QString::SkipEmptyParts);
|
||||||
|
#endif
|
||||||
if (auth.contains("CRAM-MD5"))
|
if (auth.contains("CRAM-MD5"))
|
||||||
{
|
{
|
||||||
authCramMD5();
|
authCramMD5();
|
||||||
|
|
Loading…
Reference in a new issue