LeechCraft
0.6.70-18450-gabe19ee3b0
Modular cross-platform feature rich live environment.
Toggle main menu visibility
Loading...
Searching...
No Matches
screensaverprohibitor.cpp
Go to the documentation of this file.
1
/**********************************************************************
2
* LeechCraft - modular cross-platform feature rich internet client.
3
* Copyright (C) 2006-2014 Georg Rudoy
4
*
5
* Distributed under the Boost Software License, Version 1.0.
6
* (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7
**********************************************************************/
8
9
#include "
screensaverprohibitor.h
"
10
#include <QUuid>
11
#include <
interfaces/core/ientitymanager.h
>
12
#include "
util.h
"
13
14
namespace
LC::Util
15
{
16
ScreensaverProhibitor::ScreensaverProhibitor
(
IEntityManager
*iem)
17
: IEM_ { iem }
18
, ContextID_ { QUuid::createUuid ().
toString
() }
19
{
20
}
21
22
ScreensaverProhibitor::~ScreensaverProhibitor
()
23
{
24
SetProhibited
(
false
);
25
}
26
27
void
ScreensaverProhibitor::SetProhibited
(
bool
prohibited)
28
{
29
if
(Prohibited_ == prohibited)
30
return
;
31
32
Prohibited_ = prohibited;
33
34
if
(Enabled_)
35
SendEntity (Prohibited_);
36
}
37
38
void
ScreensaverProhibitor::SetProhibitionsEnabled
(
bool
enabled)
39
{
40
if
(Enabled_ == enabled)
41
return
;
42
43
Enabled_ = enabled;
44
45
if
(Prohibited_)
46
SendEntity (Enabled_);
47
}
48
49
void
ScreensaverProhibitor::SendEntity (
bool
prohibit)
50
{
51
auto
e =
MakeEntity
(
"ScreensaverProhibition"
, {}, {}, QStringLiteral (
"x-leechcraft/power-management"
));
52
e.
Additional_
= {
53
{ QStringLiteral (
"Enable"
), prohibit },
54
{ QStringLiteral (
"ContextID"
), ContextID_ }
55
};
56
IEM_->HandleEntity (e);
57
}
58
}
IEntityManager
Proxy to core entity manager.
Definition
ientitymanager.h:32
LC::Util::ScreensaverProhibitor::~ScreensaverProhibitor
~ScreensaverProhibitor()
Definition
screensaverprohibitor.cpp:22
LC::Util::ScreensaverProhibitor::ScreensaverProhibitor
ScreensaverProhibitor(IEntityManager *)
Definition
screensaverprohibitor.cpp:16
LC::Util::ScreensaverProhibitor::SetProhibited
void SetProhibited(bool)
Definition
screensaverprohibitor.cpp:27
LC::Util::ScreensaverProhibitor::SetProhibitionsEnabled
void SetProhibitionsEnabled(bool)
Definition
screensaverprohibitor.cpp:38
toString
char * toString(const char *name, const T &t)
Definition
common.h:38
ientitymanager.h
LC::Util
Definition
icoreproxy.h:34
LC::Util::MakeEntity
Entity MakeEntity(const QVariant &entity, const QString &location, TaskParameters tp, const QString &mime)
Definition
util.cpp:82
screensaverprohibitor.h
LC::Entity::Additional_
QMap< QString, QVariant > Additional_
Additional parameters.
Definition
structures.h:165
util.h
src
util
xpc
screensaverprohibitor.cpp
Generated by
1.17.0