00001 /* -*- Mode: c++ -*- 00002 * vim: set expandtab tabstop=4 shiftwidth=4: 00003 * 00004 * Original Project 00005 * MythTV http://www.mythtv.org 00006 * 00007 * Author(s): 00008 * John Pullan, Matthew Wire 00009 * 00010 * Description: 00011 */ 00012 00013 #ifndef IMPORTICONS_H 00014 #define IMPORTICONS_H 00015 00016 #include <QUrl> 00017 #include <QDir> 00018 00019 #include "mythscreentype.h" 00020 00021 class MythUIButton; 00022 class MythUIButtonList; 00023 class MythUIButtonListItem; 00024 class MythUITextEdit; 00025 class MythUIText; 00026 class MythUIProgressDialog; 00027 00028 class ImportIconsWizard : public MythScreenType 00029 { 00030 Q_OBJECT 00031 00032 public: 00033 ImportIconsWizard(MythScreenStack *parent, bool fRefresh, 00034 const QString &channelname = ""); 00035 ~ImportIconsWizard(); 00036 00037 bool Create(void); 00038 // bool keyPressEvent(QKeyEvent *); 00039 void customEvent(QEvent *event); 00040 00041 struct SearchEntry 00042 { 00043 QString strID; 00044 QString strName; 00045 QString strLogo; 00046 }; 00047 00048 private: 00049 00050 enum dialogState 00051 { 00052 STATE_NORMAL, 00053 STATE_SEARCHING, 00054 STATE_DISABLED 00055 }; 00056 00057 struct CSVEntry 00058 { 00059 QString strChanId; 00060 QString strName; 00061 QString strXmlTvId; 00062 QString strCallsign; 00063 QString strTransportId; 00064 QString strAtscMajorChan; 00065 QString strAtscMinorChan; 00066 QString strNetworkId; 00067 QString strServiceId; 00068 QString strIconCSV; 00069 QString strNameCSV; 00070 }; 00072 typedef QList<CSVEntry> ListEntries; 00074 typedef QList<CSVEntry>::Iterator ListEntriesIter; 00075 00076 ListEntries m_listEntries; 00077 ListEntries m_missingEntries; 00078 ListEntriesIter m_iter; 00079 ListEntriesIter m_missingIter; 00080 00082 typedef QList<SearchEntry> ListSearchEntries; 00084 typedef QList<SearchEntry>::Iterator ListSearchEntriesIter; 00085 00090 QString escape_csv(const QString& str); 00091 00096 QStringList extract_csv(const QString& strLine); 00097 00103 QString wget(QUrl& url,const QString& strParam); 00104 00109 bool lookup(const QString& strParam); 00110 00115 bool search(const QString& strParam); 00116 00120 bool submit(); 00121 00126 bool findmissing(const QString& strParam); 00127 00134 bool checkAndDownload(const QString& url, const QString& localChanId); 00135 00139 bool initialLoad(QString name=""); 00140 00144 bool doLoad(); 00145 00146 protected slots: 00147 void enableControls(dialogState state=STATE_NORMAL, bool selectEnabled=true); 00148 void manualSearch(); 00149 void menuSelection(MythUIButtonListItem *); 00150 void skip(); 00151 void askSubmit(const QString& strParam); 00152 void Close(); 00153 00154 private slots: 00155 void itemChanged(MythUIButtonListItem *item); 00156 00157 protected: 00158 void Init(void); 00159 00160 private: 00161 ListSearchEntries m_listSearch; 00162 QString m_strMatches; 00163 00164 QString m_strChannelDir; 00165 QString m_strChannelname; 00166 QString m_strParam; 00167 00168 bool m_fRefresh; 00169 int m_nMaxCount; 00170 int m_nCount; 00171 int m_missingMaxCount; 00172 int m_missingCount; 00173 00174 const QString m_url; 00175 QDir m_tmpDir; 00176 00177 void startDialog(); 00178 00179 MythScreenStack *m_popupStack; 00180 MythUIProgressDialog *m_progressDialog; 00181 00182 MythUIButtonList *m_iconsList; 00183 MythUITextEdit *m_manualEdit; 00184 MythUIText *m_nameText; 00185 MythUIButton *m_manualButton; 00186 MythUIButton *m_skipButton; 00187 MythUIText *m_statusText; 00188 00189 MythUIImage *m_preview; 00190 MythUIText *m_previewtitle; 00191 00192 }; 00193 00194 Q_DECLARE_METATYPE(ImportIconsWizard::SearchEntry) 00195 00196 #endif // IMPORTICONS_H
1.6.3