Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/desktop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Cambra <claudio.cambra@gmail.com>2022-08-09 18:20:34 +0300
committerMatthieu Gallien <matthieu_gallien@yahoo.fr>2022-09-06 09:40:03 +0300
commit5acb0b272a6149268cc9e3d0a5816fa38b4499c6 (patch)
treee964e01d9253e14ece3f110f1b6363eed37781d9
parentbb4efae42e421d0992d28602c2b1dbb1a43b5e01 (diff)
Use same tooltip component everywhere
Signed-off-by: Claudio Cambra <claudio.cambra@gmail.com>
-rw-r--r--resources.qrc1
-rw-r--r--src/gui/tray/ActivityItem.qml14
-rw-r--r--src/gui/tray/ActivityItemActions.qml12
-rw-r--r--src/gui/tray/ActivityItemContent.qml12
-rw-r--r--src/gui/tray/CustomButton.qml12
-rw-r--r--src/gui/tray/CustomTextButton.qml12
-rw-r--r--src/gui/tray/NCToolTip.qml34
-rw-r--r--src/gui/tray/TalkReplyTextField.qml3
-rw-r--r--src/gui/tray/UnifiedSearchResultListItem.qml12
9 files changed, 43 insertions, 69 deletions
diff --git a/resources.qrc b/resources.qrc
index d9db7bc05..e25f2fc4a 100644
--- a/resources.qrc
+++ b/resources.qrc
@@ -34,5 +34,6 @@
<file>src/gui/tray/TalkReplyTextField.qml</file>
<file>src/gui/tray/CallNotificationDialog.qml</file>
<file>src/gui/tray/NCBusyIndicator.qml</file>
+ <file>src/gui/tray/NCToolTip.qml</file>
</qresource>
</RCC>
diff --git a/src/gui/tray/ActivityItem.qml b/src/gui/tray/ActivityItem.qml
index b0ead37ed..e952c194e 100644
--- a/src/gui/tray/ActivityItem.qml
+++ b/src/gui/tray/ActivityItem.qml
@@ -40,19 +40,9 @@ MouseArea {
color: (parent.containsMouse ? Style.lightHover : "transparent")
}
- ToolTip {
- id: activityMouseAreaTooltip
- visible: containsMouse && !activityContent.childHovered && model.displayLocation !== ""
- delay: Qt.styleHints.mousePressAndHoldInterval
+ NCToolTip {
+ visible: root.containsMouse && !activityContent.childHovered && model.displayLocation !== ""
text: qsTr("In %1").arg(model.displayLocation)
- contentItem: Label {
- text: activityMouseAreaTooltip.text
- color: Style.ncTextColor
- }
- background: Rectangle {
- border.color: Style.menuBorder
- color: Style.backgroundColor
- }
}
ColumnLayout {
diff --git a/src/gui/tray/ActivityItemActions.qml b/src/gui/tray/ActivityItemActions.qml
index 1b1b70e5c..6d9da4182 100644
--- a/src/gui/tray/ActivityItemActions.qml
+++ b/src/gui/tray/ActivityItemActions.qml
@@ -77,19 +77,9 @@ RowLayout {
radius: width / 2
}
- ToolTip {
- id: moreActionsButtonTooltip
+ NCToolTip {
visible: parent.hovered
- delay: Qt.styleHints.mousePressAndHoldInterval
text: qsTr("Show more actions")
- contentItem: Label {
- text: moreActionsButtonTooltip.text
- color: Style.ncTextColor
- }
- background: Rectangle {
- border.color: Style.menuBorder
- color: Style.backgroundColor
- }
}
Accessible.name: qsTr("Show more actions")
diff --git a/src/gui/tray/ActivityItemContent.qml b/src/gui/tray/ActivityItemContent.qml
index 5b4e14fad..da4b3f846 100644
--- a/src/gui/tray/ActivityItemContent.qml
+++ b/src/gui/tray/ActivityItemContent.qml
@@ -185,19 +185,9 @@ RowLayout {
Layout.margins: Style.roundButtonBackgroundVerticalMargins
- ToolTip {
- id: dismissActionButtonTooltip
+ NCToolTip {
visible: parent.hovered
- delay: Qt.styleHints.mousePressAndHoldInterval
text: qsTr("Dismiss")
- contentItem: Label {
- text: dismissActionButtonTooltip.text
- color: Style.ncTextColor
- }
- background: Rectangle {
- border.color: Style.menuBorder
- color: Style.backgroundColor
- }
}
Accessible.name: qsTr("Dismiss")
diff --git a/src/gui/tray/CustomButton.qml b/src/gui/tray/CustomButton.qml
index 32d6ff575..9a6ff17af 100644
--- a/src/gui/tray/CustomButton.qml
+++ b/src/gui/tray/CustomButton.qml
@@ -31,19 +31,9 @@ Button {
leftPadding: root.text === "" ? 5 : 10
rightPadding: root.text === "" ? 5 : 10
- ToolTip {
- id: customButtonTooltip
+ NCToolTip {
text: root.toolTipText
- delay: Qt.styleHints.mousePressAndHoldInterval
visible: root.toolTipText !== "" && root.hovered
- contentItem: Label {
- text: customButtonTooltip.text
- color: Style.ncTextColor
- }
- background: Rectangle {
- border.color: Style.menuBorder
- color: Style.backgroundColor
- }
}
contentItem: RowLayout {
diff --git a/src/gui/tray/CustomTextButton.qml b/src/gui/tray/CustomTextButton.qml
index 000a54d3c..5c1199a92 100644
--- a/src/gui/tray/CustomTextButton.qml
+++ b/src/gui/tray/CustomTextButton.qml
@@ -32,19 +32,9 @@ Label {
signal pressed(QtObject mouse)
signal clicked(QtObject mouse)
- ToolTip {
- id: customTextButtonTooltip
+ NCToolTip {
text: root.toolTipText
- delay: Qt.styleHints.mousePressAndHoldInterval
visible: root.toolTipText !== "" && root.hovered
- contentItem: Label {
- text: customTextButtonTooltip.text
- color: Style.ncTextColor
- }
- background: Rectangle {
- border.color: Style.menuBorder
- color: Style.backgroundColor
- }
}
MouseArea {
diff --git a/src/gui/tray/NCToolTip.qml b/src/gui/tray/NCToolTip.qml
new file mode 100644
index 000000000..3d9dbb0f5
--- /dev/null
+++ b/src/gui/tray/NCToolTip.qml
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2022 by Claudio Cambra <claudio.cambra@nextcloud.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, 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.
+ */
+
+import QtQml 2.15
+import QtQuick 2.15
+import QtQuick.Controls 2.15
+
+import Style 1.0
+
+ToolTip {
+ id: toolTip
+ clip: true
+ delay: Qt.styleHints.mousePressAndHoldInterval
+ contentItem: Label {
+ text: toolTip.text
+ color: Style.ncTextColor
+ wrapMode: Text.Wrap
+ }
+ background: Rectangle {
+ border.color: Style.menuBorder
+ color: Style.backgroundColor
+ }
+}
diff --git a/src/gui/tray/TalkReplyTextField.qml b/src/gui/tray/TalkReplyTextField.qml
index bec9e11df..79070590e 100644
--- a/src/gui/tray/TalkReplyTextField.qml
+++ b/src/gui/tray/TalkReplyTextField.qml
@@ -48,9 +48,8 @@ TextField {
top: replyMessageTextField.top
}
- ToolTip {
+ NCToolTip {
visible: sendReplyMessageButton.hovered
- delay: Qt.styleHints.mousePressAndHoldInterval
text: qsTr("Send reply to chat message")
}
}
diff --git a/src/gui/tray/UnifiedSearchResultListItem.qml b/src/gui/tray/UnifiedSearchResultListItem.qml
index c53ca4066..4e4246ce6 100644
--- a/src/gui/tray/UnifiedSearchResultListItem.qml
+++ b/src/gui/tray/UnifiedSearchResultListItem.qml
@@ -24,19 +24,9 @@ MouseArea {
height: Style.unifiedSearchItemHeight
- ToolTip {
- id: unifiedSearchResultMouseAreaTooltip
+ NCToolTip {
visible: unifiedSearchResultMouseArea.containsMouse
text: isFetchMoreTrigger ? qsTr("Load more results") : model.resultTitle + "\n\n" + model.subline
- delay: Qt.styleHints.mousePressAndHoldInterval
- contentItem: Label {
- text: unifiedSearchResultMouseAreaTooltip.text
- color: Style.ncTextColor
- }
- background: Rectangle {
- border.color: Style.menuBorder
- color: Style.backgroundColor
- }
}
Rectangle {