00001 #ifndef __BACKENDSELECT_H__ 00002 #define __BACKENDSELECT_H__ 00003 00004 #include <QMutex> 00005 00006 // libmythui 00007 #include "mythscreentype.h" 00008 #include "mythuibuttonlist.h" 00009 00010 #include "configuration.h" 00011 #include "upnpdevice.h" 00012 00013 class MythUIButtonList; 00014 class MythUIButton; 00015 00016 struct DatabaseParams; 00017 00018 // TODO: The following do not belong here, but I cannot think of a better 00019 // location at this moment in time 00020 // Some common UPnP search and XML value strings 00021 const QString gBackendURI = "urn:schemas-mythtv-org:device:MasterMediaServer:1"; 00022 const QString kDefaultDB = "Database/"; 00023 const QString kDefaultWOL = "WakeOnLAN/"; 00024 const QString kDefaultMFE = "UPnP/MythFrontend/DefaultBackend/"; 00025 const QString kDefaultPIN = kDefaultMFE + "SecurityPin"; 00026 const QString kDefaultUSN = kDefaultMFE + "USN"; 00027 00028 typedef QMap <QString, DeviceLocation*> ItemMap; 00029 00037 class BackendSelection : public MythScreenType 00038 { 00039 Q_OBJECT 00040 00041 public: 00042 typedef enum Decision 00043 { 00044 kManualConfigure = -1, 00045 kCancelConfigure = 0, 00046 kAcceptConfigure = +1, 00047 } BackendDecision; 00048 static Decision Prompt( 00049 DatabaseParams *dbParams, Configuration *pConfig); 00050 00051 BackendSelection(MythScreenStack *parent, DatabaseParams *params, 00052 Configuration *pConfig, bool exitOnFinish = false); 00053 virtual ~BackendSelection(); 00054 00055 bool Create(void); 00056 void customEvent(QEvent *event); 00057 00058 protected slots: 00059 void Accept(void); 00060 void Accept(MythUIButtonListItem *); 00061 void Manual(void); 00062 void Cancel(void); 00063 00064 private: 00065 void Load(void); 00066 void Init(void); 00067 bool ConnectBackend(DeviceLocation *dev); 00068 void AddItem(DeviceLocation *dev); 00069 void RemoveItem(QString URN); 00070 bool TryDBfromURL(const QString &error, QString URL); 00071 void PromptForPassword(void); 00072 void Close(Decision); 00073 00074 DatabaseParams *m_DBparams; 00075 Configuration *m_pConfig; 00076 bool m_exitOnFinish; 00077 ItemMap m_devices; 00078 00079 MythUIButtonList *m_backendList; 00080 MythUIButton *m_manualButton; 00081 MythUIButton *m_saveButton; 00082 MythUIButton *m_cancelButton; 00083 //MythUIButton *m_searchButton; 00084 00085 QString m_pinCode; 00086 QString m_USN; 00087 00088 QMutex m_mutex; 00089 00090 BackendDecision m_backendDecision; 00091 }; 00092 00093 Q_DECLARE_METATYPE(DeviceLocation*) 00094 00095 #endif
1.6.3