MCPcopy Create free account
hub / github.com/KDE/kdevelop / updated

Method updated

plugins/cmake/cmakebuilddirchooser.cpp:143–233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141}
142
143void CMakeBuildDirChooser::updated()
144{
145 StatusTypes st;
146 Path chosenBuildFolder(m_chooserUi->buildFolder->url());
147 bool emptyUrl = chosenBuildFolder.isEmpty();
148 if( emptyUrl ) st |= BuildFolderEmpty;
149
150 bool dirEmpty = false, dirExists= false, dirRelative = false;
151 QString srcDir;
152 QString installDir;
153 QString buildType;
154 if(!emptyUrl)
155 {
156 QDir d(chosenBuildFolder.toLocalFile());
157 dirExists = d.exists();
158 dirEmpty = dirExists && d.count()<=2;
159 dirRelative = d.isRelative();
160 if(!dirEmpty && dirExists && !dirRelative)
161 {
162 bool hasCache=QFile::exists(Path(chosenBuildFolder, QStringLiteral("CMakeCache.txt")).toLocalFile());
163 if(hasCache)
164 {
165 QString proposed=m_srcFolder.toLocalFile();
166
167 buildDirSettings(chosenBuildFolder, srcDir, installDir, buildType);
168 if(!srcDir.isEmpty())
169 {
170 auto rt = ICore::self()->runtimeController()->currentRuntime();
171 if(QDir(rt->pathInHost(Path(srcDir)).toLocalFile()).canonicalPath() == QDir(proposed).canonicalPath())
172 {
173 st |= CorrectBuildDir | BuildDirCreated;
174 }
175 }
176 else
177 {
178 qCWarning(CMAKE) << "maybe you are trying a damaged CMakeCache.txt file. Proper: ";
179 }
180
181 if(!installDir.isEmpty() && QDir(installDir).exists())
182 {
183 m_chooserUi->installPrefix->setUrl(QUrl::fromLocalFile(installDir));
184 }
185
186 m_chooserUi->buildType->setCurrentText(buildType);
187 }
188 }
189
190 if(m_alreadyUsed.contains(chosenBuildFolder.toLocalFile()) && !m_chooserUi->availableBuildDirs->isEnabled()) {
191 st=DirAlreadyCreated;
192 }
193 }
194 else
195 {
196 setStatus(i18n("You need to specify a build directory."), false);
197 return;
198 }
199
200

Callers

nothing calls this directly

Calls 15

toLocalFileMethod · 0.80
existsMethod · 0.80
currentRuntimeMethod · 0.80
runtimeControllerMethod · 0.80
canonicalPathMethod · 0.80
PathClass · 0.70
QDirClass · 0.50
urlMethod · 0.45
isEmptyMethod · 0.45
countMethod · 0.45
pathInHostMethod · 0.45
setUrlMethod · 0.45

Tested by

no test coverage detected