BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
JobView Class Reference

Description

The JobView class is a main view to show list of jobs, job results and widgets for real time and fitting activities.

Definition at line 37 of file JobView.h.

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

Public Slots

void onFocusRequest (JobItem *jobItem)
 
void onSelectionChanged (const QVector< JobItem * > &jobs)
 Propagates change in JobItem's selection down into main widgets. More...
 
void setActivity (JobViewActivity activity)
 Sets docks visibility in accordance with required activity. More...
 

Signals

void activityChanged (JobViewActivity activity)
 
void focusRequest (int)
 

Public Member Functions

 JobView (MainWindow *mainWindow, ProjectDocument *document)
 
void fillViewMenu (QMenu *menu)
 

Private Member Functions

void connectActivityRelated ()
 Connects signal related to activity change. More...
 
void connectJobRelated ()
 Connects signals related to JobItem. More...
 
void connectSignals ()
 
void createActions ()
 
void createSubWindows ()
 
void resetLayout ()
 
void setAppropriateActivityForJob (JobItem *jobItem)
 Sets appropriate activity for new JobItem. More...
 

Private Attributes

QActionGroup m_activityActions
 
DocksControllerm_docks
 
ProjectDocumentm_document
 
FitActivityPanelm_fitActivityPanel = nullptr
 
JobMessagePanelm_jobMessagePanel = nullptr
 
JobRealTimeWidgetm_jobRealTimeWidget = nullptr
 
JobResultsPresenterm_jobResultsPresenter = nullptr
 
JobSelectorWidgetm_jobSelector = nullptr
 
JobProgressAssistantm_progressAssistant
 

Constructor & Destructor Documentation

◆ JobView()

JobView::JobView ( MainWindow mainWindow,
ProjectDocument document 
)

Definition at line 30 of file JobView.cpp.

31  : m_docks(new DocksController(this))
33  , m_activityActions(this)
34  , m_document(document)
35 {
36  setObjectName("JobView");
37  createActions();
40 }
Handles creation and appearance of docked widgets in the context of QMainWindow. It is used for Sampl...
The JobProgressAssistant class helps JobView to visualize current progress.
void createActions()
Definition: JobView.cpp:118
DocksController * m_docks
Definition: JobView.h:64
JobProgressAssistant * m_progressAssistant
Definition: JobView.h:65
ProjectDocument * m_document
Definition: JobView.h:74
void connectSignals()
Definition: JobView.cpp:129
void createSubWindows()
Definition: JobView.cpp:98
QActionGroup m_activityActions
Definition: JobView.h:73
JobModel * jobModel() const
static QMainWindow * mainWindow
Definition: Globals.h:22

References connectSignals(), createActions(), and createSubWindows().

Here is the call graph for this function:

Member Function Documentation

◆ activityChanged

void JobView::activityChanged ( JobViewActivity  activity)
signal

◆ connectActivityRelated()

void JobView::connectActivityRelated ( )
private

Connects signal related to activity change.

Definition at line 137 of file JobView.cpp.

138 {
139  // Activity was changed: this -> JobResultsPresenter
141  qOverload<JobViewActivity>(&JobResultsPresenter::setPresentation));
142 }
void setPresentation(const QString &presentationType) override
Sets stack to show widget corresponding to given presentation.
JobResultsPresenter * m_jobResultsPresenter
Definition: JobView.h:68
void activityChanged(JobViewActivity activity)

References activityChanged(), m_jobResultsPresenter, and JobResultsPresenter::setPresentation().

Referenced by connectSignals().

Here is the call graph for this function:

◆ connectJobRelated()

void JobView::connectJobRelated ( )
private

Connects signals related to JobItem.

Definition at line 145 of file JobView.cpp.

146 {
147  // Focus request: JobModel -> this
149 
150  // JobItem selection: JobSelectorWidget -> this
153 
156 
157  // activate view for the selected job at project opening
159 }
void showLog(FitLog *log)
void setLog(FitLog *log)
void focusRequest(JobItem *item)
void selectedJobsChanged(const QVector< JobItem * > &jobs)
QVector< JobItem * > selectedJobs() const
FitActivityPanel * m_fitActivityPanel
Definition: JobView.h:70
void onSelectionChanged(const QVector< JobItem * > &jobs)
Propagates change in JobItem's selection down into main widgets.
Definition: JobView.cpp:88
void onFocusRequest(JobItem *jobItem)
Definition: JobView.cpp:57
JobSelectorWidget * m_jobSelector
Definition: JobView.h:67
JobMessagePanel * m_jobMessagePanel
Definition: JobView.h:71

References JobModel::focusRequest(), ProjectDocument::jobModel(), m_document, m_fitActivityPanel, m_jobMessagePanel, m_jobSelector, onFocusRequest(), onSelectionChanged(), JobSelectorWidget::selectedJobs(), JobSelectorWidget::selectedJobsChanged(), JobMessagePanel::setLog(), and FitActivityPanel::showLog().

