Skip to content
Snippets Groups Projects
Commit a8378ab2 authored by Ming Rui Zhang's avatar Ming Rui Zhang Committed by Sébastien Blin
Browse files

contactsearch: add convenient button for clearing search result

- Changed radius
- Added preferred width for side panel to fully show
  contact search bar placeholder text by default (English)

Gitlab: #321

Change-Id: I2c26ebc34812db41f5d50408e2e092bf0a99f76d
parent a69943e0
No related branches found
No related tags found
No related merge requests found
...@@ -395,7 +395,10 @@ Item { ...@@ -395,7 +395,10 @@ Item {
property string createNewJA: qsTr("Create a Jami account") property string createNewJA: qsTr("Create a Jami account")
property string aboutJami: qsTr("About Jami") property string aboutJami: qsTr("About Jami")
// Smart list context menu // SmartList
property string clearText: qsTr("Clear Text")
// SmartList context menu
property string declineContactRequest: qsTr("Decline contact request") property string declineContactRequest: qsTr("Decline contact request")
property string acceptContactRequest: qsTr("Accept contact request") property string acceptContactRequest: qsTr("Accept contact request")
......
...@@ -166,6 +166,7 @@ Item { ...@@ -166,6 +166,7 @@ Item {
property int menuFontSize: 12 property int menuFontSize: 12
property int headerFontSize: 13 property int headerFontSize: 13
property int titleFontSize: 16 property int titleFontSize: 16
property int lineEditRadius: 4
property int maximumWidthSettingsView: 600 property int maximumWidthSettingsView: 600
property int settingsHeaderpreferredHeight: 64 property int settingsHeaderpreferredHeight: 64
...@@ -179,13 +180,13 @@ Item { ...@@ -179,13 +180,13 @@ Item {
property int pluginHandlersPopupViewDelegateHeight: 50 property int pluginHandlersPopupViewDelegateHeight: 50
// main application spec // main application spec
property int mainViewMinWidth: 460 property int mainViewMinWidth: 300
property int mainViewMinHeight: 400 property int mainViewMinHeight: 400
property int wizardViewMinWidth: 500 property int wizardViewMinWidth: 500
property int wizardViewMinHeight: 600 property int wizardViewMinHeight: 600
property int mainViewPreferredWidth: 650 property int mainViewPreferredWidth: 725
property int mainViewPreferredHeight: 600 property int mainViewPreferredHeight: 600
function setTheme(dark) { function setTheme(dark) {
......
...@@ -41,12 +41,13 @@ Rectangle { ...@@ -41,12 +41,13 @@ Rectangle {
property var containerWindow: "" property var containerWindow: ""
property int sidePanelViewStackPreferredWidth: 250 property int sidePanelViewStackMinimumWidth: 300
property int mainViewStackPreferredWidth: 250 property int mainViewStackPreferredWidth: 425
property int settingsViewPreferredWidth: 460 property int settingsViewPreferredWidth: 460
property int onWidthChangedTriggerDistance: 5 property int onWidthChangedTriggerDistance: 5
property bool sidePanelOnly: (!mainViewStack.visible) && sidePanelViewStack.visible property bool sidePanelOnly: (!mainViewStack.visible) && sidePanelViewStack.visible
property int previousWidth: width
// To calculate tab bar bottom border hidden rect left margin. // To calculate tab bar bottom border hidden rect left margin.
property int tabBarLeftMargin: 8 property int tabBarLeftMargin: 8
...@@ -161,7 +162,7 @@ Rectangle { ...@@ -161,7 +162,7 @@ Rectangle {
sidePanelViewStack.push(settingsMenu, StackView.Immediate) sidePanelViewStack.push(settingsMenu, StackView.Immediate)
var windowCurrentMinimizedSize = settingsViewPreferredWidth var windowCurrentMinimizedSize = settingsViewPreferredWidth
+ sidePanelViewStackPreferredWidth + onWidthChangedTriggerDistance + sidePanelViewStackMinimumWidth + onWidthChangedTriggerDistance
if (containerWindow.width < windowCurrentMinimizedSize) if (containerWindow.width < windowCurrentMinimizedSize)
containerWindow.width = windowCurrentMinimizedSize containerWindow.width = windowCurrentMinimizedSize
} }
...@@ -289,9 +290,10 @@ Rectangle { ...@@ -289,9 +290,10 @@ Rectangle {
Rectangle { Rectangle {
id: mainViewSidePanelRect id: mainViewSidePanelRect
SplitView.minimumWidth: sidePanelViewStackPreferredWidth SplitView.minimumWidth: sidePanelViewStackMinimumWidth
SplitView.maximumWidth: (sidePanelOnly ? splitView.width : SplitView.maximumWidth: (sidePanelOnly ?
splitView.width - sidePanelViewStackPreferredWidth) splitView.width :
splitView.width - sidePanelViewStackMinimumWidth)
SplitView.fillHeight: true SplitView.fillHeight: true
color: JamiTheme.backgroundColor color: JamiTheme.backgroundColor
...@@ -352,8 +354,9 @@ Rectangle { ...@@ -352,8 +354,9 @@ Rectangle {
SplitView.maximumWidth: sidePanelOnly ? SplitView.maximumWidth: sidePanelOnly ?
splitView.width : splitView.width :
splitView.width - sidePanelViewStackPreferredWidth splitView.width - sidePanelViewStackMinimumWidth
SplitView.minimumWidth: sidePanelViewStackPreferredWidth SplitView.preferredWidth: mainViewStackPreferredWidth
SplitView.minimumWidth: sidePanelViewStackMinimumWidth
SplitView.fillHeight: true SplitView.fillHeight: true
clip: true clip: true
...@@ -493,8 +496,10 @@ Rectangle { ...@@ -493,8 +496,10 @@ Rectangle {
onWidthChanged: { onWidthChanged: {
// Hide unnecessary stackview when width is changed. // Hide unnecessary stackview when width is changed.
var widthToCompare = sidePanelViewStackPreferredWidth + var widthToCompare = previousWidth < mainView.width ?
(inSettingsView ? settingsViewPreferredWidth : mainViewStackPreferredWidth) sidePanelViewStackMinimumWidth :
(sidePanelViewStackMinimumWidth +
(inSettingsView ? settingsViewPreferredWidth : mainViewStackPreferredWidth))
if (mainView.width < widthToCompare - onWidthChangedTriggerDistance if (mainView.width < widthToCompare - onWidthChangedTriggerDistance
&& mainViewStack.visible) { && mainViewStack.visible) {
...@@ -512,8 +517,6 @@ Rectangle { ...@@ -512,8 +517,6 @@ Rectangle {
} }
else if (inWelcomeViewStack) else if (inWelcomeViewStack)
recursionStackViewItemMove(mainViewStack, sidePanelViewStack) recursionStackViewItemMove(mainViewStack, sidePanelViewStack)
mainView.update()
} else if (mainView.width >= widthToCompare + onWidthChangedTriggerDistance } else if (mainView.width >= widthToCompare + onWidthChangedTriggerDistance
&& !mainViewStack.visible) { && !mainViewStack.visible) {
mainViewStack.visible = true mainViewStack.visible = true
...@@ -532,9 +535,9 @@ Rectangle { ...@@ -532,9 +535,9 @@ Rectangle {
if (currentAccountIsCalling()) if (currentAccountIsCalling())
pushCallStackView() pushCallStackView()
} }
mainView.update()
} }
previousWidth = mainView.width
} }
AboutPopUp { AboutPopUp {
......
...@@ -24,8 +24,12 @@ import QtGraphicalEffects 1.14 ...@@ -24,8 +24,12 @@ import QtGraphicalEffects 1.14
import net.jami.Models 1.0 import net.jami.Models 1.0
import net.jami.Constants 1.0 import net.jami.Constants 1.0
import "../../commoncomponents"
Rectangle { Rectangle {
id: contactSearchBarRect id: root
property int itemMargin: 8
signal contactSearchBarTextChanged(string text) signal contactSearchBarTextChanged(string text)
signal returnPressedWhileSearching signal returnPressedWhileSearching
...@@ -35,7 +39,7 @@ Rectangle { ...@@ -35,7 +39,7 @@ Rectangle {
fakeFocus.forceActiveFocus() fakeFocus.forceActiveFocus()
} }
radius: height / 2 radius: JamiTheme.lineEditRadius
color: JamiTheme.secondaryBackgroundColor color: JamiTheme.secondaryBackgroundColor
FocusScope { FocusScope {
...@@ -45,12 +49,12 @@ Rectangle { ...@@ -45,12 +49,12 @@ Rectangle {
Image { Image {
id: searchIconImage id: searchIconImage
anchors.verticalCenter: contactSearchBarRect.verticalCenter anchors.verticalCenter: root.verticalCenter
anchors.left: contactSearchBarRect.left anchors.left: root.left
anchors.leftMargin: 8 anchors.leftMargin: itemMargin
width: 20 width: 16
height: 20 height: 16
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
mipmap: true mipmap: true
...@@ -65,15 +69,18 @@ Rectangle { ...@@ -65,15 +69,18 @@ Rectangle {
TextField { TextField {
id: contactSearchBar id: contactSearchBar
color: JamiTheme.textColor
anchors.verticalCenter: contactSearchBarRect.verticalCenter anchors.verticalCenter: root.verticalCenter
anchors.left: searchIconImage.right anchors.left: searchIconImage.right
width: contactSearchBarRect.width - searchIconImage.width - 10 width: root.width - searchIconImage.width - clearTextButton.width - itemMargin * 2
height: contactSearchBarRect.height - 5 height: root.height - 5
color: JamiTheme.textColor
font.pointSize: JamiTheme.textFontSize font.pointSize: JamiTheme.textFontSize
font.kerning: true
selectByMouse: true selectByMouse: true
selectionColor: JamiTheme.contactSearchBarPlaceHolderTextFontColor selectionColor: JamiTheme.contactSearchBarPlaceHolderTextFontColor
...@@ -86,10 +93,26 @@ Rectangle { ...@@ -86,10 +93,26 @@ Rectangle {
color: "transparent" color: "transparent"
} }
onTextChanged: { onTextChanged: root.contactSearchBarTextChanged(contactSearchBar.text)
contactSearchBarRect.contactSearchBarTextChanged(
contactSearchBar.text)
} }
PushButton {
id: clearTextButton
anchors.verticalCenter: root.verticalCenter
anchors.left: contactSearchBar.right
preferredSize: 16
visible: contactSearchBar.text.length
normalColor: root.color
imageColor: JamiTheme.primaryForegroundColor
source: "qrc:/images/icons/ic_clear_24px.svg"
toolTipText: JamiStrings.clearText
onClicked: contactSearchBar.clear()
} }
Shortcut { Shortcut {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment