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// C++
33#include <ranges>
34
35// Qt headers
36#include <QString>
37#include <QObject>
38
39// MythTV headers
42#include "scaninfo.h"
43
45{
46 Q_DECLARE_TR_FUNCTIONS(PaneExistingScanImport)
47
48 public:
49 PaneExistingScanImport(const QString &target, StandardSetting *setting) :
51 {
52 setVisible(false);
53 m_scanSelect->setLabel(tr("Scan to Import"));
54 setting->addTargetedChildren(target, {this, m_scanSelect});
55 }
56
57 void Load(void) override // GroupSetting
58 {
60 if (!m_sourceid)
61 return;
62
63 std::vector<ScanInfo> scans = LoadScanList(m_sourceid);
64 for (auto & scan : std::ranges::reverse_view(scans))
65 {
66 QString scanDate = MythDate::toString(scan.m_scandate, MythDate::kDateTimeFull);
67 QString proc = (scan.m_processed) ? tr("processed") : tr("unprocessed");
68
70 QString("%1 %2").arg(scanDate, proc),
71 QString::number(scan.m_scanid));
72 }
73 }
74
75 void SetSourceID(uint sourceid)
76 {
77 m_sourceid = sourceid;
78 Load();
79 }
80
81 uint GetScanID(void) const { return m_scanSelect->getValue().toUInt(); }
82
83 private:
86};
87
88#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:60
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