MorphoGraphX
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Information.hpp
1 #ifndef INFORMATION_H
2 #define INFORMATION_H
3 
4 #include <Config.hpp>
5 
6 #include <QEvent>
7 #include <QString>
8 #include <QString>
9 #include <QTextStream>
10 
11 class QMainWindow;
12 
13 #define SETSTATUS(msg) \
14  do { \
15  QString __status_msg; \
16  { \
17  QTextStream __status_msgstrm(&__status_msg); \
18  __status_msgstrm << msg; \
19  } \
20  mgx::Information::print(__status_msg); \
21  } while(false)
22 
23 #define DEBUG_OUTPUT(msg) \
24  if(DEBUG) \
25  do { \
26  Information::out << msg; \
27  } while(false)
28 
29 namespace mgx {
30  mgx_EXPORT extern bool DEBUG;
31 
32  namespace Information {
33  mgx_EXPORT extern QTextStream out;
34  mgx_EXPORT extern QTextStream err;
35 
36  struct mgx_EXPORT Event : public QEvent {
37  Event(const QString& msg) : QEvent(QEvent::User), message(msg) {}
38 
39  QString message;
40  };
41 
42  mgx_EXPORT void setMainWindow(QMainWindow* wnd);
43  mgx_EXPORT void setStatus(const QString& text);
44  mgx_EXPORT void print(const QString& text);
45  mgx_EXPORT void print(const std::string text);
46  }
47 }
48 #endif
Definition: Information.hpp:36