mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-04-15 04:49:58 +02:00
Ajout des "fichiers recents"
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@359 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -22,6 +22,7 @@
|
|||||||
#include "customelementpart.h"
|
#include "customelementpart.h"
|
||||||
#include "newelementwizard.h"
|
#include "newelementwizard.h"
|
||||||
#include "elementitemeditor.h"
|
#include "elementitemeditor.h"
|
||||||
|
#include "recentfiles.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Constructeur
|
Constructeur
|
||||||
@@ -260,6 +261,8 @@ void QETElementEditor::setupMenus() {
|
|||||||
|
|
||||||
file_menu -> addAction(new_element);
|
file_menu -> addAction(new_element);
|
||||||
file_menu -> addAction(open);
|
file_menu -> addAction(open);
|
||||||
|
file_menu -> addMenu(QETApp::elementsRecentFiles() -> menu());
|
||||||
|
connect(QETApp::elementsRecentFiles(), SIGNAL(fileOpeningRequested(const QString &)), this, SLOT(openRecentFile(const QString &)));
|
||||||
file_menu -> addAction(save);
|
file_menu -> addAction(save);
|
||||||
file_menu -> addAction(save_as);
|
file_menu -> addAction(save_as);
|
||||||
file_menu -> addSeparator();
|
file_menu -> addSeparator();
|
||||||
@@ -520,6 +523,7 @@ void QETElementEditor::fromFile(const QString &filepath) {
|
|||||||
|
|
||||||
// memorise le fichier
|
// memorise le fichier
|
||||||
setFileName(filepath);
|
setFileName(filepath);
|
||||||
|
QETApp::elementsRecentFiles() -> fileWasOpened(filepath);
|
||||||
slot_updateMenus();
|
slot_updateMenus();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -583,7 +587,7 @@ void QETElementEditor::slot_new() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Ouvre un fichier
|
Demande un fichier a l'utilisateur et ouvre ce fichier
|
||||||
*/
|
*/
|
||||||
void QETElementEditor::slot_open() {
|
void QETElementEditor::slot_open() {
|
||||||
// demande un nom de fichier a ouvrir a l'utilisateur
|
// demande un nom de fichier a ouvrir a l'utilisateur
|
||||||
@@ -593,9 +597,30 @@ void QETElementEditor::slot_open() {
|
|||||||
_filename.isEmpty() ? QETApp::customElementsDir() : QDir(_filename).absolutePath(),
|
_filename.isEmpty() ? QETApp::customElementsDir() : QDir(_filename).absolutePath(),
|
||||||
tr("\311l\351ments QElectroTech (*.elmt);;Fichiers XML (*.xml);;Tous les fichiers (*)")
|
tr("\311l\351ments QElectroTech (*.elmt);;Fichiers XML (*.xml);;Tous les fichiers (*)")
|
||||||
);
|
);
|
||||||
if (user_filename.isEmpty()) return;
|
openElement(user_filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Slot utilise pour ouvrir un fichier recent.
|
||||||
|
Transfere filepath au slot openElement seulement si cet editeur est actif
|
||||||
|
@param filepath Fichier a ouvrir
|
||||||
|
@see openElement
|
||||||
|
*/
|
||||||
|
void QETElementEditor::openRecentFile(const QString &filepath) {
|
||||||
|
if (qApp -> activeWindow() != this) return;
|
||||||
|
openElement(filepath);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Ouvre un fichier element dans un nouvel editeur
|
||||||
|
Cette methode ne controle pas si le fichier est deja ouvert
|
||||||
|
@param filepath Fichier a ouvrir
|
||||||
|
@see fromFile
|
||||||
|
*/
|
||||||
|
void QETElementEditor::openElement(const QString &filepath) {
|
||||||
|
if (filepath.isEmpty()) return;
|
||||||
QETElementEditor *cee = new QETElementEditor();
|
QETElementEditor *cee = new QETElementEditor();
|
||||||
cee -> fromFile(user_filename);
|
cee -> fromFile(filepath);
|
||||||
cee -> show();
|
cee -> show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -106,6 +106,8 @@ class QETElementEditor : public QMainWindow {
|
|||||||
public slots:
|
public slots:
|
||||||
void slot_new();
|
void slot_new();
|
||||||
void slot_open();
|
void slot_open();
|
||||||
|
void openRecentFile(const QString &);
|
||||||
|
void openElement(const QString &);
|
||||||
void slot_reload();
|
void slot_reload();
|
||||||
bool slot_save();
|
bool slot_save();
|
||||||
bool slot_saveAs();
|
bool slot_saveAs();
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ HEADERS += aboutqet.h \
|
|||||||
qetdiagrameditor.h \
|
qetdiagrameditor.h \
|
||||||
qetsingleapplication.h \
|
qetsingleapplication.h \
|
||||||
qgimanager.h \
|
qgimanager.h \
|
||||||
|
recentfiles.h \
|
||||||
terminal.h \
|
terminal.h \
|
||||||
editor/arceditor.h \
|
editor/arceditor.h \
|
||||||
editor/circleeditor.h \
|
editor/circleeditor.h \
|
||||||
@@ -149,6 +150,7 @@ SOURCES += aboutqet.cpp \
|
|||||||
qetdiagrameditor.cpp \
|
qetdiagrameditor.cpp \
|
||||||
qetsingleapplication.cpp \
|
qetsingleapplication.cpp \
|
||||||
qgimanager.cpp \
|
qgimanager.cpp \
|
||||||
|
recentfiles.cpp \
|
||||||
terminal.cpp \
|
terminal.cpp \
|
||||||
editor/arceditor.cpp \
|
editor/arceditor.cpp \
|
||||||
editor/circleeditor.cpp \
|
editor/circleeditor.cpp \
|
||||||
|
|||||||
25
qetapp.cpp
25
qetapp.cpp
@@ -18,6 +18,7 @@
|
|||||||
#include "qetapp.h"
|
#include "qetapp.h"
|
||||||
#include "qetdiagrameditor.h"
|
#include "qetdiagrameditor.h"
|
||||||
#include "qetelementeditor.h"
|
#include "qetelementeditor.h"
|
||||||
|
#include "recentfiles.h"
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#define QUOTE(x) STRINGIFY(x)
|
#define QUOTE(x) STRINGIFY(x)
|
||||||
@@ -26,6 +27,8 @@
|
|||||||
QString QETApp::common_elements_dir = QString();
|
QString QETApp::common_elements_dir = QString();
|
||||||
QString QETApp::config_dir = QString();
|
QString QETApp::config_dir = QString();
|
||||||
QString QETApp::diagram_texts_font = QString();
|
QString QETApp::diagram_texts_font = QString();
|
||||||
|
RecentFiles *QETApp::projects_recent_files_ = 0;
|
||||||
|
RecentFiles *QETApp::elements_recent_files_ = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Constructeur
|
Constructeur
|
||||||
@@ -78,6 +81,10 @@ QETApp::QETApp(int &argc, char **argv) :
|
|||||||
|
|
||||||
/// Destructeur
|
/// Destructeur
|
||||||
QETApp::~QETApp() {
|
QETApp::~QETApp() {
|
||||||
|
elements_recent_files_ -> save();
|
||||||
|
projects_recent_files_ -> save();
|
||||||
|
delete elements_recent_files_;
|
||||||
|
delete projects_recent_files_;
|
||||||
delete qsti;
|
delete qsti;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -388,6 +395,20 @@ QList<QETElementEditor *> QETApp::elementEditors() const {
|
|||||||
return(element_editors);
|
return(element_editors);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@return La liste des fichiers recents pour les projets
|
||||||
|
*/
|
||||||
|
RecentFiles *QETApp::projectsRecentFiles() {
|
||||||
|
return(projects_recent_files_);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@return La liste des fichiers recents pour les elements
|
||||||
|
*/
|
||||||
|
RecentFiles *QETApp::elementsRecentFiles() {
|
||||||
|
return(elements_recent_files_);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Affiche ou cache une fenetre (editeurs de schemas / editeurs d'elements)
|
Affiche ou cache une fenetre (editeurs de schemas / editeurs d'elements)
|
||||||
@param window fenetre a afficher / cacher
|
@param window fenetre a afficher / cacher
|
||||||
@@ -629,6 +650,10 @@ void QETApp::initConfiguration() {
|
|||||||
|
|
||||||
// police a utiliser pour le rendu de texte
|
// police a utiliser pour le rendu de texte
|
||||||
diagram_texts_font = qet_settings -> value("diagramfont", "Sans Serif").toString();
|
diagram_texts_font = qet_settings -> value("diagramfont", "Sans Serif").toString();
|
||||||
|
|
||||||
|
// fichiers recents
|
||||||
|
projects_recent_files_ = new RecentFiles("projects");
|
||||||
|
elements_recent_files_ = new RecentFiles("elements");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
7
qetapp.h
7
qetapp.h
@@ -23,6 +23,7 @@
|
|||||||
#include "qetarguments.h"
|
#include "qetarguments.h"
|
||||||
class QETDiagramEditor;
|
class QETDiagramEditor;
|
||||||
class QETElementEditor;
|
class QETElementEditor;
|
||||||
|
class RecentFiles;
|
||||||
/**
|
/**
|
||||||
Cette classe represente l'application QElectroTech.
|
Cette classe represente l'application QElectroTech.
|
||||||
|
|
||||||
@@ -56,6 +57,8 @@ class QETApp : public QETSingleApplication {
|
|||||||
static QETDiagramEditor *diagramEditorForFile(const QString &);
|
static QETDiagramEditor *diagramEditorForFile(const QString &);
|
||||||
QList<QETDiagramEditor *> diagramEditors() const;
|
QList<QETDiagramEditor *> diagramEditors() const;
|
||||||
QList<QETElementEditor *> elementEditors() const;
|
QList<QETElementEditor *> elementEditors() const;
|
||||||
|
static RecentFiles *projectsRecentFiles();
|
||||||
|
static RecentFiles *elementsRecentFiles();
|
||||||
#ifdef QET_ALLOW_OVERRIDE_CED_OPTION
|
#ifdef QET_ALLOW_OVERRIDE_CED_OPTION
|
||||||
public:
|
public:
|
||||||
static void overrideCommonElementsDir(const QString &);
|
static void overrideCommonElementsDir(const QString &);
|
||||||
@@ -103,7 +106,9 @@ class QETApp : public QETSingleApplication {
|
|||||||
QETArguments qet_arguments_; ///< Analyseur d'arguments
|
QETArguments qet_arguments_; ///< Analyseur d'arguments
|
||||||
bool non_interactive_execution_; ///< booleen indiquant si l'application va se terminer immediatement apres un court traitement
|
bool non_interactive_execution_; ///< booleen indiquant si l'application va se terminer immediatement apres un court traitement
|
||||||
static QString diagram_texts_font;
|
static QString diagram_texts_font;
|
||||||
|
static RecentFiles *projects_recent_files_;
|
||||||
|
static RecentFiles *elements_recent_files_;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void systray(QSystemTrayIcon::ActivationReason);
|
void systray(QSystemTrayIcon::ActivationReason);
|
||||||
void reduceEveryEditor();
|
void reduceEveryEditor();
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
#include "aboutqet.h"
|
#include "aboutqet.h"
|
||||||
#include "conductorpropertieswidget.h"
|
#include "conductorpropertieswidget.h"
|
||||||
#include "configdialog.h"
|
#include "configdialog.h"
|
||||||
|
#include "recentfiles.h"
|
||||||
/**
|
/**
|
||||||
constructeur
|
constructeur
|
||||||
@param files Liste de fichiers a ouvrir
|
@param files Liste de fichiers a ouvrir
|
||||||
@@ -384,6 +384,8 @@ void QETDiagramEditor::menus() {
|
|||||||
// menu Fichier
|
// menu Fichier
|
||||||
menu_fichier -> addAction(new_file);
|
menu_fichier -> addAction(new_file);
|
||||||
menu_fichier -> addAction(open_file);
|
menu_fichier -> addAction(open_file);
|
||||||
|
menu_fichier -> addMenu(QETApp::projectsRecentFiles() -> menu());
|
||||||
|
connect(QETApp::projectsRecentFiles(), SIGNAL(fileOpeningRequested(const QString &)), this, SLOT(openRecentFile(const QString &)));
|
||||||
menu_fichier -> addAction(save_file);
|
menu_fichier -> addAction(save_file);
|
||||||
menu_fichier -> addAction(save_file_sous);
|
menu_fichier -> addAction(save_file_sous);
|
||||||
menu_fichier -> addAction(close_file);
|
menu_fichier -> addAction(close_file);
|
||||||
@@ -549,6 +551,18 @@ bool QETDiagramEditor::newDiagram() {
|
|||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Slot utilise pour ouvrir un fichier recent.
|
||||||
|
Transfere filepath au slot openAndAddDiagram seulement si cet editeur est
|
||||||
|
actif
|
||||||
|
@param filepath Fichier a ouvrir
|
||||||
|
@see openAndAddDiagram
|
||||||
|
*/
|
||||||
|
bool QETDiagramEditor::openRecentFile(const QString &filepath) {
|
||||||
|
if (qApp -> activeWindow() != this) return(false);
|
||||||
|
return(openAndAddDiagram(filepath));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Cette fonction demande un nom de fichier a ouvrir a l'utilisateur
|
Cette fonction demande un nom de fichier a ouvrir a l'utilisateur
|
||||||
@return true si l'ouverture a reussi, false sinon
|
@return true si l'ouverture a reussi, false sinon
|
||||||
@@ -595,6 +609,7 @@ bool QETDiagramEditor::openAndAddDiagram(const QString &nom_fichier) {
|
|||||||
if (sv -> open(nom_fichier, &code_erreur)) {
|
if (sv -> open(nom_fichier, &code_erreur)) {
|
||||||
addDiagramView(sv);
|
addDiagramView(sv);
|
||||||
activateWindow();
|
activateWindow();
|
||||||
|
QETApp::projectsRecentFiles() -> fileWasOpened(nom_fichier);
|
||||||
return(true);
|
return(true);
|
||||||
} else {
|
} else {
|
||||||
QString message_erreur;
|
QString message_erreur;
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
#include "insetproperties.h"
|
#include "insetproperties.h"
|
||||||
class DiagramView;
|
class DiagramView;
|
||||||
class ElementsPanelWidget;
|
class ElementsPanelWidget;
|
||||||
|
class RecentFiles;
|
||||||
/**
|
/**
|
||||||
Cette classe represente la fenetre principale de QElectroTech et,
|
Cette classe represente la fenetre principale de QElectroTech et,
|
||||||
ipso facto, la plus grande partie de l'interface graphique de QElectroTech.
|
ipso facto, la plus grande partie de l'interface graphique de QElectroTech.
|
||||||
@@ -66,6 +67,7 @@ class QETDiagramEditor : public QMainWindow {
|
|||||||
bool save();
|
bool save();
|
||||||
bool newDiagram();
|
bool newDiagram();
|
||||||
bool openDiagram();
|
bool openDiagram();
|
||||||
|
bool openRecentFile(const QString &);
|
||||||
bool openAndAddDiagram(const QString &);
|
bool openAndAddDiagram(const QString &);
|
||||||
bool closeDiagram();
|
bool closeDiagram();
|
||||||
void slot_editInfos();
|
void slot_editInfos();
|
||||||
|
|||||||
132
recentfiles.cpp
Normal file
132
recentfiles.cpp
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
#include "recentfiles.h"
|
||||||
|
#include "qetapp.h"
|
||||||
|
|
||||||
|
RecentFiles::RecentFiles(const QString &identifier, int size, QObject *parent) :
|
||||||
|
QObject(parent),
|
||||||
|
identifier_(identifier.isEmpty() ? "unnamed" : identifier),
|
||||||
|
size_(size > 0 ? size : 10),
|
||||||
|
menu_(0)
|
||||||
|
{
|
||||||
|
mapper_ = new QSignalMapper(this);
|
||||||
|
connect(mapper_, SIGNAL(mapped(const QString &)), this, SLOT(handleMenuRequest(const QString &)));
|
||||||
|
|
||||||
|
extractFilesFromSettings();
|
||||||
|
buildMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructeur
|
||||||
|
@todo determiner s'il faut detruire ou non le menu
|
||||||
|
*/
|
||||||
|
RecentFiles::~RecentFiles() {
|
||||||
|
delete menu_;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@return le nombre de fichiers a retenir
|
||||||
|
*/
|
||||||
|
int RecentFiles::size() const {
|
||||||
|
return(size_);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@return un menu listant les derniers fichiers ouverts
|
||||||
|
*/
|
||||||
|
QMenu *RecentFiles::menu() const {
|
||||||
|
return(menu_);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Oublie les fichiers recents
|
||||||
|
*/
|
||||||
|
void RecentFiles::clear() {
|
||||||
|
list_.clear();
|
||||||
|
buildMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sauvegarde les fichiers récents dans la configuration
|
||||||
|
*/
|
||||||
|
void RecentFiles::save() {
|
||||||
|
saveFilesToSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gere les actions sur le menu
|
||||||
|
*/
|
||||||
|
void RecentFiles::handleMenuRequest(const QString &filepath) {
|
||||||
|
emit(fileOpeningRequested(filepath));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gere le fait qu'un fichier ait ete ouvert
|
||||||
|
@param filepath Chemin du fichier ouvert
|
||||||
|
*/
|
||||||
|
void RecentFiles::fileWasOpened(const QString &filepath) {
|
||||||
|
insertFile(filepath);
|
||||||
|
buildMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
lit la liste des fichiers recents dans la configuration
|
||||||
|
*/
|
||||||
|
void RecentFiles::extractFilesFromSettings() {
|
||||||
|
// oublie la liste des fichiers recents
|
||||||
|
list_.clear();
|
||||||
|
|
||||||
|
// recupere les derniers fichiers ouverts dans la configuration
|
||||||
|
for (int i = size_ ; i >= 1 ; -- i) {
|
||||||
|
QString key(identifier_ + "-recentfiles/file" + QString::number(i));
|
||||||
|
QString value(QETApp::settings().value(key, QString()).toString());
|
||||||
|
insertFile(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Insere un fichier dans la liste des fichiers recents
|
||||||
|
*/
|
||||||
|
void RecentFiles::insertFile(const QString &filepath) {
|
||||||
|
// evite d'inserer un chemin de fichier vide ou en double
|
||||||
|
if (filepath.isEmpty()) return;
|
||||||
|
list_.removeAll(filepath);
|
||||||
|
|
||||||
|
// insere le chemin de fichier
|
||||||
|
list_.push_front(filepath);
|
||||||
|
|
||||||
|
// s'assure que l'on ne retient pas plus de fichiers que necessaire
|
||||||
|
while (list_.count() > size_) list_.removeLast();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
ecrit la liste des fichiers recents dans la configuration
|
||||||
|
*/
|
||||||
|
void RecentFiles::saveFilesToSettings() {
|
||||||
|
for (int i = 0 ; i < size_ && i < list_.count() ; ++ i) {
|
||||||
|
QString key(identifier_ + "-recentfiles/file" + QString::number(i + 1));
|
||||||
|
QETApp::settings().setValue(key, list_[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Construit le menu
|
||||||
|
*/
|
||||||
|
void RecentFiles::buildMenu() {
|
||||||
|
// reinitialise le menu
|
||||||
|
if (!menu_) {
|
||||||
|
menu_ = new QMenu(tr("&R\351cemment ouvert(s)"));
|
||||||
|
menu_ -> setIcon(QIcon(":/ico/open.png"));
|
||||||
|
} else {
|
||||||
|
menu_ -> clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
// remplit le menu
|
||||||
|
foreach (QString filepath, list_) {
|
||||||
|
// creee une nouvelle action pour le fichier
|
||||||
|
QAction *action = new QAction(filepath, 0);
|
||||||
|
menu_ -> addAction(action);
|
||||||
|
|
||||||
|
// lie l'action et le mapper
|
||||||
|
mapper_ -> setMapping(action, filepath);
|
||||||
|
connect(action, SIGNAL(triggered()), mapper_, SLOT(map()));
|
||||||
|
}
|
||||||
|
}
|
||||||
65
recentfiles.h
Normal file
65
recentfiles.h
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2006-2008 Xavier Guerrin
|
||||||
|
This file is part of QElectroTech.
|
||||||
|
|
||||||
|
QElectroTech is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
QElectroTech is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#ifndef RECENT_FILES_H
|
||||||
|
#define RECENT_FILES_H
|
||||||
|
#include <QtCore>
|
||||||
|
class QMenu;
|
||||||
|
/**
|
||||||
|
Cette classe permet de gerer des fichiers recents.
|
||||||
|
*/
|
||||||
|
class RecentFiles : public QObject {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
// constructeurs, destructeur
|
||||||
|
public:
|
||||||
|
RecentFiles(const QString &, int = 10, QObject * = 0);
|
||||||
|
virtual ~RecentFiles();
|
||||||
|
private:
|
||||||
|
RecentFiles(const RecentFiles &);
|
||||||
|
|
||||||
|
// methodes
|
||||||
|
public:
|
||||||
|
int size() const;
|
||||||
|
QMenu *menu() const;
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void clear();
|
||||||
|
void save();
|
||||||
|
void fileWasOpened(const QString &);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void fileOpeningRequested(const QString &);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void extractFilesFromSettings();
|
||||||
|
void insertFile(const QString &);
|
||||||
|
void saveFilesToSettings();
|
||||||
|
void buildMenu();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void handleMenuRequest(const QString &);
|
||||||
|
|
||||||
|
// attributs
|
||||||
|
private:
|
||||||
|
QString identifier_;
|
||||||
|
int size_;
|
||||||
|
QList<QString> list_;
|
||||||
|
QMenu *menu_;
|
||||||
|
QSignalMapper *mapper_;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user