File indexing completed on 2024-05-19 15:46:02
0001 /* 0002 SPDX-FileCopyrightText: 2018 Daniel Mensinger <daniel@mensinger-ka.de> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "mesonadvancedsettings.h" 0008 0009 #include "ui_mesonadvancedsettings.h" 0010 0011 using namespace KDevelop; 0012 0013 MesonAdvancedSettings::MesonAdvancedSettings(QWidget* parent) 0014 : QWidget(parent) 0015 { 0016 m_ui = new Ui::MesonAdvancedSettings; 0017 m_ui->setupUi(this); 0018 m_ui->container->hide(); 0019 } 0020 0021 MesonAdvancedSettings::~MesonAdvancedSettings() 0022 { 0023 delete m_ui; 0024 } 0025 0026 MesonAdvancedSettings::Data MesonAdvancedSettings::getConfig() const 0027 { 0028 Data res; 0029 0030 res.args = m_ui->i_mesonArgs->text(); 0031 res.backend = m_ui->i_backend->currentText(); 0032 res.meson = Path(m_ui->i_mesonExe->url()); 0033 0034 return res; 0035 } 0036 0037 void MesonAdvancedSettings::setConfig(const MesonAdvancedSettings::Data& conf) 0038 { 0039 m_ui->i_mesonArgs->setText(conf.args); 0040 m_ui->i_mesonExe->setUrl(conf.meson.toUrl()); 0041 m_ui->i_backend->setCurrentIndex(std::max(0, m_backendList.indexOf(conf.backend))); 0042 } 0043 0044 void MesonAdvancedSettings::setSupportedBackends(const QStringList& backends) 0045 { 0046 m_backendList = backends; 0047 m_ui->i_backend->clear(); 0048 m_ui->i_backend->addItems(m_backendList); 0049 } 0050 0051 void MesonAdvancedSettings::updated() 0052 { 0053 emit configChanged(); 0054 } 0055 0056 /// Check if meson has changed since the last call 0057 bool MesonAdvancedSettings::hasMesonChanged() 0058 { 0059 if (m_mesonOldPath != Path(m_ui->i_mesonExe->url())) { 0060 m_mesonOldPath = Path(m_ui->i_mesonExe->url()); // Reset 0061 return true; 0062 } 0063 0064 return false; 0065 } 0066 0067 #include "moc_mesonadvancedsettings.cpp"