diff --git a/src/controls/PieButton.qml b/src/controls/PieButton.qml index c24a3e3..ce0aeae 100644 --- a/src/controls/PieButton.qml +++ b/src/controls/PieButton.qml @@ -1,81 +1,83 @@ import QtQuick 2.6 import QtQuick.Controls 2.2 import org.kde.mauikit 1.0 as Maui import org.kde.kirigami 2.0 as Kirigami import "private" Maui.ToolButton { id: control z: 1 /* Controlc color scheming */ ColorScheme { id: colorScheme } property alias colorScheme : colorScheme /***************************/ property int alignment : Qt.AlignLeft property int position : Qt.Horizontal property int barHeight : 0 property int maxWidth : ApplicationWindow.overlay.width * 0.5 property alias content : content.middleContent onClicked: popup.visible ? close(): open() layer.enabled: true clip: true Popup { id: popup height: barHeight width: content.middleLayout.implicitWidth + space.big > maxWidth ? maxWidth : (content.middleLayout.implicitWidth > ApplicationWindow.overlay.width ? ApplicationWindow.overlay.width : content.middleLayout.implicitWidth + space.big) - + padding: 0 + margins: 0 x: (control.x - width) - space.big y: parent.height / 2 - height / 2 background: Rectangle { radius: radiusV color: colorScheme.backgroundColor border.color: colorScheme.borderColor } onFocusChanged: !activeFocus || !focus ? close() : undefined // enter: Transition // { // NumberAnimation { property: "width"; from: 0.0; to: popup.implicitWidth } // } // exit: Transition // { // NumberAnimation { property: "width"; from: popup.implicitWidth; to: 0.0 } // } Maui.ToolBar { id: content anchors.fill: parent + implicitHeight: parent.height spacing: space.enormous colorScheme.backgroundColor: "transparent" } } function open() { popup.open() } function close() { popup.close() } } diff --git a/src/controls/ToolBar.qml b/src/controls/ToolBar.qml index 50e9875..25e7e89 100644 --- a/src/controls/ToolBar.qml +++ b/src/controls/ToolBar.qml @@ -1,328 +1,328 @@ /* * Copyright 2018 Camilo Higuita * * 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 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 QtQuick.Controls 2.2 import org.kde.kirigami 2.0 as Kirigami import org.kde.mauikit 1.0 as Maui import QtQuick.Layouts 1.3 import QtGraphicalEffects 1.0 import "private" ToolBar { id: control /* Controlc color scheming */ ColorScheme {id: colorScheme} property alias colorScheme : colorScheme /***************************/ clip: true implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding) implicitHeight: floatingFootBar ? toolBarHeightAlt : toolBarHeight width: floatingFootBar ? implicitWidth : parent.width height: implicitHeight property alias leftContent : leftRowContent.data property alias middleContent : middleRowContent.data property alias rightContent : rightRowContent.data property alias middleLayout : flickableLayout property alias layout : layout property int margins: space.medium - spacing: space.medium + spacing: space.big property int count : leftContent.length + middleContent.length + rightContent.length property bool dropShadow: false property bool drawBorder: false property bool floatingFootBar: false padding: 0 // leftPadding: Kirigami.Units.smallSpacing*2 // rightPadding: Kirigami.Units.smallSpacing*2 background: Rectangle { id: headBarBG color: colorScheme.backgroundColor implicitHeight: toolBarHeightAlt radius: floatingFootBar ? radiusV : 0 border.color: floatingFootBar ? colorScheme.borderColor : "transparent" Kirigami.Separator { visible: drawBorder color: colorScheme.borderColor anchors { left: parent.left right: parent.right bottom: control.position == ToolBar.Footer ? undefined : parent.bottom top: control.position == ToolBar.Footer ? parent.top : undefined } } layer.enabled: dropShadow layer.effect: DropShadow { anchors.fill: headBarBG horizontalOffset: 0 verticalOffset: unit * (altToolBars ? -1 : 1) radius: 8 samples: 25 color: Qt.darker(colorScheme.backgroundColor, 1.4) source: headBarBG } } Rectangle { width: parent.height height: iconSizes.tiny visible: !mainFlickable.atXEnd && mainFlickable.interactive rotation: 270 opacity: 0.2 anchors { top: parent.top bottom: parent.bottom right: parent.right } z: 999 gradient: Gradient { GradientStop { position: 0.0 color: "transparent" } GradientStop { position: 1.0 color: colorScheme.textColor } } } Rectangle { width: parent.height height: iconSizes.tiny visible: !mainFlickable.atXBeginning && mainFlickable.interactive rotation: 270 opacity: 0.2 anchors { top: parent.top bottom: parent.bottom left: parent.left } z: 999 gradient: Gradient { GradientStop { position: 0.0 color: colorScheme.textColor } GradientStop { position: 1.0 color: "transparent" } } } Flickable { id: mainFlickable flickableDirection: Flickable.HorizontalFlick anchors.fill: parent interactive: layout.implicitWidth > control.width contentWidth: layout.implicitWidth boundsBehavior: isMobile ? Flickable.DragOverBounds : Flickable.StopAtBounds RowLayout { id: layout width: control.width height: control.height Row { id: leftRowContent Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft Layout.leftMargin: leftContent.length > 0 ? margins : 0 spacing: leftContent.length > 0 ? control.spacing : 0 Layout.minimumWidth: 0 clip: true } Kirigami.Separator { Layout.fillHeight: true Layout.margins: space.medium Layout.topMargin: space.big Layout.bottomMargin: space.big width: unit opacity: 0.2 visible: leftContent.length > 0 && flickable.interactive color: colorScheme.textColor gradient: Gradient { GradientStop { position: 0.0 color: "transparent" } GradientStop { position: 0.5 color: colorScheme.textColor } GradientStop { position: 1.0 color: "transparent" } } } Item { id: flickableItem Layout.fillHeight: true Layout.fillWidth: true // Layout.minimumWidth: control.width * 0.3 Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter Layout.rightMargin: middleContent.length === 1 ? 0 : margins Layout.leftMargin: middleContent.length === 1 ? 0 : margins clip: true Flickable { id: flickable anchors.fill: parent flickableDirection: Flickable.HorizontalFlick interactive: middleRowContent.implicitWidth > width contentWidth: middleRowContent.implicitWidth boundsBehavior: isMobile ? Flickable.DragOverBounds : Flickable.StopAtBounds RowLayout { id: flickableLayout width: flickableItem.width height: flickableItem.height Item { Layout.fillWidth: true Layout.minimumHeight: 0 Layout.minimumWidth: 0 } Row { id: middleRowContent spacing: middleContent.length === 1 ? 0 : control.spacing // Layout.maximumWidth: control.width - leftRowContent.implicitWidth - rightRowContent.implicitWidth } Item { Layout.fillWidth: true Layout.minimumHeight: 0 Layout.minimumWidth: 0 } } ScrollBar.horizontal: ScrollBar { visible: false} } } Kirigami.Separator { Layout.fillHeight: true Layout.margins: space.medium Layout.topMargin: space.big Layout.bottomMargin: space.big width: unit opacity: 0.2 visible: rightContent.length > 0 && flickable.interactive color: colorScheme.textColor gradient: Gradient { GradientStop { position: 0.0 color: "transparent" } GradientStop { position: 0.5 color: colorScheme.textColor } GradientStop { position: 1.0 color: "transparent" } } } Row { id: rightRowContent Layout.alignment: Qt.AlignRight spacing: rightContent.length > 0 ? control.spacing : 0 Layout.rightMargin: rightContent.length > 0 ? margins : 0 Layout.minimumWidth: 0 clip: true } } ScrollBar.horizontal: ScrollBar { visible: false} } } diff --git a/src/controls/ToolButton.qml b/src/controls/ToolButton.qml index a55074b..44cbeb0 100644 --- a/src/controls/ToolButton.qml +++ b/src/controls/ToolButton.qml @@ -1,104 +1,109 @@ /* * Copyright 2018 Camilo Higuita * * 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 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 QtQuick.Controls 2.2 import QtQuick.Controls.impl 2.3 import org.kde.kirigami 2.0 as Kirigami import "private" ToolButton { id: control /* Controlc color scheming */ ColorScheme { id: colorScheme backgroundColor: "transparent" borderColor: "transparent" } property alias colorScheme : colorScheme /***************************/ property bool isMask: true property string iconName: "" property int size: iconSize property color iconColor: colorScheme.textColor property bool anim: false property string tooltipText : "" hoverEnabled: !isMobile + implicitWidth: Math.max(background ? background.implicitWidth : 0, + contentItem.implicitWidth + leftPadding + rightPadding) + implicitHeight: Math.max(background ? background.implicitHeight : 0, + contentItem.implicitHeight + topPadding + bottomPadding) + height: control.display === ToolButton.IconOnly ? size + space.medium : implicitHeight width: control.display === ToolButton.IconOnly ? height : implicitWidth icon.name: iconName icon.width: size icon.height: size icon.color: !isMask ? "transparent" : iconColor onClicked: if(anim) animIcon.running = true flat: true highlighted: !isMask font.pointSize: control.display === ToolButton.TextUnderIcon ? fontSizes.small : undefined display: control.text.length > 0 ? (isWide ? ToolButton.TextBesideIcon : ToolButton.TextUnderIcon) : ToolButton.IconOnly spacing: space.tiny background: Rectangle { color: /*(down || pressed || checked) */ checked && enabled ? Qt.lighter(colorScheme.highlightColor, 1.2) : colorScheme.backgroundColor radius: unit * 3 opacity: (down || pressed || checked) && enabled ? 0.5 : 1 border.color: colorScheme.borderColor } contentItem: IconLabel { spacing: control.display === ToolButton.TextUnderIcon ? space.tiny : control.spacing mirrored: control.mirrored display: control.display icon: control.icon text: control.text font: control.font color: control.iconColor } SequentialAnimation { id: animIcon PropertyAnimation { target: control property: "icon.color" easing.type: Easing.InOutQuad from: colorScheme.highlightColor to: iconColor duration: 500 } } ToolTip.delay: 1000 ToolTip.timeout: 5000 ToolTip.visible: hovered && !isMobile && tooltipText.length > 0 ToolTip.text: tooltipText }