Merge pull request #4775 from jmarshallnz/empty_episode_playcount
[vuplus_xbmc] / xbmc / dialogs / GUIDialogKaiToast.h
1 #pragma once
2
3 /*
4  *      Copyright (C) 2005-2013 Team XBMC
5  *      http://xbmc.org
6  *
7  *  This Program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation; either version 2, or (at your option)
10  *  any later version.
11  *
12  *  This Program is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with XBMC; see the file COPYING.  If not, see
19  *  <http://www.gnu.org/licenses/>.
20  *
21  */
22
23 #include "guilib/GUIDialog.h"
24
25 #include <queue>
26
27 #define TOAST_DISPLAY_TIME   5000L  // default 5 seconds
28 #define TOAST_MESSAGE_TIME   1000L  // minimal message time 1 second
29
30 class CGUIDialogKaiToast: public CGUIDialog
31 {
32 public:
33   CGUIDialogKaiToast(void);
34   virtual ~CGUIDialogKaiToast(void);
35
36   enum eMessageType { Default = 0, Info, Warning, Error };
37
38   struct Notification
39   {
40     CStdString caption;
41     CStdString description;
42     CStdString imagefile;
43     eMessageType eType;
44     unsigned int displayTime;
45     unsigned int messageTime;
46     bool withSound;
47   };
48
49   typedef std::queue<Notification> TOASTQUEUE;
50
51   static void QueueNotification(eMessageType eType, const CStdString& aCaption, const CStdString& aDescription, unsigned int displayTime = TOAST_DISPLAY_TIME, bool withSound = true, unsigned int messageTime = TOAST_MESSAGE_TIME);
52   static void QueueNotification(const CStdString& aCaption, const CStdString& aDescription);
53   static void QueueNotification(const CStdString& aImageFile, const CStdString& aCaption, const CStdString& aDescription, unsigned int displayTime = TOAST_DISPLAY_TIME, bool withSound = true, unsigned int messageTime = TOAST_MESSAGE_TIME);
54   bool DoWork();
55
56   virtual bool OnMessage(CGUIMessage& message);
57   virtual void OnWindowLoaded();
58   virtual void FrameMove();
59   void ResetTimer();
60
61 protected:
62   static void AddToQueue(const CStdString& aImageFile, const eMessageType eType, const CStdString& aCaption, const CStdString& aDescription, unsigned int displayTime, bool withSound, unsigned int messageTime);
63
64   unsigned int m_timer;
65
66   unsigned int m_toastDisplayTime;
67   unsigned int m_toastMessageTime;
68
69   CStdString m_defaultIcon;
70   
71   static TOASTQUEUE m_notifications;
72   static CCriticalSection m_critical;
73 };