diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -40,17 +40,23 @@
# 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"
@@ -66,9 +72,14 @@
COMPONENT Devel
)
+install(EXPORT KF5Kirigami2Targets
+ DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
+ FILE KF5Kirigami2Targets.cmake
+ NAMESPACE KF5::)
+
ecm_setup_version(${KF5_VERSION}
- VARIABLE_PREFIX KIRIGAMI
+ VARIABLE_PREFIX KIRIGAMI2
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kirigami_version.h"
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5Kirigami2ConfigVersion.cmake"
SOVERSION 5)
diff --git a/KF5Kirigami2Config.cmake.in b/KF5Kirigami2Config.cmake.in
--- a/KF5Kirigami2Config.cmake.in
+++ b/KF5Kirigami2Config.cmake.in
@@ -1,11 +1,15 @@
@PACKAGE_INIT@
+include(CMakeFindDependencyMacro)
+find_dependency(Qt5Core @REQUIRED_QT_VERSION@)
+
# Any changes in this ".cmake" file will be overwritten by CMake, the source is the ".cmake.in" file.
-#include("${CMAKE_CURRENT_LIST_DIR}/KF5KirigamiTargets.cmake")
+include("${CMAKE_CURRENT_LIST_DIR}/KF5Kirigami2Targets.cmake")
-set(Kirigami_INSTALL_PREFIX "@PACKAGE_CMAKE_INSTALL_PREFIX@")
+set(Kirigami2_INSTALL_PREFIX "@PACKAGE_CMAKE_INSTALL_PREFIX@")
-#set(Kirigami_LIBRARIES KF5::Kirigami)
+#set(Kirigami2_LIBRARIES KF5::Kirigami2)
include("${CMAKE_CURRENT_LIST_DIR}/KF5Kirigami2Macros.cmake")
+@PACKAGE_INCLUDE_QCHTARGETS@
diff --git a/KF5Kirigami2Macros.cmake b/KF5Kirigami2Macros.cmake
--- a/KF5Kirigami2Macros.cmake
+++ b/KF5Kirigami2Macros.cmake
@@ -13,7 +13,7 @@
endif()
#include icons used by Kirigami components themselves
- set(ARG_ICONS ${ARG_ICONS} go-next go-previous go-up handle-left handle-right)
+ set(ARG_ICONS ${ARG_ICONS} go-next go-previous go-up handle-left handle-right go-next-symbolic go-next-symbolic-rtl go-previous-symbolic go-previous-symbolic-rtl)
function(_find_breeze_icon icon varName)
#HACKY
@@ -28,6 +28,9 @@
endif()
endif()
if (NOT EXISTS ${path})
+ file(GLOB_RECURSE path ${_BREEZEICONS_DIR}/icons/*/symbolic/${icon}.svg )
+ endif()
+ if (NOT EXISTS ${path})
return()
endif()
diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -22,11 +22,15 @@
cd build
cmake .. \
-DQTANDROID_EXPORTED_TARGET=kirigami2gallery \
+ -DBUILD_EXAMPLES=on \
-DANDROID_APK_DIR=../examples/galleryapp \
-DECM_DIR=/path/to/share/ECM/cmake \
-DCMAKE_TOOLCHAIN_FILE=/usr/share/ECM/toolchain/Android.cmake \
-DECM_ADDITIONAL_FIND_ROOT_PATH=/path/to/Qt5.7.0/5.7/{arch} \
- -DCMAKE_PREFIX_PATH=/path/to/Qt5.7.0/5.7/{arch}/path/to/Qt5Core
+ -DCMAKE_PREFIX_PATH=/path/to/Qt5.7.0/5.7/{arch}/path/to/Qt5Core \
+ -DANDROID_NDK=/path/to/Android/Sdk/ndk-bundle \
+ -DANDROID_SDK_ROOT=/path/to/Android/Sdk/ \
+ -DANDROID_SDK_BUILD_TOOLS_REVISION=26.0.2
```
You need a `-DCMAKE_INSTALL_PREFIX` to somewhere in your home, but using an absolute path.
diff --git a/autotests/tst_keynavigation.qml b/autotests/tst_keynavigation.qml
--- a/autotests/tst_keynavigation.qml
+++ b/autotests/tst_keynavigation.qml
@@ -20,7 +20,7 @@
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Window 2.1
-import org.kde.kirigami 2.0 as Kirigami
+import org.kde.kirigami 2.2 as Kirigami
import QtTest 1.0
import "../tests"
diff --git a/autotests/tst_listskeynavigation.qml b/autotests/tst_listskeynavigation.qml
--- a/autotests/tst_listskeynavigation.qml
+++ b/autotests/tst_listskeynavigation.qml
@@ -21,7 +21,7 @@
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Window 2.1
-import org.kde.kirigami 2.0 as Kirigami
+import org.kde.kirigami 2.2 as Kirigami
import QtTest 1.0
import "../tests"
diff --git a/autotests/tst_pagerow.qml b/autotests/tst_pagerow.qml
--- a/autotests/tst_pagerow.qml
+++ b/autotests/tst_pagerow.qml
@@ -20,7 +20,7 @@
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Window 2.1
-import org.kde.kirigami 2.0 as Kirigami
+import org.kde.kirigami 2.2 as Kirigami
import QtTest 1.0
TestCase {
diff --git a/examples/applicationitemapp/main.qml b/examples/applicationitemapp/main.qml
--- a/examples/applicationitemapp/main.qml
+++ b/examples/applicationitemapp/main.qml
@@ -18,7 +18,7 @@
*/
import QtQuick 2.1
-import org.kde.kirigami 2.1 as Kirigami
+import org.kde.kirigami 2.2 as Kirigami
Kirigami.ApplicationItem {
id: root
diff --git a/examples/galleryapp/CMakeLists.txt b/examples/galleryapp/CMakeLists.txt
--- a/examples/galleryapp/CMakeLists.txt
+++ b/examples/galleryapp/CMakeLists.txt
@@ -1,12 +1,40 @@
+find_package(KF5Kirigami2 ${KF5_DEP_VERSION})
+
set(kirigami2gallery_SRCS
main.cpp
)
qt5_add_resources(RESOURCES resources.qrc)
if (CMAKE_SYSTEM_NAME STREQUAL "Android")
- set(kirigami2gallery_EXTRA_LIBS Qt5::AndroidExtras Qt5::QuickControls2)
+ set(kirigami2gallery_EXTRA_LIBS Qt5::AndroidExtras
+ #FIXME: we shouldn't have to link to it but otherwise the lib won't be packaged on Android
+ Qt5::QuickControls2 KF5::Kirigami2)
+endif()
+
+find_program(kpackagetool_cmd kpackagetool5)
+if (kpackagetool_cmd)
+ set(component org.kde.kirigami2.gallery)
+ set(APPDATAFILE "${CMAKE_CURRENT_BINARY_DIR}/${component}.appdata.xml")
+
+ message(STATUS "${kpackagetool_cmd} --appstream-metainfo ${CMAKE_CURRENT_SOURCE_DIR}/../gallerydata --appstream-metainfo-output ${APPDATAFILE}")
+ execute_process(
+ COMMAND ${kpackagetool_cmd} --appstream-metainfo ${CMAKE_CURRENT_SOURCE_DIR}/../gallerydata --appstream-metainfo-output ${APPDATAFILE}
+ ERROR_VARIABLE appstreamerror
+ RESULT_VARIABLE result)
+ if (NOT result EQUAL 0)
+ message(WARNING "couldn't generate metainfo for ${component}: ${appstreamerror}")
+ else()
+ if(appstreamerror)
+ message(WARNING "warnings during generation of metainfo for ${component}: ${appstreamerror}")
+ endif()
+
+ # OPTIONAL because desktop files can be NoDisplay so they render no XML.
+ install(FILES ${APPDATAFILE} DESTINATION ${KDE_INSTALL_METAINFODIR} OPTIONAL)
+ endif()
+else()
+ message(WARNING "KPackage components should be specified in reverse domain notation. Appstream information won't be generated for ${component}.")
endif()
find_program(kpackagetool_cmd kpackagetool5)
@@ -39,4 +67,4 @@
install(TARGETS kirigami2gallery ${KF5_INSTALL_TARGETS_DEFAULT_ARGS})
include(${CMAKE_SOURCE_DIR}/KF5Kirigami2Macros.cmake)
-kirigami_package_breeze_icons(ICONS applications-graphics view-list-icons folder-sync view-list-details configure document-edit dialog-cancel document-decrypt mail-reply-sender bookmarks folder)
+kirigami_package_breeze_icons(ICONS applications-graphics view-list-icons folder-sync view-list-details configure document-edit dialog-cancel document-decrypt mail-reply-sender bookmarks folder media-record-symbolic)
diff --git a/examples/galleryapp/resources.qrc b/examples/galleryapp/resources.qrc
--- a/examples/galleryapp/resources.qrc
+++ b/examples/galleryapp/resources.qrc
@@ -19,6 +19,7 @@
../gallerydata/contents/ui/gallery/MetricsGallery.qml
../gallerydata/contents/ui/gallery/LayersGallery.qml
../gallerydata/contents/ui/ExampleApp.qml
+ ../gallerydata/contents/ui/gallery/ColorSetGallery.qml
../gallerydata/contents/ui/DesktopExampleApp.qml
../gallerydata/metadata.desktop
qtquickcontrols2.conf
diff --git a/examples/gallerydata/contents/ui/DesktopExampleApp.qml b/examples/gallerydata/contents/ui/DesktopExampleApp.qml
--- a/examples/gallerydata/contents/ui/DesktopExampleApp.qml
+++ b/examples/gallerydata/contents/ui/DesktopExampleApp.qml
@@ -20,7 +20,7 @@
import QtQuick 2.1
import QtQuick.Controls 2.0 as Controls
import QtQuick.Layouts 1.2
-import org.kde.kirigami 2.0 as Kirigami
+import org.kde.kirigami 2.2 as Kirigami
import "gallery"
Kirigami.ApplicationWindow {
diff --git a/examples/gallerydata/contents/ui/ExampleApp.qml b/examples/gallerydata/contents/ui/ExampleApp.qml
--- a/examples/gallerydata/contents/ui/ExampleApp.qml
+++ b/examples/gallerydata/contents/ui/ExampleApp.qml
@@ -20,7 +20,7 @@
import QtQuick 2.1
import QtQuick.Controls 2.0 as Controls
import QtQuick.Layouts 1.2
-import org.kde.kirigami 2.1 as Kirigami
+import org.kde.kirigami 2.2 as Kirigami
import "gallery"
Kirigami.ApplicationWindow {
diff --git a/examples/gallerydata/contents/ui/MainPage.qml b/examples/gallerydata/contents/ui/MainPage.qml
--- a/examples/gallerydata/contents/ui/MainPage.qml
+++ b/examples/gallerydata/contents/ui/MainPage.qml
@@ -20,14 +20,14 @@
import QtQuick 2.1
import QtQuick.Controls 2.0 as QQC2
import QtQuick.Layouts 1.2
-import org.kde.kirigami 2.0 as Kirigami
+import org.kde.kirigami 2.2 as Kirigami
Kirigami.ScrollablePage {
id: pageRoot
implicitWidth: Kirigami.Units.gridUnit * 20
background: Rectangle {
- color: Kirigami.Theme.viewBackgroundColor
+ color: Kirigami.Theme.backgroundColor
}
title: "Gallery"
@@ -123,6 +123,10 @@
component: "Colors"
}
ListElement {
+ text: "Color Sets"
+ component: "ColorSet"
+ }
+ ListElement {
text: "Metrics"
component: "Metrics"
}
diff --git a/examples/gallerydata/contents/ui/gallery/ButtonGallery.qml b/examples/gallerydata/contents/ui/gallery/ButtonGallery.qml
--- a/examples/gallerydata/contents/ui/gallery/ButtonGallery.qml
+++ b/examples/gallerydata/contents/ui/gallery/ButtonGallery.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtQuick.Controls 2.0 as Controls
import QtQuick.Layouts 1.2
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
ScrollablePage {
id: page
diff --git a/examples/gallerydata/contents/ui/gallery/CheckBoxGallery.qml b/examples/gallerydata/contents/ui/gallery/CheckBoxGallery.qml
--- a/examples/gallerydata/contents/ui/gallery/CheckBoxGallery.qml
+++ b/examples/gallerydata/contents/ui/gallery/CheckBoxGallery.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtQuick.Controls 2.0 as Controls
import QtQuick.Layouts 1.2
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
ScrollablePage {
id: page
diff --git a/examples/gallerydata/contents/ui/gallery/ColorSetGallery.qml b/examples/gallerydata/contents/ui/gallery/ColorSetGallery.qml
new file mode 100644
--- /dev/null
+++ b/examples/gallerydata/contents/ui/gallery/ColorSetGallery.qml
@@ -0,0 +1,180 @@
+/*
+ * Copyright 2017 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 QtQuick.Controls 2.0 as Controls
+import QtQuick.Layouts 1.2
+import org.kde.kirigami 2.2 as Kirigami
+
+Kirigami.ScrollablePage {
+ id: page
+ title: "Color Sets"
+
+ background: Rectangle {
+ color: Kirigami.Theme.backgroundColor
+ }
+ ColumnLayout {
+ GridLayout {
+ columns: 2
+ Kirigami.Label {
+ text: "Global Drawer color set:"
+ Layout.alignment: Qt.AlignRight
+ }
+ Controls.ComboBox {
+ Kirigami.Theme.inherit: true
+ currentIndex: 0
+ model: ["View", "Window", "Button", "Selection", "Tooltip", "Complementary"]
+ onCurrentTextChanged: applicationWindow().globalDrawer.Kirigami.Theme.colorSet = currentText
+ }
+
+ Kirigami.Label {
+ text: "Page color set:"
+ Layout.alignment: Qt.AlignRight
+ }
+ Controls.ComboBox {
+ Kirigami.Theme.inherit: true
+ currentIndex: 1
+ model: ["View", "Window", "Button", "Selection", "Tooltip", "Complementary"]
+ onCurrentTextChanged: page.Kirigami.Theme.colorSet = currentText
+ }
+ }
+
+ Controls.Frame {
+ Kirigami.Theme.inherit: true
+ Layout.minimumHeight: childrenRect.height
+ Layout.fillWidth: true
+ height: childrenRect.height
+ width: parent.width
+ background: Rectangle {
+ color: Kirigami.Theme.backgroundColor
+ }
+ contentItem: ColumnLayout {
+ width: parent.width
+ Kirigami.Label {
+ text: "Set inherited from parent Item"
+ }
+ Kirigami.BasicListItem {
+ width: parent.width
+ icon: "media-record-symbolic"
+ label: "Delegate1"
+ }
+ Kirigami.BasicListItem {
+ width: parent.width
+ label: "Delegate2"
+ }
+ }
+ }
+
+ Controls.Frame {
+ Kirigami.Theme.inherit: false
+ Kirigami.Theme.colorSet: Kirigami.Theme.Window
+ Layout.minimumHeight: childrenRect.height
+ Layout.fillWidth: true
+ height: childrenRect.height
+ width: parent.width
+ background: Rectangle {
+ color: Kirigami.Theme.backgroundColor
+ }
+ contentItem: ColumnLayout {
+ width: parent.width
+ Kirigami.Label {
+ text: "Window Set"
+ }
+ Kirigami.BasicListItem {
+ width: parent.width
+ icon: "media-record-symbolic"
+ label: "Delegate1"
+ }
+ Kirigami.BasicListItem {
+ width: parent.width
+ label: "Delegate2"
+ }
+ }
+ }
+
+ Controls.Frame {
+ Kirigami.Theme.inherit: false
+ Kirigami.Theme.colorSet: Kirigami.Theme.View
+ Layout.minimumHeight: childrenRect.height
+ Layout.fillWidth: true
+ height: childrenRect.height
+ width: parent.width
+ background: Rectangle {
+ color: Kirigami.Theme.backgroundColor
+ }
+ contentItem: ColumnLayout {
+ width: parent.width
+ Kirigami.Label {
+ text: "View Set"
+ }
+ Kirigami.BasicListItem {
+ width: parent.width
+ icon: "media-record-symbolic"
+ label: "Delegate1"
+ }
+ Kirigami.BasicListItem {
+ width: parent.width
+ label: "Delegate2"
+ }
+ }
+ }
+
+ Controls.Frame {
+ Kirigami.Theme.inherit: false
+ Kirigami.Theme.colorSet: Kirigami.Theme.Complementary
+ Layout.minimumHeight: childrenRect.height
+ Layout.fillWidth: true
+ height: childrenRect.height
+ width: parent.width
+ background: Rectangle {
+ color: Kirigami.Theme.backgroundColor
+ }
+ contentItem: ColumnLayout {
+ Kirigami.Label {
+ text: "Complementary Set"
+ }
+ Kirigami.BasicListItem {
+ width: parent.width
+ icon: "media-record-symbolic"
+ label: "Delegate1"
+ }
+ Kirigami.BasicListItem {
+ width: parent.width
+ label: "Delegate2"
+ }
+ }
+ }
+
+ Controls.Button {
+ Kirigami.Theme.colorSet: Kirigami.Theme.Button
+ Kirigami.Theme.inherit: false
+ text: "Fixed Color Button"
+ }
+ Controls.Button {
+ Kirigami.Theme.inherit: true
+ text: "Dynamic Color Button"
+ }
+ Kirigami.Icon {
+ source: "media-record-symbolic"
+ color: "green"
+ Layout.minimumWidth: 32
+ Layout.minimumHeight: 32
+ }
+ }
+}
diff --git a/examples/gallerydata/contents/ui/gallery/ColorsGallery.qml b/examples/gallerydata/contents/ui/gallery/ColorsGallery.qml
--- a/examples/gallerydata/contents/ui/gallery/ColorsGallery.qml
+++ b/examples/gallerydata/contents/ui/gallery/ColorsGallery.qml
@@ -19,54 +19,98 @@
import QtQuick 2.0
import QtQuick.Layouts 1.2
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
ScrollablePage {
+ id: page
title: "Colors"
// leftPadding: 20//Units.gridUnit
function endsWith(subject, predicate) {
var idx = subject.indexOf(predicate);
return idx + predicate.length == subject.length;
}
+
function getkeys() {
- var keys = [];
- for(var v in Theme) {
- if (endsWith(v, "Color"))
- keys.push(v);
+ var keys = ["textColor",
+ "disabledTextColor",
+ "highlightedTextColor",
+ "activeTextColor",
+ "linkColor",
+ "visitedLinkColor",
+ "negativeTextColor",
+ "neutralTextColor",
+ "positiveTextColor",
+ "backgroundColor",
+ "highlightColor",
+ "focusColor",
+ "hoverColor"];
+
+ return keys;
+ }
+
+ function setName(id) {
+ switch(id) {
+ case 0:
+ return "Theme.View";
+ case 1:
+ return "Theme.Window";
+ case 2:
+ return "Theme.Button";
+ case 3:
+ return "Theme.Selection";
+ case 4:
+ return "Theme.Tooltip";
+ case 5:
+ return "Theme.Complementary";
}
- keys.sort();
- return keys;
}
Column {
- Flow {
- id: view
- anchors.horizontalCenter: parent.horizontalCenter
- width: Math.floor(parent.width / (Units.gridUnit * 9)) * (Units.gridUnit * 9)
- Repeater {
- model: getkeys()
+ Heading {
+ text: "Colors by Theme.colorSet"
+ }
+ Repeater {
+ model: Theme.Complementary + 1
+ delegate: Column {
+ width: parent.width
+ Heading {
+ level: 2
+ text: setName(modelData)
+ }
+ Flow {
+ id: view
+ Theme.colorSet: modelData
+ Theme.inherit: false
+ anchors.horizontalCenter: parent.horizontalCenter
+ width: Math.floor(parent.width / (Units.gridUnit * 9)) * (Units.gridUnit * 9)
+ Repeater {
+ model: page.getkeys()
- delegate: ColumnLayout {
- width: Units.gridUnit * 9
- Rectangle {
- Layout.alignment: Qt.AlignHCenter
- width: Units.gridUnit * 7
- height: Units.gridUnit * 3
- color: Theme[modelData]
- border {
- width: 1
- color: "black"
+ delegate: ColumnLayout {
+ width: Units.gridUnit * 9
+ Rectangle {
+ Layout.alignment: Qt.AlignHCenter
+ width: Units.gridUnit * 7
+ height: Units.gridUnit * 3
+ color: Theme[modelData]
+ border {
+ width: 1
+ color: "black"
+ }
+ }
+ Label {
+ Theme.colorSet: Theme.Window
+ Theme.inherit: false
+ Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
+ text: modelData
+ }
+ Item {
+ width: 1
+ height: Units.smallSpacing
+ }
}
}
- Label {
- Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
- text: modelData
- }
- Item {
- width: 1
- height: Units.smallSpacing
- }
}
}
}
diff --git a/examples/gallerydata/contents/ui/gallery/LayersGallery.qml b/examples/gallerydata/contents/ui/gallery/LayersGallery.qml
--- a/examples/gallerydata/contents/ui/gallery/LayersGallery.qml
+++ b/examples/gallerydata/contents/ui/gallery/LayersGallery.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtQuick.Controls 2.0 as Controls
import QtQuick.Layouts 1.2
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
ScrollablePage {
id: page
diff --git a/examples/gallerydata/contents/ui/gallery/ListViewGallery.qml b/examples/gallerydata/contents/ui/gallery/ListViewGallery.qml
--- a/examples/gallerydata/contents/ui/gallery/ListViewGallery.qml
+++ b/examples/gallerydata/contents/ui/gallery/ListViewGallery.qml
@@ -19,7 +19,7 @@
import QtQuick 2.4
import QtQuick.Layouts 1.2
-import org.kde.kirigami 2.1 as Kirigami
+import org.kde.kirigami 2.2 as Kirigami
Kirigami.ScrollablePage {
id: page
@@ -53,7 +53,7 @@
}
background: Rectangle {
- color: Kirigami.Theme.viewBackgroundColor
+ color: Kirigami.Theme.backgroundColor
}
Kirigami.OverlaySheet {
id: sheet
diff --git a/examples/gallerydata/contents/ui/gallery/ListViewHeaderItemsGallery.qml b/examples/gallerydata/contents/ui/gallery/ListViewHeaderItemsGallery.qml
--- a/examples/gallerydata/contents/ui/gallery/ListViewHeaderItemsGallery.qml
+++ b/examples/gallerydata/contents/ui/gallery/ListViewHeaderItemsGallery.qml
@@ -19,7 +19,7 @@
import QtQuick 2.4
import QtQuick.Layouts 1.2
-import org.kde.kirigami 2.1 as Kirigami
+import org.kde.kirigami 2.2 as Kirigami
Kirigami.ScrollablePage {
id: page
@@ -77,7 +77,7 @@
}
background: Rectangle {
- color: Kirigami.Theme.viewBackgroundColor
+ color: Kirigami.Theme.backgroundColor
}
ListView {
diff --git a/examples/gallerydata/contents/ui/gallery/MetricsGallery.qml b/examples/gallerydata/contents/ui/gallery/MetricsGallery.qml
--- a/examples/gallerydata/contents/ui/gallery/MetricsGallery.qml
+++ b/examples/gallerydata/contents/ui/gallery/MetricsGallery.qml
@@ -21,7 +21,7 @@
import QtQuick.Layouts 1.1
import QtQuick.Controls 2.0 as QQC2
import QtQuick.Window 2.2
-import org.kde.kirigami 2.0 as Kirigami
+import org.kde.kirigami 2.2 as Kirigami
Kirigami.ScrollablePage {
id: page
diff --git a/examples/gallerydata/contents/ui/gallery/MiscGallery.qml b/examples/gallerydata/contents/ui/gallery/MiscGallery.qml
--- a/examples/gallerydata/contents/ui/gallery/MiscGallery.qml
+++ b/examples/gallerydata/contents/ui/gallery/MiscGallery.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtQuick.Controls 2.0 as Controls
import QtQuick.Layouts 1.2
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
ScrollablePage {
id: page
@@ -89,7 +89,7 @@
}
footer: Rectangle {
- color: Theme.viewBackground
+ color: Theme.backgroundColor
height: Units.gridUnit * 3
Controls.TextField {
topPadding: 0
diff --git a/examples/gallerydata/contents/ui/gallery/MultipleColumnsGallery.qml b/examples/gallerydata/contents/ui/gallery/MultipleColumnsGallery.qml
--- a/examples/gallerydata/contents/ui/gallery/MultipleColumnsGallery.qml
+++ b/examples/gallerydata/contents/ui/gallery/MultipleColumnsGallery.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtQuick.Controls 2.0 as Controls
import QtQuick.Layouts 1.2
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
ScrollablePage {
id: page
diff --git a/examples/gallerydata/contents/ui/gallery/NonScrollableGallery.qml b/examples/gallerydata/contents/ui/gallery/NonScrollableGallery.qml
--- a/examples/gallerydata/contents/ui/gallery/NonScrollableGallery.qml
+++ b/examples/gallerydata/contents/ui/gallery/NonScrollableGallery.qml
@@ -19,7 +19,7 @@
import QtQuick 2.0
import QtQuick.Layouts 1.2
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
Page {
id: page
diff --git a/examples/gallerydata/contents/ui/gallery/ProgressBarGallery.qml b/examples/gallerydata/contents/ui/gallery/ProgressBarGallery.qml
--- a/examples/gallerydata/contents/ui/gallery/ProgressBarGallery.qml
+++ b/examples/gallerydata/contents/ui/gallery/ProgressBarGallery.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtQuick.Controls 2.0 as Controls
import QtQuick.Layouts 1.2
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
ScrollablePage {
id: page
diff --git a/examples/gallerydata/contents/ui/gallery/RadioButtonGallery.qml b/examples/gallerydata/contents/ui/gallery/RadioButtonGallery.qml
--- a/examples/gallerydata/contents/ui/gallery/RadioButtonGallery.qml
+++ b/examples/gallerydata/contents/ui/gallery/RadioButtonGallery.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtQuick.Controls 2.0 as Controls
import QtQuick.Layouts 1.2
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
ScrollablePage {
id: page
diff --git a/examples/gallerydata/contents/ui/gallery/SliderGallery.qml b/examples/gallerydata/contents/ui/gallery/SliderGallery.qml
--- a/examples/gallerydata/contents/ui/gallery/SliderGallery.qml
+++ b/examples/gallerydata/contents/ui/gallery/SliderGallery.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtQuick.Controls 2.0 as Controls
import QtQuick.Layouts 1.2
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
ScrollablePage {
id: page
@@ -93,6 +93,7 @@
text: slider2.position.toFixed(1)
}
}
+ Controls.RangeSlider {}
Label {
text: "Vertical:"
}
diff --git a/examples/gallerydata/contents/ui/gallery/SwitchGallery.qml b/examples/gallerydata/contents/ui/gallery/SwitchGallery.qml
--- a/examples/gallerydata/contents/ui/gallery/SwitchGallery.qml
+++ b/examples/gallerydata/contents/ui/gallery/SwitchGallery.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtQuick.Controls 2.0 as Controls
import QtQuick.Layouts 1.2
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
ScrollablePage {
id: page
diff --git a/examples/gallerydata/contents/ui/gallery/TabBarGallery.qml b/examples/gallerydata/contents/ui/gallery/TabBarGallery.qml
--- a/examples/gallerydata/contents/ui/gallery/TabBarGallery.qml
+++ b/examples/gallerydata/contents/ui/gallery/TabBarGallery.qml
@@ -20,7 +20,7 @@
import QtQuick 2.1
import QtQuick.Controls 2.0 as Controls
import QtQuick.Layouts 1.2
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
Page {
id: page
diff --git a/examples/gallerydata/contents/ui/gallery/TextFieldGallery.qml b/examples/gallerydata/contents/ui/gallery/TextFieldGallery.qml
--- a/examples/gallerydata/contents/ui/gallery/TextFieldGallery.qml
+++ b/examples/gallerydata/contents/ui/gallery/TextFieldGallery.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtQuick.Controls 2.0 as Controls
import QtQuick.Layouts 1.2
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
ScrollablePage {
id: page
diff --git a/examples/gallerydata/metadata.desktop b/examples/gallerydata/metadata.desktop
--- a/examples/gallerydata/metadata.desktop
+++ b/examples/gallerydata/metadata.desktop
@@ -36,6 +36,13 @@
Name[x-test]=xxKirigami Galleryxx
Name[zh_CN]=Kirigami 画廊
Name[zh_TW]=Kirigami 藝廊
+Comment=Shows examples of Kirigami components and allows you to play with them
+Comment[ca]=Mostra exemples de components del Kirigami i permet jugar-hi
+Comment[nl]=Toont voorbeelden van Kirigami componenten en laat u met ze spelen
+Comment[pt]=Mostra exemplos dos componentes do Kirigami e permite-lhe jogar com eles
+Comment[sv]=Visar exempel på Kirigami-komponenter och låter dig leka med dem
+Comment[uk]=Показує приклади компонентів Kirigami і надає вам змогу попрацювати з ними
+Comment[x-test]=xxShows examples of Kirigami components and allows you to play with themxx
Encoding=UTF-8
Type=Application
diff --git a/examples/minimalqmake/Page1Form.ui.qml b/examples/minimalqmake/Page1Form.ui.qml
--- a/examples/minimalqmake/Page1Form.ui.qml
+++ b/examples/minimalqmake/Page1Form.ui.qml
@@ -20,7 +20,7 @@
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.3
-import org.kde.kirigami 2.1 as Kirigami
+import org.kde.kirigami 2.2 as Kirigami
Kirigami.Page {
title: qsTr("Page 1")
diff --git a/examples/minimalqmake/kirigami-icons.qrc b/examples/minimalqmake/kirigami-icons.qrc
--- a/examples/minimalqmake/kirigami-icons.qrc
+++ b/examples/minimalqmake/kirigami-icons.qrc
@@ -10,5 +10,6 @@
3rdparty/breeze-icons/icons/actions/22/handle-right.svg
3rdparty/breeze-icons/icons/actions/32/view-list-icons.svg
3rdparty/breeze-icons/icons/categories/32/applications-graphics.svg
+ 3rdparty/breeze-icons/icons/actions/symbolic/media-record-symbolic.svg
diff --git a/examples/minimalqmake/main.qml b/examples/minimalqmake/main.qml
--- a/examples/minimalqmake/main.qml
+++ b/examples/minimalqmake/main.qml
@@ -21,7 +21,7 @@
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.3
-import org.kde.kirigami 2.0 as Kirigami
+import org.kde.kirigami 2.2 as Kirigami
Kirigami.ApplicationWindow {
visible: true
diff --git a/examples/multiplatformnotesapp/NotesGeneral.qml b/examples/multiplatformnotesapp/NotesGeneral.qml
--- a/examples/multiplatformnotesapp/NotesGeneral.qml
+++ b/examples/multiplatformnotesapp/NotesGeneral.qml
@@ -45,7 +45,7 @@
]
}
background: Rectangle {
- color: Kirigami.Thmeme.viewBackgroundColor
+ color: Kirigami.Thmeme.backgroundColor
}
GridView {
@@ -117,7 +117,7 @@
]
}
background: Rectangle {
- color: Kirigami.Theme.viewBackgroundColor
+ color: Kirigami.Theme.backgroundColor
Rectangle {
anchors.fill: parent
color: "yellow"
diff --git a/src/styles/org.kde.desktop/ApplicationWindow.qml b/examples/multiplatformnotesapp/notesDesktop.qml
copy from src/styles/org.kde.desktop/ApplicationWindow.qml
copy to examples/multiplatformnotesapp/notesDesktop.qml
--- a/src/styles/org.kde.desktop/ApplicationWindow.qml
+++ b/examples/multiplatformnotesapp/notesDesktop.qml
@@ -1,9 +1,9 @@
/*
- * Copyright 2015 Marco Martin
+ * Copyright 2016 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
+ * 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,
@@ -18,13 +18,13 @@
*/
import QtQuick 2.1
-import org.kde.kirigami 2.0
-import "../../" as Base
+import QtQuick.Layouts 1.2
+import QtQuick.Controls 2.0 as QQC2
+import org.kde.kirigami 2.0 as Kirigami
-
-Base.ApplicationWindow {
+NotesGeneral {
id: root
- width: Units.gridUnit * 55
- height: Units.gridUnit * 40
- wideScreen: true
+
+ header: Kirigami.ToolBarApplicationHeader {
+ }
}
diff --git a/src/styles/org.kde.desktop/ApplicationWindow.qml b/examples/multiplatformnotesapp/notesMobile.qml
copy from src/styles/org.kde.desktop/ApplicationWindow.qml
copy to examples/multiplatformnotesapp/notesMobile.qml
--- a/src/styles/org.kde.desktop/ApplicationWindow.qml
+++ b/examples/multiplatformnotesapp/notesMobile.qml
@@ -1,9 +1,9 @@
/*
- * Copyright 2015 Marco Martin
+ * Copyright 2016 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
+ * 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,
@@ -18,13 +18,14 @@
*/
import QtQuick 2.1
-import org.kde.kirigami 2.0
-import "../../" as Base
+import QtQuick.Layouts 1.2
+import QtQuick.Controls 2.0 as QQC2
+import org.kde.kirigami 2.0 as Kirigami
-
-Base.ApplicationWindow {
+NotesGeneral {
id: root
- width: Units.gridUnit * 55
- height: Units.gridUnit * 40
- wideScreen: true
+
+ header: Kirigami.ApplicationHeader {
+ }
+ contextDrawer: Kirigami.ContextDrawer {}
}
diff --git a/examples/simpleexamples/AbstractApplicationWindow.qml b/examples/simpleexamples/AbstractApplicationWindow.qml
--- a/examples/simpleexamples/AbstractApplicationWindow.qml
+++ b/examples/simpleexamples/AbstractApplicationWindow.qml
@@ -19,7 +19,7 @@
import QtQuick 2.1
import QtQuick.Layouts 1.2
-import org.kde.kirigami 2.0 as Kirigami
+import org.kde.kirigami 2.2 as Kirigami
Kirigami.AbstractApplicationWindow {
id: root
diff --git a/examples/simpleexamples/FixedSidebar.qml b/examples/simpleexamples/FixedSidebar.qml
--- a/examples/simpleexamples/FixedSidebar.qml
+++ b/examples/simpleexamples/FixedSidebar.qml
@@ -19,7 +19,7 @@
import QtQuick 2.1
import QtQuick.Layouts 1.2
-import org.kde.kirigami 2.0 as Kirigami
+import org.kde.kirigami 2.2 as Kirigami
Kirigami.ApplicationWindow {
id: root
diff --git a/examples/simpleexamples/MultipleColumnsGallery.qml b/examples/simpleexamples/MultipleColumnsGallery.qml
--- a/examples/simpleexamples/MultipleColumnsGallery.qml
+++ b/examples/simpleexamples/MultipleColumnsGallery.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtQuick.Controls 2.0 as Controls
import QtQuick.Layouts 1.2
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
ScrollablePage {
id: page
diff --git a/examples/simpleexamples/SplitDrawer.qml b/examples/simpleexamples/SplitDrawer.qml
--- a/examples/simpleexamples/SplitDrawer.qml
+++ b/examples/simpleexamples/SplitDrawer.qml
@@ -20,7 +20,7 @@
import QtQuick 2.1
import QtQuick.Controls 2.0 as Controls
import QtQuick.Layouts 1.2
-import org.kde.kirigami 2.0 as Kirigami
+import org.kde.kirigami 2.2 as Kirigami
Kirigami.ApplicationWindow {
id: root
diff --git a/examples/simpleexamples/TabBarHeader.qml b/examples/simpleexamples/TabBarHeader.qml
--- a/examples/simpleexamples/TabBarHeader.qml
+++ b/examples/simpleexamples/TabBarHeader.qml
@@ -19,7 +19,7 @@
import QtQuick 2.1
import QtQuick.Layouts 1.2
-import org.kde.kirigami 2.0 as Kirigami
+import org.kde.kirigami 2.2 as Kirigami
Kirigami.ApplicationWindow {
id: root
diff --git a/examples/simpleexamples/customdrawer.qml b/examples/simpleexamples/customdrawer.qml
--- a/examples/simpleexamples/customdrawer.qml
+++ b/examples/simpleexamples/customdrawer.qml
@@ -18,7 +18,7 @@
*/
import QtQuick 2.1
-import org.kde.kirigami 2.0 as Kirigami
+import org.kde.kirigami 2.2 as Kirigami
Kirigami.ApplicationWindow {
id: root
diff --git a/examples/simpleexamples/minimal.qml b/examples/simpleexamples/minimal.qml
--- a/examples/simpleexamples/minimal.qml
+++ b/examples/simpleexamples/minimal.qml
@@ -18,7 +18,7 @@
*/
import QtQuick 2.1
-import org.kde.kirigami 2.0 as Kirigami
+import org.kde.kirigami 2.2 as Kirigami
Kirigami.ApplicationWindow {
id: root
diff --git a/examples/simpleexamples/pushpopclear.qml b/examples/simpleexamples/pushpopclear.qml
--- a/examples/simpleexamples/pushpopclear.qml
+++ b/examples/simpleexamples/pushpopclear.qml
@@ -18,7 +18,7 @@
*/
import QtQuick 2.1
-import org.kde.kirigami 2.0 as Kirigami
+import org.kde.kirigami 2.2 as Kirigami
Kirigami.ApplicationWindow {
id: root
diff --git a/examples/simpleexamples/simpleChatApp.qml b/examples/simpleexamples/simpleChatApp.qml
--- a/examples/simpleexamples/simpleChatApp.qml
+++ b/examples/simpleexamples/simpleChatApp.qml
@@ -20,7 +20,7 @@
import QtQuick 2.6
import QtQuick.Layouts 1.2
import QtQuick.Controls 2.2 as QQC2
-import org.kde.kirigami 2.0 as Kirigami
+import org.kde.kirigami 2.2 as Kirigami
Kirigami.ApplicationWindow {
id: root
@@ -207,7 +207,7 @@
title: "Channels"
background: Rectangle {
anchors.fill: parent
- color: Kirigami.Theme.viewBackgroundColor
+ color: Kirigami.Theme.backgroundColor
}
footer: QQC2.ToolBar {
height: root.footerHeight
@@ -281,13 +281,13 @@
]
background: Rectangle {
anchors.fill: parent
- color: Kirigami.Theme.viewBackgroundColor
+ color: Kirigami.Theme.backgroundColor
}
footer: QQC2.Control {
height: footerHeight
padding: Kirigami.Units.smallSpacing
background: Rectangle {
- color: Kirigami.Theme.viewBackgroundColor
+ color: Kirigami.Theme.backgroundColor
Kirigami.Separator {
Rectangle {
anchors.fill: parent
diff --git a/kirigami.pri b/kirigami.pri
--- a/kirigami.pri
+++ b/kirigami.pri
@@ -1,11 +1,17 @@
-QT += qml quick gui svg
+QT += qml quick gui svg quickcontrols2
HEADERS += $$PWD/src/kirigamiplugin.h \
$$PWD/src/enums.h \
- $$PWD/src/settings.h
+ $$PWD/src/settings.h \
+ $$PWD/src/libkirigami/basictheme_p.h \
+ $$PWD/src/libkirigami/platformtheme.h \
+ $$PWD/src/libkirigami/platformthemefactory.h
SOURCES += $$PWD/src/kirigamiplugin.cpp \
$$PWD/src/enums.cpp \
- $$PWD/src/settings.cpp
+ $$PWD/src/settings.cpp \
+ $$PWD/src/libkirigami/basictheme.cpp \
+ $$PWD/src/libkirigami/platformtheme.cpp \
+ $$PWD/src/libkirigami/platformthemefactory.cpp
INCLUDEPATH += $$PWD/src
DEFINES += KIRIGAMI_BUILD_TYPE_STATIC
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -2,14 +2,22 @@
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
${kirigami_QM_LOADER}
+ ${KIRIGAMI_STATIC_FILES}
)
IF(STATIC_LIBRARY)
@@ -21,9 +29,11 @@
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 Qt5::Core Qt5::Qml Qt5::Quick)
+target_link_libraries(kirigamiplugin KF5::Kirigami2 Qt5::Core Qt5::Qml Qt5::Quick)
add_custom_target(copy)
diff --git a/src/controls/AbstractApplicationHeader.qml b/src/controls/AbstractApplicationHeader.qml
--- a/src/controls/AbstractApplicationHeader.qml
+++ b/src/controls/AbstractApplicationHeader.qml
@@ -18,7 +18,7 @@
*/
import QtQuick 2.5
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
import "private"
import "templates" as T
diff --git a/src/controls/AbstractApplicationItem.qml b/src/controls/AbstractApplicationItem.qml
--- a/src/controls/AbstractApplicationItem.qml
+++ b/src/controls/AbstractApplicationItem.qml
@@ -21,7 +21,7 @@
import QtQuick.Templates 2.0 as T2
import QtQuick.Window 2.2
import "templates/private"
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
import QtGraphicalEffects 1.0
/**
@@ -39,7 +39,7 @@
*
* Example usage:
* @code
- * import org.kde.kirigami 2.0 as Kirigami
+ * import org.kde.kirigami 2.2 as Kirigami
*
* Kirigami.ApplicationItem {
* [...]
@@ -225,7 +225,7 @@
*
* Example usage:
* @code
- * import org.kde.kirigami 2.0 as Kirigami
+ * import org.kde.kirigami 2.2 as Kirigami
*
* Kirigami.ApplicationItem {
* [...]
@@ -237,7 +237,7 @@
* @endcode
*
* @code
- * import org.kde.kirigami 2.0 as Kirigami
+ * import org.kde.kirigami 2.2 as Kirigami
*
* Kirigami.Page {
* [...]
diff --git a/src/controls/AbstractApplicationWindow.qml b/src/controls/AbstractApplicationWindow.qml
--- a/src/controls/AbstractApplicationWindow.qml
+++ b/src/controls/AbstractApplicationWindow.qml
@@ -20,7 +20,7 @@
import QtQuick 2.5
import QtQuick.Controls 2.0 as QQC2
import "templates/private"
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
import QtGraphicalEffects 1.0
/**
@@ -38,7 +38,7 @@
*
* Example usage:
* @code
- * import org.kde.kirigami 2.0 as Kirigami
+ * import org.kde.kirigami 2.2 as Kirigami
*
* Kirigami.ApplicationWindow {
* [...]
@@ -177,7 +177,7 @@
*
* Example usage:
* @code
- * import org.kde.kirigami 2.0 as Kirigami
+ * import org.kde.kirigami 2.2 as Kirigami
*
* Kirigami.ApplicationWindow {
* [...]
@@ -189,7 +189,7 @@
* @endcode
*
* @code
- * import org.kde.kirigami 2.0 as Kirigami
+ * import org.kde.kirigami 2.2 as Kirigami
*
* Kirigami.Page {
* [...]
diff --git a/src/controls/AbstractItemViewHeader.qml b/src/controls/AbstractItemViewHeader.qml
--- a/src/controls/AbstractItemViewHeader.qml
+++ b/src/controls/AbstractItemViewHeader.qml
@@ -19,7 +19,7 @@
import QtQuick 2.5
import QtQuick.Templates 2.0 as T2
-import org.kde.kirigami 2.0 as Kirigami
+import org.kde.kirigami 2.2 as Kirigami
/**
* An item that can be used as an header for a ListView.
diff --git a/src/controls/ApplicationItem.qml b/src/controls/ApplicationItem.qml
--- a/src/controls/ApplicationItem.qml
+++ b/src/controls/ApplicationItem.qml
@@ -19,7 +19,7 @@
import QtQuick 2.5
import "templates/private"
-import org.kde.kirigami 2.0 as Kirigami
+import org.kde.kirigami 2.2 as Kirigami
import QtGraphicalEffects 1.0
/**
@@ -36,7 +36,7 @@
*
* Example usage:
* @code
- * import org.kde.kirigami 2.0 as Kirigami
+ * import org.kde.kirigami 2.2 as Kirigami
*
* Kirigami.ApplicationItem {
* [...]
diff --git a/src/controls/ApplicationWindow.qml b/src/controls/ApplicationWindow.qml
--- a/src/controls/ApplicationWindow.qml
+++ b/src/controls/ApplicationWindow.qml
@@ -19,7 +19,7 @@
import QtQuick 2.5
import "templates/private"
-import org.kde.kirigami 2.0 as Kirigami
+import org.kde.kirigami 2.2 as Kirigami
import QtGraphicalEffects 1.0
/**
@@ -34,7 +34,7 @@
*
* Example usage:
* @code
- * import org.kde.kirigami 2.0 as Kirigami
+ * import org.kde.kirigami 2.2 as Kirigami
*
* Kirigami.ApplicationWindow {
* [...]
diff --git a/src/controls/BasicListItem.qml b/src/controls/BasicListItem.qml
--- a/src/controls/BasicListItem.qml
+++ b/src/controls/BasicListItem.qml
@@ -19,7 +19,7 @@
import QtQuick 2.1
import QtQuick.Layouts 1.2
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
/**
* An item delegate for the primitive ListView component.
@@ -58,7 +58,7 @@
RowLayout {
id: layout
spacing: Units.smallSpacing*2
- property bool indicateActiveFocus: Settings.isMobile || listItem.activeFocus || (listItem.ListView.view ? listItem.ListView.view.activeFocus : false)
+ property bool indicateActiveFocus: listItem.pressed || Settings.isMobile || listItem.activeFocus || (listItem.ListView.view ? listItem.ListView.view.activeFocus : false)
Icon {
id: iconItem
Layout.minimumHeight: Units.iconSizes.smallMedium
diff --git a/src/controls/ContextDrawer.qml b/src/controls/ContextDrawer.qml
--- a/src/controls/ContextDrawer.qml
+++ b/src/controls/ContextDrawer.qml
@@ -19,7 +19,7 @@
import QtQuick 2.1
import QtQuick.Layouts 1.2
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
import "templates/private"
@@ -29,7 +29,7 @@
*
* Example usage:
* @code
- * import org.kde.kirigami 2.0 as Kirigami
+ * import org.kde.kirigami 2.2 as Kirigami
*
* Kirigami.ApplicationWindow {
* [...]
@@ -41,7 +41,7 @@
* @endcode
*
* @code
- * import org.kde.kirigami 2.0 as Kirigami
+ * import org.kde.kirigami 2.2 as Kirigami
*
* Kirigami.Page {
* [...]
@@ -96,6 +96,8 @@
handleVisible: applicationWindow == undefined ? false : applicationWindow().controlsVisible
contentItem: ScrollView {
+ //this just to create the attached property
+ Theme.inherit: true
implicitWidth: Units.gridUnit * 20
ListView {
id: menu
diff --git a/src/controls/GlobalDrawer.qml b/src/controls/GlobalDrawer.qml
--- a/src/controls/GlobalDrawer.qml
+++ b/src/controls/GlobalDrawer.qml
@@ -21,7 +21,7 @@
import QtQuick.Templates 2.0 as T2
import QtQuick.Layouts 1.2
import QtGraphicalEffects 1.0
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
import "private"
import "templates/private"
@@ -33,7 +33,7 @@
*
* Example usage:
* @code
- * import org.kde.kirigami 2.0 as Kirigami
+ * import org.kde.kirigami 2.2 as Kirigami
*
* Kirigami.ApplicationWindow {
* [...]
@@ -95,7 +95,7 @@
*
* Example usage:
* @code
- * import org.kde.kirigami 2.0 as Kirigami
+ * import org.kde.kirigami 2.2 as Kirigami
*
* Kirigami.ApplicationWindow {
* [...]
@@ -134,7 +134,7 @@
*
* Example usage:
* @code
- * import org.kde.kirigami 2.0 as Kirigami
+ * import org.kde.kirigami 2.2 as Kirigami
*
* Kirigami.ApplicationWindow {
* [...]
@@ -158,7 +158,7 @@
*
* Example usage:
* @code
- * import org.kde.kirigami 2.0 as Kirigami
+ * import org.kde.kirigami 2.2 as Kirigami
*
* Kirigami.ApplicationWindow {
* [...]
@@ -209,6 +209,8 @@
contentItem: ScrollView {
id: scrollView
+ //ensure the attached property exists
+ Theme.inherit: true
anchors.fill: parent
implicitWidth: Math.min (Units.gridUnit * 20, root.parent.width * 0.8)
horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff
@@ -288,6 +290,7 @@
Layout.minimumWidth: Units.iconSizes.large
Layout.minimumHeight: width
visible: valid
+ isMask: false
//TODO: find a better way to control selective coloring on Android
enabled: !Settings.isMobile
}
@@ -409,6 +412,7 @@
enabled: model ? model.enabled : modelData.enabled
opacity: enabled ? 1.0 : 0.3
Icon {
+ isMask: true
anchors {
verticalCenter: contentItem.verticalCenter
right: contentItem.right
diff --git a/src/controls/Heading.qml b/src/controls/Heading.qml
--- a/src/controls/Heading.qml
+++ b/src/controls/Heading.qml
@@ -19,7 +19,7 @@
import QtQuick 2.0
import QtQuick.Controls 2.0 as QQC2
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
/**
* A heading label used for subsections of texts.
@@ -31,7 +31,7 @@
* Example usage:
*
* @code
- * import org.kde.kirigami 2.0 as Kirigami
+ * import org.kde.kirigami 2.2 as Kirigami
* [...]
* Column {
* Kirigami.Heading {
diff --git a/src/controls/Icon.qml b/src/controls/Icon.qml
--- a/src/controls/Icon.qml
+++ b/src/controls/Icon.qml
@@ -19,7 +19,7 @@
import QtQuick 2.0
import QtGraphicalEffects 1.0
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
/**
* Graphical representatrion of an Icon
@@ -58,6 +58,21 @@
*/
property bool selected: false
+ /**
+ * isMask: bool
+ * true if the icon should be treated as a monochrome icon which can be tinted
+ * @since 2.2
+ */
+ property bool isMask: true
+
+ /**
+ * color: color
+ * Allow to set the main color of the icon as a particular color
+ * default: transparent
+ * @since 2.2
+ */
+ property color color: "transparent"
+
implicitWidth: image.source != "" ? Units.iconSizes.smallMedium : 0
implicitHeight: image.source != "" ? Units.iconSizes.smallMedium : 0
@@ -73,8 +88,8 @@
anchors.fill: parent
source: image
- color: root.selected ? Theme.highlightedTextColor : Theme.textColor
+ color: root.selected ? Theme.highlightedTextColor : (root.color != "trasparent" ? root.color : Theme.textColor)
cached: true
- visible: root.enabled && root.valid
+ visible: root.enabled && root.valid && root.isMask
}
}
diff --git a/src/controls/ItemViewHeader.qml b/src/controls/ItemViewHeader.qml
--- a/src/controls/ItemViewHeader.qml
+++ b/src/controls/ItemViewHeader.qml
@@ -20,7 +20,7 @@
import QtQuick 2.5
import QtQuick.Templates 2.0 as T2
import QtGraphicalEffects 1.0
-import org.kde.kirigami 2.1 as Kirigami
+import org.kde.kirigami 2.2 as Kirigami
import "private"
/**
diff --git a/src/controls/Label.qml b/src/controls/Label.qml
--- a/src/controls/Label.qml
+++ b/src/controls/Label.qml
@@ -19,7 +19,7 @@
import QtQuick 2.1
import QtQuick.Window 2.2
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
import QtQuick.Templates 2.0 as T2
/**
diff --git a/src/controls/OverlayDrawer.qml b/src/controls/OverlayDrawer.qml
--- a/src/controls/OverlayDrawer.qml
+++ b/src/controls/OverlayDrawer.qml
@@ -20,7 +20,7 @@
import QtQuick 2.1
import QtGraphicalEffects 1.0
import QtQuick.Templates 2.0 as T2
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
import "private"
import "templates" as T
@@ -37,7 +37,7 @@
//BEGIN Properties
background: Rectangle {
- color: Theme.viewBackgroundColor
+ color: Theme.backgroundColor
Item {
parent: root.handle
@@ -55,7 +55,7 @@
Rectangle {
id: handleGraphics
anchors.centerIn: parent
- color: root.handle.pressed ? Theme.highlightColor : Theme.buttonBackgroundColor
+ color: root.handle.pressed ? Theme.highlightColor : Theme.backgroundColor
width: Units.iconSizes.smallMedium + Units.smallSpacing * 2
height: width
radius: Units.devicePixelRatio * 2
@@ -67,7 +67,7 @@
onItemChanged: {
if(item) {
item.morph = Qt.binding(function(){return root.position})
- item.color = Qt.binding(function(){return root.handle.pressed ? Theme.highlightedTextColor : Theme.buttonTextColor})
+ item.color = Qt.binding(function(){return root.handle.pressed ? Theme.highlightedTextColor : Theme.textColor})
}
}
}
diff --git a/src/controls/OverlaySheet.qml b/src/controls/OverlaySheet.qml
--- a/src/controls/OverlaySheet.qml
+++ b/src/controls/OverlaySheet.qml
@@ -18,7 +18,7 @@
*/
import QtQuick 2.5
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
import "private"
import "templates" as T
@@ -100,7 +100,7 @@
}
Rectangle {
anchors.fill: parent
- color: Theme.viewBackgroundColor
+ color: Theme.backgroundColor
}
}
}
diff --git a/src/controls/Page.qml b/src/controls/Page.qml
--- a/src/controls/Page.qml
+++ b/src/controls/Page.qml
@@ -19,7 +19,7 @@
import QtQuick 2.1
import QtQuick.Layouts 1.2
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2 as Kirigami
import "private"
import QtQuick.Templates 2.0 as T2
@@ -37,25 +37,25 @@
* leftPadding: int
* default contents padding at left
*/
- leftPadding: Units.gridUnit
+ leftPadding: Kirigami.Units.gridUnit
/**
* topPadding: int
* default contents padding at top
*/
- topPadding: Units.gridUnit
+ topPadding: Kirigami.Units.gridUnit
/**
* rightPadding: int
* default contents padding at right
*/
- rightPadding: Units.gridUnit
+ rightPadding: Kirigami.Units.gridUnit
/**
* bottomPadding: int
* default contents padding at bottom
*/
- bottomPadding: Units.gridUnit
+ bottomPadding: Kirigami.Units.gridUnit
/**
* flickable: Flickable
@@ -75,7 +75,7 @@
*
* Example usage:
* @code
- * import org.kde.kirigami 2.0 as Kirigami
+ * import org.kde.kirigami 2.2 as Kirigami
*
* Kirigami.ApplicationWindow {
* [...]
@@ -87,7 +87,7 @@
* @endcode
*
* @code
- * import org.kde.kirigami 2.0 as Kirigami
+ * import org.kde.kirigami 2.2 as Kirigami
*
* Kirigami.Page {
* [...]
@@ -122,7 +122,7 @@
* Example usage:
*
* @code
- * import org.kde.kirigami 2.0 as Kirigami
+ * import org.kde.kirigami 2.2 as Kirigami
* Kirigami.Page {
* actions.main: Kirigami.Action {
* iconName: "edit"
@@ -144,7 +144,7 @@
* Example usage:
*
* @code
- * import org.kde.kirigami 2.0 as Kirigami
+ * import org.kde.kirigami 2.2 as Kirigami
* Kirigami.Page {
* actions.left: Kirigami.Action {
* iconName: "edit"
@@ -166,7 +166,7 @@
* Example usage:
*
* @code
- * import org.kde.kirigami 2.0 as Kirigami
+ * import org.kde.kirigami 2.2 as Kirigami
* Kirigami.Page {
* actions.right: Kirigami.Action {
* iconName: "edit"
@@ -184,7 +184,7 @@
* Actions properties are grouped.
*
* @code
- * import org.kde.kirigami 2.0 as Kirigami
+ * import org.kde.kirigami 2.2 as Kirigami
* Kirigami.Page {
* actions {
* main: Kirigami.Action {...}
@@ -228,7 +228,7 @@
anchors.topMargin: (applicationWindow() && !applicationWindow().wideScreen && Settings.isMobile && applicationWindow().controlsVisible && applicationWindow().header ? applicationWindow().header.preferredHeight : 0)
//NOTE: This exists just because control instances require it
- contentItem: Item {
+ contentItem: Item {
onChildrenChanged: {
//NOTE: make sure OverlaySheets are directly under the root
//so they are over all the contents and don't have margins
diff --git a/src/controls/PageRow.qml b/src/controls/PageRow.qml
--- a/src/controls/PageRow.qml
+++ b/src/controls/PageRow.qml
@@ -22,7 +22,7 @@
import QtQml.Models 2.2
import QtQuick.Templates 2.0 as T
import QtQuick.Controls 2.0 as QQC2
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
/**
* PageRow implements a row-based navigation model, which can be used
diff --git a/src/controls/ScrollablePage.qml b/src/controls/ScrollablePage.qml
--- a/src/controls/ScrollablePage.qml
+++ b/src/controls/ScrollablePage.qml
@@ -19,7 +19,7 @@
import QtQuick 2.1
import QtQuick.Layouts 1.2
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
import "private"
/**
@@ -101,6 +101,8 @@
*/
property bool keyboardNavigationEnabled: true
+ Theme.colorSet: flickable && flickable.hasOwnProperty("model") ? Theme.View : Theme.Window
+
RefreshableScrollView {
id: scrollView
z: 0
@@ -116,6 +118,7 @@
bottomMargin: root.footer ? root.footer.height : 0
}
}
+
anchors.topMargin: 0
diff --git a/src/controls/Separator.qml b/src/controls/Separator.qml
--- a/src/controls/Separator.qml
+++ b/src/controls/Separator.qml
@@ -19,7 +19,7 @@
*/
import QtQuick 2.1
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
/**
* A visual separator
@@ -32,5 +32,5 @@
Rectangle {
height: Units.devicePixelRatio
width: Units.devicePixelRatio
- color: Qt.tint(Theme.textColor, Qt.rgba(Theme.viewBackgroundColor.r, Theme.viewBackgroundColor.g, Theme.viewBackgroundColor.b, 0.7))
+ color: Qt.tint(Theme.textColor, Qt.rgba(Theme.backgroundColor.r, Theme.backgroundColor.g, Theme.backgroundColor.b, 0.7))
}
diff --git a/src/controls/Theme.qml b/src/controls/Theme.qml
--- a/src/controls/Theme.qml
+++ b/src/controls/Theme.qml
@@ -19,7 +19,7 @@
import QtQuick 2.4
-pragma Singleton
+//pragma Singleton
/**
* A set of named colors for the application
@@ -34,9 +34,14 @@
property color highlightColor: "#2196F3"
property color highlightedTextColor: "#eff0fa"
property color backgroundColor: "#eff0f1"
+ property color activeTextColor: "#0176D3"
property color linkColor: "#2196F3"
property color visitedLinkColor: "#2196F3"
+ property color negativeTextColor: "#DA4453"
+ property color neutralTextColor: "#F67400"
+ property color positiveTextColor: "#27AE60"
+
property color buttonTextColor: "#31363b"
property color buttonBackgroundColor: "#eff0f1"
property color buttonHoverColor: "#2196F3"
@@ -47,6 +52,21 @@
property color viewHoverColor: "#2196F3"
property color viewFocusColor: "#2196F3"
+ property color selectionTextColor: "#eff0fa"
+ property color selectionBackgroundColor: "#2196F3"
+ property color selectionHoverColor: "#2196F3"
+ property color selectionFocusColor: "#2196F3"
+
+ property color tooltipTextColor: "#eff0f1"
+ property color tooltipBackgroundColor: "#31363b"
+ property color tooltipHoverColor: "#2196F3"
+ property color tooltipFocusColor: "#2196F3"
+
+ property color complementaryTextColor: "#eff0f1"
+ property color complementaryBackgroundColor: "#31363b"
+ property color complementaryHoverColor: "#2196F3"
+ property color complementaryFocusColor: "#2196F3"
+
property font defaultFont: fontMetrics.font
property list children: [
diff --git a/src/controls/ToolBarApplicationHeader.qml b/src/controls/ToolBarApplicationHeader.qml
--- a/src/controls/ToolBarApplicationHeader.qml
+++ b/src/controls/ToolBarApplicationHeader.qml
@@ -21,7 +21,7 @@
import QtQuick.Controls 2.0 as Controls
import QtQuick.Layouts 1.2
import "private"
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
/**
diff --git a/src/controls/Units.qml b/src/controls/Units.qml
--- a/src/controls/Units.qml
+++ b/src/controls/Units.qml
@@ -19,7 +19,7 @@
import QtQuick 2.4
import QtQuick.Window 2.2
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
pragma Singleton
diff --git a/src/controls/plugins.qmltypes b/src/controls/plugins.qmltypes
--- a/src/controls/plugins.qmltypes
+++ b/src/controls/plugins.qmltypes
@@ -1386,7 +1386,6 @@
exportMetaObjectRevisions: [0]
isComposite: true
isCreatable: false
- isSingleton: true
Property { name: "textColor"; type: "QColor" }
Property { name: "disabledTextColor"; type: "QColor" }
Property { name: "highlightColor"; type: "QColor" }
diff --git a/src/controls/private/ActionButton.qml b/src/controls/private/ActionButton.qml
--- a/src/controls/private/ActionButton.qml
+++ b/src/controls/private/ActionButton.qml
@@ -20,12 +20,14 @@
import QtQuick 2.1
import QtQuick.Layouts 1.2
import QtGraphicalEffects 1.0
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
import "../templates/private"
Item {
id: root
+ Theme.colorSet: Theme.Button
+ Theme.inherit: false
anchors {
left: parent.left
right: parent.right
@@ -226,7 +228,7 @@
width: height
visible: root.action
readonly property bool pressed: root.action && ((mouseArea.buttonPressedUnderMouse && mouseArea.pressed) || root.action.checked)
- color: pressed ? Qt.lighter(Theme.buttonHoverColor, 1.3) : Theme.buttonHoverColor
+ color: pressed ? Qt.lighter(Theme.hoverColor, 1.3) : Theme.hoverColor
Icon {
id: icon
@@ -266,7 +268,7 @@
visible: root.leftAction
readonly property bool pressed: root.leftAction && ((mouseArea.leftButtonPressedUnderMouse && mouseArea.pressed) || root.leftAction.checked)
- color: pressed ? Theme.buttonHoverColor : Theme.buttonBackgroundColor
+ color: pressed ? Theme.hoverColor : Theme.backgroundColor
Behavior on color {
ColorAnimation {
duration: Units.longDuration
@@ -300,7 +302,7 @@
width: height + (root.action ? Units.gridUnit*2 : 0)
visible: root.rightAction
readonly property bool pressed: root.rightAction && ((mouseArea.rightButtonPressedUnderMouse && mouseArea.pressed) || root.rightAction.checked)
- color: pressed ? Theme.buttonHoverColor : Theme.buttonBackgroundColor
+ color: pressed ? Theme.hoverColor : Theme.backgroundColor
Behavior on color {
ColorAnimation {
duration: Units.longDuration
@@ -370,15 +372,15 @@
Rectangle {
id: handleGraphics
anchors.centerIn: parent
- color: fakeContextMenuButton.pressed ? Theme.highlightColor : Theme.buttonBackgroundColor
+ color: fakeContextMenuButton.pressed ? Theme.highlightColor : Theme.backgroundColor
width: Units.iconSizes.smallMedium + Units.smallSpacing * 2
height: width
radius: Units.devicePixelRatio
ContextIcon {
anchors.centerIn: parent
width: height
height: Units.iconSizes.smallMedium
- color: fakeContextMenuButton.pressed ? Theme.highlightedTextColor : Theme.buttonTextColor
+ color: fakeContextMenuButton.pressed ? Theme.highlightedTextColor : Theme.textColor
}
Behavior on color {
ColorAnimation {
diff --git a/src/controls/private/CornerShadow.qml b/src/controls/private/CornerShadow.qml
--- a/src/controls/private/CornerShadow.qml
+++ b/src/controls/private/CornerShadow.qml
@@ -19,7 +19,7 @@
import QtQuick 2.1
import QtGraphicalEffects 1.0
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
RadialGradient {
id: shadow
diff --git a/src/controls/private/DefaultListItemBackground.qml b/src/controls/private/DefaultListItemBackground.qml
--- a/src/controls/private/DefaultListItemBackground.qml
+++ b/src/controls/private/DefaultListItemBackground.qml
@@ -18,16 +18,16 @@
*/
import QtQuick 2.1
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
Rectangle {
id: background
color: listItem.checked || (listItem.pressed && !listItem.checked && !listItem.sectionDelegate) ? (internal.indicateActiveFocus ? listItem.activeBackgroundColor : Qt.tint(listItem.backgroundColor, Qt.rgba(listItem.activeBackgroundColor.r, listItem.activeBackgroundColor.g, listItem.activeBackgroundColor.b, 0.3))) : listItem.backgroundColor
visible: listItem.ListView.view ? listItem.ListView.view.highlight === null : true
Rectangle {
id: internal
- property bool indicateActiveFocus: Settings.isMobile || listItem.activeFocus || (listItem.ListView.view ? listItem.ListView.view.activeFocus : false)
+ property bool indicateActiveFocus: listItem.pressed || Settings.isMobile || listItem.activeFocus || (listItem.ListView.view ? listItem.ListView.view.activeFocus : false)
anchors.fill: parent
visible: !Settings.isMobile
color: listItem.activeBackgroundColor
@@ -42,7 +42,7 @@
on_FirstElementChanged: {
if (_firstElement) {
- var newObject = Qt.createQmlObject('import QtQuick 2.0; import org.kde.kirigami 2.0; Separator {anchors {left: parent.left; right: parent.right; bottom: parent.top} visible: listItem.separatorVisible}',
+ var newObject = Qt.createQmlObject('import QtQuick 2.0; import org.kde.kirigami 2.2; Separator {anchors {left: parent.left; right: parent.right; bottom: parent.top} visible: listItem.separatorVisible}',
background);
}
}
diff --git a/src/controls/private/EdgeShadow.qml b/src/controls/private/EdgeShadow.qml
--- a/src/controls/private/EdgeShadow.qml
+++ b/src/controls/private/EdgeShadow.qml
@@ -19,7 +19,7 @@
import QtQuick 2.1
import QtGraphicalEffects 1.0
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
LinearGradient {
id: shadow
diff --git a/src/controls/private/PrivateActionToolButton.qml b/src/controls/private/PrivateActionToolButton.qml
--- a/src/controls/private/PrivateActionToolButton.qml
+++ b/src/controls/private/PrivateActionToolButton.qml
@@ -20,7 +20,7 @@
import QtQuick 2.6
import QtQuick.Layouts 1.2
import QtQuick.Controls 2.0 as Controls
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
Controls.ToolButton {
id: control
diff --git a/src/controls/private/RefreshableScrollView.qml b/src/controls/private/RefreshableScrollView.qml
--- a/src/controls/private/RefreshableScrollView.qml
+++ b/src/controls/private/RefreshableScrollView.qml
@@ -21,7 +21,7 @@
import QtQuick.Controls 2.0 as QQC2
import QtGraphicalEffects 1.0
import QtQuick.Layouts 1.2
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
import "../templates/private" as P
/**
@@ -33,7 +33,7 @@
* Example usage:
*
* @code
- * import org.kde.kirigami 2.0 as Kirigami
+ * import org.kde.kirigami 2.2 as Kirigami
* [...]
*
* Kirigami.RefreshableScrollView {
@@ -134,7 +134,7 @@
visible: supportsRefreshing && !refreshing && progress > 0
color: "transparent"
opacity: 0.8
- border.color: Theme.viewBackgroundColor
+ border.color: Theme.backgroundColor
border.width: Math.ceil(Units.smallSpacing/4)
//also take into account the listview header height if present
property real progress: supportsRefreshing && !refreshing ? ((parent.y - busyIndicatorFrame.headerItemHeight)/busyIndicatorFrame.height) : 0
diff --git a/src/controls/private/SwipeItemEventFilter.qml b/src/controls/private/SwipeItemEventFilter.qml
--- a/src/controls/private/SwipeItemEventFilter.qml
+++ b/src/controls/private/SwipeItemEventFilter.qml
@@ -18,7 +18,7 @@
*/
import QtQuick 2.5
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
MouseArea {
diff --git a/src/controls/templates/AbstractApplicationHeader.qml b/src/controls/templates/AbstractApplicationHeader.qml
--- a/src/controls/templates/AbstractApplicationHeader.qml
+++ b/src/controls/templates/AbstractApplicationHeader.qml
@@ -20,7 +20,7 @@
import QtQuick 2.5
import QtQuick.Layouts 1.2
import "private"
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
/**
diff --git a/src/controls/templates/AbstractListItem.qml b/src/controls/templates/AbstractListItem.qml
--- a/src/controls/templates/AbstractListItem.qml
+++ b/src/controls/templates/AbstractListItem.qml
@@ -19,7 +19,7 @@
import QtQuick 2.1
import QtQuick.Layouts 1.0
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
import QtQuick.Templates 2.0 as T2
/**
@@ -65,19 +65,19 @@
/**
* textColor: color
* Color for the text in the item
- * It is advised to leave the default value (Theme.viewTextColor)
+ * It is advised to leave the default value (Theme.textColor)
*
* Note: if custom text elements are inserted in an AbstractListItem,
* their color proprty will ahve to be manually binded with this property
*/
- property color textColor: Theme.viewTextColor
+ property color textColor: Theme.textColor
/**
* backgroundColor: color
* Color for the background of the item
* It is advised to leave the default value (Theme.viewBackgroundColor)
*/
- property color backgroundColor: Theme.viewBackgroundColor
+ property color backgroundColor: Theme.backgroundColor
/**
* activeTextColor: color
@@ -98,6 +98,7 @@
default property alias _default: listItem.contentItem
+ Theme.colorSet: Theme.View
leftPadding: Units.smallSpacing * 2
topPadding: Units.smallSpacing * 2
rightPadding: Units.smallSpacing * 2
@@ -116,5 +117,5 @@
hoverEnabled: true
- Accessible.role: Accessible.MenuItem
+ Accessible.role: Accessible.ListItem
}
diff --git a/src/controls/templates/ApplicationHeader.qml b/src/controls/templates/ApplicationHeader.qml
--- a/src/controls/templates/ApplicationHeader.qml
+++ b/src/controls/templates/ApplicationHeader.qml
@@ -21,7 +21,7 @@
import QtQuick.Controls 2.0 as QQC2
import QtQuick.Layouts 1.2
import "private"
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
/**
diff --git a/src/controls/templates/OverlayDrawer.qml b/src/controls/templates/OverlayDrawer.qml
--- a/src/controls/templates/OverlayDrawer.qml
+++ b/src/controls/templates/OverlayDrawer.qml
@@ -19,7 +19,7 @@
import QtQuick 2.1
import QtQuick.Templates 2.0 as T2
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
import "private"
/**
@@ -185,6 +185,11 @@
}
}
+ Theme.colorSet: Theme.View
+ Theme.onColorSetChanged: {
+ contentItem.Theme.colorSet = Theme.colorSet
+ background.Theme.colorSet = Theme.colorSet
+ }
//END Properties
@@ -299,6 +304,8 @@
root.enter.enabled = true;
}
__internal.completed = true;
+ contentItem.Theme.colorSet = Theme.colorSet;
+ background.Theme.colorSet = Theme.colorSet;
}
//END signal handlers
diff --git a/src/controls/templates/OverlaySheet.qml b/src/controls/templates/OverlaySheet.qml
--- a/src/controls/templates/OverlaySheet.qml
+++ b/src/controls/templates/OverlaySheet.qml
@@ -18,7 +18,7 @@
*/
import QtQuick 2.5
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
import QtGraphicalEffects 1.0
import QtQuick.Templates 2.0 as T2
import "private"
@@ -35,6 +35,9 @@
QtObject {
id: root
+ Theme.colorSet: Theme.View
+ Theme.inherit: false
+
/**
* contentItem: Item
* This property holds the visual content item.
@@ -142,6 +145,8 @@
readonly property Item rootItem: MouseArea {
id: mainItem
+ Theme.colorSet: root.Theme.colorSet
+ Theme.inherit: root.Theme.inherit
//we want to be over any possible OverlayDrawers, including handles
parent: root.parent == applicationWindow().overlay ? root.parent.parent : root.parent
anchors.fill: parent
@@ -323,7 +328,7 @@
z: -1
parent: scrollView.verticalScrollBar.background
anchors.fill:parent
- color: Theme.viewBackgroundColor
+ color: Theme.backgroundColor
}
Binding {
target: scrollView.verticalScrollBar
diff --git a/src/controls/templates/SwipeListItem.qml b/src/controls/templates/SwipeListItem.qml
--- a/src/controls/templates/SwipeListItem.qml
+++ b/src/controls/templates/SwipeListItem.qml
@@ -19,7 +19,7 @@
import QtQuick 2.7
import QtQuick.Layouts 1.2
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
import "../private"
import QtQuick.Templates 2.0 as T2
@@ -100,13 +100,13 @@
* Note: if custom text elements are inserted in an AbstractListItem,
* their color proprty will ahve to be manually binded with this property
*/
- property color textColor: Theme.viewTextColor
+ property color textColor: Theme.textColor
/**
* backgroundColor: color
* Color for the background of the item
*/
- property color backgroundColor: Theme.viewBackgroundColor
+ property color backgroundColor: Theme.backgroundColor
/**
* activeTextColor: color
diff --git a/src/controls/templates/private/BackButton.qml b/src/controls/templates/private/BackButton.qml
--- a/src/controls/templates/private/BackButton.qml
+++ b/src/controls/templates/private/BackButton.qml
@@ -20,7 +20,7 @@
import QtQuick 2.1
import QtQuick.Controls 2.0 as Controls
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
Controls.ToolButton {
anchors {
diff --git a/src/controls/templates/private/ContextIcon.qml b/src/controls/templates/private/ContextIcon.qml
--- a/src/controls/templates/private/ContextIcon.qml
+++ b/src/controls/templates/private/ContextIcon.qml
@@ -20,7 +20,7 @@
import QtQuick 2.1
import QtQuick.Layouts 1.2
import QtGraphicalEffects 1.0
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
Item {
id: canvas
diff --git a/src/controls/templates/private/MenuIcon.qml b/src/controls/templates/private/MenuIcon.qml
--- a/src/controls/templates/private/MenuIcon.qml
+++ b/src/controls/templates/private/MenuIcon.qml
@@ -20,7 +20,7 @@
import QtQuick 2.1
import QtQuick.Layouts 1.2
import QtGraphicalEffects 1.0
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
Item {
id: canvas
diff --git a/src/controls/templates/private/PassiveNotification.qml b/src/controls/templates/private/PassiveNotification.qml
--- a/src/controls/templates/private/PassiveNotification.qml
+++ b/src/controls/templates/private/PassiveNotification.qml
@@ -21,7 +21,7 @@
import QtQuick.Controls 2.0 as QQC2
import QtQuick.Layouts 1.2
import QtGraphicalEffects 1.0
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
MouseArea {
id: root
diff --git a/src/controls/templates/private/ScrollView.qml b/src/controls/templates/private/ScrollView.qml
--- a/src/controls/templates/private/ScrollView.qml
+++ b/src/controls/templates/private/ScrollView.qml
@@ -18,7 +18,7 @@
*/
import QtQuick 2.5
import QtQuick.Controls 2.0
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
MouseArea {
id: root
diff --git a/src/desktopicon.h b/src/desktopicon.h
--- a/src/desktopicon.h
+++ b/src/desktopicon.h
@@ -27,6 +27,11 @@
class QNetworkAccessManager;
class QNetworkReply;
+
+namespace Kirigami {
+ class PlatformTheme;
+}
+
class DesktopIcon : public QQuickItem
{
Q_OBJECT
@@ -39,6 +44,8 @@
Q_PROPERTY(bool active READ active WRITE setActive NOTIFY activeChanged)
Q_PROPERTY(bool valid READ valid NOTIFY validChanged)
Q_PROPERTY(bool selected READ selected WRITE setSelected NOTIFY selectedChanged)
+ Q_PROPERTY(bool isMask READ isMask WRITE setIsMask NOTIFY isMaskChanged)
+ Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
public:
DesktopIcon(QQuickItem *parent=0);
@@ -63,6 +70,12 @@
void setSelected(bool selected = true);
bool selected() const;
+ void setIsMask(bool mask);
+ bool isMask() const;
+
+ void setColor(const QColor &color);
+ QColor color() const;
+
QSGNode* updatePaintNode(QSGNode* node, UpdatePaintNodeData* data) Q_DECL_OVERRIDE;
Q_SIGNALS:
@@ -72,20 +85,26 @@
void activeChanged();
void validChanged();
void selectedChanged();
+ void isMaskChanged();
+ void colorChanged();
protected:
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
QImage findIcon(const QSize& size);
void handleFinished(QNetworkAccessManager* qnam, QNetworkReply* reply);
void handleReadyRead(QNetworkReply* reply);
QIcon::Mode iconMode() const;
+
private:
+ Kirigami::PlatformTheme *m_theme = nullptr;
QVariant m_source;
bool m_smooth;
bool m_changed;
bool m_active;
bool m_selected;
+ bool m_isMask;
QImage m_loadedImage;
+ QColor m_color = Qt::transparent;
};
#endif
diff --git a/src/desktopicon.cpp b/src/desktopicon.cpp
--- a/src/desktopicon.cpp
+++ b/src/desktopicon.cpp
@@ -19,6 +19,7 @@
*/
#include "desktopicon.h"
+#include "platformtheme.h"
#include
#include
@@ -33,6 +34,7 @@
#include
#include
#include
+#include
class ManagedTextureNode : public QSGSimpleTextureNode
{
@@ -132,9 +134,11 @@
m_smooth(false),
m_changed(false),
m_active(false),
- m_selected(false)
+ m_selected(false),
+ m_isMask(false)
{
setFlag(ItemHasContents, true);
+ //FIXME: not necessary anymore
connect(qApp, &QGuiApplication::paletteChanged, this, [this]() {
m_changed = true;
update();
@@ -153,6 +157,17 @@
}
m_source = icon;
m_changed = true;
+
+ if (!m_theme) {
+ m_theme = static_cast(qmlAttachedPropertiesObject(this, true));
+ Q_ASSERT(m_theme);
+
+ connect(m_theme, &Kirigami::PlatformTheme::colorsChanged, this, [this]() {
+ m_changed = true;
+ update();
+ });
+ }
+
update();
emit sourceChanged();
}
@@ -211,6 +226,37 @@
return m_selected;
}
+void DesktopIcon::setIsMask(bool mask)
+{
+ if (m_isMask == mask) {
+ return;
+ }
+
+ m_isMask = mask;
+ emit isMaskChanged();
+}
+
+bool DesktopIcon::isMask() const
+{
+ return m_isMask;
+}
+
+void DesktopIcon::setColor(const QColor &color)
+{
+ if (m_color == color) {
+ return;
+ }
+
+ m_color = color;
+ emit colorChanged();
+}
+
+QColor DesktopIcon::color() const
+{
+ return m_color;
+}
+
+
int DesktopIcon::implicitWidth() const
{
return 32;
@@ -269,8 +315,11 @@
img = findIcon(size);
break;
case QVariant::Brush:
+ //todo: fill here too?
case QVariant::Color:
- //perhaps fill image instead?
+ img = QImage(size, QImage::Format_Alpha8);
+ img.fill(m_source.value());
+ break;
default:
break;
}
@@ -402,10 +451,16 @@
}
QIcon icon(iconSource);
if (icon.availableSizes().isEmpty()) {
- icon = QIcon::fromTheme(iconSource);
+ icon = m_theme->iconFromTheme(iconSource, m_color);
}
if (!icon.availableSizes().isEmpty()){
img = icon.pixmap(size, iconMode(), QIcon::On).toImage();
+ if (m_isMask || icon.isMask()) {
+ QPainter p(&img);
+ p.setCompositionMode(QPainter::CompositionMode_SourceIn);
+ p.fillRect(img.rect(), m_theme->textColor());
+ p.end();
+ }
}
}
return img;
diff --git a/src/kirigamiplugin.cpp b/src/kirigamiplugin.cpp
--- a/src/kirigamiplugin.cpp
+++ b/src/kirigamiplugin.cpp
@@ -28,6 +28,12 @@
#include
#include
+#ifdef KIRIGAMI_BUILD_TYPE_STATIC
+#include "libkirigami/platformtheme.h"
+#else
+#include
+#endif
+
static QString s_selectedStyle;
QUrl KirigamiPlugin::componentUrl(const QString &fileName) const
@@ -52,9 +58,9 @@
#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS)
m_stylesFallbackChain.prepend(QStringLiteral("org.kde.desktop"));
#elif defined(Q_OS_ANDROID)
- m_stylesFallbackChain.prepend(QStringLiteral("material"));
+ m_stylesFallbackChain.prepend(QStringLiteral("Material"));
#else // do we have an iOS specific style?
- m_stylesFallbackChain.prepend(QStringLiteral("material"));
+ m_stylesFallbackChain.prepend(QStringLiteral("Material"));
#endif
}
@@ -67,9 +73,8 @@
}
//At this point the fallback chain will be selected->org.kde.desktop->Fallback
+ Kirigami::PlatformTheme::setFallbackThemeQmlPath(componentUrl(QStringLiteral("Theme.qml")));
- //TODO: in this plugin it will end up something similar to
- //PlasmaCore's ColorScope?
s_selectedStyle = m_stylesFallbackChain.first();
qmlRegisterSingletonType(uri, 2, 0, "Settings",
[](QQmlEngine*, QJSEngine*) -> QObject* {
@@ -82,6 +87,8 @@
qmlRegisterUncreatableType(uri, 2, 0, "ApplicationHeaderStyle", "Cannot create objects of type ApplicationHeaderStyle");
qmlRegisterSingletonType(componentUrl(QStringLiteral("Theme.qml")), uri, 2, 0, "Theme");
+ //Theme changed from a singleton to an attached property
+ qmlRegisterUncreatableType(uri, 2, 2, "Theme", "Cannot create objects of type Theme, use it as an attached poperty");
qmlRegisterSingletonType(componentUrl(QStringLiteral("Units.qml")), uri, 2, 0, "Units");
qmlRegisterType(componentUrl(QStringLiteral("Action.qml")), uri, 2, 0, "Action");
@@ -101,7 +108,12 @@
//The icon is "special: we have to use a wrapper class to QIcon on org.kde.desktops
#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS)
- qmlRegisterType(uri, 2, 0, "Icon");
+ //we know that we want a different implementation with Material and Plasma styles
+ if (s_selectedStyle == QStringLiteral("Material") || s_selectedStyle == QStringLiteral("Plasma")) {
+ qmlRegisterType(componentUrl(QStringLiteral("Icon.qml")), uri, 2, 0, "Icon");
+ } else {
+ qmlRegisterType(uri, 2, 0, "Icon");
+ }
#else
qmlRegisterType(componentUrl(QStringLiteral("Icon.qml")), uri, 2, 0, "Icon");
#endif
diff --git a/src/libkirigami/CMakeLists.txt b/src/libkirigami/CMakeLists.txt
new file mode 100644
--- /dev/null
+++ b/src/libkirigami/CMakeLists.txt
@@ -0,0 +1,85 @@
+
+
+set(libkirigami_SRCS
+ platformtheme.cpp
+ basictheme.cpp
+ kirigamipluginfactory.cpp
+)
+
+include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
+
+ecm_qt_declare_logging_category(libkirigami_SRCS
+ HEADER loggingcategory.h
+ IDENTIFIER KirigamiLog
+ CATEGORY_NAME kf5.kirigami
+ DEFAULT_SEVERITY Warning
+)
+
+add_library(KF5Kirigami2 ${libkirigami_SRCS})
+generate_export_header(KF5Kirigami2 BASE_NAME Kirigami2)
+add_library(KF5::Kirigami2 ALIAS KF5Kirigami2)
+
+target_include_directories(KF5Kirigami2
+ INTERFACE "$"
+)
+
+target_link_libraries(KF5Kirigami2
+ PUBLIC
+ Qt5::Core
+ PRIVATE
+ Qt5::Qml
+ Qt5::Quick
+ Qt5::QuickControls2
+)
+
+set_target_properties(KF5Kirigami2 PROPERTIES
+ VERSION ${KIRIGAMI_VERSION_STRING}
+ SOVERSION ${KIRIGAMI_SOVERSION}
+ EXPORT_NAME "Kirigami2"
+)
+
+ecm_generate_headers(Kirigami2_HEADERS
+ HEADER_NAMES
+ PlatformTheme
+ KirigamiPluginFactory
+
+ REQUIRED_HEADERS Kirigami2_HEADERS
+)
+
+install(TARGETS KF5Kirigami2
+ EXPORT KF5Kirigami2Targets
+ ${KF5_INSTALL_TARGETS_DEFAULT_ARGS})
+
+
+install(FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/kirigami2_export.h
+ ${Kirigami2_HEADERS}
+ DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/Kirigami2
+ COMPONENT Devel)
+
+if(BUILD_QCH)
+ ecm_add_qch(
+ KF5Kirigami2_QCH
+ NAME Kirigami2
+ BASE_NAME KF5Kirigami2
+ VERSION ${KF5_VERSION}
+ ORG_DOMAIN org.kde
+ SOURCES # using only public headers, to cover only public API
+ ${Kirigami2_HEADERS}
+ MD_MAINPAGE "${CMAKE_SOURCE_DIR}/README.md"
+ LINK_QCHS
+ Qt5Core_QCH
+ BLANK_MACROS
+ KIRIGAMI_EXPORT
+ KIRIGAMI_DEPRECATED
+ TAGFILE_INSTALL_DESTINATION ${KDE_INSTALL_QTQCHDIR}
+ QCH_INSTALL_DESTINATION ${KDE_INSTALL_QTQCHDIR}
+ COMPONENT Devel
+ )
+endif()
+
+include(ECMGeneratePriFile)
+ecm_generate_pri_file(BASE_NAME Kirigami2 LIB_NAME KF5Kirigami2 DEPS "core" FILENAME_VAR PRI_FILENAME INCLUDE_INSTALL_DIR ${KDE_INSTALL_INCLUDEDIR_KF5}/Kirigami2)
+install(FILES ${PRI_FILENAME}
+ DESTINATION ${ECM_MKSPECS_INSTALL_DIR})
+
diff --git a/src/libkirigami/basictheme.cpp b/src/libkirigami/basictheme.cpp
new file mode 100644
--- /dev/null
+++ b/src/libkirigami/basictheme.cpp
@@ -0,0 +1,295 @@
+/*
+* Copyright (C) 2017 by 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.
+*/
+
+#include "basictheme_p.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+namespace Kirigami {
+
+class BasicThemeDeclarativeSingleton
+{
+public:
+ BasicThemeDeclarativeSingleton()
+ {}
+
+ BasicThemeDeclarative self;
+};
+
+Q_GLOBAL_STATIC(BasicThemeDeclarativeSingleton, privateBasicThemeDeclarativeSelf)
+
+BasicThemeDeclarative::BasicThemeDeclarative()
+{
+ m_colorSyncTimer = new QTimer;
+ m_colorSyncTimer->setInterval(0);
+ m_colorSyncTimer->setSingleShot(true);
+}
+
+BasicThemeDeclarative::~BasicThemeDeclarative()
+{
+ delete m_colorSyncTimer;
+}
+
+void BasicThemeDeclarative::setQmlPath(const QUrl &path)
+{
+ m_qmlPath = path;
+}
+
+QUrl BasicThemeDeclarative::qmlPath() const
+{
+ return m_qmlPath;
+}
+
+QObject *BasicThemeDeclarative::instance(const BasicTheme *theme)
+{
+ if (m_declarativeBasicTheme) {
+ return m_declarativeBasicTheme;
+ }
+
+ QQmlEngine *engine = qmlEngine(theme->parent());
+ Q_ASSERT(engine);
+
+ QQmlComponent c(engine);
+ c.loadUrl(m_qmlPath);
+
+ m_declarativeBasicTheme = c.create();
+
+ return m_declarativeBasicTheme;
+}
+
+
+
+BasicTheme::BasicTheme(QObject *parent)
+ : PlatformTheme(parent)
+{
+ //TODO: correct?
+ connect(qApp, &QGuiApplication::fontDatabaseChanged, this, [this]() {setDefaultFont(qApp->font());});
+
+ //connect all the declarative object signals to the timer start to compress, use the old syntax as they are all signals defined in QML
+ connect(basicThemeDeclarative()->instance(this), SIGNAL(textColorChanged()),
+ basicThemeDeclarative()->m_colorSyncTimer, SLOT(start()));
+ connect(basicThemeDeclarative()->instance(this), SIGNAL(disabledTextColorChanged()),
+ basicThemeDeclarative()->m_colorSyncTimer, SLOT(start()));
+ connect(basicThemeDeclarative()->instance(this), SIGNAL(highlightColorChanged()),
+ basicThemeDeclarative()->m_colorSyncTimer, SLOT(start()));
+ connect(basicThemeDeclarative()->instance(this), SIGNAL(highlightedTextColorChanged()),
+ basicThemeDeclarative()->m_colorSyncTimer, SLOT(start()));
+ connect(basicThemeDeclarative()->instance(this), SIGNAL(backgroundColorChanged()),
+ basicThemeDeclarative()->m_colorSyncTimer, SLOT(start()));
+ connect(basicThemeDeclarative()->instance(this), SIGNAL(linkColorChanged()),
+ basicThemeDeclarative()->m_colorSyncTimer, SLOT(start()));
+ connect(basicThemeDeclarative()->instance(this), SIGNAL(visitedLinkColorChanged()),
+ basicThemeDeclarative()->m_colorSyncTimer, SLOT(start()));
+
+ connect(basicThemeDeclarative()->instance(this), SIGNAL(buttonTextColorChanged()),
+ basicThemeDeclarative()->m_colorSyncTimer, SLOT(start()));
+ connect(basicThemeDeclarative()->instance(this), SIGNAL(buttonBackgroundColorChanged()),
+ basicThemeDeclarative()->m_colorSyncTimer, SLOT(start()));
+ connect(basicThemeDeclarative()->instance(this), SIGNAL(buttonHoverColorChanged()),
+ basicThemeDeclarative()->m_colorSyncTimer, SLOT(start()));
+ connect(basicThemeDeclarative()->instance(this), SIGNAL(buttonFocusColorChanged()),
+ basicThemeDeclarative()->m_colorSyncTimer, SLOT(start()));
+
+ connect(basicThemeDeclarative()->instance(this), SIGNAL(viewTextColorChanged()),
+ basicThemeDeclarative()->m_colorSyncTimer, SLOT(start()));
+ connect(basicThemeDeclarative()->instance(this), SIGNAL(viewBackgroundColorChanged()),
+ basicThemeDeclarative()->m_colorSyncTimer, SLOT(start()));
+ connect(basicThemeDeclarative()->instance(this), SIGNAL(viewHoverColorChanged()),
+ basicThemeDeclarative()->m_colorSyncTimer, SLOT(start()));
+ connect(basicThemeDeclarative()->instance(this), SIGNAL(viewFocusColorChanged()),
+ basicThemeDeclarative()->m_colorSyncTimer, SLOT(start()));
+
+ connect(basicThemeDeclarative()->instance(this), SIGNAL(complementaryTextColorChanged()),
+ basicThemeDeclarative()->m_colorSyncTimer, SLOT(start()));
+ connect(basicThemeDeclarative()->instance(this), SIGNAL(complementaryBackgroundColorChanged()),
+ basicThemeDeclarative()->m_colorSyncTimer, SLOT(start()));
+ connect(basicThemeDeclarative()->instance(this), SIGNAL(complementaryHoverColorChanged()),
+ basicThemeDeclarative()->m_colorSyncTimer, SLOT(start()));
+ connect(basicThemeDeclarative()->instance(this), SIGNAL(complementaryFocusColorChanged()),
+ basicThemeDeclarative()->m_colorSyncTimer, SLOT(start()));
+
+ //finally connect the timer to the sync
+ connect(basicThemeDeclarative()->m_colorSyncTimer, &QTimer::timeout,
+ this, &BasicTheme::syncColors);
+ connect(this, &BasicTheme::colorSetChanged,
+ this, [this]() {
+ syncColors();
+ if (basicThemeDeclarative()->instance(this)) {
+ QMetaObject::invokeMethod(basicThemeDeclarative()->instance(this), "__propagateColorSet", Q_ARG(QVariant, QVariant::fromValue(this->parent())), Q_ARG(QVariant, colorSet()));
+ }
+ });
+ syncColors();
+}
+
+BasicTheme::~BasicTheme()
+{
+}
+
+QStringList BasicTheme::keys() const
+{
+ QStringList props;
+ for (int i = metaObject()->propertyOffset(); i < metaObject()->propertyCount(); ++i) {
+ const QString prop = metaObject()->property(i).name();
+ if (prop != "keys") {
+ props << prop;
+ }
+ }
+ return props;
+}
+
+//TODO: tint for which we need to chain to m_parentBasicTheme's color
+#define RESOLVECOLOR(colorName, upperCaseColor) \
+ QColor color;\
+ switch (colorSet()) {\
+ case BasicTheme::Button:\
+ color = basicThemeDeclarative()->instance(this)->property("button"#upperCaseColor).value();\
+ break;\
+ case BasicTheme::View:\
+ color = basicThemeDeclarative()->instance(this)->property("view"#upperCaseColor).value();\
+ break;\
+ case BasicTheme::Selection:\
+ color = basicThemeDeclarative()->instance(this)->property("selection"#upperCaseColor).value();\
+ break;\
+ case BasicTheme::Tooltip:\
+ color = basicThemeDeclarative()->instance(this)->property("tooltip"#upperCaseColor).value();\
+ break;\
+ case BasicTheme::Complementary:\
+ color = basicThemeDeclarative()->instance(this)->property("complementary"#upperCaseColor).value();\
+ break;\
+ case BasicTheme::Window:\
+ default:\
+ color = basicThemeDeclarative()->instance(this)->property(#colorName).value();\
+ }\
+
+
+#define PROXYCOLOR(colorName, upperCaseColor) \
+ basicThemeDeclarative()->instance(this)->property(#colorName).value()
+
+
+void BasicTheme::syncColors()
+{
+ {
+ RESOLVECOLOR(textColor, TextColor);
+ setTextColor(color);
+ }{
+ setDisabledTextColor(PROXYCOLOR(disabledTextColor, DisabledTextColor));
+ }{
+ RESOLVECOLOR(backgroundColor, BackgroundColor)
+ setBackgroundColor(color);
+ }{
+ setHighlightColor(PROXYCOLOR(highlightColor, HighlightColor));
+ }{
+ setHighlightedTextColor(PROXYCOLOR(highlightedTextColor, HighlightedTextColor));
+ }{
+ setActiveTextColor(PROXYCOLOR(activeTextColor, ActiveTextColor));
+ }{
+ setLinkColor(PROXYCOLOR(linkColor, LinkColor));
+ }{
+ setVisitedLinkColor(PROXYCOLOR(visitedLinkColor, VisitedLinkColor));
+ }{
+ setNegativeTextColor(PROXYCOLOR(negativeTextColor, NegativeTextColor));
+ }{
+ setNeutralTextColor(PROXYCOLOR(neutralTextColor, NeutralTextColor));
+ }{
+ setPositiveTextColor(PROXYCOLOR(positiveTextColor, PositiveTextColor));
+ }{
+ RESOLVECOLOR(hoverColor, HoverColor);
+ setHoverColor(color);
+ }{
+ RESOLVECOLOR(focusColor, FocusColor);
+ setFocusColor(color);
+ }
+
+ //legacy
+ {
+ m_buttonTextColor = PROXYCOLOR(buttonTextColor, ButtonTextColor);
+ m_buttonBackgroundColor = PROXYCOLOR(buttonBackgroundColor, ButtonBackgroundColor);
+ m_buttonHoverColor = PROXYCOLOR(buttonHoverColor, ButtonHoverColor);
+ m_buttonFocusColor = PROXYCOLOR(buttonFocusColor, ButtonFocusColor);
+ m_viewTextColor = PROXYCOLOR(viewTextColor, ViewTextColor);
+ m_viewBackgroundColor = PROXYCOLOR(viewBackgroundColor, ViewBackgroundColor);
+ m_viewHoverColor = PROXYCOLOR(viewHoverColor, ViewHoverColor);
+ m_viewFocusColor = PROXYCOLOR(viewFocusColor, ViewFocusColor);
+ }
+ //TODO: build the qpalette
+ emit colorsChanged();
+}
+
+QColor BasicTheme::buttonTextColor() const
+{
+ qWarning()<<"WARNING: buttonTextColor is deprecated, use textColor with colorSet: Theme.Button instead";
+ return m_buttonTextColor;
+}
+
+QColor BasicTheme::buttonBackgroundColor() const
+{
+ qWarning()<<"WARNING: buttonBackgroundColor is deprecated, use backgroundColor with colorSet: Theme.Button instead";
+ return m_buttonBackgroundColor;
+}
+
+QColor BasicTheme::buttonHoverColor() const
+{
+ qWarning()<<"WARNING: buttonHoverColor is deprecated, use backgroundColor with colorSet: Theme.Button instead";
+ return m_buttonHoverColor;
+}
+
+QColor BasicTheme::buttonFocusColor() const
+{
+ qWarning()<<"WARNING: buttonFocusColor is deprecated, use backgroundColor with colorSet: Theme.Button instead";
+ return m_buttonFocusColor;
+}
+
+
+QColor BasicTheme::viewTextColor() const
+{
+ qWarning()<<"WARNING: viewTextColor is deprecated, use backgroundColor with colorSet: Theme.View instead";
+ return m_viewTextColor;
+}
+
+QColor BasicTheme::viewBackgroundColor() const
+{
+ qWarning()<<"WARNING: viewBackgroundColor is deprecated, use backgroundColor with colorSet: Theme.View instead";
+ return m_viewBackgroundColor;
+}
+
+QColor BasicTheme::viewHoverColor() const
+{
+ qWarning()<<"WARNING: viewHoverColor is deprecated, use backgroundColor with colorSet: Theme.View instead";
+ return m_viewHoverColor;
+}
+
+QColor BasicTheme::viewFocusColor() const
+{
+ qWarning()<<"WARNING: viewFocusColor is deprecated, use backgroundColor with colorSet: Theme.View instead";
+ return m_viewFocusColor;
+}
+
+BasicThemeDeclarative *BasicTheme::basicThemeDeclarative()
+{
+ return &privateBasicThemeDeclarativeSelf->self;
+}
+
+}
+
+#include "moc_basictheme_p.cpp"
diff --git a/src/libkirigami/basictheme_p.h b/src/libkirigami/basictheme_p.h
new file mode 100644
--- /dev/null
+++ b/src/libkirigami/basictheme_p.h
@@ -0,0 +1,105 @@
+/*
+* Copyright (C) 2017 by 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.
+*/
+
+#ifndef BASICTHEME_H
+#define BASICTHEME_H
+
+#include "platformtheme.h"
+#include
+#include
+#include
+#include
+
+namespace Kirigami {
+
+class BasicTheme;
+
+class BasicThemeDeclarative
+{
+public:
+ BasicThemeDeclarative();
+ virtual ~BasicThemeDeclarative();
+
+ void setQmlPath(const QUrl &path);
+ QUrl qmlPath() const;
+ QObject *instance(const BasicTheme *theme);
+
+ QTimer *m_colorSyncTimer;
+
+private:
+ QUrl m_qmlPath;
+ QObject *m_declarativeBasicTheme = nullptr;
+};
+
+class BasicTheme : public PlatformTheme
+{
+ Q_OBJECT
+
+ // colors
+ Q_PROPERTY(QColor buttonTextColor READ buttonTextColor NOTIFY colorsChanged)
+ Q_PROPERTY(QColor buttonBackgroundColor READ buttonBackgroundColor NOTIFY colorsChanged)
+ Q_PROPERTY(QColor buttonHoverColor READ buttonHoverColor NOTIFY colorsChanged)
+ Q_PROPERTY(QColor buttonFocusColor READ buttonFocusColor NOTIFY colorsChanged)
+
+ Q_PROPERTY(QColor viewTextColor READ viewTextColor NOTIFY colorsChanged)
+ Q_PROPERTY(QColor viewBackgroundColor READ viewBackgroundColor NOTIFY colorsChanged)
+ Q_PROPERTY(QColor viewHoverColor READ viewHoverColor NOTIFY colorsChanged)
+ Q_PROPERTY(QColor viewFocusColor READ viewFocusColor NOTIFY colorsChanged)
+
+ //FIXME: this is due https://bugreports.qt.io/browse/QTBUG-63089
+ Q_PROPERTY(QStringList keys READ keys CONSTANT)
+
+public:
+ explicit BasicTheme(QObject *parent = 0);
+ ~BasicTheme();
+
+ void syncColors();
+
+ QColor buttonTextColor() const;
+ QColor buttonBackgroundColor() const;
+ QColor buttonHoverColor() const;
+ QColor buttonFocusColor() const;
+
+ QColor viewTextColor() const;
+ QColor viewBackgroundColor() const;
+ QColor viewHoverColor() const;
+ QColor viewFocusColor() const;
+
+ QStringList keys() const;
+
+ static BasicThemeDeclarative *basicThemeDeclarative();
+
+Q_SIGNALS:
+ void colorsChanged();
+
+private:
+ //legacy colors
+ QColor m_buttonTextColor;
+ QColor m_buttonBackgroundColor;
+ QColor m_buttonHoverColor;
+ QColor m_buttonFocusColor;
+ QColor m_viewTextColor;
+ QColor m_viewBackgroundColor;
+ QColor m_viewHoverColor;
+ QColor m_viewFocusColor;
+};
+
+}
+
+#endif // BASICTHEME_H
diff --git a/src/libkirigami/kirigamipluginfactory.h b/src/libkirigami/kirigamipluginfactory.h
new file mode 100644
--- /dev/null
+++ b/src/libkirigami/kirigamipluginfactory.h
@@ -0,0 +1,65 @@
+/*
+* Copyright (C) 2017 by 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.
+*/
+
+#ifndef KIRIGAMIPLUGINFACTORY_H
+#define KIRIGAMIPLUGINFACTORY_H
+
+#include "platformtheme.h"
+#include
+
+#ifndef KIRIGAMI_BUILD_TYPE_STATIC
+#include
+#endif
+
+namespace Kirigami {
+
+/**
+ * @class KirigamiPluginFactory kirigamipluginfactory.h KirigamiPluginFactory
+ *
+ * This class is reimpleented by plugins to provide different implementations
+ * of PlatformTheme
+ */
+#ifdef KIRIGAMI_BUILD_TYPE_STATIC
+class KirigamiPluginFactory : public QObject
+#else
+class KIRIGAMI2_EXPORT KirigamiPluginFactory : public QObject
+#endif
+{
+ Q_OBJECT
+
+public:
+ explicit KirigamiPluginFactory(QObject *parent = nullptr);
+ ~KirigamiPluginFactory();
+
+ /**
+ * Creates an instance of PlatformTheme which can come out from
+ * an implementation provided by a plugin
+ * @param parent the parent object of the created PlatformTheme
+ */
+ virtual PlatformTheme *createPlatformTheme(QObject *parent) = 0;
+};
+
+}
+
+QT_BEGIN_NAMESPACE
+#define KirigamiPluginFactory_iid "org.kde.kirigami.KirigamiPluginFactory"
+Q_DECLARE_INTERFACE(Kirigami::KirigamiPluginFactory, KirigamiPluginFactory_iid)
+QT_END_NAMESPACE
+
+#endif //KIRIGAMIPLUGINFACTORY_H
diff --git a/src/libkirigami/kirigamipluginfactory.cpp b/src/libkirigami/kirigamipluginfactory.cpp
new file mode 100644
--- /dev/null
+++ b/src/libkirigami/kirigamipluginfactory.cpp
@@ -0,0 +1,39 @@
+/*
+* Copyright (C) 2017 by 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.
+*/
+
+#include "kirigamipluginfactory.h"
+#include "platformtheme.h"
+
+#include
+
+
+namespace Kirigami {
+
+KirigamiPluginFactory::KirigamiPluginFactory(QObject *parent)
+ : QObject(parent)
+{
+}
+
+KirigamiPluginFactory::~KirigamiPluginFactory()
+{
+}
+
+}
+
+#include "moc_kirigamipluginfactory.cpp"
diff --git a/src/libkirigami/platformtheme.h b/src/libkirigami/platformtheme.h
new file mode 100644
--- /dev/null
+++ b/src/libkirigami/platformtheme.h
@@ -0,0 +1,239 @@
+/*
+* Copyright (C) 2017 by 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.
+*/
+
+#ifndef PLATFORMTHEME_H
+#define PLATFORMTHEME_H
+
+#include
+#include
+#include
+#include
+
+#ifndef KIRIGAMI_BUILD_TYPE_STATIC
+#include
+#endif
+
+namespace Kirigami {
+
+class PlatformThemePrivate;
+
+/**
+ * @class PlatformTheme platformtheme.h PlatformTheme
+ *
+ * This class is the base for color management in Kirigami,
+ * different platforms can reimplement this class to integrate with
+ * system platform colors of a given platform
+ */
+#ifdef KIRIGAMI_BUILD_TYPE_STATIC
+class PlatformTheme : public QObject
+#else
+class KIRIGAMI2_EXPORT PlatformTheme : public QObject
+#endif
+{
+ Q_OBJECT
+
+ /**
+ * This enumeration describes the color set for which a color is being selected.
+ *
+ * Color sets define a color "environment", suitable for drawing all parts of a
+ * given region. Colors from different sets should not be combined.
+ */
+ Q_PROPERTY(ColorSet colorSet READ colorSet WRITE setColorSet NOTIFY colorSetChanged)
+
+ /**
+ * If true, the colorSet will be inherited from the colorset of a theme of one
+ * of the ancestor items
+ * default: true
+ */
+ Q_PROPERTY(bool inherit READ inherit WRITE setInherit NOTIFY inheritChanged)
+
+ // foreground colors
+ /**
+ * Color for normal foregrounds, usually text, but not limited to it,
+ * anything that should be painted with a clear contrast should use this color
+ */
+ Q_PROPERTY(QColor textColor READ textColor NOTIFY colorsChanged)
+
+ /**
+ * Foreground color for disabled areas, usually a mid-gray
+ */
+ Q_PROPERTY(QColor disabledTextColor READ disabledTextColor NOTIFY colorsChanged)
+
+ /**
+ * Color for text that has been highlighted, often is a light color while normal text is dark
+ */
+ Q_PROPERTY(QColor highlightedTextColor READ highlightedTextColor NOTIFY colorsChanged)
+
+ /**
+ * Foreground for areas that are active or requesting attention
+ */
+ Q_PROPERTY(QColor activeTextColor READ activeTextColor NOTIFY colorsChanged)
+
+ /**
+ * Color for links
+ */
+ Q_PROPERTY(QColor linkColor READ linkColor NOTIFY colorsChanged)
+
+ /**
+ * Color for visited links, usually a bit darker than linkColor
+ */
+ Q_PROPERTY(QColor visitedLinkColor READ visitedLinkColor NOTIFY colorsChanged)
+
+ /**
+ * Foreground color for negative areas, such as critical error text
+ */
+ Q_PROPERTY(QColor negativeTextColor READ negativeTextColor NOTIFY colorsChanged)
+
+ /**
+ * Foreground color for neutral areas, such as warning texts (but not critical)
+ */
+ Q_PROPERTY(QColor neutralTextColor READ neutralTextColor NOTIFY colorsChanged)
+
+ /**
+ * Success messages, trusted content
+ */
+ Q_PROPERTY(QColor positiveTextColor READ positiveTextColor NOTIFY colorsChanged)
+
+ //background colors
+ /**
+ * The generic background color
+ */
+ Q_PROPERTY(QColor backgroundColor READ backgroundColor NOTIFY colorsChanged)
+
+ /**
+ * The background color for selected areas
+ */
+ Q_PROPERTY(QColor highlightColor READ highlightColor NOTIFY colorsChanged)
+
+ //decoration colors
+ /**
+ * A decoration color that indicates active focus
+ */
+ Q_PROPERTY(QColor focusColor READ focusColor NOTIFY colorsChanged)
+
+ /**
+ * A decoration color that indicates mouse hovering
+ */
+ Q_PROPERTY(QColor hoverColor READ hoverColor NOTIFY colorsChanged)
+
+ // font and palette
+ Q_PROPERTY(QFont defaultFont READ defaultFont NOTIFY defaultFontChanged)
+ Q_PROPERTY(QPalette palette READ palette NOTIFY paletteChanged)
+
+ Q_ENUMS(ColorSet)
+
+public:
+
+ enum ColorSet {
+ View = 0, /** Color set for item views, usually the lightest of all */
+ Window, /** Default Color set for windows and "chrome" areas */
+ Button, /** Color set used by buttons */
+ Selection, /** Color set used by selectged areas */
+ Tooltip, /** Color set used by tooltips */
+ Complementary /** Color set meant to be complementary to Window: usually is a dark theme for light themes */
+ };
+
+ explicit PlatformTheme(QObject *parent = 0);
+ ~PlatformTheme();
+
+ void setColorSet(PlatformTheme::ColorSet);
+ PlatformTheme::ColorSet colorSet() const;
+
+ bool inherit() const;
+ void setInherit(bool inherit);
+
+ //foreground colors
+ QColor textColor() const;
+ QColor disabledTextColor() const;
+ QColor highlightedTextColor() const;
+ QColor activeTextColor() const;
+ QColor linkColor() const;
+ QColor visitedLinkColor() const;
+ QColor negativeTextColor() const;
+ QColor neutralTextColor() const;
+ QColor positiveTextColor() const;
+
+ //background colors
+ QColor backgroundColor() const;
+ QColor highlightColor() const;
+ //TODO: add active/positive/neutral/negative backgrounds?
+
+ //decoration colors
+ QColor focusColor() const;
+ QColor hoverColor() const;
+
+ //Setters, not accessible from QML but from implementations
+
+ //foreground colors
+ void setTextColor(const QColor &color);
+ void setDisabledTextColor(const QColor &color);
+ void setHighlightedTextColor(const QColor &color);
+ void setActiveTextColor(const QColor &color);
+ void setLinkColor(const QColor &color);
+ void setVisitedLinkColor(const QColor &color);
+ void setNegativeTextColor(const QColor &color);
+ void setNeutralTextColor(const QColor &color);
+ void setPositiveTextColor(const QColor &color);
+
+ //background colors
+ void setBackgroundColor(const QColor &color);
+ void setHighlightColor(const QColor &color);
+
+ //decoration colors
+ void setFocusColor(const QColor &color);
+ void setHoverColor(const QColor &color);
+
+
+ QFont defaultFont() const;
+ void setDefaultFont(const QFont &defaultFont);
+
+ QPalette palette() const;
+ void setPalette(const QPalette &palette);
+
+ //this will be used by desktopicon to fetch icons with KIconLoader
+ virtual Q_INVOKABLE QIcon iconFromTheme(const QString &name, const QColor &customColor = Qt::transparent);
+ //this may be used somehow by the desktop QQC2 to set the styleoption palettes
+
+ //QML attached property
+ static PlatformTheme *qmlAttachedProperties(QObject *object);
+
+ /**
+ * @internal
+ */
+ static void setFallbackThemeQmlPath(const QUrl &path);
+ static QUrl fallbackThemeQmlPath();
+
+Q_SIGNALS:
+ //TODO: parameters to signals as this is also a c++ api
+ void colorsChanged();
+ void defaultFontChanged(const QFont &font);
+ void colorSetChanged(Kirigami::PlatformTheme::ColorSet colorSet);
+ void paletteChanged(const QPalette &pal);
+ void inheritChanged(bool inherit);
+
+private:
+ PlatformThemePrivate *d;
+ friend class PlatformThemePrivate;
+};
+
+}
+
+QML_DECLARE_TYPEINFO(Kirigami::PlatformTheme, QML_HAS_ATTACHED_PROPERTIES)
+
+#endif // PLATFORMTHEME_H
diff --git a/src/libkirigami/platformtheme.cpp b/src/libkirigami/platformtheme.cpp
new file mode 100644
--- /dev/null
+++ b/src/libkirigami/platformtheme.cpp
@@ -0,0 +1,455 @@
+/*
+* Copyright (C) 2017 by 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.
+*/
+
+#include "platformtheme.h"
+#include "kirigamipluginfactory.h"
+#include "basictheme_p.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+namespace Kirigami {
+
+class PlatformThemePrivate {
+public:
+ PlatformThemePrivate(PlatformTheme *q);
+ ~PlatformThemePrivate();
+
+ void findParentStyle();
+ static QColor tint(const QColor &c1, const QColor &c2, qreal ratio);
+
+
+ PlatformTheme *q;
+ QTimer *setColorCompressTimer;
+ PlatformTheme::ColorSet m_colorSet = PlatformTheme::Window;
+ QSet m_childThemes;
+ QPointer m_parentTheme;
+
+ QColor textColor;
+ QColor disabledTextColor;
+ QColor highlightedTextColor;
+ QColor activeTextColor;
+ QColor linkColor;
+ QColor visitedLinkColor;
+ QColor negativeTextColor;
+ QColor neutralTextColor;
+ QColor positiveTextColor;
+
+ QColor backgroundColor;
+ QColor highlightColor;
+
+ QColor focusColor;
+ QColor hoverColor;
+
+ QFont font;
+ QPalette palette;
+ bool m_inherit = true;
+};
+
+PlatformThemePrivate::PlatformThemePrivate(PlatformTheme *q)
+ : q(q)
+{
+ setColorCompressTimer = new QTimer(q);
+ setColorCompressTimer->setSingleShot(true);
+ setColorCompressTimer->setInterval(0);
+}
+
+PlatformThemePrivate::~PlatformThemePrivate()
+{}
+
+void PlatformThemePrivate::findParentStyle()
+{
+ if (m_parentTheme) {
+ m_parentTheme->d->m_childThemes.remove(q);
+ }
+ QQuickItem *candidate = qobject_cast(q->parent());
+ while (candidate) {
+ candidate = candidate->parentItem();
+ PlatformTheme *t = static_cast(qmlAttachedPropertiesObject(candidate, false));
+ if (t) {
+ t->d->m_childThemes.insert(q);
+ m_parentTheme = t;
+ if (m_inherit) {
+ q->setColorSet(t->colorSet());
+ }
+ break;
+ }
+
+ }
+}
+
+QColor PlatformThemePrivate::tint(const QColor &c1, const QColor &c2, qreal ratio)
+{
+ qreal r = c1.redF() + (c2.redF() - c1.redF()) * ratio;
+ qreal g = c1.greenF() + (c2.greenF() - c1.greenF()) * ratio;
+ qreal b = c1.blueF() + (c2.blueF() - c1.blueF()) * ratio;
+
+ return QColor::fromRgbF(r, g, b, 1);
+}
+
+
+
+
+PlatformTheme::PlatformTheme(QObject *parent)
+ : QObject(parent),
+ d(new PlatformThemePrivate(this))
+{
+ connect(d->setColorCompressTimer, &QTimer::timeout,
+ this, &PlatformTheme::colorsChanged);
+ d->findParentStyle();
+
+ if (QQuickItem *item = qobject_cast(parent)) {
+ connect(item, &QQuickItem::windowChanged, this, [this]() {
+ d->findParentStyle();
+ });
+ connect(item, &QQuickItem::parentChanged, this, [this]() {
+ d->findParentStyle();
+ });
+ }
+ //TODO: needs https://codereview.qt-project.org/#/c/206889/ for font changes
+}
+
+PlatformTheme::~PlatformTheme()
+{
+ if (d->m_parentTheme) {
+ d->m_parentTheme->d->m_childThemes.remove(this);
+ }
+}
+
+void PlatformTheme::setColorSet(PlatformTheme::ColorSet colorSet)
+{
+ if (d->m_colorSet == colorSet) {
+ return;
+ }
+
+ d->m_colorSet = colorSet;
+
+ for (PlatformTheme *t : d->m_childThemes) {
+ if (t->inherit()) {
+ t->setColorSet(colorSet);
+ }
+ }
+
+ emit colorSetChanged(colorSet);
+ d->setColorCompressTimer->start();
+}
+
+PlatformTheme::ColorSet PlatformTheme::colorSet() const
+{
+ return d->m_colorSet;
+}
+
+bool PlatformTheme::inherit() const
+{
+ return d->m_inherit;
+}
+
+void PlatformTheme::setInherit(bool inherit)
+{
+ if (d->m_inherit == inherit) {
+ return;
+ }
+
+ d->m_inherit = inherit;
+ if (inherit && d->m_parentTheme) {
+ setColorSet(d->m_parentTheme->colorSet());
+ }
+ emit inheritChanged(inherit);
+}
+
+
+QColor PlatformTheme::textColor() const
+{
+ return d->textColor;
+}
+
+QColor PlatformTheme::disabledTextColor() const
+{
+ return d->disabledTextColor;
+}
+
+QColor PlatformTheme::highlightColor() const
+{
+ return d->highlightColor;
+}
+
+QColor PlatformTheme::highlightedTextColor() const
+{
+ return d->highlightedTextColor;
+}
+
+QColor PlatformTheme::backgroundColor() const
+{
+ return d->backgroundColor;
+}
+
+QColor PlatformTheme::activeTextColor() const
+{
+ return d->activeTextColor;
+}
+
+QColor PlatformTheme::linkColor() const
+{
+ return d->linkColor;
+}
+
+QColor PlatformTheme::visitedLinkColor() const
+{
+ return d->visitedLinkColor;
+}
+
+QColor PlatformTheme::negativeTextColor() const
+{
+ return d->negativeTextColor;
+}
+
+QColor PlatformTheme::neutralTextColor() const
+{
+ return d->neutralTextColor;
+}
+
+QColor PlatformTheme::positiveTextColor() const
+{
+ return d->positiveTextColor;
+}
+
+QColor PlatformTheme::focusColor() const
+{
+ return d->focusColor;
+}
+
+QColor PlatformTheme::hoverColor() const
+{
+ return d->hoverColor;
+}
+
+
+void PlatformTheme::setTextColor(const QColor &color)
+{
+ if (d->textColor == color) {
+ return;
+ }
+
+ d->textColor = color;
+ d->setColorCompressTimer->start();
+}
+
+void PlatformTheme::setDisabledTextColor(const QColor &color)
+{
+ if (d->disabledTextColor == color) {
+ return;
+ }
+
+ d->disabledTextColor = color;
+ d->setColorCompressTimer->start();
+}
+
+void PlatformTheme::setBackgroundColor(const QColor &color)
+{
+ if (d->backgroundColor == color) {
+ return;
+ }
+
+ d->backgroundColor = color;
+ d->setColorCompressTimer->start();
+}
+
+void PlatformTheme::setHighlightColor(const QColor &color)
+{
+ if (d->highlightColor == color) {
+ return;
+ }
+
+ d->highlightColor = color;
+ d->setColorCompressTimer->start();
+}
+
+void PlatformTheme::setHighlightedTextColor(const QColor &color)
+{
+ if (d->highlightedTextColor == color) {
+ return;
+ }
+
+ d->highlightedTextColor = color;
+ d->setColorCompressTimer->start();
+}
+
+void PlatformTheme::setActiveTextColor(const QColor &color)
+{
+ if (d->activeTextColor == color) {
+ return;
+ }
+
+ d->activeTextColor = color;
+ d->setColorCompressTimer->start();
+}
+
+void PlatformTheme::setLinkColor(const QColor &color)
+{
+ if (d->linkColor == color) {
+ return;
+ }
+
+ d->linkColor = color;
+ d->setColorCompressTimer->start();
+}
+
+void PlatformTheme::setVisitedLinkColor(const QColor &color)
+{
+ if (d->visitedLinkColor == color) {
+ return;
+ }
+
+ d->visitedLinkColor = color;
+ d->setColorCompressTimer->start();
+}
+
+void PlatformTheme::setNegativeTextColor(const QColor &color)
+{
+ if (d->negativeTextColor == color) {
+ return;
+ }
+
+ d->negativeTextColor = color;
+ d->setColorCompressTimer->start();
+}
+
+void PlatformTheme::setNeutralTextColor(const QColor &color)
+{
+ if (d->neutralTextColor == color) {
+ return;
+ }
+
+ d->neutralTextColor = color;
+ d->setColorCompressTimer->start();
+}
+
+void PlatformTheme::setPositiveTextColor(const QColor &color)
+{
+ if (d->positiveTextColor == color) {
+ return;
+ }
+
+ d->positiveTextColor = color;
+ d->setColorCompressTimer->start();
+}
+
+void PlatformTheme::setHoverColor(const QColor &color)
+{
+ if (d->hoverColor == color) {
+ return;
+ }
+
+ d->hoverColor = color;
+ d->setColorCompressTimer->start();
+}
+
+void PlatformTheme::setFocusColor(const QColor &color)
+{
+ if (d->focusColor == color) {
+ return;
+ }
+
+ d->focusColor = color;
+ d->setColorCompressTimer->start();
+}
+
+QFont PlatformTheme::defaultFont() const
+{
+ return d->font;
+}
+
+void PlatformTheme::setDefaultFont(const QFont &font)
+{
+ if (d->font == font) {
+ return;
+ }
+
+ d->font = font;
+ emit defaultFontChanged(font);
+}
+
+QPalette PlatformTheme::palette() const
+{
+ return d->palette;
+}
+
+void PlatformTheme::setPalette(const QPalette &palette)
+{
+ if (d->palette == palette) {
+ return;
+ }
+
+ d->palette = palette;
+ emit paletteChanged(palette);
+}
+
+QIcon PlatformTheme::iconFromTheme(const QString &name, const QColor &customColor)
+{
+ QIcon icon = QIcon::fromTheme(name);
+ if (name.endsWith("-symbolic") || customColor != Qt::transparent) {
+ icon.setIsMask(true);
+ }
+ return icon;
+}
+
+
+
+PlatformTheme *PlatformTheme::qmlAttachedProperties(QObject *object)
+{
+ for (const QString &path : QCoreApplication::libraryPaths()) {
+ QDir dir(path + "/kf5/kirigami");
+ for (const QString &fileName : dir.entryList(QDir::Files)) {
+ //TODO: env variable?
+ if (fileName.startsWith(QQuickStyle::name())) {
+ QPluginLoader loader(dir.absoluteFilePath(fileName));
+ QObject *plugin = loader.instance();
+ //TODO: load actually a factory as plugin
+
+ KirigamiPluginFactory *factory = qobject_cast(plugin);
+ if (factory) {
+ return factory->createPlatformTheme(object);
+ }
+ }
+ }
+ }
+
+ return new BasicTheme(object);
+}
+
+void PlatformTheme::setFallbackThemeQmlPath(const QUrl &path)
+{
+ BasicTheme::basicThemeDeclarative()->setQmlPath(path);
+}
+
+QUrl PlatformTheme::fallbackThemeQmlPath()
+{
+ return BasicTheme::basicThemeDeclarative()->qmlPath();
+}
+
+}
+
+#include "moc_platformtheme.cpp"
diff --git a/src/styles/Material/AbstractListItem.qml b/src/styles/Material/AbstractListItem.qml
--- a/src/styles/Material/AbstractListItem.qml
+++ b/src/styles/Material/AbstractListItem.qml
@@ -18,45 +18,24 @@
*/
import QtQuick 2.7
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
+import QtQuick.Controls.Material 2.1 as Mat
+import QtQuick.Controls.Material.impl 2.1 as MatImp
import "../../private"
import "../../templates" as T
T.AbstractListItem {
id: listItem
- onPressedChanged: {
- if (pressed) {
- clickAnim.running = true
- }
- }
background: DefaultListItemBackground {
- clip: true
- //TODO: this will have to reuse QQC2.1 Ripple
- Rectangle {
- id: ripple
- anchors.centerIn: parent
- width: parent.width
- height: parent.width
- radius: width
- color: Qt.rgba(1,1,1,0.3)
- scale: 0
- opacity: 1
- ParallelAnimation {
- id: clickAnim
- ScaleAnimator {
- target: ripple
- from: 0
- to: 1
- duration: Units.longDuration
- }
- OpacityAnimator {
- target: ripple
- from: 0
- to: 1
- duration: Units.longDuration
- }
- }
+
+ MatImp.Ripple {
+ anchors.fill: parent
+ clip: visible
+ pressed: listItem.pressed
+ anchor: listItem
+ active: listItem.down || listItem.visualFocus
+ color: Qt.rgba(0,0,0,0.2)
}
}
implicitHeight: contentItem.implicitHeight + Units.smallSpacing * 6
diff --git a/src/styles/Material/Label.qml b/src/styles/Material/Label.qml
--- a/src/styles/Material/Label.qml
+++ b/src/styles/Material/Label.qml
@@ -18,7 +18,7 @@
*/
import QtQuick 2.1
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
import QtQuick.Templates 2.0 as T2
/**
diff --git a/src/styles/Material/SwipeListItem.qml b/src/styles/Material/SwipeListItem.qml
--- a/src/styles/Material/SwipeListItem.qml
+++ b/src/styles/Material/SwipeListItem.qml
@@ -18,7 +18,7 @@
*/
import QtQuick 2.5
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
import "../../private"
import "../../templates" as T
diff --git a/src/styles/Material/Theme.qml b/src/styles/Material/Theme.qml
--- a/src/styles/Material/Theme.qml
+++ b/src/styles/Material/Theme.qml
@@ -19,6 +19,7 @@
import QtQuick 2.7
import QtQuick.Controls.Material 2.0
+import org.kde.kirigami 2.2 as Kirigami
pragma Singleton
@@ -37,8 +38,14 @@
//FIXME: something better?
property color highlightedTextColor: theme.Material.background
property color backgroundColor: theme.Material.background
- property color linkColor: "#2196F3"
- property color visitedLinkColor: "#2196F3"
+ property color activeTextColor: theme.Material.primary
+ property color linkColor: "#2980B9"
+ property color visitedLinkColor: "#7F8C8D"
+ property color hoverColor: theme.Material.highlightedButtonColor
+ property color focusColor: theme.Material.highlightedButtonColor
+ property color negativeTextColor: "#DA4453"
+ property color neutralTextColor: "#F67400"
+ property color positiveTextColor: "#27AE60"
property color buttonTextColor: theme.Material.foreground
property color buttonBackgroundColor: theme.Material.buttonColor
@@ -50,11 +57,37 @@
property color viewHoverColor: theme.Material.listHighlightColor
property color viewFocusColor: theme.Material.listHighlightColor
+ property color selectionTextColor: theme.Material.primaryHighlightedTextColor
+ property color selectionBackgroundColor: theme.Material.textSelectionColor
+ property color selectionHoverColor: theme.Material.highlightedButtonColor
+ property color selectionFocusColor: theme.Material.highlightedButtonColor
+
+ property color tooltipTextColor: fontMetrics.Material.foreground
+ property color tooltipBackgroundColor: fontMetrics.Material.tooltipColor
+ property color tooltipHoverColor: fontMetrics.Material.highlightedButtonColor
+ property color tooltipFocusColor: fontMetrics.Material.highlightedButtonColor
+
+ property color complementaryTextColor: fontMetrics.Material.foreground
+ property color complementaryBackgroundColor: fontMetrics.Material.background
+ property color complementaryHoverColor: theme.Material.highlightedButtonColor
+ property color complementaryFocusColor: theme.Material.highlightedButtonColor
+
property font defaultFont: fontMetrics.font
property list children: [
TextMetrics {
id: fontMetrics
+ //this is to get a source of dark colors
+ Material.theme: Material.Dark
}
]
+ //for internal use
+ function __propagateColorSet(object, context) {
+ //TODO: actually check if it's a dark or light color
+ if (context == Kirigami.Theme.Complementary) {
+ object.Material.theme = Material.Dark;
+ } else {
+ object.Material.theme = Material.Light;
+ }
+ }
}
diff --git a/src/styles/Plasma/Icon.qml b/src/styles/Plasma/Icon.qml
--- a/src/styles/Plasma/Icon.qml
+++ b/src/styles/Plasma/Icon.qml
@@ -23,7 +23,11 @@
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;
diff --git a/src/styles/Plasma/Theme.qml b/src/styles/Plasma/Theme.qml
--- a/src/styles/Plasma/Theme.qml
+++ b/src/styles/Plasma/Theme.qml
@@ -21,16 +21,22 @@
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
@@ -42,5 +48,44 @@
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/org.kde.desktop/AbstractApplicationHeader.qml b/src/styles/org.kde.desktop/AbstractApplicationHeader.qml
--- a/src/styles/org.kde.desktop/AbstractApplicationHeader.qml
+++ b/src/styles/org.kde.desktop/AbstractApplicationHeader.qml
@@ -18,7 +18,7 @@
*/
import QtQuick 2.5
-import org.kde.kirigami 2.1
+import org.kde.kirigami 2.2
import "../../templates" as T
diff --git a/src/styles/org.kde.desktop/AbstractListItem.qml b/src/styles/org.kde.desktop/AbstractListItem.qml
--- a/src/styles/org.kde.desktop/AbstractListItem.qml
+++ b/src/styles/org.kde.desktop/AbstractListItem.qml
@@ -18,7 +18,7 @@
*/
import QtQuick 2.1
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
import "../../private"
import "../../templates" as T
diff --git a/src/styles/org.kde.desktop/ApplicationWindow.qml b/src/styles/org.kde.desktop/ApplicationWindow.qml
--- a/src/styles/org.kde.desktop/ApplicationWindow.qml
+++ b/src/styles/org.kde.desktop/ApplicationWindow.qml
@@ -18,7 +18,7 @@
*/
import QtQuick 2.1
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
import "../../" as Base
diff --git a/src/styles/org.kde.desktop/OverlayDrawer.qml b/src/styles/org.kde.desktop/OverlayDrawer.qml
--- a/src/styles/org.kde.desktop/OverlayDrawer.qml
+++ b/src/styles/org.kde.desktop/OverlayDrawer.qml
@@ -19,7 +19,7 @@
import QtQuick 2.1
import QtGraphicalEffects 1.0
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
import QtQuick.Templates 2.0
import "../../templates" as T
@@ -37,7 +37,7 @@
//BEGIN Properties
background: Rectangle {
- color: Theme.viewBackgroundColor
+ color: Theme.backgroundColor
Item {
parent: root.handle
@@ -55,7 +55,7 @@
Rectangle {
id: handleGraphics
anchors.centerIn: parent
- color: root.handle.pressed ? Theme.highlightColor : Theme.buttonBackgroundColor
+ color: root.handle.pressed ? Theme.highlightColor : Theme.backgroundColor
width: Units.iconSizes.smallMedium + Units.smallSpacing * 2
height: width
radius: Units.devicePixelRatio*2
@@ -67,7 +67,7 @@
onItemChanged: {
if(item) {
item.morph = Qt.binding(function(){return root.position})
- item.color = Qt.binding(function(){return root.handle.pressed ? Theme.highlightedTextColor : Theme.buttonTextColor})
+ item.color = Qt.binding(function(){return root.handle.pressed ? Theme.highlightedTextColor : Theme.textColor})
}
}
}
diff --git a/src/styles/org.kde.desktop/SwipeListItem.qml b/src/styles/org.kde.desktop/SwipeListItem.qml
--- a/src/styles/org.kde.desktop/SwipeListItem.qml
+++ b/src/styles/org.kde.desktop/SwipeListItem.qml
@@ -18,7 +18,7 @@
*/
import QtQuick 2.5
-import org.kde.kirigami 2.0
+import org.kde.kirigami 2.2
import "../../private"
import "../../templates" as T
diff --git a/src/styles/org.kde.desktop/Theme.qml b/src/styles/org.kde.desktop/Theme.qml
--- a/src/styles/org.kde.desktop/Theme.qml
+++ b/src/styles/org.kde.desktop/Theme.qml
@@ -31,8 +31,14 @@
property color highlightColor: palette.highlight
property color highlightedTextColor: palette.highlightedText
property color backgroundColor: palette.window
- property color linkColor: "#2196F3"
- property color visitedLinkColor: "#2196F3"
+ property color activeTextColor: palette.highlight
+ property color linkColor: "#2980B9"
+ property color visitedLinkColor: "#7F8C8D"
+ property color hoverColor: palette.highlight
+ property color focusColor: palette.highlight
+ property color negativeTextColor: "#DA4453"
+ property color neutralTextColor: "#F67400"
+ property color positiveTextColor: "#27AE60"
property color buttonTextColor: palette.buttonText
property color buttonBackgroundColor: palette.button
@@ -44,6 +50,21 @@
property color viewHoverColor: palette.highlight
property color viewFocusColor: palette.highlight
+ property color selectionTextColor: palette.highlightedText
+ property color selectionBackgroundColor: palette.highlight
+ property color selectionHoverColor: palette.highlight
+ property color selectionFocusColor: palette.highlight
+
+ property color tooltipTextColor: palette.base
+ property color tooltipBackgroundColor: palette.text
+ property color tooltipHoverColor: palette.highlight
+ property color tooltipFocusColor: palette.highlight
+
+ property color complementaryTextColor: palette.base
+ property color complementaryBackgroundColor: palette.text
+ property color complementaryHoverColor: palette.highlight
+ property color complementaryFocusColor: palette.highlight
+
property font defaultFont: fontMetrics.font
property list children: [
@@ -59,4 +80,6 @@
colorGroup: SystemPalette.Disabled
}
]
+
+ function __propagateColorSet(object, context) {}
}
diff --git a/tests/KeyboardListTest.qml b/tests/KeyboardListTest.qml
--- a/tests/KeyboardListTest.qml
+++ b/tests/KeyboardListTest.qml
@@ -20,7 +20,7 @@
import QtQuick 2.7
import QtQuick.Controls 2.0
-import org.kde.kirigami 2.0 as Kirigami
+import org.kde.kirigami 2.2 as Kirigami
Kirigami.ApplicationWindow
{
diff --git a/tests/KeyboardTest.qml b/tests/KeyboardTest.qml
--- a/tests/KeyboardTest.qml
+++ b/tests/KeyboardTest.qml
@@ -19,7 +19,7 @@
import QtQuick 2.7
import QtQuick.Controls 2.0
-import org.kde.kirigami 2.0 as Kirigami
+import org.kde.kirigami 2.2 as Kirigami
Kirigami.ApplicationWindow
{