diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,81 +4,67 @@ cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) -option(USE_KDE4 "Build a widget style for KDE4 (and nothing else)") - include(GenerateExportHeader) include(WriteBasicConfigVersionFile) include(FeatureSummary) -if(USE_KDE4) - find_package(KDE4 REQUIRED) - include(KDE4Defaults) - include(MacroLibrary) - - add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS}) - include_directories(${KDE4_INCLUDES}) - - add_subdirectory(libbreezecommon) - add_subdirectory(kstyle) -else() - find_package(ECM 0.0.9 REQUIRED NO_MODULE) - set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_SOURCE_DIR}/cmake) +find_package(ECM 0.0.9 REQUIRED NO_MODULE) +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_SOURCE_DIR}/cmake) - include(ECMInstallIcons) - include(KDEInstallDirs) - include(KDECMakeSettings) - include(KDECompilerSettings NO_POLICY_SCOPE) - include(KDEClangFormat) +include(ECMInstallIcons) +include(KDEInstallDirs) +include(KDECMakeSettings) +include(KDECompilerSettings NO_POLICY_SCOPE) +include(KDEClangFormat) - include(GtkUpdateIconCache) +include(GtkUpdateIconCache) - option(WITH_DECORATIONS "Build Breeze window decorations for KWin" ON) - if(WITH_DECORATIONS) +option(WITH_DECORATIONS "Build Breeze window decorations for KWin" ON) +if(WITH_DECORATIONS) find_package(KDecoration2 REQUIRED) add_subdirectory(kdecoration) - endif() +endif() - add_subdirectory(colors) - add_subdirectory(cursors) - add_subdirectory(libbreezecommon) - add_subdirectory(kstyle) - add_subdirectory(misc) +add_subdirectory(colors) +add_subdirectory(cursors) +add_subdirectory(libbreezecommon) +add_subdirectory(kstyle) +add_subdirectory(misc) - option(WITH_WALLPAPERS "Install Breeze default wallpapers" ON) - if (WITH_WALLPAPERS) +option(WITH_WALLPAPERS "Install Breeze default wallpapers" ON) +if (WITH_WALLPAPERS) add_subdirectory(wallpapers) - endif() +endif() - find_package(KF5Package CONFIG REQUIRED) - kpackage_install_package(lookandfeel.dark org.kde.breezedark.desktop look-and-feel plasma) - if(EXISTS ${CMAKE_SOURCE_DIR}/po AND IS_DIRECTORY ${CMAKE_SOURCE_DIR}/po) +find_package(KF5Package CONFIG REQUIRED) +kpackage_install_package(lookandfeel.dark org.kde.breezedark.desktop look-and-feel plasma) +if(EXISTS ${CMAKE_SOURCE_DIR}/po AND IS_DIRECTORY ${CMAKE_SOURCE_DIR}/po) find_package(KF5I18n CONFIG REQUIRED) ki18n_install(po) - endif() - - include(ECMSetupVersion) - ecm_setup_version(${PROJECT_VERSION} VARIABLE_PREFIX BREEZE - PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/BreezeConfigVersion.cmake" - ) - - # create a Config.cmake and a ConfigVersion.cmake file and install them - set(CMAKECONFIG_INSTALL_DIR "${CMAKECONFIG_INSTALL_PREFIX}/Breeze") - - ecm_configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/BreezeConfig.cmake.in" - "${CMAKE_CURRENT_BINARY_DIR}/BreezeConfig.cmake" - PATH_VARS KDE_INSTALL_FULL_DATADIR - INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR} - ) - - # add clang-format target for all our real source files - file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h) - kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES}) - - install(FILES "${CMAKE_CURRENT_BINARY_DIR}/BreezeConfig.cmake" - "${CMAKE_CURRENT_BINARY_DIR}/BreezeConfigVersion.cmake" - DESTINATION "${CMAKECONFIG_INSTALL_DIR}" - COMPONENT Devel - ) endif() +include(ECMSetupVersion) +ecm_setup_version(${PROJECT_VERSION} VARIABLE_PREFIX BREEZE + PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/BreezeConfigVersion.cmake" + ) + +# create a Config.cmake and a ConfigVersion.cmake file and install them +set(CMAKECONFIG_INSTALL_DIR "${CMAKECONFIG_INSTALL_PREFIX}/Breeze") + +ecm_configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/BreezeConfig.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/BreezeConfig.cmake" + PATH_VARS KDE_INSTALL_FULL_DATADIR + INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR} + ) + +# add clang-format target for all our real source files +file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h) +kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES}) + +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/BreezeConfig.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/BreezeConfigVersion.cmake" + DESTINATION "${CMAKECONFIG_INSTALL_DIR}" + COMPONENT Devel + ) + feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/kstyle/CMakeLists.txt b/kstyle/CMakeLists.txt --- a/kstyle/CMakeLists.txt +++ b/kstyle/CMakeLists.txt @@ -1,85 +1,45 @@ -set(BREEZE_USE_KDE4 ${USE_KDE4}) -if(BREEZE_USE_KDE4) - - ############ Language and toolchain features - ############ copied from ECM - if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") - elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" AND NOT WIN32) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") - endif() - -endif() - ################# Qt/KDE ################# -if(BREEZE_USE_KDE4) - - ### XCB - if(UNIX AND NOT APPLE) - find_package(PkgConfig REQUIRED) - pkg_check_modules(XCB xcb x11-xcb) - add_feature_info("x11-xcb" XCB_FOUND "Required to pass style properties to native Windows on X11 Platform") - set_feature_info("x11-xcb" "Required to pass style properties to native Windows on X11 Platform" "https://xcb.freedesktop.org") - set(BREEZE_HAVE_X11 ${XCB_FOUND}) - else() - set(BREEZE_HAVE_X11 FALSE) - endif() - - set(BREEZE_HAVE_QTQUICK FALSE) - set(BREEZE_HAVE_KWAYLAND FALSE) - - ### KStyle - set(BREEZE_HAVE_KSTYLE FALSE) - -else() - - find_package(Qt5 REQUIRED CONFIG COMPONENTS Widgets DBus) - find_package(KF5 REQUIRED COMPONENTS - I18n - Config - GuiAddons - ConfigWidgets - WindowSystem) - - find_package(Qt5 COMPONENTS Quick) - set(BREEZE_HAVE_QTQUICK ${Qt5Quick_FOUND}) - - find_package( KF5FrameworkIntegration CONFIG ) - set_package_properties(KF5FrameworkIntegration PROPERTIES - DESCRIPTION "KF5 Framework Integration" - URL "https://projects.kde.org/projects/frameworks/frameworkintegration" - TYPE OPTIONAL - PURPOSE "Required to use KStyle convenience functionalities in style") - - set(BREEZE_HAVE_KSTYLE ${KF5FrameworkIntegration_FOUND}) - - find_package(XCB COMPONENTS XCB) - set_package_properties(XCB PROPERTIES - DESCRIPTION "X protocol C-language Binding" - URL "https://xcb.freedesktop.org" - TYPE OPTIONAL - PURPOSE "Required to pass style properties to native Windows on X11 Platform" - ) - - find_package(KF5Wayland CONFIG) - set(BREEZE_HAVE_KWAYLAND ${KF5Wayland_FOUND}) +find_package(Qt5 REQUIRED CONFIG COMPONENTS Widgets DBus) +find_package(KF5 REQUIRED COMPONENTS + I18n + Config + GuiAddons + ConfigWidgets + WindowSystem) + +find_package(Qt5 COMPONENTS Quick) +set(BREEZE_HAVE_QTQUICK ${Qt5Quick_FOUND}) + +find_package( KF5FrameworkIntegration CONFIG ) +set_package_properties(KF5FrameworkIntegration PROPERTIES + DESCRIPTION "KF5 Framework Integration" + URL "https://projects.kde.org/projects/frameworks/frameworkintegration" + TYPE OPTIONAL + PURPOSE "Required to use KStyle convenience functionalities in style") + +set(BREEZE_HAVE_KSTYLE ${KF5FrameworkIntegration_FOUND}) + +find_package(XCB COMPONENTS XCB) +set_package_properties(XCB PROPERTIES + DESCRIPTION "X protocol C-language Binding" + URL "https://xcb.freedesktop.org" + TYPE OPTIONAL + PURPOSE "Required to pass style properties to native Windows on X11 Platform" +) - if(UNIX AND NOT APPLE) +find_package(KF5Wayland CONFIG) +set(BREEZE_HAVE_KWAYLAND ${KF5Wayland_FOUND}) +if(UNIX AND NOT APPLE) set(BREEZE_HAVE_X11 ${XCB_XCB_FOUND}) if (XCB_XCB_FOUND) - find_package(Qt5 REQUIRED CONFIG COMPONENTS X11Extras) + find_package(Qt5 REQUIRED CONFIG COMPONENTS X11Extras) endif() - - else() - +else() set(BREEZE_HAVE_X11 FALSE) - - endif() - - endif() + ################# includes ################# include_directories( animations @@ -121,6 +81,7 @@ animations/breezewidgetstatedata.cpp debug/breezewidgetexplorer.cpp breezeaddeventfilter.cpp + breezeblurhelper.cpp breezeframeshadow.cpp breezehelper.cpp breezemdiwindowshadow.cpp @@ -134,62 +95,37 @@ breezewindowmanager.cpp ) -if(NOT BREEZE_USE_KDE4) - set(breeze_PART_SRCS - ${breeze_PART_SRCS} - breezeblurhelper.cpp - ) -endif() - -if(BREEZE_USE_KDE4) - - kde4_add_kcfg_files(breeze_PART_SRCS breezestyleconfigdata.kcfgc) - kde4_add_plugin(breeze ${breeze_PART_SRCS} kstylekde4compat.cpp) - target_link_libraries(breeze ${KDE4_KDEUI_LIBS}) - target_link_libraries(breeze breezecommon4) - - if(BREEZE_HAVE_X11) - target_link_libraries(breeze ${X11_XCB_LIBRARIES}) - target_link_libraries(breeze ${XCB_LIBRARIES}) - endif() - - install(TARGETS breeze DESTINATION ${PLUGIN_INSTALL_DIR}/plugins/styles/) - -else() - - kconfig_add_kcfg_files(breeze_PART_SRCS breezestyleconfigdata.kcfgc) - add_library(breeze MODULE ${breeze_PART_SRCS}) - target_link_libraries(breeze Qt5::Core Qt5::Gui Qt5::Widgets Qt5::DBus) - if( BREEZE_HAVE_QTQUICK ) +kconfig_add_kcfg_files(breeze_PART_SRCS breezestyleconfigdata.kcfgc) +add_library(breeze MODULE ${breeze_PART_SRCS}) +target_link_libraries(breeze Qt5::Core Qt5::Gui Qt5::Widgets Qt5::DBus) +if( BREEZE_HAVE_QTQUICK ) target_link_libraries(breeze Qt5::Quick) - endif() - target_link_libraries(breeze KF5::ConfigCore KF5::ConfigWidgets KF5::GuiAddons KF5::WindowSystem) - target_link_libraries(breeze breezecommon5) +endif() +target_link_libraries(breeze KF5::ConfigCore KF5::ConfigWidgets KF5::GuiAddons KF5::WindowSystem) +target_link_libraries(breeze breezecommon5) - if( KF5FrameworkIntegration_FOUND ) - target_link_libraries(breeze KF5::Style) - endif() +if(KF5FrameworkIntegration_FOUND) + target_link_libraries(breeze KF5::Style) +endif() - if (WIN32) +if (WIN32) # As stated in https://docs.microsoft.com/en-us/cpp/c-runtime-library/math-constants M_PI only gets defined # when if _USE_MATH_DEFINES is defined target_compile_definitions(breeze PRIVATE _USE_MATH_DEFINES _BSD_SOURCE) - endif() +endif() - if(BREEZE_HAVE_X11) +if(BREEZE_HAVE_X11) target_link_libraries(breeze ${XCB_LIBRARIES}) target_link_libraries(breeze Qt5::X11Extras) - endif() +endif() - if(BREEZE_HAVE_KWAYLAND) +if(BREEZE_HAVE_KWAYLAND) target_link_libraries(breeze KF5::WaylandClient) - endif() - - install(TARGETS breeze DESTINATION ${QT_PLUGIN_INSTALL_DIR}/styles/) - endif() + ########### install files ############### +install(TARGETS breeze DESTINATION ${QT_PLUGIN_INSTALL_DIR}/styles/) install(FILES breeze.themerc DESTINATION ${DATA_INSTALL_DIR}/kstyle/themes) ########### subdirectories ############### diff --git a/kstyle/animations/breezetransitionwidget.cpp b/kstyle/animations/breezetransitionwidget.cpp --- a/kstyle/animations/breezetransitionwidget.cpp +++ b/kstyle/animations/breezetransitionwidget.cpp @@ -80,11 +80,7 @@ rect = rect.translated( widget->mapTo( widget->window(), widget->rect().topLeft() ) ); widget = widget->window(); - #if QT_VERSION < 0x050000 - out = QPixmap::grabWidget( widget, rect ); - #else out = widget->grab( rect ); - #endif } else { diff --git a/kstyle/breeze.h b/kstyle/breeze.h --- a/kstyle/breeze.h +++ b/kstyle/breeze.h @@ -31,22 +31,12 @@ //*@name convenience typedef //@{ - #if QT_VERSION >= 0x050000 //* scoped pointer convenience typedef template using WeakPointer = QPointer; - #else - //* scoped pointer convenience typedef - template using WeakPointer = QWeakPointer; - #endif //* scoped pointer convenience typedef template using ScopedPointer = QScopedPointer; - //* disable QStringLiteral for older Qt version - #if QT_VERSION < 0x050000 - using QStringLiteral = QString; - #endif - //@} //* metrics diff --git a/kstyle/breezehelper.h b/kstyle/breezehelper.h --- a/kstyle/breezehelper.h +++ b/kstyle/breezehelper.h @@ -28,10 +28,6 @@ #include #include -#if BREEZE_USE_KDE4 -#include -#endif - #include #include @@ -52,11 +48,6 @@ //* constructor explicit Helper( KSharedConfig::Ptr ); - #if BREEZE_USE_KDE4 - //* constructor - explicit Helper( const QByteArray& ); - #endif - //* destructor virtual ~Helper() {} @@ -334,11 +325,6 @@ private: - #if BREEZE_USE_KDE4 - //* component data - KComponentData _componentData; - #endif - //* configuration KSharedConfig::Ptr _config; diff --git a/kstyle/breezehelper.cpp b/kstyle/breezehelper.cpp --- a/kstyle/breezehelper.cpp +++ b/kstyle/breezehelper.cpp @@ -28,10 +28,6 @@ #include #include -#if BREEZE_HAVE_X11 && QT_VERSION < 0x050000 -#include -#endif - #include namespace Breeze @@ -45,14 +41,6 @@ _config( std::move( config ) ) { init(); } - //____________________________________________________________________ - #if BREEZE_USE_KDE4 - Helper::Helper( const QByteArray& name ): - _componentData( name, nullptr, KComponentData::SkipMainComponentRegistration ), - _config( _componentData.config() ) - { init(); } - #endif - //____________________________________________________________________ KSharedConfig::Ptr Helper::config() const { return _config; } @@ -1463,12 +1451,8 @@ bool Helper::isX11() { #if BREEZE_HAVE_X11 - #if QT_VERSION >= 0x050000 static const bool s_isX11 = KWindowSystem::isPlatformX11(); return s_isX11; - #else - return true; - #endif #endif return false; @@ -1478,12 +1462,8 @@ //______________________________________________________________________________ bool Helper::isWayland() { - #if QT_VERSION >= 0x050000 static const bool s_isWayland = KWindowSystem::isPlatformWayland(); return s_isWayland; - #else - return false; - #endif } //______________________________________________________________________________ @@ -1597,44 +1577,25 @@ //______________________________________________________________________________________ QPixmap Helper::highDpiPixmap( int width, int height ) const { - #if QT_VERSION >= 0x050300 const qreal dpiRatio( qApp->devicePixelRatio() ); QPixmap pixmap( width*dpiRatio, height*dpiRatio ); pixmap.setDevicePixelRatio( dpiRatio ); return pixmap; - #else - return QPixmap( width, height ); - #endif } //______________________________________________________________________________________ qreal Helper::devicePixelRatio( const QPixmap& pixmap ) const { - #if QT_VERSION >= 0x050300 return pixmap.devicePixelRatio(); - #else - Q_UNUSED(pixmap); - return 1; - #endif } #if BREEZE_HAVE_X11 //____________________________________________________________________ xcb_connection_t* Helper::connection() { - #if QT_VERSION >= 0x050000 return QX11Info::connection(); - #else - static xcb_connection_t* connection = nullptr; - if( !connection ) - { - Display* display = QX11Info::display(); - if( display ) connection = XGetXCBConnection( display ); - } - return connection; - #endif } //____________________________________________________________________ diff --git a/kstyle/breezemnemonics.cpp b/kstyle/breezemnemonics.cpp --- a/kstyle/breezemnemonics.cpp +++ b/kstyle/breezemnemonics.cpp @@ -70,11 +70,9 @@ { setEnabled( false ); } break; - #if QT_VERSION >= 0x050000 case QEvent::ApplicationStateChange: { setEnabled( false ); } break; - #endif default: break; diff --git a/kstyle/breezeshadowhelper.cpp b/kstyle/breezeshadowhelper.cpp --- a/kstyle/breezeshadowhelper.cpp +++ b/kstyle/breezeshadowhelper.cpp @@ -216,12 +216,7 @@ const QSize boxSize = BoxShadowRenderer::calculateMinimumBoxSize(params.shadow1.radius) .expandedTo(BoxShadowRenderer::calculateMinimumBoxSize(params.shadow2.radius)); - #if QT_VERSION >= 0x050300 const qreal dpr = qApp->devicePixelRatio(); - #else - const qreal dpr = 1.0; - #endif - const qreal frameRadius = _helper.frameRadius(); BoxShadowRenderer shadowRenderer; @@ -255,11 +250,7 @@ painter.setBrush(Qt::black); painter.setCompositionMode(QPainter::CompositionMode_DestinationOut); painter.drawRoundedRect( -#if BREEZE_USE_KDE4 - outerRect.adjusted(margins.left(), margins.top(), -margins.right(), -margins.bottom()), -#else outerRect - margins, -#endif frameRadius, frameRadius); @@ -439,14 +430,7 @@ int bottom = widget->contentsMargins().bottom(); // Need to decrement default size further due to extra hard coded round corner. -#if BREEZE_USE_KDE4 - margins.setLeft(margins.left() - 1); - margins.setTop(margins.top() - 1); - margins.setRight(margins.right() - 1); - margins.setBottom(margins.bottom() - 1); -#else margins -= 1; -#endif // Arrow can be either to the top or the bottom. Adjust margins accordingly. const int diff = qAbs(top - bottom); @@ -457,15 +441,7 @@ } } -#if BREEZE_USE_KDE4 - const qreal dpr = _helper.devicePixelRatio(_shadowTiles.pixmap(0)); - margins.setLeft(margins.left() * dpr); - margins.setTop(margins.top() * dpr); - margins.setRight(margins.right() * dpr); - margins.setBottom(margins.bottom() * dpr); -#else margins *= _helper.devicePixelRatio(_shadowTiles.pixmap(0)); -#endif return margins; } diff --git a/kstyle/breezestyle.h b/kstyle/breezestyle.h --- a/kstyle/breezestyle.h +++ b/kstyle/breezestyle.h @@ -28,25 +28,18 @@ #include #endif -#if BREEZE_USE_KDE4 -#include "kstylekde4compat.h" -#endif - #include #include +#include #include #include #include #include #include #include #include -#if QT_VERSION >= 0x050000 -#include -#endif - #include namespace BreezePrivate @@ -66,14 +59,10 @@ class SplitterFactory; class WidgetExplorer; class WindowManager; - #if !BREEZE_USE_KDE4 class BlurHelper; - #endif //* convenience typedef for base class - #if BREEZE_USE_KDE4 - using ParentStyleClass = KStyleKDE4Compat; - #elif !BREEZE_HAVE_KSTYLE + #if !BREEZE_HAVE_KSTYLE using ParentStyleClass = QCommonStyle; #else using ParentStyleClass = KStyle; @@ -149,10 +138,7 @@ bool eventFilterComboBoxContainer( QWidget*, QEvent* ); bool eventFilterDockWidget( QDockWidget*, QEvent* ); bool eventFilterMdiSubWindow( QMdiSubWindow*, QEvent* ); - - #if QT_VERSION >= 0x050000 bool eventFilterCommandLinkButton( QCommandLinkButton*, QEvent* ); - #endif //* install event filter to object, in a unique way void addEventFilter( QObject* object ) @@ -174,13 +160,8 @@ protected: //* standard icons - #if BREEZE_USE_KDE4 - QIcon standardIcon( StandardPixmap pixmap, const QStyleOption* option = nullptr, const QWidget* widget = nullptr) const - { return standardIconImplementation( pixmap, option, widget ); } - #else QIcon standardIcon( StandardPixmap pixmap, const QStyleOption* option = nullptr, const QWidget* widget = nullptr) const override { return standardIconImplementation( pixmap, option, widget ); } - #endif private: @@ -501,10 +482,8 @@ //* keyboard accelerators Mnemonics* _mnemonics = nullptr; - #if !BREEZE_USE_KDE4 //* blur helper BlurHelper* _blurHelper = nullptr; - #endif //* window manager WindowManager* _windowManager = nullptr; diff --git a/kstyle/breezestyle.cpp b/kstyle/breezestyle.cpp --- a/kstyle/breezestyle.cpp +++ b/kstyle/breezestyle.cpp @@ -144,10 +144,8 @@ }; //_______________________________________________________________ - #if !BREEZE_USE_KDE4 bool isProgressBarHorizontal( const QStyleOptionProgressBar* option ) { return option && ( (option->state & QStyle::State_Horizontal ) || option->orientation == Qt::Horizontal ); } - #endif } @@ -157,27 +155,18 @@ //______________________________________________________________ Style::Style(): - #if BREEZE_USE_KDE4 - _helper( new Helper( "breeze" ) ) - #else _helper( new Helper( StyleConfigData::self()->sharedConfig() ) ) - #endif - , _shadowHelper( new ShadowHelper( this, *_helper ) ) , _animations( new Animations( this ) ) , _mnemonics( new Mnemonics( this ) ) - - #if !BREEZE_USE_KDE4 , _blurHelper( new BlurHelper( this ) ) - #endif - , _windowManager( new WindowManager( this ) ) , _frameShadowFactory( new FrameShadowFactory( this ) ) , _mdiWindowShadowFactory( new MdiWindowShadowFactory( this ) ) , _splitterFactory( new SplitterFactory( this ) ) , _widgetExplorer( new WidgetExplorer( this ) ) , _tabBarData( new BreezePrivate::TabBarData( this ) ) - #if BREEZE_HAVE_KSTYLE||BREEZE_USE_KDE4 + #if BREEZE_HAVE_KSTYLE , SH_ArgbDndWindow( newStyleHint( QStringLiteral( "SH_ArgbDndWindow" ) ) ) , CE_CapacityBar( newControlElement( QStringLiteral( "CE_CapacityBar" ) ) ) #endif @@ -194,13 +183,11 @@ QStringLiteral( "/BreezeDecoration" ), QStringLiteral( "org.kde.Breeze.Style" ), QStringLiteral( "reparseConfiguration" ), this, SLOT(configurationChanged()) ); - #if !BREEZE_USE_KDE4 #if QT_VERSION < 0x050D00 // Check if Qt version < 5.13 this->addEventFilter(qApp); #else connect(qApp, &QApplication::paletteChanged, this, &Style::configurationChanged); #endif - #endif // call the slot directly; this initial call will set up things that also // need to be reset when the system palette changes loadConfiguration(); @@ -337,17 +324,14 @@ setTranslucentBackground( widget ); - #if !BREEZE_USE_KDE4 if ( _helper->hasAlphaChannel( widget ) && StyleConfigData::menuOpacity() < 100 ) { _blurHelper->registerWidget( widget->window() ); } - #endif - #if QT_VERSION >= 0x050000 } else if( qobject_cast( widget ) ) { addEventFilter( widget ); - #endif + } else if( auto comboBox = qobject_cast( widget ) ) { if( !hasParent( widget, "QWebView" ) ) @@ -454,10 +438,7 @@ _shadowHelper->unregisterWidget( widget ); _windowManager->unregisterWidget( widget ); _splitterFactory->unregisterWidget( widget ); - - #if !BREEZE_USE_KDE4 _blurHelper->unregisterWidget( widget ); - #endif // remove event filter if( qobject_cast( widget ) || @@ -482,7 +463,6 @@ case PM_DefaultFrameWidth: if( qobject_cast( widget ) ) return Metrics::Menu_FrameWidth; if( qobject_cast( widget ) ) return Metrics::LineEdit_FrameWidth; - #if QT_VERSION >= 0x050000 else if( isQtQuickControl( option, widget ) ) { const QString &elementType = option->styleObject->property( "elementType" ).toString(); @@ -497,7 +477,6 @@ } } - #endif // fallback return Metrics::Frame_FrameWidth; @@ -668,14 +647,10 @@ case SH_Menu_SubMenuPopupDelay: return 150; case SH_Menu_SloppySubMenus: return true; - #if QT_VERSION >= 0x050000 // TODO Qt6: drop deprecated SH_Widget_Animate case SH_Widget_Animate: return StyleConfigData::animationsEnabled(); case SH_Menu_SupportsSections: return true; - #endif - #if QT_VERSION >= 0x050A00 case SH_Widget_Animation_Duration: return StyleConfigData::animationsEnabled() ? StyleConfigData::animationsDuration() : 0; - #endif case SH_DialogButtonBox_ButtonsHaveIcons: return true; @@ -891,7 +866,7 @@ StyleControl fcn; - #if BREEZE_HAVE_KSTYLE||BREEZE_USE_KDE4 + #if BREEZE_HAVE_KSTYLE if( element == CE_CapacityBar ) { fcn = &Style::drawProgressBarControl; @@ -1025,9 +1000,7 @@ if( auto dockWidget = qobject_cast( object ) ) { return eventFilterDockWidget( dockWidget, event ); } else if( auto subWindow = qobject_cast( object ) ) { return eventFilterMdiSubWindow( subWindow, event ); } - #if QT_VERSION >= 0x050000 else if( auto commandLinkButton = qobject_cast( object ) ) { return eventFilterCommandLinkButton( commandLinkButton, event ); } - #endif #if QT_VERSION < 0x050D00 // Check if Qt version < 5.13 else if( object == qApp && event->type() == QEvent::ApplicationPaletteChange ) { configurationChanged(); } #endif @@ -1258,7 +1231,6 @@ } //____________________________________________________________________________ - #if QT_VERSION >= 0x050000 bool Style::eventFilterCommandLinkButton( QCommandLinkButton* button, QEvent* event ) { @@ -1348,18 +1320,13 @@ return false; } - #endif //_____________________________________________________________________ void Style::configurationChanged() { // reload - #if BREEZE_USE_KDE4 - StyleConfigData::self()->readConfig(); - #else StyleConfigData::self()->load(); - #endif // reload configuration loadConfiguration(); @@ -1399,11 +1366,7 @@ { // do not cache parent style icon, since it may change at runtime - #if QT_VERSION >= 0x050000 return ParentStyleClass::standardIcon( standardPixmap, option, widget ); - #else - return ParentStyleClass::standardIconImplementation( standardPixmap, option, widget ); - #endif } else { const_cast(&_iconCache)->insert( standardPixmap, icon ); @@ -1505,13 +1468,7 @@ // get flags and orientation const bool textVisible( progressBarOption->textVisible ); const bool busy( progressBarOption->minimum == 0 && progressBarOption->maximum == 0 ); - - #if BREEZE_USE_KDE4 - const auto progressBarOption2( qstyleoption_cast( option ) ); - const bool horizontal( !progressBarOption2 || progressBarOption2->orientation == Qt::Horizontal ); - #else const bool horizontal( BreezePrivate::isProgressBarHorizontal( progressBarOption ) ); - #endif // copy rectangle and adjust auto rect( option->rect ); @@ -1558,19 +1515,10 @@ if( busy ) return rect; // get orientation - #if BREEZE_USE_KDE4 - const auto progressBarOption2( qstyleoption_cast( option ) ); - const bool horizontal( !progressBarOption2 || progressBarOption2->orientation == Qt::Horizontal ); - #else const bool horizontal( BreezePrivate::isProgressBarHorizontal( progressBarOption ) ); - #endif // check inverted appearance - #if BREEZE_USE_KDE4 - const bool inverted( progressBarOption2 ? progressBarOption2->invertedAppearance : false ); - #else const bool inverted( progressBarOption->invertedAppearance ); - #endif // get progress and steps const qreal progress( progressBarOption->progress - progressBarOption->minimum ); @@ -1628,12 +1576,7 @@ if( !textVisible || busy ) return QRect(); // get direction and check - #if BREEZE_USE_KDE4 - const auto progressBarOption2( qstyleoption_cast( option ) ); - const bool horizontal( !progressBarOption2 || progressBarOption2->orientation == Qt::Horizontal ); - #else const bool horizontal( BreezePrivate::isProgressBarHorizontal( progressBarOption ) ); - #endif if( !horizontal ) return QRect(); int textWidth = qMax( @@ -1688,11 +1631,7 @@ { // cast option and check - #if BREEZE_USE_KDE4 - const auto tabOption( qstyleoption_cast( option ) ); - #else const auto tabOption( qstyleoption_cast( option ) ); - #endif if( !tabOption || tabOption->leftButtonSize.isEmpty() ) return QRect(); const auto rect( option->rect ); @@ -1736,11 +1675,7 @@ { // cast option and check - #if BREEZE_USE_KDE4 - const auto tabOption( qstyleoption_cast( option ) ); - #else const auto tabOption( qstyleoption_cast( option ) ); - #endif if( !tabOption || tabOption->rightButtonSize.isEmpty() ) return QRect(); const auto rect( option->rect ); @@ -2859,12 +2794,7 @@ const auto progressBarOption( qstyleoption_cast( option ) ); if( !progressBarOption ) return contentsSize; - #if BREEZE_USE_KDE4 - const auto progressBarOption2( qstyleoption_cast( option ) ); - const bool horizontal( !progressBarOption2 || progressBarOption2->orientation == Qt::Horizontal ); - #else const bool horizontal( BreezePrivate::isProgressBarHorizontal( progressBarOption ) ); - #endif // make local copy QSize size( contentsSize ); @@ -2938,14 +2868,8 @@ const auto tabOption( qstyleoption_cast( option ) ); const bool hasText( tabOption && !tabOption->text.isEmpty() ); const bool hasIcon( tabOption && !tabOption->icon.isNull() ); - #if BREEZE_USE_KDE4 - const auto tabOptionV3( qstyleoption_cast( option ) ); - const bool hasLeftButton( tabOptionV3 && !tabOptionV3->leftButtonSize.isEmpty() ); - const bool hasRightButton( tabOptionV3 && !tabOptionV3->leftButtonSize.isEmpty() ); - #else const bool hasLeftButton( tabOption && !tabOption->leftButtonSize.isEmpty() ); const bool hasRightButton( tabOption && !tabOption->leftButtonSize.isEmpty() ); - #endif // calculate width increment for horizontal tabs int widthIncrement = 0; @@ -3047,12 +2971,8 @@ const State& state( option->state ); if( !isTitleWidget && !( state & (State_Sunken | State_Raised ) ) ) return true; - #if QT_VERSION >= 0x050000 const bool isInputWidget( ( widget && widget->testAttribute( Qt::WA_Hover ) ) || ( isQtQuickControl( option, widget ) && option->styleObject->property( "elementType" ).toString() == QStringLiteral( "edit") ) ); - #else - const bool isInputWidget( ( widget && widget->testAttribute( Qt::WA_Hover ) ) ); - #endif const bool enabled( state & State_Enabled ); const bool mouseOver( enabled && isInputWidget && ( state & State_MouseOver ) ); @@ -3152,10 +3072,8 @@ if (widget && widget->inherits("QComboBoxListView")) { return true; } - #if QT_VERSION >= 0x050000 if ( option->styleObject && option->styleObject->property("elementType") == QLatin1String("button") ) { return true; } - #endif const State& state( option->state ); @@ -3216,12 +3134,7 @@ if( !frameOption ) return true; // no frame for flat groupboxes - #if BREEZE_USE_KDE4 - QStyleOptionFrameV2 frameOption2( *frameOption ); - if( frameOption2.features & QStyleOptionFrameV2::Flat ) return true; - #else if( frameOption->features & QStyleOptionFrame::Flat ) return true; - #endif // normal frame const auto& palette( option->palette ); @@ -3245,11 +3158,7 @@ { // cast option and check - #if BREEZE_USE_KDE4 - const auto tabOption( qstyleoption_cast( option ) ); - #else const auto tabOption( qstyleoption_cast( option ) ); - #endif if( !tabOption ) return true; // do nothing if tabbar is hidden @@ -3703,11 +3612,9 @@ const bool hasAlpha( _helper->hasAlphaChannel( widget ) ); auto background( _helper->frameBackgroundColor( palette ) ); - #if !BREEZE_USE_KDE4 if ( hasAlpha ) { background.setAlphaF(StyleConfigData::menuOpacity() / 100.0); } - #endif _helper->renderMenuFrame( painter, option->rect, background, outline, hasAlpha ); @@ -3738,11 +3645,7 @@ { // cast option and check - #if BREEZE_USE_KDE4 - const auto viewItemOption = qstyleoption_cast( option ); - #else const auto viewItemOption = qstyleoption_cast( option ); - #endif if( !viewItemOption ) return false; // try cast widget @@ -3761,11 +3664,7 @@ const bool hasCustomBackground = viewItemOption->backgroundBrush.style() != Qt::NoBrush && !( state & State_Selected ); const bool hasSolidBackground = !hasCustomBackground || viewItemOption->backgroundBrush.style() == Qt::SolidPattern; - #if BREEZE_USE_KDE4 - const bool hasAlternateBackground( viewItemOption->features & QStyleOptionViewItemV2::Alternate ); - #else const bool hasAlternateBackground( viewItemOption->features & QStyleOptionViewItem::Alternate ); - #endif // do nothing if no background is to be rendered if( !( mouseOver || selected || hasCustomBackground || hasAlternateBackground ) ) @@ -4571,7 +4470,6 @@ if( sunken && !flat ) { painter->translate( 1, 1 ); } - #if QT_VERSION >= 0x050000 if (const auto cb = qstyleoption_cast(option)) { auto editRect = proxy()->subControlRect(CC_ComboBox, cb, SC_ComboBoxEditField, widget); @@ -4619,10 +4517,6 @@ } painter->restore(); } - #else - // call base class method - ParentStyleClass::drawControl( CE_ComboBoxLabel, option, painter, widget ); - #endif return true; @@ -4958,30 +4852,20 @@ if( !progressBarOption ) return true; // render groove - #if BREEZE_USE_KDE4 - QStyleOptionProgressBarV2 progressBarOption2 = *progressBarOption; - #else QStyleOptionProgressBar progressBarOption2 = *progressBarOption; - #endif progressBarOption2.rect = subElementRect( SE_ProgressBarGroove, progressBarOption, widget ); drawControl( CE_ProgressBarGroove, &progressBarOption2, painter, widget ); - #if QT_VERSION >= 0x050000 const QObject* styleObject( widget ? widget:progressBarOption->styleObject ); - #else - const QObject* styleObject( widget ); - #endif // enable busy animations // need to check both widget and passed styleObject, used for QML if( styleObject && _animations->busyIndicatorEngine().enabled() ) { - #if QT_VERSION >= 0x050000 // register QML object if defined if( !widget && progressBarOption->styleObject ) { _animations->busyIndicatorEngine().registerWidget( progressBarOption->styleObject ); } - #endif _animations->busyIndicatorEngine().setAnimated( styleObject, progressBarOption->maximum == 0 && progressBarOption->minimum == 0 ); @@ -5020,14 +4904,8 @@ const auto& palette( option->palette ); // get direction - #if BREEZE_USE_KDE4 - const auto progressBarOption2( qstyleoption_cast( option ) ); - const bool horizontal = !progressBarOption2 || progressBarOption2->orientation == Qt::Horizontal; - const bool inverted( progressBarOption2 ? progressBarOption2->invertedAppearance : false ); - #else const bool horizontal( BreezePrivate::isProgressBarHorizontal( progressBarOption ) ); const bool inverted( progressBarOption->invertedAppearance ); - #endif bool reverse = horizontal && option->direction == Qt::RightToLeft; if( inverted ) reverse = !reverse; @@ -5096,12 +4974,7 @@ if( !progressBarOption ) return true; // get direction and check - #if BREEZE_USE_KDE4 - const auto progressBarOption2( qstyleoption_cast( option ) ); - const bool horizontal = !progressBarOption2 || progressBarOption2->orientation == Qt::Horizontal; - #else const bool horizontal( BreezePrivate::isProgressBarHorizontal( progressBarOption ) ); - #endif if( !horizontal ) return true; // store rect and palette @@ -5133,13 +5006,9 @@ const auto& palette( option->palette ); //try to understand if anywhere the widget is under mouse, not just the handle, use _animations in case of QWidget, option->styleObject in case of QML - #if QT_VERSION >= 0x050000 bool widgetMouseOver( ( option->state & State_MouseOver ) ); if( widget ) widgetMouseOver = _animations->scrollBarEngine().isHovered( widget, QStyle::SC_ScrollBarGroove ); else if( option->styleObject ) widgetMouseOver = option->styleObject->property("hover").toBool(); - #else - const bool widgetMouseOver( _animations->scrollBarEngine().isHovered( widget, QStyle::SC_ScrollBarGroove ) ); - #endif qreal grooveAnimationOpacity( _animations->scrollBarEngine().opacity( widget, QStyle::SC_ScrollBarGroove ) ); if( grooveAnimationOpacity == AnimationData::OpacityInvalid ) grooveAnimationOpacity = (widgetMouseOver ? 1 : 0); @@ -5326,11 +5195,7 @@ { // cast option and check - #if BREEZE_USE_KDE4 - const auto frameOpt = qstyleoption_cast( option ); - #else const auto frameOpt = qstyleoption_cast( option ); - #endif if( !frameOpt ) return false; switch( frameOpt->frameShape ) @@ -5746,13 +5611,7 @@ if( selected ) { - #if QT_VERSION >= 0x050000 bool documentMode = tabOption->documentMode; - #else - bool documentMode = false; - if( const auto tabOptionV3 = qstyleoption_cast( option ) ) - { documentMode = tabOptionV3->documentMode; } - #endif // flag passed to QStyleOptionTab is unfortunately not reliable enough // also need to check on parent widget @@ -5936,12 +5795,7 @@ const bool reverseLayout( option->direction == Qt::RightToLeft ); // cast to v2 to check vertical bar - #if BREEZE_USE_KDE4 - const auto v2 = qstyleoption_cast( option ); - const bool verticalTitleBar( v2 ? v2->verticalTitleBar : false ); - #else const bool verticalTitleBar( dockWidgetOption->verticalTitleBar ); - #endif const auto buttonRect( subElementRect( dockWidgetOption->floatable ? SE_DockWidgetFloatButton : SE_DockWidgetCloseButton, option, widget ) ); @@ -6864,10 +6718,8 @@ bool widgetMouseOver( ( option->state & State_MouseOver ) ); if( widget ) widgetMouseOver = widget->underMouse(); - #if QT_VERSION >= 0x050000 // in case this QStyle is used by QQuickControls QStyle wrapper else if( option->styleObject ) widgetMouseOver = option->styleObject->property("hover").toBool(); - #endif // check enabled state const bool enabled( option->state & State_Enabled ); @@ -7173,12 +7025,7 @@ const QAbstractItemView* itemView( itemViewParent( widget ) ); if( !( itemView && itemView->hasFocus() && itemView->selectionModel() ) ) return false; - #if QT_VERSION >= 0x050000 QPoint position = widget->mapTo( itemView, localPosition ); - #else - // qt4 misses a const for mapTo argument, although nothing is actually changed to the passed widget - QPoint position = widget->mapTo( const_cast( itemView ), localPosition ); - #endif // get matching QModelIndex and check const QModelIndex index( itemView->indexAt( position ) ); @@ -7192,7 +7039,7 @@ //____________________________________________________________________ bool Style::isQtQuickControl( const QStyleOption* option, const QWidget* widget ) const { - #if QT_VERSION >= 0x050000 && BREEZE_HAVE_QTQUICK + #if BREEZE_HAVE_QTQUICK const bool is = (widget == nullptr) && option && option->styleObject && option->styleObject->inherits( "QQuickItem" ); if ( is ) _windowManager->registerQuickItem( static_cast( option->styleObject ) ); return is; diff --git a/kstyle/breezestyleplugin.h b/kstyle/breezestyleplugin.h --- a/kstyle/breezestyleplugin.h +++ b/kstyle/breezestyleplugin.h @@ -30,9 +30,7 @@ Q_OBJECT - #if QT_VERSION >= 0x050000 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QStyleFactoryInterface" FILE "breeze.json" ) - #endif public: diff --git a/kstyle/breezestyleplugin.cpp b/kstyle/breezestyleplugin.cpp --- a/kstyle/breezestyleplugin.cpp +++ b/kstyle/breezestyleplugin.cpp @@ -23,10 +23,6 @@ #include -#if QT_VERSION < 0x050000 -Q_EXPORT_PLUGIN2( breeze-qt, Breeze::StylePlugin ) -#endif - namespace Breeze { diff --git a/kstyle/breezetileset.cpp b/kstyle/breezetileset.cpp --- a/kstyle/breezetileset.cpp +++ b/kstyle/breezetileset.cpp @@ -31,23 +31,13 @@ //______________________________________________________________________________________ inline qreal devicePixelRatio( const QPixmap& pixmap ) { - #if QT_VERSION >= 0x050300 return pixmap.devicePixelRatio(); - #else - Q_UNUSED( pixmap ); - return 1; - #endif } //______________________________________________________________________________________ inline void setDevicePixelRatio( QPixmap& pixmap, qreal value ) { - #if QT_VERSION >= 0x050300 return pixmap.setDevicePixelRatio( value ); - #else - Q_UNUSED( pixmap ); - Q_UNUSED( value ); - #endif } //______________________________________________________________ diff --git a/kstyle/breezewindowmanager.h b/kstyle/breezewindowmanager.h --- a/kstyle/breezewindowmanager.h +++ b/kstyle/breezewindowmanager.h @@ -170,20 +170,14 @@ //* reset drag void resetDrag(); - #if QT_VERSION >= 0x050000 - using Window = QWindow; - #else - using Window = QWidget; - #endif - //* start drag - void startDrag( Window*, const QPoint& ); + void startDrag( QWindow*, const QPoint& ); //* X11 specific implementation for startDrag - void startDragX11( Window*, const QPoint& ); + void startDragX11( QWindow*, const QPoint& ); //* Wayland specific implementation for startDrag - void startDragWayland( Window*, const QPoint& ); + void startDragWayland( QWindow*, const QPoint& ); //* returns true if window manager is used for moving /** right now this is true only for X11 */ diff --git a/kstyle/breezewindowmanager.cpp b/kstyle/breezewindowmanager.cpp --- a/kstyle/breezewindowmanager.cpp +++ b/kstyle/breezewindowmanager.cpp @@ -75,10 +75,8 @@ #include -#if QT_VERSION >= 0x050300 // needed to deal with device pixel ratio #include -#endif #if BREEZE_HAVE_QTQUICK // needed to enable dragging from QQuickWindows @@ -90,11 +88,7 @@ #include #include -#if BREEZE_USE_KDE4 -#include -#else #include -#endif #endif @@ -111,14 +105,7 @@ template inline T makeT( std::initializer_list&& reference ) { - #if QT_VERSION >= 0x050100 return T( std::move( reference ) ); - #else - // for old QT versions there is no container constructor from initializer_list - T out; - for( auto&& value:std::move(reference) ) { out.insert( value ); } - return out; - #endif } } @@ -179,36 +166,15 @@ bool appMouseEvent( QObject*, QEvent* event ) { - #if BREEZE_USE_KDE4 - // store target window (see later) - QWidget* window( _parent->_target.data()->window() ); - #else Q_UNUSED( event ); - #endif /* post some mouseRelease event to the target, in order to counter balance the mouse press that triggered the drag. Note that it triggers a resetDrag */ QMouseEvent mouseEvent( QEvent::MouseButtonRelease, _parent->_dragPoint, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier ); qApp->sendEvent( _parent->_target.data(), &mouseEvent ); - #if BREEZE_USE_KDE4 - if( event->type() == QEvent::MouseMove ) - { - /* - HACK: quickly move the main cursor out of the window and back - this is needed to get the focus right for the window children - the origin of this issue is unknown at the moment. - This apparently got fixed with qt5 - */ - const QPoint cursor = QCursor::pos(); - QCursor::setPos(window->mapToGlobal( window->rect().topRight() ) + QPoint(1, 0) ); - QCursor::setPos(cursor); - - } - #endif - return false; } @@ -422,15 +388,10 @@ { _dragTimer.stop(); - #if BREEZE_USE_KDE4 - if( _target ) - { startDrag( _target.data()->window(), _globalDragPoint ); } - #else if( _target ) startDrag( _target.data()->window()->windowHandle(), _globalDragPoint ); #if BREEZE_HAVE_QTQUICK else if( _quickTarget ) startDrag( _quickTarget.data()->window(), _globalDragPoint ); #endif - #endif } else { @@ -446,10 +407,8 @@ // cast event and check buttons/modifiers auto mouseEvent = static_cast( event ); - #if !BREEZE_USE_KDE4 if (mouseEvent->source() != Qt::MouseEventNotSynthesized) { return false; } - #endif if( !( mouseEvent->modifiers() == Qt::NoModifier && mouseEvent->button() == Qt::LeftButton ) ) { return false; } @@ -514,10 +473,8 @@ // cast event and check drag distance auto mouseEvent = static_cast( event ); - #if !BREEZE_USE_KDE4 if (mouseEvent->source() != Qt::MouseEventNotSynthesized) { return false; } - #endif if( !_dragInProgress ) { @@ -767,11 +724,7 @@ // gather options to retrieve checkbox subcontrol rect QStyleOptionGroupBox opt; opt.initFrom( groupBox ); - #if BREEZE_USE_KDE4 - if( groupBox->isFlat() ) opt.features |= QStyleOptionFrameV2::Flat; - #else if( groupBox->isFlat() ) opt.features |= QStyleOptionFrame::Flat; - #endif opt.lineWidth = 1; opt.midLineWidth = 0; opt.text = groupBox->title(); @@ -864,7 +817,7 @@ } //____________________________________________________________ - void WindowManager::startDrag( Window* window, const QPoint& position ) + void WindowManager::startDrag( QWindow* window, const QPoint& position ) { if( !( enabled() && window ) ) return; @@ -889,21 +842,16 @@ } //_______________________________________________________ - void WindowManager::startDragX11( Window* window, const QPoint& position ) + void WindowManager::startDragX11( QWindow* window, const QPoint& position ) { #if BREEZE_HAVE_X11 // connection auto connection( Helper::connection() ); - #if BREEZE_USE_KDE4 - auto net_connection = QX11Info::display(); - const QPoint native = position; - #else auto net_connection = connection; const qreal dpiRatio = window->devicePixelRatio(); const QPoint origin = window->screen()->geometry().topLeft(); const QPoint native = (position - origin) * dpiRatio + origin; - #endif xcb_ungrab_pointer( connection, XCB_TIME_CURRENT_TIME ); NETRootInfo( net_connection, NET::WMMoveResize ).moveResizeRequest( @@ -918,7 +866,7 @@ } //_______________________________________________________ - void WindowManager::startDragWayland( Window* window, const QPoint& ) + void WindowManager::startDragWayland( QWindow* window, const QPoint& ) { #if BREEZE_HAVE_KWAYLAND if( !_seat ) { diff --git a/kstyle/config-breeze.h.cmake b/kstyle/config-breeze.h.cmake --- a/kstyle/config-breeze.h.cmake +++ b/kstyle/config-breeze.h.cmake @@ -22,9 +22,6 @@ #ifndef config_breeze_h #define config_breeze_h -/* Define to 1 if breeze is compiled against KDE4 */ -#cmakedefine01 BREEZE_USE_KDE4 - /* Define to 1 if QtQuick is available */ #cmakedefine01 BREEZE_HAVE_QTQUICK diff --git a/kstyle/config/CMakeLists.txt b/kstyle/config/CMakeLists.txt --- a/kstyle/config/CMakeLists.txt +++ b/kstyle/config/CMakeLists.txt @@ -2,57 +2,40 @@ add_definitions(-DTRANSLATION_DOMAIN=\"breeze_style_config\") set(kstyle_breeze_config_PART_SRCS breezestyleconfig.cpp) -if(BREEZE_USE_KDE4) +set(kstyle_breeze_config_PART_SRCS ${kstyle_breeze_config_PART_SRCS} breezestyleconfigmodule.cpp) - kde4_add_kcfg_files(kstyle_breeze_config_PART_SRCS ../breezestyleconfigdata.kcfgc) - kde4_add_ui_files(kstyle_breeze_config_PART_SRCS ui/breezestyleconfig.ui) - kde4_add_plugin(kstyle_breeze_config ${kstyle_breeze_config_PART_SRCS}) +kconfig_add_kcfg_files(kstyle_breeze_config_PART_SRCS ../breezestyleconfigdata.kcfgc) +set(kstyle_breeze_config_PART_FORMS ui/breezestyleconfig.ui) +ki18n_wrap_ui(kstyle_breeze_config_PART_FORMS_HEADERS ${kstyle_breeze_config_PART_FORMS}) - target_link_libraries(kstyle_breeze_config ${KDE4_KDEUI_LIBS} ) - install(TARGETS kstyle_breeze_config DESTINATION ${PLUGIN_INSTALL_DIR}) - -else() - - set(kstyle_breeze_config_PART_SRCS ${kstyle_breeze_config_PART_SRCS} breezestyleconfigmodule.cpp) - - kconfig_add_kcfg_files(kstyle_breeze_config_PART_SRCS ../breezestyleconfigdata.kcfgc) - set(kstyle_breeze_config_PART_FORMS ui/breezestyleconfig.ui) - ki18n_wrap_ui(kstyle_breeze_config_PART_FORMS_HEADERS ${kstyle_breeze_config_PART_FORMS}) - - add_library(kstyle_breeze_config MODULE +add_library(kstyle_breeze_config MODULE ${kstyle_breeze_config_PART_SRCS} ${kstyle_breeze_config_PART_FORMS_HEADERS} - ) - - target_link_libraries(kstyle_breeze_config Qt5::Core Qt5::Gui Qt5::Widgets Qt5::DBus) - target_link_libraries(kstyle_breeze_config KF5::ConfigCore KF5::ConfigWidgets KF5::I18n) - install(TARGETS kstyle_breeze_config DESTINATION ${QT_PLUGIN_INSTALL_DIR}) - install(FILES breezestyleconfig.desktop DESTINATION ${SERVICES_INSTALL_DIR}) +) -endif() +target_link_libraries(kstyle_breeze_config Qt5::Core Qt5::Gui Qt5::Widgets Qt5::DBus) +target_link_libraries(kstyle_breeze_config KF5::ConfigCore KF5::ConfigWidgets KF5::I18n) +install(TARGETS kstyle_breeze_config DESTINATION ${QT_PLUGIN_INSTALL_DIR}) +install(FILES breezestyleconfig.desktop DESTINATION ${SERVICES_INSTALL_DIR}) ########### next target ############### -if(NOT BREEZE_USE_KDE4) - - find_package(KF5KCMUtils CONFIG) - set_package_properties(KF5KCMUtils PROPERTIES - DESCRIPTION "KF5 KCM utils Framework" - URL "https://projects.kde.org/projects/frameworks/kcmutils" - TYPE OPTIONAL - PURPOSE "Required for breeze-settings5 application to build") - - if( KF5KCMUtils_FOUND ) - - set(breeze_settings_SOURCES main.cpp) - add_executable(breeze-settings5 ${breeze_settings_SOURCES} ) - target_link_libraries(breeze-settings5 Qt5::Core Qt5::Gui Qt5::Widgets ) - target_link_libraries(breeze-settings5 KF5::I18n KF5::KCMUtils) - - install(TARGETS breeze-settings5 ${INSTALL_TARGETS_DEFAULT_ARGS}) - - # icon - ecm_install_icons(ICONS sc-apps-breeze-settings.svgz +find_package(KF5KCMUtils CONFIG) +set_package_properties(KF5KCMUtils PROPERTIES + DESCRIPTION "KF5 KCM utils Framework" + URL "https://projects.kde.org/projects/frameworks/kcmutils" + TYPE OPTIONAL + PURPOSE "Required for breeze-settings5 application to build") + +if( KF5KCMUtils_FOUND ) + set(breeze_settings_SOURCES main.cpp) + add_executable(breeze-settings5 ${breeze_settings_SOURCES} ) + target_link_libraries(breeze-settings5 Qt5::Core Qt5::Gui Qt5::Widgets ) + target_link_libraries(breeze-settings5 KF5::I18n KF5::KCMUtils) + + install(TARGETS breeze-settings5 ${INSTALL_TARGETS_DEFAULT_ARGS}) + + # icon + ecm_install_icons(ICONS sc-apps-breeze-settings.svgz DESTINATION ${ICON_INSTALL_DIR} THEME hicolor ) - endif() endif() diff --git a/kstyle/config/breezestyleconfig.cpp b/kstyle/config/breezestyleconfig.cpp --- a/kstyle/config/breezestyleconfig.cpp +++ b/kstyle/config/breezestyleconfig.cpp @@ -27,10 +27,6 @@ #include #include -#if !BREEZE_USE_KDE4 -#include -#endif - extern "C" { Q_DECL_EXPORT QWidget* allocate_kstyle_config(QWidget* parent) @@ -88,19 +84,8 @@ StyleConfigData::setWindowDragMode( _windowDragMode->currentIndex() ); StyleConfigData::setMenuOpacity( _menuOpacity->value() ); - #if BREEZE_USE_KDE4 - StyleConfigData::self()->writeConfig(); - #else StyleConfigData::self()->save(); - //update the KDE4 config to match - Kdelibs4Migration migration; - const QString kde4ConfigDirPath = migration.saveLocation("config"); - - QScopedPointer kde4Config(StyleConfigData::self()->config()->copyTo(kde4ConfigDirPath+"/breezerc", nullptr)); - kde4Config->sync(); - #endif - // emit dbus signal QDBusMessage message( QDBusMessage::createSignal( QStringLiteral( "/BreezeStyle" ), QStringLiteral( "org.kde.Breeze.Style" ), QStringLiteral( "reparseConfiguration" ) ) ); QDBusConnection::sessionBus().send(message); @@ -118,11 +103,7 @@ void StyleConfig::reset() { // reparse configuration - #if BREEZE_USE_KDE4 - StyleConfigData::self()->readConfig(); - #else StyleConfigData::self()->load(); - #endif load(); } diff --git a/kstyle/kstylekde4compat.h b/kstyle/kstylekde4compat.h deleted file mode 100644 --- a/kstyle/kstylekde4compat.h +++ /dev/null @@ -1,58 +0,0 @@ -/************************************************************************* - * Copyright (C) 2015 by David Edmundson * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * - *************************************************************************/ - -/** - * This class copies the features of KF5's KStyle for use in KDE4 only - * - * kdelibs4 also has a KStyle class but this isn't a 1-1 mapping and - * provides a lot of features we do not want - */ - -#ifndef KSTYLE_KDE4_COMPAT_H -#define KSTYLE_KDE4_COMPAT_H - -#include -#include - -class KStyleKDE4Compat : public QCommonStyle -{ - Q_OBJECT - - public: - - KStyleKDE4Compat(); - ~KStyleKDE4Compat(); - virtual int styleHint(StyleHint hint, const QStyleOption *opt, const QWidget *w, QStyleHintReturn *returnData) const; - - protected: - - StyleHint newStyleHint(const QString &element); - ControlElement newControlElement(const QString &element); - SubElement newSubElement(const QString &element); - - private: - - QHash styleElements; - int hintCounter; - int controlCounter; - int subElementCounter; - -}; - -#endif diff --git a/kstyle/kstylekde4compat.cpp b/kstyle/kstylekde4compat.cpp deleted file mode 100644 --- a/kstyle/kstylekde4compat.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/************************************************************************* - * Copyright (C) 2015 by David Edmundson * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * - *************************************************************************/ - -#include "kstylekde4compat.h" - -#include -#include -#include - -static const QStyle::StyleHint SH_KCustomStyleElement = (QStyle::StyleHint)0xff000001; -static const int X_KdeBase = 0xff000000; - -//_____________________________________________________________________ -KStyleKDE4Compat::KStyleKDE4Compat() -{ - controlCounter = subElementCounter = X_KdeBase; - hintCounter = X_KdeBase + 1; //sic! X_KdeBase is covered by SH_KCustomStyleElement -} - -//_____________________________________________________________________ -KStyleKDE4Compat::~KStyleKDE4Compat() -{} - -//_____________________________________________________________________ -static inline int newStyleElement(const QString &element, const char *check, int &counter, QHash *elements) -{ - if (!element.contains(check)) return 0; - - int id = elements->value(element, 0); - if (!id) - { - ++counter; - id = counter; - elements->insert(element, id); - } - return id; -} - -//_____________________________________________________________________ -QStyle::StyleHint KStyleKDE4Compat::newStyleHint(const QString &element) -{ return (StyleHint)newStyleElement(element, "SH_", hintCounter, &styleElements); } - -//_____________________________________________________________________ -QStyle::ControlElement KStyleKDE4Compat::newControlElement(const QString &element) -{ return (ControlElement)newStyleElement(element, "CE_", controlCounter, &styleElements); } - -//_____________________________________________________________________ -QStyle::SubElement KStyleKDE4Compat::newSubElement(const QString &element) -{ return (SubElement)newStyleElement(element, "SE_", subElementCounter, &styleElements); } - -//_____________________________________________________________________ -int KStyleKDE4Compat::styleHint(StyleHint hint, const QStyleOption *option, const QWidget *widget, QStyleHintReturn *returnData) const -{ - - if( hint == SH_KCustomStyleElement && widget ) - { return styleElements.value(widget->objectName(), 0); } - - switch (hint) { - case SH_ItemView_ActivateItemOnSingleClick: { - KConfigGroup g(KSharedConfig::openConfig(), "KDE"); - return g.readEntry("SingleClick", true); - } - - case SH_DialogButtonBox_ButtonsHaveIcons: { - // was KGlobalSettings::showIconsOnPushButtons() : - KConfigGroup g(KSharedConfig::openConfig(), "KDE"); - return g.readEntry("ShowIconsOnPushButtons", true); - } - - case SH_ItemView_ArrowKeysNavigateIntoChildren: - return true; - - case SH_ToolButtonStyle: { - KConfigGroup g(KSharedConfig::openConfig(), "Toolbar style"); - - bool useOthertoolbars = false; - const QWidget *parent = widget ? widget->parentWidget() : nullptr; - - //If the widget parent is a QToolBar and the magic property is set - if (parent && qobject_cast< const QToolBar * >(parent)) { - if (parent->property("otherToolbar").isValid()) { - useOthertoolbars = true; - } - } - - QString buttonStyle; - if (useOthertoolbars) { - buttonStyle = g.readEntry("ToolButtonStyleOtherToolbars", "NoText").toLower(); - } else { - buttonStyle = g.readEntry("ToolButtonStyle", "TextBesideIcon").toLower(); - } - - return buttonStyle == QLatin1String("textbesideicon") ? Qt::ToolButtonTextBesideIcon - : buttonStyle == QLatin1String("icontextright") ? Qt::ToolButtonTextBesideIcon - : buttonStyle == QLatin1String("textundericon") ? Qt::ToolButtonTextUnderIcon - : buttonStyle == QLatin1String("icontextbottom") ? Qt::ToolButtonTextUnderIcon - : buttonStyle == QLatin1String("textonly") ? Qt::ToolButtonTextOnly - : Qt::ToolButtonIconOnly; - } - - default: - break; - }; - - return QCommonStyle::styleHint(hint, option, widget, returnData); -} diff --git a/libbreezecommon/CMakeLists.txt b/libbreezecommon/CMakeLists.txt --- a/libbreezecommon/CMakeLists.txt +++ b/libbreezecommon/CMakeLists.txt @@ -1,58 +1,25 @@ -set(BREEZE_COMMON_USE_KDE4 ${USE_KDE4}) - -if (BREEZE_COMMON_USE_KDE4) - ############ Language and toolchain features - ############ copied from ECM - if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") - elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" AND NOT WIN32) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") - endif () -endif () - ################# dependencies ################# ### Qt/KDE -if (NOT BREEZE_COMMON_USE_KDE4) - find_package(Qt5 REQUIRED CONFIG COMPONENTS Widgets) -endif () - -################# configuration ################# -configure_file(config-breezecommon.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-breezecommon.h ) +find_package(Qt5 REQUIRED CONFIG COMPONENTS Widgets) ################# breezestyle target ################# set(breezecommon_LIB_SRCS breezeboxshadowrenderer.cpp ) -if (BREEZE_COMMON_USE_KDE4) - kde4_add_library(breezecommon4 SHARED ${breezecommon_LIB_SRCS}) - - generate_export_header(breezecommon4 - BASE_NAME breezecommon - EXPORT_FILE_NAME breezecommon_export.h) - - target_link_libraries(breezecommon4 ${KDE4_KDEUI_LIBS}) - - set_target_properties(breezecommon4 PROPERTIES - VERSION ${PROJECT_VERSION} - SOVERSION ${PROJECT_VERSION_MAJOR}) - - install(TARGETS breezecommon4 ${INSTALL_TARGETS_DEFAULT_ARGS} LIBRARY NAMELINK_SKIP) -else () - add_library(breezecommon5 ${breezecommon_LIB_SRCS}) +add_library(breezecommon5 ${breezecommon_LIB_SRCS}) - generate_export_header(breezecommon5 - BASE_NAME breezecommon - EXPORT_FILE_NAME breezecommon_export.h) +generate_export_header(breezecommon5 + BASE_NAME breezecommon + EXPORT_FILE_NAME breezecommon_export.h) - target_link_libraries(breezecommon5 - PUBLIC - Qt5::Core - Qt5::Gui) +target_link_libraries(breezecommon5 + PUBLIC + Qt5::Core + Qt5::Gui) - set_target_properties(breezecommon5 PROPERTIES - VERSION ${PROJECT_VERSION} - SOVERSION ${PROJECT_VERSION_MAJOR}) +set_target_properties(breezecommon5 PROPERTIES + VERSION ${PROJECT_VERSION} + SOVERSION ${PROJECT_VERSION_MAJOR}) - install(TARGETS breezecommon5 ${INSTALL_TARGETS_DEFAULT_ARGS} LIBRARY NAMELINK_SKIP) -endif () +install(TARGETS breezecommon5 ${INSTALL_TARGETS_DEFAULT_ARGS} LIBRARY NAMELINK_SKIP) diff --git a/libbreezecommon/breezeboxshadowrenderer.cpp b/libbreezecommon/breezeboxshadowrenderer.cpp --- a/libbreezecommon/breezeboxshadowrenderer.cpp +++ b/libbreezecommon/breezeboxshadowrenderer.cpp @@ -21,17 +21,9 @@ // own #include "breezeboxshadowrenderer.h" -// auto-generated -#include "config-breezecommon.h" - // Qt #include - -#ifdef BREEZE_COMMON_USE_KDE4 -#include -#else #include -#endif namespace Breeze { @@ -96,10 +88,7 @@ break; default: -#if !BREEZE_COMMON_USE_KDE4 Q_UNREACHABLE(); -#endif - break; } Q_ASSERT(major + minor + final == blurRadius); @@ -258,16 +247,10 @@ const QSize inflation = calculateBlurExtent(radius); const QSize size = rect.size() + 2 * inflation; -#if BREEZE_COMMON_USE_KDE4 - const qreal dpr = 1.0; -#else const qreal dpr = painter->device()->devicePixelRatioF(); -#endif QImage shadow(size * dpr, QImage::Format_ARGB32_Premultiplied); -#if !BREEZE_COMMON_USE_KDE4 shadow.setDevicePixelRatio(dpr); -#endif shadow.fill(Qt::transparent); QRect boxRect(QPoint(0, 0), rect.size()); @@ -335,30 +318,20 @@ } QSize canvasSize; -#if BREEZE_COMMON_USE_KDE4 - foreach (const Shadow &shadow, m_shadows) { -#else for (const Shadow &shadow : qAsConst(m_shadows)) { -#endif canvasSize = canvasSize.expandedTo( calculateMinimumShadowTextureSize(m_boxSize, shadow.radius, shadow.offset)); } QImage canvas(canvasSize * m_dpr, QImage::Format_ARGB32_Premultiplied); -#if !BREEZE_COMMON_USE_KDE4 canvas.setDevicePixelRatio(m_dpr); -#endif canvas.fill(Qt::transparent); QRect boxRect(QPoint(0, 0), m_boxSize); boxRect.moveCenter(QRect(QPoint(0, 0), canvasSize).center()); QPainter painter(&canvas); -#if BREEZE_COMMON_USE_KDE4 - foreach (const Shadow &shadow, m_shadows) { -#else for (const Shadow &shadow : qAsConst(m_shadows)) { -#endif renderShadow(&painter, boxRect, m_borderRadius, shadow.offset, shadow.radius, shadow.color); } painter.end(); diff --git a/libbreezecommon/config-breezecommon.h.cmake b/libbreezecommon/config-breezecommon.h.cmake deleted file mode 100644 --- a/libbreezecommon/config-breezecommon.h.cmake +++ /dev/null @@ -1,28 +0,0 @@ -/* config-breezecommon.h. Generated by cmake from config-breezecommon.h.cmake */ - -/************************************************************************* - * Copyright (C) 2014 by Hugo Pereira Da Costa * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * - *************************************************************************/ - -#ifndef config_breeze_common_h -#define config_breeze_common_h - -/* Define to 1 if breeze is compiled against KDE4 */ -#cmakedefine01 BREEZE_COMMON_USE_KDE4 - -#endif