MythTV  master
channelscanner_gui_scan_pane.cpp
Go to the documentation of this file.
1 /* -*- Mode: c++ -*-
2  * vim: set expandtab tabstop=4 shiftwidth=4:
3  *
4  * Original Project
5  * MythTV http://www.mythtv.org
6  *
7  * Copyright (c) 2004, 2005 John Pullan <john@pullan.org>
8  * Copyright (c) 2005 - 2007 Daniel Kristjansson
9  *
10  * Description:
11  * Collection of classes to provide channel scanning functionallity
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
26  * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
27  *
28  */
29 
31 #include "libmythui/mythuibutton.h"
34 #include "libmythui/mythuitext.h"
35 
37 
39 {
40  if (!XMLParseBase::LoadWindowFromXML("config-ui.xml", "channelscanner",
41  this))
42  {
43  LOG(VB_GENERAL, LOG_ERR, "Failed to load channelscanner screen");
44  return false;
45  }
46 
47  bool error = false;
48  UIUtilE::Assign(this, m_statusText, "status", &error);
49  UIUtilE::Assign(this, m_log, "log", &error);
50 
51  UIUtilE::Assign(this, m_progressBar, "scanprogress", &error);
52  if (error)
53  return false;
54 
55  // Percent done
56  UIUtilW::Assign(this, m_progressText, "progresstext");
57  // Found status
58  UIUtilW::Assign(this, m_scanProgressText, "scanprogresstext");
59 
60  UIUtilW::Assign(this, m_signalLockedText, "signallock");
63 
64  UIUtilW::Assign(this, m_rotatorPositionText, "rotorprogresstext");
67 
68  UIUtilW::Assign(this, m_rotatorPositionBar, "rotorprogressbar");
70  {
73  }
74 
75  UIUtilW::Assign(this, m_signalStrengthText, "signalstrengthtext");
78 
79  UIUtilW::Assign(this, m_signalStrengthBar, "signalstrength");
81  {
84  }
85 
86  UIUtilW::Assign(this, m_signalNoiseText, "signalnoisetext");
89 
90  UIUtilW::Assign(this, m_signalNoiseBar, "signalnoise");
91  if (m_signalNoiseBar)
92  {
94  m_signalNoiseBar->SetTotal(65535);
95  }
96 
97  m_statusText->SetText(tr("Tuning"));
98  m_progressBar->SetTotal(65535);
99 
100  MythUIButton *exitButton = nullptr;
101  UIUtilW::Assign(this, exitButton, "exit");
102  if (exitButton)
103  connect(exitButton, &MythUIButton::Clicked, this, &MythScreenType::Close);
104 
105  BuildFocusList();
106 
107  return true;
108 }
109 
111 {
113  m_rotatorPositionText->SetText(QString("%1%")
114  .arg(static_cast<uint>(value * 100 / 65535)));
117 }
118 
120 {
121  if (m_signalNoiseText)
122  m_signalNoiseText->SetText(QString("%1%")
123  .arg(static_cast<uint>(value * 100 / 65535)));
124  if (m_signalNoiseBar)
125  m_signalNoiseBar->SetUsed(value);
126 }
127 
129 {
131  m_signalStrengthText->SetText(QString("%1%")
132  .arg(static_cast<uint>(value * 100 / 65535)));
135 }
136 
138 {
139  if (m_signalLockedText)
140  m_signalLockedText->SetText((value) ? tr("Locked") : tr("No Lock"));
141 }
142 
144 {
145  if (m_statusText)
146  m_statusText->SetText(value);
147 }
148 
150 {
151  if (m_scanProgressText)
152  m_scanProgressText->SetText(tr("%1").arg(value));
153 }
154 
155 void ChannelScannerGUIScanPane::AppendLine(const QString &text)
156 {
157  if (m_log)
158  {
159  auto *listItem = new MythUIButtonListItem(m_log, text);
160  m_log->SetItemCurrent(listItem);
161  }
162 }
163 
165 {
166  if (m_progressText)
167  m_progressText->SetText(QString("%1%")
168  .arg(static_cast<uint>(value * 100)));
169  if (m_progressBar)
170  m_progressBar->SetUsed(static_cast<uint>(value * 65535));
171 }
MythUIButton::Clicked
void Clicked()
ChannelScannerGUIScanPane::m_showRotorPos
bool m_showRotorPos
Definition: channelscanner_gui_scan_pane.h:70
mythuitext.h
mythuiprogressbar.h
ChannelScannerGUIScanPane::m_statusText
MythUIText * m_statusText
Definition: channelscanner_gui_scan_pane.h:77
ChannelScannerGUIScanPane::m_progressBar
MythUIProgressBar * m_progressBar
Definition: channelscanner_gui_scan_pane.h:75
error
static void error(const char *str,...)
Definition: vbi.cpp:37
MythScreenType::Close
virtual void Close()
Definition: mythscreentype.cpp:383
ChannelScannerGUIScanPane::m_rotatorPositionText
MythUIText * m_rotatorPositionText
Definition: channelscanner_gui_scan_pane.h:82
ChannelScannerGUIScanPane::m_showSignalNoise
bool m_showSignalNoise
Definition: channelscanner_gui_scan_pane.h:69
MythUIProgressBar::SetUsed
void SetUsed(int value)
Definition: mythuiprogressbar.cpp:72
ChannelScannerGUIScanPane::m_progressText
MythUIText * m_progressText
Definition: channelscanner_gui_scan_pane.h:83
ChannelScannerGUIScanPane::m_scanProgressText
MythUIText * m_scanProgressText
Definition: channelscanner_gui_scan_pane.h:78
ChannelScannerGUIScanPane::AppendLine
void AppendLine(const QString &text)
Definition: channelscanner_gui_scan_pane.cpp:155
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:39
mythuibuttonlist.h
ChannelScannerGUIScanPane::m_signalLockedText
MythUIText * m_signalLockedText
Definition: channelscanner_gui_scan_pane.h:79
ChannelScannerGUIScanPane::m_rotatorPositionBar
MythUIProgressBar * m_rotatorPositionBar
Definition: channelscanner_gui_scan_pane.h:74
MythUIButtonListItem
Definition: mythuibuttonlist.h:41
ChannelScannerGUIScanPane::SetStatusSignalStrength
void SetStatusSignalStrength(int value)
Definition: channelscanner_gui_scan_pane.cpp:128
MythUIProgressBar::SetTotal
void SetTotal(int value)
Definition: mythuiprogressbar.cpp:78
ChannelScannerGUIScanPane::SetStatusText
void SetStatusText(const QString &value)
Definition: channelscanner_gui_scan_pane.cpp:143
ChannelScannerGUIScanPane::SetStatusSignalToNoise
void SetStatusSignalToNoise(int value)
Definition: channelscanner_gui_scan_pane.cpp:119
mythlogging.h
ChannelScannerGUIScanPane::SetScanProgress
void SetScanProgress(double value)
Definition: channelscanner_gui_scan_pane.cpp:164
ChannelScannerGUIScanPane::m_signalNoiseBar
MythUIProgressBar * m_signalNoiseBar
Definition: channelscanner_gui_scan_pane.h:73
MythScreenType::BuildFocusList
void BuildFocusList(void)
Definition: mythscreentype.cpp:203
MythUIButton
A single button widget.
Definition: mythuibutton.h:21
uint
unsigned int uint
Definition: compat.h:81
ChannelScannerGUIScanPane::m_showSignalLock
bool m_showSignalLock
Definition: channelscanner_gui_scan_pane.h:67
ChannelScannerGUIScanPane::SetStatusRotorPosition
void SetStatusRotorPosition(int value)
Definition: channelscanner_gui_scan_pane.cpp:110
UIUtilDisp::Assign
static bool Assign(ContainerType *container, UIType *&item, const QString &name, bool *err=nullptr)
Definition: mythuiutils.h:27
ChannelScannerGUIScanPane::m_signalStrengthBar
MythUIProgressBar * m_signalStrengthBar
Definition: channelscanner_gui_scan_pane.h:72
ChannelScannerGUIScanPane::m_showSignalStrength
bool m_showSignalStrength
Definition: channelscanner_gui_scan_pane.h:68
ChannelScannerGUIScanPane::SetStatusTitleText
void SetStatusTitleText(const QString &value)
Definition: channelscanner_gui_scan_pane.cpp:149
XMLParseBase::LoadWindowFromXML
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
Definition: xmlparsebase.cpp:687
ChannelScannerGUIScanPane::Create
bool Create() override
Definition: channelscanner_gui_scan_pane.cpp:38
MythUIText::SetText
virtual void SetText(const QString &text)
Definition: mythuitext.cpp:115
MythUIType::SetVisible
virtual void SetVisible(bool visible)
Definition: mythuitype.cpp:1105
MythUIButtonList::SetItemCurrent
void SetItemCurrent(MythUIButtonListItem *item)
Definition: mythuibuttonlist.cpp:1581
ChannelScannerGUIScanPane::m_signalStrengthText
MythUIText * m_signalStrengthText
Definition: channelscanner_gui_scan_pane.h:80
ChannelScannerGUIScanPane::m_log
MythUIButtonList * m_log
Definition: channelscanner_gui_scan_pane.h:85
mythuibutton.h
ChannelScannerGUIScanPane::SetStatusLock
void SetStatusLock(int value)
Definition: channelscanner_gui_scan_pane.cpp:137
MythUIProgressBar::SetVisible
void SetVisible(bool visible) override
Definition: mythuiprogressbar.cpp:193
ChannelScannerGUIScanPane::m_signalNoiseText
MythUIText * m_signalNoiseText
Definition: channelscanner_gui_scan_pane.h:81
channelscanner_gui_scan_pane.h