mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-24 07:33:54 -07:00
QT_VERSION <6.0
This commit is contained in:
parent
fa77b696d0
commit
e2c89c2a1a
37 changed files with 8 additions and 260 deletions
|
|
@ -2,13 +2,10 @@
|
||||||
|
|
||||||
#include "settings/cache_settings.h"
|
#include "settings/cache_settings.h"
|
||||||
|
|
||||||
|
#include <QAudioOutput>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QMediaPlayer>
|
#include <QMediaPlayer>
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
#include <QAudioOutput>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define DEFAULT_THEME_NAME "Default"
|
#define DEFAULT_THEME_NAME "Default"
|
||||||
#define TEST_SOUND_FILENAME "player_join"
|
#define TEST_SOUND_FILENAME "player_join"
|
||||||
|
|
||||||
|
|
@ -40,10 +37,8 @@ void SoundEngine::soundEnabledChanged()
|
||||||
qCInfo(SoundEngineLog) << "SoundEngine: enabling sound with" << audioData.size() << "sounds";
|
qCInfo(SoundEngineLog) << "SoundEngine: enabling sound with" << audioData.size() << "sounds";
|
||||||
if (!player) {
|
if (!player) {
|
||||||
player = new QMediaPlayer;
|
player = new QMediaPlayer;
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
audioOutput = new QAudioOutput(player);
|
audioOutput = new QAudioOutput(player);
|
||||||
player->setAudioOutput(audioOutput);
|
player->setAudioOutput(audioOutput);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
qCInfo(SoundEngineLog) << "SoundEngine: disabling sound";
|
qCInfo(SoundEngineLog) << "SoundEngine: disabling sound";
|
||||||
|
|
@ -71,13 +66,8 @@ void SoundEngine::playSound(const QString &fileName)
|
||||||
|
|
||||||
player->stop();
|
player->stop();
|
||||||
int volumeSliderValue = SettingsCache::instance().getMasterVolume();
|
int volumeSliderValue = SettingsCache::instance().getMasterVolume();
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
player->audioOutput()->setVolume(qreal(volumeSliderValue) / 100);
|
player->audioOutput()->setVolume(qreal(volumeSliderValue) / 100);
|
||||||
player->setSource(QUrl::fromLocalFile(audioData[fileName]));
|
player->setSource(QUrl::fromLocalFile(audioData[fileName]));
|
||||||
#else
|
|
||||||
player->setVolume(volumeSliderValue);
|
|
||||||
player->setMedia(QUrl::fromLocalFile(audioData[fileName]));
|
|
||||||
#endif
|
|
||||||
player->play();
|
player->play();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1385,11 +1385,7 @@ void PlayerActions::actSetPT()
|
||||||
const auto oldpt = parsePT(card->getPT());
|
const auto oldpt = parsePT(card->getPT());
|
||||||
int ptIter = 0;
|
int ptIter = 0;
|
||||||
for (const auto &_item : ptList) {
|
for (const auto &_item : ptList) {
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
if (_item.typeId() == QMetaType::Type::Int) {
|
if (_item.typeId() == QMetaType::Type::Int) {
|
||||||
#else
|
|
||||||
if (_item.type() == QVariant::Int) {
|
|
||||||
#endif
|
|
||||||
int oldItem = ptIter < oldpt.size() ? oldpt.at(ptIter).toInt() : 0;
|
int oldItem = ptIter < oldpt.size() ? oldpt.at(ptIter).toInt() : 0;
|
||||||
newpt += '/' + QString::number(oldItem + _item.toInt());
|
newpt += '/' + QString::number(oldItem + _item.toInt());
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -25,11 +25,7 @@ bool PlayerListItemDelegate::editorEvent(QEvent *event,
|
||||||
if ((event->type() == QEvent::MouseButtonPress) && index.isValid()) {
|
if ((event->type() == QEvent::MouseButtonPress) && index.isValid()) {
|
||||||
auto *const mouseEvent = static_cast<QMouseEvent *>(event);
|
auto *const mouseEvent = static_cast<QMouseEvent *>(event);
|
||||||
if (mouseEvent->button() == Qt::RightButton) {
|
if (mouseEvent->button() == Qt::RightButton) {
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
static_cast<PlayerListWidget *>(parent())->showContextMenu(mouseEvent->globalPosition().toPoint(), index);
|
static_cast<PlayerListWidget *>(parent())->showContextMenu(mouseEvent->globalPosition().toPoint(), index);
|
||||||
#else
|
|
||||||
static_cast<PlayerListWidget *>(parent())->showContextMenu(mouseEvent->globalPos(), index);
|
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -246,11 +246,7 @@ QSize CardInfoPictureWidget::sizeHint() const
|
||||||
* @brief Starts the hover timer to show the enlarged pixmap on hover.
|
* @brief Starts the hover timer to show the enlarged pixmap on hover.
|
||||||
* @param event The enter event.
|
* @param event The enter event.
|
||||||
*/
|
*/
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
void CardInfoPictureWidget::enterEvent(QEnterEvent *event)
|
void CardInfoPictureWidget::enterEvent(QEnterEvent *event)
|
||||||
#else
|
|
||||||
void CardInfoPictureWidget::enterEvent(QEvent *event)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
QWidget::enterEvent(event); // Call the base class implementation
|
QWidget::enterEvent(event); // Call the base class implementation
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,11 +48,7 @@ signals:
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent *event) override;
|
void resizeEvent(QResizeEvent *event) override;
|
||||||
void paintEvent(QPaintEvent *) override;
|
void paintEvent(QPaintEvent *) override;
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
void enterEvent(QEnterEvent *event) override;
|
||||||
void enterEvent(QEnterEvent *event) override; // Qt6 signature
|
|
||||||
#else
|
|
||||||
void enterEvent(QEvent *event) override; // Qt5 signature
|
|
||||||
#endif
|
|
||||||
void leaveEvent(QEvent *event) override;
|
void leaveEvent(QEvent *event) override;
|
||||||
void moveEvent(QMoveEvent *event) override;
|
void moveEvent(QMoveEvent *event) override;
|
||||||
void mouseMoveEvent(QMouseEvent *event) override;
|
void mouseMoveEvent(QMouseEvent *event) override;
|
||||||
|
|
|
||||||
|
|
@ -133,11 +133,7 @@ bool ResizablePanel::eventFilter(QObject *obj, QEvent *event)
|
||||||
if (event->type() == QEvent::MouseButtonPress) {
|
if (event->type() == QEvent::MouseButtonPress) {
|
||||||
auto *mouseEvent = static_cast<QMouseEvent *>(event);
|
auto *mouseEvent = static_cast<QMouseEvent *>(event);
|
||||||
if (mouseEvent->button() == Qt::LeftButton) {
|
if (mouseEvent->button() == Qt::LeftButton) {
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
dragStartPos = mouseEvent->globalPosition().toPoint();
|
dragStartPos = mouseEvent->globalPosition().toPoint();
|
||||||
#else
|
|
||||||
dragStartPos = mouseEvent->globalPos();
|
|
||||||
#endif
|
|
||||||
isDraggingPanel = false;
|
isDraggingPanel = false;
|
||||||
dragButton->setCursor(Qt::ClosedHandCursor);
|
dragButton->setCursor(Qt::ClosedHandCursor);
|
||||||
}
|
}
|
||||||
|
|
@ -145,11 +141,7 @@ bool ResizablePanel::eventFilter(QObject *obj, QEvent *event)
|
||||||
} else if (event->type() == QEvent::MouseMove) {
|
} else if (event->type() == QEvent::MouseMove) {
|
||||||
auto *mouseEvent = static_cast<QMouseEvent *>(event);
|
auto *mouseEvent = static_cast<QMouseEvent *>(event);
|
||||||
if (mouseEvent->buttons() & Qt::LeftButton) {
|
if (mouseEvent->buttons() & Qt::LeftButton) {
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
QPoint currentPos = mouseEvent->globalPosition().toPoint();
|
QPoint currentPos = mouseEvent->globalPosition().toPoint();
|
||||||
#else
|
|
||||||
QPoint currentPos = mouseEvent->globalPos();
|
|
||||||
#endif
|
|
||||||
int distance = (currentPos - dragStartPos).manhattanLength();
|
int distance = (currentPos - dragStartPos).manhattanLength();
|
||||||
if (distance >= 5 && !isDraggingPanel) {
|
if (distance >= 5 && !isDraggingPanel) {
|
||||||
isDraggingPanel = true;
|
isDraggingPanel = true;
|
||||||
|
|
@ -168,22 +160,14 @@ bool ResizablePanel::eventFilter(QObject *obj, QEvent *event)
|
||||||
if (obj == resizeHandle) {
|
if (obj == resizeHandle) {
|
||||||
if (event->type() == QEvent::MouseButtonPress) {
|
if (event->type() == QEvent::MouseButtonPress) {
|
||||||
auto *mouseEvent = static_cast<QMouseEvent *>(event);
|
auto *mouseEvent = static_cast<QMouseEvent *>(event);
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
resizeStartY = mouseEvent->globalPosition().y();
|
resizeStartY = mouseEvent->globalPosition().y();
|
||||||
#else
|
|
||||||
resizeStartY = mouseEvent->globalPos().y();
|
|
||||||
#endif
|
|
||||||
isResizing = true;
|
isResizing = true;
|
||||||
resizeStartHeight = currentHeight;
|
resizeStartHeight = currentHeight;
|
||||||
resizeHandle->grabMouse();
|
resizeHandle->grabMouse();
|
||||||
return true;
|
return true;
|
||||||
} else if (event->type() == QEvent::MouseMove && isResizing) {
|
} else if (event->type() == QEvent::MouseMove && isResizing) {
|
||||||
auto *mouseEvent = static_cast<QMouseEvent *>(event);
|
auto *mouseEvent = static_cast<QMouseEvent *>(event);
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
int deltaY = mouseEvent->globalPosition().y() - resizeStartY;
|
int deltaY = mouseEvent->globalPosition().y() - resizeStartY;
|
||||||
#else
|
|
||||||
int deltaY = mouseEvent->globalPos().y() - resizeStartY;
|
|
||||||
#endif
|
|
||||||
int newHeight = resizeStartHeight + deltaY;
|
int newHeight = resizeStartHeight + deltaY;
|
||||||
|
|
||||||
int minAllowed = getMinimumAllowedHeight();
|
int minAllowed = getMinimumAllowedHeight();
|
||||||
|
|
@ -207,11 +191,7 @@ void ResizablePanel::dragEnterEvent(QDragEnterEvent *event)
|
||||||
{
|
{
|
||||||
if (event->mimeData()->hasFormat("application/x-resizablepanel")) {
|
if (event->mimeData()->hasFormat("application/x-resizablepanel")) {
|
||||||
event->acceptProposedAction();
|
event->acceptProposedAction();
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
showDropIndicator(event->position().y());
|
showDropIndicator(event->position().y());
|
||||||
#else
|
|
||||||
showDropIndicator(event->pos().y());
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -219,13 +199,8 @@ void ResizablePanel::dragMoveEvent(QDragMoveEvent *event)
|
||||||
{
|
{
|
||||||
if (event->mimeData()->hasFormat("application/x-resizablepanel")) {
|
if (event->mimeData()->hasFormat("application/x-resizablepanel")) {
|
||||||
event->acceptProposedAction();
|
event->acceptProposedAction();
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
showDropIndicator(event->position().y());
|
showDropIndicator(event->position().y());
|
||||||
lastDragPos = mapToGlobal(event->position().toPoint());
|
lastDragPos = mapToGlobal(event->position().toPoint());
|
||||||
#else
|
|
||||||
showDropIndicator(event->pos().y());
|
|
||||||
lastDragPos = mapToGlobal(event->pos());
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!autoScrollTimer->isActive()) {
|
if (!autoScrollTimer->isActive()) {
|
||||||
autoScrollTimer->start();
|
autoScrollTimer->start();
|
||||||
|
|
@ -251,11 +226,7 @@ void ResizablePanel::dropEvent(QDropEvent *event)
|
||||||
ResizablePanel *draggedPanel = reinterpret_cast<ResizablePanel *>(ptr);
|
ResizablePanel *draggedPanel = reinterpret_cast<ResizablePanel *>(ptr);
|
||||||
|
|
||||||
if (draggedPanel && draggedPanel != this) {
|
if (draggedPanel && draggedPanel != this) {
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
bool insertBefore = (event->position().y() < height() / 2);
|
bool insertBefore = (event->position().y() < height() / 2);
|
||||||
#else
|
|
||||||
bool insertBefore = (event->pos().y() < height() / 2);
|
|
||||||
#endif
|
|
||||||
emit dropRequested(draggedPanel, this, insertBefore);
|
emit dropRequested(draggedPanel, this, insertBefore);
|
||||||
event->acceptProposedAction();
|
event->acceptProposedAction();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -320,11 +320,7 @@ void DlgSelectSetForCards::dropEvent(QDropEvent *event)
|
||||||
{
|
{
|
||||||
QByteArray itemData = event->mimeData()->data("application/x-setentrywidget");
|
QByteArray itemData = event->mimeData()->data("application/x-setentrywidget");
|
||||||
QString draggedSetName = QString::fromUtf8(itemData);
|
QString draggedSetName = QString::fromUtf8(itemData);
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
QPoint adjustedPos = event->position().toPoint() + QPoint(0, scrollArea->verticalScrollBar()->value());
|
QPoint adjustedPos = event->position().toPoint() + QPoint(0, scrollArea->verticalScrollBar()->value());
|
||||||
#else
|
|
||||||
QPoint adjustedPos = event->pos() + QPoint(0, scrollArea->verticalScrollBar()->value());
|
|
||||||
#endif
|
|
||||||
int dropIndex = -1;
|
int dropIndex = -1;
|
||||||
for (int i = 0; i < listLayout->count(); ++i) {
|
for (int i = 0; i < listLayout->count(); ++i) {
|
||||||
QWidget *widget = listLayout->itemAt(i)->widget();
|
QWidget *widget = listLayout->itemAt(i)->widget();
|
||||||
|
|
@ -489,11 +485,7 @@ void SetEntryWidget::mousePressEvent(QMouseEvent *event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
void SetEntryWidget::enterEvent(QEnterEvent *event)
|
void SetEntryWidget::enterEvent(QEnterEvent *event)
|
||||||
#else
|
|
||||||
void SetEntryWidget::enterEvent(QEvent *event)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
QWidget::enterEvent(event); // Call the base class handler
|
QWidget::enterEvent(event); // Call the base class handler
|
||||||
// Highlight the widget by changing the background color only for the widget itself
|
// Highlight the widget by changing the background color only for the widget itself
|
||||||
|
|
|
||||||
|
|
@ -87,11 +87,7 @@ public:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void mousePressEvent(QMouseEvent *event) override;
|
void mousePressEvent(QMouseEvent *event) override;
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
void enterEvent(QEnterEvent *event) override;
|
void enterEvent(QEnterEvent *event) override;
|
||||||
#else
|
|
||||||
void enterEvent(QEvent *event) override;
|
|
||||||
#endif
|
|
||||||
void leaveEvent(QEvent *event) override;
|
void leaveEvent(QEvent *event) override;
|
||||||
void dragMoveEvent(QDragMoveEvent *event) override;
|
void dragMoveEvent(QDragMoveEvent *event) override;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -204,11 +204,7 @@ void BarChartWidget::mouseMoveEvent(QMouseEvent *e)
|
||||||
if (hoveredSegment >= 0) {
|
if (hoveredSegment >= 0) {
|
||||||
const auto &s = segments[hoveredSegment];
|
const auto &s = segments[hoveredSegment];
|
||||||
QString text = QString("%1: %2 cards\n\n%3").arg(s.category).arg(s.value).arg(s.cards.join("\n"));
|
QString text = QString("%1: %2 cards\n\n%3").arg(s.category).arg(s.value).arg(s.cards.join("\n"));
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
QToolTip::showText(e->globalPosition().toPoint(), text, this);
|
QToolTip::showText(e->globalPosition().toPoint(), text, this);
|
||||||
#else
|
|
||||||
QToolTip::showText(e->globalPos(), text, this);
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
QToolTip::hideText();
|
QToolTip::hideText();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -79,19 +79,11 @@ void ColorBar::paintEvent(QPaintEvent *)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
void ColorBar::enterEvent(QEnterEvent *event)
|
void ColorBar::enterEvent(QEnterEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
isHovered = true;
|
isHovered = true;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void ColorBar::enterEvent(QEvent *event)
|
|
||||||
{
|
|
||||||
Q_UNUSED(event);
|
|
||||||
isHovered = true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void ColorBar::leaveEvent(QEvent *)
|
void ColorBar::leaveEvent(QEvent *)
|
||||||
{
|
{
|
||||||
|
|
@ -103,13 +95,8 @@ void ColorBar::mouseMoveEvent(QMouseEvent *event)
|
||||||
if (!isHovered || colors.isEmpty())
|
if (!isHovered || colors.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
int x = int(event->position().x());
|
int x = int(event->position().x());
|
||||||
QPoint gp = event->globalPosition().toPoint();
|
QPoint gp = event->globalPosition().toPoint();
|
||||||
#else
|
|
||||||
int x = event->pos().x();
|
|
||||||
QPoint gp = event->globalPos();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QString text = tooltipForPosition(x);
|
QString text = tooltipForPosition(x);
|
||||||
if (!text.isEmpty())
|
if (!text.isEmpty())
|
||||||
|
|
|
||||||
|
|
@ -76,17 +76,10 @@ protected:
|
||||||
*/
|
*/
|
||||||
void paintEvent(QPaintEvent *event) override;
|
void paintEvent(QPaintEvent *event) override;
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
/**
|
/**
|
||||||
* @brief Handles mouse hover entering (Qt6 version).
|
* @brief Handles mouse hover entering.
|
||||||
*/
|
*/
|
||||||
void enterEvent(QEnterEvent *event) override;
|
void enterEvent(QEnterEvent *event) override;
|
||||||
#else
|
|
||||||
/**
|
|
||||||
* @brief Handles mouse hover entering (Qt5 version).
|
|
||||||
*/
|
|
||||||
void enterEvent(QEvent *event) override;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Handles mouse hover leaving.
|
* @brief Handles mouse hover leaving.
|
||||||
|
|
|
||||||
|
|
@ -132,9 +132,5 @@ void SegmentedBarWidget::mouseMoveEvent(QMouseEvent *e)
|
||||||
const Segment &s = segments[idx];
|
const Segment &s = segments[idx];
|
||||||
QString text = QString("%1: %2 cards\n%3").arg(s.category).arg(s.value).arg(s.cards.join(", "));
|
QString text = QString("%1: %2 cards\n%3").arg(s.category).arg(s.value).arg(s.cards.join(", "));
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
QToolTip::showText(e->globalPosition().toPoint(), text, this);
|
QToolTip::showText(e->globalPosition().toPoint(), text, this);
|
||||||
#else
|
|
||||||
QToolTip::showText(e->globalPos(), text, this);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -82,11 +82,9 @@ void ColorPie::paintEvent(QPaintEvent *)
|
||||||
QString label = QString("%1%").arg(int(ratio * 100 + 0.5));
|
QString label = QString("%1%").arg(int(ratio * 100 + 0.5));
|
||||||
|
|
||||||
QFontMetrics fm(p.font());
|
QFontMetrics fm(p.font());
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
|
||||||
int labelWidth = fm.horizontalAdvance(label);
|
int labelWidth = fm.horizontalAdvance(label);
|
||||||
#else
|
|
||||||
int labelWidth = fm.width(label);
|
|
||||||
#endif
|
|
||||||
QRectF textRect(labelPos.x() - labelWidth / 2.0, labelPos.y() - fm.height() / 2.0, labelWidth, fm.height());
|
QRectF textRect(labelPos.x() - labelWidth / 2.0, labelPos.y() - fm.height() / 2.0, labelWidth, fm.height());
|
||||||
|
|
||||||
p.setPen(Qt::black);
|
p.setPen(Qt::black);
|
||||||
|
|
@ -96,19 +94,11 @@ void ColorPie::paintEvent(QPaintEvent *)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
void ColorPie::enterEvent(QEnterEvent *event)
|
void ColorPie::enterEvent(QEnterEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
isHovered = true;
|
isHovered = true;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void ColorPie::enterEvent(QEvent *event)
|
|
||||||
{
|
|
||||||
Q_UNUSED(event);
|
|
||||||
isHovered = true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void ColorPie::leaveEvent(QEvent *)
|
void ColorPie::leaveEvent(QEvent *)
|
||||||
{
|
{
|
||||||
|
|
@ -121,13 +111,8 @@ void ColorPie::mouseMoveEvent(QMouseEvent *event)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
QPoint p = event->position().toPoint();
|
QPoint p = event->position().toPoint();
|
||||||
QPoint gp = event->globalPosition().toPoint();
|
QPoint gp = event->globalPosition().toPoint();
|
||||||
#else
|
|
||||||
QPoint p = event->pos();
|
|
||||||
QPoint gp = event->globalPos();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QString text = tooltipForPoint(p);
|
QString text = tooltipForPoint(p);
|
||||||
if (!text.isEmpty()) {
|
if (!text.isEmpty()) {
|
||||||
|
|
|
||||||
|
|
@ -22,11 +22,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *) override;
|
void paintEvent(QPaintEvent *) override;
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
void enterEvent(QEnterEvent *event) override;
|
void enterEvent(QEnterEvent *event) override;
|
||||||
#else
|
|
||||||
void enterEvent(QEvent *event) override;
|
|
||||||
#endif
|
|
||||||
void leaveEvent(QEvent *) override;
|
void leaveEvent(QEvent *) override;
|
||||||
void mouseMoveEvent(QMouseEvent *event) override;
|
void mouseMoveEvent(QMouseEvent *event) override;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -114,11 +114,7 @@ bool AllZonesCardAmountWidget::isNonZero()
|
||||||
*
|
*
|
||||||
* @param event The event information for the mouse entry.
|
* @param event The event information for the mouse entry.
|
||||||
*/
|
*/
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
void AllZonesCardAmountWidget::enterEvent(QEnterEvent *event)
|
void AllZonesCardAmountWidget::enterEvent(QEnterEvent *event)
|
||||||
#else
|
|
||||||
void AllZonesCardAmountWidget::enterEvent(QEvent *event)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
QWidget::enterEvent(event);
|
QWidget::enterEvent(event);
|
||||||
update();
|
update();
|
||||||
|
|
|
||||||
|
|
@ -25,11 +25,7 @@ public:
|
||||||
int getSideboardAmount();
|
int getSideboardAmount();
|
||||||
bool isNonZero();
|
bool isNonZero();
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
void enterEvent(QEnterEvent *event) override;
|
void enterEvent(QEnterEvent *event) override;
|
||||||
#else
|
|
||||||
void enterEvent(QEvent *event) override;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void adjustFontSize(int scalePercentage);
|
void adjustFontSize(int scalePercentage);
|
||||||
|
|
|
||||||
|
|
@ -105,11 +105,7 @@ void PrintingSelectorCardOverlayWidget::resizeEvent(QResizeEvent *event)
|
||||||
*
|
*
|
||||||
* @param event The event triggered when the mouse enters the widget.
|
* @param event The event triggered when the mouse enters the widget.
|
||||||
*/
|
*/
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
void PrintingSelectorCardOverlayWidget::enterEvent(QEnterEvent *event)
|
void PrintingSelectorCardOverlayWidget::enterEvent(QEnterEvent *event)
|
||||||
#else
|
|
||||||
void PrintingSelectorCardOverlayWidget::enterEvent(QEvent *event)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
QWidget::enterEvent(event);
|
QWidget::enterEvent(event);
|
||||||
deckEditor->updateCard(rootCard);
|
deckEditor->updateCard(rootCard);
|
||||||
|
|
|
||||||
|
|
@ -26,11 +26,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent *event) override;
|
void resizeEvent(QResizeEvent *event) override;
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
void enterEvent(QEnterEvent *event) override;
|
void enterEvent(QEnterEvent *event) override;
|
||||||
#else
|
|
||||||
void enterEvent(QEvent *event) override;
|
|
||||||
#endif
|
|
||||||
void leaveEvent(QEvent *event) override;
|
void leaveEvent(QEvent *event) override;
|
||||||
void mousePressEvent(QMouseEvent *event) override;
|
void mousePressEvent(QMouseEvent *event) override;
|
||||||
void customMenu(QPoint point);
|
void customMenu(QPoint point);
|
||||||
|
|
|
||||||
|
|
@ -89,11 +89,7 @@ void SettingsButtonWidget::onPopupClosed() const
|
||||||
|
|
||||||
void SettingsButtonWidget::mousePressEvent(QMouseEvent *event)
|
void SettingsButtonWidget::mousePressEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
if (popup->isVisible() && !popup->geometry().contains(event->globalPosition().toPoint())) {
|
if (popup->isVisible() && !popup->geometry().contains(event->globalPosition().toPoint())) {
|
||||||
#else
|
|
||||||
if (popup->isVisible() && !popup->geometry().contains(event->globalPos())) {
|
|
||||||
#endif
|
|
||||||
popup->close();
|
popup->close();
|
||||||
}
|
}
|
||||||
QWidget::mousePressEvent(event);
|
QWidget::mousePressEvent(event);
|
||||||
|
|
|
||||||
|
|
@ -66,11 +66,7 @@ void ReplayTimelineWidget::paintEvent(QPaintEvent * /* event */)
|
||||||
|
|
||||||
void ReplayTimelineWidget::mousePressEvent(QMouseEvent *event)
|
void ReplayTimelineWidget::mousePressEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
int newTime = static_cast<int>((qint64)maxTime * (qint64)event->position().x() / width());
|
int newTime = static_cast<int>((qint64)maxTime * (qint64)event->position().x() / width());
|
||||||
#else
|
|
||||||
int newTime = static_cast<int>((qint64)maxTime * (qint64)event->x() / width());
|
|
||||||
#endif
|
|
||||||
// don't buffer rewinds from clicks, since clicks usually don't happen fast enough to require buffering
|
// don't buffer rewinds from clicks, since clicks usually don't happen fast enough to require buffering
|
||||||
skipToTime(newTime, false);
|
skipToTime(newTime, false);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -566,11 +566,7 @@ void ChatView::redactMessages(const QString &userName, int amount)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
void ChatView::enterEvent(QEnterEvent * /*event*/)
|
void ChatView::enterEvent(QEnterEvent * /*event*/)
|
||||||
#else
|
|
||||||
void ChatView::enterEvent(QEvent * /*event*/)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
}
|
}
|
||||||
|
|
@ -626,11 +622,7 @@ void ChatView::mousePressEvent(QMouseEvent *event)
|
||||||
switch (hoveredItemType) {
|
switch (hoveredItemType) {
|
||||||
case HoveredCard: {
|
case HoveredCard: {
|
||||||
if ((event->button() == Qt::MiddleButton) || (event->button() == Qt::LeftButton))
|
if ((event->button() == Qt::MiddleButton) || (event->button() == Qt::LeftButton))
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
emit showCardInfoPopup(event->globalPosition().toPoint(), {hoveredContent});
|
emit showCardInfoPopup(event->globalPosition().toPoint(), {hoveredContent});
|
||||||
#else
|
|
||||||
emit showCardInfoPopup(event->globalPos(), {hoveredContent});
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case HoveredUser: {
|
case HoveredUser: {
|
||||||
|
|
@ -640,11 +632,7 @@ void ChatView::mousePressEvent(QMouseEvent *event)
|
||||||
switch (event->button()) {
|
switch (event->button()) {
|
||||||
case Qt::RightButton: {
|
case Qt::RightButton: {
|
||||||
UserLevelFlags userLevel(hoveredContent.left(delimiterIndex).toInt());
|
UserLevelFlags userLevel(hoveredContent.left(delimiterIndex).toInt());
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
userContextMenu->showContextMenu(event->globalPosition().toPoint(), userName, userLevel, this);
|
userContextMenu->showContextMenu(event->globalPosition().toPoint(), userName, userLevel, this);
|
||||||
#else
|
|
||||||
userContextMenu->showContextMenu(event->globalPos(), userName, userLevel, this);
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Qt::LeftButton: {
|
case Qt::LeftButton: {
|
||||||
|
|
|
||||||
|
|
@ -103,11 +103,7 @@ public:
|
||||||
void redactMessages(const QString &userName, int amount);
|
void redactMessages(const QString &userName, int amount);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
void enterEvent(QEnterEvent *event) override;
|
void enterEvent(QEnterEvent *event) override;
|
||||||
#else
|
|
||||||
void enterEvent(QEvent *event) override;
|
|
||||||
#endif
|
|
||||||
void leaveEvent(QEvent *event) override;
|
void leaveEvent(QEvent *event) override;
|
||||||
void mouseMoveEvent(QMouseEvent *event) override;
|
void mouseMoveEvent(QMouseEvent *event) override;
|
||||||
void mousePressEvent(QMouseEvent *event) override;
|
void mousePressEvent(QMouseEvent *event) override;
|
||||||
|
|
|
||||||
|
|
@ -316,11 +316,7 @@ bool UserListItemDelegate::editorEvent(QEvent *event,
|
||||||
if ((event->type() == QEvent::MouseButtonPress) && index.isValid()) {
|
if ((event->type() == QEvent::MouseButtonPress) && index.isValid()) {
|
||||||
QMouseEvent *const mouseEvent = static_cast<QMouseEvent *>(event);
|
QMouseEvent *const mouseEvent = static_cast<QMouseEvent *>(event);
|
||||||
if (mouseEvent->button() == Qt::RightButton) {
|
if (mouseEvent->button() == Qt::RightButton) {
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
static_cast<UserListWidget *>(parent())->showContextMenu(mouseEvent->globalPosition().toPoint(), index);
|
static_cast<UserListWidget *>(parent())->showContextMenu(mouseEvent->globalPosition().toPoint(), index);
|
||||||
#else
|
|
||||||
static_cast<UserListWidget *>(parent())->showContextMenu(mouseEvent->globalPos(), index);
|
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -131,11 +131,7 @@ void ArchidektApiResponseDeckEntryDisplayWidget::mousePressEvent(QMouseEvent *ev
|
||||||
actRequestNavigationToDeck();
|
actRequestNavigationToDeck();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
void ArchidektApiResponseDeckEntryDisplayWidget::enterEvent(QEnterEvent *event)
|
void ArchidektApiResponseDeckEntryDisplayWidget::enterEvent(QEnterEvent *event)
|
||||||
#else
|
|
||||||
void ArchidektApiResponseDeckEntryDisplayWidget::enterEvent(QEvent *event)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
QWidget::enterEvent(event);
|
QWidget::enterEvent(event);
|
||||||
backgroundPlateWidget->setFocused(true);
|
backgroundPlateWidget->setFocused(true);
|
||||||
|
|
|
||||||
|
|
@ -97,12 +97,7 @@ public slots:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void mousePressEvent(QMouseEvent *event) override;
|
void mousePressEvent(QMouseEvent *event) override;
|
||||||
|
void enterEvent(QEnterEvent *event) override;
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
void enterEvent(QEnterEvent *event) override; ///< Qt6 hover enter
|
|
||||||
#else
|
|
||||||
void enterEvent(QEvent *event) override; ///< Qt5 hover enter
|
|
||||||
#endif
|
|
||||||
void leaveEvent(QEvent *event) override;
|
void leaveEvent(QEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -62,11 +62,7 @@ void EdhrecApiResponseCardDetailsDisplayWidget::mousePressEvent(QMouseEvent *eve
|
||||||
actRequestPageNavigation();
|
actRequestPageNavigation();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
void EdhrecApiResponseCardDetailsDisplayWidget::enterEvent(QEnterEvent *event)
|
void EdhrecApiResponseCardDetailsDisplayWidget::enterEvent(QEnterEvent *event)
|
||||||
#else
|
|
||||||
void EdhrecApiResponseCardDetailsDisplayWidget::enterEvent(QEvent *event)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
QWidget::enterEvent(event);
|
QWidget::enterEvent(event);
|
||||||
backgroundPlateWidget->setFocused(true);
|
backgroundPlateWidget->setFocused(true);
|
||||||
|
|
|
||||||
|
|
@ -39,11 +39,7 @@ private:
|
||||||
protected slots:
|
protected slots:
|
||||||
void mousePressEvent(QMouseEvent *event) override;
|
void mousePressEvent(QMouseEvent *event) override;
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
void enterEvent(QEnterEvent *event) override;
|
||||||
void enterEvent(QEnterEvent *event) override; ///< Qt6 hover enter
|
|
||||||
#else
|
|
||||||
void enterEvent(QEvent *event) override; ///< Qt5 hover enter
|
|
||||||
#endif
|
|
||||||
void leaveEvent(QEvent *event) override;
|
void leaveEvent(QEvent *event) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,11 +64,7 @@ QSize CloseButton::sizeHint() const
|
||||||
return {width, height};
|
return {width, height};
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
void CloseButton::enterEvent(QEnterEvent *event)
|
void CloseButton::enterEvent(QEnterEvent *event)
|
||||||
#else
|
|
||||||
void CloseButton::enterEvent(QEvent *event)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
update();
|
update();
|
||||||
QAbstractButton::enterEvent(event);
|
QAbstractButton::enterEvent(event);
|
||||||
|
|
|
||||||
|
|
@ -70,11 +70,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
void enterEvent(QEnterEvent *event) override;
|
void enterEvent(QEnterEvent *event) override;
|
||||||
#else
|
|
||||||
void enterEvent(QEvent *event) override;
|
|
||||||
#endif
|
|
||||||
void leaveEvent(QEvent *event) override;
|
void leaveEvent(QEvent *event) override;
|
||||||
void paintEvent(QPaintEvent *event) override;
|
void paintEvent(QPaintEvent *event) override;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -71,11 +71,7 @@ void DeckPreviewWidget::resizeEvent(QResizeEvent *event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
void DeckPreviewWidget::enterEvent(QEnterEvent *event)
|
void DeckPreviewWidget::enterEvent(QEnterEvent *event)
|
||||||
#else
|
|
||||||
void DeckPreviewWidget::enterEvent(QEvent *event)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
QWidget::enterEvent(event);
|
QWidget::enterEvent(event);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -72,11 +72,7 @@ public slots:
|
||||||
void resizeEvent(QResizeEvent *event) override;
|
void resizeEvent(QResizeEvent *event) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
void enterEvent(QEnterEvent *event) override;
|
||||||
void enterEvent(QEnterEvent *event) override; // Qt6 signature
|
|
||||||
#else
|
|
||||||
void enterEvent(QEvent *event) override; // Qt5 signature
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateLastModifiedTime();
|
void updateLastModifiedTime();
|
||||||
|
|
|
||||||
|
|
@ -128,11 +128,7 @@ void installNewTranslator()
|
||||||
QString lang = SettingsCache::instance().getLang();
|
QString lang = SettingsCache::instance().getLang();
|
||||||
|
|
||||||
QString qtNameHint = "qt_" + lang;
|
QString qtNameHint = "qt_" + lang;
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
QString qtTranslationPath = QLibraryInfo::path(QLibraryInfo::TranslationsPath);
|
QString qtTranslationPath = QLibraryInfo::path(QLibraryInfo::TranslationsPath);
|
||||||
#else
|
|
||||||
QString qtTranslationPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool qtTranslationLoaded = qtTranslator->load(qtNameHint, qtTranslationPath);
|
bool qtTranslationLoaded = qtTranslator->load(qtNameHint, qtTranslationPath);
|
||||||
if (!qtTranslationLoaded) {
|
if (!qtTranslationLoaded) {
|
||||||
|
|
@ -275,9 +271,6 @@ int main(int argc, char *argv[])
|
||||||
// force shortcuts to be shown/hidden in right-click menus, regardless of system defaults
|
// force shortcuts to be shown/hidden in right-click menus, regardless of system defaults
|
||||||
qApp->setAttribute(Qt::AA_DontShowShortcutsInContextMenus, !SettingsCache::instance().getShowShortcuts());
|
qApp->setAttribute(Qt::AA_DontShowShortcutsInContextMenus, !SettingsCache::instance().getShowShortcuts());
|
||||||
|
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
app.setAttribute(Qt::AA_UseHighDpiPixmaps);
|
|
||||||
#endif
|
|
||||||
app.exec();
|
app.exec();
|
||||||
|
|
||||||
qCInfo(MainLog) << "Event loop finished, terminating...";
|
qCInfo(MainLog) << "Event loop finished, terminating...";
|
||||||
|
|
|
||||||
|
|
@ -25,22 +25,13 @@ bool CardInfoComparator::operator()(const CardInfoPtr &a, const CardInfoPtr &b)
|
||||||
|
|
||||||
bool CardInfoComparator::compareVariants(const QVariant &a, const QVariant &b) const
|
bool CardInfoComparator::compareVariants(const QVariant &a, const QVariant &b) const
|
||||||
{
|
{
|
||||||
// Determine the type of QVariant based on Qt version
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
if (a.typeId() != b.typeId()) {
|
if (a.typeId() != b.typeId()) {
|
||||||
#else
|
|
||||||
if (a.type() != b.type()) {
|
|
||||||
#endif
|
|
||||||
// If they are not the same type, compare as strings
|
// If they are not the same type, compare as strings
|
||||||
return a.toString() < b.toString();
|
return a.toString() < b.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Perform type-specific comparison
|
// Perform type-specific comparison
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
switch (static_cast<int>(a.typeId())) {
|
switch (static_cast<int>(a.typeId())) {
|
||||||
#else
|
|
||||||
switch (static_cast<int>(a.type())) {
|
|
||||||
#endif
|
|
||||||
case static_cast<int>(QMetaType::Int):
|
case static_cast<int>(QMetaType::Int):
|
||||||
return a.toInt() < b.toInt();
|
return a.toInt() < b.toInt();
|
||||||
case static_cast<int>(QMetaType::Double):
|
case static_cast<int>(QMetaType::Double):
|
||||||
|
|
|
||||||
|
|
@ -13,14 +13,6 @@
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#if QT_VERSION < 0x050600
|
|
||||||
// qHash on QRegularExpression was added in 5.6, FIX IT
|
|
||||||
uint qHash(const QRegularExpression &key, uint seed) noexcept
|
|
||||||
{
|
|
||||||
return qHash(key.pattern(), seed); // call qHash on pattern QString instead
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static const QString CURRENT_SIDEBOARD_PLAN_KEY = "";
|
static const QString CURRENT_SIDEBOARD_PLAN_KEY = "";
|
||||||
|
|
||||||
bool DeckList::Metadata::isEmpty() const
|
bool DeckList::Metadata::isEmpty() const
|
||||||
|
|
|
||||||
|
|
@ -24,11 +24,7 @@ void installNewTranslator()
|
||||||
QString lang = SettingsCache::instance().getLang();
|
QString lang = SettingsCache::instance().getLang();
|
||||||
|
|
||||||
QString qtNameHint = "qt_" + lang;
|
QString qtNameHint = "qt_" + lang;
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
QString qtTranslationPath = QLibraryInfo::path(QLibraryInfo::TranslationsPath);
|
QString qtTranslationPath = QLibraryInfo::path(QLibraryInfo::TranslationsPath);
|
||||||
#else
|
|
||||||
QString qtTranslationPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool qtTranslationLoaded = qtTranslator->load(qtNameHint, qtTranslationPath);
|
bool qtTranslationLoaded = qtTranslator->load(qtNameHint, qtTranslationPath);
|
||||||
if (!qtTranslationLoaded) {
|
if (!qtTranslationLoaded) {
|
||||||
|
|
|
||||||
|
|
@ -109,12 +109,8 @@ QByteArray Json::serialize(const QVariant &data, bool &success)
|
||||||
{
|
{
|
||||||
str = "null";
|
str = "null";
|
||||||
}
|
}
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
else if ((data.typeId() == QMetaType::Type::QVariantList) ||
|
else if ((data.typeId() == QMetaType::Type::QVariantList) ||
|
||||||
(data.typeId() == QMetaType::Type::QStringList)) // variant is a list?
|
(data.typeId() == QMetaType::Type::QStringList)) // variant is a list?
|
||||||
#else
|
|
||||||
else if ((data.type() == QVariant::List) || (data.type() == QVariant::StringList)) // variant is a list?
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
QList<QByteArray> values;
|
QList<QByteArray> values;
|
||||||
const QVariantList list = data.toList();
|
const QVariantList list = data.toList();
|
||||||
|
|
@ -129,11 +125,7 @@ QByteArray Json::serialize(const QVariant &data, bool &success)
|
||||||
|
|
||||||
str = "[ " + join(values, ", ") + " ]";
|
str = "[ " + join(values, ", ") + " ]";
|
||||||
}
|
}
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
else if ((data.typeId() == QMetaType::Type::QVariantHash)) // variant is a list?
|
else if ((data.typeId() == QMetaType::Type::QVariantHash)) // variant is a list?
|
||||||
#else
|
|
||||||
else if (data.type() == QVariant::Hash) // variant is a hash?
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
const QVariantHash vhash = data.toHash();
|
const QVariantHash vhash = data.toHash();
|
||||||
QHashIterator<QString, QVariant> it(vhash);
|
QHashIterator<QString, QVariant> it(vhash);
|
||||||
|
|
@ -155,11 +147,7 @@ QByteArray Json::serialize(const QVariant &data, bool &success)
|
||||||
str += join(pairs, ", ");
|
str += join(pairs, ", ");
|
||||||
str += " }";
|
str += " }";
|
||||||
}
|
}
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
else if ((data.typeId() == QMetaType::Type::QVariantMap)) // variant is a list?
|
else if ((data.typeId() == QMetaType::Type::QVariantMap)) // variant is a list?
|
||||||
#else
|
|
||||||
else if (data.type() == QVariant::Map) // variant is a map?
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
const QVariantMap vmap = data.toMap();
|
const QVariantMap vmap = data.toMap();
|
||||||
QMapIterator<QString, QVariant> it(vmap);
|
QMapIterator<QString, QVariant> it(vmap);
|
||||||
|
|
@ -177,39 +165,23 @@ QByteArray Json::serialize(const QVariant &data, bool &success)
|
||||||
str += join(pairs, ", ");
|
str += join(pairs, ", ");
|
||||||
str += " }";
|
str += " }";
|
||||||
}
|
}
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
else if ((data.typeId() == QMetaType::Type::QString) ||
|
else if ((data.typeId() == QMetaType::Type::QString) ||
|
||||||
(data.typeId() == QMetaType::Type::QByteArray)) // variant is a list?
|
(data.typeId() == QMetaType::Type::QByteArray)) // variant is a list?
|
||||||
#else
|
|
||||||
else if ((data.type() == QVariant::String) || (data.type() == QVariant::ByteArray)) // a string or a byte array?
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
str = sanitizeString(data.toString()).toUtf8();
|
str = sanitizeString(data.toString()).toUtf8();
|
||||||
}
|
}
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
else if (data.typeId() == QMetaType::Type::Double)
|
else if (data.typeId() == QMetaType::Type::Double)
|
||||||
#else
|
|
||||||
else if (data.type() == QVariant::Double) // double?
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
str = QByteArray::number(data.toDouble(), 'g', 20);
|
str = QByteArray::number(data.toDouble(), 'g', 20);
|
||||||
if (!str.contains(".") && !str.contains("e")) {
|
if (!str.contains(".") && !str.contains("e")) {
|
||||||
str += ".0";
|
str += ".0";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
else if (data.typeId() == QMetaType::Type::Bool)
|
else if (data.typeId() == QMetaType::Type::Bool)
|
||||||
#else
|
|
||||||
else if (data.type() == QVariant::Bool) // boolean value?
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
str = data.toBool() ? "true" : "false";
|
str = data.toBool() ? "true" : "false";
|
||||||
}
|
}
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
else if (data.typeId() == QMetaType::Type::ULongLong)
|
else if (data.typeId() == QMetaType::Type::ULongLong)
|
||||||
#else
|
|
||||||
else if (data.type() == QVariant::ULongLong) // large unsigned number?
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
str = QByteArray::number(data.value<qulonglong>());
|
str = QByteArray::number(data.value<qulonglong>());
|
||||||
} else if (data.canConvert<qlonglong>()) // any signed number?
|
} else if (data.canConvert<qlonglong>()) // any signed number?
|
||||||
|
|
|
||||||
|
|
@ -54,13 +54,8 @@ QxtSmtp::QxtSmtp(QObject *parent) : QObject(parent)
|
||||||
// QObject::connect(socket(), SIGNAL(encrypted()), &qxt_d(), SLOT(ehlo()));
|
// QObject::connect(socket(), SIGNAL(encrypted()), &qxt_d(), SLOT(ehlo()));
|
||||||
QObject::connect(socket(), SIGNAL(connected()), this, SIGNAL(connected()));
|
QObject::connect(socket(), SIGNAL(connected()), this, SIGNAL(connected()));
|
||||||
QObject::connect(socket(), SIGNAL(disconnected()), this, SIGNAL(disconnected()));
|
QObject::connect(socket(), SIGNAL(disconnected()), this, SIGNAL(disconnected()));
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
QObject::connect(socket(), SIGNAL(errorOccurred(QAbstractSocket::SocketError)), &qxt_d(),
|
QObject::connect(socket(), SIGNAL(errorOccurred(QAbstractSocket::SocketError)), &qxt_d(),
|
||||||
SLOT(socketError(QAbstractSocket::SocketError)));
|
SLOT(socketError(QAbstractSocket::SocketError)));
|
||||||
#else
|
|
||||||
QObject::connect(socket(), SIGNAL(error(QAbstractSocket::SocketError)), &qxt_d(),
|
|
||||||
SLOT(socketError(QAbstractSocket::SocketError)));
|
|
||||||
#endif
|
|
||||||
QObject::connect(this, SIGNAL(authenticated()), &qxt_d(), SLOT(sendNext()));
|
QObject::connect(this, SIGNAL(authenticated()), &qxt_d(), SLOT(sendNext()));
|
||||||
QObject::connect(socket(), SIGNAL(readyRead()), &qxt_d(), SLOT(socketRead()));
|
QObject::connect(socket(), SIGNAL(readyRead()), &qxt_d(), SLOT(socketRead()));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue