Index: configure.ac =================================================================== --- configure.ac (revision 6006) +++ configure.ac (working copy) @@ -846,6 +846,25 @@ dnl ***************************** dnl *** Check for Qt4 Library *** dnl ***************************** +AC_ARG_WITH(qt4, + AC_HELP_STRING([--with-qt4], + [build qt4 helper applications (experimental) + @<:@default=no@:>@]), + [ + case $with_qt4 in + no) + use_qt4="no" + ;; + yes|*) + use_qt4="yes" + ;; + esac + ], + [ + use_qt4="no" + ]) + + AC_ARG_WITH(qt4-immodule, AC_HELP_STRING([--with-qt4-immodule], [Build qt4-immodule extension (experimental) @@ -864,7 +883,7 @@ [ use_qt4_immodule="no" ]) -if test x$use_qt4_immodule = xyes; then +if test x$use_qt4 = xyes || test x$use_qt4_immodule = xyes; then if test -z "$QMAKE4"; then AC_MSG_ERROR([no qmake for Qt4 found]) fi @@ -1077,6 +1096,7 @@ # 0.36.3 or later is required to resolve a 'make check' problem ([uim-ja 87]). IT_PROG_INTLTOOL([0.36.3], [no-xml]) IT_PO_SUBDIR([qt/chardict/po]) +IT_PO_SUBDIR([qt4/chardict/po]) GTK_BINARY_VERSION=`$PKG_CONFIG gtk+-2.0 --variable=gtk_binary_version` @@ -1234,7 +1254,7 @@ fi AC_PATH_PROG(KDE_CONFIG, [kde-config], [no]) -if test "x$use_qt" = "xyes"; then +if test "x$use_qt" = "xyes" || test "x$use_qt4" = "xyes"; then if test "x$KDE_CONFIG" != "xno"; then KDE_ICONDIR=`$KDE_CONFIG --expandvars --install icon` fi @@ -1303,6 +1323,7 @@ AM_CONDITIONAL(QT, test x$use_qt = xyes) AM_CONDITIONAL(QT_IMMODULE, test x$use_qtimmodule = xyes) AM_CONDITIONAL(APPLET_KDE, test x$use_applet_kde = xyes) +AM_CONDITIONAL(QT4, test x$use_qt4 = xyes) AM_CONDITIONAL(QT4_IMMODULE, test x$use_qt4_immodule = xyes) AC_ARG_ENABLE(pref, @@ -1598,9 +1619,18 @@ qt/test/Makefile qt/uimapplet.desktop qt4/Makefile + qt4/chardict/Makefile + qt4/chardict/uim-chardict-qt4.pro + qt4/chardict/po/Makefile.in + qt4/edittest/Makefile qt4/immodule/quiminputcontextplugin.pro qt4/immodule/Makefile - qt4/edittest/Makefile + qt4/pref/uim-pref-qt4.pro + qt4/pref/Makefile + qt4/switcher/uim-im-switcher-qt4.pro + qt4/switcher/Makefile + qt4/toolbar/uim-toolbar-qt4.pro + qt4/toolbar/Makefile xim/Makefile fep/Makefile emacs/Makefile @@ -1622,6 +1652,16 @@ AC_OUTPUT # Generate Makefiles for Qt4 by qmake +if test x$use_qt4 = xyes; then + ${QMAKE4} -o ${ac_abs_top_builddir}/qt4/chardict/Makefile.qmake \ + ${ac_abs_top_srcdir}/qt4/chardict/uim-chardict-qt4.pro + ${QMAKE4} -o ${ac_abs_top_builddir}/qt4/pref/Makefile.qmake \ + ${ac_abs_top_srcdir}/qt4/pref/uim-pref-qt4.pro + ${QMAKE4} -o ${ac_abs_top_builddir}/qt4/switcher/Makefile.qmake \ + ${ac_abs_top_srcdir}/qt4/switcher/uim-im-switcher-qt4.pro + ${QMAKE4} -o ${ac_abs_top_builddir}/qt4/toolbar/Makefile.qmake \ + ${ac_abs_top_srcdir}/qt4/toolbar/uim-toolbar-qt4.pro +fi if test x$use_qt4_immodule = xyes; then ${QMAKE4} -o ${ac_abs_top_builddir}/qt4/immodule/Makefile.qmake \ ${ac_abs_top_srcdir}/qt4/immodule/quiminputcontextplugin.pro @@ -1649,6 +1689,7 @@ Gnome Applet : ${use_applet_gnome} Qt3 : ${use_qt} Qt3 immodule : ${use_qtimmodule} + Qt4 : ${use_qt4} Qt4 immodule : ${use_qt4_immodule} KDE3 Applet : ${use_applet_kde} FEP : ${use_uim_fep} Index: qt4/qtgettext.h =================================================================== --- qt4/qtgettext.h (revision 0) +++ qt4/qtgettext.h (revision 0) @@ -0,0 +1,65 @@ +/* + + Copyright (c) 2003-2009 uim Project http://code.google.com/p/uim/ + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of authors nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +*/ +#ifndef UIM_QT4_QTGETTEXT_H +#define UIM_QT4_QTGETTEXT_H + +#include +#include "uim/gettext.h" + +/* NLS can be disabled through the configure --disable-nls option. */ +#if ENABLE_NLS + +/* translation without being the tag for xgettext(1) */ +#define mygettext(String) QString::fromUtf8( dgettext(GETTEXT_PACKAGE,String) ) + +/* undef original _(String) macro for handling encoding */ +#ifdef _ +#undef _ +#endif +#define _(String) mygettext(String) +/* undef original N_(String) macro for handling encoding */ +#ifdef N_ +#undef N_ +#endif +#ifdef gettext_noop +#define N_(String) gettext_noop(String) +#else +#define N_(String) (String) +#endif /* gettext_noop */ + +#else /* ENABLE_NLS */ + +#define mygettext(String) QString::fromLocal8Bit( (const char *)(String) ) +#endif /* ENABLE_NLS */ + +#endif /* Not def: UIM_QT4_QTGETTEXT_H */ Index: qt4/chardict/qtgettext.h =================================================================== --- qt4/chardict/qtgettext.h (revision 0) +++ qt4/chardict/qtgettext.h (revision 0) @@ -0,0 +1,60 @@ +/* + + Copyright (c) 2003-2009 uim Project http://code.google.com/p/uim/ + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of authors nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +*/ +#ifndef UIM_QT4_QTGETTEXT_H +#define UIM_QT4_QTGETTEXT_H + +#include + +#include "uim/gettext.h" + +/* NLS can be disabled through the configure --disable-nls option. */ +#if ENABLE_NLS + +/* undef original _(String) macro for handling encoding */ +#ifdef _ +#undef _ +#endif +#define _(String) QString::fromUtf8( dgettext(GETTEXT_PACKAGE "-chardict-qt4", (String)) ) +/* undef original N_(String) macro for handling encoding */ +#ifdef N_ +#undef N_ +#endif +#ifdef gettext_noop +#define N_(String) QString::fromUtf8( gettext_noop(String) ) +#else +#define N_(String) (String) +#endif /* gettext_noop */ + +#endif /* ENABLE_NLS */ + +#endif /* Not def: UIM_QT4_QTGETTEXT_H */ Index: qt4/chardict/uim-chardict-qt4.pro.in =================================================================== --- qt4/chardict/uim-chardict-qt4.pro.in (revision 0) +++ qt4/chardict/uim-chardict-qt4.pro.in (revision 0) @@ -0,0 +1,31 @@ +TEMPLATE = app +CONFIG += @QT_CONFIG_OPTS@ + +INCLUDEPATH += @abs_top_builddir@ @abs_top_builddir@/uim \ + @abs_top_builddir@/replace +QMAKE_LIBDIR += @abs_top_builddir@/uim +QMAKE_LIBDIR += @abs_top_builddir@/replace +LIBS += -lreplace -luim -luim-scm -luim-x-util + +QMAKE_CFLAGS_DEBUG += @CFLAGS@ @X_CFLAGS@ +QMAKE_CFLAGS_RELEASE += @CFLAGS@ @X_CFLAGS@ +QMAKE_CXXFLAGS_DEBUG += @CXXFLAGS@ @X_CFLAGS@ +QMAKE_CXXFLAGS_RELEASE += @CXXFLAGS@ @X_CFLAGS@ + +# Input +HEADERS += bushuviewwidget.h \ + chargridview.h \ + kseparator.h \ + qt4.h \ + qtgettext.h \ + unicodeviewwidget.h +SOURCES += bushuviewwidget.cpp \ + chargridview.cpp \ + kseparator.cpp \ + qt4.cpp \ + unicodeviewwidget.cpp + +TARGET = uim-chardict-qt4 + +target.path += @DESTDIR@@exec_prefix@/bin +INSTALLS += target Index: qt4/chardict/bushu.t =================================================================== --- qt4/chardict/bushu.t (revision 0) +++ qt4/chardict/bushu.t (revision 0) @@ -0,0 +1,172 @@ +あか 赫 赧 赭 +あくび 歎 欸 欷 盜 欹 飮 歇 歃 歉 歐 歙 歔 歛 歟 歡 +あし 跨 疏 疋 跂 趾 趺 跏 跚 跖 跌 跛 跋 跪 跫 跟 跣 跼 踈 踉 跿 踝 踞 踐 踟 蹂 踵 踰 踴 蹊 蹇 蹉 蹌 蹐 蹈 蹙 蹤 蹠 踪 蹣 蹕 蹶 蹲 蹼 躁 躇 躅 躄 躋 躊 躓 躑 躔 躙 躪 躡 +あな 穹 穽 窈 窗 窕 窘 窖 窩 竈 窰 窶 竅 竄 窿 邃 竇 竊 +あめ 霸 霍 雹 霄 霆 霈 霓 霎 霑 霏 霖 霙 霤 霪 霰 霹 霽 霾 靄 靆 靈 靂 靉 +あらず 斐 翡 蜚 靠 韭 +いし 碓 碍 砧 硯 砿 碕 碩 碇 砺 硲 磐 碧 斫 矼 砌 砒 礦 砠 礪 硅 碎 硴 碆 硼 碚 碌 碣 碵 碪 碯 磑 磆 磋 磔 碾 碼 磅 磊 磬 磧 磚 磽 磴 礇 礒 礑 礙 礬 礫 +いち 云 廿 甫 弌 丐 丕 于 亞 亟 兩 巫 廾 +いちた 殆 歹 歿 殀 殄 殃 殍 殘 殕 殞 殤 殪 殫 殯 殲 殱 +いと 絢 徽 轡 繋 絃 紘 縞 紗 綬 繍 綜 綻 紬 纏 緋 緬 巒 彎 糺 紆 紂 紜 紕 紊 絅 絋 紮 紲 紿 紵 絆 絳 絖 絎 絲 絨 絮 絏 絣 經 綉 絛 綏 絽 綛 綺 綮 綣 綵 緇 綽 綫 總 綢 綯 緜 綸 綟 綰 緘 緝 緤 緞 緻 緲 緡 縅 縊 縣 縡 縒 縱 縟 縉 縋 縢 繆 繦 縻 縵 縹 繃 縷 縲 縺 繧 繝 繖 繞 繙 繚 繹 繪 繩 繼 繻 纃 緕 繽 辮 繿 纈 纉 續 纒 纐 纓 纔 纖 纎 纛 纜 +いぬ 倏 獎 默 獸 獻 +いのこ 彖 燹 豕 豢 豬 +うかんむり 窺 竃 寓 窄 穿 寵 宥 窯 宀 它 宦 宸 寃 寇 寉 寔 寐 寤 實 寢 寞 寥 寫 寰 寶 寳 搴 寨 謇 賽 蹇 騫 +うお 鰍 鱈 鰭 鮒 鱒 鱗 魯 鰐 魴 鮓 鮃 鮑 鮖 鮗 鮟 鮠 鮨 鮴 鯀 鯊 鮹 鯆 鯏 鯑 鯒 鯣 鯢 鯤 鯔 鯡 鰺 鯲 鯱 鯰 鰕 鰔 鰉 鰓 鰌 鰆 鰈 鰒 鰊 鰄 鰮 鰛 鰥 鰤 鰡 鰰 鱇 鰲 鱆 鰾 鱚 鱠 鱧 鱶 鱸 +うけばこ 凵 凾 +うし 牡 犀 牟 牝 牴 牾 犂 犁 犇 犒 犖 犢 犧 +うす 輿 兒 臾 舁 舂 舅 與 舊 +うま 騨 馳 篤 駁 馭 馮 馼 駟 駛 駝 駘 駑 駭 駮 駱 駲 駻 駸 騁 騏 騅 駢 騙 騫 騷 驅 驂 驀 驃 騾 驕 驍 驛 驗 驟 驢 驥 驤 驩 驫 驪 +うり 瓢 瓠 瓣 +えん 廻 廼 廴 廸 +おい 耆 耄 耋 +おう 瑛 珂 玩 玖 珪 瑚 瑳 珊 琢 琶 斑 琵 璃 琉 琳 弄 珈 玳 珎 玻 珀 珥 珮 珞 璢 琅 瑯 琥 珸 琲 琺 瑕 琿 瑟 瑙 瑁 瑜 瑩 瑰 瑣 瑪 瑶 瑾 璋 璞 璧 瓊 瓏 瓔 珱 +おおがい 穎 頴 頗 顛 頒 頏 頌 頸 頤 頡 頷 頽 顆 顏 顋 顫 顯 顰 顱 顴 顳 +おおざと 郁 祁 鄭 邑 邨 邯 邱 邵 郢 郤 扈 郛 鄂 鄒 鄙 鄲 鄰 +おと 竟 韶 韵 +おに 魁 魄 魃 魏 魍 魎 魑 魘 +おのれ 巷 巽 巳 已 巵 +おみ 臧 +おんな 娃 姶 姐 姥 嬰 嬉 妓 嫉 嫡 嬬 妬 媛 娩 姪 婁 奸 妁 妝 佞 侫 妣 妲 姆 姨 姜 妍 姙 姚 娥 娟 娑 娜 娉 娚 婀 婬 婉 娵 娶 婢 婪 媚 媼 媾 嫋 嫂 媽 嫣 嫗 嫦 嫩 嫖 嫺 嫻 嬌 嬋 嬖 嬲 嫐 嬪 嬶 嬾 孃 孅 孀 弩 +か 劫 勃 劬 劭 劼 劵 勁 勍 勗 勞 勣 勦 飭 勠 勳 勵 勸 +かい 賜 賎 貼 賭 賑 賦 賂 罌 戝 貭 貪 貽 貲 貳 貮 貶 賈 賁 賤 賣 賚 賽 賺 賻 贄 贅 贊 贇 贏 贍 贐 齎 贓 賍 贔 贖 +かおり 馥 +かく 鞍 鞄 鞠 鞘 靭 鞭 鞫 勒 靫 靱 靹 鞅 靼 鞁 靺 鞆 鞋 鞏 鞐 鞜 鞨 鞦 鞣 鞳 鞴 韃 韆 韈 +かぜ 颪 颯 颱 颶 飄 飃 飆 +かた 牒 牋 牘 +かたな 兔 刄 刧 剏 剪 劔 劒 剱 劈 辧 +かね 鎧 鈎 鋸 釧 鍬 鈷 錆 錫 鋤 鉦 鍾 錐 錘 銑 鎗 鐸 鋳 銚 鎚 鍔 鏑 鍍 鐙 錨 鋲 鋪 鋒 鉾 釦 鑓 釖 釟 釡 釛 釼 釵 釶 鈞 釿 鈔 鈬 鈕 鈑 鉞 鉗 鉅 鉉 鉤 鉈 銕 鈿 鉋 鉐 銜 銖 銓 銛 鉚 鋏 銹 銷 鋩 錏 鋺 鍄 錮 錙 錢 錚 錣 錺 錵 錻 鍜 鍠 鍼 鍮 鍖 鎰 鎬 鎭 鎔 鎹 鏖 鏗 鏨 鏥 鏘 鏃 鏝 鏐 鏈 鏤 鐚 鐔 鐓 鐃 鐇 鐐 鐶 鐫 鐵 鐡 鐺 鑁 鑒 鑄 鑛 鑠 鑢 鑞 鑪 鈩 鑰 鑵 鑷 鑽 鑚 鑼 鑾 钁 鑿 +かまえ 匡 匝 匪 圃 冂 囘 册 冉 冏 冑 冓 冕 匚 匣 匯 匱 匳 匸 區 囗 囮 囹 圀 囿 圄 圉 圈 國 圍 圓 團 圖 嗇 圜 罔 +かみ 髭 髟 髢 髣 髦 髯 髫 髮 髴 髱 髷 髻 鬆 鬘 鬚 鬟 鬢 鬣 +かめ 龜 +からい 辜 辟 辣 辭 辯 +かわ 皰 皴 皸 皹 皺 +かわら 甑 瓧 瓩 瓮 瓲 瓰 瓱 瓸 瓷 甄 甃 甅 甌 甎 甍 甕 甓 +かん 缸 缺 罅 罌 罍 罎 罐 +がん 厩 厭 雁 厨 厄 厂 厖 厠 厦 厥 厮 厰 靨 魘 鴈 鳫 黶 +き 橿 椛 栢 采 樵 椙 栴 柁 樗 槻 梼 橡 椴 柾 棉 杢 櫓 榔 梦 婪 杳 朮 朿 朶 杁 朸 朷 杆 杞 杠 杙 杣 杤 枉 杰 枩 杼 杪 枌 枋 枦 枡 枅 枷 柯 枴 柬 枳 柩 枸 柤 柞 柝 柢 柮 枹 柎 柆 柧 檜 栞 框 栩 桀 桍 栲 桎 梳 栫 桙 档 桷 桿 梟 梏 梭 梔 條 梛 梃 檮 梹 桴 梵 梠 梺 椏 梍 桾 椁 棊 椈 棘 椢 椦 棡 椌 棍 棔 棧 棕 椶 椒 椄 棗 棣 椥 棹 棠 棯 椨 椪 椚 椣 椡 棆 楹 楷 楜 楸 楫 楔 楾 楮 椹 楴 椽 楙 椰 楡 楞 楝 榁 楪 榲 榮 槐 榿 槁 槓 榾 槎 寨 槊 槝 榻 槃 榧 樮 榑 榠 榜 榕 榴 槞 槨 樂 樛 槿 權 槹 槲 槧 樅 榱 樞 槭 樔 槫 樊 +きがまえ 气 氛 氤 氣 +きぬ 袈 裟 袁 衾 袞 袤 袰 裔 裘 裝 裹 裴 襃 襄 褻 襞 +ぎょう 徽 彳 彷 徃 徂 彿 徊 很 徑 徇 從 徙 徘 徠 徨 徭 徼 衒 衙 衞 衢 鵆 黴 +く 勾 勿 勹 匆 匈 甸 匍 匐 匏 +くさ 葵 萎 蔭 蔚 荏 薗 葛 蒲 茅 萱 莞 蕎 荊 菰 蒔 蔀 蕊 惹 蒐 薯 藷 菖 蒋 蕉 薪 菅 蒼 茸 苧 菟 董 蕩 苫 薙 蕃 蒜 蕪 葺 蕗 蔽 繭 蔓 蓑 蒙 薮 蓉 莱 葎 苓 蕨 甍 蘯 舊 艸 艾 芍 芒 芫 芟 芻 芬 苡 苣 苟 苒 苴 苳 苺 莓 范 苻 苹 苞 茆 苜 茉 苙 茵 茴 茖 茲 茱 荀 茹 荐 荅 茯 茫 茗 茘 莅 莚 莪 莟 莢 莖 茣 莎 莇 莊 荼 莵 荳 荵 莠 莉 莨 菴 萓 菫 菎 菽 萃 菘 萋 菁 菷 萇 菠 菲 萍 萢 萠 莽 萸 蔆 菻 葭 萪 萼 蕚 蒄 葷 葫 蒭 葮 蒂 葩 葆 萬 葯 葹 萵 蓊 葢 蒹 蒿 蒟 蓙 蓍 蒻 蓚 蓐 蓁 蓆 蓖 蒡 蔡 蓿 蓴 蔗 蔘 蔬 蔟 蔕 蔔 蓼 蕀 蕣 +くち 唖 咽 吋 噂 嘉 嘩 咳 嚇 喝 噛 吃 轡 唆 哉 咋 嗣 哨 噌 唾 啄 喋 噸 噺 吻 哩 邑 叮 叨 叭 叺 吁 吽 呀 听 吭 吼 吮 吶 吩 吝 呎 咏 呵 咎 呟 呱 呷 呰 咒 呻 咀 呶 咄 咐 咆 哇 咢 咸 咥 咬 哄 哈 咨 咫 哂 咤 咾 咼 哘 哥 哦 唏 唔 哽 哮 哭 哺 哢 唹 啀 啣 啌 售 啜 啅 啖 啗 唸 唳 啝 喙 喀 咯 喊 喟 啻 啾 喘 喞 單 啼 喃 喩 喇 喨 嗚 嗅 嗟 嗄 嗜 嗤 嗔 嘔 嗷 嘖 嗾 嗽 嘛 嗹 噎 噐 營 嘴 嘶 嘲 嘸 噫 噤 嘯 噬 噪 嚆 嚀 嚊 嚠 嚔 嚏 嚥 嚮 嚶 嚴 囂 嚼 囁 囃 囀 囈 囎 囑 囓 嵒 +くび 馗 馘 +くるま 轡 轟 斬 輯 轍 輔 輿 軋 軛 軣 軼 軻 軫 軾 輊 輅 輕 輒 輙 輓 輜 輟 輛 輌 輦 輳 輻 輹 轅 轂 輾 轌 轉 轆 轎 轗 轜 轢 轣 轤 鏨 +くろ 默 黔 黜 點 黝 黠 黥 黨 黯 黴 黶 黷 +け 毟 毬 毫 毳 毯 麾 氈 耄 +けつ 歎 欸 欷 盜 欹 飮 歇 歃 歉 歐 歙 歔 歛 歟 歡 +けもの 狗 狛 狙 狽 猶 犹 犲 狃 狆 狄 狎 狒 狢 狠 狡 狹 狷 猗 猊 猜 猖 猝 猴 猯 猩 猥 猾 獏 獗 獪 獨 獰 獵 獺 +けん 覗 覓 覘 覡 覩 覦 覬 覯 覲 覺 覽 覿 觀 +こ 孜 孑 孕 孚 孛 孥 孩 孰 孳 孵 學 斈 孺 +こう 馥 +こころ 怨 慧 忽 悉 惹 恕 愈 忝 悳 忿 怎 怱 恚 恁 恷 恣 恙 惡 惠 愆 惷 愍 慇 愨 愿 愬 慂 慙 慫 慝 憙 憖 憇 憊 憑 應 懃 懋 懣 懿 戀 +こざと 隈 隙 陀 陪 隋 阡 阨 阮 阯 陂 陌 陏 陋 陷 陜 陞 陝 陟 陦 陲 陬 隍 隘 隕 隗 險 隧 隱 隲 隰 隴 +こめ 粟 粥 粁 粂 糊 糠 糎 糟 粕 糞 粍 籾 籵 粃 粐 粤 粭 粢 粫 粡 粨 粳 粲 粱 粮 粹 粽 糀 糅 糂 糘 糒 糜 糢 鬻 糯 糲 糴 糶 +ころも 袷 襖 裾 裡 衫 衵 衽 袵 衲 袂 袗 袒 袮 袙 袢 袍 袿 袱 裃 裄 裙 褂 裼 裨 裲 褄 褌 褊 褓 褞 褥 褪 褫 襁 褶 褸 襌 褝 襠 襦 襤 襭 襪 襯 襴 襷 襍 +ごん 謂 謁 該 諌 誼 訣 諮 訊 詑 註 諜 誹 謬 諒 譱 訃 訖 訐 訌 訛 訝 訥 訶 詁 詛 詒 詆 詈 詼 詭 詬 詢 誅 誂 誄 誨 誡 誑 誥 誦 誚 誣 諄 諍 諂 諚 諫 諳 諧 諤 諱 謔 諠 諢 諷 諞 諛 謌 謇 謚 諡 謖 謐 謗 謠 謳 鞫 謦 謫 謾 謨 譁 譌 譏 譎 證 譖 譛 譚 譫 譟 譬 譯 譴 譽 讀 讌 讎 讒 讓 讖 讙 讚 辯 +さけ 醐 酋 酬 醜 醇 醤 醒 醍 酎 酉 醗 猷 酊 酖 酘 酣 酥 酩 酳 酲 醋 醉 醂 醢 醫 醯 醪 醵 醴 醺 釀 釁 +さむらい 壯 壺 壹 壻 壼 壽 彭 熹 臺 蠧 賣 轂 皷 鼕 +さら 盈 盜 盂 盍 盖 盒 盞 盡 盥 盧 盪 蘯 鹽 +さん 渥 溢 洩 浬 澗 潅 汲 渠 鴻 沙 洲 潤 漸 汰 瀧 湛 瀦 潰 汀 澱 淘 涛 涜 沌 灘 溌 汎 沫 湊 涌 沃 淀 洛 溜 淋 漣 娑 汕 汢 汪 沂 沍 沚 沁 沛 汾 汨 汳 沒 沐 泄 泱 泓 沽 泗 泅 泝 沮 沱 沾 沺 泛 泯 泙 泪 洟 衍 洶 洫 洽 洸 洙 洵 洳 洒 洌 浣 涓 浤 浚 浹 浙 涎 涕 濤 涅 淹 渕 渊 涵 淇 淦 涸 淆 淬 淞 淌 淨 淒 淅 淺 淙 淤 淕 淪 淮 渭 湮 渮 渙 湲 湟 渾 渣 湫 渫 湶 湍 渟 湃 渺 湎 渤 滿 渝 游 溂 溪 溘 滉 溷 滓 溽 溯 滄 溲 滔 溏 溥 滂 溟 漑 灌 滬 滸 滾 滲 漱 滯 漲 滌 漾 漓 滷 澆 潺 潸 澁 澀 潯 潛 濳 潭 澂 潼 潘 澎 澑 濂 +し 渥 溢 洩 浬 澗 潅 汲 渠 鴻 沙 洲 潤 漸 汰 瀧 湛 瀦 潰 汀 澱 淘 涛 涜 沌 灘 溌 汎 沫 湊 涌 沃 淀 洛 溜 淋 漣 娑 汕 汢 汪 沂 沍 沚 沁 沛 汾 汨 汳 沒 沐 泄 泱 泓 沽 泗 泅 泝 沮 沱 沾 沺 泛 泯 泙 泪 洟 衍 洶 洫 洽 洸 洙 洵 洳 洒 洌 浣 涓 浤 浚 浹 浙 涎 涕 濤 涅 淹 渕 渊 涵 淇 淦 涸 淆 淬 淞 淌 淨 淒 淅 淺 淙 淤 淕 淪 淮 渭 湮 渮 渙 湲 湟 渾 渣 湫 渫 湶 湍 渟 湃 渺 湎 渤 滿 渝 游 溂 溪 溘 滉 溷 滓 溽 溯 滄 溲 滔 溏 溥 滂 溟 漑 灌 滬 滸 滾 滲 漱 滯 漲 滌 漾 漓 滷 澆 潺 潸 澁 澀 潯 潛 濳 潭 澂 潼 潘 澎 澑 濂 潦 +しか 麟 鏖 麁 麈 麋 麌 麒 麕 麑 麝 +しき 弌 弍 弋 弑 貳 +した 舘 甜 舒 舍 舐 舖 +しめす 頴 祇 禦 祁 祷 禰 祀 祠 祗 祟 祚 祕 祓 祺 祿 禊 禝 禧 齋 禪 禮 禳 +しゃく 屑 犀 屍 屡 屠 尸 尹 屁 屆 屎 屓 屐 屏 孱 屬 +しょう 嘗 尖 尓 尠 甞 畄 鶯 黨 鼡 +しょく 饗 飭 飮 飩 飫 餃 餉 餒 餔 餘 餡 餝 餞 餤 餠 餬 餮 餽 餾 饂 饉 饅 饐 饋 饑 饒 饌 饕 +しろ 皐 帛 皀 皃 皈 皋 皎 皖 皓 皙 皚 魄 +しん 迅 遡 遜 逐 逓 遁 迩 逼 辷 迚 迥 迢 迪 迯 邇 迴 逅 迹 迺 逑 逕 逡 逍 逞 逖 逋 逧 逶 逵 逹 迸 遏 遐 遑 遒 逎 遉 逾 遖 遘 遞 遨 遯 遶 隨 遲 邂 遽 邁 邀 邊 邉 邏 +じゅう 兢 卆 卅 丗 卉 卍 凖 幵 辜 +すい 汞 滕 潁 漿 +すき 耒 耘 耙 耜 耡 耨 +すん 尅 將 專 對 +せつ 卩 卮 夘 卻 卷 +そう 趨 赱 赳 趁 趙 +そのた 甥 且 舘 禽 乞 此 艮 些 匙 斯 而 叢 乍 巴 斌 斧 甫 卜 尤 歪 丐 丱 丶 丼 亂 亅 豫 亊 舒 于 亞 亟 兩 兪 匕 卞 厶 參 夂 夊 夐 尢 尨 尹 屮 巛 幵 并 幺 廾 弃 弉 彝 彜 彑 彖 彗 彙 彡 彭 懿 扁 攴 敘 斃 斟 斷 无 旡 朮 歸 毋 毓 氓 爨 爻 爼 爿 牀 牆 甦 甬 矜 禹 禺 粤 鬻 羸 飜 臻 艱 艷 蠹 蠧 赱 釁 釐 隶 隸 靜 韭 鬯 鬲 鹵 鹹 黌 黹 黻 黼 黽 鼇 鼈 皷 鼕 鼬 +た 畏 畿 戴 畷 牌 毘 畢 壘 畋 甼 畄 畍 畊 畉 畛 畆 畚 畩 畤 畧 畫 畭 畸 當 疆 疇 畴 疊 疉 疂 罍 +たかい 敲 稾 髞 +たけ 竿 笈 纂 篠 笥 箭 箪 筑 篤 箔 箸 筈 筏 簸 箆 篇 箕 簾 篭 簒 笂 笏 笊 笆 笳 笘 笙 笞 笵 笨 笶 筐 筺 笄 筍 笋 筌 筅 筵 筥 筴 筧 筰 筱 筬 筮 箝 箘 箟 箍 箜 箚 箋 箒 箏 筝 箙 篋 篁 篌 篏 箴 篆 篝 篩 簑 簔 篦 篥 籠 簀 簇 簓 篳 篷 簗 簍 篶 簣 簧 簪 簟 簷 簫 簽 籌 籃 籔 籏 籀 籐 籘 籟 籤 籖 籥 籬 +たつ 竣 竸 辨 竍 竏 竕 竓 站 竚 竝 竡 竢 竦 竭 竰 翊 颯 +たに 谺 豁 谿 +たま 瑛 珂 玩 玖 珪 瑚 瑳 珊 琢 琶 斑 琵 璃 琉 琳 弄 珈 玳 珎 玻 珀 珥 珮 珞 璢 琅 瑯 琥 珸 琲 琺 瑕 琿 瑟 瑙 瑁 瑜 瑩 瑰 瑣 瑪 瑶 瑾 璋 璞 璧 瓊 瓏 瓔 珱 +だい 夷 奄 尖 套 匏 夬 夭 夲 夸 夾 竒 奕 奐 奎 奚 奘 奢 奠 奧 奬 奩 樊 +ち 衄 衂 +ちから 劫 勃 劬 劭 劼 劵 勁 勍 勗 勞 勣 勦 飭 勠 勳 勵 勸 +つ 嘗 尖 尓 尠 甞 畄 鶯 黨 鼡 +つき 胤 胡 肱 腔 肴 脆 膳 脹 膿 膝 肋 冑 朏 朖 朞 朦 朧 霸 縢 肛 肓 肚 肭 冐 肬 胛 胥 胙 胝 胄 胚 胖 脉 胯 胱 脛 脩 脣 脯 腋 隋 腆 脾 腓 腑 胼 腱 腮 腥 腦 腴 膃 膈 膊 膀 膂 膠 膕 膤 膣 腟 膓 膩 膰 膵 膾 膸 膽 臀 臂 膺 臉 臍 臑 臙 臘 臈 臚 臟 臠 +つくえ 凱 夙 凪 鳳 几 處 凩 凭 凰 +つち 堰 堪 尭 卦 珪 垢 坤 坐 埴 塑 堆 坦 填 堵 塘 塙 埠 圦 圷 圸 坎 圻 址 坏 坩 埀 垈 坡 坿 垉 垓 垠 垳 垤 垪 垰 埃 埆 埔 埒 埓 堊 埖 埣 堋 堙 堝 塲 堡 塢 塋 塰 毀 塒 堽 塹 墅 墹 墟 墫 墺 壞 墻 墸 墮 壅 壓 壑 壗 壙 壘 壥 壜 壤 壟 奎 赱 +つつみ 勾 勿 勹 匆 匈 甸 匍 匐 匏 +つの 斛 觚 觜 觝 觧 觴 觸 鵤 +つめ 亂 奚 孚 爭 爬 爰 爲 覓 +て 挨 按 掩 拐 撹 掬 拳 捲 拘 拷 挫 搾 拶 捌 撒 捷 擾 拭 据 摺 拙 撰 措 掻 捉 揃 托 捗 掴 挺 擢 撤 搭 撞 捺 捻 撚 把 播 挽 撫 扮 捧 抹 摸 揖 掠 扎 扞 扣 扛 扠 扨 扼 抂 抉 找 抒 抓 抖 拔 抃 抔 拗 拑 抻 拏 拿 拆 擔 拈 拜 拌 拊 拂 拇 抛 拉 挌 拮 拱 挧 挂 挈 拯 拵 捐 挾 捍 搜 捏 掖 掎 掀 掫 捶 掣 掏 掉 掟 掵 捫 捩 掾 揩 揀 揆 揣 揉 插 揶 揄 搖 搴 搆 搓 搦 搶 攝 搗 搨 搏 摧 摯 摶 摎 攪 撕 撓 撥 撩 撈 撼 據 擒 擅 擇 撻 擘 擂 擱 擧 舉 擠 擡 抬 擣 擯 攬 擶 擴 擲 擺 攀 擽 攘 攜 攅 攤 攣 攫 +とう 鬥 鬧 鬨 鬩 鬪 鬮 +とら 彪 處 盧 虍 乕 虔 號 虧 +とり 鵜 鴛 鴎 鴻 鵠 鷺 鴫 蔦 嶋 鴇 鳶 鳳 鵬 鵡 鷲 梟 鳧 鳬 鳰 鴉 鴈 鳫 鴃 鴆 鴪 鴦 鶯 鴣 鴟 鵄 鴕 鴒 鵁 鴿 鴾 鵆 鵈 鵝 鵞 鵤 鵑 鵐 鵙 鵲 鶉 鶇 鶫 鵯 鵺 鶚 鶤 鶩 鶲 鷄 鷁 鶻 鶸 鶺 鷆 鷏 鷂 鷙 鷓 鷸 鷦 鷭 鷯 鷽 鸚 鸛 鸞 +ど 堰 堪 尭 卦 珪 垢 坤 坐 埴 塑 堆 坦 填 堵 塘 塙 埠 圦 圷 圸 坎 圻 址 坏 坩 埀 垈 坡 坿 垉 垓 垠 垳 垤 垪 垰 埃 埆 埔 埒 埓 堊 埖 埣 堋 堙 堝 塲 堡 塢 塋 塰 毀 塒 堽 塹 墅 墹 墟 墫 墺 壞 墻 墸 墮 壅 壓 壑 壗 壙 壘 壥 壜 壤 壟 奎 赱 +なべ 亥 牽 嚢 亦 亠 亢 亰 亳 亶 卞 壅 奕 弃 旁 毫 甕 稟 禀 袞 袤 裹 襃 襄 褻 齎 雍 齏 韲 齊 +なめし 韋 韜 +にすい 冴 凄 凋 冶 凌 冫 决 冱 冲 冰 况 冽 凅 凉 凛 凖 馮 +にく 臠 +にし 襾 覃 覈 覊 賈 +にち 旺 翰 沓 戟 昂 晃 昏 晒 曙 晋 曾 暢 曝 昧 魯 亘 冕 勗 曼 旱 杲 昊 昃 旻 杳 昵 昶 昴 昜 晏 晄 晉 晁 晞 晝 晤 晧 晨 晟 晢 晰 暃 暈 暎 暉 暄 暘 暝 曁 暹 曉 暾 暼 曄 暸 曖 曚 曠 昿 曦 曩 曰 曵 曷 耆 +にん 伽 俄 臥 侃 伎 侠 僑 僅 倶 倦 伍 佼 侯 倖 坐 仔 偲 什 但 偵 僻 俣 侭 儲 傭 侶 伶 倭 个 从 仍 仄 仆 仂 仗 仞 仭 仟 价 伉 佚 估 佛 佝 佗 佇 佶 侈 侏 侘 佻 佩 佰 侑 佯 來 侖 儘 俔 俟 俎 俘 俛 俑 俚 俐 俤 俥 倚 倨 倔 倪 倥 倅 伜 俶 倡 倩 倬 俾 俯 們 倆 偃 假 會 偕 偐 偈 做 偖 偬 偸 傀 傚 傅 傴 傲 僉 僊 傳 僂 僖 僞 僥 僭 僣 僮 價 僵 儉 儁 儂 儖 儕 儔 儚 儡 儺 儷 儼 儻 佞 侫 巫 攸 條 倏 脩 舍 龕 龠 +ぬ 叉 雙 叟 曼 燮 +ね 祉 禎 祢 +の 乎 乞 采 壬 屯 丿 乂 乖 乘 亂 尹 屮 秉 +のぎ 穐 穎 禾 黍 穣 秦 秤 穆 秉 秕 秧 秬 秡 秣 稈 稍 稘 稙 稠 稟 禀 稱 稻 稾 稷 穃 穗 穉 穡 穢 穩 龝 穰 黎 黏 黐 +のごめ 釆 奧 飜 釉 釋 +のぶん 攵 攷 收 攸 畋 效 敖 敕 敍 敞 敝 數 斂 斃 變 +は 齒 齔 齣 齟 齠 齡 齦 齧 齬 齪 齷 齲 齶 +はしる 趨 赱 赳 趁 趙 +はち 其 巽 輿 兌 兮 冀 奠 與 +はつ 癶 癸 發 +はな 鼾 +はね 翫 翅 翆 翊 翕 翔 翡 翦 翩 翳 翹 +はば 帥 匝 帖 幡 幌 帋 帚 帙 帑 帛 帶 帷 幄 幃 幀 幎 幗 幔 幟 幢 幤 幇 乕 +ばく 麹 麺 麥 麩 麸 麪 麭 +ひ 焔 灸 燦 灼 燭 煽 燈 煤 焚 熔 燐 煉 勞 營 塋 榮 炙 炒 炯 烱 炬 炸 炳 炮 烟 烙 烽 焜 焙 煥 煢 煌 煖 煬 燻 熄 熕 熨 燗 熾 燒 燉 燔 燎 燠 燬 燧 燵 燼 燹 燿 爍 爐 爛 爨 犖 瑩 螢 +ひつじ 羨 姜 盖 羌 羔 羞 羝 羚 羣 羯 羲 羹 羮 羶 羸 譱 翔 +ひと 伽 俄 臥 侃 伎 侠 僑 僅 倶 倦 伍 佼 侯 倖 坐 仔 偲 什 但 偵 僻 俣 侭 儲 傭 侶 伶 倭 个 从 仍 仄 仆 仂 仗 仞 仭 仟 价 伉 佚 估 佛 佝 佗 佇 佶 侈 侏 侘 佻 佩 佰 侑 佯 來 侖 儘 俔 俟 俎 俘 俛 俑 俚 俐 俤 俥 倚 倨 倔 倪 倥 倅 伜 俶 倡 倩 倬 俾 俯 們 倆 偃 假 會 偕 偐 偈 做 偖 偬 偸 傀 傚 傅 傴 傲 僉 僊 傳 僂 僖 僞 僥 僭 僣 僮 價 僵 儉 儁 儂 儖 儕 儔 儚 儡 儺 儷 儼 儻 佞 侫 巫 攸 條 倏 脩 舍 龕 龠 +ひとあし 允 兜 兇 兎 儿 兀 兒 兌 兔 兢 竸 皃 竟 +ひよみ 醐 酋 酬 醜 醇 醤 醒 醍 酎 酉 醗 猷 酊 酖 酘 酣 酥 酩 酳 酲 醋 醉 醂 醢 醫 醯 醪 醵 醴 醺 釀 釁 +ふし 卩 卮 夘 卻 卷 +ふた 亥 牽 嚢 亦 亠 亢 亰 亳 亶 卞 壅 奕 弃 旁 毫 甕 稟 禀 袞 袤 裹 襃 襄 褻 齎 雍 齏 韲 齊 +ふで 聿 肄 肆 肅 +ふね 舷 舵 舩 舫 舸 舳 艀 艙 艘 艝 艚 艟 艤 艢 艨 艪 艫 舮 +ふるとり 雙 售 瞿 雖 讎 隹 雎 雋 雉 雍 襍 雜 霍 雕 +ぺーじ 穎 頴 頗 顛 頒 頏 頌 頸 頤 頡 頷 頽 顆 顏 顋 顫 顯 顰 顱 顴 顳 +ほう 旃 旆 旁 旄 旌 旒 旛 旙 +ほこ 曳 畿 戎 戴 戊 戈 戉 戍 戌 戔 戛 戞 戡 截 戮 戰 戲 戳 臧 +ほね 骭 骰 骼 髀 髏 髑 髓 體 +ま 庵 廓 庚 廠 庇 廟 庖 庸 廉 麼 广 庠 廁 廂 廈 廐 廏 廖 廣 廝 廚 廛 廢 廡 廨 廩 廬 廱 廳 廰 應 麾 糜 縻 靡 +また 叉 雙 叟 曼 燮 +まめ 豈 豌 豎 豐 +み 躯 躬 躰 軆 躱 躾 軅 軈 +みず 汞 滕 潁 漿 +みみ 耽 耶 聯 聾 耿 耻 聊 聆 聒 聘 聚 聟 聢 聨 聳 聲 聰 聶 聹 聽 顳 鵈 +みる 覗 覓 覘 覡 覩 覦 覬 覯 覲 覺 覽 覿 觀 +むぎ 麹 麺 麥 麩 麸 麪 麭 +むし 虻 蝦 蛎 蝉 蛸 蛋 蜘 蝿 蛭 螺 蝋 虱 蚓 蚣 蚩 蚪 蚋 蚌 蚶 蚯 蛄 蛆 蚰 蛉 蠣 蚫 蛔 蛞 蛩 蛬 蛟 蛛 蛯 蜒 蜆 蜈 蜀 蜃 蛻 蜑 蜉 蜍 蛹 蜊 蜴 蜿 蜷 蜻 蜥 蜩 蜚 蝠 蝟 蝸 蝌 蝎 蝴 蝗 蝨 蝮 蝙 蝓 蝣 蝪 蠅 螢 螟 螂 螯 蟋 螽 蟀 蟐 雖 螫 蟄 螳 蟇 蟆 螻 蟯 蟲 蟠 蠏 蠍 蟾 蟶 蟷 蠎 蟒 蠑 蠖 蠕 蠢 蠡 蠱 蠶 蠹 蠧 蠻 +むじな 豹 貌 豸 豺 貂 貉 貅 貊 貍 貎 貔 豼 貘 +めへん 鼎 瞥 睦 盻 眈 眇 眄 眩 眤 眞 眥 眦 眛 眷 眸 睇 睚 睨 睫 睛 睥 睿 睾 睹 瞎 瞋 瞑 瞠 瞞 瞰 瞶 瞹 瞿 瞼 瞽 瞻 矇 矍 矗 矚 雎 +めん 靤 靦 靨 +もん 閏 閤 閃 閂 閇 閊 閔 閖 閘 閙 閠 閨 閧 閭 閼 閻 閹 閾 闊 濶 闃 闍 闌 闕 闔 闖 關 闡 闥 闢 +や 矯 矩 矧 矣 矮 雉 +やま 峨 崖 嵯 峻 嵩 岨 岱 峯 乢 屶 屹 岌 岑 岔 妛 岫 岻 岶 岼 岷 峅 岾 峇 峙 峩 峽 峺 峭 嶌 峪 崋 崕 崗 嵜 崟 崛 崑 崔 崢 崚 崙 崘 嵌 嵒 嵎 嵋 嵬 嵳 嵶 嶇 嶄 嶂 嶢 嶝 嶬 嶮 嶽 嶐 嶷 嶼 巉 巍 巓 巒 巖 蚩 豈 +やまい 痩 疔 疚 疝 疥 疣 痂 疳 痃 疵 疽 疸 疼 疱 痍 痊 痒 痙 痣 痞 痾 痿 痼 瘁 痰 痺 痲 痳 瘋 瘍 瘉 瘟 瘧 瘠 瘡 瘢 瘤 瘴 瘰 瘻 癇 癈 癆 癜 癘 癡 癢 癨 癩 癪 癧 癬 癰 癲 +ゆう 舜 舛 夘 夛 梦 夥 +ゆみ 夷 粥 彊 弛 弔 弼 弗 弖 弩 弭 弸 彁 彈 彌 彎 弯 +よつてん 燕 煎 黛 烹 烋 烝 焉 煕 熈 煦 熏 熬 熹 +よん 欝 罹 网 罘 罟 罠 罨 罩 罧 罸 羂 羆 羃 羈 羇 蜀 +りっしん 惟 恢 慨 恰 憾 怯 惚 悌 憧 惇 忖 忻 忤 忸 忱 怡 恠 怙 怐 怩 怛 怕 怫 怦 怏 怺 恪 恟 恊 恆 恍 恃 恤 恂 恬 恫 悁 悍 惧 悃 悚 悄 悛 悖 悗 悒 悧 悋 悸 惓 悴 忰 悽 惆 悵 惘 慍 愕 惶 愀 惴 惺 愃 愡 惻 惱 愎 愾 愧 慊 愼 愴 愽 慄 慳 慷 慘 慚 慴 慯 慥 慱 慟 慓 慵 憬 憔 憚 憫 憮 懌 懊 懷 懈 懆 憺 罹 懍 懦 懶 懺 懴 懽 懼 懾 +りっとう 劃 荊 剃 剥 劉 刋 刔 刎 刪 刮 刳 刹 剄 剋 剌 剞 剔 剴 剩 剳 剿 剽 劍 劑 辨 +りつ 竣 竸 辨 竍 竏 竕 竓 站 竚 竝 竡 竢 竦 竭 竰 翊 颯 +る 允 兜 兇 兎 儿 兀 兒 兌 兔 兢 竸 皃 竟 +るまた 殳 殷 殼 毆 +ろ 唖 咽 吋 噂 嘉 嘩 咳 嚇 喝 噛 吃 轡 唆 哉 咋 嗣 哨 噌 唾 啄 喋 噸 噺 吻 哩 邑 叮 叨 叭 叺 吁 吽 呀 听 吭 吼 吮 吶 吩 吝 呎 咏 呵 咎 呟 呱 呷 呰 咒 呻 咀 呶 咄 咐 咆 哇 咢 咸 咥 咬 哄 哈 咨 咫 哂 咤 咾 咼 哘 哥 哦 唏 唔 哽 哮 哭 哺 哢 唹 啀 啣 啌 售 啜 啅 啖 啗 唸 唳 啝 喙 喀 咯 喊 喟 啻 啾 喘 喞 單 啼 喃 喩 喇 喨 嗚 嗅 嗟 嗄 嗜 嗤 嗔 嘔 嗷 嘖 嗾 嗽 嘛 嗹 噎 噐 營 嘴 嘶 嘲 嘸 噫 噤 嘯 噬 噪 嚆 嚀 嚊 嚠 嚔 嚏 嚥 嚮 嚶 嚴 囂 嚼 囁 囃 囀 囈 囎 囑 囓 嵒 +ろう 耆 耄 耋 +わかんむり 冨 冥 冖 冤 冦 冢 冩 冪 罕 +ん 冴 凄 凋 冶 凌 冫 决 冱 冲 冰 况 冽 凅 凉 凖 馮 Index: qt4/chardict/qt4.cpp =================================================================== --- qt4/chardict/qt4.cpp (revision 0) +++ qt4/chardict/qt4.cpp (revision 0) @@ -0,0 +1,221 @@ +/* + +Copyright (c) 2003-2009 uim Project http://code.google.com/p/uim/ + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. +3. Neither the name of authors nor the names of its contributors +may be used to endorse or promote products derived from this software +without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +*/ +#include "qt4.h" +#include "bushuviewwidget.h" +#include "kseparator.h" +#include "unicodeviewwidget.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "qtgettext.h" + +int main( int argc, char *argv[] ) +{ + + setlocale(LC_ALL, ""); + bindtextdomain(PACKAGE "-chardict-qt", LOCALEDIR); + textdomain(PACKAGE "-chardict-qt"); + bind_textdomain_codeset(PACKAGE "-chardict-qt", "UTF-8"); + + QApplication a( argc, argv ); + + KUimCharDict::Mode m = KUimCharDict::UNKNOWN; + for ( int i = 0; i < argc; i++ ) + { + QString arg( argv[ i ] ); + if ( !arg.isEmpty() && arg.startsWith( QLatin1String( "-mode=" ) ) ) + { + QStringList list = arg.split( '=', QString::SkipEmptyParts ); + if ( list.count() < 2 || list[ 1 ].isEmpty() ) + continue; + QString mode = list[ 1 ]; + + if ( mode == "BUSHU" ) + m = KUimCharDict::BUSHU; + else if ( mode == "UNICODE" ) + m = KUimCharDict::UNICODE; + } + } + + KUimCharDict cdict; + cdict.changeMode( m ); + cdict.resize( 600, 400 ); + cdict.show(); + + return a.exec(); +} + +KUimCharDict::KUimCharDict( QWidget *parent ) + : QWidget( parent ) +{ + setupWidgets(); + + readConfig(); +} + +KUimCharDict::~KUimCharDict() +{ + writeConfig(); +} + +void KUimCharDict::setupWidgets() +{ + QVBoxLayout * layout = new QVBoxLayout( this ); + layout->setMargin( 4 ); + layout->setSpacing( 6 ); + + QWidget *upperHWidget = new QWidget( this ); + upperHWidget->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Maximum ); + + QLabel *modeLabel = new QLabel( _( "Mode:" ), upperHWidget ); + m_modeCombo = new QComboBox( upperHWidget ); + m_modeCombo->addItem( _( "Bushu Search" ) ); + m_modeCombo->addItem( _( "Unicode Search" ) ); + modeLabel->setBuddy( m_modeCombo ); + + m_fontselButton = new QPushButton( upperHWidget ); + m_fontselButton->setText( _( "Select Font" ) ); + connect( m_fontselButton, SIGNAL( clicked() ), + this, SLOT( slotSelectFont() ) ); + + QLabel *charLabel = new QLabel( _( "Chars:" ), upperHWidget ); + m_charLineEdit = new QLineEdit( upperHWidget ); + charLabel->setBuddy( m_charLineEdit ); + + QHBoxLayout *upperHLayout = new QHBoxLayout( upperHWidget ); + upperHLayout->setSpacing( 4 ); + upperHLayout->addWidget( modeLabel ); + upperHLayout->addWidget( m_modeCombo ); + upperHLayout->addWidget( m_fontselButton ); + upperHLayout->addSpacing( 11 ); + upperHLayout->addWidget( charLabel ); + upperHLayout->addWidget( m_charLineEdit ); + + m_widgetStack = new QStackedWidget( this ); + m_widgetStack->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ); + + m_bushuView = new BushuViewWidget( this ); + connect( m_bushuView, SIGNAL( charSelected( const QString & ) ), + this, SLOT( slotCharSelected( const QString & ) ) ); + m_bushuView->hide(); + m_widgetStack->addWidget( m_bushuView ); + + m_unicodeView = new UnicodeViewWidget( this ); + connect( m_unicodeView, SIGNAL( charSelected( const QString & ) ), + this, SLOT( slotCharSelected( const QString & ) ) ); + m_unicodeView->hide(); + m_widgetStack->addWidget( m_unicodeView ); + + connect( m_modeCombo, SIGNAL( activated( int ) ), + m_widgetStack, SLOT( setCurrentIndex( int ) ) ); + + layout->addWidget( upperHWidget ); + layout->addWidget( new KSeparator( this ) ); + layout->addWidget( m_widgetStack ); +} + +void KUimCharDict::writeConfig() +{ + QSettings settings; + + // font + settings.setValue( "/uim-kdehelper/chardict/font", m_fontselButton->font().toString() ); +} +void KUimCharDict::readConfig() +{ + QSettings settings; + QString str; + + // font + str = settings.value( "/uim-kdehelper/chardict/font" ).toString(); + if ( !str.isEmpty() ) + { + QFont font; + font.fromString( str ); + + setCharDictFont( font ); + } else { + setCharDictFont( font() ); + } +} + +void KUimCharDict::setCharDictFont( const QFont &font ) +{ + // button + m_fontselButton->setFont( font ); + // bushu + m_bushuView->setFont( font ); + // unicode + m_unicodeView->setFont( font ); +} + + +void KUimCharDict::changeMode( int mode ) +{ + if ( mode < 0 || mode > m_widgetStack->count() - 1 ) + { + qDebug( "Unknown Mode" ); + return; + } + m_widgetStack->setCurrentIndex( mode ); + m_modeCombo->setCurrentIndex( mode ); +} + +void KUimCharDict::slotSelectFont() +{ + bool ok; + QFont font = QFontDialog::getFont( &ok, m_fontselButton->font(), this ); + if ( ok ) + { + // font is set to the font the user selected + setCharDictFont( font ); + } +} + +void KUimCharDict::slotCharSelected( const QString &c ) +{ + m_charLineEdit->setText( m_charLineEdit->text() + c ); +} Index: qt4/chardict/kseparator.cpp =================================================================== --- qt4/chardict/kseparator.cpp (revision 0) +++ qt4/chardict/kseparator.cpp (revision 0) @@ -0,0 +1,112 @@ +/* +* Copyright (C) 1997 Michael Roth +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU Library General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Library General Public License for more details. +* +* You should have received a copy of the GNU Library General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +* +*/ +#include "kseparator.h" + +#include +#include + +KSeparator::KSeparator( QWidget* parent, Qt::WFlags f ) + : QFrame( parent, f ) +{ + setLineWidth( 1 ); + setMidLineWidth( 0 ); + setOrientation( HLine ); +} + + + +KSeparator::KSeparator( int orientation, QWidget* parent, Qt::WFlags f ) + : QFrame( parent, f ) +{ + setLineWidth( 1 ); + setMidLineWidth( 0 ); + setOrientation( orientation ); +} + + + +void KSeparator::setOrientation( int orientation ) +{ + switch ( orientation ) + { + case Qt::Vertical: + case VLine: + setFrameStyle( QFrame::VLine | QFrame::Sunken ); + setMinimumSize( 2, 0 ); + break; + + default: + qDebug( "KSeparator::setOrientation(): invalid orientation, using default orientation HLine" ); + + case Qt::Horizontal: + case HLine: + setFrameStyle( QFrame::HLine | QFrame::Sunken ); + setMinimumSize( 0, 2 ); + break; + } +} + + + +int KSeparator::orientation() const +{ + if ( frameStyle() & VLine ) + return VLine; + + if ( frameStyle() & HLine ) + return HLine; + + return 0; +} + +void KSeparator::drawFrame( QPainter *p ) +{ + QPoint p1, p2; + QRect r = frameRect(); + + if ( frameStyle() & HLine ) + { + p1 = QPoint( r.x(), r.height() / 2 ); + p2 = QPoint( r.x() + r.width(), p1.y() ); + } + else + { + p1 = QPoint( r.x() + r.width() / 2, 0 ); + p2 = QPoint( p1.x(), r.height() ); + } + + QStyleOption opt( lineWidth(), midLineWidth() ); + opt.state = QStyle::State_Sunken; + style()->drawPrimitive( QStyle::PE_IndicatorToolBarSeparator, &opt, p ); +} + + +QSize KSeparator::sizeHint() const +{ + if ( frameStyle() & VLine ) + return QSize( 2, 0 ); + + if ( frameStyle() & HLine ) + return QSize( 0, 2 ); + + return QSize( -1, -1 ); +} + +void KSeparator::virtual_hook( int, void* ) +{ /*BASE::virtual_hook( id, data );*/ } Index: qt4/chardict/qt4.h =================================================================== --- qt4/chardict/qt4.h (revision 0) +++ qt4/chardict/qt4.h (revision 0) @@ -0,0 +1,101 @@ +/* + +Copyright (c) 2003-2009 uim Project http://code.google.com/p/uim/ + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. +3. Neither the name of authors nor the names of its contributors +may be used to endorse or promote products derived from this software +without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +*/ +#ifndef UIM_QT4_CHARDICT_CHARDICT_QT_H +#define UIM_QT4_CHARDICT_CHARDICT_QT_H + +#include + +class QComboBox; +class QLineEdit; +class QPushButton; +class QStackedWidget; +class QString; + +class BushuViewWidget; +class UnicodeViewWidget; + +class KUimCharDict : public QWidget +{ + Q_OBJECT + +public: + explicit KUimCharDict( QWidget *parent = 0 ); + ~KUimCharDict(); + + enum Mode { + BUSHU = 0, + UNICODE = 1, + UNKNOWN = 20 + }; + +protected: + void setupWidgets(); + void setupBushuWidgets(); + + void writeConfig(); + void readConfig(); + + void setCharDictFont( const QFont &font ); + +public slots: + void changeMode( int mode ); + +protected slots: + void slotSelectFont(); + void slotCharSelected( const QString &c ); + +protected: + QComboBox *m_modeCombo; + QPushButton *m_fontselButton; + QLineEdit *m_charLineEdit; + + QStackedWidget *m_widgetStack; + BushuViewWidget *m_bushuView; + UnicodeViewWidget *m_unicodeView; +}; + +class CharDictViewBase : public QWidget +{ + Q_OBJECT + +public: + explicit CharDictViewBase( QWidget *parent = 0 ) + : QWidget( parent ) {} + + virtual void setFont( const QFont &font ) = 0; + +signals: + void charSelected( const QString & ); +}; + +#endif /* Not def: UIM_QT4_CHARDICT_CHARDICT_QT_H */ Index: qt4/chardict/chargridview.cpp =================================================================== --- qt4/chardict/chargridview.cpp (revision 0) +++ qt4/chardict/chargridview.cpp (revision 0) @@ -0,0 +1,196 @@ +/* + +Copyright (c) 2003-2009 uim Project http://code.google.com/p/uim/ + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. +3. Neither the name of authors nor the names of its contributors +may be used to endorse or promote products derived from this software +without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +*/ +#include "chargridview.h" + +#include +#include +#include +#include +#include + +static const int COLS = 10; + +CharGridView::CharGridView( int x, int y, QWidget *parent ) + : QTableWidget( parent ) +{ + setColumnCount( x ); + setRowCount( y ); + QHeaderView *header = horizontalHeader(); + header->setVisible( false ); + for ( int i = 0; i < x; i++) + { + header->setResizeMode( i, QHeaderView::Fixed ); + header->resizeSection( i, 30 ); + } + header = verticalHeader(); + header->setVisible( false ); + for ( int i = 0; i < y; i++) + { + header->setResizeMode( i, QHeaderView::Fixed ); + header->resizeSection( i, 30 ); + } + setSelectionBehavior( QAbstractItemView::SelectItems ); + setSelectionMode( QAbstractItemView::SingleSelection ); + + setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); + + + setFrameStyle( QFrame::NoFrame ); + show(); +} + +CharGridView::~CharGridView() +{} + +void CharGridView::mousePressEvent( QMouseEvent * e ) +{ + if ( e->button() != Qt::LeftButton ) + return; + QTableWidget::mousePressEvent( e ); +} + +void CharGridView::mouseReleaseEvent( QMouseEvent * e ) +{ + if ( e->button() != Qt::LeftButton ) + return; + + QTableWidgetItem *item = itemAt( e->pos() ); + emit charSelected( item ? item->text() : QString() ); +} + +QSize CharGridView::sizeHint() const +{ + return QSize( columnCount() * horizontalHeader()->sectionSize( 0 ), + rowCount() * verticalHeader()->sectionSize( 0 ) ); +} + +void CharGridView::setFont( const QFont &font ) +{ + for ( int i = 0; i < rowCount(); i++) + { + for ( int j = 0; j < columnCount(); j++) + { + QTableWidgetItem *cell = item( i, j ); + if ( cell ) + cell->setFont( font ); + } + } +} + +void CharGridView::resizeEvent( QResizeEvent * /* e */ ) +{ + updateCharGridView(); +} + +void CharGridView::setCharacters( const QStringList &charList ) +{ + int total = charList.count(); + + int cols = COLS; + int rows = total / COLS; + if ( total % COLS > 0 ) + { + rows++; + } + int prevCols = columnCount(); + int prevRows = rowCount(); + setColumnCount( cols ); + setRowCount( rows ); + QHeaderView *header = horizontalHeader(); + for ( int i = prevCols + 1; i < cols; i++) + { + header->setResizeMode( i, QHeaderView::Fixed ); + header->resizeSection( i, header->sectionSize( 0 ) ); + } + header = verticalHeader(); + for ( int i = prevRows + 1; i < rows; i++) + { + header->setResizeMode( i, QHeaderView::Fixed ); + header->resizeSection( i, header->sectionSize( 0 ) ); + } + for ( int i = 0; i < rows; i++) + { + for ( int j = 0; j < cols; j++) + { + int index = i * COLS + j; + QString str = index < total ? charList.at( index ) : QString(); + QTableWidgetItem *cell = item( i, j ); + if ( !cell ) + { + cell = new QTableWidgetItem; + cell->setTextAlignment( Qt::AlignCenter ); + cell->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled ); + cell->setFont( font() ); + setItem( i, j, cell ); + } + cell->setText( str ); + } + } + + updateCharGridView(); +} + +void CharGridView::updateCharGridView() +{ + int cellsize = 0; + QScrollBar *vScrollBar = verticalScrollBar(); + /** + * 2004-12-06 Kazuki Ohta + * FIXME: + * The timing vScrollBar is shown is tricky. + * So this code doesn't work properly. + * hmm.. + */ + /* + if( vScrollBar->isShown() ) + { + qDebug("vScrollBar->isShown() = true"); + cellsize = (width() - vScrollBar->minimumWidth())/numCols(); + } + else + { + qDebug("vScrollBar->isShown() = false"); + cellsize = width()/numCols(); + } + */ + // adhoc code + // but minimumWidth() is always 0 ? + cellsize = ( width() - vScrollBar->minimumWidth() ) / columnCount(); + + QHeaderView *header = horizontalHeader(); + for ( int i = 0; i < columnCount(); i++) + header->resizeSection( i, cellsize ); + header = verticalHeader(); + for ( int i = 0; i < rowCount(); i++) + header->resizeSection( i, cellsize ); +} Index: qt4/chardict/kseparator.h =================================================================== --- qt4/chardict/kseparator.h (revision 0) +++ qt4/chardict/kseparator.h (revision 0) @@ -0,0 +1,85 @@ +/* +* Copyright (C) 1997 Michael Roth +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU Library General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Library General Public License for more details. +* +* You should have received a copy of the GNU Library General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +* +*/ + +#ifndef KSEPARATOR_H +#define KSEPARATOR_H + +#include + +/** + * Standard horizontal or vertical separator. + * + * @author Michael Roth + * @version $Id: kseparator.h,v 1.14 2004/09/09 15:23:53 faure Exp $ +*/ +class KSeparator : public QFrame +{ + Q_OBJECT + Q_PROPERTY( int orientation READ orientation WRITE setOrientation ) +public: + /** + * Constructor. + * @param parent parent object. + * @param name name of the new object. + * @param f extra QWidget flags. + **/ + explicit KSeparator( QWidget* parent = 0, Qt::WFlags f = 0 ); + + /** + * Constructor. + * @param orientation Set the orientation of the separator. + * Possible values are HLine or Horizontal and VLine or Vertical. + * @param parent parent object. + * @param name name of the new object. + * @param f extra QWidget flags. + **/ + explicit KSeparator( int orientation, QWidget* parent = 0, + Qt::WFlags f = 0 ); + + /** + * Returns the orientation of the separator. + * @return int Possible values are VLine and HLine. + **/ + int orientation() const; + + /** + * Set the orientation of the separator to @p orient + * + * @param orient Possible values are VLine and HLine. + */ + void setOrientation( int orient ); + + /** + * The recommended height (width) for a horizontal (vertical) separator. + **/ + virtual QSize sizeHint() const; + +protected: + /** + * @param p pointer to painter + */ + virtual void drawFrame( QPainter *p ); +protected: + virtual void virtual_hook( int id, void* data ); +private: + class KSeparatorPrivate* d; +}; + + +#endif // __KSEPARATOR_H__ Index: qt4/chardict/chargridview.h =================================================================== --- qt4/chardict/chargridview.h (revision 0) +++ qt4/chardict/chargridview.h (revision 0) @@ -0,0 +1,67 @@ +/* + +Copyright (c) 2003-2009 uim Project http://code.google.com/p/uim/ + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. +3. Neither the name of authors nor the names of its contributors +may be used to endorse or promote products derived from this software +without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +*/ +#ifndef UIM_QT4_CHARDICT_CHAR_GRID_VIEW_H +#define UIM_QT4_CHARDICT_CHAR_GRID_VIEW_H + +#include + +class QFont; +class QMouseEvent; +class QResizeEvent; +class QStringList; + +class CharGridView : public QTableWidget +{ + Q_OBJECT + +public: + CharGridView( int x, int y, QWidget *parent = 0 ); + ~CharGridView(); + + void setCharacters( const QStringList &charList ); + virtual QSize sizeHint() const; + + void setFont( const QFont &font ); + +protected: + virtual void resizeEvent( QResizeEvent * e ); + virtual void mousePressEvent( QMouseEvent * e ); + virtual void mouseReleaseEvent( QMouseEvent * e ); + + void updateCharGridView(); + +signals: + void charSelected( const QString & ); +}; + +#endif /* Not def: UIM_QT4_CHARDICT_CHAR_GRID_VIEW_H */ Index: qt4/chardict/bushuviewwidget.cpp =================================================================== --- qt4/chardict/bushuviewwidget.cpp (revision 0) +++ qt4/chardict/bushuviewwidget.cpp (revision 0) @@ -0,0 +1,180 @@ +/* + +Copyright (c) 2003-2009 uim Project http://code.google.com/p/uim/ + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. +3. Neither the name of authors nor the names of its contributors +may be used to endorse or promote products derived from this software +without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +*/ +#include "bushuviewwidget.h" +#include "chargridview.h" +#include "qtgettext.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static const char BUSHUDICT[] = DATADIR "/uim/helperdata/bushu.t"; +static const char BUSHUDICT_ENCODING[] = "EUC-JP"; + +BushuViewWidget::BushuViewWidget( QWidget *parent ) + : CharDictViewBase( parent ) +{ + setupWidgets(); + readDict(); + + readConfig(); +} + +BushuViewWidget::~BushuViewWidget() +{ + writeConfig(); +} + +void BushuViewWidget::setupWidgets() +{ + m_mainSplitter = new QSplitter( this ); + + QFrame *leftVBox = new QFrame( m_mainSplitter ); + QLabel *bushuLabel = new QLabel; + bushuLabel->setText( _( "Bushu List" ) ); + bushuLabel->setAlignment( Qt::AlignHCenter ); + m_bushuListView = new QListWidget; + m_bushuListView->setSelectionMode( QAbstractItemView::SingleSelection ); + m_bushuListView->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); + connect( m_bushuListView, SIGNAL( itemSelectionChanged() ), + this, SLOT( slotBushuSelected() ) ); + + m_charGridView = new CharGridView( 10, 0, m_mainSplitter ); + connect( m_charGridView, SIGNAL( charSelected( const QString & ) ), + this, SIGNAL( charSelected( const QString & ) ) ); + + QVBoxLayout *vLayout = new QVBoxLayout; + vLayout->addWidget( bushuLabel ); + vLayout->addWidget( m_bushuListView ); + + leftVBox->setLayout( vLayout ); + + // main layout + QHBoxLayout* layout = new QHBoxLayout( this ); + layout->addWidget( m_mainSplitter ); +} + +void BushuViewWidget::readDict() +{ + QFile file( BUSHUDICT ); + if ( file.open( QIODevice::ReadOnly ) ) + { + QTextStream stream( &file ); + stream.setCodec(QTextCodec::codecForName(BUSHUDICT_ENCODING)); + QString line; + while ( !stream.atEnd() ) + { + QString bushuName + = stream.readLine().split( ' ', QString::SkipEmptyParts ) [ 0 ]; + + // insert last + m_bushuListView->addItem( bushuName ); + } + file.close(); + } +} + +void BushuViewWidget::slotBushuSelected() +{ + QList items = m_bushuListView->selectedItems(); + if ( items.isEmpty() ) + return ; + + QString selectedBushuName = items[ 0 ]->text(); + if ( selectedBushuName.isEmpty() ) + return ; + + QFile file( BUSHUDICT ); + if ( file.open( QIODevice::ReadOnly ) ) + { + QTextStream stream( &file ); + stream.setCodec(QTextCodec::codecForName(BUSHUDICT_ENCODING)); + QString line; + + // search selected bushu line by line + while ( !stream.atEnd() ) + { + QStringList chars + = stream.readLine().split( ' ', QString::SkipEmptyParts ); + QString bushuName = chars[ 0 ]; + if ( selectedBushuName == bushuName ) + { + // Display Characters + chars.removeAll( bushuName ); + m_charGridView->setCharacters( chars ); + } + } + file.close(); + } +} + +void BushuViewWidget::writeConfig() +{ + QSettings settings; + + // splitter + QString str; + QTextStream out( &str ); + out << *m_mainSplitter; + settings.setValue( "/uim-kdehelper/chardict/bushuview/splitter", str ); +} + +void BushuViewWidget::readConfig() +{ + QSettings settings; + QString str; + + // splitter + str = settings.value( + "/uim-kdehelper/chardict/bushuview/splitter" ).toString(); + if ( !str.isEmpty() ) + { + QTextStream in( &str ); + in >> *m_mainSplitter; + } +} + +void BushuViewWidget::setFont( const QFont &font ) +{ + m_charGridView->setFont( font ); +} Index: qt4/chardict/unicodeviewwidget.cpp =================================================================== --- qt4/chardict/unicodeviewwidget.cpp (revision 0) +++ qt4/chardict/unicodeviewwidget.cpp (revision 0) @@ -0,0 +1,293 @@ +/* + +Copyright (c) 2003-2009 uim Project http://code.google.com/p/uim/ + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. +3. Neither the name of authors nor the names of its contributors +may be used to endorse or promote products derived from this software +without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +*/ +#include "unicodeviewwidget.h" +#include "chargridview.h" +#include "qtgettext.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class UnicodeBlock +{ +public: + UnicodeBlock( const QString &name, uint startHex, uint endHex ) + { + m_name = name; + m_startHex = startHex; + m_endHex = endHex; + } + + QString getName() const { return m_name; } + uint getStartHex() const { return m_startHex; } + uint getEndHex() const { return m_endHex; } + +protected: + QString m_name; + uint m_startHex; + uint m_endHex; +}; + +static const int UBLOCK_SIZE = 125; +static UnicodeBlock uBlocks[ UBLOCK_SIZE ] = { + UnicodeBlock( _( "Basic Latin" ), 0x0000, 0x007F ), + UnicodeBlock( _( "Latin-1 Supplement" ), 0x0080, 0x00FF ), + UnicodeBlock( _( "Latin Extended-A" ), 0x0100, 0x017F ), + UnicodeBlock( _( "Latin Extended-B" ), 0x0180, 0x024F ), + UnicodeBlock( _( "IPA Extensions" ), 0x0250, 0x02AF ), + UnicodeBlock( _( "Spacing Modifier Letters" ), 0x02B0, 0x02FF ), + UnicodeBlock( _( "Combining Diacritical Marks" ), 0x0300, 0x036F ), + UnicodeBlock( _( "Greek and Coptic" ), 0x0370, 0x03FF ), + UnicodeBlock( _( "Cyrillic" ), 0x0400, 0x04FF ), + UnicodeBlock( _( "Cyrillic Supplement" ), 0x0500, 0x052F ), + UnicodeBlock( _( "Armenian" ), 0x0530, 0x058F ), + UnicodeBlock( _( "Hebrew" ), 0x0590, 0x05FF ), + UnicodeBlock( _( "Arabic" ), 0x0600, 0x06FF ), + UnicodeBlock( _( "Syriac" ), 0x0700, 0x074F ), + UnicodeBlock( _( "Thaana" ), 0x0780, 0x07BF ), + UnicodeBlock( _( "Devanagari" ), 0x0900, 0x097F ), + UnicodeBlock( _( "Bengali" ), 0x0980, 0x09FF ), + UnicodeBlock( _( "Gurmukhi" ), 0x0A00, 0x0A7F ), + UnicodeBlock( _( "Gujarati" ), 0x0A80, 0x0AFF ), + UnicodeBlock( _( "Oriya" ), 0x0B00, 0x0B7F ), + UnicodeBlock( _( "Tamil" ), 0x0B80, 0x0BFF ), + UnicodeBlock( _( "Telugu" ), 0x0C00, 0x0C7F ), + UnicodeBlock( _( "Kannada" ), 0x0C80, 0x0CFF ), + UnicodeBlock( _( "Malayalam" ), 0x0D00, 0x0D7F ), + UnicodeBlock( _( "Sinhala" ), 0x0D80, 0x0DFF ), + UnicodeBlock( _( "Thai" ), 0x0E00, 0x0E7F ), + UnicodeBlock( _( "Lao" ), 0x0E80, 0x0EFF ), + UnicodeBlock( _( "Tibetan" ), 0x0F00, 0x0FFF ), + UnicodeBlock( _( "Myanmar" ), 0x1000, 0x109F ), + UnicodeBlock( _( "Georgian" ), 0x10A0, 0x10FF ), + UnicodeBlock( _( "Hangul Jamo" ), 0x1100, 0x11FF ), + UnicodeBlock( _( "Ethiopic" ), 0x1200, 0x137F ), + UnicodeBlock( _( "Cherokee" ), 0x13A0, 0x13FF ), + UnicodeBlock( _( "Unified Canadian Aboriginal Syllabics" ), 0x1400, 0x167F ), + UnicodeBlock( _( "Ogham" ), 0x1680, 0x169F ), + UnicodeBlock( _( "Runic" ), 0x16A0, 0x16FF ), + UnicodeBlock( _( "Tagalog" ), 0x1700, 0x171F ), + UnicodeBlock( _( "Hanunoo" ), 0x1720, 0x173F ), + UnicodeBlock( _( "Buhid" ), 0x1740, 0x175F ), + UnicodeBlock( _( "Tagbanwa" ), 0x1760, 0x177F ), + UnicodeBlock( _( "Khmer" ), 0x1780, 0x17FF ), + UnicodeBlock( _( "Mongolian" ), 0x1800, 0x18AF ), + UnicodeBlock( _( "Limbu" ), 0x1900, 0x194F ), + UnicodeBlock( _( "Tai Letters" ), 0x1950, 0x197F ), + UnicodeBlock( _( "Khmer Symbols" ), 0x19E0, 0x19FF ), + UnicodeBlock( _( "Phonetic Extensions" ), 0x1D00, 0x1D7F ), + UnicodeBlock( _( "Latin Extended Additional" ), 0x1E00, 0x1EFF ), + UnicodeBlock( _( "Greek Extended-B" ), 0x1F00, 0x1FFF ), + UnicodeBlock( _( "General Punctuation" ), 0x2000, 0x206F ), + UnicodeBlock( _( "Superscripts and Subscripts" ), 0x2070, 0x209F ), + UnicodeBlock( _( "Currency Symbols" ), 0x20A0, 0x20CF ), + UnicodeBlock( _( "Combining Diacritical Marks for Symbols" ), 0x20D0, 0x20FF ), + UnicodeBlock( _( "Letterlike Symbols" ), 0x2100, 0x214F ), + UnicodeBlock( _( "Number Forms" ), 0x2150, 0x218F ), + UnicodeBlock( _( "Arrows" ), 0x2190, 0x21FF ), + UnicodeBlock( _( "Mathematical Operators" ), 0x2200, 0x22FF ), + UnicodeBlock( _( "Miscellaneous Technical" ), 0x2300, 0x23FF ), + UnicodeBlock( _( "Control Pictures" ), 0x2400, 0x243F ), + UnicodeBlock( _( "Optical Character Recognition" ), 0x2440, 0x245F ), + UnicodeBlock( _( "Enclosed Alphanumerics" ), 0x2460, 0x24FF ), + UnicodeBlock( _( "Box Drawing" ), 0x2500, 0x257F ), + UnicodeBlock( _( "Block Elements" ), 0x2580, 0x259F ), + UnicodeBlock( _( "Geometric Shapes" ), 0x25A0, 0x25FF ), + UnicodeBlock( _( "Miscellaneous Symbols" ), 0x2600, 0x26FF ), + UnicodeBlock( _( "Dingbats" ), 0x2700, 0x27BF ), + UnicodeBlock( _( "Miscellaneous Mathematical Symbols-A" ), 0x27C0, 0x27EF ), + UnicodeBlock( _( "Supplemental Arrows-A" ), 0x27F0, 0x27FF ), + UnicodeBlock( _( "Braille Patterns" ), 0x2800, 0x28FF ), + UnicodeBlock( _( "Supplemental Arrows-B" ), 0x2900, 0x297F ), + UnicodeBlock( _( "Miscellaneous Mathematical Symbols-B" ), 0x2980, 0x29FF ), + UnicodeBlock( _( "Supplemental Mathematical Operators" ), 0x2A00, 0x2AFF ), + UnicodeBlock( _( "Miscellaneous Symbols and Arrows-B" ), 0x2B00, 0x2BFF ), + UnicodeBlock( _( "CJK Radicals Supplemental" ), 0x2E80, 0x2EFF ), + UnicodeBlock( _( "Kangxi Radicals" ), 0x2F00, 0x2FDF ), + UnicodeBlock( _( "Ideographic Description Characters" ), 0x2FF0, 0x2FFF ), + UnicodeBlock( _( "CJK Symbols and Punctuation" ), 0x3000, 0x303F ), + UnicodeBlock( _( "Hiragana" ), 0x3040, 0x309F ), + UnicodeBlock( _( "Katakana" ), 0x30A0, 0x30FF ), + UnicodeBlock( _( "Bopomofo" ), 0x3100, 0x312F ), + UnicodeBlock( _( "Hangul Compatibility Jamo" ), 0x3130, 0x318F ), + UnicodeBlock( _( "Kanbun" ), 0x3190, 0x319F ), + UnicodeBlock( _( "Bopomofo Extended-B 1F00" ), 0x31A0, 0x31BF ), + UnicodeBlock( _( "Katakana Phonetic Extensions" ), 0x31F0, 0x31FF ), + UnicodeBlock( _( "Enclosed CJK Letters and Months" ), 0x3200, 0x32FF ), + UnicodeBlock( _( "CJK Compatibility" ), 0x3300, 0x33FF ), + UnicodeBlock( _( "CJK Unified Ideographs Extension and" ), 0x3400, 0x4DBF ), + UnicodeBlock( _( "Yijing Hexagram Symbols-B" ), 0x4DC0, 0x4DFF ), + UnicodeBlock( _( "CJK Unified Ideographs" ), 0x4E00, 0x9FFF ), + UnicodeBlock( _( "Yi Syllables" ), 0xA000, 0xA48F ), + UnicodeBlock( _( "Yi Radicals" ), 0xA490, 0xA4CF ), + UnicodeBlock( _( "Hangul Syllables" ), 0xAC00, 0xD7AF ), + UnicodeBlock( _( "High Surrogates" ), 0xD800, 0xDB7F ), + UnicodeBlock( _( "High Private Use Surrogates" ), 0xDB80, 0xDBFF ), + UnicodeBlock( _( "Low Surrogates" ), 0xDC00, 0xDFFF ), + UnicodeBlock( _( "Private Use Area" ), 0xE000, 0xF8FF ), + UnicodeBlock( _( "CJK Compatibility Ideographs" ), 0xF900, 0xFAFF ), + UnicodeBlock( _( "Alphabetic Presentation Forms" ), 0xFB00, 0xFB4F ), + UnicodeBlock( _( "Arabic Presentation Forms-A" ), 0xFB50, 0xFDFF ), + UnicodeBlock( _( "Variation Selectors" ), 0xFE00, 0xFE0F ), + UnicodeBlock( _( "Combining Half Marks" ), 0xFE20, 0xFE2F ), + UnicodeBlock( _( "CJK Compatibility Forms-A" ), 0xFE30, 0xFE4F ), + UnicodeBlock( _( "Small Form Variants" ), 0xFE50, 0xFE6F ), + UnicodeBlock( _( "Arabic Presentation Forms-B" ), 0xFE70, 0xFEFF ), + UnicodeBlock( _( "Halfwidth and Fullwidth Forms-B" ), 0xFF00, 0xFFEF ), + UnicodeBlock( _( "Specials" ), 0xFFF0, 0xFFFF ), + UnicodeBlock( _( "Linear B Syllabary" ), 0x10000, 0x1007F ), + UnicodeBlock( _( "Linear B Ideograms" ), 0x10080, 0x100FF ), + UnicodeBlock( _( "Aegean Numbers" ), 0x10100, 0x1013F ), + UnicodeBlock( _( "Old Italic" ), 0x10300, 0x1032F ), + UnicodeBlock( _( "Gothic" ), 0x10330, 0x1034F ), + UnicodeBlock( _( "Ugaritic" ), 0x10380, 0x1039F ), + UnicodeBlock( _( "Deseret" ), 0x10400, 0x1044F ), + UnicodeBlock( _( "Shavian" ), 0x10450, 0x1047F ), + UnicodeBlock( _( "Osmanya" ), 0x10480, 0x104AF ), + UnicodeBlock( _( "Cypriot Syllabary" ), 0x10800, 0x1083F ), + UnicodeBlock( _( "Byzantine Musical Symbols-B 4DC0" ), 0x1D000, 0x1D0FF ), + UnicodeBlock( _( "Musical Symbols-B 4DC0 1D000" ), 0x1D100, 0x1D1FF ), + UnicodeBlock( _( "Tai Xuan Jing Symbols-B 4DC0 1D000 1D100" ), 0x1D300, 0x1D35F ), + UnicodeBlock( _( "Mathematical Alphanumeric Symbols-B 4DC0 1D000 1D100 1D300" ), 0x1D400, 0x1D7FF ), + UnicodeBlock( _( "CJK Unified Ideographs Extension B 4DC0 1D000 1D100 1D300 1D400" ), 0x20000, 0x2A6DF ), + UnicodeBlock( _( "CJK Compatibility Ideographs Supplemental 2E80" ), 0x2F800, 0x2FA1F ), + UnicodeBlock( _( "Tags" ), 0xE0000, 0xE007F ), + UnicodeBlock( _( "Variation Selectors Supplemental 2E80 2F800" ), 0xE0100, 0xE01EF ), + UnicodeBlock( _( "Supplementary Private Use Area-A" ), 0xF0000, 0xFFFFF ), + UnicodeBlock( _( "Supplementary Private Use Area-B" ), 0x100000, 0x10FFFF ) + }; + +UnicodeViewWidget::UnicodeViewWidget( QWidget *parent ) + : CharDictViewBase( parent ) +{ + uBlockMap.clear(); + + setupWidgets(); + + readConfig(); +} + +UnicodeViewWidget::~UnicodeViewWidget() +{ + writeConfig(); +} + +void UnicodeViewWidget::setupWidgets() +{ + m_mainSplitter = new QSplitter( this ); + + QFrame *leftVBox = new QFrame( m_mainSplitter ); + QLabel *unicodeBlockLabel = new QLabel; + unicodeBlockLabel->setText( _( "UnicodeBlock List" ) ); + unicodeBlockLabel->setAlignment( Qt::AlignHCenter ); + m_unicodeBlockListView = new QListWidget; + m_unicodeBlockListView->setSelectionMode( + QAbstractItemView::SingleSelection ); + m_unicodeBlockListView->setHorizontalScrollBarPolicy( + Qt::ScrollBarAlwaysOff ); + connect( m_unicodeBlockListView, SIGNAL( itemSelectionChanged() ), + this, SLOT( slotUnicodeBlockSelected() ) ); + // add Item + for ( int i = UBLOCK_SIZE - 1; i >= 0; i-- ) + { + QListWidgetItem *item = new QListWidgetItem( uBlocks[ i ].getName() ); + m_unicodeBlockListView->insertItem( 0, item ); + uBlockMap[ item ] = &uBlocks[ i ]; + } + + m_charGridView = new CharGridView( 10, 0, m_mainSplitter ); + connect( m_charGridView, SIGNAL( charSelected( const QString & ) ), + this, SIGNAL( charSelected( const QString & ) ) ); + + QVBoxLayout *vLayout = new QVBoxLayout; + vLayout->addWidget( unicodeBlockLabel ); + vLayout->addWidget( m_unicodeBlockListView ); + + leftVBox->setLayout( vLayout ); + + // main layout + QHBoxLayout* layout = new QHBoxLayout( this ); + layout->addWidget( m_mainSplitter ); +} + +void UnicodeViewWidget::slotUnicodeBlockSelected() +{ + QList items = m_unicodeBlockListView->selectedItems(); + if ( items.isEmpty() ) + return; + UnicodeBlock * block = uBlockMap[ items[ 0 ] ]; + + QStringList charList; + for ( uint d = block->getStartHex(); d < block->getEndHex(); d++ ) + { + charList.append( QString( QChar( d ) ) ); + } + + m_charGridView->setCharacters( charList ); +} + +void UnicodeViewWidget::writeConfig() +{ + QSettings settings; + + // splitter + QString str; + QTextStream out( &str ); + out << *m_mainSplitter; + settings.setValue( "/uim-kdehelper/chardict/unicodeview/splitter", str ); +} +void UnicodeViewWidget::readConfig() +{ + QSettings settings; + QString str; + + // splitter + str = settings.value( + "/uim-kdehelper/chardict/unicodeview/splitter" ).toString(); + if ( !str.isEmpty() ) + { + QTextStream in( &str ); + in >> *m_mainSplitter; + } +} + +void UnicodeViewWidget::setFont( const QFont &font ) +{ + m_charGridView->setFont( font ); +} Index: qt4/chardict/Makefile.am =================================================================== --- qt4/chardict/Makefile.am (revision 0) +++ qt4/chardict/Makefile.am (revision 0) @@ -0,0 +1,36 @@ +.PHONY: mocclean FORCE + +# Makefile.qmake is only exist when --enable-qt4 +if QT4 +SUBDIRS = po + +all clean mocclean install uninstall: + $(MAKE) $(AM_MAKEFLAGS) -f Makefile.qmake INSTALL_ROOT=$(DESTDIR) $@ + +helperdatadir = $(datadir)/uim/helperdata +helperdata_DATA = bushu.t + +# *.pro is required to run Makefile.qmake. So distclean-am is deferred. +distclean: + $(MAKE) $(AM_MAKEFLAGS) -f Makefile.qmake $@ + $(MAKE) $(AM_MAKEFLAGS) distclean-am + -rm -f Makefile uim-chardict-qt4.pro +else +distclean: + -rm -f Makefile uim-chardict-qt4.pro +endif + +FORCE: + +EXTRA_DIST = uim-chardict-qt4.pro.in \ + chargridview.h \ + kseparator.h \ + qt4.h \ + qtgettext.h \ + unicodeviewwidget.h + bushuviewwidget.cpp \ + chargridview.cpp \ + kseparator.cpp \ + qt4.cpp \ + unicodeviewwidget.cpp \ + bushu.t Index: qt4/chardict/bushuviewwidget.h =================================================================== --- qt4/chardict/bushuviewwidget.h (revision 0) +++ qt4/chardict/bushuviewwidget.h (revision 0) @@ -0,0 +1,72 @@ +/* + +Copyright (c) 2003-2009 uim Project http://code.google.com/p/uim/ + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. +3. Neither the name of authors nor the names of its contributors +may be used to endorse or promote products derived from this software +without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +*/ +#ifndef UIM_QT4_CHARDICT_BUSHU_VIEW_WIDGET_H +#define UIM_QT4_CHARDICT_BUSHU_VIEW_WIDGET_H + +#include "qt4.h" + +#include + +class QFont; +class QSplitter; +class QListWidget; + +class CharGridView; + +class BushuViewWidget : public CharDictViewBase +{ + Q_OBJECT + +public: + explicit BushuViewWidget( QWidget *parent = 0 ); + ~BushuViewWidget(); + + void setFont( const QFont &font ); + +protected: + void setupWidgets(); + void readDict(); + + void writeConfig(); + void readConfig(); + +protected slots: + void slotBushuSelected(); + +protected: + QSplitter *m_mainSplitter; + QListWidget *m_bushuListView; + CharGridView *m_charGridView; +}; + +#endif /* Not def: UIM_QT4_CHARDICT_BUSHU_VIEW_WIDGET_H */ Index: qt4/chardict/unicodeviewwidget.h =================================================================== --- qt4/chardict/unicodeviewwidget.h (revision 0) +++ qt4/chardict/unicodeviewwidget.h (revision 0) @@ -0,0 +1,75 @@ +/* + +Copyright (c) 2003-2009 uim Project http://code.google.com/p/uim/ + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. +3. Neither the name of authors nor the names of its contributors +may be used to endorse or promote products derived from this software +without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +*/ +#ifndef UIM_QT4_CHARDICT_UNICODE_VIEW_WIDGET_H +#define UIM_QT4_CHARDICT_UNICODE_VIEW_WIDGET_H + +#include "qt4.h" + +#include + +class QFont; +class QSplitter; +class QListWidget; +class QListWidgetItem; + +class CharGridView; +class UnicodeBlock; + +class UnicodeViewWidget : public CharDictViewBase +{ + Q_OBJECT + +public: + explicit UnicodeViewWidget( QWidget *parent = 0 ); + ~UnicodeViewWidget(); + + void setFont( const QFont &font ); + +protected: + void setupWidgets(); + + void writeConfig(); + void readConfig(); + +protected slots: + void slotUnicodeBlockSelected(); + +protected: + QMap uBlockMap; + + QSplitter *m_mainSplitter; + QListWidget *m_unicodeBlockListView; + CharGridView *m_charGridView; +}; + +#endif /* Not def: UIM_QT4_CHARDICT_UNICODE_VIEW_WIDGET_H */ Index: qt4/chardict/po/LINGUAS =================================================================== --- qt4/chardict/po/LINGUAS (revision 0) +++ qt4/chardict/po/LINGUAS (revision 0) @@ -0,0 +1 @@ +ja \ No newline at end of file Index: qt4/chardict/po/remove-potcdate.sin =================================================================== --- qt4/chardict/po/remove-potcdate.sin (revision 0) +++ qt4/chardict/po/remove-potcdate.sin (revision 0) @@ -0,0 +1,19 @@ +# Sed script that remove the POT-Creation-Date line in the header entry +# from a POT file. +# +# The distinction between the first and the following occurrences of the +# pattern is achieved by looking at the hold space. +/^"POT-Creation-Date: .*"$/{ +x +# Test if the hold space is empty. +s/P/P/ +ta +# Yes it was empty. First occurrence. Remove the line. +g +d +bb +:a +# The hold space was nonempty. Following occurrences. Do nothing. +x +:b +} Index: qt4/chardict/po/ja.po =================================================================== --- qt4/chardict/po/ja.po (revision 0) +++ qt4/chardict/po/ja.po (revision 0) @@ -0,0 +1,545 @@ +# Japanese translations for uim-chardict-qt4. +# Copyright (C) 2003-2009 uim Developers +# This file is distributed under the same license as the uim package. +# Etsushi Kato , 2005 +# +# +msgid "" +msgstr "" +"Project-Id-Version: uim-chardict-qt4 1.1.0\n" +"Report-Msgid-Bugs-To: uim@lists.freedesktop.org\n" +"POT-Creation-Date: 2005-12-09 14:52+0900\n" +"PO-Revision-Date: 2005-12-06 16:15+900\n" +"Last-Translator: Daichi Kawahata \n" +"Language-Team: Japanese \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: qt4/chardict/bushuviewwidget.cpp:72 +msgid "Bushu List" +msgstr "薤筝荀" + +#: qt4/chardict/qt4.cpp:113 +msgid "Mode:" +msgstr "≪若:" + +#: qt4/chardict/qt4.cpp:115 +msgid "Bushu Search" +msgstr "薤罎膣" + +#: qt4/chardict/qt4.cpp:116 +msgid "Unicode Search" +msgstr "潟若罎膣" + +#: qt4/chardict/qt4.cpp:122 +msgid "Select Font" +msgstr "潟御" + +#: qt4/chardict/qt4.cpp:126 +msgid "Chars:" +msgstr "絖:" + +#: qt4/chardict/unicodeviewwidget.cpp:66 +msgid "Basic Latin" +msgstr "堺恰絖" + +#: qt4/chardict/unicodeviewwidget.cpp:67 +msgid "Latin-1 Supplement" +msgstr "1菴遵 (ISO 8859-1 勌)" + +#: qt4/chardict/unicodeviewwidget.cpp:68 +msgid "Latin Extended-A" +msgstr "恰絖≦宍A" + +#: qt4/chardict/unicodeviewwidget.cpp:69 +msgid "Latin Extended-B" +msgstr "恰絖≦宍B" + +#: qt4/chardict/unicodeviewwidget.cpp:70 +msgid "IPA Extensions" +msgstr "初喝0荐 (IPA ≦宍)" + +#: qt4/chardict/unicodeviewwidget.cpp:71 +msgid "Spacing Modifier Letters" +msgstr "初喝0荐 (潔活)" + +#: qt4/chardict/unicodeviewwidget.cpp:72 +msgid "Combining Diacritical Marks" +msgstr "初喝0荐 (荐)" + +#: qt4/chardict/unicodeviewwidget.cpp:73 +msgid "Greek and Coptic" +msgstr "激f絖潟絖" + +#: qt4/chardict/unicodeviewwidget.cpp:74 +msgid "Cyrillic" +msgstr "絖" + +#: qt4/chardict/unicodeviewwidget.cpp:75 +msgid "Cyrillic Supplement" +msgstr "絖菴遵" + +#: qt4/chardict/unicodeviewwidget.cpp:76 +msgid "Armenian" +msgstr "≪<∽絖" + +#: qt4/chardict/unicodeviewwidget.cpp:77 +msgid "Hebrew" +msgstr "ゆ絖" + +#: qt4/chardict/unicodeviewwidget.cpp:78 +msgid "Arabic" +msgstr "≪∽絖" + +#: qt4/chardict/unicodeviewwidget.cpp:79 +msgid "Syriac" +msgstr "激∽絖" + +#: qt4/chardict/unicodeviewwidget.cpp:80 +msgid "Thaana" +msgstr "帥若絖" + +#: qt4/chardict/unicodeviewwidget.cpp:81 +msgid "Devanagari" +msgstr "若眼<若惹絖" + +#: qt4/chardict/unicodeviewwidget.cpp:82 +msgid "Bengali" +msgstr "潟絖" + +#: qt4/chardict/unicodeviewwidget.cpp:83 +msgid "Gurmukhi" +msgstr "違惹絖" + +#: qt4/chardict/unicodeviewwidget.cpp:84 +msgid "Gujarati" +msgstr "違吾c若絖" + +#: qt4/chardict/unicodeviewwidget.cpp:85 +msgid "Oriya" +msgstr "ゆ絖" + +#: qt4/chardict/unicodeviewwidget.cpp:86 +msgid "Tamil" +msgstr "帥絖" + +#: qt4/chardict/unicodeviewwidget.cpp:87 +msgid "Telugu" +msgstr "井絖" + +#: qt4/chardict/unicodeviewwidget.cpp:88 +msgid "Kannada" +msgstr "潟絖" + +#: qt4/chardict/unicodeviewwidget.cpp:89 +msgid "Malayalam" +msgstr "ゃ若絖" + +#: qt4/chardict/unicodeviewwidget.cpp:90 +msgid "Sinhala" +msgstr "激潟絖" + +#: qt4/chardict/unicodeviewwidget.cpp:91 +msgid "Thai" +msgstr "帥ゆ絖" + +#: qt4/chardict/unicodeviewwidget.cpp:92 +msgid "Lao" +msgstr "号絖" + +#: qt4/chardict/unicodeviewwidget.cpp:93 +msgid "Tibetan" +msgstr "絖" + +#: qt4/chardict/unicodeviewwidget.cpp:94 +msgid "Myanmar" +msgstr "c潟惹絖" + +#: qt4/chardict/unicodeviewwidget.cpp:95 +msgid "Georgian" +msgstr "違吾∽絖" + +#: qt4/chardict/unicodeviewwidget.cpp:96 +msgid "Hangul Jamo" +msgstr "潟違絖罸" + +#: qt4/chardict/unicodeviewwidget.cpp:97 +msgid "Ethiopic" +msgstr "∽絖" + +#: qt4/chardict/unicodeviewwidget.cpp:98 +msgid "Cherokee" +msgstr "с惹絖" + +#: qt4/chardict/unicodeviewwidget.cpp:99 +msgid "Unified Canadian Aboriginal Syllabics" +msgstr "腟怨篏閶括" + +#: qt4/chardict/unicodeviewwidget.cpp:100 +msgid "Ogham" +msgstr "若絖" + +#: qt4/chardict/unicodeviewwidget.cpp:101 +msgid "Runic" +msgstr "若恰絖" + +#: qt4/chardict/unicodeviewwidget.cpp:102 +msgid "Tagalog" +msgstr "帥井絖" + +#: qt4/chardict/unicodeviewwidget.cpp:103 +msgid "Hanunoo" +msgstr "絖" + +#: qt4/chardict/unicodeviewwidget.cpp:104 +msgid "Buhid" +msgstr "絖" + +#: qt4/chardict/unicodeviewwidget.cpp:105 +msgid "Tagbanwa" +msgstr "帥違潟絖" + +#: qt4/chardict/unicodeviewwidget.cpp:106 +msgid "Khmer" +msgstr "<若絖" + +#: qt4/chardict/unicodeviewwidget.cpp:107 +msgid "Mongolian" +msgstr "≪潟眼絖" + +#: qt4/chardict/unicodeviewwidget.cpp:108 +msgid "Limbu" +msgstr "潟惹絖" + +#: qt4/chardict/unicodeviewwidget.cpp:109 +msgid "Tai Letters" +msgstr "帥ゆ絖" + +#: qt4/chardict/unicodeviewwidget.cpp:110 +msgid "Khmer Symbols" +msgstr "<若荐" + +#: qt4/chardict/unicodeviewwidget.cpp:111 +msgid "Phonetic Extensions" +msgstr "井鴻咲活" + +#: qt4/chardict/unicodeviewwidget.cpp:112 +msgid "Latin Extended Additional" +msgstr "恰絖≦宍菴遵" + +#: qt4/chardict/unicodeviewwidget.cpp:113 +msgid "Greek Extended-B" +msgstr "激∽絖≦宍B" + +#: qt4/chardict/unicodeviewwidget.cpp:114 +msgid "General Punctuation" +msgstr "筝ヨ" + +#: qt4/chardict/unicodeviewwidget.cpp:115 +msgid "Superscripts and Subscripts" +msgstr "筝篁/筝篁絖" + +#: qt4/chardict/unicodeviewwidget.cpp:116 +msgid "Currency Symbols" +msgstr "莢荐" + +#: qt4/chardict/unicodeviewwidget.cpp:117 +msgid "Combining Diacritical Marks for Symbols" +msgstr "初喝0荐 (荐)" + +#: qt4/chardict/unicodeviewwidget.cpp:118 +msgid "Letterlike Symbols" +msgstr "絖罕荐" + +#: qt4/chardict/unicodeviewwidget.cpp:119 +msgid "Number Forms" +msgstr "医羣" + +#: qt4/chardict/unicodeviewwidget.cpp:120 +msgid "Arrows" +msgstr "√" + +#: qt4/chardict/unicodeviewwidget.cpp:121 +msgid "Mathematical Operators" +msgstr "医荐" + +#: qt4/chardict/unicodeviewwidget.cpp:122 +msgid "Miscellaneous Technical" +msgstr "篁茵荐" + +#: qt4/chardict/unicodeviewwidget.cpp:123 +msgid "Control Pictures" +msgstr "九勝罘順荐" + +#: qt4/chardict/unicodeviewwidget.cpp:124 +msgid "Optical Character Recognition" +msgstr "絖綣絖茯茘" + +#: qt4/chardict/unicodeviewwidget.cpp:125 +msgid "Enclosed Alphanumerics" +msgstr "蚊粋掩医" + +#: qt4/chardict/unicodeviewwidget.cpp:126 +msgid "Box Drawing" +msgstr "臀膩膣莨" + +#: qt4/chardict/unicodeviewwidget.cpp:127 +msgid "Block Elements" +msgstr "荀膣" + +#: qt4/chardict/unicodeviewwidget.cpp:128 +msgid "Geometric Shapes" +msgstr "綛鞘絖罔≧" + +#: qt4/chardict/unicodeviewwidget.cpp:129 +msgid "Miscellaneous Symbols" +msgstr "篁荐" + +#: qt4/chardict/unicodeviewwidget.cpp:130 +msgid "Dingbats" +msgstr "茖蕋乗" + +#: qt4/chardict/unicodeviewwidget.cpp:131 +msgid "Miscellaneous Mathematical Symbols-A" +msgstr "篁医荐A" + +#: qt4/chardict/unicodeviewwidget.cpp:132 +msgid "Supplemental Arrows-A" +msgstr "菴遵√A" + +#: qt4/chardict/unicodeviewwidget.cpp:133 +msgid "Braille Patterns" +msgstr "ゃ劫喝就" + +#: qt4/chardict/unicodeviewwidget.cpp:134 +msgid "Supplemental Arrows-B" +msgstr "菴遵√B" + +#: qt4/chardict/unicodeviewwidget.cpp:135 +msgid "Miscellaneous Mathematical Symbols-B" +msgstr "篁医荐B" + +#: qt4/chardict/unicodeviewwidget.cpp:136 +msgid "Supplemental Mathematical Operators" +msgstr "菴遵医荐" + +#: qt4/chardict/unicodeviewwidget.cpp:137 +msgid "Miscellaneous Symbols and Arrows-B" +msgstr "篁荐垸括√B" + +#: qt4/chardict/unicodeviewwidget.cpp:138 +msgid "CJK Radicals Supplemental" +msgstr "CJK薤菴遵" + +#: qt4/chardict/unicodeviewwidget.cpp:139 +msgid "Kangxi Radicals" +msgstr "綺欠薤" + +#: qt4/chardict/unicodeviewwidget.cpp:140 +msgid "Ideographic Description Characters" +msgstr "羲√罕荐菴井絖" + +#: qt4/chardict/unicodeviewwidget.cpp:141 +msgid "CJK Symbols and Punctuation" +msgstr "CJK荐垸喝ヨ" + +#: qt4/chardict/unicodeviewwidget.cpp:142 +msgid "Hiragana" +msgstr "蚊" + +#: qt4/chardict/unicodeviewwidget.cpp:143 +msgid "Katakana" +msgstr "帥" + +#: qt4/chardict/unicodeviewwidget.cpp:144 +msgid "Bopomofo" +msgstr "羈喝罸" + +#: qt4/chardict/unicodeviewwidget.cpp:145 +msgid "Hangul Compatibility Jamo" +msgstr "潟違篋絖罸" + +#: qt4/chardict/unicodeviewwidget.cpp:146 +msgid "Kanbun" +msgstr "羲∽" + +#: qt4/chardict/unicodeviewwidget.cpp:147 +msgid "Bopomofo Extended-B 1F00" +msgstr "羈喝罸≦宍B 1F00" + +#: qt4/chardict/unicodeviewwidget.cpp:148 +msgid "Katakana Phonetic Extensions" +msgstr "帥茵恰≦宍" + +#: qt4/chardict/unicodeviewwidget.cpp:149 +msgid "Enclosed CJK Letters and Months" +msgstr "蚊CJK絖紙" + +#: qt4/chardict/unicodeviewwidget.cpp:150 +msgid "CJK Compatibility" +msgstr "CJK篋絖" + +#: qt4/chardict/unicodeviewwidget.cpp:151 +msgid "CJK Unified Ideographs Extension and" +msgstr "CJK腟怨羲√≦宍" + +#: qt4/chardict/unicodeviewwidget.cpp:152 +msgid "Yijing Hexagram Symbols-B" +msgstr "腟荐B" + +#: qt4/chardict/unicodeviewwidget.cpp:153 +msgid "CJK Unified Ideographs" +msgstr "CJK腟怨羲√" + +#: qt4/chardict/unicodeviewwidget.cpp:154 +msgid "Yi Syllables" +msgstr "ら括絖" + +#: qt4/chardict/unicodeviewwidget.cpp:155 +msgid "Yi Radicals" +msgstr "ゆ絖薤" + +#: qt4/chardict/unicodeviewwidget.cpp:156 +msgid "Hangul Syllables" +msgstr "潟違括絖" + +#: qt4/chardict/unicodeviewwidget.cpp:157 +msgid "High Surrogates" +msgstr "筝篏泣蚊若" + +#: qt4/chardict/unicodeviewwidget.cpp:158 +msgid "High Private Use Surrogates" +msgstr "筝篏腱泣蚊若" + +#: qt4/chardict/unicodeviewwidget.cpp:159 +msgid "Low Surrogates" +msgstr "筝篏泣蚊若" + +#: qt4/chardict/unicodeviewwidget.cpp:160 +msgid "Private Use Area" +msgstr "腱" + +#: qt4/chardict/unicodeviewwidget.cpp:161 +msgid "CJK Compatibility Ideographs" +msgstr "CJK篋羲√" + +#: qt4/chardict/unicodeviewwidget.cpp:162 +msgid "Alphabetic Presentation Forms" +msgstr "≪<茵腓阪就" + +#: qt4/chardict/unicodeviewwidget.cpp:163 +msgid "Arabic Presentation Forms-A" +msgstr "≪∵;腓阪就A" + +#: qt4/chardict/unicodeviewwidget.cpp:164 +msgid "Variation Selectors" +msgstr "若激с潟祉祉帥" + +#: qt4/chardict/unicodeviewwidget.cpp:165 +msgid "Combining Half Marks" +msgstr "荐 ()" + +#: qt4/chardict/unicodeviewwidget.cpp:166 +msgid "CJK Compatibility Forms-A" +msgstr "CJK篋綵A" + +#: qt4/chardict/unicodeviewwidget.cpp:167 +msgid "Small Form Variants" +msgstr "絨鎕綵" + +#: qt4/chardict/unicodeviewwidget.cpp:168 +msgid "Arabic Presentation Forms-B" +msgstr "≪∵;腓阪就B" + +#: qt4/chardict/unicodeviewwidget.cpp:169 +msgid "Halfwidth and Fullwidth Forms-B" +msgstr "茹喝茹綵B" + +#: qt4/chardict/unicodeviewwidget.cpp:170 +msgid "Specials" +msgstr "号" + +#: qt4/chardict/unicodeviewwidget.cpp:171 +msgid "Linear B Syllabary" +msgstr "膩絖B括絖" + +#: qt4/chardict/unicodeviewwidget.cpp:172 +msgid "Linear B Ideograms" +msgstr "膩絖B茵絖" + +#: qt4/chardict/unicodeviewwidget.cpp:173 +msgid "Aegean Numbers" +msgstr "若我医" + +#: qt4/chardict/unicodeviewwidget.cpp:174 +msgid "Old Italic" +msgstr "若祉ゃ帥" + +#: qt4/chardict/unicodeviewwidget.cpp:175 +msgid "Gothic" +msgstr "眼激" + +#: qt4/chardict/unicodeviewwidget.cpp:176 +msgid "Ugaritic" +msgstr "罐綵∽絖" + +#: qt4/chardict/unicodeviewwidget.cpp:177 +msgid "Deseret" +msgstr "若祉≪<" + +#: qt4/chardict/unicodeviewwidget.cpp:178 +msgid "Shavian" +msgstr "激сゃ眼c≪恰絖" + +#: qt4/chardict/unicodeviewwidget.cpp:179 +msgid "Osmanya" +msgstr "鴻恰絖" + +#: qt4/chardict/unicodeviewwidget.cpp:180 +msgid "Cypriot Syllabary" +msgstr "拷括絖" + +#: qt4/chardict/unicodeviewwidget.cpp:181 +msgid "Byzantine Musical Symbols-B 4DC0" +msgstr "吟潟渇恰ソ荐B 4DC0" + +#: qt4/chardict/unicodeviewwidget.cpp:182 +msgid "Musical Symbols-B 4DC0 1D000" +msgstr "恰ソ荐B 4DC0 1D000" + +#: qt4/chardict/unicodeviewwidget.cpp:183 +msgid "Tai Xuan Jing Symbols-B 4DC0 1D000 1D100" +msgstr "紊膓B 4DC0 1D000 1D100" + +#: qt4/chardict/unicodeviewwidget.cpp:184 +msgid "Mathematical Alphanumeric Symbols-B 4DC0 1D000 1D100 1D300" +msgstr "医荐B 4DC0 1D000 1D100 1D300" + +#: qt4/chardict/unicodeviewwidget.cpp:185 +msgid "CJK Unified Ideographs Extension B 4DC0 1D000 1D100 1D300 1D400" +msgstr "CJK腟怨羲√≦宍B 4DC0 1D000 1D100 1D300 1D400" + +#: qt4/chardict/unicodeviewwidget.cpp:186 +msgid "CJK Compatibility Ideographs Supplemental 2E80" +msgstr "CJK篋羲√茖 2E80" + +#: qt4/chardict/unicodeviewwidget.cpp:187 +msgid "Tags" +msgstr "帥" + +#: qt4/chardict/unicodeviewwidget.cpp:188 +msgid "Variation Selectors Supplemental 2E80 2F800" +msgstr "若激с潟祉祉帥取 2E80 2F800" + +#: qt4/chardict/unicodeviewwidget.cpp:189 +msgid "Supplementary Private Use Area-A" +msgstr "茖腱A" + +#: qt4/chardict/unicodeviewwidget.cpp:190 +msgid "Supplementary Private Use Area-B" +msgstr "茖腱B" + +#: qt4/chardict/unicodeviewwidget.cpp:214 +msgid "UnicodeBlock List" +msgstr "潟若榊祉鴻" Index: qt4/chardict/po/ChangeLog =================================================================== Index: qt4/chardict/po/Makevars =================================================================== --- qt4/chardict/po/Makevars (revision 0) +++ qt4/chardict/po/Makevars (revision 0) @@ -0,0 +1,48 @@ +# Makefile variables for PO directory in any package using GNU gettext. + +# Usually the message domain is the same as the package name. +DOMAIN = $(PACKAGE)-chardict-qt4 + +# intltool 0.32 and later depends on $(GETTEXT_PACKAGE) +GETTEXT_PACKAGE = $(DOMAIN) + +# These variables depend on the location of this directory. +subdir = qt4/chardict/po +top_builddir = ../../.. +top_podir = $(top_srcdir)/po + +# These options get passed to xgettext. +XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ + +# This is the copyright holder that gets inserted into the header of the +# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding +# package. (Note that the msgstr strings, extracted from the package's +# sources, belong to the copyright holder of the package.) Translators are +# expected to transfer the copyright for their translations to this person +# or entity, or to disclaim their copyright. The empty string stands for +# the public domain; in this case the translators are expected to disclaim +# their copyright. +COPYRIGHT_HOLDER = uim Developers + +# This is the email address or URL to which the translators shall report +# bugs in the untranslated strings: +# - Strings which are not entire sentences, see the maintainer guidelines +# in the GNU gettext documentation, section 'Preparing Strings'. +# - Strings which use unclear terms or require additional context to be +# understood. +# - Strings which make invalid assumptions about notation of date, time or +# money. +# - Pluralisation problems. +# - Incorrect English spelling. +# - Incorrect formatting. +# It can be your email address, or a mailing list address where translators +# can write to without being subscribed, or the URL of a web page through +# which the translators can contact you. +MSGID_BUGS_ADDRESS =uim-en@googlegroups.com + +# This is the list of locale categories, beyond LC_MESSAGES, for which the +# message catalogs shall be used. It is usually empty. +EXTRA_LOCALE_CATEGORIES = + +MSGMERGE = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(top_podir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --dist +GENPOT = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(top_podir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --pot Index: qt4/chardict/po/POTFILES.in =================================================================== --- qt4/chardict/po/POTFILES.in (revision 0) +++ qt4/chardict/po/POTFILES.in (revision 0) @@ -0,0 +1,3 @@ +qt4/chardict/bushuviewwidget.cpp +qt4/chardict/qt4.cpp +qt4/chardict/unicodeviewwidget.cpp Index: qt4/chardict/po/uim-chardict-qt.pot =================================================================== --- qt4/chardict/po/uim-chardict-qt.pot (revision 0) +++ qt4/chardict/po/uim-chardict-qt.pot (revision 0) @@ -0,0 +1,545 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR uim Developers +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: uim@lists.freedesktop.org\n" +"POT-Creation-Date: 2005-12-09 14:52+0900\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: qt4/chardict/bushuviewwidget.cpp:72 +msgid "Bushu List" +msgstr "" + +#: qt4/chardict/qt4.cpp:113 +msgid "Mode:" +msgstr "" + +#: qt4/chardict/qt4.cpp:115 +msgid "Bushu Search" +msgstr "" + +#: qt4/chardict/qt4.cpp:116 +msgid "Unicode Search" +msgstr "" + +#: qt4/chardict/qt4.cpp:122 +msgid "Select Font" +msgstr "" + +#: qt4/chardict/qt4.cpp:126 +msgid "Chars:" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:66 +msgid "Basic Latin" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:67 +msgid "Latin-1 Supplement" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:68 +msgid "Latin Extended-A" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:69 +msgid "Latin Extended-B" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:70 +msgid "IPA Extensions" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:71 +msgid "Spacing Modifier Letters" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:72 +msgid "Combining Diacritical Marks" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:73 +msgid "Greek and Coptic" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:74 +msgid "Cyrillic" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:75 +msgid "Cyrillic Supplement" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:76 +msgid "Armenian" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:77 +msgid "Hebrew" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:78 +msgid "Arabic" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:79 +msgid "Syriac" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:80 +msgid "Thaana" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:81 +msgid "Devanagari" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:82 +msgid "Bengali" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:83 +msgid "Gurmukhi" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:84 +msgid "Gujarati" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:85 +msgid "Oriya" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:86 +msgid "Tamil" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:87 +msgid "Telugu" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:88 +msgid "Kannada" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:89 +msgid "Malayalam" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:90 +msgid "Sinhala" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:91 +msgid "Thai" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:92 +msgid "Lao" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:93 +msgid "Tibetan" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:94 +msgid "Myanmar" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:95 +msgid "Georgian" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:96 +msgid "Hangul Jamo" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:97 +msgid "Ethiopic" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:98 +msgid "Cherokee" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:99 +msgid "Unified Canadian Aboriginal Syllabics" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:100 +msgid "Ogham" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:101 +msgid "Runic" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:102 +msgid "Tagalog" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:103 +msgid "Hanunoo" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:104 +msgid "Buhid" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:105 +msgid "Tagbanwa" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:106 +msgid "Khmer" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:107 +msgid "Mongolian" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:108 +msgid "Limbu" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:109 +msgid "Tai Letters" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:110 +msgid "Khmer Symbols" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:111 +msgid "Phonetic Extensions" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:112 +msgid "Latin Extended Additional" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:113 +msgid "Greek Extended-B" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:114 +msgid "General Punctuation" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:115 +msgid "Superscripts and Subscripts" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:116 +msgid "Currency Symbols" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:117 +msgid "Combining Diacritical Marks for Symbols" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:118 +msgid "Letterlike Symbols" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:119 +msgid "Number Forms" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:120 +msgid "Arrows" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:121 +msgid "Mathematical Operators" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:122 +msgid "Miscellaneous Technical" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:123 +msgid "Control Pictures" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:124 +msgid "Optical Character Recognition" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:125 +msgid "Enclosed Alphanumerics" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:126 +msgid "Box Drawing" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:127 +msgid "Block Elements" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:128 +msgid "Geometric Shapes" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:129 +msgid "Miscellaneous Symbols" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:130 +msgid "Dingbats" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:131 +msgid "Miscellaneous Mathematical Symbols-A" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:132 +msgid "Supplemental Arrows-A" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:133 +msgid "Braille Patterns" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:134 +msgid "Supplemental Arrows-B" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:135 +msgid "Miscellaneous Mathematical Symbols-B" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:136 +msgid "Supplemental Mathematical Operators" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:137 +msgid "Miscellaneous Symbols and Arrows-B" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:138 +msgid "CJK Radicals Supplemental" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:139 +msgid "Kangxi Radicals" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:140 +msgid "Ideographic Description Characters" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:141 +msgid "CJK Symbols and Punctuation" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:142 +msgid "Hiragana" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:143 +msgid "Katakana" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:144 +msgid "Bopomofo" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:145 +msgid "Hangul Compatibility Jamo" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:146 +msgid "Kanbun" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:147 +msgid "Bopomofo Extended-B 1F00" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:148 +msgid "Katakana Phonetic Extensions" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:149 +msgid "Enclosed CJK Letters and Months" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:150 +msgid "CJK Compatibility" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:151 +msgid "CJK Unified Ideographs Extension and" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:152 +msgid "Yijing Hexagram Symbols-B" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:153 +msgid "CJK Unified Ideographs" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:154 +msgid "Yi Syllables" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:155 +msgid "Yi Radicals" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:156 +msgid "Hangul Syllables" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:157 +msgid "High Surrogates" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:158 +msgid "High Private Use Surrogates" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:159 +msgid "Low Surrogates" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:160 +msgid "Private Use Area" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:161 +msgid "CJK Compatibility Ideographs" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:162 +msgid "Alphabetic Presentation Forms" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:163 +msgid "Arabic Presentation Forms-A" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:164 +msgid "Variation Selectors" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:165 +msgid "Combining Half Marks" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:166 +msgid "CJK Compatibility Forms-A" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:167 +msgid "Small Form Variants" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:168 +msgid "Arabic Presentation Forms-B" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:169 +msgid "Halfwidth and Fullwidth Forms-B" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:170 +msgid "Specials" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:171 +msgid "Linear B Syllabary" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:172 +msgid "Linear B Ideograms" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:173 +msgid "Aegean Numbers" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:174 +msgid "Old Italic" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:175 +msgid "Gothic" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:176 +msgid "Ugaritic" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:177 +msgid "Deseret" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:178 +msgid "Shavian" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:179 +msgid "Osmanya" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:180 +msgid "Cypriot Syllabary" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:181 +msgid "Byzantine Musical Symbols-B 4DC0" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:182 +msgid "Musical Symbols-B 4DC0 1D000" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:183 +msgid "Tai Xuan Jing Symbols-B 4DC0 1D000 1D100" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:184 +msgid "Mathematical Alphanumeric Symbols-B 4DC0 1D000 1D100 1D300" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:185 +msgid "CJK Unified Ideographs Extension B 4DC0 1D000 1D100 1D300 1D400" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:186 +msgid "CJK Compatibility Ideographs Supplemental 2E80" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:187 +msgid "Tags" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:188 +msgid "Variation Selectors Supplemental 2E80 2F800" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:189 +msgid "Supplementary Private Use Area-A" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:190 +msgid "Supplementary Private Use Area-B" +msgstr "" + +#: qt4/chardict/unicodeviewwidget.cpp:214 +msgid "UnicodeBlock List" +msgstr "" Index: qt4/toolbar/common-uimstateindicator.cpp =================================================================== --- qt4/toolbar/common-uimstateindicator.cpp (revision 0) +++ qt4/toolbar/common-uimstateindicator.cpp (revision 0) @@ -0,0 +1,312 @@ +/* + + Copyright (c) 2003-2009 uim Project http://code.google.com/p/uim/ + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of authors nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +*/ +#include + +#include "common-uimstateindicator.h" + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +static const QString ICONDIR = UIM_PIXMAPSDIR; +static int uim_fd; +static QHelperToolbarButton *fallbackButton = 0; +static QSocketNotifier *notifier = 0; + +UimStateIndicator::UimStateIndicator( QWidget *parent ) + : QFrame( parent ) +{ + m_layout = new QHBoxLayout; + m_layout->setMargin( 0 ); + + if ( !fallbackButton ) + { + fallbackButton = new QHelperToolbarButton( this ); + m_layout->addWidget( fallbackButton ); + QPixmap icon = QPixmap( ICONDIR + '/' + "uim-icon.png" ); + if ( !icon.isNull() ) { + QImage image = icon.toImage(); + QPixmap scaledIcon = QPixmap::fromImage( + image.scaled( ICON_SIZE, ICON_SIZE, + Qt::IgnoreAspectRatio, Qt::SmoothTransformation ) ); + fallbackButton->setIcon( QIcon( scaledIcon ) ); + } else { + fallbackButton->setText( "?" ); + } + fallbackButton->show(); + } + + clearButtons(); + + uim_fd = -1; + checkHelperConnection(); + uim_helper_client_get_prop_list(); + popupMenuShowing = false; + + setLayout( m_layout ); +} + + +UimStateIndicator::~UimStateIndicator() +{ + delete notifier; + notifier = 0; + + clearButtons(); +} + +int UimStateIndicator::getNumButtons() +{ + return buttons.count(); +} + +void UimStateIndicator::checkHelperConnection() +{ + if ( uim_fd < 0 ) + { + uim_fd = uim_helper_init_client_fd( helper_disconnect_cb ); + if ( uim_fd > 0 ) + { + if ( notifier ) + delete notifier; + notifier = new QSocketNotifier( uim_fd, QSocketNotifier::Read ); + connect( notifier, SIGNAL( activated( int ) ), + this, SLOT( slotStdinActivated( int ) ) ); + } + } +} +void UimStateIndicator::parseHelperStr( const QString& str ) +{ + const QStringList lines = str.split( '\n', QString::SkipEmptyParts ); + if ( !lines.isEmpty() && !lines[ 0 ].isEmpty() ) + { + if ( lines[ 0 ] == "prop_list_update" ) + propListUpdate( lines ); + } +} + +void UimStateIndicator::propListUpdate( const QStringList& lines ) +{ + if (popupMenuShowing) + return; + + QHelperPopupMenu *popupMenu = 0; + int prevCount = m_layout->count(); + foreach ( QHelperToolbarButton *button, buttons ) + { + if ( m_layout->indexOf( button ) >= 0 ) + m_layout->removeWidget( button ); + if ( buttons.contains( button ) ) + { + buttons.removeAll( button ); + delete button; + } + } + + foreach ( const QString &line, lines ) + { + const QStringList fields = line.split( '\t', QString::SkipEmptyParts ); + + if ( !fields.isEmpty() && !fields[ 0 ].isEmpty() ) + { + if ( fields[ 0 ].startsWith( QLatin1String( "branch" ) ) ) + { + if ( fallbackButton ) + { + m_layout->removeWidget( fallbackButton ); + delete fallbackButton; + fallbackButton = 0; + } + // create button + QHelperToolbarButton *button = new QHelperToolbarButton; + m_layout->addWidget( button ); + buttons.append( button ); + QPixmap icon = QPixmap( ICONDIR + '/' + fields[1] + ".png" ); + if (!icon.isNull()) { + QImage image = icon.toImage(); + QPixmap scaledIcon = QPixmap::fromImage( + image.scaled( ICON_SIZE, ICON_SIZE, + Qt::IgnoreAspectRatio, Qt::SmoothTransformation ) ); + button->setIcon( QIcon( scaledIcon ) ); + } else { + button->setText( fields[ 2 ] ); + } + button->setToolTip( fields[ 3 ] ); + + // create popup + popupMenu = new QHelperPopupMenu( button ); + connect( popupMenu, SIGNAL( aboutToShow() ), + this, SLOT( slotPopupMenuAboutToShow() ) ); + connect( popupMenu, SIGNAL( aboutToHide() ), + this, SLOT( slotPopupMenuAboutToHide() ) ); + button->setMenu( popupMenu ); + button->setPopupMode( QToolButton::InstantPopup ); + + button->show(); + } + else if ( fields[ 0 ].startsWith( QLatin1String( "leaf" ) ) ) + { + if ( popupMenu + && !fields[ 1 ].isEmpty() + && !fields[ 3 ].isEmpty() + && !fields[ 4 ].isEmpty() + && !fields[ 5 ].isEmpty() ) + { + QAction *action = popupMenu->insertHelperItem( + fields[1], fields[ 3 ], fields[ 4 ], fields[ 5 ] ); + // check the item which is now used + if ( fields.count() > 6 && fields[ 6 ] == "*" ) + action->setChecked( true ); + } + } + } + } + + if ( m_layout->count() != prevCount ) + emit indicatorResized(); + + parentWidget()->show(); +} + +void UimStateIndicator::helper_disconnect_cb() +{ + uim_fd = -1; + disconnect( notifier, SIGNAL( activated( int ) ), 0, 0 ); +} + +void UimStateIndicator::slotStdinActivated( int /*socket*/ ) +{ + uim_helper_read_proc( uim_fd ); + + QString tmp; + char *s; + while ( ( s = uim_helper_get_message() ) ) + { + const QStringList lines = QString( s ).split( '\n', + QString::SkipEmptyParts ); + if ( lines.count() > 1 + && lines[ 1 ].startsWith( QLatin1String( "charset" ) ) ) + { + /* get charset */ + QString charset = lines[ 1 ].split( '=', + QString::SkipEmptyParts ) [ 1 ]; + + /* convert to unicode */ + QTextCodec *codec + = QTextCodec::codecForName( QByteArray( charset.toAscii() ) ); + tmp = codec->toUnicode( s ); + } + else + { + /* no charset */ + tmp = s; + } + + parseHelperStr( tmp ); + free( s ); + } +} + +void UimStateIndicator::slotPopupMenuAboutToShow() +{ + popupMenuShowing = true; +} + +void UimStateIndicator::slotPopupMenuAboutToHide() +{ + popupMenuShowing = false; +} + +void UimStateIndicator::clearButtons() +{ + while ( !buttons.isEmpty() ) { + QHelperToolbarButton *button = buttons.takeFirst(); + m_layout->removeWidget( button ); + delete button; + } +} + +/**/ + +QHelperPopupMenu::QHelperPopupMenu( QWidget *parent ) + : QMenu( parent ) +{ + msgDict.clear(); + connect( this, SIGNAL( triggered( QAction * ) ), + this, SLOT( slotMenuActivated( QAction * ) ) ); +} + +QHelperPopupMenu::~QHelperPopupMenu() +{ + msgDict.clear(); +} + +QAction *QHelperPopupMenu::insertHelperItem( const QString &indicationIdStr, + const QString &menulabelStr, + const QString &menutooltipStr, + const QString &menucommandStr ) +{ + QAction *action; + QPixmap icon = QPixmap( ICONDIR + '/' + indicationIdStr + ".png" ); + + if (!icon.isNull()) { + QImage image = icon.toImage(); + QPixmap scaledIcon = QPixmap::fromImage( + image.scaled( ICON_SIZE, ICON_SIZE, + Qt::IgnoreAspectRatio, Qt::SmoothTransformation ) ); + action = addAction( scaledIcon, menulabelStr ); + } else { + action = addAction( menulabelStr ); + } + + action->setCheckable( true ); + action->setWhatsThis( menutooltipStr ); + msgDict.insert( action, menucommandStr ); + + return action; +} + +void QHelperPopupMenu::slotMenuActivated( QAction *action ) +{ + QString msg = msgDict.find( action ).value(); + msg.prepend( "prop_activate\n" ); + msg.append( "\n" ); + uim_helper_send_message( uim_fd, msg.toAscii().constData() ); +} Index: qt4/toolbar/standalone-qt4.cpp =================================================================== --- qt4/toolbar/standalone-qt4.cpp (revision 0) +++ qt4/toolbar/standalone-qt4.cpp (revision 0) @@ -0,0 +1,201 @@ +/* + + Copyright (c) 2003-2009 uim Project http://code.google.com/p/uim/ + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of authors nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +*/ +#include + +#include "standalone-qt4.h" +#include "common-quimhelpertoolbar.h" +#include "common-uimstateindicator.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "uim/uim.h" +#include "qtgettext.h" + +static const int TOOLBAR_MARGIN_SIZE = 2; + +UimStandaloneToolbar::UimStandaloneToolbar( QWidget *parent ) + : QFrame( parent, Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint ) +{ + uim_init(); + + QHBoxLayout *layout = new QHBoxLayout; + layout->setMargin( 0 ); + setLayout( layout ); + + adjustSize(); + UimToolbarDraggingHandler *h = new UimToolbarDraggingHandler( this ); + layout->addWidget( h ); + h->adjustSize(); + h->show(); + connect( h, SIGNAL( handleDoubleClicked() ), + this, SLOT( slotToolbarDoubleClicked() ) ); + + + toolbar = new QUimHelperToolbar( this ); + layout->addWidget( toolbar ); + toolbar->adjustSize(); + toolbar->show(); + connect( toolbar, SIGNAL( toolbarResized() ), this, SLOT( slotToolbarResized() ) ); + toolbar->setMargin(TOOLBAR_MARGIN_SIZE); + + // Move + int panelHeight = 64; // FIXME! + int screenwidth = QApplication::desktop()->screenGeometry().width(); + int screenheight = QApplication::desktop()->screenGeometry().height(); + QPoint p( screenwidth - width() - panelHeight, screenheight - height() - panelHeight ); + move( p ); + + // Enable Dragging Feature + connect( h, SIGNAL( moveTo( const QPoint & ) ), + this, SLOT( moveTo( const QPoint & ) ) ); + + // Quit + connect( toolbar, SIGNAL( quitToolbar() ), + qApp, SLOT( quit() ) ); + + show(); +} +UimStandaloneToolbar::~UimStandaloneToolbar() +{ + uim_quit(); +} + +void +UimStandaloneToolbar::slotToolbarResized() +{ + adjustSize(); +} + +void +UimStandaloneToolbar::slotToolbarDoubleClicked() +{ + if (toolbar->isVisible()) + toolbar->hide(); + else + toolbar->show(); + adjustSize(); +} + +void +UimStandaloneToolbar::moveTo(const QPoint &point) +{ + move(point); +} + +UimToolbarDraggingHandler::UimToolbarDraggingHandler( QWidget *parent ) + : QFrame( parent ), isDragging( false ) +{ + setFrameStyle( NoFrame ); + + setBackgroundRole( parent->backgroundRole() ); + + setFixedWidth( 10 ); +} + +void UimToolbarDraggingHandler::drawContents( QPainter* p ) +{ + const QStyle::State flags = QStyle::State_None | QStyle::State_Horizontal; + QStyleOption opt; + opt.state = flags; + style()->drawPrimitive( QStyle::PE_IndicatorToolBarSeparator, + &opt, p, this ); +} + +QSize UimToolbarDraggingHandler::sizeHint() const +{ + int width, height; + + width = style()->pixelMetric( QStyle::PM_DockWidgetSeparatorExtent, + 0, this ); + height = BUTTON_SIZE + TOOLBAR_MARGIN_SIZE * 2; + + return QSize( width, height ); +} + +QSizePolicy UimToolbarDraggingHandler::sizePolicy() const +{ + return QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ); +} + +void UimToolbarDraggingHandler::mousePressEvent( QMouseEvent * /* e */ ) +{ + isDragging = true; + grabMouse( QCursor( Qt::SizeAllCursor) ); + + offsetX = QCursor::pos().x() - this->parentWidget()->x(); + offsetY = QCursor::pos().y() - this->parentWidget()->y(); +} + +void UimToolbarDraggingHandler::mouseReleaseEvent( QMouseEvent * /* e */ ) +{ + isDragging = false; + releaseMouse(); +} + +void UimToolbarDraggingHandler::mouseMoveEvent( QMouseEvent * /* e */ ) +{ + if ( isDragging ) { + QPoint pos = QCursor::pos(); + pos -= QPoint(offsetX, offsetY); + emit moveTo( pos ); + } +} + +void UimToolbarDraggingHandler::mouseDoubleClickEvent( QMouseEvent * /* e */ ) +{ + isDragging = false; + emit handleDoubleClicked(); +} + +int main( int argc, char *argv[] ) +{ + setlocale(LC_ALL, ""); + bindtextdomain(PACKAGE, LOCALEDIR); + textdomain(PACKAGE); + bind_textdomain_codeset(PACKAGE, "UTF-8"); // ensure code encoding is UTF8- + + QApplication a( argc, argv ); + UimStandaloneToolbar *toolbar = new UimStandaloneToolbar( 0 ); + toolbar->show(); + + return a.exec(); +} Index: qt4/toolbar/common-uimstateindicator.h =================================================================== --- qt4/toolbar/common-uimstateindicator.h (revision 0) +++ qt4/toolbar/common-uimstateindicator.h (revision 0) @@ -0,0 +1,125 @@ +/* + + Copyright (c) 2003-2009 uim Project http://code.google.com/p/uim/ + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of authors nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +*/ +#ifndef UIM_QT4_TOOLBAR_COMMON_UIM_STATE_INDICATOR_H +#define UIM_QT4_TOOLBAR_COMMON_UIM_STATE_INDICATOR_H + +#include +#include +#include +#include +#include + +#include +#include + +const int BUTTON_SIZE = 26; +const int ICON_SIZE = 16; + +class QHelperToolbarButton; +class QHelperPopupMenu; + +class QHBoxLayout; + +class UimStateIndicator : public QFrame +{ + Q_OBJECT + +public: + explicit UimStateIndicator( QWidget *parent = 0 ); + ~UimStateIndicator(); + + int getNumButtons(); + +protected: + void checkHelperConnection(); + + void parseHelperStr( const QString& str ); + void propListUpdate( const QStringList& lines ); + + static void helper_disconnect_cb(); + +signals: + void indicatorResized(); + +public slots: + void slotStdinActivated( int socket ); + +private slots: + void slotPopupMenuAboutToShow(); + void slotPopupMenuAboutToHide(); + +protected: + QList buttons; + bool popupMenuShowing; + +private: + void clearButtons(); + + QHBoxLayout *m_layout; + QHash actionHash; +}; + +class QHelperToolbarButton : public QToolButton +{ +public: + explicit QHelperToolbarButton( QWidget *parent = 0 ) + : QToolButton( parent ){ setAutoRaise( true ); } + + QSize sizeHint() const + { + return QSize( BUTTON_SIZE, BUTTON_SIZE ); + } +}; + +class QHelperPopupMenu : public QMenu +{ + Q_OBJECT + +public: + explicit QHelperPopupMenu( QWidget *parent = 0 ); + ~QHelperPopupMenu(); + + QAction *insertHelperItem( const QString &indicationIdStr, + const QString &menulabelStr, + const QString &menutooltipStr, + const QString &menucommandStr ); + +public slots: + void slotMenuActivated( QAction *action ); + +protected: + QMultiHash msgDict; +}; + + +#endif /* Not def: UIM_QT4_TOOLBAR_COMMON_UIM_STATE_INDICATOR_H */ Index: qt4/toolbar/uim-toolbar-qt4.pro.in =================================================================== --- qt4/toolbar/uim-toolbar-qt4.pro.in (revision 0) +++ qt4/toolbar/uim-toolbar-qt4.pro.in (revision 0) @@ -0,0 +1,26 @@ +TEMPLATE = app +CONFIG += @QT_CONFIG_OPTS@ + +INCLUDEPATH += @abs_top_builddir@ @abs_top_builddir@/uim \ + @abs_top_builddir@/replace .. +QMAKE_LIBDIR += @abs_top_builddir@/uim +QMAKE_LIBDIR += @abs_top_builddir@/replace +LIBS += -lreplace -luim -luim-scm -luim-x-util + +QMAKE_CFLAGS_DEBUG += @CFLAGS@ @X_CFLAGS@ +QMAKE_CFLAGS_RELEASE += @CFLAGS@ @X_CFLAGS@ +QMAKE_CXXFLAGS_DEBUG += @CXXFLAGS@ @X_CFLAGS@ +QMAKE_CXXFLAGS_RELEASE += @CXXFLAGS@ @X_CFLAGS@ + +# Input +HEADERS += common-quimhelpertoolbar.h \ + common-uimstateindicator.h \ + standalone-qt4.h +SOURCES += common-quimhelpertoolbar.cpp \ + common-uimstateindicator.cpp \ + standalone-qt4.cpp + +TARGET = uim-toolbar-qt4 + +target.path += @DESTDIR@@exec_prefix@/bin +INSTALLS += target Index: qt4/toolbar/standalone-qt4.h =================================================================== --- qt4/toolbar/standalone-qt4.h (revision 0) +++ qt4/toolbar/standalone-qt4.h (revision 0) @@ -0,0 +1,91 @@ +/* + + Copyright (c) 2003-2009 uim Project http://code.google.com/p/uim/ + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of authors nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +*/ +#ifndef UIM_QT4_STANDALONE_QT4_H +#define UIM_QT4_STANDALONE_QT4_H + +#include +#include + +class QUimHelperToolbar; + +class QPoint; +class QMouseEvent; + +class UimStandaloneToolbar : public QFrame +{ + Q_OBJECT + +public: + UimStandaloneToolbar( QWidget *paret = 0 ); + ~UimStandaloneToolbar(); + +protected slots: + void slotToolbarResized(); + void slotToolbarDoubleClicked(); + +private slots: + void moveTo(const QPoint &point); + +private: + QUimHelperToolbar *toolbar; +}; + +class UimToolbarDraggingHandler : public QFrame +{ + Q_OBJECT + +public: + explicit UimToolbarDraggingHandler( QWidget *parent ); + + QSize sizeHint() const; + QSizePolicy sizePolicy() const; + +signals: + void moveTo( const QPoint & ); + void handleDoubleClicked(); + +protected: + void drawContents( QPainter* ); + + void mousePressEvent ( QMouseEvent * e ); + void mouseReleaseEvent ( QMouseEvent * e ); + void mouseMoveEvent ( QMouseEvent * e ); + void mouseDoubleClickEvent ( QMouseEvent * e ); + +private: + bool isDragging; + int offsetX; + int offsetY; +}; + +#endif /* UIM_QT4_STANDALONE_QT4_H */ Index: qt4/toolbar/common-quimhelpertoolbar.cpp =================================================================== --- qt4/toolbar/common-quimhelpertoolbar.cpp (revision 0) +++ qt4/toolbar/common-quimhelpertoolbar.cpp (revision 0) @@ -0,0 +1,300 @@ +/* + + Copyright (c) 2003-2009 uim Project http://code.google.com/p/uim/ + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of authors nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +*/ +#include "common-quimhelpertoolbar.h" +#include "common-uimstateindicator.h" + +#include + +#include +#include +#include +#include +#include +#include + +#include "uim/uim-scm.h" +#include "qtgettext.h" + +static const QString ICONDIR = UIM_PIXMAPSDIR; +static const QString ACTION_ICONDIR = KDE_ICONDIR "/crystalsvg/16x16/actions"; + +QUimHelperToolbar::QUimHelperToolbar( QWidget *parent, bool isApplet ) + : QFrame( parent ) +{ + m_layout = new QHBoxLayout; + + m_indicator = new UimStateIndicator( this ); + m_layout->addWidget( m_indicator ); + + connect( m_indicator, SIGNAL( indicatorResized() ), this, SLOT( slotIndicatorResized() ) ); + + QPixmap swicon = QPixmap( ICONDIR + "/im_switcher.png" ); + QPixmap preficon = QPixmap( ACTION_ICONDIR + "/configure.png"); + QPixmap dicticon = QPixmap( ICONDIR + "/uim-dict.png"); + QPixmap padicon = QPixmap( ACTION_ICONDIR + "/text_bold.png"); + QPixmap handicon = QPixmap( ACTION_ICONDIR + "/edit.png"); + QPixmap helpicon = QPixmap( ACTION_ICONDIR + "/help.png"); + QPixmap exiticon = QPixmap( ACTION_ICONDIR + "/exit.png"); + QImage swimage = swicon.toImage(); + QImage prefimage = preficon.toImage(); + QImage dictimage = dicticon.toImage(); + QImage padimage = padicon.toImage(); + QImage handimage = handicon.toImage(); + QImage helpimage = helpicon.toImage(); + QImage exitimage = exiticon.toImage(); + m_swicon = QPixmap::fromImage( swimage.scaled( ICON_SIZE, ICON_SIZE, + Qt::IgnoreAspectRatio, Qt::SmoothTransformation ) ); + m_preficon = QPixmap::fromImage( prefimage.scaled( ICON_SIZE, ICON_SIZE, + Qt::IgnoreAspectRatio, Qt::SmoothTransformation ) ); + m_dicticon = QPixmap::fromImage( dictimage.scaled( ICON_SIZE, ICON_SIZE, + Qt::IgnoreAspectRatio, Qt::SmoothTransformation ) ); + m_padicon = QPixmap::fromImage( padimage.scaled( ICON_SIZE, ICON_SIZE, + Qt::IgnoreAspectRatio, Qt::SmoothTransformation ) ); + m_handicon = QPixmap::fromImage( handimage.scaled( ICON_SIZE, ICON_SIZE, + Qt::IgnoreAspectRatio, Qt::SmoothTransformation ) ); + m_helpicon = QPixmap::fromImage( helpimage.scaled( ICON_SIZE, ICON_SIZE, + Qt::IgnoreAspectRatio, Qt::SmoothTransformation ) ); + exiticon = QPixmap::fromImage( exitimage.scaled( ICON_SIZE, ICON_SIZE, + Qt::IgnoreAspectRatio, Qt::SmoothTransformation ) ); + + m_contextMenu = new QMenu( this ); + m_contextMenu->addAction( m_swicon, _("Switch input method"), + this, SLOT(slotExecImSwitcher()) ); + m_contextMenu->addAction( m_preficon, _("Preference"), + this, SLOT(slotExecPref()) ); + m_contextMenu->addAction( m_dicticon, _("Japanese dictionary editor"), + this, SLOT(slotExecDict()) ); + m_contextMenu->addAction( m_padicon, _("Input pad"), + this, SLOT(slotExecInputPad()) ); + m_contextMenu->addAction( m_handicon, _("Handwriting input pad"), + this, SLOT(slotExecHandwritingInputPad()) ); + m_contextMenu->addAction( m_helpicon, _("Help"), + this, SLOT(slotExecHelp()) ); + if ( !isApplet ) + m_contextMenu->addAction( exiticon, _("Quit this toolbar"), + this, SIGNAL(quitToolbar()) ); + m_nr_exec_buttons = 0; + + // toolbar buttons + addExecImSwitcherButton(); + addExecPrefButton(); + addExecDictButton(); + addExecInputPadButton(); + addExecHandwritingInputPadButton(); + addExecHelpButton(); + + setLayout(m_layout); +} + +QUimHelperToolbar::~QUimHelperToolbar() +{ +} + +int QUimHelperToolbar::getNumButtons() +{ + return m_indicator->getNumButtons() + m_nr_exec_buttons; +} + +void QUimHelperToolbar::contextMenuEvent( QContextMenuEvent * e ) +{ + if( m_contextMenu->isHidden() ) + { + m_contextMenu->move( e->globalPos() ); + m_contextMenu->exec(); + } +} + +QMenu * +QUimHelperToolbar::contextMenu() +{ + return m_contextMenu; +} + +void QUimHelperToolbar::slotIndicatorResized() +{ + emit toolbarResized(); +} + +void QUimHelperToolbar::addExecImSwitcherButton() +{ + uim_bool isShowSwitcher = uim_scm_symbol_value_bool("toolbar-show-switcher-button?"); + if( isShowSwitcher == UIM_FALSE ) + return; + + QToolButton * swButton = new QHelperToolbarButton( this ); + m_layout->addWidget( swButton ); + if( !m_swicon.isNull() ) + swButton->setIcon( QIcon( m_swicon ) ); + else + swButton->setText( "Sw" ); + + connect( swButton, SIGNAL( clicked() ), + this, SLOT( slotExecImSwitcher() ) ); + swButton->setToolTip( _( "Switch input method" ) ); + ++m_nr_exec_buttons; +} + + +void QUimHelperToolbar::slotExecImSwitcher() +{ + /* exec uim-im-switcher */ + QProcess::startDetached( "uim-im-switcher-qt4" ); +} + +void QUimHelperToolbar::addExecPrefButton() +{ + uim_bool isShowPref = uim_scm_symbol_value_bool("toolbar-show-pref-button?"); + if( isShowPref == UIM_FALSE ) + return; + + QToolButton * prefButton = new QHelperToolbarButton( this ); + m_layout->addWidget( prefButton ); + if( !m_preficon.isNull() ) + prefButton->setIcon( QIcon( m_preficon ) ); + else + prefButton->setText( "Pref" ); + + connect( prefButton, SIGNAL( clicked() ), + this, SLOT( slotExecPref() ) ); + prefButton->setToolTip( _( "Preference" ) ); + ++m_nr_exec_buttons; +} + +void QUimHelperToolbar::slotExecPref() +{ + /* exec uim-pref-qt */ + QProcess::startDetached( "uim-pref-qt4" ); +} + +void QUimHelperToolbar::addExecDictButton() +{ + uim_bool isShowDict = uim_scm_symbol_value_bool("toolbar-show-dict-button?"); + if( isShowDict == UIM_FALSE ) + return; + + QToolButton *dictButton = new QHelperToolbarButton( this ); + m_layout->addWidget( dictButton ); + if( !m_dicticon.isNull() ) + dictButton->setIcon( QIcon( m_dicticon ) ); + else + dictButton->setText( "Dic" ); + + connect( dictButton, SIGNAL( clicked() ), + this, SLOT( slotExecDict() ) ); + dictButton->setToolTip( _( "Japanese dictionary editor" ) ); + ++m_nr_exec_buttons; +} + +void QUimHelperToolbar::slotExecDict() +{ + /* exec uim-dict */ + QProcess::startDetached( "uim-dict-gtk" ); +} + +void QUimHelperToolbar::addExecInputPadButton() +{ + uim_bool isShowInputPad = uim_scm_symbol_value_bool("toolbar-show-input-pad-button?"); + if( isShowInputPad == UIM_FALSE ) + return; + + QToolButton *inputpadButton = new QHelperToolbarButton( this ); + m_layout->addWidget( inputpadButton ); + if( !m_padicon.isNull() ) + inputpadButton->setIcon( QIcon( m_padicon ) ); + else + inputpadButton->setText( "Pad" ); + + connect( inputpadButton, SIGNAL( clicked() ), + this, SLOT( slotExecInputPad() ) ); + inputpadButton->setToolTip( _( "Input pad" ) ); + ++m_nr_exec_buttons; +} + +void QUimHelperToolbar::slotExecInputPad() +{ + /* exec input pad */ + QProcess::startDetached( "uim-chardict-qt4" ); +} + +void QUimHelperToolbar::addExecHandwritingInputPadButton() +{ + uim_bool isShowHandwritingInputPad = uim_scm_symbol_value_bool("toolbar-show-handwriting-input-pad-button?"); + if( isShowHandwritingInputPad == UIM_FALSE ) + return; + + QToolButton *handwritingButton = new QHelperToolbarButton( this ); + m_layout->addWidget( handwritingButton ); + if( !m_handicon.isNull() ) + handwritingButton->setIcon( QIcon( m_handicon ) ); + else + handwritingButton->setText( "Hand" ); + + connect( handwritingButton, SIGNAL( clicked() ), + this, SLOT( slotExecHandwritingInputPad() ) ); + handwritingButton->setToolTip( _( "Handwriting input pad" ) ); + ++m_nr_exec_buttons; +} + +void QUimHelperToolbar::slotExecHandwritingInputPad() +{ + QProcess::startDetached( "uim-tomoe-gtk" ); +} + +void QUimHelperToolbar::addExecHelpButton() +{ + uim_bool isShowHelp = uim_scm_symbol_value_bool("toolbar-show-help-button?"); + if( isShowHelp == UIM_FALSE ) + return; + + QToolButton *helpButton = new QHelperToolbarButton( this ); + m_layout->addWidget( helpButton ); + if( !m_helpicon.isNull() ) + helpButton->setIcon( QIcon( m_helpicon ) ); + else + helpButton->setText( "Help" ); + + connect( helpButton, SIGNAL( clicked() ), + this, SLOT( slotExecHelp() ) ); + helpButton->setToolTip( _( "Help" ) ); + ++m_nr_exec_buttons; +} + +void QUimHelperToolbar::slotExecHelp() +{ + QProcess::startDetached( "uim-help" ); +} + +void QUimHelperToolbar::setMargin( int margin ) +{ + m_layout->setMargin( margin ); +} Index: qt4/toolbar/Makefile.am =================================================================== --- qt4/toolbar/Makefile.am (revision 0) +++ qt4/toolbar/Makefile.am (revision 0) @@ -0,0 +1,26 @@ +.PHONY: mocclean FORCE + +# Makefile.qmake is only exist when --enable-qt4 +if QT4 +all clean mocclean install uninstall: + $(MAKE) $(AM_MAKEFLAGS) -f Makefile.qmake INSTALL_ROOT=$(DESTDIR) $@ + +# *.pro is required to run Makefile.qmake. So distclean-am is deferred. +distclean: + $(MAKE) $(AM_MAKEFLAGS) -f Makefile.qmake $@ + $(MAKE) $(AM_MAKEFLAGS) distclean-am + -rm -f Makefile uim-toolbar-qt4.pro +else +distclean: + -rm -f Makefile uim-toolbar-qt4.pro +endif + +FORCE: + +EXTRA_DIST = uim-toolbar-qt4.pro.in \ + common-quimhelpertoolbar.cpp \ + common-quimhelpertoolbar.h \ + common-uimstateindicator.cpp \ + common-uimstateindicator.h \ + standalone-qt4.cpp \ + standalone-qt4.h Index: qt4/toolbar/common-quimhelpertoolbar.h =================================================================== --- qt4/toolbar/common-quimhelpertoolbar.h (revision 0) +++ qt4/toolbar/common-quimhelpertoolbar.h (revision 0) @@ -0,0 +1,100 @@ +/* + + Copyright (c) 2003-2009 uim Project http://code.google.com/p/uim/ + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of authors nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +*/ +#ifndef UIM_QT4_TOOLBAR_COMMON_QUIMHELPERTOOLBAR_H +#define UIM_QT4_TOOLBAR_COMMON_QUIMHELPERTOOLBAR_H + +#include +#include + +class UimStateIndicator; + +class QContextMenuEvent; +class QHBoxLayout; +class QMenu; + +class QUimHelperToolbar : public QFrame +{ + Q_OBJECT + +public: + explicit QUimHelperToolbar( QWidget *parent = 0, bool isApplet = false ); + ~QUimHelperToolbar(); + + void setMargin(int margin); + +public slots: + void slotExecPref(); + QMenu *contextMenu(); + +protected: + // right click + virtual void contextMenuEvent ( QContextMenuEvent * e ); + +protected: + void addExecImSwitcherButton(); + void addExecPrefButton(); + void addExecDictButton(); + void addExecInputPadButton(); + void addExecHandwritingInputPadButton(); + void addExecHelpButton(); + + int getNumButtons(); +protected slots: + void slotExecImSwitcher(); + void slotExecDict(); + void slotExecInputPad(); + void slotExecHandwritingInputPad(); + void slotExecHelp(); + + void slotIndicatorResized(); +signals: + void quitToolbar(); + void toolbarResized(); + +protected: + UimStateIndicator *m_indicator; + QPixmap m_swicon; + QPixmap m_preficon; + QPixmap m_dicticon; + QPixmap m_padicon; + QPixmap m_handicon; + QPixmap m_helpicon; + QMenu *m_contextMenu; + int m_nr_exec_buttons; + +private: + QHBoxLayout *m_layout; +}; + + +#endif Index: qt4/switcher/Makefile.am =================================================================== --- qt4/switcher/Makefile.am (revision 0) +++ qt4/switcher/Makefile.am (revision 0) @@ -0,0 +1,22 @@ +.PHONY: mocclean FORCE + +# Makefile.qmake is only exist when --enable-qt4 +if QT4 +all clean mocclean install uninstall: + $(MAKE) $(AM_MAKEFLAGS) -f Makefile.qmake INSTALL_ROOT=$(DESTDIR) $@ + +# *.pro is required to run Makefile.qmake. So distclean-am is deferred. +distclean: + $(MAKE) $(AM_MAKEFLAGS) -f Makefile.qmake $@ + $(MAKE) $(AM_MAKEFLAGS) distclean-am + -rm -f Makefile uim-im-switcher-qt4.pro +else +distclean: + -rm -f Makefile uim-im-switcher-qt4.pro +endif + +FORCE: + +EXTRA_DIST = uim-im-switcher-qt4.pro.in \ + qt4.h \ + qt4.cpp Index: qt4/switcher/qt4.cpp =================================================================== --- qt4/switcher/qt4.cpp (revision 0) +++ qt4/switcher/qt4.cpp (revision 0) @@ -0,0 +1,305 @@ +/* + + Copyright (c) 2003-2009 uim Project http://code.google.com/p/uim/ + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of authors nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +*/ +#include + +#include "qt4.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "qtgettext.h" + +static const int NAME_COLUMN = 0; + +static int uim_fd; +static QSocketNotifier *notifier = 0; + +int main( int argc, char **argv ) +{ + setlocale(LC_ALL, ""); + bindtextdomain(PACKAGE, LOCALEDIR); + textdomain(PACKAGE); + bind_textdomain_codeset(PACKAGE, "UTF-8"); // ensure code encoding is UTF8- + + setenv("XMODIFIERS", "@im=none", 1); + + QApplication a( argc, argv ); + + UimImSwitcher switcher; + switcher.resize( 550, 400 ); + switcher.setWindowTitle( _( "uim input method switcher" ) ); + switcher.show(); + + return a.exec(); +} + + +UimImSwitcher::UimImSwitcher( QWidget *parent ) + : QDialog( parent ) +{ + /* connect to uim helper message bus */ + uim_fd = -1; + checkHelperConnection(); + + /* to load input method list */ + uim_helper_send_message( uim_fd, "im_list_get\n" ); + + /* create GUI */ + createGUI(); +} + +UimImSwitcher::~UimImSwitcher() +{ +} + +void UimImSwitcher::createGUI() +{ + /* im list view */ + listview = new QTableWidget( this ); + listview->setSelectionMode( QAbstractItemView::SingleSelection ); + listview->setSelectionBehavior( QAbstractItemView::SelectRows ); + listview->setColumnCount( 3 ); + listview->verticalHeader()->setVisible( false ); + listview->setHorizontalHeaderLabels( QStringList() + << _( "InputMethodName" ) << _( "Language" ) << _( "Description" ) ); + listview->setShowGrid( false ); + listview->horizontalHeader()->setStretchLastSection( true ); + + /* radio buttons for the switcher coverage */ + wholeButton = new QRadioButton( _( "whole desktop" ) ); + applicationButton = new QRadioButton( _( "current application only" ) ); + textButton = new QRadioButton( _( "current text area only" ) ); + wholeButton->setChecked( true ); // default is "whole desktop" + + QVBoxLayout *vbox = new QVBoxLayout; + vbox->addWidget( wholeButton ); + vbox->addWidget( applicationButton ); + vbox->addWidget( textButton ); + + QGroupBox *groupBox = new QGroupBox( _( "Effective coverage" ) ); + groupBox->setLayout( vbox ); + + /* cancel & ok button */ + okButton = new QPushButton( this ); + okButton->setText( _( "OK" ) ); + okButton->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); + connect( okButton, SIGNAL( clicked() ), + this, SLOT( slotChangeInputMethod() ) ); + cancelButton = new QPushButton( this ); + cancelButton->setText( _( "Cancel" ) ); + cancelButton->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); + connect( cancelButton, SIGNAL( clicked() ), + qApp, SLOT( quit() ) ); + QHBoxLayout *buttonLayout = new QHBoxLayout; + buttonLayout->addStretch( 0 ); + buttonLayout->addWidget( okButton ); + buttonLayout->addWidget( cancelButton ); + + // main layout + QVBoxLayout *mainLayout = new QVBoxLayout( this ); + mainLayout->setMargin( 6 ); + mainLayout->setSpacing( 6 ); + mainLayout->addWidget( listview ); + mainLayout->addWidget( groupBox ); + mainLayout->addLayout( buttonLayout ); +} + + +void UimImSwitcher::checkHelperConnection() +{ + if ( uim_fd < 0 ) + { + uim_fd = uim_helper_init_client_fd( helper_disconnect_cb ); + if ( uim_fd > 0 ) + { + if ( notifier ) + delete notifier; + notifier = new QSocketNotifier( uim_fd, QSocketNotifier::Read ); + connect( notifier, SIGNAL( activated( int ) ), + this, SLOT( slotStdinActivated( int ) ) ); + } + } +} + +void UimImSwitcher::helper_disconnect_cb() +{ + uim_fd = -1; + disconnect( notifier, SIGNAL( activated( int ) ), 0, 0 ); +} + +void UimImSwitcher::slotChangeInputMethod() +{ + if ( wholeButton->isChecked() ) + sendMessageImChange( "im_change_whole_desktop\n" ); + else if ( applicationButton->isChecked() ) + sendMessageImChange( "im_change_this_application_only\n" ); + else if ( textButton->isChecked() ) + sendMessageImChange( "im_change_this_text_area_only\n" ); + + qApp->quit(); +} + +void UimImSwitcher::sendMessageImChange( const QString &change_type ) +{ + QString imName = selectedImName(); + if ( imName.isEmpty() ) + return ; + + /* ensuring connected to message bus */ + checkHelperConnection(); + + QString msg; + msg.append( change_type ); + msg.append( imName ); + msg.append( "\n" ); + + uim_helper_send_message( uim_fd, ( const char* ) msg.toUtf8() ); +} + +QString UimImSwitcher::selectedImName() const +{ + QList selectedItems = listview->selectedItems(); + if ( !selectedItems.isEmpty() ) + { + return listview->item( selectedItems[ 0 ]->row(), NAME_COLUMN )->text(); + } + + return QString(); +} + +void UimImSwitcher::slotStdinActivated( int /*socket*/ ) +{ + uim_helper_read_proc( uim_fd ); + + QString msg; + char *s; + while ( ( s = uim_helper_get_message() ) ) + { + const QStringList lines = QString( s ).split( '\n', + QString::SkipEmptyParts ); + if ( !lines.isEmpty() && lines.count() > 1 + && lines[ 1 ].startsWith( QLatin1String( "charset" ) ) ) + { + /* get charset */ + const QString charset + = lines[ 1 ].split( '=', QString::SkipEmptyParts ) [ 1 ]; + + /* convert to unicode */ + QTextCodec *codec + = QTextCodec::codecForName( QByteArray( charset.toAscii() ) ); + msg = codec->toUnicode( s ); + } + else + { + /* no charset */ + msg = s; + } + + if ( msg.startsWith( QLatin1String( "focus_in" ) ) ) + reloadImList(); + else if ( msg.startsWith( QLatin1String( "im_list" ) ) ) + parseHelperStrImList( msg ); + } +} + + +void UimImSwitcher::parseHelperStrImList( const QString &message ) +{ + /* delete old items */ + listview->setRowCount( 0 ); + listview->clearContents(); + + const QStringList lines = message.split( '\n', QString::SkipEmptyParts ); + for ( int i = 2; i < lines.count(); i++ ) + { + const QStringList iminfoList = lines[ i ].split( '\t' ); + + if ( !iminfoList.isEmpty() + && !iminfoList[ 0 ].isEmpty() + // Language of IM with any locale is set as "". + // && !iminfoList[ 1 ].isEmpty() + && !iminfoList[ 2 ].isEmpty() ) + { + QString lang, short_desc; + + if (iminfoList[1].isEmpty()) + lang = QString("-"); + else + lang = QString::fromUtf8(gettext(iminfoList[1].toUtf8())); + short_desc = QString::fromUtf8(gettext(iminfoList[2].toUtf8())); + + // add new item to listview + int row = listview->rowCount(); + listview->setRowCount( row + 1 ); + QTableWidgetItem *imItem = new QTableWidgetItem( iminfoList[ 0 ] ); + imItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled ); + listview->setItem( row, 0, imItem ); + + QTableWidgetItem *langItem = new QTableWidgetItem( lang ); + langItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled ); + listview->setItem( row, 1, langItem ); + + QTableWidgetItem *descItem = new QTableWidgetItem( short_desc ); + descItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled ); + listview->setItem( row, 2, descItem ); + + if ( iminfoList.count() > 3 + && iminfoList[ 3 ] == QLatin1String( "selected" ) ) + for ( int j = 0; j < listview->columnCount(); j++ ) + listview->item( row, j )->setSelected( true ); + } + } + listview->sortItems( 0 ); +} + +void UimImSwitcher::reloadImList() +{ + checkHelperConnection(); + + /* send request to get im list */ + uim_helper_send_message( uim_fd, "im_list_get\n" ); +} Index: qt4/switcher/uim-im-switcher-qt4.pro.in =================================================================== --- qt4/switcher/uim-im-switcher-qt4.pro.in (revision 0) +++ qt4/switcher/uim-im-switcher-qt4.pro.in (revision 0) @@ -0,0 +1,22 @@ +TEMPLATE = app +CONFIG += @QT_CONFIG_OPTS@ + +INCLUDEPATH += @abs_top_builddir@ @abs_top_builddir@/uim \ + @abs_top_builddir@/replace .. +QMAKE_LIBDIR += @abs_top_builddir@/uim +QMAKE_LIBDIR += @abs_top_builddir@/replace +LIBS += -lreplace -luim -luim-scm -luim-x-util + +QMAKE_CFLAGS_DEBUG += @CFLAGS@ @X_CFLAGS@ +QMAKE_CFLAGS_RELEASE += @CFLAGS@ @X_CFLAGS@ +QMAKE_CXXFLAGS_DEBUG += @CXXFLAGS@ @X_CFLAGS@ +QMAKE_CXXFLAGS_RELEASE += @CXXFLAGS@ @X_CFLAGS@ + +# Input +HEADERS += qt4.h +SOURCES += qt4.cpp + +TARGET = uim-im-switcher-qt4 + +target.path += @DESTDIR@@exec_prefix@/bin +INSTALLS += target Index: qt4/switcher/qt4.h =================================================================== --- qt4/switcher/qt4.h (revision 0) +++ qt4/switcher/qt4.h (revision 0) @@ -0,0 +1,81 @@ +/* + + Copyright (c) 2003-2009 uim Project http://code.google.com/p/uim/ + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of authors nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +*/ +#ifndef UIM_QT4_IM_SWITCHER_QT_H +#define UIM_QT4_IM_SWITCHER_QT_H + +#include +#include + +#include +#include + +class QFocusEvent; +class QPushButton; +class QRadioButton; +class QTableWidget; + +class UimImSwitcher : public QDialog +{ + Q_OBJECT + +public: + explicit UimImSwitcher( QWidget *parent = 0 ); + ~UimImSwitcher(); + +protected: + void createGUI(); + + void sendMessageImChange( const QString &change_type ); + QString selectedImName() const; + + void checkHelperConnection(); + static void helper_disconnect_cb(); + + void parseHelperStrImList( const QString &message ); + + void reloadImList(); + +protected slots: + void slotStdinActivated( int socket ); + void slotChangeInputMethod(); + +protected: + QTableWidget *listview; + QRadioButton *wholeButton; + QRadioButton *applicationButton; + QRadioButton *textButton; + QPushButton *okButton; + QPushButton *cancelButton; +}; + +#endif /* Not def: UIM_QT_IM_SWITCHER_QT_H */ Index: qt4/Makefile.am =================================================================== --- qt4/Makefile.am (revision 6006) +++ qt4/Makefile.am (working copy) @@ -1 +1,3 @@ -SUBDIRS = immodule edittest +SUBDIRS = chardict edittest immodule pref switcher toolbar + +EXTRA_DIST = qtgettext.h Index: qt4/pref/kseparator.h =================================================================== --- qt4/pref/kseparator.h (revision 0) +++ qt4/pref/kseparator.h (revision 0) @@ -0,0 +1,83 @@ +/* +* Copyright (C) 1997 Michael Roth +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU Library General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Library General Public License for more details. +* +* You should have received a copy of the GNU Library General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +* +*/ + +#ifndef KSEPARATOR_H +#define KSEPARATOR_H + +#include + +/** + * Standard horizontal or vertical separator. + * + * @author Michael Roth + * @version $Id: kseparator.h,v 1.14 2004/09/09 15:23:53 faure Exp $ +*/ +class KSeparator : public QFrame +{ + Q_OBJECT + Q_PROPERTY( int orientation READ orientation WRITE setOrientation ) +public: + /** + * Constructor. + * @param parent parent object. + * @param f extra QWidget flags. + **/ + explicit KSeparator( QWidget* parent = 0, Qt::WFlags f = 0 ); + + /** + * Constructor. + * @param orientation Set the orientation of the separator. + * Possible values are HLine or Horizontal and VLine or Vertical. + * @param parent parent object. + * @param f extra QWidget flags. + **/ + explicit KSeparator( int orientation, QWidget* parent = 0, + Qt::WFlags f = 0 ); + + /** + * Returns the orientation of the separator. + * @return int Possible values are VLine and HLine. + **/ + int orientation() const; + + /** + * Set the orientation of the separator to @p orient + * + * @param orient Possible values are VLine and HLine. + */ + void setOrientation( int orient ); + + /** + * The recommended height (width) for a horizontal (vertical) separator. + **/ + virtual QSize sizeHint() const; + +protected: + /** + * @param p pointer to painter + */ + virtual void drawFrame( QPainter *p ); +protected: + virtual void virtual_hook( int id, void* data ); +private: + class KSeparatorPrivate* d; +}; + + +#endif // __KSEPARATOR_H__ Index: qt4/pref/customwidgets.cpp =================================================================== --- qt4/pref/customwidgets.cpp (revision 0) +++ qt4/pref/customwidgets.cpp (revision 0) @@ -0,0 +1,1267 @@ +/* + + Copyright (c) 2003-2009 uim Project http://code.google.com/p/uim/ + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of authors nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +*/ +#include "customwidgets.h" + +#include +#include + +#include "qtgettext.h" + +#include +#include +#include +#include +#include + +inline static QString _FU8( const char string[] ) +{ + return QString::fromUtf8(string); +} + +static const int DEBUG_KEY_EDIT = 0; +static QString unicodeKeyToSymStr( QChar c ); + +CustomCheckBox::CustomCheckBox( struct uim_custom *c, QWidget *parent ) + : QCheckBox( parent ), + UimCustomItemIface( c ) +{ + connect( this, SIGNAL(toggled(bool)), + this, SLOT(slotCustomToggled(bool)) ); + + update(); +} + +void CustomCheckBox::update() +{ + if( !m_custom || m_custom->type != UCustom_Bool ) + return; + + setText( _FU8(m_custom->label) ); + setChecked( m_custom->value->as_bool ); + + setEnabled( m_custom->is_active ); +} + +void CustomCheckBox::setDefault() +{ + m_custom->value->as_bool = m_custom->default_value->as_bool; + + setCustom( m_custom ); + update(); +} + +void CustomCheckBox::slotCustomToggled( bool check ) +{ + Q_ASSERT( m_custom->type == UCustom_Bool ); + + m_custom->value->as_bool = check; + setCustom( m_custom ); +} + +//---------------------------------------------------------------------------------------- +CustomSpinBox::CustomSpinBox( struct uim_custom *c, QWidget *parent ) + : QSpinBox( parent ), + UimCustomItemIface( c ) +{ + setMinimum( c->range->as_int.min ); + setMaximum( c->range->as_int.max ); + setSingleStep( 1 ); + connect( this, SIGNAL(valueChanged(int)), + this, SLOT(slotCustomValueChanged(int)) ); + update(); +} + +void CustomSpinBox::update() +{ + if( !m_custom || m_custom->type != UCustom_Int ) + return; + + setValue( m_custom->value->as_int ); + setMinimum( m_custom->range->as_int.min ); + setMaximum( m_custom->range->as_int.max ); + + /* sync with Label */ + parentWidget()->setEnabled( m_custom->is_active ); +} + +void CustomSpinBox::setDefault() +{ + m_custom->value->as_int = m_custom->default_value->as_int; + + setCustom( m_custom ); + update(); +} + +void CustomSpinBox::slotCustomValueChanged( int value ) +{ + Q_ASSERT( m_custom->type == UCustom_Int ); + + m_custom->value->as_int = value; + setCustom( m_custom ); +} + +//---------------------------------------------------------------------------------------- +CustomLineEdit::CustomLineEdit( struct uim_custom *c, QWidget *parent ) + : QLineEdit( parent ), + UimCustomItemIface( c ) +{ + connect( this, SIGNAL(textChanged(const QString&)), + this, SLOT(slotCustomTextChanged(const QString&)) ); + + setAttribute( Qt::WA_InputMethodEnabled, false ); + update(); +} + +void CustomLineEdit::update() +{ + if( !m_custom || m_custom->type != UCustom_Str ) + return; + + setText( _FU8(m_custom->value->as_str) ); + + /* sync with Label */ + parentWidget()->setEnabled( m_custom->is_active ); +} + +void CustomLineEdit::setDefault() +{ + free( m_custom->value->as_str ); + m_custom->value->as_str = strdup( m_custom->default_value->as_str ); + + setCustom( m_custom ); + update(); +} + +void CustomLineEdit::slotCustomTextChanged( const QString &text ) +{ + Q_ASSERT( m_custom->type == UCustom_Str ); + + free( m_custom->value->as_str ); + m_custom->value->as_str = strdup( (const char*)text.toUtf8() ); + + setCustom( m_custom ); +} + +//---------------------------------------------------------------------------------------- +CustomPathnameEdit::CustomPathnameEdit( struct uim_custom *c, QWidget *parent ) + : QFrame( parent ), + UimCustomItemIface( c ) +{ + const char *button; + + m_lineEdit = new QLineEdit( this ); + connect( m_lineEdit, SIGNAL(textChanged(const QString &)), + this, SLOT(slotCustomTextChanged(const QString &)) ); + + m_fileButton = new QPushButton( this ); + /* Since both pathname type opens the file dialog to select an item rather + * than open it, the label should always be "Select..." here. The type is + * obvious for uses even if the button label does not indicate + * it. Information about the action the button causes is more important. + * -- YamaKen 2006-01-21 */ + switch (m_custom->value->as_pathname->type) { + case UCustomPathnameType_Directory: + button = N_( "Select..." ); + break; + case UCustomPathnameType_RegularFile: + default: + button = N_( "Select..." ); + break; + } + m_fileButton->setText( mygettext(button) ); + connect( m_fileButton, SIGNAL(clicked()), + this, SLOT(slotPathnameButtonClicked()) ); + + QHBoxLayout *layout = new QHBoxLayout; + layout->setSpacing( 3 ); + layout->addWidget( m_lineEdit ); + layout->addWidget( m_fileButton ); + + setLayout( layout ); + + update(); +} + +void CustomPathnameEdit::update() +{ + if( !m_custom || m_custom->type != UCustom_Pathname ) + return; + + m_lineEdit->setText( _FU8(m_custom->value->as_pathname->str) ); + + /* sync with Label */ + parentWidget()->setEnabled( m_custom->is_active ); +} + +void CustomPathnameEdit::setDefault() +{ + free( m_custom->value->as_pathname->str ); + m_custom->value->as_pathname->str = strdup( m_custom->default_value->as_pathname->str ); + m_custom->value->as_pathname->type = m_custom->default_value->as_pathname->type; + + setCustom( m_custom ); + update(); +} + +void CustomPathnameEdit::slotPathnameButtonClicked() +{ + m_fileDialog = new QFileDialog( this, "file dialog" ); + + switch (m_custom->value->as_pathname->type) { + case UCustomPathnameType_Directory: + m_fileDialog->setFileMode( QFileDialog::Directory ); + break; + case UCustomPathnameType_RegularFile: + default: + m_fileDialog->setFileMode( QFileDialog::ExistingFile ); + break; + } + if ( m_fileDialog->exec() == QDialog::Accepted ) + { + QString fileName = m_fileDialog->selectedFiles()[ 0 ]; + m_lineEdit->setText( fileName ); + } + delete m_fileDialog; +} + +void CustomPathnameEdit::slotCustomTextChanged( const QString & text ) +{ + Q_ASSERT( m_custom->type == UCustom_Pathname ); + + free( m_custom->value->as_pathname->str ); + m_custom->value->as_pathname->str = strdup( (const char*)text.toUtf8() ); + + setCustom( m_custom ); +} + +//---------------------------------------------------------------------------------------- +CustomChoiceCombo::CustomChoiceCombo( struct uim_custom *c, QWidget *parent ) + : QComboBox( parent ), + UimCustomItemIface( c ) +{ + setEditable( false ); + connect( this, SIGNAL(activated(int)), + this, SLOT(slotActivated(int)) ); + + update(); +} + +void CustomChoiceCombo::update() +{ + if( !m_custom || m_custom->type != UCustom_Choice ) + return; + + clear(); + char *default_symbol = m_custom->value->as_choice->symbol; + int default_index = -1; + int index = 0; + struct uim_custom_choice **item = m_custom->range->as_choice.valid_items; + while( *item ) + { + int count = this->count(); + insertItem( count, _FU8((*item)->label) ); // insert item at last + + if( QString::compare( default_symbol, (*item)->symbol ) == 0 ) + default_index = index; + + index++; + item++; + } + setCurrentIndex( default_index ); + + /* sync with Label */ + parentWidget()->setEnabled( m_custom->is_active ); +} + +void CustomChoiceCombo::setDefault() +{ + free( m_custom->value->as_choice->symbol ); + free( m_custom->value->as_choice->label ); + free( m_custom->value->as_choice->desc ); + + m_custom->value->as_choice->symbol = strdup( m_custom->default_value->as_choice->symbol ); + m_custom->value->as_choice->label = strdup( m_custom->default_value->as_choice->label ); + m_custom->value->as_choice->desc = strdup( m_custom->default_value->as_choice->desc ); + + setCustom( m_custom ); + update(); +} + +void CustomChoiceCombo::slotActivated( int index ) +{ + Q_ASSERT( m_custom->type == UCustom_Choice ); + + struct uim_custom_choice **valid_items = m_custom->range->as_choice.valid_items; + struct uim_custom_choice *choice = 0; + if( valid_items ) + { + for( int i = 0; valid_items[i]; i++ ) + { + if( i == index ) + choice = valid_items[i]; + } + } + + free( m_custom->value->as_choice->symbol ); + free( m_custom->value->as_choice->label ); + free( m_custom->value->as_choice->desc ); + + m_custom->value->as_choice->symbol = strdup( choice->symbol ); + m_custom->value->as_choice->label = strdup( choice->label ); + m_custom->value->as_choice->desc = strdup( choice->desc ); + + setCustom( m_custom ); +} + +//---------------------------------------------------------------------------------------- +CustomOrderedListEdit::CustomOrderedListEdit( struct uim_custom *c, QWidget *parent ) + : QFrame( parent ), + UimCustomItemIface( c ) +{ + + m_lineEdit = new QLineEdit( this ); + m_lineEdit->setAttribute( Qt::WA_InputMethodEnabled, false ); + m_lineEdit->setReadOnly( true ); + + m_editButton = new QPushButton( this ); + m_editButton->setText( _("Edit") ); + connect( m_editButton, SIGNAL(clicked()), + this, SLOT(slotEditButtonClicked()) ); + + QHBoxLayout *layout = new QHBoxLayout; + layout->setSpacing( 3 ); + layout->addWidget( m_lineEdit ); + layout->addWidget( m_editButton ); + + setLayout( layout ); + + update(); +} + +void CustomOrderedListEdit::update() +{ + if( !m_custom || m_custom->type != UCustom_OrderedList ) + return; + + updateText(); + + /* sync with Label */ + parentWidget()->setEnabled( m_custom->is_active ); +} + +void CustomOrderedListEdit::setDefault() +{ + /* free old items */ + int num = 0; + for( num = 0; m_custom->value->as_olist[num]; num++ ) + ; + + for( int i = 0; i < num; i++ ) + { + free( m_custom->value->as_olist[i]->symbol ); + free( m_custom->value->as_olist[i]->label ); + free( m_custom->value->as_olist[i]->desc ); + free( m_custom->value->as_olist[i] ); + } + + /* copy default_value to value */ + int default_num = 0; + for( default_num = 0; m_custom->default_value->as_olist[default_num]; default_num++ ) + ; + + m_custom->value->as_olist = (struct uim_custom_choice **)realloc( m_custom->value->as_olist, + sizeof(struct uim_custom_choice *) * (default_num + 1) ); + + for( int i = 0; i < default_num; i++ ) + { + struct uim_custom_choice *default_item = m_custom->default_value->as_olist[i]; + struct uim_custom_choice *item = (struct uim_custom_choice *)malloc(sizeof(struct uim_custom_choice)); + + item->symbol = default_item->symbol ? strdup(default_item->symbol) : 0; + item->label = default_item->label ? strdup(default_item->label) : 0; + item->desc = default_item->desc ? strdup(default_item->desc) : 0; + + m_custom->value->as_olist[i] = item; + } + m_custom->value->as_olist[default_num] = 0; /* NULL-terminated */ + + setCustom( m_custom ); + initPtrList(); + update(); +} + +void CustomOrderedListEdit::initPtrList() +{ + m_itemList.clear(); + m_validItemList.clear(); + + if( m_custom->value->as_olist ) + { + struct uim_custom_choice *item = 0; + int i = 0; + for( item = m_custom->value->as_olist[0], i = 0; + item; + item = m_custom->value->as_olist[++i] ) + { + m_itemList.append( item ); + } + } + + if( m_custom->value->as_olist && m_custom->range->as_olist.valid_items ) + { + struct uim_custom_choice *item = 0; + int i = 0; + for( item = m_custom->range->as_olist.valid_items[0], i = 0; + item; + item = m_custom->range->as_olist.valid_items[++i] ) + { + m_validItemList.append( item ); + } + } +} + +void CustomOrderedListEdit::slotEditButtonClicked() +{ + OListEditForm *d = new OListEditForm( this ); + initPtrList(); + + /* + * Adding Enabled Items + */ + foreach( const struct uim_custom_choice *item, m_itemList ) + { + d->addCheckItem( true, _FU8(item->label) ); + } + /* + * Adding Disabled Items + */ + foreach ( const struct uim_custom_choice *valid_item, m_validItemList ) + { + /* Exclude Enabled Item */ + bool isActive = false; + foreach ( const struct uim_custom_choice *item, m_itemList ) + { + if( QString::compare( valid_item->symbol, item->symbol ) == 0 ) + { + isActive = true; + break; + } + } + + if( isActive == false ) + { + d->addCheckItem( false, _FU8(valid_item->label) ); + } + } + + /* Exec Dialog */ + if( d->exec() == OListEditForm::Accepted ) + { + /* search active item's ptr, realloc it, and store in activeItemList */ + QList activeItemList; + + QStringList activeItemLabelList = d->activeItemLabels(); + for( int i = 0; i < activeItemLabelList.count(); i++ ) + { + struct uim_custom_choice *item = 0; + int j = 0; + for( item = m_custom->range->as_olist.valid_items[0], j = 0; + item; + item = m_custom->range->as_olist.valid_items[++j] ) + { + if( QString::compare( activeItemLabelList[i], _FU8(item->label) ) == 0 ) + { + /* allocate new struct because we will free the old struct */ + struct uim_custom_choice *activeItem = (struct uim_custom_choice *)malloc(sizeof(struct uim_custom_choice)); + activeItem->symbol = item->symbol ? strdup(item->symbol) : 0; + activeItem->label = item->label ? strdup(item->label) : 0; + activeItem->desc = item->desc ? strdup(item->desc) : 0; + activeItemList.append( activeItem ); + break; + } + } + } + + /* free old items */ + for( int i = 0; i < m_itemList.count(); i++ ) + { + free( m_custom->value->as_olist[i]->symbol ); + free( m_custom->value->as_olist[i]->label ); + free( m_custom->value->as_olist[i]->desc ); + free( m_custom->value->as_olist[i] ); + } + + /* create null-terminated new olist */ + m_custom->value->as_olist = (struct uim_custom_choice **)realloc( m_custom->value->as_olist, + sizeof(struct uim_custom_choice *) * (activeItemList.count() + 1) ); + for( int i = 0; i < activeItemList.count(); i++ ) + { + m_custom->value->as_olist[i] = activeItemList.at(i); + } + m_custom->value->as_olist[activeItemList.count()] = 0; + + /* save */ + setCustom( m_custom ); + + /* reload */ + update(); + } + + delete d; +} + +void CustomOrderedListEdit::updateText() +{ + QString str; + if( m_custom->value->as_olist ) + { + struct uim_custom_choice *item = 0; + int i = 0; + for( item = m_custom->value->as_olist[0], i = 0; + item; + item = m_custom->value->as_olist[++i] ) + { + if( i != 0 ) + str.append(", "); + str.append( _FU8(item->label) ); + } + } + m_lineEdit->setText( str ); +} + +OListEditForm::OListEditForm( QWidget *parent ) + : QDialog( parent ) +{ + setupUi( this ); + m_listView->setRootIsDecorated( false ); + connect( m_upButton, SIGNAL(clicked()), + this, SLOT(upItem()) ); + connect( m_downButton, SIGNAL(clicked()), + this, SLOT(downItem()) ); +} + +OListEditForm::~OListEditForm() +{ +} + +void OListEditForm::addCheckItem( bool isActive, const QString &str ) +{ + QTreeWidgetItem *item = new QTreeWidgetItem( QStringList() << str ); + m_listView->addTopLevelItem( item ); + + if( item ) + item->setCheckState( 0, isActive ? Qt::Checked : Qt::Unchecked ); +} + +void OListEditForm::upItem() +{ + QList items = m_listView->selectedItems(); + if ( items.isEmpty() ) + return; + QTreeWidgetItem *item = items[ 0 ]; + int index = m_listView->indexOfTopLevelItem( item ); + if ( index == 0 ) + return; + m_listView->takeTopLevelItem( index ); + m_listView->insertTopLevelItem ( index - 1, item ); + m_listView->setCurrentItem( item ); +} + +void OListEditForm::downItem() +{ + QList items = m_listView->selectedItems(); + if ( items.isEmpty() ) + return; + QTreeWidgetItem *item = items[ 0 ]; + int index = m_listView->indexOfTopLevelItem( item ); + if ( index == m_listView->topLevelItemCount() - 1 ) + return; + m_listView->takeTopLevelItem( index ); + m_listView->insertTopLevelItem ( index + 1, item ); + m_listView->setCurrentItem( item ); +} + +QStringList OListEditForm::activeItemLabels() const +{ + QStringList activeItemLabelList; + for ( int i = 0; i < m_listView->topLevelItemCount(); i++) + { + QTreeWidgetItem *item = m_listView->topLevelItem( i ); + if ( item->checkState( 0 ) == Qt::Checked ) + activeItemLabelList << item->text ( 0 ); + } + return activeItemLabelList; +} + +//---------------------------------------------------------------------------------------- +CustomKeyEdit::CustomKeyEdit( struct uim_custom *c, QWidget *parent ) + : QFrame( parent ), + UimCustomItemIface( c ) +{ + m_lineEdit = new QLineEdit( this ); + m_lineEdit->setAttribute( Qt::WA_InputMethodEnabled, false ); + m_lineEdit->setReadOnly( true ); + + m_editButton = new QPushButton( this ); + m_editButton->setText( _("Edit") ); + connect( m_editButton, SIGNAL(clicked()), + this, SLOT(slotKeyButtonClicked()) ); + + QHBoxLayout *layout = new QHBoxLayout; + layout->setSpacing( 3 ); + layout->addWidget( m_lineEdit ); + layout->addWidget( m_editButton ); + + setLayout( layout ); + + update(); +} + +void CustomKeyEdit::update() +{ + if( !m_custom || m_custom->type != UCustom_Key ) + return; + + updateText(); + + /* sync with Label */ + parentWidget()->setEnabled( m_custom->is_active ); +} + +void CustomKeyEdit::updateText() +{ + QString str; + if (m_custom->value->as_key) { + struct uim_custom_key *key = 0; + int i = 0; + for (key = m_custom->value->as_key[0], i = 0; + key; + key = m_custom->value->as_key[++i]) + { + if( i != 0 ) + str.append(", "); + str.append( key->literal ); + } + } else { + /* error message */ + } + m_lineEdit->setText( str ); +} + + +void CustomKeyEdit::setDefault() +{ + /* free old items */ + int num = 0; + for( num = 0; m_custom->value->as_key[num]; num++ ) + ; + + for( int i = 0; i < num; i++ ) + { + free( m_custom->value->as_key[i]->literal ); + free( m_custom->value->as_key[i]->label ); + free( m_custom->value->as_key[i]->desc ); + free( m_custom->value->as_key[i] ); + } + + /* copy default_value to value */ + int default_num = 0; + for( default_num = 0; m_custom->default_value->as_key[default_num]; default_num++ ) + ; + + m_custom->value->as_key = (struct uim_custom_key **)realloc( m_custom->value->as_key, + sizeof(struct uim_custom_key *) * (default_num + 1) ); + + for( int i = 0; i < default_num; i++ ) + { + struct uim_custom_key *default_item = m_custom->default_value->as_key[i]; + struct uim_custom_key *item = (struct uim_custom_key *)malloc(sizeof(struct uim_custom_key)); + + item->type = default_item->type; + item->editor_type = default_item->editor_type; + item->literal = default_item->literal ? strdup(default_item->literal) : 0; + item->label = default_item->label ? strdup(default_item->label) : 0; + item->desc = default_item->desc ? strdup(default_item->desc) : 0; + + m_custom->value->as_key[i] = item; + } + m_custom->value->as_key[default_num] = 0; /* NULL-terminated */ + + setCustom( m_custom ); + update(); +} + +void CustomKeyEdit::slotKeyButtonClicked() +{ + KeyEditForm *d = new KeyEditForm( this ); + + /* add items */ + QString str; + if (m_custom->value->as_key) { + struct uim_custom_key *key = 0; + int i = 0; + for (key = m_custom->value->as_key[0], i = 0; + key; + key = m_custom->value->as_key[++i]) + { + d->addKeyItem( key->literal ); + } + } + + if( d->exec() == KeyEditForm::Accepted ) + { + const QStringList keyStrList = d->getKeyStrList(); + + /* free old items */ + int num = 0; + for( num = 0; m_custom->value->as_key[num]; num++ ) + ; + + for( int i = 0; i < num; i++ ) + { + free( m_custom->value->as_key[i]->literal ); + free( m_custom->value->as_key[i]->label ); + free( m_custom->value->as_key[i]->desc ); + free( m_custom->value->as_key[i] ); + } + + + /* add new items */ + num = keyStrList.count(); + m_custom->value->as_key = (struct uim_custom_key **)realloc( m_custom->value->as_key, + sizeof(struct uim_custom_key *) * (num + 1) ); + + for( int i = 0; i < num; i++ ) + { + const char *keystr = (const char *)keyStrList[i].toAscii(); + + struct uim_custom_key *item = (struct uim_custom_key *)malloc(sizeof(struct uim_custom_key)); + item->type = UCustomKey_Regular; + item->editor_type = UCustomKeyEditor_Basic; + item->literal = strdup( keystr ); + item->label = strdup( "" ); + item->desc = strdup( "" ); + + m_custom->value->as_key[i] = item; + } + m_custom->value->as_key[num] = 0; + + setCustom( m_custom ); + update(); + } + + delete d; +} + +KeyEditForm::KeyEditForm( QWidget *parent ) + : QDialog( parent ) +{ + setupUi( this ); + + m_listView->setRootIsDecorated( false ); + m_removeButton->setEnabled( false ); + m_editButton->setEnabled( false ); + + connect( m_addButton, SIGNAL(clicked()), + this, SLOT(slotAddClicked()) ); + connect( m_removeButton, SIGNAL(clicked()), + this, SLOT(slotRemoveClicked()) ); + connect( m_editButton, SIGNAL(clicked()), + this, SLOT(slotEditClicked()) ); + + connect( m_listView, SIGNAL(itemSelectionChanged()), + this, SLOT(slotItemSelectionChanged()) ); +} + +KeyEditForm::~KeyEditForm() +{ +} + +void KeyEditForm::addKeyItem( const QString &str ) +{ + QTreeWidgetItem *item = new QTreeWidgetItem( QStringList() << str ); + m_listView->addTopLevelItem( item ); +} + +const QStringList KeyEditForm::getKeyStrList() +{ + QStringList keyStrList; + for ( int i = 0; i < m_listView->topLevelItemCount(); i++) + { + keyStrList << m_listView->topLevelItem( i )->text ( 0 ); + } + return keyStrList; +} + +void KeyEditForm::slotAddClicked() +{ + KeyGrabDialog *d = new KeyGrabDialog( this ); + if( d->exec() == KeyGrabDialog::Accepted ) + { + QString keystr = d->getKeyStr(); + if( !keystr.isEmpty() ) + { + addKeyItem( keystr ); + } + } + delete d; +} + +void KeyEditForm::slotRemoveClicked() +{ + QList selectedItems = m_listView->selectedItems(); + if( !selectedItems.isEmpty() ) + { + m_listView->takeTopLevelItem( + m_listView->indexOfTopLevelItem( selectedItems[ 0 ] ) ); + } +} + +void KeyEditForm::slotEditClicked() +{ + QList selectedItems = m_listView->selectedItems(); + if( selectedItems.isEmpty() ) + return; + KeyGrabDialog *d = new KeyGrabDialog( this ); + if( d->exec() == KeyGrabDialog::Accepted ) + { + QString keystr = d->getKeyStr(); + if( !keystr.isEmpty() ) + { + selectedItems[ 0 ]->setText( 0, keystr ); + } + } + delete d; +} + +void KeyEditForm::slotItemSelectionChanged() +{ + QList selectedItems = m_listView->selectedItems(); + if( !selectedItems.isEmpty() ) + { + m_removeButton->setEnabled( true ); + m_editButton->setEnabled( true ); + } + else + { + m_removeButton->setEnabled( false ); + m_editButton->setEnabled( false ); + } +} + +KeyGrabDialog::KeyGrabDialog( QWidget *parent ) + : QDialog( parent ), + pressed_keyval( 0 ), + pressed_keystate( Qt::NoModifier ), + pressed_unichar ( 0 ), + m_keystr( 0 ) +{ + QLabel *l = new QLabel( _("Press keys to grab (e.g. a)"), this ); + + QVBoxLayout *vboxLayout = new QVBoxLayout( this ); + vboxLayout->addWidget( l ); + + setWindowTitle( _("Key Grab Dialog") ); +} + +void KeyGrabDialog::keyPressEvent( QKeyEvent *e ) +{ + pressed_keyval = e->key(); + pressed_keystate = e->modifiers(); + pressed_unichar = e->text().at(0); +} + +void KeyGrabDialog::keyReleaseEvent( QKeyEvent * /* e */ ) +{ + // create keystr + setKeyStr(); + + // end this dialog + accept(); +} + +void KeyGrabDialog::setKeyStr() +{ + QString keystr; + int keyval = pressed_keyval; + Qt::KeyboardModifiers mod = pressed_keystate; + + /* + * Ignore Shift modifier for printable char keys for + * easy-to-recognize key configuration. uim-custom performs + * implicit shift key encoding/decoding appropriately. + */ + if( ((keyval >= 256) || !isgraph(keyval)) && + (mod & Qt::ShiftModifier) ) + keystr += ""; + if( mod & Qt::ControlModifier ) + keystr += ""; + if( mod & Qt::AltModifier ) + keystr += ""; + if( mod & Qt::MetaModifier ) + keystr += ""; + + switch( keyval ) { + case Qt::Key_Space: + keystr += "space"; + break; + case Qt::Key_Backspace: + keystr += "backspace"; + break; + case Qt::Key_Delete: + keystr += "delete"; + break; + case Qt::Key_Insert: + keystr += "insert"; + break; + case Qt::Key_Escape: + keystr += "escape"; + break; + case Qt::Key_Tab: + keystr += "tab"; + break; + case Qt::Key_Return: + keystr += "return"; + break; + case Qt::Key_Left: + keystr += "left"; + break; + case Qt::Key_Up: + keystr += "up"; + break; + case Qt::Key_Right: + keystr += "right"; + break; + case Qt::Key_Down: + keystr += "down"; + break; + case Qt::Key_PageUp: + keystr += "prior"; + break; + case Qt::Key_PageDown: + keystr += "next"; + break; + case Qt::Key_Home: + keystr += "home"; + break; + case Qt::Key_End: + keystr += "end"; + break; +#ifdef QT_IMMODULE + case Qt::Key_Multi_key: + keystr += "Multi_key"; + break; + case Qt::Key_Codeinput: + keystr += "codeinput"; + break; + case Qt::Key_SingleCandidate: + keystr += "single-candidate"; + break; + case Qt::Key_MultipleCandidate: + keystr += "multiple-candidate"; + break; + case Qt::Key_PreviousCandidate: + keystr += "previous-candidate"; + break; + case Qt::Key_Mode_switch: + keystr += "Mode_switch"; + break; + case Qt::Key_Kanji: + keystr += "Kanji"; + break; + case Qt::Key_Muhenkan: + keystr += "Muhenkan"; + break; + case Qt::Key_Henkan: + keystr += "Henkan_Mode"; + break; + case Qt::Key_Romaji: + keystr += "romaji"; + break; + case Qt::Key_Hiragana: + keystr += "hiragana"; + break; + case Qt::Key_Katakana: + keystr += "katakana"; + break; + case Qt::Key_Hiragana_Katakana: + keystr += "hiragana-katakana"; + break; + case Qt::Key_Zenkaku: + keystr += "zenkaku"; + break; + case Qt::Key_Hankaku: + keystr += "hankaku"; + break; + case Qt::Key_Zenkaku_Hankaku: + keystr += "zenkaku-hankaku"; + break; + case Qt::Key_Touroku: + keystr += "touroku"; + break; + case Qt::Key_Massyo: + keystr += "massyo"; + break; + case Qt::Key_Kana_Lock: + keystr += "kana-lock"; + break; + case Qt::Key_Kana_Shift: + keystr += "kana-shift"; + break; + case Qt::Key_Eisu_Shift: + keystr += "eisu-shift"; + break; + case Qt::Key_Eisu_toggle: + keystr += "eisu-toggle"; + break; + case Qt::Key_Hangul: + keystr += "hangul"; + break; + case Qt::Key_Hangul_Start: + keystr += "hangul-start"; + break; + case Qt::Key_Hangul_End: + keystr += "hangul-end"; + break; + case Qt::Key_Hangul_Hanja: + keystr += "hangul-hanja"; + break; + case Qt::Key_Hangul_Jamo: + keystr += "hangul-jamo"; + break; + case Qt::Key_Hangul_Romaja: + keystr += "hangul-romaja"; + break; + case Qt::Key_Hangul_Jeonja: + keystr += "hangul-jeonja"; + break; + case Qt::Key_Hangul_Banja: + keystr += "hangul-banja"; + break; + case Qt::Key_Hangul_PreHanja: + keystr += "hangul-prehanja"; + break; + case Qt::Key_Hangul_PostHanja: + keystr += "hangul-prosthanja"; + break; + case Qt::Key_Hangul_Special: + keystr += "hangul-special"; + break; + case Qt::Key_Dead_Grave: + keystr += "dead-grave"; + break; + case Qt::Key_Dead_Acute: + keystr += "dead-acute"; + break; + case Qt::Key_Dead_Circumflex: + keystr += "dead-circumflex"; + break; + case Qt::Key_Dead_Tilde: + keystr += "dead-tilde"; + break; + case Qt::Key_Dead_Macron: + keystr += "dead-macron"; + break; + case Qt::Key_Dead_Breve: + keystr += "dead-breve"; + break; + case Qt::Key_Dead_Abovedot: + keystr += "dead-abovedot"; + break; + case Qt::Key_Dead_Diaeresis: + keystr += "dead-diaeresis"; + break; + case Qt::Key_Dead_Abovering: + keystr += "dead-abovering"; + break; + case Qt::Key_Dead_Doubleacute: + keystr += "dead-doubleacute"; + break; + case Qt::Key_Dead_Caron: + keystr += "dead-caron"; + break; + case Qt::Key_Dead_Cedilla: + keystr += "dead-cedilla"; + break; + case Qt::Key_Dead_Ogonek: + keystr += "dead-ogonek"; + break; + case Qt::Key_Dead_Iota: + keystr += "dead-iota"; + break; + case Qt::Key_Dead_Voiced_Sound: + keystr += "dead-voiced-sound"; + break; + case Qt::Key_Dead_Semivoiced_Sound: + keystr += "dead-semivoiced-sound"; + break; + case Qt::Key_Dead_Belowdot: + keystr += "dead-belowdot"; + break; + case Qt::Key_Dead_Hook: + keystr += "dead-hook"; + break; + case Qt::Key_Dead_Horn: + keystr += "dead-horn"; + break; +#endif /* Def: QT_IMMODULE */ + case Qt::Key_Shift: + keystr += "Shift_key"; + break; + case Qt::Key_Control: + keystr += "Control_key"; + break; + case Qt::Key_Alt: + keystr += "Alt_key"; + break; + case Qt::Key_Meta: + keystr += "Meta_key"; + break; + case Qt::Key_Super_L: + case Qt::Key_Super_R: + keystr += "Super_key"; + break; + case Qt::Key_Hyper_L: + case Qt::Key_Hyper_R: + keystr += "Hyper_key"; + break; + case Qt::Key_CapsLock: + keystr += "caps-lock"; + break; + case Qt::Key_NumLock: + keystr += "num-lock"; + break; + case Qt::Key_ScrollLock: + keystr += "scroll-lock"; + break; + case Qt::Key_unknown: + keystr += unicodeKeyToSymStr ( pressed_unichar ); + break; + default: + if( keyval >= Qt::Key_F1 && keyval <= Qt::Key_F35 ) + { + keystr += 'F' + QString::number( keyval - Qt::Key_F1 + 1 ); + break; + } + else if( keyval < 256 ) + { + QChar ch = QChar( keyval ); + + if( mod & Qt::ShiftModifier ) + ch = ch.toUpper(); + else + ch = ch.toLower(); + + keystr += ch; + } + } + + m_keystr = keystr; + +} + +static QString unicodeKeyToSymStr ( QChar c ) +{ + QString str; + + switch ( c.unicode() ) { + case 0x00A5: str = "yen"; break; + case 0x3002: str = "kana-fullstop"; break; + case 0x300C: str = "kana-opening-bracket"; break; + case 0x300D: str = "kana-closing-bracket"; break; + case 0x3001: str = "kana-comma"; break; + case 0x30FB: str = "kana-conjunctive"; break; + case 0x30F2: str = "kana-WO"; break; + case 0x30A1: str = "kana-a"; break; + case 0x30A3: str = "kana-i"; break; + case 0x30A5: str = "kana-u"; break; + case 0x30A7: str = "kana-e"; break; + case 0x30A9: str = "kana-o"; break; + case 0x30E3: str = "kana-ya"; break; + case 0x30E5: str = "kana-yu"; break; + case 0x30E7: str = "kana-yo"; break; + case 0x30C3: str = "kana-tsu"; break; + case 0x30FC: str = "kana-prolonged-sound"; break; + case 0x30A2: str = "kana-A"; break; + case 0x30A4: str = "kana-I"; break; + case 0x30A6: str = "kana-U"; break; + case 0x30A8: str = "kana-E"; break; + case 0x30AA: str = "kana-O"; break; + case 0x30AB: str = "kana-KA"; break; + case 0x30AD: str = "kana-KI"; break; + case 0x30AF: str = "kana-KU"; break; + case 0x30B1: str = "kana-KE"; break; + case 0x30B3: str = "kana-KO"; break; + case 0x30B5: str = "kana-SA"; break; + case 0x30B7: str = "kana-SHI"; break; + case 0x30B9: str = "kana-SU"; break; + case 0x30BB: str = "kana-SE"; break; + case 0x30BD: str = "kana-SO"; break; + case 0x30BF: str = "kana-TA"; break; + case 0x30C1: str = "kana-CHI"; break; + case 0x30C4: str = "kana-TSU"; break; + case 0x30C6: str = "kana-TE"; break; + case 0x30C8: str = "kana-TO"; break; + case 0x30CA: str = "kana-NA"; break; + case 0x30CB: str = "kana-NI"; break; + case 0x30CC: str = "kana-NU"; break; + case 0x30CD: str = "kana-NE"; break; + case 0x30CE: str = "kana-NO"; break; + case 0x30CF: str = "kana-HA"; break; + case 0x30D2: str = "kana-HI"; break; + case 0x30D5: str = "kana-FU"; break; + case 0x30D8: str = "kana-HE"; break; + case 0x30DB: str = "kana-HO"; break; + case 0x30DE: str = "kana-MA"; break; + case 0x30DF: str = "kana-MI"; break; + case 0x30E0: str = "kana-MU"; break; + case 0x30E1: str = "kana-ME"; break; + case 0x30E2: str = "kana-MO"; break; + case 0x30E4: str = "kana-YA"; break; + case 0x30E6: str = "kana-YU"; break; + case 0x30E8: str = "kana-YO"; break; + case 0x30E9: str = "kana-RA"; break; + case 0x30EA: str = "kana-RI"; break; + case 0x30EB: str = "kana-RU"; break; + case 0x30EC: str = "kana-RE"; break; + case 0x30ED: str = "kana-RO"; break; + case 0x30EF: str = "kana-WA"; break; + case 0x30F3: str = "kana-N"; break; + case 0x309B: str = "kana-voiced-sound"; break; + case 0x309C: str = "kana-semivoiced-sound"; break; + default: + break; + } + + return str; +} Index: qt4/pref/customwidgets.h =================================================================== --- qt4/pref/customwidgets.h (revision 0) +++ qt4/pref/customwidgets.h (revision 0) @@ -0,0 +1,299 @@ +/* + + Copyright (c) 2003-2009 uim Project http://code.google.com/p/uim/ + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of authors nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +*/ +#ifndef UIM_QT4_PREF_CUSTOMWIDGETS_H +#define UIM_QT4_PREF_CUSTOMWIDGETS_H + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "ui_olisteditformbase.h" +#include "ui_keyeditformbase.h" + +class QPushButton; +class QListViewItem; +class QFileDialog; + +class UimCustomItemIface +{ +public: + explicit UimCustomItemIface( struct uim_custom *c = 0 ) + { + m_custom = c; + + // callback + uim_custom_cb_add( m_custom->symbol, this, UimCustomItemIface::update_cb ); + } + virtual ~UimCustomItemIface() + { + if( m_custom ) uim_custom_free( m_custom ); + } + + /* Custom Update Callback */ + static void update_cb( void *ptr, const char *custom_sym ) + { + UimCustomItemIface *iface = (UimCustomItemIface*)ptr; + iface->updateItem( custom_sym ); + iface->update(); + } + virtual void update() = 0; + + /* Set to default */ + virtual void setDefault() = 0; + +protected: + void setCustom( struct uim_custom *custom ) + { + uim_bool rv = uim_custom_set( custom ); + if( rv ) + currentCustomValueChanged(); + else + qFatal( "Failed to set value for \"%s\".", custom->symbol ); + } + void updateItem( const char *custom_sym ) + { + // remove current custom + if( m_custom ) uim_custom_free( m_custom ); + // set new item + m_custom = uim_custom_get( custom_sym ); + } + + virtual void currentCustomValueChanged() = 0; + +protected: + struct uim_custom *m_custom; +}; + +//---------------------------------------------------------------------------------------- +class CustomCheckBox : public QCheckBox, public UimCustomItemIface +{ + Q_OBJECT + +public: + explicit CustomCheckBox( struct uim_custom *c, QWidget *parent = 0 ); + + virtual void update(); + virtual void setDefault(); +protected slots: + void slotCustomToggled( bool check ); +protected: + void currentCustomValueChanged(){ emit customValueChanged(); } +signals: + void customValueChanged(); +}; + +//---------------------------------------------------------------------------------------- +class CustomSpinBox : public QSpinBox, public UimCustomItemIface +{ + Q_OBJECT + +public: + CustomSpinBox( struct uim_custom *c, QWidget *parent ); + + virtual void update(); + virtual void setDefault(); +public slots: + void slotCustomValueChanged( int value ); +protected: + void currentCustomValueChanged(){ emit customValueChanged(); } +signals: + void customValueChanged(); +}; + +//---------------------------------------------------------------------------------------- +class CustomLineEdit : public QLineEdit, public UimCustomItemIface +{ + Q_OBJECT + +public: + CustomLineEdit( struct uim_custom *c, QWidget *parent ); + + virtual void update(); + virtual void setDefault(); +protected slots: + void slotCustomTextChanged( const QString &text ); +protected: + void currentCustomValueChanged(){ emit customValueChanged(); } +signals: + void customValueChanged(); +}; + +//---------------------------------------------------------------------------------------- +class CustomPathnameEdit : public QFrame, public UimCustomItemIface +{ + Q_OBJECT + +public: + CustomPathnameEdit( struct uim_custom *c, QWidget *parent ); + + virtual void update(); + virtual void setDefault(); +protected slots: + void slotPathnameButtonClicked(); + void slotCustomTextChanged( const QString & text ); +private: + QLineEdit *m_lineEdit; + QPushButton *m_fileButton; + QFileDialog *m_fileDialog; +protected: + void currentCustomValueChanged(){ emit customValueChanged(); } +signals: + void customValueChanged(); +}; + +//---------------------------------------------------------------------------------------- +class CustomChoiceCombo : public QComboBox, public UimCustomItemIface +{ + Q_OBJECT + +public: + CustomChoiceCombo( struct uim_custom *c, QWidget *parent ); + + virtual void update(); + virtual void setDefault(); +protected slots: + void slotActivated( int index ); +protected: + void currentCustomValueChanged(){ emit customValueChanged(); } +signals: + void customValueChanged(); +}; + +//---------------------------------------------------------------------------------------- +class CustomOrderedListEdit : public QFrame, public UimCustomItemIface +{ + Q_OBJECT + +public: + CustomOrderedListEdit( struct uim_custom *c, QWidget *parent ); + + virtual void update(); + virtual void setDefault(); +protected slots: + void slotEditButtonClicked(); +private: + QLineEdit *m_lineEdit; + QPushButton *m_editButton; + + QList m_validItemList; + QList m_itemList; +protected: + void updateText(); + void initPtrList(); + void currentCustomValueChanged(){ emit customValueChanged(); } +signals: + void customValueChanged(); +}; + +class OListEditForm : public QDialog, public Ui_OListEditFormBase { + Q_OBJECT + +public: + explicit OListEditForm( QWidget *parent = 0 ); + virtual ~OListEditForm(); + + void addCheckItem( bool isActive, const QString &str ); + QStringList activeItemLabels() const; +protected slots: + void upItem(); + void downItem(); +}; + +//---------------------------------------------------------------------------------------- +class CustomKeyEdit : public QFrame, public UimCustomItemIface +{ + Q_OBJECT + +public: + CustomKeyEdit( struct uim_custom *c, QWidget *parent ); + + virtual void update(); + virtual void setDefault(); +protected: + void updateText(); +protected slots: + void slotKeyButtonClicked(); +private: + QLineEdit *m_lineEdit; + QPushButton *m_editButton; +protected: + void currentCustomValueChanged(){ emit customValueChanged(); } +signals: + void customValueChanged(); +}; + +class KeyEditForm : public QDialog, public Ui_KeyEditFormBase { + Q_OBJECT + +public: + explicit KeyEditForm( QWidget *parent = 0 ); + virtual ~KeyEditForm(); + + void addKeyItem( const QString &str ); + const QStringList getKeyStrList(); +protected slots: + void slotAddClicked(); + void slotRemoveClicked(); + void slotEditClicked(); + void slotItemSelectionChanged(); +}; + +class KeyGrabDialog : public QDialog { + Q_OBJECT + +public: + explicit KeyGrabDialog( QWidget *parent = 0 ); + + QString getKeyStr() const { return m_keystr; } + + virtual void keyPressEvent( QKeyEvent *e ); + virtual void keyReleaseEvent( QKeyEvent *e ); + +protected: + void setKeyStr(); + +protected: + int pressed_keyval; + Qt::KeyboardModifiers pressed_keystate; + QChar pressed_unichar; + QString m_keystr; +}; + +#endif /* Not def: UIM_QT4_PREF_CUSTOMWIDGETS_H */ Index: qt4/pref/keyeditformbase.ui =================================================================== --- qt4/pref/keyeditformbase.ui (revision 0) +++ qt4/pref/keyeditformbase.ui (revision 0) @@ -0,0 +1,119 @@ + + + + + + KeyEditFormBase + + + + 0 + 0 + 392 + 229 + + + + + 5 + 5 + 0 + 0 + + + + KeyEditDialog + + + + + + + + + Key Combination + + + false + + + true + + + + + + + + + + Add + + + + + + + Remove + + + + + + + Edit + + + + + + + + 77 + 50 + + + + QSizePolicy::Expanding + + + Qt::Vertical + + + + + + + OK + + + + + + + Cancel + + + + + + + + + + + + + m_okButton + clicked() + KeyEditFormBase + accept() + + + m_cancelButton + clicked() + KeyEditFormBase + reject() + + + Index: qt4/pref/qt4.cpp =================================================================== --- qt4/pref/qt4.cpp (revision 0) +++ qt4/pref/qt4.cpp (revision 0) @@ -0,0 +1,704 @@ +/* + + Copyright (c) 2003-2009 uim Project http://code.google.com/p/uim/ + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of authors nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +*/ +#include + +#include "qt4.h" +#include "customwidgets.h" +#include "kseparator.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "uim/counted-init.h" +#include "qtgettext.h" + +#include +#include + +static const int DEFAULT_WINDOW_WIDTH = 800; +static const int DEFAULT_WINDOW_HEIGHT = 600; + +inline static QString _FU8( const char string[] ) +{ + return QString::fromUtf8( string ); +} + +UimPrefDialog::UimPrefDialog( QWidget *parent ) + : QDialog( parent ), + m_isValueChanged( false ) +{ + uim_counted_init(); + if (uim_custom_enable()) { + checkDotUimFile(); + setupWidgets(); + } else { +#if defined(ENABLE_DEBUG) + qDebug("uim_custom_enable() failed."); +#endif + uim_counted_quit(); + QApplication::exit( -1 ); + } + + setWindowTitle( "uim-pref-qt4" ); +} + +UimPrefDialog::~UimPrefDialog() +{ + uim_counted_quit(); +} + +void UimPrefDialog::checkDotUimFile() +{ + /* Check Config */ + QSettings settings; + bool isShowOnStartup + = settings.value( "/uim/qt/warnDotUim", true ).toBool(); + if( !isShowOnStartup ) + return; + + /* Check File Existence */ + QString homeDir = qgetenv( "HOME" ); + if( homeDir.isEmpty() ) + return; + + QString dotUim = homeDir + "/.uim"; + if( QFile::exists( dotUim ) ) + { + QString msg = _("The user customize file \"~/.uim\" is found.\n" + "This file will override all conflicted settings set by\n" + "this tool (stored in ~/.uim.d/customs/*.scm).\n" + "Please check the file if you find your settings aren't applied."); + + QConfirmDialog *d = new QConfirmDialog( msg, + "/uim/qt/warnDotUim", + this ); + d->setWindowTitle( _("~/.uim exists!") ); + d->exec(); + delete d; + } +} + +/* + * Building up GUI + */ +void UimPrefDialog::setupWidgets() +{ + createMainWidgets(); + createGroupWidgets(); +} + +void UimPrefDialog::createMainWidgets() +{ + QVBoxLayout *mainVLayout = new QVBoxLayout( this ); + mainVLayout->setMargin( 6 ); + + QSplitter *mainSplitter = new QSplitter( this ); + + /* ListView */ + m_groupListView = new QTreeWidget( mainSplitter ); + m_groupListView->setRootIsDecorated( false ); + m_groupListView->setHeaderLabel( _("Group") ); + m_groupListView->setSelectionMode( QAbstractItemView::SingleSelection ); + connect( m_groupListView, SIGNAL(itemSelectionChanged()), + this, SLOT(slotItemSelectionChanged()) ); + + /* Contents Frame */ + m_rightSideWidget = new QScrollArea( mainSplitter ); + m_rightSideWidget->setWidgetResizable( true ); + m_groupWidgetStack = new QStackedWidget; + + /* Buttons */ + QWidget *buttonHWidget = new QWidget( this ); + buttonHWidget->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed); + QHBoxLayout *buttonHLayout = new QHBoxLayout( buttonHWidget ); + buttonHLayout->setMargin( 6 ); + buttonHLayout->setSpacing( 6 ); + QPushButton *defaultButton = new QPushButton( _("Defaults"), buttonHWidget ); + connect( defaultButton, SIGNAL(clicked()), + this, SLOT(slotSetDefault()) ); + QPushButton *okButton = new QPushButton( _("OK"), buttonHWidget ); + connect( okButton, SIGNAL(clicked()), + this, SLOT(slotOK()) ); + m_applyButton = new QPushButton( _("Apply"), buttonHWidget ); + m_applyButton->setEnabled( false ); + connect( m_applyButton, SIGNAL(clicked()), + this, SLOT(slotApply()) ); + QPushButton *cancelButton = new QPushButton( _("Cancel"), buttonHWidget ); + connect( cancelButton, SIGNAL(clicked()), + this, SLOT(slotCancel()) ); + buttonHLayout->addWidget( defaultButton ); + buttonHLayout->addStretch(); + buttonHLayout->addWidget( okButton ); + buttonHLayout->addWidget( m_applyButton ); + buttonHLayout->addWidget( cancelButton ); + + mainVLayout->addWidget( mainSplitter ); + mainVLayout->addWidget( new KSeparator( this ) ); + mainVLayout->addWidget( buttonHWidget ); + + mainSplitter->setStretchFactor( 1, 1 ); +} + +void UimPrefDialog::createGroupWidgets() +{ + char **primary_groups = uim_custom_primary_groups(); + char **grp = 0; + for( grp = primary_groups; *grp; grp++ ) + { + struct uim_custom_group *group = uim_custom_group_get( *grp ); + if( group == 0 ) + continue; + + /* insert item in uim's order */ + m_groupListView->addTopLevelItem( + new QTreeWidgetItem( QStringList() << _FU8(group->label) ) ); + + GroupPageWidget *w = new GroupPageWidget( m_groupWidgetStack, *grp ); + if ( grp == primary_groups ) + w->setupWidgets(); + + connect( w, SIGNAL(customValueChanged()), + this, SLOT(slotCustomValueChanged()) ); + + m_groupWidgetsDict.insert( _FU8(group->label), w ); + m_groupWidgetStack->addWidget( w ); + + uim_custom_group_free( group ); + } + uim_custom_symbol_list_free( primary_groups ); + + m_rightSideWidget->setWidget( m_groupWidgetStack ); +} + +/* + * GUI event handling + */ +void UimPrefDialog::slotItemSelectionChanged() +{ + QListitems = m_groupListView->selectedItems(); + if ( items.isEmpty() ) + return; + QTreeWidgetItem *item = items[ 0 ]; + + /* + * Don't confirm on each change in slot selection according to + * [Anthy-dev 1795]. + * Dec 09 2005 ekato + */ +#if 0 + /* confirm if save the change */ + if( m_isValueChanged ) + confirmChange(); +#endif + + /* switch group widget */ + QString grpname = item->text( 0 ); + static_cast(m_groupWidgetsDict[grpname])->setupWidgets(); + m_groupWidgetStack->setCurrentWidget( m_groupWidgetsDict[grpname] ); + +#if 0 + m_applyButton->setEnabled( false ); +#endif +} + +void UimPrefDialog::slotCustomValueChanged() +{ + m_isValueChanged = true; + m_applyButton->setEnabled( true ); +} + +void UimPrefDialog::confirmChange() +{ + int result = QMessageBox::question( this, + _("Save Confirm"), + _("The value was changed.\nSave?"), + _("OK"), + _("Cancel") ); + switch(result) + { + case 0: + slotApply(); + break; + case 1: + m_isValueChanged = false; + break; + } +} + +void UimPrefDialog::confirmQuit() +{ + int result = QMessageBox::question( this, + _("Quit Confirm"), + _("Some value(s) have been changed.\n" + "Do you really quit this program?"), + _("Yes"), + _("No"), + "", 1, -1); + switch(result) + { + case 0: + reject(); + break; + case 1: + break; + default: + break; + } +} + +void UimPrefDialog::slotSetDefault() +{ + QWidget *w = m_groupWidgetStack->currentWidget(); + if( w ) + { + ((GroupPageWidget*)w)->setDefault(); + } +} + +void UimPrefDialog::slotApply() +{ + if( !m_isValueChanged ) + return; + +#if defined(ENABLE_DEBUG) + qDebug("start saving...."); +#endif + + uim_custom_save(); + uim_custom_broadcast_reload_request(); + + m_isValueChanged = false; + m_applyButton->setEnabled( false ); +} + +void UimPrefDialog::slotOK() +{ + if( m_isValueChanged ) + { + slotApply(); + } + accept(); +} + +void UimPrefDialog::slotCancel() +{ + /* + * Enable confirmation since each change in slot selection is not + * checked strictly according to [Anthy-dev 1795]. + * Dec 09 2005 ekato + */ + if( m_isValueChanged ) + confirmQuit(); + else + reject(); +} + +//------------------------------------------------------------------------------------- +QConfirmDialog::QConfirmDialog( const QString &msg, const QString &confname, QWidget *parent ) + : QDialog( parent ), + m_confname( confname ) +{ + QSettings settings; + bool isShowOnStartup = settings.value( m_confname, true ).toBool(); + if( isShowOnStartup ) + setupWidgets( msg ); +} + +void QConfirmDialog::setupWidgets( const QString&msg ) +{ + QVBoxLayout *vLayout = new QVBoxLayout( this ); + vLayout->setSpacing( 6 ); + vLayout->setMargin( 6 ); + QLabel *msgLabel = new QLabel( msg, this ); + KSeparator *sep = new KSeparator( this ); + vLayout->addWidget( msgLabel ); + vLayout->addWidget( sep ); + + QHBoxLayout *buttonHLayout = new QHBoxLayout; + vLayout->addLayout( buttonHLayout ); + QCheckBox *checkBox = new QCheckBox( _("Show this dialog on startup"), this ); + QSettings settings; + bool isWarnDotUim = settings.value( m_confname, true ).toBool(); + checkBox->setChecked( isWarnDotUim ); + QPushButton *ok = new QPushButton( _("OK"), this ); + ok->setDefault(true); + buttonHLayout->addWidget( checkBox ); + buttonHLayout->addStretch(); + buttonHLayout->addWidget( ok ); + + connect( ok, SIGNAL(clicked()), + this, SLOT(accept()) ); + connect( checkBox, SIGNAL(toggled(bool)), + this, SLOT(showOnStart(bool)) ); +} + +void QConfirmDialog::showOnStart( bool isShowOnStart ) +{ + QSettings settings; + settings.setValue( m_confname, isShowOnStart ); + +#if defined(ENABLE_DEBUG) + qDebug("show on start = %d", isShowOnStart ); +#endif +} + + +//----------------------------------------------------------------------------------- + +GroupPageWidget::GroupPageWidget( QWidget *parent, const char *group_name ) + : QWidget( parent ) +{ + m_customIfaceList.clear(); + + m_group_sym = group_name; + m_widget_created = false; +} + +void GroupPageWidget::setupWidgets() +{ + if ( m_widget_created ) + return; + + QVBoxLayout *vLayout = new QVBoxLayout( this ); + vLayout->setMargin( 6 ); + vLayout->setSpacing( 3 ); + + struct uim_custom_group *group + = uim_custom_group_get( m_group_sym.toAscii().constData() ); + if( group == 0 ) + return; + + QLabel *groupLabel = new QLabel( _FU8(group->label), this ); + groupLabel->setAlignment( Qt::AlignLeft ); + vLayout->addWidget( groupLabel ); + + KSeparator *separator = new KSeparator( this ); + vLayout->addWidget( separator ); + + /* default QVGroupBox */ + QGroupBox *defaultGroupVBox = new QGroupBox( this ); + vLayout->addWidget( defaultGroupVBox ); + defaultGroupVBox->hide(); +#if 0 + SubgroupData *sd = new SubgroupData( this, group_name ); + + /* add various widgets to the vbox */ + char **custom_syms = uim_custom_collect_by_group( group_name ); + if( custom_syms ) + { + for( char **custom_sym = custom_syms; *custom_sym; custom_sym++ ) + { + QGroupBox *vbox = sd->searchGroupVBoxByCustomSym( *custom_sym ); + if( vbox == 0 ) + { + vbox = defaultGroupVBox; + vbox->show(); + } + + UimCustomItemIface *iface = addCustom( vbox, *custom_sym ); + if( iface ) + m_customIfaceList.append( iface ); + } + + uim_custom_symbol_list_free( custom_syms ); + } +#else + char **sub_groups + = uim_custom_group_subgroups( m_group_sym.toAscii().constData() ); + char **sgrp; + for( sgrp = sub_groups; *sgrp; sgrp++ ) + { + struct uim_custom_group *sgroup_custom = uim_custom_group_get( *sgrp ); + QGroupBox *vbox; + if( QString::compare( *sgrp, "main" ) == 0 ) + { + vbox = defaultGroupVBox; + vbox->show(); + } + else + { + vbox = new QGroupBox( _FU8(sgroup_custom->label), this ); + vLayout->addWidget( vbox ); + } + QVBoxLayout *layout = new QVBoxLayout; + vbox->setLayout( layout ); + + /* XXX quick hack to use AND expression of groups */ + QString groups( m_group_sym ); + groups += " '"; + groups += *sgrp; + char **custom_syms + = uim_custom_collect_by_group( groups.toAscii().constData() ); + if( !custom_syms ) + continue; + + for( char **custom_sym = custom_syms; *custom_sym; custom_sym++ ) + { + UimCustomItemIface *iface = addCustom( vbox, *custom_sym ); + if( iface ) + m_customIfaceList.append( iface ); + } + uim_custom_symbol_list_free( custom_syms ); + + + uim_custom_group_free( sgroup_custom ); + } + uim_custom_symbol_list_free( sub_groups ); +#endif + + /* free */ + //delete sd; + uim_custom_group_free( group ); + + /* bottom up */ + vLayout->addStretch(); + + setLayout( vLayout ); + + m_widget_created = true; +} + +/* + * Building up GUI in accordance with Custom Type. + */ +UimCustomItemIface *GroupPageWidget::addCustom( QGroupBox *vbox, const char *custom_sym ) +{ + UimCustomItemIface *w = 0; + struct uim_custom *custom = uim_custom_get( custom_sym ); + if( custom ) + { + switch( custom->type ) + { + case UCustom_Bool: + w = addCustomTypeBool( vbox, custom ); + break; + case UCustom_Int: + w = addCustomTypeInteger( vbox, custom ); + break; + case UCustom_Str: + w = addCustomTypeString( vbox, custom ); + break; + case UCustom_Pathname: + w = addCustomTypePathname( vbox, custom ); + break; + case UCustom_Choice: + w = addCustomTypeChoice( vbox, custom ); + break; + case UCustom_OrderedList: + w = addCustomTypeOrderedList( vbox, custom ); + break; + case UCustom_Key: + w = addCustomTypeKey( vbox, custom ); + break; + default: + w = 0; + qWarning( "Invalid custom type: %d\n", custom->type ); + uim_custom_free( custom ); + break; + } + } else { + qWarning( "Failed to get uim_custom object for %s.", custom_sym ); + } + + /* custom is freed by UimCustomItemIface's destructor */ + + return w; +} + +UimCustomItemIface *GroupPageWidget::addCustomTypeBool( QGroupBox *vbox, struct uim_custom *custom ) +{ + CustomCheckBox *checkBox = new CustomCheckBox( custom ); + connect( checkBox, SIGNAL(customValueChanged()), + this, SLOT(slotCustomValueChanged()) ); + vbox->layout()->addWidget( checkBox ); + + return checkBox; +} + +UimCustomItemIface *GroupPageWidget::addCustomTypeInteger( QGroupBox *vbox, struct uim_custom *custom ) +{ + QFrame *hbox = new QFrame; + QLabel *label = new QLabel( _FU8(custom->label), hbox ); + CustomSpinBox *spinBox = new CustomSpinBox( custom, hbox ); + label->setBuddy( spinBox ); + connect( spinBox, SIGNAL(customValueChanged()), + this, SLOT(slotCustomValueChanged()) ); + + QHBoxLayout *layout = new QHBoxLayout; + layout->setSpacing( 6 ); + layout->addWidget( label ); + layout->addStretch(); + layout->addWidget( spinBox ); + + hbox->setLayout( layout ); + vbox->layout()->addWidget( hbox ); + + return spinBox; +} + +UimCustomItemIface *GroupPageWidget::addCustomTypeString( QGroupBox *vbox, struct uim_custom *custom ) +{ + QFrame *hbox = new QFrame; + QLabel *label = new QLabel( _FU8(custom->label) + ':', hbox ); + CustomLineEdit *lineEdit = new CustomLineEdit( custom, hbox ); + label->setBuddy( lineEdit ); + connect( lineEdit, SIGNAL(customValueChanged()), + this, SLOT(slotCustomValueChanged()) ); + + QHBoxLayout *layout = new QHBoxLayout; + layout->setSpacing( 6 ); + layout->addWidget( label ); + layout->addWidget( lineEdit ); + + hbox->setLayout( layout ); + vbox->layout()->addWidget( hbox ); + + return lineEdit; +} + +UimCustomItemIface *GroupPageWidget::addCustomTypePathname( QGroupBox *vbox, struct uim_custom *custom ) +{ + QFrame *hbox = new QFrame; + QLabel *label = new QLabel( _FU8(custom->label), hbox ); + CustomPathnameEdit *pathnameEdit = new CustomPathnameEdit( custom, hbox ); + label->setBuddy( pathnameEdit ); + connect( pathnameEdit, SIGNAL(customValueChanged()), + this, SLOT(slotCustomValueChanged()) ); + + QHBoxLayout *layout = new QHBoxLayout; + layout->setSpacing( 6 ); + layout->addWidget( label ); + layout->addWidget( pathnameEdit ); + + hbox->setLayout( layout ); + vbox->layout()->addWidget( hbox ); + + return pathnameEdit; +} + +UimCustomItemIface *GroupPageWidget::addCustomTypeChoice( QGroupBox *vbox, struct uim_custom *custom ) +{ + QFrame *hbox = new QFrame; + QLabel *label = new QLabel( _FU8(custom->label), hbox ); + + CustomChoiceCombo *choiceCombo = new CustomChoiceCombo( custom, hbox ); + label->setBuddy( choiceCombo ); + connect( choiceCombo, SIGNAL(customValueChanged()), + this, SLOT(slotCustomValueChanged()) ); + + QHBoxLayout *layout = new QHBoxLayout; + layout->setSpacing( 6 ); + layout->addWidget( label ); + layout->addWidget( choiceCombo ); + + hbox->setLayout( layout ); + vbox->layout()->addWidget( hbox ); + + return choiceCombo; +} + +UimCustomItemIface *GroupPageWidget::addCustomTypeOrderedList( QGroupBox *vbox, struct uim_custom *custom ) +{ + QFrame *hbox = new QFrame; + QLabel *label = new QLabel( _FU8(custom->label), hbox ); + CustomOrderedListEdit *olistEditBox = new CustomOrderedListEdit( custom, hbox ); + label->setBuddy( olistEditBox ); + connect( olistEditBox, SIGNAL(customValueChanged()), + this, SLOT(slotCustomValueChanged()) ); + + QHBoxLayout *layout = new QHBoxLayout; + layout->setSpacing( 6 ); + layout->addWidget( label ); + layout->addWidget( olistEditBox ); + + hbox->setLayout( layout ); + vbox->layout()->addWidget( hbox ); + + return olistEditBox; +} + +UimCustomItemIface *GroupPageWidget::addCustomTypeKey( QGroupBox *vbox, struct uim_custom *custom ) +{ + QFrame *hbox = new QFrame; + QLabel *label = new QLabel( _FU8(custom->label), hbox ); + CustomKeyEdit *keyEditBox = new CustomKeyEdit( custom, hbox ); + label->setBuddy( keyEditBox ); + connect( keyEditBox, SIGNAL(customValueChanged()), + this, SLOT(slotCustomValueChanged()) ); + + QHBoxLayout *layout = new QHBoxLayout; + layout->setSpacing( 6 ); + layout->addWidget( label ); + layout->addWidget( keyEditBox ); + + hbox->setLayout( layout ); + vbox->layout()->addWidget( hbox ); + + return keyEditBox; +} + +void GroupPageWidget::setDefault() +{ + foreach ( UimCustomItemIface *iface, m_customIfaceList ) + iface->setDefault(); +} + +//-------------------------------------------------------------------------------------- +int main( int argc, char **argv ) +{ + setlocale(LC_ALL, ""); + bindtextdomain(PACKAGE, LOCALEDIR); + textdomain(PACKAGE); + bind_textdomain_codeset(PACKAGE, "UTF-8"); // ensure code encoding is UTF8- + + QApplication a( argc, argv ); + + UimPrefDialog *dlg = new UimPrefDialog(); + dlg->resize( DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT ); + dlg->show(); + + return a.exec(); +} Index: qt4/pref/Makefile.am =================================================================== --- qt4/pref/Makefile.am (revision 0) +++ qt4/pref/Makefile.am (revision 0) @@ -0,0 +1,25 @@ +.PHONY: mocclean FORCE + +# Makefile.qmake is only exist when --enable-pref and --enable-qt4 +if QT4 +if PREF +all clean mocclean install uninstall: + $(MAKE) $(AM_MAKEFLAGS) -f Makefile.qmake INSTALL_ROOT=$(DESTDIR) $@ + +# *.pro is required to run Makefile.qmake. So distclean-am is deferred. +distclean: + $(MAKE) $(AM_MAKEFLAGS) -f Makefile.qmake $@ + $(MAKE) $(AM_MAKEFLAGS) distclean-am + -rm -f Makefile uim-pref-qt4.pro +endif +else +distclean: + -rm -f Makefile uim-pref-qt4.pro +endif + +FORCE: + +EXTRA_DIST = uim-pref-qt4.pro.in \ + customwidgets.h kseparator.h qt4.h \ + keyeditformbase.ui olisteditformbase.ui \ + customwidgets.cpp kseparator.cpp qt4.cpp Index: qt4/pref/olisteditformbase.ui =================================================================== --- qt4/pref/olisteditformbase.ui (revision 0) +++ qt4/pref/olisteditformbase.ui (revision 0) @@ -0,0 +1,115 @@ + + + + + + OListEditFormBase + + + + 0 + 0 + 380 + 200 + + + + + 5 + 5 + 0 + 0 + + + + OListEditBase + + + + + + + + QAbstractItemView::SingleSelection + + + + Available Items + + + false + + + true + + + + + + + + + + Up + + + + + + + Down + + + + + + + + 20 + 140 + + + + QSizePolicy::Expanding + + + Qt::Vertical + + + + + + + OK + + + + + + + Cancel + + + + + + + + + + + + + m_okButton + clicked() + OListEditFormBase + accept() + + + m_cancelButton + clicked() + OListEditFormBase + reject() + + + Index: qt4/pref/kseparator.cpp =================================================================== --- qt4/pref/kseparator.cpp (revision 0) +++ qt4/pref/kseparator.cpp (revision 0) @@ -0,0 +1,112 @@ +/* +* Copyright (C) 1997 Michael Roth +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU Library General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Library General Public License for more details. +* +* You should have received a copy of the GNU Library General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +* +*/ +#include "kseparator.h" + +#include +#include + +KSeparator::KSeparator( QWidget* parent, Qt::WFlags f ) + : QFrame( parent, f ) +{ + setLineWidth( 1 ); + setMidLineWidth( 0 ); + setOrientation( HLine ); +} + + + +KSeparator::KSeparator( int orientation, QWidget* parent, Qt::WFlags f ) + : QFrame( parent, f ) +{ + setLineWidth( 1 ); + setMidLineWidth( 0 ); + setOrientation( orientation ); +} + + + +void KSeparator::setOrientation( int orientation ) +{ + switch ( orientation ) + { + case Qt::Vertical: + case VLine: + setFrameStyle( QFrame::VLine | QFrame::Sunken ); + setMinimumSize( 2, 0 ); + break; + + default: + qDebug( "KSeparator::setOrientation(): invalid orientation, using default orientation HLine" ); + + case Qt::Horizontal: + case HLine: + setFrameStyle( QFrame::HLine | QFrame::Sunken ); + setMinimumSize( 0, 2 ); + break; + } +} + + + +int KSeparator::orientation() const +{ + if ( frameStyle() & VLine ) + return VLine; + + if ( frameStyle() & HLine ) + return HLine; + + return 0; +} + +void KSeparator::drawFrame( QPainter *p ) +{ + QPoint p1, p2; + QRect r = frameRect(); + + if ( frameStyle() & HLine ) + { + p1 = QPoint( r.x(), r.height() / 2 ); + p2 = QPoint( r.x() + r.width(), p1.y() ); + } + else + { + p1 = QPoint( r.x() + r.width() / 2, 0 ); + p2 = QPoint( p1.x(), r.height() ); + } + + QStyleOption opt( lineWidth(), midLineWidth() ); + opt.state = QStyle::State_Sunken; + style()->drawPrimitive( QStyle::PE_IndicatorToolBarSeparator, &opt, p ); +} + + +QSize KSeparator::sizeHint() const +{ + if ( frameStyle() & VLine ) + return QSize( 2, 0 ); + + if ( frameStyle() & HLine ) + return QSize( 0, 2 ); + + return QSize( -1, -1 ); +} + +void KSeparator::virtual_hook( int, void* ) +{ /*BASE::virtual_hook( id, data );*/ } Index: qt4/pref/qt4.h =================================================================== --- qt4/pref/qt4.h (revision 0) +++ qt4/pref/qt4.h (revision 0) @@ -0,0 +1,141 @@ +/* + + Copyright (c) 2003-2009 uim Project http://code.google.com/p/uim/ + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of authors nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +*/ +#ifndef UIM_QT4_PREF_QT_H +#define UIM_QT4_PREF_QT_H + +#include +#include +#include + +#include +#include + +class QGroupBox; +class QPushButton; +class QStackedWidget; +class QTreeWidget; +class QTreeWidgetItem; +class QScrollArea; + +class UimCustomItemIface; + +class UimPrefDialog : public QDialog +{ + Q_OBJECT + +public: + explicit UimPrefDialog( QWidget *parent = 0 ); + ~UimPrefDialog(); + +protected: + void checkDotUimFile(); + + void setupWidgets(); + void createMainWidgets(); + void createGroupWidgets(); + + void confirmChange(); + void confirmQuit(); + +protected slots: + void slotSetDefault(); + void slotApply(); + void slotOK(); + void slotCancel(); + + void slotItemSelectionChanged(); + void slotCustomValueChanged(); + +private: + bool m_isValueChanged; + + QHash m_groupWidgetsDict; + QString m_currentPageName; + + QTreeWidget *m_groupListView; + QStackedWidget *m_groupWidgetStack; + QScrollArea *m_rightSideWidget; + + QPushButton *m_applyButton; +}; + +//--------------------------------------------------------------------------------- +class QConfirmDialog : public QDialog { + Q_OBJECT + +public: + QConfirmDialog( const QString &msg, const QString &confname, QWidget *parent ); + +protected: + void setupWidgets( const QString& msg ); + +protected slots: + void showOnStart( bool isShowOnStart ); + +protected: + QString m_confname; +}; + +//--------------------------------------------------------------------------------- +class GroupPageWidget : public QWidget { + Q_OBJECT + +public: + GroupPageWidget( QWidget *parent, const char *group_name ); + + void setDefault(); + void setupWidgets(); + +protected: + + UimCustomItemIface *addCustom( QGroupBox *vbox, const char *custom_sym ); + UimCustomItemIface *addCustomTypeBool( QGroupBox *vbox, struct uim_custom *custom ); + UimCustomItemIface *addCustomTypeInteger( QGroupBox *vbox, struct uim_custom *custom ); + UimCustomItemIface *addCustomTypeString( QGroupBox *vbox, struct uim_custom *custom ); + UimCustomItemIface *addCustomTypePathname( QGroupBox *vbox, struct uim_custom *custom ); + UimCustomItemIface *addCustomTypeChoice( QGroupBox *vbox, struct uim_custom *custom ); + UimCustomItemIface *addCustomTypeOrderedList( QGroupBox *vbox, struct uim_custom *custom ); + UimCustomItemIface *addCustomTypeKey( QGroupBox *vbox, struct uim_custom *custom ); + +protected slots: + void slotCustomValueChanged(){ emit customValueChanged(); } +signals: + void customValueChanged(); + +protected: + QList m_customIfaceList; + QString m_group_sym; + bool m_widget_created; +}; + +#endif /* Not def: UIM_QT4_PREF_QT_H */ Index: qt4/pref/uim-pref-qt4.pro.in =================================================================== --- qt4/pref/uim-pref-qt4.pro.in (revision 0) +++ qt4/pref/uim-pref-qt4.pro.in (revision 0) @@ -0,0 +1,23 @@ +TEMPLATE = app +CONFIG += @QT_CONFIG_OPTS@ + +INCLUDEPATH += @abs_top_builddir@ @abs_top_builddir@/uim \ + @abs_top_builddir@/replace .. +QMAKE_LIBDIR += @abs_top_builddir@/uim +QMAKE_LIBDIR += @abs_top_builddir@/replace +LIBS += -lreplace -luim -luim-scm -luim-x-util -luim-custom -luim-counted-init + +QMAKE_CFLAGS_DEBUG += @CFLAGS@ @X_CFLAGS@ +QMAKE_CFLAGS_RELEASE += @CFLAGS@ @X_CFLAGS@ +QMAKE_CXXFLAGS_DEBUG += @CXXFLAGS@ @X_CFLAGS@ +QMAKE_CXXFLAGS_RELEASE += @CXXFLAGS@ @X_CFLAGS@ + +# Input +HEADERS += customwidgets.h kseparator.h qt4.h +FORMS += keyeditformbase.ui olisteditformbase.ui +SOURCES += customwidgets.cpp kseparator.cpp qt4.cpp + +TARGET = uim-pref-qt4 + +target.path += @DESTDIR@@exec_prefix@/bin +INSTALLS += target Index: autogen.sh =================================================================== --- autogen.sh (revision 6006) +++ autogen.sh (working copy) @@ -1,5 +1,20 @@ #!/bin/sh +generate_makefile_in_in() { + cp po/Makefile.in.in $1 \ + && perl -i -pe 's/check: all.*$/check: all/' $1/Makefile.in.in \ + && ed $1/Makefile.in.in <