| 1914 | } |
| 1915 | |
| 1916 | void NetworkDiagnosticsDialog::initializeLogTail() |
| 1917 | { |
| 1918 | const QString logPath = LogManager::instance().logFilePath(); |
| 1919 | if (m_logPathLabel) { |
| 1920 | m_logPathLabel->setText(QString("Log: %1").arg(logPath)); |
| 1921 | } |
| 1922 | |
| 1923 | m_logFile.close(); |
| 1924 | m_logFile.setFileName(logPath); |
| 1925 | m_logOffset = 0; |
| 1926 | m_logPartialLine.clear(); |
| 1927 | m_logLines.clear(); |
| 1928 | |
| 1929 | if (!reopenLogFile(false)) { |
| 1930 | rebuildLogView(); |
| 1931 | return; |
| 1932 | } |
| 1933 | |
| 1934 | static constexpr qint64 kInitialTailBytes = 128 * 1024; |
| 1935 | const qint64 size = m_logFile.size(); |
| 1936 | if (size > kInitialTailBytes) { |
| 1937 | m_logFile.seek(size - kInitialTailBytes); |
| 1938 | m_logFile.readLine(); |
| 1939 | } |
| 1940 | m_logOffset = m_logFile.pos(); |
| 1941 | appendNewLogData(); |
| 1942 | } |
| 1943 | |
| 1944 | bool NetworkDiagnosticsDialog::reopenLogFile(bool keepExistingLines) |
| 1945 | { |
nothing calls this directly
no test coverage detected