tuchulcha  0.10.1
Graphical Workflow Configuration Editor
RecentFileHandler.h
Go to the documentation of this file.
1 /* Copyright (C) 2012 Jens-Malte Gottfried
2 
3  This file is part of Tuchulcha.
4 
5  Tuchulcha is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  Tuchulcha is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with Tuchulcha. If not, see <http://www.gnu.org/licenses/>.
17  */
25 #ifndef RECENTFILEHANDLER_H
26 #define RECENTFILEHANDLER_H
27 
28 #include <QObject>
29 
30 class QAction;
31 class QMenu;
32 
34 class RecentFileHandler : public QObject
35 {
36  Q_OBJECT
37 private:
39  enum {_maxRecentFiles = 5};
41 
44  static QString _strippedName(QString fullFileName);
46  // \{
48  QAction* _separatorAct;
50  QAction* _recentFileActs[_maxRecentFiles];
51  // \}
52 
53 public:
55  explicit RecentFileHandler(QObject* parent = 0);
57 
58  void registerRecentFileEntries(QMenu* menu);
59 
60 public slots:
62  void setCurrentFile(QString fileName);
63 
64 private slots:
66  void _openRecentFile();
69 
70 signals:
72  void openFile(QString fileName);
73 };
74 
75 #endif // RECENTFILEHANDLER_H
void _updateRecentFileActions()
updated the list of recent files
provide list of recent files
static QString _strippedName(QString fullFileName)
strip file name
RecentFileHandler(QObject *parent=0)
default constructor
void openFile(QString fileName)
open file with given name
QAction * _separatorAct
separator above recent files
void registerRecentFileEntries(QMenu *menu)
add entries to the given menu
void setCurrentFile(QString fileName)
insert file as current file to recent file list
void _openRecentFile()
open recent file
QAction * _recentFileActs[_maxRecentFiles]
actions to open recent files