#include "stadiumtab.h"
+/**
+ * \brief Stadium Tab constructor.
+ */
StadiumTab::StadiumTab(QWidget *parent) : QWidget(parent) {
mainLayout = new QVBoxLayout;
setLayout(mainLayout);
init();
}
+/**
+ * \brief Stadium Tab destructor.
+ */
StadiumTab::~StadiumTab() {
delete label;
delete mainLayout;
}
+/**
+ * \brief Print info about stadium from parsed data.
+ */
void StadiumTab::init() {
int cap = stadium.cap_n.toInt() + stadium.cap_e.toInt() + stadium.cap_w.toInt() + stadium.cap_s.toInt();
QString text;
if(stadium.wc.toInt() < ((cap+1000)*0.01)) {
text += tr("You need") + " " + QString().setNum((cap+1000)*0.01) + " " + tr("Toilets") + "<br>";
}
+ // but 60 for 21000 is still ok
if(stadium.bar.toInt() < ((cap+1000)*0.0044)) {
text += tr("You need") + " " + QString().setNum((cap+1000)*0.0044) + " " + tr("Buffets") + "<br>";
}
mainLayout->update();
}
+/**
+ * \brief Slot assigned to data change action.
+ */
void StadiumTab::dataChanged() {
rebuildUI();
}
+/**
+ * \brief Destroy current UI and draw it again.
+ */
void StadiumTab::rebuildUI() {
mainLayout->removeWidget(label);
delete label;