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 // MythTV
10 
11 class QEventLoop;
12 class MythUIButtonList;
13 class MythUIButton;
14 
15 class DatabaseParams;
16 
17 // TODO: The following do not belong here, but I cannot think of a better
18 // location at this moment in time
19 // Some common UPnP search and XML value strings
20 const QString kBackendURI = "urn:schemas-mythtv-org:device:MasterMediaServer:1";
21 const QString kDefaultDB = "Database/";
22 const QString kDefaultWOL = "WakeOnLAN/";
23 const QString kDefaultMFE = "UPnP/MythFrontend/DefaultBackend/";
24 const QString kDefaultPIN = kDefaultMFE + "SecurityPin";
25 const QString kDefaultUSN = kDefaultMFE + "USN";
26 
27 using ItemMap = QMap <QString, DeviceLocation*>;
28 
37 {
38  Q_OBJECT
39 
40  public:
41  enum Decision
42  {
46  };
47  static Decision Prompt(
48  DatabaseParams *dbParams, Configuration *pConfig);
49 
51  Configuration *pConfig, bool exitOnFinish = false);
52  ~BackendSelection() override;
53 
54  bool Create(void) override; // MythScreenType
55  void Close(void) override; // MythScreenType
56  void customEvent(QEvent *event) override; // QObject
57 
58  protected slots:
59  void Accept(void);
60  void Accept(MythUIButtonListItem *item);
61  void Manual(void);
62  void Cancel(void);
63 
64  private:
65  void Load(void) override; // MythScreenType
66  void Init(void) override; // MythScreenType
67  bool ConnectBackend(DeviceLocation *dev);
68  void AddItem(DeviceLocation *dev);
69  void RemoveItem(const QString& USN);
70  bool TryDBfromURL(const QString &error, const QString& URL);
71  void PromptForPassword(void);
73 
78 
83 
84  QString m_pinCode;
85  QString m_usn;
86 
87  QMutex m_mutex;
88 
90  QEventLoop *m_loop {nullptr};
91 };
92 
94 
95 #endif // BACKENDSELECT_H
BackendSelection::m_dbParams
DatabaseParams * m_dbParams
Definition: backendselect.h:74
BackendSelection::Cancel
void Cancel(void)
Linked to 'Cancel' button.
Definition: backendselect.cpp:237
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(GrabberScript *)
BackendSelection::Close
void Close(void) override
Definition: backendselect.cpp:373
upnpdevice.h
error
static void error(const char *str,...)
Definition: vbi.cpp:36
BackendSelection::Init
void Init(void) override
Used after calling Load() to assign data to widgets and other UI initilisation which is prohibited in...
Definition: backendselect.cpp:248
BackendSelection::m_mutex
QMutex m_mutex
Definition: backendselect.h:87
BackendSelection::m_pConfig
Configuration * m_pConfig
Definition: backendselect.h:75
BackendSelection::customEvent
void customEvent(QEvent *event) override
Definition: backendselect.cpp:304
DatabaseParams
Structure containing the basic Database parameters.
Definition: mythdbparams.h:10
BackendSelection::AddItem
void AddItem(DeviceLocation *dev)
Definition: backendselect.cpp:134
kDefaultWOL
const QString kDefaultWOL
Definition: backendselect.h:22
MythScreenStack
Definition: mythscreenstack.h:16
MythScreenType
Screen in which all other widgets are contained and rendered.
Definition: mythscreentype.h:45
DeviceLocation
Definition: upnpdevice.h:210
BackendSelection::m_exitOnFinish
bool m_exitOnFinish
Definition: backendselect.h:76
BackendSelection::m_devices
ItemMap m_devices
Definition: backendselect.h:77
MythUIButtonListItem
Definition: mythuibuttonlist.h:41
kDefaultDB
const QString kDefaultDB
Definition: backendselect.h:21
BackendSelection::CloseWithDecision
void CloseWithDecision(Decision d)
Definition: backendselect.cpp:378
BackendSelection::kCancelConfigure
@ kCancelConfigure
Definition: backendselect.h:44
BackendSelection::RemoveItem
void RemoveItem(const QString &USN)
Definition: backendselect.cpp:270
BackendSelection::Manual
void Manual(void)
Linked to 'Configure Manually' button.
Definition: backendselect.cpp:265
MythUIButton
A single button widget.
Definition: mythuibutton.h:21
BackendSelection::kAcceptConfigure
@ kAcceptConfigure
Definition: backendselect.h:45
BackendSelection
Classes to Prompt user for a master backend.
Definition: backendselect.h:36
BackendSelection::m_pinCode
QString m_pinCode
Definition: backendselect.h:84
BackendSelection::Accept
void Accept(void)
Definition: backendselect.cpp:123
BackendSelection::m_saveButton
MythUIButton * m_saveButton
Definition: backendselect.h:81
kBackendURI
const QString kBackendURI
Definition: backendselect.h:20
BackendSelection::ConnectBackend
bool ConnectBackend(DeviceLocation *dev)
Attempt UPnP connection to a backend device, get its DB details.
Definition: backendselect.cpp:186
ItemMap
QMap< QString, DeviceLocation * > ItemMap
Definition: backendselect.h:27
BackendSelection::~BackendSelection
~BackendSelection() override
Definition: backendselect.cpp:29
BackendSelection::m_backendList
MythUIButtonList * m_backendList
Definition: backendselect.h:79
BackendSelection::m_usn
QString m_usn
Definition: backendselect.h:85
BackendSelection::TryDBfromURL
bool TryDBfromURL(const QString &error, const QString &URL)
Definition: backendselect.cpp:286
BackendSelection::m_backendDecision
Decision m_backendDecision
Definition: backendselect.h:89
BackendSelection::Create
bool Create(void) override
Definition: backendselect.cpp:72
Configuration
Definition: configuration.h:21
BackendSelection::PromptForPassword
void PromptForPassword(void)
Definition: backendselect.cpp:355
BackendSelection::kManualConfigure
@ kManualConfigure
Definition: backendselect.h:43
BackendSelection::Decision
Decision
Definition: backendselect.h:41
configuration.h
kDefaultUSN
const QString kDefaultUSN
Definition: backendselect.h:25
BackendSelection::Prompt
static Decision Prompt(DatabaseParams *dbParams, Configuration *pConfig)
Definition: backendselect.cpp:48
BackendSelection::Load
void Load(void) override
Load data which will ultimately be displayed on-screen or used to determine what appears on-screen (S...
Definition: backendselect.cpp:242
BackendSelection::m_loop
QEventLoop * m_loop
Definition: backendselect.h:90
kDefaultPIN
const QString kDefaultPIN
Definition: backendselect.h:24
BackendSelection::m_cancelButton
MythUIButton * m_cancelButton
Definition: backendselect.h:82
BackendSelection::m_manualButton
MythUIButton * m_manualButton
Definition: backendselect.h:80
d
static const iso6937table * d
Definition: iso6937tables.cpp:1025
MythUIButtonList
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
Definition: mythuibuttonlist.h:191
kDefaultMFE
const QString kDefaultMFE
Definition: backendselect.h:23
BackendSelection::BackendSelection
BackendSelection(MythScreenStack *parent, DatabaseParams *params, Configuration *pConfig, bool exitOnFinish=false)
Definition: backendselect.cpp:17
mythscreentype.h