1 /*******************************************************************
2 Jan Cermak | johniez | aspt.johniez.com
3 Creative Commons 2.5 Attribution-NonCommercial-NoDerivs 2.5 license
4 http://creativecommons.org/licenses/by-nc-nd/2.5/legalcode
5 *******************************************************************/
7 #include "stadiumtab.h"
9 StadiumTab::StadiumTab(QWidget *parent) : QWidget(parent) {
10 mainLayout = new QVBoxLayout;
11 setLayout(mainLayout);
15 StadiumTab::~StadiumTab() {
20 void StadiumTab::init() {
21 int cap = stadium.cap_n.toInt() + stadium.cap_e.toInt() + stadium.cap_w.toInt() + stadium.cap_s.toInt();
23 text = "<table cellspacing=\"3\">";
24 text += "<tr><td>" + tr("Stadium") + "</td><td><span style=\"color:red;\">" + stadium.name + "</span></td></tr>";
25 text += "<tr><td>" + tr("Field condition") + "</td><td>" + stadium.field_status + "%</td></tr>";
26 text += "<tr><td></td><td></td></tr>";
27 text += "<tr><td>" + tr("Fan base") + "</td><td>" + stadium.fans + "</td></tr>";
28 text += "<tr><td>" + tr("satisfaction") + "</td><td>" + stadium.fanSatis + "%</td></tr>";
29 text += "<tr><td>" + tr("Capacity") + "</td><td><span style=\"color:red;\">" + QString().setNum(cap) + "</span></td></tr>";
30 text += "<tr><td></td><td></td></tr>";
31 text += "<tr><td>" + tr("Parking") + "</td><td>" + stadium.parking + "</td><td>(" + tr("minimal") + " " + QString().setNum((int)((float)cap/3)) + ")";
32 if(stadium.park_fu) text += " <span style=\"color:red;\">" + tr("unhappy!!") + "</span>";
34 text += "<tr><td>" + tr("Toilets") + "</td><td>" + stadium.wc + "</td><td>(" + tr("minimal") + " " + QString().setNum(cap*0.01) + ")";
35 if(stadium.wc_fu) text += " <span style=\"color:red;\">" + tr("unhappy!!") + "</span>";
37 text += "<tr><td>" + tr("Buffets") + "</td><td>" + stadium.bar + "</td><td>(" + tr("minimal") + " " + QString().setNum((int)(cap*0.0044)) + ")";
38 if(stadium.bar_fu) text += " <span style=\"color:red;\">" + tr("unhappy!!") + "</span>";
39 text += "</td></tr></table><hr>";
40 text += "<table cellspacing=\"3\">";
41 text += "<tr><td>" + tr("Price league") + "</td><td>" + stadium.priceLeague + "€ (" + QString().setNum(cap) + " " + tr("attendance gives cca. ") + QString().setNum(stadium.priceLeague.toInt()*(0.9*cap)) + "€)</td></tr>";
42 text += "<tr><td>" + tr("Price cup") + "</td><td>" + stadium.priceCup + "€ (" + QString().setNum(cap) + " " + tr("attendance gives cca. ") + QString().setNum(stadium.priceCup.toInt()*(0.9*cap)) + "€)</td></tr>";
43 text += "<tr><td>" + tr("Price friendly") + "</td><td>" + stadium.priceFriendly + "€ (" + QString().setNum(cap/10) + " " + tr("attendance gives cca. ") + QString().setNum(stadium.priceFriendly.toInt()*(0.09*cap)) + "€)</td></tr>";
44 text += "<tr><td>" + tr("Price friendly cup") + "</td><td>" + stadium.priceFriendlyCup + "€ (" + QString().setNum(cap/10) + " " + tr("attendance gives cca. ") + QString().setNum(stadium.priceFriendlyCup.toInt()*(0.09*cap)) + "€)</td></tr>";
45 text += "</table><hr>";
46 text += tr("Increasing 1000 places on stadium (calculations)") + ":<br>";
47 if(stadium.parking.toInt() < ((cap+1000)/3)) {
48 text += tr("You need") + " " + QString().setNum((int)((float)(cap+1000)/3)) + " " + tr("Parking places") + "<br>";
50 if(stadium.wc.toInt() < ((cap+1000)*0.01)) {
51 text += tr("You need") + " " + QString().setNum((cap+1000)*0.01) + " " + tr("Toilets") + "<br>";
53 if(stadium.bar.toInt() < ((cap+1000)*0.0044)) {
54 text += tr("You need") + " " + QString().setNum((cap+1000)*0.0044) + " " + tr("Buffets") + "<br>";
56 label = new QLabel(text);
57 mainLayout->addWidget(label);
61 void StadiumTab::dataChanged() {
65 void StadiumTab::rebuildUI() {
66 mainLayout->removeWidget(label);