MythTV master
importicons.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 * Author(s):
8 * John Pullan, Matthew Wire
9 *
10 * Description:
11 */
12
13#ifndef IMPORTICONS_H
14#define IMPORTICONS_H
15
16// Qt
17#include <QDir>
18#include <QUrl>
19
20// MythTV
22
23class MythUIButton;
26class MythUITextEdit;
27class MythUIText;
29
31{
32 Q_OBJECT
33
34 public:
35 ImportIconsWizard(MythScreenStack *parent, bool fRefresh,
36 int sourceid = 0, QString channelname = "");
37 ~ImportIconsWizard() override;
38
39 bool Create(void) override; // MythScreenType
40// bool keyPressEvent(QKeyEvent *) override; // MythScreenType
41
43 {
44 QString strID;
45 QString strName;
46 QString strLogo;
47 };
48
49 protected:
50 void customEvent(QEvent *event) override; // MythUIType
51 void Load(void) override; // MythScreenType
52
53 private:
54
55 enum dialogState : std::uint8_t
56 {
60 };
61
62 struct CSVEntry
63 {
64 QString strChanId;
65 QString strName;
66 QString strXmlTvId;
67 QString strCallsign;
71 QString strNetworkId;
72 QString strServiceId;
73 QString strIconCSV;
74 QString strNameCSV;
75 };
77 using ListEntries = QList<CSVEntry>;
79 using ListEntriesIter = QList<CSVEntry>::Iterator;
80
85
87 using ListSearchEntries = QList<SearchEntry>;
89 using ListSearchEntriesIter = QList<SearchEntry>::Iterator;
90
95 static QString escape_csv(const QString& str);
96
101 static QStringList extract_csv(const QString& strLine);
102
108 static QString wget(QUrl& url,const QString& strParam);
109
114 bool lookup(const QString& strParam);
115
120 bool search(const QString& strParam);
121
125 bool submit();
126
131 bool findmissing(const QString& strParam);
132
139 bool checkAndDownload(const QString& url, const QString& localChanId);
140
144 bool initialLoad(const QString& name="");
145
149 bool doLoad();
150
151 public slots:
152 void Close() override; // MythScreenType
153
154 protected slots:
156 void manualSearch();
158 void skip();
159 void askSubmit(const QString& strParam);
160
161 private slots:
163
164 protected:
165 void Init(void) override; // MythScreenType
166
167 private:
169 QString m_strMatches;
170
173 QString m_strParam;
174
175 bool m_fRefresh {false};
176 int m_nMaxCount {0};
177 int m_nCount {0};
180 int m_sourceId {0};
181
183 const QString m_url;
185
187
190
197
200
201};
202
204
205#endif // IMPORTICONS_H
bool m_fRefresh
are we doing a refresh or not
Definition: importicons.h:175
MythUITextEdit * m_manualEdit
manual edit field
Definition: importicons.h:192
ListEntriesIter m_iter
the current iterator
Definition: importicons.h:83
int m_missingCount
the current search point (0..m_missingCount)
Definition: importicons.h:179
void menuSelection(MythUIButtonListItem *item)
process the icon selection
bool checkAndDownload(const QString &url, const QString &localChanId)
checks and attempts to download the logo file to the appropriate place
bool findmissing(const QString &strParam)
retrieve the actual logo for the TV channel
QString m_strChannelDir
the location of the channel icon dir
Definition: importicons.h:171
void customEvent(QEvent *event) override
void Init(void) override
Used after calling Load() to assign data to widgets and other UI initilisation which is prohibited in...
MythUIProgressDialog * m_progressDialog
Definition: importicons.h:189
MythUIText * m_nameText
name field for the icon
Definition: importicons.h:193
bool doLoad()
attempts to move the iteration on one/more than one
void skip()
skip this icon
void askSubmit(const QString &strParam)
int m_nMaxCount
the maximum number of TV channels
Definition: importicons.h:176
void manualSearch()
process the manual search
QList< SearchEntry > ListSearchEntries
List of SearchEntry entries.
Definition: importicons.h:87
MythUIText * m_statusText
Definition: importicons.h:196
MythScreenStack * m_popupStack
Definition: importicons.h:188
ListEntries m_missingEntries
list of TV channels with no unique icon
Definition: importicons.h:82
static QString escape_csv(const QString &str)
changes a string into csv format
int m_missingMaxCount
the total number of missing icons
Definition: importicons.h:178
MythUIButton * m_manualButton
manual button field
Definition: importicons.h:194
void Load(void) override
Load data which will ultimately be displayed on-screen or used to determine what appears on-screen (S...
ListSearchEntries m_listSearch
the list of SearchEntry
Definition: importicons.h:168
bool Create(void) override
Definition: importicons.cpp:64
bool lookup(const QString &strParam)
looks up the string to determine the caller/xmltvid
void itemChanged(MythUIButtonListItem *item)
MythUIButton * m_skipButton
button skip
Definition: importicons.h:195
~ImportIconsWizard() override
Definition: importicons.cpp:53
static QStringList extract_csv(const QString &strLine)
extracts the csv values out of a string
ImportIconsWizard(MythScreenStack *parent, bool fRefresh, int sourceid=0, QString channelname="")
Definition: importicons.cpp:27
bool initialLoad(const QString &name="")
attempt the inital load of the TV channel information
const QString m_url
Definition: importicons.h:183
void enableControls(ImportIconsWizard::dialogState state=STATE_NORMAL)
enable/disable the controls
void Close() override
ListEntriesIter m_missingIter
Definition: importicons.h:84
QList< CSVEntry >::Iterator ListEntriesIter
iterator over list of CSV entries
Definition: importicons.h:79
ListEntries m_listEntries
list of TV channels to search for
Definition: importicons.h:81
MythUIImage * m_preview
Definition: importicons.h:198
MythUIText * m_previewtitle
Definition: importicons.h:199
static QString wget(QUrl &url, const QString &strParam)
use the equivalent of wget to fetch the POST command
QList< SearchEntry >::Iterator ListSearchEntriesIter
iterator over list of SearchEntry entries
Definition: importicons.h:89
int m_nCount
the current search point (0..m_nMaxCount)
Definition: importicons.h:177
QString m_strChannelname
the channel name if searching for a single channel icon
Definition: importicons.h:172
MythUIButtonList * m_iconsList
list of potential icons
Definition: importicons.h:191
bool submit()
submit the icon information back to the remote db
int m_sourceId
selected video source or 0 for all sources
Definition: importicons.h:180
QString m_strMatches
the string for the submit() call
Definition: importicons.h:169
QList< CSVEntry > ListEntries
List of CSV entries.
Definition: importicons.h:77
bool search(const QString &strParam)
search the remote db for icons etc
Screen in which all other widgets are contained and rendered.
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
A single button widget.
Definition: mythuibutton.h:22
Image widget, displays a single image or multiple images in sequence.
Definition: mythuiimage.h:98
A text entry and edit widget.
All purpose text widget, displays a text string.
Definition: mythuitext.h:29
Q_DECLARE_METATYPE(std::chrono::seconds)
describes the TV channel name
Definition: importicons.h:63
QString strAtscMinorChan
ATSC minor number.
Definition: importicons.h:70
QString strAtscMajorChan
ATSC major number.
Definition: importicons.h:69
QString strServiceId
service id
Definition: importicons.h:72
QString strTransportId
transport id
Definition: importicons.h:68
QString strNetworkId
network id
Definition: importicons.h:71
QString strChanId
local channel id
Definition: importicons.h:64
QString strIconCSV
icon name (csv form)
Definition: importicons.h:73
QString strXmlTvId
the xmltvid
Definition: importicons.h:66
QString strName
channel name
Definition: importicons.h:65
QString strCallsign
callsign
Definition: importicons.h:67
QString strNameCSV
name (csv form)
Definition: importicons.h:74
search entry results
Definition: importicons.h:43
QString strName
the remote name
Definition: importicons.h:45
QString strLogo
the actual logo
Definition: importicons.h:46
QString strID
the remote channel id
Definition: importicons.h:44