20 m_DBparams(params), m_pConfig(pConfig), m_exitOnFinish(exitOnFinish)
55 auto *backendSettings =
58 if (backendSettings->Create())
60 mainStack->
AddScreen(backendSettings,
false);
61 backendSettings->m_loop->exec();
62 ret = backendSettings->m_backendDecision;
63 mainStack->
PopScreen(backendSettings,
false);
66 delete backendSettings;
105 LOG(VB_GENERAL, LOG_ERR,
106 "Could not get device details from UI element?");
139 QString USN = dev->
m_sUSN;
155 infomap[
"version"] = infomap[
"modelnumber"].section(
'.', 0, 1);
158 qVariantFromValue(dev));
159 item->SetTextFromMap(infomap);
163 QString status =
"good";
165 status =
"protocolmismatch";
170 if (infomap[
"modelname"].isEmpty())
173 item->DisplayState(status,
"connection");
176 item->DisplayState(needPin ?
"yes" :
"no",
"securitypin");
199 if (backendName ==
"<Unknown>")
205 LOG(VB_UPNP, LOG_INFO,
206 QString(
"ConnectBackend() - success. New hostname: %1")
211 LOG(VB_GENERAL, LOG_ERR, QString(
"Need Human: %1").arg(message));
220 LOG(VB_GENERAL, LOG_ERR,
221 QString(
"Access denied for %1. Wrong PIN?")
227 LOG(VB_GENERAL, LOG_ERR,
228 QString(
"GetConnectionInfo() failed for %1 : %2")
229 .arg(backendName).arg(message));
258 EntryMap::const_iterator it;
259 for (it = ourMap.begin(); it != ourMap.end(); ++it)
276 ItemMap::iterator it =
m_devices.find(USN);
291 " host with default database parameters?")))
293 URL.remove(
"http://");
294 URL.remove(QRegExp(
"[:/].*"));
306 auto *me = dynamic_cast<MythEvent *>(event);
310 const QString& message = me->Message();
311 const QString& URI = me->ExtraData(0);
312 const QString& URN = me->ExtraData(1);
313 const QString&
URL = me->ExtraData(2);
316 LOG(VB_UPNP, LOG_DEBUG,
317 QString(
"BackendSelection::customEvent(%1, %2, %3, %4)")
318 .arg(message).arg(URI).arg(URN).arg(
URL));
320 if (message.startsWith(
"SSDP_ADD") &&
321 URI.startsWith(
"urn:schemas-mythtv-org:device:MasterMediaServer:"))
330 else if (message.startsWith(
"SSDP_REMOVE"))
339 auto *dce = dynamic_cast<DialogCompletionEvent*>(event);
343 QString resultid = dce->GetId();
345 if (resultid ==
"password")
355 QString message = tr(
"Please enter the backend access PIN");
362 if (pwDialog->Create())
364 pwDialog->SetReturnEvent(
this,
"password");
MythUIButton * m_saveButton
static SSDPCache * Instance()
void RemoveItem(const QString &USN)
MythConfirmationDialog * ShowOkPopup(const QString &message, QObject *parent, const char *slot, bool showCancel)
Non-blocking version of MythPopupBox::showOkPopup()
QHash< QString, QString > InfoMap
static Type MythEventMessage
bool ConnectBackend(DeviceLocation *dev)
Attempt UPnP connection to a backend device, get its DB details.
static void error(const char *str,...)
bool Create(void) override
MythUIButtonList * m_backendList
static void AddListener(QObject *listener)
const QString gBackendURI
Service type for the backend's UPnP server.
QString GetFriendlyName(void)
MythScreenStack * GetStack(const QString &stackname)
Decision m_backendDecision
static Decision Prompt(DatabaseParams *dbParams, Configuration *pConfig)
MythScreenStack * GetMainStack()
void PromptForPassword(void)
MythUIButton * m_cancelButton
MythUIButton * m_manualButton
void BuildFocusList(void)
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...
void GetEntryMap(EntryMap &)
Returns a copy of the EntryMap.
void LoadInBackground(const QString &message="")
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
void PerformSearch(const QString &sST, uint timeout_secs=2)
virtual int IncrRef(void)
Increments reference count.
virtual ~BackendSelection()
void Cancel(void)
Linked to 'Cancel' button.
static const uint16_t * d
void Close(void) override
virtual int DecrRef(void)
Decrements reference count and deletes on 0.
virtual bool Save(void)=0
#define MYTH_PROTO_VERSION
Increment this whenever the MythTV network protocol changes.
void customEvent(QEvent *event) override
DatabaseParams * m_DBparams
static void RemoveListener(QObject *listener)
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
MythMainWindow * GetMythMainWindow(void)
bool NeedSecurityPin(void)
QMap< QString, DeviceLocation * > EntryMap
Key == Unique Service Name (USN)
void Init(void) override
Used after calling Load() to assign data to widgets and other UI initilisation which is prohibited in...
Dialog prompting the user to enter a text string.
Configuration * m_pConfig
Structure containing the basic Database parameters.
void GetDeviceDetail(InfoMap &map)
#define LOG(_MASK_, _LEVEL_, _STRING_)
QString dbHostName
database server
virtual void PopScreen(MythScreenType *screen=nullptr, bool allowFade=true, bool deleteScreen=true)
void AddItem(DeviceLocation *dev)
UPnPResultCode GetConnectionInfo(const QString &sPin, DatabaseParams *pParams, QString &sMsg)
const QString kDefaultPIN
bool SetFocusWidget(MythUIType *widget=nullptr)
const QString kDefaultUSN
bool TryDBfromURL(const QString &error, QString URL)
static SSDPCacheEntries * Find(const QString &sURI)
Screen in which all other widgets are contained and rendered.
SSDPCacheEntries * Find(const QString &sURI)
Finds the SSDPCacheEntries in the cache, returns nullptr when absent.
MythUIType * GetChild(const QString &name) const
Get a named child of this UIType.
void Manual(void)
Linked to 'Configure Manually' button.
void CloseWithDecision(Decision)
virtual void SetValue(const QString &sSetting, int value)=0