summaryrefslogtreecommitdiffstats
path: root/kplayer/kplayerproperties.h
blob: c09e3b2cfe778eee777e57bcee26a89fa21af507 (plain)
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
/***************************************************************************
                          kplayerproperties.h
                          -------------------
    begin                : Tue Feb 10 2004
    copyright            : (C) 2004-2007 by kiriuja
    email                : http://kplayer.sourceforge.net/email.html
 ***************************************************************************/

/***************************************************************************
 *   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 3 of the License, or     *
 *   (at your option) any later version.                                   *
 ***************************************************************************/

#ifndef KPLAYERPROPERTIES_H
#define KPLAYERPROPERTIES_H

#include <float.h>
#include <kurl.h>
#include <limits.h>
#include <math.h>
#include <tqobject.h>

#ifdef DEBUG
#include <kdebug.h>
#endif

#include "kplayerengine.h"

class KPlayerProperty;
class KPlayerPropertyInfo;
class KPlayerProperties;
class KPlayerMedia;
class KPlayerConfiguration;
class KPlayerGenericProperties;
class KPlayerDeviceProperties;
class KPlayerDiskProperties;
class KPlayerTVProperties;
class KPlayerDVBProperties;
class KPlayerTrackProperties;
class KPlayerChannelProperties;
class KPlayerTVChannelProperties;
class KPlayerDVBChannelProperties;
class KPlayerItemProperties;

#define KPLAYER_PROPERTY_GROUP_BASIC    0
#define KPLAYER_PROPERTY_GROUP_GENERAL  1
#define KPLAYER_PROPERTY_GROUP_FORMAT   2
#define KPLAYER_PROPERTY_GROUP_SIZE     3
#define KPLAYER_PROPERTY_GROUP_VIDEO    4
#define KPLAYER_PROPERTY_GROUP_AUDIO    5
#define KPLAYER_PROPERTY_GROUP_INFO     6
#define KPLAYER_PROPERTY_GROUP_LOCATION 7

/** Compares the given strings. */
extern int compareStrings (const TQString& s1, const TQString& s2);

/** Returns the given time length as string. */
extern TQString timeString (float length, bool zero_ok = false);

/** Converts a string to a floating point number, replacing a comma with a decimal point. */
extern float stringToFloat (const TQString&);

inline int limit (int value, int minValue, int maxValue = INT_MAX)
{
  return value < minValue ? minValue : value > maxValue ? maxValue : value;
}

inline void limit4 (int& lowerValue, int& higherValue, int minValue, int maxValue)
{
  if ( lowerValue > higherValue )
  {
    int i = lowerValue;
    lowerValue = higherValue;
    higherValue = i;
  }
  lowerValue = limit (lowerValue, minValue, maxValue);
  higherValue = limit (higherValue, minValue, maxValue);
}

inline float flimit (float value, float minValue, float maxValue = FLT_MAX)
{
  return value < minValue ? minValue : value > maxValue ? maxValue : value;
}

/** The KPlayer media map by URL string.
  * @author kiriuja
  */
typedef TQMap<TQString, KPlayerMedia*> KPlayerMediaMap;

/** The KPlayer property map by name.
  * @author kiriuja
  */
typedef TQMap<TQString, KPlayerProperty*> KPlayerPropertyMap;

/** The KPlayer property info map by name.
  * @author kiriuja
  */
typedef TQMap<TQString, KPlayerPropertyInfo*> KPlayerPropertyInfoMap;

/** The KPlayer media property.
  * @author kiriuja
  */
class KPlayerProperty
{
public:
  /** Default constructor. */
  KPlayerProperty (void) { }
  /** Destructor. */
  virtual ~KPlayerProperty();

  /** Returns the value as a string. */
  virtual TQString asString (void) const;
  /** Sets the value from the given string. */
  virtual void fromString (const TQString& value);
  /** Compares the value with that of another property of the same type. */
  virtual int compare (KPlayerProperty*) const;

  /** Reads the value from the given config under the given name. */
  virtual void read (TDEConfig* config, const TQString& name);
  /** Saves the value to the given config under the given name. */
  virtual void save (TDEConfig* config, const TQString& name) const;

  /** Resets the value to the default and returns true if the property can be deleted. */
  virtual bool defaults (bool can_reset);
};

/** The boolean property.
  * @author kiriuja
  */
class KPlayerBooleanProperty : public KPlayerProperty
{
public:
  /** Constructor. Initializes the property. */
  KPlayerBooleanProperty (void) { }
  /** Destructor. */
  virtual ~KPlayerBooleanProperty();

  /** Returns the property value. */
  bool value (void) const
    { return m_value; }
  /** Sets the property value. */
  void setValue (bool value)
    { m_value = value; }

  /** Returns the value as a string. */
  virtual TQString asString (void) const;
  /** Compares the value with that of another property of the same type. */
  virtual int compare (KPlayerProperty*) const;

  /** Reads the value from the given config under the given name. */
  virtual void read (TDEConfig*, const TQString&);
  /** Saves the value to the given config under the given name. */
  virtual void save (TDEConfig*, const TQString&) const;

protected:
  /** Property value. */
  bool m_value;
};

/** The integer property.
  * @author kiriuja
  */
class KPlayerIntegerProperty : public KPlayerProperty
{
public:
  /** Constructor. Initializes the property. */
  KPlayerIntegerProperty (void) { }
  /** Destructor. */
  virtual ~KPlayerIntegerProperty();

  /** Returns the property value. */
  int value (void) const
    { return m_value; }
  /** Sets the property value. */
  void setValue (int value)
    { m_value = value; }

  /** Returns the value as a string. */
  virtual TQString asString (void) const;
  /** Sets the value from the given string. */
  virtual void fromString (const TQString& value);
  /** Compares the value with that of another property of the same type. */
  virtual int compare (KPlayerProperty*) const;

  /** Reads the value from the given config under the given name. */
  virtual void read (TDEConfig*, const TQString&);
  /** Saves the value to the given config under the given name. */
  virtual void save (TDEConfig*, const TQString&) const;

protected:
  /** Property value. */
  int m_value;
};

/** The relative integer property.
  * @author kiriuja
  */
class KPlayerRelativeProperty : public KPlayerIntegerProperty
{
public:
  /** Constructor. Initializes the property. */
  KPlayerRelativeProperty (void) { }
  /** Destructor. */
  virtual ~KPlayerRelativeProperty();

  /** Returns the property value. */
  int value (void) const
    { return m_value; }
  /** Sets the property value. */
  void setValue (int value)
    { m_value = value; }

  /** Returns the property value based on the option and the given value. */
  int value (int current) const;
  /** Sets the property value and option. */
  void setValue (int value, int current);

  /** Returns the property option. */
  int option (void) const
    { return m_option; }
  /** Sets the property option. */
  void setOption (int option)
    { m_option = option; }

  /** Returns the value as a string. */
  virtual TQString asString (void) const;
  /** Compares the value with that of another property of the same type. */
  virtual int compare (KPlayerProperty*) const;

  /** Reads the value from the given config under the given name. */
  virtual void read (TDEConfig*, const TQString&);
  /** Saves the value to the given config under the given name. */
  virtual void save (TDEConfig*, const TQString&) const;

protected:
  /** Property option. */
  int m_option;
};

/** The cache property.
  * @author kiriuja
  */
class KPlayerCacheProperty : public KPlayerIntegerProperty
{
public:
  /** Constructor. Initializes the property. */
  KPlayerCacheProperty (void) { }
  /** Destructor. */
  virtual ~KPlayerCacheProperty();

  /** Returns the value as a string. */
  virtual TQString asString (void) const;
  /** Compares the value with that of another property of the same type. */
  virtual int compare (KPlayerProperty*) const;

  /** Reads the value from the given config under the given name. */
  virtual void read (TDEConfig*, const TQString&);
};

/** The frequency property.
  * @author kiriuja
  */
class KPlayerFrequencyProperty : public KPlayerIntegerProperty
{
public:
  /** Constructor. Initializes the property. */
  KPlayerFrequencyProperty (KPlayerProperties* properties)
  {
    m_properties = (KPlayerChannelProperties*) properties;
    m_value = 0;
  }
  /** Destructor. */
  virtual ~KPlayerFrequencyProperty();

  /** Returns the property value. */
  int value (void) const;
  /** Sets the property value. */
  void setValue (int value);

  /** Returns the value as a string. */
  virtual TQString asString (void) const;
  /** Compares the value with that of another property of the same type. */
  virtual int compare (KPlayerProperty*) const;

  /** Saves the value to the given config under the given name. */
  virtual void save (TDEConfig*, const TQString&) const;

  /** Resets the value to the default and returns true if the property can be deleted. */
  virtual bool defaults (bool can_reset);

protected:
  /** Properties where this property is from. */
  KPlayerChannelProperties* m_properties;
};

/** The float property.
  * @author kiriuja
  */
class KPlayerFloatProperty : public KPlayerProperty
{
public:
  /** Constructor. Initializes the property. */
  KPlayerFloatProperty (void) { }
  /** Destructor. */
  virtual ~KPlayerFloatProperty();

  /** Returns the property value. */
  float value (void) const
    { return m_value; }
  /** Sets the property value. */
  void setValue (float value)
    { m_value = fabs (value) < 0.0001 ? 0 : value; }

  /** Returns the value as a string. */
  virtual TQString asString (void) const;
  /** Compares the value with that of another property of the same type. */
  virtual int compare (KPlayerProperty*) const;

  /** Reads the value from the given config under the given name. */
  virtual void read (TDEConfig*, const TQString&);
  /** Saves the value to the given config under the given name. */
  virtual void save (TDEConfig*, const TQString&) const;

protected:
  /** Property value. */
  float m_value;
};

/** The length property.
  * @author kiriuja
  */
class KPlayerLengthProperty : public KPlayerFloatProperty
{
public:
  /** Constructor. Initializes the property. */
  KPlayerLengthProperty (void) { }
  /** Destructor. */
  virtual ~KPlayerLengthProperty();

  /** Returns the value as a string. */
  virtual TQString asString (void) const;
};

/** The size property.
  * @author kiriuja
  */
class KPlayerSizeProperty : public KPlayerProperty
{
public:
  /** Constructor. Initializes the property. */
  KPlayerSizeProperty (void) { }
  /** Destructor. */
  virtual ~KPlayerSizeProperty();

  /** Returns the property value. */
  const TQSize& value (void) const
    { return m_value; }
  /** Sets the property value. */
  void setValue (const TQSize& value)
    { m_value = value; }

  /** Returns the value as a string. */
  virtual TQString asString (void) const;
  /** Compares the value with that of another property of the same type. */
  virtual int compare (KPlayerProperty*) const;

  /** Reads the value from the given config under the given name. */
  virtual void read (TDEConfig*, const TQString&);
  /** Saves the value to the given config under the given name. */
  virtual void save (TDEConfig*, const TQString&) const;

protected:
  /** Property value. */
  TQSize m_value;
};

/** The display size property.
  * @author kiriuja
  */
class KPlayerDisplaySizeProperty : public KPlayerSizeProperty
{
public:
  /** Constructor. Initializes the property. */
  KPlayerDisplaySizeProperty (void) { }
  /** Destructor. */
  virtual ~KPlayerDisplaySizeProperty();

  /** Returns the property value. */
  const TQSize& value (void) const
    { return m_value; }
  /** Sets the property value. */
  void setValue (const TQSize& value)
    { m_value = value; }

  /** Returns the property value based on the option and the given value. */
  TQSize value (const TQSize& current) const;
  /** Sets the property value and option. */
  void setValue (const TQSize& value, int option);

  /** Returns the property option. */
  int option (void) const
    { return m_option; }
  /** Sets the property option. */
  void setOption (int option)
    { m_option = option; }

  /** Returns the value as a string. */
  virtual TQString asString (void) const;
  /** Compares the value with that of another property of the same type. */
  virtual int compare (KPlayerProperty*) const;

  /** Reads the value from the given config under the given name. */
  virtual void read (TDEConfig*, const TQString&);
  /** Saves the value to the given config under the given name. */
  virtual void save (TDEConfig*, const TQString&) const;

protected:
  /** Property option. */
  int m_option;
};

/** The string property.
  * @author kiriuja
  */
class KPlayerStringProperty : public KPlayerProperty
{
public:
  /** Constructor. Initializes the property. */
  KPlayerStringProperty (void) { }
  /** Destructor. */
  virtual ~KPlayerStringProperty();

  /** Returns the property value. */
  const TQString& value (void) const
    { return m_value; }
  /** Sets the property value. */
  void setValue (const TQString& value)
    { m_value = value; }

  /** Returns the value as a string. */
  virtual TQString asString (void) const;
  /** Sets the value from the given string. */
  virtual void fromString (const TQString& value);
  /** Compares the value with that of another property of the same type. */
  virtual int compare (KPlayerProperty*) const;

  /** Reads the value from the given config under the given name. */
  virtual void read (TDEConfig*, const TQString&);
  /** Saves the value to the given config under the given name. */
  virtual void save (TDEConfig*, const TQString&) const;

protected:
  /** Property value. */
  TQString m_value;
};

/** The combo string property.
  * @author kiriuja
  */
class KPlayerComboStringProperty : public KPlayerStringProperty
{
public:
  /** Constructor. Initializes the property. */
  KPlayerComboStringProperty (void) { }
  /** Destructor. */
  virtual ~KPlayerComboStringProperty();

  /** Returns the property option. */
  const TQString& option (void) const
    { return m_option; }
  /** Sets the property option. */
  void setOption (const TQString& option)
    { m_option = option; }

  /** Returns the value as a string. */
  virtual TQString asString (void) const;

  /** Reads the value from the given config under the given name. */
  virtual void read (TDEConfig*, const TQString&);
  /** Saves the value to the given config under the given name. */
  virtual void save (TDEConfig*, const TQString&) const;

  /** Resets the value to the default and returns true if the property can be deleted. */
  virtual bool defaults (bool can_reset);

protected:
  /** Property option. */
  TQString m_option;
};

/** The translated string property.
  * @author kiriuja
  */
class KPlayerTranslatedStringProperty : public KPlayerStringProperty
{
public:
  /** Constructor. Initializes the property. */
  KPlayerTranslatedStringProperty (void) { }
  /** Destructor. */
  virtual ~KPlayerTranslatedStringProperty();

  /** Returns the value as a string. */
  virtual TQString asString (void) const;
};

#if 0
/** The string history property.
  * @author kiriuja
  */
