1bb02e0acSNicolas Bonnefon /* 2*b57881faSNicolas 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 23*b57881faSNicolas Bonnefon #include <vector> 24*b57881faSNicolas Bonnefon #include <string> 25*b57881faSNicolas 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: 35*b57881faSNicolas Bonnefon SessionInfo() : openFiles_() { } 36bb02e0acSNicolas Bonnefon 37bb02e0acSNicolas Bonnefon // Geometry of the main window 38*b57881faSNicolas 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; } 48*b57881faSNicolas Bonnefon */ 49*b57881faSNicolas Bonnefon struct OpenFile 50*b57881faSNicolas Bonnefon { 51*b57881faSNicolas Bonnefon std::string fileName; 52*b57881faSNicolas Bonnefon uint64_t topLine; 53*b57881faSNicolas Bonnefon }; 54*b57881faSNicolas Bonnefon 55*b57881faSNicolas Bonnefon // List of the loaded files 56*b57881faSNicolas Bonnefon std::vector<OpenFile> openFiles() const 57*b57881faSNicolas Bonnefon { return openFiles_; } 58*b57881faSNicolas Bonnefon void setOpenFiles( const std::vector<OpenFile>& loaded_files ); 59*b57881faSNicolas Bonnefon { openFiles_ = loaded_files; } 60bb02e0acSNicolas Bonnefon 61bb02e0acSNicolas Bonnefon // Reads/writes the current config in the QSettings object passed 62bb02e0acSNicolas Bonnefon virtual void saveToStorage( QSettings& settings ) const; 63bb02e0acSNicolas Bonnefon virtual void retrieveFromStorage( QSettings& settings ); 64bb02e0acSNicolas Bonnefon 65bb02e0acSNicolas Bonnefon private: 66*b57881faSNicolas Bonnefon static const int OPENFILES_VERSION; 67*b57881faSNicolas Bonnefon 68bb02e0acSNicolas Bonnefon QByteArray geometry_; 69bb02e0acSNicolas Bonnefon QByteArray crawlerState_; 70*b57881faSNicolas Bonnefon std::vector<OpenFile> openFiles_; 71bb02e0acSNicolas Bonnefon }; 72bb02e0acSNicolas Bonnefon 73bb02e0acSNicolas Bonnefon #endif 74