diff options
Diffstat (limited to 'src/debugging/TSLogger.cpp')
-rwxr-xr-x | src/debugging/TSLogger.cpp | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/src/debugging/TSLogger.cpp b/src/debugging/TSLogger.cpp index a13113e..b0f280a 100755 --- a/src/debugging/TSLogger.cpp +++ b/src/debugging/TSLogger.cpp @@ -22,13 +22,13 @@ #include "SettingsPaths.h" -#include <tqdatetime.h> -#include <tqfile.h> -#include <tqfileinfo.h> -#include <tqurl.h> -#include <tqtextstream.h> +#include <tntqdatetime.h> +#include <tntqfile.h> +#include <tntqfileinfo.h> +#include <tntqurl.h> +#include <tntqtextstream.h> #include <tqdesktopservices.h> -#include <tqmessagebox.h> +#include <tntqmessagebox.h> #include <ctime> @@ -65,9 +65,9 @@ TSLogger* TSLogger::getInstance(int verboseLevel) { */ TSLogger* TSLogger::getInstance() { #ifdef _DEBUG - return TSLogger::getInstance(QtDebugMsg); + return TSLogger::getInstance(TQtDebugMsg); #else - return TSLogger::getInstance(QtWarningMsg); + return TSLogger::getInstance(TQtWarningMsg); #endif } @@ -76,13 +76,13 @@ TSLogger* TSLogger::getInstance() { \brief Initializes the dialog and sets the path to the log file in the systems temporary directory. Sets the default verbose level to warning level. */ -TSLogger::TSLogger(int verboseLevel) : QDialog() { +TSLogger::TSLogger(int verboseLevel) : TQDialog() { _TSLoggerDialogForm = new Ui::TSLoggerDialog(); _TSLoggerDialogForm->setupUi(this); #ifdef _DEBUG - _verboseLevel = QtDebugMsg; + _verboseLevel = TQtDebugMsg; #else - _verboseLevel = QtMsgType(verboseLevel); + _verboseLevel = TQtMsgType(verboseLevel); #endif _logFileInitState = NOTINITIALZED; @@ -90,7 +90,7 @@ TSLogger::TSLogger(int verboseLevel) : QDialog() { connect( _TSLoggerDialogForm->openLogFileFolderToolButton, SIGNAL(clicked()), this, SLOT(openLogFileFolder()) ); // Make the main application not to wait for the logging window to close. - setAttribute(Qt::WA_QuitOnClose, false); + setAttribute(TQt::WA_QuitOnClose, false); } @@ -99,15 +99,15 @@ TSLogger::TSLogger(int verboseLevel) : QDialog() { Only messages whos \a type have a higher priority than the set verbose level are logged. */ -void TSLogger::messageHandler(QtMsgType type, const char *msg) { +void TSLogger::messageHandler(TQtMsgType type, const char *msg) { if ( _instance == NULL ) _instance = TSLogger::getInstance(); /* - QMessageBox messageBox; - QString messageBoxText = QString::fromUtf8( msg ); + TQMessageBox messageBox; + TQString messageBoxText = TQString::fromUtf8( msg ); messageBox.setText( messageBoxText ); - messageBox.setWindowModality( Qt::ApplicationModal ); + messageBox.setWindowModality( TQt::ApplicationModal ); messageBox.exec(); */ @@ -116,22 +116,22 @@ void TSLogger::messageHandler(QtMsgType type, const char *msg) { return; // Init log message with prepended date and time. - QString message = QDateTime::currentDateTime().toString(); + TQString message = TQDateTime::currentDateTime().toString(); - // Depending on the QtMsgType prepend a different colored Debug, Warning, Critical or Fatal. + // Depending on the TQtMsgType prepend a different colored Debug, Warning, Critical or Fatal. switch (type) { - case QtDebugMsg : + case TQtDebugMsg : message += " <span style=\"font-weight:bold; color:black;\">Debug:</span> "; break; - case QtWarningMsg : + case TQtWarningMsg : message += " <span style=\"font-weight:bold; color:gold;\">Warning:</span> "; break; - case QtCriticalMsg : + case TQtCriticalMsg : message += "<span style=\"font-weight:bold; color:red;\">Critical:</span> "; break; - case QtFatalMsg : + case TQtFatalMsg : message += " <span style=\"font-weight:bold; color:#D60000;\">Fatal:</span> "; - // This one is no Qt message type, but can be used to send info messages to the log + // This one is no TQt message type, but can be used to send info messages to the log // by calling TSLogger::messageHandler() directly. case TSLoggerInfoMsg : message += " <span style=\"font-weight:bold; color:darkgray;\">Info:</span> "; @@ -139,7 +139,7 @@ void TSLogger::messageHandler(QtMsgType type, const char *msg) { } // Append the to UTF-8 back converted message parameter. - message += QString::fromUtf8( msg ) + "<br/>\n"; + message += TQString::fromUtf8( msg ) + "<br/>\n"; // Write the message to the log windows text edit. _instance->_TSLoggerDialogForm->logTextEdit->append( message ); @@ -148,7 +148,7 @@ void TSLogger::messageHandler(QtMsgType type, const char *msg) { _instance->writeToLogFile( message ); // In case of a fatal error abort the application. - if ( type == QtFatalMsg ) + if ( type == TQtFatalMsg ) abort(); } @@ -159,11 +159,11 @@ void TSLogger::messageHandler(QtMsgType type, const char *msg) { */ void TSLogger::setVerboseLevel(int level) { if ( level < 0 ) - _verboseLevel = QtDebugMsg; + _verboseLevel = TQtDebugMsg; if ( level > 3 ) - _verboseLevel = QtFatalMsg; + _verboseLevel = TQtFatalMsg; else - _verboseLevel = QtMsgType(level); + _verboseLevel = TQtMsgType(level); } @@ -182,29 +182,29 @@ void TSLogger::deleteInstance() { \brief Opens the folder that contains the created log file with the name "UiGUI_log.html". */ void TSLogger::openLogFileFolder() { - QDesktopServices::openUrl( QFileInfo( _logFile ).absolutePath() ); + TQDesktopServices::openUrl( TQFileInfo( _logFile ).absolutePath() ); } /*! \brief Writes the \a message to the used log file. */ -void TSLogger::writeToLogFile(const QString &message) { +void TSLogger::writeToLogFile(const TQString &message) { // If the file where all logging messages should go to isn't initilized yet, do that now. if ( _logFileInitState == NOTINITIALZED ) { _logFileInitState = INITIALIZING; - // On different systems it may be that "QDir::tempPath()" ends with a "/" or not. So check this. + // On different systems it may be that "TQDir::tempPath()" ends with a "/" or not. So check this. // Remove any trailing slashes. - QString tempPath = QFileInfo( SettingsPaths::getTempPath() ).absolutePath(); + TQString tempPath = TQFileInfo( SettingsPaths::getTempPath() ).absolutePath(); while ( tempPath.right(1) == "/" ) { tempPath.chop(1); } // To make the temporary log file invulnerable against file symbolic link hacks // append the current date and time up to milliseconds to its name and a random character. - QString logFileName = "UiGUI_log_" + QDateTime::currentDateTime().toString("yyyyMMdd"); - logFileName += "-" + QDateTime::currentDateTime().toString("hhmmsszzz"); + TQString logFileName = "UiGUI_log_" + TQDateTime::currentDateTime().toString("yyyyMMdd"); + logFileName += "-" + TQDateTime::currentDateTime().toString("hhmmsszzz"); // By random decide whether to append a number or an upper or lower case character. qsrand( time(NULL) ); unsigned char randomChar; @@ -222,7 +222,7 @@ void TSLogger::writeToLogFile(const QString &message) { randomChar = qrand() % 26 + 'a'; break; } - logFileName += "_" + QString(randomChar) + ".html"; + logFileName += "_" + TQString(randomChar) + ".html"; _logFile.setFileName( tempPath + "/" + logFileName ); @@ -238,8 +238,8 @@ void TSLogger::writeToLogFile(const QString &message) { // If the logging file is initialzed, write all messages contained in the message queue into the file. if ( _logFileInitState == INITIALZED ) { // Write/append the log message to the log file. - if ( _logFile.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append) ) { - QTextStream out(&_logFile); + if ( _logFile.open(TQIODevice::WriteOnly | TQIODevice::Text | TQIODevice::Append) ) { + TQTextStream out(&_logFile); while ( !_messageQueue.isEmpty() ) { out << _messageQueue.takeFirst() << "\n"; |