1bb02e0acSNicolas Bonnefon /* 2b57881faSNicolas Bonnefon * Copyright (C) 2011, 2014 Nicolas Bonnefon and other contributors 3bb02e0acSNicolas Bonnefon * 4bb02e0acSNicolas Bonnefon * This file is part of glogg. 5bb02e0acSNicolas Bonnefon * 6bb02e0acSNicolas Bonnefon * glogg is free software: you can redistribute it and/or modify 7bb02e0acSNicolas Bonnefon * it under the terms of the GNU General Public License as published by 8bb02e0acSNicolas Bonnefon * the Free Software Foundation, either version 3 of the License, or 9bb02e0acSNicolas Bonnefon * (at your option) any later version. 10bb02e0acSNicolas Bonnefon * 11bb02e0acSNicolas Bonnefon * glogg is distributed in the hope that it will be useful, 12bb02e0acSNicolas Bonnefon * but WITHOUT ANY WARRANTY; without even the implied warranty of 13bb02e0acSNicolas Bonnefon * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14bb02e0acSNicolas Bonnefon * GNU General Public License for more details. 15bb02e0acSNicolas Bonnefon * 16bb02e0acSNicolas Bonnefon * You should have received a copy of the GNU General Public License 17bb02e0acSNicolas Bonnefon * along with glogg. If not, see <http://www.gnu.org/licenses/>. 18bb02e0acSNicolas Bonnefon */ 19bb02e0acSNicolas Bonnefon 20bb02e0acSNicolas Bonnefon #ifndef SESSIONINFO_H 21bb02e0acSNicolas Bonnefon #define SESSIONINFO_H 22bb02e0acSNicolas Bonnefon 23b57881faSNicolas Bonnefon #include <vector> 24b57881faSNicolas Bonnefon #include <string> 25b57881faSNicolas Bonnefon 26bb02e0acSNicolas Bonnefon #include <QByteArray> 27bb02e0acSNicolas Bonnefon #include <QString> 28bb02e0acSNicolas Bonnefon 29bb02e0acSNicolas Bonnefon #include "persistable.h" 30bb02e0acSNicolas Bonnefon 31bb02e0acSNicolas Bonnefon // Simple component class containing information related to the session 32bb02e0acSNicolas Bonnefon // to be persisted and reloaded upon start 33bb02e0acSNicolas Bonnefon class SessionInfo : public Persistable { 34bb02e0acSNicolas Bonnefon public: 35b57881faSNicolas Bonnefon SessionInfo() : openFiles_() { } 36bb02e0acSNicolas Bonnefon 37bb02e0acSNicolas Bonnefon // Geometry of the main window 38b57881faSNicolas Bonnefon /* 39bb02e0acSNicolas Bonnefon QByteArray geometry() const 40bb02e0acSNicolas Bonnefon { return geometry_; } 41bb02e0acSNicolas Bonnefon void setGeometry( const QByteArray& geometry ) 42bb02e0acSNicolas Bonnefon { geometry_ = geometry; } 43bb02e0acSNicolas Bonnefon // Geometry of the CrawlerWidget 44bb02e0acSNicolas Bonnefon QByteArray crawlerState() const 45bb02e0acSNicolas Bonnefon { return crawlerState_; } 46bb02e0acSNicolas Bonnefon void setCrawlerState( const QByteArray& geometry ) 47bb02e0acSNicolas Bonnefon { crawlerState_ = geometry; } 48b57881faSNicolas Bonnefon */ 49b57881faSNicolas Bonnefon struct OpenFile 50b57881faSNicolas Bonnefon { 51b57881faSNicolas Bonnefon std::string fileName; 52b57881faSNicolas Bonnefon uint64_t topLine; 53*a44d09bcSNicolas Bonnefon // The view context contains parameter specific to the view's 54*a44d09bcSNicolas Bonnefon // implementation (such as geometry...) 55*a44d09bcSNicolas Bonnefon std::string viewContext; 56b57881faSNicolas Bonnefon }; 57b57881faSNicolas Bonnefon 58b57881faSNicolas Bonnefon // List of the loaded files 59b57881faSNicolas Bonnefon std::vector<OpenFile> openFiles() const 60b57881faSNicolas Bonnefon { return openFiles_; } 61ee835f33SNicolas Bonnefon void setOpenFiles( const std::vector<OpenFile>& loaded_files ) 62b57881faSNicolas Bonnefon { openFiles_ = loaded_files; } 63bb02e0acSNicolas Bonnefon 64bb02e0acSNicolas Bonnefon // Reads/writes the current config in the QSettings object passed 65bb02e0acSNicolas Bonnefon virtual void saveToStorage( QSettings& settings ) const; 66bb02e0acSNicolas Bonnefon virtual void retrieveFromStorage( QSettings& settings ); 67bb02e0acSNicolas Bonnefon 68bb02e0acSNicolas Bonnefon private: 69b57881faSNicolas Bonnefon static const int OPENFILES_VERSION; 70b57881faSNicolas Bonnefon 71bb02e0acSNicolas Bonnefon QByteArray geometry_; 72bb02e0acSNicolas Bonnefon QByteArray crawlerState_; 73b57881faSNicolas Bonnefon std::vector<OpenFile> openFiles_; 74bb02e0acSNicolas Bonnefon }; 75bb02e0acSNicolas Bonnefon 76bb02e0acSNicolas Bonnefon #endif 77