Commit 87059fa3 authored by Ronan's avatar Ronan
Browse files

unstable

parent 0ce9a5d5
......@@ -29,6 +29,7 @@ set(CUSTOM_FLAGS "\
-Wunused \
")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CUSTOM_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DQT_QML_DEBUG")
# --------------------------------------------------------------------
# Define packages, libs, sources, headers, resources and languages
......
......@@ -22,10 +22,5 @@ QImage AvatarProvider::requestImage (
QSize *,
const QSize &
) {
QImage image(m_avatars_path + id);
if (image.isNull())
qWarning() << QStringLiteral("Unable to load: `%1`.").arg(id);
return image;
return QImage(m_avatars_path + id);
}
......@@ -17,6 +17,11 @@ using namespace std;
// ===================================================================
ContactModel::ContactModel (shared_ptr<linphone::Friend> linphone_friend) {
linphone_friend->setData("contact-model", *this);
m_linphone_friend = linphone_friend;
}
Presence::PresenceStatus ContactModel::getPresenceStatus () const {
return m_presence_status;
}
......@@ -118,6 +123,19 @@ bool ContactModel::setAvatar (const QString &path) {
return true;
}
QVariantList ContactModel::getSipAddresses () const {
QVariantList list;
for (const auto &address : m_linphone_friend->getAddresses())
list.append(Utils::linphoneStringToQString(address->asString()));
return list;
}
void ContactModel::setSipAddresses (const QVariantList &sip_addresses) {
}
QString ContactModel::getSipAddress () const {
return Utils::linphoneStringToQString(
m_linphone_friend->getAddress()->asString()
......
......@@ -28,6 +28,13 @@ class ContactModel : public QObject {
NOTIFY contactUpdated
);
Q_PROPERTY(
QVariantList sipAddresses
READ getSipAddresses
WRITE setSipAddresses
NOTIFY contactUpdated
);
Q_PROPERTY(
Presence::PresenceStatus presenceStatus
READ getPresenceStatus
......@@ -47,10 +54,7 @@ class ContactModel : public QObject {
);
public:
ContactModel (std::shared_ptr<linphone::Friend> linphone_friend) {
linphone_friend->setData("contact-model", *this);
m_linphone_friend = linphone_friend;
}
ContactModel (std::shared_ptr<linphone::Friend> linphone_friend);
signals:
void contactUpdated ();
......@@ -62,6 +66,9 @@ private:
QString getAvatar () const;
bool setAvatar (const QString &path);
QVariantList getSipAddresses () const;
void setSipAddresses (const QVariantList &sip_addresses);
Presence::PresenceStatus getPresenceStatus () const;
Presence::PresenceLevel getPresenceLevel () const;
......
......@@ -3,20 +3,19 @@ import QtQuick.Layouts 1.3
import Common 1.0
import Common.Styles 1.0
import Utils 1.0
// ===================================================================
RowLayout {
id: listForm
property alias model: values.model
property alias placeholder: placeholder.text
property alias title: text.text
// -----------------------------------------------------------------
function _addValue (value) {
model.append({ $value: value })
values.model.append({ $value: value })
if (value.length === 0) {
addButton.enabled = false
......@@ -25,9 +24,11 @@ RowLayout {
function _handleEditionFinished (index, text) {
if (text.length === 0) {
model.remove(index)
console.log('edition end')
values.model.remove(index)
} else {
model.set(index, { $value: text })
console.log('edition end (text exists)')
values.model.set(index, { $value: text })
}
addButton.enabled = true
......@@ -85,8 +86,11 @@ RowLayout {
pointSize: ListFormStyle.value.placeholder.fontSize
}
padding: ListFormStyle.value.text.padding
visible: model.count === 0
padding: ListFormStyle.value.text.padding
visible: {
console.log('placeholder', values.model.count)
return values.model.count === 0
}
verticalAlignment: Text.AlignVCenter
}
......@@ -100,7 +104,10 @@ RowLayout {
Layout.fillWidth: true
Layout.preferredHeight: count * ListFormStyle.lineHeight
interactive: false
visible: count > 0
visible: {
console.log('values', model.count)
return model.count > 0
}
delegate: Item {
implicitHeight: textEdit.height
......@@ -143,9 +150,14 @@ RowLayout {
Component.onCompleted: {
if ($value.length === 0) {
textEdit.forceActiveFocus()
textEdit.forceActiveFocus()
}
}
}
model: ListModel {
ListElement { $value: 'merinos@sip.linphone.org' }
ListElement { $value: 'elisabeth.pro@sip.linphone.org' }
}
}
}
......@@ -137,52 +137,39 @@ ColumnLayout {
Flickable {
Layout.fillHeight: true
Layout.fillWidth: true
Layout.topMargin: 40
ScrollBar.vertical: ForceScrollBar {}
boundsBehavior: Flickable.StopAtBounds
clip: true
contentHeight: infoList.height
flickableDirection: Flickable.VerticalFlick
leftMargin: 40
rightMargin: 40
topMargin: 40
ColumnLayout {
id: infoList
anchors.left: parent.left
anchors.margins: 40
anchors.right: parent.right
id: infoList
ListForm {
title: qsTr('sipAccounts')
model: ListModel {
ListElement { $value: 'merinos@sip.linphone.org' }
ListElement { $value: 'elisabeth.pro@sip.linphone.org' }
}
placeholder: qsTr('sipAccountsInput')
}
ListForm {
title: qsTr('address')
model: ListModel {
ListElement { $value: '312 East 10th Street - New York, NY 1009' }
}
placeholder: qsTr('addressInput')
}
ListForm {
title: qsTr('emails')
model: ListModel {
ListElement { $value: 'e.meri@gmail.com' }
ListElement { $value: 'toto@truc.machin' }
}
placeholder: qsTr('emailsInput')
}
ListForm {
title: qsTr('webSites')
model: ListModel {
ListElement { $value: 'www.totogro.com' }
ListElement { $value: 'www.404.unknown' }
}
placeholder: qsTr('webSitesInput')
}
}
......
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