Clean #if version check blocks

Since 08a21ae7b6 we now depend on Qt 5.14
This commit is contained in:
Méven Car 2020-05-28 13:34:56 +02:00 committed by Méven Car
parent c54d069d43
commit 464203c60e
3 changed files with 0 additions and 29 deletions

View file

@ -41,17 +41,10 @@ void Plugin::registerTypes(const char *uri)
qmlRegisterType<KDecoration2::Preview::PreviewItem>(uri, 1, 0, "Decoration"); qmlRegisterType<KDecoration2::Preview::PreviewItem>(uri, 1, 0, "Decoration");
qmlRegisterType<KDecoration2::Preview::PreviewButtonItem>(uri, 1, 0, "Button"); qmlRegisterType<KDecoration2::Preview::PreviewButtonItem>(uri, 1, 0, "Button");
qmlRegisterType<KDecoration2::Preview::ButtonsModel>(uri, 1, 0, "ButtonsModel"); qmlRegisterType<KDecoration2::Preview::ButtonsModel>(uri, 1, 0, "ButtonsModel");
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
qmlRegisterType<KDecoration2::Preview::PreviewClient>();
qmlRegisterType<KDecoration2::Decoration>();
qmlRegisterType<KDecoration2::DecorationShadow>();
qmlRegisterType<KDecoration2::Preview::PreviewBridge>();
#else
qmlRegisterAnonymousType<KDecoration2::Preview::PreviewClient>(uri, 1); qmlRegisterAnonymousType<KDecoration2::Preview::PreviewClient>(uri, 1);
qmlRegisterAnonymousType<KDecoration2::Decoration>(uri, 1); qmlRegisterAnonymousType<KDecoration2::Decoration>(uri, 1);
qmlRegisterAnonymousType<KDecoration2::DecorationShadow>(uri, 1); qmlRegisterAnonymousType<KDecoration2::DecorationShadow>(uri, 1);
qmlRegisterAnonymousType<KDecoration2::Preview::PreviewBridge>(uri, 1); qmlRegisterAnonymousType<KDecoration2::Preview::PreviewBridge>(uri, 1);
#endif
} }
} }

View file

@ -68,15 +68,9 @@ KCMKWinDecoration::KCMKWinDecoration(QObject *parent, const QVariantList &argume
QStringLiteral("vpilo@coldshock.net")); QStringLiteral("vpilo@coldshock.net"));
setAboutData(about); setAboutData(about);
setButtons(Apply | Default | Help); setButtons(Apply | Default | Help);
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
qmlRegisterType<QAbstractListModel>();
qmlRegisterType<QSortFilterProxyModel>();
qmlRegisterType<KWinDecorationSettings>();
#else
qmlRegisterAnonymousType<QAbstractListModel>("org.kde.kwin.KWinDecoration", 1); qmlRegisterAnonymousType<QAbstractListModel>("org.kde.kwin.KWinDecoration", 1);
qmlRegisterAnonymousType<QSortFilterProxyModel>("org.kde.kwin.KWinDecoration", 1); qmlRegisterAnonymousType<QSortFilterProxyModel>("org.kde.kwin.KWinDecoration", 1);
qmlRegisterAnonymousType<KWinDecorationSettings>("org.kde.kwin.KWinDecoration", 1); qmlRegisterAnonymousType<KWinDecorationSettings>("org.kde.kwin.KWinDecoration", 1);
#endif
m_proxyThemesModel->setSourceModel(m_themesModel); m_proxyThemesModel->setSourceModel(m_themesModel);
m_proxyThemesModel->setFilterCaseSensitivity(Qt::CaseInsensitive); m_proxyThemesModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
m_proxyThemesModel->setSortCaseSensitivity(Qt::CaseInsensitive); m_proxyThemesModel->setSortCaseSensitivity(Qt::CaseInsensitive);

View file

@ -88,11 +88,7 @@ void Integration::initialize()
); );
QPlatformIntegration::initialize(); QPlatformIntegration::initialize();
auto dummyScreen = new Screen(-1); auto dummyScreen = new Screen(-1);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 13, 0))
QWindowSystemInterface::handleScreenAdded(dummyScreen); QWindowSystemInterface::handleScreenAdded(dummyScreen);
#else
screenAdded(dummyScreen);
#endif
m_screens << dummyScreen; m_screens << dummyScreen;
m_inputContext.reset(QPlatformInputContextFactory::create(QStringLiteral("qtvirtualkeyboard"))); m_inputContext.reset(QPlatformInputContextFactory::create(QStringLiteral("qtvirtualkeyboard")));
qunsetenv("QT_IM_MODULE"); qunsetenv("QT_IM_MODULE");
@ -182,28 +178,16 @@ void Integration::initScreens()
newScreens.reserve(qMax(screens()->count(), 1)); newScreens.reserve(qMax(screens()->count(), 1));
for (int i = 0; i < screens()->count(); i++) { for (int i = 0; i < screens()->count(); i++) {
auto screen = new Screen(i); auto screen = new Screen(i);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 13, 0))
QWindowSystemInterface::handleScreenAdded(screen); QWindowSystemInterface::handleScreenAdded(screen);
#else
screenAdded(screen);
#endif
newScreens << screen; newScreens << screen;
} }
if (newScreens.isEmpty()) { if (newScreens.isEmpty()) {
auto dummyScreen = new Screen(-1); auto dummyScreen = new Screen(-1);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 13, 0))
QWindowSystemInterface::handleScreenAdded(dummyScreen); QWindowSystemInterface::handleScreenAdded(dummyScreen);
#else
screenAdded(dummyScreen);
#endif
newScreens << dummyScreen; newScreens << dummyScreen;
} }
while (!m_screens.isEmpty()) { while (!m_screens.isEmpty()) {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 13, 0))
QWindowSystemInterface::handleScreenRemoved(m_screens.takeLast()); QWindowSystemInterface::handleScreenRemoved(m_screens.takeLast());
#else
destroyScreen(m_screens.takeLast());
#endif
} }
m_screens = newScreens; m_screens = newScreens;
} }