1 /* 2 * Copyright (C) 2011, 2014 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 <vector> 24 #include <string> 25 26 #include <QByteArray> 27 #include <QString> 28 29 #include "persistable.h" 30 31 // Simple component class containing information related to the session 32 // to be persisted and reloaded upon start 33 class SessionInfo : public Persistable { 34 public: 35 SessionInfo() : openFiles_() { } 36 37 // Geometry of the main window 38 /* 39 QByteArray geometry() const 40 { return geometry_; } 41 void setGeometry( const QByteArray& geometry ) 42 { geometry_ = geometry; } 43 // Geometry of the CrawlerWidget 44 QByteArray crawlerState() const 45 { return crawlerState_; } 46 void setCrawlerState( const QByteArray& geometry ) 47 { crawlerState_ = geometry; } 48 */ 49 struct OpenFile 50 { 51 std::string fileName; 52 uint64_t topLine; 53 // The view context contains parameter specific to the view's 54 // implementation (such as geometry...) 55 std::string viewContext; 56 }; 57 58 // List of the loaded files 59 std::vector<OpenFile> openFiles() const 60 { return openFiles_; } 61 void setOpenFiles( const std::vector<OpenFile>& loaded_files ) 62 { openFiles_ = loaded_files; } 63 64 // Reads/writes the current config in the QSettings object passed 65 virtual void saveToStorage( QSettings& settings ) const; 66 virtual void retrieveFromStorage( QSettings& settings ); 67 68 private: 69 static const int OPENFILES_VERSION; 70 71 QByteArray geometry_; 72 QByteArray crawlerState_; 73 std::vector<OpenFile> openFiles_; 74 }; 75 76 #endif 77