MythTV  master
mythsettings.cpp
Go to the documentation of this file.
1 // Qt
2 #include <QDomDocument>
3 #include <QFile>
4 #include <QNetworkInterface>
5 
6 // MythTV
7 #include "libmyth/mythcontext.h"
8 #include "libmythbase/mythdb.h"
9 #include "libmythtv/channelsettings.h" // for ChannelTVFormat::GetFormats()
10 #include "libmythtv/frequencies.h"
11 
12 // MythBackend
13 #include "mythsettings.h"
14 
16 MythSetting::DataType parse_data_type(const QString &str);
17 bool parse_dom(MythSettingList &settings, const QDomElement &element,
18  const QString &filename, const QString &group,
19  bool includeAllChildren, bool &foundGroup);
20 
21 static QString indent(uint level)
22 {
23  QString ret;
24  for (uint i = 0; i < level; i++)
25  ret += " ";
26  return ret;
27 }
28 
29 static QString extract_query_list(
30  const MythSettingList &settings, MythSetting::SettingType stype)
31 {
32  QString list;
33 
34  for (const auto *val : std::as_const(settings))
35  {
36  const auto *group = dynamic_cast<const MythSettingGroup*>(val);
37  if (group)
38  {
39  list += extract_query_list(group->m_settings, stype);
40  continue;
41  }
42  const auto *setting = dynamic_cast<const MythSetting*>(val);
43  if (setting && (setting->m_stype == stype))
44  list += QString(",'%1'").arg(setting->m_value);
45  }
46  if (!list.isEmpty() && (list[0] == QChar(',')))
47  list = list.mid(1);
48 
49  return list;
50 }
51 
52 static void fill_setting(
53  MythSettingBase *sb, const QMap<QString,QString> &map,
55 {
56  const auto *group = dynamic_cast<const MythSettingGroup*>(sb);
57  if (group)
58  {
59  for (auto *setting : std::as_const(group->m_settings))
60  fill_setting(setting, map, stype);
61  return;
62  }
63 
64  auto *setting = dynamic_cast<MythSetting*>(sb);
65  if (setting && (setting->m_stype == stype))
66  {
67  QMap<QString,QString>::const_iterator it = map.find(setting->m_value);
68  if (it != map.end())
69  setting->m_data = *it;
70 
71  bool do_option_check = false;
72  if (MythSetting::kLocalIPAddress == setting->m_dtype)
73  {
74  setting->m_data_list = GetSettingValueList("LocalIPAddress");
75  setting->m_display_list = setting->m_data_list;
76  do_option_check = true;
77  }
78  else if (MythSetting::kSelect == setting->m_dtype)
79  {
80  do_option_check = true;
81  }
82  else if (MythSetting::kTVFormat == setting->m_dtype)
83  {
84  setting->m_data_list = setting->m_display_list =
86  do_option_check = true;
87  }
88  else if (MythSetting::kFrequencyTable == setting->m_dtype)
89  {
90  setting->m_data_list.clear();
91  for (const auto &list : gChanLists)
92  setting->m_data_list.push_back(list.name);
93  setting->m_display_list = setting->m_data_list;
94  do_option_check = true;
95  }
96 
97  if (do_option_check)
98  {
99  if (!setting->m_data_list.empty() &&
100  !setting->m_data_list.contains(setting->m_data.toLower(),
101  Qt::CaseInsensitive))
102  {
103  bool ok = false;
104  long long idata = setting->m_data.toLongLong(&ok);
105  if (ok)
106  {
107  uint sel = 0;
108  for (int i = setting->m_data_list.size() - 1; i >= 0; i--)
109  {
110  if (idata < setting->m_data_list[i].toLongLong())
111  break;
112  sel = i;
113  }
114  setting->m_data = setting->m_data_list[sel];
115  }
116  else
117  {
118  setting->m_data =
119  (setting->m_data_list.contains(
120  setting->m_default_data, Qt::CaseInsensitive)) ?
121  setting->m_default_data : setting->m_data_list[0];
122  }
123  }
124  }
125  }
126 }
127 
128 static void fill_settings(
129  MythSettingList &settings, MSqlQuery &query, MythSetting::SettingType stype)
130 {
131  QMap<QString,QString> map;
132  while (query.next())
133  map[query.value(0).toString()] = query.value(1).toString();
134 
135  for (auto *setting : std::as_const(settings))
136  fill_setting(setting, map, stype);
137 }
138 
139 QString MythSettingGroup::ToHTML(uint depth) const
140 {
141  QString ret;
142 
143  ret = indent(depth) +
144  QString("<div class=\"group\" id=\"%1\">\r\n").arg(m_unique_label);
145  if (!m_human_label.isEmpty())
146  {
147  ret += indent(depth+1) + QString("<h%1 class=\"config\">%2</h%3>\r\n")
148  .arg(depth+1).arg(m_human_label).arg(depth+1);
149  }
150 
151  for (const auto *setting : std::as_const(m_settings))
152  ret += setting->ToHTML(depth+1);
153 
154  ret += indent(depth) +"</div>";
155 
156  return ret;
157 }
158 
159 QString MythSetting::ToHTML(uint level) const
160 {
161  QString ret = indent(level) +
162  QString("<div class=\"setting\" id=\"%1_div\">\r\n").arg(m_value);
163 
164  int size = 20;
165  switch (m_dtype)
166  {
167  case kFloat:
168  case kInteger:
169  case kIntegerRange:
170  case kUnsignedInteger:
171  case kTimeOfDay:
172  case kIPAddress:
173  size = 20;
174  break;
175  case kString:
176  size = 60;
177  break;
178  case kCheckBox:
179  case kSelect:
180  case kComboBox:
181  case kTVFormat:
182  case kFrequencyTable:
183  case kLocalIPAddress:
184  case kOther:
185  case kInvalidDataType:
186  break;
187  }
188 
189  switch (m_dtype)
190  {
191  case kInteger:
192  case kUnsignedInteger:
193  ret += indent(level) +
194  QString("<p class=\"setting_paragraph\"><label class=\"setting_label\" "
195  "for=\"%1\">%2</label>")
196  .arg(m_value, m_label);
197  ret += indent(level) +
198  QString("<input class=\"setting_input\" name=\"%1\" id=\"%1\" type=\"number\""
199  " value='%2' step='1' size='%3'/>\r\n")
200  .arg(m_value, m_data, QString::number(size));
201  ret += indent(level) +
202  QString("<a class=\"setting_helplink ui-icon ui-icon-help\" href=\"javascript:showSettingHelp('%1')"
203  "\"></a></label></p>\r\n").arg(m_value);
204  ret += indent(level) +
205  QString("<div class=\"form_error\""
206  "id=\"%1_error\"></div><div style=\"display:none;"
207  "position:absolute;left:-4000px\" "
208  "id=\"%1_default\">%2</div>\r\n")
209  .arg(m_value, m_default_data);
210  break;
211  case kIntegerRange:
212  ret += indent(level) +
213  QString("<p class=\"setting_paragraph\"><label class=\"setting_label\" "
214  "for=\"%1\">%2</label>")
215  .arg(m_value, m_label);
216  ret += indent(level) +
217  QString("<input class=\"setting_input\" name=\"%1\" id=\"%1\" type=\"number\""
218  " value='%2' min='%3' max='%4' step='1' size='%5'/>\r\n")
219  .arg(m_value, m_data).arg(m_range_min).arg(m_range_max).arg(size);
220  ret += indent(level) +
221  QString("<a class=\"setting_helplink ui-icon ui-icon-help\" href=\"javascript:showSettingHelp('%1')"
222  "\"></a></label></p>\r\n").arg(m_value);
223  ret += indent(level) +
224  QString("<div class=\"form_error\""
225  "id=\"%1_error\"></div><div style=\"display:none;"
226  "position:absolute;left:-4000px\" "
227  "id=\"%1_default\">%2</div>\r\n")
228  .arg(m_value, m_default_data);
229  break;
230  case kFloat:
231  case kComboBox:
232  case kIPAddress:
233  case kString:
234  case kTimeOfDay:
235  case kOther:
236  ret += indent(level) +
237  QString("<p class=\"setting_paragraph\"><label class=\"setting_label\" "
238  "for=\"%1\">%2</label>")
239  .arg(m_value, m_label);
240  ret += indent(level) +
241  QString("<input class=\"setting_input\" name=\"%1\" id=\"%1\" type=\"text\""
242  " value=\"%2\" size='%3' placeholder=\"%4\"/>\r\n")
243  .arg(m_value, m_data, QString::number(size), m_placeholder_text);
244  ret += indent(level) +
245  QString("<a class=\"setting_helplink ui-icon ui-icon-help\" href=\"javascript:showSettingHelp('%1')"
246  "\"></a></label></p>\r\n").arg(m_value);
247  ret += indent(level) +
248  QString("<div class=\"form_error\""
249  "id=\"%1_error\"></div><div style=\"display:none;"
250  "position:absolute;left:-4000px\" "
251  "id=\"%1_default\">%2</div>\r\n")
252  .arg(m_value, m_default_data);
253  break;
254  case kCheckBox:
255  ret += indent(level) +
256  QString("<p class=\"setting_paragraph\">"
257  "<input class=\"setting_input\" name=\"%1_input\" id=\"%1\" type=\"checkbox\""
258  " value=\"1\" %2/><label class=\"setting_label_checkbox\" for=\"%1\">%3</label>")
259  .arg(m_value, (m_data.toUInt()) ? "checked" : "", m_label);
260  ret += indent(level) +
261  QString("<a class=\"setting_helplink ui-icon ui-icon-help\" href=\"javascript:showSettingHelp('%1'"
262  ")\"></a></p><div class=\"form_error\""
263  " id=\"%1_error\"></div>").arg(m_value);
264  ret += indent(level) +
265  QString("<div style=\"display:none;"
266  "position:absolute;left:-4000px\" "
267  "id=\"%1_default\">%2</div>")
268  .arg(m_value, m_default_data);
269  break;
270  case kLocalIPAddress:
271  case kTVFormat:
272  case kFrequencyTable:
273  case kSelect:
274  ret += indent(level) +
275  QString("<p class=\"setting_paragraph\"><label class=\"setting_label\" "
276  "for=\"%1\">%2</label>")
277  .arg(m_value, m_label);
278  ret += indent(level) +
279  QString("<select class=\"setting_select\" name=\"%1_input\" id=\"%1\">\r\n")
280  .arg(m_value);
281  for (uint i = 0; (i < (uint)m_data_list.size()) &&
282  (i < (uint)m_display_list.size()); i++)
283  {
284  ret += indent(level+1) +
285  QString("<option value=\"%1\" %2>%3</option>\r\n")
286  .arg(m_data_list[i],
287  (m_data_list[i].toLower() == m_data.toLower()) ?
288  "selected" : "",
289  m_display_list[i]);
290  }
291  ret += indent(level) + "</select>" +
292  QString("<a class=\"setting_helplink ui-icon ui-icon-help\" href=\"javascript:showSettingHelp('%1')"
293  "\"></a></p>\r\n").arg(m_value);
294  ret += indent(level) +
295  QString("<div class=\"form_error\""
296  "id=\"%1_error\"></div><div style=\"display:none;"
297  "position:absolute;left:-4000px\" "
298  "id=\"%1_default\">%2</div>\r\n")
299  .arg(m_value, m_default_data);
300  break;
301  case kInvalidDataType:
302  break;
303  }
304 
305  ret += indent(level) + "</div>\r\n";
306 
307  return ret;
308 }
309 
311 {
312  QString s = str.toLower();
313  if (s=="file")
314  return MythSetting::kFile;
315  if (s=="host")
316  return MythSetting::kHost;
317  if (s=="global")
318  return MythSetting::kGlobal;
320 }
321 
323 {
324  QString s = str.toLower();
325  if (s == "integer")
326  return MythSetting::kInteger;
327  if (s == "unsigned")
329  if (s == "integer_range")
331  if (s == "checkbox")
332  return MythSetting::kCheckBox;
333  if (s == "select")
334  return MythSetting::kSelect;
335  if (s == "combobox")
336  return MythSetting::kComboBox;
337  if (s == "tvformat")
338  return MythSetting::kTVFormat;
339  if (s == "frequency_table")
341  if (s == "float")
342  return MythSetting::kFloat;
343  if (s == "ipaddress")
345  if (s == "localipaddress")
347  if (s == "string")
348  return MythSetting::kString;
349  if (s == "timeofday")
351  if (s == "other")
352  return MythSetting::kOther;
353  LOG(VB_GENERAL, LOG_ERR, QString("Unknown type: %1").arg(str));
355 }
356 
357 QMap<QString,QString> GetSettingsMap(const MythSettingList &settings,
358  const QString &hostname)
359 {
360  QMap<QString,QString> result;
361  MSqlQuery query(MSqlQuery::InitCon());
362 
363  QString list = extract_query_list(settings, MythSetting::kHost);
364  QString qstr =
365  "SELECT value, data "
366  "FROM settings "
367  "WHERE hostname = '" + hostname + "' AND "
368  " value in (" + list + ")";
369 
370  if (!list.isEmpty())
371  {
372  if (!query.exec(qstr))
373  {
374  MythDB::DBError("GetSettingsMap() 1", query);
375  return result;
376  }
377 
378  while (query.next())
379  result[query.value(0).toString()] = query.value(1).toString();
380  }
381 
382  list = extract_query_list(settings, MythSetting::kGlobal);
383  qstr =
384  "SELECT value, data "
385  "FROM settings "
386  "WHERE hostname IS NULL AND "
387  " value in (" + list + ")";
388 
389  if (!list.isEmpty())
390  {
391  if (!query.exec(qstr))
392  {
393  MythDB::DBError("GetSettingsMap() 2", query);
394  return result;
395  }
396 
397  while (query.next())
398  result[query.value(0).toString()] = query.value(1).toString();
399  }
400 
401  return result;
402 }
403 
404 QStringList GetSettingValueList(const QString &type)
405 {
406  QStringList sList;
407 
408  if (type == "LocalIPAddress")
409  {
410  QList<QHostAddress> list = QNetworkInterface::allAddresses();
411  for (const auto & addr : std::as_const(list))
412  {
413  if (addr.toString().contains(":"))
414  continue; // ignore IP6 addresses for now
415  sList << addr.toString();
416  }
417 
418  if (sList.isEmpty())
419  sList << "127.0.0.1";
420  }
421 
422  return sList;
423 }
424 
425 QString StringMapToJSON(const QMap<QString,QString> &map)
426 {
427  QString result;
428 
429  QMap<QString,QString>::const_iterator it = map.begin();
430  for (; it != map.end(); ++it)
431  {
432  if (result.isEmpty())
433  result += "{ ";
434  else
435  result += ", ";
436 
437  // FIXME, howto encode double quotes in JSON?
438  result += "\"" + it.key() + "\": \"" + it.value() + "\"";
439  }
440 
441  if (!result.isEmpty())
442  result += " }";
443  else
444  result = "{ }";
445 
446  return result;
447 }
448 
449 QString StringListToJSON(const QString &key,
450  const QStringList &sList)
451 {
452  QString result;
453 
454  for (const auto & item : std::as_const(sList))
455  {
456  if (result.isEmpty())
457  result += QString("{ \"%1\" : [ ").arg(key);
458  else
459  result += ", ";
460 
461  // FIXME, howto encode double quotes in JSON?
462  result += "\"" + item + "\"";
463  }
464 
465  if (!result.isEmpty())
466  result += " ] }";
467  else
468  result = "{ }";
469 
470  return result;
471 }
472 
473 bool parse_dom(MythSettingList &settings, const QDomElement &element,
474  const QString &filename, const QString &group,
475  bool includeAllChildren, bool &foundGroup)
476 {
477 #define LOC QString("parse_dom(%1@~%2), error: ") \
478  .arg(filename).arg(e.lineNumber())
479 
480  bool mFoundGroup = false;
481 
482  QDomNode n = element.firstChild();
483  while (!n.isNull())
484  {
485  const QDomElement e = n.toElement();
486  if (e.isNull())
487  {
488  n = n.nextSibling();
489  continue;
490  }
491 
492  if (e.tagName() == "group")
493  {
494  QString m_human_label = e.attribute("human_label");
495  QString m_unique_label = e.attribute("unique_label");
496  QString m_ecma_script = e.attribute("ecma_script");
497 
498  bool tmpFoundGroup = false;
499  bool tmpIncludeAllChildren = includeAllChildren;
500  if (group.isEmpty() || m_unique_label == group)
501  {
502  mFoundGroup = true;
503  tmpIncludeAllChildren = true;
504  }
505 
506  auto *g = new MythSettingGroup(
507  m_human_label, m_unique_label, m_ecma_script);
508 
509  if ((e.hasChildNodes()) &&
510  (!parse_dom(g->m_settings, e, filename, group, tmpIncludeAllChildren,
511  tmpFoundGroup)))
512  {
513  delete g;
514  return false;
515  }
516 
517  if (tmpFoundGroup || tmpIncludeAllChildren)
518  {
519  settings.push_back(g);
520  mFoundGroup = true;
521  }
522  else
523  {
524  delete g;
525  }
526 
527  }
528  else if (e.tagName() == "setting" && includeAllChildren)
529  {
530  QMap<QString,QString> m;
531  m["value"] = e.attribute("value");
532  m["setting_type"] = e.attribute("setting_type");
533  m["label"] = e.attribute("label");
534  m["help_text"] = e.attribute("help_text");
535  m["data_type"] = e.attribute("data_type");
536 
537  MythSetting::DataType dtype = parse_data_type(m["data_type"]);
538  if (MythSetting::kInvalidDataType == dtype)
539  {
540  LOG(VB_GENERAL, LOG_ERR, LOC +
541  "Setting has invalid or missing data_type attribute.");
542  return false;
543  }
544 
545  QStringList data_list;
546  QStringList display_list;
547  if ((MythSetting::kComboBox == dtype) ||
548  (MythSetting::kSelect == dtype))
549  {
550  if (!e.hasChildNodes())
551  {
552  LOG(VB_GENERAL, LOG_ERR, LOC +
553  "Setting missing selection items.");
554  return false;
555  }
556 
557  QDomNode n2 = e.firstChild();
558  while (!n2.isNull())
559  {
560  const QDomElement e2 = n2.toElement();
561  if (e2.tagName() != "option")
562  {
563  LOG(VB_GENERAL, LOG_ERR, LOC +
564  "Setting selection contains invalid tags.");
565  return false;
566  }
567  QString display = e2.attribute("display");
568  QString data = e2.attribute("data");
569  if (data.isEmpty())
570  {
571  LOG(VB_GENERAL, LOG_ERR, LOC +
572  "Setting selection item missing data.");
573  return false;
574  }
575  display = (display.isEmpty()) ? data : display;
576  data_list.push_back(data);
577  display_list.push_back(display);
578 
579  n2 = n2.nextSibling();
580  }
581  }
582 
583  if (MythSetting::kIntegerRange == dtype)
584  {
585  m["range_min"] = e.attribute("range_min");
586  m["range_max"] = e.attribute("range_max");
587  }
588 
589  QMap<QString,QString>::const_iterator it = m.cbegin();
590  for (; it != m.cend(); ++it)
591  {
592  if ((*it).isEmpty())
593  {
594  LOG(VB_GENERAL, LOG_ERR, LOC +
595  QString("Setting has invalid or missing %1 attribute")
596  .arg(it.key()));
597  return false;
598  }
599  }
600 
601  m["default_data"] = e.attribute("default_data");
602  m["placeholder_text"] = e.attribute("placeholder_text");
603 
605  parse_setting_type(m["setting_type"]);
607  {
608  LOG(VB_GENERAL, LOG_ERR, LOC +
609  "Setting has invalid setting_type attribute.");
610  return false;
611  }
612 
613  long long range_min = m["range_min"].toLongLong();
614  long long range_max = m["range_max"].toLongLong();
615  if (range_max < range_min)
616  {
617  LOG(VB_GENERAL, LOG_ERR, LOC +
618  "Setting has invalid range attributes");
619  return false;
620  }
621 
622  auto *s = new MythSetting(
623  m["value"], m["default_data"], stype,
624  m["label"], m["help_text"], dtype,
625  data_list, display_list, range_min, range_max,
626  m["placeholder_text"]);
627 
628  settings.push_back(s);
629  }
630  else if (group.isEmpty())
631  {
632  LOG(VB_GENERAL, LOG_ERR, LOC +
633  QString("Unknown element: %1").arg(e.tagName()));
634  return false;
635  }
636  n = n.nextSibling();
637  }
638 
639  if (mFoundGroup)
640  foundGroup = true;
641 
642  return true;
643 #undef LOC
644 }
645 
646 bool parse_settings(MythSettingList &settings, const QString &filename,
647  const QString &group)
648 {
649  QDomDocument doc;
650  QFile f(filename);
651 
652  if (!f.open(QIODevice::ReadOnly))
653  {
654  LOG(VB_GENERAL, LOG_ERR, QString("parse_settings: Can't open: '%1'")
655  .arg(filename));
656  return false;
657  }
658 
659 #if QT_VERSION < QT_VERSION_CHECK(6,5,0)
660  QString errorMsg;
661  int errorLine = 0;
662  int errorColumn = 0;
663 
664  if (!doc.setContent(&f, false, &errorMsg, &errorLine, &errorColumn))
665  {
666  LOG(VB_GENERAL, LOG_ERR, QString("parse_settings: ") +
667  QString("Parsing: %1 at line: %2 column: %3")
668  .arg(filename).arg(errorLine).arg(errorColumn) +
669  QString("\n\t\t\t%1").arg(errorMsg));
670  f.close();
671  return false;
672  }
673 #else
674  auto parseResult = doc.setContent(&f);
675  if (!parseResult)
676  {
677  LOG(VB_GENERAL, LOG_ERR, QString("parse_settings: ") +
678  QString("Parsing: %1 at line: %2 column: %3")
679  .arg(filename).arg(parseResult.errorLine)
680  .arg(parseResult.errorColumn) +
681  QString("\n\t\t\t%1").arg(parseResult.errorMessage));
682  f.close();
683  return false;
684  }
685 #endif
686  f.close();
687 
688  settings.clear();
689  bool foundGroup = false;
690  bool includeAllChildren = group.isEmpty();
691  return parse_dom(settings, doc.documentElement(), filename, group,
692  includeAllChildren, foundGroup);
693 }
694 
695 bool load_settings(MythSettingList &settings, const QString &hostname)
696 {
697  MSqlQuery query(MSqlQuery::InitCon());
698 
699  QString list = extract_query_list(settings, MythSetting::kHost);
700  QString qstr =
701  "SELECT value, data "
702  "FROM settings "
703  "WHERE hostname = '" + hostname + "' AND "
704  " value in (" + list + ")";
705 
706  if (!list.isEmpty())
707  {
708  if (!query.exec(qstr))
709  {
710  MythDB::DBError("HttpConfig::LoadMythSettings() 1", query);
711  return false;
712  }
713  fill_settings(settings, query, MythSetting::kHost);
714  }
715 
716  list = extract_query_list(settings, MythSetting::kGlobal);
717  qstr =
718  "SELECT value, data "
719  "FROM settings "
720  "WHERE hostname IS NULL AND "
721  " value in (" + list + ")";
722 
723  if (!list.isEmpty())
724  {
725  if (!query.exec(qstr))
726  {
727  MythDB::DBError("HttpConfig::LoadMythSettings() 2", query);
728  return false;
729  }
730  fill_settings(settings, query, MythSetting::kGlobal);
731  }
732 
733  return true;
734 }
735 
736 bool check_settings(MythSettingList &/*database_settings*/,
737  const QMap<QString,QString> &params,
738  QString &result)
739 {
740  QMap<QString,QString>::const_iterator it = params.begin();
741  for (; it != params.end(); ++it)
742  {
743  if (it.key().startsWith("__"))
744  continue;
745 
746  if (result.isEmpty())
747  result += "{ ";
748  else
749  result += ", ";
750 
751  result += QString(R"("%1": "DEBUG: New value for '%2' would be '%3'")")
752  .arg(it.key(), it.key(), *it);
753  }
754 
755  if (!result.isEmpty())
756  result += " }";
757 
758  // FIXME, do some actual validation here
759  return result.isEmpty();
760 }
MSqlQuery::next
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
Definition: mythdbcon.cpp:812
MSqlQuery
QSqlQuery wrapper that fetches a DB connection from the connection pool.
Definition: mythdbcon.h:127
LOC
#define LOC
mythdb.h
MythSetting::kComboBox
@ kComboBox
list where user input is allowed
Definition: mythsettings.h:55
MythSetting::kIPAddress
@ kIPAddress
Definition: mythsettings.h:59
load_settings
bool load_settings(MythSettingList &settings, const QString &hostname)
Definition: mythsettings.cpp:695
MythSetting::kInvalidDataType
@ kInvalidDataType
Definition: mythsettings.h:64
frequencies.h
MythSetting::kIntegerRange
@ kIntegerRange
Definition: mythsettings.h:52
MythSetting::m_placeholder_text
QString m_placeholder_text
Definition: mythsettings.h:128
parse_setting_type
MythSetting::SettingType parse_setting_type(const QString &str)
Definition: mythsettings.cpp:310
parse_settings
bool parse_settings(MythSettingList &settings, const QString &filename, const QString &group)
Definition: mythsettings.cpp:646
MSqlQuery::value
QVariant value(int i) const
Definition: mythdbcon.h:204
MythSetting::kInvalidSettingType
@ kInvalidSettingType
Definition: mythsettings.h:46
MSqlQuery::exec
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
Definition: mythdbcon.cpp:618
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:39
parse_data_type
MythSetting::DataType parse_data_type(const QString &str)
Definition: mythsettings.cpp:322
mythsettings.h
MythSetting::kUnsignedInteger
@ kUnsignedInteger
Definition: mythsettings.h:51
MythSetting::kLocalIPAddress
@ kLocalIPAddress
Definition: mythsettings.h:60
GetSettingValueList
QStringList GetSettingValueList(const QString &type)
Definition: mythsettings.cpp:404
MythSetting::ToHTML
QString ToHTML(uint level) const override
Definition: mythsettings.cpp:159
MythSetting::DataType
DataType
Definition: mythsettings.h:49
MythSetting::kHost
@ kHost
Definition: mythsettings.h:44
MythSetting::kSelect
@ kSelect
list where only data_list are valid
Definition: mythsettings.h:54
StringMapToJSON
QString StringMapToJSON(const QMap< QString, QString > &map)
Definition: mythsettings.cpp:425
MythSetting::kInteger
@ kInteger
Definition: mythsettings.h:50
MythSetting::m_display_list
QStringList m_display_list
Definition: mythsettings.h:125
MythSetting::kFloat
@ kFloat
Definition: mythsettings.h:58
MythSetting::kTimeOfDay
@ kTimeOfDay
Definition: mythsettings.h:62
MythSetting::kString
@ kString
Definition: mythsettings.h:61
MythSetting
Definition: mythsettings.h:39
MSqlQuery::InitCon
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
Definition: mythdbcon.cpp:550
MythSetting::m_value
QString m_value
Definition: mythsettings.h:117
MythDB::DBError
static void DBError(const QString &where, const MSqlQuery &query)
Definition: mythdb.cpp:225
MythSettingGroup
Definition: mythsettings.h:21
MythSetting::SettingType
SettingType
Definition: mythsettings.h:42
MythSetting::kGlobal
@ kGlobal
Definition: mythsettings.h:45
MythSetting::kFrequencyTable
@ kFrequencyTable
Definition: mythsettings.h:57
parse_dom
bool parse_dom(MythSettingList &settings, const QDomElement &element, const QString &filename, const QString &group, bool includeAllChildren, bool &foundGroup)
Definition: mythsettings.cpp:473
MythSettingGroup::m_unique_label
QString m_unique_label
div name for stylesheets & javascript
Definition: mythsettings.h:34
MythSettingGroup::ToHTML
QString ToHTML(uint depth) const override
Definition: mythsettings.cpp:139
MythSettingGroup::m_settings
MythSettingList m_settings
Definition: mythsettings.h:35
fill_settings
static void fill_settings(MythSettingList &settings, MSqlQuery &query, MythSetting::SettingType stype)
Definition: mythsettings.cpp:128
extract_query_list
static QString extract_query_list(const MythSettingList &settings, MythSetting::SettingType stype)
Definition: mythsettings.cpp:29
MythSetting::kOther
@ kOther
Definition: mythsettings.h:63
gChanLists
const CHANLISTS_vec gChanLists
Definition: frequencies.cpp:2215
MythSettingBase
Definition: mythsettings.h:12
check_settings
bool check_settings(MythSettingList &, const QMap< QString, QString > &params, QString &result)
Definition: mythsettings.cpp:736
MythSettingList
QList< MythSettingBase * > MythSettingList
Definition: mythsettings.h:19
MythSetting::kCheckBox
@ kCheckBox
Definition: mythsettings.h:53
MythSetting::m_range_min
long long m_range_min
Definition: mythsettings.h:126
channelsettings.h
mythcontext.h
MythSetting::m_default_data
QString m_default_data
Definition: mythsettings.h:119
MythSetting::m_dtype
DataType m_dtype
Definition: mythsettings.h:123
MythSetting::kTVFormat
@ kTVFormat
Definition: mythsettings.h:56
musicbrainzngs.caa.hostname
string hostname
Definition: caa.py:17
MythSettingGroup::m_human_label
QString m_human_label
Definition: mythsettings.h:33
MythSetting::m_label
QString m_label
Definition: mythsettings.h:121
GetSettingsMap
QMap< QString, QString > GetSettingsMap(const MythSettingList &settings, const QString &hostname)
Definition: mythsettings.cpp:357
indent
static QString indent(uint level)
Definition: mythsettings.cpp:21
build_compdb.filename
filename
Definition: build_compdb.py:21
ChannelTVFormat::GetFormats
static QStringList GetFormats(void)
Definition: channelsettings.cpp:177
MythSetting::m_range_max
long long m_range_max
Definition: mythsettings.h:127
StringListToJSON
QString StringListToJSON(const QString &key, const QStringList &sList)
Definition: mythsettings.cpp:449
MythSetting::m_data_list
QStringList m_data_list
Definition: mythsettings.h:124
MythSetting::kFile
@ kFile
Definition: mythsettings.h:43
uint
unsigned int uint
Definition: freesurround.h:24
MythSetting::m_data
QString m_data
Definition: mythsettings.h:118
fill_setting
static void fill_setting(MythSettingBase *sb, const QMap< QString, QString > &map, MythSetting::SettingType stype)
Definition: mythsettings.cpp:52