diff --git a/CMakeLists.txt b/CMakeLists.txt index 616149753..b905f5671 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,514 +1,513 @@ project(KWIN) cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) set(QT_MIN_VERSION "5.2.0") # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked # TODO: this includes the cmake modules from kde-workspace. Need to move those to KWin set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/modules ${CMAKE_MODULE_PATH} ) find_package(ECM 0.0.11 REQUIRED NO_MODULE) include(FeatureSummary) include(WriteBasicConfigVersionFile) # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) include(KDEInstallDirs) include(KDECMakeSettings) include(KDECompilerSettings) include(ECMInstallIcons) find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Concurrent Core DBus Quick Script Test UiTools Widgets X11Extras ) add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0) # required frameworks by Core find_package(KF5 CONFIG REQUIRED COMPONENTS Config ConfigWidgets CoreAddons Crash GlobalAccel I18n Notifications Service Plasma WidgetsAddons WindowSystem ) # required frameworks by config modules find_package(KF5 CONFIG REQUIRED COMPONENTS Completion KCMUtils KIO NewStuff XmlGui ) # optional frameworks find_package(KF5 CONFIG COMPONENTS Activities) # TODO: remove once the build system is completely cleaned find_package(KF5KDE4Support REQUIRED NO_MODULE) if(${Qt5Gui_OPENGL_IMPLEMENTATION} STREQUAL "GL") find_package(OpenGL) set_package_properties(OpenGL PROPERTIES DESCRIPTION "The OpenGL libraries" URL "http://www.opengl.org" TYPE REQUIRED ) else() find_package(OpenGLES) set_package_properties(OpenGLES PROPERTIES DESCRIPTION "The OpenGLES libraries" URL "http://www.khronos.org/opengles" TYPE REQUIRED ) endif() find_package(EGL) set_package_properties(EGL PROPERTIES TYPE REQUIRED PURPOSE "Required to build KWin with EGL support" ) find_package(Wayland 1.2 COMPONENTS Client Egl Cursor) set_package_properties(Wayland PROPERTIES TYPE OPTIONAL PURPOSE "Required for building KWin with Wayland support" ) add_feature_info("Wayland-Client" Wayland_Client_FOUND "Required for building the Wayland backend in KWin") add_feature_info("Wayland-EGL" Wayland_Egl_FOUND "Required for building the Wayland EGL compositing backend in KWin") find_package(XKB) set_package_properties(XKB PROPERTIES TYPE OPTIONAL PURPOSE "Required for building KWin with Wayland support" ) find_package(X11) set_package_properties(X11 PROPERTIES DESCRIPTION "X11 libraries" URL "http://www.x.org" TYPE REQUIRED ) # All the required XCB components find_package(XCB REQUIRED COMPONENTS XCB XFIXES DAMAGE COMPOSITE SHAPE SYNC RENDER RANDR KEYSYMS IMAGE SHM XTEST ) set_package_properties(XCB PROPERTIES TYPE REQUIRED) # and the optional XCB dependencies find_package(XCB COMPONENTS ICCCM) add_feature_info("XCB-ICCCM" XCB_ICCCM_FOUND "Required for building test applications for KWin") if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}) feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) endif() ########### configure tests ############### include(CMakeDependentOption) option(KWIN_BUILD_DECORATIONS "Enable building of KWin decorations." ON) -option(KWIN_BUILD_OXYGEN "Enable building of default decoration Oxygen" ON) option(KWIN_BUILD_KCMS "Enable building of KWin configuration modules." ON) option(KWIN_BUILD_TABBOX "Enable building of KWin Tabbox functionality" ON) option(KWIN_BUILD_SCREENEDGES "Enable building of KWin with screen edge support" ON) option(KWIN_BUILD_KAPPMENU "Enable building of KWin with application menu support" ON) option(KWIN_BUILD_XRENDER_COMPOSITING "Enable building of KWin with XRender Compositing support" ON) cmake_dependent_option(KWIN_BUILD_ACTIVITIES "Enable building of KWin with kactivities support" ON "KF5Activities_FOUND" OFF) option(KWIN_PLASMA_ACTIVE "Enable building KWin for Plasma Active." OFF) # Binary name of KWin set(KWIN_NAME "kwin") set(KWIN_VERSION_MAJOR 4) set(KWIN_VERSION_MINOR 90) set(KWIN_VERSION_PATCH 1) set(KWIN_VERSION ${KWIN_VERSION_MAJOR}.${KWIN_VERSION_MINOR}.${KWIN_VERSION_PATCH} ) set(KWIN_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(GENERIC_LIB_SOVERSION ${KWIN_VERSION_MAJOR}) set(GENERIC_LIB_VERSION "${KWIN_VERSION_MAJOR}.${KWIN_VERSION_MINOR}.${KWIN_VERSION_PATCH}") if(KWIN_PLASMA_ACTIVE) set(KWIN_BUILD_DECORATIONS OFF) set(KWIN_BUILD_KCMS OFF) set(KWIN_BUILD_SCREENEDGES OFF) set(KWIN_BUILD_XRENDER_COMPOSITING OFF) set(KWIN_BUILD_WITH_OPENGLES ON) set(KWIN_NAME "kwinactive") endif() cmake_dependent_option(KWIN_BUILD_KAPPMENU "Build without appmenu support" ON "KWIN_BUILD_DECORATIONS" FALSE) set(KWIN_BUILD_OPENGL FALSE) set(KWIN_BUILD_OPENGLES FALSE) if(OPENGL_FOUND AND (${Qt5Gui_OPENGL_IMPLEMENTATION} STREQUAL "GL")) set(KWIN_BUILD_OPENGL TRUE) message("Building KWin with OpenGL support") endif() if(OPENGLES_FOUND AND (${Qt5Gui_OPENGL_IMPLEMENTATION} STREQUAL "GLESv2")) set(KWIN_BUILD_OPENGLES TRUE) message("Building KWin with OpenGL ES 2 support") endif() if(NOT KWIN_BUILD_OPENGL AND NOT KWIN_BUILD_OPENGLES) message(FATAL_ERROR "KWin needs to be built against either OpenGL or OpenGL ES 2. Check your Qt config!") endif() # KWIN_HAVE_XRENDER_COMPOSITING - whether XRender-based compositing support is available: may be disabled if( KWIN_BUILD_XRENDER_COMPOSITING ) set( KWIN_HAVE_XRENDER_COMPOSITING 1 ) endif() if(KWIN_BUILD_OPENGL) include_directories(${OPENGL_INCLUDE_DIR}) endif() set(KWIN_HAVE_EGL ${EGL_FOUND}) if(KWIN_BUILD_OPENGLES) include_directories(${OPENGLES_INCLUDE_DIR}) endif() # for things that are also used by kwin libraries configure_file(libkwineffects/kwinconfig.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/libkwineffects/kwinconfig.h ) # for kwin internal things if(Wayland_Client_FOUND AND XKB_FOUND) set(HAVE_WAYLAND ${Wayland_Client_FOUND}) set(HAVE_XKB ${XKB_FOUND}) set(HAVE_WAYLAND_EGL ${Wayland_Egl_FOUND}) else() set(HAVE_WAYLAND FALSE) set(HAVE_XKB FALSE) set(HAVE_WAYLAND_EGL FALSE) endif() include(CheckIncludeFiles) check_include_files(unistd.h HAVE_UNISTD_H) check_include_files(malloc.h HAVE_MALLOC_H) configure_file(config-kwin.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kwin.h ) ########### global ############### set(kwin_effects_dbus_xml ${CMAKE_CURRENT_SOURCE_DIR}/org.kde.kwin.Effects.xml) include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}/libkdecorations ${CMAKE_CURRENT_BINARY_DIR}/libkwineffects ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/libkwineffects ${CMAKE_CURRENT_SOURCE_DIR}/libkdecorations ${CMAKE_CURRENT_SOURCE_DIR}/effects ${CMAKE_CURRENT_SOURCE_DIR}/tabbox ) add_subdirectory( libkdecorations ) add_subdirectory( libkwineffects ) add_subdirectory( killer ) if(KWIN_BUILD_KCMS) add_subdirectory( kcmkwin ) endif() if( KWIN_BUILD_DECORATIONS ) add_subdirectory( clients ) endif() add_subdirectory( data ) add_subdirectory( effects ) add_subdirectory( scripts ) add_subdirectory( tabbox ) add_subdirectory(scripting) add_definitions(-DKDE_DEFAULT_DEBUG_AREA=1212) ########### next target ############### set(kwin_KDEINIT_SRCS workspace.cpp dbusinterface.cpp client.cpp client_machine.cpp cursor.cpp tabgroup.cpp focuschain.cpp globalshortcuts.cpp input.cpp netinfo.cpp placement.cpp atoms.cpp utils.cpp layers.cpp main.cpp options.cpp outline.cpp decorations.cpp events.cpp killwindow.cpp geometrytip.cpp screens.cpp shadow.cpp sm.cpp group.cpp bridge.cpp manage.cpp overlaywindow.cpp activation.cpp useractions.cpp geometry.cpp rules.cpp composite.cpp toplevel.cpp unmanaged.cpp scene.cpp scene_xrender.cpp scene_opengl.cpp scene_qpainter.cpp glxbackend.cpp thumbnailitem.cpp lanczosfilter.cpp deleted.cpp effects.cpp compositingprefs.cpp paintredirector.cpp virtualdesktops.cpp xcbutils.cpp scripting/scripting.cpp scripting/workspace_wrapper.cpp scripting/meta.cpp scripting/scriptedeffect.cpp scripting/scriptingutils.cpp scripting/timer.cpp scripting/scripting_model.cpp scripting/dbuscall.cpp scripting/screenedgeitem.cpp ) if(KWIN_BUILD_TABBOX) set( kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS} tabbox/tabbox.cpp tabbox/clientmodel.cpp tabbox/desktopchain.cpp tabbox/desktopmodel.cpp tabbox/switcheritem.cpp tabbox/tabboxconfig.cpp tabbox/tabboxhandler.cpp ) endif() if(KWIN_BUILD_SCREENEDGES) set( kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS} screenedge.cpp ) endif() if(KWIN_BUILD_KAPPMENU) set( kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS} appmenu.cpp ) qt5_add_dbus_interface(kwin_KDEINIT_SRCS ${KDEBASE_WORKSPACE_SOURCE_DIR}/plasma-workspace/appmenu/org.kde.kappmenu.xml appmenu_interface) endif() if(KWIN_BUILD_ACTIVITIES) set( kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS} activities.cpp ) endif() if(KWIN_HAVE_EGL) set(kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS} eglonxbackend.cpp) endif() if(Wayland_Client_FOUND AND XKB_FOUND) set(kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS} wayland_backend.cpp) if(KWIN_HAVE_EGL AND Wayland_Egl_FOUND) set(kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS} egl_wayland_backend.cpp) endif() endif() kconfig_add_kcfg_files(kwin_KDEINIT_SRCS settings.kcfgc) qt5_add_dbus_adaptor( kwin_KDEINIT_SRCS org.kde.KWin.xml dbusinterface.h KWin::DBusInterface ) qt5_add_dbus_adaptor( kwin_KDEINIT_SRCS org.kde.kwin.Compositing.xml composite.h KWin::Compositor ) qt5_add_dbus_adaptor( kwin_KDEINIT_SRCS org.kde.kwin.Effects.xml effects.h KWin::EffectsHandlerImpl ) qt5_add_dbus_interface( kwin_KDEINIT_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/org.freedesktop.ScreenSaver.xml screenlocker_interface) qt5_add_resources( kwin_KDEINIT_SRCS resources.qrc ) qt5_wrap_ui(kwin_KDEINIT_SRCS shortcutdialog.ui ) ########### target link libraries ############### set(kwin_OWN_LIBS kdecorations kwineffects kwin4_effect_builtins ) set(kwin_QT_LIBS Qt5::Concurrent Qt5::DBus Qt5::Quick Qt5::Script Qt5::X11Extras ) set(kwin_KDE_LIBS KF5::ConfigCore KF5::CoreAddons KF5::ConfigWidgets KF5::Crash KF5::GlobalAccel KF5::I18n KF5::Notifications KF5::Service KF5::Plasma KF5::WindowSystem ) set(kwin_XLIB_LIBS ${X11_X11_LIB} ${X11_Xext_LIB} ${X11_Xcursor_LIB} ${X11_ICE_LIB} ${X11_SM_LIB} ) set(kwin_XCB_LIBS XCB::XCB XCB::XFIXES XCB::DAMAGE XCB::COMPOSITE XCB::SHAPE XCB::SYNC XCB::RENDER XCB::RANDR XCB::KEYSYMS XCB::SHM XCB::XTEST ) set(kwin_WAYLAND_LIBS Wayland::Client Wayland::Cursor XCB::XTEST XKB::XKB ) set(kwin_WAYLAND_EGL_LIBS Wayland::Egl ) set(kwin_OPENGL_LIBS ) find_library(XF86VM_LIBRARY Xxf86vm) if (XF86VM_LIBRARY) set(kwin_XLIB_LIBS ${kwin_XLIB_LIBS} ${XF86VM_LIBRARY}) else() add_definitions(-DKWIN_NO_XF86VM) endif() if(KWIN_BUILD_ACTIVITIES) set(kwin_KDE_LIBS ${kwin_KDE_LIBS} KF5::Activities) endif() if(KWIN_HAVE_EGL) set(kwin_OPENGL_LIBS ${kwin_OPENGL_LIBS} EGL::EGL) endif() set(kwinLibs ${kwin_OWN_LIBS} ${kwin_QT_LIBS} ${kwin_KDE_LIBS} ${kwin_XLIB_LIBS} ${kwin_XCB_LIBS} ${kwin_OPENGL_LIBS} ) if(Wayland_Client_FOUND AND XKB_FOUND) set(kwinLibs ${kwinLibs} ${kwin_WAYLAND_LIBS}) if(KWIN_HAVE_EGL AND Wayland_Egl_FOUND) set(kwinLibs ${kwinLibs} ${kwin_WAYLAND_EGL_LIBS}) endif() endif() kf5_add_kdeinit_executable( kwin ${kwin_KDEINIT_SRCS}) target_link_libraries(kdeinit_kwin ${kwinLibs}) set_target_properties(kwin PROPERTIES OUTPUT_NAME ${KWIN_NAME}) generate_export_header(kdeinit_kwin EXPORT_FILE_NAME kwin_export.h) if(KWIN_BUILD_OPENGL) target_link_libraries(kdeinit_kwin kwinglutils ${OPENGL_gl_LIBRARY}) # -ldl used by OpenGL code find_library(DL_LIBRARY dl) if (DL_LIBRARY) target_link_libraries(kdeinit_kwin ${DL_LIBRARY}) endif() elseif(KWIN_BUILD_OPENGLES) target_link_libraries(kdeinit_kwin ${kwinLibs} kwinglesutils ${OPENGLES_LIBRARIES}) set_target_properties(kdeinit_kwin PROPERTIES COMPILE_FLAGS "-DKWIN_HAVE_OPENGLES") endif() install(TARGETS kdeinit_kwin ${INSTALL_TARGETS_DEFAULT_ARGS} ) install(TARGETS kwin ${INSTALL_TARGETS_DEFAULT_ARGS} ) ########### install files ############### install( FILES kwin.kcfg DESTINATION ${KCFG_INSTALL_DIR} RENAME ${KWIN_NAME}.kcfg ) install( FILES kwin.notifyrc DESTINATION ${DATA_INSTALL_DIR}/${KWIN_NAME} RENAME ${KWIN_NAME}.notifyrc) install( FILES org.kde.KWin.xml org.kde.kwin.Compositing.xml org.kde.kwin.Effects.xml DESTINATION ${DBUS_INTERFACES_INSTALL_DIR} ) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/kwin_export.h DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel) # Install the KWin/Script service type install( FILES scripting/kwinscript.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR} ) ecm_install_icons( ${ICON_INSTALL_DIR} ) add_subdirectory(qml) add_subdirectory(autotests) add_subdirectory(tests) configure_file(KWinDBusInterfaceConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/KWinDBusInterfaceConfig.cmake" @ONLY) set(CMAKECONFIG_INSTALL_DIR "${CMAKECONFIG_INSTALL_PREFIX}/KWinDBusInterface") install(FILES ${CMAKE_CURRENT_BINARY_DIR}/KWinDBusInterfaceConfig.cmake DESTINATION ${CMAKECONFIG_INSTALL_DIR}) diff --git a/clients/CMakeLists.txt b/clients/CMakeLists.txt index 8d061a0ed..a7b08dcb7 100644 --- a/clients/CMakeLists.txt +++ b/clients/CMakeLists.txt @@ -1,5 +1,2 @@ add_definitions(-DKDE_DEFAULT_DEBUG_AREA=1216) add_subdirectory( aurorae ) -if(KWIN_BUILD_OXYGEN) - add_subdirectory( oxygen ) -endif() diff --git a/clients/oxygen/CMakeLists.txt b/clients/oxygen/CMakeLists.txt deleted file mode 100644 index ee25c8f6c..000000000 --- a/clients/oxygen/CMakeLists.txt +++ /dev/null @@ -1,36 +0,0 @@ -########### add version number into compilation defines -add_definitions (-DAPP_VERSION=\\\"${KWIN_VERSION}\\\") -add_definitions(-DHAVE_X11=${X11_FOUND}) -add_subdirectory(config) -add_subdirectory(demo) -add_subdirectory(data) - -########### next target ############### -set(kwin_oxygen_SRCS - oxygenbutton.cpp - oxygenclient.cpp - oxygenclientgroupitemdata.cpp - oxygendecohelper.cpp - oxygenexceptionlist.cpp - oxygenfactory.cpp - oxygensizegrip.cpp - oxygentitleanimationdata.cpp - ) - -kconfig_add_kcfg_files(kwin_oxygen_SRCS oxygenconfiguration.kcfgc ) - -add_library(kwin3_oxygen MODULE ${kwin_oxygen_SRCS}) -target_link_libraries(kwin3_oxygen Qt5::Widgets ) -target_link_libraries(kwin3_oxygen KF5::I18n KF5::WindowSystem KF5::Style KF5::Service) - -target_link_libraries(kwin3_oxygen kdecorations) - -target_link_libraries(kwin3_oxygen oxygenstyle) - -kservice_desktop_to_json(kwin3_oxygen oxygenclient.desktop) - -if(X11_FOUND) - target_link_libraries(kwin3_oxygen XCB::XCB) -endif() - -install(TARGETS kwin3_oxygen DESTINATION ${PLUGIN_INSTALL_DIR}/kwin/kdecorations) diff --git a/clients/oxygen/config/CMakeLists.txt b/clients/oxygen/config/CMakeLists.txt deleted file mode 100644 index b5826aa9f..000000000 --- a/clients/oxygen/config/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -set(kwin_oxygen_config_PART_SRCS - oxygenanimationconfigwidget.cpp - oxygenconfig.cpp - oxygenconfigwidget.cpp - oxygendetectwidget.cpp - oxygenexceptiondialog.cpp - oxygenexceptionlistwidget.cpp - oxygenexceptionmodel.cpp - ../oxygenexceptionlist.cpp - ) - -kconfig_add_kcfg_files(kwin_oxygen_config_PART_SRCS ../oxygenconfiguration.kcfgc) - -set( kwin_oxygen_config_PART_FORMS - ui/oxygenconfigurationui.ui - ui/oxygendetectwidget.ui - ui/oxygenexceptiondialog.ui - ui/oxygenexceptionlistwidget.ui -) - -qt5_wrap_ui(kwin_oxygen_config_PART_FORMS_HEADERS ${kwin_oxygen_config_PART_FORMS}) -add_library(kwin_oxygen_config MODULE - ${kwin_oxygen_config_PART_SRCS} - ${kwin_oxygen_config_PART_FORMS_HEADERS}) - -target_link_libraries(kwin_oxygen_config Qt5::Core Qt5::Gui Qt5::Widgets Qt5::DBus) -target_link_libraries(kwin_oxygen_config KF5::WindowSystem KF5::Completion) -target_link_libraries(kwin_oxygen_config kdecorations oxygenstyle oxygenstyleconfig) - -if(X11_FOUND) - target_link_libraries(kwin_oxygen_config XCB::XCB) - target_link_libraries(kwin_oxygen_config Qt5::X11Extras) -endif() - -install(TARGETS kwin_oxygen_config DESTINATION ${QT_PLUGIN_INSTALL_DIR}/kf5/kwin/kdecorations/config) diff --git a/clients/oxygen/config/config.json b/clients/oxygen/config/config.json deleted file mode 100644 index a157e529d..000000000 --- a/clients/oxygen/config/config.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "X-KDE-PluginInfo-Name": "Oxygen" -} diff --git a/clients/oxygen/config/oxygenanimationconfigwidget.cpp b/clients/oxygen/config/oxygenanimationconfigwidget.cpp deleted file mode 100644 index 0ddecb2fc..000000000 --- a/clients/oxygen/config/oxygenanimationconfigwidget.cpp +++ /dev/null @@ -1,156 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// oxygenanimationconfigwidget.cpp -// animation configuration widget -// ------------------- -// -// Copyright (c) 2010 Hugo Pereira Da Costa -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -////////////////////////////////////////////////////////////////////////////// - -#include "oxygenanimationconfigwidget.h" -#include "oxygenanimationconfigwidget.moc" -#include "oxygenanimationconfigitem.h" -#include "oxygengenericanimationconfigitem.h" - -#include -#include -#include -#include - -namespace Oxygen -{ - - //_______________________________________________ - AnimationConfigWidget::AnimationConfigWidget( QWidget* parent ): - BaseAnimationConfigWidget( parent ) - { - - QGridLayout* layout( qobject_cast( BaseAnimationConfigWidget::layout() ) ); - - setupItem( layout, _buttonAnimations = new GenericAnimationConfigItem( this, - i18n("Button mouseover transition"), - i18n("Configure window buttons' mouseover highlight animation" ) ) ); - - setupItem( layout, _titleAnimations = new GenericAnimationConfigItem( this, - i18n("Title transitions" ), - i18n("Configure fading transitions when window title is changed" ) ) ); - - setupItem( layout, _shadowAnimations = new GenericAnimationConfigItem( this, - i18n("Window active state change transitions" ), - i18n("Configure fading between window shadow and glow when window's active state is changed" ) ) ); - - setupItem( layout, _tabAnimations = new GenericAnimationConfigItem( this, - i18n("Window grouping animations" ), - i18n("Configure window titlebar animations when windows are grouped/ungrouped" ) ) ); - - // add spacers to the first column, previous row to finalize layout - layout->addItem( new QSpacerItem( 25, 0 ), _row-1, 0, 1, 1 ); - - // add vertical spacer - layout->addItem( new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding ), _row, 1, 1, 1 ); - ++_row; - - connect( animationsEnabled(), SIGNAL(toggled(bool)), SLOT(updateChanged()) ); - foreach( AnimationConfigItem* item, findChildren() ) - { - item->QWidget::setEnabled( false ); - connect( animationsEnabled(), SIGNAL(toggled(bool)), item, SLOT(setEnabled(bool)) ); - } - - } - - //_______________________________________________ - void AnimationConfigWidget::load( void ) - { - - // check configuration - if( !_configuration ) return; - - animationsEnabled()->setChecked( _configuration->animationsEnabled() ); - - _buttonAnimations->setEnabled( _configuration->buttonAnimationsEnabled() ); - _buttonAnimations->setDuration( _configuration->buttonAnimationsDuration() ); - - _titleAnimations->setEnabled( _configuration->titleAnimationsEnabled() ); - _titleAnimations->setDuration( _configuration->titleAnimationsDuration() ); - - _shadowAnimations->setEnabled( _configuration->shadowAnimationsEnabled() ); - _shadowAnimations->setDuration( _configuration->shadowAnimationsDuration() ); - - _tabAnimations->setEnabled( _configuration->tabAnimationsEnabled() ); - _tabAnimations->setDuration( _configuration->tabAnimationsDuration() ); - - setChanged( false ); - - } - - //_______________________________________________ - void AnimationConfigWidget::save( void ) - { - - // check configuration - if( !_configuration ) return; - - // save modifications - _configuration->setAnimationsEnabled( animationsEnabled()->isChecked() ); - - _configuration->setButtonAnimationsEnabled( _buttonAnimations->enabled() ); - _configuration->setButtonAnimationsDuration( _buttonAnimations->duration() ); - - _configuration->setTitleAnimationsEnabled( _titleAnimations->enabled() ); - _configuration->setTitleAnimationsDuration( _titleAnimations->duration() ); - - _configuration->setShadowAnimationsEnabled( _shadowAnimations->enabled() ); - _configuration->setShadowAnimationsDuration( _shadowAnimations->duration() ); - - _configuration->setTabAnimationsEnabled( _tabAnimations->enabled() ); - _configuration->setTabAnimationsDuration( _tabAnimations->duration() ); - - setChanged( false ); - - } - - //_______________________________________________ - void AnimationConfigWidget::updateChanged( void ) - { - - // check configuration - if( !_configuration ) return; - - // track modifications - bool modified( false ); - if( animationsEnabled()->isChecked() != _configuration->animationsEnabled() ) modified = true; - else if( _buttonAnimations->enabled() != _configuration->buttonAnimationsEnabled() ) modified = true; - else if( _buttonAnimations->duration() != _configuration->buttonAnimationsDuration() ) modified = true; - - else if( _titleAnimations->enabled() != _configuration->titleAnimationsEnabled() ) modified = true; - else if( _titleAnimations->duration() != _configuration->titleAnimationsDuration() ) modified = true; - - else if( _shadowAnimations->enabled() != _configuration->shadowAnimationsEnabled() ) modified = true; - else if( _shadowAnimations->duration() != _configuration->shadowAnimationsDuration() ) modified = true; - - else if( _tabAnimations->enabled() != _configuration->tabAnimationsEnabled() ) modified = true; - else if( _tabAnimations->duration() != _configuration->tabAnimationsDuration() ) modified = true; - - setChanged( modified ); - - } - -} diff --git a/clients/oxygen/config/oxygenanimationconfigwidget.h b/clients/oxygen/config/oxygenanimationconfigwidget.h deleted file mode 100644 index edc7aa6c3..000000000 --- a/clients/oxygen/config/oxygenanimationconfigwidget.h +++ /dev/null @@ -1,88 +0,0 @@ -#ifndef oxygenanimationconfigwidget_h -#define oxygenanimationconfigwidget_h - -////////////////////////////////////////////////////////////////////////////// -// oxygenanimationconfigwidget.h -// animation configuration item -// ------------------- -// -// Copyright (c) 2010 Hugo Pereira Da Costa -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -////////////////////////////////////////////////////////////////////////////// - -#include "../oxygendecorationdefines.h" -#include "oxygenbaseanimationconfigwidget.h" - -namespace Oxygen -{ - - // forward declaration - class GenericAnimationConfigItem; - - //! container to configure animations individually - class AnimationConfigWidget: public BaseAnimationConfigWidget - { - - Q_OBJECT - - public: - - //! constructor - explicit AnimationConfigWidget( QWidget* = 0 ); - - //! destructor - virtual ~AnimationConfigWidget( void ) - {} - - //! configuration - void setConfiguration( ConfigurationPtr configuration ) - { _configuration = configuration; } - - public Q_SLOTS: - - //! read current configuration - virtual void load( void ); - - //! save current configuration - virtual void save( void ); - - protected Q_SLOTS: - - //! check whether configuration is changed and emit appropriate signal if yes - virtual void updateChanged(); - - private: - - //! local configuration, needed to handle I/O - ConfigurationPtr _configuration; - - //!@name animations - //@{ - GenericAnimationConfigItem* _buttonAnimations; - GenericAnimationConfigItem* _titleAnimations; - GenericAnimationConfigItem* _shadowAnimations; - GenericAnimationConfigItem* _tabAnimations; - //@} - - }; - -} - -#endif diff --git a/clients/oxygen/config/oxygenconfig.cpp b/clients/oxygen/config/oxygenconfig.cpp deleted file mode 100644 index bb9d7f210..000000000 --- a/clients/oxygen/config/oxygenconfig.cpp +++ /dev/null @@ -1,181 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// config.cpp -// ------------------- -// -// Copyright (c) 2009 Hugo Pereira Da Costa -// Copyright (C) 2008 Lubos Lunak -// -// Based on the Quartz configuration module, -// Copyright (c) 2001 Karol Szwed -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -////////////////////////////////////////////////////////////////////////////// - -#include "oxygenconfig.h" - -#include "oxygenanimationconfigwidget.h" -#include "oxygenconfiguration.h" -#include "oxygenutil.h" -#include "../oxygenexceptionlist.h" - -#include -#include -#include - -#include -#include -#include - -//_______________________________________________________________________ - -K_PLUGIN_FACTORY_WITH_JSON(OxygenConfigPlugin, - "config.json", - registerPlugin(QString(), &Oxygen::Config::create); ) - -namespace Oxygen -{ - QObject *Config::create(QWidget *parentWidget, QObject *, const QList &) - { - return new Config(parentWidget); - } - - //_______________________________________________________________________ - Config::Config(QWidget* parent ): - QObject( parent ) - { - - // configuration - _configuration = KSharedConfig::openConfig( QStringLiteral( "oxygenrc" ) ); - - // create new configuration widget and add to layout, if any - _configWidget = new ConfigWidget( parent ); - if( parent && parent->layout() ) parent->layout()->addWidget( _configWidget ); - else _configWidget->show(); - - load(); - connect( _configWidget, SIGNAL(changed(bool)), SLOT(updateChanged()) ); - - } - - //_______________________________________________________________________ - Config::~Config() - { delete _configWidget; } - - //_______________________________________________________________________ - void Config::toggleExpertMode( bool value ) - { _configWidget->toggleExpertMode( value ); } - - //_______________________________________________________________________ - void Config::load( void ) - { - - // load standard configuration - ConfigurationPtr configuration( new Configuration() ); - configuration->readConfig(); - loadConfiguration( configuration ); - - // load shadows - foreach( ShadowConfigWidget* ui, _configWidget->shadowConfigurations ) - { ui->readConfig( _configuration.data() ); } - - // load exceptions - ExceptionList exceptions; - exceptions.readConfig( _configuration ); - _configWidget->exceptionListWidget()->setExceptions( exceptions.get() ); - updateChanged(); - - } - - //_______________________________________________________________________ - void Config::updateChanged( void ) - { - - ConfigurationPtr configuration( new Configuration() ); - configuration->readConfig(); - bool modified( false ); - - // exceptions - if( _configWidget->isChanged() ) modified = true; - - // emit relevant signals - if( modified ) emit changed(); - emit changed( modified ); - - } - - //_______________________________________________________________________ - void Config::save( void ) - { - - // create configuration from group - ConfigurationPtr configuration( new Configuration() ); - configuration->readConfig(); - - // save config widget - _configWidget->setConfiguration( configuration ); - _configWidget->save(); - - // save standard configuration - Util::writeConfig( configuration.data(), _configuration.data() ); - - // get list of exceptions and write - ConfigurationList exceptions( _configWidget->exceptionListWidget()->exceptions() ); - ExceptionList( exceptions ).writeConfig( _configuration ); - - // write shadow configuration - foreach( ShadowConfigWidget* ui, _configWidget->shadowConfigurations ) - { ui->writeConfig( _configuration.data() ); } - - // sync configuration - _configuration->sync(); - - QDBusMessage message( QDBusMessage::createSignal( QStringLiteral( "/OxygenWindeco" ), QStringLiteral( "org.kde.Oxygen.Style" ), QStringLiteral( "reparseConfiguration") ) ); - QDBusConnection::sessionBus().send(message); - - } - - //_______________________________________________________________________ - void Config::defaults( void ) - { - - // install default configuration - ConfigurationPtr configuration( new Configuration() ); - configuration->setDefaults(); - loadConfiguration( configuration ); - - // load shadows - foreach( ShadowConfigWidget* ui, _configWidget->shadowConfigurations ) - { ui->readDefaults( _configuration.data() ); } - - updateChanged(); - - } - - //_______________________________________________________________________ - void Config::loadConfiguration( ConfigurationPtr configuration ) - { - - _configWidget->setConfiguration( configuration ); - _configWidget->load(); - - } - -} - -#include "oxygenconfig.moc" diff --git a/clients/oxygen/config/oxygenconfig.h b/clients/oxygen/config/oxygenconfig.h deleted file mode 100644 index 72c511150..000000000 --- a/clients/oxygen/config/oxygenconfig.h +++ /dev/null @@ -1,112 +0,0 @@ -#ifndef oxygen_config_h -#define oxygen_config_h - -////////////////////////////////////////////////////////////////////////////// -// config.h -// ------------------- -// -// Copyright (c) 2009 Hugo Pereira Da Costa -// Copyright (C) 2008 Lubos Lunak -// -// Based on the Quartz configuration module, -// Copyright (c) 2001 Karol Szwed -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -////////////////////////////////////////////////////////////////////////////// - -#include "oxygenconfigwidget.h" -#include "oxygenconfiguration.h" -#include "../oxygendecorationdefines.h" - -#include -#include - -namespace Oxygen { - - class Configuration; - - // oxygen configuration object - class Config: public QObject - { - - Q_OBJECT - - public: - - //! constructor - Config( QWidget* parent ); - - //! destructor - ~Config(); - - static QObject *create(QWidget *parentWidget, QObject *parent, const QList &arguments); - - Q_SIGNALS: - - //! emmited whenever configuration is changed - void changed(); - - //! emmited whenever configuration is changed - void changed( bool ); - - public Q_SLOTS: - - //! load configuration - /*! although kconfiggroup argument is not used. It is required by KWin API */ - void load( const KConfigGroup& ) - { load(); } - - //! save configuration - /*! although kconfiggroup argument is not used. It is required by KWin API */ - void save( KConfigGroup& ) - { save(); } - - //! load configuration - void load( void ); - - //! save configuration - void save( void ); - - //! restore defaults - void defaults( void ); - - //! toggle expert mode - void toggleExpertMode( bool ); - - private Q_SLOTS: - - //! update change state - void updateChanged( void ); - - private: - - //! load configuration - void loadConfiguration( ConfigurationPtr ); - - //! user interface - ConfigWidget* _configWidget; - - //! kconfiguration object - KSharedConfig::Ptr _configuration; - - }; - -} //namespace Oxygen - -#endif diff --git a/clients/oxygen/config/oxygenconfigwidget.cpp b/clients/oxygen/config/oxygenconfigwidget.cpp deleted file mode 100644 index 051bb965a..000000000 --- a/clients/oxygen/config/oxygenconfigwidget.cpp +++ /dev/null @@ -1,251 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// oxygenconfigurationui.cpp -// ------------------- -// -// Copyright (c) 2009 Hugo Pereira Da Costa -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -////////////////////////////////////////////////////////////////////////////// - -#include "oxygenconfigwidget.h" -#include "oxygenanimationconfigwidget.h" - -#include -#include -#include -#include - -#include - -namespace Oxygen -{ - - //_________________________________________________________ - ConfigWidget::ConfigWidget( QWidget* parent ): - QWidget( parent ), - _expertMode( false ), - _animationConfigWidget(0), - _changed( false ) - { - - ui.setupUi( this ); - - // shadow configuration - ui.activeShadowConfiguration->setGroup( QPalette::Active ); - ui.inactiveShadowConfiguration->setGroup( QPalette::Inactive ); - - shadowConfigurations.append( ui.activeShadowConfiguration ); - shadowConfigurations.append( ui.inactiveShadowConfiguration ); - - // animation config widget - _animationConfigWidget = new AnimationConfigWidget(); - _animationConfigWidget->installEventFilter( this ); - - // expert mode - ui._expertModeButton->setIcon( QIcon::fromTheme( QStringLiteral( "configure" ) ) ); - toggleExpertModeInternal( false ); - - // connections - connect( ui._expertModeButton, SIGNAL(clicked()), SLOT(toggleExpertModeInternal()) ); - connect( _animationConfigWidget, SIGNAL(layoutChanged()), SLOT(updateLayout()) ); - - // track ui changes - connect( ui.titleAlignment, SIGNAL(currentIndexChanged(int)), SLOT(updateChanged()) ); - connect( ui.buttonSize, SIGNAL(currentIndexChanged(int)), SLOT(updateChanged()) ); - connect( ui.frameBorder, SIGNAL(currentIndexChanged(int)), SLOT(updateChanged()) ); - - connect( ui.titleOutline, SIGNAL(clicked()), SLOT(updateChanged()) ); - connect( ui.drawSizeGrip, SIGNAL(clicked()), SLOT(updateChanged()) ); - connect( ui.narrowButtonSpacing, SIGNAL(clicked()), SLOT(updateChanged()) ); - connect( ui.closeFromMenuButton, SIGNAL(clicked()), SLOT(updateChanged()) ); - connect( ui.separatorMode, SIGNAL(currentIndexChanged(int)), SLOT(updateChanged()) ); - connect( ui.drawBorderOnMaximizedWindows, SIGNAL(clicked()), SLOT(updateChanged()) ); - - // track exception changes - connect( ui.exceptions, SIGNAL(changed(bool)), SLOT(updateChanged()) ); - - // track shadow configuration changes - connect( shadowConfigurations[0], SIGNAL(changed(bool)), SLOT(updateChanged()) ); - connect( shadowConfigurations[1], SIGNAL(changed(bool)), SLOT(updateChanged()) ); - - // track animations changes - connect( ui.animationsEnabled, SIGNAL(clicked()), SLOT(updateChanged()) ); - connect( _animationConfigWidget, SIGNAL(changed(bool)), SLOT(updateChanged()) ); - - } - - //_________________________________________________________ - void ConfigWidget::setConfiguration( ConfigurationPtr configuration ) - { - _configuration = configuration; - _animationConfigWidget->setConfiguration( configuration ); - } - - //_________________________________________________________ - void ConfigWidget::load( void ) - { - if( !_configuration ) return; - ui.titleAlignment->setCurrentIndex( _configuration->titleAlignment() ); - ui.buttonSize->setCurrentIndex( _configuration->buttonSize() ); - ui.frameBorder->setCurrentIndex( _configuration->frameBorder() ); - ui.separatorMode->setCurrentIndex( _configuration->separatorMode() ); - ui.drawSizeGrip->setChecked( _configuration->drawSizeGrip() ); - ui.titleOutline->setChecked( _configuration->drawTitleOutline() ); - ui.animationsEnabled->setChecked( _configuration->animationsEnabled() ); - ui.narrowButtonSpacing->setChecked( _configuration->useNarrowButtonSpacing() ); - ui.closeFromMenuButton->setChecked( _configuration->closeWindowFromMenuButton() ); - ui.drawBorderOnMaximizedWindows->setChecked( _configuration->drawBorderOnMaximizedWindows() ); - setChanged( false ); - - _animationConfigWidget->load(); - - } - - //_________________________________________________________ - void ConfigWidget::save( void ) - { - - if( !_configuration ) return; - - // apply modifications from ui - _configuration->setTitleAlignment( ui.titleAlignment->currentIndex() ); - _configuration->setButtonSize( ui.buttonSize->currentIndex() ); - _configuration->setFrameBorder( ui.frameBorder->currentIndex() ); - _configuration->setSeparatorMode( ui.separatorMode->currentIndex() ); - _configuration->setDrawSizeGrip( ui.drawSizeGrip->isChecked() ); - _configuration->setDrawTitleOutline( ui.titleOutline->isChecked() ); - _configuration->setUseNarrowButtonSpacing( ui.narrowButtonSpacing->isChecked() ); - _configuration->setCloseWindowFromMenuButton( ui.closeFromMenuButton->isChecked() ); - _configuration->setDrawBorderOnMaximizedWindows( ui.drawBorderOnMaximizedWindows->isChecked() ); - setChanged( false ); - - if( _expertMode ) _animationConfigWidget->save(); - else _configuration->setAnimationsEnabled( ui.animationsEnabled->isChecked() ); - - - } - - //_________________________________________________________ - void ConfigWidget::toggleExpertMode( bool value ) - { - ui._expertModeContainer->hide(); - toggleExpertModeInternal( value ); - } - - //_________________________________________________________ - void ConfigWidget::toggleExpertModeInternal( bool value ) - { - - // store value - _expertMode = value; - - // update button text - ui._expertModeButton->setText( _expertMode ? i18n( "Hide Advanced Configuration Options" ):i18n( "Show Advanced Configuration Options" ) ); - - // narrow button spacing - ui.narrowButtonSpacing->setVisible( _expertMode ); - - // size grip - ui.drawSizeGrip->setVisible( _expertMode ); - - // 'basic' animations enabled flag - ui.animationsEnabled->setVisible( !_expertMode ); - - // layout and animations - if( _expertMode ) - { - - // add animationConfigWidget to tabbar if needed - if( ui.tabWidget->indexOf( _animationConfigWidget ) < 0 ) - { ui.tabWidget->insertTab( 1, _animationConfigWidget, i18n( "Animations" ) ); } - - ui.shadowSpacer->changeSize(0,0, QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); - - } else { - - ui.shadowSpacer->changeSize(0,0, QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); - - if( int index = ui.tabWidget->indexOf( _animationConfigWidget ) >= 0 ) - { ui.tabWidget->removeTab( index ); } - - } - - } - - //__________________________________________________________________ - bool ConfigWidget::eventFilter( QObject* object, QEvent* event ) - { - - switch( event->type() ) - { - case QEvent::ShowToParent: - object->event( event ); - updateLayout(); - return true; - - default: - return false; - } - } - - //__________________________________________________________________ - void ConfigWidget::updateLayout( void ) - { - - int delta = _animationConfigWidget->minimumSizeHint().height() - _animationConfigWidget->size().height(); - window()->setMinimumSize( QSize( window()->minimumSizeHint().width(), window()->size().height() + delta ) ); - - } - - - //_______________________________________________ - void ConfigWidget::updateChanged( void ) - { - - // check configuration - if( !_configuration ) return; - - // track modifications - bool modified( false ); - - if( ui.titleAlignment->currentIndex() != _configuration->titleAlignment() ) modified = true; - else if( ui.buttonSize->currentIndex() != _configuration->buttonSize() ) modified = true; - else if( ui.frameBorder->currentIndex() != _configuration->frameBorder() ) modified = true; - else if( ui.separatorMode->currentIndex() != _configuration->separatorMode() ) modified = true; - else if( ui.drawSizeGrip->isChecked() != _configuration->drawSizeGrip() ) modified = true; - else if( ui.titleOutline->isChecked() != _configuration->drawTitleOutline() ) modified = true; - else if( ui.narrowButtonSpacing->isChecked() != _configuration->useNarrowButtonSpacing() ) modified = true; - else if( ui.closeFromMenuButton->isChecked() != _configuration->closeWindowFromMenuButton() ) modified = true; - else if( ui.drawBorderOnMaximizedWindows->isChecked() != _configuration->drawBorderOnMaximizedWindows() ) modified = true; - - // exceptions - else if( ui.exceptions->isChanged() ) modified = true; - - // shadow configurations - else if( shadowConfigurations[0]->isChanged() ) modified = true; - else if( shadowConfigurations[1]->isChanged() ) modified = true; - - // animations - else if( !_expertMode && ui.animationsEnabled->isChecked() != _configuration->animationsEnabled() ) modified = true; - else if( _expertMode && _animationConfigWidget->isChanged() ) modified = true; - - setChanged( modified ); - - } -} diff --git a/clients/oxygen/config/oxygenconfigwidget.h b/clients/oxygen/config/oxygenconfigwidget.h deleted file mode 100644 index a1f67b62f..000000000 --- a/clients/oxygen/config/oxygenconfigwidget.h +++ /dev/null @@ -1,135 +0,0 @@ -#ifndef oxygenconfigwidget_h -#define oxygenconfigwidget_h -////////////////////////////////////////////////////////////////////////////// -// oxygenconfigurationui.h -// ------------------- -// -// Copyright (c) 2009 Hugo Pereira Da Costa -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -////////////////////////////////////////////////////////////////////////////// - -#include "ui_oxygenconfigurationui.h" -#include "oxygenshadowconfigwidget.h" -#include "oxygenexceptionlistwidget.h" -#include "../oxygendecorationdefines.h" - -#include -#include -#include -#include - -namespace Oxygen -{ - - class AnimationConfigWidget; - - //_____________________________________________ - class ConfigWidget: public QWidget - { - - Q_OBJECT - - public: - - //! constructor - explicit ConfigWidget( QWidget* ); - - //! destructor - virtual ~ConfigWidget( void ) - {} - - //! set configuration - void setConfiguration( ConfigurationPtr ); - - //! load configuration - void load( void ); - - //! save configuration - void save( void ); - - //! true if changed - virtual bool isChanged( void ) const - { return _changed; } - - //! exceptions - ExceptionListWidget* exceptionListWidget( void ) const - { return ui.exceptions; } - - //! shadow configuration - QVector shadowConfigurations; - - //! toggle expert mode - void toggleExpertMode( bool ); - - //! event filter - virtual bool eventFilter( QObject*, QEvent* ); - - Q_SIGNALS: - - //! emmited when changed - void changed( bool ); - - protected Q_SLOTS: - - //! toggle expert mode - void toggleExpertModeInternal( void ) - { toggleExpertModeInternal( !_expertMode ); } - - //! toggle expert mode - void toggleExpertModeInternal( bool ); - - //! update changed state - virtual void updateChanged(); - - //! update layout - /*! needed in expert mode to accommodate with animations config widget size changes */ - void updateLayout( void ); - - protected: - - //! set changed state - virtual void setChanged( bool value ) - { - _changed = value; - emit changed( value ); - } - - private: - - //! ui - Ui_OxygenConfigurationUI ui; - - //! internal exception - ConfigurationPtr _configuration; - - //! expert mode - bool _expertMode; - - //! animation config (expert mode only) - AnimationConfigWidget* _animationConfigWidget; - - //! changed state - bool _changed; - - }; - -} - -#endif diff --git a/clients/oxygen/config/oxygendetectwidget.cpp b/clients/oxygen/config/oxygendetectwidget.cpp deleted file mode 100644 index d8f44cedb..000000000 --- a/clients/oxygen/config/oxygendetectwidget.cpp +++ /dev/null @@ -1,175 +0,0 @@ - -////////////////////////////////////////////////////////////////////////////// -// oxygendetectwidget.cpp -// Note: this class is a stripped down version of -// /kdebase/workspace/kwin/kcmkwin/kwinrules/detectwidget.cpp -// Copyright (c) 2004 Lubos Lunak -// ------------------- -// -// Copyright (c) 2009 Hugo Pereira Da Costa -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -////////////////////////////////////////////////////////////////////////////// - -#include "oxygendetectwidget.h" -#include "oxygendetectwidget.moc" - -#include -#include -#include -#include -#include - -#include -#include - -namespace Oxygen -{ - - //_________________________________________________________ - DetectDialog::DetectDialog( QWidget* parent ): - QDialog( parent ), - _grabber( 0 ), - _wmStateAtom( 0 ) - { - - // setup - setupUi( this ); - - connect( buttonBox->button( QDialogButtonBox::Cancel ), SIGNAL(clicked()), this, SLOT(close()) ); - windowClassCheckBox->setChecked( true ); - - // create atom - xcb_connection_t* connection( QX11Info::connection() ); - const QString atomName( QStringLiteral( "WM_STATE" ) ); - xcb_intern_atom_cookie_t cookie( xcb_intern_atom( connection, false, atomName.size(), qPrintable( atomName ) ) ); - QScopedPointer reply( xcb_intern_atom_reply( connection, cookie, nullptr) ); - _wmStateAtom = reply ? reply->atom : 0; - - } - - //_________________________________________________________ - void DetectDialog::detect( WId window ) - { - if( window == 0 ) selectWindow(); - else readWindow( window ); - } - - //_________________________________________________________ - void DetectDialog::readWindow( WId window ) - { - - if( window == 0 ) - { - emit detectionDone( false ); - return; - } - - _info.reset(new KWindowInfo( window, NET::WMAllProperties, NET::WM2AllProperties )); - if( !_info->valid()) - { - emit detectionDone( false ); - return; - } - - const QString wmClassClass( QString::fromUtf8( _info->windowClassClass() ) ); - const QString wmClassName( QString::fromUtf8( _info->windowClassName() ) ); - - windowClass->setText( QStringLiteral( "%1 (%2 %3)" ).arg( wmClassClass ).arg( wmClassName ).arg( wmClassClass ) ); - Ui::OxygenDetectWidget::windowTitle->setText( _info->name() ); - emit detectionDone( exec() == QDialog::Accepted ); - - return; - - } - - //_________________________________________________________ - void DetectDialog::selectWindow() - { - - // use a dialog, so that all user input is blocked - // use WX11BypassWM and moving away so that it's not actually visible - // grab only mouse, so that keyboard can be used e.g. for switching windows - _grabber = new QDialog( 0, Qt::X11BypassWindowManagerHint ); - _grabber->move( -1000, -1000 ); - _grabber->setModal( true ); - _grabber->show(); - - // need to explicitly override cursor for Qt5 - qApp->setOverrideCursor( Qt::CrossCursor ); - _grabber->grabMouse( Qt::CrossCursor ); - _grabber->installEventFilter( this ); - - } - - //_________________________________________________________ - bool DetectDialog::eventFilter( QObject* o, QEvent* e ) - { - // check object and event type - if( o != _grabber ) return false; - if( e->type() != QEvent::MouseButtonRelease ) return false; - - // need to explicitely release cursor for Qt5 - qApp->restoreOverrideCursor(); - - // delete old _grabber - delete _grabber; - _grabber = 0; - - // check button - if( static_cast< QMouseEvent* >( e )->button() != Qt::LeftButton ) return true; - - // read window information - readWindow( findWindow() ); - - return true; - } - - //_________________________________________________________ - WId DetectDialog::findWindow() - { - - // check atom - if( !_wmStateAtom ) return 0; - - xcb_connection_t* connection( QX11Info::connection() ); - xcb_window_t parent( QX11Info::appRootWindow() ); - - // why is there a loop of only 10 here - for( int i = 0; i < 10; ++i ) - { - - // query pointer - xcb_query_pointer_cookie_t pointerCookie( xcb_query_pointer( connection, parent ) ); - QScopedPointer pointerReply( xcb_query_pointer_reply( connection, pointerCookie, nullptr ) ); - if( !( pointerReply && pointerReply->child ) ) return 0; - - const xcb_window_t child( pointerReply->child ); - xcb_get_property_cookie_t cookie( xcb_get_property( connection, 0, child, _wmStateAtom, XCB_GET_PROPERTY_TYPE_ANY, 0, 0 ) ); - QScopedPointer reply( xcb_get_property_reply( connection, cookie, nullptr ) ); - if( reply && reply->type ) return child; - else parent = child; - - } - - return 0; - - } - -} diff --git a/clients/oxygen/config/oxygendetectwidget.h b/clients/oxygen/config/oxygendetectwidget.h deleted file mode 100644 index a71848823..000000000 --- a/clients/oxygen/config/oxygendetectwidget.h +++ /dev/null @@ -1,111 +0,0 @@ -#ifndef oxygendetectwidget_h -#define oxygendetectwidget_h - -////////////////////////////////////////////////////////////////////////////// -// oxygendetectwidget.h -// Note: this class is a stripped down version of -// /kdebase/workspace/kwin/kcmkwin/kwinrules/detectwidget.h -// Copyright (c) 2004 Lubos Lunak - -// ------------------- -// -// Copyright (c) 2009 Hugo Pereira Da Costa -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -////////////////////////////////////////////////////////////////////////////// - -#include "oxygenconfiguration.h" -#include "ui_oxygendetectwidget.h" - -#include -#include -#include -#include -#include - -#include -#include - -namespace Oxygen -{ - - class DetectDialog : public QDialog, Ui::OxygenDetectWidget - { - - Q_OBJECT - - public: - - //! constructor - explicit DetectDialog( QWidget* ); - - //! read window properties or select one from mouse grab - void detect( WId window ); - - //! selected class - QByteArray selectedClass() const; - - //! window information - const KWindowInfo& windowInfo() const - { return *(_info.data()); } - - //! exception type - Configuration::EnumExceptionType exceptionType() const - { - if( windowClassCheckBox->isChecked() ) return Configuration::ExceptionWindowClassName; - else if( windowTitleCheckBox->isChecked() ) return Configuration::ExceptionWindowTitle; - else return Configuration::ExceptionWindowClassName; - } - - Q_SIGNALS: - - void detectionDone( bool ); - - protected: - - virtual bool eventFilter( QObject* o, QEvent* e ); - - private: - - //! select window from grab - void selectWindow(); - - //! read window properties - void readWindow( WId window ); - - //! find window under cursor - WId findWindow(); - - //! execute - void executeDialog( void ); - - //! invisible dialog used to grab mouse - QDialog* _grabber; - - //! current window information - QScopedPointer _info; - - //! wm state atom - xcb_atom_t _wmStateAtom; - - }; - -} // namespace - -#endif diff --git a/clients/oxygen/config/oxygenexceptiondialog.cpp b/clients/oxygen/config/oxygenexceptiondialog.cpp deleted file mode 100644 index 348463956..000000000 --- a/clients/oxygen/config/oxygenexceptiondialog.cpp +++ /dev/null @@ -1,189 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// oxygenexceptiondialog.cpp -// ------------------- -// -// Copyright (c) 2009 Hugo Pereira Da Costa -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -////////////////////////////////////////////////////////////////////////////// - -#include "oxygenexceptiondialog.h" -#include "oxygenexceptiondialog.moc" -#include "oxygendetectwidget.h" - -namespace Oxygen -{ - - //___________________________________________ - ExceptionDialog::ExceptionDialog( QWidget* parent ): - QDialog( parent ), - _detectDialog(0), - _changed( false ) - { - - setupUi( this ); - connect( buttonBox->button( QDialogButtonBox::Cancel ), SIGNAL(clicked()), this, SLOT(close()) ); - - // store checkboxes from ui into list - _checkBoxes.insert( FrameBorder, frameBorderCheckBox ); - _checkBoxes.insert( SizeGripMode, sizeGripCheckBox ); - _checkBoxes.insert( TitleOutline, titleOutlineCheckBox ); - _checkBoxes.insert( DrawSeparator, separatorCheckBox ); - - // detect window properties - connect( detectDialogButton, SIGNAL(clicked()), SLOT(selectWindowProperties()) ); - - // connections - connect( exceptionType, SIGNAL(currentIndexChanged(int)), SLOT(updateChanged()) ); - connect( exceptionEditor, SIGNAL(textChanged(QString)), SLOT(updateChanged()) ); - connect( frameBorderComboBox, SIGNAL(currentIndexChanged(int)), SLOT(updateChanged()) ); - connect( sizeGripComboBox, SIGNAL(currentIndexChanged(int)), SLOT(updateChanged()) ); - connect( titleOutlineComboBox, SIGNAL(currentIndexChanged(int)), SLOT(updateChanged()) ); - connect( separatorComboBox, SIGNAL(currentIndexChanged(int)), SLOT(updateChanged()) ); - - for( CheckBoxMap::iterator iter = _checkBoxes.begin(); iter != _checkBoxes.end(); ++iter ) - { connect( iter.value(), SIGNAL(clicked()), SLOT(updateChanged()) ); } - - connect( hideTitleBar, SIGNAL(clicked()), SLOT(updateChanged()) ); - } - - //___________________________________________ - void ExceptionDialog::setException( ConfigurationPtr exception ) - { - - // store exception internally - _exception = exception; - - // type - exceptionType->setCurrentIndex(_exception->exceptionType() ); - exceptionEditor->setText( _exception->exceptionPattern() ); - frameBorderComboBox->setCurrentIndex( _exception->frameBorder() ); - sizeGripComboBox->setCurrentIndex( _exception->drawSizeGrip() ); - separatorComboBox->setCurrentIndex( _exception->separatorMode() ); - titleOutlineComboBox->setCurrentIndex( _exception->drawTitleOutline() ); - hideTitleBar->setChecked( _exception->hideTitleBar() ); - - // mask - for( CheckBoxMap::iterator iter = _checkBoxes.begin(); iter != _checkBoxes.end(); ++iter ) - { iter.value()->setChecked( _exception->mask() & iter.key() ); } - - setChanged( false ); - - } - - //___________________________________________ - void ExceptionDialog::save( void ) - { - _exception->setExceptionType( exceptionType->currentIndex() ); - _exception->setExceptionPattern( exceptionEditor->text() ); - _exception->setFrameBorder( frameBorderComboBox->currentIndex() ); - _exception->setDrawSizeGrip( sizeGripComboBox->currentIndex() ); - _exception->setSeparatorMode( separatorComboBox->currentIndex() ); - _exception->setDrawTitleOutline( titleOutlineComboBox->currentIndex() ); - _exception->setHideTitleBar( hideTitleBar->isChecked() ); - - // mask - unsigned int mask = None; - for( CheckBoxMap::iterator iter = _checkBoxes.begin(); iter != _checkBoxes.end(); ++iter ) - { if( iter.value()->isChecked() ) mask |= iter.key(); } - - _exception->setMask( mask ); - - setChanged( false ); - - } - - //___________________________________________ - void ExceptionDialog::updateChanged( void ) - { - bool modified( false ); - if( _exception->exceptionType() != exceptionType->currentIndex() ) modified = true; - else if( _exception->exceptionPattern() != exceptionEditor->text() ) modified = true; - else if( _exception->frameBorder() != frameBorderComboBox->currentIndex() ) modified = true; - else if( _exception->drawSizeGrip() != sizeGripComboBox->currentIndex() ) modified = true; - else if( _exception->separatorMode() != separatorComboBox->currentIndex() ) modified = true; - else if( _exception->drawTitleOutline() != titleOutlineComboBox->currentIndex() ) modified = true; - else if( _exception->hideTitleBar() != hideTitleBar->isChecked() ) modified = true; - else - { - // check mask - for( CheckBoxMap::iterator iter = _checkBoxes.begin(); iter != _checkBoxes.end(); ++iter ) - { - if( iter.value()->isChecked() != (bool)( _exception->mask() & iter.key() ) ) - { - modified = true; - break; - } - } - } - - setChanged( modified ); - - } - - //___________________________________________ - void ExceptionDialog::selectWindowProperties( void ) - { - - // create widget - if( !_detectDialog ) - { - _detectDialog = new DetectDialog( this ); - connect( _detectDialog, SIGNAL(detectionDone(bool)), SLOT(readWindowProperties(bool)) ); - } - - _detectDialog->detect(0); - - } - - //___________________________________________ - void ExceptionDialog::readWindowProperties( bool valid ) - { - Q_CHECK_PTR( _detectDialog ); - if( valid ) - { - - // type - exceptionType->setCurrentIndex( _detectDialog->exceptionType() ); - - // window info - const KWindowInfo& info( _detectDialog->windowInfo() ); - - switch( _detectDialog->exceptionType() ) - { - - default: - case Configuration::ExceptionWindowClassName: - exceptionEditor->setText( QString::fromUtf8( info.windowClassClass() ) ); - break; - - case Configuration::ExceptionWindowTitle: - exceptionEditor->setText( info.name() ); - break; - - } - - } - - delete _detectDialog; - _detectDialog = 0; - - } - -} diff --git a/clients/oxygen/config/oxygenexceptiondialog.h b/clients/oxygen/config/oxygenexceptiondialog.h deleted file mode 100644 index 3e4ba94d3..000000000 --- a/clients/oxygen/config/oxygenexceptiondialog.h +++ /dev/null @@ -1,112 +0,0 @@ -#ifndef oxygenexceptiondialog_h -#define oxygenexceptiondialog_h -////////////////////////////////////////////////////////////////////////////// -// oxygenexceptiondialog.h -// ------------------- -// -// Copyright (c) 2009 Hugo Pereira Da Costa -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -////////////////////////////////////////////////////////////////////////////// - -#include "ui_oxygenexceptiondialog.h" -#include "../oxygendecorationdefines.h" - -#include -#include - -namespace Oxygen -{ - - class DetectDialog; - - //! oxygen exceptions list - class ExceptionDialog: public QDialog, Ui::OxygenExceptionDialog - { - - Q_OBJECT - - public: - - //! constructor - explicit ExceptionDialog( QWidget* parent ); - - //! destructor - virtual ~ExceptionDialog( void ) - {} - - //! set exception - void setException( ConfigurationPtr ); - - //! save exception - void save( void ); - - //! true if changed - virtual bool isChanged( void ) const - { return _changed; } - - Q_SIGNALS: - - //! emmited when changed - void changed( bool ); - - protected: - - //! set changed state - virtual void setChanged( bool value ) - { - _changed = value; - emit changed( value ); - } - - protected Q_SLOTS: - - //! check whether configuration is changed and emit appropriate signal if yes - virtual void updateChanged(); - - private Q_SLOTS: - - //! select window properties from grabbed pointers - void selectWindowProperties( void ); - - //! read properties of selected window - void readWindowProperties( bool ); - - private: - - //! map mask and checkbox - typedef QMap< ExceptionMask, QCheckBox*> CheckBoxMap; - - //! map mask and checkbox - CheckBoxMap _checkBoxes; - - //! internal exception - ConfigurationPtr _exception; - - //! detection dialog - DetectDialog* _detectDialog; - - //! changed state - bool _changed; - - }; - -} - -#endif diff --git a/clients/oxygen/config/oxygenexceptionlistwidget.cpp b/clients/oxygen/config/oxygenexceptionlistwidget.cpp deleted file mode 100644 index 63c14fd79..000000000 --- a/clients/oxygen/config/oxygenexceptionlistwidget.cpp +++ /dev/null @@ -1,347 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// oxygenexceptionlistwidget.cpp -// ------------------- -// -// Copyright (c) 2009 Hugo Pereira Da Costa -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -////////////////////////////////////////////////////////////////////////////// - -#include "oxygenexceptionlistwidget.h" -#include "oxygenexceptionlistwidget.moc" -#include "oxygenexceptiondialog.h" - -#include -#include -#include -#include - -//__________________________________________________________ -namespace Oxygen -{ - - //__________________________________________________________ - ExceptionListWidget::ExceptionListWidget( QWidget* parent ): - QWidget( parent ), - _changed( false ) - { - - //! ui - ui.setupUi( this ); - - // list - ui.exceptionListView->setAllColumnsShowFocus( true ); - ui.exceptionListView->setRootIsDecorated( false ); - ui.exceptionListView->setSortingEnabled( false ); - ui.exceptionListView->setModel( &model() ); - ui.exceptionListView->sortByColumn( ExceptionModel::TYPE ); - ui.exceptionListView->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Ignored ) ); - - ui.moveUpButton->setIcon( QIcon::fromTheme( QStringLiteral( "arrow-up" ) ) ); - ui.moveDownButton->setIcon( QIcon::fromTheme( QStringLiteral( "arrow-down" ) ) ); - ui.addButton->setIcon( QIcon::fromTheme( QStringLiteral( "list-add" ) ) ); - ui.removeButton->setIcon( QIcon::fromTheme( QStringLiteral( "list-remove" ) ) ); - ui.editButton->setIcon( QIcon::fromTheme( QStringLiteral( "edit-rename" ) ) ); - - connect( ui.addButton, SIGNAL(clicked()), SLOT(add()) ); - connect( ui.editButton, SIGNAL(clicked()), SLOT(edit()) ); - connect( ui.removeButton, SIGNAL(clicked()), SLOT(remove()) ); - connect( ui.moveUpButton, SIGNAL(clicked()), SLOT(up()) ); - connect( ui.moveDownButton, SIGNAL(clicked()), SLOT(down()) ); - - connect( ui.exceptionListView, SIGNAL(activated(QModelIndex)), SLOT(edit()) ); - connect( ui.exceptionListView, SIGNAL(clicked(QModelIndex)), SLOT(toggle(QModelIndex)) ); - connect( ui.exceptionListView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), SLOT(updateButtons()) ); - - updateButtons(); - resizeColumns(); - - - } - - //__________________________________________________________ - void ExceptionListWidget::setExceptions( const ConfigurationList& exceptions ) - { - model().set( exceptions ); - resizeColumns(); - setChanged( false ); - } - - //__________________________________________________________ - ConfigurationList ExceptionListWidget::exceptions( void ) - { - return model().get(); - setChanged( false ); - } - - //__________________________________________________________ - void ExceptionListWidget::updateButtons( void ) - { - - bool hasSelection( !ui.exceptionListView->selectionModel()->selectedRows().empty() ); - ui.removeButton->setEnabled( hasSelection ); - ui.editButton->setEnabled( hasSelection ); - - ui.moveUpButton->setEnabled( hasSelection && !ui.exceptionListView->selectionModel()->isRowSelected( 0, QModelIndex() ) ); - ui.moveDownButton->setEnabled( hasSelection && !ui.exceptionListView->selectionModel()->isRowSelected( model().rowCount()-1, QModelIndex() ) ); - - } - - - //_______________________________________________________ - void ExceptionListWidget::add( void ) - { - - - QPointer dialog = new ExceptionDialog( this ); - ConfigurationPtr exception( new Configuration() ); - exception->readConfig(); - dialog->setException( exception ); - - // run dialog and check existence - if( !dialog->exec() ) - { - delete dialog; - return; - } - - dialog->save(); - delete dialog; - - // check exceptions - if( !checkException( exception ) ) return; - - // create new item - model().add( exception ); - setChanged( true ); - - // make sure item is selected - QModelIndex index( model().index( exception ) ); - if( index != ui.exceptionListView->selectionModel()->currentIndex() ) - { - ui.exceptionListView->selectionModel()->select( index, QItemSelectionModel::Clear|QItemSelectionModel::Select|QItemSelectionModel::Rows ); - ui.exceptionListView->selectionModel()->setCurrentIndex( index, QItemSelectionModel::Current|QItemSelectionModel::Rows ); - } - - resizeColumns(); - return; - - } - - //_______________________________________________________ - void ExceptionListWidget::edit( void ) - { - - // retrieve selection - QModelIndex current( ui.exceptionListView->selectionModel()->currentIndex() ); - if( ! model().contains( current ) ) return; - - ConfigurationPtr exception( model().get( current ) ); - - // create dialog - QPointer dialog( new ExceptionDialog( this ) ); - dialog->setException( exception ); - - // map dialog - if( !dialog->exec() ) - { - delete dialog; - return; - } - - // check modifications - if( !dialog->isChanged() ) return; - - // retrieve exception - dialog->save(); - delete dialog; - - // check new exception validity - checkException( exception ); - resizeColumns(); - - setChanged( true ); - - return; - - } - - //_______________________________________________________ - void ExceptionListWidget::remove( void ) - { - - // should use a konfirmation dialog - if( QMessageBox::question( this, i18n("Question - Oxygen Settings" ), i18n("Remove selected exception?") ) == QMessageBox::No ) return; - - // remove - model().remove( model().get( ui.exceptionListView->selectionModel()->selectedRows() ) ); - resizeColumns(); - updateButtons(); - - setChanged( true ); - - return; - - } - - //_______________________________________________________ - void ExceptionListWidget::toggle( const QModelIndex& index ) - { - - if( !model().contains( index ) ) return; - if( index.column() != ExceptionModel::ENABLED ) return; - - // get matching exception - ConfigurationPtr exception( model().get( index ) ); - exception->setEnabled( !exception->enabled() ); - setChanged( true ); - return; - - } - - //_______________________________________________________ - void ExceptionListWidget::up( void ) - { - - ConfigurationList selection( model().get( ui.exceptionListView->selectionModel()->selectedRows() ) ); - if( selection.empty() ) { return; } - - // retrieve selected indexes in list and store in model - QModelIndexList selectedIndices( ui.exceptionListView->selectionModel()->selectedRows() ); - ConfigurationList selectedExceptions( model().get( selectedIndices ) ); - - ConfigurationList currentException( model().get() ); - ConfigurationList newExceptions; - - for( ConfigurationList::const_iterator iter = currentException.constBegin(); iter != currentException.constEnd(); ++iter ) - { - - // check if new list is not empty, current index is selected and last index is not. - // if yes, move. - if( - !( newExceptions.empty() || - selectedIndices.indexOf( model().index( *iter ) ) == -1 || - selectedIndices.indexOf( model().index( newExceptions.back() ) ) != -1 - ) ) - { - ConfigurationPtr last( newExceptions.back() ); - newExceptions.removeLast(); - newExceptions.append( *iter ); - newExceptions.append( last ); - } else newExceptions.append( *iter ); - - } - - model().set( newExceptions ); - - // restore selection - ui.exceptionListView->selectionModel()->select( model().index( selectedExceptions.front() ), QItemSelectionModel::Clear|QItemSelectionModel::Select|QItemSelectionModel::Rows ); - for( ConfigurationList::const_iterator iter = selectedExceptions.constBegin(); iter != selectedExceptions.constEnd(); ++iter ) - { ui.exceptionListView->selectionModel()->select( model().index( *iter ), QItemSelectionModel::Select|QItemSelectionModel::Rows ); } - - setChanged( true ); - - return; - - } - - //_______________________________________________________ - void ExceptionListWidget::down( void ) - { - - ConfigurationList selection( model().get( ui.exceptionListView->selectionModel()->selectedRows() ) ); - if( selection.empty() ) - { return; } - - // retrieve selected indexes in list and store in model - QModelIndexList selectedIndices( ui.exceptionListView->selectionModel()->selectedIndexes() ); - ConfigurationList selectedExceptions( model().get( selectedIndices ) ); - - ConfigurationList currentExceptions( model().get() ); - ConfigurationList newExceptions; - - ConfigurationListIterator iter( currentExceptions ); - iter.toBack(); - while( iter.hasPrevious() ) - { - - ConfigurationPtr current( iter.previous() ); - - // check if new list is not empty, current index is selected and last index is not. - // if yes, move. - if( - !( newExceptions.empty() || - selectedIndices.indexOf( model().index( current ) ) == -1 || - selectedIndices.indexOf( model().index( newExceptions.front() ) ) != -1 - ) ) - { - - ConfigurationPtr first( newExceptions.front() ); - newExceptions.removeFirst(); - newExceptions.prepend( current ); - newExceptions.prepend( first ); - - } else newExceptions.prepend( current ); - } - - model().set( newExceptions ); - - // restore selection - ui.exceptionListView->selectionModel()->select( model().index( selectedExceptions.front() ), QItemSelectionModel::Clear|QItemSelectionModel::Select|QItemSelectionModel::Rows ); - for( ConfigurationList::const_iterator iter = selectedExceptions.constBegin(); iter != selectedExceptions.constEnd(); ++iter ) - { ui.exceptionListView->selectionModel()->select( model().index( *iter ), QItemSelectionModel::Select|QItemSelectionModel::Rows ); } - - setChanged( true ); - - return; - - } - - //_______________________________________________________ - void ExceptionListWidget::resizeColumns( void ) const - { - ui.exceptionListView->resizeColumnToContents( ExceptionModel::ENABLED ); - ui.exceptionListView->resizeColumnToContents( ExceptionModel::TYPE ); - ui.exceptionListView->resizeColumnToContents( ExceptionModel::REGEXP ); - } - - //_______________________________________________________ - bool ExceptionListWidget::checkException( ConfigurationPtr exception ) - { - - while( exception->exceptionPattern().isEmpty() || !QRegExp( exception->exceptionPattern() ).isValid() ) - { - - QMessageBox::warning( this, i18n( "Warning - Oxygen Settings" ), i18n("Regular Expression syntax is incorrect") ); - QPointer dialog( new ExceptionDialog( this ) ); - dialog->setException( exception ); - if( dialog->exec() == QDialog::Rejected ) - { - delete dialog; - return false; - } - - dialog->save(); - delete dialog; - } - - return true; - } - -} diff --git a/clients/oxygen/config/oxygenexceptionlistwidget.h b/clients/oxygen/config/oxygenexceptionlistwidget.h deleted file mode 100644 index dfc8b291b..000000000 --- a/clients/oxygen/config/oxygenexceptionlistwidget.h +++ /dev/null @@ -1,124 +0,0 @@ -#ifndef oxygenexceptionlistwidget_h -#define oxygenexceptionlistwidget_h -////////////////////////////////////////////////////////////////////////////// -// oxygenexceptionlistwidget.h -// ------------------- -// -// Copyright (c) 2009 Hugo Pereira Da Costa -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -////////////////////////////////////////////////////////////////////////////// - -#include "ui_oxygenexceptionlistwidget.h" -#include "oxygenexceptionmodel.h" - -//! QDialog used to commit selected files -namespace Oxygen -{ - - class ExceptionListWidget: public QWidget - { - - //! Qt meta object - Q_OBJECT - - public: - - //! constructor - explicit ExceptionListWidget( QWidget* = 0 ); - - //! set exceptions - void setExceptions( const ConfigurationList& ); - - //! get exceptions - ConfigurationList exceptions( void ); - - //! true if changed - virtual bool isChanged( void ) const - { return _changed; } - - Q_SIGNALS: - - //! emitted when changed - void changed( bool ); - - protected: - - //! model - const ExceptionModel& model() const - { return _model; } - - //! model - ExceptionModel& model() - { return _model; } - - protected Q_SLOTS: - - //! update button states - virtual void updateButtons( void ); - - //! add - virtual void add( void ); - - //! edit - virtual void edit( void ); - - //! remove - virtual void remove( void ); - - //! toggle - virtual void toggle( const QModelIndex& ); - - //! move up - virtual void up( void ); - - //! move down - virtual void down( void ); - - protected: - - //! resize columns - void resizeColumns( void ) const; - - //! check exception - bool checkException( ConfigurationPtr ); - - //! set changed state - virtual void setChanged( bool value ) - { - _changed = value; - emit changed( value ); - } - - private: - - //! model - ExceptionModel _model; - - //! ui - Ui_OxygenExceptionListWidget ui; - - //! changed state - bool _changed; - - }; - -} - -#endif diff --git a/clients/oxygen/config/oxygenexceptionmodel.cpp b/clients/oxygen/config/oxygenexceptionmodel.cpp deleted file mode 100644 index 374b134e8..000000000 --- a/clients/oxygen/config/oxygenexceptionmodel.cpp +++ /dev/null @@ -1,105 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// oxygenexceptionmodel.cpp -// ------------------- -// -// Copyright (c) 2009 Hugo Pereira Da Costa -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -////////////////////////////////////////////////////////////////////////////// - -#include "oxygenexceptionmodel.h" -#include -namespace Oxygen -{ - - //_______________________________________________ - const QString ExceptionModel::_columnTitles[ ExceptionModel::nColumns ] = - { - QStringLiteral( "" ), - i18n("Exception Type"), - i18n("Regular Expression") - }; - - //__________________________________________________________________ - QVariant ExceptionModel::data( const QModelIndex& index, int role ) const - { - - // check index, role and column - if( !index.isValid() ) return QVariant(); - - // retrieve associated file info - const ConfigurationPtr& configuration( get(index) ); - - // return text associated to file and column - if( role == Qt::DisplayRole ) - { - - switch( index.column() ) - { - case TYPE: - { - switch( configuration->exceptionType() ) - { - - case Configuration::ExceptionWindowTitle: - return i18n( "Window Title" ); - - default: - case Configuration::ExceptionWindowClassName: - return i18n( "Window Class Name" ); - } - - } - - case REGEXP: return configuration->exceptionPattern(); - default: return QVariant(); - break; - } - - } else if( role == Qt::CheckStateRole && index.column() == ENABLED ) { - - return configuration->enabled() ? Qt::Checked : Qt::Unchecked; - - } else if( role == Qt::ToolTipRole && index.column() == ENABLED ) { - - return i18n("Enable/disable this exception"); - - } - - - return QVariant(); - } - - //__________________________________________________________________ - QVariant ExceptionModel::headerData(int section, Qt::Orientation orientation, int role) const - { - - if( - orientation == Qt::Horizontal && - role == Qt::DisplayRole && - section >= 0 && - section < nColumns ) - { return _columnTitles[section]; } - - // return empty - return QVariant(); - - } - -} diff --git a/clients/oxygen/config/oxygenexceptionmodel.h b/clients/oxygen/config/oxygenexceptionmodel.h deleted file mode 100644 index 1d3b311f8..000000000 --- a/clients/oxygen/config/oxygenexceptionmodel.h +++ /dev/null @@ -1,81 +0,0 @@ -#ifndef oxygenexceptionmodel_h -#define oxygenexceptionmodel_h -////////////////////////////////////////////////////////////////////////////// -// oxygenexceptionmodel.h -// ------------------- -// -// Copyright (c) 2009 Hugo Pereira Da Costa -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -////////////////////////////////////////////////////////////////////////////// - -#include "oxygenlistmodel.h" -#include "oxygenconfiguration.h" -#include "../oxygendecorationdefines.h" - -namespace Oxygen -{ - - //! qlistview for object counters - class ExceptionModel: public ListModel - { - - public: - - //! number of columns - enum { nColumns = 3 }; - - //! column type enumeration - enum ColumnType { - ENABLED, - TYPE, - REGEXP - }; - - - //!@name methods reimplemented from base class - //@{ - - // return data for a given index - virtual QVariant data(const QModelIndex &index, int role) const; - - //! header data - virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; - - //! number of columns for a given index - virtual int columnCount(const QModelIndex& ) const - { return nColumns; } - - //@} - - protected: - - //! sort - virtual void privateSort( int, Qt::SortOrder ) - {} - - private: - - //! column titles - static const QString _columnTitles[ nColumns ]; - - }; - -} -#endif diff --git a/clients/oxygen/config/ui/oxygenconfigurationui.ui b/clients/oxygen/config/ui/oxygenconfigurationui.ui deleted file mode 100644 index 6007ca760..000000000 --- a/clients/oxygen/config/ui/oxygenconfigurationui.ui +++ /dev/null @@ -1,463 +0,0 @@ - - - OxygenConfigurationUI - - - - 0 - 0 - 538 - 388 - - - - - 0 - 0 - - - - - 0 - - - - - 0 - - - false - - - - General - - - - - - Border si&ze: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - frameBorder - - - - - - - - No Border - - - - - No Side Borders - - - - - Tiny - - - - - Normal - - - - - Large - - - - - Very Large - - - - - Huge - - - - - Very Huge - - - - - Oversized - - - - - - - - Tit&le alignment: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - titleAlignment - - - - - - - - Left - - - - - Center - - - - - Center (Full Width) - - - - - Right - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - B&utton size: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - buttonSize - - - - - - - - Small - - - - - Normal - - - - - Large - - - - - Very Large - - - - - Huge - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Enable animations - - - - - - - - Fine Tuning - - - - 4 - - - - - Close windows by double clicking the menu button - - - - - - - - Never Draw Separator - - - - - Draw Separator When Window is Active - - - - - Always Draw Separator - - - - - - - - Separator disp&lay: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - separatorMode - - - - - - - Outline active window title - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Use narrow space between decoration buttons - - - - - - - Add handle to resize windows with no border - - - - - - - Display window borders for maximized windows - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - Shadows - - - - - - - - Window Drop-Down Shadow - - - true - - - - - - - Active Window Glow - - - true - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - Window-Specific Overrides - - - - - - - - - - - - - - - - - - - - - - - QFrame::HLine - - - QFrame::Raised - - - - - - - - - - - KComboBox - QComboBox -
kcombobox.h
-
- - Oxygen::ShadowConfigWidget - QGroupBox -
oxygenshadowconfigwidget.h
- 1 -
- - Oxygen::ExceptionListWidget - QWidget -
oxygenexceptionlistwidget.h
- 1 -
-
- - tabWidget - frameBorder - titleAlignment - buttonSize - animationsEnabled - _expertModeButton - separatorMode - titleOutline - narrowButtonSpacing - inactiveShadowConfiguration - activeShadowConfiguration - - - - - titleOutline - toggled(bool) - separatorMode - setDisabled(bool) - - - 90 - 92 - - - 182 - 67 - - - - - titleOutline - toggled(bool) - label_5 - setDisabled(bool) - - - 39 - 90 - - - 53 - 64 - - - - -
diff --git a/clients/oxygen/config/ui/oxygendetectwidget.ui b/clients/oxygen/config/ui/oxygendetectwidget.ui deleted file mode 100644 index b002082aa..000000000 --- a/clients/oxygen/config/ui/oxygendetectwidget.ui +++ /dev/null @@ -1,133 +0,0 @@ - - - OxygenDetectWidget - - - - 0 - 0 - 400 - 300 - - - - Dialog - - - - - - Information about Selected Window - - - - - - Class: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - TextLabel - - - - - - - Title: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - TextLabel - - - - - - - - - - Window Property Selection - - - - - - Use window class (whole application) - - - - - - - - - - Use window title - - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - buttonBox - accepted() - OxygenDetectWidget - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - OxygenDetectWidget - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/clients/oxygen/config/ui/oxygenexceptiondialog.ui b/clients/oxygen/config/ui/oxygenexceptiondialog.ui deleted file mode 100644 index e69e4eec7..000000000 --- a/clients/oxygen/config/ui/oxygenexceptiondialog.ui +++ /dev/null @@ -1,365 +0,0 @@ - - - OxygenExceptionDialog - - - - 0 - 0 - 514 - 347 - - - - Dialog - - - - - - Window Identification - - - - - - Matching window property: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - exceptionType - - - - - - - Regular expression to match: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - exceptionEditor - - - - - - - Detect Window Properties - - - - - - - true - - - - - - - - Window Class Name - - - - - Window Title - - - - - - - - - - - Decoration Options - - - - - - false - - - - Disabled - - - - - Enabled - - - - - - - - false - - - - Never Draw Separator - - - - - Draw Separator When Window is Active - - - - - Always Draw Separator - - - - - - - - Border size: - - - - - - - Add handle to resize windows with no border - - - - - - - Outline active window title: - - - - - - - Separator display: - - - - - - - Hide window title bar - - - - - - - QFrame::HLine - - - QFrame::Sunken - - - - - - - false - - - - No Border - - - - - No Side Borders - - - - - Tiny - - - - - Normal - - - - - Large - - - - - Very Large - - - - - Huge - - - - - Very Huge - - - - - Oversized - - - - - - - - false - - - - Disabled - - - - - Enabled - - - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - KComboBox - QComboBox -
kcombobox.h
-
- - KLineEdit - QLineEdit -
klineedit.h
-
-
- - - - buttonBox - accepted() - OxygenExceptionDialog - accept() - - - 252 - 342 - - - 157 - 274 - - - - - buttonBox - rejected() - OxygenExceptionDialog - reject() - - - 320 - 342 - - - 286 - 274 - - - - - frameBorderCheckBox - toggled(bool) - frameBorderComboBox - setEnabled(bool) - - - 125 - 162 - - - 316 - 163 - - - - - sizeGripCheckBox - toggled(bool) - sizeGripComboBox - setEnabled(bool) - - - 202 - 212 - - - 319 - 214 - - - - - titleOutlineCheckBox - toggled(bool) - titleOutlineComboBox - setEnabled(bool) - - - 198 - 237 - - - 317 - 241 - - - - - separatorCheckBox - toggled(bool) - separatorComboBox - setEnabled(bool) - - - 118 - 264 - - - 298 - 266 - - - - -
diff --git a/clients/oxygen/config/ui/oxygenexceptionlistwidget.ui b/clients/oxygen/config/ui/oxygenexceptionlistwidget.ui deleted file mode 100644 index 29f2a345a..000000000 --- a/clients/oxygen/config/ui/oxygenexceptionlistwidget.ui +++ /dev/null @@ -1,102 +0,0 @@ - - - OxygenExceptionListWidget - - - - 0 - 0 - 473 - 163 - - - - - 0 - 0 - - - - - 0 - 0 - - - - - - - - 0 - 0 - - - - - 100 - 100 - - - - - - - - Qt::Vertical - - - - 20 - 1 - - - - - - - - Move Up - - - - - - - Move Down - - - - - - - Add - - - - - - - Remove - - - - - - - Edit - - - - - - - exceptionListView - moveUpButton - moveDownButton - addButton - removeButton - editButton - - - - diff --git a/clients/oxygen/data/CMakeLists.txt b/clients/oxygen/data/CMakeLists.txt deleted file mode 100644 index 7a4a2f795..000000000 --- a/clients/oxygen/data/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -########### install files ############### -install( FILES oxygen.upd DESTINATION ${KCONF_UPDATE_INSTALL_DIR} ) -install( PROGRAMS update_oxygen.pl DESTINATION ${KCONF_UPDATE_INSTALL_DIR} ) diff --git a/clients/oxygen/data/oxygen.upd b/clients/oxygen/data/oxygen.upd deleted file mode 100644 index 2271c35e2..000000000 --- a/clients/oxygen/data/oxygen.upd +++ /dev/null @@ -1,5 +0,0 @@ -# update decoration options for KDE 4.11 -Id=1 -File=oxygenrc -Options=overwrite -Script=update_oxygen.pl,perl diff --git a/clients/oxygen/data/update_oxygen.pl b/clients/oxygen/data/update_oxygen.pl deleted file mode 100755 index da5c34e0a..000000000 --- a/clients/oxygen/data/update_oxygen.pl +++ /dev/null @@ -1,192 +0,0 @@ -#!/usr/bin/perl -{ - - # keep track of current section - my $section = ""; - - # separator mode - my $drawSeparator; - my $separatorActiveOnly; - - while( <> ) - { - - # store current line - my $line = $_; - - # parse section - if( $line =~ /^\[\s*(.*)\s*\]/ ) - { - $section = $1; - print( $line ); - next; - } - - # parse key and value - if( !( $line=~ /^(.+)\s*=\s*(.+)$/ ) ) - { - print( $line ); - next; - } - - my $key = $1; - my $value = $2; - - if( $key eq "BlendColor" ) { - - # Blend style - # delete key (renamed to BlendStyle ) - print( "# DELETE [$section]$key\n" ); - $key="BlendStyle"; - - my %hash = ( - "Solid Color"=>"BlendNone", - "Radial Gradient"=>"BlendRadial", - "Follow Style Hint"=>"BlendFromStyle" ); - - if( $hash{$value} ) - { print( "$key=$hash{$value}\n" ); } - - } elsif( $key eq "ButtonSize" ) { - - # Button size - my %hash = ( - "Small"=>"ButtonSmall", - "Normal"=>"ButtonDefault", - "Large"=>"ButtonLarge", - "Very Large"=>"ButtonVeryLarge", - "Huge"=>"ButtonHuge" ); - - if( $hash{$value} ) { print( "$key=$hash{$value}\n" ); } - else { print( "# DELETE [$section]$key\n" ); } - - } elsif( $key eq "FrameBorder" ) { - - # frame border size - my %hash = ( - "No Border"=>"BorderNone", - "No Side Border"=>"BorderNoSide", - "Tiny"=>"BorderTiny", - "Normal"=>"BorderDefault", - "Large"=>"BorderLarge", - "Very Large"=>"BorderVeryLarge", - "Huge"=>"BorderHuge", - "Very Huge"=>"BorderVeryHuge", - "Oversized"=>"BorderOverSized" ); - - if( $hash{$value} ) { print( "$key=$hash{$value}\n" ); } - else { print( "# DELETE [$section]$key\n" ); } - - } elsif( $key eq "SizeGripMode" ) { - - # size grip - # delete key (renamed to DrawSizeGrip ) - print( "# DELETE [$section]$key\n" ); - $key="DrawSizeGrip"; - - my %hash = ( - "Always Hide Extra Size Grip"=>"false", - "Show Extra Size Grip When Needed"=>"true" ); - - if( $hash{$value} ) { print( "$key=$hash{$value}\n" ); } - - } elsif( $key eq "TitleAlignment" ) { - - # title alignment - my %hash = ( - "Left"=>"AlignLeft", - "Center"=>"AlignCenter", - "Center (Full Width)"=>"AlignCenterFullWidth", - "Right"=>"AlignRight" ); - - if( $hash{$value} ) { print( "$key=$hash{$value}\n" ); } - else { print( "# DELETE [$section]$key\n" ); } - - } elsif( $key eq "DrawSeparator" ) { - - # separator - print( "# DELETE [$section]$key\n" ); - - $drawSeparator = $value; - if( !( $separatorActiveOnly eq "" ) ) - { - - $key = "SeparatorMode"; - $value = ""; - - if( $drawSeparator eq "false" ) { $value = "SeparatorNever"; } - elsif( $drawSeparator eq "true" ) { - - if( $separatorActiveOnly eq "true" ) { $value = "SeparatorActive"; } - elsif( $separatorActiveOnly eq "false" ) { $value = "SeparatorAlways"; } - - } - - if( !( $value eq "" ) ) { print( "$key=$value\n" ); } - $separatorActiveOnly=""; - $drawSeparator=""; - } - - } elsif( $key eq "SeparatorActiveOnly" ) { - - # separator - print( "# DELETE [$section]$key\n" ); - - $separatorActiveOnly = $value; - if( !( $drawSeparator eq "" ) ) - { - - $key = "SeparatorMode"; - $value = ""; - - if( $drawSeparator eq "false" ) { $value = "SeparatorNever"; } - elsif( $drawSeparator eq "true" ) { - - if( $separatorActiveOnly eq "true" ) { $value = "SeparatorActive"; } - elsif( $separatorActiveOnly eq "false" ) { $value = "SeparatorAlways"; } - - } - - if( !( $value eq "" ) ) { print( "$key=$value\n" ); } - $separatorActiveOnly=""; - $drawSeparator=""; - - } - - } elsif( $key eq "Pattern" ) { - - # exception pattern - print( "# DELETE [$section]$key\n" ); - - $key="ExceptionPattern"; - print( "$key=$value\n" ); - - } elsif( $key eq "Type" ) { - - # exception type - print( "# DELETE [$section]$key\n" ); - $key = "ExceptionType"; - my %hash = ( - "Window Class Name"=>"ExceptionWindowClassName", - "Window Title"=>"ExceptionWindowTitle" ); - - if( $hash{$value} ) { print( "$key=$hash{$value}\n" ); } - - } elsif( - ( $key eq "CenterTitleOnFullWidth" ) || - ( $key eq "UseDropShadows" ) || - ( $key eq "UseOxygenShadows" ) ) { - - # obsolete flags - print( "# DELETE [$section]$key\n" ); - - - } else { - - print( $line ); - - } - - } - -} diff --git a/clients/oxygen/demo/CMakeLists.txt b/clients/oxygen/demo/CMakeLists.txt deleted file mode 100644 index 60c301801..000000000 --- a/clients/oxygen/demo/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -set(oxygen_shadow_demo_SOURCES - oxygenshadowdemodialog.cpp - oxygenshadowdemowidget.cpp - main.cpp) - -set(oxygen_shadow_demo_FORMS ui/oxygenshadowdemo.ui) - -qt5_wrap_ui(oxygen_shadow_demo_FORMS_HEADERS ${oxygen_shadow_demo_FORMS}) - -add_executable(oxygen-shadow-demo ${oxygen_shadow_demo_SOURCES} ${oxygen_shadow_demo_FORMS_HEADERS}) - -target_link_libraries(oxygen-shadow-demo Qt5::Core Qt5::Gui Qt5::Widgets Qt5::DBus) -target_link_libraries(oxygen-shadow-demo KF5::I18n) -target_link_libraries(oxygen-shadow-demo oxygenstyle ) - -if(X11_FOUND) - target_link_libraries(oxygen-shadow-demo ${X11_LIBRARIES}) -endif() - -install(TARGETS oxygen-shadow-demo ${INSTALL_TARGETS_DEFAULT_ARGS}) diff --git a/clients/oxygen/demo/main.cpp b/clients/oxygen/demo/main.cpp deleted file mode 100644 index b256e2495..000000000 --- a/clients/oxygen/demo/main.cpp +++ /dev/null @@ -1,45 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// main.cpp -// oxygen-demo main -// ------------------- -// -// Copyright (c) 2010 Hugo Pereira Da Costa -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -////////////////////////////////////////////////////////////////////////////// - -#include "oxygenshadowdemodialog.h" - -#include -#include - -#include - -int main(int argc, char *argv[]) -{ - - QApplication app( argc, argv ); - app.setApplicationName( i18n( "Oxygen Shadow Demo" ) ); - app.setWindowIcon( QIcon::fromTheme( QStringLiteral( "oxygen" ) ) ); - Oxygen::ShadowDemoDialog dialog; - dialog.show(); - bool result = app.exec(); - return result; - -} diff --git a/clients/oxygen/demo/oxygenshadowdemodialog.cpp b/clients/oxygen/demo/oxygenshadowdemodialog.cpp deleted file mode 100644 index b96c8b013..000000000 --- a/clients/oxygen/demo/oxygenshadowdemodialog.cpp +++ /dev/null @@ -1,116 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// oxygenshadowdemodialog.h -// oxygen shadow demo dialog -// ------------------- -// -// Copyright (c) 2010 Hugo Pereira Da Costa -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -////////////////////////////////////////////////////////////////////////////// - -#include "oxygenshadowdemodialog.h" -#include "oxygenshadowdemodialog.moc" - -#include -#include - -#include - -namespace Oxygen -{ - - //_________________________________________________________ - ShadowDemoDialog::ShadowDemoDialog( QWidget* parent ): - QDialog( parent ), - _helper( KSharedConfig::openConfig("oxygenrc") ), - _cache( _helper ) - { - - setWindowTitle( i18n( "Oxygen Shadow Demo" ) ); - setupUi( this ); - - inactiveRoundWidget->setHelper( _helper ); - inactiveSquareWidget->setHelper( _helper ); - activeRoundWidget->setHelper( _helper ); - activeSquareWidget->setHelper( _helper ); - - // reparse configuration - reparseConfiguration(); - - // customize button box - QList children( findChildren() ); - if( !children.isEmpty() ) - { - QDialogButtonBox* buttonBox( children.front() ); - - _backgroundCheckBox = new QCheckBox( i18n( "Draw window background" ) ); - _backgroundCheckBox->setChecked( true ); - buttonBox->addButton( _backgroundCheckBox, QDialogButtonBox::ResetRole ); - - connect( _backgroundCheckBox, SIGNAL(toggled(bool)), inactiveRoundWidget, SLOT(toggleBackground(bool)) ); - connect( _backgroundCheckBox, SIGNAL(toggled(bool)), inactiveSquareWidget, SLOT(toggleBackground(bool)) ); - connect( _backgroundCheckBox, SIGNAL(toggled(bool)), activeRoundWidget, SLOT(toggleBackground(bool)) ); - connect( _backgroundCheckBox, SIGNAL(toggled(bool)), activeSquareWidget, SLOT(toggleBackground(bool)) ); - - } - - // use DBus connection to update on oxygen configuration change - QDBusConnection dbus = QDBusConnection::sessionBus(); - dbus.connect( QString(), - QStringLiteral( "/OxygenWindeco" ), - QStringLiteral( "org.kde.Oxygen.Style" ), - QStringLiteral( "reparseConfiguration" ), this, SLOT(reparseConfiguration()) ); - - } - - //_________________________________________________________ - void ShadowDemoDialog::reparseConfiguration( void ) - { - - // read shadow configurations - _cache.invalidateCaches(); - _cache.setEnabled( true ); - - // pass tileSets to UI - ShadowCache::Key key; - key.active = false; - key.hasBorder = true; - inactiveRoundWidget->setTileSet( *_cache.tileSet( key ) ); - inactiveRoundWidget->setShadowSize( _cache.shadowSize() ); - - key.active = false; - key.hasBorder = false; - inactiveSquareWidget->setTileSet( *_cache.tileSet( key ) ); - inactiveSquareWidget->setShadowSize( _cache.shadowSize() ); - inactiveSquareWidget->setSquare( true ); - - key.active = true; - key.hasBorder = true; - activeRoundWidget->setTileSet( *_cache.tileSet( key ) ); - activeRoundWidget->setShadowSize( _cache.shadowSize() ); - - key.active = true; - key.hasBorder = false; - activeSquareWidget->setTileSet( *_cache.tileSet( key ) ); - activeSquareWidget->setShadowSize( _cache.shadowSize() ); - activeSquareWidget->setSquare( true ); - - } - -} diff --git a/clients/oxygen/demo/oxygenshadowdemodialog.h b/clients/oxygen/demo/oxygenshadowdemodialog.h deleted file mode 100644 index 009e31892..000000000 --- a/clients/oxygen/demo/oxygenshadowdemodialog.h +++ /dev/null @@ -1,73 +0,0 @@ -#ifndef oxygenshadowdemodialog_h -#define oxygenshadowdemodialog_h - -////////////////////////////////////////////////////////////////////////////// -// oxygenshadowdemodialog.h -// oxygen shadow demo dialog -// ------------------- -// -// Copyright (c) 2010 Hugo Pereira Da Costa -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -////////////////////////////////////////////////////////////////////////////// - -#include "ui_oxygenshadowdemo.h" -#include "oxygenhelper.h" -#include "oxygenshadowcache.h" - -#include -#include - -namespace Oxygen -{ - class ShadowDemoDialog: public QDialog, Ui::OxygenShadowDemoDialog - { - - Q_OBJECT - - public: - - //! constructor - explicit ShadowDemoDialog( QWidget* = 0 ); - - //! destructor - virtual ~ShadowDemoDialog( void ) - {} - - protected Q_SLOTS: - - //! reparse configuration - void reparseConfiguration( void ); - - private: - - //! helper - Helper _helper; - - //! shadow cache - ShadowCache _cache; - - //! enable state checkbox - QCheckBox* _backgroundCheckBox; - - }; - -} - -#endif diff --git a/clients/oxygen/demo/oxygenshadowdemowidget.cpp b/clients/oxygen/demo/oxygenshadowdemowidget.cpp deleted file mode 100644 index 974944d3a..000000000 --- a/clients/oxygen/demo/oxygenshadowdemowidget.cpp +++ /dev/null @@ -1,105 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// oxygenshadowdemowidget.h -// shadow demo widget -// ------------------- -// -// Copyright (c) 2009 Hugo Pereira Da Costa -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -////////////////////////////////////////////////////////////////////////////// - -#include "oxygenshadowdemowidget.h" -#include "oxygenshadowdemowidget.moc" - -#include -namespace Oxygen -{ - - //______________________________________ - void ShadowDemoWidget::paintEvent( QPaintEvent* event ) - { - - if( !_tileSet.isValid() ) return; - - QPainter painter( this ); - painter.setClipRegion( event->region() ); - _tileSet.render( rect(), &painter ); - - // draw background - if( _drawBackground ) - { - updateBackgroundPixmap(); - painter.translate( _shadowSize, _shadowSize ); - painter.drawPixmap( QPoint(0,0), _backgroundPixmap ); - } - - } - - //______________________________________ - void ShadowDemoWidget::updateBackgroundPixmap( void ) - { - - // check if background pixmap needs update - QRect backgroundRect( QPoint( 0, 0 ), size() - QSize( 2*_shadowSize, 2*_shadowSize ) ); - if( !_backgroundPixmap.isNull() && _backgroundPixmap.size() == backgroundRect.size() ) - { return; } - - _backgroundPixmap = QPixmap( backgroundRect.size() ); - _backgroundPixmap.fill( Qt::transparent ); - QPainter painter( &_backgroundPixmap ); - painter.setRenderHint( QPainter::Antialiasing ); - - _dummy.resize( backgroundRect.size() ); - helper().renderWindowBackground( - &painter, backgroundRect, - &_dummy, &_dummy, palette().color( QPalette::Window ), 0, 64 ); - - // float frame - helper().drawFloatFrame( &painter, backgroundRect.adjusted( -1, -1, 1, 1 ), palette().color( QPalette::Window ), false ); - - // add rounded mask - painter.save(); - painter.setCompositionMode( QPainter::CompositionMode_DestinationIn ); - painter.setBrush( Qt::black ); - painter.setPen( Qt::NoPen ); - if( _square ) - { - QRectF rectF( backgroundRect ); - QPainterPath path; - - // rotate counterclockwise, cause that makes angles easier - path.moveTo( rectF.topLeft() + QPointF( 3.5, 0 ) ); - path.arcTo( QRectF( rectF.topLeft(), QSize( 7, 7 ) ), 90, 90 ); - path.lineTo( rectF.bottomLeft() ); - path.lineTo( rectF.bottomRight() ); - path.lineTo( rectF.topRight() + QPointF( 0, 3.5 ) ); - path.arcTo( QRectF( rectF.topRight() + QPointF( -7, 0 ), QSize( 7, 7 ) ), 0, 90 ); - path.lineTo( rectF.topLeft() + QPointF( 3.5, 0 ) ); - painter.drawPath( path ); - - } else { - - painter.drawRoundedRect( QRectF( backgroundRect ), 3.5, 3.5 ); - - } - - painter.restore(); - } - -} diff --git a/clients/oxygen/demo/oxygenshadowdemowidget.h b/clients/oxygen/demo/oxygenshadowdemowidget.h deleted file mode 100644 index d3ec2bd4c..000000000 --- a/clients/oxygen/demo/oxygenshadowdemowidget.h +++ /dev/null @@ -1,140 +0,0 @@ -#ifndef oxygenshadowdemowidget_h -#define oxygenshadowdemowidget_h - -////////////////////////////////////////////////////////////////////////////// -// oxygenshadowdemowidget.h -// shadow demo widget -// ------------------- -// -// Copyright (c) 2009 Hugo Pereira Da Costa -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -////////////////////////////////////////////////////////////////////////////// - -#include "oxygentileset.h" -#include "oxygenhelper.h" - -#include -#include -#include -#include - -namespace Oxygen -{ - - //! shadow demo widget - class ShadowDemoWidget: public QWidget - { - - Q_OBJECT - - public: - - //! constructor - explicit ShadowDemoWidget( QWidget* parent = nullptr ): - QWidget( parent ), - _drawBackground( true ), - _square( false ), - _helper( 0L ) - {} - - //! destructor - virtual ~ShadowDemoWidget( void ) - {} - - //! helper - void setHelper( Helper& helper ) - { _helper = &helper; } - - //! set tileSet - void setTileSet( const TileSet& tileSet ) - { - _tileSet = tileSet; - if( isVisible() ) update(); - } - - //! tileset - const TileSet& tileSet( void ) const - { return _tileSet; } - - //! set shadow size - void setShadowSize( int size ) - { - _shadowSize = size; - setMinimumSize( _shadowSize*2 + 100, _shadowSize*2 + 60 ); - } - - //! square - void setSquare( bool value ) - { - _square = value; - if( isVisible() ) update(); - } - - protected Q_SLOTS: - - //! toggle background drawing - void toggleBackground( bool value ) - { - if( value == _drawBackground ) return; - _drawBackground = value; - update(); - } - - protected: - - //! paint event - virtual void paintEvent( QPaintEvent* ); - - //! render window to pixmap - void updateBackgroundPixmap( void ); - - Helper& helper( void ) const - { - assert( _helper ); - return *_helper; - } - - private: - - //! shadow size - int _shadowSize; - - //! draw window background - bool _drawBackground; - - //! true if (bottom) corners are square - bool _square; - - //! helper - Helper* _helper; - - //! dummy widget - QWidget _dummy; - - //! window pixmap - QPixmap _backgroundPixmap; - - //! tileSet - TileSet _tileSet; - - }; -} - -#endif diff --git a/clients/oxygen/demo/ui/oxygenshadowdemo.ui b/clients/oxygen/demo/ui/oxygenshadowdemo.ui deleted file mode 100644 index e8f16e774..000000000 --- a/clients/oxygen/demo/ui/oxygenshadowdemo.ui +++ /dev/null @@ -1,104 +0,0 @@ - - - OxygenShadowDemoDialog - - - - 0 - 0 - 535 - 466 - - - - Dialog - - - - - - Inactive Windows - - - Qt::AlignCenter - - - - - - - Active Windows - - - Qt::AlignCenter - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Ok - - - - - - - - - - - - - - - - - - - - Oxygen::ShadowDemoWidget - QWidget -
oxygenshadowdemowidget.h
- 1 -
-
- - - - buttonBox - accepted() - OxygenShadowDemoDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - OxygenShadowDemoDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - -
diff --git a/clients/oxygen/oxygenbutton.cpp b/clients/oxygen/oxygenbutton.cpp deleted file mode 100644 index f89c38782..000000000 --- a/clients/oxygen/oxygenbutton.cpp +++ /dev/null @@ -1,440 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// Button.cpp -// ------------------- -// -// Copyright (c) 2009 Hugo Pereira Da Costa -// Copyright (c) 2006, 2007 Riccardo Iaconelli -// Copyright (c) 2006, 2007 Casper Boemann -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -////////////////////////////////////////////////////////////////////////////// - -#include "oxygenbutton.h" -#include "oxygenbutton.moc" -#include "oxygenclient.h" - -#include - -#include -#include - -#include -#include -#include - -namespace Oxygen -{ - //_______________________________________________ - Button::Button( - Client &parent, - const QString& tip, - ButtonType type): - KCommonDecorationButton((::ButtonType)type, &parent), - _client(parent), - _helper( parent.helper() ), - _type(type), - _status( 0 ), - _forceInactive( false ), - _glowAnimation( new Animation( 150, this ) ), - _glowIntensity(0) - { - setAutoFillBackground(false); - setAttribute(Qt::WA_NoSystemBackground); - - int size( _client.buttonSize() ); - setFixedSize( size, size ); - - setCursor(Qt::ArrowCursor); - setToolTip(tip); - - // setup animation - _glowAnimation->setStartValue( 0 ); - _glowAnimation->setEndValue( 1.0 ); - _glowAnimation->setTargetObject( this ); - _glowAnimation->setPropertyName( "glowIntensity" ); - _glowAnimation->setEasingCurve( QEasingCurve::InOutQuad ); - - // setup connections - reset(0); - - - } - - //_______________________________________________ - Button::~Button() - {} - - //_______________________________________________ - QColor Button::buttonDetailColor(const QPalette &palette) const - { - if( _client.glowIsAnimated() && !_forceInactive && !_client.isForcedActive()) return KColorUtils::mix( - buttonDetailColor( palette, false ), - buttonDetailColor( palette, true ), - _client.glowIntensity() ); - else return buttonDetailColor( palette, isActive() || _client.isForcedActive() ); - } - - //___________________________________________________ - bool Button::isActive( void ) const - { return (!_forceInactive) && _client.isActive(); } - - //___________________________________________________ - bool Button::buttonAnimationsEnabled( void ) const - { return _client.animationsEnabled() && _client.configuration()->buttonAnimationsEnabled(); } - - //___________________________________________________ - QSize Button::sizeHint() const - { - unsigned int size( _client.buttonSize() ); - return QSize( size, size ); - } - - //___________________________________________________ - void Button::reset( unsigned long ) - { _glowAnimation->setDuration( _client.configuration()->buttonAnimationsDuration() ); } - - //___________________________________________________ - void Button::paint( QPainter& painter ) - { - - QPalette palette( _client.palette() ); - palette.setCurrentColorGroup( isActive() ? QPalette::Active : QPalette::Inactive); - - if( - _client.compositingActive() && - !( _client.isMaximized() || _type == ButtonItemClose || _type == ButtonItemMenu ) ) - { painter.translate( 0, -1 ); } - - // translate buttons down if window maximized - if( _client.isMaximized() ) painter.translate( 0, 1 ); - - // base button color - QColor base; - if( _type == ButtonItemClose && _forceInactive ) base = _client.backgroundPalette( this, palette ).window().color(); - else if( _type == ButtonItemClose ) base = palette.window().color(); - else base = palette.button().color(); - - // text color - QColor color = (_type == ButtonItemClose && _forceInactive ) ? - buttonDetailColor( _client.backgroundPalette( this, palette ) ): - buttonDetailColor( palette ); - - // decide decoration color - QColor glow; - if( isAnimated() || (_status&Hovered) ) - { - glow = isCloseButton() ? - _helper.viewNegativeTextBrush().brush(palette).color(): - _helper.viewHoverBrush().brush(palette).color(); - - if( isAnimated() ) - { - - color = KColorUtils::mix( color, glow, glowIntensity() ); - glow = _helper.alphaColor( glow, glowIntensity() ); - - } else if( _status&Hovered ) color = glow; - - } - - if( hasDecoration() ) - { - // scale - qreal scale( (21.0*_client.buttonSize())/22.0 ); - - // pressed state - const bool pressed( - (_status&Pressed) || - ( _type == ButtonSticky && _client.isOnAllDesktops() ) || - ( _type == ButtonAbove && _client.keepAbove() ) || - ( _type == ButtonBelow && _client.keepBelow() ) ); - - // draw button shape - painter.drawPixmap(0, 0, _helper.windecoButton( base, glow, pressed, scale ) ); - - } - - // Icon - // for menu button the application icon is used - if( isMenuButton() ) - { - - int iconScale( 0 ); - switch( _client.buttonSize() ) - { - case Configuration::ButtonSmall: iconScale = 13; break; - - default: - case Configuration::ButtonDefault: iconScale = 16; break; - case Configuration::ButtonLarge: iconScale = 20; break; - case Configuration::ButtonVeryLarge: iconScale = 24; break; - case Configuration::ButtonHuge: iconScale = 35; break; - } - - const QPixmap& pixmap( _client.icon().pixmap( iconScale ) ); - const double offset = 0.5*(width()-pixmap.width() ); - painter.drawPixmap(offset, offset-1, pixmap ); - - } else { - - painter.setRenderHints(QPainter::Antialiasing); - qreal width( 1.2 ); - - // contrast - painter.setBrush(Qt::NoBrush); - painter.setPen(QPen( _helper.calcLightColor( base ), width, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); - drawIcon(&painter); - - // main - painter.translate(0,-1.5); - painter.setBrush(Qt::NoBrush); - painter.setPen(QPen(color, width, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); - drawIcon(&painter); - - } - - } - - //___________________________________________________ - void Button::mousePressEvent( QMouseEvent *event ) - { - - if( _type == ButtonMax || event->button() == Qt::LeftButton ) - { - _status |= Pressed; - parentUpdate(); - } - - KCommonDecorationButton::mousePressEvent( event ); - } - - //___________________________________________________ - void Button::mouseReleaseEvent( QMouseEvent* event ) - { - if (_type != ButtonApplicationMenu) - { - _status &= ~Pressed; - parentUpdate(); - } - - KCommonDecorationButton::mouseReleaseEvent( event ); - } - - //___________________________________________________ - void Button::enterEvent( QEvent *event ) - { - - KCommonDecorationButton::enterEvent( event ); - _status |= Hovered; - - if( buttonAnimationsEnabled() ) - { - - _glowAnimation->setDirection( Animation::Forward ); - if( !isAnimated() ) _glowAnimation->start(); - - } else parentUpdate(); - - } - - //___________________________________________________ - void Button::leaveEvent( QEvent *event ) - { - - KCommonDecorationButton::leaveEvent( event ); - - if( _status&Hovered && buttonAnimationsEnabled() ) - { - _glowAnimation->setDirection( Animation::Backward ); - if( !isAnimated() ) _glowAnimation->start(); - } - - _status &= ~Hovered; - parentUpdate(); - - } - - //___________________________________________________ - void Button::resizeEvent( QResizeEvent *event ) - { - - // resize backing store pixmap - if( !_client.compositingActive() ) - { _pixmap = QPixmap( event->size() ); } - - // base class implementation - KCommonDecorationButton::resizeEvent( event ); - - } - - //___________________________________________________ - void Button::paintEvent(QPaintEvent *event) - { - - if( _client.hideTitleBar() ) return; - - /* - do nothing in compositing mode. - painting is performed by the parent widget - */ - if( !_client.compositingActive() ) - { - - { - - // create painter - QPainter painter( &_pixmap ); - painter.setRenderHints(QPainter::Antialiasing); - painter.setClipRect( this->rect().intersected( event->rect() ) ); - - // render parent background - painter.translate( -geometry().topLeft() ); - _client.paintBackground( painter ); - - // render buttons - painter.translate( geometry().topLeft() ); - paint( painter ); - - } - - QPainter painter(this); - painter.setClipRegion( event->region() ); - painter.drawPixmap( QPoint(), _pixmap ); - - } - - } - - //___________________________________________________ - void Button::parentUpdate( void ) - { - - if( _client.compositingActive() || _client.isPreview() ) _client.update( geometry().adjusted( -1, -1, 1, 1 ) ); - else if( parentWidget() ) parentWidget()->update( geometry().adjusted( -1, -1, 1, 1 ) ); - else this->update(); - - } - - //___________________________________________________ - void Button::drawIcon( QPainter* painter ) - { - - painter->save(); - painter->setWindow( 0, 0, 22, 22 ); - - switch(_type) - { - - case ButtonSticky: - painter->drawPoint(QPointF(10.5,10.5)); - break; - - case ButtonHelp: - painter->translate(1.5, 1.5); - painter->drawArc(7,5,4,4,135*16, -180*16); - painter->drawArc(9,8,4,4,135*16,45*16); - painter->drawPoint(9,12); - painter->translate(-1.5, -1.5); - break; - - case ButtonApplicationMenu: - painter->drawLine(QPointF(7.5, 7.5), QPointF(13.5, 7.5)); - painter->drawLine(QPointF(7.5, 10.5), QPointF(13.5, 10.5)); - painter->drawLine(QPointF(7.5, 13.5), QPointF(13.5, 13.5)); - break; - - case ButtonMin: - painter->drawLine(QPointF( 7.5, 9.5), QPointF(10.5,12.5)); - painter->drawLine(QPointF(10.5,12.5), QPointF(13.5, 9.5)); - break; - - case ButtonMax: - switch(_client.maximizeMode()) - { - case Client::MaximizeRestore: - case Client::MaximizeVertical: - case Client::MaximizeHorizontal: - painter->drawLine(QPointF( 7.5,11.5), QPointF(10.5, 8.5)); - painter->drawLine(QPointF(10.5, 8.5), QPointF(13.5,11.5)); - break; - - case Client::MaximizeFull: - { - painter->translate(1.5, 1.5); - QPoint points[4] = {QPoint(9, 6), QPoint(12, 9), QPoint(9, 12), QPoint(6, 9)}; - painter->drawPolygon(points, 4); - painter->translate(-1.5, -1.5); - break; - } - } - break; - - case ButtonItemClose: - case ButtonClose: - painter->drawLine(QPointF( 7.5,7.5), QPointF(13.5,13.5)); - painter->drawLine(QPointF(13.5,7.5), QPointF( 7.5,13.5)); - break; - - case ButtonAbove: - painter->drawLine(QPointF( 7.5,14), QPointF(10.5,11)); - painter->drawLine(QPointF(10.5,11), QPointF(13.5,14)); - painter->drawLine(QPointF( 7.5,10), QPointF(10.5, 7)); - painter->drawLine(QPointF(10.5, 7), QPointF(13.5,10)); - break; - - case ButtonBelow: - painter->drawLine(QPointF( 7.5,11), QPointF(10.5,14)); - painter->drawLine(QPointF(10.5,14), QPointF(13.5,11)); - painter->drawLine(QPointF( 7.5, 7), QPointF(10.5,10)); - painter->drawLine(QPointF(10.5,10), QPointF(13.5, 7)); - break; - - case ButtonShade: - if (!isChecked()) - { - - // shade button - painter->drawLine(QPointF( 7.5, 7.5), QPointF(10.5,10.5)); - painter->drawLine(QPointF(10.5,10.5), QPointF(13.5, 7.5)); - painter->drawLine(QPointF( 7.5,13.0), QPointF(13.5,13.0)); - - } else { - - // unshade button - painter->drawLine(QPointF( 7.5,10.5), QPointF(10.5, 7.5)); - painter->drawLine(QPointF(10.5, 7.5), QPointF(13.5,10.5)); - painter->drawLine(QPointF( 7.5,13.0), QPointF(13.5,13.0)); - - } - break; - - default: - break; - } - painter->restore(); - return; - } - - void Button::slotAppMenuHidden() - { - _status = Normal; - update(); - } - -} diff --git a/clients/oxygen/oxygenbutton.h b/clients/oxygen/oxygenbutton.h deleted file mode 100644 index a47ba934b..000000000 --- a/clients/oxygen/oxygenbutton.h +++ /dev/null @@ -1,206 +0,0 @@ -#ifndef oxygenbutton_h -#define oxygenbutton_h - -////////////////////////////////////////////////////////////////////////////// -// Button.h -// ------------------- -// -// Copyright (c) 2006, 2007 Riccardo Iaconelli -// Copyright (c) 2006, 2007 Casper Boemann -// Copyright (c) 2009 Hugo Pereira Da Costa -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -////////////////////////////////////////////////////////////////////////////// - -#include "oxygenanimation.h" -#include "oxygendecorationdefines.h" -#include "oxygendecohelper.h" - -#include - -namespace Oxygen -{ - class Client; - - Q_DECLARE_FLAGS(ButtonState, ButtonStatus) - - class Button : public KCommonDecorationButton - { - - Q_OBJECT - - //! declare animation progress property - Q_PROPERTY( qreal glowIntensity READ glowIntensity WRITE setGlowIntensity ) - - public: - - //! constructor - explicit Button(Client&, const QString& = QString(), ButtonType = ButtonHelp ); - - //! destructor - ~Button(); - - //! destructor - QSize sizeHint() const; - - //! button type - ButtonType type( void ) const - { return _type; } - - //! set force inactive - /*! returns true if value was actually changed */ - void setForceInactive( const bool& value ) - { _forceInactive = value; } - - //! configuration reset - virtual void reset( unsigned long ); - - //!@name glow animation - //@{ - void setGlowIntensity( qreal value ) - { - if( _glowIntensity == value ) return; - _glowIntensity = value; - parentUpdate(); - } - - qreal glowIntensity( void ) const - { return _glowIntensity; } - - //@} - - //! render buttn to provided painter - void paint(QPainter& ); - - protected: - - //! press event - void mousePressEvent( QMouseEvent* ); - - //! release event - void mouseReleaseEvent( QMouseEvent* ); - - //! enter event - void enterEvent( QEvent* ); - - //! leave event - void leaveEvent( QEvent* ); - - //! resize event - void resizeEvent( QResizeEvent* ); - - //! paint - void paintEvent( QPaintEvent* ); - - // parent update - void parentUpdate( void ); - - //! draw icon - void drawIcon( QPainter* ); - - //! color - QColor buttonDetailColor( const QPalette& ) const; - - //! color - QColor buttonDetailColor( const QPalette& palette, bool active ) const - { - if( _type == ButtonItemClose ) - { - - return active ? - palette.color(QPalette::Active, QPalette::WindowText ): - _helper.inactiveTitleBarTextColor( palette ); - - } else { - - return active ? - palette.color(QPalette::Active, QPalette::ButtonText ): - _helper.inactiveButtonTextColor( palette ); - - } - - } - - //! true if animation is in progress - bool isAnimated( void ) const - { return _glowAnimation->isRunning(); } - - //! true if button is active - bool isActive( void ) const; - - //! true if buttons hover are animated - bool buttonAnimationsEnabled( void ) const; - - //!@name button properties - //@{ - - //! true if button if of menu type - bool isMenuButton( void ) const - { return _type == ButtonMenu || _type == ButtonItemMenu; } - - //! true if button is of toggle type - bool isToggleButton( void ) const - { return _type == ButtonSticky || _type == ButtonAbove || _type == ButtonBelow; } - - //! true if button if of close type - bool isCloseButton( void ) const - { return _type == ButtonClose || _type == ButtonItemClose; } - - //! true if button has decoration - bool hasDecoration( void ) const - { return !isMenuButton() && _type != ButtonItemClose; } - - //@} - - private Q_SLOTS: - void slotAppMenuHidden(); - - private: - - //! parent client - Client &_client; - - //! helper - DecoHelper &_helper; - - //! backing store pixmap (when compositing is not active) - QPixmap _pixmap; - - //! button type - ButtonType _type; - - //! button status - unsigned int _status; - - //! true if button should be forced inactive - bool _forceInactive; - - //! glow animation - //Animation::Pointer _glowAnimation; - Animation* _glowAnimation; - - //! glow intensity - qreal _glowIntensity; - - - }; - -} //namespace Oxygen - -#endif diff --git a/clients/oxygen/oxygenclient.cpp b/clients/oxygen/oxygenclient.cpp deleted file mode 100644 index 3df134f8e..000000000 --- a/clients/oxygen/oxygenclient.cpp +++ /dev/null @@ -1,2034 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// oxygenclient.cpp -// ------------------- -// -// Copyright (c) 2009 Hugo Pereira Da Costa -// Copyright (c) 2006, 2007 Casper Boemann -// Copyright (c) 2006, 2007 Riccardo Iaconelli -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -////////////////////////////////////////////////////////////////////////////// - -#include "oxygenclient.h" -#include "oxygenclient.moc" - -#include "oxygenbutton.h" -#include "oxygensizegrip.h" - -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -namespace Oxygen -{ - - //___________________________________________ - Client::Client(KDecorationBridge *b, Factory *f): - KCommonDecoration(b, f), - _factory( f ), - _sizeGrip( nullptr ), - _glowAnimation( new Animation( 200, this ) ), - _titleAnimationData( new TitleAnimationData( this ) ), - _glowIntensity(0), - _initialized( false ), - _forceActive( false ), - _mouseButton( Qt::NoButton ), - _itemData( this ), - _sourceItem( -1 ), - _shadowAtom( 0 ) - { - connect(options(), &KDecorationOptions::compositingChanged, this, &Client::updateCompositing); - connect(options(), &KDecorationOptions::configChanged, this, &Client::updateConfig); - } - - //___________________________________________ - Client::~Client() - { - - // delete sizegrip if any - if( hasSizeGrip() ) deleteSizeGrip(); - - } - - //___________________________________________ - QString Client::visibleName() const - { return i18n("Oxygen"); } - - //___________________________________________ - void Client::init() - { - - // make sure valid configuration is set - if( !_configuration ) _configuration = _factory->configuration( *this ); - - KCommonDecoration::init(); - - widget()->setAttribute(Qt::WA_NoSystemBackground ); - widget()->setAutoFillBackground( false ); - widget()->setAcceptDrops( true ); - - // setup glow animation - _glowAnimation->setStartValue( glowBias() ); - _glowAnimation->setEndValue( 1.0 ); - _glowAnimation->setTargetObject( this ); - _glowAnimation->setPropertyName( "glowIntensity" ); - _glowAnimation->setEasingCurve( QEasingCurve::InOutQuad ); - connect( _glowAnimation, SIGNAL(finished()), this, SLOT(clearForceActive()) ); - - // title animation data - _titleAnimationData->initialize(); - connect( _titleAnimationData, SIGNAL(pixmapsChanged()), SLOT(updateTitleRect()) ); - - // lists - connect( _itemData.animation().data(), SIGNAL(finished()), this, SLOT(clearTargetItem()) ); - - // in case of preview, one wants to make the label used - // for the central widget transparent. This allows one to have - // the correct background (with gradient) rendered - // Remark: this is minor (and safe) a hack. - // This should be moved upstream (into kwin/lib/kdecoration) - if( isPreview() ) - { - - QList children( widget()->findChildren() ); - foreach( QLabel* widget, children ) - { widget->setAutoFillBackground( false ); } - - // also change shadow configuration size to something that fits in the preview list - shadowCache().setShadowSize( QPalette::Active, 15 ); - shadowCache().setShadowSize( QPalette::Inactive, 15 ); - - } - - setAlphaEnabled(!isMaximized()); - - _initialized = true; - - // first reset is needed to store Oxygen configuration - updateConfig(); - - } - - //___________________________________________ - void Client::updateCompositing() - { - // update window mask when compositing is changed - if( !_initialized ) return; - updateWindowShape(); - widget()->update(); - updateConfig(); - } - - //___________________________________________ - void Client::updateConfig() - { - if( !_initialized ) return; - - _configuration = _factory->configuration( *this ); - - // glow animations - _glowAnimation->setDuration( _configuration->shadowAnimationsDuration() ); - - // title transitions - _titleAnimationData->setDuration( _configuration->titleAnimationsDuration() ); - - // tabs - _itemData.setAnimationsEnabled( animationsEnabled() && _configuration->tabAnimationsEnabled() ); - _itemData.animation().data()->setDuration( _configuration->tabAnimationsDuration() ); - - // reset title transitions - _titleAnimationData->reset(); - - // should also update animations for buttons - resetButtons(); - - // also reset tab buttons - for( int index = 0; index < _itemData.count(); index++ ) - { - ClientGroupItemData& item( _itemData[index] ); - if( item._closeButton ) { item._closeButton.data()->reset(0); } - } - - // reset tab geometry - _itemData.setDirty( true ); - - // handle size grip - if( _configuration->drawSizeGrip() && _configuration->frameBorder() == Configuration::BorderNone ) - { - - if( !hasSizeGrip() ) createSizeGrip(); - - } else if( hasSizeGrip() ) deleteSizeGrip(); - - // needs to remove shadow property on window since shadows are handled by the decoration - removeShadowHint(); - - } - - //___________________________________________ - bool Client::decorationBehaviour(DecorationBehaviour behaviour) const - { - switch (behaviour) - { - - case DB_MenuClose: - return _configuration->closeWindowFromMenuButton(); - - case DB_WindowMask: - return false; - - default: - return KCommonDecoration::decorationBehaviour(behaviour); - } - } - - //_________________________________________________________ - KCommonDecorationButton *Client::createButton(::ButtonType type) - { - - switch (type) { - - case MenuButton: - return new Button(*this, i18n("Window Actions Menu"), ButtonMenu); - - case AppMenuButton: - return new Button(*this, i18n("Application Menu"), ButtonApplicationMenu); - - case HelpButton: - return new Button(*this, i18n("Help"), ButtonHelp); - - case MinButton: - return new Button(*this, i18n("Minimize"), ButtonMin); - - case MaxButton: - return new Button(*this, i18n("Maximize"), ButtonMax); - - case CloseButton: - return new Button(*this, i18n("Close"), ButtonClose); - - case AboveButton: - return new Button(*this, i18n("Keep Above Others"), ButtonAbove); - - case BelowButton: - return new Button(*this, i18n("Keep Below Others"), ButtonBelow); - - case OnAllDesktopsButton: - return new Button(*this, i18n("On All Desktops"), ButtonSticky); - - case ShadeButton: - return new Button(*this, i18n("Shade Button"), ButtonShade); - - default: break; - - } - - return nullptr; - - } - - //_________________________________________________________ - QRegion Client::calcMask( void ) const - { - - if( isMaximized() ) { return widget()->rect(); } - const QRect frame( widget()->rect().adjusted( - layoutMetric( LM_OuterPaddingLeft ), layoutMetric( LM_OuterPaddingTop ), - -layoutMetric( LM_OuterPaddingRight ), -layoutMetric( LM_OuterPaddingBottom ) ) ); - - QRegion mask; - if( _configuration->frameBorder() == Configuration::BorderNone && !isShade() ) - { - - if( hideTitleBar() ) mask = QRegion(); - else if( compositingActive() ) mask = QRegion(); - else mask = helper().roundedMask( frame, 1, 1, 1, 0 ); - - } else { - - if( compositingActive() ) mask = QRegion(); - else mask = helper().roundedMask( frame ); - - } - - return mask; - - } - - //___________________________________________ - int Client::layoutMetric(LayoutMetric lm, bool respectWindowState, const KCommonDecorationButton *btn) const - { - - const bool maximized( isMaximized() ); - const bool shaded( isShade() ); - const bool narrowSpacing( _configuration->useNarrowButtonSpacing() ); - const int frameBorder( this->frameBorder() ); - const int buttonSize( hideTitleBar() ? 0 : this->buttonSize() ); - - switch (lm) - { - case LM_BorderLeft: - case LM_BorderRight: - { - int border( frameBorder ); - if( respectWindowState && maximized ) - { - - border = 0; - - } else if( _configuration->frameBorder() < Configuration::BorderTiny ) { - - border = 0; - - } else if( !compositingActive() && _configuration->frameBorder() == Configuration::BorderTiny ) { - - border = qMax( frameBorder, 3 ); - - } - - return border; - } - - case LM_BorderBottom: - { - int border( frameBorder ); - if( (respectWindowState && maximized) || shaded ) - { - - border = 0; - - } else if( _configuration->frameBorder() >= Configuration::BorderNoSide ) { - - // for tiny border, the convention is to have a larger bottom area in order to - // make resizing easier - border = qMax(frameBorder, 4); - - } else if( _configuration->frameBorder() < Configuration::BorderTiny ) { - - border = 0; - - } else if( !compositingActive() && _configuration->frameBorder() == Configuration::BorderTiny ) { - - border = qMax( frameBorder, 3 ); - - } - - return border; - } - - case LM_TitleEdgeTop: - { - int border = 0; - if( _configuration->frameBorder() == Configuration::BorderNone && hideTitleBar() ) - { - - border = 0; - - } else if( !( respectWindowState && maximized )) { - - border = TFRAMESIZE; - - } - - return border; - - } - - case LM_TitleEdgeBottom: - { - return 0; - } - - case LM_TitleEdgeLeft: - case LM_TitleEdgeRight: - { - int border = 0; - if( !(respectWindowState && maximized) ) - { border = 4; } - - return border; - - } - - case LM_TitleBorderLeft: - case LM_TitleBorderRight: - { - int border = 5; - - // if title outline is to be drawn, one adds the space needed to - // separate title and tab border. namely the same value - if( _configuration->drawTitleOutline() ) border += border; - - return border; - } - - case LM_ButtonWidth: - case LM_ButtonHeight: - case LM_TitleHeight: - { - return buttonSize; - } - - case LM_ButtonSpacing: - return narrowSpacing ? 1:3; - - case LM_ButtonMarginTop: - return 0; - - // outer margin for shadow/glow - case LM_OuterPaddingLeft: - case LM_OuterPaddingRight: - case LM_OuterPaddingTop: - case LM_OuterPaddingBottom: - if( maximized ) return 0; - else return shadowCache().shadowSize(); - - default: - return KCommonDecoration::layoutMetric(lm, respectWindowState, btn); - } - - } - - //_________________________________________________________ - QRect Client::defaultTitleRect( bool active ) const - { - - QRect titleRect( this->titleRect().adjusted( 0, -layoutMetric( LM_TitleEdgeTop ), 0, 0 ) ); - - // when drawing title outline, shrink the rect so that it matches the actual caption size - if( active && _configuration->drawTitleOutline() && isActive() ) - { - - - if( _configuration->titleAlignment() == Configuration::AlignCenterFullWidth ) - { - titleRect.setLeft( widget()->rect().left() + layoutMetric( LM_OuterPaddingLeft ) ); - titleRect.setRight( widget()->rect().right() - layoutMetric( LM_OuterPaddingRight ) ); - } - - const QRect textRect( titleBoundingRect( options()->font( true, false), titleRect, caption() ) ); - titleRect.setLeft( textRect.left() - layoutMetric( LM_TitleBorderLeft ) ); - titleRect.setRight( textRect.right() + layoutMetric( LM_TitleBorderRight ) ); - - } else { - - // buttons are properly accounted for in titleBoundingRect method - titleRect.setLeft( widget()->rect().left() + layoutMetric( LM_OuterPaddingLeft ) ); - titleRect.setRight( widget()->rect().right() - layoutMetric( LM_OuterPaddingRight ) ); - - } - - return titleRect; - - } - - //_________________________________________________________ - QRect Client::titleBoundingRect( const QFont& font, QRect rect, const QString& caption ) const - { - - // get title bounding rect - QRect boundingRect( QFontMetrics( font ).boundingRect( rect, titleAlignment() | Qt::AlignVCenter, caption ) ); - - // adjust to make sure bounding rect - // 1/ has same vertical alignment as original titleRect - // 2/ does not exceeds available horizontal space - boundingRect.setTop( rect.top() ); - boundingRect.setBottom( rect.bottom() ); - - // check bounding rect against input rect - boundRectTo( boundingRect, rect ); - - if( _configuration->titleAlignment() == Configuration::AlignCenterFullWidth ) - { - - /* - check bounding rect against max available space, for buttons - this is not needed if centerTitleOnFullWidth flag is set to false, - because it was already done before calling titleBoundingRect - */ - boundRectTo( boundingRect, titleRect() ); - - } - - return boundingRect; - - } - - //_________________________________________________________ - void Client::boundRectTo( QRect& rect, const QRect& bound ) const - { - - if( bound.left() > rect.left() ) - { - rect.moveLeft( bound.left() ); - if( bound.right() < rect.right() ) - { rect.setRight( bound.right() ); } - - } else if( bound.right() < rect.right() ) { - - rect.moveRight( bound.right() ); - if( bound.left() > rect.left() ) - { rect.setLeft( bound.left() ); } - - } - - return; - } - - //_________________________________________________________ - void Client::clearTargetItem( void ) - { - - if( _itemData.animationType() == AnimationLeave ) - { _itemData.setDirty( true ); } - - } - - //_________________________________________________________ - void Client::updateItemBoundingRects( bool alsoUpdate ) - { - - // make sure items are not animated - _itemData.animate( AnimationNone ); - - // maximum available space - const QRect titleRect( this->titleRect() ); - - // get tabs - const int items( tabCount() ); - - // make sure item data have the correct number of items - while( _itemData.count() < items ) _itemData.push_back( ClientGroupItemData() ); - while( _itemData.count() > items ) - { - if( _itemData.back()._closeButton ) delete _itemData.back()._closeButton.data(); - _itemData.pop_back(); - } - - assert( !_itemData.isEmpty() ); - - // create buttons - if( _itemData.count() == 1 ) - { - - // remove button - if( _itemData.front()._closeButton ) - { delete _itemData.front()._closeButton.data(); } - - // set active rect - _itemData.front()._activeRect = titleRect.adjusted( 0, -layoutMetric( LM_TitleEdgeTop ), 0, 0 ); - - } else { - - int left( titleRect.left() ); - const int width( titleRect.width()/items ); - for( int index = 0; index < _itemData.count(); index++ ) - { - - ClientGroupItemData& item(_itemData[index]); - - // make sure button exists - if( !item._closeButton ) - { - item._closeButton = ClientGroupItemData::ButtonPointer( new Button( *this, QStringLiteral("Close this tab"), ButtonItemClose ) ); - item._closeButton.data()->show(); - item._closeButton.data()->installEventFilter( this ); - } - - // set active rect - QRect local( QPoint( left, titleRect.top() ), QSize( width, titleRect.height() ) ); - local.adjust( 0, -layoutMetric( LM_TitleEdgeTop ), 0, 0 ); - item._activeRect = local; - left += width; - - } - - } - - if( _itemData.count() == 1 ) - { - - _itemData.front().reset( defaultTitleRect() ); - - } else { - - for( int index = 0; index < _itemData.count(); index++ ) - { _itemData[index].reset( _itemData[index]._activeRect ); } - - } - - // button activity - _itemData.updateButtonActivity( currentTabId() ); - - // reset buttons location - _itemData.updateButtons( alsoUpdate ); - _itemData.setDirty( false ); - - return; - - } - - //_________________________________________________________ - QColor Client::titlebarTextColor(const QPalette &palette) const - { - if( glowIsAnimated() ) return KColorUtils::mix( - titlebarTextColor( palette, false ), - titlebarTextColor( palette, true ), - glowIntensity() ); - else return titlebarTextColor( palette, isActive() ); - } - - //_________________________________________________________ - void Client::renderWindowBackground( QPainter* painter, const QRect& rect, const QWidget* widget, const QPalette& palette ) const - { - - // window background - if( helper().hasBackgroundGradient( windowId() ) ) - { - - int offset = layoutMetric( LM_OuterPaddingTop ); - - // radial gradient positionning - const int height = hideTitleBar() ? 0:buttonSize(); - if( isMaximized() ) offset -= 3; - - const QWidget* window( isPreview() ? this->widget() : widget->window() ); - helper().renderWindowBackground(painter, rect, widget, window, palette, offset, height ); - - } else { - - painter->fillRect( rect, palette.color( QPalette::Window ) ); - - } - - // background pixmap - if( isPreview() || helper().hasBackgroundPixmap( windowId() ) ) - { - int offset = layoutMetric( LM_OuterPaddingTop ); - - // radial gradient positionning - const int height = hideTitleBar() ? 0:buttonSize(); - if( isMaximized() ) offset -= 3; - - // background pixmap - QPoint backgroundPixmapOffset( layoutMetric( LM_OuterPaddingLeft ) + layoutMetric( LM_BorderLeft ), 0 ); - helper().setBackgroundPixmapOffset( backgroundPixmapOffset ); - - const QWidget* window( isPreview() ? this->widget() : widget->window() ); - helper().renderBackgroundPixmap(painter, rect, widget, window, offset, height ); - - } - - } - - //_________________________________________________________ - void Client::renderWindowBorder( QPainter* painter, const QRect& clipRect, const QWidget* widget, const QPalette& palette ) const - { - - // get coordinates relative to the client area - // this is annoying. One could use mapTo if this was taking const QWidget* and not - // const QWidget* as argument. - const QWidget* window = (isPreview()) ? this->widget() : widget->window(); - const QWidget* w = widget; - QPoint position( 0, 0 ); - while ( w != window && !w->isWindow() && w != w->parentWidget() ) - { - position += w->geometry().topLeft(); - w = w->parentWidget(); - } - - // save painter - if( clipRect.isValid() ) - { - painter->save(); - painter->setClipRegion(clipRect,Qt::IntersectClip); - } - - QRect r = (isPreview()) ? this->widget()->rect():window->rect(); - r.adjust( layoutMetric( LM_OuterPaddingLeft ), layoutMetric( LM_OuterPaddingTop ), -layoutMetric( LM_OuterPaddingRight ), -layoutMetric( LM_OuterPaddingBottom ) ); - r.adjust(0,0, 1, 1); - - // base color - QColor color( palette.window().color() ); - - // add alpha channel - if( _itemData.count() == 1 && glowIsAnimated() ) - { color = helper().alphaColor( color, glowIntensity() ); } - - // title height - const int titleHeight( layoutMetric( LM_TitleEdgeTop ) + layoutMetric( LM_TitleEdgeBottom ) + layoutMetric( LM_TitleHeight ) ); - - // make titlebar background darker for tabbed, non-outline window - if( ( tabCount() >= 2 || _itemData.isAnimated() ) && !(_configuration->drawTitleOutline() && isActive() ) ) - { - - const QPoint topLeft( r.topLeft()-position ); - const QRect rect( topLeft, QSize( r.width(), titleHeight ) ); - - QLinearGradient lg( rect.topLeft(), rect.bottomLeft() ); - lg.setColorAt( 0, helper().alphaColor( Qt::black, 0.05 ) ); - lg.setColorAt( 1, helper().alphaColor( Qt::black, 0.10 ) ); - painter->setBrush( lg ); - painter->setPen( Qt::NoPen ); - painter->drawRect( rect ); - - } - - // horizontal line - { - const int shadowSize = 7; - const int height = shadowSize-3; - - const QPoint topLeft( r.topLeft()+QPoint(0,titleHeight-height)-position ); - QRect rect( topLeft, QSize( r.width(), height ) ); - - // adjustements to cope with shadow size and outline border. - rect.adjust( -shadowSize, 0, shadowSize-1, 0 ); - if( _configuration->drawTitleOutline() && ( isActive() || glowIsAnimated() ) && !isMaximized() ) - { - if( _configuration->frameBorder() == Configuration::BorderTiny ) rect.adjust( 1, 0, -1, 0 ); - else if( _configuration->frameBorder() > Configuration::BorderTiny ) rect.adjust( HFRAMESIZE-1, 0, -HFRAMESIZE+1, 0 ); - } - - if( rect.isValid() ) - { helper().slab( color, 0, shadowSize )->render( rect, painter, TileSet::Top ); } - - } - - if( _configuration->drawTitleOutline() && ( isActive() || glowIsAnimated() ) ) - { - - // save old hints and turn off anti-aliasing - const QPainter::RenderHints hints( painter->renderHints() ); - painter->setRenderHint( QPainter::Antialiasing, false ); - - // save mask and frame to where - // grey window background is to be rendered - QRegion mask; - QRect frame; - - // bottom line - const int leftOffset = qMin( layoutMetric( LM_BorderLeft ), int(HFRAMESIZE) ); - const int rightOffset = qMin( layoutMetric( LM_BorderRight ), int(HFRAMESIZE) ); - if( _configuration->frameBorder() > Configuration::BorderNone ) - { - - const int height = qMax( 0, layoutMetric( LM_BorderBottom ) - HFRAMESIZE ); - const int width = r.width() - leftOffset - rightOffset - 1; - - const QRect rect( r.bottomLeft()-position + QPoint( leftOffset, -layoutMetric( LM_BorderBottom ) ), QSize( width, height ) ); - if( height > 0 ) { mask += rect; frame |= rect; } - - const QColor shadow( helper().calcDarkColor( color ) ); - painter->setPen( shadow ); - painter->drawLine( rect.bottomLeft()+QPoint(-1,1), rect.bottomRight()+QPoint(1,1) ); - - } - - // left and right - const int topOffset = titleHeight; - const int bottomOffset = qMin( layoutMetric( LM_BorderBottom ), int(HFRAMESIZE) ); - const int height = r.height() - topOffset - bottomOffset - 1; - - if( _configuration->frameBorder() >= Configuration::BorderTiny ) - { - - const QColor shadow( helper().calcLightColor( color ) ); - painter->setPen( shadow ); - - // left - int width = qMax( 0, layoutMetric( LM_BorderLeft ) - HFRAMESIZE ); - QRect rect( r.topLeft()-position + QPoint( layoutMetric( LM_BorderLeft ) - width, topOffset ), QSize( width, height ) ); - if( width > 0 ) { mask += rect; frame |= rect; } - - painter->drawLine( rect.topLeft()-QPoint(1,0), rect.bottomLeft()-QPoint(1, 0) ); - - // right - width = qMax( 0, layoutMetric( LM_BorderRight ) - HFRAMESIZE ); - rect = QRect(r.topRight()-position + QPoint( -layoutMetric( LM_BorderRight ), topOffset ), QSize( width, height )); - if( width > 0 ) { mask += rect; frame |= rect; } - - painter->drawLine( rect.topRight()+QPoint(1,0), rect.bottomRight()+QPoint(1, 0) ); - } - - // restore old hints - painter->setRenderHints( hints ); - - // in preview mode also adds center square - if( isPreview() ) - { - const QRect rect( r.topLeft()-position + QPoint( layoutMetric( LM_BorderLeft ), topOffset ), QSize(r.width()-layoutMetric( LM_BorderLeft )-layoutMetric( LM_BorderRight ),height) ); - mask += rect; frame |= rect; - } - - // paint - if( !mask.isEmpty() ) - { - painter->setClipRegion( mask, Qt::IntersectClip); - renderWindowBackground(painter, frame, widget, palette ); - } - - } - - // restore painter - if( clipRect.isValid() ) - { painter->restore(); } - - } - - //_________________________________________________________ - void Client::renderSeparator( QPainter* painter, const QRect& clipRect, const QWidget* widget, const QColor& color ) const - { - - const QWidget* window = (isPreview()) ? this->widget() : widget->window(); - - // get coordinates relative to the client area - // this is annoying. One could use mapTo if this was taking const QWidget* and not - // const QWidget* as argument. - QPoint position( 0, 0 ); - { - const QWidget* w = widget; - while ( w != window && !w->isWindow() && w != w->parentWidget() ) { - position += w->geometry().topLeft(); - w = w->parentWidget(); - } - } - - // setup painter - if (clipRect.isValid()) - { - painter->save(); - painter->setClipRegion(clipRect,Qt::IntersectClip); - } - - QRect r = (isPreview()) ? this->widget()->rect():window->rect(); - r.adjust( layoutMetric( LM_OuterPaddingLeft ), layoutMetric( LM_OuterPaddingTop ), -layoutMetric( LM_OuterPaddingRight ), -layoutMetric( LM_OuterPaddingBottom ) ); - - // dimensions - const int titleHeight = layoutMetric(LM_TitleHeight); - const int titleTop = layoutMetric(LM_TitleEdgeTop) + r.top(); - - // set color - QColor local( color ); - if( glowIsAnimated() && _configuration->separatorMode() != Configuration::SeparatorAlways ) - { local = helper().alphaColor( color, glowIntensity() ); } - - // render - helper().drawSeparator( painter, QRect(r.top(), titleTop+titleHeight-1.5, r.width(), 2).translated( -position ), local, Qt::Horizontal); - - if (clipRect.isValid()) { painter->restore(); } - - } - - //_________________________________________________________ - void Client::renderTitleOutline( QPainter* painter, const QRect& rect, const QPalette& palette ) const - { - - // center (for active windows only) - { - painter->save(); - QRect adjustedRect( rect.adjusted( 1, 1, -1, 1 ) ); - - // prepare painter mask - QRegion mask( adjustedRect.adjusted( 1, 0, -1, 0 ) ); - mask += adjustedRect.adjusted( 0, 1, 0, 0 ); - painter->setClipRegion( mask, Qt::IntersectClip ); - - // draw window background - renderWindowBackground(painter, adjustedRect, widget(), palette ); - painter->restore(); - } - - // shadow - const int shadowSize( 7 ); - const int offset( -3 ); - const int voffset( 5-shadowSize ); - const QRect adjustedRect( rect.adjusted(offset, voffset, -offset, shadowSize) ); - QColor color( palette.color( widget()->backgroundRole() ) ); - - // add alpha channel - if( _itemData.count() == 1 && glowIsAnimated() ) - { color = helper().alphaColor( color, glowIntensity() ); } - - // render slab - helper().slab( color, 0, shadowSize )->render( adjustedRect, painter, TileSet::Tiles(TileSet::Top|TileSet::Left|TileSet::Right) ); - - } - - //_________________________________________________________ - void Client::renderTitleText( QPainter* painter, const QRect& rect, const QColor& color, const QColor& contrast ) const - { - - if( !_titleAnimationData->isValid() ) - { - // contrast pixmap - _titleAnimationData->reset( - rect, - renderTitleText( rect, caption(), color ), - renderTitleText( rect, caption(), contrast ) ); - } - - if( _titleAnimationData->isDirty() ) - { - - // clear dirty flags - _titleAnimationData->setDirty( false ); - - // finish current animation if running - if( _titleAnimationData->isAnimated() ) - { _titleAnimationData->finishAnimation(); } - - if( !_titleAnimationData->isLocked() ) - { - - // set pixmaps - _titleAnimationData->setPixmaps( - rect, - renderTitleText( rect, caption(), color ), - renderTitleText( rect, caption(), contrast ) ); - - _titleAnimationData->startAnimation(); - renderTitleText( painter, rect, color, contrast ); - - } else if( !caption().isEmpty() ) { - - renderTitleText( painter, rect, caption(), color, contrast ); - - } - - // lock animations (this must be done whether or not - // animation was actually started, in order to extend locking - // every time title get changed too rapidly - _titleAnimationData->lockAnimations(); - - } else if( _titleAnimationData->isAnimated() ) { - - if( isMaximized() ) painter->translate( 0, 2 ); - if( !_titleAnimationData->contrastPixmap().isNull() ) - { - painter->translate( 0, 1 ); - painter->drawPixmap( rect.topLeft(), _titleAnimationData->contrastPixmap() ); - painter->translate( 0, -1 ); - } - - painter->drawPixmap( rect.topLeft(), _titleAnimationData->pixmap() ); - - if( isMaximized() ) painter->translate( 0, -2 ); - - } else if( !caption().isEmpty() ) { - renderTitleText( painter, rect, caption(), color, contrast ); - - } - - } - - //_______________________________________________________________________ - void Client::renderTitleText( QPainter* painter, const QRect& rect, const QString& caption, const QColor& color, const QColor& contrast, bool elide ) const - { - - const Qt::Alignment alignment( titleAlignment() | Qt::AlignVCenter ); - const QString local( elide ? QFontMetrics( painter->font() ).elidedText( caption, Qt::ElideRight, rect.width() ):caption ); - - // translate title down in case of maximized window - if( isMaximized() ) painter->translate( 0, 2 ); - - if( contrast.isValid() ) - { - painter->setPen( contrast ); - painter->translate( 0, 1 ); - painter->drawText( rect, alignment, local ); - painter->translate( 0, -1 ); - } - - painter->setPen( color ); - painter->drawText( rect, alignment, local ); - - // translate back - if( isMaximized() ) painter->translate( 0, -2 ); - - } - - //_______________________________________________________________________ - QPixmap Client::renderTitleText( const QRect& rect, const QString& caption, const QColor& color, bool elide ) const - { - - if( !rect.isValid() ) return QPixmap(); - - QPixmap out( rect.size() ); - out.fill( Qt::transparent ); - if( caption.isEmpty() || !color.isValid() ) return out; - - QPainter painter( &out ); - painter.setFont( options()->font(isActive(), false) ); - const Qt::Alignment alignment( titleAlignment() | Qt::AlignVCenter ); - const QString local( elide ? QFontMetrics( painter.font() ).elidedText( caption, Qt::ElideRight, rect.width() ):caption ); - - painter.setPen( color ); - painter.drawText( out.rect(), alignment, local ); - painter.end(); - return out; - - } - - //_______________________________________________________________________ - void Client::renderItem( QPainter* painter, int index, const QPalette& palette ) - { - - const ClientGroupItemData& item( _itemData[index] ); - - // see if tag is active - const int itemCount( _itemData.count() ); - - // check item bounding rect - if( !item._boundingRect.isValid() ) return; - - // create rect in which text is to be drawn - QRect textRect( item._boundingRect.adjusted( 0, layoutMetric( LM_TitleEdgeTop )-1, 0, -1 ) ); - - // add extra space needed for title outline - if( itemCount > 1 || _itemData.isAnimated() ) - { textRect.adjust( layoutMetric( LM_TitleBorderLeft ), 0, -layoutMetric(LM_TitleBorderRight), 0 ); } - - // add extra space for the button - if( itemCount > 1 && item._closeButton && item._closeButton.data()->isVisible() ) - { textRect.adjust( 0, 0, - buttonSize() - layoutMetric(LM_TitleEdgeRight), 0 ); } - - // check if current item is active - const bool active( tabId(index) == currentTabId() ); - - // get current item caption and update text rect - const QString caption( itemCount == 1 ? this->caption() : this->caption(index) ); - - if( _configuration->titleAlignment() != Configuration::AlignCenterFullWidth ) - { boundRectTo( textRect, titleRect() ); } - - // adjust textRect - textRect = titleBoundingRect( painter->font(), textRect, caption ); - - // title outline - if( itemCount == 1 ) - { - - // no title outline if the window caption is empty - if( !caption.trimmed().isEmpty() ) - { - if( _itemData.isAnimated() ) { - - renderTitleOutline( painter, item._boundingRect, palette ); - - } else if( (isActive()||glowIsAnimated()) && _configuration->drawTitleOutline() ) { - - // adjusts boundingRect accordingly - QRect boundingRect( item._boundingRect ); - boundingRect.setLeft( textRect.left() - layoutMetric( LM_TitleBorderLeft ) ); - boundingRect.setRight( textRect.right() + layoutMetric( LM_TitleBorderRight ) ); - - // render bounding rect around it with extra margins - renderTitleOutline( painter, boundingRect, palette ); - - } - - } - - } else if( active ) { - - // in multiple tabs render title outline in all cases - renderTitleOutline( painter, item._boundingRect, palette ); - - } - - // render text - if( active || itemCount == 1 ) - { - - // for active tab, current caption is "merged" with old caption, if any - renderTitleText( - painter, textRect, - titlebarTextColor( palette ), - titlebarContrastColor( palette ) ); - - - } else { - - QColor background( backgroundPalette( widget(), palette ).color( widget()->window()->backgroundRole() ) ); - - // add extra shade (as used in renderWindowBorder - if( !( isActive() && _configuration->drawTitleOutline() ) ) - { background = KColorUtils::mix( background, Qt::black, 0.10 ); } - - // otherwise current caption is rendered directly - renderTitleText( - painter, textRect, caption, - titlebarTextColor( backgroundPalette( widget(), palette ), false ), - titlebarContrastColor( background ) ); - - } - - // render separators between inactive tabs - if( !( active || itemCount == 1 ) && item._closeButton && item._closeButton.data()->isVisible() ) - { - - // separators - // draw Left separator - const QColor color( backgroundPalette( widget(), palette ).window().color() ); - const bool isFirstItem( index == 0 || (index == 1 && !_itemData[0]._boundingRect.isValid() ) ); - if( !active && ( ( isFirstItem && buttonsLeftWidth() > 0 ) || _itemData.isTarget( index ) ) ) - { - - const QRect local( item._boundingRect.topLeft()+QPoint(0,2), QSize( 2, item._boundingRect.height()-3 ) ); - helper().drawSeparator( painter, local, color, Qt::Vertical); - - } - - // draw right separator - if( - ( index == itemCount-1 && buttonsRightWidth() > 0 ) || - ( index+1 < itemCount && ( _itemData.isTarget( index+1 ) || - !( tabId(index+1) == currentTabId() && _itemData[index+1]._boundingRect.isValid() ) ) ) ) - { - - const QRect local( item._boundingRect.topRight()+QPoint(0,2), QSize( 2, item._boundingRect.height()-3 ) ); - helper().drawSeparator( painter, local, color, Qt::Vertical); - - } - - } - - } - - //_______________________________________________________________________ - void Client::renderTargetRect( QPainter* p, const QPalette& palette ) - { - if( _itemData.targetRect().isNull() || _itemData.isAnimationRunning() ) return; - - const QColor color = palette.color(QPalette::Highlight); - p->setPen(KColorUtils::mix(color, palette.color(QPalette::Active, QPalette::WindowText))); - p->setBrush( helper().alphaColor( color, 0.5 ) ); - p->drawRect( QRectF(_itemData.targetRect()).adjusted( 4.5, 2.5, -4.5, -2.5 ) ); - - } - - //_______________________________________________________________________ - void Client::renderCorners( QPainter* painter, const QRect& frame, const QPalette& palette ) const - { - - const QColor color( backgroundColor( widget(), palette ) ); - - QLinearGradient lg = QLinearGradient(0, -0.5, 0, qreal( frame.height() )+0.5); - lg.setColorAt(0.0, helper().calcLightColor( helper().backgroundTopColor(color) )); - lg.setColorAt(0.51, helper().backgroundBottomColor(color) ); - lg.setColorAt(1.0, helper().backgroundBottomColor(color) ); - - painter->setPen( QPen( lg, 1 ) ); - painter->setBrush( Qt::NoBrush ); - painter->drawRoundedRect( QRectF( frame ).adjusted( 0.5, 0.5, -0.5, -0.5 ), 3.5, 3.5 ); - - } - - //_______________________________________________________________________ - void Client::renderFloatFrame( QPainter* painter, const QRect& frame, const QPalette& palette ) const - { - - // shadow and resize handles - if( !isMaximized() ) - { - - if( _configuration->frameBorder() >= Configuration::BorderTiny ) - { - - helper().drawFloatFrame( - painter, frame, backgroundColor( widget(), palette ), - !compositingActive(), isActive() && shadowCache().isEnabled( QPalette::Active ), - KDecoration::options()->color(ColorTitleBar) - ); - - } else { - - // for small borders, use a frame that matches the titlebar only - const QRect local( frame.topLeft(), QSize( frame.width(), layoutMetric(LM_TitleHeight) + layoutMetric(LM_TitleEdgeTop) ) ); - helper().drawFloatFrame( - painter, local, backgroundColor( widget(), palette ), - false, isActive() && shadowCache().isEnabled( QPalette::Active ), - KDecoration::options()->color(ColorTitleBar) - ); - } - - } else if( isShade() ) { - - // for shaded maximized windows adjust frame and draw the bottom part of it - helper().drawFloatFrame( - painter, frame, backgroundColor( widget(), palette ), - !( compositingActive() || _configuration->frameBorder() == Configuration::BorderNone ), isActive(), - KDecoration::options()->color(ColorTitleBar), - TileSet::Bottom - ); - - } - - } - - //____________________________________________________________________________ - void Client::renderDots( QPainter* painter, const QRect& frame, const QColor& color ) const - { - - if( _configuration->frameBorder() >= Configuration::BorderTiny ) - { - - // dimensions - int x,y,w,h; - frame.getRect(&x, &y, &w, &h); - - if( isResizable() && !isShade() && !isMaximized() ) - { - - // Draw right side 3-dots resize handles - const int cenY = (h / 2 + y) ; - const int posX = (w + x - 3); - - helper().renderDot( painter, QPoint(posX, cenY - 3), color); - helper().renderDot( painter, QPoint(posX, cenY), color); - helper().renderDot( painter, QPoint(posX, cenY + 3), color); - - } - - // Draw bottom-right cornet 3-dots resize handles - if( isResizable() && !isShade() && !_configuration->drawSizeGrip() ) - { - - painter->save(); - painter->translate(x + w-9, y + h-9); - helper().renderDot( painter, QPoint(2, 6), color); - helper().renderDot( painter, QPoint(5, 5), color); - helper().renderDot( painter, QPoint(6, 2), color); - painter->restore(); - } - - } - - } - - //_________________________________________________________ - void Client::activeChange( void ) - { - - KCommonDecoration::activeChange(); - _itemData.setDirty( true ); - - // reset animation - if( shadowAnimationsEnabled() ) - { - _glowAnimation->setDirection( isActive() ? Animation::Forward : Animation::Backward ); - if(!glowIsAnimated()) { _glowAnimation->start(); } - } - - // update size grip so that it gets the right color - // also make sure it is remaped to from z stack, - // unless hidden - if( hasSizeGrip() && !(isShade() || isMaximized() )) - { - sizeGrip().activeChange(); - sizeGrip().update(); - } - - } - - //_________________________________________________________ - void Client::maximizeChange( void ) - { - if( hasSizeGrip() ) sizeGrip().setVisible( !( isShade() || isMaximized() ) ); - setAlphaEnabled(!isMaximized()); - KCommonDecoration::maximizeChange(); - } - - //_________________________________________________________ - void Client::shadeChange( void ) - { - if( hasSizeGrip() ) sizeGrip().setVisible( !( isShade() || isMaximized() ) ); - KCommonDecoration::shadeChange(); - } - - //_________________________________________________________ - void Client::captionChange( void ) - { - - KCommonDecoration::captionChange(); - _itemData.setDirty( true ); - if( titleAnimationsEnabled() ) - { _titleAnimationData->setDirty( true ); } - - } - - //_________________________________________________________ - QPalette Client::backgroundPalette( const QWidget* widget, QPalette palette ) const - { - - if( _configuration->drawTitleOutline() ) - { - if( glowIsAnimated() && !isForcedActive() ) - { - - const QColor inactiveColor( backgroundColor( widget, palette, false ) ); - const QColor activeColor( backgroundColor( widget, palette, true ) ); - const QColor mixed( KColorUtils::mix( inactiveColor, activeColor, glowIntensity() ) ); - palette.setColor( QPalette::Window, mixed ); - palette.setColor( QPalette::Button, mixed ); - - } else if( isActive() || isForcedActive() ) { - - const QColor color = options()->color( KDecorationDefines::ColorTitleBar, true ); - palette.setColor( QPalette::Window, color ); - palette.setColor( QPalette::Button, color ); - - } - - } - - return palette; - - } - - //_________________________________________________________ - QColor Client::backgroundColor( const QWidget*, QPalette palette, bool active ) const - { - - return ( _configuration->drawTitleOutline() && active ) ? - options()->color( KDecorationDefines::ColorTitleBar, true ): - palette.color( QPalette::Window ); - - } - - //________________________________________________________________ - void Client::updateWindowShape() - { - - if(isMaximized()) clearMask(); - else setMask( calcMask() ); - - } - - //______________________________________________________________________________ - bool Client::eventFilter( QObject* object, QEvent* event ) - { - - // all dedicated event filtering is here to handle multiple tabs. - - bool state = false; - switch( event->type() ) - { - - case QEvent::Show: - if( widget() == object ) - { _itemData.setDirty( true ); } - break; - - case QEvent::MouseButtonPress: - if( widget() == object ) - { state = mousePressEvent( static_cast< QMouseEvent* >( event ) ); } - break; - - case QEvent::MouseButtonRelease: - if( widget() == object ) state = mouseReleaseEvent( static_cast< QMouseEvent* >( event ) ); - else if( Button *btn = qobject_cast< Button* >( object ) ) - { - QMouseEvent* mouseEvent( static_cast< QMouseEvent* >( event ) ); - if( mouseEvent->button() == Qt::LeftButton && btn->rect().contains( mouseEvent->pos() ) ) - { state = closeItem( btn ); } - } - - break; - - case QEvent::MouseMove: - state = mouseMoveEvent( static_cast< QMouseEvent* >( event ) ); - break; - - case QEvent::DragEnter: - if( widget() == object ) - { state = dragEnterEvent( static_cast< QDragEnterEvent* >( event ) ); } - break; - - case QEvent::DragMove: - if( widget() == object ) - { state = dragMoveEvent( static_cast< QDragMoveEvent* >( event ) ); } - break; - - case QEvent::DragLeave: - if( widget() == object ) - { state = dragLeaveEvent( static_cast< QDragLeaveEvent* >( event ) ); } - break; - - case QEvent::Drop: - if( widget() == object ) - { state = dropEvent( static_cast< QDropEvent* >( event ) ); } - break; - - default: break; - - } - return state || KCommonDecoration::eventFilter( object, event ); - - } - - //_________________________________________________________ - void Client::resizeEvent( QResizeEvent* event ) - { - - // prepare item data updates - _itemData.setDirty( true ); - - // mark title animation as dirty - if( event->oldSize().width() != event->size().width() ) - { _titleAnimationData->setDirty( true ); } - - // resize backing store pixmap - if( !compositingActive() ) - { _pixmap = QPixmap( event->size() ); } - - // base class implementation - KCommonDecoration::resizeEvent( event ); - } - - //_________________________________________________________ - void Client::paintBackground( QPainter& painter ) const - { - if( !compositingActive() ) - { painter.drawPixmap( QPoint(), _pixmap ); } - } - - //_________________________________________________________ - QRegion Client::region( KDecorationDefines::Region r ) - { - - // return empty region for anything but extended borders, when enabled - if( !( r == KDecorationDefines::ExtendedBorderRegion && configuration()->useExtendedWindowBorders() ) ) - { return QRegion(); } - - // return empty region for maximized windows - if( isMaximized() ) return QRegion(); - - // return 3 pixels extended borders for sides that have no visible borders - // also add the invisible pixels at the masked rounded corners, in non compositing mode - if( configuration()->frameBorder() <= Configuration::BorderNoSide || !compositingActive() ) - { - - QRect rect = widget()->rect().adjusted( - layoutMetric( LM_OuterPaddingLeft ), - layoutMetric( LM_OuterPaddingTop ), - - layoutMetric( LM_OuterPaddingRight ), - - layoutMetric( LM_OuterPaddingBottom ) ); - - rect.translate( -layoutMetric( LM_OuterPaddingLeft ), -layoutMetric( LM_OuterPaddingTop ) ); - - // mask - QRegion mask( calcMask() ); - if( mask.isEmpty() ) mask = rect; - else mask.translate( -layoutMetric( LM_OuterPaddingLeft ), -layoutMetric( LM_OuterPaddingTop ) ); - - // only return non-empty region on the sides for which there is no border - if( configuration()->frameBorder() == Configuration::BorderNone ) return QRegion( rect.adjusted( -3, 0, 3, 3 ) ) - mask; - else if( configuration()->frameBorder() == Configuration::BorderNoSide ) return QRegion( rect.adjusted( -3, 0, 3, 0 ) ) - mask; - else if( !compositingActive() ) return QRegion( rect ) - mask; - - } - - // fall back - return QRegion(); - - } - - - //_________________________________________________________ - void Client::paintEvent( QPaintEvent* event ) - { - - // factory - if(!( _initialized && _factory->initialized() ) ) return; - - if( compositingActive() ) - { - - QPainter painter(widget()); - painter.setRenderHint(QPainter::Antialiasing); - painter.setClipRegion( event->region() ); - paint( painter ); - - // update buttons - QList buttons( widget()->findChildren() ); - foreach( Button* button, buttons ) - { - if( ( button->isVisible() || isPreview() ) && event->rect().intersects( button->geometry() ) ) - { - - painter.save(); - painter.setViewport( button->geometry() ); - painter.setWindow( button->rect() ); - button->paint( painter ); - painter.restore(); - - } - } - - - } else { - - { - // update backing store pixmap - QPainter painter( &_pixmap ); - painter.setRenderHint(QPainter::Antialiasing); - painter.setClipRegion( event->region() ); - paint( painter ); - } - - QPainter painter( widget() ); - painter.setClipRegion( event->region() ); - painter.drawPixmap( QPoint(), _pixmap ); - - // update buttons - QList buttons( widget()->findChildren() ); - foreach( Button* button, buttons ) - { - if( event->rect().intersects( button->geometry() ) ) - { button->update(); } - } - - } - - - - } - - //_________________________________________________________ - void Client::paint( QPainter& painter ) - { - - // palette - QPalette palette = KCommonDecoration::palette(); - palette.setCurrentColorGroup( (isActive() ) ? QPalette::Active : QPalette::Inactive ); - - // define frame - QRect frame = widget()->rect(); - - // base color - QColor color = palette.window().color(); - - // draw shadows - if( compositingActive() && shadowCache().shadowSize() > 0 && !isMaximized() ) - { - - TileSet *tileSet( 0 ); - const ShadowCache::Key key( this->key() ); - if( shadowCache().isEnabled( QPalette::Active ) && glowIsAnimated() && !isForcedActive() ) - { - - tileSet = shadowCache().tileSet( key, glowIntensity() ); - - } else { - - tileSet = shadowCache().tileSet( key ); - - } - - tileSet->render( frame, &painter, TileSet::Ring); - - } - - // adjust frame - frame.adjust( - layoutMetric(LM_OuterPaddingLeft), - layoutMetric(LM_OuterPaddingTop), - -layoutMetric(LM_OuterPaddingRight), - -layoutMetric(LM_OuterPaddingBottom) ); - - // adjust mask - if( compositingActive() || isPreview() ) - { - - if( isMaximized() ) { - - painter.setClipRect( frame, Qt::IntersectClip ); - - } else { - - // multipliers - const int left = 1; - const int right = 1; - const int top = 1; - int bottom = 1; - - // disable bottom corners when border frame is too small and window is not shaded - if( _configuration->frameBorder() == Configuration::BorderNone && !isShade() ) bottom = 0; - QRegion mask( helper().roundedMask( frame, left, right, top, bottom ) ); - - renderCorners( &painter, frame, palette ); - painter.setClipRegion( mask, Qt::IntersectClip ); - - } - - } - - // make sure ItemData and tabList are synchronized - /* - this needs to be done before calling RenderWindowBorder - since some painting in there depend on the clientGroups state - */ - if( _itemData.isDirty() || _itemData.count() != tabCount() ) - { updateItemBoundingRects( false ); } - - // window background - renderWindowBackground( &painter, frame, widget(), backgroundPalette( widget(), palette ) ); - - // window border (for title outline) - if( hasTitleOutline() ) renderWindowBorder( &painter, frame, widget(), palette ); - - // clipping - if( compositingActive() ) - { - painter.setClipping(false); - frame.adjust(-1,-1, 1, 1); - } - - // float frame - renderFloatFrame( &painter, frame, palette ); - - // resize handles - renderDots( &painter, frame, backgroundColor( widget(), palette ) ); - - if( !hideTitleBar() ) - { - - // title bounding rect - painter.setFont( options()->font(isActive(), false) ); - - // draw ClientGroupItems - const int itemCount( _itemData.count() ); - for( int i = 0; i < itemCount; i++ ) renderItem( &painter, i, palette ); - - // draw target rect - renderTargetRect( &painter, widget()->palette() ); - - // separator - if( itemCount == 1 && !_itemData.isAnimated() && drawSeparator() ) - { renderSeparator(&painter, frame, widget(), color ); } - - } - - } - - //_____________________________________________________________ - bool Client::mousePressEvent( QMouseEvent* event ) - { - - const QPoint point = event->pos(); - if( tabIndexAt( point ) < 0 ) return false; - _dragPoint = point; - - _mouseButton = event->button(); - bool accepted( false ); - if( buttonToWindowOperation( _mouseButton ) == TabDragOp ) - { - - accepted = true; - - } else if( buttonToWindowOperation( _mouseButton ) == OperationsOp ) { - - QPoint point = event->pos(); - const int clickedIndex( tabIndexAt( point ) ); - _mouseButton = Qt::NoButton; - if ( tabIndexAt( point ) > -1) - { showWindowMenu( widget()->mapToGlobal( event->pos() ), tabId(clickedIndex) ); } - - accepted = true; // displayClientMenu can possibly destroy the deco... - - } - return accepted; - } - - //_____________________________________________________________ - bool Client::mouseReleaseEvent( QMouseEvent* event ) - { - - bool accepted( false ); - if( _mouseButton == event->button() && buttonToWindowOperation( _mouseButton ) != OperationsOp ) - { - - const QPoint point = event->pos(); - - const long visibleItem = currentTabId(); - const int clickedIndex( tabIndexAt( point ) ); - if( clickedIndex >= 0 && visibleItem != tabId(clickedIndex) ) - { - setCurrentTab( tabId(clickedIndex) ); - setForceActive( true ); - accepted = true; - } - - } - - _mouseButton = Qt::NoButton; - return accepted; - - } - - //_____________________________________________________________ - bool Client::mouseMoveEvent( QMouseEvent* event ) - { - - // check button and distance to drag point - if( hideTitleBar() || _mouseButton == Qt::NoButton || ( event->pos() - _dragPoint ).manhattanLength() <= QApplication::startDragDistance() ) - { return false; } - - bool accepted( false ); - if( buttonToWindowOperation( _mouseButton ) == TabDragOp ) - { - - const QPoint point = event->pos(); - const int clickedIndex( tabIndexAt( point ) ); - if( clickedIndex < 0 ) return false; - - _titleAnimationData->reset(); - - QDrag *drag = new QDrag( widget() ); - QMimeData *groupData = new QMimeData(); - groupData->setData( tabDragMimeType(), QByteArray().setNum( (qint64) tabId(clickedIndex) ) ); - drag->setMimeData( groupData ); - _sourceItem = tabIndexAt( _dragPoint ); - - // get tab geometry - QRect geometry( _itemData[clickedIndex]._boundingRect ); - - // remove space used for buttons - if( _itemData.count() > 1 ) - { - - geometry.adjust( 0, 0, - buttonSize() - layoutMetric(LM_TitleEdgeRight), 0 ); - - } else if( !( isActive() && _configuration->drawTitleOutline() ) ) { - - geometry.adjust( - buttonsLeftWidth() + layoutMetric( LM_TitleEdgeLeft ) , 0, - -( buttonsRightWidth() + layoutMetric( LM_TitleEdgeRight )), 0 ); - - } - - // adjust geometry to include shadow size - const int shadowSize( shadowCache().shadowSize() ); - const bool drawShadow( - compositingActive() && - KStyle::customStyleHint( QStringLiteral("SH_ArgbDndWindow"), widget() ) && - shadowSize > 0 ); - - if( drawShadow ) - { geometry.adjust( -shadowSize, -shadowSize, shadowSize, shadowSize ); } - - // compute pixmap and assign - drag->setPixmap( itemDragPixmap( clickedIndex, geometry, drawShadow ) ); - - // note: the pixmap is moved just above the pointer on purpose - // because overlapping pixmap and pointer slows down the pixmap a lot. - QPoint hotSpot( QPoint( event->pos().x() - geometry.left(), -1 ) ); - if( drawShadow ) hotSpot += QPoint( 0, shadowSize ); - - // make sure the horizontal hotspot position is not too far away (more than 1px) - // from the pixmap - if( hotSpot.x() < -1 ) hotSpot.setX(-1); - if( hotSpot.x() > geometry.width() ) hotSpot.setX( geometry.width() ); - - drag->setHotSpot( hotSpot ); - - _dragStartTimer.start( 50, this ); - drag->exec( Qt::MoveAction ); - - // detach tab from window - if( drag->target() == 0 && _itemData.count() > 1 ) - { - _itemData.setDirty( true ); - untab( tabId(_sourceItem), - widget()->frameGeometry().adjusted( - layoutMetric( LM_OuterPaddingLeft ), - layoutMetric( LM_OuterPaddingTop ), - -layoutMetric( LM_OuterPaddingRight ), - -layoutMetric( LM_OuterPaddingBottom ) - ).translated( QCursor::pos() - event->pos() + - QPoint( layoutMetric( LM_OuterPaddingLeft ), layoutMetric( LM_OuterPaddingTop ))) - ); - } - - // reset button - _mouseButton = Qt::NoButton; - accepted = true; - - } - - return accepted; - - } - - //_____________________________________________________________ - bool Client::dragEnterEvent( QDragEnterEvent* event ) - { - - // check if drag enter is allowed - if( !event->mimeData()->hasFormat( tabDragMimeType() ) || hideTitleBar() ) return false; - - // accept event - event->acceptProposedAction(); - - // animate - if( event->source() != widget() ) - { - - _itemData.animate( AnimationEnter, tabIndexAt( event->pos(), true ) ); - - } else if( _itemData.count() > 1 ) { - - _itemData.animate( AnimationEnter|AnimationSameTarget, tabIndexAt( event->pos(), true ) ); - - } - - return true; - - } - - //_____________________________________________________________ - bool Client::dragLeaveEvent( QDragLeaveEvent* ) - { - - if( _itemData.animationType() & AnimationSameTarget ) - { - - if( _dragStartTimer.isActive() ) _dragStartTimer.stop(); - _itemData.animate( AnimationLeave|AnimationSameTarget, _sourceItem ); - - } else if( _itemData.isAnimated() ) { - - _itemData.animate( AnimationLeave ); - - } - - return true; - - } - - //_____________________________________________________________ - bool Client::dragMoveEvent( QDragMoveEvent* event ) - { - - // check format - if( !event->mimeData()->hasFormat( tabDragMimeType() ) ) return false; - - // animate - if( event->source() != widget() ) - { - - _itemData.animate( AnimationMove, tabIndexAt( event->pos(), true ) ); - - } else if( _itemData.count() > 1 ) { - - if( _dragStartTimer.isActive() ) _dragStartTimer.stop(); - _itemData.animate( AnimationMove|AnimationSameTarget, tabIndexAt( event->pos(), true ) ); - - } - - return false; - - } - - //_____________________________________________________________ - bool Client::dropEvent( QDropEvent* event ) - { - - const QPoint point = event->pos(); - _itemData.animate( AnimationNone ); - - const QMimeData *groupData = event->mimeData(); - if( !groupData->hasFormat( tabDragMimeType() ) ) return false; - - _itemData.setDirty( true ); - - if( widget() != event->source() ) setForceActive( true ); - - const long source = QString::fromUtf8( groupData->data( tabDragMimeType() ) ).toLong(); - const int clickedIndex( tabIndexAt( point, true ) ); - if( clickedIndex < 0 ) tab_A_behind_B( source, tabId(_itemData.count()-1) ); - else tab_A_before_B( source, tabId(clickedIndex) ); - - // update title - if( widget() == event->source() ) updateTitleRect(); - - _titleAnimationData->reset(); - return true; - - } - - //_____________________________________________________________ - void Client::timerEvent( QTimerEvent* event ) - { - - if( event->timerId() != _dragStartTimer.timerId() ) - { return KCommonDecoration::timerEvent( event ); } - - _dragStartTimer.stop(); - - // do nothing if there is only one tab - if( _itemData.count() > 1 ) - { - _itemData.animate( AnimationMove|AnimationSameTarget, _sourceItem ); - _itemData.animate( AnimationLeave|AnimationSameTarget, _sourceItem ); - } - - } - - //_____________________________________________________________ - bool Client::closeItem( const Button* button ) - { - - for( int i=0; i < _itemData.count(); i++ ) - { - if( button == _itemData[i]._closeButton.data() ) - { - _itemData.setDirty( true ); - closeTab( tabId(i) ); - return true; - } - } - return false; - - } - - //________________________________________________________________ - QPixmap Client::itemDragPixmap( int index, QRect geometry, bool drawShadow ) - { - const bool itemValid( index >= 0 && index < tabCount() ); - - QPixmap pixmap( geometry.size() ); - pixmap.fill( Qt::transparent ); - QPainter painter( &pixmap ); - painter.setRenderHints(QPainter::SmoothPixmapTransform|QPainter::Antialiasing); - - painter.translate( -geometry.topLeft() ); - - // draw shadows - if( drawShadow ) - { - - // shadow - const int shadowSize( shadowCache().shadowSize() ); - TileSet *tileSet( shadowCache().tileSet( ShadowCache::Key() ) ); - tileSet->render( geometry, &painter, TileSet::Ring); - geometry.adjust( shadowSize, shadowSize, -shadowSize, -shadowSize ); - - renderCorners( &painter, geometry, widget()->palette() ); - - } - - // mask - painter.setClipRegion( helper().roundedMask( geometry ), Qt::IntersectClip ); - - // render window background - renderWindowBackground( &painter, geometry, widget(), widget()->palette() ); - - // darken background if item is inactive - const bool itemActive = (tabCount() <= 1) || !( itemValid && tabId(index) != currentTabId() ); - if( !itemActive ) - { - - QLinearGradient lg( geometry.topLeft(), geometry.bottomLeft() ); - lg.setColorAt( 0, helper().alphaColor( Qt::black, 0.05 ) ); - lg.setColorAt( 1, helper().alphaColor( Qt::black, 0.10 ) ); - painter.setBrush( lg ); - painter.setPen( Qt::NoPen ); - painter.drawRect( geometry ); - - } - - // render title text - painter.setFont( options()->font(isActive(), false) ); - QRect textRect( geometry.adjusted( 0, layoutMetric( LM_TitleEdgeTop )-1, 0, -1 ) ); - - if( itemValid ) - { textRect.adjust( layoutMetric( LM_TitleBorderLeft ), 0, -layoutMetric(LM_TitleBorderRight), 0 ); } - - const QString caption( itemValid ? this->caption(index) : this->caption() ); - - renderTitleText( - &painter, textRect, caption, - titlebarTextColor( widget()->palette(), isActive() && itemActive ), - titlebarContrastColor( widget()->palette() ) ); - - // adjust geometry for floatFrame when compositing is on. - if( drawShadow ) - { geometry.adjust(-1, -1, 1, 1 ); } - - // floating frame - helper().drawFloatFrame( - &painter, geometry, widget()->palette().window().color(), - !drawShadow, false, - KDecoration::options()->color(ColorTitleBar) - ); - - painter.end(); - return pixmap; - - } - - //_________________________________________________________________ - void Client::createSizeGrip( void ) - { - - assert( !hasSizeGrip() ); - if( ( isResizable() && windowId() != 0 ) || isPreview() ) - { - _sizeGrip = new SizeGrip( this ); - sizeGrip().setVisible( !( isMaximized() || isShade() ) ); - } - - } - - //_________________________________________________________________ - void Client::deleteSizeGrip( void ) - { - assert( hasSizeGrip() ); - _sizeGrip->deleteLater(); - _sizeGrip = 0; - } - - //_________________________________________________________________ - void Client::removeShadowHint( void ) - { - - // do nothing if no window id - if( !windowId() ) return; - - // create atom - if( !_shadowAtom ) - { _shadowAtom = helper().createAtom( QStringLiteral( "_KDE_NET_WM_SHADOW" ) ); } - - xcb_delete_property( helper().xcbConnection(), (xcb_window_t) windowId(), _shadowAtom); - } - -} diff --git a/clients/oxygen/oxygenclient.desktop b/clients/oxygen/oxygenclient.desktop deleted file mode 100644 index a3ff5f8b8..000000000 --- a/clients/oxygen/oxygenclient.desktop +++ /dev/null @@ -1,178 +0,0 @@ -# KDE Desktop Entry -[Desktop Entry] -Name=Oxygen -Name[af]=Oxygen -Name[ar]=أكسجين -Name[as]=Oxygen -Name[ast]=Oxíxenu -Name[be]=Oxygen -Name[be@latin]=Oxygen -Name[bg]=Oxygen -Name[bn]=অক্সিজেন -Name[bn_IN]=Oxygen -Name[bs]=Kiseonik -Name[ca]=Oxygen -Name[ca@valencia]=Oxygen -Name[cs]=Oxygen -Name[csb]=Krziseń -Name[da]=Oxygen -Name[de]=Oxygen -Name[el]=Oxygen -Name[en_GB]=Oxygen -Name[eo]=Oxygen -Name[es]=Oxígeno -Name[et]=Oxygen -Name[eu]=Oxygen -Name[fa]=اکسیژن -Name[fi]=Oxygen -Name[fr]=Oxygen -Name[fy]=Oxygen -Name[ga]=Oxygen -Name[gl]=Oxygen -Name[gu]=ઓક્સિજન -Name[he]=Oxygen -Name[hi]=आक्सीजन -Name[hne]=आक्सीजन -Name[hr]=Oxygen -Name[hsb]=Oxygen -Name[hu]=Oxygen -Name[ia]=Oxygen -Name[id]=Oksigen -Name[is]=Oxygen -Name[it]=Oxygen -Name[ja]=Oxygen -Name[kk]=Oxygen -Name[km]=អុកស៊ីហ្សែន -Name[kn]=ಆಕ್ಸಿಜನ್ -Name[ko]=Oxygen -Name[ku]=Oxygen -Name[lt]=Oxygen -Name[lv]=Oxygen -Name[mai]=आक्सीजन -Name[mk]=Оксиген -Name[ml]=ഓക്സിജന്‍ -Name[mr]=ऑक्सीजन -Name[nb]=Oxygen -Name[nds]=Oxygen -Name[ne]=अक्सिजन -Name[nl]=Oxygen -Name[nn]=Oksygen -Name[or]=ଅକ୍ସିଜେନ -Name[pa]=ਆਕਸੀਜਨ -Name[pl]=Oxygen -Name[pt]=Oxygen -Name[pt_BR]=Oxygen -Name[ro]=Oxygen -Name[ru]=Oxygen -Name[se]=Oksygena -Name[si]=ඔක්සිජන් -Name[sk]=Oxygen -Name[sl]=Kisik -Name[sr]=Кисеоник -Name[sr@ijekavian]=Кисеоник -Name[sr@ijekavianlatin]=Kiseonik -Name[sr@latin]=Kiseonik -Name[sv]=Oxygen -Name[ta]=ஆக்ஸிஜன் -Name[te]=Oxygen -Name[tg]=Oxygen -Name[th]=รูปแบบ Oxygen -Name[tr]=Oxygen -Name[ug]=ئوكسېگىن -Name[uk]=Oxygen -Name[uz]=Oxygen -Name[uz@cyrillic]=Oxygen -Name[vi]=Oxygen -Name[wa]=Ocsidjinne -Name[x-test]=xxOxygenxx -Name[zh_CN]=Oxygen -Name[zh_TW]=Oxygen - -Comment=Styling of the next generation desktop -Comment[af]=Stilering van die volgende generasie werkskerm -Comment[ar]=نمط الجيل التالي من سطح المكتب -Comment[ast]=Estilu de la siguiente xeneración d'escritorios -Comment[be]=Стыль працоўных сталоў наступнага пакалення -Comment[be@latin]=Styl nastupnaha pakaleńnia rabočaha stała -Comment[bg]=Стил за следващото поколение работни плотове -Comment[bs]=Stil za narednu generaciju površi -Comment[ca]=Estil de la propera generació d'escriptori -Comment[ca@valencia]=Estil de la propera generació d'escriptori -Comment[cs]=Styl plochy nové generace -Comment[csb]=Sztél nôslédny generacëji wëzdrzatkù pùltù -Comment[da]=Stilisering af næste generation af skrivebordet -Comment[de]=Das KDE-Design der nächsten Generation -Comment[el]=Μορφή της νέας γενιάς επιφάνειας εργασίας -Comment[en_GB]=Styling of the next generation desktop -Comment[eo]=Stilo por la labortablo de sekva generacio -Comment[es]=Estilo de la siguiente generación de escritorios -Comment[et]=Uue põlvkonna töölaua stiil -Comment[eu]=Hurrengo belaunaldiko mahaigainen estiloa -Comment[fi]=Seuraavan sukupolven työpöydän tyyli -Comment[fr]=Style pour la prochaine génération de bureau -Comment[fy]=De styl fan it buroblêd fan de folgjende generaasje -Comment[ga]=Stíliú na deisce don mhílaois nua -Comment[gl]=O estilo da seguinte xeración do escritorio -Comment[gu]=નવી પેઢીનાં ડેસ્કટોપની શૈલી -Comment[he]=הסגנון של הדור הבא של שולחן העבודה -Comment[hi]=अगली पीढ़ी के डेस्कटॉप की शैलियाँ -Comment[hne]=अगला जनरेसन डेस्कटाप के स्टाइलिंग -Comment[hr]=Stil sljedeće generacije radnih okruženja -Comment[hsb]=Stil za dźěłowy powjerch přichodneje generacije -Comment[hu]=Új generációs stílus -Comment[ia]=Le stilo de scriptorio de proxime generation -Comment[id]=Gaya dekstop generasi selanjutnya -Comment[is]=Stílar fyrir næstu-kynslóðar skjáborð -Comment[it]=Stile per il desktop di prossima generazione -Comment[ja]=次世代デスクトップのスタイル -Comment[kk]=Келесі буын үстел стилі -Comment[km]=ការ​កំណត់​រចនាប័ទ្ម​របស់​ផ្ទៃ​តុ​ជំនាន់​ក្រោយ​ -Comment[kn]=ಮುಂದಿನ ಪೀಳಿಗೆಯ ಗಣಕತೆರೆ ವೈಖರಿ -Comment[ko]=다음 세대 데스크톱을 위한 스타일 -Comment[ku]=Curekirina nifşê pêş ê sermaseyê -Comment[lt]=Kitos kartos darbastalio stiliaus kūrimas -Comment[lv]=Nākamās paaudzes darbvirsmas stils -Comment[mai]=अगिला पीढ़ीक डेस्कटापक शैली -Comment[mk]=Стил за следната генерација десктопи -Comment[ml]=ഭാവിതലമുറയിലെ പണിയിടത്തിനുള്ള രീതികള്‍ -Comment[mr]=नेक्स्ट जेनरेशन डेस्कटॉपचे स्टायलिंग -Comment[nb]=Stil for skrivebord av neste generasjon -Comment[nds]=Stil för den kamen Schriefdisch -Comment[ne]=पछिल्लो युगको डेस्कटपको शैली -Comment[nl]=De stijl voor de volgende generatie bureaubladen -Comment[nn]=Ein stil for neste generasjons skrivebord -Comment[or]=ପରବର୍ତ୍ତୀ ପିଢ଼ି ଡ଼େସ୍କଟପର ଶୈଳୀକରଣ କରିବା -Comment[pa]=ਅਗਲੀ ਪੀੜ੍ਹੀ ਡੈਸਕਟਾਪ ਦਾ ਸਟਾਇਲ -Comment[pl]=Styl pulpitu następnej generacji -Comment[pt]=O estilo do ambiente de trabalho da próxima geração -Comment[pt_BR]=Estilo da próxima geração de área de trabalho -Comment[ro]=Stilul biroului de generație următoare -Comment[ru]=Стиль рабочего стола следующего поколения -Comment[se]=Stiila boahttebuolvvalaš čállinbeavdái -Comment[si]=ඊලඟ පරම්පරාවේ වැඩතල රටා -Comment[sk]=Štýl plochy novej generácie -Comment[sl]=Slog namizja naslednje generacije -Comment[sr]=Стил за наредну генерацију површи -Comment[sr@ijekavian]=Стил за наредну генерацију површи -Comment[sr@ijekavianlatin]=Stil za narednu generaciju površi -Comment[sr@latin]=Stil za narednu generaciju površi -Comment[sv]=Stil för nästa generations skrivbord -Comment[ta]=Styling of the next generation desktop -Comment[te]=తరువాతి తరం డెస్‍క్‌టాప్ యొక్క శైలీకరణ -Comment[tg]=Стиль рабочего стола следующего поколения -Comment[th]=รูปแบบสำหรับพื้นที่ทำงานในยุคถัดไป -Comment[tr]=Sonraki kuşak masaüstü biçimi -Comment[ug]=كېيىنكى ئەۋلاد ئۈستەلئۈستى ئۇسلۇبى -Comment[uk]=Стиль стільниці наступного покоління -Comment[wa]=Stîle del novele djermêye di scribannes -Comment[x-test]=xxStyling of the next generation desktopxx -Comment[zh_CN]=下一代桌面的风格 -Comment[zh_TW]=下一代桌面的樣式 - -X-KDE-PluginInfo-Author=Nuno Pinheiro, Casper Boemann, Riccardo Iaconelli, Huynh Huu Long, Thomas Luebking, Hugo Pereira Da Costa, Matthew Woehlke -X-KDE-PluginInfo-Email=nuno@oxygen-icons.org, cbr@boemann.dk, riccardo@kde.org, long.upcase@googlemail.com, thomas.luebking@web.de, hugo.pereira@free.fr, mw_triad@users.sourceforge.net -X-KDE-PluginInfo-Name=Oxygen -X-KDE-PluginInfo-Category= -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-License=GPL -X-KDE-PluginInfo-EnabledByDefault=true diff --git a/clients/oxygen/oxygenclient.h b/clients/oxygen/oxygenclient.h deleted file mode 100644 index 3a153a770..000000000 --- a/clients/oxygen/oxygenclient.h +++ /dev/null @@ -1,540 +0,0 @@ -#ifndef oxygenclient_h -#define oxygenclient_h - -////////////////////////////////////////////////////////////////////////////// -// oxygenclient.h -// ------------------- -// -// Copyright (c) 2009 Hugo Pereira Da Costa -// Copyright (c) 2003, 2004 David Johnson -// Copyright (c) 2006, 2007 Riccardo Iaconelli -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -////////////////////////////////////////////////////////////////////////////// - -#include "oxygenanimation.h" -#include "oxygenclientgroupitemdata.h" -#include "oxygenconfiguration.h" -#include "oxygendecohelper.h" -#include "oxygenfactory.h" -#include "oxygenshadowcache.h" -#include "oxygentitleanimationdata.h" - -#include -#include -#include -#include - -#include - -namespace Oxygen -{ - - class SizeGrip; - class Client : public KCommonDecoration - { - - Q_OBJECT - - //! declare glow intensity property - Q_PROPERTY( qreal glowIntensity READ glowIntensityUnbiased WRITE setGlowIntensity ) - - public: - - //! constructor - Client(KDecorationBridge *b, Factory *f); - - //! destructor - virtual ~Client(); - - //! decoration name - virtual QString visibleName() const; - - //! buttons - virtual KCommonDecorationButton *createButton(::ButtonType type); - - //!@name flags - //@{ - - //! true if decoration has iquired behavior - virtual bool decorationBehaviour(DecorationBehaviour behaviour) const; - - //! true if window is maximized - virtual bool isMaximized( void ) const - { return maximizeMode()==MaximizeFull && !configuration()->drawBorderOnMaximizedWindows(); } - - //! true if animations are used - bool animationsEnabled( void ) const - { return _configuration->animationsEnabled(); } - - //! true if glow is animated - bool glowIsAnimated( void ) const - { return _glowAnimation->isRunning(); } - - //! true when decoration is forced active - bool isForcedActive( void ) const - { return _forceActive && tabCount() > 1; } - - //! true when separator is to be drawn - bool drawSeparator( void ) const - { - if( _configuration->drawTitleOutline() ) return false; - switch( _configuration->separatorMode() ) - { - case Configuration::SeparatorAlways: - return true; - - case Configuration::SeparatorActive: - return ( glowIsAnimated() || isActive() ); - - default: - case Configuration::SeparatorNever: - return false; - } - - } - - //! true if titlebar is hidden - bool hideTitleBar( void ) const - { - return - _configuration->hideTitleBar() && - !isShade() && - tabCount() == 1; - } - - //@} - - //! window shape - virtual void updateWindowShape(); - - //! initialization - virtual void init(); - - //! return associated configuration - Factory::ConfigurationPtr configuration( void ) const - { return _configuration; } - - //!@name glow animation - //@{ - - void setGlowIntensity( qreal value ) - { - if( _glowIntensity == value ) return; - _glowIntensity = value; - widget()->update(); - } - - //! unbiased glow intensity - qreal glowIntensityUnbiased( void ) const - { return _glowIntensity; } - - //! glow bias - static qreal glowBias( void ) - { return 0.2; } - - //! true (biased) intensity - /*! this is needed to have glow go from either 0.2->1 or 0.8->0 depending on the animation direction */ - qreal glowIntensity( void ) const - { return _glowAnimation->direction() == Animation::Forward ? _glowIntensity : _glowIntensity-glowBias(); } - - //@} - - //! helper class - DecoHelper& helper( void ) const - { return _factory->helper(); } - - //! helper class - ShadowCache& shadowCache( void ) const - { return _factory->shadowCache(); } - - //!@name metrics and color definitions - //@{ - - //! dimensions - virtual int layoutMetric(LayoutMetric lm, bool respectWindowState = true, const KCommonDecorationButton * = 0) const; - - //! get title rect for untabbed window - virtual QRect defaultTitleRect( bool active = true ) const; - - //! get title bounding rect - virtual QRect titleBoundingRect( const QFont& font, const QString& caption ) const - { return titleBoundingRect( font, titleRect(), caption ); } - - //! get title bounding rect - virtual QRect titleBoundingRect( const QFont&, QRect, const QString& ) const; - - //! palette background - QPalette backgroundPalette( const QWidget*, QPalette ) const; - - //! background - QColor backgroundColor( const QWidget* widget, QPalette palette ) const - { return backgroundColor( widget, palette, isActive() || isForcedActive() ); } - - //! background - QColor backgroundColor( const QWidget*, QPalette, bool ) const; - - //@} - - //! title alignment - inline Qt::Alignment titleAlignment( void ) const; - - //! button size - inline int buttonSize( void ) const; - - //! frame border - inline int frameBorder( void ) const; - - //!@name status change methods (overloaded from KCommonDecorationUnstable) - //@{ - - //! triggered when window activity is changed - virtual void activeChange(); - - //! triggered when maximize state changed - virtual void maximizeChange(); - - //! triggered when window shade is changed - virtual void shadeChange(); - - //! triggered when window shade is changed - virtual void captionChange(); - - //@} - - //! event filter - virtual bool eventFilter( QObject*, QEvent* ); - - //! resize event - virtual void resizeEvent( QResizeEvent* ); - - //! paint background to painter - void paintBackground( QPainter& ) const; - - public Q_SLOTS: - - //! triggers widget update in titleRect only - /*! one needs to add the title top margin to avoid some clipping glitches */ - void updateTitleRect( void ) - { widget()->update( titleRect().adjusted( 0, -layoutMetric( LM_TitleEdgeTop ), 0, 1 ) ); } - - //! return region for a given defines. This allows to implement extended borders - QRegion region( KDecorationDefines::Region ); - - protected: - - //! return shadow cache key associated to this client - ShadowCache::Key key( void ) const - { - ShadowCache::Key key; - key.active = ( isActive() || isForcedActive() ) && shadowCache().isEnabled( QPalette::Active ); - key.isShade = isShade(); - key.hasBorder = ( _configuration->frameBorder() > Configuration::BorderNone ); - return key; - } - - //! true when decoration is forced active - void setForceActive( bool value ) - { _forceActive = value; } - - //!@name event filters - //@{ - - //! paint - virtual void paintEvent( QPaintEvent* ); - - //! render full decoration to provided painter - virtual void paint( QPainter& ); - - //! mouse press event - virtual bool mousePressEvent( QMouseEvent* ); - - //! mouse release event - virtual bool mouseReleaseEvent( QMouseEvent* ); - - //! mouse move event - virtual bool mouseMoveEvent( QMouseEvent* ); - - //! drag enter event - virtual bool dragEnterEvent( QDragEnterEvent* ); - - //! drag move event - virtual bool dragMoveEvent( QDragMoveEvent* ); - - //! drag leave event - virtual bool dragLeaveEvent( QDragLeaveEvent* ); - - //! drop event - virtual bool dropEvent( QDropEvent* ); - - //! timer event - virtual void timerEvent( QTimerEvent* ); - - //@} - - //!@name rendering methods (called in paintEvent) - //@{ - - //! window background - virtual void renderWindowBackground( QPainter*, const QRect&, const QWidget*, const QPalette& ) const; - - //! window border - // this draws a "blue" border around active window - virtual void renderWindowBorder( QPainter*, const QRect&, const QWidget*, const QPalette& ) const; - - //! separator - virtual void renderSeparator( QPainter*, const QRect&, const QWidget*, const QColor& ) const; - - //! title outline - virtual void renderTitleOutline( QPainter*, const QRect&, const QPalette& ) const; - - //! title text - /*! second color, if valid, is for contrast pixel */ - virtual void renderTitleText( QPainter*, const QRect&, const QColor&, const QColor& = QColor() ) const; - - //! title text - /*! second color, if valid, is for contrast pixel */ - virtual void renderTitleText( QPainter*, const QRect&, const QString&, const QColor&, const QColor& = QColor(), bool elide = true ) const; - - //! title text - virtual QPixmap renderTitleText( const QRect&, const QString&, const QColor&, bool elide = true ) const; - - //! GroupItem - virtual void renderItem( QPainter*, int, const QPalette& ); - - //! tabbing target rect - virtual void renderTargetRect( QPainter*, const QPalette& ); - - //! render corners - virtual void renderCorners( QPainter*, const QRect&, const QPalette& ) const; - - //! render float frame - virtual void renderFloatFrame( QPainter*, const QRect&, const QPalette& ) const; - - //! render dots - virtual void renderDots( QPainter*, const QRect&, const QColor& ) const; - - //@} - - //! close tab matching give button - virtual bool closeItem( const Button* ); - - //! index of item matching point - int tabIndexAt( const QPoint& position, bool between = false ) const - { return _itemData.itemAt( position , between ); } - - //! return pixmap corresponding to a given tab, for dragging - QPixmap itemDragPixmap( int, QRect, bool = false ); - - //! return true when activity change are animated - bool shadowAnimationsEnabled( void ) const - { return ( animationsEnabled() && _configuration->shadowAnimationsEnabled() && !isPreview() ); } - - //! return true when activity change are animated - bool titleAnimationsEnabled( void ) const - { - return - animationsEnabled() && - _configuration->titleAnimationsEnabled() && - !_configuration->drawTitleOutline() && - !hideTitleBar() && - !isPreview(); - } - - //! true if some title outline is rendered - bool hasTitleOutline( void ) const - { - return - tabCount() >= 2 || - _itemData.isAnimated() || - ( (isActive()||glowIsAnimated()) && _configuration->drawTitleOutline() ); - } - - //! calculate mask - QRegion calcMask( void ) const; - - //! text color - QColor titlebarTextColor(const QPalette&) const; - - //! text color - QColor titlebarTextColor(const QPalette& palette, bool active) const - { - return active ? - palette.color(QPalette::Active, QPalette::WindowText): - helper().inactiveTitleBarTextColor( palette ); - } - - //! text color - QColor titlebarContrastColor(const QPalette& palette ) const - { return titlebarContrastColor( palette.color( widget()->window()->backgroundRole() ) ); } - - //! text color - QColor titlebarContrastColor(const QColor& color ) const - { return helper().calcLightColor( color ); } - - //!@name size grip - //@{ - - //! create size grip - void createSizeGrip( void ); - - //! delete size grip - void deleteSizeGrip( void ); - - // size grip - bool hasSizeGrip( void ) const - { return (bool)_sizeGrip; } - - //! size grip - SizeGrip& sizeGrip( void ) const - { return *_sizeGrip; } - - //@} - - //! remove shadow hint - void removeShadowHint( void ); - - protected Q_SLOTS: - - //! set target item to -1 - void clearTargetItem( void ); - - //! clear force active flag - void clearForceActive( void ) - { if( isActive() ) setForceActive( false ); } - - //! title bounding rects - /*! calculate and return title bounding rects in case of tabbed window */ - void updateItemBoundingRects( bool alsoUpdate = true ); - - //! bound one rect to another - void boundRectTo( QRect&, const QRect& ) const; - - private Q_SLOTS: - void updateCompositing(); - void updateConfig(); - - private: - - //! factory - Factory* _factory; - - //! backing store pixmap (when compositing is not active) - QPixmap _pixmap; - - //! size grip widget - SizeGrip* _sizeGrip; - - //! configuration - Factory::ConfigurationPtr _configuration; - - //! glow animation - Animation* _glowAnimation; - - //! title animation data - TitleAnimationData* _titleAnimationData; - - //! glow intensity - qreal _glowIntensity; - - //! true when initialized - bool _initialized; - - //! true when decoration is forced active - bool _forceActive; - - //! mouse button - Qt::MouseButton _mouseButton; - - //! tab bounding rects - ClientGroupItemDataList _itemData; - - //! index of tab being dragged if any, -1 otherwise - int _sourceItem; - - //! drag start point - QPoint _dragPoint; - - //! drag start timer. - /*! - it is needed to activate animations when this was not done via either - dragMoveEvent or dragLeaveEvent - */ - QBasicTimer _dragStartTimer; - - //! shadow atom - xcb_atom_t _shadowAtom; - - }; - -} // namespace Oxygen - -//____________________________________________________ -Qt::Alignment Oxygen::Client::titleAlignment( void ) const -{ - switch( _configuration->titleAlignment() ) - { - case Configuration::AlignLeft: return Qt::AlignLeft; - case Configuration::AlignRight: return Qt::AlignRight; - - default: - case Configuration::AlignCenter: - case Configuration::AlignCenterFullWidth: - return Qt::AlignCenter; - } - -} - -//____________________________________________________ -int Oxygen::Client::buttonSize( void ) const -{ - switch( _configuration->buttonSize() ) - { - case Configuration::ButtonSmall: return 18; - - default: - case Configuration::ButtonDefault: return 20; - case Configuration::ButtonLarge: return 24; - case Configuration::ButtonVeryLarge: return 32; - case Configuration::ButtonHuge: return 48; - } - -} - -//____________________________________________________ -int Oxygen::Client::frameBorder( void ) const -{ - switch( _configuration->frameBorder() ) - { - case Configuration::BorderNone: return 0; - case Configuration::BorderNoSide: return 1; - - default: - case Configuration::BorderTiny: return 2; - case Configuration::BorderDefault: return 4; - case Configuration::BorderLarge: return 8; - case Configuration::BorderVeryLarge: return 12; - case Configuration::BorderHuge: return 18; - case Configuration::BorderVeryHuge: return 27; - case Configuration::BorderOversized: return 40; - } - -} - -#endif diff --git a/clients/oxygen/oxygenclientgroupitemdata.cpp b/clients/oxygen/oxygenclientgroupitemdata.cpp deleted file mode 100644 index 5a9357922..000000000 --- a/clients/oxygen/oxygenclientgroupitemdata.cpp +++ /dev/null @@ -1,353 +0,0 @@ - -////////////////////////////////////////////////////////////////////////////// -// oxygenclientgroupitemdata.cpp -// handles tabs' geometry and animations -// ------------------- -// -// Copyright (c) 2009 Hugo Pereira Da Costa - -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -////////////////////////////////////////////////////////////////////////////// - -#include "oxygenclientgroupitemdata.h" -#include "oxygenclientgroupitemdata.moc" -#include "oxygenclient.h" - -namespace Oxygen -{ - - //____________________________________________________________________________ - ClientGroupItemDataList::ClientGroupItemDataList( Client* parent ): - QObject( parent ), - QList(), - _client( *parent ), - _dirty( false ), - animationsEnabled_( true ), - _animation( new Animation( 150, this ) ), - animationType_( AnimationNone ), - progress_(0), - draggedItem_( NoItem ), - targetItem_( NoItem ) - { - - // setup animation - animation().data()->setStartValue( 0 ); - animation().data()->setEndValue( 1.0 ); - animation().data()->setTargetObject( this ); - animation().data()->setPropertyName( "progress" ); - - } - - //________________________________________________________________ - int ClientGroupItemDataList::itemAt( const QPoint& point, bool between ) const - { - - for( int i=0; i < count(); i++ ) - { - QRect rect = at(i)._activeRect; - if( between ) rect.translate( -rect.width() / 2, 0 ); - if( rect.adjusted(0,0,0,2).contains( point ) ) - { return i; } - } - - return NoItem; - - } - - //____________________________________________________________________________ - void ClientGroupItemDataList::animate( AnimationTypes type, int target ) - { - - // store animation type - animationType_ = type; - - if( type == AnimationNone ) - { - - if( isAnimationRunning() ) animation().data()->stop(); - targetItem_ = NoItem; - draggedItem_ = NoItem; - targetRect_ = QRect(); - - } else if( type & (AnimationEnter|AnimationMove ) ) { - - // store dragged item - bool animate( true ); - - if( (type&AnimationSameTarget) && draggedItem_ == NoItem ) - { - - animate = false; - draggedItem_ = target; - - } else if( (type&AnimationMove) && targetItem_ == target ) return; - - // check animation state - if( isAnimationRunning() ) animation().data()->stop(); - - targetItem_ = target; - targetRect_ = QRect(); - QRect titleRect( _client.titleRect() ); - int left( titleRect.left() ); - int width = (type&AnimationSameTarget) ? - titleRect.width()/count(): - titleRect.width()/(count()+1); - - if( (type&AnimationSameTarget) && draggedItem_ < target ) - { - target++; - if( target >= count() ) target = NoItem; - } - - // loop over items and update bounding rects - for( int index = 0; index < count(); index++ ) - { - - ClientGroupItemData& item( ClientGroupItemDataList::operator[](index) ); - if( index == target ) - { - targetRect_ = item._refBoundingRect; - targetRect_.setLeft( left ); - targetRect_.setWidth( width ); - left+=width; - } - - item._startBoundingRect = item._boundingRect; - item._endBoundingRect = item._refBoundingRect; - item._endBoundingRect.setLeft( left ); - - if( (type&AnimationSameTarget) && index == draggedItem_ ) - { - - item._endBoundingRect.setWidth( 0 ); - - } else { - - item._endBoundingRect.setWidth( width ); - left+=width; - - } - - } - - if( targetRect_.isNull() ) - { - targetRect_ = back()._refBoundingRect; - targetRect_.setLeft( left ); - targetRect_.setWidth( width ); - } - - if( animate ) - { - - if( animationsEnabled() ) animation().data()->start(); - else { - - // change progress to maximum - progress_ = 1; - updateBoundingRects(); - - } - - } else { - - for( int index = 0; index < count(); index++ ) - { - ClientGroupItemData& item( ClientGroupItemDataList::operator[](index) ); - item._boundingRect = item._endBoundingRect; - } - - updateButtons( true ); - - } - - } else if( type & AnimationLeave ) { - - // stop animation state - if( isAnimationRunning() ) animation().data()->stop(); - - // reset target - targetItem_ = NoItem; - targetRect_ = QRect(); - - if( type & AnimationSameTarget ) - { - - // store dragged item - draggedItem_ = target; - - // do nothing if only one item - if( count() <= 1 ) return; - - QRect titleRect( _client.titleRect() ); - int left( titleRect.left() ); - int width = titleRect.width()/(count()-1); - - // loop over items and update bounding rects - for( int index = 0; index < count(); index++ ) - { - - ClientGroupItemData& item( ClientGroupItemDataList::operator[](index) ); - item._startBoundingRect = item._boundingRect; - item._endBoundingRect = item._refBoundingRect; - item._endBoundingRect.setLeft( left ); - if( index != target ) - { - - if( count() <= 2 ) - { - - item._endBoundingRect = _client.defaultTitleRect( _client.tabId(index) == _client.currentTabId() ); - - } else { - - - item._endBoundingRect.setWidth( width ); - left+=width; - - } - - } else { - - item._endBoundingRect.setWidth( 0 ); - - } - - } - - } else { - - // loop over items and update bounding rects - for( int index = 0; index < count(); index++ ) - { - ClientGroupItemData& item( ClientGroupItemDataList::operator[](index) ); - item._startBoundingRect = item._boundingRect; - item._endBoundingRect = item._refBoundingRect; - } - - } - - if( animationsEnabled() ) animation().data()->start(); - else { - - // change progress to maximum - progress_ = 1; - updateBoundingRects(); - - } - - } - - return; - - } - - //____________________________________________________________________________ - void ClientGroupItemDataList::updateButtonActivity( long visibleItem ) const - { - - for( int index = 0; index < count(); index++ ) - { - - const ClientGroupItemData& item( at(index) ); - if( item._closeButton ) - { item._closeButton.data()->setForceInactive( _client.tabId(index) != visibleItem ); } - - } - - } - - //____________________________________________________________________________ - void ClientGroupItemDataList::updateButtons( bool alsoUpdate ) const - { - - // move close buttons - if( alsoUpdate ) _client.widget()->setUpdatesEnabled( false ); - for( int index = 0; index < count(); index++ ) - { - - const ClientGroupItemData& item( at(index) ); - if( !item._closeButton ) continue; - - if( (!item._boundingRect.isValid()) || ((animationType_ & AnimationSameTarget)&&count()<=2 ) ) - { - - item._closeButton.data()->hide(); - - } else { - - QPoint position( - item._boundingRect.right() - _client.buttonSize() - _client.layoutMetric(KCommonDecoration::LM_TitleEdgeRight), - item._boundingRect.top() + _client.layoutMetric( KCommonDecoration::LM_TitleEdgeTop ) ); - - if( item._closeButton.data()->isHidden() ) item._closeButton.data()->show(); - item._closeButton.data()->move( position ); - - } - - } - - if( alsoUpdate ) - { - _client.widget()->setUpdatesEnabled( true ); - _client.updateTitleRect(); - } - - } - - //____________________________________________________________________________ - void ClientGroupItemDataList::updateBoundingRects( bool alsoUpdate ) - { - - qreal ratio( progress() ); - for( iterator iter = begin(); iter != end(); ++iter ) - { - - // left - if( iter->_endBoundingRect.left() == iter->_startBoundingRect.left() ) - { - - iter->_boundingRect.setLeft( iter->_startBoundingRect.left() ); - - } else { - - iter->_boundingRect.setLeft( (1.0-ratio)*iter->_startBoundingRect.left() + ratio*iter->_endBoundingRect.left() ); - - } - - // right - if( iter->_endBoundingRect.right() == iter->_startBoundingRect.right() ) - { - - iter->_boundingRect.setRight( iter->_startBoundingRect.right() ); - - } else { - - iter->_boundingRect.setRight( (1.0-ratio)*iter->_startBoundingRect.right() + ratio*iter->_endBoundingRect.right() ); - - } - - } - - // update button position - updateButtons( alsoUpdate ); - - } -} diff --git a/clients/oxygen/oxygenclientgroupitemdata.h b/clients/oxygen/oxygenclientgroupitemdata.h deleted file mode 100644 index ae5e65df0..000000000 --- a/clients/oxygen/oxygenclientgroupitemdata.h +++ /dev/null @@ -1,223 +0,0 @@ -#ifndef oxygenclientgroupitemdata_h -#define oxygenclientgroupitemdata_h - -////////////////////////////////////////////////////////////////////////////// -// oxygenclientgroupitemdata.h -// handles tabs' geometry and animations -// ------------------- -// -// Copyright (c) 2009 Hugo Pereira Da Costa -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -////////////////////////////////////////////////////////////////////////////// - -#include "oxygenbutton.h" -#include "oxygenanimation.h" - -#include -#include -#include - -namespace Oxygen -{ - - class Client; - - //! animation type - enum AnimationType { - AnimationNone = 0, - AnimationEnter = 1<<0, - AnimationMove = 1<<1, - AnimationLeave = 1<<2, - AnimationSameTarget = 1<<3 - }; - - Q_DECLARE_FLAGS(AnimationTypes, AnimationType) - - //! tab data - class ClientGroupItemData - { - - public: - - //! constructor - explicit ClientGroupItemData( void ) - {} - - //! destructor - virtual ~ClientGroupItemData( void ) - {} - - //! reset all rects to argument - void reset( const QRect& rect ) - { - _refBoundingRect = rect; - _startBoundingRect = rect; - _endBoundingRect = rect; - _boundingRect = rect; - } - - //! tab active rect - QRect _activeRect; - - //! reference bounding rect - /*! it is usually identical to activeRect unless there is only one tab in window */ - QRect _refBoundingRect; - - //! tab drawing rect - QRect _startBoundingRect; - - //! tab drawing rect - QRect _endBoundingRect; - - //! tab drawing rect - QRect _boundingRect; - - //! tab button - typedef QPointer