Macro qtTrIdx() replaced by tr() and QT_TRANSLATE_NOOP()
[mafwsubrenderer] / qmafw-gst-subtitles-renderer / src / MafwBlankingPreventer.cpp
1 /*
2  * This file is part of QMAFW
3  *
4  * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). All rights
5  * reserved.
6  *
7  * Contact: Visa Smolander <visa.smolander@nokia.com>
8  *
9  * This software, including documentation, is protected by copyright controlled
10  * by Nokia Corporation. All rights are reserved. Copying, including
11  * reproducing, storing, adapting or translating, any or all of this material
12  * requires the prior written consent of Nokia Corporation. This material also
13  * contains confidential information which may not be disclosed to others
14  * without the prior written consent of Nokia.
15  *
16  */
17
18 #include "MafwBlankingPreventer.h"
19 #include <qmdisplaystate.h>
20 #include <QDebug>
21
22 /* Interval of recalling setBlankingPause in seconds */
23 const int BLANKING_TIMER_INTERVAL=45;
24
25 MafwBlankingPreventer::MafwBlankingPreventer(QObject* parent) : QObject(parent)
26 {
27     connect( &m_refreshTimer, SIGNAL(timeout()), this, SLOT(refresh()));
28     m_refreshTimer.setInterval( BLANKING_TIMER_INTERVAL*1000 );
29     m_display = new MeeGo::QmDisplayState(this);
30 }
31
32 void MafwBlankingPreventer::blankingProhibit()
33 {
34     qDebug() << "MafwBlankingPreventer::blankingProhibit";
35     refresh();
36     m_refreshTimer.start();
37 }
38
39 void MafwBlankingPreventer::blankingAllow()
40 {
41     qDebug() << "MafwBlankingPreventer::blankingAllow";
42     m_refreshTimer.stop();
43     m_display->cancelBlankingPause();
44 }
45
46 void MafwBlankingPreventer::refresh()
47 {
48     bool success = m_display->setBlankingPause();
49     qDebug() << "MafwBlankingPreventer::refresh success" << success;
50 }
51