summaryrefslogtreecommitdiffstats
path: root/xbmc/pvr/dialogs/GUIDialogPVRGuideSearch.h
blob: 4d021676cd4e783b2ff51ded7ca5d0793376110d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
 *  Copyright (C) 2012-2018 Team Kodi
 *  This file is part of Kodi - https://kodi.tv
 *
 *  SPDX-License-Identifier: GPL-2.0-or-later
 *  See LICENSES/README.md for more information.
 */

#pragma once

#include "XBDateTime.h"
#include "guilib/GUIDialog.h"

#include <map>
#include <memory>
#include <string>

namespace PVR
{
  class CPVREpgSearchFilter;
  class CPVRChannelGroupMember;

  class CGUIDialogPVRGuideSearch : public CGUIDialog
  {
  public:
    CGUIDialogPVRGuideSearch();
    ~CGUIDialogPVRGuideSearch() override = default;
    bool OnMessage(CGUIMessage& message) override;
    void OnWindowLoaded() override;

    void SetFilterData(const std::shared_ptr<CPVREpgSearchFilter>& searchFilter);

    enum class Result
    {
      SEARCH,
      SAVE,
      CANCEL
    };
    Result GetResult() const { return m_result; }

  protected:
    void OnInitWindow() override;

  private:
    void UpdateSearchFilter();
    void UpdateChannelSpin();
    void UpdateGroupsSpin();
    void UpdateGenreSpin();
    void UpdateDurationSpin();
    CDateTime ReadDateTime(const std::string& strDate, const std::string& strTime) const;
    void Update();

    bool IsRadioSelected(int controlID);
    int GetSpinValue(int controlID);
    std::string GetEditValue(int controlID);

    Result m_result = Result::CANCEL;
    std::shared_ptr<CPVREpgSearchFilter> m_searchFilter;
    std::map<int, std::shared_ptr<CPVRChannelGroupMember>> m_channelsMap;

    CDateTime m_startDateTime;
    CDateTime m_endDateTime;
  };
}