Emergency 20 Dokumentation  4.2.0
DebugLogBox.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2018 Promotion Software GmbH
2 
3 
4 //[-------------------------------------------------------]
5 //[ Header guard ]
6 //[-------------------------------------------------------]
7 #pragma once
8 
9 
10 //[-------------------------------------------------------]
11 //[ Includes ]
12 //[-------------------------------------------------------]
13 #include <qsf/gui/GuiDocument.h>
14 #include <qsf/job/JobProxy.h>
15 
16 #include <mutex>
17 
18 
19 //[-------------------------------------------------------]
20 //[ Forward declarations ]
21 //[-------------------------------------------------------]
22 namespace qsf
23 {
24  struct LogMessage;
25 }
26 namespace Rocket
27 {
28  namespace Core
29  {
30  class ElementText;
31  }
32 }
33 
34 
35 //[-------------------------------------------------------]
36 //[ Namespace ]
37 //[-------------------------------------------------------]
38 namespace em5
39 {
40 
41 
42  //[-------------------------------------------------------]
43  //[ Classes ]
44  //[-------------------------------------------------------]
50  {
51 
52 
53  //[-------------------------------------------------------]
54  //[ Public methods ]
55  //[-------------------------------------------------------]
56  public:
61  explicit DebugLogBox(qsf::GuiContext& guiContext);
62 
67  virtual ~DebugLogBox();
68 
73  void rebuildGui();
74 
75 
76  //[-------------------------------------------------------]
77  //[ Public virtual qsf::GuiDocument methods ]
78  //[-------------------------------------------------------]
79  public:
80  virtual void processEvent(const std::string& eventKey, Rocket::Core::Event& event) override;
81 
82 
83  //[-------------------------------------------------------]
84  //[ Private virtual qsf::GuiDocument methods ]
85  //[-------------------------------------------------------]
86  private:
87  virtual bool onPreShow() override;
88  virtual void onPreHide() override;
89 
90 
91  //[-------------------------------------------------------]
92  //[ Private methods ]
93  //[-------------------------------------------------------]
94  private:
102  void onNewLogMessage(const qsf::LogMessage& message);
103 
111  void appendLogMessage(const qsf::LogMessage& message);
112 
117  void showLogMessages();
118 
123  void onUpdate(const qsf::JobArguments& arguments);
124 
125  void createOrUpdateLogMessagesAboveEntry();
126 
127 
128  //[-------------------------------------------------------]
129  //[ Private data ]
130  //[-------------------------------------------------------]
131  private:
132  bool mAllowAutoOpen;
133 
134  std::mutex mLogMessagesMutex; //< Mutex to restrict access to mLogMessages
135  std::vector<qsf::LogMessage> mLogMessages; //< Holds a list of new log messages
136 
137  qsf::JobProxy mUpdateJobProxy;
138 
139  Rocket::Core::Element* mMessageContainerElement;
140  Rocket::Core::Element* mMessagesAboveElement;
141  size_t mCurrentMessageAboveCount;
142  size_t mMaxLogMessages; //< How many log message should be shown
143 
144 
145  };
146 
147 
148 //[-------------------------------------------------------]
149 //[ Namespace ]
150 //[-------------------------------------------------------]
151 } // em5
Definition: ActionPriority.h:13
Job proxy class.
Definition: JobProxy.h:51
virtual ~DebugLogBox()
Destructor.
Debug GUI window.
Definition: DebugLogBox.h:49
DebugLogBox(qsf::GuiContext &guiContext)
Constructor.
void rebuildGui()
Perform a GUI rebuild.
Graphical User Interface (GUI) document base class.
Definition: GuiDocument.h:51
Definition: OverlayComponent.h:29
Job arguments class: holds data to be passed to the called job method by the job manager.
Definition: JobArguments.h:40
Definition: PickupPersonByParamedicAction.h:21
Ingame Graphical User Interface (GUI) context class.
Definition: GuiContext.h:62
virtual void processEvent(const std::string &eventKey, Rocket::Core::Event &event) override
Log message.
Definition: LogSystem.h:35