class KPlayerStringHistoryProperty : public KPlayerStringProperty
{
public:
  /** Constructor. Initializes the property. */
  KPlayerStringHistoryProperty (void) { }
  /** Destructor. */
  virtual ~KPlayerStringHistoryProperty();

  /** Sets the property value. */
  virtual void setValue (const TQString& value);

  /** Returns the string history. */
  const TQStringList& history (void) const
    { return m_history; }

  /** Reads the value from the given config under the given name. */
  virtual void read (TDEConfig*, const TQString&);
  /** Saves the value to the given config under the given name. */
  virtual void save (TDEConfig*, const TQString&) const;

protected:
  /** String history. */
  TQStringList m_history;
};
#endif

/** The name property.
  * @author kiriuja
  */
class KPlayerNameProperty : public KPlayerStringProperty
{
public:
  /** Constructor. Initializes the property. */
  KPlayerNameProperty (KPlayerProperties* properties)
    { m_properties = (KPlayerGenericProperties*) properties; }
  /** Destructor. */
  virtual ~KPlayerNameProperty();

  /** Returns the value as a string. */
  virtual TQString asString (void) const;

  /** Saves the value to the given config under the given name. */
  virtual void save (TDEConfig* config, const TQString& name) const;

  /** Resets the value to the default and returns true if the property can be deleted. */
  virtual bool defaults (bool can_reset);

protected:
  /** Properties where this property is from. */
  KPlayerGenericProperties* m_properties;
};

/** The appendable string property.
  * @author kiriuja
  */
class KPlayerAppendableProperty : public KPlayerStringProperty
{
public:
  /** Constructor. Initializes the property. */
  KPlayerAppendableProperty (void) { }
  /** Destructor. */
  virtual ~KPlayerAppendableProperty();

  /** Returns the property value based on the option and the given value. */
  TQString appendableValue (const TQString& current) const;
  /** Sets the property value and option. */
  void setAppendableValue (const TQString& value, bool append);

  /** Returns the property option. */
  bool option (void) const
    { return m_option; }
  /** Sets the property option. */
  void setOption (bool option)
    { m_option = option; }

  /** Reads the value from the given config under the given name. */
  virtual void read (TDEConfig*, const TQString&);
  /** Saves the value to the given config under the given name. */
  virtual void save (TDEConfig*, const TQString&) const;

protected:
  /** Property option. */
  bool m_option;
};

/** The string list property.
  * @author kiriuja
  */
class KPlayerStringListProperty : public KPlayerProperty
{
public:
  /** Constructor. Initializes the property. */
  KPlayerStringListProperty (void) { }
  /** Destructor. */
  virtual ~KPlayerStringListProperty();

  /** Returns the property value. */
  const TQStringList& value (void) const
    { return m_value; }
  /** Adds the given entry to the property value. */
  void addEntry (const TQString& entry)
    { m_value.append (entry); }
  /** Sets the property value. */
  void setValue (const TQStringList& value)
    { m_value = value; }

  /** Reads the value from the given config under the given name. */
  virtual void read (TDEConfig* config, const TQString& name);
  /** Saves the value to the given config under the given name. */
  virtual void save (TDEConfig* config, const TQString& name) const;

  /** Resets the value to the default and returns true if the property can be deleted. */
  virtual bool defaults (bool can_reset);

protected:
  /** Property value. */
  TQStringList m_value;
};

/** The integer string map property.
  * @author kiriuja
  */
class KPlayerIntegerStringMapProperty : public KPlayerProperty
{
public:
  /** Constructor. Initializes the property. */
  KPlayerIntegerStringMapProperty (void) { }
  /** Destructor. */
  virtual ~KPlayerIntegerStringMapProperty();

  /** Returns the property value. */
  const TQMap<int, TQString>& value (void) const
    { return m_value; }
  /** Sets the property value. */
  void setValue (int key, const TQString& value)
    { m_value.insert (key, value); }

  /** Reads the value from the given config under the given name. */
  virtual void read (TDEConfig* config, const TQString& name);
  /** Saves the value to the given config under the given name. */
  virtual void save (TDEConfig* config, const TQString& name) const;

protected:
  /** Property value. */
  TQMap<int, TQString> m_value;
};

/** The URL property.
  * @author kiriuja
  */
class KPlayerUrlProperty : public KPlayerProperty
{
public:
  /** Constructor. Initializes the property. */
  KPlayerUrlProperty (void) { }
  /** Destructor. */
  virtual ~KPlayerUrlProperty();

  /** Returns the property value. */
  const KURL& value (void) const
    { return m_value; }
  /** Sets the property value. */
  void setValue (const KURL& value)
    { m_value = value; }

  /** Returns the value as a string. */
  virtual TQString asString (void) const;
  /** Compares the value with that of another property of the same type. */
  virtual int compare (KPlayerProperty*) const;

protected:
  /** Property value. */
  KURL m_value;
};

/** The persistent URL property.
  * @author kiriuja
  */
class KPlayerPersistentUrlProperty : public KPlayerUrlProperty
{
public:
  /** Constructor. Initializes the property. */
  KPlayerPersistentUrlProperty (void) { }
  /** Destructor. */
  virtual ~KPlayerPersistentUrlProperty();

  /** Reads the value from the given config under the given name. */
  virtual void read (TDEConfig*, const TQString&);
  /** Saves the value to the given config under the given name. */
  virtual void save (TDEConfig*, const TQString&) const;

  /** Resets the value to the default and returns true if the property can be deleted. */
  virtual bool defaults (bool can_reset);
};

/** The KPlayer media property information.
  * @author kiriuja
  */
class KPlayerPropertyInfo
{
public:
  /** Default constructor. */
  KPlayerPropertyInfo (void);
  /** Destructor. */
  virtual ~KPlayerPropertyInfo();

  /** Returns the property caption. */
  const TQString& caption (void) const
    { return m_caption; }
  /** Sets the property caption. */
  void setCaption (const TQString& caption)
    { m_caption = caption; }

  /** Returns the property group. */
  int group (void) const
    { return m_group; }
  /** Sets the property group. */
  void setGroup (int group)
    { m_group = group; m_show = showByDefault(); }

  /** Returns whether the property can be shown. */
  bool canShow (void) const
    { return group() >= 0; }
  /** Returns whether the property should be shown by default. */
  bool showByDefault (void) const
    { return group() == 0 || group() == 1 || group() == 5; }

  /** Returns whether the property should be shown. */
  bool show (void) const
    { return m_show; }
  /** Sets whether the property should be shown. */
  void setShow (bool show)
    { m_show = show; }

  /** Returns whether the property can be edited. */
  bool canEdit (void) const
    { return m_can_edit; }
  /** Sets whether the property can be edited. */
  void setCanEdit (bool can_edit)
    { m_can_edit = can_edit; }

  /** Returns whether the property can be reset. */
  bool canReset (void) const
    { return m_can_reset; }
  /** Sets whether the property can be reset. */
  void setCanReset (bool can_reset)
    { m_can_reset = can_reset; }

  /** Returns the override flag. */
  bool override (void) const
    { return m_override; }
  /** Sets the override flag. */
  void setOverride (bool override)
    { m_override = override; }

  /** Creates and returns a property of the corresponding type. */
  virtual KPlayerProperty* create (KPlayerProperties*) const = 0;
  /** Makes a copy of the given property. */
  virtual KPlayerProperty* copy (const KPlayerProperty*) const = 0;

  /** Returns whether the property exists for the current URL. */
  virtual bool exists (KPlayerProperties* properties, const TQString& name) const;

protected:
  /** Caption. */
  TQString m_caption;
  /** Property group. */
  int m_group;
  /** Flag indicating whether the property should be shown. */
  bool m_show;
  /** Flag indicating whether the property can be edited. */
  bool m_can_edit;
  /** Flag indicating whether the property can be reset. */
  bool m_can_reset;
  /** Flag indicating whether an override is in effect. */
  bool m_override;
};

/** The KPlayer boolean property information.
  * @author kiriuja
  */
class KPlayerBooleanPropertyInfo : public KPlayerPropertyInfo
{
public:
  /** Constructor. Sets up the property information. */
  KPlayerBooleanPropertyInfo (void);
  /** Destructor. */
  virtual ~KPlayerBooleanPropertyInfo();

  /** Returns the default property value. */
  bool defaultValue (void) const
    { return m_default; }
  /** Sets the default property value. */
  void setDefaultValue (bool value)
    { m_default = value; }

  /** Creates and returns a property of the corresponding type. */
  virtual KPlayerProperty* create (KPlayerProperties*) const;
  /** Makes a copy of the given property. */
  virtual KPlayerProperty* copy (const KPlayerProperty*) const;

protected:
  /** Default value. */
  bool m_default;
};

/** The KPlayer integer property information.
  * @author kiriuja
  */
class KPlayerIntegerPropertyInfo : public KPlayerPropertyInfo
{
public:
  /** Constructor. Sets up the property information. */
  KPlayerIntegerPropertyInfo (void);
  /** Destructor. */
  virtual ~KPlayerIntegerPropertyInfo();

  /** Returns the default property value. */
  int defaultValue (void) const
    { return m_default; }
  /** Sets the default property value. */
  void setDefaultValue (int value)
    { m_default = value; }

  /** Creates and returns a property of the corresponding type. */
  virtual KPlayerProperty* create (KPlayerProperties*) const;
  /** Makes a copy of the given property. */
  virtual KPlayerProperty* copy (const KPlayerProperty*) const;

protected:
  /** Default value. */
  int m_default;
};

/** The KPlayer relative property information.
  * @author kiriuja
  */
class KPlayerRelativePropertyInfo : public KPlayerIntegerPropertyInfo
{
public:
  /** Constructor. Sets up the property information. */
  KPlayerRelativePropertyInfo (void) { }
  /** Destructor. */
  virtual ~KPlayerRelativePropertyInfo();

  /** Creates and returns a property of the corresponding type. */
  virtual KPlayerProperty* create (KPlayerProperties*) const;
  /** Makes a copy of the given property. */
  virtual KPlayerProperty* copy (const KPlayerProperty*) const;
};

/** The KPlayer cache property information.
  * @author kiriuja
  */
class KPlayerCachePropertyInfo : public KPlayerIntegerPropertyInfo
{
public:
  /** Constructor. Sets up the property information. */
  KPlayerCachePropertyInfo (void) { }
  /** Destructor. */
  virtual ~KPlayerCachePropertyInfo();

  /** Creates and returns a property of the corresponding type. */
  virtual KPlayerProperty* create (KPlayerProperties*) const;
  /** Makes a copy of the given property. */
  virtual KPlayerProperty* copy (const KPlayerProperty*) const;
};

/** The KPlayer frequency property information.
  * @author kiriuja
  */
class KPlayerFrequencyPropertyInfo : public KPlayerIntegerPropertyInfo
{
public:
  /** Constructor. Sets up the property information. */
  KPlayerFrequencyPropertyInfo (void) { }
  /** Destructor. */
  virtual ~KPlayerFrequencyPropertyInfo();

  /** Creates and returns a property of the corresponding type. */
  virtual KPlayerProperty* create (KPlayerProperties*) const;
  /** Makes a copy of the given property. */
  virtual KPlayerProperty* copy (const KPlayerProperty*) const;

  /** Returns whether the property exists for the current URL. */
  virtual bool exists (KPlayerProperties* properties, const TQString& name) const;
};

/** The KPlayer float property information.
  * @author kiriuja
  */
class KPlayerFloatPropertyInfo : public KPlayerPropertyInfo
{
public:
  /** Constructor. Sets up the property information. */
  KPlayerFloatPropertyInfo (void);
  /** Destructor. */
  virtual ~KPlayerFloatPropertyInfo();

  /** Returns the default property value. */
  float defaultValue (void) const
    { return m_default; }
  /** Sets the default property value. */
  void setDefaultValue (float value)
    { m_default = value; }

  /** Creates and returns a property of the corresponding type. */
  virtual KPlayerProperty* create (KPlayerProperties*) const;
  /** Makes a copy of the given property. */
  virtual KPlayerProperty* copy (const KPlayerProperty*) const;

protected:
  /** Default value. */
  float m_default;
};

/** The KPlayer length property information.
  * @author kiriuja
  */
class KPlayerLengthPropertyInfo : public KPlayerFloatPropertyInfo
{
public:
  /** Constructor. Sets up the property information. */
  KPlayerLengthPropertyInfo (void) { }
  /** Destructor. */
  virtual ~KPlayerLengthPropertyInfo();

  /** Creates and returns a property of the corresponding type. */
  virtual KPlayerProperty* create (KPlayerProperties*) const;
  /** Makes a copy of the given property. */
  virtual KPlayerProperty* copy (const KPlayerProperty*) const;
};

/** The KPlayer size property information.
  * @author kiriuja
  */
class KPlayerSizePropertyInfo : public KPlayerPropertyInfo
{
public:
  /** Constructor. Sets up the property information. */
  KPlayerSizePropertyInfo (void) { }
  /** Destructor. */
  virtual ~KPlayerSizePropertyInfo();

  /** Creates and returns a property of the corresponding type. */
  virtual KPlayerProperty* create (KPlayerProperties*) const;
  /** Makes a copy of the given property. */
  virtual KPlayerProperty* copy (const KPlayerProperty*) const;
};

/** The KPlayer optional size property information.
  * @author kiriuja
  */
class KPlayerDisplaySizePropertyInfo : public KPlayerSizePropertyInfo
{
public:
  /** Constructor. Sets up the property information. */
  KPlayerDisplaySizePropertyInfo (void) { }
  /** Destructor. */
  virtual ~KPlayerDisplaySizePropertyInfo();

  /** Creates and returns a property of the corresponding type. */
  virtual KPlayerProperty* create (KPlayerProperties*) const;
  /** Makes a copy of the given property. */
  virtual KPlayerProperty* copy (const KPlayerProperty*) const;
};

/** The KPlayer string property information.
  * @author kiriuja
  */
class KPlayerStringPropertyInfo : public KPlayerPropertyInfo
{
public:
  /** Constructor. Sets up the property information. */
  KPlayerStringPropertyInfo (void) { }
  /** Destructor. */
  virtual ~KPlayerStringPropertyInfo();

  /** Returns the default property value. */
  const TQString& defaultValue (void) const
    { return m_default; }
  /** Sets the default property value. */
  void setDefaultValue (const TQString& value)
    { m_default = value; }

  /** Creates and returns a property of the corresponding type. */
  virtual KPlayerProperty* create (KPlayerProperties*) const;
  /** Makes a copy of the given property. */
  virtual KPlayerProperty* copy (const KPlayerProperty*) const;

protected:
  /** Default value. */
  TQString m_default;
};

/** The KPlayer combo string property information.
  * @author kiriuja
  */
class KPlayerComboStringPropertyInfo : public KPlayerStringPropertyInfo
{
public:
  /** Constructor. Sets up the property information. */
  KPlayerComboStringPropertyInfo (void) { }
  /** Destructor. */
  virtual ~KPlayerComboStringPropertyInfo();

  /** Creates and returns a property of the corresponding type. */
  virtual KPlayerProperty* create (KPlayerProperties*) const;
  /** Makes a copy of the given property. */
  virtual KPlayerProperty* copy (const KPlayerProperty*) const;

  /** Returns whether the property exists for the current URL. */
  virtual bool exists (KPlayerProperties* properties, const TQString& name) const;
};

/** The KPlayer translated string property information.
  * @author kiriuja
  */
class KPlayerTranslatedStringPropertyInfo : public KPlayerStringPropertyInfo
{
public:
  /** Constructor. Sets up the property information. */
  KPlayerTranslatedStringPropertyInfo (void) { }
  /** Destructor. */
  virtual ~KPlayerTranslatedStringPropertyInfo();

  /** Creates and returns a property of the corresponding type. */
  virtual KPlayerProperty* create (KPlayerProperties*) const;
  /** Makes a copy of the given property. */
  virtual KPlayerProperty* copy (const KPlayerProperty*) const;
};

#if 0
/** The KPlayer string history property information.
  * @author kiriuja
  */
class KPlayerStringHistoryPropertyInfo : public KPlayerStringPropertyInfo
{
public:
  /** Constructor. Sets up the property information. */
  KPlayerStringHistoryPropertyInfo (void) { }
  /** Destructor. */
  virtual ~KPlayerStringHistoryPropertyInfo();

  /** Creates and returns a property of the corresponding type. */
  virtual KPlayerProperty* create (KPlayerProperties*) const;
  /** Makes a copy of the given property. */
  virtual KPlayerProperty* copy (const KPlayerProperty*) const;

  /** Returns whether the property exists for the current URL. */
  virtual bool exists (KPlayerProperties* properties, const TQString& name) const;
};
#endif

/** The KPlayer name property information.
  * @author kiriuja
  */
class KPlayerNamePropertyInfo : public KPlayerStringPropertyInfo
{
public:
  /** Constructor. Sets up the property information. */
  KPlayerNamePropertyInfo (void) { }
  /** Destructor. */
  virtual ~KPlayerNamePropertyInfo();

  /** Creates and returns a property of the corresponding type. */
  virtual KPlayerProperty* create (KPlayerProperties*) const;
  /** Makes a copy of the given property. */
  virtual KPlayerProperty* copy (const KPlayerProperty*) const;

  /** Returns whether the property exists for the current URL. */
  virtual bool exists (KPlayerProperties* properties, const TQString& name) const;
};

/** The KPlayer appendable property information.
  * @author kiriuja
  */
class KPlayerAppendablePropertyInfo : public KPlayerStringPropertyInfo
{
public:
  /** Constructor. Sets up the property information. */
  KPlayerAppendablePropertyInfo (void) { }
  /** Destructor. */
  virtual ~KPlayerAppendablePropertyInfo();

  /** Creates and returns a property of the corresponding type. */
  virtual KPlayerProperty* create (KPlayerProperties*) const;
  /** Makes a copy of the given property. */
  virtual KPlayerProperty* copy (const KPlayerProperty*) const;

  /** Returns whether the property exists for the current URL. */
  virtual bool exists (KPlayerProperties* properties, const TQString& name) const;
};

/** The KPlayer string list property information.
  * @author kiriuja
  */
class KPlayerStringListPropertyInfo : public KPlayerPropertyInfo
{
public:
  /** Constructor. Sets up the property information. */
  KPlayerStringListPropertyInfo (void) { }
  /** Destructor. */
  virtual ~KPlayerStringListPropertyInfo();

  /** Creates and returns a property of the corresponding type. */
  virtual KPlayerProperty* create (KPlayerProperties*) const;
  /** Makes a copy of the given property. */
  virtual KPlayerProperty* copy (const KPlayerProperty*) const;
};

/** The KPlayer integer string map property information.
  * @author kiriuja
  */
class KPlayerIntegerStringMapPropertyInfo : public KPlayerPropertyInfo
{
public:
  /** Constructor. Sets up the property information. */
  KPlayerIntegerStringMapPropertyInfo (bool multi)
    { m_multi = multi; }
  /** Destructor. */
  virtual ~KPlayerIntegerStringMapPropertyInfo();

  /** Creates and returns a property of the corresponding type. */
  virtual KPlayerProperty* create (KPlayerProperties*) const;
  /** Makes a copy of the given property. */
  virtual KPlayerProperty* copy (const KPlayerProperty*) const;

  /** Returns whether multiple entries are required. */
  bool multipleEntriesRequired (void) const
    { return m_multi; }

protected:
  /** Indicates whether multiple entries are required. */
  bool m_multi;
};

/** The KPlayer URL property information.
  * @author kiriuja
  */
class KPlayerUrlPropertyInfo : public KPlayerPropertyInfo
{
public:
  /** Constructor. Sets up the property information. */
  KPlayerUrlPropertyInfo (void) { }
  /** Destructor. */
  virtual ~KPlayerUrlPropertyInfo();

  /** Creates and returns a property of the corresponding type. */
  virtual KPlayerProperty* create (KPlayerProperties*) const;
  /** Makes a copy of the given property. */
  virtual KPlayerProperty* copy (const KPlayerProperty*) const;
};

/** The KPlayer persistent URL property information.
  * @author kiriuja
  */
class KPlayerPersistentUrlPropertyInfo : public KPlayerUrlPropertyInfo
{
public:
  /** Constructor. Sets up the property information. */
  KPlayerPersistentUrlPropertyInfo (void) { }
  /** Destructor. */
  virtual ~KPlayerPersistentUrlPropertyInfo();

  /** Creates and returns a property of the corresponding type. */
  virtual KPlayerProperty* create (KPlayerProperties*) const;
  /** Makes a copy of the given property. */
  virtual KPlayerProperty* copy (const KPlayerProperty*) const;
};

/** The KPlayer property counts by name.
  * @author kiriuja
  */
class KPlayerPropertyCounts : public TQMap<TQString, int>
{
public:
  /** Default constructor. Creates an empty map. */
  KPlayerPropertyCounts (void) { }

  /** Returns the count for the given key. */
  int count (const TQString& key) const;
  /** Returns the number of properties. */

  /** Adds the given counts. */
  void add (const KPlayerPropertyCounts& counts);
  /** Subtracts the given counts. */
  void subtract (const KPlayerPropertyCounts& counts);
};

/** The KPlayer properties.
  * @author kiriuja
  */
class KPlayerProperties : public TQObject
{
  TQ_OBJECT

public:
  /** Constructor. */
  KPlayerProperties (void);
  /** Destructor. */
  virtual ~KPlayerProperties();

  /** Sets up media properties. */
  void setup (void);

  /** Initializes property information. */
  virtual void setupInfo (void);
  /** Initializes meta properties. */
  virtual void setupMeta (void);

  void defaults (void);
  void commit (void);

  /** Returns the config storage. */
  virtual TDEConfig* config (void) const = 0;
  /** Returns the config group. */
  virtual TQString configGroup (void) const = 0;

  // Property access

  /** Returns property information map. */
  static const KPlayerPropertyInfoMap& info (void)
    { return m_info; }

  /** Returns property information for the given key. */
  static KPlayerPropertyInfo* info (const TQString& key);
  /** Returns boolean property information for the given key. */
  static KPlayerBooleanPropertyInfo* booleanInfo (const TQString& key)
    { return (KPlayerBooleanPropertyInfo*) info (key); }
  /** Returns integer property information for the given key. */
  static KPlayerIntegerPropertyInfo* integerInfo (const TQString& key)
    { return (KPlayerIntegerPropertyInfo*) info (key); }
  /** Returns float property information for the given key. */
  static KPlayerFloatPropertyInfo* floatInfo (const TQString& key)
    { return (KPlayerFloatPropertyInfo*) info (key); }
  /** Returns string property information for the given key. */
  static KPlayerStringPropertyInfo* stringInfo (const TQString& key)
    { return (KPlayerStringPropertyInfo*) info (key); }

  /** Returns default order of attributes. */
  static TQStringList defaultOrder (void);
  /** Returns the list of default meta attributes. */
  static const TQStringList& defaultAttributes (void)
    { return m_meta_attributes; }

  /** Returns whether the property for the given key can be edited. */
  bool canEdit (const TQString& key)
    { return info (key) -> canEdit(); }
  /** Returns whether the property for the given key can be reset. */
  bool canReset (const TQString& key)
    { return info (key) -> canReset(); }

  /** Returns the list of property keys. */
  TQStringList keys (void) const;

  /** Returns whether meta information for the given key is available. */
  bool has (const TQString& key) const
    { return m_properties.contains (key); }

  /** Returns whether meta information for the given key was available prior to the change. */
  bool had (const TQString& key) const
    { return m_previous.contains (key); }

  /** Returns the property with the given name if it exists. */
  KPlayerProperty* property (const TQString& key) const;
  /** Returns the property map. */
  const KPlayerPropertyMap& properties (void) const
    { return m_properties; }

  /** Returns the property with the given name, creating it if necessary. */
  KPlayerProperty* get (const TQString& key);
  /** Removes the property with the given name. */
  void reset (const TQString& key);
  /** Removes all properties from the store. */
  void purge (void)
    { config() -> deleteGroup (configGroup()); }

  /** Compares the properties to the given properties and emits the updated signal. */
  void diff (KPlayerProperties* media);
  /** Compares the property with the given name to that from the given properties. */
  int compare (KPlayerProperties* properties, const TQString& key) const;

  /** Increments the given counts for existing properties. */
  void count (KPlayerPropertyCounts& counts) const;

  /** Returns a map of added properties. */
  const KPlayerPropertyCounts& added (void) const
    { return m_added; }
  /** Returns a map of changed properties. */
  const KPlayerPropertyCounts& changed (void) const
    { return m_changed; }
  /** Returns a map of removed properties. */
  const KPlayerPropertyCounts& removed (void) const
    { return m_removed; }

  virtual bool getBoolean (const TQString& key) const = 0;
  virtual void setBoolean (const TQString& key, bool value) = 0;
  int getBooleanOption (const TQString& key) const;
  void setBooleanOption (const TQString& key, int value);

  virtual int getInteger (const TQString& key) const = 0;
  virtual void setInteger (const TQString& key, int value) = 0;
  int getIntegerOption (const TQString& key) const;
  void setIntegerOption (const TQString& key, int value);
  void set (const TQString& key, int value);

  virtual int getRelativeValue (const TQString& key) const = 0;
  int getRelative (const TQString& key) const;
  virtual void setRelative (const TQString& key, int value) = 0;
  virtual void adjustRelative (const TQString& key, int value) = 0;
  int getRelativeOption (const TQString& key) const;
  void setRelativeOption (const TQString& key, int value, int option);

  virtual int getCache (const TQString& key) const = 0;
  virtual int getCacheSize (const TQString& key) const = 0;
  int getCacheOption (const TQString& key) const;

  virtual float getFloat (const TQString& key) const = 0;
  virtual void setFloat (const TQString& key, float value) = 0;
  void set (const TQString& key, float value);

  const TQSize& getSize (const TQString& key) const;
  virtual TQSize getDisplaySize (const TQString& key) const;
  int getSizeOption (const TQString& key) const;
  void setSize (const TQString& key, const TQSize& value);
  void setSize (const TQString& key, const TQSize& value, int option);

  /** Returns the value of the given key as a string. */
  TQString asString (const TQString& key) const;
  /** Returns the integer value of the given key as a string. */
  TQString asIntegerString (const TQString& key) const;
  /** Sets the value for the given key from the given string. */
  void fromString (const TQString& key, const TQString& value);

  virtual const TQString& getString (const TQString& key) const = 0;
  void setString (const TQString& key, const TQString& value);
  void set (const TQString& key, const TQString& value);

  const TQString& getStringValue (const TQString& key) const;

  void setComboValue (const TQString& key, const TQString& value);
  bool hasComboValue (const TQString& key) const;

  virtual const TQString& getComboString (const TQString& key) const = 0;
  bool hasComboString (const TQString& key) const;
  const TQString& getStringOption (const TQString& key) const;
  void setStringOption (const TQString& key, const TQString& value);

  //const TQStringList& getHistory (const TQString& key) const;

  virtual TQString getAppendable (const TQString& key) const = 0;
  int getAppendableOption (const TQString& key) const;
  void setAppendable (const TQString& key, const TQString& value, int option);

  const TQStringList& getStringList (const TQString& key) const;
  void addStringListEntry (const TQString& key, const TQString& entry);
  void setStringList (const TQString& key, const TQStringList& value);

  const TQMap<int, TQString>& getIntegerStringMap (const TQString& key) const;
  void setIntegerStringMapKey (const TQString& key, int id);
  void setIntegerStringMapKeyValue (const TQString& key, int id, const TQString& lang);
  bool hasIntegerStringMapKey (const TQString& key, int id) const;
  bool hasIntegerStringMapValue (const TQString& key, int id) const;

  const KURL& getUrl (const TQString& key) const;
  void setUrl (const TQString& key, const KURL& value);

  virtual bool autoloadSubtitles (const TQString& key) const;
  virtual bool getVobsubSubtitles (const TQString& key, const KURL& url) const;
  virtual bool getPlaylist (const TQString& key, const KURL& url) const;
  virtual bool getUseKioslave (const TQString& key, const KURL& url) const;
  /** Returns whether this media needs frequency. */
  virtual bool needsFrequency (void) const;

  /** Initializes the class. */
  static void initialize (void);
  /** Terminates the class. */
  static void terminate (void);

  /** Configuration properties. */
  KPlayerConfiguration* configuration (void) const
    { return KPlayerEngine::engine() -> configuration(); }

  // General properties

  bool fullScreen (void) const
    { return getBoolean ("Full Screen"); }
  void setFullScreen (bool full_screen)
    { setBoolean ("Full Screen", full_screen); }

  bool maximized (void) const
    { return getBoolean ("Maximized"); }
  void setMaximized (bool maximized)
    { setBoolean ("Maximized", maximized); }

  bool maintainAspect (void) const
    { return getBoolean ("Maintain Aspect"); }
  void setMaintainAspect (bool value)
    { return setBoolean ("Maintain Aspect", value); }

  // Subtitle properties

  bool subtitleAutoload (void) const
    { return autoloadSubtitles ("Autoload Subtitles"); }
  void setSubtitleAutoload (bool value)
    { return setBoolean ("Autoload Subtitles", value); }

  bool subtitleClosedCaption (void) const
    { return getBoolean ("Closed Caption"); }
  void setSubtitleClosedCaption (bool enable)
    { setBoolean ("Closed Caption", enable); }

  const TQString& subtitleEncoding (void) const
    { return getString ("Subtitle Encoding"); }
  void setSubtitleEncoding (const TQString& encoding)
    { set ("Subtitle Encoding", encoding); }
  bool hasSubtitleEncoding (void) const
    { return has ("Subtitle Encoding"); }
  void resetSubtitleEncoding (void)
    { reset ("Subtitle Encoding"); }

  int subtitlePosition (void) const
    { return getInteger ("Subtitle Position"); }
  void setSubtitlePosition (int value)
    { return setInteger ("Subtitle Position", limit (value, 0, 100)); }

  float subtitleDelay (void) const
    { return getFloat ("Subtitle Delay"); }
  void setSubtitleDelay (float value)
    { return setFloat ("Subtitle Delay", value); }

  // Audio properties

  int volume (void) const
    { return getRelative ("Volume"); }
  void setVolume (int volume)
    { setRelative ("Volume", volume); }
  void adjustVolume (int volume)
    { adjustRelative ("Volume", volume); }

  float audioDelay (void) const
    { return getFloat ("Audio Delay"); }
  void setAudioDelay (float value)
    { return setFloat ("Audio Delay", value); }

  const TQString& audioDriver (void) const
    { return getString ("Audio Driver"); }
  const TQString& audioDevice (void) const
    { return getString ("Audio Device"); }

  bool softwareVolume (void) const
    { return getBoolean ("Software Volume"); }
  int maximumSoftwareVolume (void) const
    { return getInteger ("Maximum Software Volume"); }

  const TQString& mixerDevice (void) const
    { return getString ("Mixer Device"); }
  const TQString& mixerChannel (void) const
    { return getString ("Mixer Channel"); }

  const TQString& audioCodec (void) const
    { return getStringValue ("Audio Codec"); }
  void setAudioCodec (const TQString& codec)
    { setComboValue ("Audio Codec", codec); }

  // Video properties

  int contrast (void) const
    { return getRelative ("Contrast"); }
  void setContrast (int contrast)
    { setRelative ("Contrast", contrast); }
  void adjustContrast (int contrast)
    { adjustRelative ("Contrast", contrast); }

  int brightness (void) const
    { return getRelative ("Brightness"); }
  void setBrightness (int brightness)
    { setRelative ("Brightness", brightness); }
  void adjustBrightness (int brightness)
    { adjustRelative ("Brightness", brightness); }

  int hue (void) const
    { return getRelative ("Hue"); }
  void setHue (int hue)
    { setRelative ("Hue", hue); }
  void adjustHue (int hue)
    { adjustRelative ("Hue", hue); }

  int saturation (void) const
    { return getRelative ("Saturation"); }
  void setSaturation (int saturation)
    { setRelative ("Saturation", saturation); }
  void adjustSaturation (int saturation)
    { adjustRelative ("Saturation", saturation); }

  const TQString& videoDriver (void) const
    { return getString ("Video Driver"); }
  const TQString& videoDevice (void) const
    { return getString ("Video Device"); }

  const TQString& videoCodec (void) const
    { return getStringValue ("Video Codec"); }
  void setVideoCodec (const TQString& codec)
    { setComboValue ("Video Codec", codec); }

  int videoScaler (void) const
    { return getInteger ("Video Scaler"); }
  void setVideoScaler (int value)
    { setInteger ("Video Scaler", value); }

  bool videoDoubleBuffering (void) const
    { return getBoolean ("Double Buffering"); }
  void setVideoDoubleBuffering (bool value)
    { setBoolean ("Double Buffering", value); }

  bool videoDirectRendering (void) const
    { return getBoolean ("Direct Rendering"); }
  void setVideoDirectRendering (bool value)
    { setBoolean ("Direct Rendering", value); }

  // Advanced properties

  const TQString& executablePath (void) const
    { return getString ("Executable Path"); }
  void setExecutablePath (const TQString& path)
    { setString ("Executable Path", path); }

  TQString commandLine (void) const
    { return getAppendable ("Command Line"); }
  void setCommandLine (const TQString& line)
    { setString ("Command Line", line); }
  //const TQStringList& commandLineHistory (void) const
  //  { return getHistory ("Command Line"); }

  const TQString& demuxer (void) const
    { return getStringValue ("Demuxer"); }
  void setDemuxer (const TQString& codec)
    { setComboValue ("Demuxer", codec); }

  int frameDrop (void) const
    { return getInteger ("Frame Dropping"); }
  void setFrameDrop (int frame_drop)
    { setInteger ("Frame Dropping", frame_drop); }

  int cache (void) const
    { return getCache ("Cache"); }
  int cacheSize (void) const
    { return getCacheSize ("Cache"); }
  void setCache (int cache, int size);
  void setCacheOption (int cache, int size);

  int buildNewIndex (void) const
    { return getInteger ("Build New Index"); }
  void setBuildNewIndex (int build)
    { setInteger ("Build New Index", build); }

  bool useTemporaryFile (void) const
    { return getBoolean ("Use Temporary File For KIOSlave"); }
  void setUseTemporaryFile (bool value)
    { setBoolean ("Use Temporary File For KIOSlave", value); }

  int osdLevel (void) const
    { return getInteger ("OSD Level"); }
  void setOsdLevel (int level)
    { setInteger ("OSD Level", level); }

protected:
  /** Properties, including meta information. */
  KPlayerPropertyMap m_properties;
  /** Previous properties. */
  KPlayerPropertyMap m_previous;
  /** Properties that have been added. */
  KPlayerPropertyCounts m_added;
  /** Properties that have been changed. */
  KPlayerPropertyCounts m_changed;
  /** Properties that have been removed. */
  KPlayerPropertyCounts m_removed;

  /** Information about configuration properties. */
  static KPlayerPropertyInfoMap m_info;

  /** Information about meta properties. */
  static KPlayerStringPropertyInfo m_meta_info;
  /** List of default meta attributes. */
  static TQStringList m_meta_attributes;
  /** Null URL. */
  static const KURL nullUrl;
  /** Null size. */
  static const TQSize nullSize;
  /** Null string list. */
  static const TQStringList nullStringList;
  /** Null integer string map. */
  static const TQMap<int, TQString> nullIntegerStringMap;

  void load (void);
  void save (void) const;
  void update (void);
  void cleanup (void);

  void beginUpdate (void);
  void updated (const TQString& key);

signals:
  /** Emitted when the properties are updated. */
  void updated (void);
};

/** The KPlayer configuration.
  * @author kiriuja
  */
class KPlayerConfiguration : public KPlayerProperties
{
  TQ_OBJECT

public:
  /** Constructor. */
  KPlayerConfiguration (void);
  /** Destructor. */
  virtual ~KPlayerConfiguration();

  /** Returns the config storage. */
  virtual TDEConfig* config (void) const;
  /** Returns the config group. */
  virtual TQString configGroup (void) const;

  virtual bool getBoolean (const TQString& key) const;
  virtual void setBoolean (const TQString& key, bool value);
  virtual int getInteger (const TQString& key) const;
  virtual void setInteger (const TQString& key, int value);
  virtual int getRelativeValue (const TQString& key) const;
  virtual void setRelative (const TQString& key, int value);
  virtual void adjustRelative (const TQString& key, int value);
  virtual int getCache (const TQString& key) const;
  virtual int getCacheSize (const TQString& key) const;
  virtual float getFloat (const TQString& key) const;
  virtual void setFloat (const TQString& key, float value);
  virtual const TQString& getString (const TQString& key) const;
  virtual const TQString& getComboString (const TQString& key) const;
  virtual TQString getAppendable (const TQString& key) const;
  virtual bool autoloadSubtitles (const TQString& key) const;
  virtual bool getVobsubSubtitles (const TQString& key, const KURL& url) const;
  virtual bool getPlaylist (const TQString& key, const KURL& url) const;
  virtual bool getUseKioslave (const TQString& key, const KURL& url) const;

  /** Returns the override flag for the given key. */
  bool override (const TQString& key)
    { return info (key) -> override(); }
  /** Sets the override flag for the given key. */
  void setOverride (const TQString& key, bool override)
    { info (key) -> setOverride (override); }

  /** Resets configuration for a new item. */
  void itemReset (void);

  // General configuration

  bool resizeAutomatically (void) const
    { return getBoolean ("Resize Main Window Automatically"); }
  void setResizeAutomatically (bool resize)
    { setBoolean ("Resize Main Window Automatically", resize); }

  int minimumInitialWidth (void) const
    { return getInteger ("Minimum Initial Width"); }
  void setMinimumInitialWidth (int width)
    { setInteger ("Minimum Initial Width", limit (width, 200)); }

  int recentMenuSize (void) const
    { return getInteger ("Recent File List Size"); }
  void setRecentMenuSize (int size)
    { setInteger ("Recent File List Size", limit (size, 0)); }

  int recentListSize (void) const
    { return getInteger ("Playlist Size Limit"); }
  void setRecentListSize (int size)
    { setInteger ("Playlist Size Limit", limit (size, 0)); }

  // Playlist configuration

  /** Returns whether the playlist loops. */
  bool loop (void) const
    { return getBoolean ("Playlist Loop"); }
  /** Sets the playlist loop option. */
  void setLoop (bool loop)
    { setBoolean ("Playlist Loop", loop); }

  /** Returns whether the playlist is shuffled. */
  bool shuffle (void) const
    { return getBoolean ("Playlist Shuffle"); }
  /** Sets the playlist shuffle option and shuffles the playlist if the option is on. */
  void setShuffle (bool shuffle)
    { setBoolean ("Playlist Shuffle", shuffle); }

  bool allowDuplicateEntries (void) const
    { return getBoolean ("Allow Duplicate Entries"); }
  void setAllowDuplicateEntries (bool allow)
    { setBoolean ("Allow Duplicate Entries", allow); }

  int playlistMenuSize (void) const
    { return getInteger ("Playlist Menu Size"); }
  void setPlaylistMenuSize (int size)
    { setInteger ("Playlist Menu Size", limit (size, 0)); }

  int cacheSizeLimit (void) const
    { return getInteger ("Cache Size Limit"); }
  void setCacheSizeLimit (int size)
    { setInteger ("Cache Size Limit", limit (size, 10, 1000000)); }

  // Control configuration

  bool rememberWithShift (void) const
    { return getBoolean ("Remember With Shift"); }
  void setRememberWithShift (bool remember)
    { setBoolean ("Remember With Shift", remember); }

  bool rememberSize (void) const
    { return getBoolean ("Remember Size"); }
  bool rememberSize (bool shift) const
    { return rememberSize() || shift && rememberWithShift(); }
  void setRememberSize (bool remember)
    { setBoolean ("Remember Size", remember); }

  bool rememberAspect (void) const
    { return getBoolean ("Remember Aspect"); }
  bool rememberAspect (bool shift) const
    { return rememberAspect() || shift && rememberWithShift(); }
  void setRememberAspect (bool remember)
    { setBoolean ("Remember Aspect", remember); }

  bool rememberFullScreen (void) const
    { return getBoolean ("Remember Full Screen"); }
  bool rememberFullScreen (bool shift) const
    { return rememberFullScreen() || shift && rememberWithShift(); }
  void setRememberFullScreen (bool remember)
    { setBoolean ("Remember Full Screen", remember); }

  bool rememberMaximized (void) const
    { return getBoolean ("Remember Maximized"); }
  bool rememberMaximized (bool shift) const
    { return rememberMaximized() || shift && rememberWithShift(); }
  void setRememberMaximized (bool remember)
    { setBoolean ("Remember Maximized", remember); }

  bool rememberMaintainAspect (void) const
    { return getBoolean ("Remember Maintain Aspect"); }
  bool rememberMaintainAspect (bool shift) const
    { return rememberMaintainAspect() || shift && rememberWithShift(); }
  void setRememberMaintainAspect (bool remember)
    { setBoolean ("Remember Maintain Aspect", remember); }

  bool rememberVolume (void) const
    { return getBoolean ("Remember Volume"); }
  bool rememberVolume (bool shift) const
    { return rememberVolume() || shift && rememberWithShift(); }
  void setRememberVolume (bool remember)
    { setBoolean ("Remember Volume", remember); }

  bool rememberAudioDelay (void) const
    { return getBoolean ("Remember Audio Delay"); }
  bool rememberAudioDelay (bool shift) const
    { return rememberAudioDelay() || shift && rememberWithShift(); }
  void setRememberAudioDelay (bool remember)
    { setBoolean ("Remember Audio Delay", remember); }

  bool rememberFrameDrop (void) const
    { return getBoolean ("Remember Frame Drop"); }
  bool rememberFrameDrop (bool shift) const
    { return rememberFrameDrop() || shift && rememberWithShift(); }
  void setRememberFrameDrop (bool remember)
    { setBoolean ("Remember Frame Drop", remember); }

  bool rememberContrast (void) const
    { return getBoolean ("Remember Contrast"); }
  bool rememberContrast (bool shift) const
    { return rememberContrast() || shift && rememberWithShift(); }
  void setRememberContrast (bool remember)
    { setBoolean ("Remember Contrast", remember); }

  bool rememberBrightness (void) const
    { return getBoolean ("Remember Brightness"); }
  bool rememberBrightness (bool shift) const
    { return rememberBrightness() || shift && rememberWithShift(); }
  void setRememberBrightness (bool remember)
    { setBoolean ("Remember Brightness", remember); }

  bool rememberHue (void) const
    { return getBoolean ("Remember Hue"); }
  bool rememberHue (bool shift) const
    { return rememberHue() || shift && rememberWithShift(); }
  void setRememberHue (bool remember)
    { setBoolean ("Remember Hue", remember); }

  bool rememberSaturation (void) const
    { return getBoolean ("Remember Saturation"); }
  bool rememberSaturation (bool shift) const
    { return rememberSaturation() || shift && rememberWithShift(); }
  void setRememberSaturation (bool remember)
    { setBoolean ("Remember Saturation", remember); }

