Merge pull request #25945 from CrystalP/fix-extras
[xbmc.git] / xbmc / video / PlayerController.h
blob37e3d08d8f48520dbc862894bec22d8d5549d396
1 /*
2 * Copyright (C) 2012-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #pragma once
11 #include "guilib/ISliderCallback.h"
12 #include "input/actions/interfaces/IActionListener.h"
13 #include "utils/MovingSpeed.h"
15 /*! \brief Player controller class to handle user actions.
17 Handles actions that are normally suited to fullscreen playback, such as
18 altering subtitles and audio tracks, changing aspect ratio, subtitle placement,
19 and placement of the video on screen.
21 class CPlayerController : public ISliderCallback, public KODI::ACTION::IActionListener
23 public:
24 static CPlayerController& GetInstance();
26 /*! \brief Perform a player control action if appropriate.
27 \param action the action to perform.
28 \return true if the action is considered handled, false if it should be handled elsewhere.
30 bool OnAction(const CAction &action) override;
32 /*! \brief Callback from the slider dialog.
33 \sa CGUIDialogSlider
35 void OnSliderChange(void *data, CGUISliderControl *slider) override;
37 protected:
38 CPlayerController();
39 CPlayerController(const CPlayerController&) = delete;
40 CPlayerController& operator=(CPlayerController const&) = delete;
41 ~CPlayerController() override;
43 private:
44 /*! \brief pop up a slider dialog for a particular action
45 \param action id of the action the slider responds to
46 \param label id of the label to display
47 \param value value to set on the slider
48 \param min minimum value the slider may take
49 \param delta change value to advance the slider by with each click
50 \param max maximal value the slider may take
51 \param modal true if we should wait for the slider to finish. Defaults to false
53 void ShowSlider(int action, int label, float value, float min, float delta, float max, bool modal = false);
55 int m_sliderAction = 0; ///< \brief set to the action id for a slider being displayed \sa ShowSlider
56 KODI::UTILS::MOVING_SPEED::CMovingSpeed m_movingSpeed;