Referenced by connectSignals().

Here is the call graph for this function:

◆ connectSignals()

void JobView::connectSignals ( )
private

Definition at line 129 of file JobView.cpp.

130 {
133 }
void connectJobRelated()
Connects signals related to JobItem.
Definition: JobView.cpp:145
void connectActivityRelated()
Connects signal related to activity change.
Definition: JobView.cpp:137

References connectActivityRelated(), and connectJobRelated().

Referenced by JobView().

Here is the call graph for this function:

◆ createActions()

void JobView::createActions ( )
private

Definition at line 118 of file JobView.cpp.

119 {
120  for (JobViewActivity activity : JobViewActivities::all()) {
121  auto* action = new QAction(this);
122  action->setText(JobViewActivities::name(activity));
123  action->setCheckable(true);
124  connect(action, &QAction::triggered, [=]() { setActivity(activity); });
125  m_activityActions.addAction(action);
126  }
127 }
JobViewActivity
void setActivity(JobViewActivity activity)
Sets docks visibility in accordance with required activity.
Definition: JobView.cpp:73
QString name(JobViewActivity activity)
Returns name of activity.
QList< JobViewActivity > all()
Returns list of all available activities.

References JobViewActivities::all(), m_activityActions, JobViewActivities::name(), and setActivity().

Referenced by JobView().

Here is the call graph for this function:

◆ createSubWindows()

void JobView::createSubWindows ( )
private

Definition at line 98 of file JobView.cpp.

99 {
105 
106  m_docks->addWidget(JobViewFlags::JOB_LIST_DOCK, m_jobSelector, Qt::LeftDockWidgetArea);
110 
112 
113  setCentralWidget(m_jobResultsPresenter);
114 
115  resetLayout();
116 }
void addWidget(int id, QWidget *widget, Qt::DockWidgetArea area)
The FitActivityPanel class is a main widget to run the fitting. Occupies bottom right corner of JobVi...
void setRealTimeWidget(JobRealTimeWidget *realTimeWidget)
The JobMessagePanel class shows log messages from FitActivityPanel at the bottom part of JobView.
The JobRealTimeWidget class provides tuning of sample parameters in real time. Located on the right s...
Presents results of job (JobItem) using stack of different widgets and combo box in the right top cor...
The JobSelectorWidget class represents left panel of JobView. Contains a tree to select jobs on the t...
JobRealTimeWidget * m_jobRealTimeWidget
Definition: JobView.h:69
void resetLayout()
Definition: JobView.cpp:177

References DocksController::addWidget(), JobViewFlags::FIT_PANEL_DOCK, JobViewFlags::JOB_LIST_DOCK, JobViewFlags::JOB_MESSAGE_DOCK, ProjectDocument::jobModel(), m_docks, m_document, m_fitActivityPanel, m_jobMessagePanel, m_jobRealTimeWidget, m_jobResultsPresenter, m_jobSelector, JobViewFlags::REAL_TIME_DOCK, resetLayout(), and FitActivityPanel::setRealTimeWidget().

Referenced by JobView().

Here is the call graph for this function:

◆ fillViewMenu()

void JobView::fillViewMenu ( QMenu *  menu)

Definition at line 42 of file JobView.cpp.

43 {
44  menu->addActions(m_activityActions.actions());
45  menu->addSeparator();
46 
48 
49  menu->addSeparator();
50 
51  auto* action = new QAction(menu);
52  action->setText("Reset to default layout");
53  connect(action, &QAction::triggered, this, &JobView::resetLayout);
54  menu->addAction(action);
55 }
void addDockActionsToMenu(QMenu *menu)

References DocksController::addDockActionsToMenu(), m_activityActions, m_docks, and resetLayout().

Here is the call graph for this function:

◆ focusRequest

void JobView::focusRequest ( int  )
signal

◆ onFocusRequest

void JobView::onFocusRequest ( JobItem jobItem)
slot

Definition at line 57 of file JobView.cpp.

58 {
59  if (jobItem->runInBackground())
60  return;
61 
62  QVector<JobItem*> jobs = m_jobSelector->selectedJobs();
63  if (jobs.size() != 1 || jobItem != jobs.front()) {
66  }
67 
69 }
bool runInBackground() const
Definition: JobItem.cpp:217
void makeJobItemSelected(JobItem *)
void setAppropriateActivityForJob(JobItem *jobItem)
Sets appropriate activity for new JobItem.
Definition: JobView.cpp:163
void focusRequest(int)

References focusRequest(), MainWindow::JOB, m_jobSelector, JobSelectorWidget::makeJobItemSelected(), JobItem::runInBackground(), JobSelectorWidget::selectedJobs(), and setAppropriateActivityForJob().

Referenced by connectJobRelated().

Here is the call graph for this function:

◆ onSelectionChanged

void JobView::onSelectionChanged ( const QVector< JobItem * > &  jobs)
slot

Propagates change in JobItem's selection down into main widgets.

Definition at line 88 of file JobView.cpp.

89 {
90  JobItem* jobItem = nullptr;
91  if (jobs.size() == 1)
92  jobItem = jobs.front();
94  m_jobRealTimeWidget->setItem(jobItem);
95  m_fitActivityPanel->setItem(jobItem);
96 }
void setItem(JobItem *item)
void setItem(JobItem *jobItem)
void setItem(SessionItem *item) override

References m_fitActivityPanel, m_jobRealTimeWidget, m_jobResultsPresenter, FitActivityPanel::setItem(), JobRealTimeWidget::setItem(), and JobResultsPresenter::setItem().

Referenced by connectJobRelated().

Here is the call graph for this function:

◆ resetLayout()

void JobView::resetLayout ( )
private

Definition at line 177 of file JobView.cpp.

References JobView, m_docks, DocksController::resetLayout(), and setActivity().

Referenced by createSubWindows(), and fillViewMenu().

Here is the call graph for this function:

◆ setActivity

void JobView::setActivity ( JobViewActivity  activity)
slot

Sets docks visibility in accordance with required activity.

Definition at line 73 of file JobView.cpp.

74 {
75  QVector<JobViewFlags::Dock> docksToShow = JobViewActivities::activeDocks(activity);
76 
77  std::vector<int> docks_id;
78  for (auto x : docksToShow)
79  docks_id.push_back(static_cast<int>(x));
80 
81  m_docks->setVisibleDocks(docks_id);
82  m_activityActions.actions()[static_cast<int>(activity)]->setChecked(true);
83  emit activityChanged(activity);
84 }
void setVisibleDocks(const std::vector< int > &visibleDocks)
Show docks with id's from the list. Other docks will be hidden.
QVector< JobViewFlags::Dock > activeDocks(JobViewActivity activity)
Returns vector of JobView's dockId which have to be shown for given activity.

References JobViewActivities::activeDocks(), activityChanged(), m_activityActions, m_docks, and DocksController::setVisibleDocks().

Referenced by createActions(), and resetLayout().

Here is the call graph for this function:

◆ setAppropriateActivityForJob()

void JobView::setAppropriateActivityForJob ( JobItem jobItem)
private

Sets appropriate activity for new JobItem.

Definition at line 163 of file JobView.cpp.

164 {
165  if (!jobItem)
166  return;
167 
168  if (jobItem->isValidForFitting()) {
169  // fitting presentation
171  // ALTERNATIVE:
172  // fitting activity
173  // setActivity(JobViewActivity::Fitting);
174  }
175 }
bool isValidForFitting()
Definition: JobItem.cpp:154

References Fitting, JobItem::isValidForFitting(), m_jobResultsPresenter, and JobResultsPresenter::setPresentation().

Referenced by onFocusRequest().

Here is the call graph for this function:

Member Data Documentation

◆ m_activityActions

QActionGroup JobView::m_activityActions
private

Definition at line 73 of file JobView.h.

Referenced by createActions(), fillViewMenu(), and setActivity().

◆ m_docks

DocksController* JobView::m_docks
private

Definition at line 64 of file JobView.h.

Referenced by createSubWindows(), fillViewMenu(), resetLayout(), and setActivity().

◆ m_document

ProjectDocument* JobView::m_document
private

Definition at line 74 of file JobView.h.

Referenced by connectJobRelated(), and createSubWindows().

◆ m_fitActivityPanel

FitActivityPanel* JobView::m_fitActivityPanel = nullptr
private

Definition at line 70 of file JobView.h.

Referenced by connectJobRelated(), createSubWindows(), and onSelectionChanged().

◆ m_jobMessagePanel

JobMessagePanel* JobView::m_jobMessagePanel = nullptr
private

Definition at line 71 of file JobView.h.

Referenced by connectJobRelated(), and createSubWindows().

◆ m_jobRealTimeWidget

JobRealTimeWidget* JobView::m_jobRealTimeWidget = nullptr
private

Definition at line 69 of file JobView.h.

Referenced by createSubWindows(), and onSelectionChanged().

◆ m_jobResultsPresenter

JobResultsPresenter* JobView::m_jobResultsPresenter = nullptr
private

◆ m_jobSelector

JobSelectorWidget* JobView::m_jobSelector = nullptr
private

Definition at line 67 of file JobView.h.

Referenced by connectJobRelated(), createSubWindows(), and onFocusRequest().

◆ m_progressAssistant

JobProgressAssistant* JobView::m_progressAssistant
private

Definition at line 65 of file JobView.h.


The documentation for this class was generated from the following files: