Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef SCRIPTCONSOLE_H
Toshihiro Shimizu 890ddd
#define SCRIPTCONSOLE_H
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tcommon.h"
Toshihiro Shimizu 890ddd
#include <qtextedit></qtextedit>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class ScriptEngine;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#undef DVAPI
Toshihiro Shimizu 890ddd
#undef DVVAR
Toshihiro Shimizu 890ddd
#ifdef TOONZQT_EXPORTS
Toshihiro Shimizu 890ddd
#define DVAPI DV_EXPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_EXPORT_VAR
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
#define DVAPI DV_IMPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_IMPORT_VAR
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class DVAPI ScriptConsole final : public QTextEdit {
Shinya Kitaoka 120a6e
  Q_OBJECT
Shinya Kitaoka 120a6e
  ScriptEngine *m_engine;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  QList<qstring> m_commands;</qstring>
Shinya Kitaoka 120a6e
  int m_commandIndex;
Shinya Kitaoka 120a6e
  QString m_currentCommand;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  QString m_prompt;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  ScriptConsole(QWidget *parent = 0);
Shinya Kitaoka 120a6e
  ~ScriptConsole();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void executeCommand(const QString &cmd);
Shinya Kitaoka 120a6e
  ScriptEngine *getEngine() const { return m_engine; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 473e70
  void keyPressEvent(QKeyEvent *e) override;
Shinya Kitaoka 120a6e
  void onReturnKeyPress();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  bool canInsertFromMimeData(const QMimeData *source) const override;
Shinya Kitaoka 473e70
  void insertFromMimeData(const QMimeData *source) override;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public slots:
Shinya Kitaoka 120a6e
  void onEvaluationDone();
Shinya Kitaoka 120a6e
  void output(int, const QString &msg);
Shinya Kitaoka 120a6e
  void onCursorPositionChanged();
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
#endif  // SCRIPTCONSOLE_H