mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Simplify Finding the Templates
We don't need a list of QFileInfo if we are not using it much better to have a list of the files directly Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
a809eec853
commit
f07a9fa09f
1 changed files with 7 additions and 8 deletions
|
@ -21,20 +21,19 @@ void find_all_templates()
|
||||||
grantlee_templates.clear();
|
grantlee_templates.clear();
|
||||||
grantlee_statistics_templates.clear();
|
grantlee_statistics_templates.clear();
|
||||||
QDir dir(getPrintingTemplatePathUser());
|
QDir dir(getPrintingTemplatePathUser());
|
||||||
QFileInfoList list = dir.entryInfoList(QDir::Files | QDir::NoDotAndDotDot);
|
QStringList list = dir.entryList(QDir::Files | QDir::NoDotAndDotDot);
|
||||||
foreach (QFileInfo finfo, list) {
|
foreach (const QString& filename, list) {
|
||||||
QString filename = finfo.fileName();
|
|
||||||
if (filename.at(filename.size() - 1) != '~') {
|
if (filename.at(filename.size() - 1) != '~') {
|
||||||
grantlee_templates.append(finfo.fileName());
|
grantlee_templates.append(filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// find statistics templates
|
// find statistics templates
|
||||||
dir.setPath(getPrintingTemplatePathUser() + QDir::separator() + "statistics");
|
dir.setPath(getPrintingTemplatePathUser() + QDir::separator() + "statistics");
|
||||||
list = dir.entryInfoList(QDir::Files | QDir::NoDotAndDotDot);
|
list = dir.entryList(QDir::Files | QDir::NoDotAndDotDot);
|
||||||
foreach (QFileInfo finfo, list) {
|
foreach (const QString& filename, list) {
|
||||||
QString filename = finfo.fileName();
|
|
||||||
if (filename.at(filename.size() - 1) != '~') {
|
if (filename.at(filename.size() - 1) != '~') {
|
||||||
grantlee_statistics_templates.append(finfo.fileName());
|
grantlee_statistics_templates.append(filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue