diff --git a/src/controls/AboutDialog.qml b/src/controls/AboutDialog.qml index ceed5c1..b7e333d 100644 --- a/src/controls/AboutDialog.qml +++ b/src/controls/AboutDialog.qml @@ -1,174 +1,195 @@ /* * 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.0 import QtQuick.Controls 2.2 import QtQuick.Layouts 1.3 +import QtGraphicalEffects 1.13 + import org.kde.kirigami 2.7 as Kirigami import org.kde.mauikit 1.0 as Maui Maui.Dialog { id: control defaultButtons: false widthHint: 0.9 heightHint: 0.8 maxWidth: Maui.Style.unit * 400 maxHeight: Maui.Style.unit * 250 page.padding: Maui.Style.space.small footBar.middleContent: ToolButton { icon.name: "link" onClicked: Qt.openUrlExternally(Maui.App.webPage) } footBar.rightContent: ToolButton { icon.name: "love" onClicked: Qt.openUrlExternally(Maui.App.donationPage) } footBar.leftContent: ToolButton { icon.name: "documentinfo" onClicked: Qt.openUrlExternally(Maui.App.reportPage) } RowLayout { id: layout anchors.centerIn: parent width: parent.width height: parent.height * 0.7 spacing: Maui.Style.space.big +// Behavior on width +// { +// NumberAnimation +// { +// duration: Kirigami.Units.longDuration +// easing.type: Easing.InOutQuad +// } +// } + Item { - visible: parent.width > control.maxWidth * 0.7 + visible: parent.width > control.maxWidth * 0.7 Layout.fillHeight: true Layout.margins: Maui.Style.space.small Layout.alignment: Qt.AlignVCenter - Layout.preferredWidth: Maui.Style.iconSizes.huge + Layout.preferredWidth: visible ? Maui.Style.iconSizes.huge : 0 Image { + id: _imgIcon anchors.centerIn: parent source: Maui.App.iconName width: Math.max(Maui.Style.iconSizes.huge, parent.width) height: width sourceSize.width: width - sourceSize.height: height - - asynchronous: true - - fillMode: Image.PreserveAspectFit + sourceSize.height: height + asynchronous: true + fillMode: Image.PreserveAspectFit + } + + DropShadow + { + anchors.fill: _imgIcon + horizontalOffset: 0 + verticalOffset: 0 + radius: 8.0 + samples: 17 + color: "#80000000" + source: _imgIcon } } Kirigami.ScrollablePage { id: _descriptionItem Layout.fillWidth: true Layout.fillHeight: true Layout.alignment: Qt.AlignLeft | Qt.AlignTop Kirigami.Theme.backgroundColor: "transparent" padding: 0 leftPadding: padding rightPadding: padding topPadding: padding bottomPadding: padding ColumnLayout { id: _columnInfo spacing: Maui.Style.space.medium Label { Layout.fillWidth: true Layout.alignment: Qt.AlignLeft color: Kirigami.Theme.textColor text: Maui.App.name font.weight: Font.Bold font.bold: true font.pointSize: Maui.Style.fontSizes.huge elide: Text.ElideRight wrapMode: Text.NoWrap } Label { Layout.fillWidth: true Layout.alignment: Qt.AlignLeft color: Qt.lighter(Kirigami.Theme.textColor, 1.2) text: Maui.App.version font.weight: Font.Light font.pointSize: Maui.Style.fontSizes.default elide: Text.ElideRight wrapMode: Text.WrapAtWordBoundaryOrAnywhere } Label { id: body Layout.fillWidth: true text: Maui.App.description color: Kirigami.Theme.textColor font.pointSize: Maui.Style.fontSizes.default elide: Text.ElideRight wrapMode: Text.WrapAtWordBoundaryOrAnywhere } Label { color: Kirigami.Theme.textColor Layout.fillWidth: true text: qsTr("By ") + Maui.App.org font.pointSize: Maui.Style.fontSizes.default elide: Text.ElideRight wrapMode: Text.WrapAtWordBoundaryOrAnywhere } Kirigami.Separator { Layout.fillWidth: true Layout.margins: Maui.Style.space.tiny opacity: 0.4 } Label { color: Kirigami.Theme.textColor Layout.fillWidth: true text: qsTr("Powered by") + " MauiKit " + Maui.App.mauikitVersion + " and Kirigami." font.pointSize: Maui.Style.fontSizes.default elide: Text.ElideRight wrapMode: Text.WrapAtWordBoundaryOrAnywhere } } } } } diff --git a/src/controls/ToolActions.qml b/src/controls/ToolActions.qml index c515f51..ddde336 100644 --- a/src/controls/ToolActions.qml +++ b/src/controls/ToolActions.qml @@ -1,174 +1,169 @@ import QtQuick 2.9 import QtQuick.Controls 2.3 import QtQuick.Layouts 1.3 import QtQml.Models 2.3 import QtQml 2.1 import org.kde.kirigami 2.7 as Kirigami import org.kde.mauikit 1.0 as Maui -MouseArea +Item { id: control implicitWidth: _layout.implicitWidth + Maui.Style.space.medium implicitHeight: parent.height default property list actions property bool autoExclusive: true property int direction : Qt.Vertical property Action currentAction : actions[0] property bool expanded : false // Rectangle // { // anchors.fill: parent // color: control.expanded ? "#333" : "transparent" // opacity: 0.1 // radius: Math.min(Maui.Style.radiusV, height) // // Behavior on color // { // ColorAnimation // { // duration: Kirigami.Units.longDuration // } // } // } - onClicked: - { - control.expanded = !control.expanded - } - Row { id: _layout height: parent.height spacing: Maui.Style.space.small anchors.centerIn: parent ToolButton { icon.name: control.currentAction.icon.name onClicked: control.expanded = !control.expanded text: " " indicator: Kirigami.Icon { anchors { right: parent.right verticalCenter: parent.verticalCenter } color: control.Kirigami.Theme.textColor source: "qrc://assets/arrow-down.svg" width: Maui.Style.iconSizes.small height: width isMask: true } } Loader { id: _loader height: parent.height sourceComponent: control.direction === Qt.Horizontal ? _rowComponent : (control.direction === Qt.Vertical ? _menuComponent : "") } } Component { id: _rowComponent Row { id: _row width: control.expanded ? implicitWidth : 0 spacing: Maui.Style.space.medium clip: true height: parent.height Behavior on width { NumberAnimation { duration: Kirigami.Units.longDuration easing.type: Easing.InOutQuad } } Kirigami.Separator { width: 1 height: parent.height * 0.7 anchors.verticalCenter: parent.verticalCenter } Repeater { model: control.actions ToolButton { action: modelData autoExclusive: control.autoExclusive anchors.verticalCenter: parent.verticalCenter onClicked: { control.currentAction = action control.expanded = false } } } } } Component { id: _menuComponent Menu { id: _actionsMenu Connections { target: control onExpandedChanged: { if(control.expanded) _actionsMenu.popup(0, parent.height) else _actionsMenu.close() } } onClosed: control.expanded = false closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent Repeater { model: control.actions MenuItem { action: modelData autoExclusive: control.autoExclusive Connections { target: modelData onTriggered: control.currentAction = action } } } } } }