itom 1.3.0
ito::ScriptDockWidget Class Reference

widget containing one or multiple script editors (tabbed). This widget can either be a docking widget, docked in a docking area in the main window or it can be a floatable window which has a standard window behaviour. More...

Inheritance diagram for ito::ScriptDockWidget:
ito::AbstractDockWidget

List of all members.

Public Slots

void editorMarginChanged ()

Signals

void removeAndDeleteScriptDockWidget (ScriptDockWidget *widget)
void openScriptRequest (const QString &filename, ScriptDockWidget *scriptDockWidget)
void dockScriptTab (ScriptDockWidget *widget, int index, bool closeDockIfEmpty=false)
void undockScriptTab (ScriptDockWidget *widget, int index, bool undockToNewScriptWindow=false, bool closeDockIfEmpty=false)
void pythonRunFileRequest (QString filename)
void pythonDebugFileRequest (QString filename)
void pythonInterruptExecution ()
void pythonDebugCommand (tPythonDbgCmd cmd)
void pythonRunSelection (QString selectionText)

Public Member Functions

 ScriptDockWidget (const QString &title, const QString &objName, bool docked, bool isDockAvailable, QWidget *parent=0, Qt::WindowFlags flags=0)
 constructor
 ~ScriptDockWidget ()
 destructor
QStringList getModifiedFileNames (bool ignoreNewScripts=false, int excludeIndex=-1) const
 returns a list of filenames, which have been modified in this ScriptDockWidget
RetVal newScript ()
 creates new instance of ScriptEditorWidget and appends it to the tab-widget
RetVal openScript ()
 method to open an existing script which can be indicated by the user by a getOpenFileName-dialog.
RetVal openScript (QString filename, bool silent=false)
 opens a given filename as new tab in this ScriptDockWidget
RetVal saveAllScripts (bool askFirst=true, bool ignoreNewScripts=false, int excludeIndex=-1)
 tries to save all opened scripts in this ScriptDockWidget
RetVal closeAllScripts (bool saveFirst=true, bool askFirst=true, bool ignoreNewScripts=false, int excludeIndex=-1)
 closes all opened scripts in this ScriptDockWidget
bool isTabIndexValid (int tabIndex) const
int getTabCount () const
bool containsNewScripts () const
 checks whether any editor in this ScriptDockWidget has no filename
RetVal appendEditor (ScriptEditorWidget *editorWidget)
 append given ScriptEditorWidget as new tab
ScriptEditorWidget * removeEditor (int index)
 removes ScriptEditorWidget at given tab position from tab-widget and returns its reference
bool activateTabByFilename (const QString &filename, int line=-1)
 activates tab with script whose filename corresponds to the filename parameter.
bool activeTabEnsureLineVisible (int lineNr)
QList< ito::ScriptEditorStoragesaveScriptState () const
RetVal restoreScriptState (const QList< ito::ScriptEditorStorage > &states)

Protected Member Functions

ScriptEditorWidget * getEditorByIndex (int index) const
 returns ScriptEditorWidget by given tab-index
ScriptEditorWidget * getCurrentEditor () const
 returns reference to current ScriptEditorWidget
int getIndexByEditor (const ScriptEditorWidget *sew) const
 returns tab-index by given reference to ScriptEditorWidget
void createActions ()
 creates actions
void createMenus ()
 create menus
void createToolBars ()
 create toolbars
void createStatusBar ()
 init status bar
void closeEvent (QCloseEvent *event)
 this method is invoked if this ScriptDockWidget should be closed.
RetVal closeTab (int index, bool saveFirst=true)
 public method to close any specific tab with or without saving its script first
RetVal saveTab (int index, bool forceSaveAs=false, bool askFirst=true)
 saves tab

Private Slots

void tabContextMenuEvent (QContextMenuEvent *event)
 method is invoked, if a context menu is requested
void findTextExpr (QString expr, bool regExpr, bool caseSensitive, bool wholeWord, bool wrap, bool forward, bool isQuickSeach)
void replaceTextExpr (QString expr, QString replace)
void replaceAllExpr (QString expr, QString replace, bool regExpr, bool caseSensitive, bool wholeWord, int findIn)
void insertIconBrowserText (QString iconLink)
void currentTabChanged (int index)
 slot invoked by tab-widget if current tab changed
