playback.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /* dock/playback.h - playback controls dock
  2. * Copyright (C) 2017-2018 caryoscelus
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #ifndef STUDIO_DOCKS_PLAYBACK_H_107746CB_5F9B_5080_B6C1_A0670622A8FE
  18. #define STUDIO_DOCKS_PLAYBACK_H_107746CB_5F9B_5080_B6C1_A0670622A8FE
  19. #include <core/std/memory.h>
  20. #include <QTimer>
  21. #include <core/context.h>
  22. #include <generic/context_listener.h>
  23. #include <generic/dock_registry.h>
  24. #include "close_destroy_dock.h"
  25. namespace Ui {
  26. class PlaybackDock;
  27. }
  28. namespace rainynite::studio {
  29. /**
  30. * Dock with playback controls
  31. */
  32. class PlaybackDock : public DockWidget, public ContextListener {
  33. Q_OBJECT
  34. public:
  35. explicit PlaybackDock(shared_ptr<EditorContext> context_, QWidget* parent = nullptr);
  36. ~PlaybackDock();
  37. protected:
  38. void time_changed(core::Time time) override;
  39. void fps_changed(core::Time::fps_type fps) override;
  40. private Q_SLOTS:
  41. void toggle_playback(bool play);
  42. void stop();
  43. void next_frame();
  44. void move_start();
  45. void move_end();
  46. void change_time();
  47. void change_fps();
  48. private:
  49. unique_ptr<Ui::PlaybackDock> ui;
  50. QTimer* timer;
  51. bool is_looping = false;
  52. };
  53. REGISTER_CONTEXT_DOCK("Playback", PlaybackDock, Qt::BottomDockWidgetArea);
  54. } // namespace rainynite::studio
  55. #endif