00001 /* ============================================================ 00002 * File : mythnews.h 00003 * Author: Renchi Raju <renchi@pooh.tam.uiuc.edu> 00004 * Date : 2003-08-30 00005 * Description : 00006 * 00007 * Copyright 2003 by Renchi Raju 00008 00009 * This program is free software; you can redistribute it 00010 * and/or modify it under the terms of the GNU General 00011 * Public License as published bythe Free Software Foundation; 00012 * either version 2, or (at your option) 00013 * any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU General Public License for more details. 00019 * 00020 * ============================================================ */ 00021 00022 #ifndef MYTHNEWS_H 00023 #define MYTHNEWS_H 00024 00025 00026 #include <mythtv/uitypes.h> 00027 #include <mythtv/uilistbtntype.h> 00028 #include <mythtv/xmlparse.h> 00029 #include <mythtv/mythdialogs.h> 00030 #include <mythtv/httpcomms.h> 00031 00032 #include "newsengine.h" 00033 00034 class QTimer; 00035 class UIListBtnType; 00036 00037 class MPUBLIC MythNewsBusyDialog : public MythBusyDialog 00038 { 00039 Q_OBJECT 00040 public: 00041 MythNewsBusyDialog(const QString &title); 00042 00043 ~MythNewsBusyDialog(); 00044 00045 void keyPressEvent(QKeyEvent *); 00046 00047 signals: 00048 void cancelAction(); 00049 00050 }; 00051 00052 class MythNews : public MythDialog 00053 { 00054 Q_OBJECT 00055 00056 public: 00057 00058 MythNews(MythMainWindow *parent, const char *name = 0); 00059 ~MythNews(); 00060 00061 private: 00062 00063 void loadTheme(); 00064 void loadWindow(QDomElement &element); 00065 void paintEvent(QPaintEvent *e); 00066 00067 void updateBackground(); 00068 void updateSitesView(); 00069 void updateArticlesView(); 00070 void updateInfoView(); 00071 00072 void keyPressEvent(QKeyEvent *e); 00073 void cursorUp(bool page=false); 00074 void cursorDown(bool page=false); 00075 void cursorRight(); 00076 void cursorLeft(); 00077 00078 void cancelRetrieve(); 00079 void processAndShowNews(NewsSite *site); 00080 void loadSites(); 00081 bool findInDB(const QString& name); 00082 bool insertInDB(const QString &name, const QString &url, 00083 const QString &icon, const QString &category); 00084 00085 bool removeFromDB(const QString &name); 00086 00087 bool getHttpFile(QString sFilename, QString cmdURL); 00088 void createProgress(QString title); 00089 void createProgress(QString title, int total); 00090 QString formatSize(long long bytes, int prec); 00091 void playVideo(const QString &filename); 00092 00093 XMLParse *m_Theme; 00094 00095 QPixmap m_background; 00096 00097 UIListBtnType *m_UISites; 00098 UIListBtnType *m_UIArticles; 00099 QRect m_SitesRect; 00100 QRect m_ArticlesRect; 00101 QRect m_InfoRect; 00102 unsigned int m_InColumn; 00103 00104 NewsSite::List m_NewsSites; 00105 00106 QTimer *m_RetrieveTimer; 00107 int m_TimerTimeout; 00108 unsigned int m_UpdateFreq; 00109 00110 QString timeFormat; 00111 QString dateFormat; 00112 QString zoom; 00113 QString browser; 00114 MythPopupBox *menu; 00115 00116 bool abortHttp; 00117 00118 MythNewsBusyDialog *busy; 00119 HttpComms *httpGrabber; 00120 00121 private slots: 00122 void slotViewArticle(); 00123 void slotRetrieveNews(); 00124 void slotNewsRetrieved(NewsSite* site); 00125 00126 void slotSiteSelected(UIListBtnTypeItem *item); 00127 void slotSiteSelected(NewsSite*); 00128 00129 void slotArticleSelected(UIListBtnTypeItem *item); 00130 void slotProgressCancelled(); 00131 00132 // menu stuff 00133 void showMenu(); 00134 void addNewsSite(); 00135 void editNewsSite(); 00136 void deleteNewsSite(); 00137 void cancelMenu(); 00138 bool showEditDialog(bool edit); 00139 }; 00140 00141 #endif /* MYTHNEWS_H */
1.5.5