37 #include "boost/shared_ptr.hpp"
42 #include <QTextStream>
55 boost::weak_ptr<Reporter> Reporter::mWeakInstance;
56 boost::shared_ptr<Reporter> Reporter::mPersistentInstance;
78 mWeakInstance = retval;
87 mPersistentInstance = object;
88 object->initializeObject();
98 mPersistentInstance.reset();
101 void Reporter::onEmittedMessage(
Message message)
109 mAudioSource = audioSource;
112 bool Reporter::hasAudioSource()
const
114 return mAudioSource ?
true :
false;
154 Message message(text, messageLevel, timeout);
171 void Reporter::playSound(MESSAGE_LEVEL messageLevel)
173 switch (messageLevel)
191 if(this->hasAudioSource())
192 mAudioSource->playStartSound();
197 if(this->hasAudioSource())
198 mAudioSource->playStopSound();
203 if(this->hasAudioSource())
204 mAudioSource->playCancelSound();
209 if(this->hasAudioSource())
210 mAudioSource->playSuccessSound();
215 if(this->hasAudioSource())
216 mAudioSource->playWarningSound();
221 if(this->hasAudioSource())
222 mAudioSource->playErrorSound();
227 if(this->hasAudioSource())
228 mAudioSource->playScreenShotSound();
233 if(this->hasAudioSource())
234 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