defuze.me  Client
dbcore.hpp
00001 /**************************************************************************
00002 ** defuze.me Epitech Innovative Project
00003 **
00004 ** Copyright 2010
00005 **   Athena Calmettes - Jocelyn De La Rosa - Francois Gaillard
00006 **   Adrien Jarthon - Alexandre Moore - Luc Peres - Arnaud Sellier
00007 **
00008 ** All rights reserved.
00009 **************************************************************************/
00010 
00011 namespace DB {
00012     class DBCore;
00013 }
00014 
00015 #ifndef DBCORE_HPP
00016 #define DBCORE_HPP
00017 
00018 #include <QSqlDatabase>
00019 #include <QSqlQuery>
00020 #include <QSqlError>
00021 #include <QSqlRecord>
00022 #include <QVariant>
00023 #include <QStringList>
00024 #include <QDesktopServices>
00025 #include "core.hpp"
00026 #include "migration.hpp"
00027 #include "location.hpp"
00028 #include "parameterizable.hpp"
00029 
00030 namespace DB
00031 {
00032 
00036     class DBCore : public Core, public Params::Parameterizable
00037     {
00038     public:
00039         DBCore(QStringList &arguments);
00040         ~DBCore();
00041         void                        init(Cores* cores);
00042         void                        aboutToQuit();
00043         bool                        openLocation(Location* loc);                                    
00044         QVariant                    setting(const QString& key) const;                              
00045         QHash< QString, QVariant>   settingsStartingWith(const QString& key) const;                 
00046         bool                        setSetting(const QString& key, const QVariant value) const;     
00047         int                         currentMigration() const;                                       
00048         void                        backupAll();                                                    
00049         void                        test();                                                         
00050 
00051     private:
00052         void                        defineParams();
00053         void                        loadLocations();                                                
00054         void                        saveLocations();                                                
00055 
00056         QList<Location*>            locations;                                                      
00057         QSqlDatabase                connection;
00058         Location*                   currentLocation;
00059     };
00060 }
00061 
00062 #endif // DBCORE_HPP