Commit 30e805b5 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(mainWindow): searchContact view

parent 6a730dd6
...@@ -112,4 +112,23 @@ ...@@ -112,4 +112,23 @@
<translation>CANCEL</translation> <translation>CANCEL</translation>
</message> </message>
</context> </context>
<context>
<name>searchContact</name>
<message>
<source>searchContactPlaceholder</source>
<translation>Search contact</translation>
</message>
<message>
<source>selectAllContacts</source>
<translation>All</translation>
</message>
<message>
<source>selectConnectedContacts</source>
<translation>Connected</translation>
</message>
<message>
<source>addContact</source>
<translation>ADD CONTACT</translation>
</message>
</context>
</TS> </TS>
...@@ -112,4 +112,23 @@ ...@@ -112,4 +112,23 @@
<translation>ANNULER</translation> <translation>ANNULER</translation>
</message> </message>
</context> </context>
<context>
<name>searchContact</name>
<message>
<source>searchContactPlaceholder</source>
<translation>Rechercher contact</translation>
</message>
<message>
<source>selectAllContacts</source>
<translation>Tous</translation>
</message>
<message>
<source>selectConnectedContacts</source>
<translation>Connectés</translation>
</message>
<message>
<source>addContact</source>
<translation>AJOUTER CONTACT</translation>
</message>
</context>
</TS> </TS>
...@@ -21,6 +21,8 @@ TRANSLATIONS = \ ...@@ -21,6 +21,8 @@ TRANSLATIONS = \
lupdate_only{ lupdate_only{
# Each component folder must be added explicitly. # Each component folder must be added explicitly.
SOURCES = \ SOURCES = \
ui/components/collapse/*.qml \
ui/components/contact/*.qml \
ui/components/dialog/*.qml \ ui/components/dialog/*.qml \
ui/components/form/*.qml \ ui/components/form/*.qml \
ui/components/misc/*.qml \ ui/components/misc/*.qml \
......
...@@ -5,20 +5,26 @@ ...@@ -5,20 +5,26 @@
<file>languages/fr.qm</file> <file>languages/fr.qm</file>
<!-- UI: Components. --> <!-- UI: Components. -->
<file>ui/components/collapse/Collapse.qml</file>
<file>ui/components/contact/Avatar.qml</file>
<file>ui/components/dialog/DialogDescription.qml</file> <file>ui/components/dialog/DialogDescription.qml</file>
<file>ui/components/dialog/DialogPlus.qml</file> <file>ui/components/dialog/DialogPlus.qml</file>
<file>ui/components/form/Collapse.qml</file> <file>ui/components/form/DarkButton.qml</file>
<file>ui/components/form/DialogButton.qml</file>
<file>ui/components/form/DialogCheckBox.qml</file> <file>ui/components/form/DialogCheckBox.qml</file>
<file>ui/components/form/ExclusiveButtons.qml</file>
<file>ui/components/form/LightButton.qml</file>
<file>ui/components/form/SmallButton.qml</file>
<file>ui/components/form/ToolBarButton.qml</file> <file>ui/components/form/ToolBarButton.qml</file>
<file>ui/components/form/TransparentComboBox.qml</file> <file>ui/components/form/TransparentComboBox.qml</file>
<file>ui/components/misc/Contact.qml</file> <file>ui/components/misc/Contact.qml</file>
<file>ui/components/misc/MenuEntry.qml</file> <file>ui/components/misc/MenuEntry.qml</file>
<file>ui/components/scrollBar/ForceScrollBar.qml</file>
<file>ui/components/select/SelectContact.qml</file> <file>ui/components/select/SelectContact.qml</file>
<!-- UI: Views. --> <!-- UI: Views. -->
<file>ui/views/mainWindow/home.qml</file> <file>ui/views/mainWindow/home.qml</file>
<file>ui/views/mainWindow/mainWindow.qml</file> <file>ui/views/mainWindow/mainWindow.qml</file>
<file>ui/views/mainWindow/searchContact.qml</file>
<file>ui/views/manageAccounts.qml</file> <file>ui/views/manageAccounts.qml</file>
<file>ui/views/newCall.qml</file> <file>ui/views/newCall.qml</file>
......
import QtQuick 2.7 import QtQuick 2.7
import QtQuick.Controls 2.0
// =================================================================== // ===================================================================
......
import QtQuick 2.7
Rectangle {
property string username
property string image
color: '#8F8F8F'
radius: 20
Text {
anchors.centerIn: parent
text: (function () {
var spaceIndex = username.indexOf(' ')
var firstLetter = username.charAt(0)
if (spaceIndex === -1) {
return firstLetter
}
return firstLetter + username.charAt(spaceIndex + 1)
})()
color: '#FFFFFF'
}
}
import QtQuick 2.7 import QtQuick 2.7
// ===================================================================
// Description content used by dialogs.
// =================================================================== // ===================================================================
Item { Item {
......
...@@ -2,12 +2,15 @@ import QtQuick 2.7 ...@@ -2,12 +2,15 @@ import QtQuick 2.7
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import QtQuick.Window 2.2 import QtQuick.Window 2.2
// ===================================================================
// Helper to build quickly dialogs.
// =================================================================== // ===================================================================
Window { Window {
default property alias contents: content.data // Required. default property alias contents: content.data // Required.
property alias buttons: buttons.data // Required. property alias buttons: buttons.data // Required.
property alias descriptionText: description.text // Optionnal. property alias descriptionText: description.text // Optionnal.
property bool centeredButtons // Optionnal. property bool centeredButtons // Optionnal.
modality: Qt.WindowModal modality: Qt.WindowModal
......
import QtQuick 2.7
// ===================================================================
Row {
property alias text1: button1.text
property alias text2: button2.text
property bool button1IsSelected: true
signal buttonChanged (int button)
spacing: 8
SmallButton {
anchors.verticalCenter: parent.verticalCenter
backgroundColor: button1IsSelected
? '#8E8E8E'
: (button1.down
? '#FE5E00'
: '#D1D1D1'
)
id: button1
onClicked: {
if (!button1IsSelected) {
button1IsSelected = true
buttonChanged(1)
}
}
}
SmallButton {
anchors.verticalCenter: parent.verticalCenter
backgroundColor: !button1IsSelected
? '#8E8E8E'
: (button2.down
? '#FE5E00'
: '#D1D1D1'
)
id: button2
onClicked: {
if (button1IsSelected) {
button1IsSelected = false
buttonChanged(2)
}
}
}
}
import QtQuick 2.7
import QtQuick.Controls 2.0
// ===================================================================
DarkButton {
backgroundColor: '#D1D1D1'
textColor: '#5A585B'
}
import QtQuick 2.7
import QtQuick.Controls 2.0
// ===================================================================
Button {
property alias backgroundColor: background.color
background: Rectangle {
color: button.down ? '#FE5E00' : '#8E8E8E'
id: background
implicitHeight: 22
radius: 10
}
contentItem: Text {
color:'#FFFFFF'
font.pointSize: 8
horizontalAlignment: Text.AlignHCenter
id: text
text: button.text
verticalAlignment: Text.AlignVCenter
}
id: button
}
import QtQuick 2.7
import QtQuick.Controls 2.0
// ===================================================================
ScrollBar {
background: Rectangle {
color: '#F4F4F4'
}
contentItem: Rectangle {
color: scrollBar.pressed ? '#5E5E5F' : '#C5C5C5'
implicitHeight: 100
implicitWidth: 8
radius: 10
}
id: scrollBar
}
...@@ -4,8 +4,6 @@ import QtQuick.Layouts 1.3 ...@@ -4,8 +4,6 @@ import QtQuick.Layouts 1.3
import 'qrc:/ui/components/form' import 'qrc:/ui/components/form'
// ===================================================================
ColumnLayout { ColumnLayout {
spacing: 0 spacing: 0
...@@ -32,10 +30,8 @@ ColumnLayout { ...@@ -32,10 +30,8 @@ ColumnLayout {
font.pointSize: 11 font.pointSize: 11
} }
DialogButton { LightButton {
backgroundColor: '#D1D1D1'
text: qsTr('invitContact') text: qsTr('invitContact')
textColor: '#5A585B'
} }
} }
...@@ -50,10 +46,8 @@ ColumnLayout { ...@@ -50,10 +46,8 @@ ColumnLayout {
font.pointSize: 11 font.pointSize: 11
} }
DialogButton { LightButton {
backgroundColor: '#D1D1D1'
text: qsTr('addContact') text: qsTr('addContact')
textColor: '#5A585B'
} }
} }
} }
......
...@@ -2,6 +2,7 @@ import QtQuick 2.7 ...@@ -2,6 +2,7 @@ import QtQuick 2.7
import QtQuick.Controls 2.0 import QtQuick.Controls 2.0
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import 'qrc:/ui/components/collapse'
import 'qrc:/ui/components/form' import 'qrc:/ui/components/form'
import 'qrc:/ui/components/misc' import 'qrc:/ui/components/misc'
...@@ -59,7 +60,7 @@ ApplicationWindow { ...@@ -59,7 +60,7 @@ ApplicationWindow {
// User actions. // User actions.
ToolBarButton { ToolBarButton {
onClicked: { onClicked: {
var component = Qt.createComponent('qrc:/ui/views/newCall.qml'); var component = Qt.createComponent('qrc:/ui/views/manageAccounts.qml');
if (component.status !== Component.Ready) { if (component.status !== Component.Ready) {
console.debug('Window not ready.') console.debug('Window not ready.')
if(component.status === Component.Error) { if(component.status === Component.Error) {
...@@ -141,7 +142,7 @@ ApplicationWindow { ...@@ -141,7 +142,7 @@ ApplicationWindow {
Loader { Loader {
Layout.fillHeight: true Layout.fillHeight: true
Layout.fillWidth: true Layout.fillWidth: true
source: 'qrc:/ui/views/mainWindow/home.qml' source: 'qrc:/ui/views/mainWindow/searchContact.qml'
} }
} }
} }
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.3
import 'qrc:/ui/components/contact'
import 'qrc:/ui/components/form'
import 'qrc:/ui/components/scrollBar'
ColumnLayout {
spacing: 2
// Search bar.
Item {
Layout.fillWidth: true
Layout.preferredHeight: 50
anchors.left: parent.left
anchors.leftMargin: 18
anchors.right: parent.right
anchors.rightMargin: 18
RowLayout {
anchors.verticalCenter: parent.verticalCenter
height: 30
spacing: 20
width: parent.width
TextField {
Layout.fillWidth: true
Layout.preferredHeight: parent.height
background: Rectangle {
color: '#EAEAEA'
}
placeholderText: qsTr('searchContactPlaceholder')
}
ExclusiveButtons {
Layout.preferredHeight: parent.height
text1: qsTr('selectAllContacts')
text2: qsTr('selectConnectedContacts')
}
LightButton {
Layout.preferredHeight: parent.height
text: qsTr('addContact')
}
}
}
// Contacts list.
Rectangle {
Layout.fillWidth: true
Layout.fillHeight: true
color: '#F5F5F5'
ListView {
ScrollBar.vertical: ForceScrollBar { }
anchors.fill: parent
boundsBehavior: Flickable.StopAtBounds
clip: true
highlightRangeMode: ListView.ApplyRange
spacing: 1
// TODO: Remove, use C++ model instead.
model: ListModel {
ListElement {
$image: ''
$presence: 'connected'
$username: 'Isabella Ahornton'
}
ListElement {
$image: ''
$presence: 'connected'
$username: 'Mary Boreno'
}
ListElement {
$image: ''
$presence: 'disconnected'
$username: 'Cecelia Cyler'
}
ListElement {
$image: ''
$presence: 'absent'
$username: 'Daniel Elliott'
}
ListElement {
$image: ''
$presence: 'do_not_disturb'
$username: 'Effie Forton'
}
ListElement {
$image: ''
$presence: 'do_not_disturb'
$username: 'Agnes Hurner'
}
ListElement {
$image: ''
$presence: 'disconnected'
$username: 'Luke Leming'
}
ListElement {
$image: ''
$presence: 'connected'
$username: 'Olga Manning'
}
ListElement {
$image: ''
$presence: 'connected'
$username: 'Isabella Ahornton'
}
ListElement {
$image: ''
$presence: 'connected'
$username: 'Mary Boreno'
}
ListElement {
$image: ''
$presence: 'disconnected'
$username: 'Cecelia Cyler'
}
ListElement {
$image: ''
$presence: 'absent'
$username: 'Daniel Elliott'
}
ListElement {
$image: ''
$presence: 'do_not_disturb'
$username: 'Effie Forton'
}
ListElement {
$image: ''
$presence: 'do_not_disturb'
$username: 'Agnes Hurner'
}
ListElement {
$image: ''
$presence: 'disconnected'
$username: 'Luke Leming'
}
ListElement {
$image: ''
$presence: 'connected'
$username: 'Olga Manning'
}
}
delegate: Rectangle {
color: '#FFFFFF'
height: 50
id: contact
width: parent.width
Item {
anchors.verticalCenter: parent.verticalCenter
height: 30
width: parent.width
RowLayout {
anchors.fill: parent
anchors.leftMargin: 15
anchors.rightMargin: 15
spacing: 15
// Avatar.
Avatar {
Layout.fillHeight: parent.height
Layout.preferredWidth: 30
image: $image
username: $username
}
// Presence.
Item {
Layout.fillHeight: parent.height
Layout.preferredWidth: 20
Image {
anchors.fill: parent
fillMode: Image.PreserveAspectFit
source: 'qrc:/imgs/led_' + $presence + '.svg'
}
}
// Username.
Item {
Layout.fillHeight: parent.height
Layout.fillWidth: true
Text {
anchors.fill: parent
clip: true
color: '#5A585B'
font.weight: Font.DemiBold
text: $username
verticalAlignment: Text.AlignVCenter
MouseArea {
anchors.fill: parent
hoverEnabled: true
onEntered: contact.state = 'hover'
onExited: contact.state = ''
}
}
}
// Actions.
// TODO.
}
}
states: State {
name: 'hover'
PropertyChanges { target: contact; color: '#D1D1D1' }
}
}
}
}
}
...@@ -4,6 +4,7 @@ import QtQuick.Layouts 1.3 ...@@ -4,6 +4,7 @@ import QtQuick.Layouts 1.3
import 'qrc:/ui/components/dialog' import 'qrc:/ui/components/dialog'
import 'qrc:/ui/components/form' import 'qrc:/ui/components/form'
import 'qrc:/ui/components/scrollBar'
DialogPlus { DialogPlus {
descriptionText: qsTr('manageAccountsDescription') descriptionText: qsTr('manageAccountsDescription')
...@@ -11,7 +12,7 @@ DialogPlus { ...@@ -11,7 +12,7 @@ DialogPlus {
minimumWidth: 480 minimumWidth: 480
title: qsTr('manageAccountsTitle') title: qsTr('manageAccountsTitle')
buttons: DialogButton { buttons: DarkButton {
text: qsTr('validate') text: qsTr('validate')
} }
...@@ -20,6 +21,7 @@ DialogPlus { ...@@ -20,6 +21,7 @@ DialogPlus {
anchors.fill: parent anchors.fill: parent
ListView { ListView {
ScrollBar.vertical: ForceScrollBar { }
anchors.fill: parent anchors.fill: parent
boundsBehavior: Flickable.StopAtBounds boundsBehavior: Flickable.StopAtBounds
clip: true clip: true
......
...@@ -11,7 +11,7 @@ DialogPlus { ...@@ -11,7 +11,7 @@ DialogPlus {
minimumWidth: 420 minimumWidth: 420
title: qsTr('newCallTitle') title: qsTr('newCallTitle')
buttons: DialogButton { buttons: DarkButton {
text: qsTr('cancel') text: qsTr('cancel')
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment