Move directories, fix a bug into month generation (tree), add tooltips

This commit is contained in:
Grégory Soutadé 2010-07-04 17:42:14 +02:00
parent 5999035959
commit d29afc619e
44 changed files with 97 additions and 26 deletions

View File

@ -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)

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

1
ressources/icons/SOURCE Normal file
View File

@ -0,0 +1 @@
http://www.iconarchive.com/category/application-icons.html

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 533 B

After

Width:  |  Height:  |  Size: 533 B

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 592 B

After

Width:  |  Height:  |  Size: 592 B

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

17
src/model/Account.h Normal file
View File

@ -0,0 +1,17 @@
#ifndef ACCOUNT_H
#define ACCOUNT_H
#include <list>
#include <map>
#include <wx/wx.h>
class Account {
public:
wxString id;
wxString name;
wxString number;
bool shared;
bool _default;
};
#endif

14
src/model/Category.h Normal file
View File

@ -0,0 +1,14 @@
#ifndef CATEGORY_H
#define CATEGORY_H
class Category
{
public:
wxString id;
wxString parent;
wxString name;
wxColour color;
wxString font;
};
#endif

18
src/model/Operation.h Normal file
View File

@ -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

View File

View File

@ -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<unsigned int, std::vector<Operation> >::iterator it;
std::map<int, std::vector<int> > ops ;
std::vector<int>::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);

View File

@ -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 <controller/KissCount.h>
#include "wxUI.h"

View File

@ -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);

View File

@ -7,13 +7,13 @@
#include <controller/KissCount.h>
#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;