Git commit 9dc5a6b8802d3728aaed6ff70a5a9de565cd9044 by Camilo higuita. Committed on 28/09/2018 at 19:40. Pushed by camiloh into branch 'master'. new piebutton implementation M +13 -4 src/controls/Dialog.qml M +72 -99 src/controls/PieButton.qml M +19 -19 src/controls/Popup.qml M +6 -8 src/controls/ToolBar.qml M +9 -3 src/controls/ToolButton.qml M +19 -0 src/kde/mauikde.cpp https://commits.kde.org/mauikit/9dc5a6b8802d3728aaed6ff70a5a9de565cd9044 diff --git a/src/controls/Dialog.qml b/src/controls/Dialog.qml index 00a2841..f7d13d2 100644 --- a/src/controls/Dialog.qml +++ b/src/controls/Dialog.qml @@ -22,19 +22,28 @@ import QtQuick.Controls 2.2 import QtQuick.Layouts 1.3 import org.kde.mauikit 1.0 as Maui import org.kde.kirigami 2.2 as Kirigami +import "private" = Maui.Popup { id: control - = + /* Controlc color scheming */ + ColorScheme {id: colorScheme} + property alias colorScheme : colorScheme + /***************************/ property string message : "" property string title: "" + = property string acceptText: "Ok" property string rejectText: "No" + = property bool defaultButtons: true + = property bool entryField: false + = + default property alias content : page.content + property alias textEntry : __textEntry - default property alias content : page.content property alias footBar : page.footBar property alias headBar: page.headBar property alias headBarTitle: page.headBarTitle @@ -76,7 +85,7 @@ Maui.Popup { width: parent.width height: parent.visible ? parent.height : 0 - color: textColor + color: colorScheme.textColor text: title font.weight: Font.Thin font.bold: true @@ -106,7 +115,7 @@ Maui.Popup enabled: false text: message textFormat : TextEdit.AutoText - color: textColor + color: colorScheme.textColor font.pointSize: fontSizes.default wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere = diff --git a/src/controls/PieButton.qml b/src/controls/PieButton.qml index f69f81e..c24a3e3 100644 --- a/src/controls/PieButton.qml +++ b/src/controls/PieButton.qml @@ -6,103 +6,76 @@ import "private" = Maui.ToolButton { - id: control - z: 1 - property alias delegate : pathView.delegate - property alias model : pathView.model - property alias count: pathView.count - property alias path : pathView - - property int delegateSize : iconSize - property int pieHeight: Kirigami.Units.gridUnit * 10 - property int pieWidth: pieHeight - - iconColor: pathView.visible ? highlightColor : textColor - onClicked: pathView.visible ? close() : open() - - signal itemClicked (var item) - layer.enabled: true - - Popup - { - id: popup - - PathView - { - id: pathView - z: control.z + 1 - visible: true - anchors.horizontalCenter: parent.horizontalCenter - anchors.bottom: parent.top - height: pieHeight - width: pieWidth - pathItemCount: 3 - preferredHighlightBegin: 0.5 - preferredHighlightEnd: 0.5 - focus: true - Keys.onLeftPressed: decrementCurrentIndex() - Keys.onRightPressed: incrementCurrentIndex() - // offset: 1.5 - snapMode: PathView.SnapOneItem - - onActiveFocusChanged: if(!activeFocus || !focus) pathView.visible = =3D false - - model: ListModel {} - delegate: PieButtonDelegate - { - id: btnDelegate - height: delegateSize + space.big - width: height - size: delegateSize - - Connections - { - target:btnDelegate - onClicked: - { - pathView.currentIndex =3D index - itemClicked(pathView.model.get(index)) - close() - } - } - } - - path: Path - { - startX: 0; startY: pathView.height - - PathArc - { - x: pathView.width - y: pathView.height - radiusX: pathView.width *.5; radiusY: radiusX - useLargeArc: false - } - } - - // Rectangle - // { - // id: overlayBg - // parent: ApplicationWindow.overlay - // color: altColor - // opacity: 0.5 - // y: headBar.height - // height: parent.height - headBar.height - footBar.hei= ght - // width: parent.width - // visible:pathView.visible - // z: pathView.z - 1 - // } - } - } - - - function open() - { - popup.open() - } - - function close() - { - popup.close() - } + 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 ? maxWi= dth : (content.middleLayout.implicitWidth > ApplicationWindow.overlay.width= ? ApplicationWindow.overlay.width : content.middleLayout.implicitWidth + = space.big) = + = + 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.implicitWid= th } +// } +// exit: Transition = +// { +// NumberAnimation { property: "width"; from: popup.implicitWidth; to: 0= .0 } +// } + = + Maui.ToolBar + { + id: content + anchors.fill: parent + spacing: space.enormous + colorScheme.backgroundColor: "transparent" + } + } + = + = + = + function open() + { = + popup.open() = + } + = + function close() + { + popup.close() + } } diff --git a/src/controls/Popup.qml b/src/controls/Popup.qml index bce4ff0..80bdeb6 100644 --- a/src/controls/Popup.qml +++ b/src/controls/Popup.qml @@ -23,10 +23,21 @@ import QtQuick.Controls 2.2 import QtQuick.Controls.Material 2.1 import org.kde.kirigami 2.2 as Kirigami import QtGraphicalEffects 1.0 +import "private" = Popup { id: control + = + /* Controlc color scheming */ + ColorScheme + { + id: colorScheme + backgroundColor: viewBackgroundColor + } + property alias colorScheme : colorScheme + /***************************/ + = property int maxWidth : parent.width property int maxHeight : parent.height property double hint : 0.9 @@ -69,25 +80,14 @@ else rightMargin: control.margins leftMargin: control.margins topMargin: control.margins - bottomMargin: control.margins - = + bottomMargin: control.margins = = background: Rectangle { radius: unit * 2 - color: viewBackgroundColor - border.color: Qt.rgba(textColor.r, textColor.g, textColor.b, 0.3) - layer.enabled: true - = - layer.effect: DropShadow = - { - transparentBorder: true - radius: 8 - samples: 16 - horizontalOffset: 0 - verticalOffset: unit * 4 - color: Qt.rgba(0, 0, 0, 0.3) - } + color: colorScheme.backgroundColor + border.color: colorScheme.borderColor + layer.enabled: true = } = enter: Transition @@ -100,8 +100,8 @@ else NumberAnimation { property: "opacity"; from: 1.0; to: 0.0; duratio= n: 150 } } = - Material.accent: accentColor - Material.background: backgroundColor - Material.primary: backgroundColor - Material.foreground: textColor + Material.accent: colorScheme.accentColor + Material.background: colorScheme.backgroundColor + Material.primary: colorScheme.backgroundColor + Material.foreground: colorScheme.textColor } diff --git a/src/controls/ToolBar.qml b/src/controls/ToolBar.qml index a87d0e6..50e9875 100644 --- a/src/controls/ToolBar.qml +++ b/src/controls/ToolBar.qml @@ -48,6 +48,7 @@ ToolBar property alias layout : layout = property int margins: space.medium + spacing: space.medium property int count : leftContent.length + middleContent.length + right= Content.length = property bool dropShadow: false @@ -159,10 +160,8 @@ ToolBar = Flickable { - id: mainFlickable - = - property int itemSpacing: space.big - = + id: mainFlickable = + = flickableDirection: Flickable.HorizontalFlick anchors.fill: parent interactive: layout.implicitWidth > control.width @@ -180,7 +179,7 @@ ToolBar id: leftRowContent Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft Layout.leftMargin: leftContent.length > 0 ? margins : 0 - spacing: mainFlickable.itemSpacing + spacing: leftContent.length > 0 ? control.spacing : 0 Layout.minimumWidth: 0 clip: true } @@ -233,7 +232,6 @@ ToolBar { id: flickable = - property int itemSpacing: space.medium anchors.fill: parent flickableDirection: Flickable.HorizontalFlick = @@ -260,7 +258,7 @@ ToolBar { id: middleRowContent = - spacing: middleContent.length =3D=3D=3D 1 ? 0 = : flickable.itemSpacing + spacing: middleContent.length =3D=3D=3D 1 ? 0 = : control.spacing = = // Layout.maximumWidth: control= .width - leftRowContent.implicitWidth - rightRowContent.implicitWidth @@ -317,7 +315,7 @@ ToolBar { id: rightRowContent Layout.alignment: Qt.AlignRight - spacing: mainFlickable.itemSpacing + spacing: rightContent.length > 0 ? control.spacing : 0 Layout.rightMargin: rightContent.length > 0 ? margins : 0 Layout.minimumWidth: 0 clip: true diff --git a/src/controls/ToolButton.qml b/src/controls/ToolButton.qml index 691f47e..a55074b 100644 --- a/src/controls/ToolButton.qml +++ b/src/controls/ToolButton.qml @@ -28,7 +28,12 @@ ToolButton id: control = /* Controlc color scheming */ - ColorScheme {id: colorScheme} + ColorScheme = + { + id: colorScheme + backgroundColor: "transparent" + borderColor: "transparent" + } property alias colorScheme : colorScheme /***************************/ = @@ -61,9 +66,10 @@ ToolButton background: Rectangle { color: /*(down || pressed || checked) */ checked && enabled ? = - Qt.lighter(colorScheme.highlightColor, 1.2) : "transparent" + Qt.lighter(colorScheme.highlightColor, 1.2) : colorScheme.backgroundC= olor radius: unit * 3 - opacity: 0.5 + opacity: (down || pressed || checked) && enabled ? 0.5 : 1 + border.color: colorScheme.borderColor } = contentItem: IconLabel diff --git a/src/kde/mauikde.cpp b/src/kde/mauikde.cpp index 3685cea..10d74cf 100644 --- a/src/kde/mauikde.cpp +++ b/src/kde/mauikde.cpp @@ -191,6 +191,25 @@ void MAUIKDE::setColorScheme(const QString &schemeName= , const QString &bg, const group.writeEntry("activeForeground", QVariant::fromVa= lue(rgb)); group.writeEntry("inactiveForeground", QVariant::fromV= alue(rgb)); = } + = + file.group("Colors:Window"); + if(!bg.isEmpty()) + { = + color.setNamedColor(bg); + QVariantList rgb =3D {color.red(), color.green(), color.blue()}; = + group.writeEntry("BackgroundNormal", QVariant::fromValue(rgb)); + group.writeEntry("BackgroundAlternate", QVariant::fromValue(rgb)); + = + } = + = + if(!fg.isEmpty()) + { = + color.setNamedColor(fg); + QVariantList rgb =3D {color.red(), color.green(), color.blue()}; + group.writeEntry("ForegroundActive", QVariant::fromValue(rgb)); + group.writeEntry("ForegroundInactive", QVariant::fromValue(rgb)); = = + } + = = } manager.activateScheme(schemeModel); =