File indexing completed on 2024-04-28 05:38:15
0001 /*************************************************************************** 0002 * Copyright (C) 2009 by Renaud Guezennec * 0003 * https://rolisteam.org/contact * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify * 0006 * it under the terms of the GNU General Public License as published by * 0007 * the Free Software Foundation; either version 2 of the License, or * 0008 * (at your option) any later version. * 0009 * * 0010 * This program is distributed in the hope that it will be useful, * 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0013 * GNU General Public License for more details. * 0014 * * 0015 * You should have received a copy of the GNU General Public License * 0016 * along with this program; if not, write to the * 0017 * Free Software Foundation, Inc., * 0018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 0019 ***************************************************************************/ 0020 #ifndef USERLISTVIEW_H 0021 #define USERLISTVIEW_H 0022 0023 #include "rwidgets_global.h" 0024 #include <QPointer> 0025 #include <QTreeView> 0026 #include <memory> 0027 // class PlayerOnMapModel; 0028 class UserListDelegate; 0029 class Person; 0030 class CharacterAction; 0031 class PlayerController; 0032 /** 0033 * @brief custom view to display tree person 0034 */ 0035 class RWIDGET_EXPORT UserListView : public QTreeView 0036 { 0037 Q_OBJECT 0038 public: 0039 enum Type 0040 { 0041 Integer, 0042 Boolean, 0043 Real, 0044 String, 0045 Color 0046 }; 0047 0048 explicit UserListView(QWidget* parent= nullptr); 0049 void setPlayerController(PlayerController* ctrl); 0050 public slots: 0051 void editCurrentItemColor(); 0052 0053 signals: 0054 void runDiceForCharacter(const QString& dice, const QString& uuid); 0055 0056 protected slots: 0057 virtual void mouseDoubleClickEvent(QMouseEvent*) override; 0058 virtual void mouseMoveEvent(QMouseEvent* event) override; 0059 void contextMenuEvent(QContextMenuEvent* e) override; 0060 void setPropertyValue(); 0061 void setState(); 0062 0063 void addAvatar(); 0064 void deleteAvatar(); 0065 0066 private: 0067 QPointer<PlayerController> m_ctrl; 0068 std::unique_ptr<QAction> m_addAvatarAct; 0069 std::unique_ptr<QAction> m_removeAvatarAct; 0070 std::unique_ptr<QAction> m_changeName; 0071 std::unique_ptr<QAction> m_changeColor; 0072 std::vector<QAction*> m_propertyActions; 0073 }; 0074 0075 Q_DECLARE_METATYPE(UserListView::Type) 0076 0077 #endif // USERLISTVIEW_H