summaryrefslogtreecommitdiff
path: root/src/frontend/profile/cprofilemgr.h
blob: 344333d294e0c3658bce5fcee3cac2216f3ae7c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*********
*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
* Copyright 1999-2008 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/



#ifndef CPROFILEMGR_H
#define CPROFILEMGR_H

#include "cprofile.h"

//Qt includes
#include <QString>
#include <QList>

namespace Profile {
/** The manager for profiles.
 * Provides functions to create, delete, save and load profiles.
 * @author The BibleTime team
 */
class CProfileMgr {
    public:
        CProfileMgr();
        ~CProfileMgr();

        /** Creates a new profile with the name "name" (first parameter).
        * @return The profile object
        */
        CProfile* create( const QString name );
        /**
        * @return a list of available profiles
        */
        const QList<CProfile*>& profiles();
        /**
        * Removes the profile from the list and from the directory containg the profile files.
        */
        bool remove( CProfile* p );
        /**
        * Removes the profile from the list and from the directory containg the profile files.
        */
        bool remove( const QString& );
        /**
        * Returns the profile with the desired name. If there's no such profile 0 is returned.
        */
        CProfile* profile(const QString&);
        /**
        * Returns the startup profile if it exists, otherwise return 0.
        */
        CProfile* startupProfile();
        /**
        * Refreshes the profiles available on disk. Use this function to update the list of profiles after another instance of CProfileMgr created a new profile.
        */
        void refresh();

    protected:
        QList<CProfile*> m_profiles;
        QString m_profilePath;
        CProfile* m_startupProfile;
};

} //end of namespace Profile

#endif