Debian Codegraph @

src/gui/settingsDialog/plugins/PluginsSettings.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2021 Damir Porobic <[email protected]>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program 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
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20 #ifndef KSNIP_PLUGINSSETTINGS_H
21 #define KSNIP_PLUGINSSETTINGS_H
22
23 #include <QGroupBox>
24 #include <QGridLayout>
25 #include <QLineEdit>
26 #include <QLabel>
27 #include <QPushButton>
28 #include <QTableWidget>
29 #include <QHeaderView>
30 #include <QRadioButton>
31
32 #include "src/backend/config/IConfig.h"
33 #include "src/common/adapter/fileDialog/IFileDialogService.h"
34 #include "src/common/helper/PathHelper.h"
35 #include "src/plugins/PluginInfo.h"
36 #include "src/plugins/IPluginFinder.h"
37
38 class PluginsSettings : public QGroupBox
39 {
40 Q_OBJECT
41 public:
42 explicit PluginsSettings(
43 const QSharedPointer<IConfig> &config,
44 const QSharedPointer<IFileDialogService> &fileDialogService,
45 const QSharedPointer<IPluginFinder> &pluginFinder);
46 ~PluginsSettings() override = default;
47 void saveSettings();
48
49 private:
50 QGridLayout *mLayout;
51 QLabel *mPluginPathLabel;
52 QLineEdit *mPluginPathLineEdit;
53 QPushButton *mBrowseButton;
54 QPushButton *mDetectButton;
55 QTableWidget *mTableWidget;
56 QRadioButton *mDefaultSearchPathRadioButton;
57 QRadioButton *mCustomSearchPathRadioButton;
58 QSharedPointer<IConfig> mConfig;
59 QSharedPointer<IFileDialogService> mFileDialogService;
60 QSharedPointer<IPluginFinder> mPluginFinder;
61 QList<PluginInfo> mDetectedPlugins;
62
63 void initGui();
64 void loadConfig();
65 void updatePluginTable();
66
67 private slots:
68 void choosePluginDirectory();
69 void detectPlugins();
70 void searchPathSelectionChanged();
71 };
72
73 #endif //KSNIP_PLUGINSSETTINGS_H