Add new buttons and version into database

This commit is contained in:
Grégory Soutadé 2010-07-03 16:14:05 +02:00
parent 420ceb688b
commit 7d2143853e
9 changed files with 45 additions and 6 deletions

View File

@ -1,3 +1,4 @@
CREATE TABLE kisscount(version VARCHAR(20), db_version VARCHAR(20));
CREATE TABLE user (id INTEGER PRIMARY KEY, name VARCHAR(255), password VARCHAR(255));
CREATE TABLE account(id INTEGER PRIMARY KEY, user REFERENCES user(id), name VARCHAR(255), number VARCHAR(255), shared CHAR(1), default_account CHAR(1));
CREATE TABLE account_amount(id INTEGER PRIMARY KEY, account REFERENCES account(id), year INTEGER, month INTEGER, amount FLOAT);
@ -6,6 +7,7 @@ CREATE TABLE category(id INTEGER PRIMARY KEY, user REFERENCES user(id), parent R
CREATE TABLE preference(id INTEGER PRIMARY KEY, user REFERENCES user(id), name VARCHAR(255), value VARCHAR(255));
CREATE TABLE default_preference(id INTEGER PRIMARY KEY, type VARCHAR(255), name VARCHAR(255), value VARCHAR(255));
CREATE TABLE default_category(id INTEGER PRIMARY KEY, parent REFERENCES category(id), name VARCHAR(255), color VARCHAR(255), font VARCHAR(255));
INSERT INTO kisscount ("version", "db_version") VALUES ("0.1", "1");
-- INSERT INTO default_preference ("name", "value") VALUES ("category", "name", "Fixe");
-- INSERT INTO default_preference ("name", "value") VALUES ("category", "name", "Courses");
INSERT INTO default_category ("parent", "name", "color", "font") VALUES ("0", "Fixe", "#FFFF99", "");

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -43,7 +43,8 @@ AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent) : wxScrolledWindow(&(*
wxColour(0xFF, 0x93, 0x0E),
wxColour(0xC5, 0x00, 0x0D),
wxColour(0x00, 0x84, 0xD1)};
wxBitmap bitmap(wxT(DELETE_ICON));
wxBitmap deleteBitmap(wxT(DELETE_ICON));
wxBitmap checkedBitmap(wxT(CHECKED_ICON));
SetSizer(hbox);
@ -104,7 +105,8 @@ AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent) : wxScrolledWindow(&(*
_grid->SetReadOnly(0, i, true);
_grid->SetCellAlignment(0, i, wxALIGN_CENTRE, wxALIGN_CENTRE);
}
_grid->SetCellRenderer(0, DELETE, new wxGridCellBitmapRenderer(bitmap));
_grid->SetCellRenderer(0, DELETE, new wxGridCellBitmapRenderer(deleteBitmap));
_grid->SetCellRenderer(0, CHECKED, new wxGridCellBitmapRenderer(checkedBitmap));
font.SetWeight(wxFONTWEIGHT_NORMAL);
@ -472,6 +474,8 @@ void AccountPanel::InsertOperation(User* user, Operation* op, int line, bool fix
}
}
_grid->Layout();
_grid->SetMinSize(_grid->GetMinSize());
_wxUI->Layout();
}

View File

@ -19,6 +19,7 @@
#define DEFAULT_FONT(font_name) wxFont font_name(DEFAULT_FONT_SIZE, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, DEFAULT_FONT_NAME);
#define DELETE_ICON "ressources/process-stop.png"
#define CHECKED_ICON "ressources/tick-icon.png"
#include <controller/KissCount.h>
#include "wxUI.h"

View File

