1*bb02e0acSNicolas Bonnefon /* 2*bb02e0acSNicolas Bonnefon * Copyright (C) 2011 Nicolas Bonnefon and other contributors 3*bb02e0acSNicolas Bonnefon * 4*bb02e0acSNicolas Bonnefon * This file is part of glogg. 5*bb02e0acSNicolas Bonnefon * 6*bb02e0acSNicolas Bonnefon * glogg is free software: you can redistribute it and/or modify 7*bb02e0acSNicolas Bonnefon * it under the terms of the GNU General Public License as published by 8*bb02e0acSNicolas Bonnefon * the Free Software Foundation, either version 3 of the License, or 9*bb02e0acSNicolas Bonnefon * (at your option) any later version. 10*bb02e0acSNicolas Bonnefon * 11*bb02e0acSNicolas Bonnefon * glogg is distributed in the hope that it will be useful, 12*bb02e0acSNicolas Bonnefon * but WITHOUT ANY WARRANTY; without even the implied warranty of 13*bb02e0acSNicolas Bonnefon * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14*bb02e0acSNicolas Bonnefon * GNU General Public License for more details. 15*bb02e0acSNicolas Bonnefon * 16*bb02e0acSNicolas Bonnefon * You should have received a copy of the GNU General Public License 17*bb02e0acSNicolas Bonnefon * along with glogg. If not, see <http://www.gnu.org/licenses/>. 18*bb02e0acSNicolas Bonnefon */ 19*bb02e0acSNicolas Bonnefon 20*bb02e0acSNicolas Bonnefon #ifndef RECENTFILES_H 21*bb02e0acSNicolas Bonnefon #define RECENTFILES_H 22*bb02e0acSNicolas Bonnefon 23*bb02e0acSNicolas Bonnefon #include <QString> 24*bb02e0acSNicolas Bonnefon #include <QStringList> 25*bb02e0acSNicolas Bonnefon 26*bb02e0acSNicolas Bonnefon #include "persistable.h" 27*bb02e0acSNicolas Bonnefon 28*bb02e0acSNicolas Bonnefon // Manage the list of recently opened files 29*bb02e0acSNicolas Bonnefon class RecentFiles : public Persistable 30*bb02e0acSNicolas Bonnefon { 31*bb02e0acSNicolas Bonnefon public: 32*bb02e0acSNicolas Bonnefon // Creates an empty set of recent files 33*bb02e0acSNicolas Bonnefon RecentFiles(); 34*bb02e0acSNicolas Bonnefon 35*bb02e0acSNicolas Bonnefon // Adds the passed filename to the list of recently used searches 36*bb02e0acSNicolas Bonnefon void addRecent( const QString& text ); 37*bb02e0acSNicolas Bonnefon 38*bb02e0acSNicolas Bonnefon // Returns a list of recent files (latest loaded first) 39*bb02e0acSNicolas Bonnefon QStringList recentFiles() const; 40*bb02e0acSNicolas Bonnefon 41*bb02e0acSNicolas Bonnefon // Reads/writes the current config in the QSettings object passed 42*bb02e0acSNicolas Bonnefon virtual void saveToStorage( QSettings& settings ) const; 43*bb02e0acSNicolas Bonnefon virtual void retrieveFromStorage( QSettings& settings ); 44*bb02e0acSNicolas Bonnefon 45*bb02e0acSNicolas Bonnefon private: 46*bb02e0acSNicolas Bonnefon static const int RECENTFILES_VERSION; 47*bb02e0acSNicolas Bonnefon static const int MAX_NUMBER_OF_FILES; 48*bb02e0acSNicolas Bonnefon 49*bb02e0acSNicolas Bonnefon QStringList recentFiles_; 50*bb02e0acSNicolas Bonnefon }; 51*bb02e0acSNicolas Bonnefon 52*bb02e0acSNicolas Bonnefon #endif 53