Pencil2D Animation
Download Community News Docs Contribute
  • Overview
  • Articles
  • Code
  •  
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • File List
Loading...
Searching...
No Matches
  • core_lib
  • src
  • interface
recentfilemenu.h
1/*
2
3Pencil2D - Traditional Animation Software
4Copyright (C) 2005-2007 Patrick Corrieri & Pascal Naidon
5Copyright (C) 2012-2020 Matthew Chiawen Chang
6
7This program is free software; you can redistribute it and/or
8modify it under the terms of the GNU General Public License
9as published by the Free Software Foundation; version 2 of the License.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16*/
17
18
19#ifndef RECENTFILEMENU_H
20#define RECENTFILEMENU_H
21
22#include <map>
23#include <QMenu>
24#include <QStringList>
25#include "pencildef.h"
26
27class QAction;
28
29class RecentFileMenu : public QMenu
30{
31 Q_OBJECT
32
33public:
34 explicit RecentFileMenu(const QString& title = tr("Open Recent"), QWidget* parent = nullptr);
35 ~RecentFileMenu() override;
36
37 static const int MAX_RECENT_FILES = 10;
38
39 QStringList getRecentFiles() { return mRecentFiles; }
40 void setRecentFiles(const QStringList& filenames);
41
42 void addRecentFile(const QString& filename);
43 void removeRecentFile(const QString& filename);
44
45 bool loadFromDisk();
46 bool saveToDisk();
47
48signals:
49 void loadRecentFile(QString filename);
50
51public slots:
52 void clearRecentFiles();
53
54protected slots:
55 void onRecentFileTriggered();
56
57private:
58 QStringList mRecentFiles;
59 std::map<QString, QAction*> mRecentActions;
60 QAction* mClearAction = nullptr;
61 QAction* mClearSeparator = nullptr;
62 QAction* mEmptyAction = nullptr;
63};
64
65#endif // RECENTFILEMENU_H
RecentFileMenu
Definition: recentfilemenu.h:30
QAction
QMenu
QMenu::title
title
QObject::Q_OBJECT
Q_OBJECTQ_OBJECT
QObject::parent
QObject * parent() const const
QObject::tr
QString tr(const char *sourceText, const char *disambiguation, int n)
QString
QStringList
QWidget
Generated on Thu May 8 2025 04:47:53 for Pencil2D by doxygen 1.9.6 based on revision 4513250b1d5b1a3676ec0e67b06b7a885ceaae39