MythTV  master
backendselect.h
Go to the documentation of this file.
1 #ifndef __BACKENDSELECT_H__
2 #define __BACKENDSELECT_H__
3 
4 #include <QMutex>
5 
6 // libmythui
7 #include "mythscreentype.h"
8 
9 #include "configuration.h"
10 #include "upnpdevice.h"
11 
12 class QEventLoop;
13 class MythUIButtonList;
14 class MythUIButton;
15 
16 class DatabaseParams;
17 
18 // TODO: The following do not belong here, but I cannot think of a better
19 // location at this moment in time
20 // Some common UPnP search and XML value strings
21 const QString gBackendURI = "urn:schemas-mythtv-org:device:MasterMediaServer:1";
22 const QString kDefaultDB = "Database/";
23 const QString kDefaultWOL = "WakeOnLAN/";
24 const QString kDefaultMFE = "UPnP/MythFrontend/DefaultBackend/";
25 const QString kDefaultPIN = kDefaultMFE + "SecurityPin";
26 const QString kDefaultUSN = kDefaultMFE + "USN";
27 
28 typedef QMap <QString, DeviceLocation*> ItemMap;
29 
38 {
39  Q_OBJECT
40 
41  public:
42  typedef enum Decision
43  {
48  static Decision Prompt(
49  DatabaseParams *dbParams, Configuration *pConfig);
50 
52  Configuration *pConfig, bool exitOnFinish = false);
53  virtual ~BackendSelection();
54 
55  bool Create(void) override; // MythScreenType
56  void Close(void) override; // MythScreenType
57  void customEvent(QEvent *event) override; // QObject
58 
59  protected slots:
60  void Accept(void);
62  void Manual(void);
63  void Cancel(void);
64 
65  private:
66  void Load(void) override; // MythScreenType
67  void Init(void) override; // MythScreenType
68  bool ConnectBackend(DeviceLocation *dev);
69  void AddItem(DeviceLocation *dev);
70  void RemoveItem(const QString& USN);
71  bool TryDBfromURL(const QString &error, QString URL);
72  void PromptForPassword(void);
74 
79 
84  //MythUIButton *m_searchButton {nullptr};
85 
86  QString m_pinCode;
87  QString m_USN;
88 
89  QMutex m_mutex;
90 
92  QEventLoop *m_loop {nullptr};
93 };
94 
96 
97 #endif
Classes to Prompt user for a master backend.
Definition: backendselect.h:37
MythUIButton * m_saveButton
Definition: backendselect.h:82
void RemoveItem(const QString &USN)
BackendDecision m_backendDecision
Definition: backendselect.h:91
unsigned int slots[4]
Definition: element.c:38
QMap< QString, DeviceLocation * > ItemMap
Definition: backendselect.h:28
const QString kDefaultWOL
Definition: backendselect.h:23
bool ConnectBackend(DeviceLocation *dev)
Attempt UPnP connection to a backend device, get its DB details.
static void error(const char *str,...)
Definition: vbi.c:42
bool Create(void) override
enum BackendSelection::Decision BackendDecision
MythUIButtonList * m_backendList
Definition: backendselect.h:80
const QString gBackendURI
Service type for the backend's UPnP server.
Definition: backendselect.h:21
static const char URL[]
Definition: cddb.cpp:29
static Decision Prompt(DatabaseParams *dbParams, Configuration *pConfig)
void PromptForPassword(void)
Q_DECLARE_METATYPE(GrabberScript *)
QEventLoop * m_loop
Definition: backendselect.h:92
MythUIButton * m_cancelButton
Definition: backendselect.h:83
MythUIButton * m_manualButton
Definition: backendselect.h:81
const QString kDefaultDB
Definition: backendselect.h:22
BackendSelection(MythScreenStack *parent, DatabaseParams *params, Configuration *pConfig, bool exitOnFinish=false)
void Load(void) override
Load data which will ultimately be displayed on-screen or used to determine what appears on-screen (S...
virtual ~BackendSelection()
void Cancel(void)
Linked to 'Cancel' button.
void Close(void) override
void customEvent(QEvent *event) override
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
DatabaseParams * m_DBparams
Definition: backendselect.h:75
A single button widget.
Definition: mythuibutton.h:21
void Init(void) override
Used after calling Load() to assign data to widgets and other UI initilisation which is prohibited in...
Configuration * m_pConfig
Definition: backendselect.h:76
Structure containing the basic Database parameters.
Definition: mythdbparams.h:9
void AddItem(DeviceLocation *dev)
const QString kDefaultPIN
Definition: backendselect.h:25
const QString kDefaultUSN
Definition: backendselect.h:26
bool TryDBfromURL(const QString &error, QString URL)
const QString kDefaultMFE
Definition: backendselect.h:24
Screen in which all other widgets are contained and rendered.
void Manual(void)
Linked to 'Configure Manually' button.
void CloseWithDecision(Decision)