MythTV  master
paneexistingscanimport.h
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) 2008 Daniel Kristjansson
8  *
9  * Description:
10  * Collection of classes to provide channel scanning functionallity
11  *
12  * This program is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU General Public License
14  * as published by the Free Software Foundation; either version 2
15  * of the License, or (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25  * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
26  *
27  */
28 
29 #ifndef PANE_EXISTING_SCAN_IMPORT_H
30 #define PANE_EXISTING_SCAN_IMPORT_H
31 
32 // Qt headers
33 #include <QString>
34 #include <QObject>
35 
36 // MythTV headers
37 #include "libmythbase/mythdate.h"
39 #include "scaninfo.h"
40 
42 {
43  Q_DECLARE_TR_FUNCTIONS(PaneExistingScanImport)
44 
45  public:
46  PaneExistingScanImport(const QString &target, StandardSetting *setting) :
48  {
49  setVisible(false);
50  m_scanSelect->setLabel(tr("Scan to Import"));
51  setting->addTargetedChildren(target, {this, m_scanSelect});
52  }
53 
54  void Load(void) override // GroupSetting
55  {
57  if (!m_sourceid)
58  return;
59 
60  std::vector<ScanInfo> scans = LoadScanList(m_sourceid);
61  for (auto it = scans.rbegin(); it != scans.rend(); ++it)
62  {
63  ScanInfo &scan = *it;
64  QString scanDate = MythDate::toString(scan.m_scandate, MythDate::kDateTimeFull);
65  QString proc = (scan.m_processed) ? tr("processed") : tr("unprocessed");
66 
68  QString("%1 %2").arg(scanDate, proc),
69  QString::number(scan.m_scanid));
70  }
71  }
72 
73  void SetSourceID(uint sourceid)
74  {
75  m_sourceid = sourceid;
76  Load();
77  }
78 
79  uint GetScanID(void) const { return m_scanSelect->getValue().toUInt(); }
80 
81  private:
84 };
85 
86 #endif // PANE_EXISTING_SCAN_IMPORT_H
MythUIComboBoxSetting::clearSelections
void clearSelections()
Definition: standardsettings.cpp:517
MythDate::toString
QString toString(const QDateTime &raw_dt, uint format)
Returns formatted string representing the time.
Definition: mythdate.cpp:93
LoadScanList
std::vector< ScanInfo > LoadScanList(void)
Definition: scaninfo.cpp:268
TransMythUIComboBoxSetting
Definition: standardsettings.h:272
hardwareprofile.scan.scan
def scan(profile, smoonURL, gate)
Definition: scan.py:55
PaneExistingScanImport
Definition: paneexistingscanimport.h:41
PaneExistingScanImport::m_scanSelect
TransMythUIComboBoxSetting * m_scanSelect
Definition: paneexistingscanimport.h:83
mythdate.h
PaneExistingScanImport::GetScanID
uint GetScanID(void) const
Definition: paneexistingscanimport.h:79
scaninfo.h
PaneExistingScanImport::Load
void Load(void) override
Definition: paneexistingscanimport.h:54
StandardSetting::getValue
virtual QString getValue(void) const
Definition: standardsettings.h:52
channelscanmiscsettings.h
StandardSetting::setLabel
virtual void setLabel(QString str)
Definition: standardsettings.h:34
PaneExistingScanImport::PaneExistingScanImport
PaneExistingScanImport(const QString &target, StandardSetting *setting)
Definition: paneexistingscanimport.h:46
MythUIComboBoxSetting::addSelection
void addSelection(const QString &label, QString value=QString(), bool select=false)
Definition: standardsettings.cpp:502
StandardSetting::setVisible
void setVisible(bool visible)
Definition: standardsettings.cpp:59
StandardSetting
Definition: standardsettings.h:29
PaneExistingScanImport::m_sourceid
uint m_sourceid
Definition: paneexistingscanimport.h:82
MythDate::kDateTimeFull
@ kDateTimeFull
Default local time.
Definition: mythdate.h:23
StandardSetting::addTargetedChildren
void addTargetedChildren(const QString &value, std::initializer_list< StandardSetting * > settings)
Definition: standardsettings.cpp:106
ScanInfo
Definition: scaninfo.h:17
GroupSetting
Definition: standardsettings.h:435
PaneExistingScanImport::SetSourceID
void SetSourceID(uint sourceid)
Definition: paneexistingscanimport.h:73
uint
unsigned int uint
Definition: freesurround.h:24