QElectroTech 0.100.0-dev
Loading...
Searching...
No Matches
recentfiles.h
Go to the documentation of this file.
1/*
2 Copyright 2006-2024 The QElectroTech Team
3 This file is part of QElectroTech.
4
5 QElectroTech is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 2 of the License, or
8 (at your option) any later version.
9
10 QElectroTech 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 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
17*/
18#ifndef RECENT_FILES_H
19#define RECENT_FILES_H
20#include <QtCore>
21#include <QIcon>
22class QMenu;
26class RecentFiles : public QObject {
27 Q_OBJECT
28
29 // constructors, destructor
30 public:
31 RecentFiles(const QString &, int = 10, QObject * = nullptr);
32 ~RecentFiles() override;
33 private:
35
36 // methods
37 public:
38 int size() const;
39 QMenu *menu() const;
40 QIcon iconForFiles() const;
41 void setIconForFiles(const QIcon &);
42
43 public slots:
44 void clear();
45 void save();
46 void fileWasOpened(const QString &);
47
48 signals:
49 void fileOpeningRequested(const QString &);
50
51 private:
53 void insertFile(const QString &);
55 void buildMenu();
56
57 private slots:
58 void handleMenuRequest(const QString &);
59
60 // attributes
61 private:
62 QString identifier_;
63 int size_;
64 QList<QString> list_;
65 QMenu *menu_;
66 QSignalMapper *mapper_;
68};
69#endif
Definition recentfiles.h:26
void buildMenu()
Definition recentfiles.cpp:176
~RecentFiles() override
Definition recentfiles.cpp:46
void extractFilesFromSettings()
RecentFiles::extractFilesFromSettings Read the list of recent file from settings.
Definition recentfiles.cpp:126
void save()
Definition recentfiles.cpp:101
void fileWasOpened(const QString &)
Definition recentfiles.cpp:117
QString identifier_
Definition recentfiles.h:62
int size_
Definition recentfiles.h:63
QMenu * menu_
Definition recentfiles.h:65
QIcon iconForFiles() const
Definition recentfiles.cpp:74
QMenu * menu() const
Definition recentfiles.cpp:65
void clear()
Definition recentfiles.cpp:92
QSignalMapper * mapper_
Definition recentfiles.h:66
QList< QString > list_
Definition recentfiles.h:64
void setIconForFiles(const QIcon &)
Definition recentfiles.cpp:84
void insertFile(const QString &)
Definition recentfiles.cpp:144
void handleMenuRequest(const QString &)
Definition recentfiles.cpp:109
int size() const
Definition recentfiles.cpp:57
QIcon files_icon_
Definition recentfiles.h:67
RecentFiles(const RecentFiles &)
void saveFilesToSettings()
RecentFiles::saveFilesToSettings Write the list of recent files to settings.
Definition recentfiles.cpp:163
void fileOpeningRequested(const QString &)