|
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. | |
| void | findFiles () |
| Find the files if the text edit field is modified. | |
| void | findFiles (bool isModified) |
| Find the files within the text edit field and cache their full paths. | |
| void | setFileTextWithoutSearch (const QString &text) |
| Just update the file text, useful for syncing two boxes. | |
| void | setFileTextWithSearch (const QString &text) |
| Set the file text and try and find it. | |
| std::shared_ptr< const Mantid::API::IAlgorithm > | stopLiveAlgorithm () |
| Calls cancel on a running instance of MonitorLiveData. | |
Signals | |
| void | fileEditingFinished () |
| Emitted when the editing has finished. | |
| void | fileFindingFinished () |
| Emitted when file finding is finished (files may or may not have been found). | |
| void | fileInspectionFinished () |
| Emitted when inspection of any found files is completed. | |
| void | filesFound () |
| Emitted when files have been found. | |
| void | filesFoundChanged () |
| Emitted when files have been found that are different to what was found last time. | |
| void | fileTextChanged (const QString &) |
| Emitted when the file text changes. | |
| void | findingFiles () |
| Emitted when files finding starts. | |
| void | liveButtonPressed (bool) |
| Emitted when the live button is toggled. | |
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. | |
| void | allowMultipleFiles (bool) |
| Set whether this widget allows multiple files to be specifed or not. | |
| FileFinderSettings | captureSettings () const |
| Capture the current state of this widget without persistent I/O. | |
| ButtonOpts | doButtonOpt () const |
| Returns the preference for how the dialog control should be. | |
| void | doButtonOpt (ButtonOpts buttonOpt) |
| Set how the browse should appear. | |
| bool | doMultiEntry () const |
| Whether to find the number of entries in the file or assume (the normal situation) of one entry. | |
| void | doMultiEntry (bool) |
| Set to true to enable the period number box. | |
| void | dragEnterEvent (QDragEnterEvent *) override |
| Called when an item is dragged onto a control. | |
| void | dropEvent (QDropEvent *) override |
| Called when an item is dropped. | |
| bool | extsAsSingleOption () const |
| Returns whether the file dialog should display the exts as a single list or as multiple items. | |
| void | extsAsSingleOption (bool value) |
| Sets whether the file dialog should display the exts as a single list or as multiple items. | |
| FileFinderWidget (QWidget *parent=nullptr) | |
| Default constructor. | |
| const QString & | getAlgorithmProperty () const |
| Returns the algorithm name. | |
| int | getEntryNum () const |
| The number the user entered into the entryNum lineEdit or NO_ENTRY_NUM on error. | |
| const QStringList & | getFileExtensions () const |
| Returns the list of file extensions the widget will search for. | |
| const QStringList & | getFilenames () const |
| Returns the names of the files found. | |
| const QString & | getFileProblem () const |
| Get file problem, empty string means no error. | |
| QString | getFirstFilename () const |
| Safer than using getRunFiles()[0] in the situation were there are no files. | |
| const QString & | getInstrumentOverride () const |
| Gets the instrument currently fixed to. | |
| QString | getLabelText () const |
| Return the label text on the widget. | |
| const QString & | getLastDirectory () const |
| Get the last directory. | |
| std::vector< std::string > | getStringFileExtensions () const |
| QString | getText () const |
| The verbatum, unexpanded text, that was entered into the box. | |
| QVariant | getUserInput () const override |
| Overridden from base class to retrieve user input through a common interface. | |
| bool | isEmpty () const |
| Check if any text, valid or not, has been entered into the line edit. | |
| bool | isForDirectory () const |
| Returns if this widget is for selecting a directory or not. | |
| void | isForDirectory (bool) |
| Sets directory searching mode. | |
| bool | isForRunFiles () const |
| Returns if this widget is for run file searching or not. | |
| void | isForRunFiles (bool) |
| Sets whether this widget is for run file searching or not. | |
| bool | isOptional () const |
| Return whether empty input is allowed. | |
| void | isOptional (bool) |
| Sets if the text field is optional. | |
| bool | isSearching () const |
| Is the widget currently searching. | |
| bool | isValid () const |
| Is the input within the widget valid? | |
| bool | liveButtonIsChecked () const |
| void | liveButtonSetChecked (bool) |
| LiveButtonOpts | liveButtonState () const |
| Returns whether the live button is being shown;. | |
| void | liveButtonState (LiveButtonOpts) |
| void | restoreSettings (const FileFinderSettings &settings) |
| Restore this widget from an in-memory snapshot without persistent I/O. | |
| void | saveSettings (QSettings &settings, const FileFinderSettings &values) const |
| Persist the supplied snapshot to mutable storage positioned at the target group. | |
| void | setAlgorithmProperty (const QString &name) |
| Sets an algorithm name that can be tied to this widget. | |
| void | setEntryNum (const int num) |
| Set the entry displayed in the box to this value. | |
| void | setFileExtensions (const QStringList &extensions) |
| Sets the list of file extensions the dialog will search for. | |
| void | setFileProblem (const QString &message) |
| flag a problem with the file the user entered, an empty string means no error | |
| void | setInstrumentOverride (const QString &instName) |
| Overrides the value of default instrument. | |
| void | setLabelMinWidth (int) |
| Set the minimum width on the label widget. | |
| void | setLabelText (const QString &text) |
| Set the text on the label. | |
| void | setLastDirectory (const QString &lastDir) |
| Set the last directory. | |
| void | setLiveAlgorithm (const std::shared_ptr< Mantid::API::IAlgorithm > &monitorLiveData) |
| Inform the widget of a running instance of MonitorLiveData to be used in stopLiveListener() | |
| void | setNumberOfEntries (int number) |
| Alters the text label that contains the number of entries, normally run when the file is loaded. | |
| void | setProxyModel (QAbstractProxyModel *proxyModel) |
| void | setReadOnly (bool readOnly) |
| Set the input read-only or not. | |
| void | setText (const QString &value) |
| Sets a value on the widget but doesn't emit a signal to say it has changed. | |
| void | setTextValidator (const QValidator *validator) |
| Set an arbitrary validator on the line edit. | |
| void | setUseNativeWidget (bool) |
| void | setUserInput (const QVariant &value) override |
| Sets a value on the widget through a common interface. | |
Static Public Member Functions | |
| static FileFinderSettings | readSettings (const QSettings &settings) |
Query last_directory from const storage without changing this widget or writing settings. | |
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. | |
| void | checkEntry () |
| currently checks only if the entry number is any integer > 0 | |
| void | inspectThreadResult (const FindFilesSearchResults &results=FindFilesSearchResults()) |
| Slot called when file finding thread has finished. | |
Private Member Functions | |
| QString | createFileFilter () |
| Create a file filter from a list of extensions. | |
| FindFilesSearchParameters | createFindFilesSearchParameters (const std::string &text) const |
| Helper method to create a FindFilesSearchParameters object. | |
| const QString | findFilesGetSearchText (QString &searchText) |
| gets text to use for find files search parameters | |
| QStringList | getFileExtensionsFromAlgorithm (const QString &algName, const QString &propName) |
| Create an extension list from the name algorithm and property. | |
| QStringList | getFilesFromAlgorithm (const QString &algName, const QString &propName, const QString &filename) |
| Create an extension list from the name algorithm and property. | |
| QString | openFileDialog () |
| Open a file dialog. | |
| void | refreshValidator () |
| displays the validator red star if either m_fileProblem or m_entryNumProblem are not empty | |
| void | runFindFiles (const QString &searchText) |
| handles findFiles background thread | |
| void | setEntryNumProblem (const QString &message) |
| flag a problem with the supplied entry number, an empty string means no error | |
| void | setValidatorDisplay (bool display) |
| Turn on/off display of validator red star (default is on) | |
Private Attributes | |
| QString | m_algorithmProperty |
| The algorithm name and property (can be empty) | |
| bool | m_allowMultipleFiles |
| Allow multiple files. | |
| ButtonOpts | m_buttonOpt |
| To use a browse button or icon or nothing at all. | |
| FindFilesSearchResults | m_cachedResults |
| Handle to any results found. | |
| QString | m_defaultInstrumentName |
| Cache the default instrument name. | |
| QFileDialog | m_dialog |
| non-native QFileDialog | |
| QString | m_entryNumProblem |
| If applicable holds any error with the user in entryNum, "" means no error. | |
| bool | m_extsAsSingleOption |
| If true the exts are displayed as one option in the dialog. | |
| QStringList | m_fileExtensions |
| The file extensions to look for. | |
| QString | m_fileFilter |
| A file filter for the file browser. | |
| QString | m_fileProblem |
| Holds any error with the user entry for the filename, "" means no error. | |
| bool | m_findRunFiles |
| Is the widget for run files or standard files. | |
| QStringList | m_foundFiles |
| An array of valid file names derived from the entries in the leNumber LineEdit. | |
| bool | m_isForDirectory |
| If the widget is for directories. | |
| bool | m_isOptional |
| Whether the widget can be empty. | |
| QString | m_lastDir |
| The last directory viewed by the browse dialog. | |
| QStringList | m_lastFoundFiles |
| An array of the last valid file names found. | |
| LiveButtonOpts | m_liveButtonState |
| If or when live button will be shown. | |
| std::shared_ptr< Mantid::API::IAlgorithm > | m_monitorLiveData |
| Handle on a running instance of MonitorLiveData. | |
| bool | m_multiEntry |
| Whether to allow the user to state an entry number. | |
| FindFilesThreadPoolManager | m_pool |
| Handle to a find files thread pool manager. | |
| bool | m_showValidator |
| Whether validation red star is being shown. | |
| Ui::FileFinderWidget | m_uiForm |
| The Ui form. | |
| bool | m_useNativeDialog |
| flag to control use of m_dialog | |
| QString | m_valueForProperty |
| Expanded user input. | |
Additional Inherited Members | |
Protected Member Functions inherited from MantidQt::API::MantidWidget | |
| MantidWidget (QWidget *parent=nullptr) | |
| Default constructor. | |
| 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. | |
This class defines a widget for file searching.
It allows either single or multiple files to be specified.
Definition at line 53 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 79 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 73 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 84 of file FileFinderWidget.h.
| FileFinderWidget::FileFinderWidget | ( | QWidget * | parent = nullptr | ) |
Default constructor.
Definition at line 41 of file FileFinderWidget.cpp.
References browseClicked(), checkEntry(), doButtonOpt(), fileEditingFinished(), fileTextChanged(), findFiles(), 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 147 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 154 of file FileFinderWidget.cpp.
References findFiles(), and m_allowMultipleFiles.
|
privateslot |
Browse clicked slot.
This slot opens a file browser.
Definition at line 859 of file FileFinderWidget.cpp.
References fileEditingFinished(), m_uiForm, and openFileDialog().
Referenced by FileFinderWidget().
| FileFinderSettings FileFinderWidget::captureSettings | ( | ) | const |
Capture the current state of this widget without persistent I/O.
Definition at line 639 of file FileFinderWidget.cpp.
References m_lastDir.
|
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 873 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 483 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 645 of file FileFinderWidget.cpp.
References extsAsSingleOption, getFileExtensionsFromAlgorithm(), isForRunFiles(), m_algorithmProperty, and m_fileExtensions.
Referenced by openFileDialog().
|
private |
Helper method to create a FindFilesSearchParameters object.
Definition at line 953 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 177 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 184 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 203 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 209 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 914 of file FileFinderWidget.cpp.
|
override |
Called when an item is dropped.
| de | :: the drop event data package |
Definition at line 897 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 262 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 270 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 491 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 496 of file FileFinderWidget.cpp.
References findFilesGetSearchText(), inspectThreadResult(), m_cachedResults, m_foundFiles, m_isForDirectory, m_isOptional, 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 528 of file FileFinderWidget.cpp.
References m_defaultInstrumentName.
Referenced by findFiles().
|
signal |
Emitted when files finding starts.
Referenced by runFindFiles().
| const QString & FileFinderWidget::getAlgorithmProperty | ( | ) | const |
Returns the algorithm name.
Definition at line 225 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 334 of file FileFinderWidget.cpp.
References ALL_ENTRIES, isValid(), m_multiEntry, m_uiForm, and NO_ENTRY_NUM.
| const QStringList & FileFinderWidget::getFileExtensions | ( | ) | const |
Returns the list of file extensions the widget will search for.
Definition at line 237 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 723 of file FileFinderWidget.cpp.
References Mantid::Kernel::PropertyWithValue< TYPE >::allowedValues(), Mantid::API::FileProperty::getDefaultExt(), iend, and index.
Referenced by createFileFilter().
| const QStringList & FileFinderWidget::getFilenames | ( | ) | const |
Returns the names of the files found.
Definition at line 304 of file FileFinderWidget.cpp.
References m_foundFiles.
| const QString & FileFinderWidget::getFileProblem | ( | ) | const |
Get file problem, empty string means no error.
Return the error.
Definition at line 404 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 313 of file FileFinderWidget.cpp.
References m_foundFiles.
| const QString & FileFinderWidget::getInstrumentOverride | ( | ) | const |
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 440 of file FileFinderWidget.cpp.
References m_defaultInstrumentName.
| QString FileFinderWidget::getLabelText | ( | ) | const |
Return the label text on the widget.
Definition at line 126 of file FileFinderWidget.cpp.
References m_uiForm.
|
inline |
Get the last directory.
Definition at line 163 of file FileFinderWidget.h.
| std::vector< std::string > FileFinderWidget::getStringFileExtensions | ( | ) | const |
Definition at line 239 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 328 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 360 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 589 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 323 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 111 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 117 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 99 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 105 of file FileFinderWidget.cpp.
References m_findRunFiles.
| bool FileFinderWidget::isOptional | ( | ) | const |
Return whether empty input is allowed.
Definition at line 162 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 168 of file FileFinderWidget.cpp.
References findFiles(), m_isOptional, and optional.
| bool FileFinderWidget::isSearching | ( | ) | const |
Is the widget currently searching.
Definition at line 298 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 292 of file FileFinderWidget.cpp.
References m_uiForm.
Referenced by MantidQt::CustomInterfaces::UserInputValidator::checkFileFinderWidgetIsValid(), and getEntryNum().
| bool FileFinderWidget::liveButtonIsChecked | ( | ) | const |
Definition at line 286 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 284 of file FileFinderWidget.cpp.
References m_uiForm.
| FileFinderWidget::LiveButtonOpts FileFinderWidget::liveButtonState | ( | ) | const |
Returns whether the live button is being shown;.
Definition at line 273 of file FileFinderWidget.cpp.
References m_liveButtonState.
Referenced by FileFinderWidget().
| void FileFinderWidget::liveButtonState | ( | LiveButtonOpts | option | ) |
Definition at line 275 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 767 of file FileFinderWidget.cpp.
References createFileFilter(), getText(), m_allowMultipleFiles, m_dialog, m_fileFilter, m_isForDirectory, m_lastDir, and m_useNativeDialog.
Referenced by browseClicked().
|
static |
Query last_directory from const storage without changing this widget or writing settings.
Definition at line 623 of file FileFinderWidget.cpp.
Referenced by MantidQt::MantidWidgets::DataSelector::readSettings().
|
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 841 of file FileFinderWidget.cpp.
References m_entryNumProblem, m_fileProblem, m_multiEntry, m_showValidator, and m_uiForm.
Referenced by doMultiEntry(), setEntryNumProblem(), setFileProblem(), and setReadOnly().
| void FileFinderWidget::restoreSettings | ( | const FileFinderSettings & | settings | ) |
Restore this widget from an in-memory snapshot without persistent I/O.
Definition at line 637 of file FileFinderWidget.cpp.
References MantidQt::API::FileFinderSettings::lastDirectory(), and m_lastDir.
|
private |
handles findFiles background thread
creates background thread for find files
| searchText | :: text to create search parameters from |
Definition at line 563 of file FileFinderWidget.cpp.
References createFindFilesSearchParameters(), MantidQt::API::FindFilesThreadPoolManager::createWorker(), findingFiles(), and m_pool.
Referenced by findFiles().
| void FileFinderWidget::saveSettings | ( | QSettings & | settings, |
| const FileFinderSettings & | values | ||
| ) | const |
Persist the supplied snapshot to mutable storage positioned at the target group.
Definition at line 406 of file FileFinderWidget.cpp.
References MantidQt::API::FileFinderSettings::lastDirectory(), and MantidQt::MantidWidgets::QSettingsChangeAware::setValue().
| 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 232 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 351 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 832 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 252 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 395 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 475 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 467 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 453 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 140 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 132 of file FileFinderWidget.cpp.
References m_uiForm.
|
inline |
Set the last directory.
Definition at line 165 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 429 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 415 of file FileFinderWidget.cpp.
References m_uiForm.
| void FileFinderWidget::setProxyModel | ( | QAbstractProxyModel * | proxyModel | ) |
Definition at line 978 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 938 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 370 of file FileFinderWidget.cpp.
| void FileFinderWidget::setTextValidator | ( | const QValidator * | validator | ) |
Set an arbitrary validator on the line edit.
Definition at line 970 of file FileFinderWidget.cpp.
References m_uiForm.
| void FileFinderWidget::setUseNativeWidget | ( | bool | native | ) |
Definition at line 972 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 382 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 951 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 576 of file FileFinderWidget.cpp.
References m_monitorLiveData.
|
private |
The algorithm name and property (can be empty)
Definition at line 260 of file FileFinderWidget.h.
Referenced by createFileFilter(), createFindFilesSearchParameters(), getAlgorithmProperty(), and setAlgorithmProperty().
|
private |
Allow multiple files.
Definition at line 248 of file FileFinderWidget.h.
Referenced by allowMultipleFiles(), allowMultipleFiles(), and openFileDialog().
|
private |
To use a browse button or icon or nothing at all.
Definition at line 254 of file FileFinderWidget.h.
Referenced by doButtonOpt(), doButtonOpt(), and FileFinderWidget().
|
private |
Handle to any results found.
Definition at line 289 of file FileFinderWidget.h.
Referenced by findFiles(), and inspectThreadResult().
|
private |
Cache the default instrument name.
Definition at line 283 of file FileFinderWidget.h.
Referenced by findFilesGetSearchText(), getInstrumentOverride(), and setInstrumentOverride().
|
private |
non-native QFileDialog
Definition at line 291 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 258 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 264 of file FileFinderWidget.h.
Referenced by extsAsSingleOption(), and extsAsSingleOption().
|
private |
The file extensions to look for.
Definition at line 262 of file FileFinderWidget.h.
Referenced by createFileFilter(), getFileExtensions(), getStringFileExtensions(), and setFileExtensions().
|
private |
A file filter for the file browser.
Definition at line 281 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 256 of file FileFinderWidget.h.
Referenced by getFileProblem(), refreshValidator(), and setFileProblem().
|
private |
Is the widget for run files or standard files.
Definition at line 244 of file FileFinderWidget.h.
Referenced by isForRunFiles(), and isForRunFiles().
|
private |
An array of valid file names derived from the entries in the leNumber LineEdit.
Definition at line 275 of file FileFinderWidget.h.
Referenced by clear(), findFiles(), getFilenames(), getFirstFilename(), and inspectThreadResult().
|
private |
If the widget is for directories.
Definition at line 246 of file FileFinderWidget.h.
Referenced by findFiles(), isForDirectory(), isForDirectory(), and openFileDialog().
|
private |
Whether the widget can be empty.
Definition at line 250 of file FileFinderWidget.h.
Referenced by findFiles(), isOptional(), and isOptional().
|
private |
The last directory viewed by the browse dialog.
Definition at line 279 of file FileFinderWidget.h.
Referenced by captureSettings(), FileFinderWidget(), openFileDialog(), and restoreSettings().
|
private |
An array of the last valid file names found.
Definition at line 277 of file FileFinderWidget.h.
Referenced by inspectThreadResult().
|
private |
If or when live button will be shown.
Definition at line 266 of file FileFinderWidget.h.
Referenced by FileFinderWidget(), liveButtonState(), and liveButtonState().
|
private |
Handle on a running instance of MonitorLiveData.
Definition at line 268 of file FileFinderWidget.h.
Referenced by setLiveAlgorithm(), and stopLiveAlgorithm().
|
private |
Whether to allow the user to state an entry number.
Definition at line 252 of file FileFinderWidget.h.
Referenced by doMultiEntry(), doMultiEntry(), FileFinderWidget(), getEntryNum(), and refreshValidator().
|
private |
Handle to a find files thread pool manager.
Definition at line 287 of file FileFinderWidget.h.
Referenced by isSearching(), and runFindFiles().
|
private |
Whether validation red star is being shown.
Definition at line 270 of file FileFinderWidget.h.
Referenced by refreshValidator(), and setValidatorDisplay().
|
private |
The Ui form.
Definition at line 272 of file FileFinderWidget.h.
Referenced by browseClicked(), checkEntry(), clear(), doButtonOpt(), doMultiEntry(), dropEvent(), FileFinderWidget(), findFiles(), 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 293 of file FileFinderWidget.h.
Referenced by openFileDialog(), and setUseNativeWidget().
|
private |
Expanded user input.
Definition at line 285 of file FileFinderWidget.h.
Referenced by getUserInput(), and inspectThreadResult().
|
readwrite |
Definition at line 63 of file FileFinderWidget.h.
|
readwrite |
Definition at line 62 of file FileFinderWidget.h.
Referenced by doButtonOpt().
|
readwrite |
Definition at line 65 of file FileFinderWidget.h.
Referenced by createFileFilter().
|
readwrite |
Definition at line 64 of file FileFinderWidget.h.
|
readwrite |
Definition at line 57 of file FileFinderWidget.h.
|
readwrite |
Definition at line 56 of file FileFinderWidget.h.
|
readwrite |
Definition at line 67 of file FileFinderWidget.h.
|
readwrite |
Definition at line 58 of file FileFinderWidget.h.
|
readwrite |
Definition at line 66 of file FileFinderWidget.h.
|
readwrite |
Definition at line 61 of file FileFinderWidget.h.
Referenced by doMultiEntry().
|
readwrite |
Definition at line 59 of file FileFinderWidget.h.
|
readwrite |
Definition at line 60 of file FileFinderWidget.h.
Referenced by isOptional().