martinribelotta / embedded-ide

IDE for C embedded development centered on bare-metal ARM systems
http://martinribelotta.github.io/embedded-ide/
GNU General Public License v3.0
155 stars 32 forks source link

ConsoleInterceptor doesn't need parent #40

Closed wnear closed 4 years ago

wnear commented 4 years ago

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.

martinribelotta commented 4 years ago

The log message engine is a mess...

I'm open to proposals ;-)

Some ideas:

wnear commented 4 years ago

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?
martinribelotta commented 4 years ago

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

wnear commented 4 years ago

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.

wnear commented 4 years ago

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.