Commit 51c02cd7 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

const'ify

parent e2d307fe
......@@ -37,8 +37,6 @@ public:
bool isValid() const;
enum dateFormat {};
public Q_SLOTS:
void saveConfig() const;
......
......@@ -60,8 +60,8 @@ protected:
private:
MultipleFileList *mApacheFileList = nullptr;
int mApachePathsId;
int mApacheAccessPathsId;
int mApachePathsId = -1;
int mApacheAccessPathsId = -1;
};
#endif // _APACHE_CONFIGURATION_WIDGET_H
......@@ -35,7 +35,7 @@ class FileList : public QWidget, public Ui::FileListBase
{
Q_OBJECT
public:
FileList(QWidget *parent, const QString &descriptionText);
explicit FileList(QWidget *parent, const QString &descriptionText);
~FileList() override;
int count() const;
......
......@@ -124,7 +124,7 @@ bool FileListHelper::isValidFile(const QUrl &url)
return true;
}
QList<QUrl> FileListHelper::openUrls()
QList<QUrl> FileListHelper::openUrls() const
{
QFileDialog fileDialog(mParent, QString(), QStringLiteral(DEFAULT_LOG_FOLDER), QLatin1String("*|") + i18n("All Files (*)")
+ QLatin1String("\n*.log|")
......@@ -136,7 +136,7 @@ QList<QUrl> FileListHelper::openUrls()
return fileDialog.selectedUrls();
}
QUrl FileListHelper::openUrl(const QString &originPath)
QUrl FileListHelper::openUrl(const QString &originPath) const
{
QFileDialog fileDialog(mParent, QString(), originPath, QLatin1String("*|") + i18n("All Files (*)")
+ QLatin1String("\n*.log|")
......
......@@ -45,8 +45,8 @@ public:
bool isValidFile(const QUrl &url);
QStringList expandJoker(const QUrl &url);
QList<QUrl> openUrls();
QUrl openUrl(const QString &originPath);
QList<QUrl> openUrls() const;
QUrl openUrl(const QString &originPath) const;
/**
* Change the enabled status of the button and of its QActions
......
......@@ -142,13 +142,13 @@ void LogLevelFileList::changeItemType()
}
}
LogLevel *LogLevelFileList::level(int i)
LogLevel *LogLevelFileList::level(int i) const
{
return Globals::instance().logLevels().at(
fileList->item(i)->data(LogLevelFileList::LogLevelRole).toInt());
}
QList<int> LogLevelFileList::levels()
QList<int> LogLevelFileList::levels() const
{
QList<int> levels;
const int count = fileList->count();
......@@ -175,7 +175,7 @@ void LogLevelFileList::addPaths(const QStringList &stringList, const QList<int>
while (itString.hasNext()) {
int valueInt = itInt.next();
QString valueString = itString.next();
const QString valueString = itString.next();
bool missingFile = false;
QFileInfo checkFile(valueString);
......@@ -185,7 +185,7 @@ void LogLevelFileList::addPaths(const QStringList &stringList, const QList<int>
}
LogLevel *level;
if (valueInt >= 0 && valueInt < (int)Globals::instance().logLevels().count()) {
if (valueInt >= 0 && valueInt < static_cast<int>(Globals::instance().logLevels().count())) {
level = Globals::instance().logLevels().at(valueInt);
} else {
level = Globals::instance().informationLogLevel();
......
......@@ -36,12 +36,12 @@ public:
~LogLevelFileList() override;
QList<int> levels();
QList<int> levels() const;
void addPaths(const QStringList &filePaths, const QList<int> &fileLevels);
private:
LogLevel *level(int i);
LogLevel *level(int i) const;
void insertItem(LogLevel *level, const QString &itemText, bool missing = false);
......
......@@ -101,7 +101,7 @@ void MultipleFileList::updateButtons()
mFileListHelper.setEnabledAction(removeAll, true);
}
QList<QTreeWidgetItem *> selectedItems = fileList->selectedItems();
const QList<QTreeWidgetItem *> selectedItems = fileList->selectedItems();
// If the selection is not empty and a empty item is not selected
QTreeWidgetItem *categoryItem = nullptr;
......@@ -110,7 +110,7 @@ void MultipleFileList::updateButtons()
}
if (categoryItem) {
int categoryIndex = fileList->indexOfTopLevelItem(categoryItem);
const int categoryIndex = fileList->indexOfTopLevelItem(categoryItem);
mFileListHelper.setEnabledAction(remove, true);
mFileListHelper.setEnabledAction(modify, true);
......
......@@ -43,7 +43,7 @@ TabLogManager::~TabLogManager()
delete mLogManager;
}
LogManager *TabLogManager::logManager()
LogManager *TabLogManager::logManager() const
{
return mLogManager;
}
......
......@@ -40,7 +40,7 @@ public:
~TabLogManager() override;
LogManager *logManager();
LogManager *logManager() const;
void addNewLinesCount(int newLines);
void initNewLinesCount();
......
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