playback_dock.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * playback_dock.h - playback controls dock
  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__PLAYBACK_DOCK_H__AFB5B1D6
  19. #define __STUDIO__PLAYBACK_DOCK_H__AFB5B1D6
  20. #include <memory>
  21. #include <QDockWidget>
  22. #include <QTimer>
  23. #include <core/context.h>
  24. #include <generic/context_listener.h>
  25. namespace Ui {
  26. class PlaybackDock;
  27. }
  28. namespace studio {
  29. /**
  30. * Dock with playback controls
  31. */
  32. class PlaybackDock : public QDockWidget, public ContextListener {
  33. Q_OBJECT
  34. public:
  35. explicit PlaybackDock(std::shared_ptr<EditorContext> context_, QWidget* parent = 0);
  36. ~PlaybackDock();
  37. public:
  38. virtual void set_context(std::shared_ptr<EditorContext> context_) override;
  39. protected:
  40. virtual void closeEvent(QCloseEvent* event) override;
  41. private Q_SLOTS:
  42. void toggle_playback(bool play);
  43. void next_frame();
  44. void move_start();
  45. void move_end();
  46. private:
  47. std::unique_ptr<Ui::PlaybackDock> ui;
  48. QTimer* timer;
  49. };
  50. }
  51. #endif