QElectroTech  0.70
Public Slots | Signals | Public Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
RecentFiles Class Reference

#include <recentfiles.h>

Public Slots

void clear ()
 
void save ()
 
void fileWasOpened (const QString &)
 

Signals

void fileOpeningRequested (const QString &)
 

Public Member Functions

 RecentFiles (const QString &, int=10, QObject *=nullptr)
 
 ~RecentFiles () override
 
int size () const
 
QMenu * menu () const
 
QIcon iconForFiles () const
 
void setIconForFiles (const QIcon &)
 

Private Slots

void handleMenuRequest (const QString &)
 

Private Member Functions

 RecentFiles (const RecentFiles &)
 
void extractFilesFromSettings ()
 RecentFiles::extractFilesFromSettings Read the list of recent file from settings. More...
 
void insertFile (const QString &)
 
void saveFilesToSettings ()
 RecentFiles::saveFilesToSettings Write the list of recent files to settings. More...
 
void buildMenu ()
 

Private Attributes

QString identifier_
 
int size_
 
QList< QString > list_
 
QMenu * menu_
 
QSignalMapper * mapper_
 
QIcon files_icon_
 

Detailed Description

This class provides a way to manage recently opened files.

Definition at line 26 of file recentfiles.h.

Constructor & Destructor Documentation

◆ RecentFiles() [1/2]

RecentFiles::RecentFiles ( const QString &  identifier,
int  size = 10,
QObject *  parent = nullptr 
)

Constructeur

Parameters
identifierprefixe a utiliser pour recuperer les fichiers recents dans la configuration de l'application
sizeNombre de fichiers recents a retenir
parentQObject parent

Definition at line 29 of file recentfiles.cpp.

References buildMenu(), extractFilesFromSettings(), handleMenuRequest(), and mapper_.

◆ ~RecentFiles()

RecentFiles::~RecentFiles ( )
override

Destructeur

Definition at line 46 of file recentfiles.cpp.

References menu_.

◆ RecentFiles() [2/2]

RecentFiles::RecentFiles ( const RecentFiles )
private

Member Function Documentation

◆ buildMenu()

void RecentFiles::buildMenu ( )
private

Construit le menu

Definition at line 167 of file recentfiles.cpp.

References clear(), files_icon_, list_, mapper_, and menu_.

Referenced by clear(), fileWasOpened(), RecentFiles(), and setIconForFiles().

◆ clear

void RecentFiles::clear ( )
slot

Oublie les fichiers recents

Definition at line 85 of file recentfiles.cpp.

References buildMenu(), and list_.

Referenced by buildMenu().

◆ extractFilesFromSettings()

void RecentFiles::extractFilesFromSettings ( )
private

RecentFiles::extractFilesFromSettings Read the list of recent file from settings.

Definition at line 117 of file recentfiles.cpp.

References identifier_, insertFile(), list_, and size_.

Referenced by RecentFiles().

◆ fileOpeningRequested

void RecentFiles::fileOpeningRequested ( const QString &  )
signal

Referenced by handleMenuRequest().

◆ fileWasOpened

void RecentFiles::fileWasOpened ( const QString &  filepath)
slot

Gere le fait qu'un fichier ait ete ouvert

Parameters
filepathChemin du fichier ouvert

Definition at line 108 of file recentfiles.cpp.

References buildMenu(), and insertFile().

◆ handleMenuRequest

void RecentFiles::handleMenuRequest ( const QString &  filepath)
privateslot

Gere les actions sur le menu

Definition at line 100 of file recentfiles.cpp.

References fileOpeningRequested().

Referenced by RecentFiles().

◆ iconForFiles()

QIcon RecentFiles::iconForFiles ( ) const
Returns
l'icone affichee a cote de chaque fichier, ou une QIcon nulle si aucune icone n'est utilisee.

Definition at line 68 of file recentfiles.cpp.

References files_icon_.

◆ insertFile()

void RecentFiles::insertFile ( const QString &  filepath)
private

Insere un fichier dans la liste des fichiers recents

Definition at line 135 of file recentfiles.cpp.

References list_, and size_.

Referenced by extractFilesFromSettings(), and fileWasOpened().

◆ menu()

QMenu * RecentFiles::menu ( ) const
Returns
un menu listant les derniers fichiers ouverts

Definition at line 60 of file recentfiles.cpp.

References menu_.

◆ save

void RecentFiles::save ( )
slot

Sauvegarde les fichiers recents dans la configuration

Definition at line 93 of file recentfiles.cpp.

References saveFilesToSettings().

Referenced by QETApp::~QETApp().

◆ saveFilesToSettings()

void RecentFiles::saveFilesToSettings ( )
private

RecentFiles::saveFilesToSettings Write the list of recent files to settings.

Definition at line 154 of file recentfiles.cpp.

References identifier_, list_, and size_.

Referenced by save().

◆ setIconForFiles()

void RecentFiles::setIconForFiles ( const QIcon &  icon)

Definit l'icone a afficher a cote de chaque fichier. Si une QIcon nulle est fournie, aucune icone n'est utilisee.

Parameters
iconIcone a afficher a cote de chaque fichier

Definition at line 77 of file recentfiles.cpp.

References buildMenu(), and files_icon_.

◆ size()

int RecentFiles::size ( ) const
Returns
le nombre de fichiers a retenir

Definition at line 53 of file recentfiles.cpp.

References size_.

Member Data Documentation

◆ files_icon_

QIcon RecentFiles::files_icon_
private

Definition at line 67 of file recentfiles.h.

Referenced by buildMenu(), iconForFiles(), and setIconForFiles().

◆ identifier_

QString RecentFiles::identifier_
private

Definition at line 62 of file recentfiles.h.

Referenced by extractFilesFromSettings(), and saveFilesToSettings().

◆ list_

QList<QString> RecentFiles::list_
private

◆ mapper_

QSignalMapper* RecentFiles::mapper_
private

Definition at line 66 of file recentfiles.h.

Referenced by buildMenu(), and RecentFiles().

◆ menu_

QMenu* RecentFiles::menu_
private

Definition at line 65 of file recentfiles.h.

Referenced by buildMenu(), menu(), and ~RecentFiles().

◆ size_

int RecentFiles::size_
private

Definition at line 63 of file recentfiles.h.

Referenced by extractFilesFromSettings(), insertFile(), saveFilesToSettings(), and size().


The documentation for this class was generated from the following files: