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