Closed wnear closed 4 years ago
The log message engine is a mess...
I'm open to proposals ;-)
Some ideas:
You must be talking about class TextMessageBrocker and the stopbutton of ConsoleInterceptor.
Seen as a MVC , logview is the view, ConsoleInterceptor is the controller, TextMessageBrocker serve as a model feeding data to console.
Is an interface to ChildProcess necessary? the only connection between the logview and process is a stop button to stop the process generating the log.
The log message engine is a mess...
I'm open to proposals ;-)
Some ideas:
* Remove ConsoleInterceptor and change interface to singleton pub-sub engine: * Create a IConsoleInterface and wrap logview with this implementation. Extend ChildProcess to contains a reference to IConsoleInterface. IConsoleInterface can provide a list of filters. May be provide a default IConsoleInterface to ChildProcess classes (the default log viewer) * Some others?
TextMessageBrocker is my experiment to do this but I have not happy with the result... Specially with the usage of strings as keys...
The ChildProcess is a wrapper for QProcess to have more control over the creation of process. Ideally, this class can be catch the output and redirect to logview... But at this moment only ProcessManager handle this approach (in uggly manner using inner QProcess children tree)
In the past few weeks, I haven't had the time I would like to dedicate to a serious refactoring of this ;-)
Really, the log subsystem need a big-clean
Looking forward to it.
ChildProcess behaves like the std::cout 's << operator, most member functions return the instance reference so that multi operations can be compressed into one, very creative.
From the Qt doc, about QObject::QObject(QObject *parent = nullptr)
The parent of an object may be viewed as the object's owner. The destructor of a parent object destroys all child objects.
So setting parent for QObject-based class instance is for memory management.
ConsoleInterceptor direct msg to logview, acting like a decorator to logview. While parent is used to manage the ralationships between QWidgets, and logview has one.
btw. there is a typo in the code, knowed should be known.