diff --git a/kirigami.qrc b/kirigami.qrc index 8548b3ee..3177f75d 100644 --- a/kirigami.qrc +++ b/kirigami.qrc @@ -1,89 +1,90 @@ src/controls/AbstractApplicationWindow.qml src/controls/ContextDrawer.qml src/controls/Action.qml src/controls/Page.qml src/controls/PageRow.qml src/controls/AbstractListItem.qml src/controls/Theme.qml src/controls/AbstractCard.qml src/controls/templates/AbstractCard.qml src/controls/Card.qml src/controls/CardsLayout.qml src/controls/CardsListView.qml src/controls/CardsGridView.qml src/controls/ActionToolBar.qml src/controls/templates/InlineMessage.qml src/controls/InlineMessage.qml src/controls/ToolBarApplicationHeader.qml src/controls/ActionTextField.qml src/controls/SearchField.qml src/controls/PasswordField.qml src/controls/private/GlobalDrawerActionItem.qml src/controls/private/ContextDrawerActionItem.qml src/controls/private/RefreshableScrollView.qml src/controls/private/SwipeItemEventFilter.qml src/controls/private/PageActionPropertyGroup.qml src/controls/private/ActionIconGroup.qml src/controls/private/CornerShadow.qml src/controls/private/ActionButton.qml src/controls/private/DefaultListItemBackground.qml + src/controls/private/DefaultCardBackground.qml src/controls/private/BannerImage.qml src/controls/private/EdgeShadow.qml src/controls/private/globaltoolbar/AbstractPageHeader.qml src/controls/private/globaltoolbar/PageRowGlobalToolBarStyleGroup.qml src/controls/private/globaltoolbar/PageRowGlobalToolBarUI.qml src/controls/private/PrivateActionToolButton.qml src/controls/private/globaltoolbar/TitlesPageHeader.qml src/controls/private/globaltoolbar/ToolBarPageHeader.qml src/controls/private/globaltoolbar/BreadcrumbControl.qml src/controls/private/globaltoolbar/TabBarControl.qml src/controls/private/ActionsMenu.qml src/controls/private/ActionMenuItem.qml src/controls/Separator.qml src/controls/OverlayDrawer.qml src/controls/OverlaySheet.qml src/controls/GlobalDrawer.qml src/controls/templates/AbstractListItem.qml src/controls/templates/private/MenuIcon.qml src/controls/templates/private/GenericDrawerIcon.qml src/controls/templates/private/PassiveNotification.qml src/controls/templates/private/ContextIcon.qml src/controls/templates/private/ScrollView.qml src/controls/templates/private/BackButton.qml src/controls/templates/private/IconPropertiesGroup.qml src/controls/templates/private/ForwardButton.qml src/controls/templates/OverlayDrawer.qml src/controls/templates/OverlaySheet.qml src/controls/templates/SwipeListItem.qml src/controls/templates/ApplicationHeader.qml src/controls/templates/AbstractApplicationHeader.qml src/controls/Units.qml src/controls/SwipeListItem.qml src/controls/ApplicationWindow.qml src/controls/AbstractApplicationItem.qml src/controls/ApplicationItem.qml src/controls/ApplicationHeader.qml src/controls/Heading.qml src/controls/ScrollablePage.qml src/controls/AboutPage.qml src/controls/UrlButton.qml src/controls/LinkButton.qml src/controls/Label.qml src/controls/BasicListItem.qml src/controls/AbstractApplicationHeader.qml src/controls/FormLayout.qml src/controls/ListItemDragHandle.qml src/styles/Material/AbstractListItem.qml src/styles/Material/Theme.qml src/styles/Material/SwipeListItem.qml src/styles/Material/Label.qml src/styles/org.kde.desktop/AbstractListItem.qml src/styles/org.kde.desktop/Theme.qml src/styles/org.kde.desktop/Units.qml src/styles/org.kde.desktop/SwipeListItem.qml src/styles/org.kde.desktop/ApplicationWindow.qml src/styles/org.kde.desktop/AbstractApplicationHeader.qml diff --git a/kirigami.qrc.in b/kirigami.qrc.in index 3c123af3..65daaadd 100644 --- a/kirigami.qrc.in +++ b/kirigami.qrc.in @@ -1,91 +1,92 @@ @kirigami_QML_DIR@/src/controls/AbstractApplicationWindow.qml @kirigami_QML_DIR@/src/controls/ContextDrawer.qml @kirigami_QML_DIR@/src/controls/Action.qml @kirigami_QML_DIR@/src/controls/Page.qml @kirigami_QML_DIR@/src/controls/PageRow.qml @kirigami_QML_DIR@/src/controls/AbstractListItem.qml @kirigami_QML_DIR@/src/controls/Theme.qml @kirigami_QML_DIR@/src/controls/AbstractCard.qml @kirigami_QML_DIR@/src/controls/templates/AbstractCard.qml @kirigami_QML_DIR@/src/controls/Card.qml @kirigami_QML_DIR@/src/controls/CardsLayout.qml @kirigami_QML_DIR@/src/controls/CardsListView.qml @kirigami_QML_DIR@/src/controls/CardsGridView.qml @kirigami_QML_DIR@/src/controls/ActionToolBar.qml @kirigami_QML_DIR@/src/controls/templates/InlineMessage.qml @kirigami_QML_DIR@/src/controls/InlineMessage.qml @kirigami_QML_DIR@/src/controls/ToolBarApplicationHeader.qml @kirigami_QML_DIR@/src/controls/ActionTextField.qml @kirigami_QML_DIR@/src/controls/SearchField.qml @kirigami_QML_DIR@/src/controls/PasswordField.qml @kirigami_QML_DIR@/src/controls/private/PrivateActionToolButton.qml @kirigami_QML_DIR@/src/controls/private/GlobalDrawerActionItem.qml @kirigami_QML_DIR@/src/controls/private/ContextDrawerActionItem.qml @kirigami_QML_DIR@/src/controls/private/RefreshableScrollView.qml @kirigami_QML_DIR@/src/controls/private/SwipeItemEventFilter.qml @kirigami_QML_DIR@/src/controls/private/PageActionPropertyGroup.qml @kirigami_QML_DIR@/src/controls/private/ActionIconGroup.qml @kirigami_QML_DIR@/src/controls/private/CornerShadow.qml @kirigami_QML_DIR@/src/controls/private/ActionButton.qml @kirigami_QML_DIR@/src/controls/private/DefaultListItemBackground.qml + @kirigami_QML_DIR@/src/controls/private/DefaultCardBackground.qml @kirigami_QML_DIR@/src/controls/private/BannerImage.qml @kirigami_QML_DIR@/src/controls/private/EdgeShadow.qml @kirigami_QML_DIR@/src/controls/private/globaltoolbar/AbstractPageHeader.qml @kirigami_QML_DIR@/src/controls/private/globaltoolbar/BreadcrumbControl.qml @kirigami_QML_DIR@/src/controls/private/globaltoolbar/PageRowGlobalToolBarStyleGroup.qml @kirigami_QML_DIR@/src/controls/private/globaltoolbar/PageRowGlobalToolBarUI.qml @kirigami_QML_DIR@/src/controls/private/PrivateActionToolButton.qml @kirigami_QML_DIR@/src/controls/private/globaltoolbar/TabBarControl.qml @kirigami_QML_DIR@/src/controls/private/globaltoolbar/TitlesPageHeader.qml @kirigami_QML_DIR@/src/controls/private/globaltoolbar/ToolBarPageHeader.qml @kirigami_QML_DIR@/src/controls/private/ActionsMenu.qml @kirigami_QML_DIR@/src/controls/private/ActionMenuItem.qml @kirigami_QML_DIR@/src/controls/Separator.qml @kirigami_QML_DIR@/src/controls/OverlayDrawer.qml @kirigami_QML_DIR@/src/controls/OverlaySheet.qml @kirigami_QML_DIR@/src/controls/GlobalDrawer.qml @kirigami_QML_DIR@/src/controls/templates/AbstractListItem.qml @kirigami_QML_DIR@/src/controls/templates/private/MenuIcon.qml @kirigami_QML_DIR@/src/controls/templates/private/GenericDrawerIcon.qml @kirigami_QML_DIR@/src/controls/templates/private/PassiveNotification.qml @kirigami_QML_DIR@/src/controls/templates/private/ContextIcon.qml @kirigami_QML_DIR@/src/controls/templates/private/ScrollView.qml @kirigami_QML_DIR@/src/controls/templates/private/BackButton.qml @kirigami_QML_DIR@/src/controls/templates/private/IconPropertiesGroup.qml @kirigami_QML_DIR@/src/controls/templates/private/ForwardButton.qml @kirigami_QML_DIR@/src/controls/templates/OverlayDrawer.qml @kirigami_QML_DIR@/src/controls/templates/OverlaySheet.qml @kirigami_QML_DIR@/src/controls/templates/SwipeListItem.qml @kirigami_QML_DIR@/src/controls/templates/ApplicationHeader.qml @kirigami_QML_DIR@/src/controls/templates/AbstractApplicationHeader.qml @kirigami_QML_DIR@/src/controls/Units.qml @kirigami_QML_DIR@/src/controls/SwipeListItem.qml @kirigami_QML_DIR@/src/controls/ApplicationWindow.qml @kirigami_QML_DIR@/src/controls/AbstractApplicationItem.qml @kirigami_QML_DIR@/src/controls/ApplicationItem.qml @kirigami_QML_DIR@/src/controls/ApplicationHeader.qml @kirigami_QML_DIR@/src/controls/Heading.qml @kirigami_QML_DIR@/src/controls/ScrollablePage.qml @kirigami_QML_DIR@/src/controls/AboutPage.qml @kirigami_QML_DIR@/src/controls/UrlButton.qml @kirigami_QML_DIR@/src/controls/LinkButton.qml @kirigami_QML_DIR@/src/controls/Label.qml @kirigami_QML_DIR@/src/controls/BasicListItem.qml @kirigami_QML_DIR@/src/controls/ListSectionHeader.qml @kirigami_QML_DIR@/src/controls/AbstractApplicationHeader.qml @kirigami_QML_DIR@/src/controls/FormLayout.qml @kirigami_QML_DIR@/src/controls/ListItemDragHandle.qml @kirigami_QML_DIR@/src/styles/Material/AbstractListItem.qml @kirigami_QML_DIR@/src/styles/Material/Theme.qml @kirigami_QML_DIR@/src/styles/Material/SwipeListItem.qml @kirigami_QML_DIR@/src/styles/Material/Label.qml @kirigami_QML_DIR@/src/styles/org.kde.desktop/AbstractListItem.qml @kirigami_QML_DIR@/src/styles/org.kde.desktop/Theme.qml @kirigami_QML_DIR@/src/styles/org.kde.desktop/Units.qml @kirigami_QML_DIR@/src/styles/org.kde.desktop/SwipeListItem.qml @kirigami_QML_DIR@/src/styles/org.kde.desktop/ApplicationWindow.qml @kirigami_QML_DIR@/src/styles/org.kde.desktop/AbstractApplicationHeader.qml diff --git a/src/controls/AbstractCard.qml b/src/controls/AbstractCard.qml index 5ffbeb41..d9d331d7 100644 --- a/src/controls/AbstractCard.qml +++ b/src/controls/AbstractCard.qml @@ -1,69 +1,61 @@ /* * Copyright 2018 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.6 import QtGraphicalEffects 1.0 import org.kde.kirigami 2.4 as Kirigami import "templates" as T +import "private" /** * A AbstractCard is the base for cards. A Card is a visual object that serves * as an entry point for more detailed information. An abstractCard is empty, * providing just the look and the base properties and signals for an ItemDelegate. * It can be filled with any custom layout of items, its content is organized * in 3 properties: header, contentItem and footer. * Use this only when you need particular custom contents, for a standard layout * for cards, use the Card component. * * @see Card * @inherits T.AbstractCard * @since 2.4 */ T.AbstractCard { id: root - background: Rectangle { - color: Kirigami.Theme.backgroundColor + background: DefaultCardBackground { Rectangle { anchors.fill: parent color: Kirigami.Theme.highlightColor opacity: { if (root.showClickFeedback || highlighted) { return (root.highlighted || root.down) ? 0.3 : (root.hovered ? 0.1 : 0); } else { return 0; } } Behavior on opacity { OpacityAnimator { duration: Kirigami.Units.longDuration easing.type: Easing.InOutQuad } } } - layer.enabled: true - layer.effect: DropShadow { - horizontalOffset: 0 - verticalOffset: 1 - radius: 12 - samples: 32 - color: Qt.rgba(0, 0, 0, 0.5) - } } } diff --git a/src/controls/OverlaySheet.qml b/src/controls/OverlaySheet.qml index ff0869ea..1b3a660b 100644 --- a/src/controls/OverlaySheet.qml +++ b/src/controls/OverlaySheet.qml @@ -1,106 +1,39 @@ /* * Copyright (C) 2016 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 2.010-1301, USA. */ import QtQuick 2.5 import org.kde.kirigami 2.4 import "private" import "templates" as T /** * An overlay sheet that covers the current Page content. * Its contents can be scrolled up or down, scrolling all the way up or * all the way down, dismisses it. * Use this for big, modal dialogs or information display, that can't be * logically done as a new separate Page, even if potentially * are taller than the screen space. */ T.OverlaySheet { id: root - background: Item { + background: DefaultCardBackground { anchors.fill: parent - //Why not a shadow or rectangularglow? - //on some android devices they break badly when the OverlaySheet is bigger than - //the screen - CornerShadow { - corner: Qt.BottomRightCorner - anchors { - right: parent.left - bottom: parent.top - } - } - CornerShadow { - corner: Qt.BottomLeftCorner - anchors { - left: parent.right - bottom: parent.top - } - } - CornerShadow { - corner: Qt.TopRightCorner - anchors { - right: parent.left - top: parent.bottom - } - } - CornerShadow { - corner: Qt.TopLeftCorner - anchors { - left: parent.right - top: parent.bottom - } - } - EdgeShadow { - edge: Qt.BottomEdge - anchors { - left: parent.left - right: parent.right - bottom: parent.top - } - } - EdgeShadow { - edge: Qt.TopEdge - anchors { - left: parent.left - right: parent.right - top: parent.bottom - } - } - EdgeShadow { - edge: Qt.LeftEdge - anchors { - top: parent.top - bottom: parent.bottom - left: parent.right - } - } - EdgeShadow { - edge: Qt.RightEdge - anchors { - top: parent.top - bottom: parent.bottom - right: parent.left - } - } - Rectangle { - anchors.fill: parent - color: Theme.backgroundColor - } } } diff --git a/src/controls/private/CornerShadow.qml b/src/controls/private/CornerShadow.qml index 80d0c0b2..ac9591ac 100644 --- a/src/controls/private/CornerShadow.qml +++ b/src/controls/private/CornerShadow.qml @@ -1,72 +1,86 @@ /* * 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 * (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.1 import QtGraphicalEffects 1.0 import org.kde.kirigami 2.4 RadialGradient { id: shadow /** * corner: enumeration * This property holds the corner of the shadow that will determine * the direction of the gradient. * The acceptable values are: * Qt.TopLeftCorner, TopRightCorner, BottomLeftCorner, BottomRightCorner */ property int corner: Qt.TopRightCorner - width: Units.gridUnit/2 - height: Units.gridUnit/2 + readonly property real margin: -Math.floor(radius/3) + property int radius: Units.gridUnit + + width: radius - margin + height: radius - margin + + horizontalRadius: width + verticalRadius: height horizontalOffset: { switch (corner) { case Qt.TopLeftCorner: case Qt.BottomLeftCorner: return -width/2; default: return width/2; } } verticalOffset: { switch (corner) { case Qt.TopLeftCorner: case Qt.TopRightCorner: return -width/2; default: return width/2; } } gradient: Gradient { GradientStop { position: 0.0 - color: Qt.rgba(0, 0, 0, 0.2) + color: Qt.rgba(0, 0, 0, 0.25) + } + GradientStop { + position: 1 - radius/(radius - margin) + color: Qt.rgba(0, 0, 0, 0.25) } GradientStop { - position: 0.3 + position: 1 - radius/(radius - margin) + radius/(radius - margin) * 0.2 color: Qt.rgba(0, 0, 0, 0.1) } + GradientStop { + position: 1 - radius/(radius - margin) + radius/(radius - margin) * 0.35 + color: Qt.rgba(0, 0, 0, 0.02) + } GradientStop { position: 1.0 color: "transparent" } } } diff --git a/src/controls/private/DefaultCardBackground.qml b/src/controls/private/DefaultCardBackground.qml new file mode 100644 index 00000000..71915ed5 --- /dev/null +++ b/src/controls/private/DefaultCardBackground.qml @@ -0,0 +1,105 @@ +/* + * Copyright 2019 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.6 +import org.kde.kirigami 2.11 as Kirigami + +Rectangle { + + CornerShadow { + id: topLeft + corner: Qt.BottomRightCorner + z: -1 + anchors { + right: parent.left + bottom: parent.top + margins: margin + bottomMargin: margin - 1 + } + } + CornerShadow { + id: topRight + corner: Qt.BottomLeftCorner + z: -1 + anchors { + left: parent.right + bottom: parent.top + margins: margin + bottomMargin: margin - 1 + } + } + CornerShadow { + id: bottomLeft + corner: Qt.TopRightCorner + z: -1 + anchors { + right: parent.left + top: parent.bottom + margins: margin + } + } + CornerShadow { + id: bottomRight + corner: Qt.TopLeftCorner + z: -1 + anchors { + left: parent.right + top: parent.bottom + margins: margin + } + } + EdgeShadow { + edge: Qt.BottomEdge + z: -1 + anchors { + left: bottomLeft.right + right: bottomRight.left + bottom: parent.top + bottomMargin: - 1 + } + } + EdgeShadow { + edge: Qt.TopEdge + z: -1 + anchors { + left: topLeft.right + right: topRight.left + top: parent.bottom + } + } + EdgeShadow { + edge: Qt.LeftEdge + z: -1 + anchors { + top: topRight.bottom + bottom: bottomRight.top + left: parent.right + } + } + EdgeShadow { + edge: Qt.RightEdge + z: -1 + anchors { + top: topLeft.bottom + bottom: bottomLeft.top + right: parent.left + } + } +} + diff --git a/src/controls/private/EdgeShadow.qml b/src/controls/private/EdgeShadow.qml index 43194278..5e36e3ae 100644 --- a/src/controls/private/EdgeShadow.qml +++ b/src/controls/private/EdgeShadow.qml @@ -1,58 +1,63 @@ /* * 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 * (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.1 import QtGraphicalEffects 1.0 import org.kde.kirigami 2.4 LinearGradient { id: shadow /** * edge: enumeration * This property holds the edge of the shadow that will determine * the direction of the gradient. * The acceptable values are: * Qt.TopEdge: The top edge of the content item. * Qt.LeftEdge: The left edge of the content item (default). * Qt.RightEdge: The right edge of the content item. * Qt.BottomEdge: The bottom edge of the content item. */ property int edge: Qt.LeftEdge - implicitWidth: Units.gridUnit/2 - implicitHeight: Units.gridUnit/2 + property int radius: Units.gridUnit + implicitWidth: radius + implicitHeight: radius start: Qt.point((edge !== Qt.RightEdge ? 0 : width), (edge !== Qt.BottomEdge ? 0 : height)) end: Qt.point((edge !== Qt.LeftEdge ? 0 : width), (edge !== Qt.TopEdge ? 0 : height)) gradient: Gradient { GradientStop { position: 0.0 - color: Qt.rgba(0, 0, 0, 0.2) + color: Qt.rgba(0, 0, 0, 0.25) } GradientStop { - position: 0.3 + position: 0.20 color: Qt.rgba(0, 0, 0, 0.1) } + GradientStop { + position: 0.35 + color: Qt.rgba(0, 0, 0, 0.02) + } GradientStop { position: 1.0 color: "transparent" } } }