void tabCloseRequested (int index)
 slot invoked if close button of any tab of m_tab (QTabWidgetItom) has been pressed
void tabCloseRequested (ScriptEditorWidget *sew, bool ignoreModifications)
void scriptModificationChanged (bool changed)
 slot connected to each ScriptEditorWidget instance. Invoked if any content in any script changed.
void updateEditorActions ()
 updates actions which deal with editor commands
void updatePythonActions ()
 updates actions which deal with python commands
void updateTabContextActions ()
 updates actions before context menu of tabs is shown
void mnuOpenIconBrowser ()
 Open the icon browser.
void mnuTabMoveLeft ()
 moves active tab by one position to the left
void mnuTabMoveRight ()
 moves active tab by one position to the right
void mnuTabMoveFirst ()
 moves active tab to the first position
void mnuTabMoveLast ()
 moves active tab to the last position
void mnuTabClose ()
 closes active tab
void mnuTabCloseOthers ()
 closes every tab besides active one (asks for saving tabs, which should be closed)
void mnuTabCloseAll ()
 closes every tab, asks for saving first
void mnuTabDock ()
 dock the active tab and closes this ScriptDockWidget, if it is not docked and empty after docking
void mnuTabUndock ()
 undock the active tab and closes this ScriptDockWidget, if it is not docked and empty after docking
void mnuNewScript ()
 slot invoked by action to open a new script
void mnuOpenScript ()
 slot invoked by action to open an existing script
void mnuSaveScript ()
 slot invoked by action to save active script
void mnuSaveScriptAs ()
 slot invoked by action to save active script with new filename (save as)
void mnuSaveAllScripts ()
 slot invoked by action to save all opened scripts
void mnuPrint ()
void mnuCut ()
 slot invoked to execute a cut command in active script editor
void mnuCopy ()
 slot invoked to execute a copy command in active script editor
void mnuPaste ()
 slot invoked to execute a paste command in active script editor
void mnuUndo ()
 slot invoked to execute an undo command in active script editor
void mnuRedo ()
 slot invoked to execute a redo command in active script editor
void mnuComment ()
 slot invoked to execute a comment command in active script editor
void mnuUncomment ()
 slot invoked to execute an uncomment command in active script editor
void mnuIndent ()
 slot invoked to execute an indentation command in active script editor
void mnuUnindent ()
 slot invoked to execute an unindentation command in active script editor
void mnuScriptRun ()
 slot invoked to run the active script in python engine
void mnuScriptRunSelection ()
void mnuScriptDebug ()
 slot invoked to debug the active script in python engine
void mnuScriptStop ()
 slot invoked to stop python script execution
void mnuScriptContinue ()
 slot invoked to continue debugging process if actually waiting at breakpoint
void mnuScriptStep ()
 slot invoked to execute a python debugging step
void mnuScriptStepOver ()
 slot invoked to execute a python debugging step over
void mnuScriptStepOut ()
 slot invoked to execute a python debugging step out
void mnuFindTextExpr ()
void mnuReplaceTextExpr ()
void mnuGoto ()
void mnuToggleBookmark ()
void mnuClearAllBookmarks ()
void mnuGotoNextBookmark ()
void mnuGotoPreviousBookmark ()
void menuLastFilesAboutToShow ()
void lastFileOpen (const QString &path)

Private Attributes

