-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
little fixes
- Loading branch information
Showing
8 changed files
with
72 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#include "jsonactionparser.h" | ||
|
||
JsonActionParser JsonActionParser::japInstance; | ||
|
||
JsonActionParser::JsonActionParser() | ||
{ | ||
|
||
} | ||
|
||
bool JsonActionParser::parseNewAction(QJsonObject jsonObject) | ||
{ | ||
Task task; | ||
if(jsonObject.value("Action").toString() == "Shutdown") task.mode = 'w'; | ||
else if(jsonObject.value("Action").toString() == "Reboot") task.mode = 'r'; | ||
else if(jsonObject.value("Action").toString() == "Sleep") task.mode = 'u'; | ||
else if(jsonObject.value("Action").toString() == "Hibernate") task.mode = 'h'; | ||
else if(jsonObject.value("Action").toString() == "Lock") task.mode = 'l'; | ||
else if(jsonObject.value("Action").toString() == "Block") task.mode = 'b'; | ||
else if(jsonObject.value("Action").toString() == "MonitorOff") task.mode = 'm'; | ||
else return false; | ||
|
||
if(jsonObject.value("TimeMode").toString() == "Now") | ||
{ | ||
switch(task.mode) | ||
{ | ||
case 'm': monitorOff(); break; | ||
default: return false; | ||
} | ||
return true; | ||
} | ||
else if(jsonObject.value("TimeMode").toString() == "Seconds") | ||
{ | ||
|
||
} | ||
else return false; | ||
|
||
return true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#pragma once | ||
#include "QJsonDocument" | ||
#include "QJsonObject" | ||
|
||
#include "Source/Main/functions.h" | ||
#include "Source/Main/structures.h" | ||
|
||
using namespace std; | ||
|
||
class JsonActionParser | ||
{ | ||
public: | ||
JsonActionParser(); | ||
static JsonActionParser *getInstance() { return &japInstance; } | ||
|
||
bool parseNewAction(QJsonObject jsonObject); | ||
|
||
private: | ||
static JsonActionParser japInstance; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters