Changeset View
Changeset View
Standalone View
Standalone View
projectmanagers/cmake/cmakebuilddirchooser.cpp
Show First 20 Lines • Show All 53 Lines • ▼ Show 20 Line(s) | 42 | { | |||
---|---|---|---|---|---|
54 | 54 | | |||
55 | m_chooserUi = new Ui::CMakeBuildDirChooser; | 55 | m_chooserUi = new Ui::CMakeBuildDirChooser; | ||
56 | m_chooserUi->setupUi(mainWidget); | 56 | m_chooserUi->setupUi(mainWidget); | ||
57 | mainLayout->addWidget(m_buttonBox); | 57 | mainLayout->addWidget(m_buttonBox); | ||
58 | 58 | | |||
59 | m_chooserUi->buildFolder->setMode(KFile::Directory|KFile::ExistingOnly); | 59 | m_chooserUi->buildFolder->setMode(KFile::Directory|KFile::ExistingOnly); | ||
60 | m_chooserUi->installPrefix->setMode(KFile::Directory|KFile::ExistingOnly); | 60 | m_chooserUi->installPrefix->setMode(KFile::Directory|KFile::ExistingOnly); | ||
61 | 61 | | |||
62 | setCMakeBinary(Path(CMake::findExecutable())); | 62 | setCMakeExecutable(Path(CMake::findExecutable())); | ||
63 | 63 | | |||
64 | m_extraArgumentsHistory = new CMakeExtraArgumentsHistory(m_chooserUi->extraArguments); | 64 | m_extraArgumentsHistory = new CMakeExtraArgumentsHistory(m_chooserUi->extraArguments); | ||
65 | 65 | | |||
66 | connect(m_chooserUi->cmakeBin, &KUrlRequester::textChanged, this, &CMakeBuildDirChooser::updated); | 66 | connect(m_chooserUi->cmakeExecutable, &KUrlRequester::textChanged, this, &CMakeBuildDirChooser::updated); | ||
67 | connect(m_chooserUi->buildFolder, &KUrlRequester::textChanged, this, &CMakeBuildDirChooser::updated); | 67 | connect(m_chooserUi->buildFolder, &KUrlRequester::textChanged, this, &CMakeBuildDirChooser::updated); | ||
68 | connect(m_chooserUi->buildType, static_cast<void(QComboBox::*)(const QString&)>(&QComboBox::currentIndexChanged), this, &CMakeBuildDirChooser::updated); | 68 | connect(m_chooserUi->buildType, static_cast<void(QComboBox::*)(const QString&)>(&QComboBox::currentIndexChanged), this, &CMakeBuildDirChooser::updated); | ||
69 | connect(m_chooserUi->extraArguments, &KComboBox::editTextChanged, this, &CMakeBuildDirChooser::updated); | 69 | connect(m_chooserUi->extraArguments, &KComboBox::editTextChanged, this, &CMakeBuildDirChooser::updated); | ||
70 | 70 | | |||
71 | updated(); | 71 | updated(); | ||
72 | } | 72 | } | ||
73 | 73 | | |||
74 | CMakeBuildDirChooser::~CMakeBuildDirChooser() | 74 | CMakeBuildDirChooser::~CMakeBuildDirChooser() | ||
▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Line(s) | 95 | { | |||
137 | 137 | | |||
138 | qCDebug(CMAKE) << "The source directory for " << file.fileName() << "is" << srcDir; | 138 | qCDebug(CMAKE) << "The source directory for " << file.fileName() << "is" << srcDir; | ||
139 | qCDebug(CMAKE) << "The install directory for " << file.fileName() << "is" << installDir; | 139 | qCDebug(CMAKE) << "The install directory for " << file.fileName() << "is" << installDir; | ||
140 | qCDebug(CMAKE) << "The build type for " << file.fileName() << "is" << buildType; | 140 | qCDebug(CMAKE) << "The build type for " << file.fileName() << "is" << buildType; | ||
141 | } | 141 | } | ||
142 | 142 | | |||
143 | void CMakeBuildDirChooser::updated() | 143 | void CMakeBuildDirChooser::updated() | ||
144 | { | 144 | { | ||
145 | bool haveCMake=QFile::exists(m_chooserUi->cmakeBin->url().toLocalFile()); | 145 | bool haveCMake=QFile::exists(m_chooserUi->cmakeExecutable->url().toLocalFile()); | ||
146 | StatusTypes st; | 146 | StatusTypes st; | ||
147 | if( haveCMake ) st |= HaveCMake; | 147 | if( haveCMake ) st |= HaveCMake; | ||
148 | 148 | | |||
149 | m_chooserUi->buildFolder->setEnabled(haveCMake); | 149 | m_chooserUi->buildFolder->setEnabled(haveCMake); | ||
150 | m_chooserUi->installPrefix->setEnabled(haveCMake); | 150 | m_chooserUi->installPrefix->setEnabled(haveCMake); | ||
151 | m_chooserUi->buildType->setEnabled(haveCMake); | 151 | m_chooserUi->buildType->setEnabled(haveCMake); | ||
152 | // m_chooserUi->generator->setEnabled(haveCMake); | 152 | // m_chooserUi->generator->setEnabled(haveCMake); | ||
153 | if(!haveCMake) | 153 | if(!haveCMake) | ||
154 | { | 154 | { | ||
155 | setStatus(i18n("You need to select a cmake binary."), false); | 155 | setStatus(i18n("You need to select a CMake executable."), false); | ||
156 | return; | 156 | return; | ||
157 | } | 157 | } | ||
158 | 158 | | |||
159 | Path chosenBuildFolder(m_chooserUi->buildFolder->url()); | 159 | Path chosenBuildFolder(m_chooserUi->buildFolder->url()); | ||
160 | bool emptyUrl = chosenBuildFolder.isEmpty(); | 160 | bool emptyUrl = chosenBuildFolder.isEmpty(); | ||
161 | if( emptyUrl ) st |= BuildFolderEmpty; | 161 | if( emptyUrl ) st |= BuildFolderEmpty; | ||
162 | 162 | | |||
163 | bool dirEmpty = false, dirExists= false, dirRelative = false; | 163 | bool dirEmpty = false, dirExists= false, dirRelative = false; | ||
▲ Show 20 Lines • Show All 75 Lines • ▼ Show 20 Line(s) | 238 | else if(!dirEmpty) | |||
239 | setStatus(i18n("The selected build directory is not empty."), false); | 239 | setStatus(i18n("The selected build directory is not empty."), false); | ||
240 | } | 240 | } | ||
241 | 241 | | |||
242 | m_chooserUi->installPrefix->setEnabled(correct); | 242 | m_chooserUi->installPrefix->setEnabled(correct); | ||
243 | m_chooserUi->buildType->setEnabled(correct); | 243 | m_chooserUi->buildType->setEnabled(correct); | ||
244 | } | 244 | } | ||
245 | } | 245 | } | ||
246 | 246 | | |||
247 | void CMakeBuildDirChooser::setCMakeBinary(const Path& path) | 247 | void CMakeBuildDirChooser::setCMakeExecutable(const Path& path) | ||
248 | { | 248 | { | ||
249 | m_chooserUi->cmakeBin->setUrl(path.toUrl()); | 249 | m_chooserUi->cmakeExecutable->setUrl(path.toUrl()); | ||
250 | updated(); | 250 | updated(); | ||
251 | } | 251 | } | ||
252 | 252 | | |||
253 | void CMakeBuildDirChooser::setInstallPrefix(const Path& path) | 253 | void CMakeBuildDirChooser::setInstallPrefix(const Path& path) | ||
254 | { | 254 | { | ||
255 | m_chooserUi->installPrefix->setUrl(path.toUrl()); | 255 | m_chooserUi->installPrefix->setUrl(path.toUrl()); | ||
256 | updated(); | 256 | updated(); | ||
257 | } | 257 | } | ||
Show All 37 Lines | 285 | { | |||
295 | auto okButton = m_buttonBox->button(QDialogButtonBox::Ok); | 295 | auto okButton = m_buttonBox->button(QDialogButtonBox::Ok); | ||
296 | okButton->setEnabled(canApply); | 296 | okButton->setEnabled(canApply); | ||
297 | if (canApply) { | 297 | if (canApply) { | ||
298 | auto cancelButton = m_buttonBox->button(QDialogButtonBox::Cancel); | 298 | auto cancelButton = m_buttonBox->button(QDialogButtonBox::Cancel); | ||
299 | cancelButton->clearFocus(); | 299 | cancelButton->clearFocus(); | ||
300 | } | 300 | } | ||
301 | } | 301 | } | ||
302 | 302 | | |||
303 | Path CMakeBuildDirChooser::cmakeBinary() const { return Path(m_chooserUi->cmakeBin->url()); } | 303 | Path CMakeBuildDirChooser::cmakeExecutable() const { return Path(m_chooserUi->cmakeExecutable->url()); } | ||
304 | 304 | | |||
305 | Path CMakeBuildDirChooser::installPrefix() const { return Path(m_chooserUi->installPrefix->url()); } | 305 | Path CMakeBuildDirChooser::installPrefix() const { return Path(m_chooserUi->installPrefix->url()); } | ||
306 | 306 | | |||
307 | Path CMakeBuildDirChooser::buildFolder() const { return Path(m_chooserUi->buildFolder->url()); } | 307 | Path CMakeBuildDirChooser::buildFolder() const { return Path(m_chooserUi->buildFolder->url()); } | ||
308 | 308 | | |||
309 | QString CMakeBuildDirChooser::buildType() const { return m_chooserUi->buildType->currentText(); } | 309 | QString CMakeBuildDirChooser::buildType() const { return m_chooserUi->buildType->currentText(); } | ||
310 | 310 | | |||
311 | QString CMakeBuildDirChooser::extraArguments() const { return m_chooserUi->extraArguments->currentText(); } | 311 | QString CMakeBuildDirChooser::extraArguments() const { return m_chooserUi->extraArguments->currentText(); } |