Changeset View
Changeset View
Standalone View
Standalone View
projectmanagers/cmake/settings/cmakepreferences.cpp
Show First 20 Lines • Show All 296 Lines • ▼ Show 20 Line(s) | 291 | { | |||
---|---|---|---|---|---|
297 | // Moreover, the slash may be a part of the filename. | 297 | // Moreover, the slash may be a part of the filename. | ||
298 | // It may be '/' or '\', so maybe should we rely on CMake::allBuildDirs() for returning well-formed paths? | 298 | // It may be '/' or '\', so maybe should we rely on CMake::allBuildDirs() for returning well-formed paths? | ||
299 | QStringList used = CMake::allBuildDirs( m_project ); | 299 | QStringList used = CMake::allBuildDirs( m_project ); | ||
300 | bdCreator.setAlreadyUsed(used); | 300 | bdCreator.setAlreadyUsed(used); | ||
301 | bdCreator.setCMakeBinary(Path(CMake::findExecutable())); | 301 | bdCreator.setCMakeBinary(Path(CMake::findExecutable())); | ||
302 | 302 | | |||
303 | if(bdCreator.exec()) | 303 | if(bdCreator.exec()) | ||
304 | { | 304 | { | ||
305 | QString newbuilddir = bdCreator.buildFolder().toLocalFile(); | 305 | int addedBuildDirIndex = m_prefsUi->buildDirs->count(); | ||
306 | m_prefsUi->buildDirs->addItem(newbuilddir); | | |||
307 | | ||||
308 | int buildDirCount = m_prefsUi->buildDirs->count(); | | |||
309 | int addedBuildDirIndex = buildDirCount - 1; | | |||
310 | m_prefsUi->buildDirs->setCurrentIndex(addedBuildDirIndex); | | |||
311 | m_prefsUi->removeBuildDir->setEnabled(true); | | |||
312 | 306 | | |||
313 | // Initialize the kconfig items with the values from the dialog, this ensures the settings | 307 | // Initialize the kconfig items with the values from the dialog, this ensures the settings | ||
314 | // end up in the config file once the changes are saved | 308 | // end up in the config file once the changes are saved | ||
315 | qCDebug(CMAKE) << "adding to cmake config: new builddir index" << addedBuildDirIndex; | 309 | qCDebug(CMAKE) << "adding to cmake config: new builddir index" << addedBuildDirIndex; | ||
316 | qCDebug(CMAKE) << "adding to cmake config: builddir path " << bdCreator.buildFolder(); | 310 | qCDebug(CMAKE) << "adding to cmake config: builddir path " << bdCreator.buildFolder(); | ||
317 | qCDebug(CMAKE) << "adding to cmake config: installdir " << bdCreator.installPrefix(); | 311 | qCDebug(CMAKE) << "adding to cmake config: installdir " << bdCreator.installPrefix(); | ||
318 | qCDebug(CMAKE) << "adding to cmake config: extra args" << bdCreator.extraArguments(); | 312 | qCDebug(CMAKE) << "adding to cmake config: extra args" << bdCreator.extraArguments(); | ||
319 | qCDebug(CMAKE) << "adding to cmake config: build type " << bdCreator.buildType(); | 313 | qCDebug(CMAKE) << "adding to cmake config: build type " << bdCreator.buildType(); | ||
320 | qCDebug(CMAKE) << "adding to cmake config: cmake binary " << bdCreator.cmakeBinary(); | 314 | qCDebug(CMAKE) << "adding to cmake config: cmake binary " << bdCreator.cmakeBinary(); | ||
321 | qCDebug(CMAKE) << "adding to cmake config: environment empty"; | 315 | qCDebug(CMAKE) << "adding to cmake config: environment empty"; | ||
322 | CMake::setBuildDirCount( m_project, buildDirCount ); | 316 | CMake::setOverrideBuildDirIndex( m_project, addedBuildDirIndex ); | ||
317 | CMake::setBuildDirCount( m_project, addedBuildDirIndex + 1 ); | ||||
323 | CMake::setCurrentBuildDir( m_project, bdCreator.buildFolder() ); | 318 | CMake::setCurrentBuildDir( m_project, bdCreator.buildFolder() ); | ||
324 | CMake::setCurrentInstallDir( m_project, bdCreator.installPrefix() ); | 319 | CMake::setCurrentInstallDir( m_project, bdCreator.installPrefix() ); | ||
325 | CMake::setCurrentExtraArguments( m_project, bdCreator.extraArguments() ); | 320 | CMake::setCurrentExtraArguments( m_project, bdCreator.extraArguments() ); | ||
326 | CMake::setCurrentBuildType( m_project, bdCreator.buildType() ); | 321 | CMake::setCurrentBuildType( m_project, bdCreator.buildType() ); | ||
327 | CMake::setCurrentCMakeBinary( m_project, bdCreator.cmakeBinary() ); | 322 | CMake::setCurrentCMakeBinary( m_project, bdCreator.cmakeBinary() ); | ||
328 | CMake::setCurrentEnvironment( m_project, QString() ); | 323 | CMake::setCurrentEnvironment( m_project, QString() ); | ||
329 | 324 | | |||
325 | QString newbuilddir = bdCreator.buildFolder().toLocalFile(); | ||||
326 | m_prefsUi->buildDirs->addItem( newbuilddir ); | ||||
327 | m_prefsUi->buildDirs->setCurrentIndex( addedBuildDirIndex ); | ||||
328 | m_prefsUi->removeBuildDir->setEnabled( true ); | ||||
329 | | ||||
330 | qCDebug(CMAKE) << "Emitting changed signal for cmake kcm"; | 330 | qCDebug(CMAKE) << "Emitting changed signal for cmake kcm"; | ||
331 | emit changed(); | 331 | emit changed(); | ||
332 | } | 332 | } | ||
333 | //TODO: Save it for next runs | 333 | //TODO: Save it for next runs | ||
334 | } | 334 | } | ||
335 | 335 | | |||
336 | void CMakePreferences::removeBuildDir() | 336 | void CMakePreferences::removeBuildDir() | ||
337 | { | 337 | { | ||
▲ Show 20 Lines • Show All 73 Lines • Show Last 20 Lines |