From 265965dae2f0542b044607505cea2e67a8962114 Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Mon, 19 Dec 2016 14:18:34 +0100 Subject: [PATCH] fix(app): coding style & log app startup --- tests/src/app/App.cpp | 17 ++++++++++++----- tests/src/components/chat/ChatModel.cpp | 4 ++-- .../contacts/ContactsListProxyModel.hpp | 2 +- tests/ui/modules/Common/Form/ListForm.qml | 4 ++-- tests/ui/modules/Linphone/Chat/Chat.qml | 1 - 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/tests/src/app/App.cpp b/tests/src/app/App.cpp index 23feaf0cc..ab4332c93 100644 --- a/tests/src/app/App.cpp +++ b/tests/src/app/App.cpp @@ -61,6 +61,8 @@ App::App (int &argc, char **argv) : QApplication(argc, argv) { // ------------------------------------------------------------------- void App::initContentApp () { + qInfo() << "Initializing core manager..."; + // Init core. CoreManager::init(); @@ -69,6 +71,7 @@ void App::initContentApp () { addContextProperties(); // Load main view. + qInfo() << "Loading main view..."; m_engine.load(QUrl(QML_VIEW_MAIN_WINDOW)); if (m_engine.rootObjects().isEmpty()) qFatal("Unable to open main window."); @@ -81,6 +84,8 @@ void App::initContentApp () { } void App::registerTypes () { + qInfo() << "Registering types..."; + // Register meta types. qmlRegisterUncreatableType( "Linphone", 1, 0, "Presence", "Presence is uncreatable" @@ -143,14 +148,16 @@ void App::registerTypes () { } void App::addContextProperties () { + qInfo() << "Adding context properties..."; QQmlContext *context = m_engine.rootContext(); - QQmlComponent component(&m_engine, QUrl(QML_VIEW_CALL_WINDOW)); - // Windows. - if (component.isError()) + QQmlComponent component(&m_engine, QUrl(QML_VIEW_CALL_WINDOW)); + if (component.isError()) { qWarning() << component.errors(); - else - context->setContextProperty("CallsWindow", component.create()); + abort(); + } + + context->setContextProperty("CallsWindow", component.create()); m_notifier = new Notifier(); context->setContextProperty("Notifier", m_notifier); diff --git a/tests/src/components/chat/ChatModel.cpp b/tests/src/components/chat/ChatModel.cpp index e277cc8fe..7b31ecfb4 100644 --- a/tests/src/components/chat/ChatModel.cpp +++ b/tests/src/components/chat/ChatModel.cpp @@ -20,7 +20,7 @@ QHash ChatModel::roleNames () const { return roles; } -int ChatModel::rowCount (const QModelIndex&) const { +int ChatModel::rowCount (const QModelIndex &) const { return m_entries.count(); } @@ -40,7 +40,7 @@ QVariant ChatModel::data (const QModelIndex &index, int role) const { return QVariant(); } -bool ChatModel::removeRow (int row, const QModelIndex&) { +bool ChatModel::removeRow (int row, const QModelIndex &) { return removeRows(row, 1); } diff --git a/tests/src/components/contacts/ContactsListProxyModel.hpp b/tests/src/components/contacts/ContactsListProxyModel.hpp index b4c695ece..17705026b 100644 --- a/tests/src/components/contacts/ContactsListProxyModel.hpp +++ b/tests/src/components/contacts/ContactsListProxyModel.hpp @@ -49,7 +49,7 @@ private: // and reused by `lessThan`. mutable QHash m_weights; - bool m_use_connected_filter; + bool m_use_connected_filter = false; static const QRegExp m_search_separators; diff --git a/tests/ui/modules/Common/Form/ListForm.qml b/tests/ui/modules/Common/Form/ListForm.qml index 1565f60e4..677db501e 100644 --- a/tests/ui/modules/Common/Form/ListForm.qml +++ b/tests/ui/modules/Common/Form/ListForm.qml @@ -132,12 +132,12 @@ RowLayout { } padding: ListFormStyle.value.text.padding - visible: values.model.count === 0 // TODO: placeholder click machin + visible: values.model.count === 0 verticalAlignment: Text.AlignVCenter MouseArea { anchors.fill: parent - onClicked: _addValue('') + onClicked: !listForm.readOnly && _addValue('') } } diff --git a/tests/ui/modules/Linphone/Chat/Chat.qml b/tests/ui/modules/Linphone/Chat/Chat.qml index 0683cac59..1ed024cc7 100644 --- a/tests/ui/modules/Linphone/Chat/Chat.qml +++ b/tests/ui/modules/Linphone/Chat/Chat.qml @@ -5,7 +5,6 @@ import QtQuick.Layouts 1.3 import Common 1.0 import Linphone 1.0 import Linphone.Styles 1.0 -import Utils 1.0 // ===================================================================