  bool rememberSubtitlePosition (void) const
    { return getBoolean ("Remember Subtitle Position"); }
  bool rememberSubtitlePosition (bool shift) const
    { return rememberSubtitlePosition() || shift && rememberWithShift(); }
  void setRememberSubtitlePosition (bool remember)
    { setBoolean ("Remember Subtitle Position", remember); }

  bool rememberSubtitleDelay (void) const
    { return getBoolean ("Remember Subtitle Delay"); }
  bool rememberSubtitleDelay (bool shift) const
    { return rememberSubtitleDelay() || shift && rememberWithShift(); }
  void setRememberSubtitleDelay (bool remember)
    { setBoolean ("Remember Subtitle Delay", remember); }

  // Volume configuration

  int volumeMinimum (void) const
    { return getInteger ("Volume Minimum"); }
  void setVolumeMinimum (int volume)
    { setInteger ("Volume Minimum", limit (volume, 0, 100)); }

  int volumeMaximum (void) const
    { return getInteger ("Volume Maximum"); }
  void setVolumeMaximum (int volume)
    { setInteger ("Volume Maximum", limit (volume, 0, 100)); }

  void setVolumeMinimumMaximum (int minimum, int maximum)
  {
    limit4 (minimum, maximum, 0, 100);
    setVolumeMinimum (minimum);
    setVolumeMaximum (maximum);
    //setVolume (limit (volume(), volumeMinimum(), volumeMaximum()));
  }

  int volumeStep (void) const
    { return getInteger ("Volume Step"); }
  void setVolumeStep (int volume)
    { setInteger ("Volume Step", limit (volume, 1, volumeMaximum() - volumeMinimum())); }

  bool volumeReset (void) const
    { return getBoolean ("Volume Reset"); }
  void setVolumeReset (bool volume)
    { setBoolean ("Volume Reset", volume); }

  int volumeEvery (void) const
    { return getInteger ("Volume Every"); }
  void setVolumeEvery (int volume)
    { setInteger ("Volume Every", limit (volume, 0, 1)); }
  bool resetVolumeEveryFile (void) const
    { return volumeReset() && volumeEvery() == 0; }

  int initialVolume (void) const
    { return getInteger ("Volume Default"); }
  void setInitialVolume (int volume)
    { setInteger ("Volume Default", limit (volume, volumeMinimum(), volumeMaximum())); }

  // Contrast configuration

  int contrastMinimum (void) const
    { return getInteger ("Contrast Minimum"); }
  void setContrastMinimum (int contrast)
    { setInteger ("Contrast Minimum", limit (contrast, -100, 100)); }

  int contrastMaximum (void) const
    { return getInteger ("Contrast Maximum"); }
  void setContrastMaximum (int contrast)
    { setInteger ("Contrast Maximum", limit (contrast, -100, 100)); }

  void setContrastMinimumMaximum (int minimum, int maximum)
  {
    limit4 (minimum, maximum, -100, 100);
    setContrastMinimum (minimum);
    setContrastMaximum (maximum);
    //setContrast (limit (contrast(), contrastMinimum(), contrastMaximum()));
  }

  int contrastStep (void) const
    { return getInteger ("Contrast Step"); }
  void setContrastStep (int contrast)
    { setInteger ("Contrast Step", limit (contrast, 1, contrastMaximum() - contrastMinimum())); }

  bool contrastReset (void) const
    { return getBoolean ("Contrast Reset"); }
  void setContrastReset (bool contrast)
    { setBoolean ("Contrast Reset", contrast); }

  int contrastEvery (void) const
    { return getInteger ("Contrast Every"); }
  void setContrastEvery (int contrast)
    { setInteger ("Contrast Every", limit (contrast, 0, 1)); }
  bool resetContrastEveryFile (void) const
    { return contrastReset() && contrastEvery() == 0; }

  int initialContrast (void) const
    { return getInteger ("Contrast Default"); }
  void setInitialContrast (int contrast)
    { setInteger ("Contrast Default", limit (contrast, contrastMinimum(), contrastMaximum())); }

  // Brightness configuration

  int brightnessMinimum (void) const
    { return getInteger ("Brightness Minimum"); }
  void setBrightnessMinimum (int brightness)
    { setInteger ("Brightness Minimum", limit (brightness, -50, 50)); }

  int brightnessMaximum (void) const
    { return getInteger ("Brightness Maximum"); }
  void setBrightnessMaximum (int brightness)
    { setInteger ("Brightness Maximum", limit (brightness, -50, 50)); }

  void setBrightnessMinimumMaximum (int minimum, int maximum)
  {
    limit4 (minimum, maximum, -50, 50);
    setBrightnessMinimum (minimum);
    setBrightnessMaximum (maximum);
    //setBrightness (limit (brightness(), brightnessMinimum(), brightnessMaximum()));
  }

  int brightnessStep (void) const
    { return getInteger ("Brightness Step"); }
  void setBrightnessStep (int brightness)
    { setInteger ("Brightness Step", limit (brightness, 1, brightnessMaximum() - brightnessMinimum())); }

  bool brightnessReset (void) const
    { return getBoolean ("Brightness Reset"); }
  void setBrightnessReset (bool brightness)
    { setBoolean ("Brightness Reset", brightness); }

  int brightnessEvery (void) const
    { return getInteger ("Brightness Every"); }
  void setBrightnessEvery (int brightness)
    { setInteger ("Brightness Every", limit (brightness, 0, 1)); }
  bool resetBrightnessEveryFile (void) const
    { return brightnessReset() && brightnessEvery() == 0; }

  int initialBrightness (void) const
    { return getInteger ("Brightness Default"); }
  void setInitialBrightness (int brightness)
    { setInteger ("Brightness Default", limit (brightness, brightnessMinimum(), brightnessMaximum())); }

  // Hue configuration

  int hueMinimum (void) const
    { return getInteger ("Hue Minimum"); }
  void setHueMinimum (int hue)
    { setInteger ("Hue Minimum", limit (hue, -100, 100)); }

  int hueMaximum (void) const
    { return getInteger ("Hue Maximum"); }
  void setHueMaximum (int hue)
    { setInteger ("Hue Maximum", limit (hue, -100, 100)); }

  void setHueMinimumMaximum (int minimum, int maximum)
  {
    limit4 (minimum, maximum, -100, 100);
    setHueMinimum (minimum);
    setHueMaximum (maximum);
    //setHue (limit (hue(), hueMinimum(), hueMaximum()));
  }

  int hueStep (void) const
    { return getInteger ("Hue Step"); }
  void setHueStep (int hue)
    { setInteger ("Hue Step", limit (hue, 1, hueMaximum() - hueMinimum())); }

  bool hueReset (void) const
    { return getBoolean ("Hue Reset"); }
  void setHueReset (bool hue)
    { setBoolean ("Hue Reset", hue); }

  int hueEvery (void) const
    { return getInteger ("Hue Every"); }
  void setHueEvery (int hue)
    { setInteger ("Hue Every", limit (hue, 0, 1)); }
  bool resetHueEveryFile (void) const
    { return hueReset() && hueEvery() == 0; }

  int initialHue (void) const
    { return getInteger ("Hue Default"); }
  void setInitialHue (int hue)
    { setInteger ("Hue Default", limit (hue, hueMinimum(), hueMaximum())); }

  // Saturation configuration

  int saturationMinimum (void) const
    { return getInteger ("Saturation Minimum"); }
  void setSaturationMinimum (int saturation)
    { setInteger ("Saturation Minimum", limit (saturation, -100, 100)); }

  int saturationMaximum (void) const
    { return getInteger ("Saturation Maximum"); }
  void setSaturationMaximum (int saturation)
    { setInteger ("Saturation Maximum", limit (saturation, -100, 100)); }

  void setSaturationMinimumMaximum (int minimum, int maximum)
  {
    limit4 (minimum, maximum, -100, 100);
    setSaturationMinimum (minimum);
    setSaturationMaximum (maximum);
    //setSaturation (limit (saturation(), saturationMinimum(), saturationMaximum()));
  }

  int saturationStep (void) const
    { return getInteger ("Saturation Step"); }
  void setSaturationStep (int saturation)
    { setInteger ("Saturation Step", limit (saturation, 1, saturationMaximum() - saturationMinimum())); }

  bool saturationReset (void) const
    { return getBoolean ("Saturation Reset"); }
  void setSaturationReset (bool saturation)
    { setBoolean ("Saturation Reset", saturation); }

  int saturationEvery (void) const
    { return getInteger ("Saturation Every"); }
  void setSaturationEvery (int saturation)
    { setInteger ("Saturation Every", limit (saturation, 0, 1)); }
  bool resetSaturationEveryFile (void) const
    { return saturationReset() && saturationEvery() == 0; }

  int initialSaturation (void) const
    { return getInteger ("Saturation Default"); }
  void setInitialSaturation (int saturation)
    { setInteger ("Saturation Default", limit (saturation, saturationMinimum(), saturationMaximum())); }

  // Progress and seeking configuration

  int progressNormalSeek (void) const
    { return getInteger ("Normal Seek"); }
  void setProgressNormalSeek (int seek)
    { setInteger ("Normal Seek", limit (seek, 1,
        progressFastSeekUnits() == progressNormalSeekUnits() ? progressFastSeek() :
        progressNormalSeekUnits() ? INT_MAX : 100)); }

  int progressNormalSeekUnits (void) const
    { return getInteger ("Normal Seek Units"); }
  void setProgressNormalSeekUnits (int units)
    { setInteger ("Normal Seek Units", limit (units, 0, 1)); }

  int progressFastSeek (void) const
    { return getInteger ("Fast Seek"); }
  void setProgressFastSeek (int seek)
    { setInteger ("Fast Seek", limit (seek,
        progressFastSeekUnits() == progressNormalSeekUnits() ? progressNormalSeek() : 1,
        progressFastSeekUnits() ? INT_MAX : 100)); }

  int progressFastSeekUnits (void) const
    { return getInteger ("Fast Seek Units"); }
  void setProgressFastSeekUnits (int units)
    { setInteger ("Fast Seek Units", limit (units, 0, 1)); }

  // Slider configuration

  int preferredSliderLength (void) const
    { return getInteger ("Preferred Slider Length"); }
  void setPreferredSliderLength (int length)
    { setInteger ("Preferred Slider Length", limit (length, 50)); }
  void resetPreferredSliderLength (void)
    { reset ("Preferred Slider Length"); }

  int minimumSliderLength (void) const
    { return getInteger ("Minimum Slider Length"); }
  void setMinimumSliderLength (int length)
    { setInteger ("Minimum Slider Length", limit (length, 50)); }
  void resetMinimumSliderLength (void)
    { reset ("Minimum Slider Length"); }

  bool showSliderMarks (void) const
    { return getBoolean ("Show Slider Marks"); }
  void setShowSliderMarks (bool show)
    { setBoolean ("Show Slider Marks", show); }

  int sliderMarksInterval (int span) const;
  int sliderMarks (void) const
    { return getInteger ("Slider Marks"); }
  void setSliderMarks (int marks)
    { setInteger ("Slider Marks", limit (marks, 1, 100)); }
  void resetSliderMarks (void)
    { reset ("Slider Marks"); }

  // Message configuration

  bool showMessagesOnError (void) const
    { return getBoolean ("Show Messages On Error"); }
  void setShowMessagesOnError (bool show)
    { setBoolean ("Show Messages On Error", show); }

  // Audio configuration

  bool mute (void) const
    { return getBoolean ("Mute"); }
  void setMute (bool mute)
    { setBoolean ("Mute", mute); }

  float audioDelayStep (void) const
    { return getFloat ("Audio Delay Step"); }
  void setAudioDelayStep (float step)
    { setFloat ("Audio Delay Step", flimit (step, 0.01)); }
  void resetAudioDelayStep (void)
    { reset ("Audio Delay Step"); }

  void setAudioDriver (const TQString& driver)
    { setString ("Audio Driver", driver); }
  void setAudioDevice (const TQString& device)
    { setString ("Audio Device", device); }

  void setSoftwareVolume (bool value)
    { return setBoolean ("Software Volume", value); }
  void setMaximumSoftwareVolume (int maximum)
    { setInteger ("Maximum Software Volume", maximum); }
  void resetMaximumSoftwareVolume (void)
    { reset ("Maximum Software Volume"); }

  void setMixerDevice (const TQString& device)
    { setString ("Mixer Device", device); }
  bool hasMixerDevice (void) const
    { return has ("Mixer Device"); }
  void setMixerChannel (const TQString& channel)
    { setString ("Mixer Channel", channel); }

  const TQString& switchAudioDemuxers (void) const
    { return getString ("Switch Audio Demuxers"); }

  // Video configuration

  void setVideoDriver (const TQString& driver)
    { setString ("Video Driver", driver); }
  void setVideoDevice (const TQString& device)
    { setString ("Video Device", device); }

  // Subtitle configuration

  const TQString& subtitleFontName (void) const
    { return getString ("Subtitle Font Name"); }
  void setSubtitleFontName (const TQString& name)
    { setString ("Subtitle Font Name", name); }

  bool subtitleFontBold (void) const
    { return getBoolean ("Subtitle Font Bold"); }
  void setSubtitleFontBold (bool bold)
    { setBoolean ("Subtitle Font Bold", bold); }

  bool subtitleFontItalic (void) const
    { return getBoolean ("Subtitle Font Italic"); }
  void setSubtitleFontItalic (bool italic)
    { setBoolean ("Subtitle Font Italic", italic); }

  float subtitleTextSize (void) const
    { return getFloat ("Subtitle Text Size"); }
  void setSubtitleTextSize (float size)
    { setFloat ("Subtitle Text Size", flimit (size, 0.1, 100)); }
  void resetSubtitleTextSize (void)
    { reset ("Subtitle Text Size"); }

  bool subtitleAutoscale (void) const
    { return getBoolean ("Subtitle Autoscale"); }
  void setSubtitleAutoscale (bool scale)
    { setBoolean ("Subtitle Autoscale", scale); }

  float subtitleFontOutline (void) const
    { return getFloat ("Subtitle Font Outline"); }
  void setSubtitleFontOutline (float outline)
    { setFloat ("Subtitle Font Outline", flimit (outline, 0, 10)); }
  bool hasSubtitleFontOutline (void) const
    { return has ("Subtitle Font Outline"); }
  TQString subtitleFontOutlineString (void) const
    { return asString ("Subtitle Font Outline"); }

