forked from qt-creator/qt-creator
Clangd: use special value text for automatic worker count
Change-Id: Iddb75b6716724b5994d8093a8e389f5cb8e2d044 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -211,10 +211,8 @@ public:
|
||||
"If background indexing is enabled, global symbol searches will yield\n"
|
||||
"more accurate results, at the cost of additional CPU load when\n"
|
||||
"the project is first opened."));
|
||||
m_threadLimitCheckBox.setText(tr("Set worker thread count limit"));
|
||||
m_threadLimitCheckBox.setChecked(ClangdSettings::workerThreadLimit() != 0);
|
||||
m_threadLimitSpinBox.setMinimum(1);
|
||||
m_threadLimitSpinBox.setValue(ClangdSettings::workerThreadLimit());
|
||||
m_threadLimitSpinBox.setSpecialValueText("Automatic");
|
||||
|
||||
const auto layout = new QVBoxLayout(this);
|
||||
layout->addWidget(&m_useClangdCheckBox);
|
||||
@@ -226,7 +224,8 @@ public:
|
||||
const auto threadLimitLayout = new QHBoxLayout;
|
||||
threadLimitLayout->addWidget(&m_threadLimitSpinBox);
|
||||
threadLimitLayout->addStretch(1);
|
||||
formLayout->addRow(&m_threadLimitCheckBox, threadLimitLayout);
|
||||
const auto threadLimitLabel = new QLabel(tr("Set worker thread count:"));
|
||||
formLayout->addRow(threadLimitLabel, threadLimitLayout);
|
||||
layout->addLayout(formLayout);
|
||||
layout->addStretch(1);
|
||||
|
||||
@@ -235,15 +234,11 @@ public:
|
||||
m_clangdChooser.setEnabled(checked);
|
||||
indexingLabel->setEnabled(checked);
|
||||
m_indexingCheckBox.setEnabled(checked);
|
||||
m_threadLimitCheckBox.setEnabled(checked);
|
||||
m_threadLimitSpinBox.setEnabled(checked && m_threadLimitCheckBox.isChecked());
|
||||
m_threadLimitSpinBox.setEnabled(checked);
|
||||
};
|
||||
connect(&m_useClangdCheckBox, &QCheckBox::toggled, toggleEnabled);
|
||||
connect(&m_threadLimitCheckBox, &QCheckBox::toggled,
|
||||
&m_threadLimitSpinBox, &QSpinBox::setEnabled);
|
||||
toggleEnabled(m_useClangdCheckBox.isChecked());
|
||||
m_threadLimitSpinBox.setEnabled(m_useClangdCheckBox.isChecked()
|
||||
&& m_threadLimitCheckBox.isChecked());
|
||||
m_threadLimitSpinBox.setEnabled(m_useClangdCheckBox.isChecked());
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -253,14 +248,12 @@ private:
|
||||
data.useClangd = m_useClangdCheckBox.isChecked();
|
||||
data.executableFilePath = m_clangdChooser.filePath();
|
||||
data.enableIndexing = m_indexingCheckBox.isChecked();
|
||||
data.workerThreadLimit = m_threadLimitCheckBox.isChecked()
|
||||
? m_threadLimitSpinBox.value() : 0;
|
||||
data.workerThreadLimit = m_threadLimitSpinBox.value();
|
||||
ClangdSettings::setData(data);
|
||||
}
|
||||
|
||||
QCheckBox m_useClangdCheckBox;
|
||||
QCheckBox m_indexingCheckBox;
|
||||
QCheckBox m_threadLimitCheckBox;
|
||||
QSpinBox m_threadLimitSpinBox;
|
||||
Utils::PathChooser m_clangdChooser;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user