Thumbs up/down icons in selectremotedlg
authorTorste Aikio <zokier@zokier.laptop>
Thu, 8 Jul 2010 08:43:11 +0000 (11:43 +0300)
committerTorste Aikio <zokier@zokier.laptop>
Thu, 8 Jul 2010 08:43:11 +0000 (11:43 +0300)
data/symbols/symbol_thumbs_down.svg [new file with mode: 0644]
data/symbols/symbol_thumbs_up.svg [new file with mode: 0644]
src/remotelistwidgetitem.cpp
src/remotetable.cpp [new file with mode: 0644]
src/remotetable.h [new file with mode: 0644]
src/selectremotedlg.cpp
src/selectremotedlg.h
src/src.pro

diff --git a/data/symbols/symbol_thumbs_down.svg b/data/symbols/symbol_thumbs_down.svg
new file mode 100644 (file)
index 0000000..7c376dd
--- /dev/null
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Creator: CorelDRAW -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   xml:space="preserve"
+   width="48"
+   height="48"
+   style="fill-rule:evenodd"
+   viewBox="0 0 11027.027 11000"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.47 r22583"
+   sodipodi:docname="symbol_thumbs_down.svg"><metadata
+   id="metadata13"><rdf:RDF><cc:Work
+       rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+         rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><sodipodi:namedview
+   pagecolor="#ffffff"
+   bordercolor="#666666"
+   borderopacity="1"
+   objecttolerance="10"
+   gridtolerance="10"
+   guidetolerance="10"
+   inkscape:pageopacity="0"
+   inkscape:pageshadow="2"
+   inkscape:window-width="1400"
+   inkscape:window-height="975"
+   id="namedview11"
+   showgrid="false"
+   inkscape:zoom="4.9166667"
+   inkscape:cx="18.5"
+   inkscape:cy="24"
+   inkscape:window-x="0"
+   inkscape:window-y="24"
+   inkscape:window-maximized="1"
+   inkscape:current-layer="svg2" />
+ <defs
+   id="defs4"><inkscape:perspective
+   sodipodi:type="inkscape:persp3d"
+   inkscape:vp_x="0 : 24 : 1"
+   inkscape:vp_y="0 : 1000 : 0"
+   inkscape:vp_z="37 : 24 : 1"
+   inkscape:persp3d-origin="18.5 : 16 : 1"
+   id="perspective15" />
+  <style
+   type="text/css"
+   id="style6">
+   
+    .str0 {stroke:#000000;stroke-width:3}
+    .fil0 {fill:#000000}
+   
+  </style>
+ </defs>
+ <g
+   id="Layer 1"
+   transform="translate(1121.3926,0)">
+  <path
+   class="fil0 str0"
+   d="m 824,2025 1133,0 C 2477,1427 3042,989 3649,711 c 191,-15 334,-23 425,-23 259,0 552,47 881,137 l 272,-137 326,0 c 744,0 1117,267 1117,798 0,31 -5,75 -15,138 546,44 821,305 821,780 0,51 -5,121 -16,212 203,57 355,148 459,275 104,124 156,285 156,477 0,155 -55,323 -166,500 272,292 409,619 409,979 0,415 -225,749 -676,1003 -451,251 -1047,378 -1791,378 l -189,0 c 60,456 200,897 417,1322 l 122,212 c 262,501 394,889 394,1161 0,754 -396,1226 -1192,1413 l -220,54 L 4802,8703 3397,7208 c -96,-112 -261,-327 -500,-645 l -212,-280 c -228,-309 -389,-498 -482,-565 -94,-70 -244,-104 -451,-104 l -889,0 C 591,5034 454,4435 454,3824 454,3228 578,2626 824,2025 z m 252,394 c -159,461 -236,902 -236,1322 0,495 85,982 259,1464 637,0 1036,39 1197,114 163,75 407,342 731,795 129,179 326,431 583,752 l 1526,1625 303,1404 c 508,-171 762,-495 762,-972 0,-246 -85,-515 -259,-803 l -98,-168 C 5447,7293 5250,6666 5250,6068 l -8,-213 275,0 c 803,0 1410,-80 1814,-238 407,-161 609,-402 609,-726 0,-293 -106,-541 -316,-743 -210,-203 -467,-304 -770,-304 l -464,-5 -1376,620 c 208,313 487,471 837,471 91,0 208,-21 348,-59 142,-42 308,-104 502,-184 l 358,-16 357,381 -616,8 c -179,75 -340,132 -487,166 -146,36 -280,54 -402,54 -648,0 -1122,-329 -1420,-987 l 259,-122 c -319,-156 -565,-430 -736,-819 l 295,-127 c -233,-148 -448,-399 -645,-754 l 469,-218 c -256,-189 -464,-453 -622,-798 l 933,-417 c -150,-31 -280,-47 -386,-47 l -295,8 c -674,389 -1221,863 -1641,1420 l -1046,0 z m 3461,1101 c 177,236 389,387 638,454 l 1132,-508 402,0 c 381,0 669,54 865,161 65,-91 99,-179 99,-259 0,-156 -78,-273 -231,-353 -155,-78 -386,-116 -694,-116 l -806,0 -1405,621 z m -318,-888 c 23,31 44,57 59,75 122,142 267,254 433,334 l 1164,-516 1228,8 23,-98 c 0,-298 -295,-449 -889,-449 l -570,0 -1448,646 z M 4058,1608 c 36,44 62,80 83,106 96,138 218,259 365,371 l 1086,-485 700,0 0,-46 c 0,-340 -246,-508 -739,-508 l -248,0 -1247,562 z"
+   id="path9"
+   style="fill:#000000;stroke:#000000;stroke-width:3" />
+ </g>
+<path
+   style="fill:#ff0000"
+   d="m 6565.4754,9763.8033 c -11.8518,-34.7893 -80.5265,-338.9634 -152.6125,-675.9423 L 6281.7977,8475.1718 5503.0252,7639.3956 C 5074.7003,7179.7185 4520.5316,6540.7924 4271.5392,6219.5602 3510.223,5237.3642 3513.3939,5239.4743 2742.9716,5202.489 L 2240.5242,5178.3685 2170.3303,4942 C 1977.4775,4292.5945 1959.1067,3361.9909 2127.0634,2750.2518 l 86.5928,-315.3915 510.2673,0 510.2674,0 426.1363,-432.8126 c 234.3751,-238.0469 604.8584,-553.5285 823.2962,-701.0701 383.7351,-259.1898 407.4262,-268.2047 700.8705,-266.6943 l 303.7105,1.5622 -432.2034,192.3533 c -237.7119,105.7943 -432.2034,216.7079 -432.2034,246.4745 0,83.428 246.4651,452.3028 413.9806,619.5889 l 150.2179,150.0123 -200.3309,101.0357 c -110.1821,55.5696 -208.2925,108.1648 -218.0232,116.878 -35.3726,31.6747 286.813,487.6168 438.9745,621.2163 l 156.212,137.156 -136.7539,56.6454 -136.7542,56.6454 126.7802,232.937 c 69.7292,128.1154 220.2904,315.248 334.5807,415.8503 198.0973,174.3722 203.6251,186.0085 118.3864,249.2055 -87.4312,64.8222 -86.9047,71.0823 23.7389,282.2912 147.6799,281.9087 508.7519,603.0254 783.2107,696.5431 299.8689,102.1755 783.7526,94.3654 1143.6789,-18.4588 171.4222,-53.7354 429.0494,-93.1005 611.5837,-93.4495 173.4655,-0.3216 315.3916,-12.8327 315.3916,-27.7826 0,-14.9485 -77.8777,-122.2196 -173.0621,-238.3795 -171.9881,-209.8886 -174.4774,-211.0115 -401.1081,-180.948 -125.4255,16.6371 -336.6565,69.3835 -469.4029,117.2116 -351.3323,126.5845 -565.9387,152.9602 -778.6108,95.6937 -174.9527,-47.11 -514.0505,-292.3444 -514.0505,-371.7599 0,-19.2422 285.4288,-164.2464 634.2863,-322.2325 588.3553,-266.447 658.5625,-287.2286 969.5373,-286.9869 427.6878,0.3216 617.9004,54.624 843.5758,240.7784 220.9201,182.2315 353.7434,459.2626 354.8812,740.1795 2.2744,562.9488 -539.7575,846.0969 -1794.3688,937.3375 -310.2151,22.5618 -635.3261,41.6631 -722.4688,42.4499 l -158.4413,1.4244 26.6725,385.4786 c 43.8736,634.0732 158.3311,960.0465 689.1952,1962.8145 234.4079,442.782 284.458,771.0663 165.1752,1083.4045 -72.82,190.6768 -345.8632,493.1764 -445.1528,493.1764 -22.7019,0 -74.3589,12.6949 -114.7918,28.2099 -41.3555,15.8698 -82.9407,0.5284 -95.0617,-35.0434 l 0,0 z"
+   id="path2844" /><path
+   style="fill:#ff0000"
+   d="m 5412.1986,1838.9687 -198.2366,-215.0613 113.7588,-48.4625 c 62.5673,-26.6544 331.4595,-149.0686 597.5382,-272.0316 406.0156,-187.632 528.4365,-223.5691 761.5966,-223.5691 395.6823,0 693.6988,185.1249 693.6988,430.9188 0,72.5566 -46.5038,83.0529 -367.9643,83.0529 -322.8045,0 -413.1223,20.5858 -735.914,167.7357 -724.2891,330.1791 -638.5659,322.5023 -864.4775,77.4171 l 0,0 z"
+   id="path2846" /><path
+   style="fill:#ff0000"
+   d="m 5697.1808,2918.1744 c -63.54,-42.5602 -162.2953,-119.3088 -219.4562,-170.5525 l -103.9293,-93.1703 707.3071,-320.0567 c 704.0479,-318.5821 709.2216,-320.0568 1122.8629,-320.0568 228.5558,0 509.5164,23.6595 624.3574,52.5768 217.0626,54.657 393.2761,220.8193 393.2761,370.8439 0,77.4458 -44.8143,81.8554 -595.7399,58.6192 l -595.7398,-25.126 -580.3947,262.1522 c -319.2172,144.1838 -593.1346,262.1524 -608.7056,262.1524 -15.5711,0 -80.2982,-34.822 -143.838,-77.3822 z"
+   id="path2848" /><path
+   style="fill:#ff0000"
+   d="m 6072.2629,3838.9989 c -89.945,-47.807 -210.2298,-136.9389 -267.2998,-198.0711 L 5701.2,3529.7783 6418.3222,3215.9427 c 643.9561,-281.8156 747.5033,-313.6261 1014.895,-311.7837 434.9987,2.998 939.9088,69.3453 1095.6049,143.9684 182.294,87.3713 272.0333,276.0938 203.1618,427.2505 -49.3667,108.3483 -59.6995,110.7878 -222.6713,52.5741 -97.8006,-34.9348 -381.9845,-61.9239 -664.386,-63.0976 l -493.484,-2.0446 -511.097,233.254 c -281.1033,128.2896 -532.123,232.4909 -557.8215,231.5584 -25.6987,-0.9419 -120.3161,-40.8101 -210.2612,-88.6168 z"
+   id="path2850" /></svg>
\ No newline at end of file
diff --git a/data/symbols/symbol_thumbs_up.svg b/data/symbols/symbol_thumbs_up.svg
new file mode 100644 (file)
index 0000000..e87c263
--- /dev/null
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Creator: CorelDRAW -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   xml:space="preserve"
+   width="48"
+   height="48"
+   style="fill-rule:evenodd"
+   viewBox="0 0 11027.027 11000"
+   id="svg2821"
+   version="1.1"
+   inkscape:version="0.47 r22583"
+   sodipodi:docname="symbol_thumbs_up.svg"><metadata
+   id="metadata2832"><rdf:RDF><cc:Work
+       rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+         rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><sodipodi:namedview
+   pagecolor="#ffffff"
+   bordercolor="#666666"
+   borderopacity="1"
+   objecttolerance="10"
+   gridtolerance="10"
+   guidetolerance="10"
+   inkscape:pageopacity="0"
+   inkscape:pageshadow="2"
+   inkscape:window-width="920"
+   inkscape:window-height="751"
+   id="namedview2830"
+   showgrid="false"
+   inkscape:zoom="2"
+   inkscape:cx="17.288136"
+   inkscape:cy="18.941757"
+   inkscape:window-x="0"
+   inkscape:window-y="24"
+   inkscape:window-maximized="0"
+   inkscape:current-layer="svg2821" />
+ <defs
+   id="defs2823"><inkscape:perspective
+   sodipodi:type="inkscape:persp3d"
+   inkscape:vp_x="0 : 24 : 1"
+   inkscape:vp_y="0 : 1000 : 0"
+   inkscape:vp_z="37 : 24 : 1"
+   inkscape:persp3d-origin="18.5 : 16 : 1"
+   id="perspective2834" />
+  <style
+   type="text/css"
+   id="style2825">
+   
+    .str0 {stroke:#000000;stroke-width:3}
+    .fil0 {fill:#000000}
+   
+  </style>
+ </defs>
+ <g
+   id="Layer 1"
+   transform="translate(1378.3784,344.59459)">
+  <path
+   class="fil0 str0"
+   d="m 7727,8644 -1133,0 c -520,598 -1085,1036 -1692,1313 -191,16 -334,24 -425,24 -259,0 -552,-47 -881,-138 l -272,138 -326,0 c -744,0 -1117,-267 -1117,-798 0,-31 5,-75 15,-138 -546,-44 -821,-305 -821,-780 0,-51 5,-121 15,-212 C 888,7996 735,7905 632,7778 528,7654 476,7493 476,7301 c 0,-155 55,-324 166,-500 -272,-293 -409,-619 -409,-979 0,-415 225,-749 676,-1003 451,-251 1047,-378 1791,-378 l 189,0 C 2829,3985 2689,3544 2472,3119 L 2350,2907 C 2088,2406 1956,2018 1956,1746 1956,992 2352,520 3148,333 l 220,-54 381,1687 1405,1495 c 96,112 261,327 500,645 l 212,280 c 228,309 389,498 482,565 94,70 244,104 451,104 l 889,0 c 272,580 409,1179 409,1790 0,596 -124,1198 -370,1799 z m -252,-394 c 159,-461 236,-902 236,-1322 0,-495 -85,-982 -259,-1464 -637,0 -1036,-39 -1197,-114 -163,-75 -407,-342 -731,-798 -129,-176 -326,-428 -583,-749 L 3415,2178 3112,771 c -508,174 -762,498 -762,975 0,246 85,515 259,803 l 98,168 c 397,659 594,1286 594,1884 l 8,213 -275,0 c -803,0 -1410,80 -1814,238 -407,161 -609,402 -609,726 0,293 106,541 316,743 210,203 467,304 770,304 l 464,5 1376,-620 c -208,-313 -487,-471 -837,-471 -91,0 -208,21 -348,59 -142,42 -308,104 -502,184 l -358,16 -357,-381 616,-8 c 179,-75 340,-132 487,-166 146,-36 280,-54 402,-54 648,0 1122,329 1420,987 l -259,122 c 319,156 565,430 738,819 l -298,127 c 234,148 449,399 646,751 l -469,221 c 256,189 464,453 622,798 l -933,417 c 150,31 280,47 386,47 l 295,-8 c 674,-389 1221,-863 1641,-1420 l 1046,0 z M 4013,7149 c -176,-236 -388,-389 -637,-454 l -1132,508 -402,0 c -381,0 -669,-54 -866,-161 -64,91 -98,179 -98,259 0,156 78,272 231,353 155,78 386,116 694,116 l 806,0 1404,-621 z m 319,888 c -23,-31 -44,-57 -59,-77 -122,-140 -267,-252 -433,-332 l -1164,516 -1228,-8 -23,98 c 0,298 295,449 889,449 l 570,0 1448,-646 z m 161,1024 c -36,-44 -62,-80 -83,-106 -96,-138 -218,-259 -365,-371 l -1086,485 -700,0 0,46 c 0,340 246,508 739,508 l 248,0 1247,-562 z"
+   id="path2828"
+   style="fill:#000000;stroke:#000000;stroke-width:3" />
+ </g>
+<path
+   style="fill:#00ff00"
+   d="m 5585.5474,9966.3811 c 10.7077,-9.9129 203.4472,-97.5398 428.3097,-194.7286 224.8627,-97.1892 408.841,-195.0479 408.841,-217.4638 0,-95.8715 -200.4451,-421.1366 -368.2018,-597.4854 l -181.5364,-190.8342 193.101,-97.3473 c 106.2054,-53.5408 199.9078,-103.3219 208.2272,-110.624 35.3026,-30.986 -140.8999,-302.17 -340.7978,-524.5047 -215.3774,-239.5514 -215.4459,-239.7379 -108.4575,-295.4308 58.8809,-30.6506 114.0739,-61.6501 122.6511,-68.8877 42.0658,-35.4967 -334.7916,-542.9198 -504.5228,-679.3196 -178.0068,-143.0504 -185.7719,-158.2456 -97.5421,-190.8838 128.2804,-47.4541 120.9405,-120.8043 -37.0117,-369.869 -179.7996,-283.5147 -487.1146,-537.517 -759.9979,-628.1541 -311.9174,-103.6024 -797.0581,-93.7088 -1135.2874,23.1522 -174.3799,60.2496 -395.1332,95.3539 -599.6336,95.3539 -178.0084,0 -316.643,18.4817 -308.0768,41.0708 8.5661,22.5893 94.7371,128.1286 191.491,234.5313 l 175.9162,193.4605 271.9806,-43.8012 c 149.5894,-24.0908 345.9081,-74.6904 436.2638,-112.443 421.4121,-176.0773 804.7885,-135.797 1089.8725,114.5101 89.6077,78.6765 162.923,158.2374 162.923,176.8025 0,18.5645 -289.1091,163.8164 -642.4645,322.7816 -607.5599,273.3251 -661.8481,288.9979 -999.2453,288.4783 -299.1296,-0.4595 -397.1521,-21.6383 -606.6232,-131.0684 -331.3848,-173.1172 -516.8078,-435.7181 -544.6395,-771.3316 -53.7451,-648.0952 456.2148,-924.4887 1893.5222,-1026.2721 l 759.2761,-53.7682 0,-286.5093 c 0,-473.9956 -153.3958,-963.5894 -540.929,-1726.4833 -383.8542,-755.6515 -454.469,-1028.9741 -348.6677,-1349.5557 75.3688,-228.3696 253.5242,-432.9059 475.8737,-546.3401 214.6211,-109.4916 180.5602,-173.1669 351.6755,657.4399 l 129.9133,630.6089 803.403,864.5813 c 441.8718,475.5196 1041.6158,1167.8582 1332.7644,1538.5301 644.0783,819.9996 686.3263,846.6691 1394.3853,880.2301 l 510.1897,24.1818 68.3256,215.4003 c 200.8492,633.194 228.157,1444.7575 71.1202,2113.6475 l -97.3423,414.6252 -516.1455,0 -516.1457,0 -426.1367,432.8126 c -234.3749,238.0469 -604.8582,553.5283 -823.296,701.0699 -381.2512,257.5123 -409.1693,268.2497 -696.9768,268.0576 -164.8991,-0.093 -291.0558,-8.3093 -280.3481,-18.2198 l 0,0 z"
+   id="path2836" /><path
+   style="fill:#00ff00"
+   d="m 2614.6358,8012.0025 c -269.5475,-94.82 -368.811,-250.4523 -294.9245,-462.4032 41.4666,-118.9513 47.5651,-120.669 215.524,-60.699 99.2848,35.4498 380.0952,62.5892 659.7968,63.767 l 486.9469,2.0446 528.5263,-238.8868 c 354.216,-160.1007 563.8724,-230.0155 635.6987,-211.9881 58.945,14.7946 197.1819,103.943 307.1933,198.1088 l 200.0208,171.2104 -665.6286,297.7635 -665.6283,297.7638 -633.6756,-3.6895 c -348.5217,-2.0216 -696.754,-25.8781 -773.8498,-52.9986 z"
+   id="path2838" /><path
+   style="fill:#00ff00"
+   d="m 3187.1996,8928.4826 c -237.5695,-73.055 -393.4586,-243.9599 -342.8417,-375.8654 26.3107,-68.5645 97.1359,-74.3056 614.8737,-49.8426 l 585.1378,27.6477 567.1866,-254.5826 c 347.6323,-156.0349 601.1402,-243.8057 654.9007,-226.743 48.2425,15.3115 160.9243,92.1191 250.404,170.6832 l 162.6905,142.8441 -714.7756,319.1015 c -714.6956,319.0657 -714.8227,319.1011 -1135.2977,317.0254 -231.2873,-1.1486 -520.3125,-32.7626 -642.2783,-70.2683 z"
+   id="path2840" /><path
+   style="fill:#00ff00"
+   d="m 3963.9656,9870.5378 c -161.9684,-70.4925 -298.0242,-236.5671 -298.0242,-363.7791 0,-72.5569 46.5044,-83.0528 367.982,-83.0528 342.6577,0 402.9496,-16.0742 876.0881,-233.5765 l 508.1059,-233.5764 208.4737,217.966 208.474,217.966 -115.0245,49.027 c -63.2635,26.965 -332.7252,149.6334 -598.8039,272.5964 -401.0348,185.3303 -528.9022,223.2562 -747.5952,221.7402 -145.0985,-1.0108 -329.4527,-30.3958 -409.6759,-65.3108 l 0,0 z"
+   id="path2842" /></svg>
\ No newline at end of file
index 26bac27..0479728 100644 (file)
@@ -1,4 +1,7 @@
 #include <QListWidget>
+#include <QPixmap>
+#include <QColor>
+
 #include "remotelistwidgetitem.h"
 
 RemoteListWidgetItem::RemoteListWidgetItem(Remote *remote, QListWidget *parent)
@@ -12,9 +15,13 @@ QVariant RemoteListWidgetItem::data(int role) const
 {
     QString str = m_remote->name() 
         + " (" + QString::number(m_remote->rating()) + ")";
+    QPixmap pix = QPixmap(48,48);
+    pix.fill(Qt::red);
     switch (role) {
         case Qt::DisplayRole:
             return QVariant(str);
+        case Qt::DecorationRole:
+            return QVariant(pix);
         default:
             return QVariant();
     }
diff --git a/src/remotetable.cpp b/src/remotetable.cpp
new file mode 100644 (file)
index 0000000..b27301e
--- /dev/null
@@ -0,0 +1,68 @@
+#include <QResizeEvent>
+#include <QHeaderView>
+#include <QSvgWidget>
+#include "remotetable.h"
+#include "remote.h"
+
+RemoteTable::RemoteTable(QWidget *parent)
+      // Always two columns: Remote name and rating.
+    : QTableWidget(0, 2, parent),
+    thumbsUp("/usr/share/irwi/symbols/symbol_thumbs_up.svg"),
+    thumbsDown("/usr/share/irwi/symbols/symbol_thumbs_down.svg")
+{
+    verticalHeader()->setVisible(false);
+    horizontalHeader()->setVisible(false);
+    
+    setSelectionMode(QAbstractItemView::SingleSelection);
+}
+
+RemoteTable::~RemoteTable()
+{
+}
+
+void RemoteTable::addItem(Remote *remote)
+{
+    if (remote == NULL) {
+        return;
+    }
+    int currentRow = rowCount(); 
+    remotes[currentRow] = remote;
+
+    QString key = remote->name();
+    QWidget *ratingWidget = NULL;
+    if (remote->rating() > 5) {
+        ratingWidget = new QSvgWidget(thumbsUp);
+    } else {
+        ratingWidget = new QSvgWidget(thumbsDown);
+    }
+    QTableWidgetItem *k = new QTableWidgetItem(key);
+    k->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
+    insertRow(currentRow);
+    setItem(currentRow, 0, k);
+    setCellWidget(currentRow, 1, ratingWidget);
+    verticalHeader()->resizeSection(currentRow, 60);
+}
+
+Remote *RemoteTable::selected()
+{
+    QModelIndexList selections = selectedIndexes();
+    if (selections.count() != 1) {
+        return NULL;
+    }
+
+    return remotes[selections[0].row()];
+}
+
+void RemoteTable::removeAllRows()
+{
+    clear();
+    setRowCount(0);
+    remotes.clear();
+}
+/*
+void RemoteTable::resizeEvent(QResizeEvent *e)
+{
+    setColumnWidth(0, (2 * e->size().width() / 3) - 10);
+    setColumnWidth(1, (e->size().width() / 3) - 10);
+}
+*/
diff --git a/src/remotetable.h b/src/remotetable.h
new file mode 100644 (file)
index 0000000..e783cf7
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef _REMOTETABLE_H_
+#define _REMOTETABLE_H_
+
+#include <QTableWidget>
+#include <QMap>
+#include <QString>
+
+class QResizeEvent;
+class Remote;
+
+class RemoteTable : public QTableWidget
+{
+public:
+    RemoteTable(QWidget *parent = 0);
+    ~RemoteTable();
+
+    void addItem(Remote *remote);
+    void removeAllRows();
+    Remote *selected();
+
+protected:
+    //void resizeEvent(QResizeEvent *);
+
+private:
+    QMap<int, Remote*> remotes;
+    QString thumbsUp;
+    QString thumbsDown;
+};
+
+#endif // _REMOTETABLE_H_
+
index 89a69f6..b6fefb2 100644 (file)
@@ -3,6 +3,7 @@
 #include "remote.h"
 #include "remotelistwidgetitem.h"
 #include "onlinepollerthread.h"
+#include "remotetable.h"
 
 #include <QHBoxLayout>
 #include <QLabel>
@@ -39,7 +40,7 @@ SelectRemoteDlg::SelectRemoteDlg(QWidget *parent)
             this,
             SLOT(mfgItemChanged(QListWidgetItem*, QListWidgetItem*)));
 
-    modelList = new QListWidget(this);
+    modelList = new RemoteTable(this);
     layout->addWidget(modelList);
 
     downloadBtn = new QPushButton(tr("Download"), this);
@@ -78,7 +79,7 @@ void SelectRemoteDlg::alphabetItemChanged(QListWidgetItem *current,
                                       QListWidgetItem * /*previous*/)
 {
     mfgList->clear();
-    modelList->clear();
+    modelList->removeAllRows();
     if (current)
     {
         mfgList->addItems((*remoteDB)[current->text()].keys());
@@ -88,29 +89,28 @@ void SelectRemoteDlg::alphabetItemChanged(QListWidgetItem *current,
 void SelectRemoteDlg::mfgItemChanged(QListWidgetItem *current,
                                      QListWidgetItem * /*previous*/)
 {
-    modelList->clear();
+    modelList->removeAllRows();
     if (current)
     {
         RemoteList remotes =
             (*remoteDB)[alphabetList->currentItem()->text()][current->text()];
         foreach(Remote *remote, remotes) {
-            modelList->addItem(new RemoteListWidgetItem(remote));
+            modelList->addItem(remote);
         }
     }
 }
 
 void SelectRemoteDlg::downloadRemote()
 {
-    RemoteListWidgetItem *currentModel =
-        static_cast<RemoteListWidgetItem *>(modelList->currentItem());
+    Remote *currentModel = modelList->selected();
     if (currentModel)
     {
         setBusy();
-        connect(currentModel->remote(), SIGNAL(saveFinished()),
+        connect(currentModel, SIGNAL(saveFinished()),
                 this, SLOT(close()));
-        currentModel->remote()->saveToFile();
+        currentModel->saveToFile();
 
-        emit remoteChanged(*(currentModel->remote()));
+        emit remoteChanged(*currentModel);
     }
 }
 
index c4821f2..90170cd 100644 (file)
@@ -11,6 +11,7 @@
 class QHBoxLayout;
 class QListWidget;
 class QListWidgetItem;
+class RemoteTable;
 class QSettings;
 class QNetworkAccessManager;
 class QNetworkReply;
@@ -52,7 +53,7 @@ private:
     QHBoxLayout *layout;
     QListWidget *alphabetList;
     QListWidget *mfgList;
-    QListWidget *modelList;
+    RemoteTable *modelList;
     QPushButton *downloadBtn;
     RemoteDB *remoteDB;
     OnlinePollerThread *onlinePollerThread;
index b0592ad..98d82c0 100644 (file)
@@ -16,6 +16,7 @@ SOURCES += settingstable.cpp
 SOURCES += aboutdlg.cpp
 SOURCES += remotelistwidgetitem.cpp
 SOURCES += onlinepollerthread.cpp
+SOURCES += remotetable.cpp
 
 HEADERS += rating.h
 HEADERS += settingsdlg.h
@@ -29,6 +30,7 @@ HEADERS += settingstable.h
 HEADERS += aboutdlg.h
 HEADERS += remotelistwidgetitem.h
 HEADERS += onlinepollerthread.h
+HEADERS += remotetable.h
 
 include(qmaemo5homescreenadaptor/qmaemo5homescreenadaptor.pri)
 
@@ -38,6 +40,7 @@ MOC_DIR = moc
 QT += network
 QT += xml
 QT += dbus
+QT += svg
 
 CONFIG += mobility
 MOBILITY += bearer
@@ -55,7 +58,7 @@ DEFINES += DATADIR=\\\"$$DATADIR\\\" PKGDATADIR=\\\"$$PKGDATADIR\\\"
 
 #MAKE INSTALL
 
-INSTALLS += target desktop iconxpm icon26 icon48 icon64
+INSTALLS += target desktop iconxpm icon26 icon48 icon64 symbols
 
   target.path = $$PREFIX/lib/hildon-desktop
 
@@ -73,5 +76,9 @@ INSTALLS += target desktop iconxpm icon26 icon48 icon64
 
   icon64.path = $$DATADIR/icons/hicolor/64x64/apps
   icon64.files += ../data/64x64/$${TARGET}.png
+
+  symbols.path = $$DATADIR/irwi/symbols
+  symbols.files += ../data/symbols/symbol_thumbs_up.svg
+  symbols.files += ../data/symbols/symbol_thumbs_down.svg
 }