File indexing completed on 2024-04-28 04:38:25

0001 /*
0002     SPDX-FileCopyrightText: 2010 Andreas Pakulat <apaku@gmx.de>
0003 
0004     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-or-later
0005 */
0006 
0007 #include "kcm_custombuildsystem.h"
0008 
0009 #include <QVBoxLayout>
0010 
0011 #include <interfaces/icore.h>
0012 #include <interfaces/iprojectcontroller.h>
0013 
0014 #include "custombuildsystemconfigwidget.h"
0015 
0016 CustomBuildSystemKCModule::CustomBuildSystemKCModule(KDevelop::IPlugin* plugin, const KDevelop::ProjectConfigOptions& options, QWidget* parent)
0017     : ProjectConfigPage<CustomBuildSystemSettings>(plugin, options, parent)
0018 {
0019     auto* layout = new QVBoxLayout( this );
0020     layout->setContentsMargins(0, 0, 0, 0);
0021     configWidget = new CustomBuildSystemConfigWidget( this );
0022     connect(configWidget, &CustomBuildSystemConfigWidget::changed, this, &ConfigPage::changed);
0023     layout->addWidget( configWidget );
0024 }
0025 
0026 CustomBuildSystemKCModule::~CustomBuildSystemKCModule()
0027 {
0028 }
0029 
0030 void CustomBuildSystemKCModule::reset()
0031 {
0032     ProjectConfigPage::reset();
0033     configWidget->loadFrom(CustomBuildSystemSettings::self()->config());
0034 }
0035 
0036 void CustomBuildSystemKCModule::apply()
0037 {
0038     configWidget->saveTo(CustomBuildSystemSettings::self()->config(), project());
0039     ProjectConfigPage::apply();
0040     if (KDevelop::IProjectController::parseAllProjectSources()) {
0041         KDevelop::ICore::self()->projectController()->reparseProject(project());
0042     }
0043 }
0044 
0045 void CustomBuildSystemKCModule::defaults()
0046 {
0047     ProjectConfigPage::defaults();
0048     configWidget->loadDefaults();
0049 }
0050 
0051 QString CustomBuildSystemKCModule::name() const
0052 {
0053     return i18nc("@title:tab", "Custom Build System");
0054 }
0055 
0056 QString CustomBuildSystemKCModule::fullName() const
0057 {
0058     return i18n("Configure a projects custom build tool and includes/defines for the language support.");
0059 }
0060 
0061 QIcon CustomBuildSystemKCModule::icon() const
0062 {
0063     return QIcon::fromTheme(QStringLiteral("kdevelop"));
0064 }
0065 
0066 #include "moc_kcm_custombuildsystem.cpp"