summaryrefslogtreecommitdiffstats
path: root/kiten/learn.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-11 04:44:41 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-11 04:44:41 +0000
commita374efce3a207b39514be3c52264091400ce297e (patch)
tree77bdf654b55826d4f59b53a5621310206bcaead1 /kiten/learn.cpp
parentf81a494f3957d5cf38c787973415597941934727 (diff)
downloadtdeedu-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/learn.cpp')
-rw-r--r--kiten/learn.cpp86
1 files changed, 43 insertions, 43 deletions
diff --git a/kiten/learn.cpp b/kiten/learn.cpp
index 02b21618..79493131 100644
--- a/kiten/learn.cpp
+++ b/kiten/learn.cpp
@@ -46,8 +46,8 @@
#include "ksaver.h"
#include "learn.h"
-LearnItem::LearnItem(TQListView *parent, TQString label1, TQString label2, TQString label3, TQString label4, TQString label5, TQString label6, TQString label7, TQString label8)
- : TQListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8)
+LearnItem::LearnItem(TQListView *tqparent, TQString label1, TQString label2, TQString label3, TQString label4, TQString label5, TQString label6, TQString label7, TQString label8)
+ : TQListViewItem(tqparent, label1, label2, label3, label4, label5, label6, label7, label8)
{
}
@@ -60,10 +60,10 @@ int LearnItem::compare(TQListViewItem *item, int col, bool ascending) const
const int Learn::numberOfAnswers = 5;
-Learn::Learn(Dict::Index *parentDict, TQWidget *parent, const char *name)
- : KMainWindow(parent, name), initialized(false), isMod(false), prevItem(0), curItem(0)
+Learn::Learn(Dict::Index *tqparentDict, TQWidget *tqparent, const char *name)
+ : KMainWindow(tqparent, name), initialized(false), isMod(false), prevItem(0), curItem(0)
{
- index = parentDict;
+ index = tqparentDict;
TQWidget *dummy = new TQWidget(this);
setCentralWidget(dummy);
@@ -113,40 +113,40 @@ Learn::Learn(Dict::Index *parentDict, TQWidget *parent, const char *name)
grades.append(i18n("Others in Jouyou"));
grades.append(i18n("Jinmeiyou"));
- /*KAction *closeAction = */(void) KStdAction::close(this, TQT_SLOT(close()), actionCollection());
- printAct = KStdAction::print(this, TQT_SLOT(print()), actionCollection());
- forwardAct = KStdAction::forward(this, TQT_SLOT(next()), actionCollection());
+ /*KAction *closeAction = */(void) KStdAction::close(TQT_TQOBJECT(this), TQT_SLOT(close()), actionCollection());
+ printAct = KStdAction::print(TQT_TQOBJECT(this), TQT_SLOT(print()), actionCollection());
+ forwardAct = KStdAction::forward(TQT_TQOBJECT(this), TQT_SLOT(next()), actionCollection());
forwardAct->plug(toolBar());
- backAct = KStdAction::back(this, TQT_SLOT(prev()), actionCollection());
+ backAct = KStdAction::back(TQT_TQOBJECT(this), TQT_SLOT(prev()), actionCollection());
backAct->plug(toolBar());
- cheatAct = new KAction(i18n("&Cheat"), CTRL + Key_C, this, TQT_SLOT(cheat()), actionCollection(), "cheat");
- randomAct = new KAction(i18n("&Random"), "goto", CTRL + Key_R, this, TQT_SLOT(random()), actionCollection(), "random");
+ cheatAct = new KAction(i18n("&Cheat"), CTRL + Key_C, TQT_TQOBJECT(this), TQT_SLOT(cheat()), actionCollection(), "cheat");
+ randomAct = new KAction(i18n("&Random"), "goto", CTRL + Key_R, TQT_TQOBJECT(this), TQT_SLOT(random()), actionCollection(), "random");
gradeAct = new KListAction(i18n("Grade"), 0, 0, 0, actionCollection(), "grade");
gradeAct->setItems(grades);
connect(gradeAct, TQT_SIGNAL(activated(const TQString&)), TQT_SLOT(updateGrade()));
- removeAct = new KAction(i18n("&Delete"), "edit_remove", CTRL + Key_X, this, TQT_SLOT(del()), actionCollection(), "del");
- addAct = new KAction(i18n("&Add"), "edit_add", CTRL + Key_A, this, TQT_SLOT(add()), actionCollection(), "add");
- addAllAct = new KAction(i18n("Add A&ll"), 0, this, TQT_SLOT(addAll()), actionCollection(), "addall");
- newAct = KStdAction::openNew(this, TQT_SLOT(openNew()), actionCollection());
- openAct = KStdAction::open(this, TQT_SLOT(open()), actionCollection());
- saveAct = KStdAction::save(this, TQT_SLOT(save()), actionCollection());
- saveAsAct = KStdAction::saveAs(this, TQT_SLOT(saveAs()), actionCollection());
- (void) KStdAction::preferences(this, TQT_SIGNAL(configureLearn()), actionCollection());
+ removeAct = new KAction(i18n("&Delete"), "edit_remove", CTRL + Key_X, TQT_TQOBJECT(this), TQT_SLOT(del()), actionCollection(), "del");
+ addAct = new KAction(i18n("&Add"), "edit_add", CTRL + Key_A, TQT_TQOBJECT(this), TQT_SLOT(add()), actionCollection(), "add");
+ addAllAct = new KAction(i18n("Add A&ll"), 0, TQT_TQOBJECT(this), TQT_SLOT(addAll()), actionCollection(), "addall");
+ newAct = KStdAction::openNew(TQT_TQOBJECT(this), TQT_SLOT(openNew()), actionCollection());
+ openAct = KStdAction::open(TQT_TQOBJECT(this), TQT_SLOT(open()), actionCollection());
+ saveAct = KStdAction::save(TQT_TQOBJECT(this), TQT_SLOT(save()), actionCollection());
+ saveAsAct = KStdAction::saveAs(TQT_TQOBJECT(this), TQT_SLOT(saveAs()), actionCollection());
+ (void) KStdAction::preferences(TQT_TQOBJECT(this), TQT_SIGNAL(configureLearn()), actionCollection());
removeAct->setEnabled(false);
TQVBoxLayout *quizLayout = new TQVBoxLayout(quizTop, KDialog::marginHint(), KDialog::spacingHint());
quizLayout->addStretch();
- TQHBoxLayout *hlayout = new TQHBoxLayout(quizLayout);
+ TQHBoxLayout *htqlayout = new TQHBoxLayout(quizLayout);
qKanji = new TQPushButton(quizTop);
connect(qKanji, TQT_SIGNAL(clicked()), this, TQT_SLOT(qKanjiClicked()));
- hlayout->addStretch();
- hlayout->addWidget(qKanji);
- hlayout->addStretch();
+ htqlayout->addStretch();
+ htqlayout->addWidget(qKanji);
+ htqlayout->addStretch();
quizLayout->addStretch();
- answers = new TQButtonGroup(1, Horizontal, quizTop);
+ answers = new TQButtonGroup(1,Qt::Horizontal, quizTop);
for (int i = 0; i < numberOfAnswers; ++i)
answers->insert(new KPushButton(answers), i);
quizLayout->addWidget(answers);
@@ -299,7 +299,7 @@ void Learn::update()
TQString kanji = curKanji.kanji();
Dict::SearchResult compounds = index->search(TQRegExp(kanji), kanji, true);
- View->addHeader(i18n("%1 in compounds").arg(kanji));
+ View->addHeader(i18n("%1 in compounds").tqarg(kanji));
for (TQValueListIterator<Dict::Entry> it = compounds.list.begin(); it != compounds.list.end(); ++it)
{
@@ -315,12 +315,12 @@ void Learn::updateGrade()
int grade = getCurrentGrade();
TQString regexp("G%1 ");
- regexp = regexp.arg(grade);
+ regexp = regexp.tqarg(grade);
Dict::SearchResult result = index->searchKanji(TQRegExp(regexp), regexp, false);
list = result.list;
- statusBar()->message(i18n("%1 entries in grade %2").arg(list.count()).arg(grade));
+ statusBar()->message(i18n("%1 entries in grade %2").tqarg(list.count()).tqarg(grade));
list.remove(list.begin());
current = list.begin();
@@ -351,7 +351,7 @@ void Learn::read(const KURL &url)
// ignore whitespace
if (!kanji.isSpace())
{
- TQRegExp regexp ( TQString("^%1\\W").arg(kanji) );
+ TQRegExp regexp ( TQString("^%1\\W").tqarg(kanji) );
Dict::SearchResult res = index->searchKanji(regexp, kanji, false);
Dict::Entry first = Dict::firstEntry(res);
if (first.extendedKanjiInfo())
@@ -368,7 +368,7 @@ void Learn::open()
return;
KURL prevname = filename;
- filename = KFileDialog::getOpenURL(TQString::null, "*.kiten");
+ filename = KFileDialog::getOpenURL(TQString(), "*.kiten");
if (filename.isEmpty())
{
filename = prevname;
@@ -407,7 +407,7 @@ void Learn::openNew()
void Learn::saveAs()
{
KURL prevname = filename;
- filename = KFileDialog::getSaveURL(TQString::null, "*.kiten");
+ filename = KFileDialog::getSaveURL(TQString(), "*.kiten");
if (filename.isEmpty())
{
filename = prevname;
@@ -444,7 +444,7 @@ void Learn::write(const KURL &url)
stream.setCodec(&codec);
for (TQListViewItemIterator it(List); it.current(); ++it)
- stream << it.current()->text(0).at(0);
+ stream << it.current()->text(0).tqat(0);
if (!saver.close())
{
@@ -456,7 +456,7 @@ void Learn::write(const KURL &url)
setClean();
- statusBar()->message(i18n("%1 written").arg(url.prettyURL()));
+ statusBar()->message(i18n("%1 written").tqarg(url.prettyURL()));
}
void Learn::saveScores()
@@ -473,8 +473,8 @@ void Learn::add(Dict::Entry toAdd, bool noEmit)
{
// Remove peripheral readings: This is a study mode, not a reference mode
TQRegExp inNames (",\\s*[A-Za-z ]+:.*");
- TQString readings = Dict::prettyKanjiReading(toAdd.readings()).replace(inNames, "");
- TQString meanings = shortenString(Dict::prettyMeaning(toAdd.meanings()).replace(inNames, ""));
+ TQString readings = Dict::prettyKanjiReading(toAdd.readings()).tqreplace(inNames, "");
+ TQString meanings = shortenString(Dict::prettyMeaning(toAdd.meanings()).tqreplace(inNames, ""));
TQString kanji = toAdd.kanji();
// here's a dirty rotten cheat (well, not really)
@@ -485,13 +485,13 @@ void Learn::add(Dict::Entry toAdd, bool noEmit)
{
if (it.current()->text(0) == kanji)
{
- statusBar()->message(i18n("%1 already on your list").arg(kanji));
+ statusBar()->message(i18n("%1 already on your list").tqarg(kanji));
return;
}
}
}
- statusBar()->message(i18n("%1 added to your list").arg(kanji));
+ statusBar()->message(i18n("%1 added to your list").tqarg(kanji));
KConfig &config = *Config::self()->config();
int score = 0;
@@ -515,7 +515,7 @@ void Learn::addAll()
int grade = getCurrentGrade();
TQString regexp("G%1 ");
- regexp = regexp.arg(grade);
+ regexp = regexp.tqarg(grade);
Dict::SearchResult result = index->searchKanji(TQRegExp(regexp), regexp, false);
for (TQValueListIterator<Dict::Entry> i = result.list.begin(); i != result.list.end(); ++i)
@@ -607,7 +607,7 @@ void Learn::del()
void Learn::print()
{
View->clear();
- View->addHeader(TQString("<h1>%1</h1>").arg(i18n("Learning List")), 1);
+ View->addHeader(TQString("<h1>%1</h1>").tqarg(i18n("Learning List")), 1);
TQListViewItemIterator it(List);
for (; it.current(); ++it)
@@ -730,7 +730,7 @@ TQString Learn::randomMeaning(TQStringList &oldMeanings)
}
//kdDebug() << "curMeaning: " << curItem->text(guessOn) << endl;
}
- while (oldMeanings.contains(meaning) || meaning == curItem->text(guessOn));
+ while (oldMeanings.tqcontains(meaning) || meaning == curItem->text(guessOn));
oldMeanings.append(meaning);
meaning = shortenString(meaning);
@@ -755,9 +755,9 @@ void Learn::qupdate()
TQStringList oldMeanings;
for (int i = 0; i < numberOfAnswers; ++i)
- answers->find(i)->setText(randomMeaning(oldMeanings));
+ answers->tqfind(i)->setText(randomMeaning(oldMeanings));
- answers->find(seikai)->setText(curItem->text(guessOn));
+ answers->tqfind(seikai)->setText(curItem->text(guessOn));
}
struct Learn::scoreCompare
@@ -774,7 +774,7 @@ void Learn::qnew() // new quiz kanji
nogood = false;
statusBar()->clear();
- statusBar()->message(TQString("%1 %2 %3").arg(curItem->text(0)).arg(curItem->text(1)).arg(curItem->text(2)));
+ statusBar()->message(TQString("%1 %2 %3").tqarg(curItem->text(0)).tqarg(curItem->text(1)).tqarg(curItem->text(2)));
backAct->setEnabled(true);
@@ -834,7 +834,7 @@ void Learn::qnew() // new quiz kanji
void Learn::cheat()
{
- answers->find(seikai)->setFocus();
+ answers->tqfind(seikai)->setFocus();
statusBar()->message(i18n("Better luck next time"));
nogood = true;
}