summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/debugging/TSLogger.cpp72
-rw-r--r--src/debugging/TSLogger.h12
2 files changed, 42 insertions, 42 deletions
diff --git a/src/debugging/TSLogger.cpp b/src/debugging/TSLogger.cpp
index 2337fc5..c79dacb 100644
--- a/src/debugging/TSLogger.cpp
+++ b/src/debugging/TSLogger.cpp
@@ -35,7 +35,7 @@
using namespace tschweitzer;
using namespace tschweitzer::debugging;
-TSLogger*TSLogger::_instance = NULL;
+TSLogger*TSLogger::m_instance = NULL;
/*!
\class TSLogger
@@ -54,12 +54,12 @@ TSLogger*TSLogger::_instance = NULL;
*/
TSLogger* TSLogger::getInstance(int verboseLevel)
{
- if (_instance == NULL)
+ if (m_instance == NULL)
{
- _instance = new TSLogger(verboseLevel);
+ m_instance = new TSLogger(verboseLevel);
}
- return _instance;
+ return m_instance;
}
/*!
@@ -81,17 +81,17 @@ TSLogger* TSLogger::getInstance()
TSLogger::TSLogger(int verboseLevel) :
TQDialog()
{
- _TSLoggerDialogForm = new Ui::TSLoggerDialog();
- _TSLoggerDialogForm->setupUi(this);
+ m_TSLoggerDialogForm = new Ui::TSLoggerDialog();
+ m_TSLoggerDialogForm->setupUi(this);
#ifdef _DEBUG
- _verboseLevel = TQtDebugMsg;
+ m_verboseLevel = TQtDebugMsg;
#else
- _verboseLevel = TQtMsgType(verboseLevel);
+ m_verboseLevel = TQtMsgType(verboseLevel);
#endif
- _logFileInitState = NOTINITIALZED;
+ m_logFileInitState = NOTINITIALZED;
- connect(_TSLoggerDialogForm->openLogFileFolderToolButton, SIGNAL(clicked()), this,
+ connect(m_TSLoggerDialogForm->openLogFileFolderToolButton, SIGNAL(clicked()), this,
SLOT(openLogFileFolder()));
// Make the main application not to wait for the logging window to close.
@@ -105,9 +105,9 @@ TSLogger::TSLogger(int verboseLevel) :
*/
void TSLogger::messageHandler(TQtMsgType type, const char *msg)
{
- if (_instance == NULL)
+ if (m_instance == NULL)
{
- _instance = TSLogger::getInstance();
+ m_instance = TSLogger::getInstance();
}
/*
@@ -119,7 +119,7 @@ void TSLogger::messageHandler(TQtMsgType type, const char *msg)
*/
// Only log messages that have a higher or equal priority than set with the verbose level.
- if (type < _instance->_verboseLevel)
+ if (type < m_instance->m_verboseLevel)
{
return;
}
@@ -166,10 +166,10 @@ void TSLogger::messageHandler(TQtMsgType type, const char *msg)
message += TQString::fromUtf8(msg) + "<br/>\n";
// Write the message to the log windows text edit.
- _instance->_TSLoggerDialogForm->logTextEdit->append(message);
+ m_instance->m_TSLoggerDialogForm->logTextEdit->append(message);
// Write/append the log message to the log file.
- _instance->writeToLogFile(message);
+ m_instance->writeToLogFile(message);
// In case of a fatal error abort the application.
if (type == TQtFatalMsg)
@@ -186,27 +186,27 @@ void TSLogger::setVerboseLevel(int level)
{
if (level < 0)
{
- _verboseLevel = TQtDebugMsg;
+ m_verboseLevel = TQtDebugMsg;
}
if (level > 3)
{
- _verboseLevel = TQtFatalMsg;
+ m_verboseLevel = TQtFatalMsg;
}
else
{
- _verboseLevel = TQtMsgType(level);
+ m_verboseLevel = TQtMsgType(level);
}
}
/*!
- \brief Deletes the existing _instance of TSLogger.
+ \brief Deletes the existing m_instance of TSLogger.
*/
void TSLogger::deleteInstance()
{
- if (_instance != NULL)
+ if (m_instance != NULL)
{
- delete _instance;
- _instance = NULL;
+ delete m_instance;
+ m_instance = NULL;
}
}
@@ -215,7 +215,7 @@ void TSLogger::deleteInstance()
*/
void TSLogger::openLogFileFolder()
{
- TQDesktopServices::openUrl(TQFileInfo(_logFile).absolutePath());
+ TQDesktopServices::openUrl(TQFileInfo(m_logFile).absolutePath());
}
/*!
@@ -224,9 +224,9 @@ void TSLogger::openLogFileFolder()
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)
+ if (m_logFileInitState == NOTINITIALZED)
{
- _logFileInitState = INITIALIZING;
+ m_logFileInitState = INITIALIZING;
// On different systems it may be that "TQDir::tempPath()" ends with a "/" or not. So check
// this.
@@ -269,33 +269,33 @@ void TSLogger::writeToLogFile(const TQString &message)
}
logFileName += "_" + TQString(randomChar) + ".html";
- _logFile.setFileName(tempPath + "/" + logFileName);
+ m_logFile.setFileName(tempPath + "/" + logFileName);
// Set the tooltip of the open log file folder button to show the unique name of the log file.
- _TSLoggerDialogForm->openLogFileFolderToolButton->setToolTip(
- _TSLoggerDialogForm->openLogFileFolderToolButton->toolTip() + " (" + logFileName + ")");
+ m_TSLoggerDialogForm->openLogFileFolderToolButton->setToolTip(
+ m_TSLoggerDialogForm->openLogFileFolderToolButton->toolTip() + " (" + logFileName + ")");
- _logFileInitState = INITIALZED;
+ m_logFileInitState = INITIALZED;
}
// Add the message to the message queue.
- _messageQueue << message;
+ m_messageQueue << message;
// If the logging file is initialzed, write all messages contained in the message queue into the
// file.
- if (_logFileInitState == INITIALZED)
+ if (m_logFileInitState == INITIALZED)
{
// Write/append the log message to the log file.
- if (_logFile.open(TQIODevice::WriteOnly | TQIODevice::Text | TQIODevice::Append))
+ if (m_logFile.open(TQIODevice::WriteOnly | TQIODevice::Text | TQIODevice::Append))
{
- TQTextStream out(&_logFile);
+ TQTextStream out(&m_logFile);
- while (!_messageQueue.isEmpty())
+ while (!m_messageQueue.isEmpty())
{
- out << _messageQueue.takeFirst() << "\n";
+ out << m_messageQueue.takeFirst() << "\n";
}
- _logFile.close();
+ m_logFile.close();
}
}
}
diff --git a/src/debugging/TSLogger.h b/src/debugging/TSLogger.h
index 5cbe4c9..261398c 100644
--- a/src/debugging/TSLogger.h
+++ b/src/debugging/TSLogger.h
@@ -49,22 +49,22 @@ namespace tschweitzer
void openLogFileFolder();
private:
- Ui::TSLoggerDialog *_TSLoggerDialogForm;
+ Ui::TSLoggerDialog *m_TSLoggerDialogForm;
enum LogFileInitState
{
NOTINITIALZED,
INITIALIZING,
INITIALZED
- } _logFileInitState;
+ } m_logFileInitState;
TSLogger(int verboseLevel);
void writeToLogFile(const TQString &message);
- static TSLogger *_instance;
- TQtMsgType _verboseLevel;
- TQFile _logFile;
- TQStringList _messageQueue;
+ static TSLogger *m_instance;
+ TQtMsgType m_verboseLevel;
+ TQFile m_logFile;
+ TQStringList m_messageQueue;
};
}
} // namespace tschweitzer::debugging