Crossfire Server, Branches 1.12  R18729
CREAnimationPanel.cpp
Go to the documentation of this file.
1 #include <Qt>
2 
3 extern "C" {
4 #include "global.h"
5 #include "artifact.h"
6 #include "object.h"
7 #include "face.h"
8 }
9 
10 #include "CREAnimationPanel.h"
11 #include "CREAnimationControl.h"
12 #include "CREUtils.h"
13 
15 {
16  myAnimation = 0;
17 
18  QGridLayout* layout = new QGridLayout(this);
19 
20  myUsing = new QTreeWidget(this);
21  myUsing->setColumnCount(1);
22  myUsing->setHeaderLabel(tr("Used by"));
23  myUsing->setIconSize(QSize(32, 32));
24  layout->addWidget(myUsing, 1, 1);
25 
26  myDisplay = new CREAnimationControl(this);
27  layout->addWidget(myDisplay, 2, 1);
28 }
29 
31 {
32  Q_ASSERT(animation);
33  myAnimation = animation;
34 
35  myUsing->clear();
36 
38 
39  QTreeWidgetItem* root = NULL;
40 
41  const archt* arch;
42 
43  for (arch = first_archetype; arch; arch = (arch->more ? arch->more : arch->next))
44  {
45  if (arch->clone.animation_id == myAnimation->num)
46  {
47  if (root == NULL)
48  {
49  root = CREUtils::archetypeNode(NULL);
50  myUsing->addTopLevelItem(root);
51  root->setExpanded(true);
52  }
53  CREUtils::archetypeNode(arch, root);
54  }
55  }
56 
57  root = NULL;
58 
59  artifactlist* list;
60  artifact* art;
61 
62  for (list = first_artifactlist; list; list = list->next)
63  {
64  for (art = list->items; art; art = art->next)
65  {
66  if (art->item->animation_id == myAnimation->num)
67  {
68  if (root == NULL)
69  {
70  root = CREUtils::artifactNode(NULL);
71  myUsing->addTopLevelItem(root);
72  root->setExpanded(true);
73  }
74  CREUtils::artifactNode(art, root);
75  }
76  }
77  }
78 }
static QTreeWidgetItem * archetypeNode(QTreeWidgetItem *parent)
Definition: CREUtils.cpp:11
static QTreeWidgetItem * artifactNode(QTreeWidgetItem *parent)
Definition: CREUtils.cpp:25
const Animations * myAnimation
struct artifactstruct * items
Definition: artifact.h:52
object clone
Definition: object.h:326
void setAnimation(const Animations *animation)
CREAnimationControl * myDisplay
Definition: object.h:321
struct artifactliststruct * next
Definition: artifact.h:51
uint16 num
Definition: face.h:58
static char root[500]
Definition: mapper.c:361
QTreeWidget * myUsing
struct archt * more
Definition: object.h:325
EXTERN artifactlist * first_artifactlist
Definition: global.h:194
struct archt * next
Definition: object.h:323
uint16 animation_id
Definition: object.h:267
object * item
Definition: artifact.h:38
void setAnimation(const Animations *animation)
EXTERN archetype * first_archetype
Definition: global.h:195
struct artifactstruct * next
Definition: artifact.h:41