Mantid
|
This class defines the interface and functionality for the cataloging system within Mantid. More...
#include <CatalogSearch.h>
Public Member Functions | |
CatalogSearch (QWidget *parent=nullptr) | |
Default constructor. More... | |
~CatalogSearch () override | |
Destructor. More... | |
Private Slots | |
void | advancedSearchChecked () |
Show the advanced field when checked. More... | |
void | dataFileCheckboxSelected (QTableWidgetItem *item) |
Select/Deselect row when a checkbox is selected. More... | |
void | dataFileRowSelected () |
Select/Deselect row & check-box when a row is selected. More... | |
void | dateSelected (QDate date) |
Update text field when date is selected. More... | |
void | disableDatafileButtons () |
Disable load/download buttons if no datafile is selected. More... | |
void | doFilter (const int &index) |
Performs filterDataFileType() for specified filer type. More... | |
void | downloadDataFiles () |
Downloads selected datFiles to a specified location. More... | |
void | goToInputPage () |
Populate's result table depending page number input by user. More... | |
void | helpClicked () |
When the help button is clicked. More... | |
void | hideErrorLabels () |
Hide the error message labels. More... | |
void | investigationSelected (QTableWidgetItem *item) |
Checks that the investigation is selected and performs investigationClicked. More... | |
void | loadDataFiles () |
Loads the selected dataFiles into workspaces. More... | |
void | nextPageClicked () |
Populate the result table, and update the page number. More... | |
void | onFacilityLogin () |
When the facility login button is clicked. More... | |
void | onReset () |
Reset all fields when "Reset" is clicked. More... | |
void | openCalendar () |
Open the DateTime Calendar to select date. More... | |
void | openFacilitySelection () |
Enables user to select specific facilities that they want to search the catalogs of. More... | |
void | prevPageClicked () |
Populate the result table, and update the page number. More... | |
void | searchClicked () |
When the "Search" button is clicked, display "Search results" frame. More... | |
void | selectAllDataFiles (const bool &toggled) |
Selects/deselects ALL rows in dataFile table. More... | |
void | showCatalogSearch () |
When checked, show the Catalog search frame. More... | |
void | showDataFileInfo () |
When checked, show the data file info frame. More... | |
void | showErrorLabels (std::map< std::string, std::string > &errors) |
Show the error message labels, including the error message on the tooltips. More... | |
void | showSearchResults () |
Shows/Hides the "Search results" frame when search results combo box is checked. More... | |
void | sortByFileSize (int column) |
Sort table by file size when certain column is clicked (E.g. More... | |
Private Member Functions | |
void | addCheckBoxColumn (QTableWidget *table) |
Add a row of checkboxes to the first column of a table. More... | |
void | clearDataFileFrame () |
Clear "dataFileFrame" when the user tries to search again. More... | |
void | clearSearch (QTableWidget *table, const std::string &workspace) |
Removes data associated with previous search. More... | |
void | clearSearchFrame () |
Clear the "search" frame when an investigation has been selected. More... | |
void | clearSearchResultFrame () |
Clear the "search results" frame if no results are returned from search. More... | |
void | correctedToolTip (const std::string &toolTip, QLabel *label) |
void | dateSelected (const std::string &buttonName) |
void | disableDownloadButtonIfArchives (int row) |
Disable the download button if user can access the files locally from the archives. More... | |
void | emboldenTableHeaders (QTableWidget *table) |
Make the headers in the provided table bold. More... | |
std::unordered_set< std::string > | getDataFileExtensions (const Mantid::API::Column_sptr &column) |
Obtain all file extensions from the provided column (dataFileResults -> File name). More... | |
const std::map< std::string, std::string > | getSearchFields () |
Obtain the users' text input for each search field. More... | |
int | headerIndexByName (QTableWidget *table, const std::string &searchFor) |
Obtain the index of the column in a table that contains a specified name. More... | |
virtual void | initLayout () |
Initialise the layout. More... | |
void | loadSettings () |
Read settings from store. More... | |
void | populateDataFileTable () |
Populates the table from the results of investigationSelected();. More... | |
void | populateDataFileType (const std::unordered_set< std::string > &extensions) |
Add the list of file extensions to the "Filter type..." drop-down. More... | |
void | populateInstrumentBox () |
Populate the instrument list-box. More... | |
void | populateInvestigationTypeBox () |
Populate the investigation type list-box. More... | |
void | populateResultTable (int sort_section, Qt::SortOrder sort_order) |
Outputs the results of the query into a table. More... | |
void | populateTable (QTableWidget *table, const Mantid::API::ITableWorkspace_sptr &workspace) |
Populate the provided table with data from the provided workspace. More... | |
void | saveSettings () |
Save the current state of ICAT for next time. More... | |
const std::vector< std::pair< int64_t, std::string > > | selectedDataFileNames () |
Obtain the file details (file ID and name) for the file to download. More... | |
std::string | selectedInvestigationSession () |
Obtain the sessionID for the selected investigation. More... | |
void | setupTable (QTableWidget *table, const size_t &numOfRows, const size_t &numOfColumns) |
Setup table prior to adding data to it, such hiding vertical header. More... | |
void | updateDataFileLabels (QTableWidgetItem *item) |
Updates the dataFile text boxes with relevant info about the selected dataFile. More... | |
bool | validateDates () |
Checks if start date is greater than end date. More... | |
Private Attributes | |
QCalendarWidget * | m_calendar |
The calendar widget that will allow the user to select start and end date/times. More... | |
CatalogSelector * | m_catalogSelector |
Access methods of catalog selector GUI, e.g. selected facilities. More... | |
int | m_currentPageNumber |
The current page the user is on in the results window. Used for paging. More... | |
CheckboxHeader * | m_customHeader |
The custom table header with checkbox functionality. More... | |
QString | m_dateButtonName |
The name of the date button the user pressed to open the calendar. More... | |
QString | m_downloadSaveDir |
The directory to save the downloaded dataFiles. More... | |
CatalogHelper * | m_icatHelper |
The helper class that accesses ICAT algorithmic functionality. More... | |
Ui::CatalogSearch | m_icatUiForm |
The form generated by QT Designer. More... | |
This class defines the interface and functionality for the cataloging system within Mantid.
Definition at line 28 of file CatalogSearch.h.
MantidQt::MantidWidgets::CatalogSearch::CatalogSearch | ( | QWidget * | parent = nullptr | ) |
Default constructor.
Constructor.
Definition at line 34 of file CatalogSearch.cpp.
References initLayout(), and loadSettings().
|
override |
Destructor.
|
private |
Add a row of checkboxes to the first column of a table.
table | :: The table to add the checkboxes to. |
Definition at line 956 of file CatalogSearch.cpp.
References m_customHeader, and selectAllDataFiles().
Referenced by populateDataFileTable().
|
privateslot |
Show the advanced field when checked.
Show or hide advanced options if "Advanced Search" checked.
Definition at line 539 of file CatalogSearch.cpp.
References m_icatUiForm.
Referenced by initLayout().
|
private |
Clear "dataFileFrame" when the user tries to search again.
Definition at line 316 of file CatalogSearch.cpp.
References m_icatUiForm.
Referenced by populateDataFileTable(), and searchClicked().
|
private |
Removes data associated with previous search.
Clears data associated with previous search.
table | :: The table to modify and remove previous results from. |
workspace | :: The workspace to remove. |
Definition at line 284 of file CatalogSearch.cpp.
References Mantid::Kernel::SingletonHolder< T >::Instance(), setupTable(), and workspace.
Referenced by investigationSelected(), and searchClicked().
|
private |
Clear the "search" frame when an investigation has been selected.
Definition at line 297 of file CatalogSearch.cpp.
References m_icatUiForm.
Referenced by investigationSelected().
|
private |
Clear the "search results" frame if no results are returned from search.
Definition at line 305 of file CatalogSearch.cpp.
References m_icatUiForm.
Referenced by populateResultTable(), and searchClicked().
|
private |
Definition at line 528 of file CatalogSearch.cpp.
Referenced by showErrorLabels(), and validateDates().
|
privateslot |
Select/Deselect row when a checkbox is selected.
Select/Deselect row when related checkbox is selected.
item | :: The item from the table the user has selected. |
Definition at line 1198 of file CatalogSearch.cpp.
References m_icatUiForm.
Referenced by initLayout().
|
privateslot |
Select/Deselect row & check-box when a row is selected.
Disable/Enable download button if user has access to the archives.
Definition at line 1220 of file CatalogSearch.cpp.
References disableDatafileButtons(), disableDownloadButtonIfArchives(), and m_icatUiForm.
Referenced by initLayout().
|
private |
|
privateslot |
Update text field when date is selected.
date | :: The date the user has selected. |
Definition at line 490 of file CatalogSearch.cpp.
References m_calendar, m_dateButtonName, and m_icatUiForm.
Referenced by initLayout().
|
privateslot |
Disable load/download buttons if no datafile is selected.
Disable the load/download button to prevent the user from downloading/loading nothing.
Definition at line 1084 of file CatalogSearch.cpp.
References m_icatUiForm.
Referenced by dataFileRowSelected().
|
private |
Disable the download button if user can access the files locally from the archives.
row | :: The row the user has selected from the table. |
Definition at line 1053 of file CatalogSearch.cpp.
References headerIndexByName(), Mantid::Kernel::SingletonHolder< T >::Instance(), m_icatUiForm, Mantid::Kernel::makeCatalogConfigServiceAdapter(), and Mantid::Kernel::ICatalogInfo::transformArchivePath().
Referenced by dataFileRowSelected().
|
privateslot |
Performs filterDataFileType() for specified filer type.
Performs filter option for specified filer type.
Definition at line 1094 of file CatalogSearch.cpp.
References headerIndexByName(), index, and m_icatUiForm.
Referenced by initLayout().
|
privateslot |
Downloads selected datFiles to a specified location.
Definition at line 1121 of file CatalogSearch.cpp.
References MantidQt::MantidWidgets::CatalogHelper::downloadDataFiles(), m_downloadSaveDir, m_icatHelper, saveSettings(), selectedDataFileNames(), and selectedInvestigationSession().
Referenced by initLayout().
|
private |
Make the headers in the provided table bold.
Embolden the headers in the provided table.
Definition at line 210 of file CatalogSearch.cpp.
Referenced by populateTable().
|
private |
Obtain all file extensions from the provided column (dataFileResults -> File name).
Obtain all file extensions from the provided column.
column | :: The fileName column in the dataFile workspace. |
Definition at line 1026 of file CatalogSearch.cpp.
Referenced by populateDataFileTable().
|
private |
Obtain the users' text input for each search field.
Get the users' input for each search field.
Definition at line 428 of file CatalogSearch.cpp.
References m_icatUiForm.
Referenced by searchClicked().
|
privateslot |
Populate's result table depending page number input by user.
Definition at line 819 of file CatalogSearch.cpp.
References m_currentPageNumber, m_icatUiForm, and searchClicked().
Referenced by initLayout().
|
private |
Obtain the index of the column in a table that contains a specified name.
table | :: The table to search the headers on. |
searchFor | :: The header name to search against. |
Definition at line 329 of file CatalogSearch.cpp.
Referenced by disableDownloadButtonIfArchives(), doFilter(), investigationSelected(), populateDataFileTable(), populateResultTable(), selectedDataFileNames(), selectedInvestigationSession(), sortByFileSize(), and updateDataFileLabels().
|
privateslot |
When the help button is clicked.
Sends the user to relevant search page on the Mantid project site.
Definition at line 168 of file CatalogSearch.cpp.
References MantidQt::API::MantidDesktopServices::openUrl().
Referenced by initLayout().
|
privateslot |
Hide the error message labels.
Hides the error message labels on the GUI.
Definition at line 660 of file CatalogSearch.cpp.
References m_icatUiForm.
Referenced by initLayout(), and searchClicked().
|
privatevirtual |
Initialise the layout.
Destructor.
Initialise the default layout.
Definition at line 49 of file CatalogSearch.cpp.
References advancedSearchChecked(), dataFileCheckboxSelected(), dataFileRowSelected(), dateSelected(), doFilter(), downloadDataFiles(), goToInputPage(), helpClicked(), hideErrorLabels(), Mantid::Kernel::SingletonHolder< T >::Instance(), investigationSelected(), loadDataFiles(), m_calendar, m_icatUiForm, nextPageClicked(), onReset(), openCalendar(), openFacilitySelection(), populateInstrumentBox(), populateInvestigationTypeBox(), prevPageClicked(), searchClicked(), showCatalogSearch(), showDataFileInfo(), and showSearchResults().
Referenced by CatalogSearch().
|
privateslot |
Checks that the investigation is selected and performs investigationClicked.
Hides the "search results" frame, and shows the "dataFiles" frame when an investigation is selected.
Definition at line 835 of file CatalogSearch.cpp.
References clearSearch(), clearSearchFrame(), MantidQt::MantidWidgets::CatalogHelper::executeGetDataFiles(), headerIndexByName(), m_icatHelper, m_icatUiForm, populateDataFileTable(), and updateDataFileLabels().
Referenced by initLayout().
|
privateslot |
Loads the selected dataFiles into workspaces.
Definition at line 1140 of file CatalogSearch.cpp.
References MantidQt::MantidWidgets::CatalogHelper::downloadDataFiles(), Mantid::Kernel::SingletonHolder< T >::Instance(), m_downloadSaveDir, m_icatHelper, selectedDataFileNames(), and selectedInvestigationSession().
Referenced by initLayout().
|
private |
Read settings from store.
Read the saved settings from the store.
Definition at line 357 of file CatalogSearch.cpp.
References Mantid::Kernel::SingletonHolder< T >::Instance(), and m_downloadSaveDir.
Referenced by CatalogSearch().
|
privateslot |
Populate the result table, and update the page number.
Definition at line 789 of file CatalogSearch.cpp.
References m_currentPageNumber, m_icatUiForm, and searchClicked().
Referenced by initLayout().
|
privateslot |
When the facility login button is clicked.
Opens the login dialog to allow the user to log into another facility.
Definition at line 163 of file CatalogSearch.cpp.
|
privateslot |
Reset all fields when "Reset" is clicked.
Reset all fields when the "Reset" button is pressed.
Definition at line 679 of file CatalogSearch.cpp.
References m_icatUiForm.
Referenced by initLayout().
|
privateslot |
Open the DateTime Calendar to select date.
SLOTS for "Catalog Search".
Opens the DateTime m_calendar box when start or end date selected.
Definition at line 468 of file CatalogSearch.cpp.
References m_calendar, and m_dateButtonName.
Referenced by initLayout().
|
privateslot |
Enables user to select specific facilities that they want to search the catalogs of.
Allows a user to select specific facilities that they want to search the catalogs of.
Definition at line 693 of file CatalogSearch.cpp.
References m_catalogSelector, and MantidQt::MantidWidgets::CatalogSelector::populateFacilitySelection().
Referenced by initLayout().
|
private |
Populates the table from the results of investigationSelected();.
Outputs related dataFiles (from selected investigation) into the "DataFile information" table.
Definition at line 881 of file CatalogSearch.cpp.
References addCheckBoxColumn(), clearDataFileFrame(), getDataFileExtensions(), headerIndexByName(), Mantid::Kernel::SingletonHolder< T >::Instance(), m_customHeader, m_icatUiForm, populateDataFileType(), populateTable(), setupTable(), sortByFileSize(), and workspace.
Referenced by investigationSelected().
|
private |
Add the list of file extensions to the "Filter type..." drop-down.
Definition at line 1042 of file CatalogSearch.cpp.
References m_icatUiForm.
Referenced by populateDataFileTable().
|
private |
Populate the instrument list-box.
Methods for "Catalog Search".
void CatalogSearch::dateSelected(const std::string &buttonName) Populates the "Instrument" list-box
Definition at line 380 of file CatalogSearch.cpp.
References MantidQt::MantidWidgets::CatalogHelper::getInstrumentList(), MantidQt::MantidWidgets::CatalogSelector::getSelectedCatalogSessions(), Mantid::Kernel::SingletonHolder< T >::Instance(), m_catalogSelector, m_icatHelper, and m_icatUiForm.
Referenced by initLayout().
|
private |
Populate the investigation type list-box.
Populates the "Investigation type" list-box.
Definition at line 405 of file CatalogSearch.cpp.
References MantidQt::MantidWidgets::CatalogHelper::getInvestigationTypeList(), MantidQt::MantidWidgets::CatalogSelector::getSelectedCatalogSessions(), m_catalogSelector, m_icatHelper, and m_icatUiForm.
Referenced by initLayout().
|
private |
Outputs the results of the query into a table.
Outputs the results of the search into the "Search results" table.
sort_section | :: An int giving the column number by which to sort the data (0 will sort by StartDate) |
sort_order | :: A Qt::SortOrder giving the order of sorting |
Definition at line 709 of file CatalogSearch.cpp.
References clearSearchResultFrame(), headerIndexByName(), Mantid::Kernel::SingletonHolder< T >::Instance(), m_icatUiForm, populateTable(), setupTable(), and workspace.
Referenced by searchClicked().
|
private |
Populate the provided table with data from the provided workspace.
table | :: The table we want to setup. |
workspace | :: The workspace to obtain data information from. |
Definition at line 245 of file CatalogSearch.cpp.
References emboldenTableHeaders(), and workspace.
Referenced by populateDataFileTable(), and populateResultTable().
|
privateslot |
Populate the result table, and update the page number.
Definition at line 806 of file CatalogSearch.cpp.
References m_currentPageNumber, and searchClicked().
Referenced by initLayout().
|
private |
Save the current state of ICAT for next time.
Definition at line 347 of file CatalogSearch.cpp.
References m_downloadSaveDir.
Referenced by downloadDataFiles().
|
privateslot |
When the "Search" button is clicked, display "Search results" frame.
Hides the search frame, and shows search results frame when "Search" button pressed.
Definition at line 565 of file CatalogSearch.cpp.
References clearDataFileFrame(), clearSearch(), clearSearchResultFrame(), MantidQt::MantidWidgets::CatalogHelper::executeSearch(), MantidQt::MantidWidgets::CatalogHelper::getNumberOfSearchResults(), getSearchFields(), MantidQt::MantidWidgets::CatalogSelector::getSelectedCatalogSessions(), hideErrorLabels(), m_catalogSelector, m_currentPageNumber, m_icatHelper, m_icatUiForm, MantidQt::MantidWidgets::CatalogSelector::populateFacilitySelection(), populateResultTable(), showErrorLabels(), validateDates(), and MantidQt::MantidWidgets::CatalogHelper::validateProperties().
Referenced by goToInputPage(), initLayout(), nextPageClicked(), and prevPageClicked().
|
privateslot |
Selects/deselects ALL rows in dataFile table.
If the user has checked "check all", then check and select ALL rows.
Otherwise, deselect all.
toggled | :: True if user has checked the checkbox in the dataFile table header. |
Definition at line 1173 of file CatalogSearch.cpp.
References m_icatUiForm.
Referenced by addCheckBoxColumn().
|
private |
Obtain the file details (file ID and name) for the file to download.
Obtains the names of the selected dataFiles, in preparation for download.
(Used in downloadDataFiles).
Definition at line 983 of file CatalogSearch.cpp.
References headerIndexByName(), and m_icatUiForm.
Referenced by downloadDataFiles(), and loadDataFiles().
|
private |
Obtain the sessionID for the selected investigation.
Obtain the sessionID for the specific row selected in the search results table.
(only one row can be selected at a time)
Definition at line 773 of file CatalogSearch.cpp.
References headerIndexByName(), and m_icatUiForm.
Referenced by downloadDataFiles(), and loadDataFiles().
|
private |
Setup table prior to adding data to it, such hiding vertical header.
Set the table properties prior to adding data to it.
table | :: The table we want to setup. |
numOfRows | :: The number of rows in the workspace. |
numOfColumns | :: The number of columns in the workspace. |
Definition at line 224 of file CatalogSearch.cpp.
Referenced by clearSearch(), populateDataFileTable(), and populateResultTable().
|
privateslot |
When checked, show the Catalog search frame.
Shows/hides the "Catalog search" frame when search combo box is checked.
Definition at line 176 of file CatalogSearch.cpp.
References m_icatUiForm.
Referenced by initLayout().
|
privateslot |
When checked, show the data file info frame.
Hides "Search results" frame when a result is double clicked.
Definition at line 199 of file CatalogSearch.cpp.
References m_icatUiForm.
Referenced by initLayout().
|
privateslot |
Show the error message labels, including the error message on the tooltips.
errors | :: A map containing the error label names, and the related error message. |
Definition at line 645 of file CatalogSearch.cpp.
References correctedToolTip(), error, and m_icatUiForm.
Referenced by searchClicked().
|
privateslot |
Shows/Hides the "Search results" frame when search results combo box is checked.
Definition at line 188 of file CatalogSearch.cpp.
References m_icatUiForm.
Referenced by initLayout().
|
privateslot |
Sort table by file size when certain column is clicked (E.g.
When the user clicks "File size" column sort the table by "File size(bytes)".
"File size" row).
column | :: The column that was clicked by the user. |
Definition at line 1247 of file CatalogSearch.cpp.
References headerIndexByName(), and m_icatUiForm.
Referenced by populateDataFileTable().
|
private |
Updates the dataFile text boxes with relevant info about the selected dataFile.
Updates the dataFile text boxes with relevant info regarding the selected dataFile.
Definition at line 1003 of file CatalogSearch.cpp.
References headerIndexByName(), and m_icatUiForm.
Referenced by investigationSelected().
|
private |
Checks if start date is greater than end date.
Definition at line 506 of file CatalogSearch.cpp.
References correctedToolTip(), MantidQt::MantidWidgets::CatalogHelper::getTimevalue(), m_icatHelper, and m_icatUiForm.
Referenced by searchClicked().
|
private |
The calendar widget that will allow the user to select start and end date/times.
Definition at line 187 of file CatalogSearch.h.
Referenced by dateSelected(), initLayout(), and openCalendar().
|
private |
Access methods of catalog selector GUI, e.g. selected facilities.
Definition at line 191 of file CatalogSearch.h.
Referenced by openFacilitySelection(), populateInstrumentBox(), populateInvestigationTypeBox(), and searchClicked().
|
private |
The current page the user is on in the results window. Used for paging.
Definition at line 195 of file CatalogSearch.h.
Referenced by goToInputPage(), nextPageClicked(), prevPageClicked(), and searchClicked().
|
private |
The custom table header with checkbox functionality.
Definition at line 182 of file CatalogSearch.h.
Referenced by addCheckBoxColumn(), and populateDataFileTable().
|
private |
The name of the date button the user pressed to open the calendar.
Definition at line 180 of file CatalogSearch.h.
Referenced by dateSelected(), and openCalendar().
|
private |
The directory to save the downloaded dataFiles.
Definition at line 193 of file CatalogSearch.h.
Referenced by downloadDataFiles(), loadDataFiles(), loadSettings(), and saveSettings().
|
private |
The helper class that accesses ICAT algorithmic functionality.
Definition at line 189 of file CatalogSearch.h.
Referenced by downloadDataFiles(), investigationSelected(), loadDataFiles(), populateInstrumentBox(), populateInvestigationTypeBox(), searchClicked(), and validateDates().
|
private |
The form generated by QT Designer.
Definition at line 184 of file CatalogSearch.h.
Referenced by advancedSearchChecked(), clearDataFileFrame(), clearSearchFrame(), clearSearchResultFrame(), dataFileCheckboxSelected(), dataFileRowSelected(), dateSelected(), disableDatafileButtons(), disableDownloadButtonIfArchives(), doFilter(), getSearchFields(), goToInputPage(), hideErrorLabels(), initLayout(), investigationSelected(), nextPageClicked(), onReset(), populateDataFileTable(), populateDataFileType(), populateInstrumentBox(), populateInvestigationTypeBox(), populateResultTable(), searchClicked(), selectAllDataFiles(), selectedDataFileNames(), selectedInvestigationSession(), showCatalogSearch(), showDataFileInfo(), showErrorLabels(), showSearchResults(), sortByFileSize(), updateDataFileLabels(), and validateDates().