| 169 | } |
| 170 | |
| 171 | void LogsWidget::AddLogs(const int type, const qint64 time, const QString &message) |
| 172 | { |
| 173 | const auto& theme = ConsoleThemeManager::instance().theme(); |
| 174 | |
| 175 | QString sTime = UnixTimestampGlobalToStringLocal(time); |
| 176 | QString logTime = QString("[%1] -> ").arg(sTime); |
| 177 | logsConsoleTextEdit->appendFormatted(logTime, [&](QTextCharFormat& fmt){ fmt = theme.logDebug.toFormat(); }); |
| 178 | |
| 179 | QString logMsg = message + "\n"; |
| 180 | |
| 181 | if( type == EVENT_CLIENT_CONNECT ) logsConsoleTextEdit->appendFormatted(logMsg, [&](QTextCharFormat& fmt){ fmt = theme.operatorConnect.toFormat(); }); |
| 182 | else if( type == EVENT_CLIENT_DISCONNECT ) logsConsoleTextEdit->appendFormatted(logMsg, [&](QTextCharFormat& fmt){ fmt = theme.operatorDisconnect.toFormat(); }); |
| 183 | else if( type == EVENT_LISTENER_START ) logsConsoleTextEdit->appendFormatted(logMsg, [&](QTextCharFormat& fmt){ fmt = theme.listenerStart.toFormat(); }); |
| 184 | else if( type == EVENT_LISTENER_STOP ) logsConsoleTextEdit->appendFormatted(logMsg, [&](QTextCharFormat& fmt){ fmt = theme.listenerStop.toFormat(); }); |
| 185 | else if( type == EVENT_AGENT_NEW ) logsConsoleTextEdit->appendFormatted(logMsg, [&](QTextCharFormat& fmt){ fmt = theme.agentNew.toFormat(); }); |
| 186 | else if( type == EVENT_TUNNEL_START ) logsConsoleTextEdit->appendFormatted(logMsg, [&](QTextCharFormat& fmt){ fmt = theme.tunnel.toFormat(); }); |
| 187 | else if( type == EVENT_TUNNEL_STOP ) logsConsoleTextEdit->appendFormatted(logMsg, [&](QTextCharFormat& fmt){ fmt = theme.tunnel.toFormat(); }); |
| 188 | else logsConsoleTextEdit->appendPlain(logMsg); |
| 189 | } |
| 190 | |
| 191 | void LogsWidget::applyTheme() |
| 192 | { |
no test coverage detected