First version of statistics (very ugly code)

This commit is contained in:
2010-08-17 18:59:19 +02:00
parent 023b1def9d
commit 74c401c8c7
15 changed files with 417 additions and 21 deletions

View File

@@ -20,10 +20,22 @@ along with KissCount. If not, see <http://www.gnu.org/licenses/>.
#include "wxUI.h"
wxString months[12] ;
wxColour categoryColors[12] = {wxColour(0x00, 0x45, 0x86),
wxColour(0xFF, 0x3E, 0x0E),
wxColour(0xFF, 0xD3, 0x20),
wxColour(0x58, 0x9D, 0x1B),
wxColour(0x7E, 0x00, 0x21),
wxColour(0x83, 0xCC, 0xFF),
wxColour(0x31, 0x40, 0x04),
wxColour(0xB0, 0xCF, 0x00),
wxColour(0x4B, 0x1F, 0x6F),
wxColour(0xFF, 0x93, 0x0E),
wxColour(0xC5, 0x00, 0x0D),
wxColour(0x00, 0x84, 0xD1)};
wxUI::wxUI(KissCount* kiss, const wxString& title, const wxPoint& pos, const wxSize& size)
: wxFrame(NULL, wxID_ANY, title, pos, size), _kiss(kiss), _accountPanel(NULL), _searchPanel(NULL), _preferencesPanel(NULL),
_curPanel(NULL), _locale(NULL), _needReload(false)
: wxFrame(NULL, wxID_ANY, title, pos, size), _kiss(kiss), _accountPanel(NULL), _statsPanel(NULL),
_searchPanel(NULL), _preferencesPanel(NULL), _curPanel(NULL), _locale(NULL), _needReload(false)
{
_hbox = new wxBoxSizer(wxVERTICAL);
ButtonPanel* buttons = new ButtonPanel(_kiss, this);
@@ -51,6 +63,7 @@ wxUI::~wxUI()
if (_accountPanel) delete _accountPanel;
if (_preferencesPanel) delete _preferencesPanel;
if (_searchPanel) delete _searchPanel;
if (_statsPanel) delete _statsPanel;
if (_locale) delete _locale;
}
@@ -117,6 +130,11 @@ void wxUI::ShowSearch()
ShowPanel(_searchPanel);
}
void wxUI::ShowStats()
{
ShowPanel(_statsPanel);
}
void wxUI::ShowPreferences()
{
ShowPanel(_preferencesPanel);
@@ -147,10 +165,14 @@ void wxUI::LoadUser()
if (_searchPanel)
delete _searchPanel;
if (_statsPanel)
delete _statsPanel;
if (user->_preferences[wxT("language")] != wxT(""))
SetLanguage(user->GetLanguage());
_accountPanel = new AccountPanel(_kiss, this);
_statsPanel = new StatsPanel(_kiss, this);
_searchPanel = new SearchPanel(_kiss, this);
_preferencesPanel = new PreferencesPanel(_kiss, this);
@@ -159,7 +181,7 @@ void wxUI::LoadUser()
void wxUI::ShowPanel(wxPanel* panel)
{
int month, year, account=0, preferences=0, search=0;
int month, year, account=0, preferences=0, search=0, stats=0;
wxShowEvent event;
if (!panel) return;
@@ -189,9 +211,15 @@ void wxUI::ShowPanel(wxPanel* panel)
search = 1;
}
if (panel == _statsPanel)
{
stats = 1;
}
delete _accountPanel;
delete _preferencesPanel;
delete _searchPanel;
delete _statsPanel;
_accountPanel = new AccountPanel(_kiss, this);
if (year != -1)
@@ -201,22 +229,28 @@ void wxUI::ShowPanel(wxPanel* panel)
}
_preferencesPanel = new PreferencesPanel(_kiss, this);
_searchPanel = new SearchPanel(_kiss, this);
_statsPanel = new StatsPanel(_kiss, this);
if (account)
{
_accountPanel->OnShow(event);
panel = _accountPanel;
}
if (preferences)
else if (preferences)
{
_preferencesPanel->OnShow(event);
panel = _preferencesPanel;
}
if (search)
else if (search)
{
_searchPanel->OnShow(event);
panel = _searchPanel;
}
else if (stats)
{
_statsPanel->OnShow(event);
panel = _statsPanel;
}
_needReload = false;
}