Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
System
KSystemLog
Commits
344bdbd4
Commit
344bdbd4
authored
Jan 09, 2021
by
Laurent Montel
😁
Browse files
Constify
parent
9dbac498
Changes
33
Hide whitespace changes
Inline
Side-by-side
src/lib/logViewWidget.cpp
View file @
344bdbd4
...
...
@@ -106,7 +106,8 @@ void LogViewWidget::setColumns(const LogViewColumns &columns)
// Add new actions
int
columnIndex
=
0
;
foreach
(
const
LogViewColumn
&
column
,
columns
.
columns
())
{
const
auto
columnsLst
=
columns
.
columns
();
for
(
const
LogViewColumn
&
column
:
columnsLst
)
{
auto
*
action
=
new
QAction
(
this
);
action
->
setText
(
column
.
columnName
());
// helloAction->setIcon(QIcon::fromTheme( QLatin1String( "media-playback-start" )));
...
...
@@ -289,7 +290,7 @@ int LogViewWidget::notHiddenItemCount()
int
count
=
0
;
QTreeWidgetItemIterator
it
(
this
,
QTreeWidgetItemIterator
::
NotHidden
);
while
(
*
it
!=
nullptr
)
{
while
(
*
it
)
{
count
++
;
++
it
;
}
...
...
src/lib/processOutputLogFileReader.cpp
View file @
344bdbd4
...
...
@@ -33,14 +33,14 @@
class
ProcessOutputLogFileReaderPrivate
:
public
LogFileReaderPrivate
{
public:
long
p
reviousLinesCount
;
long
mP
reviousLinesCount
;
QTimer
p
rocessUpdater
;
QTimer
mP
rocessUpdater
;
QProcess
*
p
rocess
=
nullptr
;
QProcess
*
mP
rocess
=
nullptr
;
QString
b
uffer
;
QStringList
a
vailableStandardOutput
;
QString
mB
uffer
;
QStringList
mA
vailableStandardOutput
;
};
ProcessOutputLogFileReader
::
ProcessOutputLogFileReader
(
const
LogFile
&
logFile
)
...
...
@@ -65,12 +65,12 @@ void ProcessOutputLogFileReader::init()
Q_D
(
ProcessOutputLogFileReader
);
// Init current file position
d
->
p
reviousLinesCount
=
0
;
d
->
a
vailableStandardOutput
.
clear
();
d
->
p
rocess
=
nullptr
;
d
->
mP
reviousLinesCount
=
0
;
d
->
mA
vailableStandardOutput
.
clear
();
d
->
mP
rocess
=
nullptr
;
d
->
p
rocessUpdater
.
setInterval
(
PROCESS_OUTPUT_UPDATER_INTERVAL
);
connect
(
&
(
d
->
p
rocessUpdater
),
&
QTimer
::
timeout
,
this
,
&
ProcessOutputLogFileReader
::
startProcess
);
d
->
mP
rocessUpdater
.
setInterval
(
PROCESS_OUTPUT_UPDATER_INTERVAL
);
connect
(
&
(
d
->
mP
rocessUpdater
),
&
QTimer
::
timeout
,
this
,
&
ProcessOutputLogFileReader
::
startProcess
);
logDebug
()
<<
"Using process name "
<<
d
->
logFile
.
url
().
toLocalFile
();
}
...
...
@@ -83,16 +83,16 @@ void ProcessOutputLogFileReader::watchFile(bool enable)
logDebug
()
<<
"Monitoring process : "
<<
d
->
logFile
.
url
().
toLocalFile
();
// Reinit current file position
d
->
p
reviousLinesCount
=
0
;
d
->
mP
reviousLinesCount
=
0
;
// Launch the timer
d
->
p
rocessUpdater
.
start
();
d
->
mP
rocessUpdater
.
start
();
// Launch immediately the process updater
startProcess
();
}
else
{
// Stop regularly start process
d
->
p
rocessUpdater
.
stop
();
d
->
mP
rocessUpdater
.
stop
();
}
}
...
...
@@ -110,14 +110,14 @@ void ProcessOutputLogFileReader::startProcess()
logDebug
()
<<
"Starting process..."
;
d
->
p
rocess
=
new
QProcess
();
connect
(
d
->
p
rocess
,
&
QProcess
::
readyReadStandardOutput
,
this
,
&
ProcessOutputLogFileReader
::
logFileModified
);
connect
(
d
->
p
rocess
,
SIGNAL
(
finished
(
int
,
QProcess
::
ExitStatus
)),
this
,
d
->
mP
rocess
=
new
QProcess
();
connect
(
d
->
mP
rocess
,
&
QProcess
::
readyReadStandardOutput
,
this
,
&
ProcessOutputLogFileReader
::
logFileModified
);
connect
(
d
->
mP
rocess
,
SIGNAL
(
finished
(
int
,
QProcess
::
ExitStatus
)),
this
,
SLOT
(
emitProcessOutput
(
int
,
QProcess
::
ExitStatus
)));
d
->
p
rocess
->
start
(
d
->
logFile
.
url
().
toLocalFile
(),
QStringList
(),
QIODevice
::
ReadOnly
|
QIODevice
::
Text
);
d
->
mP
rocess
->
start
(
d
->
logFile
.
url
().
toLocalFile
(),
QStringList
(),
QIODevice
::
ReadOnly
|
QIODevice
::
Text
);
d
->
p
rocess
->
waitForStarted
();
d
->
mP
rocess
->
waitForStarted
();
logDebug
()
<<
"Process started"
;
}
...
...
@@ -129,15 +129,15 @@ void ProcessOutputLogFileReader::closeProcess()
Q_D
(
ProcessOutputLogFileReader
);
// Get the size file for the next calculation
d
->
p
reviousLinesCount
=
d
->
a
vailableStandardOutput
.
count
();
logDebug
()
<<
"New lines count : "
<<
d
->
p
reviousLinesCount
<<
" ("
<<
d
->
logFile
.
url
().
toLocalFile
()
<<
")"
;
d
->
mP
reviousLinesCount
=
d
->
mA
vailableStandardOutput
.
count
();
logDebug
()
<<
"New lines count : "
<<
d
->
mP
reviousLinesCount
<<
" ("
<<
d
->
logFile
.
url
().
toLocalFile
()
<<
")"
;
d
->
a
vailableStandardOutput
.
clear
();
d
->
mA
vailableStandardOutput
.
clear
();
if
(
d
->
p
rocess
)
{
d
->
p
rocess
->
close
();
delete
d
->
p
rocess
;
d
->
p
rocess
=
nullptr
;
if
(
d
->
mP
rocess
)
{
d
->
mP
rocess
->
close
();
delete
d
->
mP
rocess
;
d
->
mP
rocess
=
nullptr
;
}
logDebug
()
<<
"Process closed"
;
...
...
@@ -150,8 +150,8 @@ void ProcessOutputLogFileReader::emitProcessOutput(int /*exitCode*/, QProcess::E
// First commit last lines of the buffer to the line list
emptyBuffer
();
logDebug
()
<<
"Process terminated"
<<
d
->
p
reviousLinesCount
<<
"previously /"
<<
d
->
a
vailableStandardOutput
.
count
()
<<
"currently"
;
logDebug
()
<<
"Process terminated"
<<
d
->
mP
reviousLinesCount
<<
"previously /"
<<
d
->
mA
vailableStandardOutput
.
count
()
<<
"currently"
;
if
(
exitStatus
==
QProcess
::
CrashExit
)
{
QString
message
(
i18n
(
"The process '%1' crashed."
,
d
->
logFile
.
url
().
toLocalFile
()));
...
...
@@ -160,21 +160,21 @@ void ProcessOutputLogFileReader::emitProcessOutput(int /*exitCode*/, QProcess::E
}
// If there is no new lines
if
(
d
->
p
reviousLinesCount
==
d
->
a
vailableStandardOutput
.
count
())
{
if
(
d
->
mP
reviousLinesCount
==
d
->
mA
vailableStandardOutput
.
count
())
{
/*
//Q_EMIT an empty log lines list
Q_EMIT contentChanged(this, false, QStringList());
*/
}
// If there are new lines in the file, insert only them or this is the first time we read this file
else
if
(
d
->
p
reviousLinesCount
!=
0
&&
d
->
p
reviousLinesCount
<=
d
->
a
vailableStandardOutput
.
count
())
{
logDebug
()
<<
"Reading from line "
<<
d
->
p
reviousLinesCount
<<
" ("
<<
d
->
logFile
.
url
().
toLocalFile
()
<<
")"
;
else
if
(
d
->
mP
reviousLinesCount
!=
0
&&
d
->
mP
reviousLinesCount
<=
d
->
mA
vailableStandardOutput
.
count
())
{
logDebug
()
<<
"Reading from line "
<<
d
->
mP
reviousLinesCount
<<
" ("
<<
d
->
logFile
.
url
().
toLocalFile
()
<<
")"
;
QStringList
newOutputs
;
int
index
=
d
->
p
reviousLinesCount
-
1
;
while
(
index
<
d
->
a
vailableStandardOutput
.
count
())
{
newOutputs
.
append
(
d
->
a
vailableStandardOutput
.
at
(
index
));
int
index
=
d
->
mP
reviousLinesCount
-
1
;
while
(
index
<
d
->
mA
vailableStandardOutput
.
count
())
{
newOutputs
.
append
(
d
->
mA
vailableStandardOutput
.
at
(
index
));
++
index
;
}
...
...
@@ -187,7 +187,7 @@ void ProcessOutputLogFileReader::emitProcessOutput(int /*exitCode*/, QProcess::E
else
{
logDebug
()
<<
"New process or process already read. Reading entire content"
;
Q_EMIT
contentChanged
(
this
,
Analyzer
::
FullRead
,
d
->
a
vailableStandardOutput
);
Q_EMIT
contentChanged
(
this
,
Analyzer
::
FullRead
,
d
->
mA
vailableStandardOutput
);
}
closeProcess
();
...
...
@@ -200,24 +200,24 @@ void ProcessOutputLogFileReader::logFileModified()
logDebug
()
<<
"Content available on process output..."
;
// New added lines
QByteArray
bytesOutput
=
d
->
p
rocess
->
readAllStandardOutput
();
d
->
b
uffer
.
append
(
QLatin1String
(
bytesOutput
));
QByteArray
bytesOutput
=
d
->
mP
rocess
->
readAllStandardOutput
();
d
->
mB
uffer
.
append
(
QLatin1String
(
bytesOutput
));
// Parse buffer
int
endLinePos
=
d
->
b
uffer
.
indexOf
(
QLatin1String
(
"
\n
"
));
int
endLinePos
=
d
->
mB
uffer
.
indexOf
(
QLatin1String
(
"
\n
"
));
forever
{
if
(
endLinePos
==
-
1
)
{
break
;
}
// Add the new found lines and
d
->
a
vailableStandardOutput
.
append
(
d
->
b
uffer
.
left
(
endLinePos
));
d
->
b
uffer
.
remove
(
0
,
endLinePos
+
1
);
d
->
mA
vailableStandardOutput
.
append
(
d
->
mB
uffer
.
left
(
endLinePos
));
d
->
mB
uffer
.
remove
(
0
,
endLinePos
+
1
);
endLinePos
=
d
->
b
uffer
.
indexOf
(
QLatin1String
(
"
\n
"
));
endLinePos
=
d
->
mB
uffer
.
indexOf
(
QLatin1String
(
"
\n
"
));
}
logDebug
()
<<
"Received a total of"
<<
d
->
a
vailableStandardOutput
.
count
()
<<
"new lines"
;
logDebug
()
<<
"Received a total of"
<<
d
->
mA
vailableStandardOutput
.
count
()
<<
"new lines"
;
}
/**
...
...
@@ -228,9 +228,9 @@ void ProcessOutputLogFileReader::emptyBuffer()
{
Q_D
(
ProcessOutputLogFileReader
);
if
(
d
->
b
uffer
.
isEmpty
()
==
false
)
{
if
(
d
->
mB
uffer
.
isEmpty
()
==
false
)
{
logWarning
()
<<
"Buffer was not empty !!"
;
d
->
a
vailableStandardOutput
.
append
(
d
->
b
uffer
);
d
->
b
uffer
.
clear
();
d
->
mA
vailableStandardOutput
.
append
(
d
->
mB
uffer
);
d
->
mB
uffer
.
clear
();
}
}
src/lib/simpleAction.cpp
View file @
344bdbd4
...
...
@@ -47,8 +47,7 @@ SimpleAction::~SimpleAction()
QList
<
QAction
*>
SimpleAction
::
innerActions
()
{
QList
<
QAction
*>
actions
;
actions
.
append
(
mAction
);
const
QList
<
QAction
*>
actions
{
mAction
};
return
actions
;
}
...
...
src/lib/view.cpp
View file @
344bdbd4
...
...
@@ -163,7 +163,7 @@ QSize View::sizeHint() const
void
View
::
dropEvent
(
QDropEvent
*
event
)
{
QList
<
QUrl
>
urls
=
event
->
mimeData
()
->
urls
();
const
QList
<
QUrl
>
urls
=
event
->
mimeData
()
->
urls
();
// If URLs have been dropped
if
(
!
urls
.
isEmpty
())
{
...
...
src/modes/acpid/acpidAnalyzer.cpp
View file @
344bdbd4
...
...
@@ -55,17 +55,17 @@ LogLine *AcpidAnalyzer::parseMessage(const QString &logLine, const LogFile &orig
date
=
QDate
::
currentDate
();
time
=
QTime
::
currentTime
();
}
else
{
QString
strDate
=
line
.
mid
(
dateBegin
+
1
,
dateEnd
-
dateBegin
-
1
);
const
QString
strDate
=
line
.
mid
(
dateBegin
+
1
,
dateEnd
-
dateBegin
-
1
);
QString
month
=
strDate
.
mid
(
4
,
3
);
const
QString
month
=
strDate
.
mid
(
4
,
3
);
QString
day
=
strDate
.
mid
(
8
,
2
);
const
QString
day
=
strDate
.
mid
(
8
,
2
);
QString
hour
=
strDate
.
mid
(
11
,
2
);
QString
min
=
strDate
.
mid
(
14
,
2
);
QString
sec
=
strDate
.
mid
(
17
,
2
);
const
QString
hour
=
strDate
.
mid
(
11
,
2
);
const
QString
min
=
strDate
.
mid
(
14
,
2
);
const
QString
sec
=
strDate
.
mid
(
17
,
2
);
QString
year
=
strDate
.
mid
(
20
,
4
);
const
QString
year
=
strDate
.
mid
(
20
,
4
);
date
=
QDate
(
year
.
toInt
(),
ParsingHelper
::
instance
()
->
parseSyslogMonth
(
month
),
day
.
toInt
());
time
=
QTime
(
hour
.
toInt
(),
min
.
toInt
(),
sec
.
toInt
());
...
...
src/modes/acpid/acpidConfiguration.cpp
View file @
344bdbd4
...
...
@@ -25,8 +25,7 @@ AcpidConfiguration::AcpidConfiguration()
{
mConfiguration
->
setCurrentGroup
(
QStringLiteral
(
"AcpidLogMode"
));
QStringList
defaultAcpidPaths
;
defaultAcpidPaths
<<
QStringLiteral
(
"/var/log/acpid"
);
const
QStringList
defaultAcpidPaths
{
QStringLiteral
(
"/var/log/acpid"
)};
mConfiguration
->
addItemStringList
(
QStringLiteral
(
"LogFilesPaths"
),
mAcpidPaths
,
defaultAcpidPaths
,
QStringLiteral
(
"LogFilesPaths"
));
}
...
...
src/modes/acpid/acpidConfigurationWidget.cpp
View file @
344bdbd4
...
...
@@ -60,7 +60,7 @@ void AcpidConfigurationWidget::defaultConfig()
bool
AcpidConfigurationWidget
::
isValid
()
const
{
if
(
mFileList
->
isEmpty
()
==
false
)
{
if
(
!
mFileList
->
isEmpty
())
{
return
true
;
}
...
...
src/modes/apache/apacheAnalyzer.cpp
View file @
344bdbd4
...
...
@@ -72,17 +72,17 @@ LogLine *ApacheAnalyzer::parseMessage(const QString &logLine, const LogFile &ori
QString
type
;
QString
message
;
QString
strDate
=
line
.
mid
(
dateBegin
+
1
,
dateEnd
-
dateBegin
-
1
);
const
QString
strDate
=
line
.
mid
(
dateBegin
+
1
,
dateEnd
-
dateBegin
-
1
);
QString
month
=
strDate
.
mid
(
4
,
3
);
const
QString
month
=
strDate
.
mid
(
4
,
3
);
QString
day
=
strDate
.
mid
(
8
,
2
);
const
QString
day
=
strDate
.
mid
(
8
,
2
);
QString
hour
=
strDate
.
mid
(
11
,
2
);
QString
min
=
strDate
.
mid
(
14
,
2
);
QString
sec
=
strDate
.
mid
(
17
,
2
);
const
QString
hour
=
strDate
.
mid
(
11
,
2
);
const
QString
min
=
strDate
.
mid
(
14
,
2
);
const
QString
sec
=
strDate
.
mid
(
17
,
2
);
QString
year
=
strDate
.
mid
(
20
,
4
);
const
QString
year
=
strDate
.
mid
(
20
,
4
);
date
=
QDate
(
year
.
toInt
(),
ParsingHelper
::
instance
()
->
parseSyslogMonth
(
month
),
day
.
toInt
());
time
=
QTime
(
hour
.
toInt
(),
min
.
toInt
(),
sec
.
toInt
());
...
...
src/modes/apache/apacheConfiguration.cpp
View file @
344bdbd4
...
...
@@ -25,13 +25,11 @@ ApacheConfiguration::ApacheConfiguration()
{
mConfiguration
->
setCurrentGroup
(
QStringLiteral
(
"ApacheLogMode"
));
QStringList
defaultApachePaths
;
defaultApachePaths
<<
QStringLiteral
(
"/var/log/apache2/error.log"
);
const
QStringList
defaultApachePaths
{
QStringLiteral
(
"/var/log/apache2/error.log"
)};
mConfiguration
->
addItemStringList
(
QStringLiteral
(
"ApacheLogFilesPaths"
),
mApachePaths
,
defaultApachePaths
,
QStringLiteral
(
"ApacheLogFilesPaths"
));
QStringList
defaultApacheAccessPaths
;
defaultApacheAccessPaths
<<
QStringLiteral
(
"/var/log/apache2/access.log"
);
const
QStringList
defaultApacheAccessPaths
{
QStringLiteral
(
"/var/log/apache2/access.log"
)};
mConfiguration
->
addItemStringList
(
QStringLiteral
(
"ApacheAccessLogFilesPaths"
),
mApacheAccessPaths
,
defaultApacheAccessPaths
,
QStringLiteral
(
"ApacheAccessLogFilesPaths"
));
...
...
src/modes/apache/apacheConfigurationWidget.cpp
View file @
344bdbd4
...
...
@@ -71,7 +71,7 @@ void ApacheConfigurationWidget::readConfig()
bool
ApacheConfigurationWidget
::
isValid
()
const
{
if
(
mApacheFileList
->
isOneOfCategoryEmpty
()
==
true
)
{
if
(
mApacheFileList
->
isOneOfCategoryEmpty
())
{
logDebug
()
<<
"Apache configuration not valid"
;
return
false
;
}
...
...
src/modes/apache/apacheFactory.cpp
View file @
344bdbd4
...
...
@@ -52,8 +52,8 @@ LogModeAction *ApacheLogModeFactory::createLogModeAction() const
LogMode
*
apacheLogMode
=
Globals
::
instance
().
findLogMode
(
QStringLiteral
(
APACHE_LOG_MODE_ID
));
LogMode
*
apacheAccessLogMode
=
Globals
::
instance
().
findLogMode
(
QStringLiteral
(
APACHE_ACCESS_LOG_MODE_ID
));
bool
apacheLogsExist
=
apacheLogMode
->
filesExist
();
bool
apacheAccessLogsExist
=
apacheAccessLogMode
->
filesExist
();
const
bool
apacheLogsExist
=
apacheLogMode
->
filesExist
();
const
bool
apacheAccessLogsExist
=
apacheAccessLogMode
->
filesExist
();
if
(
!
apacheLogsExist
&&
!
apacheAccessLogsExist
)
{
return
nullptr
;
...
...
src/modes/authentication/authenticationAnalyzer.cpp
View file @
344bdbd4
...
...
@@ -30,7 +30,7 @@ LogLine *AuthenticationAnalyzer::parseMessage(const QString &logLine, const LogF
{
LogLine
*
syslogLine
=
SyslogAnalyzer
::
parseMessage
(
logLine
,
originalLogFile
);
QString
message
=
syslogLine
->
logItems
().
at
(
syslogLine
->
logItems
().
count
()
-
1
);
const
QString
message
=
syslogLine
->
logItems
().
at
(
syslogLine
->
logItems
().
count
()
-
1
);
if
(
hasErrorKeywords
(
message
))
{
syslogLine
->
setLogLevel
(
Globals
::
instance
().
errorLogLevel
());
...
...
src/modes/authentication/authenticationConfiguration.cpp
View file @
344bdbd4
...
...
@@ -25,17 +25,15 @@ AuthenticationConfiguration::AuthenticationConfiguration()
{
mConfiguration
->
setCurrentGroup
(
QStringLiteral
(
"AuthenticationLogMode"
));
QString
defaultAuthenticationPath
(
QStringLiteral
(
"/var/log/auth.log"
)
)
;
const
QString
defaultAuthenticationPath
{
QStringLiteral
(
"/var/log/auth.log"
)
}
;
mConfiguration
->
addItemString
(
QStringLiteral
(
"LogFilePath"
),
mAuthenticationPath
,
defaultAuthenticationPath
,
QStringLiteral
(
"LogFilePath"
));
QStringList
defaultWarningKeywords
;
defaultWarningKeywords
.
append
(
QStringLiteral
(
"failed"
));
const
QStringList
defaultWarningKeywords
{
QStringLiteral
(
"failed"
)};
mConfiguration
->
addItemStringList
(
QStringLiteral
(
"WarningKeywords"
),
mWarningKeywords
,
defaultWarningKeywords
,
QStringLiteral
(
"WarningKeywords"
));
QStringList
defaultErrorKeywords
;
defaultErrorKeywords
.
append
(
QStringLiteral
(
"error"
));
const
QStringList
defaultErrorKeywords
{
QStringLiteral
(
"error"
)};
mConfiguration
->
addItemStringList
(
QStringLiteral
(
"ErrorKeywords"
),
mErrorKeywords
,
defaultErrorKeywords
,
QStringLiteral
(
"ErrorKeywords"
));
}
...
...
src/modes/authentication/authenticationConfigurationWidget.cpp
View file @
344bdbd4
...
...
@@ -80,8 +80,8 @@ void AuthenticationConfigurationWidget::readConfig()
.
findLogMode
(
QStringLiteral
(
AUTHENTICATION_LOG_MODE_ID
))
->
logModeConfiguration
<
AuthenticationConfiguration
*>
();
QString
path
=
authenticationConfiguration
->
authenticationPath
();
QFileInfo
fileInfo
(
path
);
const
QString
path
=
authenticationConfiguration
->
authenticationPath
();
const
QFileInfo
fileInfo
(
path
);
mWarningBox
->
setVisible
(
!
fileInfo
.
exists
());
mAuthenticationUrlRequester
->
setUrl
(
QUrl
::
fromLocalFile
(
path
));
...
...
src/modes/authentication/authenticationLogMode.cpp
View file @
344bdbd4
...
...
@@ -64,7 +64,6 @@ QList<LogFile> AuthenticationLogMode::createLogFiles()
{
auto
*
configuration
=
logModeConfiguration
<
AuthenticationConfiguration
*>
();
QList
<
LogFile
>
logFiles
;
logFiles
.
append
(
configuration
->
findGenericLogFile
(
configuration
->
authenticationPath
()));
const
QList
<
LogFile
>
logFiles
{
configuration
->
findGenericLogFile
(
configuration
->
authenticationPath
())};
return
logFiles
;
}
src/modes/base/fileList.cpp
View file @
344bdbd4
...
...
@@ -135,7 +135,7 @@ void FileList::modifyItem(QListWidgetItem *item)
const
QStringList
paths
=
mFileListHelper
.
findPaths
(
urls
);
// We only take the first path
if
(
paths
.
count
()
>=
1
)
{
if
(
!
paths
.
isEmpty
()
)
{
item
->
setText
(
paths
.
at
(
0
));
}
...
...
src/modes/base/genericConfiguration.cpp
View file @
344bdbd4
...
...
@@ -29,13 +29,6 @@
#include "globals.h"
#include "ksystemlogConfig.h"
class
GenericLogModeConfigurationPrivate
{
public:
};
GenericLogModeConfiguration
::
GenericLogModeConfiguration
(
const
QString
&
configurationGroup
,
const
QStringList
&
defaultLogFilesPaths
,
const
QList
<
int
>
&
defaultLogFilesLevels
)
{
logDebug
()
<<
"Using Configuration Group : "
<<
configurationGroup
;
...
...
@@ -87,8 +80,8 @@ QList<LogFile> GenericLogModeConfiguration::findGenericLogFiles() const
QListIterator
<
int
>
itInt
(
mLogFilesLevels
);
while
(
itString
.
hasNext
())
{
int
intValue
=
itInt
.
next
();
QString
stringValue
=
itString
.
next
();
const
int
intValue
=
itInt
.
next
();
const
QString
stringValue
=
itString
.
next
();
if
(
intValue
>=
0
&&
intValue
<
static_cast
<
int
>
(
Globals
::
instance
().
logLevels
().
count
()))
{
level
=
Globals
::
instance
().
logLevels
().
at
(
intValue
);
...
...
src/modes/base/multipleFileList.cpp
View file @
344bdbd4
...
...
@@ -144,7 +144,7 @@ void MultipleFileList::updateButtons()
bool
MultipleFileList
::
isFileListsEmpty
()
const
{
for
(
int
i
=
0
;
i
<
fileList
->
topLevelItemCount
();
++
i
)
{
for
(
int
i
=
0
,
total
=
fileList
->
topLevelItemCount
();
i
<
total
;
++
i
)
{
if
(
categoryCount
(
i
)
!=
0
)
{
logDebug
()
<<
"Is not empty"
;
return
false
;
...
...
@@ -157,7 +157,7 @@ bool MultipleFileList::isFileListsEmpty() const
bool
MultipleFileList
::
isOneOfCategoryEmpty
()
const
{
for
(
int
i
=
0
;
i
<
fileList
->
topLevelItemCount
();
++
i
)
{
for
(
int
i
=
0
,
total
=
fileList
->
topLevelItemCount
();
i
<
total
;
++
i
)
{
if
(
categoryCount
(
i
)
==
0
)
{
logDebug
()
<<
"A category is empty"
;
return
true
;
...
...
@@ -177,7 +177,7 @@ int MultipleFileList::categoryCount(int index) const
}
int
count
=
0
;
for
(
int
i
=
0
;
i
<
item
->
childCount
();
++
i
)
{
for
(
int
i
=
0
,
total
=
item
->
childCount
();
i
<
total
;
++
i
)
{
QTreeWidgetItem
*
childItem
=
item
->
child
(
i
);
if
(
isEmptyItem
(
childItem
)
==
false
)
{
count
++
;
...
...
@@ -220,7 +220,7 @@ void MultipleFileList::addItem(int category)
logDebug
()
<<
"Adding item"
<<
category
;
// Open a standard Filedialog
QList
<
QUrl
>
urls
=
mFileListHelper
.
openUrls
();
const
QList
<
QUrl
>
urls
=
mFileListHelper
.
openUrls
();
QTreeWidgetItem
*
categoryItem
=
fileList
->
topLevelItem
(
category
);
...
...
@@ -253,7 +253,7 @@ QTreeWidgetItem *MultipleFileList::findCategoryOfChild(QTreeWidgetItem *childIte
{
logDebug
()
<<
"Finding Category of"
<<
childItem
->
text
(
0
);
for
(
int
i
=
0
;
i
<
fileList
->
topLevelItemCount
();
++
i
)
{
for
(
int
i
=
0
,
total
=
fileList
->
topLevelItemCount
();
i
<
total
;
++
i
)
{
QTreeWidgetItem
*
item
=
fileList
->
topLevelItem
(
i
);
if
(
item
->
indexOfChild
(
childItem
)
!=
-
1
)
{
...
...
@@ -377,7 +377,7 @@ void MultipleFileList::updateEmptyItems()
logDebug
()
<<
"Adding empty items..."
;
for
(
int
i
=
0
;
i
<
fileList
->
topLevelItemCount
();
++
i
)
{
for
(
int
i
=
0
,
total
=
fileList
->
topLevelItemCount
();
i
<
total
;
++
i
)
{
QTreeWidgetItem
*
categoryItem
=
fileList
->
topLevelItem
(
i
);
// If it's a category item and it's empty
...
...
@@ -457,7 +457,7 @@ QStringList MultipleFileList::paths(int category)
QTreeWidgetItemIterator
it
(
fileList
,
QTreeWidgetItemIterator
::
All
);
QStringList
paths
;
while
(
*
it
!=
nullptr
)
{
while
(
*
it
)
{
QTreeWidgetItem
*
item
=
*
it
;
if
(
categoryItem
->
indexOfChild
(
item
)
!=
-
1
)
{
...
...
src/modes/cron/cronAnalyzer.cpp
View file @
344bdbd4
...
...
@@ -55,7 +55,7 @@ LogLine *CronAnalyzer::parseMessage(const QString &logLine, const LogFile &origi
int
leftBracket
=
message
.
indexOf
(
QLatin1Char
(
'('
));
int
rightBracket
=
message
.
indexOf
(
QLatin1Char
(
')'
));
QString
user
=
message
.
mid
(
leftBracket
+
1
,
rightBracket
-
leftBracket
-
1
);
const
QString
user
=
message
.
mid
(
leftBracket
+
1
,
rightBracket
-
leftBracket
-
1
);
list
.
append
(
user
);
...
...
src/modes/cron/cronConfiguration.cpp
View file @
344bdbd4
...
...
@@ -25,12 +25,11 @@ CronConfiguration::CronConfiguration()
{
mConfiguration
->
setCurrentGroup
(
QStringLiteral
(
"CronLogMode"
));
QStringList
defaultCronPaths
;
defaultCronPaths
<<
QStringLiteral
(
"/var/log/syslog"
);
const
QStringList
defaultCronPaths
{
QStringLiteral
(
"/var/log/syslog"
)};
mConfiguration
->
addItemStringList
(
QStringLiteral
(
"LogFilesPaths"
),
mCronPaths
,
defaultCronPaths
,
QStringLiteral
(
"LogFilesPaths"
));
QString
defaultProcessFilter
(
QStringLiteral
(
"/usr/sbin/cron"
));
const
QString
defaultProcessFilter
(
QStringLiteral
(
"/usr/sbin/cron"
));
mConfiguration
->
addItemString
(
QStringLiteral
(
"ProcessFilter"
),
mProcessFilter
,
defaultProcessFilter
,
QStringLiteral
(
"ProcessFilter"
));
}
...
...
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment