| 1 |
/**************************************************************************** |
| 2 |
|
| 3 |
This file is part of the wolfenqt project on http://qt.gitorious.org. |
| 4 |
|
| 5 |
Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).* |
| 6 |
All rights reserved. |
| 7 |
|
| 8 |
Contact: Nokia Corporation (qt-info@nokia.com)** |
| 9 |
|
| 10 |
You may use this file under the terms of the BSD license as follows: |
| 11 |
|
| 12 |
"Redistribution and use in source and binary forms, with or without |
| 13 |
modification, are permitted provided that the following conditions are met: |
| 14 |
* Redistributions of source code must retain the above copyright notice, |
| 15 |
* this list of conditions and the following disclaimer. |
| 16 |
* Redistributions in binary form must reproduce the above copyright notice, |
| 17 |
* this list of conditions and the following disclaimer in the documentation |
| 18 |
* and/or other materials provided with the distribution. |
| 19 |
* Neither the name of Nokia Corporation and its Subsidiary(-ies) nor the |
| 20 |
* names of its contributors may be used to endorse or promote products |
| 21 |
* derived from this software without specific prior written permission. |
| 22 |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 23 |
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 24 |
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 25 |
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
| 26 |
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 27 |
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 28 |
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 29 |
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 30 |
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 31 |
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 32 |
POSSIBILITY OF SUCH DAMAGE." |
| 33 |
|
| 34 |
****************************************************************************/ |
| 35 |
#ifndef SCRIPTWIDGET_H |
| 36 |
#define SCRIPTWIDGET_H |
| 37 |
|
| 38 |
#include <QScriptEngine> |
| 39 |
#include <QtGui> |
| 40 |
|
| 41 |
class MazeScene; |
| 42 |
class Entity; |
| 43 |
|
| 44 |
class ScriptWidget : public QWidget |
| 45 |
{ |
| 46 |
Q_OBJECT |
| 47 |
public: |
| 48 |
ScriptWidget(MazeScene *scene, Entity *entity); |
| 49 |
|
| 50 |
public slots: |
| 51 |
void display(QScriptValue value); |
| 52 |
|
| 53 |
private slots: |
| 54 |
void updateSource(); |
| 55 |
void setPreset(int preset); |
| 56 |
|
| 57 |
protected: |
| 58 |
void timerEvent(QTimerEvent *event); |
| 59 |
|
| 60 |
private: |
| 61 |
MazeScene *m_scene; |
| 62 |
Entity *m_entity; |
| 63 |
QScriptEngine *m_engine; |
| 64 |
QPlainTextEdit *m_sourceEdit; |
| 65 |
QLineEdit *m_statusView; |
| 66 |
QString m_source; |
| 67 |
QTime m_time; |
| 68 |
}; |
| 69 |
|
| 70 |
#endif |