summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/ContactsView.qml36
-rw-r--r--app/Dialer.qml3
-rw-r--r--app/app.pro2
-rw-r--r--app/main.cpp3
-rwxr-xr-xapp/models/ContactsModel.qml68
-rw-r--r--app/numbertype.h33
6 files changed, 110 insertions, 35 deletions
diff --git a/app/ContactsView.qml b/app/ContactsView.qml
index 2a00cf5..8d37590 100644
--- a/app/ContactsView.qml
+++ b/app/ContactsView.qml
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Qt Company Ltd.
+ * Copyright (C) 2018 Konsulko Group
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,14 +16,27 @@
*/
import QtQuick 2.6
-import QtQuick.Layouts 1.1
+import QtQuick.Layouts 1.3
import QtQuick.Controls 2.0
import AGL.Demo.Controls 1.0
+import NumberType 1.0
import 'models'
Item {
id: root
+ function display_type(type) {
+ if (type == NumberType.Mobile) {
+ return "M"
+ } else if (type == NumberType.Work) {
+ return "W"
+ } else if (type == NumberType.Home) {
+ return "H"
+ } else {
+ return "O"
+ }
+ }
+
signal call(var contact)
signal cancel
@@ -47,11 +61,11 @@ Item {
model: ContactsModel {}
delegate: MouseArea {
width: ListView.view.width
- height: width / 5
+ height: width / 3
RowLayout {
anchors.fill: parent
anchors.leftMargin: 200
- spacing: 20
+ spacing: 100
Image {
source: './images/HMI_ContactScreen_ImageHolder-01.svg'
}
@@ -59,14 +73,18 @@ Item {
Label {
Layout.fillWidth: true
color: '#59FF7F'
- text: model.name
+ font.pixelSize: 50
+ text: name
}
- Label {
- Layout.fillWidth: true
- font.pixelSize: 30
- text: model.number
- }
+ Repeater {
+ model: numbers
+ delegate: Label {
+ Layout.fillWidth: true
+ font.pixelSize: 50
+ text: display_type(type) + ": " + number
+ }
+ }
}
}
onClicked: {
diff --git a/app/Dialer.qml b/app/Dialer.qml
index 0bf51cf..f9c3e27 100644
--- a/app/Dialer.qml
+++ b/app/Dialer.qml
@@ -59,7 +59,8 @@ Item {
signal showContacts
function call(contact) {
name.text = contact.name
- number.text = contact.number
+ var rawNumber = contact.numbers.get(0).number
+ number.text = rawNumber.replace(/-/g, '')
callButton.checked = true
}
diff --git a/app/app.pro b/app/app.pro
index 3bb385a..41b90da 100644
--- a/app/app.pro
+++ b/app/app.pro
@@ -2,7 +2,7 @@ TARGET = phone
QT = quickcontrols2 websockets multimedia
SOURCES = main.cpp phone.cpp
-HEADERS = phone.h
+HEADERS = phone.h numbertype.h
SUBDIRS = telephony-binding
diff --git a/app/main.cpp b/app/main.cpp
index 6fd0e9a..ea6c8b5 100644
--- a/app/main.cpp
+++ b/app/main.cpp
@@ -28,6 +28,7 @@
#include <telephony.h>
#include "phone.h"
+#include "numbertype.h"
int main(int argc, char *argv[])
{
@@ -98,6 +99,8 @@ int main(int argc, char *argv[])
}
});
+ qmlRegisterUncreatableType<NumberType>("NumberType", 1, 0, "NumberType", "Not creatable as it is an enum type");
+
engine.load(QUrl(QStringLiteral("qrc:/Phone.qml")));
QObject *root = engine.rootObjects().first();
QQuickWindow *window = qobject_cast<QQuickWindow *>(root);
diff --git a/app/models/ContactsModel.qml b/app/models/ContactsModel.qml
index f8419ee..f53d2c8 100755
--- a/app/models/ContactsModel.qml
+++ b/app/models/ContactsModel.qml
@@ -1,68 +1,88 @@
/* Copyright (C) 2015, Jaguar Land Rover. All Rights Reserved.
* Copyright (C) 2015, The Qt Company. All Rights Reserved.
+ * Copyright (C) 2018, Konsulko Group
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import QtQml.Models 2.2
+import NumberType 1.0
ListModel {
function findName(number) {
for (var i = 0; i < count; i++) {
- var o = get(i)
- if (o.phone === number || o.mobile === number || o.work === number)
- return o.name
+ var entry = get(i)
+ for (var j = 0; j < entry.numbers.length; j++) {
+ if (entry.numbers[j].number) {
+ return entry.name
+ }
+ }
}
return "Unknown number"
}
ListElement {
name: "Art McGee"
- number: "503-616-4940"
- mobile: "503-715-6618"
- work: "972-256-9732"
+ numbers: [
+ ListElement {number: "503-715-6618"; type: NumberType.Mobile},
+ ListElement {number: "972-256-9732"; type: NumberType.Work},
+ ListElement {number: "503-616-4940"; type: NumberType.Home}
+ ]
}
ListElement {
name: "Dana Jonty"
- number: "503-000-0000"
- mobile: "503-209-3254"
- work: "972-000-0000"
+ numbers: [
+ ListElement {number: "503-209-3254"; type: NumberType.Mobile},
+ ListElement {number: "972-000-0000"; type: NumberType.Work},
+ ListElement {number: "503-000-0000"; type: NumberType.Other}
+ ]
}
ListElement {
name: "Jojo Derick"
- number: "503-000-0000"
- mobile: "503-209-3254"
- work: "972-000-0000"
+ numbers: [
+ ListElement {number: "503-209-3254"; type: NumberType.Mobile},
+ ListElement {number: "972-000-0000"; type: NumberType.Work},
+ ListElement {number: "503-000-0000"; type: NumberType.Other}
+ ]
}
ListElement {
name: "Kelly Johnson"
- number: "503-000-0000"
- mobile: "503-000-0000"
- work: "972-000-0000"
+ numbers: [
+ ListElement {number: "503-000-0000"; type: NumberType.Mobile},
+ ListElement {number: "972-000-0000"; type: NumberType.Work},
+ ListElement {number: "503-000-0000"; type: NumberType.Home}
+ ]
}
ListElement {
name: "Marco Morales"
- number: "503-000-0000"
- mobile: "503-209-3254"
- work: "972-000-0000"
+ numbers: [
+ ListElement {number: "503-209-3254"; type: NumberType.Mobile},
+ ListElement {number: "972-000-0000"; type: NumberType.Work},
+ ListElement {number: "503-000-0000"; type: NumberType.Home}
+ ]
}
ListElement {
name: "Rob Brad"
- number: "503-000-0000"
- mobile: "503-209-3254"
- work: "972-000-0000"
+ numbers: [
+ ListElement {number: "503-209-3254"; type: NumberType.Mobile},
+ ListElement {number: "972-000-0000"; type: NumberType.Work},
+ ListElement {number: "503-000-0000"; type: NumberType.Other}
+ ]
}
ListElement {
name: "Ted Gilbert"
- number: "503-000-0000"
- mobile: "503-209-3254"
- work: "972-000-0000"
+ numbers: [
+ ListElement {number: "503-209-3254"; type: NumberType.Mobile},
+ ListElement {number: "972-000-0000"; type: NumberType.Work},
+ ListElement {number: "503-101-1001"; type: NumberType.Home},
+ ListElement {number: "503-000-0000"; type: NumberType.Other}
+ ]
}
}
diff --git a/app/numbertype.h b/app/numbertype.h
new file mode 100644
index 0000000..3c7e787
--- /dev/null
+++ b/app/numbertype.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2018 Konsulko Group
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <QObject>
+
+class NumberType
+{
+ Q_GADGET
+ public:
+ enum Value {
+ Mobile,
+ Work,
+ Home,
+ Other,
+ };
+ Q_ENUM(Value)
+
+ private:
+ NumberType();
+};