Mantid
Loading...
Searching...
No Matches
CatalogSearch.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2011 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9#include "DllOption.h"
14#include "ui_CatalogSearch.h"
15
16#include <QCalendarWidget>
17
18namespace MantidQt {
19namespace MantidWidgets {
29 Q_OBJECT
30
31public:
33 CatalogSearch(QWidget *parent = nullptr);
35 ~CatalogSearch() override;
36
37private:
39 virtual void initLayout();
41 void emboldenTableHeaders(QTableWidget *table);
43 void setupTable(QTableWidget *table, const size_t &numOfRows, const size_t &numOfColumns);
47 void clearSearch(QTableWidget *table, const std::string &workspace);
55 int headerIndexByName(QTableWidget *table, const std::string &searchFor);
60
62 // Methods for: "Catalog Search"
64
65 void dateSelected(const std::string &buttonName);
71 const std::map<std::string, std::string> getSearchFields();
74
76 // Methods for: "Search results"
78
80 void populateResultTable(int sort_section, Qt::SortOrder sort_order);
83
85 // Methods for: "Datafile information"
87
91 void addCheckBoxColumn(QTableWidget *table);
94 const std::vector<std::pair<int64_t, std::string>> selectedDataFileNames();
97 void updateDataFileLabels(QTableWidgetItem *item);
100 std::unordered_set<std::string> getDataFileExtensions(const Mantid::API::Column_sptr &column);
102 void populateDataFileType(const std::unordered_set<std::string> &extensions);
106
107private slots:
119
121 // SLOTS for: "Catalog Search"
123
127 void dateSelected(QDate date);
134 void showErrorLabels(std::map<std::string, std::string> &errors);
138 void onReset();
142
144 // SLOTS for: "Search results"
146
154 void investigationSelected(QTableWidgetItem *item);
155
157 // SLOTS for: "Datafile information"
159
163 void doFilter(const int &index);
169 void selectAllDataFiles(const bool &toggled);
171 void dataFileCheckboxSelected(QTableWidgetItem *item);
176 void sortByFileSize(int column);
177
178private:
184 Ui::CatalogSearch m_icatUiForm;
187 QCalendarWidget *m_calendar;
196 // Ensure tooltip uses visible color on current OS
197 void correctedToolTip(const std::string &toolTip, QLabel *label);
198};
199} // namespace MantidWidgets
200} // namespace MantidQt
#define EXPORT_OPT_MANTIDQT_COMMON
Definition DllOption.h:15
IPeaksWorkspace_sptr workspace
std::map< DeltaEMode::Type, std::string > index
This class defines the interface and functionality for the cataloging system within Mantid.
void showCatalogSearch()
When checked, show the Catalog search frame.
void showDataFileInfo()
When checked, show the data file info frame.
void correctedToolTip(const std::string &toolTip, QLabel *label)
void selectAllDataFiles(const bool &toggled)
Selects/deselects ALL rows in dataFile table.
CatalogSelector * m_catalogSelector
Access methods of catalog selector GUI, e.g. selected facilities.
void emboldenTableHeaders(QTableWidget *table)
Make the headers in the provided table bold.
void showSearchResults()
Shows/Hides the "Search results" frame when search results combo box is checked.
void updateDataFileLabels(QTableWidgetItem *item)
Updates the dataFile text boxes with relevant info about the selected dataFile.
void clearSearchFrame()
Clear the "search" frame when an investigation has been selected.
void disableDatafileButtons()
Disable load/download buttons if no datafile is selected.
void goToInputPage()
Populate's result table depending page number input by user.
CatalogHelper * m_icatHelper
The helper class that accesses ICAT algorithmic functionality.
void populateResultTable(int sort_section, Qt::SortOrder sort_order)
Outputs the results of the query into a table.
void populateInvestigationTypeBox()
Populate the investigation type list-box.
QString m_dateButtonName
The name of the date button the user pressed to open the calendar.
void setupTable(QTableWidget *table, const size_t &numOfRows, const size_t &numOfColumns)
Setup table prior to adding data to it, such hiding vertical header.
void investigationSelected(QTableWidgetItem *item)
Checks that the investigation is selected and performs investigationClicked.
std::string selectedInvestigationSession()
Obtain the sessionID for the selected investigation.
void loadDataFiles()
Loads the selected dataFiles into workspaces.
void sortByFileSize(int column)
Sort table by file size when certain column is clicked (E.g.
void onFacilityLogin()
When the facility login button is clicked.
QCalendarWidget * m_calendar
The calendar widget that will allow the user to select start and end date/times.
virtual void initLayout()
Initialise the layout.
void clearSearch(QTableWidget *table, const std::string &workspace)
Removes data associated with previous search.
void onReset()
Reset all fields when "Reset" is clicked.
void showErrorLabels(std::map< std::string, std::string > &errors)
Show the error message labels, including the error message on the tooltips.
void openCalendar()
Open the DateTime Calendar to select date.
CatalogSearch(QWidget *parent=nullptr)
Default constructor.
const std::vector< std::pair< int64_t, std::string > > selectedDataFileNames()
Obtain the file details (file ID and name) for the file to download.
const std::map< std::string, std::string > getSearchFields()
Obtain the users' text input for each search field.
QString m_downloadSaveDir
The directory to save the downloaded dataFiles.
void disableDownloadButtonIfArchives(int row)
Disable the download button if user can access the files locally from the archives.
void dataFileRowSelected()
Select/Deselect row & check-box when a row is selected.
void populateTable(QTableWidget *table, const Mantid::API::ITableWorkspace_sptr &workspace)
Populate the provided table with data from the provided workspace.
void doFilter(const int &index)
Performs filterDataFileType() for specified filer type.
void helpClicked()
When the help button is clicked.
bool validateDates()
Checks if start date is greater than end date.
std::unordered_set< std::string > getDataFileExtensions(const Mantid::API::Column_sptr &column)
Obtain all file extensions from the provided column (dataFileResults -> File name).
void clearDataFileFrame()
Clear "dataFileFrame" when the user tries to search again.
void loadSettings()
Read settings from store.
void populateDataFileType(const std::unordered_set< std::string > &extensions)
Add the list of file extensions to the "Filter type..." drop-down.
void clearSearchResultFrame()
Clear the "search results" frame if no results are returned from search.
void populateInstrumentBox()
Populate the instrument list-box.
void hideErrorLabels()
Hide the error message labels.
void dateSelected(QDate date)
Update text field when date is selected.
Ui::CatalogSearch m_icatUiForm
The form generated by QT Designer.
void populateDataFileTable()
Populates the table from the results of investigationSelected();.
~CatalogSearch() override
Destructor.
void nextPageClicked()
Populate the result table, and update the page number.
void addCheckBoxColumn(QTableWidget *table)
Add a row of checkboxes to the first column of a table.
void downloadDataFiles()
Downloads selected datFiles to a specified location.
void openFacilitySelection()
Enables user to select specific facilities that they want to search the catalogs of.
void dateSelected(const std::string &buttonName)
int m_currentPageNumber
The current page the user is on in the results window. Used for paging.
int headerIndexByName(QTableWidget *table, const std::string &searchFor)
Obtain the index of the column in a table that contains a specified name.
void searchClicked()
When the "Search" button is clicked, display "Search results" frame.
void saveSettings()
Save the current state of ICAT for next time.
void advancedSearchChecked()
Show the advanced field when checked.
CheckboxHeader * m_customHeader
The custom table header with checkbox functionality.
void dataFileCheckboxSelected(QTableWidgetItem *item)
Select/Deselect row when a checkbox is selected.
This class subclasses and overwrites QHeaderView methods to enable checkboxes to exist in the table h...
The AlgorithmProgressDialogPresenter keeps track of the running algorithms and displays a progress ba...
std::shared_ptr< Column > Column_sptr
Definition Column.h:232
std::shared_ptr< ITableWorkspace > ITableWorkspace_sptr
shared pointer to Mantid::API::ITableWorkspace