summaryrefslogtreecommitdiff
path: root/src/frontend/profile/cprofile.h
blob: 49f241a663014b64cb7644d096de47451b060ebc (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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/*********
*
* 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 CPROFILE_H
#define CPROFILE_H

#include "cprofilewindow.h"
#include "frontend/cmdiarea.h"

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

namespace Profile {

/** Manages one profile file. Provides functions to save and restore settings of the available display windows.
  * @author The BibleTime team
  */
class CProfile {
    public:
        CProfile(const QString& fileName, const QString& name = QString::null);
        ~CProfile();

        /**
        * Saves the profile to the file given in the constructor.
        * @param windows The list of windows available in the profile.
        */
        bool save( QList<CProfileWindow*> windows );
        /**
        * Saves the profile to the file given in the constructor.
        */
        bool save();
        /**
        * Loads the profile from the file given in the constructor.
        * @return The list of profiled window which exist in the profile.
        */
        QList<CProfileWindow*> load();
        /**
        * Returns the name of this profile.
        */
        const QString& name();
        /**
        * Returns the filename used for this profile.
        */
        const QString& filename();
        /**
        * Initializes the XML for the first time (use to create a new profile)
        */
        void init(const QString);
        /**
        * Chnages the name of this profile.
        */
        void setName( const QString& );
        /**
        * Returns true if the main window was in fullscreen mode as the profile was saved.
        */
        bool fullscreen() const;
        /**
        * Set the parameter to true if the main window coveres the full screen size.
        */
        void setFullscreen( const bool fullscreen );
        /**
        * Returns true if the main window was maximized as the profile was saved.
        */
        bool maximized() const;
        /**
        * Set the parameter to true if the main window is maximized.
        */
        void setMaximized( const bool maximized );
        /**
        * Sets the geoemtry of the main window
        */
        void setGeometry( const QRect rect );
        /**
        * Returns the geometry of the main window
        */
        const QRect geometry();
        /**
        * Sets the MDI arrangement mode
        */
        void setMDIArrangementMode(const CMDIArea::MDIArrangementMode);
        /**
        * Returns mdi arrangement mode
        */
        CMDIArea::MDIArrangementMode getMDIArrangementMode(void);
        /**
        * set mainwindow saveState - position of docking windows and toolbar
        */
        void setMainwindowState(const QByteArray& state);
        /**
         * Return mainwindow saveState - position of docking windows and toolbar
        */
        QByteArray getMainwindowState();

    private:
        /**
        * Loads the basic settings requires for proper operation.
        */
        void loadBasics();
        void saveBasics();

        QList<CProfileWindow*> m_profileWindows;
        QString m_name;
        QString m_filename;
        bool m_fullscreen;
        bool m_maximized;
        QRect m_geometry;
        CMDIArea::MDIArrangementMode m_mdiArrangementMode;
        QByteArray m_mainwindowState;
};

} //end of namespace Profile

#endif