From cdb03cae2c21c9a5ada496b92e705995334e9e9a Mon Sep 17 00:00:00 2001 From: daniel-Jones Date: Sat, 23 Jul 2016 13:36:10 +0930 Subject: Added images for all weapons, stats from each weapon appear in a table. thanks to csgo-stats.com for the images! Other small changes. --- csgo_images.qrc | 38 +++++ csgo_stats.pro | 3 + icons/avatar.jpg | Bin 0 -> 3761 bytes icons/mvp.png | Bin 0 -> 55680 bytes stats_display_window.cpp | 386 +++++++++++++++++++++++++++++++++++++++++++++-- stats_display_window.h | 42 +++++- stats_display_window.ui | 174 +++++++++++++++++---- user_select_dialog.cpp | 70 +++++---- user_select_dialog.h | 2 + user_select_dialog.ui | 71 +++++---- weapons/ak47.png | Bin 0 -> 13352 bytes weapons/aug.png | Bin 0 -> 13048 bytes weapons/awp.png | Bin 0 -> 9509 bytes weapons/bizon.png | Bin 0 -> 16292 bytes weapons/deagle.png | Bin 0 -> 11812 bytes weapons/elite.png | Bin 0 -> 19207 bytes weapons/famas.png | Bin 0 -> 13738 bytes weapons/fiveseven.png | Bin 0 -> 10752 bytes weapons/g3sg1.png | Bin 0 -> 11262 bytes weapons/galilar.png | Bin 0 -> 13944 bytes weapons/glock.png | Bin 0 -> 8708 bytes weapons/hegrenade.png | Bin 0 -> 9162 bytes weapons/hkp2000.png | Bin 0 -> 8376 bytes weapons/knife.png | Bin 0 -> 34170 bytes weapons/m249.png | Bin 0 -> 15132 bytes weapons/m4.png | Bin 0 -> 14944 bytes weapons/mac10.png | Bin 0 -> 10180 bytes weapons/mag7.png | Bin 0 -> 8815 bytes weapons/mp7.png | Bin 0 -> 10298 bytes weapons/negev.png | Bin 0 -> 15850 bytes weapons/nova.png | Bin 0 -> 10379 bytes weapons/p250.png | Bin 0 -> 11730 bytes weapons/p90.png | Bin 0 -> 16426 bytes weapons/sawedoff.png | Bin 0 -> 7111 bytes weapons/scar20.png | Bin 0 -> 12024 bytes weapons/sg556.png | Bin 0 -> 14664 bytes weapons/ssg08.png | Bin 0 -> 12112 bytes weapons/tec9.png | Bin 0 -> 9724 bytes weapons/ump45.png | Bin 0 -> 12000 bytes weapons/xm1014.png | Bin 0 -> 11950 bytes 40 files changed, 677 insertions(+), 109 deletions(-) create mode 100644 csgo_images.qrc create mode 100644 icons/avatar.jpg create mode 100644 icons/mvp.png create mode 100644 weapons/ak47.png create mode 100644 weapons/aug.png create mode 100644 weapons/awp.png create mode 100644 weapons/bizon.png create mode 100644 weapons/deagle.png create mode 100644 weapons/elite.png create mode 100644 weapons/famas.png create mode 100644 weapons/fiveseven.png create mode 100644 weapons/g3sg1.png create mode 100644 weapons/galilar.png create mode 100644 weapons/glock.png create mode 100644 weapons/hegrenade.png create mode 100644 weapons/hkp2000.png create mode 100644 weapons/knife.png create mode 100644 weapons/m249.png create mode 100644 weapons/m4.png create mode 100644 weapons/mac10.png create mode 100644 weapons/mag7.png create mode 100644 weapons/mp7.png create mode 100644 weapons/negev.png create mode 100644 weapons/nova.png create mode 100644 weapons/p250.png create mode 100644 weapons/p90.png create mode 100644 weapons/sawedoff.png create mode 100644 weapons/scar20.png create mode 100644 weapons/sg556.png create mode 100644 weapons/ssg08.png create mode 100644 weapons/tec9.png create mode 100644 weapons/ump45.png create mode 100644 weapons/xm1014.png diff --git a/csgo_images.qrc b/csgo_images.qrc new file mode 100644 index 0000000..6d5f5ae --- /dev/null +++ b/csgo_images.qrc @@ -0,0 +1,38 @@ + + + icons/mvp.png + icons/avatar.jpg + + + weapons/ak47.png + weapons/aug.png + weapons/awp.png + weapons/bizon.png + weapons/deagle.png + weapons/elite.png + weapons/famas.png + weapons/fiveseven.png + weapons/g3sg1.png + weapons/galilar.png + weapons/glock.png + weapons/hegrenade.png + weapons/hkp2000.png + weapons/knife.png + weapons/m4.png + weapons/m249.png + weapons/mac10.png + weapons/mag7.png + weapons/mp7.png + weapons/negev.png + weapons/nova.png + weapons/p90.png + weapons/p250.png + weapons/sawedoff.png + weapons/scar20.png + weapons/sg556.png + weapons/ssg08.png + weapons/tec9.png + weapons/ump45.png + weapons/xm1014.png + + diff --git a/csgo_stats.pro b/csgo_stats.pro index 647e441..dcdd896 100644 --- a/csgo_stats.pro +++ b/csgo_stats.pro @@ -25,3 +25,6 @@ HEADERS += user_select_dialog.h \ FORMS += user_select_dialog.ui \ stats_display_window.ui + +RESOURCES += \ + csgo_images.qrc diff --git a/icons/avatar.jpg b/icons/avatar.jpg new file mode 100644 index 0000000..785c5bc Binary files /dev/null and b/icons/avatar.jpg differ diff --git a/icons/mvp.png b/icons/mvp.png new file mode 100644 index 0000000..7eb6779 Binary files /dev/null and b/icons/mvp.png differ diff --git a/stats_display_window.cpp b/stats_display_window.cpp index 24bbbec..1b71f7e 100644 --- a/stats_display_window.cpp +++ b/stats_display_window.cpp @@ -14,31 +14,34 @@ stats_display_window::~stats_display_window() delete ui; } -void stats_display_window::showEvent(QShowEvent *ev) -{ - emit window_loaded(); -} - -void stats_display_window::window_open() +void stats_display_window::setup_user() { /* - * this slot is called when our stats window is opened - * we will parse our steam account file and edit the UI accordingly + * this function sets up our user struct + * TODO: CLEAN IT UP */ user.username = parse.parse_user_data("\"personaname\":", ": "); user.realname = parse.parse_user_data("\"realname\":", ": "); user.avatar_url = parse.parse_user_data("\"avatarfull\":", ": "); user.status = parse.parse_user_data("\"personastate\":", ": "); + user.user_64id = parse.parse_user_data("\"steamid\":", ": "); download.download_file(user.avatar_url, "avatar.jpg"); /* now we have to deal with our user account details */ ui->username_label->setText(user.username); - if (user.realname == NULL) - ui->realname_label->setText("Realname not set"); + if (user.realname == "null") + ui->realname_label->setText("Real name not set"); else ui->realname_label->setText(user.realname); - QPixmap image("avatar.jpg"); - ui->avatar_label->setPixmap(image); - + if (user.username == "null") + { + QPixmap avatar(":/icons/icons/avatar.jpg"); + ui->avatar_label->setPixmap(avatar); + } + else + { + QPixmap avatar("avatar.jpg"); + ui->avatar_label->setPixmap(avatar); + } /* user online status */ switch(user.status.toInt()) { @@ -61,8 +64,363 @@ void stats_display_window::window_open() ui->status_label->setText("Unknown status"); break; } +} + +void stats_display_window::setup_csgo_data() +{ + /* most of the things in this function are images */ + int w = 100; + int h = 50; + ui->weapon_table->setColumnCount(2); + ui->weapon_table->setRowCount(29); + /* mvp */ + user.mvp_count = parse.parse_csgo_data("total_mvps"); + QPixmap mvp(":/icons/icons/mvp.png"); + ui->mvp_label->setPixmap(mvp.scaled(30, 30)); + QString mvp_count = user.mvp_count + " MVPs"; + ui->mvp_number_label->setText(mvp_count); + /* time played */ user.time_ingame = parse.parse_csgo_data("total_time_played"); QString time_in_game = "Hours in CS:GO: " + QString::number(user.time_ingame.toInt() / 3600); ui->time_in_label->setText(time_in_game); - qDebug() << user.time_ingame.toInt(); + /* awp */ + QLabel *awp_label = new QLabel(this); + QLabel *awp_kills_label = new QLabel(this); + QPixmap awp(":/weapons/weapons/awp.png"); + awp_label->setPixmap(awp.scaled(w, h)); + user.awp_kills = parse.parse_csgo_data("total_kills_awp"); + QString awp_kills_text = user.awp_kills + " kills"; + awp_kills_label->setText(awp_kills_text); + ui->weapon_table->setCellWidget(0, 0, awp_label); + ui->weapon_table->setCellWidget(0, 1, awp_kills_label); + /* ak47 */ + QLabel *ak47_label = new QLabel(this); + QLabel *ak47_kills_label = new QLabel(this); + QPixmap ak47(":/weapons/weapons/ak47.png"); + ak47_label->setPixmap(ak47.scaled(w, h)); + user.ak47_kills = parse.parse_csgo_data("total_kills_ak47"); + QString ak47_kills_text = user.ak47_kills + " kills"; + ak47_kills_label->setText(ak47_kills_text); + ui->weapon_table->setCellWidget(1, 0, ak47_label); + ui->weapon_table->setCellWidget(1, 1, ak47_kills_label); + /* deagle */ + QLabel *deagle_label = new QLabel(this); + QLabel *deagle_kills_label = new QLabel(this); + QPixmap deagle(":/weapons/weapons/deagle.png"); + deagle_label->setPixmap(deagle.scaled(w / 2, h)); + user.deagle_kills = parse.parse_csgo_data("total_kills_deagle"); + QString deagle_kills_text = user.deagle_kills + " kills"; + deagle_kills_label->setText(deagle_kills_text); + ui->weapon_table->setCellWidget(2, 0, deagle_label); + ui->weapon_table->setCellWidget(2, 1, deagle_kills_label); + /* m4 */ + QLabel *m4_label = new QLabel(this); + QLabel *m4_kills_label = new QLabel(this); + QPixmap m4(":/weapons/weapons/m4.png"); + m4_label->setPixmap(m4.scaled(w, h)); + user.m4_kills = parse.parse_csgo_data("total_kills_m4"); + QString m4_kills_text = user.m4_kills + " kills"; + m4_kills_label->setText(m4_kills_text); + ui->weapon_table->setCellWidget(3, 0, m4_label); + ui->weapon_table->setCellWidget(3, 1, m4_kills_label); + /* aug */ + QLabel *aug_label = new QLabel(this); + QLabel *aug_kills_label = new QLabel(this); + QPixmap aug(":/weapons/weapons/aug.png"); + aug_label->setPixmap(aug.scaled(w, h)); + user.aug_kills = parse.parse_csgo_data("total_kills_aug"); + QString aug_kills_text = user.aug_kills + " kills"; + aug_kills_label->setText(aug_kills_text); + ui->weapon_table->setCellWidget(4, 0, aug_label); + ui->weapon_table->setCellWidget(4, 1, aug_kills_label); + /* bizon */ + QLabel *bizon_label = new QLabel(this); + QLabel *bizon_kills_label = new QLabel(this); + QPixmap bizon(":/weapons/weapons/bizon.png"); + bizon_label->setPixmap(bizon.scaled(w, h)); + user.bizon_kills = parse.parse_csgo_data("total_kills_bizon"); + QString bizon_kills_text = user.bizon_kills + " kills"; + bizon_kills_label->setText(bizon_kills_text); + ui->weapon_table->setCellWidget(5, 0, bizon_label); + ui->weapon_table->setCellWidget(5, 1, bizon_kills_label); + /* elite */ + QLabel *elite_label = new QLabel(this); + QLabel *elite_kills_label = new QLabel(this); + QPixmap elite(":/weapons/weapons/elite.png"); + elite_label->setPixmap(elite.scaled(w, h)); + user.elite_kills = parse.parse_csgo_data("total_kills_elite"); + QString elite_kills_text = user.elite_kills + " kills"; + elite_kills_label->setText(elite_kills_text); + ui->weapon_table->setCellWidget(6, 0, elite_label); + ui->weapon_table->setCellWidget(6, 1, elite_kills_label); + /* famas */ + QLabel *famas_label = new QLabel(this); + QLabel *famas_kills_label = new QLabel(this); + QPixmap famas(":/weapons/weapons/famas.png"); + famas_label->setPixmap(famas.scaled(w, h)); + user.famas_kills = parse.parse_csgo_data("total_kills_famas"); + QString famas_kills_text = user.famas_kills + " kills"; + famas_kills_label->setText(famas_kills_text); + ui->weapon_table->setCellWidget(7, 0, famas_label); + ui->weapon_table->setCellWidget(7, 1, famas_kills_label); + /* fiveseven */ + QLabel *fiveseven_label = new QLabel(this); + QLabel *fiveseven_kills_label = new QLabel(this); + QPixmap fiveseven(":/weapons/weapons/fiveseven.png"); + fiveseven_label->setPixmap(fiveseven.scaled(w / 2, h)); + user.fiveseven_kills = parse.parse_csgo_data("total_kills_fiveseven"); + QString fiveseven_kills_text = user.fiveseven_kills + " kills"; + fiveseven_kills_label->setText(fiveseven_kills_text); + ui->weapon_table->setCellWidget(8, 0, fiveseven_label); + ui->weapon_table->setCellWidget(8, 1, fiveseven_kills_label); + /* g3sg1 */ + QLabel *g3sg1_label = new QLabel(this); + QLabel *g3sg1_kills_label = new QLabel(this); + QPixmap g3sg1(":/weapons/weapons/g3sg1.png"); + g3sg1_label->setPixmap(g3sg1.scaled(w, h)); + user.g3sg1_kills = parse.parse_csgo_data("total_kills_g3sg1"); + QString g3sg1_kills_text = user.g3sg1_kills + " kills"; + g3sg1_kills_label->setText(g3sg1_kills_text); + ui->weapon_table->setCellWidget(9, 0, g3sg1_label); + ui->weapon_table->setCellWidget(9, 1, g3sg1_kills_label); + /* galilar */ + QLabel *galilar_label = new QLabel(this); + QLabel *galilar_kills_label = new QLabel(this); + QPixmap galilar(":/weapons/weapons/galilar.png"); + galilar_label->setPixmap(galilar.scaled(w, h)); + user.galilar_kills = parse.parse_csgo_data("total_kills_galilar"); + QString galilar_kills_text = user.galilar_kills + " kills"; + galilar_kills_label->setText(galilar_kills_text); + ui->weapon_table->setCellWidget(10, 0, galilar_label); + ui->weapon_table->setCellWidget(10, 1, galilar_kills_label); + /* glock */ + QLabel *glock_label = new QLabel(this); + QLabel *glock_kills_label = new QLabel(this); + QPixmap glock(":/weapons/weapons/glock.png"); + glock_label->setPixmap(glock.scaled(w / 2, h)); + user.glock_kills = parse.parse_csgo_data("total_kills_glock"); + QString glock_kills_text = user.glock_kills + " kills"; + glock_kills_label->setText(glock_kills_text); + ui->weapon_table->setCellWidget(11, 0, glock_label); + ui->weapon_table->setCellWidget(11, 1, glock_kills_label); + /* hegrenade */ + QLabel *hegrenade_label = new QLabel(this); + QLabel *hegrenade_kills_label = new QLabel(this); + QPixmap hegrenade(":/weapons/weapons/hegrenade.png"); + hegrenade_label->setPixmap(hegrenade.scaled(w / 2, h)); + user.hegrenade_kills = parse.parse_csgo_data("total_kills_hegrenade"); + QString hegrenade_kills_text = user.hegrenade_kills + " kills"; + hegrenade_kills_label->setText(hegrenade_kills_text); + ui->weapon_table->setCellWidget(12, 0, hegrenade_label); + ui->weapon_table->setCellWidget(12, 1, hegrenade_kills_label); + /* hkp2000 */ + QLabel *hkp2000_label = new QLabel(this); + QLabel *hkp2000_kills_label = new QLabel(this); + QPixmap hkp2000(":/weapons/weapons/hkp2000.png"); + hkp2000_label->setPixmap(hkp2000.scaled(w / 2, h)); + user.hkp2000_kills = parse.parse_csgo_data("total_kills_hkp2000"); + QString hkp2000_kills_text = user.hkp2000_kills + " kills"; + hkp2000_kills_label->setText(hkp2000_kills_text); + ui->weapon_table->setCellWidget(13, 0, hkp2000_label); + ui->weapon_table->setCellWidget(13, 1, hkp2000_kills_label); + /* knife */ + QLabel *knife_label = new QLabel(this); + QLabel *knife_kills_label = new QLabel(this); + QPixmap knife(":/weapons/weapons/knife.png"); + knife_label->setPixmap(knife.scaled(w / 2, h)); + user.knife_kills = parse.parse_csgo_data("total_kills_knife"); + QString knife_kills_text = user.knife_kills + " kills"; + knife_kills_label->setText(knife_kills_text); + ui->weapon_table->setCellWidget(14, 0, knife_label); + ui->weapon_table->setCellWidget(14, 1, knife_kills_label); + /* mac10 */ + QLabel *mac10_label = new QLabel(this); + QLabel *mac10_kills_label = new QLabel(this); + QPixmap mac10(":/weapons/weapons/mac10.png"); + mac10_label->setPixmap(mac10.scaled(w / 2, h)); + user.mac10_kills = parse.parse_csgo_data("total_kills_mac10"); + QString mac10_kills_text = user.mac10_kills + " kills"; + mac10_kills_label->setText(mac10_kills_text); + ui->weapon_table->setCellWidget(15, 0, mac10_label); + ui->weapon_table->setCellWidget(15, 1, mac10_kills_label); + /* mag7 */ + QLabel *mag7_label = new QLabel(this); + QLabel *mag7_kills_label = new QLabel(this); + QPixmap mag7(":/weapons/weapons/mag7.png"); + mag7_label->setPixmap(mag7.scaled(w, h)); + user.mag7_kills = parse.parse_csgo_data("total_kills_mag7"); + QString mag7_kills_text = user.mag7_kills + " kills"; + mag7_kills_label->setText(mag7_kills_text); + ui->weapon_table->setCellWidget(16, 0, mag7_label); + ui->weapon_table->setCellWidget(16, 1, mag7_kills_label); + /* mp7 */ + QLabel *mp7_label = new QLabel(this); + QLabel *mp7_kills_label = new QLabel(this); + QPixmap mp7(":/weapons/weapons/mp7.png"); + mp7_label->setPixmap(mp7.scaled(w / 2, h)); + user.mp7_kills = parse.parse_csgo_data("total_kills_mp7"); + QString mp7_kills_text = user.mp7_kills + " kills"; + mp7_kills_label->setText(mp7_kills_text); + ui->weapon_table->setCellWidget(17, 0, mp7_label); + ui->weapon_table->setCellWidget(17, 1, mp7_kills_label); + /* negev */ + QLabel *negev_label = new QLabel(this); + QLabel *negev_kills_label = new QLabel(this); + QPixmap negev(":/weapons/weapons/negev.png"); + negev_label->setPixmap(negev.scaled(w, h)); + user.negev_kills = parse.parse_csgo_data("total_kills_negev"); + QString negev_kills_text = user.negev_kills + " kills"; + negev_kills_label->setText(negev_kills_text); + ui->weapon_table->setCellWidget(18, 0, negev_label); + ui->weapon_table->setCellWidget(18, 1, negev_kills_label); + /* nova */ + QLabel *nova_label = new QLabel(this); + QLabel *nova_kills_label = new QLabel(this); + QPixmap nova(":/weapons/weapons/nova.png"); + nova_label->setPixmap(nova.scaled(w, h)); + user.nova_kills = parse.parse_csgo_data("total_kills_nova"); + QString nova_kills_text = user.nova_kills + " kills"; + nova_kills_label->setText(nova_kills_text); + ui->weapon_table->setCellWidget(19, 0, nova_label); + ui->weapon_table->setCellWidget(19, 1, nova_kills_label); + /* p250 */ + QLabel *p250_label = new QLabel(this); + QLabel *p250_kills_label = new QLabel(this); + QPixmap p250(":/weapons/weapons/p250.png"); + p250_label->setPixmap(p250.scaled(w / 2, h)); + user.p250_kills = parse.parse_csgo_data("total_kills_p250"); + QString p250_kills_text = user.p250_kills + " kills"; + p250_kills_label->setText(p250_kills_text); + ui->weapon_table->setCellWidget(20, 0, p250_label); + ui->weapon_table->setCellWidget(20, 1, p250_kills_label); + /* p90 */ + QLabel *p90_label = new QLabel(this); + QLabel *p90_kills_label = new QLabel(this); + QPixmap p90(":/weapons/weapons/p90.png"); + p90_label->setPixmap(p90.scaled(w, h)); + user.p90_kills = parse.parse_csgo_data("total_kills_p90"); + QString p90_kills_text = user.p90_kills + " kills"; + p90_kills_label->setText(p90_kills_text); + ui->weapon_table->setCellWidget(21, 0, p90_label); + ui->weapon_table->setCellWidget(21, 1, p90_kills_label); + /* sawedoff */ + QLabel *sawedoff_label = new QLabel(this); + QLabel *sawedoff_kills_label = new QLabel(this); + QPixmap sawedoff(":/weapons/weapons/sawedoff.png"); + sawedoff_label->setPixmap(sawedoff.scaled(w, h)); + user.sawedoff_kills = parse.parse_csgo_data("total_kills_sawedoff"); + QString sawedoff_kills_text = user.sawedoff_kills + " kills"; + sawedoff_kills_label->setText(sawedoff_kills_text); + ui->weapon_table->setCellWidget(22, 0, sawedoff_label); + ui->weapon_table->setCellWidget(22, 1, sawedoff_kills_label); + /* scar20 */ + QLabel *scar20_label = new QLabel(this); + QLabel *scar20_kills_label = new QLabel(this); + QPixmap scar20(":/weapons/weapons/scar20.png"); + scar20_label->setPixmap(scar20.scaled(w, h)); + user.scar20_kills = parse.parse_csgo_data("total_kills_scar20"); + QString scar20_kills_text = user.scar20_kills + " kills"; + scar20_kills_label->setText(scar20_kills_text); + ui->weapon_table->setCellWidget(23, 0, scar20_label); + ui->weapon_table->setCellWidget(23, 1, scar20_kills_label); + /* sg556 */ + QLabel *sg556_label = new QLabel(this); + QLabel *sg556_kills_label = new QLabel(this); + QPixmap sg556(":/weapons/weapons/sg556.png"); + sg556_label->setPixmap(sg556.scaled(w, h)); + user.sg556_kills = parse.parse_csgo_data("total_kills_sg556"); + QString sg556_kills_text = user.sg556_kills + " kills"; + sg556_kills_label->setText(sg556_kills_text); + ui->weapon_table->setCellWidget(24, 0, sg556_label); + ui->weapon_table->setCellWidget(24, 1, sg556_kills_label); + /* ssg08 */ + QLabel *ssg08_label = new QLabel(this); + QLabel *ssg08_kills_label = new QLabel(this); + QPixmap ssg08(":/weapons/weapons/ssg08.png"); + ssg08_label->setPixmap(ssg08.scaled(w, h)); + user.ssg08_kills = parse.parse_csgo_data("total_kills_ssg08"); + QString ssg08_kills_text = user.ssg08_kills + " kills"; + ssg08_kills_label->setText(ssg08_kills_text); + ui->weapon_table->setCellWidget(25, 0, ssg08_label); + ui->weapon_table->setCellWidget(25, 1, ssg08_kills_label); + /* tec9 */ + QLabel *tec9_label = new QLabel(this); + QLabel *tec9_kills_label = new QLabel(this); + QPixmap tec9(":/weapons/weapons/tec9.png"); + tec9_label->setPixmap(tec9.scaled(w / 2, h)); + user.tec9_kills = parse.parse_csgo_data("total_kills_tec9"); + QString tec9_kills_text = user.tec9_kills + " kills"; + tec9_kills_label->setText(tec9_kills_text); + ui->weapon_table->setCellWidget(26, 0, tec9_label); + ui->weapon_table->setCellWidget(26, 1, tec9_kills_label); + /* ump45 */ + QLabel *ump45_label = new QLabel(this); + QLabel *ump45_kills_label = new QLabel(this); + QPixmap ump45(":/weapons/weapons/ump45.png"); + ump45_label->setPixmap(ump45.scaled(w, h)); + user.ump45_kills = parse.parse_csgo_data("total_kills_ump45"); + QString ump45_kills_text = user.ump45_kills + " kills"; + ump45_kills_label->setText(ump45_kills_text); + ui->weapon_table->setCellWidget(27, 0, ump45_label); + ui->weapon_table->setCellWidget(27, 1, ump45_kills_label); + /* xm1014 */ + QLabel *xm1014_label = new QLabel(this); + QLabel *xm1014_kills_label = new QLabel(this); + QPixmap xm1014(":/weapons/weapons/xm1014.png"); + xm1014_label->setPixmap(xm1014.scaled(w, h)); + user.xm1014_kills = parse.parse_csgo_data("total_kills_xm1014"); + QString xm1014_kills_text = user.xm1014_kills + " kills"; + xm1014_kills_label->setText(xm1014_kills_text); + ui->weapon_table->setCellWidget(28, 0, xm1014_label); + ui->weapon_table->setCellWidget(28, 1, xm1014_kills_label); +} + +void stats_display_window::reload_profile() +{ + /* a hacky function that refreshes stats displayed */ + qDebug() << "Attempting to download user data"; + QString file_loc = "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=FEBFDE46520663091143F867FEE39BFF&steamids=" + user.user_64id; + int success = download.download_file(file_loc, "userdata.dat"); + if (success == 1) + { + qDebug() << "Attempting to download cs:go data"; + file_loc = "http://api.steampowered.com/ISteamUserStats/GetUserStatsForGame/v0002/?appid=730&key=FEBFDE46520663091143F867FEE39BFF&steamid=" + user.user_64id; + success = download.download_file(file_loc, "csgodata.dat"); + } + if (success == 1) + { + window_open(); + qDebug() << "User data and CS:GO stats refreshed"; /* file could be ANYTHING or empty! */ + } + else + { + qDebug() << "Failed"; + } +} + +void stats_display_window::showEvent(QShowEvent *ev) +{ + emit window_loaded(); +} + +void stats_display_window::window_open() +{ + /* + * this slot is called when our stats window is opened + * we will call our user setup function + * we will then call our csgo data setup function + */ + setup_user(); + setup_csgo_data(); +} + +void stats_display_window::on_refresh_button_clicked() +{ + reload_profile(); +} + +void stats_display_window::on_new_id_button_clicked() +{ + user.user_64id = ui->new_steam_id->text(); + reload_profile(); } diff --git a/stats_display_window.h b/stats_display_window.h index d73f6ca..2784e6f 100644 --- a/stats_display_window.h +++ b/stats_display_window.h @@ -24,13 +24,49 @@ public: private: Ui::stats_display_window *ui; - - struct user_info { /* contains our user data for both steam and csgo */ + void setup_user(); + void setup_csgo_data(); + void reload_profile(); + struct user_info { + /* contains our user data for both steam and csgo */ QString username; QString realname; QString avatar_url; + QString user_64id; QString status; QString time_ingame; + QString mvp_count; + /* weapon stats */ + QString ak47_kills; + QString deagle_kills; + QString m4_kills; + QString awp_kills; + QString aug_kills; + QString bizon_kills; + QString elite_kills; + QString famas_kills; + QString fiveseven_kills; + QString g3sg1_kills; + QString galilar_kills; + QString glock_kills; + QString hegrenade_kills; + QString hkp2000_kills; + QString knife_kills; + QString m249_kills; + QString mac10_kills; + QString mag7_kills; + QString mp7_kills; + QString negev_kills; + QString nova_kills; + QString p250_kills; + QString p90_kills; + QString sawedoff_kills; + QString scar20_kills; + QString sg556_kills; + QString ssg08_kills; + QString tec9_kills; + QString ump45_kills; + QString xm1014_kills; } user; file_download download; @@ -40,6 +76,8 @@ signals: private slots: void window_open(); + void on_refresh_button_clicked(); + void on_new_id_button_clicked(); }; #endif // STATS_DISPLAY_WINDOW_H diff --git a/stats_display_window.ui b/stats_display_window.ui index ca16129..dcbace5 100644 --- a/stats_display_window.ui +++ b/stats_display_window.ui @@ -9,54 +9,166 @@ 0 0 - 104 - 112 + 416 + 402 CS:GO Statistics - - - + + + - status + refresh - - - - - Arial [Mono] - 14 - 75 - true - - - - username + + + + New steam account ID here - - - avatar - - + + + + + avatar + + + + + + + + Arial [Mono] + 14 + 75 + true + + + + username + + + + + + + realname + + + + + + + status + + + + + + + MVP_IMAGE + + + + + + + Time in CS:GO + + + + + + + MVPs + + + + - - - - realname - - + + + + + + + + + 0 + 0 + + + + <html><head/><body><p><span style=" font-size:16pt;">Weapon Statistics</span></p></body></html> + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 0 + 0 + + + + QFrame::Panel + + + QAbstractScrollArea::AdjustToContents + + + false + + + false + + + false + + + false + + + false + + + 100 + + + false + + + 50 + + + + + + - + - Time in CS:GO + New ID diff --git a/user_select_dialog.cpp b/user_select_dialog.cpp index 81c40f4..6a6f4b2 100644 --- a/user_select_dialog.cpp +++ b/user_select_dialog.cpp @@ -16,42 +16,52 @@ user_select_dialog::~user_select_dialog() void user_select_dialog::on_select_account_button_clicked() { /* - * we need to check if the user gave a steam id + * we need to check if the user gave a steam id or selected a user * if they did, proceed */ if (ui->steam_url_text->text() == NULL) { qDebug() << "No profile provided."; } else { - qDebug() << "Profile selected:" << ui->steam_url_text->text(); - ui->close_button->setEnabled(false); - ui->select_account_button->setEnabled(false); - ui->steam_url_text->setEnabled(false); - ui->info_label->setText("Downloading data.."); - /* user data was a last second thought when designing this fucntion, clean it up one day, error checking etc */ - qDebug() << "Attempting to download user data"; - QString file_loc = "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=FEBFDE46520663091143F867FEE39BFF&steamids=" + ui->steam_url_text->text(); - int success = download.download_file(file_loc, "userdata.dat"); - if (success == 1) - { - qDebug() << "Attempting to download cs:go data"; - file_loc = "http://api.steampowered.com/ISteamUserStats/GetUserStatsForGame/v0002/?appid=730&key=FEBFDE46520663091143F867FEE39BFF&steamid=" + ui->steam_url_text->text(); - success = download.download_file(file_loc, "csgodata.dat"); - } - if (success == 1) - { - qDebug() << "Downloaded everything"; /* file could be ANYTHING or empty! */ - n_window.show(); - this->hide(); - } - else - { - qDebug() << "Failed"; - ui->close_button->setEnabled(true); - ui->select_account_button->setEnabled(true); - ui->steam_url_text->setEnabled(true); - ui->info_label->setText("Failed to download, try again."); - } + download_info(); + } +} +void user_select_dialog::download_info() +{ + qDebug() << "Profile selected:" << ui->steam_url_text->text(); + ui->close_button->setEnabled(false); + ui->select_account_button->setEnabled(false); + ui->steam_url_text->setEnabled(false); + ui->player_dropdown->setEnabled(false); + ui->info_label->setText("Downloading data.."); + /* user data was a last second thought when designing this fucntion, clean it up one day, error checking etc */ + qDebug() << "Attempting to download user data"; + QString file_loc = "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=FEBFDE46520663091143F867FEE39BFF&steamids=" + ui->steam_url_text->text(); + int success = download.download_file(file_loc, "userdata.dat"); + if (success == 1) + { + qDebug() << "Attempting to download cs:go data"; + file_loc = "http://api.steampowered.com/ISteamUserStats/GetUserStatsForGame/v0002/?appid=730&key=FEBFDE46520663091143F867FEE39BFF&steamid=" + ui->steam_url_text->text(); + success = download.download_file(file_loc, "csgodata.dat"); + } + if (success == 1) + { + qDebug() << "Downloaded everything"; /* file could be ANYTHING or empty! */ + n_window.show(); + this->hide(); } + else + { + qDebug() << "Failed"; + ui->close_button->setEnabled(true); + ui->select_account_button->setEnabled(true); + ui->steam_url_text->setEnabled(true); + ui->info_label->setText("Failed to download, try again."); + } +} + +void user_select_dialog::load_players() +{ + } diff --git a/user_select_dialog.h b/user_select_dialog.h index 98b3503..3420bad 100644 --- a/user_select_dialog.h +++ b/user_select_dialog.h @@ -25,6 +25,8 @@ private: Ui::user_select_dialog *ui; file_download download; stats_display_window n_window; + void download_info(); + void load_players(); }; #endif // USER_SELECT_DIALOG_H diff --git a/user_select_dialog.ui b/user_select_dialog.ui index 75a5e7d..f435425 100644 --- a/user_select_dialog.ui +++ b/user_select_dialog.ui @@ -9,8 +9,8 @@ 0 0 - 181 - 115 + 269 + 138 @@ -19,32 +19,39 @@ - - - Enter a Steam account ID - - - - - - - 76561198055087665 - - - - - - - Select - - - - - - - Close - - + + + + + Close + + + + + + + Enter a Steam account ID or select a user + + + + + + + 76561198055087665 + + + + + + + Select + + + + + + + @@ -59,12 +66,12 @@ close() - 348 - 403 + 259 + 128 - 418 - 566 + 268 + 110 diff --git a/weapons/ak47.png b/weapons/ak47.png new file mode 100644 index 0000000..2f42900 Binary files /dev/null and b/weapons/ak47.png differ diff --git a/weapons/aug.png b/weapons/aug.png new file mode 100644 index 0000000..dc36dc8 Binary files /dev/null and b/weapons/aug.png differ diff --git a/weapons/awp.png b/weapons/awp.png new file mode 100644 index 0000000..35f7218 Binary files /dev/null and b/weapons/awp.png differ diff --git a/weapons/bizon.png b/weapons/bizon.png new file mode 100644 index 0000000..2c6787b Binary files /dev/null and b/weapons/bizon.png differ diff --git a/weapons/deagle.png b/weapons/deagle.png new file mode 100644 index 0000000..7242a50 Binary files /dev/null and b/weapons/deagle.png differ diff --git a/weapons/elite.png b/weapons/elite.png new file mode 100644 index 0000000..ad54d7b Binary files /dev/null and b/weapons/elite.png differ diff --git a/weapons/famas.png b/weapons/famas.png new file mode 100644 index 0000000..5765214 Binary files /dev/null and b/weapons/famas.png differ diff --git a/weapons/fiveseven.png b/weapons/fiveseven.png new file mode 100644 index 0000000..fc686b9 Binary files /dev/null and b/weapons/fiveseven.png differ diff --git a/weapons/g3sg1.png b/weapons/g3sg1.png new file mode 100644 index 0000000..74fdb23 Binary files /dev/null and b/weapons/g3sg1.png differ diff --git a/weapons/galilar.png b/weapons/galilar.png new file mode 100644 index 0000000..1ef8a5c Binary files /dev/null and b/weapons/galilar.png differ diff --git a/weapons/glock.png b/weapons/glock.png new file mode 100644 index 0000000..5cebb4a Binary files /dev/null and b/weapons/glock.png differ diff --git a/weapons/hegrenade.png b/weapons/hegrenade.png new file mode 100644 index 0000000..ad175be Binary files /dev/null and b/weapons/hegrenade.png differ diff --git a/weapons/hkp2000.png b/weapons/hkp2000.png new file mode 100644 index 0000000..6891efa Binary files /dev/null and b/weapons/hkp2000.png differ diff --git a/weapons/knife.png b/weapons/knife.png new file mode 100644 index 0000000..f614ed7 Binary files /dev/null and b/weapons/knife.png differ diff --git a/weapons/m249.png b/weapons/m249.png new file mode 100644 index 0000000..6095922 Binary files /dev/null and b/weapons/m249.png differ diff --git a/weapons/m4.png b/weapons/m4.png new file mode 100644 index 0000000..2fe2db7 Binary files /dev/null and b/weapons/m4.png differ diff --git a/weapons/mac10.png b/weapons/mac10.png new file mode 100644 index 0000000..d05c3c2 Binary files /dev/null and b/weapons/mac10.png differ diff --git a/weapons/mag7.png b/weapons/mag7.png new file mode 100644 index 0000000..5fa1541 Binary files /dev/null and b/weapons/mag7.png differ diff --git a/weapons/mp7.png b/weapons/mp7.png new file mode 100644 index 0000000..4bbf199 Binary files /dev/null and b/weapons/mp7.png differ diff --git a/weapons/negev.png b/weapons/negev.png new file mode 100644 index 0000000..3dc15dc Binary files /dev/null and b/weapons/negev.png differ diff --git a/weapons/nova.png b/weapons/nova.png new file mode 100644 index 0000000..c85a1d5 Binary files /dev/null and b/weapons/nova.png differ diff --git a/weapons/p250.png b/weapons/p250.png new file mode 100644 index 0000000..1013168 Binary files /dev/null and b/weapons/p250.png differ diff --git a/weapons/p90.png b/weapons/p90.png new file mode 100644 index 0000000..6eceaa3 Binary files /dev/null and b/weapons/p90.png differ diff --git a/weapons/sawedoff.png b/weapons/sawedoff.png new file mode 100644 index 0000000..4335ef5 Binary files /dev/null and b/weapons/sawedoff.png differ diff --git a/weapons/scar20.png b/weapons/scar20.png new file mode 100644 index 0000000..1cda9f9 Binary files /dev/null and b/weapons/scar20.png differ diff --git a/weapons/sg556.png b/weapons/sg556.png new file mode 100644 index 0000000..b777b98 Binary files /dev/null and b/weapons/sg556.png differ diff --git a/weapons/ssg08.png b/weapons/ssg08.png new file mode 100644 index 0000000..1992ef1 Binary files /dev/null and b/weapons/ssg08.png differ diff --git a/weapons/tec9.png b/weapons/tec9.png new file mode 100644 index 0000000..a3f2717 Binary files /dev/null and b/weapons/tec9.png differ diff --git a/weapons/ump45.png b/weapons/ump45.png new file mode 100644 index 0000000..9e3ede9 Binary files /dev/null and b/weapons/ump45.png differ diff --git a/weapons/xm1014.png b/weapons/xm1014.png new file mode 100644 index 0000000..fc41286 Binary files /dev/null and b/weapons/xm1014.png differ -- cgit v1.2.3