Changeset 202
- Timestamp:
- 05/04/2009 12:22:36 PM (3 years ago)
- Location:
- trunk/src
- Files:
-
- 2 added
- 5 edited
-
Makefile.am (modified) (2 diffs)
-
simple_histogram.cpp (added)
-
simple_histogram.h (added)
-
statistics.cpp (modified) (6 diffs)
-
statistics.h (modified) (2 diffs)
-
statistics_dialog.cpp (modified) (3 diffs)
-
statistics_dialog.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/Makefile.am
r199 r202 15 15 settings_dialog.h \ 16 16 ScoreDice.cpp \ 17 simple_histogram.cpp \ 17 18 statistics.cpp \ 18 19 statistics_dialog.cpp \ … … 34 35 MainFrame.h \ 35 36 ScoreDice.h \ 37 simple_histogram.h \ 36 38 statistics.h \ 37 39 statistics_dialog.h \ -
trunk/src/statistics.cpp
r201 r202 34 34 Statistics::Statistics(configuration::Configuration *backend) 35 35 { 36 this->backend = backend; 36 37 try { 37 38 load_data(); … … 45 46 string tmp; 46 47 vector<string> tmp_vec; 47 this->backend = backend;48 48 49 49 tmp = backend->get("statistics_games_started"); … … 59 59 60 60 BOOST_FOREACH(string i, tmp_vec) { 61 score_distribution.push_back(atoi(i.c_str()));61 _score_distribution.push_back(atoi(i.c_str())); 62 62 } 63 63 … … 82 82 score_slot = score/score_distribution_granuality; 83 83 score_slot = score_slot<score_distributions_slots ? score_slot : score_slot; 84 score_distribution[score_slot]++;84 _score_distribution[score_slot]++; 85 85 save(); 86 86 } … … 93 93 94 94 tmp = ""; 95 BOOST_FOREACH(int i, score_distribution) {95 BOOST_FOREACH(int i, _score_distribution) { 96 96 tmp += stringify(i) + ","; 97 97 } … … 108 108 _last_reset = time(NULL); 109 109 110 score_distribution = vector<int>(score_distributions_slots, 0);110 _score_distribution = vector<int>(score_distributions_slots, 0); 111 111 112 112 save(); -
trunk/src/statistics.h
r201 r202 49 49 int games_finished() { return _games_finished; } 50 50 time_t last_reset() { return _last_reset; } 51 std::vector<int> score_distribution() { return _score_distribution; } 51 52 52 53 private: … … 65 66 time_t _last_reset; 66 67 67 std::vector<int> score_distribution;68 std::vector<int> _score_distribution; 68 69 configuration::Configuration *backend; 69 70 }; -
trunk/src/statistics_dialog.cpp
r199 r202 46 46 games_started = new wxStaticText(this, wxID_ANY, wxT("")); 47 47 games_finished = new wxStaticText(this, wxID_ANY, wxT("")); 48 histogram = new SimpleHistogram(this, wxID_ANY); 48 49 statistics_reset_date = new wxStaticText(this, wxID_ANY, wxT("")); 49 50 } … … 61 62 tmp = wxT("Last reset: ") + reset_time.Format(); 62 63 statistics_reset_date->SetLabel(tmp); 64 65 vector<int> score_dist = m_stats->score_distribution(); 66 vector<double> dist (score_dist.begin(), score_dist.end()); 67 histogram->SetData(dist); 63 68 } 64 69 … … 71 76 game_counts->AddStretchSpacer(10); 72 77 game_counts->Add(games_finished); 73 top_sizer->Add(game_counts, 10,wxEXPAND);78 top_sizer->Add(game_counts,0,wxEXPAND,10); 74 79 75 80 wxStaticBoxSizer* score_distribution = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxT("Score Distribution") ), wxHORIZONTAL); 76 top_sizer->Add(score_distribution,10,wxEXPAND); 81 score_distribution->Add(histogram, 1, wxEXPAND, 10); 82 top_sizer->Add(score_distribution,10,wxEXPAND, 10); 77 83 78 top_sizer->Add(statistics_reset_date, 10,wxEXPAND);84 top_sizer->Add(statistics_reset_date,0,wxEXPAND,10); 79 85 80 86 wxBoxSizer *button_sizer = new wxBoxSizer( wxHORIZONTAL ); -
trunk/src/statistics_dialog.h
r199 r202 22 22 23 23 #include "statistics.h" 24 #include "simple_histogram.h" 24 25 #include <wx/wx.h> 25 26 #include <wx/dialog.h> … … 46 47 wxStaticText *games_finished; 47 48 wxStaticText *statistics_reset_date; 49 SimpleHistogram* histogram; 48 50 49 51 statistics::Statistics* m_stats;
Note: See TracChangeset
for help on using the changeset viewer.
