File indexing completed on 2024-04-28 04:39:10

0001 /*
0002     SPDX-FileCopyrightText: 2012 Andrew Fuller <mactalla.obair@gmail.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef KDEVPLATFORM_PLUGIN_PROJECTMODELSAVER_H
0008 #define KDEVPLATFORM_PLUGIN_PROJECTMODELSAVER_H
0009 
0010 #include <KConfigViewStateSaver>
0011 
0012 namespace KDevelop
0013 {
0014 
0015 class IProject;
0016 
0017 class ProjectModelSaver: public KConfigViewStateSaver
0018 {
0019     Q_OBJECT
0020 public:
0021     ProjectModelSaver();
0022 
0023     /**
0024      * If @p project is non-null, only files from that project will
0025      * be handled by @c indexFromConfigString() and @c indexToConfigString().
0026      *
0027      * For other files, an invalid index or empty string is be returned.
0028      */
0029     void setProject(IProject* project);
0030 
0031     QModelIndex indexFromConfigString(const QAbstractItemModel *model, const QString &key) const override;
0032 
0033     QString indexToConfigString(const QModelIndex &index) const override;
0034 
0035 private:
0036     IProject* m_project = nullptr;
0037 };
0038 
0039 }
0040 
0041 #endif // KDEVPLATFORM_PLUGIN_PROJECTMODELSAVER_H