summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaniel-Jones <daniel@danieljon.es>2016-08-01 21:57:47 +0930
committerdaniel-Jones <daniel@danieljon.es>2016-08-01 21:59:15 +0930
commitca548026050c9643c82640cb46926545c2114949 (patch)
treee967b23dd94cff4914a71459c7877687bd13bb1e
parent58cc302ca32c807b1fd238dfc5149ff847c0c454 (diff)
downloadcsgo_stats-ca548026050c9643c82640cb46926545c2114949.tar.gz
csgo_stats-ca548026050c9643c82640cb46926545c2114949.zip
Added stats for maps, added a user management tool that will allow you to add/remove user profiles from storage.
-rw-r--r--csgo_images.qrc22
-rw-r--r--csgo_stats.pro9
-rw-r--r--csgo_stats.pro.user17
-rw-r--r--maps/ar_baggage.pngbin0 -> 6639 bytes
-rw-r--r--maps/ar_monastery.pngbin0 -> 19402 bytes
-rw-r--r--maps/ar_shoots.pngbin0 -> 17585 bytes
-rw-r--r--maps/cs_assault.pngbin0 -> 8077 bytes
-rw-r--r--maps/cs_italy.pngbin0 -> 9623 bytes
-rw-r--r--maps/cs_militia.pngbin0 -> 8566 bytes
-rw-r--r--maps/cs_office.pngbin0 -> 8465 bytes
-rw-r--r--maps/de_aztec.pngbin0 -> 6213 bytes
-rw-r--r--maps/de_bank.pngbin0 -> 5895 bytes
-rw-r--r--maps/de_cbble.pngbin0 -> 10061 bytes
-rw-r--r--maps/de_dust.pngbin0 -> 11216 bytes
-rw-r--r--maps/de_dust2.pngbin0 -> 11459 bytes
-rw-r--r--maps/de_inferno.pngbin0 -> 8141 bytes
-rw-r--r--maps/de_lake.pngbin0 -> 6510 bytes
-rw-r--r--maps/de_nuke.pngbin0 -> 11225 bytes
-rw-r--r--maps/de_safehouse.pngbin0 -> 8545 bytes
-rw-r--r--maps/de_stmarc.pngbin0 -> 18850 bytes
-rw-r--r--maps/de_sugarcane.pngbin0 -> 18819 bytes
-rw-r--r--maps/de_train.pngbin0 -> 8467 bytes
-rw-r--r--maps/de_vertigo.pngbin0 -> 20007 bytes
-rw-r--r--maps2/ar_baggage.pngbin0 -> 7039 bytes
-rw-r--r--maps2/ar_monastery.pngbin0 -> 19402 bytes
-rw-r--r--maps2/ar_shoots.pngbin0 -> 17585 bytes
-rw-r--r--maps2/cs_assault.pngbin0 -> 8077 bytes
-rw-r--r--maps2/cs_italy.pngbin0 -> 9623 bytes
-rw-r--r--maps2/cs_militia.pngbin0 -> 12105 bytes
-rw-r--r--maps2/cs_office.pngbin0 -> 10646 bytes
-rw-r--r--maps2/de_aztec.pngbin0 -> 9738 bytes
-rw-r--r--maps2/de_bank.pngbin0 -> 8254 bytes
-rw-r--r--maps2/de_cbble.pngbin0 -> 13422 bytes
-rw-r--r--maps2/de_dust.pngbin0 -> 14797 bytes
-rw-r--r--maps2/de_dust2.pngbin0 -> 15436 bytes
-rw-r--r--maps2/de_inferno.pngbin0 -> 10182 bytes
-rw-r--r--maps2/de_lake.pngbin0 -> 9611 bytes
-rw-r--r--maps2/de_nuke.pngbin0 -> 12909 bytes
-rw-r--r--maps2/de_safehouse.pngbin0 -> 9914 bytes
-rw-r--r--maps2/de_stmarc.pngbin0 -> 18850 bytes
-rw-r--r--maps2/de_sugarcane.pngbin0 -> 18819 bytes
-rw-r--r--maps2/de_train.pngbin0 -> 9698 bytes
-rw-r--r--maps2/de_vertigo.pngbin0 -> 20007 bytes
-rw-r--r--maps2/temp.pngbin0 -> 11416 bytes
-rw-r--r--parse_file.cpp36
-rw-r--r--parse_file.h2
-rw-r--r--stats_display_window.cpp72
-rw-r--r--stats_display_window.h32
-rw-r--r--stats_display_window.ui245
-rw-r--r--user_management.cpp50
-rw-r--r--user_management.h35
-rw-r--r--user_management.ui100
-rw-r--r--user_select_dialog.cpp15
-rw-r--r--user_select_dialog.h6
-rw-r--r--user_select_dialog.ui40
-rw-r--r--weapons/nova.pngbin1154 -> 2851 bytes
-rw-r--r--weapons/sawedoff.pngbin1100 -> 2396 bytes
57 files changed, 544 insertions, 137 deletions
diff --git a/csgo_images.qrc b/csgo_images.qrc
index 968ebef..5ae9dad 100644
--- a/csgo_images.qrc
+++ b/csgo_images.qrc
@@ -61,4 +61,26 @@
<file>weapons/xm1014.png</file>
<file>weapons/m249.png</file>
</qresource>
+ <qresource prefix="/maps">
+ <file>maps/ar_baggage.png</file>
+ <file>maps/ar_monastery.png</file>
+ <file>maps/ar_shoots.png</file>
+ <file>maps/cs_assault.png</file>
+ <file>maps/cs_italy.png</file>
+ <file>maps/cs_militia.png</file>
+ <file>maps/cs_office.png</file>
+ <file>maps/de_aztec.png</file>
+ <file>maps/de_bank.png</file>
+ <file>maps/de_cbble.png</file>
+ <file>maps/de_dust.png</file>
+ <file>maps/de_dust2.png</file>
+ <file>maps/de_inferno.png</file>
+ <file>maps/de_lake.png</file>
+ <file>maps/de_nuke.png</file>
+ <file>maps/de_safehouse.png</file>
+ <file>maps/de_stmarc.png</file>
+ <file>maps/de_sugarcane.png</file>
+ <file>maps/de_train.png</file>
+ <file>maps/de_vertigo.png</file>
+ </qresource>
</RCC>
diff --git a/csgo_stats.pro b/csgo_stats.pro
index dcdd896..bc584ff 100644
--- a/csgo_stats.pro
+++ b/csgo_stats.pro
@@ -16,15 +16,18 @@ SOURCES += main.cpp\
user_select_dialog.cpp \
file_download.cpp \
stats_display_window.cpp \
- parse_file.cpp
+ parse_file.cpp \
+ user_management.cpp
HEADERS += user_select_dialog.h \
file_download.h \
stats_display_window.h \
- parse_file.h
+ parse_file.h \
+ user_management.h
FORMS += user_select_dialog.ui \
- stats_display_window.ui
+ stats_display_window.ui \
+ user_management.ui
RESOURCES += \
csgo_images.qrc
diff --git a/csgo_stats.pro.user b/csgo_stats.pro.user
index 5349ab4..85df869 100644
--- a/csgo_stats.pro.user
+++ b/csgo_stats.pro.user
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
-<!-- Written by QtCreator 4.0.3, 2016-07-21T13:21:40. -->
+<!-- Written by QtCreator 4.0.3, 2016-07-30T08:47:12. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
@@ -300,14 +300,17 @@
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
- <value type="int" key="PE.EnvironmentAspect.Base">-1</value>
+ <value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
- <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value>
- <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable"></value>
- <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">%{buildDir}</value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Custom Executable</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">csgo_stats</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/daniel_j/programming/c++/csgo_stats/csgo_stats/csgo_stats.pro</value>
+ <value type="bool" key="QmakeProjectManager.QmakeRunConfiguration.UseLibrarySearchPath">true</value>
+ <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
+ <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">csgo_stats.pro</value>
+ <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
+ <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
+ <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">/home/daniel_j/programming/c++/csgo_stats/build-csgo_stats-Desktop-Debug</value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
diff --git a/maps/ar_baggage.png b/maps/ar_baggage.png
new file mode 100644
index 0000000..c33c5e0
--- /dev/null
+++ b/maps/ar_baggage.png
Binary files differ
diff --git a/maps/ar_monastery.png b/maps/ar_monastery.png
new file mode 100644
index 0000000..8954c2c
--- /dev/null
+++ b/maps/ar_monastery.png
Binary files differ
diff --git a/maps/ar_shoots.png b/maps/ar_shoots.png
new file mode 100644
index 0000000..066d04c
--- /dev/null
+++ b/maps/ar_shoots.png
Binary files differ
diff --git a/maps/cs_assault.png b/maps/cs_assault.png
new file mode 100644
index 0000000..7932e05
--- /dev/null
+++ b/maps/cs_assault.png
Binary files differ
diff --git a/maps/cs_italy.png b/maps/cs_italy.png
new file mode 100644
index 0000000..c20a880
--- /dev/null
+++ b/maps/cs_italy.png
Binary files differ
diff --git a/maps/cs_militia.png b/maps/cs_militia.png
new file mode 100644
index 0000000..091be17
--- /dev/null
+++ b/maps/cs_militia.png
Binary files differ
diff --git a/maps/cs_office.png b/maps/cs_office.png
new file mode 100644
index 0000000..451c786
--- /dev/null
+++ b/maps/cs_office.png
Binary files differ
diff --git a/maps/de_aztec.png b/maps/de_aztec.png
new file mode 100644
index 0000000..f824da5
--- /dev/null
+++ b/maps/de_aztec.png
Binary files differ
diff --git a/maps/de_bank.png b/maps/de_bank.png
new file mode 100644
index 0000000..ab54ae1
--- /dev/null
+++ b/maps/de_bank.png
Binary files differ
diff --git a/maps/de_cbble.png b/maps/de_cbble.png
new file mode 100644
index 0000000..6c6ae29
--- /dev/null
+++ b/maps/de_cbble.png
Binary files differ
diff --git a/maps/de_dust.png b/maps/de_dust.png
new file mode 100644
index 0000000..2c3e897
--- /dev/null
+++ b/maps/de_dust.png
Binary files differ
diff --git a/maps/de_dust2.png b/maps/de_dust2.png
new file mode 100644
index 0000000..53b5a9e
--- /dev/null
+++ b/maps/de_dust2.png
Binary files differ
diff --git a/maps/de_inferno.png b/maps/de_inferno.png
new file mode 100644
index 0000000..93a7b5c
--- /dev/null
+++ b/maps/de_inferno.png
Binary files differ
diff --git a/maps/de_lake.png b/maps/de_lake.png
new file mode 100644
index 0000000..9543c72
--- /dev/null
+++ b/maps/de_lake.png
Binary files differ
diff --git a/maps/de_nuke.png b/maps/de_nuke.png
new file mode 100644
index 0000000..ca164d7
--- /dev/null
+++ b/maps/de_nuke.png
Binary files differ
diff --git a/maps/de_safehouse.png b/maps/de_safehouse.png
new file mode 100644
index 0000000..933736e
--- /dev/null
+++ b/maps/de_safehouse.png
Binary files differ
diff --git a/maps/de_stmarc.png b/maps/de_stmarc.png
new file mode 100644
index 0000000..b31af7c
--- /dev/null
+++ b/maps/de_stmarc.png
Binary files differ
diff --git a/maps/de_sugarcane.png b/maps/de_sugarcane.png
new file mode 100644
index 0000000..e15a25a
--- /dev/null
+++ b/maps/de_sugarcane.png
Binary files differ
diff --git a/maps/de_train.png b/maps/de_train.png
new file mode 100644
index 0000000..b50ef19
--- /dev/null
+++ b/maps/de_train.png
Binary files differ
diff --git a/maps/de_vertigo.png b/maps/de_vertigo.png
new file mode 100644
index 0000000..b87f80e
--- /dev/null
+++ b/maps/de_vertigo.png
Binary files differ
diff --git a/maps2/ar_baggage.png b/maps2/ar_baggage.png
new file mode 100644
index 0000000..87049a3
--- /dev/null
+++ b/maps2/ar_baggage.png
Binary files differ
diff --git a/maps2/ar_monastery.png b/maps2/ar_monastery.png
new file mode 100644
index 0000000..8954c2c
--- /dev/null
+++ b/maps2/ar_monastery.png
Binary files differ
diff --git a/maps2/ar_shoots.png b/maps2/ar_shoots.png
new file mode 100644
index 0000000..066d04c
--- /dev/null
+++ b/maps2/ar_shoots.png
Binary files differ
diff --git a/maps2/cs_assault.png b/maps2/cs_assault.png
new file mode 100644
index 0000000..7932e05
--- /dev/null
+++ b/maps2/cs_assault.png
Binary files differ
diff --git a/maps2/cs_italy.png b/maps2/cs_italy.png
new file mode 100644
index 0000000..c20a880
--- /dev/null
+++ b/maps2/cs_italy.png
Binary files differ
diff --git a/maps2/cs_militia.png b/maps2/cs_militia.png
new file mode 100644
index 0000000..871c427
--- /dev/null
+++ b/maps2/cs_militia.png
Binary files differ
diff --git a/maps2/cs_office.png b/maps2/cs_office.png
new file mode 100644
index 0000000..3bb0eac
--- /dev/null
+++ b/maps2/cs_office.png
Binary files differ
diff --git a/maps2/de_aztec.png b/maps2/de_aztec.png
new file mode 100644
index 0000000..2f4b753
--- /dev/null
+++ b/maps2/de_aztec.png
Binary files differ
diff --git a/maps2/de_bank.png b/maps2/de_bank.png
new file mode 100644
index 0000000..738e694
--- /dev/null
+++ b/maps2/de_bank.png
Binary files differ
diff --git a/maps2/de_cbble.png b/maps2/de_cbble.png
new file mode 100644
index 0000000..793eb9e
--- /dev/null
+++ b/maps2/de_cbble.png
Binary files differ
diff --git a/maps2/de_dust.png b/maps2/de_dust.png
new file mode 100644
index 0000000..4a0d85e
--- /dev/null
+++ b/maps2/de_dust.png
Binary files differ
diff --git a/maps2/de_dust2.png b/maps2/de_dust2.png
new file mode 100644
index 0000000..c20138a
--- /dev/null
+++ b/maps2/de_dust2.png
Binary files differ
diff --git a/maps2/de_inferno.png b/maps2/de_inferno.png
new file mode 100644
index 0000000..4d5ba69
--- /dev/null
+++ b/maps2/de_inferno.png
Binary files differ
diff --git a/maps2/de_lake.png b/maps2/de_lake.png
new file mode 100644
index 0000000..2012bd7
--- /dev/null
+++ b/maps2/de_lake.png
Binary files differ
diff --git a/maps2/de_nuke.png b/maps2/de_nuke.png
new file mode 100644
index 0000000..ab38d70
--- /dev/null
+++ b/maps2/de_nuke.png
Binary files differ
diff --git a/maps2/de_safehouse.png b/maps2/de_safehouse.png
new file mode 100644
index 0000000..70de0d8
--- /dev/null
+++ b/maps2/de_safehouse.png
Binary files differ
diff --git a/maps2/de_stmarc.png b/maps2/de_stmarc.png
new file mode 100644
index 0000000..b31af7c
--- /dev/null
+++ b/maps2/de_stmarc.png
Binary files differ
diff --git a/maps2/de_sugarcane.png b/maps2/de_sugarcane.png
new file mode 100644
index 0000000..e15a25a
--- /dev/null
+++ b/maps2/de_sugarcane.png
Binary files differ
diff --git a/maps2/de_train.png b/maps2/de_train.png
new file mode 100644
index 0000000..d16da9a
--- /dev/null
+++ b/maps2/de_train.png
Binary files differ
diff --git a/maps2/de_vertigo.png b/maps2/de_vertigo.png
new file mode 100644
index 0000000..b87f80e
--- /dev/null
+++ b/maps2/de_vertigo.png
Binary files differ
diff --git a/maps2/temp.png b/maps2/temp.png
new file mode 100644
index 0000000..da5bc46
--- /dev/null
+++ b/maps2/temp.png
Binary files differ
diff --git a/parse_file.cpp b/parse_file.cpp
index 2193a04..3d6a078 100644
--- a/parse_file.cpp
+++ b/parse_file.cpp
@@ -91,3 +91,39 @@ QStringList parse_file::get_ids()
{
return userids;
}
+
+void parse_file::delete_user(QString user)
+{
+ /* copy pasta, make pretty */
+ qDebug() << "deleting user" << user;
+ QFile f("users.dat");
+ if(f.open(QIODevice::ReadWrite | QIODevice::Text))
+ {
+ QString s;
+ QTextStream t(&f);
+ while(!t.atEnd())
+ {
+ QString line = t.readLine();
+ if(line != user)
+ s.append(line + "\n");
+ }
+ f.resize(0);
+ t << s;
+ f.close();
+ }
+}
+
+void parse_file::add_user(QString user)
+{
+ qDebug() << "adding user" << user;
+ QFile file("users.dat");
+ if(!file.open(QIODevice::Append)) {
+ qDebug() << "Cannot open file to save";
+
+ } else
+ {
+ QTextStream stream(&file);
+ stream << user;
+ file.close();
+ }
+}
diff --git a/parse_file.h b/parse_file.h
index e12a66f..25b0aa6 100644
--- a/parse_file.h
+++ b/parse_file.h
@@ -15,6 +15,8 @@ public:
QStringList get_ids(); /* returns pre parsed data */
QStringList usernames;
QStringList userids;
+ void delete_user(QString user);
+ void add_user(QString user);
};
#endif // PARSE_FILE_H
diff --git a/stats_display_window.cpp b/stats_display_window.cpp
index 1af8907..577586e 100644
--- a/stats_display_window.cpp
+++ b/stats_display_window.cpp
@@ -68,34 +68,56 @@ void stats_display_window::setup_user()
void stats_display_window::setup_csgo_data()
{
- /* this function populates our data templates and filsl in the UI */
+ /* this function populates our data templates and fills in the UI */
+ /* tables */
ui->weapon_table->setColumnCount(2);
ui->weapon_table->setRowCount(33);
- /* set data in user,weapons */
+ ui->map_table->setColumnCount(2);
+ ui->map_table->setRowCount(20);
+ /*
+ * set data in user.weapons
+ * create a qlabel for each weapon * 2 and set the info
+ */
for (int x = 0; x < 33; x++)
{
+ /* parse stats */
user.weapons[x][2] = parse.parse_csgo_data("total_kills_" + user.weapons[x][0]);
user.weapons[x][3] = parse.parse_csgo_data("total_shots_" + user.weapons[x][0]);
user.weapons[x][4] = parse.parse_csgo_data("total_hits_" + user.weapons[x][0]);
user.weapons[x][5] = QString::number(user.weapons[x][4].toFloat() / user.weapons[x][3].toFloat(), 'f', 2);
+ /* set weapon label */
+ user.weapon_labels << new QLabel(this);
+ user.weapon_labels.at(x)->setTextFormat(Qt::RichText);
+ user.weapon_labels.at(x)->setText("<center><img src=" + user.weapons[x][1] + "> <br /> " + user.weapons[x][0] + " </center>");
+ ui->weapon_table->setCellWidget(x, 0, user.weapon_labels.at(x));
+ /* set weapon stat labels */
+ user.stat_labels << new QLabel(this);
+ user.stat_labels.at(x)->setTextFormat(Qt::RichText);
+ user.stat_labels.at(x)->setText(user.weapons[x][2] + " kills <br />" + user.weapons[x][3] + " shots <br />" + user.weapons[x][4] + " hits <br />" + user.weapons[x][5] + " hit ratio");
+ ui->weapon_table->setCellWidget(x, 1, user.stat_labels.at(x));
}
- /* weapon label/image */
- QList<QLabel *> weapon_labels;
- for (int i = 0; i < 33; ++i)
- {
- weapon_labels << new QLabel(this);
- weapon_labels.at(i)->setTextFormat(Qt::RichText);
- weapon_labels.at(i)->setText("<img src=" + user.weapons[i][1] + "> <br /> <center>" + user.weapons[i][0] + " </center>");
- ui->weapon_table->setCellWidget(i, 0, weapon_labels.at(i));
- }
- /* stats */
- QList<QLabel *> stat_labels;
- for (int i = 0; i < 33; ++i)
+
+ /*
+ * set data in user.maps
+ * create a qlabel for each map * 2 and set the info
+ */
+ for (int x = 0; x < 20; x++)
{
- stat_labels << new QLabel(this);
- stat_labels.at(i)->setTextFormat(Qt::RichText);
- stat_labels.at(i)->setText(user.weapons[i][2] + " kills <br />" + user.weapons[i][3] + " shots <br />" + user.weapons[i][4] + " hits <br />" + user.weapons[i][5] + " hit ratio");
- ui->weapon_table->setCellWidget(i, 1, stat_labels.at(i));
+ /* parse stats */
+ user.maps[x][2] = parse.parse_csgo_data("total_rounds_map_" + user.maps[x][0] + '"');
+ user.maps[x][3] = parse.parse_csgo_data("total_wins_map_" + user.maps[x][0] + '"');
+ user.maps[x][4] = QString::number(user.maps[x][2].toInt() - user.maps[x][3].toInt());
+ user.maps[x][5] = QString::number(user.maps[x][3].toFloat() / user.maps[x][2].toFloat(), 'f', 2);
+ /* set map label */
+ user.map_labels << new QLabel(this);
+ user.map_labels.at(x)->setTextFormat(Qt::RichText);
+ user.map_labels.at(x)->setText("<center><img src=" + user.maps[x][1] + "> <br /> " + user.maps[x][0] + " </center>");
+ ui->map_table->setCellWidget(x, 0, user.map_labels.at(x));
+ /* set map stat labels */
+ user.map_stat_labels << new QLabel(this);
+ user.map_stat_labels.at(x)->setTextFormat(Qt::RichText);
+ user.map_stat_labels.at(x)->setText(user.maps[x][2] + " rounds <br />" + user.maps[x][3] + " won <br />" + user.maps[x][4] + " lost <br />" + user.maps[x][5] + " W/L ratio");
+ ui->map_table->setCellWidget(x, 1, user.map_stat_labels.at(x));
}
/* time played */
@@ -182,9 +204,12 @@ void stats_display_window::on_refresh_button_clicked()
void stats_display_window::on_new_id_button_clicked()
{
- user.user_64id = ui->new_steam_id->text();
- reload_profile();
- load_players();
+ if (ui->new_steam_id->text() != "")
+ {
+ user.user_64id = ui->new_steam_id->text();
+ reload_profile();
+ load_players();
+ }
}
void stats_display_window::on_users_dropdown_currentIndexChanged(int index)
@@ -192,3 +217,8 @@ void stats_display_window::on_users_dropdown_currentIndexChanged(int index)
if (!usernames.isEmpty() && index != -1)
ui->new_steam_id->setText(userids.at(index));
}
+
+void stats_display_window::on_manage_users_button_clicked()
+{
+ manage.show();
+}
diff --git a/stats_display_window.h b/stats_display_window.h
index 971b9ca..7748097 100644
--- a/stats_display_window.h
+++ b/stats_display_window.h
@@ -3,8 +3,10 @@
#include <QWidget>
#include <QDebug>
+#include <QLabel>
#include "file_download.h"
#include "parse_file.h"
+#include "user_management.h"
namespace Ui {
class stats_display_window;
@@ -40,6 +42,31 @@ private:
QString total_kills;
QString total_deaths;
float kd_ratio;
+ QString maps[20][6] = {
+ /* map name | image location | rounds total | rounds win | rounds lost | win percent*/
+ {"cs_assault", ":/maps/maps/cs_assault.png", "", "", ""},
+ {"cs_italy", ":/maps/maps/cs_italy.png", "", "", "", ""},
+ {"cs_office", ":/maps/maps/cs_office.png", "", "", "", ""},
+ {"de_aztec", ":/maps/maps/de_aztec.png", "", "", "", ""},
+ {"de_cbble", ":/maps/maps/de_cbble.png", "", "", "", ""},
+ {"de_dust2", ":/maps/maps/de_dust2.png", "", "", "", ""},
+ {"de_dust", ":/maps/maps/de_dust.png", "", "", "", ""},
+ {"de_inferno", ":/maps/maps/de_inferno.png", "" "", "", ""},
+ {"de_nuke", ":/maps/maps/de_nuke.png", "", "", "", ""},
+ {"de_train", ":/maps/maps/de_train.png", "", "", "", ""},
+ {"de_lake", ":/maps/maps/de_lake.png", "", "", "", ""},
+ {"de_stmarc", ":/maps/maps/de_stmarc.png", "", "", "", ""},
+ {"de_safehouse", ":/maps/maps/de_safehouse.png", "" "", "" , ""},
+ {"ar_baggage", ":/maps/maps/ar_baggage.png", "", "", "", ""},
+ {"ar_shoots", ":/maps/maps/ar_shoots.png", "", "", "", ""},
+ {"de_bank", ":/maps/maps/de_bank.png", "", "", "", ""},
+ {"ar_monas", ":/maps/maps/ar_monastery.png", "" "", "", ""},
+ {"de_vertigo", ":/maps/maps/de_vertigo.png", "", "", "", ""},
+ {"de_sugarcane", ":/maps/maps/de_sugarcane.png", "", "", "", ""},
+ {"cs_militia", ":/maps/maps/cs_militia.png", "", "", "", ""},
+ };
+ QList<QLabel *> map_labels;
+ QList<QLabel *> map_stat_labels;
QString weapons[33][6] = {
/*weapon name | image location | kills | shots | hits | ratio of hits to shots */
{"ak47", ":/weapons/weapons/ak47.png", "0", "0", "0", "0"},
@@ -76,12 +103,14 @@ private:
{"taser", ":/weapons/weapons/taser.png", "0", "0", "0", "0"},
{"molotov", ":/weapons/weapons/molotov.png", "0", "0", "0", "0"},
};
-
+ QList<QLabel *> weapon_labels;
+ QList<QLabel *> stat_labels;
} user;
file_download download;
parse_file parse;
QStringList usernames;
QStringList userids;
+ user_management manage;
signals:
void window_loaded();
@@ -90,6 +119,7 @@ private slots:
void on_refresh_button_clicked();
void on_new_id_button_clicked();
void on_users_dropdown_currentIndexChanged(int index);
+ void on_manage_users_button_clicked();
};
#endif // STATS_DISPLAY_WINDOW_H
diff --git a/stats_display_window.ui b/stats_display_window.ui
index 06e36af..9274368 100644
--- a/stats_display_window.ui
+++ b/stats_display_window.ui
@@ -9,7 +9,7 @@
<rect>
<x>0</x>
<y>0</y>
- <width>416</width>
+ <width>643</width>
<height>402</height>
</rect>
</property>
@@ -17,37 +17,159 @@
<string>CS:GO Statistics</string>
</property>
<layout class="QGridLayout" name="gridLayout">
- <item row="1" column="0">
- <widget class="QPushButton" name="refresh_button">
+ <item row="0" column="2">
+ <layout class="QGridLayout" name="base_grid">
+ <item row="0" column="0">
+ <layout class="QFormLayout" name="stats_layout_contents">
+ <item row="0" column="1">
+ <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="4" column="1">
+ <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::NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Plain</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>true</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="horizontalHeaderHighlightSections">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="horizontalHeaderMinimumSectionSize">
+ <number>15</number>
+ </attribute>
+ <attribute name="verticalHeaderVisible">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="verticalHeaderDefaultSectionSize">
+ <number>70</number>
+ </attribute>
+ <attribute name="verticalHeaderHighlightSections">
+ <bool>false</bool>
+ </attribute>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <widget class="QTableWidget" name="map_table">
+ <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="cornerButtonEnabled">
+ <bool>false</bool>
+ </property>
+ <attribute name="horizontalHeaderVisible">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="horizontalHeaderDefaultSectionSize">
+ <number>100</number>
+ </attribute>
+ <attribute name="horizontalHeaderHighlightSections">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="horizontalHeaderMinimumSectionSize">
+ <number>15</number>
+ </attribute>
+ <attribute name="verticalHeaderVisible">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="verticalHeaderDefaultSectionSize">
+ <number>70</number>
+ </attribute>
+ <attribute name="verticalHeaderHighlightSections">
+ <bool>false</bool>
+ </attribute>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="map_stats_label">
+ <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;Map Statistics&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ <item row="7" column="0">
+ <widget class="QPushButton" name="close_button">
<property name="text">
- <string>refresh</string>
+ <string>Close</string>
</property>
</widget>
</item>
- <item row="6" column="1">
+ <item row="6" column="2">
<widget class="QLineEdit" name="new_steam_id">
<property name="placeholderText">
<string>New Steam account ID here</string>
</property>
</widget>
</item>
- <item row="7" column="0">
- <widget class="QPushButton" name="close_button">
- <property name="text">
- <string>Close</string>
- </property>
- </widget>
+ <item row="1" column="2">
+ <widget class="QComboBox" name="users_dropdown"/>
</item>
- <item row="7" column="1">
+ <item row="7" column="2">
<widget class="QPushButton" name="new_id_button">
<property name="text">
- <string>New ID</string>
+ <string>New user</string>
</property>
</widget>
</item>
- <item row="1" column="1">
- <widget class="QComboBox" name="users_dropdown"/>
- </item>
<item row="0" column="0">
<layout class="QFormLayout" name="stats_layout">
<item row="0" column="0">
@@ -123,84 +245,19 @@
</item>
</layout>
</item>
- <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::NoFrame</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Plain</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>true</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="horizontalHeaderMinimumSectionSize">
- <number>15</number>
- </attribute>
- <attribute name="verticalHeaderVisible">
- <bool>false</bool>
- </attribute>
- <attribute name="verticalHeaderDefaultSectionSize">
- <number>70</number>
- </attribute>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
+ <item row="6" column="0">
+ <widget class="QPushButton" name="refresh_button">
+ <property name="text">
+ <string>Refresh statistics</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2">
+ <widget class="QPushButton" name="manage_users_button">
+ <property name="text">
+ <string>Manage users</string>
+ </property>
+ </widget>
</item>
</layout>
</widget>
diff --git a/user_management.cpp b/user_management.cpp
new file mode 100644
index 0000000..21058b0
--- /dev/null
+++ b/user_management.cpp
@@ -0,0 +1,50 @@
+#include "user_management.h"
+#include "ui_user_management.h"
+
+user_management::user_management(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::user_management)
+{
+ ui->setupUi(this);
+ load_players();
+}
+
+user_management::~user_management()
+{
+ delete ui;
+}
+
+void user_management::load_players()
+{
+ ui->user_dropdown->clear();
+ usernames.clear();
+ userids.clear();
+ parse.parse_users();
+ usernames = parse.get_usernames();
+ userids = parse.get_ids();
+ for (int x = 0; x < usernames.length(); x++)
+ {
+ ui->user_dropdown->addItem(usernames.at(x));
+ }
+}
+
+void user_management::on_refresh_users_button_clicked()
+{
+ load_players();
+}
+
+void user_management::on_delete_user_button_clicked()
+{
+ QString to_remove = ui->user_dropdown->currentText() + "=" + userids.at(ui->user_dropdown->currentIndex());
+ parse.delete_user(to_remove);
+ load_players();
+}
+
+void user_management::on_add_user_button_clicked()
+{
+ if (ui->username_text->text() != "" && ui->user_id_text->text() != "")
+ {
+ QString user = ui->username_text->text() + "=" + ui->user_id_text->text();
+ parse.add_user(user);
+ }
+}
diff --git a/user_management.h b/user_management.h
new file mode 100644
index 0000000..88e2bd0
--- /dev/null
+++ b/user_management.h
@@ -0,0 +1,35 @@
+#ifndef USER_MANAGEMENT_H
+#define USER_MANAGEMENT_H
+
+#include <QWidget>
+#include <QDebug>
+#include "parse_file.h"
+
+namespace Ui {
+class user_management;
+}
+
+class user_management : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit user_management(QWidget *parent = 0);
+ ~user_management();
+
+private slots:
+ void on_refresh_users_button_clicked();
+
+ void on_delete_user_button_clicked();
+
+ void on_add_user_button_clicked();
+
+private:
+ Ui::user_management *ui;
+ parse_file parse;
+ QStringList usernames;
+ QStringList userids;
+ void load_players();
+};
+
+#endif // USER_MANAGEMENT_H
diff --git a/user_management.ui b/user_management.ui
new file mode 100644
index 0000000..c9f3fe7
--- /dev/null
+++ b/user_management.ui
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>user_management</class>
+ <widget class="QWidget" name="user_management">
+ <property name="windowModality">
+ <enum>Qt::ApplicationModal</enum>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>157</width>
+ <height>208</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>User Management</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QComboBox" name="user_dropdown"/>
+ </item>
+ <item>
+ <widget class="QPushButton" name="delete_user_button">
+ <property name="text">
+ <string>Remove selected user</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="refresh_users_button">
+ <property name="text">
+ <string>Refresh list</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="username_label">
+ <property name="text">
+ <string>Username</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="username_text">
+ <property name="placeholderText">
+ <string>Username</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="stean_id_label">
+ <property name="text">
+ <string>Steam ID</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="user_id_text">
+ <property name="placeholderText">
+ <string>Steam ID</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="add_user_button">
+ <property name="text">
+ <string>Add user</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="close_button">
+ <property name="text">
+ <string>Close</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>close_button</sender>
+ <signal>clicked()</signal>
+ <receiver>user_management</receiver>
+ <slot>close()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>99</x>
+ <y>84</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>94</x>
+ <y>107</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/user_select_dialog.cpp b/user_select_dialog.cpp
index 1ba0593..8431417 100644
--- a/user_select_dialog.cpp
+++ b/user_select_dialog.cpp
@@ -77,6 +77,19 @@ void user_select_dialog::load_players()
void user_select_dialog::on_player_dropdown_currentIndexChanged(int index)
{
- if (!usernames.isEmpty())
+ if (!usernames.isEmpty() && index != -1)
ui->steam_url_text->setText(userids.at(index));
}
+
+void user_select_dialog::on_manage_users_button_clicked()
+{
+ manage.show();
+}
+
+void user_select_dialog::on_refresh_users_button_clicked()
+{
+ ui->player_dropdown->clear();
+ usernames.clear();
+ userids.clear();
+ load_players();
+}
diff --git a/user_select_dialog.h b/user_select_dialog.h
index 5e8253f..dc83ddb 100644
--- a/user_select_dialog.h
+++ b/user_select_dialog.h
@@ -7,6 +7,7 @@
#include "file_download.h"
#include "stats_display_window.h"
#include "parse_file.h"
+#include "user_management.h"
namespace Ui {
class user_select_dialog;
@@ -25,10 +26,15 @@ private slots:
void on_player_dropdown_currentIndexChanged(int index);
+ void on_manage_users_button_clicked();
+
+ void on_refresh_users_button_clicked();
+
private:
Ui::user_select_dialog *ui;
file_download download;
stats_display_window n_window;
+ user_management manage;
parse_file parse;
void download_info();
void load_players();
diff --git a/user_select_dialog.ui b/user_select_dialog.ui
index f435425..fcd9877 100644
--- a/user_select_dialog.ui
+++ b/user_select_dialog.ui
@@ -10,9 +10,15 @@
<x>0</x>
<y>0</y>
<width>269</width>
- <height>138</height>
+ <height>190</height>
</rect>
</property>
+ <property name="maximumSize">
+ <size>
+ <width>269</width>
+ <height>16777215</height>
+ </size>
+ </property>
<property name="windowTitle">
<string>Select a Steam account</string>
</property>
@@ -20,10 +26,10 @@
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
- <item row="5" column="0">
- <widget class="QPushButton" name="close_button">
+ <item row="3" column="0">
+ <widget class="QLineEdit" name="steam_url_text">
<property name="text">
- <string>Close</string>
+ <string>76561198055087665</string>
</property>
</widget>
</item>
@@ -34,23 +40,37 @@
</property>
</widget>
</item>
- <item row="3" column="0">
- <widget class="QLineEdit" name="steam_url_text">
+ <item row="6" column="0">
+ <widget class="QPushButton" name="select_account_button">
<property name="text">
- <string>76561198055087665</string>
+ <string>Select</string>
</property>
</widget>
</item>
- <item row="4" column="0">
- <widget class="QPushButton" name="select_account_button">
+ <item row="5" column="0">
+ <widget class="QPushButton" name="manage_users_button">
<property name="text">
- <string>Select</string>
+ <string>Manage users</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QComboBox" name="player_dropdown"/>
</item>
+ <item row="7" column="0">
+ <widget class="QPushButton" name="close_button">
+ <property name="text">
+ <string>Close</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <widget class="QPushButton" name="refresh_users_button">
+ <property name="text">
+ <string>Refresh list</string>
+ </property>
+ </widget>
+ </item>
</layout>
</item>
</layout>
diff --git a/weapons/nova.png b/weapons/nova.png
index a759e4a..0d3a0bb 100644
--- a/weapons/nova.png
+++ b/weapons/nova.png
Binary files differ
diff --git a/weapons/sawedoff.png b/weapons/sawedoff.png
index a440e24..4285e61 100644
--- a/weapons/sawedoff.png
+++ b/weapons/sawedoff.png
Binary files differ