| 75 | } |
| 76 | |
| 77 | void MesonConfigPage::apply() |
| 78 | { |
| 79 | qCDebug(KDEV_Meson) << "Applying meson config for build dir " << m_current.buildDir; |
| 80 | readUI(); |
| 81 | writeConfig(); |
| 82 | |
| 83 | if (m_config.currentIndex >= 0 && m_configChanged) { |
| 84 | QList<KJob*> joblist; |
| 85 | |
| 86 | auto options = m_ui->options->options(); |
| 87 | if (!options) { |
| 88 | qCWarning(KDEV_Meson) << "Options is nullptr. Can not update meson config"; |
| 89 | return; |
| 90 | } |
| 91 | |
| 92 | QStringList mesonArgs = options->getMesonArgs(); |
| 93 | if (mesonArgs.empty()) { |
| 94 | qCDebug(KDEV_Meson) << "Config has not changed --> nothing has to be updated"; |
| 95 | return; |
| 96 | } |
| 97 | |
| 98 | // Check if a configuration is required |
| 99 | auto status = MesonBuilder::evaluateBuildDirectory(m_current.buildDir, m_current.mesonBackend); |
| 100 | if (status != MesonBuilder::MESON_CONFIGURED) { |
| 101 | joblist << new MesonJob(m_current, m_project, MesonJob::CONFIGURE, mesonArgs, nullptr); |
| 102 | } |
| 103 | |
| 104 | joblist << new MesonJob(m_current, m_project, MesonJob::SET_CONFIG, mesonArgs, nullptr); |
| 105 | joblist << m_ui->options->repopulateFromBuildDir(m_project, m_current); |
| 106 | KJob* job = new ExecuteCompositeJob(nullptr, joblist); |
| 107 | connect(job, &KJob::result, this, [this]() { |
| 108 | setDisabled(false); |
| 109 | updateUI(); |
| 110 | }); |
| 111 | setDisabled(true); |
| 112 | m_configChanged = false; |
| 113 | job->start(); |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | void MesonConfigPage::defaults() |
| 118 | { |
nothing calls this directly
no test coverage detected