  int subtitleTextWidth (void) const
    { return getInteger ("Subtitle Text Width"); }
  void setSubtitleTextWidth (int width)
    { setInteger ("Subtitle Text Width", limit (width, 10, 100)); }
  bool hasSubtitleTextWidth (void) const
    { return has ("Subtitle Text Width"); }
  TQString subtitleTextWidthString (void) const
    { return asString ("Subtitle Text Width"); }

  bool subtitleEmbeddedFonts (void) const
    { return getBoolean ("Subtitle Embedded Fonts"); }
  void setSubtitleEmbeddedFonts (bool enable)
    { setBoolean ("Subtitle Embedded Fonts", enable); }

  int subtitlePositionStep (void) const
    { return getInteger ("Subtitle Position Step"); }
  void setSubtitlePositionStep (int step)
    { setInteger ("Subtitle Position Step", limit (step, 1)); }

  float subtitleDelayStep (void) const
    { return getFloat ("Subtitle Delay Step"); }
  void setSubtitleDelayStep (float step)
    { setFloat ("Subtitle Delay Step", flimit (step, 0.01)); }
  void resetSubtitleDelayStep (void)
    { reset ("Subtitle Delay Step"); }

  int subtitleAutoexpand (void) const
    { return getInteger ("Subtitle Autoexpand"); }
  void setSubtitleAutoexpand (int expand)
    { setInteger ("Subtitle Autoexpand", limit (expand, 0, 3)); }
  void resetSubtitleAutoexpand (void)
    { reset ("Subtitle Autoexpand"); }
  bool hasSubtitleAutoexpand (void) const
    { return has ("Subtitle Autoexpand"); }
  TQSize autoexpandAspect (void) const;

  const TQString& autoloadExtensionList (void) const
    { return getString ("Autoload Extension List"); }
  void setAutoloadExtensionList (const TQString& autoload)
    { setString ("Autoload Extension List", autoload); }

  TQStringList subtitleExtensions (void) const;

  // Advanced configuration

  bool useKioslaveForHttp (void) const
    { return getBoolean ("Use KIOSlave For HTTP"); }
  void setUseKioslaveForHttp (bool use)
    { setBoolean ("Use KIOSlave For HTTP", use); }

  bool useKioslaveForFtp (void) const
    { return getBoolean ("Use KIOSlave For FTP"); }
  void setUseKioslaveForFtp (bool use)
    { setBoolean ("Use KIOSlave For FTP", use); }

  bool useKioslaveForSmb (void) const
    { return getBoolean ("Use KIOSlave For SMB"); }
  void setUseKioslaveForSmb (bool use)
    { setBoolean ("Use KIOSlave For SMB", use); }
};

/** The KPlayer media.
  * @author kiriuja
  */
class KPlayerMedia : public KPlayerProperties
{
  TQ_OBJECT

public:
  /** Constructor. */
  KPlayerMedia (KPlayerProperties* parent, const KURL& url);
  /** Destructor. */
  virtual ~KPlayerMedia();

  /** Parent properties. */
  KPlayerProperties* parent (void) const
    { return m_parent; }
  /** Sets the parent. */
  void setParent (KPlayerMedia* media);

  const KURL& url (void) const
    { return m_url; }

  /** Increments reference count. */
  void reference (void)
    { ++ m_references; }
  /** Returns reference count. */
  int references (void)
    { return m_references; }

  /** Returns the config group. */
  virtual TQString configGroup (void) const;

  virtual bool getBoolean (const TQString& key) const;
  virtual void setBoolean (const TQString& key, bool value);
  virtual int getInteger (const TQString& key) const;
  virtual void setInteger (const TQString& key, int value);
  virtual int getRelativeValue (const TQString& key) const;
  virtual void setRelative (const TQString& key, int value);
  virtual void adjustRelative (const TQString& key, int value);
  virtual int getCache (const TQString& key) const;
  virtual int getCacheSize (const TQString& key) const;
  virtual float getFloat (const TQString& key) const;
  virtual void setFloat (const TQString& key, float value);
  virtual const TQString& getString (const TQString& key) const;
  virtual const TQString& getComboString (const TQString& key) const;
  virtual TQString getAppendable (const TQString& key) const;

  /** Creates generic properties for the given URL based on configuration if needed and adds a reference. */
  static KPlayerGenericProperties* genericProperties (const KURL& url);
  /** Creates device properties for the given URL based on configuration if needed and adds a reference. */
  static KPlayerDeviceProperties* deviceProperties (const KURL& url);
  /** Creates disk properties for the given URL based on configuration if needed and adds a reference. */
  static KPlayerDiskProperties* diskProperties (const KURL& url);
  /** Creates disk properties for the given URL if needed and adds a reference. */
  static KPlayerDiskProperties* diskProperties (KPlayerDeviceProperties* parent, const KURL& url);
  /** Creates TV device properties for the given URL based on configuration if needed and adds a reference. */
  static KPlayerTVProperties* tvProperties (const KURL& url);
  /** Creates DVB device properties for the given URL based on configuration if needed and adds a reference. */
  static KPlayerDVBProperties* dvbProperties (const KURL& url);
  /** Creates track properties for the given URL if needed and adds a reference. */
  static KPlayerTrackProperties* trackProperties (const KURL& url);
  /** Adds a reference and returns the media for the given URL if it is already loaded. */
  static KPlayerMedia* reference (const TQString& urls);
  /** Releases the given media properties and removes them from the map when no references remain. */
  static void release (KPlayerMedia* media);

protected:
  /** Parent properties. */
  KPlayerProperties* m_parent;
  /** Media URL. */
  KURL m_url;
  /** Reference count. */
  int m_references;

  /** Media map by URL string. */
  static KPlayerMediaMap m_media_map;

  /** Decrements reference count and deletes the object when no references remain. */
  bool release (void);
};

/** The KPlayer generic properties.
  * @author kiriuja
  */
class KPlayerGenericProperties : public KPlayerMedia
{
  TQ_OBJECT

public:
  /** Constructor. */
  KPlayerGenericProperties (KPlayerProperties* parent, const KURL& url);
  /** Destructor. */
  virtual ~KPlayerGenericProperties();

  /** Returns the config storage. */
  virtual TDEConfig* config (void) const;

  TQString name (void) const
    { return asString ("Name"); }
  void setName (const TQString& name)
    { set ("Name", name); }
  bool hasName (void) const
    { return ! getString ("Name").isEmpty(); }
  //const TQStringList& nameHistory (void) const
  //  { return getHistory ("Name"); }

  TQString defaultName (void) const;
  void setDefaultName (const TQString& name)
    { m_default_name = name; }

  const TQString& temporaryName (void) const
    { return m_temporary_name; }
  void setTemporaryName (const TQString& name)
    { m_temporary_name = name; }
  TQString currentName (void) const
    { return temporaryName().isEmpty() ? name() : temporaryName(); }

  TQString caption (void) const;

  /** Returns icon name. */
  virtual TQString icon (void) const;
  void setIcon (const TQString& icon)
    { setString ("Icon", icon); }
  bool hasIcon (void) const
    { return has ("Icon"); }

  const TQStringList& children (void) const
    { return getStringList ("Children"); }
  void setChildren (const TQStringList& children)
    { setStringList ("Children", children); }
  void resetChildren (void)
    { reset ("Children"); }
  bool hasChildren (void) const
    { return has ("Children"); }

  const KURL& origin (void) const
    { return getUrl ("Origin"); }
  void setOrigin (const KURL& url)
    { setUrl ("Origin", url); }
  void resetOrigin (void)
    { reset ("Origin"); }

  bool customOrder (void) const
    { return getBoolean ("Custom Order"); }
  void setCustomOrder (bool custom)
    { setBooleanOption ("Custom Order", custom ? 1 : 2); }
  void resetCustomOrder (void)
    { reset ("Custom Order"); }
  bool hasCustomOrder (void) const
    { return has ("Custom Order"); }

  const TQString& groupingKey (void) const
    { return getString ("Group By"); }
  void setGroupingKey (const TQString& key)
    { setString ("Group By", key); }

  /** Returns the type property for the given ID. */
  TQString type (const TQString& id) const;

  /** Returns the MSF property for the given ID. */
  float msf (const TQString& id) const;

  /** Returns the hidden property for the given ID. */
  bool hidden (const TQString& id) const;
  /** Sets the hidden property for the given ID. */
  void setHidden (const TQString& id, bool hidden);

protected:
  /** Default name. */
  TQString m_default_name;
  /** Temporary name. */
  TQString m_temporary_name;
};

/** The KPlayer media properties.
  * @author kiriuja
  */
class KPlayerMediaProperties : public KPlayerGenericProperties
{
  TQ_OBJECT

public:
  /** Constructor. */
  KPlayerMediaProperties (KPlayerProperties* parent, const KURL& url);
  /** Destructor. */
  virtual ~KPlayerMediaProperties();

  // General properties

  const KURL& path (void) const
    { return getUrl ("Path"); }
  void setPath (const KURL& url)
    { setUrl ("Path", url); }
  bool hasPath (void) const
    { return has ("Path"); }
  TQString pathString (void) const
    { return asString ("Path"); }

  const TQString& type (void) const
    { return getString ("Type"); }
  void setType (const TQString& type)
    { setString ("Type", type); }
  void resetType (void)
    { return reset ("Type"); }
  bool hasType (void) const
    { return has ("Type"); }
  /** Translated type. */
  TQString typeString (void) const
    { return asString ("Type"); }

  TQSize displaySize (void) const
    { return getDisplaySize ("Display Size"); }
  int displaySizeOption (void) const
    { return getSizeOption ("Display Size"); }
  bool hasDisplaySize (void) const
    { return has ("Display Size"); }
  virtual void setDisplaySize (const TQSize& size, int option);
  void resetDisplaySize (void)
    { reset ("Display Size"); }
  /** Display size as string. */
  TQString displaySizeString (void) const
    { return asString ("Display Size"); }
  /** Display width as string. */
  TQString displayWidthString (void) const
    { return hasDisplaySize() ? TQString::number (getSize ("Display Size").width()) : TQString::null; }
  /** Display height as string. */
  TQString displayHeightString (void) const
    { return hasDisplaySize() ? TQString::number (getSize ("Display Size").height()) : TQString::null; }

  const TQString& channelList (void) const
    { return getString ("Channel List"); }
  bool hasChannelList (void) const
    { return has ("Channel List"); }

  const TQString& inputDriver (void) const
    { return getString ("Input Driver"); }

  // Size properties

  int fullScreenOption (void) const
    { return getBooleanOption ("Full Screen"); }
  void setFullScreenOption (int full_screen)
    { setBooleanOption ("Full Screen", full_screen); }
  bool hasFullScreen (void) const
    { return has ("Full Screen"); }

  int maximizedOption (void) const
    { return getBooleanOption ("Maximized"); }
  void setMaximizedOption (int maximized)
    { setBooleanOption ("Maximized", maximized); }

  int maintainAspectOption (void) const
    { return getBooleanOption ("Maintain Aspect"); }
  void setMaintainAspectOption (int value)
    { return setBooleanOption ("Maintain Aspect", value); }

  // Subtitle properties

  void setSubtitlePositionValue (int value)
    { return set ("Subtitle Position", limit (value, 0, 100)); }
  TQString subtitlePositionString (void) const
    { return asString ("Subtitle Position"); }
  bool hasSubtitlePosition (void) const
    { return has ("Subtitle Position"); }
  void resetSubtitlePosition (void)
    { reset ("Subtitle Position"); }

  void setSubtitleDelayValue (float value)
    { return set ("Subtitle Delay", value); }
  TQString subtitleDelayString (void) const
    { return asString ("Subtitle Delay"); }
  bool hasSubtitleDelay (void) const
    { return has ("Subtitle Delay"); }
  void resetSubtitleDelay (void)
    { reset ("Subtitle Delay"); }

  int subtitleClosedCaptionOption (void) const
    { return getBooleanOption ("Closed Caption"); }
  void setSubtitleClosedCaptionOption (int value)
    { return setBooleanOption ("Closed Caption", value); }

  // Audio properties

  int volumeOption (void) const
    { return getRelativeOption ("Volume"); }
  void setVolumeOption (int volume, int option)
    { setRelativeOption ("Volume", volume, option); }
  TQString volumeString (void) const
    { return asIntegerString ("Volume"); }
  void resetVolume (void)
    { reset ("Volume"); }

  void setAudioDelayValue (float value)
    { return set ("Audio Delay", value); }
  TQString audioDelayString (void) const
    { return asString ("Audio Delay"); }
  bool hasAudioDelay (void) const
    { return has ("Audio Delay"); }
  void resetAudioDelay (void)
    { reset ("Audio Delay"); }

  const TQString& audioCodecValue (void) const
    { return getString ("Audio Codec"); }
  const TQString& audioCodecOption (void) const
    { return getStringOption ("Audio Codec"); }
  void setAudioCodecOption (const TQString& codec)
    { setStringOption ("Audio Codec", codec); }

  TQString audioDriverString (void) const;
  TQString mixerChannelString (void) const;
  TQString audioCodecString (void) const;

  int audioMode (void) const
    { return getInteger ("Audio Mode"); }
  TQString audioModeString (void) const
    { return asString ("Audio Mode"); }
  bool hasAudioMode (void) const
    { return has ("Audio Mode"); }

  int audioInput (void) const
    { return getInteger ("Audio Input"); }
  TQString audioInputString (void) const
    { return asString ("Audio Input"); }
  bool hasAudioInput (void) const
    { return has ("Audio Input"); }

  bool immediateMode (void) const
    { return getBoolean ("Immediate Mode"); }
  bool alsaCapture (void) const
    { return getBoolean ("ALSA Capture"); }

  const TQString& captureDevice (void) const
    { return getString ("Capture Device"); }
  bool hasCaptureDevice (void) const
    { return has ("Capture Device"); }

  // Video properties

  int contrastOption (void) const
    { return getRelativeOption ("Contrast"); }
  void setContrastOption (int contrast, int option)
    { setRelativeOption ("Contrast", contrast, option); }
  TQString contrastString (void) const
    { return asIntegerString ("Contrast"); }
  void resetContrast (void)
    { reset ("Contrast"); }

  int brightnessOption (void) const
    { return getRelativeOption ("Brightness"); }
  void setBrightnessOption (int brightness, int option)
    { setRelativeOption ("Brightness", brightness, option); }
  TQString brightnessString (void) const
    { return asIntegerString ("Brightness"); }
  void resetBrightness (void)
    { reset ("Brightness"); }

