Path: blob/devel/ElmerGUI/Application/vtkpost/ecmaconsole.h
3203 views
/*****************************************************************************1* *2* Elmer, A Finite Element Software for Multiphysical Problems *3* *4* Copyright 1st April 1995 - , CSC - IT Center for Science Ltd., Finland *5* *6* This program is free software; you can redistribute it and/or *7* modify it under the terms of the GNU General Public License *8* as published by the Free Software Foundation; either version 2 *9* of the License, or (at your option) any later version. *10* *11* This program is distributed in the hope that it will be useful, *12* but WITHOUT ANY WARRANTY; without even the implied warranty of *13* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *14* GNU General Public License for more details. *15* *16* You should have received a copy of the GNU General Public License *17* along with this program (in file fem/GPL-2); if not, write to the *18* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *19* Boston, MA 02110-1301, USA. *20* *21*****************************************************************************/2223/*****************************************************************************24* *25* ElmerGUI ecmaconsole *26* *27* Modified from the PythonQt console by Florian Link / MeVis Research *28* *29*****************************************************************************30* *31* Authors: Mikko Lyly, Juha Ruokolainen and Peter Råback *32* Email: [email protected] *33* Web: http://www.csc.fi/elmer *34* Address: CSC - IT Center for Science Ltd. *35* Keilaranta 14 *36* 02101 Espoo, Finland *37* *38* Original Date: 15 Mar 2008 *39* *40*****************************************************************************/4142#ifndef ECMACONSOLE_H43#define ECMACONSOLE_H4445#include <QTextEdit>46#include <QString>47#include <QStringList>48#include <QHash>4950#if WITH_QT651#include <QJSValue>52#endif5354class QWidget;55class QKeyEvent;56class QMouseEvent;57class QMetaObject;58class QCompleter;5960class EcmaConsole : public QTextEdit61{62Q_OBJECT6364public:65EcmaConsole(QWidget* parent = 0);66~EcmaConsole();67void clearHistory();68void addNames(QString, const QMetaObject*);69void initCompleter();7071#if WITH_QT672template<class... A> QJSValue print(A... args);73#endif7475public slots:76void keyPressEvent(QKeyEvent*);77void mousePressEvent(QMouseEvent*);78void mouseReleaseEvent(QMouseEvent*);79void mouseDoubleClickEvent(QMouseEvent*);80void insertCompletion(const QString&);8182signals:83void cmd(QString);8485private:86QString prompt;87int getPromptPos();88void execLine();89void scanHistory();90void handleTabCompletion();91int historyPtr;92QStringList history;93QHash<QString, QStringList> names;94QCompleter* completer;95};9697#endif9899100