Commit c657a953 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Adapt build system + fix compile against qt6

parent 8cfeadfc
Pipeline #116026 passed with stage
in 46 seconds
......@@ -9,7 +9,7 @@ set(RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_
project(kgoldrunner VERSION ${RELEASE_SERVICE_VERSION})
set (QT_MIN_VERSION "5.15.0")
set (KF5_MIN_VERSION "5.85.0")
set (KF5_MIN_VERSION "5.90.0")
find_package(ECM ${KF5_MIN_VERSION} REQUIRED CONFIG)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH})
......@@ -24,7 +24,9 @@ include(ECMQtDeclareLoggingCategory)
include(ECMSetupVersion)
include(FeatureSummary)
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Gui Widgets)
find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Gui Widgets)
find_package(Qt${QT_MAJOR_VERSION}QuickWidgets ${REQUIRED_QT_VERSION} CONFIG)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
Config
ConfigWidgets
......
......@@ -10,11 +10,12 @@
#include <QAction>
#include <QApplication>
#include <QDesktopWidget>
#include <QIcon>
#include <QKeyEvent>
#include <QKeySequence>
#include <QShortcut>
#include <QActionGroup>
#include <QScreen>
#include <KActionCollection>
#include <KConfig>
......@@ -71,11 +72,12 @@ KGoldrunner::KGoldrunner()
/************************ SET PLAYFIELD AND GAME DATA ***********************/
/******************************************************************************/
const QSize maxSize = screen()->availableGeometry().size();
// Base the size of playing-area and widgets on the monitor resolution.
int dw = QApplication::desktop()->width();
int dw = maxSize.width();
// Need to consider the height, for widescreen displays (eg. 1280x768).
int dh = QApplication::desktop()->height();
int dh = maxSize.height();
dw = qMin ((4 * dh + 1) / 3, dw); // KGoldrunner aspect ratio is 4:3.
dh = (3 * dw + 2) / 4;
......
......@@ -1567,7 +1567,11 @@ bool KGrGame::selectSavedGame (int & selectedGame, int & selectedLevel)
}
if (index >= 0) {
selectedGame = index;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
selectedLevel = loadedData.midRef (28, 3).toInt();
#else
selectedLevel = QStringView(loadedData).mid(28, 3).toInt();
#endif
result = true;
}
else {
......
......@@ -12,9 +12,9 @@
#include "kgrgameio.h"
#include <QApplication>
#include <QDesktopWidget>
#include <QGridLayout>
#include <QHeaderView>
#include <QScreen>
#include <QLabel>
#include <QPainter>
#include <QPushButton>
......@@ -224,8 +224,8 @@ void KGrSLDialog::setupWidgets()
// Avoid spilling into the Taskbar or Apple Dock area if they get too close.
// Otherwise allow the dialog to choose its size and then be resizeable.
const QRect avail = QApplication::desktop()->availableGeometry(this);
if ((avail.height() - slParent->height()) <= 120) {
const QSize maxSize = screen()->availableGeometry().size();
if ((maxSize.height() - slParent->height()) <= 120) {
dad->setFixedHeight (slParent->height() - 120); // Keep 120 for buttons.
}
......
......@@ -23,7 +23,9 @@ static void addCredits (KAboutData & about);
int main (int argc, char **argv)
{
// Fixes blurry icons with fractional scaling
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
#endif
QApplication app(argc, argv);
KLocalizedString::setApplicationDomain("kgoldrunner");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment