-
Notifications
You must be signed in to change notification settings - Fork 0
/
fikstur.cpp
108 lines (90 loc) · 2.52 KB
/
fikstur.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#include "fikstur.h"
#include "ui_fikstur.h"
#include <iostream>
#include <mac_bilgi_ekrani.h>
#include <QListWidgetItem>
#include "QMessageBox"
using namespace std;
int Fikstur::extractIntegerWords(string str)
{
stringstream ss;
/* Storing the whole string into string stream */
ss << str;
/* Running loop till the end of the stream */
string temp;
int found;
while (!ss.eof()) {
/* extracting word by word from stream */
ss >> temp;
/* Checking the given word is integer or not */
if (stringstream(temp) >> found)
return found;
/* To save from space at the end of string */
temp = "";
}
}
Fikstur::Fikstur(QWidget *parent) :
QDialog(parent),
ui(new Ui::Fikstur)
{
ui->setupUi(this);
this->setWindowTitle("Fikstür");
}
Fikstur::~Fikstur()
{
delete ui;
}
void Fikstur::on_listWidget_itemClicked(QListWidgetItem *item)
{
// mac_bilgi_ekrani ekrani;
// ekrani.setModal(true);
// ekrani.exec();
}
void Fikstur::setAllTeams(vector<Takim>& a){
allTeams = a;
for(int i = 0 ; i < allTeams.size()-1 ; i++){
QString haftaName = QString::number(i+1)+".Hafta";
ui->listWidget->addItem(haftaName);
}
}
void Fikstur::on_listWidget_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous)
{
int weekNum;
weekNum = extractIntegerWords(current->text().toStdString());
int macInt=0;
ui->tableWidget->setRowCount(allMatchs[weekNum].size());
for (auto& mac :allMatchs[weekNum-1]) {
QTableWidgetItem *b;
for (int j=0; j<5; j++) {
b = new QTableWidgetItem;
switch (j) {
case 0:
b->setText(QString::number(mac.getMacID()));
break;
case 1:
b->setText(QString::fromStdString(mac.getEvSahibi().getName()));
break;
case 2:
b->setText(QString::number(mac.getEvSahibiSkor()));
break;
case 3:
b->setText(QString::number(mac.getRakipSkor()));
break;
case 4:
b->setText(QString::fromStdString(mac.getRakip().getName()));
break;
}
ui->tableWidget->setItem(macInt,j,b);
}
macInt++;
}
}
void Fikstur::setAllMatchs(vector<vector<Mac>> &a){
allMatchs = a;
}
void Fikstur::on_tableWidget_itemClicked(QTableWidgetItem *item)
{
mac_bilgi_ekrani ekrani;
ekrani.setModal(true);
ekrani.exec();
}