1 /*
2     SPDX-FileCopyrightText: 2012 Andrew Fuller <mactalla.obair@gmail.com>
3 
4     SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #ifndef KDEVPLATFORM_PLUGIN_PROJECTMODELSAVER_H
8 #define KDEVPLATFORM_PLUGIN_PROJECTMODELSAVER_H
9 
10 #include <KConfigViewStateSaver>
11 
12 namespace KDevelop
13 {
14 
15 class IProject;
16 
17 class ProjectModelSaver: public KConfigViewStateSaver
18 {
19     Q_OBJECT
20 public:
21     ProjectModelSaver();
22 
23     /**
24      * If @p project is non-null, only files from that project will
25      * be handled by @c indexFromConfigString() and @c indexToConfigString().
26      *
27      * For other files, an invalid index or empty string is be returned.
28      */
29     void setProject(IProject* project);
30 
31     QModelIndex indexFromConfigString(const QAbstractItemModel *model, const QString &key) const override;
32 
33     QString indexToConfigString(const QModelIndex &index) const override;
34 
35 private:
36     IProject* m_project = nullptr;
37 };
38 
39 }
40 
41 #endif // KDEVPLATFORM_PLUGIN_PROJECTMODELSAVER_H
42