[319e11]: xbmc / utils / GUIInfoManager.cpp  Maximize  Restore  History

Repo status: analyzing...

Download this file

4412 lines (4230 with data), 167.3 kB

   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
/*
* Copyright (C) 2005-2008 Team XBMC
* http://www.xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
#include "system.h"
#include "GUIDialogSeekBar.h"
#include "GUIMediaWindow.h"
#include "GUIDialogFileBrowser.h"
#include "GUIDialogContentSettings.h"
#include "GUIDialogProgress.h"
#include "Application.h"
#include "Util.h"
#include "lib/libscrobbler/lastfmscrobbler.h"
#include "Weather.h"
#include "PartyModeManager.h"
#include "addons/Visualisation.h"
#include "ButtonTranslator.h"
#include "utils/AlarmClock.h"
#ifdef HAS_LCD
#include "utils/LCD.h"
#endif
#include "GUIPassword.h"
#include "LangInfo.h"
#include "SystemInfo.h"
#include "GUIButtonScroller.h"
#include "GUITextBox.h"
#include "GUIInfoManager.h"
#include "GUIWindowSlideShow.h"
#include "LastFmManager.h"
#include "PictureInfoTag.h"
#include "MusicInfoTag.h"
#include "GUIDialogMusicScan.h"
#include "GUIDialogVideoScan.h"
#include "GUIWindowManager.h"
#include "FileSystem/File.h"
#include "PlayList.h"
#include "TuxBoxUtil.h"
#include "WindowingFactory.h"
#include "PowerManager.h"
#include "AdvancedSettings.h"
#include "Settings.h"
#include "LocalizeStrings.h"
#include "CPUInfo.h"
#include "StringUtils.h"
#include "MathUtils.h"
// stuff for current song
#include "MusicInfoTagLoaderFactory.h"
#include "MusicInfoLoader.h"
#include "LabelFormatter.h"
#include "GUIUserMessages.h"
#include "GUIWindowVideoInfo.h"
#include "GUIWindowMusicInfo.h"
#include "MediaManager.h"
#include "TimeUtils.h"
#include "SingleLock.h"
#include "log.h"
#include "addons/AddonManager.h"
#define SYSHEATUPDATEINTERVAL 60000
using namespace std;
using namespace XFILE;
using namespace MUSIC_INFO;
using namespace ADDON;
CGUIInfoManager::CCombinedValue& CGUIInfoManager::CCombinedValue::operator =(const CGUIInfoManager::CCombinedValue& mSrc)
{
this->m_info = mSrc.m_info;
this->m_id = mSrc.m_id;
this->m_postfix = mSrc.m_postfix;
return *this;
}
CGUIInfoManager::CGUIInfoManager(void)
{
m_lastSysHeatInfoTime = -SYSHEATUPDATEINTERVAL; // make sure we grab CPU temp on the first pass
m_lastMusicBitrateTime = 0;
m_fanSpeed = 0;
m_AfterSeekTimeout = 0;
m_seekOffset = 0;
m_playerSeeking = false;
m_performingSeek = false;
m_nextWindowID = WINDOW_INVALID;
m_prevWindowID = WINDOW_INVALID;
m_stringParameters.push_back("__ZZZZ__"); // to offset the string parameters by 1 to assure that all entries are non-zero
m_currentFile = new CFileItem;
m_currentSlide = new CFileItem;
m_frameCounter = 0;
m_lastFPSTime = 0;
ResetLibraryBools();
}
CGUIInfoManager::~CGUIInfoManager(void)
{
delete m_currentFile;
delete m_currentSlide;
}
bool CGUIInfoManager::OnMessage(CGUIMessage &message)
{
if (message.GetMessage() == GUI_MSG_NOTIFY_ALL)
{
if (message.GetParam1() == GUI_MSG_UPDATE_ITEM && message.GetItem())
{
CFileItemPtr item = boost::static_pointer_cast<CFileItem>(message.GetItem());
if (item && m_currentFile->m_strPath.Equals(item->m_strPath))
*m_currentFile = *item;
return true;
}
}
return false;
}
/// \brief Translates a string as given by the skin into an int that we use for more
/// efficient retrieval of data. Can handle combined strings on the form
/// Player.Caching + VideoPlayer.IsFullscreen (Logical and)
/// Player.HasVideo | Player.HasAudio (Logical or)
int CGUIInfoManager::TranslateString(const CStdString &condition)
{
// translate $LOCALIZE as required
CStdString strCondition(CGUIInfoLabel::ReplaceLocalize(condition));
if (strCondition.find_first_of("|") != strCondition.npos ||
strCondition.find_first_of("+") != strCondition.npos ||
strCondition.find_first_of("[") != strCondition.npos ||
strCondition.find_first_of("]") != strCondition.npos)
{
// Have a boolean expression
// Check if this was added before
vector<CCombinedValue>::iterator it;
for(it = m_CombinedValues.begin(); it != m_CombinedValues.end(); it++)
{
if(strCondition.CompareNoCase(it->m_info) == 0)
return it->m_id;
}
return TranslateBooleanExpression(strCondition);
}
//Just single command.
return TranslateSingleString(strCondition);
}
/// \brief Translates a string as given by the skin into an int that we use for more
/// efficient retrieval of data.
int CGUIInfoManager::TranslateSingleString(const CStdString &strCondition)
{
// trim whitespace, and convert to lowercase
CStdString strTest = strCondition;
strTest.TrimLeft(" \t\r\n");
strTest.TrimRight(" \t\r\n");
if (strTest.IsEmpty()) return 0;
bool bNegate = strTest[0] == '!';
int ret = 0;
if(bNegate)
strTest.Delete(0, 1);
CStdString original(strTest);
strTest.ToLower();
CStdString strCategory = strTest.Left(strTest.Find("."));
// translate conditions...
if (strTest.Equals("false") || strTest.Equals("no") || strTest.Equals("off")) ret = SYSTEM_ALWAYS_FALSE;
else if (strTest.Equals("true") || strTest.Equals("yes") || strTest.Equals("on")) ret = SYSTEM_ALWAYS_TRUE;
if (strCategory.Equals("player"))
{
if (strTest.Equals("player.hasmedia")) ret = PLAYER_HAS_MEDIA;
else if (strTest.Equals("player.hasaudio")) ret = PLAYER_HAS_AUDIO;
else if (strTest.Equals("player.hasvideo")) ret = PLAYER_HAS_VIDEO;
else if (strTest.Equals("player.playing")) ret = PLAYER_PLAYING;
else if (strTest.Equals("player.paused")) ret = PLAYER_PAUSED;
else if (strTest.Equals("player.rewinding")) ret = PLAYER_REWINDING;
else if (strTest.Equals("player.forwarding")) ret = PLAYER_FORWARDING;
else if (strTest.Equals("player.rewinding2x")) ret = PLAYER_REWINDING_2x;
else if (strTest.Equals("player.rewinding4x")) ret = PLAYER_REWINDING_4x;
else if (strTest.Equals("player.rewinding8x")) ret = PLAYER_REWINDING_8x;
else if (strTest.Equals("player.rewinding16x")) ret = PLAYER_REWINDING_16x;
else if (strTest.Equals("player.rewinding32x")) ret = PLAYER_REWINDING_32x;
else if (strTest.Equals("player.forwarding2x")) ret = PLAYER_FORWARDING_2x;
else if (strTest.Equals("player.forwarding4x")) ret = PLAYER_FORWARDING_4x;
else if (strTest.Equals("player.forwarding8x")) ret = PLAYER_FORWARDING_8x;
else if (strTest.Equals("player.forwarding16x")) ret = PLAYER_FORWARDING_16x;
else if (strTest.Equals("player.forwarding32x")) ret = PLAYER_FORWARDING_32x;
else if (strTest.Equals("player.canrecord")) ret = PLAYER_CAN_RECORD;
else if (strTest.Equals("player.recording")) ret = PLAYER_RECORDING;
else if (strTest.Equals("player.displayafterseek")) ret = PLAYER_DISPLAY_AFTER_SEEK;
else if (strTest.Equals("player.caching")) ret = PLAYER_CACHING;
else if (strTest.Equals("player.cachelevel")) ret = PLAYER_CACHELEVEL;
else if (strTest.Equals("player.seekbar")) ret = PLAYER_SEEKBAR;
else if (strTest.Equals("player.progress")) ret = PLAYER_PROGRESS;
else if (strTest.Equals("player.seeking")) ret = PLAYER_SEEKING;
else if (strTest.Equals("player.showtime")) ret = PLAYER_SHOWTIME;
else if (strTest.Equals("player.showcodec")) ret = PLAYER_SHOWCODEC;
else if (strTest.Equals("player.showinfo")) ret = PLAYER_SHOWINFO;
else if (strTest.Left(15).Equals("player.seektime")) return AddMultiInfo(GUIInfo(PLAYER_SEEKTIME, TranslateTimeFormat(strTest.Mid(15))));
else if (strTest.Left(17).Equals("player.seekoffset")) return AddMultiInfo(GUIInfo(PLAYER_SEEKOFFSET, TranslateTimeFormat(strTest.Mid(17))));
else if (strTest.Left(20).Equals("player.timeremaining")) return AddMultiInfo(GUIInfo(PLAYER_TIME_REMAINING, TranslateTimeFormat(strTest.Mid(20))));
else if (strTest.Left(16).Equals("player.timespeed")) return AddMultiInfo(GUIInfo(PLAYER_TIME_SPEED, TranslateTimeFormat(strTest.Mid(16))));
else if (strTest.Left(11).Equals("player.time")) return AddMultiInfo(GUIInfo(PLAYER_TIME, TranslateTimeFormat(strTest.Mid(11))));
else if (strTest.Left(15).Equals("player.duration")) return AddMultiInfo(GUIInfo(PLAYER_DURATION, TranslateTimeFormat(strTest.Mid(15))));
else if (strTest.Left(17).Equals("player.finishtime")) return AddMultiInfo(GUIInfo(PLAYER_FINISH_TIME, TranslateTimeFormat(strTest.Mid(17))));
else if (strTest.Equals("player.volume")) ret = PLAYER_VOLUME;
else if (strTest.Equals("player.subtitledelay")) ret = PLAYER_SUBTITLE_DELAY;
else if (strTest.Equals("player.audiodelay")) ret = PLAYER_AUDIO_DELAY;
else if (strTest.Equals("player.muted")) ret = PLAYER_MUTED;
else if (strTest.Equals("player.hasduration")) ret = PLAYER_HASDURATION;
else if (strTest.Equals("player.chapter")) ret = PLAYER_CHAPTER;
else if (strTest.Equals("player.chaptercount")) ret = PLAYER_CHAPTERCOUNT;
else if (strTest.Equals("player.chaptername")) ret = PLAYER_CHAPTERNAME;
else if (strTest.Equals("player.starrating")) ret = PLAYER_STAR_RATING;
else if (strTest.Equals("player.passthrough")) ret = PLAYER_PASSTHROUGH;
else if (strTest.Equals("player.folderpath")) ret = PLAYER_PATH;
else if (strTest.Equals("player.filenameandpath")) ret = PLAYER_FILEPATH;
}
else if (strCategory.Equals("weather"))
{
if (strTest.Equals("weather.conditions")) ret = WEATHER_CONDITIONS;
else if (strTest.Equals("weather.temperature")) ret = WEATHER_TEMPERATURE;
else if (strTest.Equals("weather.location")) ret = WEATHER_LOCATION;
else if (strTest.Equals("weather.isfetched")) ret = WEATHER_IS_FETCHED;
else if (strTest.Equals("weather.fanartcode")) ret = WEATHER_FANART_CODE;
else if (strTest.Equals("weather.plugin")) ret = WEATHER_PLUGIN;
}
else if (strCategory.Equals("bar"))
{
if (strTest.Equals("bar.gputemperature")) ret = SYSTEM_GPU_TEMPERATURE;
else if (strTest.Equals("bar.cputemperature")) ret = SYSTEM_CPU_TEMPERATURE;
else if (strTest.Equals("bar.cpuusage")) ret = SYSTEM_CPU_USAGE;
else if (strTest.Equals("bar.freememory")) ret = SYSTEM_FREE_MEMORY;
else if (strTest.Equals("bar.usedmemory")) ret = SYSTEM_USED_MEMORY;
else if (strTest.Equals("bar.fanspeed")) ret = SYSTEM_FAN_SPEED;
else if (strTest.Equals("bar.usedspace")) ret = SYSTEM_USED_SPACE;
else if (strTest.Equals("bar.freespace")) ret = SYSTEM_FREE_SPACE;
else if (strTest.Equals("bar.usedspace(c)")) ret = SYSTEM_USED_SPACE_C;
else if (strTest.Equals("bar.freespace(c)")) ret = SYSTEM_FREE_SPACE_C;
else if (strTest.Equals("bar.usedspace(e)")) ret = SYSTEM_USED_SPACE_E;
else if (strTest.Equals("bar.freespace(e)")) ret = SYSTEM_FREE_SPACE_E;
else if (strTest.Equals("bar.usedspace(f)")) ret = SYSTEM_USED_SPACE_F;
else if (strTest.Equals("bar.freespace(f)")) ret = SYSTEM_FREE_SPACE_F;
else if (strTest.Equals("bar.usedspace(g)")) ret = SYSTEM_USED_SPACE_G;
else if (strTest.Equals("bar.freespace(g)")) ret = SYSTEM_FREE_SPACE_G;
else if (strTest.Equals("bar.usedspace(x)")) ret = SYSTEM_USED_SPACE_X;
else if (strTest.Equals("bar.freespace(x)")) ret = SYSTEM_FREE_SPACE_X;
else if (strTest.Equals("bar.usedspace(y)")) ret = SYSTEM_USED_SPACE_Y;
else if (strTest.Equals("bar.freespace(y)")) ret = SYSTEM_FREE_SPACE_Y;
else if (strTest.Equals("bar.usedspace(z)")) ret = SYSTEM_USED_SPACE_Z;
else if (strTest.Equals("bar.freespace(z)")) ret = SYSTEM_FREE_SPACE_Z;
else if (strTest.Equals("bar.hddtemperature")) ret = SYSTEM_HDD_TEMPERATURE;
}
else if (strCategory.Equals("system"))
{
if (strTest.Equals("system.date")) ret = SYSTEM_DATE;
else if (strTest.Left(12).Equals("system.date("))
{
// the skin must submit the date in the format MM-DD
// This InfoBool is designed for generic range checking, so year is NOT used. Only Month-Day.
CStdString param = strTest.Mid(12, strTest.length() - 13);
CStdStringArray params;
StringUtils::SplitString(param, ",", params);
if (params.size() == 2)
return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_DATE : SYSTEM_DATE, StringUtils::DateStringToYYYYMMDD(params[0]) % 10000, StringUtils::DateStringToYYYYMMDD(params[1]) % 10000));
else if (params.size() == 1)
return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_DATE : SYSTEM_DATE, StringUtils::DateStringToYYYYMMDD(params[0]) % 10000));
}
else if (strTest.Left(11).Equals("system.time"))
{
// 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
// essentially if it isn't a valid TIME_FORMAT then its considered to be the latter.
CStdString param = strTest.Mid(11);
TIME_FORMAT timeFormat = TranslateTimeFormat(param);
if ((timeFormat == TIME_FORMAT_GUESS) && (!param.IsEmpty()))
{
param = strTest.Mid(12, strTest.length() - 13);
CStdStringArray params;
StringUtils::SplitString(param, ",", params);
if (params.size() == 2)
return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_TIME : SYSTEM_TIME, StringUtils::TimeStringToSeconds(params[0]), StringUtils::TimeStringToSeconds(params[1])));
else if (params.size() == 1)
return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_TIME : SYSTEM_TIME, StringUtils::TimeStringToSeconds(params[0])));
}
else
return AddMultiInfo(GUIInfo(SYSTEM_TIME, timeFormat));
}
else if (strTest.Equals("system.cputemperature")) ret = SYSTEM_CPU_TEMPERATURE;
else if (strTest.Equals("system.cpuusage")) ret = SYSTEM_CPU_USAGE;
else if (strTest.Equals("system.gputemperature")) ret = SYSTEM_GPU_TEMPERATURE;
else if (strTest.Equals("system.fanspeed")) ret = SYSTEM_FAN_SPEED;
else if (strTest.Equals("system.freespace")) ret = SYSTEM_FREE_SPACE;
else if (strTest.Equals("system.usedspace")) ret = SYSTEM_USED_SPACE;
else if (strTest.Equals("system.totalspace")) ret = SYSTEM_TOTAL_SPACE;
else if (strTest.Equals("system.usedspacepercent")) ret = SYSTEM_USED_SPACE_PERCENT;
else if (strTest.Equals("system.freespacepercent")) ret = SYSTEM_FREE_SPACE_PERCENT;
else if (strTest.Equals("system.freespace(c)")) ret = SYSTEM_FREE_SPACE_C;
else if (strTest.Equals("system.usedspace(c)")) ret = SYSTEM_USED_SPACE_C;
else if (strTest.Equals("system.totalspace(c)")) ret = SYSTEM_TOTAL_SPACE_C;
else if (strTest.Equals("system.usedspacepercent(c)")) ret = SYSTEM_USED_SPACE_PERCENT_C;
else if (strTest.Equals("system.freespacepercent(c)")) ret = SYSTEM_FREE_SPACE_PERCENT_C;
else if (strTest.Equals("system.freespace(e)")) ret = SYSTEM_FREE_SPACE_E;
else if (strTest.Equals("system.usedspace(e)")) ret = SYSTEM_USED_SPACE_E;
else if (strTest.Equals("system.totalspace(e)")) ret = SYSTEM_TOTAL_SPACE_E;
else if (strTest.Equals("system.usedspacepercent(e)")) ret = SYSTEM_USED_SPACE_PERCENT_E;
else if (strTest.Equals("system.freespacepercent(e)")) ret = SYSTEM_FREE_SPACE_PERCENT_E;
else if (strTest.Equals("system.freespace(f)")) ret = SYSTEM_FREE_SPACE_F;
else if (strTest.Equals("system.usedspace(f)")) ret = SYSTEM_USED_SPACE_F;
else if (strTest.Equals("system.totalspace(f)")) ret = SYSTEM_TOTAL_SPACE_F;
else if (strTest.Equals("system.usedspacepercent(f)")) ret = SYSTEM_USED_SPACE_PERCENT_F;
else if (strTest.Equals("system.freespacepercent(f)")) ret = SYSTEM_FREE_SPACE_PERCENT_F;
else if (strTest.Equals("system.freespace(g)")) ret = SYSTEM_FREE_SPACE_G;
else if (strTest.Equals("system.usedspace(g)")) ret = SYSTEM_USED_SPACE_G;
else if (strTest.Equals("system.totalspace(g)")) ret = SYSTEM_TOTAL_SPACE_G;
else if (strTest.Equals("system.usedspacepercent(g)")) ret = SYSTEM_USED_SPACE_PERCENT_G;
else if (strTest.Equals("system.freespacepercent(g)")) ret = SYSTEM_FREE_SPACE_PERCENT_G;
else if (strTest.Equals("system.usedspace(x)")) ret = SYSTEM_USED_SPACE_X;
else if (strTest.Equals("system.freespace(x)")) ret = SYSTEM_FREE_SPACE_X;
else if (strTest.Equals("system.totalspace(x)")) ret = SYSTEM_TOTAL_SPACE_X;
else if (strTest.Equals("system.usedspace(y)")) ret = SYSTEM_USED_SPACE_Y;
else if (strTest.Equals("system.freespace(y)")) ret = SYSTEM_FREE_SPACE_Y;
else if (strTest.Equals("system.totalspace(y)")) ret = SYSTEM_TOTAL_SPACE_Y;
else if (strTest.Equals("system.usedspace(z)")) ret = SYSTEM_USED_SPACE_Z;
else if (strTest.Equals("system.freespace(z)")) ret = SYSTEM_FREE_SPACE_Z;
else if (strTest.Equals("system.totalspace(z)")) ret = SYSTEM_TOTAL_SPACE_Z;
else if (strTest.Equals("system.buildversion")) ret = SYSTEM_BUILD_VERSION;
else if (strTest.Equals("system.builddate")) ret = SYSTEM_BUILD_DATE;
else if (strTest.Equals("system.hasnetwork")) ret = SYSTEM_ETHERNET_LINK_ACTIVE;
else if (strTest.Equals("system.fps")) ret = SYSTEM_FPS;
else if (strTest.Equals("system.hasmediadvd")) ret = SYSTEM_MEDIA_DVD;
else if (strTest.Equals("system.dvdready")) ret = SYSTEM_DVDREADY;
else if (strTest.Equals("system.trayopen")) ret = SYSTEM_TRAYOPEN;
else if (strTest.Equals("system.dvdtraystate")) ret = SYSTEM_DVD_TRAY_STATE;
else if (strTest.Equals("system.memory(free)") || strTest.Equals("system.freememory")) ret = SYSTEM_FREE_MEMORY;
else if (strTest.Equals("system.memory(free.percent)")) ret = SYSTEM_FREE_MEMORY_PERCENT;
else if (strTest.Equals("system.memory(used)")) ret = SYSTEM_USED_MEMORY;
else if (strTest.Equals("system.memory(used.percent)")) ret = SYSTEM_USED_MEMORY_PERCENT;
else if (strTest.Equals("system.memory(total)")) ret = SYSTEM_TOTAL_MEMORY;
else if (strTest.Equals("system.language")) ret = SYSTEM_LANGUAGE;
else if (strTest.Equals("system.temperatureunits")) ret = SYSTEM_TEMPERATURE_UNITS;
else if (strTest.Equals("system.screenmode")) ret = SYSTEM_SCREEN_MODE;
else if (strTest.Equals("system.screenwidth")) ret = SYSTEM_SCREEN_WIDTH;
else if (strTest.Equals("system.screenheight")) ret = SYSTEM_SCREEN_HEIGHT;
else if (strTest.Equals("system.currentwindow")) ret = SYSTEM_CURRENT_WINDOW;
else if (strTest.Equals("system.currentcontrol")) ret = SYSTEM_CURRENT_CONTROL;
else if (strTest.Equals("system.dvdlabel")) ret = SYSTEM_DVD_LABEL;
else if (strTest.Equals("system.haslocks")) ret = SYSTEM_HASLOCKS;
else if (strTest.Equals("system.hasloginscreen")) ret = SYSTEM_HAS_LOGINSCREEN;
else if (strTest.Equals("system.ismaster")) ret = SYSTEM_ISMASTER;
else if (strTest.Equals("system.internetstate")) ret = SYSTEM_INTERNET_STATE;
else if (strTest.Equals("system.loggedon")) ret = SYSTEM_LOGGEDON;
else if (strTest.Equals("system.hasdrivef")) ret = SYSTEM_HAS_DRIVE_F;
else if (strTest.Equals("system.hasdriveg")) ret = SYSTEM_HAS_DRIVE_G;
else if (strTest.Equals("system.kernelversion")) ret = SYSTEM_KERNEL_VERSION;
else if (strTest.Equals("system.uptime")) ret = SYSTEM_UPTIME;
else if (strTest.Equals("system.totaluptime")) ret = SYSTEM_TOTALUPTIME;
else if (strTest.Equals("system.cpufrequency")) ret = SYSTEM_CPUFREQUENCY;
else if (strTest.Equals("system.screenresolution")) ret = SYSTEM_SCREEN_RESOLUTION;
else if (strTest.Equals("system.videoencoderinfo")) ret = SYSTEM_VIDEO_ENCODER_INFO;
else if (strTest.Left(16).Equals("system.idletime("))
{
int time = atoi((strTest.Mid(16, strTest.GetLength() - 17).c_str()));
if (time > SYSTEM_IDLE_TIME_FINISH - SYSTEM_IDLE_TIME_START)
time = SYSTEM_IDLE_TIME_FINISH - SYSTEM_IDLE_TIME_START;
if (time > 0)
ret = SYSTEM_IDLE_TIME_START + time;
}
else if (strTest.Left(16).Equals("system.hasalarm("))
return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_HAS_ALARM : SYSTEM_HAS_ALARM, ConditionalStringParameter(strTest.Mid(16,strTest.size()-17)), 0));
else if (strTest.Equals("system.alarmpos")) ret = SYSTEM_ALARM_POS;
else if (strTest.Left(24).Equals("system.alarmlessorequal("))
{
int pos = strTest.Find(",");
int skinOffset = ConditionalStringParameter(strTest.Mid(24, pos-24));
int compareString = ConditionalStringParameter(strTest.Mid(pos + 1, strTest.GetLength() - (pos + 2)));
return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_ALARM_LESS_OR_EQUAL: SYSTEM_ALARM_LESS_OR_EQUAL, skinOffset, compareString));
}
else if (strTest.Equals("system.profilename")) ret = SYSTEM_PROFILENAME;
else if (strTest.Equals("system.profilethumb")) ret = SYSTEM_PROFILETHUMB;
else if (strTest.Equals("system.progressbar")) ret = SYSTEM_PROGRESS_BAR;
else if (strTest.Equals("system.platform.linux")) ret = SYSTEM_PLATFORM_LINUX;
else if (strTest.Equals("system.platform.xbox")) ret = SYSTEM_PLATFORM_XBOX;
else if (strTest.Equals("system.platform.windows")) ret = SYSTEM_PLATFORM_WINDOWS;
else if (strTest.Equals("system.platform.osx")) ret = SYSTEM_PLATFORM_OSX;
else if (strTest.Left(15).Equals("system.getbool("))
return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_GET_BOOL : SYSTEM_GET_BOOL, ConditionalStringParameter(strTest.Mid(15,strTest.size()-16)), 0));
else if (strTest.Left(17).Equals("system.coreusage("))
return AddMultiInfo(GUIInfo(SYSTEM_GET_CORE_USAGE, atoi(strTest.Mid(17,strTest.size()-18)), 0));
else if (strTest.Left(17).Equals("system.hascoreid("))
return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_HAS_CORE_ID : SYSTEM_HAS_CORE_ID, ConditionalStringParameter(strTest.Mid(17,strTest.size()-18)), 0));
else if (strTest.Left(15).Equals("system.setting("))
return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_SETTING : SYSTEM_SETTING, ConditionalStringParameter(strTest.Mid(15,strTest.size()-16)), 0));
else if (strTest.Equals("system.canpowerdown")) ret = SYSTEM_CAN_POWERDOWN;
else if (strTest.Equals("system.cansuspend")) ret = SYSTEM_CAN_SUSPEND;
else if (strTest.Equals("system.canhibernate")) ret = SYSTEM_CAN_HIBERNATE;
else if (strTest.Equals("system.canreboot")) ret = SYSTEM_CAN_REBOOT;
else if (strTest.Left(16).Equals("system.hasaddon("))
return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_HAS_ADDON: SYSTEM_HAS_ADDON, ConditionalStringParameter(strTest.Mid(16,strTest.size()-17)), 0));
else if (strTest.Left(18).Equals("system.addontitle("))
{
CStdString param = strTest.Mid(18,strTest.size()-19);
int info = TranslateString(param);
if (info > 0)
return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_ADDON_TITLE: SYSTEM_ADDON_TITLE, info, 0));
// pipe our original string through the localize parsing then make it lowercase (picks up $LBRACKET etc.)
CStdString label = CGUIInfoLabel::GetLabel(param).ToLower();
int compareString = ConditionalStringParameter(label);
return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_ADDON_TITLE: SYSTEM_ADDON_TITLE, compareString, 1));
}
else if (strTest.Left(17).Equals("system.addonicon("))
{
CStdString param = strTest.Mid(17,strTest.size()-18);
int info = TranslateString(param);
if (info > 0)
return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_ADDON_ICON: SYSTEM_ADDON_ICON, info, 0));
// pipe our original string through the localize parsing then make it lowercase (picks up $LBRACKET etc.)
CStdString label = CGUIInfoLabel::GetLabel(param).ToLower();
int compareString = ConditionalStringParameter(label);
return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_ADDON_ICON : SYSTEM_ADDON_ICON, compareString, 1));
}
}
// library test conditions
else if (strTest.Left(7).Equals("library"))
{
if (strTest.Equals("library.hascontent(music)")) ret = LIBRARY_HAS_MUSIC;
else if (strTest.Equals("library.hascontent(video)")) ret = LIBRARY_HAS_VIDEO;
else if (strTest.Equals("library.hascontent(movies)")) ret = LIBRARY_HAS_MOVIES;
else if (strTest.Equals("library.hascontent(tvshows)")) ret = LIBRARY_HAS_TVSHOWS;
else if (strTest.Equals("library.hascontent(musicvideos)")) ret = LIBRARY_HAS_MUSICVIDEOS;
else if (strTest.Equals("library.isscanning")) ret = LIBRARY_IS_SCANNING;
}
else if (strTest.Left(8).Equals("isempty("))
{
CStdString str = strTest.Mid(8, strTest.GetLength() - 9);
return AddMultiInfo(GUIInfo(bNegate ? -STRING_IS_EMPTY : STRING_IS_EMPTY, TranslateSingleString(str)));
}
else if (strTest.Left(14).Equals("stringcompare("))
{
int pos = strTest.Find(",");
int info = TranslateString(strTest.Mid(14, pos-14));
int info2 = TranslateString(strTest.Mid(pos + 1, strTest.GetLength() - (pos + 2)));
if (info2 > 0)
return AddMultiInfo(GUIInfo(bNegate ? -STRING_COMPARE: STRING_COMPARE, info, -info2));
// pipe our original string through the localize parsing then make it lowercase (picks up $LBRACKET etc.)
CStdString label = CGUIInfoLabel::GetLabel(original.Mid(pos + 1, original.GetLength() - (pos + 2))).ToLower();
int compareString = ConditionalStringParameter(label);
return AddMultiInfo(GUIInfo(bNegate ? -STRING_COMPARE: STRING_COMPARE, info, compareString));
}
else if (strTest.Left(19).Equals("integergreaterthan("))
{
int pos = strTest.Find(",");
int info = TranslateString(strTest.Mid(19, pos-19));
int compareInt = atoi(strTest.Mid(pos + 1, strTest.GetLength() - (pos + 2)).c_str());
return AddMultiInfo(GUIInfo(bNegate ? -INTEGER_GREATER_THAN: INTEGER_GREATER_THAN, info, compareInt));
}
else if (strTest.Left(10).Equals("substring("))
{
int pos = strTest.Find(",");
int info = TranslateString(strTest.Mid(10, pos-10));
// pipe our original string through the localize parsing then make it lowercase (picks up $LBRACKET etc.)
CStdString label = CGUIInfoLabel::GetLabel(original.Mid(pos + 1, original.GetLength() - (pos + 2))).ToLower();
int compareString = ConditionalStringParameter(label);
return AddMultiInfo(GUIInfo(bNegate ? -STRING_STR: STRING_STR, info, compareString));
}
else if (strCategory.Equals("lcd"))
{
if (strTest.Equals("lcd.playicon")) ret = LCD_PLAY_ICON;
else if (strTest.Equals("lcd.progressbar")) ret = LCD_PROGRESS_BAR;
else if (strTest.Equals("lcd.cputemperature")) ret = LCD_CPU_TEMPERATURE;
else if (strTest.Equals("lcd.gputemperature")) ret = LCD_GPU_TEMPERATURE;
else if (strTest.Equals("lcd.hddtemperature")) ret = LCD_HDD_TEMPERATURE;
else if (strTest.Equals("lcd.fanspeed")) ret = LCD_FAN_SPEED;
else if (strTest.Equals("lcd.date")) ret = LCD_DATE;
else if (strTest.Equals("lcd.freespace(c)")) ret = LCD_FREE_SPACE_C;
else if (strTest.Equals("lcd.freespace(e)")) ret = LCD_FREE_SPACE_E;
else if (strTest.Equals("lcd.freespace(f)")) ret = LCD_FREE_SPACE_F;
else if (strTest.Equals("lcd.freespace(g)")) ret = LCD_FREE_SPACE_G;
else if (strTest.Equals("lcd.Time21")) ret = LCD_TIME_21; // Small LCD numbers
else if (strTest.Equals("lcd.Time22")) ret = LCD_TIME_22;
else if (strTest.Equals("lcd.TimeWide21")) ret = LCD_TIME_W21; // Medium LCD numbers
else if (strTest.Equals("lcd.TimeWide22")) ret = LCD_TIME_W22;
else if (strTest.Equals("lcd.Time41")) ret = LCD_TIME_41; // Big LCD numbers
else if (strTest.Equals("lcd.Time42")) ret = LCD_TIME_42;
else if (strTest.Equals("lcd.Time43")) ret = LCD_TIME_43;
else if (strTest.Equals("lcd.Time44")) ret = LCD_TIME_44;
}
else if (strCategory.Equals("network"))
{
if (strTest.Equals("network.ipaddress")) ret = NETWORK_IP_ADDRESS;
if (strTest.Equals("network.isdhcp")) ret = NETWORK_IS_DHCP;
if (strTest.Equals("network.linkstate")) ret = NETWORK_LINK_STATE;
if (strTest.Equals("network.macaddress")) ret = NETWORK_MAC_ADDRESS;
if (strTest.Equals("network.subnetaddress")) ret = NETWORK_SUBNET_ADDRESS;
if (strTest.Equals("network.gatewayaddress")) ret = NETWORK_GATEWAY_ADDRESS;
if (strTest.Equals("network.dns1address")) ret = NETWORK_DNS1_ADDRESS;
if (strTest.Equals("network.dns2address")) ret = NETWORK_DNS2_ADDRESS;
if (strTest.Equals("network.dhcpaddress")) ret = NETWORK_DHCP_ADDRESS;
}
else if (strCategory.Equals("musicplayer"))
{
CStdString info = strTest.Mid(strCategory.GetLength() + 1);
if (info.Left(9).Equals("position("))
{
int position = atoi(info.Mid(9));
int value = TranslateMusicPlayerString(info.Mid(info.Find(".")+1));
ret = AddMultiInfo(GUIInfo(value, 0, position));
}
else if (info.Left(7).Equals("offset("))
{
int position = atoi(info.Mid(7));
int value = TranslateMusicPlayerString(info.Mid(info.Find(".")+1));
ret = AddMultiInfo(GUIInfo(value, 1, position));
}
else if (info.Left(13).Equals("timeremaining")) return AddMultiInfo(GUIInfo(PLAYER_TIME_REMAINING, TranslateTimeFormat(info.Mid(13))));
else if (info.Left(9).Equals("timespeed")) return AddMultiInfo(GUIInfo(PLAYER_TIME_SPEED, TranslateTimeFormat(info.Mid(9))));
else if (info.Left(4).Equals("time")) return AddMultiInfo(GUIInfo(PLAYER_TIME, TranslateTimeFormat(info.Mid(4))));
else if (info.Left(8).Equals("duration")) return AddMultiInfo(GUIInfo(PLAYER_DURATION, TranslateTimeFormat(info.Mid(8))));
else if (info.Left(9).Equals("property("))
return AddListItemProp(info.Mid(9, info.GetLength() - 10), MUSICPLAYER_PROPERTY_OFFSET);
else
ret = TranslateMusicPlayerString(strTest.Mid(12));
}
else if (strCategory.Equals("videoplayer"))
{
if (strTest.Equals("videoplayer.title")) ret = VIDEOPLAYER_TITLE;
else if (strTest.Equals("videoplayer.genre")) ret = VIDEOPLAYER_GENRE;
else if (strTest.Equals("videoplayer.country")) ret = VIDEOPLAYER_COUNTRY;
else if (strTest.Equals("videoplayer.originaltitle")) ret = VIDEOPLAYER_ORIGINALTITLE;
else if (strTest.Equals("videoplayer.director")) ret = VIDEOPLAYER_DIRECTOR;
else if (strTest.Equals("videoplayer.year")) ret = VIDEOPLAYER_YEAR;
else if (strTest.Left(25).Equals("videoplayer.timeremaining")) ret = AddMultiInfo(GUIInfo(PLAYER_TIME_REMAINING, TranslateTimeFormat(strTest.Mid(25))));
else if (strTest.Left(21).Equals("videoplayer.timespeed")) ret = AddMultiInfo(GUIInfo(PLAYER_TIME_SPEED, TranslateTimeFormat(strTest.Mid(21))));
else if (strTest.Left(16).Equals("videoplayer.time")) ret = AddMultiInfo(GUIInfo(PLAYER_TIME, TranslateTimeFormat(strTest.Mid(16))));
else if (strTest.Left(20).Equals("videoplayer.duration")) ret = AddMultiInfo(GUIInfo(PLAYER_DURATION, TranslateTimeFormat(strTest.Mid(20))));
else if (strTest.Equals("videoplayer.cover")) ret = VIDEOPLAYER_COVER;
else if (strTest.Equals("videoplayer.usingoverlays")) ret = VIDEOPLAYER_USING_OVERLAYS;
else if (strTest.Equals("videoplayer.isfullscreen")) ret = VIDEOPLAYER_ISFULLSCREEN;
else if (strTest.Equals("videoplayer.hasmenu")) ret = VIDEOPLAYER_HASMENU;
else if (strTest.Equals("videoplayer.playlistlength")) ret = VIDEOPLAYER_PLAYLISTLEN;
else if (strTest.Equals("videoplayer.playlistposition")) ret = VIDEOPLAYER_PLAYLISTPOS;
else if (strTest.Equals("videoplayer.plot")) ret = VIDEOPLAYER_PLOT;
else if (strTest.Equals("videoplayer.plotoutline")) ret = VIDEOPLAYER_PLOT_OUTLINE;
else if (strTest.Equals("videoplayer.episode")) ret = VIDEOPLAYER_EPISODE;
else if (strTest.Equals("videoplayer.season")) ret = VIDEOPLAYER_SEASON;
else if (strTest.Equals("videoplayer.rating")) ret = VIDEOPLAYER_RATING;
else if (strTest.Equals("videoplayer.ratingandvotes")) ret = VIDEOPLAYER_RATING_AND_VOTES;
else if (strTest.Equals("videoplayer.tvshowtitle")) ret = VIDEOPLAYER_TVSHOW;
else if (strTest.Equals("videoplayer.premiered")) ret = VIDEOPLAYER_PREMIERED;
else if (strTest.Left(19).Equals("videoplayer.content")) return AddMultiInfo(GUIInfo(bNegate ? -VIDEOPLAYER_CONTENT : VIDEOPLAYER_CONTENT, ConditionalStringParameter(strTest.Mid(20,strTest.size()-21)), 0));
else if (strTest.Equals("videoplayer.studio")) ret = VIDEOPLAYER_STUDIO;
else if (strTest.Equals("videoplayer.mpaa")) return VIDEOPLAYER_MPAA;
else if (strTest.Equals("videoplayer.top250")) return VIDEOPLAYER_TOP250;
else if (strTest.Equals("videoplayer.cast")) return VIDEOPLAYER_CAST;
else if (strTest.Equals("videoplayer.castandrole")) return VIDEOPLAYER_CAST_AND_ROLE;
else if (strTest.Equals("videoplayer.artist")) return VIDEOPLAYER_ARTIST;
else if (strTest.Equals("videoplayer.album")) return VIDEOPLAYER_ALBUM;
else if (strTest.Equals("videoplayer.writer")) return VIDEOPLAYER_WRITER;
else if (strTest.Equals("videoplayer.tagline")) return VIDEOPLAYER_TAGLINE;
else if (strTest.Equals("videoplayer.hasinfo")) return VIDEOPLAYER_HAS_INFO;
else if (strTest.Equals("videoplayer.trailer")) return VIDEOPLAYER_TRAILER;
else if (strTest.Equals("videoplayer.videocodec")) return VIDEOPLAYER_VIDEO_CODEC;
else if (strTest.Equals("videoplayer.videoresolution")) return VIDEOPLAYER_VIDEO_RESOLUTION;
else if (strTest.Equals("videoplayer.videoaspect")) return VIDEOPLAYER_VIDEO_ASPECT;
else if (strTest.Equals("videoplayer.audiocodec")) return VIDEOPLAYER_AUDIO_CODEC;
else if (strTest.Equals("videoplayer.audiochannels")) return VIDEOPLAYER_AUDIO_CHANNELS;
else if (strTest.Equals("videoplayer.hasteletext")) return VIDEOPLAYER_HASTELETEXT;
}
else if (strCategory.Equals("playlist"))
{
if (strTest.Equals("playlist.length")) ret = PLAYLIST_LENGTH;
else if (strTest.Equals("playlist.position")) ret = PLAYLIST_POSITION;
else if (strTest.Equals("playlist.random")) ret = PLAYLIST_RANDOM;
else if (strTest.Equals("playlist.repeat")) ret = PLAYLIST_REPEAT;
else if (strTest.Equals("playlist.israndom")) ret = PLAYLIST_ISRANDOM;
else if (strTest.Equals("playlist.isrepeat")) ret = PLAYLIST_ISREPEAT;
else if (strTest.Equals("playlist.isrepeatone")) ret = PLAYLIST_ISREPEATONE;
}
else if (strCategory.Equals("musicpartymode"))
{
if (strTest.Equals("musicpartymode.enabled")) ret = MUSICPM_ENABLED;
else if (strTest.Equals("musicpartymode.songsplayed")) ret = MUSICPM_SONGSPLAYED;
else if (strTest.Equals("musicpartymode.matchingsongs")) ret = MUSICPM_MATCHINGSONGS;
else if (strTest.Equals("musicpartymode.matchingsongspicked")) ret = MUSICPM_MATCHINGSONGSPICKED;
else if (strTest.Equals("musicpartymode.matchingsongsleft")) ret = MUSICPM_MATCHINGSONGSLEFT;
else if (strTest.Equals("musicpartymode.relaxedsongspicked")) ret = MUSICPM_RELAXEDSONGSPICKED;
else if (strTest.Equals("musicpartymode.randomsongspicked")) ret = MUSICPM_RANDOMSONGSPICKED;
}
else if (strCategory.Equals("audioscrobbler"))
{
if (strTest.Equals("audioscrobbler.enabled")) ret = AUDIOSCROBBLER_ENABLED;
else if (strTest.Equals("audioscrobbler.connectstate")) ret = AUDIOSCROBBLER_CONN_STATE;
else if (strTest.Equals("audioscrobbler.submitinterval")) ret = AUDIOSCROBBLER_SUBMIT_INT;
else if (strTest.Equals("audioscrobbler.filescached")) ret = AUDIOSCROBBLER_FILES_CACHED;
else if (strTest.Equals("audioscrobbler.submitstate")) ret = AUDIOSCROBBLER_SUBMIT_STATE;
}
else if (strCategory.Equals("lastfm"))
{
if (strTest.Equals("lastfm.radioplaying")) ret = LASTFM_RADIOPLAYING;
else if (strTest.Equals("lastfm.canlove")) ret = LASTFM_CANLOVE;
else if (strTest.Equals("lastfm.canban")) ret = LASTFM_CANBAN;
}
else if (strCategory.Equals("slideshow"))
ret = CPictureInfoTag::TranslateString(strTest.Mid(strCategory.GetLength() + 1));
else if (strCategory.Left(9).Equals("container"))
{
int id = atoi(strCategory.Mid(10, strCategory.GetLength() - 11));
CStdString info = strTest.Mid(strCategory.GetLength() + 1);
if (info.Left(14).Equals("listitemnowrap"))
{
int offset = atoi(info.Mid(15, info.GetLength() - 16));
ret = TranslateListItem(info.Mid(info.Find(".")+1));
if (offset || id)
return AddMultiInfo(GUIInfo(bNegate ? -ret : ret, id, offset));
}
else if (info.Left(16).Equals("listitemposition"))
{
int offset = atoi(info.Mid(17, info.GetLength() - 18));
ret = TranslateListItem(info.Mid(info.Find(".")+1));
if (offset || id)
return AddMultiInfo(GUIInfo(bNegate ? -ret : ret, id, offset, INFOFLAG_LISTITEM_POSITION));
}
else if (info.Left(8).Equals("listitem"))
{
int offset = atoi(info.Mid(9, info.GetLength() - 10));
ret = TranslateListItem(info.Mid(info.Find(".")+1));
if (offset || id)
return AddMultiInfo(GUIInfo(bNegate ? -ret : ret, id, offset, INFOFLAG_LISTITEM_WRAP));
}
else if (info.Equals("hasfiles")) ret = CONTAINER_HASFILES;
else if (info.Equals("hasfolders")) ret = CONTAINER_HASFOLDERS;
else if (info.Equals("isstacked")) ret = CONTAINER_STACKED;
else if (info.Equals("folderthumb")) ret = CONTAINER_FOLDERTHUMB;
else if (info.Equals("tvshowthumb")) ret = CONTAINER_TVSHOWTHUMB;
else if (info.Equals("seasonthumb")) ret = CONTAINER_SEASONTHUMB;
else if (info.Equals("folderpath")) ret = CONTAINER_FOLDERPATH;
else if (info.Equals("foldername")) ret = CONTAINER_FOLDERNAME;
else if (info.Equals("pluginname")) ret = CONTAINER_PLUGINNAME;
else if (info.Equals("viewmode")) ret = CONTAINER_VIEWMODE;
else if (info.Equals("onnext")) ret = CONTAINER_MOVE_NEXT;
else if (info.Equals("onprevious")) ret = CONTAINER_MOVE_PREVIOUS;
else if (info.Equals("onscrollnext")) ret = CONTAINER_SCROLL_NEXT;
else if (info.Equals("onscrollprevious")) ret = CONTAINER_SCROLL_PREVIOUS;
else if (info.Equals("totaltime")) ret = CONTAINER_TOTALTIME;
else if (info.Equals("scrolling"))
return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_SCROLLING : CONTAINER_SCROLLING, id, 0));
else if (info.Equals("hasnext"))
return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_HAS_NEXT : CONTAINER_HAS_NEXT, id, 0));
else if (info.Equals("hasprevious"))
return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_HAS_PREVIOUS : CONTAINER_HAS_PREVIOUS, id, 0));
else if (info.Left(8).Equals("content("))
return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_CONTENT : CONTAINER_CONTENT, ConditionalStringParameter(info.Mid(8,info.GetLength()-9)), 0));
else if (info.Left(4).Equals("row("))
return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_ROW : CONTAINER_ROW, id, atoi(info.Mid(4, info.GetLength() - 5))));
else if (info.Left(7).Equals("column("))
return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_COLUMN : CONTAINER_COLUMN, id, atoi(info.Mid(7, info.GetLength() - 8))));
else if (info.Left(8).Equals("position"))
return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_POSITION : CONTAINER_POSITION, id, atoi(info.Mid(9, info.GetLength() - 10))));
else if (info.Left(8).Equals("subitem("))
return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_SUBITEM : CONTAINER_SUBITEM, id, atoi(info.Mid(8, info.GetLength() - 9))));
else if (info.Equals("hasthumb")) ret = CONTAINER_HAS_THUMB;
else if (info.Equals("numpages")) ret = CONTAINER_NUM_PAGES;
else if (info.Equals("numitems")) ret = CONTAINER_NUM_ITEMS;
else if (info.Equals("currentpage")) ret = CONTAINER_CURRENT_PAGE;
else if (info.Equals("sortmethod")) ret = CONTAINER_SORT_METHOD;
else if (info.Left(13).Equals("sortdirection"))
{
CStdString direction = info.Mid(14, info.GetLength() - 15);
SORT_ORDER order = SORT_ORDER_NONE;
if (direction == "ascending")
order = SORT_ORDER_ASC;
else if (direction == "descending")
order = SORT_ORDER_DESC;
return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_SORT_DIRECTION : CONTAINER_SORT_DIRECTION, order));
}
else if (info.Left(5).Equals("sort("))
{
SORT_METHOD sort = SORT_METHOD_NONE;
CStdString method(info.Mid(5, info.GetLength() - 6));
if (method.Equals("songrating")) sort = SORT_METHOD_SONG_RATING;
if (sort != SORT_METHOD_NONE)
return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_SORT_METHOD : CONTAINER_SORT_METHOD, sort));
}
else if (id && info.Left(9).Equals("hasfocus("))
{
int itemID = atoi(info.Mid(9, info.GetLength() - 10));
return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_HAS_FOCUS : CONTAINER_HAS_FOCUS, id, itemID));
}
else if (info.Left(9).Equals("property("))
{
int compareString = ConditionalStringParameter(info.Mid(9, info.GetLength() - 10));
return AddMultiInfo(GUIInfo(CONTAINER_PROPERTY, id, compareString));
}
else if (info.Equals("showplot")) ret = CONTAINER_SHOWPLOT;
if (id && ((ret >= CONTAINER_SCROLL_PREVIOUS && ret <= CONTAINER_SCROLL_NEXT) || ret == CONTAINER_NUM_PAGES ||
ret == CONTAINER_NUM_ITEMS || ret == CONTAINER_CURRENT_PAGE))
return AddMultiInfo(GUIInfo(bNegate ? -ret : ret, id));
}
else if (strCategory.Left(8).Equals("listitem"))
{
int offset = atoi(strCategory.Mid(9, strCategory.GetLength() - 10));
ret = TranslateListItem(strTest.Mid(strCategory.GetLength() + 1));
if (offset || ret == LISTITEM_ISSELECTED || ret == LISTITEM_ISPLAYING || ret == LISTITEM_IS_FOLDER)
return AddMultiInfo(GUIInfo(bNegate ? -ret : ret, 0, offset, INFOFLAG_LISTITEM_WRAP));
}
else if (strCategory.Left(16).Equals("listitemposition"))
{
int offset = atoi(strCategory.Mid(17, strCategory.GetLength() - 18));
ret = TranslateListItem(strCategory.Mid(strCategory.GetLength()+1));
if (offset || ret == LISTITEM_ISSELECTED || ret == LISTITEM_ISPLAYING || ret == LISTITEM_IS_FOLDER)
return AddMultiInfo(GUIInfo(bNegate ? -ret : ret, 0, offset, INFOFLAG_LISTITEM_POSITION));
}
else if (strCategory.Left(14).Equals("listitemnowrap"))
{
int offset = atoi(strCategory.Mid(15, strCategory.GetLength() - 16));
ret = TranslateListItem(strTest.Mid(strCategory.GetLength() + 1));
if (offset || ret == LISTITEM_ISSELECTED || ret == LISTITEM_ISPLAYING || ret == LISTITEM_IS_FOLDER)
return AddMultiInfo(GUIInfo(bNegate ? -ret : ret, 0, offset));
}
else if (strCategory.Equals("visualisation"))
{
if (strTest.Equals("visualisation.locked")) ret = VISUALISATION_LOCKED;
else if (strTest.Equals("visualisation.preset")) ret = VISUALISATION_PRESET;
else if (strTest.Equals("visualisation.name")) ret = VISUALISATION_NAME;
else if (strTest.Equals("visualisation.enabled")) ret = VISUALISATION_ENABLED;
}
else if (strCategory.Equals("fanart"))
{
if (strTest.Equals("fanart.color1")) ret = FANART_COLOR1;
else if (strTest.Equals("fanart.color2")) ret = FANART_COLOR2;
else if (strTest.Equals("fanart.color3")) ret = FANART_COLOR3;
else if (strTest.Equals("fanart.image")) ret = FANART_IMAGE;
}
else if (strCategory.Equals("skin"))
{
if (strTest.Equals("skin.currenttheme"))
ret = SKIN_THEME;
else if (strTest.Equals("skin.currentcolourtheme"))
ret = SKIN_COLOUR_THEME;
else if (strTest.Left(12).Equals("skin.string("))
{
int pos = strTest.Find(",");
if (pos >= 0)
{
int skinOffset = g_settings.TranslateSkinString(strTest.Mid(12, pos - 12));
int compareString = ConditionalStringParameter(strTest.Mid(pos + 1, strTest.GetLength() - (pos + 2)));
return AddMultiInfo(GUIInfo(bNegate ? -SKIN_STRING : SKIN_STRING, skinOffset, compareString));
}
int skinOffset = g_settings.TranslateSkinString(strTest.Mid(12, strTest.GetLength() - 13));
return AddMultiInfo(GUIInfo(bNegate ? -SKIN_STRING : SKIN_STRING, skinOffset));
}
else if (strTest.Left(16).Equals("skin.hassetting("))
{
int skinOffset = g_settings.TranslateSkinBool(strTest.Mid(16, strTest.GetLength() - 17));
return AddMultiInfo(GUIInfo(bNegate ? -SKIN_BOOL : SKIN_BOOL, skinOffset));
}
else if (strTest.Left(14).Equals("skin.hastheme("))
ret = SKIN_HAS_THEME_START + ConditionalStringParameter(strTest.Mid(14, strTest.GetLength() - 15));
}
else if (strCategory.Left(6).Equals("window"))
{
CStdString info = strTest.Mid(strCategory.GetLength() + 1);
// special case for window.xml parameter, fails above
if (info.Left(5).Equals("xml)."))
info = info.Mid(5, info.GetLength() + 1);
if (info.Left(9).Equals("property("))
{
int winID = 0;
if (strTest.Left(7).Equals("window("))
{
CStdString window(strTest.Mid(7, strTest.Find(")", 7) - 7).ToLower());
winID = CButtonTranslator::TranslateWindow(window);
}
if (winID != WINDOW_INVALID)
{
int compareString = ConditionalStringParameter(info.Mid(9, info.GetLength() - 10));
return AddMultiInfo(GUIInfo(WINDOW_PROPERTY, winID, compareString));
}
}
else if (info.Left(9).Equals("isactive("))
{
CStdString window(strTest.Mid(16, strTest.GetLength() - 17).ToLower());
if (window.Find("xml") >= 0)
return AddMultiInfo(GUIInfo(bNegate ? -WINDOW_IS_ACTIVE : WINDOW_IS_ACTIVE, 0, ConditionalStringParameter(window)));
int winID = CButtonTranslator::TranslateWindow(window);
if (winID != WINDOW_INVALID)
return AddMultiInfo(GUIInfo(bNegate ? -WINDOW_IS_ACTIVE : WINDOW_IS_ACTIVE, winID, 0));
}
else if (info.Left(7).Equals("ismedia")) return WINDOW_IS_MEDIA;
else if (info.Left(10).Equals("istopmost("))
{
CStdString window(strTest.Mid(17, strTest.GetLength() - 18).ToLower());
if (window.Find("xml") >= 0)
return AddMultiInfo(GUIInfo(bNegate ? -WINDOW_IS_TOPMOST : WINDOW_IS_TOPMOST, 0, ConditionalStringParameter(window)));
int winID = CButtonTranslator::TranslateWindow(window);
if (winID != WINDOW_INVALID)
return AddMultiInfo(GUIInfo(bNegate ? -WINDOW_IS_TOPMOST : WINDOW_IS_TOPMOST, winID, 0));
}
else if (info.Left(10).Equals("isvisible("))
{
CStdString window(strTest.Mid(17, strTest.GetLength() - 18).ToLower());
if (window.Find("xml") >= 0)
return AddMultiInfo(GUIInfo(bNegate ? -WINDOW_IS_VISIBLE : WINDOW_IS_VISIBLE, 0, ConditionalStringParameter(window)));
int winID = CButtonTranslator::TranslateWindow(window);
if (winID != WINDOW_INVALID)
return AddMultiInfo(GUIInfo(bNegate ? -WINDOW_IS_VISIBLE : WINDOW_IS_VISIBLE, winID, 0));
}
else if (info.Left(9).Equals("previous("))
{
CStdString window(strTest.Mid(16, strTest.GetLength() - 17).ToLower());
if (window.Find("xml") >= 0)
return AddMultiInfo(GUIInfo(bNegate ? -WINDOW_PREVIOUS : WINDOW_PREVIOUS, 0, ConditionalStringParameter(window)));
int winID = CButtonTranslator::TranslateWindow(window);
if (winID != WINDOW_INVALID)
return AddMultiInfo(GUIInfo(bNegate ? -WINDOW_PREVIOUS : WINDOW_PREVIOUS, winID, 0));
}
else if (info.Left(5).Equals("next("))
{
CStdString window(strTest.Mid(12, strTest.GetLength() - 13).ToLower());
if (window.Find("xml") >= 0)
return AddMultiInfo(GUIInfo(bNegate ? -WINDOW_NEXT : WINDOW_NEXT, 0, ConditionalStringParameter(window)));
int winID = CButtonTranslator::TranslateWindow(window);
if (winID != WINDOW_INVALID)
return AddMultiInfo(GUIInfo(bNegate ? -WINDOW_NEXT : WINDOW_NEXT, winID, 0));
}
}
else if (strTest.Left(17).Equals("control.hasfocus("))
{
int controlID = atoi(strTest.Mid(17, strTest.GetLength() - 18).c_str());
if (controlID)
return AddMultiInfo(GUIInfo(bNegate ? -CONTROL_HAS_FOCUS : CONTROL_HAS_FOCUS, controlID, 0));
}
else if (strTest.Left(18).Equals("control.isvisible("))
{
int controlID = atoi(strTest.Mid(18, strTest.GetLength() - 19).c_str());
if (controlID)
return AddMultiInfo(GUIInfo(bNegate ? -CONTROL_IS_VISIBLE : CONTROL_IS_VISIBLE, controlID, 0));
}
else if (strTest.Left(18).Equals("control.isenabled("))
{
int controlID = atoi(strTest.Mid(18, strTest.GetLength() - 19).c_str());
if (controlID)
return AddMultiInfo(GUIInfo(bNegate ? -CONTROL_IS_ENABLED : CONTROL_IS_ENABLED, controlID, 0));
}
else if (strTest.Left(17).Equals("control.getlabel("))
{
int controlID = atoi(strTest.Mid(17, strTest.GetLength() - 18).c_str());
if (controlID)
return AddMultiInfo(GUIInfo(bNegate ? -CONTROL_GET_LABEL : CONTROL_GET_LABEL, controlID, 0));
}
else if (strTest.Left(13).Equals("controlgroup("))
{
int groupID = atoi(strTest.Mid(13).c_str());
int controlID = 0;
int controlPos = strTest.Find(".hasfocus(");
if (controlPos > 0)
controlID = atoi(strTest.Mid(controlPos + 10).c_str());
if (groupID)
{
return AddMultiInfo(GUIInfo(bNegate ? -CONTROL_GROUP_HAS_FOCUS : CONTROL_GROUP_HAS_FOCUS, groupID, controlID));
}
}
else if (strTest.Left(24).Equals("buttonscroller.hasfocus("))
{
int controlID = atoi(strTest.Mid(24, strTest.GetLength() - 24).c_str());
if (controlID)
return AddMultiInfo(GUIInfo(bNegate ? -BUTTON_SCROLLER_HAS_ICON : BUTTON_SCROLLER_HAS_ICON, controlID, 0));
}
return bNegate ? -ret : ret;
}
int CGUIInfoManager::TranslateListItem(const CStdString &info)
{
if (info.Equals("thumb")) return LISTITEM_THUMB;
else if (info.Equals("icon")) return LISTITEM_ICON;
else if (info.Equals("actualicon")) return LISTITEM_ACTUAL_ICON;
else if (info.Equals("overlay")) return LISTITEM_OVERLAY;
else if (info.Equals("label")) return LISTITEM_LABEL;
else if (info.Equals("label2")) return LISTITEM_LABEL2;
else if (info.Equals("title")) return LISTITEM_TITLE;
else if (info.Equals("tracknumber")) return LISTITEM_TRACKNUMBER;
else if (info.Equals("artist")) return LISTITEM_ARTIST;
else if (info.Equals("album")) return LISTITEM_ALBUM;
else if (info.Equals("albumartist")) return LISTITEM_ALBUM_ARTIST;
else if (info.Equals("year")) return LISTITEM_YEAR;
else if (info.Equals("genre")) return LISTITEM_GENRE;
else if (info.Equals("director")) return LISTITEM_DIRECTOR;
else if (info.Equals("filename")) return LISTITEM_FILENAME;
else if (info.Equals("filenameandpath")) return LISTITEM_FILENAME_AND_PATH;
else if (info.Equals("date")) return LISTITEM_DATE;
else if (info.Equals("size")) return LISTITEM_SIZE;
else if (info.Equals("rating")) return LISTITEM_RATING;
else if (info.Equals("ratingandvotes")) return LISTITEM_RATING_AND_VOTES;
else if (info.Equals("programcount")) return LISTITEM_PROGRAM_COUNT;
else if (info.Equals("duration")) return LISTITEM_DURATION;
else if (info.Equals("isselected")) return LISTITEM_ISSELECTED;
else if (info.Equals("isplaying")) return LISTITEM_ISPLAYING;
else if (info.Equals("plot")) return LISTITEM_PLOT;
else if (info.Equals("plotoutline")) return LISTITEM_PLOT_OUTLINE;
else if (info.Equals("episode")) return LISTITEM_EPISODE;
else if (info.Equals("season")) return LISTITEM_SEASON;
else if (info.Equals("tvshowtitle")) return LISTITEM_TVSHOW;
else if (info.Equals("premiered")) return LISTITEM_PREMIERED;
else if (info.Equals("comment")) return LISTITEM_COMMENT;
else if (info.Equals("path")) return LISTITEM_PATH;
else if (info.Equals("foldername")) return LISTITEM_FOLDERNAME;
else if (info.Equals("picturepath")) return LISTITEM_PICTURE_PATH;
else if (info.Equals("pictureresolution")) return LISTITEM_PICTURE_RESOLUTION;
else if (info.Equals("picturedatetime")) return LISTITEM_PICTURE_DATETIME;
else if (info.Equals("studio")) return LISTITEM_STUDIO;
else if (info.Equals("country")) return LISTITEM_COUNTRY;
else if (info.Equals("mpaa")) return LISTITEM_MPAA;
else if (info.Equals("cast")) return LISTITEM_CAST;
else if (info.Equals("castandrole")) return LISTITEM_CAST_AND_ROLE;
else if (info.Equals("writer")) return LISTITEM_WRITER;
else if (info.Equals("tagline")) return LISTITEM_TAGLINE;
else if (info.Equals("top250")) return LISTITEM_TOP250;
else if (info.Equals("trailer")) return LISTITEM_TRAILER;
else if (info.Equals("starrating")) return LISTITEM_STAR_RATING;
else if (info.Equals("sortletter")) return LISTITEM_SORT_LETTER;
else if (info.Equals("videocodec")) return LISTITEM_VIDEO_CODEC;
else if (info.Equals("videoresolution")) return LISTITEM_VIDEO_RESOLUTION;
else if (info.Equals("videoaspect")) return LISTITEM_VIDEO_ASPECT;
else if (info.Equals("audiocodec")) return LISTITEM_AUDIO_CODEC;
else if (info.Equals("audiochannels")) return LISTITEM_AUDIO_CHANNELS;
else if (info.Equals("audiolanguage")) return LISTITEM_AUDIO_LANGUAGE;
else if (info.Equals("subtitlelanguage")) return LISTITEM_SUBTITLE_LANGUAGE;
else if (info.Equals("isfolder")) return LISTITEM_IS_FOLDER;
else if (info.Equals("originaltitle")) return LISTITEM_ORIGINALTITLE;
else if (info.Left(9).Equals("property(")) return AddListItemProp(info.Mid(9, info.GetLength() - 10));
return 0;
}
int CGUIInfoManager::TranslateMusicPlayerString(const CStdString &info) const
{
if (info.Equals("title")) return MUSICPLAYER_TITLE;
else if (info.Equals("album")) return MUSICPLAYER_ALBUM;
else if (info.Equals("artist")) return MUSICPLAYER_ARTIST;
else if (info.Equals("albumartist")) return MUSICPLAYER_ALBUM_ARTIST;
else if (info.Equals("year")) return MUSICPLAYER_YEAR;
else if (info.Equals("genre")) return MUSICPLAYER_GENRE;
else if (info.Equals("duration")) return MUSICPLAYER_DURATION;
else if (info.Equals("tracknumber")) return MUSICPLAYER_TRACK_NUMBER;
else if (info.Equals("cover")) return MUSICPLAYER_COVER;
else if (info.Equals("bitrate")) return MUSICPLAYER_BITRATE;
else if (info.Equals("playlistlength")) return MUSICPLAYER_PLAYLISTLEN;
else if (info.Equals("playlistposition")) return MUSICPLAYER_PLAYLISTPOS;
else if (info.Equals("channels")) return MUSICPLAYER_CHANNELS;
else if (info.Equals("bitspersample")) return MUSICPLAYER_BITSPERSAMPLE;
else if (info.Equals("samplerate")) return MUSICPLAYER_SAMPLERATE;
else if (info.Equals("codec")) return MUSICPLAYER_CODEC;
else if (info.Equals("discnumber")) return MUSICPLAYER_DISC_NUMBER;
else if (info.Equals("rating")) return MUSICPLAYER_RATING;
else if (info.Equals("comment")) return MUSICPLAYER_COMMENT;
else if (info.Equals("lyrics")) return MUSICPLAYER_LYRICS;
else if (info.Equals("playlistplaying")) return MUSICPLAYER_PLAYLISTPLAYING;
else if (info.Equals("exists")) return MUSICPLAYER_EXISTS;
else if (info.Equals("hasprevious")) return MUSICPLAYER_HASPREVIOUS;
else if (info.Equals("hasnext")) return MUSICPLAYER_HASNEXT;
return 0;
}
TIME_FORMAT CGUIInfoManager::TranslateTimeFormat(const CStdString &format)
{
if (format.IsEmpty()) return TIME_FORMAT_GUESS;
else if (format.Equals("(hh)")) return TIME_FORMAT_HH;
else if (format.Equals("(mm)")) return TIME_FORMAT_MM;
else if (format.Equals("(ss)")) return TIME_FORMAT_SS;
else if (format.Equals("(hh:mm)")) return TIME_FORMAT_HH_MM;
else if (format.Equals("(mm:ss)")) return TIME_FORMAT_MM_SS;
else if (format.Equals("(hh:mm:ss)")) return TIME_FORMAT_HH_MM_SS;
return TIME_FORMAT_GUESS;
}
CStdString CGUIInfoManager::GetLabel(int info, int contextWindow)
{
CStdString strLabel;
if (info >= MULTI_INFO_START && info <= MULTI_INFO_END)
return GetMultiInfoLabel(m_multiInfo[info - MULTI_INFO_START], contextWindow);
if (info >= SLIDE_INFO_START && info <= SLIDE_INFO_END)
return GetPictureLabel(info);
if (info >= LISTITEM_PROPERTY_START+MUSICPLAYER_PROPERTY_OFFSET &&
info - (LISTITEM_PROPERTY_START+MUSICPLAYER_PROPERTY_OFFSET) < (int)m_listitemProperties.size())
{ // grab the property
if (!m_currentFile)
return "";
CStdString property = m_listitemProperties[info - LISTITEM_PROPERTY_START-MUSICPLAYER_PROPERTY_OFFSET];
return m_currentFile->GetProperty(property);
}
if (info >= LISTITEM_START && info <= LISTITEM_END)
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_HAS_LIST_ITEMS); // true for has list items
if (window)
{
CFileItemPtr item = window->GetCurrentListItem();
strLabel = GetItemLabel(item.get(), info);
}
return strLabel;
}
switch (info)
{
case WEATHER_CONDITIONS:
strLabel = g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_COND);
strLabel = strLabel.Trim();
break;
case WEATHER_TEMPERATURE:
strLabel.Format("%s%s", g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_TEMP), g_langInfo.GetTempUnitString().c_str());
break;
case WEATHER_LOCATION:
strLabel = g_weatherManager.GetInfo(WEATHER_LABEL_LOCATION);
break;
case WEATHER_FANART_CODE:
strLabel = CUtil::GetFileName(g_weatherManager.GetInfo(WEATHER_IMAGE_CURRENT_ICON));
CUtil::RemoveExtension(strLabel);
break;
case WEATHER_PLUGIN:
strLabel = g_guiSettings.GetString("weather.script");
break;
case SYSTEM_DATE:
strLabel = GetDate();
break;
case LCD_DATE:
strLabel = GetDate(true);
break;
case SYSTEM_FPS:
strLabel.Format("%02.2f", m_fps);
break;
case PLAYER_VOLUME:
strLabel.Format("%2.1f dB", (float)(g_settings.m_nVolumeLevel + g_settings.m_dynamicRangeCompressionLevel) * 0.01f);
break;
case PLAYER_SUBTITLE_DELAY:
strLabel.Format("%2.3f s", g_settings.m_currentVideoSettings.m_SubtitleDelay);
break;
case PLAYER_AUDIO_DELAY:
strLabel.Format("%2.3f s", g_settings.m_currentVideoSettings.m_AudioDelay);
break;
case PLAYER_CHAPTER:
if(g_application.IsPlaying() && g_application.m_pPlayer)
strLabel.Format("%02d", g_application.m_pPlayer->GetChapter());
break;
case PLAYER_CHAPTERCOUNT:
if(g_application.IsPlaying() && g_application.m_pPlayer)
strLabel.Format("%02d", g_application.m_pPlayer->GetChapterCount());
break;
case PLAYER_CHAPTERNAME:
if(g_application.IsPlaying() && g_application.m_pPlayer)
g_application.m_pPlayer->GetChapterName(strLabel);
break;
case PLAYER_CACHELEVEL:
{
int iLevel = 0;
if(g_application.IsPlaying() && ((iLevel = GetInt(PLAYER_CACHELEVEL)) >= 0))
strLabel.Format("%i", iLevel);
}
break;
case PLAYER_TIME:
if(g_application.IsPlaying() && g_application.m_pPlayer)
strLabel = GetCurrentPlayTime(TIME_FORMAT_HH_MM);
break;
case PLAYER_DURATION:
if(g_application.IsPlaying() && g_application.m_pPlayer)
strLabel = GetDuration(TIME_FORMAT_HH_MM);
break;
case PLAYER_PATH:
case PLAYER_FILEPATH:
if (m_currentFile)
{
if (m_currentFile->HasMusicInfoTag())
strLabel = m_currentFile->GetMusicInfoTag()->GetURL();
else if (m_currentFile->HasVideoInfoTag())
strLabel = m_currentFile->GetVideoInfoTag()->m_strFileNameAndPath;
if (strLabel.IsEmpty())
strLabel = m_currentFile->m_strPath;
}
if (info == PLAYER_PATH)
{
// do this twice since we want the path outside the archive if this
// is to be of use.
if (CUtil::IsInArchive(strLabel))
strLabel = CUtil::GetParentPath(strLabel);
strLabel = CUtil::GetParentPath(strLabel);
}
break;
case MUSICPLAYER_TITLE:
case MUSICPLAYER_ALBUM:
case MUSICPLAYER_ARTIST:
case MUSICPLAYER_ALBUM_ARTIST:
case MUSICPLAYER_GENRE:
case MUSICPLAYER_YEAR:
case MUSICPLAYER_TRACK_NUMBER:
case MUSICPLAYER_BITRATE:
case MUSICPLAYER_PLAYLISTLEN:
case MUSICPLAYER_PLAYLISTPOS:
case MUSICPLAYER_CHANNELS:
case MUSICPLAYER_BITSPERSAMPLE:
case MUSICPLAYER_SAMPLERATE:
case MUSICPLAYER_CODEC:
case MUSICPLAYER_DISC_NUMBER:
case MUSICPLAYER_RATING:
case MUSICPLAYER_COMMENT:
case MUSICPLAYER_LYRICS:
strLabel = GetMusicLabel(info);
break;
case VIDEOPLAYER_TITLE:
case VIDEOPLAYER_ORIGINALTITLE:
case VIDEOPLAYER_GENRE:
case VIDEOPLAYER_DIRECTOR:
case VIDEOPLAYER_YEAR:
case VIDEOPLAYER_PLAYLISTLEN:
case VIDEOPLAYER_PLAYLISTPOS:
case VIDEOPLAYER_PLOT:
case VIDEOPLAYER_PLOT_OUTLINE:
case VIDEOPLAYER_EPISODE:
case VIDEOPLAYER_SEASON:
case VIDEOPLAYER_RATING:
case VIDEOPLAYER_RATING_AND_VOTES:
case VIDEOPLAYER_TVSHOW:
case VIDEOPLAYER_PREMIERED:
case VIDEOPLAYER_STUDIO:
case VIDEOPLAYER_COUNTRY:
case VIDEOPLAYER_MPAA:
case VIDEOPLAYER_TOP250:
case VIDEOPLAYER_CAST:
case VIDEOPLAYER_CAST_AND_ROLE:
case VIDEOPLAYER_ARTIST:
case VIDEOPLAYER_ALBUM:
case VIDEOPLAYER_WRITER:
case VIDEOPLAYER_TAGLINE:
case VIDEOPLAYER_TRAILER:
strLabel = GetVideoLabel(info);
break;
case VIDEOPLAYER_VIDEO_CODEC:
if(g_application.IsPlaying() && g_application.m_pPlayer)
strLabel = g_application.m_pPlayer->GetVideoCodecName();
break;
case VIDEOPLAYER_VIDEO_RESOLUTION:
if(g_application.IsPlaying() && g_application.m_pPlayer)
return CStreamDetails::VideoDimsToResolutionDescription(g_application.m_pPlayer->GetPictureWidth(), g_application.m_pPlayer->GetPictureHeight());
break;
case VIDEOPLAYER_AUDIO_CODEC:
if(g_application.IsPlaying() && g_application.m_pPlayer)
strLabel = g_application.m_pPlayer->GetAudioCodecName();
break;
case VIDEOPLAYER_VIDEO_ASPECT:
if (g_application.IsPlaying() && g_application.m_pPlayer)
{
float aspect;
g_application.m_pPlayer->GetVideoAspectRatio(aspect);
strLabel = CStreamDetails::VideoAspectToAspectDescription(aspect);
}
break;
case VIDEOPLAYER_AUDIO_CHANNELS:
if(g_application.IsPlaying() && g_application.m_pPlayer)
strLabel.Format("%i", g_application.m_pPlayer->GetChannels());
break;
case PLAYLIST_LENGTH:
case PLAYLIST_POSITION:
case PLAYLIST_RANDOM:
case PLAYLIST_REPEAT:
strLabel = GetPlaylistLabel(info);
break;
case MUSICPM_SONGSPLAYED:
case MUSICPM_MATCHINGSONGS:
case MUSICPM_MATCHINGSONGSPICKED:
case MUSICPM_MATCHINGSONGSLEFT:
case MUSICPM_RELAXEDSONGSPICKED:
case MUSICPM_RANDOMSONGSPICKED:
strLabel = GetMusicPartyModeLabel(info);
break;
case SYSTEM_FREE_SPACE:
case SYSTEM_FREE_SPACE_C:
case SYSTEM_FREE_SPACE_E:
case SYSTEM_FREE_SPACE_F:
case SYSTEM_FREE_SPACE_G:
case SYSTEM_USED_SPACE:
case SYSTEM_USED_SPACE_C:
case SYSTEM_USED_SPACE_E:
case SYSTEM_USED_SPACE_F:
case SYSTEM_USED_SPACE_G:
case SYSTEM_TOTAL_SPACE:
case SYSTEM_TOTAL_SPACE_C:
case SYSTEM_TOTAL_SPACE_E:
case SYSTEM_TOTAL_SPACE_F:
case SYSTEM_TOTAL_SPACE_G:
case SYSTEM_FREE_SPACE_PERCENT:
case SYSTEM_FREE_SPACE_PERCENT_C:
case SYSTEM_FREE_SPACE_PERCENT_E:
case SYSTEM_FREE_SPACE_PERCENT_F:
case SYSTEM_FREE_SPACE_PERCENT_G:
case SYSTEM_USED_SPACE_PERCENT:
case SYSTEM_USED_SPACE_PERCENT_C:
case SYSTEM_USED_SPACE_PERCENT_E:
case SYSTEM_USED_SPACE_PERCENT_F:
case SYSTEM_USED_SPACE_PERCENT_G:
case SYSTEM_USED_SPACE_X:
case SYSTEM_FREE_SPACE_X:
case SYSTEM_TOTAL_SPACE_X:
case SYSTEM_USED_SPACE_Y:
case SYSTEM_FREE_SPACE_Y:
case SYSTEM_TOTAL_SPACE_Y:
case SYSTEM_USED_SPACE_Z:
case SYSTEM_FREE_SPACE_Z:
case SYSTEM_TOTAL_SPACE_Z:
return g_sysinfo.GetHddSpaceInfo(info);
break;
case LCD_FREE_SPACE_C:
case LCD_FREE_SPACE_E:
case LCD_FREE_SPACE_F:
case LCD_FREE_SPACE_G:
return g_sysinfo.GetHddSpaceInfo(info, true);
break;
case SYSTEM_CPU_TEMPERATURE:
case SYSTEM_GPU_TEMPERATURE:
case SYSTEM_FAN_SPEED:
case LCD_CPU_TEMPERATURE:
case LCD_GPU_TEMPERATURE:
case LCD_FAN_SPEED:
case SYSTEM_CPU_USAGE:
return GetSystemHeatInfo(info);
break;
case SYSTEM_VIDEO_ENCODER_INFO:
case NETWORK_MAC_ADDRESS:
case SYSTEM_KERNEL_VERSION:
case SYSTEM_CPUFREQUENCY:
case SYSTEM_INTERNET_STATE:
case SYSTEM_UPTIME:
case SYSTEM_TOTALUPTIME:
return g_sysinfo.GetInfo(info);
break;
case SYSTEM_SCREEN_RESOLUTION:
if (g_settings.m_ResInfo[g_guiSettings.m_LookAndFeelResolution].bFullScreen)
strLabel.Format("%ix%i@%.2fHz - %s (%02.2fHz)",
g_settings.m_ResInfo[g_guiSettings.m_LookAndFeelResolution].iWidth,
g_settings.m_ResInfo[g_guiSettings.m_LookAndFeelResolution].iHeight,
g_settings.m_ResInfo[g_guiSettings.m_LookAndFeelResolution].fRefreshRate,
g_localizeStrings.Get(244), GetFPS());
else
strLabel.Format("%ix%i - %s (%02.2fHz)",
g_settings.m_ResInfo[g_guiSettings.m_LookAndFeelResolution].iWidth,
g_settings.m_ResInfo[g_guiSettings.m_LookAndFeelResolution].iHeight,
g_localizeStrings.Get(242), GetFPS());
return strLabel;
break;
case CONTAINER_FOLDERPATH:
case CONTAINER_FOLDERNAME:
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (window)
{
strLabel = CURL(((CGUIMediaWindow*)window)->CurrentDirectory().m_strPath).GetWithoutUserDetails();
if (info==CONTAINER_FOLDERNAME)
{
CUtil::RemoveSlashAtEnd(strLabel);
strLabel=CUtil::GetFileName(strLabel);
}
}
break;
}
case CONTAINER_PLUGINNAME:
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (window)
{
CURL url(((CGUIMediaWindow*)window)->CurrentDirectory().m_strPath);
if (url.GetProtocol().Equals("plugin"))
{
strLabel = url.GetFileName();
CUtil::RemoveSlashAtEnd(strLabel);
}
}
break;
}
case CONTAINER_VIEWMODE:
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (window)
{
const CGUIControl *control = window->GetControl(window->GetViewContainerID());
if (control && control->IsContainer())
strLabel = ((CGUIBaseContainer *)control)->GetLabel();
}
break;
}
case CONTAINER_SORT_METHOD:
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (window)
{
const CGUIViewState *viewState = ((CGUIMediaWindow*)window)->GetViewState();
if (viewState)
strLabel = g_localizeStrings.Get(viewState->GetSortMethodLabel());
}
}
break;
case CONTAINER_NUM_PAGES:
case CONTAINER_NUM_ITEMS:
case CONTAINER_CURRENT_PAGE:
return GetMultiInfoLabel(GUIInfo(info), contextWindow);
break;
case CONTAINER_SHOWPLOT:
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (window)
return ((CGUIMediaWindow *)window)->CurrentDirectory().GetProperty("showplot");
}
break;
case CONTAINER_TOTALTIME:
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (window)
{
const CFileItemList& items=((CGUIMediaWindow *)window)->CurrentDirectory();
int duration=0;
for (int i=0;i<items.Size();++i)
{
CFileItemPtr item=items.Get(i);
if (item->HasMusicInfoTag())
duration += item->GetMusicInfoTag()->GetDuration();
else if (item->HasVideoInfoTag())
duration += item->GetVideoInfoTag()->m_streamDetails.GetVideoDuration();
}
if (duration > 0)
return StringUtils::SecondsToTimeString(duration);
}
}
break;
case SYSTEM_BUILD_VERSION:
strLabel = GetVersion();
break;
case SYSTEM_BUILD_DATE:
strLabel = GetBuild();
break;
case SYSTEM_FREE_MEMORY:
case SYSTEM_FREE_MEMORY_PERCENT:
case SYSTEM_USED_MEMORY:
case SYSTEM_USED_MEMORY_PERCENT:
case SYSTEM_TOTAL_MEMORY:
{
MEMORYSTATUS stat;
GlobalMemoryStatus(&stat);
int iMemPercentFree = 100 - ((int)( 100.0f* (stat.dwTotalPhys - stat.dwAvailPhys)/stat.dwTotalPhys + 0.5f ));
int iMemPercentUsed = 100 - iMemPercentFree;
if (info == SYSTEM_FREE_MEMORY)
strLabel.Format("%luMB", (ULONG)(stat.dwAvailPhys/MB));
else if (info == SYSTEM_FREE_MEMORY_PERCENT)
strLabel.Format("%i%%", iMemPercentFree);
else if (info == SYSTEM_USED_MEMORY)
strLabel.Format("%luMB", (ULONG)((stat.dwTotalPhys - stat.dwAvailPhys)/MB));
else if (info == SYSTEM_USED_MEMORY_PERCENT)
strLabel.Format("%i%%", iMemPercentUsed);
else if (info == SYSTEM_TOTAL_MEMORY)
strLabel.Format("%luMB", (ULONG)(stat.dwTotalPhys/MB));
}
break;
case SYSTEM_SCREEN_MODE:
strLabel = g_settings.m_ResInfo[g_graphicsContext.GetVideoResolution()].strMode;
break;
case SYSTEM_SCREEN_WIDTH:
strLabel.Format("%i", g_settings.m_ResInfo[g_graphicsContext.GetVideoResolution()].iWidth);
break;
case SYSTEM_SCREEN_HEIGHT:
strLabel.Format("%i", g_settings.m_ResInfo[g_graphicsContext.GetVideoResolution()].iHeight);
break;
case SYSTEM_CURRENT_WINDOW:
return g_localizeStrings.Get(g_windowManager.GetFocusedWindow());
break;
case SYSTEM_CURRENT_CONTROL:
{
CGUIWindow *window = g_windowManager.GetWindow(g_windowManager.GetFocusedWindow());
if (window)
{
CGUIControl *control = window->GetFocusedControl();
if (control)
strLabel = control->GetDescription();
}
}
break;
#ifdef HAS_DVD_DRIVE
case SYSTEM_DVD_LABEL:
strLabel = g_mediaManager.GetDiskLabel();
break;
#endif
case SYSTEM_ALARM_POS:
if (g_alarmClock.GetRemaining("shutdowntimer") == 0.f)
strLabel = "";
else
{
double fTime = g_alarmClock.GetRemaining("shutdowntimer");
if (fTime > 60.f)
strLabel.Format(g_localizeStrings.Get(13213).c_str(),g_alarmClock.GetRemaining("shutdowntimer")/60.f);
else
strLabel.Format(g_localizeStrings.Get(13214).c_str(),g_alarmClock.GetRemaining("shutdowntimer"));
}
break;
case SYSTEM_PROFILENAME:
strLabel = g_settings.GetCurrentProfile().getName();
break;
case SYSTEM_LANGUAGE:
strLabel = g_guiSettings.GetString("locale.language");
break;
case SYSTEM_TEMPERATURE_UNITS:
strLabel = g_langInfo.GetTempUnitString();
break;
case SYSTEM_PROGRESS_BAR:
{
int percent = GetInt(SYSTEM_PROGRESS_BAR);
if (percent)
strLabel.Format("%i", percent);
}
break;
case LCD_PLAY_ICON:
{
int iPlaySpeed = g_application.GetPlaySpeed();
if (g_application.IsPaused())
strLabel.Format("\7");
else if (iPlaySpeed < 1)
strLabel.Format("\3:%ix", iPlaySpeed);
else if (iPlaySpeed > 1)
strLabel.Format("\4:%ix", iPlaySpeed);
else
strLabel.Format("\5");
}
break;
case LCD_TIME_21:
case LCD_TIME_22:
case LCD_TIME_W21:
case LCD_TIME_W22:
case LCD_TIME_41:
case LCD_TIME_42:
case LCD_TIME_43:
case LCD_TIME_44:
//alternatively, set strLabel
return GetLcdTime( info );
break;
case SKIN_THEME:
if (g_guiSettings.GetString("lookandfeel.skintheme").Equals("skindefault"))
strLabel = g_localizeStrings.Get(15109);
else
strLabel = g_guiSettings.GetString("lookandfeel.skintheme");
break;
case SKIN_COLOUR_THEME:
if (g_guiSettings.GetString("lookandfeel.skincolors").Equals("skindefault"))
strLabel = g_localizeStrings.Get(15109);
else
strLabel = g_guiSettings.GetString("lookandfeel.skincolors");
break;
#ifdef HAS_LCD
case LCD_PROGRESS_BAR:
if (g_lcd) strLabel = g_lcd->GetProgressBar(g_application.GetTime(), g_application.GetTotalTime());
break;
#endif
case NETWORK_IP_ADDRESS:
{
CNetworkInterface* iface = g_application.getNetwork().GetFirstConnectedInterface();
if (iface)
return iface->GetCurrentIPAddress();
}
break;
case NETWORK_SUBNET_ADDRESS:
{
CNetworkInterface* iface = g_application.getNetwork().GetFirstConnectedInterface();
if (iface)
return iface->GetCurrentNetmask();
}
break;
case NETWORK_GATEWAY_ADDRESS:
{
CNetworkInterface* iface = g_application.getNetwork().GetFirstConnectedInterface();
if (iface)
return iface->GetCurrentDefaultGateway();
}
break;
case NETWORK_DNS1_ADDRESS:
{
vector<CStdString> nss = g_application.getNetwork().GetNameServers();
if (nss.size() >= 1)
return nss[0];
}
break;
case NETWORK_DNS2_ADDRESS:
{
vector<CStdString> nss = g_application.getNetwork().GetNameServers();
if (nss.size() >= 2)
return nss[1];
}
break;
case NETWORK_DHCP_ADDRESS:
{
CStdString dhcpserver;
return dhcpserver;
}
break;
case NETWORK_LINK_STATE:
{
CStdString linkStatus = g_localizeStrings.Get(151);
linkStatus += " ";
CNetworkInterface* iface = g_application.getNetwork().GetFirstConnectedInterface();
if (iface && iface->IsConnected())
linkStatus += g_localizeStrings.Get(15207);
else
linkStatus += g_localizeStrings.Get(15208);
return linkStatus;
}
break;
case AUDIOSCROBBLER_CONN_STATE:
case AUDIOSCROBBLER_SUBMIT_INT:
case AUDIOSCROBBLER_FILES_CACHED:
case AUDIOSCROBBLER_SUBMIT_STATE:
strLabel=GetAudioScrobblerLabel(info);
break;
case VISUALISATION_PRESET:
{
CGUIMessage msg(GUI_MSG_GET_VISUALISATION, 0, 0);
g_windowManager.SendMessage(msg);
if (msg.GetPointer())
{
CVisualisation* viz = NULL;
viz = (CVisualisation*)msg.GetPointer();
if (viz)
{
strLabel = viz->GetPresetName();
CUtil::RemoveExtension(strLabel);
}
}
}
break;
case VISUALISATION_NAME:
{
AddonPtr addon;
strLabel = g_guiSettings.GetString("musicplayer.visualisation");
if (CAddonMgr::Get().GetAddon(strLabel,addon) && addon)
strLabel = addon->Name();
}
break;
case FANART_COLOR1:
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (window)
return ((CGUIMediaWindow *)window)->CurrentDirectory().GetProperty("fanart_color1");
}
break;
case FANART_COLOR2:
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (window)
return ((CGUIMediaWindow *)window)->CurrentDirectory().GetProperty("fanart_color2");
}
break;
case FANART_COLOR3:
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (window)
return ((CGUIMediaWindow *)window)->CurrentDirectory().GetProperty("fanart_color3");
}
break;
case FANART_IMAGE:
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (window)
return ((CGUIMediaWindow *)window)->CurrentDirectory().GetProperty("fanart_image");
}
break;
case SYSTEM_RENDER_VENDOR:
strLabel = g_Windowing.GetRenderVendor();
break;
case SYSTEM_RENDER_RENDERER:
strLabel = g_Windowing.GetRenderRenderer();
break;
case SYSTEM_RENDER_VERSION:
strLabel = g_Windowing.GetRenderVersionString();
break;
}
return strLabel;
}
// tries to get a integer value for use in progressbars/sliders and such
int CGUIInfoManager::GetInt(int info, int contextWindow) const
{
switch( info )
{
case PLAYER_VOLUME:
return g_application.GetVolume();
case PLAYER_SUBTITLE_DELAY:
return g_application.GetSubtitleDelay();
case PLAYER_AUDIO_DELAY:
return g_application.GetAudioDelay();
case PLAYER_PROGRESS:
case PLAYER_SEEKBAR:
case PLAYER_CACHELEVEL:
case PLAYER_CHAPTER:
case PLAYER_CHAPTERCOUNT:
{
if( g_application.IsPlaying() && g_application.m_pPlayer)
{
switch( info )
{
case PLAYER_PROGRESS:
return (int)(g_application.GetPercentage());
case PLAYER_SEEKBAR:
{
CGUIDialogSeekBar *seekBar = (CGUIDialogSeekBar*)g_windowManager.GetWindow(WINDOW_DIALOG_SEEK_BAR);
return seekBar ? (int)seekBar->GetPercentage() : 0;
}
case PLAYER_CACHELEVEL:
return (int)(g_application.m_pPlayer->GetCacheLevel());
case PLAYER_CHAPTER:
return g_application.m_pPlayer->GetChapter();
case PLAYER_CHAPTERCOUNT:
return g_application.m_pPlayer->GetChapterCount();
}
}
}
break;
case SYSTEM_FREE_MEMORY:
case SYSTEM_USED_MEMORY:
{
MEMORYSTATUS stat;
GlobalMemoryStatus(&stat);
int memPercentUsed = (int)( 100.0f* (stat.dwTotalPhys - stat.dwAvailPhys)/stat.dwTotalPhys + 0.5f );
if (info == SYSTEM_FREE_MEMORY)
return 100 - memPercentUsed;
return memPercentUsed;
}
case SYSTEM_PROGRESS_BAR:
{
CGUIDialogProgress *bar = (CGUIDialogProgress *)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS);
if (bar && bar->IsDialogRunning())
return bar->GetPercentage();
}
case SYSTEM_FREE_SPACE:
case SYSTEM_FREE_SPACE_C:
case SYSTEM_FREE_SPACE_E:
case SYSTEM_FREE_SPACE_F:
case SYSTEM_FREE_SPACE_G:
case SYSTEM_USED_SPACE:
case SYSTEM_USED_SPACE_C:
case SYSTEM_USED_SPACE_E:
case SYSTEM_USED_SPACE_F:
case SYSTEM_USED_SPACE_G:
case SYSTEM_FREE_SPACE_X:
case SYSTEM_USED_SPACE_X:
case SYSTEM_FREE_SPACE_Y:
case SYSTEM_USED_SPACE_Y:
case SYSTEM_FREE_SPACE_Z:
case SYSTEM_USED_SPACE_Z:
{
int ret = 0;
g_sysinfo.GetHddSpaceInfo(ret, info, true);
return ret;
}
case SYSTEM_CPU_USAGE:
return g_cpuInfo.getUsedPercentage();
}
return 0;
}
// checks the condition and returns it as necessary. Currently used
// for toggle button controls and visibility of images.
bool CGUIInfoManager::GetBool(int condition1, int contextWindow, const CGUIListItem *item)
{
// check our cache
bool bReturn = false;
if (!item && IsCached(condition1, contextWindow, bReturn)) // never use cache for list items
return bReturn;
int condition = abs(condition1);
if(condition >= COMBINED_VALUES_START && (condition - COMBINED_VALUES_START) < (int)(m_CombinedValues.size()) )
{
const CCombinedValue &comb = m_CombinedValues[condition - COMBINED_VALUES_START];
if (!EvaluateBooleanExpression(comb, bReturn, contextWindow, item))
bReturn = false;
}
else if (item && condition >= LISTITEM_START && condition < LISTITEM_END)
bReturn = GetItemBool(item, condition);
// Ethernet Link state checking
// Will check if the Xbox has a Ethernet Link connection! [Cable in!]
// This can used for the skinner to switch off Network or Inter required functions
else if ( condition == SYSTEM_ALWAYS_TRUE)
bReturn = true;
else if (condition == SYSTEM_ALWAYS_FALSE)
bReturn = false;
else if (condition == SYSTEM_ETHERNET_LINK_ACTIVE)
bReturn = true;
else if (condition > SYSTEM_IDLE_TIME_START && condition <= SYSTEM_IDLE_TIME_FINISH)
bReturn = (g_application.GlobalIdleTime() >= condition - SYSTEM_IDLE_TIME_START);
else if (condition == WINDOW_IS_MEDIA)
{ // note: This doesn't return true for dialogs (content, favourites, login, videoinfo)
CGUIWindow *pWindow = g_windowManager.GetWindow(g_windowManager.GetActiveWindow());
bReturn = (pWindow && pWindow->IsMediaWindow());
}
else if (condition == PLAYER_MUTED)
bReturn = g_settings.m_bMute;
else if (condition >= LIBRARY_HAS_MUSIC && condition <= LIBRARY_HAS_MUSICVIDEOS)
bReturn = GetLibraryBool(condition);
else if (condition == LIBRARY_IS_SCANNING)
{
CGUIDialogMusicScan *musicScanner = (CGUIDialogMusicScan *)g_windowManager.GetWindow(WINDOW_DIALOG_MUSIC_SCAN);
CGUIDialogVideoScan *videoScanner = (CGUIDialogVideoScan *)g_windowManager.GetWindow(WINDOW_DIALOG_VIDEO_SCAN);
if (musicScanner->IsScanning() || videoScanner->IsScanning())
bReturn = true;
else
bReturn = false;
}
else if (condition == SYSTEM_PLATFORM_LINUX)
#if defined(_LINUX) && !defined(__APPLE__)
bReturn = true;
#else
bReturn = false;
#endif
else if (condition == SYSTEM_PLATFORM_WINDOWS)
#ifdef WIN32
bReturn = true;
#else
bReturn = false;
#endif
else if (condition == SYSTEM_PLATFORM_OSX)
#ifdef __APPLE__
bReturn = true;
#else
bReturn = false;
#endif
else if (condition == SYSTEM_PLATFORM_XBOX)
bReturn = false;
else if (condition == SYSTEM_MEDIA_DVD)
bReturn = g_mediaManager.IsDiscInDrive();
#ifdef HAS_DVD_DRIVE
else if (condition == SYSTEM_HAS_DRIVE_F)
bReturn = CIoSupport::DriveExists('F');
else if (condition == SYSTEM_HAS_DRIVE_G)
bReturn = CIoSupport::DriveExists('G');
else if (condition == SYSTEM_DVDREADY)
bReturn = g_mediaManager.GetDriveStatus() != DRIVE_NOT_READY;
else if (condition == SYSTEM_TRAYOPEN)
bReturn = g_mediaManager.GetDriveStatus() == DRIVE_OPEN;
#endif
else if (condition == SYSTEM_CAN_POWERDOWN)
bReturn = g_powerManager.CanPowerdown();
else if (condition == SYSTEM_CAN_SUSPEND)
bReturn = g_powerManager.CanSuspend();
else if (condition == SYSTEM_CAN_HIBERNATE)
bReturn = g_powerManager.CanHibernate();
else if (condition == SYSTEM_CAN_REBOOT)
bReturn = g_powerManager.CanReboot();
else if (condition == PLAYER_SHOWINFO)
bReturn = m_playerShowInfo;
else if (condition == PLAYER_SHOWCODEC)
bReturn = m_playerShowCodec;
else if (condition >= SKIN_HAS_THEME_START && condition <= SKIN_HAS_THEME_END)
{ // Note that the code used here could probably be extended to general
// settings conditions (parameter would need to store both the setting name an
// the and the comparison string)
CStdString theme = g_guiSettings.GetString("lookandfeel.skintheme");
theme.ToLower();
CUtil::RemoveExtension(theme);
bReturn = theme.Equals(m_stringParameters[condition - SKIN_HAS_THEME_START]);
}
else if (condition >= MULTI_INFO_START && condition <= MULTI_INFO_END)
{
// cache return value
bool result = GetMultiInfoBool(m_multiInfo[condition - MULTI_INFO_START], contextWindow, item);
if (!item)
CacheBool(condition1, contextWindow, result);
return result;
}
else if (condition == SYSTEM_HASLOCKS)
bReturn = g_settings.GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE;
else if (condition == SYSTEM_ISMASTER)
bReturn = g_settings.GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE && g_passwordManager.bMasterUser;
else if (condition == SYSTEM_LOGGEDON)
bReturn = !(g_windowManager.GetActiveWindow() == WINDOW_LOGIN_SCREEN);
else if (condition == SYSTEM_HAS_LOGINSCREEN)
bReturn = g_settings.UsingLoginScreen();
else if (condition == WEATHER_IS_FETCHED)
bReturn = g_weatherManager.IsFetched();
else if (condition == SYSTEM_INTERNET_STATE)
{
g_sysinfo.GetInfo(condition);
bReturn = g_sysinfo.HasInternet();
}
else if (condition == SKIN_HAS_VIDEO_OVERLAY)
{
bReturn = g_windowManager.IsOverlayAllowed() && g_application.IsPlayingVideo();
}
else if (condition == SKIN_HAS_MUSIC_OVERLAY)
{
bReturn = g_windowManager.IsOverlayAllowed() && g_application.IsPlayingAudio();
}
else if (condition == CONTAINER_HASFILES || condition == CONTAINER_HASFOLDERS)
{
CGUIWindow *pWindow = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (pWindow)
{
const CFileItemList& items=((CGUIMediaWindow*)pWindow)->CurrentDirectory();
for (int i=0;i<items.Size();++i)
{
CFileItemPtr item=items.Get(i);
if (!item->m_bIsFolder && condition == CONTAINER_HASFILES)
{
bReturn=true;
break;
}
else if (item->m_bIsFolder && !item->IsParentFolder() && condition == CONTAINER_HASFOLDERS)
{
bReturn=true;
break;
}
}
}
}
else if (condition == CONTAINER_STACKED)
{
CGUIWindow *pWindow = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (pWindow)
bReturn = ((CGUIMediaWindow*)pWindow)->CurrentDirectory().GetProperty("isstacked")=="1";
}
else if (condition == CONTAINER_HAS_THUMB)
{
CGUIWindow *pWindow = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (pWindow)
bReturn = ((CGUIMediaWindow*)pWindow)->CurrentDirectory().HasThumbnail();
}
else if (condition == VIDEOPLAYER_HAS_INFO)
bReturn = (m_currentFile->HasVideoInfoTag() && !m_currentFile->GetVideoInfoTag()->IsEmpty());
else if (condition >= CONTAINER_SCROLL_PREVIOUS && condition <= CONTAINER_SCROLL_NEXT)
{
// no parameters, so we assume it's just requested for a media window. It therefore
// can only happen if the list has focus.
CGUIWindow *pWindow = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (pWindow)
{
map<int,int>::const_iterator it = m_containerMoves.find(pWindow->GetViewContainerID());
if (it != m_containerMoves.end())
{
if (condition > CONTAINER_STATIC) // moving up
bReturn = it->second >= std::max(condition - CONTAINER_STATIC, 1);
else
bReturn = it->second <= std::min(condition - CONTAINER_STATIC, -1);
}
}
}
else if (g_application.IsPlaying())
{
switch (condition)
{
case PLAYER_HAS_MEDIA:
bReturn = true;
break;
case PLAYER_HAS_AUDIO:
bReturn = g_application.IsPlayingAudio();
break;
case PLAYER_HAS_VIDEO:
bReturn = g_application.IsPlayingVideo();
break;
case PLAYER_PLAYING:
bReturn = !g_application.IsPaused() && (g_application.GetPlaySpeed() == 1);
break;
case PLAYER_PAUSED:
bReturn = g_application.IsPaused();
break;
case PLAYER_REWINDING:
bReturn = !g_application.IsPaused() && g_application.GetPlaySpeed() < 1;
break;
case PLAYER_FORWARDING:
bReturn = !g_application.IsPaused() && g_application.GetPlaySpeed() > 1;
break;
case PLAYER_REWINDING_2x:
bReturn = !g_application.IsPaused() && g_application.GetPlaySpeed() == -2;
break;
case PLAYER_REWINDING_4x:
bReturn = !g_application.IsPaused() && g_application.GetPlaySpeed() == -4;
break;
case PLAYER_REWINDING_8x:
bReturn = !g_application.IsPaused() && g_application.GetPlaySpeed() == -8;
break;
case PLAYER_REWINDING_16x:
bReturn = !g_application.IsPaused() && g_application.GetPlaySpeed() == -16;
break;
case PLAYER_REWINDING_32x:
bReturn = !g_application.IsPaused() && g_application.GetPlaySpeed() == -32;
break;
case PLAYER_FORWARDING_2x:
bReturn = !g_application.IsPaused() && g_application.GetPlaySpeed() == 2;
break;
case PLAYER_FORWARDING_4x:
bReturn = !g_application.IsPaused() && g_application.GetPlaySpeed() == 4;
break;
case PLAYER_FORWARDING_8x:
bReturn = !g_application.IsPaused() && g_application.GetPlaySpeed() == 8;
break;
case PLAYER_FORWARDING_16x:
bReturn = !g_application.IsPaused() && g_application.GetPlaySpeed() == 16;
break;
case PLAYER_FORWARDING_32x:
bReturn = !g_application.IsPaused() && g_application.GetPlaySpeed() == 32;
break;
case PLAYER_CAN_RECORD:
bReturn = g_application.m_pPlayer->CanRecord();
break;
case PLAYER_RECORDING:
bReturn = g_application.m_pPlayer->IsRecording();
break;
case PLAYER_DISPLAY_AFTER_SEEK:
bReturn = GetDisplayAfterSeek();
break;
case PLAYER_CACHING:
bReturn = g_application.m_pPlayer->IsCaching();
break;
case PLAYER_SEEKBAR:
{
CGUIDialogSeekBar *seekBar = (CGUIDialogSeekBar*)g_windowManager.GetWindow(WINDOW_DIALOG_SEEK_BAR);
bReturn = seekBar ? seekBar->IsDialogRunning() : false;
}
break;
case PLAYER_SEEKING:
bReturn = m_playerSeeking;
break;
case PLAYER_SHOWTIME:
bReturn = m_playerShowTime;
break;
case PLAYER_PASSTHROUGH:
bReturn = g_application.m_pPlayer && g_application.m_pPlayer->IsPassthrough();
break;
case MUSICPM_ENABLED:
bReturn = g_partyModeManager.IsEnabled();
break;
case AUDIOSCROBBLER_ENABLED:
bReturn = CLastFmManager::GetInstance()->IsLastFmEnabled();
break;
case LASTFM_RADIOPLAYING:
bReturn = CLastFmManager::GetInstance()->IsRadioEnabled();
break;
case LASTFM_CANLOVE:
bReturn = CLastFmManager::GetInstance()->CanLove();
break;
case LASTFM_CANBAN:
bReturn = CLastFmManager::GetInstance()->CanBan();
break;
case MUSICPLAYER_HASPREVIOUS:
{
// requires current playlist be PLAYLIST_MUSIC
bReturn = false;
if (g_playlistPlayer.GetCurrentPlaylist() == PLAYLIST_MUSIC)
bReturn = (g_playlistPlayer.GetCurrentSong() > 0); // not first song
}
break;
case MUSICPLAYER_HASNEXT:
{
// requires current playlist be PLAYLIST_MUSIC
bReturn = false;
if (g_playlistPlayer.GetCurrentPlaylist() == PLAYLIST_MUSIC)
bReturn = (g_playlistPlayer.GetCurrentSong() < (g_playlistPlayer.GetPlaylist(PLAYLIST_MUSIC).size() - 1)); // not last song
}
break;
case MUSICPLAYER_PLAYLISTPLAYING:
{
bReturn = false;
if (g_application.IsPlayingAudio() && g_playlistPlayer.GetCurrentPlaylist() == PLAYLIST_MUSIC)
bReturn = true;
}
break;
case VIDEOPLAYER_USING_OVERLAYS:
bReturn = (g_guiSettings.GetInt("videoplayer.rendermethod") == RENDER_OVERLAYS);
break;
case VIDEOPLAYER_ISFULLSCREEN:
bReturn = g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_VIDEO;
break;
case VIDEOPLAYER_HASMENU:
bReturn = g_application.m_pPlayer->HasMenu();
break;
case PLAYLIST_ISRANDOM:
bReturn = g_playlistPlayer.IsShuffled(g_playlistPlayer.GetCurrentPlaylist());
break;
case PLAYLIST_ISREPEAT:
bReturn = g_playlistPlayer.GetRepeat(g_playlistPlayer.GetCurrentPlaylist()) == PLAYLIST::REPEAT_ALL;
break;
case PLAYLIST_ISREPEATONE:
bReturn = g_playlistPlayer.GetRepeat(g_playlistPlayer.GetCurrentPlaylist()) == PLAYLIST::REPEAT_ONE;
break;
case PLAYER_HASDURATION:
bReturn = g_application.GetTotalTime() > 0;
break;
case VIDEOPLAYER_HASTELETEXT:
if (g_application.m_pPlayer->GetTeletextCache())
bReturn = true;
break;
case VISUALISATION_LOCKED:
{
CGUIMessage msg(GUI_MSG_GET_VISUALISATION, 0, 0);
g_windowManager.SendMessage(msg);
if (msg.GetPointer())
{
CVisualisation *pVis = (CVisualisation *)msg.GetPointer();
bReturn = pVis->IsLocked();
}
}
break;
case VISUALISATION_ENABLED:
bReturn = g_guiSettings.GetString("musicplayer.visualisation") != "None";
break;
default: // default, use integer value different from 0 as true
bReturn = GetInt(condition) != 0;
}
}
// cache return value
if (condition1 < 0) bReturn = !bReturn;
if (!item) // don't cache item properties
CacheBool(condition1, contextWindow, bReturn);
return bReturn;
}
/// \brief Examines the multi information sent and returns true or false accordingly.
bool CGUIInfoManager::GetMultiInfoBool(const GUIInfo &info, int contextWindow, const CGUIListItem *item)
{
bool bReturn = false;
int condition = abs(info.m_info);
if (condition >= LISTITEM_START && condition <= LISTITEM_END)
{
// TODO: We currently don't use the item that is passed in to here, as these
// conditions only come from Container(id).ListItem(offset).* at this point.
CGUIListItemPtr item;
CGUIWindow *window = NULL;
int data1 = info.GetData1();
if (!data1) // No container specified, so we lookup the current view container
{
window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_HAS_LIST_ITEMS);
if (window && window->IsMediaWindow())
data1 = ((CGUIMediaWindow*)(window))->GetViewContainerID();
}
if (!window) // If we don't have a window already (from lookup above), get one
window = GetWindowWithCondition(contextWindow, 0);
if (window)
{
const CGUIControl *control = window->GetControl(data1);
if (control && control->IsContainer())
item = ((CGUIBaseContainer *)control)->GetListItem(info.GetData2(), info.GetInfoFlag());
}
if (item) // If we got a valid item, do the lookup
bReturn = GetItemBool(item.get(), condition); // Image prioritizes images over labels (in the case of music item ratings for instance)
}
else
{
switch (condition)
{
case SKIN_BOOL:
{
bReturn = g_settings.GetSkinBool(info.GetData1());
}
break;
case SKIN_STRING:
{
if (info.GetData2())
bReturn = g_settings.GetSkinString(info.GetData1()).Equals(m_stringParameters[info.GetData2()]);
else
bReturn = !g_settings.GetSkinString(info.GetData1()).IsEmpty();
}
break;
case STRING_IS_EMPTY:
// note: Get*Image() falls back to Get*Label(), so this should cover all of them
if (item && item->IsFileItem() && info.GetData1() >= LISTITEM_START && info.GetData1() < LISTITEM_END)
bReturn = GetItemImage((const CFileItem *)item, info.GetData1()).IsEmpty();
else
bReturn = GetImage(info.GetData1(), contextWindow).IsEmpty();
break;
case STRING_COMPARE:
{
CStdString compare;
if (info.GetData2() < 0) // info labels are stored with negative numbers
{
int info2 = -info.GetData2();
if (item && item->IsFileItem() && info2 >= LISTITEM_START && info2 < LISTITEM_END)
compare = GetItemImage((const CFileItem *)item, info2);
else
compare = GetImage(info2, contextWindow);
}
else if (info.GetData2() < (int)m_stringParameters.size())
{ // conditional string
compare = m_stringParameters[info.GetData2()];
}
if (item && item->IsFileItem() && info.GetData1() >= LISTITEM_START && info.GetData1() < LISTITEM_END)
bReturn = GetItemImage((const CFileItem *)item, info.GetData1()).Equals(compare);
else
bReturn = GetImage(info.GetData1(), contextWindow).Equals(compare);
}
break;
case INTEGER_GREATER_THAN:
{
CStdString value;
if (item && item->IsFileItem() && info.GetData1() >= LISTITEM_START && info.GetData1() < LISTITEM_END)
value = GetItemImage((const CFileItem *)item, info.GetData1());
else
value = GetImage(info.GetData1(), contextWindow);
// Handle the case when a value contains time separator (:). This makes IntegerGreaterThan
// useful for Player.Time* members without adding a separate set of members returning time in seconds
if ( value.find_first_of( ':' ) != value.npos )
bReturn = StringUtils::TimeStringToSeconds( value ) > info.GetData2();
else
bReturn = atoi( value.c_str() ) > info.GetData2();
}
break;
case STRING_STR:
{
CStdString compare = m_stringParameters[info.GetData2()];
// our compare string is already in lowercase, so lower case our label as well
// as CStdString::Find() is case sensitive
CStdString label;
if (item && item->IsFileItem() && info.GetData1() >= LISTITEM_START && info.GetData1() < LISTITEM_END)
label = GetItemImage((const CFileItem *)item, info.GetData1()).ToLower();
else
label = GetImage(info.GetData1(), contextWindow).ToLower();
if (compare.Right(5).Equals(",left"))
bReturn = label.Find(compare.Mid(0,compare.size()-5)) == 0;
else if (compare.Right(6).Equals(",right"))
{
compare = compare.Mid(0,compare.size()-6);
bReturn = label.Find(compare) == (int)(label.size()-compare.size());
}
else
bReturn = label.Find(compare) > -1;
}
break;
case SYSTEM_ALARM_LESS_OR_EQUAL:
{
int time = lrint(g_alarmClock.GetRemaining(m_stringParameters[info.GetData1()]));
int timeCompare = atoi(m_stringParameters[info.GetData2()]);
if (time > 0)
bReturn = timeCompare >= time;
else
bReturn = false;
}
break;
case CONTROL_GROUP_HAS_FOCUS:
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, 0);
if (window)
bReturn = window->ControlGroupHasFocus(info.GetData1(), info.GetData2());
}
break;
case CONTROL_IS_VISIBLE:
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, 0);
if (window)
{
// Note: This'll only work for unique id's
const CGUIControl *control = window->GetControl(info.GetData1());
if (control)
bReturn = control->IsVisible();
}
}
break;
case CONTROL_IS_ENABLED:
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, 0);
if (window)
{
// Note: This'll only work for unique id's
const CGUIControl *control = window->GetControl(info.GetData1());
if (control)
bReturn = !control->IsDisabled();
}
}
break;
case CONTROL_HAS_FOCUS:
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, 0);
if (window)
bReturn = (window->GetFocusedControlID() == (int)info.GetData1());
}
break;
case BUTTON_SCROLLER_HAS_ICON:
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, 0);
if (window)
{
CGUIControl *pControl = window->GetFocusedControl();
if (pControl && pControl->GetControlType() == CGUIControl::GUICONTROL_BUTTONBAR)
bReturn = ((CGUIButtonScroller *)pControl)->GetActiveButtonID() == (int)info.GetData1();
}
}
break;
case WINDOW_NEXT:
if (info.GetData1())
bReturn = ((int)info.GetData1() == m_nextWindowID);
else
{
CGUIWindow *window = g_windowManager.GetWindow(m_nextWindowID);
if (window && CUtil::GetFileName(window->GetProperty("xmlfile")).Equals(m_stringParameters[info.GetData2()]))
bReturn = true;
}
break;
case WINDOW_PREVIOUS:
if (info.GetData1())
bReturn = ((int)info.GetData1() == m_prevWindowID);
else
{
CGUIWindow *window = g_windowManager.GetWindow(m_prevWindowID);
if (window && CUtil::GetFileName(window->GetProperty("xmlfile")).Equals(m_stringParameters[info.GetData2()]))
bReturn = true;
}
break;
case WINDOW_IS_VISIBLE:
if (info.GetData1())
bReturn = g_windowManager.IsWindowVisible(info.GetData1());
else
bReturn = g_windowManager.IsWindowVisible(m_stringParameters[info.GetData2()]);
break;
case WINDOW_IS_TOPMOST:
if (info.GetData1())
bReturn = g_windowManager.IsWindowTopMost(info.GetData1());
else
bReturn = g_windowManager.IsWindowTopMost(m_stringParameters[info.GetData2()]);
break;
case WINDOW_IS_ACTIVE:
if (info.GetData1())
bReturn = g_windowManager.IsWindowActive(info.GetData1());
else
bReturn = g_windowManager.IsWindowActive(m_stringParameters[info.GetData2()]);
break;
case SYSTEM_HAS_ALARM:
bReturn = g_alarmClock.HasAlarm(m_stringParameters[info.GetData1()]);
break;
case SYSTEM_GET_BOOL:
bReturn = g_guiSettings.GetBool(m_stringParameters[info.GetData1()]);
break;
case SYSTEM_HAS_CORE_ID:
bReturn = g_cpuInfo.HasCoreId(info.GetData1());
break;
case SYSTEM_SETTING:
{
if ( m_stringParameters[info.GetData1()].Equals("hidewatched") )
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (window)
bReturn = g_settings.GetWatchMode(((CGUIMediaWindow *)window)->CurrentDirectory().GetContent()) == VIDEO_SHOW_UNWATCHED;
}
}
break;
case SYSTEM_HAS_ADDON:
{
AddonPtr addon;
bReturn = CAddonMgr::Get().GetAddon(m_stringParameters[info.GetData1()],addon) && addon;
break;
}
case CONTAINER_SCROLL_PREVIOUS:
case CONTAINER_MOVE_PREVIOUS:
case CONTAINER_MOVE_NEXT:
case CONTAINER_SCROLL_NEXT:
{
map<int,int>::const_iterator it = m_containerMoves.find(info.GetData1());
if (it != m_containerMoves.end())
{
if (condition > CONTAINER_STATIC) // moving up
bReturn = it->second >= std::max(condition - CONTAINER_STATIC, 1);
else
bReturn = it->second <= std::min(condition - CONTAINER_STATIC, -1);
}
}
break;
case CONTAINER_CONTENT:
{
CStdString content;
CGUIWindow *window = GetWindowWithCondition(contextWindow, 0);
if (window)
{
if (window->GetID() == WINDOW_MUSIC_INFO)
content = ((CGUIWindowMusicInfo *)window)->CurrentDirectory().GetContent();
else if (window->GetID() == WINDOW_VIDEO_INFO)
content = ((CGUIWindowVideoInfo *)window)->CurrentDirectory().GetContent();
}
if (content.IsEmpty())
{
window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (window)
content = ((CGUIMediaWindow *)window)->CurrentDirectory().GetContent();
}
bReturn = m_stringParameters[info.GetData1()].Equals(content);
}
break;
case CONTAINER_ROW:
case CONTAINER_COLUMN:
case CONTAINER_POSITION:
case CONTAINER_HAS_NEXT:
case CONTAINER_HAS_PREVIOUS:
case CONTAINER_SCROLLING:
case CONTAINER_SUBITEM:
{
const CGUIControl *control = NULL;
if (info.GetData1())
{ // container specified
CGUIWindow *window = GetWindowWithCondition(contextWindow, 0);
if (window)
control = window->GetControl(info.GetData1());
}
else
{ // no container specified - assume a mediawindow
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (window)
control = window->GetControl(window->GetViewContainerID());
}
if (control)
bReturn = control->GetCondition(condition, info.GetData2());
}
break;
case CONTAINER_HAS_FOCUS:
{ // grab our container
CGUIWindow *window = GetWindowWithCondition(contextWindow, 0);
if (window)
{
const CGUIControl *control = window->GetControl(info.GetData1());
if (control && control->IsContainer())
{
CFileItemPtr item = boost::static_pointer_cast<CFileItem>(((CGUIBaseContainer *)control)->GetListItem(0));
if (item && item->m_iprogramCount == info.GetData2()) // programcount used to store item id
bReturn = true;
}
}
break;
}
case VIDEOPLAYER_CONTENT:
{
CStdString strContent="movies";
if (!m_currentFile->HasVideoInfoTag() || m_currentFile->GetVideoInfoTag()->IsEmpty())
strContent = "files";
if (m_currentFile->HasVideoInfoTag() && m_currentFile->GetVideoInfoTag()->m_iSeason > -1) // episode
strContent = "episodes";
if (m_currentFile->HasVideoInfoTag() && !m_currentFile->GetVideoInfoTag()->m_strArtist.IsEmpty())
strContent = "musicvideos";
if (m_currentFile->HasVideoInfoTag() && m_currentFile->GetVideoInfoTag()->m_strStatus == "livetv")
strContent = "livetv";
bReturn = m_stringParameters[info.GetData1()].Equals(strContent);
}
break;
case CONTAINER_SORT_METHOD:
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (window)
{
const CGUIViewState *viewState = ((CGUIMediaWindow*)window)->GetViewState();
if (viewState)
bReturn = ((unsigned int)viewState->GetSortMethod() == info.GetData1());
}
break;
}
case CONTAINER_SORT_DIRECTION:
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (window)
{
const CGUIViewState *viewState = ((CGUIMediaWindow*)window)->GetViewState();
if (viewState)
bReturn = ((unsigned int)viewState->GetDisplaySortOrder() == info.GetData1());
}
break;
}
case SYSTEM_DATE:
{
CDateTime date = CDateTime::GetCurrentDateTime();
int currentDate = date.GetMonth()*100+date.GetDay();
int startDate = info.GetData1();
int stopDate = info.GetData2();
if (stopDate < startDate)
bReturn = currentDate >= startDate || currentDate < stopDate;
else
bReturn = currentDate >= startDate && currentDate < stopDate;
}
break;
case SYSTEM_TIME:
{
CDateTime time=CDateTime::GetCurrentDateTime();
int currentTime = time.GetMinuteOfDay();
int startTime = info.GetData1();
int stopTime = info.GetData2();
if (stopTime < startTime)
bReturn = currentTime >= startTime || currentTime < stopTime;
else
bReturn = currentTime >= startTime && currentTime < stopTime;
}
break;
case MUSICPLAYER_EXISTS:
{
int index = info.GetData2();
if (info.GetData1() == 1)
{ // relative index
if (g_playlistPlayer.GetCurrentPlaylist() != PLAYLIST_MUSIC)
return false;
index += g_playlistPlayer.GetCurrentSong();
}
if (index >= 0 && index < g_playlistPlayer.GetPlaylist(PLAYLIST_MUSIC).size())
return true;
return false;
}
break;
}
}
return (info.m_info < 0) ? !bReturn : bReturn;
}
/// \brief Examines the multi information sent and returns the string as appropriate
CStdString CGUIInfoManager::GetMultiInfoLabel(const GUIInfo &info, int contextWindow) const
{
if (info.m_info == SKIN_STRING)
{
return g_settings.GetSkinString(info.GetData1());
}
else if (info.m_info == SKIN_BOOL)
{
bool bInfo = g_settings.GetSkinBool(info.GetData1());
if (bInfo)
return g_localizeStrings.Get(20122);
}
if (info.m_info >= LISTITEM_START && info.m_info <= LISTITEM_END)
{
CFileItemPtr item;
CGUIWindow *window = NULL;
int data1 = info.GetData1();
if (!data1) // No container specified, so we lookup the current view container
{
window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_HAS_LIST_ITEMS);
if (window && window->IsMediaWindow())
data1 = ((CGUIMediaWindow*)(window))->GetViewContainerID();
}
if (!window) // If we don't have a window already (from lookup above), get one
window = GetWindowWithCondition(contextWindow, 0);
if (window)
{
const CGUIControl *control = window->GetControl(data1);
if (control && control->IsContainer())
item = boost::static_pointer_cast<CFileItem>(((CGUIBaseContainer *)control)->GetListItem(info.GetData2(), info.GetInfoFlag()));
}
if (item) // If we got a valid item, do the lookup
return GetItemImage(item.get(), info.m_info); // Image prioritizes images over labels (in the case of music item ratings for instance)
}
else if (info.m_info == PLAYER_TIME)
{
return GetCurrentPlayTime((TIME_FORMAT)info.GetData1());
}
else if (info.m_info == PLAYER_TIME_REMAINING)
{
return GetCurrentPlayTimeRemaining((TIME_FORMAT)info.GetData1());
}
else if (info.m_info == PLAYER_FINISH_TIME)
{
CDateTime time = CDateTime::GetCurrentDateTime();
time += CDateTimeSpan(0, 0, 0, GetPlayTimeRemaining());
return LocalizeTime(time, (TIME_FORMAT)info.GetData1());
}
else if (info.m_info == PLAYER_TIME_SPEED)
{
CStdString strTime;
if (g_application.GetPlaySpeed() != 1)
strTime.Format("%s (%ix)", GetCurrentPlayTime((TIME_FORMAT)info.GetData1()).c_str(), g_application.GetPlaySpeed());
else
strTime = GetCurrentPlayTime();
return strTime;
}
else if (info.m_info == PLAYER_DURATION)
{
return GetDuration((TIME_FORMAT)info.GetData1());
}
else if (info.m_info == PLAYER_SEEKTIME)
{
TIME_FORMAT format = (TIME_FORMAT)info.GetData1();
if (format == TIME_FORMAT_GUESS && GetTotalPlayTime() >= 3600)
format = TIME_FORMAT_HH_MM_SS;
CGUIDialogSeekBar *seekBar = (CGUIDialogSeekBar*)g_windowManager.GetWindow(WINDOW_DIALOG_SEEK_BAR);
if (seekBar)
return seekBar->GetSeekTimeLabel(format);
}
else if (info.m_info == PLAYER_SEEKOFFSET)
{
CStdString seekOffset = StringUtils::SecondsToTimeString(abs(m_seekOffset), (TIME_FORMAT)info.GetData1());
if (m_seekOffset < 0)
return "-" + seekOffset;
if (m_seekOffset > 0)
return "+" + seekOffset;
}
else if (info.m_info == SYSTEM_TIME)
{
return GetTime((TIME_FORMAT)info.GetData1());
}
else if (info.m_info == CONTAINER_NUM_PAGES || info.m_info == CONTAINER_CURRENT_PAGE ||
info.m_info == CONTAINER_NUM_ITEMS || info.m_info == CONTAINER_POSITION)
{
const CGUIControl *control = NULL;
if (info.GetData1())
{ // container specified
CGUIWindow *window = GetWindowWithCondition(contextWindow, 0);
if (window)
control = window->GetControl(info.GetData1());
}
else
{ // no container specified - assume a mediawindow
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (window)
control = window->GetControl(window->GetViewContainerID());
}
if (control)
{
if (control->IsContainer())
return ((CGUIBaseContainer *)control)->GetLabel(info.m_info);
else if (control->GetControlType() == CGUIControl::GUICONTROL_TEXTBOX)
return ((CGUITextBox *)control)->GetLabel(info.m_info);
}
}
else if (info.m_info == SYSTEM_GET_CORE_USAGE)
{
CStdString strCpu;
strCpu.Format("%4.2f", g_cpuInfo.GetCoreInfo(info.GetData1()).m_fPct);
return strCpu;
}
else if (info.m_info >= MUSICPLAYER_TITLE && info.m_info <= MUSICPLAYER_ALBUM_ARTIST)
return GetMusicPlaylistInfo(info);
else if (info.m_info == CONTAINER_PROPERTY)
{
CGUIWindow *window = NULL;
if (info.GetData1())
{ // container specified
window = GetWindowWithCondition(contextWindow, 0);
}
else
{ // no container specified - assume a mediawindow
window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
}
if (window)
return ((CGUIMediaWindow *)window)->CurrentDirectory().GetProperty(m_stringParameters[info.GetData2()]);
}
else if (info.m_info == CONTROL_GET_LABEL)
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, 0);
if (window)
{
const CGUIControl *control = window->GetControl(info.GetData1());
if (control)
return control->GetDescription();
}
}
else if (info.m_info == WINDOW_PROPERTY)
{
CGUIWindow *window = NULL;
if (info.GetData1())
{ // window specified
window = g_windowManager.GetWindow(info.GetData1());//GetWindowWithCondition(contextWindow, 0);
}
else
{ // no window specified - assume active
window = GetWindowWithCondition(contextWindow, 0);
}
if (window)
return window->GetProperty(m_stringParameters[info.GetData2()]);
}
else if (info.m_info == SYSTEM_ADDON_TITLE ||
info.m_info == SYSTEM_ADDON_ICON)
{
AddonPtr addon;
if (info.GetData2() == 0)
CAddonMgr::Get().GetAddon(const_cast<CGUIInfoManager*>(this)->GetLabel(info.GetData1(), contextWindow),addon);
else
CAddonMgr::Get().GetAddon(m_stringParameters[info.GetData1()],addon);
if (addon && info.m_info == SYSTEM_ADDON_TITLE)
return addon->Name();
if (addon && info.m_info == SYSTEM_ADDON_ICON)
return addon->Icon();
}
return StringUtils::EmptyString;
}
/// \brief Obtains the filename of the image to show from whichever subsystem is needed
CStdString CGUIInfoManager::GetImage(int info, int contextWindow)
{
if (info >= MULTI_INFO_START && info <= MULTI_INFO_END)
{
return GetMultiInfoLabel(m_multiInfo[info - MULTI_INFO_START], contextWindow);
}
else if (info == WEATHER_CONDITIONS)
return g_weatherManager.GetInfo(WEATHER_IMAGE_CURRENT_ICON);
else if (info == SYSTEM_PROFILETHUMB)
{
CStdString thumb = g_settings.GetCurrentProfile().getThumb();
if (thumb.IsEmpty())
thumb = "unknown-user.png";
return thumb;
}
else if (info == MUSICPLAYER_COVER)
{
if (!g_application.IsPlayingAudio()) return "";
return m_currentFile->HasThumbnail() ? m_currentFile->GetThumbnailImage() : "DefaultAlbumCover.png";
}
else if (info == MUSICPLAYER_RATING)
{
if (!g_application.IsPlayingAudio()) return "";
return GetItemImage(m_currentFile, LISTITEM_RATING);
}
else if (info == PLAYER_STAR_RATING)
{
if (!g_application.IsPlaying()) return "";
return GetItemImage(m_currentFile, LISTITEM_STAR_RATING);
}
else if (info == VIDEOPLAYER_COVER)
{
if (!g_application.IsPlayingVideo()) return "";
if(m_currentMovieThumb.IsEmpty())
return m_currentFile->HasThumbnail() ? m_currentFile->GetThumbnailImage() : "DefaultVideoCover.png";
else return m_currentMovieThumb;
}
else if (info == CONTAINER_FOLDERTHUMB)
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (window)
return GetItemImage(&const_cast<CFileItemList&>(((CGUIMediaWindow*)window)->CurrentDirectory()), LISTITEM_THUMB);
}
else if (info == CONTAINER_TVSHOWTHUMB)
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (window)
return ((CGUIMediaWindow *)window)->CurrentDirectory().GetProperty("tvshowthumb");
}
else if (info == CONTAINER_SEASONTHUMB)
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (window)
return ((CGUIMediaWindow *)window)->CurrentDirectory().GetProperty("seasonthumb");
}
else if (info == LISTITEM_THUMB || info == LISTITEM_ICON || info == LISTITEM_ACTUAL_ICON ||
info == LISTITEM_OVERLAY || info == LISTITEM_RATING || info == LISTITEM_STAR_RATING)
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_HAS_LIST_ITEMS);
if (window)
{
CFileItemPtr item = window->GetCurrentListItem();
if (item)
return GetItemImage(item.get(), info);
}
}
return GetLabel(info, contextWindow);
}
CStdString CGUIInfoManager::GetDate(bool bNumbersOnly)
{
CDateTime time=CDateTime::GetCurrentDateTime();
return time.GetAsLocalizedDate(!bNumbersOnly);
}
CStdString CGUIInfoManager::GetTime(TIME_FORMAT format) const
{
CDateTime time=CDateTime::GetCurrentDateTime();
return LocalizeTime(time, format);
}
CStdString CGUIInfoManager::GetLcdTime( int _eInfo ) const
{
CDateTime time=CDateTime::GetCurrentDateTime();
CStdString strLcdTime;
#ifdef HAS_LCD
UINT nCharset;
UINT nLine;
CStdString strTimeMarker;
nCharset = 0;
nLine = 0;
switch ( _eInfo )
{
case LCD_TIME_21:
nCharset = 1; // CUSTOM_CHARSET_SMALLCHAR;
nLine = 0;
strTimeMarker = ".";
break;
case LCD_TIME_22:
nCharset = 1; // CUSTOM_CHARSET_SMALLCHAR;
nLine = 1;
strTimeMarker = ".";
break;
case LCD_TIME_W21:
nCharset = 2; // CUSTOM_CHARSET_MEDIUMCHAR;
nLine = 0;
strTimeMarker = ".";
break;
case LCD_TIME_W22:
nCharset = 2; // CUSTOM_CHARSET_MEDIUMCHAR;
nLine = 1;
strTimeMarker = ".";
break;
case LCD_TIME_41:
nCharset = 3; // CUSTOM_CHARSET_BIGCHAR;
nLine = 0;
strTimeMarker = " ";
break;
case LCD_TIME_42:
nCharset = 3; // CUSTOM_CHARSET_BIGCHAR;
nLine = 1;
strTimeMarker = "o";
break;
case LCD_TIME_43:
nCharset = 3; // CUSTOM_CHARSET_BIGCHAR;
nLine = 2;
strTimeMarker = "o";
break;
case LCD_TIME_44:
nCharset = 3; // CUSTOM_CHARSET_BIGCHAR;
nLine = 3;
strTimeMarker = " ";
break;
}
strLcdTime += g_lcd->GetBigDigit( nCharset, time.GetHour() , nLine, 2, 2, true );
strLcdTime += strTimeMarker;
strLcdTime += g_lcd->GetBigDigit( nCharset, time.GetMinute(), nLine, 2, 2, false );
strLcdTime += strTimeMarker;
strLcdTime += g_lcd->GetBigDigit( nCharset, time.GetSecond(), nLine, 2, 2, false );
#endif
return strLcdTime;
}
CStdString CGUIInfoManager::LocalizeTime(const CDateTime &time, TIME_FORMAT format) const
{
const CStdString timeFormat = g_langInfo.GetTimeFormat();
bool use12hourclock = timeFormat.Find('h') != -1;
switch (format)
{
case TIME_FORMAT_GUESS:
return time.GetAsLocalizedTime("", false);
case TIME_FORMAT_SS:
return time.GetAsLocalizedTime("ss", true);
case TIME_FORMAT_MM:
return time.GetAsLocalizedTime("mm", true);
case TIME_FORMAT_MM_SS:
return time.GetAsLocalizedTime("mm:ss", true);
case TIME_FORMAT_HH: // this forces it to a 12 hour clock
return time.GetAsLocalizedTime(use12hourclock ? "h" : "HH", false);
case TIME_FORMAT_HH_MM:
return time.GetAsLocalizedTime(use12hourclock ? "h:mm" : "HH:mm", false);
case TIME_FORMAT_HH_MM_XX:
return time.GetAsLocalizedTime(use12hourclock ? "h:mm xx" : "HH:mm", false);
case TIME_FORMAT_HH_MM_SS:
return time.GetAsLocalizedTime("", true);
default:
break;
}
return time.GetAsLocalizedTime("", false);
}
CStdString CGUIInfoManager::GetDuration(TIME_FORMAT format) const
{
if (g_application.IsPlayingAudio() && m_currentFile->HasMusicInfoTag())
{
const CMusicInfoTag& tag = *m_currentFile->GetMusicInfoTag();
if (tag.GetDuration() > 0)
return StringUtils::SecondsToTimeString(tag.GetDuration(), format);
}
if (g_application.IsPlayingVideo() && !m_currentMovieDuration.IsEmpty())
return m_currentMovieDuration; // for tuxbox
unsigned int iTotal = (unsigned int)g_application.GetTotalTime();
if (iTotal > 0)
return StringUtils::SecondsToTimeString(iTotal, format);
return "";
}
CStdString CGUIInfoManager::GetMusicPartyModeLabel(int item)
{
// get song counts
if (item >= MUSICPM_SONGSPLAYED && item <= MUSICPM_RANDOMSONGSPICKED)
{
int iSongs = -1;
switch (item)
{
case MUSICPM_SONGSPLAYED:
{
iSongs = g_partyModeManager.GetSongsPlayed();
break;
}
case MUSICPM_MATCHINGSONGS:
{
iSongs = g_partyModeManager.GetMatchingSongs();
break;
}
case MUSICPM_MATCHINGSONGSPICKED:
{
iSongs = g_partyModeManager.GetMatchingSongsPicked();
break;
}
case MUSICPM_MATCHINGSONGSLEFT:
{
iSongs = g_partyModeManager.GetMatchingSongsLeft();
break;
}
case MUSICPM_RELAXEDSONGSPICKED:
{
iSongs = g_partyModeManager.GetRelaxedSongs();
break;
}
case MUSICPM_RANDOMSONGSPICKED:
{
iSongs = g_partyModeManager.GetRandomSongs();
break;
}
}
if (iSongs < 0)
return "";
CStdString strLabel;
strLabel.Format("%i", iSongs);
return strLabel;
}
return "";
}
const CStdString CGUIInfoManager::GetMusicPlaylistInfo(const GUIInfo& info) const
{
PLAYLIST::CPlayList& playlist = g_playlistPlayer.GetPlaylist(PLAYLIST_MUSIC);
if (playlist.size() < 1)
return "";
int index = info.GetData2();
if (info.GetData1() == 1)
{ // relative index (requires current playlist is PLAYLIST_MUSIC)
if (g_playlistPlayer.GetCurrentPlaylist() != PLAYLIST_MUSIC)
return "";
index = g_playlistPlayer.GetNextSong(index);
}
if (index < 0 || index >= playlist.size())
return "";
CFileItemPtr playlistItem = playlist[index];
if (!playlistItem->GetMusicInfoTag()->Loaded())
{
playlistItem->LoadMusicTag();
playlistItem->GetMusicInfoTag()->SetLoaded();
}
// try to set a thumbnail
if (!playlistItem->HasThumbnail())
{
playlistItem->SetMusicThumb();
// still no thumb? then just the set the default cover
if (!playlistItem->HasThumbnail())
playlistItem->SetThumbnailImage("DefaultAlbumCover.png");
}
if (info.m_info == MUSICPLAYER_PLAYLISTPOS)
{
CStdString strPosition = "";
strPosition.Format("%i", index + 1);
return strPosition;
}
else if (info.m_info == MUSICPLAYER_COVER)
return playlistItem->GetThumbnailImage();
return GetMusicTagLabel(info.m_info, playlistItem.get());
}
CStdString CGUIInfoManager::GetPlaylistLabel(int item) const
{
if (!g_application.IsPlaying()) return "";
int iPlaylist = g_playlistPlayer.GetCurrentPlaylist();
switch (item)
{
case PLAYLIST_LENGTH:
{
CStdString strLength = "";
strLength.Format("%i", g_playlistPlayer.GetPlaylist(iPlaylist).size());
return strLength;
}
case PLAYLIST_POSITION:
{
CStdString strPosition = "";
strPosition.Format("%i", g_playlistPlayer.GetCurrentSong() + 1);
return strPosition;
}
case PLAYLIST_RANDOM:
{
if (g_playlistPlayer.IsShuffled(iPlaylist))
return g_localizeStrings.Get(590); // 590: Random
else
return g_localizeStrings.Get(591); // 591: Off
}
case PLAYLIST_REPEAT:
{
PLAYLIST::REPEAT_STATE state = g_playlistPlayer.GetRepeat(iPlaylist);
if (state == PLAYLIST::REPEAT_ONE)
return g_localizeStrings.Get(592); // 592: One
else if (state == PLAYLIST::REPEAT_ALL)
return g_localizeStrings.Get(593); // 593: All
else
return g_localizeStrings.Get(594); // 594: Off
}
}
return "";
}
CStdString CGUIInfoManager::GetMusicLabel(int item)
{
if (!g_application.IsPlayingAudio() || !m_currentFile->HasMusicInfoTag()) return "";
switch (item)
{
case MUSICPLAYER_PLAYLISTLEN:
{
if (g_playlistPlayer.GetCurrentPlaylist() == PLAYLIST_MUSIC)
return GetPlaylistLabel(PLAYLIST_LENGTH);
}
break;
case MUSICPLAYER_PLAYLISTPOS:
{
if (g_playlistPlayer.GetCurrentPlaylist() == PLAYLIST_MUSIC)
return GetPlaylistLabel(PLAYLIST_POSITION);
}
break;
case MUSICPLAYER_BITRATE:
{
float fTimeSpan = (float)(CTimeUtils::GetFrameTime() - m_lastMusicBitrateTime);
if (fTimeSpan >= 500.0f)
{
m_MusicBitrate = g_application.m_pPlayer->GetAudioBitrate();
m_lastMusicBitrateTime = CTimeUtils::GetFrameTime();
}
CStdString strBitrate = "";
if (m_MusicBitrate > 0)
strBitrate.Format("%i", MathUtils::round_int((double)m_MusicBitrate / 1000.0));
return strBitrate;
}
break;
case MUSICPLAYER_CHANNELS:
{
CStdString strChannels = "";
if (g_application.m_pPlayer->GetChannels() > 0)
{
strChannels.Format("%i", g_application.m_pPlayer->GetChannels());
}
return strChannels;
}
break;
case MUSICPLAYER_BITSPERSAMPLE:
{
CStdString strBitsPerSample = "";
if (g_application.m_pPlayer->GetBitsPerSample() > 0)
{
strBitsPerSample.Format("%i", g_application.m_pPlayer->GetBitsPerSample());
}
return strBitsPerSample;
}
break;
case MUSICPLAYER_SAMPLERATE:
{
CStdString strSampleRate = "";
if (g_application.m_pPlayer->GetSampleRate() > 0)
{
strSampleRate.Format("%i",g_application.m_pPlayer->GetSampleRate());
}
return strSampleRate;
}
break;
case MUSICPLAYER_CODEC:
{
CStdString strCodec;
strCodec.Format("%s", g_application.m_pPlayer->GetAudioCodecName().c_str());
return strCodec;
}
break;
case MUSICPLAYER_LYRICS:
return GetItemLabel(m_currentFile, AddListItemProp("lyrics"));
}
return GetMusicTagLabel(item, m_currentFile);
}
CStdString CGUIInfoManager::GetMusicTagLabel(int info, const CFileItem *item) const
{
if (!item->HasMusicInfoTag()) return "";
const CMusicInfoTag &tag = *item->GetMusicInfoTag();
switch (info)
{
case MUSICPLAYER_TITLE:
if (tag.GetTitle().size()) { return tag.GetTitle(); }
break;
case MUSICPLAYER_ALBUM:
if (tag.GetAlbum().size()) { return tag.GetAlbum(); }
break;
case MUSICPLAYER_ARTIST:
if (tag.GetArtist().size()) { return tag.GetArtist(); }
break;
case MUSICPLAYER_ALBUM_ARTIST:
if (tag.GetAlbumArtist().size()) { return tag.GetAlbumArtist(); }
break;
case MUSICPLAYER_YEAR:
if (tag.GetYear()) { return tag.GetYearString(); }
break;
case MUSICPLAYER_GENRE:
if (tag.GetGenre().size()) { return tag.GetGenre(); }
break;
case MUSICPLAYER_LYRICS:
if (tag.GetLyrics().size()) { return tag.GetLyrics(); }
break;
case MUSICPLAYER_TRACK_NUMBER:
{
CStdString strTrack;
if (tag.Loaded() && tag.GetTrackNumber() > 0)
{
strTrack.Format("%02i", tag.GetTrackNumber());
return strTrack;
}
}
break;
case MUSICPLAYER_DISC_NUMBER:
{
CStdString strDisc;
if (tag.Loaded() && tag.GetDiscNumber() > 0)
{
strDisc.Format("%02i", tag.GetDiscNumber());
return strDisc;
}
}
break;
case MUSICPLAYER_RATING:
return GetItemLabel(item, LISTITEM_RATING);
case MUSICPLAYER_COMMENT:
return GetItemLabel(item, LISTITEM_COMMENT);
case MUSICPLAYER_DURATION:
return GetItemLabel(item, LISTITEM_DURATION);
}
return "";
}
CStdString CGUIInfoManager::GetVideoLabel(int item)
{
if (!g_application.IsPlayingVideo())
return "";
if (item == VIDEOPLAYER_TITLE)
{
if (m_currentFile->HasVideoInfoTag() && !m_currentFile->GetVideoInfoTag()->m_strTitle.IsEmpty())
return m_currentFile->GetVideoInfoTag()->m_strTitle;
// don't have the title, so use dvdplayer, label, or drop down to title from path
if (!g_application.m_pPlayer->GetPlayingTitle().IsEmpty())
return g_application.m_pPlayer->GetPlayingTitle();
if (!m_currentFile->GetLabel().IsEmpty())
return m_currentFile->GetLabel();
// Fallback to the filename for the title/label name. URLDecode since the path may be an URL
CStdString strVideoLabel = CUtil::GetTitleFromPath(m_currentFile->m_strPath);
CUtil::URLDecode(strVideoLabel);
return strVideoLabel;
}
else if (item == VIDEOPLAYER_PLAYLISTLEN)
{
if (g_playlistPlayer.GetCurrentPlaylist() == PLAYLIST_VIDEO)
return GetPlaylistLabel(PLAYLIST_LENGTH);
}
else if (item == VIDEOPLAYER_PLAYLISTPOS)
{
if (g_playlistPlayer.GetCurrentPlaylist() == PLAYLIST_VIDEO)
return GetPlaylistLabel(PLAYLIST_POSITION);
}
else if (m_currentFile->HasVideoInfoTag())
{
switch (item)
{
case VIDEOPLAYER_ORIGINALTITLE:
return m_currentFile->GetVideoInfoTag()->m_strOriginalTitle;
break;
case VIDEOPLAYER_GENRE:
return m_currentFile->GetVideoInfoTag()->m_strGenre;
break;
case VIDEOPLAYER_DIRECTOR:
return m_currentFile->GetVideoInfoTag()->m_strDirector;
break;
case VIDEOPLAYER_RATING:
{
CStdString strRating;
if (m_currentFile->GetVideoInfoTag()->m_fRating > 0.f)
strRating.Format("%.1f", m_currentFile->GetVideoInfoTag()->m_fRating);
return strRating;
}
break;
case VIDEOPLAYER_RATING_AND_VOTES:
{
CStdString strRatingAndVotes;
if (m_currentFile->GetVideoInfoTag()->m_fRating > 0.f)
{
if (m_currentFile->GetVideoInfoTag()->m_strVotes.IsEmpty())
strRatingAndVotes.Format("%.1f", m_currentFile->GetVideoInfoTag()->m_fRating);
else
strRatingAndVotes.Format("%.1f (%s %s)", m_currentFile->GetVideoInfoTag()->m_fRating, m_currentFile->GetVideoInfoTag()->m_strVotes, g_localizeStrings.Get(20350));
}
return strRatingAndVotes;
}
break;
case VIDEOPLAYER_YEAR:
{
CStdString strYear;
if (m_currentFile->GetVideoInfoTag()->m_iYear > 0)
strYear.Format("%i", m_currentFile->GetVideoInfoTag()->m_iYear);
return strYear;
}
break;
case VIDEOPLAYER_PREMIERED:
{
if (!m_currentFile->GetVideoInfoTag()->m_strFirstAired.IsEmpty())
return m_currentFile->GetVideoInfoTag()->m_strFirstAired;
if (!m_currentFile->GetVideoInfoTag()->m_strPremiered.IsEmpty())
return m_currentFile->GetVideoInfoTag()->m_strPremiered;
}
break;
case VIDEOPLAYER_PLOT:
return m_currentFile->GetVideoInfoTag()->m_strPlot;
case VIDEOPLAYER_TRAILER:
return m_currentFile->GetVideoInfoTag()->m_strTrailer;
case VIDEOPLAYER_PLOT_OUTLINE:
return m_currentFile->GetVideoInfoTag()->m_strPlotOutline;
case VIDEOPLAYER_EPISODE:
{
CStdString strYear;
if (m_currentFile->GetVideoInfoTag()->m_iSpecialSortEpisode > 0)
strYear.Format("S%i", m_currentFile->GetVideoInfoTag()->m_iEpisode);
else if(m_currentFile->GetVideoInfoTag()->m_iEpisode > 0)
strYear.Format("%i", m_currentFile->GetVideoInfoTag()->m_iEpisode);
return strYear;
}
break;
case VIDEOPLAYER_SEASON:
{
CStdString strYear;
if (m_currentFile->GetVideoInfoTag()->m_iSpecialSortSeason > 0)
strYear.Format("%i", m_currentFile->GetVideoInfoTag()->m_iSpecialSortSeason);
else if(m_currentFile->GetVideoInfoTag()->m_iSeason > 0)
strYear.Format("%i", m_currentFile->GetVideoInfoTag()->m_iSeason);
return strYear;
}
break;
case VIDEOPLAYER_TVSHOW:
return m_currentFile->GetVideoInfoTag()->m_strShowTitle;
case VIDEOPLAYER_STUDIO:
return m_currentFile->GetVideoInfoTag()->m_strStudio;
case VIDEOPLAYER_COUNTRY:
return m_currentFile->GetVideoInfoTag()->m_strCountry;
case VIDEOPLAYER_MPAA:
return m_currentFile->GetVideoInfoTag()->m_strMPAARating;
case VIDEOPLAYER_TOP250:
{
CStdString strTop250;
if (m_currentFile->GetVideoInfoTag()->m_iTop250 > 0)
strTop250.Format("%i", m_currentFile->GetVideoInfoTag()->m_iTop250);
return strTop250;
}
break;
case VIDEOPLAYER_CAST:
return m_currentFile->GetVideoInfoTag()->GetCast();
case VIDEOPLAYER_CAST_AND_ROLE:
return m_currentFile->GetVideoInfoTag()->GetCast(true);
case VIDEOPLAYER_ARTIST:
return m_currentFile->GetVideoInfoTag()->m_strArtist;
case VIDEOPLAYER_ALBUM:
return m_currentFile->GetVideoInfoTag()->m_strAlbum;
case VIDEOPLAYER_WRITER:
return m_currentFile->GetVideoInfoTag()->m_strWritingCredits;
case VIDEOPLAYER_TAGLINE:
return m_currentFile->GetVideoInfoTag()->m_strTagLine;
}
}
return "";
}
__int64 CGUIInfoManager::GetPlayTime() const
{
if (g_application.IsPlaying())
{
__int64 lPTS = (__int64)(g_application.GetTime() * 1000);
if (lPTS < 0) lPTS = 0;
return lPTS;
}
return 0;
}
CStdString CGUIInfoManager::GetCurrentPlayTime(TIME_FORMAT format) const
{
if (format == TIME_FORMAT_GUESS && GetTotalPlayTime() >= 3600)
format = TIME_FORMAT_HH_MM_SS;
if (g_application.IsPlayingAudio() || g_application.IsPlayingVideo())
return StringUtils::SecondsToTimeString((int)(GetPlayTime()/1000), format);
return "";
}
int CGUIInfoManager::GetTotalPlayTime() const
{
int iTotalTime = (int)g_application.GetTotalTime();
return iTotalTime > 0 ? iTotalTime : 0;
}
int CGUIInfoManager::GetPlayTimeRemaining() const
{
int iReverse = GetTotalPlayTime() - (int)g_application.GetTime();
return iReverse > 0 ? iReverse : 0;
}
CStdString CGUIInfoManager::GetCurrentPlayTimeRemaining(TIME_FORMAT format) const
{
if (format == TIME_FORMAT_GUESS && GetTotalPlayTime() >= 3600)
format = TIME_FORMAT_HH_MM_SS;
int timeRemaining = GetPlayTimeRemaining();
if (timeRemaining && (g_application.IsPlayingAudio() || g_application.IsPlayingVideo()))
return StringUtils::SecondsToTimeString(timeRemaining, format);
return "";
}
void CGUIInfoManager::ResetCurrentItem()
{
m_currentFile->Reset();
m_currentMovieThumb = "";
m_currentMovieDuration = "";
}
void CGUIInfoManager::SetCurrentItem(CFileItem &item)
{
ResetCurrentItem();
if (item.IsAudio())
SetCurrentSong(item);
else
SetCurrentMovie(item);
}
void CGUIInfoManager::SetCurrentAlbumThumb(const CStdString thumbFileName)
{
if (CFile::Exists(thumbFileName))
m_currentFile->SetThumbnailImage(thumbFileName);
else
{
m_currentFile->SetThumbnailImage("");
m_currentFile->FillInDefaultIcon();
}
}
void CGUIInfoManager::SetCurrentSong(CFileItem &item)
{
CLog::Log(LOGDEBUG,"CGUIInfoManager::SetCurrentSong(%s)",item.m_strPath.c_str());
*m_currentFile = item;
m_currentFile->LoadMusicTag();
if (m_currentFile->GetMusicInfoTag()->GetTitle().IsEmpty())
{
// No title in tag, show filename only
m_currentFile->GetMusicInfoTag()->SetTitle(CUtil::GetTitleFromPath(m_currentFile->m_strPath));
}
m_currentFile->GetMusicInfoTag()->SetLoaded(true);
// find a thumb for this file.
if (m_currentFile->IsInternetStream())
{
if (!g_application.m_strPlayListFile.IsEmpty())
{
CLog::Log(LOGDEBUG,"Streaming media detected... using %s to find a thumb", g_application.m_strPlayListFile.c_str());
CFileItem streamingItem(g_application.m_strPlayListFile,false);
streamingItem.SetMusicThumb();
CStdString strThumb = streamingItem.GetThumbnailImage();
if (CFile::Exists(strThumb))
m_currentFile->SetThumbnailImage(strThumb);
}
}
else
m_currentFile->SetMusicThumb();
m_currentFile->FillInDefaultIcon();
CMusicInfoLoader::LoadAdditionalTagInfo(m_currentFile);
}
void CGUIInfoManager::SetCurrentMovie(CFileItem &item)
{
CLog::Log(LOGDEBUG,"CGUIInfoManager::SetCurrentMovie(%s)",item.m_strPath.c_str());
*m_currentFile = item;
if (!m_currentFile->HasVideoInfoTag() || m_currentFile->GetVideoInfoTag()->IsEmpty())
{ // attempt to get some information
CVideoDatabase dbs;
dbs.Open();
if (dbs.HasMovieInfo(item.m_strPath))
{
dbs.GetMovieInfo(item.m_strPath, *m_currentFile->GetVideoInfoTag());
CLog::Log(LOGDEBUG,"%s, got movie info!", __FUNCTION__);
CLog::Log(LOGDEBUG," Title = %s", m_currentFile->GetVideoInfoTag()->m_strTitle.c_str());
}
else if (dbs.HasEpisodeInfo(item.m_strPath))
{
dbs.GetEpisodeInfo(item.m_strPath, *m_currentFile->GetVideoInfoTag());
CLog::Log(LOGDEBUG,"%s, got episode info!", __FUNCTION__);
CLog::Log(LOGDEBUG," Title = %s", m_currentFile->GetVideoInfoTag()->m_strTitle.c_str());
}
else if (dbs.HasMusicVideoInfo(item.m_strPath))
{
dbs.GetMusicVideoInfo(item.m_strPath, *m_currentFile->GetVideoInfoTag());
CLog::Log(LOGDEBUG,"%s, got music video info!", __FUNCTION__);
CLog::Log(LOGDEBUG," Title = %s", m_currentFile->GetVideoInfoTag()->m_strTitle.c_str());
}
dbs.Close();
}
// Find a thumb for this file.
item.SetVideoThumb();
if (!item.HasThumbnail())
{
CStdString strPath, strFileName;
CUtil::Split(item.GetCachedVideoThumb(), strPath, strFileName);
// create unique thumb for auto generated thumbs
CStdString cachedThumb = strPath + "auto-" + strFileName;
if (CFile::Exists(cachedThumb))
item.SetThumbnailImage(cachedThumb);
}
// find a thumb for this stream
if (item.IsInternetStream())
{
// case where .strm is used to start an audio stream
if (g_application.IsPlayingAudio())
{
SetCurrentSong(item);
return;
}
// else its a video
if (!g_application.m_strPlayListFile.IsEmpty())
{
CLog::Log(LOGDEBUG,"Streaming media detected... using %s to find a thumb", g_application.m_strPlayListFile.c_str());
CFileItem thumbItem(g_application.m_strPlayListFile,false);
thumbItem.SetVideoThumb();
if (thumbItem.HasThumbnail())
item.SetThumbnailImage(thumbItem.GetThumbnailImage());
}
}
item.FillInDefaultIcon();
m_currentMovieThumb = item.GetThumbnailImage();
}
string CGUIInfoManager::GetSystemHeatInfo(int info)
{
if (CTimeUtils::GetFrameTime() - m_lastSysHeatInfoTime >= SYSHEATUPDATEINTERVAL)
{ // update our variables
m_lastSysHeatInfoTime = CTimeUtils::GetFrameTime();
#if defined(_LINUX)
m_cpuTemp = g_cpuInfo.getTemperature();
m_gpuTemp = GetGPUTemperature();
#endif
}
CStdString text;
switch(info)
{
case LCD_CPU_TEMPERATURE:
case SYSTEM_CPU_TEMPERATURE:
return m_cpuTemp.IsValid() ? m_cpuTemp.ToString() : "?";
break;
case LCD_GPU_TEMPERATURE:
case SYSTEM_GPU_TEMPERATURE:
return m_gpuTemp.IsValid() ? m_gpuTemp.ToString() : "?";
break;
case LCD_FAN_SPEED:
case SYSTEM_FAN_SPEED:
text.Format("%i%%", m_fanSpeed * 2);
break;
case SYSTEM_CPU_USAGE:
#if defined(__APPLE__) || defined(_WIN32)
text.Format("%d%%", g_cpuInfo.getUsedPercentage());
#else
text.Format("%s", g_cpuInfo.GetCoresUsageString());
#endif
break;
}
return text;
}
CTemperature CGUIInfoManager::GetGPUTemperature()
{
CStdString cmd = g_advancedSettings.m_gpuTempCmd;
int value = 0,
ret = 0;
char scale = 0;
FILE *p = NULL;
if (cmd.IsEmpty() || !(p = popen(cmd.c_str(), "r")))
return CTemperature();
ret = fscanf(p, "%d %c", &value, &scale);
pclose(p);
if (ret != 2)
return CTemperature();
if (scale == 'C' || scale == 'c')
return CTemperature::CreateFromCelsius(value);
if (scale == 'F' || scale == 'f')
return CTemperature::CreateFromFahrenheit(value);
return CTemperature();
}
CStdString CGUIInfoManager::GetVersion()
{
CStdString tmp;
#ifdef SVN_REV
tmp.Format("%s r%s", VERSION_STRING, SVN_REV);
#else
tmp.Format("%s", VERSION_STRING);
#endif
return tmp;
}
CStdString CGUIInfoManager::GetBuild()
{
CStdString tmp;
tmp.Format("%s", __DATE__);
return tmp;
}
void CGUIInfoManager::SetDisplayAfterSeek(unsigned int timeOut, int seekOffset)
{
if (timeOut>0)
{
m_AfterSeekTimeout = CTimeUtils::GetFrameTime() + timeOut;
if (seekOffset)
m_seekOffset = seekOffset;
}
else
m_AfterSeekTimeout = 0;
}
bool CGUIInfoManager::GetDisplayAfterSeek()
{
if (CTimeUtils::GetFrameTime() < m_AfterSeekTimeout)
return true;
m_seekOffset = 0;
return false;
}
CStdString CGUIInfoManager::GetAudioScrobblerLabel(int item)
{
switch (item)
{
case AUDIOSCROBBLER_CONN_STATE:
return CLastfmScrobbler::GetInstance()->GetConnectionState();
break;
case AUDIOSCROBBLER_SUBMIT_INT:
return CLastfmScrobbler::GetInstance()->GetSubmitInterval();
break;
case AUDIOSCROBBLER_FILES_CACHED:
return CLastfmScrobbler::GetInstance()->GetFilesCached();
break;
case AUDIOSCROBBLER_SUBMIT_STATE:
return CLastfmScrobbler::GetInstance()->GetSubmitState();
break;
}
return "";
}
int CGUIInfoManager::GetOperator(const char ch)
{
if (ch == '[')
return 5;
else if (ch == ']')
return 4;
else if (ch == '!')
return OPERATOR_NOT;
else if (ch == '+')
return OPERATOR_AND;
else if (ch == '|')
return OPERATOR_OR;
else
return 0;
}
bool CGUIInfoManager::EvaluateBooleanExpression(const CCombinedValue &expression, bool &result, int contextWindow, const CGUIListItem *item)
{
// stack to save our bool state as we go
stack<bool> save;
for (list<int>::const_iterator it = expression.m_postfix.begin(); it != expression.m_postfix.end(); ++it)
{
int expr = *it;
if (expr == -OPERATOR_NOT)
{ // NOT the top item on the stack
if (save.size() < 1) return false;
bool expr = save.top();
save.pop();
save.push(!expr);
}
else if (expr == -OPERATOR_AND)
{ // AND the top two items on the stack
if (save.size() < 2) return false;
bool right = save.top(); save.pop();
bool left = save.top(); save.pop();
save.push(left && right);
}
else if (expr == -OPERATOR_OR)
{ // OR the top two items on the stack
if (save.size() < 2) return false;
bool right = save.top(); save.pop();
bool left = save.top(); save.pop();
save.push(left || right);
}
else // operator
save.push(GetBool(expr, contextWindow, item));
}
if (save.size() != 1) return false;
result = save.top();
return true;
}
int CGUIInfoManager::TranslateBooleanExpression(const CStdString &expression)
{
CCombinedValue comb;
comb.m_info = expression;
comb.m_id = COMBINED_VALUES_START + m_CombinedValues.size();
// operator stack
stack<char> save;
CStdString operand;
for (unsigned int i = 0; i < expression.size(); i++)
{
if (GetOperator(expression[i]))
{
// cleanup any operand, translate and put into our expression list
if (!operand.IsEmpty())
{
int iOp = TranslateSingleString(operand);
if (iOp)
comb.m_postfix.push_back(iOp);
operand.clear();
}
// handle closing parenthesis
if (expression[i] == ']')
{
while (save.size())
{
char oper = save.top();
save.pop();
if (oper == '[')
break;
comb.m_postfix.push_back(-GetOperator(oper));
}
}
else
{
// all other operators we pop off the stack any operator
// that has a higher priority than the one we have.
while (!save.empty() && GetOperator(save.top()) > GetOperator(expression[i]))
{
// only handle parenthesis once they're closed.
if (save.top() == '[' && expression[i] != ']')
break;
comb.m_postfix.push_back(-GetOperator(save.top())); // negative denotes operator
save.pop();
}
save.push(expression[i]);
}
}
else
{
operand += expression[i];
}
}
if (!operand.empty())
{
int op = TranslateSingleString(operand);
if (op)
comb.m_postfix.push_back(op);
}
// finish up by adding any operators
while (!save.empty())
{
comb.m_postfix.push_back(-GetOperator(save.top()));
save.pop();
}
// test evaluate
bool test;
if (!EvaluateBooleanExpression(comb, test, WINDOW_INVALID))
CLog::Log(LOGERROR, "Error evaluating boolean expression %s", expression.c_str());
// success - add to our combined values
m_CombinedValues.push_back(comb);
return comb.m_id;
}
void CGUIInfoManager::Clear()
{
m_CombinedValues.clear();
}
void CGUIInfoManager::UpdateFPS()
{
m_frameCounter++;
unsigned int curTime = CTimeUtils::GetFrameTime();
float fTimeSpan = (float)(curTime - m_lastFPSTime);
if (fTimeSpan >= 1000.0f)
{
fTimeSpan /= 1000.0f;
m_fps = m_frameCounter / fTimeSpan;
m_lastFPSTime = curTime;
m_frameCounter = 0;
}
}
int CGUIInfoManager::AddListItemProp(const CStdString &str, int offset)
{
for (int i=0; i < (int)m_listitemProperties.size(); i++)
if (m_listitemProperties[i] == str)
return (LISTITEM_PROPERTY_START+offset + i);
if (m_listitemProperties.size() < LISTITEM_PROPERTY_END - LISTITEM_PROPERTY_START)
{
m_listitemProperties.push_back(str);
return LISTITEM_PROPERTY_START + offset + m_listitemProperties.size() - 1;
}
CLog::Log(LOGERROR,"%s - not enough listitem property space!", __FUNCTION__);
return 0;
}
int CGUIInfoManager::AddMultiInfo(const GUIInfo &info)
{
// check to see if we have this info already
for (unsigned int i = 0; i < m_multiInfo.size(); i++)
if (m_multiInfo[i] == info)
return (int)i + MULTI_INFO_START;
// return the new offset
m_multiInfo.push_back(info);
int id = (int)m_multiInfo.size() + MULTI_INFO_START - 1;
if (id > MULTI_INFO_END)
CLog::Log(LOGERROR, "%s - too many multiinfo bool/labels in this skin", __FUNCTION__);
return id;
}
int CGUIInfoManager::ConditionalStringParameter(const CStdString &parameter)
{
// check to see if we have this parameter already
for (unsigned int i = 0; i < m_stringParameters.size(); i++)
if (parameter.Equals(m_stringParameters[i]))
return (int)i;
// return the new offset
m_stringParameters.push_back(parameter);
return (int)m_stringParameters.size() - 1;
}
CStdString CGUIInfoManager::GetItemLabel(const CFileItem *item, int info) const
{
if (!item) return "";
if (info >= LISTITEM_PROPERTY_START && info - LISTITEM_PROPERTY_START < (int)m_listitemProperties.size())
{ // grab the property
CStdString property = m_listitemProperties[info - LISTITEM_PROPERTY_START];
return item->GetProperty(property);
}
switch (info)
{
case LISTITEM_LABEL:
return item->GetLabel();
case LISTITEM_LABEL2:
return item->GetLabel2();
case LISTITEM_TITLE:
if (item->HasVideoInfoTag())
return item->GetVideoInfoTag()->m_strTitle;
if (item->HasMusicInfoTag())
return item->GetMusicInfoTag()->GetTitle();
break;
case LISTITEM_ORIGINALTITLE:
if (item->HasVideoInfoTag())
return item->GetVideoInfoTag()->m_strOriginalTitle;
break;
case LISTITEM_TRACKNUMBER:
{
CStdString track;
if (item->HasMusicInfoTag())
track.Format("%i", item->GetMusicInfoTag()->GetTrackNumber());
return track;
}
case LISTITEM_ARTIST:
if (item->HasVideoInfoTag())
return item->GetVideoInfoTag()->m_strArtist;
if (item->HasMusicInfoTag())
return item->GetMusicInfoTag()->GetArtist();
break;
case LISTITEM_ALBUM_ARTIST:
if (item->HasMusicInfoTag())
return item->GetMusicInfoTag()->GetAlbumArtist();
break;
case LISTITEM_DIRECTOR:
if (item->HasVideoInfoTag())
return item->GetVideoInfoTag()->m_strDirector;
case LISTITEM_ALBUM:
if (item->HasVideoInfoTag())
return item->GetVideoInfoTag()->m_strAlbum;
if (item->HasMusicInfoTag())
return item->GetMusicInfoTag()->GetAlbum();
break;
case LISTITEM_YEAR:
if (item->HasVideoInfoTag())
{
CStdString strResult;
if (item->GetVideoInfoTag()->m_iYear > 0)
strResult.Format("%i",item->GetVideoInfoTag()->m_iYear);
return strResult;
}
if (item->HasMusicInfoTag())
return item->GetMusicInfoTag()->GetYearString();
break;
case LISTITEM_PREMIERED:
if (item->HasVideoInfoTag())
{
if (!item->GetVideoInfoTag()->m_strFirstAired.IsEmpty())
return item->GetVideoInfoTag()->m_strFirstAired;
if (!item->GetVideoInfoTag()->m_strPremiered.IsEmpty())
return item->GetVideoInfoTag()->m_strPremiered;
}
break;
case LISTITEM_GENRE:
if (item->HasVideoInfoTag())
return item->GetVideoInfoTag()->m_strGenre;
if (item->HasMusicInfoTag())
return item->GetMusicInfoTag()->GetGenre();
break;
case LISTITEM_FILENAME:
if (item->IsMusicDb() && item->HasMusicInfoTag())
return CUtil::GetFileName(item->GetMusicInfoTag()->GetURL());
if (item->IsVideoDb() && item->HasVideoInfoTag())
return CUtil::GetFileName(item->GetVideoInfoTag()->m_strFileNameAndPath);
return CUtil::GetFileName(item->m_strPath);
case LISTITEM_DATE:
if (item->m_dateTime.IsValid())
return item->m_dateTime.GetAsLocalizedDate();
break;
case LISTITEM_SIZE:
if (!item->m_bIsFolder || item->m_dwSize)
return StringUtils::SizeToString(item->m_dwSize);
break;
case LISTITEM_RATING:
{
CStdString rating;
if (item->HasVideoInfoTag() && item->GetVideoInfoTag()->m_fRating > 0.f) // movie rating
rating.Format("%.1f", item->GetVideoInfoTag()->m_fRating);
else if (item->HasMusicInfoTag() && item->GetMusicInfoTag()->GetRating() > '0')
{ // song rating. Images will probably be better than numbers for this in the long run
rating = item->GetMusicInfoTag()->GetRating();
}
return rating;
}
case LISTITEM_RATING_AND_VOTES:
{
if (item->HasVideoInfoTag() && item->GetVideoInfoTag()->m_fRating > 0.f) // movie rating
{
CStdString strRatingAndVotes;
if (item->GetVideoInfoTag()->m_strVotes.IsEmpty())
strRatingAndVotes.Format("%.1f", item->GetVideoInfoTag()->m_fRating);
else
strRatingAndVotes.Format("%.1f (%s %s)", item->GetVideoInfoTag()->m_fRating, item->GetVideoInfoTag()->m_strVotes, g_localizeStrings.Get(20350));
return strRatingAndVotes;
}
}
break;
case LISTITEM_PROGRAM_COUNT:
{
CStdString count;
count.Format("%i", item->m_iprogramCount);
return count;
}
case LISTITEM_DURATION:
{
CStdString duration;
if (item->HasVideoInfoTag())
{
if (item->GetVideoInfoTag()->m_streamDetails.GetVideoDuration() > 0)
duration.Format("%i", item->GetVideoInfoTag()->m_streamDetails.GetVideoDuration() / 60);
else if (!item->GetVideoInfoTag()->m_strRuntime.IsEmpty())
duration = item->GetVideoInfoTag()->m_strRuntime;
}
if (item->HasMusicInfoTag())
{
if (item->GetMusicInfoTag()->GetDuration() > 0)
duration = StringUtils::SecondsToTimeString(item->GetMusicInfoTag()->GetDuration());
}
return duration;
}
case LISTITEM_PLOT:
if (item->HasVideoInfoTag())
{
if (!(!item->GetVideoInfoTag()->m_strShowTitle.IsEmpty() && item->GetVideoInfoTag()->m_iSeason == -1)) // dont apply to tvshows
if (item->GetVideoInfoTag()->m_playCount == 0 && !g_guiSettings.GetBool("videolibrary.showunwatchedplots"))
return g_localizeStrings.Get(20370);
return item->GetVideoInfoTag()->m_strPlot;
}
break;
case LISTITEM_PLOT_OUTLINE:
if (item->HasVideoInfoTag())
return item->GetVideoInfoTag()->m_strPlotOutline;
break;
case LISTITEM_EPISODE:
if (item->HasVideoInfoTag())
{
CStdString strResult;
if (item->GetVideoInfoTag()->m_iSpecialSortEpisode > 0)
strResult.Format("S%d",item->GetVideoInfoTag()->m_iEpisode);
else if (item->GetVideoInfoTag()->m_iEpisode > 0) // if m_iEpisode = -1 there's no episode detail
strResult.Format("%d",item->GetVideoInfoTag()->m_iEpisode);
return strResult;
}
break;
case LISTITEM_SEASON:
if (item->HasVideoInfoTag())
{
CStdString strResult;
if (item->GetVideoInfoTag()->m_iSpecialSortSeason > 0)
strResult.Format("%d",item->GetVideoInfoTag()->m_iSpecialSortSeason);
else if (item->GetVideoInfoTag()->m_iSeason > 0) // if m_iSeason = -1 there's no season detail
strResult.Format("%d",item->GetVideoInfoTag()->m_iSeason);
return strResult;
}
break;
case LISTITEM_TVSHOW:
if (item->HasVideoInfoTag())
return item->GetVideoInfoTag()->m_strShowTitle;
break;
case LISTITEM_COMMENT:
if (item->HasMusicInfoTag())
return item->GetMusicInfoTag()->GetComment();
break;
case LISTITEM_ACTUAL_ICON:
return item->GetIconImage();
case LISTITEM_ICON:
{
CStdString strThumb = item->GetThumbnailImage();
if(!strThumb.IsEmpty() && !g_TextureManager.CanLoad(strThumb))
strThumb = "";
if(strThumb.IsEmpty() && !item->GetIconImage().IsEmpty())
strThumb = item->GetIconImage();
return strThumb;
}
case LISTITEM_OVERLAY:
return item->GetOverlayImage();
case LISTITEM_THUMB:
return item->GetThumbnailImage();
case LISTITEM_FOLDERNAME:
case LISTITEM_PATH:
{
CStdString path;
if (item->IsMusicDb() && item->HasMusicInfoTag())
CUtil::GetDirectory(item->GetMusicInfoTag()->GetURL(), path);
else if (item->IsVideoDb() && item->HasVideoInfoTag())
{
if( item->m_bIsFolder )
path = item->GetVideoInfoTag()->m_strPath;
else
CUtil::GetParentPath(item->GetVideoInfoTag()->m_strFileNameAndPath, path);
}
else
CUtil::GetParentPath(item->m_strPath, path);
path = CURL(path).GetWithoutUserDetails();
if (info==CONTAINER_FOLDERNAME)
{
CUtil::RemoveSlashAtEnd(path);
path=CUtil::GetFileName(path);
}
CUtil::URLDecode(path);
return path;
}
case LISTITEM_FILENAME_AND_PATH:
{
CStdString path;
if (item->IsMusicDb() && item->HasMusicInfoTag())
path = item->GetMusicInfoTag()->GetURL();
else if (item->IsVideoDb() && item->HasVideoInfoTag())
path = item->GetVideoInfoTag()->m_strFileNameAndPath;
else
path = item->m_strPath;
path = CURL(path).GetWithoutUserDetails();
CUtil::URLDecode(path);
return path;
}
case LISTITEM_PICTURE_PATH:
if (item->IsPicture() && (!item->IsZIP() || item->IsRAR() || item->IsCBZ() || item->IsCBR()))
return item->m_strPath;
break;
case LISTITEM_PICTURE_DATETIME:
if (item->HasPictureInfoTag())
return item->GetPictureInfoTag()->GetInfo(SLIDE_EXIF_DATE_TIME);
break;
case LISTITEM_PICTURE_RESOLUTION:
if (item->HasPictureInfoTag())
return item->GetPictureInfoTag()->GetInfo(SLIDE_RESOLUTION);
break;
case LISTITEM_STUDIO:
if (item->HasVideoInfoTag())
return item->GetVideoInfoTag()->m_strStudio;
break;
case LISTITEM_COUNTRY:
if (item->HasVideoInfoTag())
return item->GetVideoInfoTag()->m_strCountry;
break;
case LISTITEM_MPAA:
if (item->HasVideoInfoTag())
return item->GetVideoInfoTag()->m_strMPAARating;
break;
case LISTITEM_CAST:
if (item->HasVideoInfoTag())
return item->GetVideoInfoTag()->GetCast();
break;
case LISTITEM_CAST_AND_ROLE:
if (item->HasVideoInfoTag())
return item->GetVideoInfoTag()->GetCast(true);
break;
case LISTITEM_WRITER:
if (item->HasVideoInfoTag())
return item->GetVideoInfoTag()->m_strWritingCredits;;
break;
case LISTITEM_TAGLINE:
if (item->HasVideoInfoTag())
return item->GetVideoInfoTag()->m_strTagLine;
break;
case LISTITEM_TRAILER:
if (item->HasVideoInfoTag())
return item->GetVideoInfoTag()->m_strTrailer;
break;
case LISTITEM_TOP250:
if (item->HasVideoInfoTag())
{
CStdString strResult;
if (item->GetVideoInfoTag()->m_iTop250 > 0)
strResult.Format("%i",item->GetVideoInfoTag()->m_iTop250);
return strResult;
}
break;
case LISTITEM_SORT_LETTER:
{
CStdString letter;
g_charsetConverter.wToUTF8(item->GetSortLabel().Left(1).ToUpper(), letter);
return letter;
}
break;
case LISTITEM_VIDEO_CODEC:
if (item->HasVideoInfoTag())
return item->GetVideoInfoTag()->m_streamDetails.GetVideoCodec();
break;
case LISTITEM_VIDEO_RESOLUTION:
if (item->HasVideoInfoTag())
return CStreamDetails::VideoDimsToResolutionDescription(item->GetVideoInfoTag()->m_streamDetails.GetVideoWidth(), item->GetVideoInfoTag()->m_streamDetails.GetVideoHeight());
break;
case LISTITEM_VIDEO_ASPECT:
if (item->HasVideoInfoTag())
return CStreamDetails::VideoAspectToAspectDescription(item->GetVideoInfoTag()->m_streamDetails.GetVideoAspect());
break;
case LISTITEM_AUDIO_CODEC:
if (item->HasVideoInfoTag())
{
return item->GetVideoInfoTag()->m_streamDetails.GetAudioCodec();
}
break;
case LISTITEM_AUDIO_CHANNELS:
if (item->HasVideoInfoTag())
{
CStdString strResult;
int iChannels = item->GetVideoInfoTag()->m_streamDetails.GetAudioChannels();
if (iChannels > -1)
strResult.Format("%i", iChannels);
return strResult;
}
break;
case LISTITEM_AUDIO_LANGUAGE:
if (item->HasVideoInfoTag())
return item->GetVideoInfoTag()->m_streamDetails.GetAudioLanguage();
break;
case LISTITEM_SUBTITLE_LANGUAGE:
if (item->HasVideoInfoTag())
return item->GetVideoInfoTag()->m_streamDetails.GetSubtitleLanguage();
break;
}
return "";
}
CStdString CGUIInfoManager::GetItemImage(const CFileItem *item, int info) const
{
switch (info)
{
case LISTITEM_RATING: // old song rating format
{
CStdString rating;
if (item->HasMusicInfoTag())
{
rating.Format("songrating%c.png", item->GetMusicInfoTag()->GetRating());
return rating;
}
}
break;
case LISTITEM_STAR_RATING:
{
CStdString rating;
if (item->HasVideoInfoTag())
{ // rating for videos is assumed 0..10, so convert to 0..5
rating.Format("rating%d.png", (long)((item->GetVideoInfoTag()->m_fRating * 0.5f) + 0.5f));
}
else if (item->HasMusicInfoTag())
{ // song rating.
rating.Format("rating%c.png", item->GetMusicInfoTag()->GetRating());
}
return rating;
}
break;
} /* switch (info) */
return GetItemLabel(item, info);
}
bool CGUIInfoManager::GetItemBool(const CGUIListItem *item, int condition) const
{
if (!item) return false;
if (condition >= LISTITEM_PROPERTY_START && condition - LISTITEM_PROPERTY_START < (int)m_listitemProperties.size())
{ // grab the property
CStdString property = m_listitemProperties[condition - LISTITEM_PROPERTY_START];
CStdString val = item->GetProperty(property);
return (val == "1" || val.CompareNoCase("true") == 0);
}
else if (condition == LISTITEM_ISPLAYING)
{
if (item->IsFileItem() && !m_currentFile->m_strPath.IsEmpty())
{
if (!g_application.m_strPlayListFile.IsEmpty())
{
//playlist file that is currently playing or the playlistitem that is currently playing.
return g_application.m_strPlayListFile.Equals(((const CFileItem *)item)->m_strPath) || m_currentFile->IsSamePath((const CFileItem *)item);
}
return m_currentFile->IsSamePath((const CFileItem *)item);
}
}
else if (condition == LISTITEM_ISSELECTED)
return item->IsSelected();
else if (condition == LISTITEM_IS_FOLDER)
return item->m_bIsFolder;
return false;
}
void CGUIInfoManager::ResetCache()
{
CSingleLock lock(m_critInfo);
m_boolCache.clear();
// reset any animation triggers as well
m_containerMoves.clear();
}
void CGUIInfoManager::ResetPersistentCache()
{
CSingleLock lock(m_critInfo);
m_persistentBoolCache.clear();
}
inline void CGUIInfoManager::CacheBool(int condition, int contextWindow, bool result, bool persistent)
{
// windows have id's up to 13100 or thereabouts (ie 2^14 needed)
// conditionals have id's up to 100000 or thereabouts (ie 2^18 needed)
CSingleLock lock(m_critInfo);
int hash = ((contextWindow & 0x3fff) << 18) | (condition & 0x3ffff);
if (persistent)
m_persistentBoolCache.insert(pair<int, bool>(hash, result));
else
m_boolCache.insert(pair<int, bool>(hash, result));
}
bool CGUIInfoManager::IsCached(int condition, int contextWindow, bool &result) const
{
// windows have id's up to 13100 or thereabouts (ie 2^14 needed)
// conditionals have id's up to 100000 or thereabouts (ie 2^18 needed)
CSingleLock lock(m_critInfo);
int hash = ((contextWindow & 0x3fff) << 18) | (condition & 0x3ffff);
map<int, bool>::const_iterator it = m_boolCache.find(hash);
if (it != m_boolCache.end())
{
result = (*it).second;
return true;
}
it = m_persistentBoolCache.find(hash);
if (it != m_persistentBoolCache.end())
{
result = (*it).second;
return true;
}
return false;
}
// Called from tuxbox service thread to update current status
void CGUIInfoManager::UpdateFromTuxBox()
{
if(g_tuxbox.vVideoSubChannel.mode)
m_currentFile->GetVideoInfoTag()->m_strTitle = g_tuxbox.vVideoSubChannel.current_name;
// Set m_currentMovieDuration
if(!g_tuxbox.sCurSrvData.current_event_duration.IsEmpty() &&
!g_tuxbox.sCurSrvData.next_event_description.IsEmpty() &&
!g_tuxbox.sCurSrvData.current_event_duration.Equals("-") &&
!g_tuxbox.sCurSrvData.next_event_description.Equals("-"))
{
g_tuxbox.sCurSrvData.current_event_duration.Replace("(","");
g_tuxbox.sCurSrvData.current_event_duration.Replace(")","");
m_currentMovieDuration.Format("%s: %s %s (%s - %s)",
g_localizeStrings.Get(180),
g_tuxbox.sCurSrvData.current_event_duration,
g_localizeStrings.Get(12391),
g_tuxbox.sCurSrvData.current_event_time,
g_tuxbox.sCurSrvData.next_event_time);
}
//Set strVideoGenre
if (!g_tuxbox.sCurSrvData.current_event_description.IsEmpty() &&
!g_tuxbox.sCurSrvData.next_event_description.IsEmpty() &&
!g_tuxbox.sCurSrvData.current_event_description.Equals("-") &&
!g_tuxbox.sCurSrvData.next_event_description.Equals("-"))
{
m_currentFile->GetVideoInfoTag()->m_strGenre.Format("%s %s - (%s: %s)",
g_localizeStrings.Get(143),
g_tuxbox.sCurSrvData.current_event_description,
g_localizeStrings.Get(209),
g_tuxbox.sCurSrvData.next_event_description);
}
//Set m_currentMovie.m_strDirector
if (!g_tuxbox.sCurSrvData.current_event_details.Equals("-") &&
!g_tuxbox.sCurSrvData.current_event_details.IsEmpty())
{
m_currentFile->GetVideoInfoTag()->m_strDirector = g_tuxbox.sCurSrvData.current_event_details;
}
}
CStdString CGUIInfoManager::GetPictureLabel(int info) const
{
if (info == SLIDE_FILE_NAME)
return GetItemLabel(m_currentSlide, LISTITEM_FILENAME);
else if (info == SLIDE_FILE_PATH)
{
CStdString path;
CUtil::GetDirectory(m_currentSlide->m_strPath, path);
return CURL(path).GetWithoutUserDetails();
}
else if (info == SLIDE_FILE_SIZE)
return GetItemLabel(m_currentSlide, LISTITEM_SIZE);
else if (info == SLIDE_FILE_DATE)
return GetItemLabel(m_currentSlide, LISTITEM_DATE);
else if (info == SLIDE_INDEX)
{
CGUIWindowSlideShow *slideshow = (CGUIWindowSlideShow *)g_windowManager.GetWindow(WINDOW_SLIDESHOW);
if (slideshow && slideshow->NumSlides())
{
CStdString index;
index.Format("%d/%d", slideshow->CurrentSlide(), slideshow->NumSlides());
return index;
}
}
if (m_currentSlide->HasPictureInfoTag())
return m_currentSlide->GetPictureInfoTag()->GetInfo(info);
return "";
}
void CGUIInfoManager::SetCurrentSlide(CFileItem &item)
{
if (m_currentSlide->m_strPath != item.m_strPath)
{
if (!item.HasPictureInfoTag() && !item.GetPictureInfoTag()->Loaded())
item.GetPictureInfoTag()->Load(item.m_strPath);
*m_currentSlide = item;
}
}
void CGUIInfoManager::ResetCurrentSlide()
{
m_currentSlide->Reset();
}
bool CGUIInfoManager::CheckWindowCondition(CGUIWindow *window, int condition) const
{
// check if it satisfies our condition
if (!window) return false;
if ((condition & WINDOW_CONDITION_HAS_LIST_ITEMS) && !window->HasListItems())
return false;
if ((condition & WINDOW_CONDITION_IS_MEDIA_WINDOW) && !window->IsMediaWindow())
return false;
return true;
}
CGUIWindow *CGUIInfoManager::GetWindowWithCondition(int contextWindow, int condition) const
{
CGUIWindow *window = g_windowManager.GetWindow(contextWindow);
if (CheckWindowCondition(window, condition))
return window;
// try topmost dialog
window = g_windowManager.GetWindow(g_windowManager.GetTopMostModalDialogID());
if (CheckWindowCondition(window, condition))
return window;
// try active window
window = g_windowManager.GetWindow(g_windowManager.GetActiveWindow());
if (CheckWindowCondition(window, condition))
return window;
return NULL;
}
void CGUIInfoManager::SetCurrentVideoTag(const CVideoInfoTag &tag)
{
*m_currentFile->GetVideoInfoTag() = tag;
m_currentFile->m_lStartOffset = 0;
}
void CGUIInfoManager::SetCurrentSongTag(const MUSIC_INFO::CMusicInfoTag &tag)
{
//CLog::Log(LOGDEBUG, "Asked to SetCurrentTag");
*m_currentFile->GetMusicInfoTag() = tag;
m_currentFile->m_lStartOffset = 0;
}
const CFileItem& CGUIInfoManager::GetCurrentSlide() const
{
return *m_currentSlide;
}
const MUSIC_INFO::CMusicInfoTag* CGUIInfoManager::GetCurrentSongTag() const
{
if (m_currentFile->HasMusicInfoTag())
return m_currentFile->GetMusicInfoTag();
return NULL;
}
const CVideoInfoTag* CGUIInfoManager::GetCurrentMovieTag() const
{
if (m_currentFile->HasVideoInfoTag())
return m_currentFile->GetVideoInfoTag();
return NULL;
}
void GUIInfo::SetInfoFlag(uint32_t flag)
{
assert(flag >= (1 << 24));
m_data1 |= flag;
}
uint32_t GUIInfo::GetInfoFlag() const
{
// we strip out the bottom 24 bits, where we keep data
// and return the flag only
return m_data1 & 0xff000000;
}
uint32_t GUIInfo::GetData1() const
{
// we strip out the top 8 bits, where we keep flags
// and return the unflagged data
return m_data1 & ((1 << 24) -1);
}
int GUIInfo::GetData2() const
{
return m_data2;
}
void CGUIInfoManager::SetLibraryBool(int condition, bool value)
{
switch (condition)
{
case LIBRARY_HAS_MUSIC:
m_libraryHasMusic = value ? 1 : 0;
break;
case LIBRARY_HAS_MOVIES:
m_libraryHasMovies = value ? 1 : 0;
break;
case LIBRARY_HAS_TVSHOWS:
m_libraryHasTVShows = value ? 1 : 0;
break;
case LIBRARY_HAS_MUSICVIDEOS:
m_libraryHasMusicVideos = value ? 1 : 0;
break;
default:
break;
}
}
void CGUIInfoManager::ResetLibraryBools()
{
m_libraryHasMusic = -1;
m_libraryHasMovies = -1;
m_libraryHasTVShows = -1;
m_libraryHasMusicVideos = -1;
}
bool CGUIInfoManager::GetLibraryBool(int condition)
{
if (condition == LIBRARY_HAS_MUSIC)
{
if (m_libraryHasMusic < 0)
{ // query
CMusicDatabase db;
if (db.Open())
{
m_libraryHasMusic = (db.GetSongsCount() > 0) ? 1 : 0;
db.Close();
}
}
return m_libraryHasMusic > 0;
}
else if (condition == LIBRARY_HAS_MOVIES)
{
if (m_libraryHasMovies < 0)
{
CVideoDatabase db;
if (db.Open())
{
m_libraryHasMovies = db.HasContent(VIDEODB_CONTENT_MOVIES) ? 1 : 0;
db.Close();
}
}
return m_libraryHasMovies > 0;
}
else if (condition == LIBRARY_HAS_TVSHOWS)
{
if (m_libraryHasTVShows < 0)
{
CVideoDatabase db;
if (db.Open())
{
m_libraryHasTVShows = db.HasContent(VIDEODB_CONTENT_TVSHOWS) ? 1 : 0;
db.Close();
}
}
return m_libraryHasTVShows > 0;
}
else if (condition == LIBRARY_HAS_MUSICVIDEOS)
{
if (m_libraryHasMusicVideos < 0)
{
CVideoDatabase db;
if (db.Open())
{
m_libraryHasMusicVideos = db.HasContent(VIDEODB_CONTENT_MUSICVIDEOS) ? 1 : 0;
db.Close();
}
}
return m_libraryHasMusicVideos > 0;
}
else if (condition == LIBRARY_HAS_VIDEO)
{
return (GetLibraryBool(LIBRARY_HAS_MOVIES) ||
GetLibraryBool(LIBRARY_HAS_TVSHOWS) ||
GetLibraryBool(LIBRARY_HAS_MUSICVIDEOS));
}
return false;
}

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks