Skip to content

Commit 549fb4d

Browse files
author
Mark Kendall
committed
Frontend Services: Extend action methods.
Add an optional context filter to GetActionList and add a new GetContextList method.
1 parent 0c2d019 commit 549fb4d

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

mythtv/libs/libmythservicecontracts/services/frontendServices.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ class SERVICE_PUBLIC FrontendServices : public Service
2323
virtual bool SendAction(const QString &Action,
2424
const QString &File,
2525
uint Width, uint Height) = 0;
26-
virtual DTC::FrontendActionList* GetActionList(void) = 0;
26+
virtual QStringList GetContextList(void) = 0;
27+
virtual DTC::FrontendActionList* GetActionList(const QString &Context) = 0;
28+
29+
2730
};
2831

2932
#endif // FRONTENDSERVICES_H

mythtv/programs/mythfrontend/services/frontend.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,13 @@ bool Frontend::SendAction(const QString &Action, const QString &File,
7171
return true;
7272
}
7373

74-
DTC::FrontendActionList* Frontend::GetActionList(void)
74+
QStringList Frontend::GetContextList(void)
75+
{
76+
InitialiseActions();
77+
return gActionDescriptions.keys();
78+
}
79+
80+
DTC::FrontendActionList* Frontend::GetActionList(const QString &Context)
7581
{
7682
DTC::FrontendActionList *list = new DTC::FrontendActionList();
7783

@@ -81,6 +87,9 @@ DTC::FrontendActionList* Frontend::GetActionList(void)
8187
while (contexts.hasNext())
8288
{
8389
contexts.next();
90+
if (!Context.isEmpty() && contexts.key() != Context)
91+
continue;
92+
8493
// TODO can we keep the context data with QMap<QString, QStringList>?
8594
QStringList actions = contexts.value();
8695
foreach (QString action, actions)

mythtv/programs/mythfrontend/services/frontend.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ class Frontend : public FrontendServices
1818
bool SendMessage(const QString &Message);
1919
bool SendAction(const QString &Action, const QString &File,
2020
uint Width, uint Height);
21-
DTC::FrontendActionList* GetActionList(void);
21+
QStringList GetContextList(void);
22+
DTC::FrontendActionList* GetActionList(const QString &Context);
23+
2224

2325
static bool IsValidAction(const QString &action);
2426
static void InitialiseActions(void);

0 commit comments

Comments
 (0)