Crossfire Server, Trunk  R22047
CRETreeItemQuest.cpp
Go to the documentation of this file.
1 #include "CRETreeItemQuest.h"
2 #include "CREQuestPanel.h"
3 #include "Quest.h"
4 #include <QTreeWidgetItem>
5 #include "CREResourcesWindow.h"
6 #include "ResourcesManager.h"
7 #include "CREPixmap.h"
8 #include "assets.h"
9 #include "AssetsManager.h"
10 
11 CRETreeItemQuest::CRETreeItemQuest(Quest* quest, QTreeWidgetItem* item, CREResourcesWindow* window) : CRETTreeItem(quest, "Quest")
12 {
13  Q_ASSERT(item);
14  myTreeItem = item;
15  Q_ASSERT(window);
16  myWindow = window;
17 
18  if (myItem != NULL)
19  connect(myItem, SIGNAL(modified()), this, SLOT(questModified()));
20 }
21 
23 {
24 }
25 
27 {
28  if (myItem)
29  return "Quest";
30  return "(dummy)";
31 }
32 
33 void CRETreeItemQuest::fillPanel(QWidget* panel)
34 {
35  if (myItem == NULL)
36  return;
37 
39 }
40 
42 {
43  myTreeItem->setText(0, myItem->code());
44  myTreeItem->setIcon(0, QIcon());
45  if (!myItem->face().isEmpty())
46  {
47  const Face* face = getManager()->faces()->get(myItem->face().toLocal8Bit().data());
48  if (face != NULL)
49  myTreeItem->setIcon(0, CREPixmap::getIcon(face->number));
50  }
51 }
52 
54 {
55  if (!myItem)
56  return;
57 
58  QAction* del = new QAction("delete quest", menu);
59  connect(del, SIGNAL(triggered(bool)), this, SLOT(deleteQuest(bool)));
60  menu->addAction(del);
61 }
62 
64 {
65  Q_ASSERT(myItem);
67 }
const QString & face() const
Definition: Quest.cpp:89
void deleteQuest(Quest *quest)
T * get(const Key &name)
Definition: Quest.h:32
Definition: face.h:14
const QString & code() const
Definition: Quest.cpp:63
CREResourcesWindow * myWindow
AssetsManager * getManager()
Definition: assets.cpp:304
QTreeWidgetItem * myTreeItem
Faces * faces()
Definition: AssetsManager.h:38
virtual QString getPanelName() const
virtual void fillContextMenu(QMenu *menu)
virtual void fillPanel(QWidget *panel)
Definition: CRETreeItem.h:32
uint16_t number
Definition: face.h:15
virtual ~CRETreeItemQuest()
CRETreeItemQuest(Quest *quest, QTreeWidgetItem *item, CREResourcesWindow *window)
static QIcon getIcon(int faceNumber)
Definition: CREPixmap.cpp:30
virtual void fillPanel(QWidget *panel)