Changeset View
Changeset View
Standalone View
Standalone View
plugins/meson/settings/mesonadvancedsettings.cpp
- This file was added.
1 | /* This file is part of KDevelop | ||||
---|---|---|---|---|---|
2 | Copyright 2018 Daniel Mensinger <daniel@mensinger-ka.de> | ||||
3 | | ||||
4 | This library is free software; you can redistribute it and/or | ||||
5 | modify it under the terms of the GNU Library General Public | ||||
6 | License as published by the Free Software Foundation; either | ||||
7 | version 2 of the License, or (at your option) any later version. | ||||
8 | | ||||
9 | This library is distributed in the hope that it will be useful, | ||||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
12 | Library General Public License for more details. | ||||
13 | | ||||
14 | You should have received a copy of the GNU Library General Public License | ||||
15 | along with this library; see the file COPYING.LIB. If not, write to | ||||
16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||||
17 | Boston, MA 02110-1301, USA. | ||||
18 | */ | ||||
19 | | ||||
20 | #include "mesonadvancedsettings.h" | ||||
21 | #include "ui_mesonadvancedsettings.h" | ||||
22 | | ||||
23 | using namespace KDevelop; | ||||
24 | | ||||
25 | MesonAdvancedSettings::MesonAdvancedSettings(QWidget* parent) | ||||
26 | : QWidget(parent) | ||||
27 | { | ||||
28 | m_ui = new Ui::MesonAdvancedSettings; | ||||
29 | m_ui->setupUi(this); | ||||
30 | m_ui->container->hide(); | ||||
31 | } | ||||
32 | | ||||
33 | MesonAdvancedSettings::~MesonAdvancedSettings() | ||||
34 | { | ||||
35 | delete m_ui; | ||||
36 | } | ||||
37 | | ||||
38 | MesonAdvancedSettings::Data MesonAdvancedSettings::getConfig() const | ||||
39 | { | ||||
40 | Data res; | ||||
41 | | ||||
42 | res.args = m_ui->i_mesonArgs->text(); | ||||
43 | res.backend = m_ui->i_backend->currentText(); | ||||
44 | res.meson = Path(m_ui->i_mesonExe->url()); | ||||
45 | | ||||
46 | return res; | ||||
47 | } | ||||
48 | | ||||
49 | void MesonAdvancedSettings::setConfig(const MesonAdvancedSettings::Data& conf) | ||||
50 | { | ||||
51 | m_ui->i_mesonArgs->setText(conf.args); | ||||
52 | m_ui->i_mesonExe->setUrl(conf.meson.toUrl()); | ||||
53 | m_ui->i_backend->setCurrentIndex(std::max(0, m_backendList.indexOf(conf.backend))); | ||||
54 | } | ||||
55 | | ||||
56 | void MesonAdvancedSettings::setSupportedBackends(const QStringList& backends) | ||||
57 | { | ||||
58 | m_backendList = backends; | ||||
59 | m_ui->i_backend->clear(); | ||||
60 | m_ui->i_backend->addItems(m_backendList); | ||||
61 | } | ||||
62 | | ||||
63 | void MesonAdvancedSettings::updated() | ||||
64 | { | ||||
65 | emit configChanged(); | ||||
66 | } |