mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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 <gracie.karanja89@gmail.com>
This commit is contained in:
parent
cd28082c39
commit
56771159a8
2 changed files with 18 additions and 4 deletions
|
@ -10,19 +10,28 @@ import org.subsurfacedivelog.mobile 1.0
|
||||||
Item {
|
Item {
|
||||||
id: logWindow
|
id: logWindow
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
height: parent.height
|
||||||
objectName: "Log"
|
objectName: "Log"
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
height: parent.height
|
||||||
spacing: 8
|
spacing: 8
|
||||||
|
|
||||||
TopBar {
|
TopBar {
|
||||||
height: childrenRect.height
|
id: topBar
|
||||||
|
anchors.top: parent.top
|
||||||
}
|
}
|
||||||
|
|
||||||
TextEdit {
|
Rectangle {
|
||||||
anchors.fill: height
|
anchors.top: topBar.bottom
|
||||||
text: manager.logText
|
Layout.fillHeight: true
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Text {
|
||||||
|
anchors.fill: parent
|
||||||
|
wrapMode: Text.WrapAnywhere
|
||||||
|
text: manager.logText
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,7 @@ void QMLManager::savePreferences()
|
||||||
void QMLManager::loadDives()
|
void QMLManager::loadDives()
|
||||||
{
|
{
|
||||||
showMessage("Loading dives...");
|
showMessage("Loading dives...");
|
||||||
|
appendTextToLog("Loading dives...");
|
||||||
QString url;
|
QString url;
|
||||||
if (getCloudURL(url)) {
|
if (getCloudURL(url)) {
|
||||||
showMessage(get_error_string());
|
showMessage(get_error_string());
|
||||||
|
@ -71,8 +72,10 @@ void QMLManager::loadDives()
|
||||||
showMessage(get_error_string());
|
showMessage(get_error_string());
|
||||||
appendTextToLog(get_error_string());
|
appendTextToLog(get_error_string());
|
||||||
set_filename(fileNamePrt.data(), true);
|
set_filename(fileNamePrt.data(), true);
|
||||||
|
appendTextToLog(fileNamePrt.data());
|
||||||
} else {
|
} else {
|
||||||
showMessage(get_error_string());
|
showMessage(get_error_string());
|
||||||
|
appendTextToLog(get_error_string());
|
||||||
}
|
}
|
||||||
process_dives(false, false);
|
process_dives(false, false);
|
||||||
|
|
||||||
|
@ -148,11 +151,13 @@ QString QMLManager::logText() const
|
||||||
void QMLManager::setLogText(const QString &logText)
|
void QMLManager::setLogText(const QString &logText)
|
||||||
{
|
{
|
||||||
m_logText = logText;
|
m_logText = logText;
|
||||||
|
emit logTextChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QMLManager::appendTextToLog(const QString &newText)
|
void QMLManager::appendTextToLog(const QString &newText)
|
||||||
{
|
{
|
||||||
m_logText += "\n" + newText;
|
m_logText += "\n" + newText;
|
||||||
|
emit logTextChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue