New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Notification Area - Non-Intrusive notifications #8120
Changes from 1 commit
9d262e2
a3d7205
e48b93f
fb27f61
8c3435d
82d920a
5221004
d54e975
8c5b0e3
b1c2689
c7ce182
3c79ce3
3ef4c71
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -489,7 +489,7 @@ class BaseExport ILogger | |
|
||
/** Used to send a Log message at the given level. | ||
*/ | ||
virtual void SendLog(const std::string& msg, LogStyle level) = 0; | ||
virtual void SendLog(const std::string& notifiername, const std::string& msg, LogStyle level) = 0; | ||
|
||
virtual const char *Name(){return nullptr;} | ||
bool bErr,bMsg,bLog,bWrn; | ||
|
@@ -515,24 +515,32 @@ class BaseExport ILogger | |
*/ | ||
class BaseExport ConsoleSingleton | ||
{ | ||
|
||
public: | ||
static const unsigned int BufferSize = 4024; | ||
// exported functions goes here +++++++++++++++++++++++++++++++++++++++ | ||
/// Prints a Message | ||
virtual void Message ( const char * pMsg, ... ); | ||
void Message ( const char * pMsg, ... ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: Legacy Message/Warning/Error/Log functions stop being virtual. New MessageS/WarningS/ErrorS/LogS counterparts are created, which take an additional notifier parameter (also non-virtual). Both this are then handled via a virtual private interface (NVI pattern) for extension (see MessageV/WarningV/ErrorV/LogV). The Console client user has then the option to emit regular legacy message (not identifying the notifier), or use the new versions identifying the notifier. |
||
/// Prints a warning Message | ||
virtual void Warning ( const char * pMsg, ... ); | ||
void Warning ( const char * pMsg, ... ); | ||
/// Prints a error Message | ||
virtual void Error ( const char * pMsg, ... ); | ||
void Error ( const char * pMsg, ... ); | ||
/// Prints a log Message | ||
virtual void Log ( const char * pMsg, ... ); | ||
void Log ( const char * pMsg, ... ); | ||
|
||
/// Prints a Message with source indication | ||
void MessageS ( const std::string &, const char * pMsg, ... ); | ||
/// Prints a warning Message with source indication | ||
void WarningS ( const std::string &, const char * pMsg, ... ); | ||
/// Prints a error Message with source indication | ||
void ErrorS ( const std::string &, const char * pMsg, ... ); | ||
/// Prints a log Message with source indication | ||
void LogS ( const std::string &, const char * pMsg, ... ); | ||
|
||
// observer processing | ||
void NotifyMessage(const char *sMsg); | ||
void NotifyWarning(const char *sMsg); | ||
void NotifyError (const char *sMsg); | ||
void NotifyLog (const char *sMsg); | ||
void NotifyMessage(const char *sMsg, const std::string & notifiername = ""); | ||
void NotifyWarning(const char *sMsg, const std::string & notifiername = ""); | ||
void NotifyError (const char *sMsg, const std::string & notifiername = ""); | ||
void NotifyLog (const char *sMsg, const std::string & notifiername = ""); | ||
|
||
/// Attaches an Observer to FCConsole | ||
void AttachObserver(ILogger *pcObserver); | ||
|
@@ -603,6 +611,15 @@ class BaseExport ConsoleSingleton | |
// Singleton! | ||
ConsoleSingleton(); | ||
virtual ~ConsoleSingleton(); | ||
|
||
/// Prints a Message with source indication | ||
virtual void MessageV ( const std::string &, const char * pMsg, va_list args ); | ||
/// Prints a warning Message with source indication | ||
virtual void WarningV ( const std::string &, const char * pMsg, va_list args ); | ||
/// Prints a error Message with source indication | ||
virtual void ErrorV ( const std::string &, const char * pMsg, va_list args ); | ||
/// Prints a log Message with source indication | ||
virtual void LogV ( const std::string &, const char * pMsg, va_list args ); | ||
|
||
private: | ||
// singleton | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Notes:
ILogger interface is extended to include a new string "notifiername". This would ultimately enable Console messaging to offer notifier identification, which is specially useful to discern between Documents and Document Objects where an notification may originate, while still allowing other, client defined, identification where the object is neither a Document or a DocumentObject (such as sketch.cpp). In part, this is done to separate the actual error messages and notifier (which could be treated differently by different observers, and may lead to reusing the same message for different observers despite how the handle notifier information) and, in part, to support multi-document projects.
This implies a change in the API. The majority of the rest of the changes in this commit are to deal with this change of API. If there is client code that links against FreeCAD and uses this interface, that client code would need to be adapted too. In those changes, I have not made a decision yet on how to best convey the notifier information.