Carousel
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Properties Pages
Public Slots | Signals | Public Member Functions | Properties | List of all members
IScriptConsole Class Referenceabstract

This abstract class provides methods for manipulatin with scripting console object. More...

#include <IScriptConsole.h>

Inherits QObject, and IOutputHandler.

Inherited by ScriptConsole.

Public Slots

virtual bool execCommand (const QString &command)=0
 
virtual QString nextCommand ()=0
 
virtual QString prevCommand ()=0
 

Signals

void aboutToExecute (const QString &command)
 
void error (const QString &error)
 
void printed (const QString &message)
 

Public Member Functions

 IScriptConsole ()
 
virtual const QStringListcommandHistory () const =0
 
virtual QScriptEngineengine ()=0
 
virtual int historyCapacity () const =0
 
virtual void setHistoryCapacity (int capacity)=0
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
 QObject (QObject *parent, const char *name)
 
bool blockSignals (bool block)
 
QObjectchild (const char *objName, const char *inheritsClass, bool recursiveSearch) const
 
const QObjectList & children () const
 
const char * className () const
 
bool connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const QObject *receiver, const char *method)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method)
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QByteArraydynamicPropertyNames () const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name) const
 
QList< T > findChildren (const QRegExp &regExp) const
 
QList< T > findChildren (const QString &name) const
 
bool inherits (const char *className) const
 
void insertChild (QObject *object)
 
void installEventFilter (QObject *filterObj)
 
bool isA (const char *className) const
 
bool isWidgetType () const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const
 
void moveToThread (QThread *targetThread)
 
const char * name () const
 
const char * name (const char *defaultName) const
 
QString objectName () const
 
QObjectparent () const
 
QVariant property (const char *name) const
 
void removeChild (QObject *object)
 
void removeEventFilter (QObject *obj)
 
void setName (const char *name)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval)
 
QThreadthread () const
 
- Public Member Functions inherited from IOutputHandler
 IOutputHandler ()
 
virtual void print (const QString &message)=0
 

Properties

QStringList commandHistory
 
int historyCapacity
 
- Properties inherited from QObject
 objectName
 

Additional Inherited Members

- Static Public Member Functions inherited from QObject
bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Protected Member Functions inherited from QObject
bool checkConnectArgs (const char *signal, const QObject *object, const char *method)
 
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const char *signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const char *signal)
 
int receivers (const char *signal) const
 
QObjectsender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 
- Static Protected Member Functions inherited from QObject
QByteArray normalizeSignalSlot (const char *signalSlot)
 

Detailed Description

This abstract class provides methods for manipulatin with scripting console object.

There are methods similiar to the just a console or terminal - execute command and command history. But this object does not pretend for visualizatoin, there is the ScriptConsoleView for this purpose.

Also, when this interface is implemented, an IOutputHandler one should be implemented too to be able to redirect print() functions to the console printed() signal.

You can get reference to the IScriptConsole using

* IScriptingService *service = serviceLocator->locate<IScriptingService>();
* IScriptConsole *console = service->console();
*
See Also
ScriptConsoleView

Constructor & Destructor Documentation

IScriptConsole::IScriptConsole ( )
inline

Initializes a new instance of the IScriptConsole class.

Member Function Documentation

virtual QScriptEngine* IScriptConsole::engine ( )
pure virtual

Gets an script engine, that executes commands. See IScriptExtension extension, if you want to extend script engine in more common way.

See Also
execCommand

Implemented in ScriptConsole.

virtual int IScriptConsole::historyCapacity ( ) const
pure virtual

Gets a maximum amount of commands, stored in the history collection. When current size reaches this amount, further execCommand() calls will remove oldest command from the history.

See Also
setHistoryCapacity, execCommand

Implemented in ScriptConsole.

virtual void IScriptConsole::setHistoryCapacity ( int  capacity)
pure virtual

Sets a maximum amount of commands, stored in the history collection.

See Also
historyCapacity, execCommand

Implemented in ScriptConsole.

virtual const QStringList& IScriptConsole::commandHistory ( ) const
pure virtual

Gets all executed commands on this console.

See Also
prevCommand, nextCommand

Implemented in ScriptConsole.

virtual bool IScriptConsole::execCommand ( const QString command)
pure virtualslot

Pushes command at the end of history, resetting history pointer (ponts to the last command) and tries to execute a command. Before executing the aboutToExecute() signal is emitted. If command was executed without errors, returns true. Otherwise, returns false and emits the error() signal.

If the number of executed commands exceeded the historyCapacity() value, then first command will be removed from the history.

virtual QString IScriptConsole::prevCommand ( )
pure virtualslot

Moves command pointer to the previous command and returns its value. If current command is the first one - returns it and does not move pointer.

See Also
nextCommand, commandHistory
virtual QString IScriptConsole::nextCommand ( )
pure virtualslot

Moves command pointer to the next command and returns its value. If current command is the last one - returns it and does not move pointer.

See Also
prevCommand, commandHistory
void IScriptConsole::aboutToExecute ( const QString command)
signal

This signal is emmited before a command will be evaluated. Connect to this signal if you want to echo commands, for example, into text edit.

void IScriptConsole::printed ( const QString message)
signal

This signal is emmited when the print() function is called from the script. Connect to this signal if you want to echo message, for example, into text edit.

void IScriptConsole::error ( const QString error)
signal

This signal is emmited when the error is appears during evaluate the script. Connect to this signal if you want to echo error, for example, into text edit.