BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
gui2::LoaderSelectorPanel Class Reference

Panel with settings for DataLoaderDialog. More...

Inheritance diagram for gui2::LoaderSelectorPanel:
[legend]
Collaboration diagram for gui2::LoaderSelectorPanel:
[legend]

Public Slots

QStringList fileNames () const
 
void onAddFilesRequest ()
 
void onRemoveFileRequest ()
 
QStringList selectedFileNames () const
 

Signals

void fileNamesChanged (const QStringList &file_names)
 
void fileSelectionChanged (const QStringList &file_names)
 
void parserPropertyChanged ()
 

Public Member Functions

 LoaderSelectorPanel (QWidget *parent=nullptr)
 
 ~LoaderSelectorPanel ()
 
std::unique_ptr< ParserInterfacecreateParser () const
 
void setTargetCanvas (const QStringList &canvas_names, int current_index)
 
int targetCanvasIndex () const
 

Private Member Functions

void init_connections ()
 

Private Attributes

ImportFileWidgetm_fileSelectorWidget {nullptr}
 
ParserPropertyWidgetm_propertyWidget {nullptr}
 
QSplitter * m_splitter {nullptr}
 
int m_targetCanvasIndex {-1}
 

Detailed Description

Panel with settings for DataLoaderDialog.

Located on its left side, contains file selection dialog and parser property widget.

Definition at line 33 of file loaderselectorpanel.h.

Constructor & Destructor Documentation

◆ LoaderSelectorPanel()

gui2::LoaderSelectorPanel::LoaderSelectorPanel ( QWidget *  parent = nullptr)

Definition at line 24 of file loaderselectorpanel.cpp.

25  : QWidget(parent)
26  , m_fileSelectorWidget(new ImportFileWidget)
27  , m_propertyWidget(new ParserPropertyWidget)
28  , m_splitter(new QSplitter)
29 {
30  auto layout = new QVBoxLayout(this);
31  layout->setContentsMargins(0, 0, 0, 0);
32 
33  m_splitter->setOrientation(Qt::Vertical);
34  m_splitter->setChildrenCollapsible(false);
35 
36  m_splitter->addWidget(m_fileSelectorWidget);
37  m_splitter->addWidget(m_propertyWidget);
38 
39  layout->addWidget(m_splitter);
40 
42 }
ParserPropertyWidget * m_propertyWidget
ImportFileWidget * m_fileSelectorWidget

References init_connections(), m_fileSelectorWidget, m_propertyWidget, and m_splitter.

Here is the call graph for this function:

◆ ~LoaderSelectorPanel()

gui2::LoaderSelectorPanel::~LoaderSelectorPanel ( )
default

Member Function Documentation

◆ createParser()

std::unique_ptr< ParserInterface > gui2::LoaderSelectorPanel::createParser ( ) const

Definition at line 46 of file loaderselectorpanel.cpp.

47 {
49 }
std::unique_ptr< ParserInterface > createParser() const
Creates parser from parser properties.

References gui2::ParserPropertyWidget::createParser(), and m_propertyWidget.

Referenced by gui2::DataLoaderDialog::onParseAllRequest(), and gui2::DataLoaderDialog::onShowFilePreviewRequest().

Here is the call graph for this function:

◆ fileNames

QStringList gui2::LoaderSelectorPanel::fileNames ( ) const
slot

Definition at line 76 of file loaderselectorpanel.cpp.

77 {
79 }
QStringList fileNames() const
Retuns the list of all file names imported by the user.

References gui2::ImportFileWidget::fileNames(), and m_fileSelectorWidget.

Referenced by gui2::DataLoaderDialog::fileNames(), gui2::DataLoaderDialog::onLoadFilesRequest(), and gui2::DataLoaderDialog::onParseAllRequest().

Here is the call graph for this function:

◆ fileNamesChanged

void gui2::LoaderSelectorPanel::fileNamesChanged ( const QStringList &  file_names)
signal

◆ fileSelectionChanged

void gui2::LoaderSelectorPanel::fileSelectionChanged ( const QStringList &  file_names)
signal

◆ init_connections()

void gui2::LoaderSelectorPanel::init_connections ( )
private

Definition at line 81 of file loaderselectorpanel.cpp.