  int hueOption (void) const
    { return getRelativeOption ("Hue"); }
  void setHueOption (int hue, int option)
    { setRelativeOption ("Hue", hue, option); }
  TQString hueString (void) const
    { return asIntegerString ("Hue"); }
  void resetHue (void)
    { reset ("Hue"); }

  int saturationOption (void) const
    { return getRelativeOption ("Saturation"); }
  void setSaturationOption (int saturation, int option)
    { setRelativeOption ("Saturation", saturation, option); }
  TQString saturationString (void) const
    { return asIntegerString ("Saturation"); }
  void resetSaturation (void)
    { reset ("Saturation"); }

  const TQString& videoCodecValue (void) const
    { return getString ("Video Codec"); }
  const TQString& videoCodecOption (void) const
    { return getStringOption ("Video Codec"); }
  void setVideoCodecOption (const TQString& codec)
    { setStringOption ("Video Codec", codec); }

  TQString videoDriverString (void) const;
  TQString videoCodecString (void) const;

  int videoInput (void) const
    { return getInteger ("Video Input"); }
  TQString videoInputString (void) const
    { return asString ("Video Input"); }
  bool hasVideoInput (void) const
    { return has ("Video Input"); }

  const TQString& videoFormat (void) const
    { return getString ("Video Format"); }
  bool hasVideoFormat (void) const
    { return has ("Video Format"); }

  int videoNorm (void) const
    { return getInteger ("Video Norm"); }
  TQString videoNormString (void) const
    { return asString ("Video Norm"); }
  bool hasVideoNorm (void) const
    { return has ("Video Norm"); }

  // Advanced properties

  bool hasExecutablePath (void) const
    { return has ("Executable Path"); }

  int commandLineOption (void) const
    { return getAppendableOption ("Command Line"); }
  const TQString& commandLineValue (void) const
    { return getStringValue ("Command Line"); }
  void setCommandLineOption (const TQString& value, int option)
    { return setAppendable ("Command Line", value, option); }
  bool hasCommandLine (void) const
    { return has ("Command Line"); }

  const TQString& demuxerValue (void) const
    { return getString ("Demuxer"); }
  const TQString& demuxerOption (void) const
    { return getStringOption ("Demuxer"); }
  void setDemuxerOption (const TQString& codec)
    { setStringOption ("Demuxer", codec); }
  TQString demuxerString (void) const;

  int frameDropOption (void) const
    { return getIntegerOption ("Frame Dropping"); }
  void setFrameDropOption (int frame_drop)
    { setIntegerOption ("Frame Dropping", frame_drop); }

  int cacheOption (void) const
    { return getCacheOption ("Cache"); }
  TQString cacheSizeString (void) const
    { return asString ("Cache"); }

  int buildNewIndexOption (void) const
    { return getIntegerOption ("Build New Index"); }
  void setBuildNewIndexOption (int build)
    { setIntegerOption ("Build New Index", build); }

  int osdLevelOption (void) const
    { return getIntegerOption ("OSD Level"); }
  void setOsdLevelOption (int level)
    { setIntegerOption ("OSD Level", level); }

  int mjpegDecimation (void) const
    { return getInteger ("Decimation"); }
  TQString mjpegDecimationString (void) const
    { return asString ("Decimation"); }
  bool hasMjpegDecimation (void) const
    { return has ("Decimation"); }

  int mjpegQuality (void) const
    { return getInteger ("Compression"); }
  TQString mjpegQualityString (void) const
    { return asString ("Compression"); }
  bool hasMjpegQuality (void) const
    { return has ("Compression"); }
};

/** The KPlayer device properties.
  * @author kiriuja
  */
class KPlayerDeviceProperties : public KPlayerMediaProperties
{
  TQ_OBJECT

public:
  /** Constructor. */
  KPlayerDeviceProperties (KPlayerProperties* parent, const KURL& url);
  /** Destructor. */
  virtual ~KPlayerDeviceProperties();

  /** Initializes property information. */
  virtual void setupInfo (void);

  int digits (void) const
    { return m_digits; }

protected:
  /** Number of digits in track or channel names. */
  int m_digits;
};

/** The KPlayer tuner device properties.
  * @author kiriuja
  */
class KPlayerTunerProperties : public KPlayerDeviceProperties
{
  TQ_OBJECT

public:
  /** Constructor. */
  KPlayerTunerProperties (KPlayerProperties* parent, const KURL& url);
  /** Destructor. */
  virtual ~KPlayerTunerProperties();

  /** Returns the list of channels. */
  virtual TQStringList channels (void) = 0;
  /** Returns the frequency of the given channel. */
  int channelFrequency (const TQString& id) const;

  void setVideoInput (int input)
    { setInteger ("Video Input", input); }
  void resetVideoInput (void)
    { reset ("Video Input"); }

  void setAudioInput (int input)
    { setInteger ("Audio Input", input); }
  void resetAudioInput (void)
    { reset ("Audio Input"); }

  void setChannelList (const TQString& list)
    { setString ("Channel List", list); }

protected:
  /** Default frequencies. */
  TQMap<TQString, int> m_frequencies;
};

struct KPlayerChannelGroup
{
  /** Number of the first channel. */
  int first_channel;
  /** Number of channels. */
  uint channels;
  /** Number of digits. */
  uint digits;
  /** Name prefix. */
  const char* prefix;
  /** Frequency of the first channel. */
  int first_freq;
  /** Frequency step. */
  int freq_step;
};

struct KPlayerChannelList
{
  /** List ID. */
  const char* id;
  /** List name. */
  const char* name;
  /** Channel groups. */
  struct KPlayerChannelGroup* groups;
  /** Group count. */
  uint groupcount;
};

extern struct KPlayerChannelList channellists[];
extern const uint channellistcount;

/** The KPlayer TV device properties.
  * @author kiriuja
  */
class KPlayerTVProperties : public KPlayerTunerProperties
{
  TQ_OBJECT

public:
  /** Constructor. */
  KPlayerTVProperties (KPlayerProperties* parent, const KURL& url);
  /** Destructor. */
  virtual ~KPlayerTVProperties();

  /** Initializes meta properties. */
  virtual void setupMeta (void);

  /** Returns the list of TV channels. */
  virtual TQStringList channels (void);

  void setInputDriver (const TQString& driver)
    { setString ("Input Driver", driver); }

  void setVideoFormat (const TQString& format)
    { setString ("Video Format", format); }

  void setVideoNorm (int norm)
    { setInteger ("Video Norm", norm); }

  int audioModeOption (void) const
    { return getIntegerOption ("Audio Mode"); }
  void setAudioModeOption (int mode)
    { setIntegerOption ("Audio Mode", mode); }

  void setImmediateMode (bool enable)
    { setBoolean ("Immediate Mode", enable); }

  void setAlsaCapture (bool alsa)
    { setBoolean ("ALSA Capture", alsa); }

  void setCaptureDevice (const TQString& device)
    { setString ("Capture Device", device); }

  void setMjpegDecimation (int decimation)
    { setInteger ("Decimation", decimation); }

  void setMjpegQuality (int quality)
    { setInteger ("Compression", quality); }

  /** Returns a channel list based on the KDE country setting. */
  static TQString channelListFromCountry (void);
};

/** The KPlayer DVB device properties.
  * @author kiriuja
  */
class KPlayerDVBProperties : public KPlayerTunerProperties
{
  TQ_OBJECT

public:
  /** Constructor. */
  KPlayerDVBProperties (KPlayerProperties* parent, const KURL& url);
  /** Destructor. */
  virtual ~KPlayerDVBProperties();

  /** Initializes meta properties. */
  virtual void setupMeta (void);

  /** Returns the list of DVB channels. */
  TQStringList channels (void);
  /** Returns the name of the given channel. */
  const TQString& channelName (const TQString& id) const
    { return m_names [id]; }

protected:
  /** Default names. */
  TQMap<TQString, TQString> m_names;
};

/** The KPlayer disk properties.
  * @author kiriuja
  */
class KPlayerDiskProperties : public KPlayerDeviceProperties
{
  TQ_OBJECT

public:
  /** Constructor. */
  KPlayerDiskProperties (KPlayerProperties* parent, const KURL& url);
  /** Destructor. */
  virtual ~KPlayerDiskProperties();

  /** Initializes property information. */
  virtual void setupInfo (void);
  /** Initializes meta properties. */
  virtual void setupMeta (void);

  /** Returns the config storage. */
  virtual TDEConfig* config (void) const;

  int tracks (void) const
    { return getInteger ("Tracks"); }
  void setTracks (int tracks)
  {
    setInteger ("Tracks", tracks);
    setupMeta();
  }
  bool hasTracks (void) const
    { return has ("Tracks"); }
};

/** The KPlayer track properties.
  * @author kiriuja
  */
class KPlayerTrackProperties : public KPlayerMediaProperties
{
  TQ_OBJECT

public:
  /** Constructor. */
  KPlayerTrackProperties (KPlayerProperties* parent, const KURL& url);
  /** Destructor. */
  virtual ~KPlayerTrackProperties();

  /** Initializes meta properties. */
  virtual void setupMeta (void);

  /** Returns the config storage. */
  virtual TDEConfig* config (void) const;

  /** Returns device option. */
  virtual TQString deviceOption (void) const;
  /** Returns device setting. */
  virtual TQString deviceSetting (void) const;
  /** Returns URL string. */
  virtual TQString urlString (void) const = 0;

  /** Returns the display size based on the option and the original size. */
  virtual TQSize getDisplaySize (const TQString& key) const;
  /** Sets the display size and option. */
  virtual void setDisplaySize (const TQSize& size, int option);

  /** Returns track ID option. */
  int getTrackOption (const TQString& key) const;
  /** Sets track ID option. */
  void setTrackOption (const TQString& key, int value);

  /** Imports the given value under the given key. */
  void importMeta (TQString key, TQString value);
  /** Extracts meta information from the given string and stores it in the properties,
      updating it if the update flag is set. */
  void extractMeta (const TQString& str, bool update);

  TQString extension (void) const;

  float length (void) const
    { return getFloat ("Length"); }
  void setLength (float length)
    { setFloat ("Length", length); }
  bool hasLength (void) const
    { return has ("Length"); }
  /** Time length as string. */
  TQString lengthString (void) const
    { return asString ("Length"); }

  int normalSeek (void) const;
  int fastSeek (void) const;

  int track (void) const
    { return getInteger ("Track"); }
  void setTrack (int track)
    { setInteger ("Track", track); }
  bool hasTrack (void) const
    { return has ("Track"); }

  const TQSize& resolution (void) const
    { return getSize ("Resolution"); }
  void setResolution (const TQSize& size)
    { setSize ("Resolution", size); }
  bool hasResolution (void) const
    { return has ("Resolution"); }
  /** Resolution size as string. */
  TQString resolutionString (void) const
    { return asString ("Resolution"); }
  /** Resolution width as string. */
  TQString resolutionWidthString (void) const
  {
    const TQSize& size (resolution());
    return size.isEmpty() ? TQString::null : TQString::number (size.width());
  }
  /** Resolution height as string. */
  TQString resolutionHeightString (void) const
  {
    const TQSize& size (resolution());
    return size.isEmpty() ? TQString::null : TQString::number (size.height());
  }

  const TQSize& originalSize (void) const
    { return getSize ("Video Size"); }
  void setOriginalSize (const TQSize& size)
    { setSize ("Video Size", size); }
  bool hasOriginalSize (void) const
    { return has ("Video Size"); }
  /** Original size as string. */
  TQString originalSizeString (void) const
    { return asString ("Video Size"); }
  /** Original width as string. */
  TQString originalWidthString (void) const
  {
    const TQSize& size (originalSize());
    return size.isEmpty() ? TQString::null : TQString::number (size.width());
  }
  /** Original height as string. */
  TQString originalHeightString (void) const
  {
    const TQSize& size (originalSize());
    return size.isEmpty() ? TQString::null : TQString::number (size.height());
  }

  const TQSize& currentResolution (void) const
    { return hasCurrentResolution() ? getSize ("Current Resolution") : resolution(); }
  void setCurrentResolution (const TQSize& size)
    { setSize ("Current Resolution", size); }
  void resetCurrentResolution (void)
    { reset ("Current Resolution"); }
  bool hasCurrentResolution (void) const
    { return has ("Current Resolution"); }

  const TQSize& currentSize (void) const
    { return hasCurrentSize() ? getSize ("Current Size") : originalSize(); }
  void setCurrentSize (const TQSize& size)
    { setSize ("Current Size", size); }
  void resetCurrentSize (void)
    { reset ("Current Size"); }
  bool hasCurrentSize (void) const
    { return has ("Current Size"); }
  /** Current size as string. */
  TQString currentSizeString (void) const
    { return asString ("Current Size"); }
  /** Current width as string. */
  TQString currentWidthString (void) const
  {
    const TQSize& size (currentSize());
    return size.isEmpty() ? TQString::null : TQString::number (size.width());
  }
  /** Current height as string. */
  TQString currentHeightString (void) const
  {
    const TQSize& size (currentSize());
    return size.isEmpty() ? TQString::null : TQString::number (size.height());
  }

  TQSize originalAspect (void) const
    { return hasDisplaySize() ? displaySize() : originalSize(); }
  TQSize currentAspect (void) const
    { return hasDisplaySize() ? displaySize() : currentSize(); }

  bool hasVideo (void) const
    { return hasOriginalSize() || hasDisplaySize(); }
  bool hasNoVideo (void) const
    { return ! hasOriginalSize() && ! getBoolean ("Has Video"); }
  void setHasVideo (bool value)
    { return setBoolean ("Has Video", value); }

  /** Returns whether the original video size is known. */
  bool originalSizeKnown (void) const
    { return hasVideo() || hasNoVideo(); }

  /** Returns whether the video area needs to be expanded to accomodate subtitles. */
  bool needsExpanding (void) const;
  /** Expands the video area to accomodate subtitles. */
  void autoexpand (void);

  bool hasDemuxer (void) const
    { return hasComboValue ("Demuxer"); }
  bool hasDemuxerOption (void) const
    { return hasComboString ("Demuxer"); }

  /* bool autoexpanded (void) const
    { return getBoolean ("Autoexpanded"); }
  void setAutoexpanded (bool autoexpanded)
    { setBoolean ("Autoexpanded", autoexpanded); } */

