File indexing completed on 2024-05-19 05:47:30

0001 /*
0002  * This file is part of PyKrita, Krita' Python scripting plugin.
0003  *
0004  * Copyright (C) 2013 Alex Turbov <i.zaufi@gmail.com>
0005  * Copyright (C) 2014-2016 Boudewijn Rempt <boud@valdyas.org>
0006  * Copyright (C) 2017 Jouni Pentikäinen (joupent@gmail.com)
0007  *
0008  * This library is free software; you can redistribute it and/or
0009  * modify it under the terms of the GNU Library General Public
0010  * License as published by the Free Software Foundation; either
0011  * version 2 of the License, or (at your option) any later version.
0012  *
0013  * This library is distributed in the hope that it will be useful,
0014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0016  * Library General Public License for more details.
0017  *
0018  * You should have received a copy of the GNU Library General Public License
0019  * along with this library; see the file COPYING.LIB.  If not, write to
0020  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0021  * Boston, MA 02110-1301, USA.
0022  */
0023 
0024 #ifndef KRITA_PYTHONPLUGINSMODEL_H
0025 #define KRITA_PYTHONPLUGINSMODEL_H
0026 
0027 #include <QtCore/QAbstractTableModel>
0028 
0029 class PythonPluginManager;
0030 class PythonPlugin;
0031 
0032 class PythonPluginsModel : public QAbstractTableModel
0033 {
0034 public:
0035     PythonPluginsModel(QObject *parent, PythonPluginManager *pluginManager);
0036     PythonPlugin *plugin(const QModelIndex &) const;
0037 
0038 protected:
0039     enum Column {COl_NAME, COL_COMMENT, COLUMN_COUNT};
0040 
0041     int columnCount(const QModelIndex&) const override;
0042     int rowCount(const QModelIndex&) const override;
0043     QModelIndex index(int row, int column, const QModelIndex& parent) const override;
0044     QVariant headerData(int, Qt::Orientation, int) const override;
0045     QVariant data(const QModelIndex&, int) const override;
0046     Qt::ItemFlags flags(const QModelIndex&) const override;
0047     bool setData(const QModelIndex&, const QVariant&, int) override;
0048 
0049 
0050 private:
0051     PythonPluginManager *m_pluginManager;
0052 };
0053 
0054 #endif //KRITA_PYTHONPLUGINSMODEL_H