time_dock.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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 <QDockWidget>
  22. #include <core/context.h>
  23. #include <generic/context_listener.h>
  24. namespace Ui {
  25. class TimeDock;
  26. }
  27. namespace studio {
  28. /**
  29. * Dock for displaying/editing time.
  30. *
  31. * TODO:
  32. * - separate time editing widget
  33. * - time line
  34. */
  35. class TimeDock : public QDockWidget, public ContextListener {
  36. Q_OBJECT
  37. public:
  38. explicit TimeDock(std::shared_ptr<EditorContext> context_, QWidget* parent = 0);
  39. ~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:
  44. virtual void closeEvent(QCloseEvent* event) override;
  45. protected Q_SLOTS:
  46. virtual void change_time();
  47. virtual void change_fps();
  48. protected:
  49. void set_time(core::Time time);
  50. private:
  51. std::unique_ptr<Ui::TimeDock> ui;
  52. struct Null {};
  53. std::shared_ptr<Null> destroy_detector;
  54. };
  55. }
  56. #endif