mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-08 21:05:34 +08:00
Issue #15 Classes for sharing the history of log messages
This commit is contained in:
41
src/blackmisc/loghistory.cpp
Normal file
41
src/blackmisc/loghistory.cpp
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user