Mantid
|
This class defines a widget for file searching. More...
#include <FileFinderWidget.h>
Public Types | |
enum | { NO_ENTRY_NUM = -1 , ALL_ENTRIES = -2 } |
Flags for workspace entries. More... | |
enum | ButtonOpts { Text , Icon , None } |
options for bringing up the load file dialog More... | |
enum | LiveButtonOpts { Hide , Show } |
Options for the live button. More... | |
Public Slots | |
void | clear () |
Clear the search from the widget. More... | |
void | findFiles () |
Find the files if the text edit field is modified. More... | |
void | findFiles (bool isModified) |
Find the files within the text edit field and cache their full paths. More... | |
void | setFileTextWithoutSearch (const QString &text) |
Just update the file text, useful for syncing two boxes. More... | |
void | setFileTextWithSearch (const QString &text) |
Set the file text and try and find it. More... | |
std::shared_ptr< const Mantid::API::IAlgorithm > | stopLiveAlgorithm () |
Calls cancel on a running instance of MonitorLiveData. More... | |
Signals | |
void | fileEditingFinished () |
Emitted when the editing has finished. More... | |
void | fileFindingFinished () |
Emitted when file finding is finished (files may or may not have been found). More... | |
void | fileInspectionFinished () |
Emitted when inspection of any found files is completed. More... | |
void | filesFound () |
Emitted when files have been found. More... | |
void | filesFoundChanged () |
Emitted when files have been found that are different to what was found last time. More... | |
void | fileTextChanged (const QString &) |
Emitted when the file text changes. More... | |
void | findingFiles () |
Emitted when files finding starts. More... | |
void | liveButtonPressed (bool) |
Emitted when the live button is toggled. More... | |
Signals inherited from MantidQt::API::MantidWidget | |
void | runAsPythonScript (const QString &code, bool) |
Public Member Functions | |
bool | allowMultipleFiles () const |
Return whether this widget allows multiple files to be specified within the edit box. More... | |
void | allowMultipleFiles (bool) |
Set whether this widget allows multiple files to be specifed or not. More... | |
ButtonOpts | doButtonOpt () const |
Returns the preference for how the dialog control should be. More... | |
void | doButtonOpt (ButtonOpts buttonOpt) |
Set how the browse should appear. More... | |
bool | doMultiEntry () const |
Whether to find the number of entries in the file or assume (the normal situation) of one entry. More... | |
void | doMultiEntry (bool) |
Set to true to enable the period number box. More... | |
void | dragEnterEvent (QDragEnterEvent *) override |
Called when an item is dragged onto a control. More... | |
void | dropEvent (QDropEvent *) override |
Called when an item is dropped. More... | |
bool | extsAsSingleOption () const |
Returns whether the file dialog should display the exts as a single list or as multiple items. More... | |
void | extsAsSingleOption (bool value) |
Sets whether the file dialog should display the exts as a single list or as multiple items. More... | |
FileFinderWidget (QWidget *parent=nullptr) | |
Default constructor. More... | |
QString | getAlgorithmProperty () const |
Returns the algorithm name. More... | |
int | getEntryNum () const |
The number the user entered into the entryNum lineEdit or NO_ENTRY_NUM on error. More... | |
QStringList | getFileExtensions () const |
Returns the list of file extensions the widget will search for. More... | |
QStringList | getFilenames () const |
Returns the names of the files found. More... | |
QString | getFileProblem () |
Get file problem, empty string means no error. More... | |
QString | getFirstFilename () const |
Safer than using getRunFiles()[0] in the situation were there are no files. More... | |
QString | getInstrumentOverride () |
Gets the instrument currently fixed to. More... | |
QString | getLabelText () const |
Return the label text on the widget. More... | |
QString | getLastDirectory () |
Get the last directory. More... | |
std::vector< std::string > | getStringFileExtensions () const |
QString | getText () const |
The verbatum, unexpanded text, that was entered into the box. More... | |
QVariant | getUserInput () const override |
Overridden from base class to retrieve user input through a common interface. More... | |
bool | isEmpty () const |
Check if any text, valid or not, has been entered into the line edit. More... | |
bool | isForDirectory () const |
Returns if this widget is for selecting a directory or not. More... | |
void | isForDirectory (bool) |
Sets directory searching mode. More... | |
bool | isForRunFiles () const |
Returns if this widget is for run file searching or not. More... | |
void | isForRunFiles (bool) |
Sets whether this widget is for run file searching or not. More... | |
bool | isOptional () const |
Return whether empty input is allowed. More... | |
void | isOptional (bool) |
Sets if the text field is optional. More... | |
bool | isSearching () const |
Is the widget currently searching. More... | |
bool | isValid () const |
Is the input within the widget valid? More... | |
bool | liveButtonIsChecked () const |
void | liveButtonSetChecked (bool) |
LiveButtonOpts | liveButtonState () const |
Returns whether the live button is being shown;. More... | |
void | liveButtonState (LiveButtonOpts) |
void | readSettings (const QString &group) |
Read settings from the given group. More... | |
void | saveSettings (const QString &group) |
Save settings in the given group. More... | |
void | setAlgorithmProperty (const QString &name) |
Sets an algorithm name that can be tied to this widget. More... | |
void | setEntryNum (const int num) |
Set the entry displayed in the box to this value. More... | |
void | setFileExtensions (const QStringList &extensions) |
Sets the list of file extensions the dialog will search for. More... | |
void | setFileProblem (const QString &message) |
flag a problem with the file the user entered, an empty string means no error More... | |
void | setInstrumentOverride (const QString &instName) |
Overrides the value of default instrument. More... | |
void | setLabelMinWidth (int) |
Set the minimum width on the label widget. More... | |
void | setLabelText (const QString &text) |
Set the text on the label. More... | |
void | setLastDirectory (const QString &lastDir) |
Set the last directory. More... | |
void | setLiveAlgorithm (const std::shared_ptr< Mantid::API::IAlgorithm > &monitorLiveData) |
Inform the widget of a running instance of MonitorLiveData to be used in stopLiveListener() More... | |
void | setNumberOfEntries (int number) |
Alters the text label that contains the number of entries, normally run when the file is loaded. More... | |
void | setProxyModel (QAbstractProxyModel *proxyModel) |
void | setReadOnly (bool readOnly) |
Set the input read-only or not. More... | |
void | setText (const QString &value) |
Sets a value on the widget but doesn't emit a signal to say it has changed. More... | |
void | setTextValidator (const QValidator *validator) |
Set an arbitrary validator on the line edit. More... | |
void | setUseNativeWidget (bool) |
void | setUserInput (const QVariant &value) override |
Sets a value on the widget through a common interface. More... | |
virtual QVariant | getUserInput () const |
Returns a QVariant containing what the widget classes as user input so that input can be returned through a common interface. More... | |
virtual void | setUserInput (const QVariant &value) |
Sets a value on a mantid widget through a common interface. More... | |
Properties | |
QString | algorithmAndProperty |
ButtonOpts | buttonOpt |
bool | extsAsSingleOption |
QStringList | fileExtensions |
bool | findDirectory |
bool | findRunFiles |
QString | instrumentOverride |
QString | label |
LiveButtonOpts | liveButton |
bool | multiEntry |
bool | multipleFiles |
bool | optional |
Private Slots | |
void | browseClicked () |
Browse clicked slot. More... | |
void | checkEntry () |
currently checks only if the entry number is any integer > 0 More... | |
void | inspectThreadResult (const FindFilesSearchResults &results=FindFilesSearchResults()) |
Slot called when file finding thread has finished. More... | |
Private Member Functions | |
QString | createFileFilter () |
Create a file filter from a list of extensions. More... | |
FindFilesSearchParameters | createFindFilesSearchParameters (const std::string &text) const |
Helper method to create a FindFilesSearchParameters object. More... | |
const QString | findFilesGetSearchText (QString &searchText) |
gets text to use for find files search parameters More... | |
QStringList | getFileExtensionsFromAlgorithm (const QString &algName, const QString &propName) |
Create an extension list from the name algorithm and property. More... | |
QStringList | getFilesFromAlgorithm (const QString &algName, const QString &propName, const QString &filename) |
Create an extension list from the name algorithm and property. More... | |
QString | openFileDialog () |
Open a file dialog. More... | |
void | refreshValidator () |
displays the validator red star if either m_fileProblem or m_entryNumProblem are not empty More... | |
void | runFindFiles (const QString &searchText) |
handles findFiles background thread More... | |
void | setEntryNumProblem (const QString &message) |
flag a problem with the supplied entry number, an empty string means no error More... | |
void | setValidatorDisplay (bool display) |
Turn on/off display of validator red star (default is on) More... | |
Private Attributes | |
QString | m_algorithmProperty |
The algorithm name and property (can be empty) More... | |
bool | m_allowMultipleFiles |
Allow multiple files. More... | |
ButtonOpts | m_buttonOpt |
To use a browse button or icon or nothing at all. More... | |
FindFilesSearchResults | m_cachedResults |
Handle to any results found. More... | |
QString | m_defaultInstrumentName |
Cache the default instrument name. More... | |
QFileDialog | m_dialog |
non-native QFileDialog More... | |
QString | m_entryNumProblem |
If applicable holds any error with the user in entryNum, "" means no error. More... | |
bool | m_extsAsSingleOption |
If true the exts are displayed as one option in the dialog. More... | |
QStringList | m_fileExtensions |
The file extensions to look for. More... | |
QString | m_fileFilter |
A file filter for the file browser. More... | |
QString | m_fileProblem |
Holds any error with the user entry for the filename, "" means no error. More... | |
bool | m_findRunFiles |
Is the widget for run files or standard files. More... | |
QStringList | m_foundFiles |
An array of valid file names derived from the entries in the leNumber LineEdit. More... | |
bool | m_isForDirectory |
If the widget is for directories. More... | |
bool | m_isOptional |
Whether the widget can be empty. More... | |
QString | m_lastDir |
The last directory viewed by the browse dialog. More... | |
QStringList | m_lastFoundFiles |
An array of the last valid file names found. More... | |
LiveButtonOpts | m_liveButtonState |
If or when live button will be shown. More... | |
std::shared_ptr< Mantid::API::IAlgorithm > | m_monitorLiveData |
Handle on a running instance of MonitorLiveData. More... | |
bool | m_multiEntry |
Whether to allow the user to state an entry number. More... | |
FindFilesThreadPoolManager | m_pool |
Handle to a find files thread pool manager. More... | |
bool | m_showValidator |
Whether validation red star is being shown. More... | |
Ui::FileFinderWidget | m_uiForm |
The Ui form. More... | |
bool | m_useNativeDialog |
flag to control use of m_dialog More... | |
QString | m_valueForProperty |
Expanded user input. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from MantidQt::API::MantidWidget | |
MantidWidget (QWidget *parent=nullptr) | |
Default constructor. More... | |
QString | runPythonCode (const QString &code, bool no_output=false) |
Run python code that is passed to it and, optionally, return anything it wrote to standard output as a string. More... | |
This class defines a widget for file searching.
It allows either single or multiple files to be specified.
Definition at line 42 of file FileFinderWidget.h.
anonymous enum |
Flags for workspace entries.
Enumerator | |
---|---|
NO_ENTRY_NUM | error in the entry number setting |
ALL_ENTRIES | use all entries (i.e. entry number was left blank) |
Definition at line 68 of file FileFinderWidget.h.
options for bringing up the load file dialog
Enumerator | |
---|---|
Text | use a button (normally labelled "Browse") |
Icon | use an icon |
None | disable the load file dialog |
Definition at line 62 of file FileFinderWidget.h.
Options for the live button.
Enumerator | |
---|---|
Hide | Don't use the live button. |
Show | Display the live button. |
Definition at line 73 of file FileFinderWidget.h.
FileFinderWidget::FileFinderWidget | ( | QWidget * | parent = nullptr | ) |
Default constructor.
Definition at line 40 of file FileFinderWidget.cpp.
References browseClicked(), checkEntry(), doButtonOpt(), fileEditingFinished(), fileTextChanged(), findFiles(), Mantid::Kernel::SingletonHolder< T >::Instance(), liveButtonPressed(), liveButtonState(), m_buttonOpt, m_lastDir, m_liveButtonState, m_multiEntry, and m_uiForm.
bool FileFinderWidget::allowMultipleFiles | ( | ) | const |
Return whether this widget allows multiple files to be specified within the edit box.
Definition at line 148 of file FileFinderWidget.cpp.
References m_allowMultipleFiles.
void FileFinderWidget::allowMultipleFiles | ( | bool | allow | ) |
Set whether this widget allows multiple files to be specifed or not.
allow | :: If true then the widget will accept multiple files else only a single file may be specified |
Definition at line 155 of file FileFinderWidget.cpp.
References findFiles(), and m_allowMultipleFiles.
|
privateslot |
Browse clicked slot.
This slot opens a file browser.
Definition at line 871 of file FileFinderWidget.cpp.
References fileEditingFinished(), m_uiForm, and openFileDialog().
Referenced by FileFinderWidget().
|
privateslot |
currently checks only if the entry number is any integer > 0
Currently just checks that entryNum contains an int > 0 and hence might be a valid entry number.
Definition at line 885 of file FileFinderWidget.cpp.
References m_uiForm, and setEntryNumProblem().
Referenced by FileFinderWidget().
|
slot |
Clear the search from the widget.
Clears the search string and found files from the widget.
Definition at line 491 of file FileFinderWidget.cpp.
References m_foundFiles, and m_uiForm.
Referenced by isForDirectory().
|
private |
Create a file filter from a list of extensions.
Set a new file filter for the file dialog based on the given extensions.
Definition at line 652 of file FileFinderWidget.cpp.
References extsAsSingleOption, getFileExtensionsFromAlgorithm(), Mantid::Kernel::SingletonHolder< T >::Instance(), isForRunFiles(), m_algorithmProperty, and m_fileExtensions.
Referenced by openFileDialog().
|
private |
Helper method to create a FindFilesSearchParameters object.
Definition at line 965 of file FileFinderWidget.cpp.
References MantidQt::API::FindFilesSearchParameters::algorithmName, MantidQt::API::FindFilesSearchParameters::algorithmProperty, MantidQt::API::FindFilesSearchParameters::extensions, getStringFileExtensions(), isForRunFiles(), MantidQt::API::FindFilesSearchParameters::isForRunFiles, isOptional(), MantidQt::API::FindFilesSearchParameters::isOptional, m_algorithmProperty, and MantidQt::API::FindFilesSearchParameters::searchText.
Referenced by runFindFiles().
FileFinderWidget::ButtonOpts FileFinderWidget::doButtonOpt | ( | ) | const |
Returns the preference for how the dialog control should be.
Definition at line 178 of file FileFinderWidget.cpp.
References m_buttonOpt.
Referenced by FileFinderWidget().
void FileFinderWidget::doButtonOpt | ( | const FileFinderWidget::ButtonOpts | buttonOpt | ) |
Set how the browse should appear.
buttonOpt | the preference for the control, if there will be one, to activate the dialog box |
Definition at line 185 of file FileFinderWidget.cpp.
References buttonOpt, Icon, m_buttonOpt, m_uiForm, None, and Text.
bool FileFinderWidget::doMultiEntry | ( | ) | const |
Whether to find the number of entries in the file or assume (the normal situation) of one entry.
Definition at line 204 of file FileFinderWidget.cpp.
References m_multiEntry.
void FileFinderWidget::doMultiEntry | ( | bool | multiEntry | ) |
Set to true to enable the period number box.
multiEntry | whether to show the multiperiod box |
Definition at line 210 of file FileFinderWidget.cpp.
References m_multiEntry, m_uiForm, multiEntry, and refreshValidator().
|
override |
Called when an item is dragged onto a control.
de | :: the drag event data package |
Definition at line 926 of file FileFinderWidget.cpp.
|
override |
Called when an item is dropped.
de | :: the drop event data package |
Definition at line 909 of file FileFinderWidget.cpp.
References MantidQt::MantidWidgets::DropEventHelper::getFileNames(), and m_uiForm.
bool FileFinderWidget::extsAsSingleOption | ( | ) | const |
Returns whether the file dialog should display the exts as a single list or as multiple items.
Definition at line 263 of file FileFinderWidget.cpp.
References m_extsAsSingleOption.
void FileFinderWidget::extsAsSingleOption | ( | bool | value | ) |
Sets whether the file dialog should display the exts as a single list or as multiple items.
value | :: If true the file dialog wil contain a single entry will all filters |
Definition at line 271 of file FileFinderWidget.cpp.
References m_extsAsSingleOption, and value.
|
signal |
Emitted when the editing has finished.
Referenced by browseClicked(), FileFinderWidget(), and setUserInput().
|
signal |
Emitted when file finding is finished (files may or may not have been found).
|
signal |
Emitted when inspection of any found files is completed.
Referenced by inspectThreadResult().
|
signal |
Emitted when files have been found.
Referenced by inspectThreadResult().
|
signal |
Emitted when files have been found that are different to what was found last time.
Referenced by inspectThreadResult().
|
signal |
Emitted when the file text changes.
Referenced by FileFinderWidget().
|
slot |
Find the files if the text edit field is modified.
Finds the files if the user has changed the parameter text.
Definition at line 499 of file FileFinderWidget.cpp.
References findFiles(), and m_uiForm.
Referenced by allowMultipleFiles(), FileFinderWidget(), findFiles(), isOptional(), setFileTextWithSearch(), and setInstrumentOverride().
|
slot |
Find the files within the text edit field and cache their full paths.
Finds the files specified by the user in a background thread.
Definition at line 504 of file FileFinderWidget.cpp.
References findFilesGetSearchText(), inspectThreadResult(), m_cachedResults, m_foundFiles, m_isForDirectory, m_uiForm, runFindFiles(), and setFileProblem().
|
private |
gets text to use for find files search parameters
Gets the search text to find files with.
searchText | :: text entered by user |
Definition at line 533 of file FileFinderWidget.cpp.
References m_defaultInstrumentName.
Referenced by findFiles().
|
signal |
Emitted when files finding starts.
Referenced by runFindFiles().
QString FileFinderWidget::getAlgorithmProperty | ( | ) | const |
Returns the algorithm name.
Definition at line 226 of file FileFinderWidget.cpp.
References m_algorithmProperty.
int FileFinderWidget::getEntryNum | ( | ) | const |
The number the user entered into the entryNum lineEdit or NO_ENTRY_NUM on error.
Checking if isValid is true should eliminate the possiblity of getting NO_ENTRY_NUM
Definition at line 335 of file FileFinderWidget.cpp.
References ALL_ENTRIES, isValid(), m_multiEntry, m_uiForm, and NO_ENTRY_NUM.
QStringList FileFinderWidget::getFileExtensions | ( | ) | const |
Returns the list of file extensions the widget will search for.
Definition at line 238 of file FileFinderWidget.cpp.
References m_fileExtensions.
|
private |
Create an extension list from the name algorithm and property.
Create a list of file extensions from the given algorithm.
algName | :: The name of the algorithm |
propName | :: The name of the property |
Definition at line 735 of file FileFinderWidget.cpp.
References Mantid::Kernel::PropertyWithValue< TYPE >::allowedValues(), Mantid::API::FileProperty::getDefaultExt(), index, and Mantid::Kernel::SingletonHolder< T >::Instance().
Referenced by createFileFilter().
QStringList FileFinderWidget::getFilenames | ( | ) | const |
Returns the names of the files found.
Definition at line 305 of file FileFinderWidget.cpp.
References m_foundFiles.
QString FileFinderWidget::getFileProblem | ( | ) |
Get file problem, empty string means no error.
Return the error.
Definition at line 405 of file FileFinderWidget.cpp.
References m_fileProblem.
Referenced by MantidQt::CustomInterfaces::UserInputValidator::checkFileFinderWidgetIsValid().
|
private |
Create an extension list from the name algorithm and property.
QString FileFinderWidget::getFirstFilename | ( | ) | const |
Safer than using getRunFiles()[0] in the situation were there are no files.
invalid_argument | if one of the files couldn't be found it then no filenames are returned |
Definition at line 314 of file FileFinderWidget.cpp.
References m_foundFiles.
QString FileFinderWidget::getInstrumentOverride | ( | ) |
Gets the instrument currently fixed to.
Gets the instrument currently set by the override property.
If no override is set then the instrument set by default instrument configurtion option will be used and this function returns an empty string.
Definition at line 448 of file FileFinderWidget.cpp.
References m_defaultInstrumentName.
QString FileFinderWidget::getLabelText | ( | ) | const |
Return the label text on the widget.
Definition at line 127 of file FileFinderWidget.cpp.
References m_uiForm.
|
inline |
Get the last directory.
Definition at line 148 of file FileFinderWidget.h.
std::vector< std::string > FileFinderWidget::getStringFileExtensions | ( | ) | const |
Definition at line 240 of file FileFinderWidget.cpp.
References m_fileExtensions.
Referenced by createFindFilesSearchParameters().
QString FileFinderWidget::getText | ( | ) | const |
The verbatum, unexpanded text, that was entered into the box.
Definition at line 329 of file FileFinderWidget.cpp.
References m_uiForm.
Referenced by openFileDialog().
|
overridevirtual |
Overridden from base class to retrieve user input through a common interface.
Retrieve user input from this widget.
This expands the current file text to include the found absolute paths so that no more searching is required NOTE: This knows nothing of periods yet
Reimplemented from MantidQt::API::MantidWidget.
Definition at line 361 of file FileFinderWidget.cpp.
References m_valueForProperty.
|
privateslot |
Slot called when file finding thread has finished.
Called when the file finding thread finishes.
Inspects the result of the thread, and emits fileFound() if it has been successful.
Definition at line 594 of file FileFinderWidget.cpp.
References MantidQt::API::FindFilesSearchResults::error, fileInspectionFinished(), MantidQt::API::FindFilesSearchResults::filenames, filesFound(), filesFoundChanged(), isOptional(), m_cachedResults, m_foundFiles, m_lastFoundFiles, m_valueForProperty, setFileProblem(), and MantidQt::API::FindFilesSearchResults::valueForProperty.
Referenced by findFiles().
bool FileFinderWidget::isEmpty | ( | ) | const |
Check if any text, valid or not, has been entered into the line edit.
Definition at line 324 of file FileFinderWidget.cpp.
References m_uiForm.
bool FileFinderWidget::isForDirectory | ( | ) | const |
Returns if this widget is for selecting a directory or not.
Definition at line 112 of file FileFinderWidget.cpp.
References m_isForDirectory.
void FileFinderWidget::isForDirectory | ( | bool | mode | ) |
Sets directory searching mode.
mode | True to search for directories only |
Definition at line 118 of file FileFinderWidget.cpp.
References clear(), and m_isForDirectory.
bool FileFinderWidget::isForRunFiles | ( | ) | const |
Returns if this widget is for run file searching or not.
Definition at line 100 of file FileFinderWidget.cpp.
References m_findRunFiles.
Referenced by createFileFilter(), and createFindFilesSearchParameters().
void FileFinderWidget::isForRunFiles | ( | bool | mode | ) |
Sets whether this widget is for run file searching or not.
mode | :: True if this widget searches for run files, false otherwise |
Definition at line 106 of file FileFinderWidget.cpp.
References m_findRunFiles.
bool FileFinderWidget::isOptional | ( | ) | const |
Return whether empty input is allowed.
Definition at line 163 of file FileFinderWidget.cpp.
References m_isOptional.
Referenced by createFindFilesSearchParameters(), and inspectThreadResult().
void FileFinderWidget::isOptional | ( | bool | optional | ) |
Sets if the text field is optional.
optional | :: Set the optional status of the text field |
Definition at line 169 of file FileFinderWidget.cpp.
References findFiles(), m_isOptional, and optional.
bool FileFinderWidget::isSearching | ( | ) | const |
Is the widget currently searching.
Definition at line 299 of file FileFinderWidget.cpp.
References MantidQt::API::FindFilesThreadPoolManager::isSearchRunning(), and m_pool.
bool FileFinderWidget::isValid | ( | ) | const |
Is the input within the widget valid?
Definition at line 293 of file FileFinderWidget.cpp.
References m_uiForm.
Referenced by MantidQt::CustomInterfaces::UserInputValidator::checkFileFinderWidgetIsValid(), and getEntryNum().
bool FileFinderWidget::liveButtonIsChecked | ( | ) | const |
Definition at line 287 of file FileFinderWidget.cpp.
References m_uiForm.
|
signal |
Emitted when the live button is toggled.
Referenced by FileFinderWidget().
void FileFinderWidget::liveButtonSetChecked | ( | bool | checked | ) |
Definition at line 285 of file FileFinderWidget.cpp.
References m_uiForm.
FileFinderWidget::LiveButtonOpts FileFinderWidget::liveButtonState | ( | ) | const |
Returns whether the live button is being shown;.
Definition at line 274 of file FileFinderWidget.cpp.
References m_liveButtonState.
Referenced by FileFinderWidget().
void FileFinderWidget::liveButtonState | ( | LiveButtonOpts | option | ) |
Definition at line 276 of file FileFinderWidget.cpp.
References Hide, m_liveButtonState, m_uiForm, and Show.
|
private |
Open a file dialog.
Lauches a load file browser allowing a user to select multiple files.
Definition at line 779 of file FileFinderWidget.cpp.
References createFileFilter(), getText(), m_allowMultipleFiles, m_dialog, m_fileFilter, m_isForDirectory, m_lastDir, and m_useNativeDialog.
Referenced by browseClicked().
void FileFinderWidget::readSettings | ( | const QString & | group | ) |
Read settings from the given group.
group | :: The name of the group key to retrieve data from |
Definition at line 632 of file FileFinderWidget.cpp.
References Mantid::Kernel::SingletonHolder< T >::Instance(), and m_lastDir.
|
private |
displays the validator red star if either m_fileProblem or m_entryNumProblem are not empty
Checks the data m_fileProblem and m_entryNumProblem to see if the validator label needs to be displayed.
Validator always hidden if m_showValidator set false.
Definition at line 853 of file FileFinderWidget.cpp.
References m_entryNumProblem, m_fileProblem, m_multiEntry, m_showValidator, and m_uiForm.
Referenced by doMultiEntry(), setEntryNumProblem(), setFileProblem(), and setReadOnly().
|
private |
handles findFiles background thread
creates background thread for find files
searchText | :: text to create search parameters from |
Definition at line 568 of file FileFinderWidget.cpp.
References createFindFilesSearchParameters(), MantidQt::API::FindFilesThreadPoolManager::createWorker(), findingFiles(), and m_pool.
Referenced by findFiles().
void FileFinderWidget::saveSettings | ( | const QString & | group | ) |
Save settings in the given group.
Save settings to the given group.
group | :: The name of the group key to save to |
Definition at line 411 of file FileFinderWidget.cpp.
References m_lastDir.
void FileFinderWidget::setAlgorithmProperty | ( | const QString & | text | ) |
Sets an algorithm name that can be tied to this widget.
text | :: The name of the algorithm and property in the form [AlgorithmName|PropertyName] |
Definition at line 233 of file FileFinderWidget.cpp.
References m_algorithmProperty.
void FileFinderWidget::setEntryNum | ( | const int | num | ) |
Set the entry displayed in the box to this value.
num | the period number to use |
Definition at line 352 of file FileFinderWidget.cpp.
References m_uiForm.
|
private |
flag a problem with the supplied entry number, an empty string means no error
flag a problem with the supplied entry number, an empty string means no error.
file errors take precedence of these errors
message | the message to display |
Definition at line 844 of file FileFinderWidget.cpp.
References m_entryNumProblem, and refreshValidator().
Referenced by checkEntry().
void FileFinderWidget::setFileExtensions | ( | const QStringList & | extensions | ) |
Sets the list of file extensions the dialog will search for.
Only taken notice of if AlgorithmProperty not set.
extensions | :: list of file extensions |
Definition at line 253 of file FileFinderWidget.cpp.
References m_fileExtensions, and m_fileFilter.
void FileFinderWidget::setFileProblem | ( | const QString & | message | ) |
flag a problem with the file the user entered, an empty string means no error
Flag a problem with the file the user entered, an empty string means no error but there may be an error with the entry box if enabled.
Errors passed here are shown first
message | :: A message to include or "" for no error |
Definition at line 396 of file FileFinderWidget.cpp.
References m_fileProblem, and refreshValidator().
Referenced by findFiles(), and inspectThreadResult().
|
slot |
Just update the file text, useful for syncing two boxes.
Set the file text but do not search.
text | :: The text string to set |
Definition at line 483 of file FileFinderWidget.cpp.
References m_uiForm.
Referenced by setFileTextWithSearch().
|
slot |
Set the file text and try and find it.
Set the file text.
This is different to setText in that it emits findFiles, as well changing the state of the text box widget to "modified = true" which is a prerequisite of findFiles.
text | :: The text string to set |
Definition at line 475 of file FileFinderWidget.cpp.
References findFiles(), and setFileTextWithoutSearch().
void FileFinderWidget::setInstrumentOverride | ( | const QString & | instName | ) |
Overrides the value of default instrument.
Sets an instrument to fix the widget to.
If an instrument name is geven then the widget will only look for files for that instrument, providing na empty string will remove this restriction and will search using the default instrument.
instName | Name of instrument, empty to disable override |
Definition at line 461 of file FileFinderWidget.cpp.
References findFiles(), and m_defaultInstrumentName.
void FileFinderWidget::setLabelMinWidth | ( | int | width | ) |
Set the minimum width on the label widget.
width | The new minimum width of the widget |
Definition at line 141 of file FileFinderWidget.cpp.
References m_uiForm.
void FileFinderWidget::setLabelText | ( | const QString & | text | ) |
Set the text on the label.
text | :: A string giving the label to use for the text |
Definition at line 133 of file FileFinderWidget.cpp.
References m_uiForm.
|
inline |
Set the last directory.
Definition at line 150 of file FileFinderWidget.h.
void FileFinderWidget::setLiveAlgorithm | ( | const std::shared_ptr< Mantid::API::IAlgorithm > & | monitorLiveData | ) |
Inform the widget of a running instance of MonitorLiveData to be used in stopLiveListener()
Inform the widget of a running instance of MonitorLiveData to be used in stopLiveListener().
Note that the type passed in is IAlgorithm and that no check is made that it actually refers to an instance of MonitorLiveData.
monitorLiveData | The running algorithm |
Definition at line 437 of file FileFinderWidget.cpp.
References m_monitorLiveData.
void FileFinderWidget::setNumberOfEntries | ( | int | number | ) |
Alters the text label that contains the number of entries, normally run when the file is loaded.
Writes the total number of periods in a file to the NumEntries Qlabel.
number | the number to write, if this is < 1 a ? will be displayed in it's place |
Definition at line 425 of file FileFinderWidget.cpp.
References m_uiForm.
void FileFinderWidget::setProxyModel | ( | QAbstractProxyModel * | proxyModel | ) |
Definition at line 990 of file FileFinderWidget.cpp.
References m_dialog.
void FileFinderWidget::setReadOnly | ( | bool | readOnly | ) |
Set the input read-only or not.
Sets the text read-only or editable and the Browse button disabled or enabled.
If read-only, disable the red asterisk validator.
readOnly | :: [input] whether read-only or editable |
Definition at line 950 of file FileFinderWidget.cpp.
References m_uiForm, refreshValidator(), and setValidatorDisplay().
void FileFinderWidget::setText | ( | const QString & | value | ) |
Sets a value on the widget but doesn't emit a signal to say it has changed.
"Silently" sets the value of the widget.
It does NOT emit a signal to say it has changed, and as far as the file finding routine is concerned it has not been modified and so it will NOT go searching for files.
value | A QString containing text to be entered into the widget |
Definition at line 371 of file FileFinderWidget.cpp.
void FileFinderWidget::setTextValidator | ( | const QValidator * | validator | ) |
Set an arbitrary validator on the line edit.
Definition at line 982 of file FileFinderWidget.cpp.
References m_uiForm.
void FileFinderWidget::setUseNativeWidget | ( | bool | native | ) |
Definition at line 984 of file FileFinderWidget.cpp.
References m_dialog, and m_useNativeDialog.
|
overridevirtual |
Sets a value on the widget through a common interface.
The QVariant is assumed to be text and to contain a file string. Note that this is primarily here for use within the AlgorithmDialog.
Emits fileEditingFinished(), and changes to state of the text box widget to be "modified", so that the file finder will try and find the file(s).
value | A QVariant containing user text |
Reimplemented from MantidQt::API::MantidWidget.
Definition at line 383 of file FileFinderWidget.cpp.
References fileEditingFinished(), m_uiForm, and value.
|
private |
Turn on/off display of validator red star (default is on)
Turn on/off the display of the red validator star.
Validation is still performed, this just controls the display of the result.
display | :: [input] whether to show validator result or not |
Definition at line 963 of file FileFinderWidget.cpp.
References m_showValidator.
Referenced by setReadOnly().
|
slot |
Calls cancel on a running instance of MonitorLiveData.
Requires that a handle to the MonitorLiveData instance has been set via setLiveListener()
Definition at line 581 of file FileFinderWidget.cpp.
References m_monitorLiveData.
|
private |
The algorithm name and property (can be empty)
Definition at line 245 of file FileFinderWidget.h.
Referenced by createFileFilter(), createFindFilesSearchParameters(), getAlgorithmProperty(), and setAlgorithmProperty().
|
private |
Allow multiple files.
Definition at line 233 of file FileFinderWidget.h.
Referenced by allowMultipleFiles(), and openFileDialog().
|
private |
To use a browse button or icon or nothing at all.
Definition at line 239 of file FileFinderWidget.h.
Referenced by doButtonOpt(), and FileFinderWidget().
|
private |
Handle to any results found.
Definition at line 274 of file FileFinderWidget.h.
Referenced by findFiles(), and inspectThreadResult().
|
private |
Cache the default instrument name.
Definition at line 268 of file FileFinderWidget.h.
Referenced by findFilesGetSearchText(), getInstrumentOverride(), and setInstrumentOverride().
|
private |
non-native QFileDialog
Definition at line 276 of file FileFinderWidget.h.
Referenced by openFileDialog(), setProxyModel(), and setUseNativeWidget().
|
private |
If applicable holds any error with the user in entryNum, "" means no error.
Definition at line 243 of file FileFinderWidget.h.
Referenced by refreshValidator(), and setEntryNumProblem().
|
private |
If true the exts are displayed as one option in the dialog.
Definition at line 249 of file FileFinderWidget.h.
Referenced by extsAsSingleOption().
|
private |
The file extensions to look for.
Definition at line 247 of file FileFinderWidget.h.
Referenced by createFileFilter(), getFileExtensions(), getStringFileExtensions(), and setFileExtensions().
|
private |
A file filter for the file browser.
Definition at line 266 of file FileFinderWidget.h.
Referenced by openFileDialog(), and setFileExtensions().
|
private |
Holds any error with the user entry for the filename, "" means no error.
Definition at line 241 of file FileFinderWidget.h.
Referenced by getFileProblem(), refreshValidator(), and setFileProblem().
|
private |
Is the widget for run files or standard files.
Definition at line 229 of file FileFinderWidget.h.
Referenced by isForRunFiles().
|
private |
An array of valid file names derived from the entries in the leNumber LineEdit.
Definition at line 260 of file FileFinderWidget.h.
Referenced by clear(), findFiles(), getFilenames(), getFirstFilename(), and inspectThreadResult().
|
private |
If the widget is for directories.
Definition at line 231 of file FileFinderWidget.h.
Referenced by findFiles(), isForDirectory(), and openFileDialog().
|
private |
Whether the widget can be empty.
Definition at line 235 of file FileFinderWidget.h.
Referenced by isOptional().
|
private |
The last directory viewed by the browse dialog.
Definition at line 264 of file FileFinderWidget.h.
Referenced by FileFinderWidget(), openFileDialog(), readSettings(), and saveSettings().
|
private |
An array of the last valid file names found.
Definition at line 262 of file FileFinderWidget.h.
Referenced by inspectThreadResult().
|
private |
If or when live button will be shown.
Definition at line 251 of file FileFinderWidget.h.
Referenced by FileFinderWidget(), and liveButtonState().
|
private |
Handle on a running instance of MonitorLiveData.
Definition at line 253 of file FileFinderWidget.h.
Referenced by setLiveAlgorithm(), and stopLiveAlgorithm().
|
private |
Whether to allow the user to state an entry number.
Definition at line 237 of file FileFinderWidget.h.
Referenced by doMultiEntry(), FileFinderWidget(), getEntryNum(), and refreshValidator().
|
private |
Handle to a find files thread pool manager.
Definition at line 272 of file FileFinderWidget.h.
Referenced by isSearching(), and runFindFiles().
|
private |
Whether validation red star is being shown.
Definition at line 255 of file FileFinderWidget.h.
Referenced by refreshValidator(), and setValidatorDisplay().
|
private |
The Ui form.
Definition at line 257 of file FileFinderWidget.h.
Referenced by browseClicked(), checkEntry(), clear(), doButtonOpt(), doMultiEntry(), dropEvent(), FileFinderWidget(), findFiles(), getEntryNum(), getLabelText(), getText(), isEmpty(), isValid(), liveButtonIsChecked(), liveButtonSetChecked(), liveButtonState(), refreshValidator(), setEntryNum(), setFileTextWithoutSearch(), setLabelMinWidth(), setLabelText(), setNumberOfEntries(), setReadOnly(), setText(), setTextValidator(), and setUserInput().
|
private |
flag to control use of m_dialog
Definition at line 278 of file FileFinderWidget.h.
Referenced by openFileDialog(), and setUseNativeWidget().
|
private |
Expanded user input.
Definition at line 270 of file FileFinderWidget.h.
Referenced by getUserInput(), and inspectThreadResult().
|
readwrite |
Definition at line 42 of file FileFinderWidget.h.
|
readwrite |
Definition at line 42 of file FileFinderWidget.h.
Referenced by doButtonOpt().
|
readwrite |
Definition at line 42 of file FileFinderWidget.h.
Referenced by createFileFilter().
|
readwrite |
Definition at line 42 of file FileFinderWidget.h.
|
readwrite |
Definition at line 42 of file FileFinderWidget.h.
|
readwrite |
Definition at line 42 of file FileFinderWidget.h.
|
readwrite |
Definition at line 42 of file FileFinderWidget.h.
|
readwrite |
Definition at line 42 of file FileFinderWidget.h.
|
readwrite |
Definition at line 42 of file FileFinderWidget.h.
|
readwrite |
Definition at line 42 of file FileFinderWidget.h.
Referenced by doMultiEntry().
|
readwrite |
Definition at line 42 of file FileFinderWidget.h.
|
readwrite |
Definition at line 42 of file FileFinderWidget.h.
Referenced by isOptional().