Changeset View
Changeset View
Standalone View
Standalone View
projectmanagers/cmake/settings/cmakepreferences.cpp
Show First 20 Lines • Show All 86 Lines • ▼ Show 20 Line(s) | 54 | { | |||
---|---|---|---|---|---|
87 | connect(m_prefsUi->buildType, static_cast<void(QComboBox::*)(const QString&)>(&QComboBox::currentIndexChanged), | 87 | connect(m_prefsUi->buildType, static_cast<void(QComboBox::*)(const QString&)>(&QComboBox::currentIndexChanged), | ||
88 | this, &CMakePreferences::changed); | 88 | this, &CMakePreferences::changed); | ||
89 | connect(m_prefsUi->buildType, &QComboBox::currentTextChanged, | 89 | connect(m_prefsUi->buildType, &QComboBox::currentTextChanged, | ||
90 | this, &CMakePreferences::changed); | 90 | this, &CMakePreferences::changed); | ||
91 | connect(m_prefsUi->extraArguments, &KComboBox::currentTextChanged, | 91 | connect(m_prefsUi->extraArguments, &KComboBox::currentTextChanged, | ||
92 | this, &CMakePreferences::changed); | 92 | this, &CMakePreferences::changed); | ||
93 | connect(m_prefsUi->extraArguments, &KComboBox::editTextChanged, | 93 | connect(m_prefsUi->extraArguments, &KComboBox::editTextChanged, | ||
94 | this, &CMakePreferences::changed); | 94 | this, &CMakePreferences::changed); | ||
95 | connect(m_prefsUi->cMakeBinary, &KUrlRequester::textChanged, | 95 | connect(m_prefsUi->cMakeExecutable, &KUrlRequester::textChanged, | ||
96 | this, &CMakePreferences::changed); | 96 | this, &CMakePreferences::changed); | ||
97 | 97 | | |||
98 | showInternal(m_prefsUi->showInternal->checkState()); | 98 | showInternal(m_prefsUi->showInternal->checkState()); | ||
99 | m_subprojFolder = Path(options.projectTempFile).parent(); | 99 | m_subprojFolder = Path(options.projectTempFile).parent(); | ||
100 | 100 | | |||
101 | qCDebug(CMAKE) << "Source folder: " << m_srcFolder << options.projectTempFile; | 101 | qCDebug(CMAKE) << "Source folder: " << m_srcFolder << options.projectTempFile; | ||
102 | // foreach(const QVariant &v, args) | 102 | // foreach(const QVariant &v, args) | ||
103 | // { | 103 | // { | ||
Show All 19 Lines | 122 | { | |||
123 | m_prefsUi->environment->setCurrentProfile( CMake::currentEnvironment(m_project) ); | 123 | m_prefsUi->environment->setCurrentProfile( CMake::currentEnvironment(m_project) ); | ||
124 | m_prefsUi->installationPrefix->setText(CMake::currentInstallDir(m_project).toLocalFile()); | 124 | m_prefsUi->installationPrefix->setText(CMake::currentInstallDir(m_project).toLocalFile()); | ||
125 | const QString buildType = CMake::currentBuildType(m_project); | 125 | const QString buildType = CMake::currentBuildType(m_project); | ||
126 | if (m_prefsUi->buildType->findText(buildType) == -1) { | 126 | if (m_prefsUi->buildType->findText(buildType) == -1) { | ||
127 | m_prefsUi->buildType->addItem(buildType); | 127 | m_prefsUi->buildType->addItem(buildType); | ||
128 | } | 128 | } | ||
129 | m_prefsUi->buildType->setCurrentIndex(m_prefsUi->buildType->findText(buildType)); | 129 | m_prefsUi->buildType->setCurrentIndex(m_prefsUi->buildType->findText(buildType)); | ||
130 | m_prefsUi->extraArguments->setEditText(CMake::currentExtraArguments(m_project)); | 130 | m_prefsUi->extraArguments->setEditText(CMake::currentExtraArguments(m_project)); | ||
131 | m_prefsUi->cMakeBinary->setText(CMake::currentCMakeBinary(m_project).toLocalFile()); | 131 | m_prefsUi->cMakeExecutable->setText(CMake::currentCMakeExecutable(m_project).toLocalFile()); | ||
132 | } | 132 | } | ||
133 | 133 | | |||
134 | void CMakePreferences::reset() | 134 | void CMakePreferences::reset() | ||
135 | { | 135 | { | ||
136 | qCDebug(CMAKE) << "********loading"; | 136 | qCDebug(CMAKE) << "********loading"; | ||
137 | m_prefsUi->buildDirs->clear(); | 137 | m_prefsUi->buildDirs->clear(); | ||
138 | m_prefsUi->buildDirs->addItems( CMake::allBuildDirs(m_project) ); | 138 | m_prefsUi->buildDirs->addItems( CMake::allBuildDirs(m_project) ); | ||
139 | CMake::removeOverrideBuildDirIndex(m_project); // addItems() triggers buildDirChanged(), compensate for it | 139 | CMake::removeOverrideBuildDirIndex(m_project); // addItems() triggers buildDirChanged(), compensate for it | ||
Show All 26 Lines | 153 | { | |||
166 | 166 | | |||
167 | CMake::setCurrentInstallDir( m_project, Path(m_prefsUi->installationPrefix->text()) ); | 167 | CMake::setCurrentInstallDir( m_project, Path(m_prefsUi->installationPrefix->text()) ); | ||
168 | const QString buildType = m_prefsUi->buildType->currentText(); | 168 | const QString buildType = m_prefsUi->buildType->currentText(); | ||
169 | if (m_prefsUi->buildType->findText(buildType) == -1) { | 169 | if (m_prefsUi->buildType->findText(buildType) == -1) { | ||
170 | m_prefsUi->buildType->addItem(buildType); | 170 | m_prefsUi->buildType->addItem(buildType); | ||
171 | } | 171 | } | ||
172 | CMake::setCurrentBuildType( m_project, buildType ); | 172 | CMake::setCurrentBuildType( m_project, buildType ); | ||
173 | CMake::setCurrentExtraArguments( m_project, m_prefsUi->extraArguments->currentText() ); | 173 | CMake::setCurrentExtraArguments( m_project, m_prefsUi->extraArguments->currentText() ); | ||
174 | CMake::setCurrentCMakeBinary( m_project, Path(m_prefsUi->cMakeBinary->text()) ); | 174 | CMake::setCurrentCMakeExecutable(m_project, Path(m_prefsUi->cMakeExecutable->text())); | ||
175 | 175 | | |||
176 | qCDebug(CMAKE) << "writing to cmake config: using builddir " << CMake::currentBuildDirIndex(m_project); | 176 | qCDebug(CMAKE) << "writing to cmake config: using builddir " << CMake::currentBuildDirIndex(m_project); | ||
177 | qCDebug(CMAKE) << "writing to cmake config: builddir path " << CMake::currentBuildDir(m_project); | 177 | qCDebug(CMAKE) << "writing to cmake config: builddir path " << CMake::currentBuildDir(m_project); | ||
178 | qCDebug(CMAKE) << "writing to cmake config: installdir " << CMake::currentInstallDir(m_project); | 178 | qCDebug(CMAKE) << "writing to cmake config: installdir " << CMake::currentInstallDir(m_project); | ||
179 | qCDebug(CMAKE) << "writing to cmake config: build type " << CMake::currentBuildType(m_project); | 179 | qCDebug(CMAKE) << "writing to cmake config: build type " << CMake::currentBuildType(m_project); | ||
180 | qCDebug(CMAKE) << "writing to cmake config: cmake binary " << CMake::currentCMakeBinary(m_project); | 180 | qCDebug(CMAKE) << "writing to cmake config: cmake executable " << CMake::currentCMakeExecutable(m_project); | ||
181 | qCDebug(CMAKE) << "writing to cmake config: environment " << CMake::currentEnvironment(m_project); | 181 | qCDebug(CMAKE) << "writing to cmake config: environment " << CMake::currentEnvironment(m_project); | ||
182 | 182 | | |||
183 | //We run cmake on the builddir to generate it | 183 | //We run cmake on the builddir to generate it | ||
184 | configure(); | 184 | configure(); | ||
185 | } | 185 | } | ||
186 | 186 | | |||
187 | void CMakePreferences::defaults() | 187 | void CMakePreferences::defaults() | ||
188 | { | 188 | { | ||
▲ Show 20 Lines • Show All 102 Lines • ▼ Show 20 Line(s) | 289 | { | |||
291 | bdCreator.setSourceFolder( m_srcFolder ); | 291 | bdCreator.setSourceFolder( m_srcFolder ); | ||
292 | 292 | | |||
293 | // NOTE: (on removing the trailing slashes) | 293 | // NOTE: (on removing the trailing slashes) | ||
294 | // Generally, we have no clue about how shall a trailing slash look in the current system. | 294 | // Generally, we have no clue about how shall a trailing slash look in the current system. | ||
295 | // Moreover, the slash may be a part of the filename. | 295 | // Moreover, the slash may be a part of the filename. | ||
296 | // It may be '/' or '\', so maybe should we rely on CMake::allBuildDirs() for returning well-formed paths? | 296 | // It may be '/' or '\', so maybe should we rely on CMake::allBuildDirs() for returning well-formed paths? | ||
297 | QStringList used = CMake::allBuildDirs( m_project ); | 297 | QStringList used = CMake::allBuildDirs( m_project ); | ||
298 | bdCreator.setAlreadyUsed(used); | 298 | bdCreator.setAlreadyUsed(used); | ||
299 | bdCreator.setCMakeBinary(Path(CMake::findExecutable())); | 299 | bdCreator.setCMakeExecutable(Path(CMake::findExecutable())); | ||
300 | 300 | | |||
301 | if(bdCreator.exec()) | 301 | if(bdCreator.exec()) | ||
302 | { | 302 | { | ||
303 | int addedBuildDirIndex = m_prefsUi->buildDirs->count(); | 303 | int addedBuildDirIndex = m_prefsUi->buildDirs->count(); | ||
304 | 304 | | |||
305 | // Initialize the kconfig items with the values from the dialog, this ensures the settings | 305 | // Initialize the kconfig items with the values from the dialog, this ensures the settings | ||
306 | // end up in the config file once the changes are saved | 306 | // end up in the config file once the changes are saved | ||
307 | qCDebug(CMAKE) << "adding to cmake config: new builddir index" << addedBuildDirIndex; | 307 | qCDebug(CMAKE) << "adding to cmake config: new builddir index" << addedBuildDirIndex; | ||
308 | qCDebug(CMAKE) << "adding to cmake config: builddir path " << bdCreator.buildFolder(); | 308 | qCDebug(CMAKE) << "adding to cmake config: builddir path " << bdCreator.buildFolder(); | ||
309 | qCDebug(CMAKE) << "adding to cmake config: installdir " << bdCreator.installPrefix(); | 309 | qCDebug(CMAKE) << "adding to cmake config: installdir " << bdCreator.installPrefix(); | ||
310 | qCDebug(CMAKE) << "adding to cmake config: extra args" << bdCreator.extraArguments(); | 310 | qCDebug(CMAKE) << "adding to cmake config: extra args" << bdCreator.extraArguments(); | ||
311 | qCDebug(CMAKE) << "adding to cmake config: build type " << bdCreator.buildType(); | 311 | qCDebug(CMAKE) << "adding to cmake config: build type " << bdCreator.buildType(); | ||
312 | qCDebug(CMAKE) << "adding to cmake config: cmake binary " << bdCreator.cmakeBinary(); | 312 | qCDebug(CMAKE) << "adding to cmake config: cmake executable " << bdCreator.cmakeExecutable(); | ||
313 | qCDebug(CMAKE) << "adding to cmake config: environment empty"; | 313 | qCDebug(CMAKE) << "adding to cmake config: environment empty"; | ||
314 | CMake::setOverrideBuildDirIndex( m_project, addedBuildDirIndex ); | 314 | CMake::setOverrideBuildDirIndex( m_project, addedBuildDirIndex ); | ||
315 | CMake::setBuildDirCount( m_project, addedBuildDirIndex + 1 ); | 315 | CMake::setBuildDirCount( m_project, addedBuildDirIndex + 1 ); | ||
316 | CMake::setCurrentBuildDir( m_project, bdCreator.buildFolder() ); | 316 | CMake::setCurrentBuildDir( m_project, bdCreator.buildFolder() ); | ||
317 | CMake::setCurrentInstallDir( m_project, bdCreator.installPrefix() ); | 317 | CMake::setCurrentInstallDir( m_project, bdCreator.installPrefix() ); | ||
318 | CMake::setCurrentExtraArguments( m_project, bdCreator.extraArguments() ); | 318 | CMake::setCurrentExtraArguments( m_project, bdCreator.extraArguments() ); | ||
319 | CMake::setCurrentBuildType( m_project, bdCreator.buildType() ); | 319 | CMake::setCurrentBuildType( m_project, bdCreator.buildType() ); | ||
320 | CMake::setCurrentCMakeBinary( m_project, bdCreator.cmakeBinary() ); | 320 | CMake::setCurrentCMakeExecutable(m_project, bdCreator.cmakeExecutable()); | ||
321 | CMake::setCurrentEnvironment( m_project, QString() ); | 321 | CMake::setCurrentEnvironment( m_project, QString() ); | ||
322 | 322 | | |||
323 | QString newbuilddir = bdCreator.buildFolder().toLocalFile(); | 323 | QString newbuilddir = bdCreator.buildFolder().toLocalFile(); | ||
324 | m_prefsUi->buildDirs->addItem( newbuilddir ); | 324 | m_prefsUi->buildDirs->addItem( newbuilddir ); | ||
325 | m_prefsUi->buildDirs->setCurrentIndex( addedBuildDirIndex ); | 325 | m_prefsUi->buildDirs->setCurrentIndex( addedBuildDirIndex ); | ||
326 | m_prefsUi->removeBuildDir->setEnabled( true ); | 326 | m_prefsUi->removeBuildDir->setEnabled( true ); | ||
327 | 327 | | |||
328 | qCDebug(CMAKE) << "Emitting changed signal for cmake kcm"; | 328 | qCDebug(CMAKE) << "Emitting changed signal for cmake kcm"; | ||
Show All 24 Lines | 343 | { | |||
353 | } | 353 | } | ||
354 | } | 354 | } | ||
355 | 355 | | |||
356 | qCDebug(CMAKE) << "removing from cmake config: using builddir " << curr; | 356 | qCDebug(CMAKE) << "removing from cmake config: using builddir " << curr; | ||
357 | qCDebug(CMAKE) << "removing from cmake config: builddir path " << removedPath; | 357 | qCDebug(CMAKE) << "removing from cmake config: builddir path " << removedPath; | ||
358 | qCDebug(CMAKE) << "removing from cmake config: installdir " << CMake::currentInstallDir( m_project ); | 358 | qCDebug(CMAKE) << "removing from cmake config: installdir " << CMake::currentInstallDir( m_project ); | ||
359 | qCDebug(CMAKE) << "removing from cmake config: extra args" << CMake::currentExtraArguments( m_project ); | 359 | qCDebug(CMAKE) << "removing from cmake config: extra args" << CMake::currentExtraArguments( m_project ); | ||
360 | qCDebug(CMAKE) << "removing from cmake config: buildtype " << CMake::currentBuildType( m_project ); | 360 | qCDebug(CMAKE) << "removing from cmake config: buildtype " << CMake::currentBuildType( m_project ); | ||
361 | qCDebug(CMAKE) << "removing from cmake config: cmake binary " << CMake::currentCMakeBinary( m_project ); | 361 | qCDebug(CMAKE) << "removing from cmake config: cmake executable " << CMake::currentCMakeExecutable(m_project); | ||
362 | qCDebug(CMAKE) << "removing from cmake config: environment " << CMake::currentEnvironment( m_project ); | 362 | qCDebug(CMAKE) << "removing from cmake config: environment " << CMake::currentEnvironment( m_project ); | ||
363 | 363 | | |||
364 | CMake::removeBuildDirConfig(m_project); | 364 | CMake::removeBuildDirConfig(m_project); | ||
365 | m_prefsUi->buildDirs->removeItem( curr ); // this triggers buildDirChanged() | 365 | m_prefsUi->buildDirs->removeItem( curr ); // this triggers buildDirChanged() | ||
366 | if(m_prefsUi->buildDirs->count()==0) | 366 | if(m_prefsUi->buildDirs->count()==0) | ||
367 | m_prefsUi->removeBuildDir->setEnabled(false); | 367 | m_prefsUi->removeBuildDir->setEnabled(false); | ||
368 | 368 | | |||
369 | emit changed(); | 369 | emit changed(); | ||
Show All 40 Lines |