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 <qsqldatabase.h> 00017 #include <qurl.h> 00018 00019 #include "settings.h" 00020 00021 class ImportIconsWizard : public QObject, public ConfigurationWizard 00022 { 00023 Q_OBJECT 00024 public: 00025 ImportIconsWizard(bool fRefresh, QString channelname=""); 00026 MythDialog *dialogWidget(MythMainWindow *parent, const char *widgetName); 00027 00028 int exec(); 00029 00030 private: 00031 00032 enum dialogState 00033 { 00034 STATE_NORMAL, 00035 STATE_SEARCHING, 00036 STATE_DISABLED 00037 }; 00038 00039 struct CSVEntry 00040 { 00041 QString strChanId; 00042 QString strName; 00043 QString strXmlTvId; 00044 QString strCallsign; 00045 QString strTransportId; 00046 QString strAtscMajorChan; 00047 QString strAtscMinorChan; 00048 QString strNetworkId; 00049 QString strServiceId; 00050 QString strIconCSV; 00051 QString strNameCSV; 00052 }; 00054 typedef QValueList<CSVEntry> ListEntries; 00056 typedef QValueListIterator<CSVEntry> ListEntriesIter; 00057 00058 ListEntries m_listEntries; 00059 ListEntries m_missingEntries; 00060 ListEntriesIter m_iter; 00061 ListEntriesIter m_missingIter; 00062 00063 struct SearchEntry 00064 { 00065 QString strID; 00066 QString strName; 00067 QString strLogo; 00068 }; 00070 typedef QValueList<SearchEntry> ListSearchEntries; 00072 typedef QValueListIterator<SearchEntry> ListSearchEntriesIter; 00073 00074 ListSearchEntries m_listSearch; 00075 QString m_strMatches; 00076 00077 static const QString url; 00078 QString m_strChannelDir; 00079 QString m_strChannelname; 00080 00081 bool m_fRefresh; 00082 int m_nMaxCount; 00083 int m_nCount; 00084 int m_missingMaxCount; 00085 int m_missingCount; 00086 00087 void startDialog(); 00088 00093 QString escape_csv(const QString& str); 00094 00099 QStringList extract_csv(const QString& strLine); 00100 00106 QString wget(QUrl& url,const QString& strParam); 00107 00108 TransLineEditSetting *m_editName; 00109 TransListBoxSetting *m_listIcons; 00110 TransLineEditSetting *m_editManual; 00111 TransButtonSetting *m_buttonManual; 00112 TransButtonSetting *m_buttonSkip; 00113 TransButtonSetting *m_buttonSelect; 00114 00119 bool isBlocked(const QString& strParam); 00120 00125 bool lookup(const QString& strParam); 00126 00131 bool search(const QString& strParam); 00132 00137 bool submit(const QString& strParam); 00138 00143 bool findmissing(const QString& strParam); 00144 00151 bool checkAndDownload(const QString& str, const QString& localChanId); 00152 00156 uint initialLoad(QString name=""); 00157 00161 bool doLoad(); 00162 00163 bool m_closeDialog; 00164 00165 ~ImportIconsWizard() { }; 00166 00167 protected slots: 00168 void enableControls(dialogState state=STATE_NORMAL, bool selectEnabled=true); 00169 void manualSearch(); 00170 void menuSelect(); 00171 void menuSelection(int nIndex); 00172 void skip(); 00173 void cancelPressed(); 00174 void finishButtonPressed(); 00175 00176 }; 00177 00178 #endif // IMPORTICONS_H
1.5.5