mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 20:14:05 +00:00
reorganization of Groups dialog (unstable - needs to be checked)
This commit is contained in:
parent
dae521a262
commit
f5f23ff4b2
502
src/flags.qrc
502
src/flags.qrc
|
@ -1,252 +1,254 @@
|
|||
<RCC>
|
||||
<qresource>
|
||||
<file>flags/wiki.png</file>
|
||||
<file>flags/ad.png</file>
|
||||
<file>flags/ae.png</file>
|
||||
<file>flags/af.png</file>
|
||||
<file>flags/ag.png</file>
|
||||
<file>flags/ai.png</file>
|
||||
<file>flags/al.png</file>
|
||||
<file>flags/am.png</file>
|
||||
<file>flags/an.png</file>
|
||||
<file>flags/ao.png</file>
|
||||
<file>flags/ar.png</file>
|
||||
<file>flags/as.png</file>
|
||||
<file>flags/at.png</file>
|
||||
<file>flags/au.png</file>
|
||||
<file>flags/aw.png</file>
|
||||
<file>flags/ax.png</file>
|
||||
<file>flags/az.png</file>
|
||||
<file>flags/ba.png</file>
|
||||
<file>flags/bb.png</file>
|
||||
<file>flags/bd.png</file>
|
||||
<file>flags/be.png</file>
|
||||
<file>flags/bf.png</file>
|
||||
<file>flags/bg.png</file>
|
||||
<file>flags/bh.png</file>
|
||||
<file>flags/bi.png</file>
|
||||
<file>flags/bj.png</file>
|
||||
<file>flags/bm.png</file>
|
||||
<file>flags/bn.png</file>
|
||||
<file>flags/bo.png</file>
|
||||
<file>flags/br.png</file>
|
||||
<file>flags/bs.png</file>
|
||||
<file>flags/bt.png</file>
|
||||
<file>flags/bv.png</file>
|
||||
<file>flags/bw.png</file>
|
||||
<file>flags/by.png</file>
|
||||
<file>flags/bz.png</file>
|
||||
<file>flags/ca.png</file>
|
||||
<file>flags/catalonia.png</file>
|
||||
<file>flags/cc.png</file>
|
||||
<file>flags/cd.png</file>
|
||||
<file>flags/cf.png</file>
|
||||
<file>flags/cg.png</file>
|
||||
<file>flags/ch.png</file>
|
||||
<file>flags/ci.png</file>
|
||||
<file>flags/ck.png</file>
|
||||
<file>flags/cl.png</file>
|
||||
<file>flags/cm.png</file>
|
||||
<file>flags/cn.png</file>
|
||||
<file>flags/co.png</file>
|
||||
<file>flags/cr.png</file>
|
||||
<file>flags/cs.png</file>
|
||||
<file>flags/cu.png</file>
|
||||
<file>flags/cv.png</file>
|
||||
<file>flags/cx.png</file>
|
||||
<file>flags/cy.png</file>
|
||||
<file>flags/cz.png</file>
|
||||
<file>flags/de.png</file>
|
||||
<file>flags/dj.png</file>
|
||||
<file>flags/dk.png</file>
|
||||
<file>flags/dm.png</file>
|
||||
<file>flags/do.png</file>
|
||||
<file>flags/dz.png</file>
|
||||
<file>flags/ec.png</file>
|
||||
<file>flags/ee.png</file>
|
||||
<file>flags/eg.png</file>
|
||||
<file>flags/eh.png</file>
|
||||
<file>flags/england.png</file>
|
||||
<file>flags/er.png</file>
|
||||
<file>flags/es.png</file>
|
||||
<file>flags/et.png</file>
|
||||
<file>flags/europeanunion.png</file>
|
||||
<file>flags/fam.png</file>
|
||||
<file>flags/fi.png</file>
|
||||
<file>flags/fj.png</file>
|
||||
<file>flags/fk.png</file>
|
||||
<file>flags/fm.png</file>
|
||||
<file>flags/fo.png</file>
|
||||
<file>flags/fr.png</file>
|
||||
<file>flags/ga.png</file>
|
||||
<file>flags/gb.png</file>
|
||||
<file>flags/gd.png</file>
|
||||
<file>flags/ge.png</file>
|
||||
<file>flags/gf.png</file>
|
||||
<file>flags/gh.png</file>
|
||||
<file>flags/gi.png</file>
|
||||
<file>flags/gl.png</file>
|
||||
<file>flags/gm.png</file>
|
||||
<file>flags/gn.png</file>
|
||||
<file>flags/gp.png</file>
|
||||
<file>flags/gq.png</file>
|
||||
<file>flags/gr.png</file>
|
||||
<file>flags/gs.png</file>
|
||||
<file>flags/gt.png</file>
|
||||
<file>flags/gu.png</file>
|
||||
<file>flags/gw.png</file>
|
||||
<file>flags/gy.png</file>
|
||||
<file>flags/hk.png</file>
|
||||
<file>flags/hm.png</file>
|
||||
<file>flags/hn.png</file>
|
||||
<file>flags/hr.png</file>
|
||||
<file>flags/ht.png</file>
|
||||
<file>flags/hu.png</file>
|
||||
<file>flags/id.png</file>
|
||||
<file>flags/ie.png</file>
|
||||
<file>flags/il.png</file>
|
||||
<file>flags/in.png</file>
|
||||
<file>flags/io.png</file>
|
||||
<file>flags/iq.png</file>
|
||||
<file>flags/ir.png</file>
|
||||
<file>flags/is.png</file>
|
||||
<file>flags/it.png</file>
|
||||
<file>flags/jm.png</file>
|
||||
<file>flags/jo.png</file>
|
||||
<file>flags/jp.png</file>
|
||||
<file>flags/ke.png</file>
|
||||
<file>flags/kg.png</file>
|
||||
<file>flags/kh.png</file>
|
||||
<file>flags/ki.png</file>
|
||||
<file>flags/km.png</file>
|
||||
<file>flags/kn.png</file>
|
||||
<file>flags/kp.png</file>
|
||||
<file>flags/kr.png</file>
|
||||
<file>flags/kw.png</file>
|
||||
<file>flags/ky.png</file>
|
||||
<file>flags/kz.png</file>
|
||||
<file>flags/la.png</file>
|
||||
<file>flags/lb.png</file>
|
||||
<file>flags/lc.png</file>
|
||||
<file>flags/li.png</file>
|
||||
<file>flags/lk.png</file>
|
||||
<file>flags/lr.png</file>
|
||||
<file>flags/ls.png</file>
|
||||
<file>flags/lt.png</file>
|
||||
<file>flags/lu.png</file>
|
||||
<file>flags/lv.png</file>
|
||||
<file>flags/ly.png</file>
|
||||
<file>flags/ma.png</file>
|
||||
<file>flags/mc.png</file>
|
||||
<file>flags/md.png</file>
|
||||
<file>flags/me.png</file>
|
||||
<file>flags/mg.png</file>
|
||||
<file>flags/mh.png</file>
|
||||
<file>flags/mk.png</file>
|
||||
<file>flags/ml.png</file>
|
||||
<file>flags/mm.png</file>
|
||||
<file>flags/mn.png</file>
|
||||
<file>flags/mo.png</file>
|
||||
<file>flags/mp.png</file>
|
||||
<file>flags/mq.png</file>
|
||||
<file>flags/mr.png</file>
|
||||
<file>flags/ms.png</file>
|
||||
<file>flags/mt.png</file>
|
||||
<file>flags/mu.png</file>
|
||||
<file>flags/mv.png</file>
|
||||
<file>flags/mw.png</file>
|
||||
<file>flags/mx.png</file>
|
||||
<file>flags/my.png</file>
|
||||
<file>flags/mz.png</file>
|
||||
<file>flags/na.png</file>
|
||||
<file>flags/nc.png</file>
|
||||
<file>flags/ne.png</file>
|
||||
<file>flags/nf.png</file>
|
||||
<file>flags/ng.png</file>
|
||||
<file>flags/ni.png</file>
|
||||
<file>flags/nl.png</file>
|
||||
<file>flags/no.png</file>
|
||||
<file>flags/np.png</file>
|
||||
<file>flags/nr.png</file>
|
||||
<file>flags/nu.png</file>
|
||||
<file>flags/nz.png</file>
|
||||
<file>flags/om.png</file>
|
||||
<file>flags/pa.png</file>
|
||||
<file>flags/pe.png</file>
|
||||
<file>flags/pf.png</file>
|
||||
<file>flags/pg.png</file>
|
||||
<file>flags/ph.png</file>
|
||||
<file>flags/pk.png</file>
|
||||
<file>flags/pl.png</file>
|
||||
<file>flags/pm.png</file>
|
||||
<file>flags/pn.png</file>
|
||||
<file>flags/pr.png</file>
|
||||
<file>flags/ps.png</file>
|
||||
<file>flags/pt.png</file>
|
||||
<file>flags/pw.png</file>
|
||||
<file>flags/py.png</file>
|
||||
<file>flags/qa.png</file>
|
||||
<file>flags/re.png</file>
|
||||
<file>flags/ro.png</file>
|
||||
<file>flags/rs.png</file>
|
||||
<file>flags/ru.png</file>
|
||||
<file>flags/rw.png</file>
|
||||
<file>flags/sa.png</file>
|
||||
<file>flags/sb.png</file>
|
||||
<file>flags/scotland.png</file>
|
||||
<file>flags/sc.png</file>
|
||||
<file>flags/sd.png</file>
|
||||
<file>flags/se.png</file>
|
||||
<file>flags/sg.png</file>
|
||||
<file>flags/sh.png</file>
|
||||
<file>flags/si.png</file>
|
||||
<file>flags/sj.png</file>
|
||||
<file>flags/sk.png</file>
|
||||
<file>flags/sl.png</file>
|
||||
<file>flags/sm.png</file>
|
||||
<file>flags/sn.png</file>
|
||||
<file>flags/so.png</file>
|
||||
<file>flags/sr.png</file>
|
||||
<file>flags/st.png</file>
|
||||
<file>flags/sv.png</file>
|
||||
<file>flags/sy.png</file>
|
||||
<file>flags/sz.png</file>
|
||||
<file>flags/tc.png</file>
|
||||
<file>flags/td.png</file>
|
||||
<file>flags/tf.png</file>
|
||||
<file>flags/tg.png</file>
|
||||
<file>flags/th.png</file>
|
||||
<file>flags/tj.png</file>
|
||||
<file>flags/tk.png</file>
|
||||
<file>flags/tl.png</file>
|
||||
<file>flags/tm.png</file>
|
||||
<file>flags/tn.png</file>
|
||||
<file>flags/to.png</file>
|
||||
<file>flags/tr.png</file>
|
||||
<file>flags/tt.png</file>
|
||||
<file>flags/tv.png</file>
|
||||
<file>flags/tw.png</file>
|
||||
<file>flags/tz.png</file>
|
||||
<file>flags/ua.png</file>
|
||||
<file>flags/ug.png</file>
|
||||
<file>flags/um.png</file>
|
||||
<file>flags/us.png</file>
|
||||
<file>flags/uy.png</file>
|
||||
<file>flags/uz.png</file>
|
||||
<file>flags/va.png</file>
|
||||
<file>flags/vc.png</file>
|
||||
<file>flags/ve.png</file>
|
||||
<file>flags/vg.png</file>
|
||||
<file>flags/vi.png</file>
|
||||
<file>flags/vn.png</file>
|
||||
<file>flags/vu.png</file>
|
||||
<file>flags/wales.png</file>
|
||||
<file>flags/wf.png</file>
|
||||
<file>flags/ws.png</file>
|
||||
<file>flags/ye.png</file>
|
||||
<file>flags/yt.png</file>
|
||||
<file>flags/za.png</file>
|
||||
<file>flags/zm.png</file>
|
||||
<file>flags/zw.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="/" >
|
||||
<file>flags/wiki.png</file>
|
||||
<file>flags/ad.png</file>
|
||||
<file>flags/ae.png</file>
|
||||
<file>flags/af.png</file>
|
||||
<file>flags/ag.png</file>
|
||||
<file>flags/ai.png</file>
|
||||
<file>flags/al.png</file>
|
||||
<file>flags/am.png</file>
|
||||
<file>flags/an.png</file>
|
||||
<file>flags/ao.png</file>
|
||||
<file>flags/ar.png</file>
|
||||
<file>flags/as.png</file>
|
||||
<file>flags/at.png</file>
|
||||
<file>flags/au.png</file>
|
||||
<file>flags/aw.png</file>
|
||||
<file>flags/ax.png</file>
|
||||
<file>flags/az.png</file>
|
||||
<file>flags/ba.png</file>
|
||||
<file>flags/bb.png</file>
|
||||
<file>flags/bd.png</file>
|
||||
<file>flags/be.png</file>
|
||||
<file>flags/bf.png</file>
|
||||
<file>flags/bg.png</file>
|
||||
<file>flags/bh.png</file>
|
||||
<file>flags/bi.png</file>
|
||||
<file>flags/bj.png</file>
|
||||
<file>flags/bm.png</file>
|
||||
<file>flags/bn.png</file>
|
||||
<file>flags/bo.png</file>
|
||||
<file>flags/br.png</file>
|
||||
<file>flags/bs.png</file>
|
||||
<file>flags/bt.png</file>
|
||||
<file>flags/bv.png</file>
|
||||
<file>flags/bw.png</file>
|
||||
<file>flags/by.png</file>
|
||||
<file>flags/bz.png</file>
|
||||
<file>flags/ca.png</file>
|
||||
<file>flags/catalonia.png</file>
|
||||
<file>flags/cc.png</file>
|
||||
<file>flags/cd.png</file>
|
||||
<file>flags/cf.png</file>
|
||||
<file>flags/cg.png</file>
|
||||
<file>flags/ch.png</file>
|
||||
<file>flags/ci.png</file>
|
||||
<file>flags/ck.png</file>
|
||||
<file>flags/cl.png</file>
|
||||
<file>flags/cm.png</file>
|
||||
<file>flags/cn.png</file>
|
||||
<file>flags/co.png</file>
|
||||
<file>flags/cr.png</file>
|
||||
<file>flags/cs.png</file>
|
||||
<file>flags/cu.png</file>
|
||||
<file>flags/cv.png</file>
|
||||
<file>flags/cx.png</file>
|
||||
<file>flags/cy.png</file>
|
||||
<file>flags/cz.png</file>
|
||||
<file>flags/de.png</file>
|
||||
<file>flags/dj.png</file>
|
||||
<file>flags/dk.png</file>
|
||||
<file>flags/dm.png</file>
|
||||
<file>flags/do.png</file>
|
||||
<file>flags/dz.png</file>
|
||||
<file>flags/ec.png</file>
|
||||
<file>flags/ee.png</file>
|
||||
<file>flags/eg.png</file>
|
||||
<file>flags/eh.png</file>
|
||||
<file>flags/england.png</file>
|
||||
<file>flags/er.png</file>
|
||||
<file>flags/es.png</file>
|
||||
<file>flags/et.png</file>
|
||||
<file>flags/europeanunion.png</file>
|
||||
<file>flags/fam.png</file>
|
||||
<file>flags/fi.png</file>
|
||||
<file>flags/fj.png</file>
|
||||
<file>flags/fk.png</file>
|
||||
<file>flags/fm.png</file>
|
||||
<file>flags/fo.png</file>
|
||||
<file>flags/fr.png</file>
|
||||
<file>flags/ga.png</file>
|
||||
<file>flags/gb.png</file>
|
||||
<file>flags/gd.png</file>
|
||||
<file>flags/ge.png</file>
|
||||
<file>flags/gf.png</file>
|
||||
<file>flags/gh.png</file>
|
||||
<file>flags/gi.png</file>
|
||||
<file>flags/gl.png</file>
|
||||
<file>flags/gm.png</file>
|
||||
<file>flags/gn.png</file>
|
||||
<file>flags/gp.png</file>
|
||||
<file>flags/gq.png</file>
|
||||
<file>flags/gr.png</file>
|
||||
<file>flags/gs.png</file>
|
||||
<file>flags/gt.png</file>
|
||||
<file>flags/gu.png</file>
|
||||
<file>flags/gw.png</file>
|
||||
<file>flags/gy.png</file>
|
||||
<file>flags/hk.png</file>
|
||||
<file>flags/hm.png</file>
|
||||
<file>flags/hn.png</file>
|
||||
<file>flags/hr.png</file>
|
||||
<file>flags/ht.png</file>
|
||||
<file>flags/hu.png</file>
|
||||
<file>flags/id.png</file>
|
||||
<file>flags/ie.png</file>
|
||||
<file>flags/il.png</file>
|
||||
<file>flags/in.png</file>
|
||||
<file>flags/io.png</file>
|
||||
<file>flags/iq.png</file>
|
||||
<file>flags/ir.png</file>
|
||||
<file>flags/is.png</file>
|
||||
<file>flags/it.png</file>
|
||||
<file>flags/jm.png</file>
|
||||
<file>flags/jo.png</file>
|
||||
<file>flags/jp.png</file>
|
||||
<file>flags/ke.png</file>
|
||||
<file>flags/kg.png</file>
|
||||
<file>flags/kh.png</file>
|
||||
<file>flags/ki.png</file>
|
||||
<file>flags/km.png</file>
|
||||
<file>flags/kn.png</file>
|
||||
<file>flags/kp.png</file>
|
||||
<file>flags/kr.png</file>
|
||||
<file>flags/kw.png</file>
|
||||
<file>flags/ky.png</file>
|
||||
<file>flags/kz.png</file>
|
||||
<file>flags/la.png</file>
|
||||
<file>flags/lb.png</file>
|
||||
<file>flags/lc.png</file>
|
||||
<file>flags/li.png</file>
|
||||
<file>flags/lk.png</file>
|
||||
<file>flags/lr.png</file>
|
||||
<file>flags/ls.png</file>
|
||||
<file>flags/lt.png</file>
|
||||
<file>flags/lu.png</file>
|
||||
<file>flags/lv.png</file>
|
||||
<file>flags/ly.png</file>
|
||||
<file>flags/ma.png</file>
|
||||
<file>flags/mc.png</file>
|
||||
<file>flags/md.png</file>
|
||||
<file>flags/me.png</file>
|
||||
<file>flags/mg.png</file>
|
||||
<file>flags/mh.png</file>
|
||||
<file>flags/mk.png</file>
|
||||
<file>flags/ml.png</file>
|
||||
<file>flags/mm.png</file>
|
||||
<file>flags/mn.png</file>
|
||||
<file>flags/mo.png</file>
|
||||
<file>flags/mp.png</file>
|
||||
<file>flags/mq.png</file>
|
||||
<file>flags/mr.png</file>
|
||||
<file>flags/ms.png</file>
|
||||
<file>flags/mt.png</file>
|
||||
<file>flags/mu.png</file>
|
||||
<file>flags/mv.png</file>
|
||||
<file>flags/mw.png</file>
|
||||
<file>flags/mx.png</file>
|
||||
<file>flags/my.png</file>
|
||||
<file>flags/mz.png</file>
|
||||
<file>flags/na.png</file>
|
||||
<file>flags/nc.png</file>
|
||||
<file>flags/ne.png</file>
|
||||
<file>flags/nf.png</file>
|
||||
<file>flags/ng.png</file>
|
||||
<file>flags/ni.png</file>
|
||||
<file>flags/nl.png</file>
|
||||
<file>flags/no.png</file>
|
||||
<file>flags/np.png</file>
|
||||
<file>flags/nr.png</file>
|
||||
<file>flags/nu.png</file>
|
||||
<file>flags/nz.png</file>
|
||||
<file>flags/om.png</file>
|
||||
<file>flags/pa.png</file>
|
||||
<file>flags/pe.png</file>
|
||||
<file>flags/pf.png</file>
|
||||
<file>flags/pg.png</file>
|
||||
<file>flags/ph.png</file>
|
||||
<file>flags/pk.png</file>
|
||||
<file>flags/pl.png</file>
|
||||
<file>flags/pm.png</file>
|
||||
<file>flags/pn.png</file>
|
||||
<file>flags/pr.png</file>
|
||||
<file>flags/ps.png</file>
|
||||
<file>flags/pt.png</file>
|
||||
<file>flags/pw.png</file>
|
||||
<file>flags/py.png</file>
|
||||
<file>flags/qa.png</file>
|
||||
<file>flags/re.png</file>
|
||||
<file>flags/ro.png</file>
|
||||
<file>flags/rs.png</file>
|
||||
<file>flags/ru.png</file>
|
||||
<file>flags/rw.png</file>
|
||||
<file>flags/sa.png</file>
|
||||
<file>flags/sb.png</file>
|
||||
<file>flags/scotland.png</file>
|
||||
<file>flags/sc.png</file>
|
||||
<file>flags/sd.png</file>
|
||||
<file>flags/se.png</file>
|
||||
<file>flags/sg.png</file>
|
||||
<file>flags/sh.png</file>
|
||||
<file>flags/si.png</file>
|
||||
<file>flags/sj.png</file>
|
||||
<file>flags/sk.png</file>
|
||||
<file>flags/sl.png</file>
|
||||
<file>flags/sm.png</file>
|
||||
<file>flags/sn.png</file>
|
||||
<file>flags/so.png</file>
|
||||
<file>flags/sr.png</file>
|
||||
<file>flags/st.png</file>
|
||||
<file>flags/sv.png</file>
|
||||
<file>flags/sy.png</file>
|
||||
<file>flags/sz.png</file>
|
||||
<file>flags/tc.png</file>
|
||||
<file>flags/td.png</file>
|
||||
<file>flags/tf.png</file>
|
||||
<file>flags/tg.png</file>
|
||||
<file>flags/th.png</file>
|
||||
<file>flags/tj.png</file>
|
||||
<file>flags/tk.png</file>
|
||||
<file>flags/tl.png</file>
|
||||
<file>flags/tm.png</file>
|
||||
<file>flags/tn.png</file>
|
||||
<file>flags/to.png</file>
|
||||
<file>flags/tr.png</file>
|
||||
<file>flags/tt.png</file>
|
||||
<file>flags/tv.png</file>
|
||||
<file>flags/tw.png</file>
|
||||
<file>flags/tz.png</file>
|
||||
<file>flags/ua.png</file>
|
||||
<file>flags/ug.png</file>
|
||||
<file>flags/um.png</file>
|
||||
<file>flags/us.png</file>
|
||||
<file>flags/uy.png</file>
|
||||
<file>flags/uz.png</file>
|
||||
<file>flags/va.png</file>
|
||||
<file>flags/vc.png</file>
|
||||
<file>flags/ve.png</file>
|
||||
<file>flags/vg.png</file>
|
||||
<file>flags/vi.png</file>
|
||||
<file>flags/vn.png</file>
|
||||
<file>flags/vu.png</file>
|
||||
<file>flags/wales.png</file>
|
||||
<file>flags/wf.png</file>
|
||||
<file>flags/ws.png</file>
|
||||
<file>flags/ye.png</file>
|
||||
<file>flags/yt.png</file>
|
||||
<file>flags/za.png</file>
|
||||
<file>flags/zm.png</file>
|
||||
<file>flags/zw.png</file>
|
||||
<file>flags/en.png</file>
|
||||
<file>flags/uk.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
BIN
src/flags/en.png
Normal file
BIN
src/flags/en.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 599 B |
BIN
src/flags/uk.png
Normal file
BIN
src/flags/uk.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 446 B |
|
@ -27,8 +27,18 @@ Groups::Groups( QWidget * parent,
|
|||
this, SLOT( addNew() ) );
|
||||
connect( ui.renameGroup, SIGNAL( clicked() ),
|
||||
this, SLOT( renameCurrent() ) );
|
||||
// connect( ui.emptyGroup, SIGNAL( clicked() ),
|
||||
// this, SLOT( emptyCurrent() ) );
|
||||
connect( ui.removeGroup, SIGNAL( clicked() ),
|
||||
this, SLOT( removeCurrent() ) );
|
||||
connect( ui.removeGroups, SIGNAL( clicked() ),
|
||||
this, SLOT( removeAll() ) );
|
||||
|
||||
connect( ui.tbAddDictsToGroup, SIGNAL( clicked() ),
|
||||
this, SLOT( addDictsToCurrentGroup() ) );
|
||||
connect( ui.tbRemoveDictsFromGroup, SIGNAL( clicked() ),
|
||||
this, SLOT( removeDictsFromCurrentGroup() ) );
|
||||
|
||||
|
||||
countChanged();
|
||||
}
|
||||
|
@ -43,7 +53,12 @@ void Groups::countChanged()
|
|||
bool en = ui.groups->count();
|
||||
|
||||
ui.renameGroup->setEnabled( en );
|
||||
// ui.emptyGroup->setEnabled( en );
|
||||
ui.removeGroup->setEnabled( en );
|
||||
ui.removeGroups->setEnabled( en );
|
||||
|
||||
ui.tbAddDictsToGroup->setEnabled( en );
|
||||
ui.tbRemoveDictsFromGroup->setEnabled( en );
|
||||
}
|
||||
|
||||
void Groups::addNew()
|
||||
|
@ -78,6 +93,38 @@ void Groups::renameCurrent()
|
|||
ui.groups->renameCurrentGroup( name );
|
||||
}
|
||||
|
||||
//void Groups::emptyCurrent()
|
||||
//{
|
||||
// int current = ui.groups->currentIndex();
|
||||
//
|
||||
// if ( current < 0 || QMessageBox::question( this, tr( "Empty group contents" ),
|
||||
// tr( "Are you sure you want to remove all the dictionaries from this group?" ),
|
||||
// QMessageBox::Yes, QMessageBox::Cancel ) != QMessageBox::Yes )
|
||||
// return;
|
||||
//
|
||||
// ui.groups->emptyCurrentGroup();
|
||||
//}
|
||||
|
||||
void Groups::addDictsToCurrentGroup()
|
||||
{
|
||||
int current = ui.groups->currentIndex();
|
||||
|
||||
if ( current >= 0 )
|
||||
{
|
||||
ui.groups->getCurrentModel()->addSelectedUniqueFromModel( ui.dictionaries->selectionModel() );
|
||||
}
|
||||
}
|
||||
|
||||
void Groups::removeDictsFromCurrentGroup()
|
||||
{
|
||||
int current = ui.groups->currentIndex();
|
||||
|
||||
if ( current >= 0 )
|
||||
{
|
||||
ui.groups->getCurrentModel()->removeSelectedRows( ui.groups->getCurrentSelectionModel() );
|
||||
}
|
||||
}
|
||||
|
||||
void Groups::removeCurrent()
|
||||
{
|
||||
int current = ui.groups->currentIndex();
|
||||
|
@ -90,3 +137,16 @@ void Groups::removeCurrent()
|
|||
countChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void Groups::removeAll()
|
||||
{
|
||||
int current = ui.groups->currentIndex();
|
||||
|
||||
if ( current >= 0 && QMessageBox::question( this, tr( "Remove all groups" ),
|
||||
tr( "Are you sure you want to remove all the groups?" ),
|
||||
QMessageBox::Yes, QMessageBox::Cancel ) == QMessageBox::Yes )
|
||||
{
|
||||
ui.groups->removeAllGroups();
|
||||
countChanged();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,10 +30,13 @@ private:
|
|||
void countChanged();
|
||||
|
||||
private slots:
|
||||
|
||||
void addNew();
|
||||
void renameCurrent();
|
||||
//void emptyCurrent();
|
||||
void addDictsToCurrentGroup();
|
||||
void removeDictsFromCurrentGroup();
|
||||
void removeCurrent();
|
||||
void removeAll();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
403
src/groups.ui
403
src/groups.ui
|
@ -1,158 +1,245 @@
|
|||
<ui version="4.0" >
|
||||
<class>Groups</class>
|
||||
<widget class="QDialog" name="Groups" >
|
||||
<property name="windowModality" >
|
||||
<enum>Qt::WindowModal</enum>
|
||||
</property>
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>726</width>
|
||||
<height>535</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Groups</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2" >
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2" >
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3" >
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2" >
|
||||
<property name="text" >
|
||||
<string>Dictionaries available:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="DictListWidget" name="dictionaries" />
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" >
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3" >
|
||||
<property name="text" >
|
||||
<string>Groups:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="DictGroupsWidget" name="groups" >
|
||||
<property name="tabPosition" >
|
||||
<enum>QTabWidget::North</enum>
|
||||
</property>
|
||||
<property name="elideMode" >
|
||||
<enum>Qt::ElideRight</enum>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_4" >
|
||||
<attribute name="title" >
|
||||
<string>Tab 2</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" >
|
||||
<item>
|
||||
<widget class="QPushButton" name="addGroup" >
|
||||
<property name="text" >
|
||||
<string>&Add group</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="renameGroup" >
|
||||
<property name="text" >
|
||||
<string>Re&name group</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="removeGroup" >
|
||||
<property name="text" >
|
||||
<string>&Remove group</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4" >
|
||||
<property name="text" >
|
||||
<string>Drag&drop dictionaries to and from the groups, move them inside the groups, reorder the groups using your mouse.</string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttons" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons" >
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>DictListWidget</class>
|
||||
<extends>QListWidget</extends>
|
||||
<header>groups_widgets.hh</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>DictGroupsWidget</class>
|
||||
<extends>QTabWidget</extends>
|
||||
<header>groups_widgets.hh</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttons</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>Groups</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttons</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>Groups</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Groups</class>
|
||||
<widget class="QDialog" name="Groups">
|
||||
<property name="windowModality">
|
||||
<enum>Qt::WindowModal</enum>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>784</width>
|
||||
<height>505</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Groups</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Dictionaries available</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="DictListWidget" name="dictionaries"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QToolButton" name="tbAddDictsToGroup">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="tbRemoveDictsFromGroup">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>User groups</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="addGroup">
|
||||
<property name="toolTip">
|
||||
<string>Create a new dictionary group</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Add group</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="renameGroup">
|
||||
<property name="toolTip">
|
||||
<string>Change current group's name</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Re&name group</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="removeGroup">
|
||||
<property name="toolTip">
|
||||
<string>Remove group</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Remove group</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="removeGroups">
|
||||
<property name="toolTip">
|
||||
<string>Remove all groups</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Remove all groups</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="DictGroupsWidget" name="groups">
|
||||
<property name="tabPosition">
|
||||
<enum>QTabWidget::North</enum>
|
||||
</property>
|
||||
<property name="tabShape">
|
||||
<enum>QTabWidget::Rounded</enum>
|
||||
</property>
|
||||
<property name="elideMode">
|
||||
<enum>Qt::ElideRight</enum>
|
||||
</property>
|
||||
<property name="documentMode">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_4">
|
||||
<attribute name="title">
|
||||
<string>Tab 2</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Drag & drop dictionaries to and from the groups, move them inside the groups, reorder the groups using your mouse.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttons">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>DictListWidget</class>
|
||||
<extends>QListWidget</extends>
|
||||
<header>groups_widgets.hh</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>DictGroupsWidget</class>
|
||||
<extends>QTabWidget</extends>
|
||||
<header>groups_widgets.hh</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttons</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>Groups</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttons</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>Groups</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
|
|
|
@ -79,9 +79,80 @@ std::vector< sptr< Dictionary::Class > > const &
|
|||
return dictionaries;
|
||||
}
|
||||
|
||||
void DictListModel::removeSelectedRows( QItemSelectionModel * source )
|
||||
{
|
||||
if ( !source )
|
||||
return;
|
||||
|
||||
QModelIndexList rows = source->selectedRows();
|
||||
|
||||
if ( !rows.count() )
|
||||
return;
|
||||
|
||||
for ( int i = rows.count()-1; i >= 0; --i )
|
||||
{
|
||||
dictionaries.erase( dictionaries.begin() + rows.at( i ).row() );
|
||||
}
|
||||
|
||||
reset();
|
||||
}
|
||||
|
||||
void DictListModel::addSelectedUniqueFromModel( QItemSelectionModel * source )
|
||||
{
|
||||
if ( !source )
|
||||
return;
|
||||
|
||||
QModelIndexList rows = source->selectedRows();
|
||||
|
||||
if ( !rows.count() )
|
||||
return;
|
||||
|
||||
const DictListModel * baseModel = dynamic_cast< const DictListModel * > ( source->model() );
|
||||
if ( !baseModel )
|
||||
return;
|
||||
|
||||
QVector< Dictionary::Class * > list;
|
||||
QVector< Dictionary::Class * > dicts;
|
||||
for ( int i = 0; i < dictionaries.size(); i++ )
|
||||
dicts.append( dictionaries.at( i ).get() );
|
||||
|
||||
for ( int i = 0; i < rows.count(); i++ )
|
||||
{
|
||||
Dictionary::Class * d =
|
||||
static_cast< Dictionary::Class * > ( rows.at( i ).internalPointer() );
|
||||
|
||||
//qDebug() << "rows.at( i ).internalPointer() " << rows.at( i ).internalPointer();
|
||||
|
||||
if ( !d )
|
||||
continue;
|
||||
|
||||
// sptr< Dictionary::Class > s ( d );
|
||||
//
|
||||
// if ( std::find( dictionaries.begin(), dictionaries.end(), s ) == dictionaries.end() )
|
||||
// continue;
|
||||
//
|
||||
// qDebug() << "std::find ";
|
||||
|
||||
if ( !dicts.contains( d ) )
|
||||
list.append( d );
|
||||
|
||||
//list.push_back( s );
|
||||
}
|
||||
|
||||
if ( list.empty() )
|
||||
return;
|
||||
|
||||
// qDebug() << "list " << list.size();
|
||||
|
||||
for ( int i = 0; i < list.size(); i++ )
|
||||
dictionaries.push_back( sptr< Dictionary::Class > ( list.at( i ) ) );
|
||||
|
||||
reset();
|
||||
}
|
||||
|
||||
Qt::ItemFlags DictListModel::flags( QModelIndex const & index ) const
|
||||
{
|
||||
Qt::ItemFlags defaultFlags = QAbstractListModel::flags( index );
|
||||
Qt::ItemFlags defaultFlags = QAbstractItemModel::flags( index );
|
||||
|
||||
if (index.isValid())
|
||||
return Qt::ItemIsDragEnabled | defaultFlags;
|
||||
|
@ -101,20 +172,69 @@ QVariant DictListModel::data( QModelIndex const & index, int role ) const
|
|||
if ( !item )
|
||||
return QVariant();
|
||||
|
||||
switch ( role )
|
||||
switch ( index.column() )
|
||||
{
|
||||
case Qt::DisplayRole :
|
||||
return QString::fromUtf8( item->getName().c_str() );
|
||||
// + QString(" lang: %1 %2").arg( langCoder.decode(item->getLangFrom()),
|
||||
// langCoder.decode(item->getLangTo()) );
|
||||
case 0:
|
||||
{
|
||||
switch ( role )
|
||||
{
|
||||
case Qt::DisplayRole :
|
||||
return QString::fromUtf8( item->getName().c_str() );
|
||||
// + QString(" lang: %1 %2").arg( langCoder.decode(item->getLangFrom()),
|
||||
// langCoder.decode(item->getLangTo()) );
|
||||
|
||||
case Qt::EditRole :
|
||||
return QString::fromUtf8( item->getId().c_str() );
|
||||
case Qt::EditRole :
|
||||
return QString::fromUtf8( item->getId().c_str() );
|
||||
|
||||
case Qt::DecorationRole:
|
||||
return item->getIcon();
|
||||
case Qt::DecorationRole:
|
||||
return item->getIcon();
|
||||
|
||||
default:;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 1:
|
||||
{
|
||||
switch ( role )
|
||||
{
|
||||
case Qt::DisplayRole :
|
||||
return LangCoder::decode( item->getLangFrom() ).left( 3 );
|
||||
|
||||
case Qt::EditRole :
|
||||
break;
|
||||
|
||||
case Qt::DecorationRole:
|
||||
return LangCoder::icon( item->getLangFrom() );
|
||||
|
||||
default:;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 2:
|
||||
{
|
||||
switch ( role )
|
||||
{
|
||||
case Qt::DisplayRole :
|
||||
return LangCoder::decode( item->getLangTo() ).left( 3 );
|
||||
|
||||
case Qt::EditRole :
|
||||
break;
|
||||
|
||||
case Qt::DecorationRole:
|
||||
return LangCoder::icon( item->getLangTo() );
|
||||
|
||||
default:;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:;
|
||||
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
|
@ -141,7 +261,7 @@ bool DictListModel::removeRows( int row, int count,
|
|||
|
||||
beginRemoveRows( parent, row, row + count - 1 );
|
||||
dictionaries.erase( dictionaries.begin() + row,
|
||||
dictionaries.begin() + row + count );
|
||||
count == INT_MAX ? dictionaries.end() : dictionaries.begin() + row + count );
|
||||
endRemoveRows();
|
||||
|
||||
return true;
|
||||
|
@ -160,45 +280,80 @@ bool DictListModel::setData( QModelIndex const & index, const QVariant & value,
|
|||
return true;
|
||||
}
|
||||
|
||||
if ( role == Qt::EditRole )
|
||||
{
|
||||
Config::Group g;
|
||||
|
||||
g.dictionaries.push_back( Config::DictionaryRef( value.toString(), QString() ) );
|
||||
|
||||
Instances::Group i( g, *allDicts );
|
||||
|
||||
if ( i.dictionaries.size() == 1 )
|
||||
{
|
||||
// Found that dictionary
|
||||
dictionaries[ index.row() ] = i.dictionaries.front();
|
||||
|
||||
emit dataChanged( index, index );
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// if ( role == Qt::EditRole )
|
||||
// {
|
||||
// Config::Group g;
|
||||
//
|
||||
// g.dictionaries.push_back( Config::DictionaryRef( value.toString(), QString() ) );
|
||||
//
|
||||
// Instances::Group i( g, *allDicts );
|
||||
//
|
||||
// if ( i.dictionaries.size() == 1 )
|
||||
// {
|
||||
// // Found that dictionary
|
||||
// dictionaries[ index.row() ] = i.dictionaries.front();
|
||||
//
|
||||
// emit dataChanged( index, index );
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Qt::DropActions DictListModel::supportedDropActions() const
|
||||
{
|
||||
return Qt::MoveAction;
|
||||
return 0; //Qt::MoveAction;
|
||||
}
|
||||
|
||||
QModelIndex DictListModel::index( int row, int column, const QModelIndex &parent ) const
|
||||
{
|
||||
return createIndex( row, column, dictionaries.at( row ).get() );
|
||||
}
|
||||
|
||||
QModelIndex DictListModel::parent( const QModelIndex & child ) const
|
||||
{
|
||||
return QModelIndex();
|
||||
}
|
||||
|
||||
QVariant DictListModel::headerData ( int section, Qt::Orientation orientation, int role ) const
|
||||
{
|
||||
if ( role == Qt::DisplayRole )
|
||||
{
|
||||
switch ( section )
|
||||
{
|
||||
case 0: return tr( "Dictionary" );
|
||||
case 1: return tr( "Source" );
|
||||
case 2: return tr( "Target" );
|
||||
default:;
|
||||
}
|
||||
}
|
||||
|
||||
return QAbstractItemModel::headerData( section, orientation, role );
|
||||
}
|
||||
|
||||
/// DictListWidget
|
||||
|
||||
DictListWidget::DictListWidget( QWidget * parent ): QListView( parent ),
|
||||
DictListWidget::DictListWidget( QWidget * parent ): QTreeView( parent ),
|
||||
model( this )
|
||||
{
|
||||
setModel( &model );
|
||||
|
||||
setSelectionMode( ExtendedSelection );
|
||||
|
||||
setDragEnabled( true );
|
||||
setAcceptDrops( true );
|
||||
setDropIndicatorShown( true );
|
||||
setDragEnabled( false );
|
||||
setAcceptDrops( false );
|
||||
setDropIndicatorShown( false );
|
||||
|
||||
setRootIsDecorated( false );
|
||||
setItemsExpandable( false );
|
||||
// setSortingEnabled( true );
|
||||
|
||||
header()->setAlternatingRowColors( true );
|
||||
header()->setResizeMode( QHeaderView::ResizeToContents );
|
||||
// header()->setSortIndicatorShown( true );
|
||||
// header()->setSortIndicator( 1, Qt::AscendingOrder );
|
||||
}
|
||||
|
||||
DictListWidget::~DictListWidget()
|
||||
|
@ -281,6 +436,32 @@ Config::Groups DictGroupsWidget::makeGroups() const
|
|||
return result;
|
||||
}
|
||||
|
||||
DictListModel * DictGroupsWidget::getCurrentModel() const
|
||||
{
|
||||
int current = currentIndex();
|
||||
|
||||
if ( current >= 0 )
|
||||
{
|
||||
DictGroupWidget * w = ( DictGroupWidget * ) widget( current );
|
||||
return w->getModel();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
QItemSelectionModel * DictGroupsWidget::getCurrentSelectionModel() const
|
||||
{
|
||||
int current = currentIndex();
|
||||
|
||||
if ( current >= 0 )
|
||||
{
|
||||
DictGroupWidget * w = ( DictGroupWidget * ) widget( current );
|
||||
return w->getSelectionModel();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void DictGroupsWidget::addNewGroup( QString const & name )
|
||||
{
|
||||
if ( !allDicts )
|
||||
|
@ -317,6 +498,17 @@ void DictGroupsWidget::renameCurrentGroup( QString const & name )
|
|||
setTabText( current, escapeAmps( name ) );
|
||||
}
|
||||
|
||||
void DictGroupsWidget::emptyCurrentGroup()
|
||||
{
|
||||
int current = currentIndex();
|
||||
|
||||
if ( current >= 0 )
|
||||
{
|
||||
DictGroupWidget * w = ( DictGroupWidget * ) widget( current );
|
||||
w->getModel()->removeRows( );
|
||||
}
|
||||
}
|
||||
|
||||
void DictGroupsWidget::removeCurrentGroup()
|
||||
{
|
||||
int current = currentIndex();
|
||||
|
@ -328,3 +520,14 @@ void DictGroupsWidget::removeCurrentGroup()
|
|||
delete w;
|
||||
}
|
||||
}
|
||||
|
||||
void DictGroupsWidget::removeAllGroups()
|
||||
{
|
||||
while ( count() )
|
||||
{
|
||||
QWidget * w = widget( 0 );
|
||||
removeTab( 0 );
|
||||
delete w;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,20 +6,20 @@
|
|||
|
||||
// Various custom widgets used in the Groups dialog
|
||||
|
||||
#include <QListWidget>
|
||||
#include <QtGui>
|
||||
#include "config.hh"
|
||||
#include "dictionary.hh"
|
||||
#include <vector>
|
||||
|
||||
/// A model to be projected into the view, according to Qt's MVC model
|
||||
class DictListModel: public QAbstractListModel
|
||||
class DictListModel: public QAbstractItemModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
DictListModel( QWidget * parent ):
|
||||
QAbstractListModel( parent ), isSource( false ), allDicts( 0 )
|
||||
QAbstractItemModel( parent ), isSource( false ), allDicts( 0 )
|
||||
{}
|
||||
|
||||
/// Populates the current model with the given dictionaries. This is
|
||||
|
@ -32,12 +32,20 @@ public:
|
|||
/// Returns the dictionaries the model currently has listed
|
||||
std::vector< sptr< Dictionary::Class > > const & getCurrentDictionaries() const;
|
||||
|
||||
void removeSelectedRows( QItemSelectionModel * source );
|
||||
void addSelectedUniqueFromModel( QItemSelectionModel * source );
|
||||
|
||||
Qt::ItemFlags flags( QModelIndex const &index ) const;
|
||||
int rowCount( QModelIndex const & parent ) const;
|
||||
int columnCount( QModelIndex const & parent ) const { return 3; }
|
||||
QVariant data( QModelIndex const & index, int role ) const;
|
||||
bool insertRows( int row, int count, const QModelIndex & parent );
|
||||
bool removeRows( int row, int count, const QModelIndex & parent );
|
||||
bool insertRows( int row, int count, const QModelIndex & parent = QModelIndex() );
|
||||
bool removeRows( int row = 0, int count = INT_MAX, const QModelIndex & parent = QModelIndex() );
|
||||
bool setData( QModelIndex const & index, const QVariant & value, int role );
|
||||
QModelIndex index( int row, int column,
|
||||
const QModelIndex &parent = QModelIndex() ) const;
|
||||
QModelIndex parent( const QModelIndex &child ) const;
|
||||
QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
|
||||
|
||||
Qt::DropActions supportedDropActions() const;
|
||||
|
||||
|
@ -50,7 +58,7 @@ private:
|
|||
|
||||
/// This widget is for dictionaries' lists, it handles drag-n-drop operations
|
||||
/// with them etc.
|
||||
class DictListWidget: public QListView
|
||||
class DictListWidget: public QTreeView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -67,6 +75,8 @@ public:
|
|||
/// Returns the dictionaries the widget currently has listed
|
||||
std::vector< sptr< Dictionary::Class > > const & getCurrentDictionaries() const;
|
||||
|
||||
DictListModel * getModel()
|
||||
{ return & model; }
|
||||
|
||||
private:
|
||||
|
||||
|
@ -90,6 +100,12 @@ public:
|
|||
/// (it is known by the containing tab widget only), it is returned as empty.
|
||||
Config::Group makeGroup() const;
|
||||
|
||||
DictListModel * getModel() const
|
||||
{ return ui.dictionaries->getModel(); }
|
||||
|
||||
QItemSelectionModel * getSelectionModel() const
|
||||
{ return ui.dictionaries->selectionModel(); }
|
||||
|
||||
private:
|
||||
Ui::DictGroupWidget ui;
|
||||
unsigned groupId;
|
||||
|
@ -117,12 +133,21 @@ public:
|
|||
/// Changes the name of the currently chosen group, if any, to the given one
|
||||
void renameCurrentGroup( QString const & );
|
||||
|
||||
void emptyCurrentGroup();
|
||||
|
||||
/// Removes the currently chosen group, if any
|
||||
void removeCurrentGroup();
|
||||
|
||||
/// Removes all the groups
|
||||
void removeAllGroups();
|
||||
|
||||
/// Creates groups from what is currently set up
|
||||
Config::Groups makeGroups() const;
|
||||
|
||||
DictListModel * getCurrentModel() const;
|
||||
|
||||
QItemSelectionModel * getCurrentSelectionModel() const;
|
||||
|
||||
private:
|
||||
|
||||
unsigned nextId;
|
||||
|
|
|
@ -14,21 +14,36 @@ LangCoder::LangCoder()
|
|||
const LangCode &lc = LangCodes[i];
|
||||
if (lc.lang[0] == 0)
|
||||
break;
|
||||
//ls.order = i;
|
||||
//ls.icon = QIcon(":/flags/" + QString(lc.code) + ".png");
|
||||
codeMap[code2toInt(lc.code)] = i;
|
||||
}
|
||||
}
|
||||
|
||||
QString LangCoder::decode(quint32 code)
|
||||
{
|
||||
// temp!
|
||||
if (langCoder.codeMap.contains(code))
|
||||
return LangCodes[langCoder.codeMap[code]].lang;
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
QIcon LangCoder::icon(quint32 code)
|
||||
{
|
||||
if (langCoder.codeMap.contains(code))
|
||||
{
|
||||
const LangCode &lc = LangCodes[ langCoder.codeMap[ code ] ];
|
||||
// QString flag_id( lc.code );
|
||||
// if (flag_id == "en")
|
||||
// flag_id = "gb";
|
||||
// else
|
||||
// if (flag_id == "uk")
|
||||
// flag_id = "ua";
|
||||
|
||||
return QIcon( ":/flags/" + QString( lc.code) + ".png" );
|
||||
}
|
||||
|
||||
return QIcon();
|
||||
}
|
||||
|
||||
LangStruct LangCoder::langStruct(quint32 code)
|
||||
{
|
||||
LangStruct ls;
|
||||
|
|
|
@ -237,6 +237,8 @@ public:
|
|||
|
||||
/// Returns decoded name of language or empty string if not found.
|
||||
static QString decode(quint32 code);
|
||||
/// Returns icon for language or empty string if not found.
|
||||
static QIcon icon(quint32 code);
|
||||
|
||||
//const QMap<quint32, int>& codes() { return codeMap; }
|
||||
|
||||
|
@ -246,12 +248,12 @@ public:
|
|||
|
||||
// bool CheckCode(QString &code);
|
||||
|
||||
protected:
|
||||
private:
|
||||
QMap<quint32, int> codeMap;
|
||||
// LangStruct dummyLS;
|
||||
};
|
||||
|
||||
extern LangCoder langCoder;
|
||||
//extern LangCoder langCoder;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
Loading…
Reference in a new issue