swift
loghistory.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2020 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #ifndef SWIFT_MISC_LOGHISTORY_H
7 #define SWIFT_MISC_LOGHISTORY_H
8 
9 #include <QObject>
10 
11 #include "misc/logpattern.h"
16 #include "misc/statusmessagelist.h"
17 
18 namespace swift::misc
19 {
23  class SWIFT_MISC_EXPORT CLogHistory : public shared_state::CListJournal<CStatusMessageList>
24  {
25  Q_OBJECT
26  SWIFT_SHARED_STATE_CHANNEL("swift.log.history")
27 
28  public:
30  CLogHistory(QObject *parent = nullptr);
31  };
32 
37  {
38  Q_OBJECT
39  SWIFT_SHARED_STATE_CHANNEL("swift.log.history")
40 
41  public:
43  CLogHistorySource(QObject *parent = nullptr);
44  };
45 
49  class SWIFT_MISC_EXPORT CLogHistoryReplica : public shared_state::CListObserver<CStatusMessageList, CLogPattern>
50  {
51  Q_OBJECT
52  SWIFT_SHARED_STATE_CHANNEL("swift.log.history")
53 
54  public:
56  CLogHistoryReplica(QObject *parent = nullptr);
57 
58  signals:
61 
64 
65  private:
66  void onElementAdded(const CStatusMessage &msg) final;
67  void onElementsReplaced(const CStatusMessageList &msgs) final;
68  };
69 } // namespace swift::misc
70 
71 #endif // SWIFT_MISC_LOGHISTORY_H
Records all log messages to a list that persists for the lifetime of the application.
Definition: loghistory.h:24
Allows distributed access to the log messages of a central CLogHistory.
Definition: loghistory.h:50
void elementAdded(const swift::misc::CStatusMessage &msg)
Signal emitted for each new log message.
void elementsReplaced(const swift::misc::CStatusMessageList &msgs)
Signal emitted when the whole history is updated wholesale.
Allows distributed insertion of log messages into a central CLogHistory.
Definition: loghistory.h:37
Streamable status message, e.g.
Status messages, e.g. from Core -> GUI.
Base class for an object that shares state with a corresponding CListObserver subclass object.
Definition: listjournal.h:53
Base class for an object that shares state with a corresponding CListObserver subclass object.
Definition: listmutator.h:50
Base class for an object that shares state with a corresponding CListMutator subclass object.
Definition: listobserver.h:63
#define SWIFT_SHARED_STATE_CHANNEL(ID)
Put this macro in the private section of a class to set the channel of its child endpoints.
Definition: datalink.h:27
Free functions in swift::misc.
#define SWIFT_MISC_EXPORT
Export a class or function from the library.