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 "mythlogging.h"
32 #include "mythuiprogressbar.h"
33 #include "mythuitext.h"
34 #include "mythuibuttonlist.h"
35 #include "mythuibutton.h"
36 
38 {
39  if (!XMLParseBase::LoadWindowFromXML("config-ui.xml", "channelscanner",
40  this))
41  {
42  LOG(VB_GENERAL, LOG_ERR, "Failed to load channelscanner screen");
43  return false;
44  }
45 
46  bool error = false;
47  UIUtilE::Assign(this, m_statusText, "status", &error);
48  UIUtilE::Assign(this, m_log, "log", &error);
49 
50  UIUtilE::Assign(this, m_progressBar, "scanprogress", &error);
51  if (error)
52  return false;
53 
54  // Percent done
55  UIUtilW::Assign(this, m_progressText, "progresstext");
56  // Found status
57  UIUtilW::Assign(this, m_scanProgressText, "scanprogresstext");
58 
59  UIUtilW::Assign(this, m_signalLockedText, "signallock");
62 
63  UIUtilW::Assign(this, m_rotatorPositionText, "rotorprogresstext");
66 
67  UIUtilW::Assign(this, m_rotatorPositionBar, "rotorprogressbar");
69  {
72  }
73 
74  UIUtilW::Assign(this, m_signalStrengthText, "signalstrengthtext");
77 
78  UIUtilW::Assign(this, m_signalStrengthBar, "signalstrength");
80  {
83  }
84 
85  UIUtilW::Assign(this, m_signalNoiseText, "signalnoisetext");
88 
89  UIUtilW::Assign(this, m_signalNoiseBar, "signalnoise");
90  if (m_signalNoiseBar)
91  {
93  m_signalNoiseBar->SetTotal(65535);
94  }
95 
96  m_statusText->SetText(tr("Tuning"));
97  m_progressBar->SetTotal(65535);
98 
99  MythUIButton *exitButton = nullptr;
100  UIUtilW::Assign(this, exitButton, "exit");
101  if (exitButton)
102  connect(exitButton, SIGNAL(Clicked()), SLOT(Close()));
103 
104  BuildFocusList();
105 
106  return true;
107 }
108 
110 {
112  m_rotatorPositionText->SetText(QString("%1%")
113  .arg(static_cast<uint>(value * 100 / 65535)));
116 }
117 
119 {
120  if (m_signalNoiseText)
121  m_signalNoiseText->SetText(QString("%1%")
122  .arg(static_cast<uint>(value * 100 / 65535)));
123  if (m_signalNoiseBar)
124  m_signalNoiseBar->SetUsed(value);
125 }
126 
128 {
130  m_signalStrengthText->SetText(QString("%1%")
131  .arg(static_cast<uint>(value * 100 / 65535)));
134 }
135 
137 {
138  if (m_signalLockedText)
139  m_signalLockedText->SetText((value) ? tr("Locked") : tr("No Lock"));
140 }
141 
143 {
144  if (m_statusText)
145  m_statusText->SetText(value);
146 }
147 
149 {
150  if (m_scanProgressText)
151  m_scanProgressText->SetText(tr("%1").arg(value));
152 }
153 
154 void ChannelScannerGUIScanPane::AppendLine(const QString &text)
155 {
156  if (m_log)
157  {
158  auto *listItem = new MythUIButtonListItem(m_log, text);
159  m_log->SetItemCurrent(listItem);
160  }
161 }
162 
164 {
165  if (m_progressText)
166  m_progressText->SetText(QString("%1%")
167  .arg(static_cast<uint>(value * 100)));
168  if (m_progressBar)
169  m_progressBar->SetUsed(static_cast<uint>(value * 65535));
170 }
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:42
MythScreenType::Close
virtual void Close()
Definition: mythscreentype.cpp:402
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:59
arg
arg(title).arg(filename).arg(doDelete))
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:154
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:23
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:28
ChannelScannerGUIScanPane::SetStatusSignalStrength
void SetStatusSignalStrength(int value)
Definition: channelscanner_gui_scan_pane.cpp:127
MythUIProgressBar::SetTotal
void SetTotal(int value)
Definition: mythuiprogressbar.cpp:71
ChannelScannerGUIScanPane::SetStatusText
void SetStatusText(const QString &value)
Definition: channelscanner_gui_scan_pane.cpp:142
ChannelScannerGUIScanPane::SetStatusSignalToNoise
void SetStatusSignalToNoise(int value)
Definition: channelscanner_gui_scan_pane.cpp:118
mythlogging.h
ChannelScannerGUIScanPane::SetScanProgress
void SetScanProgress(double value)
Definition: channelscanner_gui_scan_pane.cpp:163
ChannelScannerGUIScanPane::m_signalNoiseBar
MythUIProgressBar * m_signalNoiseBar
Definition: channelscanner_gui_scan_pane.h:73
MythScreenType::BuildFocusList
void BuildFocusList(void)
Definition: mythscreentype.cpp:222
MythUIButton
A single button widget.
Definition: mythuibutton.h:22
uint
unsigned int uint
Definition: compat.h:140
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:109
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:148
XMLParseBase::LoadWindowFromXML
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
Definition: xmlparsebase.cpp:692
ChannelScannerGUIScanPane::Create
bool Create() override
Definition: channelscanner_gui_scan_pane.cpp:37
MythUIText::SetText
virtual void SetText(const QString &text)
Definition: mythuitext.cpp:134
MythUIType::SetVisible
virtual void SetVisible(bool visible)
Definition: mythuitype.cpp:1085
MythUIButtonList::SetItemCurrent
void SetItemCurrent(MythUIButtonListItem *item)
Definition: mythuibuttonlist.cpp:1557
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:136
MythUIProgressBar::SetVisible
void SetVisible(bool visible) override
Definition: mythuiprogressbar.cpp:186
ChannelScannerGUIScanPane::m_signalNoiseText
MythUIText * m_signalNoiseText
Definition: channelscanner_gui_scan_pane.h:81
channelscanner_gui_scan_pane.h