00001 #ifndef NETTREE_H
00002 #define NETTREE_H
00003
00004
00005 #include <mythuibuttonlist.h>
00006 #include <mythuibuttontree.h>
00007 #include <mythgenerictree.h>
00008 #include <mythuiprogressbar.h>
00009 #include <mythprogressdialog.h>
00010 #include <mythuistatetype.h>
00011 #include <mythscreentype.h>
00012 #include <mythdialogbox.h>
00013 #include <netgrabbermanager.h>
00014 #include <mythrssmanager.h>
00015 #include <mythdownloadmanager.h>
00016 #include <metadata/metadataimagedownload.h>
00017
00018 enum DialogType { DLG_DEFAULT = 0, DLG_GALLERY = 0x1, DLG_TREE = 0x2,
00019 DLG_BROWSER = 0x4, dtLast };
00020
00021 enum TreeNodeType {
00022 kSubFolder = -1,
00023 kUpFolder = -2,
00024 kRootNode = -3,
00025 kNoFilesFound = -4
00026 };
00027
00028
00029 enum TreeNodeAttributes {
00030 kNodeSort
00031 };
00032
00033 enum NodeOrder {
00034 kOrderUp,
00035 kOrderSub,
00036 kOrderItem
00037 };
00038
00039 class MythUIBusyDialog;
00040
00041 class NetTree : public MythScreenType
00042 {
00043 Q_OBJECT
00044
00045 public:
00046 NetTree(DialogType type, MythScreenStack *parent, const char *name = 0);
00047 ~NetTree();
00048
00049 bool Create(void);
00050 bool keyPressEvent(QKeyEvent *);
00051
00052 void populateResultList(ResultItem::resultList list);
00053
00054 public slots:
00055
00056 protected:
00057 void createBusyDialog(QString title);
00058
00059 private:
00060 virtual void Load();
00061 virtual void Init();
00062
00063 void fillTree(void);
00064 void SetCurrentNode(MythGenericTree *node);
00065 void handleDirSelect(MythGenericTree *node);
00066 bool goBack();
00067 void UpdateItem(MythUIButtonListItem *item);
00068
00069 void buildGenericTree(MythGenericTree* dst,
00070 QDomElement& domElem);
00071 void buildGenericTree(MythGenericTree *dst,
00072 QStringList paths,
00073 QString dirthumb,
00074 QList<ResultItem*> videos);
00075
00076 void cleanCacheDir(void);
00077
00078 void initProgressDialog();
00079
00080 MythGenericTree *AddDirNode(
00081 MythGenericTree *where_to_add,
00082 QString name, QString thumbnail);
00083 int AddFileNode(MythGenericTree *where_to_add,
00084 ResultItem *video);
00085
00086 void switchView(void);
00087
00088
00089 QList<ResultItem*> m_videos;
00090
00091 MythUIButtonTree *m_siteMap;
00092 MythUIButtonList *m_siteButtonList;
00093 MythGenericTree *m_siteGeneric;
00094 MythGenericTree *m_rssGeneric;
00095 MythGenericTree *m_searchGeneric;
00096 MythGenericTree *m_currentNode;
00097
00098 MythUIText *m_noSites;
00099
00100 MythUIImage *m_thumbImage;
00101
00102 MythUIStateType *m_downloadable;
00103
00104 MythUIBusyDialog *m_busyPopup;
00105
00106 MythDialogBox *m_menuPopup;
00107 MythScreenStack *m_popupStack;
00108 MythUIProgressDialog *m_progressDialog;
00109
00110 MetadataImageDownload *m_imageDownload;
00111 GrabberDownloadThread *m_gdt;
00112 QString m_downloadFile;
00113
00114 QFile *m_file;
00115
00116 GrabberScript::scriptList m_grabberList;
00117 RSSSite::rssList m_rssList;
00118
00119 DialogType m_type;
00120
00121 uint m_updateFreq;
00122 bool m_rssAutoUpdate;
00123 bool m_treeAutoUpdate;
00124
00125 private slots:
00126 void streamWebVideo(void);
00127 void showWebVideo(void);
00128 void doDownloadAndPlay(void);
00129 void doPlayVideo(QString filename);
00130 void showMenu(void);
00131 MythMenu* createShowViewMenu(void);
00132 MythMenu* createShowManageMenu(void);
00133 void runTreeEditor(void);
00134 void runRSSEditor(void);
00135 void loadData(void);
00136 void handleSelect(MythUIButtonListItem *item);
00137
00138 void switchTreeView(void);
00139 void switchGalleryView(void);
00140 void switchBrowseView(void);
00141
00142 void updateRSS();
00143 void updateTrees();
00144 void toggleRSSUpdates();
00145 void toggleTreeUpdates();
00146
00147 void slotDeleteVideo(void);
00148 void doDeleteVideo(bool remove);
00149
00150 void slotItemChanged();
00151
00152 void doTreeRefresh();
00153 void TreeRefresh();
00154
00155 void customEvent(QEvent *levent);
00156 void DownloadVideo(QString url, QString dest);
00157
00158 protected:
00159 static const QString RSSNode;
00160 static const QString SearchNode;
00161 static const QString DownloadNode;
00162 };
00163
00164 #endif
00165