Merge PR #536: Inlude also the previous runs logs in the applogcontroller

This commit is contained in:
Jenkins nymea 2021-02-19 00:40:13 +01:00
commit f3f4efe3bd

View File

@ -69,6 +69,16 @@ AppLogController::AppLogController(QObject *parent) : QAbstractListModel(parent)
QFile::remove(fileName + ".old");
}
QFile::rename(fileName, fileName + ".old");
QFile oldFile(fileName + ".old");
if (oldFile.open(QFile::ReadOnly)) {
m_buffer.append(QString(oldFile.readAll()).split('\n'));
for (int i = 0; i < m_buffer.count(); i++) {
m_types.append(TypeInfo);
}
m_types.append(TypeWarning);
m_buffer.append("**** App restart ****");
oldFile.close();
}
}
QDir dir(path);
if (!dir.exists()) {