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>
21 class QQmlEngine;
22 class QJSEngine;
23 namespace JS
24 {
25 
26 struct ActionContext : public QObject
27 {
28  W_OBJECT(ActionContext)
29 public:
30  QString Menu = "Menu";
31 
32  W_PROPERTY(QString, Menu READ Menu)
33 };
34 class SCORE_PLUGIN_JS_EXPORT PanelDelegate final
35  : public QObject
36  , public score::PanelDelegate
37 {
38 public:
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 
48 private:
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:59
Definition: ConsolePanel.hpp:36
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