@ -1,11 +1,13 @@
#include "ButtonPanel.h"
enum {ID_BUTTON_ACCOUNT=1, ID_BUTTON_STATS, ID_BUTTON_PREFS, ID_BUTTON_CHANGE_USER};
enum {ID_BUTTON_ACCOUNT=1, ID_BUTTON_STATS, ID_BUTTON_SEARCH, ID_BUTTON_PREFS, ID_BUTTON_CHANGE_USER, ID_BUTTON_ABOUT, ID_BUTTON_QUIT};
BEGIN_EVENT_TABLE(ButtonPanel, wxPanel)
EVT_BUTTON(ID_BUTTON_ACCOUNT, ButtonPanel::OnButtonAccount)
EVT_BUTTON(ID_BUTTON_PREFS, ButtonPanel::OnButtonPreferences)
EVT_BUTTON(ID_BUTTON_CHANGE_USER, ButtonPanel::OnButtonChangeUser)
EVT_BUTTON(ID_BUTTON_ABOUT, ButtonPanel::OnButtonAbout)
EVT_BUTTON(ID_BUTTON_QUIT, ButtonPanel::OnButtonQuit)
END_EVENT_TABLE()
ButtonPanel::ButtonPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*parent)), _kiss(kiss), _wxUI(parent)
@ -13,15 +15,21 @@ ButtonPanel::ButtonPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*parent)), _
wxBoxSizer *hbox = new wxBoxSizer(wxHORIZONTAL);
_account = new wxBitmapButton(this, ID_BUTTON_ACCOUNT, wxBitmap(wxT(ACCOUNT_ICON)), wxDefaultPosition, wxSize(128, 128));
_stats = new wxBitmapButton(this, ID_BUTTON_STATS, wxBitmap(wxT(STATS_ICON)), wxDefaultPosition, wxSize(128, 128));
_search = new wxBitmapButton(this, ID_BUTTON_SEARCH, wxBitmap(wxT(SEARCH_ICON)), wxDefaultPosition, wxSize(128, 128));
_prefs = new wxBitmapButton(this, ID_BUTTON_PREFS, wxBitmap(wxT(PREFS_ICON)), wxDefaultPosition, wxSize(128, 128));
_changeUser = new wxBitmapButton(this, ID_BUTTON_CHANGE_USER, wxBitmap(wxT(CHANGE_USER_ICON)), wxDefaultPosition, wxSize(128, 128));
_about = new wxBitmapButton(this, ID_BUTTON_ABOUT, wxBitmap(wxT(ABOUT_ICON)), wxDefaultPosition, wxSize(128, 128));
_quit = new wxBitmapButton(this, ID_BUTTON_QUIT, wxBitmap(wxT(QUIT_ICON)), wxDefaultPosition, wxSize(128, 128));
SetSizer(hbox);
hbox->Add(_account);
hbox->Add(_stats);
hbox->Add(_search);
hbox->Add(_prefs);
hbox->Add(_changeUser);
hbox->Add(_about);
hbox->Add(_quit);
Fit();
SetMinSize(GetSize());
@ -49,3 +57,20 @@ void ButtonPanel::OnButtonChangeUser(wxCommandEvent& event)
{
_wxUI->ChangeUser();
}
void ButtonPanel::OnButtonAbout(wxCommandEvent& event)
{
wxMessageBox( _("KissCount v0.1\n\nLogiciel de comptabilité\n\nCopyright (C) 2010 Grégory Soutadé"),
wxT("KissCount"),
wxOK | wxICON_INFORMATION, _wxUI );
}
void ButtonPanel::OnButtonQuit(wxCommandEvent& event)
{
wxMessageDialog dialog(_wxUI, _("Quit KissCount ?"), wxT("KissCount"), wxYES_NO);
if (dialog.ShowModal() == wxID_NO)
{
return;
}
_wxUI->Close(true);
}

View File

@ -9,8 +9,11 @@
#define ACCOUNT_ICON "ressources/administrator-icon.png"
#define STATS_ICON "ressources/chart-icon.png"
#define SEARCH_ICON "ressources/Search-icon.png"
#define PREFS_ICON "ressources/options-icon.png"
#define CHANGE_USER_ICON "ressources/Clients-icon.png"
#define ABOUT_ICON "ressources/windows-users-icon.png"
#define QUIT_ICON "ressources/system-log-out.png"
class KissCount;
class wxUI;
@ -25,14 +28,19 @@ public:
void OnButtonAccount(wxCommandEvent& event);
void OnButtonPreferences(wxCommandEvent& event);
void OnButtonChangeUser(wxCommandEvent& event);
void OnButtonAbout(wxCommandEvent& event);
void OnButtonQuit(wxCommandEvent& event);
private:
KissCount* _kiss;
wxUI* _wxUI;
wxBitmapButton* _account;
wxBitmapButton* _stats;
wxBitmapButton* _search;
wxBitmapButton* _prefs;
wxBitmapButton* _changeUser;
wxBitmapButton* _about;
wxBitmapButton* _quit;
DECLARE_EVENT_TABLE();
};

View File

@ -312,11 +312,11 @@ void PreferencesPanel::OnAccountModified(wxGridEvent& event)
_accountsGrid->SetReadOnly(row+1, ACCOUNT_SHARED, true);
_accountsGrid->SetReadOnly(row+1, ACCOUNT_DEFAULT, true);
_accountsGrid->SetReadOnly(row+1, ACCOUNT_DELETE, true);
_wxUI->Layout();
_kiss->AddAccount(new_account);
}
_wxUI->Layout();
_wxUI->NeedReload();
inModification = false;
}
@ -403,10 +403,9 @@ void PreferencesPanel::OnCategoryModified(wxGridEvent& event)
_categoriesGrid->SetReadOnly(row, CATEGORY_FONT, true);
_categoriesGrid->SetReadOnly(row, CATEGORY_DELETE, true);
SET_ROW_COLOR(row, OWN_GREEN);
_wxUI->Layout();
}
_wxUI->Layout();
_wxUI->NeedReload();
return;
}