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