lua_editor.h
Go to the documentation of this file.
1 #ifndef LUA_EDITOR_H
2 #define LUA_EDITOR_H
3 
4 #include <QtPlugin>
5 #include <QListWidgetItem>
6 #include <map>
11 
12 #include "QCodeEditor"
13 #include "QLuaHighlighter"
14 #include "QLuaCompleter"
15 
16 namespace Ui
17 {
18 class LuaEditor;
19 }
20 
22 {
23  Q_OBJECT
24  Q_PLUGIN_METADATA(IID "facontidavide.PlotJuggler3.Toolbox")
25  Q_INTERFACES(PJ::ToolboxPlugin)
26 
27 public:
29 
30  ~ToolboxLuaEditor() override;
31 
32  const char* name() const override;
33 
34  void init(PJ::PlotDataMapRef& src_data, PJ::TransformsMap& transform_map) override;
35 
36  std::pair<QWidget*, WidgetType> providedWidget() const override;
37 
38  bool xmlSaveState(QDomDocument& doc, QDomElement& parent_element) const override;
39 
40  bool xmlLoadState(const QDomElement& parent_element) override;
41 
42 public slots:
43 
44  bool onShowWidget() override;
45 
46  void onSave();
47 
48  void onDelete();
49 
50  void restoreRecent(const QModelIndex& index);
51 
52  void restoreFunction(const QModelIndex& index);
53 
54  void onLibraryUpdated();
55 
56  void onReloadLibrary();
57 
58 private:
59  QWidget* _widget;
60  Ui::LuaEditor* ui;
61 
64 
65  bool eventFilter(QObject* obj, QEvent* event) override;
66  QStringList _dragging_curves;
67 
69 
72 
74 
75  struct SavedData
76  {
77  QString name;
78  QString global_code;
79  QString function_code;
80  };
81 
82  SavedData getItemData(const QListWidgetItem* item) const;
83 
84  void setItemData(QListWidgetItem* item, QString name, QString global_code,
85  QString function_code);
86 };
87 
88 #endif // LUA_EDITOR_H
ToolboxLuaEditor::SavedData::global_code
QString global_code
Definition: lua_editor.h:78
ToolboxLuaEditor::ToolboxLuaEditor
ToolboxLuaEditor()
Definition: lua_editor.cpp:16
ToolboxLuaEditor::~ToolboxLuaEditor
~ToolboxLuaEditor() override
Definition: lua_editor.cpp:107
delayed_callback.hpp
ToolboxLuaEditor::_widget
QWidget * _widget
Definition: lua_editor.h:59
ToolboxLuaEditor::providedWidget
std::pair< QWidget *, WidgetType > providedWidget() const override
Definition: lua_editor.cpp:123
ToolboxLuaEditor::SavedData::name
QString name
Definition: lua_editor.h:77
ToolboxLuaEditor::onSave
void onSave()
Definition: lua_editor.cpp:251
ToolboxLuaEditor::_plot_data
PJ::PlotDataMapRef * _plot_data
Definition: lua_editor.h:62
ToolboxLuaEditor::restoreFunction
void restoreFunction(const QModelIndex &index)
Definition: lua_editor.cpp:362
ToolboxLuaEditor
Definition: lua_editor.h:21
QLuaCompleter
Class, that describes completer with glsl specific types and functions.
Definition: QLuaCompleter.hpp:10
ToolboxLuaEditor::name
const char * name() const override
Name of the plugin type, NOT the particular instance.
Definition: lua_editor.cpp:112
ToolboxLuaEditor::_delay_library_check
DelayedCallback _delay_library_check
Definition: lua_editor.h:71
PJ::TransformsMap
std::unordered_map< std::string, std::shared_ptr< TransformFunction > > TransformsMap
Definition: transform_function.h:85
ToolboxLuaEditor::onDelete
void onDelete()
Definition: lua_editor.cpp:342
ToolboxLuaEditor::xmlSaveState
bool xmlSaveState(QDomDocument &doc, QDomElement &parent_element) const override
Override this method to save the status of the plugin to XML.
Definition: lua_editor.cpp:128
plotwidget_base.h
reactive_function.h
Ui
Definition: cheatsheet_dialog.h:6
ToolboxLuaEditor::xmlLoadState
bool xmlLoadState(const QDomElement &parent_element) override
Override this method to load the status of the plugin from XML.
Definition: lua_editor.cpp:168
ToolboxLuaEditor::setItemData
void setItemData(QListWidgetItem *item, QString name, QString global_code, QString function_code)
Definition: lua_editor.cpp:529
ToolboxLuaEditor::init
void init(PJ::PlotDataMapRef &src_data, PJ::TransformsMap &transform_map) override
Definition: lua_editor.cpp:117
PJ::DelayedCallback
Definition: delayed_callback.hpp:17
ToolboxLuaEditor::ui
Ui::LuaEditor * ui
Definition: lua_editor.h:60
ToolboxLuaEditor::SavedData
Definition: lua_editor.h:75
ToolboxLuaEditor::eventFilter
bool eventFilter(QObject *obj, QEvent *event) override
Definition: lua_editor.cpp:435
ToolboxLuaEditor::SavedData::function_code
QString function_code
Definition: lua_editor.h:79
ToolboxLuaEditor::onLibraryUpdated
void onLibraryUpdated()
Definition: lua_editor.cpp:371
ToolboxLuaEditor::_previous_library
QString _previous_library
Definition: lua_editor.h:73
ToolboxLuaEditor::onReloadLibrary
void onReloadLibrary()
Definition: lua_editor.cpp:411
ToolboxLuaEditor::_font_size
int _font_size
Definition: lua_editor.h:70
PJ::ToolboxPlugin
Definition: toolbox_base.h:20
ToolboxLuaEditor::restoreRecent
void restoreRecent(const QModelIndex &index)
Definition: lua_editor.cpp:353
ToolboxLuaEditor::_transforms
PJ::TransformsMap * _transforms
Definition: lua_editor.h:63
ToolboxLuaEditor::_dragging_curves
QStringList _dragging_curves
Definition: lua_editor.h:66
PJ::PlotDataMapRef
Definition: plotdata.h:34
toolbox_base.h
ToolboxLuaEditor::_completer
QLuaCompleter * _completer
Definition: lua_editor.h:68
ToolboxLuaEditor::onShowWidget
bool onShowWidget() override
Definition: lua_editor.cpp:201
ToolboxLuaEditor::getItemData
SavedData getItemData(const QListWidgetItem *item) const
Definition: lua_editor.cpp:519


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:45