UniversalIndentGUI 1.2.0
TSLogger.h
Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2006-2012 by Thomas Schweitzer                          *
00003  *   thomas-schweitzer(at)arcor.de                                         *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License version 2.0 as   *
00007  *   published by the Free Software Foundation.                            *
00008  *                                                                         *
00009  *   This program is distributed in the hope that it will be useful,       *
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00012  *   GNU General Public License for more details.                          *
00013  *                                                                         *
00014  *   You should have received a copy of the GNU General Public License     *
00015  *   along with this program in the file LICENSE.GPL; if not, write to the *
00016  *   Free Software Foundation, Inc.,                                       *
00017  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00018  ***************************************************************************/
00019 
00020 #ifndef TSLogger_H
00021 #define TSLogger_H
00022 
00023 #include <QDialog>
00024 #include <QFile>
00025 
00026 namespace Ui {
00027     class TSLoggerDialog;
00028 }
00029 
00030 namespace tschweitzer { namespace debugging {
00031 
00032 #define TSLoggerInfoMsg QtMsgType(4)
00033 
00034 class TSLogger : public QDialog
00035 {
00036     Q_OBJECT
00037 
00038 public:
00039     static TSLogger* getInstance(int verboseLevel);
00040     static TSLogger* getInstance();
00041     static void messageHandler(QtMsgType type, const char *msg);
00042     static void deleteInstance();
00043     void setVerboseLevel(int level);
00044 
00045 private slots:
00046     void openLogFileFolder();
00047 
00048 private:
00049     Ui::TSLoggerDialog *_TSLoggerDialogForm;
00050 
00051     enum LogFileInitState { NOTINITIALZED, INITIALIZING, INITIALZED } _logFileInitState;
00052     TSLogger(int verboseLevel);
00053     void writeToLogFile(const QString &message);
00054 
00055     static TSLogger* _instance;
00056     QtMsgType _verboseLevel;
00057     QFile _logFile;
00058     QStringList _messageQueue;
00059 };
00060 
00061 }} // namespace tschweitzer::debugging
00062 
00063 #endif // TSLogger_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines