-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathPluginSettingsPage.h
129 lines (103 loc) · 3.56 KB
/
PluginSettingsPage.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
//-----------------------------------------------------------------------------
// File: PluginSettingsPage.h
//-----------------------------------------------------------------------------
// Project: Kactus 2
// Author: Joni-Matti Maatta
// Date: 19.02.2013
//
// Description:
// Settings page for adjusting plugin settings.
//-----------------------------------------------------------------------------
#ifndef PLUGINSETTINGSPAGE_H
#define PLUGINSETTINGSPAGE_H
#include "SettingsPage.h"
#include <common/widgets/DirectoryListSelector/DirectoryListSelector.h>
#include <KactusAPI/include/PluginManager.h>
#include <QTreeWidget>
#include <QPlainTextEdit>
#include <QSettings>
#include <QStackedWidget>
//-----------------------------------------------------------------------------
//! PluginSettingsPage class.
//-----------------------------------------------------------------------------
class PluginSettingsPage : public SettingsPage
{
Q_OBJECT
public:
/*!
* Constructor.
*
* @param [in/out] settings The settings store.
*/
PluginSettingsPage(QSettings& settings);
/*!
* Destructor.
*/
virtual ~PluginSettingsPage() = default;
//! Disable copying.
PluginSettingsPage(PluginSettingsPage const& rhs) = delete;
PluginSettingsPage& operator=(PluginSettingsPage const& rhs) = delete;
/*!
* Validates the contents of the page thoroughly.
*
* @return True, if the contents are valid. False, if they are invalid.
*
* @remarks Showing message boxes for errors is allowed.
*/
virtual bool validate() override final;
/*!
* Applies the changes that were done in the page.
*/
virtual void apply() override final;
private slots:
/*!
* Updates the correct settings in view when the tree item selection has changed.
*/
void onTreeItemChanged(QTreeWidgetItem* current, QTreeWidgetItem* prev);
/*!
* Updates the plugins tree when plugins directories have changed.
*/
void onDirectoriesChanged();
private:
//! Sets the page layout.
void setupLayout();
/*!
* Updates the plugins tree.
*/
void refreshPluginsTree(bool displayChanges = false);
/*!
* Resets the general information and settings stacks for plugins.
*
*/
void resetStacks();
/*!
* Creates a new category item to the tree.
*
* @param [in] text Category title text.
* @param [in] icon Icon for the category.
*/
QTreeWidgetItem* createCategoryItem(QString const& text, QIcon const& icon);
/*!
* Creates a new plugin item to the tree.
*
* @param [in] plugin Target plugin for the item.
*
* @return The created tree item.
*/
QTreeWidgetItem* createPluginItem(IPlugin* plugin);
//-----------------------------------------------------------------------------
// Data.
//-----------------------------------------------------------------------------
//! The settings store.
QSettings& settings_;
//! The plugins directories editor.
DirectoryListSelector pluginDirSelector_;
//! The plugins tree widget.
QTreeWidget pluginsTree_;
//! The plugin info stack.
QStackedWidget infoStack_;
//! Flag for indicating changes in plugin directories.
bool directoriesChanged_;
};
//-----------------------------------------------------------------------------
#endif // PLUGINSETTINGSPAGE_H