NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 69 70 71 72 73 … 93 Next »
UberPanel

 
  • 0 Vote(s) - 0 Average
UberPanel
reven
Offline

Posting Freak

Posts: 5,782
Threads: 396
Joined: Sep 2004
#1
2005-07-28, 04:07 AM
i was hoping that jeff could adapt his current panel to allow for any plugin to easily send notifications to the user, these notifications would all follow the same pattern, ie all have
- a title
- a message
- an image (a default image if not specified)

and since all these notifications would be extremely similar it would be best if they looked exactly the same, and appeared in the same place, and only appeared one at a time. jeff has pretty much done this, but i think it needs to be modified a little, so i was hoping that us developers could discuss what we would need out of this Uber Panel. well we should really have 2 panels, one for notifications and one for looping annoucements (eg weather). The basic idea i think for messages is to be similar to a windows popup message, have categories like: alert/warning, information, err whatever else they've got, so either different signatures for different types, or just a extra parameters specify the message type. so what do you guys think? and more importantly, jeff you cool with this? Smile

the only panel i would really want that is seperate (well that exists at the moment) would be the music panel (i like that to be displayed all the time when music is playing back).
Jeff
Offline

Posting Freak

Posts: 1,933
Threads: 69
Joined: Oct 2004
#2
2005-07-28, 06:08 AM
I'm open to making changes. The panel I have has an API. You can look at the VAPanel class in the CommonGBPVRUtilities and let me know what you think.

Jeff
reven
Offline

Posting Freak

Posts: 5,782
Threads: 396
Joined: Sep 2004
#3
2005-07-28, 08:21 AM
ok ill take a look at it when i get a chance.
reven
Offline

Posting Freak

Posts: 5,782
Threads: 396
Joined: Sep 2004
#4
2005-07-31, 01:10 AM
hey jeff i took a look at the doc, and my inital thoughts are to add these methods, or something similar
Code:
// returns an unique indentifier that can be used to access the panel, so you can easily update the message without readding the panel
// lifetime is how long the message should be displayed before its removed (well how long should it be kept as a panel to be shown.
public int AddPanelMessage(string title, string message, long lifeTimeInSeconds, Image OptionalParamPic){}

public void UpdatePanel(int uniqueID, string title, string message, long lifetime, Image OptionParamPic){}

public void RemovePanel(int uniqueID){}
this would be for the weather/diskspace etc panel, and for the "Message/Alert Panel" a message should only be shown once for a constant amount of time, eg 5-10 seconds. and then removed completely. And each message should be First in first Out, and you only need a method like
Code:
private void ShowMessage(string title, string message, Image imageshown){}
private void ShowMessage(string title, string message, int MODE){}
where mode are constant ints for like "Alert","Warning" etc.
jasjol
Offline

Senior Member

Posts: 270
Threads: 78
Joined: Dec 2004
#5
2005-07-31, 08:36 AM
reven Wrote:for the "Message/Alert Panel" a message should only be shown once for a constant amount of time, eg 5-10 seconds. and then removed completely. And each message should be First in first Out, and you only need a method

I wonder how you mean - if the alert is only shown to the user once and only for 5-10 seconds - I would think most people would miss the alert, because of not watching those 5 seconds etc.

Or am I missing something here?
Using DELL P4 1.5GB RAM 250 GB HD + DLINK DNS313 netdisk 1,5TB, 2 pieces of Hauppauge PVR150 w/45-button remote, 1 Popcorn Hour 110. Win XP SP3. GB-PVR v1.4.7 Plugins: Xrecord
reven
Offline

Posting Freak

Posts: 5,782
Threads: 396
Joined: Sep 2004
#6
2005-07-31, 09:53 AM
like if someone signs onto MSN you dont want to show the message constantly, you just want to flash it when it happens. just small alerts like, "DVD Rip complete" it doesnt need to stay there, and its not important if you user misses it, just if they see it, they know.
reven
Offline

Posting Freak

Posts: 5,782
Threads: 396
Joined: Sep 2004
#7
2005-07-31, 07:30 PM
nope.
reven
Offline

Posting Freak

