diff --git a/.arcconfig b/.arcconfig
new file mode 100644
--- /dev/null
+++ b/.arcconfig
@@ -0,0 +1,3 @@
+{
+ "phabricator.uri" : "https://phabricator.kde.org/project/view/220/"
+}
diff --git a/src/abbreviationmanager.h b/src/abbreviationmanager.h
--- a/src/abbreviationmanager.h
+++ b/src/abbreviationmanager.h
@@ -39,7 +39,7 @@
* Constructs a new manager object.
**/
explicit Manager(KileInfo* kileInfo, QObject *parent = Q_NULLPTR);
- virtual ~Manager();
+ virtual ~Manager() = default;
// the boolean value is 'true' iff the abbreviation is global
const AbbreviationMap& getAbbreviationMap();
diff --git a/src/abbreviationmanager.cpp b/src/abbreviationmanager.cpp
--- a/src/abbreviationmanager.cpp
+++ b/src/abbreviationmanager.cpp
@@ -31,10 +31,6 @@
}
}
-Manager::~Manager()
-{
-}
-
const AbbreviationMap& Manager::getAbbreviationMap()
{
return m_abbreviationMap;
@@ -125,8 +121,7 @@
void Manager::addAbbreviationListToMap(const QStringList& list, bool global)
{
// a '=' symbol in the left-hand side is encoded by '\='
- for(QStringList::const_iterator i = list.begin(); i != list.end(); ++i) {
- QString entry = *i;
+ for (auto entry : list) {
int delimiter = entry.indexOf(QRegExp("[^\\\\]="));
if(delimiter < 0) {
continue;
diff --git a/src/codecompletion.h b/src/codecompletion.h
--- a/src/codecompletion.h
+++ b/src/codecompletion.h
@@ -52,7 +52,7 @@
public:
LaTeXCompletionModel(QObject *parent, KileCodeCompletion::Manager *manager,
KileDocument::EditorExtension *editorExtension);
- virtual ~LaTeXCompletionModel();
+ virtual ~LaTeXCompletionModel() = default;
virtual QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const Q_DECL_OVERRIDE;
virtual QVariant data(const QModelIndex& index, int role) const Q_DECL_OVERRIDE;
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
@@ -103,7 +103,7 @@
public:
AbbreviationCompletionModel(QObject *parent, KileAbbreviation::Manager *manager);
- virtual ~AbbreviationCompletionModel();
+ virtual ~AbbreviationCompletionModel() = default;
virtual QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const Q_DECL_OVERRIDE;
virtual QVariant data(const QModelIndex& index, int role) const Q_DECL_OVERRIDE;
@@ -146,7 +146,7 @@
public:
Manager(KileInfo *info, QObject *parent);
- virtual ~Manager();
+ virtual ~Manager() = default;
QStringList getLaTeXCommands() const;
QStringList getLocallyDefinedLaTeXCommands(KTextEditor::View *view) const;
diff --git a/src/codecompletion.cpp b/src/codecompletion.cpp
--- a/src/codecompletion.cpp
+++ b/src/codecompletion.cpp
@@ -25,6 +25,7 @@
#include
#include
#include
+#include
#include "kiledebug.h"
#include "abbreviationmanager.h"
@@ -44,10 +45,6 @@
setHasGroups(false);
}
-LaTeXCompletionModel::~LaTeXCompletionModel()
-{
-}
-
void LaTeXCompletionModel::completionInvoked(KTextEditor::View *view, const KTextEditor::Range &range,
InvocationType invocationType)
{
@@ -202,10 +199,7 @@
if(numOpenSquareBrackets != numClosedSquareBrackets || numOpenCurlyBrackets != numClosedCurlyBrackets) {
return true;
}
- if(numOpenSquareBrackets == 0 && numOpenCurlyBrackets == 0 && commandText.count(' ') == 0) {
- return true;
- }
- return false;
+ return numOpenSquareBrackets == 0 && numOpenCurlyBrackets == 0 && commandText.count(' ') == 0;
}
KTextEditor::Range LaTeXCompletionModel::completionRange(KTextEditor::View *view, const KTextEditor::Cursor &position)
@@ -301,11 +295,8 @@
const QString ¤tCompletion)
{
Q_UNUSED(currentCompletion);
- if(view->cursorPosition() < range.start() || view->cursorPosition() > range.end()
- || m_completionList.size() == 0) {
- return true;
- }
- return false;
+ return view->cursorPosition() < range.start() || view->cursorPosition() > range.end()
+ || m_completionList.size() == 0;
}
QString LaTeXCompletionModel::filterString(KTextEditor::View *view, const KTextEditor::Range &range,
@@ -443,8 +434,8 @@
QString s;
bool ignore = false;
- for(int i = 0; i < text.length(); ++i) {
- QChar c = text[i];
+ for (auto i : text) {
+ QChar c = i;
switch(c.unicode()) {
case '[':
case '{':
@@ -571,6 +562,8 @@
pos = 6;
}
break;
+ default:
+ break;
}
// update cursorposition and set bullet
@@ -645,9 +638,9 @@
QString LaTeXCompletionModel::buildWhiteSpaceString(const QString &s) const
{
QString whitespace = s;
- for(int i = 0; i < whitespace.length(); ++i) {
- if(!whitespace[i].isSpace()) {
- whitespace[i] = ' ';
+ for (auto &&i : whitespace) {
+ if(!i.isSpace()) {
+ i = ' ';
}
}
return whitespace;
@@ -659,10 +652,6 @@
setHasGroups(false);
}
-AbbreviationCompletionModel::~AbbreviationCompletionModel()
-{
-}
-
QModelIndex AbbreviationCompletionModel::index(int row, int column, const QModelIndex &parent) const
{
if (row < 0 || row >= m_completionList.count() || column < 0 || column >= ColumnCount || parent.isValid()) {
@@ -677,8 +666,8 @@
if(index.column() != KTextEditor::CodeCompletionModel::Name) {
return QVariant();
}
- switch(role) {
- case Qt::DisplayRole:
+
+ if (role == Qt::DisplayRole) {
return m_completionList.at(index.row());
}
@@ -714,11 +703,8 @@
const QString ¤tCompletion)
{
Q_UNUSED(currentCompletion);
- if(view->cursorPosition() < range.start() || view->cursorPosition() > range.end()
- || m_completionList.size() == 0) {
- return true;
- }
- return false;
+ return view->cursorPosition() < range.start() || view->cursorPosition() > range.end()
+ || m_completionList.empty();
}
void AbbreviationCompletionModel::completionInvoked(KTextEditor::View *view, const KTextEditor::Range &range,
@@ -791,7 +777,7 @@
if (completionText.indexOf("%C") >= 0) {
KTextEditor::Range searchrange = KTextEditor::Range(word.start(),document->lines()+1,0);
QVector rangevec = document->searchText(searchrange,"%C");
- if (rangevec.size() >= 1) {
+ if (!rangevec.empty()) {
KTextEditor::Range range = rangevec.at(0);
document->removeText(range);
if (view) {
@@ -832,10 +818,6 @@
m_firstConfig = true;
}
-Manager::~Manager()
-{
-}
-
QStringList Manager::getLaTeXCommands() const
{
return m_texWordList;
@@ -988,7 +970,6 @@
QString Manager::getCommandsString(KileDocument::CmdAttribute attrtype)
{
QStringList cmdlist;
- QStringList::ConstIterator it;
// get info about user-defined references
KileDocument::LatexCommands *cmd = m_ki->latexCommands();
@@ -996,11 +977,11 @@
// build list of references
QString commands;
- for(it = cmdlist.constBegin(); it != cmdlist.constEnd(); ++it) {
- if(cmd->isStarredEnv(*it) ) {
- commands += '|' + (*it).mid(1) + '*';
+ for(const auto &it : cmdlist) {
+ if(cmd->isStarredEnv(it) ) {
+ commands += '|' + it.mid(1) + '*';
}
- commands += '|' + (*it).mid(1);
+ commands += '|' + it.mid(1);
}
return commands;
}
@@ -1008,7 +989,6 @@
void Manager::addUserDefinedLaTeXCommands(QStringList &wordlist)
{
QStringList cmdlist;
- QStringList::ConstIterator it;
KileDocument::LatexCmdAttributes attr;
// get info about user-defined commands and environments
@@ -1016,16 +996,16 @@
cmd->commandList(cmdlist, KileDocument::CmdAttrNone, true);
// add entries to wordlist
- for(it = cmdlist.constBegin(); it != cmdlist.constEnd(); ++it) {
- if(cmd->commandAttributes(*it, attr)) {
+ for(const auto &it : cmdlist) {
+ if(cmd->commandAttributes(it, attr)) {
QString command,eos;
QStringList entrylist;
if(attr.type < KileDocument::CmdAttrLabel) { // environment
- command = "\\begin{" + (*it);
+ command = "\\begin{" + it;
eos = '}';
}
else { // command
- command = (*it);
+ command = it;
// eos.clear();
}
@@ -1042,9 +1022,8 @@
}
// finally append entries to wordlist
- QStringList::ConstIterator itentry;
- for(itentry = entrylist.constBegin(); itentry != entrylist.constEnd(); ++itentry) {
- QString entry = (*itentry);
+ for(const auto &itentry : entrylist) {
+ QString entry = itentry;
if(!attr.parameter.isEmpty()) {
entry += "{param}";
}
@@ -1106,10 +1085,10 @@
static void getCwlFiles(QMap &map, const QString &dir)
{
QStringList files = QDir(dir, "*.cwl").entryList();
- for (QStringList::ConstIterator it = files.constBegin(); it != files.constEnd(); ++it) {
- QString filename = QFileInfo(*it).fileName();
+ for (const auto &file : files) {
+ QString filename = QFileInfo(file).fileName();
if(!map.contains(filename)) {
- map[filename] = dir + '/' + (*it);
+ map[filename] = dir + '/' + file;
}
}
}
@@ -1130,9 +1109,9 @@
QString globalDir;
const QStringList dirs = QStandardPaths::locateAll(QStandardPaths::DataLocation, "complete", QStandardPaths::LocateDirectory);
- for(QStringList::ConstIterator it = dirs.constBegin(); it != dirs.constEnd(); ++it) {
- if((*it) != localDir) {
- globalDir = (*it);
+ for (const auto &dir : dirs) {
+ if(dir != localDir) {
+ globalDir = dir;
break;
}
}
diff --git a/src/configtester.h b/src/configtester.h
--- a/src/configtester.h
+++ b/src/configtester.h
@@ -46,7 +46,7 @@
enum Status { Success = 2, Failure = 1, NotRun = 0 };
ConfigTest(const QString& testGroup, const QString &name, bool isCritical);
- virtual ~ConfigTest();
+ virtual ~ConfigTest() = default;
int status() const;
@@ -84,7 +84,7 @@
Q_OBJECT
public:
OkularVersionTest(const QString& testGroup, bool isCritical);
- ~OkularVersionTest();
+ ~OkularVersionTest() = default;
virtual void call();
@@ -99,7 +99,7 @@
Q_OBJECT
public:
FindProgramTest(const QString& testGroup, const QString& programName, bool isCritical);
- ~FindProgramTest();
+ ~FindProgramTest() = default;
virtual void call();
@@ -115,7 +115,7 @@
Q_OBJECT
public:
TestToolInKileTest(const QString& testGroup, KileInfo *kileInfo, const QString& toolName, const QString& filePath, bool isCritical);
- ~TestToolInKileTest();
+ ~TestToolInKileTest() = default;
virtual void call();
@@ -167,7 +167,7 @@
public:
LaTeXSrcSpecialsSupportTest(const QString& testGroup, const QString& workingDir,
const QString& fileBaseName);
- ~LaTeXSrcSpecialsSupportTest();
+ ~LaTeXSrcSpecialsSupportTest() = default;
protected:
QString m_fileBaseName;
@@ -183,7 +183,7 @@
public:
SyncTeXSupportTest(const QString& testGroup, const QString& toolName, const QString& workingDir,
const QString& fileBaseName);
- ~SyncTeXSupportTest();
+ ~SyncTeXSupportTest() = default;
protected:
QString m_fileBaseName;
diff --git a/src/configtester.cpp b/src/configtester.cpp
--- a/src/configtester.cpp
+++ b/src/configtester.cpp
@@ -49,10 +49,6 @@
{
}
-ConfigTest::~ConfigTest()
-{
-}
-
int ConfigTest::status() const
{
return m_status;
@@ -80,7 +76,7 @@
bool ConfigTest::allDependenciesSucceeded() const
{
- Q_FOREACH(ConfigTest *test, m_dependencyTestList) {
+ for (auto &test : m_dependencyTestList) {
if(test->status() != Success) {
return false;
}
@@ -227,10 +223,6 @@
{
}
-TestToolInKileTest::~TestToolInKileTest()
-{
-}
-
void TestToolInKileTest::call()
{
KileDocument::TextInfo *textInfo = m_ki->docManager()->fileOpen(QUrl::fromLocalFile(m_filePath));
@@ -299,10 +291,6 @@
{
}
-OkularVersionTest::~OkularVersionTest()
-{
-}
-
void OkularVersionTest::call()
{
KPluginLoader pluginLoader(OKULAR_LIBRARY_NAME);
@@ -339,10 +327,6 @@
{
}
-FindProgramTest::~FindProgramTest()
-{
-}
-
void FindProgramTest::call()
{
QString execPath = QStandardPaths::findExecutable(m_programName);
@@ -489,10 +473,6 @@
setName(i18n("Source Specials Switch"));
}
-LaTeXSrcSpecialsSupportTest::~LaTeXSrcSpecialsSupportTest()
-{
-}
-
void LaTeXSrcSpecialsSupportTest::processFinishedSuccessfully()
{
// before we can report success, we still have to perform the
@@ -539,10 +519,6 @@
setName(i18n("SyncTeX Support"));
}
-SyncTeXSupportTest::~SyncTeXSupportTest()
-{
-}
-
void SyncTeXSupportTest::reportSuccess()
{
m_resultText = i18n("Supported, use the 'Modern' configuration for PDFLaTeX and XeLaTeX to auto-enable inverse and forward search capabilities.");
diff --git a/src/configurationmanager.h b/src/configurationmanager.h
--- a/src/configurationmanager.h
+++ b/src/configurationmanager.h
@@ -34,7 +34,7 @@
* Constructs a new Manager object.
**/
explicit Manager(KileInfo *info, QObject *parent = Q_NULLPTR, const char *name = Q_NULLPTR);
- virtual ~Manager();
+ virtual ~Manager() = default;
Q_SIGNALS:
/**
diff --git a/src/configurationmanager.cpp b/src/configurationmanager.cpp
--- a/src/configurationmanager.cpp
+++ b/src/configurationmanager.cpp
@@ -24,10 +24,6 @@
setObjectName(name);
}
-Manager::~Manager() {
-
-}
-
void Manager::emitConfigChanged()
{
emit configChanged();
diff --git a/src/convert.h b/src/convert.h
--- a/src/convert.h
+++ b/src/convert.h
@@ -82,7 +82,7 @@
{
public:
explicit ConvertIO(KTextEditor::Document *doc);
- virtual ~ConvertIO() {}
+ virtual ~ConvertIO() = default;
virtual void nextLine(); //read next line
virtual QString& currentLine();
@@ -114,7 +114,7 @@
{
public:
ConvertBase(const QString & encoding, ConvertIO * io);
- virtual ~ConvertBase() {};
+ virtual ~ConvertBase() = default;;
public:
virtual bool convert();
diff --git a/src/convert.cpp b/src/convert.cpp
--- a/src/convert.cpp
+++ b/src/convert.cpp
@@ -73,9 +73,9 @@
QString ConvertMap::isoNameFor(const QString & name)
{
QString std;
- for(int i = 0; i < name.length(); ++i) {
- if(!name[i].isSpace()) {
- std += name[i];
+ for (auto i : name) {
+ if(!i.isSpace()) {
+ std += i;
}
}
@@ -309,7 +309,7 @@
else {
QChar nextChar = m_io->currentLine()[i++];
if(!nextChar.isSpace()) {
- seq += (QString)nextChar;
+ seq += nextChar;
}
}
}
diff --git a/src/data/symbols-ng/convertOldSymbolFormat.cpp b/src/data/symbols-ng/convertOldSymbolFormat.cpp
--- a/src/data/symbols-ng/convertOldSymbolFormat.cpp
+++ b/src/data/symbols-ng/convertOldSymbolFormat.cpp
@@ -150,7 +150,6 @@
void outputXML(const QString latexCommand, const QString imageCommand, QList< Package >& packages, bool mathMode)
{
- Package pkg;
QString output;
output = "\n";
if(imageCommand == latexCommand) {
@@ -165,7 +164,7 @@
output += " true\n";
}
- foreach(pkg, packages) {
+ for (Package pkg : packages) {
if(pkg.name.isEmpty()) {
continue;
}
@@ -186,7 +185,6 @@
QRegExp rePkgs("(?:\\[(.*)\\])?\\{(.*)\\}");
QStringList args,pkgs;
- Package pkg;
if(string.isEmpty()) {
return;
@@ -203,6 +201,7 @@
}
for(int i = 0 ; i < pkgs.count() && i < args.count() ; i++) {
+ Package pkg;
pkg.name = pkgs.at(i);
pkg.arguments = args.at(i);
packages.append(pkg);
diff --git a/src/dialogs/findfilesdialog.cpp b/src/dialogs/findfilesdialog.cpp
--- a/src/dialogs/findfilesdialog.cpp
+++ b/src/dialogs/findfilesdialog.cpp
@@ -641,6 +641,7 @@
}
QStringList tokens = files_temp.split(' ', QString::SkipEmptyParts);
+
QStringList::Iterator it = tokens.begin();
if (it != tokens.end()) {
files = " '" + (*it) + '\'';
@@ -864,7 +865,6 @@
QString FindFilesDialog::getCommandList(KileDocument::CmdAttribute attrtype)
{
QStringList cmdlist;
- QStringList::ConstIterator it;
// get info about user-defined references
KileDocument::LatexCommands *cmd = m_ki->latexCommands();
@@ -872,8 +872,8 @@
// build list of references
QString commands;
- for (it = cmdlist.constBegin(); it != cmdlist.constEnd(); ++it) {
- commands += '|' + (*it).mid(1);
+ for (const auto &cmdIt : cmdlist) {
+ commands += '|' + cmdIt.mid(1);
}
return commands;
}
diff --git a/src/dialogs/latexcommanddialog.cpp b/src/dialogs/latexcommanddialog.cpp
--- a/src/dialogs/latexcommanddialog.cpp
+++ b/src/dialogs/latexcommanddialog.cpp
@@ -35,6 +35,7 @@
#include
#include
#include
+#include
#include "kileconfig.h"
#include "kiledebug.h"
@@ -276,7 +277,7 @@
void NewLatexCommand::getParameter(QString &name, KileDocument::LatexCmdAttributes &attr)
{
name = m_edName->text();
- if(m_envmode == false && name.at(0) != '\\') {
+ if(!m_envmode && name.at(0) != '\\') {
name.prepend('\\');
}
@@ -312,7 +313,7 @@
}
QString name = m_edName->text();
- if (m_envmode == false && name.at(0) != '\\') {
+ if (!m_envmode && name.at(0) != '\\') {
name.prepend('\\');
}
@@ -400,12 +401,11 @@
m_lviInputs = new QTreeWidgetItem(m_widget.commands, QStringList(i18n("Includes")));
QStringList list;
- QStringList::ConstIterator it;
KileDocument::LatexCmdAttributes attr;
m_commands->commandList(list, KileDocument::CmdAttrNone, m_widget.showOnlyUserDefined->isChecked());
- for (it = list.constBegin(); it != list.constEnd(); ++it) {
- if (m_commands->commandAttributes(*it, attr)) {
+ for (const auto &it : list) {
+ if (m_commands->commandAttributes(it, attr)) {
QTreeWidgetItem *parent;
switch (attr.type) {
case KileDocument::CmdAttrAmsmath:
@@ -441,7 +441,7 @@
default:
continue;
}
- setEntry(parent, *it, attr);
+ setEntry(parent, it, attr);
}
}
}
diff --git a/src/dialogs/listselector.cpp b/src/dialogs/listselector.cpp
--- a/src/dialogs/listselector.cpp
+++ b/src/dialogs/listselector.cpp
@@ -110,11 +110,10 @@
void KileListSelector::insertStringList(const QStringList &list)
{
- QStringList::ConstIterator it;
- for (it = list.begin(); it != list.end(); ++it) {
- QTreeWidgetItem *item = new QTreeWidgetItem(m_listView, QStringList(*it));
+ for (const auto &it : list) {
+ QTreeWidgetItem *item = new QTreeWidgetItem(m_listView, QStringList(it));
- if (it == list.begin()) {
+ if (it == list.first()) {
m_listView->setCurrentItem(item);
}
}
@@ -202,7 +201,7 @@
QStringList list = KileCodeCompletion::Manager::getAllCwlFiles(m_localCompletionDirectory, m_globalCompletionDirectory).uniqueKeys();
std::sort(list.begin(), list.end());
m_listView->clear();
- foreach(QString filename, list) {
+ for (QString filename : list) {
QString expectedLocalPath = m_localCompletionDirectory + '/' + filename;
QString expectedGlobalPath = m_globalCompletionDirectory + '/' + filename;
if (QFileInfo(expectedLocalPath).exists() && QFileInfo(expectedLocalPath).isReadable()) {
@@ -233,7 +232,7 @@
}
QDir workPath(m_localCompletionDirectory);
- foreach (QString file, files) {
+ for (QString file : files) {
QFileInfo fileInf(file);
QFileInfo localFile(m_localCompletionDirectory + '/' + fileInf.fileName());
if (localFile.exists()) {
@@ -275,7 +274,7 @@
m_listView->sortItems(0, Qt::AscendingOrder);
// Info about preselected files.
- if (someFileAdded == true) {
+ if (someFileAdded) {
KMessageBox::information(this,
i18n("The custom files have been installed and preselected for adding."),
i18n("Installation Successful"));
diff --git a/src/dialogs/managetemplatesdialog.cpp b/src/dialogs/managetemplatesdialog.cpp
--- a/src/dialogs/managetemplatesdialog.cpp
+++ b/src/dialogs/managetemplatesdialog.cpp
@@ -208,9 +208,8 @@
QTreeWidgetItem* previousItem = Q_NULLPTR;
m_templateList->clear();
- for (KileTemplate::TemplateListIterator i = templateList.begin(); i != templateList.end(); ++i)
+ for (const auto &info : templateList)
{
- KileTemplate::Info info = *i;
QFileInfo iconFileInfo(info.icon);
mode = (QFileInfo(info.path).isWritable() && (!iconFileInfo.exists() || iconFileInfo.isWritable())) ? " " : "*";
if ((type == KileDocument::Undefined) || (info.type == type)) {
diff --git a/src/dialogs/mathenvironmentdialog.cpp b/src/dialogs/mathenvironmentdialog.cpp
--- a/src/dialogs/mathenvironmentdialog.cpp
+++ b/src/dialogs/mathenvironmentdialog.cpp
@@ -162,10 +162,9 @@
{
// read all math environments and insert them into the combobox
QStringList list;
- QStringList::ConstIterator it;
m_latexCommands->commandList(list, (uint)(KileDocument::CmdAttrAmsmath | KileDocument::CmdAttrMath), false);
- for (it = list.constBegin(); it != list.constEnd(); ++it) {
- m_coEnvironment->addItem(*it);
+ for (const auto &item : list) {
+ m_coEnvironment->addItem(item);
}
}
diff --git a/src/dialogs/pdf-wizard/pdfdialog.cpp b/src/dialogs/pdf-wizard/pdfdialog.cpp
--- a/src/dialogs/pdf-wizard/pdfdialog.cpp
+++ b/src/dialogs/pdf-wizard/pdfdialog.cpp
@@ -76,9 +76,9 @@
if(!texfilename.isEmpty()) {
// working with a pdf document, so we try to determine the LaTeX source file
QStringList extlist = latexextensions.split(' ');
- for (QStringList::Iterator it = extlist.begin(); it != extlist.end(); ++it) {
- if (texfilename.indexOf((*it), -(*it).length()) >= 0) {
- pdffilename = texfilename.left(texfilename.length() - (*it).length()) + ".pdf";
+ for (auto &ext : extlist) {
+ if (texfilename.indexOf(ext, -ext.length()) >= 0) {
+ pdffilename = texfilename.left(texfilename.length() - ext.length()) + ".pdf";
if (!QFileInfo(pdffilename).exists())
pdffilename.clear();
break;
@@ -1549,7 +1549,7 @@
bool ok;
QBitArray arr(m_numpages + 1,false);
QStringList pagelist = param.split(',');
- foreach (const QString &s, pagelist) {
+ for (const QString &s : pagelist) {
if ( s.contains('-') && re.indexIn(s) >= 0 ) {
int from = re.cap(1).toInt(&ok);
int to = re.cap(2).toInt(&ok);
@@ -1625,7 +1625,7 @@
// analyze page list
bool ok;
QStringList pagelist = param.split(',');
- foreach (const QString &s, pagelist) {
+ for (const QString &s : pagelist) {
if ( s.contains('-') && re.indexIn(s)>=0 ) {
int from = re.cap(1).toInt(&ok);
int to = re.cap(2).toInt(&ok);
diff --git a/src/dialogs/projectdialogs.h b/src/dialogs/projectdialogs.h
--- a/src/dialogs/projectdialogs.h
+++ b/src/dialogs/projectdialogs.h
@@ -47,7 +47,7 @@
public:
KileProjectDialogBase(const QString &caption, KileDocument::Extensions *extensions, QWidget *parent = Q_NULLPTR, const char * name = Q_NULLPTR);
- virtual ~KileProjectDialogBase();
+ virtual ~KileProjectDialogBase() = default;
void setProject(KileProject *project, bool override);
virtual KileProject * project();
diff --git a/src/dialogs/projectdialogs.cpp b/src/dialogs/projectdialogs.cpp
--- a/src/dialogs/projectdialogs.cpp
+++ b/src/dialogs/projectdialogs.cpp
@@ -90,7 +90,7 @@
m_defaultGraphicsExtensionCombo = new QComboBox(this);
KileDocument::Extensions extManager;
QStringList imageExtensions = extManager.images().split(' ');
- foreach (const QString &extension, imageExtensions) {
+ for (const QString &extension : imageExtensions) {
const QString extName = extension.mid(1); // all characters right of "."
m_defaultGraphicsExtensionCombo->addItem(extension, extName);
}
@@ -127,10 +127,6 @@
QWidget::setTabOrder(m_defaultLatexFileExtensionsCombo, m_defaultLatexFileExtensions);
}
-KileProjectDialogBase::~KileProjectDialogBase()
-{
-}
-
void KileProjectDialogBase::onExtensionsIndexChanged(int index)
{
m_userFileExtensions->setText(m_val_extensions[index]);
@@ -150,11 +146,10 @@
m_val_extensions[i-1] = m_val_extensions[i-1].trimmed();
if (! m_val_extensions[i-1].isEmpty()) {
// some tiny extension checks
- QStringList::ConstIterator it;
QStringList list = m_val_extensions[i-1].split(' ');
- for (it = list.constBegin(); it != list.constEnd(); ++it) {
- if (! reg.exactMatch(*it)) {
- KMessageBox::error(this, i18n("Error in extension") + " '" + (*it) + "':\n" + i18n("All user-defined extensions should look like '.xyz'"), i18n("Invalid extension"));
+ for (const auto &item : list) {
+ if (! reg.exactMatch(item)) {
+ KMessageBox::error(this, i18n("Error in extension") + " '" + item + "':\n" + i18n("All user-defined extensions should look like '.xyz'"), i18n("Invalid extension"));
return false;
}
}
diff --git a/src/dialogs/scriptshortcutdialog.cpp b/src/dialogs/scriptshortcutdialog.cpp
--- a/src/dialogs/scriptshortcutdialog.cpp
+++ b/src/dialogs/scriptshortcutdialog.cpp
@@ -62,7 +62,7 @@
// search for all action collections (needed for shortcut conflicts)
QList allCollections;
- foreach ( KXMLGUIClient *client, ki->mainWindow()->guiFactory()->clients() ) {
+ for (KXMLGUIClient *client : ki->mainWindow()->guiFactory()->clients()) {
allCollections += client->actionCollection();
}
m_scriptShortcutDialog.m_keyChooser->setCheckActionCollections(allCollections);
diff --git a/src/dialogs/tabular/newtabulardialog.cpp b/src/dialogs/tabular/newtabulardialog.cpp
--- a/src/dialogs/tabular/newtabulardialog.cpp
+++ b/src/dialogs/tabular/newtabulardialog.cpp
@@ -235,7 +235,6 @@
{
/* read all tabular environments and insert them into the combobox */
QStringList list;
- QStringList::ConstIterator it;
m_latexCommands->commandList(list, KileDocument::CmdAttrTabular, false);
m_cmbName->addItems(list);
@@ -272,7 +271,7 @@
{
QList checkColumns;
- foreach(QTableWidgetItem *item, m_Table->selectedItems()) {
+ for(QTableWidgetItem *item : m_Table->selectedItems()) {
item->setTextAlignment(alignment | Qt::AlignVCenter);
int column = item->column();
@@ -281,7 +280,7 @@
}
}
- foreach(int column, checkColumns) {
+ for(int column : checkColumns) {
if(checkForColumnAlignment(column)) {
static_cast(m_Table->horizontalHeaderItem(column))->setAlignment(alignment);
}
@@ -795,7 +794,7 @@
bool unsetBold = false;
bool unsetItalic = false;
bool unsetUnderline = false;
- foreach(QTableWidgetItem *item, selectedItems) {
+ for (QTableWidgetItem *item : selectedItems) {
if(!unsetBold && !item->font().bold()) {
m_acBold->setChecked(false);
unsetBold = true;
@@ -862,7 +861,7 @@
void NewTabularDialog::slotBold()
{
- foreach(QTableWidgetItem *item, m_Table->selectedItems()) {
+ for(QTableWidgetItem *item : m_Table->selectedItems()) {
QFont font = item->font();
font.setBold(!font.bold());
item->setFont(font);
@@ -872,7 +871,7 @@
void NewTabularDialog::slotItalic()
{
- foreach(QTableWidgetItem *item, m_Table->selectedItems()) {
+ for (QTableWidgetItem *item : m_Table->selectedItems()) {
QFont font = item->font();
font.setItalic(!font.italic());
item->setFont(font);
@@ -882,7 +881,7 @@
void NewTabularDialog::slotUnderline()
{
- foreach(QTableWidgetItem *item, m_Table->selectedItems()) {
+ for (QTableWidgetItem *item : m_Table->selectedItems()) {
QFont font = item->font();
font.setUnderline(!font.underline());
item->setFont(font);
@@ -906,7 +905,7 @@
int newColumnSpan = columns.size();
/* check for already joined cells in range */
- foreach(int column, columns) {
+ for (int column : columns) {
int thisColumnSpan = m_Table->columnSpan(row, column);
if(thisColumnSpan > 1) {
newColumnSpan = qMax(newColumnSpan, thisColumnSpan + column - columns.first());
@@ -936,7 +935,7 @@
void NewTabularDialog::slotFrame(int border)
{
- foreach(QTableWidgetItem *item, m_Table->selectedItems()) {
+ for (QTableWidgetItem *item : m_Table->selectedItems()) {
static_cast(item)->setBorder(border);
}
}
@@ -944,7 +943,7 @@
void NewTabularDialog::slotBackground(const QColor &color)
{
m_clCurrentBackground = color;
- foreach(QTableWidgetItem *item, m_Table->selectedItems()) {
+ for (QTableWidgetItem *item : m_Table->selectedItems()) {
item->setBackground(color);
}
m_acBackground->setIcon(generateColorIcon(true));
@@ -954,7 +953,7 @@
void NewTabularDialog::slotForeground(const QColor &color)
{
m_clCurrentForeground = color;
- foreach(QTableWidgetItem *item, m_Table->selectedItems()) {
+ for (QTableWidgetItem *item : m_Table->selectedItems()) {
item->setForeground(color);
}
m_acBackground->setIcon(generateColorIcon(true));
@@ -973,14 +972,14 @@
void NewTabularDialog::slotClearText()
{
- foreach(QTableWidgetItem *item, m_Table->selectedItems()) {
+ for (QTableWidgetItem *item : m_Table->selectedItems()) {
item->setText(QString());
}
}
void NewTabularDialog::slotClearAttributes()
{
- foreach(QTableWidgetItem *item, m_Table->selectedItems()) {
+ for (QTableWidgetItem *item : m_Table->selectedItems()) {
item->setTextAlignment(Qt::AlignLeft | Qt::AlignVCenter);
QFont font = item->font();
font.setBold(false);
diff --git a/src/dialogs/texdocumentationdialog.cpp b/src/dialogs/texdocumentationdialog.cpp
--- a/src/dialogs/texdocumentationdialog.cpp
+++ b/src/dialogs/texdocumentationdialog.cpp
@@ -260,10 +260,10 @@
QStringList extlist = QString(",.gz,.bz2").split(',', QString::KeepEmptyParts);
QString filename;
- for (QStringList::Iterator itp = pathlist.begin(); itp != pathlist.end(); ++itp) {
- for (QStringList::Iterator ite = extlist.begin(); ite != extlist.end(); ++ite) {
- filename = (subdir.isEmpty()) ? (*itp) + '/' + docfilename + (*ite)
- : (*itp) + '/' + subdir + '/' + docfilename + (*ite);
+ for (auto &itp : pathlist) {
+ for (auto &ite : extlist) {
+ filename = subdir.isEmpty() ? itp + '/' + docfilename + ite
+ : itp + '/' + subdir + '/' + docfilename + ite;
KILE_DEBUG_MAIN << "search file: " << filename << endl;
if(QFile::exists(filename)) {
return filename;
@@ -281,9 +281,8 @@
ext = "txt";
}
- if(m_tempfile) {
- delete m_tempfile;
- }
+ delete m_tempfile;
+
m_tempfile = new QTemporaryFile(QDir::tempPath() + QLatin1String("/kile_XXXXXX.") + ext);
m_tempfile->setAutoRemove(true);
@@ -314,9 +313,8 @@
return;
}
- if (m_tempfile) {
- delete m_tempfile;
- }
+ delete m_tempfile;
+
m_tempfile = new QTemporaryFile();
m_tempfile->setAutoRemove(true);
@@ -511,9 +509,8 @@
void TexDocDialog::executeScript(const QString &command)
{
- if (m_proc) {
- delete m_proc;
- }
+
+ delete m_proc;
m_proc = new KProcess();
m_proc->setShellCommand(command);
diff --git a/src/dialogs/usermenu/usermenudialog.cpp b/src/dialogs/usermenu/usermenudialog.cpp
--- a/src/dialogs/usermenu/usermenudialog.cpp
+++ b/src/dialogs/usermenu/usermenudialog.cpp
@@ -62,7 +62,7 @@
// search for all action collections (needed for shortcut conflicts)
QList allCollections;
- foreach (KXMLGUIClient *client, m_ki->mainWindow()->guiFactory()->clients()) {
+ for (KXMLGUIClient *client : m_ki->mainWindow()->guiFactory()->clients()) {
KILE_DEBUG_MAIN << "collection count: " << client->actionCollection()->count() ;
allCollections += client->actionCollection();
}
diff --git a/src/dialogs/usermenu/usermenutree.cpp b/src/dialogs/usermenu/usermenutree.cpp
--- a/src/dialogs/usermenu/usermenutree.cpp
+++ b/src/dialogs/usermenu/usermenutree.cpp
@@ -112,7 +112,7 @@
#else
// Returns the environment of the calling process as a list of key=value pairs.
QStringList environment = QProcess::systemEnvironment();
- foreach ( const QString &s, environment ) {
+ for ( const QString &s : environment ) {
if ( s.startsWith(QLatin1String("PATH=")) ) {
envpath = s.mid(5);
break;
@@ -1043,7 +1043,7 @@
}
else {
msg += "";
- foreach ( const QString &s, list ) {
+ for (const QString &s : list) {
msg += "- " + s + "
";
}
msg += "
";
diff --git a/src/docpart.h b/src/docpart.h
--- a/src/docpart.h
+++ b/src/docpart.h
@@ -25,7 +25,7 @@
public:
explicit DocumentationViewer(QWidget *parent = Q_NULLPTR);
- ~DocumentationViewer();
+ ~DocumentationViewer() = default;
bool backEnable();
bool forwardEnable();
diff --git a/src/docpart.cpp b/src/docpart.cpp
--- a/src/docpart.cpp
+++ b/src/docpart.cpp
@@ -39,10 +39,6 @@
KStandardAction::home(this, SLOT(home()), (QObject*)actionCollection());
}
-DocumentationViewer::~DocumentationViewer()
-{
-}
-
bool DocumentationViewer::urlSelected(const QString &url, int button, int state, const QString &_target, const KParts::OpenUrlArguments &args, const KParts::BrowserArguments & /* browserArgs */)
{
QUrl cURL = completeURL(url);
diff --git a/src/documentinfo.h b/src/documentinfo.h
--- a/src/documentinfo.h
+++ b/src/documentinfo.h
@@ -482,7 +482,7 @@
KileView::Manager *viewManager,
KileParser::Manager *parserManager);
- virtual ~LaTeXInfo();
+ virtual ~LaTeXInfo() = default;
virtual Type getType();
@@ -533,7 +533,7 @@
KileAbbreviation::Manager *abbreviationManager,
KileParser::Manager *parserManager,
LatexCommands* commands);
- virtual ~BibInfo();
+ virtual ~BibInfo() = default;
virtual bool isLaTeXRoot();
@@ -556,7 +556,7 @@
KileAbbreviation::Manager *abbreviationManager,
KileParser::Manager *parserManager);
- virtual ~ScriptInfo();
+ virtual ~ScriptInfo() = default;
virtual bool isLaTeXRoot();
diff --git a/src/documentinfo.cpp b/src/documentinfo.cpp
--- a/src/documentinfo.cpp
+++ b/src/documentinfo.cpp
@@ -193,7 +193,7 @@
updateStructLevelInfo();
}
-Info::~Info(void)
+Info::~Info()
{
KILE_DEBUG_MAIN << "DELETING DOCINFO" << this;
}
@@ -682,8 +682,7 @@
QList eventFilterList = createEventFilters(view);
if(!eventFilterList.isEmpty()) {
- for(QList::iterator i = eventFilterList.begin(); i != eventFilterList.end(); ++i) {
- QObject* eventFilter = *i;
+ for (auto eventFilter : eventFilterList) {
KileView::Manager::installEventFilter(view, eventFilter);
}
m_eventFilterHash[view] = eventFilterList;
@@ -695,10 +694,10 @@
QHash >::iterator i = m_eventFilterHash.find(view);
if(i != m_eventFilterHash.end()) {
QList eventFilterList = *i;
- for(QList::iterator i2 = eventFilterList.begin(); i2 != eventFilterList.end(); ++i2) {
- QObject *eventFilter = *i2;
+ for (auto &i2 : eventFilterList) {
+ QObject *eventFilter = i2;
KileView::Manager::removeEventFilter(view, eventFilter);
- delete(*i2);
+ delete i2;
}
m_eventFilterHash.erase(i);
}
@@ -715,8 +714,8 @@
return;
}
QList views = m_doc->views();
- for(QList::iterator i = views.begin(); i != views.end(); ++i) {
- installEventFilters(*i);
+ for (auto &view : views) {
+ installEventFilters(view);
}
}
@@ -726,8 +725,8 @@
return;
}
QList views = m_doc->views();
- for(QList::iterator i = views.begin(); i != views.end(); ++i) {
- removeInstalledEventFilters(*i);
+ for (auto &view : views) {
+ removeInstalledEventFilters(view);
}
}
@@ -747,8 +746,8 @@
return;
}
QList views = m_doc->views();
- for(QList::iterator i = views.begin(); i != views.end(); ++i) {
- installSignalConnections(*i);
+ for (auto &view : views) {
+ installSignalConnections(view);
}
}
@@ -758,8 +757,8 @@
return;
}
QList views = m_doc->views();
- for(QList::iterator i = views.begin(); i != views.end(); ++i) {
- removeSignalConnections(*i);
+ for (auto &view : views) {
+ removeSignalConnections(view);
}
}
@@ -788,8 +787,8 @@
return;
}
QList views = m_doc->views();
- for(QList::iterator i = views.begin(); i != views.end(); ++i) {
- registerCodeCompletionModels(*i);
+ for (auto &view : views) {
+ registerCodeCompletionModels(view);
}
}
@@ -799,8 +798,8 @@
return;
}
QList views = m_doc->views();
- for(QList::iterator i = views.begin(); i != views.end(); ++i) {
- unregisterCodeCompletionModels(*i);
+ for (auto &view : views) {
+ unregisterCodeCompletionModels(view);
}
}
@@ -866,10 +865,6 @@
editorExtension);
}
-LaTeXInfo::~LaTeXInfo()
-{
-}
-
Type LaTeXInfo::getType()
{
return LaTeX;
@@ -957,34 +952,33 @@
// add user-defined commands
QStringList list;
- QStringList::ConstIterator it;
// labels, we also gather them
m_commands->commandList(list,KileDocument::CmdAttrLabel, false);
- for(it=list.constBegin(); it != list.constEnd(); ++it) {
- m_dictStructLevel[*it] = KileStructData(KileStruct::NotSpecified, KileStruct::Label, QString(), "labels");
+ for (const auto &item : list) {
+ m_dictStructLevel[item] = KileStructData(KileStruct::NotSpecified, KileStruct::Label, QString(), "labels");
}
// input files
if(m_showStructureInputFiles) {
m_commands->commandList(list, KileDocument::CmdAttrIncludes, false);
- for(it = list.constBegin(); it != list.constEnd(); ++it) {
- m_dictStructLevel[*it] = KileStructData(KileStruct::File, KileStruct::Input, "input-file");
+ for (const auto &item : list) {
+ m_dictStructLevel[item] = KileStructData(KileStruct::File, KileStruct::Input, "input-file");
}
}
// references
if(m_showStructureReferences) {
m_commands->commandList(list, KileDocument::CmdAttrReference, false);
- for(it=list.constBegin(); it != list.constEnd(); ++it ) {
- m_dictStructLevel[*it] = KileStructData(KileStruct::Hidden, KileStruct::Reference);
+ for (const auto &item : list) {
+ m_dictStructLevel[item] = KileStructData(KileStruct::Hidden, KileStruct::Reference);
}
}
//bibliography commands
m_commands->commandList(list,KileDocument::CmdAttrBibliographies, false);
- for(it=list.constBegin(); it != list.constEnd(); ++it) {
- m_dictStructLevel[*it] = KileStructData(0, KileStruct::Bibliography, "viewbib");
+ for (const auto &item : list) {
+ m_dictStructLevel[item] = KileStructData(0, KileStruct::Bibliography, "viewbib");
}
}
@@ -1118,10 +1112,6 @@
documentTypePromotionAllowed = false;
}
-BibInfo::~BibInfo()
-{
-}
-
bool BibInfo::isLaTeXRoot()
{
return false;
@@ -1166,10 +1156,6 @@
documentTypePromotionAllowed = false;
}
-ScriptInfo::~ScriptInfo()
-{
-}
-
bool ScriptInfo::isLaTeXRoot()
{
return false;
diff --git a/src/editorcommands.h b/src/editorcommands.h
--- a/src/editorcommands.h
+++ b/src/editorcommands.h
@@ -28,7 +28,7 @@
class EditorCommands : public KTextEditor::Command {
public:
explicit EditorCommands(KileInfo *info);
- virtual ~EditorCommands();
+ virtual ~EditorCommands() = default;
virtual bool exec(KTextEditor::View *view, const QString &cmd, QString &msg,
const KTextEditor::Range &range = KTextEditor::Range::invalid()) Q_DECL_OVERRIDE;
diff --git a/src/editorcommands.cpp b/src/editorcommands.cpp
--- a/src/editorcommands.cpp
+++ b/src/editorcommands.cpp
@@ -24,10 +24,6 @@
{
}
-EditorCommands::~EditorCommands()
-{
-}
-
bool EditorCommands::exec(KTextEditor::View *view, const QString &cmd, QString &msg,
const KTextEditor::Range &range)
{
diff --git a/src/editorextension.h b/src/editorextension.h
--- a/src/editorextension.h
+++ b/src/editorextension.h
@@ -40,7 +40,7 @@
public:
explicit EditorExtension(KileInfo *);
- ~EditorExtension();
+ ~EditorExtension() = default;
enum EnvType {EnvNone, EnvList, EnvTab, EnvCrTab};
diff --git a/src/editorextension.cpp b/src/editorextension.cpp
--- a/src/editorextension.cpp
+++ b/src/editorextension.cpp
@@ -83,9 +83,6 @@
readConfig();
}
-EditorExtension::~EditorExtension()
-{
-}
//////////////////// read configuration ////////////////////
@@ -223,6 +220,7 @@
}
else {
int py = para_begin, px = index_begin;
+ // TODO: clang-tody say this condition is always false
if(wrap) { //act as if cursor was at beginning of selected text (which is the point where the tagBegin is inserted)
py = para;
px = index;
@@ -372,8 +370,8 @@
}
bool ok1,ok2;
- for(QStringList::Iterator it = envlist.begin(); it != envlist.end(); ++it) {
- QStringList entry = (*it).split(',');
+ for (auto &it : envlist) {
+ QStringList entry = it.split(',');
if(entry[0] == "document") {
break;
}
@@ -428,7 +426,7 @@
{
// view will be checked in mathgroupRange()
KTextEditor::Range range = mathgroupRange(view);
- return (range.isValid()) ? true : false;
+ return range.isValid();
}
QString EditorExtension::getMathgroupText(KTextEditor::View *view)
@@ -613,12 +611,8 @@
}
// and additionally: if it is a math env, both tags must have the same name
- if(begin.tag == mmDisplaymathEnv && begin.envname != end.envname) {
- //KILE_DEBUG_MAIN << "error: opening and closing env tags have different names: " << begin.envname << " - " << end.envname;
- return false;
- }
+ return !(begin.tag == mmDisplaymathEnv && begin.envname != end.envname);
- return true;
}
bool EditorExtension::isOpeningMathTagPosition(KTextEditor::Document *doc, uint row, uint col, MathData &mathdata)
@@ -3381,9 +3375,9 @@
{
QString whitespace = s;
- for(int i = 0; i < whitespace.length(); ++i) {
- if(!whitespace[i].isSpace()) {
- whitespace[i] = ' ';
+ for(auto &i : whitespace) {
+ if(!i.isSpace()) {
+ i = ' ';
}
}
return whitespace;
@@ -3514,7 +3508,7 @@
QString text;
KTextEditor::Document::EditingTransaction transaction(doc);
- switch (id) {
+ switch(id) {
case KileWidget::StructureWidget::SectioningCut:
QApplication::clipboard()->setText(doc->text(KTextEditor::Range(row1, col1, row2, col2))); // copy -> clipboard
doc->removeText(KTextEditor::Range(row1, col1, row2, col2)); // delete
@@ -3558,7 +3552,7 @@
KTextEditor::Range documentRange(KTextEditor::Cursor(row, col), doc->documentEnd());
QVector foundRanges = doc->searchText(documentRange, "\\end{document}");
- if(foundRanges.size() >= 1) {
+ if(!foundRanges.empty()) {
KTextEditor::Range range = foundRanges.first();
if(range.isValid()) {
rowFound = range.start().line();
@@ -3581,8 +3575,8 @@
const QString lineString = doc->line(line);
int lastWhiteSpaceCharIndex = -1;
- for(int i = 0; i < lineString.length(); ++i) {
- if(!lineString[i].isSpace()) {
+ for(auto i : lineString) {
+ if(!i.isSpace()) {
break;
}
++lastWhiteSpaceCharIndex;
diff --git a/src/editorkeysequencemanager.h b/src/editorkeysequencemanager.h
--- a/src/editorkeysequencemanager.h
+++ b/src/editorkeysequencemanager.h
@@ -35,8 +35,8 @@
**/
class Action {
public:
- Action();
- virtual ~Action();
+ Action() = default;
+ virtual ~Action() = default;
/**
* The main method, which implements the "action" itself.
@@ -55,7 +55,7 @@
class ExecuteScriptAction : public Action {
public:
ExecuteScriptAction(KileScript::Script *script, KileScript::Manager *scriptManager);
- virtual ~ExecuteScriptAction();
+ virtual ~ExecuteScriptAction() = default;
virtual void execute();
virtual QString getDescription() const;
@@ -87,7 +87,7 @@
* Constructs a new manager object.
**/
explicit Manager(KileInfo* kileInfo, QObject *parent = 0, const char *name = 0);
- virtual ~Manager();
+ virtual ~Manager() = default;
/**
* Adds a new consequence and the corresponding action.
@@ -192,7 +192,7 @@
Q_OBJECT
public:
Recorder(KTextEditor::View *view, Manager *manager);
- virtual ~Recorder();
+ virtual ~Recorder() = default;
Q_SIGNALS:
/**
diff --git a/src/editorkeysequencemanager.cpp b/src/editorkeysequencemanager.cpp
--- a/src/editorkeysequencemanager.cpp
+++ b/src/editorkeysequencemanager.cpp
@@ -30,10 +30,6 @@
setObjectName(name);
}
-Manager::~Manager()
-{
-}
-
void Manager::addAction(const QString& seq, Action *action)
{
if(seq.isEmpty()) {
@@ -63,15 +59,15 @@
void Manager::removeKeySequence(const QStringList& l)
{
bool changed = false;
- for(QStringList::const_iterator i = l.begin(); i != l.end(); ++i) {
- if((*i).isEmpty()) {
+ for (const auto &i : l) {
+ if(i.isEmpty()) {
continue;
}
- QMap::iterator it = m_actionMap.find(*i);
+ QMap::iterator it = m_actionMap.find(i);
if(it != m_actionMap.end()) {
delete (it.value());
m_actionMap.erase(it);
- m_watchedKeySequencesList.removeAll(*i);
+ m_watchedKeySequencesList.removeAll(i);
changed = true;
}
}
@@ -136,8 +132,8 @@
}
bool Manager::isSequenceAssigned(const QString& seq) const {
- for(QList::const_iterator i = m_watchedKeySequencesList.begin(); i != m_watchedKeySequencesList.end(); ++i) {
- if((*i).startsWith(seq)) {
+ for (const auto &i : m_watchedKeySequencesList) {
+ if(i.startsWith(seq)) {
return true;
}
}
@@ -146,15 +142,15 @@
QPair Manager::checkSequence(const QString& seq, const QString& skip)
{
- for(QList::iterator i = m_watchedKeySequencesList.begin(); i != m_watchedKeySequencesList.end(); ++i) {
- if((*i) == skip) {
+ for (auto &i : m_watchedKeySequencesList) {
+ if(i == skip) {
continue;
}
- if((*i).startsWith(seq)) {
- return (*i == seq) ? qMakePair(1, seq) : qMakePair(2, *i);
+ if(i.startsWith(seq)) {
+ return (i == seq) ? qMakePair(1, seq) : qMakePair(2, i);
}
- if(!(*i).isEmpty() && seq.startsWith(*i)) {
- return qMakePair(3, *i);
+ if(!i.isEmpty() && seq.startsWith(i)) {
+ return qMakePair(3, i);
}
}
return qMakePair(0, QString());
@@ -171,10 +167,6 @@
reloadWatchedKeySequences();
}
-Recorder::~Recorder()
-{
-}
-
bool Recorder::eventFilter(QObject* /* o */, QEvent *e)
{
if (e->type() == QEvent::KeyPress) {
@@ -218,20 +210,14 @@
{
m_watchedKeySequencesList = m_manager->getWatchedKeySequences();
m_maxSequenceLength = 0;
- for(QStringList::iterator i = m_watchedKeySequencesList.begin(); i != m_watchedKeySequencesList.end(); ++i) {
- m_maxSequenceLength = qMax(m_maxSequenceLength, (*i).length());
+ for (auto &i : m_watchedKeySequencesList) {
+ m_maxSequenceLength = qMax(m_maxSequenceLength, i.length());
}
if(m_maxSequenceLength < m_typedSequence.length()) {
m_typedSequence = m_typedSequence.right(m_maxSequenceLength);
}
}
-Action::Action() {
-}
-
-Action::~Action() {
-}
-
QString Action::getDescription() const {
return QString();
}
@@ -240,10 +226,6 @@
{
}
-ExecuteScriptAction::~ExecuteScriptAction()
-{
-}
-
void ExecuteScriptAction::execute()
{
m_scriptManager->executeScript(m_script);
diff --git a/src/errorhandler.cpp b/src/errorhandler.cpp
--- a/src/errorhandler.cpp
+++ b/src/errorhandler.cpp
@@ -355,10 +355,8 @@
//print detailed error info
logWidget->setUpdatesEnabled(false);
- for(QList::const_iterator i = infoList.begin();
- i != infoList.end(); ++i) {
+ for (const auto &info : infoList) {
- const LatexOutputInfo& info = *i;
message = info.source() + ':' + QString::number(info.sourceLine()) + ':' + info.message();
switch(info.type()) {
case LatexOutputInfo::itmBadBox:
@@ -421,9 +419,7 @@
if(!m_currentLaTeXOutputHandler->logFile().isEmpty() && logFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
QHash hash;
- for(QList::const_iterator i = outputInfoList.begin();
- i != outputInfoList.end(); ++i) {
- LatexOutputInfo info = *i;
+ for (auto info : outputInfoList) {
hash[info.outputLine()] = info;
}
diff --git a/src/kile.cpp b/src/kile.cpp
--- a/src/kile.cpp
+++ b/src/kile.cpp
@@ -48,6 +48,7 @@
#include
#include
#include
+#include
#include "abbreviationmanager.h"
#include "configurationmanager.h"
@@ -992,23 +993,13 @@
m_actionMessageView->setChecked(true);
connect(m_actionMessageView, &KToggleAction::toggled, m_bottomBar, &Kile::setVisible);
connect(m_bottomBar, &KileWidget::SideBar::visibilityChanged, this, &Kile::sideOrBottomBarChanged);
- if(m_singlemode) {
- ModeAction->setChecked(false);
- }
- else {
- ModeAction->setChecked(true);
- }
+ ModeAction->setChecked(!m_singlemode);
WatchFileAction = new KToggleAction(i18n("Watch File Mode"), actionCollection());
actionCollection()->addAction("WatchFile", WatchFileAction);
WatchFileAction->setIcon(QIcon::fromTheme("watchfile"));
connect(WatchFileAction, &KToggleAction::toggled, this, &Kile::toggleWatchFile);
- if(m_bWatchFile) {
- WatchFileAction->setChecked(true);
- }
- else {
- WatchFileAction->setChecked(false);
- }
+ WatchFileAction->setChecked(m_bWatchFile);
createAction(i18n("TeX Guide"), "help_tex_guide", QKeySequence("CTRL+Alt+H, G"), m_help, &KileHelp::Help::helpTexGuide);
createAction(i18n("LaTeX"), "help_latex_index", QKeySequence("CTRL+Alt+H, L"), m_help, &KileHelp::Help::helpLatexIndex);
@@ -1073,8 +1064,7 @@
void Kile::createToolActions()
{
QStringList tools = KileTool::toolList(m_config.data());
- for (QStringList::iterator i = tools.begin(); i != tools.end(); ++i) {
- QString toolName = *i;
+ for (const auto &toolName : tools) {
if(!actionCollection()->action("tool_" + toolName)) {
KILE_DEBUG_MAIN << "Creating action for tool" << toolName;
createToolAction(toolName);
@@ -1100,7 +1090,7 @@
QStringList tools = KileTool::toolList(m_config.data());
QString toolMenu, grp;
QList *pl;
- QAction *act;
+ QAction * act;
ToolbarSelectAction *pSelectAction = Q_NULLPTR;
m_compilerActions->saveCurrentAction();
@@ -1109,8 +1099,8 @@
m_quickActions->saveCurrentAction();
// do plugActionList by hand ...
- foreach(act, m_listQuickActions) {
- m_buildMenuTopLevel->removeAction(act);
+ for (QAction *actToRemove : m_listQuickActions) {
+ m_buildMenuTopLevel->removeAction(actToRemove);
}
m_buildMenuCompile->clear();
@@ -1220,23 +1210,23 @@
KConfigGroup grp = m_config->group("ToolSelectAction");
- for(QStringList::Iterator it = list.begin(); it != list.end() ; ++it) {
- if ( *it == "Compile" ) {
+ for ( auto &it : list ) {
+ if (it == "Compile" ) {
pSelectAction = m_compilerActions;
}
- else if ( *it == "View" ) {
+ else if (it == "View" ) {
pSelectAction = m_viewActions;
}
- else if ( *it == "Convert" ) {
+ else if (it == "Convert" ) {
pSelectAction = m_convertActions;
}
- else if ( *it == "Quick" ) {
+ else if (it == "Quick" ) {
pSelectAction = m_quickActions;
}
KILE_DEBUG_MAIN << "current item is " << pSelectAction->currentItem();
- grp.writeEntry(*it, pSelectAction->currentItem());
+ grp.writeEntry(it, pSelectAction->currentItem());
}
}
@@ -1250,26 +1240,26 @@
KConfigGroup grp = m_config->group("ToolSelectAction");
- for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) {
- if ( *it == "Compile" ) {
+ for (auto &it : list) {
+ if (it == "Compile" ) {
pSelectAction = m_compilerActions;
defaultAction = 9; // PDFLatex
}
- else if ( *it == "View" ) {
+ else if (it == "View" ) {
pSelectAction = m_viewActions;
defaultAction = 4; // ViewPDF
}
- else if ( *it == "Convert" ) {
+ else if (it == "Convert" ) {
pSelectAction = m_convertActions;
defaultAction = 0;
}
- else if ( *it == "Quick" ) {
+ else if (it == "Quick" ) {
pSelectAction = m_quickActions;
defaultAction = 0;
}
- int actIndex = grp.readEntry(*it, defaultAction);
- KILE_DEBUG_MAIN << "selecting" << actIndex << "for" << *it;
+ int actIndex = grp.readEntry(it, defaultAction);
+ KILE_DEBUG_MAIN << "selecting" << actIndex << "for" << it;
pSelectAction->setCurrentItem(actIndex);
}
}
@@ -1397,9 +1387,7 @@
QList toolBarsList = toolBars();
QHash toolBarVisibilityHash;
- for(QList::iterator i = toolBarsList.begin();
- i != toolBarsList.end(); ++i) {
- KToolBar *toolBar = *i;
+ for ( auto toolBar : toolBarsList ) {
toolBarVisibilityHash[toolBar] = toolBar->isVisible();
}
@@ -1567,8 +1555,8 @@
KILE_DEBUG_MAIN << "#projects = " << docManager()->projects().count() << endl;
QList projectList = docManager()->projects();
- for(QList::iterator i = projectList.begin(); i != projectList.end(); ++i) {
- const QUrl url = (*i)->url();
+ for ( auto &i : projectList ) {
+ const QUrl url = i->url();
if(url.isEmpty()) { // shouldn't happen, but just in case...
continue;
}
@@ -1768,17 +1756,17 @@
{
// update action lists
QList actions = actionCollection()->actions();
- for(QList::iterator itact = actions.begin(); itact != actions.end(); ++itact) {
- if (m_dictMenuAction.contains((*itact)->objectName())
- || m_dictMenuFile.contains((*itact)->objectName())) {
- (*itact)->setEnabled(enable);
+ for ( auto &action : actions ) {
+ if (m_dictMenuAction.contains(action->objectName())
+ || m_dictMenuFile.contains(action->objectName())) {
+ action->setEnabled(enable);
}
}
// update latex usermenu actions
if ( m_userMenu ) {
QList useractions = m_userMenu->menuActions();
- foreach ( QAction *action, useractions ) {
+ for (QAction *action : useractions) {
action->setEnabled(enable);
}
}
@@ -1793,20 +1781,20 @@
<< m_listViewerActions
<< m_listOtherActions;
// enable or disable list actions
- for(QList::iterator i = actionList.begin(); i != actionList.end(); ++i) {
- (*i)->setEnabled(enable);
+ for ( auto &i : actionList ) {
+ i->setEnabled(enable);
}
// enable or disable bibliography menu entries
actionList = m_bibTagActionMenu->menu()->actions();
- for(QList::iterator it = actionList.begin(); it != actionList.end(); ++it) {
- (*it)->setEnabled(enable);
+ for (auto &it : actionList ) {
+ it->setEnabled(enable);
}
QStringList menuList;
menuList << "file" << "edit" << "view" << "menu_build" << "menu_project" << "menu_latex" << "wizard" << "tools";
- for(QStringList::iterator it = menuList.begin(); it != menuList.end(); ++it) {
- QMenu *menu = dynamic_cast(guiFactory()->container(*it, this));
+ for ( auto &it : menuList ) {
+ QMenu *menu = dynamic_cast(guiFactory()->container(it, this));
if(menu) {
updateMenuActivationStatus(menu);
}
@@ -1950,8 +1938,8 @@
void Kile::setMenuItems(QStringList &list, QMap &dict)
{
- for ( QStringList::Iterator it=list.begin(); it!=list.end(); ++it ) {
- dict[(*it)] = true;
+ for ( auto &it : list ) {
+ dict[it] = true;
}
}
@@ -2006,8 +1994,7 @@
bool enabled = false;
QList actionList = menu->actions();
- for(QList::iterator it = actionList.begin(); it != actionList.end(); ++it) {
- QAction *action = *it;
+ for ( auto action : actionList ) {
QMenu *subMenu = action->menu();
if(subMenu) {
QSet newVisited(visited);
@@ -2546,18 +2533,13 @@
KileConfig::setMainwindowHeight(height());
QList sizes;
- QList::Iterator it;
- sizes = m_horizontalSplitter->sizes();
- it = sizes.begin();
- KileConfig::setHorizontalSplitterLeft(*it);
- ++it;
- KileConfig::setHorizontalSplitterRight(*it);
- sizes.clear();
- sizes = m_verticalSplitter->sizes();
- it = sizes.begin();
- KileConfig::setVerticalSplitterTop(*it);
- ++it;
- KileConfig::setVerticalSplitterBottom(*it);
+ KileConfig::setHorizontalSplitterLeft(m_horizontalSplitter->sizes()[0]);
+ KileConfig::setHorizontalSplitterRight(m_horizontalSplitter->sizes()[1]);
+ m_horizontalSplitter->sizes().clear();
+
+ KileConfig::setVerticalSplitterTop(m_verticalSplitter->sizes()[0]);
+ KileConfig::setVerticalSplitterBottom(m_verticalSplitter->sizes()[1]);
+
#ifdef __GNUC__
#warning Restoring the side bar sizes from minimized after start up does not work perfectly yet!
#endif
@@ -2635,14 +2617,9 @@
void Kile::toggleWatchFile()
{
- m_bWatchFile=!m_bWatchFile;
+ m_bWatchFile = !m_bWatchFile;
- if (m_bWatchFile) {
- WatchFileAction->setChecked(true);
- }
- else {
- WatchFileAction->setChecked(false);
- }
+ WatchFileAction->setChecked(m_bWatchFile);
}
// execute configuration dialog
@@ -2798,7 +2775,7 @@
if ( ! view )
return;
- QRegExp reOptional( "(ALT|OPT)(\\w+)\\s*=\\s*(\\S.*)" );
+ QRegExp reOptional(R"((ALT|OPT)(\w+)\s*=\s*(\S.*))");
QRegExp reNonEmptyEntry( ".*\\w.*" );
QString s;
@@ -2827,7 +2804,7 @@
int j = 0;
for (i = 0; i < view->document()->lines(); ++i) {
j = i+1;
- if(j < view->document()->lines() && view->document()->line(j).contains(QRegExp("^\\s*\\}\\s*$"))) {
+ if(j < view->document()->lines() && view->document()->line(j).contains(QRegExp(R"(^\s*\}\s*$)"))) {
s = view->document()->line(i);
view->document()->removeLine(i);
s.remove(QRegExp(",\\s*$"));
diff --git a/src/kileactions.h b/src/kileactions.h
--- a/src/kileactions.h
+++ b/src/kileactions.h
@@ -68,7 +68,7 @@
Tag(const QString &text, const QString& iconText, const QString& pix, const QKeySequence &cut, const QObject *receiver, const char *slot, KActionCollection *parent, const QString& name,
const TagData& data);
- ~Tag();
+ ~Tag() = default;
private:
void init(const QObject *receiver = Q_NULLPTR, const char *slot = Q_NULLPTR);
@@ -106,7 +106,7 @@
InputTag(KileInfo* ki, const QString &text, const QString &iconText, const QString& pix, const QKeySequence &cut, const QObject *receiver, const char *slot, KActionCollection *parent, const QString& name, QWidget *wparent, uint options,
const TagData& data, const QString &hint = QString(), const QString &alter = QString());
- ~InputTag();
+ ~InputTag() = default;
bool hasHistory() {
return (m_options & KeepHistory);
@@ -146,7 +146,7 @@
public:
InputDialog(const QString &caption, uint options, const QStringList& history, const QString &hint, const QString &alter, KileInfo *ki, QWidget *parent=0, const char *name=0);
- ~InputDialog();
+ ~InputDialog() = default;
bool useAlternative() {
return m_useAlternative;
diff --git a/src/kileactions.cpp b/src/kileactions.cpp
--- a/src/kileactions.cpp
+++ b/src/kileactions.cpp
@@ -109,10 +109,6 @@
init(receiver,slot);
}
-Tag::~Tag()
-{
-}
-
void Tag::init(const QObject *receiver, const char *slot)
{
connect(this, SIGNAL(triggered()), SLOT(emitData()));
@@ -161,10 +157,6 @@
init();
}
-InputTag::~InputTag()
-{
-}
-
void InputTag::init()
{
m_history.clear();
@@ -269,20 +261,20 @@
if(options & KileAction::FromLabelList) {
list = ki->allLabels();
- if(list.size() > 0) {
+ if(!list.empty()) {
input->addItems(list);
m_tag = list.first();
}
}
else if(options & KileAction::FromBibItemList) {
list = ki->allBibItems();
- if(list.size() > 0) {
+ if(!list.empty()) {
input->addItems(list);
m_tag = list.first();
}
}
else {
- if(history.size() > 0) {
+ if(!history.empty()) {
input->addItems(history);
m_tag = history.first();
}
@@ -362,11 +354,6 @@
focus->setFocus();
}
-
-InputDialog::~InputDialog()
-{
-}
-
void InputDialog::slotBrowse()
{
QString fn;
@@ -427,8 +414,8 @@
{
removeAllActions();
- for(QList::const_iterator i = list.begin(); i != list.end(); ++i) {
- addAction(*i);
+ for (auto i : list) {
+ addAction(i);
}
}
@@ -484,8 +471,8 @@
{
int counter = -1;
QList actionList = menu()->actions();
- for(QList::iterator i = actionList.begin(); i != actionList.end(); ++i) {
- if(*i == action) {
+ for (auto &i : actionList) {
+ if(i == action) {
return counter + 1;
}
++counter;
diff --git a/src/kiledocmanager.cpp b/src/kiledocmanager.cpp
--- a/src/kiledocmanager.cpp
+++ b/src/kiledocmanager.cpp
@@ -153,8 +153,8 @@
// update all Info's with changed user commands
void Manager::updateInfos()
{
- for(QList::iterator it = m_textInfoList.begin(); it != m_textInfoList.end(); ++it) {
- (*it)->updateStructLevelInfo();
+ for (auto &it : m_textInfoList) {
+ it->updateStructLevelInfo();
}
}
@@ -170,9 +170,7 @@
KTextEditor::Document* Manager::docFor(const QUrl &url)
{
- for(QList::iterator it = m_textInfoList.begin(); it != m_textInfoList.end(); ++it) {
- TextInfo *info = *it;
-
+ for (auto info : m_textInfoList) {
if(m_ki->similarOrEqualURL(info->url(), url)) {
return info->getDoc();
}
@@ -200,9 +198,7 @@
KILE_DEBUG_MAIN << "==KileInfo::textInfoFor(" << url << ")==========================";
- for(QList::iterator it = m_textInfoList.begin(); it != m_textInfoList.end(); ++it) {
- TextInfo *info = *it;
-
+ for (auto info : m_textInfoList) {
if (info->url() == url) {
return info;
}
@@ -210,8 +206,8 @@
// the URL might belong to a TextInfo* which currently doesn't have a KTextEditor::Document*
// associated with it, i.e. a project item which isn't open in the editor
- for(QList::iterator it = m_projects.begin(); it != m_projects.end(); ++it) {
- KileProjectItem *item = (*it)->item(url);
+ for (auto &m_project : m_projects) {
+ KileProjectItem *item = m_project->item(url);
// all project items (across different projects) that share a URL have the same TextInfo*;
// so, the first one we find is good enough
@@ -235,9 +231,9 @@
// TextInfo* objects that contain KTextEditor::Document* pointers must be open in the editor, i.e.
// we don't have to look through the project items
- for(QList::const_iterator it = m_textInfoList.begin(); it != m_textInfoList.end(); ++it) {
- if((*it)->getDoc() == doc) {
- return (*it);
+ for (auto it : m_textInfoList) {
+ if(it->getDoc() == doc) {
+ return it;
}
}
@@ -264,9 +260,7 @@
KileProject* Manager::projectForMember(const QUrl &memberUrl)
{
- for(QList::iterator it = m_projects.begin(); it != m_projects.end(); ++it) {
- KileProject *project = *it;
-
+ for (auto project : m_projects) {
if(project->contains(memberUrl)) {
return project;
}
@@ -277,8 +271,7 @@
KileProject* Manager::projectFor(const QUrl &projecturl)
{
//find project with url = projecturl
- for(QList::iterator it = m_projects.begin(); it != m_projects.end(); ++it) {
- KileProject *project = *it;
+ for (auto project : m_projects) {
if(project->url() == projecturl) {
return project;
}
@@ -290,9 +283,7 @@
KileProject* Manager::projectFor(const QString &name)
{
//find project with url = projecturl
- for(QList::iterator it = m_projects.begin(); it != m_projects.end(); ++it) {
- KileProject *project = *it;
-
+ for (auto project : m_projects) {
if (project->name() == name) {
return project;
}
@@ -304,9 +295,7 @@
KileProjectItem* Manager::itemFor(const QUrl &url, KileProject *project /*=0L*/) const
{
if (!project) {
- for(QList::const_iterator it = m_projects.begin(); it != m_projects.end(); ++it) {
- KileProject *project = *it;
-
+ for (auto project : m_projects) {
KileProjectItem *item = project->item(url);
if(item) {
return item;
@@ -322,9 +311,7 @@
KileProjectItem* Manager::itemFor(TextInfo *docinfo, KileProject *project /*=0*/) const
{
if (!project) {
- for(QList::const_iterator it = m_projects.begin(); it != m_projects.end(); ++it) {
- KileProject *project = *it;
-
+ for (auto project : m_projects) {
KileProjectItem *item = project->item(docinfo);
if(item) {
return item;
@@ -345,10 +332,10 @@
KILE_DEBUG_MAIN << "==KileInfo::itemsFor(" << docinfo->url().fileName() << ")============";
QList list;
- for(QList::const_iterator it = m_projects.begin(); it != m_projects.end(); ++it) {
- KileProject *project = *it;
+ for (auto m_project : m_projects) {
+ KileProject *project = m_project;
- KILE_DEBUG_MAIN << "\tproject: " << (*it)->name();
+ KILE_DEBUG_MAIN << "\tproject: " << m_project->name();
if(project->contains(docinfo)) {
KILE_DEBUG_MAIN << "\t\tcontains";
list.append(project->item(docinfo));
@@ -361,9 +348,7 @@
QList Manager::itemsFor(const QUrl &url) const
{
QList list;
- for(QList::const_iterator it = m_projects.begin(); it != m_projects.end(); ++it) {
- KileProject *project = *it;
-
+ for (auto project : m_projects) {
if(project->contains(url)) {
list.append(project->item(url));
}
@@ -397,9 +382,7 @@
if (curpr && doc) {
QList list = curpr->items();
- for(QList::iterator it = list.begin(); it != list.end(); ++it) {
- KileProjectItem *item = *it;
-
+ for (auto item : list) {
if (item->url() == doc->url()) {
return item;
}
@@ -469,8 +452,8 @@
newinfo->setDoc(oldinfo->getDoc());
- for(QList::iterator it = list.begin(); it != list.end(); ++it) {
- (*it)->setInfo(newinfo);
+ for (auto &it : list) {
+ it->setInfo(newinfo);
}
removeTextDocumentInfo(oldinfo);
@@ -824,8 +807,7 @@
//open them
const QList& urls = result.URLs;
- for (QList::ConstIterator i = urls.begin(); i != urls.end(); ++i) {
- const QUrl& url = *i;
+ for (const auto &url : urls) {
if(m_ki->extensions()->isProjectFile(url)) { // this can happen... (bug 317432)
KILE_DEBUG_MAIN << "file is a project file:" << url;
projectOpen(url);
@@ -990,8 +972,8 @@
QList itemList = itemsFor(realurl);
TextInfo *textInfo = textInfoFor(realurl);
- for(QList::iterator it = itemList.begin(); it != itemList.end(); ++it) {
- (*it)->setInfo(textInfo);
+ for (auto &it : itemList) {
+ it->setInfo(textInfo);
}
if(itemList.isEmpty()) {
@@ -1156,9 +1138,8 @@
viewList.push_back(view);
}
- for(QList::iterator it = viewList.begin();
- it != viewList.end(); ++it) {
- if (!fileClose(*it)) {
+ for (auto &it : viewList) {
+ if (!fileClose(it)) {
return false;
}
}
@@ -1235,9 +1216,7 @@
}
bool inProject = false;
QList items = itemsFor(docinfo);
- for(QList::iterator it = items.begin(); it != items.end(); ++it) {
- KileProjectItem *item = *it;
-
+ for (auto item : items) {
//FIXME: refactor here
if(item && doc) {
storeProjectItem(item, doc);
@@ -1382,8 +1361,8 @@
KileProject* Manager::selectProject(const QString& caption)
{
QStringList list;
- for(QList::iterator it = m_projects.begin(); it != m_projects.end(); ++it) {
- list.append((*it)->name());
+ for (auto &m_project : m_projects) {
+ list.append(m_project->name());
}
KileProject *project = Q_NULLPTR;
@@ -1642,8 +1621,8 @@
orderedList.push_back(item);
}
}
- for(QList::iterator i = notCorrectlyOrderedList.begin(); i != notCorrectlyOrderedList.end(); ++i) {
- orderedList.push_back(*i);
+ for (auto &i : notCorrectlyOrderedList) {
+ orderedList.push_back(i);
}
addProject(kp);
@@ -1653,13 +1632,13 @@
// a stand-alone document currently being open already, or through a project item that belongs to
// a different project
// => 'createTextDocumentInfo' will take care of that situation as well
- for (QList::iterator i = orderedList.begin(); i != orderedList.end(); ++i) {
- createTextInfoForProjectItem(*i);
+ for (auto &i : orderedList) {
+ createTextInfoForProjectItem(i);
}
unsigned int counter = 1;
- for (QList::iterator i = orderedList.begin(); i != orderedList.end(); ++i) {
- projectOpenItem(*i, openProjectItemViews);
+ for (auto &i : orderedList) {
+ projectOpenItem(i, openProjectItemViews);
m_progressDialog->setValue(counter + project_steps);
qApp->processEvents();
++counter;
@@ -1682,8 +1661,8 @@
void Manager::updateProjectReferences(KileProject *project)
{
QList list = project->items();
- for(QList::iterator it = list.begin(); it != list.end(); ++it) {
- emit(updateReferences((*it)->getInfo()));
+ for (auto &item : list) {
+ emit(updateReferences(item->getInfo()));
}
}
@@ -1720,30 +1699,30 @@
// determine the order in which the project items are opened
QVector viewPositionVector(m_ki->viewManager()->getTabCount(), Q_NULLPTR);
- for(QList::iterator i = list.begin(); i != list.end(); ++i) {
- docinfo = (*i)->getInfo();
+ for (auto &i : list) {
+ docinfo = i->getInfo();
if(docinfo) {
KTextEditor::View *view = m_ki->viewManager()->textView(docinfo);
if(view) {
int position = m_ki->viewManager()->tabIndexOf(view);
if(position >= 0 && position < viewPositionVector.size()) {
- viewPositionVector[position] = *i;
+ viewPositionVector[position] = i;
}
}
}
}
int position = 0;
- for(int i = 0; i < viewPositionVector.size(); ++i) {
- if(viewPositionVector[i] != Q_NULLPTR) {
- viewPositionVector[i]->setOrder(position);
+ for (auto &i : viewPositionVector) {
+ if(i != Q_NULLPTR) {
+ i->setOrder(position);
++position;
}
}
//update the open-state of the items
- for (QList::iterator i = list.begin(); i != list.end(); ++i) {
- item = *i;
- KILE_DEBUG_MAIN << "\tsetOpenState(" << (*i)->url().toLocalFile() << ") to " << m_ki->isOpen(item->url());
+ for (auto &i : list) {
+ item = i;
+ KILE_DEBUG_MAIN << "\tsetOpenState(" << i->url().toLocalFile() << ") to " << m_ki->isOpen(item->url());
item->setOpenState(m_ki->isOpen(item->url()));
docinfo = item->getInfo();
@@ -1856,7 +1835,7 @@
{
KILE_DEBUG_MAIN << "==Kile::projectCloseAll==========================";
- while(m_projects.size() > 0) {
+ while(!m_projects.empty()) {
if(!projectClose(m_projects.first()->url())) {
return false;
}
@@ -1892,9 +1871,7 @@
bool close = true;
KTextEditor::Document *doc = Q_NULLPTR;
TextInfo *docinfo = Q_NULLPTR;
- for(QList::iterator it = list.begin(); it != list.end(); ++it) {
- KileProjectItem *item = *it;
-
+ for (auto item : list) {
doc = Q_NULLPTR;
docinfo = item->getInfo();
if (docinfo) {
@@ -2002,8 +1979,7 @@
QList urls = e->mimeData()->urls();
Extensions *extensions = m_ki->extensions();
- for(QList::iterator i = urls.begin(); i != urls.end(); ++i) {
- QUrl url = *i;
+ for (auto url : urls) {
if(extensions->isProjectFile(url)) {
projectOpen(url);
}
@@ -2015,8 +1991,8 @@
void Manager::reloadXMLOnAllDocumentsAndViews()
{
- for(QList::iterator it = m_textInfoList.begin(); it != m_textInfoList.end(); ++it) {
- KTextEditor::Document *doc = (*it)->getDoc();
+ for (auto &it : m_textInfoList) {
+ KTextEditor::Document *doc = it->getDoc();
// FIXME: 'doc' can be null, for example if it belongs to a project item
// which has been closed, but this should be improved in the sense
// that 'm_textInfoList' should only contain 'TextInfo' objects which
@@ -2026,8 +2002,8 @@
}
doc->reloadXML();
QList views = doc->views();
- for(QList::iterator viewIt = views.begin(); viewIt != views.end(); ++viewIt) {
- (*viewIt)->reloadXML();
+ for (auto &view : views) {
+ view->reloadXML();
}
}
}
@@ -2081,16 +2057,14 @@
KileProjectItem *first_texitem = Q_NULLPTR;
if(!docitem) {
QList list = project->items();
- for(QList::iterator it = list.begin(); it != list.end(); ++it) {
- KileProjectItem *item = *it;
-
+ for (auto item : list) {
QString itempath = item->path();
// called from QAction 'Show projects...': find the first opened
// LaTeX document or, if that fails, any other opened file
QStringList extlist = (m_ki->extensions()->latexDocuments() + ' ' + m_ki->extensions()->latexPackages()).split(' ');
- for(QStringList::Iterator it=extlist.begin(); it!=extlist.end(); ++it) {
- if(itempath.indexOf( (*it), -(*it).length() ) >= 0) {
+ for (auto &it : extlist) {
+ if(itempath.indexOf(it, -it.length() ) >= 0) {
if (m_ki->isOpen(item->url())) {
docitem = item;
break;
@@ -2127,8 +2101,8 @@
{
QList itemsList = selectProjectFileItems(i18n("Select Files to Remove"));
if(itemsList.count() > 0) {
- for(QList::iterator it = itemsList.begin(); it != itemsList.end(); ++it) {
- removeFromProject(*it);
+ for (auto &item : itemsList) {
+ removeFromProject(item);
}
}
}
@@ -2182,9 +2156,7 @@
// we remember the actual view, so the user gets the same view back after opening
QList list = project->items();
- for(QList::iterator it = list.begin(); it != list.end(); ++it) {
- KileProjectItem *item = *it;
-
+ for (auto item : list) {
if (item->type()==KileProjectItem::ProjectFile) {
dontOpenWarning( item, i18n("Open All Project Files"), i18n("project configuration file") );
}
@@ -2209,9 +2181,7 @@
if ( project )
{
QList list = project->items();
- for(QList::iterator it = list.begin(); it != list.end(); ++it) {
- KileProjectItem *item = *it;
-
+ for (auto item : list) {
if(item->type() != KileProjectItem::ProjectFile && item->type() != KileProjectItem::Image) {
filelist << item->url().toLocalFile();
}
@@ -2239,9 +2209,7 @@
QStringList filelist;
QMap map;
QList list = project->items();
- for(QList::iterator it = list.begin(); it != list.end(); ++it) {
- KileProjectItem *item = *it;
-
+ for (auto item : list) {
filelist << item->path();
map[item->path()] = item;
}
@@ -2276,9 +2244,7 @@
QMap map;
QList list = project->items();
- for(QList::iterator it = list.begin(); it != list.end(); ++it) {
- KileProjectItem *item = *it;
-
+ for (auto item : list) {
filelist << item->path();
map[item->path()] = item;
}
@@ -2290,9 +2256,9 @@
if(dlg->exec()) {
if(dlg->hasSelection()) {
QStringList selectedfiles = dlg->selectedItems();
- for(QStringList::Iterator it = selectedfiles.begin(); it != selectedfiles.end(); ++it ) {
- if(map.contains(*it)) {
- itemsList.append(map[(*it)]);
+ for (auto &selectedfile : selectedfiles) {
+ if(map.contains(selectedfile)) {
+ itemsList.append(map[selectedfile]);
}
else {
KMessageBox::error(m_ki->mainWindow(), i18n("Could not determine the selected file."), i18n( "Project Error"));
@@ -2349,8 +2315,8 @@
void Manager::cleanupDocumentInfoForProjectItems(KileDocument::Info *info)
{
QList itemsList = itemsFor(info);
- for(QList::iterator it = itemsList.begin(); it != itemsList.end(); ++it) {
- (*it)->setInfo(Q_NULLPTR);
+ for (auto &it : itemsList) {
+ it->setInfo(Q_NULLPTR);
}
}
@@ -2400,8 +2366,7 @@
QList viewList = document->views();
int i = 0;
- for(QList::iterator it = viewList.begin(); it != viewList.end(); ++it) {
- KTextEditor::View *view = *it;
+ for (auto view : viewList) {
configGroup = configGroupForViewSettings(document, i);
view->readSessionConfig(configGroup);
++i;
@@ -2439,9 +2404,9 @@
QList viewList = document->views();
int i = 0;
- for(QList::iterator it = viewList.begin(); it != viewList.end(); ++it) {
+ for (auto &it : viewList) {
configGroup = configGroupForViewSettings(document, i);
- (*it)->writeSessionConfig(configGroup);
+ it->writeSessionConfig(configGroup);
++i;
}
// finally remove the config groups for the oldest documents that exceed MAX_NUMBER_OF_STORED_SETTINGS
@@ -2489,7 +2454,7 @@
{
QString urlString = url.url();
const QStringList groupList = KSharedConfig::openConfig()->groupList();
- for(auto groupName : groupList) {
+ for(const auto &groupName : groupList) {
if(!KSharedConfig::openConfig()->hasGroup(groupName)) { // 'groupName' might have been deleted
continue; // work around bug 384039
}
diff --git a/src/kileextensions.cpp b/src/kileextensions.cpp
--- a/src/kileextensions.cpp
+++ b/src/kileextensions.cpp
@@ -155,9 +155,8 @@
bool Extensions::validExtension(const QString &ext, const QString &extensions) const
{
- const QStringList extlist = extensions.split(' ');
- for(QStringList::ConstIterator it = extlist.constBegin(); it != extlist.constEnd(); ++it) {
- if((*it) == ext) {
+ for(const auto &extension : extensions.split(' ')) {
+ if(extension == ext) {
return true;
}
}
diff --git a/src/kilehelp.cpp b/src/kilehelp.cpp
--- a/src/kilehelp.cpp
+++ b/src/kilehelp.cpp
@@ -16,6 +16,7 @@
#include
#include
#include
+#include
#include "editorextension.h"
#include "errorhandler.h"
@@ -121,9 +122,9 @@
QString sep = QDir::separator();
QRegExp re( sep + "texlive" + sep + "(201\\d)" + sep );
- for (QStringList::ConstIterator it = paths.begin(); it != paths.end(); ++it) {
+ for (const auto &it : paths) {
// Remove any leading or trailing ", this is commonly used in the environment variables
- QString path = (*it);
+ QString path = it;
if (path.startsWith('\"'))
path = path.right(path.length() - 1);
if (path.endsWith('\"'))
diff --git a/src/kileinfo.cpp b/src/kileinfo.cpp
--- a/src/kileinfo.cpp
+++ b/src/kileinfo.cpp
@@ -215,8 +215,8 @@
// tries to determine the LaTeX source file
bool found = false;
QStringList extlist = (m_extensions->latexDocuments()).split(' ');
- for(QStringList::Iterator it=extlist.begin(); it!=extlist.end(); ++it) {
- QString name = file + (*it);
+ for (auto &ext : extlist) {
+ QString name = file + ext;
if(QFileInfo(name).exists()) {
file = name;
fi.setFile(name);
@@ -240,9 +240,9 @@
{
QList items = docManager()->itemsFor(info);
QList list;
- for(QList::iterator it = items.begin(); it != items.end(); ++it) {
- if((*it)->parent()) {
- list.append((*it)->parent()->url());
+ for (auto &item : items) {
+ if(item->parent()) {
+ list.append(item->parent()->url());
}
}
return list;
@@ -267,8 +267,7 @@
root->allChildren(&children);
QStringList toReturn;
- for(QList::iterator it = children.begin(); it != children.end(); ++it) {
- const KileProjectItem *item = *it;
+ for (auto item : children) {
KileDocument::TextInfo *textInfo = item->getInfo();
KILE_DEBUG_MAIN << "\t" << item->url();
@@ -454,7 +453,7 @@
inputpaths.prepend(path);
// the first match is supposed to be the correct one
- foreach(const QString &string, inputpaths) {
+ for (const QString &string : inputpaths) {
KILE_DEBUG_MAIN << "path is " << string << "and file is " << file << endl;
info.setFile(string + '/' + file);
if(info.exists()) {
diff --git a/src/kilelauncher.h b/src/kilelauncher.h
--- a/src/kilelauncher.h
+++ b/src/kilelauncher.h
@@ -123,7 +123,7 @@
Q_OBJECT
public:
- DocumentViewerLauncher();
+ DocumentViewerLauncher() = default;
~DocumentViewerLauncher();
public Q_SLOTS:
diff --git a/src/kilelauncher.cpp b/src/kilelauncher.cpp
--- a/src/kilelauncher.cpp
+++ b/src/kilelauncher.cpp
@@ -338,10 +338,6 @@
return ProcessLauncher::launch();
}
-DocumentViewerLauncher::DocumentViewerLauncher()
-{
-}
-
DocumentViewerLauncher::~DocumentViewerLauncher()
{
KILE_DEBUG_MAIN << "DELETING DocumentViewerLauncher";
diff --git a/src/kilelyxserver.cpp b/src/kilelyxserver.cpp
--- a/src/kilelyxserver.cpp
+++ b/src/kilelyxserver.cpp
@@ -74,12 +74,12 @@
delete m_tempDir;
- for(QList::iterator i = m_pipeIn.begin(); i != m_pipeIn.end(); ++i) {
- delete *i;
+ for (auto &i : m_pipeIn) {
+ delete i;
}
- for(QList::iterator i = m_notifier.begin(); i != m_notifier.end(); ++i) {
- delete *i;
+ for (auto &i : m_notifier) {
+ delete i;
}
}
@@ -93,15 +93,15 @@
if (openPipes()) {
QSocketNotifier *notifier;
- for(QList::iterator it = m_pipeIn.begin(); it != m_pipeIn.end(); ++it) {
- if ((*it)->fileName().right(3) == ".in" ) {
- notifier = new QSocketNotifier((*it)->handle(), QSocketNotifier::Read, this);
+ for (auto &it : m_pipeIn) {
+ if (it->fileName().right(3) == ".in" ) {
+ notifier = new QSocketNotifier(it->handle(), QSocketNotifier::Read, this);
connect(notifier, SIGNAL(activated(int)), this, SLOT(receive(int)));
m_notifier.append(notifier);
- KILE_DEBUG_MAIN << "Created notifier for " << (*it)->fileName();
+ KILE_DEBUG_MAIN << "Created notifier for " << it->fileName();
}
else {
- KILE_DEBUG_MAIN << "No notifier created for " << (*it)->fileName();
+ KILE_DEBUG_MAIN << "No notifier created for " << it->fileName();
}
}
m_running=true;
@@ -203,13 +203,13 @@
{
KILE_DEBUG_MAIN << "Stopping the LyX server...";
- for(QList::iterator it = m_pipeIn.begin(); it != m_pipeIn.end(); ++it) {
- (*it)->close();
- delete *it;
+ for (auto &it : m_pipeIn) {
+ it->close();
+ delete it;
}
- for(QList::iterator i = m_notifier.begin(); i != m_notifier.end(); ++i) {
- delete *i;
+ for (auto &i : m_notifier) {
+ delete i;
}
m_pipeIn.clear();
diff --git a/src/kileproject.cpp b/src/kileproject.cpp
--- a/src/kileproject.cpp
+++ b/src/kileproject.cpp
@@ -136,8 +136,8 @@
QList viewList = document->views();
loadDocumentSettings(document);
int i = 0;
- for(QList::iterator it = viewList.begin(); it != viewList.end(); ++it) {
- loadViewSettings(*it, i);
+ for (auto &it : viewList) {
+ loadViewSettings(it, i);
++i;
}
}
@@ -154,8 +154,8 @@
QList viewList = document->views();
saveDocumentSettings(document);
int i = 0;
- for(QList::iterator it = viewList.begin(); it != viewList.end(); ++it) {
- saveViewSettings(*it, i);
+ for (auto &it : viewList) {
+ saveViewSettings(it, i);
++i;
}
}
@@ -276,8 +276,8 @@
delete m_guiConfig;
delete m_config;
- for(QList::iterator it = m_projectItems.begin(); it != m_projectItems.end(); ++it) {
- delete *it;
+ for (auto &m_projectItem : m_projectItems) {
+ delete m_projectItem;
}
}
@@ -328,31 +328,30 @@
if(!ext.isEmpty()) {
QStringList userExtList;
- QStringList::ConstIterator it;
QStringList list = ext.split(' ');
- for(it = list.constBegin(); it != list.constEnd(); ++it) {
+ for (const auto &it : list) {
// some tiny extension checks
- if((*it).length() < 2 || (*it)[0] != '.') {
+ if(it.length() < 2 || it[0] != '.') {
continue;
}
// some of the old definitions are wrong, so we test them all
if(type == KileProjectItem::Source || type == KileProjectItem::Package) {
- if(!(m_extmanager->isLatexDocument(*it) || m_extmanager->isLatexPackage(*it))) {
- standardExtList << (*it);
- userExtList << (*it);
+ if(!(m_extmanager->isLatexDocument(it) || m_extmanager->isLatexPackage(it))) {
+ standardExtList << it;
+ userExtList << it;
}
}
else if(type == KileProjectItem::Image) {
- if(!m_extmanager->isImage(*it)) {
- standardExtList << (*it);
- userExtList << (*it);
+ if(!m_extmanager->isImage(it)) {
+ standardExtList << it;
+ userExtList << it;
}
}
else if(type == KileProjectItem::Bibliography) {
- if(!m_extmanager->isBibFile(*it)) {
- standardExtList << (*it);
- userExtList << (*it);
+ if(!m_extmanager->isBibFile(it)) {
+ standardExtList << it;
+ userExtList << it;
}
}
}
@@ -524,7 +523,7 @@
const QStringList groups = m_config->groupList();
//retrieve all the project files and create and initialize project items for them
- for (auto group : groups) {
+ for (const auto &group : groups) {
if(!m_config->hasGroup(group)) { // 'group' might have been deleted
continue; // work around bug 384039
}
@@ -592,8 +591,8 @@
generalGroup.writeEntry("pkg_extIsRegExp", false);
generalGroup.writeEntry("img_extIsRegExp", false);
- for(QList::iterator it = m_projectItems.begin(); it != m_projectItems.end(); ++it) {
- (*it)->save();
+ for (auto &m_projectItem : m_projectItems) {
+ m_projectItem->save();
}
KileTool::setConfigName("QuickBuild", quickBuildConfig(), m_config);
@@ -648,7 +647,7 @@
{
QString itemString = "item:" + item->path();
const QStringList groupList = m_config->groupList();
- for(auto groupName : groupList) {
+ for(const auto groupName : groupList) {
if(!m_config->hasGroup(groupName)) { // 'groupName' might have been deleted
continue; // work around bug 384039
}
@@ -682,15 +681,15 @@
QUrl url;
//clean first
- for(QList::iterator it = m_projectItems.begin(); it != m_projectItems.end(); ++it) {
- (*it)->setParent(0);
+ for (auto &m_projectItem : m_projectItems) {
+ m_projectItem->setParent(0);
}
//use the dependencies list of the documentinfo object to determine the parent
- for(QList::iterator it = m_projectItems.begin(); it != m_projectItems.end(); ++it) {
+ for (auto &m_projectItem : m_projectItems) {
//set the type correctly (changing m_extensions causes a call to buildProjectTree)
- setType(*it);
- KileDocument::Info *docinfo = (*it)->getInfo();
+ setType(m_projectItem);
+ KileDocument::Info *docinfo = m_projectItem->getInfo();
if(docinfo) {
QUrl parentUrl = docinfo->url();
@@ -713,9 +712,9 @@
}
itm = item(url);
if(itm && (itm->parent() == 0)
- && !isAncestorOf(itm, *it)) { // avoid circular references if a file should
+ && !isAncestorOf(itm, m_projectItem)) { // avoid circular references if a file should
// include itself in a circular way
- itm->setParent(*it);
+ itm->setParent(m_projectItem);
}
}
}
@@ -723,9 +722,9 @@
//make a list of all the root items (items with parent == 0)
m_rootItems.clear();
- for(QList::iterator it = m_projectItems.begin(); it != m_projectItems.end(); ++it) {
- if((*it)->parent() == Q_NULLPTR) {
- m_rootItems.append(*it);
+ for (auto &m_projectItem : m_projectItems) {
+ if(m_projectItem->parent() == Q_NULLPTR) {
+ m_rootItems.append(m_projectItem);
}
}
@@ -734,9 +733,9 @@
KileProjectItem* KileProject::item(const QUrl &url)
{
- for(QList::iterator it = m_projectItems.begin(); it != m_projectItems.end(); ++it) {
- if((*it)->url() == url) {
- return *it;
+ for (auto &m_projectItem : m_projectItems) {
+ if(m_projectItem->url() == url) {
+ return m_projectItem;
}
}
@@ -745,9 +744,7 @@
KileProjectItem* KileProject::item(const KileDocument::Info *info)
{
- for(QList::iterator it = m_projectItems.begin(); it != m_projectItems.end(); ++it) {
- KileProjectItem *current = *it;
-
+ for (auto current : m_projectItems) {
if (current->getInfo() == info) {
return current;
}
@@ -811,8 +808,8 @@
bool KileProject::contains(const QUrl &url)
{
- for(QList::iterator it = m_projectItems.begin(); it != m_projectItems.end(); ++it) {
- if((*it)->url() == url) {
+ for (auto &m_projectItem : m_projectItems) {
+ if(m_projectItem->url() == url) {
return true;
}
}
@@ -822,8 +819,8 @@
bool KileProject::contains(const KileDocument::Info *info)
{
- for(QList::iterator it = m_projectItems.begin(); it != m_projectItems.end(); ++it) {
- if((*it)->getInfo() == info) {
+ for (auto &m_projectItem : m_projectItems) {
+ if(m_projectItem->getInfo() == info) {
return true;
}
}
@@ -845,8 +842,7 @@
}
else {
//if not, see if we can find another root item that is a LaTeX root
- for(QList::const_iterator it = m_rootItems.begin(); it != m_rootItems.end(); ++it) {
- KileProjectItem *current = *it;
+ for (auto current : m_rootItems) {
if(current->getInfo() && current->getInfo()->isLaTeXRoot()) {
return current;
}
@@ -864,8 +860,7 @@
void KileProject::dump()
{
KILE_DEBUG_MAIN << "KileProject::dump() " << m_name;
- for(QList::iterator it = m_projectItems.begin(); it != m_projectItems.end(); ++it) {
- KileProjectItem *item = *it;
+ for (auto item : m_projectItems) {
KILE_DEBUG_MAIN << "item " << item << " has path: " << item->path();
KILE_DEBUG_MAIN << "item->type() " << item->type();
KILE_DEBUG_MAIN << "OpenState: " << item->isOpen();
@@ -877,9 +872,9 @@
KILE_DEBUG_MAIN << "KileProject::archiveFileList()";
QString path, list;
- for(QList::const_iterator it = m_projectItems.begin(); it != m_projectItems.end(); ++it) {
- if ((*it)->archive()) {
- list.append(KShell::quoteArg((*it)->path()) + ' ');
+ for (auto m_projectItem : m_projectItems) {
+ if (m_projectItem->archive()) {
+ list.append(KShell::quoteArg(m_projectItem->path()) + ' ');
}
}
return list;
@@ -975,7 +970,7 @@
<< QStringLiteral("kile_livePreviewTool");
const QStringList groups = m_config->groupList();
- for(auto groupName : groups) {
+ for(const auto groupName : groups) {
if(!m_config->hasGroup(groupName)) { // 'groupName' might have been deleted
continue; // work around bug 384039
}
diff --git a/src/kilestdactions.cpp b/src/kilestdactions.cpp
--- a/src/kilestdactions.cpp
+++ b/src/kilestdactions.cpp
@@ -259,16 +259,13 @@
KConfig *bibCfg = new KConfig(filename, KConfig::SimpleConfig);
- if(bibCfg == Q_NULLPTR )
- return;
-
const QStringList groupList = bibCfg->groupList();
// check if a non-deleted group exists
// groupList.count() == 0 is not enough due to bug 384039
{
- bool allDeleted = false;
- for(auto group : groupList) {
+ bool allDeleted = false; // TODO this variable is always false. Strange
+ for(auto &group : groupList) {
if(bibCfg->hasGroup(group)) {
allDeleted = false;
break;
@@ -283,7 +280,7 @@
QStringList keyList, optKeyList, altKeyList;
QString altText, optText, compText;
- for(auto group : groupList) {
+ for(const auto &group : groupList) {
if(!bibCfg->hasGroup(group)) { // 'group' might have been deleted
continue; // work around bug 384039
}
@@ -313,22 +310,22 @@
internalName = "tag_bib_" + internalName.trimmed();
tag = tag.trimmed();
- for(QList::iterator it = keyList.begin(); it != keyList.end(); ++it) {
- key = (*it).trimmed();
+ for (auto &it : keyList) {
+ key = it.trimmed();
key = QString(" %1 = {},\n").arg(key);
keys.append(key);
// KILE_DEBUG_MAIN << "key" << key ;
}
- for(QList::iterator it = altKeyList.begin(); it != altKeyList.end(); ++it) {
- key = (*it).trimmed();
+ for (auto &it : altKeyList) {
+ key = it.trimmed();
key = QString(" ALT%1 = {},\n").arg(key);
keys.append(key);
// KILE_DEBUG_MAIN << "altkey" << key ;
}
- for(QList::iterator it = optKeyList.begin(); it != optKeyList.end(); ++it) {
- key = (*it).trimmed();
+ for (auto &it : optKeyList) {
+ key = it.trimmed();
key = QString(" OPT%1 = {},\n").arg(key);
keys.append(key);
// KILE_DEBUG_MAIN << "optKey" << key;
diff --git a/src/kilestdtools.h b/src/kilestdtools.h
--- a/src/kilestdtools.h
+++ b/src/kilestdtools.h
@@ -35,7 +35,7 @@
public:
Factory(Manager *mngr, KConfig *config, KActionCollection *actionCollection);
- ~Factory();
+ ~Factory() = default;
void resetToolConfigurations();
void installStandardLivePreviewTools();
@@ -58,7 +58,7 @@
protected:
LaTeX(const QString& tool, Manager *mngr, bool prepare);
public:
- virtual ~LaTeX();
+ virtual ~LaTeX() = default;
void setupAsChildTool(KileTool::Base *child);
diff --git a/src/kilestdtools.cpp b/src/kilestdtools.cpp
--- a/src/kilestdtools.cpp
+++ b/src/kilestdtools.cpp
@@ -48,10 +48,6 @@
m_standardToolConfigurationFileName = QStandardPaths::locate(QStandardPaths::DataLocation, "kilestdtools.rc");
}
-Factory::~Factory()
-{
-}
-
Base* Factory::create(const QString& toolName, const QString& config, bool prepare /* = true */)
{
KILE_DEBUG_MAIN << toolName << config << prepare;
@@ -127,14 +123,14 @@
m_config->deleteGroup(QLatin1String("ToolsGUI"));
// we delete all the groups whose names start with "Tool/";
- for(QString groupName : m_config->groupList()) {
+ for(const auto &groupName : m_config->groupList()) {
if(groupName.startsWith(QLatin1String("Tool/"))) {
m_config->deleteGroup(groupName);
}
}
// now we copy all the "Tool/" groups, the "Tools", and "ToolsGUI" groups over
- for(QString groupName : stdToolConfig.groupList()) {
+ for(const auto &groupName : stdToolConfig.groupList()) {
if(groupName != SHORTCUTS_GROUP_NAME) {
KConfigGroup configGroup = stdToolConfig.group(groupName);
m_config->deleteGroup(groupName);
@@ -147,7 +143,7 @@
static void transferKeyStringPairsStartingWith(KConfigGroup& src, KConfigGroup& target, const QString& startsWith)
{
const QStringList keyList = src.keyList();
- for(QString key : keyList) {
+ for(auto &key : keyList) {
if(key.startsWith(startsWith)) {
QString value = src.readEntry(key, QString());
target.writeEntry(key, value);
@@ -160,7 +156,7 @@
KConfig stdToolConfig(m_standardToolConfigurationFileName, KConfig::NoGlobals);
const QStringList groupList = stdToolConfig.groupList();
- for(QString groupName : groupList) {
+ for(const auto &groupName : groupList) {
if(groupName.startsWith(QStringLiteral("Tool/LivePreview"))) {
KConfigGroup configGroup = stdToolConfig.group(groupName);
m_config->deleteGroup(groupName);
@@ -191,10 +187,6 @@
{
}
-LaTeX::~LaTeX()
-{
-}
-
void LaTeX::setupAsChildTool(KileTool::Base *child)
{
KileTool::LaTeX *latexChild = dynamic_cast(child);
diff --git a/src/kiletool.h b/src/kiletool.h
--- a/src/kiletool.h
+++ b/src/kiletool.h
@@ -385,7 +385,7 @@
protected:
Compile(const QString &name, Manager * manager, bool prepare = true);
public:
- ~Compile();
+ ~Compile() = default;
protected:
bool checkSource();
@@ -400,7 +400,7 @@
protected:
View(const QString &name, Manager * manager, bool prepare = true);
public:
- ~View();
+ ~View() = default;
bool isViewer() {
return true;
@@ -416,7 +416,7 @@
protected:
Convert(const QString &name, Manager * manager, bool prepare = true);
public:
- ~Convert();
+ ~Convert() = default;
bool determineSource();
};
@@ -432,7 +432,7 @@
protected:
Archive(const QString &name, Manager * manager, bool prepare = true);
public:
- ~Archive();
+ ~Archive() = default;
bool checkPrereqs();
void setSource(const QString & source, const QString& workingDir = "");
private:
diff --git a/src/kiletool.cpp b/src/kiletool.cpp
--- a/src/kiletool.cpp
+++ b/src/kiletool.cpp
@@ -488,12 +488,7 @@
emit(done(this, result, m_childToolSpawned));
//we will only get here if the done() signal is not connected to the manager (who will destroy this object)
- if (result == Success) {
- return true;
- }
- else {
- return false;
- }
+ return result == Success;
}
void Base::installLaTeXOutputParserResult(int nErrors, int nWarnings, int nBadBoxes, const LatexOutputInfoArray& outputList,
@@ -624,9 +619,6 @@
setFlags( flags() | NeedTargetDirExec | NeedTargetDirWrite);
}
-Compile::~Compile()
-{}
-
bool Compile::checkSource()
{
if ( !Base::checkSource() ) return false;
@@ -654,20 +646,12 @@
setMsg(NeedTargetExists, ki18n("The file %1/%2 does not exist; did you compile the source file?"));
}
-View::~View()
-{
-}
-
-
Archive::Archive(const QString &name, Manager * manager, bool prepare /* = true*/)
: Base(name, manager,prepare)
{
setFlags( NeedTargetDirExec | NeedTargetDirWrite );
}
-Archive::~Archive()
-{}
-
bool Archive::checkPrereqs()
{
if(!m_project) {
@@ -714,10 +698,6 @@
setFlags( flags() | NeedTargetDirExec | NeedTargetDirWrite );
}
-Convert::~Convert()
-{
-}
-
bool Convert::determineSource()
{
bool br = Base::determineSource();
@@ -768,8 +748,8 @@
{
// if one of the tools in the sequence requests save-all, then we also
// request it
- for(QLinkedList::iterator i = m_tools.begin(); i != m_tools.end(); ++i) {
- if((*i)->requestSaveAll()) {
+ for (auto &m_tool : m_tools) {
+ if(m_tool->requestSaveAll()) {
return true;
}
}
@@ -782,8 +762,8 @@
QStringList toolNameList = readEntry("sequence").split(',');
QString tl, cfg;
Base *tool;
- for(QStringList::iterator i = toolNameList.begin(); i != toolNameList.end(); ++i) {
- QString fullToolSpec = (*i).trimmed();
+ for (auto &toolName : toolNameList) {
+ QString fullToolSpec = toolName.trimmed();
extract(fullToolSpec, tl, cfg);
tool = manager()->createTool(tl, cfg, false); // create tool with delayed preparation
@@ -823,8 +803,7 @@
return ConfigureFailed;
}
- for(QLinkedList::iterator i = m_tools.begin(); i != m_tools.end(); ++i) {
- Base *tool = *i;
+ for (auto tool : m_tools) {
tool->setSource(source());
// if we are running a 'LaTeX' tool here, we still have to set the
diff --git a/src/kiletoolmanager.h b/src/kiletoolmanager.h
--- a/src/kiletoolmanager.h
+++ b/src/kiletoolmanager.h
@@ -68,7 +68,7 @@
{
public:
explicit QueueItem(Base *tool, bool block = false);
- ~QueueItem();
+ ~QueueItem() = default;
Base* tool() const {
return m_tool;
diff --git a/src/kiletoolmanager.cpp b/src/kiletoolmanager.cpp
--- a/src/kiletoolmanager.cpp
+++ b/src/kiletoolmanager.cpp
@@ -48,10 +48,6 @@
{
}
-QueueItem::~QueueItem()
-{
-}
-
Base* Queue::tool() const
{
if(count() > 0 && head()) {
@@ -125,10 +121,10 @@
{
KILE_DEBUG_MAIN;
- for(QQueue::iterator i = m_queue.begin(); i != m_queue.end(); ++i) {
+ for (auto &i : m_queue) {
// this will also stop any running processes
- delete (*i)->tool();
- delete (*i);
+ delete i->tool();
+ delete i;
}
// tools have the tool manager as parent; so, all remaining tools will be deleted
// after this, i.e. those that were scheduled for deletion via 'deleteLater' but
@@ -181,7 +177,7 @@
void Manager::handleDocumentParsingComplete()
{
- Q_FOREACH(Base *tool, m_toolsScheduledAfterParsingList) {
+ for (auto &tool : m_toolsScheduledAfterParsingList) {
disconnect(tool, SIGNAL(aboutToBeDestroyed(KileTool::Base*)),
this, SLOT(toolScheduledAfterParsingDestroyed(KileTool::Base*)));
runImmediately(tool);
@@ -256,9 +252,9 @@
int status;
if((status=head->run()) != Running) { //tool did not even start, clear queue
stop();
- for(QQueue::iterator i = m_queue.begin(); i != m_queue.end(); ++i) {
- (*i)->tool()->deleteLater();
- delete (*i);
+ for (auto &i : m_queue) {
+ i->tool()->deleteLater();
+ delete i;
}
m_queue.clear();
return status;
@@ -369,9 +365,9 @@
runNextInQueue();
}
else {
- for(QQueue::iterator i = m_queue.begin(); i != m_queue.end(); ++i) {
- (*i)->tool()->deleteLater();
- delete (*i);
+ for (auto &i : m_queue) {
+ i->tool()->deleteLater();
+ delete i;
}
m_queue.clear();
m_ki->focusLog();
@@ -523,7 +519,7 @@
QRegExp re = QRegExp("Tool/(.+)/.+");
QString name;
- for(auto group : groups) {
+ for(const auto &group : groups) {
if(!config->hasGroup(group)) { // 'group' might have been deleted
continue; // work around bug 384039
}
@@ -554,7 +550,7 @@
QRegExp re = QRegExp("Tool/(.+)/(.+)");
QList toReturn;
- for(auto group : groups) {
+ for(const auto &group : groups) {
if(!config->hasGroup(group)) { // 'group' might have been deleted
continue; // work around bug 384039
}
@@ -635,7 +631,7 @@
QRegExp re = QRegExp("Tool/"+ tool +"/(.+)");
- for(auto group : groups) {
+ for(const auto &group : groups) {
if(!config->hasGroup(group)) { // 'group' might have been deleted
continue; // work around bug 384039
}
diff --git a/src/kileviewmanager.h b/src/kileviewmanager.h
--- a/src/kileviewmanager.h
+++ b/src/kileviewmanager.h
@@ -70,7 +70,7 @@
public:
explicit DocumentViewerWindow(QWidget *parent = Q_NULLPTR, Qt::WindowFlags f = KDE_DEFAULT_WINDOWFLAGS);
- virtual ~DocumentViewerWindow();
+ virtual ~DocumentViewerWindow() = default;
Q_SIGNALS:
void visibilityChanged(bool shown);
@@ -244,7 +244,7 @@
public:
explicit DropWidget(QWidget * parent = 0, const char * name = 0, Qt::WindowFlags f = 0);
- virtual ~DropWidget();
+ virtual ~DropWidget() = default;
virtual void dragEnterEvent(QDragEnterEvent *e);
virtual void dropEvent(QDropEvent *e);
diff --git a/src/kileviewmanager.cpp b/src/kileviewmanager.cpp
--- a/src/kileviewmanager.cpp
+++ b/src/kileviewmanager.cpp
@@ -81,10 +81,6 @@
{
}
-DocumentViewerWindow::~DocumentViewerWindow()
-{
-}
-
void DocumentViewerWindow::showEvent(QShowEvent *event)
{
KMainWindow::showEvent(event);
@@ -266,7 +262,7 @@
}
std::sort(views.begin(), views.end(), sortDocuments);
- foreach(KTextEditor::View* view, views) {
+ for (KTextEditor::View* view : views) {
QAction *action = m_documentListButton->menu()->addAction(view->document()->documentName());
action->setData(QVariant::fromValue(view));
}
@@ -471,7 +467,7 @@
if(usermenu) {
KILE_DEBUG_MAIN << "Insert actions from user-defined latex menu";
popupMenu->addSeparator();
- foreach(QAction *action, usermenu->contextMenuActions()) {
+ for (QAction *action : usermenu->contextMenuActions()) {
if(action) {
popupMenu->addAction(action);
}
@@ -806,8 +802,8 @@
}
const QList &viewsList = doc->views();
- for(QList::const_iterator i = viewsList.begin(); i != viewsList.end(); ++i) {
- setTabIcon(*i, icon);
+ for (auto view : viewsList) {
+ setTabIcon(view, icon);
}
}
@@ -855,7 +851,7 @@
}
}
-void Manager::convertSelectionToLaTeX(void)
+void Manager::convertSelectionToLaTeX()
{
KTextEditor::View *view = currentTextView();
@@ -922,7 +918,7 @@
/**
* Pastes the clipboard's contents as LaTeX (ie. % -> \%, etc.).
*/
-void Manager::pasteAsLaTeX(void)
+void Manager::pasteAsLaTeX()
{
KTextEditor::View *view = currentTextView();
@@ -1001,8 +997,7 @@
int index = tabIndexOf(qobject_cast(w));
KileDocument::Extensions *extensions = m_ki->extensions();
bool hasReplacedTab = false;
- for(QList::iterator i = urls.begin(); i != urls.end(); ++i) {
- QUrl url = *i;
+ for (auto url : urls) {
if(extensions->isProjectFile(url)) {
m_ki->docManager()->projectOpen(url);
}
@@ -1020,12 +1015,12 @@
void Manager::updateTabTexts(KTextEditor::Document *changedDoc)
{
const QList &viewsList = changedDoc->views();
- for(QList::const_iterator i = viewsList.begin(); i != viewsList.end(); ++i) {
+ for (auto view : viewsList) {
QString documentName = changedDoc->documentName();
if(documentName.isEmpty()) {
documentName = i18n("Untitled");
}
- const int viewIndex = tabIndexOf(*i);
+ const int viewIndex = tabIndexOf(view);
m_tabBar->setTabText(viewIndex, documentName);
m_tabBar->setTabToolTip(viewIndex, changedDoc->url().toString());
}
@@ -1037,10 +1032,6 @@
setAcceptDrops(true);
}
-DropWidget::~DropWidget()
-{
-}
-
void DropWidget::dragEnterEvent(QDragEnterEvent *e)
{
bool b;
diff --git a/src/latexcmd.cpp b/src/latexcmd.cpp
--- a/src/latexcmd.cpp
+++ b/src/latexcmd.cpp
@@ -177,12 +177,12 @@
void LatexCommands::insert(const QStringList &list)
{
// now insert new entries, if they have the right number of attributes
- QStringList::ConstIterator it;
- for(it = list.begin(); it!=list.end(); ++it) {
- int pos = (*it).indexOf(',');
+
+ for (const auto &item : list) {
+ int pos = item.indexOf(',');
if(pos >= 0) {
- QString key = (*it).left(pos);
- QString value = (*it).right( (*it).length()-pos-1 );
+ QString key = item.left(pos);
+ QString value = item.right(item.length()-pos-1 );
QStringList valuelist = value.split(',', QString::KeepEmptyParts);
int attributes = ( key.at(0)=='\\' ) ? MaxCmdAttr : MaxEnvAttr;
if(valuelist.count() == attributes) {
@@ -193,7 +193,7 @@
}
}
else {
- KILE_DEBUG_MAIN << "\tLatexCommands error: no separator found (" << (*it) << ")" ;
+ KILE_DEBUG_MAIN << "\tLatexCommands error: no separator found (" << item << ")" ;
}
}
}
diff --git a/src/livepreview.cpp b/src/livepreview.cpp
--- a/src/livepreview.cpp
+++ b/src/livepreview.cpp
@@ -278,7 +278,7 @@
void LivePreviewManager::setLivePreviewToolActionsEnabled(bool b)
{
- Q_FOREACH(QAction *action, m_livePreviewToolActionList) {
+ for (auto &action : m_livePreviewToolActionList) {
action->setEnabled(b);
}
}
@@ -304,15 +304,15 @@
QList toolList = toolsWithConfigurationsBasedOnClass(config, "LaTeXLivePreview");
std::sort(toolList.begin(), toolList.end());
- for(QList::iterator i = toolList.begin(); i != toolList.end(); ++i) {
- const QString shortToolName = QString((*i).first).remove("LivePreview-");
- QAction *action = new KToggleAction(ToolConfigPair::userStringRepresentation(shortToolName, (*i).second), this);
+ for (auto &i : toolList) {
+ const QString shortToolName = QString(i.first).remove("LivePreview-");
+ QAction *action = new KToggleAction(ToolConfigPair::userStringRepresentation(shortToolName, i.second), this);
m_livePreviewToolActionGroup->addAction(action);
connect(action, SIGNAL(triggered()), this, SLOT(livePreviewToolActionTriggered()));
m_livePreviewToolActionList.push_back(action);
- m_livePreviewToolToActionHash[*i] = action;
- m_actionToLivePreviewToolHash[action] = *i;
+ m_livePreviewToolToActionHash[i] = action;
+ m_actionToLivePreviewToolHash[action] = i;
menu->addAction(action);
}
menu->addSeparator();
@@ -803,9 +803,7 @@
static void fillTextHashForProject(KileProject *project, QHash &textHash)
{
QList list = project->items();
- for(QList::iterator it = list.begin(); it != list.end(); ++it) {
- KileProjectItem *item = *it;
-
+ for (auto item : list) {
KileDocument::TextInfo *textInfo = item->getInfo();
if(!textInfo) {
continue;
@@ -822,8 +820,7 @@
{
// we compute hashes over all the opened files
QList textDocumentInfos = m_ki->docManager()->textDocumentInfos();
- for(QList::iterator it = textDocumentInfos.begin(); it != textDocumentInfos.end(); ++it) {
- KileDocument::TextInfo *textInfo = *it;
+ for (auto textInfo : textDocumentInfos) {
if(!textInfo) {
continue;
}
diff --git a/src/main.cpp b/src/main.cpp
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -201,7 +201,7 @@
else {
QDBusInterface *interface = new QDBusInterface("net.sourceforge.kile","/main","net.sourceforge.kile.main");
- Q_FOREACH(QString argument, parser.positionalArguments()) {
+ for (QString &argument : parser.positionalArguments()) {
if(argument == "-") {
interface->call("openDocument", readDataFromStdin());
}
diff --git a/src/outputinfo.h b/src/outputinfo.h
--- a/src/outputinfo.h
+++ b/src/outputinfo.h
@@ -159,7 +159,7 @@
{
public:
LaTeXOutputHandler();
- virtual ~LaTeXOutputHandler();
+ virtual ~LaTeXOutputHandler() = default;
void storeLaTeXOutputParserResult(int nErrors, int nWarnings, int nBadBoxes,
const LatexOutputInfoArray& outputList,
diff --git a/src/outputinfo.cpp b/src/outputinfo.cpp
--- a/src/outputinfo.cpp
+++ b/src/outputinfo.cpp
@@ -77,11 +77,6 @@
{
}
-LaTeXOutputHandler::~LaTeXOutputHandler()
-{
-
-}
-
void LaTeXOutputHandler::storeLaTeXOutputParserResult(int nErrors, int nWarnings, int nBadBoxes,
const LatexOutputInfoArray& outputList,
const QString& logFile)
diff --git a/src/parser/latexoutputparser.cpp b/src/parser/latexoutputparser.cpp
--- a/src/parser/latexoutputparser.cpp
+++ b/src/parser/latexoutputparser.cpp
@@ -94,8 +94,8 @@
// try to determine the LaTeX source file
QStringList extlist = m_extensions->latexDocuments().split(' ');
- for(QStringList::Iterator it = extlist.begin(); it!=extlist.end(); ++it) {
- fi.setFile(path() + '/' + name + (*it));
+ for (auto &extension : extlist) {
+ fi.setFile(path() + '/' + name + extension);
if(fi.exists() && !fi.isDir()) {
return true;
}
diff --git a/src/plaintolatexconverter.h b/src/plaintolatexconverter.h
--- a/src/plaintolatexconverter.h
+++ b/src/plaintolatexconverter.h
@@ -30,8 +30,8 @@
class PlainToLaTeXConverter
{
public:
- PlainToLaTeXConverter(void);
- ~PlainToLaTeXConverter(void);
+ PlainToLaTeXConverter();
+ ~PlainToLaTeXConverter() = default;
QString ConvertToLaTeX(const QString&) const;
diff --git a/src/plaintolatexconverter.cpp b/src/plaintolatexconverter.cpp
--- a/src/plaintolatexconverter.cpp
+++ b/src/plaintolatexconverter.cpp
@@ -19,7 +19,7 @@
#include "plaintolatexconverter.h"
-PlainToLaTeXConverter::PlainToLaTeXConverter(void)
+PlainToLaTeXConverter::PlainToLaTeXConverter()
{
// Fill the replacement map
//TODO Do it only once!
@@ -34,7 +34,6 @@
m_replaceMap.insert('~', "$\\sim$");
}
-PlainToLaTeXConverter::~PlainToLaTeXConverter(void) {}
/**
* Converts plain text to LaTeX.
@@ -45,21 +44,8 @@
{
QString result(toConv);
- // Replacing what must be...
- uint sSize = result.length();
- QMap::const_iterator mapEnd = m_replaceMap.end();
- for(uint i = 0 ; i < sSize ; ++i)
- {
- QMap::const_iterator it = m_replaceMap.find(result.at(i));
-
- if(it != mapEnd) { // The character must be replaced
- result.replace(i, 1, *it);
- uint len = (*it).length();
- if(1 < len) {
- i += len - 1;
- sSize += len - 1;
- }
- }
+ for (QMap::const_iterator it = m_replaceMap.cbegin(); it != m_replaceMap.cend(); ++it) {
+ result.replace(it.key(), it.value());
}
return result;
diff --git a/src/scriptmanager.h b/src/scriptmanager.h
--- a/src/scriptmanager.h
+++ b/src/scriptmanager.h
@@ -188,7 +188,7 @@
public:
ScriptExecutionAction(unsigned int scriptID, Manager *manager, QObject* parent = 0);
- virtual ~ScriptExecutionAction();
+ virtual ~ScriptExecutionAction() = default;
protected Q_SLOTS:
void executeScript();
diff --git a/src/scriptmanager.cpp b/src/scriptmanager.cpp
--- a/src/scriptmanager.cpp
+++ b/src/scriptmanager.cpp
@@ -144,10 +144,10 @@
unsigned int maxID = 0;
QMap pathIDMap;
QMap takenIDMap;
- for(QList::iterator i = idList.begin(); i != idList.end(); ++i) {
- QString fileName = configGroup.readPathEntry("Script" + QString::number(*i), QString());
+ for (unsigned int &i : idList) {
+ QString fileName = configGroup.readPathEntry("Script" + QString::number(i), QString());
if(!fileName.isEmpty()) {
- unsigned int id = *i;
+ unsigned int id = i;
pathIDMap[fileName] = id;
takenIDMap[id] = true;
maxID = qMax(maxID, id);
@@ -157,14 +157,14 @@
// scan *.js files
QSet scriptFileNamesSet;
const QStringList dirs = QStandardPaths::locateAll(QStandardPaths::DataLocation, "scripts/", QStandardPaths::LocateDirectory);
- Q_FOREACH (const QString &dir, dirs) {
+ for (const QString &dir : dirs) {
QDirIterator it(dir, QStringList() << QStringLiteral("*.js"), QDir::Files | QDir::Readable, QDirIterator::Subdirectories);
while (it.hasNext()) {
scriptFileNamesSet.insert(it.next());
}
}
- Q_FOREACH(const QString &scriptFileName, scriptFileNamesSet) {
+ for (const QString &scriptFileName : scriptFileNamesSet) {
registerScript(scriptFileName, pathIDMap, takenIDMap, maxID);
}
//rewrite the IDs that are currently in use
@@ -178,21 +178,21 @@
QList