README
[n9profile] / profiledb.cpp
1 #include "profiledb.h"
2 #include <QtCore/QDebug> //Debug pro informace
3 #include <QtXml/QDomElement>
4 #include <QtCore/QStringList>
5 #include <QtCore/QTextStream>
6 #include <QtCore/QString>
7 #include "profil.h"
8 #include <QtGui/QStandardItemModel>
9
10 /** Constructor
11 Sets the pointer to the object to connect to deamon to NULL
12 */
13 ProfileDB::ProfileDB(QObject *parent) :
14         QObject(parent),
15         profile_manager(new ProfilesManager(this)),
16         sound_files_manager(new SoundFilesManager(this)),
17         rules_manager(new RulesManager(this))
18 {
19
20 }
21
22 /** Destructor
23 Deletes the object to connect to deamon
24 */
25 ProfileDB::~ProfileDB()
26 {
27
28 }
29
30 /** Init
31   Creates an object ProfileDeamon and connects via ProfileDeamon: ConnectToDeamon
32   Create a model that will list all audio files
33   Then initializes the XML file using InitFile()
34   If the file exists so it attempts to read with readfile()
35    and if not it creates and initializes using CreateFile()
36 */
37 bool ProfileDB::Init()
38 {
39     if(profile_manager->Init() == false){
40         return false;
41     }
42     if(sound_files_manager->Init(profile_manager->GetRootElement()) == false)
43     {
44         return false;
45     }
46     if(rules_manager->Init() == false)
47     {
48         return false;
49     }
50 return true;
51 }
52
53
54
55 //=============================================================
56 ProfilesManager *ProfileDB::GetProfileManager() const
57 {
58     return profile_manager;
59 }
60
61 SoundFilesManager *ProfileDB::GetSoundFilesManager() const
62 {
63     return sound_files_manager;
64 }
65
66 RulesManager *ProfileDB::GetRulesManager() const
67 {
68     return rules_manager;
69 }
70
71 void ProfileDB::SaveProfilesToXml()
72 {
73     profile_manager->SaveProfilesToXml();
74     rules_manager->SaveProfilesToXml();
75
76 }
77
78 //================================================================
79 //=============================================================================================================
80 //=============================================================================================================
81