Posts: 5,782
Threads: 396
Joined: Sep 2004
#8
2005-08-01, 03:54 AM
i guess i should say why im not going to add support for those other chat programs, since i probably use yahoo more than any other, its because there dont seem to be any free (well i couldnt find any) libraries for these chat programs, i found this wonderful msn library called "dotMSN", now what this does is take care of the entire MSN client (ie the sign ins/out, file sharing, the entire thing, its a wonderful library), i dont have to write the message protocols etc (that would be a lot of work) all i have to do is the interface (and figure out how to use the library, which does take awhile by itself).

sorry about be short before, i was running out the door to uni (im not a morning person).
Jeff
Offline

Posting Freak

Posts: 1,933
Threads: 69
Joined: Oct 2004
#9
2005-08-04, 06:40 PM
reven Wrote:hey jeff i took a look at the doc, and my inital thoughts are to add these methods, or something similar
Code:
// returns an unique indentifier that can be used to access the panel, so you can easily update the message without readding the panel
// lifetime is how long the message should be displayed before its removed (well how long should it be kept as a panel to be shown.
public int AddPanelMessage(string title, string message, long lifeTimeInSeconds, Image OptionalParamPic){}

public void UpdatePanel(int uniqueID, string title, string message, long lifetime, Image OptionParamPic){}

public void RemovePanel(int uniqueID){}
this would be for the weather/diskspace etc panel, and for the "Message/Alert Panel" a message should only be shown once for a constant amount of time, eg 5-10 seconds. and then removed completely. And each message should be First in first Out, and you only need a method like
Code:
private void ShowMessage(string title, string message, Image imageshown){}
private void ShowMessage(string title, string message, int MODE){}
where mode are constant ints for like "Alert","Warning" etc.


I have updated the panel class in the CommonGBPVRUtilities to do all of these things. A copy of the new help file is attached; let me know what you think.

When you look at it, think of the VAPanel class as being used by two types of applications. The first class is those applications that want to post messages to be displayed on a panel. For them there are methods to add and remove messages. The messages can optionally include an image and an automatic timeout. Messages can be posted at any of 5 levels, where 0 is the highest and 4 is the lowest. Rather than an integer of a unique ID I use a string since that makes it easier to debug when looking at the log. Of course the string you pass could be an integer.ToString() if you want, for example, to generate a random number to use as your ID.

The second class of applications that can use the VAPanel class are panels that want to display the messages. I have implemented one such panel in the Video Archive panel. I have updated the panel for the next release to be more flexible and to have the ability to display multiple message priorities at the same time and to show icons. This panel works more or less like the “Uber Panel” that Reven described.

There can, however, be multiple panels running at the same time retrieving information from the message queues. For example, you could create a dedicated panel that would just show high priority messages. This would be like the Alert panel that Reven described.

As a simple test case, I wrote a second panel to do just this. Rather than cycle through all the top priority messages, it just displays the first one in the queue. When that one clears it will display the next one and so on until the queue is empty, at which point the panel will disappear from the screen. I have run it at the same time as the VAPanel and they both play well with each other.

The code is below:

Code:
using System;
using GBPVR.Public;
using System.Collections;
using System.Drawing;
using System.Xml;
using CommonGBPVRUtilities;

namespace AlarmPanelPlugIn
{
    /// <summary>
    /// Summary description for AlarmPanel.
    /// </summary>
    public class AlarmPanel : IInfoPanel
    {
        private string lastMessageDisplayed;
        
        public AlarmPanel()
        {
            // Don't run in the config app
            if (PluginHelperFactory.getPluginHelper() == null) return;

            // Make sure we have a skin file
            SkinUtilities.CreateSkinSubDirIfNeeded("panels");
            SkinUtilities.CopyFileFromBlueSkinToActiveSkin("AlarmPanel.xml", "panels");
        }

        public string getPanelName()
        {    
            return "AlarmPanel";
        }

        /// <summary>Called every second or so when the panel is visible</summary>
        public bool panelNeedsRendering()
        {        
            // See what the highest priority alarm message is
            string currentMessage = CommonGBPVRUtilities.VAPanel.GetPanelMessage(0, 0);
            if (currentMessage.Length == 0)
                currentMessage = CommonGBPVRUtilities.VAPanel.GetPanelMessage(1, 0);

            // See if it is the same as what we last displayed
            if (currentMessage == lastMessageDisplayed)
                return false;
            else
                return true;
        }


        /// <summary>
        /// Called by GBPVR to render the image shown to the user
        /// This could be called because we have asked the panel to rerender, because another
        /// panel has asked GBPVR to rerender or because the user has switched buttons, which
        /// will force a rerender.  
        /// </summary>
        public Image renderPanel()
        {    
            Hashtable args = new Hashtable();
            
            // setup skin helper
            XmlDocument document = new XmlDocument();
            document.Load(GBPVRInfo.FullActiveSkinPath + "\\panels\\AlarmPanel.xml");
            SkinHelper myskinHelper = new SkinHelper(document, GBPVRInfo.FullActiveSkinPath + "panels");            
            
            args["@AlarmMessageWithIcon"]="";
            args["@AlarmMessageWithoutIcon"]="";
            
            string panelMessageString = "";
            Image panelMessageIcon = null;

            // Always display the higest priority alarm; start by trying to get the first message from the first
            // mesasge queue.  If that doesn't work (because the queue is empty), try to get the first message from
            // the second priority message queue.  All offsets are zero based (e.g., the first queue is 0).
            PanelMessage panelMessage = CommonGBPVRUtilities.VAPanel.GetPanelMessageStructure(0, 0);
            if (panelMessage != null)
            {
                panelMessageString = panelMessage.Message;
                panelMessageIcon = panelMessage.Icon;
            }
            else if ((panelMessage = CommonGBPVRUtilities.VAPanel.GetPanelMessageStructure (1, 0)) != null)
            {
                panelMessageString = panelMessage.Message;
                panelMessageIcon = panelMessage.Icon;
            }

            if (panelMessageIcon == null)
                args["@AlarmMessageWithoutIcon"] = panelMessageString;
            else
                args["@AlarmMessageWithIcon"] = panelMessageString;

            // Save a copy of the last message displayed
            lastMessageDisplayed = panelMessageString;

            Image offScreenBmp = myskinHelper.getNamedImage("AlarmPanel", args);
            Graphics offScreenDC = Graphics.FromImage(offScreenBmp);

            // See if we have a message level icon to show
            if (panelMessageIcon != null)
            {
                ScreenBoxParams IconBox = UiUtilities.getBoxSettings(myskinHelper, "MessageIcon");
                if (IconBox != null)
                    UiUtilities.DrawScaledCenteredImage(offScreenDC, panelMessageIcon, IconBox.StartX, IconBox.StartY, IconBox.Width, IconBox.Height);
            }

            offScreenDC.DrawImage(offScreenBmp, 0, 0);
            
            offScreenDC.Dispose();

            return offScreenBmp;
        }
    }
}

And, here is a sample AlarmPanel.xml skin file

Code:
<settings>
    <!-- Text Style -->
    <TextStyles>
        <TextStyle name="WarningText" color="Red" typeFace="Arial Narrow" size="16" style="bold"/>
    </TextStyles>
    
    <!-- Composite Images -->    
    <CompositeImages>
        <CompositeImage name="AlarmPanel" size="320,80">            
            <DrawText text="@AlarmMessageWithIcon" loc="42,0" size="280,850" textStyle="WarningText" align="Left"/>    
            <DrawText text="@AlarmMessageWithoutIcon" loc="0,0" size="320,850" textStyle="WarningText" align="Left"/>    
        </CompositeImage>                                        
    </CompositeImages>        
                

    <!-- Special Elements -->
    <SpecialElements>
        <SpecialElement name="AlarmPanel" size="320,80"/>
        
        <!-- The image location of the highest priority message being displayed -->    
        <SpecialElement name="MessageIcon" loc="0,0" size="40,40"/>        
    </SpecialElements>    
</settings>

I am going to test my setup for a few more days before I feel comfortable releasing the updates. I changed some of the interfaces during this process so I will need to do a simultaneous release of the Video Archive, Music Player, and Weather, plug-ins as well as the CommonGBPVRUtilies library. I figured it was better to change the interfaces now when no one else was using them rather than carry the old version forward for legacy support.

Jeff
reven
Offline

Posting Freak

Posts: 5,782
Threads: 396
Joined: Sep 2004
#10
2005-08-07, 10:13 PM
sounds good, but i wont really know until i start playing around with it (thats always the case). and what about the new IVideoPlugin (i think thats what its called) can you add support for that, so the message shows up under that circumstance (trying not to say to much and get into trouble again Smile).
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode