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(tr("%1%")
113  .arg(static_cast<uint>(value * 100 / 65535)));
116 }
117 
119 {
120  if (m_signalNoiseText)
121  m_signalNoiseText->SetText(tr("%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(tr("%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(tr("%1%")
167  .arg(static_cast<uint>(value * 100)));
168  if (m_progressBar)
169  m_progressBar->SetUsed(static_cast<uint>(value * 65535));
170 }
void SetStatusText(const QString &value)
void SetVisible(bool visible) override
static void error(const char *str,...)
Definition: vbi.c:42
void SetStatusTitleText(const QString &value)
virtual void SetText(const QString &text)
Definition: mythuitext.cpp:135
void BuildFocusList(void)
virtual void Close()
virtual void SetVisible(bool visible)
static bool Assign(ContainerType *container, UIType *&item, const QString &name, bool *err=nullptr)
Definition: mythuiutils.h:27
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
A single button widget.
Definition: mythuibutton.h:21
#define LOG(_MASK_, _LEVEL_, _STRING_)
Definition: mythlogging.h:41
void SetItemCurrent(MythUIButtonListItem *item)