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
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
void addSelection(const QString &label, QString value=QString(), bool select=false)
PaneExistingScanImport(const QString &target, StandardSetting *setting)
void SetSourceID(uint sourceid)
TransMythUIComboBoxSetting * m_scanSelect
void addTargetedChildren(const QString &value, std::initializer_list< StandardSetting * > settings)
void setVisible(bool visible)
virtual QString getValue(void) const
virtual void setLabel(QString str)
unsigned int uint
Definition: compat.h:68
QString toString(const QDateTime &raw_dt, uint format)
Returns formatted string representing the time.
Definition: mythdate.cpp:93
@ kDateTimeFull
Default local time.
Definition: mythdate.h:23
def scan(profile, smoonURL, gate)
Definition: scan.py:54
std::vector< ScanInfo > LoadScanList(void)
Definition: scaninfo.cpp:268