#ifndef RECENT_FILES_MANAGER_H #define RECENT_FILES_MANAGER_H #include #include class RecentFilesManager: public QObject { Q_OBJECT public: RecentFilesManager(QObject* parent, QMenu* recentFilesMenu); void createRecentFileActs(const QStringList& recentFiles); void addFile( const QString& filePath); QString getLastUsedFilePath() const; QStringList getFiles() const; private: static QString getShortFileName(const QString& filePath) { return QFileInfo(filePath).fileName(); } static QString getActionFile(QAction* action); private: QAction* createRecentFileAction(const QString& filePath); void updateActionTexts(); QString getShortDirPath(const QString& filePath) const; void addRecentFileAction(const QString& filePath); private slots: void triggerRecentFile(); signals: void recentFileTriggered(const QString& filePath); void addedFile(); private: static const int MaxRecentFiles = 10; static const int MaxPathLength = 300; private: QMenu* recentFilesMenu; }; #endif