MythTV  master
restoredata.h
Go to the documentation of this file.
1 /*
2  * $Id$
3  * vim: set expandtab tabstop=4 shiftwidth=4:
4  *
5  * Original Project
6  * MythTV http://www.mythtv.org
7  *
8  *
9  * Description:
10  * Postprocessing of channelscan result
11  *
12  * When all channels are deleted and a new scan is done then
13  * all the non-scanned data is lost.
14  * This are the following fields:
15  * xmltvid Channel identification for XMLTV including Schedules Direct
16  * iconpath File name of icon for this channel
17  * visible Visible status
18  * When a channel is deleted it is not immediately deleted from the database;
19  * it is kept for a while with the "deleted" field set to the date at which it
20  * is deleted.
21  * This makes it possible to retrieve this data from the deleted records
22  * when the same channel is found again in a new scan.
23  *
24  *
25  * This program is free software; you can redistribute it and/or
26  * modify it under the terms of the GNU General Public License
27  * as published by the Free Software Foundation; either version 2
28  * of the License, or (at your option) any later version.
29  *
30  * This program is distributed in the hope that it will be useful,
31  * but WITHOUT ANY WARRANTY; without even the implied warranty of
32  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33  * GNU General Public License for more details.
34  *
35  * You should have received a copy of the GNU General Public License
36  * along with this program; if not, write to the Free Software
37  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
38  * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
39  *
40  */
41 
42 #ifndef RESTOREDATA_H
43 #define RESTOREDATA_H
44 
45 #include <vector>
46 
48 #include "libmythui/mythuigroup.h"
49 #include "libmythui/xmlparsebase.h"
50 
51 #include "cardutil.h"
52 #include "mythtvexp.h"
53 #include "videosource.h"
54 
55 class VideoSourceShow;
56 class MythUIType;
57 class RestoreXMLTVID;
58 class RestoreVisible;
59 class RestoreIcon;
60 
62 {
63  uint chanid {0};
68  QString channum;
69  QString name;
70  QString xmltvid;
71  QString icon;
72  int visible {0};
73  QString deleted;
74  bool found_xmltvid {false};
75  bool found_icon {false};
76  bool found_visible {false};
77 };
78 
79 // Page for updating the fields with non-scanned data
80 // from deleted channel data.
81 //
83 {
84  Q_OBJECT
85  public:
86  explicit RestoreData(uint sourceid, bool useGUI = true);
87  static RestoreData * getInstance(uint sourceid);
88  static void freeInstance();
89  void Load(void) override; // StandardSetting
90  void Save(void) override; // StandardSetting
91  bool doSave(void);
92  QString doRestore(bool do_xmltvid, bool do_icon, bool do_visible);
93 
94  public slots:
95  void Restore(void);
96 
97  private:
99  VideoSourceShow *m_videosource {nullptr};
100  RestoreXMLTVID *m_restoreXMLTVID {nullptr};
101  RestoreVisible *m_restoreVisible {nullptr};
102  RestoreIcon *m_restoreIcon {nullptr};
103 
104  uint m_sourceid {0};
105  bool m_useGUI {false};
106 
107  std::vector<OldChannelData> m_ocd;
108 
109  public:
110  // Return values for the API
111  int m_num_channels {0};
112  int m_num_xmltvid {0};
113  int m_num_icon {0};
114  int m_num_visible {0};
115 
116 };
117 
118 #endif // RESTOREDATA_H
RestoreData::s_Instance
static RestoreData * s_Instance
Definition: restoredata.h:98
RestoreData
Definition: restoredata.h:82
OldChannelData::found_visible
bool found_visible
Definition: restoredata.h:76
OldChannelData::sourceid
uint sourceid
Definition: restoredata.h:64
OldChannelData::channum
QString channum
Definition: restoredata.h:68
mythtvexp.h
RestoreData::m_ocd
std::vector< OldChannelData > m_ocd
Definition: restoredata.h:107
OldChannelData::visible
int visible
Definition: restoredata.h:72
OldChannelData::icon
QString icon
Definition: restoredata.h:71
StandardSetting::Load
virtual void Load(void)
Definition: standardsettings.cpp:214
OldChannelData::transportid
uint transportid
Definition: restoredata.h:66
StandardSetting::Save
virtual void Save(void)
Definition: standardsettings.cpp:233
OldChannelData::found_icon
bool found_icon
Definition: restoredata.h:75
xmlparsebase.h
OldChannelData::chanid
uint chanid
Definition: restoredata.h:63
uint
unsigned int uint
Definition: compat.h:81
OldChannelData::name
QString name
Definition: restoredata.h:69
OldChannelData::found_xmltvid
bool found_xmltvid
Definition: restoredata.h:74
mythuigroup.h
VideoSourceShow
Definition: videosource.h:76
MythUIType
The base class on which all widgets and screens are based.
Definition: mythuitype.h:85
standardsettings.h
MTV_PUBLIC
#define MTV_PUBLIC
Definition: mythtvexp.h:15
cardutil.h
RestoreXMLTVID
Definition: restoredata.cpp:58
OldChannelData
Definition: restoredata.h:61
OldChannelData::serviceid
uint serviceid
Definition: restoredata.h:65
OldChannelData::networkid
uint networkid
Definition: restoredata.h:67
OldChannelData::xmltvid
QString xmltvid
Definition: restoredata.h:70
RestoreIcon
Definition: restoredata.cpp:87
RestoreVisible
Definition: restoredata.cpp:73
videosource.h
GroupSetting
Definition: standardsettings.h:435
OldChannelData::deleted
QString deleted
Definition: restoredata.h:73