15 #include <QListWidget>
51 static void Init(QListWidget* textDisplay =
nullptr,
54 bool redirectToStdOut =
false);
103 void logMessage(
const QString& message,
int level)
override;
static CVLog * TheInstance()
Returns the static and unique instance.
ecvConsole()
Default constructor.
static QString getLogDirectory()
Get appropriate log directory path (handles permissions on Ubuntu)
QWidget * m_parentWidget
Parent widget.
static void ReleaseInstance(bool flush=true)
Releases unique instance.
QMutex m_mutex
Mutex for concurrent thread access to console.
static void Init(QListWidget *textDisplay=nullptr, QWidget *parentWidget=nullptr, MainWindow *parentWindow=nullptr, bool redirectToStdOut=false)
Inits console (and optionaly associates it with a text output widget)
MainWindow * m_parentWindow
Parent window (if any)
static void EnableQtMessages(bool state)
Whether to show Qt messages (qDebug / qWarning / etc.) in Console.
QPair< QString, int > ConsoleItemType
Queue element type (message + color)
QTextStream * m_logStream
Log file stream.
bool setLogFile(const QString &logPrefix)
Sets log file with prefix (generates timestamped log file like glog)
QTimer m_timer
Timer for auto-refresh.
void refresh()
Refreshes console (display all messages still in queue)
static bool s_showQtMessagesInConsole
Whether to show Qt messages (qDebug / qWarning / etc.) in Console.
static bool QtMessagesEnabled()
~ecvConsole() override
Destructor.
static QString generateLogFileName(const QString &prefix)
Generate log file name with timestamp and pid.
QWidget * parentWidget()
Returns the parent widget (if any)
static bool s_redirectToStdOut
QListWidget * m_textDisplay
Associated text display widget.
void logMessage(const QString &message, int level) override
Generic message logging method.
void setAutoRefresh(bool state)
Sets auto-refresh state.
QVector< ConsoleItemType > m_queue
Queue for incoming messages.