diff options
Diffstat (limited to 'khangman')
-rw-r--r-- | khangman/README.languages | 2 | ||||
-rw-r--r-- | khangman/khangman/khangman.cpp | 38 | ||||
-rw-r--r-- | khangman/khangman/khangmanview.cpp | 82 | ||||
-rw-r--r-- | khangman/khangman/khnewstuff.cpp | 4 |
4 files changed, 63 insertions, 63 deletions
diff --git a/khangman/README.languages b/khangman/README.languages index b0d2bf07..d72a7a72 100644 --- a/khangman/README.languages +++ b/khangman/README.languages @@ -25,7 +25,7 @@ cd kdeedu/khangman ./add_language <language_code> - Here you must tqreplace <language_code> with your language code. + Here you must replace <language_code> with your language code. The program will refuse a non-valid language code! diff --git a/khangman/khangman/khangman.cpp b/khangman/khangman/khangman.cpp index e478d804..79d8f43a 100644 --- a/khangman/khangman/khangman.cpp +++ b/khangman/khangman/khangman.cpp @@ -90,7 +90,7 @@ void KHangMan::setupActions() // Action for selecting language. m_languageAction = new KSelectAction(i18n("&Language"), 0, actionCollection(), "languages"); m_languageAction->setItems(m_languageNames); - m_languageAction->setCurrentItem(m_languages.tqfindIndex(Prefs::selectedLanguage())); + m_languageAction->setCurrentItem(m_languages.findIndex(Prefs::selectedLanguage())); connect(m_languageAction, TQT_SIGNAL(activated(int)), TQT_TQOBJECT(this), TQT_SLOT(slotChangeLanguage(int))); KStdAction::preferences(TQT_TQOBJECT(this), TQT_SLOT(optionsPreferences()), actionCollection()); @@ -150,7 +150,7 @@ void KHangMan::slotChangeLevel(int index) changeStatusbar("", IDS_ACCENTS); #endif Prefs::setCurrentLevel(index); - levelString.tqreplace(0, 1, levelString.left(1).lower()); + levelString.replace(0, 1, levelString.left(1).lower()); Prefs::setLevelFile(levelString +".kvtml"); Prefs::writeConfig(); m_view->slotNewGame(); @@ -159,12 +159,12 @@ void KHangMan::slotChangeLevel(int index) void KHangMan::slotChangeLanguage(int index) { //good when no in English - kdDebug() << "Change to " << m_languages[m_languageNames.tqfindIndex(m_languageNames[index])] << endl; - Prefs::setSelectedLanguage(m_languages[m_languageNames.tqfindIndex(m_languageNames[index])]); + kdDebug() << "Change to " << m_languages[m_languageNames.findIndex(m_languageNames[index])] << endl; + Prefs::setSelectedLanguage(m_languages[m_languageNames.findIndex(m_languageNames[index])]); Prefs::writeConfig(); loadLevels(); loadLangToolBar(); - changeStatusbar(m_languageNames[m_languages.tqfindIndex(Prefs::selectedLanguage())], IDS_LANG); + changeStatusbar(m_languageNames[m_languages.findIndex(Prefs::selectedLanguage())], IDS_LANG); setAccent(); setMessages(); m_view->slotNewGame(); @@ -196,8 +196,8 @@ void KHangMan::setLanguages() for (TQStringList::Iterator it =mdirs.begin(); it !=mdirs.end(); ++it ) { TQDir dir(*it); m_languages += dir.entryList(TQDir::Dirs, TQDir::Name); - m_languages.remove(m_languages.tqfind(".")); - m_languages.remove(m_languages.tqfind("..")); + m_languages.remove(m_languages.find(".")); + m_languages.remove(m_languages.find("..")); } m_languages.sort(); @@ -209,7 +209,7 @@ void KHangMan::setLanguages() TQStringList temp_languages; for (uint i=0; i<m_languages.count(); i++) { - if (m_languages.tqcontains(m_languages[i])>1) { + if (m_languages.contains(m_languages[i])>1) { temp_languages.append(m_languages[i]); m_languages.remove(m_languages[i]); } @@ -261,7 +261,7 @@ void KHangMan::loadSettings() selectedLanguage = Prefs::selectedLanguage(); if (m_languages.grep(selectedLanguage).isEmpty()) selectedLanguage = "en"; - changeStatusbar(m_languageNames[m_languages.tqfindIndex(Prefs::selectedLanguage())], IDS_LANG); + changeStatusbar(m_languageNames[m_languages.findIndex(Prefs::selectedLanguage())], IDS_LANG); // Show/hide characters toolbar if (Prefs::showCharToolbar()) secondToolbar->show(); @@ -276,8 +276,8 @@ void KHangMan::setLevel() if (currentLevel > (uint) levels.count()) currentLevel= 0; levelString = levels[currentLevel]; - levelString.tqreplace(0, 1, levelString.left(1).lower()); - levelString = levels[currentLevel].tqreplace(0, 1, levels[currentLevel].left(1).lower()) ; + levelString.replace(0, 1, levelString.left(1).lower()); + levelString = levels[currentLevel].replace(0, 1, levels[currentLevel].left(1).lower()) ; } void KHangMan::loadLevels() @@ -292,14 +292,14 @@ void KHangMan::loadLevels() for (TQStringList::Iterator it = mfiles.begin(); it != mfiles.end(); ++it ) { TQFile f( *it); //find the last / in the file name - int location = f.name().tqfindRev("/"); + int location = f.name().findRev("/"); //strip the string to keep only the filename and not the path TQString mString = f.name().right(f.name().length()-location-1); if (mString == Prefs::levelFile()) levelBool = true; mString = mString.left(mString.length()-6); //Put the first letter in Upper case - mString = mString.tqreplace(0, 1, mString.left(1).upper()); + mString = mString.replace(0, 1, mString.left(1).upper()); levels+=mString; } //TODO else tell no files had been found @@ -307,13 +307,13 @@ void KHangMan::loadLevels() // Sort easy, medium, hard at bottom, with the other categories at the top levels.sort(); - TQString tqreplace[3] = { "Easy", "Medium", "Hard" }; + TQString replace[3] = { "Easy", "Medium", "Hard" }; for ( int i = 0; i < 3; ++i ) { - if ( levels.tqfindIndex( tqreplace[i] ) > -1 ) + if ( levels.findIndex( replace[i] ) > -1 ) { - levels.remove( tqreplace[i] ); - levels.append( tqreplace[i] ); + levels.remove( replace[i] ); + levels.append( replace[i] ); } } @@ -338,7 +338,7 @@ void KHangMan::loadLevels() if (levelBool == false) { - Prefs::setLevelFile(levels[0].tqreplace(0, 1, levels[0].left(1).lower())+".kvtml"); + Prefs::setLevelFile(levels[0].replace(0, 1, levels[0].left(1).lower())+".kvtml"); Prefs::setCurrentLevel(0); currentLevel =0; Prefs::writeConfig(); @@ -351,7 +351,7 @@ void KHangMan::loadLevels() setLevel(); TQString m_lstring = translatedLevels[currentLevel].utf8(); - m_lstring.tqreplace(0, 1, m_lstring.left(1).upper()); + m_lstring.replace(0, 1, m_lstring.left(1).upper()); changeStatusbar(m_lstring, IDS_LEVEL); } diff --git a/khangman/khangman/khangmanview.cpp b/khangman/khangman/khangmanview.cpp index 82dd4485..34269d9a 100644 --- a/khangman/khangman/khangmanview.cpp +++ b/khangman/khangman/khangmanview.cpp @@ -102,30 +102,30 @@ void KHangManView::replaceLetters(const TQString& sChar) // Replace letter in the word if (Prefs::oneLetter()) { // We just replace the next instance. - for (int count=0; count < m_word.tqcontains(sChar, false); count++) { + for (int count=0; count < m_word.contains(sChar, false); count++) { - index = m_word.tqfind(sChar, index, false); + index = m_word.find(sChar, index, false); if (m_goodWord.at(2*index)=='_') { - m_goodWord.tqreplace((2*index), 1, m_word.at(index)); + m_goodWord.replace((2*index), 1, m_word.at(index)); kdDebug() << "m_goodword " << m_goodWord << endl; - if (count == m_word.tqcontains(sChar, false)-1) + if (count == m_word.contains(sChar, false)-1) b_end = true; break; } else index++; - if (count == m_word.tqcontains(sChar, false)-1) + if (count == m_word.contains(sChar, false)-1) b_end = true; } } else { - for (int count=0; count < m_word.tqcontains(sChar, false); count++) { + for (int count=0; count < m_word.contains(sChar, false); count++) { //searching for letter location - index = m_word.tqfind(sChar, index, false); + index = m_word.find(sChar, index, false); //we replace it... - m_goodWord.tqreplace((2*index), 1,m_word.at(index)); + m_goodWord.replace((2*index), 1,m_word.at(index)); index++; } } @@ -146,7 +146,7 @@ void KHangManView::replaceLetters(const TQString& sChar) if (!Prefs::oneLetter()) m_guessedLetters << sChar; //appends the list only if not in One Letter only mode... - if (m_word.tqcontains(sChar, false) == 1) + if (m_word.contains(sChar, false) == 1) m_guessedLetters << sChar; //append if only one instance if (Prefs::oneLetter() && b_end) @@ -159,28 +159,28 @@ bool KHangManView::containsChar(const TQString &sChar) bool b = false; if (m_accentedLetters && !Prefs::accentedLetters()) { if (sChar=="i") - b = m_word.tqcontains(TQString::fromUtf8("í"), false); + b = m_word.contains(TQString::fromUtf8("í"), false); if (sChar=="a") - b = m_word.tqcontains(TQString::fromUtf8("à"), false) - || m_word.tqcontains(TQString::fromUtf8("á"), false) - || m_word.tqcontains(TQString::fromUtf8("ã"), false); + b = m_word.contains(TQString::fromUtf8("à"), false) + || m_word.contains(TQString::fromUtf8("á"), false) + || m_word.contains(TQString::fromUtf8("ã"), false); if (sChar=="u") - b = m_word.tqcontains(TQString::fromUtf8("ü"), false) - || m_word.tqcontains(TQString::fromUtf8("ù"), false); + b = m_word.contains(TQString::fromUtf8("ü"), false) + || m_word.contains(TQString::fromUtf8("ù"), false); if (sChar=="o") - b = m_word.tqcontains(TQString::fromUtf8("ò"), false) - || m_word.tqcontains(TQString::fromUtf8("ó"), false) - || m_word.tqcontains(TQString::fromUtf8("õ"), false); + b = m_word.contains(TQString::fromUtf8("ò"), false) + || m_word.contains(TQString::fromUtf8("ó"), false) + || m_word.contains(TQString::fromUtf8("õ"), false); if (sChar=="e") - b = m_word.tqcontains(TQString::fromUtf8("è"), false) - || m_word.tqcontains(TQString::fromUtf8("é"), false); + b = m_word.contains(TQString::fromUtf8("è"), false) + || m_word.contains(TQString::fromUtf8("é"), false); } - return (b || m_word.tqcontains(sChar, false)); + return (b || m_word.contains(sChar, false)); } @@ -379,7 +379,7 @@ void KHangManView::slotTry() } // Handle the guess. - if (!m_guessedLetters.tqcontains(guess.lower())) { + if (!m_guessedLetters.contains(guess.lower())) { // The letter is not already guessed. if (containsChar(guess)) { @@ -389,11 +389,11 @@ void KHangManView::slotTry() TQString stripWord = m_goodWord; TQString sword = m_word; if (dd > 0) { - stripWord.tqreplace(2*c, 1, ""); - stripWord.tqreplace(2*c-1, 1, ""); + stripWord.replace(2*c, 1, ""); + stripWord.replace(2*c-1, 1, ""); - stripWord.tqreplace(2*(dd-1), 1, ""); - stripWord.tqreplace(2*(dd-1)-1, 1, ""); + stripWord.replace(2*(dd-1), 1, ""); + stripWord.replace(2*(dd-1)-1, 1, ""); } TQStringList rightChars = TQStringList::split(" ", stripWord, true); @@ -442,7 +442,7 @@ void KHangManView::slotTry() m_guessedLetters << guess.lower(); m_guessedLetters << guess.upper(); - m_missedLetters = m_missedLetters.tqreplace((2 * m_numMissedLetters), + m_missedLetters = m_missedLetters.replace((2 * m_numMissedLetters), 1, guess.lower()); m_numMissedLetters++; update(); @@ -496,7 +496,7 @@ void KHangManView::slotTry() int x = 0; int y = 0; - if (m_missedLetters.tqcontains(guess, false) > 0) { + if (m_missedLetters.contains(guess, false) > 0) { // FIXME: popup should be better placed. TQPoint abspos = popup->pos(); @@ -513,7 +513,7 @@ void KHangManView::slotTry() m_letterInput->setEnabled(false); } - if (m_goodWord.tqcontains(guess, false) > 0) { + if (m_goodWord.contains(guess, false) > 0) { TQPoint abspos = popup->pos(); if (Prefs::mode() == 0) { @@ -631,35 +631,35 @@ void KHangManView::game() // If needed, display white space or - if in word or semi dot. // 1. Find dashes. - int f = m_word.tqfind( "-" ); + int f = m_word.find( "-" ); if (f>0) { - m_goodWord.tqreplace(2*f, 1, "-"); + m_goodWord.replace(2*f, 1, "-"); - int g = m_word.tqfind( "-", f+1); + int g = m_word.find( "-", f+1); if (g>0) - m_goodWord.tqreplace(2*g, 3, "-"); + m_goodWord.replace(2*g, 3, "-"); if (g>1) m_goodWord.append("_"); } // 2. Find white space. - c = m_word.tqfind( " " ); + c = m_word.find( " " ); if (c > 0) { - m_goodWord.tqreplace(2*c, 1, " "); - dd = m_word.tqfind( " ", c+1); + m_goodWord.replace(2*c, 1, " "); + dd = m_word.find( " ", c+1); if (dd > 0) - m_goodWord.tqreplace(2*dd, c+1, " "); + m_goodWord.replace(2*dd, c+1, " "); } // 3. Find · - int e = m_word.tqfind( TQString::fromUtf8("·") ); + int e = m_word.find( TQString::fromUtf8("·") ); if (e>0) - m_goodWord.tqreplace(2*e, 1, TQString::fromUtf8("·") ); + m_goodWord.replace(2*e, 1, TQString::fromUtf8("·") ); // 4. Find ' - int h = m_word.tqfind( "'" ); + int h = m_word.find( "'" ); if (h>0) - m_goodWord.tqreplace(2*h, 1, "'"); + m_goodWord.replace(2*h, 1, "'"); } diff --git a/khangman/khangman/khnewstuff.cpp b/khangman/khangman/khnewstuff.cpp index efc816e5..b4eaa512 100644 --- a/khangman/khangman/khnewstuff.cpp +++ b/khangman/khangman/khnewstuff.cpp @@ -55,8 +55,8 @@ bool KHNewStuff::install( const TQString &fileName ) m_view->khangman->setLanguages(); //refresh Languages menu m_view->khangman->m_languageAction->setItems(m_view->khangman->m_languageNames); - m_view->khangman->slotChangeLanguage(m_view->khangman->m_languages.tqfindIndex(Prefs::selectedLanguage())); - m_view->khangman->m_languageAction->setCurrentItem(m_view->khangman->m_languages.tqfindIndex(Prefs::selectedLanguage())); + m_view->khangman->slotChangeLanguage(m_view->khangman->m_languages.findIndex(Prefs::selectedLanguage())); + m_view->khangman->m_languageAction->setCurrentItem(m_view->khangman->m_languages.findIndex(Prefs::selectedLanguage())); return true; } |