29 QApplication::setOverrideCursor(Qt::WaitCursor);
31 setAttribute(Qt::WA_DeleteOnClose);
33 QGridLayout* layout =
new QGridLayout(
this);
36 myTree =
new QTreeWidget(
this);
38 myTree->setIconSize(QSize(32, 32));
39 myTree->setHeaderLabel(tr(
"All resources"));
44 title = tr(
"Archetypes");
49 title = tr(
"Animations");
54 title = tr(
"Treasures");
59 title = tr(
"Formulae");
64 title = tr(
"Artifacts");
74 title = tr(
"All resources");
76 myTree->setSortingEnabled(
true);
80 connect(
myTree, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
this, SLOT(
tree_currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)));
82 setWindowTitle(title);
84 QApplication::restoreOverrideCursor();
89 if (!current || current->data(0, Qt::UserRole).value<
void*>() == NULL)
109 newPanel->setVisible(
true);
117 myTree->addTopLevelItem(animationsNode);
119 QTreeWidgetItem* item;
133 QTreeWidgetItem* item, *sub;
138 myTree->addTopLevelItem(treasures);
149 for (treasure = list->
items; treasure; treasure = treasure->
next)
153 sub->setText(1, QString::number(treasure->
chance));
163 QTreeWidgetItem* item, *
root, *sub;
167 myTree->addTopLevelItem(root);
188 QTreeWidgetItem*
root, *form, *sub;
190 form =
new QTreeWidgetItem(
myTree, QStringList(tr(
"Formulae")));
193 for (
int ing = 1; ; ing++)
199 root =
new QTreeWidgetItem(form, QStringList(tr(
"%1 ingredients").arg(ing)));
201 for (recipe = list->
items; recipe; recipe = recipe->
next)
204 sub->setData(0, Qt::UserRole, QVariant::fromValue<void*>(
new CRETreeItemFormulae(recipe)));
213 QTreeWidgetItem* item, *
root, *sub;
217 root =
new QTreeWidgetItem(
myTree, QStringList(tr(
"Artifacts")));
223 item =
new QTreeWidgetItem(root, QStringList(data ? data->
name : tr(
"type %1").arg(list->
type)));
237 QTreeWidgetItem* item, *
root;
240 myTree->addTopLevelItem(root);
255 panel->setVisible(
false);
static QTreeWidgetItem * animationNode(QTreeWidgetItem *parent)
static QTreeWidgetItem * archetypeNode(QTreeWidgetItem *parent)
static QTreeWidgetItem * artifactNode(QTreeWidgetItem *parent)
CREResourcesWindow(DisplayMode mode=DisplayAll)
EXTERN int num_animations
struct artifactstruct * items
void tree_currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)
struct treasureliststruct * next
virtual QString getPanelName() const =0
static QTreeWidgetItem * formulaeNode(const recipe *recipe, QTreeWidgetItem *parent)
static QTreeWidgetItem * faceNode(QTreeWidgetItem *parent)
void addPanel(QString name, QWidget *panel)
virtual void fillPanel(QWidget *panel)=0
const typedata * get_typedata(int itemtype)
struct artifactliststruct * next
struct recipestruct recipe
EXTERN Animations * animations
EXTERN treasurelist * first_treasurelist
EXTERN artifactlist * first_artifactlist
QHash< QString, QPointer< QWidget > > myPanels
struct treasurestruct * items
struct treasurestruct treasure
struct recipestruct * next
static QTreeWidgetItem * treasureNode(QTreeWidgetItem *parent)
struct treasurestruct * next
EXTERN archetype * first_archetype
struct recipestruct * items
recipelist * get_formulalist(int i)
struct artifactstruct * next