Commit de7c99bd authored by Alexander Volkov's avatar Alexander Volkov

Require Qt 5.9

Summary:
Plasma 5.12 requires Qt 5.9, so also plasma-integration can require Qt 5.9
which removes quite some ifdefs.

Reviewers: #plasma, graesslin

Reviewed By: #plasma, graesslin

Subscribers: graesslin, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D9625
parent 0f3fd179
......@@ -21,7 +21,7 @@ include(KDEInstallDirs)
include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
include(KDECMakeSettings)
set(REQUIRED_QT_VERSION 5.5.0)
set(REQUIRED_QT_VERSION 5.9.0)
find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Widgets DBus X11Extras QuickControls2)
set(KF5_DEP_VERSION "5.33.0")
......@@ -45,21 +45,8 @@ set_package_properties(Breeze PROPERTIES
PURPOSE "For setting the default QStyle name")
# dependencies for QPA plugin
if(Qt5Core_VERSION VERSION_LESS "5.8.0")
find_package(Qt5PlatformSupport REQUIRED)
else()
find_package(Qt5ThemeSupport REQUIRED)
endif()
if(Qt5Core_VERSION VERSION_LESS "5.8.0")
add_definitions(-DQ_FONTCONFIGDATABASE)
set(QT5PLATFORMSUPPORT_LIBS Qt5PlatformSupport::Qt5PlatformSupport)
else()
set(QT5PLATFORMSUPPORT_LIBS
Qt5ThemeSupport::Qt5ThemeSupport
)
endif()
find_package(Qt5ThemeSupport REQUIRED)
set(QT5PLATFORMSUPPORT_LIBS Qt5ThemeSupport::Qt5ThemeSupport)
add_definitions(-DTRANSLATION_DOMAIN=\"plasmaintegration5\")
if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/po")
......
......@@ -33,6 +33,7 @@ macro(FRAMEWORKINTEGRATION_TESTS _testname)
endmacro()
set(platformThemeSRCS
../src/platformtheme/qdbusmenubar.cpp # fork of Qt's qdbusmenubar with some added setters for our convenience
../src/platformtheme/kdeplatformtheme.cpp
../src/platformtheme/kfontsettingsdata.cpp
../src/platformtheme/khintssettings.cpp
......@@ -45,13 +46,6 @@ set(platformThemeSRCS
../src/platformtheme/x11integration.cpp
)
if(Qt5Core_VERSION VERSION_EQUAL "5.7.0" OR Qt5Core_VERSION VERSION_GREATER "5.7.0")
set(platformThemeSRCS
../src/platformtheme/qdbusmenubar.cpp # fork of Qt's qdbusmenubar with some added setters for our convenience
${platformThemeSRCS}
)
endif()
frameworkintegration_tests(
kdeplatformtheme_unittest
${platformThemeSRCS}
......
......@@ -75,7 +75,6 @@ private Q_SLOTS:
QCOMPARE(dialog.selectedNameFilter(), selectNameFilter);
}
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
void testSelectedMimeTypeFilter_data()
{
QTest::addColumn<QStringList>("mimeTypeFilters");
......@@ -121,9 +120,6 @@ private Q_SLOTS:
QCOMPARE(dialog.selectedMimeTypeFilter(), QStringLiteral("application/json"));
}
#endif
void testSetDirectory()
{
QFileDialog dialog;
......
......@@ -21,6 +21,7 @@ include_directories(${Qt5Core_PRIVATE_INCLUDE_DIRS})
include_directories(${Qt5Gui_PRIVATE_INCLUDE_DIRS})
set(platformtheme_SRCS
qdbusmenubar.cpp # fork of Qt's qdbusmenubar with some added setters for our convenience
kdeplatformtheme.cpp
kfontsettingsdata.cpp
khintssettings.cpp
......@@ -34,13 +35,6 @@ set(platformtheme_SRCS
main.cpp
)
if(Qt5Core_VERSION VERSION_EQUAL "5.7.0" OR Qt5Core_VERSION VERSION_GREATER "5.7.0")
set(platformtheme_SRCS
qdbusmenubar.cpp # fork of Qt's qdbusmenubar with some added setters for our convenience
${platformtheme_SRCS}
)
endif()
add_library(KDEPlasmaPlatformTheme MODULE ${platformtheme_SRCS})
target_link_libraries(KDEPlasmaPlatformTheme
......
......@@ -300,9 +300,7 @@ void KDEPlatformFileDialogHelper::initializeDialog()
if (!mimeFilters.isEmpty()) {
QString defaultMimeFilter;
if (options()->acceptMode() == QFileDialogOptions::AcceptSave) {
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
defaultMimeFilter = options()->initiallySelectedMimeTypeFilter();
#endif
if (defaultMimeFilter.isEmpty()) {
defaultMimeFilter = mimeFilters.at(0);
}
......@@ -315,17 +313,11 @@ void KDEPlatformFileDialogHelper::initializeDialog()
dialog->m_fileWidget->setFilter(qt2KdeFilter(nameFilters));
}
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
if (!options()->initiallySelectedMimeTypeFilter().isEmpty()) {
selectMimeTypeFilter(options()->initiallySelectedMimeTypeFilter());
} else if (!options()->initiallySelectedNameFilter().isEmpty()) {
selectNameFilter(options()->initiallySelectedNameFilter());
}
#else
if (!options()->initiallySelectedNameFilter().isEmpty()) {
selectNameFilter(options()->initiallySelectedNameFilter());
}
#endif
// overwrite option
if (options()->testOption(QFileDialogOptions::FileDialogOption::DontConfirmOverwrite)) {
......@@ -390,7 +382,6 @@ QList<QUrl> KDEPlatformFileDialogHelper::selectedFiles() const
return m_dialog->selectedFiles();
}
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
QString KDEPlatformFileDialogHelper::selectedMimeTypeFilter() const
{
return m_dialog->selectedMimeTypeFilter();
......@@ -400,7 +391,6 @@ void KDEPlatformFileDialogHelper::selectMimeTypeFilter(const QString &filter)
{
m_dialog->selectMimeTypeFilter(filter);
}
#endif
QString KDEPlatformFileDialogHelper::selectedNameFilter() const
{
......
......@@ -61,10 +61,8 @@ public:
bool defaultNameFilterDisables() const override;
QUrl directory() const override;
QList<QUrl> selectedFiles() const override;
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
QString selectedMimeTypeFilter() const override;
void selectMimeTypeFilter(const QString &filter) override;
#endif
QString selectedNameFilter() const override;
void selectNameFilter(const QString &filter) override;
void selectFile(const QUrl &filename) override;
......
......@@ -53,9 +53,7 @@
#include <KWindowSystem>
#include <KIO/Global>
#if QT_VERSION >= QT_VERSION_CHECK(5,7,0)
#include "qdbusmenubar_p.h"
#endif
static const QByteArray s_x11AppMenuServiceNamePropertyName = QByteArrayLiteral("_KDE_NET_WM_APPMENU_SERVICE_NAME");
static const QByteArray s_x11AppMenuObjectPathPropertyName = QByteArrayLiteral("_KDE_NET_WM_APPMENU_OBJECT_PATH");
......@@ -122,13 +120,6 @@ QIcon KdePlatformTheme::fileIcon(const QFileInfo &fileInfo, QPlatformTheme::Icon
return QIcon::fromTheme(KIO::iconNameForUrl(QUrl::fromLocalFile(fileInfo.absoluteFilePath())));
}
#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
QPixmap KdePlatformTheme::fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &size, QPlatformTheme::IconOptions iconOptions) const
{
return fileIcon(fileInfo, iconOptions).pixmap(size.toSize(), QIcon::Normal);
}
#endif
const QPalette *KdePlatformTheme::palette(Palette type) const
{
QPalette *palette = m_hints->palette(type);
......@@ -347,7 +338,6 @@ QPlatformSystemTrayIcon *KdePlatformTheme::createPlatformSystemTrayIcon() const
return new KDEPlatformSystemTrayIcon;
}
#if QT_VERSION >= QT_VERSION_CHECK(5,7,0)
QPlatformMenuBar *KdePlatformTheme::createPlatformMenuBar() const
{
if (isDBusGlobalMenuAvailable()) {
......@@ -385,7 +375,6 @@ QPlatformMenuBar *KdePlatformTheme::createPlatformMenuBar() const
return nullptr;
}
#endif
//force QtQuickControls2 to use the desktop theme as default
void KdePlatformTheme::setQtQuickControlsTheme()
......
......@@ -43,16 +43,9 @@ public:
~KdePlatformTheme();
QVariant themeHint(ThemeHint hint) const override;
#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
QIcon fileIcon(const QFileInfo &fileInfo,
QPlatformTheme::IconOptions iconOptions) const override;
#else
QPixmap fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &size,
QPlatformTheme::IconOptions iconOptions) const override;
// this will be the implementation
QIcon fileIcon(const QFileInfo &fileInfo,
QPlatformTheme::IconOptions iconOptions) const;
#endif
const QPalette *palette(Palette type = SystemPalette) const override;
const QFont *font(Font type) const override;
QIconEngine *createIconEngine(const QString &iconName) const override;
......@@ -65,9 +58,7 @@ public:
QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const override;
#if QT_VERSION >= QT_VERSION_CHECK(5,7,0)
QPlatformMenuBar *createPlatformMenuBar() const override;
#endif
private:
void loadSettings();
......
......@@ -55,19 +55,10 @@
#include <QtCore/QString>
#include <QtGui/QWindow>
#if (QT_VERSION < QT_VERSION_CHECK(5, 8, 0))
#include <QtPlatformSupport/private/qdbusplatformmenu_p.h>
#include <QtPlatformSupport/private/qdbusmenuadaptor_p.h>
#include <QtPlatformSupport/private/qdbusmenuconnection_p.h>
#include <QtPlatformSupport/private/qdbusmenuregistrarproxy_p.h>
#else
#include <QtThemeSupport/private/qdbusplatformmenu_p.h>
#include <QtThemeSupport/private/qdbusmenuadaptor_p.h>
#include <QtThemeSupport/private/qdbusmenuconnection_p.h>
#include <QtThemeSupport/private/qdbusmenuregistrarproxy_p.h>
#endif
QT_BEGIN_NAMESPACE
......
......@@ -113,13 +113,12 @@ void X11Integration::installDesktopFileName(QWindow *w)
if (!w->isTopLevel()) {
return;
}
#if (QT_VERSION >= QT_VERSION_CHECK(5, 7, 0))
if (QGuiApplication::desktopFileName().isEmpty()) {
return;
}
NETWinInfo info(QX11Info::connection(), w->winId(), QX11Info::appRootWindow(), NET::Properties(), NET::Properties2());
info.setDesktopFileName(QGuiApplication::desktopFileName().toUtf8().constData());
#endif
}
void X11Integration::setWindowProperty(QWindow *window, const QByteArray &name, const QByteArray &value)
......
......@@ -129,9 +129,7 @@ int main(int argc, char **argv)
if (dialog.result() == QDialog::Accepted) {
qDebug() << "selected files" << dialog.selectedFiles();
qDebug() << "selected urls" << dialog.selectedUrls();
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
qDebug() << "selected mime type filter" << dialog.selectedMimeTypeFilter();
#endif
}
qDebug() << "mime type filter(s):" << dialog.mimeTypeFilters();
......
Markdown is supported
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