Issue #15 Classes for sharing the history of log messages

This commit is contained in:
Mat Sutcliffe
2020-04-15 18:18:43 +01:00
parent 151810d6fc
commit 7382564633
7 changed files with 144 additions and 1 deletions

View File

@@ -0,0 +1,41 @@
/* Copyright (C) 2020
* swift Project Community / Contributors
*
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution. No part of swift project, including this file, may be copied, modified, propagated,
* or distributed except according to the terms contained in the LICENSE file.
*/
//! \file
#include "blackmisc/loghistory.h"
#include "blackmisc/loghandler.h"
namespace BlackMisc
{
CLogHistory::CLogHistory(QObject *parent) : CListJournal(parent)
{
}
CLogHistorySource::CLogHistorySource(QObject *parent) : CListMutator(parent)
{
connect(CLogHandler::instance(), &CLogHandler::localMessageLogged, this, [this](auto&&... args)
{
this->addElement(args...);
});
}
CLogHistoryReplica::CLogHistoryReplica(QObject* parent) : CListObserver(parent)
{
}
void CLogHistoryReplica::onElementAdded(const CStatusMessage &msg)
{
emit elementAdded(msg);
}
void CLogHistoryReplica::onElementsReplaced(const CStatusMessageList &msgs)
{
emit elementsReplaced(msgs);
}
}