  const KURL& subtitleUrl (void) const
    { return getUrl ("Subtitle URL"); }
  void setSubtitleUrl (const KURL& url)
    { setUrl ("Subtitle URL", url); }
  void setSubtitleUrl (const TQString& url)
    { setSubtitleUrl (KURL::fromPathOrURL (url)); }
  bool hasSubtitleUrl (void) const
    { return has ("Subtitle URL"); }
  TQString subtitleUrlString (void) const
  {
    const KURL& u (subtitleUrl());
    return u.isLocalFile() ? u.path() : u.url();
  }
  TQString subtitlePath (void) const
    { return asString ("Subtitle URL"); }
  void resetSubtitleUrl (void)
    { reset ("Subtitle URL"); }

  void showSubtitleUrl (const KURL& url);

  bool showSubtitles (void) const
    { return getBoolean ("Subtitle Visibility"); }
  void setShowSubtitles (bool show)
    { return setBoolean ("Subtitle Visibility", show); }

  bool showInternalSubtitles (void) const
    { return hasSubtitleID() || hasVobsubID(); }
  bool showExternalSubtitles (void) const
    { return hasSubtitleUrl() && showSubtitles() && ! showInternalSubtitles(); }

  bool vobsubSubtitles (void) const
    { return getVobsubSubtitles ("Vobsub", subtitleUrl()); }
  int vobsubSubtitlesOption (void) const
    { return getBooleanOption ("Vobsub"); }
  void setVobsubSubtitlesOption (int vobsub)
    { setBooleanOption ("Vobsub", vobsub); }

  int subtitleIndex (void) const;
  int subtitleOption (void) const;
  void setSubtitleOption (int option);

  int subtitleID (void) const
    { return getInteger ("Subtitle ID"); }
  void setSubtitleID (int id)
    { setInteger ("Subtitle ID", id); }
  TQString subtitleIDString (void) const
    { return asString ("Subtitle ID"); }
  bool hasSubtitleID (void) const
    { return has ("Subtitle ID"); }
  void resetSubtitleID (void)
    { reset ("Subtitle ID"); }

  const TQMap<int, TQString>& subtitleIDs (void) const
    { return getIntegerStringMap ("Subtitle IDs"); }
  void addSubtitleID (int sid)
    { setIntegerStringMapKey ("Subtitle IDs", sid); }
  void setSubtitleLanguage (int sid, const TQString& slang)
    { setIntegerStringMapKeyValue ("Subtitle IDs", sid, slang); }
  bool hasSubtitleIDs (void) const
    { return has ("Subtitle IDs"); }
  bool hasSubtitleID (int sid) const
    { return hasIntegerStringMapKey ("Subtitle IDs", sid); }
  bool hasSubtitleLanguage (int sid) const
    { return hasIntegerStringMapValue ("Subtitle IDs", sid); }

  int vobsubID (void) const
    { return getInteger ("Vobsub ID"); }
  void setVobsubID (int id)
    { setInteger ("Vobsub ID", id); }
  TQString vobsubIDString (void) const
    { return asString ("Vobsub ID"); }
  bool hasVobsubID (void) const
    { return has ("Vobsub ID"); }
  void resetVobsubID (void)
    { reset ("Vobsub ID"); }

  const TQMap<int, TQString>& vobsubIDs (void) const
    { return getIntegerStringMap ("Vobsub IDs"); }
  void addVobsubID (int sid)
    { setIntegerStringMapKey ("Vobsub IDs", sid); }
  void setVobsubLanguage (int sid, const TQString& slang)
    { setIntegerStringMapKeyValue ("Vobsub IDs", sid, slang); }
  bool hasVobsubIDs (void) const
    { return has ("Vobsub IDs"); }
  bool hasVobsubID (int sid) const
    { return hasIntegerStringMapKey ("Vobsub IDs", sid); }
  bool hasVobsubLanguage (int sid) const
    { return hasIntegerStringMapValue ("Vobsub IDs", sid); }
  void resetVobsubIDs (void)
    { return reset ("Vobsub IDs"); }

  float subtitleFramerate (void) const
    { return getFloat ("Subtitle Framerate"); }
  void setSubtitleFramerate (float framerate)
    { setFloat ("Subtitle Framerate", framerate); }
  bool hasSubtitleFramerate (void) const
    { return has ("Subtitle Framerate"); }
  TQString subtitleFramerateString (void) const
    { return asString ("Subtitle Framerate"); }
  void resetSubtitleFramerate (void)
    { reset ("Subtitle Framerate"); }

  int audioBitrate (void) const
    { return getInteger ("Audio Bitrate"); }
  void setAudioBitrate (int bitrate)
    { setInteger ("Audio Bitrate", bitrate); }
  bool hasAudioBitrate (void) const
    { return has ("Audio Bitrate"); }
  TQString audioBitrateString (void) const
    { return asString ("Audio Bitrate"); }

  int samplerate (void) const
    { return getInteger ("Samplerate"); }
  void setSamplerate (int samplerate)
    { setInteger ("Samplerate", samplerate); }
  bool hasSamplerate (void) const
    { return has ("Samplerate"); }
  /** Samplerate as string. */
  TQString samplerateString (void) const
    { return asString ("Samplerate"); }

  int channels (void) const
    { return getInteger ("Channels"); }
  void setChannels (int channels)
    { setInteger ("Channels", channels); }
  bool hasChannels (void) const
    { return has ("Channels"); }
  /** Channels as string. */
  TQString channelsString (void) const
    { return asString ("Channels"); }

  bool hasAudioCodec (void) const
    { return hasComboValue ("Audio Codec"); }
  bool hasAudioCodecOption (void) const
    { return hasComboString ("Audio Codec"); }

  int audioID (void) const
    { return getInteger ("Audio ID"); }
  void setAudioID (int id)
    { setInteger ("Audio ID", id); }
  int audioIDOption (void) const
    { return getTrackOption ("Audio ID"); }
  void setAudioIDOption (int option)
    { setTrackOption ("Audio ID", option); }
  TQString audioIDString (void) const
    { return asString ("Audio ID"); }
  bool hasAudioID (void) const
    { return has ("Audio ID"); }

  const TQMap<int, TQString>& audioIDs (void) const
    { return getIntegerStringMap ("Audio IDs"); }
  void addAudioID (int aid)
    { setIntegerStringMapKey ("Audio IDs", aid); }
  void setAudioLanguage (int aid, const TQString& alang)
    { setIntegerStringMapKeyValue ("Audio IDs", aid, alang); }
  bool hasAudioID (int aid) const
    { return hasIntegerStringMapKey ("Audio IDs", aid); }
  bool hasAudioLanguage (int aid) const
    { return hasIntegerStringMapValue ("Audio IDs", aid); }

  int videoBitrate (void) const
    { return getInteger ("Video Bitrate"); }
  void setVideoBitrate (int bitrate)
    { setInteger ("Video Bitrate", bitrate); }
  bool hasVideoBitrate (void) const
    { return has ("Video Bitrate"); }
  TQString videoBitrateString (void) const
    { return asString ("Video Bitrate"); }

  float framerate (void) const
    { return getFloat ("Framerate"); }
  void setFramerate (float framerate)
    { setFloat ("Framerate", framerate); }
  bool hasFramerate (void) const
    { return has ("Framerate"); }
  /** Framerate as string. */
  TQString framerateString (void) const
    { return asString ("Framerate"); }

  bool hasVideoCodec (void) const
    { return hasComboValue ("Video Codec"); }
  bool hasVideoCodecOption (void) const
    { return hasComboString ("Video Codec"); }

  int videoID (void) const
    { return getInteger ("Video ID"); }
  void setVideoID (int id)
    { setInteger ("Video ID", id); }
  int videoIDOption (void) const
    { return getTrackOption ("Video ID"); }
  void setVideoIDOption (int option)
    { setTrackOption ("Video ID", option); }
  TQString videoIDString (void) const
    { return asString ("Video ID"); }
  bool hasVideoID (void) const
    { return has ("Video ID"); }

  const TQMap<int, TQString>& videoIDs (void) const
    { return getIntegerStringMap ("Video IDs"); }
  void addVideoID (int vid)
    { setIntegerStringMapKey ("Video IDs", vid); }
  bool hasVideoID (int vid) const
    { return hasIntegerStringMapKey ("Video IDs", vid); }

  bool playlist (void) const
    { return getPlaylist ("Playlist", url()); }
  int playlistOption (void) const
    { return getBooleanOption ("Playlist"); }
  void setPlaylistOption (int playlist)
    { setBooleanOption ("Playlist", playlist); }

  bool useKioslave (void) const
    { return getUseKioslave ("Use KIOSlave", url()); }
  int useKioslaveOption (void) const
    { return getIntegerOption ("Use KIOSlave"); }
  void setUseKioslaveOption (int use)
    { setIntegerOption ("Use KIOSlave", use); }

  int useTemporaryFileOption (void) const
    { return getBooleanOption ("Use Temporary File For KIOSlave"); }
  void setUseTemporaryFileOption (int value)
    { return setBooleanOption ("Use Temporary File For KIOSlave", value); }

  /** Returns whether the height has been adjusted to aspect. */
  bool heightAdjusted (void) const
    { return m_height_adjusted; }

protected:
  /** Flag indicating whether the height has been adjusted to aspect. */
  bool m_height_adjusted;
};

/** The KPlayer disk track properties.
  * @author kiriuja
  */
class KPlayerDiskTrackProperties : public KPlayerTrackProperties
{
  TQ_OBJECT

public:
  /** Constructor. */
  KPlayerDiskTrackProperties (KPlayerProperties* parent, const KURL& url);
  /** Destructor. */
  virtual ~KPlayerDiskTrackProperties();

  /** Initializes property information. */
  virtual void setupInfo (void);

  /** Parent properties. */
  KPlayerDiskProperties* parent (void) const
    { return (KPlayerDiskProperties*) m_parent; }

  /** Returns icon name. */
  virtual TQString icon (void) const;

  /** Returns device option. */
  virtual TQString deviceOption (void) const;
  /** Returns device setting. */
  virtual TQString deviceSetting (void) const;
  /** Returns URL string. */
  virtual TQString urlString (void) const;
};

/** The KPlayer channel properties.
  * @author kiriuja
  */
class KPlayerChannelProperties : public KPlayerTrackProperties
{
  TQ_OBJECT

public:
  /** Constructor. */
  KPlayerChannelProperties (KPlayerProperties* parent, const KURL& url);
  /** Destructor. */
  virtual ~KPlayerChannelProperties();

  /** Parent properties. */
  KPlayerDeviceProperties* parent (void) const
    { return (KPlayerDeviceProperties*) m_parent; }

  /** Returns icon name. */
  virtual TQString icon (void) const;

  /** Returns whether this media needs frequency. */
  virtual bool needsFrequency (void) const;
  /** Returns whether the frequency can be changed. */
  virtual bool canChangeFrequency (void) const = 0;

  /** Returns the channel frequency. */
  int frequency (void) const;
  /** Sets the channel frequency. */
  void setFrequency (int frequency);
  /** Frequency as string. */
  TQString frequencyString (void) const
    { return asString ("Frequency"); }

  /** Returns the default frequency. */
  int defaultFrequency (void) const
    { return m_default_frequency; }
  /** Sets the default frequency. */
  void setDefaultFrequency (int frequency)
    { m_default_frequency = frequency; }

protected:
  int m_default_frequency;
};

/** The KPlayer TV channel properties.
  * @author kiriuja
  */
class KPlayerTVChannelProperties : public KPlayerChannelProperties
{
  TQ_OBJECT

public:
  /** Constructor. */
  KPlayerTVChannelProperties (KPlayerProperties* parent, const KURL& url);
  /** Destructor. */
  virtual ~KPlayerTVChannelProperties();

  /** Initializes property information. */
  virtual void setupInfo (void);

  /** Parent properties. */
  KPlayerTVProperties* parent (void) const
    { return (KPlayerTVProperties*) m_parent; }

  /** Returns whether the frequency can be changed. */
  virtual bool canChangeFrequency (void) const;

  /** Returns device option. */
  virtual TQString deviceOption (void) const;
  /** Returns device setting. */
  virtual TQString deviceSetting (void) const;
  /** Returns URL string. */
  virtual TQString urlString (void) const;
};

/** The KPlayer DVB channel properties.
  * @author kiriuja
  */
class KPlayerDVBChannelProperties : public KPlayerChannelProperties
{
  TQ_OBJECT

public:
  /** Constructor. */
  KPlayerDVBChannelProperties (KPlayerProperties* parent, const KURL& url);
  /** Destructor. */
  virtual ~KPlayerDVBChannelProperties();

  /** Parent properties. */
  KPlayerDVBProperties* parent (void) const
    { return (KPlayerDVBProperties*) m_parent; }

  /** Initializes property information. */
  virtual void setupInfo (void);

  /** Returns whether the frequency can be changed. */
  virtual bool canChangeFrequency (void) const;

  /** Returns device option. */
  virtual TQString deviceOption (void) const;
  /** Returns device setting. */
  virtual TQString deviceSetting (void) const;
  /** Returns URL string. */
  virtual TQString urlString (void) const;
};

inline int KPlayerFrequencyProperty::value (void) const
{
  return m_value ? m_value : m_properties -> defaultFrequency();
}

inline void KPlayerFrequencyProperty::setValue (int value)
{
  m_value = value == m_properties -> defaultFrequency() ? 0 : value;
}

/** The KPlayer item properties.
  * @author kiriuja
  */
class KPlayerItemProperties : public KPlayerTrackProperties
{
  TQ_OBJECT

public:
  /** Constructor. */
  KPlayerItemProperties (KPlayerProperties* parent, const KURL& url);
  /** Destructor. */
  virtual ~KPlayerItemProperties();

  /** Initializes property information. */
  virtual void setupInfo (void);
  /** Initializes meta properties. */
  virtual void setupMeta (void);

  virtual bool autoloadSubtitles (const TQString& key) const;
  virtual bool getVobsubSubtitles (const TQString& key, const KURL& url) const;
  virtual bool getPlaylist (const TQString& key, const KURL& url) const;
  virtual bool getUseKioslave (const TQString& key, const KURL& url) const;

  /** Returns URL string. */
  virtual TQString urlString (void) const;

  int subtitleAutoloadOption (void) const
    { return getBooleanOption ("Autoload Subtitles"); }
  void setSubtitleAutoloadOption (int value)
    { return setBooleanOption ("Autoload Subtitles", value); }

  /** Resets the meta info timer. */
  static void resetMetaInfoTimer (void)
    { m_meta_info_timer = 0; }

protected:
  /** Timer that prevents wasting too much time on getting meta information. */
  static int m_meta_info_timer;
};

#ifdef DEBUG
kdbgstream kdDebugTime (void);
#endif

#endif