mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-07 05:53:59 -07:00
Merge 1d825112b0 into 6c960fdf31
This commit is contained in:
commit
85f2066bd4
64 changed files with 70 additions and 551 deletions
|
|
@ -401,8 +401,6 @@ endif(APPLE)
|
|||
|
||||
if(Qt6_FOUND)
|
||||
qt6_add_resources(cockatrice_RESOURCES_RCC ${cockatrice_RESOURCES})
|
||||
elseif(Qt5_FOUND)
|
||||
qt5_add_resources(cockatrice_RESOURCES_RCC ${cockatrice_RESOURCES})
|
||||
endif()
|
||||
|
||||
# Declare path variables
|
||||
|
|
@ -429,44 +427,7 @@ if(Qt6_FOUND)
|
|||
${cockatrice_MOC_SRCS}
|
||||
MANUAL_FINALIZATION
|
||||
)
|
||||
elseif(Qt5_FOUND)
|
||||
# Qt5 Translations need to be linked at executable creation time
|
||||
if(Qt5LinguistTools_FOUND)
|
||||
if(UPDATE_TRANSLATIONS)
|
||||
qt5_create_translation(cockatrice_QM ${translate_SRCS} ${cockatrice_TS})
|
||||
else()
|
||||
qt5_add_translation(cockatrice_QM ${cockatrice_TS})
|
||||
endif()
|
||||
endif()
|
||||
add_executable(
|
||||
cockatrice WIN32 MACOSX_BUNDLE ${cockatrice_MOC_SRCS} ${cockatrice_QM} ${cockatrice_RESOURCES_RCC}
|
||||
${cockatrice_SOURCES}
|
||||
)
|
||||
if(UNIX)
|
||||
if(APPLE)
|
||||
install(FILES ${cockatrice_QM} DESTINATION ${COCKATRICE_MAC_QM_INSTALL_DIR})
|
||||
else()
|
||||
install(FILES ${cockatrice_QM} DESTINATION ${COCKATRICE_UNIX_QM_INSTALL_DIR})
|
||||
endif()
|
||||
elseif(WIN32)
|
||||
install(FILES ${cockatrice_QM} DESTINATION ${COCKATRICE_WIN32_QM_INSTALL_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(Qt5_FOUND)
|
||||
target_link_libraries(
|
||||
cockatrice
|
||||
libcockatrice_card
|
||||
libcockatrice_deck_list
|
||||
libcockatrice_filters
|
||||
libcockatrice_utility
|
||||
libcockatrice_network
|
||||
libcockatrice_models
|
||||
libcockatrice_rng
|
||||
libcockatrice_settings
|
||||
${COCKATRICE_QT_MODULES}
|
||||
)
|
||||
else()
|
||||
target_link_libraries(
|
||||
cockatrice
|
||||
PUBLIC libcockatrice_card
|
||||
|
|
@ -509,7 +470,7 @@ if(APPLE)
|
|||
set(plugin_dest_dir cockatrice.app/Contents/Plugins)
|
||||
set(qtconf_dest_dir cockatrice.app/Contents/Resources)
|
||||
|
||||
# Qt plugins: audio (Qt5), iconengines, imageformats, multimedia (Qt6), platforms, printsupport (Qt5), styles, tls (Qt6)
|
||||
# Qt plugins: iconengines, imageformats, multimedia (Qt6), platforms, styles, tls (Qt6)
|
||||
install(
|
||||
DIRECTORY "${QT_PLUGINS_DIR}/"
|
||||
DESTINATION ${plugin_dest_dir}
|
||||
|
|
@ -517,12 +478,10 @@ if(APPLE)
|
|||
FILES_MATCHING
|
||||
PATTERN "*.dSYM" EXCLUDE
|
||||
PATTERN "*_debug.dylib" EXCLUDE
|
||||
PATTERN "audio/*.dylib"
|
||||
PATTERN "iconengines/*.dylib"
|
||||
PATTERN "imageformats/*.dylib"
|
||||
PATTERN "multimedia/*.dylib"
|
||||
PATTERN "platforms/*.dylib"
|
||||
PATTERN "printsupport/*.dylib"
|
||||
PATTERN "styles/*.dylib"
|
||||
PATTERN "tls/*.dylib"
|
||||
)
|
||||
|
|
@ -576,14 +535,12 @@ if(WIN32)
|
|||
PATTERN "*.ini"
|
||||
)
|
||||
|
||||
# Qt plugins: audio (Qt5), iconengines, imageformats, multimedia (Qt6) platforms, printsupport (Qt5), styles, tls (Qt6)
|
||||
# Qt plugins: iconengines, imageformats, multimedia (Qt6) platforms, styles, tls (Qt6)
|
||||
install(
|
||||
DIRECTORY "${QT_PLUGINS_DIR}/"
|
||||
DESTINATION ${plugin_dest_dir}
|
||||
COMPONENT Runtime
|
||||
FILES_MATCHING
|
||||
PATTERN "audio/qtaudio_wasapi.dll"
|
||||
PATTERN "audio/qtaudio_windows.dll"
|
||||
PATTERN "iconengines/qsvgicon.dll"
|
||||
PATTERN "imageformats/*.dll"
|
||||
PATTERN "mediaservice/dsengine.dll"
|
||||
|
|
@ -593,7 +550,6 @@ if(WIN32)
|
|||
PATTERN "platforms/qminimal.dll"
|
||||
PATTERN "platforms/qoffscreen.dll"
|
||||
PATTERN "platforms/qwindows.dll"
|
||||
PATTERN "printsupport/windowsprintersupport.dll"
|
||||
PATTERN "styles/qcertonlybackend.dll"
|
||||
PATTERN "styles/qopensslbackend.dll"
|
||||
PATTERN "styles/qschannelbackend.dll"
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ bool ReleaseChannel::downloadMatchesCurrentOS(const QString &fileName)
|
|||
char arch[255];
|
||||
size_t len = sizeof(arch);
|
||||
if (sysctlbyname("machdep.cpu.brand_string", arch, &len, nullptr, 0) == 0) {
|
||||
// Intel mac is only supported on macOS 13 versions
|
||||
// Intel Mac is only supported on macOS 13 versions
|
||||
if (QString::fromUtf8(arch).contains("Intel")) {
|
||||
return 13;
|
||||
}
|
||||
|
|
@ -74,13 +74,9 @@ bool ReleaseChannel::downloadMatchesCurrentOS(const QString &fileName)
|
|||
return rel_maj == sys_maj;
|
||||
|
||||
#elif defined(Q_OS_WIN)
|
||||
#if Q_PROCESSOR_WORDSIZE == 4
|
||||
return fileName.contains("32bit");
|
||||
#elif Q_PROCESSOR_WORDSIZE == 8
|
||||
#if Q_PROCESSOR_WORDSIZE == 8 // 64-bit
|
||||
const QString &version = QSysInfo::productVersion();
|
||||
if (version.startsWith("7") || version.startsWith("8")) {
|
||||
return fileName.contains("Win7");
|
||||
} else {
|
||||
if (version.startsWith("10")) {
|
||||
return fileName.contains("Win10");
|
||||
}
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -2,13 +2,10 @@
|
|||
|
||||
#include "settings/cache_settings.h"
|
||||
|
||||
#include <QAudioOutput>
|
||||
#include <QDir>
|
||||
#include <QMediaPlayer>
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
#include <QAudioOutput>
|
||||
#endif
|
||||
|
||||
#define DEFAULT_THEME_NAME "Default"
|
||||
#define TEST_SOUND_FILENAME "player_join"
|
||||
|
||||
|
|
@ -40,10 +37,8 @@ void SoundEngine::soundEnabledChanged()
|
|||
qCInfo(SoundEngineLog) << "SoundEngine: enabling sound with" << audioData.size() << "sounds";
|
||||
if (!player) {
|
||||
player = new QMediaPlayer;
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
audioOutput = new QAudioOutput(player);
|
||||
player->setAudioOutput(audioOutput);
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
qCInfo(SoundEngineLog) << "SoundEngine: disabling sound";
|
||||
|
|
@ -71,13 +66,8 @@ void SoundEngine::playSound(const QString &fileName)
|
|||
|
||||
player->stop();
|
||||
int volumeSliderValue = SettingsCache::instance().getMasterVolume();
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
player->audioOutput()->setVolume(qreal(volumeSliderValue) / 100);
|
||||
player->setSource(QUrl::fromLocalFile(audioData[fileName]));
|
||||
#else
|
||||
player->setVolume(volumeSliderValue);
|
||||
player->setMedia(QUrl::fromLocalFile(audioData[fileName]));
|
||||
#endif
|
||||
player->play();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1352,11 +1352,7 @@ void PlayerActions::actSetPT(QList<CardItem *> selectedCards, const QString &pt)
|
|||
const auto oldpt = CardItem::parsePT(card->getPT());
|
||||
int ptIter = 0;
|
||||
for (const auto &_item : ptList) {
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
if (_item.typeId() == QMetaType::Type::Int) {
|
||||
#else
|
||||
if (_item.type() == QVariant::Int) {
|
||||
#endif
|
||||
int oldItem = ptIter < oldpt.size() ? oldpt.at(ptIter).toInt() : 0;
|
||||
newpt += '/' + QString::number(oldItem + _item.toInt());
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -25,11 +25,7 @@ bool PlayerListItemDelegate::editorEvent(QEvent *event,
|
|||
if ((event->type() == QEvent::MouseButtonPress) && index.isValid()) {
|
||||
auto *const mouseEvent = static_cast<QMouseEvent *>(event);
|
||||
if (mouseEvent->button() == Qt::RightButton) {
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
static_cast<PlayerListWidget *>(parent())->showContextMenu(mouseEvent->globalPosition().toPoint(), index);
|
||||
#else
|
||||
static_cast<PlayerListWidget *>(parent())->showContextMenu(mouseEvent->globalPos(), index);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -312,13 +312,7 @@ bool CardPictureLoader::hasCustomArt()
|
|||
// Check if there is at least one non-directory file in the pics path, other
|
||||
// than in the "downloadedPics" subdirectory.
|
||||
while (it.hasNext()) {
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 3, 0))
|
||||
QFileInfo dir(it.nextFileInfo());
|
||||
#else
|
||||
// nextFileInfo() is only available in Qt 6.3+, for previous versions, we build
|
||||
// the QFileInfo from a QString which requires more system calls.
|
||||
QFileInfo dir(it.next());
|
||||
#endif
|
||||
|
||||
if (it.fileName() == "downloadedPics") {
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -246,11 +246,7 @@ QSize CardInfoPictureWidget::sizeHint() const
|
|||
* @brief Starts the hover timer to show the enlarged pixmap on hover.
|
||||
* @param event The enter event.
|
||||
*/
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
void CardInfoPictureWidget::enterEvent(QEnterEvent *event)
|
||||
#else
|
||||
void CardInfoPictureWidget::enterEvent(QEvent *event)
|
||||
#endif
|
||||
{
|
||||
QWidget::enterEvent(event); // Call the base class implementation
|
||||
|
||||
|
|
|
|||
|
|
@ -48,11 +48,7 @@ signals:
|
|||
protected:
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
void paintEvent(QPaintEvent *) override;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
void enterEvent(QEnterEvent *event) override; // Qt6 signature
|
||||
#else
|
||||
void enterEvent(QEvent *event) override; // Qt5 signature
|
||||
#endif
|
||||
void enterEvent(QEnterEvent *event) override;
|
||||
void leaveEvent(QEvent *event) override;
|
||||
void moveEvent(QMoveEvent *event) override;
|
||||
void mouseMoveEvent(QMouseEvent *event) override;
|
||||
|
|
|
|||
|
|
@ -147,11 +147,7 @@ bool ResizablePanel::eventFilter(QObject *obj, QEvent *event)
|
|||
if (event->type() == QEvent::MouseButtonPress) {
|
||||
auto *mouseEvent = static_cast<QMouseEvent *>(event);
|
||||
if (mouseEvent->button() == Qt::LeftButton) {
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
dragStartPos = mouseEvent->globalPosition().toPoint();
|
||||
#else
|
||||
dragStartPos = mouseEvent->globalPos();
|
||||
#endif
|
||||
isDraggingPanel = false;
|
||||
dragButton->setCursor(Qt::ClosedHandCursor);
|
||||
}
|
||||
|
|
@ -159,11 +155,7 @@ bool ResizablePanel::eventFilter(QObject *obj, QEvent *event)
|
|||
} else if (event->type() == QEvent::MouseMove) {
|
||||
auto *mouseEvent = static_cast<QMouseEvent *>(event);
|
||||
if (mouseEvent->buttons() & Qt::LeftButton) {
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QPoint currentPos = mouseEvent->globalPosition().toPoint();
|
||||
#else
|
||||
QPoint currentPos = mouseEvent->globalPos();
|
||||
#endif
|
||||
int distance = (currentPos - dragStartPos).manhattanLength();
|
||||
if (distance >= 5 && !isDraggingPanel) {
|
||||
isDraggingPanel = true;
|
||||
|
|
@ -182,22 +174,14 @@ bool ResizablePanel::eventFilter(QObject *obj, QEvent *event)
|
|||
if (obj == resizeHandle) {
|
||||
if (event->type() == QEvent::MouseButtonPress) {
|
||||
auto *mouseEvent = static_cast<QMouseEvent *>(event);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
resizeStartY = mouseEvent->globalPosition().y();
|
||||
#else
|
||||
resizeStartY = mouseEvent->globalPos().y();
|
||||
#endif
|
||||
isResizing = true;
|
||||
resizeStartHeight = currentHeight;
|
||||
resizeHandle->grabMouse();
|
||||
return true;
|
||||
} else if (event->type() == QEvent::MouseMove && isResizing) {
|
||||
auto *mouseEvent = static_cast<QMouseEvent *>(event);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
int deltaY = mouseEvent->globalPosition().y() - resizeStartY;
|
||||
#else
|
||||
int deltaY = mouseEvent->globalPos().y() - resizeStartY;
|
||||
#endif
|
||||
int newHeight = resizeStartHeight + deltaY;
|
||||
|
||||
int minAllowed = getMinimumAllowedHeight();
|
||||
|
|
@ -221,11 +205,7 @@ void ResizablePanel::dragEnterEvent(QDragEnterEvent *event)
|
|||
{
|
||||
if (event->mimeData()->hasFormat("application/x-resizablepanel")) {
|
||||
event->acceptProposedAction();
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
showDropIndicator(event->position().y());
|
||||
#else
|
||||
showDropIndicator(event->pos().y());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -233,13 +213,8 @@ void ResizablePanel::dragMoveEvent(QDragMoveEvent *event)
|
|||
{
|
||||
if (event->mimeData()->hasFormat("application/x-resizablepanel")) {
|
||||
event->acceptProposedAction();
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
showDropIndicator(event->position().y());
|
||||
lastDragPos = mapToGlobal(event->position().toPoint());
|
||||
#else
|
||||
showDropIndicator(event->pos().y());
|
||||
lastDragPos = mapToGlobal(event->pos());
|
||||
#endif
|
||||
|
||||
if (!autoScrollTimer->isActive()) {
|
||||
autoScrollTimer->start();
|
||||
|
|
@ -265,11 +240,7 @@ void ResizablePanel::dropEvent(QDropEvent *event)
|
|||
ResizablePanel *draggedPanel = reinterpret_cast<ResizablePanel *>(ptr);
|
||||
|
||||
if (draggedPanel && draggedPanel != this) {
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
bool insertBefore = (event->position().y() < height() / 2);
|
||||
#else
|
||||
bool insertBefore = (event->pos().y() < height() / 2);
|
||||
#endif
|
||||
emit dropRequested(draggedPanel, this, insertBefore);
|
||||
event->acceptProposedAction();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -321,11 +321,7 @@ void DlgSelectSetForCards::dropEvent(QDropEvent *event)
|
|||
{
|
||||
QByteArray itemData = event->mimeData()->data("application/x-setentrywidget");
|
||||
QString draggedSetName = QString::fromUtf8(itemData);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QPoint adjustedPos = event->position().toPoint() + QPoint(0, scrollArea->verticalScrollBar()->value());
|
||||
#else
|
||||
QPoint adjustedPos = event->pos() + QPoint(0, scrollArea->verticalScrollBar()->value());
|
||||
#endif
|
||||
int dropIndex = -1;
|
||||
for (int i = 0; i < listLayout->count(); ++i) {
|
||||
QWidget *widget = listLayout->itemAt(i)->widget();
|
||||
|
|
@ -491,11 +487,7 @@ void SetEntryWidget::mousePressEvent(QMouseEvent *event)
|
|||
}
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
void SetEntryWidget::enterEvent(QEnterEvent *event)
|
||||
#else
|
||||
void SetEntryWidget::enterEvent(QEvent *event)
|
||||
#endif
|
||||
{
|
||||
QWidget::enterEvent(event); // Call the base class handler
|
||||
// Highlight the widget by changing the background color only for the widget itself
|
||||
|
|
|
|||
|
|
@ -87,11 +87,7 @@ public:
|
|||
|
||||
public slots:
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
void enterEvent(QEnterEvent *event) override;
|
||||
#else
|
||||
void enterEvent(QEvent *event) override;
|
||||
#endif
|
||||
void leaveEvent(QEvent *event) override;
|
||||
void dragMoveEvent(QDragMoveEvent *event) override;
|
||||
|
||||
|
|
|
|||
|
|
@ -207,11 +207,7 @@ void BarChartWidget::mouseMoveEvent(QMouseEvent *e)
|
|||
if (hoveredSegment >= 0) {
|
||||
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"));
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QToolTip::showText(e->globalPosition().toPoint(), text, this);
|
||||
#else
|
||||
QToolTip::showText(e->globalPos(), text, this);
|
||||
#endif
|
||||
} else {
|
||||
QToolTip::hideText();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,19 +83,11 @@ void ColorBar::paintEvent(QPaintEvent *)
|
|||
}
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
void ColorBar::enterEvent(QEnterEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
isHovered = true;
|
||||
}
|
||||
#else
|
||||
void ColorBar::enterEvent(QEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
isHovered = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
void ColorBar::leaveEvent(QEvent *)
|
||||
{
|
||||
|
|
@ -108,13 +100,8 @@ void ColorBar::mouseMoveEvent(QMouseEvent *event)
|
|||
return;
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
int x = int(event->position().x());
|
||||
QPoint gp = event->globalPosition().toPoint();
|
||||
#else
|
||||
int x = event->pos().x();
|
||||
QPoint gp = event->globalPos();
|
||||
#endif
|
||||
|
||||
QString text = tooltipForPosition(x);
|
||||
if (!text.isEmpty()) {
|
||||
|
|
|
|||
|
|
@ -76,17 +76,10 @@ protected:
|
|||
*/
|
||||
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;
|
||||
#else
|
||||
/**
|
||||
* @brief Handles mouse hover entering (Qt5 version).
|
||||
*/
|
||||
void enterEvent(QEvent *event) override;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Handles mouse hover leaving.
|
||||
|
|
|
|||
|
|
@ -134,9 +134,5 @@ void SegmentedBarWidget::mouseMoveEvent(QMouseEvent *e)
|
|||
const Segment &s = segments[idx];
|
||||
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);
|
||||
#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));
|
||||
|
||||
QFontMetrics fm(p.font());
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
||||
|
||||
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());
|
||||
|
||||
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)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
isHovered = true;
|
||||
}
|
||||
#else
|
||||
void ColorPie::enterEvent(QEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
isHovered = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
void ColorPie::leaveEvent(QEvent *)
|
||||
{
|
||||
|
|
@ -121,13 +111,8 @@ void ColorPie::mouseMoveEvent(QMouseEvent *event)
|
|||
return;
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QPoint p = event->position().toPoint();
|
||||
QPoint gp = event->globalPosition().toPoint();
|
||||
#else
|
||||
QPoint p = event->pos();
|
||||
QPoint gp = event->globalPos();
|
||||
#endif
|
||||
|
||||
QString text = tooltipForPoint(p);
|
||||
if (!text.isEmpty()) {
|
||||
|
|
|
|||
|
|
@ -22,11 +22,7 @@ public:
|
|||
protected:
|
||||
void paintEvent(QPaintEvent *) override;
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
void enterEvent(QEnterEvent *event) override;
|
||||
#else
|
||||
void enterEvent(QEvent *event) override;
|
||||
#endif
|
||||
void leaveEvent(QEvent *) override;
|
||||
void mouseMoveEvent(QMouseEvent *event) override;
|
||||
|
||||
|
|
|
|||
|
|
@ -141,11 +141,7 @@ bool AllZonesCardAmountWidget::isNonZero()
|
|||
*
|
||||
* @param event The event information for the mouse entry.
|
||||
*/
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
void AllZonesCardAmountWidget::enterEvent(QEnterEvent *event)
|
||||
#else
|
||||
void AllZonesCardAmountWidget::enterEvent(QEvent *event)
|
||||
#endif
|
||||
{
|
||||
QWidget::enterEvent(event);
|
||||
update();
|
||||
|
|
|
|||
|
|
@ -26,11 +26,7 @@ public:
|
|||
int getTokensboardAmount();
|
||||
bool isNonZero();
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
void enterEvent(QEnterEvent *event) override;
|
||||
#else
|
||||
void enterEvent(QEvent *event) override;
|
||||
#endif
|
||||
|
||||
public slots:
|
||||
void adjustFontSize(int scalePercentage);
|
||||
|
|
|
|||
|
|
@ -105,11 +105,7 @@ void PrintingSelectorCardOverlayWidget::resizeEvent(QResizeEvent *event)
|
|||
*
|
||||
* @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)
|
||||
#else
|
||||
void PrintingSelectorCardOverlayWidget::enterEvent(QEvent *event)
|
||||
#endif
|
||||
{
|
||||
QWidget::enterEvent(event);
|
||||
deckEditor->updateCard(rootCard);
|
||||
|
|
|
|||
|
|
@ -26,11 +26,7 @@ public:
|
|||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
void enterEvent(QEnterEvent *event) override;
|
||||
#else
|
||||
void enterEvent(QEvent *event) override;
|
||||
#endif
|
||||
void leaveEvent(QEvent *event) override;
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void customMenu(QPoint point);
|
||||
|
|
|
|||
|
|
@ -103,11 +103,7 @@ void SettingsButtonWidget::onPopupClosed() const
|
|||
|
||||
void SettingsButtonWidget::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
if (popup->isVisible() && !popup->geometry().contains(event->globalPosition().toPoint())) {
|
||||
#else
|
||||
if (popup->isVisible() && !popup->geometry().contains(event->globalPos())) {
|
||||
#endif
|
||||
popup->close();
|
||||
}
|
||||
QWidget::mousePressEvent(event);
|
||||
|
|
|
|||
|
|
@ -70,11 +70,7 @@ void ReplayTimelineWidget::paintEvent(QPaintEvent * /* 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());
|
||||
#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
|
||||
skipToTime(newTime, false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -529,23 +529,13 @@ void ChatView::showSystemPopup(const QString &userName)
|
|||
|
||||
QColor ChatView::getCustomMentionColor()
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 4, 0))
|
||||
QColor customColor = QColor::fromString("#" + SettingsCache::instance().getChatMentionColor());
|
||||
#else
|
||||
QColor customColor;
|
||||
customColor.setNamedColor("#" + SettingsCache::instance().getChatMentionColor());
|
||||
#endif
|
||||
return customColor.isValid() ? customColor : DEFAULT_MENTION_COLOR;
|
||||
}
|
||||
|
||||
QColor ChatView::getCustomHighlightColor()
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 4, 0))
|
||||
QColor customColor = QColor::fromString("#" + SettingsCache::instance().getChatMentionColor());
|
||||
#else
|
||||
QColor customColor;
|
||||
customColor.setNamedColor("#" + SettingsCache::instance().getChatMentionColor());
|
||||
#endif
|
||||
return customColor.isValid() ? customColor : DEFAULT_MENTION_COLOR;
|
||||
}
|
||||
|
||||
|
|
@ -578,11 +568,7 @@ void ChatView::redactMessages(const QString &userName, int amount)
|
|||
}
|
||||
}
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
void ChatView::enterEvent(QEnterEvent * /*event*/)
|
||||
#else
|
||||
void ChatView::enterEvent(QEvent * /*event*/)
|
||||
#endif
|
||||
{
|
||||
setMouseTracking(true);
|
||||
}
|
||||
|
|
@ -639,12 +625,9 @@ void ChatView::mousePressEvent(QMouseEvent *event)
|
|||
{
|
||||
switch (hoveredItemType) {
|
||||
case HoveredCard: {
|
||||
if ((event->button() == Qt::MiddleButton) || (event->button() == Qt::LeftButton))
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
if ((event->button() == Qt::MiddleButton) || (event->button() == Qt::LeftButton)) {
|
||||
emit showCardInfoPopup(event->globalPosition().toPoint(), {hoveredContent});
|
||||
#else
|
||||
emit showCardInfoPopup(event->globalPos(), {hoveredContent});
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HoveredUser: {
|
||||
|
|
@ -654,11 +637,7 @@ void ChatView::mousePressEvent(QMouseEvent *event)
|
|||
switch (event->button()) {
|
||||
case Qt::RightButton: {
|
||||
UserLevelFlags userLevel(hoveredContent.left(delimiterIndex).toInt());
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
userContextMenu->showContextMenu(event->globalPosition().toPoint(), userName, userLevel, this);
|
||||
#else
|
||||
userContextMenu->showContextMenu(event->globalPos(), userName, userLevel, this);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case Qt::LeftButton: {
|
||||
|
|
|
|||
|
|
@ -103,11 +103,7 @@ public:
|
|||
void redactMessages(const QString &userName, int amount);
|
||||
|
||||
protected:
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
void enterEvent(QEnterEvent *event) override;
|
||||
#else
|
||||
void enterEvent(QEvent *event) override;
|
||||
#endif
|
||||
void leaveEvent(QEvent *event) override;
|
||||
void mouseMoveEvent(QMouseEvent *event) override;
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
|
|
|
|||
|
|
@ -339,11 +339,7 @@ bool UserListItemDelegate::editorEvent(QEvent *event,
|
|||
if ((event->type() == QEvent::MouseButtonPress) && index.isValid()) {
|
||||
QMouseEvent *const mouseEvent = static_cast<QMouseEvent *>(event);
|
||||
if (mouseEvent->button() == Qt::RightButton) {
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
static_cast<UserListWidget *>(parent())->showContextMenu(mouseEvent->globalPosition().toPoint(), index);
|
||||
#else
|
||||
static_cast<UserListWidget *>(parent())->showContextMenu(mouseEvent->globalPos(), index);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -137,11 +137,7 @@ void ArchidektApiResponseDeckEntryDisplayWidget::mousePressEvent(QMouseEvent *ev
|
|||
actRequestNavigationToDeck();
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
void ArchidektApiResponseDeckEntryDisplayWidget::enterEvent(QEnterEvent *event)
|
||||
#else
|
||||
void ArchidektApiResponseDeckEntryDisplayWidget::enterEvent(QEvent *event)
|
||||
#endif
|
||||
{
|
||||
QWidget::enterEvent(event);
|
||||
backgroundPlateWidget->setFocused(true);
|
||||
|
|
|
|||
|
|
@ -97,12 +97,7 @@ public slots:
|
|||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *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 enterEvent(QEnterEvent *event) override;
|
||||
void leaveEvent(QEvent *event) override;
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -65,11 +65,7 @@ void EdhrecApiResponseCardDetailsDisplayWidget::mousePressEvent(QMouseEvent *eve
|
|||
}
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
void EdhrecApiResponseCardDetailsDisplayWidget::enterEvent(QEnterEvent *event)
|
||||
#else
|
||||
void EdhrecApiResponseCardDetailsDisplayWidget::enterEvent(QEvent *event)
|
||||
#endif
|
||||
{
|
||||
QWidget::enterEvent(event);
|
||||
backgroundPlateWidget->setFocused(true);
|
||||
|
|
|
|||
|
|
@ -39,11 +39,7 @@ private:
|
|||
protected slots:
|
||||
void mousePressEvent(QMouseEvent *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 enterEvent(QEnterEvent *event) override;
|
||||
void leaveEvent(QEvent *event) override;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -38,18 +38,6 @@
|
|||
#include <libcockatrice/protocol/pb/serverinfo_room.pb.h>
|
||||
#include <libcockatrice/protocol/pb/serverinfo_user.pb.h>
|
||||
|
||||
QRect MacOSTabFixStyle::subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const
|
||||
{
|
||||
if (element != SE_TabBarTabText) {
|
||||
return QProxyStyle::subElementRect(element, option, widget);
|
||||
}
|
||||
|
||||
// Skip over QProxyStyle handling subElementRect,
|
||||
// This fixes an issue with Qt 5.10 on OSX where the labels for tabs with a button and an icon
|
||||
// get cut-off too early
|
||||
return QCommonStyle::subElementRect(element, option, widget);
|
||||
}
|
||||
|
||||
CloseButton::CloseButton(QWidget *parent) : QAbstractButton(parent)
|
||||
{
|
||||
setFocusPolicy(Qt::NoFocus);
|
||||
|
|
@ -65,11 +53,7 @@ QSize CloseButton::sizeHint() const
|
|||
return {width, height};
|
||||
}
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
void CloseButton::enterEvent(QEnterEvent *event)
|
||||
#else
|
||||
void CloseButton::enterEvent(QEvent *event)
|
||||
#endif
|
||||
{
|
||||
update();
|
||||
QAbstractButton::enterEvent(event);
|
||||
|
|
@ -117,12 +101,6 @@ TabSupervisor::TabSupervisor(AbstractClient *_client, QMenu *tabsMenu, QWidget *
|
|||
setMovable(true);
|
||||
setIconSize(QSize(15, 15));
|
||||
|
||||
#if defined(Q_OS_MAC)
|
||||
// This is necessary to fix an issue on macOS with qt5.10,
|
||||
// where tabs with icons and buttons get drawn incorrectly
|
||||
tabBar()->setStyle(new MacOSTabFixStyle);
|
||||
#endif
|
||||
|
||||
userListManager = new UserListManager(client, this);
|
||||
|
||||
// connect tab changes
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@
|
|||
#include <QAbstractButton>
|
||||
#include <QLoggingCategory>
|
||||
#include <QMap>
|
||||
#include <QProxyStyle>
|
||||
#include <QTabWidget>
|
||||
|
||||
class TabCardArtRules;
|
||||
|
|
@ -52,13 +51,6 @@ class ServerInfo_User;
|
|||
class GameReplay;
|
||||
class DeckList;
|
||||
|
||||
class MacOSTabFixStyle : public QProxyStyle
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QRect subElementRect(SubElement, const QStyleOption *, const QWidget *) const override;
|
||||
};
|
||||
|
||||
class CloseButton : public QAbstractButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
@ -71,11 +63,7 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
void enterEvent(QEnterEvent *event) override;
|
||||
#else
|
||||
void enterEvent(QEvent *event) override;
|
||||
#endif
|
||||
void leaveEvent(QEvent *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)
|
||||
#else
|
||||
void DeckPreviewWidget::enterEvent(QEvent *event)
|
||||
#endif
|
||||
{
|
||||
QWidget::enterEvent(event);
|
||||
|
||||
|
|
|
|||
|
|
@ -72,11 +72,7 @@ public slots:
|
|||
void resizeEvent(QResizeEvent *event) override;
|
||||
|
||||
protected:
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
void enterEvent(QEnterEvent *event) override; // Qt6 signature
|
||||
#else
|
||||
void enterEvent(QEvent *event) override; // Qt5 signature
|
||||
#endif
|
||||
void enterEvent(QEnterEvent *event) override;
|
||||
|
||||
private:
|
||||
void updateLastModifiedTime();
|
||||
|
|
|
|||
|
|
@ -128,11 +128,7 @@ void installNewTranslator()
|
|||
QString lang = SettingsCache::instance().getLang();
|
||||
|
||||
QString qtNameHint = "qt_" + lang;
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
QString qtTranslationPath = QLibraryInfo::path(QLibraryInfo::TranslationsPath);
|
||||
#else
|
||||
QString qtTranslationPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
|
||||
#endif
|
||||
|
||||
bool qtTranslationLoaded = qtTranslator->load(qtNameHint, qtTranslationPath);
|
||||
if (!qtTranslationLoaded) {
|
||||
|
|
@ -277,9 +273,6 @@ int main(int argc, char *argv[])
|
|||
// force shortcuts to be shown/hidden in right-click menus, regardless of system defaults
|
||||
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();
|
||||
|
||||
qCInfo(MainLog) << "Event loop finished, terminating...";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue