| 283 | } |
| 284 | |
| 285 | void CMakePreferences::createBuildDir() |
| 286 | { |
| 287 | CMakeBuildDirChooser bdCreator; |
| 288 | bdCreator.setProject( m_project ); |
| 289 | |
| 290 | // NOTE: (on removing the trailing slashes) |
| 291 | // Generally, we have no clue about how shall a trailing slash look in the current system. |
| 292 | // Moreover, the slash may be a part of the filename. |
| 293 | // It may be '/' or '\', so maybe should we rely on CMake::allBuildDirs() for returning well-formed paths? |
| 294 | QStringList used = CMake::allBuildDirs( m_project ); |
| 295 | bdCreator.setAlreadyUsed(used); |
| 296 | bdCreator.setCMakeExecutable(Path(CMakeBuilderSettings::self()->cmakeExecutable().toLocalFile())); |
| 297 | |
| 298 | if(bdCreator.exec()) |
| 299 | { |
| 300 | int addedBuildDirIndex = m_prefsUi->buildDirs->count(); |
| 301 | |
| 302 | // Initialize the kconfig items with the values from the dialog, this ensures the settings |
| 303 | // end up in the config file once the changes are saved |
| 304 | qCDebug(CMAKE) << "adding to cmake config: new builddir index" << addedBuildDirIndex; |
| 305 | qCDebug(CMAKE) << "adding to cmake config: builddir path " << bdCreator.buildFolder(); |
| 306 | qCDebug(CMAKE) << "adding to cmake config: installdir " << bdCreator.installPrefix(); |
| 307 | qCDebug(CMAKE) << "adding to cmake config: extra args" << bdCreator.extraArguments(); |
| 308 | qCDebug(CMAKE) << "adding to cmake config: build type " << bdCreator.buildType(); |
| 309 | qCDebug(CMAKE) << "adding to cmake config: cmake executable " << bdCreator.cmakeExecutable(); |
| 310 | qCDebug(CMAKE) << "adding to cmake config: environment empty"; |
| 311 | CMake::setOverrideBuildDirIndex( m_project, addedBuildDirIndex ); |
| 312 | CMake::setBuildDirCount( m_project, addedBuildDirIndex + 1 ); |
| 313 | CMake::setCurrentBuildDir( m_project, bdCreator.buildFolder() ); |
| 314 | CMake::setCurrentInstallDir( m_project, bdCreator.installPrefix() ); |
| 315 | CMake::setCurrentExtraArguments( m_project, bdCreator.extraArguments() ); |
| 316 | CMake::setCurrentBuildType( m_project, bdCreator.buildType() ); |
| 317 | CMake::setCurrentCMakeExecutable(m_project, bdCreator.cmakeExecutable()); |
| 318 | CMake::setCurrentEnvironment( m_project, QString() ); |
| 319 | |
| 320 | QString newbuilddir = bdCreator.buildFolder().toLocalFile(); |
| 321 | m_prefsUi->buildDirs->addItem( newbuilddir ); |
| 322 | m_prefsUi->buildDirs->setCurrentIndex( addedBuildDirIndex ); |
| 323 | m_prefsUi->removeBuildDir->setEnabled( true ); |
| 324 | |
| 325 | qCDebug(CMAKE) << "Emitting changed signal for cmake kcm"; |
| 326 | emit changed(); |
| 327 | } |
| 328 | //TODO: Save it for next runs |
| 329 | } |
| 330 | |
| 331 | void CMakePreferences::removeBuildDir() |
| 332 | { |
nothing calls this directly
no test coverage detected