File indexing completed on 2024-05-05 04:53:42

0001 /*
0002     SPDX-FileCopyrightText: 2017 Nicolas Carion
0003     SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0004 */
0005 
0006 #pragma once
0007 
0008 #include "abstractmodel/abstracttreemodel.hpp"
0009 
0010 /** @brief This class represents a profile hierarchy to be displayed as a tree
0011  */
0012 class TreeItem;
0013 class ProfileModel;
0014 class ProfileTreeModel : public AbstractTreeModel
0015 {
0016     Q_OBJECT
0017 
0018 protected:
0019     explicit ProfileTreeModel(QObject *parent = nullptr);
0020 
0021 public:
0022     static std::shared_ptr<ProfileTreeModel> construct(QObject *parent);
0023 
0024     void init();
0025 
0026     QVariant data(const QModelIndex &index, int role) const override;
0027 
0028     /** @brief Given a valid QModelIndex, this function retrieves the corresponding profile's path. Returns the empty string if something went wrong */
0029     QString getProfile(const QModelIndex &index);
0030 
0031     /** @brief This function returns the model index corresponding to a given @param profile path */
0032     QModelIndex findProfile(const QString &profile);
0033 };