| 33 | using namespace KDevelop; |
| 34 | |
| 35 | CMakePreferences::CMakePreferences(IPlugin* plugin, const ProjectConfigOptions& options, QWidget* parent) |
| 36 | : ConfigPage(plugin, nullptr, parent), m_project(options.project), m_currentModel(nullptr) |
| 37 | { |
| 38 | m_prefsUi = new Ui::CMakeBuildSettings; |
| 39 | m_prefsUi->setupUi(this); |
| 40 | |
| 41 | m_prefsUi->cacheList->setItemDelegate(new CMakeCacheDelegate(m_prefsUi->cacheList)); |
| 42 | m_prefsUi->cacheList->setSelectionMode(QAbstractItemView::SingleSelection); |
| 43 | m_prefsUi->cacheList->horizontalHeader()->setStretchLastSection(true); |
| 44 | m_prefsUi->cacheList->verticalHeader()->hide(); |
| 45 | |
| 46 | // configure the extraArguments widget to span the advanced box width but not |
| 47 | // expand the dialog to the width of the longest element in the argument history. |
| 48 | m_prefsUi->extraArguments->setMinimumWidth(m_prefsUi->extraArguments->minimumSizeHint().width()); |
| 49 | m_extraArgumentsHistory = new CMakeExtraArgumentsHistory(m_prefsUi->extraArguments); |
| 50 | |
| 51 | connect(m_prefsUi->buildDirs, QOverload<int>::of(&KComboBox::currentIndexChanged), |
| 52 | this, &CMakePreferences::buildDirChanged); |
| 53 | connect(m_prefsUi->showInternal, &QCheckBox::stateChanged, |
| 54 | this, &CMakePreferences::showInternal); |
| 55 | connect(m_prefsUi->addBuildDir, &QPushButton::pressed, this, &CMakePreferences::createBuildDir); |
| 56 | connect(m_prefsUi->removeBuildDir, &QPushButton::pressed, this, &CMakePreferences::removeBuildDir); |
| 57 | connect(m_prefsUi->showAdvanced, &QPushButton::toggled, this, &CMakePreferences::showAdvanced); |
| 58 | connect(m_prefsUi->environment, &EnvironmentSelectionWidget::currentProfileChanged, |
| 59 | this, &CMakePreferences::changed); |
| 60 | connect(m_prefsUi->configureEnvironment, &EnvironmentConfigureButton::environmentConfigured, |
| 61 | this, &CMakePreferences::changed); |
| 62 | |
| 63 | connect(m_prefsUi->installationPrefix, &KUrlRequester::textChanged, |
| 64 | this, &CMakePreferences::changed); |
| 65 | connect(m_prefsUi->buildType, &QComboBox::currentTextChanged, |
| 66 | this, &CMakePreferences::changed); |
| 67 | connect(m_prefsUi->extraArguments, &KComboBox::currentTextChanged, |
| 68 | this, &CMakePreferences::changed); |
| 69 | connect(m_prefsUi->extraArguments, &KComboBox::editTextChanged, |
| 70 | this, &CMakePreferences::changed); |
| 71 | connect(m_prefsUi->cMakeExecutable, &KUrlRequester::textChanged, |
| 72 | this, &CMakePreferences::changed); |
| 73 | |
| 74 | showInternal(m_prefsUi->showInternal->checkState()); |
| 75 | m_subprojFolder = Path(options.projectTempFile).parent(); |
| 76 | |
| 77 | qCDebug(CMAKE) << "Source folder: " << m_srcFolder << options.projectTempFile; |
| 78 | // foreach(const QVariant &v, args) |
| 79 | // { |
| 80 | // qCDebug(CMAKE) << "arg: " << v.toString(); |
| 81 | // } |
| 82 | |
| 83 | m_prefsUi->configureEnvironment->setSelectionWidget(m_prefsUi->environment); |
| 84 | |
| 85 | m_prefsUi->showAdvanced->setChecked(false); |
| 86 | showAdvanced(false); |
| 87 | reset(); // load the initial values |
| 88 | } |
| 89 | |
| 90 | CMakePreferences::~CMakePreferences() |
| 91 | { |
nothing calls this directly
no test coverage detected