From 56771159a83d7791994bbf7f3cfed8c1459e2193 Mon Sep 17 00:00:00 2001 From: Grace Karanja Date: Thu, 20 Aug 2015 12:08:59 +0300 Subject: QML UI: Show log correctly Correctly show the log messages. The log window will display all messages emitted by the QML Manager class. Signed-off-by: Grace Karanja --- qt-mobile/Log.qml | 17 +++++++++++++---- qt-mobile/qmlmanager.cpp | 5 +++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/qt-mobile/Log.qml b/qt-mobile/Log.qml index 0bd812f3f..8e660f2c7 100644 --- a/qt-mobile/Log.qml +++ b/qt-mobile/Log.qml @@ -10,19 +10,28 @@ import org.subsurfacedivelog.mobile 1.0 Item { id: logWindow width: parent.width + height: parent.height objectName: "Log" ColumnLayout { width: parent.width + height: parent.height spacing: 8 TopBar { - height: childrenRect.height + id: topBar + anchors.top: parent.top } - TextEdit { - anchors.fill: height - text: manager.logText + Rectangle { + anchors.top: topBar.bottom + Layout.fillHeight: true + Layout.fillWidth: true + Text { + anchors.fill: parent + wrapMode: Text.WrapAnywhere + text: manager.logText + } } } } diff --git a/qt-mobile/qmlmanager.cpp b/qt-mobile/qmlmanager.cpp index da91f96fe..dd038c6e2 100644 --- a/qt-mobile/qmlmanager.cpp +++ b/qt-mobile/qmlmanager.cpp @@ -56,6 +56,7 @@ void QMLManager::savePreferences() void QMLManager::loadDives() { showMessage("Loading dives..."); + appendTextToLog("Loading dives..."); QString url; if (getCloudURL(url)) { showMessage(get_error_string()); @@ -71,8 +72,10 @@ void QMLManager::loadDives() showMessage(get_error_string()); appendTextToLog(get_error_string()); set_filename(fileNamePrt.data(), true); + appendTextToLog(fileNamePrt.data()); } else { showMessage(get_error_string()); + appendTextToLog(get_error_string()); } process_dives(false, false); @@ -148,11 +151,13 @@ QString QMLManager::logText() const void QMLManager::setLogText(const QString &logText) { m_logText = logText; + emit logTextChanged(); } void QMLManager::appendTextToLog(const QString &newText) { m_logText += "\n" + newText; + emit logTextChanged(); } -- cgit v1.2.3-70-g09d2