16 #include "boost/shared_ptr.hpp" 21 #include <QTextStream> 32 boost::weak_ptr<Reporter> Reporter::mWeakInstance;
33 boost::shared_ptr<Reporter> Reporter::mPersistentInstance;
55 mWeakInstance = retval;
64 mPersistentInstance = object;
65 object->initializeObject();
75 mPersistentInstance.reset();
78 void Reporter::onEmittedMessage(
Message message)
86 mAudioSource = audioSource;
89 bool Reporter::hasAudioSource()
const 91 return mAudioSource ?
true :
false;
131 Message message(text, messageLevel, timeout);
148 void Reporter::playSound(MESSAGE_LEVEL messageLevel)
150 switch (messageLevel)
168 if(this->hasAudioSource())
169 mAudioSource->playStartSound();
174 if(this->hasAudioSource())
175 mAudioSource->playStopSound();
180 if(this->hasAudioSource())
181 mAudioSource->playCancelSound();
186 if(this->hasAudioSource())
187 mAudioSource->playSuccessSound();
192 if(this->hasAudioSource())
193 mAudioSource->playWarningSound();
198 if(this->hasAudioSource())
199 mAudioSource->playErrorSound();
204 if(this->hasAudioSource())
205 mAudioSource->playScreenShotSound();
210 if(this->hasAudioSource())
211 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.