QWidget * m_pCenterWidget
QVBoxLayout * m_pVBox
QTabWidgetItomm_tab
WidgetFindWordm_pWidgetFindWord
DialogReplacem_pDialogReplace
int m_actTabIndex
ShortcutAction * m_tabMoveLeftAction
ShortcutAction * m_tabMoveRightAction
ShortcutAction * m_tabMoveFirstAction
ShortcutAction * m_tabMoveLastAction
ShortcutAction * m_tabCloseAction
ShortcutAction * m_tabCloseOthersAction
ShortcutAction * m_tabCloseAllAction
ShortcutAction * m_tabDockAction
ShortcutAction * m_tabUndockAction
ShortcutAction * m_newScriptAction
ShortcutAction * m_openScriptAction
ShortcutAction * m_saveScriptAction
ShortcutAction * m_saveScriptAsAction
ShortcutAction * m_saveAllScriptsAction
ShortcutAction * m_printAction
ShortcutAction * m_cutAction
ShortcutAction * m_copyAction
ShortcutAction * m_pasteAction
ShortcutAction * m_undoAction
ShortcutAction * m_redoAction
ShortcutAction * m_commentAction
ShortcutAction * m_uncommentAction
ShortcutAction * m_indentAction
ShortcutAction * m_unindentAction
ShortcutAction * m_scriptRunAction
ShortcutAction * m_scriptRunSelectionAction
ShortcutAction * m_scriptDebugAction
ShortcutAction * m_scriptStopAction
ShortcutAction * m_scriptContinueAction
ShortcutAction * m_scriptStepAction
ShortcutAction * m_scriptStepOverAction
ShortcutAction * m_scriptStepOutAction
ShortcutAction * m_findTextExprAction
ShortcutAction * m_replaceTextExprAction
ShortcutAction * m_gotoAction
ShortcutAction * m_openIconBrowser
ShortcutAction * m_bookmarkToggle
ShortcutAction * m_bookmarkNext
ShortcutAction * m_bookmarkPrevious
ShortcutAction * m_bookmarkClearAll
ShortcutAction * m_lastFileAct
QMenu * m_tabContextMenu
QMenu * m_fileMenu
QMenu * m_lastFilesMenu
QMenu * m_viewMenu
QMenu * m_editMenu
QMenu * m_scriptMenu
QMenu * m_winMenu
QMenu * m_bookmark
QSignalMapper * m_lastFilesMapper
QToolBar * m_fileToolBar
QToolBar * m_editToolBar
QToolBar * m_scriptToolBar
QToolBar * m_bookmarkToolBar

Detailed Description

widget containing one or multiple script editors (tabbed). This widget can either be a docking widget, docked in a docking area in the main window or it can be a floatable window which has a standard window behaviour.

Todo:
right now, the floatable window does not have an single icon in the windows taskbar and is always on top of the main window. This behavior can be changed e.g. by defining an own titleWidget of the dockWidget.

Constructor & Destructor Documentation

ito::ScriptDockWidget::ScriptDockWidget ( const QString &  title,
const QString &  objName,
bool  docked,
bool  isDockAvailable,
QWidget *  parent = 0,
Qt::WindowFlags  flags = 0 
)

constructor

creates a tab widget (QTabWidgetItom), which contains multiple instances of ScriptEditorWidget. Creates actions, menus, toolbars and sets some other settings.

Parameters:
titleTitle of the DockWidget
dockedtrue: this widget should be docked at creating time, else: false
isDockAvailableindicates whether docking functionality is available, if not, docked is always set to false
Returns:
description
See also:
AbstractDockWidget::AbstractDockWidget

< tab-settings

ito::ScriptDockWidget::~ScriptDockWidget ( )

destructor

cancels connections and closes every tab.


Member Function Documentation

bool ito::ScriptDockWidget::activateTabByFilename ( const QString &  filename,
int  line = -1 
)

activates tab with script whose filename corresponds to the filename parameter.

Parameters:
filenameFilename of the script which should be activated
lineis the marked debugging line (default: -1, no arrow)
Returns:
true if filename has been found and activated, else false.
RetVal ito::ScriptDockWidget::appendEditor ( ScriptEditorWidget *  editorWidget)

append given ScriptEditorWidget as new tab

appends widget, without creating it (for drag&drop, (un)-docking...)

Parameters:
editorWidgetScriptEditorWidget to append
Returns:
retOk

< activate appended tab

RetVal ito::ScriptDockWidget::closeAllScripts ( bool  saveFirst = true,
bool  askFirst = true,
bool  ignoreNewScripts = false,
int  excludeIndex = -1 
)

closes all opened scripts in this ScriptDockWidget

if indicated, scripts will be saved first. Methods returns if saving process fails, else scripts will be closed.

