home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
HTPC Projects
Hardware
Ambient Lighting System
AtmoHue - BETA - Philips Hue support for AtmoLight & AtmoWin
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Lightning303" data-source="post: 1112313" data-attributes="member: 97876"><p>I see <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite1" alt=":)" title="Smile :)" loading="lazy" data-shortname=":)" /></p><p>Yeah that would be possible. I thought about it a bit and came up with 2 different approaches. Not sure which one is best though <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite7" alt=":p" title="Stick Out Tongue :p" loading="lazy" data-shortname=":p" />. I think approach 2, but lets see what [USER=17766]@Rick164[/USER] says.</p><p></p><p>First approach:</p><p>We would need to extend ITargets, added methods like GetContextMenuContent() and ExecuteCommand(string commands).</p><p>And in every Target we would need to add a roadmap how to build the menu. E.g. for Hue</p><p></p><p>item="Use all Groups"</p><p>onPress="group:all"</p><p></p><p>item="Use group:"</p><p>onPress="group:[keyboard]"</p><p></p><p>where MP1 plugin would need to open the onscreen keyboard when it sees the [keyboard].</p><p></p><p>Not sure which data format would be best for this, as we could also use submenus, so maybe json or something similar?</p><p></p><p>In core we would have a method that collects all the menu infos (calling GetContextMenuContent() on every enabled target).</p><p></p><p>And in MP1 we would call this method in core and then would need to parse all these information to then build a menu out of that.</p><p>When an item is selected, we would call the core with the result, e.g. ExecuteCommand(Target.Hue, "group:all"), the core then sends it to hue handler with ExecuteCommand("group:all") and HueHandler would need to parse this and then set the group to all in this example.</p><p></p><p>I reckon this would be quite some work. Also not sure if we would need the menu layout in the handler, as displaying and the way something is displayed is not the task of the handler or core.</p><p></p><p></p><p>Second approach:</p><p>In MP1 check if Hue is a target, and then get its instance.</p><p></p><p>We would need this in core:</p><p>[code] public ITargets GetTarget(Target target)</p><p> {</p><p> lock (targetsLock)</p><p> {</p><p> foreach (var t in targets)</p><p> {</p><p> if (t.Name == target)</p><p> {</p><p> return t;</p><p> }</p><p> }</p><p> }</p><p> return null;</p><p> }[/code]</p><p></p><p>and in MP1 we could do:</p><p>[code]var hueTarget = coreObject.GetTarget(Target.Hue) as AtmoLight.Targets.HueHandler;[/code]</p><p></p><p>And now we could use hueTarget.ChangeGroup("all") fo example.</p><p></p><p></p><p>Context Menu in general [USER=17766]@Rick164[/USER]:</p><p>The context menu starts here: <a href="https://github.com/ambilight-4-mediaportal/AtmoLight/blob/master/AtmoLight.MediaPortal1/Plugin.cs#L644" target="_blank">https://github.com/ambilight-4-mediaportal/AtmoLight/blob/master/AtmoLight.MediaPortal1/Plugin.cs#L644</a></p><p></p><p>The general layout is:</p><p>[code] GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);</p><p> dlg.Reset();</p><p> dlg.SetHeading("AtmoLight");</p><p> dlg.Add(new GUIListItem("Item 1"));</p><p> dlg.Add(new GUIListItem("Item 2"));</p><p> dlg.Add(new GUIListItem("Item 3"));</p><p> dlg.SelectedLabel = 0;</p><p> dlg.DoModal(GUIWindowManager.ActiveWindow);</p><p></p><p> if (dlg.SelectedLabelText == "Item 1")</p><p> {</p><p> // do this</p><p> }</p><p> ....[/code]</p><p></p><p>So we would need to add a new Item to DialogContextMenu() and when that is selected we would need to make a new GUIDialogMenu that then has all the Hue stuff in it. Either having this generated dynamically with approach 1 or code it into MP1 plugin with approach 2, or you have some other ideas <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite1" alt=":)" title="Smile :)" loading="lazy" data-shortname=":)" />.</p></blockquote><p></p>
[QUOTE="Lightning303, post: 1112313, member: 97876"] I see :) Yeah that would be possible. I thought about it a bit and came up with 2 different approaches. Not sure which one is best though :P. I think approach 2, but lets see what [USER=17766]@Rick164[/USER] says. First approach: We would need to extend ITargets, added methods like GetContextMenuContent() and ExecuteCommand(string commands). And in every Target we would need to add a roadmap how to build the menu. E.g. for Hue item="Use all Groups" onPress="group:all" item="Use group:" onPress="group:[keyboard]" where MP1 plugin would need to open the onscreen keyboard when it sees the [keyboard]. Not sure which data format would be best for this, as we could also use submenus, so maybe json or something similar? In core we would have a method that collects all the menu infos (calling GetContextMenuContent() on every enabled target). And in MP1 we would call this method in core and then would need to parse all these information to then build a menu out of that. When an item is selected, we would call the core with the result, e.g. ExecuteCommand(Target.Hue, "group:all"), the core then sends it to hue handler with ExecuteCommand("group:all") and HueHandler would need to parse this and then set the group to all in this example. I reckon this would be quite some work. Also not sure if we would need the menu layout in the handler, as displaying and the way something is displayed is not the task of the handler or core. Second approach: In MP1 check if Hue is a target, and then get its instance. We would need this in core: [code] public ITargets GetTarget(Target target) { lock (targetsLock) { foreach (var t in targets) { if (t.Name == target) { return t; } } } return null; }[/code] and in MP1 we could do: [code]var hueTarget = coreObject.GetTarget(Target.Hue) as AtmoLight.Targets.HueHandler;[/code] And now we could use hueTarget.ChangeGroup("all") fo example. Context Menu in general [USER=17766]@Rick164[/USER]: The context menu starts here: [url]https://github.com/ambilight-4-mediaportal/AtmoLight/blob/master/AtmoLight.MediaPortal1/Plugin.cs#L644[/url] The general layout is: [code] GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); dlg.Reset(); dlg.SetHeading("AtmoLight"); dlg.Add(new GUIListItem("Item 1")); dlg.Add(new GUIListItem("Item 2")); dlg.Add(new GUIListItem("Item 3")); dlg.SelectedLabel = 0; dlg.DoModal(GUIWindowManager.ActiveWindow); if (dlg.SelectedLabelText == "Item 1") { // do this } ....[/code] So we would need to add a new Item to DialogContextMenu() and when that is selected we would need to make a new GUIDialogMenu that then has all the Hue stuff in it. Either having this generated dynamically with approach 1 or code it into MP1 plugin with approach 2, or you have some other ideas :). [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
HTPC Projects
Hardware
Ambient Lighting System
AtmoHue - BETA - Philips Hue support for AtmoLight & AtmoWin
Contact us
RSS
Top
Bottom