Possibility pass bdd file to load at startup
This commit is contained in:
parent
9f7d858bc3
commit
fb1007bfcb
1
TODO
1
TODO
|
@ -14,7 +14,6 @@ Others translation
|
||||||
Handle bad SQL return
|
Handle bad SQL return
|
||||||
Category color/font
|
Category color/font
|
||||||
Button tooltip not translated
|
Button tooltip not translated
|
||||||
Do not consider account transferts into statistics
|
|
||||||
|
|
||||||
===============================================================
|
===============================================================
|
||||||
Next version
|
Next version
|
||||||
|
|
Binary file not shown.
|
@ -2,7 +2,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: \n"
|
"Project-Id-Version: \n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2010-08-21 11:44+0200\n"
|
"POT-Creation-Date: 2010-08-22 16:33+0200\n"
|
||||||
"PO-Revision-Date: \n"
|
"PO-Revision-Date: \n"
|
||||||
"Last-Translator: Soutadé <soutade@gmail.com>\n"
|
"Last-Translator: Soutadé <soutade@gmail.com>\n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
|
@ -36,7 +36,7 @@ msgstr " existe déjà "
|
||||||
msgid " entries found"
|
msgid " entries found"
|
||||||
msgstr " entrées trouvées"
|
msgstr " entrées trouvées"
|
||||||
|
|
||||||
#: src/model/Database.cpp:102
|
#: src/model/Database.cpp:130
|
||||||
msgid " not found, aborting"
|
msgid " not found, aborting"
|
||||||
msgstr " non trouvé, arrêt"
|
msgstr " non trouvé, arrêt"
|
||||||
|
|
||||||
|
@ -207,8 +207,12 @@ msgstr "Décroissant"
|
||||||
msgid "Description"
|
msgid "Description"
|
||||||
msgstr "Description"
|
msgstr "Description"
|
||||||
|
|
||||||
#: src/model/Database.cpp:102
|
#: src/model/Database.cpp:84
|
||||||
#: src/model/Database.cpp:125
|
#: src/model/Database.cpp:91
|
||||||
|
#: src/model/Database.cpp:109
|
||||||
|
#: src/model/Database.cpp:130
|
||||||
|
#: src/model/Database.cpp:138
|
||||||
|
#: src/model/Database.cpp:159
|
||||||
#: src/view/PasswordDialog.cpp:72
|
#: src/view/PasswordDialog.cpp:72
|
||||||
#: src/view/PasswordDialog.cpp:78
|
#: src/view/PasswordDialog.cpp:78
|
||||||
#: src/view/PreferencesPanel.cpp:336
|
#: src/view/PreferencesPanel.cpp:336
|
||||||
|
@ -228,7 +232,7 @@ msgstr "Description"
|
||||||
msgid "Error"
|
msgid "Error"
|
||||||
msgstr "Erreur"
|
msgstr "Erreur"
|
||||||
|
|
||||||
#: src/model/Database.cpp:125
|
#: src/model/Database.cpp:159
|
||||||
msgid "Error creating original database"
|
msgid "Error creating original database"
|
||||||
msgstr "Erreur durant la création de la base de données initiale"
|
msgstr "Erreur durant la création de la base de données initiale"
|
||||||
|
|
||||||
|
@ -236,7 +240,7 @@ msgstr "Erreur durant la création de la base de données initiale"
|
||||||
msgid "Final value"
|
msgid "Final value"
|
||||||
msgstr "Valeur finale"
|
msgstr "Valeur finale"
|
||||||
|
|
||||||
#: src/model/Database.cpp:260
|
#: src/model/Database.cpp:294
|
||||||
#: src/controller/KissCount.cpp:276
|
#: src/controller/KissCount.cpp:276
|
||||||
#: src/view/GridAccount.cpp:126
|
#: src/view/GridAccount.cpp:126
|
||||||
msgid "Fix"
|
msgid "Fix"
|
||||||
|
@ -352,7 +356,7 @@ msgstr "Nouvel utilisateur"
|
||||||
msgid "New password "
|
msgid "New password "
|
||||||
msgstr "Nouveau mot de passe"
|
msgstr "Nouveau mot de passe"
|
||||||
|
|
||||||
#: src/model/Database.cpp:96
|
#: src/model/Database.cpp:124
|
||||||
msgid "No database found, creating a new one"
|
msgid "No database found, creating a new one"
|
||||||
msgstr "Aucune base de données trouvée, création d'une nouvelle"
|
msgstr "Aucune base de données trouvée, création d'une nouvelle"
|
||||||
|
|
||||||
|
@ -466,6 +470,13 @@ msgstr "Total Crédit"
|
||||||
msgid "Total Debit"
|
msgid "Total Debit"
|
||||||
msgstr "Total Débit"
|
msgstr "Total Débit"
|
||||||
|
|
||||||
|
#: src/model/Database.cpp:84
|
||||||
|
#: src/model/Database.cpp:91
|
||||||
|
#: src/model/Database.cpp:109
|
||||||
|
#: src/model/Database.cpp:138
|
||||||
|
msgid "Unable to open Database"
|
||||||
|
msgstr "Impossible d'ouvrir la base de données"
|
||||||
|
|
||||||
#: src/controller/KissCount.cpp:284
|
#: src/controller/KissCount.cpp:284
|
||||||
msgid "Unexpected"
|
msgid "Unexpected"
|
||||||
msgstr "Exceptionnel"
|
msgstr "Exceptionnel"
|
||||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2010-08-21 11:44+0200\n"
|
"POT-Creation-Date: 2010-08-22 16:33+0200\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
@ -30,7 +30,7 @@ msgstr ""
|
||||||
msgid " entries found"
|
msgid " entries found"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/model/Database.cpp:102
|
#: src/model/Database.cpp:130
|
||||||
msgid " not found, aborting"
|
msgid " not found, aborting"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -190,7 +190,9 @@ msgstr ""
|
||||||
msgid "Description"
|
msgid "Description"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/model/Database.cpp:102 src/model/Database.cpp:125
|
#: src/model/Database.cpp:84 src/model/Database.cpp:91
|
||||||
|
#: src/model/Database.cpp:109 src/model/Database.cpp:130
|
||||||
|
#: src/model/Database.cpp:138 src/model/Database.cpp:159
|
||||||
#: src/view/PasswordDialog.cpp:72 src/view/PasswordDialog.cpp:78
|
#: src/view/PasswordDialog.cpp:72 src/view/PasswordDialog.cpp:78
|
||||||
#: src/view/PreferencesPanel.cpp:336 src/view/PreferencesPanel.cpp:359
|
#: src/view/PreferencesPanel.cpp:336 src/view/PreferencesPanel.cpp:359
|
||||||
#: src/view/PreferencesPanel.cpp:378 src/view/PreferencesPanel.cpp:468
|
#: src/view/PreferencesPanel.cpp:378 src/view/PreferencesPanel.cpp:468
|
||||||
|
@ -202,7 +204,7 @@ msgstr ""
|
||||||
msgid "Error"
|
msgid "Error"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/model/Database.cpp:125
|
#: src/model/Database.cpp:159
|
||||||
msgid "Error creating original database"
|
msgid "Error creating original database"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -210,7 +212,7 @@ msgstr ""
|
||||||
msgid "Final value"
|
msgid "Final value"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/model/Database.cpp:260 src/controller/KissCount.cpp:276
|
#: src/model/Database.cpp:294 src/controller/KissCount.cpp:276
|
||||||
#: src/view/GridAccount.cpp:126
|
#: src/view/GridAccount.cpp:126
|
||||||
msgid "Fix"
|
msgid "Fix"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -321,7 +323,7 @@ msgstr ""
|
||||||
msgid "New password "
|
msgid "New password "
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/model/Database.cpp:96
|
#: src/model/Database.cpp:124
|
||||||
msgid "No database found, creating a new one"
|
msgid "No database found, creating a new one"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -427,6 +429,11 @@ msgstr ""
|
||||||
msgid "Total Debit"
|
msgid "Total Debit"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/model/Database.cpp:84 src/model/Database.cpp:91
|
||||||
|
#: src/model/Database.cpp:109 src/model/Database.cpp:138
|
||||||
|
msgid "Unable to open Database"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: src/controller/KissCount.cpp:284
|
#: src/controller/KissCount.cpp:284
|
||||||
msgid "Unexpected"
|
msgid "Unexpected"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
|
@ -19,7 +19,7 @@ along with KissCount. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include "KissCount.h"
|
#include "KissCount.h"
|
||||||
|
|
||||||
KissCount::KissCount() : _user(NULL)
|
KissCount::KissCount(const char* bdd_filename) : _user(NULL)
|
||||||
{
|
{
|
||||||
_wxUI = new wxUI(this, wxT("KissCount"), wxPoint(50, 50), wxSize(1024, 768));
|
_wxUI = new wxUI(this, wxT("KissCount"), wxPoint(50, 50), wxSize(1024, 768));
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ KissCount::KissCount() : _user(NULL)
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_db = new Database();
|
_db = new Database(bdd_filename);
|
||||||
}
|
}
|
||||||
catch (std::string s)
|
catch (std::string s)
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,7 +33,7 @@ class wxUI;
|
||||||
class KissCount
|
class KissCount
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
KissCount();
|
KissCount(const char* bdd_filename);
|
||||||
~KissCount();
|
~KissCount();
|
||||||
|
|
||||||
std::list<wxString> GetUsers();
|
std::list<wxString> GetUsers();
|
||||||
|
|
30
src/main.cpp
30
src/main.cpp
|
@ -25,7 +25,10 @@ class MyApp: public wxApp
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
new KissCount();
|
if (argc == 2)
|
||||||
|
new KissCount(wxString(argv[1]).mb_str());
|
||||||
|
else
|
||||||
|
new KissCount(NULL);
|
||||||
}
|
}
|
||||||
catch (std::string s)
|
catch (std::string s)
|
||||||
{
|
{
|
||||||
|
@ -38,28 +41,3 @@ class MyApp: public wxApp
|
||||||
};
|
};
|
||||||
|
|
||||||
IMPLEMENT_APP(MyApp);
|
IMPLEMENT_APP(MyApp);
|
||||||
|
|
||||||
// bool MyApp::OnInit()
|
|
||||||
// {
|
|
||||||
// Main app;
|
|
||||||
|
|
||||||
// MyFrame *frame = new MyFrame( _("Hello World"), wxPoint(50, 50), wxSize(1024, 768) );
|
|
||||||
// AccountPanel* f = new AccountPanel(frame);
|
|
||||||
// frame->Show(true);
|
|
||||||
// SetTopWindow(frame);
|
|
||||||
|
|
||||||
// frame->Centre();
|
|
||||||
// frame->Disable();
|
|
||||||
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// app.Init();
|
|
||||||
// }
|
|
||||||
// catch (std::string s)
|
|
||||||
// {
|
|
||||||
// std::cout << "Error " << s << "\n";
|
|
||||||
// frame->Close(true);
|
|
||||||
// }
|
|
||||||
// frame->Enable();
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
|
|
|
@ -71,18 +71,46 @@ static inline wxString DoubleToString(double d)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
Database::Database()
|
Database::Database(const char* filename)
|
||||||
{
|
{
|
||||||
std::ifstream bdd_file;
|
std::ifstream bdd_file;
|
||||||
|
|
||||||
bdd_file.open(BDD_FILE);
|
if (filename)
|
||||||
|
{
|
||||||
|
bdd_file.open(filename, std::ifstream::in);
|
||||||
|
|
||||||
if (!bdd_file)
|
if (!bdd_file.good())
|
||||||
|
{
|
||||||
|
wxMessageBox(_("Unable to open Database"), _("Error"), wxICON_ERROR | wxOK );
|
||||||
|
throw std::string("Unable to open ") + filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
_db.Open(wxString(filename, wxConvUTF8));
|
||||||
|
if (!_db.IsOpen())
|
||||||
|
{
|
||||||
|
wxMessageBox(_("Unable to open Database"), _("Error"), wxICON_ERROR | wxOK );
|
||||||
|
throw std::string("Unable to open ") + filename;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// If default BDD file, assume this can be the first load
|
||||||
|
bdd_file.open(BDD_FILE, std::ifstream::in);
|
||||||
|
|
||||||
|
if (!bdd_file.good())
|
||||||
{
|
{
|
||||||
CreateDatabase();
|
CreateDatabase();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
_db.Open(wxT(BDD_FILE));
|
_db.Open(wxT(BDD_FILE));
|
||||||
|
if (!_db.IsOpen())
|
||||||
|
{
|
||||||
|
wxMessageBox(_("Unable to open Database"), _("Error"), wxICON_ERROR | wxOK );
|
||||||
|
throw std::string("Unable to open ") + BDD_FILE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bdd_file.close();
|
bdd_file.close();
|
||||||
}
|
}
|
||||||
|
@ -105,6 +133,12 @@ void Database::CreateDatabase()
|
||||||
|
|
||||||
_db.Open(wxT(BDD_FILE));
|
_db.Open(wxT(BDD_FILE));
|
||||||
|
|
||||||
|
if (!_db.IsOpen())
|
||||||
|
{
|
||||||
|
wxMessageBox(_("Unable to open Database"), _("Error"), wxICON_ERROR | wxOK );
|
||||||
|
throw std::string("Unable to open ") + BDD_FILE;
|
||||||
|
}
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
getline(init_script, line);
|
getline(init_script, line);
|
||||||
|
|
|
@ -35,7 +35,7 @@ along with KissCount. If not, see <http://www.gnu.org/licenses/>.
|
||||||
class Database
|
class Database
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Database();
|
Database(const char* filename);
|
||||||
|
|
||||||
std::list<wxString> GetUsers();
|
std::list<wxString> GetUsers();
|
||||||
bool IsValidUser(const wxString& user, const wxString& password);
|
bool IsValidUser(const wxString& user, const wxString& password);
|
||||||
|
|
|
@ -11,9 +11,9 @@ make clean
|
||||||
fi
|
fi
|
||||||
make || (echo "Compilation failed" ; exit 1)
|
make || (echo "Compilation failed" ; exit 1)
|
||||||
mkdir -p $DIR/lib
|
mkdir -p $DIR/lib
|
||||||
find $DIR -type f -exec strip \{\} \;
|
|
||||||
cp -r lib/freechart/lib/* lib/wxsqlite3-1.9.9/lib/* $DIR/lib
|
cp -r lib/freechart/lib/* lib/wxsqlite3-1.9.9/lib/* $DIR/lib
|
||||||
cp -r kc init.sql ressources tools/launch_kc.sh TODO CONTRIBUTORS COPYING README README.fr $DIR
|
cp -r kc init.sql ressources tools/launch_kc.sh TODO CONTRIBUTORS COPYING README README.fr $DIR
|
||||||
|
find $DIR -type f -executable -exec strip \{\} \;
|
||||||
tar -jcf $FILE $DIR
|
tar -jcf $FILE $DIR
|
||||||
rm -rf $DIR
|
rm -rf $DIR
|
||||||
echo "Packaged !"
|
echo "Packaged !"
|
Loading…
Reference in New Issue
Block a user