BrainStim Main Application
1.1.0.1
The BrainStim Main Application class references.
|
The BrainStim Main Application. More...
Inherits DocumentWindow.
Public Slots | |
bool | addOutputWindow (const QString &sTabName) |
Add a new tab to the Output Log Window. More... | |
bool | addScriptIncludePath (const QString &sPath) |
Adds an include path/directory for the script engine to search in for an included file. More... | |
void | clearOutputWindow (const QString &sTabName=MAINWINDOW_DEFAULT_OUTPUTWINDOW_TABNAME) |
Clears the Output Log Window. More... | |
void | closeActiveDocument () |
Closes the current active document. More... | |
void | enableActiveDocument (bool bEnable=true) |
configures the Active(edit) state for the current document. More... | |
void | executeActiveDocument () |
Executes the current active document. More... | |
QString | getActiveDocumentFileLocation () |
Returns the path to the current active document. More... | |
QString | getActiveDocumentFileName () |
Returns the filename of the current active document. More... | |
QString | getApplicationRootDirPath () |
Returns the path to the BrainStim Root directory. More... | |
QString | getEnvironmentVariabele (QString strName) |
Returns the requested Environment Variable. More... | |
QString | getJavaScriptConfigurationFileContents () |
returns the content from the embedded JavaScript file inside the BrainStim application. More... | |
QString | getQMLPluginPath () |
Returns the path to the BrainStim QML plugin directory. More... | |
QStringList | getScriptIncludePaths () |
Returns an array containing all the appended include paths/directories for the script engine to search in for an included file. More... | |
bool | initialize (GlobalApplicationInformation::MainProgramModeFlags mainFlags=0) |
Initializes the main BrainStim application and the dynamic plugin loading. More... | |
QVariant | invokeJavaScriptConfigurationFile (const QString &sCode) |
Executes and returns a result from a provided Javascript function that is embedded inside the BrainStim application. More... | |
void | openFiles (const QString &fileToLoad=QString(), const QStringList &filesToLoad=QStringList(), const bool &bViewAsText=false) |
Opens one or more files. More... | |
void | processEvents () |
forces the main application event loop to process its events. More... | |
void | reloadSubWindow () |
Re-opens the current active document. More... | |
bool | removeOutputWindow (const QString &sTabName=MAINWINDOW_DEFAULT_OUTPUTWINDOW_TABNAME) |
Removes a named tab from the Output Log Window. More... | |
void | reOpenCurrentFile (const QString &strCanonicalFilePath, const bool &bNativeFileViewer=false) |
Re-opens the document. More... | |
bool | saveOutputWindow (const QString &sFilePath="", const bool &bOverwrite=false, const QString &sTabName=MAINWINDOW_DEFAULT_OUTPUTWINDOW_TABNAME) |
Saves the content of a Output Log window to a file. More... | |
void | showJavaScriptConfigurationFile () |
executes the content from the embedded JavaScript file inside the BrainStim application in a QWebView object. More... | |
void | write2OutputWindow (const QString &text2Write="", const QString &sTabName=MAINWINDOW_DEFAULT_OUTPUTWINDOW_TABNAME) |
Appends a text String to the Output Log Window. More... | |
Public Member Functions | |
void | activateMainWindow () |
Forces the BrainStim User Interface to become activated. More... | |
void | cleanupScript () |
Forces the script engine to perform a garbage collection. More... | |
bool | copyDirectoryRecursively (const QString &srcFilePath, const QString &tgtFilePath) |
Use this function to copy a complete directory path recursively. More... | |
bool | deleteContextState (const QString &sContextName) |
Deletes the provided context name of the internal script engine context state list. More... | |
bool | emulateKeyPress (QWindow *pWindow=NULL, const int keyCode=0, const QString &sKeys="", const Qt::KeyboardModifiers modifier=Qt::NoModifier, const int nDelay=-1) |
Emulates one or more key press event(s). More... | |
QScriptValue | executeScriptContent (const QString &sContent) |
Executes the provided script content in the Internal Script Engine and returns the result of that operation. More... | |
QScriptValue | executeScriptFile (const QString &sFilePath) |
Executes the provided script file content in the Internal Script Engine and returns the result of that operation. More... | |
void | find (bool useParams=false, QString strFindString="", DocFindFlags findFlags=_DocFindFlags()) |
Searches for a provided String inside the currently active document. More... | |
void | findNext () |
Searches for the last provided String inside the currently active document. More... | |
void | findPrev () |
Searches for the last provided String inside the currently active document. More... | |
int | getCurrentContextStateScriptID () |
Returns the current internal script engine context state script identifier. More... | |
QString | getCurrentDateTimeStamp (const QString &sFormat=MainAppInfo::stdDateTimeFormat()) |
Use this function to retrieve the current date/time. More... | |
bool | getStoredSettingValue (const QString &sSettingPath, QString *sResult) |
Use this function to retrieve a stored setting value. More... | |
bool | loadDynamicPlugins () |
loads the available enabled plugins. More... | |
void | quit () |
Closes the BrainStim application. More... | |
Q_INVOKABLE QAction * | registerMainMenuAction (const QStringList &lmenuItemSpecifier, QIcon *iMenuIcon=NULL, const bool &bSkipSubWindowRegistration=false) |
void | replace (bool bReplaceAll=false, bool useParams=false, QString strFindString="", QString strReplaceString="", DocFindFlags findFlags=_DocFindFlags()) |
Searches and replaces a provided String inside the currently active document. More... | |
bool | resetContextState (const quint64 &nScriptId=0) |
Resets the current internal script engine context state to the context state marked with a script identifier. More... | |
bool | restartScriptEngine () |
Forces a complete restart of the internal script engine. More... | |
bool | saveContextState (const QString &sContextName) |
Saves the current internal script engine context state marked with a provided context name for later usage. More... | |
bool | setContextState (const QString &sContextName) |
Sets/switches the current internal script engine to the context state marked with the provided context name. More... | |
bool | unloadDynamicPlugins () |
unloads the previously loaded plugins. More... | |
The BrainStim Main Application.
The BrainStim Main Application can be directly accessed within the script by using the default 'BrainStim' object.
void MainWindow::activateMainWindow | ( | ) |
Forces the BrainStim User Interface to become activated.
This function forces the the BrainStim User Interface to become activated. An active window is a visible top-level window that has the keyboard input focus. It is the same operation as clicking the mouse on the title bar of a top-level window.
|
slot |
Add a new tab to the Output Log Window.
This function adds a new tab to the Output Log Window.
sTabName | a String value holding the name of the new tab. |
|
slot |
Adds an include path/directory for the script engine to search in for an included file.
This function adds an include path/directory for the script engine to search in for an included file. Whenever the script "Include()" command cannot be resolved automatically (using the active docments directory) all the included paths appended with this method are then used for resolving the command.
sPath | a String containing the path of the path/directory that should be appended to the include script paths. |
void MainWindow::cleanupScript | ( | ) |
Forces the script engine to perform a garbage collection.
This function forces the script engine to perform a garbage collection and is therefore a safe and good practice to execute as last command before ending the script.
|
slot |
Clears the Output Log Window.
This function clears the Output Log Window.
sTabName | a String value holding the name of the tab that should be cleared, if left empty then the first "Default" tab is automatically cleared. |
|
slot |
Closes the current active document.
This function closes the document that is currently opened and active.
bool MainWindow::copyDirectoryRecursively | ( | const QString & | srcFilePath, |
const QString & | tgtFilePath | ||
) |
Use this function to copy a complete directory path recursively.
This function copies a complete directory path recursively to another directory path.
srcFilePath | a string value containing the path to the directory to copy from. |
tgtFilePath | a string value containing the path to the directory to copy to. |
bool MainWindow::deleteContextState | ( | const QString & | sContextName | ) |
Deletes the provided context name of the internal script engine context state list.
This function deletes the provided context name of the internal script engine context state list.
bool MainWindow::emulateKeyPress | ( | QWindow * | pWindow = NULL , |
const int | keyCode = 0 , |
||
const QString & | sKeys = "" , |
||
const Qt::KeyboardModifiers | modifier = Qt::NoModifier , |
||
const int | nDelay = -1 |
||
) |
Emulates one or more key press event(s).
This function emulates one or more key press event(s). These events are executed in a specified QWindow, there's also a option to set a delay.
pWindow | a pointer to a QWindow, this is the QWindow where the key press event should be executed in (default = NULL), if this parameter is NULL then the current active BrainStim document window is used. |
keyCode | a value (default = 0), this is the key code for the key to emulate, see http://qt-project.org/doc/qt-5.1/qtcore/qt.html#Key-enum. |
sKeys | a string (default = ""), this is a string of keys to emulate. |
modifier | a integer value holding a keyboard modifier value (default = Qt::NoModifier), see http://qt-project.org/doc/qt-5.1/qtcore/qt.html#KeyboardModifier-enum. |
nDelay | a integer value (default = -1) holding the delay in mSeconds between the key presses. |
|
slot |
configures the Active(edit) state for the current document.
This function can configures the Active(edit) state for the current document, this can be convenient for (un-)locking the document for editing
bEnable | a Boolean value (default = true) determining whether the document should be Activated (Editable). |
|
slot |
Executes the current active document.
This function executes the current active document (file that is opened and active).
QScriptValue MainWindow::executeScriptContent | ( | const QString & | sContent | ) |
Executes the provided script content in the Internal Script Engine and returns the result of that operation.
This function executes the provided script content in the Internal Script Engine and returns the result of that operation. This function acts the same as like executing a script file (*.qs) from the BrainStim application, but now the content of the script is directly provided by a string of text. Before the internal script engine executes the custom script it firsts creates a so called script context state from within the script is then executed. This context state holds the stack and can be saved/recovered for later usage, see also MainWindow::saveContextState(), MainWindow::setContextState(), MainWindow.resetContextState() and MainWindow.deleteContextState().
sContent | a string value holding the script content to execute. |
QScriptValue MainWindow::executeScriptFile | ( | const QString & | sFilePath | ) |
Executes the provided script file content in the Internal Script Engine and returns the result of that operation.
This function executes the provided script file content in the Internal Script Engine and returns the result of that operation. See MainWindow::executeScriptFile(), MainWindow::saveContextState(), MainWindow::setContextState(), MainWindow.resetContextState() and MainWindow.deleteContextState().
sFilePath | a string value holding the script absolute path to the script file that should be executed. |
void MainWindow::find | ( | bool | useParams = false , |
QString | strFindString = "" , |
||
DocFindFlags | findFlags = _DocFindFlags() |
||
) |
Searches for a provided String inside the currently active document.
This function searches for a provided String of text inside the currently active document. Furthermore this action can be specified with special flags.
useParams | a boolean value that determines whether the optional provided parameters should be used. If useParams is false then a Search window appears allowing the user to make further changes. If some text from the document was selected than this String is automatically used for the find String, otherwise the word around the cursor position is used. If useParams is true then no Search window appears and the optional provided parameters are used for the search action, the first found occurrence (starting from the cursor position) of the find result is then automatically selected. |
strFindString | a String holding the text value to use. |
findFlags | a DocFindFlags structure holding the text value to use, you can create this structure in the script like: var varName=DocFindFlags;
varName.backwards = true;
|
void MainWindow::findNext | ( | ) |
Searches for the last provided String inside the currently active document.
This function searches (forwards) for the last provided String of text inside the currently active document starting from the current cursor position.
void MainWindow::findPrev | ( | ) |
Searches for the last provided String inside the currently active document.
This function searches (backwards) for the last provided String of text inside the currently active document starting from the current cursor position.
|
slot |
Returns the path to the current active document.
This function returns the path to the document that is currently opened and active.
|
slot |
Returns the filename of the current active document.
This function returns the filename of the document that is currently opened and active.
|
slot |
Returns the path to the BrainStim Root directory.
This function returns the path to the BrainStim Root directory, where the binary is running in.
int MainWindow::getCurrentContextStateScriptID | ( | ) |
Returns the current internal script engine context state script identifier.
This function returns the current internal script engine context state script identifier.
QString MainWindow::getCurrentDateTimeStamp | ( | const QString & | sFormat = MainAppInfo::stdDateTimeFormat() | ) |
Use this function to retrieve the current date/time.
This function returns the current date/time string that can be custom formatted.
sFormat | a string value containing the custom Date/Time format, if left empty the value "yyyyMMddHHmmsszzz" is used. |
|
slot |
Returns the requested Environment Variable.
This function can return a Environment Variable value by providing the name of the variable.
strName | a String value holding the name of the requested Environment Variable. |
|
slot |
returns the content from the embedded JavaScript file inside the BrainStim application.
This function returns the content from the embedded JavaScript file inside the BrainStim application that is used for storing all kind of application and plugin (version) information. See also MainWindow.invokeJavaScriptConfigurationFile().
|
slot |
Returns the path to the BrainStim QML plugin directory.
This function returns the path to the BrainStim QML plugin directory.
|
slot |
Returns an array containing all the appended include paths/directories for the script engine to search in for an included file.
This function returns an array containing all the appended include paths/directories for the script engine to search in for an included file. See also MainWindow::addScriptIncludePath()
bool MainWindow::getStoredSettingValue | ( | const QString & | sSettingPath, |
QString * | sResult | ||
) |
Use this function to retrieve a stored setting value.
This function returns a stored setting using the provided path to the settings variable.
sSettingPath | a string value containing the path to the settings variable. |
sResult | a string value containing the requested settings variable value. |
|
slot |
Initializes the main BrainStim application and the dynamic plugin loading.
This function Initializes the main BrainStim application and the dynamic plugin loading, this is automatically done during startup.
mainFlags | a GlobalApplicationInformation::MainProgramModeFlags value holding the flags used for the initialization. |
|
slot |
Executes and returns a result from a provided Javascript function that is embedded inside the BrainStim application.
This function executes and returns a result from a provided Javascript function that is embedded inside the BrainStim application. The embedded available Javascript function calls provide a way to request all kind of application and plugin (version) information. The menu command 'Help' –> 'BrainStim History' can also be used to retrieve this kind of information, see also MainWindow.getJavaScriptConfigurationFileContents().
sCode | a String containing the Javascript function call that should be executed. |
bool MainWindow::loadDynamicPlugins | ( | ) |
loads the available enabled plugins.
This function loads the available enabled plugins.
= QFileInfo(sPluginAbsFilePath).canonicalFilePath()) && (QFileInfo(lFiles[i]).canonicalPath() != QDir(MainAppInfo::appDirPath()).canonicalPath()))
|
slot |
Opens one or more files.
This function can open one or more files.
fileToLoad | a String containing a single path to the file that should be loaded. |
filesToLoad | a String Array containing multiple Strings containing the paths to the files that should be loaded. |
bViewAsText | a boolean value determining whether the file(s) to open should be viewed/formatted as text. |
|
inlineslot |
forces the main application event loop to process its events.
This function forces the main application event loop to process its events, see http://qt-project.org/doc/qt-5.1/qtcore/qcoreapplication.html#processEvents.
|
inline |
Closes the BrainStim application.
This function closes the BrainStim application.
QAction * MainWindow::registerMainMenuAction | ( | const QStringList & | lmenuItemSpecifier, |
QIcon * | iMenuIcon = NULL , |
||
const bool & | bSkipSubWindowRegistration = false |
||
) |
Cannot use already present menu actions...
|
slot |
Re-opens the current active document.
This function first closes and then re-opens the current active document, see MainWindow::reOpenCurrentFile().
|
slot |
Removes a named tab from the Output Log Window.
This function removes a named tab from the Output Log Window.
sTabName | a String value holding the name of the tab that should be removed. |
|
slot |
Re-opens the document.
This function first closes and re-opens the document.
strCanonicalFilePath | a String value containing the canonical file path of the document, if empty then the current active document file path is used. |
bNativeFileViewer | a Boolean value determining whether the file should be opened again by the default set file-handler (defined by a plug-in) or by BrainStim directly. |
void MainWindow::replace | ( | bool | bReplaceAll = false , |
bool | useParams = false , |
||
QString | strFindString = "" , |
||
QString | strReplaceString = "" , |
||
DocFindFlags | findFlags = _DocFindFlags() |
||
) |
Searches and replaces a provided String inside the currently active document.
This function searches and replaces a provided String of text inside the currently active document. Furthermore this action can be specified with special flags.
bReplaceAll | a boolean value that determines whether all occurrences of the found String should be replaced. |
useParams | a boolean value that determines whether the optional provided parameters should be used. If useParams is false then a Replace window appears allowing the user to make further changes. If some text from the document was selected than this String is automatically used for the find String, otherwise the word around the cursor position is used. If useParams is true then no Search window appears and the optional provided parameters are used for the search action, the first found occurrence (starting from the cursor position) of the find result is then automatically selected. |
strFindString | a String holding the String value to search for. |
strReplaceString | a String holding the text value to replace the found String strFindString with. |
findFlags | a DocFindFlags structure holding the text value to use, you can create this structure in the script like: var varName=DocFindFlags;
varName.backwards = true;
|
bool MainWindow::resetContextState | ( | const quint64 & | nScriptId = 0 | ) |
Resets the current internal script engine context state to the context state marked with a script identifier.
This function resets the current internal script engine context state to the context state marked with a script identifier, see also MainWindow.getCurrentContextStateScriptID(). If the script identifier is left empty or 0 then the current script state is reset.
nScriptId | a integer value holding the script identifier (default = 0). |
bool MainWindow::restartScriptEngine | ( | ) |
Forces a complete restart of the internal script engine.
This function forces a complete restart of the internal script engine. The engine restarts which means that all running scripts and context states are deleted.
bool MainWindow::saveContextState | ( | const QString & | sContextName | ) |
Saves the current internal script engine context state marked with a provided context name for later usage.
This function saves the current internal script engine context state marked with a provided name for later usage.
sContextName | a string value holding the script context name. |
|
slot |
Saves the content of a Output Log window to a file.
This function saves the content of a named Output Log Window to a text file.
sFilePath | a String value holding the path to the destination file. |
bOverwrite | a Boolean value determining whether the destination file may be overwritten in case the file already exists. |
sTabName | a String value holding the name of the tab that should be saved. |
bool MainWindow::setContextState | ( | const QString & | sContextName | ) |
Sets/switches the current internal script engine to the context state marked with the provided context name.
This function sets/switches the current internal script engine to the context state marked with the provided context name.
sContextName | a string value holding the script context name. |
|
slot |
executes the content from the embedded JavaScript file inside the BrainStim application in a QWebView object.
This function executes the content from the embedded JavaScript file (of the BrainStim application that is used for storing all kind of application and plugin (version) information) in a QWebView object. See also MainWindow.invokeJavaScriptConfigurationFile().
bool MainWindow::unloadDynamicPlugins | ( | ) |
unloads the previously loaded plugins.
This function unloads the previously loaded plugins.
|
slot |
Appends a text String to the Output Log Window.
This function appends a provided String to the Output Log Window.
text2Write | a String value holding the text that should be appended. |
sTabName | a String value holding the name of the tab where the text should be appended, if left empty then the text is automatically send to the first "Default" tab. |