ScriptInterface.hh 3.81 KB
Newer Older
Jan Möbius's avatar
 
Jan Möbius committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14
//=============================================================================
//
//                               OpenFlipper
//        Copyright (C) 2008 by Computer Graphics Group, RWTH Aachen
//                           www.openflipper.org
//
//-----------------------------------------------------------------------------
//
//                                License
//
//  OpenFlipper is free software: you can redistribute it and/or modify
//  it under the terms of the GNU Lesser General Public License as published by
//  the Free Software Foundation, either version 3 of the License, or
//  (at your option) any later version.
15
//
Jan Möbius's avatar
 
Jan Möbius committed
16 17 18 19
//  OpenFlipper is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU Lesser General Public License for more details.
20
//
Jan Möbius's avatar
 
Jan Möbius committed
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
//  You should have received a copy of the GNU Lesser General Public License
//  along with OpenFlipper.  If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
//
//   $Revision$
//   $Author$
//   $Date$
//
//=============================================================================




//
// C++ Interface: ScriptInterface
//
38
// Description:
Jan Möbius's avatar
 
Jan Möbius committed
39 40 41 42 43
//
//
// Author: Jan Moebius <jan_moebius@web.de>, (C) 2007
//

44 45
#ifndef SCRIPTINTERFACE_HH
#define SCRIPTINTERFACE_HH
Jan Möbius's avatar
 
Jan Möbius committed
46 47 48 49 50 51 52 53

#include <QtScript/QScriptEngine>

/** Interface for all Plugins which provide scriptable Functions.
 * These Functions should follow some guidelines :
 * -# Todo
*/
class ScriptInterface {
54

55 56 57 58
   public:
      /// Destructor
      virtual ~ScriptInterface() {};

Jan Möbius's avatar
 
Jan Möbius committed
59
  signals :
60

Jan Möbius's avatar
 
Jan Möbius committed
61
     /** \brief Emit this signal if a scriptable function is executed
62
       *
Jan Möbius's avatar
 
Jan Möbius committed
63
       * e.g. selectAllVertices( ObjectId )
64
       *
Jan Möbius's avatar
 
Jan Möbius committed
65 66
       * @param _functionName the called function
       */
Dirk Wilden's avatar
Dirk Wilden committed
67
    virtual void scriptInfo( QString /*_functionName*/  ) {};
68

Jan Möbius's avatar
 
Jan Möbius committed
69 70 71
    /** Emit this signal to execute a script
       * @param _script The script to execute
       */
Dirk Wilden's avatar
Dirk Wilden committed
72
    virtual void executeScript( QString /*_script*/  ) {};
73

Jan Möbius's avatar
 
Jan Möbius committed
74 75 76
    /** Emit this signal to get the core scripting engine
      * @param _engine The scripting Engine
      */
Dirk Wilden's avatar
Dirk Wilden committed
77
    virtual void getScriptingEngine( QScriptEngine*& /*_engine*/  ) {};
78

Jan Möbius's avatar
 
Jan Möbius committed
79 80 81
    /** With this signal you can get a list of all available scripting functions
     * @param _functions All available functions
     */
Dirk Wilden's avatar
Dirk Wilden committed
82
    virtual void getAvailableFunctions( QStringList& /*_functions*/  ) {};
83 84 85 86 87 88 89 90 91 92

    /** With this signal you can get descriptions about a given function if available
     *
     *   @param _function name of the function (e.g. plugin.function)
     *   @param _description a description for the function
     *   @param _parameters list of names for the parameters
     *   @param _descriptions list of descriptions for the parameters (_descriptions[i] corresponds to _parameters[i])
     */
    virtual void getDescription(QString /*_function*/, QString& /*_description*/,
                                QStringList& /*_parameters*/, QStringList& /*_descriptions*/  ) {};
93

Jan Möbius's avatar
 
Jan Möbius committed
94
  private slots:
95

Jan Möbius's avatar
 
Jan Möbius committed
96
    /** Slot for a scripting plugin. Gets the Script and executes it.
97
     *
Jan Möbius's avatar
 
Jan Möbius committed
98 99 100
     * @param _pluginName Name of the plugin that executed a scriptable function
     * @param _functionName Name of the executed function
     */
Dirk Wilden's avatar
Dirk Wilden committed
101
    virtual void slotScriptInfo( QString /*_pluginName*/ , QString /*_functionName*/  ) {};
102 103


Jan Möbius's avatar
 
Jan Möbius committed
104
    /** Slot for a scripting plugin. Gets the Script and executes it.
105
     *
Jan Möbius's avatar
 
Jan Möbius committed
106 107
     * @param _script Script to execute
     */
Dirk Wilden's avatar
Dirk Wilden committed
108
    virtual void slotExecuteScript( QString /*_script*/ ) {};
109 110


Jan Möbius's avatar
 
Jan Möbius committed
111 112
    /** Call this slot to open the given file and execute the script in it
     */
Dirk Wilden's avatar
Dirk Wilden committed
113
    virtual void slotExecuteFileScript( QString /*_filename*/ ) {};
114 115


Jan Möbius's avatar
 
Jan Möbius committed
116 117
};

118 119
Q_DECLARE_INTERFACE(ScriptInterface,"OpenFlipper.ScriptInterface/1.1")

Jan Möbius's avatar
 
Jan Möbius committed
120
#endif // SCRIPTINTERFACE_HH