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 <QLineEdit>
13#include <QMenu>
14#include <QPlainTextEdit>
15#include <QScrollBar>
16#include <QVBoxLayout>
17#include <QtMath>
18
19#include <score_plugin_js_export.h>
20#include <wobjectimpl.h>
21class QQmlEngine;
22class QJSEngine;
23namespace JS
24{
25
26struct ActionContext : public QObject
27{
28 W_OBJECT(ActionContext)
29public:
30 QString Menu = "Menu";
31
32 W_PROPERTY(QString, Menu READ Menu)
33};
34class SCORE_PLUGIN_JS_EXPORT PanelDelegate final
35 : public QObject
37{
38public:
40
41 QJSEngine& engine() noexcept;
42
43 void evaluate(const QString& txt);
44 void compute(const QString& txt, std::function<void(QVariant)> r);
45 QMenu* addMenu(QMenu* cur, QStringList names);
46 void importModule(const QString& path);
47
48private:
49 QWidget* widget() override;
50
51 const score::PanelStatus& defaultPanelStatus() const override;
52
53 QQmlEngine& m_engine;
54 QWidget* m_widget{};
55 QPlainTextEdit* m_edit{};
56 QLineEdit* m_lineEdit{};
57};
58
60{
61 SCORE_CONCRETE("6060a63c-26b1-4ec6-a468-27e72530ac69")
62
63 std::unique_ptr<score::PanelDelegate>
64 make(const score::GUIApplicationContext& ctx) override
65 {
66 return std::make_unique<PanelDelegate>(ctx);
67 }
68};
69}
Definition ConsolePanel.hpp:60
Definition ConsolePanel.hpp:37
Reimplement this interface to register new panels.
Definition PanelDelegateFactory.hpp:10
The PanelDelegate class.
Definition PanelDelegate.hpp:50
Definition ConsolePanel.hpp:27
Specializes ApplicationContext with the QMainWindow.
Definition GUIApplicationContext.hpp:15
The PanelStatus struct.
Definition PanelDelegate.hpp:24