MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / createRows

Method createRows

src/plugins/java/gradle/project/gradleasynparse.cpp:74–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74void GradleAsynParse::createRows(const QString &path)
75{
76 QString rootPath = path;
77 if (rootPath.endsWith(QDir::separator())) {
78 int separatorSize = QString(QDir::separator()).size();
79 rootPath = rootPath.remove(rootPath.size() - separatorSize, separatorSize);
80 }
81
82 // 缓存当前工程目录
83 d->rootPath = rootPath;
84 QFileSystemWatcher::addPath(d->rootPath);
85
86 {// 避免变量冲突 迭代文件夹
87 QDir dir;
88 dir.setPath(rootPath);
89 dir.setFilter(QDir::NoDotAndDotDot | QDir::Dirs);
90 dir.setSorting(QDir::Name);
91 QDirIterator dirItera(dir, QDirIterator::Subdirectories);
92 while (dirItera.hasNext()) {
93 QString childPath = dirItera.next().remove(0, rootPath.size());
94 QFileSystemWatcher::addPath(dirItera.filePath());
95 QStandardItem *item = findItem(childPath);
96 auto newItem = new QStandardItem(dirItera.fileName());
97 newItem->setData(dirItera.filePath(), Project::FileIconRole);
98 newItem->setToolTip(dirItera.filePath());
99 if (!item) {
100 d->rows.append(newItem);
101 } else {
102 item->appendRow(newItem);
103 }
104 }
105 }
106 {// 避免变量冲突 迭代文件
107 QDir dir;
108 dir.setPath(rootPath);
109 dir.setFilter(QDir::NoDotAndDotDot | QDir::Files);
110 dir.setSorting(QDir::Name);
111 QDirIterator fileItera(dir, QDirIterator::Subdirectories);
112 while (fileItera.hasNext()) {
113 QString childPath = fileItera.next().remove(0, rootPath.size());
114 QStandardItem *item = findItem(childPath);
115 auto newItem = new QStandardItem(fileItera.fileName());
116 newItem->setData(fileItera.filePath(), Project::FileIconRole);
117 newItem->setToolTip(fileItera.filePath());
118 if (!item) {
119 d->rows.append(newItem);
120 } else {
121 item->appendRow(newItem);
122 }
123 }
124 }
125}
126
127QList<QStandardItem *> GradleAsynParse::rows(const QStandardItem *item) const
128{

Callers

nothing calls this directly

Calls 11

endsWithMethod · 0.80
fileNameMethod · 0.80
QStringClass · 0.50
sizeMethod · 0.45
removeMethod · 0.45
setPathMethod · 0.45
nextMethod · 0.45
filePathMethod · 0.45
setDataMethod · 0.45
appendMethod · 0.45
appendRowMethod · 0.45

Tested by

no test coverage detected