82 {
83  auto on_file_names_changed = [this]() { fileNamesChanged(m_fileSelectorWidget->fileNames()); };
84  connect(m_fileSelectorWidget, &ImportFileWidget::fileNamesChanged, on_file_names_changed);
85 
86  auto on_selection_changed = [this]() {
88  };
89  connect(m_fileSelectorWidget, &ImportFileWidget::fileSelectionChanged, on_selection_changed);
90 
93 
94  auto on_target_changed = [this](auto index) { m_targetCanvasIndex = index; };
95  connect(m_propertyWidget, &ParserPropertyWidget::targetCanvasChanged, on_target_changed);
96 }
QStringList selectedFileNames() const
Retuns the list of currently selected file names.
void fileNamesChanged(const QStringList &file_names)
void fileSelectionChanged(const QStringList &file_names)
int targetCanvasChanged(int canvas_index)

References gui2::ImportFileWidget::fileNames(), gui2::ImportFileWidget::fileNamesChanged(), fileNamesChanged(), gui2::ImportFileWidget::fileSelectionChanged(), fileSelectionChanged(), m_fileSelectorWidget, m_propertyWidget, m_targetCanvasIndex, parserPropertyChanged(), gui2::ParserPropertyWidget::parserPropertyChanged(), gui2::ImportFileWidget::selectedFileNames(), and gui2::ParserPropertyWidget::targetCanvasChanged().

Referenced by LoaderSelectorPanel().

Here is the call graph for this function:

◆ onAddFilesRequest

void gui2::LoaderSelectorPanel::onAddFilesRequest ( )
slot

Definition at line 61 of file loaderselectorpanel.cpp.

62 {
64 }
void onAddFilesRequest()
Summons dialog for file selections, update list view with file names.

References m_fileSelectorWidget, and gui2::ImportFileWidget::onAddFilesRequest().

Referenced by gui2::DataLoaderDialog::initConnections(), and gui2::DataLoaderDialog::invokeFileSelectorDialog().

Here is the call graph for this function:

◆ onRemoveFileRequest

void gui2::LoaderSelectorPanel::onRemoveFileRequest ( )
slot

Definition at line 66 of file loaderselectorpanel.cpp.

67 {
69 }
void onRemoveFileRequest()
Removes currently selected file.

References m_fileSelectorWidget, and gui2::ImportFileWidget::onRemoveFileRequest().

Referenced by gui2::DataLoaderDialog::initConnections().

Here is the call graph for this function:

◆ parserPropertyChanged

void gui2::LoaderSelectorPanel::parserPropertyChanged ( )
signal

◆ selectedFileNames

QStringList gui2::LoaderSelectorPanel::selectedFileNames ( ) const
slot

Definition at line 71 of file loaderselectorpanel.cpp.

72 {
74 }

References m_fileSelectorWidget, and gui2::ImportFileWidget::selectedFileNames().

Referenced by gui2::DataLoaderDialog::onShowFilePreviewRequest().

Here is the call graph for this function:

◆ setTargetCanvas()

void gui2::LoaderSelectorPanel::setTargetCanvas ( const QStringList &  canvas_names,
int  current_index 
)

Definition at line 51 of file loaderselectorpanel.cpp.

52 {
53  m_propertyWidget->setTargetCanvas(canvas_names, current_index);
54 }
void setTargetCanvas(const QStringList &canvas_names, int current_index)
Sets list of canvas names as possible import targets.

References m_propertyWidget, and gui2::ParserPropertyWidget::setTargetCanvas().

Referenced by gui2::DataLoaderDialog::setTargetCanvas().

Here is the call graph for this function:

◆ targetCanvasIndex()

int gui2::LoaderSelectorPanel::targetCanvasIndex ( ) const

Definition at line 56 of file loaderselectorpanel.cpp.

57 {
58  return m_targetCanvasIndex;
59 }

References m_targetCanvasIndex.

Referenced by gui2::DataLoaderDialog::targetCanvasIndex().

Member Data Documentation

◆ m_fileSelectorWidget

ImportFileWidget* gui2::LoaderSelectorPanel::m_fileSelectorWidget {nullptr}
private

◆ m_propertyWidget

ParserPropertyWidget* gui2::LoaderSelectorPanel::m_propertyWidget {nullptr}
private

◆ m_splitter

QSplitter* gui2::LoaderSelectorPanel::m_splitter {nullptr}
private

Definition at line 63 of file loaderselectorpanel.h.

Referenced by LoaderSelectorPanel().

◆ m_targetCanvasIndex

int gui2::LoaderSelectorPanel::m_targetCanvasIndex {-1}
private

Definition at line 60 of file loaderselectorpanel.h.

Referenced by init_connections(), and targetCanvasIndex().


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