Skip to content

Commit

Permalink
mythcontext.cpp: remove pointless casts
Browse files Browse the repository at this point in the history
I don't like the pointer use of BackendSelection::Prompt(), but I am not
investigating replacing it at this time.  It should probably return a DatabaseParams
and take by reference as an output a BackendSelection::Decision (enum).
  • Loading branch information
ulmus-scott committed Jan 7, 2022
1 parent 381a3c9 commit 13b0a44
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
1 change: 0 additions & 1 deletion mythtv/libs/libmyth/backendselect.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class BackendSelection : public MythScreenType
kAcceptConfigure = +1,
};
static Decision Prompt(DatabaseParams *dbParams, const QString& config_filename);
// TODO return a DatabaseParams, use a bool& parameter

BackendSelection(MythScreenStack *parent, DatabaseParams *params,
QString config_filename, bool exitOnFinish = false);
Expand Down
11 changes: 6 additions & 5 deletions mythtv/libs/libmyth/mythcontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ class MythContextPrivate : public QObject
void EnableDBerrors(void);
void ResetDatabase(void) const;

int ChooseBackend(const QString &error);
BackendSelection::Decision
ChooseBackend(const QString &error);
int UPnPautoconf(std::chrono::milliseconds milliSeconds = 2s);
bool DefaultUPnP(QString& Error);
bool UPnPconnect(const DeviceLocation *backend, const QString &PIN);
Expand Down Expand Up @@ -499,8 +500,7 @@ bool MythContextPrivate::FindDatabase(bool prompt, bool noAutodetect)
if (manualSelect)
{
// Get the user to select a backend from a possible list:
auto d = (BackendSelection::Decision)ChooseBackend(failure);
switch (d)
switch (ChooseBackend(failure))
{
case BackendSelection::kAcceptConfigure:
break;
Expand Down Expand Up @@ -1157,7 +1157,7 @@ void MythContextPrivate::ResetDatabase(void) const
/**
* Search for backends via UPnP, put up a UI for the user to choose one
*/
int MythContextPrivate::ChooseBackend(const QString &error)
BackendSelection::Decision MythContextPrivate::ChooseBackend(const QString &error)
{
TempMainWindow();

Expand All @@ -1172,10 +1172,11 @@ int MythContextPrivate::ChooseBackend(const QString &error)

BackendSelection::Decision ret =
BackendSelection::Prompt(&m_dbParams, k_config_filename);
// TODO encapuslation: don't use a pointer

EndTempWindow();

return (int)ret;
return ret;
}

/**
Expand Down

0 comments on commit 13b0a44

Please sign in to comment.