MorphoGraphX
Information.hpp
1 //
2 // This file is part of MorphoGraphX - http://www.MorphoGraphX.org
3 // Copyright (C) 2012-2015 Richard S. Smith and collaborators.
4 //
5 // If you use MorphoGraphX in your work, please cite:
6 // http://dx.doi.org/10.7554/eLife.05864
7 //
8 // MorphoGraphX is free software, and is licensed under under the terms of the
9 // GNU General (GPL) Public License version 2.0, http://www.gnu.org/licenses.
10 //
11 #ifndef INFORMATION_H
12 #define INFORMATION_H
13 
14 #include <Config.hpp>
15 
16 #include <QEvent>
17 #include <QString>
18 #include <QString>
19 #include <QTextStream>
20 
21 class QMainWindow;
22 
23 #define SETSTATUS(msg) \
24  do { \
25  QString __status_msg; \
26  { \
27  QTextStream __status_msgstrm(&__status_msg); \
28  __status_msgstrm << msg; \
29  } \
30  mgx::Information::print(__status_msg); \
31  } while(false)
32 
33 #define DEBUG_OUTPUT(msg) \
34  if(DEBUG) \
35  do { \
36  Information::out << msg; \
37  } while(false)
38 
39 namespace mgx {
40  mgx_EXPORT extern bool DEBUG;
41 
42  namespace Information {
43  mgx_EXPORT extern QTextStream out;
44  mgx_EXPORT extern QTextStream err;
45 
46  struct mgx_EXPORT Event : public QEvent {
47  Event(const QString& msg) : QEvent(QEvent::User), message(msg) {}
48 
49  QString message;
50  };
51 
52  mgx_EXPORT void setMainWindow(QMainWindow* wnd);
53  mgx_EXPORT void setStatus(const QString& text);
54  mgx_EXPORT void print(const QString& text);
55  mgx_EXPORT void print(const std::string text);
56  }
57 }
58 #endif
Definition: Information.hpp:46
This namespace contains all the API of MorphoGraphX.
Definition: Assert.hpp:26