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
3
Pencil2D - Traditional Animation Software
4
Copyright (C) 2005-2007 Patrick Corrieri & Pascal Naidon
5
Copyright (C) 2012-2020 Matthew Chiawen Chang
6
7
This program is free software; you can redistribute it and/or
8
modify it under the terms of the GNU General Public License
9
as published by the Free Software Foundation; version 2 of the License.
10
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU 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
27
class
QAction
;
28
29
class
RecentFileMenu
:
public
QMenu
30
{
31
Q_OBJECT
32
33
public
:
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
48
signals:
49
void
loadRecentFile(
QString
filename);
50
51
public
slots:
52
void
clearRecentFiles();
53
54
protected
slots:
55
void
onRecentFileTriggered();
56
57
private
:
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