Fraxinus  18.10
An IGT application
cxReporter.h
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
12 #ifndef CXREPORTER_H_
13 #define CXREPORTER_H_
14 
15 #include "cxResourceExport.h"
16 
17 #include <QMetaType>
18 #include <QObject>
19 #include <QMutex>
20 #include <QDateTime>
21 #include <QFile>
22 #include "boost/shared_ptr.hpp"
23 #include "boost/weak_ptr.hpp"
24 #include "cxDefinitions.h"
25 #include "cxAudio.h"
26 #include <sstream>
27 #include "cxTypeConversions.h"
28 #include "cxLogger.h"
29 #include "cxLogMessage.h"
30 #include "cxLogFileWatcher.h"
31 
32 class QString;
33 class QDomNode;
34 class QDomDocument;
35 class QFile;
36 class QTextStream;
37 
44 namespace cx
45 {
46 typedef boost::shared_ptr<class Reporter> ReporterPtr;
47 
63 class cxResource_EXPORT Reporter : public Log
64 {
65  Q_OBJECT
66 
67 public:
68  virtual ~Reporter();
69 
70  static void initialize();
71  static void shutdown();
72 
73  static ReporterPtr getInstance();
74 
75  void setAudioSource(AudioPtr audioSource);
76 
77  //Text
78  void sendInfo(QString info);
79  void sendSuccess(QString success);
80  void sendWarning(QString warning);
81  void sendError(QString error);
82  void sendDebug(QString debug);
83  void sendVolatile(QString volatile_msg);
84  void sendRaw(QString raw);
85 
86  void sendMessage(QString text, MESSAGE_LEVEL messageLevel=mlDEBUG, int timeout=-1, bool mute=false);
87  void sendMessage(Message msg);
88 
89  //Audio
90  void playStartSound();
91  void playStopSound();
92  void playCancelSound();
93 
94  void playSuccessSound();
95  void playWarningSound();
96  void playErrorSound();
97 
98  void playScreenShotSound();
99  void playSampleSound();
100 
101 private slots:
102  virtual void onEmittedMessage(Message message);
103 
104 protected:
105  virtual LogThreadPtr createWorker();
106 
107 private:
108  bool hasAudioSource() const;
109  Reporter();
110  Reporter(const Reporter&);
111  Reporter& operator=(const Reporter&);
112 
113  void playSound(MESSAGE_LEVEL messageLevel);
114 
115  AudioPtr mAudioSource;
116 
117 // static Reporter *mTheInstance; // global variable
118  static boost::weak_ptr<Reporter> mWeakInstance; // global variable
119  static boost::shared_ptr<Reporter> mPersistentInstance; // global variable
120 };
121 
124 cxResource_EXPORT ReporterPtr reporter();
125 
126 
127 } //namespace cx
128 
134 #endif /* CXREPORTER_H_ */
ReporterPtr reporter()
Definition: cxReporter.cpp:38
boost::shared_ptr< class Reporter > ReporterPtr
Definition: cxReporter.h:46
mlDEBUG
Definition: cxDefinitions.h:65
Definition: cxLog.h:55
boost::shared_ptr< class LogThread > LogThreadPtr
Definition: cxLog.h:46
boost::shared_ptr< Audio > AudioPtr
Definition: cxAudio.h:47
Namespace for all CustusX production code.