summaryrefslogtreecommitdiff
path: root/src/plugins/pythoneditor/pythoneditorplugin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/pythoneditor/pythoneditorplugin.cpp')
-rw-r--r--src/plugins/pythoneditor/pythoneditorplugin.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/plugins/pythoneditor/pythoneditorplugin.cpp b/src/plugins/pythoneditor/pythoneditorplugin.cpp
index f3efaedba5..4a9220b86f 100644
--- a/src/plugins/pythoneditor/pythoneditorplugin.cpp
+++ b/src/plugins/pythoneditor/pythoneditorplugin.cpp
@@ -333,7 +333,7 @@ static QStringList readLines(const Utils::FileName &projectFile)
QTextStream stream(&file);
forever {
- QString line = stream.readLine();
+ const QString line = stream.readLine();
if (line.isNull())
break;
if (visited.contains(line))
@@ -395,7 +395,7 @@ static QStringList readLinesJson(const Utils::FileName &projectFile,
bool PythonProject::saveRawFileList(const QStringList &rawFileList)
{
- bool result = saveRawList(rawFileList, projectFilePath().toString());
+ const bool result = saveRawList(rawFileList, projectFilePath().toString());
// refresh(PythonProject::Files);
return result;
}
@@ -411,19 +411,18 @@ bool PythonProject::saveRawList(const QStringList &rawList, const QString &fileN
stream << filePath << '\n';
saver.setResult(&stream);
}
- bool result = saver.finalize(ICore::mainWindow());
- return result;
+ return saver.finalize(ICore::mainWindow());
}
bool PythonProject::addFiles(const QStringList &filePaths)
{
QStringList newList = m_rawFileList;
- QDir baseDir(projectDirectory().toString());
+ const QDir baseDir(projectDirectory().toString());
foreach (const QString &filePath, filePaths)
newList.append(baseDir.relativeFilePath(filePath));
- bool result = saveRawList(newList, projectFilePath().toString());
+ const bool result = saveRawList(newList, projectFilePath().toString());
refresh();
return result;
@@ -434,7 +433,7 @@ bool PythonProject::removeFiles(const QStringList &filePaths)
QStringList newList = m_rawFileList;
foreach (const QString &filePath, filePaths) {
- QHash<QString, QString>::iterator i = m_rawListEntries.find(filePath);
+ const QHash<QString, QString>::iterator i = m_rawListEntries.find(filePath);
if (i != m_rawListEntries.end())
newList.removeOne(i.value());
}
@@ -445,7 +444,7 @@ bool PythonProject::removeFiles(const QStringList &filePaths)
bool PythonProject::setFiles(const QStringList &filePaths)
{
QStringList newList;
- QDir baseDir(projectDirectory().toString());
+ const QDir baseDir(projectDirectory().toString());
foreach (const QString &filePath, filePaths)
newList.append(baseDir.relativeFilePath(filePath));
@@ -456,11 +455,11 @@ bool PythonProject::renameFile(const QString &filePath, const QString &newFilePa
{
QStringList newList = m_rawFileList;
- QHash<QString, QString>::iterator i = m_rawListEntries.find(filePath);
+ const QHash<QString, QString>::iterator i = m_rawListEntries.find(filePath);
if (i != m_rawListEntries.end()) {
- int index = newList.indexOf(i.value());
+ const int index = newList.indexOf(i.value());
if (index != -1) {
- QDir baseDir(projectDirectory().toString());
+ const QDir baseDir(projectDirectory().toString());
newList.replace(index, baseDir.relativeFilePath(newFilePath));
}
}
@@ -509,12 +508,13 @@ void PythonProject::refresh(Target *target)
emitParsingStarted();
parseProject();
- QDir baseDir(projectDirectory().toString());
+ const QDir baseDir(projectDirectory().toString());
BuildTargetInfoList appTargets;
auto newRoot = std::make_unique<PythonProjectNode>(this);
for (const QString &f : qAsConst(m_files)) {
const QString displayName = baseDir.relativeFilePath(f);
- FileType fileType = f.endsWith(".pyproject") || f.endsWith(".pyqtc") ? FileType::Project : FileType::Source;
+ const FileType fileType = f.endsWith(".pyproject") || f.endsWith(".pyqtc") ? FileType::Project
+ : FileType::Source;
newRoot->addNestedNode(std::make_unique<PythonFileNode>(FileName::fromString(f),
displayName, fileType));
if (fileType == FileType::Source) {
@@ -617,8 +617,8 @@ QHash<QString, QStringList> sortFilesIntoPaths(const QString &base, const QSet<Q
const QDir baseDir(base);
foreach (const QString &absoluteFileName, files) {
- QFileInfo fileInfo(absoluteFileName);
- FileName absoluteFilePath = FileName::fromString(fileInfo.path());
+ const QFileInfo fileInfo(absoluteFileName);
+ const FileName absoluteFilePath = FileName::fromString(fileInfo.path());
QString relativeFilePath;
if (absoluteFilePath.isChildOf(baseDir)) {