Imported Upstream version 0.1.1
Aron Xu
10 years ago
20 | 20 | find_package(Fcitx 4.2.3 REQUIRED) |
21 | 21 | find_package(Libiconv REQUIRED) |
22 | 22 | find_package(Gettext REQUIRED) |
23 | find_package(Qt4) | |
23 | 24 | |
24 | 25 | configure_file(config.h.in config.h) |
25 | 26 | |
27 | add_subdirectory(unikey) | |
26 | 28 | add_subdirectory(src) |
27 | 29 | add_subdirectory(data) |
28 | add_subdirectory(po)⏎ | |
30 | add_subdirectory(po) | |
31 | ||
32 | if (QT_FOUND) | |
33 | add_subdirectory(macro-editor) | |
34 | endif(QT_FOUND)⏎ |
0 | Unikey (Vietnamese Input Method) engine support for Fcitx | |
1 | ||
2 | Released under GPLv3+ | |
3 | ||
4 | Install: | |
5 | $ mkdir build && cd build | |
6 | $ cmake -DCMAKE_INSTALL_PREFIX=`fcitx4-config --prefix` .. | |
7 | $ make | |
8 | # make install |
6 | 6 | Library=fcitx-unikey.so |
7 | 7 | Type=SharedLibrary |
8 | 8 | IMRegisterMethod=ConfigFile |
9 | SubConfig=Macro:program:fcitx-unikey-macro-editor,fcitx-unikey:domain⏎ |
0 | include_directories( | |
1 | ${QT_QTCORE_INCLUDE_DIR} | |
2 | ${QT_QTGUI_INCLUDE_DIR} | |
3 | ${CMAKE_CURRENT_BINARY_DIR} | |
4 | ${PROJECT_SOURCE_DIR}/unikey | |
5 | ) | |
6 | ||
7 | link_directories( | |
8 | ${FCITX4_FCITX_UTILS_LIBRARY_DIRS} | |
9 | ${FCITX4_FCITX_CONFIG_LIBRARY_DIRS} | |
10 | ) | |
11 | ||
12 | set(MACRO_EDITOR_SRCS | |
13 | model.cpp | |
14 | main.cpp | |
15 | editor.cpp | |
16 | dialog.cpp | |
17 | ) | |
18 | set(MACRO_EDITOR_HDRS | |
19 | model.h | |
20 | editor.h | |
21 | dialog.h | |
22 | ) | |
23 | qt4_wrap_cpp(MACRO_EDITOR_MOCS ${MACRO_EDITOR_HDRS}) | |
24 | qt4_wrap_ui(MACRO_EDITOR_SRCS editor.ui dialog.ui) | |
25 | add_executable(fcitx-unikey-macro-editor ${MACRO_EDITOR_SRCS} ${MACRO_EDITOR_MOCS}) | |
26 | target_link_libraries(fcitx-unikey-macro-editor | |
27 | debug ${QT_QTCORE_LIBRARY_DEBUG} | |
28 | debug ${QT_QTDBUS_LIBRARY_DEBUG} | |
29 | debug ${QT_QTGUI_LIBRARY_DEBUG} | |
30 | optimized ${QT_QTCORE_LIBRARY_RELEASE} | |
31 | optimized ${QT_QTDBUS_LIBRARY_RELEASE} | |
32 | optimized ${QT_QTGUI_LIBRARY_RELEASE} | |
33 | unikey | |
34 | ${FCITX4_FCITX_UTILS_LIBRARIES} | |
35 | ${FCITX4_FCITX_CONFIG_LIBRARIES} | |
36 | ) | |
37 | ||
38 | install(TARGETS fcitx-unikey-macro-editor DESTINATION ${FCITX4_PREFIX}/bin)⏎ |
0 | /*************************************************************************** | |
1 | * Copyright (C) 2012~2012 by CSSlayer * | |
2 | * wengxt@gmail.com * | |
3 | * * | |
4 | * This program is free software: you can redistribute it and/or modify * | |
5 | * it under the terms of the GNU General Public License as published by * | |
6 | * the Free Software Foundation, either version 3 of the License, or * | |
7 | * (at your option) any later version. * | |
8 | * * | |
9 | * This program is distributed in the hope that it will be useful, * | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | |
12 | * GNU General Public License for more details. * | |
13 | * * | |
14 | * You should have received a copy of the GNU General Public License * | |
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. * | |
16 | * * | |
17 | ***************************************************************************/ | |
18 | ||
19 | #ifndef _FCITX_UNIKEY_COMMON_H | |
20 | #define _FCITX_UNIKEY_COMMON_H | |
21 | ||
22 | #include <libintl.h> | |
23 | ||
24 | #define _(x) QString::fromUtf8(gettext(x)) | |
25 | ||
26 | #endif // _FCITX_UNIKEY_COMMON_H⏎ |
0 | /*************************************************************************** | |
1 | * Copyright (C) 2012~2012 by CSSlayer * | |
2 | * wengxt@gmail.com * | |
3 | * * | |
4 | * This program is free software: you can redistribute it and/or modify * | |
5 | * it under the terms of the GNU General Public License as published by * | |
6 | * the Free Software Foundation, either version 3 of the License, or * | |
7 | * (at your option) any later version. * | |
8 | * * | |
9 | * This program is distributed in the hope that it will be useful, * | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | |
12 | * GNU General Public License for more details. * | |
13 | * * | |
14 | * You should have received a copy of the GNU General Public License * | |
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. * | |
16 | * * | |
17 | ***************************************************************************/ | |
18 | ||
19 | #include "ui_dialog.h" | |
20 | #include "dialog.h" | |
21 | ||
22 | namespace fcitx_unikey { | |
23 | MacroDialog::MacroDialog(QWidget* parent): QDialog(parent), | |
24 | m_ui(new Ui::Dialog) | |
25 | { | |
26 | m_ui->setupUi(this); | |
27 | } | |
28 | ||
29 | MacroDialog::~MacroDialog() | |
30 | { | |
31 | delete m_ui; | |
32 | } | |
33 | ||
34 | QString MacroDialog::macro() const | |
35 | { | |
36 | return m_ui->macroLineEdit->text(); | |
37 | } | |
38 | ||
39 | QString MacroDialog::word() const | |
40 | { | |
41 | return m_ui->wordLineEdit->text(); | |
42 | } | |
43 | ||
44 | ||
45 | }⏎ |
0 | /*************************************************************************** | |
1 | * Copyright (C) 2012~2012 by CSSlayer * | |
2 | * wengxt@gmail.com * | |
3 | * * | |
4 | * This program is free software: you can redistribute it and/or modify * | |
5 | * it under the terms of the GNU General Public License as published by * | |
6 | * the Free Software Foundation, either version 3 of the License, or * | |
7 | * (at your option) any later version. * | |
8 | * * | |
9 | * This program is distributed in the hope that it will be useful, * | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | |
12 | * GNU General Public License for more details. * | |
13 | * * | |
14 | * You should have received a copy of the GNU General Public License * | |
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. * | |
16 | * * | |
17 | ***************************************************************************/ | |
18 | ||
19 | #include <QDialog> | |
20 | ||
21 | class CMacroTable; | |
22 | namespace Ui { | |
23 | class Dialog; | |
24 | } | |
25 | ||
26 | namespace fcitx_unikey { | |
27 | class MacroDialog : public QDialog { | |
28 | Q_OBJECT | |
29 | public: | |
30 | explicit MacroDialog(QWidget* parent = 0); | |
31 | virtual ~MacroDialog(); | |
32 | QString macro() const; | |
33 | QString word() const; | |
34 | ||
35 | private: | |
36 | Ui::Dialog* m_ui; | |
37 | }; | |
38 | }⏎ |
0 | <?xml version="1.0" encoding="UTF-8"?> | |
1 | <ui version="4.0"> | |
2 | <class>Dialog</class> | |
3 | <widget class="QDialog" name="Dialog"> | |
4 | <property name="geometry"> | |
5 | <rect> | |
6 | <x>0</x> | |
7 | <y>0</y> | |
8 | <width>334</width> | |
9 | <height>91</height> | |
10 | </rect> | |
11 | </property> | |
12 | <property name="windowTitle"> | |
13 | <string>Dialog</string> | |
14 | </property> | |
15 | <layout class="QVBoxLayout" name="verticalLayout"> | |
16 | <item> | |
17 | <layout class="QFormLayout" name="formLayout"> | |
18 | <item row="1" column="1"> | |
19 | <widget class="QLineEdit" name="wordLineEdit"/> | |
20 | </item> | |
21 | <item row="1" column="0"> | |
22 | <widget class="QLabel" name="label"> | |
23 | <property name="text"> | |
24 | <string>Word:</string> | |
25 | </property> | |
26 | </widget> | |
27 | </item> | |
28 | <item row="0" column="0"> | |
29 | <widget class="QLabel" name="label_2"> | |
30 | <property name="text"> | |
31 | <string>Macro:</string> | |
32 | </property> | |
33 | </widget> | |
34 | </item> | |
35 | <item row="0" column="1"> | |
36 | <widget class="QLineEdit" name="macroLineEdit"/> | |
37 | </item> | |
38 | </layout> | |
39 | </item> | |
40 | <item> | |
41 | <widget class="QDialogButtonBox" name="buttonBox"> | |
42 | <property name="orientation"> | |
43 | <enum>Qt::Horizontal</enum> | |
44 | </property> | |
45 | <property name="standardButtons"> | |
46 | <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> | |
47 | </property> | |
48 | </widget> | |
49 | </item> | |
50 | </layout> | |
51 | </widget> | |
52 | <tabstops> | |
53 | <tabstop>macroLineEdit</tabstop> | |
54 | <tabstop>wordLineEdit</tabstop> | |
55 | <tabstop>buttonBox</tabstop> | |
56 | </tabstops> | |
57 | <resources/> | |
58 | <connections> | |
59 | <connection> | |
60 | <sender>buttonBox</sender> | |
61 | <signal>accepted()</signal> | |
62 | <receiver>Dialog</receiver> | |
63 | <slot>accept()</slot> | |
64 | <hints> | |
65 | <hint type="sourcelabel"> | |
66 | <x>248</x> | |
67 | <y>254</y> | |
68 | </hint> | |
69 | <hint type="destinationlabel"> | |
70 | <x>157</x> | |
71 | <y>274</y> | |
72 | </hint> | |
73 | </hints> | |
74 | </connection> | |
75 | <connection> | |
76 | <sender>buttonBox</sender> | |
77 | <signal>rejected()</signal> | |
78 | <receiver>Dialog</receiver> | |
79 | <slot>reject()</slot> | |
80 | <hints> | |
81 | <hint type="sourcelabel"> | |
82 | <x>316</x> | |
83 | <y>260</y> | |
84 | </hint> | |
85 | <hint type="destinationlabel"> | |
86 | <x>286</x> | |
87 | <y>274</y> | |
88 | </hint> | |
89 | </hints> | |
90 | </connection> | |
91 | </connections> | |
92 | </ui> |
0 | /*************************************************************************** | |
1 | * Copyright (C) 2012~2012 by CSSlayer * | |
2 | * wengxt@gmail.com * | |
3 | * * | |
4 | * This program is free software: you can redistribute it and/or modify * | |
5 | * it under the terms of the GNU General Public License as published by * | |
6 | * the Free Software Foundation, either version 3 of the License, or * | |
7 | * (at your option) any later version. * | |
8 | * * | |
9 | * This program is distributed in the hope that it will be useful, * | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | |
12 | * GNU General Public License for more details. * | |
13 | * * | |
14 | * You should have received a copy of the GNU General Public License * | |
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. * | |
16 | * * | |
17 | ***************************************************************************/ | |
18 | ||
19 | #include <libintl.h> | |
20 | #include <fcitx-config/xdg.h> | |
21 | ||
22 | #include <QFileDialog> | |
23 | #include <QMessageBox> | |
24 | #include <QCloseEvent> | |
25 | #include <QDebug> | |
26 | ||
27 | #include "editor.h" | |
28 | #include "model.h" | |
29 | #include "dialog.h" | |
30 | #include "mactab.h" | |
31 | #include "ui_editor.h" | |
32 | #include "common.h" | |
33 | ||
34 | namespace fcitx_unikey { | |
35 | ||
36 | MacroEditor::MacroEditor(QWidget* parent): QMainWindow(parent) | |
37 | ,m_ui(new Ui::Editor) | |
38 | { | |
39 | m_ui->setupUi(this); | |
40 | m_ui->addButton->setText(_("&Add")); | |
41 | m_ui->deleteButton->setText(_("&Delete")); | |
42 | m_ui->clearButton->setText(_("De&lete All")); | |
43 | m_ui->exitButton->setText(_("&Quit")); | |
44 | m_ui->saveButton->setText(_("&Save")); | |
45 | m_ui->importButton->setText(_("&Import")); | |
46 | m_ui->exportButton->setText(_("&Export")); | |
47 | m_ui->macroTableView->setSelectionMode(QAbstractItemView::SingleSelection); | |
48 | m_ui->macroTableView->setSelectionBehavior(QAbstractItemView::SelectRows); | |
49 | setWindowTitle(_("Unikey Macro Editor")); | |
50 | ||
51 | connect(m_ui->addButton, SIGNAL(clicked(bool)), this, SLOT(addWord())); | |
52 | connect(m_ui->deleteButton, SIGNAL(clicked(bool)), this, SLOT(deleteWord())); | |
53 | connect(m_ui->clearButton, SIGNAL(clicked(bool)), this, SLOT(deleteAllWord())); | |
54 | connect(m_ui->importButton, SIGNAL(clicked(bool)), this, SLOT(importMacro())); | |
55 | connect(m_ui->exportButton, SIGNAL(clicked(bool)), this, SLOT(exportMacro())); | |
56 | connect(m_ui->exitButton, SIGNAL(clicked(bool)), this, SLOT(aboutToQuit())); | |
57 | connect(m_ui->saveButton, SIGNAL(clicked(bool)), this, SLOT(saveMacro())); | |
58 | ||
59 | load(); | |
60 | itemFocusChanged(); | |
61 | } | |
62 | ||
63 | MacroEditor::~MacroEditor() | |
64 | { | |
65 | delete m_ui; | |
66 | } | |
67 | ||
68 | void MacroEditor::aboutToQuit() | |
69 | { | |
70 | if (!m_model->needSave()) | |
71 | qApp->quit(); | |
72 | else { | |
73 | QMessageBox* dialog = new QMessageBox(this); | |
74 | dialog->setIcon(QMessageBox::Warning); | |
75 | dialog->setWindowTitle(_("Quit Macro Editor")); | |
76 | dialog->setText(_("Macro table still contains unsaved changes. Do you want to save?")); | |
77 | dialog->setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); | |
78 | dialog->setDefaultButton(QMessageBox::Save); | |
79 | dialog->setAttribute(Qt::WA_DeleteOnClose, true); | |
80 | dialog->open(); | |
81 | connect(dialog, SIGNAL(finished(int)), this, SLOT(quitConfirmDone(int))); | |
82 | } | |
83 | } | |
84 | ||
85 | void MacroEditor::quitConfirmDone(int result) | |
86 | { | |
87 | switch(result) { | |
88 | case QMessageBox::Save: | |
89 | saveMacro(); | |
90 | case QMessageBox::Discard: | |
91 | qApp->quit(); | |
92 | break; | |
93 | } | |
94 | } | |
95 | ||
96 | void MacroEditor::closeEvent(QCloseEvent* event) | |
97 | { | |
98 | if (m_model->needSave()) { | |
99 | event->ignore(); | |
100 | ||
101 | QMessageBox* dialog = new QMessageBox(this); | |
102 | dialog->setIcon(QMessageBox::Warning); | |
103 | dialog->setWindowTitle(_("Quit Macro Editor")); | |
104 | dialog->setText(_("Macro table still contains unsaved changes. Do you want to save?")); | |
105 | dialog->setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); | |
106 | dialog->setDefaultButton(QMessageBox::Save); | |
107 | dialog->setAttribute(Qt::WA_DeleteOnClose, true); | |
108 | dialog->open(); | |
109 | connect(dialog, SIGNAL(finished(int)), this, SLOT(quitConfirmDone(int))); | |
110 | } | |
111 | else { | |
112 | event->accept(); | |
113 | qApp->quit(); | |
114 | } | |
115 | } | |
116 | ||
117 | ||
118 | void MacroEditor::itemFocusChanged() | |
119 | { | |
120 | m_ui->deleteButton->setEnabled(m_ui->macroTableView->currentIndex().isValid()); | |
121 | } | |
122 | ||
123 | void MacroEditor::deleteWord() | |
124 | { | |
125 | if (!m_ui->macroTableView->currentIndex().isValid()) | |
126 | return; | |
127 | int row = m_ui->macroTableView->currentIndex().row(); | |
128 | m_model->deleteItem(row); | |
129 | } | |
130 | ||
131 | void MacroEditor::deleteAllWord() | |
132 | { | |
133 | m_model->deleteAllItem(); | |
134 | } | |
135 | ||
136 | void MacroEditor::addWord() | |
137 | { | |
138 | MacroDialog* dialog = new MacroDialog(this); | |
139 | dialog->setAttribute(Qt::WA_DeleteOnClose, true); | |
140 | dialog->open(); | |
141 | connect(dialog, SIGNAL(accepted()), this, SLOT(addWordAccepted())); | |
142 | } | |
143 | ||
144 | QString MacroEditor::getData(CMacroTable* table, int i, bool iskey) { | |
145 | ||
146 | char key[MAX_MACRO_KEY_LEN*3]; | |
147 | char value[MAX_MACRO_TEXT_LEN*3]; | |
148 | do { | |
149 | if (i < table->getCount()) { | |
150 | const StdVnChar* p = NULL; | |
151 | int maxOutLen = 0; | |
152 | const char* result = NULL; | |
153 | if (iskey) { | |
154 | p = table->getKey(i); | |
155 | maxOutLen = sizeof(key); | |
156 | result = key; | |
157 | } else { | |
158 | p = table->getText(i); | |
159 | maxOutLen = sizeof(value); | |
160 | result = value; | |
161 | } | |
162 | ||
163 | if (!p) | |
164 | break; | |
165 | int inLen = -1; | |
166 | int ret = VnConvert(CONV_CHARSET_VNSTANDARD, CONV_CHARSET_XUTF8, | |
167 | (UKBYTE*) p, (UKBYTE*)result, | |
168 | &inLen, &maxOutLen); | |
169 | if (ret != 0) | |
170 | break; | |
171 | return QString::fromUtf8(result); | |
172 | } | |
173 | } while(0); | |
174 | return QString(); | |
175 | } | |
176 | ||
177 | void MacroEditor::addWordAccepted() | |
178 | { | |
179 | const MacroDialog* dialog = qobject_cast< const MacroDialog* >(QObject::sender()); | |
180 | ||
181 | m_model->addItem(dialog->macro(), dialog->word()); | |
182 | } | |
183 | ||
184 | void MacroEditor::load() | |
185 | { | |
186 | m_table = new CMacroTable; | |
187 | m_table->init(); | |
188 | char* fileName; | |
189 | FcitxXDGGetFileUserWithPrefix("unikey", "macro", NULL, &fileName); | |
190 | m_table->loadFromFile(fileName); | |
191 | free(fileName); | |
192 | m_model = new MacroModel(this); | |
193 | m_model->load(m_table); | |
194 | m_ui->macroTableView->horizontalHeader()->setStretchLastSection(true); | |
195 | m_ui->macroTableView->verticalHeader()->setVisible(false); | |
196 | m_ui->macroTableView->setModel(m_model); | |
197 | connect(m_ui->macroTableView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(itemFocusChanged())); | |
198 | connect(m_model, SIGNAL(needSaveChanged(bool)), this, SLOT(needSaveChanged(bool))); | |
199 | ||
200 | } | |
201 | ||
202 | void MacroEditor::needSaveChanged(bool needSave) | |
203 | { | |
204 | m_ui->saveButton->setEnabled(needSave); | |
205 | } | |
206 | ||
207 | ||
208 | void MacroEditor::saveMacro() | |
209 | { | |
210 | m_model->save(m_table); | |
211 | FILE* f = FcitxXDGGetFileUserWithPrefix("unikey", "macro", "w", NULL); | |
212 | m_table->writeToFp(f); | |
213 | } | |
214 | ||
215 | void MacroEditor::importMacro() | |
216 | { | |
217 | QFileDialog* dialog = new QFileDialog(this); | |
218 | dialog->setAttribute(Qt::WA_DeleteOnClose, true); | |
219 | dialog->setFileMode(QFileDialog::ExistingFile); | |
220 | dialog->setAcceptMode(QFileDialog::AcceptOpen); | |
221 | dialog->open(); | |
222 | connect(dialog, SIGNAL(accepted()), this, SLOT(importFileSelected())); | |
223 | } | |
224 | ||
225 | void MacroEditor::importFileSelected() | |
226 | { | |
227 | const QFileDialog* dialog = qobject_cast< const QFileDialog* >(QObject::sender()); | |
228 | qDebug() << dialog->selectedFiles(); | |
229 | } | |
230 | ||
231 | void MacroEditor::exportMacro() | |
232 | { | |
233 | QFileDialog* dialog = new QFileDialog(this); | |
234 | dialog->setAttribute(Qt::WA_DeleteOnClose, true); | |
235 | dialog->setDirectory("macro"); | |
236 | dialog->setAcceptMode(QFileDialog::AcceptSave); | |
237 | dialog->open(); | |
238 | connect(dialog, SIGNAL(accepted()), this, SLOT(exportFileSelected())); | |
239 | } | |
240 | ||
241 | void MacroEditor::exportFileSelected() | |
242 | { | |
243 | const QFileDialog* dialog = qobject_cast< const QFileDialog* >(QObject::sender()); | |
244 | if (dialog->selectedFiles().length() <= 0) | |
245 | return; | |
246 | QString file = dialog->selectedFiles()[0]; | |
247 | m_table->writeToFile(file.toUtf8().data()); | |
248 | } | |
249 | ||
250 | ||
251 | ||
252 | ||
253 | }⏎ |
0 | /*************************************************************************** | |
1 | * Copyright (C) 2012~2012 by CSSlayer * | |
2 | * wengxt@gmail.com * | |
3 | * * | |
4 | * This program is free software: you can redistribute it and/or modify * | |
5 | * it under the terms of the GNU General Public License as published by * | |
6 | * the Free Software Foundation, either version 3 of the License, or * | |
7 | * (at your option) any later version. * | |
8 | * * | |
9 | * This program is distributed in the hope that it will be useful, * | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | |
12 | * GNU General Public License for more details. * | |
13 | * * | |
14 | * You should have received a copy of the GNU General Public License * | |
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. * | |
16 | * * | |
17 | ***************************************************************************/ | |
18 | ||
19 | #include <QMainWindow> | |
20 | ||
21 | class CMacroTable; | |
22 | namespace Ui { | |
23 | class Editor; | |
24 | } | |
25 | ||
26 | namespace fcitx_unikey { | |
27 | ||
28 | class MacroModel; | |
29 | class MacroEditor : public QMainWindow { | |
30 | Q_OBJECT | |
31 | public: | |
32 | explicit MacroEditor(QWidget* parent = 0); | |
33 | virtual ~MacroEditor(); | |
34 | static QString getData(CMacroTable* table, int i, bool iskey); | |
35 | protected: | |
36 | virtual void closeEvent(QCloseEvent* event ); | |
37 | private slots: | |
38 | void addWord(); | |
39 | void deleteWord(); | |
40 | void deleteAllWord(); | |
41 | void itemFocusChanged(); | |
42 | void aboutToQuit(); | |
43 | void saveMacro(); | |
44 | void load(); | |
45 | void addWordAccepted(); | |
46 | void importMacro(); | |
47 | void exportMacro(); | |
48 | void importFileSelected(); | |
49 | void exportFileSelected(); | |
50 | void needSaveChanged(bool needSave); | |
51 | void quitConfirmDone(int result); | |
52 | private: | |
53 | Ui::Editor* m_ui; | |
54 | CMacroTable* m_table; | |
55 | MacroModel* m_model; | |
56 | }; | |
57 | }⏎ |
0 | <?xml version="1.0" encoding="UTF-8"?> | |
1 | <ui version="4.0"> | |
2 | <class>Editor</class> | |
3 | <widget class="QMainWindow" name="Editor"> | |
4 | <property name="geometry"> | |
5 | <rect> | |
6 | <x>0</x> | |
7 | <y>0</y> | |
8 | <width>375</width> | |
9 | <height>366</height> | |
10 | </rect> | |
11 | </property> | |
12 | <property name="windowTitle"> | |
13 | <string>MainWindow</string> | |
14 | </property> | |
15 | <property name="windowIcon"> | |
16 | <iconset theme="fcitx-unikey"/> | |
17 | </property> | |
18 | <widget class="QWidget" name="centralwidget"> | |
19 | <layout class="QHBoxLayout" name="horizontalLayout"> | |
20 | <item> | |
21 | <widget class="QTableView" name="macroTableView"/> | |
22 | </item> | |
23 | <item> | |
24 | <layout class="QVBoxLayout" name="verticalLayout"> | |
25 | <item> | |
26 | <widget class="QPushButton" name="addButton"> | |
27 | <property name="text"> | |
28 | <string/> | |
29 | </property> | |
30 | <property name="icon"> | |
31 | <iconset theme="list-add"> | |
32 | <normaloff/> | |
33 | </iconset> | |
34 | </property> | |
35 | </widget> | |
36 | </item> | |
37 | <item> | |
38 | <widget class="QPushButton" name="deleteButton"> | |
39 | <property name="text"> | |
40 | <string/> | |
41 | </property> | |
42 | <property name="icon"> | |
43 | <iconset theme="list-remove"> | |
44 | <normaloff/> | |
45 | </iconset> | |
46 | </property> | |
47 | </widget> | |
48 | </item> | |
49 | <item> | |
50 | <widget class="QPushButton" name="clearButton"> | |
51 | <property name="text"> | |
52 | <string/> | |
53 | </property> | |
54 | <property name="icon"> | |
55 | <iconset theme="edit-delete"> | |
56 | <normaloff/> | |
57 | </iconset> | |
58 | </property> | |
59 | </widget> | |
60 | </item> | |
61 | <item> | |
62 | <widget class="Line" name="line"> | |
63 | <property name="orientation"> | |
64 | <enum>Qt::Horizontal</enum> | |
65 | </property> | |
66 | </widget> | |
67 | </item> | |
68 | <item> | |
69 | <widget class="QPushButton" name="importButton"> | |
70 | <property name="text"> | |
71 | <string/> | |
72 | </property> | |
73 | <property name="icon"> | |
74 | <iconset theme="document-import"> | |
75 | <normaloff/> | |
76 | </iconset> | |
77 | </property> | |
78 | </widget> | |
79 | </item> | |
80 | <item> | |
81 | <widget class="QPushButton" name="exportButton"> | |
82 | <property name="text"> | |
83 | <string/> | |
84 | </property> | |
85 | <property name="icon"> | |
86 | <iconset theme="document-export"> | |
87 | <normaloff/> | |
88 | </iconset> | |
89 | </property> | |
90 | </widget> | |
91 | </item> | |
92 | <item> | |
93 | <widget class="Line" name="line_2"> | |
94 | <property name="orientation"> | |
95 | <enum>Qt::Horizontal</enum> | |
96 | </property> | |
97 | </widget> | |
98 | </item> | |
99 | <item> | |
100 | <widget class="QPushButton" name="saveButton"> | |
101 | <property name="enabled"> | |
102 | <bool>false</bool> | |
103 | </property> | |
104 | <property name="text"> | |
105 | <string/> | |
106 | </property> | |
107 | <property name="icon"> | |
108 | <iconset theme="document-save"> | |
109 | <normaloff/> | |
110 | </iconset> | |
111 | </property> | |
112 | </widget> | |
113 | </item> | |
114 | <item> | |
115 | <widget class="QPushButton" name="exitButton"> | |
116 | <property name="text"> | |
117 | <string/> | |
118 | </property> | |
119 | <property name="icon"> | |
120 | <iconset theme="application-exit"> | |
121 | <normaloff/> | |
122 | </iconset> | |
123 | </property> | |
124 | </widget> | |
125 | </item> | |
126 | <item> | |
127 | <spacer name="verticalSpacer"> | |
128 | <property name="orientation"> | |
129 | <enum>Qt::Vertical</enum> | |
130 | </property> | |
131 | <property name="sizeHint" stdset="0"> | |
132 | <size> | |
133 | <width>20</width> | |
134 | <height>40</height> | |
135 | </size> | |
136 | </property> | |
137 | </spacer> | |
138 | </item> | |
139 | </layout> | |
140 | </item> | |
141 | </layout> | |
142 | </widget> | |
143 | </widget> | |
144 | <resources/> | |
145 | <connections/> | |
146 | </ui> |
0 | /*************************************************************************** | |
1 | * Copyright (C) 2012~2012 by CSSlayer * | |
2 | * wengxt@gmail.com * | |
3 | * * | |
4 | * This program is free software: you can redistribute it and/or modify * | |
5 | * it under the terms of the GNU General Public License as published by * | |
6 | * the Free Software Foundation, either version 3 of the License, or * | |
7 | * (at your option) any later version. * | |
8 | * * | |
9 | * This program is distributed in the hope that it will be useful, * | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | |
12 | * GNU General Public License for more details. * | |
13 | * * | |
14 | * You should have received a copy of the GNU General Public License * | |
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. * | |
16 | * * | |
17 | ***************************************************************************/ | |
18 | ||
19 | #include <QApplication> | |
20 | #include <libintl.h> | |
21 | #include <fcitx-utils/utils.h> | |
22 | #include "editor.h" | |
23 | int main(int argc, char* argv[]) | |
24 | { | |
25 | setlocale(LC_ALL, ""); | |
26 | char* path = fcitx_utils_get_fcitx_path("localedir"); | |
27 | bindtextdomain("fcitx-unikey", path); | |
28 | free(path); | |
29 | bind_textdomain_codeset("fcitx-unikey", "UTF-8"); | |
30 | textdomain("fcitx-unikey"); | |
31 | ||
32 | QApplication app(argc, argv); | |
33 | fcitx_unikey::MacroEditor window; | |
34 | window.show(); | |
35 | return app.exec(); | |
36 | }⏎ |
0 | /*************************************************************************** | |
1 | * Copyright (C) 2012~2012 by CSSlayer * | |
2 | * wengxt@gmail.com * | |
3 | * * | |
4 | * This program is free software: you can redistribute it and/or modify * | |
5 | * it under the terms of the GNU General Public License as published by * | |
6 | * the Free Software Foundation, either version 3 of the License, or * | |
7 | * (at your option) any later version. * | |
8 | * * | |
9 | * This program is distributed in the hope that it will be useful, * | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | |
12 | * GNU General Public License for more details. * | |
13 | * * | |
14 | * You should have received a copy of the GNU General Public License * | |
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. * | |
16 | * * | |
17 | ***************************************************************************/ | |
18 | ||
19 | #include <QApplication> | |
20 | ||
21 | #include "model.h" | |
22 | #include "common.h" | |
23 | #include "editor.h" | |
24 | ||
25 | namespace fcitx_unikey { | |
26 | ||
27 | typedef QPair<QString, QString> ItemType; | |
28 | ||
29 | MacroModel::MacroModel(QObject* parent): QAbstractTableModel(parent) | |
30 | ,m_needSave(false) | |
31 | { | |
32 | } | |
33 | ||
34 | MacroModel::~MacroModel() | |
35 | { | |
36 | ||
37 | } | |
38 | ||
39 | QVariant MacroModel::headerData(int section, Qt::Orientation orientation, int role) const | |
40 | { | |
41 | if (orientation == Qt::Horizontal && role == Qt::DisplayRole) { | |
42 | if (section == 0) | |
43 | return _("Macro"); | |
44 | else if (section == 1) | |
45 | return _("Word"); | |
46 | } | |
47 | return QVariant(); | |
48 | } | |
49 | ||
50 | int MacroModel::rowCount(const QModelIndex& parent) const | |
51 | { | |
52 | return m_list.count(); | |
53 | } | |
54 | ||
55 | int MacroModel::columnCount(const QModelIndex& parent) const | |
56 | { | |
57 | return 2; | |
58 | } | |
59 | ||
60 | QVariant MacroModel::data(const QModelIndex& index, int role) const | |
61 | { | |
62 | do { | |
63 | if (role == Qt::DisplayRole && index.row() < m_list.count()) { | |
64 | if (index.column() == 0) { | |
65 | return m_list[index.row()].first; | |
66 | } else if (index.column() == 1) { | |
67 | return m_list[index.row()].second; | |
68 | } | |
69 | } | |
70 | } while(0); | |
71 | return QVariant(); | |
72 | } | |
73 | ||
74 | void MacroModel::addItem(const QString& macro, const QString& word) | |
75 | { | |
76 | if (m_keyset.contains(macro)) | |
77 | return; | |
78 | beginInsertRows(QModelIndex(), m_list.size(), m_list.size()); | |
79 | m_list.append(QPair<QString, QString>(macro, word)); | |
80 | m_keyset.insert(macro); | |
81 | endInsertRows(); | |
82 | setNeedSave(true); | |
83 | } | |
84 | ||
85 | void MacroModel::deleteItem(int row) | |
86 | { | |
87 | if (row >= m_list.count()) | |
88 | return; | |
89 | QPair<QString, QString> item = m_list.at(row); | |
90 | QString key = item.first; | |
91 | beginRemoveRows(QModelIndex(), row, row); | |
92 | m_list.removeAt(row); | |
93 | m_keyset.remove(key); | |
94 | endRemoveRows(); | |
95 | setNeedSave(true); | |
96 | } | |
97 | ||
98 | void MacroModel::deleteAllItem() | |
99 | { | |
100 | if (m_list.count()) | |
101 | setNeedSave(true); | |
102 | beginResetModel(); | |
103 | m_list.clear(); | |
104 | m_keyset.clear(); | |
105 | endResetModel(); | |
106 | } | |
107 | ||
108 | void MacroModel::setNeedSave(bool needSave) | |
109 | { | |
110 | if (m_needSave != needSave) { | |
111 | m_needSave = needSave; | |
112 | emit needSaveChanged(m_needSave); | |
113 | } | |
114 | } | |
115 | ||
116 | bool MacroModel::needSave() | |
117 | { | |
118 | return m_needSave; | |
119 | } | |
120 | ||
121 | ||
122 | void MacroModel::load(CMacroTable* table) | |
123 | { | |
124 | beginResetModel(); | |
125 | m_list.clear(); | |
126 | m_keyset.clear(); | |
127 | for (int i = 0; i < table->getCount(); i++) { | |
128 | QString key = MacroEditor::getData(table, i, true); | |
129 | QString value = MacroEditor::getData(table, i, false); | |
130 | m_list.append(QPair<QString, QString>(key, value)); | |
131 | m_keyset.insert(key); | |
132 | } | |
133 | endResetModel(); | |
134 | } | |
135 | ||
136 | void MacroModel::save(CMacroTable* m_table) | |
137 | { | |
138 | m_table->resetContent(); | |
139 | foreach(const ItemType& item, m_list) { | |
140 | m_table->addItem(item.first.toUtf8().data(), item.second.toUtf8().data(), CONV_CHARSET_XUTF8); | |
141 | } | |
142 | setNeedSave(false); | |
143 | } | |
144 | ||
145 | ||
146 | }⏎ |
0 | /*************************************************************************** | |
1 | * Copyright (C) 2012~2012 by CSSlayer * | |
2 | * wengxt@gmail.com * | |
3 | * * | |
4 | * This program is free software: you can redistribute it and/or modify * | |
5 | * it under the terms of the GNU General Public License as published by * | |
6 | * the Free Software Foundation, either version 3 of the License, or * | |
7 | * (at your option) any later version. * | |
8 | * * | |
9 | * This program is distributed in the hope that it will be useful, * | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | |
12 | * GNU General Public License for more details. * | |
13 | * * | |
14 | * You should have received a copy of the GNU General Public License * | |
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. * | |
16 | * * | |
17 | ***************************************************************************/ | |
18 | ||
19 | #include <QAbstractItemModel> | |
20 | #include <QSet> | |
21 | #include "mactab.h" | |
22 | ||
23 | namespace fcitx_unikey { | |
24 | class MacroModel : public QAbstractTableModel { | |
25 | Q_OBJECT | |
26 | public: | |
27 | explicit MacroModel(QObject* parent = 0); | |
28 | virtual ~MacroModel(); | |
29 | ||
30 | virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; | |
31 | virtual int rowCount(const QModelIndex& parent = QModelIndex()) const; | |
32 | virtual int columnCount(const QModelIndex& parent = QModelIndex()) const; | |
33 | virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; | |
34 | void load(CMacroTable* table); | |
35 | void addItem(const QString& macro, const QString& word); | |
36 | void deleteItem(int row); | |
37 | void deleteAllItem(); | |
38 | void save(CMacroTable* m_table); | |
39 | bool needSave(); | |
40 | ||
41 | signals: | |
42 | void needSaveChanged(bool m_needSave); | |
43 | ||
44 | private: | |
45 | void setNeedSave(bool needSave); | |
46 | bool m_needSave; | |
47 | QSet<QString> m_keyset; | |
48 | QList<QPair< QString, QString > >m_list; | |
49 | }; | |
50 | ||
51 | }⏎ |
8 | 8 | configure_file(POTFILES.in.in ${CMAKE_CURRENT_BINARY_DIR}/POTFILES.in) |
9 | 9 | |
10 | 10 | extract_fcitx_addon_conf_postring() |
11 | ||
12 | add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/desc.po | |
13 | COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/getdescpo ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} | |
14 | DEPENDS getdescpo) | |
11 | extract_fcitx_desc_file_postring() | |
15 | 12 | |
16 | 13 | add_custom_target( |
17 | 14 | pot |
5 | 5 | @REL_SOURCE_ROOT@/src/unikey-config.h |
6 | 6 | @REL_SOURCE_ROOT@/src/unikey-im.cpp |
7 | 7 | @REL_SOURCE_ROOT@/src/unikey-im.h |
8 | @REL_SOURCE_ROOT@/macro-editor/dialog.cpp | |
9 | @REL_SOURCE_ROOT@/macro-editor/editor.cpp | |
10 | @REL_SOURCE_ROOT@/macro-editor/main.cpp | |
11 | @REL_SOURCE_ROOT@/macro-editor/model.cpp | |
8 | 12 | @REL_SOURCE_ROOT@/data/fcitx-unikey.conf.in |
9 | 13 | @REL_SOURCE_ROOT@/data/unikey.conf.in |
7 | 7 | msgstr "" |
8 | 8 | "Project-Id-Version: PACKAGE VERSION\n" |
9 | 9 | "Report-Msgid-Bugs-To: \n" |
10 | "POT-Creation-Date: 2012-05-05 16:38+0800\n" | |
10 | "POT-Creation-Date: 2012-10-20 22:29-0400\n" | |
11 | 11 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
12 | 12 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
13 | 13 | "Language-Team: LANGUAGE <LL@li.org>\n" |
21 | 21 | msgstr "" |
22 | 22 | |
23 | 23 | #: /home/saber/Develop/fcitx-unikey/data/fcitx-unikey.desc:14 |
24 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:137 | |
24 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:156 | |
25 | 25 | msgid "Output Charset" |
26 | 26 | msgstr "" |
27 | 27 | |
52 | 52 | # unknown |
53 | 53 | #: /home/saber/Develop/fcitx-unikey/build/po/tmp/fcitx-unikey.conf.in.h:1 |
54 | 54 | #: /home/saber/Develop/fcitx-unikey/build/po/tmp/unikey.conf.in.h:1 |
55 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-im.cpp:131 | |
55 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-im.cpp:150 | |
56 | 56 | msgid "Unikey" |
57 | 57 | msgstr "" |
58 | 58 | |
102 | 102 | |
103 | 103 | #: unknown |
104 | 104 | msgid "VNI Win" |
105 | msgstr "" | |
106 | ||
107 | #: unknown | |
108 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:127 | |
109 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:187 | |
110 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//macro-editor/model.cpp:25 | |
111 | msgid "Macro" | |
105 | 112 | msgstr "" |
106 | 113 | |
107 | 114 | #: /home/saber/Develop/fcitx-unikey/build/po/tmp/fcitx-unikey.conf.in.h:2 |
108 | 115 | msgid "Unikey Wrapper For Fcitx" |
109 | 116 | msgstr "" |
110 | 117 | |
111 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:86 | |
112 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:153 | |
118 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:105 | |
119 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:172 | |
113 | 120 | msgid "Choose input method" |
114 | 121 | msgstr "" |
115 | 122 | |
116 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:94 | |
117 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:159 | |
123 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:113 | |
124 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:178 | |
118 | 125 | msgid "Choose output charset" |
119 | 126 | msgstr "" |
120 | 127 | |
121 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:100 | |
122 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:163 | |
128 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:119 | |
129 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:182 | |
123 | 130 | msgid "Spell Check" |
124 | 131 | msgstr "" |
125 | 132 | |
126 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:101 | |
127 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:164 | |
133 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:120 | |
134 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:183 | |
128 | 135 | msgid "Enable Spell Check" |
129 | 136 | msgstr "" |
130 | 137 | |
131 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:108 | |
132 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:168 | |
133 | msgid "Macro" | |
134 | msgstr "" | |
135 | ||
136 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:109 | |
137 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:169 | |
138 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:128 | |
139 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:188 | |
138 | 140 | msgid "Enable Macro" |
139 | 141 | msgstr "" |
140 | 142 | |
141 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:123 | |
143 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:142 | |
142 | 144 | msgid "Unikey Input Method" |
143 | 145 | msgstr "" |
144 | 146 | |
145 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:163 | |
146 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:168 | |
147 | msgid "N" | |
148 | msgstr "" | |
147 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:182 | |
148 | msgid "No Spell Check" | |
149 | msgstr "" | |
150 | ||
151 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:187 | |
152 | msgid "No Macro" | |
153 | msgstr "" | |
154 | ||
155 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//macro-editor/editor.cpp:21 | |
156 | msgid "&Add" | |
157 | msgstr "" | |
158 | ||
159 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//macro-editor/editor.cpp:22 | |
160 | msgid "&Delete" | |
161 | msgstr "" | |
162 | ||
163 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//macro-editor/editor.cpp:23 | |
164 | msgid "De&lete All" | |
165 | msgstr "" | |
166 | ||
167 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//macro-editor/editor.cpp:24 | |
168 | msgid "&Quit" | |
169 | msgstr "" | |
170 | ||
171 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//macro-editor/editor.cpp:25 | |
172 | msgid "&Save" | |
173 | msgstr "" | |
174 | ||
175 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//macro-editor/editor.cpp:26 | |
176 | msgid "&Import" | |
177 | msgstr "" | |
178 | ||
179 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//macro-editor/editor.cpp:27 | |
180 | msgid "&Export" | |
181 | msgstr "" | |
182 | ||
183 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//macro-editor/editor.cpp:30 | |
184 | msgid "Unikey Macro Editor" | |
185 | msgstr "" | |
186 | ||
187 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//macro-editor/editor.cpp:56 | |
188 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//macro-editor/editor.cpp:84 | |
189 | msgid "Quit Macro Editor" | |
190 | msgstr "" | |
191 | ||
192 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//macro-editor/editor.cpp:57 | |
193 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//macro-editor/editor.cpp:85 | |
194 | msgid "Macro table still contains unsaved changes. Do you want to save?" | |
195 | msgstr "" | |
196 | ||
197 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//macro-editor/model.cpp:27 | |
198 | msgid "Word" | |
199 | msgstr "" |
0 | #!/bin/sh | |
1 | filename=desc.po | |
2 | indir=$1 | |
3 | outdir=$2 | |
4 | ||
5 | cd "$outdir" | |
6 | ||
7 | rm -f "$outdir/$filename"; touch "$outdir/$filename" | |
8 | ||
9 | cat > "$outdir/$filename" <<EOF | |
10 | # SOME DESCRIPTIVE TITLE. | |
11 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER | |
12 | # This file is distributed under the same license as the PACKAGE package. | |
13 | # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. | |
14 | # | |
15 | #, fuzzy | |
16 | msgid "" | |
17 | msgstr "" | |
18 | "Project-Id-Version: PACKAGE VERSION\n" | |
19 | "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n" | |
20 | "POT-Creation-Date: 2010-11-17 11:48+0800\n" | |
21 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | |
22 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | |
23 | "Language-Team: LANGUAGE <LL@li.org>\n" | |
24 | "Language: \n" | |
25 | "MIME-Version: 1.0\n" | |
26 | "Content-Type: text/plain; charset=UTF-8\n" | |
27 | "Content-Transfer-Encoding: 8bit\n" | |
28 | EOF | |
29 | ||
30 | cd $indir | |
31 | ||
32 | descfiles=`find "$indir" -name ".hg" -prune -or -name "test" -prune -or -iname "*.desc" | grep desc` | |
33 | ||
34 | # Extract Description | |
35 | for f in $descfiles | |
36 | do | |
37 | awk '/^[\t ]*Description=/ { print "\n#: '$f':" NR"\n" "msgid \"" substr($0, 13)"\"\n" "msgstr \"\""}' "$f" >> "$outdir/$filename" | |
38 | done | |
39 | ||
40 | # Extract Group Name | |
41 | grep -nH '^\[' $descfiles | grep -v 'DescriptionFile' | awk ' "^[" { split($0, a, ":"); split(a[3], b, "/"); print substr(b[1], 2); }' | sort | uniq | awk '{ print "# unknown\nmsgid \""$0"\"\nmsgstr \"\"\n"; }' >> "$outdir/$filename" | |
42 | ||
43 | # Extract Enum Name | |
44 | grep -h 'Enum[0-9]' $descfiles | sed -e 's/Enum[0-9]=//g' | sort | uniq | awk '{ print "#: unknown\nmsgid \""$0"\"\nmsgstr \"\"\n"; }' >> "$outdir/$filename" | |
45 |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: ibus-unikey 0.6.1\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | "POT-Creation-Date: 2012-05-05 16:38+0800\n" | |
12 | "PO-Revision-Date: 2012-05-05 16:39+0800\n" | |
11 | "POT-Creation-Date: 2012-10-20 22:29-0400\n" | |
12 | "PO-Revision-Date: 2012-10-20 22:33-0400\n" | |
13 | 13 | "Last-Translator: Weng Xuetian <wengxt@gmail.com>\n" |
14 | 14 | "Language-Team: Chinese Simplified <kde-i18n-doc@kde.org>\n" |
15 | 15 | "Language: zh_CN\n" |
20 | 20 | "X-Poedit-Language: Vietnamese\n" |
21 | 21 | "X-Poedit-Country: VIET NAM\n" |
22 | 22 | "X-Poedit-SourceCharset: utf-8\n" |
23 | "X-Generator: Lokalize 1.4\n" | |
23 | "X-Generator: Lokalize 1.5\n" | |
24 | ||
25 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//macro-editor/editor.cpp:21 | |
26 | msgid "&Add" | |
27 | msgstr "" | |
28 | ||
29 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//macro-editor/editor.cpp:22 | |
30 | msgid "&Delete" | |
31 | msgstr "&Xóa" | |
32 | ||
33 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//macro-editor/editor.cpp:27 | |
34 | msgid "&Export" | |
35 | msgstr "&Xuất" | |
36 | ||
37 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//macro-editor/editor.cpp:26 | |
38 | msgid "&Import" | |
39 | msgstr "&Nhập" | |
40 | ||
41 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//macro-editor/editor.cpp:24 | |
42 | msgid "&Quit" | |
43 | msgstr "" | |
44 | ||
45 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//macro-editor/editor.cpp:25 | |
46 | msgid "&Save" | |
47 | msgstr "" | |
24 | 48 | |
25 | 49 | #: /home/saber/Develop/fcitx-unikey/data/fcitx-unikey.desc:43 |
26 | 50 | msgid "Allow type with more freedom" |
38 | 62 | msgid "CString" |
39 | 63 | msgstr "CString" |
40 | 64 | |
41 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:86 | |
42 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:153 | |
65 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:105 | |
66 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:172 | |
43 | 67 | msgid "Choose input method" |
44 | 68 | msgstr "Chọn kiểu gõ" |
45 | 69 | |
46 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:94 | |
47 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:159 | |
70 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:113 | |
71 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:178 | |
48 | 72 | msgid "Choose output charset" |
49 | 73 | msgstr "Chọn bảng mã" |
50 | 74 | |
51 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:109 | |
52 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:169 | |
75 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//macro-editor/editor.cpp:23 | |
76 | msgid "De&lete All" | |
77 | msgstr "Xóa &hết" | |
78 | ||
79 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:128 | |
80 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:188 | |
53 | 81 | msgid "Enable Macro" |
54 | 82 | msgstr "Bật gõ tắt" |
55 | 83 | |
56 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:101 | |
57 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:164 | |
84 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:120 | |
85 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:183 | |
58 | 86 | msgid "Enable Spell Check" |
59 | 87 | msgstr "Bật kiểm tra chính tả" |
60 | 88 | |
70 | 98 | msgid "Input Method" |
71 | 99 | msgstr "Kiểu gõ" |
72 | 100 | |
73 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:108 | |
74 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:168 | |
101 | #: unknown | |
102 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:127 | |
103 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:187 | |
104 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//macro-editor/model.cpp:25 | |
75 | 105 | msgid "Macro" |
76 | 106 | msgstr "gõ tắt" |
77 | 107 | |
78 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:163 | |
79 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:168 | |
80 | msgid "N" | |
81 | msgstr "N" | |
108 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//macro-editor/editor.cpp:57 | |
109 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//macro-editor/editor.cpp:85 | |
110 | msgid "Macro table still contains unsaved changes. Do you want to save?" | |
111 | msgstr "" | |
82 | 112 | |
83 | 113 | #: unknown |
84 | 114 | msgid "NCR Decimal" |
88 | 118 | msgid "NCR Hex" |
89 | 119 | msgstr "NCR Hex" |
90 | 120 | |
121 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:187 | |
122 | #, fuzzy | |
123 | msgid "No Macro" | |
124 | msgstr "gõ tắt" | |
125 | ||
126 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:182 | |
127 | #, fuzzy | |
128 | msgid "No Spell Check" | |
129 | msgstr "kiểm tra chính tả" | |
130 | ||
91 | 131 | #: /home/saber/Develop/fcitx-unikey/data/fcitx-unikey.desc:14 |
92 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:137 | |
132 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:156 | |
93 | 133 | msgid "Output Charset" |
94 | 134 | msgstr "Bảng mã" |
95 | 135 | |
97 | 137 | msgid "Process W at word begin" |
98 | 138 | msgstr "Xử lý phím W ở đầu từ" |
99 | 139 | |
140 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//macro-editor/editor.cpp:56 | |
141 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//macro-editor/editor.cpp:84 | |
142 | msgid "Quit Macro Editor" | |
143 | msgstr "" | |
144 | ||
100 | 145 | #: unknown |
101 | 146 | msgid "STelex" |
102 | 147 | msgstr "STelex" |
105 | 150 | msgid "STelex2" |
106 | 151 | msgstr "STelex2" |
107 | 152 | |
108 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:100 | |
109 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:163 | |
153 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:119 | |
154 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:182 | |
110 | 155 | msgid "Spell Check" |
111 | 156 | msgstr "kiểm tra chính tả" |
112 | 157 | |
125 | 170 | # unknown |
126 | 171 | #: /home/saber/Develop/fcitx-unikey/build/po/tmp/fcitx-unikey.conf.in.h:1 |
127 | 172 | #: /home/saber/Develop/fcitx-unikey/build/po/tmp/unikey.conf.in.h:1 |
128 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-im.cpp:131 | |
173 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-im.cpp:150 | |
129 | 174 | msgid "Unikey" |
130 | 175 | msgstr "Unikey" |
131 | 176 | |
132 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:123 | |
177 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:142 | |
133 | 178 | msgid "Unikey Input Method" |
134 | 179 | msgstr "Unikey Kiểu gõ" |
180 | ||
181 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//macro-editor/editor.cpp:30 | |
182 | msgid "Unikey Macro Editor" | |
183 | msgstr "" | |
135 | 184 | |
136 | 185 | #: /home/saber/Develop/fcitx-unikey/build/po/tmp/fcitx-unikey.conf.in.h:2 |
137 | 186 | msgid "Unikey Wrapper For Fcitx" |
153 | 202 | msgid "Vni" |
154 | 203 | msgstr "Vni" |
155 | 204 | |
205 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//macro-editor/model.cpp:27 | |
206 | msgid "Word" | |
207 | msgstr "Từ" | |
208 | ||
156 | 209 | #~ msgid "(replace text)" |
157 | 210 | #~ msgstr "(chuỗi thay thế)" |
158 | 211 | |
178 | 231 | #~ msgid "Choose file to import" |
179 | 232 | #~ msgstr "Chọn tập tin để nhập" |
180 | 233 | |
181 | #~ msgid "Delete _all" | |
182 | #~ msgstr "Xóa _hết" | |
183 | ||
184 | 234 | #~ msgid "Full setup utility for IBus-Unikey" |
185 | 235 | #~ msgstr "Tiện ích cài đặt đầy đủ cho IBus-Unikey" |
186 | 236 | |
195 | 245 | |
196 | 246 | #~ msgid "Macro table definition" |
197 | 247 | #~ msgstr "Định nghĩa bảng gõ tắt" |
248 | ||
249 | #~ msgid "N" | |
250 | #~ msgstr "N" | |
198 | 251 | |
199 | 252 | #~ msgid "Options" |
200 | 253 | #~ msgstr "Tùy chọn" |
240 | 293 | #~ " - Dùng <Shift>+<Space> hoặc <Shift>+<Shift> để khôi phục phím.\n" |
241 | 294 | #~ " - Dùng <Control> để xác nhận từ (kết thúc từ)." |
242 | 295 | |
243 | #~ msgid "Word" | |
244 | #~ msgstr "Từ" | |
245 | ||
246 | 296 | #~ msgid "_Edit macro" |
247 | 297 | #~ msgstr "_Sửa bảng gõ tắt" |
248 | ||
249 | #~ msgid "_Export..." | |
250 | #~ msgstr "_Xuất..." | |
251 | ||
252 | #~ msgid "_Import..." | |
253 | #~ msgstr "_Nhập..." |
0 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER | |
1 | # This file is distributed under the same license as the PACKAGE package. | |
2 | # | |
3 | # Translators: | |
4 | # Christopher Meng <cickumqt@gmail.com>, 2012. | |
5 | # Weng Xuetian <wengxt@gmail.com>, 2012. | |
6 | msgid "" | |
7 | msgstr "" | |
8 | "Project-Id-Version: fcitx\n" | |
9 | "Report-Msgid-Bugs-To: \n" | |
10 | "POT-Creation-Date: 2012-10-20 22:29-0400\n" | |
11 | "PO-Revision-Date: 2012-10-20 22:47-0400\n" | |
12 | "Last-Translator: Weng Xuetian <wengxt@gmail.com>\n" | |
13 | "Language-Team: Chinese Simplified <kde-china@kde.org>\n" | |
14 | "Language: zh_CN\n" | |
15 | "MIME-Version: 1.0\n" | |
16 | "Content-Type: text/plain; charset=UTF-8\n" | |
17 | "Content-Transfer-Encoding: 8bit\n" | |
18 | "Plural-Forms: nplurals=1; plural=0\n" | |
19 | "X-Generator: Lokalize 1.5\n" | |
20 | ||
21 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//macro-editor/editor.cpp:21 | |
22 | msgid "&Add" | |
23 | msgstr "添加(&A)" | |
24 | ||
25 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//macro-editor/editor.cpp:22 | |
26 | msgid "&Delete" | |
27 | msgstr "删除(&D)" | |
28 | ||
29 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//macro-editor/editor.cpp:27 | |
30 | msgid "&Export" | |
31 | msgstr "导出(&E)" | |
32 | ||
33 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//macro-editor/editor.cpp:26 | |
34 | msgid "&Import" | |
35 | msgstr "导入(&I)" | |
36 | ||
37 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//macro-editor/editor.cpp:24 | |
38 | msgid "&Quit" | |
39 | msgstr "退出(&Q)" | |
40 | ||
41 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//macro-editor/editor.cpp:25 | |
42 | msgid "&Save" | |
43 | msgstr "保存(&S)" | |
44 | ||
45 | #: /home/saber/Develop/fcitx-unikey/data/fcitx-unikey.desc:43 | |
46 | msgid "Allow type with more freedom" | |
47 | msgstr "" | |
48 | ||
49 | #: /home/saber/Develop/fcitx-unikey/data/fcitx-unikey.desc:48 | |
50 | msgid "Auto restore keys with invalid words" | |
51 | msgstr "" | |
52 | ||
53 | #: unknown | |
54 | msgid "BK HCM 2" | |
55 | msgstr "BK HCM 2" | |
56 | ||
57 | #: unknown | |
58 | msgid "CString" | |
59 | msgstr "CString" | |
60 | ||
61 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:105 | |
62 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:172 | |
63 | msgid "Choose input method" | |
64 | msgstr "选择输入法" | |
65 | ||
66 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:113 | |
67 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:178 | |
68 | msgid "Choose output charset" | |
69 | msgstr "选择输出字符集" | |
70 | ||
71 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//macro-editor/editor.cpp:23 | |
72 | msgid "De&lete All" | |
73 | msgstr "全部删除(&L)" | |
74 | ||
75 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:128 | |
76 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:188 | |
77 | msgid "Enable Macro" | |
78 | msgstr "开启宏" | |
79 | ||
80 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:120 | |
81 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:183 | |
82 | msgid "Enable Spell Check" | |
83 | msgstr "启用拼写检查" | |
84 | ||
85 | #: /home/saber/Develop/fcitx-unikey/data/fcitx-unikey.desc:33 | |
86 | msgid "Enable macro" | |
87 | msgstr "开启宏" | |
88 | ||
89 | #: /home/saber/Develop/fcitx-unikey/data/fcitx-unikey.desc:28 | |
90 | msgid "Enable spell check" | |
91 | msgstr "启用拼写检查" | |
92 | ||
93 | #: /home/saber/Develop/fcitx-unikey/data/fcitx-unikey.desc:4 | |
94 | msgid "Input Method" | |
95 | msgstr "输入法" | |
96 | ||
97 | #: unknown | |
98 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:127 | |
99 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:187 | |
100 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//macro-editor/model.cpp:25 | |
101 | msgid "Macro" | |
102 | msgstr "宏" | |
103 | ||
104 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//macro-editor/editor.cpp:57 | |
105 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//macro-editor/editor.cpp:85 | |
106 | msgid "Macro table still contains unsaved changes. Do you want to save?" | |
107 | msgstr "宏表上有未保存的修改。您想要保存吗?" | |
108 | ||
109 | #: unknown | |
110 | msgid "NCR Decimal" | |
111 | msgstr "NCR Decimal" | |
112 | ||
113 | #: unknown | |
114 | msgid "NCR Hex" | |
115 | msgstr "NCR Hex" | |
116 | ||
117 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:187 | |
118 | msgid "No Macro" | |
119 | msgstr "禁用宏" | |
120 | ||
121 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:182 | |
122 | msgid "No Spell Check" | |
123 | msgstr "禁用拼写检查" | |
124 | ||
125 | #: /home/saber/Develop/fcitx-unikey/data/fcitx-unikey.desc:14 | |
126 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:156 | |
127 | msgid "Output Charset" | |
128 | msgstr "输出字符集" | |
129 | ||
130 | #: /home/saber/Develop/fcitx-unikey/data/fcitx-unikey.desc:53 | |
131 | msgid "Process W at word begin" | |
132 | msgstr "" | |
133 | ||
134 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//macro-editor/editor.cpp:56 | |
135 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//macro-editor/editor.cpp:84 | |
136 | msgid "Quit Macro Editor" | |
137 | msgstr "" | |
138 | ||
139 | #: unknown | |
140 | msgid "STelex" | |
141 | msgstr "STelex" | |
142 | ||
143 | #: unknown | |
144 | msgid "STelex2" | |
145 | msgstr "STelex2" | |
146 | ||
147 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:119 | |
148 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:182 | |
149 | msgid "Spell Check" | |
150 | msgstr "拼写检查" | |
151 | ||
152 | #: unknown | |
153 | msgid "TCVN3" | |
154 | msgstr "TCVN3" | |
155 | ||
156 | #: unknown | |
157 | msgid "Telex" | |
158 | msgstr "Telex" | |
159 | ||
160 | #: unknown | |
161 | msgid "Unicode" | |
162 | msgstr "Unicode" | |
163 | ||
164 | # unknown | |
165 | #: /home/saber/Develop/fcitx-unikey/build/po/tmp/fcitx-unikey.conf.in.h:1 | |
166 | #: /home/saber/Develop/fcitx-unikey/build/po/tmp/unikey.conf.in.h:1 | |
167 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-im.cpp:150 | |
168 | msgid "Unikey" | |
169 | msgstr "Unikey" | |
170 | ||
171 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:142 | |
172 | msgid "Unikey Input Method" | |
173 | msgstr "Unikey 输入法" | |
174 | ||
175 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//macro-editor/editor.cpp:30 | |
176 | msgid "Unikey Macro Editor" | |
177 | msgstr "Unikey 宏编辑器" | |
178 | ||
179 | #: /home/saber/Develop/fcitx-unikey/build/po/tmp/fcitx-unikey.conf.in.h:2 | |
180 | msgid "Unikey Wrapper For Fcitx" | |
181 | msgstr "Fcitx 的 Unikey 封装" | |
182 | ||
183 | #: /home/saber/Develop/fcitx-unikey/data/fcitx-unikey.desc:38 | |
184 | msgid "Use oà, _uý (instead of òa, úy)" | |
185 | msgstr "使用 oà, _uý (替换òa, úy)" | |
186 | ||
187 | #: unknown | |
188 | msgid "VIQR" | |
189 | msgstr "VIQR" | |
190 | ||
191 | #: unknown | |
192 | msgid "VNI Win" | |
193 | msgstr "VNI Win" | |
194 | ||
195 | #: unknown | |
196 | msgid "Vni" | |
197 | msgstr "Vni" | |
198 | ||
199 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//macro-editor/model.cpp:27 | |
200 | msgid "Word" | |
201 | msgstr "单词" | |
202 | ||
203 | #~ msgid "N" | |
204 | #~ msgstr "N" |
12 | 12 | unikey-ui.cpp |
13 | 13 | ) |
14 | 14 | |
15 | set(UNIKEY_SRCS | |
16 | ../unikey/byteio.cpp | |
17 | ../unikey/byteio.h | |
18 | ../unikey/charset.cpp | |
19 | ../unikey/charset.h | |
20 | ../unikey/convert.cpp | |
21 | ../unikey/data.cpp | |
22 | ../unikey/data.h | |
23 | ../unikey/error.cpp | |
24 | ../unikey/inputproc.cpp | |
25 | ../unikey/inputproc.h | |
26 | ../unikey/keycons.h | |
27 | ../unikey/mactab.cpp | |
28 | ../unikey/mactab.h | |
29 | ../unikey/pattern.cpp | |
30 | ../unikey/pattern.h | |
31 | ../unikey/ukengine.cpp | |
32 | ../unikey/ukengine.h | |
33 | ../unikey/unikey.cpp | |
34 | ../unikey/unikey.h | |
35 | ../unikey/usrkeymap.cpp | |
36 | ../unikey/usrkeymap.h | |
37 | ../unikey/vnconv.h | |
38 | ../unikey/vnlexi.h | |
39 | ) | |
40 | ||
41 | 15 | add_definitions( -DLOCALEDIR=\"${CMAKE_INSTALL_PREFIX}/share/locale\" ) |
42 | 16 | |
43 | fcitx_add_addon(fcitx-unikey ${fcitx_unikey_sources} ${UNIKEY_SRCS} ) | |
17 | fcitx_add_addon(fcitx-unikey ${fcitx_unikey_sources} ) | |
18 | target_link_libraries(fcitx-unikey unikey) |
186 | 186 | |
187 | 187 | UnikeyResetBuf(); |
188 | 188 | unikey->preeditstr->clear(); |
189 | FcitxUnikeyUpdatePreedit(unikey); | |
189 | 190 | } |
190 | 191 | |
191 | 192 | void FcitxUnikeyCommit(FcitxUnikey* unikey) |
238 | 239 | FcitxUnikeyCommit(unikey); |
239 | 240 | return IRV_FLAG_FORWARD_KEY; |
240 | 241 | } |
241 | ||
242 | else if (state & FcitxKeyState_Super) { | |
243 | return IRV_TO_PROCESS; | |
244 | } | |
242 | 245 | else if ((sym >= FcitxKey_Caps_Lock && sym <= FcitxKey_Hyper_R) |
243 | 246 | || (!(state & FcitxKeyState_Shift) && (sym == FcitxKey_Shift_L || sym == FcitxKey_Shift_R)) // when press one shift key |
244 | 247 | ) |
266 | 269 | else |
267 | 270 | { |
268 | 271 | FcitxUnikeyEraseChars(unikey, UnikeyBackspaces); |
269 | FcitxUnikeyUpdatePreedit(unikey); | |
270 | 272 | } |
271 | 273 | |
272 | 274 | // change tone position after press backspace |
286 | 288 | } |
287 | 289 | |
288 | 290 | unikey->auto_commit = false; |
289 | FcitxUnikeyUpdatePreedit(unikey); | |
290 | } | |
291 | } | |
292 | FcitxUnikeyUpdatePreedit(unikey); | |
291 | 293 | } |
292 | 294 | return IRV_DISPLAY_MESSAGE; |
293 | 295 | } // end capture BackSpace |
492 | 494 | } |
493 | 495 | FcitxMessagesAddMessageAtLast(clientPreedit, MSG_INPUT, "%s", unikey->preeditstr->c_str()); |
494 | 496 | FcitxInputStateSetClientCursorPos(input, unikey->preeditstr->size()); |
497 | FcitxUIUpdateInputWindow(unikey->owner); | |
495 | 498 | } |
496 | 499 | |
497 | 500 | CONFIG_DESC_DEFINE(GetUnikeyConfigDesc, "fcitx-unikey.desc") |
529 | 532 | UnikeySetInputMethod(unikey->config.im); |
530 | 533 | UnikeySetOutputCharset(Unikey_OC[unikey->config.oc]); |
531 | 534 | UnikeySetOptions(&unikey->ukopt); |
535 | char* userFile = NULL; | |
536 | FcitxXDGGetFileUserWithPrefix("unikey", "macro", NULL, &userFile); | |
537 | UnikeyLoadMacroTable(userFile); | |
538 | free(userFile); | |
532 | 539 | |
533 | 540 | UpdateUnikeyUI(unikey); |
534 | 541 | } |
178 | 178 | |
179 | 179 | FcitxUISetStatusString(unikey->owner, |
180 | 180 | "unikey-spell-check", |
181 | unikey->config.spellCheck? _("Spell Check"): _("N"), | |
181 | unikey->config.spellCheck? _("Spell Check"): _("No Spell Check"), | |
182 | 182 | _("Enable Spell Check")); |
183 | 183 | |
184 | 184 | FcitxUISetStatusString(unikey->owner, |
185 | 185 | "unikey-macro", |
186 | unikey->config.macro? _("Macro"): _("N"), | |
186 | unikey->config.macro? _("Macro"): _("No Macro"), | |
187 | 187 | _("Enable Macro")); |
188 | 188 | } |
0 | ||
1 | set(UNIKEY_SRCS | |
2 | byteio.cpp | |
3 | byteio.h | |
4 | charset.cpp | |
5 | charset.h | |
6 | convert.cpp | |
7 | data.cpp | |
8 | data.h | |
9 | error.cpp | |
10 | inputproc.cpp | |
11 | inputproc.h | |
12 | keycons.h | |
13 | mactab.cpp | |
14 | mactab.h | |
15 | pattern.cpp | |
16 | pattern.h | |
17 | ukengine.cpp | |
18 | ukengine.h | |
19 | unikey.cpp | |
20 | unikey.h | |
21 | usrkeymap.cpp | |
22 | usrkeymap.h | |
23 | vnconv.h | |
24 | vnlexi.h | |
25 | ) | |
26 | ||
27 | ||
28 | add_library(unikey STATIC ${UNIKEY_SRCS}) | |
29 | set_target_properties(unikey PROPERTIES COMPILE_FLAGS "-fPIC")⏎ |
76 | 76 | //---------------------------------------------- |
77 | 77 | //int VnConvert(int inCharset, int outCharset, UKBYTE *input, UKBYTE *output, int & inLen, int & maxOutLen) |
78 | 78 | |
79 | DllExport int VnConvert(int inCharset, int outCharset, UKBYTE *input, UKBYTE *output, | |
79 | DllExport int VnConvert(int inCharset, int outCharset, UKBYTE *input, UKBYTE *output, | |
80 | 80 | int * pInLen, int * pMaxOutLen) |
81 | 81 | { |
82 | 82 | int inLen, maxOutLen; |
162 | 162 | |
163 | 163 | if (outf == NULL) { |
164 | 164 | fclose(inf); |
165 | ret = VNCONV_ERR_OUTPUT_FILE; | |
165 | ret = VNCONV_ERR_OUTPUT_FILE; | |
166 | 166 | goto end; |
167 | 167 | } |
168 | 168 | } |
189 | 189 | } |
190 | 190 | #endif |
191 | 191 | } |
192 | else | |
192 | else | |
193 | 193 | remove(tmpName); |
194 | 194 | } |
195 | 195 | |
229 | 229 | return genConvert(*pInCharset, *pOutCharset, is, os); |
230 | 230 | } |
231 | 231 | |
232 | const char *ErrTable[VNCONV_LAST_ERROR] = | |
232 | const char *ErrTable[VNCONV_LAST_ERROR] = | |
233 | 233 | {"No error", |
234 | 234 | "Unknown error", |
235 | 235 | "Invalid charset", |
132 | 132 | //if BOM is available, skip it |
133 | 133 | char *p = line; |
134 | 134 | size_t len = strlen(line); |
135 | if (len >= 3 && (unsigned char)line[0] == 0xEF && (unsigned char)line[1] == 0xBB && | |
136 | (unsigned char)line[2] == 0xBF) | |
135 | if (len >= 3 && (unsigned char)line[0] == 0xEF && (unsigned char)line[1] == 0xBB && | |
136 | (unsigned char)line[2] == 0xBF) | |
137 | 137 | { |
138 | 138 | p += 3; |
139 | 139 | } |
172 | 172 | f = fopen(fname, "r"); |
173 | 173 | #endif |
174 | 174 | |
175 | if (f == NULL) | |
175 | if (f == NULL) | |
176 | 176 | return 0; |
177 | 177 | char line[MAX_MACRO_LINE]; |
178 | 178 | size_t len; |
209 | 209 | //--------------------------------------------------------------- |
210 | 210 | int CMacroTable::writeToFile(const char *fname) |
211 | 211 | { |
212 | int ret; | |
213 | int inLen, maxOutLen; | |
214 | 212 | FILE *f; |
215 | 213 | #if defined(WIN32) |
216 | 214 | f = _tfopen(fname, _TEXT("wt")); |
217 | 215 | #else |
218 | 216 | f = fopen(fname, "w"); |
219 | 217 | #endif |
218 | return writeToFp(f); | |
219 | } | |
220 | ||
221 | int CMacroTable::writeToFp(FILE* f) | |
222 | { | |
223 | int ret; | |
224 | int inLen, maxOutLen; | |
220 | 225 | |
221 | 226 | if (f == NULL) |
222 | 227 | return 0; |
267 | 272 | |
268 | 273 | if (m_count >= MAX_MACRO_ITEMS) |
269 | 274 | return -1; |
270 | ||
275 | ||
271 | 276 | m_table[m_count].keyOffset = offset; |
272 | 277 | |
273 | 278 | // Convert macro key to VN standard |
275 | 280 | maxOutLen = MAX_MACRO_KEY_LEN * sizeof(StdVnChar); |
276 | 281 | if (maxOutLen + offset > m_memSize) |
277 | 282 | maxOutLen = m_memSize - offset; |
278 | ret = VnConvert(charset, CONV_CHARSET_VNSTANDARD, | |
283 | ret = VnConvert(charset, CONV_CHARSET_VNSTANDARD, | |
279 | 284 | (UKBYTE *)key, (UKBYTE *)p, |
280 | 285 | &inLen, &maxOutLen); |
281 | 286 | if (ret != 0) |
290 | 295 | maxOutLen = MAX_MACRO_TEXT_LEN * sizeof(StdVnChar); |
291 | 296 | if (maxOutLen + offset > m_memSize) |
292 | 297 | maxOutLen = m_memSize - offset; |
293 | ret = VnConvert(charset, CONV_CHARSET_VNSTANDARD, | |
298 | ret = VnConvert(charset, CONV_CHARSET_VNSTANDARD, | |
294 | 299 | (UKBYTE *)text, (UKBYTE *)p, |
295 | 300 | &inLen, &maxOutLen); |
296 | 301 | if (ret != 0) |
308 | 313 | int CMacroTable::addItem(const char *item, int charset) |
309 | 314 | { |
310 | 315 | char key[MAX_MACRO_KEY_LEN]; |
311 | ||
316 | ||
312 | 317 | // Parse the input item |
313 | 318 | char * pos = (char*)strchr(item, ':'); |
314 | 319 | if (pos == NULL) |
329 | 334 | } |
330 | 335 | |
331 | 336 | //--------------------------------------------------------------- |
332 | const StdVnChar *CMacroTable::getKey(int idx) | |
337 | const StdVnChar *CMacroTable::getKey(int idx) const | |
333 | 338 | { |
334 | 339 | if (idx < 0 || idx >= m_count) |
335 | 340 | return 0; |
337 | 342 | } |
338 | 343 | |
339 | 344 | //--------------------------------------------------------------- |
340 | const StdVnChar *CMacroTable::getText(int idx) | |
345 | const StdVnChar *CMacroTable::getText(int idx) const | |
341 | 346 | { |
342 | 347 | if (idx < 0 || idx >= m_count) |
343 | 348 | return 0; |
54 | 54 | void init(); |
55 | 55 | int loadFromFile(const char *fname); |
56 | 56 | int writeToFile(const char *fname); |
57 | int writeToFp(FILE* f); | |
57 | 58 | |
58 | 59 | const StdVnChar *lookup(StdVnChar *key); |
59 | const StdVnChar *getKey(int idx); | |
60 | const StdVnChar *getText(int idx); | |
61 | int getCount() { return m_count; } | |
60 | const StdVnChar *getKey(int idx) const; | |
61 | const StdVnChar *getText(int idx) const; | |
62 | int getCount() const { return m_count; } | |
62 | 63 | void resetContent(); |
63 | 64 | int addItem(const char *item, int charset); |
64 | 65 | int addItem(const void *key, const void *text, int charset); |
74 | 74 | #if defined(__cplusplus) |
75 | 75 | extern "C" { |
76 | 76 | #endif |
77 | DllInterface int VnConvert(int inCharset, int outCharset, UKBYTE *input, UKBYTE *output, | |
77 | DllInterface int VnConvert(int inCharset, int outCharset, UKBYTE *input, UKBYTE *output, | |
78 | 78 | int * pInLen, int * pMaxOutLen); |
79 | 79 | |
80 | 80 | DllInterface int VnFileConvert(int inCharset, int outCharset, const char *inFile, const char *outFile); |