MythTV  master
importnative.h
Go to the documentation of this file.
1 #ifndef IMPORTNATIVE_H_
2 #define IMPORTNATIVE_H_
3 
4 #include <cstdint>
5 #include <iostream>
6 #include <utility>
7 
8 // qt
9 #include <QDateTime>
10 #include <QKeyEvent>
11 #include <QList>
12 #include <QString>
13 #include <QStringList>
14 
15 // myth
17 
18 // mytharchive
19 #include "fileselector.h"
20 
21 struct FileInfo
22 {
23  bool directory;
24  bool selected;
25  QString filename;
26  int64_t size;
27 };
28 
30 {
31  QString title;
32  QString subtitle;
33  QDateTime startTime;
34  QString description;
35  QString chanID;
36  QString chanNo;
37  QString chanName;
38  QString callsign;
39 };
40 
41 
42 class MythUIText;
43 class MythUIButton;
44 class MythUIButtonList;
46 
48 {
49  Q_OBJECT
50 
51  public:
52  explicit ArchiveFileSelector(MythScreenStack *parent);
53  ~ArchiveFileSelector(void) override;
54 
55  bool Create(void) override; // FileSelector
56 
57  private slots:
58  void nextPressed(void);
59  void prevPressed(void);
60  void cancelPressed(void);
62 
63  private:
65  QString m_xmlFile;
66 
69  MythUIText *m_progTitle {nullptr};
72 };
73 
75 {
76  Q_OBJECT
77 
78  public:
79  ImportNative(MythScreenStack *parent, MythScreenType *previousScreen,
80  QString xmlFile, FileDetails details)
81  : MythScreenType(parent, "ImportNative"),
82  m_xmlFile(std::move(xmlFile)),
83  m_details(std::move(details)),
84  m_previousScreen(previousScreen) {}
85  ~ImportNative() override = default;
86 
87  bool Create(void) override; // MythScreenType
88  bool keyPressEvent(QKeyEvent *e) override; // MythScreenType
89 
90  private slots:
91  void finishedPressed();
92  void prevPressed();
93  void cancelPressed();
94  void searchChanID(void);
95  void searchChanNo(void);
96  void searchName(void);
97  void searchCallsign(void);
98  void gotChanID(const QString& value);
99  void gotChanNo(const QString& value);
100  void gotName(const QString& value);
101  void gotCallsign(const QString& value);
102 
103  private:
104  void findChannelMatch(const QString &chanid, const QString &chanNo,
105  const QString &name, const QString &callsign);
106  void fillSearchList(const QString &field);
107  using INSlot = void (ImportNative::*)(const QString&);
108  void showList(const QString &caption, QString &value, INSlot slot);
109 
110  QString m_xmlFile;
113 
114  QStringList m_searchList;
115 
119 
124 
129 
134 
138 
139  bool m_isValidXMLSelected {false};
140 };
141 
142 #endif
FileInfo
Definition: importnative.h:21
FileDetails::chanNo
QString chanNo
Definition: importnative.h:36
ImportNative::gotChanNo
void gotChanNo(const QString &value)
Definition: importnative.cpp:579
ImportNative::m_previousScreen
MythScreenType * m_previousScreen
Definition: importnative.h:112
ArchiveFileSelector::nextPressed
void nextPressed(void)
Definition: importnative.cpp:261
ImportNative::searchChanID
void searchChanID(void)
Definition: importnative.cpp:543
ImportNative::m_localChanIDText
MythUIText * m_localChanIDText
Definition: importnative.h:125
fileselector.h
ImportNative::Create
bool Create(void) override
Definition: importnative.cpp:290
ImportNative::m_progDescriptionText
MythUIText * m_progDescriptionText
Definition: importnative.h:118
FileDetails::subtitle
QString subtitle
Definition: importnative.h:32
ImportNative::searchCallsign
void searchCallsign(void)
Definition: importnative.cpp:621
ImportNative::showList
void showList(const QString &caption, QString &value, INSlot slot)
Definition: importnative.cpp:504
MythScreenStack
Definition: mythscreenstack.h:16
ImportNative::keyPressEvent
bool keyPressEvent(QKeyEvent *e) override
Key event handler.
Definition: importnative.cpp:358
MythScreenType
Screen in which all other widgets are contained and rendered.
Definition: mythscreentype.h:45
ImportNative::finishedPressed
void finishedPressed()
Definition: importnative.cpp:384
ImportNative::findChannelMatch
void findChannelMatch(const QString &chanid, const QString &chanNo, const QString &name, const QString &callsign)
Definition: importnative.cpp:442
FileInfo::size
int64_t size
Definition: importnative.h:26
ImportNative::searchChanNo
void searchChanNo(void)
Definition: importnative.cpp:569
ImportNative::prevPressed
void prevPressed()
Definition: importnative.cpp:431
ImportNative::gotChanID
void gotChanID(const QString &value)
Definition: importnative.cpp:553
ImportNative::m_chanNameText
MythUIText * m_chanNameText
Definition: importnative.h:122
ArchiveFileSelector::m_progStartTime
MythUIText * m_progStartTime
Definition: importnative.h:71
ArchiveFileSelector::m_progSubtitle
MythUIText * m_progSubtitle
Definition: importnative.h:70
ImportNative::m_progTitleText
MythUIText * m_progTitleText
Definition: importnative.h:116
MythUIButtonListItem
Definition: mythuibuttonlist.h:41
ArchiveFileSelector::prevPressed
void prevPressed(void)
Definition: importnative.cpp:278
FileInfo::directory
bool directory
Definition: importnative.h:23
FileSelector
Definition: fileselector.h:39
ImportNative::m_localChanNoText
MythUIText * m_localChanNoText
Definition: importnative.h:126
ImportNative::m_finishButton
MythUIButton * m_finishButton
Definition: importnative.h:135
FileInfo::filename
QString filename
Definition: importnative.h:25
ImportNative::~ImportNative
~ImportNative() override=default
ArchiveFileSelector
Definition: importnative.h:47
ImportNative::m_xmlFile
QString m_xmlFile
Definition: importnative.h:110
ArchiveFileSelector::~ArchiveFileSelector
~ArchiveFileSelector(void) override
Definition: importnative.cpp:173
ArchiveFileSelector::m_xmlFile
QString m_xmlFile
Definition: importnative.h:65
ImportNative::m_details
FileDetails m_details
Definition: importnative.h:111
MythUIButton
A single button widget.
Definition: mythuibutton.h:21
ImportNative::m_searchChanNameButton
MythUIButton * m_searchChanNameButton
Definition: importnative.h:132
ImportNative::gotCallsign
void gotCallsign(const QString &value)
Definition: importnative.cpp:631
ImportNative::m_localChanNameText
MythUIText * m_localChanNameText
Definition: importnative.h:127
ArchiveFileSelector::ArchiveFileSelector
ArchiveFileSelector(MythScreenStack *parent)
Definition: importnative.cpp:167
FileInfo::selected
bool selected
Definition: importnative.h:24
FileDetails::startTime
QDateTime startTime
Definition: importnative.h:33
ArchiveFileSelector::m_progTitle
MythUIText * m_progTitle
Definition: importnative.h:69
ImportNative::INSlot
void(ImportNative::*)(const QString &) INSlot
Definition: importnative.h:107
ImportNative::searchName
void searchName(void)
Definition: importnative.cpp:595
ArchiveFileSelector::m_details
FileDetails m_details
Definition: importnative.h:64
FileDetails::description
QString description
Definition: importnative.h:34
FileDetails::callsign
QString callsign
Definition: importnative.h:38
ArchiveFileSelector::m_nextButton
MythUIButton * m_nextButton
Definition: importnative.h:67
ArchiveFileSelector::itemSelected
void itemSelected(MythUIButtonListItem *item)
Definition: importnative.cpp:234
ImportNative::m_searchCallsignButton
MythUIButton * m_searchCallsignButton
Definition: importnative.h:133
FileDetails::title
QString title
Definition: importnative.h:31
ImportNative::m_chanNoText
MythUIText * m_chanNoText
Definition: importnative.h:121
ImportNative::m_cancelButton
MythUIButton * m_cancelButton
Definition: importnative.h:137
MythUIText
All purpose text widget, displays a text string.
Definition: mythuitext.h:28
ImportNative::m_searchChanIDButton
MythUIButton * m_searchChanIDButton
Definition: importnative.h:130
ImportNative::m_searchList
QStringList m_searchList
Definition: importnative.h:114
ImportNative::ImportNative
ImportNative(MythScreenStack *parent, MythScreenType *previousScreen, QString xmlFile, FileDetails details)
Definition: importnative.h:79
ArchiveFileSelector::cancelPressed
void cancelPressed(void)
Definition: importnative.cpp:283
FileDetails
Definition: importnative.h:29
ImportNative::gotName
void gotName(const QString &value)
Definition: importnative.cpp:605
ImportNative::m_callsignText
MythUIText * m_callsignText
Definition: importnative.h:123
std
Definition: mythchrono.h:23
ImportNative::m_prevButton
MythUIButton * m_prevButton
Definition: importnative.h:136
ImportNative::cancelPressed
void cancelPressed()
Definition: importnative.cpp:436
ArchiveFileSelector::m_prevButton
MythUIButton * m_prevButton
Definition: importnative.h:68
ArchiveFileSelector::Create
bool Create(void) override
Definition: importnative.cpp:178
ImportNative::fillSearchList
void fillSearchList(const QString &field)
Definition: importnative.cpp:524
ImportNative::m_isValidXMLSelected
bool m_isValidXMLSelected
Definition: importnative.h:139
ImportNative::m_progDateTimeText
MythUIText * m_progDateTimeText
Definition: importnative.h:117
MythUIButtonList
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
Definition: mythuibuttonlist.h:191
FileDetails::chanName
QString chanName
Definition: importnative.h:37
ImportNative::m_localCallsignText
MythUIText * m_localCallsignText
Definition: importnative.h:128
ImportNative::m_searchChanNoButton
MythUIButton * m_searchChanNoButton
Definition: importnative.h:131
mythscreentype.h
ImportNative
Definition: importnative.h:74
FileDetails::chanID
QString chanID
Definition: importnative.h:35
ImportNative::m_chanIDText
MythUIText * m_chanIDText
Definition: importnative.h:120