OpenMS  2.6.0
Public Slots | Signals | Public Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
RecentFilesMenu Class Reference

Manages recent files opened by the user and provides a QMenu to go with it. More...

#include <OpenMS/VISUAL/RecentFilesMenu.h>

Inheritance diagram for RecentFilesMenu:
[legend]
Collaboration diagram for RecentFilesMenu:
[legend]

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...
 
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...
 

Detailed Description

Manages recent files opened by the user and provides a QMenu to go with it.

Constructor & Destructor Documentation

◆ RecentFilesMenu()

RecentFilesMenu ( int  max_entries = 15)

C'tor.

Member Function Documentation

◆ add

void add ( const String filename)
slot

put a new recent file at the top (removing any duplicates in other positions); will update the QMenu

Referenced by TOPPViewBase::addRecentFile_().

◆ get()

const QStringList& get ( ) const

current list of recent files (most recent first)

Referenced by TOPPViewBase::savePreferences().

◆ getMenu()

QMenu* getMenu ( )

get a menu-pointer to an internal member which always contains the up-to-date recent items

◆ itemClicked_

void itemClicked_ ( )
privateslot

invoked by the QAction when it was clicked; emits recentFileClicked(String filename)

◆ recentFileClicked

void recentFileClicked ( const String filename)
signal

when a recent file action item from the getMenu() was clicked

Referenced by TOPPViewBase::TOPPViewBase().

◆ set()

void set ( const QStringList &  initial)

sets a list of recent files (up to max_entries many – see C'tor)

Referenced by TOPPViewBase::loadPreferences().

◆ sync_()

void sync_ ( )
private

updates the menu by synching text and and visibility of actions using the current list of recent files

Member Data Documentation

◆ max_entries_

int max_entries_
private

maximum of entries; adding more will delete the oldest one

◆ recent_actions_

std::vector<QAction*> recent_actions_
private

.. and the actions to go with it

◆ recent_files_

QStringList recent_files_
private

list of the recently opened files actions (menu entries)

◆ recent_menu_

QMenu recent_menu_
private

holds the menu and the filenames (as QActions)