2 * Copyright (C) 2005-2008 Team XBMC
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with XBMC; see the file COPYING. If not, write to
17 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18 * http://www.gnu.org/copyleft/gpl.html
23 #include "GUIDialogSeekBar.h"
24 #include "GUIMediaWindow.h"
25 #include "GUIDialogFileBrowser.h"
26 #include "GUIDialogContentSettings.h"
27 #include "GUIDialogProgress.h"
28 #include "Application.h"
30 #include "lib/libscrobbler/lastfmscrobbler.h"
32 #include "PartyModeManager.h"
33 #include "addons/Visualisation.h"
34 #include "ButtonTranslator.h"
35 #include "utils/AlarmClock.h"
37 #include "utils/LCD.h"
39 #include "GUIPassword.h"
41 #include "SystemInfo.h"
42 #include "GUIButtonScroller.h"
43 #include "GUITextBox.h"
44 #include "GUIInfoManager.h"
45 #include "GUIWindowSlideShow.h"
46 #include "LastFmManager.h"
47 #include "PictureInfoTag.h"
48 #include "MusicInfoTag.h"
49 #include "GUIDialogMusicScan.h"
50 #include "GUIDialogVideoScan.h"
51 #include "GUIWindowManager.h"
52 #include "FileSystem/File.h"
54 #include "TuxBoxUtil.h"
55 #include "WindowingFactory.h"
56 #include "PowerManager.h"
57 #include "AdvancedSettings.h"
59 #include "LocalizeStrings.h"
61 #include "StringUtils.h"
63 // stuff for current song
64 #include "MusicInfoTagLoaderFactory.h"
65 #include "MusicInfoLoader.h"
66 #include "LabelFormatter.h"
68 #include "GUIUserMessages.h"
69 #include "GUIWindowVideoInfo.h"
70 #include "GUIWindowMusicInfo.h"
71 #include "addons/Skin.h"
72 #include "MediaManager.h"
73 #include "TimeUtils.h"
74 #include "SingleLock.h"
77 #include "addons/AddonManager.h"
79 #define SYSHEATUPDATEINTERVAL 60000
82 using namespace XFILE
;
83 using namespace MUSIC_INFO
;
84 using namespace ADDON
;
86 CGUIInfoManager g_infoManager
;
88 CGUIInfoManager::CCombinedValue
& CGUIInfoManager::CCombinedValue::operator =(const CGUIInfoManager::CCombinedValue
& mSrc
)
90 this->m_info
= mSrc
.m_info
;
91 this->m_id
= mSrc
.m_id
;
92 this->m_postfix
= mSrc
.m_postfix
;
96 CGUIInfoManager::CGUIInfoManager(void)
98 m_lastSysHeatInfoTime
= -SYSHEATUPDATEINTERVAL
; // make sure we grab CPU temp on the first pass
99 m_lastMusicBitrateTime
= 0;
101 m_AfterSeekTimeout
= 0;
103 m_playerSeeking
= false;
104 m_performingSeek
= false;
105 m_nextWindowID
= WINDOW_INVALID
;
106 m_prevWindowID
= WINDOW_INVALID
;
107 m_stringParameters
.push_back("__ZZZZ__"); // to offset the string parameters by 1 to assure that all entries are non-zero
108 m_currentFile
= new CFileItem
;
109 m_currentSlide
= new CFileItem
;
115 CGUIInfoManager::~CGUIInfoManager(void)
117 delete m_currentFile
;
118 delete m_currentSlide
;
121 bool CGUIInfoManager::OnMessage(CGUIMessage
&message
)
123 if (message
.GetMessage() == GUI_MSG_NOTIFY_ALL
)
125 if (message
.GetParam1() == GUI_MSG_UPDATE_ITEM
&& message
.GetItem())
127 CFileItemPtr item
= boost::static_pointer_cast
<CFileItem
>(message
.GetItem());
128 if (item
&& m_currentFile
->m_strPath
.Equals(item
->m_strPath
))
129 *m_currentFile
= *item
;
136 /// \brief Translates a string as given by the skin into an int that we use for more
137 /// efficient retrieval of data. Can handle combined strings on the form
138 /// Player.Caching + VideoPlayer.IsFullscreen (Logical and)
139 /// Player.HasVideo | Player.HasAudio (Logical or)
140 int CGUIInfoManager::TranslateString(const CStdString
&condition
)
142 // translate $LOCALIZE as required
143 CStdString
strCondition(CGUIInfoLabel::ReplaceLocalize(condition
));
144 if (strCondition
.find_first_of("|") != strCondition
.npos
||
145 strCondition
.find_first_of("+") != strCondition
.npos
||
146 strCondition
.find_first_of("[") != strCondition
.npos
||
147 strCondition
.find_first_of("]") != strCondition
.npos
)
149 // Have a boolean expression
150 // Check if this was added before
151 vector
<CCombinedValue
>::iterator it
;
152 for(it
= m_CombinedValues
.begin(); it
!= m_CombinedValues
.end(); it
++)
154 if(strCondition
.CompareNoCase(it
->m_info
) == 0)
157 return TranslateBooleanExpression(strCondition
);
159 //Just single command.
160 return TranslateSingleString(strCondition
);
164 /// \brief Translates a string as given by the skin into an int that we use for more
165 /// efficient retrieval of data.
166 int CGUIInfoManager::TranslateSingleString(const CStdString
&strCondition
)
168 // trim whitespace, and convert to lowercase
169 CStdString strTest
= strCondition
;
170 strTest
.TrimLeft(" \t\r\n");
171 strTest
.TrimRight(" \t\r\n");
172 if (strTest
.IsEmpty()) return 0;
174 bool bNegate
= strTest
[0] == '!';
178 strTest
.Delete(0, 1);
179 CStdString
original(strTest
);
182 CStdString strCategory
= strTest
.Left(strTest
.Find("."));
184 // translate conditions...
185 if (strTest
.Equals("false") || strTest
.Equals("no") || strTest
.Equals("off")) ret
= SYSTEM_ALWAYS_FALSE
;
186 else if (strTest
.Equals("true") || strTest
.Equals("yes") || strTest
.Equals("on")) ret
= SYSTEM_ALWAYS_TRUE
;
187 if (strCategory
.Equals("player"))
189 if (strTest
.Equals("player.hasmedia")) ret
= PLAYER_HAS_MEDIA
;
190 else if (strTest
.Equals("player.hasaudio")) ret
= PLAYER_HAS_AUDIO
;
191 else if (strTest
.Equals("player.hasvideo")) ret
= PLAYER_HAS_VIDEO
;
192 else if (strTest
.Equals("player.playing")) ret
= PLAYER_PLAYING
;
193 else if (strTest
.Equals("player.paused")) ret
= PLAYER_PAUSED
;
194 else if (strTest
.Equals("player.rewinding")) ret
= PLAYER_REWINDING
;
195 else if (strTest
.Equals("player.forwarding")) ret
= PLAYER_FORWARDING
;
196 else if (strTest
.Equals("player.rewinding2x")) ret
= PLAYER_REWINDING_2x
;
197 else if (strTest
.Equals("player.rewinding4x")) ret
= PLAYER_REWINDING_4x
;
198 else if (strTest
.Equals("player.rewinding8x")) ret
= PLAYER_REWINDING_8x
;
199 else if (strTest
.Equals("player.rewinding16x")) ret
= PLAYER_REWINDING_16x
;
200 else if (strTest
.Equals("player.rewinding32x")) ret
= PLAYER_REWINDING_32x
;
201 else if (strTest
.Equals("player.forwarding2x")) ret
= PLAYER_FORWARDING_2x
;
202 else if (strTest
.Equals("player.forwarding4x")) ret
= PLAYER_FORWARDING_4x
;
203 else if (strTest
.Equals("player.forwarding8x")) ret
= PLAYER_FORWARDING_8x
;
204 else if (strTest
.Equals("player.forwarding16x")) ret
= PLAYER_FORWARDING_16x
;
205 else if (strTest
.Equals("player.forwarding32x")) ret
= PLAYER_FORWARDING_32x
;
206 else if (strTest
.Equals("player.canrecord")) ret
= PLAYER_CAN_RECORD
;
207 else if (strTest
.Equals("player.recording")) ret
= PLAYER_RECORDING
;
208 else if (strTest
.Equals("player.displayafterseek")) ret
= PLAYER_DISPLAY_AFTER_SEEK
;
209 else if (strTest
.Equals("player.caching")) ret
= PLAYER_CACHING
;
210 else if (strTest
.Equals("player.cachelevel")) ret
= PLAYER_CACHELEVEL
;
211 else if (strTest
.Equals("player.seekbar")) ret
= PLAYER_SEEKBAR
;
212 else if (strTest
.Equals("player.progress")) ret
= PLAYER_PROGRESS
;
213 else if (strTest
.Equals("player.seeking")) ret
= PLAYER_SEEKING
;
214 else if (strTest
.Equals("player.showtime")) ret
= PLAYER_SHOWTIME
;
215 else if (strTest
.Equals("player.showcodec")) ret
= PLAYER_SHOWCODEC
;
216 else if (strTest
.Equals("player.showinfo")) ret
= PLAYER_SHOWINFO
;
217 else if (strTest
.Left(15).Equals("player.seektime")) return AddMultiInfo(GUIInfo(PLAYER_SEEKTIME
, TranslateTimeFormat(strTest
.Mid(15))));
218 else if (strTest
.Left(17).Equals("player.seekoffset")) return AddMultiInfo(GUIInfo(PLAYER_SEEKOFFSET
, TranslateTimeFormat(strTest
.Mid(17))));
219 else if (strTest
.Left(20).Equals("player.timeremaining")) return AddMultiInfo(GUIInfo(PLAYER_TIME_REMAINING
, TranslateTimeFormat(strTest
.Mid(20))));
220 else if (strTest
.Left(16).Equals("player.timespeed")) return AddMultiInfo(GUIInfo(PLAYER_TIME_SPEED
, TranslateTimeFormat(strTest
.Mid(16))));
221 else if (strTest
.Left(11).Equals("player.time")) return AddMultiInfo(GUIInfo(PLAYER_TIME
, TranslateTimeFormat(strTest
.Mid(11))));
222 else if (strTest
.Left(15).Equals("player.duration")) return AddMultiInfo(GUIInfo(PLAYER_DURATION
, TranslateTimeFormat(strTest
.Mid(15))));
223 else if (strTest
.Left(17).Equals("player.finishtime")) return AddMultiInfo(GUIInfo(PLAYER_FINISH_TIME
, TranslateTimeFormat(strTest
.Mid(17))));
224 else if (strTest
.Equals("player.volume")) ret
= PLAYER_VOLUME
;
225 else if (strTest
.Equals("player.subtitledelay")) ret
= PLAYER_SUBTITLE_DELAY
;
226 else if (strTest
.Equals("player.audiodelay")) ret
= PLAYER_AUDIO_DELAY
;
227 else if (strTest
.Equals("player.muted")) ret
= PLAYER_MUTED
;
228 else if (strTest
.Equals("player.hasduration")) ret
= PLAYER_HASDURATION
;
229 else if (strTest
.Equals("player.chapter")) ret
= PLAYER_CHAPTER
;
230 else if (strTest
.Equals("player.chaptercount")) ret
= PLAYER_CHAPTERCOUNT
;
231 else if (strTest
.Equals("player.chaptername")) ret
= PLAYER_CHAPTERNAME
;
232 else if (strTest
.Equals("player.starrating")) ret
= PLAYER_STAR_RATING
;
233 else if (strTest
.Equals("player.passthrough")) ret
= PLAYER_PASSTHROUGH
;
234 else if (strTest
.Equals("player.folderpath")) ret
= PLAYER_PATH
;
235 else if (strTest
.Equals("player.filenameandpath")) ret
= PLAYER_FILEPATH
;
237 else if (strCategory
.Equals("weather"))
239 if (strTest
.Equals("weather.conditions")) ret
= WEATHER_CONDITIONS
;
240 else if (strTest
.Equals("weather.temperature")) ret
= WEATHER_TEMPERATURE
;
241 else if (strTest
.Equals("weather.location")) ret
= WEATHER_LOCATION
;
242 else if (strTest
.Equals("weather.isfetched")) ret
= WEATHER_IS_FETCHED
;
243 else if (strTest
.Equals("weather.fanartcode")) ret
= WEATHER_FANART_CODE
;
244 else if (strTest
.Equals("weather.plugin")) ret
= WEATHER_PLUGIN
;
246 else if (strCategory
.Equals("bar"))
248 if (strTest
.Equals("bar.gputemperature")) ret
= SYSTEM_GPU_TEMPERATURE
;
249 else if (strTest
.Equals("bar.cputemperature")) ret
= SYSTEM_CPU_TEMPERATURE
;
250 else if (strTest
.Equals("bar.cpuusage")) ret
= SYSTEM_CPU_USAGE
;
251 else if (strTest
.Equals("bar.freememory")) ret
= SYSTEM_FREE_MEMORY
;
252 else if (strTest
.Equals("bar.usedmemory")) ret
= SYSTEM_USED_MEMORY
;
253 else if (strTest
.Equals("bar.fanspeed")) ret
= SYSTEM_FAN_SPEED
;
254 else if (strTest
.Equals("bar.usedspace")) ret
= SYSTEM_USED_SPACE
;
255 else if (strTest
.Equals("bar.freespace")) ret
= SYSTEM_FREE_SPACE
;
256 else if (strTest
.Equals("bar.usedspace(c)")) ret
= SYSTEM_USED_SPACE_C
;
257 else if (strTest
.Equals("bar.freespace(c)")) ret
= SYSTEM_FREE_SPACE_C
;
258 else if (strTest
.Equals("bar.usedspace(e)")) ret
= SYSTEM_USED_SPACE_E
;
259 else if (strTest
.Equals("bar.freespace(e)")) ret
= SYSTEM_FREE_SPACE_E
;
260 else if (strTest
.Equals("bar.usedspace(f)")) ret
= SYSTEM_USED_SPACE_F
;
261 else if (strTest
.Equals("bar.freespace(f)")) ret
= SYSTEM_FREE_SPACE_F
;
262 else if (strTest
.Equals("bar.usedspace(g)")) ret
= SYSTEM_USED_SPACE_G
;
263 else if (strTest
.Equals("bar.freespace(g)")) ret
= SYSTEM_FREE_SPACE_G
;
264 else if (strTest
.Equals("bar.usedspace(x)")) ret
= SYSTEM_USED_SPACE_X
;
265 else if (strTest
.Equals("bar.freespace(x)")) ret
= SYSTEM_FREE_SPACE_X
;
266 else if (strTest
.Equals("bar.usedspace(y)")) ret
= SYSTEM_USED_SPACE_Y
;
267 else if (strTest
.Equals("bar.freespace(y)")) ret
= SYSTEM_FREE_SPACE_Y
;
268 else if (strTest
.Equals("bar.usedspace(z)")) ret
= SYSTEM_USED_SPACE_Z
;
269 else if (strTest
.Equals("bar.freespace(z)")) ret
= SYSTEM_FREE_SPACE_Z
;
270 else if (strTest
.Equals("bar.hddtemperature")) ret
= SYSTEM_HDD_TEMPERATURE
;
272 else if (strCategory
.Equals("system"))
274 if (strTest
.Equals("system.date")) ret
= SYSTEM_DATE
;
275 else if (strTest
.Left(12).Equals("system.date("))
277 // the skin must submit the date in the format MM-DD
278 // This InfoBool is designed for generic range checking, so year is NOT used. Only Month-Day.
279 CStdString param
= strTest
.Mid(12, strTest
.length() - 13);
280 CStdStringArray params
;
281 StringUtils::SplitString(param
, ",", params
);
282 if (params
.size() == 2)
283 return AddMultiInfo(GUIInfo(bNegate
? -SYSTEM_DATE
: SYSTEM_DATE
, StringUtils::DateStringToYYYYMMDD(params
[0]) % 10000, StringUtils::DateStringToYYYYMMDD(params
[1]) % 10000));
284 else if (params
.size() == 1)
285 return AddMultiInfo(GUIInfo(bNegate
? -SYSTEM_DATE
: SYSTEM_DATE
, StringUtils::DateStringToYYYYMMDD(params
[0]) % 10000));
287 else if (strTest
.Left(11).Equals("system.time"))
289 // determine if this is a System.Time(TIME_FORMAT) infolabel or a System.Time(13:00,14:00) boolean based on the contents of the param
290 // essentially if it isn't a valid TIME_FORMAT then its considered to be the latter.
291 CStdString param
= strTest
.Mid(11);
292 TIME_FORMAT timeFormat
= TranslateTimeFormat(param
);
293 if ((timeFormat
== TIME_FORMAT_GUESS
) && (!param
.IsEmpty()))
295 param
= strTest
.Mid(12, strTest
.length() - 13);
296 CStdStringArray params
;
297 StringUtils::SplitString(param
, ",", params
);
298 if (params
.size() == 2)
299 return AddMultiInfo(GUIInfo(bNegate
? -SYSTEM_TIME
: SYSTEM_TIME
, StringUtils::TimeStringToSeconds(params
[0]), StringUtils::TimeStringToSeconds(params
[1])));
300 else if (params
.size() == 1)
301 return AddMultiInfo(GUIInfo(bNegate
? -SYSTEM_TIME
: SYSTEM_TIME
, StringUtils::TimeStringToSeconds(params
[0])));
304 return AddMultiInfo(GUIInfo(SYSTEM_TIME
, timeFormat
));
306 else if (strTest
.Equals("system.cputemperature")) ret
= SYSTEM_CPU_TEMPERATURE
;
307 else if (strTest
.Equals("system.cpuusage")) ret
= SYSTEM_CPU_USAGE
;
308 else if (strTest
.Equals("system.gputemperature")) ret
= SYSTEM_GPU_TEMPERATURE
;
309 else if (strTest
.Equals("system.fanspeed")) ret
= SYSTEM_FAN_SPEED
;
310 else if (strTest
.Equals("system.freespace")) ret
= SYSTEM_FREE_SPACE
;
311 else if (strTest
.Equals("system.usedspace")) ret
= SYSTEM_USED_SPACE
;
312 else if (strTest
.Equals("system.totalspace")) ret
= SYSTEM_TOTAL_SPACE
;
313 else if (strTest
.Equals("system.usedspacepercent")) ret
= SYSTEM_USED_SPACE_PERCENT
;
314 else if (strTest
.Equals("system.freespacepercent")) ret
= SYSTEM_FREE_SPACE_PERCENT
;
315 else if (strTest
.Equals("system.freespace(c)")) ret
= SYSTEM_FREE_SPACE_C
;
316 else if (strTest
.Equals("system.usedspace(c)")) ret
= SYSTEM_USED_SPACE_C
;
317 else if (strTest
.Equals("system.totalspace(c)")) ret
= SYSTEM_TOTAL_SPACE_C
;
318 else if (strTest
.Equals("system.usedspacepercent(c)")) ret
= SYSTEM_USED_SPACE_PERCENT_C
;
319 else if (strTest
.Equals("system.freespacepercent(c)")) ret
= SYSTEM_FREE_SPACE_PERCENT_C
;
320 else if (strTest
.Equals("system.freespace(e)")) ret
= SYSTEM_FREE_SPACE_E
;
321 else if (strTest
.Equals("system.usedspace(e)")) ret
= SYSTEM_USED_SPACE_E
;
322 else if (strTest
.Equals("system.totalspace(e)")) ret
= SYSTEM_TOTAL_SPACE_E
;
323 else if (strTest
.Equals("system.usedspacepercent(e)")) ret
= SYSTEM_USED_SPACE_PERCENT_E
;
324 else if (strTest
.Equals("system.freespacepercent(e)")) ret
= SYSTEM_FREE_SPACE_PERCENT_E
;
325 else if (strTest
.Equals("system.freespace(f)")) ret
= SYSTEM_FREE_SPACE_F
;
326 else if (strTest
.Equals("system.usedspace(f)")) ret
= SYSTEM_USED_SPACE_F
;
327 else if (strTest
.Equals("system.totalspace(f)")) ret
= SYSTEM_TOTAL_SPACE_F
;
328 else if (strTest
.Equals("system.usedspacepercent(f)")) ret
= SYSTEM_USED_SPACE_PERCENT_F
;
329 else if (strTest
.Equals("system.freespacepercent(f)")) ret
= SYSTEM_FREE_SPACE_PERCENT_F
;
330 else if (strTest
.Equals("system.freespace(g)")) ret
= SYSTEM_FREE_SPACE_G
;
331 else if (strTest
.Equals("system.usedspace(g)")) ret
= SYSTEM_USED_SPACE_G
;
332 else if (strTest
.Equals("system.totalspace(g)")) ret
= SYSTEM_TOTAL_SPACE_G
;
333 else if (strTest
.Equals("system.usedspacepercent(g)")) ret
= SYSTEM_USED_SPACE_PERCENT_G
;
334 else if (strTest
.Equals("system.freespacepercent(g)")) ret
= SYSTEM_FREE_SPACE_PERCENT_G
;
335 else if (strTest
.Equals("system.usedspace(x)")) ret
= SYSTEM_USED_SPACE_X
;
336 else if (strTest
.Equals("system.freespace(x)")) ret
= SYSTEM_FREE_SPACE_X
;
337 else if (strTest
.Equals("system.totalspace(x)")) ret
= SYSTEM_TOTAL_SPACE_X
;
338 else if (strTest
.Equals("system.usedspace(y)")) ret
= SYSTEM_USED_SPACE_Y
;
339 else if (strTest
.Equals("system.freespace(y)")) ret
= SYSTEM_FREE_SPACE_Y
;
340 else if (strTest
.Equals("system.totalspace(y)")) ret
= SYSTEM_TOTAL_SPACE_Y
;
341 else if (strTest
.Equals("system.usedspace(z)")) ret
= SYSTEM_USED_SPACE_Z
;
342 else if (strTest
.Equals("system.freespace(z)")) ret
= SYSTEM_FREE_SPACE_Z
;
343 else if (strTest
.Equals("system.totalspace(z)")) ret
= SYSTEM_TOTAL_SPACE_Z
;
344 else if (strTest
.Equals("system.buildversion")) ret
= SYSTEM_BUILD_VERSION
;
345 else if (strTest
.Equals("system.builddate")) ret
= SYSTEM_BUILD_DATE
;
346 else if (strTest
.Equals("system.hasnetwork")) ret
= SYSTEM_ETHERNET_LINK_ACTIVE
;
347 else if (strTest
.Equals("system.fps")) ret
= SYSTEM_FPS
;
348 else if (strTest
.Equals("system.hasmediadvd")) ret
= SYSTEM_MEDIA_DVD
;
349 else if (strTest
.Equals("system.dvdready")) ret
= SYSTEM_DVDREADY
;
350 else if (strTest
.Equals("system.trayopen")) ret
= SYSTEM_TRAYOPEN
;
351 else if (strTest
.Equals("system.dvdtraystate")) ret
= SYSTEM_DVD_TRAY_STATE
;
353 else if (strTest
.Equals("system.memory(free)") || strTest
.Equals("system.freememory")) ret
= SYSTEM_FREE_MEMORY
;
354 else if (strTest
.Equals("system.memory(free.percent)")) ret
= SYSTEM_FREE_MEMORY_PERCENT
;
355 else if (strTest
.Equals("system.memory(used)")) ret
= SYSTEM_USED_MEMORY
;
356 else if (strTest
.Equals("system.memory(used.percent)")) ret
= SYSTEM_USED_MEMORY_PERCENT
;
357 else if (strTest
.Equals("system.memory(total)")) ret
= SYSTEM_TOTAL_MEMORY
;
359 else if (strTest
.Equals("system.language")) ret
= SYSTEM_LANGUAGE
;
360 else if (strTest
.Equals("system.temperatureunits")) ret
= SYSTEM_TEMPERATURE_UNITS
;
361 else if (strTest
.Equals("system.screenmode")) ret
= SYSTEM_SCREEN_MODE
;
362 else if (strTest
.Equals("system.screenwidth")) ret
= SYSTEM_SCREEN_WIDTH
;
363 else if (strTest
.Equals("system.screenheight")) ret
= SYSTEM_SCREEN_HEIGHT
;
364 else if (strTest
.Equals("system.currentwindow")) ret
= SYSTEM_CURRENT_WINDOW
;
365 else if (strTest
.Equals("system.currentcontrol")) ret
= SYSTEM_CURRENT_CONTROL
;
366 else if (strTest
.Equals("system.dvdlabel")) ret
= SYSTEM_DVD_LABEL
;
367 else if (strTest
.Equals("system.haslocks")) ret
= SYSTEM_HASLOCKS
;
368 else if (strTest
.Equals("system.hasloginscreen")) ret
= SYSTEM_HAS_LOGINSCREEN
;
369 else if (strTest
.Equals("system.ismaster")) ret
= SYSTEM_ISMASTER
;
370 else if (strTest
.Equals("system.internetstate")) ret
= SYSTEM_INTERNET_STATE
;
371 else if (strTest
.Equals("system.loggedon")) ret
= SYSTEM_LOGGEDON
;
372 else if (strTest
.Equals("system.hasdrivef")) ret
= SYSTEM_HAS_DRIVE_F
;
373 else if (strTest
.Equals("system.hasdriveg")) ret
= SYSTEM_HAS_DRIVE_G
;
374 else if (strTest
.Equals("system.kernelversion")) ret
= SYSTEM_KERNEL_VERSION
;
375 else if (strTest
.Equals("system.uptime")) ret
= SYSTEM_UPTIME
;
376 else if (strTest
.Equals("system.totaluptime")) ret
= SYSTEM_TOTALUPTIME
;
377 else if (strTest
.Equals("system.cpufrequency")) ret
= SYSTEM_CPUFREQUENCY
;
378 else if (strTest
.Equals("system.screenresolution")) ret
= SYSTEM_SCREEN_RESOLUTION
;
379 else if (strTest
.Equals("system.videoencoderinfo")) ret
= SYSTEM_VIDEO_ENCODER_INFO
;
380 else if (strTest
.Left(16).Equals("system.idletime("))
382 int time
= atoi((strTest
.Mid(16, strTest
.GetLength() - 17).c_str()));
383 if (time
> SYSTEM_IDLE_TIME_FINISH
- SYSTEM_IDLE_TIME_START
)
384 time
= SYSTEM_IDLE_TIME_FINISH
- SYSTEM_IDLE_TIME_START
;
386 ret
= SYSTEM_IDLE_TIME_START
+ time
;
388 else if (strTest
.Left(16).Equals("system.hasalarm("))
389 return AddMultiInfo(GUIInfo(bNegate
? -SYSTEM_HAS_ALARM
: SYSTEM_HAS_ALARM
, ConditionalStringParameter(strTest
.Mid(16,strTest
.size()-17)), 0));
390 else if (strTest
.Equals("system.alarmpos")) ret
= SYSTEM_ALARM_POS
;
391 else if (strTest
.Left(24).Equals("system.alarmlessorequal("))
393 int pos
= strTest
.Find(",");
394 int skinOffset
= ConditionalStringParameter(strTest
.Mid(24, pos
-24));
395 int compareString
= ConditionalStringParameter(strTest
.Mid(pos
+ 1, strTest
.GetLength() - (pos
+ 2)));
396 return AddMultiInfo(GUIInfo(bNegate
? -SYSTEM_ALARM_LESS_OR_EQUAL
: SYSTEM_ALARM_LESS_OR_EQUAL
, skinOffset
, compareString
));
398 else if (strTest
.Equals("system.profilename")) ret
= SYSTEM_PROFILENAME
;
399 else if (strTest
.Equals("system.profilethumb")) ret
= SYSTEM_PROFILETHUMB
;
400 else if (strTest
.Equals("system.progressbar")) ret
= SYSTEM_PROGRESS_BAR
;
401 else if (strTest
.Equals("system.platform.linux")) ret
= SYSTEM_PLATFORM_LINUX
;
402 else if (strTest
.Equals("system.platform.xbox")) ret
= SYSTEM_PLATFORM_XBOX
;
403 else if (strTest
.Equals("system.platform.windows")) ret
= SYSTEM_PLATFORM_WINDOWS
;
404 else if (strTest
.Equals("system.platform.osx")) ret
= SYSTEM_PLATFORM_OSX
;
405 else if (strTest
.Left(15).Equals("system.getbool("))
406 return AddMultiInfo(GUIInfo(bNegate
? -SYSTEM_GET_BOOL
: SYSTEM_GET_BOOL
, ConditionalStringParameter(strTest
.Mid(15,strTest
.size()-16)), 0));
407 else if (strTest
.Left(17).Equals("system.coreusage("))
408 return AddMultiInfo(GUIInfo(SYSTEM_GET_CORE_USAGE
, atoi(strTest
.Mid(17,strTest
.size()-18)), 0));
409 else if (strTest
.Left(17).Equals("system.hascoreid("))
410 return AddMultiInfo(GUIInfo(bNegate
? -SYSTEM_HAS_CORE_ID
: SYSTEM_HAS_CORE_ID
, ConditionalStringParameter(strTest
.Mid(17,strTest
.size()-18)), 0));
411 else if (strTest
.Left(15).Equals("system.setting("))
412 return AddMultiInfo(GUIInfo(bNegate
? -SYSTEM_SETTING
: SYSTEM_SETTING
, ConditionalStringParameter(strTest
.Mid(15,strTest
.size()-16)), 0));
413 else if (strTest
.Equals("system.canpowerdown")) ret
= SYSTEM_CAN_POWERDOWN
;
414 else if (strTest
.Equals("system.cansuspend")) ret
= SYSTEM_CAN_SUSPEND
;
415 else if (strTest
.Equals("system.canhibernate")) ret
= SYSTEM_CAN_HIBERNATE
;
416 else if (strTest
.Equals("system.canreboot")) ret
= SYSTEM_CAN_REBOOT
;
417 else if (strTest
.Left(16).Equals("system.hasaddon("))
418 return AddMultiInfo(GUIInfo(bNegate
? -SYSTEM_HAS_ADDON
: SYSTEM_HAS_ADDON
, ConditionalStringParameter(strTest
.Mid(16,strTest
.size()-17)), 0));
420 // library test conditions
421 else if (strTest
.Left(7).Equals("library"))
423 if (strTest
.Equals("library.hascontent(music)")) ret
= LIBRARY_HAS_MUSIC
;
424 else if (strTest
.Equals("library.hascontent(video)")) ret
= LIBRARY_HAS_VIDEO
;
425 else if (strTest
.Equals("library.hascontent(movies)")) ret
= LIBRARY_HAS_MOVIES
;
426 else if (strTest
.Equals("library.hascontent(tvshows)")) ret
= LIBRARY_HAS_TVSHOWS
;
427 else if (strTest
.Equals("library.hascontent(musicvideos)")) ret
= LIBRARY_HAS_MUSICVIDEOS
;
428 else if (strTest
.Equals("library.isscanning")) ret
= LIBRARY_IS_SCANNING
;
430 else if (strTest
.Left(8).Equals("isempty("))
432 CStdString str
= strTest
.Mid(8, strTest
.GetLength() - 9);
433 return AddMultiInfo(GUIInfo(bNegate
? -STRING_IS_EMPTY
: STRING_IS_EMPTY
, TranslateSingleString(str
)));
435 else if (strTest
.Left(14).Equals("stringcompare("))
437 int pos
= strTest
.Find(",");
438 int info
= TranslateString(strTest
.Mid(14, pos
-14));
439 int info2
= TranslateString(strTest
.Mid(pos
+ 1, strTest
.GetLength() - (pos
+ 2)));
441 return AddMultiInfo(GUIInfo(bNegate
? -STRING_COMPARE
: STRING_COMPARE
, info
, -info2
));
442 // pipe our original string through the localize parsing then make it lowercase (picks up $LBRACKET etc.)
443 CStdString label
= CGUIInfoLabel::GetLabel(original
.Mid(pos
+ 1, original
.GetLength() - (pos
+ 2))).ToLower();
444 int compareString
= ConditionalStringParameter(label
);
445 return AddMultiInfo(GUIInfo(bNegate
? -STRING_COMPARE
: STRING_COMPARE
, info
, compareString
));
447 else if (strTest
.Left(19).Equals("integergreaterthan("))
449 int pos
= strTest
.Find(",");
450 int info
= TranslateString(strTest
.Mid(19, pos
-19));
451 int compareInt
= atoi(strTest
.Mid(pos
+ 1, strTest
.GetLength() - (pos
+ 2)).c_str());
452 return AddMultiInfo(GUIInfo(bNegate
? -INTEGER_GREATER_THAN
: INTEGER_GREATER_THAN
, info
, compareInt
));
454 else if (strTest
.Left(10).Equals("substring("))
456 int pos
= strTest
.Find(",");
457 int info
= TranslateString(strTest
.Mid(10, pos
-10));
458 // pipe our original string through the localize parsing then make it lowercase (picks up $LBRACKET etc.)
459 CStdString label
= CGUIInfoLabel::GetLabel(original
.Mid(pos
+ 1, original
.GetLength() - (pos
+ 2))).ToLower();
460 int compareString
= ConditionalStringParameter(label
);
461 return AddMultiInfo(GUIInfo(bNegate
? -STRING_STR
: STRING_STR
, info
, compareString
));
463 else if (strCategory
.Equals("lcd"))
465 if (strTest
.Equals("lcd.playicon")) ret
= LCD_PLAY_ICON
;
466 else if (strTest
.Equals("lcd.progressbar")) ret
= LCD_PROGRESS_BAR
;
467 else if (strTest
.Equals("lcd.cputemperature")) ret
= LCD_CPU_TEMPERATURE
;
468 else if (strTest
.Equals("lcd.gputemperature")) ret
= LCD_GPU_TEMPERATURE
;
469 else if (strTest
.Equals("lcd.hddtemperature")) ret
= LCD_HDD_TEMPERATURE
;
470 else if (strTest
.Equals("lcd.fanspeed")) ret
= LCD_FAN_SPEED
;
471 else if (strTest
.Equals("lcd.date")) ret
= LCD_DATE
;
472 else if (strTest
.Equals("lcd.freespace(c)")) ret
= LCD_FREE_SPACE_C
;
473 else if (strTest
.Equals("lcd.freespace(e)")) ret
= LCD_FREE_SPACE_E
;
474 else if (strTest
.Equals("lcd.freespace(f)")) ret
= LCD_FREE_SPACE_F
;
475 else if (strTest
.Equals("lcd.freespace(g)")) ret
= LCD_FREE_SPACE_G
;
476 else if (strTest
.Equals("lcd.Time21")) ret
= LCD_TIME_21
; // Small LCD numbers
477 else if (strTest
.Equals("lcd.Time22")) ret
= LCD_TIME_22
;
478 else if (strTest
.Equals("lcd.TimeWide21")) ret
= LCD_TIME_W21
; // Medium LCD numbers
479 else if (strTest
.Equals("lcd.TimeWide22")) ret
= LCD_TIME_W22
;
480 else if (strTest
.Equals("lcd.Time41")) ret
= LCD_TIME_41
; // Big LCD numbers
481 else if (strTest
.Equals("lcd.Time42")) ret
= LCD_TIME_42
;
482 else if (strTest
.Equals("lcd.Time43")) ret
= LCD_TIME_43
;
483 else if (strTest
.Equals("lcd.Time44")) ret
= LCD_TIME_44
;
485 else if (strCategory
.Equals("network"))
487 if (strTest
.Equals("network.ipaddress")) ret
= NETWORK_IP_ADDRESS
;
488 if (strTest
.Equals("network.isdhcp")) ret
= NETWORK_IS_DHCP
;
489 if (strTest
.Equals("network.linkstate")) ret
= NETWORK_LINK_STATE
;
490 if (strTest
.Equals("network.macaddress")) ret
= NETWORK_MAC_ADDRESS
;
491 if (strTest
.Equals("network.subnetaddress")) ret
= NETWORK_SUBNET_ADDRESS
;
492 if (strTest
.Equals("network.gatewayaddress")) ret
= NETWORK_GATEWAY_ADDRESS
;
493 if (strTest
.Equals("network.dns1address")) ret
= NETWORK_DNS1_ADDRESS
;
494 if (strTest
.Equals("network.dns2address")) ret
= NETWORK_DNS2_ADDRESS
;
495 if (strTest
.Equals("network.dhcpaddress")) ret
= NETWORK_DHCP_ADDRESS
;
497 else if (strCategory
.Equals("musicplayer"))
499 CStdString info
= strTest
.Mid(strCategory
.GetLength() + 1);
500 if (info
.Left(9).Equals("position("))
502 int position
= atoi(info
.Mid(9));
503 int value
= TranslateMusicPlayerString(info
.Mid(info
.Find(".")+1));
504 ret
= AddMultiInfo(GUIInfo(value
, 0, position
));
506 else if (info
.Left(7).Equals("offset("))
508 int position
= atoi(info
.Mid(7));
509 int value
= TranslateMusicPlayerString(info
.Mid(info
.Find(".")+1));
510 ret
= AddMultiInfo(GUIInfo(value
, 1, position
));
512 else if (info
.Left(13).Equals("timeremaining")) return AddMultiInfo(GUIInfo(PLAYER_TIME_REMAINING
, TranslateTimeFormat(info
.Mid(13))));
513 else if (info
.Left(9).Equals("timespeed")) return AddMultiInfo(GUIInfo(PLAYER_TIME_SPEED
, TranslateTimeFormat(info
.Mid(9))));
514 else if (info
.Left(4).Equals("time")) return AddMultiInfo(GUIInfo(PLAYER_TIME
, TranslateTimeFormat(info
.Mid(4))));
515 else if (info
.Left(8).Equals("duration")) return AddMultiInfo(GUIInfo(PLAYER_DURATION
, TranslateTimeFormat(info
.Mid(8))));
516 else if (info
.Left(9).Equals("property("))
517 return AddListItemProp(info
.Mid(9, info
.GetLength() - 10), MUSICPLAYER_PROPERTY_OFFSET
);
519 ret
= TranslateMusicPlayerString(strTest
.Mid(12));
521 else if (strCategory
.Equals("videoplayer"))
523 if (strTest
.Equals("videoplayer.title")) ret
= VIDEOPLAYER_TITLE
;
524 else if (strTest
.Equals("videoplayer.genre")) ret
= VIDEOPLAYER_GENRE
;
525 else if (strTest
.Equals("videoplayer.country")) ret
= VIDEOPLAYER_COUNTRY
;
526 else if (strTest
.Equals("videoplayer.originaltitle")) ret
= VIDEOPLAYER_ORIGINALTITLE
;
527 else if (strTest
.Equals("videoplayer.director")) ret
= VIDEOPLAYER_DIRECTOR
;
528 else if (strTest
.Equals("videoplayer.year")) ret
= VIDEOPLAYER_YEAR
;
529 else if (strTest
.Left(25).Equals("videoplayer.timeremaining")) ret
= AddMultiInfo(GUIInfo(PLAYER_TIME_REMAINING
, TranslateTimeFormat(strTest
.Mid(25))));
530 else if (strTest
.Left(21).Equals("videoplayer.timespeed")) ret
= AddMultiInfo(GUIInfo(PLAYER_TIME_SPEED
, TranslateTimeFormat(strTest
.Mid(21))));
531 else if (strTest
.Left(16).Equals("videoplayer.time")) ret
= AddMultiInfo(GUIInfo(PLAYER_TIME
, TranslateTimeFormat(strTest
.Mid(16))));
532 else if (strTest
.Left(20).Equals("videoplayer.duration")) ret
= AddMultiInfo(GUIInfo(PLAYER_DURATION
, TranslateTimeFormat(strTest
.Mid(20))));
533 else if (strTest
.Equals("videoplayer.cover")) ret
= VIDEOPLAYER_COVER
;
534 else if (strTest
.Equals("videoplayer.usingoverlays")) ret
= VIDEOPLAYER_USING_OVERLAYS
;
535 else if (strTest
.Equals("videoplayer.isfullscreen")) ret
= VIDEOPLAYER_ISFULLSCREEN
;
536 else if (strTest
.Equals("videoplayer.hasmenu")) ret
= VIDEOPLAYER_HASMENU
;
537 else if (strTest
.Equals("videoplayer.playlistlength")) ret
= VIDEOPLAYER_PLAYLISTLEN
;
538 else if (strTest
.Equals("videoplayer.playlistposition")) ret
= VIDEOPLAYER_PLAYLISTPOS
;
539 else if (strTest
.Equals("videoplayer.plot")) ret
= VIDEOPLAYER_PLOT
;
540 else if (strTest
.Equals("videoplayer.plotoutline")) ret
= VIDEOPLAYER_PLOT_OUTLINE
;
541 else if (strTest
.Equals("videoplayer.episode")) ret
= VIDEOPLAYER_EPISODE
;
542 else if (strTest
.Equals("videoplayer.season")) ret
= VIDEOPLAYER_SEASON
;
543 else if (strTest
.Equals("videoplayer.rating")) ret
= VIDEOPLAYER_RATING
;
544 else if (strTest
.Equals("videoplayer.ratingandvotes")) ret
= VIDEOPLAYER_RATING_AND_VOTES
;
545 else if (strTest
.Equals("videoplayer.tvshowtitle")) ret
= VIDEOPLAYER_TVSHOW
;
546 else if (strTest
.Equals("videoplayer.premiered")) ret
= VIDEOPLAYER_PREMIERED
;
547 else if (strTest
.Left(19).Equals("videoplayer.content")) return AddMultiInfo(GUIInfo(bNegate
? -VIDEOPLAYER_CONTENT
: VIDEOPLAYER_CONTENT
, ConditionalStringParameter(strTest
.Mid(20,strTest
.size()-21)), 0));
548 else if (strTest
.Equals("videoplayer.studio")) ret
= VIDEOPLAYER_STUDIO
;
549 else if (strTest
.Equals("videoplayer.mpaa")) return VIDEOPLAYER_MPAA
;
550 else if (strTest
.Equals("videoplayer.top250")) return VIDEOPLAYER_TOP250
;
551 else if (strTest
.Equals("videoplayer.cast")) return VIDEOPLAYER_CAST
;
552 else if (strTest
.Equals("videoplayer.castandrole")) return VIDEOPLAYER_CAST_AND_ROLE
;
553 else if (strTest
.Equals("videoplayer.artist")) return VIDEOPLAYER_ARTIST
;
554 else if (strTest
.Equals("videoplayer.album")) return VIDEOPLAYER_ALBUM
;
555 else if (strTest
.Equals("videoplayer.writer")) return VIDEOPLAYER_WRITER
;
556 else if (strTest
.Equals("videoplayer.tagline")) return VIDEOPLAYER_TAGLINE
;
557 else if (strTest
.Equals("videoplayer.hasinfo")) return VIDEOPLAYER_HAS_INFO
;
558 else if (strTest
.Equals("videoplayer.trailer")) return VIDEOPLAYER_TRAILER
;
559 else if (strTest
.Equals("videoplayer.videocodec")) return VIDEOPLAYER_VIDEO_CODEC
;
560 else if (strTest
.Equals("videoplayer.videoresolution")) return VIDEOPLAYER_VIDEO_RESOLUTION
;
561 else if (strTest
.Equals("videoplayer.videoaspect")) return VIDEOPLAYER_VIDEO_ASPECT
;
562 else if (strTest
.Equals("videoplayer.audiocodec")) return VIDEOPLAYER_AUDIO_CODEC
;
563 else if (strTest
.Equals("videoplayer.audiochannels")) return VIDEOPLAYER_AUDIO_CHANNELS
;
564 else if (strTest
.Equals("videoplayer.hasteletext")) return VIDEOPLAYER_HASTELETEXT
;
566 else if (strCategory
.Equals("playlist"))
568 if (strTest
.Equals("playlist.length")) ret
= PLAYLIST_LENGTH
;
569 else if (strTest
.Equals("playlist.position")) ret
= PLAYLIST_POSITION
;
570 else if (strTest
.Equals("playlist.random")) ret
= PLAYLIST_RANDOM
;
571 else if (strTest
.Equals("playlist.repeat")) ret
= PLAYLIST_REPEAT
;
572 else if (strTest
.Equals("playlist.israndom")) ret
= PLAYLIST_ISRANDOM
;
573 else if (strTest
.Equals("playlist.isrepeat")) ret
= PLAYLIST_ISREPEAT
;
574 else if (strTest
.Equals("playlist.isrepeatone")) ret
= PLAYLIST_ISREPEATONE
;
576 else if (strCategory
.Equals("musicpartymode"))
578 if (strTest
.Equals("musicpartymode.enabled")) ret
= MUSICPM_ENABLED
;
579 else if (strTest
.Equals("musicpartymode.songsplayed")) ret
= MUSICPM_SONGSPLAYED
;
580 else if (strTest
.Equals("musicpartymode.matchingsongs")) ret
= MUSICPM_MATCHINGSONGS
;
581 else if (strTest
.Equals("musicpartymode.matchingsongspicked")) ret
= MUSICPM_MATCHINGSONGSPICKED
;
582 else if (strTest
.Equals("musicpartymode.matchingsongsleft")) ret
= MUSICPM_MATCHINGSONGSLEFT
;
583 else if (strTest
.Equals("musicpartymode.relaxedsongspicked")) ret
= MUSICPM_RELAXEDSONGSPICKED
;
584 else if (strTest
.Equals("musicpartymode.randomsongspicked")) ret
= MUSICPM_RANDOMSONGSPICKED
;
586 else if (strCategory
.Equals("audioscrobbler"))
588 if (strTest
.Equals("audioscrobbler.enabled")) ret
= AUDIOSCROBBLER_ENABLED
;
589 else if (strTest
.Equals("audioscrobbler.connectstate")) ret
= AUDIOSCROBBLER_CONN_STATE
;
590 else if (strTest
.Equals("audioscrobbler.submitinterval")) ret
= AUDIOSCROBBLER_SUBMIT_INT
;
591 else if (strTest
.Equals("audioscrobbler.filescached")) ret
= AUDIOSCROBBLER_FILES_CACHED
;
592 else if (strTest
.Equals("audioscrobbler.submitstate")) ret
= AUDIOSCROBBLER_SUBMIT_STATE
;
594 else if (strCategory
.Equals("lastfm"))
596 if (strTest
.Equals("lastfm.radioplaying")) ret
= LASTFM_RADIOPLAYING
;
597 else if (strTest
.Equals("lastfm.canlove")) ret
= LASTFM_CANLOVE
;
598 else if (strTest
.Equals("lastfm.canban")) ret
= LASTFM_CANBAN
;
600 else if (strCategory
.Equals("slideshow"))
601 ret
= CPictureInfoTag::TranslateString(strTest
.Mid(strCategory
.GetLength() + 1));
602 else if (strCategory
.Left(9).Equals("container"))
604 int id
= atoi(strCategory
.Mid(10, strCategory
.GetLength() - 11));
605 CStdString info
= strTest
.Mid(strCategory
.GetLength() + 1);
606 if (info
.Left(14).Equals("listitemnowrap"))
608 int offset
= atoi(info
.Mid(15, info
.GetLength() - 16));
609 ret
= TranslateListItem(info
.Mid(info
.Find(".")+1));
611 return AddMultiInfo(GUIInfo(bNegate
? -ret
: ret
, id
, offset
));
613 else if (info
.Left(16).Equals("listitemposition"))
615 int offset
= atoi(info
.Mid(17, info
.GetLength() - 18));
616 ret
= TranslateListItem(info
.Mid(info
.Find(".")+1));
618 return AddMultiInfo(GUIInfo(bNegate
? -ret
: ret
, id
, offset
, INFOFLAG_LISTITEM_POSITION
));
620 else if (info
.Left(8).Equals("listitem"))
622 int offset
= atoi(info
.Mid(9, info
.GetLength() - 10));
623 ret
= TranslateListItem(info
.Mid(info
.Find(".")+1));
625 return AddMultiInfo(GUIInfo(bNegate
? -ret
: ret
, id
, offset
, INFOFLAG_LISTITEM_WRAP
));
627 else if (info
.Equals("hasfiles")) ret
= CONTAINER_HASFILES
;
628 else if (info
.Equals("hasfolders")) ret
= CONTAINER_HASFOLDERS
;
629 else if (info
.Equals("isstacked")) ret
= CONTAINER_STACKED
;
630 else if (info
.Equals("folderthumb")) ret
= CONTAINER_FOLDERTHUMB
;
631 else if (info
.Equals("tvshowthumb")) ret
= CONTAINER_TVSHOWTHUMB
;
632 else if (info
.Equals("seasonthumb")) ret
= CONTAINER_SEASONTHUMB
;
633 else if (info
.Equals("folderpath")) ret
= CONTAINER_FOLDERPATH
;
634 else if (info
.Equals("foldername")) ret
= CONTAINER_FOLDERNAME
;
635 else if (info
.Equals("pluginname")) ret
= CONTAINER_PLUGINNAME
;
636 else if (info
.Equals("viewmode")) ret
= CONTAINER_VIEWMODE
;
637 else if (info
.Equals("onnext")) ret
= CONTAINER_MOVE_NEXT
;
638 else if (info
.Equals("onprevious")) ret
= CONTAINER_MOVE_PREVIOUS
;
639 else if (info
.Equals("onscrollnext")) ret
= CONTAINER_SCROLL_NEXT
;
640 else if (info
.Equals("onscrollprevious")) ret
= CONTAINER_SCROLL_PREVIOUS
;
641 else if (info
.Equals("totaltime")) ret
= CONTAINER_TOTALTIME
;
642 else if (info
.Equals("scrolling"))
643 return AddMultiInfo(GUIInfo(bNegate
? -CONTAINER_SCROLLING
: CONTAINER_SCROLLING
, id
, 0));
644 else if (info
.Equals("hasnext"))
645 return AddMultiInfo(GUIInfo(bNegate
? -CONTAINER_HAS_NEXT
: CONTAINER_HAS_NEXT
, id
, 0));
646 else if (info
.Equals("hasprevious"))
647 return AddMultiInfo(GUIInfo(bNegate
? -CONTAINER_HAS_PREVIOUS
: CONTAINER_HAS_PREVIOUS
, id
, 0));
648 else if (info
.Left(8).Equals("content("))
649 return AddMultiInfo(GUIInfo(bNegate
? -CONTAINER_CONTENT
: CONTAINER_CONTENT
, ConditionalStringParameter(info
.Mid(8,info
.GetLength()-9)), 0));
650 else if (info
.Left(4).Equals("row("))
651 return AddMultiInfo(GUIInfo(bNegate
? -CONTAINER_ROW
: CONTAINER_ROW
, id
, atoi(info
.Mid(4, info
.GetLength() - 5))));
652 else if (info
.Left(7).Equals("column("))
653 return AddMultiInfo(GUIInfo(bNegate
? -CONTAINER_COLUMN
: CONTAINER_COLUMN
, id
, atoi(info
.Mid(7, info
.GetLength() - 8))));
654 else if (info
.Left(8).Equals("position"))
655 return AddMultiInfo(GUIInfo(bNegate
? -CONTAINER_POSITION
: CONTAINER_POSITION
, id
, atoi(info
.Mid(9, info
.GetLength() - 10))));
656 else if (info
.Left(8).Equals("subitem("))
657 return AddMultiInfo(GUIInfo(bNegate
? -CONTAINER_SUBITEM
: CONTAINER_SUBITEM
, id
, atoi(info
.Mid(8, info
.GetLength() - 9))));
658 else if (info
.Equals("hasthumb")) ret
= CONTAINER_HAS_THUMB
;
659 else if (info
.Equals("numpages")) ret
= CONTAINER_NUM_PAGES
;
660 else if (info
.Equals("numitems")) ret
= CONTAINER_NUM_ITEMS
;
661 else if (info
.Equals("currentpage")) ret
= CONTAINER_CURRENT_PAGE
;
662 else if (info
.Equals("sortmethod")) ret
= CONTAINER_SORT_METHOD
;
663 else if (info
.Left(13).Equals("sortdirection"))
665 CStdString direction
= info
.Mid(14, info
.GetLength() - 15);
666 SORT_ORDER order
= SORT_ORDER_NONE
;
667 if (direction
== "ascending")
668 order
= SORT_ORDER_ASC
;
669 else if (direction
== "descending")
670 order
= SORT_ORDER_DESC
;
671 return AddMultiInfo(GUIInfo(bNegate
? -CONTAINER_SORT_DIRECTION
: CONTAINER_SORT_DIRECTION
, order
));
673 else if (info
.Left(5).Equals("sort("))
675 SORT_METHOD sort
= SORT_METHOD_NONE
;
676 CStdString
method(info
.Mid(5, info
.GetLength() - 6));
677 if (method
.Equals("songrating")) sort
= SORT_METHOD_SONG_RATING
;
678 if (sort
!= SORT_METHOD_NONE
)
679 return AddMultiInfo(GUIInfo(bNegate
? -CONTAINER_SORT_METHOD
: CONTAINER_SORT_METHOD
, sort
));
681 else if (id
&& info
.Left(9).Equals("hasfocus("))
683 int itemID
= atoi(info
.Mid(9, info
.GetLength() - 10));
684 return AddMultiInfo(GUIInfo(bNegate
? -CONTAINER_HAS_FOCUS
: CONTAINER_HAS_FOCUS
, id
, itemID
));
686 else if (info
.Left(9).Equals("property("))
688 int compareString
= ConditionalStringParameter(info
.Mid(9, info
.GetLength() - 10));
689 return AddMultiInfo(GUIInfo(CONTAINER_PROPERTY
, id
, compareString
));
691 else if (info
.Equals("showplot")) ret
= CONTAINER_SHOWPLOT
;
692 if (id
&& ((ret
>= CONTAINER_SCROLL_PREVIOUS
&& ret
<= CONTAINER_SCROLL_NEXT
) || ret
== CONTAINER_NUM_PAGES
||
693 ret
== CONTAINER_NUM_ITEMS
|| ret
== CONTAINER_CURRENT_PAGE
))
694 return AddMultiInfo(GUIInfo(bNegate
? -ret
: ret
, id
));
696 else if (strCategory
.Left(8).Equals("listitem"))
698 int offset
= atoi(strCategory
.Mid(9, strCategory
.GetLength() - 10));
699 ret
= TranslateListItem(strTest
.Mid(strCategory
.GetLength() + 1));
700 if (offset
|| ret
== LISTITEM_ISSELECTED
|| ret
== LISTITEM_ISPLAYING
|| ret
== LISTITEM_IS_FOLDER
)
701 return AddMultiInfo(GUIInfo(bNegate
? -ret
: ret
, 0, offset
, INFOFLAG_LISTITEM_WRAP
));
703 else if (strCategory
.Left(16).Equals("listitemposition"))
705 int offset
= atoi(strCategory
.Mid(17, strCategory
.GetLength() - 18));
706 ret
= TranslateListItem(strCategory
.Mid(strCategory
.GetLength()+1));
707 if (offset
|| ret
== LISTITEM_ISSELECTED
|| ret
== LISTITEM_ISPLAYING
|| ret
== LISTITEM_IS_FOLDER
)
708 return AddMultiInfo(GUIInfo(bNegate
? -ret
: ret
, 0, offset
, INFOFLAG_LISTITEM_POSITION
));
710 else if (strCategory
.Left(14).Equals("listitemnowrap"))
712 int offset
= atoi(strCategory
.Mid(15, strCategory
.GetLength() - 16));
713 ret
= TranslateListItem(strTest
.Mid(strCategory
.GetLength() + 1));
714 if (offset
|| ret
== LISTITEM_ISSELECTED
|| ret
== LISTITEM_ISPLAYING
|| ret
== LISTITEM_IS_FOLDER
)
715 return AddMultiInfo(GUIInfo(bNegate
? -ret
: ret
, 0, offset
));
717 else if (strCategory
.Equals("visualisation"))
719 if (strTest
.Equals("visualisation.locked")) ret
= VISUALISATION_LOCKED
;
720 else if (strTest
.Equals("visualisation.preset")) ret
= VISUALISATION_PRESET
;
721 else if (strTest
.Equals("visualisation.name")) ret
= VISUALISATION_NAME
;
722 else if (strTest
.Equals("visualisation.enabled")) ret
= VISUALISATION_ENABLED
;
724 else if (strCategory
.Equals("fanart"))
726 if (strTest
.Equals("fanart.color1")) ret
= FANART_COLOR1
;
727 else if (strTest
.Equals("fanart.color2")) ret
= FANART_COLOR2
;
728 else if (strTest
.Equals("fanart.color3")) ret
= FANART_COLOR3
;
729 else if (strTest
.Equals("fanart.image")) ret
= FANART_IMAGE
;
731 else if (strCategory
.Equals("skin"))
733 if (strTest
.Equals("skin.currenttheme"))
735 else if (strTest
.Equals("skin.currentcolourtheme"))
736 ret
= SKIN_COLOUR_THEME
;
737 else if (strTest
.Left(12).Equals("skin.string("))
739 int pos
= strTest
.Find(",");
742 int skinOffset
= g_settings
.TranslateSkinString(strTest
.Mid(12, pos
- 12));
743 int compareString
= ConditionalStringParameter(strTest
.Mid(pos
+ 1, strTest
.GetLength() - (pos
+ 2)));
744 return AddMultiInfo(GUIInfo(bNegate
? -SKIN_STRING
: SKIN_STRING
, skinOffset
, compareString
));
746 int skinOffset
= g_settings
.TranslateSkinString(strTest
.Mid(12, strTest
.GetLength() - 13));
747 return AddMultiInfo(GUIInfo(bNegate
? -SKIN_STRING
: SKIN_STRING
, skinOffset
));
749 else if (strTest
.Left(16).Equals("skin.hassetting("))
751 int skinOffset
= g_settings
.TranslateSkinBool(strTest
.Mid(16, strTest
.GetLength() - 17));
752 return AddMultiInfo(GUIInfo(bNegate
? -SKIN_BOOL
: SKIN_BOOL
, skinOffset
));
754 else if (strTest
.Left(14).Equals("skin.hastheme("))
755 ret
= SKIN_HAS_THEME_START
+ ConditionalStringParameter(strTest
.Mid(14, strTest
.GetLength() - 15));
757 else if (strCategory
.Left(6).Equals("window"))
759 CStdString info
= strTest
.Mid(strCategory
.GetLength() + 1);
760 // special case for window.xml parameter, fails above
761 if (info
.Left(5).Equals("xml)."))
762 info
= info
.Mid(5, info
.GetLength() + 1);
763 if (info
.Left(9).Equals("property("))
766 if (strTest
.Left(7).Equals("window("))
768 CStdString
window(strTest
.Mid(7, strTest
.Find(")", 7) - 7).ToLower());
769 winID
= CButtonTranslator::TranslateWindow(window
);
771 if (winID
!= WINDOW_INVALID
)
773 int compareString
= ConditionalStringParameter(info
.Mid(9, info
.GetLength() - 10));
774 return AddMultiInfo(GUIInfo(WINDOW_PROPERTY
, winID
, compareString
));
777 else if (info
.Left(9).Equals("isactive("))
779 CStdString
window(strTest
.Mid(16, strTest
.GetLength() - 17).ToLower());
780 if (window
.Find("xml") >= 0)
781 return AddMultiInfo(GUIInfo(bNegate
? -WINDOW_IS_ACTIVE
: WINDOW_IS_ACTIVE
, 0, ConditionalStringParameter(window
)));
782 int winID
= CButtonTranslator::TranslateWindow(window
);
783 if (winID
!= WINDOW_INVALID
)
784 return AddMultiInfo(GUIInfo(bNegate
? -WINDOW_IS_ACTIVE
: WINDOW_IS_ACTIVE
, winID
, 0));
786 else if (info
.Left(7).Equals("ismedia")) return WINDOW_IS_MEDIA
;
787 else if (info
.Left(10).Equals("istopmost("))
789 CStdString
window(strTest
.Mid(17, strTest
.GetLength() - 18).ToLower());
790 if (window
.Find("xml") >= 0)
791 return AddMultiInfo(GUIInfo(bNegate
? -WINDOW_IS_TOPMOST
: WINDOW_IS_TOPMOST
, 0, ConditionalStringParameter(window
)));
792 int winID
= CButtonTranslator::TranslateWindow(window
);
793 if (winID
!= WINDOW_INVALID
)
794 return AddMultiInfo(GUIInfo(bNegate
? -WINDOW_IS_TOPMOST
: WINDOW_IS_TOPMOST
, winID
, 0));
796 else if (info
.Left(10).Equals("isvisible("))
798 CStdString
window(strTest
.Mid(17, strTest
.GetLength() - 18).ToLower());
799 if (window
.Find("xml") >= 0)
800 return AddMultiInfo(GUIInfo(bNegate
? -WINDOW_IS_VISIBLE
: WINDOW_IS_VISIBLE
, 0, ConditionalStringParameter(window
)));
801 int winID
= CButtonTranslator::TranslateWindow(window
);
802 if (winID
!= WINDOW_INVALID
)
803 return AddMultiInfo(GUIInfo(bNegate
? -WINDOW_IS_VISIBLE
: WINDOW_IS_VISIBLE
, winID
, 0));
805 else if (info
.Left(9).Equals("previous("))
807 CStdString
window(strTest
.Mid(16, strTest
.GetLength() - 17).ToLower());
808 if (window
.Find("xml") >= 0)
809 return AddMultiInfo(GUIInfo(bNegate
? -WINDOW_PREVIOUS
: WINDOW_PREVIOUS
, 0, ConditionalStringParameter(window
)));
810 int winID
= CButtonTranslator::TranslateWindow(window
);
811 if (winID
!= WINDOW_INVALID
)
812 return AddMultiInfo(GUIInfo(bNegate
? -WINDOW_PREVIOUS
: WINDOW_PREVIOUS
, winID
, 0));
814 else if (info
.Left(5).Equals("next("))
816 CStdString
window(strTest
.Mid(12, strTest
.GetLength() - 13).ToLower());
817 if (window
.Find("xml") >= 0)
818 return AddMultiInfo(GUIInfo(bNegate
? -WINDOW_NEXT
: WINDOW_NEXT
, 0, ConditionalStringParameter(window
)));
819 int winID
= CButtonTranslator::TranslateWindow(window
);
820 if (winID
!= WINDOW_INVALID
)
821 return AddMultiInfo(GUIInfo(bNegate
? -WINDOW_NEXT
: WINDOW_NEXT
, winID
, 0));
824 else if (strTest
.Left(17).Equals("control.hasfocus("))
826 int controlID
= atoi(strTest
.Mid(17, strTest
.GetLength() - 18).c_str());
828 return AddMultiInfo(GUIInfo(bNegate
? -CONTROL_HAS_FOCUS
: CONTROL_HAS_FOCUS
, controlID
, 0));
830 else if (strTest
.Left(18).Equals("control.isvisible("))
832 int controlID
= atoi(strTest
.Mid(18, strTest
.GetLength() - 19).c_str());
834 return AddMultiInfo(GUIInfo(bNegate
? -CONTROL_IS_VISIBLE
: CONTROL_IS_VISIBLE
, controlID
, 0));
836 else if (strTest
.Left(18).Equals("control.isenabled("))
838 int controlID
= atoi(strTest
.Mid(18, strTest
.GetLength() - 19).c_str());
840 return AddMultiInfo(GUIInfo(bNegate
? -CONTROL_IS_ENABLED
: CONTROL_IS_ENABLED
, controlID
, 0));
842 else if (strTest
.Left(17).Equals("control.getlabel("))
844 int controlID
= atoi(strTest
.Mid(17, strTest
.GetLength() - 18).c_str());
846 return AddMultiInfo(GUIInfo(bNegate
? -CONTROL_GET_LABEL
: CONTROL_GET_LABEL
, controlID
, 0));
848 else if (strTest
.Left(13).Equals("controlgroup("))
850 int groupID
= atoi(strTest
.Mid(13).c_str());
852 int controlPos
= strTest
.Find(".hasfocus(");
854 controlID
= atoi(strTest
.Mid(controlPos
+ 10).c_str());
857 return AddMultiInfo(GUIInfo(bNegate
? -CONTROL_GROUP_HAS_FOCUS
: CONTROL_GROUP_HAS_FOCUS
, groupID
, controlID
));
860 else if (strTest
.Left(24).Equals("buttonscroller.hasfocus("))
862 int controlID
= atoi(strTest
.Mid(24, strTest
.GetLength() - 24).c_str());
864 return AddMultiInfo(GUIInfo(bNegate
? -BUTTON_SCROLLER_HAS_ICON
: BUTTON_SCROLLER_HAS_ICON
, controlID
, 0));
867 return bNegate
? -ret
: ret
;
870 int CGUIInfoManager::TranslateListItem(const CStdString
&info
)
872 if (info
.Equals("thumb")) return LISTITEM_THUMB
;
873 else if (info
.Equals("icon")) return LISTITEM_ICON
;
874 else if (info
.Equals("actualicon")) return LISTITEM_ACTUAL_ICON
;
875 else if (info
.Equals("overlay")) return LISTITEM_OVERLAY
;
876 else if (info
.Equals("label")) return LISTITEM_LABEL
;
877 else if (info
.Equals("label2")) return LISTITEM_LABEL2
;
878 else if (info
.Equals("title")) return LISTITEM_TITLE
;
879 else if (info
.Equals("tracknumber")) return LISTITEM_TRACKNUMBER
;
880 else if (info
.Equals("artist")) return LISTITEM_ARTIST
;
881 else if (info
.Equals("album")) return LISTITEM_ALBUM
;
882 else if (info
.Equals("albumartist")) return LISTITEM_ALBUM_ARTIST
;
883 else if (info
.Equals("year")) return LISTITEM_YEAR
;
884 else if (info
.Equals("genre")) return LISTITEM_GENRE
;
885 else if (info
.Equals("director")) return LISTITEM_DIRECTOR
;
886 else if (info
.Equals("filename")) return LISTITEM_FILENAME
;
887 else if (info
.Equals("filenameandpath")) return LISTITEM_FILENAME_AND_PATH
;
888 else if (info
.Equals("date")) return LISTITEM_DATE
;
889 else if (info
.Equals("size")) return LISTITEM_SIZE
;
890 else if (info
.Equals("rating")) return LISTITEM_RATING
;
891 else if (info
.Equals("ratingandvotes")) return LISTITEM_RATING_AND_VOTES
;
892 else if (info
.Equals("programcount")) return LISTITEM_PROGRAM_COUNT
;
893 else if (info
.Equals("duration")) return LISTITEM_DURATION
;
894 else if (info
.Equals("isselected")) return LISTITEM_ISSELECTED
;
895 else if (info
.Equals("isplaying")) return LISTITEM_ISPLAYING
;
896 else if (info
.Equals("plot")) return LISTITEM_PLOT
;
897 else if (info
.Equals("plotoutline")) return LISTITEM_PLOT_OUTLINE
;
898 else if (info
.Equals("episode")) return LISTITEM_EPISODE
;
899 else if (info
.Equals("season")) return LISTITEM_SEASON
;
900 else if (info
.Equals("tvshowtitle")) return LISTITEM_TVSHOW
;
901 else if (info
.Equals("premiered")) return LISTITEM_PREMIERED
;
902 else if (info
.Equals("comment")) return LISTITEM_COMMENT
;
903 else if (info
.Equals("path")) return LISTITEM_PATH
;
904 else if (info
.Equals("foldername")) return LISTITEM_FOLDERNAME
;
905 else if (info
.Equals("picturepath")) return LISTITEM_PICTURE_PATH
;
906 else if (info
.Equals("pictureresolution")) return LISTITEM_PICTURE_RESOLUTION
;
907 else if (info
.Equals("picturedatetime")) return LISTITEM_PICTURE_DATETIME
;
908 else if (info
.Equals("studio")) return LISTITEM_STUDIO
;
909 else if (info
.Equals("country")) return LISTITEM_COUNTRY
;
910 else if (info
.Equals("mpaa")) return LISTITEM_MPAA
;
911 else if (info
.Equals("cast")) return LISTITEM_CAST
;
912 else if (info
.Equals("castandrole")) return LISTITEM_CAST_AND_ROLE
;
913 else if (info
.Equals("writer")) return LISTITEM_WRITER
;
914 else if (info
.Equals("tagline")) return LISTITEM_TAGLINE
;
915 else if (info
.Equals("top250")) return LISTITEM_TOP250
;
916 else if (info
.Equals("trailer")) return LISTITEM_TRAILER
;
917 else if (info
.Equals("starrating")) return LISTITEM_STAR_RATING
;
918 else if (info
.Equals("sortletter")) return LISTITEM_SORT_LETTER
;
919 else if (info
.Equals("videocodec")) return LISTITEM_VIDEO_CODEC
;
920 else if (info
.Equals("videoresolution")) return LISTITEM_VIDEO_RESOLUTION
;
921 else if (info
.Equals("videoaspect")) return LISTITEM_VIDEO_ASPECT
;
922 else if (info
.Equals("audiocodec")) return LISTITEM_AUDIO_CODEC
;
923 else if (info
.Equals("audiochannels")) return LISTITEM_AUDIO_CHANNELS
;
924 else if (info
.Equals("audiolanguage")) return LISTITEM_AUDIO_LANGUAGE
;
925 else if (info
.Equals("subtitlelanguage")) return LISTITEM_SUBTITLE_LANGUAGE
;
926 else if (info
.Equals("isfolder")) return LISTITEM_IS_FOLDER
;
927 else if (info
.Equals("originaltitle")) return LISTITEM_ORIGINALTITLE
;
928 else if (info
.Left(9).Equals("property(")) return AddListItemProp(info
.Mid(9, info
.GetLength() - 10));
932 int CGUIInfoManager::TranslateMusicPlayerString(const CStdString
&info
) const
934 if (info
.Equals("title")) return MUSICPLAYER_TITLE
;
935 else if (info
.Equals("album")) return MUSICPLAYER_ALBUM
;
936 else if (info
.Equals("artist")) return MUSICPLAYER_ARTIST
;
937 else if (info
.Equals("albumartist")) return MUSICPLAYER_ALBUM_ARTIST
;
938 else if (info
.Equals("year")) return MUSICPLAYER_YEAR
;
939 else if (info
.Equals("genre")) return MUSICPLAYER_GENRE
;
940 else if (info
.Equals("duration")) return MUSICPLAYER_DURATION
;
941 else if (info
.Equals("tracknumber")) return MUSICPLAYER_TRACK_NUMBER
;
942 else if (info
.Equals("cover")) return MUSICPLAYER_COVER
;
943 else if (info
.Equals("bitrate")) return MUSICPLAYER_BITRATE
;
944 else if (info
.Equals("playlistlength")) return MUSICPLAYER_PLAYLISTLEN
;
945 else if (info
.Equals("playlistposition")) return MUSICPLAYER_PLAYLISTPOS
;
946 else if (info
.Equals("channels")) return MUSICPLAYER_CHANNELS
;
947 else if (info
.Equals("bitspersample")) return MUSICPLAYER_BITSPERSAMPLE
;
948 else if (info
.Equals("samplerate")) return MUSICPLAYER_SAMPLERATE
;
949 else if (info
.Equals("codec")) return MUSICPLAYER_CODEC
;
950 else if (info
.Equals("discnumber")) return MUSICPLAYER_DISC_NUMBER
;
951 else if (info
.Equals("rating")) return MUSICPLAYER_RATING
;
952 else if (info
.Equals("comment")) return MUSICPLAYER_COMMENT
;
953 else if (info
.Equals("lyrics")) return MUSICPLAYER_LYRICS
;
954 else if (info
.Equals("playlistplaying")) return MUSICPLAYER_PLAYLISTPLAYING
;
955 else if (info
.Equals("exists")) return MUSICPLAYER_EXISTS
;
956 else if (info
.Equals("hasprevious")) return MUSICPLAYER_HASPREVIOUS
;
957 else if (info
.Equals("hasnext")) return MUSICPLAYER_HASNEXT
;
961 TIME_FORMAT
CGUIInfoManager::TranslateTimeFormat(const CStdString
&format
)
963 if (format
.IsEmpty()) return TIME_FORMAT_GUESS
;
964 else if (format
.Equals("(hh)")) return TIME_FORMAT_HH
;
965 else if (format
.Equals("(mm)")) return TIME_FORMAT_MM
;
966 else if (format
.Equals("(ss)")) return TIME_FORMAT_SS
;
967 else if (format
.Equals("(hh:mm)")) return TIME_FORMAT_HH_MM
;
968 else if (format
.Equals("(mm:ss)")) return TIME_FORMAT_MM_SS
;
969 else if (format
.Equals("(hh:mm:ss)")) return TIME_FORMAT_HH_MM_SS
;
970 return TIME_FORMAT_GUESS
;
973 CStdString
CGUIInfoManager::GetLabel(int info
, int contextWindow
)
976 if (info
>= MULTI_INFO_START
&& info
<= MULTI_INFO_END
)
977 return GetMultiInfoLabel(m_multiInfo
[info
- MULTI_INFO_START
], contextWindow
);
979 if (info
>= SLIDE_INFO_START
&& info
<= SLIDE_INFO_END
)
980 return GetPictureLabel(info
);
982 if (info
>= LISTITEM_PROPERTY_START
+MUSICPLAYER_PROPERTY_OFFSET
&&
983 info
- (LISTITEM_PROPERTY_START
+MUSICPLAYER_PROPERTY_OFFSET
) < (int)m_listitemProperties
.size())
984 { // grab the property
988 CStdString property
= m_listitemProperties
[info
- LISTITEM_PROPERTY_START
-MUSICPLAYER_PROPERTY_OFFSET
];
989 return m_currentFile
->GetProperty(property
);
992 if (info
>= LISTITEM_START
&& info
<= LISTITEM_END
)
994 CGUIWindow
*window
= GetWindowWithCondition(contextWindow
, WINDOW_CONDITION_HAS_LIST_ITEMS
); // true for has list items
997 CFileItemPtr item
= window
->GetCurrentListItem();
998 strLabel
= GetItemLabel(item
.get(), info
);
1006 case WEATHER_CONDITIONS
:
1007 strLabel
= g_weatherManager
.GetInfo(WEATHER_LABEL_CURRENT_COND
);
1008 strLabel
= strLabel
.Trim();
1010 case WEATHER_TEMPERATURE
:
1011 strLabel
.Format("%s%s", g_weatherManager
.GetInfo(WEATHER_LABEL_CURRENT_TEMP
), g_langInfo
.GetTempUnitString().c_str());
1013 case WEATHER_LOCATION
:
1014 strLabel
= g_weatherManager
.GetInfo(WEATHER_LABEL_LOCATION
);
1016 case WEATHER_FANART_CODE
:
1017 strLabel
= CUtil::GetFileName(g_weatherManager
.GetInfo(WEATHER_IMAGE_CURRENT_ICON
));
1018 CUtil::RemoveExtension(strLabel
);
1020 case WEATHER_PLUGIN
:
1021 strLabel
= g_guiSettings
.GetString("weather.script");
1024 strLabel
= GetDate();
1027 strLabel
= GetDate(true);
1030 strLabel
.Format("%02.2f", m_fps
);
1033 strLabel
.Format("%2.1f dB", (float)(g_settings
.m_nVolumeLevel
+ g_settings
.m_dynamicRangeCompressionLevel
) * 0.01f
);
1035 case PLAYER_SUBTITLE_DELAY
:
1036 strLabel
.Format("%2.3f s", g_settings
.m_currentVideoSettings
.m_SubtitleDelay
);
1038 case PLAYER_AUDIO_DELAY
:
1039 strLabel
.Format("%2.3f s", g_settings
.m_currentVideoSettings
.m_AudioDelay
);
1041 case PLAYER_CHAPTER
:
1042 if(g_application
.IsPlaying() && g_application
.m_pPlayer
)
1043 strLabel
.Format("%02d", g_application
.m_pPlayer
->GetChapter());
1045 case PLAYER_CHAPTERCOUNT
:
1046 if(g_application
.IsPlaying() && g_application
.m_pPlayer
)
1047 strLabel
.Format("%02d", g_application
.m_pPlayer
->GetChapterCount());
1049 case PLAYER_CHAPTERNAME
:
1050 if(g_application
.IsPlaying() && g_application
.m_pPlayer
)
1051 g_application
.m_pPlayer
->GetChapterName(strLabel
);
1053 case PLAYER_CACHELEVEL
:
1056 if(g_application
.IsPlaying() && ((iLevel
= GetInt(PLAYER_CACHELEVEL
)) >= 0))
1057 strLabel
.Format("%i", iLevel
);
1061 if(g_application
.IsPlaying() && g_application
.m_pPlayer
)
1062 strLabel
= GetCurrentPlayTime(TIME_FORMAT_HH_MM
);
1064 case PLAYER_DURATION
:
1065 if(g_application
.IsPlaying() && g_application
.m_pPlayer
)
1066 strLabel
= GetDuration(TIME_FORMAT_HH_MM
);
1069 case PLAYER_FILEPATH
:
1072 if (m_currentFile
->HasMusicInfoTag())
1073 strLabel
= m_currentFile
->GetMusicInfoTag()->GetURL();
1074 else if (m_currentFile
->HasVideoInfoTag())
1075 strLabel
= m_currentFile
->GetVideoInfoTag()->m_strFileNameAndPath
;
1076 if (strLabel
.IsEmpty())
1077 strLabel
= m_currentFile
->m_strPath
;
1079 if (info
== PLAYER_PATH
)
1081 // do this twice since we want the path outside the archive if this
1083 if (CUtil::IsInArchive(strLabel
))
1084 strLabel
= CUtil::GetParentPath(strLabel
);
1085 strLabel
= CUtil::GetParentPath(strLabel
);
1088 case MUSICPLAYER_TITLE
:
1089 case MUSICPLAYER_ALBUM
:
1090 case MUSICPLAYER_ARTIST
:
1091 case MUSICPLAYER_ALBUM_ARTIST
:
1092 case MUSICPLAYER_GENRE
:
1093 case MUSICPLAYER_YEAR
:
1094 case MUSICPLAYER_TRACK_NUMBER
:
1095 case MUSICPLAYER_BITRATE
:
1096 case MUSICPLAYER_PLAYLISTLEN
:
1097 case MUSICPLAYER_PLAYLISTPOS
:
1098 case MUSICPLAYER_CHANNELS
:
1099 case MUSICPLAYER_BITSPERSAMPLE
:
1100 case MUSICPLAYER_SAMPLERATE
:
1101 case MUSICPLAYER_CODEC
:
1102 case MUSICPLAYER_DISC_NUMBER
:
1103 case MUSICPLAYER_RATING
:
1104 case MUSICPLAYER_COMMENT
:
1105 case MUSICPLAYER_LYRICS
:
1106 strLabel
= GetMusicLabel(info
);
1108 case VIDEOPLAYER_TITLE
:
1109 case VIDEOPLAYER_ORIGINALTITLE
:
1110 case VIDEOPLAYER_GENRE
:
1111 case VIDEOPLAYER_DIRECTOR
:
1112 case VIDEOPLAYER_YEAR
:
1113 case VIDEOPLAYER_PLAYLISTLEN
:
1114 case VIDEOPLAYER_PLAYLISTPOS
:
1115 case VIDEOPLAYER_PLOT
:
1116 case VIDEOPLAYER_PLOT_OUTLINE
:
1117 case VIDEOPLAYER_EPISODE
:
1118 case VIDEOPLAYER_SEASON
:
1119 case VIDEOPLAYER_RATING
:
1120 case VIDEOPLAYER_RATING_AND_VOTES
:
1121 case VIDEOPLAYER_TVSHOW
:
1122 case VIDEOPLAYER_PREMIERED
:
1123 case VIDEOPLAYER_STUDIO
:
1124 case VIDEOPLAYER_COUNTRY
:
1125 case VIDEOPLAYER_MPAA
:
1126 case VIDEOPLAYER_TOP250
:
1127 case VIDEOPLAYER_CAST
:
1128 case VIDEOPLAYER_CAST_AND_ROLE
:
1129 case VIDEOPLAYER_ARTIST
:
1130 case VIDEOPLAYER_ALBUM
:
1131 case VIDEOPLAYER_WRITER
:
1132 case VIDEOPLAYER_TAGLINE
:
1133 case VIDEOPLAYER_TRAILER
:
1134 strLabel
= GetVideoLabel(info
);
1136 case VIDEOPLAYER_VIDEO_CODEC
:
1137 if(g_application
.IsPlaying() && g_application
.m_pPlayer
)
1138 strLabel
= g_application
.m_pPlayer
->GetVideoCodecName();
1140 case VIDEOPLAYER_VIDEO_RESOLUTION
:
1141 if(g_application
.IsPlaying() && g_application
.m_pPlayer
)
1142 return CStreamDetails::VideoDimsToResolutionDescription(g_application
.m_pPlayer
->GetPictureWidth(), g_application
.m_pPlayer
->GetPictureHeight());
1144 case VIDEOPLAYER_AUDIO_CODEC
:
1145 if(g_application
.IsPlaying() && g_application
.m_pPlayer
)
1146 strLabel
= g_application
.m_pPlayer
->GetAudioCodecName();
1148 case VIDEOPLAYER_VIDEO_ASPECT
:
1149 if (g_application
.IsPlaying() && g_application
.m_pPlayer
)
1152 g_application
.m_pPlayer
->GetVideoAspectRatio(aspect
);
1153 strLabel
= CStreamDetails::VideoAspectToAspectDescription(aspect
);
1156 case VIDEOPLAYER_AUDIO_CHANNELS
:
1157 if(g_application
.IsPlaying() && g_application
.m_pPlayer
)
1158 strLabel
.Format("%i", g_application
.m_pPlayer
->GetChannels());
1160 case PLAYLIST_LENGTH
:
1161 case PLAYLIST_POSITION
:
1162 case PLAYLIST_RANDOM
:
1163 case PLAYLIST_REPEAT
:
1164 strLabel
= GetPlaylistLabel(info
);
1166 case MUSICPM_SONGSPLAYED
:
1167 case MUSICPM_MATCHINGSONGS
:
1168 case MUSICPM_MATCHINGSONGSPICKED
:
1169 case MUSICPM_MATCHINGSONGSLEFT
:
1170 case MUSICPM_RELAXEDSONGSPICKED
:
1171 case MUSICPM_RANDOMSONGSPICKED
:
1172 strLabel
= GetMusicPartyModeLabel(info
);
1175 case SYSTEM_FREE_SPACE
:
1176 case SYSTEM_FREE_SPACE_C
:
1177 case SYSTEM_FREE_SPACE_E
:
1178 case SYSTEM_FREE_SPACE_F
:
1179 case SYSTEM_FREE_SPACE_G
:
1180 case SYSTEM_USED_SPACE
:
1181 case SYSTEM_USED_SPACE_C
:
1182 case SYSTEM_USED_SPACE_E
:
1183 case SYSTEM_USED_SPACE_F
:
1184 case SYSTEM_USED_SPACE_G
:
1185 case SYSTEM_TOTAL_SPACE
:
1186 case SYSTEM_TOTAL_SPACE_C
:
1187 case SYSTEM_TOTAL_SPACE_E
:
1188 case SYSTEM_TOTAL_SPACE_F
:
1189 case SYSTEM_TOTAL_SPACE_G
:
1190 case SYSTEM_FREE_SPACE_PERCENT
:
1191 case SYSTEM_FREE_SPACE_PERCENT_C
:
1192 case SYSTEM_FREE_SPACE_PERCENT_E
:
1193 case SYSTEM_FREE_SPACE_PERCENT_F
:
1194 case SYSTEM_FREE_SPACE_PERCENT_G
:
1195 case SYSTEM_USED_SPACE_PERCENT
:
1196 case SYSTEM_USED_SPACE_PERCENT_C
:
1197 case SYSTEM_USED_SPACE_PERCENT_E
:
1198 case SYSTEM_USED_SPACE_PERCENT_F
:
1199 case SYSTEM_USED_SPACE_PERCENT_G
:
1200 case SYSTEM_USED_SPACE_X
:
1201 case SYSTEM_FREE_SPACE_X
:
1202 case SYSTEM_TOTAL_SPACE_X
:
1203 case SYSTEM_USED_SPACE_Y
:
1204 case SYSTEM_FREE_SPACE_Y
:
1205 case SYSTEM_TOTAL_SPACE_Y
:
1206 case SYSTEM_USED_SPACE_Z
:
1207 case SYSTEM_FREE_SPACE_Z
:
1208 case SYSTEM_TOTAL_SPACE_Z
:
1209 return g_sysinfo
.GetHddSpaceInfo(info
);
1212 case LCD_FREE_SPACE_C
:
1213 case LCD_FREE_SPACE_E
:
1214 case LCD_FREE_SPACE_F
:
1215 case LCD_FREE_SPACE_G
:
1216 return g_sysinfo
.GetHddSpaceInfo(info
, true);
1219 case SYSTEM_CPU_TEMPERATURE
:
1220 case SYSTEM_GPU_TEMPERATURE
:
1221 case SYSTEM_FAN_SPEED
:
1222 case LCD_CPU_TEMPERATURE
:
1223 case LCD_GPU_TEMPERATURE
:
1225 case SYSTEM_CPU_USAGE
:
1226 return GetSystemHeatInfo(info
);
1229 case SYSTEM_VIDEO_ENCODER_INFO
:
1230 case NETWORK_MAC_ADDRESS
:
1231 case SYSTEM_KERNEL_VERSION
:
1232 case SYSTEM_CPUFREQUENCY
:
1233 case SYSTEM_INTERNET_STATE
:
1235 case SYSTEM_TOTALUPTIME
:
1236 return g_sysinfo
.GetInfo(info
);
1239 case SYSTEM_SCREEN_RESOLUTION
:
1240 if (g_settings
.m_ResInfo
[g_guiSettings
.m_LookAndFeelResolution
].bFullScreen
)
1241 strLabel
.Format("%ix%i@%.2fHz - %s (%02.2fHz)",
1242 g_settings
.m_ResInfo
[g_guiSettings
.m_LookAndFeelResolution
].iWidth
,
1243 g_settings
.m_ResInfo
[g_guiSettings
.m_LookAndFeelResolution
].iHeight
,
1244 g_settings
.m_ResInfo
[g_guiSettings
.m_LookAndFeelResolution
].fRefreshRate
,
1245 g_localizeStrings
.Get(244), GetFPS());
1247 strLabel
.Format("%ix%i - %s (%02.2fHz)",
1248 g_settings
.m_ResInfo
[g_guiSettings
.m_LookAndFeelResolution
].iWidth
,
1249 g_settings
.m_ResInfo
[g_guiSettings
.m_LookAndFeelResolution
].iHeight
,
1250 g_localizeStrings
.Get(242), GetFPS());
1254 case CONTAINER_FOLDERPATH
:
1255 case CONTAINER_FOLDERNAME
:
1257 CGUIWindow
*window
= GetWindowWithCondition(contextWindow
, WINDOW_CONDITION_IS_MEDIA_WINDOW
);
1260 strLabel
= CURL(((CGUIMediaWindow
*)window
)->CurrentDirectory().m_strPath
).GetWithoutUserDetails();
1261 if (info
==CONTAINER_FOLDERNAME
)
1263 CUtil::RemoveSlashAtEnd(strLabel
);
1264 strLabel
=CUtil::GetFileName(strLabel
);
1269 case CONTAINER_PLUGINNAME
:
1271 CGUIWindow
*window
= GetWindowWithCondition(contextWindow
, WINDOW_CONDITION_IS_MEDIA_WINDOW
);
1274 CURL
url(((CGUIMediaWindow
*)window
)->CurrentDirectory().m_strPath
);
1275 if (url
.GetProtocol().Equals("plugin"))
1277 strLabel
= url
.GetFileName();
1278 CUtil::RemoveSlashAtEnd(strLabel
);
1283 case CONTAINER_VIEWMODE
:
1285 CGUIWindow
*window
= GetWindowWithCondition(contextWindow
, WINDOW_CONDITION_IS_MEDIA_WINDOW
);
1288 const CGUIControl
*control
= window
->GetControl(window
->GetViewContainerID());
1289 if (control
&& control
->IsContainer())
1290 strLabel
= ((CGUIBaseContainer
*)control
)->GetLabel();
1294 case CONTAINER_SORT_METHOD
:
1296 CGUIWindow
*window
= GetWindowWithCondition(contextWindow
, WINDOW_CONDITION_IS_MEDIA_WINDOW
);
1299 const CGUIViewState
*viewState
= ((CGUIMediaWindow
*)window
)->GetViewState();
1301 strLabel
= g_localizeStrings
.Get(viewState
->GetSortMethodLabel());
1305 case CONTAINER_NUM_PAGES
:
1306 case CONTAINER_NUM_ITEMS
:
1307 case CONTAINER_CURRENT_PAGE
:
1308 return GetMultiInfoLabel(GUIInfo(info
), contextWindow
);
1310 case CONTAINER_SHOWPLOT
:
1312 CGUIWindow
*window
= GetWindowWithCondition(contextWindow
, WINDOW_CONDITION_IS_MEDIA_WINDOW
);
1314 return ((CGUIMediaWindow
*)window
)->CurrentDirectory().GetProperty("showplot");
1317 case CONTAINER_TOTALTIME
:
1319 CGUIWindow
*window
= GetWindowWithCondition(contextWindow
, WINDOW_CONDITION_IS_MEDIA_WINDOW
);
1322 const CFileItemList
& items
=((CGUIMediaWindow
*)window
)->CurrentDirectory();
1324 for (int i
=0;i
<items
.Size();++i
)
1326 CFileItemPtr item
=items
.Get(i
);
1327 if (item
->HasMusicInfoTag())
1328 duration
+= item
->GetMusicInfoTag()->GetDuration();
1329 else if (item
->HasVideoInfoTag())
1330 duration
+= item
->GetVideoInfoTag()->m_streamDetails
.GetVideoDuration();
1333 return StringUtils::SecondsToTimeString(duration
);
1337 case SYSTEM_BUILD_VERSION
:
1338 strLabel
= GetVersion();
1340 case SYSTEM_BUILD_DATE
:
1341 strLabel
= GetBuild();
1343 case SYSTEM_FREE_MEMORY
:
1344 case SYSTEM_FREE_MEMORY_PERCENT
:
1345 case SYSTEM_USED_MEMORY
:
1346 case SYSTEM_USED_MEMORY_PERCENT
:
1347 case SYSTEM_TOTAL_MEMORY
:
1350 GlobalMemoryStatus(&stat
);
1351 int iMemPercentFree
= 100 - ((int)( 100.0f
* (stat
.dwTotalPhys
- stat
.dwAvailPhys
)/stat
.dwTotalPhys
+ 0.5f
));
1352 int iMemPercentUsed
= 100 - iMemPercentFree
;
1354 if (info
== SYSTEM_FREE_MEMORY
)
1355 strLabel
.Format("%luMB", (ULONG
)(stat
.dwAvailPhys
/MB
));
1356 else if (info
== SYSTEM_FREE_MEMORY_PERCENT
)
1357 strLabel
.Format("%i%%", iMemPercentFree
);
1358 else if (info
== SYSTEM_USED_MEMORY
)
1359 strLabel
.Format("%luMB", (ULONG
)((stat
.dwTotalPhys
- stat
.dwAvailPhys
)/MB
));
1360 else if (info
== SYSTEM_USED_MEMORY_PERCENT
)
1361 strLabel
.Format("%i%%", iMemPercentUsed
);
1362 else if (info
== SYSTEM_TOTAL_MEMORY
)
1363 strLabel
.Format("%luMB", (ULONG
)(stat
.dwTotalPhys
/MB
));
1366 case SYSTEM_SCREEN_MODE
:
1367 strLabel
= g_settings
.m_ResInfo
[g_graphicsContext
.GetVideoResolution()].strMode
;
1369 case SYSTEM_SCREEN_WIDTH
:
1370 strLabel
.Format("%i", g_settings
.m_ResInfo
[g_graphicsContext
.GetVideoResolution()].iWidth
);
1372 case SYSTEM_SCREEN_HEIGHT
:
1373 strLabel
.Format("%i", g_settings
.m_ResInfo
[g_graphicsContext
.GetVideoResolution()].iHeight
);
1375 case SYSTEM_CURRENT_WINDOW
:
1376 return g_localizeStrings
.Get(g_windowManager
.GetFocusedWindow());
1378 case SYSTEM_CURRENT_CONTROL
:
1380 CGUIWindow
*window
= g_windowManager
.GetWindow(g_windowManager
.GetFocusedWindow());
1383 CGUIControl
*control
= window
->GetFocusedControl();
1385 strLabel
= control
->GetDescription();
1389 #ifdef HAS_DVD_DRIVE
1390 case SYSTEM_DVD_LABEL
:
1391 strLabel
= g_mediaManager
.GetDiskLabel();
1394 case SYSTEM_ALARM_POS
:
1395 if (g_alarmClock
.GetRemaining("shutdowntimer") == 0.f
)
1399 double fTime
= g_alarmClock
.GetRemaining("shutdowntimer");
1401 strLabel
.Format(g_localizeStrings
.Get(13213).c_str(),g_alarmClock
.GetRemaining("shutdowntimer")/60.f
);
1403 strLabel
.Format(g_localizeStrings
.Get(13214).c_str(),g_alarmClock
.GetRemaining("shutdowntimer"));
1406 case SYSTEM_PROFILENAME
:
1407 strLabel
= g_settings
.GetCurrentProfile().getName();
1409 case SYSTEM_LANGUAGE
:
1410 strLabel
= g_guiSettings
.GetString("locale.language");
1412 case SYSTEM_TEMPERATURE_UNITS
:
1413 strLabel
= g_langInfo
.GetTempUnitString();
1415 case SYSTEM_PROGRESS_BAR
:
1417 int percent
= GetInt(SYSTEM_PROGRESS_BAR
);
1419 strLabel
.Format("%i", percent
);
1424 int iPlaySpeed
= g_application
.GetPlaySpeed();
1425 if (g_application
.IsPaused())
1426 strLabel
.Format("\7");
1427 else if (iPlaySpeed
< 1)
1428 strLabel
.Format("\3:%ix", iPlaySpeed
);
1429 else if (iPlaySpeed
> 1)
1430 strLabel
.Format("\4:%ix", iPlaySpeed
);
1432 strLabel
.Format("\5");
1444 //alternatively, set strLabel
1445 return GetLcdTime( info
);
1449 if (g_guiSettings
.GetString("lookandfeel.skintheme").Equals("skindefault"))
1450 strLabel
= g_localizeStrings
.Get(15109);
1452 strLabel
= g_guiSettings
.GetString("lookandfeel.skintheme");
1454 case SKIN_COLOUR_THEME
:
1455 if (g_guiSettings
.GetString("lookandfeel.skincolors").Equals("skindefault"))
1456 strLabel
= g_localizeStrings
.Get(15109);
1458 strLabel
= g_guiSettings
.GetString("lookandfeel.skincolors");
1461 case LCD_PROGRESS_BAR
:
1462 if (g_lcd
) strLabel
= g_lcd
->GetProgressBar(g_application
.GetTime(), g_application
.GetTotalTime());
1465 case NETWORK_IP_ADDRESS
:
1467 CNetworkInterface
* iface
= g_application
.getNetwork().GetFirstConnectedInterface();
1469 return iface
->GetCurrentIPAddress();
1472 case NETWORK_SUBNET_ADDRESS
:
1474 CNetworkInterface
* iface
= g_application
.getNetwork().GetFirstConnectedInterface();
1476 return iface
->GetCurrentNetmask();
1479 case NETWORK_GATEWAY_ADDRESS
:
1481 CNetworkInterface
* iface
= g_application
.getNetwork().GetFirstConnectedInterface();
1483 return iface
->GetCurrentDefaultGateway();
1486 case NETWORK_DNS1_ADDRESS
:
1488 vector
<CStdString
> nss
= g_application
.getNetwork().GetNameServers();
1489 if (nss
.size() >= 1)
1493 case NETWORK_DNS2_ADDRESS
:
1495 vector
<CStdString
> nss
= g_application
.getNetwork().GetNameServers();
1496 if (nss
.size() >= 2)
1500 case NETWORK_DHCP_ADDRESS
:
1502 CStdString dhcpserver
;
1506 case NETWORK_LINK_STATE
:
1508 CStdString linkStatus
= g_localizeStrings
.Get(151);
1510 CNetworkInterface
* iface
= g_application
.getNetwork().GetFirstConnectedInterface();
1511 if (iface
&& iface
->IsConnected())
1512 linkStatus
+= g_localizeStrings
.Get(15207);
1514 linkStatus
+= g_localizeStrings
.Get(15208);
1519 case AUDIOSCROBBLER_CONN_STATE
:
1520 case AUDIOSCROBBLER_SUBMIT_INT
:
1521 case AUDIOSCROBBLER_FILES_CACHED
:
1522 case AUDIOSCROBBLER_SUBMIT_STATE
:
1523 strLabel
=GetAudioScrobblerLabel(info
);
1525 case VISUALISATION_PRESET
:
1527 CGUIMessage
msg(GUI_MSG_GET_VISUALISATION
, 0, 0);
1528 g_windowManager
.SendMessage(msg
);
1529 if (msg
.GetPointer())
1531 CVisualisation
* viz
= NULL
;
1532 viz
= (CVisualisation
*)msg
.GetPointer();
1535 strLabel
= viz
->GetPresetName();
1536 CUtil::RemoveExtension(strLabel
);
1541 case VISUALISATION_NAME
:
1544 strLabel
= g_guiSettings
.GetString("musicplayer.visualisation");
1545 if (CAddonMgr::Get().GetAddon(strLabel
,addon
) && addon
)
1546 strLabel
= addon
->Name();
1551 CGUIWindow
*window
= GetWindowWithCondition(contextWindow
, WINDOW_CONDITION_IS_MEDIA_WINDOW
);
1553 return ((CGUIMediaWindow
*)window
)->CurrentDirectory().GetProperty("fanart_color1");
1558 CGUIWindow
*window
= GetWindowWithCondition(contextWindow
, WINDOW_CONDITION_IS_MEDIA_WINDOW
);
1560 return ((CGUIMediaWindow
*)window
)->CurrentDirectory().GetProperty("fanart_color2");
1565 CGUIWindow
*window
= GetWindowWithCondition(contextWindow
, WINDOW_CONDITION_IS_MEDIA_WINDOW
);
1567 return ((CGUIMediaWindow
*)window
)->CurrentDirectory().GetProperty("fanart_color3");
1572 CGUIWindow
*window
= GetWindowWithCondition(contextWindow
, WINDOW_CONDITION_IS_MEDIA_WINDOW
);
1574 return ((CGUIMediaWindow
*)window
)->CurrentDirectory().GetProperty("fanart_image");
1577 case SYSTEM_RENDER_VENDOR
:
1578 strLabel
= g_Windowing
.GetRenderVendor();
1580 case SYSTEM_RENDER_RENDERER
:
1581 strLabel
= g_Windowing
.GetRenderRenderer();
1583 case SYSTEM_RENDER_VERSION
:
1584 strLabel
= g_Windowing
.GetRenderVersionString();
1591 // tries to get a integer value for use in progressbars/sliders and such
1592 int CGUIInfoManager::GetInt(int info
, int contextWindow
) const
1597 return g_application
.GetVolume();
1598 case PLAYER_SUBTITLE_DELAY
:
1599 return g_application
.GetSubtitleDelay();
1600 case PLAYER_AUDIO_DELAY
:
1601 return g_application
.GetAudioDelay();
1602 case PLAYER_PROGRESS
:
1603 case PLAYER_SEEKBAR
:
1604 case PLAYER_CACHELEVEL
:
1605 case PLAYER_CHAPTER
:
1606 case PLAYER_CHAPTERCOUNT
:
1608 if( g_application
.IsPlaying() && g_application
.m_pPlayer
)
1612 case PLAYER_PROGRESS
:
1613 return (int)(g_application
.GetPercentage());
1614 case PLAYER_SEEKBAR
:
1616 CGUIDialogSeekBar
*seekBar
= (CGUIDialogSeekBar
*)g_windowManager
.GetWindow(WINDOW_DIALOG_SEEK_BAR
);
1617 return seekBar
? (int)seekBar
->GetPercentage() : 0;
1619 case PLAYER_CACHELEVEL
:
1620 return (int)(g_application
.m_pPlayer
->GetCacheLevel());
1621 case PLAYER_CHAPTER
:
1622 return g_application
.m_pPlayer
->GetChapter();
1623 case PLAYER_CHAPTERCOUNT
:
1624 return g_application
.m_pPlayer
->GetChapterCount();
1629 case SYSTEM_FREE_MEMORY
:
1630 case SYSTEM_USED_MEMORY
:
1633 GlobalMemoryStatus(&stat
);
1634 int memPercentUsed
= (int)( 100.0f
* (stat
.dwTotalPhys
- stat
.dwAvailPhys
)/stat
.dwTotalPhys
+ 0.5f
);
1635 if (info
== SYSTEM_FREE_MEMORY
)
1636 return 100 - memPercentUsed
;
1637 return memPercentUsed
;
1639 case SYSTEM_PROGRESS_BAR
:
1641 CGUIDialogProgress
*bar
= (CGUIDialogProgress
*)g_windowManager
.GetWindow(WINDOW_DIALOG_PROGRESS
);
1642 if (bar
&& bar
->IsDialogRunning())
1643 return bar
->GetPercentage();
1645 case SYSTEM_FREE_SPACE
:
1646 case SYSTEM_FREE_SPACE_C
:
1647 case SYSTEM_FREE_SPACE_E
:
1648 case SYSTEM_FREE_SPACE_F
:
1649 case SYSTEM_FREE_SPACE_G
:
1650 case SYSTEM_USED_SPACE
:
1651 case SYSTEM_USED_SPACE_C
:
1652 case SYSTEM_USED_SPACE_E
:
1653 case SYSTEM_USED_SPACE_F
:
1654 case SYSTEM_USED_SPACE_G
:
1655 case SYSTEM_FREE_SPACE_X
:
1656 case SYSTEM_USED_SPACE_X
:
1657 case SYSTEM_FREE_SPACE_Y
:
1658 case SYSTEM_USED_SPACE_Y
:
1659 case SYSTEM_FREE_SPACE_Z
:
1660 case SYSTEM_USED_SPACE_Z
:
1663 g_sysinfo
.GetHddSpaceInfo(ret
, info
, true);
1666 case SYSTEM_CPU_USAGE
:
1667 return g_cpuInfo
.getUsedPercentage();
1671 // checks the condition and returns it as necessary. Currently used
1672 // for toggle button controls and visibility of images.
1673 bool CGUIInfoManager::GetBool(int condition1
, int contextWindow
, const CGUIListItem
*item
)
1676 bool bReturn
= false;
1677 if (!item
&& IsCached(condition1
, contextWindow
, bReturn
)) // never use cache for list items
1680 int condition
= abs(condition1
);
1682 if(condition
>= COMBINED_VALUES_START
&& (condition
- COMBINED_VALUES_START
) < (int)(m_CombinedValues
.size()) )
1684 const CCombinedValue
&comb
= m_CombinedValues
[condition
- COMBINED_VALUES_START
];
1685 if (!EvaluateBooleanExpression(comb
, bReturn
, contextWindow
, item
))
1688 else if (item
&& condition
>= LISTITEM_START
&& condition
< LISTITEM_END
)
1689 bReturn
= GetItemBool(item
, condition
);
1690 // Ethernet Link state checking
1691 // Will check if the Xbox has a Ethernet Link connection! [Cable in!]
1692 // This can used for the skinner to switch off Network or Inter required functions
1693 else if ( condition
== SYSTEM_ALWAYS_TRUE
)
1695 else if (condition
== SYSTEM_ALWAYS_FALSE
)
1697 else if (condition
== SYSTEM_ETHERNET_LINK_ACTIVE
)
1699 else if (condition
> SYSTEM_IDLE_TIME_START
&& condition
<= SYSTEM_IDLE_TIME_FINISH
)
1700 bReturn
= (g_application
.GlobalIdleTime() >= condition
- SYSTEM_IDLE_TIME_START
);
1701 else if (condition
== WINDOW_IS_MEDIA
)
1702 { // note: This doesn't return true for dialogs (content, favourites, login, videoinfo)
1703 CGUIWindow
*pWindow
= g_windowManager
.GetWindow(g_windowManager
.GetActiveWindow());
1704 bReturn
= (pWindow
&& pWindow
->IsMediaWindow());
1706 else if (condition
== PLAYER_MUTED
)
1707 bReturn
= g_settings
.m_bMute
;
1708 else if (condition
>= LIBRARY_HAS_MUSIC
&& condition
<= LIBRARY_HAS_MUSICVIDEOS
)
1709 bReturn
= GetLibraryBool(condition
);
1710 else if (condition
== LIBRARY_IS_SCANNING
)
1712 CGUIDialogMusicScan
*musicScanner
= (CGUIDialogMusicScan
*)g_windowManager
.GetWindow(WINDOW_DIALOG_MUSIC_SCAN
);
1713 CGUIDialogVideoScan
*videoScanner
= (CGUIDialogVideoScan
*)g_windowManager
.GetWindow(WINDOW_DIALOG_VIDEO_SCAN
);
1714 if (musicScanner
->IsScanning() || videoScanner
->IsScanning())
1719 else if (condition
== SYSTEM_PLATFORM_LINUX
)
1720 #if defined(_LINUX) && !defined(__APPLE__)
1725 else if (condition
== SYSTEM_PLATFORM_WINDOWS
)
1731 else if (condition
== SYSTEM_PLATFORM_OSX
)
1737 else if (condition
== SYSTEM_PLATFORM_XBOX
)
1739 else if (condition
== SYSTEM_MEDIA_DVD
)
1740 bReturn
= g_mediaManager
.IsDiscInDrive();
1741 #ifdef HAS_DVD_DRIVE
1742 else if (condition
== SYSTEM_HAS_DRIVE_F
)
1743 bReturn
= CIoSupport::DriveExists('F');
1744 else if (condition
== SYSTEM_HAS_DRIVE_G
)
1745 bReturn
= CIoSupport::DriveExists('G');
1746 else if (condition
== SYSTEM_DVDREADY
)
1747 bReturn
= g_mediaManager
.GetDriveStatus() != DRIVE_NOT_READY
;
1748 else if (condition
== SYSTEM_TRAYOPEN
)
1749 bReturn
= g_mediaManager
.GetDriveStatus() == DRIVE_OPEN
;
1751 else if (condition
== SYSTEM_CAN_POWERDOWN
)
1752 bReturn
= g_powerManager
.CanPowerdown();
1753 else if (condition
== SYSTEM_CAN_SUSPEND
)
1754 bReturn
= g_powerManager
.CanSuspend();
1755 else if (condition
== SYSTEM_CAN_HIBERNATE
)
1756 bReturn
= g_powerManager
.CanHibernate();
1757 else if (condition
== SYSTEM_CAN_REBOOT
)
1758 bReturn
= g_powerManager
.CanReboot();
1760 else if (condition
== PLAYER_SHOWINFO
)
1761 bReturn
= m_playerShowInfo
;
1762 else if (condition
== PLAYER_SHOWCODEC
)
1763 bReturn
= m_playerShowCodec
;
1764 else if (condition
>= SKIN_HAS_THEME_START
&& condition
<= SKIN_HAS_THEME_END
)
1765 { // Note that the code used here could probably be extended to general
1766 // settings conditions (parameter would need to store both the setting name an
1767 // the and the comparison string)
1768 CStdString theme
= g_guiSettings
.GetString("lookandfeel.skintheme");
1770 CUtil::RemoveExtension(theme
);
1771 bReturn
= theme
.Equals(m_stringParameters
[condition
- SKIN_HAS_THEME_START
]);
1773 else if (condition
>= MULTI_INFO_START
&& condition
<= MULTI_INFO_END
)
1775 // cache return value
1776 bool result
= GetMultiInfoBool(m_multiInfo
[condition
- MULTI_INFO_START
], contextWindow
, item
);
1778 CacheBool(condition1
, contextWindow
, result
);
1781 else if (condition
== SYSTEM_HASLOCKS
)
1782 bReturn
= g_settings
.GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE
;
1783 else if (condition
== SYSTEM_ISMASTER
)
1784 bReturn
= g_settings
.GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE
&& g_passwordManager
.bMasterUser
;
1785 else if (condition
== SYSTEM_LOGGEDON
)
1786 bReturn
= !(g_windowManager
.GetActiveWindow() == WINDOW_LOGIN_SCREEN
);
1787 else if (condition
== SYSTEM_HAS_LOGINSCREEN
)
1788 bReturn
= g_settings
.UsingLoginScreen();
1789 else if (condition
== WEATHER_IS_FETCHED
)
1790 bReturn
= g_weatherManager
.IsFetched();
1791 else if (condition
== SYSTEM_INTERNET_STATE
)
1793 g_sysinfo
.GetInfo(condition
);
1794 bReturn
= g_sysinfo
.HasInternet();
1796 else if (condition
== SKIN_HAS_VIDEO_OVERLAY
)
1798 bReturn
= g_windowManager
.IsOverlayAllowed() && g_application
.IsPlayingVideo();
1800 else if (condition
== SKIN_HAS_MUSIC_OVERLAY
)
1802 bReturn
= g_windowManager
.IsOverlayAllowed() && g_application
.IsPlayingAudio();
1804 else if (condition
== CONTAINER_HASFILES
|| condition
== CONTAINER_HASFOLDERS
)
1806 CGUIWindow
*pWindow
= GetWindowWithCondition(contextWindow
, WINDOW_CONDITION_IS_MEDIA_WINDOW
);
1809 const CFileItemList
& items
=((CGUIMediaWindow
*)pWindow
)->CurrentDirectory();
1810 for (int i
=0;i
<items
.Size();++i
)
1812 CFileItemPtr item
=items
.Get(i
);
1813 if (!item
->m_bIsFolder
&& condition
== CONTAINER_HASFILES
)
1818 else if (item
->m_bIsFolder
&& !item
->IsParentFolder() && condition
== CONTAINER_HASFOLDERS
)
1826 else if (condition
== CONTAINER_STACKED
)
1828 CGUIWindow
*pWindow
= GetWindowWithCondition(contextWindow
, WINDOW_CONDITION_IS_MEDIA_WINDOW
);
1830 bReturn
= ((CGUIMediaWindow
*)pWindow
)->CurrentDirectory().GetProperty("isstacked")=="1";
1832 else if (condition
== CONTAINER_HAS_THUMB
)
1834 CGUIWindow
*pWindow
= GetWindowWithCondition(contextWindow
, WINDOW_CONDITION_IS_MEDIA_WINDOW
);
1836 bReturn
= ((CGUIMediaWindow
*)pWindow
)->CurrentDirectory().HasThumbnail();
1838 else if (condition
== VIDEOPLAYER_HAS_INFO
)
1839 bReturn
= (m_currentFile
->HasVideoInfoTag() && !m_currentFile
->GetVideoInfoTag()->IsEmpty());
1840 else if (condition
>= CONTAINER_SCROLL_PREVIOUS
&& condition
<= CONTAINER_SCROLL_NEXT
)
1842 // no parameters, so we assume it's just requested for a media window. It therefore
1843 // can only happen if the list has focus.
1844 CGUIWindow
*pWindow
= GetWindowWithCondition(contextWindow
, WINDOW_CONDITION_IS_MEDIA_WINDOW
);
1847 map
<int,int>::const_iterator it
= m_containerMoves
.find(pWindow
->GetViewContainerID());
1848 if (it
!= m_containerMoves
.end())
1850 if (condition
> CONTAINER_STATIC
) // moving up
1851 bReturn
= it
->second
>= std::max(condition
- CONTAINER_STATIC
, 1);
1853 bReturn
= it
->second
<= std::min(condition
- CONTAINER_STATIC
, -1);
1857 else if (g_application
.IsPlaying())
1861 case PLAYER_HAS_MEDIA
:
1864 case PLAYER_HAS_AUDIO
:
1865 bReturn
= g_application
.IsPlayingAudio();
1867 case PLAYER_HAS_VIDEO
:
1868 bReturn
= g_application
.IsPlayingVideo();
1870 case PLAYER_PLAYING
:
1871 bReturn
= !g_application
.IsPaused() && (g_application
.GetPlaySpeed() == 1);
1874 bReturn
= g_application
.IsPaused();
1876 case PLAYER_REWINDING
:
1877 bReturn
= !g_application
.IsPaused() && g_application
.GetPlaySpeed() < 1;
1879 case PLAYER_FORWARDING
:
1880 bReturn
= !g_application
.IsPaused() && g_application
.GetPlaySpeed() > 1;
1882 case PLAYER_REWINDING_2x
:
1883 bReturn
= !g_application
.IsPaused() && g_application
.GetPlaySpeed() == -2;
1885 case PLAYER_REWINDING_4x
:
1886 bReturn
= !g_application
.IsPaused() && g_application
.GetPlaySpeed() == -4;
1888 case PLAYER_REWINDING_8x
:
1889 bReturn
= !g_application
.IsPaused() && g_application
.GetPlaySpeed() == -8;
1891 case PLAYER_REWINDING_16x
:
1892 bReturn
= !g_application
.IsPaused() && g_application
.GetPlaySpeed() == -16;
1894 case PLAYER_REWINDING_32x
:
1895 bReturn
= !g_application
.IsPaused() && g_application
.GetPlaySpeed() == -32;
1897 case PLAYER_FORWARDING_2x
:
1898 bReturn
= !g_application
.IsPaused() && g_application
.GetPlaySpeed() == 2;
1900 case PLAYER_FORWARDING_4x
:
1901 bReturn
= !g_application
.IsPaused() && g_application
.GetPlaySpeed() == 4;
1903 case PLAYER_FORWARDING_8x
:
1904 bReturn
= !g_application
.IsPaused() && g_application
.GetPlaySpeed() == 8;
1906 case PLAYER_FORWARDING_16x
:
1907 bReturn
= !g_application
.IsPaused() && g_application
.GetPlaySpeed() == 16;
1909 case PLAYER_FORWARDING_32x
:
1910 bReturn
= !g_application
.IsPaused() && g_application
.GetPlaySpeed() == 32;
1912 case PLAYER_CAN_RECORD
:
1913 bReturn
= g_application
.m_pPlayer
->CanRecord();
1915 case PLAYER_RECORDING
:
1916 bReturn
= g_application
.m_pPlayer
->IsRecording();
1918 case PLAYER_DISPLAY_AFTER_SEEK
:
1919 bReturn
= GetDisplayAfterSeek();
1921 case PLAYER_CACHING
:
1922 bReturn
= g_application
.m_pPlayer
->IsCaching();
1924 case PLAYER_SEEKBAR
:
1926 CGUIDialogSeekBar
*seekBar
= (CGUIDialogSeekBar
*)g_windowManager
.GetWindow(WINDOW_DIALOG_SEEK_BAR
);
1927 bReturn
= seekBar
? seekBar
->IsDialogRunning() : false;
1930 case PLAYER_SEEKING
:
1931 bReturn
= m_playerSeeking
;
1933 case PLAYER_SHOWTIME
:
1934 bReturn
= m_playerShowTime
;
1936 case PLAYER_PASSTHROUGH
:
1937 bReturn
= g_application
.m_pPlayer
&& g_application
.m_pPlayer
->IsPassthrough();
1939 case MUSICPM_ENABLED
:
1940 bReturn
= g_partyModeManager
.IsEnabled();
1942 case AUDIOSCROBBLER_ENABLED
:
1943 bReturn
= CLastFmManager::GetInstance()->IsLastFmEnabled();
1945 case LASTFM_RADIOPLAYING
:
1946 bReturn
= CLastFmManager::GetInstance()->IsRadioEnabled();
1948 case LASTFM_CANLOVE
:
1949 bReturn
= CLastFmManager::GetInstance()->CanLove();
1952 bReturn
= CLastFmManager::GetInstance()->CanBan();
1954 case MUSICPLAYER_HASPREVIOUS
:
1956 // requires current playlist be PLAYLIST_MUSIC
1958 if (g_playlistPlayer
.GetCurrentPlaylist() == PLAYLIST_MUSIC
)
1959 bReturn
= (g_playlistPlayer
.GetCurrentSong() > 0); // not first song
1962 case MUSICPLAYER_HASNEXT
:
1964 // requires current playlist be PLAYLIST_MUSIC
1966 if (g_playlistPlayer
.GetCurrentPlaylist() == PLAYLIST_MUSIC
)
1967 bReturn
= (g_playlistPlayer
.GetCurrentSong() < (g_playlistPlayer
.GetPlaylist(PLAYLIST_MUSIC
).size() - 1)); // not last song
1970 case MUSICPLAYER_PLAYLISTPLAYING
:
1973 if (g_application
.IsPlayingAudio() && g_playlistPlayer
.GetCurrentPlaylist() == PLAYLIST_MUSIC
)
1977 case VIDEOPLAYER_USING_OVERLAYS
:
1978 bReturn
= (g_guiSettings
.GetInt("videoplayer.rendermethod") == RENDER_OVERLAYS
);
1980 case VIDEOPLAYER_ISFULLSCREEN
:
1981 bReturn
= g_windowManager
.GetActiveWindow() == WINDOW_FULLSCREEN_VIDEO
;
1983 case VIDEOPLAYER_HASMENU
:
1984 bReturn
= g_application
.m_pPlayer
->HasMenu();
1986 case PLAYLIST_ISRANDOM
:
1987 bReturn
= g_playlistPlayer
.IsShuffled(g_playlistPlayer
.GetCurrentPlaylist());
1989 case PLAYLIST_ISREPEAT
:
1990 bReturn
= g_playlistPlayer
.GetRepeat(g_playlistPlayer
.GetCurrentPlaylist()) == PLAYLIST::REPEAT_ALL
;
1992 case PLAYLIST_ISREPEATONE
:
1993 bReturn
= g_playlistPlayer
.GetRepeat(g_playlistPlayer
.GetCurrentPlaylist()) == PLAYLIST::REPEAT_ONE
;
1995 case PLAYER_HASDURATION
:
1996 bReturn
= g_application
.GetTotalTime() > 0;
1998 case VIDEOPLAYER_HASTELETEXT
:
1999 if (g_application
.m_pPlayer
->GetTeletextCache())
2002 case VISUALISATION_LOCKED
:
2004 CGUIMessage
msg(GUI_MSG_GET_VISUALISATION
, 0, 0);
2005 g_windowManager
.SendMessage(msg
);
2006 if (msg
.GetPointer())
2008 CVisualisation
*pVis
= (CVisualisation
*)msg
.GetPointer();
2009 bReturn
= pVis
->IsLocked();
2013 case VISUALISATION_ENABLED
:
2014 bReturn
= g_guiSettings
.GetString("musicplayer.visualisation") != "None";
2016 default: // default, use integer value different from 0 as true
2017 bReturn
= GetInt(condition
) != 0;
2020 // cache return value
2021 if (condition1
< 0) bReturn
= !bReturn
;
2023 if (!item
) // don't cache item properties
2024 CacheBool(condition1
, contextWindow
, bReturn
);
2029 /// \brief Examines the multi information sent and returns true or false accordingly.
2030 bool CGUIInfoManager::GetMultiInfoBool(const GUIInfo
&info
, int contextWindow
, const CGUIListItem
*item
)
2032 bool bReturn
= false;
2033 int condition
= abs(info
.m_info
);
2035 if (condition
>= LISTITEM_START
&& condition
<= LISTITEM_END
)
2037 // TODO: We currently don't use the item that is passed in to here, as these
2038 // conditions only come from Container(id).ListItem(offset).* at this point.
2039 CGUIListItemPtr item
;
2040 CGUIWindow
*window
= NULL
;
2041 int data1
= info
.GetData1();
2042 if (!data1
) // No container specified, so we lookup the current view container
2044 window
= GetWindowWithCondition(contextWindow
, WINDOW_CONDITION_HAS_LIST_ITEMS
);
2045 if (window
&& window
->IsMediaWindow())
2046 data1
= ((CGUIMediaWindow
*)(window
))->GetViewContainerID();
2049 if (!window
) // If we don't have a window already (from lookup above), get one
2050 window
= GetWindowWithCondition(contextWindow
, 0);
2054 const CGUIControl
*control
= window
->GetControl(data1
);
2055 if (control
&& control
->IsContainer())
2056 item
= ((CGUIBaseContainer
*)control
)->GetListItem(info
.GetData2(), info
.GetInfoFlag());
2059 if (item
) // If we got a valid item, do the lookup
2060 bReturn
= GetItemBool(item
.get(), condition
); // Image prioritizes images over labels (in the case of music item ratings for instance)
2068 bReturn
= g_settings
.GetSkinBool(info
.GetData1());
2073 if (info
.GetData2())
2074 bReturn
= g_settings
.GetSkinString(info
.GetData1()).Equals(m_stringParameters
[info
.GetData2()]);
2076 bReturn
= !g_settings
.GetSkinString(info
.GetData1()).IsEmpty();
2079 case STRING_IS_EMPTY
:
2080 // note: Get*Image() falls back to Get*Label(), so this should cover all of them
2081 if (item
&& item
->IsFileItem() && info
.GetData1() >= LISTITEM_START
&& info
.GetData1() < LISTITEM_END
)
2082 bReturn
= GetItemImage((const CFileItem
*)item
, info
.GetData1()).IsEmpty();
2084 bReturn
= GetImage(info
.GetData1(), contextWindow
).IsEmpty();
2086 case STRING_COMPARE
:
2089 if (info
.GetData2() < 0) // info labels are stored with negative numbers
2091 int info2
= -info
.GetData2();
2092 if (item
&& item
->IsFileItem() && info2
>= LISTITEM_START
&& info2
< LISTITEM_END
)
2093 compare
= GetItemImage((const CFileItem
*)item
, info2
);
2095 compare
= GetImage(info2
, contextWindow
);
2097 else if (info
.GetData2() < (int)m_stringParameters
.size())
2098 { // conditional string
2099 compare
= m_stringParameters
[info
.GetData2()];
2101 if (item
&& item
->IsFileItem() && info
.GetData1() >= LISTITEM_START
&& info
.GetData1() < LISTITEM_END
)
2102 bReturn
= GetItemImage((const CFileItem
*)item
, info
.GetData1()).Equals(compare
);
2104 bReturn
= GetImage(info
.GetData1(), contextWindow
).Equals(compare
);
2107 case INTEGER_GREATER_THAN
:
2111 if (item
&& item
->IsFileItem() && info
.GetData1() >= LISTITEM_START
&& info
.GetData1() < LISTITEM_END
)
2112 value
= GetItemImage((const CFileItem
*)item
, info
.GetData1());
2114 value
= GetImage(info
.GetData1(), contextWindow
);
2116 // Handle the case when a value contains time separator (:). This makes IntegerGreaterThan
2117 // useful for Player.Time* members without adding a separate set of members returning time in seconds
2118 if ( value
.find_first_of( ':' ) != value
.npos
)
2119 bReturn
= StringUtils::TimeStringToSeconds( value
) > info
.GetData2();
2121 bReturn
= atoi( value
.c_str() ) > info
.GetData2();
2126 CStdString compare
= m_stringParameters
[info
.GetData2()];
2127 // our compare string is already in lowercase, so lower case our label as well
2128 // as CStdString::Find() is case sensitive
2130 if (item
&& item
->IsFileItem() && info
.GetData1() >= LISTITEM_START
&& info
.GetData1() < LISTITEM_END
)
2131 label
= GetItemImage((const CFileItem
*)item
, info
.GetData1()).ToLower();
2133 label
= GetImage(info
.GetData1(), contextWindow
).ToLower();
2134 if (compare
.Right(5).Equals(",left"))
2135 bReturn
= label
.Find(compare
.Mid(0,compare
.size()-5)) == 0;
2136 else if (compare
.Right(6).Equals(",right"))
2138 compare
= compare
.Mid(0,compare
.size()-6);
2139 bReturn
= label
.Find(compare
) == (int)(label
.size()-compare
.size());
2142 bReturn
= label
.Find(compare
) > -1;
2145 case SYSTEM_ALARM_LESS_OR_EQUAL
:
2147 int time
= lrint(g_alarmClock
.GetRemaining(m_stringParameters
[info
.GetData1()]));
2148 int timeCompare
= atoi(m_stringParameters
[info
.GetData2()]);
2150 bReturn
= timeCompare
>= time
;
2155 case CONTROL_GROUP_HAS_FOCUS
:
2157 CGUIWindow
*window
= GetWindowWithCondition(contextWindow
, 0);
2159 bReturn
= window
->ControlGroupHasFocus(info
.GetData1(), info
.GetData2());
2162 case CONTROL_IS_VISIBLE
:
2164 CGUIWindow
*window
= GetWindowWithCondition(contextWindow
, 0);
2167 // Note: This'll only work for unique id's
2168 const CGUIControl
*control
= window
->GetControl(info
.GetData1());
2170 bReturn
= control
->IsVisible();
2174 case CONTROL_IS_ENABLED
:
2176 CGUIWindow
*window
= GetWindowWithCondition(contextWindow
, 0);
2179 // Note: This'll only work for unique id's
2180 const CGUIControl
*control
= window
->GetControl(info
.GetData1());
2182 bReturn
= !control
->IsDisabled();
2186 case CONTROL_HAS_FOCUS
:
2188 CGUIWindow
*window
= GetWindowWithCondition(contextWindow
, 0);
2190 bReturn
= (window
->GetFocusedControlID() == (int)info
.GetData1());
2193 case BUTTON_SCROLLER_HAS_ICON
:
2195 CGUIWindow
*window
= GetWindowWithCondition(contextWindow
, 0);
2198 CGUIControl
*pControl
= window
->GetFocusedControl();
2199 if (pControl
&& pControl
->GetControlType() == CGUIControl::GUICONTROL_BUTTONBAR
)
2200 bReturn
= ((CGUIButtonScroller
*)pControl
)->GetActiveButtonID() == (int)info
.GetData1();
2205 if (info
.GetData1())
2206 bReturn
= ((int)info
.GetData1() == m_nextWindowID
);
2209 CGUIWindow
*window
= g_windowManager
.GetWindow(m_nextWindowID
);
2210 if (window
&& CUtil::GetFileName(window
->GetProperty("xmlfile")).Equals(m_stringParameters
[info
.GetData2()]))
2214 case WINDOW_PREVIOUS
:
2215 if (info
.GetData1())
2216 bReturn
= ((int)info
.GetData1() == m_prevWindowID
);
2219 CGUIWindow
*window
= g_windowManager
.GetWindow(m_prevWindowID
);
2220 if (window
&& CUtil::GetFileName(window
->GetProperty("xmlfile")).Equals(m_stringParameters
[info
.GetData2()]))
2224 case WINDOW_IS_VISIBLE
:
2225 if (info
.GetData1())
2226 bReturn
= g_windowManager
.IsWindowVisible(info
.GetData1());
2228 bReturn
= g_windowManager
.IsWindowVisible(m_stringParameters
[info
.GetData2()]);
2230 case WINDOW_IS_TOPMOST
:
2231 if (info
.GetData1())
2232 bReturn
= g_windowManager
.IsWindowTopMost(info
.GetData1());
2234 bReturn
= g_windowManager
.IsWindowTopMost(m_stringParameters
[info
.GetData2()]);
2236 case WINDOW_IS_ACTIVE
:
2237 if (info
.GetData1())
2238 bReturn
= g_windowManager
.IsWindowActive(info
.GetData1());
2240 bReturn
= g_windowManager
.IsWindowActive(m_stringParameters
[info
.GetData2()]);
2242 case SYSTEM_HAS_ALARM
:
2243 bReturn
= g_alarmClock
.HasAlarm(m_stringParameters
[info
.GetData1()]);
2245 case SYSTEM_GET_BOOL
:
2246 bReturn
= g_guiSettings
.GetBool(m_stringParameters
[info
.GetData1()]);
2248 case SYSTEM_HAS_CORE_ID
:
2249 bReturn
= g_cpuInfo
.HasCoreId(info
.GetData1());
2251 case SYSTEM_SETTING
:
2253 if ( m_stringParameters
[info
.GetData1()].Equals("hidewatched") )
2255 CGUIWindow
*window
= GetWindowWithCondition(contextWindow
, WINDOW_CONDITION_IS_MEDIA_WINDOW
);
2257 bReturn
= g_settings
.GetWatchMode(((CGUIMediaWindow
*)window
)->CurrentDirectory().GetContent()) == VIDEO_SHOW_UNWATCHED
;
2261 case SYSTEM_HAS_ADDON
:
2264 bReturn
= CAddonMgr::Get().GetAddon(m_stringParameters
[info
.GetData1()],addon
) && addon
;
2267 case CONTAINER_SCROLL_PREVIOUS
:
2268 case CONTAINER_MOVE_PREVIOUS
:
2269 case CONTAINER_MOVE_NEXT
:
2270 case CONTAINER_SCROLL_NEXT
:
2272 map
<int,int>::const_iterator it
= m_containerMoves
.find(info
.GetData1());
2273 if (it
!= m_containerMoves
.end())
2275 if (condition
> CONTAINER_STATIC
) // moving up
2276 bReturn
= it
->second
>= std::max(condition
- CONTAINER_STATIC
, 1);
2278 bReturn
= it
->second
<= std::min(condition
- CONTAINER_STATIC
, -1);
2282 case CONTAINER_CONTENT
:
2285 CGUIWindow
*window
= GetWindowWithCondition(contextWindow
, 0);
2288 if (window
->GetID() == WINDOW_MUSIC_INFO
)
2289 content
= ((CGUIWindowMusicInfo
*)window
)->CurrentDirectory().GetContent();
2290 else if (window
->GetID() == WINDOW_VIDEO_INFO
)
2291 content
= ((CGUIWindowVideoInfo
*)window
)->CurrentDirectory().GetContent();
2293 if (content
.IsEmpty())
2295 window
= GetWindowWithCondition(contextWindow
, WINDOW_CONDITION_IS_MEDIA_WINDOW
);
2297 content
= ((CGUIMediaWindow
*)window
)->CurrentDirectory().GetContent();
2299 bReturn
= m_stringParameters
[info
.GetData1()].Equals(content
);
2303 case CONTAINER_COLUMN
:
2304 case CONTAINER_POSITION
:
2305 case CONTAINER_HAS_NEXT
:
2306 case CONTAINER_HAS_PREVIOUS
:
2307 case CONTAINER_SCROLLING
:
2308 case CONTAINER_SUBITEM
:
2310 const CGUIControl
*control
= NULL
;
2311 if (info
.GetData1())
2312 { // container specified
2313 CGUIWindow
*window
= GetWindowWithCondition(contextWindow
, 0);
2315 control
= window
->GetControl(info
.GetData1());
2318 { // no container specified - assume a mediawindow
2319 CGUIWindow
*window
= GetWindowWithCondition(contextWindow
, WINDOW_CONDITION_IS_MEDIA_WINDOW
);
2321 control
= window
->GetControl(window
->GetViewContainerID());
2324 bReturn
= control
->GetCondition(condition
, info
.GetData2());
2327 case CONTAINER_HAS_FOCUS
:
2328 { // grab our container
2329 CGUIWindow
*window
= GetWindowWithCondition(contextWindow
, 0);
2332 const CGUIControl
*control
= window
->GetControl(info
.GetData1());
2333 if (control
&& control
->IsContainer())
2335 CFileItemPtr item
= boost::static_pointer_cast
<CFileItem
>(((CGUIBaseContainer
*)control
)->GetListItem(0));
2336 if (item
&& item
->m_iprogramCount
== info
.GetData2()) // programcount used to store item id
2342 case VIDEOPLAYER_CONTENT
:
2344 CStdString strContent
="movies";
2345 if (!m_currentFile
->HasVideoInfoTag() || m_currentFile
->GetVideoInfoTag()->IsEmpty())
2346 strContent
= "files";
2347 if (m_currentFile
->HasVideoInfoTag() && m_currentFile
->GetVideoInfoTag()->m_iSeason
> -1) // episode
2348 strContent
= "episodes";
2349 if (m_currentFile
->HasVideoInfoTag() && !m_currentFile
->GetVideoInfoTag()->m_strArtist
.IsEmpty())
2350 strContent
= "musicvideos";
2351 if (m_currentFile
->HasVideoInfoTag() && m_currentFile
->GetVideoInfoTag()->m_strStatus
== "livetv")
2352 strContent
= "livetv";
2353 bReturn
= m_stringParameters
[info
.GetData1()].Equals(strContent
);
2356 case CONTAINER_SORT_METHOD
:
2358 CGUIWindow
*window
= GetWindowWithCondition(contextWindow
, WINDOW_CONDITION_IS_MEDIA_WINDOW
);
2361 const CGUIViewState
*viewState
= ((CGUIMediaWindow
*)window
)->GetViewState();
2363 bReturn
= ((unsigned int)viewState
->GetSortMethod() == info
.GetData1());
2367 case CONTAINER_SORT_DIRECTION
:
2369 CGUIWindow
*window
= GetWindowWithCondition(contextWindow
, WINDOW_CONDITION_IS_MEDIA_WINDOW
);
2372 const CGUIViewState
*viewState
= ((CGUIMediaWindow
*)window
)->GetViewState();
2374 bReturn
= ((unsigned int)viewState
->GetDisplaySortOrder() == info
.GetData1());
2380 CDateTime date
= CDateTime::GetCurrentDateTime();
2381 int currentDate
= date
.GetMonth()*100+date
.GetDay();
2382 int startDate
= info
.GetData1();
2383 int stopDate
= info
.GetData2();
2385 if (stopDate
< startDate
)
2386 bReturn
= currentDate
>= startDate
|| currentDate
< stopDate
;
2388 bReturn
= currentDate
>= startDate
&& currentDate
< stopDate
;
2393 CDateTime time
=CDateTime::GetCurrentDateTime();
2394 int currentTime
= time
.GetMinuteOfDay();
2395 int startTime
= info
.GetData1();
2396 int stopTime
= info
.GetData2();
2398 if (stopTime
< startTime
)
2399 bReturn
= currentTime
>= startTime
|| currentTime
< stopTime
;
2401 bReturn
= currentTime
>= startTime
&& currentTime
< stopTime
;
2404 case MUSICPLAYER_EXISTS
:
2406 int index
= info
.GetData2();
2407 if (info
.GetData1() == 1)
2409 if (g_playlistPlayer
.GetCurrentPlaylist() != PLAYLIST_MUSIC
)
2411 index
+= g_playlistPlayer
.GetCurrentSong();
2413 if (index
>= 0 && index
< g_playlistPlayer
.GetPlaylist(PLAYLIST_MUSIC
).size())
2420 return (info
.m_info
< 0) ? !bReturn
: bReturn
;
2423 /// \brief Examines the multi information sent and returns the string as appropriate
2424 CStdString
CGUIInfoManager::GetMultiInfoLabel(const GUIInfo
&info
, int contextWindow
) const
2426 if (info
.m_info
== SKIN_STRING
)
2428 return g_settings
.GetSkinString(info
.GetData1());
2430 else if (info
.m_info
== SKIN_BOOL
)
2432 bool bInfo
= g_settings
.GetSkinBool(info
.GetData1());
2434 return g_localizeStrings
.Get(20122);
2436 if (info
.m_info
>= LISTITEM_START
&& info
.m_info
<= LISTITEM_END
)
2439 CGUIWindow
*window
= NULL
;
2441 int data1
= info
.GetData1();
2442 if (!data1
) // No container specified, so we lookup the current view container
2444 window
= GetWindowWithCondition(contextWindow
, WINDOW_CONDITION_HAS_LIST_ITEMS
);
2445 if (window
&& window
->IsMediaWindow())
2446 data1
= ((CGUIMediaWindow
*)(window
))->GetViewContainerID();
2449 if (!window
) // If we don't have a window already (from lookup above), get one
2450 window
= GetWindowWithCondition(contextWindow
, 0);
2454 const CGUIControl
*control
= window
->GetControl(data1
);
2455 if (control
&& control
->IsContainer())
2456 item
= boost::static_pointer_cast
<CFileItem
>(((CGUIBaseContainer
*)control
)->GetListItem(info
.GetData2(), info
.GetInfoFlag()));
2459 if (item
) // If we got a valid item, do the lookup
2460 return GetItemImage(item
.get(), info
.m_info
); // Image prioritizes images over labels (in the case of music item ratings for instance)
2462 else if (info
.m_info
== PLAYER_TIME
)
2464 return GetCurrentPlayTime((TIME_FORMAT
)info
.GetData1());
2466 else if (info
.m_info
== PLAYER_TIME_REMAINING
)
2468 return GetCurrentPlayTimeRemaining((TIME_FORMAT
)info
.GetData1());
2470 else if (info
.m_info
== PLAYER_FINISH_TIME
)
2472 CDateTime time
= CDateTime::GetCurrentDateTime();
2473 time
+= CDateTimeSpan(0, 0, 0, GetPlayTimeRemaining());
2474 return LocalizeTime(time
, (TIME_FORMAT
)info
.GetData1());
2476 else if (info
.m_info
== PLAYER_TIME_SPEED
)
2479 if (g_application
.GetPlaySpeed() != 1)
2480 strTime
.Format("%s (%ix)", GetCurrentPlayTime((TIME_FORMAT
)info
.GetData1()).c_str(), g_application
.GetPlaySpeed());
2482 strTime
= GetCurrentPlayTime();
2485 else if (info
.m_info
== PLAYER_DURATION
)
2487 return GetDuration((TIME_FORMAT
)info
.GetData1());
2489 else if (info
.m_info
== PLAYER_SEEKTIME
)
2491 TIME_FORMAT format
= (TIME_FORMAT
)info
.GetData1();
2492 if (format
== TIME_FORMAT_GUESS
&& GetTotalPlayTime() >= 3600)
2493 format
= TIME_FORMAT_HH_MM_SS
;
2494 CGUIDialogSeekBar
*seekBar
= (CGUIDialogSeekBar
*)g_windowManager
.GetWindow(WINDOW_DIALOG_SEEK_BAR
);
2496 return seekBar
->GetSeekTimeLabel(format
);
2498 else if (info
.m_info
== PLAYER_SEEKOFFSET
)
2500 CStdString seekOffset
= StringUtils::SecondsToTimeString(abs(m_seekOffset
), (TIME_FORMAT
)info
.GetData1());
2501 if (m_seekOffset
< 0)
2502 return "-" + seekOffset
;
2503 if (m_seekOffset
> 0)
2504 return "+" + seekOffset
;
2506 else if (info
.m_info
== SYSTEM_TIME
)
2508 return GetTime((TIME_FORMAT
)info
.GetData1());
2510 else if (info
.m_info
== CONTAINER_NUM_PAGES
|| info
.m_info
== CONTAINER_CURRENT_PAGE
||
2511 info
.m_info
== CONTAINER_NUM_ITEMS
|| info
.m_info
== CONTAINER_POSITION
)
2513 const CGUIControl
*control
= NULL
;
2514 if (info
.GetData1())
2515 { // container specified
2516 CGUIWindow
*window
= GetWindowWithCondition(contextWindow
, 0);
2518 control
= window
->GetControl(info
.GetData1());
2521 { // no container specified - assume a mediawindow
2522 CGUIWindow
*window
= GetWindowWithCondition(contextWindow
, WINDOW_CONDITION_IS_MEDIA_WINDOW
);
2524 control
= window
->GetControl(window
->GetViewContainerID());
2528 if (control
->IsContainer())
2529 return ((CGUIBaseContainer
*)control
)->GetLabel(info
.m_info
);
2530 else if (control
->GetControlType() == CGUIControl::GUICONTROL_TEXTBOX
)
2531 return ((CGUITextBox
*)control
)->GetLabel(info
.m_info
);
2534 else if (info
.m_info
== SYSTEM_GET_CORE_USAGE
)
2537 strCpu
.Format("%4.2f", g_cpuInfo
.GetCoreInfo(info
.GetData1()).m_fPct
);
2540 else if (info
.m_info
>= MUSICPLAYER_TITLE
&& info
.m_info
<= MUSICPLAYER_DISC_NUMBER
)
2541 return GetMusicPlaylistInfo(info
);
2542 else if (info
.m_info
== CONTAINER_PROPERTY
)
2544 CGUIWindow
*window
= NULL
;
2545 if (info
.GetData1())
2546 { // container specified
2547 window
= GetWindowWithCondition(contextWindow
, 0);
2550 { // no container specified - assume a mediawindow
2551 window
= GetWindowWithCondition(contextWindow
, WINDOW_CONDITION_IS_MEDIA_WINDOW
);
2554 return ((CGUIMediaWindow
*)window
)->CurrentDirectory().GetProperty(m_stringParameters
[info
.GetData2()]);
2556 else if (info
.m_info
== CONTROL_GET_LABEL
)
2558 CGUIWindow
*window
= GetWindowWithCondition(contextWindow
, 0);
2561 const CGUIControl
*control
= window
->GetControl(info
.GetData1());
2563 return control
->GetDescription();
2566 else if (info
.m_info
== WINDOW_PROPERTY
)
2568 CGUIWindow
*window
= NULL
;
2569 if (info
.GetData1())
2570 { // window specified
2571 window
= g_windowManager
.GetWindow(info
.GetData1());//GetWindowWithCondition(contextWindow, 0);
2574 { // no window specified - assume active
2575 window
= GetWindowWithCondition(contextWindow
, 0);
2579 return window
->GetProperty(m_stringParameters
[info
.GetData2()]);
2582 return StringUtils::EmptyString
;
2585 /// \brief Obtains the filename of the image to show from whichever subsystem is needed
2586 CStdString
CGUIInfoManager::GetImage(int info
, int contextWindow
)
2588 if (info
>= MULTI_INFO_START
&& info
<= MULTI_INFO_END
)
2590 return GetMultiInfoLabel(m_multiInfo
[info
- MULTI_INFO_START
], contextWindow
);
2592 else if (info
== WEATHER_CONDITIONS
)
2593 return g_weatherManager
.GetInfo(WEATHER_IMAGE_CURRENT_ICON
);
2594 else if (info
== SYSTEM_PROFILETHUMB
)
2596 CStdString thumb
= g_settings
.GetCurrentProfile().getThumb();
2597 if (thumb
.IsEmpty())
2598 thumb
= "unknown-user.png";
2601 else if (info
== MUSICPLAYER_COVER
)
2603 if (!g_application
.IsPlayingAudio()) return "";
2604 return m_currentFile
->HasThumbnail() ? m_currentFile
->GetThumbnailImage() : "DefaultAlbumCover.png";
2606 else if (info
== MUSICPLAYER_RATING
)
2608 if (!g_application
.IsPlayingAudio()) return "";
2609 return GetItemImage(m_currentFile
, LISTITEM_RATING
);
2611 else if (info
== PLAYER_STAR_RATING
)
2613 if (!g_application
.IsPlaying()) return "";
2614 return GetItemImage(m_currentFile
, LISTITEM_STAR_RATING
);
2616 else if (info
== VIDEOPLAYER_COVER
)
2618 if (!g_application
.IsPlayingVideo()) return "";
2619 if(m_currentMovieThumb
.IsEmpty())
2620 return m_currentFile
->HasThumbnail() ? m_currentFile
->GetThumbnailImage() : "DefaultVideoCover.png";
2621 else return m_currentMovieThumb
;
2623 else if (info
== CONTAINER_FOLDERTHUMB
)
2625 CGUIWindow
*window
= GetWindowWithCondition(contextWindow
, WINDOW_CONDITION_IS_MEDIA_WINDOW
);
2627 return GetItemImage(&const_cast<CFileItemList
&>(((CGUIMediaWindow
*)window
)->CurrentDirectory()), LISTITEM_THUMB
);
2629 else if (info
== CONTAINER_TVSHOWTHUMB
)
2631 CGUIWindow
*window
= GetWindowWithCondition(contextWindow
, WINDOW_CONDITION_IS_MEDIA_WINDOW
);
2633 return ((CGUIMediaWindow
*)window
)->CurrentDirectory().GetProperty("tvshowthumb");
2635 else if (info
== CONTAINER_SEASONTHUMB
)
2637 CGUIWindow
*window
= GetWindowWithCondition(contextWindow
, WINDOW_CONDITION_IS_MEDIA_WINDOW
);
2639 return ((CGUIMediaWindow
*)window
)->CurrentDirectory().GetProperty("seasonthumb");
2641 else if (info
== LISTITEM_THUMB
|| info
== LISTITEM_ICON
|| info
== LISTITEM_ACTUAL_ICON
||
2642 info
== LISTITEM_OVERLAY
|| info
== LISTITEM_RATING
|| info
== LISTITEM_STAR_RATING
)
2644 CGUIWindow
*window
= GetWindowWithCondition(contextWindow
, WINDOW_CONDITION_HAS_LIST_ITEMS
);
2647 CFileItemPtr item
= window
->GetCurrentListItem();
2649 return GetItemImage(item
.get(), info
);
2652 return GetLabel(info
, contextWindow
);
2655 CStdString
CGUIInfoManager::GetDate(bool bNumbersOnly
)
2657 CDateTime time
=CDateTime::GetCurrentDateTime();
2658 return time
.GetAsLocalizedDate(!bNumbersOnly
);
2661 CStdString
CGUIInfoManager::GetTime(TIME_FORMAT format
) const
2663 CDateTime time
=CDateTime::GetCurrentDateTime();
2664 return LocalizeTime(time
, format
);
2667 CStdString
CGUIInfoManager::GetLcdTime( int _eInfo
) const
2669 CDateTime time
=CDateTime::GetCurrentDateTime();
2670 CStdString strLcdTime
;
2676 CStdString strTimeMarker
;
2684 nCharset
= 1; // CUSTOM_CHARSET_SMALLCHAR;
2686 strTimeMarker
= ".";
2689 nCharset
= 1; // CUSTOM_CHARSET_SMALLCHAR;
2691 strTimeMarker
= ".";
2695 nCharset
= 2; // CUSTOM_CHARSET_MEDIUMCHAR;
2697 strTimeMarker
= ".";
2700 nCharset
= 2; // CUSTOM_CHARSET_MEDIUMCHAR;
2702 strTimeMarker
= ".";
2706 nCharset
= 3; // CUSTOM_CHARSET_BIGCHAR;
2708 strTimeMarker
= " ";
2711 nCharset
= 3; // CUSTOM_CHARSET_BIGCHAR;
2713 strTimeMarker
= "o";
2716 nCharset
= 3; // CUSTOM_CHARSET_BIGCHAR;
2718 strTimeMarker
= "o";
2721 nCharset
= 3; // CUSTOM_CHARSET_BIGCHAR;
2723 strTimeMarker
= " ";
2727 strLcdTime
+= g_lcd
->GetBigDigit( nCharset
, time
.GetHour() , nLine
, 2, 2, true );
2728 strLcdTime
+= strTimeMarker
;
2729 strLcdTime
+= g_lcd
->GetBigDigit( nCharset
, time
.GetMinute(), nLine
, 2, 2, false );
2730 strLcdTime
+= strTimeMarker
;
2731 strLcdTime
+= g_lcd
->GetBigDigit( nCharset
, time
.GetSecond(), nLine
, 2, 2, false );
2738 CStdString
CGUIInfoManager::LocalizeTime(const CDateTime
&time
, TIME_FORMAT format
) const
2740 const CStdString timeFormat
= g_langInfo
.GetTimeFormat();
2741 bool use12hourclock
= timeFormat
.Find('h') != -1;
2744 case TIME_FORMAT_GUESS
:
2745 return time
.GetAsLocalizedTime("", false);
2746 case TIME_FORMAT_SS
:
2747 return time
.GetAsLocalizedTime("ss", true);
2748 case TIME_FORMAT_MM
:
2749 return time
.GetAsLocalizedTime("mm", true);
2750 case TIME_FORMAT_MM_SS
:
2751 return time
.GetAsLocalizedTime("mm:ss", true);
2752 case TIME_FORMAT_HH
: // this forces it to a 12 hour clock
2753 return time
.GetAsLocalizedTime(use12hourclock
? "h" : "HH", false);
2754 case TIME_FORMAT_HH_MM
:
2755 return time
.GetAsLocalizedTime(use12hourclock
? "h:mm" : "HH:mm", false);
2756 case TIME_FORMAT_HH_MM_XX
:
2757 return time
.GetAsLocalizedTime(use12hourclock
? "h:mm xx" : "HH:mm", false);
2758 case TIME_FORMAT_HH_MM_SS
:
2759 return time
.GetAsLocalizedTime("", true);
2763 return time
.GetAsLocalizedTime("", false);
2766 CStdString
CGUIInfoManager::GetDuration(TIME_FORMAT format
) const
2768 if (g_application
.IsPlayingAudio() && m_currentFile
->HasMusicInfoTag())
2770 const CMusicInfoTag
& tag
= *m_currentFile
->GetMusicInfoTag();
2771 if (tag
.GetDuration() > 0)
2772 return StringUtils::SecondsToTimeString(tag
.GetDuration(), format
);
2774 if (g_application
.IsPlayingVideo() && !m_currentMovieDuration
.IsEmpty())
2775 return m_currentMovieDuration
; // for tuxbox
2776 unsigned int iTotal
= (unsigned int)g_application
.GetTotalTime();
2778 return StringUtils::SecondsToTimeString(iTotal
, format
);
2782 CStdString
CGUIInfoManager::GetMusicPartyModeLabel(int item
)
2785 if (item
>= MUSICPM_SONGSPLAYED
&& item
<= MUSICPM_RANDOMSONGSPICKED
)
2790 case MUSICPM_SONGSPLAYED
:
2792 iSongs
= g_partyModeManager
.GetSongsPlayed();
2795 case MUSICPM_MATCHINGSONGS
:
2797 iSongs
= g_partyModeManager
.GetMatchingSongs();
2800 case MUSICPM_MATCHINGSONGSPICKED
:
2802 iSongs
= g_partyModeManager
.GetMatchingSongsPicked();
2805 case MUSICPM_MATCHINGSONGSLEFT
:
2807 iSongs
= g_partyModeManager
.GetMatchingSongsLeft();
2810 case MUSICPM_RELAXEDSONGSPICKED
:
2812 iSongs
= g_partyModeManager
.GetRelaxedSongs();
2815 case MUSICPM_RANDOMSONGSPICKED
:
2817 iSongs
= g_partyModeManager
.GetRandomSongs();
2823 CStdString strLabel
;
2824 strLabel
.Format("%i", iSongs
);
2830 const CStdString
CGUIInfoManager::GetMusicPlaylistInfo(const GUIInfo
& info
) const
2832 PLAYLIST::CPlayList
& playlist
= g_playlistPlayer
.GetPlaylist(PLAYLIST_MUSIC
);
2833 if (playlist
.size() < 1)
2835 int index
= info
.GetData2();
2836 if (info
.GetData1() == 1)
2837 { // relative index (requires current playlist is PLAYLIST_MUSIC)
2838 if (g_playlistPlayer
.GetCurrentPlaylist() != PLAYLIST_MUSIC
)
2840 index
= g_playlistPlayer
.GetNextSong(index
);
2842 if (index
< 0 || index
>= playlist
.size())
2844 CFileItemPtr playlistItem
= playlist
[index
];
2845 if (!playlistItem
->GetMusicInfoTag()->Loaded())
2847 playlistItem
->LoadMusicTag();
2848 playlistItem
->GetMusicInfoTag()->SetLoaded();
2850 // try to set a thumbnail
2851 if (!playlistItem
->HasThumbnail())
2853 playlistItem
->SetMusicThumb();
2854 // still no thumb? then just the set the default cover
2855 if (!playlistItem
->HasThumbnail())
2856 playlistItem
->SetThumbnailImage("DefaultAlbumCover.png");
2858 if (info
.m_info
== MUSICPLAYER_PLAYLISTPOS
)
2860 CStdString strPosition
= "";
2861 strPosition
.Format("%i", index
+ 1);
2864 else if (info
.m_info
== MUSICPLAYER_COVER
)
2865 return playlistItem
->GetThumbnailImage();
2866 return GetMusicTagLabel(info
.m_info
, playlistItem
.get());
2869 CStdString
CGUIInfoManager::GetPlaylistLabel(int item
) const
2871 if (!g_application
.IsPlaying()) return "";
2872 int iPlaylist
= g_playlistPlayer
.GetCurrentPlaylist();
2875 case PLAYLIST_LENGTH
:
2877 CStdString strLength
= "";
2878 strLength
.Format("%i", g_playlistPlayer
.GetPlaylist(iPlaylist
).size());
2881 case PLAYLIST_POSITION
:
2883 CStdString strPosition
= "";
2884 strPosition
.Format("%i", g_playlistPlayer
.GetCurrentSong() + 1);
2887 case PLAYLIST_RANDOM
:
2889 if (g_playlistPlayer
.IsShuffled(iPlaylist
))
2890 return g_localizeStrings
.Get(590); // 590: Random
2892 return g_localizeStrings
.Get(591); // 591: Off
2894 case PLAYLIST_REPEAT
:
2896 PLAYLIST::REPEAT_STATE state
= g_playlistPlayer
.GetRepeat(iPlaylist
);
2897 if (state
== PLAYLIST::REPEAT_ONE
)
2898 return g_localizeStrings
.Get(592); // 592: One
2899 else if (state
== PLAYLIST::REPEAT_ALL
)
2900 return g_localizeStrings
.Get(593); // 593: All
2902 return g_localizeStrings
.Get(594); // 594: Off
2908 CStdString
CGUIInfoManager::GetMusicLabel(int item
)
2910 if (!g_application
.IsPlayingAudio() || !m_currentFile
->HasMusicInfoTag()) return "";
2913 case MUSICPLAYER_PLAYLISTLEN
:
2915 if (g_playlistPlayer
.GetCurrentPlaylist() == PLAYLIST_MUSIC
)
2916 return GetPlaylistLabel(PLAYLIST_LENGTH
);
2919 case MUSICPLAYER_PLAYLISTPOS
:
2921 if (g_playlistPlayer
.GetCurrentPlaylist() == PLAYLIST_MUSIC
)
2922 return GetPlaylistLabel(PLAYLIST_POSITION
);
2925 case MUSICPLAYER_BITRATE
:
2927 float fTimeSpan
= (float)(CTimeUtils::GetFrameTime() - m_lastMusicBitrateTime
);
2928 if (fTimeSpan
>= 500.0f
)
2930 m_MusicBitrate
= g_application
.m_pPlayer
->GetAudioBitrate();
2931 m_lastMusicBitrateTime
= CTimeUtils::GetFrameTime();
2933 CStdString strBitrate
= "";
2934 if (m_MusicBitrate
> 0)
2935 strBitrate
.Format("%i", m_MusicBitrate
);
2939 case MUSICPLAYER_CHANNELS
:
2941 CStdString strChannels
= "";
2942 if (g_application
.m_pPlayer
->GetChannels() > 0)
2944 strChannels
.Format("%i", g_application
.m_pPlayer
->GetChannels());
2949 case MUSICPLAYER_BITSPERSAMPLE
:
2951 CStdString strBitsPerSample
= "";
2952 if (g_application
.m_pPlayer
->GetBitsPerSample() > 0)
2954 strBitsPerSample
.Format("%i", g_application
.m_pPlayer
->GetBitsPerSample());
2956 return strBitsPerSample
;
2959 case MUSICPLAYER_SAMPLERATE
:
2961 CStdString strSampleRate
= "";
2962 if (g_application
.m_pPlayer
->GetSampleRate() > 0)
2964 strSampleRate
.Format("%i",g_application
.m_pPlayer
->GetSampleRate());
2966 return strSampleRate
;
2969 case MUSICPLAYER_CODEC
:
2971 CStdString strCodec
;
2972 strCodec
.Format("%s", g_application
.m_pPlayer
->GetAudioCodecName().c_str());
2976 case MUSICPLAYER_LYRICS
:
2977 return GetItemLabel(m_currentFile
, AddListItemProp("lyrics"));
2979 return GetMusicTagLabel(item
, m_currentFile
);
2982 CStdString
CGUIInfoManager::GetMusicTagLabel(int info
, const CFileItem
*item
) const
2984 if (!item
->HasMusicInfoTag()) return "";
2985 const CMusicInfoTag
&tag
= *item
->GetMusicInfoTag();
2988 case MUSICPLAYER_TITLE
:
2989 if (tag
.GetTitle().size()) { return tag
.GetTitle(); }
2991 case MUSICPLAYER_ALBUM
:
2992 if (tag
.GetAlbum().size()) { return tag
.GetAlbum(); }
2994 case MUSICPLAYER_ARTIST
:
2995 if (tag
.GetArtist().size()) { return tag
.GetArtist(); }
2997 case MUSICPLAYER_ALBUM_ARTIST
:
2998 if (tag
.GetAlbumArtist().size()) { return tag
.GetAlbumArtist(); }
3000 case MUSICPLAYER_YEAR
:
3001 if (tag
.GetYear()) { return tag
.GetYearString(); }
3003 case MUSICPLAYER_GENRE
:
3004 if (tag
.GetGenre().size()) { return tag
.GetGenre(); }
3006 case MUSICPLAYER_TRACK_NUMBER
:
3008 CStdString strTrack
;
3009 if (tag
.Loaded() && tag
.GetTrackNumber() > 0)
3011 strTrack
.Format("%02i", tag
.GetTrackNumber());
3016 case MUSICPLAYER_DISC_NUMBER
:
3019 if (tag
.Loaded() && tag
.GetDiscNumber() > 0)
3021 strDisc
.Format("%02i", tag
.GetDiscNumber());
3026 case MUSICPLAYER_RATING
:
3027 return GetItemLabel(item
, LISTITEM_RATING
);
3028 case MUSICPLAYER_COMMENT
:
3029 return GetItemLabel(item
, LISTITEM_COMMENT
);
3030 case MUSICPLAYER_DURATION
:
3031 return GetItemLabel(item
, LISTITEM_DURATION
);
3036 CStdString
CGUIInfoManager::GetVideoLabel(int item
)
3038 if (!g_application
.IsPlayingVideo())
3041 if (item
== VIDEOPLAYER_TITLE
)
3043 if (m_currentFile
->HasVideoInfoTag() && !m_currentFile
->GetVideoInfoTag()->m_strTitle
.IsEmpty())
3044 return m_currentFile
->GetVideoInfoTag()->m_strTitle
;
3045 // don't have the title, so use dvdplayer, label, or drop down to title from path
3046 if (!g_application
.m_pPlayer
->GetPlayingTitle().IsEmpty())
3047 return g_application
.m_pPlayer
->GetPlayingTitle();
3048 if (!m_currentFile
->GetLabel().IsEmpty())
3049 return m_currentFile
->GetLabel();
3050 return CUtil::GetTitleFromPath(m_currentFile
->m_strPath
);
3052 else if (item
== VIDEOPLAYER_PLAYLISTLEN
)
3054 if (g_playlistPlayer
.GetCurrentPlaylist() == PLAYLIST_VIDEO
)
3055 return GetPlaylistLabel(PLAYLIST_LENGTH
);
3057 else if (item
== VIDEOPLAYER_PLAYLISTPOS
)
3059 if (g_playlistPlayer
.GetCurrentPlaylist() == PLAYLIST_VIDEO
)
3060 return GetPlaylistLabel(PLAYLIST_POSITION
);
3062 else if (m_currentFile
->HasVideoInfoTag())
3066 case VIDEOPLAYER_ORIGINALTITLE
:
3067 return m_currentFile
->GetVideoInfoTag()->m_strOriginalTitle
;
3069 case VIDEOPLAYER_GENRE
:
3070 return m_currentFile
->GetVideoInfoTag()->m_strGenre
;
3072 case VIDEOPLAYER_DIRECTOR
:
3073 return m_currentFile
->GetVideoInfoTag()->m_strDirector
;
3075 case VIDEOPLAYER_RATING
:
3077 CStdString strRating
;
3078 if (m_currentFile
->GetVideoInfoTag()->m_fRating
> 0.f
)
3079 strRating
.Format("%.1f", m_currentFile
->GetVideoInfoTag()->m_fRating
);
3083 case VIDEOPLAYER_RATING_AND_VOTES
:
3085 CStdString strRatingAndVotes
;
3086 if (m_currentFile
->GetVideoInfoTag()->m_fRating
> 0.f
)
3088 if (m_currentFile
->GetVideoInfoTag()->m_strVotes
.IsEmpty())
3089 strRatingAndVotes
.Format("%.1f", m_currentFile
->GetVideoInfoTag()->m_fRating
);
3091 strRatingAndVotes
.Format("%.1f (%s %s)", m_currentFile
->GetVideoInfoTag()->m_fRating
, m_currentFile
->GetVideoInfoTag()->m_strVotes
, g_localizeStrings
.Get(20350));
3093 return strRatingAndVotes
;
3096 case VIDEOPLAYER_YEAR
:
3099 if (m_currentFile
->GetVideoInfoTag()->m_iYear
> 0)
3100 strYear
.Format("%i", m_currentFile
->GetVideoInfoTag()->m_iYear
);
3104 case VIDEOPLAYER_PREMIERED
:
3106 if (!m_currentFile
->GetVideoInfoTag()->m_strFirstAired
.IsEmpty())
3107 return m_currentFile
->GetVideoInfoTag()->m_strFirstAired
;
3108 if (!m_currentFile
->GetVideoInfoTag()->m_strPremiered
.IsEmpty())
3109 return m_currentFile
->GetVideoInfoTag()->m_strPremiered
;
3112 case VIDEOPLAYER_PLOT
:
3113 return m_currentFile
->GetVideoInfoTag()->m_strPlot
;
3114 case VIDEOPLAYER_TRAILER
:
3115 return m_currentFile
->GetVideoInfoTag()->m_strTrailer
;
3116 case VIDEOPLAYER_PLOT_OUTLINE
:
3117 return m_currentFile
->GetVideoInfoTag()->m_strPlotOutline
;
3118 case VIDEOPLAYER_EPISODE
:
3121 if (m_currentFile
->GetVideoInfoTag()->m_iSpecialSortEpisode
> 0)
3122 strYear
.Format("S%i", m_currentFile
->GetVideoInfoTag()->m_iEpisode
);
3123 else if(m_currentFile
->GetVideoInfoTag()->m_iEpisode
> 0)
3124 strYear
.Format("%i", m_currentFile
->GetVideoInfoTag()->m_iEpisode
);
3128 case VIDEOPLAYER_SEASON
:
3131 if (m_currentFile
->GetVideoInfoTag()->m_iSpecialSortSeason
> 0)
3132 strYear
.Format("%i", m_currentFile
->GetVideoInfoTag()->m_iSpecialSortSeason
);
3133 else if(m_currentFile
->GetVideoInfoTag()->m_iSeason
> 0)
3134 strYear
.Format("%i", m_currentFile
->GetVideoInfoTag()->m_iSeason
);
3138 case VIDEOPLAYER_TVSHOW
:
3139 return m_currentFile
->GetVideoInfoTag()->m_strShowTitle
;
3141 case VIDEOPLAYER_STUDIO
:
3142 return m_currentFile
->GetVideoInfoTag()->m_strStudio
;
3143 case VIDEOPLAYER_COUNTRY
:
3144 return m_currentFile
->GetVideoInfoTag()->m_strCountry
;
3145 case VIDEOPLAYER_MPAA
:
3146 return m_currentFile
->GetVideoInfoTag()->m_strMPAARating
;
3147 case VIDEOPLAYER_TOP250
:
3149 CStdString strTop250
;
3150 if (m_currentFile
->GetVideoInfoTag()->m_iTop250
> 0)
3151 strTop250
.Format("%i", m_currentFile
->GetVideoInfoTag()->m_iTop250
);
3155 case VIDEOPLAYER_CAST
:
3156 return m_currentFile
->GetVideoInfoTag()->GetCast();
3157 case VIDEOPLAYER_CAST_AND_ROLE
:
3158 return m_currentFile
->GetVideoInfoTag()->GetCast(true);
3159 case VIDEOPLAYER_ARTIST
:
3160 return m_currentFile
->GetVideoInfoTag()->m_strArtist
;
3161 case VIDEOPLAYER_ALBUM
:
3162 return m_currentFile
->GetVideoInfoTag()->m_strAlbum
;
3163 case VIDEOPLAYER_WRITER
:
3164 return m_currentFile
->GetVideoInfoTag()->m_strWritingCredits
;
3165 case VIDEOPLAYER_TAGLINE
:
3166 return m_currentFile
->GetVideoInfoTag()->m_strTagLine
;
3172 __int64
CGUIInfoManager::GetPlayTime() const
3174 if (g_application
.IsPlaying())
3176 __int64 lPTS
= (__int64
)(g_application
.GetTime() * 1000);
3177 if (lPTS
< 0) lPTS
= 0;
3183 CStdString
CGUIInfoManager::GetCurrentPlayTime(TIME_FORMAT format
) const
3185 if (format
== TIME_FORMAT_GUESS
&& GetTotalPlayTime() >= 3600)
3186 format
= TIME_FORMAT_HH_MM_SS
;
3187 if (g_application
.IsPlayingAudio() || g_application
.IsPlayingVideo())
3188 return StringUtils::SecondsToTimeString((int)(GetPlayTime()/1000), format
);
3192 int CGUIInfoManager::GetTotalPlayTime() const
3194 int iTotalTime
= (int)g_application
.GetTotalTime();
3195 return iTotalTime
> 0 ? iTotalTime
: 0;
3198 int CGUIInfoManager::GetPlayTimeRemaining() const
3200 int iReverse
= GetTotalPlayTime() - (int)g_application
.GetTime();
3201 return iReverse
> 0 ? iReverse
: 0;
3204 CStdString
CGUIInfoManager::GetCurrentPlayTimeRemaining(TIME_FORMAT format
) const
3206 if (format
== TIME_FORMAT_GUESS
&& GetTotalPlayTime() >= 3600)
3207 format
= TIME_FORMAT_HH_MM_SS
;
3208 int timeRemaining
= GetPlayTimeRemaining();
3209 if (timeRemaining
&& (g_application
.IsPlayingAudio() || g_application
.IsPlayingVideo()))
3210 return StringUtils::SecondsToTimeString(timeRemaining
, format
);
3214 void CGUIInfoManager::ResetCurrentItem()
3216 m_currentFile
->Reset();
3217 m_currentMovieThumb
= "";
3218 m_currentMovieDuration
= "";
3221 void CGUIInfoManager::SetCurrentItem(CFileItem
&item
)
3226 SetCurrentSong(item
);
3228 SetCurrentMovie(item
);
3231 void CGUIInfoManager::SetCurrentAlbumThumb(const CStdString thumbFileName
)
3233 if (CFile::Exists(thumbFileName
))
3234 m_currentFile
->SetThumbnailImage(thumbFileName
);
3237 m_currentFile
->SetThumbnailImage("");
3238 m_currentFile
->FillInDefaultIcon();
3242 void CGUIInfoManager::SetCurrentSong(CFileItem
&item
)
3244 CLog::Log(LOGDEBUG
,"CGUIInfoManager::SetCurrentSong(%s)",item
.m_strPath
.c_str());
3245 *m_currentFile
= item
;
3247 m_currentFile
->LoadMusicTag();
3248 if (m_currentFile
->GetMusicInfoTag()->GetTitle().IsEmpty())
3250 // No title in tag, show filename only
3251 m_currentFile
->GetMusicInfoTag()->SetTitle(CUtil::GetTitleFromPath(m_currentFile
->m_strPath
));
3253 m_currentFile
->GetMusicInfoTag()->SetLoaded(true);
3255 // find a thumb for this file.
3256 if (m_currentFile
->IsInternetStream())
3258 if (!g_application
.m_strPlayListFile
.IsEmpty())
3260 CLog::Log(LOGDEBUG
,"Streaming media detected... using %s to find a thumb", g_application
.m_strPlayListFile
.c_str());
3261 CFileItem
streamingItem(g_application
.m_strPlayListFile
,false);
3262 streamingItem
.SetMusicThumb();
3263 CStdString strThumb
= streamingItem
.GetThumbnailImage();
3264 if (CFile::Exists(strThumb
))
3265 m_currentFile
->SetThumbnailImage(strThumb
);
3269 m_currentFile
->SetMusicThumb();
3270 m_currentFile
->FillInDefaultIcon();
3272 CMusicInfoLoader::LoadAdditionalTagInfo(m_currentFile
);
3275 void CGUIInfoManager::SetCurrentMovie(CFileItem
&item
)
3277 CLog::Log(LOGDEBUG
,"CGUIInfoManager::SetCurrentMovie(%s)",item
.m_strPath
.c_str());
3278 *m_currentFile
= item
;
3280 if (!m_currentFile
->HasVideoInfoTag() || m_currentFile
->GetVideoInfoTag()->IsEmpty())
3281 { // attempt to get some information
3284 if (dbs
.HasMovieInfo(item
.m_strPath
))
3286 dbs
.GetMovieInfo(item
.m_strPath
, *m_currentFile
->GetVideoInfoTag());
3287 CLog::Log(LOGDEBUG
,"%s, got movie info!", __FUNCTION__
);
3288 CLog::Log(LOGDEBUG
," Title = %s", m_currentFile
->GetVideoInfoTag()->m_strTitle
.c_str());
3290 else if (dbs
.HasEpisodeInfo(item
.m_strPath
))
3292 dbs
.GetEpisodeInfo(item
.m_strPath
, *m_currentFile
->GetVideoInfoTag());
3293 CLog::Log(LOGDEBUG
,"%s, got episode info!", __FUNCTION__
);
3294 CLog::Log(LOGDEBUG
," Title = %s", m_currentFile
->GetVideoInfoTag()->m_strTitle
.c_str());
3296 else if (dbs
.HasMusicVideoInfo(item
.m_strPath
))
3298 dbs
.GetMusicVideoInfo(item
.m_strPath
, *m_currentFile
->GetVideoInfoTag());
3299 CLog::Log(LOGDEBUG
,"%s, got music video info!", __FUNCTION__
);
3300 CLog::Log(LOGDEBUG
," Title = %s", m_currentFile
->GetVideoInfoTag()->m_strTitle
.c_str());
3304 // Find a thumb for this file.
3305 item
.SetVideoThumb();
3306 if (!item
.HasThumbnail())
3308 CStdString strPath
, strFileName
;
3309 CUtil::Split(item
.GetCachedVideoThumb(), strPath
, strFileName
);
3311 // create unique thumb for auto generated thumbs
3312 CStdString cachedThumb
= strPath
+ "auto-" + strFileName
;
3313 if (CFile::Exists(cachedThumb
))
3314 item
.SetThumbnailImage(cachedThumb
);
3317 // find a thumb for this stream
3318 if (item
.IsInternetStream())
3320 // case where .strm is used to start an audio stream
3321 if (g_application
.IsPlayingAudio())
3323 SetCurrentSong(item
);
3328 if (!g_application
.m_strPlayListFile
.IsEmpty())
3330 CLog::Log(LOGDEBUG
,"Streaming media detected... using %s to find a thumb", g_application
.m_strPlayListFile
.c_str());
3331 CFileItem
thumbItem(g_application
.m_strPlayListFile
,false);
3332 thumbItem
.SetVideoThumb();
3333 if (thumbItem
.HasThumbnail())
3334 item
.SetThumbnailImage(thumbItem
.GetThumbnailImage());
3338 item
.FillInDefaultIcon();
3339 m_currentMovieThumb
= item
.GetThumbnailImage();
3342 string
CGUIInfoManager::GetSystemHeatInfo(int info
)
3344 if (CTimeUtils::GetFrameTime() - m_lastSysHeatInfoTime
>= SYSHEATUPDATEINTERVAL
)
3345 { // update our variables
3346 m_lastSysHeatInfoTime
= CTimeUtils::GetFrameTime();
3348 m_cpuTemp
= g_cpuInfo
.getTemperature();
3349 m_gpuTemp
= GetGPUTemperature();
3356 case LCD_CPU_TEMPERATURE
:
3357 case SYSTEM_CPU_TEMPERATURE
:
3358 return m_cpuTemp
.IsValid() ? m_cpuTemp
.ToString() : "?";
3360 case LCD_GPU_TEMPERATURE
:
3361 case SYSTEM_GPU_TEMPERATURE
:
3362 return m_gpuTemp
.IsValid() ? m_gpuTemp
.ToString() : "?";
3365 case SYSTEM_FAN_SPEED
:
3366 text
.Format("%i%%", m_fanSpeed
* 2);
3368 case SYSTEM_CPU_USAGE
:
3369 #if defined(__APPLE__) || defined(_WIN32)
3370 text
.Format("%d%%", g_cpuInfo
.getUsedPercentage());
3372 text
.Format("%s", g_cpuInfo
.GetCoresUsageString());
3379 CTemperature
CGUIInfoManager::GetGPUTemperature()
3381 CStdString cmd
= g_advancedSettings
.m_gpuTempCmd
;
3387 if (cmd
.IsEmpty() || !(p
= popen(cmd
.c_str(), "r")))
3388 return CTemperature();
3390 ret
= fscanf(p
, "%d %c", &value
, &scale
);
3394 return CTemperature();
3396 if (scale
== 'C' || scale
== 'c')
3397 return CTemperature::CreateFromCelsius(value
);
3398 if (scale
== 'F' || scale
== 'f')
3399 return CTemperature::CreateFromFahrenheit(value
);
3400 return CTemperature();
3403 CStdString
CGUIInfoManager::GetVersion()
3407 tmp
.Format("%s r%s", VERSION_STRING
, SVN_REV
);
3409 tmp
.Format("%s", VERSION_STRING
);
3414 CStdString
CGUIInfoManager::GetBuild()
3417 tmp
.Format("%s", __DATE__
);
3421 void CGUIInfoManager::SetDisplayAfterSeek(unsigned int timeOut
, int seekOffset
)
3425 m_AfterSeekTimeout
= CTimeUtils::GetFrameTime() + timeOut
;
3427 m_seekOffset
= seekOffset
;
3430 m_AfterSeekTimeout
= 0;
3433 bool CGUIInfoManager::GetDisplayAfterSeek()
3435 if (CTimeUtils::GetFrameTime() < m_AfterSeekTimeout
)
3441 CStdString
CGUIInfoManager::GetAudioScrobblerLabel(int item
)
3445 case AUDIOSCROBBLER_CONN_STATE
:
3446 return CLastfmScrobbler::GetInstance()->GetConnectionState();
3448 case AUDIOSCROBBLER_SUBMIT_INT
:
3449 return CLastfmScrobbler::GetInstance()->GetSubmitInterval();
3451 case AUDIOSCROBBLER_FILES_CACHED
:
3452 return CLastfmScrobbler::GetInstance()->GetFilesCached();
3454 case AUDIOSCROBBLER_SUBMIT_STATE
:
3455 return CLastfmScrobbler::GetInstance()->GetSubmitState();
3462 int CGUIInfoManager::GetOperator(const char ch
)
3469 return OPERATOR_NOT
;
3471 return OPERATOR_AND
;
3478 bool CGUIInfoManager::EvaluateBooleanExpression(const CCombinedValue
&expression
, bool &result
, int contextWindow
, const CGUIListItem
*item
)
3480 // stack to save our bool state as we go
3483 for (list
<int>::const_iterator it
= expression
.m_postfix
.begin(); it
!= expression
.m_postfix
.end(); ++it
)
3486 if (expr
== -OPERATOR_NOT
)
3487 { // NOT the top item on the stack
3488 if (save
.size() < 1) return false;
3489 bool expr
= save
.top();
3493 else if (expr
== -OPERATOR_AND
)
3494 { // AND the top two items on the stack
3495 if (save
.size() < 2) return false;
3496 bool right
= save
.top(); save
.pop();
3497 bool left
= save
.top(); save
.pop();
3498 save
.push(left
&& right
);
3500 else if (expr
== -OPERATOR_OR
)
3501 { // OR the top two items on the stack
3502 if (save
.size() < 2) return false;
3503 bool right
= save
.top(); save
.pop();
3504 bool left
= save
.top(); save
.pop();
3505 save
.push(left
|| right
);
3508 save
.push(GetBool(expr
, contextWindow
, item
));
3510 if (save
.size() != 1) return false;
3511 result
= save
.top();
3515 int CGUIInfoManager::TranslateBooleanExpression(const CStdString
&expression
)
3517 CCombinedValue comb
;
3518 comb
.m_info
= expression
;
3519 comb
.m_id
= COMBINED_VALUES_START
+ m_CombinedValues
.size();
3526 for (unsigned int i
= 0; i
< expression
.size(); i
++)
3528 if (GetOperator(expression
[i
]))
3530 // cleanup any operand, translate and put into our expression list
3531 if (!operand
.IsEmpty())
3533 int iOp
= TranslateSingleString(operand
);
3535 comb
.m_postfix
.push_back(iOp
);
3538 // handle closing parenthesis
3539 if (expression
[i
] == ']')
3543 char oper
= save
.top();
3549 comb
.m_postfix
.push_back(-GetOperator(oper
));
3554 // all other operators we pop off the stack any operator
3555 // that has a higher priority than the one we have.
3556 while (!save
.empty() && GetOperator(save
.top()) > GetOperator(expression
[i
]))
3558 // only handle parenthesis once they're closed.
3559 if (save
.top() == '[' && expression
[i
] != ']')
3562 comb
.m_postfix
.push_back(-GetOperator(save
.top())); // negative denotes operator
3565 save
.push(expression
[i
]);
3570 operand
+= expression
[i
];
3574 if (!operand
.empty())
3576 int op
= TranslateSingleString(operand
);
3578 comb
.m_postfix
.push_back(op
);
3581 // finish up by adding any operators
3582 while (!save
.empty())
3584 comb
.m_postfix
.push_back(-GetOperator(save
.top()));
3590 if (!EvaluateBooleanExpression(comb
, test
, WINDOW_INVALID
))
3591 CLog::Log(LOGERROR
, "Error evaluating boolean expression %s", expression
.c_str());
3592 // success - add to our combined values
3593 m_CombinedValues
.push_back(comb
);
3597 void CGUIInfoManager::Clear()
3599 m_CombinedValues
.clear();
3602 void CGUIInfoManager::UpdateFPS()
3605 unsigned int curTime
= CTimeUtils::GetFrameTime();
3607 float fTimeSpan
= (float)(curTime
- m_lastFPSTime
);
3608 if (fTimeSpan
>= 1000.0f
)
3610 fTimeSpan
/= 1000.0f
;
3611 m_fps
= m_frameCounter
/ fTimeSpan
;
3612 m_lastFPSTime
= curTime
;
3617 int CGUIInfoManager::AddListItemProp(const CStdString
&str
, int offset
)
3619 for (int i
=0; i
< (int)m_listitemProperties
.size(); i
++)
3620 if (m_listitemProperties
[i
] == str
)
3621 return (LISTITEM_PROPERTY_START
+offset
+ i
);
3623 if (m_listitemProperties
.size() < LISTITEM_PROPERTY_END
- LISTITEM_PROPERTY_START
)
3625 m_listitemProperties
.push_back(str
);
3626 return LISTITEM_PROPERTY_START
+ offset
+ m_listitemProperties
.size() - 1;
3629 CLog::Log(LOGERROR
,"%s - not enough listitem property space!", __FUNCTION__
);
3633 int CGUIInfoManager::AddMultiInfo(const GUIInfo
&info
)
3635 // check to see if we have this info already
3636 for (unsigned int i
= 0; i
< m_multiInfo
.size(); i
++)
3637 if (m_multiInfo
[i
] == info
)
3638 return (int)i
+ MULTI_INFO_START
;
3639 // return the new offset
3640 m_multiInfo
.push_back(info
);
3641 int id
= (int)m_multiInfo
.size() + MULTI_INFO_START
- 1;
3642 if (id
> MULTI_INFO_END
)
3643 CLog::Log(LOGERROR
, "%s - too many multiinfo bool/labels in this skin", __FUNCTION__
);
3647 int CGUIInfoManager::ConditionalStringParameter(const CStdString
¶meter
)
3649 // check to see if we have this parameter already
3650 for (unsigned int i
= 0; i
< m_stringParameters
.size(); i
++)
3651 if (parameter
.Equals(m_stringParameters
[i
]))
3653 // return the new offset
3654 m_stringParameters
.push_back(parameter
);
3655 return (int)m_stringParameters
.size() - 1;
3658 CStdString
CGUIInfoManager::GetItemLabel(const CFileItem
*item
, int info
) const
3660 if (!item
) return "";
3662 if (info
>= LISTITEM_PROPERTY_START
&& info
- LISTITEM_PROPERTY_START
< (int)m_listitemProperties
.size())
3663 { // grab the property
3664 CStdString property
= m_listitemProperties
[info
- LISTITEM_PROPERTY_START
];
3665 return item
->GetProperty(property
);
3670 case LISTITEM_LABEL
:
3671 return item
->GetLabel();
3672 case LISTITEM_LABEL2
:
3673 return item
->GetLabel2();
3674 case LISTITEM_TITLE
:
3675 if (item
->HasVideoInfoTag())
3676 return item
->GetVideoInfoTag()->m_strTitle
;
3677 if (item
->HasMusicInfoTag())
3678 return item
->GetMusicInfoTag()->GetTitle();
3680 case LISTITEM_ORIGINALTITLE
:
3681 if (item
->HasVideoInfoTag())
3682 return item
->GetVideoInfoTag()->m_strOriginalTitle
;
3684 case LISTITEM_TRACKNUMBER
:
3687 if (item
->HasMusicInfoTag())
3688 track
.Format("%i", item
->GetMusicInfoTag()->GetTrackNumber());
3692 case LISTITEM_ARTIST
:
3693 if (item
->HasVideoInfoTag())
3694 return item
->GetVideoInfoTag()->m_strArtist
;
3695 if (item
->HasMusicInfoTag())
3696 return item
->GetMusicInfoTag()->GetArtist();
3698 case LISTITEM_ALBUM_ARTIST
:
3699 if (item
->HasMusicInfoTag())
3700 return item
->GetMusicInfoTag()->GetAlbumArtist();
3702 case LISTITEM_DIRECTOR
:
3703 if (item
->HasVideoInfoTag())
3704 return item
->GetVideoInfoTag()->m_strDirector
;
3705 case LISTITEM_ALBUM
:
3706 if (item
->HasVideoInfoTag())
3707 return item
->GetVideoInfoTag()->m_strAlbum
;
3708 if (item
->HasMusicInfoTag())
3709 return item
->GetMusicInfoTag()->GetAlbum();
3712 if (item
->HasVideoInfoTag())
3714 CStdString strResult
;
3715 if (item
->GetVideoInfoTag()->m_iYear
> 0)
3716 strResult
.Format("%i",item
->GetVideoInfoTag()->m_iYear
);
3719 if (item
->HasMusicInfoTag())
3720 return item
->GetMusicInfoTag()->GetYearString();
3722 case LISTITEM_PREMIERED
:
3723 if (item
->HasVideoInfoTag())
3725 if (!item
->GetVideoInfoTag()->m_strFirstAired
.IsEmpty())
3726 return item
->GetVideoInfoTag()->m_strFirstAired
;
3727 if (!item
->GetVideoInfoTag()->m_strPremiered
.IsEmpty())
3728 return item
->GetVideoInfoTag()->m_strPremiered
;
3731 case LISTITEM_GENRE
:
3732 if (item
->HasVideoInfoTag())
3733 return item
->GetVideoInfoTag()->m_strGenre
;
3734 if (item
->HasMusicInfoTag())
3735 return item
->GetMusicInfoTag()->GetGenre();
3737 case LISTITEM_FILENAME
:
3738 if (item
->IsMusicDb() && item
->HasMusicInfoTag())
3739 return CUtil::GetFileName(item
->GetMusicInfoTag()->GetURL());
3740 if (item
->IsVideoDb() && item
->HasVideoInfoTag())
3741 return CUtil::GetFileName(item
->GetVideoInfoTag()->m_strFileNameAndPath
);
3742 return CUtil::GetFileName(item
->m_strPath
);
3744 if (item
->m_dateTime
.IsValid())
3745 return item
->m_dateTime
.GetAsLocalizedDate();
3748 if (!item
->m_bIsFolder
|| item
->m_dwSize
)
3749 return StringUtils::SizeToString(item
->m_dwSize
);
3751 case LISTITEM_RATING
:
3754 if (item
->HasVideoInfoTag() && item
->GetVideoInfoTag()->m_fRating
> 0.f
) // movie rating
3755 rating
.Format("%.1f", item
->GetVideoInfoTag()->m_fRating
);
3756 else if (item
->HasMusicInfoTag() && item
->GetMusicInfoTag()->GetRating() > '0')
3757 { // song rating. Images will probably be better than numbers for this in the long run
3758 rating
= item
->GetMusicInfoTag()->GetRating();
3762 case LISTITEM_RATING_AND_VOTES
:
3764 if (item
->HasVideoInfoTag() && item
->GetVideoInfoTag()->m_fRating
> 0.f
) // movie rating
3766 CStdString strRatingAndVotes
;
3767 if (item
->GetVideoInfoTag()->m_strVotes
.IsEmpty())
3768 strRatingAndVotes
.Format("%.1f", item
->GetVideoInfoTag()->m_fRating
);
3770 strRatingAndVotes
.Format("%.1f (%s %s)", item
->GetVideoInfoTag()->m_fRating
, item
->GetVideoInfoTag()->m_strVotes
, g_localizeStrings
.Get(20350));
3771 return strRatingAndVotes
;
3775 case LISTITEM_PROGRAM_COUNT
:
3778 count
.Format("%i", item
->m_iprogramCount
);
3781 case LISTITEM_DURATION
:
3783 CStdString duration
;
3784 if (item
->HasVideoInfoTag())
3786 if (item
->GetVideoInfoTag()->m_streamDetails
.GetVideoDuration() > 0)
3787 duration
.Format("%i", item
->GetVideoInfoTag()->m_streamDetails
.GetVideoDuration() / 60);
3788 else if (!item
->GetVideoInfoTag()->m_strRuntime
.IsEmpty())
3789 duration
= item
->GetVideoInfoTag()->m_strRuntime
;
3791 if (item
->HasMusicInfoTag())
3793 if (item
->GetMusicInfoTag()->GetDuration() > 0)
3794 duration
= StringUtils::SecondsToTimeString(item
->GetMusicInfoTag()->GetDuration());
3799 if (item
->HasVideoInfoTag())
3801 if (!(!item
->GetVideoInfoTag()->m_strShowTitle
.IsEmpty() && item
->GetVideoInfoTag()->m_iSeason
== -1)) // dont apply to tvshows
3802 if (item
->GetVideoInfoTag()->m_playCount
== 0 && !g_guiSettings
.GetBool("videolibrary.showunwatchedplots"))
3803 return g_localizeStrings
.Get(20370);
3805 return item
->GetVideoInfoTag()->m_strPlot
;
3808 case LISTITEM_PLOT_OUTLINE
:
3809 if (item
->HasVideoInfoTag())
3810 return item
->GetVideoInfoTag()->m_strPlotOutline
;
3812 case LISTITEM_EPISODE
:
3813 if (item
->HasVideoInfoTag())
3815 CStdString strResult
;
3816 if (item
->GetVideoInfoTag()->m_iSpecialSortEpisode
> 0)
3817 strResult
.Format("S%d",item
->GetVideoInfoTag()->m_iEpisode
);
3818 else if (item
->GetVideoInfoTag()->m_iEpisode
> 0) // if m_iEpisode = -1 there's no episode detail
3819 strResult
.Format("%d",item
->GetVideoInfoTag()->m_iEpisode
);
3823 case LISTITEM_SEASON
:
3824 if (item
->HasVideoInfoTag())
3826 CStdString strResult
;
3827 if (item
->GetVideoInfoTag()->m_iSpecialSortSeason
> 0)
3828 strResult
.Format("%d",item
->GetVideoInfoTag()->m_iSpecialSortSeason
);
3829 else if (item
->GetVideoInfoTag()->m_iSeason
> 0) // if m_iSeason = -1 there's no season detail
3830 strResult
.Format("%d",item
->GetVideoInfoTag()->m_iSeason
);
3834 case LISTITEM_TVSHOW
:
3835 if (item
->HasVideoInfoTag())
3836 return item
->GetVideoInfoTag()->m_strShowTitle
;
3838 case LISTITEM_COMMENT
:
3839 if (item
->HasMusicInfoTag())
3840 return item
->GetMusicInfoTag()->GetComment();
3842 case LISTITEM_ACTUAL_ICON
:
3843 return item
->GetIconImage();
3846 CStdString strThumb
= item
->GetThumbnailImage();
3847 if(!strThumb
.IsEmpty() && !g_TextureManager
.CanLoad(strThumb
))
3850 if(strThumb
.IsEmpty() && !item
->GetIconImage().IsEmpty())
3852 strThumb
= item
->GetIconImage();
3853 if (g_SkinInfo
->GetVersion() <= 2.10)
3854 strThumb
.Insert(strThumb
.Find("."), "Big");
3858 case LISTITEM_OVERLAY
:
3859 return item
->GetOverlayImage();
3860 case LISTITEM_THUMB
:
3861 return item
->GetThumbnailImage();
3862 case LISTITEM_FOLDERNAME
:
3866 if (item
->IsMusicDb() && item
->HasMusicInfoTag())
3867 CUtil::GetDirectory(item
->GetMusicInfoTag()->GetURL(), path
);
3868 else if (item
->IsVideoDb() && item
->HasVideoInfoTag())
3870 if( item
->m_bIsFolder
)
3871 path
= item
->GetVideoInfoTag()->m_strPath
;
3873 CUtil::GetParentPath(item
->GetVideoInfoTag()->m_strFileNameAndPath
, path
);
3876 CUtil::GetParentPath(item
->m_strPath
, path
);
3877 path
= CURL(path
).GetWithoutUserDetails();
3878 if (info
==CONTAINER_FOLDERNAME
)
3880 CUtil::RemoveSlashAtEnd(path
);
3881 path
=CUtil::GetFileName(path
);
3883 CUtil::URLDecode(path
);
3886 case LISTITEM_FILENAME_AND_PATH
:
3889 if (item
->IsMusicDb() && item
->HasMusicInfoTag())
3890 path
= item
->GetMusicInfoTag()->GetURL();
3891 else if (item
->IsVideoDb() && item
->HasVideoInfoTag())
3892 path
= item
->GetVideoInfoTag()->m_strFileNameAndPath
;
3894 path
= item
->m_strPath
;
3895 path
= CURL(path
).GetWithoutUserDetails();
3896 CUtil::URLDecode(path
);
3899 case LISTITEM_PICTURE_PATH
:
3900 if (item
->IsPicture() && (!item
->IsZIP() || item
->IsRAR() || item
->IsCBZ() || item
->IsCBR()))
3901 return item
->m_strPath
;
3903 case LISTITEM_PICTURE_DATETIME
:
3904 if (item
->HasPictureInfoTag())
3905 return item
->GetPictureInfoTag()->GetInfo(SLIDE_EXIF_DATE_TIME
);
3907 case LISTITEM_PICTURE_RESOLUTION
:
3908 if (item
->HasPictureInfoTag())
3909 return item
->GetPictureInfoTag()->GetInfo(SLIDE_RESOLUTION
);
3911 case LISTITEM_STUDIO
:
3912 if (item
->HasVideoInfoTag())
3913 return item
->GetVideoInfoTag()->m_strStudio
;
3915 case LISTITEM_COUNTRY
:
3916 if (item
->HasVideoInfoTag())
3917 return item
->GetVideoInfoTag()->m_strCountry
;
3920 if (item
->HasVideoInfoTag())
3921 return item
->GetVideoInfoTag()->m_strMPAARating
;
3924 if (item
->HasVideoInfoTag())
3925 return item
->GetVideoInfoTag()->GetCast();
3927 case LISTITEM_CAST_AND_ROLE
:
3928 if (item
->HasVideoInfoTag())
3929 return item
->GetVideoInfoTag()->GetCast(true);
3931 case LISTITEM_WRITER
:
3932 if (item
->HasVideoInfoTag())
3933 return item
->GetVideoInfoTag()->m_strWritingCredits
;;
3935 case LISTITEM_TAGLINE
:
3936 if (item
->HasVideoInfoTag())
3937 return item
->GetVideoInfoTag()->m_strTagLine
;
3939 case LISTITEM_TRAILER
:
3940 if (item
->HasVideoInfoTag())
3941 return item
->GetVideoInfoTag()->m_strTrailer
;
3943 case LISTITEM_TOP250
:
3944 if (item
->HasVideoInfoTag())
3946 CStdString strResult
;
3947 if (item
->GetVideoInfoTag()->m_iTop250
> 0)
3948 strResult
.Format("%i",item
->GetVideoInfoTag()->m_iTop250
);
3952 case LISTITEM_SORT_LETTER
:
3954 CStdString letter
= g_charsetConverter
.utf8Left(item
->GetSortLabel(), 1);
3959 case LISTITEM_VIDEO_CODEC
:
3960 if (item
->HasVideoInfoTag())
3961 return item
->GetVideoInfoTag()->m_streamDetails
.GetVideoCodec();
3963 case LISTITEM_VIDEO_RESOLUTION
:
3964 if (item
->HasVideoInfoTag())
3965 return CStreamDetails::VideoDimsToResolutionDescription(item
->GetVideoInfoTag()->m_streamDetails
.GetVideoWidth(), item
->GetVideoInfoTag()->m_streamDetails
.GetVideoHeight());
3967 case LISTITEM_VIDEO_ASPECT
:
3968 if (item
->HasVideoInfoTag())
3969 return CStreamDetails::VideoAspectToAspectDescription(item
->GetVideoInfoTag()->m_streamDetails
.GetVideoAspect());
3971 case LISTITEM_AUDIO_CODEC
:
3972 if (item
->HasVideoInfoTag())
3974 return item
->GetVideoInfoTag()->m_streamDetails
.GetAudioCodec();
3977 case LISTITEM_AUDIO_CHANNELS
:
3978 if (item
->HasVideoInfoTag())
3980 CStdString strResult
;
3981 int iChannels
= item
->GetVideoInfoTag()->m_streamDetails
.GetAudioChannels();
3983 strResult
.Format("%i", iChannels
);
3987 case LISTITEM_AUDIO_LANGUAGE
:
3988 if (item
->HasVideoInfoTag())
3989 return item
->GetVideoInfoTag()->m_streamDetails
.GetAudioLanguage();
3991 case LISTITEM_SUBTITLE_LANGUAGE
:
3992 if (item
->HasVideoInfoTag())
3993 return item
->GetVideoInfoTag()->m_streamDetails
.GetSubtitleLanguage();
3999 CStdString
CGUIInfoManager::GetItemImage(const CFileItem
*item
, int info
) const
4003 case LISTITEM_RATING
: // old song rating format
4006 if (item
->HasMusicInfoTag())
4008 rating
.Format("songrating%c.png", item
->GetMusicInfoTag()->GetRating());
4013 case LISTITEM_STAR_RATING
:
4016 if (item
->HasVideoInfoTag())
4017 { // rating for videos is assumed 0..10, so convert to 0..5
4018 rating
.Format("rating%d.png", (long)((item
->GetVideoInfoTag()->m_fRating
* 0.5f
) + 0.5f
));
4020 else if (item
->HasMusicInfoTag())
4022 rating
.Format("rating%c.png", item
->GetMusicInfoTag()->GetRating());
4027 } /* switch (info) */
4029 return GetItemLabel(item
, info
);
4032 bool CGUIInfoManager::GetItemBool(const CGUIListItem
*item
, int condition
) const
4034 if (!item
) return false;
4035 if (condition
>= LISTITEM_PROPERTY_START
&& condition
- LISTITEM_PROPERTY_START
< (int)m_listitemProperties
.size())
4036 { // grab the property
4037 CStdString property
= m_listitemProperties
[condition
- LISTITEM_PROPERTY_START
];
4038 CStdString val
= item
->GetProperty(property
);
4039 return (val
== "1" || val
.CompareNoCase("true") == 0);
4041 else if (condition
== LISTITEM_ISPLAYING
)
4043 if (item
->IsFileItem() && !m_currentFile
->m_strPath
.IsEmpty())
4045 if (!g_application
.m_strPlayListFile
.IsEmpty())
4047 //playlist file that is currently playing or the playlistitem that is currently playing.
4048 return g_application
.m_strPlayListFile
.Equals(((const CFileItem
*)item
)->m_strPath
) || m_currentFile
->IsSamePath((const CFileItem
*)item
);
4050 return m_currentFile
->IsSamePath((const CFileItem
*)item
);
4053 else if (condition
== LISTITEM_ISSELECTED
)
4054 return item
->IsSelected();
4055 else if (condition
== LISTITEM_IS_FOLDER
)
4056 return item
->m_bIsFolder
;
4060 void CGUIInfoManager::ResetCache()
4062 CSingleLock
lock(m_critInfo
);
4063 m_boolCache
.clear();
4064 // reset any animation triggers as well
4065 m_containerMoves
.clear();
4068 void CGUIInfoManager::ResetPersistentCache()
4070 CSingleLock
lock(m_critInfo
);
4071 m_persistentBoolCache
.clear();
4074 inline void CGUIInfoManager::CacheBool(int condition
, int contextWindow
, bool result
, bool persistent
)
4076 // windows have id's up to 13100 or thereabouts (ie 2^14 needed)
4077 // conditionals have id's up to 100000 or thereabouts (ie 2^18 needed)
4078 CSingleLock
lock(m_critInfo
);
4079 int hash
= ((contextWindow
& 0x3fff) << 18) | (condition
& 0x3ffff);
4081 m_persistentBoolCache
.insert(pair
<int, bool>(hash
, result
));
4083 m_boolCache
.insert(pair
<int, bool>(hash
, result
));
4086 bool CGUIInfoManager::IsCached(int condition
, int contextWindow
, bool &result
) const
4088 // windows have id's up to 13100 or thereabouts (ie 2^14 needed)
4089 // conditionals have id's up to 100000 or thereabouts (ie 2^18 needed)
4091 CSingleLock
lock(m_critInfo
);
4092 int hash
= ((contextWindow
& 0x3fff) << 18) | (condition
& 0x3ffff);
4093 map
<int, bool>::const_iterator it
= m_boolCache
.find(hash
);
4094 if (it
!= m_boolCache
.end())
4096 result
= (*it
).second
;
4099 it
= m_persistentBoolCache
.find(hash
);
4100 if (it
!= m_persistentBoolCache
.end())
4102 result
= (*it
).second
;
4109 // Called from tuxbox service thread to update current status
4110 void CGUIInfoManager::UpdateFromTuxBox()
4112 if(g_tuxbox
.vVideoSubChannel
.mode
)
4113 m_currentFile
->GetVideoInfoTag()->m_strTitle
= g_tuxbox
.vVideoSubChannel
.current_name
;
4115 // Set m_currentMovieDuration
4116 if(!g_tuxbox
.sCurSrvData
.current_event_duration
.IsEmpty() &&
4117 !g_tuxbox
.sCurSrvData
.next_event_description
.IsEmpty() &&
4118 !g_tuxbox
.sCurSrvData
.current_event_duration
.Equals("-") &&
4119 !g_tuxbox
.sCurSrvData
.next_event_description
.Equals("-"))
4121 g_tuxbox
.sCurSrvData
.current_event_duration
.Replace("(","");
4122 g_tuxbox
.sCurSrvData
.current_event_duration
.Replace(")","");
4124 m_currentMovieDuration
.Format("%s: %s %s (%s - %s)",
4125 g_localizeStrings
.Get(180),
4126 g_tuxbox
.sCurSrvData
.current_event_duration
,
4127 g_localizeStrings
.Get(12391),
4128 g_tuxbox
.sCurSrvData
.current_event_time
,
4129 g_tuxbox
.sCurSrvData
.next_event_time
);
4133 if (!g_tuxbox
.sCurSrvData
.current_event_description
.IsEmpty() &&
4134 !g_tuxbox
.sCurSrvData
.next_event_description
.IsEmpty() &&
4135 !g_tuxbox
.sCurSrvData
.current_event_description
.Equals("-") &&
4136 !g_tuxbox
.sCurSrvData
.next_event_description
.Equals("-"))
4138 m_currentFile
->GetVideoInfoTag()->m_strGenre
.Format("%s %s - (%s: %s)",
4139 g_localizeStrings
.Get(143),
4140 g_tuxbox
.sCurSrvData
.current_event_description
,
4141 g_localizeStrings
.Get(209),
4142 g_tuxbox
.sCurSrvData
.next_event_description
);
4145 //Set m_currentMovie.m_strDirector
4146 if (!g_tuxbox
.sCurSrvData
.current_event_details
.Equals("-") &&
4147 !g_tuxbox
.sCurSrvData
.current_event_details
.IsEmpty())
4149 m_currentFile
->GetVideoInfoTag()->m_strDirector
= g_tuxbox
.sCurSrvData
.current_event_details
;
4153 CStdString
CGUIInfoManager::GetPictureLabel(int info
) const
4155 if (info
== SLIDE_FILE_NAME
)
4156 return GetItemLabel(m_currentSlide
, LISTITEM_FILENAME
);
4157 else if (info
== SLIDE_FILE_PATH
)
4160 CUtil::GetDirectory(m_currentSlide
->m_strPath
, path
);
4161 return CURL(path
).GetWithoutUserDetails();
4163 else if (info
== SLIDE_FILE_SIZE
)
4164 return GetItemLabel(m_currentSlide
, LISTITEM_SIZE
);
4165 else if (info
== SLIDE_FILE_DATE
)
4166 return GetItemLabel(m_currentSlide
, LISTITEM_DATE
);
4167 else if (info
== SLIDE_INDEX
)
4169 CGUIWindowSlideShow
*slideshow
= (CGUIWindowSlideShow
*)g_windowManager
.GetWindow(WINDOW_SLIDESHOW
);
4170 if (slideshow
&& slideshow
->NumSlides())
4173 index
.Format("%d/%d", slideshow
->CurrentSlide(), slideshow
->NumSlides());
4177 if (m_currentSlide
->HasPictureInfoTag())
4178 return m_currentSlide
->GetPictureInfoTag()->GetInfo(info
);
4182 void CGUIInfoManager::SetCurrentSlide(CFileItem
&item
)
4184 if (m_currentSlide
->m_strPath
!= item
.m_strPath
)
4186 if (!item
.HasPictureInfoTag() && !item
.GetPictureInfoTag()->Loaded())
4187 item
.GetPictureInfoTag()->Load(item
.m_strPath
);
4188 *m_currentSlide
= item
;
4192 void CGUIInfoManager::ResetCurrentSlide()
4194 m_currentSlide
->Reset();
4197 bool CGUIInfoManager::CheckWindowCondition(CGUIWindow
*window
, int condition
) const
4199 // check if it satisfies our condition
4200 if (!window
) return false;
4201 if ((condition
& WINDOW_CONDITION_HAS_LIST_ITEMS
) && !window
->HasListItems())
4203 if ((condition
& WINDOW_CONDITION_IS_MEDIA_WINDOW
) && !window
->IsMediaWindow())
4208 CGUIWindow
*CGUIInfoManager::GetWindowWithCondition(int contextWindow
, int condition
) const
4210 CGUIWindow
*window
= g_windowManager
.GetWindow(contextWindow
);
4211 if (CheckWindowCondition(window
, condition
))
4214 // try topmost dialog
4215 window
= g_windowManager
.GetWindow(g_windowManager
.GetTopMostModalDialogID());
4216 if (CheckWindowCondition(window
, condition
))
4219 // try active window
4220 window
= g_windowManager
.GetWindow(g_windowManager
.GetActiveWindow());
4221 if (CheckWindowCondition(window
, condition
))
4227 void CGUIInfoManager::SetCurrentVideoTag(const CVideoInfoTag
&tag
)
4229 *m_currentFile
->GetVideoInfoTag() = tag
;
4230 m_currentFile
->m_lStartOffset
= 0;
4233 void CGUIInfoManager::SetCurrentSongTag(const MUSIC_INFO::CMusicInfoTag
&tag
)
4235 //CLog::Log(LOGDEBUG, "Asked to SetCurrentTag");
4236 *m_currentFile
->GetMusicInfoTag() = tag
;
4237 m_currentFile
->m_lStartOffset
= 0;
4240 const CFileItem
& CGUIInfoManager::GetCurrentSlide() const
4242 return *m_currentSlide
;
4245 const MUSIC_INFO::CMusicInfoTag
* CGUIInfoManager::GetCurrentSongTag() const
4247 if (m_currentFile
->HasMusicInfoTag())
4248 return m_currentFile
->GetMusicInfoTag();
4253 const CVideoInfoTag
* CGUIInfoManager::GetCurrentMovieTag() const
4255 if (m_currentFile
->HasVideoInfoTag())
4256 return m_currentFile
->GetVideoInfoTag();
4261 void GUIInfo::SetInfoFlag(uint32_t flag
)
4263 assert(flag
>= (1 << 24));
4267 uint32_t GUIInfo::GetInfoFlag() const
4269 // we strip out the bottom 24 bits, where we keep data
4270 // and return the flag only
4271 return m_data1
& 0xff000000;
4274 uint32_t GUIInfo::GetData1() const
4276 // we strip out the top 8 bits, where we keep flags
4277 // and return the unflagged data
4278 return m_data1
& ((1 << 24) -1);
4281 int GUIInfo::GetData2() const
4286 void CGUIInfoManager::SetLibraryBool(int condition
, bool value
)
4290 case LIBRARY_HAS_MUSIC
:
4291 m_libraryHasMusic
= value
? 1 : 0;
4293 case LIBRARY_HAS_MOVIES
:
4294 m_libraryHasMovies
= value
? 1 : 0;
4296 case LIBRARY_HAS_TVSHOWS
:
4297 m_libraryHasTVShows
= value
? 1 : 0;
4299 case LIBRARY_HAS_MUSICVIDEOS
:
4300 m_libraryHasMusicVideos
= value
? 1 : 0;
4307 void CGUIInfoManager::ResetLibraryBools()
4309 m_libraryHasMusic
= -1;
4310 m_libraryHasMovies
= -1;
4311 m_libraryHasTVShows
= -1;
4312 m_libraryHasMusicVideos
= -1;
4315 bool CGUIInfoManager::GetLibraryBool(int condition
)
4317 if (condition
== LIBRARY_HAS_MUSIC
)
4319 if (m_libraryHasMusic
< 0)
4324 m_libraryHasMusic
= (db
.GetSongsCount() > 0) ? 1 : 0;
4328 return m_libraryHasMusic
> 0;
4330 else if (condition
== LIBRARY_HAS_MOVIES
)
4332 if (m_libraryHasMovies
< 0)
4337 m_libraryHasMovies
= db
.HasContent(VIDEODB_CONTENT_MOVIES
) ? 1 : 0;
4341 return m_libraryHasMovies
> 0;
4343 else if (condition
== LIBRARY_HAS_TVSHOWS
)
4345 if (m_libraryHasTVShows
< 0)
4350 m_libraryHasTVShows
= db
.HasContent(VIDEODB_CONTENT_TVSHOWS
) ? 1 : 0;
4354 return m_libraryHasTVShows
> 0;
4356 else if (condition
== LIBRARY_HAS_MUSICVIDEOS
)
4358 if (m_libraryHasMusicVideos
< 0)
4363 m_libraryHasMusicVideos
= db
.HasContent(VIDEODB_CONTENT_MUSICVIDEOS
) ? 1 : 0;
4367 return m_libraryHasMusicVideos
> 0;
4369 else if (condition
== LIBRARY_HAS_VIDEO
)
4371 return (GetLibraryBool(LIBRARY_HAS_MOVIES
) ||
4372 GetLibraryBool(LIBRARY_HAS_TVSHOWS
) ||
4373 GetLibraryBool(LIBRARY_HAS_MUSICVIDEOS
));