summaryrefslogtreecommitdiff
path: root/display.h
blob: 2bb971ab2ecd72fe7dfce1ada312a0bd0e381fae (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*
 * GraphLCD plugin for the Video Disk Recorder
 *
 * display.h - display class
 *
 * This file is released under the GNU General Public License. Refer
 * to the COPYING file distributed with this package.
 *
 * (c) 2001-2004 Carsten Siebholz <c.siebholz AT t-online.de>
 * (c) 2004-2010 Andreas Regel <andreas.regel AT powarman.de>
 * (c) 2010-2011 Wolfgang Astleitner <mrwastl AT users sourceforge net>
 */

#ifndef _GRAPHLCD_DISPLAY_H_
#define _GRAPHLCD_DISPLAY_H_

#include <stdint.h>

#include <string>
#include <vector>
#include <map>

#include <glcdgraphics/bitmap.h>
#include <glcddrivers/driver.h>
#include <glcdskin/skin.h>

#include "global.h"
#include "setup.h"
#include "state.h"
#include "skinconfig.h"

#include "service.h"

#include <vdr/thread.h>


enum eThreadState
{
    StateNormal,
    StateReplay,
    StateMenu
};

// state of current display mode (interesting for displays w/ touchpads)
enum eDisplayMode
{
    DisplayModeNormal,
    DisplayModeInteractive
};

// Display update Thread
class cGraphLCDDisplay : public cThread
{
public:
    cGraphLCDDisplay(void);
    ~cGraphLCDDisplay(void);

    bool Initialise(GLCD::cDriver * Lcd, const std::string & CfgPath, const std::string & SkinsPath, const std::string & SkinName);
    void Tick();
    void Update();
    void Clear();
    void Replaying(bool Starting);
    void SetMenuClear();
    void SetMenuTitle();
    void SetMenuCurrent();
    const GLCD::cBitmap * GetScreen() const { return mScreen; }

    void ForceUpdateBrightness();

    const cGraphLCDService * GetServiceObject() const { return mService; }

    GLCD::cDriver * GetDriver() const { return mLcd; }
    GLCD::cSkin * GetSkin() const { return mSkin; }

    const eDisplayMode GetDisplayMode() const { return mDisplayMode; }
protected:
    virtual void Action();

private:
    GLCD::cDriver * mLcd;
    GLCD::cBitmap * mScreen;
    GLCD::cSkin * mSkin;
    cGraphLCDSkinConfig * mSkinConfig;

    bool mUpdate;
    uint64_t mUpdateAt;
    uint64_t mLastTimeMs;

    eThreadState mState;
    eThreadState mLastState;

    cMutex mMutex;
    cGraphLCDState * mGraphLCDState;

    bool mShowVolume;
    bool mShowAudio;

    void UpdateIn(uint64_t msec);

    /* set brightness depending on user activity */
    void SetBrightness();
    uint64_t LastTimeBrightness;
    int nCurrentBrightness;
    bool bBrightnessActive;
    /* external services */
    cGraphLCDService * mService;
    /* display mode (normal or interactive) */
    eDisplayMode mDisplayMode;
    uint64_t LastTimeDisplayMode;
};

#endif