xref: /glogg/src/sessioninfo.h (revision bb02e0acf44ddb4e4f83d6127a1e488789162922)
1 /*
2  * Copyright (C) 2011 Nicolas Bonnefon and other contributors
3  *
4  * This file is part of glogg.
5  *
6  * glogg is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * glogg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with glogg.  If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef SESSIONINFO_H
21 #define SESSIONINFO_H
22 
23 #include <QByteArray>
24 #include <QString>
25 
26 #include "persistable.h"
27 
28 // Simple component class containing information related to the session
29 // to be persisted and reloaded upon start
30 class SessionInfo : public Persistable {
31   public:
32     SessionInfo() { }
33 
34     // Geometry of the main window
35     QByteArray geometry() const
36     { return geometry_; }
37     void setGeometry( const QByteArray& geometry )
38     { geometry_ = geometry; }
39     // Geometry of the CrawlerWidget
40     QByteArray crawlerState() const
41     { return crawlerState_; }
42     void setCrawlerState( const QByteArray& geometry )
43     { crawlerState_ = geometry; }
44     // Name of the current (last loaded) file
45     QString currentFile() const
46     { return currentFile_; }
47     void setCurrentFile( const QString& filename )
48     { currentFile_ = filename; }
49 
50     // Reads/writes the current config in the QSettings object passed
51     virtual void saveToStorage( QSettings& settings ) const;
52     virtual void retrieveFromStorage( QSettings& settings );
53 
54   private:
55     QByteArray geometry_;
56     QByteArray crawlerState_;
57     QString    currentFile_;
58 };
59 
60 #endif
61