Crossfire Server, Trunk  R20513
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 
9 CRETreeItemQuest::CRETreeItemQuest(Quest* quest, QTreeWidgetItem* item, CREResourcesWindow* window) : CRETTreeItem(quest, "Quest")
10 {
11  Q_ASSERT(item);
12  myTreeItem = item;
13  Q_ASSERT(window);
14  myWindow = window;
15 
16  if (myItem != NULL)
17  connect(myItem, SIGNAL(modified()), this, SLOT(questModified()));
18 }
19 
21 {
22 }
23 
25 {
26  if (myItem)
27  return "Quest";
28  return "(dummy)";
29 }
30 
31 void CRETreeItemQuest::fillPanel(QWidget* panel)
32 {
33  if (myItem == NULL)
34  return;
35 
37 }
38 
40 {
41  myTreeItem->setText(0, myItem->code());
42  myTreeItem->setIcon(0, QIcon());
43  if (!myItem->face().isEmpty())
44  {
45  const New_Face* face = myWindow->resourcesManager()->face(myItem->face());
46  if (face != NULL)
47  myTreeItem->setIcon(0, CREPixmap::getIcon(face->number));
48  }
49 }
50 
52 {
53  if (!myItem)
54  return;
55 
56  QAction* del = new QAction("delete quest", menu);
57  connect(del, SIGNAL(triggered(bool)), this, SLOT(deleteQuest(bool)));
58  menu->addAction(del);
59 }
60 
62 {
63  Q_ASSERT(myItem);
65 }
void deleteQuest(Quest *quest)
const New_Face * face(const QString &name) const
Definition: Quest.h:32
const QString & code() const
Definition: Quest.cpp:63
const QString & face() const
Definition: Quest.cpp:89
CREResourcesWindow * myWindow
uint16_t number
This is the image id.
Definition: face.h:15
QTreeWidgetItem * myTreeItem
virtual void fillContextMenu(QMenu *menu)
virtual void fillPanel(QWidget *panel)
Definition: CRETreeItem.h:32
virtual ~CRETreeItemQuest()
CRETreeItemQuest(Quest *quest, QTreeWidgetItem *item, CREResourcesWindow *window)
static QIcon getIcon(int faceNumber)
Definition: CREPixmap.cpp:27
virtual void fillPanel(QWidget *panel)
New face structure - this enforces the notion that data is face by face only - you can not change the...
Definition: face.h:14
const ResourcesManager * resourcesManager() const
virtual QString getPanelName() const