#ifndef LOGGER_H #define LOGGER_H #include #include #include #include #include /** * @short An item for every process that is logged * @author Daniel Faust * @version 0.3 */ class LoggerItem { public: /** * Constructor */ LoggerItem(); /** * Destructor */ virtual ~LoggerItem(); QString filename; int id; QStringList data; bool completed; int state; // 0 = ok, -1 = failed, 1 = other (soundKonverter) QTime time; QFile file; QTextStream textStream; }; /** * @short All data about the processes are collected here * @author Daniel Faust * @version 0.3 */ class Logger : public QObject { Q_OBJECT public: /** * Constructor */ Logger(); /** * Destructor */ virtual ~Logger(); void cleanUp(); /** * Creates a new logger item and returns the id of it, @p filename is added to the new logger item */ int registerProcess( const QString& filename ); /** * Adds the string @p data to the data of the logger item with id @p id */ void log( int id, const QString& data ); /** * Returns the logger item with id @p id */ LoggerItem* getLog( int id ); /** * Returns a list of all logger items */ QValueList getLogs(); private: /** the list of all logger items */ QValueList processes; /** returns an unused random id */ int getNewID(); public slots: void processCompleted( int id, int state ); signals: void removedProcess( int id ); void updateProcess( int id ); }; #endif // LOGGER_H