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

Method createRows

src/plugins/java/maven/project/mavenasynparse.cpp:118–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

116}
117
118void MavenAsynParse::createRows(const QString &path)
119{
120 QString rootPath = path;
121 if (rootPath.endsWith(QDir::separator())) {
122 int separatorSize = QString(QDir::separator()).size();
123 rootPath = rootPath.remove(rootPath.size() - separatorSize, separatorSize);
124 }
125
126 // 缓存当前工程目录
127 d->rootPath = rootPath;
128 QFileSystemWatcher::addPath(d->rootPath);
129
130 {// 避免变量冲突 迭代文件夹
131 QDir dir;
132 dir.setPath(rootPath);
133 dir.setFilter(QDir::NoDotAndDotDot | QDir::Dirs);
134 dir.setSorting(QDir::Name);
135 QDirIterator dirItera(dir, QDirIterator::Subdirectories);
136 while (dirItera.hasNext()) {
137 QString childPath = dirItera.next().remove(0, rootPath.size());
138 QFileSystemWatcher::addPath(dirItera.filePath());
139 QStandardItem *item = findItem(childPath);
140 auto newItem = new QStandardItem(dirItera.fileName());
141 newItem->setData(dirItera.filePath(), Project::FileIconRole);
142 newItem->setToolTip(dirItera.filePath());
143 if (!item) {
144 d->rows.append(newItem);
145 } else {
146 item->appendRow(newItem);
147 }
148 }
149 }
150 {// 避免变量冲突 迭代文件
151 QDir dir;
152 dir.setPath(rootPath);
153 dir.setFilter(QDir::NoDotAndDotDot | QDir::Files);
154 dir.setSorting(QDir::Name);
155 QDirIterator fileItera(dir, QDirIterator::Subdirectories);
156 while (fileItera.hasNext()) {
157 QString childPath = fileItera.next().remove(0, rootPath.size());
158 QStandardItem *item = findItem(childPath);
159 auto newItem = new QStandardItem(fileItera.fileName());
160 newItem->setData(fileItera.filePath(), Project::FileIconRole);
161 newItem->setToolTip(fileItera.filePath());
162 if (!item) {
163 d->rows.append(newItem);
164 } else {
165 item->appendRow(newItem);
166 }
167 }
168 }
169}
170
171QList<QStandardItem *> MavenAsynParse::rows(const QStandardItem *item) const
172{

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