28 #include "../include/Profiles.h"
37 bool read_file =
false;
54 QFile inputFile(path.c_str());
55 if (inputFile.open(QIODevice::ReadOnly))
57 QTextStream in(&inputFile);
60 QString line = in.readLine();
62 if (line.length() <= 0)
66 QStringList parts = line.split(
"=" );
67 string setting = parts[0].toStdString();
68 string value = parts[1].toStdString();
72 if (setting ==
"description")
74 else if (setting ==
"frame_rate_num") {
75 stringstream(value) >> value_int;
78 else if (setting ==
"frame_rate_den") {
79 stringstream(value) >> value_int;
82 else if (setting ==
"width") {
83 stringstream(value) >> value_int;
86 else if (setting ==
"height") {
87 stringstream(value) >> value_int;
90 else if (setting ==
"progressive") {
91 stringstream(value) >> value_int;
94 else if (setting ==
"sample_aspect_num") {
95 stringstream(value) >> value_int;
98 else if (setting ==
"sample_aspect_den") {
99 stringstream(value) >> value_int;
102 else if (setting ==
"display_aspect_num") {
103 stringstream(value) >> value_int;
106 else if (setting ==
"display_aspect_den") {
107 stringstream(value) >> value_int;
110 else if (setting ==
"colorspace") {
111 stringstream(value) >> value_int;
123 throw InvalidFile(
"Profile could not be found or loaded (or is invalid).", path);
129 throw InvalidFile(
"Profile could not be found or loaded (or is invalid).", path);
147 root[
"fps"] = Json::Value(Json::objectValue);
150 root[
"pixel_ratio"] = Json::Value(Json::objectValue);
153 root[
"display_ratio"] = Json::Value(Json::objectValue);
168 bool success = reader.parse( value, root );
171 throw InvalidJSON(
"JSON could not be parsed (or is invalid)",
"");
181 throw InvalidJSON(
"JSON is invalid (missing keys or invalid data types)",
"");
188 if (!root[
"height"].isNull())
190 if (!root[
"width"].isNull())
192 if (!root[
"pixel_format"].isNull())
194 if (!root[
"fps"].isNull()) {
198 if (!root[
"pixel_ratio"].isNull()) {
202 if (!root[
"display_ratio"].isNull()) {
206 if (!root[
"interlaced_frame"].isNull())