MythTV  master
statusbox.cpp
Go to the documentation of this file.
1 
2 #include "statusbox.h"
3 
4 #include <QRegExp>
5 #include <QHostAddress>
6 #include <QNetworkInterface>
7 
8 #include "mythcorecontext.h"
9 #include "filesysteminfo.h"
10 #include "mythmiscutil.h"
11 #include "mythdb.h"
12 #include "mythlogging.h"
13 #include "mythversion.h"
14 #include "mythdate.h"
15 
16 #include "config.h"
17 #include "remoteutil.h"
18 #include "tv.h"
19 #include "jobqueue.h"
20 #include "cardutil.h"
21 #include "recordinginfo.h"
22 
23 #include "mythmiscutil.h"
24 #include "mythuihelper.h"
25 #include "mythuibuttonlist.h"
26 #include "mythuitext.h"
27 #include "mythuistatetype.h"
28 #include "mythdialogbox.h"
29 #include "mythrender_base.h"
31 #include "mythdisplay.h"
33 
34 struct LogLine {
35  QString m_line;
36  QString m_detail;
37  QString m_help;
38  QString m_helpdetail;
39  QString m_data;
40  QString m_state;
41 };
42 
43 void StatusBoxItem::Start(int Interval)
44 {
45  connect(this, &QTimer::timeout, [=]() { emit UpdateRequired(this); });
46  start(Interval * 1000);
47 }
48 
59  : MythScreenType(parent, "StatusBox")
60 {
61  m_minLevel = gCoreContext->GetNumSetting("LogDefaultView",5);
62 
63  QStringList strlist;
64  strlist << "QUERY_IS_ACTIVE_BACKEND";
65  strlist << gCoreContext->GetHostName();
66 
68 
69  m_isBackendActive = (strlist[0] == "TRUE");
70  m_popupStack = GetMythMainWindow()->GetStack("popup stack");
71 }
72 
74 {
75  if (m_logList)
76  gCoreContext->SaveSetting("StatusBoxItemCurrent",
78 }
79 
81 {
82  if (!LoadWindowFromXML("status-ui.xml", "status", this))
83  return false;
84 
85  m_categoryList = dynamic_cast<MythUIButtonList *>(GetChild("category"));
86  m_logList = dynamic_cast<MythUIButtonList *>(GetChild("log"));
87 
88  m_iconState = dynamic_cast<MythUIStateType *>(GetChild("icon"));
89  m_helpText = dynamic_cast<MythUIText *>(GetChild("helptext"));
90  m_justHelpText = dynamic_cast<MythUIText *>(GetChild("justhelptext"));
91 
93  {
94  LOG(VB_GENERAL, LOG_ERR, "StatusBox, theme is missing "
95  "required elements");
96  return false;
97  }
98 
100  this, &StatusBox::updateLogList);
102  this, &StatusBox::setHelpText);
104  this, &StatusBox::clicked);
105 
106  BuildFocusList();
107  return true;
108 }
109 
111 {
112  auto *item = new MythUIButtonListItem(m_categoryList, tr("Listings Status"),
114  item->DisplayState("listings", "icon");
115 
116  item = new MythUIButtonListItem(m_categoryList, tr("Schedule Status"),
118  item->DisplayState("schedule", "icon");
119 
120  item = new MythUIButtonListItem(m_categoryList, tr("Input Status"),
122  item->DisplayState("tuner", "icon");
123 
124  item = new MythUIButtonListItem(m_categoryList, tr("Job Queue"),
126  item->DisplayState("jobqueue", "icon");
127 
128  item = new MythUIButtonListItem(m_categoryList, tr("Video decoders"),
130  item->DisplayState("decoders", "icon");
131 
132  item = new MythUIButtonListItem(m_categoryList, tr("Display"),
134  item->DisplayState("display", "icon");
135 
136  item = new MythUIButtonListItem(m_categoryList, tr("Machine Status"),
138  item->DisplayState("machine", "icon");
139 
140  item = new MythUIButtonListItem(m_categoryList, tr("AutoExpire List"),
141  qOverload<>(&StatusBox::doAutoExpireList));
142  item->DisplayState("autoexpire", "icon");
143 
144  int itemCurrent = gCoreContext->GetNumSetting("StatusBoxItemCurrent", 0);
145  m_categoryList->SetItemCurrent(itemCurrent);
146 }
147 
148 StatusBoxItem *StatusBox::AddLogLine(const QString & line,
149  const QString & help,
150  const QString & detail,
151  const QString & helpdetail,
152  const QString & state,
153  const QString & data)
154 {
155  LogLine logline;
156  logline.m_line = line;
157 
158  if (detail.isEmpty())
159  logline.m_detail = line;
160  else
161  logline.m_detail = detail;
162 
163  if (help.isEmpty())
164  logline.m_help = logline.m_detail;
165  else
166  logline.m_help = help;
167 
168  if (helpdetail.isEmpty())
169  logline.m_helpdetail = logline.m_detail;
170  else
171  logline.m_helpdetail = helpdetail;
172 
173  logline.m_state = state;
174  logline.m_data = data;
175 
176  auto *item = new StatusBoxItem(m_logList, line, QVariant::fromValue(logline));
177  if (logline.m_state.isEmpty())
178  logline.m_state = "normal";
179 
180  item->SetFontState(logline.m_state);
181  item->DisplayState(logline.m_state, "status");
182  item->SetText(logline.m_detail, "detail");
183  return item;
184 }
185 
186 bool StatusBox::keyPressEvent(QKeyEvent *event)
187 {
188  if (GetFocusWidget()->keyPressEvent(event))
189  return true;
190 
191  QStringList actions;
192  bool handled = GetMythMainWindow()->TranslateKeyPress("Status", event, actions);
193 
194  for (int i = 0; i < actions.size() && !handled; ++i)
195  {
196  QString action = actions[i];
197  handled = true;
198 
199  QRegExp logNumberKeys( "^[12345678]$" );
200 
202  QString currentItem;
203  if (currentButton)
204  currentItem = currentButton->GetText();
205 
206  if (action == "MENU")
207  {
208  if (currentItem == tr("Log Entries"))
209  {
210  QString message = tr("Acknowledge all log entries at "
211  "this priority level or lower?");
212 
213  auto *confirmPopup =
214  new MythConfirmationDialog(m_popupStack, message);
215 
216  confirmPopup->SetReturnEvent(this, "LogAckAll");
217 
218  if (confirmPopup->Create())
219  m_popupStack->AddScreen(confirmPopup, false);
220  }
221  }
222  else if ((currentItem == tr("Log Entries")) &&
223  (logNumberKeys.indexIn(action) == 0))
224  {
225  m_minLevel = action.toInt();
226  if (m_helpText)
227  m_helpText->SetText(tr("Setting priority level to %1")
228  .arg(m_minLevel));
229  if (m_justHelpText)
230  m_justHelpText->SetText(tr("Setting priority level to %1")
231  .arg(m_minLevel));
232  doLogEntries();
233  }
234  else
235  handled = false;
236  }
237 
238  if (!handled && MythScreenType::keyPressEvent(event))
239  handled = true;
240 
241  return handled;
242 }
243 
245 {
246  if (!item || GetFocusWidget() != m_logList)
247  return;
248 
249  auto logline = item->GetData().value<LogLine>();
250  if (m_helpText)
251  m_helpText->SetText(logline.m_helpdetail);
252  if (m_justHelpText)
253  m_justHelpText->SetText(logline.m_help);
254 }
255 
257 {
258  if (!item)
259  return;
260 
261  disconnect(this, &StatusBox::updateLog,nullptr,nullptr);
262 
263  if (item->GetData().value<MythUICallbackMF>())
264  {
265  connect(this, &StatusBox::updateLog,
266  item->GetData().value<MythUICallbackMF>());
267  emit updateLog();
268  }
269  else if (item->GetData().value<MythUICallbackMFc>())
270  {
271  connect(this, &StatusBox::updateLog,
272  item->GetData().value<MythUICallbackMFc>());
273  emit updateLog();
274  }
275 }
276 
278 {
279  if (!item)
280  return;
281 
282  auto logline = item->GetData().value<LogLine>();
283 
285  QString currentItem;
286  if (currentButton)
287  currentItem = currentButton->GetText();
288 
289  // FIXME: Comparisons against strings here is not great, changing names
290  // breaks everything and it's inefficient
291  if (currentItem == tr("Log Entries"))
292  {
293  QString message = tr("Acknowledge this log entry?");
294 
295  auto *confirmPopup = new MythConfirmationDialog(m_popupStack, message);
296 
297  confirmPopup->SetReturnEvent(this, "LogAck");
298  confirmPopup->SetData(logline.m_data);
299 
300  if (confirmPopup->Create())
301  m_popupStack->AddScreen(confirmPopup, false);
302  }
303  else if (currentItem == tr("Job Queue"))
304  {
305  QStringList msgs;
306  int jobStatus = JobQueue::GetJobStatus(logline.m_data.toInt());
307 
308  if (jobStatus == JOB_QUEUED)
309  {
310  QString message = tr("Delete Job?");
311 
312  auto *confirmPopup =
313  new MythConfirmationDialog(m_popupStack, message);
314 
315  confirmPopup->SetReturnEvent(this, "JobDelete");
316  confirmPopup->SetData(logline.m_data);
317 
318  if (confirmPopup->Create())
319  m_popupStack->AddScreen(confirmPopup, false);
320  }
321  else if ((jobStatus == JOB_PENDING) ||
322  (jobStatus == JOB_STARTING) ||
323  (jobStatus == JOB_RUNNING) ||
324  (jobStatus == JOB_PAUSED))
325  {
326  QString label = tr("Job Queue Actions:");
327 
328  auto *menuPopup = new MythDialogBox(label, m_popupStack,
329  "statusboxpopup");
330 
331  if (menuPopup->Create())
332  m_popupStack->AddScreen(menuPopup, false);
333 
334  menuPopup->SetReturnEvent(this, "JobModify");
335 
336  QVariant data = QVariant::fromValue(logline.m_data);
337 
338  if (jobStatus == JOB_PAUSED)
339  menuPopup->AddButtonV(tr("Resume"), data);
340  else
341  menuPopup->AddButtonV(tr("Pause"), data);
342  menuPopup->AddButtonV(tr("Stop"), data);
343  menuPopup->AddButtonV(tr("No Change"), data);
344  }
345  else if (jobStatus & JOB_DONE)
346  {
347  QString message = tr("Requeue Job?");
348 
349  auto *confirmPopup =
350  new MythConfirmationDialog(m_popupStack, message);
351 
352  confirmPopup->SetReturnEvent(this, "JobRequeue");
353  confirmPopup->SetData(logline.m_data);
354 
355  if (confirmPopup->Create())
356  m_popupStack->AddScreen(confirmPopup, false);
357  }
358  }
359  else if (currentItem == tr("AutoExpire List"))
360  {
362 
363  if (rec)
364  {
365  QString label = tr("AutoExpire Actions:");
366 
367  auto *menuPopup = new MythDialogBox(label, m_popupStack,
368  "statusboxpopup");
369 
370  if (menuPopup->Create())
371  m_popupStack->AddScreen(menuPopup, false);
372 
373  menuPopup->SetReturnEvent(this, "AutoExpireManage");
374 
375  menuPopup->AddButtonV(tr("Delete Now"), QVariant::fromValue(rec));
376  if ((rec)->GetRecordingGroup() == "LiveTV")
377  {
378  menuPopup->AddButtonV(tr("Move to Default group"),
379  QVariant::fromValue(rec));
380  }
381  else if ((rec)->GetRecordingGroup() == "Deleted")
382  menuPopup->AddButtonV(tr("Undelete"), QVariant::fromValue(rec));
383  else
384  menuPopup->AddButtonV(tr("Disable AutoExpire"),
385  QVariant::fromValue(rec));
386  menuPopup->AddButtonV(tr("No Change"), QVariant::fromValue(rec));
387 
388  }
389  }
390 }
391 
392 void StatusBox::customEvent(QEvent *event)
393 {
394  if (event->type() == DialogCompletionEvent::kEventType)
395  {
396  auto *dce = (DialogCompletionEvent*)(event);
397 
398  QString resultid = dce->GetId();
399  int buttonnum = dce->GetResult();
400 
401  if (resultid == "LogAck")
402  {
403  if (buttonnum == 1)
404  {
405  QString sql = dce->GetData().toString();
407  query.prepare("UPDATE mythlog SET acknowledged = 1 "
408  "WHERE logid = :LOGID ;");
409  query.bindValue(":LOGID", sql);
410  if (!query.exec())
411  MythDB::DBError("StatusBox::customEvent -- LogAck", query);
413  }
414  }
415  else if (resultid == "LogAckAll")
416  {
417  if (buttonnum == 1)
418  {
420  query.prepare("UPDATE mythlog SET acknowledged = 1 "
421  "WHERE priority <= :PRIORITY ;");
422  query.bindValue(":PRIORITY", m_minLevel);
423  if (!query.exec())
424  MythDB::DBError("StatusBox::customEvent -- LogAckAll",
425  query);
426  doLogEntries();
427  }
428  }
429  else if (resultid == "JobDelete")
430  {
431  if (buttonnum == 1)
432  {
433  int jobID = dce->GetData().toInt();
435 
437  }
438  }
439  else if (resultid == "JobRequeue")
440  {
441  if (buttonnum == 1)
442  {
443  int jobID = dce->GetData().toInt();
444  JobQueue::ChangeJobStatus(jobID, JOB_QUEUED);
446  }
447  }
448  else if (resultid == "JobModify")
449  {
450  int jobID = dce->GetData().toInt();
451  if (buttonnum == 0)
452  {
453  if (JobQueue::GetJobStatus(jobID) == JOB_PAUSED)
455  else
457  }
458  else if (buttonnum == 1)
459  {
461  }
462 
464  }
465  else if (resultid == "AutoExpireManage")
466  {
467  auto* rec = dce->GetData().value<ProgramInfo*>();
468 
469  // button 2 is "No Change"
470  if (!rec || buttonnum == 2)
471  return;
472 
473  // button 1 is "Delete Now"
474  if ((buttonnum == 0) && rec->QueryIsDeleteCandidate())
475  {
476  if (!RemoteDeleteRecording(rec->GetRecordingID(),
477  false, false))
478  {
479  LOG(VB_GENERAL, LOG_ERR, QString("Failed to delete recording: %1").arg(rec->GetTitle()));
480  return;
481  }
482  }
483  // button 1 is "Move To Default Group" or "UnDelete" or "Disable AutoExpire"
484  else if (buttonnum == 1)
485  {
486  if ((rec)->GetRecordingGroup() == "Deleted")
487  {
488  RemoteUndeleteRecording(rec->GetRecordingID());
489  }
490  else
491  {
492  rec->SaveAutoExpire(kDisableAutoExpire);
493 
494  if ((rec)->GetRecordingGroup() == "LiveTV")
495  {
496  RecordingInfo ri(*rec);
498  *rec = ri;
499  }
500  }
501  }
502 
503  // remove the changed recording from the expire list
504  delete m_expList[m_logList->GetCurrentPos()];
505  m_expList.erase(m_expList.begin() + m_logList->GetCurrentPos());
506 
507  int pos = m_logList->GetCurrentPos();
508  int topPos = m_logList->GetTopItemPos();
509  doAutoExpireList(false);
510  m_logList->SetItemCurrent(pos, topPos);
511  }
512 
513  }
514 }
515 
517 {
518  if (m_iconState)
519  m_iconState->DisplayState("listings");
520  m_logList->Reset();
521 
522  QString helpmsg(tr("Listings Status shows the latest "
523  "status information from "
524  "mythfilldatabase"));
525  if (m_helpText)
526  m_helpText->SetText(helpmsg);
527  if (m_justHelpText)
528  m_justHelpText->SetText(helpmsg);
529 
530  QDateTime mfdLastRunStart;
531  QDateTime mfdLastRunEnd;
532  QDateTime mfdNextRunStart;
533  QString mfdLastRunStatus;
534  QDateTime qdtNow;
535  QDateTime GuideDataThrough;
536 
537  qdtNow = MythDate::current();
538 
540  query.prepare("SELECT max(endtime) FROM program WHERE manualid=0;");
541 
542  if (query.exec() && query.next())
543  GuideDataThrough = MythDate::fromString(query.value(0).toString());
544 
545  QString tmp = gCoreContext->GetSetting("mythfilldatabaseLastRunStart");
546  mfdLastRunStart = MythDate::fromString(tmp);
547  tmp = gCoreContext->GetSetting("mythfilldatabaseLastRunEnd");
548  mfdLastRunEnd = MythDate::fromString(tmp);
549  tmp = gCoreContext->GetSetting("MythFillSuggestedRunTime");
550  mfdNextRunStart = MythDate::fromString(tmp);
551 
552  mfdLastRunStatus = gCoreContext->GetSetting("mythfilldatabaseLastRunStatus");
553 
554  AddLogLine(tr("Mythfrontend version: %1 (%2)").arg(GetMythSourcePath())
555  .arg(GetMythSourceVersion()), helpmsg);
556  AddLogLine(tr("Last mythfilldatabase guide update:"), helpmsg);
557  tmp = tr("Started: %1").arg(
559  mfdLastRunStart, MythDate::kDateTimeFull | MythDate::kSimplify));
560  AddLogLine(tmp, helpmsg);
561 
562  if (mfdLastRunEnd >= mfdLastRunStart)
563  {
564  tmp = tr("Finished: %1")
565  .arg(MythDate::toString(
566  mfdLastRunEnd,
568  AddLogLine(tmp, helpmsg);
569  }
570 
571  AddLogLine(tr("Result: %1").arg(mfdLastRunStatus), helpmsg);
572 
573 
574  if (mfdNextRunStart >= mfdLastRunStart)
575  {
576  tmp = tr("Suggested Next: %1")
577  .arg(MythDate::toString(
578  mfdNextRunStart,
580  AddLogLine(tmp, helpmsg);
581  }
582 
583  int DaysOfData = qdtNow.daysTo(GuideDataThrough);
584 
585  if (GuideDataThrough.isNull())
586  {
587  AddLogLine(tr("There's no guide data available!"), helpmsg,
588  "", "warning");
589  AddLogLine(tr("Have you run mythfilldatabase?"), helpmsg,
590  "", "warning");
591  }
592  else
593  {
594  AddLogLine(
595  tr("There is guide data until %1")
597  GuideDataThrough,
599 
600  AddLogLine(QString("(%1).").arg(tr("%n day(s)", "", DaysOfData)),
601  helpmsg);
602  }
603 
604  if (DaysOfData <= 3)
605  AddLogLine(tr("WARNING: is mythfilldatabase running?"), helpmsg,
606  "", "", "warning");
607 }
608 
610 {
611  if (m_iconState)
612  m_iconState->DisplayState("schedule");
613  m_logList->Reset();
614 
615  QString helpmsg(tr("Schedule Status shows current statistics "
616  "from the scheduler."));
617  if (m_helpText)
618  m_helpText->SetText(helpmsg);
619  if (m_justHelpText)
620  m_justHelpText->SetText(helpmsg);
621 
623 
624  query.prepare("SELECT COUNT(*) FROM record WHERE type = :TEMPLATE");
625  query.bindValue(":TEMPLATE", kTemplateRecord);
626  if (query.exec() && query.next())
627  {
628  QString rules = tr("%n template rule(s) (is) defined", "",
629  query.value(0).toInt());
630  AddLogLine(rules, helpmsg);
631  }
632  else
633  {
634  MythDB::DBError("StatusBox::doScheduleStatus()", query);
635  return;
636  }
637 
638  query.prepare("SELECT COUNT(*) FROM record "
639  "WHERE type <> :TEMPLATE AND search = :NOSEARCH");
640  query.bindValue(":TEMPLATE", kTemplateRecord);
641  query.bindValue(":NOSEARCH", kNoSearch);
642  if (query.exec() && query.next())
643  {
644  QString rules = tr("%n standard rule(s) (is) defined", "",
645  query.value(0).toInt());
646  AddLogLine(rules, helpmsg);
647  }
648  else
649  {
650  MythDB::DBError("StatusBox::doScheduleStatus()", query);
651  return;
652  }
653 
654  query.prepare("SELECT COUNT(*) FROM record WHERE search > :NOSEARCH");
655  query.bindValue(":NOSEARCH", kNoSearch);
656  if (query.exec() && query.next())
657  {
658  QString rules = tr("%n search rule(s) are defined", "",
659  query.value(0).toInt());
660  AddLogLine(rules, helpmsg);
661  }
662  else
663  {
664  MythDB::DBError("StatusBox::doScheduleStatus()", query);
665  return;
666  }
667 
668  QMap<RecStatus::Type, int> statusMatch;
669  QMap<RecStatus::Type, QString> statusText;
670  QMap<int, int> sourceMatch;
671  QMap<int, QString> sourceText;
672  QMap<int, int> cardMatch;
673  QMap<int, QString> cardText;
674  QMap<int, int> cardParent;
675  QMap<int, bool> cardSchedGroup;
676  QString tmpstr;
677  int maxSource = 0;
678  int maxCard = 0;
679  int lowerpriority = 0;
680  int hdflag = 0;
681 
682  query.prepare("SELECT MAX(sourceid) FROM videosource");
683  if (query.exec())
684  {
685  if (query.next())
686  maxSource = query.value(0).toInt();
687  }
688 
689  query.prepare("SELECT sourceid,name FROM videosource");
690  if (query.exec())
691  {
692  while (query.next())
693  sourceText[query.value(0).toInt()] = query.value(1).toString();
694  }
695 
696  query.prepare("SELECT MAX(cardid) FROM capturecard");
697  if (query.exec())
698  {
699  if (query.next())
700  maxCard = query.value(0).toInt();
701  }
702 
703  query.prepare("SELECT cardid, inputname, displayname, parentid, "
704  " schedgroup "
705  "FROM capturecard");
706  if (query.exec())
707  {
708  while (query.next())
709  {
710  int inputid = query.value(0).toInt();
711  cardText[inputid] = query.value(2).toString();
712  if (cardText[inputid].isEmpty())
713  cardText[inputid] = QString::number(query.value(1).toInt());
714  cardParent[inputid] = query.value(3).toInt();
715  cardSchedGroup[inputid] = query.value(4).toBool();
716  }
717  }
718 
719  ProgramList schedList;
720  LoadFromScheduler(schedList);
721 
722  tmpstr = tr("%n matching showing(s)", "", schedList.size());
723  AddLogLine(tmpstr, helpmsg);
724 
725  for (auto *s : schedList)
726  {
727  const RecStatus::Type recstatus = s->GetRecordingStatus();
728 
729  if (statusMatch[recstatus] < 1)
730  {
731  statusText[recstatus] = RecStatus::toString(
732  recstatus, s->GetRecordingRuleType());
733  }
734 
735  ++statusMatch[recstatus];
736 
737  if (recstatus == RecStatus::WillRecord ||
738  recstatus == RecStatus::Pending ||
739  recstatus == RecStatus::Recording ||
740  recstatus == RecStatus::Tuning ||
741  recstatus == RecStatus::Failing)
742  {
743  ++sourceMatch[s->GetSourceID()];
744  int inputid = s->GetInputID();
745  // When schedgroup is used, always attribute recordings to
746  // the parent inputs.
747  if (cardParent[inputid] && cardSchedGroup[cardParent[inputid]])
748  inputid = cardParent[inputid];
749  ++cardMatch[inputid];
750  if (s->GetRecordingPriority2() < 0)
751  ++lowerpriority;
752  if (s->GetVideoProperties() & VID_HDTV)
753  ++hdflag;
754  }
755  }
756 
757 #define ADD_STATUS_LOG_LINE(rtype, fstate) \
758  do { \
759  if (statusMatch[rtype] > 0) \
760  { \
761  tmpstr = QString("%1 %2").arg(statusMatch[rtype]) \
762  .arg(statusText[rtype]); \
763  AddLogLine(tmpstr, helpmsg, tmpstr, tmpstr, fstate);\
764  } \
765  } while (false)
776 
777  QString willrec = statusText[RecStatus::WillRecord];
778 
779  if (lowerpriority > 0)
780  {
781  tmpstr = QString("%1 %2 %3").arg(lowerpriority).arg(willrec)
782  .arg(tr("with lower priority"));
783  AddLogLine(tmpstr, helpmsg, tmpstr, tmpstr, "warning");
784  }
785  if (hdflag > 0)
786  {
787  tmpstr = QString("%1 %2 %3").arg(hdflag).arg(willrec)
788  .arg(tr("marked as HDTV"));
789  AddLogLine(tmpstr, helpmsg);
790  }
791  for (int i = 1; i <= maxSource; ++i)
792  {
793  if (sourceMatch[i] > 0)
794  {
795  tmpstr = QString("%1 %2 %3 %4 \"%5\"")
796  .arg(sourceMatch[i]).arg(willrec)
797  .arg(tr("from source")).arg(i).arg(sourceText[i]);
798  AddLogLine(tmpstr, helpmsg);
799  }
800  }
801  for (int i = 1; i <= maxCard; ++i)
802  {
803  if (cardMatch[i] > 0)
804  {
805  tmpstr = QString("%1 %2 %3 %4 \"%5\"")
806  .arg(cardMatch[i]).arg(willrec)
807  .arg(tr("on input")).arg(i).arg(cardText[i]);
808  AddLogLine(tmpstr, helpmsg);
809  }
810  }
811 }
812 
814 {
815  struct info
816  {
817  int m_inputid {0};
818  bool m_schedgroup {false};
819  QString m_displayname;
820  int m_errored {0};
821  int m_unavailable {0};
822  int m_sleeping {0};
823  int m_recording {0};
824  int m_livetv {0};
825  int m_available {0};
826  QStringList m_recordings;
827  };
828  QMap<int, struct info> info;
829  QList<int> inputids;
830 
831  if (m_iconState)
832  m_iconState->DisplayState("tuner");
833  m_logList->Reset();
834 
835  QString helpmsg(tr("Input Status shows the current information "
836  "about the state of backend inputs"));
837  if (m_helpText)
838  m_helpText->SetText(helpmsg);
839  if (m_justHelpText)
840  m_justHelpText->SetText(helpmsg);
841 
843  query.prepare(
844  "SELECT cardid, parentid, schedgroup, displayname "
845  "FROM capturecard ORDER BY cardid");
846 
847  if (!query.exec() || !query.isActive())
848  {
849  MythDB::DBError("StatusBox::doTunerStatus()", query);
850  return;
851  }
852 
853  while (query.next())
854  {
855  int inputid = query.value(0).toInt();
856  int parentid = query.value(1).toInt();
857 
858  // If this is a schedgroup child, attribute all status to the
859  // parent.
860  int infoid = inputid;
861  if (parentid && info[parentid].m_schedgroup)
862  infoid = parentid;
863  else
864  {
865  info[infoid].m_inputid = inputid;
866  info[infoid].m_schedgroup = query.value(2).toBool();
867  info[infoid].m_displayname = query.value(3).toString();
868  inputids.append(inputid);
869  }
870 
871  QString cmd = QString("QUERY_REMOTEENCODER %1").arg(inputid);
872  QStringList strlist( cmd );
873  strlist << "GET_STATE";
874 
876  int state = strlist[0].toInt();
877 
878  if (state == kState_Error)
879  {
880  strlist.clear();
881  strlist << QString("QUERY_REMOTEENCODER %1").arg(inputid);
882  strlist << "GET_SLEEPSTATUS";
883 
885  int sleepState = strlist[0].toInt();
886 
887  if (sleepState == -1)
888  info[infoid].m_errored += 1;
889  else if (sleepState == sStatus_Undefined)
890  info[infoid].m_unavailable += 1;
891  else
892  info[infoid].m_sleeping += 1;
893  }
894  else if (state == kState_RecordingOnly ||
895  state == kState_WatchingRecording)
896  info[infoid].m_recording += 1;
897  else if (state == kState_WatchingLiveTV)
898  info[infoid].m_livetv += 1;
899  else
900  info[infoid].m_available += 1;
901 
902  if (state == kState_RecordingOnly ||
903  state == kState_WatchingRecording ||
904  state == kState_WatchingLiveTV)
905  {
906  strlist = QStringList( QString("QUERY_RECORDER %1").arg(inputid));
907  strlist << "GET_RECORDING";
909  ProgramInfo pginfo(strlist);
910  if (pginfo.GetChanID())
911  {
912  QString titlesub = pginfo.GetTitle();
913  if (!pginfo.GetSubtitle().isEmpty())
914  titlesub += QString(" - ") + pginfo.GetSubtitle();
915  info[infoid].m_recordings += titlesub;
916  }
917  }
918  }
919 
920  for (int inputid : qAsConst(inputids))
921  {
922  QStringList statuslist;
923  if (info[inputid].m_errored)
924  statuslist << tr("%1 errored").arg(info[inputid].m_errored);
925  if (info[inputid].m_unavailable)
926  statuslist << tr("%1 unavailable").arg(info[inputid].m_unavailable);
927  if (info[inputid].m_sleeping)
928  statuslist << tr("%1 sleeping").arg(info[inputid].m_sleeping);
929  if (info[inputid].m_recording)
930  statuslist << tr("%1 recording").arg(info[inputid].m_recording);
931  if (info[inputid].m_livetv)
932  statuslist << tr("%1 live television").arg(info[inputid].m_livetv);
933  if (info[inputid].m_available)
934  statuslist << tr("%1 available").arg(info[inputid].m_available);
935 
936  QString fontstate;
937  if (info[inputid].m_errored)
938  fontstate = "error";
939  else if (info[inputid].m_unavailable || info[inputid].m_sleeping)
940  fontstate = "warning";
941 
942  QString shortstatus = tr("Input %1 %2: %3")
943  .arg(inputid).arg(info[inputid].m_displayname)
944  .arg(statuslist.join(tr(", ")));
945  QString longstatus = shortstatus + "\n" +
946  info[inputid].m_recordings.join("\n");
947 
948  AddLogLine(shortstatus, helpmsg, longstatus, longstatus, fontstate);
949  }
950 }
951 
953 {
954  if (m_iconState)
955  m_iconState->DisplayState("log");
956  m_logList->Reset();
957 
958  QString helpmsg(tr("Log Entries shows any unread log entries "
959  "from the system if you have logging enabled"));
960  if (m_helpText)
961  m_helpText->SetText(helpmsg);
962  if (m_justHelpText)
963  m_justHelpText->SetText(helpmsg);
964 
966  query.prepare("SELECT logid, module, priority, logdate, host, "
967  "message, details "
968  "FROM mythlog WHERE acknowledged = 0 "
969  "AND priority <= :PRIORITY ORDER BY logdate DESC;");
970  query.bindValue(":PRIORITY", m_minLevel);
971 
972  if (query.exec())
973  {
974  QString line;
975  QString detail;
976  while (query.next())
977  {
978  line = QString("%1").arg(query.value(5).toString());
979 
980  detail = tr("On %1 from %2.%3\n%4\n")
981  .arg(MythDate::toString(
982  MythDate::as_utc(query.value(3).toDateTime()),
984  .arg(query.value(4).toString())
985  .arg(query.value(1).toString())
986  .arg(query.value(5).toString());
987 
988  QString tmp = query.value(6).toString();
989  if (!tmp.isEmpty())
990  detail.append(tmp);
991  else
992  detail.append(tr("No further details"));
993 
994  AddLogLine(line, helpmsg, detail, detail,
995  "", query.value(0).toString());
996  }
997 
998  if (query.size() == 0)
999  {
1000  AddLogLine(tr("No items found at priority level %1 or lower.")
1001  .arg(m_minLevel), helpmsg);
1002  AddLogLine(tr("Use 1-8 to change priority level."), helpmsg);
1003  }
1004  }
1005 }
1006 
1008 {
1009  if (m_iconState)
1010  m_iconState->DisplayState("jobqueue");
1011  m_logList->Reset();
1012 
1013  QString helpmsg(tr("Job Queue shows any jobs currently in "
1014  "MythTV's Job Queue such as a commercial "
1015  "detection job."));
1016  if (m_helpText)
1017  m_helpText->SetText(helpmsg);
1018  if (m_justHelpText)
1019  m_justHelpText->SetText(helpmsg);
1020 
1021  QMap<int, JobQueueEntry> jobs;
1022  QMap<int, JobQueueEntry>::Iterator it;
1023 
1026  JOB_LIST_RECENT);
1027 
1028  if (!jobs.empty())
1029  {
1030  QString detail;
1031  QString line;
1032 
1033  for (it = jobs.begin(); it != jobs.end(); ++it)
1034  {
1035  ProgramInfo pginfo((*it).chanid, (*it).recstartts);
1036 
1037  if (!pginfo.GetChanID())
1038  continue;
1039 
1040  detail = QString("%1\n%2 %3 @ %4\n%5 %6 %7 %8")
1041  .arg(pginfo.GetTitle())
1042  .arg(pginfo.GetChannelName())
1043  .arg(pginfo.GetChanNum())
1044  .arg(MythDate::toString(
1045  pginfo.GetRecordingStartTime(),
1047  .arg(tr("Job:"))
1048  .arg(JobQueue::JobText((*it).type))
1049  .arg(tr("Status: "))
1050  .arg(JobQueue::StatusText((*it).status));
1051 
1052  if ((*it).status != JOB_QUEUED)
1053  detail += " (" + (*it).hostname + ')';
1054 
1055  if ((*it).schedruntime > MythDate::current())
1056  {
1057  detail += '\n' + tr("Scheduled Run Time:") + ' ' +
1059  (*it).schedruntime,
1061  }
1062  else
1063  {
1064  detail += '\n' + (*it).comment;
1065  }
1066 
1067  line = QString("%1 @ %2").arg(pginfo.GetTitle())
1068  .arg(MythDate::toString(
1069  pginfo.GetRecordingStartTime(),
1071 
1072  QString font;
1073  if ((*it).status == JOB_ERRORED)
1074  font = "error";
1075  else if ((*it).status == JOB_ABORTED)
1076  font = "warning";
1077 
1078  AddLogLine(line, helpmsg, detail, detail, font,
1079  QString("%1").arg((*it).id));
1080  }
1081  }
1082  else
1083  AddLogLine(tr("Job Queue is currently empty."), helpmsg);
1084 
1085 }
1086 
1087 // Some helper routines for doMachineStatus() that format the output strings
1088 
1096 static QString sm_str(long long sizeKB, int prec=1)
1097 {
1098  if (sizeKB>1024*1024*1024) // Terabytes
1099  {
1100  double sizeGB = sizeKB/(1024*1024*1024.0);
1101  return QObject::tr("%1 TB").arg(sizeGB, 0, 'f', (sizeGB>10)?0:prec);
1102  }
1103  if (sizeKB>1024*1024) // Gigabytes
1104  {
1105  double sizeGB = sizeKB/(1024*1024.0);
1106  return QObject::tr("%1 GB").arg(sizeGB, 0, 'f', (sizeGB>10)?0:prec);
1107  }
1108  if (sizeKB>1024) // Megabytes
1109  {
1110  double sizeMB = sizeKB/1024.0;
1111  return QObject::tr("%1 MB").arg(sizeMB, 0, 'f', (sizeMB>10)?0:prec);
1112  }
1113  // Kilobytes
1114  return QObject::tr("%1 KB").arg(sizeKB);
1115 }
1116 
1117 static QString usage_str_kb(long long total,
1118  long long used,
1119  long long free)
1120 {
1121  QString ret = QObject::tr("Unknown");
1122  if (total > 0.0 && free > 0.0)
1123  {
1124  double percent = (100.0*free)/total;
1125  ret = StatusBox::tr("%1 total, %2 used, %3 (or %4%) free.")
1126  .arg(sm_str(total)).arg(sm_str(used))
1127  .arg(sm_str(free)).arg(percent, 0, 'f', (percent >= 10.0) ? 0 : 2);
1128  }
1129  return ret;
1130 }
1131 
1132 static QString usage_str_mb(float total, float used, float free)
1133 {
1134  return usage_str_kb((long long)(total*1024), (long long)(used*1024),
1135  (long long)(free*1024));
1136 }
1137 
1138 static void disk_usage_with_rec_time_kb(QStringList& out, long long total,
1139  long long used, long long free,
1140  const recprof2bps_t& prof2bps)
1141 {
1142  const QString tail = StatusBox::tr(", using your %1 rate of %2 kb/s");
1143 
1144  out<<usage_str_kb(total, used, free);
1145  if (free<0)
1146  return;
1147 
1148  // NOLINTNEXTLINE(modernize-loop-convert)
1149  for (auto it = prof2bps.begin(); it != prof2bps.end(); ++it)
1150  {
1151  const QString pro =
1152  tail.arg(it.key()).arg((int)((float)(*it) / 1024.0F));
1153 
1154  long long bytesPerMin = ((*it) >> 1) * 15;
1155  uint minLeft = ((free<<5)/bytesPerMin)<<5;
1156  minLeft = (minLeft/15)*15;
1157  uint hoursLeft = minLeft/60;
1158  QString hourstring = StatusBox::tr("%n hour(s)", "", hoursLeft);
1159  QString minstring = StatusBox::tr("%n minute(s)", "", minLeft%60);
1160  QString remainstring = StatusBox::tr("%1 remaining", "time");
1161  if (minLeft%60 == 0)
1162  out<<remainstring.arg(hourstring) + pro;
1163  else if (minLeft > 60)
1164  {
1165  out<<StatusBox::tr("%1 and %2 remaining", "time").arg(hourstring)
1166  .arg(minstring) + pro;
1167  }
1168  else
1169  {
1170  out<<remainstring.arg(minstring) + pro;
1171  }
1172  }
1173 }
1174 
1175 static QString uptimeStr(time_t uptime)
1176 {
1177  QString str = " " + StatusBox::tr("Uptime") + ": ";
1178 
1179  if (uptime == 0)
1180  return str + StatusBox::tr("unknown", "unknown uptime");
1181 
1182  int days = uptime/ONEDAYINSEC;
1183  int secs = uptime - days*ONEDAYINSEC;
1184 
1185  QString astext;
1186  if (days > 0)
1187  {
1188  astext = QString("%1, %2")
1189  .arg(StatusBox::tr("%n day(s)", "", days))
1190  .arg(MythFormatTime(secs, "H:mm"));
1191  } else {
1192  astext = MythFormatTime(secs, "H:mm:ss");
1193  }
1194  return str + astext;
1195 }
1196 
1200 void StatusBox::getActualRecordedBPS(const QString& hostnames)
1201 {
1202  m_recordingProfilesBps.clear();
1203 
1204  QString querystr;
1206 
1207  querystr =
1208  "SELECT sum(filesize) * 8 / "
1209  "sum(((unix_timestamp(endtime) - unix_timestamp(starttime)))) "
1210  "AS avg_bitrate "
1211  "FROM recorded WHERE hostname in (%1) "
1212  "AND (unix_timestamp(endtime) - unix_timestamp(starttime)) > 300;";
1213 
1214  query.prepare(querystr.arg(hostnames));
1215 
1216  if (query.exec() && query.next() &&
1217  query.value(0).toDouble() > 0)
1218  {
1219  QString rateStr = tr("average", "average rate");
1220 
1221  // Don't user a tr() directly here as the Qt tools will
1222  // not be able to extract the string for translation.
1223  m_recordingProfilesBps[rateStr] =
1224  (int)(query.value(0).toDouble());
1225  }
1226 
1227  querystr =
1228  "SELECT max(filesize * 8 / "
1229  "(unix_timestamp(endtime) - unix_timestamp(starttime))) "
1230  "AS max_bitrate "
1231  "FROM recorded WHERE hostname in (%1) "
1232  "AND (unix_timestamp(endtime) - unix_timestamp(starttime)) > 300;";
1233 
1234  query.prepare(querystr.arg(hostnames));
1235 
1236  if (query.exec() && query.next() &&
1237  query.value(0).toDouble() > 0)
1238  {
1239  QString rateStr = tr("maximum", "maximum rate");
1240 
1241  // Don't user a tr() directly here as the Qt tools will
1242  // not be able to extract the string for translation.
1243  m_recordingProfilesBps[rateStr] =
1244  (int)(query.value(0).toDouble());
1245  }
1246 }
1247 
1257 {
1258  if (m_iconState)
1259  m_iconState->DisplayState("machine");
1260  m_logList->Reset();
1261  QString machineStr = tr("Machine Status shows some operating system "
1262  "statistics of this machine and the MythTV "
1263  "server.");
1264 
1265  if (m_helpText)
1266  m_helpText->SetText(machineStr);
1267  if (m_justHelpText)
1268  m_justHelpText->SetText(machineStr);
1269 
1270  QString line;
1271  if (m_isBackendActive)
1272  line = tr("System:");
1273  else
1274  line = tr("This machine:");
1275  AddLogLine(line, machineStr);
1276 
1277  // Time
1278  StatusBoxItem *timebox = AddLogLine("");
1279  auto UpdateTime = [](StatusBoxItem* Item)
1280  {
1281  Item->SetText(" " + tr("System time") + ": " + QDateTime::currentDateTime().toString());
1282  };
1283  UpdateTime(timebox);
1284  connect(timebox, &StatusBoxItem::UpdateRequired, UpdateTime);
1285  timebox->Start();
1286 
1287  // Hostname & IP
1288  AddLogLine(" " + tr("Hostname") + ": " + gCoreContext->GetHostName());
1289  AddLogLine(" " + tr("OS") + QString(": %1 (%2)").arg(QSysInfo::prettyProductName())
1290  .arg(QSysInfo::currentCpuArchitecture()));
1291  AddLogLine(" " + tr("Qt version") + QString(": %1").arg(qVersion()));
1292 
1293  QList allInterfaces = QNetworkInterface::allInterfaces();
1294  for (const QNetworkInterface & iface : qAsConst(allInterfaces))
1295  {
1296  QNetworkInterface::InterfaceFlags f = iface.flags();
1297  if (!(f & QNetworkInterface::IsUp))
1298  continue;
1299  if (!(f & QNetworkInterface::IsRunning))
1300  continue;
1301  if ((f & QNetworkInterface::IsLoopBack) != 0U)
1302  continue;
1303 
1304 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
1305  QNetworkInterface::InterfaceType type = iface.type();
1306  QString name = type == QNetworkInterface::Wifi ? tr("WiFi") : tr("Ethernet");
1307 #else
1308  QString name = tr("Network");
1309 #endif
1310  AddLogLine(" " + name + QString(" (%1): ").arg(iface.humanReadableName()));
1311  AddLogLine(" " + tr("MAC Address") + ": " + iface.hardwareAddress());
1312  QList addresses = iface.addressEntries();
1313  for (const QNetworkAddressEntry & addr : qAsConst(addresses))
1314  {
1315  if (addr.ip().protocol() == QAbstractSocket::IPv4Protocol ||
1316  addr.ip().protocol() == QAbstractSocket::IPv6Protocol)
1317  {
1318  AddLogLine(" " + tr("IP Address") + ": " + addr.ip().toString());
1319  }
1320  }
1321  }
1322  AddLogLine(line, machineStr);
1323 
1324  // uptime
1325  time_t uptime = 0;
1326  if (getUptime(uptime))
1327  {
1328  auto UpdateUptime = [](StatusBoxItem* Item)
1329  {
1330  time_t time = 0;
1331  getUptime(time);
1332  Item->SetText(uptimeStr(time));
1333  };
1334  StatusBoxItem *uptimeitem = AddLogLine(uptimeStr(uptime));
1335  connect(uptimeitem, &StatusBoxItem::UpdateRequired, UpdateUptime);
1336  uptimeitem->Start(60);
1337  }
1338 
1339  // weighted average loads
1340 #if !defined(_WIN32) && !defined(Q_OS_ANDROID)
1341  auto UpdateLoad = [](StatusBoxItem* Item)
1342  {
1343  loadArray loads = getLoadAvgs();
1344  Item->SetText(QString(" %1: %2 %3 %4").arg(tr("Load")).arg(loads[0], 1, 'f', 2)
1345  .arg(loads[1], 1, 'f', 2).arg(loads[2], 1, 'f', 2));
1346  };
1347  StatusBoxItem* loaditem = AddLogLine("");
1348  UpdateLoad(loaditem);
1349  connect(loaditem, &StatusBoxItem::UpdateRequired, UpdateLoad);
1350  loaditem->Start();
1351 #endif
1352 
1353  // memory usage
1354  int totalM = 0; // Physical memory
1355  int freeM = 0;
1356  int totalS = 0; // Virtual memory (swap)
1357  int freeS = 0;
1358  if (getMemStats(totalM, freeM, totalS, freeS))
1359  {
1360  auto UpdateMem = [](StatusBoxItem* Item)
1361  {
1362  int totm = 0;
1363  int freem = 0;
1364  int tots = 0;
1365  int frees = 0;
1366  if (getMemStats(totm, freem, tots, frees))
1367  Item->SetText(QString(" " + tr("RAM") + ": " + usage_str_mb(totm, totm - freem, freem)));
1368  };
1369 
1370  auto UpdateSwap = [](StatusBoxItem* Item)
1371  {
1372  int totm = 0;
1373  int freem = 0;
1374  int tots = 0;
1375  int frees = 0;
1376  if (getMemStats(totm, freem, tots, frees))
1377  Item->SetText(QString(" " + tr("Swap") + ": " + usage_str_mb(tots, tots - frees, frees)));
1378  };
1379  StatusBoxItem* mem = AddLogLine("", machineStr);
1380  StatusBoxItem* swap = AddLogLine("", machineStr);
1381  UpdateMem(mem);
1382  UpdateSwap(swap);
1383  connect(mem, &StatusBoxItem::UpdateRequired, UpdateMem);
1384  connect(swap, &StatusBoxItem::UpdateRequired, UpdateSwap);
1385  mem->Start(3);
1386  swap->Start(3);
1387  }
1388 
1389  if (!m_isBackendActive)
1390  {
1391  line = tr("MythTV server") + ':';
1392  AddLogLine(line, machineStr);
1393 
1394  // Hostname & IP
1395  line = " " + tr("Hostname") + ": " + gCoreContext->GetSetting("MasterServerName");
1396  line.append(", " + tr("IP") + ": " + gCoreContext->GetSetting("MasterServerIP"));
1397  AddLogLine(line, machineStr);
1398 
1399  // uptime
1400  if (RemoteGetUptime(uptime))
1401  {
1402  auto UpdateRemoteUptime = [](StatusBoxItem* Item)
1403  {
1404  time_t time = 0;
1405  RemoteGetUptime(time);
1406  Item->SetText(uptimeStr(time));
1407  };
1408  StatusBoxItem *remoteuptime = AddLogLine(uptimeStr(uptime));
1409  connect(remoteuptime, &StatusBoxItem::UpdateRequired, UpdateRemoteUptime);
1410  remoteuptime->Start(60);
1411  }
1412 
1413  // weighted average loads
1414  system_load_array floads;
1415  if (RemoteGetLoad(floads))
1416  {
1417  auto UpdateRemoteLoad = [](StatusBoxItem* Item)
1418  {
1419  system_load_array loads = { 0.0, 0.0, 0.0 };
1420  RemoteGetLoad(loads);
1421  Item->SetText(QString(" %1: %2 %3 %4").arg(tr("Load")).arg(loads[0], 1, 'f', 2)
1422  .arg(loads[1], 1, 'f', 2).arg(loads[2], 1, 'f', 2));
1423  };
1424  StatusBoxItem* remoteloaditem = AddLogLine("");
1425  UpdateRemoteLoad(remoteloaditem);
1426  connect(remoteloaditem, &StatusBoxItem::UpdateRequired, UpdateRemoteLoad);
1427  remoteloaditem->Start();
1428  }
1429 
1430  // memory usage
1431  if (RemoteGetMemStats(totalM, freeM, totalS, freeS))
1432  {
1433  auto UpdateRemoteMem = [](StatusBoxItem* Item)
1434  {
1435  int totm = 0;
1436  int freem = 0;
1437  int tots = 0;
1438  int frees = 0;
1439  if (RemoteGetMemStats(totm, freem, tots, frees))
1440  Item->SetText(QString(" " + tr("RAM") + ": " + usage_str_mb(totm, totm - freem, freem)));
1441  };
1442 
1443  auto UpdateRemoteSwap = [](StatusBoxItem* Item)
1444  {
1445  int totm = 0;
1446  int freem = 0;
1447  int tots = 0;
1448  int frees = 0;
1449  if (RemoteGetMemStats(totm, freem, tots, frees))
1450  Item->SetText(QString(" " + tr("Swap") + ": " + usage_str_mb(tots, tots - frees, frees)));
1451  };
1452  StatusBoxItem* rmem = AddLogLine("", machineStr);
1453  StatusBoxItem* rswap = AddLogLine("", machineStr);
1454  UpdateRemoteMem(rmem);
1455  UpdateRemoteSwap(rswap);
1456  connect(rmem, &StatusBoxItem::UpdateRequired, UpdateRemoteMem);
1457  connect(rswap, &StatusBoxItem::UpdateRequired, UpdateRemoteSwap);
1458  rmem->Start(10);
1459  rswap->Start(11);
1460  }
1461  }
1462 
1463  // get free disk space
1464  QString hostnames;
1465 
1466  QList<FileSystemInfo> fsInfos = FileSystemInfo::RemoteGetInfo();
1467  for (int i = 0; i < fsInfos.size(); ++i)
1468  {
1469  // For a single-directory installation just display the totals
1470  if ((fsInfos.size() == 2) && (i == 0) &&
1471  (fsInfos[i].getPath() != "TotalDiskSpace") &&
1472  (fsInfos[i+1].getPath() == "TotalDiskSpace"))
1473  i++;
1474 
1475  hostnames = QString("\"%1\"").arg(fsInfos[i].getHostname());
1476  hostnames.replace(' ', "");
1477  hostnames.replace(',', "\",\"");
1478 
1479  getActualRecordedBPS(hostnames);
1480 
1481  QStringList list;
1483  fsInfos[i].getTotalSpace(), fsInfos[i].getUsedSpace(),
1484  fsInfos[i].getTotalSpace() - fsInfos[i].getUsedSpace(),
1486 
1487  if (fsInfos[i].getPath() == "TotalDiskSpace")
1488  {
1489  line = tr("Total Disk Space:");
1490  AddLogLine(line, machineStr);
1491  }
1492  else
1493  {
1494  line = tr("MythTV Drive #%1:").arg(fsInfos[i].getFSysID());
1495  AddLogLine(line, machineStr);
1496 
1497  QStringList tokens = fsInfos[i].getPath().split(',');
1498 
1499  if (tokens.size() > 1)
1500  {
1501  AddLogLine(QString(" ") + tr("Directories:"), machineStr);
1502 
1503  int curToken = 0;
1504  while (curToken < tokens.size())
1505  AddLogLine(QString(" ") +
1506  tokens[curToken++], machineStr);
1507  }
1508  else
1509  {
1510  AddLogLine(QString(" " ) + tr("Directory:") + ' ' +
1511  fsInfos[i].getPath(), machineStr);
1512  }
1513  }
1514 
1515  for (auto & diskinfo : list)
1516  {
1517  line = QString(" ") + diskinfo;
1518  AddLogLine(line, machineStr);
1519  }
1520  }
1521 
1522 }
1523 
1525 {
1526  if (m_iconState)
1527  m_iconState->DisplayState("decoders");
1528  m_logList->Reset();
1529  QString displayhelp = tr("Available hardware decoders for video playback.");
1530  if (m_helpText)
1531  m_helpText->SetText(displayhelp);
1532  if (m_justHelpText)
1533  m_justHelpText->SetText(displayhelp);
1534 
1535  QStringList decoders = MythCodecContext::GetDecoderDescription();
1536  if (decoders.isEmpty())
1537  {
1538  AddLogLine(tr("None"));
1539  }
1540  else
1541  {
1542  for (const QString & decoder : qAsConst(decoders))
1543  AddLogLine(decoder);
1544  }
1545 }
1546 
1548 {
1549  if (m_iconState)
1550  m_iconState->DisplayState("display");
1551  m_logList->Reset();
1552  QString displayhelp = tr("Display and rendering information.");
1553  if (m_helpText)
1554  m_helpText->SetText(displayhelp);
1555  if (m_justHelpText)
1556  m_justHelpText->SetText(displayhelp);
1557 
1558  auto * window = GetMythMainWindow();
1559  QStringList desc = window->GetDisplay()->GetDescription();
1560  for (const auto & line : qAsConst(desc))
1561  AddLogLine(line);
1562  AddLogLine("");
1563 
1564  auto * render = window->GetRenderDevice();
1565  if (render && render->Type() == kRenderOpenGL)
1566  {
1567  auto * opengl = dynamic_cast<MythRenderOpenGL*>(render);
1568  if (opengl && (opengl->GetExtraFeatures() & kGLNVMemory))
1569  {
1570  auto GetGPUMem = []()
1571  {
1572  auto * rend = GetMythMainWindow()->GetRenderDevice();
1573  if (auto * gl = dynamic_cast<MythRenderOpenGL*>(rend); gl != nullptr)
1574  return gl->GetGPUMemory();
1575  return std::tuple<int,int,int> { 0, 0, 0 };
1576  };
1577  auto UpdateUsed = [&GetGPUMem](StatusBoxItem* Item)
1578  {
1579  auto mem = GetGPUMem();
1580  int total = std::get<0>(mem);
1581  if (total > 0)
1582  {
1583  int avail = std::get<2>(mem);
1584  Item->SetText(tr("GPU memory used : %1MB").arg(total - avail));
1585  }
1586  };
1587 
1588  auto UpdateFree = [&GetGPUMem](StatusBoxItem* Item)
1589  {
1590  auto mem = GetGPUMem();
1591  int total = std::get<0>(mem);
1592  if (total > 0)
1593  {
1594  int avail = std::get<2>(mem);
1595  int percent = static_cast<int>((avail / static_cast<float>(total) * 100.0F));
1596  Item->SetText(tr("GPU memory free : %1MB (or %2%)").arg(avail).arg(percent));
1597  }
1598  };
1599 
1600  auto current = GetGPUMem();
1601  // Total and dedicated will not change
1602  AddLogLine(tr("GPU memory total : %1MB").arg(std::get<0>(current)));
1603  AddLogLine(tr("GPU memory dedicated: %1MB").arg(std::get<1>(current)));
1604  auto * used = AddLogLine("");
1605  auto * freemem = AddLogLine("");
1606  UpdateUsed(used);
1607  UpdateFree(freemem);
1608  connect(used, &StatusBoxItem::UpdateRequired, UpdateUsed);
1609  connect(freemem, &StatusBoxItem::UpdateRequired, UpdateFree);
1610  used->Start();
1611  freemem->Start();
1612  }
1613 
1614  desc = render->GetDescription();
1615  for (const auto & line : qAsConst(desc))
1616  AddLogLine(line);
1617  }
1618 }
1619 
1623 void StatusBox::doAutoExpireList(bool updateExpList)
1624 {
1625  if (m_iconState)
1626  m_iconState->DisplayState("autoexpire");
1627  m_logList->Reset();
1628 
1629  QString helpmsg(tr("The AutoExpire List shows all recordings "
1630  "which may be expired and the order of "
1631  "their expiration. Recordings at the top "
1632  "of the list will be expired first."));
1633  if (m_helpText)
1634  m_helpText->SetText(helpmsg);
1635  if (m_justHelpText)
1636  m_justHelpText->SetText(helpmsg);
1637 
1638  QString contentLine;
1639  QString detailInfo;
1640  QString staticInfo;
1641  long long totalSize(0);
1642  long long liveTVSize(0);
1643  int liveTVCount(0);
1644  long long deletedGroupSize(0);
1645  int deletedGroupCount(0);
1646 
1647  vector<ProgramInfo *>::iterator it;
1648 
1649  if (updateExpList)
1650  {
1651  for (it = m_expList.begin(); it != m_expList.end(); ++it)
1652  delete *it;
1653  m_expList.clear();
1654 
1656  }
1657 
1658  for (it = m_expList.begin(); it != m_expList.end(); ++it)
1659  {
1660  ProgramInfo *pginfo = *it;
1661 
1662  totalSize += pginfo->GetFilesize();
1663  if (pginfo->GetRecordingGroup() == "LiveTV")
1664  {
1665  liveTVSize += pginfo->GetFilesize();
1666  liveTVCount++;
1667  }
1668  else if (pginfo->GetRecordingGroup() == "Deleted")
1669  {
1670  deletedGroupSize += pginfo->GetFilesize();
1671  deletedGroupCount++;
1672  }
1673  }
1674 
1675  staticInfo = tr("%n recording(s) consuming %1 (is) allowed to expire\n", "",
1676  m_expList.size()).arg(sm_str(totalSize / 1024));
1677 
1678  if (liveTVCount)
1679  staticInfo += tr("%n (is) LiveTV and consume(s) %1\n", "", liveTVCount)
1680  .arg(sm_str(liveTVSize / 1024));
1681 
1682  if (deletedGroupCount)
1683  {
1684  staticInfo += tr("%n (is) Deleted and consume(s) %1\n", "",
1685  deletedGroupCount)
1686  .arg(sm_str(deletedGroupSize / 1024));
1687  }
1688 
1689  for (it = m_expList.begin(); it != m_expList.end(); ++it)
1690  {
1691  ProgramInfo *pginfo = *it;
1692  QDateTime starttime = pginfo->GetRecordingStartTime();
1693  QDateTime endtime = pginfo->GetRecordingEndTime();
1694  contentLine =
1696  starttime, MythDate::kDateFull | MythDate::kSimplify) + " - ";
1697 
1698  contentLine +=
1699  "(" + ProgramInfo::i18n(pginfo->GetRecordingGroup()) + ") ";
1700 
1701  contentLine += pginfo->GetTitle() +
1702  " (" + sm_str(pginfo->GetFilesize() / 1024) + ")";
1703 
1704  detailInfo =
1707  " - " +
1710 
1711  detailInfo += " (" + sm_str(pginfo->GetFilesize() / 1024) + ")";
1712 
1713  detailInfo += " (" + ProgramInfo::i18n(pginfo->GetRecordingGroup()) + ")";
1714 
1715  detailInfo += "\n" + pginfo->toString(ProgramInfo::kTitleSubtitle, " - ");
1716 
1717  AddLogLine(contentLine, staticInfo, detailInfo,
1718  staticInfo + detailInfo);
1719  }
1720 }
1721 
1723 
1724 /* vim: set expandtab tabstop=4 shiftwidth=4: */
filesysteminfo.h
MSqlQuery::isActive
bool isActive(void) const
Definition: mythdbcon.h:204
MSqlQuery::next
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
Definition: mythdbcon.cpp:783
RecStatus::Type
Type
Definition: recStatus.h:16
MSqlQuery
QSqlQuery wrapper that fetches a DB connection from the connection pool.
Definition: mythdbcon.h:125
RecStatus::LaterShowing
@ LaterShowing
Definition: recStatus.h:40
MythUIButtonList::GetTopItemPos
int GetTopItemPos(void) const
Definition: mythuibuttonlist.h:200
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(GrabberScript *)
RecordingInfo::kDefaultRecGroup
@ kDefaultRecGroup
Definition: recordinginfo.h:190
MythDate::toString
QString toString(const QDateTime &raw_dt, uint format)
Returns formatted string representing the time.
Definition: mythdate.cpp:80
tv.h
MSqlQuery::size
int size(void) const
Definition: mythdbcon.h:203
MythUIButtonList::GetItemCurrent
MythUIButtonListItem * GetItemCurrent() const
Definition: mythuibuttonlist.cpp:1590
hardwareprofile.smolt.timeout
float timeout
Definition: smolt.py:103
ProgramInfo::GetFilesize
virtual uint64_t GetFilesize(void) const
Definition: programinfo.cpp:6162
kGLNVMemory
@ kGLNVMemory
Definition: mythrenderopengl.h:48
mythuitext.h
VID_HDTV
@ VID_HDTV
Definition: programtypes.h:188
LoadFromScheduler
bool LoadFromScheduler(AutoDeleteDeque< TYPE * > &destination, bool &hasConflicts, const QString &altTable="", int recordid=-1)
Definition: programinfo.h:883
mythdb.h
MythCoreContext::SendReceiveStringList
bool SendReceiveStringList(QStringList &strlist, bool quickTimeout=false, bool block=true)
Send a message to the backend and wait for a response.
Definition: mythcorecontext.cpp:1380
StatusBox::Init
void Init(void) override
Used after calling Load() to assign data to widgets and other UI initilisation which is prohibited in...
Definition: statusbox.cpp:110
MythDate::as_utc
QDateTime as_utc(const QDateTime &old_dt)
Returns copy of QDateTime with TimeSpec set to UTC.
Definition: mythdate.cpp:23
StatusBox::doAutoExpireList
void doAutoExpireList()
Show list of recordings which may AutoExpire.
Definition: statusbox.h:66
RecStatus::Tuning
@ Tuning
Definition: recStatus.h:22
RecordingInfo
Holds information on a TV Program one might wish to record.
Definition: recordinginfo.h:34
StatusBox::getActualRecordedBPS
void getActualRecordedBPS(const QString &hostnames)
Fills in m_recordingProfilesBps w/ average bitrate from recorded table.
Definition: statusbox.cpp:1200
MythUIType::GetChild
MythUIType * GetChild(const QString &name) const
Get a named child of this UIType.
Definition: mythuitype.cpp:131
MythUIButtonList::RemoveItem
void RemoveItem(MythUIButtonListItem *item)
Definition: mythuibuttonlist.cpp:1488
ProgramInfo::GetChannelName
QString GetChannelName(void) const
This is the channel name in the local market, i.e.
Definition: programinfo.h:384
StatusBox::AddLogLine
StatusBoxItem * AddLogLine(const QString &line, const QString &help="", const QString &detail="", const QString &helpdetail="", const QString &state="", const QString &data="")
Definition: statusbox.cpp:148
StatusBoxItem::Start
void Start(int Interval=1)
Definition: statusbox.cpp:43
LogLine::m_data
QString m_data
Definition: statusbox.cpp:39
DialogCompletionEvent::kEventType
static Type kEventType
Definition: mythdialogbox.h:57
ProgramInfo::GetChanNum
QString GetChanNum(void) const
This is the channel "number", in the form 1, 1_2, 1-2, 1#1, etc.
Definition: programinfo.h:374
MythUIButtonList::itemSelected
void itemSelected(MythUIButtonListItem *item)
getLoadAvgs
loadArray getLoadAvgs(void)
Returns the system load averages.
Definition: mythmiscutil.cpp:178
ProgramInfo::kTitleSubtitle
@ kTitleSubtitle
Definition: programinfo.h:500
mythdialogbox.h
MSqlQuery::value
QVariant value(int i) const
Definition: mythdbcon.h:198
MythScreenStack
Definition: mythscreenstack.h:15
arg
arg(title).arg(filename).arg(doDelete))
MSqlQuery::exec
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
Definition: mythdbcon.cpp:603
JOB_LIST_NOT_DONE
@ JOB_LIST_NOT_DONE
Definition: jobqueue.h:63
kRenderOpenGL
@ kRenderOpenGL
Definition: mythrender_base.h:19
RemoteUndeleteRecording
bool RemoteUndeleteRecording(uint recordingID)
Definition: remoteutil.cpp:139
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:23
MythScreenType
Screen in which all other widgets are contained and rendered.
Definition: mythscreentype.h:44
mythuistatetype.h
StatusBox::doDisplayStatus
void doDisplayStatus()
Definition: statusbox.cpp:1547
statusbox.h
StatusBox::Create
bool Create(void) override
Definition: statusbox.cpp:80
JobQueue::StopJob
static bool StopJob(int jobID)
Definition: jobqueue.cpp:751
StatusBox::~StatusBox
~StatusBox(void) override
Definition: statusbox.cpp:73
MythMainWindow::GetRenderDevice
MythRender * GetRenderDevice()
Definition: mythmainwindow.cpp:289
ProgramInfo::GetRecordingEndTime
QDateTime GetRecordingEndTime(void) const
Approximate time the recording should have ended, did end, or is intended to end.
Definition: programinfo.h:410
LogLine::m_state
QString m_state
Definition: statusbox.cpp:40
ProgramInfo::GetRecordingGroup
QString GetRecordingGroup(void) const
Definition: programinfo.h:417
remoteutil.h
mythuibuttonlist.h
MythDate::kDateTimeShort
@ kDateTimeShort
Default local time.
Definition: mythdate.h:21
LogLine::m_detail
QString m_detail
Definition: statusbox.cpp:36
MythDate::current
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
Definition: mythdate.cpp:10
kState_Error
@ kState_Error
Error State, if we ever try to enter this state errored is set.
Definition: tv.h:54
ProgramInfo::GetRecordingStartTime
QDateTime GetRecordingStartTime(void) const
Approximate time the recording started.
Definition: programinfo.h:402
RemoteGetUptime
bool RemoteGetUptime(time_t &uptime)
Definition: remoteutil.cpp:54
StatusBox::keyPressEvent
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
Definition: statusbox.cpp:186
tmp
static guint32 * tmp
Definition: goom_core.cpp:31
RemoteGetLoad
bool RemoteGetLoad(system_load_array &load)
Definition: remoteutil.cpp:39
MythScreenType::GetFocusWidget
MythUIType * GetFocusWidget(void) const
Definition: mythscreentype.cpp:112
StatusBox::setHelpText
void setHelpText(MythUIButtonListItem *item)
Definition: statusbox.cpp:244
mythversion.h
StatusBox::m_categoryList
MythUIButtonList * m_categoryList
Definition: statusbox.h:82
system_load_array
std::array< double, 3 > system_load_array
Definition: remoteutil.h:17
kState_WatchingRecording
@ kState_WatchingRecording
Watching Recording is the state for when we are watching an in progress recording,...
Definition: tv.h:80
JobQueue::JobText
static QString JobText(int jobType)
Definition: jobqueue.cpp:1121
JobQueue::PauseJob
static bool PauseJob(int jobID)
Definition: jobqueue.cpp:724
RecStatus::WillRecord
@ WillRecord
Definition: recStatus.h:31
usage_str_mb
static QString usage_str_mb(float total, float used, float free)
Definition: statusbox.cpp:1132
MythUIButtonListItem
Definition: mythuibuttonlist.h:27
StatusBox::m_justHelpText
MythUIText * m_justHelpText
Definition: statusbox.h:81
kDisableAutoExpire
@ kDisableAutoExpire
Definition: programtypes.h:236
mythrenderopengl.h
MythUICallbackMF
void(QObject::*)(void) MythUICallbackMF
Definition: mythuitype.h:43
JobQueue::GetJobsInQueue
static int GetJobsInQueue(QMap< int, JobQueueEntry > &jobs, int findJobs=JOB_LIST_NOT_DONE)
Definition: jobqueue.cpp:1282
mythdate.h
mythrender_base.h
RecStatus::TooManyRecordings
@ TooManyRecordings
Definition: recStatus.h:37
mythdisplay.h
StatusBox::clicked
void clicked(MythUIButtonListItem *item)
Definition: statusbox.cpp:277
StatusBox::m_recordingProfilesBps
recprof2bps_t m_recordingProfilesBps
Definition: statusbox.h:86
mythlogging.h
FileSystemInfo::RemoteGetInfo
static QList< FileSystemInfo > RemoteGetInfo(MythSocket *sock=nullptr)
Definition: filesysteminfo.cpp:143
StatusBox::doListingsStatus
void doListingsStatus()
Definition: statusbox.cpp:516
MythUIButtonList::itemClicked
void itemClicked(MythUIButtonListItem *item)
StatusBox::updateLogList
void updateLogList(MythUIButtonListItem *item)
Definition: statusbox.cpp:256
MythMainWindow::TranslateKeyPress
bool TranslateKeyPress(const QString &Context, QKeyEvent *Event, QStringList &Actions, bool AllowJumps=true)
Get a list of actions for a keypress in the given context.
Definition: mythmainwindow.cpp:1114
MythUIButtonList::GetCurrentPos
int GetCurrentPos() const
Definition: mythuibuttonlist.h:198
kTemplateRecord
@ kTemplateRecord
Definition: recordingtypes.h:32
MythDialogBox
Basic menu dialog, message and a list of options.
Definition: mythdialogbox.h:166
StatusBox::doJobQueueStatus
void doJobQueueStatus()
Definition: statusbox.cpp:1007
ProgramInfo::GetTitle
QString GetTitle(void) const
Definition: programinfo.h:359
MSqlQuery::InitCon
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
Definition: mythdbcon.cpp:535
JobQueue::GetJobStatus
static enum JobStatus GetJobStatus(int jobID)
Definition: jobqueue.cpp:1528
MythDB::DBError
static void DBError(const QString &where, const MSqlQuery &query)
Definition: mythdb.cpp:178
MythFormatTime
QString MythFormatTime(int secs, const QString &fmt)
Format a seconds time value.
Definition: mythmiscutil.cpp:1238
MythScreenType::BuildFocusList
void BuildFocusList(void)
Definition: mythscreentype.cpp:222
RecStatus::Failing
@ Failing
Definition: recStatus.h:18
StatusBox::StatusBox
StatusBox(MythScreenStack *parent)
Definition: statusbox.cpp:58
StatusBox::doTunerStatus
void doTunerStatus()
Definition: statusbox.cpp:813
disk_usage_with_rec_time_kb
static void disk_usage_with_rec_time_kb(QStringList &out, long long total, long long used, long long free, const recprof2bps_t &prof2bps)
Definition: statusbox.cpp:1138
RecStatus::Conflict
@ Conflict
Definition: recStatus.h:39
ProgramInfo::toString
QString toString(Verbosity v=kLongDescription, const QString &sep=":", const QString &grp="\"") const
Definition: programinfo.cpp:1832
loadArray
std::array< double, 3 > loadArray
Definition: mythmiscutil.h:36
f
QTextStream t & f
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:603
jobqueue.h
kNoSearch
@ kNoSearch
Definition: recordingtypes.h:73
uptimeStr
static QString uptimeStr(time_t uptime)
Definition: statusbox.cpp:1175
MythUIButtonListItem::GetData
QVariant GetData()
Definition: mythuibuttonlist.cpp:3580
uint
unsigned int uint
Definition: compat.h:141
StatusBox::doDecoderStatus
void doDecoderStatus()
Definition: statusbox.cpp:1524
ONEDAYINSEC
#define ONEDAYINSEC
Definition: mythmiscutil.h:113
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:60
StatusBox::m_logList
MythUIButtonList * m_logList
Definition: statusbox.h:83
StatusBox::updateLog
void updateLog()
ProgramInfo::i18n
static QString i18n(const QString &msg)
Translations for play,recording, & storage groups +.
Definition: programinfo.cpp:5203
MythCoreContext::GetNumSetting
int GetNumSetting(const QString &key, int defaultval=0)
Definition: mythcorecontext.cpp:933
GetMythSourcePath
const char * GetMythSourcePath()
Definition: mythcoreutil.cpp:318
getUptime
bool getUptime(time_t &uptime)
Returns uptime statistics.
Definition: mythmiscutil.cpp:68
RemoteGetMemStats
bool RemoteGetMemStats(int &totalMB, int &freeMB, int &totalVM, int &freeVM)
Definition: remoteutil.cpp:74
MythDate::fromString
QDateTime fromString(const QString &dtstr)
Converts kFilename && kISODate formats to QDateTime.
Definition: mythdate.cpp:30
JobQueue::DeleteJob
static bool DeleteJob(int jobID)
Definition: jobqueue.cpp:881
RecStatus::Pending
@ Pending
Definition: recStatus.h:17
ADD_STATUS_LOG_LINE
#define ADD_STATUS_LOG_LINE(rtype, fstate)
MythDate::kSimplify
@ kSimplify
Do Today/Yesterday/Tomorrow transform.
Definition: mythdate.h:23
MythUIButtonListItem::GetText
QString GetText(const QString &name="") const
Definition: mythuibuttonlist.cpp:3305
AutoDeleteDeque< ProgramInfo * >
MythCodecContext::GetDecoderDescription
static QStringList GetDecoderDescription(void)
Definition: mythcodeccontext.cpp:115
sStatus_Undefined
@ sStatus_Undefined
A slave's sleep status is undefined when it has never connected to the master backend or is not able ...
Definition: tv.h:117
mythuihelper.h
MythRenderOpenGL
Definition: mythrenderopengl.h:96
recordinginfo.h
ProgramInfo::GetChanID
uint GetChanID(void) const
This is the unique key used in the database to locate tuning information.
Definition: programinfo.h:370
RemoteGetAllExpiringRecordings
void RemoteGetAllExpiringRecordings(vector< ProgramInfo * > &expiringlist)
Definition: remoteutil.cpp:168
ProgramInfo
Holds information on recordings and videos.
Definition: programinfo.h:67
MythUIText
All purpose text widget, displays a text string.
Definition: mythuitext.h:30
MythScreenType::keyPressEvent
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
Definition: mythscreentype.cpp:414
mythmiscutil.h
RecStatus::Recording
@ Recording
Definition: recStatus.h:30
StatusBox::m_popupStack
MythScreenStack * m_popupStack
Definition: statusbox.h:90
MythConfirmationDialog
Dialog asking for user confirmation. Ok and optional Cancel button.
Definition: mythdialogbox.h:271
mythcorecontext.h
XMLParseBase::LoadWindowFromXML
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
Definition: xmlparsebase.cpp:692
cardutil.h
StatusBox::m_helpText
MythUIText * m_helpText
Definition: statusbox.h:80
MSqlQuery::bindValue
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
Definition: mythdbcon.cpp:864
DialogCompletionEvent
Event dispatched from MythUI modal dialogs to a listening class containing a result of some form.
Definition: mythdialogbox.h:41
recprof2bps_t
QMap< QString, unsigned int > recprof2bps_t
Definition: statusbox.h:21
StatusBoxItem
Definition: statusbox.h:23
RecStatus::NotListed
@ NotListed
Definition: recStatus.h:38
MythUIText::SetText
virtual void SetText(const QString &text)
Definition: mythuitext.cpp:133
LogLine::m_line
QString m_line
Definition: statusbox.cpp:35
StatusBox::doLogEntries
void doLogEntries()
Definition: statusbox.cpp:952
MythUIButtonList::Reset
void Reset() override
Reset the widget to it's original state, should not reset changes made by the theme.
Definition: mythuibuttonlist.cpp:114
GetMythMainWindow
MythMainWindow * GetMythMainWindow(void)
Definition: mythmainwindow.cpp:104
kState_WatchingLiveTV
@ kState_WatchingLiveTV
Watching LiveTV is the state for when we are watching a recording and the user has control over the c...
Definition: tv.h:63
MythUIButtonList::SetItemCurrent
void SetItemCurrent(MythUIButtonListItem *item)
Definition: mythuibuttonlist.cpp:1557
build_compdb.action
action
Definition: build_compdb.py:9
JobQueue::ResumeJob
static bool ResumeJob(int jobID)
Definition: jobqueue.cpp:733
build_compdb.help
help
Definition: build_compdb.py:10
MythMainWindow::GetStack
MythScreenStack * GetStack(const QString &Stackname)
Definition: mythmainwindow.cpp:320
MythDate::kDateFull
@ kDateFull
Default local time.
Definition: mythdate.h:16
GetMythSourceVersion
const char * GetMythSourceVersion()
Definition: mythcoreutil.cpp:313
mythcodeccontext.h
MythCoreContext::GetHostName
QString GetHostName(void)
Definition: mythcorecontext.cpp:859
getMemStats
bool getMemStats(int &totalMB, int &freeMB, int &totalVM, int &freeVM)
Returns memory statistics in megabytes.
Definition: mythmiscutil.cpp:111
JOB_LIST_RECENT
@ JOB_LIST_RECENT
Definition: jobqueue.h:65
StatusBox::m_iconState
MythUIStateType * m_iconState
Definition: statusbox.h:84
MythUICallbackMFc
void(QObject::*)(void) const MythUICallbackMFc
Definition: mythuitype.h:44
MythDate::kDateTimeFull
@ kDateTimeFull
Default local time.
Definition: mythdate.h:20
RecStatus::toString
static QString toString(Type recstatus, uint id)
Converts "recstatus" into a short (unreadable) string.
Definition: recStatus.cpp:39
usage_str_kb
static QString usage_str_kb(long long total, long long used, long long free)
Definition: statusbox.cpp:1117
StatusBox::doScheduleStatus
void doScheduleStatus()
Definition: statusbox.cpp:609
MythCoreContext::SaveSetting
void SaveSetting(const QString &key, int newValue)
Definition: mythcorecontext.cpp:902
StatusBox::m_expList
std::vector< ProgramInfo * > m_expList
Definition: statusbox.h:88
RecordingInfo::ApplyRecordRecGroupChange
void ApplyRecordRecGroupChange(const QString &newrecgroup)
Sets the recording group, both in this RecordingInfo and in the database.
Definition: recordinginfo.cpp:600
StatusBox::customEvent
void customEvent(QEvent *event) override
Definition: statusbox.cpp:392
jobID
int jobID
Definition: mythtv/programs/mythcommflag/main.cpp:84
MythUIButtonList
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
Definition: mythuibuttonlist.h:151
JOB_LIST_ERROR
@ JOB_LIST_ERROR
Definition: jobqueue.h:64
JobQueue::ChangeJobStatus
static bool ChangeJobStatus(int jobID, int newStatus, const QString &comment="")
Definition: jobqueue.cpp:992
StatusBoxItem::UpdateRequired
void UpdateRequired(StatusBoxItem *Item)
RecStatus::LowDiskSpace
@ LowDiskSpace
Definition: recStatus.h:25
RemoteDeleteRecording
bool RemoteDeleteRecording(uint recordingID, bool forceMetadataDelete, bool forgetHistory)
Definition: remoteutil.cpp:110
sm_str
static QString sm_str(long long sizeKB, int prec=1)
Returns a short string describing an amount of space, choosing one of a number of useful units,...
Definition: statusbox.cpp:1096
MythScreenStack::AddScreen
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
Definition: mythscreenstack.cpp:52
query
MSqlQuery query(MSqlQuery::InitCon())
LogLine::m_helpdetail
QString m_helpdetail
Definition: statusbox.cpp:38
kState_RecordingOnly
@ kState_RecordingOnly
Recording Only is a TVRec only state for when we are recording a program, but there is no one current...
Definition: tv.h:84
LogLine
Definition: statusbox.cpp:34
StatusBox::m_minLevel
int m_minLevel
Definition: statusbox.h:92
StatusBox::m_isBackendActive
bool m_isBackendActive
Definition: statusbox.h:94
MythUIStateType
This widget is used for grouping other widgets for display when a particular named state is called....
Definition: mythuistatetype.h:22
LogLine::m_help
QString m_help
Definition: statusbox.cpp:37
AutoDeleteDeque::size
size_t size(void) const
Definition: autodeletedeque.h:67
JobQueue::StatusText
static QString StatusText(int status)
Definition: jobqueue.cpp:1140
StatusBox::doMachineStatus
void doMachineStatus()
Show machine status.
Definition: statusbox.cpp:1256
MythUIStateType::DisplayState
bool DisplayState(const QString &name)
Definition: mythuistatetype.cpp:84
MythCoreContext::GetSetting
QString GetSetting(const QString &key, const QString &defaultval="")
Definition: mythcorecontext.cpp:919
MSqlQuery::prepare
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.
Definition: mythdbcon.cpp:808
ProgramInfo::GetSubtitle
QString GetSubtitle(void) const
Definition: programinfo.h:361