Chris@149: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@149: Chris@149: /* Chris@149: Sonic Visualiser Chris@149: An audio file viewer and annotation editor. Chris@149: Centre for Digital Music, Queen Mary, University of London. Chris@149: This file copyright 2006 Chris Cannam. Chris@149: Chris@149: This program is free software; you can redistribute it and/or Chris@149: modify it under the terms of the GNU General Public License as Chris@149: published by the Free Software Foundation; either version 2 of the Chris@149: License, or (at your option) any later version. See the file Chris@149: COPYING included with this distribution for more information. Chris@149: */ Chris@149: Chris@149: #ifndef _RECENT_FILES_H_ Chris@149: #define _RECENT_FILES_H_ Chris@149: Chris@149: #include Chris@149: #include Chris@149: #include Chris@149: #include Chris@149: Chris@149: class RecentFiles : public QObject Chris@149: { Chris@149: Q_OBJECT Chris@149: Chris@149: public: Chris@149: // The maxFileCount argument will only be used the first time this is called Chris@149: static RecentFiles *getInstance(int maxFileCount = 10); Chris@149: Chris@149: virtual ~RecentFiles(); Chris@149: Chris@149: int getMaxFileCount() const { return m_maxFileCount; } Chris@149: Chris@149: std::vector getRecentFiles() const; Chris@149: Chris@149: void addFile(QString filename); Chris@149: Chris@149: signals: Chris@149: void recentFilesChanged(); Chris@149: Chris@149: protected: Chris@149: RecentFiles(int maxFileCount); Chris@149: Chris@149: int m_maxFileCount; Chris@149: std::deque m_files; Chris@149: Chris@149: void readFiles(); Chris@149: void writeFiles(); Chris@149: void truncateAndWrite(); Chris@149: Chris@149: static RecentFiles *m_instance; Chris@149: }; Chris@149: Chris@149: #endif