time_dock.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * time_dock.h - time 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__TIME_DOCK_H__476B54A4
  19. #define __STUDIO__TIME_DOCK_H__476B54A4
  20. #include <memory>
  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 TimeDock;
  27. }
  28. namespace studio {
  29. /**
  30. * Dock for displaying/editing time.
  31. *
  32. * TODO:
  33. * - separate time editing widget
  34. */
  35. class TimeDock : public DockWidget, public ContextListener {
  36. Q_OBJECT
  37. public:
  38. explicit TimeDock(std::shared_ptr<EditorContext> context_, QWidget* parent = nullptr);
  39. virtual ~TimeDock();
  40. protected:
  41. virtual void time_changed(core::Time time) override;
  42. virtual void fps_changed(core::Time::fps_type fps) override;
  43. protected Q_SLOTS:
  44. virtual void change_time();
  45. virtual void change_fps();
  46. protected:
  47. void set_time(core::Time time);
  48. private:
  49. std::unique_ptr<Ui::TimeDock> ui;
  50. };
  51. REGISTER_DOCK("Time", TimeDock, Qt::BottomDockWidgetArea);
  52. }
  53. #endif