16 #include "boost/shared_ptr.hpp" 21 #include <QTextStream> 34 boost::weak_ptr<Reporter> Reporter::mWeakInstance;
35 boost::shared_ptr<Reporter> Reporter::mPersistentInstance;
57 mWeakInstance = retval;
66 mPersistentInstance = object;
67 object->initializeObject();
77 mPersistentInstance.reset();
80 void Reporter::onEmittedMessage(
Message message)
88 mAudioSource = audioSource;
91 bool Reporter::hasAudioSource()
const 93 return mAudioSource ?
true :
false;
133 Message message(text, messageLevel, timeout);
150 void Reporter::playSound(MESSAGE_LEVEL messageLevel)
152 switch (messageLevel)
170 if(this->hasAudioSource())
171 mAudioSource->playStartSound();
176 if(this->hasAudioSource())
177 mAudioSource->playStopSound();
182 if(this->hasAudioSource())
183 mAudioSource->playCancelSound();
188 if(this->hasAudioSource())
189 mAudioSource->playSuccessSound();
194 if(this->hasAudioSource())
195 mAudioSource->playWarningSound();
200 if(this->hasAudioSource())
201 mAudioSource->playErrorSound();
206 if(this->hasAudioSource())
207 mAudioSource->playScreenShotSound();
212 if(this->hasAudioSource())
213 mAudioSource->playSampleSound();
void playScreenShotSound()
plays a sound signaling that a screen shot has been taken
void sendVolatile(QString volatile_msg)
Used to output volatile info that changes rapidly, not suited for logging.
QString getPrintableMessage() const
Text containing information appropriate to display.
static void shutdown()
shutdown service, destroy static object if none holds a reference.
static void initialize()
Initialize logging, static object is guaranteed to exist at least until shutdown. ...
void playWarningSound()
automatically called by sendWarning if not muted
void playSuccessSound()
automatically called by sendSuccess if not muted
void sendInfo(QString info)
Used to report normal interesting activity, no sound associated.
boost::shared_ptr< class Reporter > ReporterPtr
boost::shared_ptr< class QThread > mThread
void playErrorSound()
automatically called by sendError if not muted
void sendDebug(QString debug)
Used to output debug info, no sound associated.
void playCancelSound()
plays a sound signaling that something has been canceled
void sendWarning(QString warning)
The program does not need to terminate, but the user might need to do something, default not muted...
void playStartSound()
plays a sound signaling that something has started
void sendSuccess(QString success)
Used to report larger successful operations, default not muted.
boost::shared_ptr< class LogThread > LogThreadPtr
virtual LogThreadPtr createWorker()
void sendError(QString error)
The program (might) need to terminate, default not muted.
void sendRaw(QString raw)
Used to output messages without adding anything to them, can be used as cout when mangling needs to b...
void playStopSound()
plays a sound signaling that something has stopped
static ReporterPtr getInstance()
Returns a reference to the only Reporter that exists.
void sendMessage(QString text, MESSAGE_LEVEL messageLevel=mlDEBUG, int timeout=-1, bool mute=false)
boost::shared_ptr< Audio > AudioPtr
MESSAGE_LEVEL getMessageLevel() const
The category of the message.
void setAudioSource(AudioPtr audioSource)
define sounds to go with the messages.
void playSampleSound()
plays a sound signaling that something has been sampled
Namespace for all CustusX production code.