playback_dock.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 <core/std/memory.h>
  21. #include <QTimer>
  22. #include <core/context.h>
  23. #include <generic/context_listener.h>
  24. #include <generic/dock_registry.h>
  25. #include "close_destroy_dock.h"
  26. namespace Ui {
  27. class PlaybackDock;
  28. }
  29. namespace rainynite::studio {
  30. /**
  31. * Dock with playback controls
  32. */
  33. class PlaybackDock : public DockWidget, public ContextListener {
  34. Q_OBJECT
  35. public:
  36. explicit PlaybackDock(shared_ptr<EditorContext> context_, QWidget* parent = nullptr);
  37. ~PlaybackDock();
  38. protected:
  39. void time_changed(core::Time time) override;
  40. void fps_changed(core::Time::fps_type fps) override;
  41. private Q_SLOTS:
  42. void toggle_playback(bool play);
  43. void stop();
  44. void next_frame();
  45. void move_start();
  46. void move_end();
  47. void change_time();
  48. void change_fps();
  49. private:
  50. unique_ptr<Ui::PlaybackDock> ui;
  51. QTimer* timer;
  52. };
  53. REGISTER_DOCK("Playback", PlaybackDock, Qt::BottomDockWidgetArea);
  54. }
  55. #endif