From d29afc619e8a3f4394cc754f36701d67bcb1ccc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sun, 4 Jul 2010 17:42:14 +0200 Subject: [PATCH] Move directories, fix a bug into month generation (tree), add tooltips --- Makefile | 22 +++++++-------- ressources/{ => icons}/Clients-icon.png | Bin ressources/icons/SOURCE | 1 + ressources/{ => icons}/Search-icon.png | Bin ressources/{ => icons}/administrator-icon.png | Bin ressources/{ => icons}/chart-icon.png | Bin ressources/{ => icons}/options-icon.png | Bin ressources/{ => icons}/process-stop.png | Bin ressources/{ => icons}/system-log-out.png | Bin ressources/{ => icons}/tick-icon.png | Bin ressources/{ => icons}/windows-users-icon.png | Bin {controller => src/controller}/KissCount.cpp | 0 {controller => src/controller}/KissCount.h | 0 main.cpp => src/main.cpp | 0 main.h => src/main.h | 0 src/model/Account.h | 17 ++++++++++++ src/model/Category.h | 14 ++++++++++ {model => src/model}/Database.cpp | 0 {model => src/model}/Database.h | 0 src/model/Operation.h | 18 +++++++++++++ {model => src/model}/User.cpp | 0 {model => src/model}/User.h | 0 {model => src/model}/model.h | 0 sha1.cpp => src/sha1.cpp | 0 sha1.h => src/sha1.h | 0 {view => src/view}/AccountPanel.cpp | 25 +++++++++++++----- {view => src/view}/AccountPanel.h | 4 +-- {view => src/view}/ButtonPanel.cpp | 8 ++++++ {view => src/view}/ButtonPanel.h | 14 +++++----- {view => src/view}/CalendarEditor.cpp | 0 {view => src/view}/CalendarEditor.h | 0 {view => src/view}/GenerateDialog.cpp | 0 {view => src/view}/GenerateDialog.h | 0 {view => src/view}/GridAccount.h | 0 {view => src/view}/PasswordDialog.cpp | 0 {view => src/view}/PasswordDialog.h | 0 {view => src/view}/PreferencesPanel.cpp | 0 {view => src/view}/PreferencesPanel.h | 0 {view => src/view}/UsersDialog.cpp | 0 {view => src/view}/UsersDialog.h | 0 .../view}/wxGridCellBitmapRenderer.cpp | 0 {view => src/view}/wxGridCellBitmapRenderer.h | 0 {view => src/view}/wxUI.cpp | 0 {view => src/view}/wxUI.h | 0 44 files changed, 97 insertions(+), 26 deletions(-) rename ressources/{ => icons}/Clients-icon.png (100%) create mode 100644 ressources/icons/SOURCE rename ressources/{ => icons}/Search-icon.png (100%) rename ressources/{ => icons}/administrator-icon.png (100%) rename ressources/{ => icons}/chart-icon.png (100%) rename ressources/{ => icons}/options-icon.png (100%) rename ressources/{ => icons}/process-stop.png (100%) rename ressources/{ => icons}/system-log-out.png (100%) rename ressources/{ => icons}/tick-icon.png (100%) rename ressources/{ => icons}/windows-users-icon.png (100%) rename {controller => src/controller}/KissCount.cpp (100%) rename {controller => src/controller}/KissCount.h (100%) rename main.cpp => src/main.cpp (100%) rename main.h => src/main.h (100%) create mode 100644 src/model/Account.h create mode 100644 src/model/Category.h rename {model => src/model}/Database.cpp (100%) rename {model => src/model}/Database.h (100%) create mode 100644 src/model/Operation.h rename {model => src/model}/User.cpp (100%) rename {model => src/model}/User.h (100%) rename {model => src/model}/model.h (100%) rename sha1.cpp => src/sha1.cpp (100%) rename sha1.h => src/sha1.h (100%) rename {view => src/view}/AccountPanel.cpp (98%) rename {view => src/view}/AccountPanel.h (95%) rename {view => src/view}/ButtonPanel.cpp (90%) rename {view => src/view}/ButtonPanel.h (65%) rename {view => src/view}/CalendarEditor.cpp (100%) rename {view => src/view}/CalendarEditor.h (100%) rename {view => src/view}/GenerateDialog.cpp (100%) rename {view => src/view}/GenerateDialog.h (100%) rename {view => src/view}/GridAccount.h (100%) rename {view => src/view}/PasswordDialog.cpp (100%) rename {view => src/view}/PasswordDialog.h (100%) rename {view => src/view}/PreferencesPanel.cpp (100%) rename {view => src/view}/PreferencesPanel.h (100%) rename {view => src/view}/UsersDialog.cpp (100%) rename {view => src/view}/UsersDialog.h (100%) rename {view => src/view}/wxGridCellBitmapRenderer.cpp (100%) rename {view => src/view}/wxGridCellBitmapRenderer.h (100%) rename {view => src/view}/wxUI.cpp (100%) rename {view => src/view}/wxUI.h (100%) diff --git a/Makefile b/Makefile index b2e700d..dfa502b 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -CXXFLAGS=`wx-config --cxxflags` -Wall -I. -ggdb +CXXFLAGS=`wx-config --cxxflags` -Wall -Isrc -ggdb CXXFLAGS+=-I./lib/wxsqlite3-1.9.9/include CXXFLAGS+=-I./lib/freechart/include @@ -8,22 +8,22 @@ LDFLAGS+=-L./lib/freechart/lib -lwxcode_gtk2u_freechart-2.8 CXX=g++ -SOURCES=$(wildcard model/*.cpp) -SOURCES+=$(wildcard view/*.cpp) -SOURCES+=$(wildcard controller/*.cpp) -SOURCES+=main.cpp sha1.cpp -HEADERS=$(wildcard model/*.h) -HEADERS+=$(wildcard view/*.h) -HEADERS+=$(wildcard controller/*.h) -HEADERS+=main.h sha1.h +SOURCES=$(wildcard src/model/*.cpp) +SOURCES+=$(wildcard src/view/*.cpp) +SOURCES+=$(wildcard src/controller/*.cpp) +SOURCES+=src/main.cpp src/sha1.cpp +HEADERS=$(wildcard src/model/*.h) +HEADERS+=$(wildcard src/view/*.h) +HEADERS+=$(wildcard src/controller/*.h) +HEADERS+=src/main.h src/sha1.h OBJS=$(SOURCES:.cpp=.o) all: kc clean: - rm -f *~ *.o model/*.o model/*~ view/*.o view/*~ controller/*.o controller/*~ kc + rm -f *~ src/*~ src/*.o src/model/*.o src/model/*~ src/view/*.o src/view/*~ src/controller/*.o src/controller/*~ kc -%.o : model/%.cpp view/%.cpp controller/%.cpp %.cpp +%.o : src/model/%.cpp src/view/%.cpp src/controller/%.cpp src/%.cpp $(CXX) $(CXXFLAGS) $< -c kc: $(OBJS) diff --git a/ressources/Clients-icon.png b/ressources/icons/Clients-icon.png similarity index 100% rename from ressources/Clients-icon.png rename to ressources/icons/Clients-icon.png diff --git a/ressources/icons/SOURCE b/ressources/icons/SOURCE new file mode 100644 index 0000000..db176a4 --- /dev/null +++ b/ressources/icons/SOURCE @@ -0,0 +1 @@ +http://www.iconarchive.com/category/application-icons.html diff --git a/ressources/Search-icon.png b/ressources/icons/Search-icon.png similarity index 100% rename from ressources/Search-icon.png rename to ressources/icons/Search-icon.png diff --git a/ressources/administrator-icon.png b/ressources/icons/administrator-icon.png similarity index 100% rename from ressources/administrator-icon.png rename to ressources/icons/administrator-icon.png diff --git a/ressources/chart-icon.png b/ressources/icons/chart-icon.png similarity index 100% rename from ressources/chart-icon.png rename to ressources/icons/chart-icon.png diff --git a/ressources/options-icon.png b/ressources/icons/options-icon.png similarity index 100% rename from ressources/options-icon.png rename to ressources/icons/options-icon.png diff --git a/ressources/process-stop.png b/ressources/icons/process-stop.png similarity index 100% rename from ressources/process-stop.png rename to ressources/icons/process-stop.png diff --git a/ressources/system-log-out.png b/ressources/icons/system-log-out.png similarity index 100% rename from ressources/system-log-out.png rename to ressources/icons/system-log-out.png diff --git a/ressources/tick-icon.png b/ressources/icons/tick-icon.png similarity index 100% rename from ressources/tick-icon.png rename to ressources/icons/tick-icon.png diff --git a/ressources/windows-users-icon.png b/ressources/icons/windows-users-icon.png similarity index 100% rename from ressources/windows-users-icon.png rename to ressources/icons/windows-users-icon.png diff --git a/controller/KissCount.cpp b/src/controller/KissCount.cpp similarity index 100% rename from controller/KissCount.cpp rename to src/controller/KissCount.cpp diff --git a/controller/KissCount.h b/src/controller/KissCount.h similarity index 100% rename from controller/KissCount.h rename to src/controller/KissCount.h diff --git a/main.cpp b/src/main.cpp similarity index 100% rename from main.cpp rename to src/main.cpp diff --git a/main.h b/src/main.h similarity index 100% rename from main.h rename to src/main.h diff --git a/src/model/Account.h b/src/model/Account.h new file mode 100644 index 0000000..e109be7 --- /dev/null +++ b/src/model/Account.h @@ -0,0 +1,17 @@ +#ifndef ACCOUNT_H +#define ACCOUNT_H + +#include +#include +#include + +class Account { + public: + wxString id; + wxString name; + wxString number; + bool shared; + bool _default; +}; + +#endif diff --git a/src/model/Category.h b/src/model/Category.h new file mode 100644 index 0000000..55edd8c --- /dev/null +++ b/src/model/Category.h @@ -0,0 +1,14 @@ +#ifndef CATEGORY_H +#define CATEGORY_H + +class Category +{ + public: + wxString id; + wxString parent; + wxString name; + wxColour color; + wxString font; +}; + +#endif diff --git a/model/Database.cpp b/src/model/Database.cpp similarity index 100% rename from model/Database.cpp rename to src/model/Database.cpp diff --git a/model/Database.h b/src/model/Database.h similarity index 100% rename from model/Database.h rename to src/model/Database.h diff --git a/src/model/Operation.h b/src/model/Operation.h new file mode 100644 index 0000000..e2dfb91 --- /dev/null +++ b/src/model/Operation.h @@ -0,0 +1,18 @@ +#ifndef OPERATION_H +#define OPERATION_H + +class Operation { + public: + wxString id; + unsigned int day; + unsigned int month; + unsigned int year; + double amount; + wxString description; + wxString category; + bool fix_cost; + wxString account; + bool checked; +} ; + +#endif diff --git a/model/User.cpp b/src/model/User.cpp similarity index 100% rename from model/User.cpp rename to src/model/User.cpp diff --git a/model/User.h b/src/model/User.h similarity index 100% rename from model/User.h rename to src/model/User.h diff --git a/model/model.h b/src/model/model.h similarity index 100% rename from model/model.h rename to src/model/model.h diff --git a/sha1.cpp b/src/sha1.cpp similarity index 100% rename from sha1.cpp rename to src/sha1.cpp diff --git a/sha1.h b/src/sha1.h similarity index 100% rename from sha1.h rename to src/sha1.h diff --git a/view/AccountPanel.cpp b/src/view/AccountPanel.cpp similarity index 98% rename from view/AccountPanel.cpp rename to src/view/AccountPanel.cpp index b7db1c1..db97a3b 100644 --- a/view/AccountPanel.cpp +++ b/src/view/AccountPanel.cpp @@ -939,9 +939,17 @@ void AccountPanel::GetTreeSelection(int* month, int* year) void AccountPanel::OnMenuGenerate(wxCommandEvent& event) { int month, year; + wxDateTime curDate; + + curDate.SetToCurrent(); GetTreeSelection(&month, &year); + if (month == -1 && year == curDate.GetYear()) + { + month = _curMonth; + } + GenerateDialog g(_kiss, _wxUI, month, year); g.ShowModal(); } @@ -1005,14 +1013,16 @@ void AccountPanel::GenerateMonth(int month, int year) wxTreeItemId root, years, node ; wxTreeItemIdValue cookie; wxString monthString, yearString; - std::map >::iterator it; + std::map > ops ; + std::vector::iterator it ; int i; - User* user = _kiss->GetUser(); root = _tree.GetRootItem(); yearString = wxString::Format(wxT("%d"), year); monthString = months[month]; + ops = _kiss->GetAllOperations(); + if (_tree.GetChildrenCount(root, true) < 1) { node = _tree.AppendItem(root, yearString); @@ -1053,14 +1063,17 @@ void AccountPanel::GenerateMonth(int month, int year) node = _tree.AppendItem(years, monthString); else { - for(i=0, it = user->_operations[year]->begin(); - it != user->_operations[year]->end(); + for(i=0, it = ops[year].begin(); + it != ops[year].end(); it++, i++) { - if ((int)it->first > month) + if (*it > month) break; } - years = _tree.InsertItem(years, i, monthString); + if (it == ops[year].end()) + years = _tree.AppendItem(years, monthString); + else + years = _tree.InsertItem(years, i-1, monthString); } _tree.SelectItem(node, true); diff --git a/view/AccountPanel.h b/src/view/AccountPanel.h similarity index 95% rename from view/AccountPanel.h rename to src/view/AccountPanel.h index abfe0f8..d9843a8 100644 --- a/view/AccountPanel.h +++ b/src/view/AccountPanel.h @@ -18,8 +18,8 @@ #define DEFAULT_FONT_SIZE 12 #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" +#define DELETE_ICON "ressources/icons/process-stop.png" +#define CHECKED_ICON "ressources/icons/tick-icon.png" #include #include "wxUI.h" diff --git a/view/ButtonPanel.cpp b/src/view/ButtonPanel.cpp similarity index 90% rename from view/ButtonPanel.cpp rename to src/view/ButtonPanel.cpp index a156470..1b4af31 100644 --- a/view/ButtonPanel.cpp +++ b/src/view/ButtonPanel.cpp @@ -23,6 +23,14 @@ ButtonPanel::ButtonPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*parent)), _ SetSizer(hbox); + _account->SetToolTip(_("Operations")); + _stats->SetToolTip(_("Statistics")); + _search->SetToolTip(_("Search")); + _prefs->SetToolTip(_("Preferences")); + _changeUser->SetToolTip(_("Change user")); + _about->SetToolTip(_("About")); + _quit->SetToolTip(_("Quit")); + hbox->Add(_account); hbox->Add(_stats); hbox->Add(_search); diff --git a/view/ButtonPanel.h b/src/view/ButtonPanel.h similarity index 65% rename from view/ButtonPanel.h rename to src/view/ButtonPanel.h index 9217f2a..061005f 100644 --- a/view/ButtonPanel.h +++ b/src/view/ButtonPanel.h @@ -7,13 +7,13 @@ #include #include "wxUI.h" -#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" +#define ACCOUNT_ICON "ressources/icons/administrator-icon.png" +#define STATS_ICON "ressources/icons/chart-icon.png" +#define SEARCH_ICON "ressources/icons/Search-icon.png" +#define PREFS_ICON "ressources/icons/options-icon.png" +#define CHANGE_USER_ICON "ressources/icons/Clients-icon.png" +#define ABOUT_ICON "ressources/icons/windows-users-icon.png" +#define QUIT_ICON "ressources/icons/system-log-out.png" class KissCount; class wxUI; diff --git a/view/CalendarEditor.cpp b/src/view/CalendarEditor.cpp similarity index 100% rename from view/CalendarEditor.cpp rename to src/view/CalendarEditor.cpp diff --git a/view/CalendarEditor.h b/src/view/CalendarEditor.h similarity index 100% rename from view/CalendarEditor.h rename to src/view/CalendarEditor.h diff --git a/view/GenerateDialog.cpp b/src/view/GenerateDialog.cpp similarity index 100% rename from view/GenerateDialog.cpp rename to src/view/GenerateDialog.cpp diff --git a/view/GenerateDialog.h b/src/view/GenerateDialog.h similarity index 100% rename from view/GenerateDialog.h rename to src/view/GenerateDialog.h diff --git a/view/GridAccount.h b/src/view/GridAccount.h similarity index 100% rename from view/GridAccount.h rename to src/view/GridAccount.h diff --git a/view/PasswordDialog.cpp b/src/view/PasswordDialog.cpp similarity index 100% rename from view/PasswordDialog.cpp rename to src/view/PasswordDialog.cpp diff --git a/view/PasswordDialog.h b/src/view/PasswordDialog.h similarity index 100% rename from view/PasswordDialog.h rename to src/view/PasswordDialog.h diff --git a/view/PreferencesPanel.cpp b/src/view/PreferencesPanel.cpp similarity index 100% rename from view/PreferencesPanel.cpp rename to src/view/PreferencesPanel.cpp diff --git a/view/PreferencesPanel.h b/src/view/PreferencesPanel.h similarity index 100% rename from view/PreferencesPanel.h rename to src/view/PreferencesPanel.h diff --git a/view/UsersDialog.cpp b/src/view/UsersDialog.cpp similarity index 100% rename from view/UsersDialog.cpp rename to src/view/UsersDialog.cpp diff --git a/view/UsersDialog.h b/src/view/UsersDialog.h similarity index 100% rename from view/UsersDialog.h rename to src/view/UsersDialog.h diff --git a/view/wxGridCellBitmapRenderer.cpp b/src/view/wxGridCellBitmapRenderer.cpp similarity index 100% rename from view/wxGridCellBitmapRenderer.cpp rename to src/view/wxGridCellBitmapRenderer.cpp diff --git a/view/wxGridCellBitmapRenderer.h b/src/view/wxGridCellBitmapRenderer.h similarity index 100% rename from view/wxGridCellBitmapRenderer.h rename to src/view/wxGridCellBitmapRenderer.h diff --git a/view/wxUI.cpp b/src/view/wxUI.cpp similarity index 100% rename from view/wxUI.cpp rename to src/view/wxUI.cpp diff --git a/view/wxUI.h b/src/view/wxUI.h similarity index 100% rename from view/wxUI.h rename to src/view/wxUI.h