diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-03-01 19:09:31 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-03-01 19:09:31 +0000 |
commit | f2cfda2a54780868dfe0af7bd652fcd4906547da (patch) | |
tree | c6ac23545528f5701818424f2af5f79ce3665e6c /src/logger.h | |
download | soundkonverter-f2cfda2a54780868dfe0af7bd652fcd4906547da.tar.gz soundkonverter-f2cfda2a54780868dfe0af7bd652fcd4906547da.zip |
Added KDE3 version of SoundKonverter
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/soundkonverter@1097614 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/logger.h')
-rwxr-xr-x | src/logger.h | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/src/logger.h b/src/logger.h new file mode 100755 index 0000000..c8d0076 --- /dev/null +++ b/src/logger.h @@ -0,0 +1,100 @@ + + +#ifndef LOGGER_H +#define LOGGER_H + +#include <qobject.h> +#include <qstringlist.h> +#include <qdatetime.h> +#include <qfile.h> +#include <qtextstream.h> + + +/** + * @short An item for every process that is logged + * @author Daniel Faust <[email protected]> + * @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 <[email protected]> + * @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<LoggerItem*> getLogs(); + +private: + /** the list of all logger items */ + QValueList<LoggerItem*> 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 |