File indexing completed on 2024-05-12 04:39:40

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 #ifndef KDEVELOP_PROJECTMANAGERS_CUSTOM_BUILDSYSTEM_PROJECTPATHSWIDGET_H
0008 #define KDEVELOP_PROJECTMANAGERS_CUSTOM_BUILDSYSTEM_PROJECTPATHSWIDGET_H
0009 
0010 #include <QScopedPointer>
0011 #include <QWidget>
0012 
0013 #include "../compilerprovider/icompiler.h"
0014 #include "../compilerprovider/settingsmanager.h"
0015 
0016 namespace Ui
0017 {
0018 class ProjectPathsWidget;
0019 }
0020 
0021 namespace KDevelop
0022 {
0023     class IProject;
0024 }
0025 
0026 class ProjectPathsModel;
0027 
0028 class ProjectPathsWidget : public QWidget
0029 {
0030 Q_OBJECT
0031 public:
0032     explicit ProjectPathsWidget( QWidget* parent = nullptr );
0033     ~ProjectPathsWidget() override;
0034 
0035     void setProject(KDevelop::IProject* w_project);
0036     void setPaths( const QVector<ConfigEntry>& );
0037     QVector<ConfigEntry> paths() const;
0038     void clear();
0039 
0040 Q_SIGNALS:
0041     void changed();
0042 
0043 private:
0044     void setCurrentCompiler(const QString& name);
0045 
0046     CompilerPointer currentCompiler() const;
0047 
0048 private Q_SLOTS:
0049     // Handling of project-path combobox, add and remove buttons
0050     void projectPathSelected( int index );
0051     void addProjectPath();
0052     void deleteProjectPath();
0053     void batchEdit();
0054     void tabChanged(int);
0055     void changeCompilerForPath();
0056 
0057     // Forward includes model changes into the pathsModel
0058     void includesChanged( const QStringList& includes );
0059 
0060     // Forward defines model changes into the pathsModel
0061     void definesChanged( const KDevelop::Defines& defines );
0062 
0063     void parserArgumentsChanged();
0064 
0065 private:
0066     QScopedPointer<Ui::ProjectPathsWidget> ui;
0067     ProjectPathsModel* pathsModel;
0068     // Enables/Disables widgets based on UI state/selection
0069     void updateEnablements();
0070     void updatePathsModel( const QVariant& newData, int role );
0071 };
0072 
0073 #endif
0074