Commit a2efc6fa authored by Ronan Abhamon's avatar Ronan Abhamon

fix(app): refactoring

parent 1832297f
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="63px" height="82px" viewBox="0 0 63 82" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
<!-- Generator: Sketch 3.3.3 (12081) - http://www.bohemiancoding.com/sketch -->
<title>delete</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="OUTILS" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
<g id="linphone_v2.0_icones_buttons" sketch:type="MSArtboardGroup" transform="translate(-1451.000000, -7131.000000)">
<g id="delete" sketch:type="MSLayerGroup" transform="translate(1426.000000, 7115.000000)">
<g transform="translate(27.000000, 19.000000)" stroke="#444444" id="Delete-icon" stroke-width="5" sketch:type="MSShapeGroup" stroke-linecap="round" stroke-linejoin="round">
<path d="M29.5231579,75.5263158 L34.8768421,75.5263158 C46.4010526,75.5263158 48.46,64.9796053 48.46,64.9796053 L58.3389474,10.9707368 L0.5,10.9707368 L10.38,64.9796053 C10.38,64.9796053 12.4410526,75.5263158 23.9652632,75.5263158 L29.5231579,75.5263158 L29.5231579,75.5263158 Z M22.7305263,24.4726842 L22.7305263,75.5263158 L22.7305263,24.4726842 Z M36.1094737,24.4726842 L36.1094737,75.5263158 L36.1094737,24.4726842 Z M17.5852632,9.09494702e-13 L41.2568421,9.09494702e-13 L17.5852632,9.09494702e-13 Z"></path>
</g>
<rect id="Rectangle-232-Copy-27" opacity="0" fill-opacity="0.7" fill="#FFFFFF" sketch:type="MSShapeGroup" x="0" y="0" width="120" height="120"></rect>
</g>
</g>
</g>
</svg>
\ No newline at end of file
<!DOCTYPE RCC><RCC version="1.0"> <!DOCTYPE RCC><RCC version="1.0">
<qresource prefix="/"> <qresource prefix="/">
<!-- Languages. -->
<file>languages/en.qm</file>
<file>languages/fr.qm</file> <file>languages/fr.qm</file>
<file>languages/en.qm</file>
<!-- UI: Components. --> <file>ui/components/scrollBar/ForceScrollBar.qml</file>
<file>ui/components/misc/MenuEntry.qml</file>
<file>ui/components/select/SelectContact.qml</file>
<file>ui/components/collapse/Collapse.qml</file> <file>ui/components/collapse/Collapse.qml</file>
<file>ui/components/contact/Avatar.qml</file> <file>ui/components/contact/Contact.qml</file>
<file>ui/components/contact/ShortContactDescription.qml</file> <file>ui/components/contact/ShortContactDescription.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/DarkButton.qml</file>
<file>ui/components/form/CheckBoxText.qml</file> <file>ui/components/form/CheckBoxText.qml</file>
<file>ui/components/form/DropZone.qml</file> <file>ui/components/form/DropZone.qml</file>
<file>ui/components/form/ExclusiveButtons.qml</file>
<file>ui/components/form/LightButton.qml</file> <file>ui/components/form/LightButton.qml</file>
<file>ui/components/form/SmallButton.qml</file> <file>ui/components/form/ExclusiveButtons.qml</file>
<file>ui/components/form/ToolBarButton.qml</file> <file>ui/components/form/ActionBar.qml</file>
<file>ui/components/form/ActionButton.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/form/SmallButton.qml</file>
<file>ui/components/misc/MenuEntry.qml</file> <file>ui/components/form/DarkButton.qml</file>
<file>ui/components/scrollBar/ForceScrollBar.qml</file> <file>ui/views/newCall.qml</file>
<file>ui/components/select/SelectContact.qml</file> <file>ui/views/manageAccounts.qml</file>
<file>ui/views/mainWindow/mainWindow.qml</file>
<!-- UI: Views. -->
<file>ui/views/mainWindow/contacts.qml</file> <file>ui/views/mainWindow/contacts.qml</file>
<file>ui/views/mainWindow/conversation.qml</file>
<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/conversation.qml</file>
<file>ui/views/manageAccounts.qml</file>
<file>ui/views/newCall.qml</file>
<!-- Images. -->
<file>imgs/avatar.svg</file>
<file>imgs/camera.svg</file>
<file>imgs/chat_attachment.svg</file>
<file>imgs/collapse.svg</file>
<file>imgs/led_absent.svg</file>
<file>imgs/led_connected.svg</file>
<file>imgs/led_disconnected.svg</file> <file>imgs/led_disconnected.svg</file>
<file>imgs/led_do_not_disturb.svg</file>
<file>imgs/phone.svg</file>
<file>imgs/start_conference.svg</file>
<file>imgs/valid.svg</file> <file>imgs/valid.svg</file>
</qresource> <file>imgs/led_do_not_disturb.svg</file>
<file>imgs/conference.svg</file>
<file>imgs/cam.svg</file>
<file>imgs/chat_attachment.svg</file>
<file>imgs/led_connected.svg</file>
<file>imgs/led_absent.svg</file>
<file>imgs/call.svg</file>
<file>imgs/collapse.svg</file>
<file>imgs/delete.svg</file>
<file>imgs/contact.svg</file>
</qresource>
</RCC> </RCC>
...@@ -4,7 +4,6 @@ import QtQuick 2.7 ...@@ -4,7 +4,6 @@ import QtQuick 2.7
Item { Item {
property bool enabled: false property bool enabled: false
property alias image: backgroundImage.source
signal collapsed (bool collapsed) signal collapsed (bool collapsed)
...@@ -18,6 +17,7 @@ Item { ...@@ -18,6 +17,7 @@ Item {
anchors.fill: parent anchors.fill: parent
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
id: backgroundImage id: backgroundImage
source: 'qrc:/imgs/collapse.svg'
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
......
import QtQuick 2.7 import QtQuick 2.7
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0 // OpacityMask.
// =================================================================== // ===================================================================
...@@ -44,8 +44,8 @@ Item { ...@@ -44,8 +44,8 @@ Item {
// Avatar. // Avatar.
OpacityMask { OpacityMask {
anchors.fill: imageToFilter anchors.fill: imageToFilter
source: imageToFilter
maskSource: avatar maskSource: avatar
source: imageToFilter
} }
// Presence. // Presence.
...@@ -55,13 +55,9 @@ Item { ...@@ -55,13 +55,9 @@ Item {
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
height: parent.height/ 3 height: parent.height/ 3
id: presenceImage id: presenceImage
source: (function () { source: presence
if (!presence) { ? 'qrc:/imgs/led_' + presence + '.svg'
return '' : ''
}
return 'qrc:/imgs/led_' + presence + '.svg'
})()
width: parent.width / 3 width: parent.width / 3
} }
} }
import QtQuick 2.7
import QtQuick.Layouts 1.3
import 'qrc:/ui/components/form'
// ===================================================================
Item {
property alias actions: actionBar.data
property alias image: avatar.image
property alias presence: avatar.presence
property alias sipAddress: contactDescription.sipAddress
property string username
id: contact
height: 50
RowLayout {
anchors.fill: parent
anchors.leftMargin: 14
anchors.rightMargin: 14
spacing: 14
Avatar {
Layout.preferredHeight: 32
Layout.preferredWidth: 32
id: avatar
username: contact.username
}
ShortContactDescription {
Layout.fillHeight: true
Layout.fillWidth: true
id: contactDescription
username: contact.username
}
ActionBar {
Layout.preferredHeight: 32
id: actionBar
}
}
}
...@@ -3,8 +3,8 @@ import QtQuick 2.7 ...@@ -3,8 +3,8 @@ import QtQuick 2.7
// =================================================================== // ===================================================================
Column { Column {
property string sipAddress property alias sipAddress: sipAddress.text
property string username property alias username: username.text
// Username. // Username.
Text { Text {
...@@ -13,7 +13,7 @@ Column { ...@@ -13,7 +13,7 @@ Column {
font.pointSize: 11 font.pointSize: 11
font.weight: Font.DemiBold font.weight: Font.DemiBold
height: parent.height / 2 height: parent.height / 2
text: username id: username
verticalAlignment: Text.AlignBottom verticalAlignment: Text.AlignBottom
width: parent.width width: parent.width
} }
...@@ -23,7 +23,7 @@ Column { ...@@ -23,7 +23,7 @@ Column {
clip: true clip: true
color: '#5A585B' color: '#5A585B'
height: parent.height / 2 height: parent.height / 2
text: sipAddress id: sipAddress
verticalAlignment: Text.AlignTop verticalAlignment: Text.AlignTop
width: parent.width width: parent.width
} }
......
...@@ -5,7 +5,6 @@ import QtQuick 2.7 ...@@ -5,7 +5,6 @@ import QtQuick 2.7
// =================================================================== // ===================================================================
Item { Item {
property alias fontSize: description.font.pointSize
property alias text: description.text property alias text: description.text
height: text ? 90 : 25 height: text ? 90 : 25
......
...@@ -7,7 +7,7 @@ import QtQuick.Window 2.2 ...@@ -7,7 +7,7 @@ import QtQuick.Window 2.2
// =================================================================== // ===================================================================
Window { Window {
default property alias contents: content.data // Required. default property alias content: 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.
......
import QtQuick 2.7
// ===================================================================
// Bar which can contains ActionButton.
// ===================================================================
Row {
property int iconSize
spacing: 8
}
...@@ -2,13 +2,21 @@ import QtQuick 2.7 ...@@ -2,13 +2,21 @@ import QtQuick 2.7
import QtQuick.Controls 2.0 import QtQuick.Controls 2.0
// =================================================================== // ===================================================================
// An animated small button with an image.
// ===================================================================
Button {
property int iconSize
property string icon
ToolButton { // Ugly hack, use current size, ActionBar size,
property alias image: backgroundImage.source // or other parent height.
height: iconSize || parent.iconSize || parent.height
width: iconSize || parent.iconSize || parent.height
Image { Image {
anchors.fill: parent anchors.fill: parent
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
id: backgroundImage source: 'qrc:/imgs/' + parent.icon + '.svg'
} }
} }
...@@ -6,6 +6,14 @@ import QtQuick.Controls 2.0 ...@@ -6,6 +6,14 @@ import QtQuick.Controls 2.0
// =================================================================== // ===================================================================
CheckBox { CheckBox {
contentItem: Text {
color: checkBox.down ? '#FE5E00' : '#8E8E8E'
font: checkBox.font
horizontalAlignment: Text.AlignHCenter
leftPadding: checkBox.indicator.width + checkBox.spacing
text: checkBox.text
verticalAlignment: Text.AlignVCenter
}
id: checkBox id: checkBox
indicator: Rectangle { indicator: Rectangle {
border.color: checkBox.down ? '#FE5E00' : '#8E8E8E' border.color: checkBox.down ? '#FE5E00' : '#8E8E8E'
...@@ -25,12 +33,4 @@ CheckBox { ...@@ -25,12 +33,4 @@ CheckBox {
y: 4 y: 4
} }
} }
contentItem: Text {
color: checkBox.down ? '#FE5E00' : '#8E8E8E'
font: checkBox.font
horizontalAlignment: Text.AlignHCenter
leftPadding: checkBox.indicator.width + checkBox.spacing
text: checkBox.text
verticalAlignment: Text.AlignVCenter
}
} }
...@@ -12,14 +12,18 @@ Row { ...@@ -12,14 +12,18 @@ Row {
Repeater { Repeater {
model: texts model: texts
SmallButton { SmallButton {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
backgroundColor: selectedButton === index backgroundColor: selectedButton === index
? '#8E8E8E' ? '#8E8E8E'
: (button.down : (button.down
? '#FE5E00' ? '#FE5E00'
: (button.hovered
? '#C0C0C0'
: '#D1D1D1' : '#D1D1D1'
) )
)
id: button id: button
text: modelData text: modelData
......
import QtQuick 2.7 import QtQuick 2.7
import QtQuick.Controls 2.0
// =================================================================== // ===================================================================
......
...@@ -7,7 +7,12 @@ Button { ...@@ -7,7 +7,12 @@ Button {
property alias backgroundColor: background.color property alias backgroundColor: background.color
background: Rectangle { background: Rectangle {
color: button.down ? '#FE5E00' : '#8E8E8E' color: button.down
? '#FE5E00'
: (button.hovered
? '#C0C0C0'
: '#D1D1D1'
)
id: background id: background
implicitHeight: 22 implicitHeight: 22
radius: 10 radius: 10
...@@ -20,5 +25,6 @@ Button { ...@@ -20,5 +25,6 @@ Button {
text: button.text text: button.text
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
} }
hoverEnabled: true
id: button id: button
} }
...@@ -14,8 +14,7 @@ ComboBox { ...@@ -14,8 +14,7 @@ ComboBox {
background: Rectangle { background: Rectangle {
color: delegate.down color: delegate.down
? '#FE5E00' ? '#FE5E00'
: ( : (comboBox.currentIndex === index
comboBox.currentIndex === index
? '#F0F0F0' ? '#F0F0F0'
: '#FFFFFF' : '#FFFFFF'
) )
......
import QtQuick 2.7
import QtQuick.Layouts 1.3
Item {
property alias sipAddress: sipAddressText.text
property alias username: usernameText.text
property string avatar: 'qrc:/imgs/avatar.svg' // Default.
id: contact
height: 50
RowLayout {
anchors.fill: parent
// Avatar.
Image {
Layout.fillHeight: parent.height
Layout.margins: 5
Layout.preferredWidth: 50
fillMode: Image.PreserveAspectFit
id: avatarImage
source: contact.avatar
}
// Sip address & username.
Column {
Layout.fillHeight: parent.height
Layout.fillWidth: true
// Username.
Text {
clip: true
color: '#5A585B'
font.weight: Font.DemiBold
height: parent.height / 2
id: usernameText
verticalAlignment: Text.AlignBottom
width: parent.width
}
// Sip address.
Text {
clip: true
color: '#5A585B'
height: parent.height / 2
id: sipAddressText
verticalAlignment: Text.AlignTop
width: parent.width
}
}
// Actions.
Row {
Layout.fillHeight: parent.height
Layout.preferredWidth: 90
Layout.margins: 10
// Call.
Image {
fillMode: Image.PreserveAspectFit
height: parent.height
source: 'qrc:/imgs/phone.svg'
width: parent.width / 2
}
// Camera.
Image {
fillMode: Image.PreserveAspectFit
height: parent.height
source: 'qrc:/imgs/camera.svg'
width: parent.width / 2
}
}
}
}
...@@ -13,6 +13,7 @@ Rectangle { ...@@ -13,6 +13,7 @@ Rectangle {
spacing: 10 spacing: 10
Image { Image {
fillMode: Image.PreserveAspectFit
height: parent.height height: parent.height
width: 30 width: 30
} }
...@@ -26,6 +27,7 @@ Rectangle { ...@@ -26,6 +27,7 @@ Rectangle {
} }
Image { Image {
fillMode: Image.PreserveAspectFit
height: parent.height height: parent.height
} }
} }
......
...@@ -2,12 +2,13 @@ import QtGraphicalEffects 1.0 ...@@ -2,12 +2,13 @@ import QtGraphicalEffects 1.0
import QtQuick 2.7 import QtQuick 2.7
import QtQuick.Controls 2.0 import QtQuick.Controls 2.0
import 'qrc:/ui/components/misc' import 'qrc:/ui/components/contact'
import 'qrc:/ui/components/form'
// TODO: Contacts list. // TODO: Contacts list.
Item { Item {
function setPopupVisibility (visibility) { function setPopupVisibility (visibility) {
popup.visible = popupShadow.visible = visibility popup.visible = true
} }
function filterContacts (text) { function filterContacts (text) {
...@@ -92,9 +93,22 @@ Item { ...@@ -92,9 +93,22 @@ Item {
} }
delegate: Contact { delegate: Contact {
presence: $presence
sipAddress: $sipAddress sipAddress: $sipAddress
username: $username username: $username
width: parent.width width: parent.width
actions: [
ActionButton {
icon: 'call'
onClicked: console.log('clicked')
},
ActionButton {
icon: 'cam'
onClicked: console.log('cam clicked')
}
]
} }
} }
} }
......
...@@ -48,40 +48,34 @@ ColumnLayout { ...@@ -48,40 +48,34 @@ ColumnLayout {
height: parent.height * 0.40 height: parent.height * 0.40
width: parent.width width: parent.width
Row { ActionBar {
height: parent.height iconSize: 32
spacing: 10
width: parent.width / 2 width: parent.width / 2
Rectangle { ActionButton {
color: 'blue' icon: 'cam'
width: 32 onClicked: console.log('clicked!!!')
height: 32
} }
Rectangle { ActionButton {
color: 'red' icon: 'call'
width: 32 onClicked: console.log('clicked!!!')
height: 32
} }
} }
Row { ActionBar {
height: parent.height iconSize: 32
layoutDirection: Qt.RightToLeft layoutDirection: Qt.RightToLeft
spacing: 10
width: parent.width / 2 width: parent.width / 2
Rectangle { ActionButton {
color: 'green' icon: 'delete'
width: 32 onClicked: console.log('clicked!!!')
height: 32
} }
Rectangle { ActionButton {
color: 'orange' icon: 'contact'
width: 32 onClicked: console.log('clicked!!!')
height: 32
} }
} }
} }
......
...@@ -8,6 +8,24 @@ import 'qrc:/ui/components/form' ...@@ -8,6 +8,24 @@ import 'qrc:/ui/components/form'
import 'qrc:/ui/components/misc' import 'qrc:/ui/components/misc'
ApplicationWindow { ApplicationWindow {
function openWindow (name) {
var component = Qt.createComponent('qrc:/ui/views/' + name + '.qml');
if (component.status !== Component.Ready) {
console.debug('Window not ready.')
if(component.status === Component.Error) {
console.debug('Error:' + component.errorString())
}
} else {
component.createObject(mainWindow).show()
}
}
id: mainWindow
minimumHeight: 70
minimumWidth: 780
title: 'Linphone'
visible: true
header: ToolBar { header: ToolBar {
background: Rectangle { background: Rectangle {
color: '#EAEAEA' color: '#EAEAEA'
...@@ -24,7 +42,6 @@ ApplicationWindow { ...@@ -24,7 +42,6 @@ ApplicationWindow {
Collapse { Collapse {
Layout.preferredWidth: 25 Layout.preferredWidth: 25
Layout.fillHeight: parent.height Layout.fillHeight: parent.height
image: 'qrc:/imgs/collapse.svg'
onCollapsed: { onCollapsed: {
mainWindow.height = collapsed ? 500 : 70 mainWindow.height = collapsed ? 500 : 70
} }
...@@ -39,18 +56,12 @@ ApplicationWindow { ...@@ -39,18 +56,12 @@ ApplicationWindow {
} }
// User actions. // User actions.
ToolBarButton { ActionButton {
onClicked: { onClicked: openWindow('manageAccounts')
var component = Qt.createComponent('qrc:/ui/views/manageAccounts.qml');
if (component.status !== Component.Ready) {
console.debug('Window not ready.')
if(component.status === Component.Error) {
console.debug('Error:' + component.errorString())
}
} else {
component.createObject(mainWindow).show()
}
} }
ActionButton {
onClicked: openWindow('newCall')
} }
// Search. // Search.
...@@ -68,18 +79,13 @@ ApplicationWindow { ...@@ -68,18 +79,13 @@ ApplicationWindow {
} }
// Start conference. // Start conference.
ToolBarButton { ActionButton {
Layout.fillHeight: parent.height
Layout.preferredWidth: 32 Layout.preferredWidth: 32
image: 'qrc:/imgs/start_conference.svg' Layout.preferredHeight: 32
icon: 'conference'
} }
} }
} }
id: mainWindow
minimumHeight: 70
minimumWidth: 780
title: 'Linphone'
visible: true
RowLayout { RowLayout {
anchors.fill: parent anchors.fill: parent
...@@ -123,7 +129,7 @@ ApplicationWindow { ...@@ -123,7 +129,7 @@ ApplicationWindow {
Loader { Loader {
Layout.fillHeight: true Layout.fillHeight: true
Layout.fillWidth: true Layout.fillWidth: true
source: 'qrc:/ui/views/mainWindow/conversation.qml' source: 'qrc:/ui/views/mainWindow/contacts.qml'
} }
} }
} }
...@@ -17,7 +17,6 @@ DialogPlus { ...@@ -17,7 +17,6 @@ DialogPlus {
} }
Item { Item {
id: listViewContainer
anchors.fill: parent anchors.fill: parent
ListView { ListView {
......
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