File indexing completed on 2024-05-12 04:06:22

0001 /*
0002     SPDX-FileCopyrightText: 2010 Stefan Majewsky <majewsky@gmx.net>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef PALAPELI_TRIGGERLISTVIEW_H
0008 #define PALAPELI_TRIGGERLISTVIEW_H
0009 
0010 #include "../engine/interactor.h"
0011 #include "../engine/trigger.h"
0012 
0013 class QStandardItemModel;
0014 class KCategorizedSortFilterProxyModel;
0015 class KCategoryDrawer;
0016 #include <KCategorizedView>
0017 
0018 namespace Palapeli
0019 {
0020     class Interactor;
0021     class TriggerListDelegate;
0022     enum TriggerListRoles { TriggerRole = Qt::UserRole + 42, InteractorTypeRole, InteractorRole };
0023 
0024     class TriggerListView : public KCategorizedView
0025     {
0026         Q_OBJECT
0027         public:
0028             TriggerListView(const QMap<QByteArray, Palapeli::Interactor*>& interactors, Palapeli::InteractorType interactorType, QWidget* parent = nullptr);
0029             ~TriggerListView() override;
0030 
0031             void getAssociations(QMap<QByteArray, Palapeli::Trigger>& associations);
0032             void setAssociations(const QMap<QByteArray, Palapeli::Trigger>& associations);
0033         Q_SIGNALS:
0034             void associationsChanged();
0035         private:
0036             KCategoryDrawer* m_categoryDrawer;
0037             QStandardItemModel* m_baseModel;
0038             KCategorizedSortFilterProxyModel* m_proxyModel;
0039             Palapeli::TriggerListDelegate* m_delegate;
0040     };
0041 }
0042 
0043 #endif // PALAPELI_TRIGGERLISTVIEW_H