Parameters:
saveFirstif true, unsaved scripts are tried to be saved first
askFirstif true, user will be asked about script saving
ignoreNewScriptsif true, new scripts which do not have any filename are not considered in the saving method
excludeIndextab with given index will not be considered in saving method, default: -1 (consider all scripts)
Returns:
retOk if every script could be closed, else retError
See also:
saveAllScripts
void ito::ScriptDockWidget::closeEvent ( QCloseEvent *  event) [protected, virtual]

this method is invoked if this ScriptDockWidget should be closed.

First, tries to save every script. If this process is successfully executed, the close event is accepted in order to close this instance, else the event is ignored. If event is accepted, the signal removeAndDeleteScriptDockWidget is emitted, such that the ScriptEditorOrganizer can manage the deletion of this instance.

Parameters:
eventEvent of type QCloseEvent
See also:
removeAndDeleteScriptDockWidget

Reimplemented from ito::AbstractDockWidget.

RetVal ito::ScriptDockWidget::closeTab ( int  index,
bool  saveFirst = true 
) [protected]

public method to close any specific tab with or without saving its script first

Parameters:
indextab-index of tab in question
saveFirstsave changes in editor first (true) or ignore changes (false)
Returns:
retOk if tab has been saved (or not) and closed, retError if saving failed
See also:
saveTab, removeEditor
bool ito::ScriptDockWidget::containsNewScripts ( ) const

checks whether any editor in this ScriptDockWidget has no filename

returns number of tabs

Returns:
true if any script has no filename, else false< new means unsaved (without filename)
void ito::ScriptDockWidget::createStatusBar ( ) [protected, virtual]

init status bar

Todo:
right now, this is an empty method

Implements ito::AbstractDockWidget.

void ito::ScriptDockWidget::currentTabChanged ( int  index) [private, slot]

slot invoked by tab-widget if current tab changed

modifies title of this ScriptDockWidget instance, depending on the active tab.

Parameters:
indextab-index of changed editor
void ito::ScriptDockWidget::dockScriptTab ( ScriptDockWidget widget,
int  index,
bool  closeDockIfEmpty = false 
) [signal]

signal emitted if tab with given index of given ScriptDockWidget should be docked in a docked ScriptDockWidget

ScriptEditorWidget * ito::ScriptDockWidget::getCurrentEditor ( ) const [protected]

returns reference to current ScriptEditorWidget

Returns:
reference to current ScriptEditorWidget or NULL
ScriptEditorWidget * ito::ScriptDockWidget::getEditorByIndex ( int  index) const [protected]

returns ScriptEditorWidget by given tab-index

long description

Parameters:
indextab-index
Returns:
reference to ScriptEditorWidget or NULL, if index has been out of boundaries
int ito::ScriptDockWidget::getIndexByEditor ( const ScriptEditorWidget *  sew) const [protected]

returns tab-index by given reference to ScriptEditorWidget

Parameters:
sewreference to ScriptEditorWidget
Returns:
tab-index of given ScriptEditorWidget or -1 if this widget could not be found
QStringList ito::ScriptDockWidget::getModifiedFileNames ( bool  ignoreUnsavedFiles = false,
int  excludeIndex = -1 
) const

returns a list of filenames, which have been modified in this ScriptDockWidget

long description

Parameters:
ignoreUnsavedFilesif true, ignores scripts, which do not have any filename yet
exludeIndextab-index which should be ignored, set to -1 in order to consider every tab
Returns:
string list
int ito::ScriptDockWidget::getTabCount ( ) const [inline]

checks wether given tab-index is valid (true) or not (false)

RetVal ito::ScriptDockWidget::newScript ( )

creates new instance of ScriptEditorWidget and appends it to the tab-widget

Returns:
result of method appendEditor
See also:
appendEditor
RetVal ito::ScriptDockWidget::openScript ( QString  filename,
bool  silent = false 
)

opens a given filename as new tab in this ScriptDockWidget

Opens new ScriptEditorWidget, appends it to the tab widget and opens filename in the newly created instance.

Parameters:
silentif true, no warning about invalid filename or invalid file format is shown
Returns:
retOk if file has been opened, else retError
RetVal ito::ScriptDockWidget::openScript ( )

method to open an existing script which can be indicated by the user by a getOpenFileName-dialog.

