#include "abouttab.h"
+/**
+ * \brief About Tab constructor.
+ */
AboutTab::AboutTab(QWidget *parent) : QWidget(parent) {
init();
}
+/**
+ * \brief About Tab destructor.
+ */
AboutTab::~AboutTab() {
delete label;
delete mainLayout;
}
+/**
+ * \brief About Tab initializer.
+ *
+ * Set some text into about tab.
+ */
void AboutTab::init() {
mainLayout = new QVBoxLayout;
QString text;
#include <QVBoxLayout>
#include <QLabel>
+/**
+ * \brief About Tab widget.
+ */
class AboutTab: public QWidget {
Q_OBJECT
QVBoxLayout *mainLayout;
#include "clubtab.h"
+/**
+ * Club Tab constructor.
+ */
ClubTab::ClubTab(QWidget *parent) : QWidget(parent) {
init();
}
+/**
+ * Club Tab destructor.
+ */
ClubTab::~ClubTab() {
delete label;
delete mainLayout;
}
+/**
+ * \brief Club Tab initializer.
+ *
+ * Set text into Club Tab.
+ */
void ClubTab::init() {
mainLayout = new QVBoxLayout;
QString text;
setLayout(mainLayout);
}
+/**
+ * \brief Slot assigned to data change action.
+ *
+ * Rebuild UI with new data.
+ */
void ClubTab::dataChanged() {
rebuildUI();
}
+/**
+ * \brief Redraw UI with new data.
+ *
+ * Destroy old widget and initialize new one..
+ */
void ClubTab::rebuildUI() {
label->clear();
delete mainLayout;
#include <QPushButton>
#include <QLabel>
+/// Struct with club information.
struct ClubStruct {
QString name, budget, rat, fndd, spirit, curpos, curdiv, totgmade, totgrecv, curgmade, curgrecv, curlgmade, curlgrecv, tothgames, totwins, totdraws, totlosts, curhgames, curwins, curdraws, curlosts, curlwins, curldraws, curllosts, totmaxatt, curmaxatt, totavgatt, curavgatt, form, for_a, tactic_a, attstyle_a, agr_a, cap_a;
bool incup;
extern void parse(const QString &);
extern ClubStruct club;
+/// Club Tab widget.
class ClubTab: public QWidget {
Q_OBJECT
QVBoxLayout *mainLayout;
#include "configtab.h"
+/**
+ * \brief Config Tab constructor.
+ */
ConfigTab::ConfigTab(QWidget *parent): QWidget(parent) {
file = 0;
http = new QHttp;
setLayout(mainLayout);
}
+/**
+ * \brief Config Tab destructor.
+ */
ConfigTab::~ConfigTab() {
if(file) delete file;
delete http;
delete mainLayout;
}
+/**
+ * \brief Slot assigned to language change action.
+ * \param langId language ID.
+ */
void ConfigTab::changeLang(int langId) {
langToSave = langId;
}
+/**
+ * \brief Slot assigned to proxy settings opening action.
+ */
void ConfigTab::openProxy() {
proxyWin = new ProxySet();
}
+/**
+ * \brief Slot assigned to save button click.
+ */
void ConfigTab::saveSettings() {
const char* langs[5] = {"en", "cs", "ro", "pl", "lt"};
QSettings settings("config/global.ini", QSettings::IniFormat);
}
}
+/**
+ * \brief Slot assigned to download button click.
+ */
void ConfigTab::downloadLatest() {
QSettings settings("config/global.ini", QSettings::IniFormat);
useProxy = settings.value("Network/proxyUsed", 0).toInt();
settings.sync();
}
+/**
+ * \brief Slot assigned to download finished action.
+ */
void ConfigTab::httpRequestFinished(int requestId, bool error) {
if (requestId != httpId) return;
file = 0;
}
+/**
+ * \brief Slot assigned to QHttp response action.
+ * \param responseHeader QHttp response.
+ */
void ConfigTab::readResponseHeader(const QHttpResponseHeader &responseHeader) {
if (responseHeader.statusCode() != 200) {
QMessageBox::information(this, tr("HTTP"), tr("Download failed: %1.").arg(responseHeader.reasonPhrase()));
}
}
+/**
+ * \brief Slot assigned to errMsgBox signal.
+ * \param text text to show.
+ */
void ConfigTab::showMsgBox(const QString &text) {
msgbox->clear();
msgbox->setText(text);
extern void parse(const QString &);
+/// Config widget.
class ConfigTab: public QWidget {
Q_OBJECT
QVBoxLayout *mainLayout, *group1Layout, *group2Layout;
#include "loadtab.h"
+/**
+ * \brief Load Tab constructor.
+ */
LoadTab::LoadTab(QWidget * parent) : QWidget(parent) {
init();
}
+/**
+ * \brief Load Tab destructor.
+ */
LoadTab::~LoadTab() {
delete label;
delete older;
delete mainLayout;
}
+/**
+ * Init UI for this tab.
+ */
void LoadTab::init() {
QSettings settings("config/global.ini", QSettings::IniFormat);
QString num = settings.value("nextXmlId", "0").toString();
int j = 0;
for(int i=num.toInt()-1; i>=0; i--) {
- quickparse("data/data_"+QString().setNum(i)+".xml");
+ quickparse("data/data_"+QString().setNum(i)+".xml"); // should be stored somewhere else
if(globSlot) {
dataParsed[j][0] = globSlot;
dataParsed[j][1] = curSlot;
connect(older, SIGNAL(currentIndexChanged(int)), this, SLOT(indexChanged(int)));
}
+/**
+ * \brief Slot assigned to data change action.
+ */
void LoadTab::dataChanged() {
rebuildUI();
}
+/**
+ * \brief Slot assigned to combobox index change.
+ * \param i selected index.
+ */
void LoadTab::indexChanged(int i) {
int fileNum = dataParsed[i][3];
parse("data/data_" + QString().setNum(fileNum) + ".xml");
label->setText(tr("Loaded file: ") + "data_" + QString().setNum(fileNum) + ".xml");
}
+/**
+ * \brief Delete UI and draw it again.
+ */
void LoadTab::rebuildUI() {
delete older;
delete label;
#include <QComboBox>
#include <QDate>
-extern int dataParsed[20][4]; // glob slot || slot || seazon || data #
+extern int dataParsed[20][4]; // glob slot || slot || season || data #
extern int globSlot;
extern int curSlot;
extern int curSeason;
extern void parse(const QString &);
extern void quickparse(const QString &);
+/// Load Tab widget.
class LoadTab: public QWidget {
Q_OBJECT
QVBoxLayout *mainLayout;
void parse(const QString &data);
-int playerCnt;
-Player pls[45];
-int staffCnt;
-StaffMemberStruct staff[7];
-StadiumStruct stadium;
-ClubStruct club;
+int playerCnt; ///< number of players parsed
+Player pls[45]; ///< parsed players array
+int staffCnt; ///< number of staff parsed
+StaffMemberStruct staff[7]; ///< parsed staff array
+StadiumStruct stadium; ///< parsed stadium
+ClubStruct club; ///< parsed club
int dataParsed[20][4];
int globSlot, curSlot, curSeason;
+/**
+ * \brief Function parsing input XML.
+ *
+ * Parse players, staff, stadium etc. info from soccerproject XML.
+ * \param[in] data path to input xml.
+ */
void parse(const QString &data) {
QDomDocument doc("spdt");
QFile file( data );
}
}
+/**
+ * \brief Function partially parsing input XML.
+ *
+ * Parse only information about current season.
+ * Used to assigning season to input xml on the fly.
+ * \param[in] data path to input xml.
+ */
void quickparse(const QString &data) {
QDomDocument doc("spdt");
QFile file( data );
#include "mainwindow.h"
+/**
+ * \brief Main Window constructor.
+ */
MainWindow::MainWindow(QWidget * parent) : QWidget(parent) {
tabWidget = new QTabWidget;
conf = new ConfigTab(this);
setLayout(mainLayout);
}
+/**
+ * \brief Main Window destructor.
+ */
MainWindow::~MainWindow() {
delete conf;
delete player;
#include "abouttab.h"
#include "performance.h"
+/**
+ * \brief Main Window widget.
+ *
+ * Holds all tabs inside it.
+ */
class MainWindow: public QWidget {
Q_OBJECT
QVBoxLayout *mainLayout;
#include "performance.h"
+/**
+ * \brief Init UI.
+ */
void PerformanceTab::init() {
QSettings settings("config/formation.ini", QSettings::IniFormat);
mainLayout->update();
}
+/**
+ * \brief Performance Tab constructor.
+ */
PerformanceTab::PerformanceTab(QWidget *parent): QWidget(parent), defs(0), mids(0), fors(0) {
mainLayout = new QVBoxLayout;
setLayout(mainLayout);
init();
}
+/**
+ * \brief Performance Tab destructor.
+ */
PerformanceTab::~PerformanceTab() {
for(int i=0; i<11; ++i) {
delete player[i];
delete mainLayout;
}
+/**
+ * \brief Slot assigned to data change action.
+ */
void PerformanceTab::dataChanged() {
container->removeWidget(format);
delete format;
init();
}
+/**
+ * \brief Set adequate player post by selected formation.
+ */
void PerformanceTab::postLabels() {
int LMpos = 0;
if(!defsC) {
}
}
+/**
+ * \brief Count performance of each line (def, mid, fwd).
+ *
+ * Count with offensive/defensive order of each player.
+ */
void PerformanceTab::countPerf() {
defs = 0;
mids = 0;
}
}
+/**
+ * \brief Slot assigned to "count performance" button.
+ *
+ * Print all play-variants points..
+ */
void PerformanceTab::recount() {
double homeMod = home->itemData(home->currentIndex()).toDouble();
double pre = (1.0+((double)aggress/1000))/(7.0 - (club.spirit.toDouble()/1000) + homeMod);
result->setText(text);
}
+/**
+ * \brief Slot assigned to aggression change.
+ *
+ * \param[in] a Aggression ID.
+ * Save aggression to config file.
+ */
void PerformanceTab::aggressChange(int a) {
aggress = a*5;
QSettings settings("config/formation.ini", QSettings::IniFormat);
settings.sync();
}
+/**
+ * \brief Slot assigned to formation change.
+ * \param[in] t Formation ID.
+ */
void PerformanceTab::formatChange(int t) {
QSettings settings("config/formation.ini", QSettings::IniFormat);
if(t<8 && t>=0) { settings.setValue("form", t); settings.sync(); }
reorderPlayers();
}
+/**
+ * \brief Slot assigned to player combobox changes.
+ * \param[in] id possition ID
+ */
void PerformanceTab::playerChange(int id) {
id = 1; //avoid warning :-D
QSettings settings("config/formation.ini", QSettings::IniFormat);
settings.sync();
}
+/**
+ * \brief Slot assigned to "re-order players" button.
+ *
+ * If there are players assigned to wrong possition (by selected formation),
+ * then this function give here players with correct post.
+ * This do not look at player performance, first is selected..
+ */
void PerformanceTab::reorderPlayers() {
int i;
int from = 0;
}
}
+/**
+ * \brief Searching for first player with this post.
+ * \param[in] post player possition.
+ */
int PerformanceTab::findFirstOnPost(const QString &post) {
for(int i=0; i<playerCnt; ++i) {
if(post == pls[i].position) return i;
extern ClubStruct club;
+/// Performance widget.
class PerformanceTab: public QWidget {
Q_OBJECT
QVBoxLayout *mainLayout;
#include "playerdetail.h"
+/**
+ * \brief Player Detail Widget constructor.
+ */
PlayerDetail::PlayerDetail(int idx, QWidget * parent): QWidget(parent), i(idx) {
mainLayout = new QVBoxLayout;
QString info = "<table>";
setLayout(mainLayout);
}
+/**
+ * \brief Player Detail destructor.
+ */
PlayerDetail::~PlayerDetail() {
delete player;
delete mainLayout;
#include <QPushButton>
#include <QLabel>
+/// Struct with information parsed for each player.
struct Player {
QString id;
QString fname;
extern Player pls[];
extern int playerCnt;
+/// Player detail widget.
class PlayerDetail: public QWidget {
Q_OBJECT
QVBoxLayout *mainLayout;
#include "playertab.h"
+/**
+ * \brief Player Container constructor.
+ *
+ * Add player to adequate Tab by player possition (GK, LB etc.).
+ */
PlayerCont::PlayerCont(int pos, QWidget *parent) : QWidget(parent) {
tabWidget = new QTabWidget;
tabWidget->setTabPosition(QTabWidget::West);
setLayout(mainLayout);
}
+/**
+ * \brief Player Container destructor.
+ */
PlayerCont::~PlayerCont() {
delete tabWidget;
delete mainLayout;
}
+/**
+ * \brief Players Tab constructor.
+ *
+ * Hold player possition Tabs (GK, LB...).
+ */
PlayerTab::PlayerTab(QWidget *parent) : QWidget(parent) {
initTabs();
}
+/**
+ * \brief Players Tab destructor.
+ */
PlayerTab::~PlayerTab() {
delete tabWidget;
delete mainLayout;
}
+/**
+ * \brief Init Player Tab - add Tabs with player possition.
+ */
void PlayerTab::initTabs() {
tabWidget = new QTabWidget;
tabWidget->setTabPosition(QTabWidget::North);
setLayout(mainLayout);
}
+/**
+ * \brief Slot assigned to data change action.
+ */
void PlayerTab::dataChanged() {
rebuildUI();
}
+/**
+ * \brief Redraw UI with new data.
+ */
void PlayerTab::rebuildUI() {
delete tabWidget;
delete mainLayout;
extern int playerCnt;
extern Player pls[];
+/// Container for players with same possition (GK, LB..)
class PlayerCont: public QWidget {
Q_OBJECT
QTabWidget *tabWidget;
~PlayerCont();
};
+/// Widget with player possition Tabs.
class PlayerTab: public QWidget {
Q_OBJECT
QTabWidget *tabWidget;
#include "proxyset.h"
+/**
+ * \brief Proxy settings widget constructor.
+ */
ProxySet::ProxySet(QWidget *parent) : QWidget(parent) {
QSettings settings("config/global.ini", QSettings::IniFormat);
useProxy = settings.value("Network/proxyUsed", 0).toInt();
this->show();
}
+/**
+ * \brief Proxy settings destructor.
+ */
ProxySet::~ProxySet() {
delete addrP;
delete portP;
delete mainLayout;
}
+/**
+ * \brief Slot assigned to save button click.
+ */
void ProxySet::save() {
QSettings settings("config/global.ini", QSettings::IniFormat);
settings.setValue("Network/proxyUsed", useProxy);
settings.sync();
}
+/**
+ * \brief Slot assigned to check box changes.
+ */
void ProxySet::checkChange(int state) {
useProxy = state;
}
#include <QLineEdit>
#include <QSettings>
+/// Proxy settings widget.
class ProxySet: public QWidget {
Q_OBJECT
QVBoxLayout *mainLayout;
#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;
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;
extern void parse(const QString &);
extern StadiumStruct stadium;
+/// Stadium Tab widget.
class StadiumTab: public QWidget {
Q_OBJECT
QVBoxLayout *mainLayout;
#include "staffmember.h"
+/**
+ * \brief Staff Member constructor.
+ *
+ * Display info about requested staff.
+ * \param idx staff member ID.
+ */
StaffMember::StaffMember(int idx, QWidget *parent): QWidget(parent), i(idx) {
mainLayout = new QVBoxLayout;
QString info = "<table cellspacing=\"3\">";
setLayout(mainLayout);
}
+/**
+ * \brief Staff member destructor.
+ */
StaffMember::~StaffMember() {
delete player;
delete mainLayout;
extern StaffMemberStruct staff[];
extern int staffCnt;
+/// Staff widget.
class StaffMember: public QWidget {
Q_OBJECT
QVBoxLayout *mainLayout;
#include "stafftab.h"
+/**
+ * \brief Staff Tab constructor.
+ */
StaffTab::StaffTab(QWidget *parent) : QWidget(parent) {
initTabs();
}
+/**
+ * \brief Staff Tab destructor.
+ */
StaffTab::~StaffTab() {
delete tabWidget;
delete mainLayout;
}
+/**
+ * \brief Add tabs for each staff members.
+ */
void StaffTab::initTabs() {
tabWidget = new QTabWidget;
tabWidget->setTabPosition(QTabWidget::West);
setLayout(mainLayout);
}
+/**
+ * \brief Slot assigned to data change action.
+ */
void StaffTab::dataChanged() {
rebuildUI();
}
+/**
+ * \brief Delete widget and draw it again.
+ */
void StaffTab::rebuildUI() {
delete tabWidget;
delete mainLayout;
extern int staffCnt;
extern StaffMemberStruct staff[];
+/// Staff Tab widget.
class StaffTab: public QWidget {
Q_OBJECT
QTabWidget *tabWidget;