OpenMS
2.7.0
|
Manages recent files opened by the user and provides a QMenu to go with it. More...
#include <OpenMS/VISUAL/RecentFilesMenu.h>
Public Slots | |
void | add (const String &filename) |
put a new recent file at the top (removing any duplicates in other positions); will update the QMenu More... | |
Signals | |
void | recentFileClicked (const String &filename) |
when a recent file action item from the getMenu() was clicked More... | |
Public Member Functions | |
RecentFilesMenu (int max_entries=15) | |
C'tor. More... | |
void | set (const QStringList &initial) |
sets a list of recent files (up to max_entries many – see C'tor) More... | |
unsigned | setFromParam (const Param &filenames) |
Extracts all values from all elements in the param object and tries to interpret them as filenames If they exist, they will be used in the list of recent files. The name of the param items is ignored. More... | |
Param | getAsParam () const |
Convert current file list to Param. Their names are just numbers, starting at "0". The values are the filenames. More... | |
QMenu * | getMenu () |
get a menu-pointer to an internal member which always contains the up-to-date recent items More... | |
const QStringList & | get () const |
current list of recent files (most recent first) More... | |
Private Slots | |
void | itemClicked_ () |
invoked by the QAction when it was clicked; emits recentFileClicked(String filename) More... | |
Private Member Functions | |
void | sync_ () |
updates the menu by synching text and and visibility of actions using the current list of recent files More... | |
Private Attributes | |
QMenu | recent_menu_ |
holds the menu and the filenames (as QActions) More... | |
int | max_entries_ |
maximum of entries; adding more will delete the oldest one More... | |
QStringList | recent_files_ |
list of the recently opened files actions (menu entries) More... | |
std::vector< QAction * > | recent_actions_ |
.. and the actions to go with it More... | |
Manages recent files opened by the user and provides a QMenu to go with it.
RecentFilesMenu | ( | int | max_entries = 15 | ) |
C'tor.
|
slot |
put a new recent file at the top (removing any duplicates in other positions); will update the QMenu
Referenced by TOPPViewBase::addRecentFile_(), and TOPPASBase::addTOPPASFile().
const QStringList& get | ( | ) | const |
current list of recent files (most recent first)
Param getAsParam | ( | ) | const |
Convert current file list to Param. Their names are just numbers, starting at "0". The values are the filenames.
Referenced by TOPPASBase::savePreferences(), and TOPPViewBase::savePreferences().
QMenu* getMenu | ( | ) |
get a menu-pointer to an internal member which always contains the up-to-date recent items
Referenced by TOPPASBase::TOPPASBase().
|
privateslot |
invoked by the QAction when it was clicked; emits recentFileClicked(String filename)
|
signal |
when a recent file action item from the getMenu() was clicked
Referenced by TOPPASBase::TOPPASBase(), and TOPPViewBase::TOPPViewBase().
void set | ( | const QStringList & | initial | ) |
sets a list of recent files (up to max_entries many – see C'tor)
unsigned setFromParam | ( | const Param & | filenames | ) |
Extracts all values from all elements in the param object and tries to interpret them as filenames If they exist, they will be used in the list of recent files. The name of the param items is ignored.
filenames | A Param object of which all values will be tested for being a filename |
Referenced by TOPPASBase::loadPreferences(), and TOPPViewBase::loadPreferences().
|
private |
updates the menu by synching text and and visibility of actions using the current list of recent files
|
private |
maximum of entries; adding more will delete the oldest one
|
private |
.. and the actions to go with it
|
private |
list of the recently opened files actions (menu entries)
|
private |
holds the menu and the filenames (as QActions)