diff --git a/CMakeLists.txt b/CMakeLists.txt index 618404e8..eb427d76 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,129 +1,118 @@ cmake_minimum_required(VERSION 3.0) set(KF5_VERSION "5.42.0") # handled by release scripts set(KF5_DEP_VERSION "5.41.0") # handled by release scripts project(kirigami2 VERSION ${KF5_VERSION}) set(REQUIRED_QT_VERSION "5.7.0") ################# Disallow in-source build ################# if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") message(FATAL_ERROR "kirigami requires an out of source build. Please create a separate build directory and run 'cmake path_to_kirigami [options]' there.") endif() -option(PLASMA_ENABLED "Build and install The Plasma style" ON) option(DESKTOP_ENABLED "Build and install The Desktop style" ON) option(STATIC_LIBRARY "Build as a static library" OFF) option(BUILD_EXAMPLES "Build and install examples" OFF) # Make CPack available to easy generate binary packages include(CPack) include(FeatureSummary) IF(STATIC_LIBRARY) set(CMAKE_AUTOMOC ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) ADD_DEFINITIONS(-DKIRIGAMI_BUILD_TYPE_STATIC) find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE COMPONENTS Core Quick Test Gui Svg) add_subdirectory(src) ELSE(STATIC_LIBRARY) ################# set KDE specific information ################# find_package(ECM 5.41.0 NO_MODULE) set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://projects.kde.org/projects/kdesupport/extra-cmake-modules") # 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(GenerateExportHeader) include(ECMSetupVersion) include(ECMGenerateHeaders) include(CMakePackageConfigHelpers) include(ECMPoQmTools) include(ECMQMLModules) include(KDEInstallDirs) include(KDECMakeSettings) include(ECMQtDeclareLoggingCategory) include(ECMAddQch) include(KDECompilerSettings NO_POLICY_SCOPE) set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5Kirigami2") option(BUILD_QCH "Build API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)" OFF) add_feature_info(QCH ${BUILD_QCH} "API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)") configure_package_config_file( "${CMAKE_CURRENT_SOURCE_DIR}/KF5Kirigami2Config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/KF5Kirigami2Config.cmake" INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR} PATH_VARS KF5_INCLUDE_INSTALL_DIR CMAKE_INSTALL_PREFIX ) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/KF5Kirigami2Config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/KF5Kirigami2ConfigVersion.cmake" "${CMAKE_CURRENT_SOURCE_DIR}/KF5Kirigami2Macros.cmake" DESTINATION "${CMAKECONFIG_INSTALL_DIR}" COMPONENT Devel ) install(EXPORT KF5Kirigami2Targets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF5Kirigami2Targets.cmake NAMESPACE KF5::) ecm_setup_version(${KF5_VERSION} VARIABLE_PREFIX KIRIGAMI2 VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kirigami_version.h" PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5Kirigami2ConfigVersion.cmake" SOVERSION 5) find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE COMPONENTS Core Quick Test Gui Svg QuickControls2) if(BUILD_EXAMPLES AND CMAKE_SYSTEM_NAME STREQUAL "Android") -# treat plasma as an optinal dep: full functionality is expected with only Qt find_package(Qt5AndroidExtras ${REQUIRED_QT_VERSION} REQUIRED) endif() -if(PLASMA_ENABLED) -# treat plasma as an optional dep: full functionality is expected with only Qt -find_package(KF5 ${KF5_DEP_VERSION} COMPONENTS Plasma) -set_package_properties(KF5Plasma PROPERTIES DESCRIPTION "Plasma framework" - TYPE OPTIONAL - PURPOSE "Optional Look and feel integration with Plasma Mobile." - ) -endif() - ecm_find_qmlmodule(QtGraphicalEffects 1.0) ################# Enable C++11 features for clang and gcc ################# if(UNIX) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++0x") endif() ######################################################################### add_definitions(-DQT_NO_URL_CAST_FROM_STRING) add_subdirectory(autotests) add_subdirectory(src) if (BUILD_EXAMPLES) add_subdirectory(examples) endif() ENDIF(STATIC_LIBRARY) if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/po") ecm_install_po_files_as_qm(po) endif() feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 48035b23..2a6bea2d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,76 +1,71 @@ project(kirigami) if (NOT STATIC_LIBRARY) ecm_create_qm_loader(kirigami_QM_LOADER libkirigami2plugin_qt) else() set(KIRIGAMI_STATIC_FILES libkirigami/basictheme.cpp libkirigami/platformtheme.cpp libkirigami/kirigamipluginfactory.cpp) endif() include_directories(${CMAKE_CURRENT_SOURCE_DIR}/libkirigami ${CMAKE_CURRENT_BINARY_DIR}/libkirigami) set(kirigami_SRCS kirigamiplugin.cpp enums.cpp desktopicon.cpp settings.cpp formlayoutattached.cpp mnemonicattached.cpp ${kirigami_QM_LOADER} ${KIRIGAMI_STATIC_FILES} ) IF(STATIC_LIBRARY) qt5_add_resources(RESOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../kirigami.qrc) add_library(kirigamiplugin STATIC ${kirigami_SRCS} ${RESOURCES}) target_link_libraries(kirigamiplugin Qt5::Core Qt5::Qml Qt5::Quick Qt5::QuickControls2) ELSE(STATIC_LIBRARY) add_subdirectory(libkirigami) add_library(kirigamiplugin SHARED ${kirigami_SRCS}) set_target_properties(kirigamiplugin PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/org/kde/kirigami.2) target_link_libraries(kirigamiplugin KF5::Kirigami2 Qt5::Core Qt5::Qml Qt5::Quick Qt5::QuickControls2) add_custom_target(copy) file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin/org/kde/kirigami.2) add_custom_command(TARGET copy PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/controls ${CMAKE_BINARY_DIR}/bin/org/kde/kirigami.2/) add_custom_command(TARGET copy PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/styles ${CMAKE_BINARY_DIR}/bin/org/kde/kirigami.2/styles) add_dependencies(kirigamiplugin copy) install(TARGETS kirigamiplugin DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/kirigami.2) install(DIRECTORY controls/ DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/kirigami.2) -if (PLASMA_ENABLED) - install(DIRECTORY styles/Plasma DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/kirigami.2/styles) -endif() if (DESKTOP_ENABLED) install(DIRECTORY styles/org.kde.desktop DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/kirigami.2/styles) endif() -if (PLASMA_ENABLED AND DESKTOP_ENABLED) -install(DIRECTORY styles/org.kde.desktop.plasma DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/kirigami.2/styles) -endif() + install(DIRECTORY styles/Material DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/kirigami.2/styles) install(FILES ${platformspecific} DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/kirigami.2) include(ECMGeneratePriFile) ecm_generate_pri_file(BASE_NAME Kirigami2 LIB_NAME KF5Kirigami2 DEPS "core qml quick svg" FILENAME_VAR PRI_FILENAME ) install(FILES ${PRI_FILENAME} DESTINATION ${ECM_MKSPECS_INSTALL_DIR}) ENDIF(STATIC_LIBRARY) diff --git a/src/styles/Plasma/Icon.qml b/src/styles/Plasma/Icon.qml deleted file mode 100644 index 04878d39..00000000 --- a/src/styles/Plasma/Icon.qml +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2015 Marco Martin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -import QtQuick 2.0 -import org.kde.plasma.core 2.0 as PlasmaCore - - -PlasmaCore.IconItem { - property bool selected: false - property bool isMask: false - //TODO: implement in libplasma - property color color: "transparent" - usesPlasmaTheme: false - colorGroup: PlasmaCore.ColorScope.colorGroup - onSelectedChanged: { - if (selected) { - status = PlasmaCore.Svg.Selected; - } else { - status = PlasmaCore.Svg.Normal; - } - } -} diff --git a/src/styles/Plasma/Theme.qml b/src/styles/Plasma/Theme.qml deleted file mode 100644 index b00500b6..00000000 --- a/src/styles/Plasma/Theme.qml +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 2015 Marco Martin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -pragma Singleton - -import QtQuick 2.4 -import org.kde.plasma.core 2.0 as PlasmaCore -import org.kde.kirigami 2.2 as Kirigami - -QtObject { - property color textColor: theme.textColor - property color disabledTextColor: Qt.rgba(theme.textColor.r, theme.textColor.g, theme.textColor.b, 0.6) - - property color highlightColor: theme.highlightColor - property color highlightedTextColor: theme.highlightedTextColor - property color backgroundColor: theme.backgroundColor - //TODO: don't make this invisible - property color activeTextColor: theme.highlightColor - property color linkColor: theme.linkColor - property color visitedLinkColor: theme.visitedLinkColor - property color negativeTextColor: theme.negativeTextColor - property color neutralTextColor: theme.neutralTextColor - property color positiveTextColor: theme.positiveTextColor - - property color buttonTextColor: theme.buttonTextColor - property color buttonBackgroundColor: theme.buttonBackgroundColor - property color buttonHoverColor: theme.buttonHoverColor - property color buttonFocusColor: theme.buttonFocusColor - - property color viewTextColor: theme.viewTextColor - property color viewBackgroundColor: theme.viewBackgroundColor - property color viewHoverColor: theme.viewHoverColor - property color viewFocusColor: theme.viewFocusColor - - property color selectionTextColor: theme.highlightedTextColor - property color selectionBackgroundColor: theme.highlightColor - property color selectionHoverColor: theme.buttonHoverColor - property color selectionFocusColor: theme.buttonFocusColor - - property color tooltipTextColor: theme.complementaryTextColor - property color tooltipBackgroundColor: theme.complementaryBackgroundColor - property color tooltipHoverColor: theme.complementaryHoverColor - property color tooltipFocusColor: theme.complementaryFocusColor - - property color complementaryTextColor: theme.complementaryTextColor - property color complementaryBackgroundColor: theme.complementaryBackgroundColor - property color complementaryHoverColor: theme.complementaryHoverColor - property color complementaryFocusColor: theme.complementaryFocusColor - - property variant defaultFont: theme.defaultFont - - function __propagateColorSet(object, context) { - object.PlasmaCore.ColorScope.inherit = false; - switch(context) { - case Kirigami.Theme.Window: - object.PlasmaCore.ColorScope.colorGroup = PlasmaCore.Theme.NormalColorGroup; - break; - case Kirigami.Theme.Button: - object.PlasmaCore.ColorScope.colorGroup = PlasmaCore.Theme.ButtonColorGroup; - break; - case Kirigami.Theme.View: - object.PlasmaCore.ColorScope.colorGroup = PlasmaCore.Theme.ViewColorGroup; - break; - case Kirigami.Theme.Selection: - object.PlasmaCore.ColorScope.colorGroup = PlasmaCore.Theme.NormalColorGroup; - break; - case Kirigami.Theme.Tooltip: - object.PlasmaCore.ColorScope.colorGroup = PlasmaCore.Theme.ComplementaryColorGroup; - break; - case Kirigami.Theme.Complementary: - object.PlasmaCore.ColorScope.colorGroup = PlasmaCore.Theme.ComplementaryColorGroup; - break; - } - } -} diff --git a/src/styles/Plasma/Units.qml b/src/styles/Plasma/Units.qml deleted file mode 100644 index cfa10b4c..00000000 --- a/src/styles/Plasma/Units.qml +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright 2015 Marco Martin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -pragma Singleton - -import QtQuick 2.4 -import org.kde.plasma.core 2.0 as PlasmaCore - - -QtObject { - /** - * The fundamental unit of space that should be used for sizes, expressed in pixels. - * Given the screen has an accurate DPI settings, it corresponds to a width of - * the capital letter M - */ - property int gridUnit: units.gridUnit - - /** - * units.iconSizes provides access to platform-dependent icon sizing - * - * The icon sizes provided are normalized for different DPI, so icons - * will scale depending on the DPI. - * - * Icon sizes from KIconLoader, adjusted to devicePixelRatio: - * * small - * * smallMedium - * * medium - * * large - * * huge - * * enormous - * - * Not devicePixelRation-adjusted:: - * * desktop - */ - property QtObject iconSizes: QtObject { - property int small: units.iconSizes.small - property int smallMedium: units.iconSizes.smallMedium - property int medium: units.iconSizes.medium - property int large: units.iconSizes.large - property int huge: units.iconSizes.huge - property int enormous: units.iconSizes.enormous - } - - /** - * units.smallSpacing is the amount of spacing that should be used around smaller UI elements, - * for example as spacing in Columns. Internally, this size depends on the size of - * the default font as rendered on the screen, so it takes user-configured font size and DPI - * into account. - */ - property int smallSpacing: units.smallSpacing - - /** - * units.largeSpacing is the amount of spacing that should be used inside bigger UI elements, - * for example between an icon and the corresponding text. Internally, this size depends on - * the size of the default font as rendered on the screen, so it takes user-configured font - * size and DPI into account. - */ - property int largeSpacing: units.largeSpacing - - /** - * The ratio between physical and device-independent pixels. This value does not depend on the \ - * size of the configured font. If you want to take font sizes into account when scaling elements, - * use theme.mSize(theme.defaultFont), units.smallSpacing and units.largeSpacing. - * The devicePixelRatio follows the definition of "device independent pixel" by Microsoft. - */ - property real devicePixelRatio: units.devicePixelRatio - - /** - * units.longDuration should be used for longer, screen-covering animations, for opening and - * closing of dialogs and other "not too small" animations - */ - property int longDuration: units.longDuration - - /** - * units.shortDuration should be used for short animations, such as accentuating a UI event, - * hover events, etc.. - */ - property int shortDuration: units.shortDuration - - /** - * How much the mouse scroll wheel scrolls, expressed in lines of text. - * Note: this is strictly for classical mouse wheels, touchpads 2 figer scrolling won't be affected - */ - property int wheelScrollLines: 3 - - /** - * metrics used by the default font - */ - property variant fontMetrics: TextMetrics { - text: "M" - } -} diff --git a/src/styles/org.kde.desktop.plasma/Units.qml b/src/styles/org.kde.desktop.plasma/Units.qml deleted file mode 100644 index dd820e62..00000000 --- a/src/styles/org.kde.desktop.plasma/Units.qml +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright 2015 Marco Martin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -import QtQuick 2.4 -import QtQuick.Window 2.2 -import org.kde.plasma.core 2.0 as PlasmaCore -import QtQuick.Controls 1.4 as QtQuickControls -import QtQuick.Controls.Private 1.0 as QtQuickControlsPrivate - -pragma Singleton - - -QtObject { - id: unitsRoot - - /** - * The fundamental unit of space that should be used for sizes, expressed in pixels. - * Given the screen has an accurate DPI settings, it corresponds to a width of - * the capital letter M - */ - property int gridUnit: fontMetrics.height - - /** - * units.iconSizes provides access to platform-dependent icon sizing - * - * The icon sizes provided are normalized for different DPI, so icons - * will scale depending on the DPI. - * - * Icon sizes from KIconLoader, adjusted to devicePixelRatio: - * * small - * * smallMedium - * * medium - * * large - * * huge - * * enormous - * - * Not devicePixelRation-adjusted:: - * * desktop - */ - property QtObject iconSizes: QtObject { - property int small: fontMetrics.roundedIconSize(16 * devicePixelRatio) - property int smallMedium: fontMetrics.roundedIconSize(22 * devicePixelRatio) - property int medium: fontMetrics.roundedIconSize(32 * devicePixelRatio) - property int large: fontMetrics.roundedIconSize(48 * devicePixelRatio) - property int huge: fontMetrics.roundedIconSize(64 * devicePixelRatio) - property int enormous: 128 * devicePixelRatio - } - - /** - * units.smallSpacing is the amount of spacing that should be used around smaller UI elements, - * for example as spacing in Columns. Internally, this size depends on the size of - * the default font as rendered on the screen, so it takes user-configured font size and DPI - * into account. - */ - property int smallSpacing: Math.floor(gridUnit/4) - - /** - * units.largeSpacing is the amount of spacing that should be used inside bigger UI elements, - * for example between an icon and the corresponding text. Internally, this size depends on - * the size of the default font as rendered on the screen, so it takes user-configured font - * size and DPI into account. - */ - property int largeSpacing: gridUnit - - /** - * The ratio between physical and device-independent pixels. This value does not depend on the \ - * size of the configured font. If you want to take font sizes into account when scaling elements, - * use theme.mSize(theme.defaultFont), units.smallSpacing and units.largeSpacing. - * The devicePixelRatio follows the definition of "device independent pixel" by Microsoft. - */ - property real devicePixelRatio: Math.max(1, (fontMetrics.font.pixelSize / fontMetrics.font.pointSize)) - - /** - * units.longDuration should be used for longer, screen-covering animations, for opening and - * closing of dialogs and other "not too small" animations - */ - property int longDuration: units.longDuration - - /** - * units.shortDuration should be used for short animations, such as accentuating a UI event, - * hover events, etc.. - */ - property int shortDuration: units.shortDuration - - readonly property QtObject __styleItem: QtQuickControlsPrivate.StyleItem {elementType: "frame" } - - /** - * How much the mouse scroll wheel scrolls, expressed in lines of text. - * Note: this is strictly for classical mouse wheels, touchpads 2 figer scrolling won't be affected - */ - readonly property int wheelScrollLines: __styleItem.styleHint("wheelScrollLines") - - property variant fontMetrics: TextMetrics { - text: "M" - function roundedIconSize(size) { - if (size < 16) { - return size; - } else if (size < 22) { - return 16; - } else if (size < 32) { - return 22; - } else if (size < 48) { - return 32; - } else if (size < 64) { - return 48; - } else { - return size; - } - } - } -}