File indexing completed on 2024-05-12 04:38:19

0001 /*
0002     SPDX-FileCopyrightText: 2006 Adam Treat <treat@kde.org>
0003     SPDX-FileCopyrightText: 2007 Dukju Ahn <dukjuahn@gmail.com>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #ifndef KDEVPLATFORM_ENVIRONMENTWIDGET_H
0009 #define KDEVPLATFORM_ENVIRONMENTWIDGET_H
0010 
0011 #include <QWidget>
0012 #include "ui_environmentwidget.h"
0013 
0014 class KConfig;
0015 class QSortFilterProxyModel;
0016 
0017 
0018 namespace KDevelop
0019 {
0020 
0021 class EnvironmentProfileListModel;
0022 class EnvironmentProfileModel;
0023 
0024 
0025 /**
0026  * @short Environment variable setting widget.
0027  * This class manages a EnvironmentProfileList and allows one to change the variables and add/remove groups
0028  *
0029  * @sa EnvPreferences
0030  */
0031 class EnvironmentWidget: public QWidget
0032 {
0033     Q_OBJECT
0034 
0035 public:
0036     explicit EnvironmentWidget( QWidget *parent = nullptr );
0037 
0038     void loadSettings( KConfig* config );
0039     void saveSettings( KConfig* config );
0040     void defaults( KConfig* config );
0041     void selectProfile(const QString& profileName);
0042 
0043 Q_SIGNALS:
0044     void changed();
0045 
0046 private:
0047     QString askNewProfileName(const QString& defaultName);
0048     void removeSelectedVariables();
0049     void batchModeEditButtonClicked();
0050     void addProfile();
0051     void cloneSelectedProfile();
0052     void removeSelectedProfile();
0053     void setSelectedProfileAsDefault();
0054     void onDefaultProfileChanged(int defaultProfileIndex);
0055     void onSelectedProfileChanged(int selectedProfileIndex);
0056     void onVariableInserted(int column, const QVariant& value);
0057     void updateDeleteVariableButton();
0058 
0059 private:
0060     Ui::EnvironmentWidget ui;
0061     EnvironmentProfileListModel* const m_environmentProfileListModel;
0062     EnvironmentProfileModel* const m_environmentProfileModel;
0063     QSortFilterProxyModel* const m_proxyModel;
0064 
0065 };
0066 
0067 }
0068 
0069 #endif
0070