MythTV  master
Go to the documentation of this file.
1 /* -*- Mode: c++ -*-
2  * vim: set expandtab tabstop=4 shiftwidth=4:
3  *
4  * Original Project
5  * MythTV
6  *
7  * Author(s):
8  * John Pullan, Matthew Wire
9  *
10  * Description:
11  */
13 #ifndef IMPORTICONS_H
14 #define IMPORTICONS_H
16 #include <QUrl>
17 #include <QDir>
19 #include "mythscreentype.h"
21 class MythUIButton;
22 class MythUIButtonList;
24 class MythUITextEdit;
25 class MythUIText;
29 {
32  public:
33  ImportIconsWizard(MythScreenStack *parent, bool fRefresh,
34  const QString &channelname = "");
37  bool Create(void) override; // MythScreenType
38  void Load(void) override; // MythScreenType
39 // bool keyPressEvent(QKeyEvent *) override; // MythScreenType
40  void customEvent(QEvent *event) override; // MythUIType
42  struct SearchEntry
43  {
44  QString strID;
45  QString strName;
46  QString strLogo;
47  };
49  private:
52  {
56  };
58  struct CSVEntry
59  {
60  QString strChanId;
61  QString strName;
62  QString strXmlTvId;
63  QString strCallsign;
64  QString strTransportId;
65  QString strAtscMajorChan;
66  QString strAtscMinorChan;
67  QString strNetworkId;
68  QString strServiceId;
69  QString strIconCSV;
70  QString strNameCSV;
71  };
73  typedef QList<CSVEntry> ListEntries;
75  typedef QList<CSVEntry>::Iterator ListEntriesIter;
83  typedef QList<SearchEntry> ListSearchEntries;
85  typedef QList<SearchEntry>::Iterator ListSearchEntriesIter;
91  QString escape_csv(const QString& str);
97  QStringList extract_csv(const QString& strLine);
104  QString wget(QUrl& url,const QString& strParam);
110  bool lookup(const QString& strParam);
116  bool search(const QString& strParam);
121  bool submit();
127  bool findmissing(const QString& strParam);
135  bool checkAndDownload(const QString& url, const QString& localChanId);
140  bool initialLoad(const QString& name="");
145  bool doLoad();
147  protected slots:
149  void manualSearch();
151  void skip();
152  void askSubmit(const QString& strParam);
153  void Close() override; // MythScreenType
155  private slots:
156  void itemChanged(MythUIButtonListItem *item);
158  protected:
159  void Init(void) override; // MythScreenType
161  private:
163  QString m_strMatches;
165  QString m_strChannelDir;
167  QString m_strParam;
169  bool m_fRefresh {false};
170  int m_nMaxCount {0};
171  int m_nCount {0};
173  int m_missingCount {0};
176  const QString m_url {""};
177  QDir m_tmpDir;
179  void startDialog();
186  MythUIText *m_nameText {nullptr};
191  MythUIImage *m_preview {nullptr};
194 };
198 #endif // IMPORTICONS_H
QString strCallsign
Definition: importicons.h:63
MythUIText * m_nameText
name field for the icon
Definition: importicons.h:186
const QString m_url
Definition: importicons.h:176
unsigned int slots[4]
Definition: element.c:38
QString strNetworkId
network id
Definition: importicons.h:67
All purpose text widget, displays a text string.
Definition: mythuitext.h:28
QString m_strChannelname
the channel name if searching for a single channel icon
Definition: importicons.h:166
QString strChanId
local channel id
Definition: importicons.h:60
bool initialLoad(const QString &name="")
attempt the inital load of the TV channel information
bool Create(void) override
Definition: importicons.cpp:57
ListEntriesIter m_iter
the current iterator
Definition: importicons.h:79
Image widget, displays a single image or multiple images in sequence.
Definition: mythuiimage.h:97
void itemChanged(MythUIButtonListItem *item)
QString strName
the remote name
Definition: importicons.h:45
QStringList extract_csv(const QString &strLine)
extracts the csv values out of a string
MythScreenStack * m_popupStack
Definition: importicons.h:181
QString strName
channel name
Definition: importicons.h:61
MythUIButton * m_manualButton
manual button field
Definition: importicons.h:187
int m_missingCount
the current search point (0..m_missingCount)
Definition: importicons.h:173
QString strID
the remote channel id
Definition: importicons.h:44
MythUIButtonList * m_iconsList
list of potential icons
Definition: importicons.h:184
int m_nMaxCount
the maximum number of TV channels
Definition: importicons.h:170
QString escape_csv(const QString &str)
changes a string into csv format
int m_nCount
the current search point (0..m_nMaxCount)
Definition: importicons.h:171
void enableControls(dialogState state=STATE_NORMAL)
enable/disable the controls
void menuSelection(MythUIButtonListItem *)
process the icon selection
QList< CSVEntry >::Iterator ListEntriesIter
iterator over list of CSV entries
Definition: importicons.h:75
bool doLoad()
attempts to move the iteration on one/more than one
ImportIconsWizard(MythScreenStack *parent, bool fRefresh, const QString &channelname="")
Definition: importicons.cpp:25
bool search(const QString &strParam)
search the remote db for icons etc
ListEntries m_listEntries
list of TV channels to search for
Definition: importicons.h:77
void skip()
skip this icon
MythUITextEdit * m_manualEdit
manual edit field
Definition: importicons.h:185
describes the TV channel name
Definition: importicons.h:58
bool lookup(const QString &strParam)
looks up the string to determine the caller/xmltvid
QString strAtscMinorChan
ATSC minor number.
Definition: importicons.h:66
MythUIImage * m_preview
Definition: importicons.h:191
MythUIProgressDialog * m_progressDialog
Definition: importicons.h:182
A text entry and edit widget.
QList< SearchEntry > ListSearchEntries
List of SearchEntry entries.
Definition: importicons.h:83
QString strIconCSV
icon name (csv form)
Definition: importicons.h:69
MythUIText * m_statusText
Definition: importicons.h:189
const char * name
Definition: ParseText.cpp:328
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
QString strAtscMajorChan
ATSC major number.
Definition: importicons.h:65
MythUIText * m_previewtitle
Definition: importicons.h:192
QString m_strChannelDir
the location of the channel icon dir
Definition: importicons.h:165
ListEntries m_missingEntries
list of TV channels with no unique icon
Definition: importicons.h:78
QList< SearchEntry >::Iterator ListSearchEntriesIter
iterator over list of SearchEntry entries
Definition: importicons.h:85
A single button widget.
Definition: mythuibutton.h:21
QString strTransportId
transport id
Definition: importicons.h:64
bool checkAndDownload(const QString &url, const QString &localChanId)
checks and attempts to download the logo file to the appropriate place
void askSubmit(const QString &strParam)
QString strLogo
the actual logo
Definition: importicons.h:46
QString m_strMatches
the string for the submit() call
Definition: importicons.h:163
QString strServiceId
service id
Definition: importicons.h:68
void Close() override
ListEntriesIter m_missingIter
Definition: importicons.h:80
MythUIButton * m_skipButton
button skip
Definition: importicons.h:188
QList< CSVEntry > ListEntries
List of CSV entries.
Definition: importicons.h:73
ListSearchEntries m_listSearch
the list of SearchEntry
Definition: importicons.h:162
void customEvent(QEvent *event) override
bool submit()
submit the icon information back to the remote db
search entry results
Definition: importicons.h:42
QString strNameCSV
name (csv form)
Definition: importicons.h:70
void Init(void) override
Used after calling Load() to assign data to widgets and other UI initilisation which is prohibited in...
bool m_fRefresh
are we doing a refresh or not
Definition: importicons.h:169
QString wget(QUrl &url, const QString &strParam)
use the equivalent of wget to fetch the POST command
QString strXmlTvId
the xmltvid
Definition: importicons.h:62
Screen in which all other widgets are contained and rendered.
void Load(void) override
Load data which will ultimately be displayed on-screen or used to determine what appears on-screen (S...
bool findmissing(const QString &strParam)
retrieve the actual logo for the TV channel
int m_missingMaxCount
the total number of missing icons
Definition: importicons.h:172
void manualSearch()
process the manual search