Crossfire Server, Trunk
CREExperienceWindow.cpp
Go to the documentation of this file.
1 /*
2  * Crossfire -- cooperative multi-player graphical RPG and adventure game
3  *
4  * Copyright (c) 2022 the Crossfire Development Team
5  *
6  * Crossfire is free software and comes with ABSOLUTELY NO WARRANTY. You are
7  * welcome to redistribute it under certain conditions. For details, please
8  * see COPYING and LICENSE.
9  *
10  * The authors can be reached via e-mail at <crossfire@metalforge.org>.
11  */
12 
13 #include <qboxlayout.h>
14 #include <qtreewidget.h>
15 
16 #include "CREExperienceWindow.h"
17 #include "CREFilterDialog.h"
18 
19 #include "global.h"
20 
22 {
23  QVBoxLayout* layout = new QVBoxLayout(this);
24 
25  QTreeWidget* tree = new QTreeWidget(this);
26  tree->setColumnCount(3);
27  QStringList headers;
28  headers << tr("Level") << tr("Experience") << tr("Difference");
29  tree->setHeaderLabels(headers);
30 
31  layout->addWidget(tree);
32 
33  extern int64_t *levels;
34  int64_t previous = 0;
35 
36  for (int level = 0; level < settings.max_level + 1; level++)
37  {
38  QTreeWidgetItem* item = new QTreeWidgetItem(tree);
39  item->setText(0, QString::number(level));
40  item->setText(1, QString::number(levels[level]));
41  item->setText(2, QString::number(levels[level] - previous));
43  }
44 
45  setWindowTitle(tr("Experience"));
46 }
47 
49 {
50 }
global.h
settings
struct Settings settings
Definition: init.cpp:139
Settings::max_level
int16_t max_level
Definition: global.h:302
layout
Definition: main.cpp:84
CREExperienceWindow::CREExperienceWindow
CREExperienceWindow()
Definition: CREExperienceWindow.cpp:21
say.previous
dictionary previous
Definition: say.py:205
CREFilterDialog.h
CREExperienceWindow.h
levels
int64_t * levels
Definition: exp.cpp:26
item
Definition: item.py:1
level
int level
Definition: readable.cpp:1609
CREExperienceWindow::~CREExperienceWindow
virtual ~CREExperienceWindow()
Definition: CREExperienceWindow.cpp:48
level
Definition: level.py:1