svcore
1.9
|
RecentFiles manages a list of the names of recently-used objects, saving and restoring that list via QSettings. More...
#include <RecentFiles.h>
Signals | |
void | recentChanged () |
Public Member Functions | |
RecentFiles (QString settingsGroup="RecentFiles", int maxCount=10) | |
Construct a RecentFiles object that saves and restores in the given QSettings group and truncates when the given count of strings is reached. | |
virtual | ~RecentFiles () |
QString | getSettingsGroup () const |
int | getMaxCount () const |
std::vector< QString > | getRecent () const |
void | add (QString name) |
Add a name that should be treated as a literal string. | |
void | addFile (QString name) |
Add a name that is known to be either a file path or a URL. | |
Protected Member Functions | |
void | read () |
void | write () |
void | truncateAndWrite () |
Protected Attributes | |
QString | m_settingsGroup |
int | m_maxCount |
std::deque< QString > | m_names |
RecentFiles manages a list of the names of recently-used objects, saving and restoring that list via QSettings.
The names do not actually have to refer to files.
Definition at line 30 of file RecentFiles.h.
RecentFiles::RecentFiles | ( | QString | settingsGroup = "RecentFiles" , |
int | maxCount = 10 |
||
) |
Construct a RecentFiles object that saves and restores in the given QSettings group and truncates when the given count of strings is reached.
Definition at line 24 of file RecentFiles.cpp.
References read().
RecentFiles::~RecentFiles | ( | ) | [virtual] |
Definition at line 31 of file RecentFiles.cpp.
QString RecentFiles::getSettingsGroup | ( | ) | const [inline] |
Definition at line 44 of file RecentFiles.h.
References m_settingsGroup.
int RecentFiles::getMaxCount | ( | ) | const [inline] |
Definition at line 46 of file RecentFiles.h.
References m_maxCount.
std::vector< QString > RecentFiles::getRecent | ( | ) | const |
Definition at line 80 of file RecentFiles.cpp.
References m_maxCount, and m_names.
void RecentFiles::add | ( | QString | name | ) |
Add a name that should be treated as a literal string.
Definition at line 92 of file RecentFiles.cpp.
References m_names, recentChanged(), and truncateAndWrite().
Referenced by addFile().
void RecentFiles::addFile | ( | QString | name | ) |
Add a name that is known to be either a file path or a URL.
If it looks like a URL, add it literally; otherwise treat it as a file path and canonicalise it appropriately. Also takes into account the user preference for whether to include temporary files in the recent files menu: the file will not be added if the preference is set and the file appears to be a temporary one.
Definition at line 119 of file RecentFiles.cpp.
References add(), Preferences::getInstance(), and Preferences::getOmitTempsFromRecentFiles().
void RecentFiles::recentChanged | ( | ) | [signal] |
Referenced by add().
void RecentFiles::read | ( | ) | [protected] |
Definition at line 37 of file RecentFiles.cpp.
References m_maxCount, m_names, and m_settingsGroup.
Referenced by RecentFiles().
void RecentFiles::write | ( | ) | [protected] |
Definition at line 55 of file RecentFiles.cpp.
References m_maxCount, m_names, and m_settingsGroup.
Referenced by truncateAndWrite().
void RecentFiles::truncateAndWrite | ( | ) | [protected] |
Definition at line 71 of file RecentFiles.cpp.
References m_maxCount, m_names, and write().
Referenced by add().
QString RecentFiles::m_settingsGroup [protected] |
Definition at line 70 of file RecentFiles.h.
Referenced by getSettingsGroup(), read(), and write().
int RecentFiles::m_maxCount [protected] |
Definition at line 71 of file RecentFiles.h.
Referenced by getMaxCount(), getRecent(), read(), truncateAndWrite(), and write().
std::deque<QString> RecentFiles::m_names [protected] |
Definition at line 73 of file RecentFiles.h.
Referenced by add(), getRecent(), read(), truncateAndWrite(), and write().