Skip to content

Commit

Permalink
Add ability to force CMake cache clean before run. Again.
Browse files Browse the repository at this point in the history
  • Loading branch information
h4tr3d committed Mar 5, 2016
1 parent 78fb28e commit 5308efa
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
20 changes: 17 additions & 3 deletions cmakebuildsettingswidget.cpp
Expand Up @@ -197,6 +197,13 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc)
mainLayout->addWidget(m_toolchainGroupBox, row, 0, 1, 3);
}

// Force clean cache
{
++row;
m_forceClearCache = new QCheckBox(tr("Force cache clean before CMake run"));
mainLayout->addWidget(m_forceClearCache, row, 0, 1, 3);
}

++row;
m_reconfigureButton = new QPushButton(tr("Apply Configuration Changes"));
m_reconfigureButton->setEnabled(false);
Expand Down Expand Up @@ -230,16 +237,22 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc)

connect(m_resetButton, &QPushButton::clicked, m_configModel, &ConfigModel::resetAllChanges);
connect(m_reconfigureButton, &QPushButton::clicked, this, [this, project]() {
project->setCurrentCMakeConfiguration(m_configModel->configurationChanges(), currentToolchainInfo());
bool clearCache = m_forceClearCache->isChecked();
m_forceClearCache->setChecked(false);
project->setCurrentCMakeConfiguration(m_configModel->configurationChanges(), currentToolchainInfo(), clearCache);
});
connect(m_editButton, &QPushButton::clicked, this, [this]() {
connect(m_editButton, &QPushButton::clicked, [this]() {
QModelIndex idx = m_configView->currentIndex();
if (idx.column() != 1)
idx = idx.sibling(idx.row(), 1);
m_configView->setCurrentIndex(idx);
m_configView->edit(idx);
});

connect(m_forceClearCache, &QCheckBox::stateChanged, [this] (int) {
updateButtonState();
});

connect(bc, &CMakeBuildConfiguration::errorOccured, this, &CMakeBuildSettingsWidget::setError);

connect(m_toolchainGroupBox, &QGroupBox::clicked, [this](bool) {
Expand Down Expand Up @@ -294,6 +307,7 @@ void CMakeBuildSettingsWidget::updateButtonState()
auto project = static_cast<CMakeProject *>(m_buildConfiguration->target()->project());
const bool isParsing = project->isParsing();
const bool hasChanges = m_configModel->hasChanges();
const bool clearCache = m_forceClearCache->isChecked();
m_resetButton->setEnabled(hasChanges && !isParsing);

auto const& prev = m_buildConfiguration->cmakeToolchainInfo();
Expand All @@ -304,7 +318,7 @@ void CMakeBuildSettingsWidget::updateButtonState()
curr.toolchainFile != prev.toolchainFile ||
curr.toolchainInline != prev.toolchainInline);

m_reconfigureButton->setEnabled((hasChanges || hasToolchainChanges || m_configModel->hasCMakeChanges()) && !isParsing);
m_reconfigureButton->setEnabled((hasChanges || hasToolchainChanges || clearCache || m_configModel->hasCMakeChanges()) && !isParsing);
}

void CMakeBuildSettingsWidget::updateAdvancedCheckBox()
Expand Down
1 change: 1 addition & 0 deletions cmakebuildsettingswidget.h
Expand Up @@ -84,6 +84,7 @@ class CMakeBuildSettingsWidget : public ProjectExplorer::NamedWidget
QPushButton *m_toolchainEditPushButton;
QRadioButton *m_fileToolchainRadioButton;
QRadioButton *m_inlineToolchainRadioButton;
QCheckBox *m_forceClearCache;
QTimer m_showProgressTimer;
QLabel *m_errorLabel;
QLabel *m_errorMessageLabel;
Expand Down

0 comments on commit 5308efa

Please sign in to comment.