Commit 53bbdd0e authored by Waqar Ahmed's avatar Waqar Ahmed
Browse files

Make methods static in ProjectWorker


Signed-off-by: Waqar Ahmed's avatarWaqar Ahmed <waqar.17a@gmail.com>
parent d19b911a
......@@ -38,7 +38,7 @@ void KateProjectWorker::run()
*/
KateProjectSharedQStandardItem topLevel(new QStandardItem());
KateProjectSharedQHashStringItem file2Item(new QHash<QString, KateProjectItem *>());
loadProject(topLevel.data(), m_projectMap, file2Item.data());
loadProject(topLevel.data(), m_projectMap, file2Item.data(), m_baseDir);
/**
* sort the stuff once recursively, this is a LOT faster than once sorting the list
......@@ -90,7 +90,7 @@ void KateProjectWorker::run()
Q_EMIT loadIndexDone(index);
}
void KateProjectWorker::loadProject(QStandardItem *parent, const QVariantMap &project, QHash<QString, KateProjectItem *> *file2Item)
void KateProjectWorker::loadProject(QStandardItem *parent, const QVariantMap &project, QHash<QString, KateProjectItem *> *file2Item, const QString &baseDir)
{
/**
* recurse to sub-projects FIRST
......@@ -110,7 +110,7 @@ void KateProjectWorker::loadProject(QStandardItem *parent, const QVariantMap &pr
* recurse
*/
QStandardItem *subProjectItem = new KateProjectItem(KateProjectItem::Project, subProject[keyName].toString());
loadProject(subProjectItem, subProject, file2Item);
loadProject(subProjectItem, subProject, file2Item, baseDir);
parent->appendRow(subProjectItem);
}
......@@ -120,7 +120,7 @@ void KateProjectWorker::loadProject(QStandardItem *parent, const QVariantMap &pr
const QString keyFiles = QStringLiteral("files");
const QVariantList files = project[keyFiles].toList();
for (const QVariant &fileVariant : files) {
loadFilesEntry(parent, fileVariant.toMap(), file2Item);
loadFilesEntry(parent, fileVariant.toMap(), file2Item, baseDir);
}
}
......@@ -187,9 +187,12 @@ static QStandardItem *directoryParent(const QDir &base, QHash<QString, QStandard
return item;
}
void KateProjectWorker::loadFilesEntry(QStandardItem *parent, const QVariantMap &filesEntry, QHash<QString, KateProjectItem *> *file2Item)
void KateProjectWorker::loadFilesEntry(QStandardItem *parent,
const QVariantMap &filesEntry,
QHash<QString, KateProjectItem *> *file2Item,
const QString &baseDir)
{
QDir dir(m_baseDir);
QDir dir(baseDir);
if (!dir.cd(filesEntry[QStringLiteral("directory")].toString())) {
return;
}
......@@ -370,9 +373,9 @@ QVector<QString> KateProjectWorker::findFiles(const QDir &dir, const QVariantMap
* all code later requires this and the filesFrom... routines do this, too, internally
* even without this, the tree views will show them, but opening them will create new elements!
*/
for (auto &file : userGivenFilesList) {
file = dir.absoluteFilePath(file);
}
// for (auto &file : userGivenFilesList) {
// file = dir.absoluteFilePath(file);
// }
/**
* users might have specified duplicates, this can't happen for the other ways
......
......@@ -47,7 +47,7 @@ private:
* @param project variant map for this group
* @param file2Item mapping file => item, will be filled
*/
void loadProject(QStandardItem *parent, const QVariantMap &project, QHash<QString, KateProjectItem *> *file2Item);
static void loadProject(QStandardItem *parent, const QVariantMap &project, QHash<QString, KateProjectItem *> *file2Item, const QString &baseDir);
/**
* Load one files entry in the current parent item.
......@@ -55,17 +55,17 @@ private:
* @param filesEntry one files entry specification to load
* @param file2Item mapping file => item, will be filled
*/
void loadFilesEntry(QStandardItem *parent, const QVariantMap &filesEntry, QHash<QString, KateProjectItem *> *file2Item);
static void loadFilesEntry(QStandardItem *parent, const QVariantMap &filesEntry, QHash<QString, KateProjectItem *> *file2Item, const QString &baseDir);
QVector<QString> findFiles(const QDir &dir, const QVariantMap &filesEntry);
static QVector<QString> findFiles(const QDir &dir, const QVariantMap &filesEntry);
QVector<QString> filesFromGit(const QDir &dir, bool recursive);
QVector<QString> filesFromMercurial(const QDir &dir, bool recursive);
QVector<QString> filesFromSubversion(const QDir &dir, bool recursive);
QVector<QString> filesFromDarcs(const QDir &dir, bool recursive);
QVector<QString> filesFromDirectory(const QDir &dir, bool recursive, const QStringList &filters);
static QVector<QString> filesFromGit(const QDir &dir, bool recursive);
static QVector<QString> filesFromMercurial(const QDir &dir, bool recursive);
static QVector<QString> filesFromSubversion(const QDir &dir, bool recursive);
static QVector<QString> filesFromDarcs(const QDir &dir, bool recursive);
static QVector<QString> filesFromDirectory(const QDir &dir, bool recursive, const QStringList &filters);
QVector<QString> gitFiles(const QDir &dir, bool recursive, const QStringList &args);
static QVector<QString> gitFiles(const QDir &dir, bool recursive, const QStringList &args);
private:
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment