File indexing completed on 2024-05-19 15:46:03

0001 /*
0002     SPDX-FileCopyrightText: 2019 Daniel Mensinger <daniel@mensinger-ka.de>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "mintro/mesonoptions.h"
0010 
0011 #include <util/path.h>
0012 
0013 #include <QVector>
0014 #include <QWidget>
0015 
0016 #include <memory>
0017 
0018 namespace Ui
0019 {
0020 class MesonOptionsView;
0021 }
0022 
0023 namespace KDevelop
0024 {
0025 class IProject;
0026 }
0027 
0028 namespace Meson
0029 {
0030 struct BuildDir;
0031 }
0032 
0033 class MesonOptionBaseView;
0034 class MesonIntrospectJob;
0035 class KJob;
0036 
0037 using OPT_VIEW_PTR = std::shared_ptr<MesonOptionBaseView>;
0038 
0039 class MesonOptionsView : public QWidget
0040 {
0041     Q_OBJECT
0042 
0043 public:
0044     explicit MesonOptionsView(QWidget* parent = nullptr);
0045     virtual ~MesonOptionsView();
0046 
0047     void clear();
0048     void resetAll();
0049     KJob* repopulateFromBuildDir(KDevelop::IProject* project, const Meson::BuildDir& buildDir);
0050     KJob* repopulateFromMesonFile(KDevelop::IProject* project, KDevelop::Path mesonExe);
0051 
0052     MesonOptsPtr options();
0053 
0054 public Q_SLOTS:
0055     void emitChanged();
0056 
0057 Q_SIGNALS:
0058     void configChanged();
0059 
0060 private:
0061     Ui::MesonOptionsView* m_ui = nullptr;
0062     QVector<OPT_VIEW_PTR> m_optViews;
0063     MesonOptsPtr m_options;
0064 
0065     KJob* repopulate(MesonIntrospectJob* introJob);
0066 };