Commit 30cdb5ca authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Use QVector

parent d41a652e
......@@ -106,7 +106,7 @@ void KernelAnalyzerTest::testUbuntuDmesg()
QVERIFY(kernelAnalyzer);
QVERIFY(model);
QList<LogFile> logFiles = testUtil.createLogFiles(QStringLiteral(":/testFiles/kernel/ubuntu.dmesg"));
QVector<LogFile> logFiles = testUtil.createLogFiles(QStringLiteral(":/testFiles/kernel/ubuntu.dmesg"));
kernelAnalyzer->setLogFiles(logFiles);
......@@ -140,7 +140,7 @@ void KernelAnalyzerTest::testSuseDmesg()
QVERIFY(kernelAnalyzer);
QVERIFY(model);
QList<LogFile> logFiles = testUtil.createLogFiles(QStringLiteral(":/testFiles/kernel/suse.dmesg"));
QVector<LogFile> logFiles = testUtil.createLogFiles(QStringLiteral(":/testFiles/kernel/suse.dmesg"));
kernelAnalyzer->setLogFiles(logFiles);
......
......@@ -78,7 +78,7 @@ void SystemAnalyzerTest::testOneLine()
QVERIFY(systemAnalyzer);
QVERIFY(model);
QList<LogFile> logFiles = testUtil.createLogFiles(QStringLiteral(":/testFiles/default/one-line.log"));
QVector<LogFile> logFiles = testUtil.createLogFiles(QStringLiteral(":/testFiles/default/one-line.log"));
systemAnalyzer->setLogFiles(logFiles);
......@@ -115,7 +115,7 @@ void SystemAnalyzerTest::testTwoLines()
// Specifical configuration
KSystemLogConfig::setMaxLines(1000);
QList<LogFile> logFiles = testUtil.createLogFiles(QStringLiteral(":/testFiles/default/two-lines.log"));
QVector<LogFile> logFiles = testUtil.createLogFiles(QStringLiteral(":/testFiles/default/two-lines.log"));
systemAnalyzer->setLogFiles(logFiles);
......@@ -138,7 +138,7 @@ void SystemAnalyzerTest::testMultipleLines()
// Specifical configuration
KSystemLogConfig::setMaxLines(1000);
QList<LogFile> logFiles = testUtil.createLogFiles(QStringLiteral(":/testFiles/system/system.log"));
QVector<LogFile> logFiles = testUtil.createLogFiles(QStringLiteral(":/testFiles/system/system.log"));
LogFile logFile = logFiles.at(0);
systemAnalyzer->setLogFiles(logFiles);
......@@ -197,7 +197,7 @@ void SystemAnalyzerTest::testStrangeLines()
KSystemLogConfig::setMaxLines(1000);
KSystemLogConfig::setDeleteProcessIdentifier(false);
QList<LogFile> logFiles = testUtil.createLogFiles(QStringLiteral(":/testFiles/system/strange-lines.log"));
QVector<LogFile> logFiles = testUtil.createLogFiles(QStringLiteral(":/testFiles/system/strange-lines.log"));
systemAnalyzer->setLogFiles(logFiles);
......@@ -288,7 +288,7 @@ void SystemAnalyzerTest::testDeleteProcessIdentifier()
KSystemLogConfig::setMaxLines(1000);
KSystemLogConfig::setDeleteProcessIdentifier(true);
QList<LogFile> logFiles = testUtil.createLogFiles(QStringLiteral(":/testFiles/system/delete-process-identifier.log"));
QVector<LogFile> logFiles = testUtil.createLogFiles(QStringLiteral(":/testFiles/system/delete-process-identifier.log"));
systemAnalyzer->setLogFiles(logFiles);
......@@ -320,7 +320,7 @@ void SystemAnalyzerTest::testMaxLines()
// Specifical configuration
KSystemLogConfig::setMaxLines(5);
QList<LogFile> logFiles = testUtil.createLogFiles(QStringLiteral(":/testFiles/system/max-lines.log"));
QVector<LogFile> logFiles = testUtil.createLogFiles(QStringLiteral(":/testFiles/system/max-lines.log"));
LogFile logFile = logFiles.at(0);
systemAnalyzer->setLogFiles(logFiles);
......@@ -389,7 +389,7 @@ void SystemAnalyzerTest::testRemoveDuplicates()
KSystemLogConfig::setMaxLines(1000);
KSystemLogConfig::setDeleteDuplicatedLines(true);
QList<LogFile> logFiles = testUtil.createLogFiles(QStringLiteral(":/testFiles/system/duplicate-lines.log"));
QVector<LogFile> logFiles = testUtil.createLogFiles(QStringLiteral(":/testFiles/system/duplicate-lines.log"));
systemAnalyzer->setLogFiles(logFiles);
......
......@@ -83,7 +83,7 @@ void TestUtil::destroyReader(Analyzer *analyzer) const
delete analyzer;
}
QList<LogFile> TestUtil::createLogFiles(const QString &resourceFileName) const
QVector<LogFile> TestUtil::createLogFiles(const QString &resourceFileName) const
{
QTemporaryFile *tempFile = QTemporaryFile::createNativeFile(resourceFileName);
logDebug() << "Using log file name " << tempFile;
......@@ -91,7 +91,7 @@ QList<LogFile> TestUtil::createLogFiles(const QString &resourceFileName) const
LogLevel *informationLogLevel = Globals::instance().informationLogLevel();
QList<LogFile> logFiles;
QVector<LogFile> logFiles;
LogFile logFile(QUrl::fromLocalFile(tempFile->fileName()), informationLogLevel);
logFiles.append(logFile);
......
......@@ -65,7 +65,7 @@ public:
/*
* Create a LogFile list from a single resourceFileName
*/
QList<LogFile> createLogFiles(const QString &resourceFileName) const;
QVector<LogFile> createLogFiles(const QString &resourceFileName) const;
/*
* Add the "addedLines" list to the file "fileName"
......
......@@ -54,7 +54,7 @@ public:
virtual void watchLogFiles(bool enabled) = 0;
virtual void setLogFiles(const QList<LogFile> &logFiles) = 0;
virtual void setLogFiles(const QVector<LogFile> &logFiles) = 0;
virtual LogViewColumns initColumns() = 0;
......
......@@ -71,7 +71,7 @@ void FileAnalyzer::deleteLogFiles()
mLogFileReaders.clear();
}
void FileAnalyzer::setLogFiles(const QList<LogFile> &logFiles)
void FileAnalyzer::setLogFiles(const QVector<LogFile> &logFiles)
{
// Remove previous files
deleteLogFiles();
......
......@@ -50,7 +50,7 @@ public:
void watchLogFiles(bool enabled) override;
void setLogFiles(const QList<LogFile> &logFiles) override;
void setLogFiles(const QVector<LogFile> &logFiles) override;
protected:
virtual LogFileReader *createLogFileReader(const LogFile &logFile) = 0;
......
......@@ -173,7 +173,7 @@ void LogManager::initialize(LogMode *mode, const QVariant &analyzerOptions)
internalInitialize(mode, mode->createLogFiles(), analyzerOptions);
}
void LogManager::internalInitialize(LogMode *mode, const QList<LogFile> &logFiles, const QVariant &analyzerOptions)
void LogManager::internalInitialize(LogMode *mode, const QVector<LogFile> &logFiles, const QVariant &analyzerOptions)
{
logDebug() << "Initializing LogManager...";
......@@ -244,7 +244,7 @@ void LogManager::loadDroppedUrls(const QList<QUrl> &urls)
{
logDebug() << "Drop " << urls;
QList<LogFile> logFiles;
QVector<LogFile> logFiles;
logFiles.reserve(urls.count());
for (const QUrl &url : urls) {
......
......@@ -82,7 +82,7 @@ private Q_SLOTS:
void loadDroppedUrls(const QList<QUrl> &urls);
private:
void internalInitialize(LogMode *mode, const QList<LogFile> &logFiles, const QVariant &analyzerOptions = QVariant());
void internalInitialize(LogMode *mode, const QVector<LogFile> &logFiles, const QVariant &analyzerOptions = QVariant());
void cleanPreviousLogMode();
......
......@@ -26,6 +26,7 @@
#include <QList>
#include <QObject>
#include <QString>
#include <QVector>
#include "logFile.h"
......@@ -108,7 +109,7 @@ public:
/**
* Create the log file list which will be read
*/
virtual QList<LogFile> createLogFiles() = 0;
virtual QVector<LogFile> createLogFiles() = 0;
Q_SIGNALS:
void menuChanged();
......
......@@ -108,16 +108,16 @@ Reader* ReaderFactory::createReader(LogMode* logMode) {
// TODO Move this method in LogModeFactory subclasses
/*
QList<LogFile> LogFilesFactory::createLogFiles(LogMode* logMode) {
QVector<LogFile> LogFilesFactory::createLogFiles(LogMode* logMode) {
else if (logMode==Globals::instance().bootMode()) {
QList<LogFile> list;
QVector<LogFile> list;
list.append(LogFilesFactory::instance().getBootLogFile());
return list;
}
else if (logMode==Globals::instance().authenticationMode()) {
QList<LogFile> list;
QVector<LogFile> list;
list.append(LogFilesFactory::instance().getAuthenticationLogFile());
return list;
}
......@@ -154,7 +154,7 @@ QList<LogFile> LogFilesFactory::createLogFiles(LogMode* logMode) {
logError() << "LogFiles not found : returns NULL Reader";
return QList<LogFile>();
return QVector<LogFile>();
}
......@@ -169,39 +169,39 @@ LogFile LogFilesFactory::getAuthenticationLogFile() {
return getGenericLogFile(file);
}
QList<LogFile> LogFilesFactory::getDaemonLogFiles() {
QVector<LogFile> LogFilesFactory::getDaemonLogFiles() {
QStringList files=KSystemLogConfig::daemonPaths();
QList<int> levels=KSystemLogConfig::daemonLevels();
return LogFilesFactory::getGenericLogFiles(files, levels);
}
QList<LogFile> LogFilesFactory::getCupsLogFiles() {
QVector<LogFile> LogFilesFactory::getCupsLogFiles() {
QStringList stringList=KSystemLogConfig::cupsPaths();
return getNoModeLogFiles(stringList);
}
QList<LogFile> LogFilesFactory::getCupsAccessLogFiles() {
QVector<LogFile> LogFilesFactory::getCupsAccessLogFiles() {
QStringList stringList=KSystemLogConfig::cupsAccessPaths();
return getNoModeLogFiles(stringList);
}
QList<LogFile> LogFilesFactory::getPostfixLogFiles() {
QVector<LogFile> LogFilesFactory::getPostfixLogFiles() {
QStringList files=KSystemLogConfig::postfixPaths();
QList<int> levels=KSystemLogConfig::postfixLevels();
return LogFilesFactory::getGenericLogFiles(files, levels);
}
QList<LogFile> LogFilesFactory::getSambaLogFiles() {
QVector<LogFile> LogFilesFactory::getSambaLogFiles() {
QStringList stringList=KSystemLogConfig::sambaPaths();
return getNoModeLogFiles(stringList);
}
QList<LogFile> LogFilesFactory::getSSHLogFiles() {
QVector<LogFile> LogFilesFactory::getSSHLogFiles() {
QStringList stringList=KSystemLogConfig::sshPaths();
return getNoModeLogFiles(stringList);
}
QList<LogFile> LogFilesFactory::getXSessionLogFiles() {
QVector<LogFile> LogFilesFactory::getXSessionLogFiles() {
QStringList stringList=KSystemLogConfig::xSessionPaths();
return getNoModeLogFiles(stringList);
}
......@@ -220,9 +220,9 @@ LogFile LogModeConfiguration::findGenericLogFile(const QString &file)
return LogFile(url, level);
}
QList<LogFile> LogModeConfiguration::findGenericLogFiles(const QStringList &files)
QVector<LogFile> LogModeConfiguration::findGenericLogFiles(const QStringList &files)
{
QList<LogFile> logFiles;
QVector<LogFile> logFiles;
for (const QString &file : files) {
logFiles.append(findGenericLogFile(file));
......@@ -231,9 +231,9 @@ QList<LogFile> LogModeConfiguration::findGenericLogFiles(const QStringList &file
return logFiles;
}
QList<LogFile> LogModeConfiguration::findNoModeLogFiles(const QStringList &stringList)
QVector<LogFile> LogModeConfiguration::findNoModeLogFiles(const QStringList &stringList)
{
QList<LogFile> logFiles;
QVector<LogFile> logFiles;
// Default level used for No Mode logs
LogLevel *level = Globals::instance().noLogLevel();
......
......@@ -40,9 +40,9 @@ public:
~LogModeConfiguration() override;
LogFile findGenericLogFile(const QString &file);
QList<LogFile> findGenericLogFiles(const QStringList &files);
QVector<LogFile> findGenericLogFiles(const QStringList &files);
QList<LogFile> findNoModeLogFiles(const QStringList &stringList);
QVector<LogFile> findNoModeLogFiles(const QStringList &stringList);
protected:
KSystemLogConfig *mConfiguration = nullptr;
......
......@@ -59,7 +59,7 @@ Analyzer *AcpidLogMode::createAnalyzer(const QVariant &options)
return new AcpidAnalyzer(this);
}
QList<LogFile> AcpidLogMode::createLogFiles()
QVector<LogFile> AcpidLogMode::createLogFiles()
{
auto *configuration = logModeConfiguration<AcpidConfiguration *>();
return configuration->findNoModeLogFiles(configuration->acpidPaths());
......
......@@ -49,7 +49,7 @@ public:
Analyzer *createAnalyzer(const QVariant &options = QVariant()) override;
QList<LogFile> createLogFiles() override;
QVector<LogFile> createLogFiles() override;
};
#endif // _ACPID_LOG_MODE_H
......@@ -60,7 +60,7 @@ Analyzer *ApacheAccessLogMode::createAnalyzer(const QVariant &options)
return new ApacheAccessAnalyzer(this);
}
QList<LogFile> ApacheAccessLogMode::createLogFiles()
QVector<LogFile> ApacheAccessLogMode::createLogFiles()
{
auto *apacheConfiguration = logModeConfiguration<ApacheConfiguration *>();
return apacheConfiguration->findNoModeLogFiles(apacheConfiguration->apacheAccessPaths());
......
......@@ -52,7 +52,7 @@ public:
Analyzer *createAnalyzer(const QVariant &options = QVariant()) override;
QList<LogFile> createLogFiles() override;
QVector<LogFile> createLogFiles() override;
};
#endif // _APACHE_ACCESS_LOG_MODE_H
......@@ -58,7 +58,7 @@ Analyzer *ApacheLogMode::createAnalyzer(const QVariant &options)
return new ApacheAnalyzer(this);
}
QList<LogFile> ApacheLogMode::createLogFiles()
QVector<LogFile> ApacheLogMode::createLogFiles()
{
auto *apacheConfiguration = logModeConfiguration<ApacheConfiguration *>();
return apacheConfiguration->findNoModeLogFiles(apacheConfiguration->apachePaths());
......
......@@ -52,7 +52,7 @@ public:
Analyzer *createAnalyzer(const QVariant &options = QVariant()) override;
QList<LogFile> createLogFiles() override;
QVector<LogFile> createLogFiles() override;
};
#endif // _APACHE_LOG_MODE_H
......@@ -25,7 +25,7 @@ LogViewColumns AuditAnalyzer::initColumns()
return columns;
}
void AuditAnalyzer::setLogFiles(const QList<LogFile> &logFiles)
void AuditAnalyzer::setLogFiles(const QVector<LogFile> &logFiles)
{
// Remove previous files
deleteLogFiles();
......
......@@ -17,7 +17,7 @@ public:
LogViewColumns initColumns() override;
void setLogFiles(const QList<LogFile> &logFiles) override;
void setLogFiles(const QVector<LogFile> &logFiles) override;
protected:
LogFileReader *createLogFileReader(const LogFile &logFile) override;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment