diff options
author | alex-z <blackslayer4@gmail.com> | 2022-01-04 17:28:26 +0300 |
---|---|---|
committer | alex-z <blackslayer4@gmail.com> | 2022-02-04 18:52:37 +0300 |
commit | ae44dd59787cd4614db1c11fe1376035345f36da (patch) | |
tree | f40cab03c5eca7410f7429bb5502ed09ab4255d7 /src/gui/tray/ActivityActionButton.qml | |
parent | 5ce8c9bf50f7a9e8753e0fddf471bbc8eb7d6ccc (diff) |
Adjust icons for activity entries in main dialog. Refactor the dialog by splitting it to separate components.
Signed-off-by: alex-z <blackslayer4@gmail.com>
Diffstat (limited to 'src/gui/tray/ActivityActionButton.qml')
-rw-r--r-- | src/gui/tray/ActivityActionButton.qml | 116 |
1 files changed, 36 insertions, 80 deletions
diff --git a/src/gui/tray/ActivityActionButton.qml b/src/gui/tray/ActivityActionButton.qml index 6cf3d3495..4c64e0bc8 100644 --- a/src/gui/tray/ActivityActionButton.qml +++ b/src/gui/tray/ActivityActionButton.qml @@ -1,109 +1,65 @@ -import QtQuick 2.5 +import QtQuick 2.15 import QtQuick.Controls 2.3 +import QtQuick.Layouts 1.15 import Style 1.0 Item { id: root - readonly property bool labelVisible: label.visible - readonly property bool iconVisible: icon.visible - // label value property string text: "" - - // font value - property var font: label.font + property string toolTipText: "" - // icon value - property string imageSource: "" - - // Tooltip value - property string tooltipText: text - - // text color - property color textColor: Style.ncTextColor - property color textColorHovered: Style.lightHover - - // text background color - property color textBgColor: "transparent" - property color textBgColorHovered: Style.lightHover + property bool bold: false - // icon background color - property color iconBgColor: "transparent" - property color iconBgColorHovered: Style.lightHover - - // text border color - property color textBorderColor: "transparent" + property string imageSource: "" + property string imageSourceHover: "" - property alias hovered: mouseArea.containsMouse + property color textColor: Style.unifiedSearchResulTitleColor + property color textColorHovered: Style.unifiedSearchResulSublineColor signal clicked() - Accessible.role: Accessible.Button - Accessible.name: text !== "" ? text : (tooltipText !== "" ? tooltipText : qsTr("Activity action button")) - Accessible.onPressAction: clicked() - - // background with border around the Text - Rectangle { - visible: parent.labelVisible + Loader { + active: root.imageSource === "" anchors.fill: parent - // padding - anchors.topMargin: 10 - anchors.bottomMargin: 10 - - border.color: parent.textBorderColor - border.width: 1 + sourceComponent: CustomTextButton { + anchors.fill: parent + text: root.text + toolTipText: root.toolTipText - color: parent.hovered ? parent.textBgColorHovered : parent.textBgColor + textColor: root.textColor + textColorHovered: root.textColorHovered - radius: 25 + onClicked: root.clicked() + } } - // background with border around the Image - Rectangle { - visible: parent.iconVisible + Loader { + active: root.imageSource !== "" anchors.fill: parent - color: parent.hovered ? parent.iconBgColorHovered : parent.iconBgColor - } + sourceComponent: CustomButton { + anchors.fill: parent + anchors.topMargin: Style.roundedButtonBackgroundVerticalMargins + anchors.bottomMargin: Style.roundedButtonBackgroundVerticalMargins - // label - Text { - id: label - visible: parent.text !== "" - text: parent.text - font: parent.font - color: parent.hovered ? parent.textColorHovered : parent.textColor - anchors.fill: parent - anchors.leftMargin: 10 - anchors.rightMargin: 10 - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - elide: Text.ElideRight - } + text: root.text + toolTipText: root.toolTipText - // icon - Image { - id: icon - visible: parent.imageSource !== "" - anchors.centerIn: parent - source: parent.imageSource - sourceSize.width: visible ? 32 : 0 - sourceSize.height: visible ? 32 : 0 - } + textColor: root.textColor + textColorHovered: root.textColorHovered - MouseArea { - id: mouseArea - anchors.fill: parent - onClicked: parent.clicked() - hoverEnabled: true - } + bold: root.bold + + imageSource: root.imageSource + imageSourceHover: root.imageSourceHover + + bgColor: Style.ncBlue - ToolTip { - text: parent.tooltipText - delay: 1000 - visible: text != "" && parent.hovered + onClicked: root.clicked() + } } } |