the script is not directly opened by this method, but the signal openScriptRequest is emitted which invokes a slot in the scriptEditorOrganizer. Then the organizer can check, if that filename is already opened in another tab and activate it instead of opening a new editor.

Returns:
retOk, if filename has been chosen, else retError (also in case of user cancellation)
See also:
(see also) keywords (comma-separated)
void ito::ScriptDockWidget::openScriptRequest ( const QString &  filename,
ScriptDockWidget scriptDockWidget 
) [signal]

signal emitted if script with given filename should be opened in scriptDockWidget

void ito::ScriptDockWidget::pythonDebugCommand ( tPythonDbgCmd  cmd) [signal]

will be received by PythonThread, directly

void ito::ScriptDockWidget::pythonDebugFileRequest ( QString  filename) [signal]

will be received by scriptEditorOrganizer, in order to save all unsaved changes first

void ito::ScriptDockWidget::pythonInterruptExecution ( ) [signal]

will be received by PythonThread, directly

void ito::ScriptDockWidget::pythonRunFileRequest ( QString  filename) [signal]

will be received by scriptEditorOrganizer, in order to save all unsaved changes first

void ito::ScriptDockWidget::pythonRunSelection ( QString  selectionText) [signal]

will be received by consoleWidget, directly

void ito::ScriptDockWidget::removeAndDeleteScriptDockWidget ( ScriptDockWidget widget) [signal]

signal emitted if given ScriptDockWidget should be closed and removed by ScriptEditorOrganizer

ScriptEditorWidget * ito::ScriptDockWidget::removeEditor ( int  index)

removes ScriptEditorWidget at given tab position from tab-widget and returns its reference

removes widget, without deleting it (for drag&drop, (un)-docking...)

Parameters:
indextab index of editor, which should be removed
Returns:
instance to recently removed ScriptEditorWidget, NULL if index exceeds limits
RetVal ito::ScriptDockWidget::saveAllScripts ( bool  askFirst = true,
bool  ignoreNewScripts = false,
int  excludeIndex = -1 
)

tries to save all opened scripts in this ScriptDockWidget

First, all unsaved and modified scripts are indentified and listed. Then the user is asked for confirmation of saving these modified documents. Then these scripts will be saved, if desired.

Parameters:
askFirstif true, the user is asked for confirmation, else all scripts are silently saved
ignoreNewScriptsif true do not consider new scripts, which does not have any filename yet
excludeIndexignore tab with this index, set it to -1 in order to consider every tab (default: -1)
Returns:
retOk if all identified scripts could be saved, else retError
RetVal ito::ScriptDockWidget::saveTab ( int  index,
bool  forceSaveAs = false,
bool  askFirst = true 
) [protected]

saves tab

Parameters:
indextab-index of tab in question
forceSaveAstrue if script should be saved with new filename, else false
askFirsttrue if user must confirm that script will be saved
Returns:
retOk if script in tab could be successfully saved, else retError
void ito::ScriptDockWidget::scriptModificationChanged ( bool  changed) [private, slot]

slot connected to each ScriptEditorWidget instance. Invoked if any content in any script changed.

calls slot currentTabChanged with active tab index as parameter.

See also:
currentTabChanged
void ito::ScriptDockWidget::tabCloseRequested ( int  index) [private, slot]

slot invoked if close button of any tab of m_tab (QTabWidgetItom) has been pressed

tries to close the tab in question

Parameters:
indextab-index of tab in question
void ito::ScriptDockWidget::tabContextMenuEvent ( QContextMenuEvent *  event) [private, slot]

method is invoked, if a context menu is requested

checks if mouse click directly has been located at any tab and if yes actualizes the member m_actTabIndex.

void ito::ScriptDockWidget::undockScriptTab ( ScriptDockWidget widget,
int  index,
bool  undockToNewScriptWindow = false,
bool  closeDockIfEmpty = false 
) [signal]

signal emitted if tab with given index of given ScriptDockWidget should be undocked in an undocked ScriptDockWidget

void ito::ScriptDockWidget::updateEditorActions ( ) [private, slot]

updates actions which deal with editor commands

< todo


Member Data Documentation

member indicating the tab-index of the active script editor


The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends