Merge pull request #473 from Montellese/onplaybackspeedchanged
[vuplus_xbmc] / xbmc / GUIInfoManager.h
1 /*!
2 \file GUIInfoManager.h
3 \brief
4 */
5
6 #ifndef GUIINFOMANAGER_H_
7 #define GUIINFOMANAGER_H_
8
9 /*
10  *      Copyright (C) 2005-2008 Team XBMC
11  *      http://www.xbmc.org
12  *
13  *  This Program is free software; you can redistribute it and/or modify
14  *  it under the terms of the GNU General Public License as published by
15  *  the Free Software Foundation; either version 2, or (at your option)
16  *  any later version.
17  *
18  *  This Program is distributed in the hope that it will be useful,
19  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
20  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  *  GNU General Public License for more details.
22  *
23  *  You should have received a copy of the GNU General Public License
24  *  along with XBMC; see the file COPYING.  If not, write to
25  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
26  *  http://www.gnu.org/copyleft/gpl.html
27  *
28  */
29
30 #include "Temperature.h"
31 #include "threads/CriticalSection.h"
32 #include "guilib/IMsgTargetCallback.h"
33 #include "inttypes.h"
34 #include "XBDateTime.h"
35 #include "interfaces/info/SkinVariable.h"
36
37 #include <list>
38 #include <map>
39
40 namespace MUSIC_INFO
41 {
42   class CMusicInfoTag;
43 }
44 class CVideoInfoTag;
45 class CFileItem;
46 class CGUIListItem;
47 class CDateTime;
48 namespace INFO
49 {
50   class InfoBool;
51   class InfoSingle;
52 }
53
54 // conditions for window retrieval
55 #define WINDOW_CONDITION_HAS_LIST_ITEMS  1
56 #define WINDOW_CONDITION_IS_MEDIA_WINDOW 2
57
58 #define PLAYER_HAS_MEDIA              1
59 #define PLAYER_HAS_AUDIO              2
60 #define PLAYER_HAS_VIDEO              3
61 #define PLAYER_PLAYING                4
62 #define PLAYER_PAUSED                 5
63 #define PLAYER_REWINDING              6
64 #define PLAYER_REWINDING_2x           7
65 #define PLAYER_REWINDING_4x           8
66 #define PLAYER_REWINDING_8x           9
67 #define PLAYER_REWINDING_16x         10
68 #define PLAYER_REWINDING_32x         11
69 #define PLAYER_FORWARDING            12
70 #define PLAYER_FORWARDING_2x         13
71 #define PLAYER_FORWARDING_4x         14
72 #define PLAYER_FORWARDING_8x         15
73 #define PLAYER_FORWARDING_16x        16
74 #define PLAYER_FORWARDING_32x        17
75 #define PLAYER_CAN_RECORD            18
76 #define PLAYER_RECORDING             19
77 #define PLAYER_CACHING               20
78 #define PLAYER_DISPLAY_AFTER_SEEK    21
79 #define PLAYER_PROGRESS              22
80 #define PLAYER_SEEKBAR               23
81 #define PLAYER_SEEKTIME              24
82 #define PLAYER_SEEKING               25
83 #define PLAYER_SHOWTIME              26
84 #define PLAYER_TIME                  27
85 #define PLAYER_TIME_REMAINING        28
86 #define PLAYER_DURATION              29
87 #define PLAYER_SHOWCODEC             30
88 #define PLAYER_SHOWINFO              31
89 #define PLAYER_VOLUME                32
90 #define PLAYER_MUTED                 33
91 #define PLAYER_HASDURATION           34
92 #define PLAYER_CHAPTER               35
93 #define PLAYER_CHAPTERCOUNT          36
94 #define PLAYER_TIME_SPEED            37
95 #define PLAYER_FINISH_TIME           38
96 #define PLAYER_CACHELEVEL            39
97 #define PLAYER_STAR_RATING           40
98 #define PLAYER_CHAPTERNAME           41
99 #define PLAYER_SUBTITLE_DELAY        42
100 #define PLAYER_AUDIO_DELAY           43
101 #define PLAYER_PASSTHROUGH           44
102 #define PLAYER_PATH                  45
103 #define PLAYER_FILEPATH              46
104 #define PLAYER_SEEKOFFSET            47
105 #define PLAYER_PROGRESS_CACHE        48
106
107 #define WEATHER_CONDITIONS          100
108 #define WEATHER_TEMPERATURE         101
109 #define WEATHER_LOCATION            102
110 #define WEATHER_IS_FETCHED          103
111 #define WEATHER_FANART_CODE         104
112 #define WEATHER_PLUGIN              105
113
114 #define SYSTEM_TEMPERATURE_UNITS    106
115 #define SYSTEM_PROGRESS_BAR         107
116 #define SYSTEM_LANGUAGE             108
117 #define SYSTEM_TIME                 110
118 #define SYSTEM_DATE                 111
119 #define SYSTEM_CPU_TEMPERATURE      112
120 #define SYSTEM_GPU_TEMPERATURE      113
121 #define SYSTEM_FAN_SPEED            114
122 #define SYSTEM_FREE_SPACE_C         115
123 // #define SYSTEM_FREE_SPACE_D         116 //116 is reserved for space on D
124 #define SYSTEM_FREE_SPACE_E         117
125 #define SYSTEM_FREE_SPACE_F         118
126 #define SYSTEM_FREE_SPACE_G         119
127 #define SYSTEM_BUILD_VERSION        120
128 #define SYSTEM_BUILD_DATE           121
129 #define SYSTEM_ETHERNET_LINK_ACTIVE 122
130 #define SYSTEM_FPS                  123
131 #define SYSTEM_ALWAYS_TRUE          125   // useful for <visible fade="10" start="hidden">true</visible>, to fade in a control
132 #define SYSTEM_ALWAYS_FALSE         126   // used for <visible fade="10">false</visible>, to fade out a control (ie not particularly useful!)
133 #define SYSTEM_MEDIA_DVD            127
134 #define SYSTEM_DVDREADY             128
135 #define SYSTEM_HAS_ALARM            129
136 #define SYSTEM_SCREEN_MODE          132
137 #define SYSTEM_SCREEN_WIDTH         133
138 #define SYSTEM_SCREEN_HEIGHT        134
139 #define SYSTEM_CURRENT_WINDOW       135
140 #define SYSTEM_CURRENT_CONTROL      136
141 #define SYSTEM_DVD_LABEL            138
142 #define SYSTEM_HAS_DRIVE_F          139
143 #define SYSTEM_HASLOCKS             140
144 #define SYSTEM_ISMASTER             141
145 #define SYSTEM_TRAYOPEN             142
146 #define SYSTEM_SHOW_EXIT_BUTTON         143
147 #define SYSTEM_ALARM_POS            144
148 #define SYSTEM_LOGGEDON             145
149 #define SYSTEM_PROFILENAME          146
150 #define SYSTEM_PROFILETHUMB         147
151 #define SYSTEM_HAS_LOGINSCREEN      148
152 #define SYSTEM_HAS_DRIVE_G          149
153 #define SYSTEM_HDD_SMART            150
154 #define SYSTEM_HDD_TEMPERATURE      151
155 #define SYSTEM_HDD_MODEL            152
156 #define SYSTEM_HDD_SERIAL           153
157 #define SYSTEM_HDD_FIRMWARE         154
158 #define SYSTEM_HDD_PASSWORD         156
159 #define SYSTEM_HDD_LOCKSTATE        157
160 #define SYSTEM_HDD_LOCKKEY          158
161 #define SYSTEM_INTERNET_STATE       159
162 #define LCD_PLAY_ICON               160
163 #define LCD_PROGRESS_BAR            161
164 #define LCD_CPU_TEMPERATURE         162
165 #define LCD_GPU_TEMPERATURE         163
166 #define LCD_HDD_TEMPERATURE         164
167 #define LCD_FAN_SPEED               165
168 #define LCD_DATE                    166
169 #define LCD_TIME_21                 172 // Small bigfont
170 #define LCD_TIME_22                 173
171 #define LCD_TIME_W21                174 // Medum bigfont
172 #define LCD_TIME_W22                175
173 #define LCD_TIME_41                 176 // Big bigfont
174 #define LCD_TIME_42                 177
175 #define LCD_TIME_43                 178
176 #define LCD_TIME_44                 179
177 #define SYSTEM_ALARM_LESS_OR_EQUAL  180
178 #define SYSTEM_PROFILECOUNT         181
179 #define SYSTEM_ISFULLSCREEN         182
180 #define SYSTEM_ISSTANDALONE         183
181
182 #define NETWORK_IP_ADDRESS          190
183 #define NETWORK_MAC_ADDRESS         191
184 #define NETWORK_IS_DHCP             192
185 #define NETWORK_LINK_STATE          193
186 #define NETWORK_SUBNET_MASK         194
187 #define NETWORK_GATEWAY_ADDRESS     195
188 #define NETWORK_DNS1_ADDRESS        196
189 #define NETWORK_DNS2_ADDRESS        197
190 #define NETWORK_DHCP_ADDRESS        198
191
192 #define MUSICPLAYER_TITLE           200
193 #define MUSICPLAYER_ALBUM           201
194 #define MUSICPLAYER_ARTIST          202
195 #define MUSICPLAYER_GENRE           203
196 #define MUSICPLAYER_YEAR            204
197 #define MUSICPLAYER_DURATION        205
198 #define MUSICPLAYER_TRACK_NUMBER    208
199 #define MUSICPLAYER_COVER           210
200 #define MUSICPLAYER_BITRATE         211
201 #define MUSICPLAYER_PLAYLISTLEN     212
202 #define MUSICPLAYER_PLAYLISTPOS     213
203 #define MUSICPLAYER_CHANNELS        214
204 #define MUSICPLAYER_BITSPERSAMPLE   215
205 #define MUSICPLAYER_SAMPLERATE      216
206 #define MUSICPLAYER_CODEC           217
207 #define MUSICPLAYER_DISC_NUMBER     218
208 #define MUSICPLAYER_RATING          219
209 #define MUSICPLAYER_COMMENT         220
210 #define MUSICPLAYER_LYRICS          221
211 #define MUSICPLAYER_HASPREVIOUS     222
212 #define MUSICPLAYER_HASNEXT         223
213 #define MUSICPLAYER_EXISTS          224
214 #define MUSICPLAYER_PLAYLISTPLAYING 225
215 #define MUSICPLAYER_ALBUM_ARTIST    226
216 #define MUSICPLAYER_PLAYCOUNT       227
217 #define MUSICPLAYER_LASTPLAYED      228
218
219 #define VIDEOPLAYER_TITLE             250
220 #define VIDEOPLAYER_GENRE             251
221 #define VIDEOPLAYER_DIRECTOR          252
222 #define VIDEOPLAYER_YEAR              253
223 #define VIDEOPLAYER_HASSUBTITLES      254
224 #define VIDEOPLAYER_SUBTITLESENABLED  255
225 #define VIDEOPLAYER_COVER             258
226 #define VIDEOPLAYER_USING_OVERLAYS    259
227 #define VIDEOPLAYER_ISFULLSCREEN      260
228 #define VIDEOPLAYER_HASMENU           261
229 #define VIDEOPLAYER_PLAYLISTLEN       262
230 #define VIDEOPLAYER_PLAYLISTPOS       263
231 #define VIDEOPLAYER_EVENT             264
232 #define VIDEOPLAYER_ORIGINALTITLE     265
233 #define VIDEOPLAYER_PLOT              266
234 #define VIDEOPLAYER_PLOT_OUTLINE      267
235 #define VIDEOPLAYER_EPISODE           268
236 #define VIDEOPLAYER_SEASON            269
237 #define VIDEOPLAYER_RATING            270
238 #define VIDEOPLAYER_TVSHOW            271
239 #define VIDEOPLAYER_PREMIERED         272
240 #define VIDEOPLAYER_CONTENT           273
241 #define VIDEOPLAYER_STUDIO            274
242 #define VIDEOPLAYER_MPAA              275
243 #define VIDEOPLAYER_CAST              276
244 #define VIDEOPLAYER_CAST_AND_ROLE     277
245 #define VIDEOPLAYER_ARTIST            278
246 #define VIDEOPLAYER_ALBUM             279
247 #define VIDEOPLAYER_WRITER            280
248 #define VIDEOPLAYER_TAGLINE           281
249 #define VIDEOPLAYER_HAS_INFO          282
250 #define VIDEOPLAYER_TOP250            283
251 #define VIDEOPLAYER_RATING_AND_VOTES  284
252 #define VIDEOPLAYER_TRAILER           285
253 #define VIDEOPLAYER_VIDEO_CODEC       286
254 #define VIDEOPLAYER_VIDEO_RESOLUTION  287
255 #define VIDEOPLAYER_AUDIO_CODEC       288
256 #define VIDEOPLAYER_AUDIO_CHANNELS    289
257 #define VIDEOPLAYER_VIDEO_ASPECT      290
258 #define VIDEOPLAYER_HASTELETEXT       291
259 #define VIDEOPLAYER_COUNTRY           292
260 #define VIDEOPLAYER_PLAYCOUNT         293
261 #define VIDEOPLAYER_LASTPLAYED        294
262
263 #define AUDIOSCROBBLER_ENABLED      300
264 #define AUDIOSCROBBLER_CONN_STATE   301
265 #define AUDIOSCROBBLER_SUBMIT_INT   302
266 #define AUDIOSCROBBLER_FILES_CACHED 303
267 #define AUDIOSCROBBLER_SUBMIT_STATE 304
268 #define LASTFM_RADIOPLAYING         305
269 #define LASTFM_CANLOVE              306
270 #define LASTFM_CANBAN               307
271
272 #define CONTAINER_SCROLL_PREVIOUS   345 // NOTE: These 5 must be kept in this consecutive order
273 #define CONTAINER_MOVE_PREVIOUS     346
274 #define CONTAINER_STATIC            347
275 #define CONTAINER_MOVE_NEXT         348
276 #define CONTAINER_SCROLL_NEXT       349
277
278 #define CONTAINER_HASFILES          351
279 #define CONTAINER_HASFOLDERS        352
280 #define CONTAINER_STACKED           353
281 #define CONTAINER_FOLDERNAME        354
282 #define CONTAINER_SCROLLING         355
283 #define CONTAINER_PLUGINNAME        356
284 #define CONTAINER_PROPERTY          357
285 #define CONTAINER_SORT_DIRECTION    358
286 #define CONTAINER_NUM_ITEMS         359
287 #define CONTAINER_FOLDERTHUMB       360
288 #define CONTAINER_FOLDERPATH        361
289 #define CONTAINER_CONTENT           362
290 #define CONTAINER_HAS_THUMB         363
291 #define CONTAINER_SORT_METHOD       364
292
293 #define CONTAINER_HAS_FOCUS         367
294 #define CONTAINER_ROW               368
295 #define CONTAINER_COLUMN            369
296 #define CONTAINER_POSITION          370
297 #define CONTAINER_VIEWMODE          371
298 #define CONTAINER_HAS_NEXT          372
299 #define CONTAINER_HAS_PREVIOUS      373
300 #define CONTAINER_SUBITEM           374
301 #define CONTAINER_TVSHOWTHUMB       375
302 #define CONTAINER_NUM_PAGES         376
303 #define CONTAINER_CURRENT_PAGE      377
304 #define CONTAINER_SEASONTHUMB       378
305 #define CONTAINER_SHOWPLOT          379
306 #define CONTAINER_TOTALTIME         380
307
308 #define MUSICPM_ENABLED             381
309 #define MUSICPM_SONGSPLAYED         382
310 #define MUSICPM_MATCHINGSONGS       383
311 #define MUSICPM_MATCHINGSONGSPICKED 384
312 #define MUSICPM_MATCHINGSONGSLEFT   385
313 #define MUSICPM_RELAXEDSONGSPICKED  386
314 #define MUSICPM_RANDOMSONGSPICKED   387
315
316 #define PLAYLIST_LENGTH             390
317 #define PLAYLIST_POSITION           391
318 #define PLAYLIST_RANDOM             392
319 #define PLAYLIST_REPEAT             393
320 #define PLAYLIST_ISRANDOM           394
321 #define PLAYLIST_ISREPEAT           395
322 #define PLAYLIST_ISREPEATONE        396
323
324 #define VISUALISATION_LOCKED        400
325 #define VISUALISATION_PRESET        401
326 #define VISUALISATION_NAME          402
327 #define VISUALISATION_ENABLED       403
328
329 #define STRING_IS_EMPTY             410
330 #define STRING_COMPARE              411
331 #define STRING_STR                  412
332 #define INTEGER_GREATER_THAN        413
333 #define STRING_STR_LEFT             414
334 #define STRING_STR_RIGHT            415
335
336 #define SKIN_BOOL                   600
337 #define SKIN_STRING                 601
338 #define SKIN_HAS_MUSIC_OVERLAY      602
339 #define SKIN_HAS_VIDEO_OVERLAY      603
340 #define SKIN_THEME                  604
341 #define SKIN_COLOUR_THEME           605
342 #define SKIN_HAS_THEME              606
343
344 #define SYSTEM_TOTAL_MEMORY         644
345 #define SYSTEM_CPU_USAGE            645
346 #define SYSTEM_USED_MEMORY_PERCENT  646
347 #define SYSTEM_USED_MEMORY          647
348 #define SYSTEM_FREE_MEMORY          648
349 #define SYSTEM_FREE_MEMORY_PERCENT  649
350 #define SYSTEM_UPTIME               654
351 #define SYSTEM_TOTALUPTIME          655
352 #define SYSTEM_CPUFREQUENCY         656
353 #define SYSTEM_SCREEN_RESOLUTION    659
354 #define SYSTEM_VIDEO_ENCODER_INFO   660
355 #define SYSTEM_KERNEL_VERSION       667
356 #define SYSTEM_FREE_SPACE           679
357 #define SYSTEM_USED_SPACE           680
358 #define SYSTEM_TOTAL_SPACE          681
359 #define SYSTEM_USED_SPACE_PERCENT   682
360 #define SYSTEM_FREE_SPACE_PERCENT   683
361 #define SYSTEM_DVD_TRAY_STATE       700
362 #define SYSTEM_GET_BOOL             704
363 #define SYSTEM_GET_CORE_USAGE       705
364 #define SYSTEM_HAS_CORE_ID          706
365 #define SYSTEM_RENDER_VENDOR        707
366 #define SYSTEM_RENDER_RENDERER      708
367 #define SYSTEM_RENDER_VERSION       709
368 #define SYSTEM_SETTING              710
369 #define SYSTEM_HAS_ADDON            711
370 #define SYSTEM_ADDON_TITLE          712
371 #define SYSTEM_ADDON_ICON           713
372 #define SYSTEM_BATTERY_LEVEL        714
373 #define SYSTEM_IDLE_TIME            715
374 #define SYSTEM_FRIENDLY_NAME        716
375
376 #define LIBRARY_HAS_MUSIC           720
377 #define LIBRARY_HAS_VIDEO           721
378 #define LIBRARY_HAS_MOVIES          722
379 #define LIBRARY_HAS_TVSHOWS         723
380 #define LIBRARY_HAS_MUSICVIDEOS     724
381 #define LIBRARY_IS_SCANNING         725
382 #define LIBRARY_IS_SCANNING_VIDEO   726
383 #define LIBRARY_IS_SCANNING_MUSIC   727
384
385 #define SYSTEM_PLATFORM_XBOX        740
386 #define SYSTEM_PLATFORM_LINUX       741
387 #define SYSTEM_PLATFORM_WINDOWS     742
388 #define SYSTEM_PLATFORM_OSX         743
389
390 #define SYSTEM_CAN_POWERDOWN        750
391 #define SYSTEM_CAN_SUSPEND          751
392 #define SYSTEM_CAN_HIBERNATE        752
393 #define SYSTEM_CAN_REBOOT           753
394
395 #define SLIDESHOW_ISPAUSED          800
396 #define SLIDESHOW_ISRANDOM          801
397 #define SLIDESHOW_ISACTIVE          802
398
399 #define SLIDE_INFO_START            900
400 #define SLIDE_INFO_END              980
401
402 #define FANART_COLOR1               1000
403 #define FANART_COLOR2               1001
404 #define FANART_COLOR3               1002
405 #define FANART_IMAGE                1003
406
407 #define WINDOW_PROPERTY             9993
408 #define WINDOW_IS_TOPMOST           9994
409 #define WINDOW_IS_VISIBLE           9995
410 #define WINDOW_NEXT                 9996
411 #define WINDOW_PREVIOUS             9997
412 #define WINDOW_IS_MEDIA             9998
413 #define WINDOW_IS_ACTIVE            9999
414
415 #define CONTROL_GET_LABEL           29996
416 #define CONTROL_IS_ENABLED          29997
417 #define CONTROL_IS_VISIBLE          29998
418 #define CONTROL_GROUP_HAS_FOCUS     29999
419 #define CONTROL_HAS_FOCUS           30000
420
421 #define VERSION_MAJOR 11
422 #define VERSION_MINOR 0
423 #define VERSION_TAG "PRE-"
424
425 #define LISTITEM_START              35000
426 #define LISTITEM_THUMB              (LISTITEM_START)
427 #define LISTITEM_LABEL              (LISTITEM_START + 1)
428 #define LISTITEM_TITLE              (LISTITEM_START + 2)
429 #define LISTITEM_TRACKNUMBER        (LISTITEM_START + 3)
430 #define LISTITEM_ARTIST             (LISTITEM_START + 4)
431 #define LISTITEM_ALBUM              (LISTITEM_START + 5)
432 #define LISTITEM_YEAR               (LISTITEM_START + 6)
433 #define LISTITEM_GENRE              (LISTITEM_START + 7)
434 #define LISTITEM_ICON               (LISTITEM_START + 8)
435 #define LISTITEM_DIRECTOR           (LISTITEM_START + 9)
436 #define LISTITEM_OVERLAY            (LISTITEM_START + 10)
437 #define LISTITEM_LABEL2             (LISTITEM_START + 11)
438 #define LISTITEM_FILENAME           (LISTITEM_START + 12)
439 #define LISTITEM_DATE               (LISTITEM_START + 13)
440 #define LISTITEM_SIZE               (LISTITEM_START + 14)
441 #define LISTITEM_RATING             (LISTITEM_START + 15)
442 #define LISTITEM_PROGRAM_COUNT      (LISTITEM_START + 16)
443 #define LISTITEM_DURATION           (LISTITEM_START + 17)
444 #define LISTITEM_ISPLAYING          (LISTITEM_START + 18)
445 #define LISTITEM_ISSELECTED         (LISTITEM_START + 19)
446 #define LISTITEM_PLOT               (LISTITEM_START + 20)
447 #define LISTITEM_PLOT_OUTLINE       (LISTITEM_START + 21)
448 #define LISTITEM_EPISODE            (LISTITEM_START + 22)
449 #define LISTITEM_SEASON             (LISTITEM_START + 23)
450 #define LISTITEM_TVSHOW             (LISTITEM_START + 24)
451 #define LISTITEM_PREMIERED          (LISTITEM_START + 25)
452 #define LISTITEM_COMMENT            (LISTITEM_START + 26)
453 #define LISTITEM_ACTUAL_ICON        (LISTITEM_START + 27)
454 #define LISTITEM_PATH               (LISTITEM_START + 28)
455 #define LISTITEM_PICTURE_PATH       (LISTITEM_START + 29)
456 #define LISTITEM_PICTURE_DATETIME   (LISTITEM_START + 30)
457 #define LISTITEM_PICTURE_RESOLUTION (LISTITEM_START + 31)
458 #define LISTITEM_STUDIO             (LISTITEM_START + 32)
459 #define LISTITEM_MPAA               (LISTITEM_START + 33)
460 #define LISTITEM_CAST               (LISTITEM_START + 34)
461 #define LISTITEM_CAST_AND_ROLE      (LISTITEM_START + 35)
462 #define LISTITEM_WRITER             (LISTITEM_START + 36)
463 #define LISTITEM_TAGLINE            (LISTITEM_START + 37)
464 #define LISTITEM_TOP250             (LISTITEM_START + 38)
465 #define LISTITEM_RATING_AND_VOTES   (LISTITEM_START + 39)
466 #define LISTITEM_TRAILER            (LISTITEM_START + 40)
467 #define LISTITEM_STAR_RATING        (LISTITEM_START + 41)
468 #define LISTITEM_FILENAME_AND_PATH  (LISTITEM_START + 42)
469 #define LISTITEM_SORT_LETTER        (LISTITEM_START + 43)
470 #define LISTITEM_ALBUM_ARTIST       (LISTITEM_START + 44)
471 #define LISTITEM_FOLDERNAME         (LISTITEM_START + 45)
472 #define LISTITEM_VIDEO_CODEC        (LISTITEM_START + 46)
473 #define LISTITEM_VIDEO_RESOLUTION   (LISTITEM_START + 47)
474 #define LISTITEM_VIDEO_ASPECT       (LISTITEM_START + 48)
475 #define LISTITEM_AUDIO_CODEC        (LISTITEM_START + 49)
476 #define LISTITEM_AUDIO_CHANNELS     (LISTITEM_START + 50)
477 #define LISTITEM_AUDIO_LANGUAGE     (LISTITEM_START + 51)
478 #define LISTITEM_SUBTITLE_LANGUAGE  (LISTITEM_START + 52)
479 #define LISTITEM_IS_FOLDER          (LISTITEM_START + 53)
480 #define LISTITEM_ORIGINALTITLE      (LISTITEM_START + 54)
481 #define LISTITEM_COUNTRY            (LISTITEM_START + 55)
482 #define LISTITEM_PLAYCOUNT          (LISTITEM_START + 56)
483 #define LISTITEM_LASTPLAYED         (LISTITEM_START + 57)
484 #define LISTITEM_FOLDERPATH         (LISTITEM_START + 58)
485 #define LISTITEM_DISC_NUMBER        (LISTITEM_START + 59)
486 #define LISTITEM_FILE_EXTENSION     (LISTITEM_START + 60)
487 #define LISTITEM_IS_RESUMABLE       (LISTITEM_START + 61)
488 #define LISTITEM_PERCENT_PLAYED     (LISTITEM_START + 62)
489
490 #define LISTITEM_PROPERTY_START     (LISTITEM_START + 200)
491 #define LISTITEM_PROPERTY_END       (LISTITEM_PROPERTY_START + 1000)
492 #define LISTITEM_END                (LISTITEM_PROPERTY_END)
493
494 #define MUSICPLAYER_PROPERTY_OFFSET 900 // last 100 id's reserved for musicplayer props.
495
496 #define CONDITIONAL_LABEL_START       LISTITEM_END + 1 // 36001
497 #define CONDITIONAL_LABEL_END         37000
498
499 // the multiple information vector
500 #define MULTI_INFO_START              40000
501 #define MULTI_INFO_END                99999
502 #define COMBINED_VALUES_START        100000
503
504 // forward
505 class CInfoLabel;
506 class CGUIWindow;
507
508 // Info Flags
509 // Stored in the top 8 bits of GUIInfo::m_data1
510 // therefore we only have room for 8 flags
511 #define INFOFLAG_LISTITEM_WRAP        ((uint32_t) (1 << 25))  // Wrap ListItem lookups
512 #define INFOFLAG_LISTITEM_POSITION    ((uint32_t) (1 << 26))  // Absolute ListItem lookups
513
514 // structure to hold multiple integer data
515 // for storage referenced from a single integer
516 class GUIInfo
517 {
518 public:
519   GUIInfo(int info, uint32_t data1 = 0, int data2 = 0, uint32_t flag = 0)
520   {
521     m_info = info;
522     m_data1 = data1;
523     m_data2 = data2;
524     if (flag)
525       SetInfoFlag(flag);
526   }
527   bool operator ==(const GUIInfo &right) const
528   {
529     return (m_info == right.m_info && m_data1 == right.m_data1 && m_data2 == right.m_data2);
530   };
531   uint32_t GetInfoFlag() const;
532   uint32_t GetData1() const;
533   int GetData2() const;
534   int m_info;
535 private:
536   void SetInfoFlag(uint32_t flag);
537   uint32_t m_data1;
538   int m_data2;
539 };
540
541 /*!
542  \ingroup strings
543  \brief
544  */
545 class CGUIInfoManager : public IMsgTargetCallback
546 {
547 public:
548   CGUIInfoManager(void);
549   virtual ~CGUIInfoManager(void);
550
551   void Clear();
552   virtual bool OnMessage(CGUIMessage &message);
553
554   /*! \brief Register a boolean condition/expression
555    This routine allows controls or other clients of the info manager to register
556    to receive updates of particular expressions, in a particular context (currently windows).
557
558    In the future, it will allow clients to receive pushed callbacks when the expression changes.
559
560    \param expression the boolean condition or expression
561    \param context the context window
562    \return an identifier used to reference this expression
563
564    \sa GetBoolValue
565    */
566   unsigned int Register(const CStdString &expression, int context = 0);
567
568   /*! \brief Get a previously registered boolean expression's value
569    Checks the cache and evaluates the boolean expression if required.
570    \sa Register
571    */
572   bool GetBoolValue(unsigned int expression, const CGUIListItem *item = NULL);
573
574   /*! \brief Evaluate a boolean expression
575    \param expression the expression to evaluate
576    \param context the context in which to evaluate the expression (currently windows)
577    \return the value of the evaluated expression.
578    \sa Register, GetBoolValue
579    */
580   bool EvaluateBool(const CStdString &expression, int context = 0);
581
582   int TranslateString(const CStdString &strCondition);
583
584   /*! \brief Get integer value of info.
585    \param value int reference to pass value of given info
586    \param info id of info
587    \param context the context in which to evaluate the expression (currently windows)
588    \param item optional listitem if want to get listitem related int
589    \return true if given info was handled
590    \sa GetItemInt, GetMultiInfoInt
591    */
592   bool GetInt(int &value, int info, int contextWindow = 0, const CGUIListItem *item = NULL) const;
593   CStdString GetLabel(int info, int contextWindow = 0);
594
595   CStdString GetImage(int info, int contextWindow);
596
597   CStdString GetTime(TIME_FORMAT format = TIME_FORMAT_GUESS) const;
598   CStdString GetLcdTime( int _eInfo ) const;
599   CStdString GetDate(bool bNumbersOnly = false);
600   CStdString GetDuration(TIME_FORMAT format = TIME_FORMAT_GUESS) const;
601
602   void SetCurrentItem(CFileItem &item);
603   void ResetCurrentItem();
604   // Current song stuff
605   /// \brief Retrieves tag info (if necessary) and fills in our current song path.
606   void SetCurrentSong(CFileItem &item);
607   void SetCurrentAlbumThumb(const CStdString thumbFileName);
608   void SetCurrentMovie(CFileItem &item);
609   void SetCurrentSlide(CFileItem &item);
610   const CFileItem &GetCurrentSlide() const;
611   void ResetCurrentSlide();
612   void SetCurrentSongTag(const MUSIC_INFO::CMusicInfoTag &tag);
613   void SetCurrentVideoTag(const CVideoInfoTag &tag);
614
615   const MUSIC_INFO::CMusicInfoTag *GetCurrentSongTag() const;
616   const CVideoInfoTag* GetCurrentMovieTag() const;
617
618   CStdString GetMusicLabel(int item);
619   CStdString GetMusicTagLabel(int info, const CFileItem *item);
620   CStdString GetVideoLabel(int item);
621   CStdString GetPlaylistLabel(int item) const;
622   CStdString GetMusicPartyModeLabel(int item);
623   const CStdString GetMusicPlaylistInfo(const GUIInfo& info);
624   CStdString GetPictureLabel(int item);
625
626   __int64 GetPlayTime() const;  // in ms
627   CStdString GetCurrentPlayTime(TIME_FORMAT format = TIME_FORMAT_GUESS) const;
628   int GetPlayTimeRemaining() const;
629   int GetTotalPlayTime() const;
630   CStdString GetCurrentPlayTimeRemaining(TIME_FORMAT format) const;
631   CStdString GetVersion();
632   CStdString GetBuild();
633
634   bool GetDisplayAfterSeek();
635   void SetDisplayAfterSeek(unsigned int timeOut = 2500, int seekOffset = 0);
636   void SetSeeking(bool seeking) { m_playerSeeking = seeking; };
637   void SetShowTime(bool showtime) { m_playerShowTime = showtime; };
638   void SetShowCodec(bool showcodec) { m_playerShowCodec = showcodec; };
639   void SetShowInfo(bool showinfo) { m_playerShowInfo = showinfo; };
640   void ToggleShowCodec() { m_playerShowCodec = !m_playerShowCodec; };
641   bool ToggleShowInfo() { m_playerShowInfo = !m_playerShowInfo; return m_playerShowInfo; };
642   bool m_performingSeek;
643
644   std::string GetSystemHeatInfo(int info);
645   CTemperature GetGPUTemperature();
646
647   void UpdateFPS();
648   inline float GetFPS() const { return m_fps; };
649
650   void SetNextWindow(int windowID) { m_nextWindowID = windowID; };
651   void SetPreviousWindow(int windowID) { m_prevWindowID = windowID; };
652
653   void ResetCache();
654   bool GetItemInt(int &value, const CGUIListItem *item, int info) const;
655   CStdString GetItemLabel(const CFileItem *item, int info);
656   CStdString GetItemImage(const CFileItem *item, int info);
657
658   // Called from tuxbox service thread to update current status
659   void UpdateFromTuxBox();
660
661   /*! \brief containers call here to specify that the focus is changing
662    \param id control id
663    \param next true if we're moving to the next item, false if previous
664    \param scrolling true if the container is scrolling, false if the movement requires no scroll
665    */
666   void SetContainerMoving(int id, bool next, bool scrolling)
667   {
668     // magnitude 2 indicates a scroll, sign indicates direction
669     m_containerMoves[id] = (next ? 1 : -1) * (scrolling ? 2 : 1);
670   }
671
672   void SetLibraryBool(int condition, bool value);
673   bool GetLibraryBool(int condition);
674   void ResetLibraryBools();
675   CStdString LocalizeTime(const CDateTime &time, TIME_FORMAT format) const;
676
677   int TranslateSingleString(const CStdString &strCondition);
678
679   int RegisterSkinVariableString(const INFO::CSkinVariableString& info);
680   int TranslateSkinVariableString(const CStdString& name);
681   CStdString GetSkinVariableString(int info, int contextWindow, bool preferImage = false, const CGUIListItem *item=NULL);
682 protected:
683   friend class INFO::InfoSingle;
684   bool GetBool(int condition, int contextWindow = 0, const CGUIListItem *item=NULL);
685
686   // routines for window retrieval
687   bool CheckWindowCondition(CGUIWindow *window, int condition) const;
688   CGUIWindow *GetWindowWithCondition(int contextWindow, int condition) const;
689
690   /*! \brief class for holding information on properties
691    */
692   class Property
693   {
694   public:
695     Property(const CStdString &property, const CStdString &parameters);
696
697     const CStdString &param(unsigned int n = 0) const;
698     unsigned int num_params() const;
699
700     CStdString name;
701   private:
702     std::vector<CStdString> params;
703   };
704
705   bool GetMultiInfoBool(const GUIInfo &info, int contextWindow = 0, const CGUIListItem *item = NULL);
706   bool GetMultiInfoInt(int &value, const GUIInfo &info, int contextWindow = 0) const;
707   CStdString GetMultiInfoLabel(const GUIInfo &info, int contextWindow = 0);
708   int TranslateListItem(const Property &info);
709   int TranslateMusicPlayerString(const CStdString &info) const;
710   TIME_FORMAT TranslateTimeFormat(const CStdString &format);
711   bool GetItemBool(const CGUIListItem *item, int condition) const;
712
713   /*! \brief Split an info string into it's constituent parts and parameters
714    Format is:
715      
716      info1(params1).info2(params2).info3(params3) ...
717    
718    where the parameters are an optional comma separated parameter list.
719    
720    \param infoString the original string
721    \param info the resulting pairs of info and parameters.
722    */
723   void SplitInfoString(const CStdString &infoString, std::vector<Property> &info);
724
725   // Conditional string parameters for testing are stored in a vector for later retrieval.
726   // The offset into the string parameters array is returned.
727   int ConditionalStringParameter(const CStdString &strParameter, bool caseSensitive = false);
728   int AddMultiInfo(const GUIInfo &info);
729   int AddListItemProp(const CStdString &str, int offset=0);
730
731   CStdString GetAudioScrobblerLabel(int item);
732
733   // Conditional string parameters are stored here
734   CStdStringArray m_stringParameters;
735
736   // Array of multiple information mapped to a single integer lookup
737   std::vector<GUIInfo> m_multiInfo;
738   std::vector<std::string> m_listitemProperties;
739
740   CStdString m_currentMovieDuration;
741
742   // Current playing stuff
743   CFileItem* m_currentFile;
744   CStdString m_currentMovieThumb;
745   unsigned int m_lastMusicBitrateTime;
746   unsigned int m_MusicBitrate;
747   CFileItem* m_currentSlide;
748
749   // fan stuff
750   unsigned int m_lastSysHeatInfoTime;
751   int m_fanSpeed;
752   CTemperature m_gpuTemp;
753   CTemperature m_cpuTemp;
754
755   //Fullscreen OSD Stuff
756   unsigned int m_AfterSeekTimeout;
757   int m_seekOffset;
758   bool m_playerSeeking;
759   bool m_playerShowTime;
760   bool m_playerShowCodec;
761   bool m_playerShowInfo;
762
763   // FPS counters
764   float m_fps;
765   unsigned int m_frameCounter;
766   unsigned int m_lastFPSTime;
767
768   std::map<int, int> m_containerMoves;  // direction of list moving
769   int m_nextWindowID;
770   int m_prevWindowID;
771
772   std::vector<INFO::InfoBool*> m_bools;
773   std::vector<INFO::CSkinVariableString> m_skinVariableStrings;
774   unsigned int m_updateTime;
775
776   int m_libraryHasMusic;
777   int m_libraryHasMovies;
778   int m_libraryHasTVShows;
779   int m_libraryHasMusicVideos;
780
781   CCriticalSection m_critInfo;
782 };
783
784 /*!
785  \ingroup strings
786  \brief
787  */
788 extern CGUIInfoManager g_infoManager;
789 #endif
790
791
792
793