Merge pull request #2242 from ulion/add_clear_ctlmsg_for_generic_keyboard
[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-2013 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, see
25  *  <http://www.gnu.org/licenses/>.
26  *
27  */
28
29 #include "Temperature.h"
30 #include "threads/CriticalSection.h"
31 #include "guilib/IMsgTargetCallback.h"
32 #include "inttypes.h"
33 #include "XBDateTime.h"
34 #include "utils/Observer.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 #define PLAYER_ITEM_ART              49
107 #define PLAYER_CAN_PAUSE             50
108 #define PLAYER_CAN_SEEK              51
109 #define PLAYER_START_TIME            52
110 #define PLAYER_TITLE                 53
111
112 #define WEATHER_CONDITIONS          100
113 #define WEATHER_TEMPERATURE         101
114 #define WEATHER_LOCATION            102
115 #define WEATHER_IS_FETCHED          103
116 #define WEATHER_FANART_CODE         104
117 #define WEATHER_PLUGIN              105
118
119 #define SYSTEM_TEMPERATURE_UNITS    106
120 #define SYSTEM_PROGRESS_BAR         107
121 #define SYSTEM_LANGUAGE             108
122 #define SYSTEM_TIME                 110
123 #define SYSTEM_DATE                 111
124 #define SYSTEM_CPU_TEMPERATURE      112
125 #define SYSTEM_GPU_TEMPERATURE      113
126 #define SYSTEM_FAN_SPEED            114
127 #define SYSTEM_FREE_SPACE_C         115
128 // #define SYSTEM_FREE_SPACE_D         116 //116 is reserved for space on D
129 #define SYSTEM_FREE_SPACE_E         117
130 #define SYSTEM_FREE_SPACE_F         118
131 #define SYSTEM_FREE_SPACE_G         119
132 #define SYSTEM_BUILD_VERSION        120
133 #define SYSTEM_BUILD_DATE           121
134 #define SYSTEM_ETHERNET_LINK_ACTIVE 122
135 #define SYSTEM_FPS                  123
136 #define SYSTEM_ALWAYS_TRUE          125   // useful for <visible fade="10" start="hidden">true</visible>, to fade in a control
137 #define SYSTEM_ALWAYS_FALSE         126   // used for <visible fade="10">false</visible>, to fade out a control (ie not particularly useful!)
138 #define SYSTEM_MEDIA_DVD            127
139 #define SYSTEM_DVDREADY             128
140 #define SYSTEM_HAS_ALARM            129
141 #define SYSTEM_SCREEN_MODE          132
142 #define SYSTEM_SCREEN_WIDTH         133
143 #define SYSTEM_SCREEN_HEIGHT        134
144 #define SYSTEM_CURRENT_WINDOW       135
145 #define SYSTEM_CURRENT_CONTROL      136
146 #define SYSTEM_DVD_LABEL            138
147 #define SYSTEM_HASLOCKS             140
148 #define SYSTEM_ISMASTER             141
149 #define SYSTEM_TRAYOPEN             142
150 #define SYSTEM_SHOW_EXIT_BUTTON     143
151 #define SYSTEM_ALARM_POS            144
152 #define SYSTEM_LOGGEDON             145
153 #define SYSTEM_PROFILENAME          146
154 #define SYSTEM_PROFILETHUMB         147
155 #define SYSTEM_HAS_LOGINSCREEN      148
156 #define SYSTEM_HDD_SMART            150
157 #define SYSTEM_HDD_TEMPERATURE      151
158 #define SYSTEM_HDD_MODEL            152
159 #define SYSTEM_HDD_SERIAL           153
160 #define SYSTEM_HDD_FIRMWARE         154
161 #define SYSTEM_HDD_PASSWORD         156
162 #define SYSTEM_HDD_LOCKSTATE        157
163 #define SYSTEM_HDD_LOCKKEY          158
164 #define SYSTEM_INTERNET_STATE       159
165 #define SYSTEM_ALARM_LESS_OR_EQUAL  180
166 #define SYSTEM_PROFILECOUNT         181
167 #define SYSTEM_ISFULLSCREEN         182
168 #define SYSTEM_ISSTANDALONE         183
169 #define SYSTEM_ISINHIBIT            184
170 #define SYSTEM_HAS_SHUTDOWN         185
171 #define SYSTEM_HAS_PVR              186
172
173 #define NETWORK_IP_ADDRESS          190
174 #define NETWORK_MAC_ADDRESS         191
175 #define NETWORK_IS_DHCP             192
176 #define NETWORK_LINK_STATE          193
177 #define NETWORK_SUBNET_MASK         194
178 #define NETWORK_GATEWAY_ADDRESS     195
179 #define NETWORK_DNS1_ADDRESS        196
180 #define NETWORK_DNS2_ADDRESS        197
181 #define NETWORK_DHCP_ADDRESS        198
182
183 #define MUSICPLAYER_TITLE           200
184 #define MUSICPLAYER_ALBUM           201
185 #define MUSICPLAYER_ARTIST          202
186 #define MUSICPLAYER_GENRE           203
187 #define MUSICPLAYER_YEAR            204
188 #define MUSICPLAYER_DURATION        205
189 #define MUSICPLAYER_TRACK_NUMBER    208
190 #define MUSICPLAYER_COVER           210
191 #define MUSICPLAYER_BITRATE         211
192 #define MUSICPLAYER_PLAYLISTLEN     212
193 #define MUSICPLAYER_PLAYLISTPOS     213
194 #define MUSICPLAYER_CHANNELS        214
195 #define MUSICPLAYER_BITSPERSAMPLE   215
196 #define MUSICPLAYER_SAMPLERATE      216
197 #define MUSICPLAYER_CODEC           217
198 #define MUSICPLAYER_DISC_NUMBER     218
199 #define MUSICPLAYER_RATING          219
200 #define MUSICPLAYER_COMMENT         220
201 #define MUSICPLAYER_LYRICS          221
202 #define MUSICPLAYER_HASPREVIOUS     222
203 #define MUSICPLAYER_HASNEXT         223
204 #define MUSICPLAYER_EXISTS          224
205 #define MUSICPLAYER_PLAYLISTPLAYING 225
206 #define MUSICPLAYER_ALBUM_ARTIST    226
207 #define MUSICPLAYER_PLAYCOUNT       227
208 #define MUSICPLAYER_LASTPLAYED      228
209 #define MUSICPLAYER_CHANNEL_NAME    229
210 #define MUSICPLAYER_CHANNEL_NUMBER  230
211 #define MUSICPLAYER_CHANNEL_GROUP   231
212
213 #define VIDEOPLAYER_TITLE             250
214 #define VIDEOPLAYER_GENRE             251
215 #define VIDEOPLAYER_DIRECTOR          252
216 #define VIDEOPLAYER_YEAR              253
217 #define VIDEOPLAYER_HASSUBTITLES      254
218 #define VIDEOPLAYER_SUBTITLESENABLED  255
219 #define VIDEOPLAYER_COVER             258
220 #define VIDEOPLAYER_USING_OVERLAYS    259
221 #define VIDEOPLAYER_ISFULLSCREEN      260
222 #define VIDEOPLAYER_HASMENU           261
223 #define VIDEOPLAYER_PLAYLISTLEN       262
224 #define VIDEOPLAYER_PLAYLISTPOS       263
225 #define VIDEOPLAYER_EVENT             264
226 #define VIDEOPLAYER_ORIGINALTITLE     265
227 #define VIDEOPLAYER_PLOT              266
228 #define VIDEOPLAYER_PLOT_OUTLINE      267
229 #define VIDEOPLAYER_EPISODE           268
230 #define VIDEOPLAYER_SEASON            269
231 #define VIDEOPLAYER_RATING            270
232 #define VIDEOPLAYER_TVSHOW            271
233 #define VIDEOPLAYER_PREMIERED         272
234 #define VIDEOPLAYER_CONTENT           273
235 #define VIDEOPLAYER_STUDIO            274
236 #define VIDEOPLAYER_MPAA              275
237 #define VIDEOPLAYER_CAST              276
238 #define VIDEOPLAYER_CAST_AND_ROLE     277
239 #define VIDEOPLAYER_ARTIST            278
240 #define VIDEOPLAYER_ALBUM             279
241 #define VIDEOPLAYER_WRITER            280
242 #define VIDEOPLAYER_TAGLINE           281
243 #define VIDEOPLAYER_HAS_INFO          282
244 #define VIDEOPLAYER_TOP250            283
245 #define VIDEOPLAYER_RATING_AND_VOTES  284
246 #define VIDEOPLAYER_TRAILER           285
247 #define VIDEOPLAYER_VIDEO_CODEC       286
248 #define VIDEOPLAYER_VIDEO_RESOLUTION  287
249 #define VIDEOPLAYER_AUDIO_CODEC       288
250 #define VIDEOPLAYER_AUDIO_CHANNELS    289
251 #define VIDEOPLAYER_VIDEO_ASPECT      290
252 #define VIDEOPLAYER_HASTELETEXT       291
253 #define VIDEOPLAYER_COUNTRY           292
254 #define VIDEOPLAYER_PLAYCOUNT         293
255 #define VIDEOPLAYER_LASTPLAYED        294
256
257 #define VIDEOPLAYER_STARTTIME         295
258 #define VIDEOPLAYER_ENDTIME           296
259 #define VIDEOPLAYER_NEXT_TITLE        297
260 #define VIDEOPLAYER_NEXT_GENRE        298
261 #define VIDEOPLAYER_NEXT_PLOT         299
262 #define VIDEOPLAYER_NEXT_PLOT_OUTLINE 300
263 #define VIDEOPLAYER_NEXT_STARTTIME    301
264 #define VIDEOPLAYER_NEXT_ENDTIME      302
265 #define VIDEOPLAYER_NEXT_DURATION     303
266 #define VIDEOPLAYER_CHANNEL_NAME      304
267 #define VIDEOPLAYER_CHANNEL_NUMBER    305
268 #define VIDEOPLAYER_CHANNEL_GROUP     306
269 #define VIDEOPLAYER_PARENTAL_RATING   307
270 #define VIDEOPLAYER_HAS_EPG           308
271
272 #define CONTAINER_CAN_FILTER         342
273 #define CONTAINER_CAN_FILTERADVANCED 343
274 #define CONTAINER_FILTERED           344
275
276 #define CONTAINER_SCROLL_PREVIOUS   345 // NOTE: These 5 must be kept in this consecutive order
277 #define CONTAINER_MOVE_PREVIOUS     346
278 #define CONTAINER_STATIC            347
279 #define CONTAINER_MOVE_NEXT         348
280 #define CONTAINER_SCROLL_NEXT       349
281
282 #define CONTAINER_HASFILES          351
283 #define CONTAINER_HASFOLDERS        352
284 #define CONTAINER_STACKED           353
285 #define CONTAINER_FOLDERNAME        354
286 #define CONTAINER_SCROLLING         355
287 #define CONTAINER_PLUGINNAME        356
288 #define CONTAINER_PROPERTY          357
289 #define CONTAINER_SORT_DIRECTION    358
290 #define CONTAINER_NUM_ITEMS         359
291 #define CONTAINER_FOLDERTHUMB       360
292 #define CONTAINER_FOLDERPATH        361
293 #define CONTAINER_CONTENT           362
294 #define CONTAINER_HAS_THUMB         363
295 #define CONTAINER_SORT_METHOD       364
296
297 #define CONTAINER_HAS_FOCUS         367
298 #define CONTAINER_ROW               368
299 #define CONTAINER_COLUMN            369
300 #define CONTAINER_POSITION          370
301 #define CONTAINER_VIEWMODE          371
302 #define CONTAINER_HAS_NEXT          372
303 #define CONTAINER_HAS_PREVIOUS      373
304 #define CONTAINER_SUBITEM           374
305 #define CONTAINER_TVSHOWTHUMB       375
306 #define CONTAINER_NUM_PAGES         376
307 #define CONTAINER_CURRENT_PAGE      377
308 #define CONTAINER_SEASONTHUMB       378
309 #define CONTAINER_SHOWPLOT          379
310 #define CONTAINER_TOTALTIME         380
311
312 #define MUSICPM_ENABLED             381
313 #define MUSICPM_SONGSPLAYED         382
314 #define MUSICPM_MATCHINGSONGS       383
315 #define MUSICPM_MATCHINGSONGSPICKED 384
316 #define MUSICPM_MATCHINGSONGSLEFT   385
317 #define MUSICPM_RELAXEDSONGSPICKED  386
318 #define MUSICPM_RANDOMSONGSPICKED   387
319
320 #define PLAYLIST_LENGTH             390
321 #define PLAYLIST_POSITION           391
322 #define PLAYLIST_RANDOM             392
323 #define PLAYLIST_REPEAT             393
324 #define PLAYLIST_ISRANDOM           394
325 #define PLAYLIST_ISREPEAT           395
326 #define PLAYLIST_ISREPEATONE        396
327
328 #define VISUALISATION_LOCKED        400
329 #define VISUALISATION_PRESET        401
330 #define VISUALISATION_NAME          402
331 #define VISUALISATION_ENABLED       403
332
333 #define STRING_IS_EMPTY             410
334 #define STRING_COMPARE              411
335 #define STRING_STR                  412
336 #define INTEGER_GREATER_THAN        413
337 #define STRING_STR_LEFT             414
338 #define STRING_STR_RIGHT            415
339
340 #define SKIN_BOOL                   600
341 #define SKIN_STRING                 601
342 #define SKIN_HAS_MUSIC_OVERLAY      602
343 #define SKIN_HAS_VIDEO_OVERLAY      603
344 #define SKIN_THEME                  604
345 #define SKIN_COLOUR_THEME           605
346 #define SKIN_HAS_THEME              606
347 #define SKIN_ASPECT_RATIO           607
348
349 #define SYSTEM_TOTAL_MEMORY         644
350 #define SYSTEM_CPU_USAGE            645
351 #define SYSTEM_USED_MEMORY_PERCENT  646
352 #define SYSTEM_USED_MEMORY          647
353 #define SYSTEM_FREE_MEMORY          648
354 #define SYSTEM_FREE_MEMORY_PERCENT  649
355 #define SYSTEM_UPTIME               654
356 #define SYSTEM_TOTALUPTIME          655
357 #define SYSTEM_CPUFREQUENCY         656
358 #define SYSTEM_SCREEN_RESOLUTION    659
359 #define SYSTEM_VIDEO_ENCODER_INFO   660
360 #define SYSTEM_KERNEL_VERSION       667
361 #define SYSTEM_FREE_SPACE           679
362 #define SYSTEM_USED_SPACE           680
363 #define SYSTEM_TOTAL_SPACE          681
364 #define SYSTEM_USED_SPACE_PERCENT   682
365 #define SYSTEM_FREE_SPACE_PERCENT   683
366 #define SYSTEM_DVD_TRAY_STATE       700
367 #define SYSTEM_GET_BOOL             704
368 #define SYSTEM_GET_CORE_USAGE       705
369 #define SYSTEM_HAS_CORE_ID          706
370 #define SYSTEM_RENDER_VENDOR        707
371 #define SYSTEM_RENDER_RENDERER      708
372 #define SYSTEM_RENDER_VERSION       709
373 #define SYSTEM_SETTING              710
374 #define SYSTEM_HAS_ADDON            711
375 #define SYSTEM_ADDON_TITLE          712
376 #define SYSTEM_ADDON_ICON           713
377 #define SYSTEM_BATTERY_LEVEL        714
378 #define SYSTEM_IDLE_TIME            715
379 #define SYSTEM_FRIENDLY_NAME        716
380 #define SYSTEM_SCREENSAVER_ACTIVE   717
381
382 #define LIBRARY_HAS_MUSIC           720
383 #define LIBRARY_HAS_VIDEO           721
384 #define LIBRARY_HAS_MOVIES          722
385 #define LIBRARY_HAS_MOVIE_SETS      723
386 #define LIBRARY_HAS_TVSHOWS         724
387 #define LIBRARY_HAS_MUSICVIDEOS     725
388 #define LIBRARY_IS_SCANNING         726
389 #define LIBRARY_IS_SCANNING_VIDEO   727
390 #define LIBRARY_IS_SCANNING_MUSIC   728
391
392 #define SYSTEM_PLATFORM_LINUX       741
393 #define SYSTEM_PLATFORM_WINDOWS     742
394 #define SYSTEM_PLATFORM_DARWIN      743
395 #define SYSTEM_PLATFORM_DARWIN_OSX  744
396 #define SYSTEM_PLATFORM_DARWIN_IOS  745
397 #define SYSTEM_PLATFORM_DARWIN_ATV2 746
398 #define SYSTEM_PLATFORM_ANDROID     747
399
400 #define SYSTEM_CAN_POWERDOWN        750
401 #define SYSTEM_CAN_SUSPEND          751
402 #define SYSTEM_CAN_HIBERNATE        752
403 #define SYSTEM_CAN_REBOOT           753
404
405 #define SLIDESHOW_ISPAUSED          800
406 #define SLIDESHOW_ISRANDOM          801
407 #define SLIDESHOW_ISACTIVE          802
408
409 #define SLIDE_INFO_START            900
410 #define SLIDE_INFO_END              980
411
412 #define FANART_COLOR1               1000
413 #define FANART_COLOR2               1001
414 #define FANART_COLOR3               1002
415 #define FANART_IMAGE                1003
416
417 #define PVR_CONDITIONS_START        1100
418 #define PVR_IS_RECORDING            (PVR_CONDITIONS_START)
419 #define PVR_HAS_TIMER               (PVR_CONDITIONS_START + 1)
420 #define PVR_HAS_NONRECORDING_TIMER  (PVR_CONDITIONS_START + 2)
421 #define PVR_HAS_EPG                 (PVR_CONDITIONS_START + 3)
422 #define PVR_HAS_TXT                 (PVR_CONDITIONS_START + 4)
423 #define PVR_HAS_DIRECTOR            (PVR_CONDITIONS_START + 5)
424 #define PVR_IS_PLAYING_TV           (PVR_CONDITIONS_START + 6)
425 #define PVR_IS_PLAYING_RADIO        (PVR_CONDITIONS_START + 7)
426 #define PVR_IS_PLAYING_RECORDING    (PVR_CONDITIONS_START + 8)
427 #define PVR_ACTUAL_STREAM_ENCRYPTED (PVR_CONDITIONS_START + 9)
428 #define PVR_CONDITIONS_END          PVR_ACTUAL_STREAM_ENCRYPTED
429
430 #define PVR_STRINGS_START           1200
431 #define PVR_NEXT_RECORDING_CHANNEL  (PVR_STRINGS_START)
432 #define PVR_NEXT_RECORDING_CHAN_ICO (PVR_STRINGS_START + 1)
433 #define PVR_NEXT_RECORDING_DATETIME (PVR_STRINGS_START + 2)
434 #define PVR_NEXT_RECORDING_TITLE    (PVR_STRINGS_START + 3)
435 #define PVR_NOW_RECORDING_CHANNEL   (PVR_STRINGS_START + 4)
436 #define PVR_NOW_RECORDING_CHAN_ICO  (PVR_STRINGS_START + 5)
437 #define PVR_NOW_RECORDING_DATETIME  (PVR_STRINGS_START + 6)
438 #define PVR_NOW_RECORDING_TITLE     (PVR_STRINGS_START + 7)
439 #define PVR_BACKEND_NAME            (PVR_STRINGS_START + 8)
440 #define PVR_BACKEND_VERSION         (PVR_STRINGS_START + 9)
441 #define PVR_BACKEND_HOST            (PVR_STRINGS_START + 10)
442 #define PVR_BACKEND_DISKSPACE       (PVR_STRINGS_START + 11)
443 #define PVR_BACKEND_CHANNELS        (PVR_STRINGS_START + 12)
444 #define PVR_BACKEND_TIMERS          (PVR_STRINGS_START + 13)
445 #define PVR_BACKEND_RECORDINGS      (PVR_STRINGS_START + 14)
446 #define PVR_BACKEND_NUMBER          (PVR_STRINGS_START + 15)
447 #define PVR_TOTAL_DISKSPACE         (PVR_STRINGS_START + 16)
448 #define PVR_NEXT_TIMER              (PVR_STRINGS_START + 17)
449 #define PVR_PLAYING_DURATION        (PVR_STRINGS_START + 18)
450 #define PVR_PLAYING_TIME            (PVR_STRINGS_START + 19)
451 #define PVR_PLAYING_PROGRESS        (PVR_STRINGS_START + 20)
452 #define PVR_ACTUAL_STREAM_CLIENT    (PVR_STRINGS_START + 21)
453 #define PVR_ACTUAL_STREAM_DEVICE    (PVR_STRINGS_START + 22)
454 #define PVR_ACTUAL_STREAM_STATUS    (PVR_STRINGS_START + 23)
455 #define PVR_ACTUAL_STREAM_SIG       (PVR_STRINGS_START + 24)
456 #define PVR_ACTUAL_STREAM_SNR       (PVR_STRINGS_START + 25)
457 #define PVR_ACTUAL_STREAM_SIG_PROGR (PVR_STRINGS_START + 26)
458 #define PVR_ACTUAL_STREAM_SNR_PROGR (PVR_STRINGS_START + 27)
459 #define PVR_ACTUAL_STREAM_BER       (PVR_STRINGS_START + 28)
460 #define PVR_ACTUAL_STREAM_UNC       (PVR_STRINGS_START + 29)
461 #define PVR_ACTUAL_STREAM_VIDEO_BR  (PVR_STRINGS_START + 30)
462 #define PVR_ACTUAL_STREAM_AUDIO_BR  (PVR_STRINGS_START + 31)
463 #define PVR_ACTUAL_STREAM_DOLBY_BR  (PVR_STRINGS_START + 32)
464 #define PVR_ACTUAL_STREAM_CRYPTION  (PVR_STRINGS_START + 33)
465 #define PVR_STRINGS_END             PVR_ACTUAL_STREAM_CRYPTION
466
467 #define WINDOW_PROPERTY             9993
468 #define WINDOW_IS_TOPMOST           9994
469 #define WINDOW_IS_VISIBLE           9995
470 #define WINDOW_NEXT                 9996
471 #define WINDOW_PREVIOUS             9997
472 #define WINDOW_IS_MEDIA             9998
473 #define WINDOW_IS_ACTIVE            9999
474
475 #define CONTROL_GET_LABEL           29996
476 #define CONTROL_IS_ENABLED          29997
477 #define CONTROL_IS_VISIBLE          29998
478 #define CONTROL_GROUP_HAS_FOCUS     29999
479 #define CONTROL_HAS_FOCUS           30000
480
481 #define VERSION_MAJOR 13
482 #define VERSION_MINOR 0
483 #define VERSION_TAG "-ALPHA2"
484
485 #define LISTITEM_START              35000
486 #define LISTITEM_THUMB              (LISTITEM_START)
487 #define LISTITEM_LABEL              (LISTITEM_START + 1)
488 #define LISTITEM_TITLE              (LISTITEM_START + 2)
489 #define LISTITEM_TRACKNUMBER        (LISTITEM_START + 3)
490 #define LISTITEM_ARTIST             (LISTITEM_START + 4)
491 #define LISTITEM_ALBUM              (LISTITEM_START + 5)
492 #define LISTITEM_YEAR               (LISTITEM_START + 6)
493 #define LISTITEM_GENRE              (LISTITEM_START + 7)
494 #define LISTITEM_ICON               (LISTITEM_START + 8)
495 #define LISTITEM_DIRECTOR           (LISTITEM_START + 9)
496 #define LISTITEM_OVERLAY            (LISTITEM_START + 10)
497 #define LISTITEM_LABEL2             (LISTITEM_START + 11)
498 #define LISTITEM_FILENAME           (LISTITEM_START + 12)
499 #define LISTITEM_DATE               (LISTITEM_START + 13)
500 #define LISTITEM_SIZE               (LISTITEM_START + 14)
501 #define LISTITEM_RATING             (LISTITEM_START + 15)
502 #define LISTITEM_PROGRAM_COUNT      (LISTITEM_START + 16)
503 #define LISTITEM_DURATION           (LISTITEM_START + 17)
504 #define LISTITEM_ISPLAYING          (LISTITEM_START + 18)
505 #define LISTITEM_ISSELECTED         (LISTITEM_START + 19)
506 #define LISTITEM_PLOT               (LISTITEM_START + 20)
507 #define LISTITEM_PLOT_OUTLINE       (LISTITEM_START + 21)
508 #define LISTITEM_EPISODE            (LISTITEM_START + 22)
509 #define LISTITEM_SEASON             (LISTITEM_START + 23)
510 #define LISTITEM_TVSHOW             (LISTITEM_START + 24)
511 #define LISTITEM_PREMIERED          (LISTITEM_START + 25)
512 #define LISTITEM_COMMENT            (LISTITEM_START + 26)
513 #define LISTITEM_ACTUAL_ICON        (LISTITEM_START + 27)
514 #define LISTITEM_PATH               (LISTITEM_START + 28)
515 #define LISTITEM_PICTURE_PATH       (LISTITEM_START + 29)
516 // the ordering of LISTITEM_PICTURE_* is important as they're mapped to SLIDE_* items in GUIInfoManager.cpp
517 #define LISTITEM_PICTURE_START      (LISTITEM_START + 30)
518 #define LISTITEM_PICTURE_RESOLUTION (LISTITEM_PICTURE_START) // => SLIDE_RESOLUTION
519 #define LISTITEM_PICTURE_DATE       (LISTITEM_START + 31)    // => SLIDE_EXIF_DATE
520 #define LISTITEM_PICTURE_DATETIME   (LISTITEM_START + 32)    // => SLIDE_EXIF_DATE_TIME
521 #define LISTITEM_PICTURE_COMMENT    (LISTITEM_START + 33)    // => SLIDE_COMMENT
522 #define LISTITEM_PICTURE_CAPTION    (LISTITEM_START + 34)    // => SLIDE_IPTC_CAPTION
523 #define LISTITEM_PICTURE_DESC       (LISTITEM_START + 35)    // => SLIDE_EXIF_DESCRIPTION
524 #define LISTITEM_PICTURE_KEYWORDS   (LISTITEM_START + 36)    // => SLIDE_IPTC_KEYWORDS
525 #define LISTITEM_PICTURE_CAM_MAKE   (LISTITEM_START + 37)    // => SLIDE_EXIF_CAMERA_MAKE
526 #define LISTITEM_PICTURE_CAM_MODEL  (LISTITEM_START + 38)    // => SLIDE_EXIF_CAMERA_MODEL
527 #define LISTITEM_PICTURE_APERTURE   (LISTITEM_START + 39)    // => SLIDE_EXIF_APERTURE
528 #define LISTITEM_PICTURE_FOCAL_LEN  (LISTITEM_START + 40)    // => SLIDE_EXIF_FOCAL_LENGTH
529 #define LISTITEM_PICTURE_FOCUS_DIST (LISTITEM_START + 41)    // => SLIDE_EXIF_FOCUS_DIST
530 #define LISTITEM_PICTURE_EXP_MODE   (LISTITEM_START + 42)    // => SLIDE_EXIF_EXPOSURE_MODE
531 #define LISTITEM_PICTURE_EXP_TIME   (LISTITEM_START + 43)    // => SLIDE_EXIF_EXPOSURE_TIME
532 #define LISTITEM_PICTURE_ISO        (LISTITEM_START + 44)    // => SLIDE_EXIF_ISO_EQUIV
533 #define LISTITEM_PICTURE_GPS_LAT    (LISTITEM_START + 45)    // => SLIDE_EXIF_GPS_LATITUDE
534 #define LISTITEM_PICTURE_GPS_LON    (LISTITEM_START + 46)    // => SLIDE_EXIF_GPS_LONGITUDE
535 #define LISTITEM_PICTURE_GPS_ALT    (LISTITEM_START + 47)    // => SLIDE_EXIF_GPS_ALTITUDE
536 #define LISTITEM_PICTURE_END        (LISTITEM_PICTURE_GPS_ALT)
537 #define LISTITEM_STUDIO             (LISTITEM_START + 48)
538 #define LISTITEM_MPAA               (LISTITEM_START + 49)
539 #define LISTITEM_CAST               (LISTITEM_START + 50)
540 #define LISTITEM_CAST_AND_ROLE      (LISTITEM_START + 51)
541 #define LISTITEM_WRITER             (LISTITEM_START + 52)
542 #define LISTITEM_TAGLINE            (LISTITEM_START + 53)
543 #define LISTITEM_TOP250             (LISTITEM_START + 54)
544 #define LISTITEM_RATING_AND_VOTES   (LISTITEM_START + 55)
545 #define LISTITEM_TRAILER            (LISTITEM_START + 56)
546 #define LISTITEM_STAR_RATING        (LISTITEM_START + 57)
547 #define LISTITEM_FILENAME_AND_PATH  (LISTITEM_START + 58)
548 #define LISTITEM_SORT_LETTER        (LISTITEM_START + 59)
549 #define LISTITEM_ALBUM_ARTIST       (LISTITEM_START + 60)
550 #define LISTITEM_FOLDERNAME         (LISTITEM_START + 61)
551 #define LISTITEM_VIDEO_CODEC        (LISTITEM_START + 62)
552 #define LISTITEM_VIDEO_RESOLUTION   (LISTITEM_START + 63)
553 #define LISTITEM_VIDEO_ASPECT       (LISTITEM_START + 64)
554 #define LISTITEM_AUDIO_CODEC        (LISTITEM_START + 65)
555 #define LISTITEM_AUDIO_CHANNELS     (LISTITEM_START + 66)
556 #define LISTITEM_AUDIO_LANGUAGE     (LISTITEM_START + 67)
557 #define LISTITEM_SUBTITLE_LANGUAGE  (LISTITEM_START + 68)
558 #define LISTITEM_IS_FOLDER          (LISTITEM_START + 69)
559 #define LISTITEM_ORIGINALTITLE      (LISTITEM_START + 70)
560 #define LISTITEM_COUNTRY            (LISTITEM_START + 71)
561 #define LISTITEM_PLAYCOUNT          (LISTITEM_START + 72)
562 #define LISTITEM_LASTPLAYED         (LISTITEM_START + 73)
563 #define LISTITEM_FOLDERPATH         (LISTITEM_START + 74)
564 #define LISTITEM_DISC_NUMBER        (LISTITEM_START + 75)
565 #define LISTITEM_FILE_EXTENSION     (LISTITEM_START + 76)
566 #define LISTITEM_IS_RESUMABLE       (LISTITEM_START + 77)
567 #define LISTITEM_PERCENT_PLAYED     (LISTITEM_START + 78)
568 #define LISTITEM_DATE_ADDED         (LISTITEM_START + 79)
569 #define LISTITEM_DBTYPE             (LISTITEM_START + 80)
570 #define LISTITEM_DBID               (LISTITEM_START + 81)
571
572 #define LISTITEM_STARTTIME          (LISTITEM_START + 82)
573 #define LISTITEM_ENDTIME            (LISTITEM_START + 83)
574 #define LISTITEM_STARTDATE          (LISTITEM_START + 84)
575 #define LISTITEM_ENDDATE            (LISTITEM_START + 85)
576 #define LISTITEM_NEXT_TITLE         (LISTITEM_START + 86)
577 #define LISTITEM_NEXT_GENRE         (LISTITEM_START + 87)
578 #define LISTITEM_NEXT_PLOT          (LISTITEM_START + 88)
579 #define LISTITEM_NEXT_PLOT_OUTLINE  (LISTITEM_START + 89)
580 #define LISTITEM_NEXT_STARTTIME     (LISTITEM_START + 90)
581 #define LISTITEM_NEXT_ENDTIME       (LISTITEM_START + 91)
582 #define LISTITEM_NEXT_STARTDATE     (LISTITEM_START + 92)
583 #define LISTITEM_NEXT_ENDDATE       (LISTITEM_START + 93)
584 #define LISTITEM_NEXT_DURATION      (LISTITEM_START + 94)
585 #define LISTITEM_CHANNEL_NAME       (LISTITEM_START + 95)
586 #define LISTITEM_CHANNEL_NUMBER     (LISTITEM_START + 96)
587 #define LISTITEM_CHANNEL_GROUP      (LISTITEM_START + 97)
588 #define LISTITEM_HASTIMER           (LISTITEM_START + 98)
589 #define LISTITEM_ISRECORDING        (LISTITEM_START + 99)
590 #define LISTITEM_ISENCRYPTED        (LISTITEM_START + 100)
591 #define LISTITEM_PARENTALRATING     (LISTITEM_START + 101)
592 #define LISTITEM_PROGRESS           (LISTITEM_START + 102)
593 #define LISTITEM_HAS_EPG            (LISTITEM_START + 103)
594
595 #define LISTITEM_PROPERTY_START     (LISTITEM_START + 200)
596 #define LISTITEM_PROPERTY_END       (LISTITEM_PROPERTY_START + 1000)
597 #define LISTITEM_END                (LISTITEM_PROPERTY_END)
598
599 #define MUSICPLAYER_PROPERTY_OFFSET 800 // 100 id's reserved for musicplayer props.
600 #define LISTITEM_ART_OFFSET         900 // 100 id's reserved for listitem art.
601
602 #define CONDITIONAL_LABEL_START       LISTITEM_END + 1 // 36001
603 #define CONDITIONAL_LABEL_END         37000
604
605 // the multiple information vector
606 #define MULTI_INFO_START              40000
607 #define MULTI_INFO_END                99999
608 #define COMBINED_VALUES_START        100000
609
610 // forward
611 class CInfoLabel;
612 class CGUIWindow;
613 namespace EPG { class CEpgInfoTag; }
614
615 // Info Flags
616 // Stored in the top 8 bits of GUIInfo::m_data1
617 // therefore we only have room for 8 flags
618 #define INFOFLAG_LISTITEM_WRAP        ((uint32_t) (1 << 25))  // Wrap ListItem lookups
619 #define INFOFLAG_LISTITEM_POSITION    ((uint32_t) (1 << 26))  // Absolute ListItem lookups
620
621 // structure to hold multiple integer data
622 // for storage referenced from a single integer
623 class GUIInfo
624 {
625 public:
626   GUIInfo(int info, uint32_t data1 = 0, int data2 = 0, uint32_t flag = 0)
627   {
628     m_info = info;
629     m_data1 = data1;
630     m_data2 = data2;
631     if (flag)
632       SetInfoFlag(flag);
633   }
634   bool operator ==(const GUIInfo &right) const
635   {
636     return (m_info == right.m_info && m_data1 == right.m_data1 && m_data2 == right.m_data2);
637   };
638   uint32_t GetInfoFlag() const;
639   uint32_t GetData1() const;
640   int GetData2() const;
641   int m_info;
642 private:
643   void SetInfoFlag(uint32_t flag);
644   uint32_t m_data1;
645   int m_data2;
646 };
647
648 /*!
649  \ingroup strings
650  \brief
651  */
652 class CGUIInfoManager : public IMsgTargetCallback, public Observable
653 {
654 public:
655   CGUIInfoManager(void);
656   virtual ~CGUIInfoManager(void);
657
658   void Clear();
659   virtual bool OnMessage(CGUIMessage &message);
660
661   /*! \brief Register a boolean condition/expression
662    This routine allows controls or other clients of the info manager to register
663    to receive updates of particular expressions, in a particular context (currently windows).
664
665    In the future, it will allow clients to receive pushed callbacks when the expression changes.
666
667    \param expression the boolean condition or expression
668    \param context the context window
669    \return an identifier used to reference this expression
670
671    \sa GetBoolValue
672    */
673   unsigned int Register(const CStdString &expression, int context = 0);
674
675   /*! \brief Get a previously registered boolean expression's value
676    Checks the cache and evaluates the boolean expression if required.
677    \sa Register
678    */
679   bool GetBoolValue(unsigned int expression, const CGUIListItem *item = NULL);
680
681   /*! \brief Evaluate a boolean expression
682    \param expression the expression to evaluate
683    \param context the context in which to evaluate the expression (currently windows)
684    \return the value of the evaluated expression.
685    \sa Register, GetBoolValue
686    */
687   bool EvaluateBool(const CStdString &expression, int context = 0);
688
689   int TranslateString(const CStdString &strCondition);
690
691   /*! \brief Get integer value of info.
692    \param value int reference to pass value of given info
693    \param info id of info
694    \param context the context in which to evaluate the expression (currently windows)
695    \param item optional listitem if want to get listitem related int
696    \return true if given info was handled
697    \sa GetItemInt, GetMultiInfoInt
698    */
699   bool GetInt(int &value, int info, int contextWindow = 0, const CGUIListItem *item = NULL) const;
700   CStdString GetLabel(int info, int contextWindow = 0, CStdString *fallback = NULL);
701
702   CStdString GetImage(int info, int contextWindow, CStdString *fallback = NULL);
703
704   CStdString GetTime(TIME_FORMAT format = TIME_FORMAT_GUESS) const;
705   CStdString GetDate(bool bNumbersOnly = false);
706   CStdString GetDuration(TIME_FORMAT format = TIME_FORMAT_GUESS) const;
707
708   void SetCurrentItem(CFileItem &item);
709   void ResetCurrentItem();
710   // Current song stuff
711   /// \brief Retrieves tag info (if necessary) and fills in our current song path.
712   void SetCurrentSong(CFileItem &item);
713   void SetCurrentAlbumThumb(const CStdString thumbFileName);
714   void SetCurrentMovie(CFileItem &item);
715   void SetCurrentSlide(CFileItem &item);
716   const CFileItem &GetCurrentSlide() const;
717   void ResetCurrentSlide();
718   void SetCurrentSongTag(const MUSIC_INFO::CMusicInfoTag &tag);
719   void SetCurrentVideoTag(const CVideoInfoTag &tag);
720
721   const MUSIC_INFO::CMusicInfoTag *GetCurrentSongTag() const;
722   const CVideoInfoTag* GetCurrentMovieTag() const;
723
724   CStdString GetMusicLabel(int item);
725   CStdString GetMusicTagLabel(int info, const CFileItem *item);
726   CStdString GetVideoLabel(int item);
727   CStdString GetPlaylistLabel(int item) const;
728   CStdString GetMusicPartyModeLabel(int item);
729   const CStdString GetMusicPlaylistInfo(const GUIInfo& info);
730   CStdString GetPictureLabel(int item);
731
732   int64_t GetPlayTime() const;  // in ms
733   CStdString GetCurrentPlayTime(TIME_FORMAT format = TIME_FORMAT_GUESS) const;
734   CStdString GetCurrentSeekTime(TIME_FORMAT format = TIME_FORMAT_GUESS) const;
735   int GetPlayTimeRemaining() const;
736   int GetTotalPlayTime() const;
737   CStdString GetCurrentPlayTimeRemaining(TIME_FORMAT format) const;
738   CStdString GetVersion();
739   CStdString GetBuild();
740
741   bool GetDisplayAfterSeek();
742   void SetDisplayAfterSeek(unsigned int timeOut = 2500, int seekOffset = 0);
743   void SetSeeking(bool seeking) { m_playerSeeking = seeking; };
744   void SetShowTime(bool showtime) { m_playerShowTime = showtime; };
745   void SetShowCodec(bool showcodec) { m_playerShowCodec = showcodec; };
746   void SetShowInfo(bool showinfo) { m_playerShowInfo = showinfo; };
747   void ToggleShowCodec() { m_playerShowCodec = !m_playerShowCodec; };
748   bool ToggleShowInfo() { m_playerShowInfo = !m_playerShowInfo; return m_playerShowInfo; };
749   bool m_performingSeek;
750
751   std::string GetSystemHeatInfo(int info);
752   CTemperature GetGPUTemperature();
753
754   void UpdateFPS();
755   inline float GetFPS() const { return m_fps; };
756
757   void SetNextWindow(int windowID) { m_nextWindowID = windowID; };
758   void SetPreviousWindow(int windowID) { m_prevWindowID = windowID; };
759
760   void ResetCache();
761   bool GetItemInt(int &value, const CGUIListItem *item, int info) const;
762   CStdString GetItemLabel(const CFileItem *item, int info, CStdString *fallback = NULL);
763   CStdString GetItemImage(const CFileItem *item, int info, CStdString *fallback = NULL);
764
765   // Called from tuxbox service thread to update current status
766   void UpdateFromTuxBox();
767
768   /*! \brief containers call here to specify that the focus is changing
769    \param id control id
770    \param next true if we're moving to the next item, false if previous
771    \param scrolling true if the container is scrolling, false if the movement requires no scroll
772    */
773   void SetContainerMoving(int id, bool next, bool scrolling)
774   {
775     // magnitude 2 indicates a scroll, sign indicates direction
776     m_containerMoves[id] = (next ? 1 : -1) * (scrolling ? 2 : 1);
777   }
778
779   void SetLibraryBool(int condition, bool value);
780   bool GetLibraryBool(int condition);
781   void ResetLibraryBools();
782   CStdString LocalizeTime(const CDateTime &time, TIME_FORMAT format) const;
783
784   int TranslateSingleString(const CStdString &strCondition);
785
786   int RegisterSkinVariableString(const INFO::CSkinVariableString* info);
787   int TranslateSkinVariableString(const CStdString& name, int context);
788   CStdString GetSkinVariableString(int info, bool preferImage = false, const CGUIListItem *item=NULL);
789
790   /// \brief iterates through boolean conditions and compares their stored values to current values. Returns true if any condition changed value.
791   bool ConditionsChangedValues(const std::map<int, bool>& map);
792 protected:
793   friend class INFO::InfoSingle;
794   bool GetBool(int condition, int contextWindow = 0, const CGUIListItem *item=NULL);
795
796   // routines for window retrieval
797   bool CheckWindowCondition(CGUIWindow *window, int condition) const;
798   CGUIWindow *GetWindowWithCondition(int contextWindow, int condition) const;
799
800   /*! \brief class for holding information on properties
801    */
802   class Property
803   {
804   public:
805     Property(const CStdString &property, const CStdString &parameters);
806
807     const CStdString &param(unsigned int n = 0) const;
808     unsigned int num_params() const;
809
810     CStdString name;
811   private:
812     std::vector<CStdString> params;
813   };
814
815   bool GetMultiInfoBool(const GUIInfo &info, int contextWindow = 0, const CGUIListItem *item = NULL);
816   bool GetMultiInfoInt(int &value, const GUIInfo &info, int contextWindow = 0) const;
817   CStdString GetMultiInfoLabel(const GUIInfo &info, int contextWindow = 0, CStdString *fallback = NULL);
818   int TranslateListItem(const Property &info);
819   int TranslateMusicPlayerString(const CStdString &info) const;
820   TIME_FORMAT TranslateTimeFormat(const CStdString &format);
821   bool GetItemBool(const CGUIListItem *item, int condition) const;
822
823   /*! \brief Split an info string into it's constituent parts and parameters
824    Format is:
825      
826      info1(params1).info2(params2).info3(params3) ...
827    
828    where the parameters are an optional comma separated parameter list.
829    
830    \param infoString the original string
831    \param info the resulting pairs of info and parameters.
832    */
833   void SplitInfoString(const CStdString &infoString, std::vector<Property> &info);
834
835   // Conditional string parameters for testing are stored in a vector for later retrieval.
836   // The offset into the string parameters array is returned.
837   int ConditionalStringParameter(const CStdString &strParameter, bool caseSensitive = false);
838   int AddMultiInfo(const GUIInfo &info);
839   int AddListItemProp(const CStdString &str, int offset=0);
840
841   /*!
842    * @brief Get the EPG tag that is currently active
843    * @param tag The active tag
844    * @return True if an EPG tag is active and 'tag' was updated, false otherwise
845    */
846   bool GetEpgInfoTag(EPG::CEpgInfoTag& tag) const;
847
848   // Conditional string parameters are stored here
849   CStdStringArray m_stringParameters;
850
851   // Array of multiple information mapped to a single integer lookup
852   std::vector<GUIInfo> m_multiInfo;
853   std::vector<std::string> m_listitemProperties;
854
855   CStdString m_currentMovieDuration;
856
857   // Current playing stuff
858   CFileItem* m_currentFile;
859   CStdString m_currentMovieThumb;
860   unsigned int m_lastMusicBitrateTime;
861   unsigned int m_MusicBitrate;
862   CFileItem* m_currentSlide;
863
864   // fan stuff
865   unsigned int m_lastSysHeatInfoTime;
866   int m_fanSpeed;
867   CTemperature m_gpuTemp;
868   CTemperature m_cpuTemp;
869
870   //Fullscreen OSD Stuff
871   unsigned int m_AfterSeekTimeout;
872   int m_seekOffset;
873   bool m_playerSeeking;
874   bool m_playerShowTime;
875   bool m_playerShowCodec;
876   bool m_playerShowInfo;
877
878   // FPS counters
879   float m_fps;
880   unsigned int m_frameCounter;
881   unsigned int m_lastFPSTime;
882
883   std::map<int, int> m_containerMoves;  // direction of list moving
884   int m_nextWindowID;
885   int m_prevWindowID;
886
887   std::vector<INFO::InfoBool*> m_bools;
888   std::vector<INFO::CSkinVariableString> m_skinVariableStrings;
889   unsigned int m_updateTime;
890
891   int m_libraryHasMusic;
892   int m_libraryHasMovies;
893   int m_libraryHasTVShows;
894   int m_libraryHasMusicVideos;
895   int m_libraryHasMovieSets;
896
897   CCriticalSection m_critInfo;
898 };
899
900 /*!
901  \ingroup strings
902  \brief
903  */
904 extern CGUIInfoManager g_infoManager;
905 #endif
906
907
908
909