diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-11 04:44:41 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-11 04:44:41 +0000 |
commit | a374efce3a207b39514be3c52264091400ce297e (patch) | |
tree | 77bdf654b55826d4f59b53a5621310206bcaead1 /kiten/kiten.cpp | |
parent | f81a494f3957d5cf38c787973415597941934727 (diff) | |
download | tdeedu-a374efce3a207b39514be3c52264091400ce297e.tar.gz tdeedu-a374efce3a207b39514be3c52264091400ce297e.zip |
TQt4 port kdeedu
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeedu@1236073 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kiten/kiten.cpp')
-rw-r--r-- | kiten/kiten.cpp | 118 |
1 files changed, 59 insertions, 59 deletions
diff --git a/kiten/kiten.cpp b/kiten/kiten.cpp index 5e54a9af..beb56a31 100644 --- a/kiten/kiten.cpp +++ b/kiten/kiten.cpp @@ -46,7 +46,7 @@ #include <cassert> -TopLevel::TopLevel(TQWidget *parent, const char *name) : KMainWindow(parent, name) +TopLevel::TopLevel(TQWidget *tqparent, const char *name) : KMainWindow(tqparent, name) { #if KDE_VERSION > 305 setStandardToolBarMenuEnabled(true); @@ -54,43 +54,43 @@ TopLevel::TopLevel(TQWidget *parent, const char *name) : KMainWindow(parent, nam config = Config::self(); config->readConfig(); - Accel = new KGlobalAccel(this); - (void) Accel->insert("Lookup Kanji (Kanjidic)", i18n("Lookup Kanji (Kanjidic)"), i18n("Gives detailed information about Kanji currently on clipboard."), CTRL + ALT + Key_K, CTRL + ALT + Key_K, this, TQT_SLOT(kanjiSearchAccel())); - (void) Accel->insert("Lookup English/Japanese word", i18n("Lookup English/Japanese Word"), i18n("Looks up current text on clipboard in the same way as if you used Kiten's regular search."), CTRL + ALT + Key_S, CTRL + ALT + Key_S, this, TQT_SLOT(searchAccel())); + Accel = new KGlobalAccel(TQT_TQOBJECT(this)); + (void) Accel->insert("Lookup Kanji (Kanjidic)", i18n("Lookup Kanji (Kanjidic)"), i18n("Gives detailed information about Kanji currently on clipboard."), CTRL + ALT + Key_K, CTRL + ALT + Key_K, TQT_TQOBJECT(this), TQT_SLOT(kanjiSearchAccel())); + (void) Accel->insert("Lookup English/Japanese word", i18n("Lookup English/Japanese Word"), i18n("Looks up current text on clipboard in the same way as if you used Kiten's regular search."), CTRL + ALT + Key_S, CTRL + ALT + Key_S, TQT_TQOBJECT(this), TQT_SLOT(searchAccel())); Accel->readSettings(KGlobal::config()); Accel->updateConnections(); _ResultView = new ResultView(true, this, "_ResultView"); setCentralWidget(_ResultView); - (void) KStdAction::quit(this, TQT_SLOT(close()), actionCollection()); - (void) KStdAction::print(this, TQT_SLOT(print()), actionCollection()); - (void) KStdAction::preferences(this, TQT_SLOT(slotConfigure()), actionCollection()); + (void) KStdAction::quit(TQT_TQOBJECT(this), TQT_SLOT(close()), actionCollection()); + (void) KStdAction::print(TQT_TQOBJECT(this), TQT_SLOT(print()), actionCollection()); + (void) KStdAction::preferences(TQT_TQOBJECT(this), TQT_SLOT(slotConfigure()), actionCollection()); KStdAction::keyBindings(guiFactory(), TQT_SLOT(configureShortcuts()), actionCollection()); - (void) new KAction(i18n("&Learn"), "pencil", CTRL+Key_L, this, TQT_SLOT(createLearn()), actionCollection(), "file_learn"); - (void) new KAction(i18n("&Dictionary Editor..."), "edit", 0, this, TQT_SLOT(createEEdit()), actionCollection(), "dict_editor"); - (void) new KAction(i18n("Ra&dical Search..."), "gear", CTRL+Key_R, this, TQT_SLOT(radicalSearch()), actionCollection(), "search_radical"); - Edit = new EditAction(i18n("Search Edit"), 0, this, TQT_SLOT(search()), actionCollection(), "search_edit"); + (void) new KAction(i18n("&Learn"), "pencil", CTRL+Key_L, TQT_TQOBJECT(this), TQT_SLOT(createLearn()), actionCollection(), "file_learn"); + (void) new KAction(i18n("&Dictionary Editor..."), "edit", 0, TQT_TQOBJECT(this), TQT_SLOT(createEEdit()), actionCollection(), "dict_editor"); + (void) new KAction(i18n("Ra&dical Search..."), "gear", CTRL+Key_R, TQT_TQOBJECT(this), TQT_SLOT(radicalSearch()), actionCollection(), "search_radical"); + Edit = new EditAction(i18n("Search Edit"), 0, TQT_TQOBJECT(this), TQT_SLOT(search()), actionCollection(), "search_edit"); (void) new KAction(i18n("&Clear Search Bar"), BarIcon("locationbar_erase", 16), CTRL+Key_N, Edit, TQT_SLOT(clear()), actionCollection(), "clear_search"); - (void) new KAction(i18n("S&earch"), "key_enter", 0, this, TQT_SLOT(search()), actionCollection(), "search"); - (void) new KAction(i18n("Search with &Beginning of Word"), 0, this, TQT_SLOT(searchBeginning()), actionCollection(), "search_beginning"); - (void) new KAction(i18n("Search &Anywhere"), 0, this, TQT_SLOT(searchAnywhere()), actionCollection(), "search_anywhere"); - (void) new KAction(i18n("Stro&kes"), "paintbrush", CTRL+Key_S, this, TQT_SLOT(strokeSearch()), actionCollection(), "search_stroke"); - (void) new KAction(i18n("&Grade"), "leftjust", CTRL+Key_G, this, TQT_SLOT(gradeSearch()), actionCollection(), "search_grade"); - kanjiCB = new KToggleAction(i18n("&Kanjidic"), "kanjidic", CTRL+Key_K, this, TQT_SLOT(kanjiDictChange()), actionCollection(), "kanji_toggle"); - deinfCB = new KToggleAction(i18n("&Deinflect Verbs in Regular Search"), 0, this, TQT_SLOT(kanjiDictChange()), actionCollection(), "deinf_toggle"); - comCB = new KToggleAction(i18n("&Filter Rare"), "filter", CTRL+Key_F, this, TQT_SLOT(toggleCom()), actionCollection(), "common"); - autoSearchToggle = new KToggleAction(i18n("&Automatically Search Clipboard Selections"), "find", 0, this, TQT_SLOT(kanjiDictChange()), actionCollection(), "autosearch_toggle"); - irAction = new KAction(i18n("Search &in Results"), "find", CTRL+Key_I, this, TQT_SLOT(resultSearch()), actionCollection(), "search_in_results"); - (void) KStdAction::configureToolbars(this, TQT_SLOT(configureToolBars()), actionCollection()); - addAction = new KAction(i18n("Add &Kanji to Learning List"), 0, this, TQT_SLOT(addToList()), actionCollection(), "add"); + (void) new KAction(i18n("S&earch"), "key_enter", 0, TQT_TQOBJECT(this), TQT_SLOT(search()), actionCollection(), "search"); + (void) new KAction(i18n("Search with &Beginning of Word"), 0, TQT_TQOBJECT(this), TQT_SLOT(searchBeginning()), actionCollection(), "search_beginning"); + (void) new KAction(i18n("Search &Anywhere"), 0, TQT_TQOBJECT(this), TQT_SLOT(searchAnywhere()), actionCollection(), "search_anywhere"); + (void) new KAction(i18n("Stro&kes"), "paintbrush", CTRL+Key_S, TQT_TQOBJECT(this), TQT_SLOT(strokeSearch()), actionCollection(), "search_stroke"); + (void) new KAction(i18n("&Grade"), "leftjust", CTRL+Key_G, TQT_TQOBJECT(this), TQT_SLOT(gradeSearch()), actionCollection(), "search_grade"); + kanjiCB = new KToggleAction(i18n("&Kanjidic"), "kanjidic", CTRL+Key_K, TQT_TQOBJECT(this), TQT_SLOT(kanjiDictChange()), actionCollection(), "kanji_toggle"); + deinfCB = new KToggleAction(i18n("&Deinflect Verbs in Regular Search"), 0, TQT_TQOBJECT(this), TQT_SLOT(kanjiDictChange()), actionCollection(), "deinf_toggle"); + comCB = new KToggleAction(i18n("&Filter Rare"), "filter", CTRL+Key_F, TQT_TQOBJECT(this), TQT_SLOT(toggleCom()), actionCollection(), "common"); + autoSearchToggle = new KToggleAction(i18n("&Automatically Search Clipboard Selections"), "tqfind", 0, TQT_TQOBJECT(this), TQT_SLOT(kanjiDictChange()), actionCollection(), "autosearch_toggle"); + irAction = new KAction(i18n("Search &in Results"), "tqfind", CTRL+Key_I, TQT_TQOBJECT(this), TQT_SLOT(resultSearch()), actionCollection(), "search_in_results"); + (void) KStdAction::configureToolbars(TQT_TQOBJECT(this), TQT_SLOT(configureToolBars()), actionCollection()); + addAction = new KAction(i18n("Add &Kanji to Learning List"), 0, TQT_TQOBJECT(this), TQT_SLOT(addToList()), actionCollection(), "add"); addAction->setEnabled(false); - (void) new KAction(i18n("Configure &Global Shortcuts..."), "configure_shortcuts", 0, this, TQT_SLOT(configureGlobalKeys()), actionCollection(), "options_configure_keybinding"); + (void) new KAction(i18n("Configure &Global Shortcuts..."), "configure_shortcuts", 0, TQT_TQOBJECT(this), TQT_SLOT(configureGlobalKeys()), actionCollection(), "options_configure_keybinding"); historyAction = new KListAction(i18n("&History"), 0, 0, 0, actionCollection(), "history"); - connect(historyAction, TQT_SIGNAL(activated(int)), this, TQT_SLOT(goInHistory(int))); - backAction = KStdAction::back(this, TQT_SLOT(back()), actionCollection()); - forwardAction = KStdAction::forward(this, TQT_SLOT(forward()), actionCollection()); + connect(historyAction, TQT_SIGNAL(activated(int)), TQT_TQOBJECT(this), TQT_SLOT(goInHistory(int))); + backAction = KStdAction::back(TQT_TQOBJECT(this), TQT_SLOT(back()), actionCollection()); + forwardAction = KStdAction::forward(TQT_TQOBJECT(this), TQT_SLOT(forward()), actionCollection()); backAction->setEnabled(false); forwardAction->setEnabled(false); currentResult = resultHistory.end(); @@ -115,9 +115,9 @@ TopLevel::TopLevel(TQWidget *parent, const char *name) : KMainWindow(parent, nam applyMainWindowSettings(KGlobal::config(), "TopLevelWindow"); connect(_ResultView, TQT_SIGNAL(linkClicked(const TQString &)), TQT_SLOT(ressearch(const TQString &))); - connect(kapp->clipboard(), TQT_SIGNAL(selectionChanged()), this, TQT_SLOT(autoSearch())); + connect(kapp->clipboard(), TQT_SIGNAL(selectionChanged()), TQT_TQOBJECT(this), TQT_SLOT(autoSearch())); - TQTimer::singleShot(10, this, TQT_SLOT(finishInit())); + TQTimer::singleShot(10, TQT_TQOBJECT(this), TQT_SLOT(finishInit())); } TopLevel::~TopLevel() @@ -142,7 +142,7 @@ void TopLevel::finishInit() Edit->clear(); // make sure the edit is focused initially StatusBar->message(i18n("Welcome to Kiten")); - setCaption(TQString::null); + setCaption(TQString()); } bool TopLevel::queryClose() @@ -172,7 +172,7 @@ void TopLevel::addToList() if (learnList.isEmpty()) createLearn(); else - StatusBar->message(i18n("%1 added to learn list of all open learn windows").arg(toAddKanji.kanji())); + StatusBar->message(i18n("%1 added to learn list of all open learn windows").tqarg(toAddKanji.kanji())); emit add(toAddKanji); } @@ -257,12 +257,12 @@ void TopLevel::handleSearchResult(Dict::SearchResult results) addAction->setEnabled(true); - _ResultView->append(TQString("<p>%1</p>").arg(i18n("HTML Entity: %1").arg(TQString("&#x%1;").arg(TQString::number(toAddKanji.kanji().at(0).unicode(), 16))))); // show html entity + _ResultView->append(TQString("<p>%1</p>").tqarg(i18n("HTML Entity: %1").tqarg(TQString("&#x%1;").tqarg(TQString::number(toAddKanji.kanji().tqat(0).tqunicode(), 16))))); // show html entity // now show some compounds in which this kanji appears TQString kanji = toAddKanji.kanji(); - _ResultView->addHeader(i18n("%1 in compounds").arg(kanji)); + _ResultView->addHeader(i18n("%1 in compounds").tqarg(kanji)); Dict::SearchResult compounds = _Asyndeta.retrieveIndex()->search(TQRegExp(kanji), kanji, true); bool common = true; @@ -396,7 +396,7 @@ void TopLevel::search(bool inResults) TQStringList::Iterator nit = names.begin(); for (TQStringList::Iterator it = res.begin(); it != res.end(); ++it, ++nit) { - if (done.contains(*it) > 0) + if (done.tqcontains(*it) > 0) continue; //kdDebug() << "currently on deinflection " << *it << endl; @@ -442,7 +442,7 @@ void TopLevel::strokeSearch() if (!ok) { /* - if (text.find("-") < 0) + if (text.tqfind("-") < 0) { StatusBar->message(i18n("For a range between 4 and 8 strokes, use '4-8'")); return; @@ -498,7 +498,7 @@ void TopLevel::strokeSearch() // must be in kanjidic mode kanjiCB->setChecked(true); - doSearch(TQString("S%1 ").arg(strokesString), regexp); + doSearch(TQString("S%1 ").tqarg(strokesString), regexp); } void TopLevel::gradeSearch() @@ -519,7 +519,7 @@ void TopLevel::gradeSearch() return; } - TQString text = TQString("G%1 ").arg(grade); + TQString text = TQString("G%1 ").tqarg(grade); TQRegExp regexp = TQRegExp(text); kanjiCB->setChecked(true); @@ -529,9 +529,9 @@ void TopLevel::gradeSearch() TQString TopLevel::clipBoardText() // gets text from clipboard for globalaccels { - kapp->clipboard()->setSelectionMode(true); - TQString text = kapp->clipboard()->text().stripWhiteSpace(); - kapp->clipboard()->setSelectionMode(false); + kapp->tqclipboard()->setSelectionMode(true); + TQString text = kapp->tqclipboard()->text().stripWhiteSpace(); + kapp->tqclipboard()->setSelectionMode(false); return text; } @@ -540,10 +540,10 @@ TQString TopLevel::filteredClipboardText() { TQString newText = clipBoardText(); TQString currentText = Edit->text(); - if (newText.length() < 80 && newText.find(':') < 0 && newText.find('#') < 0 && newText.find("-") != 0 && newText.find("+") < 0 && currentText.find(newText) < 0) + if (newText.length() < 80 && newText.tqfind(':') < 0 && newText.tqfind('#') < 0 && newText.tqfind("-") != 0 && newText.tqfind("+") < 0 && currentText.tqfind(newText) < 0) return newText; else - return TQString::null; + return TQString(); } void TopLevel::autoSearch() @@ -585,7 +585,7 @@ void TopLevel::setResults(unsigned int results, unsigned int fullNum) TQString str = i18n("%n result","%n results",results); if (results < fullNum) - str += i18n(" out of %1").arg(fullNum); + str += i18n(" out of %1").tqarg(fullNum); StatusBar->message(str); setCaption(str); @@ -610,8 +610,8 @@ void TopLevel::slotConfigure() //ConfigureDialog didn't find an instance of this dialog, so lets create it : optionDialog = new ConfigureDialog(this, "settings"); connect(optionDialog, TQT_SIGNAL(hidden()),this,TQT_SLOT(slotConfigureHide())); - connect(optionDialog, TQT_SIGNAL(settingsChanged()), this, TQT_SLOT(slotConfigurationChanged())); - connect(optionDialog, TQT_SIGNAL(valueChanged()), this, TQT_SIGNAL(quizConfChanged())); + connect(optionDialog, TQT_SIGNAL(settingsChanged()), TQT_TQOBJECT(this), TQT_SLOT(slotConfigurationChanged())); + connect(optionDialog, TQT_SIGNAL(valueChanged()), TQT_TQOBJECT(this), TQT_SIGNAL(quizConfChanged())); optionDialog->show(); return; @@ -625,7 +625,7 @@ void TopLevel::slotLearnConfigure() void TopLevel::slotConfigureHide() { - TQTimer::singleShot(0, this, TQT_SLOT(slotConfigureDestroy())); + TQTimer::singleShot(0, TQT_TQOBJECT(this), TQT_SLOT(slotConfigureDestroy())); } void TopLevel::slotConfigureDestroy() @@ -641,9 +641,9 @@ void TopLevel::createLearn() { Learn *_Learn = new Learn(_Asyndeta.retrieveIndex(), 0); - connect(_Learn, TQT_SIGNAL(destroyed(Learn *)), this, TQT_SLOT(learnDestroyed(Learn *))); - connect(_Learn, TQT_SIGNAL(linkClicked(const TQString &)), this, TQT_SLOT(ressearch(const TQString &))); - connect(_Learn, TQT_SIGNAL(configureLearn()), this, TQT_SLOT(slotLearnConfigure())); + connect(_Learn, TQT_SIGNAL(destroyed(Learn *)), TQT_TQOBJECT(this), TQT_SLOT(learnDestroyed(Learn *))); + connect(_Learn, TQT_SIGNAL(linkClicked(const TQString &)), TQT_TQOBJECT(this), TQT_SLOT(ressearch(const TQString &))); + connect(_Learn, TQT_SIGNAL(configureLearn()), TQT_TQOBJECT(this), TQT_SLOT(slotLearnConfigure())); connect(this, TQT_SIGNAL(quizConfChanged()), _Learn, TQT_SLOT(updateQuizConfiguration())); connect(this, TQT_SIGNAL(add(Dict::Entry)), _Learn, TQT_SLOT(add(Dict::Entry))); @@ -681,7 +681,7 @@ TQRegExp TopLevel::readingSearchItems(bool kanji) else regexp = "\\[%1\\]"; - regexp = regexp.arg(text); + regexp = regexp.tqarg(text); return TQRegExp(regexp, Config::caseSensitive()); } @@ -699,7 +699,7 @@ TQRegExp TopLevel::kanjiSearchItems(bool beginning) else regexp = "^%1\\W"; - regexp = regexp.arg(text); + regexp = regexp.tqarg(text); return TQRegExp(regexp, Config::caseSensitive()); } @@ -711,13 +711,13 @@ TQRegExp TopLevel::searchItems() if (text.isEmpty()) return TQRegExp(); //empty - unsigned int contains = text.contains(TQRegExp("[A-Za-z0-9_:]")); - if (Config::wholeWord() && contains == text.length()) + unsigned int tqcontains = text.tqcontains(TQRegExp("[A-Za-z0-9_:]")); + if (Config::wholeWord() && tqcontains == text.length()) regexp = "\\W%1\\W"; else regexp = "%1"; - regexp = regexp.arg(text); + regexp = regexp.tqarg(text); return TQRegExp(regexp, Config::caseSensitive()); } @@ -743,7 +743,7 @@ void TopLevel::newToolBarConfig() RadWidget *TopLevel::radicalSearch() { RadWidget *rw = new RadWidget(&_Rad, 0, "rw"); - connect(rw, TQT_SIGNAL(set(const TQStringList &, unsigned int, unsigned int)), this, TQT_SLOT(radSearch(const TQStringList &, unsigned int, unsigned int))); + connect(rw, TQT_SIGNAL(set(const TQStringList &, unsigned int, unsigned int)), TQT_TQOBJECT(this), TQT_SLOT(radSearch(const TQStringList &, unsigned int, unsigned int))); rw->show(); return rw; } @@ -772,12 +772,12 @@ void TopLevel::radSearch(const TQStringList &_list, unsigned int strokes, unsign already = true; } - hist.text = i18n("Radical(s): %1").arg(prettyRadicalString); + hist.text = i18n("Radical(s): %1").tqarg(prettyRadicalString); if (strokes) - hist.list.append(Dict::Entry(i18n("Kanji with radical(s) %1 and %2 strokes").arg(prettyRadicalString).arg(strokes), true)); + hist.list.append(Dict::Entry(i18n("Kanji with radical(s) %1 and %2 strokes").tqarg(prettyRadicalString).tqarg(strokes), true)); else - hist.list.append(Dict::Entry(i18n("Kanji with radical(s) %1").arg(prettyRadicalString), true)); + hist.list.append(Dict::Entry(i18n("Kanji with radical(s) %1").tqarg(prettyRadicalString), true)); TQString strokesString; if (strokes) @@ -800,7 +800,7 @@ void TopLevel::radSearch(const TQStringList &_list, unsigned int strokes, unsign for (it = list.begin(); it != list.end(); ++it) { - Dict::SearchResult results = _Asyndeta.retrieveIndex()->searchKanji(TQRegExp(strokes? (TQString("S%1 ").arg(strokesString)) : (TQString("^") + (*it)) ), (*it), comCB->isChecked()); + Dict::SearchResult results = _Asyndeta.retrieveIndex()->searchKanji(TQRegExp(strokes? (TQString("S%1 ").tqarg(strokesString)) : (TQString("^") + (*it)) ), (*it), comCB->isChecked()); hist.outOf += results.outOf; if (results.count < 1) |