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
38 #include "scaninfo.h"
39 #include "mythdate.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  vector<ScanInfo> scans = LoadScanList();
61  for (uint i = 0; i < scans.size(); i++)
62  {
63  if (scans[i].m_sourceid != m_sourceid)
64  continue;
65 
66  QString scanDate = MythDate::toString(
67  scans[i].m_scandate, MythDate::kDateTimeFull);
68  QString proc = (scans[i].m_processed) ?
69  tr("processed") : tr("unprocessed");
70 
72  QString("%1 %2").arg(scanDate).arg(proc),
73  QString::number(scans[i].m_scanid));
74  }
75  }
76 
77  void SetSourceID(uint sourceid)
78  {
79  m_sourceid = sourceid;
80  Load();
81  }
82 
83  uint GetScanID(void) const { return m_scanSelect->getValue().toUInt(); }
84 
85  private:
88 };
89 
90 #endif // _PANE_EXISTING_SCAN_IMPORT_H_
vector< ScanInfo > LoadScanList(void)
Definition: scaninfo.cpp:249
TransMythUIComboBoxSetting * m_scanSelect
void addSelection(const QString &label, QString value=QString(), bool select=false)
unsigned int uint
Definition: compat.h:140
PaneExistingScanImport(const QString &target, StandardSetting *setting)
virtual QString getValue(void) const
virtual void setLabel(QString str)
QString toString(const QDateTime &raw_dt, uint format)
Returns formatted string representing the time.
Definition: mythdate.cpp:101
void setVisible(bool visible)
void addTargetedChildren(const QString &value, std::initializer_list< StandardSetting * > settings)
Default local time.
Definition: mythdate.h:20
void SetSourceID(uint sourceid)