node_edit_dock.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * node_edit_dock.h - simple text editing of selecting node
  3. * Copyright (C) 2017 caryoscelus
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef __STUDIO__NODE_EDIT_DOCK_H__49AA85D4
  19. #define __STUDIO__NODE_EDIT_DOCK_H__49AA85D4
  20. #include <memory>
  21. #include <QDockWidget>
  22. #include <core/context.h>
  23. #include <generic/context_listener.h>
  24. namespace Ui {
  25. class NodeEditDock;
  26. }
  27. namespace studio {
  28. /**
  29. * Dock for simple text node editing
  30. */
  31. class NodeEditDock : public QDockWidget, public ContextListener {
  32. Q_OBJECT
  33. public:
  34. explicit NodeEditDock(std::shared_ptr<core::Context> context_, QWidget* parent = 0);
  35. ~NodeEditDock();
  36. public:
  37. virtual void active_node_changed(std::shared_ptr<core::AbstractValue> node) override;
  38. protected:
  39. virtual void closeEvent(QCloseEvent* event) override;
  40. private Q_SLOTS:
  41. void write_node();
  42. private:
  43. void setup_custom_widget(std::shared_ptr<core::AbstractValue> node);
  44. private:
  45. std::unique_ptr<Ui::NodeEditDock> ui;
  46. QWidget* custom_widget;
  47. std::shared_ptr<core::AbstractValue> active_node;
  48. };
  49. }
  50. #endif