Commit c709d295 authored by Karel Slaný's avatar Karel Slaný

Made MemoryLog usage obvious in Log constructor.

parent 54f6c9ea
......@@ -21,22 +21,21 @@
* the two.
*/
#include <QByteArray>
#include <QFile>
#include <QList>
#include <QSysInfo>
#include "src/auxiliaries/email_helper.h"
#include "src/datovka_shared/log/global.h"
#include "src/datovka_shared/log/log.h"
#include "src/datovka_shared/log/memory_log.h"
#include "src/dialogues/dialogues.h"
#include "src/log.h"
#include "src/io/filesystem.h"
#include "src/log.h"
Log::Log(QObject *parent)
: QObject(parent)
Log::Log(MemoryLog *memLog, QObject *parent)
: QObject(parent),
m_memLog(memLog)
{
m_memLog = GlobInstcs::logPtr->memoryLog();
if (m_memLog != Q_NULLPTR) {
connect(m_memLog, SIGNAL(logged(quint64)),
this, SLOT(appendNewLog(quint64)));
......@@ -62,7 +61,7 @@ QString Log::loadLogContent(const QString &filePath)
QString log;
if (filePath.isEmpty()) {
if (filePath.isEmpty() && (m_memLog != Q_NULLPTR)) {
const QList<quint64> keys(m_memLog->keys());
foreach (quint64 key, keys) {
log.append(m_memLog->message(key));
......
......@@ -26,7 +26,7 @@
#include <QObject>
#include <QString>
#include "src/datovka_shared/log/memory_log.h"
class MemoryLog; /* Forward declaration. */
/*
* Class Log provides interface between QML and log device.
......@@ -36,13 +36,13 @@ class Log : public QObject {
Q_OBJECT
public:
/*!
* @brief Constructor.
*
* @param[in] memLog Memory log.
* @param[in] parent Parent object.
*/
explicit Log(QObject *parent = Q_NULLPTR);
explicit Log(MemoryLog *memLog, QObject *parent = Q_NULLPTR);
/*!
* @brief Destructor.
......@@ -75,7 +75,6 @@ public:
void sendLogViaEmail(const QString &logContent);
signals:
/*!
* @brief Append new log message to QML log bar.
*
......@@ -84,7 +83,6 @@ signals:
void appendNewLogMessage(QString newLog);
private slots:
/*!
* @brief Appends newly logged message to QML log bar.
*
......@@ -93,6 +91,5 @@ private slots:
void appendNewLog(quint64 key);
private:
MemoryLog *m_memLog; /*!< Pointer to memory log. */
};
......@@ -403,7 +403,7 @@ int main(int argc, char *argv[])
Messages messages;
Accounts accounts;
Files files;
Log log;
Log log(&memLog);
IsdsWrapper isds;
GlobalSettingsQmlWrapper settings;
RecordsManagement recordsManagement;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment