summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--csgo_images.qrc38
-rw-r--r--csgo_stats.pro3
-rw-r--r--icons/avatar.jpgbin0 -> 3761 bytes
-rw-r--r--icons/mvp.pngbin0 -> 55680 bytes
-rw-r--r--stats_display_window.cpp386
-rw-r--r--stats_display_window.h42
-rw-r--r--stats_display_window.ui174
-rw-r--r--user_select_dialog.cpp70
-rw-r--r--user_select_dialog.h2
-rw-r--r--user_select_dialog.ui71
-rw-r--r--weapons/ak47.pngbin0 -> 13352 bytes
-rw-r--r--weapons/aug.pngbin0 -> 13048 bytes
-rw-r--r--weapons/awp.pngbin0 -> 9509 bytes
-rw-r--r--weapons/bizon.pngbin0 -> 16292 bytes
-rw-r--r--weapons/deagle.pngbin0 -> 11812 bytes
-rw-r--r--weapons/elite.pngbin0 -> 19207 bytes
-rw-r--r--weapons/famas.pngbin0 -> 13738 bytes
-rw-r--r--weapons/fiveseven.pngbin0 -> 10752 bytes
-rw-r--r--weapons/g3sg1.pngbin0 -> 11262 bytes
-rw-r--r--weapons/galilar.pngbin0 -> 13944 bytes
-rw-r--r--weapons/glock.pngbin0 -> 8708 bytes
-rw-r--r--weapons/hegrenade.pngbin0 -> 9162 bytes
-rw-r--r--weapons/hkp2000.pngbin0 -> 8376 bytes
-rw-r--r--weapons/knife.pngbin0 -> 34170 bytes
-rw-r--r--weapons/m249.pngbin0 -> 15132 bytes
-rw-r--r--weapons/m4.pngbin0 -> 14944 bytes
-rw-r--r--weapons/mac10.pngbin0 -> 10180 bytes
-rw-r--r--weapons/mag7.pngbin0 -> 8815 bytes
-rw-r--r--weapons/mp7.pngbin0 -> 10298 bytes
-rw-r--r--weapons/negev.pngbin0 -> 15850 bytes
-rw-r--r--weapons/nova.pngbin0 -> 10379 bytes
-rw-r--r--weapons/p250.pngbin0 -> 11730 bytes
-rw-r--r--weapons/p90.pngbin0 -> 16426 bytes
-rw-r--r--weapons/sawedoff.pngbin0 -> 7111 bytes
-rw-r--r--weapons/scar20.pngbin0 -> 12024 bytes
-rw-r--r--weapons/sg556.pngbin0 -> 14664 bytes
-rw-r--r--weapons/ssg08.pngbin0 -> 12112 bytes
-rw-r--r--weapons/tec9.pngbin0 -> 9724 bytes
-rw-r--r--weapons/ump45.pngbin0 -> 12000 bytes
-rw-r--r--weapons/xm1014.pngbin0 -> 11950 bytes
40 files changed, 677 insertions, 109 deletions
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 @@
+<RCC>
+ <qresource prefix="/icons">
+ <file>icons/mvp.png</file>
+ <file>icons/avatar.jpg</file>
+ </qresource>
+ <qresource prefix="/weapons">
+ <file>weapons/ak47.png</file>
+ <file>weapons/aug.png</file>
+ <file>weapons/awp.png</file>
+ <file>weapons/bizon.png</file>
+ <file>weapons/deagle.png</file>
+ <file>weapons/elite.png</file>
+ <file>weapons/famas.png</file>
+ <file>weapons/fiveseven.png</file>
+ <file>weapons/g3sg1.png</file>
+ <file>weapons/galilar.png</file>
+ <file>weapons/glock.png</file>
+ <file>weapons/hegrenade.png</file>
+ <file>weapons/hkp2000.png</file>
+ <file>weapons/knife.png</file>
+ <file>weapons/m4.png</file>
+ <file>weapons/m249.png</file>
+ <file>weapons/mac10.png</file>
+ <file>weapons/mag7.png</file>
+ <file>weapons/mp7.png</file>
+ <file>weapons/negev.png</file>
+ <file>weapons/nova.png</file>
+ <file>weapons/p90.png</file>
+ <file>weapons/p250.png</file>
+ <file>weapons/sawedoff.png</file>
+ <file>weapons/scar20.png</file>
+ <file>weapons/sg556.png</file>
+ <file>weapons/ssg08.png</file>
+ <file>weapons/tec9.png</file>
+ <file>weapons/ump45.png</file>
+ <file>weapons/xm1014.png</file>
+ </qresource>
+</RCC>
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
--- /dev/null
+++ b/icons/avatar.jpg
Binary files differ
diff --git a/icons/mvp.png b/icons/mvp.png
new file mode 100644
index 0000000..7eb6779
--- /dev/null
+++ b/icons/mvp.png
Binary files 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 @@
<rect>
<x>0</x>
<y>0</y>
- <width>104</width>
- <height>112</height>
+ <width>416</width>
+ <height>402</height>
</rect>
</property>
<property name="windowTitle">
<string>CS:GO Statistics</string>
</property>
- <layout class="QGridLayout" name="gridLayout_2">
- <item row="3" column="0">
- <widget class="QLabel" name="status_label">
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="1" column="0">
+ <widget class="QPushButton" name="refresh_button">
<property name="text">
- <string>status</string>
+ <string>refresh</string>
</property>
</widget>
</item>
- <item row="1" column="0">
- <widget class="QLabel" name="username_label">
- <property name="font">
- <font>
- <family>Arial [Mono]</family>
- <pointsize>14</pointsize>
- <weight>75</weight>
- <bold>true</bold>
- </font>
- </property>
- <property name="text">
- <string>username</string>
+ <item row="4" column="1">
+ <widget class="QLineEdit" name="new_steam_id">
+ <property name="placeholderText">
+ <string>New steam account ID here</string>
</property>
</widget>
</item>
<item row="0" column="0">
- <widget class="QLabel" name="avatar_label">
- <property name="text">
- <string>avatar</string>
- </property>
- </widget>
+ <layout class="QFormLayout" name="stats_layout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="avatar_label">
+ <property name="text">
+ <string>avatar</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="username_label">
+ <property name="font">
+ <font>
+ <family>Arial [Mono]</family>
+ <pointsize>14</pointsize>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>username</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="realname_label">
+ <property name="text">
+ <string>realname</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="status_label">
+ <property name="text">
+ <string>status</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0">
+ <widget class="QLabel" name="mvp_label">
+ <property name="text">
+ <string>MVP_IMAGE</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <widget class="QLabel" name="time_in_label">
+ <property name="text">
+ <string>Time in CS:GO</string>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="0">
+ <widget class="QLabel" name="mvp_number_label">
+ <property name="text">
+ <string>MVPs</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
- <item row="2" column="0">
- <widget class="QLabel" name="realname_label">
- <property name="text">
- <string>realname</string>
- </property>
- </widget>
+ <item row="0" column="1">
+ <layout class="QGridLayout" name="base_grid">
+ <item row="0" column="0">
+ <layout class="QFormLayout" name="weapons_layout">
+ <item row="1" column="0">
+ <widget class="QLabel" name="weapon_stats_label">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:16pt;&quot;&gt;Weapon Statistics&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0">
+ <widget class="QTableWidget" name="weapon_table">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="baseSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::Panel</enum>
+ </property>
+ <property name="sizeAdjustPolicy">
+ <enum>QAbstractScrollArea::AdjustToContents</enum>
+ </property>
+ <property name="tabKeyNavigation">
+ <bool>false</bool>
+ </property>
+ <property name="showDropIndicator" stdset="0">
+ <bool>false</bool>
+ </property>
+ <property name="showGrid">
+ <bool>false</bool>
+ </property>
+ <property name="cornerButtonEnabled">
+ <bool>false</bool>
+ </property>
+ <attribute name="horizontalHeaderVisible">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="horizontalHeaderDefaultSectionSize">
+ <number>100</number>
+ </attribute>
+ <attribute name="verticalHeaderVisible">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="verticalHeaderDefaultSectionSize">
+ <number>50</number>
+ </attribute>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
</item>
<item row="4" column="0">
- <widget class="QLabel" name="time_in_label">
+ <widget class="QPushButton" name="new_id_button">
<property name="text">
- <string>Time in CS:GO</string>
+ <string>New ID</string>
</property>
</widget>
</item>
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 @@
<rect>
<x>0</x>
<y>0</y>
- <width>181</width>
- <height>115</height>
+ <width>269</width>
+ <height>138</height>
</rect>
</property>
<property name="windowTitle">
@@ -19,32 +19,39 @@
<widget class="QWidget" name="centralWidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
- <widget class="QLabel" name="info_label">
- <property name="text">
- <string>Enter a Steam account ID</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLineEdit" name="steam_url_text">
- <property name="text">
- <string>76561198055087665</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="select_account_button">
- <property name="text">
- <string>Select</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="close_button">
- <property name="text">
- <string>Close</string>
- </property>
- </widget>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="5" column="0">
+ <widget class="QPushButton" name="close_button">
+ <property name="text">
+ <string>Close</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="info_label">
+ <property name="text">
+ <string>Enter a Steam account ID or select a user</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLineEdit" name="steam_url_text">
+ <property name="text">
+ <string>76561198055087665</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <widget class="QPushButton" name="select_account_button">
+ <property name="text">
+ <string>Select</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QComboBox" name="player_dropdown"/>
+ </item>
+ </layout>
</item>
</layout>
</widget>
@@ -59,12 +66,12 @@
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
- <x>348</x>
- <y>403</y>
+ <x>259</x>
+ <y>128</y>
</hint>
<hint type="destinationlabel">
- <x>418</x>
- <y>566</y>
+ <x>268</x>
+ <y>110</y>
</hint>
</hints>
</connection>
diff --git a/weapons/ak47.png b/weapons/ak47.png
new file mode 100644
index 0000000..2f42900
--- /dev/null
+++ b/weapons/ak47.png
Binary files differ
diff --git a/weapons/aug.png b/weapons/aug.png
new file mode 100644
index 0000000..dc36dc8
--- /dev/null
+++ b/weapons/aug.png
Binary files differ
diff --git a/weapons/awp.png b/weapons/awp.png
new file mode 100644
index 0000000..35f7218
--- /dev/null
+++ b/weapons/awp.png
Binary files differ
diff --git a/weapons/bizon.png b/weapons/bizon.png
new file mode 100644
index 0000000..2c6787b
--- /dev/null
+++ b/weapons/bizon.png
Binary files differ
diff --git a/weapons/deagle.png b/weapons/deagle.png
new file mode 100644
index 0000000..7242a50
--- /dev/null
+++ b/weapons/deagle.png
Binary files differ
diff --git a/weapons/elite.png b/weapons/elite.png
new file mode 100644
index 0000000..ad54d7b
--- /dev/null
+++ b/weapons/elite.png
Binary files differ
diff --git a/weapons/famas.png b/weapons/famas.png
new file mode 100644
index 0000000..5765214
--- /dev/null
+++ b/weapons/famas.png
Binary files differ
diff --git a/weapons/fiveseven.png b/weapons/fiveseven.png
new file mode 100644
index 0000000..fc686b9
--- /dev/null
+++ b/weapons/fiveseven.png
Binary files differ
diff --git a/weapons/g3sg1.png b/weapons/g3sg1.png
new file mode 100644
index 0000000..74fdb23
--- /dev/null
+++ b/weapons/g3sg1.png
Binary files differ
diff --git a/weapons/galilar.png b/weapons/galilar.png
new file mode 100644
index 0000000..1ef8a5c
--- /dev/null
+++ b/weapons/galilar.png
Binary files differ
diff --git a/weapons/glock.png b/weapons/glock.png
new file mode 100644
index 0000000..5cebb4a
--- /dev/null
+++ b/weapons/glock.png
Binary files differ
diff --git a/weapons/hegrenade.png b/weapons/hegrenade.png
new file mode 100644
index 0000000..ad175be
--- /dev/null
+++ b/weapons/hegrenade.png
Binary files differ
diff --git a/weapons/hkp2000.png b/weapons/hkp2000.png
new file mode 100644
index 0000000..6891efa
--- /dev/null
+++ b/weapons/hkp2000.png
Binary files differ
diff --git a/weapons/knife.png b/weapons/knife.png
new file mode 100644
index 0000000..f614ed7
--- /dev/null
+++ b/weapons/knife.png
Binary files differ
diff --git a/weapons/m249.png b/weapons/m249.png
new file mode 100644
index 0000000..6095922
--- /dev/null
+++ b/weapons/m249.png
Binary files differ
diff --git a/weapons/m4.png b/weapons/m4.png
new file mode 100644
index 0000000..2fe2db7
--- /dev/null
+++ b/weapons/m4.png
Binary files differ
diff --git a/weapons/mac10.png b/weapons/mac10.png
new file mode 100644
index 0000000..d05c3c2
--- /dev/null
+++ b/weapons/mac10.png
Binary files differ
diff --git a/weapons/mag7.png b/weapons/mag7.png
new file mode 100644
index 0000000..5fa1541
--- /dev/null
+++ b/weapons/mag7.png
Binary files differ
diff --git a/weapons/mp7.png b/weapons/mp7.png
new file mode 100644
index 0000000..4bbf199
--- /dev/null
+++ b/weapons/mp7.png
Binary files differ
diff --git a/weapons/negev.png b/weapons/negev.png
new file mode 100644
index 0000000..3dc15dc
--- /dev/null
+++ b/weapons/negev.png
Binary files differ
diff --git a/weapons/nova.png b/weapons/nova.png
new file mode 100644
index 0000000..c85a1d5
--- /dev/null
+++ b/weapons/nova.png
Binary files differ
diff --git a/weapons/p250.png b/weapons/p250.png
new file mode 100644
index 0000000..1013168
--- /dev/null
+++ b/weapons/p250.png
Binary files differ
diff --git a/weapons/p90.png b/weapons/p90.png
new file mode 100644
index 0000000..6eceaa3
--- /dev/null
+++ b/weapons/p90.png
Binary files differ
diff --git a/weapons/sawedoff.png b/weapons/sawedoff.png
new file mode 100644
index 0000000..4335ef5
--- /dev/null
+++ b/weapons/sawedoff.png
Binary files differ
diff --git a/weapons/scar20.png b/weapons/scar20.png
new file mode 100644
index 0000000..1cda9f9
--- /dev/null
+++ b/weapons/scar20.png
Binary files differ
diff --git a/weapons/sg556.png b/weapons/sg556.png
new file mode 100644
index 0000000..b777b98
--- /dev/null
+++ b/weapons/sg556.png
Binary files differ
diff --git a/weapons/ssg08.png b/weapons/ssg08.png
new file mode 100644
index 0000000..1992ef1
--- /dev/null
+++ b/weapons/ssg08.png
Binary files differ
diff --git a/weapons/tec9.png b/weapons/tec9.png
new file mode 100644
index 0000000..a3f2717
--- /dev/null
+++ b/weapons/tec9.png
Binary files differ
diff --git a/weapons/ump45.png b/weapons/ump45.png
new file mode 100644
index 0000000..9e3ede9
--- /dev/null
+++ b/weapons/ump45.png
Binary files differ
diff --git a/weapons/xm1014.png b/weapons/xm1014.png
new file mode 100644
index 0000000..fc41286
--- /dev/null
+++ b/weapons/xm1014.png
Binary files differ