Temp commit
This commit is contained in:
parent
6773ef05dd
commit
2c56271e1b
35
Makefile
35
Makefile
|
@ -11,6 +11,8 @@ CXXFLAGS+=-DRESSOURCES_ROOT="\"$(SHARE_DIR)\""
|
||||||
#CXXFLAGS+=-DRESSOURCES_ROOT="\"./ressources/\""
|
#CXXFLAGS+=-DRESSOURCES_ROOT="\"./ressources/\""
|
||||||
|
|
||||||
LDFLAGS+=`wx-config --libs`
|
LDFLAGS+=`wx-config --libs`
|
||||||
|
LDFLAGS+=-lofx
|
||||||
|
|
||||||
ifdef WIN32
|
ifdef WIN32
|
||||||
LDFLAGS+=-L./lib/wxsqlite3-1.9.9/lib/ -lwxcode_msw_wxsqlite3-2.8
|
LDFLAGS+=-L./lib/wxsqlite3-1.9.9/lib/ -lwxcode_msw_wxsqlite3-2.8
|
||||||
LDFLAGS+=-L./lib/freechart/lib -lwxcode_msw_freechart-2.8
|
LDFLAGS+=-L./lib/freechart/lib -lwxcode_msw_freechart-2.8
|
||||||
|
@ -21,25 +23,32 @@ endif
|
||||||
|
|
||||||
CXX=$(PREFIX)g++
|
CXX=$(PREFIX)g++
|
||||||
|
|
||||||
SOURCES=$(wildcard src/model/*.cpp)
|
# SOURCES=$(wildcard src/model/*.cpp)
|
||||||
SOURCES+=$(wildcard src/view/*.cpp)
|
# SOURCES+=$(wildcard src/model/import/*.cpp)
|
||||||
SOURCES+=$(wildcard src/view/grid/*.cpp)
|
# SOURCES+=$(wildcard src/model/export/*.cpp)
|
||||||
SOURCES+=$(wildcard src/controller/*.cpp)
|
# SOURCES+=$(wildcard src/view/*.cpp)
|
||||||
SOURCES+=src/main.cpp src/sha1.cpp src/ParseExp.cpp
|
# SOURCES+=$(wildcard src/view/grid/*.cpp)
|
||||||
HEADERS=$(wildcard src/model/*.h)
|
# SOURCES+=$(wildcard src/controller/*.cpp)
|
||||||
HEADERS+=$(wildcard src/view/*.h)
|
# SOURCES+=$(wildcard src/*.cpp)
|
||||||
HEADERS+=$(wildcard src/view/grid/*.h)
|
SOURCES=$(shell find src -name '*.cpp' -type f | tr '\n' ' ')
|
||||||
HEADERS+=$(wildcard src/controller/*.h)
|
# HEADERS=$(wildcard src/model/*.h)
|
||||||
HEADERS+=src/main.h src/sha1.h
|
# HEADERS+=$(wildcard src/model/import/*.h)
|
||||||
|
# HEADERS+=$(wildcard src/model/export/*.h)
|
||||||
|
# HEADERS+=$(wildcard src/view/*.h)
|
||||||
|
# HEADERS+=$(wildcard src/view/grid/*.h)
|
||||||
|
# HEADERS+=$(wildcard src/controller/*.h)
|
||||||
|
# HEADERS+=$(wildcard src/*.h)
|
||||||
|
HEADERS=$(shell find src -name '*.h' -type f)
|
||||||
OBJS=$(SOURCES:.cpp=.o)
|
OBJS=$(SOURCES:.cpp=.o)
|
||||||
|
|
||||||
all: check kc
|
all: check kc
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *~ src/*~ src/*.o src/model/*.o src/model/*~ src/view/*.o src/view/grid/*.o src/view/grid/*~ src/view/*~ src/controller/*.o src/controller/*~ kc
|
find src -type f -name '*.[o~]' -exec rm -f \{\} \;
|
||||||
|
rm -f kc
|
||||||
|
|
||||||
%.o : src/model/%.cpp src/view/%.cpp src/view/grid/%.cpp src/controller/%.cpp src/%.cpp
|
%.o : src/model/%.cpp src/model/import/%.cpp src/model/export/%.cpp src/view/%.cpp src/view/grid/%.cpp src/controller/%.cpp src/%.cpp
|
||||||
$(CXX) $(CXXFLAGS) $< -c
|
$(CXX) $(CXXFLAGS) -c $<
|
||||||
|
|
||||||
check:
|
check:
|
||||||
if ! test -d lib ; then echo lib directory not found, please see INSTALL ; return 1 ; fi
|
if ! test -d lib ; then echo lib directory not found, please see INSTALL ; return 1 ; fi
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
|
|
||||||
#include "KissCount.h"
|
#include "KissCount.h"
|
||||||
|
|
||||||
|
std::vector<ImportEngine*> KissCount::_importEngines;
|
||||||
|
|
||||||
KissCount::KissCount(const char* bdd_filename) : _user(NULL)
|
KissCount::KissCount(const char* bdd_filename) : _user(NULL)
|
||||||
{
|
{
|
||||||
wxRect rect = wxDisplay().GetGeometry();
|
wxRect rect = wxDisplay().GetGeometry();
|
||||||
|
@ -40,7 +42,7 @@ KissCount::KissCount(const char* bdd_filename) : _user(NULL)
|
||||||
_wxUI->Close(true);
|
_wxUI->Close(true);
|
||||||
throw s;
|
throw s;
|
||||||
}
|
}
|
||||||
|
|
||||||
_wxUI->ChangeUser();
|
_wxUI->ChangeUser();
|
||||||
_wxUI->Enable();
|
_wxUI->Enable();
|
||||||
}
|
}
|
||||||
|
@ -561,3 +563,46 @@ wxString KissCount::CompactFont(const wxFont& font)
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void KissCount::UnRegisterImportEngine(ImportEngine* engine)
|
||||||
|
{
|
||||||
|
std::vector<ImportEngine*>::iterator it;
|
||||||
|
|
||||||
|
for(it=_importEngines.begin(); it!=_importEngines.end(); it++)
|
||||||
|
if (*it == engine)
|
||||||
|
{
|
||||||
|
_importEngines.erase(it);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void KissCount::RegisterImportEngine(ImportEngine* engine)
|
||||||
|
{
|
||||||
|
_importEngines.push_back(engine);
|
||||||
|
}
|
||||||
|
|
||||||
|
wxString KissCount::GetImportEngineExtensions()
|
||||||
|
{
|
||||||
|
wxString res;
|
||||||
|
std::vector<ImportEngine*>::iterator it;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for(i=0; i<(int)_importEngines.size()-1; i++)
|
||||||
|
res = res + _importEngines[i]->GetFileExt() + wxT("|") ;
|
||||||
|
|
||||||
|
if (_importEngines.size())
|
||||||
|
res = res + _importEngines[i]->GetFileExt();
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
ImportEngine* KissCount::GetImportEngine(wxString path)
|
||||||
|
{
|
||||||
|
std::vector<ImportEngine*>::iterator it;
|
||||||
|
|
||||||
|
for(it=_importEngines.begin(); it!=_importEngines.end(); it++)
|
||||||
|
if ((*it)->HandleFile(path, _user, _db))
|
||||||
|
return *it;
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
|
#include <model/import/ImportEngine.h>
|
||||||
#include <model/model.h>
|
#include <model/model.h>
|
||||||
#include <view/wxUI.h>
|
#include <view/wxUI.h>
|
||||||
|
|
||||||
|
@ -33,6 +34,7 @@
|
||||||
|
|
||||||
class wxUI;
|
class wxUI;
|
||||||
class Database;
|
class Database;
|
||||||
|
class ImportEngine;
|
||||||
|
|
||||||
class KissCount
|
class KissCount
|
||||||
{
|
{
|
||||||
|
@ -102,10 +104,17 @@ public:
|
||||||
static wxFont ExtractFont(wxString strFont);
|
static wxFont ExtractFont(wxString strFont);
|
||||||
static wxString CompactFont(const wxFont& font);
|
static wxString CompactFont(const wxFont& font);
|
||||||
|
|
||||||
|
static void RegisterImportEngine(ImportEngine* engine);
|
||||||
|
static void UnRegisterImportEngine(ImportEngine* engine);
|
||||||
|
|
||||||
|
wxString GetImportEngineExtensions();
|
||||||
|
ImportEngine* GetImportEngine(wxString path);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxUI* _wxUI;
|
wxUI* _wxUI;
|
||||||
Database* _db;
|
Database* _db;
|
||||||
User* _user;
|
User* _user;
|
||||||
|
static std::vector<ImportEngine*> _importEngines;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -30,8 +30,8 @@
|
||||||
#include <wx/file.h>
|
#include <wx/file.h>
|
||||||
#include <sha1.h>
|
#include <sha1.h>
|
||||||
|
|
||||||
#include "model.h"
|
|
||||||
#include "../controller/KissCount.h"
|
#include "../controller/KissCount.h"
|
||||||
|
#include "model.h"
|
||||||
|
|
||||||
#define DATABASE_VERSION 2
|
#define DATABASE_VERSION 2
|
||||||
|
|
||||||
|
|
|
@ -25,9 +25,9 @@ class Database;
|
||||||
class Account;
|
class Account;
|
||||||
class Operation;
|
class Operation;
|
||||||
|
|
||||||
#include "User.h"
|
#include <model/User.h>
|
||||||
#include "Database.h"
|
#include <model/Database.h>
|
||||||
#include "Account.h"
|
#include <model/Account.h>
|
||||||
#include "Operation.h"
|
#include <model/Operation.h>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -43,10 +43,13 @@ enum {TREE, DESCRIPTION, OP_DATE, DEBIT, CREDIT, CATEGORY, ACCOUNT, OP_DELETE, C
|
||||||
|
|
||||||
enum {GRID_ID};
|
enum {GRID_ID};
|
||||||
|
|
||||||
GridAccount::GridAccount(KissCount* kiss, wxWindow *parent, wxWindowID id) : wxGrid(parent, id), _fixCosts(0), _week1(0),
|
GridAccount::GridAccount(KissCount* kiss, wxWindow *parent, wxWindowID id,
|
||||||
_week2(0), _week3(0), _week4(0), _parent(parent), _kiss(kiss),
|
bool canAddOperation, bool setWeek, bool synchronizeWithDatabase)
|
||||||
_loadOperations(false),
|
: wxGrid(parent, id), _fixCosts(0), _week1(0),
|
||||||
_curMonth(0), _curYear(0)
|
_week2(0), _week3(0), _week4(0), _parent(parent), _kiss(kiss),
|
||||||
|
_canAddOperation(canAddOperation), _setWeek(setWeek),
|
||||||
|
_databaseSynchronization(synchronizeWithDatabase), _loadOperations(false),
|
||||||
|
_curMonth(0), _curYear(0)
|
||||||
{
|
{
|
||||||
wxBitmap deleteBitmap(wxT(DELETE_ICON), wxBITMAP_TYPE_PNG);
|
wxBitmap deleteBitmap(wxT(DELETE_ICON), wxBITMAP_TYPE_PNG);
|
||||||
wxBitmap checkedBitmap(wxT(CHECKED_ICON), wxBITMAP_TYPE_PNG);
|
wxBitmap checkedBitmap(wxT(CHECKED_ICON), wxBITMAP_TYPE_PNG);
|
||||||
|
@ -174,6 +177,13 @@ int GridAccount::GetDisplayedRow(const wxString& id)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GridAccount::ClearGrid()
|
||||||
|
{
|
||||||
|
std::vector<Operation> operations;
|
||||||
|
|
||||||
|
LoadOperations(&operations, false, false, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
void GridAccount::LoadOperations(std::vector<Operation>* operations, bool canAddOperation, bool setWeek, int month, int year)
|
void GridAccount::LoadOperations(std::vector<Operation>* operations, bool canAddOperation, bool setWeek, int month, int year)
|
||||||
{
|
{
|
||||||
std::vector<Operation>::iterator it;
|
std::vector<Operation>::iterator it;
|
||||||
|
|
|
@ -41,13 +41,15 @@ typedef void (*updateOperationFunc)(Operation* op, void** params);
|
||||||
class GridAccount : public wxGrid
|
class GridAccount : public wxGrid
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GridAccount(KissCount* kiss, wxWindow *parent, wxWindowID id);
|
GridAccount(KissCount* kiss, wxWindow *parent, wxWindowID id,
|
||||||
|
bool canAddOperation, bool setWeek, bool synchronizeWithDatabase);
|
||||||
~GridAccount();
|
~GridAccount();
|
||||||
|
|
||||||
wxPen GetColGridLinePen (int col);
|
wxPen GetColGridLinePen (int col);
|
||||||
wxPen GetRowGridLinePen (int row);
|
wxPen GetRowGridLinePen (int row);
|
||||||
|
|
||||||
void LoadOperations(std::vector<Operation>* operations, bool canAddOperation, bool setWeek, int month, int year);
|
virtual void ClearGrid();
|
||||||
|
void LoadOperations(std::vector<Operation>* operations, int month, int year);
|
||||||
void InsertOperationWithWeek(User* user, Operation& op, int line, bool fix, int month, int year) ;
|
void InsertOperationWithWeek(User* user, Operation& op, int line, bool fix, int month, int year) ;
|
||||||
void InsertOperation(User* user, Operation& op, int line, bool fix, int month, int year) ;
|
void InsertOperation(User* user, Operation& op, int line, bool fix, int month, int year) ;
|
||||||
|
|
||||||
|
@ -69,6 +71,8 @@ private:
|
||||||
wxWindow* _parent;
|
wxWindow* _parent;
|
||||||
KissCount* _kiss;
|
KissCount* _kiss;
|
||||||
bool _displayLines;
|
bool _displayLines;
|
||||||
|
bool _canAddOperation, setWeek;
|
||||||
|
bool _databaseSynchronization;
|
||||||
wxString* _categories, *_accounts;
|
wxString* _categories, *_accounts;
|
||||||
std::vector<Operation>* _operations;
|
std::vector<Operation>* _operations;
|
||||||
bool _canAddOperation, _loadOperations;
|
bool _canAddOperation, _loadOperations;
|
||||||
|
|
|
@ -154,6 +154,7 @@ void wxUI::InitPanels()
|
||||||
ADD_PANEL(StatsPanel, 1);
|
ADD_PANEL(StatsPanel, 1);
|
||||||
ADD_PANEL(SearchPanel, 2);
|
ADD_PANEL(SearchPanel, 2);
|
||||||
ADD_PANEL(PreferencesPanel, 3);
|
ADD_PANEL(PreferencesPanel, 3);
|
||||||
|
ADD_PANEL(ImportPanel, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxUI::LoadPanels()
|
void wxUI::LoadPanels()
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
#ifndef WXUI_H
|
#ifndef WXUI_H
|
||||||
#define WXUI_H
|
#define WXUI_H
|
||||||
|
|
||||||
|
class ImportEngine;
|
||||||
|
|
||||||
#include <wx/wx.h>
|
#include <wx/wx.h>
|
||||||
#include "AccountPanel.h"
|
#include "AccountPanel.h"
|
||||||
#include "PreferencesPanel.h"
|
#include "PreferencesPanel.h"
|
||||||
|
@ -27,6 +29,7 @@
|
||||||
#include "GenerateDialog.h"
|
#include "GenerateDialog.h"
|
||||||
#include "SearchPanel.h"
|
#include "SearchPanel.h"
|
||||||
#include "StatsPanel.h"
|
#include "StatsPanel.h"
|
||||||
|
#include "ImportPanel.h"
|
||||||
#include <controller/KissCount.h>
|
#include <controller/KissCount.h>
|
||||||
#include "grid/wxMyGrid.h"
|
#include "grid/wxMyGrid.h"
|
||||||
#include "grid/wxGridCellFastBoolEditor.h"
|
#include "grid/wxGridCellFastBoolEditor.h"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user