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: SessionInfo()35b57881faSNicolas Bonnefon SessionInfo() : openFiles_() { } 36bb02e0acSNicolas Bonnefon 37bb02e0acSNicolas Bonnefon // Geometry of the main window 38*b76966a6SNicolas Bonnefon // (this is an opaque string which is interpreted by the 39*b76966a6SNicolas Bonnefon // MainWindow implementation) geometry()40bb02e0acSNicolas Bonnefon QByteArray geometry() const 41bb02e0acSNicolas Bonnefon { return geometry_; } setGeometry(const QByteArray & geometry)42bb02e0acSNicolas Bonnefon void setGeometry( const QByteArray& geometry ) 43bb02e0acSNicolas Bonnefon { geometry_ = geometry; } 44*b76966a6SNicolas Bonnefon 45b57881faSNicolas Bonnefon struct OpenFile 46b57881faSNicolas Bonnefon { 47b57881faSNicolas Bonnefon std::string fileName; 48b57881faSNicolas Bonnefon uint64_t topLine; 49a44d09bcSNicolas Bonnefon // The view context contains parameter specific to the view's 50a44d09bcSNicolas Bonnefon // implementation (such as geometry...) 51a44d09bcSNicolas Bonnefon std::string viewContext; 52b57881faSNicolas Bonnefon }; 53b57881faSNicolas Bonnefon 54b57881faSNicolas Bonnefon // List of the loaded files openFiles()55b57881faSNicolas Bonnefon std::vector<OpenFile> openFiles() const 56b57881faSNicolas Bonnefon { return openFiles_; } setOpenFiles(const std::vector<OpenFile> & loaded_files)57ee835f33SNicolas Bonnefon void setOpenFiles( const std::vector<OpenFile>& loaded_files ) 58b57881faSNicolas Bonnefon { openFiles_ = loaded_files; } 59bb02e0acSNicolas Bonnefon 60bb02e0acSNicolas Bonnefon // Reads/writes the current config in the QSettings object passed 61bb02e0acSNicolas Bonnefon virtual void saveToStorage( QSettings& settings ) const; 62bb02e0acSNicolas Bonnefon virtual void retrieveFromStorage( QSettings& settings ); 63bb02e0acSNicolas Bonnefon 64bb02e0acSNicolas Bonnefon private: 65b57881faSNicolas Bonnefon static const int OPENFILES_VERSION; 66b57881faSNicolas Bonnefon 67bb02e0acSNicolas Bonnefon QByteArray geometry_; 68bb02e0acSNicolas Bonnefon QByteArray crawlerState_; 69b57881faSNicolas Bonnefon std::vector<OpenFile> openFiles_; 70bb02e0acSNicolas Bonnefon }; 71bb02e0acSNicolas Bonnefon 72bb02e0acSNicolas Bonnefon #endif 73