Go to the documentation of this file.
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;
104 LOG(VB_GENERAL, LOG_ERR,
105 "Could not get device details from UI element?");
138 QString usn = dev->
m_sUSN;
154 infomap[
"version"] = infomap[
"modelnumber"].section(
'.', 0, 1);
157 QVariant::fromValue(dev));
158 item->SetTextFromMap(infomap);
162 QString status =
"good";
164 status =
"protocolmismatch";
169 if (infomap[
"modelname"].isEmpty())
172 item->DisplayState(status,
"connection");
175 item->DisplayState(needPin ?
"yes" :
"no",
"securitypin");
197 if (backendName ==
"<Unknown>")
203 LOG(VB_UPNP, LOG_INFO,
204 QString(
"ConnectBackend() - success. New hostname: %1")
209 LOG(VB_GENERAL, LOG_ERR, QString(
"Need Human: %1").
arg(message));
218 LOG(VB_GENERAL, LOG_ERR,
219 QString(
"Access denied for %1. Wrong PIN?")
225 LOG(VB_GENERAL, LOG_ERR,
226 QString(
"GetConnectionInfo() failed for %1 : %2")
227 .
arg(backendName).
arg(message));
256 for (
auto * devLoc : qAsConst(ourMap))
273 ItemMap::iterator it =
m_devices.find(USN_);
288 " host with default database parameters?")))
290 QRegularExpression re {
"http[s]?://([^:/]+)", QRegularExpression::CaseInsensitiveOption};
291 QRegularExpressionMatch match = re.match(URL);
292 if (match.hasMatch())
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)")
320 if (message.startsWith(
"SSDP_ADD") &&
321 URI.startsWith(
"urn:schemas-mythtv-org:device:MasterMediaServer:"))
330 else if (message.startsWith(
"SSDP_REMOVE"))
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");
DatabaseParams * m_dbParams
void LoadInBackground(const QString &message="")
MythScreenStack * GetMainStack()
void Cancel(void)
Linked to 'Cancel' button.
void Close(void) override
static Type MythEventMessage
QString m_dbHostName
database server
static void error(const char *str,...)
virtual int DecrRef(void)
Decrements reference count and deletes on 0.
void PerformSearch(const QString &sST, std::chrono::seconds timeout=2s)
void Init(void) override
Used after calling Load() to assign data to widgets and other UI initilisation which is prohibited in...
Configuration * m_pConfig
void customEvent(QEvent *event) override
Structure containing the basic Database parameters.
MythUIType * GetChild(const QString &name) const
Get a named child of this UIType.
This class is used as a container for messages.
void AddItem(DeviceLocation *dev)
arg(title).arg(filename).arg(doDelete))
static SSDPCacheEntries * Find(const QString &sURI)
QString GetFriendlyName(void)
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Screen in which all other widgets are contained and rendered.
void GetEntryMap(EntryMap &map)
Returns a copy of the EntryMap.
static SSDPCache * Instance()
const QString & Message() const
@ UPnPResult_HumanInterventionRequired
QHash< QString, QString > InfoMap
bool NeedSecurityPin(void)
virtual void SetValue(const QString &sSetting, int value)=0
void CloseWithDecision(Decision d)
bool SetFocusWidget(MythUIType *widget=nullptr)
SSDPCacheEntries * Find(const QString &sURI)
Finds the SSDPCacheEntries in the cache, returns nullptr when absent.
void RemoveItem(const QString &USN)
void BuildFocusList(void)
void Manual(void)
Linked to 'Configure Manually' button.
QMap< QString, DeviceLocation * > EntryMap
Key == Unique Service Name (USN)
MythUIButton * m_saveButton
const QString kBackendURI
@ UPnPResult_ActionNotAuthorized
bool ConnectBackend(DeviceLocation *dev)
Attempt UPnP connection to a backend device, get its DB details.
~BackendSelection() override
MythUIButtonList * m_backendList
#define MYTH_PROTO_VERSION
Increment this whenever the MythTV network protocol changes.
bool TryDBfromURL(const QString &error, const QString &URL)
Decision m_backendDecision
bool Create(void) override
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
void PromptForPassword(void)
virtual bool Save(void)=0
Event dispatched from MythUI modal dialogs to a listening class containing a result of some form.
virtual void PopScreen(MythScreenType *screen=nullptr, bool allowFade=true, bool deleteScreen=true)
const QString kDefaultUSN
MythMainWindow * GetMythMainWindow(void)
static Decision Prompt(DatabaseParams *dbParams, Configuration *pConfig)
UPnPResultCode GetConnectionInfo(const QString &sPin, DatabaseParams *pParams, QString &sMsg)
void Load(void) override
Load data which will ultimately be displayed on-screen or used to determine what appears on-screen (S...
MythScreenStack * GetStack(const QString &Stackname)
const QString kDefaultPIN
MythUIButton * m_cancelButton
static void AddListener(QObject *listener)
MythUIButton * m_manualButton
static const iso6937table * d
Dialog prompting the user to enter a text string.
virtual int IncrRef(void)
Increments reference count.
BackendSelection(MythScreenStack *parent, DatabaseParams *params, Configuration *pConfig, bool exitOnFinish=false)
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
MythConfirmationDialog * ShowOkPopup(const QString &message, bool showCancel)
Non-blocking version of MythPopupBox::showOkPopup()
static void RemoveListener(QObject *listener)
void GetDeviceDetail(InfoMap &map)