BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
JobViewActivities.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/View/Job/JobViewActivities.cpp
6 //! @brief Implements class JobViewActivities
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
16 #include "Base/Util/Assert.h"
18 
19 namespace {
20 
21 QMap<JobViewActivity, QVector<JobViewFlags::Dock>> createActivityMap()
22 {
23  QMap<JobViewActivity, QVector<JobViewFlags::Dock>> result;
24  result[JobViewActivity::JobView] = QVector<JobViewFlags::Dock>() << JobViewFlags::JOB_LIST_DOCK;
25  result[JobViewActivity::RealTime] = QVector<JobViewFlags::Dock>()
27  result[JobViewActivity::Fitting] = QVector<JobViewFlags::Dock>()
31  return result;
32 }
33 
34 QMap<JobViewActivity, QVector<JobViewFlags::Dock>> activityToDocks = createActivityMap();
35 
36 QMap<JobViewActivity, QString> activityNames = {
40 
41 } // namespace
42 
43 namespace JobViewActivities {
44 
45 //! Returns list of all available activities.
46 
47 QList<JobViewActivity> all()
48 {
49  return activityNames.keys();
50 }
51 
52 //! Returns name of activity.
53 
54 QString name(JobViewActivity activity)
55 {
56  QMap<JobViewActivity, QString>::const_iterator it = activityNames.find(activity);
57  ASSERT(it != activityNames.end());
58  return it.value();
59 }
60 
61 //! Returns vector of JobView's dockId which have to be shown for given activity.
62 
63 QVector<JobViewFlags::Dock> activeDocks(JobViewActivity activity)
64 {
65  QMap<JobViewActivity, QVector<JobViewFlags::Dock>>::const_iterator it =
66  activityToDocks.find(activity);
67  ASSERT(it != activityToDocks.end());
68  return it.value();
69 }
70 
71 } // namespace JobViewActivities
Defines class JobViewActivities.
JobViewActivity
Defines namespace GUI::Constants.
const QString JobViewActivityName
const QString JobRealTimeActivityName
const QString JobFittingActivityName
The JobViewActivities namespace is a helper to get info related to JobView activities.
QString name(JobViewActivity activity)
Returns name of activity.
QVector< JobViewFlags::Dock > activeDocks(JobViewActivity activity)
Returns vector of JobView's dockId which have to be shown for given activity.
QList< JobViewActivity > all()
Returns list of all available activities.