-
Notifications
You must be signed in to change notification settings - Fork 1
/
api_commands.cpp
64 lines (54 loc) · 1.3 KB
/
api_commands.cpp
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
#include "api_commands.h"
QVariant ApiCommand::getReturnedData()
{
return data_;
}
void ApiCommand::setReturnedData(QVariant data)
{
data_ = data;
}
VolumeMuteCommand::VolumeMuteCommand(bool isMute)
: isMute_(isMute)
{
}
bool VolumeMuteCommand::execute(ApiController& apiController)
{
emit apiController.volumeSetIsMute(isMute_);
QString action;
if (isMute_)
action = "mute";
else
action = "unmute";
data_ = "Volume is " + action;
return true;
}
VolumeSetValueCommand::VolumeSetValueCommand(int value)
: value_(value)
{
}
bool VolumeSetValueCommand::execute(ApiController &apiController)
{
emit apiController.volumeSetValue(value_);
data_ = QString("Volume set to %1!").arg(value_);
return true;
}
VolumeTurnValueCommand::VolumeTurnValueCommand(bool isTurnUp, int value)
: isTurnUp_(isTurnUp), value_(value)
{
}
bool VolumeTurnValueCommand::execute(ApiController &apiController)
{
emit apiController.volumeTurnValue(isTurnUp_, value_);
data_ = QString("Volume turn up for %1!").arg(value_);
return true;
}
GetFileListCommand::GetFileListCommand()
{
}
bool GetFileListCommand::execute(ApiController &apiController)
{
QStringList filesList;
emit apiController.fsGetFilesList(filesList);
data_ = filesList;
return true;
}