Loading...
Searching...
No Matches
ConsolePanel.hpp
1#pragma once
2
3#include <score/actions/ActionManager.hpp>
4#include <score/actions/MenuManager.hpp>
5#include <score/application/GUIApplicationContext.hpp>
6#include <score/command/Dispatchers/MultiOngoingCommandDispatcher.hpp>
7#include <score/plugins/panel/PanelDelegate.hpp>
8#include <score/plugins/panel/PanelDelegateFactory.hpp>
9
10#include <core/application/ApplicationSettings.hpp>
11
12#include <QMenu>
13#include <QPlainTextEdit>
14#include <QScrollBar>
15#include <QVBoxLayout>
16#include <QtMath>
17
18#include <score_plugin_js_export.h>
19#include <wobjectimpl.h>
20namespace score
21{
22class PromptLineEdit;
23}
24class QQmlEngine;
25class QJSEngine;
26namespace JS
27{
28
29struct ActionContext : public QObject
30{
31 W_OBJECT(ActionContext)
32public:
33 QString Menu = "Menu";
34
35 W_PROPERTY(QString, Menu READ Menu)
36};
37class SCORE_PLUGIN_JS_EXPORT PanelDelegate final
38 : public QObject
40{
41public:
43
44 QJSEngine& engine() noexcept;
45
46 void evaluate(const QString& txt);
47 void compute(const QString& txt, std::function<void(QVariant)> r);
48 QMenu* addMenu(QMenu* cur, QStringList names);
49 void importModule(const QString& path);
50
51private:
52 QWidget* widget() override;
53
54 const score::PanelStatus& defaultPanelStatus() const override;
55
56 QQmlEngine& m_engine;
57 QWidget* m_widget{};
58 QPlainTextEdit* m_edit{};
59 score::PromptLineEdit* m_lineEdit{};
60};
61
63{
64 SCORE_CONCRETE("6060a63c-26b1-4ec6-a468-27e72530ac69")
65
66 std::unique_ptr<score::PanelDelegate>
67 make(const score::GUIApplicationContext& ctx) override
68 {
69 return std::make_unique<PanelDelegate>(ctx);
70 }
71};
72}
Definition ConsolePanel.hpp:63
Definition ConsolePanel.hpp:40
Reimplement this interface to register new panels.
Definition PanelDelegateFactory.hpp:10
The PanelDelegate class.
Definition PanelDelegate.hpp:50
PromptLineEdit - A QLineEdit with readline-like features.
Definition PromptLineEdit.hpp:26
Base toolkit upon which the software is built.
Definition Application.cpp:97
Definition ConsolePanel.hpp:30
Specializes ApplicationContext with the QMainWindow.
Definition GUIApplicationContext.hpp:15
The PanelStatus struct.
Definition PanelDelegate.hpp:24