OpenMS
3.1.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
RecentFilesMenu.h
Go to the documentation of this file.
1
// Copyright (c) 2002-2023, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2
// SPDX-License-Identifier: BSD-3-Clause
3
//
4
// --------------------------------------------------------------------------
5
// $Maintainer: Chris Bielow $
6
// $Authors: Chris Bielow $
7
// --------------------------------------------------------------------------
8
9
#pragma once
10
11
// OpenMS_GUI config
12
#include <OpenMS/VISUAL/OpenMS_GUIConfig.h>
13
14
#include <
OpenMS/KERNEL/StandardTypes.h
>
15
16
#include <QMenu>
17
#include <QStringList>
18
19
#include <vector>
20
21
class
QAction;
22
23
namespace
OpenMS
24
{
25
class
Param;
26
class
String;
27
33
class
RecentFilesMenu
34
:
public
QObject
35
{
36
Q_OBJECT
37
38
signals:
40
void
recentFileClicked
(
const
String
& filename);
41
42
public
:
44
RecentFilesMenu
(
int
max_entries = 15);
45
47
void
set
(
const
QStringList& initial);
48
57
unsigned
setFromParam
(
const
Param
& filenames);
58
63
Param
getAsParam
()
const
;
64
66
QMenu*
getMenu
();
67
69
const
QStringList&
get
()
const
;
70
71
public
slots:
73
void
add
(
const
String
& filename);
74
75
private
slots:
77
void
itemClicked_
();
78
79
private
:
81
void
sync_
();
82
84
QMenu
recent_menu_
;
86
int
max_entries_
;
88
QStringList
recent_files_
;
90
std::vector<QAction*>
recent_actions_
;
91
};
92
93
}
//namespace
94
StandardTypes.h
OpenMS::Param
Management and storage of parameters / INI files.
Definition:
Param.h:44
OpenMS::RecentFilesMenu
Manages recent files opened by the user and provides a QMenu to go with it.
Definition:
RecentFilesMenu.h:35
OpenMS::RecentFilesMenu::getAsParam
Param getAsParam() const
Convert current file list to Param. Their names are just numbers, starting at "0"....
OpenMS::RecentFilesMenu::RecentFilesMenu
RecentFilesMenu(int max_entries=15)
C'tor.
OpenMS::RecentFilesMenu::recent_actions_
std::vector< QAction * > recent_actions_
.. and the actions to go with it
Definition:
RecentFilesMenu.h:90
OpenMS::RecentFilesMenu::recent_files_
QStringList recent_files_
list of the recently opened files actions (menu entries)
Definition:
RecentFilesMenu.h:88
OpenMS::RecentFilesMenu::setFromParam
unsigned setFromParam(const Param &filenames)
Extracts all values from all elements in the param object and tries to interpret them as filenames If...
OpenMS::RecentFilesMenu::getMenu
QMenu * getMenu()
get a menu-pointer to an internal member which always contains the up-to-date recent items
OpenMS::RecentFilesMenu::recentFileClicked
void recentFileClicked(const String &filename)
when a recent file action item from the getMenu() was clicked
OpenMS::RecentFilesMenu::itemClicked_
void itemClicked_()
invoked by the QAction when it was clicked; emits recentFileClicked(String filename)
OpenMS::RecentFilesMenu::add
void add(const String &filename)
put a new recent file at the top (removing any duplicates in other positions); will update the QMenu
OpenMS::RecentFilesMenu::sync_
void sync_()
updates the menu by synching text and and visibility of actions using the current list of recent file...
OpenMS::RecentFilesMenu::get
const QStringList & get() const
current list of recent files (most recent first)
OpenMS::RecentFilesMenu::recent_menu_
QMenu recent_menu_
holds the menu and the filenames (as QActions)
Definition:
RecentFilesMenu.h:84
OpenMS::RecentFilesMenu::max_entries_
int max_entries_
maximum of entries; adding more will delete the oldest one
Definition:
RecentFilesMenu.h:86
OpenMS::RecentFilesMenu::set
void set(const QStringList &initial)
sets a list of recent files (up to max_entries many – see C'tor)
OpenMS::String
A more convenient string class.
Definition:
String.h:34
QObject
OpenMS
Main OpenMS namespace.
Definition:
FeatureDeconvolution.h:22
OpenMS
VISUAL
RecentFilesMenu.h
Generated on Wed Oct 18 2023 11:33:44 for OpenMS by
1.9.1