From: Flavio Date: Mon, 7 Jan 2013 16:39:51 +0000 (+0100) Subject: Categories, region selection, refactoring X-Git-Tag: 2.0~42 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=8a672c2d0706dd56daab42b2a585418ea9562ea3;p=minitube Categories, region selection, refactoring --- diff --git a/CHANGES b/CHANGES index 6be6d80..a3127f8 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,16 @@ -2.0 +2.0 - January ?? 2013 +- YouTube categories and "standard feeds": "Most Popular", "Featured", etc +- Country selection for YouTube categories and feeds - Autoupdate on Mac and Windows +- Related videos are now appended to the video when pasting a YouTube link +- "Show 10 More" with a single click +- Play video in the playlist with a single click on its thumbnail +- OS X Mountain Lion notifications on video start +- Fixed some YouTube links not working when pasted in the searchbox +- Fixed playlist drag'n'drop +- Fixed system language settings detection - Fixed clicking on channel names not working in some cases +- Fixed incorrect number of downloads in status bar 1.9 - September 27, 2012 - Adapted to YouTube changes diff --git a/flags/aa.png b/flags/aa.png new file mode 100644 index 0000000..00de749 Binary files /dev/null and b/flags/aa.png differ diff --git a/flags/ad.png b/flags/ad.png new file mode 100644 index 0000000..1797beb Binary files /dev/null and b/flags/ad.png differ diff --git a/flags/ae.png b/flags/ae.png new file mode 100644 index 0000000..0c4384f Binary files /dev/null and b/flags/ae.png differ diff --git a/flags/af.png b/flags/af.png new file mode 100644 index 0000000..c5d6ad0 Binary files /dev/null and b/flags/af.png differ diff --git a/flags/ag.png b/flags/ag.png new file mode 100644 index 0000000..9cd5ef6 Binary files /dev/null and b/flags/ag.png differ diff --git a/flags/ai.png b/flags/ai.png new file mode 100644 index 0000000..8773497 Binary files /dev/null and b/flags/ai.png differ diff --git a/flags/al.png b/flags/al.png new file mode 100644 index 0000000..dc74567 Binary files /dev/null and b/flags/al.png differ diff --git a/flags/am.png b/flags/am.png new file mode 100644 index 0000000..ffb0468 Binary files /dev/null and b/flags/am.png differ diff --git a/flags/ao.png b/flags/ao.png new file mode 100644 index 0000000..bb3e36c Binary files /dev/null and b/flags/ao.png differ diff --git a/flags/aq.png b/flags/aq.png new file mode 100644 index 0000000..9434a79 Binary files /dev/null and b/flags/aq.png differ diff --git a/flags/ar.png b/flags/ar.png new file mode 100644 index 0000000..7d8f6c1 Binary files /dev/null and b/flags/ar.png differ diff --git a/flags/as.png b/flags/as.png new file mode 100644 index 0000000..7dcbf45 Binary files /dev/null and b/flags/as.png differ diff --git a/flags/at.png b/flags/at.png new file mode 100644 index 0000000..3fe9b01 Binary files /dev/null and b/flags/at.png differ diff --git a/flags/au.png b/flags/au.png new file mode 100644 index 0000000..1337776 Binary files /dev/null and b/flags/au.png differ diff --git a/flags/aw.png b/flags/aw.png new file mode 100644 index 0000000..820da22 Binary files /dev/null and b/flags/aw.png differ diff --git a/flags/ax.png b/flags/ax.png new file mode 100644 index 0000000..558285c Binary files /dev/null and b/flags/ax.png differ diff --git a/flags/az.png b/flags/az.png new file mode 100644 index 0000000..d3a59e9 Binary files /dev/null and b/flags/az.png differ diff --git a/flags/ba.png b/flags/ba.png new file mode 100644 index 0000000..8113723 Binary files /dev/null and b/flags/ba.png differ diff --git a/flags/bb.png b/flags/bb.png new file mode 100644 index 0000000..81bccb3 Binary files /dev/null and b/flags/bb.png differ diff --git a/flags/bd.png b/flags/bd.png new file mode 100644 index 0000000..984d0b1 Binary files /dev/null and b/flags/bd.png differ diff --git a/flags/be.png b/flags/be.png new file mode 100644 index 0000000..8db34d3 Binary files /dev/null and b/flags/be.png differ diff --git a/flags/bf.png b/flags/bf.png new file mode 100644 index 0000000..27a9bc0 Binary files /dev/null and b/flags/bf.png differ diff --git a/flags/bg.png b/flags/bg.png new file mode 100644 index 0000000..656ccae Binary files /dev/null and b/flags/bg.png differ diff --git a/flags/bh.png b/flags/bh.png new file mode 100644 index 0000000..76b0abd Binary files /dev/null and b/flags/bh.png differ diff --git a/flags/bi.png b/flags/bi.png new file mode 100644 index 0000000..5ee2762 Binary files /dev/null and b/flags/bi.png differ diff --git a/flags/bj.png b/flags/bj.png new file mode 100644 index 0000000..8eb7145 Binary files /dev/null and b/flags/bj.png differ diff --git a/flags/bl.png b/flags/bl.png new file mode 100644 index 0000000..2d0efbd Binary files /dev/null and b/flags/bl.png differ diff --git a/flags/bm.png b/flags/bm.png new file mode 100644 index 0000000..dfb2903 Binary files /dev/null and b/flags/bm.png differ diff --git a/flags/bn.png b/flags/bn.png new file mode 100644 index 0000000..bb297c0 Binary files /dev/null and b/flags/bn.png differ diff --git a/flags/bo.png b/flags/bo.png new file mode 100644 index 0000000..0b925cc Binary files /dev/null and b/flags/bo.png differ diff --git a/flags/bq.png b/flags/bq.png new file mode 100644 index 0000000..0537acb Binary files /dev/null and b/flags/bq.png differ diff --git a/flags/br.png b/flags/br.png new file mode 100644 index 0000000..0388ab2 Binary files /dev/null and b/flags/br.png differ diff --git a/flags/bs.png b/flags/bs.png new file mode 100644 index 0000000..08d7740 Binary files /dev/null and b/flags/bs.png differ diff --git a/flags/bt.png b/flags/bt.png new file mode 100644 index 0000000..5dbf784 Binary files /dev/null and b/flags/bt.png differ diff --git a/flags/bv.png b/flags/bv.png new file mode 100644 index 0000000..efd5c47 Binary files /dev/null and b/flags/bv.png differ diff --git a/flags/bw.png b/flags/bw.png new file mode 100644 index 0000000..324f49d Binary files /dev/null and b/flags/bw.png differ diff --git a/flags/by.png b/flags/by.png new file mode 100644 index 0000000..4af566a Binary files /dev/null and b/flags/by.png differ diff --git a/flags/bz.png b/flags/bz.png new file mode 100644 index 0000000..8e03b90 Binary files /dev/null and b/flags/bz.png differ diff --git a/flags/ca.png b/flags/ca.png new file mode 100644 index 0000000..41e3b9b Binary files /dev/null and b/flags/ca.png differ diff --git a/flags/cc.png b/flags/cc.png new file mode 100644 index 0000000..1337776 Binary files /dev/null and b/flags/cc.png differ diff --git a/flags/cd.png b/flags/cd.png new file mode 100644 index 0000000..d6db89e Binary files /dev/null and b/flags/cd.png differ diff --git a/flags/cf.png b/flags/cf.png new file mode 100644 index 0000000..40bc0bc Binary files /dev/null and b/flags/cf.png differ diff --git a/flags/cg.png b/flags/cg.png new file mode 100644 index 0000000..73b99f9 Binary files /dev/null and b/flags/cg.png differ diff --git a/flags/ch.png b/flags/ch.png new file mode 100644 index 0000000..2bcf775 Binary files /dev/null and b/flags/ch.png differ diff --git a/flags/ci.png b/flags/ci.png new file mode 100644 index 0000000..fa83e47 Binary files /dev/null and b/flags/ci.png differ diff --git a/flags/ck.png b/flags/ck.png new file mode 100644 index 0000000..970a2b6 Binary files /dev/null and b/flags/ck.png differ diff --git a/flags/cl.png b/flags/cl.png new file mode 100644 index 0000000..b8a76b0 Binary files /dev/null and b/flags/cl.png differ diff --git a/flags/cm.png b/flags/cm.png new file mode 100644 index 0000000..c5b103d Binary files /dev/null and b/flags/cm.png differ diff --git a/flags/cn.png b/flags/cn.png new file mode 100644 index 0000000..643342a Binary files /dev/null and b/flags/cn.png differ diff --git a/flags/co.png b/flags/co.png new file mode 100644 index 0000000..d8ce22f Binary files /dev/null and b/flags/co.png differ diff --git a/flags/cr.png b/flags/cr.png new file mode 100644 index 0000000..203d97d Binary files /dev/null and b/flags/cr.png differ diff --git a/flags/cu.png b/flags/cu.png new file mode 100644 index 0000000..df19b36 Binary files /dev/null and b/flags/cu.png differ diff --git a/flags/cv.png b/flags/cv.png new file mode 100644 index 0000000..5d3738b Binary files /dev/null and b/flags/cv.png differ diff --git a/flags/cw.png b/flags/cw.png new file mode 100644 index 0000000..8df3897 Binary files /dev/null and b/flags/cw.png differ diff --git a/flags/cx.png b/flags/cx.png new file mode 100644 index 0000000..9d5e140 Binary files /dev/null and b/flags/cx.png differ diff --git a/flags/cy.png b/flags/cy.png new file mode 100644 index 0000000..f1b75cc Binary files /dev/null and b/flags/cy.png differ diff --git a/flags/cz.png b/flags/cz.png new file mode 100644 index 0000000..7045331 Binary files /dev/null and b/flags/cz.png differ diff --git a/flags/de.png b/flags/de.png new file mode 100644 index 0000000..6e4227c Binary files /dev/null and b/flags/de.png differ diff --git a/flags/dj.png b/flags/dj.png new file mode 100644 index 0000000..f47f94a Binary files /dev/null and b/flags/dj.png differ diff --git a/flags/dk.png b/flags/dk.png new file mode 100644 index 0000000..9b4d4dd Binary files /dev/null and b/flags/dk.png differ diff --git a/flags/dm.png b/flags/dm.png new file mode 100644 index 0000000..b7ca081 Binary files /dev/null and b/flags/dm.png differ diff --git a/flags/do.png b/flags/do.png new file mode 100644 index 0000000..28d278e Binary files /dev/null and b/flags/do.png differ diff --git a/flags/dz.png b/flags/dz.png new file mode 100644 index 0000000..f7ee5a5 Binary files /dev/null and b/flags/dz.png differ diff --git a/flags/ec.png b/flags/ec.png new file mode 100644 index 0000000..8fadbf3 Binary files /dev/null and b/flags/ec.png differ diff --git a/flags/ee.png b/flags/ee.png new file mode 100644 index 0000000..b396554 Binary files /dev/null and b/flags/ee.png differ diff --git a/flags/eg.png b/flags/eg.png new file mode 100644 index 0000000..6a6c757 Binary files /dev/null and b/flags/eg.png differ diff --git a/flags/eh.png b/flags/eh.png new file mode 100644 index 0000000..cb34f16 Binary files /dev/null and b/flags/eh.png differ diff --git a/flags/eo.png b/flags/eo.png new file mode 100644 index 0000000..a81582a Binary files /dev/null and b/flags/eo.png differ diff --git a/flags/er.png b/flags/er.png new file mode 100644 index 0000000..759a70f Binary files /dev/null and b/flags/er.png differ diff --git a/flags/es.png b/flags/es.png new file mode 100644 index 0000000..e0221d0 Binary files /dev/null and b/flags/es.png differ diff --git a/flags/et.png b/flags/et.png new file mode 100644 index 0000000..f9b07e1 Binary files /dev/null and b/flags/et.png differ diff --git a/flags/fi.png b/flags/fi.png new file mode 100644 index 0000000..fa748e0 Binary files /dev/null and b/flags/fi.png differ diff --git a/flags/fj.png b/flags/fj.png new file mode 100644 index 0000000..e2374ef Binary files /dev/null and b/flags/fj.png differ diff --git a/flags/fk.png b/flags/fk.png new file mode 100644 index 0000000..880b9fe Binary files /dev/null and b/flags/fk.png differ diff --git a/flags/fm.png b/flags/fm.png new file mode 100644 index 0000000..05d0669 Binary files /dev/null and b/flags/fm.png differ diff --git a/flags/fo.png b/flags/fo.png new file mode 100644 index 0000000..c32504c Binary files /dev/null and b/flags/fo.png differ diff --git a/flags/fr.png b/flags/fr.png new file mode 100644 index 0000000..2d0efbd Binary files /dev/null and b/flags/fr.png differ diff --git a/flags/ga.png b/flags/ga.png new file mode 100644 index 0000000..448829f Binary files /dev/null and b/flags/ga.png differ diff --git a/flags/gb.png b/flags/gb.png new file mode 100644 index 0000000..7792b6f Binary files /dev/null and b/flags/gb.png differ diff --git a/flags/gd.png b/flags/gd.png new file mode 100644 index 0000000..2907cdd Binary files /dev/null and b/flags/gd.png differ diff --git a/flags/ge.png b/flags/ge.png new file mode 100644 index 0000000..3e46cb6 Binary files /dev/null and b/flags/ge.png differ diff --git a/flags/gf.png b/flags/gf.png new file mode 100644 index 0000000..2d0efbd Binary files /dev/null and b/flags/gf.png differ diff --git a/flags/gg.png b/flags/gg.png new file mode 100644 index 0000000..8d7dff0 Binary files /dev/null and b/flags/gg.png differ diff --git a/flags/gh.png b/flags/gh.png new file mode 100644 index 0000000..1f7e7a1 Binary files /dev/null and b/flags/gh.png differ diff --git a/flags/gi.png b/flags/gi.png new file mode 100644 index 0000000..dcfd125 Binary files /dev/null and b/flags/gi.png differ diff --git a/flags/gl.png b/flags/gl.png new file mode 100644 index 0000000..fcfd3f1 Binary files /dev/null and b/flags/gl.png differ diff --git a/flags/gm.png b/flags/gm.png new file mode 100644 index 0000000..e6036b5 Binary files /dev/null and b/flags/gm.png differ diff --git a/flags/gn.png b/flags/gn.png new file mode 100644 index 0000000..dc9f0a3 Binary files /dev/null and b/flags/gn.png differ diff --git a/flags/gp.png b/flags/gp.png new file mode 100644 index 0000000..2d0efbd Binary files /dev/null and b/flags/gp.png differ diff --git a/flags/gq.png b/flags/gq.png new file mode 100644 index 0000000..027f740 Binary files /dev/null and b/flags/gq.png differ diff --git a/flags/gr.png b/flags/gr.png new file mode 100644 index 0000000..08e7682 Binary files /dev/null and b/flags/gr.png differ diff --git a/flags/gs.png b/flags/gs.png new file mode 100644 index 0000000..9ecf002 Binary files /dev/null and b/flags/gs.png differ diff --git a/flags/gt.png b/flags/gt.png new file mode 100644 index 0000000..8578339 Binary files /dev/null and b/flags/gt.png differ diff --git a/flags/gu.png b/flags/gu.png new file mode 100644 index 0000000..03a2240 Binary files /dev/null and b/flags/gu.png differ diff --git a/flags/gw.png b/flags/gw.png new file mode 100644 index 0000000..8eab2cf Binary files /dev/null and b/flags/gw.png differ diff --git a/flags/gy.png b/flags/gy.png new file mode 100644 index 0000000..8c2a856 Binary files /dev/null and b/flags/gy.png differ diff --git a/flags/hk.png b/flags/hk.png new file mode 100644 index 0000000..8c5fd7a Binary files /dev/null and b/flags/hk.png differ diff --git a/flags/hm.png b/flags/hm.png new file mode 100644 index 0000000..369a261 Binary files /dev/null and b/flags/hm.png differ diff --git a/flags/hn.png b/flags/hn.png new file mode 100644 index 0000000..837a4c5 Binary files /dev/null and b/flags/hn.png differ diff --git a/flags/hr.png b/flags/hr.png new file mode 100644 index 0000000..7d44171 Binary files /dev/null and b/flags/hr.png differ diff --git a/flags/ht.png b/flags/ht.png new file mode 100644 index 0000000..e899329 Binary files /dev/null and b/flags/ht.png differ diff --git a/flags/hu.png b/flags/hu.png new file mode 100644 index 0000000..3409688 Binary files /dev/null and b/flags/hu.png differ diff --git a/flags/id.png b/flags/id.png new file mode 100644 index 0000000..8121a6c Binary files /dev/null and b/flags/id.png differ diff --git a/flags/ie.png b/flags/ie.png new file mode 100644 index 0000000..be36b16 Binary files /dev/null and b/flags/ie.png differ diff --git a/flags/il.png b/flags/il.png new file mode 100644 index 0000000..2559b9a Binary files /dev/null and b/flags/il.png differ diff --git a/flags/im.png b/flags/im.png new file mode 100644 index 0000000..4b7eff7 Binary files /dev/null and b/flags/im.png differ diff --git a/flags/in.png b/flags/in.png new file mode 100644 index 0000000..f1bbf5b Binary files /dev/null and b/flags/in.png differ diff --git a/flags/io.png b/flags/io.png new file mode 100644 index 0000000..a22b14f Binary files /dev/null and b/flags/io.png differ diff --git a/flags/iq.png b/flags/iq.png new file mode 100644 index 0000000..c567515 Binary files /dev/null and b/flags/iq.png differ diff --git a/flags/ir.png b/flags/ir.png new file mode 100644 index 0000000..e9242fb Binary files /dev/null and b/flags/ir.png differ diff --git a/flags/is.png b/flags/is.png new file mode 100644 index 0000000..00c2758 Binary files /dev/null and b/flags/is.png differ diff --git a/flags/it.png b/flags/it.png new file mode 100644 index 0000000..8ac6699 Binary files /dev/null and b/flags/it.png differ diff --git a/flags/je.png b/flags/je.png new file mode 100644 index 0000000..afca28e Binary files /dev/null and b/flags/je.png differ diff --git a/flags/jm.png b/flags/jm.png new file mode 100644 index 0000000..42923df Binary files /dev/null and b/flags/jm.png differ diff --git a/flags/jo.png b/flags/jo.png new file mode 100644 index 0000000..65deddc Binary files /dev/null and b/flags/jo.png differ diff --git a/flags/jp.png b/flags/jp.png new file mode 100644 index 0000000..478fd9f Binary files /dev/null and b/flags/jp.png differ diff --git a/flags/ke.png b/flags/ke.png new file mode 100644 index 0000000..580e255 Binary files /dev/null and b/flags/ke.png differ diff --git a/flags/kg.png b/flags/kg.png new file mode 100644 index 0000000..64fd7a3 Binary files /dev/null and b/flags/kg.png differ diff --git a/flags/kh.png b/flags/kh.png new file mode 100644 index 0000000..5367f59 Binary files /dev/null and b/flags/kh.png differ diff --git a/flags/ki.png b/flags/ki.png new file mode 100644 index 0000000..74ebc68 Binary files /dev/null and b/flags/ki.png differ diff --git a/flags/km.png b/flags/km.png new file mode 100644 index 0000000..3585c04 Binary files /dev/null and b/flags/km.png differ diff --git a/flags/kn.png b/flags/kn.png new file mode 100644 index 0000000..7f0625e Binary files /dev/null and b/flags/kn.png differ diff --git a/flags/kp.png b/flags/kp.png new file mode 100644 index 0000000..7abcf8e Binary files /dev/null and b/flags/kp.png differ diff --git a/flags/kr.png b/flags/kr.png new file mode 100644 index 0000000..590b981 Binary files /dev/null and b/flags/kr.png differ diff --git a/flags/kw.png b/flags/kw.png new file mode 100644 index 0000000..973cbe1 Binary files /dev/null and b/flags/kw.png differ diff --git a/flags/ky.png b/flags/ky.png new file mode 100644 index 0000000..339eb9a Binary files /dev/null and b/flags/ky.png differ diff --git a/flags/kz.png b/flags/kz.png new file mode 100644 index 0000000..89ff910 Binary files /dev/null and b/flags/kz.png differ diff --git a/flags/la.png b/flags/la.png new file mode 100644 index 0000000..d7f3c1d Binary files /dev/null and b/flags/la.png differ diff --git a/flags/lb.png b/flags/lb.png new file mode 100644 index 0000000..86df7b5 Binary files /dev/null and b/flags/lb.png differ diff --git a/flags/lc.png b/flags/lc.png new file mode 100644 index 0000000..d522ed7 Binary files /dev/null and b/flags/lc.png differ diff --git a/flags/li.png b/flags/li.png new file mode 100644 index 0000000..9c9d485 Binary files /dev/null and b/flags/li.png differ diff --git a/flags/lk.png b/flags/lk.png new file mode 100644 index 0000000..78f8768 Binary files /dev/null and b/flags/lk.png differ diff --git a/flags/lr.png b/flags/lr.png new file mode 100644 index 0000000..6c564bc Binary files /dev/null and b/flags/lr.png differ diff --git a/flags/ls.png b/flags/ls.png new file mode 100644 index 0000000..5c5336b Binary files /dev/null and b/flags/ls.png differ diff --git a/flags/lt.png b/flags/lt.png new file mode 100644 index 0000000..8a359a5 Binary files /dev/null and b/flags/lt.png differ diff --git a/flags/lu.png b/flags/lu.png new file mode 100644 index 0000000..8cef647 Binary files /dev/null and b/flags/lu.png differ diff --git a/flags/lv.png b/flags/lv.png new file mode 100644 index 0000000..6398693 Binary files /dev/null and b/flags/lv.png differ diff --git a/flags/ly.png b/flags/ly.png new file mode 100644 index 0000000..266a909 Binary files /dev/null and b/flags/ly.png differ diff --git a/flags/ma.png b/flags/ma.png new file mode 100644 index 0000000..bb29b17 Binary files /dev/null and b/flags/ma.png differ diff --git a/flags/mc.png b/flags/mc.png new file mode 100644 index 0000000..7d5bccb Binary files /dev/null and b/flags/mc.png differ diff --git a/flags/md.png b/flags/md.png new file mode 100644 index 0000000..5045a30 Binary files /dev/null and b/flags/md.png differ diff --git a/flags/me.png b/flags/me.png new file mode 100644 index 0000000..426fbf5 Binary files /dev/null and b/flags/me.png differ diff --git a/flags/mf.png b/flags/mf.png new file mode 100644 index 0000000..691826d Binary files /dev/null and b/flags/mf.png differ diff --git a/flags/mg.png b/flags/mg.png new file mode 100644 index 0000000..83510ff Binary files /dev/null and b/flags/mg.png differ diff --git a/flags/mh.png b/flags/mh.png new file mode 100644 index 0000000..c5bbf2d Binary files /dev/null and b/flags/mh.png differ diff --git a/flags/mk.png b/flags/mk.png new file mode 100644 index 0000000..223af3e Binary files /dev/null and b/flags/mk.png differ diff --git a/flags/ml.png b/flags/ml.png new file mode 100644 index 0000000..ccdd589 Binary files /dev/null and b/flags/ml.png differ diff --git a/flags/mm.png b/flags/mm.png new file mode 100644 index 0000000..122c42b Binary files /dev/null and b/flags/mm.png differ diff --git a/flags/mn.png b/flags/mn.png new file mode 100644 index 0000000..741d90e Binary files /dev/null and b/flags/mn.png differ diff --git a/flags/mo.png b/flags/mo.png new file mode 100644 index 0000000..2b7762c Binary files /dev/null and b/flags/mo.png differ diff --git a/flags/mp.png b/flags/mp.png new file mode 100644 index 0000000..70f164a Binary files /dev/null and b/flags/mp.png differ diff --git a/flags/mq.png b/flags/mq.png new file mode 100644 index 0000000..2d0efbd Binary files /dev/null and b/flags/mq.png differ diff --git a/flags/mr.png b/flags/mr.png new file mode 100644 index 0000000..2c3ddf5 Binary files /dev/null and b/flags/mr.png differ diff --git a/flags/ms.png b/flags/ms.png new file mode 100644 index 0000000..a493f41 Binary files /dev/null and b/flags/ms.png differ diff --git a/flags/mt.png b/flags/mt.png new file mode 100644 index 0000000..f276dcc Binary files /dev/null and b/flags/mt.png differ diff --git a/flags/mu.png b/flags/mu.png new file mode 100644 index 0000000..e85120c Binary files /dev/null and b/flags/mu.png differ diff --git a/flags/mv.png b/flags/mv.png new file mode 100644 index 0000000..8922669 Binary files /dev/null and b/flags/mv.png differ diff --git a/flags/mw.png b/flags/mw.png new file mode 100644 index 0000000..d24b38a Binary files /dev/null and b/flags/mw.png differ diff --git a/flags/mx.png b/flags/mx.png new file mode 100644 index 0000000..64bc962 Binary files /dev/null and b/flags/mx.png differ diff --git a/flags/my.png b/flags/my.png new file mode 100644 index 0000000..3ba4e6c Binary files /dev/null and b/flags/my.png differ diff --git a/flags/mz.png b/flags/mz.png new file mode 100644 index 0000000..812613e Binary files /dev/null and b/flags/mz.png differ diff --git a/flags/na.png b/flags/na.png new file mode 100644 index 0000000..e395bd8 Binary files /dev/null and b/flags/na.png differ diff --git a/flags/nc.png b/flags/nc.png new file mode 100644 index 0000000..2d0efbd Binary files /dev/null and b/flags/nc.png differ diff --git a/flags/ne.png b/flags/ne.png new file mode 100644 index 0000000..8fba5a1 Binary files /dev/null and b/flags/ne.png differ diff --git a/flags/nf.png b/flags/nf.png new file mode 100644 index 0000000..37ab3a8 Binary files /dev/null and b/flags/nf.png differ diff --git a/flags/ng.png b/flags/ng.png new file mode 100644 index 0000000..5dd9c1a Binary files /dev/null and b/flags/ng.png differ diff --git a/flags/ni.png b/flags/ni.png new file mode 100644 index 0000000..50cc637 Binary files /dev/null and b/flags/ni.png differ diff --git a/flags/nl.png b/flags/nl.png new file mode 100644 index 0000000..df2794e Binary files /dev/null and b/flags/nl.png differ diff --git a/flags/no.png b/flags/no.png new file mode 100644 index 0000000..59138a7 Binary files /dev/null and b/flags/no.png differ diff --git a/flags/np.png b/flags/np.png new file mode 100644 index 0000000..37c8f29 Binary files /dev/null and b/flags/np.png differ diff --git a/flags/nr.png b/flags/nr.png new file mode 100644 index 0000000..d6408e2 Binary files /dev/null and b/flags/nr.png differ diff --git a/flags/nu.png b/flags/nu.png new file mode 100644 index 0000000..1dd6000 Binary files /dev/null and b/flags/nu.png differ diff --git a/flags/nz.png b/flags/nz.png new file mode 100644 index 0000000..ba5dfd1 Binary files /dev/null and b/flags/nz.png differ diff --git a/flags/om.png b/flags/om.png new file mode 100644 index 0000000..692229f Binary files /dev/null and b/flags/om.png differ diff --git a/flags/pa.png b/flags/pa.png new file mode 100644 index 0000000..d1b7838 Binary files /dev/null and b/flags/pa.png differ diff --git a/flags/pe.png b/flags/pe.png new file mode 100644 index 0000000..513b986 Binary files /dev/null and b/flags/pe.png differ diff --git a/flags/pf.png b/flags/pf.png new file mode 100644 index 0000000..3bffe95 Binary files /dev/null and b/flags/pf.png differ diff --git a/flags/pg.png b/flags/pg.png new file mode 100644 index 0000000..f674483 Binary files /dev/null and b/flags/pg.png differ diff --git a/flags/ph.png b/flags/ph.png new file mode 100644 index 0000000..3c5c242 Binary files /dev/null and b/flags/ph.png differ diff --git a/flags/pk.png b/flags/pk.png new file mode 100644 index 0000000..bcc771c Binary files /dev/null and b/flags/pk.png differ diff --git a/flags/pl.png b/flags/pl.png new file mode 100644 index 0000000..2ac25fe Binary files /dev/null and b/flags/pl.png differ diff --git a/flags/pm.png b/flags/pm.png new file mode 100644 index 0000000..2d0efbd Binary files /dev/null and b/flags/pm.png differ diff --git a/flags/pn.png b/flags/pn.png new file mode 100644 index 0000000..c88f11c Binary files /dev/null and b/flags/pn.png differ diff --git a/flags/pr.png b/flags/pr.png new file mode 100644 index 0000000..3cdf8a2 Binary files /dev/null and b/flags/pr.png differ diff --git a/flags/ps.png b/flags/ps.png new file mode 100644 index 0000000..c0a7e9c Binary files /dev/null and b/flags/ps.png differ diff --git a/flags/pt.png b/flags/pt.png new file mode 100644 index 0000000..37ff303 Binary files /dev/null and b/flags/pt.png differ diff --git a/flags/pw.png b/flags/pw.png new file mode 100644 index 0000000..40ca642 Binary files /dev/null and b/flags/pw.png differ diff --git a/flags/py.png b/flags/py.png new file mode 100644 index 0000000..4801324 Binary files /dev/null and b/flags/py.png differ diff --git a/flags/qa.png b/flags/qa.png new file mode 100644 index 0000000..5983296 Binary files /dev/null and b/flags/qa.png differ diff --git a/flags/re.png b/flags/re.png new file mode 100644 index 0000000..2d0efbd Binary files /dev/null and b/flags/re.png differ diff --git a/flags/ro.png b/flags/ro.png new file mode 100644 index 0000000..ad1ffd2 Binary files /dev/null and b/flags/ro.png differ diff --git a/flags/rs.png b/flags/rs.png new file mode 100644 index 0000000..937a33e Binary files /dev/null and b/flags/rs.png differ diff --git a/flags/ru.png b/flags/ru.png new file mode 100644 index 0000000..5575bee Binary files /dev/null and b/flags/ru.png differ diff --git a/flags/rw.png b/flags/rw.png new file mode 100644 index 0000000..4189609 Binary files /dev/null and b/flags/rw.png differ diff --git a/flags/sa.png b/flags/sa.png new file mode 100644 index 0000000..0ac21cd Binary files /dev/null and b/flags/sa.png differ diff --git a/flags/sb.png b/flags/sb.png new file mode 100644 index 0000000..cd27a52 Binary files /dev/null and b/flags/sb.png differ diff --git a/flags/sc.png b/flags/sc.png new file mode 100644 index 0000000..6163323 Binary files /dev/null and b/flags/sc.png differ diff --git a/flags/sd.png b/flags/sd.png new file mode 100644 index 0000000..3d5fdbf Binary files /dev/null and b/flags/sd.png differ diff --git a/flags/se.png b/flags/se.png new file mode 100644 index 0000000..f838195 Binary files /dev/null and b/flags/se.png differ diff --git a/flags/sg.png b/flags/sg.png new file mode 100644 index 0000000..3109de1 Binary files /dev/null and b/flags/sg.png differ diff --git a/flags/sh.png b/flags/sh.png new file mode 100644 index 0000000..41f6dd9 Binary files /dev/null and b/flags/sh.png differ diff --git a/flags/si.png b/flags/si.png new file mode 100644 index 0000000..442768e Binary files /dev/null and b/flags/si.png differ diff --git a/flags/sj.png b/flags/sj.png new file mode 100644 index 0000000..980b2e4 Binary files /dev/null and b/flags/sj.png differ diff --git a/flags/sk.png b/flags/sk.png new file mode 100644 index 0000000..ed0ae19 Binary files /dev/null and b/flags/sk.png differ diff --git a/flags/sl.png b/flags/sl.png new file mode 100644 index 0000000..1403c70 Binary files /dev/null and b/flags/sl.png differ diff --git a/flags/sm.png b/flags/sm.png new file mode 100644 index 0000000..69b230c Binary files /dev/null and b/flags/sm.png differ diff --git a/flags/sn.png b/flags/sn.png new file mode 100644 index 0000000..53f1dda Binary files /dev/null and b/flags/sn.png differ diff --git a/flags/so.png b/flags/so.png new file mode 100644 index 0000000..3b3bcc6 Binary files /dev/null and b/flags/so.png differ diff --git a/flags/sr.png b/flags/sr.png new file mode 100644 index 0000000..4e55bbc Binary files /dev/null and b/flags/sr.png differ diff --git a/flags/ss.png b/flags/ss.png new file mode 100644 index 0000000..f809b6d Binary files /dev/null and b/flags/ss.png differ diff --git a/flags/st.png b/flags/st.png new file mode 100644 index 0000000..976f5b8 Binary files /dev/null and b/flags/st.png differ diff --git a/flags/sv.png b/flags/sv.png new file mode 100644 index 0000000..9e96582 Binary files /dev/null and b/flags/sv.png differ diff --git a/flags/sx.png b/flags/sx.png new file mode 100644 index 0000000..691826d Binary files /dev/null and b/flags/sx.png differ diff --git a/flags/sy.png b/flags/sy.png new file mode 100644 index 0000000..900dc2d Binary files /dev/null and b/flags/sy.png differ diff --git a/flags/sz.png b/flags/sz.png new file mode 100644 index 0000000..8153162 Binary files /dev/null and b/flags/sz.png differ diff --git a/flags/tc.png b/flags/tc.png new file mode 100644 index 0000000..cddd919 Binary files /dev/null and b/flags/tc.png differ diff --git a/flags/td.png b/flags/td.png new file mode 100644 index 0000000..4ee6a39 Binary files /dev/null and b/flags/td.png differ diff --git a/flags/tf.png b/flags/tf.png new file mode 100644 index 0000000..2d0efbd Binary files /dev/null and b/flags/tf.png differ diff --git a/flags/tg.png b/flags/tg.png new file mode 100644 index 0000000..9d6ab4a Binary files /dev/null and b/flags/tg.png differ diff --git a/flags/th.png b/flags/th.png new file mode 100644 index 0000000..1aed666 Binary files /dev/null and b/flags/th.png differ diff --git a/flags/tj.png b/flags/tj.png new file mode 100644 index 0000000..630cc7d Binary files /dev/null and b/flags/tj.png differ diff --git a/flags/tk.png b/flags/tk.png new file mode 100644 index 0000000..0c7a257 Binary files /dev/null and b/flags/tk.png differ diff --git a/flags/tl.png b/flags/tl.png new file mode 100644 index 0000000..b4c043f Binary files /dev/null and b/flags/tl.png differ diff --git a/flags/tm.png b/flags/tm.png new file mode 100644 index 0000000..6eea744 Binary files /dev/null and b/flags/tm.png differ diff --git a/flags/tn.png b/flags/tn.png new file mode 100644 index 0000000..109f393 Binary files /dev/null and b/flags/tn.png differ diff --git a/flags/to.png b/flags/to.png new file mode 100644 index 0000000..2b808e4 Binary files /dev/null and b/flags/to.png differ diff --git a/flags/tr.png b/flags/tr.png new file mode 100644 index 0000000..43aa432 Binary files /dev/null and b/flags/tr.png differ diff --git a/flags/tt.png b/flags/tt.png new file mode 100644 index 0000000..ad90bf1 Binary files /dev/null and b/flags/tt.png differ diff --git a/flags/tv.png b/flags/tv.png new file mode 100644 index 0000000..fab20c6 Binary files /dev/null and b/flags/tv.png differ diff --git a/flags/tw.png b/flags/tw.png new file mode 100644 index 0000000..733d370 Binary files /dev/null and b/flags/tw.png differ diff --git a/flags/tz.png b/flags/tz.png new file mode 100644 index 0000000..bfc0993 Binary files /dev/null and b/flags/tz.png differ diff --git a/flags/ua.png b/flags/ua.png new file mode 100644 index 0000000..383c127 Binary files /dev/null and b/flags/ua.png differ diff --git a/flags/ug.png b/flags/ug.png new file mode 100644 index 0000000..4c977f2 Binary files /dev/null and b/flags/ug.png differ diff --git a/flags/um.png b/flags/um.png new file mode 100644 index 0000000..9ca0bfd Binary files /dev/null and b/flags/um.png differ diff --git a/flags/us.png b/flags/us.png new file mode 100644 index 0000000..9ca0bfd Binary files /dev/null and b/flags/us.png differ diff --git a/flags/uy.png b/flags/uy.png new file mode 100644 index 0000000..a90b9e0 Binary files /dev/null and b/flags/uy.png differ diff --git a/flags/uz.png b/flags/uz.png new file mode 100644 index 0000000..d83031f Binary files /dev/null and b/flags/uz.png differ diff --git a/flags/va.png b/flags/va.png new file mode 100644 index 0000000..9935a8e Binary files /dev/null and b/flags/va.png differ diff --git a/flags/vc.png b/flags/vc.png new file mode 100644 index 0000000..8e50bba Binary files /dev/null and b/flags/vc.png differ diff --git a/flags/ve.png b/flags/ve.png new file mode 100644 index 0000000..fbb9820 Binary files /dev/null and b/flags/ve.png differ diff --git a/flags/vg.png b/flags/vg.png new file mode 100644 index 0000000..afb867a Binary files /dev/null and b/flags/vg.png differ diff --git a/flags/vi.png b/flags/vi.png new file mode 100644 index 0000000..afb867a Binary files /dev/null and b/flags/vi.png differ diff --git a/flags/vn.png b/flags/vn.png new file mode 100644 index 0000000..9b0536f Binary files /dev/null and b/flags/vn.png differ diff --git a/flags/vu.png b/flags/vu.png new file mode 100644 index 0000000..d609d75 Binary files /dev/null and b/flags/vu.png differ diff --git a/flags/wf.png b/flags/wf.png new file mode 100644 index 0000000..2d0efbd Binary files /dev/null and b/flags/wf.png differ diff --git a/flags/ws.png b/flags/ws.png new file mode 100644 index 0000000..d71b1a6 Binary files /dev/null and b/flags/ws.png differ diff --git a/flags/ye.png b/flags/ye.png new file mode 100644 index 0000000..e8c50f8 Binary files /dev/null and b/flags/ye.png differ diff --git a/flags/yt.png b/flags/yt.png new file mode 100644 index 0000000..2d0efbd Binary files /dev/null and b/flags/yt.png differ diff --git a/flags/za.png b/flags/za.png new file mode 100644 index 0000000..695b53e Binary files /dev/null and b/flags/za.png differ diff --git a/flags/zm.png b/flags/zm.png new file mode 100644 index 0000000..2fff587 Binary files /dev/null and b/flags/zm.png differ diff --git a/flags/zw.png b/flags/zw.png new file mode 100644 index 0000000..76af07f Binary files /dev/null and b/flags/zw.png differ diff --git a/minitube.pro b/minitube.pro index 1846c02..e229cce 100644 --- a/minitube.pro +++ b/minitube.pro @@ -1,4 +1,4 @@ -CONFIG += release +CONFIG += debug TEMPLATE = app VERSION = 2.0 DEFINES += APP_VERSION="$$VERSION" @@ -13,15 +13,11 @@ DEFINES += QT_USE_FAST_CONCATENATION DEFINES += QT_USE_FAST_OPERATOR_PLUS DEFINES += QT_STRICT_ITERATORS -# TODO Saner string behaviour -# DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII TARGET = minitube -QT += network xml phonon declarative +QT += network xml phonon include(src/qtsingleapplication/qtsingleapplication.pri) HEADERS += \ - src/youtubesearch.h \ src/video.h \ - src/youtubestreamreader.h \ src/searchlineedit.h \ src/urllineedit.h \ src/spacer.h \ @@ -32,7 +28,6 @@ HEADERS += \ src/videomimedata.h \ src/global.h \ src/updatechecker.h \ - src/playlistwidget.h \ src/searchparams.h \ src/minisplitter.h \ src/loadingwidget.h \ @@ -48,7 +43,6 @@ HEADERS += \ src/downloadmodel.h \ src/downloadlistview.h \ src/downloadsettings.h \ - src/youtubesuggest.h \ src/suggester.h \ src/channelsuggest.h \ src/temporary.h \ @@ -59,17 +53,25 @@ HEADERS += \ src/sidebarwidget.h \ src/homeview.h \ src/aboutview.h \ - src/listmodel.h \ src/mainwindow.h \ src/mediaview.h \ src/searchview.h \ src/view.h \ - src/categoriesview.h \ src/userview.h \ - src/youtubecategories.h + src/playlistmodel.h \ + src/videosource.h \ + src/ytsearch.h \ + src/ytstandardfeed.h \ + src/standardfeedsview.h \ + src/ytregions.h \ + src/ytcategories.h \ + src/ytfeedreader.h \ + src/ytsuggester.h \ + src/videosourcewidget.h \ + src/regionsview.h \ + src/ytsinglevideosource.h \ + src/sidebarheader.h SOURCES += src/main.cpp \ - src/youtubesearch.cpp \ - src/youtubestreamreader.cpp \ src/searchlineedit.cpp \ src/urllineedit.cpp \ src/spacer.cpp \ @@ -78,7 +80,6 @@ SOURCES += src/main.cpp \ src/videomimedata.cpp \ src/updatechecker.cpp \ src/networkaccess.cpp \ - src/playlistwidget.cpp \ src/searchparams.cpp \ src/minisplitter.cpp \ src/loadingwidget.cpp \ @@ -95,7 +96,6 @@ SOURCES += src/main.cpp \ src/downloadmodel.cpp \ src/downloadlistview.cpp \ src/downloadsettings.cpp \ - src/youtubesuggest.cpp \ src/channelsuggest.cpp \ src/temporary.cpp \ src/segmentedcontrol.cpp \ @@ -106,13 +106,23 @@ SOURCES += src/main.cpp \ src/homeview.cpp \ src/mainwindow.cpp \ src/mediaview.cpp \ - src/listmodel.cpp \ src/aboutview.cpp \ src/searchview.cpp \ - src/categoriesview.cpp \ src/userview.cpp \ src/playlistitemdelegate.cpp \ - src/youtubecategories.cpp + src/playlistmodel.cpp \ + src/videosource.cpp \ + src/ytsearch.cpp \ + src/ytstandardfeed.cpp \ + src/standardfeedsview.cpp \ + src/ytregions.cpp \ + src/ytcategories.cpp \ + src/ytfeedreader.cpp \ + src/ytsuggester.cpp \ + src/videosourcewidget.cpp \ + src/regionsview.cpp \ + src/ytsinglevideosource.cpp \ + src/sidebarheader.cpp RESOURCES += resources.qrc DESTDIR = build/target/ OBJECTS_DIR = build/obj/ @@ -174,6 +184,3 @@ unix:!mac { icon512.files += data/512x512/minitube.png } mac|win32:include(local/local.pri) - -OTHER_FILES += \ - qml/categories.qml diff --git a/resources.qrc b/resources.qrc index 5961a8f..8206127 100644 --- a/resources.qrc +++ b/resources.qrc @@ -6,6 +6,53 @@ images/search-sortBy.png images/search-quality.png images/search-duration.png - qml/categories.qml + flags/dz.png + flags/ar.png + flags/au.png + flags/be.png + flags/br.png + flags/ca.png + flags/cl.png + flags/co.png + flags/cz.png + flags/eg.png + flags/fr.png + flags/de.png + flags/gh.png + flags/gr.png + flags/hk.png + flags/hu.png + flags/in.png + flags/id.png + flags/ie.png + flags/il.png + flags/it.png + flags/jp.png + flags/jo.png + flags/ke.png + flags/my.png + flags/mx.png + flags/ma.png + flags/nl.png + flags/nz.png + flags/ng.png + flags/pe.png + flags/ph.png + flags/pl.png + flags/ru.png + flags/sa.png + flags/sg.png + flags/za.png + flags/kr.png + flags/es.png + flags/se.png + flags/tw.png + flags/tn.png + flags/tr.png + flags/ug.png + flags/ae.png + flags/gb.png + flags/ye.png + style.css diff --git a/src/downloadmodel.cpp b/src/downloadmodel.cpp index 702711e..2031d3f 100644 --- a/src/downloadmodel.cpp +++ b/src/downloadmodel.cpp @@ -2,7 +2,7 @@ #include "downloadmanager.h" #include "downloaditem.h" #include "video.h" -#include "listmodel.h" +#include "playlistmodel.h" DownloadModel::DownloadModel(DownloadManager *downloadManager, QObject *parent) : QAbstractListModel(parent), diff --git a/src/downloadview.cpp b/src/downloadview.cpp index 11b7400..42db96b 100644 --- a/src/downloadview.cpp +++ b/src/downloadview.cpp @@ -4,7 +4,7 @@ #include "downloadlistview.h" #include "downloaditem.h" #include "downloadsettings.h" -#include "listmodel.h" +#include "playlistmodel.h" #include "playlistitemdelegate.h" #include "segmentedcontrol.h" diff --git a/src/homeview.cpp b/src/homeview.cpp new file mode 100644 index 0000000..f7ad71a --- /dev/null +++ b/src/homeview.cpp @@ -0,0 +1,107 @@ +#include "homeview.h" +#include "segmentedcontrol.h" +#include "searchview.h" +#include "standardfeedsview.h" +#include "userview.h" +#include "mainwindow.h" +#include "mediaview.h" +#include "ytstandardfeed.h" + +HomeView::HomeView(QWidget *parent) : QWidget(parent) { + standardFeedsView = 0; + userView = 0; + + QBoxLayout *layout = new QVBoxLayout(this); + layout->setMargin(0); + layout->setSpacing(0); + + setupBar(); + layout->addWidget(bar); + + stackedWidget = new QStackedWidget(); + layout->addWidget(stackedWidget); + + searchView = new SearchView(); + connect(searchView, SIGNAL(search(SearchParams*)), + MainWindow::instance(), SLOT(showMedia(SearchParams*))); + stackedWidget->addWidget(searchView); +} + +void HomeView::setupBar() { + bar = new SegmentedControl(this); + + QAction *action = new QAction(tr("Search"), this); + action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_1)); + action->setStatusTip(tr("Find videos and channels by keyword")); + connect(action, SIGNAL(triggered()), SLOT(showSearch())); + bar->addAction(action); + bar->setCheckedAction(action); + + action = new QAction(tr("Categories"), this); + action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_2)); + action->setStatusTip(tr("Browse videos by category")); + connect(action, SIGNAL(triggered()), SLOT(showStandardFeeds())); + bar->addAction(action); + + /* + action = new QAction(tr("User"), this); + action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_3)); + action->setStatusTip(tr("Your favorite videos, subscriptions and playlists")); + connect(action, SIGNAL(triggered()), SLOT(showUser())); + bar->addAction(action); + */ + + foreach (QAction* action, bar->actions()) { + // action->setEnabled(false); + addAction(action); + action->setAutoRepeat(false); + if (!action->shortcut().isEmpty()) + action->setStatusTip( + action->statusTip() + " (" + + action->shortcut().toString(QKeySequence::NativeText) + ")"); + } +} + +void HomeView::showWidget(QWidget *widget) { + QWidget* currentWidget = stackedWidget->currentWidget(); + if (currentWidget == widget) return; + QMetaObject::invokeMethod(currentWidget, "disappear"); + currentWidget->setEnabled(false); + stackedWidget->setCurrentWidget(widget); + widget->setEnabled(true); + QMetaObject::invokeMethod(widget, "appear"); + bar->setCheckedAction(stackedWidget->currentIndex()); + // autoChosenView = false; + widget->setFocus(); +} + +void HomeView::appear() { + QMetaObject::invokeMethod(stackedWidget->currentWidget(), "appear"); +} + +void HomeView::disappear() { + QMetaObject::invokeMethod(stackedWidget->currentWidget(), "disappear"); +} + +void HomeView::showSearch() { + showWidget(searchView); +} + +void HomeView::showStandardFeeds() { + if (!standardFeedsView) { + standardFeedsView = new StandardFeedsView(); + connect(standardFeedsView, SIGNAL(activated(VideoSource*)), + MainWindow::instance(), + SLOT(showMedia(VideoSource*))); + stackedWidget->addWidget(standardFeedsView); + } + showWidget(standardFeedsView); +} + +void HomeView::showUser() { + if (!userView) { + userView = new UserView(this); + stackedWidget->addWidget(userView); + } + showWidget(userView); +} diff --git a/src/homeview.h b/src/homeview.h new file mode 100644 index 0000000..20cb46d --- /dev/null +++ b/src/homeview.h @@ -0,0 +1,40 @@ +#ifndef HOMEVIEW_H +#define HOMEVIEW_H + +#include +#include "view.h" + +class SegmentedControl; +class SearchView; +class StandardFeedsView; +class UserView; + +class HomeView : public QWidget, public View { + + Q_OBJECT + +public: + HomeView(QWidget *parent = 0); + void appear(); + void disappear(); + void showWidget(QWidget *widget); + SearchView* getSearchView() { return searchView; } + StandardFeedsView* getStandardFeedsView() { return standardFeedsView; } + +public slots: + void showSearch(); + void showStandardFeeds(); + void showUser(); + +private: + void setupBar(); + SegmentedControl *bar; + QStackedWidget *stackedWidget; + + SearchView *searchView; + StandardFeedsView *standardFeedsView; + UserView* userView; + +}; + +#endif // HOMEVIEW_H diff --git a/src/main.cpp b/src/main.cpp index 02b4abe..3513dba 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -36,13 +36,16 @@ int main(int argc, char **argv) { #ifndef Q_WS_X11 Extra::appSetup(&app); +#else + QFile cssFile(":/style.css"); + cssFile.open(QFile::ReadOnly); + QString styleSheet = QLatin1String(cssFile.readAll()); + app.setStyleSheet(styleSheet); #endif - const QString locale = QLocale::system().name(); - // qt translations QTranslator qtTranslator; - qtTranslator.load("qt_" + locale, + qtTranslator.load("qt_" + QLocale::system().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath)); app.installTranslator(&qtTranslator); @@ -52,13 +55,13 @@ int main(int argc, char **argv) { #else QString dataDir = ""; #endif - QString localeDir = qApp->applicationDirPath() + QDir::separator() + "locale"; + QString localeDir = qApp->applicationDirPath() + "/locale"; if (!QDir(localeDir).exists()) { - localeDir = dataDir + QDir::separator() + "locale"; + localeDir = dataDir + "/locale"; } // qDebug() << "Using locale dir" << localeDir << locale; QTranslator translator; - translator.load(locale, localeDir); + translator.load(QLocale::system(), localeDir); app.installTranslator(&translator); QTextCodec::setCodecForTr(QTextCodec::codecForName("utf8")); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index c427d91..d418ece 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -11,6 +11,9 @@ #include "videodefinition.h" #include "fontutils.h" #include "globalshortcuts.h" +#include "searchparams.h" +#include "videosource.h" +#include "ytsearch.h" #ifdef Q_WS_X11 #include "gnomeglobalshortcutbackend.h" #endif @@ -21,7 +24,7 @@ #include "macutils.h" #endif #include "downloadmanager.h" -#include "youtubesuggest.h" +#include "ytsuggester.h" #include "updatechecker.h" #include "temporary.h" #ifdef APP_MAC @@ -39,6 +42,9 @@ #include "activationview.h" #include "activationdialog.h" #endif +#include "ytregions.h" +#include "regionsview.h" +#include "standardfeedsview.h" static MainWindow *singleton = 0; @@ -48,12 +54,13 @@ MainWindow* MainWindow::instance() { } MainWindow::MainWindow() : - updateChecker(0), - aboutView(0), - downloadView(0), - mediaObject(0), - audioOutput(0), - m_fullscreen(false) { + updateChecker(0), + aboutView(0), + downloadView(0), + regionsView(0), + mediaObject(0), + audioOutput(0), + m_fullscreen(false) { singleton = this; @@ -66,7 +73,7 @@ MainWindow::MainWindow() : views->addWidget(homeView); // TODO make this lazy - mediaView = new MediaView(this); + mediaView = MediaView::instance(); mediaView->setEnabled(false); views->addWidget(mediaView); @@ -77,7 +84,6 @@ MainWindow::MainWindow() : createStatusBar(); initPhonon(); - mediaView->setSlider(seekSlider); mediaView->setMediaObject(mediaObject); // remove that useless menu/toolbar context menu @@ -479,8 +485,18 @@ void MainWindow::createActions() { action = new QAction(tr("&Refine Search..."), this); action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R)); action->setCheckable(true); + action->setEnabled(false); actions->insert("refine-search", action); + action = new QAction(YTRegions::worldwideRegion().name, this); + actions->insert("worldwide-region", action); + + action = new QAction(YTRegions::localRegion().name, this); + actions->insert("local-region", action); + + action = new QAction(tr("More..."), this); + actions->insert("more-region", action); + #ifdef APP_ACTIVATION Extra::createActivationAction(tr("Buy %1...").arg(Constants::NAME)); #endif @@ -635,7 +651,7 @@ void MainWindow::createToolBars() { seekSlider->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred); mainToolBar->addWidget(seekSlider); -/* + /* mainToolBar->addWidget(new Spacer()); slider = new QSlider(this); slider->setOrientation(Qt::Horizontal); @@ -660,7 +676,7 @@ void MainWindow::createToolBars() { QSlider* volumeQSlider = volumeSlider->findChild(); if (volumeQSlider) volumeQSlider->setStatusTip(tr("Press %1 to raise the volume, %2 to lower it").arg( - volumeUpAct->shortcut().toString(QKeySequence::NativeText), volumeDownAct->shortcut().toString(QKeySequence::NativeText))); + volumeUpAct->shortcut().toString(QKeySequence::NativeText), volumeDownAct->shortcut().toString(QKeySequence::NativeText))); // this makes the volume slider smaller volumeSlider->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); mainToolBar->addWidget(volumeSlider); @@ -674,7 +690,7 @@ void MainWindow::createToolBars() { toolbarSearch = new SearchLineEdit(this); #endif toolbarSearch->setMinimumWidth(toolbarSearch->fontInfo().pixelSize()*15); - toolbarSearch->setSuggester(new YouTubeSuggest(this)); + toolbarSearch->setSuggester(new YTSuggester(this)); connect(toolbarSearch, SIGNAL(search(const QString&)), this, SLOT(startToolbarSearch(const QString&))); connect(toolbarSearch, SIGNAL(suggestionAccepted(const QString&)), SLOT(startToolbarSearch(const QString&))); toolbarSearch->setStatusTip(searchFocusAct->statusTip()); @@ -691,13 +707,42 @@ void MainWindow::createToolBars() { } void MainWindow::createStatusBar() { - QToolBar* toolBar = new QToolBar(this); - statusToolBar = toolBar; - toolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); - toolBar->setIconSize(QSize(16, 16)); - toolBar->addAction(The::globalActions()->value("downloads")); - toolBar->addAction(The::globalActions()->value("definition")); - statusBar()->addPermanentWidget(toolBar); + statusToolBar = new QToolBar(this); + statusToolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); + statusToolBar->setIconSize(QSize(16, 16)); + statusToolBar->addAction(The::globalActions()->value("downloads")); + + regionButton = new QToolButton(this); + regionButton->setStatusTip(tr("Choose your content location")); + regionButton->setIcon(QtIconLoader::icon("go-down")); + regionButton->setIconSize(QSize(16, 16)); + regionButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); + regionAction = statusToolBar->addWidget(regionButton); + regionAction->setVisible(false); + + QAction *localAction = The::globalActions()->value("local-region"); + if (!localAction->text().isEmpty()) { + regionButton->setPopupMode(QToolButton::InstantPopup); + QMenu *regionMenu = new QMenu(this); + regionMenu->addAction(The::globalActions()->value("worldwide-region")); + regionMenu->addAction(localAction); + regionMenu->addSeparator(); + QAction *moreRegionsAction = The::globalActions()->value("more-region"); + regionMenu->addAction(moreRegionsAction); + connect(moreRegionsAction, SIGNAL(triggered()), SLOT(showRegionsView())); + regionButton->setMenu(regionMenu); + } else { + connect(regionButton, SIGNAL(clicked()), SLOT(showRegionsView())); + } + + /* Stupid code that generates the QRC items + foreach(YTRegion r, YTRegions::list()) + qDebug() << QString("flags/%1.png").arg(r.id.toLower()); + */ + + statusToolBar->addAction(The::globalActions()->value("definition")); + + statusBar()->addPermanentWidget(statusToolBar); statusBar()->show(); } @@ -719,7 +764,7 @@ void MainWindow::readSettings() { if (settings.contains("geometry")) { restoreGeometry(settings.value("geometry").toByteArray()); #ifdef APP_MAC - MacSupport::fixGeometry(this); + MacSupport::fixGeometry(this); #endif } else { setGeometry(100, 100, 1000, 500); @@ -770,8 +815,9 @@ void MainWindow::showWidget(QWidget* widget, bool transition) { newView->appear(); QHash metadata = newView->metadata(); QString title = metadata.value("title").toString(); - if (!title.isEmpty()) title += " - "; - setWindowTitle(title + Constants::NAME); + if (title.isEmpty()) title = Constants::NAME; + else title += QLatin1String(" - ") + Constants::NAME; + setWindowTitle(title); QString desc = metadata.value("description").toString(); if (!desc.isEmpty()) showMessage(desc); } @@ -811,7 +857,8 @@ void MainWindow::showWidget(QWidget* widget, bool transition) { widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); #ifndef Q_WS_X11 - if (transition) Extra::fadeInWidget(oldWidget, widget); + if (transition && oldWidget != mediaView) + Extra::fadeInWidget(oldWidget, widget); #endif history->push(widget); @@ -903,6 +950,11 @@ void MainWindow::showMedia(SearchParams *searchParams) { showWidget(mediaView); } +void MainWindow::showMedia(VideoSource *videoSource) { + mediaView->setVideoSource(videoSource); + showWidget(mediaView); +} + void MainWindow::stateChanged(Phonon::State newState, Phonon::State /* oldState */) { // qDebug() << "Phonon state: " << newState; @@ -919,7 +971,7 @@ void MainWindow::stateChanged(Phonon::State newState, Phonon::State /* oldState } break; - case Phonon::PlayingState: + case Phonon::PlayingState: pauseAct->setEnabled(true); pauseAct->setIcon(QtIconLoader::icon("media-playback-pause")); pauseAct->setText(tr("&Pause")); @@ -927,12 +979,12 @@ void MainWindow::stateChanged(Phonon::State newState, Phonon::State /* oldState // stopAct->setEnabled(true); break; - case Phonon::StoppedState: + case Phonon::StoppedState: pauseAct->setEnabled(false); // stopAct->setEnabled(false); break; - case Phonon::PausedState: + case Phonon::PausedState: pauseAct->setEnabled(true); pauseAct->setIcon(QtIconLoader::icon("media-playback-start")); pauseAct->setText(tr("&Play")); @@ -940,15 +992,15 @@ void MainWindow::stateChanged(Phonon::State newState, Phonon::State /* oldState // stopAct->setEnabled(true); break; - case Phonon::BufferingState: - case Phonon::LoadingState: + case Phonon::BufferingState: + case Phonon::LoadingState: pauseAct->setEnabled(false); currentTime->clear(); totalTime->clear(); // stopAct->setEnabled(true); break; - default: + default: ; } } @@ -1305,11 +1357,11 @@ void MainWindow::toggleDownloads(bool show) { if (show) { stopAct->setShortcuts(QList() << QKeySequence(Qt::Key_MediaStop)); The::globalActions()->value("downloads")->setShortcuts( - QList() << QKeySequence(Qt::CTRL + Qt::Key_J) - << QKeySequence(Qt::Key_Escape)); + QList() << QKeySequence(Qt::CTRL + Qt::Key_J) + << QKeySequence(Qt::Key_Escape)); } else { The::globalActions()->value("downloads")->setShortcuts( - QList() << QKeySequence(Qt::CTRL + Qt::Key_J)); + QList() << QKeySequence(Qt::CTRL + Qt::Key_J)); stopAct->setShortcuts(QList() << QKeySequence(Qt::Key_Escape) << QKeySequence(Qt::Key_MediaStop)); } @@ -1342,7 +1394,7 @@ void MainWindow::dragEnterEvent(QDragEnterEvent *event) { if (urls.isEmpty()) return; QUrl url = urls.first(); - QString videoId = YouTubeSearch::videoIdFromUrl(url.toString()); + QString videoId = YTSearch::videoIdFromUrl(url.toString()); if (!videoId.isNull()) event->acceptProposedAction(); } @@ -1353,7 +1405,7 @@ void MainWindow::dropEvent(QDropEvent *event) { if (urls.isEmpty()) return; QUrl url = urls.first(); - QString videoId = YouTubeSearch::videoIdFromUrl(url.toString()); + QString videoId = YTSearch::videoIdFromUrl(url.toString()); if (!videoId.isNull()) { setWindowTitle(url.toString()); SearchParams *searchParams = new SearchParams(); @@ -1507,3 +1559,13 @@ void MainWindow::hideBuyAction() { action->setEnabled(false); } #endif + +void MainWindow::showRegionsView() { + if (!regionsView) { + regionsView = new RegionsView(this); + connect(regionsView, SIGNAL(regionChanged()), + homeView->getStandardFeedsView(), SLOT(load())); + views->addWidget(regionsView); + } + showWidget(regionsView); +} diff --git a/src/mainwindow.h b/src/mainwindow.h index cdb66f5..1602748 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -14,6 +14,7 @@ class DownloadView; class SearchLineEdit; class UpdateChecker; class SearchParams; +class VideoSource; class MainWindow : public QMainWindow { @@ -27,10 +28,15 @@ public: void readSettings(); void writeSettings(); static void printHelp(); + MediaView* getMediaView() { return mediaView; } + QToolButton* getRegionButton() { return regionButton; } + QAction* getRegionAction() { return regionAction; } public slots: void showHome(bool transition = true); void showMedia(SearchParams *params); + void showMedia(VideoSource *videoSource); + void showRegionsView(); void restore(); void messageReceived(const QString &message); void quit(); @@ -115,6 +121,7 @@ private: MediaView *mediaView; QWidget *aboutView; QWidget *downloadView; + QWidget *regionsView; // actions QAction *addGadgetAct; @@ -153,10 +160,12 @@ private: QMenu *playlistMenu; QMenu *helpMenu; - // toolbar + // toolbar & statusbar QToolBar *mainToolBar; SearchLineEdit *toolbarSearch; QToolBar *statusToolBar; + QToolButton *regionButton; + QAction *regionAction; // phonon Phonon::SeekSlider *seekSlider; @@ -166,11 +175,10 @@ private: QLabel *currentTime; QLabel *totalTime; + // fullscreen bool m_fullscreen; bool m_maximized; - QTimer *mouseTimer; - }; #endif diff --git a/src/mediaview.cpp b/src/mediaview.cpp index 32540b3..6346961 100644 --- a/src/mediaview.cpp +++ b/src/mediaview.cpp @@ -1,6 +1,8 @@ #include "mediaview.h" +#include "playlistmodel.h" #include "playlistview.h" -#include "playlistitemdelegate.h" +#include "loadingwidget.h" +#include "videoareawidget.h" #include "networkaccess.h" #include "videowidget.h" #include "minisplitter.h" @@ -9,75 +11,67 @@ #include "downloaditem.h" #include "mainwindow.h" #include "temporary.h" -#include "sidebarwidget.h" -#include "playlistwidget.h" #include "refinesearchwidget.h" #include "sidebarwidget.h" +#include "sidebarheader.h" #ifdef APP_MAC #include "macfullscreen.h" +#include "macutils.h" #endif #ifdef APP_ACTIVATION #include "activation.h" #endif +#include "videosource.h" +#include "ytsearch.h" +#include "searchparams.h" +#include "ytsinglevideosource.h" namespace The { NetworkAccess* http(); -} - -namespace The { QMap* globalActions(); QMap* globalMenus(); QNetworkAccessManager* networkAccessManager(); } -MediaView::MediaView(QWidget *parent) : QWidget(parent) { +MediaView* MediaView::instance() { + static MediaView *i = new MediaView(); + return i; +} +MediaView::MediaView(QWidget *parent) : QWidget(parent) { reallyStopped = false; downloadItem = 0; - QBoxLayout *layout = new QVBoxLayout(); + QBoxLayout *layout = new QVBoxLayout(this); layout->setMargin(0); - splitter = new MiniSplitter(this); + splitter = new MiniSplitter(); splitter->setChildrenCollapsible(false); - listView = new PlaylistView(this); - listView->setItemDelegate(new PlaylistItemDelegate(this)); - listView->setSelectionMode(QAbstractItemView::ExtendedSelection); - - // dragndrop - listView->setDragEnabled(true); - listView->setAcceptDrops(true); - listView->setDropIndicatorShown(true); - listView->setDragDropMode(QAbstractItemView::DragDrop); - - // cosmetics - listView->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); - listView->setFrameShape( QFrame::NoFrame ); - listView->setAttribute(Qt::WA_MacShowFocusRect, false); - listView->setMinimumSize(320,240); - listView->setUniformItemSizes(true); - + playlistView = new PlaylistView(this); // respond to the user doubleclicking a playlist item - connect(listView, SIGNAL(activated(const QModelIndex &)), this, SLOT(itemActivated(const QModelIndex &))); + connect(playlistView, SIGNAL(activated(const QModelIndex &)), + SLOT(itemActivated(const QModelIndex &))); - listModel = new ListModel(this); - connect(listModel, SIGNAL(activeRowChanged(int)), this, SLOT(activeRowChanged(int))); + playlistModel = new PlaylistModel(); + connect(playlistModel, SIGNAL(activeRowChanged(int)), + SLOT(activeRowChanged(int))); // needed to restore the selection after dragndrop - connect(listModel, SIGNAL(needSelectionFor(QList)), this, SLOT(selectVideos(QList))); - listView->setModel(listModel); + connect(playlistModel, SIGNAL(needSelectionFor(QList)), + SLOT(selectVideos(QList))); + playlistView->setModel(playlistModel); - connect(listView->selectionModel(), - SIGNAL(selectionChanged ( const QItemSelection & , const QItemSelection & )), - this, SLOT(selectionChanged ( const QItemSelection & , const QItemSelection & ))); + connect(playlistView->selectionModel(), + SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)), + SLOT(selectionChanged(const QItemSelection &, const QItemSelection &))); - connect(listView, SIGNAL(authorPushed(QModelIndex)), SLOT(authorPushed(QModelIndex))); + connect(playlistView, SIGNAL(authorPushed(QModelIndex)), SLOT(authorPushed(QModelIndex))); sidebar = new SidebarWidget(this); - sidebar->setPlaylist(listView); + sidebar->setPlaylist(playlistView); connect(sidebar->getRefineSearchWidget(), SIGNAL(searchRefined()), SLOT(searchAgain())); - connect(listModel, SIGNAL(haveSuggestions(const QStringList &)), + connect(playlistModel, SIGNAL(haveSuggestions(const QStringList &)), sidebar, SLOT(showSuggestions(const QStringList &))); connect(sidebar, SIGNAL(suggestionAccepted(QString)), MainWindow::instance(), SLOT(startToolbarSearch(QString))); @@ -87,7 +81,7 @@ MediaView::MediaView(QWidget *parent) : QWidget(parent) { videoAreaWidget->setMinimumSize(320,240); videoWidget = new Phonon::VideoWidget(this); videoAreaWidget->setVideoWidget(videoWidget); - videoAreaWidget->setListModel(listModel); + videoAreaWidget->setListModel(playlistModel); loadingWidget = new LoadingWidget(this); videoAreaWidget->setLoadingWidget(loadingWidget); @@ -95,7 +89,6 @@ MediaView::MediaView(QWidget *parent) : QWidget(parent) { splitter->addWidget(videoAreaWidget); layout->addWidget(splitter); - setLayout(layout); splitter->setStretchFactor(0, 1); splitter->setStretchFactor(1, 6); @@ -109,11 +102,6 @@ MediaView::MediaView(QWidget *parent) : QWidget(parent) { errorTimer->setInterval(3000); connect(errorTimer, SIGNAL(timeout()), SLOT(skipVideo())); - workaroundTimer = new QTimer(this); - workaroundTimer->setSingleShot(true); - workaroundTimer->setInterval(3000); - connect(workaroundTimer, SIGNAL(timeout()), SLOT(timerPlay())); - #ifdef APP_ACTIVATION demoTimer = new QTimer(this); demoTimer->setSingleShot(true); @@ -123,13 +111,8 @@ MediaView::MediaView(QWidget *parent) : QWidget(parent) { } void MediaView::initialize() { - connect(videoAreaWidget, SIGNAL(doubleClicked()), The::globalActions()->value("fullscreen"), SLOT(trigger())); - - /* - videoAreaWidget->setContextMenuPolicy(Qt::CustomContextMenu); - connect(videoAreaWidget, SIGNAL(customContextMenuRequested(QPoint)), - this, SLOT(showVideoContextMenu(QPoint))); - */ + connect(videoAreaWidget, SIGNAL(doubleClicked()), + The::globalActions()->value("fullscreen"), SLOT(trigger())); QAction* refineSearchAction = The::globalActions()->value("refine-search"); connect(refineSearchAction, SIGNAL(toggled(bool)), @@ -138,121 +121,131 @@ void MediaView::initialize() { void MediaView::setMediaObject(Phonon::MediaObject *mediaObject) { this->mediaObject = mediaObject; - Phonon::createPath(this->mediaObject, videoWidget); - connect(mediaObject, SIGNAL(finished()), this, SLOT(playbackFinished())); + Phonon::createPath(mediaObject, videoWidget); + connect(mediaObject, SIGNAL(finished()), SLOT(playbackFinished())); connect(mediaObject, SIGNAL(stateChanged(Phonon::State, Phonon::State)), - this, SLOT(stateChanged(Phonon::State, Phonon::State))); + SLOT(stateChanged(Phonon::State, Phonon::State))); connect(mediaObject, SIGNAL(currentSourceChanged(Phonon::MediaSource)), - this, SLOT(currentSourceChanged(Phonon::MediaSource))); - // connect(mediaObject, SIGNAL(bufferStatus(int)), loadingWidget, SLOT(bufferStatus(int))); + SLOT(currentSourceChanged(Phonon::MediaSource))); connect(mediaObject, SIGNAL(aboutToFinish()), SLOT(aboutToFinish())); } +SearchParams* MediaView::getSearchParams() { + VideoSource *videoSource = playlistModel->getVideoSource(); + if (videoSource && videoSource->metaObject()->className() == QLatin1String("YTSearch")) { + YTSearch *search = dynamic_cast(videoSource); + return search->getSearchParams(); + } + return 0; +} + void MediaView::search(SearchParams *searchParams) { + if (!searchParams->keywords().isEmpty()) { + if (searchParams->keywords().startsWith("http://") || + searchParams->keywords().startsWith("https://")) { + QString videoId = YTSearch::videoIdFromUrl(searchParams->keywords()); + if (!videoId.isEmpty()) { + qDebug() << "single video"; + YTSingleVideoSource *singleVideoSource = new YTSingleVideoSource(this); + singleVideoSource->setVideoId(videoId); + setVideoSource(singleVideoSource); + return; + } + } + } + setVideoSource(new YTSearch(searchParams, this)); +} + +void MediaView::setVideoSource(VideoSource *videoSource, bool addToHistory) { reallyStopped = false; #ifdef APP_ACTIVATION demoTimer->stop(); #endif - workaroundTimer->stop(); errorTimer->stop(); - this->searchParams = searchParams; + if (addToHistory) { + int currentIndex = getHistoryIndex(); + if (currentIndex >= 0 && currentIndex < history.size() - 1) { + for (int i = currentIndex + 1; i < history.size(); i++) { + VideoSource *vs = history.takeAt(i); + if (!vs->parent()) delete vs; + } + } + history.append(videoSource); + } - // start serching for videos - listModel->search(searchParams); + playlistModel->setVideoSource(videoSource); sidebar->showPlaylist(); - listView->setFocus(); - - QString keyword = searchParams->keywords(); - QString display = keyword; - if (keyword.startsWith("http://") || keyword.startsWith("https://")) { - int separator = keyword.indexOf("|"); - if (separator > 0 && separator + 1 < keyword.length()) { - display = keyword.mid(separator+1); + sidebar->getRefineSearchWidget()->setSearchParams(getSearchParams()); + sidebar->hideSuggestions(); + sidebar->getHeader()->updateInfo(); + + SearchParams *searchParams = getSearchParams(); + bool isChannel = searchParams && !searchParams->author().isEmpty(); + playlistView->setClickableAuthors(!isChannel); +} + +void MediaView::searchAgain() { + VideoSource *currentVideoSource = playlistModel->getVideoSource(); + setVideoSource(currentVideoSource, false); +} + +bool MediaView::canGoBack() { + return getHistoryIndex() > 0; +} + +void MediaView::goBack() { + if (history.size() > 1) { + int currentIndex = getHistoryIndex(); + if (currentIndex > 0) { + VideoSource *previousVideoSource = history.at(currentIndex - 1); + setVideoSource(previousVideoSource, false); } } +} - sidebar->getRefineSearchWidget()->setSearchParams(searchParams); - sidebar->hideSuggestions(); +bool MediaView::canGoForward() { + int currentIndex = getHistoryIndex(); + return currentIndex >= 0 && currentIndex < history.size() - 1; +} +void MediaView::goForward() { + if (canGoForward()) { + int currentIndex = getHistoryIndex(); + VideoSource *nextVideoSource = history.at(currentIndex + 1); + setVideoSource(nextVideoSource, false); + } } -void MediaView::searchAgain() { - search(searchParams); +int MediaView::getHistoryIndex() { + return history.lastIndexOf(playlistModel->getVideoSource()); } void MediaView::appear() { - listView->setFocus(); + playlistView->setFocus(); } void MediaView::disappear() { - timerPlayFlag = true; + } void MediaView::handleError(QString /* message */) { - QTimer::singleShot(500, this, SLOT(startPlaying())); - - /* - videoAreaWidget->showError(message); - skippedVideo = listModel->activeVideo(); - // recover from errors by skipping to the next video - errorTimer->start(2000); - */ } void MediaView::stateChanged(Phonon::State newState, Phonon::State /*oldState*/) { - // qDebug() << "Phonon state: " << newState; - // slider->setEnabled(newState == Phonon::PlayingState); - - switch (newState) { - - case Phonon::ErrorState: + if (newState == Phonon::PlayingState) + videoAreaWidget->showVideo(); + else if (newState == Phonon::ErrorState) { qDebug() << "Phonon error:" << mediaObject->errorString() << mediaObject->errorType(); if (mediaObject->errorType() == Phonon::FatalError) handleError(mediaObject->errorString()); - break; - - case Phonon::PlayingState: - // qDebug("playing"); - videoAreaWidget->showVideo(); - break; - - case Phonon::StoppedState: - // qDebug("stopped"); - // play() has already been called when setting the source - // but Phonon on Linux needs a little more help to start playback - // if (!reallyStopped) mediaObject->play(); - -#ifdef APP_MAC - // Workaround for Mac playback start problem - if (!timerPlayFlag) { - // workaroundTimer->start(); - } -#endif - - break; - - case Phonon::PausedState: - qDebug("paused"); - break; - - case Phonon::BufferingState: - qDebug("buffering"); - break; - - case Phonon::LoadingState: - qDebug("loading"); - break; - } } void MediaView::pause() { - // qDebug() << "pause() called" << mediaObject->state(); - switch( mediaObject->state() ) { case Phonon::PlayingState: mediaObject->pause(); @@ -261,7 +254,6 @@ void MediaView::pause() { mediaObject->play(); break; } - } QRegExp MediaView::wordRE(QString s) { @@ -269,60 +261,68 @@ QRegExp MediaView::wordRE(QString s) { } void MediaView::stop() { - listModel->abortSearch(); + playlistModel->abortSearch(); reallyStopped = true; mediaObject->stop(); videoAreaWidget->clear(); - workaroundTimer->stop(); errorTimer->stop(); - listView->selectionModel()->clearSelection(); + playlistView->selectionModel()->clearSelection(); if (downloadItem) { downloadItem->stop(); delete downloadItem; downloadItem = 0; } The::globalActions()->value("refine-search")->setChecked(false); + + while (!history.isEmpty()) { + VideoSource *videoSource = history.takeFirst(); + if (!videoSource->parent()) delete videoSource; + } } void MediaView::activeRowChanged(int row) { if (reallyStopped) return; - Video *video = listModel->videoAt(row); + Video *video = playlistModel->videoAt(row); if (!video) return; - // now that we have a new video to play - // stop all the timers - workaroundTimer->stop(); + // Related videos without video interruption + if (row == 0) { + VideoSource *videoSource = playlistModel->getVideoSource(); + if (videoSource && !history.isEmpty() && + mediaObject->state() == Phonon::PlayingState && + videoSource->metaObject()->className() == QLatin1String("YTSingleVideoSource")) { + if (playlistModel->videoAt(row)->title() == downloadItem->getVideo()->title()) + return; + } + } + errorTimer->stop(); + videoAreaWidget->showLoading(video); + mediaObject->stop(); if (downloadItem) { downloadItem->stop(); delete downloadItem; downloadItem = 0; } - // slider->setMinimum(0); - - // immediately show the loading widget - videoAreaWidget->showLoading(video); - connect(video, SIGNAL(gotStreamUrl(QUrl)), SLOT(gotStreamUrl(QUrl)), Qt::UniqueConnection); - // TODO handle signal in a proper slot and impl item error status - connect(video, SIGNAL(errorStreamUrl(QString)), SLOT(handleError(QString)), Qt::UniqueConnection); + connect(video, SIGNAL(gotStreamUrl(QUrl)), + SLOT(gotStreamUrl(QUrl)), Qt::UniqueConnection); + connect(video, SIGNAL(errorStreamUrl(QString)), + SLOT(handleError(QString)), Qt::UniqueConnection); video->loadStreamUrl(); - // reset the timer flag - timerPlayFlag = false; - // video title in the statusbar MainWindow::instance()->showMessage(video->title()); // ensure active item is visible // int row = listModel->activeRow(); if (row != -1) { - QModelIndex index = listModel->index(row, 0, QModelIndex()); - listView->scrollTo(index, QAbstractItemView::EnsureVisible); + QModelIndex index = playlistModel->index(row, 0, QModelIndex()); + playlistView->scrollTo(index, QAbstractItemView::EnsureVisible); } // enable/disable actions @@ -340,7 +340,7 @@ void MediaView::gotStreamUrl(QUrl streamUrl) { Video *video = static_cast